Commit c018a133 by 胡悦

提交服务中心置顶和详情

1 parent 41e911f6

2.61 MB | W: | H:

2.61 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<view>
<ServiceList @handleClick="handleClick" />
<ServiceList :topListProp="topList" @handleClick="handleClick" />
</view>
</template>
<script>
......@@ -12,9 +12,14 @@ export default {
},
data() {
return {
topList: []
}
},
created() {
uni.$on('messageBackHome', (topList) => {
this.topList = topList
})
},
methods: {
handleClick(item) {
const { moduleType } = item
......
......@@ -17,11 +17,16 @@
{{ messageInfo.polishContent }}
</view>
</view>
<view class="detail-footer" v-if="messageInfo.status == 0">
<view class="tips">以上内容请认真阅读,至少读完{{ countTime }}分钟,如未按照要求阅读完内容,今日无法使用pad接待</view>
<view :class="['btn', !countFlag ? '' : 'blue']" @click="handleCompleted">已完成阅读 {{ !countFlag ?
`${countdown}s` :
'' }}</view>
<view class="detail-footer">
<template v-if="messageInfo.status == 0">
<view class="tips">以上内容请认真阅读,至少读完{{ countTime }}分钟,如未按照要求阅读完内容,今日无法使用pad接待</view>
<view :class="['btn', !countFlag ? '' : 'blue']" @click="handleCompleted">已完成阅读 {{ !countFlag ?
`${countdown}s` :
'' }}</view>
</template>
<template v-if="pageType == 'service'">
<view class="btn blue more-script" @click="handleMoreScript">更多话术</view>
</template>
</view>
</view>
</view>
......@@ -43,7 +48,8 @@ export default {
enterTime: '',
isProcessing: false,
MOCKDATA: {},
countTime: 0
countTime: 0,
pageType: ''
}
},
computed: {
......@@ -65,6 +71,7 @@ export default {
// 进入埋点的时间
this.enterTime = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
this.messageInfo = JSON.parse(row)
this.pageType = options.type
},
beforeDestroy() {
if (timer) {
......@@ -141,7 +148,11 @@ export default {
}
}
},
handleMoreScript() {
uni.redirectTo({
url: '/pages/common/messageList'
});
}
}
}
</script>
......@@ -306,5 +317,8 @@ export default {
opacity: 1;
}
}
.more-script {
margin-bottom: toRpx(48);
}
}
</style>
\ No newline at end of file
<template>
<view class="message-index-box">
<view class="message-list">
<view class="message-list" v-if="getTopList.length > 0">
<view :class="['message-item', moduleType == i.moduleType ? 'active' : '']" v-for="(i, ind) in getTopList" :key="ind" @click.stop="handleClick(i)">
<view class="message-item-icon">
<view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view>
......@@ -55,6 +55,10 @@ export default {
moduleType: {
type: [Number, String, null],
default: null
},
topListProp: {
type: Array,
default: () => []
}
},
data() {
......@@ -62,7 +66,7 @@ export default {
moduleTypeEnum,
moduleIconEnum,
moduleContentEnum,
topList: [1],
topList: [],
msgList: [
{
moduleType: 3,
......@@ -102,10 +106,21 @@ export default {
]
}
},
watch: {
topListProp: {
handler(newVal) {
this.topList = newVal
},
immediate: true
}
},
computed: {
getTopList() {
if (!this.topList) return [];
return this.msgList.filter(item => this.topList.includes(item.moduleType));
// 按topList中的倒序排列
return this.topList.slice().reverse().map(type =>
this.msgList.find(item => item.moduleType === type)
).filter(Boolean);
},
getList() {
// 过滤掉topList中包含moduleType的对象
......@@ -132,7 +147,16 @@ export default {
}));
}
},
created() {
this.getTopInfo()
},
methods: {
getTopInfo() {
const {phone, shopMerchantId, sceneType} = uni.$storage.get('userInfo')
const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || []
},
formatTime(time) {
return dayjs(time).format('HH:mm');
},
......
......@@ -8,18 +8,18 @@
</view>
<view class="detail-content">
<view class="detail-left">
<ServiceList :moduleType="moduleType" @handleClick="handleClick" />
<ServiceList :moduleType="moduleType" :topListProp="topList" @handleClick="handleClick" />
</view>
<view class="detail-right">
<view class="common-title">
<view>{{ moduleTypeEnum[moduleType] }}</view>
<view class="stick-top">
<view class="stick-top" @click="handleStickTop">
<view class="sprite-icon icon-stick-top-blue"></view>
{{ topList.includes(Number(moduleType)) ? '取消置顶' : '置顶' }}
</view>
</view>
<scroll-view scroll-y class="service-list" @scrolltolower="pageonReachBottom" :scroll-top="scrollTop">
<view class="service-item" v-for="(item, index) in list" :key="index">
<view class="service-item" v-for="(item, index) in list" :key="index" @click="handleDetail(item)">
<view class="service-item-title">{{ moduleTypeEnum[moduleType] }}
<view class="service-item-title-right">
<view>查看详情</view>
......@@ -43,7 +43,7 @@
</view>
</template>
<script>
const PAGE_SIZE = 5
const PAGE_SIZE = 10
const PAGE_NUM = 1
import dayjs from 'dayjs'
import { moduleTypeEnum, moduleContentEnum } from './components/contant'
......@@ -58,7 +58,7 @@ export default {
moduleTypeEnum,
moduleContentEnum,
moduleType: null,
topList: [1],
topList: [],
scriptList: [],
earlyWarnList: [],
systemList: [],
......@@ -67,7 +67,8 @@ export default {
pageNum: 1,
pageSize: 10,
scrollTop: 0,
isLoading: false
isLoading: false,
userInfo: {}
}
},
computed: {
......@@ -104,13 +105,25 @@ export default {
}
},
created() {
console.log(this.$route.query.moduleType)
this.userInfo = uni.$storage.get('userInfo')
this.getTopInfo()
this.moduleType = Number(this.$route.query.moduleType)
// this.handleClick({moduleType: this.moduleType})
},
methods: {
// 获取缓存中置顶的列表
getTopInfo() {
const {phone, shopMerchantId, sceneType} = this.userInfo
const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || []
},
backPage() {
uni.navigateBack()
uni.navigateBack({
success: (res) => {
uni.$emit('messageBackHome', this.topList)
}
});
},
handleClick(item) {
// 如果点击的是同一个模块类型,则不进行操作
......@@ -260,6 +273,81 @@ export default {
} else {
this.nothing = true;
}
},
// 查看详情
async handleDetail(item) {
console.log(item, this.moduleType)
const {moduleType} = this
switch (moduleType) {
case 0:
console.log('企业消息跳转')
const res = await uni.$api.commonApi.getTaskById({ id: item.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}`
})
}
break
case 1:
console.log('优秀话术跳转')
uni.navigateTo({
url: `/pages/common/messageDetail?row=${encodeURIComponent(JSON.stringify(item))}&type=service`,
fail: (err) => {
console.error('页面跳转失败:', err);
}
});
break
case 2:
console.log('违规话术跳转')
uni.navigateTo({
url: `/pages/common/earlyWarnDetail?row=${encodeURIComponent(JSON.stringify(item))}`,
fail: (err) => {
console.error('页面跳转失败:', err);
}
});
break
case 3:
console.log('短课程学习跳转')
break
case 4:
console.log('长课程学习跳转')
break
default:
break
}
},
// 置顶,取消置顶
handleStickTop() {
console.log('置顶')
const {phone, shopMerchantId, sceneType} = this.userInfo
const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}`
let _topList = _topInfo[key] || []
if (_topList.includes(this.moduleType)) {
_topList = _topList.filter(item => item !== this.moduleType)
} else {
_topList.push(this.moduleType)
}
_topInfo[key] = _topList
this.topList = _topList
uni.$storage.set('noticeTopInfo', _topInfo)
}
}
}
......
......@@ -41,5 +41,5 @@ export const STORAGE_OBJECTKEY = {
recordTrackList: 'recordTrackList',
beisenToken: 'beisenToken',
messagePopShownDate: 'messagePopShownDate',
noticeTopList: 'noticeTopList'
noticeTopInfo: 'noticeTopInfo'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!