123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- // component/myInfo/myInfo.ts
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- /**
- * 组件的初始数据
- */
- data: {
- region: ['北京市', '北京市', '海淀区'],
- schoolArray: ['中国', '美国', '巴西', '日本'],
- schoolIndex: 0,
- classArray: ['一年级一班', '一年级2班', '一年级3班', '一年级4班'],
- classIndex: 0,
- isShowPassWord: true,
- userName: "",
- userPwd: ""
- },
- /**
- * 组件的方法列表
- */
- methods: {
- bindRegionChange: function (event: any) {
-
- this.setData({
- region: event.detail.value
- })
- },
- bindSchoolPicker: function (event: any) {
- let newArray;
- switch (Number(event.detail.value)) {
- case 0:
- newArray = ["一", "二", "三"];
- this.setData({
- classArray: newArray,
- classIndex: 0
- })
- break;
- case 1:
- newArray = ["4", "5", "6"];
- this.setData({
- classArray: newArray,
- classIndex: 0
- })
- break;
- case 2:
- newArray = ["as", "ad", "af"];
- this.setData({
- classArray: newArray,
- classIndex: 0
- })
- break;
- case 3:
- newArray = ["b1", "b2", "b3"];
- this.setData({
- classArray: newArray,
- classIndex: 0
- })
- break;
- }
- this.setData({
- schoolIndex: event.detail.value
- })
- },
- bindClssPicker: function (event: any) {
- this.setData({
- classIndex: event.detail.value
- })
- },
- showPwdTab: function () {
- if (this.data.isShowPassWord) {
- this.setData({
- isShowPassWord: false
- })
- } else {
- this.setData({
- isShowPassWord: true
- })
- }
- },
- bindUserNameInput: function (event: any) {
- this.setData({
- userName: event.detail.value
- })
- },
- bindUserPwdInput: function (event: any) {
- this.setData({
- userPwd: event.detail.value
- })
- },
- submitMyInfo: function () {
- if (!this.data.userName) {
- wx.showToast({
- title: '请输入姓名',
- icon: 'none',
- duration: 1000
- })
- return;
- }
- if (!this.data.userPwd) {
- wx.showToast({
- title: '请输入密码',
- icon: 'none',
- duration: 1000
- })
- return;
- }
- let params = {
- name: this.data.userName,
- address: this.data.region[0] + "--" + this.data.region[1] + "--" + this.data.region[2],
- school: this.data.schoolArray[this.data.schoolIndex],
- class: this.data.classArray[this.data.classIndex],
- password: this.data.userPwd
- }
- console.log("params:", params)
- }
- }
- })
|