Commit 8893754e by 胡悦

提交消息中心代码

1 parent d62d440d
...@@ -164,5 +164,86 @@ module.exports = { ...@@ -164,5 +164,86 @@ module.exports = {
projectName: 'boutique', projectName: 'boutique',
...data ...data
}) })
},
/** 系统消息埋点接口 */
addSystemInfo(data) {
return http.post({
method: 'dj.api.smartcarlife.contentManagerTask.view.add',
projectName: 'mindworkplate',
...data
})
},
leaveSystemInfo(data) {
return http.post({
method: 'dj.api.smartcarlife.contentManagerTask.view.leave',
projectName: 'mindworkplate',
...data
})
},
/** 消息盒子 */
// 获取客户标签分类信息
getClassConfig(data = {}) {
return http.post({
method: 'dj.pad.api.list.script.config.class',
projectName: 'pad',
...data
})
},
// 查阅未阅读的优秀话术
getUnreadRecord(data) {
return http.post({
method: 'dj.pad.api.list.unread.script.message.box.record',
projectName: 'pad',
...data
})
},
// 分页查询的优秀话术接口
getPageRecord(data) {
return http.post({
method: 'dj.pad.api.page.script.message.box.record',
projectName: 'pad',
...data
})
},
// 更新话术状态
updateMessageStatus(data) {
return http.post({
method: 'dj.pad.api.update.script.message.status',
projectName: 'pad',
...data
})
},
// 埋点
extractExcellent(data) {
return http.post({
method: 'dj.pad.api.burying.point.script.extract.excellent.browse',
projectName: 'pad',
...data
})
},
/** 系统消息接口 */
// 分页查询系统消息
getTaskInfo(data) {
return http.post({
method: 'dj.pad.api.contentManagerTask.page',
projectName: 'pad',
...data
})
},
// 查询系统详细信息
getTaskById(data) {
return http.post({
method: 'dj.pad.api.contentManagerTask.getById',
projectName: 'pad',
...data
})
},
// 根据状态查询消息数量
getMessageCount(data) {
return http.post({
method: 'dj.pad.api.message.box.count.by.status',
projectName: 'pad',
...data
})
} }
} }
No preview for this file type
...@@ -16,15 +16,17 @@ ...@@ -16,15 +16,17 @@
</template> </template>
</view> </view>
<view class="left-footer"> <view class="left-footer">
<view class="btn" @click="$refs.kfRef.open()"> <view class="btn" @click="openPop">
<view class="sprite-icon icon-feedback"></view> <view class="sprite-icon icon-feedback"></view>
<view class="message-number" v-if="messageTotal > 0"></view>
</view> </view>
<view class="btn" @click="$refs.settingRef.open()"> <view class="btn" @click="$refs.settingRef.open()">
<view class="sprite-icon icon-setting"></view> <view class="sprite-icon icon-setting"></view>
</view> </view>
</view> </view>
<!-- 客服弹框 --> <!-- 客服弹框 -->
<kf-box ref="kfRef" /> <!-- <kf-box ref="kfRef" /> -->
<message-pop ref="kfRef" :messageData="messageData"></message-pop>
<!-- 设置弹框 --> <!-- 设置弹框 -->
<setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" /> <setting-box ref="settingRef" @stopAudio="$emit('stopAudio')" />
</view> </view>
...@@ -32,10 +34,11 @@ ...@@ -32,10 +34,11 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import KfBox from "./KfBox"; import KfBox from "./KfBox";
import MessagePop from "./MessagePop"
import SettingBox from "./SettingBox"; import SettingBox from "./SettingBox";
import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData' import { STORAGE_OBJECTkEY } from '@/utils/cache/constantData'
export default { export default {
components: { KfBox, SettingBox }, components: { KfBox, SettingBox, MessagePop },
props: { props: {
tabIndex: Number, tabIndex: Number,
userInfo: Object userInfo: Object
...@@ -55,6 +58,12 @@ export default { ...@@ -55,6 +58,12 @@ export default {
name: 'RecordList' name: 'RecordList'
}, },
], ],
messageData: {
classCountList: [],
recordDetailList: [],
total: 0
},
messageTotal: 0
} }
}, },
watch: { watch: {
...@@ -67,13 +76,16 @@ export default { ...@@ -67,13 +76,16 @@ export default {
return this.$store.state.audio.perRecordNumber return this.$store.state.audio.perRecordNumber
} }
}, },
inject: ['showPage'],
mounted() { mounted() {
this.getMessageInfo()
}, },
methods: { methods: {
changeIndex(index) { changeIndex(index) {
if (this.tabIndex == index) return; if (this.tabIndex == index) return;
this.$emit('update:tabIndex', index) this.$emit('update:tabIndex', index)
this.$emit("changeTab", index) this.$emit("changeTab", index)
this.getMessageInfo()
}, },
async haveCustomerAccess(val) { async haveCustomerAccess(val) {
const {shopMerchantId, sceneType:scene} = val const {shopMerchantId, sceneType:scene} = val
...@@ -98,6 +110,34 @@ export default { ...@@ -98,6 +110,34 @@ export default {
}) })
} }
}) })
},
async getMessage() {
console.log('获取话术', uni.$storage.get("userInfo"))
const {sceneType, uuid} = uni.$storage.get("userInfo")
const res = await uni.$api.commonApi.getUnreadRecord({
businessType: sceneType,
uuid
})
if (res.total) {
this.messageData = res
this.$refs.kfRef.open()
}
},
async getMessageCount() {
const {sceneType} = uni.$storage.get("userInfo")
const res = await uni.$api.commonApi.getMessageCount({
status: 0, // 待查看,未读
})
console.log(res)
this.messageTotal = res
},
openPop() {
// this.$refs.kfRef.open()
this.showPage('MessageList')
},
getMessageInfo() {
this.getMessage()
this.getMessageCount()
} }
} }
} }
...@@ -242,11 +282,26 @@ export default { ...@@ -242,11 +282,26 @@ export default {
} }
.btn { .btn {
position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
margin: toRpx(48) auto 0; margin: toRpx(48) auto 0;
box-sizing: border-box; box-sizing: border-box;
padding-left: toRpx(60); padding-left: toRpx(60);
.message-number {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
width: toRpx(20);
height: toRpx(20);
background-color: #F24724;
right: 50%;
top: 0;
color: #fff;
border-radius: 50%;
font-size: toRpx(20);
}
} }
} }
</style> </style>
<template>
<view class="detail-box">
<view class="nav-bar">
<view v-if="type == 'view'" class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="title">消息</view>
</view>
<view class="weekly-tips">
<view class="tips-title" v-if="type == 'read'">本周优秀话术:
<view class="tips-tags">
<template v-for="(i, idx) in classCountList">
<view>{{ i.className }}</view>
<view v-if="i.count > 1">* {{ i.count }}</view>
<view class="tags-separator" v-if="classCountList.length - 1 != idx"> | </view>
</template>
</view>
</view>
<template v-if="type == 'read'">
<scroll-view scroll-y class="outstanding-tip-list">
<view :class="['outstanding-tip-item', onlyOneLength ? 'long' : 'short']"
v-for="(item, index) in recordDetailList" :key="item.id">
<view class="tip-header">
<view class="tip-rank">{{ onlyOneLength ? '' : `NO.${index + 1}` }} 优秀话术-{{ item.className }}</view>
<view class="tip-time">{{ item.pushTime }}</view>
<view class="tip-tags">{{ item.className }}</view>
</view>
<view class="tip-content">
{{ item.polishContent }}
</view>
</view>
</scroll-view>
<view class="detail-footer">
<view class="tips">以上内容请认真阅读,至少读完1分钟,如未按照要求阅读完内容,今日无法使用pad接待</view>
<view :class="['btn', !countFlag ? '' : 'blue']" @click="handleCompleted">已完成阅读 {{ !countFlag ?
`${countdown}s` :
'' }}</view>
</view>
</template>
<template v-else-if="type == 'view'">
<view :class="['outstanding-tip-item', messageInfo.status == 1 ? 'single' : 'read' ]">
<view class="tip-header">
<view class="tip-rank">优秀话术-{{ messageInfo.className }}</view>
<view class="tip-time">{{ messageInfo.pushTime }}</view>
<view class="tip-tags">{{ messageInfo.className }}</view>
</view>
<view class="tip-content">
{{ messageInfo.polishContent }}
</view>
</view>
<view class="detail-footer" v-if="messageInfo.status == 0">
<view class="tips">以上内容请认真阅读,至少读完1分钟,如未按照要求阅读完内容,今日无法使用pad接待</view>
<view :class="['btn', !countFlag ? '' : 'blue']" @click="handleCompleted">已完成阅读 {{ !countFlag ?
`${countdown}s` :
'' }}</view>
</view>
</template>
</view>
</view>
</template>
<script>
let timer = null
import dayjs from 'dayjs'
import { create } from 'lodash'
export default {
name: 'MessageDetail',
data() {
return {
recordDetailList: [],
classCountList: [],
countdown: 5,
countFlag: false,
messageInfo: {},
type: 'view',
tagIndex: '',
enterTime: '',
isProcessing: false
}
},
props: {
transfer: {
type: Object,
default: () => { }
}
},
computed: {
onlyOneLength() {
return this.recordDetailList.length == 1
},
},
created() {
// 获取mock配置的时间
const MOCKDATA = uni.$storage.get('mock_data')
if (MOCKDATA) this.countdown = MOCKDATA.timer
},
mounted() {
// 开始倒计时
this.startCountdown()
console.log(this.transfer)
// 进入事件的买点
this.enterTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
const { type, row, tagIndex, classCountList, recordDetailList } = this.transfer || {}
console.log(type)
if (type == 'view') {
this.messageInfo = row
this.type = type
this.tagIndex = tagIndex
} else if (type == 'read') {
this.type = type
this.classCountList = classCountList
this.recordDetailList = recordDetailList
console.log(this.classCountList)
}
},
beforeDestroy() {
if (timer) {
clearInterval(timer);
}
},
inject: ['showPage'],
methods: {
// 返回
back(name, obj = null) {
this.showPage(name, obj)
},
async backPage() {
const {type} = this
let idList
if(type == 'read') idList = this.recordDetailList.map(item => item.id);
else if (type == 'view') idList = [this.messageInfo.id];
// 埋点
const result = await uni.$api.commonApi.extractExcellent({
scriptIdList: idList,
startTime: this.enterTime,
endTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
})
if (type == 'read') this.$emit("backHome")
else if (type == 'view') this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
// this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
},
// 开始倒计时
startCountdown() {
timer = setInterval(() => {
if (this.countdown > 0) {
this.countdown--;
} else {
this.countFlag = true
clearInterval(timer);
}
}, 1000);
},
// 点击已完成按钮
async handleCompleted() {
if (this.isProcessing) return;
console.log(this.countFlag)
if (this.countFlag) {
try {
this.isProcessing = true;
let idList
if(this.type == 'read') idList = this.recordDetailList.map(item => item.id);
else if (this.type == 'view') idList = [this.messageInfo.id];
// 接口调用
const res = await uni.$api.commonApi.updateMessageStatus({
idList
})
if (res) {
this.backPage()
} else {
console.log('接口返回结果为空,可能存在问题')
}
} catch (error) {
console.error('更新消息状态时出现错误:', error)
} finally {
this.isProcessing = false; // 处理完成,将标志位设为 false
}
}
},
}
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
margin: 0 auto;
}
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
z-index: 999;
pointer-events: none;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
pointer-events: auto;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
}
.weekly-tips {
position: relative;
margin: toRpx(156) toRpx(64) toRpx(80);
background-color: rgba(255, 255, 255, 0.35);
border: toRpx(4) solid #fff;
border-radius: toRpx(48);
height: calc(100% - #{toRpx(236)});
padding-top: toRpx(40);
.tips-title {
display: flex;
font-size: toRpx(36);
font-weight: 500;
padding: 0 toRpx(64) toRpx(40);
.tips-tags {
display: flex;
color: #4673FF;
.tags-separator {
margin: 0 toRpx(10);
}
}
}
.outstanding-tip-list {
height: calc(100% - #{toRpx(348)});
}
.outstanding-tip-item {
width: calc(100% - #{toRpx(128)});
padding: toRpx(24) toRpx(32);
border-radius: toRpx(16);
background-color: #fff;
margin: 0 toRpx(64) toRpx(40);
&.long {
height: 100%;
}
&.single {
height: calc(100% - #{toRpx(40)});
}
&.read {
height: calc(100% - #{toRpx(216)});
}
.tip-header {
display: flex;
align-items: center;
.tip-rank {
color: #333;
font-size: toRpx(32);
font-weight: 500;
line-height: toRpx(44);
}
.tip-time {
color: rgba(102, 102, 102, 0.6);
font-size: toRpx(28);
line-height: toRpx(44);
margin-left: toRpx(24);
}
.tip-tags {
border-radius: toRpx(4);
background: rgba(255, 157, 10, 0.1);
padding: toRpx(8) toRpx(24);
color: #ff9d0a;
font-size: toRpx(24);
font-weight: 500;
margin-left: toRpx(24);
}
}
.tip-content {
margin-top: toRpx(17);
color: #666;
font-size: toRpx(28);
}
}
.detail-footer {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: absolute;
bottom: toRpx(32);
left: 50%;
transform: translateX(-50%);
width: 100%;
}
.tips {
color: #ff9d0a;
font-size: toRpx(32);
margin-bottom: toRpx(32);
}
.btn {
width: toRpx(720);
height: toRpx(80);
border-radius: toRpx(48);
opacity: 0.4;
border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #fff;
font-size: toRpx(32);
line-height: toRpx(80);
text-align: center;
opacity: 0.4;
&.blue {
opacity: 1;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
<template>
<view class="detail-box">
<view class="nav-bar">
<view class="back" @click="back">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="title">{{ systemInfo.title }}</view>
</view>
<view class="weekly-tips">
<scroll-view scroll-y class="outstanding-tip-list">
<view class="outstanding-tip-item">
<view class="tip-header">
<view class="tip-rank">{{ systemInfo.subtitle || '' }}</view>
<view class="tip-time">{{ systemInfo.time }}</view>
</view>
<view class="tip-content">
<rich-text :nodes="systemInfo.content"></rich-text>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
let timer = null
import dayjs from 'dayjs'
export default {
name: 'SystemDetial',
data() {
return {
classCountList: [],
countFlag: false,
systemInfo: {},
type: 'view',
content: '<p><img src=\"https://qcimg01.glsx.com.cn/group1/M00/0A/6B/wKgD3mfuUHiAIvUfAAKVSmxdFVE298.jpg\" style=\"max-width:100%;\" contenteditable=\"false\"/></p>'
}
},
props: {
transfer: {
type: Object,
default: () => { }
}
},
mounted() {
console.log(this.transfer)
const { row } = this.transfer || {}
this.systemInfo = row
this.systemInfo.time = dayjs(new Date(row.actualSendTime)).format("YYYY-MM-DD HH:mm:ss")
this.addTrack(row)
},
beforeDestroy() {
if (timer) {
clearInterval(timer);
}
},
inject: ['showPage'],
methods: {
// 返回
back() {
this.showPage('MessageList')
},
// 进入埋点事件
addTrack(row) {
try {
const {phone} = uni.$storage.get("userInfo")
const entryData = {
taskId: row.id,
phoneNumber: phone
}
uni.$api.commonApi.addSystemInfo(entryData).then(res => {
if (res) {
this.leaveTrack(res)
timer = setInterval(() => {
this.leaveTrack(res)
}, 3000)
}
})
} catch (error) {
console.error('进入埋点发生错误', error);
}
},
// 离开埋点事件
async leaveTrack(id) {
await uni.$api.commonApi.leaveSystemInfo({id})
}
}
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
margin: 0 auto;
}
.nav-bar {
position: fixed;
width: 100%;
height: toRpx(96);
left: 0;
top: toRpx(48);
z-index: 999;
pointer-events: none;
.back {
height: 100%;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
pointer-events: auto;
}
.title {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-weight: 700;
font-size: toRpx(32);
color: #1a1a1a;
}
}
.weekly-tips {
position: relative;
margin: toRpx(156) toRpx(64) toRpx(80);
background-color: rgba(255, 255, 255, 0.35);
border: toRpx(4) solid #fff;
border-radius: toRpx(16);
height: calc(100% - #{toRpx(236)});
.outstanding-tip-list {
height: 100%;
background-color: #fff;
border-radius: toRpx(16);
}
.outstanding-tip-item {
width: calc(100% - #{toRpx(128)});
padding: toRpx(24) toRpx(32);
border-radius: toRpx(16);
background-color: #fff;
height: 100%;
.tip-header {
display: flex;
align-items: center;
.tip-rank {
color: #333;
font-size: toRpx(32);
font-weight: 500;
line-height: toRpx(44);
margin-right: toRpx(24);
}
.tip-time {
color: rgba(102, 102, 102, 0.6);
font-size: toRpx(28);
line-height: toRpx(44);
}
.tip-tags {
border-radius: toRpx(4);
background: rgba(255, 157, 10, 0.1);
padding: toRpx(8) toRpx(24);
color: #ff9d0a;
font-size: toRpx(24);
font-weight: 500;
margin-left: toRpx(24);
}
}
.tip-content {
padding: toRpx(17) 0;
color: #666;
font-size: toRpx(28);
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
export const CONTRNT_TYPE = {
1: '图文',
2: '视频',
3: 'PDF'
}
<template>
<uni-popup ref="popup" type="bottom" border-radius="16px" :mask-click="false">
<view class="kf-box">
<image class="message-bg" :src="require('@//assets/images/common/message-bg.webp')"></image>
<view class="text text-first">本周优秀话术推送</view>
<view class="text">你有{{messageData.total}}条消息待查看</view>
<view class="btn" @click="toMessage">去查看</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'MessagePop',
props: {
messageData: Object
},
data() {
return {
}
},
inject: ['showPage'],
mounted() {
console.log(this.messageData)
},
methods: {
open() {
this.$refs.popup.open("center");
},
close() {
this.$refs.popup.close()
},
toMessage() {
console.log(this.messageData)
const {messageData} = this
this.showPage('MessageDetail', {...messageData, type: 'read'})
this.close()
}
}
}
</script>
<style scoped lang='scss'>
.kf-box {
position: relative;
width: toRpx(848);
height: toRpx(720);
background: #ffffff;
border-radius: toRpx(48);
// padding: 0 toRpx(48);
box-sizing: border-box;
.message-bg {
width: toRpx(848);
height: toRpx(346);
border-radius: toRpx(48);
}
.text {
text-align: center;
color: #333333;
font-size: toRpx(32);
line-height: toRpx(64);
&.text-first {
margin-top: toRpx(40);
}
}
.btn {
margin: toRpx(70) auto;
width: toRpx(784);
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);
font-weight: 500;
text-align: center;
line-height: toRpx(80);
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -563,7 +563,7 @@ export default { ...@@ -563,7 +563,7 @@ export default {
} }
} }
.record-list { .record-list {
height: calc(100% - #{toRpx(248)}); height: calc(100% - #{toRpx(286)});
position: relative; position: relative;
z-index: 4; z-index: 4;
} }
......
...@@ -77,9 +77,12 @@ import Calendar from './components/Income/Calendar.vue' ...@@ -77,9 +77,12 @@ import Calendar from './components/Income/Calendar.vue'
import Promotion from './components/Income/Promotion.vue' import Promotion from './components/Income/Promotion.vue'
import History from './components/Income/History.vue' import History from './components/Income/History.vue'
import merge from '@/mixin/record/merge.js' import merge from '@/mixin/record/merge.js'
import MessageDetail from './components/Message/MessageDetail.vue'
import MessageList from './components/Message/MessageList.vue'
import SystemDetial from './components/Message/SystemDetial.vue'
export default { export default {
mixins: [recorder, uploader, timeout, versionCheck, merge], mixins: [recorder, uploader, timeout, versionCheck, merge],
components: { RecordList, CustomerFile, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History, LevelMedal }, components: { RecordList, CustomerFile, LeftSide, Point, dayPoint, rulePoint, Course, Ranking, LevelPoint, Calendar, Promotion, History, LevelMedal, MessageDetail, MessageList, SystemDetial },
props: { props: {
id: [String, Number], id: [String, Number],
finishDoneText: String, finishDoneText: String,
......
...@@ -98,6 +98,9 @@ ...@@ -98,6 +98,9 @@
"path": "pages/common/webview" "path": "pages/common/webview"
}, },
{ {
"path": "pages/common/msgwebview"
},
{
"path": "pages/common/customerDetail", "path": "pages/common/customerDetail",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
......
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-28 18:19:19
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-09-06 14:42:32
* @FilePath: \gl-tape\pages\common\webview.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<web-view :src="url"></web-view>
</template>
<script type="text/ecmascript-6">
export default {
name: '',
data () {
return {
url: '',
viewerUrl: '/hybrid/html/web/viewer.html',
}
},
onLoad (options) {
console.log(options,'options')
if(options.fileUrl) this.url = `${this.viewerUrl}?file=${options.fileUrl}`
else this.url = options.url
if (options.title) uni.setNavigationBarTitle({
title: options.title
})
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss"></style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!