Commit 32f8eb70 by 胡悦

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

1 parent 4e5d2bd1
import { method } from 'lodash'
import http from '../request/http'
import environment from '@/env'
......@@ -278,7 +279,8 @@ module.exports = {
getUnreadCount(data) {
return http.post(
{
method: 'dj.pad.api.beisen.getUnreadCount',
// method: 'dj.pad.api.beisen.getUnreadCount',
method: 'dj.pad.api.staff.getUnreadCount', // 修改为sop+北森的未读数
projectName: 'pad',
...data
},
......@@ -336,4 +338,36 @@ module.exports = {
...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 {
collectTrack:false,
hasPerson: false,
messageType: 'study',
sopCount: 0
sopCount: 0,
tokenUrl: ''
}
},
watch: {
......@@ -113,6 +114,10 @@ export default {
this.getMessageInfo();
this.getSopCount()
});
uni.$on('studyCenter', () => {
console.log('studyCenter')
this.changeIndex(3,this.tabs[3])
});
this.getMessageInfo()
this.getUnreadCount()
this.getSopCount() // 获取Ai集市未读个数
......@@ -158,6 +163,8 @@ export default {
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'
uni.$api.commonApi.findBeiSenSSOToken({}).then(res => {
console.log(res, 'res')
this.tokenUrl = res.data
const studyUrl = res.data ? `${res.data}&return_url=${url}` : ''
resolve(studyUrl)
})
......@@ -187,7 +194,7 @@ export default {
clearInterval(this.trackInterval)
}
this.$emit('update:tabIndex', index)
this.$emit("changeTab", index,jumpUrl)
this.$emit("changeTab", index,jumpUrl, this.tokenUrl)
this.getMessageInfo()
this.getSopCount()
},
......@@ -235,16 +242,31 @@ export default {
console.log(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() {
// this.messageType = 'attendance'
// this.messageType = 'system'
// this.$refs.kfRef.open()
uni.navigateTo({
url: `/pages/common/messageList`
})
},
getMessageInfo() {
this.getMessage()
// this.getMessage()
this.getMessageCount()
this.getMessagePop()
},
jumpPersonCenter() {
if(this.hasPerson) {
......
<template>
<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'">
<image class="message-bg" :src="require('@//assets/images/common/message-bg.webp')"></image>
<view class="text text-first">本周优秀话术推送</view>
......@@ -16,6 +16,13 @@
<view class="text study-text">坚持学习助您能力提升!</view>
<view class="btn study-btn" @click="jumpStudyCenter">去查看</view>
</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>
</uni-popup>
......@@ -50,8 +57,39 @@ export default {
this.close()
},
jumpStudyCenter() {
uni.$emit('studyCenter')
this.close()
}
},
jumpSystem() {
// this.getDetailById(this.messageData.ids[0])
this.getDetailById(51)
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>
......@@ -65,6 +103,9 @@ export default {
border-radius: toRpx(48);
// padding: 0 toRpx(48);
box-sizing: border-box;
&.system-height {
height: toRpx(664);
}
.message-bg {
width: toRpx(848);
......@@ -95,7 +136,6 @@ export default {
height: toRpx(80);
border-radius: toRpx(48);
opacity: 1;
border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: toRpx(28);
......
......@@ -107,7 +107,8 @@ export default {
userInfo: {},
tabIndex: 0,
showLeadPage: false,
showBeisen: false
showBeisen: false,
tokenUrl: ''
}
},
mounted() {
......@@ -135,12 +136,13 @@ export default {
}
},
methods: {
async changeTab($event, jumpUrl) {
console.log($event, 'event')
async changeTab($event, jumpUrl, tokenUrl) {
console.log($event, 'event', tokenUrl)
this.$emit('changeTab', $event)
if ($event == 3) {
this.showBeisen = false
this.jumpUrl = jumpUrl
this.tokenUrl = tokenUrl
if (!this.jumpUrl) {
uni.showToast({
title: '培训账号未创建',
......@@ -198,21 +200,67 @@ export default {
}
}
},
handleOperation(val) {
if (val.type == 'openCourse') {
console.log('beisen')
this.showBeisen = true
handleOperation(val, data) {
const { type } = val;
// 提取公共的webview设置逻辑
const setWebviewStyle = () => {
setTimeout(() => {
const currentWebview = this.$parent.$scope.$getAppWebview()
const wv = currentWebview.children()[1]
console.log(wv, 1111)
const currentWebview = this.$parent.$scope.$getAppWebview();
const wv = currentWebview.children()[1];
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 {
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!