From 7aea984e34bd7eb606a8a3a07d31ed9613fc14d2 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 22 May 2020 11:32:38 +0800 Subject: [PATCH] bind wechat only one time --- test_client/src/views/question/questioncreate.vue | 5 +++++ test_client/src/views/question/questionupdate.vue | 5 +++++ test_server/crm/views.py | 2 ++ 3 files changed, 12 insertions(+) diff --git a/test_client/src/views/question/questioncreate.vue b/test_client/src/views/question/questioncreate.vue index 3d96ae8..3b414aa 100644 --- a/test_client/src/views/question/questioncreate.vue +++ b/test_client/src/views/question/questioncreate.vue @@ -133,6 +133,11 @@ export default { if (valid) { this.submitLoding = true this.Form.questioncat = this.Form.questioncat.pop() + for(let key in this.Form.options){ + if(!this.Form.options[key]){ + delete this.Form.options[key] + } + } createQuestion(this.Form).then(response => { this.submitLoding = false if(response.code >= 200){ diff --git a/test_client/src/views/question/questionupdate.vue b/test_client/src/views/question/questionupdate.vue index f79b6a5..58d6699 100644 --- a/test_client/src/views/question/questionupdate.vue +++ b/test_client/src/views/question/questionupdate.vue @@ -137,6 +137,11 @@ export default { if(this.Form.questioncat instanceof Array){ this.Form.questioncat = this.Form.questioncat.pop() } + for(let key in this.Form.options){ + if(!this.Form.options[key]){ + delete this.Form.options[key] + } + } updateQuestion(this.Form.id, this.Form).then(response => { this.submitLoding = false if(response.code >= 200){ diff --git a/test_server/crm/views.py b/test_server/crm/views.py index 53e12c3..8e02da2 100644 --- a/test_server/crm/views.py +++ b/test_server/crm/views.py @@ -286,6 +286,8 @@ class ConsumerRegister(APIView): consumer_queryset = Consumer.objects.filter(username=phone) if consumer_queryset.exists(): # 是否存在 consumer = consumer_queryset.first() + if consumer.openid: + return Response({'error':'该号码已使用!'}) openid = request.user.openid request.user.delete(soft=False) # 彻底删除 consumer.openid = openid