1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042 |
- // pages/my/myData/myData.js
- var App = getApp()
- const util = require('../../../utils/util');
- let CityArray0 = [];
- let CityArray1 = [];
- let CityArray2 = [];
- let g1 = [];
- let g2 = [];
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- bottomLeft: App.bottomLeft,
- load: true,
- nodata: util.nodata(),
- u: [],
- hiddenmodalput: true,
- sexArray: [],
- sexIndex: 0,
- maskShow: false,
- inputValue: '',
- multiArray: [0, 0],
- multiIndex: [0, 0],
- schoolItem: [],
- schIndex: 0,
- isHealthy: [],
- isHealthyIndex: 0,
- birthday: util.getNowDate(),
- birthdayIndex: 0,
- nowTime: util.getNowDate(),
- gradeIndex: [0, 0],
- gradeItem: [],
- weightItem: [],
- weightIndex: 0,
- userphoto: App.appAssetsUrl + '/images/tx.png',
- checkTimeItems: [],
- checkskillItems: [],
- checkboxValue: [],
- checkboxTxt: '',
- checkboxText: '',
- nolink: true,
- selectShow: false,
- vague: [],
- inputSch: '',
- graduationDate: '',
- /**
- * 所有需要提交的数据
- */
- allData: {
- college: '',
- province: null,
- graduationDate: ''
- },
- isDev: true, //开发环境隐藏"编辑资料"页面的部分数据项
- formNum: 0
- },
- /**
- * 防止穿透
- */
- preventTouchMove() { },
- //绑定选择器滑动事件 地区
- MultiPickerAreaChange: function (e) {
- this.data.load = false;
- let _this = this;
- if (e.detail.column === 0) {
- let pid = CityArray0[e.detail.value].areaid
- _this.data.multiIndex[0] = e.detail.value;
- _this.loadCity(pid);
- } else if (e.detail.column === 1) {
- _this.data.multiIndex[1] = e.detail.value;
- _this.setData({
- multiIndex: _this.data.multiIndex
- })
- }
- },
- //点击完成修改后 地区
- PickerAreaChange: function (e) {
- this.data.load = false;
- let _this = this;
- _this.data.multiIndex[0] = e.detail.value[0]
- _this.data.multiIndex[1] = e.detail.value[1]
- _this.setData({
- multiIndex: _this.data.multiIndex,
- ['allData.province']: CityArray0[_this.data.multiIndex[0]].areaid,
- ['allData.region']: CityArray1[_this.data.multiIndex[1]].areaid
- })
- _this.loadSchool(_this.data.allData.region)
- },
- // 学校选择事件
- bindSchChange: function (e) {
- this.data.load = false;
- this.setData({
- schIndex: e.detail.value
- })
- if (this.data.schoolItem.length > 0) {
- this.data.allData.college = this.data.schoolItem[e.detail.value].itemcode
- }
- },
- /**
- * 年级 完成
- */
- pickerSchChange: function (e) {
- this.data.load = false;
- this.data.gradeIndex[0] = e.detail.value[0]
- this.data.gradeIndex[1] = e.detail.value[1]
- this.setData({
- gradeIndex: this.data.gradeIndex
- })
- if (this.data.gradeItem) {
- this.setData({
- ['allData.rank']: this.data.gradeItem[1][e.detail.value[1]].id,
- ['allData.grade']: this.data.gradeItem[0][e.detail.value[0]].id
- })
- }
- },
- /**
- * 体重滑轨完成
- */
- bindWeightChange: function (e) {
- this.data.load = false;
- this.setData({
- weightIndex: e.detail.value
- })
- if (this.data.weightItem) {
- if (this.data.weightItem[e.detail.value].itemcode) {
- this.data.allData.weighttype = this.data.weightItem[e.detail.value].itemcode
- }
- }
- },
- /**
- * 年级滑轨后
- */
- MultiPickerSchChange: function (e) {
- this.data.load = false;
- if (e.detail.column === 0) {
- let pid = g1[e.detail.value].id;
- let newg2List = [];
- for (let i = 0; i < g2.length; i++) {
- if (pid === g2[i].pid) {
- newg2List.push(g2[i])
- }
- }
- this.data.gradeItem[1] = newg2List
- this.setData({
- gradeItem: this.data.gradeItem
- })
- }
- },
- /**
- * 性别滑轨完成
- */
- bindSexChange: function (e) {
- this.setData({
- sexIndex: e.detail.value
- })
- this.data.load = false;
- if (this.data.sexArray) {
- if (this.data.sexArray[e.detail.value].itemcode) {
- this.data.allData.sex = this.data.sexArray[e.detail.value].itemcode
- }
- }
- },
- //生日
- bindTimeChange: function (e) {
- if (e.detail.value) {
- this.setData({
- birthday: e.detail.value
- })
- this.data.allData.birthday = e.detail.value
- }
- },
- //毕业时间
- bindTimeChange2: function (e) {
- if (e.detail.value) {
- this.setData({
- graduationDate: e.detail.value
- })
- this.data.allData.graduationDate = e.detail.value
- }
- console.log(e.detail.value)
- },
- //健康
- bindhisChange: function (e) {
- this.setData({
- isHealthyIndex: e.detail.value
- })
- this.data.load = false;
- if (this.data.isHealthy) {
- this.data.allData.ishealth = this.data.isHealthy[e.detail.value].itemcode
- }
- },
- /**
- * 绑定用户信息展示在页面上(普通文本)
- */
- async loadUser() {
- // let uinfo = util.getUser();
- // console.log(uinfo)
- let _this = this;
- let id = util.getUserId();
- let parm = {
- id
- }
- await App._post_form('member/apiSelectMeberInfo', 'application/json', JSON.stringify(parm),
- function (res) {
- if (res.code === 0) {
- wx.setStorageSync("USER", res.member);
- let uinfo = res.member;
- _this.setData({
- u: uinfo,
- birthday: uinfo.birthday === "" || uinfo.birthday === null ? '' : uinfo.birthday,
- userphoto: uinfo.memberphoto === '' || uinfo.memberphoto === null ?
- '{{appAssetsUrl}}/images/tx.png' : uinfo.memberphoto,
- ['allData.college']: uinfo.college,
- ['allData.collegeName']: uinfo.collegeName,
- ['allData.province']: uinfo.province,
- ['allData.region']: uinfo.region,
- ['allData.rank']: uinfo.rank,
- ['allData.grade']: uinfo.grade,
- graduationDate: uinfo.graduationDate,
- ['allData.graduationDate']: uinfo.graduationDate
- })
- }
- })
- setTimeout(() => {
- this.loadDictionary();
- }, 500);
- this.searchProvince();
- g1 = [{
- id: '11',
- name: '研究生'
- }, {
- id: '12',
- name: '大学'
- }, {
- id: '13',
- name: '高中'
- }, {
- id: '14',
- name: '初中'
- }]
- g2 = [{
- id: "1101",
- name: '研一',
- pid: '11'
- }, {
- id: "1102",
- name: '研二',
- pid: '11'
- }, {
- id: "1103",
- name: '研三',
- pid: '11'
- }, {
- id: "1201",
- name: '大一',
- pid: '12'
- }, {
- id: "1202",
- name: '大二',
- pid: '12'
- }, {
- id: "1203",
- name: '大三',
- pid: '12'
- }, {
- id: "1204",
- name: '大四',
- pid: '12'
- }, {
- id: "1301",
- name: '高一',
- pid: '13'
- }, {
- id: "1302",
- name: '高二',
- pid: '13'
- }, {
- id: "1303",
- name: '高三',
- pid: '13'
- }, {
- id: "1401",
- name: '初一',
- pid: '14'
- }, {
- id: "1402",
- name: '初二',
- pid: '14'
- }, {
- id: "1403",
- name: '初三',
- pid: '14'
- }]
- this.data.gradeItem.push(g1);
- let newg2List = [];
- let gra = this.data.u.rank;
- let rank = "";
- rank = this.data.u.grade;
- if (rank) {
- for (let i = 0; i < g1.length; i++) {
- if (g1[i].id === rank) {
- this.data.gradeIndex[0] = i;
- break;
- }
- }
- } else {
- rank = g1[0].id
- }
- for (let i = 0; i < g2.length; i++) {
- if (rank === g2[i].pid) {
- newg2List.push(g2[i])
- }
- }
- if (gra) {
- for (let i = 0; i < newg2List.length; i++) {
- if (newg2List[i].id === gra) {
- this.data.gradeIndex[1] = i;
- break;
- }
- }
- }
- this.data.gradeItem[1] = newg2List;
- this.setData({
- gradeItem: this.data.gradeItem,
- gradeIndex: this.data.gradeIndex
- })
- wx.hideLoading();
- },
- changeAvatar() {
- let _this = this;
- var tempFile;
- wx.showActionSheet({
- itemList: ['拍照上传', '从相册中选择'],
- success(res) {
- if (res.tapIndex === 0) {
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['camera'],
- success(res) {
- const tempFilePaths = res.tempFilePaths
- wx.uploadFile({
- url: App.apiRoot + 'member/addPhoto/' + util
- .getUserId(),
- filePath: tempFilePaths[0],
- name: 'file',
- success: function (res) {
- if (res.errMsg === "uploadFile:ok") {
- wx.showToast({
- title: '修改成功',
- image: '',
- duration: 1500,
- mask: false
- });
- _this.setData({
- userphoto: tempFilePaths[0]
- })
- }
- },
- function() {
- wx.showToast({
- title: '修改失败',
- icon: 'none',
- image: '',
- duration: 1500,
- mask: false,
- });
- }
- })
- }
- })
- } else if (res.tapIndex === 1) {
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album'],
- success(res) {
- const tempFilePaths = res.tempFilePaths
- wx.uploadFile({
- url: App.apiRoot + 'member/addPhoto/' + util
- .getUserId(),
- filePath: tempFilePaths[0],
- name: 'file',
- success: function (res) {
- if (res.errMsg === "uploadFile:ok") {
- wx.showToast({
- title: '修改成功',
- image: '',
- duration: 1500,
- mask: false
- });
- _this.setData({
- userphoto: tempFilePaths[0]
- })
- }
- },
- function() {
- wx.showToast({
- title: '修改失败',
- icon: 'none',
- image: '',
- duration: 1500,
- mask: false,
- success: (result) => { },
- fail: () => { },
- complete: () => { }
- });
- }
- })
- }
- })
- }
- },
- fail(res) { }
- })
- },
- /**
- * 查询字典项,渲染页面下拉框数据
- */
- loadDictionary() {
- let _this = this;
- /**
- * 性别
- */
- App._post_form('bizcatelog/apiSelectBizcatelog/gender', '', null, function (res) {
- if (res.code === 0) {
- let gender = res.dictList
- let all = {
- itemcode: "",
- itemname: "全部"
- }
- gender.unshift(all)
- let sexI = 0;
- if (_this.data.u.sex) {
- let sex = _this.data.u.sex;
- if (gender.length) {
- for (let i = 0; i < gender.length; i++) {
- if (gender[i].itemcode === sex) {
- sexI = i;
- }
- }
- }
- }
- _this.setData({
- sexArray: gender,
- sexIndex: sexI
- })
- }
- })
- /**
- * 体重
- */
- App._post_form('bizcatelog/apiSelectBizcatelog/WEIGHTTYPE', '', null, function (res) {
- if (res.code === 0) {
- let weight = res.dictList
- let all = {
- itemcode: "",
- itemname: "全部"
- }
- weight.unshift(all)
- if (_this.data.u.weighttype) {
- if (weight.length) {
- for (let i = 0; i < weight.length; i++) {
- if (_this.data.u.weighttype === weight[i].itemcode) {
- _this.data.weightIndex = i;
- break;
- }
- }
- }
- }
- _this.setData({
- weightItem: weight,
- weightIndex: _this.data.weightIndex
- })
- }
- })
- /**
- * 健康证
- */
- App._post_form('bizcatelog/apiSelectBizcatelog/YF', '', null, function (res) {
- if (res.code === 0) {
- let healthy = res.dictList
- if (_this.data.u.ishealth) {
- let health = _this.data.u.ishealth;
- if (healthy.length) {
- for (let i = 0; i < healthy.length; i++) {
- if (healthy[i].itemcode === health) {
- _this.data.isHealthyIndex = i;
- break;
- }
- }
- }
- }
- _this.setData({
- isHealthy: healthy,
- isHealthyIndex: _this.data.isHealthyIndex
- })
- }
- })
- /***空闲时间*/
- App._post_form('bizcatelog/apiSelectBizcatelog/FREETIME', '', null, function (res) {
- if (res.code === 0) {
- let FREETIME = res.dictList
- if (FREETIME.length) {
- _this.data.checkTimeItems = FREETIME;
- if (_this.data.u.freetime) {
- _this.changeTxt(_this.data.checkTimeItems, _this.data.u.freetime, "freetime")
- }
- }
- }
- })
- /*** 技能 */
- App._post_form('bizcatelog/apiSelectBizcatelog/skill', '', null, function (res) {
- if (res.code === 0) {
- let skill = res.dictList
- if (skill.length) {
- _this.data.checkskillItems = skill;
- //加载技能
- if (_this.data.u.skill) {
- _this.changeTxt(_this.data.checkskillItems, _this.data.u.skill, "skill")
- }
- }
- }
- })
- },
- /**
- * 加载省份
- */
- searchProvince() {
- let _this = this;
- let proId = '';
- let prov = '';
- App._post_form('areainfo/province', '', null, function (res) {
- if (res.code === 0) {
- let provice = res.list
- _this.data.multiArray[0] = provice;
- CityArray0 = provice;
- if (_this.data.u.region) {
- prov = _this.data.u.province;
- if (CityArray0.length) {
- for (let i = 0; i < CityArray0.length; i++) {
- if (CityArray0[i].areaid === prov) {
- _this.data.multiIndex[0] = i;
- break;
- }
- }
- }
- }
- if (prov && _this.data.load === true) {
- proId = prov
- } else {
- //根据默认省,获取默认市
- if (_this.data.multiArray[0].length) {
- proId = _this.data.multiArray[0][0].areaid;
- }
- }
- _this.loadCity(proId)
- }
- })
- },
- //获取市级
- loadCity(cid) {
- let _this = this;
- App._post_form('areainfo/city/' + cid, '', null, function (res) {
- if (res.code === 0) {
- let city = res.list;
- _this.data.multiArray[1] = city;
- CityArray1 = city;
- if (_this.data.u.region) {
- let region = _this.data.u.region;
- if (CityArray1.length) {
- for (let i = 0; i < CityArray1.length; i++) {
- if (CityArray1[i].areaid === region) {
- _this.data.multiIndex[1] = i;
- break;
- }
- }
- }
- let cityId = '';
- if (region && _this.data.load === true) {
- cityId = region;
- } else {
- if (_this.data.multiArray[1].length) {
- cityId = _this.data.multiArray[1][0].areaid
- }
- }
- _this.loadSchool(cityId)
- }
- _this.setData({
- multiArray: _this.data.multiArray,
- multiIndex: _this.data.multiIndex
- })
- }
- })
- },
- //获取学校
- loadSchool(cityId) {
- let _this = this;
- App._post_form('areainfo/Schoolinfo/' + cityId, '', null, function (res) {
- if (res.code === 0) {
- let school = []
- if (res.dictList.length <= 0) {
- school = []
- } else {
- let college = _this.data.u.college;
- school = res.dictList
- CityArray2 = school;
- if (college && _this.data.load === true) {
- for (let i = 0; i < CityArray2.length; i++) {
- if (college === CityArray2[i].itemcode) {
- _this.data.schIndex = i;
- break;
- }
- }
- }
- }
- _this.setData({
- schoolItem: school
- //schoolName: _this.data.schoolName?_this.data.schoolName:school[_this.data.schIndex].itemname
- //schIndex: _this.data.schIndex
- })
- }
- })
- },
- /**
- * 更新用户数据根据id
- */
- PushVipInfo() {
- wx.showLoading({
- title: '加载中...',
- })
- let _this = this;
- let id = util.getUserId();
- let parm = {
- id
- }
- App._post_form('member/apiSelectMeberInfo', 'application/json', JSON.stringify(parm),
- function (res) {
- if (res.code === 0) {
- wx.setStorageSync("USER", res.member);
- _this.loadUser();
- _this.loadSchool(res.member.region)
- }
- })
- },
- maskClose(e) {
- if (e.currentTarget.dataset) {
- let value = e.currentTarget.dataset.type;
- if (this.data.inputValue || this.data.checkboxValue.length) {
- if (value === "vipname") {
- this.setData({
- "u.vipname": this.data.inputValue
- })
- this.data.allData.vipname = this.data.inputValue
- } else if (value === "name") {
- this.setData({
- "u.name": this.data.inputValue
- })
- this.data.allData.name = this.data.inputValue
- } else if (value === "email") {
- let regex = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
- if (!regex.test(this.data.inputValue)) {
- wx.showToast({
- title: '请填写正确的邮箱!',
- icon: 'none'
- })
- return;
- }
- this.setData({
- "u.email": this.data.inputValue
- })
- this.data.allData.email = this.data.inputValue
- } else if (value === "height") {
- this.setData({
- "u.height": this.data.inputValue
- })
- this.data.allData.height = this.data.inputValue
- } else if (value === "dormitoryno") {
- this.setData({
- "u.dormitoryno": this.data.inputValue
- })
- this.data.allData.dormitoryno = this.data.inputValue
- } else if (value === "idcard") {
- let regex = /^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|[xX])$/;
- if (!regex.test(this.data.inputValue)) {
- wx.showToast({
- title: '请填写正确的身份证!',
- icon: 'none'
- })
- return;
- }
- this.setData({
- "u.idcard": this.data.inputValue
- })
- this.data.allData.idcard = this.data.inputValue
- } else if (value === "remarks") {
- this.setData({
- "u.remarks": this.data.inputValue
- })
- this.data.allData.remarks = this.data.inputValue
- } else if (value === "major") {
- this.setData({
- "u.major": this.data.inputValue
- })
- this.data.allData.major = this.data.inputValue
- } else if (value === "freetime") {
- if (this.data.checkboxValue.length) {
- let item = "";
- for (let i = 0; i < this.data.checkboxValue.length; i++) {
- item += this.data.checkboxValue[i] + ","
- }
- item = item.substring(0, item.length - 1);
- this.data.allData.freetime = item;
- this.changeTxt(this.data.checkTimeItems, this.data.allData.freetime, "freetime")
- }
- } else if (value === "skill") {
- if (this.data.checkboxValue.length) {
- let item = "";
- for (let i = 0; i < this.data.checkboxValue.length; i++) {
- item += this.data.checkboxValue[i] + ","
- }
- item = item.substring(0, item.length - 1);
- this.data.allData.skill = item;
- this.changeTxt(this.data.checkskillItems, this.data.allData.skill, "skill")
- }
- }
- }
- }
- this.setData({
- maskShow: false,
- })
- },
- checkboxChange: function (e) {
- this.data.checkboxValue = e.detail.value
- },
- bindKeyInput(e) {
- this.data.inputValue = e.detail.value;
- },
- updateInfo(e) {
- let _this = this;
- _this.data.checkboxValue = [];
- if (e.currentTarget.dataset) {
- let value = e.currentTarget.dataset;
- if (value.mode === "checkbox") {
- if (value.type === "freetime") {
- _this.setData({
- checkboxItems: _this.data.checkTimeItems
- })
- } else if (value.type === "skill") {
- _this.setData({
- checkboxItems: _this.data.checkskillItems
- })
- }
- }
- _this.setData({
- maskShow: true,
- maskTitle: value.title,
- maskInputPla: '输入' + value.title,
- maskInputMode: value.mode,
- type: value.type,
- inputValue: ''
- })
- }
- },
- changeTxt(valueItem, item, type) {
- item = item.split(",");
- if (item.length) {
- let v = "";
- for (let i = 0; i < item.length; i++) {
- for (let j = 0; j < valueItem.length; j++) {
- if (valueItem[j].itemcode == item[i]) {
- v += valueItem[j].itemname + ","
- }
- }
- }
- v = v.substring(0, v.length - 1);
- if (type === "freetime") {
- this.setData({
- checkboxTxt: v
- })
- } else if (type === "skill") {
- this.setData({
- checkboxText: v
- })
- }
- }
- },
- btnCancel() {
- wx.navigateBack();
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let _this = this;
- if (Object.keys(options).length > 0) {
- if (options.type === "no") {
- _this.data.nolink = false;
- } else {
- _this.data.nolink = true;
- }
- } else {
- _this.data.nolink = true;
- }
- if (util.UserLoginStatus()) {
- _this.loadUser();
- }
- this.loadVipSel();
- this.getNum();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- wx.setNavigationBarTitle({
- title: '个人资料',
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.data.load = true;
- this.data.allData = {};
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () { },
- btnUpUserInfo() {
- let that = this;
- //必填校验
- if (that.data.u.name == null) {
- wx.showToast({
- title: '请填写真实姓名',
- icon: 'none'
- })
- return;
- }
- if (that.data.sexIndex == 0) {
- wx.showToast({
- title: '请选择性别',
- icon: 'none'
- })
- return;
- }
- // if (that.data.u.email == '') {
- // wx.showToast({
- // title: '请填写邮箱',
- // icon: 'none'
- // })
- // return;
- // }
- if (Object.keys(this.data.allData).length > 0) {
- this.data.allData.id = this.data.u.id;
- wx.showModal({
- title: '请注意',
- content: '您已修改资料,是否保存?',
- success: function (res) {
- if (res.confirm) {
- that.updateUserInfo()
- }
- }
- })
- } else {
- wx.showToast({
- title: '没有修改数据!',
- icon: 'none'
- })
- }
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- updateUserInfo() {
- let _this = this;
- App._post_form('member/apiUpdateMeberInfo',
- 'application/json',
- JSON.stringify(_this.data.allData),
- function (res) {
- if (res.code === 0) {
- // wx.showLoading({
- // title: '保存中...',
- // duration: 1000
- // })
- wx.showToast({
- title: '修改成功!',
- icon: 'none'
- })
- setTimeout(() => {
- _this.PushVipInfo();
- _this.getNum();
- if (_this.data.nolink === true) {
- wx.switchTab({
- url: '/pages/my/index/index'
- })
- } else if (_this.data.nolink === false) {
- wx.navigateBack({
- delta: 1
- })
- }
- }, 2000)
- }
- })
- },
- chooseSch() {
- const _this = this;
- _this.openSel();
- },
- schoolPickerChange(e) {
- this.setData({
- ['allData.college']: this.data.schoolItem[e.detail.value].itemcode,
- ['allData.collegeName']: this.data.schoolItem[e.detail.value].itemname
- })
- },
- /**
- * 打开下拉框
- */
- openSel() {
- this.setData({
- selectShow: true,
- })
- },
- /**
- * 关闭下拉框
- */
- closeSel() {
- this.setData({
- selectShow: false,
- vague: [],
- inputSch: ''
- })
- },
- ok() {
- this.closeSel();
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- schoolInput(e) {
- this.setData({
- ['allData.college']: e.detail.value
- })
- },
- loadVipSel() {
- let _this = this;
- App._post_form('wgfillinfo/apiSelectwgfillinfo', 'application/json',
- null,
- function (res) {
- if (res.code === 0) {
- _this.setData({
- isDev: res.wgFillInfo.isDev
- })
- }
- }
- )
- },
- // 获取已填写的会员信息个数
- getNum() {
- let id = util.getUserId();
- let _this = this;
- App._get('member/completeNum/' + id, {}, res => {
- console.log(res);
- if (res.code === 0) {
- this.setData({
- formNum: res.data || 0
- })
- }
- }, err => { }, complete => {
- })
- },
- })
|