添加后台代理代码
This commit is contained in:
108
codes/agent/game/dlweb/api/web2/components/common_mixin.js
Normal file
108
codes/agent/game/dlweb/api/web2/components/common_mixin.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* 组件公共部分
|
||||
*/
|
||||
var commonMixin = {
|
||||
data: function () {
|
||||
return {
|
||||
params: {},
|
||||
wxInfo: {},
|
||||
userInfo: {},
|
||||
tel: '',
|
||||
captcha: '',
|
||||
btnMsg: '发送验证码',
|
||||
verity: 0
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 使用手机号代替微信的openid、unionid,自动生成用户信息
|
||||
* @param func
|
||||
*/
|
||||
phoneToWechat: function (func) {
|
||||
|
||||
var that = this;
|
||||
$.api
|
||||
(
|
||||
'agent.user.login',
|
||||
{
|
||||
agentid: that.params.agentid,
|
||||
channelid: that.params.channelid,
|
||||
openid: that.tel,
|
||||
unionid: that.tel,
|
||||
nickname: ( that.wxInfo.nickname ? that.wxInfo.nickname : '代理'+$.randomString(4, '0123456789')),
|
||||
avatar: (that.wxInfo.headimgurl ? that.wxInfo.headimgurl : 'https://dlwebv3.tscce.cn/images/noavatar.png'),
|
||||
sex: (that.wxInfo.sex ? that.wxInfo.sex : 0),
|
||||
province: (that.wxInfo.province ? that.wxInfo.province : ''),
|
||||
islog: 0
|
||||
},
|
||||
function (res) {
|
||||
that.userInfo = res;
|
||||
func && func(res);
|
||||
}, true
|
||||
);
|
||||
},
|
||||
/**
|
||||
* 绑定手机号
|
||||
*/
|
||||
bindPhone: function (func) {
|
||||
|
||||
var param = {
|
||||
agentid: this.params.agentid,
|
||||
channelid: this.params.channelid,
|
||||
salesid: this.userInfo.salesid,
|
||||
phone: this.tel,
|
||||
msgcode: this.captcha
|
||||
};
|
||||
|
||||
$.api(
|
||||
"sms.sms.bindPhone",
|
||||
param,
|
||||
function (res) {
|
||||
func && func();
|
||||
}.bind(this), true
|
||||
);
|
||||
},
|
||||
/**
|
||||
* 发送手机验证码
|
||||
*/
|
||||
getCheckCode: function (r) {
|
||||
var that = this;
|
||||
|
||||
$.api(
|
||||
"sms.sms.sendBindCode",
|
||||
{
|
||||
agentid: this.params.agentid,
|
||||
channelid: this.params.channelid,
|
||||
salesid: '',
|
||||
isbind: 0,
|
||||
phone: this.tel
|
||||
},
|
||||
function (res) {
|
||||
if(res.code)
|
||||
that.verity = res.code;
|
||||
|
||||
that.disabled = true;
|
||||
that.timeout(60);
|
||||
|
||||
}.bind(this), true
|
||||
);
|
||||
},
|
||||
/**
|
||||
* 发送验证码后的倒计时
|
||||
* @param time 倒计时的时间(单位:秒)
|
||||
*/
|
||||
timeout: function (time) {
|
||||
time--;
|
||||
if(time > 0) {
|
||||
this.btnMsg=time;
|
||||
var that = this;
|
||||
setTimeout(function () {
|
||||
that.timeout(time);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.btnMsg='发送验证码';
|
||||
this.disabled = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user