Browse Source

feat(common): 新增文章详情页面并优化系统消息列表

- 新增文章详情页面(article_info.vue)- 重构系统消息列表(sys_msg_list.vue),添加滚动加载功能- 修改我的消息(my_message.vue)和IM聊天信息(im_chat_info.vue)的跳转逻辑
master
liutong 12 months ago
parent
commit
0977d6020e
  1. 9
      pages.json
  2. 193
      pages/common/article_info.vue
  3. 2
      pages/common/im_chat_info.vue
  4. 13
      pages/common/my_message.vue
  5. 189
      pages/common/sys_msg_list.vue

9
pages.json

@ -135,6 +135,15 @@
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, },
{
"path" : "pages/common/article_info",
"style": {
"navigationBarTitleText": "文章详情",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#292929",
"navigationBarTextStyle": "white"
}
},
{ {
"path" : "pages/common/feedback", "path" : "pages/common/feedback",
"style": { "style": {

193
pages/common/article_info.vue

@ -0,0 +1,193 @@
<!--文章-详情-->
<template>
<view class="main_box">
<view class="main_section">
<view class="section_1">
<view class="titile">{{dataInfo.title}}</view>
<view class="content" v-html="dataInfo.content"></view>
</view>
</view>
</view>
</template>
<script>
import commonApi from '@/api/common.js';
export default {
components: {
},
data() {
return {
dataInfo: {
title: '',//
content: '',//
},//
}
},
onLoad(options) {
this.filteredData.hair_staff_id = options.hair_staff_id//id
},
onShow(){
this.init()
},
//
async onPullDownRefresh() {
//
await this.resetFilteredData()
await this.getList()
},
methods: {
//
async init(){
await this.getList();
},
//()
loadMoreData() {
//
if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
}
},
//
async resetFilteredData() {
this.isReachedBottom = false; // 便
this.filteredData.page = 1//
this.filteredData.limit = 10//
this.filteredData.total = 10//
},
//
async getList(){
this.loading = true
let data = {...this.filteredData}
//
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
if(data.page == 1){
this.tableList = []
}
let res = await commonApi.getContactMessage(data)//
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = this.tableList.concat(res.data.data); // 使 concat
// this.tableList.unshift(...res.data.data); //
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
//
openViewArticleInfo(item){
uni.navigateTo({
url: '/pages/common/article_info?id='+item.id
})
},
}
}
</script>
<style lang="less" scoped>
.main_box {
background: #292929;
}
//
.navbar_section {
display: flex;
justify-content: center;
align-items: center;
background: #29d3b4;
.title {
padding: 20rpx 0;
font-size: 30rpx;
color: #315d55;
}
}
.main_section {
min-height: 100vh;
background: #292929 100%;
padding: 0 0rpx;
padding-top: 32rpx;
padding-bottom: 150rpx;
font-size: 28rpx;
display: flex;
flex-direction: column;
gap: 20rpx;
.section {
background-color: #434544;
padding: 40rpx 40rpx;
}
.section_1{
padding: 0 24rpx;
display: flex;
flex-direction: column;
.item{
margin-bottom: 38rpx;
display: flex;
flex-direction: column;
padding: 32rpx 24rpx;
border-radius: 14rpx;
background-color: rgba(255,255,255,1);
border: 2rpx solid rgba(187,187,187,1);
color: #4F4F4F;
font-size: 32rpx;
.title{
}
.img_box{
margin-top: 30rpx;
width: 100%;
}
.content{
margin-top: 30rpx;
}
.time{
display: flex;
justify-content: flex-end;
margin-top: 36rpx;
}
}
}
}
.describe {
color: #999999;
padding-left: 30rpx;
}
</style>

2
pages/common/im_chat_info.vue

@ -112,7 +112,7 @@ export default {
this.filteredData.total = 10// this.filteredData.total = 10//
}, },
// //
async getList(){ async getList(){
this.loading = true this.loading = true

13
pages/common/my_message.vue

@ -139,21 +139,22 @@ export default {
}, },
//- //-
openViewSysMsgList(){ openViewSysMsgList(e){
let hair_staff_id = e.hair_staff_id//id
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/sys_msg_list` url: `/pages/common/sys_msg_list?hair_staff_id=${hair_staff_id}`
}) })
}, },
//- //-
openViewImChatInfo(v){ openViewImChatInfo(e){
if(v.type == 1){ if(e.type == 1){
// //
this.openViewSysMsgList this.openViewSysMsgList(e)
}else{ }else{
// //
let hair_staff_id = v.hair_staff_id//id let hair_staff_id = e.hair_staff_id//id
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/im_chat_info?hair_staff_id=${hair_staff_id}` url: `/pages/common/im_chat_info?hair_staff_id=${hair_staff_id}`
}) })

189
pages/common/sys_msg_list.vue

@ -3,122 +3,140 @@
<view class="main_box"> <view class="main_box">
<view class="main_section"> <view class="main_section">
<view class="section_1"> <scroll-view
<view class="item"> class="section_1"
<view class="title">吾悦校区停电通知</view> scroll-y="true"
<image :lower-threshold="lowerThreshold"
class="img_box" @scrolltolower="loadMoreData"
:src="$util.img('/upload/attachment/image/202504/02/1743562333d1bb6666f969da1b7170381d0845153e_local.png')" style="height: 90vh;"
model="aspectFit" >
></image> <view
class="item"
<view class="content"> v-for="(v,k) in tableList"
李老师将张包子的跟进人设置为您需要您 :key="k"
继续跟进点击此消息查看张包子的信息 @click="openViewArticleInfo(v)"
成后续跟进 >
</view> <view class="title">{{v.title}}</view>
<!-- <image-->
<view class="time">2024-03-07 10:30:00</view> <!-- class="img_box"-->
<!-- :src="$util.img('/upload/attachment/image/202504/02/1743562333d1bb6666f969da1b7170381d0845153e_local.png')"-->
<!-- model="aspectFit"-->
<!-- ></image>-->
<view class="content" v-html="v.content"></view>
<view class="time">{{v.show_time}}</view>
</view> </view>
<view class="item"> </scroll-view>
<view class="title">吾悦校区停电通知</view>
<image
class="img_box"
:src="$util.img('/upload/attachment/image/202504/02/1743562333d1bb6666f969da1b7170381d0845153e_local.png')"
model="aspectFit"
></image>
<view class="time">2024-03-07 10:30:00</view>
</view>
<view class="item">
<view class="title">吾悦校区停电通知</view>
<image
class="img_box"
:src="$util.img('/upload/attachment/image/202504/02/1743562333d1bb6666f969da1b7170381d0845153e_local.png')"
model="aspectFit"
></image>
<view class="content">
李老师将张包子的跟进人设置为您需要您
继续跟进点击此消息查看张包子的信息
成后续跟进
</view>
<view class="time">2024-03-07 10:30:00</view>
</view>
</view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import memberApi from '@/api/member.js'; import commonApi from '@/api/common.js';
import AQUplodeImgMulti from '@/components/AQ/AQUplodeImgMulti';
import AQTabber from "@/components/AQ/AQTabber"
export default { export default {
components: { components: {
AQTabber,
AQUplodeImgMulti,
}, },
data() { data() {
return { return {
formData: { loading:false,//
images_arr: [], lowerThreshold: 100,//
images: '', isReachedBottom: false,//|true=|false=
content: '',
mailbox: '', //
filteredData:{
page:1,//
limit:10,//
total:10,//
hair_staff_id: '',//id
}, },
tableList:[],//
} }
}, },
onLoad() { onLoad(options) {
this.filteredData.hair_staff_id = options.hair_staff_id//id
},
onShow(){
this.init()
},
//
async onPullDownRefresh() {
//
await this.resetFilteredData()
await this.getList()
}, },
methods: { methods: {
//######AQ###### //
// async init(){
AQUploadSuccess(res) { await this.getList();
console.log('接收AQ上传回调xxx1', res) },
// 使 split //()
let _inputValue = [] loadMoreData() {
if (res.filePathArr.length) { //
_inputValue = res.filePathArr if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
} }
this.formData[res.inputName] = _inputValue
// console.log('AQxxx1',res)
// console.log('AQxxx2',this.formData.member_store_certification_arr)
}, },
//
async resetFilteredData() {
this.isReachedBottom = false; // 便
this.filteredData.page = 1//
this.filteredData.limit = 10//
this.filteredData.total = 10//
},
//
async getList(){
this.loading = true
let data = {...this.filteredData}
async submitForm() { //
let data = {...this.formData} if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){
data.images = data.images_arr.join(',') this.loading = false
if (!data.content) {
//
uni.showToast({ uni.showToast({
title: '反馈内容为必填项', title: '暂无更多',
icon: 'none' icon: 'none'
}) })
return return
} }
let res = await memberApi.setFeedback(data)
if (res.code != 1) { if(data.page == 1){
this.tableList = []
}
let res = await commonApi.getContactMessage(data)//
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none' icon: 'none'
}) })
} else { return
uni.showToast({
title: '提交成功',
icon: 'none'
})
//1s
setTimeout(() => {
this.$util.openHomeView();
}, 1000);
} }
this.tableList = this.tableList.concat(res.data.data); // 使 concat
// this.tableList.unshift(...res.data.data); //
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
//
openViewArticleInfo(item) {
let id = item.id
let redirect = item.redirect//
uni.navigateTo({
url: `/pages/common/article_info?id=${id}`
})
}, },
} }
@ -164,8 +182,9 @@ export default {
padding: 0 24rpx; padding: 0 24rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 38rpx;
.item{ .item{
margin-bottom: 38rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;

Loading…
Cancel
Save