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);
......
......@@ -30,57 +30,56 @@
<uni-icons v-if="isSearch" type="closeempty" class="close" color="#999" @click="handleClear"
size="20"></uni-icons>
</view>
<view class="tips"><view class="sprite-icon icon-study-tips"></view>带有“限时学”标签的课程:规定时间内未完成任务,禁止提单!请按时学习。</view>
<view class="tag-box" v-if="firstIndex == 1">
<view :class="['tag-item', i.classCode == tagIndex ? 'active' : '']" v-for="i in tagList" :key="i.className"
@click="selectTag(i)">{{ i.className }}</view>
<view class="tips" v-if="firstIndex != 2">
<view class="sprite-icon icon-study-tips"></view>带有“限时学”标签的课程:规定时间内未完成任务,禁止提单!请按时学习。
</view>
<scroll-view scroll-y ref="scrollViewRef" class="message-list"
@scrolltolower="pageonReachBottom" :scroll-top="scrollTop">
<template v-if="getList.length">
<view class="message-item" v-for="item in getList" :key="item.id" @click="openDetail(item)">
<template v-if="firstIndex == 0">
<view class="message-header">
<view :class="['dot', item.readFlag ? '' : 'red']"></view>
<view class="message-type">系统通知</view>
<view class="message-time">{{ item.actualSendTimeStr }}</view>
<scroll-view scroll-y ref="scrollViewRef" :class="['message-list', getScrollHeight]" @scrolltolower="pageonReachBottom"
:scroll-top="scrollTop">
<template v-if="list.length">
<view class="message-list-box">
<view class="message-item" v-for="item in list" :key="item.id" @click="openDetail(item)">
<image class="course-bg" src="../../../assets/images/common/course-default-bg.webp" mode="aspectFill" />
<view class="course-info">
<view class="course-title">{{ item.taskTitle }}</view>
<view class="study-status">
<text class="label">学习进度:</text>
<view class="value-wrapper">
<view class="status-dot" :class="{
'orange-bg': [1, 2, 3].includes(item.status),
'green-bg': item.status === 5,
'red-bg': item.status === 4
}"></view>
<text class="value" :class="{
'orange': [1, 2, 3].includes(item.status),
'green': item.status === 5,
'red': item.status === 4
}">{{
item.status === 1 ? '未学习' :
item.status === 2 ? '未完成' :
item.status === 3 ? '待考核' :
item.status === 4 ? '未通过' :
item.status === 5 ? '已完成' : ''
}}</text>
</view>
</view>
<view class="info-item">
<text class="label">课程名称:</text>
<text class="value">{{ item.courseName }}</text>
</view>
<view class="info-item">
<text class="label">开始时间:</text>
<text class="value">{{ item.createdDate }}</text>
</view>
<view class="info-item">
<text class="label">完成时间:</text>
<text class="value">{{ item.finishDate }}</text>
</view>
<view class="info-item">
<text class="label">完成标准:</text>
<text class="value">{{ item.taskFinishCriteria === 0 ? '无' : '完成学习 (含考核)' }}</text>
</view>
</view>
<view class="message-content"> 您有新的消息【{{ item.title }}】{{ item.subtitle ? item.subtitle.length > 40 ?
`[${item.subtitle.slice(0, 39)}...]` : `[${item.subtitle}]` : '' }},请点击查看
</view>
</template>
<template v-else-if="firstIndex == 1">
<view class="message-header">
<view :class="['dot', item.status == 1 ? '' : 'red']"></view>
<view class="message-type">优秀话术-{{ item.sceneLabelName }}</view>
<view class="message-time">{{ item.time }}</view>
<view v-if="item.excellentLabelName" class="message-tag">{{ item.excellentLabelName }}</view>
</view>
<view class="message-content">{{ item.polishContent }}</view>
</template>
<template v-else-if="firstIndex == 2">
<view class="message-header">
<view :class="['dot', item.status == 1 ? '' : 'red']"></view>
<view class="message-type">话术违规预警</view>
<view class="message-time">{{ item.time }}</view>
<view class="message-tag">{{ item.warningTag }}</view>
</view>
<view class="message-content warning-content">
<view>你有以下接待记录判定为话术违规</view>{{ item.warningContent }}
</view>
</template>
<template v-else-if="firstIndex == 3">
<view class="message-header">
<view :class="['dot', item.status == 1 ? '' : 'red']"></view>
<view class="message-type">AI导师消息</view>
<view class="message-time">{{ item.pushTime }}</view>
</view>
<view class="message-content warning-content">
<view>您有新的消息【{{ item.sopTaskDetailInfoDTO ? item.sopTaskDetailInfoDTO.checkDate : ''
}}+战败复盘报告】AI导师来帮你进行战败复盘了,请点击查看</view>
</view>
</template>
</view>
</view>
</template>
<template v-else>
......@@ -107,14 +106,14 @@ export default {
return {
typeList: [
{ tabName: '全部', num: () => '' },
{ tabName: '未完成', num: () => '(4)' },
{ tabName: '未完成', num: () => '' },
{ tabName: '已完成', num: () => '' }
],
firstIndex: 0,
firstLeft: ['first', 'second', 'three'],
firstClass: ['first-nav', 'second-nav', 'second-nav'],
scrollTop: 0,
systemList: [
list: [
{
taskId: 1,
finishDate: '2025-06-11',
......@@ -123,47 +122,102 @@ export default {
taskTitle: '销售话术',
createdDate: '2025-06-11',
taskFinishCriteria: 0
},
{
taskId: 2,
finishDate: '2025-06-11',
courseName: '家庭车主延保营销',
status: 2,
taskTitle: '销售话术',
createdDate: '2025-06-11',
taskFinishCriteria: 0
},
{
taskId: 13,
finishDate: '2025-06-11',
courseName: '家庭车主延保营销',
status: 3,
taskTitle: '销售话术',
createdDate: '2025-06-11',
taskFinishCriteria: 0
},
{
taskId: 131,
finishDate: '2025-06-11',
courseName: '家庭车主延保营销',
status: 4,
taskTitle: '销售话术',
createdDate: '2025-06-11',
taskFinishCriteria: 0
},
{
taskId: 14,
finishDate: '2025-06-11',
courseName: '家庭车主延保营销',
status: 5,
taskTitle: '销售话术',
createdDate: '2025-06-11',
taskFinishCriteria: 0
}
],
messageList: [],
earlyWarnList: [],
name: '',
isSearch: false,
nothing: false,
total: 0,
pageNum: PAGE_NUM,
pageSize: PAGE_SIZE,
}
},
computed: {
getList() {
const listMap = {
0: this.systemList,
1: this.messageList,
2: this.earlyWarnList
};
if (this.firstIndex in listMap) {
return listMap[this.firstIndex];
getScrollHeight() {
// 调用 getList 函数获取列表
const list = this.list;
// 如果获取的列表为空,则返回空字符串
if (!list || list.length === 0) {
return '';
}
return []; // 若 firstIndex 不在 0、1、2 范围内,返回 []
},
// 根据 firstIndex 的值返回不同的类名
switch (this.firstIndex) {
case 2:
return 'class-scroll';
default:
return 'scroll-list';
}
}
// getList() {
// const listMap = {
// 0: this.systemList,
// 1: this.messageList,
// 2: this.earlyWarnList
// };
// if (this.firstIndex in listMap) {
// return listMap[this.firstIndex];
// }
// return []; // 若 firstIndex 不在 0、1、2 范围内,返回 []
// },
},
mounted() {
this.getStudyCenterList()
this.getUnreadCount()
},
methods: {
// tab切换
changeType(index, tagIndex) {
console.log(index)
this.firstIndex = index
this.name = ''
this.scrollTop = 1
this.total = 0
this.pageNum = PAGE_NUM
this.pageSize = PAGE_SIZE
if (tagIndex) this.tagIndex = tagIndex
else this.tagIndex = ''
if (index == 0) {
this.getSystemPage()
} else if (index == 1) {
this.getMessagePage()
this.getLabelList()
} else if (index == 2) {
this.getWarningPage()
}
setTimeout(() => {
this.scrollTop = 0
}, 100);
this.getStudyCenterList()
},
openAllCourse() {
console.log('跳转北森')
......@@ -176,11 +230,101 @@ export default {
this.name = e.detail.value
if (this.name == '')
this.isSearch = false
this.getStudyCenterList(this.name)
},
handleClear() {
this.name = ''
this.isSearch = false
this.getStudyCenterList()
},
openDetail(item) {
console.log(item)
this.$emit("handleOperation", { type: 'courseDetail', data: item })
},
// 查询未读数
async getUnreadCount() {
try {
const { undoCount } = await uni.$api.commonApi.getStudyCenterStatistics();
this.typeList[1].num = () => `(${undoCount})`;
} catch (error) {
console.error('获取未读数失败:', error);
this.typeList[1].num = () => '';
}
},
async getStudyCenterList(search) {
try {
uni.showLoading({
mask: true
})
const { pageNum, pageSize } = this
const params = {
pageNum,
pageSize
}
if (this.firstIndex === 1) {
params.readFlag = false
} else if (this.firstIndex === 2) {
params.readFlag = true
}
if (search) params.search = search
const res = await uni.$api.commonApi.getStudyCenterList(params)
if (pageNum == 1) {
this.list = res.list
} else {
this.list = this.list.concat(res.list)
}
uni.hideLoading()
this.total = res.total
this.nothing = res.length ? true : false
} catch (error) {
uni.showToast({
title: error,
icon: "none",
});
}
},
/**
* 页面触底时的处理函数
* 当页面触底时,判断是否还有更多数据,如果有则加载下一页数据
* 如果没有更多数据,则标记为没有更多数据状态
*/
pageonReachBottom() {
console.log('到底了');
// 解构赋值,设置 nothing 的默认值
let { pageNum, total, nothing = 'nothing', pageSize } = this;
if (Math.ceil(total / pageSize) > pageNum) {
this.pageNum += 1;
// 根据 firstIndex 的值调用不同的方法
switch (this.firstIndex) {
case 1:
try {
this.getStudyCenterList();
} catch (error) {
console.error('调用 getStudyCenterList 方法时出错:', error);
}
break;
case 0:
try {
this.getStudyCenterList();
} catch (error) {
console.error('调用 getStudyCenterList 方法时出错:', error);
}
break;
case 2:
try {
this.getStudyCenterList();
} catch (error) {
console.error('调用 getStudyCenterList 方法时出错:', error);
}
break;
default:
break;
}
} else {
this.nothing = true;
}
}
}
}
</script>
......@@ -321,7 +465,7 @@ export default {
.input-box {
position: relative;
margin: 0 toRpx(64);
margin: toRpx(2) toRpx(64) 0;
.input {
padding-left: toRpx(30);
......@@ -364,91 +508,109 @@ export default {
justify-content: center;
}
}
.tips {
display: flex;
align-items: center;
padding: toRpx(8) toRpx(22);
background-color: rgba(255, 243, 224, 0.8);
border-radius: toRpx(8);
margin: toRpx(24) toRpx(64);
margin: toRpx(24) toRpx(64) 0;
font-size: toRpx(24);
color: #FF9D0A;
.icon-study-tips {
margin-right: toRpx(8);
}
}
.message-list-box {
display: flex;
flex-wrap: wrap;
gap: toRpx(48);
padding: 0 toRpx(64) toRpx(24);
margin-top: toRpx(24);
}
.message-list {
position: relative;
background-color: #fff;
border-radius: 0 0 toRpx(48) toRpx(48);
height: calc(100% - #{toRpx(400)});
// height: calc(100% - #{toRpx(400)});
&.scroll-list {
height: calc(100% - #{toRpx(400)});
}
&.class-scroll {
height: calc(100% - #{toRpx(336)});
}
.message-item {
border-radius: toRpx(16);
// box-shadow: 0 toRpx(4) toRpx(20) 0 #0000001a;
box-shadow: 0 4px 12px 0 #2c66f71a;
margin: 0 toRpx(64) toRpx(40);
padding: toRpx(24) toRpx(32);
width: calc((100% - #{toRpx(144)}) / 4);
border-radius: toRpx(24);
box-shadow: 0 toRpx(8) toRpx(32) 0 #2c66f71a;
box-sizing: border-box;
&:first-child {
margin-top: toRpx(10);
.course-bg {
width: 100%;
height: toRpx(180);
border-radius: toRpx(16) toRpx(16) 0 0;
}
.message-header {
display: flex;
align-items: center;
.dot {
width: toRpx(12);
height: toRpx(12);
border-radius: 50%;
background-color: #999;
margin-right: toRpx(24);
&.red {
background-color: #F24724;
}
}
.message-type {
color: #333;
font-size: toRpx(32);
.course-info {
padding: toRpx(20) toRpx(32) toRpx(20);
.course-title {
font-size: toRpx(30);
color: #292D33;
font-weight: 500;
line-height: toRpx(44);
margin-right: toRpx(24);
}
.message-time {
color: rgba(102, 102, 102, 0.6);
font-size: toRpx(28);
}
.message-tag {
border-radius: toRpx(4);
background: rgba(255, 157, 10, 0.1);
padding: toRpx(8) toRpx(24);
color: #ff9d0a;
.label {
font-size: toRpx(24);
font-weight: 500;
margin-left: toRpx(24);
color: #999EA8;
}
}
.message-content {
color: #666666;
font-size: toRpx(28);
line-height: toRpx(48);
margin-top: toRpx(17);
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
&.warning-content {
white-space: pre-line;
-webkit-line-clamp: 4;
.study-status {
display: flex;
align-items: center;
margin-top: toRpx(20);
margin-bottom: toRpx(24);
padding: toRpx(16) toRpx(20);
background-color: #F5F9FF;
border-radius: toRpx(6);
font-size: toRpx(24)啊,;
.value-wrapper {
display: flex;
align-items: center;
.status-dot {
width: toRpx(12);
height: toRpx(12);
border-radius: 50%;
margin-right: toRpx(8);
&.orange-bg {
background-color: #F59619;
}
&.green-bg {
background-color: #2CCA74;
}
&.red-bg {
background-color: #EB4E4E;
}
}
}
.orange {
color: #F59619;
}
.green {
color: #2CCA74;
}
.red {
color: #EB4E4E;
}
}
.info-item {
font-size: toRpx(24);
margin-bottom: toRpx(12);
.value {
color: #666666;
}
}
}
}
......@@ -475,6 +637,7 @@ export default {
padding: toRpx(30) 0;
font-size: toRpx(24);
}
/deep/ {
.uni-scroll-view-content {
height: calc(100% - #{toRpx(10)});
......
......@@ -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!