Commit bfcc3779 by 胡悦

提交服务中心代码

1 parent 91549652
......@@ -369,5 +369,13 @@ module.exports = {
projectName: 'pad',
...data
})
},
// 服务中心-消息汇总
getMessageSummary(data) {
return http.post({
method: 'dj.pad.api.page.script.sop.message.summary.list',
projectName: 'pad',
...data
})
}
}

2.44 MB | W: | H:

2.44 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -318,14 +318,14 @@ export default {
}
},
// 消息中心未读总数
async getMessageCount () {
const { sceneType } = uni.$storage.get("userInfo")
const res = await uni.$api.commonApi.getMessageCount({
status: 0, // 待查看,未读
businessType: sceneType
})
this.messageTotal = res
},
// async getMessageCount () {
// const { sceneType } = uni.$storage.get("userInfo")
// const res = await uni.$api.commonApi.getMessageCount({
// status: 0, // 待查看,未读
// businessType: sceneType
// })
// this.messageTotal = res
// },
// 学习中心消息弹窗,优先级高于有修改话术弹窗
async getMessagePop () {
// 获取今天日期字符串
......@@ -375,8 +375,9 @@ export default {
})
},
getMessageInfo () {
console.log(111111, 'getMessageInfo')
// this.getMessage()
this.getMessageCount()
// this.getMessageCount()
this.getMessagePop()
},
jumpPersonCenter () {
......
......@@ -140,9 +140,6 @@ export default {
console.log(error)
this.back()
}
// 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})
},
back() {
uni.navigateTo({
......@@ -175,22 +172,14 @@ export default {
const res = await uni.$api.commonApi.updateMessageStatus({
idList
})
// this.backPage()
// if (res) {
// this.backPage()
// } else {
// console.log('接口返回结果为空,可能存在问题')
// }
} catch (error) {
// this.backPage()
console.error('更新消息状态时出现错误:', error)
} finally {
this.isProcessing = false; // 处理完成,将标志位设为 false
this.backPage()
}
}
},
}
}
}
</script>
......
<template>
<view>
<ServiceList :topListProp="topList" @handleClick="handleClick" />
<ServiceList :messageList="messageList" :topListProp="topList" @handleClick="handleClick" />
</view>
</template>
<script>
import ServiceList from '../../../../pages/common/serviceDetail/components/ServiceList.vue';
import { getMessageSummary } from '../../../../api/module/common'
export default {
name: 'MessageIndex',
components: {
......@@ -12,7 +13,8 @@ export default {
},
data() {
return {
topList: []
topList: [],
messageList: []
}
},
created() {
......@@ -20,7 +22,18 @@ export default {
this.topList = topList
})
},
mounted() {
console.log('消息')
this.getMessageSummary()
},
methods: {
// 获取服务中心列表
async getMessageSummary() {
const userInfo = uni.$storage.get('userInfo')
const res = await getMessageSummary({businessType: userInfo.sceneType})
console.log(res, '===')
this.messageList = res
},
handleClick(item) {
const { moduleType } = item
uni.navigateTo({
......
......@@ -56,7 +56,7 @@
<view class="content-right box-class">
<view class="common-title">服务中心</view>
<view class="content-box">
<MessageIndex />
<MessageIndex class="message-box" ref="messageRef" />
</view>
</view>
</view>
......@@ -239,6 +239,7 @@ export default {
},
methods: {
async changeTab ({ item, jumpUrl, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary()
this.previewOff = index != 0
this.$emit('changeTab', index)
this.showBeisen = false
......@@ -535,6 +536,9 @@ export default {
position: relative;
width: 100%;
height: calc(100% - #{toRpx(120)});
.message-box {
height: 100%;
}
.developing {
height: 100%;
flex-direction: column;
......
......@@ -24,7 +24,7 @@
`${countdown}s` :
'' }}</view>
</template>
<template v-if="pageType == 'service'">
<template v-if="pageType == 'service' && messageInfo.status == 1">
<view class="btn blue more-script" @click="handleMoreScript">更多话术</view>
</template>
</view>
......@@ -61,6 +61,7 @@ export default {
// 获取mock配置的时间
this.MOCKDATA = uni.$storage.get('mock_data')
this.countTime = this.MOCKDATA.timer || countTimer
// this.countTime = 0.1
this.countdown = this.countTime * 60 - 1
},
onLoad(options) {
......@@ -102,7 +103,11 @@ export default {
startTime: this.enterTime,
endTime: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")
})
this.back(ids)
if (ids) {
this.back(ids)
} else {
this.handleMoreScript()
}
// if (type == 'read') this.$emit("backHome")
// else if (type == 'view') this.back('MessageList', {firstIndex: 1})
// this.back('MessageList', {firstIndex: 1, tagIndex: this.tagIndex})
......@@ -129,22 +134,16 @@ export default {
scriptId = [this.messageInfo.scriptId]
try {
this.isProcessing = true;
// this.back(idList)
// 接口调用
const res = await uni.$api.commonApi.updateMessageStatus({
idList
})
// if (res) {
// this.backPage(scriptId, idList)
// } else {
// console.log('接口返回结果为空,可能存在问题')
// }
} catch (error) {
// this.backPage(scriptId, idList)
console.error('更新消息状态时出现错误:', error)
} finally {
this.isProcessing = false; // 处理完成,将标志位设为 false
this.backPage(scriptId, idList)
this.backPage(scriptId)
}
}
},
......
......@@ -54,7 +54,8 @@ export default {
pageSize: PAGE_SIZE,
tagList: [],
tagIndex: '',
scrollTop: 0
scrollTop: 0,
type: ''
}
},
computed: {
......@@ -75,6 +76,7 @@ export default {
},
onLoad(options) {
console.log(options)
if (options.type) this.type = options.type
// this.init()
},
methods: {
......@@ -92,9 +94,13 @@ export default {
});
},
back() {
let pageNum = 2
if (this.type == 'read') {
pageNum = 1
}
uni.$emit('pageBack')
uni.navigateBack({
delta: 2,
delta: pageNum,
animationType: 'pop-out',
animationDuration: 100
})
......
<template>
<view class="message-index-box">
<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>
<view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view>
</view>
<view class="message-item-content">
<view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] : i.title }}</view>
</view>
<view class="message-item-time-box">
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
<view class="sprite-icon icon-stick-top"></view>
</view>
</view>
</view>
<template v-if="getList.length > 0">
<view class="message-group" v-for="(item, index) in getList" :key="index">
<view class="message-date">{{ item.date }}</view>
<view class="message-list">
<view :class="['message-item', moduleType == i.moduleType ? 'active' : '']" v-for="(i, ind) in item.msgList" :key="ind" @click.stop="handleClick(i)">
<scroll-view scroll-y class="service-list">
<view class="message-index-box">
<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>
<view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view>
</view>
<view class="message-item-content">
<view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] : i.title }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] :
i.title }}</view>
</view>
<view class="message-item-time-box">
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
<view class="sprite-icon icon-stick-top"></view>
</view>
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
</view>
</view>
<template v-if="getList.length > 0">
<view class="message-group" v-for="(item, index) in getList" :key="index">
<view class="message-date">{{ item.date }}</view>
<view class="message-list">
<view :class="['message-item', moduleType == i.moduleType ? 'active' : '']"
v-for="(i, ind) in item.msgList" :key="ind" @click.stop="handleClick(i)">
<view class="message-item-icon">
<view :class="['sprite-icon', `icon-${moduleIconEnum[i.moduleType]}`]"></view>
<view class="message-item-icon-num" v-if="i.count > 0">{{ i.count > 99 ? 99 : i.count }}</view>
</view>
<view class="message-item-content">
<view class="message-item-title">{{ moduleTypeEnum[i.moduleType] }}</view>
<view class="message-item-desc">{{ moduleContentEnum[i.moduleType] ? moduleContentEnum[i.moduleType] :
i.title }}</view>
</view>
<view class="message-item-time">{{ formatTime(i.createdTime) }}</view>
</view>
</view>
</view>
</template>
<template v-else>
<view class="message-empty">
<image class="message-empty-img" src="../../../../assets//images/home/notice-nothing.webp"
mode="scaleToFill" />
<view class="message-empty-text">暂无消息</view>
</view>
</template>
</view>
</template>
<template v-else>
<view class="message-empty">
<image
class="message-empty-img"
src="../../../../assets//images/home/notice-nothing.webp"
mode="scaleToFill"
/>
<view class="message-empty-text">暂无消息</view>
</view>
</template>
</view>
</scroll-view>
</template>
<script>
import dayjs from 'dayjs';
......@@ -59,6 +63,10 @@ export default {
topListProp: {
type: Array,
default: () => []
},
messageList: {
type: Array,
default: () => []
}
},
data() {
......@@ -107,6 +115,12 @@ export default {
}
},
watch: {
messageList: {
handler(newVal) {
this.msgList = newVal
},
immediate: true
},
topListProp: {
handler(newVal) {
this.topList = newVal
......@@ -118,7 +132,7 @@ export default {
getTopList() {
if (!this.topList) return [];
// 按topList中的倒序排列
return this.topList.slice().reverse().map(type =>
return this.topList.slice().reverse().map(type =>
this.msgList.find(item => item.moduleType === type)
).filter(Boolean);
},
......@@ -132,10 +146,10 @@ export default {
// 根据date进行分组
const groupedByDate = {};
filteredList.forEach(item => {
if (!groupedByDate[item.strdate]) {
groupedByDate[item.strdate] = [];
if (!groupedByDate[item.strDate]) {
groupedByDate[item.strDate] = [];
}
groupedByDate[item.strdate].push(item);
groupedByDate[item.strDate].push(item);
});
// 转换为数组格式,并按date降序排列
......@@ -152,7 +166,7 @@ export default {
},
methods: {
getTopInfo() {
const {phone, shopMerchantId, sceneType} = uni.$storage.get('userInfo')
const { phone, shopMerchantId, sceneType } = uni.$storage.get('userInfo')
const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || []
......@@ -170,6 +184,9 @@ export default {
}
</script>
<style scoped lang="scss">
.service-list {
height: 100%;
}
.message-index-box {
margin: 0 toRpx(32);
height: 100%;
......@@ -193,6 +210,7 @@ export default {
background: #ffffff;
border-radius: toRpx(24);
padding: toRpx(24);
&.active {
background: #4673ff1a;
}
......@@ -237,16 +255,19 @@ export default {
word-break: break-all;
}
}
.message-item-time {
color: #999999;
font-size: toRpx(24);
margin-left: auto;
}
.message-item-time-box {
display: flex;
flex-direction: column;
align-items: center;
margin-left: auto;
.icon-stick-top {
margin-top: toRpx(4);
}
......@@ -254,16 +275,19 @@ export default {
}
}
}
.message-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: toRpx(144);
&-img {
width: toRpx(496);
height: toRpx(208);
}
&-text {
color: #999999;
font-size: toRpx(20);
......
<template>
<view class="detail-box">
<view class="nav-bar">
<view class="back" @click="backPage(null)">
<view class="back" @click="backPage">
<uni-icons type="left" :size="20" color="#000"></uni-icons>
</view>
<view class="title">服务中心</view>
</view>
<view class="detail-content">
<view class="detail-left">
<ServiceList :moduleType="moduleType" :topListProp="topList" @handleClick="handleClick" />
<ServiceList :moduleType="moduleType" :messageList="messageList" :topListProp="topList" @handleClick="handleClick" />
</view>
<view class="detail-right">
<view class="common-title">
......@@ -41,9 +41,9 @@
</view>
</view>
<uni-transition :show="noticeTips" mode="slide-top">
<view class="notice-tips blue" >
<view class="sprite-icon icon-notice-success"></view>
<view>{{ topList.includes(Number(moduleType)) ? '置顶' : '取消置顶' }}成功</view>
<view class="notice-tips" >
<!-- <view class="sprite-icon icon-notice-success"></view> -->
<view>{{ topList.includes(Number(moduleType)) ? '置顶成功' : '取消置顶' }}</view>
</view>
</uni-transition>
</view>
......@@ -55,6 +55,7 @@ let timer = null
import dayjs from 'dayjs'
import { moduleTypeEnum, moduleContentEnum } from './components/contant'
import ServiceList from './components/ServiceList.vue';
import {getMessageSummary} from '../../../api/module/common'
export default {
name: 'ServiceDetail',
components: {
......@@ -76,7 +77,8 @@ export default {
scrollTop: 0,
isLoading: false,
userInfo: {},
noticeTips: false
noticeTips: false,
messageList: []
}
},
computed: {
......@@ -119,9 +121,17 @@ export default {
// this.handleClick({moduleType: this.moduleType})
},
methods: {
// 获取服务中心列表
async getMessageSummary(sceneType) {
// const userInfo = uni.$storage.get('userInfo')
const res = await getMessageSummary({businessType: sceneType})
console.log(res, '===')
this.messageList = res
},
// 获取缓存中置顶的列表
getTopInfo() {
const {phone, shopMerchantId, sceneType} = this.userInfo
this.getMessageSummary(sceneType)
const _topInfo = uni.$storage.get('noticeTopInfo') || {}
const key = `${phone}-${shopMerchantId}-${sceneType}`
this.topList = _topInfo[key] || []
......@@ -129,6 +139,7 @@ export default {
backPage() {
uni.navigateBack({
success: (res) => {
this.getMessageSummary(this.userInfo.sceneType)
uni.$emit('messageBackHome', this.topList)
}
});
......@@ -504,22 +515,18 @@ export default {
}
.notice-tips {
position: fixed;
top: toRpx(160);
top: toRpx(150);
width: toRpx(400);
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
justify-content: center;
color: #4673ff;
color: #FFFFFF;
font-size: toRpx(28);
padding: toRpx(16) toRpx(24);
border-radius: toRpx(8);
z-index: 1;
&.blue {
background: #4673ff1a;
}
.icon-notice-success {
margin-right: toRpx(16);
}
background-color: #000000cc;
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!