|
@@ -8,6 +8,7 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
+ showSchool:false,
|
|
|
sexList: [{label:'男',value:1},{label:'女',value:2}],
|
|
|
form: {schoolName:''},
|
|
|
areaList: [],
|
|
@@ -88,12 +89,53 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- bindPickerSchool (e) {
|
|
|
- const id = e.currentTarget.id;
|
|
|
- const value = e.detail.value
|
|
|
+ handlePickerSchool (e) {
|
|
|
+ const id = this.data.form.area
|
|
|
+ if (id) {
|
|
|
+ const value = e.detail.value
|
|
|
+ imine.querySchoolByAreaId({
|
|
|
+ reqdata: {
|
|
|
+ id,
|
|
|
+ keyword: value
|
|
|
+ }
|
|
|
+ }, res => {
|
|
|
+ this.setData({
|
|
|
+ schoolList: res.list
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ title: '请先选择区域',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.setData({
|
|
|
+ // ['form.'+id]: this.data.schoolList[value].id,
|
|
|
+ // ['form.schoolName']: this.data.schoolList[value].schoolName
|
|
|
+ // })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleShowSchool () {
|
|
|
+ if (this.data.schoolList.length) {
|
|
|
+ this.setData({
|
|
|
+ showSchool: true
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ wx.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ title: '请先选择区域'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ handleChooseSchool (e) {
|
|
|
+ let item = e.currentTarget.dataset.item
|
|
|
+ console.log(item)
|
|
|
+ // @todo 给学校赋值,并且关闭输入框
|
|
|
this.setData({
|
|
|
- ['form.'+id]: this.data.schoolList[value].id,
|
|
|
- ['form.schoolName']: this.data.schoolList[value].schoolName
|
|
|
+ showSchool:false
|
|
|
})
|
|
|
},
|
|
|
|