9 changed files with 157 additions and 194 deletions
Unified View
Diff Options
-
4pages/api/payment.js
-
75pages/api/request.js
-
4pages/api/user.js
-
4pages/api/ztb.js
-
239pages/home/password/index.js
-
8pages/home/setting/index.wxml
-
8pages/ztbvip/index.js
-
7pages/ztbvip/index.wxml
-
2project.config.json
@ -1,138 +1,105 @@ |
|||||
// // pages/home/password/index.js
|
|
||||
// // 页面已经废弃,因为UEC的修改,暂时不会提供修改密码的功能
|
|
||||
// import { $wuxCountDown } from '../../../components/index'
|
|
||||
// import { setPassword } from '../../api/ztb'
|
|
||||
// const request = require('../../../utils/request') //导入模块
|
|
||||
// const util = require('../../../utils/util')
|
|
||||
// const md5 = require('../../../utils/md5')
|
|
||||
// const app = getApp()
|
|
||||
|
// pages/home/password/index.js
|
||||
|
// 页面已经废弃,因为UEC的修改,暂时不会提供修改密码的功能
|
||||
|
import { $wuxCountDown } from '../../../components/index' |
||||
|
import { postCaptcha, setPassword } from "../../api/user" |
||||
|
const util = require('../../../utils/util') |
||||
|
const md5 = require('../../../utils/md5') |
||||
|
const app = getApp() |
||||
|
|
||||
// Page({
|
|
||||
// /**
|
|
||||
// * 页面的初始数据
|
|
||||
// */
|
|
||||
// data: {
|
|
||||
// second: null,
|
|
||||
// codeEnable: true,
|
|
||||
// pwdType: 'password',
|
|
||||
// pwd_icon: 'attention',
|
|
||||
// form: {
|
|
||||
// mobile: null,
|
|
||||
// password: null,
|
|
||||
// verifyCode: null
|
|
||||
// },
|
|
||||
// requesting: false,
|
|
||||
// first: false
|
|
||||
// },
|
|
||||
|
Page({ |
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
second: null, |
||||
|
codeEnable: true, |
||||
|
pwdType: 'password', |
||||
|
pwd_icon: 'attention', |
||||
|
form: { |
||||
|
mobile: null, |
||||
|
password: null, |
||||
|
verifyCode: null |
||||
|
}, |
||||
|
requesting: false, |
||||
|
first: false |
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
this.setData({ ['form.mobile']: app.globalData.userInfo.mobile }) |
||||
|
if(options.from){ |
||||
|
this.setData({ first: true }) |
||||
|
} |
||||
|
}, |
||||
|
bindForm: function (e) { |
||||
|
this.data.form[e.target.id] = e.detail.value |
||||
|
}, |
||||
|
changePwd: function (e) { |
||||
|
if (this.data.pwdType === 'password') { |
||||
|
this.setData({ pwdType: 'text', pwd_icon: 'attentionforbid' }) |
||||
|
} else { |
||||
|
this.setData({ pwdType: 'password', pwd_icon: 'attention' }) |
||||
|
} |
||||
|
}, |
||||
|
fetchCode: function () { |
||||
|
if (util.isEmpty(this.data.form.mobile)) { |
||||
|
util.showToast('请输入手机号码') |
||||
|
return |
||||
|
} |
||||
|
if (this.second && this.second.interval) return !1 |
||||
|
wx.showLoading({ title: '正在获取', mask: true }) |
||||
|
postCaptcha({ verifiableAccount: this.data.form.mobile, verifiableAccountType: 1, purpose: 2 }).then(result => { |
||||
|
wx.hideLoading() |
||||
|
this.setData({ codeEnable: false }) |
||||
|
util.showToast('验证码已经发送') |
||||
|
this.second = new $wuxCountDown({ |
||||
|
date: +(new Date) + 60000, |
||||
|
onEnd() { |
||||
|
this.setData({ second: '重新获取验证码', codeEnable: true }) |
||||
|
}, |
||||
|
render(date) { |
||||
|
const sec = this.leadingZeros(date.sec, 2) + ' 秒 ' |
||||
|
date.sec !== 0 && this.setData({ second: sec }) |
||||
|
} |
||||
|
}) |
||||
|
}).catch(error => { |
||||
|
wx.hideLoading() |
||||
|
util.showToast(error) |
||||
|
}) |
||||
|
}, |
||||
|
submitForm: function () { |
||||
|
if (this.data.requesting) { |
||||
|
return |
||||
|
} |
||||
|
if (util.isEmpty(this.data.form.mobile) && !this.data.first) { |
||||
|
util.showToast('请输入手机号码') |
||||
|
return |
||||
|
} |
||||
|
if (util.isEmpty(this.data.form.password)) { |
||||
|
util.showToast('请输入密码') |
||||
|
return |
||||
|
} |
||||
|
if (util.isEmpty(this.data.form.verifyCode) && !this.data.first) { |
||||
|
util.showToast('请输入验证码') |
||||
|
return |
||||
|
} |
||||
|
wx.showLoading({ title: '处理中', mask: true }) |
||||
|
this.data.requesting = true |
||||
|
setPassword(this.data.form).then(res => { |
||||
|
wx.hideLoading() |
||||
|
util.showBackToast('设置成功') |
||||
|
}).catch(error => { |
||||
|
wx.hideLoading() |
||||
|
this.data.requesting = false |
||||
|
util.showToast(error) |
||||
|
}) |
||||
|
}, |
||||
|
onUnload: function(){ |
||||
|
if(this.wuxCountDown){ |
||||
|
this.wuxCountDown.stop() |
||||
|
this.wuxCountDown = null |
||||
|
} |
||||
|
} |
||||
|
|
||||
// /**
|
|
||||
// * 生命周期函数--监听页面加载
|
|
||||
// */
|
|
||||
// onLoad: function (options) {
|
|
||||
// this.setData({
|
|
||||
// ['form.mobile']: app.globalData.userInfo.mobile
|
|
||||
// })
|
|
||||
// if(options.from){
|
|
||||
// this.setData({
|
|
||||
// first: true
|
|
||||
// })
|
|
||||
// }
|
|
||||
// },
|
|
||||
// bindForm: function (e) {
|
|
||||
// this.data.form[e.target.id] = e.detail.value
|
|
||||
// },
|
|
||||
// changePwd: function (e) {
|
|
||||
// if (this.data.pwdType === 'password') {
|
|
||||
// this.setData({
|
|
||||
// pwdType: 'text'
|
|
||||
// })
|
|
||||
// this.setData({
|
|
||||
// pwd_icon: 'attentionforbid'
|
|
||||
// })
|
|
||||
// } else {
|
|
||||
// this.setData({
|
|
||||
// pwdType: 'password'
|
|
||||
// })
|
|
||||
// this.setData({
|
|
||||
// pwd_icon: 'attention'
|
|
||||
// })
|
|
||||
// }
|
|
||||
// },
|
|
||||
// fetchCode: function () {
|
|
||||
// if (util.isEmpty(this.data.form.mobile)) {
|
|
||||
// util.showToast('请输入手机号码')
|
|
||||
// return
|
|
||||
// }
|
|
||||
// if (this.second && this.second.interval) return !1
|
|
||||
// wx.showLoading({ title: '正在获取', mask: true })
|
|
||||
// // //commonLogin/sendVerifyCode 发送验证码
|
|
||||
// request.post('/user-centre/commonLogin/sendVerifyCode', {
|
|
||||
// mobile: this.data.form.mobile,
|
|
||||
// codeType: '7',
|
|
||||
// type: 'yzmjc'
|
|
||||
// }).then(result => {
|
|
||||
// wx.hideLoading()
|
|
||||
// this.setData({ codeEnable: false })
|
|
||||
// util.showToast('验证码已经发送')
|
|
||||
// this.second = new $wuxCountDown({
|
|
||||
// date: +(new Date) + 60000,
|
|
||||
// onEnd() {
|
|
||||
// this.setData({ second: '重新获取验证码', codeEnable: true })
|
|
||||
// },
|
|
||||
// render(date) {
|
|
||||
// const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
|
|
||||
// date.sec !== 0 && this.setData({ second: sec })
|
|
||||
// }
|
|
||||
// })
|
|
||||
// }).catch(error => {
|
|
||||
// wx.hideLoading()
|
|
||||
// util.showToast(error)
|
|
||||
// })
|
|
||||
// },
|
|
||||
// submitForm: function () {
|
|
||||
// if (this.data.requesting) {
|
|
||||
// return
|
|
||||
// }
|
|
||||
// if (util.isEmpty(this.data.form.mobile) && !this.data.first) {
|
|
||||
// util.showToast('请输入手机号码')
|
|
||||
// return
|
|
||||
// }
|
|
||||
// if (util.isEmpty(this.data.form.password)) {
|
|
||||
// util.showToast('请输入密码')
|
|
||||
// return
|
|
||||
// }
|
|
||||
// if (util.isEmpty(this.data.form.verifyCode) && !this.data.first) {
|
|
||||
// util.showToast('请输入验证码')
|
|
||||
// return
|
|
||||
// }
|
|
||||
// wx.showLoading({ title: '处理中', mask: true })
|
|
||||
// this.data.requesting = true
|
|
||||
// if(this.data.first){
|
|
||||
// // var data = { password : md5.hexMD5(this.data.form.password).toUpperCase() }
|
|
||||
// setPassword({ password : this.data.form.password }).then(res => {
|
|
||||
// wx.hideLoading()
|
|
||||
// util.showBackToast('设置成功')
|
|
||||
// }).catch(error => {
|
|
||||
// wx.hideLoading()
|
|
||||
// this.data.requesting = false
|
|
||||
// util.showToast(error)
|
|
||||
// })
|
|
||||
// } else {
|
|
||||
// resetPassword(this.data.form).then(res => {
|
|
||||
// wx.hideLoading()
|
|
||||
// util.showBackToast('设置成功')
|
|
||||
// }).catch(error => {
|
|
||||
// wx.hideLoading()
|
|
||||
// this.data.requesting = false
|
|
||||
// util.showToast(error)
|
|
||||
// })
|
|
||||
// }
|
|
||||
// },
|
|
||||
// onUnload: function(){
|
|
||||
// if(this.wuxCountDown){
|
|
||||
// this.wuxCountDown.stop()
|
|
||||
// this.wuxCountDown = null
|
|
||||
// }
|
|
||||
// }
|
|
||||
|
|
||||
// })
|
|
||||
|
}) |
||||
Write
Preview
Loading…
Cancel
Save