20
@@ -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,523 @@
|
||||
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");
|
||||
|
||||
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){
|
||||
prepareConversationState(conversation);
|
||||
}
|
||||
}
|
||||
}
|
||||
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>
|
||||
|
||||
|
||||
@@ -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",
|
||||
@@ -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
|
||||
}
|
||||
),
|
||||
],
|
||||
|
||||
@@ -158,37 +158,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;
|
||||
@@ -275,6 +273,7 @@ export default {
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
border-radius: 32rpx;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.pane_title {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
padding: 6px 22px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
@@ -194,7 +194,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 {
|
||||
@@ -51,36 +52,7 @@
|
||||
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"
|
||||
// })
|
||||
}
|
||||
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;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -153,9 +142,10 @@ import util from "@/util/index.js"
|
||||
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}) {
|
||||
|
||||
@@ -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 |
@@ -253,7 +253,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 +268,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 "";
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||