123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044 |
- // 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
- }
- },
- /**
- * 绑定用户信息展示在页面上(普通文本)
- */
- loadUser() {
- // let uinfo = util.getUser();
- // console.log(uinfo)
- 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);
- 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
- })
- }
- })
- this.loadDictionary();
- 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;
- console.log('_this.data.u==>?', _this.data.u)
- if (_this.data.u.sex) {
- let sex = _this.data.u.sex;
- console.log('sex==>?', sex)
- console.log(gender)
- if (gender.length) {
- for (let i = 0; i < gender.length; i++) {
- if (gender[i].itemcode === sex) {
- sexI = i;
- }
- }
- }
- }
- console.log('sexI==>?', sexI)
- _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();
- that.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 => {
- })
- },
- })
|