Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online
Commits
2fd18dcb
提交
2fd18dcb
authored
8月 05, 2019
作者:
hexi
浏览文件
操作
浏览文件
下载
差异文件
merge
上级
1758907c
5bfac678
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
131 行增加
和
54 行删除
+131
-54
ChapterApi.js
learnOnline/apiService/ChapterApi.js
+17
-4
CourseApi.js
learnOnline/apiService/CourseApi.js
+1
-0
history.md
learnOnline/history.md
+6
-0
bindAccount.js
learnOnline/pages/index/bindAccount/bindAccount.js
+20
-4
bindPhone.js
learnOnline/pages/index/bindPhone/bindPhone.js
+20
-3
courseContent.js
learnOnline/pages/learnSystem/courseContent/courseContent.js
+3
-2
courseList.wxml
...ages/learnSystem/courseContent/courseList/courseList.wxml
+1
-1
selectChapterList.wxml
...ages/videoPlayer/selectChapterList/selectChapterList.wxml
+1
-1
show.js
learnOnline/pages/videoPlayer/show.js
+20
-10
util.js
learnOnline/utils/util.js
+42
-29
没有找到文件。
learnOnline/apiService/ChapterApi.js
浏览文件 @
2fd18dcb
...
...
@@ -20,6 +20,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo
=
{
id
:
_
.
children
[
j
-
1
].
resource_id
,
time
:
_
.
children
[
j
-
1
].
video
&&
util
.
durationToTimeString
(
_
.
children
[
j
-
1
].
video
.
video_length
)
||
''
,
videoType
:
_
.
children
[
j
-
1
].
video
&&
_
.
children
[
j
-
1
].
video
.
video_provider
||
''
,
name
:
_
.
children
[
j
-
1
].
name
}
}
else
if
(
i
-
1
>=
0
)
{
...
...
@@ -27,6 +28,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo
=
{
id
:
_temp
.
children
[
_temp
.
children
.
length
-
1
].
resource_id
,
time
:
_temp
.
children
[
_temp
.
children
.
length
-
1
].
video
&&
util
.
durationToTimeString
(
_temp
.
children
[
_temp
.
children
.
length
-
1
].
video
.
video_length
)
||
''
,
videoType
:
_
.
children
[
_temp
.
children
.
length
-
1
].
video
&&
_
.
children
[
_temp
.
children
.
length
-
1
].
video
.
video_provider
||
''
,
name
:
_temp
.
children
[
_temp
.
children
.
length
-
1
].
name
}
}
...
...
@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo
=
{
id
:
_
.
children
[
j
+
1
].
resource_id
,
time
:
_
.
children
[
j
+
1
].
video
&&
util
.
durationToTimeString
(
_
.
children
[
j
+
1
].
video
.
video_length
)
||
''
,
videoType
:
_
.
children
[
j
+
1
].
video
&&
_
.
children
[
j
+
1
].
video
.
video_provider
||
''
,
name
:
_
.
children
[
j
+
1
].
name
}
}
else
if
(
i
+
1
<
res
.
data
.
chapters
.
length
)
{
...
...
@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo
=
{
id
:
_temp
.
children
[
0
].
resource_id
,
time
:
_temp
.
children
[
0
].
video
&&
util
.
durationToTimeString
(
_temp
.
children
[
0
].
video
.
video_length
)
||
''
,
videoType
:
_
.
children
[
0
].
video
&&
_
.
children
[
0
].
video
.
video_provider
||
''
,
name
:
_temp
.
children
[
0
].
name
}
}
...
...
@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
return
{
id
:
__
.
resource_id
,
time
:
__
.
video
&&
util
.
durationToTimeString
(
__
.
video
.
video_length
)
||
''
,
videoType
:
__
.
video
&&
__
.
video
.
video_provider
,
name
:
__
.
name
,
homework
:
_homework
}
...
...
@@ -78,9 +83,17 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
})
}
/* 获取对应某个章节的详细信息 */
const
getCurrentChapterDetail
=
(
vid
,
callback
)
=>
{
const
getCurrentChapterDetail
=
(
vid
,
videoType
,
callback
)
=>
{
// CC视频请求数据接口
let
_url
=
null
;
if
(
videoType
==
3
){
_url
=
util
.
config
.
URL_PATH1
+
'/v2/education/aliyun-video-streaming'
}
else
{
_url
=
util
.
config
.
URL_PATH1
+
'/v2/education/video-streaming'
}
util
.
requestApi
({
url
:
util
.
config
.
URL_PATH1
+
'/v2/education/video-streaming'
,
url
:
_url
,
method
:
'POST'
,
data
:
{
vid
:
vid
...
...
@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => {
callback
:
function
(
res
)
{
let
json
=
{
video
:
{
src
:
res
.
data
.
video
[
0
].
playurl
,
src
:
videoType
==
3
?
res
.
data
.
video
&&
res
.
data
.
video
.
LD
:
res
.
data
.
video
[
0
]
&&
res
.
data
.
video
[
0
].
playurl
,
spareSrc
:
'http://pd4t7ae3m.bkt.clouddn.com/test.mp4'
// 正式环境时,需要将 contentVideo 中 spareSrc 改成 src
},
audio
:
{
src
:
res
.
data
.
audio
[
0
].
url
,
src
:
videoType
==
3
?
res
.
data
.
video
&&
res
.
data
.
video
.
SQ
:
res
.
data
.
audio
[
0
].
url
,
poster
:
res
.
data
.
ppts
&&
res
.
data
.
ppts
[
0
]
&&
res
.
data
.
ppts
[
0
].
ppt_url
||
''
},
image
:
{
...
...
learnOnline/apiService/CourseApi.js
浏览文件 @
2fd18dcb
...
...
@@ -106,6 +106,7 @@ const getCourseDetail = (id, sid, callback) => {
sid
:
cur
.
semester_id
,
vid
:
__
.
resource_id
,
time
:
__
.
video
&&
util
.
durationToTimeString
(
__
.
video
.
video_length
)
||
''
,
videoType
:
__
.
video
&&
__
.
video
.
video_provider
,
name
:
__
.
name
,
homework
:
_homework
}
...
...
learnOnline/history.md
浏览文件 @
2fd18dcb
#### 3.0.8.2019.07.25
1、增加阿里视频源
#### 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
...
...
learnOnline/pages/index/bindAccount/bindAccount.js
浏览文件 @
2fd18dcb
...
...
@@ -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'
:
'lfoWIsuLZQZ72RBKWe2xpYsxGfty8R2s'
},
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
...
...
@@ -42,11 +42,27 @@ const BindAccount = {
data
:
{},
method
:
'GET'
,
header
:
{
token
:
_token
,
tenant
:
util
.
config
.
tenant
,
'version'
:
util
.
config
.
version
,
'apikey'
:
'lfoWIsuLZQZ72RBKWe2xpYsxGfty8R2s'
,
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
||
'无'
...
...
learnOnline/pages/index/bindPhone/bindPhone.js
浏览文件 @
2fd18dcb
...
...
@@ -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'
:
'lfoWIsuLZQZ72RBKWe2xpYsxGfty8R2s'
},
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
});
...
...
@@ -75,11 +76,27 @@ const BindPhone = {
data
:
{},
method
:
'GET'
,
header
:
{
token
:
_token
,
'tenant'
:
util
.
config
.
tenant
,
'version'
:
util
.
config
.
version
,
'apikey'
:
'lfoWIsuLZQZ72RBKWe2xpYsxGfty8R2s'
,
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
||
'无'
...
...
learnOnline/pages/learnSystem/courseContent/courseContent.js
浏览文件 @
2fd18dcb
...
...
@@ -223,7 +223,7 @@ Page({
/* 如果未选课,不能查看课程内容 */
if
(
!
this
.
data
.
headerInfo
.
isStart
)
{
wx
.
showToast
({
title
:
'先选课,才能看'
,
icon
:
'none'
,
duration
:
1500
});
return
;
}
let
_data
=
e
.
target
.
dataset
let
cid
=
_data
.
cid
,
sid
=
_data
.
sid
,
vid
=
_data
.
vid
let
cid
=
_data
.
cid
,
sid
=
_data
.
sid
,
vid
=
_data
.
vid
,
video_type
=
_data
.
videoType
;
if
(
!
_data
.
hasva
)
{
/* 如果存在 - 课后习题类型, type:3、work_type:1 */
let
i1
=
_data
.
index
,
i2
=
_data
.
index1
...
...
@@ -238,8 +238,9 @@ Page({
}
wx
.
showToast
({
title
:
'请在PC上使用该功能'
,
icon
:
'none'
});
return
;
}
wx
.
navigateTo
({
url
:
'/pages/videoPlayer/show'
+
'?cid='
+
cid
+
'&sid='
+
sid
+
'&vid='
+
vid
url
:
'/pages/videoPlayer/show'
+
'?cid='
+
cid
+
'&sid='
+
sid
+
'&vid='
+
vid
+
'&type='
+
video_type
})
},
/**
...
...
learnOnline/pages/learnSystem/courseContent/courseList/courseList.wxml
浏览文件 @
2fd18dcb
...
...
@@ -8,7 +8,7 @@
</view>
<block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'>
<view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'
data-type='{{item1.videoType}}'
>
{{item1.name}}
<view class='time'>{{item1.time}}</view>
</view>
...
...
learnOnline/pages/videoPlayer/selectChapterList/selectChapterList.wxml
浏览文件 @
2fd18dcb
...
...
@@ -7,7 +7,7 @@
<view class='title'>{{item.title}}</view>
<block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'>
<view class='body {{item1.id === chapterList.currentChapterId && "on"}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'
data-type='{{item1.videoType}}'
>
{{item1.name}}
<view class='time'>{{item1.time}}</view>
</view>
...
...
learnOnline/pages/videoPlayer/show.js
浏览文件 @
2fd18dcb
...
...
@@ -142,12 +142,14 @@ Page({
},
200
);
},
/* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */
ajaxInitGetInfo
:
function
(
vid
)
{
ajaxInitGetInfo
:
function
(
vid
,
videoType
)
{
let
cid
=
this
.
data
.
options
.
cid
,
sid
=
this
.
data
.
options
.
sid
,
did
=
'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8'
;
ChapterApi
.
getChapterList
(
cid
,
sid
,
vid
,
(
json
)
=>
{
this
.
setData
({
'chapterList'
:
json
})
})
ChapterApi
.
getCurrentChapterDetail
(
vid
,
(
json
)
=>
{
// CC视频走这个接口
ChapterApi
.
getCurrentChapterDetail
(
vid
,
videoType
,
(
json
)
=>
{
// 播放的视频数据
this
.
setData
({
'video'
:
json
.
video
})
this
.
setData
({
'audio'
:
json
.
audio
})
this
.
setData
({
'image'
:
json
.
image
})
...
...
@@ -191,7 +193,7 @@ Page({
}
},
/* 生命周期函数--监听页面初次渲染完成 */
onReady
:
function
()
{
this
.
ajaxInitGetInfo
(
this
.
data
.
options
.
vid
);
},
onReady
:
function
()
{
this
.
ajaxInitGetInfo
(
this
.
data
.
options
.
vid
,
this
.
data
.
options
.
type
);
},
/* controlBar页面 - 切换音频页面 - bindTap事件 */
showContentAudio
:
function
()
{
...
...
@@ -230,7 +232,6 @@ Page({
jumpToOtherVA
:
function
(
e
)
{
/* 跳转时,清空当前播放状态 */
this
.
heartbeat
&&
clearInterval
(
this
.
heartbeat
)
let
_data
=
e
.
target
.
dataset
;
if
(
!
_data
.
hasva
)
{
/* 如果存在 - 课后习题类型, type:3、work_type:1 */
...
...
@@ -248,7 +249,7 @@ Page({
}
this
.
isFirstInitAndSwitchVideo
=
true
;
this
.
statusClear
(
_data
.
name
,
_data
.
id
);
this
.
ajaxInitGetInfo
(
_data
.
id
);
this
.
ajaxInitGetInfo
(
_data
.
id
,
_data
.
type
);
},
/* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */
statusClear
:
function
(
name
,
id
)
{
...
...
@@ -301,8 +302,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 +336,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 +385,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
)
{
...
...
learnOnline/utils/util.js
浏览文件 @
2fd18dcb
/**
* 所有相关配置项
*/
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://ep-api2.ezijing.com'
,
// 正式域名 - 由于项目变动域名
URL_PATH2
:
'https://sso2.ezijing.com'
,
// 正式域名 - 由于项目变动域名
outSiteLink
:
'https://e-learning.ezijing.com'
,
// 正式外链
tenant
:
'classes'
,
version
:
'3.0.8'
};
const
url_online
=
{
URL_PATH
:
'https://api.ezijing.com/tenant'
,
// 正式域名 - 由于项目变动域名
URL_PATH1
:
'https://ep-api.ezijing.com'
,
// 正式域名 - 由于项目变动域名
URL_PATH2
:
'https://sso.ezijing.com'
,
// 正式域名 - 由于项目变动域名
outSiteLink
:
'https://e-learning.ezijing.com'
,
// 正式外链
version
:
'3.0.5'
,
tenant
:
'classes'
};
tenant
:
'classes'
,
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'
:
'lfoWIsuLZQZ72RBKWe2xpYsxGfty8R2s'
},
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
:
res2
.
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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论