4
@@ -1,29 +1,16 @@
|
||||
<script>
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import IMSDK, {
|
||||
IMMethods,
|
||||
MessageType,
|
||||
SessionType,
|
||||
} 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 {
|
||||
conversationSort
|
||||
} from "@/util/imCommon";
|
||||
import {
|
||||
PageEvents,
|
||||
UpdateMessageTypes
|
||||
} from "@/constant";
|
||||
import {getDbDir,toastWithCallback} from "@/util/common.js";
|
||||
import {conversationSort} from "@/util/imCommon";
|
||||
import {checkUpgrade} from "@/api/login.js"
|
||||
import {PageEvents,UpdateMessageTypes} from "@/constant";
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
console.log("App Launch");
|
||||
this.checkUpdate();
|
||||
this.setGlobalIMlistener();
|
||||
this.tryLogin();
|
||||
// #ifdef H5
|
||||
@@ -101,15 +88,11 @@
|
||||
});
|
||||
|
||||
// sync
|
||||
const syncStartHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const syncStartHandler = ({data}) => {
|
||||
this.$store.commit("user/SET_IS_SYNCING", true);
|
||||
this.$store.commit("user/SET_REINSTALL", data);
|
||||
};
|
||||
const syncProgressHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const syncProgressHandler = ({data}) => {
|
||||
this.$store.commit("user/SET_PROGRESS", data);
|
||||
};
|
||||
const syncFinishHandler = () => {
|
||||
@@ -133,9 +116,7 @@
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerProgress, syncProgressHandler);
|
||||
|
||||
// self
|
||||
const selfInfoUpdateHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const selfInfoUpdateHandler = ({data}) => {
|
||||
this.$store.commit("user/SET_SELF_INFO", {
|
||||
...this.storeSelfInfo,
|
||||
...data,
|
||||
@@ -145,9 +126,7 @@
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnSelfInfoUpdated, selfInfoUpdateHandler);
|
||||
|
||||
// message
|
||||
const newMessagesHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const newMessagesHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
@@ -157,9 +136,7 @@
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessages, newMessagesHandler);
|
||||
|
||||
// friend
|
||||
const friendInfoChangeHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const friendInfoChangeHandler = ({data}) => {
|
||||
uni.$emit(IMSDK.IMEvents.OnFriendInfoChanged, {
|
||||
data
|
||||
});
|
||||
@@ -167,36 +144,25 @@
|
||||
friendInfo: data,
|
||||
});
|
||||
};
|
||||
const friendAddedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const friendAddedHandler = ({data}) => {
|
||||
this.pushNewFriend(data);
|
||||
};
|
||||
const friendDeletedHander = ({
|
||||
data
|
||||
}) => {
|
||||
const friendDeletedHander = ({data}) => {
|
||||
this.updateFriendInfo({
|
||||
friendInfo: data,
|
||||
isRemove: true,
|
||||
});
|
||||
};
|
||||
|
||||
IMSDK.subscribe(
|
||||
IMSDK.IMEvents.OnFriendInfoChanged,
|
||||
friendInfoChangeHandler
|
||||
);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendInfoChanged,friendInfoChangeHandler);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendAdded, friendAddedHandler);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnFriendDeleted, friendDeletedHander);
|
||||
|
||||
// blacklist
|
||||
const blackAddedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const blackAddedHandler = ({data}) => {
|
||||
this.pushNewBlack(data);
|
||||
};
|
||||
const blackDeletedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const blackDeletedHandler = ({data}) => {
|
||||
this.updateBlackInfo({
|
||||
blackInfo: data,
|
||||
isRemove: true,
|
||||
@@ -207,58 +173,34 @@
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnBlackDeleted, blackDeletedHandler);
|
||||
|
||||
// group
|
||||
const joinedGroupAddedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const joinedGroupAddedHandler = ({data}) => {
|
||||
this.pushNewGroup(data);
|
||||
};
|
||||
const joinedGroupDeletedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const joinedGroupDeletedHandler = ({data}) => {
|
||||
this.updateGroupInfo({
|
||||
groupInfo: data,
|
||||
isRemove: true,
|
||||
});
|
||||
};
|
||||
const groupInfoChangedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const groupInfoChangedHandler = ({data}) => {
|
||||
this.updateGroupInfo({
|
||||
groupInfo: data,
|
||||
});
|
||||
};
|
||||
const groupMemberInfoChangedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
uni.$emit(IMSDK.IMEvents.OnGroupMemberInfoChanged, {
|
||||
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
|
||||
);
|
||||
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 friendApplicationNumHandler = ({data}) => {
|
||||
const isRecv = data.toUserID === this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.pushNewRecvFriendApplition(data);
|
||||
@@ -266,9 +208,7 @@
|
||||
this.pushNewSentFriendApplition(data);
|
||||
}
|
||||
};
|
||||
const friendApplicationAccessHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const friendApplicationAccessHandler = ({data}) => {
|
||||
const isRecv = data.toUserID === this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.updateRecvFriendApplition({
|
||||
@@ -280,9 +220,7 @@
|
||||
});
|
||||
}
|
||||
};
|
||||
const groupApplicationNumHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const groupApplicationNumHandler = ({data}) => {
|
||||
const isRecv = data.userID !== this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.pushNewRecvGroupApplition(data);
|
||||
@@ -290,9 +228,7 @@
|
||||
this.pushNewSentGroupApplition(data);
|
||||
}
|
||||
};
|
||||
const groupApplicationAccessHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const groupApplicationAccessHandler = ({data}) => {
|
||||
const isRecv = data.userID !== this.storeCurrentUserID;
|
||||
if (isRecv) {
|
||||
this.updateRecvGroupApplition({
|
||||
@@ -305,43 +241,21 @@
|
||||
}
|
||||
};
|
||||
|
||||
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.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);
|
||||
|
||||
// conversation
|
||||
const totalUnreadCountChangedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const totalUnreadCountChangedHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
this.$store.commit("conversation/SET_UNREAD_COUNT", data);
|
||||
};
|
||||
const newConversationHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const newConversationHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
@@ -351,9 +265,7 @@
|
||||
conversationSort(result)
|
||||
);
|
||||
};
|
||||
const conversationChangedHandler = ({
|
||||
data
|
||||
}) => {
|
||||
const conversationChangedHandler = ({data}) => {
|
||||
if (this.storeIsSyncing) {
|
||||
return;
|
||||
}
|
||||
@@ -421,17 +333,14 @@
|
||||
uni.$u.toast("初始化IMSDK失败!");
|
||||
return;
|
||||
}
|
||||
const status = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetLoginStatus,
|
||||
IMSDK.uuid()
|
||||
);
|
||||
const status = await IMSDK.asyncApi(IMSDK.IMMethods.GetLoginStatus,IMSDK.uuid());
|
||||
if (status === 3) {
|
||||
initStore();
|
||||
return;
|
||||
}
|
||||
|
||||
const IMToken = uni.getStorageSync("IMToken");
|
||||
const IMUserID = uni.getStorageSync("IMUserID");
|
||||
const IMUserID = uni.getStorageSync("IMUserID")+'';
|
||||
if (IMToken && IMUserID) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.Login, IMSDK.uuid(), {
|
||||
userID: IMUserID,
|
||||
@@ -494,6 +403,20 @@
|
||||
this.storeCurrentConversation.conversationID
|
||||
);
|
||||
},
|
||||
// 验证是否升级
|
||||
checkUpdate() {
|
||||
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=>{
|
||||
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')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// 登录
|
||||
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 businessLogin = (params) =>
|
||||
uni.$u?.http.post("/common/login", JSON.stringify(params));
|
||||
export const businessSendSms = (params) =>
|
||||
@@ -28,9 +31,8 @@ export const businessModify = (params) =>
|
||||
export const businessInfoUpdate = (params) =>
|
||||
uni.$u?.http.post(
|
||||
"/user/profile",
|
||||
JSON.stringify({
|
||||
...params,
|
||||
}), {
|
||||
JSON.stringify({ ...params, }),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
@@ -39,9 +41,8 @@ export const businessInfoUpdate = (params) =>
|
||||
export const businessGetUserInfo = (userID) =>
|
||||
uni.$u?.http.post(
|
||||
"/user/find",
|
||||
JSON.stringify({
|
||||
userIDs: [userID],
|
||||
}), {
|
||||
JSON.stringify({ userIDs: [userID], }),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
@@ -76,4 +77,41 @@ export const businessSearchUser = (keyword,searchtype) =>
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
);
|
||||
export const getArticle = (id,type) =>
|
||||
uni.$u?.http.post(
|
||||
"/article/detail",
|
||||
JSON.stringify({
|
||||
id,
|
||||
type:(type? type : 'id')
|
||||
}), {
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
export const getFriendCircle = (page=1,limit=10) =>{
|
||||
uni.$u?.http.get(
|
||||
"/friend_circle/list",
|
||||
JSON.stringify({
|
||||
limit:limit,
|
||||
page:page
|
||||
}),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
export const getFriendCircleNewcount = () =>{
|
||||
uni.$u?.http.get(
|
||||
"/friend_circle/newcount",
|
||||
JSON.stringify({}),
|
||||
{
|
||||
header: {
|
||||
token: uni.getStorageSync("BusinessToken"),
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -7,7 +7,7 @@ const BASE_DOMAIN = 'www.axzc.xyz'
|
||||
// const CHAT_URL = `https://${BASE_DOMAIN}/chat`
|
||||
// const API_URL = `https://${BASE_DOMAIN}/api`
|
||||
// const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway`
|
||||
const CHAT_URL = `http://${BASE_DOMAIN}:8585/api`
|
||||
const CHAT_URL = `http://${BASE_DOMAIN}/api`
|
||||
const API_URL = `http://${BASE_DOMAIN}/imapi`
|
||||
const WS_URL = `ws://${BASE_DOMAIN}/ws`
|
||||
|
||||
|
||||
@@ -1,59 +1,55 @@
|
||||
<template>
|
||||
<view class="selected_item">
|
||||
<view class="left_info">
|
||||
<my-avatar
|
||||
:src="source.faceURL"
|
||||
:desc="source.nickname || source.showName"
|
||||
:isGroup="Boolean(source.groupID)"
|
||||
size="42"
|
||||
/>
|
||||
<text>{{ source.nickname || source.groupName || source.showName }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<u-button @click="action" plain text="移除" type="primary" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="selected_item">
|
||||
<view class="left_info">
|
||||
<my-avatar :src="source.faceURL" :desc="source.nickname || source.showName"
|
||||
:isGroup="Boolean(source.groupID)" size="42" />
|
||||
<text>{{ source.nickname || source.groupName || source.showName }}</text>
|
||||
</view>
|
||||
<view>
|
||||
<u-button @click="action" plain text="移除" type="primary" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
export default {
|
||||
name: "",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {
|
||||
source: Object,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
action() {
|
||||
this.$emit("removeItem");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.source);
|
||||
},
|
||||
};
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
export default {
|
||||
name: "",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {
|
||||
source: Object,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
action() {
|
||||
this.$emit("removeItem");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.source);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.selected_item {
|
||||
@include btwBox();
|
||||
padding: 20rpx 0;
|
||||
.selected_item {
|
||||
@include btwBox();
|
||||
padding: 20rpx 0;
|
||||
|
||||
.left_info {
|
||||
@include vCenterBox();
|
||||
.left_info {
|
||||
@include vCenterBox();
|
||||
|
||||
.u-avatar {
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
.u-avatar {
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-button {
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.u-button {
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,143 +1,130 @@
|
||||
<template>
|
||||
<view class="member_checked_desc">
|
||||
<view @click="showSelected = true" class="left_info">
|
||||
<view class="select_num">
|
||||
<text class="text">{{ `已选择(${choosedData.length})` }}</text>
|
||||
<u-icon name="arrow-up" size="14" color="#007aff" />
|
||||
</view>
|
||||
<view class="select_list">{{ selectedStr }}</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<u-button
|
||||
:loading="comfirmLoading"
|
||||
@click="clickComfirm"
|
||||
:disabled="choosedData.length === 0"
|
||||
type="primary"
|
||||
:text="
|
||||
isRemove
|
||||
? '移除'
|
||||
: `确定(${choosedData.length}${
|
||||
maxLength > 0 ? `/${maxLength}` : ``
|
||||
})`
|
||||
"
|
||||
/>
|
||||
<u-popup round="24" :show="showSelected" mode="bottom" @close="close">
|
||||
<view class="selected_container">
|
||||
<view class="top_desc">
|
||||
<text>{{ `已选择(${choosedData.length})` }}</text>
|
||||
<text @click="close" class="comfirm_text">确认</text>
|
||||
</view>
|
||||
<u-list class="selected_list">
|
||||
<u-list-item
|
||||
v-for="item in choosedData"
|
||||
:key="item.userID || item.groupID"
|
||||
>
|
||||
<selected-member @removeItem="removeItem(item)" :source="item" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</view>
|
||||
<view class="member_checked_desc">
|
||||
<view @click="showSelected = true" class="left_info">
|
||||
<view class="select_num">
|
||||
<text class="text">{{ `已选择(${choosedData.length})` }}</text>
|
||||
<u-icon name="arrow-up" size="14" color="#007aff" />
|
||||
</view>
|
||||
<view class="select_list">{{ selectedStr }}</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<u-button :loading="comfirmLoading" @click="clickComfirm" :disabled="choosedData.length === 0"
|
||||
type="primary"
|
||||
:text="isRemove? '移除': `确定(${choosedData.length}${maxLength > 0 ? `/${maxLength}` : ``})`" />
|
||||
<u-popup round="24" :show="showSelected" mode="bottom" @close="close">
|
||||
<view class="selected_container">
|
||||
<view class="top_desc">
|
||||
<text>{{ `已选择(${choosedData.length})` }}</text>
|
||||
<text @click="close" class="comfirm_text">确认</text>
|
||||
</view>
|
||||
<u-list class="selected_list">
|
||||
<u-list-item v-for="item in choosedData" :key="item.userID || item.groupID">
|
||||
<selected-member @removeItem="removeItem(item)" :source="item" />
|
||||
</u-list-item>
|
||||
</u-list>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectedMember from "./SelectedMember.vue";
|
||||
export default {
|
||||
name: "ChooseIndexFooter",
|
||||
components: {
|
||||
SelectedMember,
|
||||
},
|
||||
props: {
|
||||
isRemove: Boolean,
|
||||
choosedData: Array,
|
||||
comfirmLoading: Boolean,
|
||||
maxLength: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelected: false,
|
||||
showConfirmModal: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selectedStr() {
|
||||
return this.choosedData
|
||||
.map((item) => item.nickname || item.showName || item.groupName)
|
||||
.join("、");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.showSelected = false;
|
||||
},
|
||||
removeItem(item) {
|
||||
this.$emit("removeItem", item);
|
||||
},
|
||||
clickComfirm() {
|
||||
this.$emit("confirm");
|
||||
},
|
||||
},
|
||||
};
|
||||
import SelectedMember from "./SelectedMember.vue";
|
||||
export default {
|
||||
name: "ChooseIndexFooter",
|
||||
components: {
|
||||
SelectedMember,
|
||||
},
|
||||
props: {
|
||||
isRemove: Boolean,
|
||||
choosedData: Array,
|
||||
comfirmLoading: Boolean,
|
||||
maxLength: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelected: false,
|
||||
showConfirmModal: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selectedStr() {
|
||||
return this.choosedData
|
||||
.map((item) => item.nickname || item.showName || item.groupName)
|
||||
.join("、");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.showSelected = false;
|
||||
},
|
||||
removeItem(item) {
|
||||
this.$emit("removeItem", item);
|
||||
},
|
||||
clickComfirm() {
|
||||
this.$emit("confirm");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.member_checked_desc {
|
||||
@include btwBox();
|
||||
background-color: #fff;
|
||||
align-items: flex-start;
|
||||
padding: 24rpx 44rpx 0;
|
||||
height: 60px;
|
||||
max-height: 60px;
|
||||
box-shadow: 0px -1px 4px 1px rgba(0, 0, 0, 0.04);
|
||||
.member_checked_desc {
|
||||
@include btwBox();
|
||||
background-color: #fff;
|
||||
align-items: flex-start;
|
||||
padding: 24rpx 44rpx 0;
|
||||
height: 60px;
|
||||
max-height: 60px;
|
||||
box-shadow: 0px -1px 4px 1px rgba(0, 0, 0, 0.04);
|
||||
|
||||
.left_info {
|
||||
@include colBox(false);
|
||||
.left_info {
|
||||
@include colBox(false);
|
||||
|
||||
.select_num {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
.select_num {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: $uni-color-primary;
|
||||
}
|
||||
|
||||
.select_list {
|
||||
font-size: 24rpx;
|
||||
color: #8e9ab0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 50vw;
|
||||
}
|
||||
.select_list {
|
||||
font-size: 24rpx;
|
||||
color: #8e9ab0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 50vw;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 30rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
font-size: 30rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.u-button {
|
||||
background-color: #0089ff;
|
||||
height: 40px;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
.u-button {
|
||||
background-color: #0089ff;
|
||||
height: 40px;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.selected_container {
|
||||
padding: 44rpx;
|
||||
.selected_container {
|
||||
padding: 44rpx;
|
||||
|
||||
.top_desc {
|
||||
@include btwBox();
|
||||
margin-bottom: 20rpx;
|
||||
.top_desc {
|
||||
@include btwBox();
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.comfirm_text {
|
||||
color: $uni-color-primary;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
.comfirm_text {
|
||||
color: $uni-color-primary;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.selected_list {
|
||||
height: 60vh !important;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.selected_list {
|
||||
height: 60vh !important;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,91 +1,77 @@
|
||||
<template>
|
||||
<u-index-list
|
||||
@scrolltolower="scrolltolower"
|
||||
class="user_list"
|
||||
:style="{ height: height }"
|
||||
:index-list="indexList"
|
||||
>
|
||||
<template v-for="(item, index) in itemArr">
|
||||
<u-index-item :key="index">
|
||||
<u-index-anchor
|
||||
class="user_anchor"
|
||||
:text="indexList[index]"
|
||||
></u-index-anchor>
|
||||
<user-item
|
||||
@itemClick="itemClick"
|
||||
@updateCheck="updateCheck"
|
||||
:checked="checkedIDList.includes(cell.userID)"
|
||||
:disabled="disabledIDList.includes(cell.userID)"
|
||||
:checkVisible="showCheck"
|
||||
v-for="cell in item"
|
||||
:item="cell"
|
||||
:key="cell.userID"
|
||||
/>
|
||||
</u-index-item>
|
||||
</template>
|
||||
</u-index-list>
|
||||
<u-index-list @scrolltolower="scrolltolower" class="user_list" :style="{ height: height }" :index-list="indexList">
|
||||
<template v-for="(item, index) in itemArr">
|
||||
<u-index-item :key="index">
|
||||
<u-index-anchor class="user_anchor" :text="indexList[index]"></u-index-anchor>
|
||||
<user-item @itemClick="itemClick" @updateCheck="updateCheck"
|
||||
:checked="checkedIDList.includes(cell.userID)" :disabled="disabledIDList.includes(cell.userID)"
|
||||
:checkVisible="showCheck" v-for="cell in item" :item="cell" :key="cell.userID" />
|
||||
</u-index-item>
|
||||
</template>
|
||||
</u-index-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import UserItem from "../UserItem/index.vue";
|
||||
export default {
|
||||
name: "ChooseIndexList",
|
||||
components: {
|
||||
UserItem,
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "0px",
|
||||
},
|
||||
indexList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
itemArr: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
checkedIDList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disabledIDList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
showCheck: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
itemClick(item) {
|
||||
this.$emit("itemClick", item);
|
||||
},
|
||||
updateCheck(item) {
|
||||
this.$emit("updateCheck", item);
|
||||
},
|
||||
scrolltolower() {
|
||||
this.$emit("scrolltolower");
|
||||
},
|
||||
},
|
||||
};
|
||||
import UserItem from "../UserItem/index.vue";
|
||||
export default {
|
||||
name: "ChooseIndexList",
|
||||
components: {
|
||||
UserItem,
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "0px",
|
||||
},
|
||||
indexList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
itemArr: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
checkedIDList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
disabledIDList: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
showCheck: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
itemClick(item) {
|
||||
this.$emit("itemClick", item);
|
||||
},
|
||||
updateCheck(item) {
|
||||
this.$emit("updateCheck", item);
|
||||
},
|
||||
scrolltolower() {
|
||||
this.$emit("scrolltolower");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.user_list {
|
||||
flex: 1;
|
||||
::v-deep uni-scroll-view {
|
||||
max-height: 100% !important;
|
||||
}
|
||||
}
|
||||
.user_list {
|
||||
flex: 1;
|
||||
|
||||
.user_anchor {
|
||||
background-color: #f8f8f8 !important;
|
||||
border: none !important;
|
||||
}
|
||||
</style>
|
||||
::v-deep uni-scroll-view {
|
||||
max-height: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.user_anchor {
|
||||
background-color: #f8f8f8 !important;
|
||||
border: none !important;
|
||||
}
|
||||
</style>
|
||||
@@ -1,42 +1,46 @@
|
||||
export const ChatingFooterActionTypes = {
|
||||
Album: "Album",
|
||||
Album: "Album",
|
||||
Camera: "Camera",
|
||||
Video: "Video",
|
||||
Voice: "Voice",
|
||||
Location: "Location",
|
||||
};
|
||||
|
||||
export const ContactMenuTypes = {
|
||||
NewFriend: "NewFriend",
|
||||
NewGroup: "NewGroup",
|
||||
MyFriend: "MyFriend",
|
||||
MyGroup: "MyGroup",
|
||||
NewFriend: "NewFriend",
|
||||
NewGroup: "NewGroup",
|
||||
MyFriend: "MyFriend",
|
||||
MyGroup: "MyGroup",
|
||||
};
|
||||
|
||||
export const GroupMemberListTypes = {
|
||||
Preview: "Preview",
|
||||
Transfer: "Transfer",
|
||||
Kickout: "Kickout",
|
||||
Preview: "Preview",
|
||||
Transfer: "Transfer",
|
||||
Kickout: "Kickout",
|
||||
};
|
||||
|
||||
export const ContactChooseTypes = {
|
||||
Invite: "Invite",
|
||||
GetList: "GetList",
|
||||
Invite: "Invite",
|
||||
GetList: "GetList",
|
||||
};
|
||||
|
||||
export const UpdateMessageTypes = {
|
||||
Overall: "Overall",
|
||||
KeyWords: "KeyWords",
|
||||
Overall: "Overall",
|
||||
KeyWords: "KeyWords",
|
||||
};
|
||||
|
||||
export const SmsUserFor = {
|
||||
Register: 1,
|
||||
Reset: 2,
|
||||
Login: 3,
|
||||
Register: 1,
|
||||
Reset: 2,
|
||||
Login: 3,
|
||||
};
|
||||
|
||||
export const CustomMessageStatus = {
|
||||
Success: "success",
|
||||
Cancel: "cancel",
|
||||
Canceled: "canceled",
|
||||
Refuse: "refuse",
|
||||
Refused: "refused",
|
||||
Timeout: "timeout",
|
||||
AccessByOther: "accessByOther",
|
||||
};
|
||||
Success: "success",
|
||||
Cancel: "cancel",
|
||||
Canceled: "canceled",
|
||||
Refuse: "refuse",
|
||||
Refused: "refused",
|
||||
Timeout: "timeout",
|
||||
AccessByOther: "accessByOther",
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
export const PageEvents = {
|
||||
GlobalToast: "GlobalToast",
|
||||
ScrollToBottom: "ScrollToBottom",
|
||||
RtcCall: "RtcCall"
|
||||
};
|
||||
GlobalToast: "GlobalToast",
|
||||
ScrollToBottom: "ScrollToBottom",
|
||||
RtcCall: "RtcCall"
|
||||
};
|
||||
@@ -1,51 +1,51 @@
|
||||
import { MessageType } from "openim-uniapp-polyfill";
|
||||
import {MessageType} from "openim-uniapp-polyfill";
|
||||
|
||||
export const CustomType = {
|
||||
VideoCall: "c100",
|
||||
VoiceCall: "c101",
|
||||
Call: 901,
|
||||
MassMsg: 903,
|
||||
VideoCall: "c100",
|
||||
VoiceCall: "c101",
|
||||
Call: 901,
|
||||
MassMsg: 903,
|
||||
};
|
||||
|
||||
export const Platform = {
|
||||
1: 'iOS',
|
||||
2: 'Android',
|
||||
3: 'PC',
|
||||
4: 'PC',
|
||||
5: 'Web'
|
||||
1: 'iOS',
|
||||
2: 'Android',
|
||||
3: 'PC',
|
||||
4: 'PC',
|
||||
5: 'Web'
|
||||
};
|
||||
|
||||
export const noticeMessageTypes = [
|
||||
MessageType.RevokeMessage,
|
||||
MessageType.FriendAdded,
|
||||
MessageType.GroupCreated,
|
||||
MessageType.GroupInfoUpdated,
|
||||
MessageType.MemberQuit,
|
||||
MessageType.GroupOwnerTransferred,
|
||||
MessageType.MemberKicked,
|
||||
MessageType.MemberInvited,
|
||||
MessageType.MemberEnter,
|
||||
MessageType.GroupDismissed,
|
||||
MessageType.GroupMemberMuted,
|
||||
MessageType.GroupMuted,
|
||||
MessageType.GroupCancelMuted,
|
||||
MessageType.GroupMemberCancelMuted,
|
||||
MessageType.GroupNameUpdated,
|
||||
MessageType.BurnMessageChange,
|
||||
MessageType.RevokeMessage,
|
||||
MessageType.FriendAdded,
|
||||
MessageType.GroupCreated,
|
||||
MessageType.GroupInfoUpdated,
|
||||
MessageType.MemberQuit,
|
||||
MessageType.GroupOwnerTransferred,
|
||||
MessageType.MemberKicked,
|
||||
MessageType.MemberInvited,
|
||||
MessageType.MemberEnter,
|
||||
MessageType.GroupDismissed,
|
||||
MessageType.GroupMemberMuted,
|
||||
MessageType.GroupMuted,
|
||||
MessageType.GroupCancelMuted,
|
||||
MessageType.GroupMemberCancelMuted,
|
||||
MessageType.GroupNameUpdated,
|
||||
MessageType.BurnMessageChange,
|
||||
];
|
||||
|
||||
export const GroupSystemMessageTypes = [
|
||||
MessageType.GroupCreated,
|
||||
MessageType.GroupInfoUpdated,
|
||||
MessageType.MemberQuit,
|
||||
MessageType.GroupOwnerTransferred,
|
||||
MessageType.MemberKicked,
|
||||
MessageType.MemberInvited,
|
||||
MessageType.MemberEnter,
|
||||
MessageType.GroupDismissed,
|
||||
MessageType.GroupMemberMuted,
|
||||
MessageType.GroupMuted,
|
||||
MessageType.GroupCancelMuted,
|
||||
MessageType.GroupMemberCancelMuted,
|
||||
MessageType.GroupNameUpdated
|
||||
];
|
||||
MessageType.GroupCreated,
|
||||
MessageType.GroupInfoUpdated,
|
||||
MessageType.MemberQuit,
|
||||
MessageType.GroupOwnerTransferred,
|
||||
MessageType.MemberKicked,
|
||||
MessageType.MemberInvited,
|
||||
MessageType.MemberEnter,
|
||||
MessageType.GroupDismissed,
|
||||
MessageType.GroupMemberMuted,
|
||||
MessageType.GroupMuted,
|
||||
MessageType.GroupCancelMuted,
|
||||
MessageType.GroupMemberCancelMuted,
|
||||
MessageType.GroupNameUpdated
|
||||
];
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name" : "IM-UCB",
|
||||
"name" : "探探",
|
||||
"appid" : "__UNI__F0A946D",
|
||||
"description" : "",
|
||||
"versionName" : "3.3.4",
|
||||
@@ -21,7 +21,10 @@
|
||||
"Camera" : {},
|
||||
"Record" : {},
|
||||
"Geolocation" : {},
|
||||
"Maps" : {}
|
||||
"Maps" : {},
|
||||
"Fingerprint" : {},
|
||||
"Contacts" : {},
|
||||
"Barcode" : {}
|
||||
},
|
||||
"distribute" : {
|
||||
"android" : {
|
||||
@@ -66,8 +69,18 @@
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"ad" : {},
|
||||
"geolocation" : {},
|
||||
"maps" : {},
|
||||
"geolocation" : {
|
||||
"system" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
}
|
||||
},
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"name" : "amap_18926034082bYRO97pz",
|
||||
"appkey_ios" : "cfc7b531b60382598b4aac7944415fba",
|
||||
"appkey_android" : "e431515e99e69fc1b6edb674e3487f1a"
|
||||
}
|
||||
},
|
||||
"share" : {},
|
||||
"statics" : {},
|
||||
"speech" : {}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@openim/client-sdk": "^0.0.11-ahpha.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"dayjs": "^1.11.6",
|
||||
"image-tools": "^1.4.0",
|
||||
"md5": "^2.3.0",
|
||||
"@openim/client-sdk": "^0.0.11-ahpha.1",
|
||||
"openim-uniapp-polyfill": "^1.4.1",
|
||||
"qrcode": "^1.5.4",
|
||||
"uuid": "^9.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,37 +245,61 @@
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/upgrade",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/article",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/common/webview",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/workbench/friend-circle/friend-circle",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#8E9AB0",
|
||||
"selectedColor": "#0089FF",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"color": "#171717",
|
||||
"selectedColor": "#07c160",
|
||||
"borderStyle": "#f4f4f4",
|
||||
"backgroundColor": "#f4f4f4",
|
||||
"height": "55px",
|
||||
"list": [{
|
||||
"pagePath": "pages/conversation/conversationList/index",
|
||||
"iconPath": "./static/images/tabbar_conversation.png",
|
||||
"selectedIconPath": "static/images/tabbar_conversation_active.png",
|
||||
"text": "OpenIM"
|
||||
"iconPath": "./static/images/tabbar/conversation.png",
|
||||
"selectedIconPath": "static/images/tabbar/conversation_active.png",
|
||||
"text": "消息"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/contact/index/index",
|
||||
"iconPath": "./static/images/tabbar_contacts.png",
|
||||
"selectedIconPath": "static/images/tabbar_contacts_active.png",
|
||||
"iconPath": "./static/images/tabbar/contacts.png",
|
||||
"selectedIconPath": "static/images/tabbar/contacts_active.png",
|
||||
"text": "通讯录"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/workbench/index/index",
|
||||
"iconPath": "./static/images/tabbar_workbench.png",
|
||||
"selectedIconPath": "static/images/tabbar_workbench_active.png",
|
||||
"iconPath": "./static/images/tabbar/workbench.png",
|
||||
"selectedIconPath": "static/images/tabbar/workbench_active.png",
|
||||
"text": "发现"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/profile/index/index",
|
||||
"iconPath": "./static/images/tabbar_profile.png",
|
||||
"selectedIconPath": "static/images/tabbar_profile_active.png",
|
||||
"text": "我的"
|
||||
"iconPath": "./static/images/tabbar/profile.png",
|
||||
"selectedIconPath": "static/images/tabbar/profile_active.png",
|
||||
"text": "我"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<view class="n-ps-all-base">
|
||||
<uv-parse v-if="content" :content="content"></uv-parse>
|
||||
<view class="n-flex-row" v-if="showButton" :style="{marginTop:'100rpx'}">
|
||||
<uv-button class="n-flex-1 n-ms-base" v-for="(item, idx) in buttonList" :key="idx" @click="switchButton(idx, item)" :text="item.title" :icon="'/static/image/' + item.value + '.png'" :plain="current==idx" :color="current==idx ? item.color:'#f8f8f8'" :customStyle="{height:'80rpx'}" :customTextStyle="{color:current==idx ? item.color:'#333333',marginLeft:'20rpx'}" shape="circle" color="#f8f8f8" throttleTime="1000"></uv-button>
|
||||
</view>
|
||||
<uv-empty :show="empty" icon="/static/image/empty.png" text="暂无数据~" width="200" marginTop="100"></uv-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getArticle} from '@/api/login.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
empty: false,
|
||||
content: '',
|
||||
current: null,
|
||||
questionId: 0,
|
||||
showButton: false,
|
||||
buttonList: [
|
||||
{title:'未解决', value:'unresolved', color:'#fc3463'},
|
||||
{title:'已解决', value:'resolved', color:'#5ac725'}
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad(evt) {
|
||||
if(evt.type=='config') this.setConfig(evt)
|
||||
if(evt.type=='question') this.setQuestion(evt)
|
||||
|
||||
uni.setNavigationBarTitle({title:evt.title})
|
||||
},
|
||||
methods: {
|
||||
// 设置配置内容
|
||||
setConfig(evt) {
|
||||
let config = getApp().globalData.config
|
||||
if(evt.name && config[evt.name]){
|
||||
this.content = config[evt.name]
|
||||
}else{
|
||||
this.empty = true
|
||||
}
|
||||
},
|
||||
// 设置问题内容
|
||||
setQuestion(evt) {
|
||||
this.content = evt.content
|
||||
this.questionId = evt.id
|
||||
this.showButton = true
|
||||
},
|
||||
// 切换按钮
|
||||
switchButton(idx, item) {
|
||||
this.current = idx
|
||||
getArticle({id:this.questionId,type:item.value})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,281 +1,267 @@
|
||||
<template>
|
||||
<view class="contact_choose_container">
|
||||
<custom-nav-bar title="联系人" />
|
||||
<view class="contact_choose_container">
|
||||
<custom-nav-bar title="联系人" />
|
||||
|
||||
<view class="search_bar_wrap">
|
||||
<u-search
|
||||
shape="square"
|
||||
placeholder="搜索"
|
||||
:showAction="false"
|
||||
v-model="keyword"
|
||||
/>
|
||||
</view>
|
||||
<view class="search_bar_wrap">
|
||||
<u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
|
||||
</view>
|
||||
|
||||
<view class="tab_container">
|
||||
<template v-if="activeTab === 0">
|
||||
<setting-item
|
||||
@click="tabChange(tabs[0].idx)"
|
||||
:title="tabs[0].title"
|
||||
:border="false"
|
||||
/>
|
||||
<view class="tab_container">
|
||||
<template v-if="activeTab === 0">
|
||||
<setting-item @click="tabChange(tabs[0].idx)" :title="tabs[0].title" :border="false" />
|
||||
|
||||
<view class="tab_pane"></view>
|
||||
</template>
|
||||
<view class="tab_pane"></view>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<view class="tab_pane" v-show="activeTab === 1">
|
||||
<choose-index-list
|
||||
@updateCheck="updateCheckedUser"
|
||||
:indexList="getChooseData.indexList"
|
||||
:itemArr="getChooseData.dataList"
|
||||
:checkedIDList="checkedUserIDList"
|
||||
:disabledIDList="disabledUserIDList"
|
||||
:showCheck="true"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<choose-index-footer
|
||||
:comfirmLoading="comfirmLoading"
|
||||
@removeItem="updateCheckedUserOrGroup"
|
||||
@confirm="confirm"
|
||||
:choosedData="getCheckedInfo"
|
||||
/>
|
||||
</view>
|
||||
<template v-else>
|
||||
<view class="tab_pane" v-show="activeTab === 1">
|
||||
<choose-index-list @updateCheck="updateCheckedUser" :indexList="getChooseData.indexList"
|
||||
:itemArr="getChooseData.dataList" :checkedIDList="checkedUserIDList"
|
||||
:disabledIDList="disabledUserIDList" :showCheck="true" />
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<choose-index-footer :comfirmLoading="comfirmLoading" @removeItem="updateCheckedUserOrGroup" @confirm="confirm"
|
||||
:choosedData="getCheckedInfo" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import { ContactChooseTypes } from "@/constant";
|
||||
import { formatChooseData, toastWithCallback } from "@/util/common";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import UserItem from "@/components/UserItem/index.vue";
|
||||
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
|
||||
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
import {mapGetters} from "vuex";
|
||||
import {ContactChooseTypes} from "@/constant";
|
||||
import {formatChooseData,toastWithCallback} from "@/util/common";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import UserItem from "@/components/UserItem/index.vue";
|
||||
import ChooseIndexList from "@/components/ChooseIndexList/index.vue";
|
||||
import ChooseIndexFooter from "@/components/ChooseIndexFooter/index.vue";
|
||||
import SettingItem from "@/components/SettingItem/index.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
UserItem,
|
||||
ChooseIndexList,
|
||||
ChooseIndexFooter,
|
||||
SettingItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
type: ContactChooseTypes.Card,
|
||||
activeTab: 0,
|
||||
groupID: "",
|
||||
checkedUserIDList: [],
|
||||
disabledUserIDList: [],
|
||||
comfirmLoading: false,
|
||||
tabs: [
|
||||
{
|
||||
idx: 1,
|
||||
title: "我的好友",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeFriendList",
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentUserID",
|
||||
"storeConversationList",
|
||||
]),
|
||||
getChooseData() {
|
||||
if (this.keyword) {
|
||||
return {
|
||||
indexList: ["#"],
|
||||
dataList: [
|
||||
this.storeFriendList.filter(
|
||||
(friend) =>
|
||||
friend.nickname.includes(this.keyword) ||
|
||||
friend.remark.includes(this.keyword)
|
||||
),
|
||||
],
|
||||
};
|
||||
}
|
||||
return formatChooseData(this.storeFriendList);
|
||||
},
|
||||
getCheckedInfo() {
|
||||
const tmpUserIDList = [...this.checkedUserIDList];
|
||||
const checkedFriends = this.storeFriendList.filter((friend) => {
|
||||
const idx = tmpUserIDList.findIndex(
|
||||
(userID) => userID === friend.userID
|
||||
);
|
||||
if (idx > -1) {
|
||||
tmpUserIDList.splice(idx, 1);
|
||||
}
|
||||
return idx > -1;
|
||||
});
|
||||
return [...checkedFriends];
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const {
|
||||
groupID,
|
||||
type,
|
||||
checkedUserIDList,
|
||||
} = options;
|
||||
this.type = type;
|
||||
this.groupID = groupID;
|
||||
this.checkedUserIDList = checkedUserIDList
|
||||
? JSON.parse(checkedUserIDList)
|
||||
: [];
|
||||
if (this.type === ContactChooseTypes.Invite) {
|
||||
this.checkDisabledUser();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkDisabledUser() {
|
||||
const friendIDList = this.storeFriendList.map((friend) => friend.userID);
|
||||
IMSDK.asyncApi("getUsersInGroup", IMSDK.uuid(), {
|
||||
groupID: this.groupID,
|
||||
userIDList: friendIDList,
|
||||
}).then(({ data }) => {
|
||||
this.disabledUserIDList = data;
|
||||
});
|
||||
},
|
||||
tabChange(idx) {
|
||||
this.keyword = "";
|
||||
this.activeTab = idx;
|
||||
},
|
||||
updateCheckedUserOrGroup(item) {
|
||||
if (item.userID) {
|
||||
this.updateCheckedUser(item);
|
||||
}
|
||||
},
|
||||
updateCheckedUser({ userID }) {
|
||||
if (this.checkedUserIDList.includes(userID)) {
|
||||
const idx = this.checkedUserIDList.findIndex((item) => item === userID);
|
||||
const tmpArr = [...this.checkedUserIDList];
|
||||
tmpArr.splice(idx, 1);
|
||||
this.checkedUserIDList = [...tmpArr];
|
||||
} else {
|
||||
this.checkedUserIDList = [...this.checkedUserIDList, userID];
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
if (this.activeTab) {
|
||||
this.activeTab = 0;
|
||||
return;
|
||||
}
|
||||
this.comfirmLoading = true;
|
||||
if (this.type === ContactChooseTypes.GetList) {
|
||||
let pages = getCurrentPages();
|
||||
let prevPage = pages[pages.length - 2];
|
||||
prevPage.$vm.getCheckedUsers(this.getCheckedInfo);
|
||||
this.comfirmLoading = false;
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
UserItem,
|
||||
ChooseIndexList,
|
||||
ChooseIndexFooter,
|
||||
SettingItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
type: ContactChooseTypes.Card,
|
||||
activeTab: 0,
|
||||
groupID: "",
|
||||
checkedUserIDList: [],
|
||||
disabledUserIDList: [],
|
||||
comfirmLoading: false,
|
||||
tabs: [
|
||||
{
|
||||
idx: 1,
|
||||
title: "我的好友",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"storeFriendList",
|
||||
"storeCurrentConversation",
|
||||
"storeCurrentUserID",
|
||||
"storeConversationList",
|
||||
]),
|
||||
getChooseData() {
|
||||
if (this.keyword) {
|
||||
return {
|
||||
indexList: ["#"],
|
||||
dataList: [
|
||||
this.storeFriendList.filter(
|
||||
(friend) =>
|
||||
friend.nickname.includes(this.keyword) ||
|
||||
friend.remark.includes(this.keyword)
|
||||
),
|
||||
],
|
||||
};
|
||||
}
|
||||
return formatChooseData(this.storeFriendList);
|
||||
},
|
||||
getCheckedInfo() {
|
||||
const tmpUserIDList = [...this.checkedUserIDList];
|
||||
const checkedFriends = this.storeFriendList.filter((friend) => {
|
||||
const idx = tmpUserIDList.findIndex(
|
||||
(userID) => userID === friend.userID
|
||||
);
|
||||
if (idx > -1) {
|
||||
tmpUserIDList.splice(idx, 1);
|
||||
}
|
||||
return idx > -1;
|
||||
});
|
||||
return [...checkedFriends];
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const {groupID,type,checkedUserIDList,} = options;
|
||||
console.log(this.storeFriendList);
|
||||
this.type = type;
|
||||
this.groupID = groupID;
|
||||
this.checkedUserIDList = checkedUserIDList ?
|
||||
JSON.parse(checkedUserIDList) :
|
||||
[];
|
||||
if (this.type === ContactChooseTypes.Invite) {
|
||||
this.checkDisabledUser();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkDisabledUser() {
|
||||
const friendIDList = this.storeFriendList.map((friend) => friend.userID);
|
||||
IMSDK.asyncApi("getUsersInGroup", IMSDK.uuid(), {
|
||||
groupID: this.groupID,
|
||||
userIDList: friendIDList,
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.disabledUserIDList = data;
|
||||
});
|
||||
},
|
||||
tabChange(idx) {
|
||||
this.keyword = "";
|
||||
this.activeTab = idx;
|
||||
},
|
||||
updateCheckedUserOrGroup(item) {
|
||||
if (item.userID) {
|
||||
this.updateCheckedUser(item);
|
||||
}
|
||||
},
|
||||
updateCheckedUser({
|
||||
userID
|
||||
}) {
|
||||
if (this.checkedUserIDList.includes(userID)) {
|
||||
const idx = this.checkedUserIDList.findIndex((item) => item === userID);
|
||||
const tmpArr = [...this.checkedUserIDList];
|
||||
tmpArr.splice(idx, 1);
|
||||
this.checkedUserIDList = [...tmpArr];
|
||||
} else {
|
||||
this.checkedUserIDList = [...this.checkedUserIDList, userID];
|
||||
}
|
||||
},
|
||||
confirm() {
|
||||
if (this.activeTab) {
|
||||
this.activeTab = 0;
|
||||
return;
|
||||
}
|
||||
this.comfirmLoading = true;
|
||||
if (this.type === ContactChooseTypes.GetList) {
|
||||
let pages = getCurrentPages();
|
||||
let prevPage = pages[pages.length - 2];
|
||||
prevPage.$vm.getCheckedUsers(this.getCheckedInfo);
|
||||
this.comfirmLoading = false;
|
||||
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.type === ContactChooseTypes.Invite) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.InviteUserToGroup, IMSDK.uuid(), {
|
||||
groupID: this.groupID,
|
||||
reason: "",
|
||||
userIDList: this.getCheckedInfo.map((user) => user.userID),
|
||||
})
|
||||
.then(() => {
|
||||
toastWithCallback("操作成功", () => uni.navigateBack());
|
||||
this.comfirmLoading = false;
|
||||
})
|
||||
.catch(() => toastWithCallback("操作失败"));
|
||||
return;
|
||||
}
|
||||
if (this.type === ContactChooseTypes.Invite) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.InviteUserToGroup, IMSDK.uuid(), {
|
||||
groupID: this.groupID,
|
||||
reason: "",
|
||||
userIDList: this.getCheckedInfo.map((user) => user.userID),
|
||||
})
|
||||
.then(() => {
|
||||
toastWithCallback("操作成功", () => uni.navigateBack());
|
||||
this.comfirmLoading = false;
|
||||
})
|
||||
.catch(() => toastWithCallback("操作失败"));
|
||||
return;
|
||||
}
|
||||
|
||||
this.comfirmLoading = false;
|
||||
},
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.activeTab) {
|
||||
this.activeTab = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
this.comfirmLoading = false;
|
||||
},
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.activeTab) {
|
||||
this.activeTab = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.u-popup {
|
||||
flex: none;
|
||||
}
|
||||
.contact_choose_container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.search_bar_wrap {
|
||||
height: 34px;
|
||||
padding: 12px 22px;
|
||||
}
|
||||
::v-deep.u-popup {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.tab_container {
|
||||
@include colBox(false);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
.contact_choose_container {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.setting_item {
|
||||
padding: 32rpx 36rpx;
|
||||
}
|
||||
.search_bar_wrap {
|
||||
height: 34px;
|
||||
padding: 12px 22px;
|
||||
}
|
||||
|
||||
.title {
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
// padding: 16rpx 8rpx;
|
||||
background: #f8f9fa;
|
||||
color: #8e9ab0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.tab_container {
|
||||
@include colBox(false);
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.tabs_bar {
|
||||
@include vCenterBox();
|
||||
justify-content: space-evenly;
|
||||
.setting_item {
|
||||
padding: 32rpx 36rpx;
|
||||
}
|
||||
|
||||
.tab_item {
|
||||
@include colBox(false);
|
||||
align-items: center;
|
||||
.title {
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
align-items: center;
|
||||
// padding: 16rpx 8rpx;
|
||||
background: #f8f9fa;
|
||||
color: #8e9ab0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.tabs_bar {
|
||||
@include vCenterBox();
|
||||
justify-content: space-evenly;
|
||||
|
||||
.tab_pane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
.tab_item {
|
||||
@include colBox(false);
|
||||
align-items: center;
|
||||
|
||||
.member_list {
|
||||
flex: 1;
|
||||
height: 80% !important;
|
||||
::v-deepuni-scroll-view {
|
||||
max-height: 100% !important;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user_list {
|
||||
height: 100% !important;
|
||||
}
|
||||
.tab_pane {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
|
||||
.member_anchor {
|
||||
background-color: #f8f8f8 !important;
|
||||
border: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.member_list {
|
||||
flex: 1;
|
||||
height: 80% !important;
|
||||
|
||||
::v-deepuni-scroll-view {
|
||||
max-height: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.user_list {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.member_anchor {
|
||||
background-color: #f8f8f8 !important;
|
||||
border: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -86,6 +86,7 @@
|
||||
);
|
||||
info = data[0];
|
||||
}
|
||||
console.log(info)
|
||||
if (info) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(info,)}`,
|
||||
@@ -103,7 +104,7 @@
|
||||
const {data} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetUsersInfo,
|
||||
IMSDK.uuid(),
|
||||
[res.data[0].id],
|
||||
[res.data[0].id+''],
|
||||
);
|
||||
const imData = data[0];
|
||||
|
||||
@@ -111,9 +112,9 @@
|
||||
...imData,
|
||||
...res.data[0],
|
||||
};
|
||||
console.log(info)
|
||||
}
|
||||
}
|
||||
console.log(info)
|
||||
if (info) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(info,)}`,
|
||||
@@ -123,6 +124,7 @@
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
//TODO handle the exception
|
||||
}
|
||||
this.searching = false;
|
||||
|
||||
@@ -1,125 +1,117 @@
|
||||
<template>
|
||||
<view class="request_join_container">
|
||||
<custom-nav-bar :title="isGroup ? '群聊验证' : '好友验证'">
|
||||
<view class="top_right_btn" slot="more">
|
||||
<u-button @click="sendRequest" text="发送" type="primary"></u-button>
|
||||
</view>
|
||||
</custom-nav-bar>
|
||||
<view class="request_join_container">
|
||||
<custom-nav-bar :title="isGroup ? '群聊验证' : '好友验证'">
|
||||
<view class="top_right_btn" slot="more">
|
||||
<u-button @click="sendRequest" text="发送" type="primary"></u-button>
|
||||
</view>
|
||||
</custom-nav-bar>
|
||||
|
||||
<text class="title">{{ `发送${isGroup ? "入群" : "好友"}申请` }}</text>
|
||||
<text class="title">{{ `发送${isGroup ? "入群" : "好友"}申请` }}</text>
|
||||
|
||||
<view class="input_container">
|
||||
<u--textarea
|
||||
height="120"
|
||||
v-model="reason"
|
||||
border="none"
|
||||
placeholder="请输入内容"
|
||||
maxlength="20"
|
||||
count
|
||||
>
|
||||
</u--textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="input_container">
|
||||
<u--textarea height="120" v-model="reason" border="none" placeholder="请输入内容" maxlength="20" count>
|
||||
</u--textarea>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IMSDK, { GroupJoinSource } from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import { navigateToDesignatedConversation } from "@/util/imCommon";
|
||||
import IMSDK, {GroupJoinSource} from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import {navigateToDesignatedConversation} from "@/util/imCommon";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
reason: "",
|
||||
sourceID: "",
|
||||
isGroup: false,
|
||||
isScan: false,
|
||||
notNeedVerification: false,
|
||||
sessionType: 0,
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
const { isGroup, sourceID, isScan, notNeedVerification, sessionType } =
|
||||
options;
|
||||
this.isGroup = JSON.parse(isGroup);
|
||||
this.isScan = JSON.parse(isScan);
|
||||
this.sourceID = sourceID;
|
||||
this.notNeedVerification = JSON.parse(notNeedVerification);
|
||||
this.sessionType = sessionType ?? 0;
|
||||
},
|
||||
methods: {
|
||||
sendRequest() {
|
||||
let func;
|
||||
if (this.isGroup) {
|
||||
const joinSource = this.isScan
|
||||
? GroupJoinSource.QrCode
|
||||
: GroupJoinSource.Search;
|
||||
func = IMSDK.asyncApi(IMSDK.IMMethods.JoinGroup, IMSDK.uuid(), {
|
||||
groupID: this.sourceID,
|
||||
reqMsg: this.reason,
|
||||
joinSource,
|
||||
});
|
||||
} else {
|
||||
func = IMSDK.asyncApi(IMSDK.IMMethods.AddFriend, IMSDK.uuid(), {
|
||||
toUserID: this.sourceID,
|
||||
reqMsg: this.reason,
|
||||
});
|
||||
}
|
||||
func
|
||||
.then(() => {
|
||||
uni.$u.toast(this.notNeedVerification ? "你已加入该群" : "发送成功");
|
||||
setTimeout(() => {
|
||||
if (this.notNeedVerification) {
|
||||
navigateToDesignatedConversation(
|
||||
this.sourceID,
|
||||
Number(this.sessionType),
|
||||
).catch(() => this.showToast("获取会话信息失败"));
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
uni.$u.toast("发送失败");
|
||||
});
|
||||
},
|
||||
showToast(message) {
|
||||
this.$refs.uToast.show({
|
||||
message,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
reason: "",
|
||||
sourceID: "",
|
||||
isGroup: false,
|
||||
isScan: false,
|
||||
notNeedVerification: false,
|
||||
sessionType: 0,
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
const {isGroup,sourceID,isScan,notNeedVerification,sessionType} = options;
|
||||
this.isGroup = JSON.parse(isGroup);
|
||||
this.isScan = JSON.parse(isScan);
|
||||
this.sourceID = sourceID;
|
||||
this.notNeedVerification = JSON.parse(notNeedVerification);
|
||||
this.sessionType = sessionType ?? 0;
|
||||
},
|
||||
methods: {
|
||||
sendRequest() {
|
||||
let func;
|
||||
if (this.isGroup) {
|
||||
const joinSource = this.isScan ?
|
||||
GroupJoinSource.QrCode :
|
||||
GroupJoinSource.Search;
|
||||
func = IMSDK.asyncApi(IMSDK.IMMethods.JoinGroup, IMSDK.uuid(), {
|
||||
groupID: this.sourceID,
|
||||
reqMsg: this.reason,
|
||||
joinSource,
|
||||
});
|
||||
} else {
|
||||
func = IMSDK.asyncApi(IMSDK.IMMethods.AddFriend, IMSDK.uuid(), {
|
||||
toUserID: this.sourceID,
|
||||
reqMsg: this.reason,
|
||||
});
|
||||
}
|
||||
func
|
||||
.then(() => {
|
||||
uni.$u.toast(this.notNeedVerification ? "你已加入该群" : "发送成功");
|
||||
setTimeout(() => {
|
||||
if (this.notNeedVerification) {
|
||||
navigateToDesignatedConversation(
|
||||
this.sourceID,
|
||||
Number(this.sessionType),
|
||||
).catch(() => this.showToast("获取会话信息失败"));
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
}, 1000);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
uni.$u.toast(err.errMsg || "发送失败");
|
||||
});
|
||||
},
|
||||
showToast(message) {
|
||||
this.$refs.uToast.show({
|
||||
message,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.request_join_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
.request_join_container {
|
||||
@include colBox(false);
|
||||
height: 100vh;
|
||||
background-color: #f6f6f6;
|
||||
|
||||
.top_right_btn {
|
||||
margin-right: 44rpx;
|
||||
.top_right_btn {
|
||||
margin-right: 44rpx;
|
||||
|
||||
.u-button {
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
.u-button {
|
||||
height: 48rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin: 24rpx 44rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
margin: 24rpx 44rpx;
|
||||
}
|
||||
|
||||
.input_container {
|
||||
::v-deep.u-textarea {
|
||||
padding: 24rpx 44rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.input_container {
|
||||
::v-deep.u-textarea {
|
||||
padding: 24rpx 44rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,110 @@
|
||||
<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>
|
||||
<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>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
value: 0,
|
||||
model: {
|
||||
force: 1,
|
||||
version: '1.0.0',
|
||||
content: ''
|
||||
},
|
||||
progress: false,
|
||||
download: false
|
||||
}
|
||||
},
|
||||
onLoad(evt) {
|
||||
if(evt.model){
|
||||
this.model = {...this.model, ...JSON.parse(evt.model)}
|
||||
}
|
||||
},
|
||||
onBackPress() {
|
||||
if(this.model.force==1){
|
||||
return true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 取消更新
|
||||
cancel() {
|
||||
uni.navigateBack()
|
||||
uni.setStorageSync('skip_version', this.model.version)
|
||||
},
|
||||
// 立即更新
|
||||
upgrade(){
|
||||
// 检测更新方式
|
||||
if(this.model.type==0 || this.model.type==1){
|
||||
this.downloadUpdate()
|
||||
}else{
|
||||
plus.runtime.openURL(this.model.source_text)
|
||||
}
|
||||
},
|
||||
// 下载更新
|
||||
downloadUpdate() {
|
||||
if(!this.download){
|
||||
this.progress = true
|
||||
this.download = true
|
||||
// 下载安装包
|
||||
const download = uni.downloadFile({
|
||||
url: this.model.source_text,
|
||||
success: result=>{
|
||||
// 自动安装软件
|
||||
plus.runtime.install(result.tempFilePath, {force:true}, ()=>{
|
||||
// 防止强制更新无法关闭界面
|
||||
this.model.force = 0
|
||||
if(this.model.type==1){
|
||||
uni.showToast({
|
||||
title:'更新成功,软件重启'
|
||||
})
|
||||
setTimeout(()=>{ plus.runtime.restart() }, 1500)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: error=>{
|
||||
uni.showToast({
|
||||
title:'下载失败,请检查您的网络情况'
|
||||
})
|
||||
}
|
||||
})
|
||||
// 监听下载进度
|
||||
download.onProgressUpdate(result=>{
|
||||
this.value = result.progress
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.m-shade{
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
</style>
|
||||
@@ -15,7 +15,11 @@
|
||||
<u-button type="primary" icon="man-add" text="添加"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="info_row">
|
||||
<user-info-row-item lable="性别" :content="getGender" />
|
||||
<user-info-row-item lable="生日" :content="getBirth" />
|
||||
<user-info-row-item lable="个性签名" :content="sourceUserInfo.bio" />
|
||||
</view>
|
||||
<view v-if="isFriend" class="info_row">
|
||||
<user-info-row-item @click="toMoreInfo" lable="个人资料" arrow />
|
||||
</view>
|
||||
@@ -31,21 +35,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import {
|
||||
navigateToDesignatedConversation
|
||||
} from "@/util/imCommon";
|
||||
import IMSDK, {
|
||||
SessionType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {mapGetters} from "vuex";
|
||||
import {navigateToDesignatedConversation} from "@/util/imCommon";
|
||||
import IMSDK, {SessionType,} from "openim-uniapp-polyfill";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import UserInfoRowItem from "./components/UserInfoRowItem.vue";
|
||||
import {
|
||||
businessSearchUserInfo
|
||||
} from "@/api/login";
|
||||
import {businessSearchUserInfo} from "@/api/login";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -67,6 +64,19 @@
|
||||
"storeFriendList",
|
||||
"storeSelfInfo",
|
||||
]),
|
||||
getGender() {
|
||||
if (this.sourceUserInfo.sex === 0) {
|
||||
return "保密";
|
||||
}
|
||||
if (this.sourceUserInfo.sex === 1) {
|
||||
return "男";
|
||||
}
|
||||
return "女";
|
||||
},
|
||||
getBirth() {
|
||||
const birth = this.sourceUserInfo.birthday ?? 0;
|
||||
return dayjs(birth).format("YYYY-MM-DD");
|
||||
},
|
||||
isFriend() {
|
||||
return (
|
||||
this.storeFriendList.findIndex(
|
||||
@@ -142,7 +152,7 @@
|
||||
} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetUsersInfo,
|
||||
IMSDK.uuid(),
|
||||
[this.sourceID],
|
||||
[this.sourceID+''],
|
||||
);
|
||||
const imData = data[0]?.friendInfo ?? data[0]?.publicInfo ?? {};
|
||||
info = {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<web-view :src="linkUrl"></web-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
linkUrl: "",
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.linkUrl = 'https://doc.rentsoft.cn/'
|
||||
},
|
||||
onReady() {
|
||||
// #ifdef APP-PLUS
|
||||
setTimeout(() => {
|
||||
this.$scope
|
||||
.$getAppWebview()
|
||||
.children()[0]
|
||||
.setStyle({
|
||||
top: uni.getWindowInfo().statusBarHeight,
|
||||
height: uni.getWindowInfo().safeArea.height,
|
||||
});
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,74 +1,74 @@
|
||||
<template>
|
||||
<view class="action_item" @click="onClick">
|
||||
<slot name="icon">
|
||||
<view class="action_icon">
|
||||
<image :src="action.icon" mode=""></image>
|
||||
</view>
|
||||
</slot>
|
||||
<view class="action_item" @click="onClick">
|
||||
<slot name="icon">
|
||||
<view class="action_icon">
|
||||
<image :src="action.icon" mode=""></image>
|
||||
</view>
|
||||
</slot>
|
||||
|
||||
<view class="action_details">
|
||||
<text class="title">{{ action.title }}</text>
|
||||
<text class="desc">{{ action.desc }}</text>
|
||||
<view class="bottom_line"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action_details">
|
||||
<text class="title">{{ action.title }}</text>
|
||||
<text class="desc">{{ action.desc }}</text>
|
||||
<view class="bottom_line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "",
|
||||
props: {
|
||||
action: Object,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit("click", this.action);
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
name: "",
|
||||
props: {
|
||||
action: Object,
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit("click", this.action);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.action_item {
|
||||
@include vCenterBox();
|
||||
padding: 24rpx 44rpx;
|
||||
.action_item {
|
||||
@include vCenterBox();
|
||||
padding: 24rpx 44rpx;
|
||||
|
||||
.action_icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
.action_icon {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
|
||||
image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.action_details {
|
||||
@include colBox(false);
|
||||
margin-left: 48rpx;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
.action_details {
|
||||
@include colBox(false);
|
||||
margin-left: 48rpx;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
font-weight: 500;
|
||||
padding-bottom: 12rpx;
|
||||
}
|
||||
.title {
|
||||
font-weight: 500;
|
||||
padding-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.bottom_line {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
background-color: #f0f0f0;
|
||||
position: absolute;
|
||||
bottom: -24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.bottom_line {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
background-color: #f0f0f0;
|
||||
position: absolute;
|
||||
bottom: -24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,101 +1,91 @@
|
||||
<template>
|
||||
<view class="contact_add_container">
|
||||
<custom-nav-bar title="添加" />
|
||||
<view class="contact_add_container">
|
||||
<custom-nav-bar title="添加" />
|
||||
|
||||
<view class="action_row">
|
||||
<action-item
|
||||
@click="friendAction(item)"
|
||||
v-for="item in friendActionMenus"
|
||||
:action="item"
|
||||
:key="item.idx"
|
||||
/>
|
||||
<action-item
|
||||
@click="groupAction(item)"
|
||||
v-for="item in groupActionMenus"
|
||||
:action="item"
|
||||
:key="item.idx"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="action_row">
|
||||
<action-item @click="friendAction(item)" v-for="item in friendActionMenus" :action="item" :key="'f_'+item.idx" />
|
||||
<action-item @click="groupAction(item)" v-for="item in groupActionMenus" :action="item" :key="'g_'+item.idx" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import ActionItem from "./ActionItem.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
ActionItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupActionMenus: [
|
||||
{
|
||||
idx: 0,
|
||||
title: "创建群聊",
|
||||
desc: "创建群聊,全面使用OpenIM",
|
||||
icon: require("static/images/contact_add_create_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 1,
|
||||
title: "添加群聊",
|
||||
desc: "向管理员或团队成员询问ID",
|
||||
icon: require("static/images/contact_add_join_group.png"),
|
||||
},
|
||||
],
|
||||
friendActionMenus: [
|
||||
{
|
||||
idx: 0,
|
||||
title: "添加好友",
|
||||
desc: "通过手机号/ID号/搜索添加",
|
||||
icon: require("static/images/contact_add_search_user.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
groupAction({ idx }) {
|
||||
if (idx === 0) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/contact/switchJoinGroup/index",
|
||||
});
|
||||
}
|
||||
},
|
||||
friendAction({ idx }) {
|
||||
if (!idx) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/searchUserOrGroup/index?isSearchGroup=false",
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import ActionItem from "./ActionItem.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
ActionItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupActionMenus: [
|
||||
{
|
||||
idx: 0,
|
||||
title: "创建群聊",
|
||||
desc: "创建群聊,全面使用OpenIM",
|
||||
icon: require("static/images/contact_add_create_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 1,
|
||||
title: "添加群聊",
|
||||
desc: "向管理员或团队成员询问ID",
|
||||
icon: require("static/images/contact_add_join_group.png"),
|
||||
},
|
||||
],
|
||||
friendActionMenus: [
|
||||
{
|
||||
idx: 0,
|
||||
title: "添加好友",
|
||||
desc: "通过手机号/ID号/搜索添加",
|
||||
icon: require("static/images/contact_add_search_user.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
groupAction({idx}) {
|
||||
if (idx === 0) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: "/pages/contact/switchJoinGroup/index",
|
||||
});
|
||||
}
|
||||
},
|
||||
friendAction({idx}) {
|
||||
if (!idx) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/common/searchUserOrGroup/index?isSearchGroup=false",
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contact_add_container {
|
||||
height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
.contact_add_container {
|
||||
height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
|
||||
.desc_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
padding: 24rpx 44rpx;
|
||||
}
|
||||
.desc_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
padding: 24rpx 44rpx;
|
||||
}
|
||||
|
||||
.action_row {
|
||||
margin-top: 24rpx;
|
||||
background-color: #fff;
|
||||
.action_row {
|
||||
margin-top: 24rpx;
|
||||
background-color: #fff;
|
||||
|
||||
.action_item:last-child {
|
||||
.bottom_line {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.action_item:last-child {
|
||||
.bottom_line {
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,80 +1,112 @@
|
||||
<template>
|
||||
<view class="chat_action_bar">
|
||||
<u-row class="action_row">
|
||||
<u-col
|
||||
v-for="item in actionList"
|
||||
:key="item.idx"
|
||||
@click="actionClick(item)"
|
||||
span="3"
|
||||
>
|
||||
<view class="action_item">
|
||||
<image :src="item.icon" alt="" srcset="" />
|
||||
<text class="action_item_title">{{ item.title }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
<view class="chat_action_bar">
|
||||
<u-row class="action_row">
|
||||
<u-col v-for="item in actionList" :key="item.idx" @click="actionClick(item)" span="3">
|
||||
<view class="action_item">
|
||||
<image :src="item.icon" alt="" srcset="" />
|
||||
<text class="action_item_title">{{ item.title }}</text>
|
||||
</view>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
ChatingFooterActionTypes,
|
||||
} from "@/constant";
|
||||
import {ChatingFooterActionTypes,} from "@/constant";
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
actionList: [
|
||||
{
|
||||
idx: 0,
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
title: "相册",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
}
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async actionClick(action) {
|
||||
switch (action.type) {
|
||||
case ChatingFooterActionTypes.Album:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
actionList: [
|
||||
{
|
||||
idx: 0,
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
title: "照片",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 1,
|
||||
type: ChatingFooterActionTypes.Camera,
|
||||
title: "拍摄",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
type: ChatingFooterActionTypes.Video,
|
||||
title: "视频通话",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
type: ChatingFooterActionTypes.Location,
|
||||
title: "位置",
|
||||
icon: require("static/images/chating_action_image.png"),
|
||||
},
|
||||
// {
|
||||
// idx: 0,
|
||||
// type: ChatingFooterActionTypes.Album,
|
||||
// title: "红包",
|
||||
// icon: require("static/images/chating_action_image.png"),
|
||||
// },
|
||||
// {
|
||||
// idx: 0,
|
||||
// type: ChatingFooterActionTypes.Album,
|
||||
// title: "转账",
|
||||
// icon: require("static/images/chating_action_image.png"),
|
||||
// }
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async actionClick(action) {
|
||||
switch (action.type) {
|
||||
case ChatingFooterActionTypes.Video:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Album:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Camera:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
case ChatingFooterActionTypes.Location:
|
||||
this.$emit("prepareMediaMessage", action.type);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.chat_action_bar {
|
||||
position: relative;
|
||||
background: #f0f2f6;
|
||||
padding: 24rpx 36rpx;
|
||||
.chat_action_bar {
|
||||
position: relative;
|
||||
background: #f0f2f6;
|
||||
padding: 24rpx 36rpx;
|
||||
|
||||
.action_row {
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.action_row {
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.action_item {
|
||||
@include centerBox();
|
||||
flex-direction: column;
|
||||
margin-top: 24rpx;
|
||||
.action_item {
|
||||
@include centerBox();
|
||||
flex-direction: column;
|
||||
margin-top: 24rpx;
|
||||
|
||||
image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
image {
|
||||
width: 96rpx;
|
||||
height: 96rpx;
|
||||
}
|
||||
|
||||
&_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
&_title {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -25,40 +25,26 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import {
|
||||
getPurePath,
|
||||
html2Text
|
||||
} from "@/util/common";
|
||||
import {
|
||||
offlinePushInfo
|
||||
} from "@/util/imCommon";
|
||||
import {
|
||||
ChatingFooterActionTypes,
|
||||
UpdateMessageTypes,
|
||||
} from "@/constant";
|
||||
import IMSDK, {
|
||||
IMMethods,
|
||||
MessageStatus,
|
||||
MessageType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {mapGetters,mapActions} from "vuex";
|
||||
import {getPurePath,html2Text} from "@/util/common";
|
||||
import {offlinePushInfo} from "@/util/imCommon";
|
||||
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
|
||||
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
|
||||
import UParse from "@/components/gaoyia-parse/parse.vue";
|
||||
import CustomEditor from "./CustomEditor.vue";
|
||||
import ChatingActionBar from "./ChatingActionBar.vue";
|
||||
|
||||
const needClearTypes = [MessageType.TextMessage];
|
||||
|
||||
const albumChoose = [{
|
||||
name: "图片",
|
||||
type: ChatingFooterActionTypes.Album,
|
||||
const rtcChoose = [
|
||||
{
|
||||
name: "视频通话",
|
||||
type: ChatingFooterActionTypes.Video,
|
||||
idx: 0,
|
||||
},
|
||||
{
|
||||
name: "拍照",
|
||||
type: ChatingFooterActionTypes.Camera,
|
||||
name: "语言通话",
|
||||
type: ChatingFooterActionTypes.Voice,
|
||||
idx: 1,
|
||||
},
|
||||
];
|
||||
@@ -133,23 +119,19 @@
|
||||
message,
|
||||
offlinePushInfo,
|
||||
})
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
.then(({data}) => {
|
||||
this.updateOneMessage({
|
||||
message: data,
|
||||
isSuccess: true,
|
||||
});
|
||||
})
|
||||
.catch(({
|
||||
data,
|
||||
errCode,
|
||||
errMsg
|
||||
}) => {
|
||||
.catch(({data,errCode,errMsg}) => {
|
||||
uni.$u.toast(errMsg);
|
||||
this.updateOneMessage({
|
||||
message: data,
|
||||
type: UpdateMessageTypes.KeyWords,
|
||||
keyWords: [{
|
||||
keyWords: [
|
||||
{
|
||||
key: "status",
|
||||
value: MessageStatus.Failed,
|
||||
},
|
||||
@@ -186,14 +168,62 @@
|
||||
this.inputHtml = e.detail.html;
|
||||
},
|
||||
prepareMediaMessage(type) {
|
||||
if (type === ChatingFooterActionTypes.Album) {
|
||||
this.actionSheetMenu = [...albumChoose];
|
||||
console.log(type)
|
||||
if (type === ChatingFooterActionTypes.Video) {
|
||||
this.actionSheetMenu = [...rtcChoose];
|
||||
this.showActionSheet = true;
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Album) {
|
||||
this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Camera) {
|
||||
this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
}
|
||||
if (type === ChatingFooterActionTypes.Location) {
|
||||
uni.chooseLocation({
|
||||
complete(res) {
|
||||
console.log(res);
|
||||
},
|
||||
fail(res) {
|
||||
console.log(res);
|
||||
}
|
||||
//latitude:1,
|
||||
//longitude:1,
|
||||
})
|
||||
}
|
||||
this.showActionSheet = true;
|
||||
},
|
||||
|
||||
// from comp
|
||||
batchCreateImageMesage(paths) {
|
||||
/*
|
||||
createAdvancedTextMessage
|
||||
createTextAtMessage
|
||||
createLocationMessage
|
||||
createTextMessage
|
||||
createCustomMessage
|
||||
createQuoteMessage
|
||||
createAdvancedQuoteMessage
|
||||
createCardMessage
|
||||
createImageMessage
|
||||
createImageMessage
|
||||
createImageMessageByURL
|
||||
createSoundMessage
|
||||
createSoundMessageFromFullPath
|
||||
createSoundMessageByURL
|
||||
createVideoMessage
|
||||
createVideoMessageFromFullPath
|
||||
createVideoMessageByURL
|
||||
createFileMessage
|
||||
createFileMessageFromFullPath
|
||||
createFileMessageByURL
|
||||
createMergerMessage
|
||||
createFaceMessage
|
||||
createForwardMessage
|
||||
*/
|
||||
paths.forEach(async (path) => {
|
||||
const message = await IMSDK.asyncApi(
|
||||
IMMethods.CreateImageMessageFromFullPath,
|
||||
@@ -203,17 +233,19 @@
|
||||
this.sendMessage(message);
|
||||
});
|
||||
},
|
||||
selectClick({
|
||||
idx
|
||||
}) {
|
||||
selectClick({idx}) {
|
||||
if (idx === 0) {
|
||||
this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
uni.$u.toast('根据相关政策,暂时禁用视频通话');
|
||||
//发送视频通话
|
||||
// this.chooseOrShotImage(["album"]).then((paths) =>
|
||||
// this.batchCreateImageMesage(paths)
|
||||
// );
|
||||
} else {
|
||||
this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
this.batchCreateImageMesage(paths)
|
||||
);
|
||||
uni.$u.toast('根据相关政策,暂时禁用音频通话');
|
||||
//发送音频通话
|
||||
// this.chooseOrShotImage(["camera"]).then((paths) =>
|
||||
// this.batchCreateImageMesage(paths)
|
||||
// );
|
||||
}
|
||||
},
|
||||
chooseOrShotImage(sourceType) {
|
||||
@@ -222,9 +254,7 @@
|
||||
count: 9,
|
||||
sizeType: ["compressed"],
|
||||
sourceType,
|
||||
success: function({
|
||||
tempFilePaths
|
||||
}) {
|
||||
success: function({tempFilePaths}) {
|
||||
resolve(tempFilePaths);
|
||||
},
|
||||
fail: function(err) {
|
||||
@@ -236,9 +266,7 @@
|
||||
},
|
||||
|
||||
// keyboard
|
||||
keyboardChangeHander({
|
||||
height
|
||||
}) {
|
||||
keyboardChangeHander({height}) {
|
||||
if (height > 0) {
|
||||
if (this.actionBarVisible) {
|
||||
this.actionBarVisible = false;
|
||||
|
||||
@@ -1,329 +1,301 @@
|
||||
<template>
|
||||
<view class="chat_header">
|
||||
<view class="self_info">
|
||||
<my-avatar
|
||||
:src="storeSelfInfo.faceURL"
|
||||
:desc="storeSelfInfo.nickname"
|
||||
size="46"
|
||||
/>
|
||||
<view class="self_info_desc">
|
||||
<view class="user_state">
|
||||
<text class="nickname">{{ storeSelfInfo.nickname }}</text>
|
||||
<view v-if="!storeReinstall">
|
||||
<view class="tag" v-if="storeIsSyncing">
|
||||
<img
|
||||
class="loading"
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/loading.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">同步中</text>
|
||||
</view>
|
||||
<view class="tag" v-if="connectStart == 0">
|
||||
<img
|
||||
class="loading"
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/loading.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">连接中</text>
|
||||
</view>
|
||||
<view class="err-tag" v-if="connectStart == -1">
|
||||
<img
|
||||
style="height: 24rpx; width: 24rpx"
|
||||
src="static/images/sync_error.png"
|
||||
alt=""
|
||||
/>
|
||||
<text class="status">连接失败</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_action">
|
||||
<view class="call_icon"> </view>
|
||||
<view @click="showMore" class="more_icon">
|
||||
<image src="@/static/images/common_circle_add.png"></image>
|
||||
</view>
|
||||
<u-overlay
|
||||
:show="moreMenuVisible"
|
||||
@click="moreMenuVisible = false"
|
||||
opacity="0"
|
||||
>
|
||||
<view
|
||||
:style="{ top: popMenuPosition.top, right: popMenuPosition.right }"
|
||||
class="more_menu"
|
||||
>
|
||||
<view
|
||||
@click="clickMenu(item)"
|
||||
v-for="item in moreMenus"
|
||||
:key="item.idx"
|
||||
class="menu_item"
|
||||
>
|
||||
<image :src="item.icon" mode=""></image>
|
||||
<text>{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
<view class="chat_header">
|
||||
<view class="self_info">
|
||||
<my-avatar :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname" size="46" />
|
||||
<view class="self_info_desc">
|
||||
<view class="user_state">
|
||||
<text class="nickname">{{ storeSelfInfo.nickname }}</text>
|
||||
<view v-if="!storeReinstall">
|
||||
<view class="tag" v-if="storeIsSyncing">
|
||||
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
|
||||
alt="" />
|
||||
<text class="status">同步中</text>
|
||||
</view>
|
||||
<view class="tag" v-if="connectStart == 0">
|
||||
<img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
|
||||
alt="" />
|
||||
<text class="status">连接中</text>
|
||||
</view>
|
||||
<view class="err-tag" v-if="connectStart == -1">
|
||||
<img style="height: 24rpx; width: 24rpx" src="static/images/sync_error.png" alt="" />
|
||||
<text class="status">连接失败</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_action">
|
||||
<view class="call_icon"> </view>
|
||||
<view @click="showMore" class="more_icon">
|
||||
<image src="@/static/images/common_circle_add.png"></image>
|
||||
</view>
|
||||
<u-overlay :show="moreMenuVisible" @click="moreMenuVisible = false" opacity="0">
|
||||
<view :style="{ top: popMenuPosition.top, right: popMenuPosition.right }" class="more_menu">
|
||||
<view @click="clickMenu(item)" v-for="item in moreMenus" :key="item.idx" class="menu_item">
|
||||
<image :src="item.icon" mode=""></image>
|
||||
<text>{{ item.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-overlay>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
name: "ChatHeader",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
connectStart: -2,
|
||||
moreMenuVisible: false,
|
||||
popMenuPosition: {
|
||||
top: 0,
|
||||
right: 0,
|
||||
},
|
||||
moreMenus: [
|
||||
{
|
||||
idx: 1,
|
||||
title: "添加好友",
|
||||
icon: require("static/images/more_add_friend.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
title: "添加群聊",
|
||||
icon: require("static/images/more_add_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
title: "创建群聊",
|
||||
icon: require("static/images/more_create_group.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeSelfInfo", "storeIsSyncing", "storeReinstall"]),
|
||||
},
|
||||
mounted() {
|
||||
this.subscribeAll();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.unsubscribeAll();
|
||||
},
|
||||
methods: {
|
||||
setStateStart() {
|
||||
this.connectStart = 0;
|
||||
},
|
||||
setStateSuccess() {
|
||||
this.connectStart = 1;
|
||||
},
|
||||
setStateError() {
|
||||
this.connectStart = -1;
|
||||
},
|
||||
subscribeAll() {
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
unsubscribeAll() {
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
clickMenu({ idx }) {
|
||||
switch (idx) {
|
||||
case 1:
|
||||
case 2:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${
|
||||
idx === 2
|
||||
}`,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async showMore() {
|
||||
const { right, bottom } = await this.getEl(".more_icon");
|
||||
this.popMenuPosition.right =
|
||||
uni.getWindowInfo().windowWidth - right + "px";
|
||||
this.popMenuPosition.top = bottom + "px";
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
getEl(el) {
|
||||
return new Promise((resolve) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query
|
||||
.select(el)
|
||||
.boundingClientRect((data) => {
|
||||
// 存在data,且存在宽和高,视为渲染完毕
|
||||
resolve(data);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
export default {
|
||||
name: "ChatHeader",
|
||||
components: {
|
||||
MyAvatar,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
connectStart: -2,
|
||||
moreMenuVisible: false,
|
||||
popMenuPosition: {
|
||||
top: 0,
|
||||
right: 0,
|
||||
},
|
||||
moreMenus: [{
|
||||
idx: 1,
|
||||
title: "添加好友",
|
||||
icon: require("static/images/more_add_friend.png"),
|
||||
},
|
||||
{
|
||||
idx: 2,
|
||||
title: "添加群聊",
|
||||
icon: require("static/images/more_add_group.png"),
|
||||
},
|
||||
{
|
||||
idx: 3,
|
||||
title: "创建群聊",
|
||||
icon: require("static/images/more_create_group.png"),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["storeSelfInfo", "storeIsSyncing", "storeReinstall"]),
|
||||
},
|
||||
mounted() {
|
||||
this.subscribeAll();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.unsubscribeAll();
|
||||
},
|
||||
methods: {
|
||||
setStateStart() {
|
||||
this.connectStart = 0;
|
||||
},
|
||||
setStateSuccess() {
|
||||
this.connectStart = 1;
|
||||
},
|
||||
setStateError() {
|
||||
this.connectStart = -1;
|
||||
},
|
||||
subscribeAll() {
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.subscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
unsubscribeAll() {
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnecting, this.setStateStart);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectSuccess, this.setStateSuccess);
|
||||
IMSDK.unsubscribe(IMSDK.IMEvents.OnConnectFailed, this.setStateError);
|
||||
},
|
||||
clickMenu({idx}) {
|
||||
switch (idx) {
|
||||
case 1:
|
||||
case 2:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${idx === 2}`,
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/createGroup/index`,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
async showMore() {
|
||||
const {right,bottom} = await this.getEl(".more_icon");
|
||||
this.popMenuPosition.right =
|
||||
uni.getWindowInfo().windowWidth - right + "px";
|
||||
this.popMenuPosition.top = bottom + "px";
|
||||
this.moreMenuVisible = true;
|
||||
},
|
||||
getEl(el) {
|
||||
return new Promise((resolve) => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query
|
||||
.select(el)
|
||||
.boundingClientRect((data) => {
|
||||
// 存在data,且存在宽和高,视为渲染完毕
|
||||
resolve(data);
|
||||
})
|
||||
.exec();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
@keyframes loading {
|
||||
0% {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.chat_header {
|
||||
@include btwBox();
|
||||
padding: 36rpx 44rpx;
|
||||
margin-top: var(--status-bar-height);
|
||||
.chat_header {
|
||||
@include btwBox();
|
||||
padding: 36rpx 44rpx;
|
||||
margin-top: var(--status-bar-height);
|
||||
|
||||
.self_info {
|
||||
@include btwBox();
|
||||
.self_info {
|
||||
@include btwBox();
|
||||
|
||||
&_desc {
|
||||
@include colBox(true);
|
||||
margin-left: 24rpx;
|
||||
color: $uni-text-color;
|
||||
&_desc {
|
||||
@include colBox(true);
|
||||
margin-left: 24rpx;
|
||||
color: $uni-text-color;
|
||||
|
||||
.company {
|
||||
@include nomalEllipsis();
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
max-width: 300rpx;
|
||||
}
|
||||
.company {
|
||||
@include nomalEllipsis();
|
||||
font-size: 24rpx;
|
||||
margin-bottom: 10rpx;
|
||||
max-width: 300rpx;
|
||||
}
|
||||
|
||||
.user_state {
|
||||
@include vCenterBox();
|
||||
.user_state {
|
||||
@include vCenterBox();
|
||||
|
||||
.nickname {
|
||||
@include nomalEllipsis();
|
||||
font-size: 26rpx;
|
||||
max-width: 240rpx;
|
||||
}
|
||||
.nickname {
|
||||
@include nomalEllipsis();
|
||||
font-size: 26rpx;
|
||||
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;
|
||||
}
|
||||
}
|
||||
.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;
|
||||
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #ff381f;
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
.tag {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 152rpx;
|
||||
height: 44rpx;
|
||||
background: #f2f8ff;
|
||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||
margin-left: 8rpx;
|
||||
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
.loading {
|
||||
animation: loading 1.5s infinite;
|
||||
}
|
||||
|
||||
.online_state {
|
||||
@include vCenterBox();
|
||||
margin-left: 24rpx;
|
||||
font-size: 24rpx;
|
||||
.status {
|
||||
font-size: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
font-weight: 400;
|
||||
color: #0089ff;
|
||||
}
|
||||
}
|
||||
|
||||
.dot {
|
||||
background-color: #10cc64;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.online_state {
|
||||
@include vCenterBox();
|
||||
margin-left: 24rpx;
|
||||
font-size: 24rpx;
|
||||
|
||||
.right_action {
|
||||
display: flex;
|
||||
position: relative;
|
||||
.dot {
|
||||
background-color: #10cc64;
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.call_icon {
|
||||
margin-right: 24rpx;
|
||||
.right_action {
|
||||
display: flex;
|
||||
position: relative;
|
||||
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
.call_icon {
|
||||
margin-right: 24rpx;
|
||||
|
||||
.more_icon {
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
// bottom: 0;
|
||||
// left: 100%;
|
||||
z-index: 999;
|
||||
// transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
.more_icon {
|
||||
image {
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.menu_item {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
.more_menu {
|
||||
position: absolute;
|
||||
// bottom: 0;
|
||||
// left: 100%;
|
||||
z-index: 999;
|
||||
// transform: translate(-100%, 100%);
|
||||
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.16);
|
||||
width: max-content;
|
||||
border-radius: 12rpx;
|
||||
background-color: #fff;
|
||||
|
||||
image {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.menu_item {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 20rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
image {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,34 +1,31 @@
|
||||
<template>
|
||||
<view @tap.prevent="clickConversationItem" class="conversation_item">
|
||||
<view class="pinned" v-if="source.isPinned"></view>
|
||||
<view @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="details">
|
||||
<text class="conversation_name">{{ source.showName }}</text>
|
||||
<view class="title">
|
||||
<text class="conversation_name">
|
||||
{{ source.showName }}
|
||||
</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">
|
||||
<text class="lastest_msg_content">{{ latestMessage }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right_desc">
|
||||
<text class="send_time">{{ latestMessageTime }}</text>
|
||||
<u-badge max="99" :value="source.unreadCount"></u-badge>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
SessionType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import {SessionType,} from "openim-uniapp-polyfill";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import UParse from "@/components/gaoyia-parse/parse.vue";
|
||||
import {
|
||||
getConversationContent,
|
||||
formatConversionTime,
|
||||
prepareConversationState,
|
||||
} from "@/util/imCommon";
|
||||
import {getConversationContent,formatConversionTime,prepareConversationState,} from "@/util/imCommon";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -81,6 +78,9 @@
|
||||
flex-direction: row;
|
||||
padding: 12rpx 44rpx 20rpx;
|
||||
position: relative;
|
||||
&.pinned{
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
&_active {
|
||||
background-color: #f3f3f3;
|
||||
@@ -88,17 +88,41 @@
|
||||
|
||||
.left_info {
|
||||
@include btwBox();
|
||||
flex:1;
|
||||
|
||||
.details {
|
||||
@include colBox(true);
|
||||
flex:1;
|
||||
margin-left: 24rpx;
|
||||
height: 46px;
|
||||
color: $uni-text-color;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom:20rpx;
|
||||
.title{
|
||||
@include btwBox();
|
||||
.conversation_name {
|
||||
@include nomalEllipsis();
|
||||
max-width: 40vw;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.conversation_name {
|
||||
@include nomalEllipsis();
|
||||
max-width: 40vw;
|
||||
font-size: 28rpx;
|
||||
.right_desc {
|
||||
@include colBox(true);
|
||||
align-items: flex-end;
|
||||
width: max-content;
|
||||
justify-content: space-between;
|
||||
|
||||
.send_time {
|
||||
width: max-content;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.u-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.lastest_msg_wrap {
|
||||
@@ -125,32 +149,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right_desc {
|
||||
@include colBox(true);
|
||||
align-items: flex-end;
|
||||
width: max-content;
|
||||
justify-content: space-between;
|
||||
height: 46px;
|
||||
|
||||
.send_time {
|
||||
width: max-content;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.u-badge {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
|
||||
.pinned {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 24rpx;
|
||||
width: 17rpx;
|
||||
height: 17rpx;
|
||||
background-image: linear-gradient(to bottom left, #314ffe 50%, white 50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,10 +7,10 @@
|
||||
</view>
|
||||
<u-tabs :list="list" :current="active" @click="click"></u-tabs>
|
||||
<u-form class="loginForm" labelPosition="top" :model="loginInfo" :labelStyle="{
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
width: 'max-content',
|
||||
}" ref="loginForm">
|
||||
fontSize: '14px',
|
||||
marginTop: '20rpx',
|
||||
width: 'max-content',
|
||||
}" ref="loginForm">
|
||||
<u-form-item v-if="active === 0" label="" prop="phoneNumber">
|
||||
<u-input v-model="loginInfo.phoneNumber" border="surround" placeholder="请输入手机号码" clearable>
|
||||
<view slot="prefix" class="phoneNumber_areacode" @click="showPicker">
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<view class="action_bar">
|
||||
<text>还没有账号?<text class="register" @click="toRegisterOrForget(true)">立即注册</text></text>
|
||||
<text style="margin-bottom: 16rpx" @click="copy">{{ v }}</text>
|
||||
<text style="margin-bottom: 16rpx" @click="copy">{{ appversion }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -62,7 +62,6 @@
|
||||
import { mapGetters } from "vuex";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import md5 from "md5";
|
||||
import { version } from '@/common/config'
|
||||
import { businessLogin, businessSendSms } from "@/api/login";
|
||||
import AreaPicker from "@/components/AreaPicker";
|
||||
import { checkLoginError } from "@/util/common";
|
||||
@@ -89,6 +88,7 @@
|
||||
areaCode: "86",
|
||||
verificationCode: "",
|
||||
},
|
||||
appversion:0,
|
||||
eying: false,
|
||||
loading: false,
|
||||
count: 0,
|
||||
@@ -97,12 +97,7 @@
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
"config",
|
||||
]),
|
||||
v() {
|
||||
return this.config.name+' '+version
|
||||
},
|
||||
...mapGetters(["config"]),
|
||||
canLogin() {
|
||||
return (
|
||||
(this.loginInfo.phoneNumber || this.loginInfo.email) &&
|
||||
@@ -111,16 +106,18 @@
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
const _this = this;
|
||||
plus.runtime.getProperty(plus.runtime.appid,(inf) => {
|
||||
console.log(inf);
|
||||
_this.appversion = inf.version
|
||||
});
|
||||
// if(options.isRedirect){
|
||||
// plus.navigator.closeSplashscreen();
|
||||
// }
|
||||
this.version = version
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
click({
|
||||
index
|
||||
}) {
|
||||
click({index}) {
|
||||
this.active = index;
|
||||
},
|
||||
copy() {
|
||||
@@ -164,14 +161,11 @@
|
||||
email: this.loginInfo.email,
|
||||
areaCode: `+${this.loginInfo.areaCode}`,
|
||||
password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
platform: uni.$u.os(),
|
||||
type: this.active === 0 ? 'mobile' : 'email',
|
||||
code: this.loginInfo.verificationCode,
|
||||
});
|
||||
const {
|
||||
imToken,
|
||||
userID
|
||||
} = data;
|
||||
const {imToken,userID} = data;
|
||||
await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
|
||||
userID,
|
||||
token: imToken,
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
code: this.codeValue,
|
||||
password: this.formData.password,
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
platform: uni.$u.os(),
|
||||
operationID: Date.now() + "",
|
||||
};
|
||||
businessReset(options)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</u-form>
|
||||
<view class="btn">
|
||||
<u-button :loading="loading" type="primary" @click="doNext">
|
||||
进入OpenIM
|
||||
进入{{config.name}}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -36,12 +36,9 @@
|
||||
<script>
|
||||
import md5 from "md5";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import {
|
||||
businessRegister
|
||||
} from "@/api/login";
|
||||
import {
|
||||
checkLoginError
|
||||
} from "@/util/common";
|
||||
import { mapGetters } from "vuex";
|
||||
import { businessRegister } from "@/api/login";
|
||||
import { checkLoginError } from "@/util/common";
|
||||
export default {
|
||||
components: {
|
||||
MyAvatar,
|
||||
@@ -100,19 +97,19 @@
|
||||
},
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
...mapGetters(["config"]),
|
||||
},
|
||||
onLoad(options) {
|
||||
const {
|
||||
userInfo,
|
||||
codeValue
|
||||
} = options;
|
||||
const {userInfo,codeValue} = options;
|
||||
this.userInfo = {
|
||||
...this.userInfo,
|
||||
...JSON.parse(userInfo),
|
||||
};
|
||||
this.codeValue = codeValue;
|
||||
if(process.env.NODE_ENV == 'development'){
|
||||
this.userInfo.email = "commiu@outlook.com";
|
||||
this.userInfo.nickname = "commiu";
|
||||
//this.userInfo.email = "commiu@outlook.com";
|
||||
this.userInfo.nickname = "";
|
||||
this.userInfo.password = "qwe123";
|
||||
this.userInfo.confirmPassword = "qwe123";
|
||||
}
|
||||
@@ -135,12 +132,12 @@
|
||||
this.loading = true;
|
||||
const options = {
|
||||
code: this.codeValue,
|
||||
platform: uni.$u.os() === "ios" ? 1 : 2,
|
||||
platform: uni.$u.os(),
|
||||
autoLogin: true,
|
||||
...this.userInfo,
|
||||
areaCode: `+${this.userInfo.areaCode}`,
|
||||
password: md5(this.userInfo.password),
|
||||
mobile: `+${this.userInfo.phoneNumber}`,
|
||||
mobile: this.userInfo.phoneNumber
|
||||
};
|
||||
try {
|
||||
await businessRegister(options);
|
||||
|
||||
@@ -1,144 +1,169 @@
|
||||
<template>
|
||||
<view class="page_container">
|
||||
<custom-nav-bar title="关于我们" />
|
||||
<view class="logo_area">
|
||||
<image src="@/static/images/about_logo.png" mode=""></image>
|
||||
<view>{{ v }}</view>
|
||||
<view class="page_container">
|
||||
<custom-nav-bar title="关于我们" />
|
||||
<view class="logo_area">
|
||||
<image src="@/static/images/about_logo.png" mode=""></image>
|
||||
<view>{{ appversion }}</view>
|
||||
|
||||
<info-item @click="checkUpdate" class="check" title="检测更新" content="" />
|
||||
<info-item @click="openurl('http://baidu.com')" class="check" title="官方网站" content="" />
|
||||
<info-item @click="goto('/pages/common/article?type=article&name=coom&title=商务合作')" class="check" title="商务合作" content="" />
|
||||
<info-item @click="goto('/pages/common/article?type=article&name=contract&title=用户协议')" class="check" title="用户协议" content="" />
|
||||
<info-item @click="goto('/pages/common/article?type=article&name=privacy&title=隐私政策')" class="check" title="隐私政策" content="" />
|
||||
<info-item @click="goto('/pages/common/article?type=article&name=aboutus&title=关于我们')" class="check" title="关于我们" content="" />
|
||||
<info-item @click="clearcache" class="check" title="清除缓存" content="" />
|
||||
<info-item @click="show = true" class="check" title="上传调试日志" content="" />
|
||||
|
||||
<info-item
|
||||
@click="show = true"
|
||||
class="check"
|
||||
title="上传调试日志"
|
||||
content=""
|
||||
/>
|
||||
|
||||
<u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false" >
|
||||
<view class="slot-content">
|
||||
<u--input
|
||||
placeholder="日志数量"
|
||||
border="surround"
|
||||
v-model="line"
|
||||
></u--input>
|
||||
</view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</view>
|
||||
<u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false">
|
||||
<view class="slot-content">
|
||||
<u--input placeholder="日志数量" border="surround" v-model="line"></u--input>
|
||||
</view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import { version } from '@/common/config'
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import { PageEvents } from "@/constant";
|
||||
import InfoItem from "../selfInfo/InfoItem.vue";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
InfoItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
line: 10000,
|
||||
version: "",
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
v(){
|
||||
return version
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getAppVersion();
|
||||
uni.$on(PageEvents.CheckForUpdateResp, this.checkRespHandler);
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off(PageEvents.CheckForUpdateResp, this.checkRespHandler);
|
||||
},
|
||||
mounted() {
|
||||
IMSDK.subscribe('uploadLogsProgress', this.uploadHandler);
|
||||
},
|
||||
beforeDestroy() {
|
||||
IMSDK.unsubscribe('uploadLogsProgress', this.uploadHandler);
|
||||
},
|
||||
methods: {
|
||||
uploadLog() {
|
||||
this.show = false
|
||||
IMSDK.asyncApi(
|
||||
'uploadLogs',
|
||||
IMSDK.uuid(),
|
||||
{
|
||||
line: this.line,
|
||||
ex: ""
|
||||
}
|
||||
)
|
||||
uni.showLoading({
|
||||
title: '上传中',
|
||||
mask: true,
|
||||
});
|
||||
},
|
||||
uploadHandler({
|
||||
data: { current, size },
|
||||
}) {
|
||||
console.log('uploadHandler',current,size)
|
||||
if (current >= size) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "上传成功",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
getAppVersion() {
|
||||
plus.runtime.getProperty(
|
||||
plus.runtime.appid,
|
||||
({ version }) => (this.appVersion = version),
|
||||
);
|
||||
},
|
||||
updateCheck() {
|
||||
this.loading = true;
|
||||
uni.$emit(PageEvents.CheckForUpdate, true);
|
||||
},
|
||||
checkRespHandler() {
|
||||
this.loading = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import {version } from '@/common/config'
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import {PageEvents } from "@/constant";
|
||||
import InfoItem from "../selfInfo/InfoItem.vue";
|
||||
import {checkUpgrade} from "@/api/login.js"
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
InfoItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
line: 10000,
|
||||
appversion: "",
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getAppVersion();
|
||||
},
|
||||
mounted() {
|
||||
IMSDK.subscribe('uploadLogsProgress', this.uploadHandler);
|
||||
},
|
||||
beforeDestroy() {
|
||||
IMSDK.unsubscribe('uploadLogsProgress', this.uploadHandler);
|
||||
},
|
||||
methods: {
|
||||
uploadLog() {
|
||||
this.show = false
|
||||
IMSDK.asyncApi('uploadLogs',IMSDK.uuid(), {
|
||||
line: this.line,
|
||||
ex: ""
|
||||
})
|
||||
uni.showLoading({
|
||||
title: '上传中',
|
||||
mask: true,
|
||||
});
|
||||
},
|
||||
uploadHandler({data: {current,size},}) {
|
||||
console.log('uploadHandler', current, size)
|
||||
if (current >= size) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "上传成功",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
getAppVersion() {
|
||||
let system = uni.getSystemInfoSync();
|
||||
const _this = this;
|
||||
plus.runtime.getProperty(plus.runtime.appid,(inf) => {
|
||||
console.log(inf);
|
||||
_this.appversion = inf.version
|
||||
});
|
||||
},
|
||||
|
||||
checkRespHandler() {
|
||||
this.loading = false;
|
||||
},
|
||||
goto(url){
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
},
|
||||
clearcache(){
|
||||
|
||||
},
|
||||
openurl(url){
|
||||
// #ifdef APP
|
||||
plus.runtime.openWeb(url)
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
window.open(url);
|
||||
// #endif
|
||||
},
|
||||
// 验证是否升级
|
||||
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"
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page_container {
|
||||
background-color: #f8f8f8;
|
||||
.page_container {
|
||||
background-color: #f8f8f8;
|
||||
|
||||
.logo_area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 48rpx 0 16rpx 0;
|
||||
color: $uni-text-color;
|
||||
.logo_area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
padding: 48rpx 0 16rpx 0;
|
||||
color: $uni-text-color;
|
||||
|
||||
image {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.check {
|
||||
margin-top: 26rpx;
|
||||
border-top: 1px #e8eaef solid;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 0;
|
||||
width: 90%;
|
||||
}
|
||||
.check {
|
||||
margin-top: 26rpx;
|
||||
border-top: 1px #e8eaef solid;
|
||||
padding: 20rpx;
|
||||
padding-bottom: 0;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.btn_row {
|
||||
padding: 0 44rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.btn_row {
|
||||
padding: 0 44rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -86,19 +86,22 @@
|
||||
});
|
||||
},
|
||||
logoutConfirm() {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid())
|
||||
.then(() => {
|
||||
uni.removeStorage({
|
||||
key: "IMToken",
|
||||
});
|
||||
uni.removeStorage({
|
||||
key: "BusinessToken",
|
||||
});
|
||||
})
|
||||
.catch((err) => console.log(err))
|
||||
.finally(() => {
|
||||
uni.$u.route("/pages/login/index");
|
||||
console.log(1)
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()).then(() => {
|
||||
console.log(2)
|
||||
uni.removeStorage({
|
||||
key: "IMToken",
|
||||
});
|
||||
uni.removeStorage({
|
||||
key: "BusinessToken",
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(3)
|
||||
console.log(err)
|
||||
}).finally(() => {
|
||||
console.log(4)
|
||||
uni.$u.route("/pages/login/index");
|
||||
});
|
||||
},
|
||||
profileMenuClick({idx}) {
|
||||
switch (idx) {
|
||||
|
||||
@@ -1,74 +1,71 @@
|
||||
<template>
|
||||
<view @click="clickItem" class="info_item">
|
||||
<view class="left_label">
|
||||
<text>{{ title }}</text>
|
||||
</view>
|
||||
<view class="right_value">
|
||||
<slot name="value">
|
||||
<text class="content">{{ content }}</text>
|
||||
</slot>
|
||||
<u-icon
|
||||
v-if="showArrow"
|
||||
name="arrow-right"
|
||||
size="16"
|
||||
color="#999"
|
||||
></u-icon>
|
||||
</view>
|
||||
<u-loading-icon v-show="loading" class="loading_icon"></u-loading-icon>
|
||||
</view>
|
||||
<view @click="clickItem" class="info_item">
|
||||
<view class="left_label">
|
||||
<text>{{ title }}</text>
|
||||
</view>
|
||||
<view class="right_value">
|
||||
<slot name="value">
|
||||
<text class="content">{{ content }}</text>
|
||||
</slot>
|
||||
<u-icon v-if="showArrow" name="arrow-right" size="16" color="#999"></u-icon>
|
||||
</view>
|
||||
<u-loading-icon v-show="loading" class="loading_icon"></u-loading-icon>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "",
|
||||
props: {
|
||||
title: String,
|
||||
content: String,
|
||||
showArrow: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
clickItem() {
|
||||
this.$emit("click");
|
||||
},
|
||||
},
|
||||
};
|
||||
export default {
|
||||
name: "",
|
||||
props: {
|
||||
title: String,
|
||||
content: String,
|
||||
showArrow: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {
|
||||
clickItem() {
|
||||
this.$emit("click");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.info_item {
|
||||
@include btwBox();
|
||||
height: 82rpx;
|
||||
padding: 0 44rpx;
|
||||
color: $uni-text-color;
|
||||
// border-bottom: 1px solid rgba(153,153,153,0.3);
|
||||
position: relative;
|
||||
.info_item {
|
||||
@include btwBox();
|
||||
height: 82rpx;
|
||||
padding: 0 44rpx;
|
||||
color: $uni-text-color;
|
||||
// border-bottom: 1px solid rgba(153,153,153,0.3);
|
||||
position: relative;
|
||||
|
||||
.right_value {
|
||||
@include vCenterBox();
|
||||
.content {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
.u-icon {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
.right_value {
|
||||
@include vCenterBox();
|
||||
|
||||
.loading_icon {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.content {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.u-icon {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.loading_icon {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,216 +1,180 @@
|
||||
<template>
|
||||
<view class="page_container">
|
||||
<custom-nav-bar title="个人资料" />
|
||||
<view class="page_container">
|
||||
<custom-nav-bar title="个人资料" />
|
||||
|
||||
<view class="info_wrap">
|
||||
<info-item
|
||||
:loading="loadingState.faceURL"
|
||||
@click="updateAvatar"
|
||||
title="头像"
|
||||
>
|
||||
<my-avatar
|
||||
:src="selfInfo.faceURL"
|
||||
:desc="selfInfo.nickname"
|
||||
size="30"
|
||||
slot="value"
|
||||
/>
|
||||
</info-item>
|
||||
<info-item
|
||||
@click="updateNickname"
|
||||
title="姓名"
|
||||
:content="selfInfo.nickname"
|
||||
/>
|
||||
<info-item
|
||||
:loading="loadingState.gender"
|
||||
@click="updateGender"
|
||||
title="性别"
|
||||
:content="getGender"
|
||||
/>
|
||||
<info-item
|
||||
:loading="loadingState.birth"
|
||||
@click="() => (showDatePicker = true)"
|
||||
title="生日"
|
||||
:content="getBirth"
|
||||
/>
|
||||
</view>
|
||||
<view class="info_wrap">
|
||||
<info-item :loading="loadingState.faceURL" @click="updateAvatar" title="头像">
|
||||
<my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="30" slot="value" />
|
||||
</info-item>
|
||||
<info-item @click="updateNickname" title="姓名" :content="selfInfo.nickname" />
|
||||
<info-item :loading="loadingState.gender" @click="updateGender" title="性别" :content="getGender" />
|
||||
<info-item :loading="loadingState.birth" @click="() => (showDatePicker = true)" title="生日"
|
||||
:content="getBirth" />
|
||||
</view>
|
||||
|
||||
<view class="info_wrap">
|
||||
<info-item
|
||||
:showArrow="false"
|
||||
title="手机号码"
|
||||
:content="selfInfo.phoneNumber || '-'"
|
||||
/>
|
||||
<info-item
|
||||
:showArrow="false"
|
||||
title="邮箱"
|
||||
:content="selfInfo.email || '-'"
|
||||
/>
|
||||
</view>
|
||||
<view class="info_wrap">
|
||||
<info-item :showArrow="false" title="手机号码" :content="selfInfo.mobile || '-'" />
|
||||
<info-item :showArrow="false" title="邮箱" :content="selfInfo.email || '-'" />
|
||||
</view>
|
||||
|
||||
<u-datetime-picker
|
||||
:minDate="0"
|
||||
:maxDate="nowDate"
|
||||
:show="showDatePicker"
|
||||
@confirm="confirmDate"
|
||||
@cancel="() => (showDatePicker = false)"
|
||||
v-model="selfInfo.birth"
|
||||
mode="date"
|
||||
/>
|
||||
</view>
|
||||
<u-datetime-picker :minDate="0" :maxDate="nowDate" :show="showDatePicker" @confirm="confirmDate"
|
||||
@cancel="() => (showDatePicker = false)" v-model="selfInfo.birth" mode="date" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { businessInfoUpdate } from "@/api/login";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import dayjs from "dayjs";
|
||||
import InfoItem from "./InfoItem.vue";
|
||||
import { getPurePath } from "@/util/common";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
MyAvatar,
|
||||
InfoItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showDatePicker: false,
|
||||
loadingState: {
|
||||
faceURL: false,
|
||||
gender: false,
|
||||
birth: false,
|
||||
},
|
||||
nowDate: Date.now(),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selfInfo() {
|
||||
return this.$store.getters.storeSelfInfo;
|
||||
},
|
||||
getGender() {
|
||||
if (this.selfInfo.gender === 0) {
|
||||
return "保密";
|
||||
}
|
||||
if (this.selfInfo.gender === 1) {
|
||||
return "男";
|
||||
}
|
||||
return "女";
|
||||
},
|
||||
getBirth() {
|
||||
const birth = this.selfInfo.birth ?? 0;
|
||||
return dayjs(birth).format("YYYY-MM-DD");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateNickname() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/markOrIDPage/index?isSelfNickname=true&sourceInfo=${JSON.stringify(
|
||||
import {
|
||||
businessInfoUpdate
|
||||
} from "@/api/login";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
import CustomNavBar from "@/components/CustomNavBar/index.vue";
|
||||
import MyAvatar from "@/components/MyAvatar/index.vue";
|
||||
import dayjs from "dayjs";
|
||||
import InfoItem from "./InfoItem.vue";
|
||||
import {
|
||||
getPurePath
|
||||
} from "@/util/common";
|
||||
export default {
|
||||
components: {
|
||||
CustomNavBar,
|
||||
MyAvatar,
|
||||
InfoItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showDatePicker: false,
|
||||
loadingState: {
|
||||
faceURL: false,
|
||||
gender: false,
|
||||
birth: false,
|
||||
},
|
||||
nowDate: Date.now(),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selfInfo() {
|
||||
return this.$store.getters.storeSelfInfo;
|
||||
},
|
||||
getGender() {
|
||||
if (this.selfInfo.sex === 0) {
|
||||
return "保密";
|
||||
}
|
||||
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");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateNickname() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/markOrIDPage/index?isSelfNickname=true&sourceInfo=${JSON.stringify(
|
||||
this.selfInfo,
|
||||
)}`,
|
||||
});
|
||||
},
|
||||
updateGender() {
|
||||
uni.showActionSheet({
|
||||
itemList: ["男", "女"],
|
||||
success: async ({ tapIndex }) => {
|
||||
this.loadingState.gender = true;
|
||||
await this.updateSelfInfo(
|
||||
{
|
||||
gender: tapIndex + 1,
|
||||
},
|
||||
"gender",
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
updateAvatar() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
success: async ({ tempFilePaths }) => {
|
||||
const path = tempFilePaths[0];
|
||||
const nameIdx = path.lastIndexOf("/") + 1;
|
||||
const typeIdx = path.lastIndexOf(".") + 1;
|
||||
const fileName = path.slice(nameIdx);
|
||||
const fileType = path.slice(typeIdx);
|
||||
this.loadingState.faceURL = true;
|
||||
const {
|
||||
data: { url },
|
||||
} = await IMSDK.asyncApi(IMSDK.IMMethods.UploadFile, IMSDK.uuid(), {
|
||||
filepath: getPurePath(tempFilePaths[0]),
|
||||
name: fileName,
|
||||
contentType: fileType,
|
||||
uuid: IMSDK.uuid(),
|
||||
});
|
||||
console.log(url);
|
||||
this.updateSelfInfo(
|
||||
{
|
||||
faceURL: url,
|
||||
},
|
||||
"faceURL",
|
||||
);
|
||||
this.loadingState.faceURL = false;
|
||||
},
|
||||
});
|
||||
},
|
||||
toQrCode() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/userOrGroupQrCode/index`,
|
||||
});
|
||||
},
|
||||
copyID() {
|
||||
uni.setClipboardData({
|
||||
data: this.selfInfo.userID,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
async updateSelfInfo(data, key) {
|
||||
try {
|
||||
await businessInfoUpdate({
|
||||
userID: this.selfInfo.userID,
|
||||
...data,
|
||||
});
|
||||
await this.$store.dispatch("user/updateBusinessInfo");
|
||||
uni.$u.toast("修改成功");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
this.loadingState[key] = false;
|
||||
},
|
||||
confirmDate({ value }) {
|
||||
this.loadingState.birth = true;
|
||||
this.updateSelfInfo(
|
||||
{
|
||||
birth: value,
|
||||
},
|
||||
"birth",
|
||||
);
|
||||
this.showDatePicker = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
updateGender() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['保密',"男", "女"],
|
||||
success: async ({
|
||||
tapIndex
|
||||
}) => {
|
||||
this.loadingState.gender = true;
|
||||
await this.updateSelfInfo({gender: tapIndex,},"gender",);
|
||||
},
|
||||
});
|
||||
},
|
||||
updateAvatar() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ["compressed"],
|
||||
success: async ({
|
||||
tempFilePaths
|
||||
}) => {
|
||||
const path = tempFilePaths[0];
|
||||
const nameIdx = path.lastIndexOf("/") + 1;
|
||||
const typeIdx = path.lastIndexOf(".") + 1;
|
||||
const fileName = path.slice(nameIdx);
|
||||
const fileType = path.slice(typeIdx);
|
||||
this.loadingState.faceURL = true;
|
||||
const {
|
||||
data: {
|
||||
url
|
||||
},
|
||||
} = await IMSDK.asyncApi(IMSDK.IMMethods.UploadFile, IMSDK.uuid(), {
|
||||
filepath: getPurePath(tempFilePaths[0]),
|
||||
name: fileName,
|
||||
contentType: fileType,
|
||||
uuid: IMSDK.uuid(),
|
||||
});
|
||||
console.log(url);
|
||||
this.updateSelfInfo({
|
||||
faceURL: url,
|
||||
},
|
||||
"faceURL",
|
||||
);
|
||||
this.loadingState.faceURL = false;
|
||||
},
|
||||
});
|
||||
},
|
||||
toQrCode() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/userOrGroupQrCode/index`,
|
||||
});
|
||||
},
|
||||
copyID() {
|
||||
uni.setClipboardData({
|
||||
data: this.selfInfo.userID,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
uni.$u.toast("复制成功");
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
async updateSelfInfo(data, key) {
|
||||
try {
|
||||
console.log(data);
|
||||
await businessInfoUpdate({
|
||||
userID: this.selfInfo.userID,
|
||||
...data,
|
||||
});
|
||||
await this.$store.dispatch("user/updateBusinessInfo");
|
||||
uni.$u.toast("修改成功");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
uni.$u.toast("修改失败");
|
||||
}
|
||||
this.loadingState[key] = false;
|
||||
},
|
||||
confirmDate({value}) {
|
||||
this.loadingState.birth = true;
|
||||
this.updateSelfInfo({birth: value,},"birth",);
|
||||
this.showDatePicker = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page_container {
|
||||
background-color: #f8f8f8;
|
||||
.page_container {
|
||||
background-color: #f8f8f8;
|
||||
|
||||
.info_wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
.info_wrap {
|
||||
margin: 24rpx 24rpx 0 24rpx;
|
||||
background: #fff;
|
||||
border-radius: 6px;
|
||||
|
||||
.qr_icon {
|
||||
width: 22px;
|
||||
height: 23px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.qr_icon {
|
||||
width: 22px;
|
||||
height: 23px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,22 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
@@ -1,31 +1,270 @@
|
||||
<template>
|
||||
<web-view :src="linkUrl"></web-view>
|
||||
<view class="content">
|
||||
<u-navbar :is-back="false" title="发现" :background="{ background: '#f4f4f5' }" title-color="#404133"
|
||||
:title-bold="true" title-size="34" :border-bottom="false" z-index="1001">
|
||||
</u-navbar>
|
||||
<view style="background-color: #FFFFFF;">
|
||||
<view>
|
||||
<u-cell-item title="" :title-style="titleStyle" :border-bottom="showBorder(0)" :border-top="false"
|
||||
@tap="linkTo(cellList[0])">
|
||||
<u-icon class="u-m-r-10" slot="icon" name="/static/image/workbench/01.png" color="inherit" :size="44"></u-icon>
|
||||
<view slot="title" class="u-flex u-row-left u-col-center" style="min-width: 200rpx;">
|
||||
<view class="u-m-r-20">
|
||||
<text>朋友圈</text>
|
||||
</view>
|
||||
<view class="u-flex u-row-center u-col-center" v-if="vuex_friendCircleUnreadCount>0"
|
||||
style="width:36rpx;height:36rpx;background-color:#fa3534;border-radius:18rpx;font-size:28rpx;color: #ffffff;">
|
||||
<text>{{vuex_friendCircleUnreadCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view slot="right-icon" v-if="newCircleInfo&&newCircleInfo.userHeadImg.length>0">
|
||||
<u-avatar :src="newCircleInfo.userHeadImg" mode="square" :size="70"></u-avatar>
|
||||
<u-badge :is-dot="true" type="error" :offset="[20,60]"></u-badge>
|
||||
</view>
|
||||
</u-cell-item>
|
||||
<u-gap :height="16" bg-color="#f4f4f5" v-if="showGap(0)"></u-gap>
|
||||
</view>
|
||||
|
||||
|
||||
<view v-for="(item,index) in cellList" :key="index">
|
||||
<template v-if="item.hidden==false&&index!=0">
|
||||
<u-cell-item :title="item.title" :title-style="titleStyle"
|
||||
:border-bottom="showBorder(index)" :border-top="false"
|
||||
@tap="linkTo(item)">
|
||||
<u-icon :class="item.title=='购物'?'u-m-l-6 u-m-r-10':'u-m-r-10'"
|
||||
slot="icon" :name="item.icon" :color="item.color" :size="item.size"></u-icon>
|
||||
</u-cell-item>
|
||||
<u-gap :height="16" bg-color="#f4f4f5" v-if="showGap(index)"></u-gap>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
linkUrl: "",
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
this.linkUrl = 'https://doc.rentsoft.cn/'
|
||||
},
|
||||
onReady() {
|
||||
// #ifdef APP-PLUS
|
||||
setTimeout(() => {
|
||||
this.$scope
|
||||
.$getAppWebview()
|
||||
.children()[0]
|
||||
.setStyle({
|
||||
top: uni.getWindowInfo().statusBarHeight,
|
||||
height: uni.getWindowInfo().safeArea.height,
|
||||
});
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
};
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
cellList: [
|
||||
{
|
||||
id: 1,
|
||||
title: "朋友圈",
|
||||
icon: "/static/image/workbench/01.png",
|
||||
color: "inherit",
|
||||
bind: "/pages/workbench/friend-circle/friend-circle",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "扫一扫",
|
||||
//icon: "/static/image/wx/saoyisao.png",
|
||||
icon: "/static/image/workbench/04.png",
|
||||
color: "#409eff",
|
||||
bind: "scan",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "摇一摇",
|
||||
//icon: "/static/image/wx/yaoyiyao.png",
|
||||
icon: "/static/image/workbench/05.png",
|
||||
color: "#409eff",
|
||||
bind: "/pages/tabbar/find/yaoyiyao/yyy-index",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
title: "看一看",
|
||||
icon: "/static/image/workbench/06.png",
|
||||
color: "#f29100",
|
||||
bind: "",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
title: "附近",
|
||||
icon: "/static/image/workbench/08.png",
|
||||
color: "#fab6b6",
|
||||
bind: "",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
title: "购物",
|
||||
icon: "/static/image/workbench/09.png",
|
||||
color: "#fab6b6",
|
||||
bind: "taobao",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
title: "游戏",
|
||||
icon: "/static/image/workbench/10.png",
|
||||
color: "#fab6b6",
|
||||
bind: "",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: "小程序",
|
||||
//icon: "/static/image/wx/xiaochengxu.png",
|
||||
icon: "/static/image/workbench/11.png",
|
||||
color: "#fab6b6",
|
||||
bind: "",
|
||||
hidden:false,
|
||||
size:44,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
title: "ChatGpt",
|
||||
icon: "/static/image/find/chatgpt.png",
|
||||
color: "#ff9900",
|
||||
bind: "/pages/tabbar/group/chat/chat-gpt-conversion-wss",
|
||||
hidden:true,
|
||||
size:64,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
title: "AI绘画",
|
||||
icon: "http://open.yjai.art/assets/logo-9a019aa3.svg",
|
||||
color: "#ff9900",
|
||||
bind: "/pages/tabbar/find/AI/ai-text-to-create-img/ai-text-to-create-img",
|
||||
hidden:true,
|
||||
size:64,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
title: "免费听歌",
|
||||
icon: "/static/image/find/MP3.png",
|
||||
color: "#19BE6B",
|
||||
bind: "/pages/tabbar/find/music/free-music",
|
||||
hidden:true,
|
||||
size:64,
|
||||
}
|
||||
],
|
||||
titleStyle: {
|
||||
marginLeft: "20rpx",
|
||||
fontSize: "34rpx",
|
||||
color: "#000000"
|
||||
},
|
||||
newCircleInfo: {
|
||||
userHeadImg:""
|
||||
},
|
||||
};
|
||||
},
|
||||
onShow: function() {
|
||||
this.changeDefaultAvatar(1,10);
|
||||
let unreadCount= 1;//this.vuex_friendCircleUnreadCount+"";
|
||||
this.localGroupApi.setTabBarBadge(2,unreadCount);
|
||||
},
|
||||
methods: {
|
||||
changeDefaultAvatar:function(min,max){
|
||||
let that=this;
|
||||
that.$u.api.friendCircle.checkFriendCircleUpdate().then(res => {
|
||||
if(res.code==200){
|
||||
console.log("查询朋友圈更新情况",res.data);
|
||||
if(res.data&&res.data.length>0){
|
||||
that.newCircleInfo=res.data[0];
|
||||
}else{
|
||||
that.newCircleInfo=null;
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
showBorder(index){
|
||||
switch (index){
|
||||
case 1:
|
||||
return true;
|
||||
case 3:
|
||||
return true;
|
||||
case 5:
|
||||
return true;
|
||||
case 8:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
showGap(index){
|
||||
switch (index){
|
||||
case 0:
|
||||
return true;
|
||||
case 2:
|
||||
return true;
|
||||
case 4:
|
||||
return true;
|
||||
case 6:
|
||||
return true;
|
||||
case 7:
|
||||
return true;
|
||||
case 9:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
linkTo(item) {
|
||||
let that = this;
|
||||
let url = item.bind;
|
||||
console.log("跳转链接", url);
|
||||
if (url != null && url.length > 0) {
|
||||
if (url == 'taobao') {
|
||||
if (plus.os.name == 'Android') {
|
||||
plus.runtime.launchApplication({
|
||||
pname: 'com.taobao.taobao'
|
||||
},
|
||||
function(e) {
|
||||
console.log('Open system default browser failed: ' + e.message);
|
||||
}
|
||||
);
|
||||
} else if (plus.os.name == 'iOS') {
|
||||
//抖音 snssdk1128://
|
||||
plus.runtime.launchApplication({
|
||||
action: 'snssdk1128://'
|
||||
}, function(e) {
|
||||
console.log('Open system default browser failed: ' + e.message);
|
||||
});
|
||||
}
|
||||
} else if (url == "scan") {
|
||||
this.globalUtil.scanQRcode(that, {
|
||||
complete: function(res) {
|
||||
console.log("扫码结果", res);
|
||||
if (res.resp_code == 1000) {
|
||||
let respData = res.resp_result;
|
||||
that.$u.route({
|
||||
url: '/pages/chat/qr-info/qr-info',
|
||||
params: {
|
||||
qrInfo: respData
|
||||
},
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
} else {
|
||||
console.log("url", url);
|
||||
this.$u.route(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss"></style>
|
||||
<style lang="scss" scoped>
|
||||
.content {}
|
||||
</style>
|
||||
<style>
|
||||
page {
|
||||
background-color: #f4f4f5 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
v4 as uuidv4
|
||||
} from "uuid";
|
||||
import {v4 as uuidv4} from "uuid";
|
||||
import IMSDK from "openim-uniapp-polyfill";
|
||||
|
||||
const state = {
|
||||
@@ -46,14 +44,9 @@ const mutations = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
async getConversationList({
|
||||
state,
|
||||
commit
|
||||
}, isFirstPage = true) {
|
||||
async getConversationList({state,commit}, isFirstPage = true) {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi(
|
||||
const {data} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetConversationListSplit,
|
||||
uuidv4(), {
|
||||
offset: isFirstPage ? 0 : state.conversationList.length,
|
||||
@@ -71,9 +64,7 @@ const actions = {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
getCurrentGroup({
|
||||
commit
|
||||
}, groupID) {
|
||||
getCurrentGroup({commit}, groupID) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [
|
||||
groupID,
|
||||
]).then(({
|
||||
@@ -82,10 +73,7 @@ const actions = {
|
||||
commit("SET_CURRENT_GROUP", data[0] ?? {});
|
||||
});
|
||||
},
|
||||
getCurrentMemberInGroup({
|
||||
commit,
|
||||
rootState
|
||||
}, groupID) {
|
||||
getCurrentMemberInGroup({commit,rootState}, groupID) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), {
|
||||
groupID,
|
||||
userIDList: [rootState.user.selfInfo.userID],
|
||||
@@ -95,20 +83,15 @@ const actions = {
|
||||
commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {});
|
||||
});
|
||||
},
|
||||
getUnReadCount({
|
||||
commit
|
||||
}) {
|
||||
getUnReadCount({commit}) {
|
||||
IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then(
|
||||
(res) => {
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
commit("SET_UNREAD_COUNT", res.data);
|
||||
},
|
||||
);
|
||||
},
|
||||
updateCurrentMemberInGroup({
|
||||
commit,
|
||||
state
|
||||
}, memberInfo) {
|
||||
updateCurrentMemberInGroup({commit,state}, memberInfo) {
|
||||
console.log(memberInfo);
|
||||
if (
|
||||
memberInfo.groupID === state.currentMemberInGroup.groupID &&
|
||||
|
||||
@@ -48,19 +48,13 @@ const actions = {
|
||||
commit
|
||||
}) {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetSelfUserInfo,
|
||||
uuidv4(),
|
||||
);
|
||||
const res = await businessGetUserInfo(data.userID);
|
||||
//console.log(res.data);
|
||||
const result = await IMSDK.asyncApi(IMSDK.IMMethods.GetSelfUserInfo,uuidv4(),);
|
||||
const res = await businessGetUserInfo(result.data.userID);
|
||||
|
||||
const businessData = res.data[0] ?? {};
|
||||
filterEmptyValue(businessData);
|
||||
commit("SET_SELF_INFO", {
|
||||
...data,
|
||||
...result.data,
|
||||
...businessData,
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import store from "@/store";
|
||||
import {
|
||||
CustomType,
|
||||
GroupSystemMessageTypes,
|
||||
AddFriendQrCodePrefix,
|
||||
AddGroupQrCodePrefix,
|
||||
CustomType,
|
||||
GroupSystemMessageTypes,
|
||||
AddFriendQrCodePrefix,
|
||||
AddGroupQrCodePrefix,
|
||||
} from "@/constant";
|
||||
import IMSDK, {
|
||||
GroupAtType,
|
||||
MessageType,
|
||||
SessionType,
|
||||
GroupAtType,
|
||||
MessageType,
|
||||
SessionType,
|
||||
} from "openim-uniapp-polyfill";
|
||||
import dayjs from "dayjs";
|
||||
import { isThisYear } from "date-fns";
|
||||
import {
|
||||
isThisYear
|
||||
} from "date-fns";
|
||||
|
||||
import calendar from "dayjs/plugin/calendar";
|
||||
import relativeTime from "dayjs/plugin/relativeTime";
|
||||
@@ -24,338 +26,335 @@ dayjs.extend(updateLocale);
|
||||
dayjs.locale("zh-cn");
|
||||
|
||||
dayjs.updateLocale("en", {
|
||||
calendar: {
|
||||
sameElse: "YYYY-MM-DD",
|
||||
},
|
||||
calendar: {
|
||||
sameElse: "YYYY-MM-DD",
|
||||
},
|
||||
});
|
||||
dayjs.updateLocale("zh-cn", {
|
||||
calendar: {
|
||||
sameDay: "HH:mm",
|
||||
nextDay: "[明天]",
|
||||
nextWeek: "dddd",
|
||||
lastDay: "[昨天] HH:mm",
|
||||
lastWeek: "dddd HH:mm",
|
||||
sameElse: "YYYY年M月D日 HH:mm",
|
||||
},
|
||||
calendar: {
|
||||
sameDay: "HH:mm",
|
||||
nextDay: "[明天]",
|
||||
nextWeek: "dddd",
|
||||
lastDay: "[昨天] HH:mm",
|
||||
lastWeek: "dddd HH:mm",
|
||||
sameElse: "YYYY年M月D日 HH:mm",
|
||||
},
|
||||
});
|
||||
|
||||
export const formatMessageTime = (timestemp, keepSameYear = false) => {
|
||||
if (!timestemp) return "";
|
||||
if (!timestemp) return "";
|
||||
|
||||
const isRecent = dayjs().diff(timestemp, "day") < 7;
|
||||
const keepYear = keepSameYear || !isThisYear(timestemp);
|
||||
const isRecent = dayjs().diff(timestemp, "day") < 7;
|
||||
const keepYear = keepSameYear || !isThisYear(timestemp);
|
||||
|
||||
if (!isRecent && !keepYear) {
|
||||
return dayjs(timestemp).format("M月D日 HH:mm");
|
||||
}
|
||||
if (!isRecent && !keepYear) {
|
||||
return dayjs(timestemp).format("M月D日 HH:mm");
|
||||
}
|
||||
|
||||
return dayjs(timestemp).calendar();
|
||||
return dayjs(timestemp).calendar();
|
||||
};
|
||||
|
||||
export const conversationSort = (conversationList) => {
|
||||
const arr = [];
|
||||
const filterArr = conversationList.filter(
|
||||
(c) => !arr.includes(c.conversationID) && arr.push(c.conversationID),
|
||||
);
|
||||
filterArr.sort((a, b) => {
|
||||
if (a.isPinned === b.isPinned) {
|
||||
const aCompare =
|
||||
a.draftTextTime > a.latestMsgSendTime
|
||||
? a.draftTextTime
|
||||
: a.latestMsgSendTime;
|
||||
const bCompare =
|
||||
b.draftTextTime > b.latestMsgSendTime
|
||||
? b.draftTextTime
|
||||
: b.latestMsgSendTime;
|
||||
if (aCompare > bCompare) {
|
||||
return -1;
|
||||
} else if (aCompare < bCompare) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.isPinned && !b.isPinned) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
return filterArr;
|
||||
const arr = [];
|
||||
const filterArr = conversationList.filter(
|
||||
(c) => !arr.includes(c.conversationID) && arr.push(c.conversationID),
|
||||
);
|
||||
filterArr.sort((a, b) => {
|
||||
if (a.isPinned === b.isPinned) {
|
||||
const aCompare =
|
||||
a.draftTextTime > a.latestMsgSendTime ?
|
||||
a.draftTextTime :
|
||||
a.latestMsgSendTime;
|
||||
const bCompare =
|
||||
b.draftTextTime > b.latestMsgSendTime ?
|
||||
b.draftTextTime :
|
||||
b.latestMsgSendTime;
|
||||
if (aCompare > bCompare) {
|
||||
return -1;
|
||||
} else if (aCompare < bCompare) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.isPinned && !b.isPinned) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
return filterArr;
|
||||
};
|
||||
|
||||
|
||||
export const sec2Time = (seconds) => {
|
||||
var theTime1 = 0; // min
|
||||
var theTime2 = 0; // hour
|
||||
var theTime3 = 0; // day
|
||||
if (seconds > 60) {
|
||||
theTime1 = parseInt(seconds / 60);
|
||||
seconds = parseInt(seconds % 60);
|
||||
if (theTime1 > 60) {
|
||||
theTime2 = parseInt(theTime1 / 60);
|
||||
theTime1 = parseInt(theTime1 % 60);
|
||||
if (theTime2 > 24) {
|
||||
theTime3 = parseInt(theTime2 / 24);
|
||||
theTime2 = parseInt(theTime2 % 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
var result = "";
|
||||
if (seconds > 0) {
|
||||
result = "" + parseInt(seconds) + "秒";
|
||||
}
|
||||
if (theTime1 > 0) {
|
||||
result = "" + parseInt(theTime1) + "分钟" + result;
|
||||
}
|
||||
if (theTime2 > 0) {
|
||||
result = "" + parseInt(theTime2) + "小时" + result;
|
||||
}
|
||||
if (theTime3 > 0) {
|
||||
result = "" + parseInt(theTime3) + "天" + result;
|
||||
}
|
||||
return result;
|
||||
var theTime1 = 0; // min
|
||||
var theTime2 = 0; // hour
|
||||
var theTime3 = 0; // day
|
||||
if (seconds > 60) {
|
||||
theTime1 = parseInt(seconds / 60);
|
||||
seconds = parseInt(seconds % 60);
|
||||
if (theTime1 > 60) {
|
||||
theTime2 = parseInt(theTime1 / 60);
|
||||
theTime1 = parseInt(theTime1 % 60);
|
||||
if (theTime2 > 24) {
|
||||
theTime3 = parseInt(theTime2 / 24);
|
||||
theTime2 = parseInt(theTime2 % 24);
|
||||
}
|
||||
}
|
||||
}
|
||||
var result = "";
|
||||
if (seconds > 0) {
|
||||
result = "" + parseInt(seconds) + "秒";
|
||||
}
|
||||
if (theTime1 > 0) {
|
||||
result = "" + parseInt(theTime1) + "分钟" + result;
|
||||
}
|
||||
if (theTime2 > 0) {
|
||||
result = "" + parseInt(theTime2) + "小时" + result;
|
||||
}
|
||||
if (theTime3 > 0) {
|
||||
result = "" + parseInt(theTime3) + "天" + result;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
export const parseMessageByType = (pmsg) => {
|
||||
const getName = (user) => {
|
||||
return user.userID === store.getters.storeCurrentUserID
|
||||
? "你"
|
||||
: user.nickname;
|
||||
};
|
||||
const getName = (user) => {
|
||||
return user.userID === store.getters.storeCurrentUserID ?
|
||||
"你" :
|
||||
user.nickname;
|
||||
};
|
||||
|
||||
switch (pmsg.contentType) {
|
||||
case MessageType.TextMessage:
|
||||
return pmsg.textElem.content;
|
||||
case MessageType.PictureMessage:
|
||||
return `[图片]`;
|
||||
case MessageType.FriendAdded:
|
||||
return "你们已经是好友了,开始聊天吧~";
|
||||
case MessageType.MemberEnter:
|
||||
const enterDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const enterUser = enterDetails.entrantUser;
|
||||
return `${getName(enterUser)}进入了群聊`;
|
||||
case MessageType.GroupCreated:
|
||||
const groupCreatedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupCreatedUser = groupCreatedDetail.opUser;
|
||||
return `${getName(groupCreatedUser)}创建了群聊`;
|
||||
case MessageType.MemberInvited:
|
||||
const inviteDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const inviteOpUser = inviteDetails.opUser;
|
||||
const invitedUserList = inviteDetails.invitedUserList ?? [];
|
||||
let inviteStr = "";
|
||||
invitedUserList.find(
|
||||
(user, idx) => (inviteStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
inviteStr = inviteStr.slice(0, -1);
|
||||
return `${getName(inviteOpUser)}邀请了${inviteStr}${
|
||||
switch (pmsg.contentType) {
|
||||
case MessageType.TextMessage:
|
||||
return pmsg.textElem.content;
|
||||
case MessageType.PictureMessage:
|
||||
return `[图片]`;
|
||||
case MessageType.FriendAdded:
|
||||
return "你们已经是好友了,开始聊天吧~";
|
||||
case MessageType.MemberEnter:
|
||||
const enterDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const enterUser = enterDetails.entrantUser;
|
||||
return `${getName(enterUser)}进入了群聊`;
|
||||
case MessageType.GroupCreated:
|
||||
const groupCreatedDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupCreatedUser = groupCreatedDetail.opUser;
|
||||
return `${getName(groupCreatedUser)}创建了群聊`;
|
||||
case MessageType.MemberInvited:
|
||||
const inviteDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const inviteOpUser = inviteDetails.opUser;
|
||||
const invitedUserList = inviteDetails.invitedUserList ?? [];
|
||||
let inviteStr = "";
|
||||
invitedUserList.find(
|
||||
(user, idx) => (inviteStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
inviteStr = inviteStr.slice(0, -1);
|
||||
return `${getName(inviteOpUser)}邀请了${inviteStr}${
|
||||
invitedUserList.length > 3 ? "..." : ""
|
||||
}进入群聊`;
|
||||
|
||||
case MessageType.MemberKicked:
|
||||
const kickDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const kickOpUser = kickDetails.opUser;
|
||||
const kickdUserList = kickDetails.kickedUserList ?? [];
|
||||
let kickStr = "";
|
||||
kickdUserList.find(
|
||||
(user, idx) => (kickStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${getName(kickOpUser)}踢出了${kickStr}${
|
||||
case MessageType.MemberKicked:
|
||||
const kickDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const kickOpUser = kickDetails.opUser;
|
||||
const kickdUserList = kickDetails.kickedUserList ?? [];
|
||||
let kickStr = "";
|
||||
kickdUserList.find(
|
||||
(user, idx) => (kickStr += getName(user) + "、") && idx > 3,
|
||||
);
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${getName(kickOpUser)}踢出了${kickStr}${
|
||||
kickdUserList.length > 3 ? "..." : ""
|
||||
}`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
return `${getName(quitUser)}退出了群聊`;
|
||||
case MessageType.GroupInfoUpdated:
|
||||
const groupUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupUpdateUser = groupUpdateDetail.opUser;
|
||||
return `${getName(groupUpdateUser)}修改了群信息`;
|
||||
case MessageType.GroupOwnerTransferred:
|
||||
const transferDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const transferOpUser = transferDetails.opUser;
|
||||
const newOwner = transferDetails.newGroupOwner;
|
||||
return `${getName(transferOpUser)}将群主转让给${getName(newOwner)}`;
|
||||
case MessageType.GroupDismissed:
|
||||
const dismissDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const dismissUser = dismissDetails.opUser;
|
||||
return `${getName(dismissUser)}解散了群聊`;
|
||||
case MessageType.GroupNameUpdated:
|
||||
const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupNameUpdateUser = groupNameUpdateDetail.opUser;
|
||||
return `${getName(groupNameUpdateUser)}修改了群名称为${
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
return `${getName(quitUser)}退出了群聊`;
|
||||
case MessageType.GroupInfoUpdated:
|
||||
const groupUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupUpdateUser = groupUpdateDetail.opUser;
|
||||
return `${getName(groupUpdateUser)}修改了群信息`;
|
||||
case MessageType.GroupOwnerTransferred:
|
||||
const transferDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const transferOpUser = transferDetails.opUser;
|
||||
const newOwner = transferDetails.newGroupOwner;
|
||||
return `${getName(transferOpUser)}将群主转让给${getName(newOwner)}`;
|
||||
case MessageType.GroupDismissed:
|
||||
const dismissDetails = JSON.parse(pmsg.notificationElem.detail);
|
||||
const dismissUser = dismissDetails.opUser;
|
||||
return `${getName(dismissUser)}解散了群聊`;
|
||||
case MessageType.GroupNameUpdated:
|
||||
const groupNameUpdateDetail = JSON.parse(pmsg.notificationElem.detail);
|
||||
const groupNameUpdateUser = groupNameUpdateDetail.opUser;
|
||||
return `${getName(groupNameUpdateUser)}修改了群名称为${
|
||||
groupNameUpdateDetail.group.groupName
|
||||
}`;
|
||||
default:
|
||||
return "[暂未支持的消息类型]";
|
||||
}
|
||||
default:
|
||||
return "[暂未支持的消息类型]";
|
||||
}
|
||||
};
|
||||
|
||||
export const formatConversionTime = (timestemp) => {
|
||||
const fromNowStr = dayjs(timestemp).fromNow();
|
||||
const fromNowStr = dayjs(timestemp).fromNow();
|
||||
|
||||
if (fromNowStr.includes("秒")) {
|
||||
return "刚刚";
|
||||
}
|
||||
if (fromNowStr.includes("秒")) {
|
||||
return "刚刚";
|
||||
}
|
||||
|
||||
if (!fromNowStr.includes("秒") && !fromNowStr.includes("分钟")) {
|
||||
return dayjs(timestemp).calendar();
|
||||
}
|
||||
if (!fromNowStr.includes("秒") && !fromNowStr.includes("分钟")) {
|
||||
return dayjs(timestemp).calendar();
|
||||
}
|
||||
|
||||
return fromNowStr;
|
||||
return fromNowStr;
|
||||
};
|
||||
|
||||
export const secFormat = (sec) => {
|
||||
let h;
|
||||
let s;
|
||||
h = Math.floor(sec / 60);
|
||||
s = sec % 60;
|
||||
h += "";
|
||||
s += "";
|
||||
h = h.length === 1 ? "0" + h : h;
|
||||
s = s.length === 1 ? "0" + s : s;
|
||||
return h + ":" + s;
|
||||
let h;
|
||||
let s;
|
||||
h = Math.floor(sec / 60);
|
||||
s = sec % 60;
|
||||
h += "";
|
||||
s += "";
|
||||
h = h.length === 1 ? "0" + h : h;
|
||||
s = s.length === 1 ? "0" + s : s;
|
||||
return h + ":" + s;
|
||||
};
|
||||
|
||||
export const bytesToSize = (bytes) => {
|
||||
if (bytes === 0) return "0 B";
|
||||
var k = 1024,
|
||||
sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
if (bytes === 0) return "0 B";
|
||||
var k = 1024,
|
||||
sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
||||
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
|
||||
};
|
||||
|
||||
export const tipMessaggeFormat = (msg, currentUserID) => {
|
||||
|
||||
const getName = (user) =>
|
||||
user.userID === currentUserID ? "你" : user.nickname;
|
||||
const getName = (user) =>
|
||||
user.userID === currentUserID ? "你" : user.nickname;
|
||||
|
||||
switch (msg.contentType) {
|
||||
case MessageType.FriendAdded:
|
||||
return `你们已经是好友了~`;
|
||||
case MessageType.GroupCreated:
|
||||
const groupCreatedDetail = JSON.parse(msg.notificationElem.detail);
|
||||
const groupCreatedUser = groupCreatedDetail.opUser;
|
||||
return `${getName(groupCreatedUser)}创建了群聊`;
|
||||
case MessageType.GroupInfoUpdated:
|
||||
const groupUpdateDetail = JSON.parse(msg.notificationElem.detail);
|
||||
const groupUpdateUser = groupUpdateDetail.opUser;
|
||||
return `${parseInfo(groupUpdateUser)}修改了群信息`;
|
||||
case MessageType.GroupOwnerTransferred:
|
||||
const transferDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const transferOpUser = transferDetails.opUser;
|
||||
const newOwner = transferDetails.newGroupOwner;
|
||||
return `${parseInfo(transferOpUser)}转让群主给${parseInfo(newOwner)}`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
return `${parseInfo(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,
|
||||
);
|
||||
inviteStr = inviteStr.slice(0, -1);
|
||||
return `${parseInfo(inviteOpUser)} 邀请了${inviteStr}${
|
||||
switch (msg.contentType) {
|
||||
case MessageType.FriendAdded:
|
||||
return `你们已经是好友了~`;
|
||||
case MessageType.GroupCreated:
|
||||
const groupCreatedDetail = JSON.parse(msg.notificationElem.detail);
|
||||
const groupCreatedUser = groupCreatedDetail.opUser;
|
||||
return `${getName(groupCreatedUser)}创建了群聊`;
|
||||
case MessageType.GroupInfoUpdated:
|
||||
const groupUpdateDetail = JSON.parse(msg.notificationElem.detail);
|
||||
const groupUpdateUser = groupUpdateDetail.opUser;
|
||||
return `${parseInfo(groupUpdateUser)}修改了群信息`;
|
||||
case MessageType.GroupOwnerTransferred:
|
||||
const transferDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const transferOpUser = transferDetails.opUser;
|
||||
const newOwner = transferDetails.newGroupOwner;
|
||||
return `${parseInfo(transferOpUser)}转让群主给${parseInfo(newOwner)}`;
|
||||
case MessageType.MemberQuit:
|
||||
const quitDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const quitUser = quitDetails.quitUser;
|
||||
return `${parseInfo(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,
|
||||
);
|
||||
inviteStr = inviteStr.slice(0, -1);
|
||||
return `${parseInfo(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,
|
||||
);
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${parseInfo(kickOpUser)} 踢出了${kickStr}${
|
||||
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,
|
||||
);
|
||||
kickStr = kickStr.slice(0, -1);
|
||||
return `${parseInfo(kickOpUser)} 踢出了${kickStr}${
|
||||
kickdUserList.length > 3 ? "..." : ""
|
||||
}`;
|
||||
case MessageType.MemberEnter:
|
||||
const enterDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const enterUser = enterDetails.entrantUser;
|
||||
return `${parseInfo(enterUser)}加入了群聊`;
|
||||
case MessageType.GroupDismissed:
|
||||
const dismissDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const dismissUser = dismissDetails.opUser;
|
||||
return `${parseInfo(dismissUser)}解散了群聊`;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
case MessageType.MemberEnter:
|
||||
const enterDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const enterUser = enterDetails.entrantUser;
|
||||
return `${parseInfo(enterUser)}加入了群聊`;
|
||||
case MessageType.GroupDismissed:
|
||||
const dismissDetails = JSON.parse(msg.notificationElem.detail);
|
||||
const dismissUser = dismissDetails.opUser;
|
||||
return `${parseInfo(dismissUser)}解散了群聊`;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
export const markConversationAsRead = (conversation, fromChating = false) => {
|
||||
if (conversation.unreadCount !== 0) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.MarkConversationMessageAsRead,
|
||||
IMSDK.uuid(),
|
||||
conversation.conversationID,
|
||||
);
|
||||
}
|
||||
if (conversation.unreadCount !== 0) {
|
||||
IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.MarkConversationMessageAsRead,
|
||||
IMSDK.uuid(),
|
||||
conversation.conversationID,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export const prepareConversationState = (conversation, back2Tab = false) => {
|
||||
markConversationAsRead(conversation);
|
||||
markConversationAsRead(conversation);
|
||||
|
||||
if (conversation.conversationType === SessionType.WorkingGroup) {
|
||||
store.dispatch("conversation/getCurrentGroup", conversation.groupID);
|
||||
store.dispatch(
|
||||
"conversation/getCurrentMemberInGroup",
|
||||
conversation.groupID,
|
||||
);
|
||||
}
|
||||
store.dispatch("message/resetMessageState");
|
||||
store.commit("conversation/SET_CURRENT_CONVERSATION", conversation);
|
||||
if (conversation.conversationType === SessionType.WorkingGroup) {
|
||||
store.dispatch("conversation/getCurrentGroup", conversation.groupID);
|
||||
store.dispatch(
|
||||
"conversation/getCurrentMemberInGroup",
|
||||
conversation.groupID,
|
||||
);
|
||||
}
|
||||
store.dispatch("message/resetMessageState");
|
||||
store.commit("conversation/SET_CURRENT_CONVERSATION", conversation);
|
||||
|
||||
let url = `/pages/conversation/chating/index?back2Tab=${back2Tab}`;
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
}, 300)
|
||||
let url = `/pages/conversation/chating/index?back2Tab=${back2Tab}`;
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
});
|
||||
}, 300)
|
||||
};
|
||||
|
||||
export const navigateToDesignatedConversation = (
|
||||
sourceID,
|
||||
sessionType,
|
||||
back2Tab = false,
|
||||
) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const { data } = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetOneConversation,
|
||||
IMSDK.uuid(),
|
||||
{
|
||||
sessionType,
|
||||
sourceID,
|
||||
},
|
||||
);
|
||||
prepareConversationState(data, back2Tab);
|
||||
resolve();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
export const navigateToDesignatedConversation = (sourceID,sessionType,back2Tab = false,) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
} = await IMSDK.asyncApi(
|
||||
IMSDK.IMMethods.GetOneConversation,
|
||||
IMSDK.uuid(), {
|
||||
sessionType,
|
||||
sourceID,
|
||||
},
|
||||
);
|
||||
prepareConversationState(data, back2Tab);
|
||||
resolve();
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const offlinePushInfo = {
|
||||
title: "you have a new message",
|
||||
desc: "you have a new message",
|
||||
ex: "",
|
||||
iOSPushSound: "",
|
||||
iOSBadgeCount: true,
|
||||
title: "you have a new message",
|
||||
desc: "you have a new message",
|
||||
ex: "",
|
||||
iOSPushSound: "",
|
||||
iOSBadgeCount: true,
|
||||
};
|
||||
|
||||
export const getConversationContent = (message) => {
|
||||
if (
|
||||
!message.groupID ||
|
||||
message.sendID === store.getters.storeCurrentUserID
|
||||
) {
|
||||
return parseMessageByType(message);
|
||||
}
|
||||
return `${message.senderNickname}:${parseMessageByType(message)}`;
|
||||
if (
|
||||
!message.groupID ||
|
||||
message.sendID === store.getters.storeCurrentUserID
|
||||
) {
|
||||
return parseMessageByType(message);
|
||||
}
|
||||
return `${message.senderNickname}:${parseMessageByType(message)}`;
|
||||
};
|
||||