From d83e452e4c21ce49ce72565af253b8eebe7c3856 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Wed, 14 Aug 2019 13:46:43 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E4=BC=98=E5=8C=96=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=8A=A5=E5=90=8D]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/radetail/joinActivity/edit.js | 51 ++++++++++++++------------- pages/radetail/joinActivity/edit.wxml | 10 +++--- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/pages/radetail/joinActivity/edit.js b/pages/radetail/joinActivity/edit.js index 8007854..24b0539 100644 --- a/pages/radetail/joinActivity/edit.js +++ b/pages/radetail/joinActivity/edit.js @@ -10,6 +10,7 @@ Page({ data: { navigationBarHeight, date: '1988-03-12', + selectques: { "sex": 0, "name": 0, "birth": 0, "phone": 0, "address": 0 }, flag: 1, answerflag: "", flagsex: 0, @@ -60,21 +61,21 @@ Page({ index1: e.detail.value }) }, - // address: function() { - // let that = this; - // wx.chooseLocation({ - // success: function(res) { - // that.setData({ - // address: res.name + '(' + res.address + ')', - // addressStr: JSON.stringify(res) - // }) - // }, - // fail: function(error) { - // console.log(error) - // }, - // complete: function(data) {} - // }) - // }, + address: function() { + let that = this; + wx.chooseLocation({ + success: function(res) { + that.setData({ + address: res.name + '(' + res.address + ')', + addressStr: JSON.stringify(res) + }) + }, + fail: function(error) { + console.log(error) + }, + complete: function(data) {} + }) + }, change(value){ console.log(value) }, @@ -91,11 +92,11 @@ Page({ } else { var sex = that.data.sex; } - // if (that.data.addressStr) { - // var address = that.data.addressStr; - // } else { - // var address = null; - // } + if (that.data.addressStr) { + var address = that.data.addressStr; + } else { + var address = null; + } if (e.detail.value.username) { var username = e.detail.value.username; } else if (that.data.username) { @@ -136,12 +137,13 @@ Page({ }); } - if (username == null || sex == 0 || birthday == null) { + if ((username == null && this.data.selectques.name == 1) || (sex == 0 && this.data.selectques.sex == 1) || (birthday == null && this.data.selectques.birthday == 1)) { wx.showToast({ title: '请输入完整的用户信息', icon: "none" }) - } else { + } + else { if (this.data.answerflag == 'noanswer'){ }else{ that.setData({ @@ -150,7 +152,7 @@ Page({ let data ={}; data = { sex: sex, - // address: address, + address: address, name: username, birthday: birthday, answer: JSON.stringify(that.data.answer), @@ -266,7 +268,8 @@ Page({ if (res && res.data && res.data.activity) { this.setData({ useImg: res.data.activity.useImg, - imgDetail: res.data.activity.imgDetail + imgDetail: res.data.activity.imgDetail, + selectques: JSON.parse(res.data.activity.selectques) }) if (res.data && res.data.activity && res.data.activity.question) { that.setData({ diff --git a/pages/radetail/joinActivity/edit.wxml b/pages/radetail/joinActivity/edit.wxml index 840710a..9b3449b 100644 --- a/pages/radetail/joinActivity/edit.wxml +++ b/pages/radetail/joinActivity/edit.wxml @@ -2,19 +2,19 @@
- + 姓名 - + 生日 {{date}} - + 性别 @@ -22,11 +22,11 @@ - + 调查问卷