feat(uniapp_v2): 二开功能迁移与小程序主包优化
- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动 - queue、assets 使用独立分包以降低主包体积 - 修复首页单根节点与支付结果页 v-if 链 - 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错 - 配置域名与 manifest 应用名称;cache/store 防御性处理 Made-with: Cursor
This commit is contained in:
212
pro_v3.5.1/view/uniapp_v2/pages/users/message_center/index.vue
Normal file
212
pro_v3.5.1/view/uniapp_v2/pages/users/message_center/index.vue
Normal file
@@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<!-- 消息中心 -->
|
||||
<view class="main">
|
||||
<view class="px-20">
|
||||
<view class="w-full bg--w111-fff rd-24rpx mt-24 p-32 flex-between-center" v-if="system.id" @tap="goDetail(0)">
|
||||
<view class="left-pic w-88 h-88 rd-50-p111- flex-center">
|
||||
<text class="iconfont icon-ic_message1 fs-48 text--w111-fff"></text>
|
||||
</view>
|
||||
<view class="flex-1 pl-24">
|
||||
<view class="flex-between-center">
|
||||
<view class="fs-32 lh-44rpx w-200 line1">{{ system.title }}</view>
|
||||
<text class="fs-22 text--w111-999 lh-30rpx">{{ system.add_time }}</text>
|
||||
</view>
|
||||
<view class="flex-between-center mt-8">
|
||||
<view class="fs-24 text--w111-999 lh-34rpx w-430 line1">{{ system.content }}</view>
|
||||
<view class="dot" v-if="system.message_num > 0"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="w-full bg--w111-fff rd-24rpx mt-24 p-32 flex-between-center" @tap="goDetail(1)" v-if="community.id">
|
||||
<image src="../static/discover_msg.png" class="w-88 h-88 rd-50-p111- block"></image>
|
||||
<view class="flex-1 pl-24">
|
||||
<view class="flex-between-center">
|
||||
<view class="fs-32 lh-44rpx w-200 line1">互动消息</view>
|
||||
<text class="fs-22 text--w111-999 lh-30rpx"></text>
|
||||
</view>
|
||||
<view class="flex-between-center mt-8">
|
||||
<view class="fs-24 text--w111-999 lh-34rpx w-430 line1">用户{{ community.relation_author }}{{ community.type | typeFilter }}了你</view>
|
||||
<view class="dot" v-if="community.is_viewed == 0"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<tui-swipe-action v-for="(item, index) in list" :key="index" :operateWidth="64" class="mt-24 rd-24rpx">
|
||||
<template v-slot:content>
|
||||
<view class="w-full bg--w111-fff rd-24rpx p-32 flex-between-center" @tap="goChat(item.to_uid)">
|
||||
<image :src="item.avatar" class="w-88 h-88 rd-50-p111-"></image>
|
||||
<view class="flex-1 pl-24">
|
||||
<view class="flex-between-center">
|
||||
<view class="fs-32 lh-44rpx w-200 line1">{{ item.nickname }}</view>
|
||||
<view class="fs-22 text--w111-999 lh-30rpx">{{ item._update_time }}</view>
|
||||
</view>
|
||||
<view class="flex-between-center mt-8">
|
||||
<view class="fs-24 text--w111-999 lh-34rpx w-430 line1" v-if="[1, 2].includes(item.message_type)" v-html="item.message"></view>
|
||||
<view v-else>{{ item.message_type | messageType }}</view>
|
||||
<text class="badge" v-if="item.mssage_num > 0">{{ item.mssage_num > 99 ? '99+' : item.mssage_num }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-slot:button>
|
||||
<view class="delete-btn flex-center text--w111-fff fs-24" @tap="deleteMsg(index)">删除</view>
|
||||
</template>
|
||||
</tui-swipe-action>
|
||||
<view class="empty mt-20" v-if="list.length == 0 && !system.id && !community.id">
|
||||
<emptyPage title="暂无数据~"></emptyPage>
|
||||
</view>
|
||||
</view>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { serviceRecord } from '@/api/user.js';
|
||||
import colors from '@/mixins/color.js';
|
||||
import { HTTP_REQUEST_URL } from '@/config/app';
|
||||
import tuiSwipeAction from '@/components/tui-swipe-action/index.vue';
|
||||
import emptyPage from '@/components/emptyPage.vue';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [], //客服消息
|
||||
system: {}, //站内信
|
||||
community: {}, //社区消息
|
||||
page: 1,
|
||||
type: 0,
|
||||
limit: 20,
|
||||
loading: false,
|
||||
finished: false,
|
||||
imgHost: HTTP_REQUEST_URL
|
||||
};
|
||||
},
|
||||
components: {
|
||||
tuiSwipeAction,
|
||||
emptyPage
|
||||
},
|
||||
filters: {
|
||||
messageType(val) {
|
||||
let obj = {
|
||||
3: '[图片]',
|
||||
4: '[语音]',
|
||||
5: '[商品]',
|
||||
6: '[订单]'
|
||||
};
|
||||
return obj[val];
|
||||
},
|
||||
typeFilter(val) {
|
||||
let obj = {
|
||||
1: '点赞',
|
||||
2: '评论',
|
||||
3: '关注'
|
||||
};
|
||||
return obj[val];
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.page = 1;
|
||||
this.list = [];
|
||||
this.finished = false;
|
||||
this.getList();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getList();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.page = 1;
|
||||
this.list = [];
|
||||
this.finished = false;
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 站内信
|
||||
getList() {
|
||||
if (this.loading || this.finished) {
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
serviceRecord({
|
||||
page: this.page,
|
||||
limit: this.limit
|
||||
})
|
||||
.then((res) => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
let data = res.data.service;
|
||||
this.system = res.data.system;
|
||||
this.community = res.data.community;
|
||||
this.loading = false;
|
||||
data.forEach((item) => {
|
||||
if ([1, 2].includes(item.message_type)) {
|
||||
item.message = this.replace_em(item.message);
|
||||
}
|
||||
});
|
||||
this.list = this.list.concat(data);
|
||||
this.finished = data.length < this.limit;
|
||||
this.page += 1;
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
},
|
||||
replace_em(str) {
|
||||
str = str.replace(/\[em-([a-z_]*)\]/g, "<span class='em em-$1'/></span>");
|
||||
return str;
|
||||
},
|
||||
goChat(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/extension/customer_list/chat?to_uid=' + id + '&type=1'
|
||||
});
|
||||
},
|
||||
goDetail(type) {
|
||||
if (type == 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/message_center/messageDetail'
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/discover/discoverMessage/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
deleteMsg(index) {
|
||||
this.list.splice(index, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.left-pic {
|
||||
background: linear-gradient(180deg, #ffc657 0%, #fe653b 100%);
|
||||
}
|
||||
.dot {
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #e93323;
|
||||
}
|
||||
.badge {
|
||||
min-width: 32rpx;
|
||||
max-width: 56rpx;
|
||||
height: 32rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 32rpx;
|
||||
text-align: center;
|
||||
padding: 0 8rpx;
|
||||
border-radius: 20rpx;
|
||||
color: #fff;
|
||||
background-color: #e93323;
|
||||
}
|
||||
.delete-btn {
|
||||
width: 128rpx;
|
||||
height: 152rpx;
|
||||
background: #e93323;
|
||||
border-radius: 0 24rpx 24rpx 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<view class="msg">
|
||||
<view class="pt-32 pl-20 pr-20">
|
||||
<view class="item" v-for="(item,index) in messageList" :key="index">
|
||||
<view class="flex-x-center fs-22 lh-30rpx text--w111-999">{{ item.add_time }}</view>
|
||||
<view class="w-full bg--w111-fff rd-24rpx mt-24 p-32">
|
||||
<view class="fs-32 lh-44rpx">{{item.title}}</view>
|
||||
<view class="fs-28 lh-44rpx mt-24">{{item.content}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<home></home>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { messageSystem } from '@/api/user.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
loading: false,
|
||||
finished: false,
|
||||
messageList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getMessageList()
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getMessageList()
|
||||
},
|
||||
methods: {
|
||||
getMessageList() {
|
||||
if (this.loading || this.finished) return
|
||||
this.loading = true;
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
messageSystem({
|
||||
page: this.page,
|
||||
limit: this.limit
|
||||
})
|
||||
.then(res => {
|
||||
let data = res.data.list;
|
||||
uni.hideLoading();
|
||||
this.loading = false;
|
||||
this.messageList = this.messageList.concat(data);
|
||||
this.finished = data.length < this.limit;
|
||||
this.page += 1;
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.left-pic{
|
||||
background: linear-gradient(180deg, #FFC657 0%, #FE653B 100%);
|
||||
}
|
||||
.dot{
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #e93323;
|
||||
}
|
||||
.item ~ .item{
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user