提交 4db36ee6 authored 作者: 王鹏飞's avatar 王鹏飞

merge...

...@@ -8,7 +8,8 @@ const getMyMsg = (callback) => { ...@@ -8,7 +8,8 @@ const getMyMsg = (callback) => {
util.requestApi({ util.requestApi({
url: util.config.URL_PATH1 + '/v2/education/message/my', url: util.config.URL_PATH1 + '/v2/education/message/my',
callback: function (res) { callback: function (res) {
let json = res.data.map(function (_, i) { let list = Array.isArray(res.data) ? res.data : res.data.list || []
let json = list.map(function (_, i) {
return { return {
isRead: false, isRead: false,
id: _.id, id: _.id,
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
"color": "#313131", "color": "#313131",
"backgroundColor": "#ffffff", "backgroundColor": "#ffffff",
"selectedColor": "#b49441", "selectedColor": "#b49441",
"aniamtion": "true",
"list": [ "list": [
{ {
"pagePath": "pages/learnSystem/home/home", "pagePath": "pages/learnSystem/home/home",
......
...@@ -13,7 +13,13 @@ Page({ ...@@ -13,7 +13,13 @@ Page({
hasUserInfo: false, hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo'), canIUse: wx.canIUse('button.open-type.getUserInfo'),
// 绑定手机号 相关 // 绑定手机号 相关
bindphone: { isShow: '', getCode: true, countDown: 60, phone: '', code: '' }, bindphone: {
isShow: '',
getCode: true,
countDown: 60,
phone: '',
code: ''
},
// 绑定账号 相关 // 绑定账号 相关
bindaccount: { isShow: '', account: '', pwd: '' }, bindaccount: { isShow: '', account: '', pwd: '' },
// 是否 可以使用登录 // 是否 可以使用登录
...@@ -42,16 +48,21 @@ Page({ ...@@ -42,16 +48,21 @@ Page({
/* 判别 是否显示 账号登录 */ /* 判别 是否显示 账号登录 */
wx.request({ wx.request({
url: util.config.URL_PATH1 + '/switch/lock', url: util.config.URL_PATH1 + '/switch/lock',
data: {}, method: 'GET', header: { tenant: 'survey', apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N' }, success: res => { data: {},
this.setData({ 'isUseAccountLogin': res.data.switch }) method: 'GET',
header: { tenant: 'survey', apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N' },
success: (res) => {
this.setData({ isUseAccountLogin: res.data.switch })
wx.setStorageSync('isUseAccountLogin', res.data.switch) wx.setStorageSync('isUseAccountLogin', res.data.switch)
} }
}) })
wx.hideLoading(); wx.hideLoading()
}, },
// e.detail.userInfo, // e.detail.userInfo,
/* 按键授权,微信新版 - 获取用户信息 - 授权方式 */ /* 按键授权,微信新版 - 获取用户信息 - 授权方式 */
getUserInfo: function (e) { this.getInfo() }, getUserInfo: function (e) {
this.getInfo()
},
/* 获取用户信息 并 判别是否跟紫荆账号绑定 */ /* 获取用户信息 并 判别是否跟紫荆账号绑定 */
getInfo: function () { getInfo: function () {
wx.showLoading({ title: '信息获取中...', mask: true }) wx.showLoading({ title: '信息获取中...', mask: true })
...@@ -63,29 +74,46 @@ Page({ ...@@ -63,29 +74,46 @@ Page({
wx.setStorageSync('userInfo', {}) wx.setStorageSync('userInfo', {})
if (loginRes.data && loginRes.data.code == 80120) { if (loginRes.data && loginRes.data.code == 80120) {
/* 判别 是否绑定过 紫荆账号 */ /* 判别 是否绑定过 紫荆账号 */
this.popupShow(res); wx.hideLoading(); return; this.popupShow(res)
} else if (loginRes.data && loginRes.data.status && loginRes.data.status != 200) { wx.hideLoading()
wx.hideLoading(); wx.showToast({ title: loginRes.data.message, icon: 'none' }); return; return
} else if (
loginRes.data &&
loginRes.data.status &&
loginRes.data.status != 200
) {
wx.hideLoading()
wx.showToast({ title: loginRes.data.message, icon: 'none' })
return
} else if (loginRes.statusCode != 200) { } else if (loginRes.statusCode != 200) {
wx.hideLoading(); wx.showToast({ title: loginRes.data.message, icon: 'none' }); return; wx.hideLoading()
wx.showToast({ title: loginRes.data.message, icon: 'none' })
return
} else { } else {
let _userInfo = { let _userInfo = {
avatarUrl: loginRes.data.avatar || res.userInfo.avatarUrl || '无', avatarUrl: loginRes.data.avatar || res.userInfo.avatarUrl || '无',
nickName: loginRes.data.nickname || res.userInfo.nickName || '无' nickName: loginRes.data.nickname || res.userInfo.nickName || '无'
} }
wx.setStorageSync('userInfo', _userInfo); wx.setStorageSync('userInfo', _userInfo)
this.setData({ userInfo: _userInfo, hasUserInfo: true }) this.setData({ userInfo: _userInfo, hasUserInfo: true })
wx.hideLoading(); this.goOutSite(); return; wx.hideLoading()
this.goOutSite()
return
} }
// if (res.data.errorCode == 40029) return _that.animteHint("code错误"); // if (res.data.errorCode == 40029) return _that.animteHint("code错误");
} else { } else {
this.setData({ userInfo: wx.getStorageSync('userInfo'), hasUserInfo: true }) this.setData({
wx.hideLoading(); this.goOutSite(); return; userInfo: wx.getStorageSync('userInfo'),
hasUserInfo: true
})
wx.hideLoading()
this.goOutSite()
return
} }
}) })
}, },
guestLogin: function () { guestLogin: function () {
this.accountConfirms(); this.accountConfirms()
// return; // return;
// wx.showModal({ // wx.showModal({
// title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮', // title: '提示', content: '本账户只适用于“体验学习”,正式学习请点击“登录”按钮',
...@@ -100,54 +128,69 @@ Page({ ...@@ -100,54 +128,69 @@ Page({
}, },
//游客登录 //游客登录
accountConfirms: function (e) { accountConfirms: function (e) {
const _that = this; const _that = this
/* 调用接口 - 使用账号登录 */ /* 调用接口 - 使用账号登录 */
wx.request({ wx.request({
url: util.config.URL_PATH2 + '/user_center/login', url: util.config.URL_PATH2 + '/user_center/login',
data: { data: {
login_name:'18519690645@163.com', login_name: '18519690645@163.com',
password: md5('uokoaduw' + '123456'.split('').reverse().join('') + 'auhgniq'), password: md5(
'uokoaduw' + '123456'.split('').reverse().join('') + 'auhgniq'
),
service: 'applet.ezijing.com' service: 'applet.ezijing.com'
}, method: 'POST', header: { },
'tenant': util.config.tenant, method: 'POST',
header: {
tenant: util.config.tenant,
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'version': util.config.version, version: util.config.version,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N' apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N'
}, },
success: function (res) { success: function (res) {
if (res.statusCode && res.statusCode != 200) { wx.showToast({ title: res.data.message, icon: 'none' }); return; } if (res.statusCode && res.statusCode != 200) {
wx.hideToast(); wx.showToast({ title: res.data.message, icon: 'none' })
wx.setStorageSync('userSession', { sessionKey: res.data.ticket }); return
}
wx.hideToast()
wx.setStorageSync('userSession', { sessionKey: res.data.ticket })
let _token = wx.getStorageSync('userSession').sessionKey let _token = wx.getStorageSync('userSession').sessionKey
if (!_token) { if (!_token) {
wx.reLaunch({ url: '/pages/index/index' }) wx.reLaunch({ url: '/pages/index/index' })
return; return
} }
/* 获取用户信息 */ /* 获取用户信息 */
wx.request({ wx.request({
url: util.config.URL_PATH1 + '/user/check-access', url: util.config.URL_PATH1 + '/user/check-access',
data: {}, method: 'GET', header: { data: {},
method: 'GET',
header: {
token: _token, token: _token,
tenant: util.config.tenant, tenant: util.config.tenant,
'apikey': 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N', apikey: 'pP5ECUqRDLDzuh4qRuJro0L1LPgjLP0N',
'version': util.config.version, version: util.config.version,
unionid: wx.getStorageSync('union_id') unionid: wx.getStorageSync('union_id')
}, },
success: res => { success: (res) => {
if (res.statusCode != 200 && res.statusCode != 401) { 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
}
let _userInfo = { let _userInfo = {
avatarUrl: res.data.avatar || '无', avatarUrl: res.data.avatar || '无',
nickName: res.data.nickname || '游客登录' nickName: res.data.nickname || '游客登录'
} }
wx.setStorageSync('userInfo', _userInfo); wx.setStorageSync('userInfo', _userInfo)
_that.setData({ userInfo: _userInfo, hasUserInfo: true }) _that.setData({ userInfo: _userInfo, hasUserInfo: true })
_that.popupClose() _that.popupClose()
_that.goOutSite() _that.goOutSite()
} }
}) })
}, },
fail: function (res) { wx.hideToast(); wx.showToast({ title: res, icon: 'none' }); } fail: function (res) {
wx.hideToast()
wx.showToast({ title: res, icon: 'none' })
}
}) })
}, },
/* 手机号绑定 方法 */ /* 手机号绑定 方法 */
......
...@@ -22,7 +22,7 @@ Page({ ...@@ -22,7 +22,7 @@ Page({
onLoad: function (options) { onLoad: function (options) {
wx.showLoading({ title: '页面加载中...', mask: true }) wx.showLoading({ title: '页面加载中...', mask: true })
MsgApi.getMyMsg((json) => { MsgApi.getMyMsg((json) => {
this.setData({ 'msgList': json }) this.setData({ msgList: json })
wx.hideLoading() wx.hideLoading()
}) })
}, },
...@@ -47,15 +47,15 @@ Page({ ...@@ -47,15 +47,15 @@ Page({
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
// 显示顶部刷新图标 // 显示顶部刷新图标
wx.showNavigationBarLoading(); wx.showNavigationBarLoading()
wx.showLoading({ title: '更新中...', mask: true }) wx.showLoading({ title: '更新中...', mask: true })
MsgApi.getMyMsg((json) => { MsgApi.getMyMsg((json) => {
this.setData({ 'msgList': json }) this.setData({ msgList: json.list })
wx.hideLoading() wx.hideLoading()
// 隐藏导航栏加载框 // 隐藏导航栏加载框
wx.hideNavigationBarLoading(); wx.hideNavigationBarLoading()
// 停止下拉动作 // 停止下拉动作
wx.stopPullDownRefresh(); wx.stopPullDownRefresh()
}) })
}, },
/** /**
...@@ -81,7 +81,7 @@ Page({ ...@@ -81,7 +81,7 @@ Page({
* 滚动到底部,加载更多数据 * 滚动到底部,加载更多数据
*/ */
loadmore: function () { loadmore: function () {
let _that = this; let _that = this
wx.showLoading({ title: '数据加载中...', mask: true }) wx.showLoading({ title: '数据加载中...', mask: true })
setTimeout(function () { setTimeout(function () {
wx.showToast({ title: '没有更多了', icon: 'none' }) wx.showToast({ title: '没有更多了', icon: 'none' })
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
*/ */
var Audio = function (src, _that) { var Audio = function (src, _that) {
if (!(this instanceof Audio)) { if (!(this instanceof Audio)) {
return new Audio(src, _that); return new Audio(src, _that)
} else { } else {
this._audio = this.init(src, _that); this._audio = this.init(src, _that)
this.currentTime = 0; // 当前时间 this.currentTime = 0 // 当前时间
this.totalTime = 0; // 总时间 this.totalTime = 0 // 总时间
this.rateIndex = 2; // 取值为 RATE中的 下标 0,1,2,3,4 this.rateIndex = 2 // 取值为 RATE中的 下标 0,1,2,3,4
} }
} }
/** /**
...@@ -27,38 +27,48 @@ Audio.prototype = { ...@@ -27,38 +27,48 @@ Audio.prototype = {
constructor: Audio, constructor: Audio,
RATE: ['0.5', '0.8', '1.0', '1.25', '1.5'], RATE: ['0.5', '0.8', '1.0', '1.25', '1.5'],
init: function (src, _that) { init: function (src, _that) {
let _auCtx = wx.createInnerAudioContext(); let _auCtx = wx.createInnerAudioContext()
_auCtx.autoplay = false; wx.setInnerAudioOption({ obeyMuteSwitch: false })
_auCtx.src = src; _auCtx.autoplay = false
_auCtx.src = src
/* 使用绑定事件,代替wxml中的事件绑定 */ /* 使用绑定事件,代替wxml中的事件绑定 */
_auCtx.onTimeUpdate(() => { let e = { detail: { currentTime: _auCtx.currentTime, duration: _auCtx.duration } }; _that.timeUpdate(e) }) _auCtx.onTimeUpdate(() => {
_auCtx.onPlay(() => { _that.beginPlayVA() }) let e = {
_auCtx.onError((e) => { _that.playError(e) }) detail: { currentTime: _auCtx.currentTime, duration: _auCtx.duration }
_auCtx.onEnded(() => { _that.playEnded }) }
return _auCtx; _that.timeUpdate(e)
})
_auCtx.onPlay(() => {
_that.beginPlayVA()
})
_auCtx.onError((e) => {
_that.playError(e)
})
_auCtx.onEnded(() => {
_that.playEnded
})
return _auCtx
}, },
play: function () { play: function () {
this._audio.play(); this._audio.play()
}, },
pause: function () { pause: function () {
this._audio.pause(); this._audio.pause()
}, },
stop: function () { stop: function () {
this._audio.stop(); this._audio.stop()
}, },
seek: function (time) { seek: function (time) {
this._audio.seek(time); this._audio.seek(time)
}, },
fastSlow15: function (timeStr) { fastSlow15: function (timeStr) {
this._audio.seek(this.currentTime + parseInt(timeStr)); this._audio.seek(this.currentTime + parseInt(timeStr))
}, },
rate: function () { rate: function () {
this.rateIndex++; this.rateIndex++
if (this.rateIndex > 4) this.rateIndex = 0; if (this.rateIndex > 4) this.rateIndex = 0
this._audio.playbackRate(parseFloat(this.RATE[this.rateIndex])); this._audio.playbackRate(parseFloat(this.RATE[this.rateIndex]))
} }
} }
module.exports = { module.exports = {
Audio: Audio Audio: Audio
......
<template name='contentAudio'> <template name='contentAudio'>
<view class='content-audio' <view class='content-audio' wx:if="{{status.isAudio}}">
style='{{status.isSet && status.isAudio ? "display: none;" : "" }} {{status.isImages && status.isAudio ? "display: none;" : "" }} {{status.isVideo ? "display: none;" : "" }}'
>
<image src='./contentAudio/icons/loading_small.gif' class='loading-image {{status.imagesLoaded && "none"}}' mode='aspectFit'/> <image src='./contentAudio/icons/loading_small.gif' class='loading-image {{status.imagesLoaded && "none"}}' mode='aspectFit'/>
<image wx:if='{{image.imgUrls[image.current]}}' src='{{image.imgUrls[image.current]}}' class='slide-image' mode='aspectFill' bindload='imagesLoaded'/> <image wx:if='{{image.imgUrls[image.current]}}' src='{{image.imgUrls[image.current]}}' class='slide-image' mode='aspectFill' bindload='imagesLoaded'/>
<view wx:if='{{!image.imgUrls[image.current]}}' class='slide-image'>本课程暂无PPT</view> <view wx:if='{{!image.imgUrls[image.current]}}' class='slide-image'>本课程暂无PPT</view>
......
<template name='contentVideo'> <template name='contentVideo'>
<!-- 这里加 这么多判断原因,video组件在真机上测试,一定在最上层,其他任何元素都挡不住,只能先隐藏,需要时再显示 --> <!-- 这里加 这么多判断原因,video组件在真机上测试,一定在最上层,其他任何元素都挡不住,只能先隐藏,需要时再显示 -->
<view class='content-video' <view class='content-video' wx:if="{{status.isVideo}}">
style='{{status.isSet && status.isVideo ? "display: none;" : "" }} {{status.isImages && status.isVideo ? "display: none;" : "" }} {{status.isAudio ? "display: none;" : "" }} {{chapterList.isShow && status.isVideo ? "display: none;" : "" }} {{ status.isLoading ? "display: none": "" }}'
>
<video id='my-video' class='my-video' src='{{video.src}}' show-center-play-btn='{{false}}' controls='{{false}}' bindtimeupdate='timeUpdate' bindfullscreenchange='beginAndOutFullScreen' bindpause='beginPauseVA' bindplay='beginPlayVA' binderror='playError' bindended='playEnded' autoplay='{{true}}'></video> <video id='my-video' class='my-video' src='{{video.src}}' show-center-play-btn='{{false}}' controls='{{false}}' bindtimeupdate='timeUpdate' bindfullscreenchange='beginAndOutFullScreen' bindpause='beginPauseVA' bindplay='beginPlayVA' binderror='playError' bindended='playEnded' autoplay='{{true}}'></video>
</view> </view>
</template> </template>
\ No newline at end of file
...@@ -13,14 +13,16 @@ ...@@ -13,14 +13,16 @@
<template is='pageLoading'></template> <template is='pageLoading'></template>
</block> </block>
<block wx:if='{{status.isSupport}}'> <block wx:if='{{status.isSupport}}'>
<template is='contentAudio' data='{{status, audio, image, ctrlBar}}'></template>
<template is='contentVideo' data='{{status, video, chapterList, ctrlBar}}'></template>
<block wx:if='{{status.isSet}}'> <block wx:if='{{status.isSet}}'>
<template is='setContent' data='{{ctrlBar}}'></template> <template is='setContent' data='{{ctrlBar}}'></template>
</block><block wx:elif='{{status.isImages}}'> </block>
<block wx:elif='{{status.isImages}}'>
<template is='contentImages' data='{{status, image}}'></template> <template is='contentImages' data='{{status, image}}'></template>
</block> </block>
<template is='contentAudio' data='{{status, audio, image, ctrlBar}}'></template> </block>
<template is='contentVideo' data='{{status, video, chapterList, ctrlBar}}'></template> <block wx:else>
</block><block wx:else>
<template is='noSupport'></template> <template is='noSupport'></template>
</block> </block>
<template is='controlBar' data='{{status, video, ctrlBar, chapterList, initVAFlag}}'></template> <template is='controlBar' data='{{status, video, ctrlBar, chapterList, initVAFlag}}'></template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论