const company = getApp().globalData.company let Parse = getApp().Parse; Page({ /** * 页面的初始数据 */ data: { status: 0, password: null, passwords: null, id: null, store: null, getText2: '获取验证码', loveChange: true, hongyzphone: '', // 验证码是否正确 zhengLove: true, huoLove: '', }, async getShopStore() { let ShopOrder = new Parse.Query('ShopStore') ShopOrder.notEqualTo('isDeleted', "true") ShopOrder.equalTo('company', company) ShopOrder.include('user') ShopOrder.equalTo('objectId', this.data.id) let shopOrder = await ShopOrder.first() if (shopOrder && shopOrder.id) { this.setData({ store: shopOrder.toJSON() }) console.log(this.data.store); } }, yanLoveBtn: function () { let loveChange = this.data.loveChange; let phone = this.data.store.mobile; console.log(phone) let n = 59; let that = this; if (!phone) { wx.showToast({ title: '手机号有误', icon: 'success', duration: 1000 }) } else { if (loveChange) { this.setData({ loveChange: false }) let lovetime = setInterval(function () { let str = '(' + n + ')' + '重新获取' that.setData({ getText2: str }) if (n <= 0) { that.setData({ loveChange: true, getText2: '重新获取' }) clearInterval(lovetime); } n--; }, 1000); console.log(phone) wx.request({ url: "https://server.fmode.cn/api/apig/message", method: "post", //请求方式 data: { mobile: phone, company: company, }, success(res) { console.log(res) } }) } } }, formSubmit(e) { let that = this let val = e.detail.value console.log('val', val) var phone = this.data.store.mobile //电话 var phoneCode = val.phoneCode //验证码 var openid = wx.getStorageSync('userInfo').openid console.log(openid) wx.request({ url: 'https://server.fmode.cn/api/apig/verifyCode', method: "post", //请求方式 data: { mobile: phone, code: phoneCode, openid: openid }, success(res) { console.log(res); if (res.data.code != 200) { wx.showToast({ title: res.data.mess, icon: 'none' }) return } that.setData({ status: 1 }) } }) console.log(this.data.status); }, blur(e) { let name = e.currentTarget.dataset.name this.setData({ [name]: e.detail.value }) }, async getuser() { if (this.data.password.length < 6) { wx.showToast({ title: '密码长度不得小于6位数', icon: 'none' }) return } if (this.data.password != this.data.passwords) { wx.showToast({ title: '两次密码输入不同', icon: 'none' }) return } let query = new Parse.Query("_User") console.log(this.data.store.user.objectId); let user = await query.get(this.data.store.user.objectId) user.set("password", this.data.password) user.save().then(res => { console.log(res) wx.showToast({ title: '重置成功', icon: 'none' }) wx.navigateBack({ delta: 1 }); }) }, yanLoveInput: function (e) { let that = this; let yanLove = e.detail.value; let huoLove = this.data.huoLove; that.setData({ yanLove: yanLove, zhengLove: false, }) if (yanLove.length >= 7) { if (yanLove == huoLove) { that.setData({ zhengLove: true, }) } else { that.setData({ zhengLove: false, }) wx.showModal({ content: '输入验证码有误', showCancel: false, success: function (res) { } }) } } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { let id = options.id this.setData({ id: id }) this.getShopStore() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })