deletemsg
This commit is contained in:
@@ -489,7 +489,7 @@
|
||||
this.$store.dispatch("contact/getFriendList");
|
||||
this.$store.dispatch("circle/getFriendCircleInfo");
|
||||
|
||||
this.handleArguments();
|
||||
if(true !== this.handleArguments()){
|
||||
uni.switchTab({
|
||||
url: "/pages/conversation/conversationList/index?isRedirect=true",
|
||||
complete() {
|
||||
@@ -501,6 +501,7 @@
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 验证是否升级
|
||||
@@ -540,7 +541,9 @@
|
||||
}else{
|
||||
let conversation = this.storeConversationList.find((item) => item === json.data);
|
||||
if(conversation){
|
||||
plus.navigator.closeSplashscreen();
|
||||
prepareConversationState(conversation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : false,
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : false,
|
||||
"delay" : 0
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
</u-form-item>
|
||||
<u-form-item v-if="active <= 1 && !isPwdLogin" label="" prop="verificationCode">
|
||||
<u-input v-model="loginInfo.verificationCode" border="surround" placeholder="请输入验证码">
|
||||
<view class="code_btn" slot="suffix" @click="getCode">
|
||||
{{ count !== 0 ? `${count} s` : "获取验证码" }}
|
||||
<view class="code_btn" slot="suffix" @click="getCode">{{ count !== 0 ? `${count} s` : "获取验证码" }}
|
||||
</view>
|
||||
</u-input>
|
||||
</u-form-item>
|
||||
@@ -219,10 +218,11 @@ export default {
|
||||
}
|
||||
|
||||
const options = {
|
||||
phoneNumber: this.loginInfo.phoneNumber,
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
usedFor: SmsUserFor.Login,
|
||||
operationID: Date.now() + "",
|
||||
event: "login",
|
||||
type:"mobile"
|
||||
};
|
||||
businessSendSms(options)
|
||||
.then(() => {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
validator: (rule, value, callback) => {
|
||||
return value.length >= 6;
|
||||
},
|
||||
message: "密码太短",
|
||||
message: "密码太过于简单",
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -62,10 +62,11 @@
|
||||
nickname: [{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请填写真实姓名",
|
||||
message: "请填写您的昵称",
|
||||
trigger: ["blur", "change"],
|
||||
}, ],
|
||||
password: [{
|
||||
password: [
|
||||
{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入密码",
|
||||
@@ -76,20 +77,20 @@
|
||||
validator: (rule, value, callback) => {
|
||||
return value.length >= 6;
|
||||
},
|
||||
message: "密码太短",
|
||||
message: "密码太过于简单",
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
confirmPassword: [{
|
||||
type: "string",
|
||||
required: true,
|
||||
message: "请输入确认密码",
|
||||
message: "请再次输入密码",
|
||||
trigger: ["blur", "change"],
|
||||
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{6,}$/,
|
||||
},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
return value === this.formData.password;
|
||||
return value === this.userInfo.password;
|
||||
},
|
||||
message: "两次密码不一致",
|
||||
trigger: ["change", "blur"],
|
||||
@@ -103,15 +104,17 @@
|
||||
},
|
||||
onLoad(options) {
|
||||
const {userInfo,codeValue} = options;
|
||||
if(userInfo){
|
||||
this.userInfo = {
|
||||
...this.userInfo,
|
||||
...util.aesdecode(userInfo),
|
||||
};
|
||||
}
|
||||
this.codeValue = codeValue;
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
//this.userInfo.email = "commiu@outlook.com";
|
||||
this.userInfo.nickname = "";
|
||||
this.userInfo.password = "qwe123";
|
||||
this.userInfo.password = "qwe1231";
|
||||
this.userInfo.confirmPassword = "qwe123";
|
||||
}
|
||||
},
|
||||
@@ -129,26 +132,29 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
async doRegister() {
|
||||
this.loading = true;
|
||||
doRegister() {
|
||||
const _this = this;
|
||||
this.$refs.loginForm.validate().then(async (res) => {
|
||||
_this.loading = true;
|
||||
console.log(res);
|
||||
const options = {
|
||||
code: this.codeValue,
|
||||
code: _this.codeValue,
|
||||
platform: uni.$u.os(),
|
||||
autoLogin: true,
|
||||
...this.userInfo,
|
||||
region: `+${this.userInfo.region}`,
|
||||
password: md5(this.userInfo.password),
|
||||
mobile: this.userInfo.mobile
|
||||
..._this.userInfo,
|
||||
region: `+${_this.userInfo.region}`,
|
||||
password: md5(_this.userInfo.password),
|
||||
mobile: _this.userInfo.mobile
|
||||
};
|
||||
try {
|
||||
await businessRegister(options);
|
||||
this.saveLoginInfo();
|
||||
_this.saveLoginInfo();
|
||||
uni.$u.toast('注册成功')
|
||||
uni.$u.route("/pages/common/login/index")
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
if(err.msg=="验证码过期" || err.msg=="验证码错误"){
|
||||
const s = util.aesencode(this.userInfo);
|
||||
const s = util.aesencode(_this.userInfo);
|
||||
uni.$u.route("/pages/common/verifyCode/index", {
|
||||
userInfo: s,
|
||||
isRegister: true,
|
||||
@@ -158,8 +164,14 @@
|
||||
}
|
||||
// uni.$u.toast('注册失败')
|
||||
} finally {
|
||||
this.loading = false;
|
||||
_this.loading = false;
|
||||
}
|
||||
uni.$u.toast('校验通过')
|
||||
}).catch(errors => {
|
||||
console.log(errors);
|
||||
uni.$u.toast('校验失败')
|
||||
});
|
||||
return ;
|
||||
},
|
||||
saveLoginInfo() {
|
||||
uni.setStorage({
|
||||
@@ -176,7 +188,6 @@
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.set_info_container {
|
||||
margin-top: var(--status-bar-height);
|
||||
background: linear-gradient(180deg,
|
||||
rgba(0, 137, 255, 0.1) 0%,
|
||||
rgba(255, 255, 255, 0) 100%);
|
||||
|
||||
@@ -8,9 +8,16 @@
|
||||
export default {
|
||||
name: "ErrorMessagegRender",
|
||||
components: {},
|
||||
props: {
|
||||
message: Object,
|
||||
conversationID:String,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created(){
|
||||
console.log(this.message);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
<view v-if="isNoticeMessage" class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
|
||||
<text>{{ getNoticeContent }}</text>
|
||||
</view>
|
||||
<view v-else-if="source.contentType == 1519" class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
|
||||
<text @click="toAnnouncement">{{ announcementElem.opUser.nickname }}更新了群公告</text>
|
||||
</view>
|
||||
<view v-else class="message_wrapper">
|
||||
<template v-if="selectFlag">
|
||||
<uni-icons class="selectedIcon" size="30" color="#07c160" type="checkbox-filled" v-if="selectClientMsgIDItems.indexOf(source.clientMsgID)>-1"></uni-icons>
|
||||
@@ -24,7 +27,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)">
|
||||
<component :is="component"
|
||||
<component v-if="component" :is="component"
|
||||
@messageEvent="onMessageEvent"
|
||||
:isSender="isSender"
|
||||
:message="source"
|
||||
@@ -34,6 +37,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="selected_overlay" v-if="selectFlag"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -113,7 +117,8 @@
|
||||
toolTipFlag: false,
|
||||
popPostion:"default",
|
||||
toolTipData: [],
|
||||
component:"ErrorMessageRender"
|
||||
component:"",
|
||||
announcementElem:{opUser:{nickname:""}}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -159,6 +164,9 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if(this.source.contentType == MessageType.GroupAnnouncementUpdated){
|
||||
this.announcementElem = JSON.parse(this.source.notificationElem.detail)
|
||||
}else{
|
||||
const MsgType2Components = {
|
||||
['type_'+MessageType.TextMessage] : "TextMessageRender",
|
||||
['type_'+MessageType.PictureMessage] : "PictureMessageRender",
|
||||
@@ -179,6 +187,7 @@
|
||||
'type_2001' : "NotificationRender"
|
||||
};
|
||||
this.component = MsgType2Components['type_'+this.source.contentType] || "ErrorMessageRender";
|
||||
}
|
||||
this.$emit('userEvent',{type:"messageItemRender"},this.source.clientMsgID);
|
||||
this.setSendingDelay();
|
||||
},
|
||||
@@ -191,6 +200,11 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
toAnnouncement(){
|
||||
uni.navigateTo({
|
||||
url:"/pages/conversation/groupSettings/announcement"
|
||||
})
|
||||
},
|
||||
setSendingDelay() {
|
||||
if (this.source.status === MessageStatus.Sending) {
|
||||
setTimeout(() => {
|
||||
@@ -201,8 +215,8 @@
|
||||
longtapEvent(e){
|
||||
this.$emit('userEvent',{type:"longtapMsgContent"},this.source);
|
||||
},
|
||||
onMessageEvent(e){
|
||||
this.$emit('userEvent',e);
|
||||
onMessageEvent(e,data){
|
||||
this.$emit('userEvent',e,data);
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -214,6 +228,15 @@
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
.selected_overlay{
|
||||
position: absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
.message_item {
|
||||
display: flex;
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeHistoryMessageList",
|
||||
"storeCurrentUserID",
|
||||
"storeCurrentConversation","storeCurrentMsg",'storeCurrentMsgID'
|
||||
]),
|
||||
},
|
||||
@@ -91,8 +93,17 @@
|
||||
if (options?.back2Tab) {
|
||||
this.back2Tab = JSON.parse(options.back2Tab);
|
||||
}
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnMsgDeleted,({data})=>{
|
||||
let list = this.storeHistoryMessageList;
|
||||
//console.log(data);
|
||||
list = list.filter((item)=>{
|
||||
return item.serverMsgID != data.serverMsgID;
|
||||
})
|
||||
this.$store.commit('message/SET_HISTORY_MESSAGE_LIST',list);
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnMsgDeleted);
|
||||
//console.log("unload");
|
||||
this.disposePageListener();
|
||||
markConversationAsRead({...this.$store.getters.storeCurrentConversation,},true);
|
||||
@@ -215,18 +226,9 @@
|
||||
if(noticeMessageTypes.includes(data.contentType)){
|
||||
return ;
|
||||
}
|
||||
let founded = false;
|
||||
let arr = [];
|
||||
for (var index = 0; index < this.selectItems.length; index++) {
|
||||
var v = this.selectItems[index];
|
||||
if (v.clientMsgID == data.clientMsgID) {
|
||||
founded = true;
|
||||
} else {
|
||||
arr.push(v);
|
||||
}
|
||||
}
|
||||
if (!founded) {
|
||||
arr.push(data);
|
||||
let arr = this.selectItems.filter((item)=>item.clientMsgID != data.clientMsgID);
|
||||
if(arr.length === this.selectItems.length){
|
||||
arr.push(data)
|
||||
}
|
||||
this.selectItems = [...arr];
|
||||
}
|
||||
@@ -241,17 +243,19 @@
|
||||
}
|
||||
for (let i = 0; i < deleteMsgs.length; i++) {
|
||||
let element = deleteMsgs[i];
|
||||
IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessageFromLocalStorage, IMSDK.uuid(), {
|
||||
//IMSDK.asyncApi(IMSDK.IMMethods.DeleteMessage, IMSDK.uuid(), {
|
||||
conversationID: _this.storeCurrentConversation.conversationID,
|
||||
clientMsgID: element.clientMsgID
|
||||
}).then(res => {
|
||||
//console.log(res);
|
||||
|
||||
}).catch(res => {
|
||||
//console.log(res);
|
||||
console.log('catch',res);
|
||||
}).finally(() => {
|
||||
//console.log(arguments);
|
||||
console.log('finally',arguments);
|
||||
})
|
||||
}
|
||||
|
||||
this.selectItems = [];
|
||||
this.$refs.chatingListRef.loadMessageList();
|
||||
return;
|
||||
@@ -300,7 +304,11 @@
|
||||
conversationID: _this.storeCurrentConversation.conversationID,
|
||||
clientMsgID: data.clientMsgID
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
let list = _this.storeHistoryMessageList;
|
||||
list = list.filter((item)=>{
|
||||
return item.clientMsgID != data.clientMsgID;
|
||||
});
|
||||
_this.$store.commit('message/SET_HISTORY_MESSAGE_LIST',list);
|
||||
}).catch(res => {
|
||||
console.log(res);
|
||||
}).finally(() => {
|
||||
@@ -327,7 +335,7 @@
|
||||
let nowTime = new Date().getTime();
|
||||
let msgTime = data.createTime;
|
||||
let diff = nowTime - msgTime;
|
||||
if (this.isSender && diff < 120000) {
|
||||
if (_this.storeCurrentUserID == data.sendID && diff < 120000) {
|
||||
menu.push('撤回')
|
||||
}
|
||||
uni.showActionSheet({
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
// uni.navigateTo({
|
||||
// url:"/pages/user/vip/vip"
|
||||
// });
|
||||
//prepareConversationState(this.storeConversationList[2]);
|
||||
prepareConversationState(this.storeConversationList[0]);
|
||||
},1000)
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
<template>
|
||||
<view style="display: flex;flex-direction: column;width: 100vw;height: 100vh;">
|
||||
<view>
|
||||
<u-navbar
|
||||
:autoBack="true"
|
||||
title="群公告"
|
||||
safeAreaInsetTop
|
||||
placeholder
|
||||
fixed
|
||||
:autoBack="true"
|
||||
>
|
||||
<view class="u-nav-slot" slot="right" v-if="isOwner || isAdmin">
|
||||
<u-button type="primary" size="mini" @click="save">确定</u-button>
|
||||
<u-button type="primary" size="mini" @click="save">保存</u-button>
|
||||
</view>
|
||||
</u-navbar>
|
||||
<u--textarea :disabled="!isOwner && !isAdmin" count confirmType="done" focus autoHeight maxlength="-1" border="none" v-model="announcement"></u--textarea >
|
||||
<u-parse v-if="!isOwner && !isAdmin" :content="announcement"></u-parse>
|
||||
<u--textarea v-else
|
||||
count
|
||||
confirmType="done"
|
||||
focus
|
||||
autoHeight
|
||||
height="500"
|
||||
maxlength="-1"
|
||||
border="none"
|
||||
:adjustPosition="false"
|
||||
class="textarea"
|
||||
placeholder="暂无公告"
|
||||
v-model="announcement"
|
||||
>
|
||||
</u--textarea>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -45,7 +57,7 @@
|
||||
uni.navigateBack();
|
||||
},
|
||||
save(){
|
||||
if(!isOwner && !isAdmin){
|
||||
if(!this.isOwner && !this.isAdmin){
|
||||
return ;
|
||||
}
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetGroupInfo, IMSDK.uuid(), {
|
||||
@@ -62,6 +74,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.textarea{
|
||||
}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<u-navbar :autoBack="true" bgColor="#ECECEC" :title="'群聊设置('+storeCurrentGroup.memberCount+')'" safeAreaInsetTop placeholder fixed></u-navbar>
|
||||
|
||||
<view class="group_settings_content">
|
||||
<view class="setting_row info_row" v-if="1==2">
|
||||
<view class="setting_row info_row">
|
||||
<view class="group_avatar" @click="updateGroupAvatar">
|
||||
<my-avatar :src="storeCurrentConversation.faceURL" :isGroup="true" size="46" />
|
||||
<image v-if="isOwner" class="edit_icon" src="@/static/images/group_setting_edit.png" alt="" />
|
||||
|
||||
@@ -19,7 +19,7 @@ const mutations = {
|
||||
};
|
||||
},
|
||||
SET_UNREAD_COUNT(state, count) {
|
||||
if (count) {
|
||||
if (count>0) {
|
||||
uni.setTabBarBadge({
|
||||
index: 0,
|
||||
text: count < 99 ? count + "" : "99+",
|
||||
|
||||
+20
-4
@@ -1,5 +1,5 @@
|
||||
import store from "@/store";
|
||||
import {CustomType,GroupSystemMessageTypes,AddFriendQrCodePrefix,AddGroupQrCodePrefix} from "@/constant";
|
||||
import {CustomType,GroupSystemMessageTypes,noticeMessageTypes} from "@/constant";
|
||||
import IMSDK, {GroupAtType,MessageType,SessionType} from "openim-uniapp-polyfill";
|
||||
import dayjs from "dayjs";
|
||||
import {isThisYear} from "date-fns";
|
||||
@@ -174,11 +174,17 @@ export const parseMessageByType = (pmsg) => {
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${getName(kickOpUser)}踢出了${kickStr}${kickdUserList.length > 3 ? "..." : ""}`;
|
||||
case MessageType.GroupMemberMuted:
|
||||
//群成员禁言通知
|
||||
return `[GroupMemberMuted]`;
|
||||
case MessageType.GroupMemberCancelMuted:
|
||||
//取消群成员禁言通知
|
||||
return `[GroupMemberCancelMuted]`;
|
||||
case MessageType.GroupMuted:
|
||||
//群禁言通知
|
||||
return `[GroupMuted]`;
|
||||
case MessageType.GroupCancelMuted:
|
||||
//取消群禁言通知
|
||||
return `[GroupCancelMuted]`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
@@ -200,15 +206,19 @@ export const parseMessageByType = (pmsg) => {
|
||||
const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupNameUpdateUser = groupNameUpdateDetail.opUser;
|
||||
return `${getName(groupNameUpdateUser)}修改了群名称为${groupNameUpdateDetail.group.groupName}`;
|
||||
case MessageType.GroupCancelMuted:
|
||||
return `[GroupCancelMuted]`;
|
||||
case MessageType.GroupAnnouncementUpdated:
|
||||
//群公告更新
|
||||
const groupAnnouncementUpdatedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupAnnouncementUpdatedDetail.opUser)}更新了群公告`;
|
||||
return `[GroupAnnouncementUpdated]`;
|
||||
case MessageType.BurnMessageChange:
|
||||
//阅后即焚开启或关闭通知
|
||||
return `[BurnMessageChange]`;
|
||||
case MessageType.RevokeMessage:
|
||||
return `[RevokeMessage]`;
|
||||
let notificationElem = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${notificationElem.revokerNickname}撤回了一条消息`;
|
||||
case MessageType.MsgPinned:
|
||||
//消息置顶
|
||||
return `[MsgPinned]`;
|
||||
case 2001:
|
||||
const body = JSON.parse(pmsg.notificationElem.detail);
|
||||
@@ -370,11 +380,17 @@ export const offlinePushInfo = {
|
||||
};
|
||||
|
||||
export const getConversationContent = (message) => {
|
||||
if(noticeMessageTypes.includes(message.contentType)){
|
||||
return `${parseMessageByType(message)}`;
|
||||
}
|
||||
if (
|
||||
!message.groupID ||
|
||||
message.sendID === store.getters.storeCurrentUserID
|
||||
) {
|
||||
return parseMessageByType(message);
|
||||
}
|
||||
if(message.senderNickname){
|
||||
return `${message.senderNickname}:${parseMessageByType(message)}`;
|
||||
}
|
||||
return parseMessageByType(message);
|
||||
};
|
||||
Reference in New Issue
Block a user