|
|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<view class="content " >
|
|
|
- <!-- <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
|
|
|
+ <view class="header-nav" :style="{height: `calc(88rpx + ${statusBarHeight}px)`,paddingTop: statusBarHeight + 'px'}">
|
|
|
<u-icon name="arrow-left" size="28" @click="tosales" v-if="appToken"></u-icon>
|
|
|
<view class="header-title" :style="{width:menuButtonLeft + 'px',height:menuButtonH+'px',lineHeight:menuButtonH+'px'}">{{courseInfo.title}}</view>
|
|
|
- </view> -->
|
|
|
+ </view>
|
|
|
<view class="video-box" >
|
|
|
<image v-if="!isLogin || isAddKf!=1" class="video-poster" :src="courseInfo.imgUrl" mode="aspectFill">
|
|
|
</image>
|
|
|
@@ -64,7 +64,7 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<view class="descbox-desc" id="descbox-desc" :style="{height: isExpand ? 'auto': '42rpx'}">
|
|
|
- <text>{{courseInfo.description==null?'暂无简介':courseInfo.description}}</text>
|
|
|
+ <text>{{courseInfo.description==null?'':courseInfo.description}}</text>
|
|
|
<view :class="isExpand ? 'expand': 'expand expand-ab'" v-if="isLogin&&isAddKf==1&&textHeight > 21">
|
|
|
<text @click="handleExpand">{{isExpand ? '收起简介' : '展开简介'}}</text>
|
|
|
<image :src="imgPath+'/app/image/course_arrow_up_icon.png'" v-show="isExpand"></image>
|
|
|
@@ -247,7 +247,7 @@
|
|
|
<view class="submitname" @click="confimrname" :class="nameuser&&avataruser?'subact':'sub'">确定</view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
|
- <view class="footer-tips">重庆云联融智提供技术支持</view>
|
|
|
+ <!-- <view class="footer-tips">重庆云联融智提供技术支持</view> -->
|
|
|
<!-- footer -->
|
|
|
<view class="footer" v-if="videoId">
|
|
|
<view class="btns" >
|
|
|
@@ -259,8 +259,12 @@
|
|
|
class="author-btn"
|
|
|
open-type="getUserInfo" :disabled="userdisabled"
|
|
|
@getuserinfo="userInfologin" v-if="authType==0&&!isquestion">{{isLogin&&isAddKf==1 ? '提交答案领取奖励' : '立即学习'}}</button> -->
|
|
|
- <button class="author-btn"
|
|
|
- @click="submit">{{isLogin&&isAddKf==1 ?'提交答案领取奖励' : '立即学习'}}</button>
|
|
|
+ <button class="author-btn" v-if="quesList&&quesList.length>0&&isLogin&&isAddKf==1&&isRedPackage!=0"
|
|
|
+ @click="submit">提交答案领取奖励</button>
|
|
|
+ <button class="author-btn" v-if="quesList&&quesList.length>0&&isLogin&&isAddKf==1&&isRedPackage==0"
|
|
|
+ @click="submit">提交答案</button>
|
|
|
+ <button class="author-btn" v-if="!isLogin&&isAddKf!=1 "
|
|
|
+ @click="submit">立即学习</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view>
|
|
|
@@ -268,12 +272,18 @@
|
|
|
</view>
|
|
|
<u-loading-page :loading="viewload" iconSize="32" loadingColor="#3c9cff" fontSize="24"
|
|
|
:loading-text="loadingtext"></u-loading-page>
|
|
|
+ <ykscreenRecord></ykscreenRecord>
|
|
|
+ <courseExpiration v-if="showExpiration" :code="resCode" :msg="resMsg" :qrcode="qrcode"
|
|
|
+ :userId="user && userInfo.userId ? userInfo.userId : ''"></courseExpiration>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { generateRandomString} from "@/utils/common.js"
|
|
|
import dayjs from 'dayjs';
|
|
|
+ import { mapGetters } from 'vuex';
|
|
|
+ import ykscreenRecord from './yk-screenRecord/yk-screenRecord.vue'
|
|
|
+ import courseExpiration from './components/courseExpiration.vue'
|
|
|
import {
|
|
|
getErrMsg,
|
|
|
getH5CourseByVideoId,
|
|
|
@@ -291,9 +301,17 @@
|
|
|
import {
|
|
|
getConfigByKey
|
|
|
} from "@/api/user.js"
|
|
|
+
|
|
|
export default {
|
|
|
+ components: {
|
|
|
+ ykscreenRecord,
|
|
|
+ courseExpiration
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ resMsg :'',
|
|
|
+ resCode:"",
|
|
|
+ showExpiration:false,
|
|
|
videoItem:{},
|
|
|
viewload:true,
|
|
|
loadingtext:"数据加载中...",
|
|
|
@@ -424,6 +442,8 @@
|
|
|
projectId:'',
|
|
|
showfalse:false,
|
|
|
contentmsg:null,
|
|
|
+ isRedPackage:null,
|
|
|
+ miniAppAuthType:2
|
|
|
}
|
|
|
},
|
|
|
filters: {
|
|
|
@@ -464,8 +484,27 @@
|
|
|
avataruser() {
|
|
|
return this.userinfos.avatar
|
|
|
},
|
|
|
+ ...mapGetters(['coureLogin']),
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ coureLogin: {
|
|
|
+ immediate: true, // 页面一进入就检查一次
|
|
|
+ handler(val) {
|
|
|
+ if (val == 2&&this.isLogin) {
|
|
|
+ console.log("看课AppToken失效,请重新登录")
|
|
|
+ this.isLogin = false
|
|
|
+ this.isAddKf = 0
|
|
|
+ if(this.miniAppAuthType==2){
|
|
|
+ this.goLogin()
|
|
|
+ }else{
|
|
|
+ this.goLogins()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
+
|
|
|
this.getWebviewUrl()
|
|
|
uni.$on('usercode',(data)=>{
|
|
|
console.log('huoqu ',data)
|
|
|
@@ -493,7 +532,8 @@
|
|
|
const keys = decodeURIComponent(Object.keys(option)[0]);
|
|
|
this.urlOption=JSON.parse(keys.split('course=')[1])
|
|
|
}else{
|
|
|
- this.urlOption = option.course ? JSON.parse(option.course) : {}
|
|
|
+ console.log(4444,option)
|
|
|
+ this.urlOption = option.course ? JSON.parse(decodeURIComponent(option.course)) : {}
|
|
|
}
|
|
|
uni.setStorageSync('H5course',this.urlOption)
|
|
|
this.videoId = this.urlOption.videoId
|
|
|
@@ -508,11 +548,11 @@
|
|
|
// this.sortLink = this.urlOption.link || ''
|
|
|
this.getMenuButton()
|
|
|
// #ifdef MP-WEIXIN
|
|
|
- // if(this.$store.state.logoname!=='乐氏本源'&&!uni.getStorageSync('userInfos')){
|
|
|
+ // if(this.$store.state.logoname!=='乐氏本源'&&!uni.getStorageSync('userinfos')){
|
|
|
// this.userlogo=true
|
|
|
// }
|
|
|
- console.log(uni.getStorageSync('userInfos'))
|
|
|
- if(!uni.getStorageSync('userInfos')&&this.$store.state.logoname=='乐氏本源'){
|
|
|
+ console.log(uni.getStorageSync('userinfos'))
|
|
|
+ if(!uni.getStorageSync('userinfos')&&this.$store.state.logoname=='乐氏本源'){
|
|
|
uni.navigateTo({
|
|
|
url:'/pages_course/webview'
|
|
|
})
|
|
|
@@ -522,7 +562,7 @@
|
|
|
},
|
|
|
onShow() {
|
|
|
this.userinfos=uni.getStorageSync('userinfos')
|
|
|
- this.userinfo=uni.getStorageSync('userinfo')
|
|
|
+ this.userInfo=uni.getStorageSync('userInfo')
|
|
|
this.tipsOpen = false
|
|
|
this.isExpand = true
|
|
|
this.uuId = generateRandomString(16)
|
|
|
@@ -533,7 +573,7 @@
|
|
|
console.log(AppToken)
|
|
|
if(AppToken){
|
|
|
// this.isLogin=true
|
|
|
- if(this.isAddKf == 1&&this.userinfo.userId){
|
|
|
+ if(this.isAddKf == 1&&this.userInfo.userId){
|
|
|
console.log(1233)
|
|
|
this.getH5CourseVideoDetails()
|
|
|
} else{
|
|
|
@@ -588,12 +628,15 @@
|
|
|
methods: {
|
|
|
getWebviewUrl() {
|
|
|
var data = {
|
|
|
- key: 'course.config'
|
|
|
+ key: 'course.config',
|
|
|
+ appId:wx.getAccountInfoSync().miniProgram.appId,
|
|
|
}
|
|
|
getConfigByKey(data).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
console.log("getConfigByKey====", JSON.parse(res.data))
|
|
|
let data = JSON.parse(res.data,)
|
|
|
+ this.miniAppAuthType=data.miniAppAuthType
|
|
|
+ uni.setStorageSync('miniAppAuthType',data.miniAppAuthType)
|
|
|
uni.setStorageSync('setWebviewUrl',data.userCourseAuthDomain)
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
@@ -630,10 +673,10 @@
|
|
|
uni.getStorageSync('TOKEN_WEXIN');
|
|
|
this.userInfo=uni.getStorageSync('userInfo');
|
|
|
this.isLogin = true
|
|
|
- this.getH5CourseVideoDetails()
|
|
|
- // setTimeout(()=>{
|
|
|
- // this.getIsAddKf()
|
|
|
- // },200)
|
|
|
+ // this.getH5CourseVideoDetails()
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.getIsAddKf()
|
|
|
+ },200)
|
|
|
}else if(res.code==406){
|
|
|
uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
@@ -681,7 +724,7 @@
|
|
|
});
|
|
|
return
|
|
|
}
|
|
|
- uni.setStorageSync('userInfos',this.userinfos)
|
|
|
+ uni.setStorageSync('userinfos',this.userinfos)
|
|
|
this.editUserA()
|
|
|
this.userlogo=false
|
|
|
},
|
|
|
@@ -714,7 +757,7 @@
|
|
|
},
|
|
|
tosales(){
|
|
|
uni.switchTab({
|
|
|
- url:"/pages/index/index"
|
|
|
+ url:"/pages/home/index"
|
|
|
})
|
|
|
},
|
|
|
closepop(){
|
|
|
@@ -723,31 +766,23 @@
|
|
|
open(){
|
|
|
|
|
|
},
|
|
|
- userInfologin(e){
|
|
|
- console.log(e)
|
|
|
- this.userdisabled=true
|
|
|
+ goLogins(){
|
|
|
+ // this.userdisabled=true
|
|
|
uni.showLoading({
|
|
|
title: "处理中..."
|
|
|
});
|
|
|
- if (e.mp.detail.errMsg == 'getUserInfo:ok') {
|
|
|
- this.utils.getProvider()
|
|
|
- .then(provider => {
|
|
|
- if (!provider) {
|
|
|
- this.userdisabled=false
|
|
|
- reject()
|
|
|
- }
|
|
|
// uni登录
|
|
|
+ let provider = 'weixin'
|
|
|
uni.login({
|
|
|
provider: provider,
|
|
|
success: async loginRes => {
|
|
|
console.log(loginRes)
|
|
|
- console.log(e)
|
|
|
let code = loginRes.code // 获取开发code
|
|
|
- this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
|
|
|
+ this.userinfos=uni.getStorageSync('userinfos')?uni.getStorageSync('userinfos'):this.userinfos
|
|
|
loginByMiniApp({
|
|
|
- encryptedData: e.mp.detail.encryptedData,
|
|
|
- iv: e.mp.detail.iv,
|
|
|
- code: code,
|
|
|
+ code: loginRes.code,
|
|
|
+ encryptedData:loginRes.encryptedData,
|
|
|
+ iv:loginRes.iv,
|
|
|
companyId : this.companyId || '',
|
|
|
companyUserId:this.companyUserId || 0,
|
|
|
nickname:this.userinfos.nickname ||'',
|
|
|
@@ -765,13 +800,16 @@
|
|
|
icon:'none',
|
|
|
title: "登录成功",
|
|
|
});
|
|
|
+ this.$store.commit('setCoureLogin', 1);
|
|
|
+ this.userinfos=uni.getStorageSync('userinfos')
|
|
|
uni.setStorageSync('TOKEN_WEXIN', res.token);
|
|
|
- uni.setStorageSync('userInfo', JSON.stringify(res.user));
|
|
|
- this.userInfo=res.user;
|
|
|
- uni.hideLoading()
|
|
|
- // this.checkUserInfoA()
|
|
|
- // this.isLogin = true
|
|
|
-
|
|
|
+ uni.setStorageSync('userInfo',res.user);
|
|
|
+ this.userInfo=res.user
|
|
|
+ this.isLogin = true
|
|
|
+ // this.getH5CourseVideoDetails()
|
|
|
+ setTimeout(()=>{
|
|
|
+ this.getIsAddKf()
|
|
|
+ },200)
|
|
|
}else if(res.code==406){
|
|
|
uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
@@ -780,10 +818,19 @@
|
|
|
});
|
|
|
}else{
|
|
|
uni.hideLoading();
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title: res.msg,
|
|
|
- });
|
|
|
+ if (res.msg.length >14) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: res.msg,
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '我知道了'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
})
|
|
|
@@ -791,27 +838,7 @@
|
|
|
this.userdisabled=false
|
|
|
})
|
|
|
},
|
|
|
- fail() {
|
|
|
- this.userdisabled=false
|
|
|
- }
|
|
|
})
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- this.userdisabled=false
|
|
|
- uni.showToast({
|
|
|
- icon:'none',
|
|
|
- title: err,
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
- } else {
|
|
|
- this.userdisabled=false
|
|
|
- uni.showToast({
|
|
|
- title: '已拒绝授权',
|
|
|
- icon: 'none',
|
|
|
- duration: 2000,
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
phoneLogin(e) {
|
|
|
console.log(e)
|
|
|
@@ -834,7 +861,7 @@
|
|
|
console.log(loginRes)
|
|
|
console.log(e)
|
|
|
let code = loginRes.code // 获取开发code
|
|
|
- this.userinfos=uni.getStorageSync('userInfos')?uni.getStorageSync('userInfos'):this.userinfos
|
|
|
+ this.userinfos=uni.getStorageSync('userinfos')?uni.getStorageSync('userinfos'):this.userinfos
|
|
|
loginByMiniApp({
|
|
|
encryptedData: e.mp.detail.encryptedData,
|
|
|
iv: e.mp.detail.iv,
|
|
|
@@ -1079,6 +1106,7 @@
|
|
|
}
|
|
|
getH5CourseVideoDetails(data).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
+ this.isRedPackage=res.data.isRedPackage
|
|
|
this.config = res.data.courseConfig || {}
|
|
|
this.isFinish = res.data.isFinish || 0
|
|
|
this.duration = res.data.courseVideoDetails &&
|
|
|
@@ -1145,12 +1173,17 @@
|
|
|
}
|
|
|
console.log('题目',res.data.courseVideoDetails.questionBankList)
|
|
|
this.quesList = res.data.courseVideoDetails.questionBankList
|
|
|
- && res.data.courseVideoDetails.questionBankList.length > 0 ? res.data.courseVideoDetails.questionBankList : [],
|
|
|
- this.quesList = this.quesList.map(item => ({
|
|
|
- ...item,
|
|
|
- questionOption: JSON.parse(item.question),
|
|
|
- answer: ''
|
|
|
- }))
|
|
|
+ && res.data.courseVideoDetails.questionBankList.length > 0 ? res.data.courseVideoDetails.questionBankList : [];
|
|
|
+ this.quesList = this.quesList.map(item => ({
|
|
|
+ ...item,
|
|
|
+ questionOption: JSON.parse(item.question),
|
|
|
+ answer: ''
|
|
|
+ }))
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
}
|
|
|
this.getHeight()
|
|
|
this.getDescHeight()
|
|
|
@@ -1231,7 +1264,11 @@
|
|
|
}
|
|
|
}
|
|
|
} else{
|
|
|
- this.goLogin()
|
|
|
+ if(this.miniAppAuthType==2){
|
|
|
+ this.goLogin()
|
|
|
+ }else{
|
|
|
+ this.goLogins()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
rej => {}
|
|
|
@@ -1302,14 +1339,21 @@
|
|
|
// this.$refs.answerPopup.open("center")
|
|
|
// this.answerPopup=true
|
|
|
if(res.msg=='答题成功'){
|
|
|
- uni.login({
|
|
|
- provider: 'weixin',
|
|
|
- success: async loginRes => {
|
|
|
- console.log(loginRes)
|
|
|
- var code=loginRes
|
|
|
- this.closeAnswerPopup(loginRes.code)
|
|
|
- }
|
|
|
- })
|
|
|
+ if(this.isRedPackage==0){
|
|
|
+ uni.showToast({
|
|
|
+ title: "恭喜你,回答正确",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.login({
|
|
|
+ provider: 'weixin',
|
|
|
+ success: async loginRes => {
|
|
|
+ console.log(loginRes)
|
|
|
+ var code=loginRes
|
|
|
+ this.closeAnswerPopup(loginRes.code)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1454,7 +1498,8 @@
|
|
|
companyId:this.companyId,
|
|
|
courseId:this.courseId,
|
|
|
periodId:this.periodId,
|
|
|
- projectId:this.projectId
|
|
|
+ projectId:this.projectId,
|
|
|
+ appId:wx.getAccountInfoSync().miniProgram.appId
|
|
|
}
|
|
|
// {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
|
|
|
getIsAddKf(data).then(res => {
|
|
|
@@ -1465,6 +1510,12 @@
|
|
|
if(this.userInfo.userId){
|
|
|
this.getH5CourseVideoDetails()
|
|
|
console.log(123223)
|
|
|
+ }else{
|
|
|
+ if(this.miniAppAuthType==2){
|
|
|
+ this.goLogin()
|
|
|
+ }else{
|
|
|
+ this.goLogins()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -1477,25 +1528,28 @@
|
|
|
}else if(res.code==1002){
|
|
|
this.isAddKf = 0
|
|
|
this.qrcode=res.ext
|
|
|
- this.kfPopup=true
|
|
|
+ // this.kfPopup=true
|
|
|
uni.showToast({
|
|
|
title: "请添加管理员微信,成为会员!",
|
|
|
icon: 'none'
|
|
|
});
|
|
|
+ this.initExpiration(res.msg,res.code)
|
|
|
}else if(res.code==505){
|
|
|
this.isAddKf = 0
|
|
|
this.qrcode=res.ext
|
|
|
- this.kfPopup=true
|
|
|
+ // this.kfPopup=true
|
|
|
uni.showToast({
|
|
|
title: "管理员开启了会员审核,请等待审核!",
|
|
|
icon: 'none'
|
|
|
});
|
|
|
+ this.initExpiration(res.msg,res.code)
|
|
|
}else if(res.code==406){
|
|
|
uni.hideLoading();
|
|
|
uni.showToast({
|
|
|
icon:'none',
|
|
|
title: '该用户已成为其他销售会员',
|
|
|
});
|
|
|
+ this.initExpiration(res.msg,res.code)
|
|
|
}else if(res.code==504){
|
|
|
this.isAddKf = 0
|
|
|
this.iskftype=1
|
|
|
@@ -1504,17 +1558,25 @@
|
|
|
title: res.msg,
|
|
|
icon: 'none'
|
|
|
});
|
|
|
+ this.initExpiration(res.msg,res.code)
|
|
|
}else {
|
|
|
this.isAddKf = 0
|
|
|
uni.showToast({
|
|
|
title: res.msg,
|
|
|
icon: 'none'
|
|
|
});
|
|
|
+ this.initExpiration(res.msg,res.code)
|
|
|
}
|
|
|
},
|
|
|
err => {}
|
|
|
);
|
|
|
},
|
|
|
+ initExpiration(resMsg,resCode) {
|
|
|
+ if(resCode==401) return;
|
|
|
+ this.resMsg = resMsg
|
|
|
+ this.resCode = resCode
|
|
|
+ this.showExpiration = true
|
|
|
+ },
|
|
|
closeKFPop() {
|
|
|
// this.$refs.kfPopup.close()
|
|
|
// this.kfPopup=!this.kfPopup
|
|
|
@@ -1661,6 +1723,10 @@
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="scss" scoped>
|
|
|
+ html, body {
|
|
|
+ -webkit-user-select: none;
|
|
|
+ user-select: none;
|
|
|
+ }
|
|
|
.subname{
|
|
|
background-color: #00aa00;
|
|
|
color: #fff;
|