diff --git a/App.vue b/App.vue
index b726a1b..ccc2c3e 100644
--- a/App.vue
+++ b/App.vue
@@ -29,7 +29,7 @@
},
computed: {
...mapState('chatStore', ['chats'])
- },
+ },
onLaunch() {
// 判断版本更新 需要真机进行测试
//checkupdate();
@@ -114,19 +114,19 @@
// url: `/pages/chatbox/chat`
// });
}
-
+
if(!extras){
uni.reLaunch({
url: `/pages/chatbox/chat`
});
}
}
-
+
// 消息推送事件
if (notificationEventType == 'notificationArrived') {
-
+
}
-
+
});
jpushModule.getRegistrationID(result => {
console.log("极光推送--注册ID", result.registerID)
@@ -164,8 +164,8 @@
uni.navigateTo({
url: "/pages/login/login"
})
- }
-
+ }
+
// 未读消息总数(用于角标)
let count = 0
myCache("this.chats",this.chats);
@@ -176,9 +176,9 @@
});
myCache("massageCount",count);
console.log("massageCountmassageCount",count);
-
+
//---------------------------------------------------
- },
+ },
methods: {
...mapActions('chatStore'),
//---------------------------------------------------
@@ -307,7 +307,9 @@
}
},
handlePrivateMessage(msg) {
- msg.selfSend = msg.sendId === this.userId;
+ msg.selfSend = String(msg.sendId) === String(this.userId);
+ console.log("msg.sendId",msg.sendId)
+ console.log("this.userId",this.userId)
const friendId = msg.selfSend ? msg.recvId : msg.sendId;
const chatInfo = { type: 'PRIVATE', targetId: friendId };
const type=Number(msg.type)
@@ -326,10 +328,17 @@
this.$store.dispatch('chatStore/readedMessage', { friendId: msg.sendId });
return;
}
+ //撤回
if (type === enums.MESSAGE_TYPE.RECALL) {
this.$store.dispatch('chatStore/recallMessage', { msgInfo: msg, chatInfo });
return;
}
+ //屏蔽违规信息
+ if (type === enums.MESSAGE_TYPE.BLOCKED) {
+ this.$store.dispatch('chatStore/blockMessage', { msgInfo: msg, chatInfo });
+ return;
+ }
+ //更新好友列表
if (type === enums.MESSAGE_TYPE.FRIEND_NEW) {
this.$store.dispatch('friendStore/addFriend', JSON.parse(msg.content));
// this.friendStore.addFriend(JSON.parse(msg.content));
@@ -355,7 +364,8 @@
},
handleGroupMessage(msg) {
- msg.selfSend = msg.sendId === this.userId;
+ msg.selfSend = String(msg.sendId) === String(this.userId);
+ // msg.selfSend = msg.sendId === this.userId;
const chatInfo = { type: 'GROUP', targetId: msg.groupId };
const type=Number(msg.type)
if (type === enums.MESSAGE_TYPE.LOADING) {
@@ -383,6 +393,11 @@
this.$store.dispatch('chatStore/recallMessage', { msgInfo: msg, chatInfo });
return;
}
+ //屏蔽违规信息
+ if (type === enums.MESSAGE_TYPE.BLOCKED) {
+ this.$store.dispatch('chatStore/blockMessage', { msgInfo: msg, chatInfo });
+ return;
+ }
if (type === enums.MESSAGE_TYPE.GROUP_NEW) {
this.$store.dispatch('groupStore/addGroup', JSON.parse(msg.content));
return;
diff --git a/common/enums.js b/common/enums.js
index 1521c87..fea5c87 100644
--- a/common/enums.js
+++ b/common/enums.js
@@ -7,6 +7,7 @@ const MESSAGE_TYPE = {
VIDEO: 4,
ORDER: 5,
PRODUCT: 6,
+ BLOCKED: 7,
RECALL: 10,
READED: 11,
RECEIPT: 12,
@@ -57,7 +58,8 @@ const MESSAGE_STATUS = {
UNSEND: 0,
SENDED: 1,
RECALL: 2,
- READED: 3
+ READED: 3,
+ BLOCKED:4
}
export {
diff --git a/common/utils.js b/common/utils.js
index e9d6462..b1cf623 100644
--- a/common/utils.js
+++ b/common/utils.js
@@ -1,4 +1,4 @@
-
+
var utils = {
//时间格式化
formatDate: (value) => {
@@ -47,10 +47,10 @@
MM = MM < 10 ? ('0' + MM) : MM;
let d = date.getDate();
d = d < 10 ? ('0' + d) : d;
-
+
return y + '/' + MM + '/' + d;
},
-
+
//字典数据根据key显示文字
dataFilter:(arr, val='')=> {
let name = "";
@@ -63,7 +63,7 @@
});
return name;
},
-
+
//列表转换为树格式
listtoTree:(data)=>{
let result = [];
@@ -88,8 +88,8 @@
return result;
},
getRemoteFile: (path) => {
- return `https://www.sanduolantoyoga.com/yoga${path}`;
+ return `https://yoga.runpengsoft.com/yoga${path}`;
}
}
// 格式化日期
- export default utils;
\ No newline at end of file
+ export default utils;
diff --git a/main.js b/main.js
index 3d13af4..7f50ce3 100644
--- a/main.js
+++ b/main.js
@@ -95,6 +95,7 @@ $http.afterRequest = function (response) {
}, 2000);
}
else {
+
return
}
}
diff --git a/manifest.json b/manifest.json
index 45e1e9e..381dfe0 100644
--- a/manifest.json
+++ b/manifest.json
@@ -18,7 +18,7 @@
}
},
"compatible" : {
- "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
+ "ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
"splashscreen" : {
"alwaysShowBeforeRender" : true,
@@ -385,7 +385,7 @@
"disableHostCheck" : true, //禁用 Host 检查
"proxy" : {
"/apis" : {
- "target" : "https://www.sanduolantoyoga.com",
+ "target" : "https://yoga.runpengsoft.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
diff --git a/pages.json b/pages.json
index 4d6aba1..cb8b818 100644
--- a/pages.json
+++ b/pages.json
@@ -172,11 +172,28 @@
"path" : "pages/chatbox/chat-box",
"style" :
{
- "navigationBarTitleText": "消息2",
- "enablePullDownRefresh": false
+ "navigationBarTitleText": "消息",
+ "enablePullDownRefresh": false,
+ "app-plus": {
+ "titleNView": {
+ "buttons": [
+ {
+ "text": "\uE684", // 使用 unicode 或字体图标,此处为三个点的 Unicode(需引入 iconfont)
+ "fontSrc": "/static/font.ttf", // 如果使用自定义字体需指定
+ "fontSize": "22px",
+ "float": "right"
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "path": "pages/chatbox/report",
+ "style": {
+ "navigationBarTitleText": "投诉举报"
}
},
-
{
"path" : "pages/product/list",
"style": {
@@ -440,10 +457,10 @@
"enablePullDownRefresh": false
}
},
-
+
{
"path" : "pages/user/info",
- "style" :
+ "style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
@@ -451,7 +468,7 @@
},
{
"path" : "pages/user/infofw",
- "style" :
+ "style" :
{
"navigationBarTitleText": "用户服务协议",
"enablePullDownRefresh": false
@@ -459,13 +476,13 @@
},
{
"path" : "pages/user/infoys",
- "style" :
+ "style" :
{
"navigationBarTitleText": "隐私政策条款",
"enablePullDownRefresh": false
}
},
-
+
// ……其他页面配置 更新版本
{
diff --git a/pages/chatbox/chat-box.vue b/pages/chatbox/chat-box.vue
index fff01db..e547975 100644
--- a/pages/chatbox/chat-box.vue
+++ b/pages/chatbox/chat-box.vue
@@ -11,6 +11,31 @@
>
+
+
+
+
+
+ ✓
+
+
+
+
+
+
+
@@ -34,6 +60,23 @@
+
+
+
+ 已选 {{ selectedMessageIds.length }} 条
+
+
+
+
+
+
+
@@ -81,7 +124,12 @@ export default {
isReadOnly: false,
playingAudio: null,
isInBottom: true,
- newMessageSize: 0
+ newMessageSize: 0,
+ // ===== 投诉选择模式 =====
+ selectionMode: false, // 是否处于选择模式
+ selectedMessageIds: [], // 已选中的消息ID列表
+ showReportMenu: false, // 是否显示投诉底部弹窗(投诉 / 取消)
+ selectableTypes: [0, 'TEXT', 1, 'IMAGE', 2, 'AUDIO', 3, 'VIDEO'] // 可选的消息类型
};
},
computed: {
@@ -206,6 +254,9 @@ export default {
},
onUnload() {
this.unListenKeyboard();
+ // 退出时重置选择模式
+ this.selectionMode = false;
+ this.selectedMessageIds = [];
},
onShow() {
if (this.needScrollToBottom) {
@@ -216,6 +267,113 @@ export default {
},
methods: {
+ // ==================== 投诉选择模式 ====================
+ /**
+ * 获取可选的消息列表(排除系统提示消息)
+ */
+ getAvailableMessages() {
+ return (this.chat?.messages || []).filter(msg => {
+ // 排除系统提示类型
+ if (msg.type === 'TIP_TEXT') return false;
+ // 排除已经被撤回的消息
+ if (msg.isRecalled) return false;
+ return true;
+ });
+ },
+ canReport(msgInfo) {
+ if (!msgInfo) return false
+ // 1. 本人发送的消息不能投诉
+ if (msgInfo.selfSend) return false
+ // 2. 系统提示消息不能投诉(如"撤回了一条消息"等)
+ if (msgInfo.type === 21) return false
+
+ if (msgInfo.type === 20) return false
+ return true
+ },
+ /**
+ * 切换选择模式
+ */
+ enterSelectionMode() {
+ this.showReportMenu = false; // 关闭底部弹窗
+ this.selectionMode = true;
+ this.selectedMessageIds = [];
+ // 隐藏键盘
+ uni.hideKeyboard();
+ // 关闭其他面板
+ this.switchChatTabBox('none');
+ },
+
+ /**
+ * 关闭投诉底部弹窗
+ */
+ closeReportMenu() {
+ this.showReportMenu = false;
+ },
+
+ /**
+ * 取消选择模式
+ */
+ cancelSelection() {
+ this.selectionMode = false;
+ this.selectedMessageIds = [];
+ },
+
+ /**
+ * 切换单条消息的选中状态
+ */
+ toggleSelectMessage(msgId) {
+ // 查找消息
+ const msg = this.chat.messages.find(m => m.id === msgId);
+ if (!msg || !this.canReport(msg)) return
+
+ const idx = this.selectedMessageIds.indexOf(msgId);
+ if (idx > -1) {
+ this.selectedMessageIds.splice(idx, 1);
+ } else {
+ this.selectedMessageIds.push(msgId);
+ }
+ },
+
+ /**
+ * 点击"下一步":校验选择并跳转到投诉页
+ */
+ nextStep() {
+ if (this.selectedMessageIds.length === 0) {
+ uni.showToast({ title: '请至少选择一条消息', icon: 'none' });
+ return;
+ }
+
+ // 构建投诉页参数
+ const sendType = this.chat.type === 'GROUP' ? '1' : '2';
+ const senderId = this.chat.targetId;
+ const senderName = this.chat.showName || '';
+ const senderAvatar = this.chat.headImage || '';
+
+ // 将选中的消息ID存入本地缓存,供投诉页读取(避免URL参数过长)
+ // 按选中顺序提取完整聊天记录
+ const selectedRecords = this.selectedMessageIds
+ .map(id => this.chat.messages.find(m => m.id === id))
+ .filter(msg => !!msg);
+ // 直接存储完整聊天记录(含全部消息字段),供投诉页读取
+ uni.setStorageSync('report_selected_messages', selectedRecords);
+ uni.setStorageSync('report_send_type', sendType);
+ uni.setStorageSync('report_sender_id', senderId);
+ uni.setStorageSync('report_sender_name', senderName);
+ uni.setStorageSync('report_sender_avatar', senderAvatar);
+ // 退出选择模式
+ this.selectionMode = false;
+ this.selectedMessageIds = [];
+
+ // 跳转投诉页
+ uni.navigateTo({
+ url: `/pages/chatbox/report?sendType=${sendType}&senderId=${senderId}&fromChat=true`
+ });
+ },
+ onNavigationBarButtonTap(e) {
+ // 点击右上角符号:弹出底部操作菜单(投诉 / 取消)
+ if (this.selectionMode) return; // 选择模式中忽略
+ this.showReportMenu = true;
+ },
// 映射 Vuex actions
...mapActions('chatStore', [
'insertMessage',
@@ -1190,4 +1348,137 @@ export default {
}
}
+
+/* ========== 选择模式样式 ========== */
+.message-wrapper {
+ display: flex;
+ align-items: flex-start;
+ padding: 4rpx 0;
+ transition: background 0.2s;
+
+ /* 本人发送的消息:整行靠右,保持消息原右侧位置不变 */
+ &.self {
+ flex-direction: row-reverse;
+ justify-content: flex-start;
+ }
+}
+
+.message-wrapper .checkbox-container {
+ padding: 20rpx 12rpx 0 16rpx;
+ flex-shrink: 0;
+ align-self: stretch;
+}
+
+.checkbox {
+ width: 42rpx;
+ height: 42rpx;
+ border-radius: 50%;
+ border: 2rpx solid #ccc;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 24rpx;
+ color: #fff;
+ flex-shrink: 0;
+ background: #fff;
+ transition: all 0.2s;
+ &.checked {
+ background: $im-color-primary;
+ border-color: $im-color-primary;
+ }
+}
+
+/* ========== 底部选择操作栏 ========== */
+.selection-bar {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ background: #ffffff;
+ border-top: 1rpx solid #e8e8e8;
+ padding: 16rpx 24rpx;
+ padding-bottom: env(safe-area-inset-bottom, 16rpx);
+ display: flex;
+ align-items: center;
+ justify-content: flex-end;
+ z-index: 1000;
+ box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.06);
+
+ .selection-right {
+ display: flex;
+ align-items: center;
+ gap: 16rpx;
+ .selection-count {
+ font-size: 26rpx;
+ color: #999;
+ margin-right: 8rpx;
+ }
+ .btn-cancel-selection {
+ padding: 10rpx 28rpx;
+ height: 60rpx;
+ line-height: 40rpx;
+ background: #f5f7fa;
+ color: #666;
+ font-size: 26rpx;
+ border-radius: 30rpx;
+ border: none;
+ }
+ .btn-confirm-selection {
+ padding: 10rpx 32rpx;
+ height: 60rpx;
+ line-height: 40rpx;
+ background: $im-color-primary;
+ color: #fff;
+ font-size: 26rpx;
+ border-radius: 30rpx;
+ border: none;
+ box-shadow: 0 4rpx 12rpx $im-color-primary;
+ &:disabled {
+ background: #ccc;
+ box-shadow: none;
+ }
+ }
+ }
+}
+
+/* ========== 投诉底部弹窗样式 ========== */
+.report-menu-mask {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.45);
+ z-index: 999;
+ display: flex;
+ align-items: flex-end;
+}
+.report-menu-panel {
+ width: 100%;
+ background: #ffffff;
+ border-radius: 24rpx 24rpx 0 0;
+ padding-bottom: env(safe-area-inset-bottom, 24rpx);
+ overflow: hidden;
+}
+.report-menu-title {
+ text-align: center;
+ font-size: 26rpx;
+ color: #999999;
+ padding: 24rpx 0 12rpx;
+}
+.report-menu-item {
+ height: 100rpx;
+ line-height: 100rpx;
+ text-align: center;
+ font-size: 32rpx;
+ color: #333333;
+ border-top: 1rpx solid #f0f0f0;
+ &:active {
+ background: #f5f5f5;
+ }
+}
+.report-menu-complain {
+ color: $im-color-primary;
+ font-weight: 600;
+}
diff --git a/pages/chatbox/report.vue b/pages/chatbox/report.vue
new file mode 100644
index 0000000..580cd57
--- /dev/null
+++ b/pages/chatbox/report.vue
@@ -0,0 +1,563 @@
+
+
+
+
+
+
+ 群
+
+
+ {{ targetName }}
+
+
+
+
+
+
+
+
+ 暂无聊天记录可投诉
+
+
+
+
+
+
+ {{ getFullMessageContent(msg) }}
+
+
+
+
+
+
+
+
+ 投诉原因 *
+
+
+
+
+
+
+
+ 补充描述 (选填)
+
+ {{ description.length }}/200
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 865c2ba..32001df 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -6,11 +6,11 @@
-
- 密码登录
-
+
+
+
- 短信登录(待审核)
+ 短信登录
@@ -28,16 +28,16 @@
-
-
-
-
+
+
+
+
看不清?
-
+
@@ -70,11 +70,11 @@
登录中..
-
+
-
+
@@ -82,7 +82,7 @@
- 我已阅读并同意
+ 我已阅读并同意
《用户服务协议》
@@ -95,8 +95,8 @@
-
-
+
+
@@ -132,16 +132,16 @@
gcj02:"1",
address:'',
longitude:'', // 经度
- latitude:'', // 维度
+ latitude:'', // 维度
checkbox1: [1],
checkboxitem: [{
text: '',
value: 1,
}],
- ifxy: false, // 是否选择协议
- loginType:'pwd',
+ ifxy: false, // 是否选择协议
+ loginType:'sms',
smsCountdown: 0, // 短信验证码倒计时
- smsTimer: null, // 定时器
+ smsTimer: null, // 定时器
}
},
onLoad(){
@@ -355,7 +355,7 @@
},
// 密码登录
async loginpwdDo(){
-
+
// 是否阅读协议
if(!this.checkxy()){
return false;
@@ -509,7 +509,7 @@
var shoplist=[shop]
myCache('shoplist',shoplist);
}
- },
+ },
gotofw(){
uni.navigateTo({
url: `/pages/user/infofw`
@@ -519,7 +519,7 @@
uni.navigateTo({
url: `/pages/user/infoys`
});
- },
+ },
// ========== 短信验证码相关 ==========
/**
* 发送短信验证码
@@ -603,7 +603,7 @@
async loginSmsDo() {
const phone = this.form.phonenumber;
const smsCode = this.form.smsCode;
-
+
// 是否阅读协议
if(!this.checkxy()){
return false;
@@ -672,7 +672,7 @@
duration: 2000
});
}
- },
+ },
}
}
@@ -887,7 +887,7 @@
padding: 0 0 40rpx 0;
}
-
+
.xycon{
display: flex;
align-items: center;
@@ -910,18 +910,18 @@
margin-left: 10rpx;
}
.sname{
- font-size: 24rpx;
+ font-size: 24rpx;
font-weight: 400;
color: #23262F;
line-height: 36rpx;
}
.adress{
- font-size: 24rpx;
+ font-size: 24rpx;
font-weight: 400;
color: #00a89b;
line-height: 36rpx;
}
}
}
-
+
diff --git a/pages/user/userEdit.vue b/pages/user/userEdit.vue
index 85615a5..703f8d0 100644
--- a/pages/user/userEdit.vue
+++ b/pages/user/userEdit.vue
@@ -69,7 +69,7 @@
{
text: '未知',
value: 0
- },
+ },
{
text: '男',
value: 2
@@ -116,7 +116,7 @@
// 获取用户信息
this.getmember();
},
- onShow() {
+ onShow() {
this.iflogin();
},
methods: {
@@ -153,7 +153,7 @@
var token = uni.getStorageSync("token");
try{
uni.uploadFile({
- url: 'https://www.sanduolantoyoga.com/yoga/api/my/avatarUpload', //上传图片的后端接口
+ url: 'https://yoga.runpengsoft.com/yoga/api/my/avatarUpload', //上传图片的后端接口
filePath: tempFilePaths,
name: 'file',
header: {
@@ -162,7 +162,7 @@
},
success: res => {
uni.hideLoading();
- myCache("ifuserEdit", true);
+ myCache("ifuserEdit", true);
var data = JSON.parse(res.data);
if (data.success) {
uni.showToast({
@@ -218,24 +218,25 @@
},
async savedo() {
var that = this;
- try {
+ try {
uni.showLoading({
title: '信息保存中....'
});
const { data: res } = await uni.$http.post("/api/my/modifyMyInformation", that.valiFormData);
if (res.success) {
+
this.msgType = 'success';
this.messageText = `提交成功!`;
this.$refs.message.open();
- myCache("ifuserEdit", true);
+ myCache("ifuserEdit", true);
var user = myCache('userInfo');
myCache('user',{
- userid:user.userid,
- nickName:that.valiFormData.nickName,
+ userid:res.data.id,
+ nickName:res.data.nickName,
username:user.username,
userphone:user.userphone,
- signature:that.valiFormData.signature,
- avatar:that.valiFormData.avatar
+ signature:res.data.signature,
+ avatar:res.data.avatar
});
setTimeout(() => {
// 返回 关闭当前页面
@@ -397,4 +398,4 @@
padding: 10rpx 48rpx;
box-sizing: border-box;
}
-
\ No newline at end of file
+
diff --git a/store/chatStore.js b/store/chatStore.js
index 7775637..5c6de7c 100644
--- a/store/chatStore.js
+++ b/store/chatStore.js
@@ -248,7 +248,33 @@ const chatModule = {
}
chat.stored = false;
},
-
+ BLOCK_MESSAGE(state, { idx, targetId, blockContent, sendTime }) {
+ const chat = state.chats[idx];
+ if (!chat) return;
+ for (let m of chat.messages) {
+ if (m.id === targetId) {
+ m.status = MESSAGE_STATUS.BLOCKED;
+ m.content = blockContent;
+ m.type = MESSAGE_TYPE.TIP_TEXT; // 改为提示型消息
+ // 如果屏蔽的是最后一条消息,更新会话摘要
+ if (chat.messages[chat.messages.length - 1] === m) {
+ chat.lastContent = blockContent;
+ chat.lastSendTime = sendTime;
+ chat.sendNickName = '';
+ }
+ break;
+ }
+ }
+ // 处理引用消息(如有引用该消息的内容,也屏蔽)
+ for (let m of chat.messages) {
+ if (m.quoteMessage && m.quoteMessage.id === targetId) {
+ m.quoteMessage.content = "内容已被屏蔽";
+ m.quoteMessage.status = MESSAGE_STATUS.BLOCKED;
+ m.quoteMessage.type = MESSAGE_TYPE.TIP_TEXT;
+ }
+ }
+ chat.stored = false;
+ },
// 更新会话头像和名称
UPDATE_CHAT_AVATAR_NAME(state, { type, targetId, headImage, showName }) {
for (let chat of state.chats) {
@@ -481,8 +507,12 @@ const chatModule = {
let atAll = chat.atAll || false;
// 未读计数
- if (!msgInfo.selfSend && msgInfoStatus !== MESSAGE_STATUS.READED &&
- msgInfoStatus !== MESSAGE_STATUS.RECALL && msgInfoType !== MESSAGE_TYPE.TIP_TEXT) {
+ if (!msgInfo.selfSend
+ && msgInfoStatus !== MESSAGE_STATUS.READED
+ && msgInfoStatus !== MESSAGE_STATUS.RECALL
+ && msgInfoStatus !== MESSAGE_STATUS.BLOCKED
+ && msgInfoType !== MESSAGE_TYPE.TIP_TEXT
+ ) {
unreadCount++;
}
@@ -589,6 +619,39 @@ const chatModule = {
dispatch('saveToStorage', { withColdMessage: isCold });
},
+ /**
+ * 系统/管理员屏蔽违规消息
+ * @param {Object} context - Vuex action 上下文
+ * @param {Object} payload - { msgInfo, chatInfo }
+ * msgInfo: { id: 被屏蔽的消息ID, sendTime: 消息发送时间 }
+ */
+ blockMessage({ getters, commit, dispatch }, { msgInfo, chatInfo }) {
+ const idx = getters.findChatIdx(chatInfo);
+ if (idx === -1) return;
+ const chat = getters.findChat(chatInfo);
+ const targetId = msgInfo.content; // 被屏蔽的消
+ const blockContent = '该消息因违规已被屏蔽';
+
+ // 判断是否为冷消息(用于存储优化)
+ let isCold = false;
+ for (let i = 0; i < chat.messages.length; i++) {
+ if (chat.messages[i].id === targetId) {
+ isCold = i < chat.hotMinIdx;
+ break;
+ }
+ }
+ // 提交 mutation 修改消息状态
+ commit('BLOCK_MESSAGE', {
+ idx,
+ targetId,
+ blockContent,
+ sendTime: msgInfo.sendTime || Date.now(),
+ });
+
+ // 屏蔽不增加未读计数(系统操作,不打扰用户)
+ // 直接保存到存储
+ dispatch('saveToStorage', { withColdMessage: isCold });
+ },
// ========== 更新会话信息(好友) ==========
updateChatFromFriend({ commit, dispatch }, friend) {
commit('UPDATE_CHAT_AVATAR_NAME', {
diff --git a/utils/utils.js b/utils/utils.js
index 7b789fe..76ae581 100644
--- a/utils/utils.js
+++ b/utils/utils.js
@@ -5,9 +5,9 @@ function myCache(key, value, seconds = 3600 * 240) {// 默认是24小时
// 设置缓存
let expire = nowTime + Number(seconds);
uni.setStorageSync(key,JSON.stringify(value) + '§' +expire)
- }
+ }
else if (key && !value) {
-
+
if(value==undefined){
// 获取缓存
let val = uni.getStorageSync(key);
@@ -39,25 +39,25 @@ function getRemoteFile(path) {
}
function getRemoteFile0(path) {
if (path.includes("/profile/upload/")) {
- return `https://www.sanduolantoyoga.com/yoga${path}`;
+ return `https://yoga.runpengsoft.com/yoga${path}`;
}
else{
- return `https://www.sanduolantoyoga.com/yoga/profile/upload${path}`;
+ return `https://yoga.runpengsoft.com/yoga/profile/upload${path}`;
}
}
function getRemoteHtmlFile(str) {
// const reg = new RegExp('"/profile/upload/', 'g'); //g,表示全部替换。
- // str = str.replace(reg, '"https://www.sanduolantoyoga.com/profile/upload/');
+ // str = str.replace(reg, '"https://yoga.runpengsoft.com/profile/upload/');
// const reg1 = new RegExp('\'/profile/upload/', 'g'); //g,表示全部替换。
- // str = str.replace(reg1, '\'https://www.sanduolantoyoga.com/profile/upload/');
+ // str = str.replace(reg1, '\'https://yoga.runpengsoft.com/profile/upload/');
return str;
}
function getRemoteHtmlFile0(str) {
// https://xcfzk.com/
const reg = new RegExp('"/profile/upload/', 'g'); //g,表示全部替换。
- str = str.replace(reg, '"https://www.sanduolantoyoga.com/profile/upload/');
+ str = str.replace(reg, '"https://yoga.runpengsoft.com/profile/upload/');
const reg1 = new RegExp('\'/profile/upload/', 'g'); //g,表示全部替换。
- str = str.replace(reg1, '\'https://www.sanduolantoyoga.com/profile/upload/');
+ str = str.replace(reg1, '\'https://yoga.runpengsoft.com/profile/upload/');
return str;
}
function getNowDate() {
@@ -126,7 +126,7 @@ function getcartLoseNum() {
return num
};
// function getmessageNum() {
-// var user=myCache("user");
+// var user=myCache("user");
// var userid = user.userid? user.userid:'';
// var num=0;
// if(userid){
@@ -140,7 +140,7 @@ function getcartLoseNum() {
// return num
// }
// };
-function getmessageNum() {
+function getmessageNum() {
var num= myCache("massageCount")?myCache("massageCount"):0;
return num;
};