Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 941464c330 | |||
| 825ac3457d | |||
| 7913a63a39 |
@@ -1,5 +1,11 @@
|
||||
<script>
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import {mapGetters,mapActions} from "vuex";
|
||||
import IMSDK, {IMMethods,MessageType,SessionType,} from "openim-uniapp-polyfill";
|
||||
import config from "@/common/config";
|
||||
import {getDbDir,toastWithCallback} from "@/util/common.js";
|
||||
import {getConversationContent,conversationSort,prepareConversationState} from "@/util/imCommon";
|
||||
import {PageEvents,UpdateMessageTypes} from "@/constant";
|
||||
import {checkUpgrade} from "@/api/login.js"
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
// #ifndef APP
|
||||
@@ -8,18 +14,15 @@
|
||||
);
|
||||
return ;
|
||||
// #endif
|
||||
this.$store.dispatch("system/getConfig");
|
||||
this.init();
|
||||
},
|
||||
onShow: function() {
|
||||
var args= plus.runtime.arguments;
|
||||
if(args){
|
||||
// 处理args参数,如直达到某新页面等
|
||||
console.log(args);
|
||||
}
|
||||
//console.log("App Show");
|
||||
// #ifdef APP
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), false);
|
||||
// #endif
|
||||
this.handleArguments();
|
||||
//console.log(this.$store.state.contact);
|
||||
},
|
||||
onHide: function() {
|
||||
@@ -28,19 +31,526 @@
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.SetAppBackgroundStatus, IMSDK.uuid(), true);
|
||||
// #endif
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeConversationList",
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentUserID",
|
||||
"storeSelfInfo",
|
||||
"storeRecvFriendApplications",
|
||||
"storeRecvGroupApplications",
|
||||
"storeHistoryMessageList",
|
||||
"storeIsSyncing",
|
||||
"storeGroupList",
|
||||
"config",
|
||||
]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions("message", ["pushNewMessage", "updateOneMessage"]),
|
||||
...mapActions("conversation", ["updateCurrentMemberInGroup"]),
|
||||
...mapActions("circle", ["getFriendCircleInfo"]),
|
||||
...mapActions("contact", [
|
||||
"updateFriendInfo",
|
||||
"pushNewFriend",
|
||||
"updateBlackInfo",
|
||||
"pushNewBlack",
|
||||
"pushNewGroup",
|
||||
"updateGroupInfo",
|
||||
"pushNewRecvFriendApplition",
|
||||
"updateRecvFriendApplition",
|
||||
"pushNewSentFriendApplition",
|
||||
"updateSentFriendApplition",
|
||||
"pushNewRecvGroupApplition",
|
||||
"updateRecvGroupApplition",
|
||||
"pushNewSentGroupApplition",
|
||||
"updateSentGroupApplition",
|
||||
]),
|
||||
init(){
|
||||
this.$store.dispatch("system/getConfig");
|
||||
const IMToken = uni.getStorageSync("IMToken");
|
||||
const IMUserID = uni.getStorageSync("IMUserID")+'';
|
||||
if (IMToken && IMUserID) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/index/launch"
|
||||
});
|
||||
// #ifdef APP
|
||||
this.tryLogin();
|
||||
// #endif
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/login/index"
|
||||
plus.navigator.closeSplashscreen();
|
||||
uni.$u.route("/pages/common/login/index");
|
||||
}
|
||||
},
|
||||
setGlobalIMlistener() {
|
||||
//console.log("setGlobalIMlistener");
|
||||
// init
|
||||
const kickHander = (message) => {
|
||||
toastWithCallback(message, () => {
|
||||
uni.removeStorage({
|
||||
key: "IMToken",
|
||||
});
|
||||
uni.removeStorage({
|
||||
key: "BusinessToken",
|
||||
});
|
||||
uni.$u.route("/pages/common/login/index");
|
||||
});
|
||||
};
|
||||
//由于 APP 管理员强制用户下线,或由于登录策略导致用户被踢下线
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnKickedOffline, (data) => {
|
||||
kickHander("您的账号在其他设备登录,请重新登陆!");
|
||||
});
|
||||
//token无效回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnUserTokenExpired, (data) => {
|
||||
kickHander("您的登录已过期,请重新登陆!");
|
||||
});
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnUserTokenInvalid, (data) => {
|
||||
kickHander("您的登录已无效,请重新登陆!");
|
||||
});
|
||||
|
||||
// sync
|
||||
//向服务器同步会话开始时的回调。
|
||||
const syncStartHandler = ({data}) => {
|
||||
this.$store.commit("user/SET_IS_SYNCING", true);
|
||||
this.$store.commit("user/SET_REINSTALL", data);
|
||||
};
|
||||
//同步中
|
||||
const syncProgressHandler = ({data}) => {
|
||||
this.$store.commit("user/SET_PROGRESS", data);
|
||||
};
|
||||
//向服务器同步会话成功时的回调。
|
||||
const syncFinishHandler = () => {
|
||||
uni.hideLoading();
|
||||
this.$store.dispatch("conversation/getConversationList");
|
||||
this.$store.dispatch("contact/getFriendList");
|
||||
this.$store.dispatch("contact/getGrouplist");
|
||||
this.$store.dispatch("conversation/getUnReadCount");
|
||||
this.$store.commit("user/SET_IS_SYNCING", false);
|
||||
};
|
||||
//向服务器同步会话失败时的回调。
|
||||
const syncFailedHandler = () => {
|
||||
uni.hideLoading();
|
||||
uni.$u.toast("同步消息失败");
|
||||
this.$store.dispatch("conversation/getConversationList");
|
||||
this.$store.dispatch("conversation/getUnReadCount");
|
||||
this.$store.commit("user/SET_IS_SYNCING", false);
|
||||
};
|
||||
//向服务器同步会话开始时的回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerStart, syncStartHandler);
|
||||
//向服务器同步会话成功时的回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerFinish, syncFinishHandler);
|
||||
//向服务器同步会话失败时的回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerFailed, syncFailedHandler);
|
||||
//同步中
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerProgress, syncProgressHandler);
|
||||
|
||||
// 当前登录用户个人信息改变时会收到此回调。
|
||||
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSelfInfoUpdated, ({data}) => {
|
||||
this.$store.commit("user/SET_SELF_INFO", {
|
||||
...this.storeSelfInfo,
|
||||
...data,
|
||||
});
|
||||
});
|
||||
|
||||
// message
|
||||
//接收到新消息时会收到此回调,回调中只会携带一条消息。
|
||||
//设置了批量消息监听setBatchMsgListener时,此回调不会触发。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessage, ({data}) =>{});
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessages, ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
data.forEach(this.handleNewMessage);
|
||||
});
|
||||
|
||||
//好友个人信息(包括备注)改变时会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendInfoChanged,({data}) => {
|
||||
console.log('friendInfoChangeHandler',data);
|
||||
uni.$emit(IMSDK.IMEvents.OnFriendInfoChanged, {data});
|
||||
this.updateFriendInfo({friendInfo: data,});
|
||||
});
|
||||
//两个用户成功建立好友关系后双方都会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendAdded, ({data}) => {
|
||||
this.pushNewFriend(data);
|
||||
});
|
||||
//某个用户的好友列表减少时会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendDeleted, ({data}) => {
|
||||
this.updateFriendInfo({
|
||||
friendInfo: data,
|
||||
isRemove: true,
|
||||
});
|
||||
});
|
||||
|
||||
// blacklist
|
||||
//某个用户的黑名单列表增加时会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnBlackAdded, ({data}) => {
|
||||
this.pushNewBlack(data);
|
||||
});
|
||||
//某个用户的黑名单列表减少时会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnBlackDeleted, ({data}) => {
|
||||
this.updateBlackInfo({
|
||||
blackInfo: data,
|
||||
isRemove: true,
|
||||
});
|
||||
});
|
||||
|
||||
// group
|
||||
const joinedGroupAddedHandler = ({data}) => {
|
||||
this.pushNewGroup(data);
|
||||
};
|
||||
const joinedGroupDeletedHandler = ({data}) => {
|
||||
this.updateGroupInfo({
|
||||
groupInfo: data,
|
||||
isRemove: true,
|
||||
});
|
||||
};
|
||||
const groupInfoChangedHandler = ({data}) => {
|
||||
this.updateGroupInfo({
|
||||
groupInfo: data,
|
||||
});
|
||||
};
|
||||
const groupMemberInfoChangedHandler = ({data}) => {
|
||||
uni.$emit(IMSDK.IMEvents.OnGroupMemberInfoChanged, {data});
|
||||
if (data.groupID === this.storeCurrentConversation?.groupID) {
|
||||
this.updateCurrentMemberInGroup(data);
|
||||
}
|
||||
};
|
||||
//用户所在群组的数量增加时(被邀请入群、入群申请被同意等),会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnJoinedGroupAdded,joinedGroupAddedHandler);
|
||||
//用户所在群组的数量减少时(主动退群、群被解散等),会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnJoinedGroupDeleted,joinedGroupDeletedHandler);
|
||||
//群组信息(头像、群名称等,也包括群主变化)改变时,该群所有群成员会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnGroupInfoChanged,groupInfoChangedHandler);
|
||||
//群成员信息改变(群昵称、头像等)后回调,该群所有群成员会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnGroupMemberInfoChanged,groupMemberInfoChangedHandler);
|
||||
|
||||
// application
|
||||
const friendApplicationNumHandler = ({data}) => {
|
||||
const isRecv = data.toUserID === this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.pushNewRecvFriendApplition(data);
|
||||
} else {
|
||||
this.pushNewSentFriendApplition(data);
|
||||
}
|
||||
};
|
||||
const friendApplicationAccessHandler = ({data}) => {
|
||||
const isRecv = data.toUserID === this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.updateRecvFriendApplition({
|
||||
application: data,
|
||||
});
|
||||
} else {
|
||||
this.updateSentFriendApplition({
|
||||
application: data,
|
||||
});
|
||||
}
|
||||
};
|
||||
const groupApplicationNumHandler = ({data}) => {
|
||||
const isRecv = data.userID !== this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.pushNewRecvGroupApplition(data);
|
||||
} else {
|
||||
this.pushNewSentGroupApplition(data);
|
||||
}
|
||||
};
|
||||
const groupApplicationAccessHandler = ({data}) => {
|
||||
const isRecv = data.userID !== this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.updateRecvGroupApplition({
|
||||
application: data,
|
||||
});
|
||||
} else {
|
||||
this.updateSentGroupApplition({
|
||||
application: data,
|
||||
});
|
||||
}
|
||||
};
|
||||
//用户发起好友申请后,申请发起者和接收者都会收到此回调,接收者可以选择同意或拒绝好友申请。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationAdded,friendApplicationNumHandler);
|
||||
//好友申请被同意时,申请发起方和接收方都会收到该回调,双方成功建立好友关系。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationAccepted,friendApplicationAccessHandler);
|
||||
//好友申请被拒绝时,申请发起方和接收方都会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationRejected,friendApplicationAccessHandler);
|
||||
//用户发起好友申请后,申请发起者和接收者都会收到此回调,接收者可以选择同意或拒绝好友申请。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationAdded,groupApplicationNumHandler);
|
||||
//好友申请被同意时,申请发起方和接收方都会收到该回调,双方成功建立好友关系。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationAccepted,groupApplicationAccessHandler);
|
||||
//好友申请被拒绝时,申请发起方和接收方都会收到该回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationRejected,groupApplicationAccessHandler);
|
||||
//群组被解散时,该群所有群成员会收到此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.OnGroupDismissed,({ data })=>{});
|
||||
//群成员增加(如用户被邀请进群),其他群成员会收到此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onGroupMemberAdded,({ data })=>{});
|
||||
//群成员增加(如用户被邀请进群),群成员减少(如群成员退群), 其他群成员会收到此回调。。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onGroupMemberDeleted,({ data })=>{});
|
||||
//收到的消息被撤回或自己发出的消息被撤回时,会收到此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onNewRecvMessageRevoked,({ data })=>{});
|
||||
//自己发出的单聊消息被对方标记为已读后,消息发送者会收到此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onRecvC2CReadReceipt,({ data })=>{});
|
||||
//自己发出的群聊消息被群成员标记为已读后,消息发送者和标记者均会收到此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onRecvGroupReadReceipt,({ data })=>{});
|
||||
//当应用在后台运行,接收到新消息时,会收到该回调,回调中只会携带一条消息。
|
||||
//设置了批量消息监听setBatchMsgListener时,此回调不会触发。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onRecvOfflineNewMessage,({ data })=>{});
|
||||
//当应用在后台运行,接收到新消息时,会收到该回调,回调中可能会携带多条消息。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnRecvOfflineNewMessages,({data})=>{
|
||||
data.forEach(this.handleOfflineNewMessages);
|
||||
});
|
||||
//已订阅用户的在线状态发生变化时,会触发此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onUserStatusChanged,({ data })=>{});
|
||||
//建立WebSocket连接失败返回后,触发此回调
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onConnectFailed,({ data })=>{});
|
||||
//建立WebSocket连接成功返回后,触发此回调
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onConnectSuccess,({ data })=>{});
|
||||
//建立WebSocket连接中,触发此回调
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onConnecting,({ data })=>{});
|
||||
//正在输入状态回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onInputStatusChanged,({ data })=>{});
|
||||
// conversation
|
||||
const totalUnreadCountChangedHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
this.$store.commit("conversation/SET_UNREAD_COUNT", data);
|
||||
};
|
||||
const newConversationHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
const result = [...data, ...this.storeConversationList];
|
||||
this.$store.commit(
|
||||
"conversation/SET_CONVERSATION_LIST",
|
||||
conversationSort(result)
|
||||
);
|
||||
};
|
||||
const conversationChangedHandler = ({data}) => {
|
||||
//console.log('conversationChangedHandler',data);
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
let filterArr = [];
|
||||
//console.log(data);
|
||||
const chids = data.map((ch) => ch.conversationID);
|
||||
filterArr = this.storeConversationList.filter((tc) => !chids.includes(tc.conversationID));
|
||||
const idx = data.findIndex((c) =>c.conversationID === this.storeCurrentConversation.conversationID);
|
||||
if (idx !== -1){
|
||||
this.$store.commit("conversation/SET_CURRENT_CONVERSATION",data[idx]);
|
||||
}
|
||||
const result = [...data, ...filterArr];
|
||||
this.$store.commit("conversation/SET_CONVERSATION_LIST",conversationSort(result));
|
||||
};
|
||||
//会话总未读发生变化时的回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnTotalUnreadMessageCountChanged,totalUnreadCountChangedHandler);
|
||||
//有新会话产生时,会收到此回调。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnNewConversation, newConversationHandler);
|
||||
//某些会话的关键信息发生变化时,会触发该回调,例如会话的未读数发生变化,会话的最后一条消息发生变化等。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConversationChanged,conversationChangedHandler);
|
||||
|
||||
},
|
||||
|
||||
async tryLogin() {
|
||||
const _this = this;
|
||||
const IMToken = uni.getStorageSync("IMToken");
|
||||
const IMUserID = uni.getStorageSync("IMUserID")+'';
|
||||
//console.log('IMToken:',IMToken);
|
||||
//console.log('IMUserID:',IMUserID);
|
||||
const path = await getDbDir();
|
||||
//console.log('path:',path);
|
||||
const IMConfig = {
|
||||
systemType: "uni-app",
|
||||
apiAddr: config.getApiUrl(), // SDK的API接口地址。如:http://xxx:10002
|
||||
wsAddr: config.getWsUrl(), // SDK的websocket地址。如: ws://xxx:10001
|
||||
dataDir: path, // 数据存储路径
|
||||
logLevel: 6,
|
||||
logFilePath: path,
|
||||
isLogStandardOutput: true,
|
||||
isExternalExtensions: false,
|
||||
};
|
||||
//console.log('IMConfig:',IMConfig);
|
||||
const flag = await IMSDK.asyncApi(IMMethods.InitSDK, IMSDK.uuid(), IMConfig);
|
||||
//console.log('flag:',flag);
|
||||
if (!flag) {
|
||||
plus.navigator.closeSplashscreen();
|
||||
console.log('初始化IMSDK失败!');
|
||||
uni.$u.toast("初始化IMSDK失败!");
|
||||
return;
|
||||
}
|
||||
|
||||
_this.setGlobalIMlistener();
|
||||
// setTimeout(()=>{
|
||||
|
||||
// },1000);
|
||||
let status;
|
||||
do{
|
||||
status = await IMSDK.asyncApi(IMSDK.IMMethods.GetLoginStatus,IMSDK.uuid());
|
||||
//console.log(status);
|
||||
}while(status == -1001);
|
||||
if (status === 3) {
|
||||
console.log('初始化status === 3失败!');
|
||||
_this.initStore();
|
||||
return;
|
||||
}
|
||||
if (status === 1) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.Login, IMSDK.uuid(), {
|
||||
userID: IMUserID,
|
||||
token: IMToken,
|
||||
})
|
||||
.then(_this.initStore)
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
uni.removeStorage({
|
||||
key: "IMToken",
|
||||
});
|
||||
uni.removeStorage({
|
||||
key: "BusinessToken",
|
||||
});
|
||||
plus.navigator.closeSplashscreen();
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
handleOfflineNewMessages(newServerMsg) {
|
||||
console.log(newServerMsg);
|
||||
console.log( getConversationContent(newServerMsg));
|
||||
uni.createPushMessage({
|
||||
title:"您的朋友发来新的消息",
|
||||
content:getConversationContent(newServerMsg),
|
||||
payload:{
|
||||
type:"msg",
|
||||
data:newServerMsg
|
||||
},
|
||||
//icon:'',
|
||||
//sound:'',
|
||||
//cover:'false',
|
||||
//delay:0,
|
||||
//when:0,//消息上显示的提示时间
|
||||
//channelId:"",
|
||||
//category:"",
|
||||
success(res){
|
||||
//console.log(res);
|
||||
},
|
||||
fail(res){
|
||||
//console.log(res);
|
||||
},
|
||||
complete(res){
|
||||
//console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleNewMessage(newServerMsg) {
|
||||
if (this.inCurrentConversation(newServerMsg)) {
|
||||
if (
|
||||
newServerMsg.contentType !== MessageType.TypingMessage &&
|
||||
newServerMsg.contentType !== MessageType.RevokeMessage
|
||||
) {
|
||||
newServerMsg.isAppend = true;
|
||||
this.pushNewMessage(newServerMsg);
|
||||
setTimeout(() => uni.$emit(PageEvents.ScrollToBottom, true));
|
||||
uni.$u.debounce(this.markConversationAsRead, 2000);
|
||||
}
|
||||
}else{
|
||||
this.handleOfflineNewMessages(newServerMsg);
|
||||
}
|
||||
},
|
||||
|
||||
inCurrentConversation(newServerMsg) {
|
||||
switch (newServerMsg.sessionType) {
|
||||
case SessionType.Single:
|
||||
return (
|
||||
newServerMsg.sendID === this.storeCurrentConversation.userID ||
|
||||
(newServerMsg.sendID === this.storeCurrentUserID &&
|
||||
newServerMsg.recvID === this.storeCurrentConversation.userID)
|
||||
);
|
||||
case SessionType.WorkingGroup:
|
||||
return newServerMsg.groupID === this.storeCurrentConversation.groupID;
|
||||
case SessionType.Notification:
|
||||
return newServerMsg.sendID === this.storeCurrentConversation.userID;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
markConversationAsRead() {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.MarkConversationMessageAsRead,
|
||||
IMSDK.uuid(),
|
||||
this.storeCurrentConversation.conversationID
|
||||
);
|
||||
},
|
||||
|
||||
initStore() {
|
||||
const _this = this;
|
||||
this.$store.dispatch("user/getSelfInfo");
|
||||
this.$store.dispatch("conversation/getConversationList");
|
||||
this.$store.dispatch("conversation/getUnReadCount");
|
||||
this.$store.dispatch("contact/getBlacklist");
|
||||
this.$store.dispatch("contact/getRecvFriendApplications");
|
||||
this.$store.dispatch("contact/getSentFriendApplications");
|
||||
this.$store.dispatch("contact/getRecvGroupApplications");
|
||||
this.$store.dispatch("contact/getSentGroupApplications");
|
||||
this.$store.dispatch("contact/getFriendList");
|
||||
this.$store.dispatch("circle/getFriendCircleInfo");
|
||||
|
||||
if(true !== this.handleArguments()){
|
||||
uni.switchTab({
|
||||
url: "/pages/conversation/conversationList/index?isRedirect=true",
|
||||
complete() {
|
||||
_this.keppAlive();
|
||||
plus.navigator.closeSplashscreen();
|
||||
_this.checkUpdate();
|
||||
},
|
||||
fail(e){
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 验证是否升级
|
||||
checkUpdate() {
|
||||
const _this = this;
|
||||
checkUpgrade();
|
||||
},
|
||||
|
||||
keppAlive(){
|
||||
// #ifdef APP-NVUE
|
||||
uni.requestPermissions(['android.permission.RECEIVE_BOOT_COMPLETED'], (result) => {
|
||||
if (result.granted) {
|
||||
console.log('权限已获得');
|
||||
} else {
|
||||
console.log('权限被拒绝');
|
||||
uni.showModal({
|
||||
title: '权限申请',
|
||||
content: '您需要授权后台运行权限才能正常使用该功能',
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
|
||||
handleArguments(){
|
||||
var args= plus.runtime.arguments;
|
||||
if(args){
|
||||
if(args.startsWith('shunliao://')){
|
||||
console.log(args);
|
||||
return ;
|
||||
}
|
||||
if(args.startsWith('{')){
|
||||
const json = JSON.parse(args);
|
||||
if(json.type == 'msg'){
|
||||
if(this.inCurrentConversation(json.data)){
|
||||
}else{
|
||||
let conversation = this.storeConversationList.find((item) => item === json.data);
|
||||
if(conversation){
|
||||
plus.navigator.closeSplashscreen();
|
||||
prepareConversationState(conversation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
// 处理args参数,如直达到某新页面等
|
||||
console.log(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,41 @@ import config from "@/common/config";
|
||||
export const businessConfig = (params) =>
|
||||
uni.$u?.http.post("/common/init", JSON.stringify(params));
|
||||
// 验证是否升级
|
||||
export const checkUpgrade = (params) =>
|
||||
uni.$u?.http.post("/common/checkUpgrade", JSON.stringify(params));
|
||||
export const checkUpgrade = (params) =>{
|
||||
const _this = this;
|
||||
return new Promise((resolve,reject)=>{
|
||||
let system = uni.getSystemInfoSync()
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
uni.$u?.http.post("/common/checkUpgrade", JSON.stringify({
|
||||
version:system.appVersion,
|
||||
platform:system.platform,
|
||||
version_wgt:inf.versionCode,
|
||||
})).then(res=>{
|
||||
console.log(res);
|
||||
if(!res || !res.version){
|
||||
return reject(true);
|
||||
}
|
||||
let skip_version = uni.getStorageSync('skip_version')
|
||||
//console.log(res.version,skip_version);
|
||||
if(res && res.version!=skip_version){
|
||||
uni.$emit('closeWebview')
|
||||
uni.setStorageSync('upgrade_model',res)
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/upgrade',
|
||||
animationType:"fade-in",
|
||||
complete(res1) {
|
||||
//console.log(res1);
|
||||
return resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
reject();
|
||||
}).catch(e=>{
|
||||
reject(e);
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
export const businessLogin = (params) =>
|
||||
uni.$u?.http.post("/common/login", JSON.stringify(params));
|
||||
export const businessSendSms = (params) =>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// const API_URL = `http://${BASE_HOST}:10002`
|
||||
// const WS_URL = `ws://${BASE_HOST}:10001`
|
||||
|
||||
const BASE_DOMAIN = 'www.axzc.xyz'
|
||||
const BASE_DOMAIN = 'www.shun777.com'
|
||||
// const CHAT_URL = `https://${BASE_DOMAIN}/chat`
|
||||
// const API_URL = `https://${BASE_DOMAIN}/api`
|
||||
// const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway`
|
||||
|
||||
@@ -44,37 +44,42 @@
|
||||
return this.isGroup ? defaultGroupIcon : defaultUserIcon;
|
||||
},
|
||||
},
|
||||
watch:{
|
||||
src(nv,ov){
|
||||
this.init(nv);
|
||||
},
|
||||
desc() {
|
||||
//this.redirectShow();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
//_this.cachesrc = plus.io.convertAbsoluteFileSystem();
|
||||
const _this = this;
|
||||
if (this.src) {
|
||||
util.cacheFile(util.cdn(this.src),'avatar').then(res=>{
|
||||
_this.avatarText=""
|
||||
_this.cachesrc = res;
|
||||
//_this.cachesrc = plus.io.convertAbsoluteFileSystem(res);
|
||||
//console.log(_this.cachesrc);
|
||||
});
|
||||
return ;
|
||||
}
|
||||
if (this.isGroup) {
|
||||
_this.cachesrc = defaultGroupIcon;
|
||||
return ;
|
||||
}
|
||||
if (this.isNotify) {
|
||||
_this.cachesrc = defaultNotifyIcon;
|
||||
return ;
|
||||
}
|
||||
this.avatarText = this.desc ? this.desc.slice(0, 1) : "未知";
|
||||
return "";
|
||||
this.init(this.src);
|
||||
},
|
||||
methods: {
|
||||
errorHandle() {
|
||||
init(nv){
|
||||
const _this = this;
|
||||
//console.log(nv);
|
||||
if (nv) {
|
||||
util.cacheFile(util.cdn(nv),'avatar').then(res=>{
|
||||
_this.avatarText=""
|
||||
_this.cachesrc = res;
|
||||
//_this.cachesrc = plus.io.convertAbsoluteFileSystem(res);
|
||||
//console.log(_this.cachesrc);
|
||||
});
|
||||
return ;
|
||||
}
|
||||
if (this.isGroup) {
|
||||
_this.cachesrc = defaultGroupIcon;
|
||||
return ;
|
||||
}
|
||||
if (this.isNotify) {
|
||||
_this.cachesrc = defaultNotifyIcon;
|
||||
return ;
|
||||
}
|
||||
this.avatarText = this.desc ? this.desc.slice(0, 1) : "未知";
|
||||
},
|
||||
redirectShow() {
|
||||
if (this.avatarText) {
|
||||
this.avatarText = undefined;
|
||||
}
|
||||
errorHandle() {
|
||||
this.avatarText = this.desc ? this.desc.slice(0, 1) : "未知";
|
||||
},
|
||||
click() {
|
||||
this.$emit("click");
|
||||
@@ -82,16 +87,7 @@
|
||||
longpress() {
|
||||
this.$emit("longpress");
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
src(nv,ov) {
|
||||
this.redirectShow();
|
||||
},
|
||||
desc() {
|
||||
this.redirectShow();
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view @click="clickItem" class="user_item">
|
||||
<view @longtap.stop.prevent="longtap" @tap="clickItem" class="user_item">
|
||||
<view v-if="checkVisible" class="check_wrap"
|
||||
:class="{ check_wrap_active: checked, check_wrap_disabled: disabled }">
|
||||
<u-icon v-show="checked" name="checkbox-mark" size="12" color="#fff" />
|
||||
@@ -8,9 +8,10 @@
|
||||
<my-avatar :src="item.faceURL" :desc="item.remark || item.nickname || item.showName"
|
||||
:isGroup="item.groupName !== undefined || isGroupConversation" size="42" />
|
||||
<view class="user_item_details">
|
||||
<text class="user_name">{{item.remark || item.nickname || item.groupName || item.showName}}</text>
|
||||
<text v-if="item.roleLevel === 100" class="user_role">群主</text>
|
||||
<text v-if="item.roleLevel === 60" class="user_role admin_role">管理员</text>
|
||||
<view class="user_name">{{item.remark || item.nickname || item.groupName || item.showName}}</view>
|
||||
<view v-if="item.roleLevel === 100" class="user_role">群主</view>
|
||||
<view v-else-if="item.roleLevel === 60" class="user_role admin_role">管理员<u-icon v-if="item.muteEndTime>0" size="24" name="volume-off"></u-icon></view>
|
||||
<view v-else class="user_role"><u-icon v-if="item.muteEndTime>0" size="24" name="volume-off"></u-icon></view>
|
||||
<!-- <view class="bottom_line" /> -->
|
||||
</view>
|
||||
|
||||
@@ -55,6 +56,9 @@
|
||||
this.$emit(this.checkVisible ? "updateCheck" : "itemClick", this.item);
|
||||
}
|
||||
},
|
||||
longtap(){
|
||||
this.$emit("longtapEvent", this.item);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -119,6 +123,8 @@
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: 24rpx;
|
||||
margin-left: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: $u-tips-color;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ export const GroupMemberListTypes = {
|
||||
Preview: "Preview",
|
||||
Transfer: "Transfer",
|
||||
Kickout: "Kickout",
|
||||
setAdmin: "setAdmin",
|
||||
Mute: "Mute",
|
||||
};
|
||||
|
||||
export const ContactChooseTypes = {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name" : "瞬聊",
|
||||
"appid" : "__UNI__E41111F",
|
||||
"description" : "一款即时聊天软件",
|
||||
"versionName" : "3.3.5",
|
||||
"versionCode" : 335,
|
||||
"versionName" : "3.3.6",
|
||||
"versionCode" : 336,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"bounce" : "none",
|
||||
@@ -11,7 +11,7 @@
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : false,
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : false,
|
||||
"delay" : 0
|
||||
@@ -54,7 +54,7 @@
|
||||
],
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
|
||||
"minSdkVersion" : 21,
|
||||
"targetSdkVersion" : 26,
|
||||
"targetSdkVersion" : 36,
|
||||
"schemes" : "shunliao"
|
||||
},
|
||||
"ios" : {
|
||||
@@ -97,7 +97,7 @@
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"version" : "2",
|
||||
"offline" : true,
|
||||
"offline" : false,
|
||||
"icons" : {
|
||||
"small" : {
|
||||
"ldpi" : "static/images/about_logo.png",
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"androidStyle" : "default",
|
||||
"androidStyle" : "common",
|
||||
"iosStyle" : "common",
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/cover/480_762.9.png",
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"pages": [
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/index/guide",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
"path": "pages/common/login/index"
|
||||
},
|
||||
{
|
||||
"path": "pages/index/launch",
|
||||
@@ -12,9 +10,11 @@
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/common/login/index"
|
||||
"path": "pages/index/guide",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/registerOrForget/index"
|
||||
@@ -277,7 +277,11 @@
|
||||
{
|
||||
"path": "pages/common/upgrade",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
"navigationStyle": "custom",
|
||||
"backgroundColor": "transparent",
|
||||
"navigationBarTextStyle": "white",
|
||||
"navigationBarTitleText": "系统更新",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -235,6 +235,7 @@
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
const _this = this;
|
||||
//console.log(this.checkedUserIDList,this.checkedGroupIDList);
|
||||
//return false;
|
||||
// if (this.activeTab) {
|
||||
@@ -262,16 +263,20 @@
|
||||
return;
|
||||
}
|
||||
if (this.type === ContactChooseTypes.Invite) {
|
||||
console.log(_this.getCheckedUserInfo,_this.groupID);
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.InviteUserToGroup, IMSDK.uuid(), {
|
||||
groupID: this.groupID,
|
||||
groupID: _this.groupID,
|
||||
reason: "",
|
||||
userIDList: this.getCheckedUserInfo.map((user) => user.userID),
|
||||
userIDList: _this.getCheckedUserInfo.map((user) => user.userID),
|
||||
})
|
||||
.then(() => {
|
||||
toastWithCallback("操作成功", () => uni.navigateBack());
|
||||
this.comfirmLoading = false;
|
||||
_this.comfirmLoading = false;
|
||||
})
|
||||
.catch(() => toastWithCallback("操作失败"));
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
toastWithCallback("操作失败")
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
console.log(friend.nickname);
|
||||
return friend.nickname.indexOf(this.keyword) !==-1 || friend?.remark.indexOf(this.keyword) !==-1
|
||||
}
|
||||
),
|
||||
],
|
||||
|
||||
@@ -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>
|
||||
@@ -158,37 +157,35 @@ export default {
|
||||
});
|
||||
},
|
||||
async startLogin() {
|
||||
this.$refs.loginForm.validate().then(async (valid) => {
|
||||
this.loading = true;
|
||||
this.saveLoginInfo();
|
||||
let data = {};
|
||||
try {
|
||||
data = await businessLogin({
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os(),
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const { imToken, userID } = data;
|
||||
this.saveLoginProfile(data);
|
||||
this.$store.commit("user/SET_AUTH_DATA", data);
|
||||
this.loginInfo.password = "";
|
||||
// #ifdef APP
|
||||
// await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
// userID,
|
||||
// token: imToken,
|
||||
// });
|
||||
plus.runtime.restart();
|
||||
// #endif
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.$u.toast(checkLoginError(err));
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
this.loading = true;
|
||||
this.saveLoginInfo();
|
||||
let data = {};
|
||||
try {
|
||||
data = await businessLogin({
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os(),
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const { imToken, userID } = data;
|
||||
this.saveLoginProfile(data);
|
||||
this.$store.commit("user/SET_AUTH_DATA", data);
|
||||
this.loginInfo.password = "";
|
||||
// #ifdef APP
|
||||
// await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
// userID,
|
||||
// token: imToken,
|
||||
// });
|
||||
plus.runtime.restart();
|
||||
// #endif
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
uni.$u.toast(checkLoginError(err));
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
saveLoginProfile(data) {
|
||||
const { imToken, token, userID } = data;
|
||||
@@ -220,12 +217,13 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
const options = {
|
||||
phoneNumber: this.loginInfo.phoneNumber,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
usedFor: SmsUserFor.Login,
|
||||
operationID: Date.now() + "",
|
||||
};
|
||||
const options = {
|
||||
mobile: this.loginInfo.phoneNumber,
|
||||
email: this.loginInfo.email,
|
||||
region: `+${this.loginInfo.region}`,
|
||||
event: "login",
|
||||
type:"mobile"
|
||||
};
|
||||
businessSendSms(options)
|
||||
.then(() => {
|
||||
uni.$u.toast("验证码已发送!");
|
||||
@@ -275,6 +273,7 @@ export default {
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
border-radius: 32rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<view class="set_password_container content_with_back">
|
||||
<view class="title">重置密码</view>
|
||||
<u-form class="loginForm commonPage-form" labelPosition="top" :model="formData" :rules="rules" :labelStyle="{
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}" ref="loginForm">
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}" ref="loginForm">
|
||||
<u-form-item label="密码" prop="password">
|
||||
<u-input v-model="formData.password" border="surround" placeholder="请输入密码" :password="!passwordEying">
|
||||
<u-icon @click="updateEye('passwordEying')" slot="suffix"
|
||||
@@ -60,7 +60,7 @@
|
||||
validator: (rule, value, callback) => {
|
||||
return value.length >= 6;
|
||||
},
|
||||
message: "密码太短",
|
||||
message: "密码太过于简单",
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<view class="set_info_container content_with_back">
|
||||
<view class="title">设置信息</view>
|
||||
<u-form class="loginForm commonPage-form" labelPosition="top" :model="userInfo" :rules="rules" :labelStyle="{
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}" ref="loginForm">
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
minWidth: '200rpx',
|
||||
}" ref="loginForm">
|
||||
<u-form-item label="昵称" prop="nickname">
|
||||
<u-input v-model="userInfo.nickname" border="surround" placeholder="请输入您的昵称" clearable>
|
||||
</u-input>
|
||||
@@ -37,8 +37,8 @@
|
||||
import md5 from "md5";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import { mapGetters } from "vuex";
|
||||
import { businessRegister } from "@/api/login";
|
||||
import { checkLoginError } from "@/util/common";
|
||||
import {businessRegister} from "@/api/login";
|
||||
import {checkLoginError } from "@/util/common";
|
||||
import util from "@/util/index.js"
|
||||
export default {
|
||||
components: {
|
||||
@@ -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;
|
||||
this.userInfo = {
|
||||
...this.userInfo,
|
||||
...util.aesdecode(userInfo),
|
||||
};
|
||||
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,37 +132,46 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
async doRegister() {
|
||||
this.loading = true;
|
||||
const options = {
|
||||
code: this.codeValue,
|
||||
platform: uni.$u.os(),
|
||||
autoLogin: true,
|
||||
...this.userInfo,
|
||||
region: `+${this.userInfo.region}`,
|
||||
password: md5(this.userInfo.password),
|
||||
mobile: this.userInfo.mobile
|
||||
};
|
||||
try {
|
||||
await businessRegister(options);
|
||||
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);
|
||||
uni.$u.route("/pages/common/verifyCode/index", {
|
||||
userInfo: s,
|
||||
isRegister: true,
|
||||
resend: 1,
|
||||
})
|
||||
return ;
|
||||
doRegister() {
|
||||
const _this = this;
|
||||
this.$refs.loginForm.validate().then(async (res) => {
|
||||
_this.loading = true;
|
||||
console.log(res);
|
||||
const options = {
|
||||
code: _this.codeValue,
|
||||
platform: uni.$u.os(),
|
||||
autoLogin: true,
|
||||
..._this.userInfo,
|
||||
region: `+${_this.userInfo.region}`,
|
||||
password: md5(_this.userInfo.password),
|
||||
mobile: _this.userInfo.mobile
|
||||
};
|
||||
try {
|
||||
await businessRegister(options);
|
||||
_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);
|
||||
uni.$u.route("/pages/common/verifyCode/index", {
|
||||
userInfo: s,
|
||||
isRegister: true,
|
||||
resend: 1,
|
||||
})
|
||||
return ;
|
||||
}
|
||||
// uni.$u.toast('注册失败')
|
||||
} finally {
|
||||
_this.loading = false;
|
||||
}
|
||||
// uni.$u.toast('注册失败')
|
||||
} finally {
|
||||
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%);
|
||||
|
||||
@@ -1,24 +1,32 @@
|
||||
<template>
|
||||
<view class="m-shade n-flex-1 n-align-center n-justify-center">
|
||||
<view :style="{width:'580rpx'}">
|
||||
<image src="/static/image/upgrade.png" mode="widthFix"></image>
|
||||
<view class="n-ps-all-ll n-ms-top-ll n-position-absolute">
|
||||
<text class="n-size-mm n-weight-7 n-color-inverse">发现新版本</text>
|
||||
<text class="n-size-base n-ms-top-ss n-color-inverse">V{{model.version}}</text>
|
||||
</view>
|
||||
<view class="n-ps-all-l n-radius-lb-base" :style="{backgroundColor:'#f3f3f3',borderRadius:'0 0 16rpx 16rpx'}">
|
||||
<view :style="{height:'300rpx'}">
|
||||
<scroll-view class="n-flex-1" :show-scrollbar="false" scroll-y>
|
||||
<rich-text class="n-size-s" :nodes="model.content" :style="{lineHeight:'26rpx'}"></rich-text>
|
||||
</scroll-view>
|
||||
<view class="upgrade_page">
|
||||
<uni-nav-bar left-icon="back"
|
||||
@clickLeft="back"
|
||||
title="系统更新"
|
||||
backgroundColor="#FFF"
|
||||
fixed
|
||||
statusBar>
|
||||
</uni-nav-bar>
|
||||
|
||||
<view style="flex:1;display: flex;align-items: center;justify-content: center;">
|
||||
<view :style="{width:'580rpx',position:'relative'}">
|
||||
<image src="/static/images/upgrade.png" :style="{width:'580rpx'}" mode="widthFix"></image>
|
||||
<view class="version_info">
|
||||
<text class="title">发现新版本</text>
|
||||
<text class="code">V{{model.version}}</text>
|
||||
</view>
|
||||
<view class="n-height-base n-justify-center">
|
||||
<view v-if="progress">
|
||||
<uv-line-progress :percentage="value" activeColor="#fc3463"></uv-line-progress>
|
||||
</view>
|
||||
<view class="n-flex-row" v-else>
|
||||
<uv-button class="n-flex-1 n-ms-right-ll" v-if="model.force==0" @click="cancel" :customStyle="{backgroundColor:'#f3f3f3'}" text="暂不更新" color="#fc3463" shape="circle" throttleTime="1000" plain></uv-button>
|
||||
<uv-button class="n-flex-1" @click="upgrade" text="立即更新" color="#fc3463" shape="circle" throttleTime="1000"></uv-button>
|
||||
<view class="detail">
|
||||
<scroll-view :show-scrollbar="false" scroll-y>
|
||||
<rich-text :nodes="model.content"></rich-text>
|
||||
</scroll-view>
|
||||
<view class="footer">
|
||||
<view v-if="progress">
|
||||
<u-line-progress :percentage="value" activeColor="#fc3463"></u-line-progress>
|
||||
</view>
|
||||
<view class="buttons" v-else>
|
||||
<u-button v-if="model.force==0" @click="cancel" :customStyle="{backgroundColor:'#f3f3f3'}" text="暂不更新" color="#fc3463" shape="circle" throttleTime="1000" plain></u-button>
|
||||
<u-button @click="upgrade" text="立即更新" color="#fc3463" shape="circle" throttleTime="1000"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -27,7 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import util from "@/util/index.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -42,9 +50,23 @@
|
||||
}
|
||||
},
|
||||
onLoad(evt) {
|
||||
if(evt.model){
|
||||
this.model = {...this.model, ...JSON.parse(evt.model)}
|
||||
// if(evt.model){
|
||||
// this.model = {...this.model, ...JSON.parse(evt.model)}
|
||||
// }
|
||||
var model = uni.getStorageSync('upgrade_model');
|
||||
console.log(model);
|
||||
if(model){
|
||||
this.model = {...this.model, ...model};
|
||||
}
|
||||
// this.model = {
|
||||
// "id": 1,
|
||||
// "type": 1,
|
||||
// "force": 1,
|
||||
// "source": "https://shunliao.oss-accelerate.aliyuncs.com/files/150016c51d8672fde3d1cc6945a95089_695d97b6c0162.wgt",
|
||||
// "version": "3.3.6",
|
||||
// "content": "修复了一些bug",
|
||||
// "source_text": null
|
||||
// };
|
||||
},
|
||||
onBackPress() {
|
||||
if(this.model.force==1){
|
||||
@@ -52,6 +74,11 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
if(this.model.force!=1){
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
// 取消更新
|
||||
cancel() {
|
||||
uni.navigateBack()
|
||||
@@ -80,17 +107,14 @@
|
||||
// 防止强制更新无法关闭界面
|
||||
this.model.force = 0
|
||||
if(this.model.type==1){
|
||||
uni.showToast({
|
||||
title:'更新成功,软件重启'
|
||||
})
|
||||
util.showToast('更新成功,软件重启')
|
||||
setTimeout(()=>{ plus.runtime.restart() }, 1500)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: error=>{
|
||||
uni.showToast({
|
||||
title:'下载失败,请检查您的网络情况'
|
||||
})
|
||||
util.showToast('下载失败,请检查您的网络情况')
|
||||
this.model.force = 0;
|
||||
}
|
||||
})
|
||||
// 监听下载进度
|
||||
@@ -103,8 +127,54 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.m-shade{
|
||||
<style lang="scss" scoped>
|
||||
.upgrade_page{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
.version_info{
|
||||
position: absolute;
|
||||
top:120rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
margin-left: 20rpx;
|
||||
width: 100%;
|
||||
.title{
|
||||
color: #fff;
|
||||
}
|
||||
.code{
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.detail{
|
||||
margin-top: -10rpx;
|
||||
background-color:#f3f3f3;
|
||||
border-radius:0 0 16rpx 16rpx;
|
||||
padding: 10rpx 20rpx 30rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
scroll-view{
|
||||
flex: 1;
|
||||
min-height: 300rpx;
|
||||
rich-text{
|
||||
font-size:32rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
.footer{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 20rpx;
|
||||
.buttons{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,157 +1,135 @@
|
||||
<template>
|
||||
<view class="group_list_container">
|
||||
<custom-nav-bar title="我的群组">
|
||||
<view class="group_list_container">
|
||||
<custom-nav-bar title="我的群组"></custom-nav-bar>
|
||||
<view class="search_bar_wrap">
|
||||
<u-search class="search_bar" shape="square" placeholder="搜索" disabled :showAction="false" />
|
||||
</view>
|
||||
|
||||
</custom-nav-bar>
|
||||
<view class="search_bar_wrap">
|
||||
<u-search
|
||||
class="search_bar"
|
||||
shape="square"
|
||||
placeholder="搜索"
|
||||
disabled
|
||||
:showAction="false"
|
||||
/>
|
||||
</view>
|
||||
<u-tabs :scrollable="false" :list="tabList" @click="clickTab"></u-tabs>
|
||||
|
||||
<u-tabs :scrollable="false" :list="tabList" @click="clickTab"></u-tabs>
|
||||
<view class="pane_row" :style="{ transform: `translateX(${isMyCreate ? '0' : '-100%'})` }">
|
||||
<view class="pane_content">
|
||||
<u-list v-if="getMyCreateGroupList.length > 0" class="group_list" :height="`${getListHeight}px`">
|
||||
<u-list-item v-for="group in getMyCreateGroupList" :key="group.groupID">
|
||||
<group-item :groupInfo="group" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
<u-empty v-else mode="list" />
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="pane_row"
|
||||
:style="{ transform: `translateX(${isMyCreate ? '0' : '-100%'})` }"
|
||||
>
|
||||
<view class="pane_content">
|
||||
<u-list
|
||||
v-if="getMyCreateGroupList.length > 0"
|
||||
class="group_list"
|
||||
:height="`${getListHeight}px`"
|
||||
>
|
||||
<u-list-item
|
||||
v-for="group in getMyCreateGroupList"
|
||||
:key="group.groupID"
|
||||
>
|
||||
<group-item :groupInfo="group" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
<u-empty v-else mode="list" />
|
||||
</view>
|
||||
|
||||
<view class="pane_content">
|
||||
<u-list
|
||||
v-if="getMyJoinedGroupList.length > 0"
|
||||
class="group_list"
|
||||
:height="`${getListHeight}px`"
|
||||
>
|
||||
<u-list-item
|
||||
v-for="group in getMyJoinedGroupList"
|
||||
:key="group.groupID"
|
||||
>
|
||||
<group-item :groupInfo="group" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
<u-empty v-else mode="list" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pane_content">
|
||||
<u-list v-if="getMyJoinedGroupList.length > 0" class="group_list" :height="`${getListHeight}px`">
|
||||
<u-list-item v-for="group in getMyJoinedGroupList" :key="group.groupID">
|
||||
<group-item :groupInfo="group" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
<u-empty v-else mode="list" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import GroupItem from "./GroupItem.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
GroupItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
tabList: [
|
||||
{
|
||||
name: "我创建的",
|
||||
},
|
||||
{
|
||||
name: "我加入的",
|
||||
},
|
||||
],
|
||||
isMyCreate: true,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeGroupList", "storeCurrentUserID"]),
|
||||
getMyCreateGroupList() {
|
||||
return this.storeGroupList.filter(
|
||||
(group) => group.ownerUserID === this.storeCurrentUserID,
|
||||
);
|
||||
},
|
||||
getListHeight() {
|
||||
const statusBar = uni.getWindowInfo().statusBarHeight;
|
||||
const searchBar = 58;
|
||||
const tabAndNavBar = 44 * 2;
|
||||
const titleBar = 32;
|
||||
return (
|
||||
uni.getWindowInfo().safeArea.height -
|
||||
statusBar -
|
||||
searchBar -
|
||||
tabAndNavBar -
|
||||
titleBar
|
||||
);
|
||||
},
|
||||
getMyJoinedGroupList() {
|
||||
// console.log(this.storeGroupList.filter(group => group.ownerUserID !== this.storeCurrentUserID));
|
||||
return this.storeGroupList.filter(
|
||||
(group) => group.ownerUserID !== this.storeCurrentUserID,
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clickTab({ index }) {
|
||||
this.isMyCreate = index === 0;
|
||||
},
|
||||
toCreateGroup() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import GroupItem from "./GroupItem.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
GroupItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
tabList: [{
|
||||
name: "我创建的",
|
||||
},
|
||||
{
|
||||
name: "我加入的",
|
||||
},
|
||||
],
|
||||
isMyCreate: true,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeGroupList", "storeCurrentUserID"]),
|
||||
getMyCreateGroupList() {
|
||||
return this.storeGroupList.filter(
|
||||
(group) => group.ownerUserID === this.storeCurrentUserID,
|
||||
);
|
||||
},
|
||||
getListHeight() {
|
||||
const statusBar = uni.getWindowInfo().statusBarHeight;
|
||||
const searchBar = 58;
|
||||
const tabAndNavBar = 44 * 2;
|
||||
const titleBar = 32;
|
||||
return (
|
||||
uni.getWindowInfo().safeArea.height -
|
||||
statusBar -
|
||||
searchBar -
|
||||
tabAndNavBar -
|
||||
titleBar
|
||||
);
|
||||
},
|
||||
getMyJoinedGroupList() {
|
||||
//console.log(this.storeGroupList);
|
||||
return this.storeGroupList.filter(
|
||||
(group) => group.ownerUserID !== this.storeCurrentUserID,
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clickTab({
|
||||
index
|
||||
}) {
|
||||
this.isMyCreate = index === 0;
|
||||
},
|
||||
toCreateGroup() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.group_list_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
.group_list_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
|
||||
.nav_right_action {
|
||||
padding-right: 44rpx;
|
||||
}
|
||||
.nav_right_action {
|
||||
padding-right: 44rpx;
|
||||
}
|
||||
|
||||
.search_bar_wrap {
|
||||
height: 34px;
|
||||
padding: 12px 22px;
|
||||
}
|
||||
.search_bar_wrap {
|
||||
height: 34px;
|
||||
padding: 12px 22px;
|
||||
}
|
||||
|
||||
.pane_row {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
transition: all 0.3s ease 0s !important;
|
||||
border-top: 2rpx solid #e8eaef;
|
||||
// overflow-x: hidden;
|
||||
.pane_row {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
transition: all 0.3s ease 0s !important;
|
||||
border-top: 2rpx solid #e8eaef;
|
||||
// overflow-x: hidden;
|
||||
|
||||
.pane_content {
|
||||
@include colBox(false);
|
||||
height: 100%;
|
||||
flex: 0 0 100%;
|
||||
.pane_content {
|
||||
@include colBox(false);
|
||||
height: 100%;
|
||||
flex: 0 0 100%;
|
||||
|
||||
.pane_title {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
padding: 6px 22px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.pane_title {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
padding: 6px 22px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-if="storeCurrentMemberInGroup.muteEndTime===0">
|
||||
<view class="chat_footer">
|
||||
<!-- 语音信息 -->
|
||||
<image class="action_btn" v-show="inputType == 'keyboard'" @click.prevent="swtichInputType('record')" mode="heightFix" src="@/static/images/chating_footer_audio.png" alt="" srcset="" />
|
||||
@@ -43,12 +43,17 @@
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="forbidden_footer">
|
||||
<view class="mute_tip">您被禁言至{{date(storeCurrentMemberInGroup.muteEndTime)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters,mapActions} from "vuex";
|
||||
import {getPurePath,html2Text,getVideoCover,getVideoInfo} from "@/util/common";
|
||||
import {offlinePushInfo} from "@/util/imCommon";
|
||||
import {offlinePushInfo,date} from "@/util/imCommon";
|
||||
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
|
||||
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
|
||||
import CustomEditor from "./CustomEditor";
|
||||
@@ -101,7 +106,8 @@
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentGroup",
|
||||
"storeBlackList",
|
||||
"storeCurrentUserID"
|
||||
"storeCurrentUserID",
|
||||
"storeCurrentMemberInGroup"
|
||||
]),
|
||||
hasContent() {
|
||||
return html2Text(this.inputHtml) !== "";
|
||||
@@ -113,6 +119,8 @@
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.storeCurrentGroup)
|
||||
console.log(this.storeCurrentMemberInGroup)
|
||||
this.setKeyboardListener();
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -120,6 +128,7 @@
|
||||
},
|
||||
methods: {
|
||||
...mapActions("message", ["pushNewMessage", "updateOneMessage"]),
|
||||
date,
|
||||
async createTextMessage() {
|
||||
let message = "";
|
||||
const text = html2Text(this.inputHtml);
|
||||
@@ -510,6 +519,9 @@
|
||||
max-height: 120px;
|
||||
padding: 10rpx 20rpx;
|
||||
gap: 20rpx;
|
||||
.mute_tip{
|
||||
|
||||
}
|
||||
|
||||
.input_content {
|
||||
flex: 1;
|
||||
|
||||
@@ -8,9 +8,16 @@
|
||||
export default {
|
||||
name: "ErrorMessagegRender",
|
||||
components: {},
|
||||
props: {
|
||||
message: Object,
|
||||
conversationID:String,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
created(){
|
||||
console.log(this.message);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
conversationID:String,
|
||||
},
|
||||
data() {
|
||||
console.log(this.message);
|
||||
//console.log(this.message);
|
||||
return {
|
||||
loadingWidth: "120px",
|
||||
src:"",
|
||||
@@ -64,7 +64,7 @@
|
||||
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
|
||||
self.coverDownloading = false;
|
||||
self.src = fn;
|
||||
console.log(fn);
|
||||
//console.log(fn);
|
||||
});
|
||||
},
|
||||
clickMediaItem() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="text_message_container bg_container">
|
||||
<u-parse :content="getContent" :previewImg="false" :showImgMenu="false" selectable></u-parse>
|
||||
<u-parse :content="getContent" :previewImg="false" :showImgMenu="false"></u-parse>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -117,10 +117,10 @@
|
||||
methods: {
|
||||
async init(){
|
||||
const self = this;
|
||||
console.log(this.message?.videoElem);
|
||||
const snapshotUrl = this.message?.videoElem?.snapshotPath || this.message?.videoElem?.snapshotUrl;
|
||||
//console.log(this.message?.videoElem);
|
||||
const snapshotUrl = this.message?.videoElem?.snapshotUrl;
|
||||
self.coverDownloading = true;
|
||||
console.log(snapshotUrl);
|
||||
//console.log(snapshotUrl);
|
||||
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
|
||||
self.coverDownloading = false;
|
||||
self.src = fn;
|
||||
|
||||
@@ -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,26 +164,30 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const MsgType2Components = {
|
||||
['type_'+MessageType.TextMessage] : "TextMessageRender",
|
||||
['type_'+MessageType.PictureMessage] : "PictureMessageRender",
|
||||
['type_'+MessageType.VoiceMessage] : "VoiceMessageRender",
|
||||
['type_'+MessageType.VideoMessage] : "VideoMessageRender",
|
||||
['type_'+MessageType.FileMessage] : "FileMessageRender",
|
||||
['type_'+MessageType.AtTextMessage] : "AtTextMessageRender",
|
||||
['type_'+MessageType.MergeMessage] : "MergeMessageRender",
|
||||
['type_'+MessageType.CardMessage] : "CardMessageRender",
|
||||
['type_'+MessageType.LocationMessage] : "LocationMessageRender",
|
||||
['type_'+MessageType.CustomMessage] : "CustomMessageRender",
|
||||
['type_'+MessageType.TypingMessage] : "TypingMessageRender",
|
||||
['type_'+MessageType.QuoteMessage] : "QuoteMessageRender",
|
||||
['type_'+MessageType.FaceMessage] : "FaceMessageRender",
|
||||
['type_'+MessageType.MarkdownMessage] : "MarkdownMessageRender",
|
||||
['type_'+MessageType.StreamMessage] : "StreamMessageRender",
|
||||
['type_'+MessageType.OANotification] : "OANotificationRender",
|
||||
'type_2001' : "NotificationRender"
|
||||
};
|
||||
this.component = MsgType2Components['type_'+this.source.contentType] || "ErrorMessageRender";
|
||||
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",
|
||||
['type_'+MessageType.VoiceMessage] : "VoiceMessageRender",
|
||||
['type_'+MessageType.VideoMessage] : "VideoMessageRender",
|
||||
['type_'+MessageType.FileMessage] : "FileMessageRender",
|
||||
['type_'+MessageType.AtTextMessage] : "AtTextMessageRender",
|
||||
['type_'+MessageType.MergeMessage] : "MergeMessageRender",
|
||||
['type_'+MessageType.CardMessage] : "CardMessageRender",
|
||||
['type_'+MessageType.LocationMessage] : "LocationMessageRender",
|
||||
['type_'+MessageType.CustomMessage] : "CustomMessageRender",
|
||||
['type_'+MessageType.TypingMessage] : "TypingMessageRender",
|
||||
['type_'+MessageType.QuoteMessage] : "QuoteMessageRender",
|
||||
['type_'+MessageType.FaceMessage] : "FaceMessageRender",
|
||||
['type_'+MessageType.MarkdownMessage] : "MarkdownMessageRender",
|
||||
['type_'+MessageType.StreamMessage] : "StreamMessageRender",
|
||||
['type_'+MessageType.OANotification] : "OANotificationRender",
|
||||
'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;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
import SelectHeader from "./components/SelectHeader";
|
||||
import SelectFooter from "./components/SelectFooter";
|
||||
import {markConversationAsRead} from "@/util/imCommon";
|
||||
import IMSDK, {MessageType} from "openim-uniapp-polyfill";
|
||||
import IMSDK, {MessageType,GroupMemberRole} from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
components: {
|
||||
ChatingHeader,
|
||||
@@ -50,8 +50,20 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeCurrentConversation","storeCurrentMsg",'storeCurrentMsgID'
|
||||
"storeHistoryMessageList",
|
||||
"storeCurrentUserID",
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentMsg",
|
||||
'storeCurrentMsgID',
|
||||
"storeCurrentGroup",
|
||||
"storeCurrentMemberInGroup"
|
||||
]),
|
||||
isOwner() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Owner;
|
||||
},
|
||||
isAdmin() {
|
||||
return this.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.Audio = uni.createInnerAudioContext(); //音频
|
||||
@@ -91,8 +103,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);
|
||||
@@ -163,7 +184,7 @@
|
||||
this.onUserMessageEvent({type: 'cancelSelect'});
|
||||
},
|
||||
async doForwarMsg(userList, groupList, msgiem)
|
||||
{
|
||||
{b
|
||||
//console.log(userList,groupList);
|
||||
const _this = this;
|
||||
for (var i = 0; i < userList.length; i++) {
|
||||
@@ -215,24 +236,19 @@
|
||||
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];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (e.type == 'deleteMsg') {
|
||||
if (e.type == 'deleteMsg' || e.type == 'deleteServerMsg') {
|
||||
let method = IMSDK.IMMethods.DeleteMessageFromLocalStorage;
|
||||
if(e.type == 'deleteServerMsg'){
|
||||
method = IMSDK.IMMethods.DeleteMessage
|
||||
}
|
||||
let deleteMsgs = [];
|
||||
if (!data) {
|
||||
deleteMsgs = [...this.selectItems];
|
||||
@@ -241,16 +257,10 @@
|
||||
}
|
||||
for (let i = 0; i < deleteMsgs.length; i++) {
|
||||
let element = deleteMsgs[i];
|
||||
IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
|
||||
IMSDK.asyncApi(method, IMSDK.uuid(), {
|
||||
conversationID: _this.storeCurrentConversation.conversationID,
|
||||
clientMsgID: element.clientMsgID
|
||||
}).then(res => {
|
||||
//console.log(res);
|
||||
}).catch(res => {
|
||||
//console.log(res);
|
||||
}).finally(() => {
|
||||
//console.log(arguments);
|
||||
})
|
||||
});
|
||||
}
|
||||
this.selectItems = [];
|
||||
this.$refs.chatingListRef.loadMessageList();
|
||||
@@ -300,7 +310,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(() => {
|
||||
@@ -308,7 +322,7 @@
|
||||
})
|
||||
return;
|
||||
}
|
||||
if(e.type == 'audio_msg_click'){
|
||||
if (e.type == 'audio_msg_click'){
|
||||
if(_this.storeCurrentMsgID){
|
||||
_this.updateCurrentMsg({clientMsgID:""});
|
||||
}else{
|
||||
@@ -327,9 +341,12 @@
|
||||
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('撤回')
|
||||
}
|
||||
if(_this.isAdmin | _this.isOwner){
|
||||
menu.push('删除(管理员功能)')
|
||||
}
|
||||
uni.showActionSheet({
|
||||
itemList: menu,
|
||||
success({tapIndex}) {
|
||||
@@ -369,6 +386,9 @@
|
||||
case "删除":
|
||||
_this.onUserMessageEvent({type: 'deleteMsg'}, data);
|
||||
break;
|
||||
case "删除(管理员功能)":
|
||||
_this.onUserMessageEvent({type: 'deleteServerMsg'}, data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<uni-icons size="24" color="#FFF" type="personadd"></uni-icons>
|
||||
<text>添加好友</text>
|
||||
</view>
|
||||
<view @click="clickMenu({name:'createGroup'})" class="menu_item">
|
||||
<view @click="clickMenu({name:'scan'})" class="menu_item">
|
||||
<uni-icons size="24" color="#FFF" type="scan"></uni-icons>
|
||||
<text>扫一扫</text>
|
||||
</view>
|
||||
@@ -191,6 +191,45 @@
|
||||
padding: 0 24rpx 10rpx;
|
||||
//margin-top: var(--status-bar-height);
|
||||
background: #f4f4f4;
|
||||
.status_notice{
|
||||
.err-tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 44rpx;
|
||||
background: #ffe1dd;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #ff381f;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.self_info {
|
||||
@include btwBox();
|
||||
@@ -216,46 +255,6 @@
|
||||
max-width: 240rpx;
|
||||
}
|
||||
|
||||
.err-tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #ffe1dd;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #ff381f;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
|
||||
.online_state {
|
||||
@include vCenterBox();
|
||||
margin-left: 24rpx;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<template>
|
||||
<view @longtap.prevent="longtapConversationItem" @tap.prevent="clickConversationItem" :class="['conversation_item',source.isPinned?'pinned' : '']">
|
||||
<view class="left_info">
|
||||
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName" size="46" />
|
||||
<view class="avatar">
|
||||
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName" size="46" />
|
||||
<u-badge max="99" :value="source.unreadCount"></u-badge>
|
||||
</view>
|
||||
<view class="details">
|
||||
<view class="title">
|
||||
<text class="conversation_name">
|
||||
@@ -9,7 +12,6 @@
|
||||
</text>
|
||||
<view class="right_desc">
|
||||
<text class="send_time">{{ latestMessageTime }}</text>
|
||||
<u-badge max="99" :value="source.unreadCount"></u-badge>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lastest_msg_wrap">
|
||||
@@ -101,7 +103,14 @@
|
||||
box-sizing: border-box;
|
||||
padding: 12rpx 44rpx 20rpx;
|
||||
flex:1;
|
||||
|
||||
.avatar{
|
||||
position: relative;
|
||||
.u-badge{
|
||||
position: absolute;
|
||||
right: -6rpx;
|
||||
top: -6rpx;
|
||||
}
|
||||
}
|
||||
.details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -161,5 +170,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -1,11 +1,22 @@
|
||||
<template>
|
||||
<view class="conversation_container">
|
||||
<chat-header ref="chatHeaderRef" />
|
||||
<scroll-view class="scroll-view" scroll-y="true" refresher-enabled="true" :refresher-triggered="triggered"
|
||||
:scroll-top="scrollTop" :scroll-with-animation="true" @scroll="scroll" @refresherrefresh="onRefresh"
|
||||
@refresherrestore="onRestore" @scrolltolower="scrolltolower">
|
||||
<scroll-view class="scroll-view"
|
||||
scroll-y="true"
|
||||
refresher-enabled="true"
|
||||
:refresher-triggered="triggered"
|
||||
:scroll-top="scrollTop"
|
||||
:scroll-with-animation="true"
|
||||
@scroll="scroll"
|
||||
@refresherrefresh="onRefresh"
|
||||
@refresherrestore="onRestore"
|
||||
@scrolltolower="scrolltolower">
|
||||
<uni-swipe-action ref="swipe_action">
|
||||
<uni-swipe-action-item :right-options="swipe_actions" @click="actionClick($event,item)" v-for="item in storeConversationList" :key="item.conversationID" >
|
||||
<uni-swipe-action-item
|
||||
:right-options="swipe_actions"
|
||||
@click="actionClick($event,item)"
|
||||
v-for="item in storeConversationList"
|
||||
:key="item.conversationID" >
|
||||
<conversation-item @longtapEvent="showExtendMenu(item)" :source="item"/>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
@@ -78,7 +89,7 @@
|
||||
// uni.navigateTo({
|
||||
// url:"/pages/user/vip/vip"
|
||||
// });
|
||||
//prepareConversationState(this.storeConversationList[2]);
|
||||
prepareConversationState(this.storeConversationList[0]);
|
||||
},1000)
|
||||
},
|
||||
methods: {
|
||||
@@ -178,7 +189,9 @@
|
||||
this.queryList();
|
||||
},
|
||||
async queryList(isFirstPage = false) {
|
||||
//console.log(1);
|
||||
await this.$store.dispatch("conversation/getConversationList",isFirstPage);
|
||||
//console.log(2);
|
||||
this.triggered = false;
|
||||
this._freshing = false;
|
||||
},
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
<u-navbar :autoBack="true" bgColor="#ECECEC" title="群管理" safeAreaInsetTop placeholder fixed></u-navbar>
|
||||
<uni-list>
|
||||
<uni-list-item title="群主管理权转让" @click="toTransfer" showArrow clickable></uni-list-item>
|
||||
<uni-list-item title="设置管理员" @click="setAdmin" showArrow clickable></uni-list-item>
|
||||
<uni-list-item title="进群验证" @switchChange="updateGroupInfo('needVerification',storeCurrentGroup.needVerification==1 ? 2: 1)" showSwitch :switchChecked="!(storeCurrentGroup.needVerification != 1)"></uni-list-item>
|
||||
<!-- <uni-list-item title="进群验证" :rightText="verifyTypeText" @click="changeVerify" clickable></uni-list-item> -->
|
||||
<uni-list-item title="允许查看成员资料" @switchChange="updateGroupInfo('lookMemberInfo',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item>
|
||||
<uni-list-item title="允许群内添加好友" @switchChange="updateGroupInfo('applyMemberFriend',storeCurrentGroup.applyMemberFriend == 1 ? 0 : 1)" showSwitch :switchChecked="storeCurrentGroup.applyMemberFriend==0"></uni-list-item>
|
||||
<uni-list-item :title="isMute ? '解除禁言':'全员禁言'" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item>
|
||||
<uni-list-item title="全员禁言" @switchChange="updateMute" showSwitch :switchChecked="isMute"></uni-list-item>
|
||||
|
||||
</uni-list>
|
||||
</view>
|
||||
@@ -28,8 +30,19 @@
|
||||
"storeCurrentMemberInGroup",
|
||||
"storeCurrentGroup",
|
||||
]),
|
||||
verifyTypeText(){
|
||||
if(this.storeCurrentGroup.needVerification === 0){
|
||||
return '0'
|
||||
}
|
||||
if(this.storeCurrentGroup.needVerification === 1){
|
||||
return '1'
|
||||
}
|
||||
return '2';
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.isMute = this.storeCurrentGroup.status == 3;
|
||||
//console.log(this.storeCurrentGroup);
|
||||
// IMSDK.asyncApi('getSpecifiedGroupsInfo', IMSDK.uuid(), [this.storeCurrentGroup.groupID]).then(res=>{
|
||||
// console.log(res);
|
||||
// }).catch(e=>{
|
||||
@@ -42,7 +55,13 @@
|
||||
url: `/pages/conversation/groupMemberList/index?type=${GroupMemberListTypes.Transfer}&groupID=${this.storeCurrentGroup.groupID}`,
|
||||
});
|
||||
},
|
||||
setAdmin(){
|
||||
uni.navigateTo({
|
||||
url: `/pages/conversation/groupMemberList/index?type=${GroupMemberListTypes.setAdmin}&groupID=${this.storeCurrentGroup.groupID}`,
|
||||
});
|
||||
},
|
||||
updateMute(){
|
||||
this.isMute = !this.isMute;
|
||||
IMSDK.asyncApi('changeGroupMute', IMSDK.uuid(), {
|
||||
groupID: this.storeCurrentGroup.groupID,
|
||||
isMute: this.isMute
|
||||
@@ -61,6 +80,18 @@
|
||||
console.log(e);
|
||||
})
|
||||
},
|
||||
changeVerify(){
|
||||
uni.showActionSheet({
|
||||
itemList:[
|
||||
'申请进群需要群主或管理员同意;群成员邀请可以直接进群',
|
||||
'申请进群需要群主或管理员同意;群主和管理员邀请可以直接进群;普通成员邀请进群需群主或管理员同意',
|
||||
'直接进群'
|
||||
],
|
||||
success(res){
|
||||
console.log(res);
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,126 +1,128 @@
|
||||
<template>
|
||||
<custom-nav-bar @leftClick="leftClick" :title="getTitle">
|
||||
</custom-nav-bar>
|
||||
<custom-nav-bar @leftClick="leftClick" :title="getTitle">
|
||||
</custom-nav-bar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import { ContactChooseTypes } from "@/constant";
|
||||
export default {
|
||||
name: "",
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
props: {
|
||||
checkVisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isNomal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isTransfer: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isAt: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isSetAdmin: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMute: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isCall: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
groupID: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
moreMenuVisible: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getTitle() {
|
||||
if (this.isCall) {
|
||||
return "邀请成员";
|
||||
}
|
||||
if (this.isAt) {
|
||||
return "选择提醒的人";
|
||||
}
|
||||
if (this.isSetAdmin) {
|
||||
return "设置管理员";
|
||||
}
|
||||
if (this.isMute) {
|
||||
return "禁言成员";
|
||||
}
|
||||
if (this.checkVisible) {
|
||||
return "移除群成员";
|
||||
}
|
||||
return "群成员";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
leftClick() {
|
||||
if (this.checkVisible) {
|
||||
this.$emit("update:checkVisible", false);
|
||||
}
|
||||
},
|
||||
rightClick() {
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
checkMenu() {
|
||||
if (this.moreMenuVisible) {
|
||||
this.moreMenuVisible = false;
|
||||
}
|
||||
},
|
||||
inviteMember() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
|
||||
});
|
||||
},
|
||||
removeMember() {
|
||||
this.$emit("removeMember");
|
||||
},
|
||||
},
|
||||
};
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import {
|
||||
ContactChooseTypes
|
||||
} from "@/constant";
|
||||
export default {
|
||||
name: "",
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
props: {
|
||||
checkVisible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isNomal: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isTransfer: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isAt: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isSetAdmin: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isMute: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
isCall: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
groupID: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
moreMenuVisible: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
getTitle() {
|
||||
if (this.isCall) {
|
||||
return "邀请成员";
|
||||
}
|
||||
if (this.isAt) {
|
||||
return "选择提醒的人";
|
||||
}
|
||||
if (this.isSetAdmin) {
|
||||
return "设置管理员";
|
||||
}
|
||||
if (this.isMute) {
|
||||
return "禁言成员";
|
||||
}
|
||||
if (this.checkVisible) {
|
||||
return "移除群成员";
|
||||
}
|
||||
return "群成员";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
leftClick() {
|
||||
if (this.checkVisible) {
|
||||
this.$emit("update:checkVisible", false);
|
||||
}
|
||||
},
|
||||
rightClick() {
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
checkMenu() {
|
||||
if (this.moreMenuVisible) {
|
||||
this.moreMenuVisible = false;
|
||||
}
|
||||
},
|
||||
inviteMember() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/contactChoose/index?type=${ContactChooseTypes.Invite}&groupID=${this.groupID}`,
|
||||
});
|
||||
},
|
||||
removeMember() {
|
||||
this.$emit("removeMember");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.more_container {
|
||||
position: relative;
|
||||
.more_container {
|
||||
position: relative;
|
||||
|
||||
.more_dot {
|
||||
padding: 24rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.more_dot {
|
||||
padding: 24rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 8rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.menu_item {
|
||||
padding: 20rpx 48rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
.menu_item {
|
||||
padding: 20rpx 48rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
|
||||
// &:nth-child(1) {
|
||||
// border-bottom: 1px solid #F0F0F0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
// &:nth-child(1) {
|
||||
// border-bottom: 1px solid #F0F0F0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,14 @@
|
||||
<template>
|
||||
<view @click="pageClick" class="group_members_container">
|
||||
<group-member-list-header ref="navHeaderRef" :checkVisible.sync="showCheck" :isTransfer="isTransfer"
|
||||
:isNomal="!isOwner && !isAdmin" :groupID="groupID" @removeMember="showMemberCheck" />
|
||||
<group-member-list-header
|
||||
ref="navHeaderRef"
|
||||
:checkVisible.sync="showCheck"
|
||||
:isTransfer="isTransfer"
|
||||
:isSetAdmin="isSetAdmin"
|
||||
:isNomal="!isOwner && !isAdmin"
|
||||
:groupID="groupID"
|
||||
@removeMember="showMemberCheck"
|
||||
/>
|
||||
|
||||
<view class="search_bar_wrap">
|
||||
<u-search disabled class="search_bar" shape="square" placeholder="搜索" :showAction="false"
|
||||
@@ -10,22 +17,35 @@
|
||||
|
||||
<u-list class="member_list" @scrolltolower="loadMore" lowerThreshold="100" height="1">
|
||||
<u-list-item v-for="member in groupMemberList" :key="member.userID">
|
||||
<user-item @itemClick="userClick" @updateCheck="updateCheck" :checked="isChecked(member.userID)"
|
||||
:checkVisible="showCheck" :disabled="!canCheck(member) && showCheck" :item="member" />
|
||||
<user-item
|
||||
@itemClick="userClick"
|
||||
@updateCheck="updateCheck"
|
||||
@longtapEvent="longtap"
|
||||
:checked="isChecked(member.userID)"
|
||||
:checkVisible="showCheck"
|
||||
:disabled="!canCheck(member) && showCheck" :item="member"
|
||||
/>
|
||||
</u-list-item>
|
||||
<view v-show="loadState.loading" class="member_loading">
|
||||
<u-loading-icon></u-loading-icon>
|
||||
</view>
|
||||
</u-list>
|
||||
|
||||
<choose-index-footer v-if="showCheck" :comfirmLoading="comfirmLoading" @removeItem="updateCheck"
|
||||
@confirm="confirm" :choosedData="getChoosedData" :isRemove="isRemove" :maxLength="groupMemberLength" />
|
||||
<choose-index-footer
|
||||
v-if="showCheck"
|
||||
:comfirmLoading="comfirmLoading"
|
||||
@removeItem="updateCheck"
|
||||
@confirm="confirm"
|
||||
:choosedData="getChoosedData"
|
||||
:isRemove="isRemove"
|
||||
:maxLength="groupMemberLength" />
|
||||
|
||||
<u-modal :show="showConfirmModal" asyncClose showCancelButton @confirm="modalConfirm"
|
||||
@cancel="() => (showConfirmModal = false)" :content="
|
||||
isRemove
|
||||
? '确定移除已选群成员?'
|
||||
: `确定要把群主转移给${choosedTransferMember.nickname}吗?`
|
||||
<u-modal
|
||||
:show="showConfirmModal"
|
||||
asyncClose
|
||||
showCancelButton
|
||||
@confirm="modalConfirm"
|
||||
@cancel="() => (showConfirmModal = false)" :content="isRemove? '确定移除已选群成员?': `确定要把群主转移给${choosedTransferMember.nickname}吗?`
|
||||
" />
|
||||
<u-toast ref="uToast"></u-toast>
|
||||
</view>
|
||||
@@ -61,6 +81,7 @@
|
||||
hasMore: true,
|
||||
loading: false,
|
||||
},
|
||||
adminUserIdList:[]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -82,6 +103,9 @@
|
||||
isTransfer() {
|
||||
return this.type === GroupMemberListTypes.Transfer;
|
||||
},
|
||||
isSetAdmin() {
|
||||
return this.type === GroupMemberListTypes.setAdmin;
|
||||
},
|
||||
isChecked() {
|
||||
return (userID) => this.choosedMemberIDList.includes(userID);
|
||||
},
|
||||
@@ -93,8 +117,7 @@
|
||||
},
|
||||
isAdmin() {
|
||||
return (
|
||||
this.$store.getters.storeCurrentMemberInGroup.roleLevel ===
|
||||
GroupMemberRole.Admin
|
||||
this.$store.getters.storeCurrentMemberInGroup.roleLevel === GroupMemberRole.Admin
|
||||
);
|
||||
},
|
||||
canCheck() {
|
||||
@@ -125,12 +148,29 @@
|
||||
this.loadMemberList(groupID);
|
||||
this.type = type;
|
||||
this.groupID = groupID;
|
||||
this.isRightKick = type === GroupMemberListTypes.Kickout;
|
||||
if (
|
||||
this.isRightKick
|
||||
) {
|
||||
this.isRightKick = (type == GroupMemberListTypes.setAdmin|| type === GroupMemberListTypes.Kickout);
|
||||
if (this.isRightKick) {
|
||||
this.showCheck = true;
|
||||
}
|
||||
if(type == GroupMemberListTypes.setAdmin){
|
||||
IMSDK.asyncApi('getGroupMemberOwnerAndAdmin', IMSDK.uuid(), this.groupID).then(({data}) => {
|
||||
let arr = [];
|
||||
data.forEach((item)=>{
|
||||
if(item.roleLevel == GroupMemberRole.Admin){
|
||||
arr.push(item.userID);
|
||||
}
|
||||
});
|
||||
this.adminUserIdList = arr;
|
||||
this.choosedMemberIDList = arr;
|
||||
console.log(arr);
|
||||
// 调用成功
|
||||
})
|
||||
.catch(({ errCode, errMsg }) => {
|
||||
console.log(errCode, errMsg );
|
||||
// 调用失败
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
async pageClick(e) {
|
||||
@@ -146,8 +186,36 @@
|
||||
this.$refs.navHeaderRef.checkMenu();
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
this.showConfirmModal = true;
|
||||
async confirm() {
|
||||
if(this.isSetAdmin){
|
||||
uni.showLoading({mask:true})
|
||||
const remveUserIds = this.adminUserIdList.filter(userID=>{
|
||||
return !this.choosedMemberIDList.includes(userID);
|
||||
});
|
||||
const addUserIds = this.choosedMemberIDList.filter(userID=>{
|
||||
return !this.adminUserIdList.includes(userID);
|
||||
});
|
||||
remveUserIds.forEach(async (userID)=>{
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.SetGroupMemberInfo,IMSDK.uuid(),{
|
||||
roleLevel:GroupMemberRole.Normal,
|
||||
groupID:this.groupID,
|
||||
userID:userID
|
||||
});
|
||||
})
|
||||
addUserIds.forEach(async (userID)=>{
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.SetGroupMemberInfo,IMSDK.uuid(),{
|
||||
roleLevel:GroupMemberRole.Admin,
|
||||
groupID:this.groupID,
|
||||
userID:userID
|
||||
});
|
||||
})
|
||||
uni.hideLoading();
|
||||
this.groupMemberList = [];
|
||||
this.loadMemberList(this.groupID);
|
||||
uni.navigateBack();
|
||||
}else{
|
||||
this.showConfirmModal = true;
|
||||
}
|
||||
},
|
||||
modalConfirm() {
|
||||
let func = () => {};
|
||||
@@ -182,7 +250,6 @@
|
||||
} else {
|
||||
this.choosedMemberIDList = [...this.choosedMemberIDList, userID];
|
||||
}
|
||||
console.log(this.choosedMemberIDList);
|
||||
},
|
||||
userClick(member) {
|
||||
if (this.type === GroupMemberListTypes.Transfer) {
|
||||
@@ -227,6 +294,86 @@
|
||||
})
|
||||
.finally(() => (this.loadState.loading = false));
|
||||
},
|
||||
longtap(member){
|
||||
const _this = this;
|
||||
if(this.isRightKick){
|
||||
return ;
|
||||
}
|
||||
if(!this.isOwner&&!this.isAdmin){
|
||||
return ;
|
||||
}
|
||||
if(this.$store.getters.storeCurrentMemberInGroup.roleLevel == member.roleLevel ){
|
||||
return ;
|
||||
}
|
||||
let itemList = [];
|
||||
if(this.isOwner){
|
||||
itemList.push(member.roleLevel == GroupMemberRole.Admin ? '取消管理员' : '设为管理员');
|
||||
}
|
||||
if(this.isOwner || this.isAdmin){
|
||||
itemList.push(member.muteEndTime > 0 ? '取消禁言':'设置禁言');
|
||||
itemList.push('踢出群聊');
|
||||
}
|
||||
uni.showActionSheet({
|
||||
itemList:itemList,
|
||||
async success({tapIndex}) {
|
||||
if(tapIndex == 0){
|
||||
let roleId = itemList[tapIndex]=='设为管理员' ? GroupMemberRole.Admin : GroupMemberRole.Normal;
|
||||
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.SetGroupMemberInfo,IMSDK.uuid(),{
|
||||
roleLevel:roleId,
|
||||
groupID:_this.groupID,
|
||||
userID:member.userID
|
||||
});
|
||||
_this.groupMemberList = _this.groupMemberList.map((item)=>{
|
||||
if(item.userID == member.userID){
|
||||
item.roleLevel = roleId
|
||||
}
|
||||
return item;
|
||||
});
|
||||
return ;
|
||||
}
|
||||
if(tapIndex == 1){
|
||||
if(itemList[tapIndex]=='取消禁言'){
|
||||
_this.setMute(member.userID,0)
|
||||
return ;
|
||||
}
|
||||
uni.showActionSheet({
|
||||
itemList:['2小时','8小时','1天','3天','7天','15天','30天','1年'],
|
||||
async success(res){
|
||||
const secs = [3600*2,3600*8,3600*24,3600*72,3600*24*7,3600*24*15,3600*24*30,3600*24*365];
|
||||
_this.setMute(member.userID,secs[res.tapIndex])
|
||||
}
|
||||
});
|
||||
return ;
|
||||
}
|
||||
if(tapIndex == 2){
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.KickGroupMember,IMSDK.uuid(),{
|
||||
groupID:_this.groupID,
|
||||
reason:"",
|
||||
userIDList:[member.userID]
|
||||
});
|
||||
_this.groupMemberList = _this.groupMemberList.filter((item)=>{
|
||||
return item.userID != member.userID;
|
||||
});
|
||||
return ;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async setMute(userID,mutedSeconds){
|
||||
const _this = this;
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.ChangeGroupMemberMute,IMSDK.uuid(),{
|
||||
mutedSeconds:mutedSeconds,
|
||||
groupID:_this.groupID,
|
||||
userID:userID
|
||||
});
|
||||
this.groupMemberList = this.groupMemberList.map((item)=>{
|
||||
if(item.userID == userID){
|
||||
item.muteEndTime = mutedSeconds===0 ? 0 : (new Date().getTime())+mutedSeconds*1000
|
||||
}
|
||||
return item;
|
||||
});
|
||||
},
|
||||
showToast(message, complete = null) {
|
||||
this.$refs.uToast.show({
|
||||
message,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -38,14 +50,14 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.announcement = this.storeCurrentGroup.notification;
|
||||
this.announcement = this.storeCurrentGroup.notification;
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
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>
|
||||
@@ -11,6 +11,7 @@
|
||||
<view class="member_item" v-for="(member, index) in groupMemberList" :key="member.userID">
|
||||
<my-avatar :src="member.faceURL" :desc="member.nickname" :key="member.userID" size="48" />
|
||||
<view class="ower" v-if="member.roleLevel === 100">群主</view>
|
||||
<view class="ower" v-if="member.roleLevel === 60">管理员</view>
|
||||
<text class="member_item_name">{{ member.nickname }}</text>
|
||||
</view>
|
||||
<view class="member_item">
|
||||
|
||||
@@ -3,26 +3,16 @@
|
||||
<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="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="" />
|
||||
</view>
|
||||
<view class="group_info">
|
||||
<view class="group_info_name">
|
||||
<text class="group_name">{{ storeCurrentConversation.showName }}({{storeCurrentGroup.memberCount}})</text>
|
||||
<image v-if="isOwner || isAdmin" @click="toUpdateGroupName" style="width: 24rpx; height: 24rpx" src="@/static/images/group_edit.png" alt="" />
|
||||
</view>
|
||||
|
||||
<text @click="copyGroupID" class="sub_title">{{storeCurrentConversation.groupID}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<group-member-row v-if="isJoinGroup" :isNomal="!isAdmin && !isOwner"
|
||||
:groupID="storeCurrentConversation.groupID" :memberCount="storeCurrentGroup.memberCount"
|
||||
:groupMemberList="groupMemberList" />
|
||||
|
||||
<uni-list>
|
||||
<uni-list-item title="群图标" @click="updateGroupAvatar" clickable showArrow>
|
||||
<template v-slot:footer>
|
||||
<my-avatar :src="storeCurrentConversation.faceURL" :isGroup="true" size="46" />
|
||||
</template>
|
||||
</uni-list-item>
|
||||
<uni-list-item title="群聊名称" :rightText="storeCurrentConversation.showName" @click="editGroupName" :clickable="isOwner || isAdmin" :showArrow="isOwner || isAdmin"></uni-list-item>
|
||||
<uni-list-item title="群公告" to="/pages/conversation/groupSettings/announcement" clickable showArrow></uni-list-item>
|
||||
<uni-list-item title="群二维码" :to="getGroupQrcdeUrl" clickable showArrow></uni-list-item>
|
||||
@@ -95,7 +85,7 @@
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
console.log(this.storeCurrentConversation);
|
||||
//console.log(this.storeCurrentConversation);
|
||||
/*
|
||||
this.$store.commit("conversation/SET_CURRENT_CONVERSATION", {
|
||||
"conversationID": "sg_1793688611",
|
||||
@@ -194,7 +184,7 @@
|
||||
faceURL : this.storeCurrentConversation.faceURL,
|
||||
type : "group",
|
||||
});
|
||||
return `/pages/common/userOrGroupQrCode?sourceInfo=${s}`;
|
||||
return `/pages/common/userOrGroupQrCode?sourceInfo=${info}`;
|
||||
},
|
||||
getGroupVerStr() {
|
||||
if (
|
||||
|
||||
@@ -24,13 +24,14 @@
|
||||
<uni-list-item v-if="1==2" title="看一看" thumb="/static/images/find/06.png" :thumbSize="thumbSize" to="/pages/find/friend-circle/friend-circle" showArrow></uni-list-item>
|
||||
<uni-list-item v-if="1==2" title="听一听" thumb="/static/images/find/06.png" :thumbSize="thumbSize" to="/pages/find/friend-circle/friend-circle" showArrow></uni-list-item>
|
||||
<uni-list-item v-if="config.near_user_open == '1'" title="附近" thumb="/static/images/find/08.png" :thumbSize="thumbSize" to="/pages/find/near/near" showArrow></uni-list-item>
|
||||
<uni-list-item title="购物" thumb="/static/images/find/09.png" :thumbSize="thumbSize" :to="'/pages/common/webview?url='+encodeURI('http://pinduoduo.com')" showArrow></uni-list-item>
|
||||
<uni-list-item v-if="1===2" title="购物" thumb="/static/images/find/09.png" :thumbSize="thumbSize" :to="'/pages/common/webview?url='+encodeURI('http://pinduoduo.com')" showArrow></uni-list-item>
|
||||
</uni-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import util from "@/util";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -50,37 +51,8 @@
|
||||
let unreadCount= 1;
|
||||
this.$store.dispatch('circle/getFriendCircleInfo');
|
||||
},
|
||||
methods: {
|
||||
scan(){
|
||||
uni.scanCode({
|
||||
success(res) {
|
||||
if(res.scanType == "QR_CODE"){
|
||||
if(res.result.startsWith("http")){
|
||||
uni.navigateTo({
|
||||
url:"/pages/common/webview?url="+encodeURIComponent(res.result)
|
||||
});
|
||||
//res.result;
|
||||
return ;
|
||||
}
|
||||
const user_prefix = `${this.config.website}/u/`;
|
||||
if(res.result.startsWith(user_prefix)){
|
||||
return uni.navigateTo({
|
||||
url:"/pages/common/userCard/index?sourceID="+res.result.replace(user_prefix,'')
|
||||
});
|
||||
}
|
||||
const group_prefix = `${this.config.website}/g/`;
|
||||
if(res.result.startsWith(group_prefix)){
|
||||
return uni.navigateTo({
|
||||
url:"/pages/common/groupCard/index?sourceID="+res.result.replace(group_prefix,'')
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// uni.navigateTo({
|
||||
// url:"/pages/common/scan"
|
||||
// })
|
||||
}
|
||||
methods: {
|
||||
scan:util.scan
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
},
|
||||
onReady() {
|
||||
//console.log('onReady');
|
||||
// uni.navigateTo({
|
||||
// url:"/pages/common/upgrade"
|
||||
// });
|
||||
// return ;
|
||||
// #ifdef APP
|
||||
this.checkUpdate();
|
||||
this.tryLogin();
|
||||
@@ -148,7 +152,6 @@
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
console.log(data);
|
||||
data.forEach(this.handleNewMessage);
|
||||
});
|
||||
|
||||
@@ -282,8 +285,8 @@
|
||||
//设置了批量消息监听setBatchMsgListener时,此回调不会触发。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onRecvOfflineNewMessage,({ data })=>{});
|
||||
//当应用在后台运行,接收到新消息时,会收到该回调,回调中可能会携带多条消息。
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnRecvOfflineNewMessages,(res)=>{
|
||||
console.log(res);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnRecvOfflineNewMessages,({data})=>{
|
||||
data.forEach(this.handleOfflineNewMessages);
|
||||
});
|
||||
//已订阅用户的在线状态发生变化时,会触发此回调。
|
||||
//IMSDK.subscribe(IMSDK.IMEvents.onUserStatusChanged,({ data })=>{});
|
||||
@@ -404,6 +407,35 @@
|
||||
}
|
||||
},
|
||||
|
||||
handleOfflineNewMessages(newServerMsg) {
|
||||
console.log(newServerMsg);
|
||||
console.log( getConversationContent(newServerMsg));
|
||||
uni.createPushMessage({
|
||||
title:"您的朋友发来新的消息",
|
||||
content:getConversationContent(newServerMsg),
|
||||
payload:{
|
||||
type:"msg",
|
||||
data:newServerMsg
|
||||
},
|
||||
//icon:'',
|
||||
//sound:'',
|
||||
//cover:'false',
|
||||
//delay:0,
|
||||
//when:0,//消息上显示的提示时间
|
||||
//channelId:"",
|
||||
//category:"",
|
||||
success(res){
|
||||
//console.log(res);
|
||||
},
|
||||
fail(res){
|
||||
//console.log(res);
|
||||
},
|
||||
complete(res){
|
||||
//console.log(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleNewMessage(newServerMsg) {
|
||||
if (this.inCurrentConversation(newServerMsg)) {
|
||||
if (
|
||||
@@ -416,30 +448,7 @@
|
||||
uni.$u.debounce(this.markConversationAsRead, 2000);
|
||||
}
|
||||
}else{
|
||||
console.log(newServerMsg);
|
||||
|
||||
console.log( getConversationContent(newServerMsg));
|
||||
uni.createPushMessage({
|
||||
title:"您的朋友发来新的消息",
|
||||
content:getConversationContent(newServerMsg),
|
||||
payload:newServerMsg,
|
||||
//icon:'',
|
||||
//sound:'',
|
||||
//cover:'false',
|
||||
//delay:0,
|
||||
//when:0,//消息上显示的提示时间
|
||||
//channelId:"",
|
||||
//category:"",
|
||||
success(res){
|
||||
console.log(res);
|
||||
},
|
||||
fail(res){
|
||||
console.log(res);
|
||||
},
|
||||
complete(res){
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
this.handleOfflineNewMessages(newServerMsg);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -497,10 +506,10 @@
|
||||
let system = uni.getSystemInfoSync()
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
checkUpgrade({version:system.appVersion,platform:system.platform,version_wgt:inf.versionCode}).then(res=>{
|
||||
console.log(res.version,skip_version);
|
||||
let skip_version = uni.getStorageSync('skip_version')
|
||||
if(res && res.version!=skip_version){
|
||||
uni.$emit('closeWebview')
|
||||
this.setShow(this.current, false)
|
||||
router('/pages/common/upgrade?model=' + JSON.stringify(res), '', 'fade-in')
|
||||
}
|
||||
})
|
||||
@@ -523,6 +532,7 @@
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -537,5 +547,6 @@
|
||||
|
||||
.gif-image {
|
||||
width: 50%;
|
||||
border-radius: 10%;
|
||||
}
|
||||
</style>
|
||||
@@ -2,19 +2,19 @@
|
||||
<view class="page_container">
|
||||
<custom-nav-bar title="关于我们" />
|
||||
<view class="logo_area">
|
||||
<image :src="cdn(config.app_logo)" mode=""></image>
|
||||
<image class="logo" :src="cdn(config.app_logo)" mode="aspectFit"></image>
|
||||
<view>{{ appversion }}</view>
|
||||
|
||||
<info-item @click="checkUpdate" class="check" title="检测更新" />
|
||||
<info-item @click="openurl(config.website)" class="check" title="官方网站" />
|
||||
<info-item @click="goto('/pages/common/article?type=spage&name=cooperation&title=商务合作')" class="check" title="商务合作" />
|
||||
<info-item v-if="1==2" @click="goto('/pages/common/article?type=spage&name=cooperation&title=商务合作')" class="check" title="商务合作" />
|
||||
<info-item @click="goto('/pages/common/article?type=spage&name=terms_of_service&title=用户协议')" class="check" title="用户协议" />
|
||||
<info-item @click="goto('/pages/common/article?type=spage&name=privacy_policy&title=隐私政策')" class="check" title="隐私政策" />
|
||||
<info-item @click="goto('/pages/common/article?type=spage&name=aboutus&title=关于我们')" class="check" title="关于我们" />
|
||||
<info-item @click="clearcache" class="check" title="清除缓存" />
|
||||
<info-item @click="show = true" class="check" title="上传调试日志" />
|
||||
<info-item v-if="1==2" @click="show = true" class="check" title="上传调试日志" />
|
||||
|
||||
<u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false">
|
||||
<u-modal v-if="1==2" showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false">
|
||||
<view class="slot-content">
|
||||
<u--input placeholder="日志数量" border="surround" v-model="line"></u--input>
|
||||
</view>
|
||||
@@ -31,7 +31,7 @@
|
||||
import InfoItem from "../selfInfo/InfoItem.vue";
|
||||
import {checkUpgrade} from "@/api/login.js"
|
||||
import { mapGetters } from "vuex";
|
||||
import util from "@/util/index.js"
|
||||
import util from "@/util/index.js"
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
@@ -113,27 +113,16 @@ import util from "@/util/index.js"
|
||||
checkUpdate() {
|
||||
this.loading = true;
|
||||
const _this = this;
|
||||
let system = uni.getSystemInfoSync();
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
checkUpgrade({version:system.appVersion,platform:system.platform,version_wgt:inf.versionCode}).then(res=>{
|
||||
_this.loading = false;
|
||||
if(!res.data){
|
||||
uni.showToast({
|
||||
title:"已经是最新版本"
|
||||
})
|
||||
return ;
|
||||
}
|
||||
let skip_version = uni.getStorageSync('skip_version')
|
||||
if(res && res.version!=skip_version){
|
||||
uni.$emit('closeWebview')
|
||||
_this.setShow(_this.current, false)
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/upgrade?model=' + JSON.stringify(res),
|
||||
animationType:"fade-in"
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
checkUpgrade().then(res=>{
|
||||
_this.loading = false;
|
||||
}).catch(e=>{
|
||||
console.log(e);
|
||||
if(e === true){
|
||||
uni.showToast({title:'已经是最新版本'})
|
||||
return ;
|
||||
}
|
||||
_this.loading = false;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -152,10 +141,11 @@ import util from "@/util/index.js"
|
||||
border-radius: 6px;
|
||||
padding: 48rpx 0 16rpx 0;
|
||||
color: $uni-text-color;
|
||||
|
||||
image {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
|
||||
.logo{
|
||||
border-radius: 32rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<view class="id_row">
|
||||
<text class="nickname">{{ selfInfo.nickname }}</text>
|
||||
<view class="id_row_copy" @click="copy">
|
||||
<text class="id">{{ selfInfo.userID }}</text>
|
||||
<text class="id">瞬聊号:{{ selfInfo.userID }}</text>
|
||||
<image style="width: 32rpx; height: 32rpx" src="@/static/images/id_copy.png" mode="" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -55,16 +55,15 @@
|
||||
return this.$store.getters.storeSelfInfo;
|
||||
},
|
||||
getGender() {
|
||||
if (this.selfInfo.sex === 0) {
|
||||
if (this.selfInfo.sex == 0) {
|
||||
return "保密";
|
||||
}
|
||||
if (this.selfInfo.sex === 1) {
|
||||
if (this.selfInfo.sex == 1) {
|
||||
return "男";
|
||||
}
|
||||
return "女";
|
||||
},
|
||||
getBirth() {
|
||||
console.log(this.selfInfo);
|
||||
const birth = this.selfInfo.birthday ?? 0;
|
||||
return dayjs(birth).format("YYYY-MM-DD");
|
||||
},
|
||||
@@ -153,6 +152,7 @@
|
||||
},
|
||||
confirmDate({value}) {
|
||||
this.loadingState.birth = true;
|
||||
console.log(this.$store.getters.storeSelfInfo.faceURL);
|
||||
this.updateSelfInfo({birth: value,},"birth",);
|
||||
this.showDatePicker = false;
|
||||
},
|
||||
|
||||
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 22 KiB |
@@ -53,9 +53,6 @@ const mutations = {
|
||||
|
||||
const actions = {
|
||||
async getFriendList({commit }) {
|
||||
//#ifndef APP
|
||||
return [];
|
||||
//#endif
|
||||
let offset = 0;
|
||||
let friendInfoList = [];
|
||||
let initialFetch = true;
|
||||
@@ -73,14 +70,12 @@ const actions = {
|
||||
initialFetch = false;
|
||||
} catch (error) {
|
||||
console.error("getFriendListPage error",error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
commit("SET_FRIEND_LIST", friendInfoList);
|
||||
},
|
||||
async getGrouplist({commit}) {
|
||||
//#ifndef APP
|
||||
return [];
|
||||
//#endif
|
||||
let offset = 0;
|
||||
let groupList = [];
|
||||
while (true) {
|
||||
@@ -101,6 +96,7 @@ const actions = {
|
||||
console.error("getGrouplist error");
|
||||
}
|
||||
}
|
||||
//console.log(groupList);
|
||||
commit("SET_GROUP_LIST", groupList);
|
||||
},
|
||||
getBlacklist({commit}) {
|
||||
|
||||
@@ -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+",
|
||||
@@ -104,7 +104,7 @@ const actions = {
|
||||
);
|
||||
},
|
||||
updateCurrentMemberInGroup({commit,state}, memberInfo) {
|
||||
console.log(memberInfo);
|
||||
//console.log(memberInfo);
|
||||
if (
|
||||
memberInfo.groupID === state.currentMemberInGroup.groupID &&
|
||||
memberInfo.userID === state.currentMemberInGroup.userID
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view class="ly-map-wrapper">
|
||||
<view style="background: transparent;position: absolute;z-index:1998;top:10px;left: 10px;right:10px;display: flex;align-items: center;justify-content: space-between;">
|
||||
<view style="background: transparent;position: absolute;z-index:1998;top:54px;left: 10px;right:10px;display: flex;align-items: center;justify-content: space-between;">
|
||||
<uni-icons type="left" size="26" color="#333" @click="back"></uni-icons>
|
||||
<u-button
|
||||
@click="confirm"
|
||||
type="primary"
|
||||
v-if="type == 'chooselocation'"
|
||||
style="font-size: 15px;width: 100rpx;margin: 0;">确定</u-button>
|
||||
style="font-size: 15px;width: 150rpx;margin: 0;">确定</u-button>
|
||||
</view>
|
||||
<!-- <uni-nav-bar
|
||||
left-icon="back"
|
||||
|
||||
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 231 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 4.0 KiB |
@@ -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";
|
||||
@@ -30,6 +30,10 @@ dayjs.updateLocale("zh-cn", {
|
||||
},
|
||||
});
|
||||
|
||||
export const date = (timestemp, fmt = 'YYYY-MM-DD HH:mm:ss') => {
|
||||
if (!timestemp) return "";
|
||||
return dayjs(timestemp).format(fmt)
|
||||
};
|
||||
export const formatMessageTime = (timestemp, keepSameYear = false) => {
|
||||
if (!timestemp) return "";
|
||||
const isRecent = dayjs().diff(timestemp, "day") < 7;
|
||||
@@ -174,11 +178,21 @@ export const parseMessageByType = (pmsg) => {
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${getName(kickOpUser)}踢出了${kickStr}${kickdUserList.length > 3 ? "..." : ""}`;
|
||||
case MessageType.GroupMemberMuted:
|
||||
return `[GroupMemberMuted]`;
|
||||
//群成员禁言通知
|
||||
const groupMemberMutedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupMemberMutedDetail.opUser)}取消了${getName(groupMemberMutedDetail.mutedUser)}的禁言`;
|
||||
case MessageType.GroupMemberCancelMuted:
|
||||
return `[GroupMemberCancelMuted]`;
|
||||
//取消群成员禁言通知
|
||||
const groupMemberCancelMutedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupMemberCancelMutedDetail.opUser)}禁言了${getName(groupMemberCancelMutedDetail.mutedUser)}`;
|
||||
case MessageType.GroupMuted:
|
||||
return `[GroupMuted]`;
|
||||
//群禁言通知
|
||||
const groupGroupMutedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupGroupMutedDetail.opUser)}设置了全员禁言`;
|
||||
case MessageType.GroupCancelMuted:
|
||||
//取消群禁言通知
|
||||
const groupGroupCancelMutedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupGroupCancelMutedDetail.opUser)}取消了全员禁言`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
@@ -200,15 +214,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:
|
||||
return `[GroupAnnouncementUpdated]`;
|
||||
//群公告更新
|
||||
const groupAnnouncementUpdatedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
return `${getName(groupAnnouncementUpdatedDetail.opUser)}更新了群公告`;
|
||||
case MessageType.BurnMessageChange:
|
||||
//阅后即焚开启或关闭通知
|
||||
//console.log(pmsg);
|
||||
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);
|
||||
@@ -253,7 +271,6 @@ export const bytesToSize = (bytes) => {
|
||||
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
||||
};
|
||||
|
||||
export const tipMessaggeFormat = (msg, currentUserID) => {
|
||||
|
||||
const getName = (user) =>
|
||||
@@ -269,43 +286,43 @@ export const tipMessaggeFormat = (msg, currentUserID) => {
|
||||
case MessageType.GroupInfoUpdated:
|
||||
const groupUpdateDetail = JSON.parse(msg.notificationElem.detail);
|
||||
const groupUpdateUser = groupUpdateDetail.opUser;
|
||||
return `${parseInfo(groupUpdateUser)}修改了群信息`;
|
||||
return `${getName(groupUpdateUser)}修改了群信息`;
|
||||
case MessageType.GroupOwnerTransferred:
|
||||
const transferDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const transferOpUser = transferDetails.opUser;
|
||||
const newOwner = transferDetails.newGroupOwner;
|
||||
return `${parseInfo(transferOpUser)}转让群主给${parseInfo(newOwner)}`;
|
||||
return `${getName(transferOpUser)}转让群主给${getName(newOwner)}`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
return `${parseInfo(quitUser)}退出了群组`;
|
||||
return `${getName(quitUser)}退出了群组`;
|
||||
case MessageType.MemberInvited:
|
||||
const inviteDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const inviteOpUser = inviteDetails.opUser;
|
||||
const invitedUserList = inviteDetails.invitedUserList ?? [];
|
||||
let inviteStr = "";
|
||||
invitedUserList.find(
|
||||
(user, idx) => (inviteStr += parseInfo(user) + "、") && idx > 3,
|
||||
(user, idx) => (inviteStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
inviteStr = inviteStr.slice(0, -1);
|
||||
return `${parseInfo(inviteOpUser)} 邀请了${inviteStr}${invitedUserList.length > 3 ? "..." : ""}加入群聊`; case MessageType.MemberKicked:
|
||||
return `${getName(inviteOpUser)} 邀请了${inviteStr}${invitedUserList.length > 3 ? "..." : ""}加入群聊`; case MessageType.MemberKicked:
|
||||
const kickDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const kickOpUser = kickDetails.opUser;
|
||||
const kickdUserList = kickDetails.kickedUserList ?? [];
|
||||
let kickStr = "";
|
||||
kickdUserList.find(
|
||||
(user, idx) => (kickStr += parseInfo(user) + "、") && idx > 3,
|
||||
(user, idx) => (kickStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${parseInfo(kickOpUser)} 踢出了${kickStr}${kickdUserList.length > 3 ? "..." : ""}`;
|
||||
return `${getName(kickOpUser)} 踢出了${kickStr}${kickdUserList.length > 3 ? "..." : ""}`;
|
||||
case MessageType.MemberEnter:
|
||||
const enterDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const enterUser = enterDetails.entrantUser;
|
||||
return `${parseInfo(enterUser)}加入了群聊`;
|
||||
return `${getName(enterUser)}加入了群聊`;
|
||||
case MessageType.GroupDismissed:
|
||||
const dismissDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const dismissUser = dismissDetails.opUser;
|
||||
return `${parseInfo(dismissUser)}解散了群聊`;
|
||||
return `${getName(dismissUser)}解散了群聊`;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -371,11 +388,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);
|
||||
}
|
||||
return `${message.senderNickname}:${parseMessageByType(message)}`;
|
||||
if(message.senderNickname){
|
||||
return `${message.senderNickname}:${parseMessageByType(message)}`;
|
||||
}
|
||||
return parseMessageByType(message);
|
||||
};
|
||||
@@ -1,13 +1,14 @@
|
||||
|
||||
//import i18n from '@/locales'
|
||||
import base from '@/common/config';
|
||||
//import store from "@/store";
|
||||
import store from "@/store";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
|
||||
import CryptoJS from 'crypto-js';
|
||||
import md5 from "md5";
|
||||
|
||||
// #ifdef APP
|
||||
import {downloadFile} from "@/uni_modules/network-manage";
|
||||
// #endif
|
||||
const isString = (v)=> {
|
||||
return typeof v === 'string' || v instanceof String;
|
||||
},
|
||||
@@ -144,20 +145,31 @@ const scan = ()=>{
|
||||
barCode 扫描条形码时返回条形码数据 支付宝小程序
|
||||
imageChannel 来源 支付宝小程序
|
||||
*/
|
||||
if(res.result){
|
||||
if(res.result.indexOf('blackcatp:/')){
|
||||
if(res.scanType == "QR_CODE"){
|
||||
const user_prefix = `${store.getters.config.website}/u/`;
|
||||
console.log(res.result,user_prefix)
|
||||
if(res.result.startsWith(user_prefix)){
|
||||
return uni.navigateTo({
|
||||
url:"/pages/common/userCard/index?sourceID="+res.result.replace(user_prefix,'')
|
||||
});
|
||||
}
|
||||
const group_prefix = `${store.getters.config.website}/g/`;
|
||||
console.log(res.result,group_prefix)
|
||||
if(res.result.startsWith(group_prefix)){
|
||||
return uni.navigateTo({
|
||||
url:"/pages/common/groupCard/index?sourceID="+res.result.replace(group_prefix,'')
|
||||
});
|
||||
}
|
||||
if(res.result.startsWith("http")){
|
||||
uni.navigateTo({
|
||||
url:res.result.substring(11)
|
||||
})
|
||||
}else{
|
||||
success(res.result)
|
||||
url:"/pages/common/webview?url="+encodeURIComponent(res.result)
|
||||
});
|
||||
//res.result;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
},
|
||||
fail(res){
|
||||
|
||||
},
|
||||
complete(res){
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
@@ -234,6 +246,11 @@ const get_absolute_path = (fn)=>{
|
||||
}
|
||||
const pendingDownloads = new Map();
|
||||
const cacheFile = (url, saveDir,progressCallback) => {
|
||||
// #ifndef APP
|
||||
return new Promise(async (resolve, reject) => {
|
||||
resolve(url);
|
||||
});
|
||||
// #endif
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
if(!url || !url.startsWith('http')){
|
||||
@@ -443,7 +460,9 @@ export default{
|
||||
cacheFile,
|
||||
fileExsit,
|
||||
get_absolute_path,
|
||||
// #ifdef APP
|
||||
downloadFile,
|
||||
// #endif
|
||||
isString :isString,
|
||||
isNumber :isNumber,
|
||||
isInteger :isInteger,
|
||||
|
||||