import { ApiModel } from "../../utils/api" const _Http = new ApiModel() Component({ /** * 组件的属性列表 */ properties: { userTelephone: { type: Number } }, /** * 组件的初始数据 */ data: { //用户名 userName: "", //身份职位 identity: "", }, /** * 组件的方法列表 */ methods: { /* 用户名 */ setUserName(e) { this.setData({ userName: e.detail.value }) }, /* 用户身份 */ setUsereFole(e) { this.setData({ identity: e.detail.value }) }, /* 设置默认信息并发送请求 */ setTacitlyApprove() { let userName = this.data.userName, identity = this.data.identity; /* 设置用户名默认值 */ if (userName.length < 1) { const str = this.data.userTelephone.toString(); userName = str.substring(str.length - 4, str.length) + "用户" } /* 设置身份/职位默认值 */ if (identity < 1) { identity = "管理员"; } /* 发送请求 */ return _Http.basic({ "accesstoken": wx.getStorageSync('token'), "classname": "customer.usercenter.usermsg.usermsg", "method": "update_usermsg", "content": { "fname": userName, "fsex": "", "fbirthdate": "", "femail": "", "fwechatno": "", "faddress": "", "frole": identity } }) }, /* 下一步,完善商户信息 */ userPerfectMsg() { this.setTacitlyApprove().then(s => { console.log(s) }) }, /* 跳过,跳转首页 */ toHomePage() { this.setTacitlyApprove().then(s => { console.log(s) if (s.msg != "成功") return; wx.reLaunch({ url: '/pages/tabbarPage/Home/index' }) }) } } })