|
@@ -9,22 +9,45 @@ Page({
|
|
*/
|
|
*/
|
|
data: {
|
|
data: {
|
|
sexList: [{label:'男',value:1},{label:'女',value:2}],
|
|
sexList: [{label:'男',value:1},{label:'女',value:2}],
|
|
- form: {},
|
|
|
|
|
|
+ form: {schoolName:''},
|
|
areaList: [],
|
|
areaList: [],
|
|
sortList: [
|
|
sortList: [
|
|
{name:'actualName',title:'姓名'},
|
|
{name:'actualName',title:'姓名'},
|
|
{name:'sex',title:'性别'},
|
|
{name:'sex',title:'性别'},
|
|
- {name:'age',title:'年龄'},
|
|
|
|
|
|
+ {name:'birthday',title:'生日'},
|
|
{name:'area',title:'区域'},
|
|
{name:'area',title:'区域'},
|
|
{name:'school',title:'学校'},
|
|
{name:'school',title:'学校'},
|
|
{name:'grade',title:'年级'}
|
|
{name:'grade',title:'年级'}
|
|
],
|
|
],
|
|
- jgList: [true,true,true,true,true,true]
|
|
|
|
|
|
+ ageList: [],
|
|
|
|
+ gradeList: [
|
|
|
|
+ {label:'一年级',value:'一年级'},
|
|
|
|
+ {label:'二年级',value:'二年级'},
|
|
|
|
+ {label:'三年级',value:'三年级'},
|
|
|
|
+ {label:'四年级',value:'四年级'},
|
|
|
|
+ {label:'五年级',value:'五年级'},
|
|
|
|
+ {label:'六年级',value:'六年级'},
|
|
|
|
+ {label:'七年级',value:'七年级'},
|
|
|
|
+ {label:'八年级',value:'八年级'},
|
|
|
|
+ {label:'九年级',value:'九年级'},
|
|
|
|
+ {label:'高一',value:'高一'},
|
|
|
|
+ {label:'高二',value:'高二'},
|
|
|
|
+ {label:'高三',value:'高三'}
|
|
|
|
+ ],
|
|
|
|
+ schoolList: [],
|
|
|
|
+ jgList: [true,true,true,true,true,true],
|
|
|
|
+ statusBar: 0
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ goHome (e) {
|
|
|
|
+ wx.reLaunch({
|
|
|
|
+ url: '/pages/home/home',
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
|
|
changeInput (e) {
|
|
changeInput (e) {
|
|
const id = e.currentTarget.id;
|
|
const id = e.currentTarget.id;
|
|
- let value = (id === 'age' ? e.detail.value.replace(/\D/g, '')-0 : e.detail.value)
|
|
|
|
|
|
+ let value = (id === 'actualName' ? e.detail.value.replace(/[^\u4E00-\u9FA5]/g, '') : e.detail.value)
|
|
this.setData({
|
|
this.setData({
|
|
['form.'+id]: value
|
|
['form.'+id]: value
|
|
})
|
|
})
|
|
@@ -38,11 +61,30 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- bindPickerSex (e) {
|
|
|
|
|
|
+ bindPickerData (e) {
|
|
|
|
+ const id = e.currentTarget.id;
|
|
|
|
+ const value = this.formatYMD(e.detail.value)
|
|
|
|
+ this.setData({
|
|
|
|
+ ['form.'+id]: value
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ formatYMD (time) {
|
|
|
|
+ let date = new Date(time)
|
|
|
|
+ let y = date.getFullYear()
|
|
|
|
+ let m = date.getMonth() + 1
|
|
|
|
+ m = m < 10 ? '0' + m : m
|
|
|
|
+ let d = date.getDate()
|
|
|
|
+ d = d < 10 ? '0' + d : d
|
|
|
|
+ return y + '-' + m + '-' + d
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ bindPicker (e) {
|
|
const id = e.currentTarget.id;
|
|
const id = e.currentTarget.id;
|
|
|
|
+ const list = e.currentTarget.dataset.list
|
|
const value = e.detail.value
|
|
const value = e.detail.value
|
|
this.setData({
|
|
this.setData({
|
|
- ['form.'+id]: this.data.sexList[value].value
|
|
|
|
|
|
+ ['form.'+id]: this.data[list][value].value
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
@@ -50,7 +92,7 @@ Page({
|
|
const id = e.currentTarget.id;
|
|
const id = e.currentTarget.id;
|
|
const value = e.detail.value
|
|
const value = e.detail.value
|
|
this.setData({
|
|
this.setData({
|
|
- ['form.'+id]: this.data.areaList[value].id,
|
|
|
|
|
|
+ ['form.'+id]: this.data.schoolList[value].id,
|
|
['form.schoolName']: this.data.schoolList[value].schoolName
|
|
['form.schoolName']: this.data.schoolList[value].schoolName
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -65,16 +107,21 @@ Page({
|
|
imine.querySchoolByAreaId({reqdata:{
|
|
imine.querySchoolByAreaId({reqdata:{
|
|
id: this.data.form[id]
|
|
id: this.data.form[id]
|
|
}},r => {
|
|
}},r => {
|
|
|
|
+ let list = r.list
|
|
|
|
+ let index = list.findIndex(item=>item.schoolName.includes('其他'))
|
|
|
|
+ let obj = list.splice(index,1)
|
|
|
|
+ list.push(obj[0])
|
|
this.setData({
|
|
this.setData({
|
|
- schoolList: r.list,
|
|
|
|
- ['form.school']: null
|
|
|
|
|
|
+ schoolList: list,
|
|
|
|
+ ['form.school']: null,
|
|
|
|
+ ['form.schoolName']: ''
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
submit (e) {
|
|
submit (e) {
|
|
- let {actualName,sex,age,area,grade,other,school} = this.data.form
|
|
|
|
|
|
+ let {actualName,sex,birthday,area,grade,other,school} = this.data.form
|
|
let {sortList} = this.data
|
|
let {sortList} = this.data
|
|
this.setData({
|
|
this.setData({
|
|
jgList: sortList.map(item => !!this.data.form[item.name])
|
|
jgList: sortList.map(item => !!this.data.form[item.name])
|
|
@@ -84,10 +131,24 @@ Page({
|
|
return
|
|
return
|
|
}
|
|
}
|
|
let id = wx.getStorageSync('id')
|
|
let id = wx.getStorageSync('id')
|
|
- imine.updateUser({reqdata:{actualName,sex,age,area,grade,other,school,id}},r => {
|
|
|
|
|
|
+ imine.updateUser({reqdata:{actualName,sex,birthday,area,grade,other,school,id}},r => {
|
|
this.loadMyinformation()
|
|
this.loadMyinformation()
|
|
- wx.navigateTo({
|
|
|
|
- url: '/pages/contest/answer/answer'
|
|
|
|
|
|
+ wx.showModal({
|
|
|
|
+ title: '答题须知:',
|
|
|
|
+ content: '1.每人每天最多答题三次\n\n 2.排行榜以得分情况计算',
|
|
|
|
+ confirmColor: '#ff0000',
|
|
|
|
+ cancelText: '返回',
|
|
|
|
+ success (res) {
|
|
|
|
+ if (res.confirm) {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '/pages/contest/answer/answer'
|
|
|
|
+ })
|
|
|
|
+ } else if (res.cancel) {
|
|
|
|
+ wx.reLaunch({
|
|
|
|
+ url: '/pages/home/home',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
})
|
|
@@ -113,6 +174,23 @@ Page({
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
this.queryAllArea()
|
|
this.queryAllArea()
|
|
|
|
+ wx.getSystemInfo({
|
|
|
|
+ success: e => {
|
|
|
|
+ this.setData({
|
|
|
|
+ statusBar: e.statusBarHeight + 13
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ let {ageList} = this.data
|
|
|
|
+
|
|
|
|
+ for (let index = 0; index < 100; index++) {
|
|
|
|
+ // const element = array[index];
|
|
|
|
+ ageList[index] = { label: index+1+'岁',value: index+1}
|
|
|
|
+ }
|
|
|
|
+ this.setData({
|
|
|
|
+ ageList,
|
|
|
|
+ endDate: new Date().format('yyyy-MM-dd')
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|