微信小程序
作者:
歪嘴战神叁叁叁
,
2022-03-29 19:20:29
,
所有人可见
,
阅读 278
关于赋值
/**
* 页面的初始数据
*/
data: {
passwordType: "password",
userName: 'xmjl',
password: 'xczx@123COM',
randomNumber: '',
verificationCode: '',
form: {
userName: 'xmjl',
password: 'xczx@123COM',
randomNumber: '',
verificationCode: '',
},
codeImg: '',
},
// 验证码
getCode:function() {
let date = new Date()
let codeImg = BASE_URL+`/WxAppLogin/VerificationCode?randomNumber=${date.getTime()}`
this.setData({
["form.randomNumber"]: date.getTime(),
codeImg
})
// console.log(this.data.form.randomNumber)
},
// 登陆提交
async handleLogin() {
this.setData({
["form.userName"]:this.data.userName,
["form.password"]:this.data.password,
["form.verificationCode"]:this.data.verificationCode
})
console.log(this.data.form);
let handleData = await encryptedData(this.data.form)
handleData = `${handleData.param}@${handleData.aesKey}`
let res = await WxAppLogin(handleData)
console.log(res.data);
const accessToken = res.data
if(accessToken){
wx.setStorageSync('token', accessToken)
}
},