Commit 32f8eb70 by 胡悦

学习中心开发以及强制弹窗跳转

1 parent 4e5d2bd1
import { method } from 'lodash'
import http from '../request/http' import http from '../request/http'
import environment from '@/env' import environment from '@/env'
...@@ -278,7 +279,8 @@ module.exports = { ...@@ -278,7 +279,8 @@ module.exports = {
getUnreadCount(data) { getUnreadCount(data) {
return http.post( return http.post(
{ {
method: 'dj.pad.api.beisen.getUnreadCount', // method: 'dj.pad.api.beisen.getUnreadCount',
method: 'dj.pad.api.staff.getUnreadCount', // 修改为sop+北森的未读数
projectName: 'pad', projectName: 'pad',
...data ...data
}, },
...@@ -336,4 +338,36 @@ module.exports = { ...@@ -336,4 +338,36 @@ module.exports = {
...data ...data
}) })
}, },
// 学习中心、分页列表
getStudyCenterList(data) {
return http.post({
method: 'dj.pad.api.staff.study.page',
projectName: 'pad',
...data
})
},
// 查询当前员工的消息弹窗
getMessagePop(data) {
return http.post({
method: 'dj.pad.api.staff.message.notify',
projectName: 'pad',
...data
})
},
// 学习中心-员工课程阅读
getStudyCenterRead(data) {
return http.post({
method: 'dj.pad.api.staff.study.course.read',
projectName: 'pad',
...data
})
},
// 学习中心-员工课程统计
getStudyCenterStatistics(data) {
return http.post({
method: 'dj.pad.api.staff.study.summary',
projectName: 'pad',
...data
})
}
} }
No preview for this file type
...@@ -88,7 +88,8 @@ export default { ...@@ -88,7 +88,8 @@ export default {
collectTrack:false, collectTrack:false,
hasPerson: false, hasPerson: false,
messageType: 'study', messageType: 'study',
sopCount: 0 sopCount: 0,
tokenUrl: ''
} }
}, },
watch: { watch: {
...@@ -113,6 +114,10 @@ export default { ...@@ -113,6 +114,10 @@ export default {
this.getMessageInfo(); this.getMessageInfo();
this.getSopCount() this.getSopCount()
}); });
uni.$on('studyCenter', () => {
console.log('studyCenter')
this.changeIndex(3,this.tabs[3])
});
this.getMessageInfo() this.getMessageInfo()
this.getUnreadCount() this.getUnreadCount()
this.getSopCount() // 获取Ai集市未读个数 this.getSopCount() // 获取Ai集市未读个数
...@@ -158,6 +163,8 @@ export default { ...@@ -158,6 +163,8 @@ export default {
return new Promise(resolve => { return new Promise(resolve => {
const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2' const url = 'https%3A%2F%2Fcloud.italent.cn%2FPageHome%2FIndex%3Fproduct%3DLearning%26keyName%3DNusion%26pageCode%3DLearningNewHomepage%26appCode%3DLearning%26_qsrcapp%3DLearning%26_qrt%3Dhtml%26quark_s%3D5102bff371c00da5b19968ee53a8c3f1499ecd2447a19f72f3e3ba2390cc9617%23%2FviewDynamic%3Fshadow_context%3D%257BappModel%253A%2522italent%2522%252Cuppid%253A%25221%2522%257D%26quark_s%3D028930f1066f8ef8d28790940d53ae64337f44bde3a44cf89a290e4a3611e3e2'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => { uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
console.log(res, 'res')
this.tokenUrl = res.data
const studyUrl = res.data ? `${res.data}&return_url=${url}` : '' const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl) resolve(studyUrl)
}) })
...@@ -187,7 +194,7 @@ export default { ...@@ -187,7 +194,7 @@ export default {
clearInterval(this.trackInterval) clearInterval(this.trackInterval)
} }
this.$emit('update:tabIndex', index) this.$emit('update:tabIndex', index)
this.$emit("changeTab", index,jumpUrl) this.$emit("changeTab", index,jumpUrl, this.tokenUrl)
this.getMessageInfo() this.getMessageInfo()
this.getSopCount() this.getSopCount()
}, },
...@@ -235,16 +242,31 @@ export default { ...@@ -235,16 +242,31 @@ export default {
console.log(res) console.log(res)
this.messageTotal = res this.messageTotal = res
}, },
// 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop() {
const res = await uni.$api.commonApi.getMessagePop({})
if (res.ids && res.ids.length > 0) {
if ([1, 2, 3].includes(res.contentType)) {
this.messageType = 'system'
} else if (res.contentType === 5) {
this.messageType = 'study'
}
this.messageData = res
} else {
await this.getMessage()
}
},
openPop() { openPop() {
// this.messageType = 'attendance' // this.messageType = 'system'
// this.$refs.kfRef.open() // this.$refs.kfRef.open()
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/messageList` url: `/pages/common/messageList`
}) })
}, },
getMessageInfo() { getMessageInfo() {
this.getMessage() // this.getMessage()
this.getMessageCount() this.getMessageCount()
this.getMessagePop()
}, },
jumpPersonCenter() { jumpPersonCenter() {
if(this.hasPerson) { if(this.hasPerson) {
......
<template> <template>
<uni-popup ref="popup" type="bottom" border-radius="16px" :mask-click="false"> <uni-popup ref="popup" type="bottom" border-radius="16px" :mask-click="false">
<view class="kf-box"> <view class="kf-box" :class="{'system-height': type=='system'}">
<template v-if="type=='attendance'"> <template v-if="type=='attendance'">
<image class="message-bg" :src="require('@//assets/images/common/message-bg.webp')"></image> <image class="message-bg" :src="require('@//assets/images/common/message-bg.webp')"></image>
<view class="text text-first">本周优秀话术推送</view> <view class="text text-first">本周优秀话术推送</view>
...@@ -16,6 +16,13 @@ ...@@ -16,6 +16,13 @@
<view class="text study-text">坚持学习助您能力提升!</view> <view class="text study-text">坚持学习助您能力提升!</view>
<view class="btn study-btn" @click="jumpStudyCenter">去查看</view> <view class="btn study-btn" @click="jumpStudyCenter">去查看</view>
</template> </template>
<template v-else-if="type=='system'">
<image class="message-bg" :src="require('@//assets/images/common/system-bg.webp')"></image>
<view class="text text-first study-title">系统消息</view>
<view class="text study-text">您有新的消息【{{messageData.title}}】,请点击查看</view>
<view class="text study-text"></view>
<view class="btn study-btn" @click="jumpSystem">去查看</view>
</template>
</view> </view>
</uni-popup> </uni-popup>
...@@ -50,8 +57,39 @@ export default { ...@@ -50,8 +57,39 @@ export default {
this.close() this.close()
}, },
jumpStudyCenter() { jumpStudyCenter() {
uni.$emit('studyCenter')
this.close()
},
jumpSystem() {
// this.getDetailById(this.messageData.ids[0])
this.getDetailById(51)
this.close() this.close()
},
async getDetailById(id) {
const res = await uni.$api.commonApi.getTaskById({ id })
const _row = encodeURIComponent(JSON.stringify(res))
if (res.contentType == 1) {
uni.navigateTo({
url: `/pages/common/systemDetail?row=${_row}`
})
} else if (res.contentType == 2) {
console.log(JSON.parse(res.content))
const _content = res.content ? JSON.parse(res.content) : []
const url = _content[0]
const { content, title, id } = res
uni.navigateTo({
// url: `/pages/common/msgwebview?url=${url}&title=${title}&id=${id}`
url: `/pages/common/imgPreview?tabName=${title}&sourceType=2&detailUrl=${url}&row=${_row}`
})
} else if (res.contentType == 3) {
const _content = res.content ? JSON.parse(res.content) : []
const url = _content[0].image
const { content, title, id } = res
uni.navigateTo({
url: `/pages/common/msgwebview?fileUrl=${url}&title=${title}&id=${id}&row=${_row}`
})
} }
},
} }
} }
</script> </script>
...@@ -65,6 +103,9 @@ export default { ...@@ -65,6 +103,9 @@ export default {
border-radius: toRpx(48); border-radius: toRpx(48);
// padding: 0 toRpx(48); // padding: 0 toRpx(48);
box-sizing: border-box; box-sizing: border-box;
&.system-height {
height: toRpx(664);
}
.message-bg { .message-bg {
width: toRpx(848); width: toRpx(848);
...@@ -95,7 +136,6 @@ export default { ...@@ -95,7 +136,6 @@ export default {
height: toRpx(80); height: toRpx(80);
border-radius: toRpx(48); border-radius: toRpx(48);
opacity: 1; opacity: 1;
border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%); background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff; color: #ffffff;
font-size: toRpx(28); font-size: toRpx(28);
......
...@@ -107,7 +107,8 @@ export default { ...@@ -107,7 +107,8 @@ export default {
userInfo: {}, userInfo: {},
tabIndex: 0, tabIndex: 0,
showLeadPage: false, showLeadPage: false,
showBeisen: false showBeisen: false,
tokenUrl: ''
} }
}, },
mounted() { mounted() {
...@@ -135,12 +136,13 @@ export default { ...@@ -135,12 +136,13 @@ export default {
} }
}, },
methods: { methods: {
async changeTab($event, jumpUrl) { async changeTab($event, jumpUrl, tokenUrl) {
console.log($event, 'event') console.log($event, 'event', tokenUrl)
this.$emit('changeTab', $event) this.$emit('changeTab', $event)
if ($event == 3) { if ($event == 3) {
this.showBeisen = false this.showBeisen = false
this.jumpUrl = jumpUrl this.jumpUrl = jumpUrl
this.tokenUrl = tokenUrl
if (!this.jumpUrl) { if (!this.jumpUrl) {
uni.showToast({ uni.showToast({
title: '培训账号未创建', title: '培训账号未创建',
...@@ -198,21 +200,67 @@ export default { ...@@ -198,21 +200,67 @@ export default {
} }
} }
}, },
handleOperation(val) { handleOperation(val, data) {
if (val.type == 'openCourse') { const { type } = val;
console.log('beisen')
this.showBeisen = true // 提取公共的webview设置逻辑
const setWebviewStyle = () => {
setTimeout(() => { setTimeout(() => {
const currentWebview = this.$parent.$scope.$getAppWebview() const currentWebview = this.$parent.$scope.$getAppWebview();
const wv = currentWebview.children()[1] const wv = currentWebview.children()[1];
console.log(wv, 1111)
if (wv) { if (wv) {
wv.setStyle({ left: '8%', height: '100%', top: '3%', height: '97%', width: '92%' }) wv.setStyle({
left: '8%',
top: '3%',
height: '97%',
width: '92%'
});
} else { } else {
this.jumpUrl = '' this.jumpUrl = '';
} }
}, 100) }, 100);
};
// 处理课程详情
const handleCourseDetail = () => {
const COURSE_ID = '80cb90d7-1609-4360-8f23-6c47ddba41c0';
const baseUrl = 'https://cloud.italent.cn/PageHome/Index';
const params = {
product: 'Learning',
keyName: 'Nusion',
pageCode: 'LearningCourseTraineeDetailPage',
appCode: 'Learning',
id: COURSE_ID
};
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.join('&');
const url = encodeURIComponent(`${baseUrl}?${queryString}#/viewDynamic?1=1`);
this.jumpUrl = `${this.tokenUrl}&return_url=${url}`;
};
// 根据操作类型执行相应逻辑
switch(type) {
case 'openCourse':
this.showBeisen = true;
setWebviewStyle();
this.getStudyCenterRead(data.id)
break;
case 'courseDetail':
handleCourseDetail();
this.showBeisen = true;
setWebviewStyle();
break;
} }
},
// 学习中心修改阅读状态,打开后才修改
async getStudyCenterRead(id) {
const res = await uni.$api.commonApi.getStudyCenterRead({ id })
console.log(res)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!