|
@@ -6,6 +6,8 @@ import {
|
|
|
TestVerify
|
|
|
} from "../../utils/verify"
|
|
|
const _Verify = new TestVerify();
|
|
|
+const utilMd5 = require('../../utils/md5')
|
|
|
+let countDown = null;
|
|
|
Page({
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
@@ -21,12 +23,16 @@ Page({
|
|
|
throttle: false, //节流阀
|
|
|
makeOver: false,
|
|
|
showModel: false,
|
|
|
+ codeChange: "", //验证码
|
|
|
+ codeCount: 60,
|
|
|
+ verificationCode: "",
|
|
|
/* 必填项 */
|
|
|
errTips: {
|
|
|
fname: false,
|
|
|
frole: false,
|
|
|
fphonenumber: false
|
|
|
- }
|
|
|
+ },
|
|
|
+ tispText: "", //验证码提示文本
|
|
|
},
|
|
|
/* input事件剔除特殊字符 */
|
|
|
eliminate(value) {
|
|
@@ -59,14 +65,101 @@ Page({
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ /* 获取验证码 */
|
|
|
+ getAuthCode() {
|
|
|
+ if (this.data.codeCount != 60) return wx.showToast({
|
|
|
+ title: '已发送验证码,请勿重复获取',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.usercenter.teammsg.teammsg",
|
|
|
+ "method": "getPassword",
|
|
|
+ "content": {
|
|
|
+ "tenterprise_userid": this.data.tenterprise_userid
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log("转让主账号", res)
|
|
|
+ if (res.data != '成功') return;
|
|
|
+ const that = this;
|
|
|
+ wx.showToast({
|
|
|
+ title: '已将验证码发送到受让方',
|
|
|
+ icon: "none",
|
|
|
+ duration: 3000
|
|
|
+ })
|
|
|
+ this.setData({
|
|
|
+ tispText: "已发送到对方手机号"
|
|
|
+ })
|
|
|
+ that.setData({
|
|
|
+ codeCount: this.data.codeCount - 1
|
|
|
+ });
|
|
|
+ countDown = setInterval(() => {
|
|
|
+ if (this.data.codeCount == 0) {
|
|
|
+ that.setData({
|
|
|
+ codeCount: 60
|
|
|
+ });
|
|
|
+ clearInterval(countDown)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.setData({
|
|
|
+ codeCount: this.data.codeCount - 1
|
|
|
+ });
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 回调 */
|
|
|
+ callBack({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ clearInterval(countDown)
|
|
|
+ this.setData({
|
|
|
+ codeCount: 60,
|
|
|
+ tispText: ''
|
|
|
+ });
|
|
|
+ if (detail == 'true') {
|
|
|
+ if (this.data.verificationCode == '') return wx.showToast({
|
|
|
+ title: '验证码不能为空',
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ _Http.basic({
|
|
|
+ "accesstoken": wx.getStorageSync('userData').token,
|
|
|
+ "classname": "customer.usercenter.teammsg.teammsg",
|
|
|
+ "method": "changeAdministrator",
|
|
|
+ "content": {
|
|
|
+ "tenterprise_userid": this.data.tenterprise_userid,
|
|
|
+ "fpassword": utilMd5.hexMD5(this.data.verificationCode)
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ wx.showToast({
|
|
|
+ title: '转让成功!请您重新登录',
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ wx.reLaunch({
|
|
|
+ url: '/pages/login/index',
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
/* 转让主账号 */
|
|
|
makeOverChange() {
|
|
|
this.setData({
|
|
|
showModel: true
|
|
|
})
|
|
|
},
|
|
|
- codeChange(e){
|
|
|
- console.log(e)
|
|
|
+ /* 验证码输入 */
|
|
|
+ codeChange(e) {
|
|
|
+ this.setData({
|
|
|
+ verificationCode: e.detail.value
|
|
|
+ })
|
|
|
},
|
|
|
/* 提交 */
|
|
|
submit() {
|
|
@@ -219,7 +312,9 @@ Page({
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
- onUnload: function () {},
|
|
|
+ onUnload: function () {
|
|
|
+ clearInterval(countDown);
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|