提交 61e114bc authored 作者: hexi's avatar hexi

登陆错误解绑和安卓数据上报修复

#### 3.0.8.2019.07.22
1、修复安卓手机数据上报问题
#### 3.0.7.2019.07.17
1、用户手机号没有绑定微信,后端返回401,弹出提示框
#### 3.0.6.2019.07.16
1、upload-video 接口在 data 中增加vid传递
#### 3.0.6.2019.07.15
......
......@@ -13,8 +13,7 @@ const BindAccount = {
/* 点击确定 */
accountConfirm: function (e) {
const _that = this, _bind = _that.data.bindaccount
const _that = this, _bind = _that.data.bindaccount;
/* 调用接口 - 使用账号登录 */
wx.request({
url: util.config.URL_PATH2 + '/user_center/login',
......@@ -24,11 +23,12 @@ const BindAccount = {
service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version':util.config.version,
'apikey': '1pzy3FOYTQk7171FElDfaCuGrJZ9r7sT'
},
success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
wx.hideToast()
wx.hideToast();
wx.setStorageSync('userSession', { sessionKey: res.data.ticket });
let _token = wx.getStorageSync('userSession').sessionKey
......@@ -43,10 +43,26 @@ const BindAccount = {
token: _token,
tenant: util.config.tenant,
'apikey': '1pzy3FOYTQk7171FElDfaCuGrJZ9r7sT',
'version':util.config.version,
unionid: wx.getStorageSync('union_id')
},
success: res => {
if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode != 200 && res.statusCode != 401) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode && res.statusCode == 401) {
// 401特殊处理,这种情况,理解为手机号绑定错误
wx.hideToast();
wx.showModal({
title: '提示',
content: res.data.message,
showCancel:false,
complete (res) {
_that.setData({
'bindaccount.pwd': '',
});
}
})
return ;
}
let _userInfo = {
avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无',
nickName: res.data.nickname || _that.tempUserInfo.nickName || '无'
......
......@@ -46,7 +46,7 @@ const BindPhone = {
},
/* 点击确定 */
codeConfirm: function (e) {
const _that = this, _bind = _that.data.bindphone
const _that = this, _bind = _that.data.bindphone;
if (!_bind.phone || !/^1[3-9][0-9]{9}$/.test(_bind.phone)) { wx.showToast({ title: '请填入正确手机号', icon: 'none' }); return ; }
if (!_bind.code || !/^\d{4}$/.test(_bind.code)) { wx.showToast({ title: '请填入正确验证码', icon: 'none' }); return ; }
wx.showToast({ title: '验证中', icon: 'none' })
......@@ -56,11 +56,12 @@ const BindPhone = {
data: { mobile: _bind.phone, code: _bind.code, service: 'applet.ezijing.com' }, method: 'POST', header: {
'tenant': util.config.tenant,
'content-type': 'application/x-www-form-urlencoded',
'version':util.config.version,
'apikey': '1pzy3FOYTQk7171FElDfaCuGrJZ9r7sT'
},
success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return ; }
wx.hideToast()
wx.hideToast();
clearInterval(_that.timer);
wx.setStorageSync('userSession', { sessionKey: res.data.ticket });
......@@ -76,10 +77,26 @@ const BindPhone = {
token: _token,
'tenant': util.config.tenant,
'apikey': '1pzy3FOYTQk7171FElDfaCuGrJZ9r7sT',
'version': util.config.version,
unionid: wx.getStorageSync('union_id')
},
success: res => {
if (res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode != 200 && res.statusCode != 401) { wx.showToast({ title: res.data.message, icon: 'none' }); return; }
if (res.statusCode && res.statusCode == 401) {
// 401特殊处理,这种情况,理解为手机号绑定错误
wx.hideToast();
wx.showModal({
title: '提示',
content: res.data.message,
showCancel:false,
complete (res) {
_that.setData({
'bindphone.code': '',
});
}
})
return ;
}
let _userInfo = {
avatarUrl: res.data.avatar || _that.tempUserInfo.avatarUrl || '无',
nickName: res.data.nickname || _that.tempUserInfo.nickName || '无'
......
......@@ -301,8 +301,8 @@ Page({
playVA: function () {
let _data = this.data, _status = _data.status
this.setData({ 'ctrlBar.isPlay': true })
_status.isVideo && this._video.play()
_status.isAudio && this._audio.play()
_status.isVideo && this._video.play();
_status.isAudio && this._audio.play();
this.setHeartbeat()
},
/* controlBar页面 - 暂停音视频 - bindTap事件和内部调用 */
......@@ -335,7 +335,10 @@ Page({
beginAndOutFullScreen: function (e) {},
/* VideoOrAudio标签 - 开始/继续播放时触发play事件时,触发 - bindplay事件 */
beginPlayVA: function () {
this.setData({ 'initVAFlag': false })
if(this.data.initVAFlag){
this.setData({ 'initVAFlag': false })
this.setHeartbeat() //安卓手机播放之后才会上送进度
}
/* iphone6 8.4.1 首次初始化时,不能直接 设置进度并播放 */
if (this.isFirstInitAndSwitchVideo) {
if (!this._cache) this._cache = wx.getStorageSync('videoCacheCtrlBar') || {}
......@@ -381,8 +384,14 @@ Page({
let arr = _data.ctrlBar.currentTime.split(':'), tempTime = parseInt(arr[0] * 60) + parseInt(arr[1]);
this.setData({ 'ctrlBar.initial_time': tempTime })
/* 这里改成异步的,试一下 */
wx.setStorage('videoCacheCtrlBar', _data.ctrlBar)
wx.setStorage('audioCacheCtrlBar', _data.ctrlBar)
wx.setStorage({
'key': 'videoCacheCtrlBar',
'data': _data.ctrlBar
})
wx.setStorage({
'key': 'audioCacheCtrlBar',
'data': _data.ctrlBar
})
/* 由于 音视频相同,所以 设置方式设置成一致就可以了 */
/* 提交进度请求, 进度进行中,才计算上进度时间 */
if (this.realTimeProgress && tempTime != this.realTimeProgress.cpt) {
......
/**
* 所有相关配置项
*/
const config = {
// URL_PATH: 'http://dev.ezijing.com:3000/api', // 本地开发域名
const url_test = {
// URL_PATH: 'http://dev.ezijing.com:3000/api', // 本地开发域名
// outSiteLink: 'https://applets.ezijing.com', // 本地测试外链
// URL_PATH: 'https://api2.ezijing.com', // 测试域名
// outSiteLink: 'https://kelley2.ezijing.com', // 测试外链
URL_PATH: 'https://api.ezijing.com/tenant', // 正式域名 - 由于项目变动域名
URL_PATH1: 'https://lms-api2.ezijing.com', // 正式域名 - 由于项目变动域名
URL_PATH2: 'https://sso2.ezijing.com', // 正式域名 - 由于项目变动域名
outSiteLink: 'https://e-learning.ezijing.com', // 正式外链
tenant: 'collage',
version: '3.0.8'
};
const url_online = {
URL_PATH: 'https://api.ezijing.com/tenant', // 正式域名 - 由于项目变动域名
URL_PATH1: 'https://lms-api.ezijing.com', // 正式域名 - 由于项目变动域名
URL_PATH2: 'https://sso.ezijing.com', // 正式域名 - 由于项目变动域名
outSiteLink: 'https://e-learning.ezijing.com', // 正式外链
tenant: 'collage',
version: '3.0.5'
version: '3.0.8'
};
let config = url_online;
/* 请求接口统一 重定义 */
const requestApi = (obj) => {
let _token = wx.getStorageSync('userSession').sessionKey;
......@@ -133,32 +142,36 @@ const loginApi = (obj, callback) => {
'apikey': '1pzy3FOYTQk7171FElDfaCuGrJZ9r7sT'
},
success: res1 => {
let _token = res1.data.ticket;
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
wx.setStorageSync('userSession', { 'sessionKey': _token });
if (res1.statusCode == 200) {
let _token = res1.data.ticket;
if (!_token) {
wx.reLaunch({ url: '/pages/index/index' })
return ;
}
wx.setStorageSync('userSession', { 'sessionKey': _token });
/* 获取用户信息 */
wx.request({
url: config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: {
token: _token,
tenant: config.tenant,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
unionid: res.data.union_id
},
success: res2 => {
if (res2.statusCode != 200) { wx.showToast({ title: res.data.message||'获取用户信息失败', icon: 'none' }); return; }
/* 获取用户信息 */
wx.request({
url: config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: {
token: _token,
tenant: config.tenant,
'version': config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
unionid: res.data.union_id
},
success: res2 => {
if (res2.statusCode != 200) { wx.showToast({ title: res.data.message||'获取用户信息失败', icon: 'none' }); return; }
wx.setStorageSync("sid", res2.data.id);
wx.setStorageSync("uid", res1.data.uid);
callback(res1, obj);
}
})
}else{
callback(res1, obj);
}
wx.setStorageSync("sid", res2.data.id);
wx.setStorageSync("uid", res1.data.uid);
callback(res1, obj);
}
})
}
})
} else {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论