Commit a20e7bdd by 胡悦

预警通知界面

1 parent 8ec90efd
...@@ -245,5 +245,13 @@ module.exports = { ...@@ -245,5 +245,13 @@ module.exports = {
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
},
// 预警消息
getWarningPage(data) {
return http.post({
method: 'dj.pad.api.message.box.findWarningNotificationPage',
projectName: 'pad',
...data
})
} }
} }
...@@ -125,6 +125,12 @@ ...@@ -125,6 +125,12 @@
} }
}, },
{ {
"path": "pages/common/earlyWarnDetail",
"style": {
"navigationStyle": "custom"
}
},
{
"path": "pages/common/messageList", "path": "pages/common/messageList",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
......
<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">话术违规预警</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-time">{{ warningInfo.time }}</view>
<view class="tip-tags">{{ warningInfo.warningTag }}</view>
</view>
<view class="tip-content warning-content">{{ warningInfo.warningContent }}
<view class="tips">你在以上的接待记录中,存在过度承诺现象,这极易引发客户纠纷,损害公司信誉。请严格依据公司政策与产品实际情况介绍,切勿做出无法兑现的承诺。因本次违规已扣除本月行为类-行为异常积分,后续将加强监管,违规者将严肃处理。
当购车者车辆出现问题,依据商家“任何小毛病都免费修”的承诺前往维修,却发现不在质保范围内需自费维修时,会产生经济上的落差与困扰。这不仅增加维修成本,还可能因与商家的售后纠纷,耗费大量时间与精力去沟通协调。</view>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
name: 'EarlyWarnDetail',
data() {
return {
warningInfo: {},
type: 'view',
content: ''
}
},
onLoad(options) {
const { row } = options
const _row = JSON.parse(row)
this.warningInfo = _row
},
methods: {
// 返回
back() {
// this.showPage('MessageList')
uni.navigateBack({
delta: 1,
animationType: 'pop-out',
animationDuration: 100
})
},
}
}
</script>
<style scoped lang="scss">
.detail-box {
position: relative;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/page-bg.webp');
background-size: 100%;
box-sizing: border-box;
padding-top: toRpx(160);
}
.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: 0 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(80)});
.outstanding-tip-list {
height: 100%;
background-color: #fff;
border-radius: toRpx(16);
padding: toRpx(24) 0;
}
.outstanding-tip-item {
width: 100%;
padding: 0 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: #333;
font-size: toRpx(28);
line-height: toRpx(48);
&.warning-content {
white-space: pre-line;
}
.tips {
color: #666;
margin-top: toRpx(16);
}
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
<view class="message-time">{{ item.actualSendTimeStr }}</view> <view class="message-time">{{ item.actualSendTimeStr }}</view>
<view class="message-tag">{{ CONTRNT_TYPE[item.contentType] }}</view> <view class="message-tag">{{ CONTRNT_TYPE[item.contentType] }}</view>
</view> </view>
<view class="message-content"> 您有新的消息【{{ item.title }}】{{ item.subtitle ? item.subtitle.length > 40 ? `[${item.subtitle.slice(0, 39)}...]` : `[${item.subtitle}]` : ''}},请点击查看 <view class="message-content"> 您有新的消息【{{ item.title }}】{{ item.subtitle ? item.subtitle.length > 40 ?
`[${item.subtitle.slice(0, 39)}...]` : `[${item.subtitle}]` : '' }},请点击查看
</view> </view>
</template> </template>
<template v-else-if="firstIndex == 1"> <template v-else-if="firstIndex == 1">
...@@ -49,6 +50,17 @@ ...@@ -49,6 +50,17 @@
</view> </view>
<view class="message-content">{{ item.polishContent }}</view> <view class="message-content">{{ item.polishContent }}</view>
</template> </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>
</view> </view>
</template> </template>
<template v-else> <template v-else>
...@@ -79,14 +91,16 @@ export default { ...@@ -79,14 +91,16 @@ export default {
return { return {
typeList: [ typeList: [
{ tabName: '系统通知', num: () => '' }, { tabName: '系统通知', num: () => '' },
{ tabName: '优秀话术', num: () => '' } { tabName: '优秀话术', num: () => '' },
{ tabName: '预警通知', num: () => '' }
], ],
CONTRNT_TYPE: CONTRNT_TYPE, CONTRNT_TYPE: CONTRNT_TYPE,
firstIndex: 0, firstIndex: 0,
firstLeft: ['first', 'second'], firstLeft: ['first', 'second', 'three'],
firstClass: ['first-nav', 'second-nav'], firstClass: ['first-nav', 'second-nav', 'second-nav'],
systemList: [], systemList: [],
messageList: [], messageList: [],
earlyWarnList: [],
nothing: false, nothing: false,
total: 0, total: 0,
pageNum: PAGE_NUM, pageNum: PAGE_NUM,
...@@ -98,31 +112,36 @@ export default { ...@@ -98,31 +112,36 @@ export default {
}, },
computed: { computed: {
getList() { getList() {
if (this.firstIndex == 0) { const listMap = {
return this.systemList 0: this.systemList,
} else if (this.firstIndex == 1) { 1: this.messageList,
console.log(this.messageList) 2: this.earlyWarnList
return this.messageList };
} if (this.firstIndex in listMap) {
return listMap[this.firstIndex];
}
return []; // 若 firstIndex 不在 0、1、2 范围内,返回 []
}, },
getScrollHeight() { getScrollHeight() {
if (this.getList == 0) return '' // 调用 getList 函数获取列表
else { const list = this.getList;
if (this.firstIndex == 0) { // 如果获取的列表为空,则返回空字符串
return 'scroll-list' if (!list || list.length === 0) {
} else if (this.firstIndex == 1) { return '';
return 'class-scroll' }
} else return '' // 根据 firstIndex 的值返回不同的类名
switch (this.firstIndex) {
case 0:
return 'scroll-list';
case 1:
return 'class-scroll';
case 2:
return 'scroll-list';
default:
return '';
} }
} }
}, },
// props: {
// transfer: {
// type: Object,
// default: () => { }
// }
// },
// inject: ['showPage'],
created() { created() {
uni.$on('pageList', (data) => { uni.$on('pageList', (data) => {
console.log('接收到上一个页面返回的数据:', data); console.log('接收到上一个页面返回的数据:', data);
...@@ -158,20 +177,38 @@ export default { ...@@ -158,20 +177,38 @@ export default {
} else if (index == 1) { } else if (index == 1) {
this.getMessagePage() this.getMessagePage()
this.getLabelList() this.getLabelList()
} else if (index == 2) {
this.getWarningPage()
} }
}, },
// 跳转详情 // 跳转详情
openDetail(row) { openDetail(row) {
console.log(row) console.log(row);
const { id, contentType } = row const { id } = row;
const { tagIndex } = this const actionMap = {
if (this.firstIndex == 1) { 2: () => {
// this.showPage('MessageDetail', { row, type: 'view', tagIndex })
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/messageDetail?row=${encodeURIComponent(JSON.stringify(row))}&type=view` url: `/pages/common/earlyWarnDetail?row=${encodeURIComponent(JSON.stringify(row))}`,
}) fail: (err) => {
} else if (this.firstIndex == 0) { console.error('页面跳转失败:', err);
this.getDetailById(id, row.readFlag) }
});
},
1: () => {
uni.navigateTo({
url: `/pages/common/messageDetail?row=${encodeURIComponent(JSON.stringify(row))}&type=view`,
fail: (err) => {
console.error('页面跳转失败:', err);
}
});
},
0: () => {
this.getDetailById(id, row.readFlag);
}
};
const action = actionMap[this.firstIndex];
if (action) {
action();
} }
}, },
back() { back() {
...@@ -248,9 +285,6 @@ export default { ...@@ -248,9 +285,6 @@ export default {
const res = await uni.$api.commonApi.getTaskInfo({ const res = await uni.$api.commonApi.getTaskInfo({
pageNum, pageSize pageNum, pageSize
}) })
// res.list?.length && res.list.map(e => {
// e.time = dayjs(new Date(e.actualSendTime)).format("YYYY-MM-DD HH:mm:ss")
// })
if (pageNum == 1) { if (pageNum == 1) {
this.systemList = res.list this.systemList = res.list
} else { } else {
...@@ -266,6 +300,41 @@ export default { ...@@ -266,6 +300,41 @@ export default {
}); });
} }
}, },
async getWarningPage() {
try {
uni.showLoading({
mask: true
})
const { pageNum, pageSize } = this
const params = {
pageNum,
pageSize
}
const res = await uni.$api.commonApi.getWarningPage(params)
res.list?.length && res.list.map(e => {
e.time = dayjs(new Date(e.warningTime)).format("YYYY-MM-DD HH:mm:ss")
// const warningContent = e.warningContent.split('\n');
// console.log(warningContent)
// const resultArray = warningContent.filter(item => item!== '')
// e.len = resultArray.length
// console.log(resultArray)
})
if (pageNum == 1) {
this.earlyWarnList = res.list
console.log(this.earlyWarnList, '===')
} else {
this.earlyWarnList = this.messageList.concat(res.list)
}
uni.hideLoading()
this.total = res.total
this.nothing = res.length ? true : false
} catch (error) {
uni.showToast({
title: error,
icon: "none",
});
}
},
async getDetailById(id, readFlag) { async getDetailById(id, readFlag) {
const res = await uni.$api.commonApi.getTaskById({ id }) const res = await uni.$api.commonApi.getTaskById({ id })
// 不刷新列表的更新消息状态 // 不刷新列表的更新消息状态
...@@ -294,16 +363,40 @@ export default { ...@@ -294,16 +363,40 @@ export default {
}) })
} }
}, },
//下拉分页 /**
* 页面触底时的处理函数
* 当页面触底时,判断是否还有更多数据,如果有则加载下一页数据
* 如果没有更多数据,则标记为没有更多数据状态
*/
pageonReachBottom() { pageonReachBottom() {
console.log('到底了'); console.log('到底了');
let { pageNum, total, nothing, pageSize } = this // 解构赋值,设置 nothing 的默认值
if (!nothing) nothing = 'nothing' let { pageNum, total, nothing = 'nothing', pageSize } = this;
if (Math.ceil(total / pageSize) > pageNum) { if (Math.ceil(total / pageSize) > pageNum) {
this.pageNum += 1 this.pageNum += 1;
if (this.firstIndex == 1) this.getMessagePage() // 根据 firstIndex 的值调用不同的方法
else if (this.firstIndex == 0) this.getSystemPage() switch (this.firstIndex) {
} else this.nothing = true case 1:
try {
this.getMessagePage();
} catch (error) {
console.error('调用 getMessagePage 方法时出错:', error);
}
break;
case 0:
try {
this.getSystemPage();
} catch (error) {
console.error('调用 getSystemPage 方法时出错:', error);
}
break;
default:
break;
}
} else {
this.nothing = true;
}
} }
} }
} }
...@@ -365,6 +458,7 @@ export default { ...@@ -365,6 +458,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
.type-box { .type-box {
position: relative; position: relative;
display: flex; display: flex;
...@@ -449,6 +543,7 @@ export default { ...@@ -449,6 +543,7 @@ export default {
position: relative; position: relative;
background-color: #fff; background-color: #fff;
border-radius: 0 0 toRpx(48) toRpx(48); border-radius: 0 0 toRpx(48) toRpx(48);
&.scroll-list { &.scroll-list {
height: calc(100% - #{toRpx(222)}); height: calc(100% - #{toRpx(222)});
} }
...@@ -464,6 +559,7 @@ export default { ...@@ -464,6 +559,7 @@ export default {
margin: 0 toRpx(64) toRpx(40); margin: 0 toRpx(64) toRpx(40);
padding: toRpx(24) toRpx(32); padding: toRpx(24) toRpx(32);
box-sizing: border-box; box-sizing: border-box;
&:first-child { &:first-child {
margin-top: toRpx(10); margin-top: toRpx(10);
} }
...@@ -518,6 +614,10 @@ export default { ...@@ -518,6 +614,10 @@ export default {
display: -webkit-box; display: -webkit-box;
-webkit-line-clamp: 2; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
&.warning-content {
white-space: pre-line;
-webkit-line-clamp: 4;
}
} }
} }
} }
...@@ -563,7 +663,8 @@ export default { ...@@ -563,7 +663,8 @@ export default {
} }
} }
} }
/deep/{
/deep/ {
.uni-scroll-view-content { .uni-scroll-view-content {
height: calc(100% - #{toRpx(10)}); height: calc(100% - #{toRpx(10)});
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!