This commit is contained in:
2025-11-25 05:36:02 +08:00
parent 8e036cc171
commit b10e4b4336
65 changed files with 2672 additions and 2270 deletions
+55 -132
View File
@@ -1,29 +1,16 @@
<script> <script>
import { import {mapGetters,mapActions} from "vuex";
mapGetters, import IMSDK, {IMMethods,MessageType,SessionType,} from "openim-uniapp-polyfill";
mapActions
} from "vuex";
import IMSDK, {
IMMethods,
MessageType,
SessionType,
} from "openim-uniapp-polyfill";
import config from "./common/config"; import config from "./common/config";
import { import {getDbDir,toastWithCallback} from "@/util/common.js";
getDbDir, import {conversationSort} from "@/util/imCommon";
toastWithCallback import {checkUpgrade} from "@/api/login.js"
} from "@/util/common.js"; import {PageEvents,UpdateMessageTypes} from "@/constant";
import {
conversationSort
} from "@/util/imCommon";
import {
PageEvents,
UpdateMessageTypes
} from "@/constant";
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log("App Launch"); console.log("App Launch");
this.checkUpdate();
this.setGlobalIMlistener(); this.setGlobalIMlistener();
this.tryLogin(); this.tryLogin();
// #ifdef H5 // #ifdef H5
@@ -101,15 +88,11 @@
}); });
// sync // sync
const syncStartHandler = ({ const syncStartHandler = ({data}) => {
data
}) => {
this.$store.commit("user/SET_IS_SYNCING", true); this.$store.commit("user/SET_IS_SYNCING", true);
this.$store.commit("user/SET_REINSTALL", data); this.$store.commit("user/SET_REINSTALL", data);
}; };
const syncProgressHandler = ({ const syncProgressHandler = ({data}) => {
data
}) => {
this.$store.commit("user/SET_PROGRESS", data); this.$store.commit("user/SET_PROGRESS", data);
}; };
const syncFinishHandler = () => { const syncFinishHandler = () => {
@@ -133,9 +116,7 @@
IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerProgress, syncProgressHandler); IMSDK.subscribe(IMSDK.IMEvents.OnSyncServerProgress, syncProgressHandler);
// self // self
const selfInfoUpdateHandler = ({ const selfInfoUpdateHandler = ({data}) => {
data
}) => {
this.$store.commit("user/SET_SELF_INFO", { this.$store.commit("user/SET_SELF_INFO", {
...this.storeSelfInfo, ...this.storeSelfInfo,
...data, ...data,
@@ -145,9 +126,7 @@
IMSDK.subscribe(IMSDK.IMEvents.OnSelfInfoUpdated, selfInfoUpdateHandler); IMSDK.subscribe(IMSDK.IMEvents.OnSelfInfoUpdated, selfInfoUpdateHandler);
// message // message
const newMessagesHandler = ({ const newMessagesHandler = ({data}) => {
data
}) => {
if (this.storeIsSyncing) { if (this.storeIsSyncing) {
return; return;
} }
@@ -157,9 +136,7 @@
IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessages, newMessagesHandler); IMSDK.subscribe(IMSDK.IMEvents.OnRecvNewMessages, newMessagesHandler);
// friend // friend
const friendInfoChangeHandler = ({ const friendInfoChangeHandler = ({data}) => {
data
}) => {
uni.$emit(IMSDK.IMEvents.OnFriendInfoChanged, { uni.$emit(IMSDK.IMEvents.OnFriendInfoChanged, {
data data
}); });
@@ -167,36 +144,25 @@
friendInfo: data, friendInfo: data,
}); });
}; };
const friendAddedHandler = ({ const friendAddedHandler = ({data}) => {
data
}) => {
this.pushNewFriend(data); this.pushNewFriend(data);
}; };
const friendDeletedHander = ({ const friendDeletedHander = ({data}) => {
data
}) => {
this.updateFriendInfo({ this.updateFriendInfo({
friendInfo: data, friendInfo: data,
isRemove: true, isRemove: true,
}); });
}; };
IMSDK.subscribe( IMSDK.subscribe(IMSDK.IMEvents.OnFriendInfoChanged,friendInfoChangeHandler);
IMSDK.IMEvents.OnFriendInfoChanged,
friendInfoChangeHandler
);
IMSDK.subscribe(IMSDK.IMEvents.OnFriendAdded, friendAddedHandler); IMSDK.subscribe(IMSDK.IMEvents.OnFriendAdded, friendAddedHandler);
IMSDK.subscribe(IMSDK.IMEvents.OnFriendDeleted, friendDeletedHander); IMSDK.subscribe(IMSDK.IMEvents.OnFriendDeleted, friendDeletedHander);
// blacklist // blacklist
const blackAddedHandler = ({ const blackAddedHandler = ({data}) => {
data
}) => {
this.pushNewBlack(data); this.pushNewBlack(data);
}; };
const blackDeletedHandler = ({ const blackDeletedHandler = ({data}) => {
data
}) => {
this.updateBlackInfo({ this.updateBlackInfo({
blackInfo: data, blackInfo: data,
isRemove: true, isRemove: true,
@@ -207,58 +173,34 @@
IMSDK.subscribe(IMSDK.IMEvents.OnBlackDeleted, blackDeletedHandler); IMSDK.subscribe(IMSDK.IMEvents.OnBlackDeleted, blackDeletedHandler);
// group // group
const joinedGroupAddedHandler = ({ const joinedGroupAddedHandler = ({data}) => {
data
}) => {
this.pushNewGroup(data); this.pushNewGroup(data);
}; };
const joinedGroupDeletedHandler = ({ const joinedGroupDeletedHandler = ({data}) => {
data
}) => {
this.updateGroupInfo({ this.updateGroupInfo({
groupInfo: data, groupInfo: data,
isRemove: true, isRemove: true,
}); });
}; };
const groupInfoChangedHandler = ({ const groupInfoChangedHandler = ({data}) => {
data
}) => {
this.updateGroupInfo({ this.updateGroupInfo({
groupInfo: data, groupInfo: data,
}); });
}; };
const groupMemberInfoChangedHandler = ({ const groupMemberInfoChangedHandler = ({data}) => {
data uni.$emit(IMSDK.IMEvents.OnGroupMemberInfoChanged, {data});
}) => {
uni.$emit(IMSDK.IMEvents.OnGroupMemberInfoChanged, {
data
});
if (data.groupID === this.storeCurrentConversation?.groupID) { if (data.groupID === this.storeCurrentConversation?.groupID) {
this.updateCurrentMemberInGroup(data); this.updateCurrentMemberInGroup(data);
} }
}; };
IMSDK.subscribe( IMSDK.subscribe(IMSDK.IMEvents.OnJoinedGroupAdded,joinedGroupAddedHandler);
IMSDK.IMEvents.OnJoinedGroupAdded, IMSDK.subscribe(IMSDK.IMEvents.OnJoinedGroupDeleted,joinedGroupDeletedHandler);
joinedGroupAddedHandler IMSDK.subscribe(IMSDK.IMEvents.OnGroupInfoChanged,groupInfoChangedHandler);
); IMSDK.subscribe(IMSDK.IMEvents.OnGroupMemberInfoChanged,groupMemberInfoChangedHandler);
IMSDK.subscribe(
IMSDK.IMEvents.OnJoinedGroupDeleted,
joinedGroupDeletedHandler
);
IMSDK.subscribe(
IMSDK.IMEvents.OnGroupInfoChanged,
groupInfoChangedHandler
);
IMSDK.subscribe(
IMSDK.IMEvents.OnGroupMemberInfoChanged,
groupMemberInfoChangedHandler
);
// application // application
const friendApplicationNumHandler = ({ const friendApplicationNumHandler = ({data}) => {
data
}) => {
const isRecv = data.toUserID === this.storeCurrentUserID; const isRecv = data.toUserID === this.storeCurrentUserID;
if (isRecv) { if (isRecv) {
this.pushNewRecvFriendApplition(data); this.pushNewRecvFriendApplition(data);
@@ -266,9 +208,7 @@
this.pushNewSentFriendApplition(data); this.pushNewSentFriendApplition(data);
} }
}; };
const friendApplicationAccessHandler = ({ const friendApplicationAccessHandler = ({data}) => {
data
}) => {
const isRecv = data.toUserID === this.storeCurrentUserID; const isRecv = data.toUserID === this.storeCurrentUserID;
if (isRecv) { if (isRecv) {
this.updateRecvFriendApplition({ this.updateRecvFriendApplition({
@@ -280,9 +220,7 @@
}); });
} }
}; };
const groupApplicationNumHandler = ({ const groupApplicationNumHandler = ({data}) => {
data
}) => {
const isRecv = data.userID !== this.storeCurrentUserID; const isRecv = data.userID !== this.storeCurrentUserID;
if (isRecv) { if (isRecv) {
this.pushNewRecvGroupApplition(data); this.pushNewRecvGroupApplition(data);
@@ -290,9 +228,7 @@
this.pushNewSentGroupApplition(data); this.pushNewSentGroupApplition(data);
} }
}; };
const groupApplicationAccessHandler = ({ const groupApplicationAccessHandler = ({data}) => {
data
}) => {
const isRecv = data.userID !== this.storeCurrentUserID; const isRecv = data.userID !== this.storeCurrentUserID;
if (isRecv) { if (isRecv) {
this.updateRecvGroupApplition({ this.updateRecvGroupApplition({
@@ -305,43 +241,21 @@
} }
}; };
IMSDK.subscribe( IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationAdded,friendApplicationNumHandler);
IMSDK.IMEvents.OnFriendApplicationAdded, IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationAccepted,friendApplicationAccessHandler);
friendApplicationNumHandler IMSDK.subscribe(IMSDK.IMEvents.OnFriendApplicationRejected,friendApplicationAccessHandler);
); IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationAdded,groupApplicationNumHandler);
IMSDK.subscribe( IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationAccepted,groupApplicationAccessHandler);
IMSDK.IMEvents.OnFriendApplicationAccepted, IMSDK.subscribe(IMSDK.IMEvents.OnGroupApplicationRejected,groupApplicationAccessHandler);
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 // conversation
const totalUnreadCountChangedHandler = ({ const totalUnreadCountChangedHandler = ({data}) => {
data
}) => {
if (this.storeIsSyncing) { if (this.storeIsSyncing) {
return; return;
} }
this.$store.commit("conversation/SET_UNREAD_COUNT", data); this.$store.commit("conversation/SET_UNREAD_COUNT", data);
}; };
const newConversationHandler = ({ const newConversationHandler = ({data}) => {
data
}) => {
if (this.storeIsSyncing) { if (this.storeIsSyncing) {
return; return;
} }
@@ -351,9 +265,7 @@
conversationSort(result) conversationSort(result)
); );
}; };
const conversationChangedHandler = ({ const conversationChangedHandler = ({data}) => {
data
}) => {
if (this.storeIsSyncing) { if (this.storeIsSyncing) {
return; return;
} }
@@ -421,17 +333,14 @@
uni.$u.toast("初始化IMSDK失败!"); uni.$u.toast("初始化IMSDK失败!");
return; return;
} }
const status = await IMSDK.asyncApi( const status = await IMSDK.asyncApi(IMSDK.IMMethods.GetLoginStatus,IMSDK.uuid());
IMSDK.IMMethods.GetLoginStatus,
IMSDK.uuid()
);
if (status === 3) { if (status === 3) {
initStore(); initStore();
return; return;
} }
const IMToken = uni.getStorageSync("IMToken"); const IMToken = uni.getStorageSync("IMToken");
const IMUserID = uni.getStorageSync("IMUserID"); const IMUserID = uni.getStorageSync("IMUserID")+'';
if (IMToken && IMUserID) { if (IMToken && IMUserID) {
IMSDK.asyncApi(IMSDK.IMMethods.Login, IMSDK.uuid(), { IMSDK.asyncApi(IMSDK.IMMethods.Login, IMSDK.uuid(), {
userID: IMUserID, userID: IMUserID,
@@ -494,6 +403,20 @@
this.storeCurrentConversation.conversationID 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> </script>
+44 -6
View File
@@ -1,6 +1,9 @@
// 登录 // 登录
export const businessConfig = (params) => export const businessConfig = (params) =>
uni.$u?.http.post("/common/init", JSON.stringify(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) => export const businessLogin = (params) =>
uni.$u?.http.post("/common/login", JSON.stringify(params)); uni.$u?.http.post("/common/login", JSON.stringify(params));
export const businessSendSms = (params) => export const businessSendSms = (params) =>
@@ -28,9 +31,8 @@ export const businessModify = (params) =>
export const businessInfoUpdate = (params) => export const businessInfoUpdate = (params) =>
uni.$u?.http.post( uni.$u?.http.post(
"/user/profile", "/user/profile",
JSON.stringify({ JSON.stringify({ ...params, }),
...params, {
}), {
header: { header: {
token: uni.getStorageSync("BusinessToken"), token: uni.getStorageSync("BusinessToken"),
}, },
@@ -39,9 +41,8 @@ export const businessInfoUpdate = (params) =>
export const businessGetUserInfo = (userID) => export const businessGetUserInfo = (userID) =>
uni.$u?.http.post( uni.$u?.http.post(
"/user/find", "/user/find",
JSON.stringify({ JSON.stringify({ userIDs: [userID], }),
userIDs: [userID], {
}), {
header: { header: {
token: uni.getStorageSync("BusinessToken"), token: uni.getStorageSync("BusinessToken"),
}, },
@@ -77,3 +78,40 @@ export const businessSearchUser = (keyword,searchtype) =>
}, },
} }
); );
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"),
},
}
);
}
+1 -1
View File
@@ -7,7 +7,7 @@ const BASE_DOMAIN = 'www.axzc.xyz'
// const CHAT_URL = `https://${BASE_DOMAIN}/chat` // const CHAT_URL = `https://${BASE_DOMAIN}/chat`
// const API_URL = `https://${BASE_DOMAIN}/api` // const API_URL = `https://${BASE_DOMAIN}/api`
// const WS_URL = `wss://${BASE_DOMAIN}/msg_gateway` // 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 API_URL = `http://${BASE_DOMAIN}/imapi`
const WS_URL = `ws://${BASE_DOMAIN}/ws` const WS_URL = `ws://${BASE_DOMAIN}/ws`
@@ -1,12 +1,8 @@
<template> <template>
<view class="selected_item"> <view class="selected_item">
<view class="left_info"> <view class="left_info">
<my-avatar <my-avatar :src="source.faceURL" :desc="source.nickname || source.showName"
:src="source.faceURL" :isGroup="Boolean(source.groupID)" size="42" />
:desc="source.nickname || source.showName"
:isGroup="Boolean(source.groupID)"
size="42"
/>
<text>{{ source.nickname || source.groupName || source.showName }}</text> <text>{{ source.nickname || source.groupName || source.showName }}</text>
</view> </view>
<view> <view>
+3 -16
View File
@@ -8,19 +8,9 @@
<view class="select_list">{{ selectedStr }}</view> <view class="select_list">{{ selectedStr }}</view>
</view> </view>
<view class=""> <view class="">
<u-button <u-button :loading="comfirmLoading" @click="clickComfirm" :disabled="choosedData.length === 0"
:loading="comfirmLoading"
@click="clickComfirm"
:disabled="choosedData.length === 0"
type="primary" type="primary"
:text=" :text="isRemove? '移除': `确定(${choosedData.length}${maxLength > 0 ? `/${maxLength}` : ``})`" />
isRemove
? '移除'
: `确定(${choosedData.length}${
maxLength > 0 ? `/${maxLength}` : ``
})`
"
/>
<u-popup round="24" :show="showSelected" mode="bottom" @close="close"> <u-popup round="24" :show="showSelected" mode="bottom" @close="close">
<view class="selected_container"> <view class="selected_container">
<view class="top_desc"> <view class="top_desc">
@@ -28,10 +18,7 @@
<text @click="close" class="comfirm_text">确认</text> <text @click="close" class="comfirm_text">确认</text>
</view> </view>
<u-list class="selected_list"> <u-list class="selected_list">
<u-list-item <u-list-item v-for="item in choosedData" :key="item.userID || item.groupID">
v-for="item in choosedData"
:key="item.userID || item.groupID"
>
<selected-member @removeItem="removeItem(item)" :source="item" /> <selected-member @removeItem="removeItem(item)" :source="item" />
</u-list-item> </u-list-item>
</u-list> </u-list>
+6 -20
View File
@@ -1,26 +1,11 @@
<template> <template>
<u-index-list <u-index-list @scrolltolower="scrolltolower" class="user_list" :style="{ height: height }" :index-list="indexList">
@scrolltolower="scrolltolower"
class="user_list"
:style="{ height: height }"
:index-list="indexList"
>
<template v-for="(item, index) in itemArr"> <template v-for="(item, index) in itemArr">
<u-index-item :key="index"> <u-index-item :key="index">
<u-index-anchor <u-index-anchor class="user_anchor" :text="indexList[index]"></u-index-anchor>
class="user_anchor" <user-item @itemClick="itemClick" @updateCheck="updateCheck"
:text="indexList[index]" :checked="checkedIDList.includes(cell.userID)" :disabled="disabledIDList.includes(cell.userID)"
></u-index-anchor> :checkVisible="showCheck" v-for="cell in item" :item="cell" :key="cell.userID" />
<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> </u-index-item>
</template> </template>
</u-index-list> </u-index-list>
@@ -79,6 +64,7 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.user_list { .user_list {
flex: 1; flex: 1;
::v-deep uni-scroll-view { ::v-deep uni-scroll-view {
max-height: 100% !important; max-height: 100% !important;
} }
+4
View File
@@ -1,5 +1,9 @@
export const ChatingFooterActionTypes = { export const ChatingFooterActionTypes = {
Album: "Album", Album: "Album",
Camera: "Camera",
Video: "Video",
Voice: "Voice",
Location: "Location",
}; };
export const ContactMenuTypes = { export const ContactMenuTypes = {
+17 -4
View File
@@ -1,5 +1,5 @@
{ {
"name" : "IM-UCB", "name" : "探探",
"appid" : "__UNI__F0A946D", "appid" : "__UNI__F0A946D",
"description" : "", "description" : "",
"versionName" : "3.3.4", "versionName" : "3.3.4",
@@ -21,7 +21,10 @@
"Camera" : {}, "Camera" : {},
"Record" : {}, "Record" : {},
"Geolocation" : {}, "Geolocation" : {},
"Maps" : {} "Maps" : {},
"Fingerprint" : {},
"Contacts" : {},
"Barcode" : {}
}, },
"distribute" : { "distribute" : {
"android" : { "android" : {
@@ -66,8 +69,18 @@
}, },
"sdkConfigs" : { "sdkConfigs" : {
"ad" : {}, "ad" : {},
"geolocation" : {}, "geolocation" : {
"maps" : {}, "system" : {
"__platform__" : [ "ios", "android" ]
}
},
"maps" : {
"amap" : {
"name" : "amap_18926034082bYRO97pz",
"appkey_ios" : "cfc7b531b60382598b4aac7944415fba",
"appkey_android" : "e431515e99e69fc1b6edb674e3487f1a"
}
},
"share" : {}, "share" : {},
"statics" : {}, "statics" : {},
"speech" : {} "speech" : {}
+2 -1
View File
@@ -1,11 +1,12 @@
{ {
"dependencies": { "dependencies": {
"@openim/client-sdk": "^0.0.11-ahpha.1",
"date-fns": "^2.30.0", "date-fns": "^2.30.0",
"dayjs": "^1.11.6", "dayjs": "^1.11.6",
"image-tools": "^1.4.0", "image-tools": "^1.4.0",
"md5": "^2.3.0", "md5": "^2.3.0",
"@openim/client-sdk": "^0.0.11-ahpha.1",
"openim-uniapp-polyfill": "^1.4.1", "openim-uniapp-polyfill": "^1.4.1",
"qrcode": "^1.5.4",
"uuid": "^9.0.0" "uuid": "^9.0.0"
} }
} }
+38 -14
View File
@@ -245,37 +245,61 @@
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "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": { "tabBar": {
"color": "#8E9AB0", "color": "#171717",
"selectedColor": "#0089FF", "selectedColor": "#07c160",
"borderStyle": "black", "borderStyle": "#f4f4f4",
"backgroundColor": "#ffffff", "backgroundColor": "#f4f4f4",
"height": "55px", "height": "55px",
"list": [{ "list": [{
"pagePath": "pages/conversation/conversationList/index", "pagePath": "pages/conversation/conversationList/index",
"iconPath": "./static/images/tabbar_conversation.png", "iconPath": "./static/images/tabbar/conversation.png",
"selectedIconPath": "static/images/tabbar_conversation_active.png", "selectedIconPath": "static/images/tabbar/conversation_active.png",
"text": "OpenIM" "text": "消息"
}, },
{ {
"pagePath": "pages/contact/index/index", "pagePath": "pages/contact/index/index",
"iconPath": "./static/images/tabbar_contacts.png", "iconPath": "./static/images/tabbar/contacts.png",
"selectedIconPath": "static/images/tabbar_contacts_active.png", "selectedIconPath": "static/images/tabbar/contacts_active.png",
"text": "通讯录" "text": "通讯录"
}, },
{ {
"pagePath": "pages/workbench/index/index", "pagePath": "pages/workbench/index/index",
"iconPath": "./static/images/tabbar_workbench.png", "iconPath": "./static/images/tabbar/workbench.png",
"selectedIconPath": "static/images/tabbar_workbench_active.png", "selectedIconPath": "static/images/tabbar/workbench_active.png",
"text": "发现" "text": "发现"
}, },
{ {
"pagePath": "pages/profile/index/index", "pagePath": "pages/profile/index/index",
"iconPath": "./static/images/tabbar_profile.png", "iconPath": "./static/images/tabbar/profile.png",
"selectedIconPath": "static/images/tabbar_profile_active.png", "selectedIconPath": "static/images/tabbar/profile_active.png",
"text": "我" "text": "我"
} }
] ]
}, },
+61
View File
@@ -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>
+21 -35
View File
@@ -3,44 +3,26 @@
<custom-nav-bar title="联系人" /> <custom-nav-bar title="联系人" />
<view class="search_bar_wrap"> <view class="search_bar_wrap">
<u-search <u-search shape="square" placeholder="搜索" :showAction="false" v-model="keyword" />
shape="square"
placeholder="搜索"
:showAction="false"
v-model="keyword"
/>
</view> </view>
<view class="tab_container"> <view class="tab_container">
<template v-if="activeTab === 0"> <template v-if="activeTab === 0">
<setting-item <setting-item @click="tabChange(tabs[0].idx)" :title="tabs[0].title" :border="false" />
@click="tabChange(tabs[0].idx)"
:title="tabs[0].title"
:border="false"
/>
<view class="tab_pane"></view> <view class="tab_pane"></view>
</template> </template>
<template v-else> <template v-else>
<view class="tab_pane" v-show="activeTab === 1"> <view class="tab_pane" v-show="activeTab === 1">
<choose-index-list <choose-index-list @updateCheck="updateCheckedUser" :indexList="getChooseData.indexList"
@updateCheck="updateCheckedUser" :itemArr="getChooseData.dataList" :checkedIDList="checkedUserIDList"
:indexList="getChooseData.indexList" :disabledIDList="disabledUserIDList" :showCheck="true" />
:itemArr="getChooseData.dataList"
:checkedIDList="checkedUserIDList"
:disabledIDList="disabledUserIDList"
:showCheck="true"
/>
</view> </view>
</template> </template>
</view> </view>
<choose-index-footer <choose-index-footer :comfirmLoading="comfirmLoading" @removeItem="updateCheckedUserOrGroup" @confirm="confirm"
:comfirmLoading="comfirmLoading" :choosedData="getCheckedInfo" />
@removeItem="updateCheckedUserOrGroup"
@confirm="confirm"
:choosedData="getCheckedInfo"
/>
</view> </view>
</template> </template>
@@ -117,16 +99,13 @@ export default {
}, },
}, },
onLoad(options) { onLoad(options) {
const { const {groupID,type,checkedUserIDList,} = options;
groupID, console.log(this.storeFriendList);
type,
checkedUserIDList,
} = options;
this.type = type; this.type = type;
this.groupID = groupID; this.groupID = groupID;
this.checkedUserIDList = checkedUserIDList this.checkedUserIDList = checkedUserIDList ?
? JSON.parse(checkedUserIDList) JSON.parse(checkedUserIDList) :
: []; [];
if (this.type === ContactChooseTypes.Invite) { if (this.type === ContactChooseTypes.Invite) {
this.checkDisabledUser(); this.checkDisabledUser();
} }
@@ -137,7 +116,9 @@ export default {
IMSDK.asyncApi("getUsersInGroup", IMSDK.uuid(), { IMSDK.asyncApi("getUsersInGroup", IMSDK.uuid(), {
groupID: this.groupID, groupID: this.groupID,
userIDList: friendIDList, userIDList: friendIDList,
}).then(({ data }) => { }).then(({
data
}) => {
this.disabledUserIDList = data; this.disabledUserIDList = data;
}); });
}, },
@@ -150,7 +131,9 @@ export default {
this.updateCheckedUser(item); this.updateCheckedUser(item);
} }
}, },
updateCheckedUser({ userID }) { updateCheckedUser({
userID
}) {
if (this.checkedUserIDList.includes(userID)) { if (this.checkedUserIDList.includes(userID)) {
const idx = this.checkedUserIDList.findIndex((item) => item === userID); const idx = this.checkedUserIDList.findIndex((item) => item === userID);
const tmpArr = [...this.checkedUserIDList]; const tmpArr = [...this.checkedUserIDList];
@@ -209,10 +192,12 @@ export default {
::v-deep.u-popup { ::v-deep.u-popup {
flex: none; flex: none;
} }
.contact_choose_container { .contact_choose_container {
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.search_bar_wrap { .search_bar_wrap {
height: 34px; height: 34px;
padding: 12px 22px; padding: 12px 22px;
@@ -262,6 +247,7 @@ export default {
.member_list { .member_list {
flex: 1; flex: 1;
height: 80% !important; height: 80% !important;
::v-deepuni-scroll-view { ::v-deepuni-scroll-view {
max-height: 100% !important; max-height: 100% !important;
} }
+5 -3
View File
@@ -86,6 +86,7 @@
); );
info = data[0]; info = data[0];
} }
console.log(info)
if (info) { if (info) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(info,)}`, url: `/pages/common/groupCard/index?sourceInfo=${JSON.stringify(info,)}`,
@@ -103,7 +104,7 @@
const {data} = await IMSDK.asyncApi( const {data} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetUsersInfo, IMSDK.IMMethods.GetUsersInfo,
IMSDK.uuid(), IMSDK.uuid(),
[res.data[0].id], [res.data[0].id+''],
); );
const imData = data[0]; const imData = data[0];
@@ -111,9 +112,9 @@
...imData, ...imData,
...res.data[0], ...res.data[0],
}; };
}
}
console.log(info) console.log(info)
}
}
if (info) { if (info) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(info,)}`, url: `/pages/common/userCard/index?sourceInfo=${JSON.stringify(info,)}`,
@@ -123,6 +124,7 @@
} }
} }
} catch (e) { } catch (e) {
console.log(e);
//TODO handle the exception //TODO handle the exception
} }
this.searching = false; this.searching = false;
+6 -14
View File
@@ -9,14 +9,7 @@
<text class="title">{{ `发送${isGroup ? "入群" : "好友"}申请` }}</text> <text class="title">{{ `发送${isGroup ? "入群" : "好友"}申请` }}</text>
<view class="input_container"> <view class="input_container">
<u--textarea <u--textarea height="120" v-model="reason" border="none" placeholder="请输入内容" maxlength="20" count>
height="120"
v-model="reason"
border="none"
placeholder="请输入内容"
maxlength="20"
count
>
</u--textarea> </u--textarea>
</view> </view>
</view> </view>
@@ -42,8 +35,7 @@ export default {
}; };
}, },
onLoad(options) { onLoad(options) {
const { isGroup, sourceID, isScan, notNeedVerification, sessionType } = const {isGroup,sourceID,isScan,notNeedVerification,sessionType} = options;
options;
this.isGroup = JSON.parse(isGroup); this.isGroup = JSON.parse(isGroup);
this.isScan = JSON.parse(isScan); this.isScan = JSON.parse(isScan);
this.sourceID = sourceID; this.sourceID = sourceID;
@@ -54,9 +46,9 @@ export default {
sendRequest() { sendRequest() {
let func; let func;
if (this.isGroup) { if (this.isGroup) {
const joinSource = this.isScan const joinSource = this.isScan ?
? GroupJoinSource.QrCode GroupJoinSource.QrCode :
: GroupJoinSource.Search; GroupJoinSource.Search;
func = IMSDK.asyncApi(IMSDK.IMMethods.JoinGroup, IMSDK.uuid(), { func = IMSDK.asyncApi(IMSDK.IMMethods.JoinGroup, IMSDK.uuid(), {
groupID: this.sourceID, groupID: this.sourceID,
reqMsg: this.reason, reqMsg: this.reason,
@@ -84,7 +76,7 @@ export default {
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
uni.$u.toast("发送失败"); uni.$u.toast(err.errMsg || "发送失败");
}); });
}, },
showToast(message) { showToast(message) {
+110
View File
@@ -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>
+24 -14
View File
@@ -15,7 +15,11 @@
<u-button type="primary" icon="man-add" text="添加"></u-button> <u-button type="primary" icon="man-add" text="添加"></u-button>
</view> </view>
</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"> <view v-if="isFriend" class="info_row">
<user-info-row-item @click="toMoreInfo" lable="个人资料" arrow /> <user-info-row-item @click="toMoreInfo" lable="个人资料" arrow />
</view> </view>
@@ -31,21 +35,14 @@
</template> </template>
<script> <script>
import { import {mapGetters} from "vuex";
mapGetters import {navigateToDesignatedConversation} from "@/util/imCommon";
} from "vuex"; import IMSDK, {SessionType,} from "openim-uniapp-polyfill";
import {
navigateToDesignatedConversation
} from "@/util/imCommon";
import IMSDK, {
SessionType,
} from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import UserInfoRowItem from "./components/UserInfoRowItem.vue"; import UserInfoRowItem from "./components/UserInfoRowItem.vue";
import { import {businessSearchUserInfo} from "@/api/login";
businessSearchUserInfo import dayjs from "dayjs";
} from "@/api/login";
export default { export default {
components: { components: {
@@ -67,6 +64,19 @@
"storeFriendList", "storeFriendList",
"storeSelfInfo", "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() { isFriend() {
return ( return (
this.storeFriendList.findIndex( this.storeFriendList.findIndex(
@@ -142,7 +152,7 @@
} = await IMSDK.asyncApi( } = await IMSDK.asyncApi(
IMSDK.IMMethods.GetUsersInfo, IMSDK.IMMethods.GetUsersInfo,
IMSDK.uuid(), IMSDK.uuid(),
[this.sourceID], [this.sourceID+''],
); );
const imData = data[0]?.friendInfo ?? data[0]?.publicInfo ?? {}; const imData = data[0]?.friendInfo ?? data[0]?.publicInfo ?? {};
info = { info = {
+33
View File
@@ -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>
+2 -12
View File
@@ -3,18 +3,8 @@
<custom-nav-bar title="添加" /> <custom-nav-bar title="添加" />
<view class="action_row"> <view class="action_row">
<action-item <action-item @click="friendAction(item)" v-for="item in friendActionMenus" :action="item" :key="'f_'+item.idx" />
@click="friendAction(item)" <action-item @click="groupAction(item)" v-for="item in groupActionMenus" :action="item" :key="'g_'+item.idx" />
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> </view>
</template> </template>
@@ -1,12 +1,7 @@
<template> <template>
<view class="chat_action_bar"> <view class="chat_action_bar">
<u-row class="action_row"> <u-row class="action_row">
<u-col <u-col v-for="item in actionList" :key="item.idx" @click="actionClick(item)" span="3">
v-for="item in actionList"
:key="item.idx"
@click="actionClick(item)"
span="3"
>
<view class="action_item"> <view class="action_item">
<image :src="item.icon" alt="" srcset="" /> <image :src="item.icon" alt="" srcset="" />
<text class="action_item_title">{{ item.title }}</text> <text class="action_item_title">{{ item.title }}</text>
@@ -17,9 +12,7 @@
</template> </template>
<script> <script>
import { import {ChatingFooterActionTypes,} from "@/constant";
ChatingFooterActionTypes,
} from "@/constant";
export default { export default {
components: {}, components: {},
@@ -29,18 +22,57 @@ export default {
{ {
idx: 0, idx: 0,
type: ChatingFooterActionTypes.Album, type: ChatingFooterActionTypes.Album,
title: "相册", title: "照片",
icon: require("static/images/chating_action_image.png"), 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: { methods: {
async actionClick(action) { async actionClick(action) {
switch (action.type) { switch (action.type) {
case ChatingFooterActionTypes.Video:
this.$emit("prepareMediaMessage", action.type);
break;
case ChatingFooterActionTypes.Album: case ChatingFooterActionTypes.Album:
this.$emit("prepareMediaMessage", action.type); this.$emit("prepareMediaMessage", action.type);
break; break;
case ChatingFooterActionTypes.Camera:
this.$emit("prepareMediaMessage", action.type);
break;
case ChatingFooterActionTypes.Location:
this.$emit("prepareMediaMessage", action.type);
break;
default: default:
break; break;
} }
@@ -25,40 +25,26 @@
</template> </template>
<script> <script>
import { import {mapGetters,mapActions} from "vuex";
mapGetters, import {getPurePath,html2Text} from "@/util/common";
mapActions import {offlinePushInfo} from "@/util/imCommon";
} from "vuex"; import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
import { import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
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 UParse from "@/components/gaoyia-parse/parse.vue";
import CustomEditor from "./CustomEditor.vue"; import CustomEditor from "./CustomEditor.vue";
import ChatingActionBar from "./ChatingActionBar.vue"; import ChatingActionBar from "./ChatingActionBar.vue";
const needClearTypes = [MessageType.TextMessage]; const needClearTypes = [MessageType.TextMessage];
const albumChoose = [{ const rtcChoose = [
name: "图片", {
type: ChatingFooterActionTypes.Album, name: "视频通话",
type: ChatingFooterActionTypes.Video,
idx: 0, idx: 0,
}, },
{ {
name: "拍照", name: "语言通话",
type: ChatingFooterActionTypes.Camera, type: ChatingFooterActionTypes.Voice,
idx: 1, idx: 1,
}, },
]; ];
@@ -133,23 +119,19 @@
message, message,
offlinePushInfo, offlinePushInfo,
}) })
.then(({ .then(({data}) => {
data
}) => {
this.updateOneMessage({ this.updateOneMessage({
message: data, message: data,
isSuccess: true, isSuccess: true,
}); });
}) })
.catch(({ .catch(({data,errCode,errMsg}) => {
data, uni.$u.toast(errMsg);
errCode,
errMsg
}) => {
this.updateOneMessage({ this.updateOneMessage({
message: data, message: data,
type: UpdateMessageTypes.KeyWords, type: UpdateMessageTypes.KeyWords,
keyWords: [{ keyWords: [
{
key: "status", key: "status",
value: MessageStatus.Failed, value: MessageStatus.Failed,
}, },
@@ -186,14 +168,62 @@
this.inputHtml = e.detail.html; this.inputHtml = e.detail.html;
}, },
prepareMediaMessage(type) { prepareMediaMessage(type) {
if (type === ChatingFooterActionTypes.Album) { console.log(type)
this.actionSheetMenu = [...albumChoose]; if (type === ChatingFooterActionTypes.Video) {
} this.actionSheetMenu = [...rtcChoose];
this.showActionSheet = true; 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,
})
}
}, },
// from comp // from comp
batchCreateImageMesage(paths) { 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) => { paths.forEach(async (path) => {
const message = await IMSDK.asyncApi( const message = await IMSDK.asyncApi(
IMMethods.CreateImageMessageFromFullPath, IMMethods.CreateImageMessageFromFullPath,
@@ -203,17 +233,19 @@
this.sendMessage(message); this.sendMessage(message);
}); });
}, },
selectClick({ selectClick({idx}) {
idx
}) {
if (idx === 0) { if (idx === 0) {
this.chooseOrShotImage(["album"]).then((paths) => uni.$u.toast('根据相关政策,暂时禁用视频通话');
this.batchCreateImageMesage(paths) //发送视频通话
); // this.chooseOrShotImage(["album"]).then((paths) =>
// this.batchCreateImageMesage(paths)
// );
} else { } else {
this.chooseOrShotImage(["camera"]).then((paths) => uni.$u.toast('根据相关政策,暂时禁用音频通话');
this.batchCreateImageMesage(paths) //发送音频通话
); // this.chooseOrShotImage(["camera"]).then((paths) =>
// this.batchCreateImageMesage(paths)
// );
} }
}, },
chooseOrShotImage(sourceType) { chooseOrShotImage(sourceType) {
@@ -222,9 +254,7 @@
count: 9, count: 9,
sizeType: ["compressed"], sizeType: ["compressed"],
sourceType, sourceType,
success: function({ success: function({tempFilePaths}) {
tempFilePaths
}) {
resolve(tempFilePaths); resolve(tempFilePaths);
}, },
fail: function(err) { fail: function(err) {
@@ -236,9 +266,7 @@
}, },
// keyboard // keyboard
keyboardChangeHander({ keyboardChangeHander({height}) {
height
}) {
if (height > 0) { if (height > 0) {
if (this.actionBarVisible) { if (this.actionBarVisible) {
this.actionBarVisible = false; this.actionBarVisible = false;
@@ -1,39 +1,23 @@
<template> <template>
<view class="chat_header"> <view class="chat_header">
<view class="self_info"> <view class="self_info">
<my-avatar <my-avatar :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname" size="46" />
:src="storeSelfInfo.faceURL"
:desc="storeSelfInfo.nickname"
size="46"
/>
<view class="self_info_desc"> <view class="self_info_desc">
<view class="user_state"> <view class="user_state">
<text class="nickname">{{ storeSelfInfo.nickname }}</text> <text class="nickname">{{ storeSelfInfo.nickname }}</text>
<view v-if="!storeReinstall"> <view v-if="!storeReinstall">
<view class="tag" v-if="storeIsSyncing"> <view class="tag" v-if="storeIsSyncing">
<img <img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
class="loading" alt="" />
style="height: 24rpx; width: 24rpx"
src="static/images/loading.png"
alt=""
/>
<text class="status">同步中</text> <text class="status">同步中</text>
</view> </view>
<view class="tag" v-if="connectStart == 0"> <view class="tag" v-if="connectStart == 0">
<img <img class="loading" style="height: 24rpx; width: 24rpx" src="static/images/loading.png"
class="loading" alt="" />
style="height: 24rpx; width: 24rpx"
src="static/images/loading.png"
alt=""
/>
<text class="status">连接中</text> <text class="status">连接中</text>
</view> </view>
<view class="err-tag" v-if="connectStart == -1"> <view class="err-tag" v-if="connectStart == -1">
<img <img style="height: 24rpx; width: 24rpx" src="static/images/sync_error.png" alt="" />
style="height: 24rpx; width: 24rpx"
src="static/images/sync_error.png"
alt=""
/>
<text class="status">连接失败</text> <text class="status">连接失败</text>
</view> </view>
</view> </view>
@@ -45,21 +29,9 @@
<view @click="showMore" class="more_icon"> <view @click="showMore" class="more_icon">
<image src="@/static/images/common_circle_add.png"></image> <image src="@/static/images/common_circle_add.png"></image>
</view> </view>
<u-overlay <u-overlay :show="moreMenuVisible" @click="moreMenuVisible = false" opacity="0">
:show="moreMenuVisible" <view :style="{ top: popMenuPosition.top, right: popMenuPosition.right }" class="more_menu">
@click="moreMenuVisible = false" <view @click="clickMenu(item)" v-for="item in moreMenus" :key="item.idx" class="menu_item">
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> <image :src="item.icon" mode=""></image>
<text>{{ item.title }}</text> <text>{{ item.title }}</text>
</view> </view>
@@ -70,7 +42,9 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import {
mapGetters
} from "vuex";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill";
export default { export default {
@@ -87,8 +61,7 @@ export default {
top: 0, top: 0,
right: 0, right: 0,
}, },
moreMenus: [ moreMenus: [{
{
idx: 1, idx: 1,
title: "添加好友", title: "添加好友",
icon: require("static/images/more_add_friend.png"), icon: require("static/images/more_add_friend.png"),
@@ -140,9 +113,7 @@ export default {
case 1: case 1:
case 2: case 2:
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${ url: `/pages/common/searchUserOrGroup/index?isSearchGroup=${idx === 2}`,
idx === 2
}`,
}); });
break; break;
case 3: case 3:
@@ -226,6 +197,7 @@ export default {
background: #ffe1dd; background: #ffe1dd;
border-radius: 12rpx 12rpx 12rpx 12rpx; border-radius: 12rpx 12rpx 12rpx 12rpx;
margin-left: 8rpx; margin-left: 8rpx;
.status { .status {
font-size: 24rpx; font-size: 24rpx;
margin-left: 8rpx; margin-left: 8rpx;
@@ -1,34 +1,31 @@
<template> <template>
<view @tap.prevent="clickConversationItem" class="conversation_item"> <view @tap.prevent="clickConversationItem" :class="['conversation_item',source.isPinned?'pinned' : '']">
<view class="pinned" v-if="source.isPinned"></view>
<view class="left_info"> <view class="left_info">
<my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName" <my-avatar :isGroup="isGroup" :isNotify="isNotify" :src="source.faceURL" :desc="source.showName"
size="46" /> size="46" />
<view class="details"> <view class="details">
<text class="conversation_name">{{ source.showName }}</text> <view class="title">
<view class="lastest_msg_wrap"> <text class="conversation_name">
<text class="lastest_msg_content">{{ latestMessage }}</text> {{ source.showName }}
</view> </text>
</view>
</view>
<view class="right_desc"> <view class="right_desc">
<text class="send_time">{{ latestMessageTime }}</text> <text class="send_time">{{ latestMessageTime }}</text>
<u-badge max="99" :value="source.unreadCount"></u-badge> <u-badge max="99" :value="source.unreadCount"></u-badge>
</view> </view>
</view> </view>
<view class="lastest_msg_wrap">
<text class="lastest_msg_content">{{ latestMessage }}</text>
</view>
</view>
</view>
</view>
</template> </template>
<script> <script>
import { import {SessionType,} from "openim-uniapp-polyfill";
SessionType,
} from "openim-uniapp-polyfill";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import UParse from "@/components/gaoyia-parse/parse.vue"; import UParse from "@/components/gaoyia-parse/parse.vue";
import { import {getConversationContent,formatConversionTime,prepareConversationState,} from "@/util/imCommon";
getConversationContent,
formatConversionTime,
prepareConversationState,
} from "@/util/imCommon";
export default { export default {
components: { components: {
@@ -81,6 +78,9 @@
flex-direction: row; flex-direction: row;
padding: 12rpx 44rpx 20rpx; padding: 12rpx 44rpx 20rpx;
position: relative; position: relative;
&.pinned{
background-color: #ededed;
}
&_active { &_active {
background-color: #f3f3f3; background-color: #f3f3f3;
@@ -88,17 +88,41 @@
.left_info { .left_info {
@include btwBox(); @include btwBox();
flex:1;
.details { .details {
@include colBox(true); @include colBox(true);
flex:1;
margin-left: 24rpx; margin-left: 24rpx;
height: 46px; height: 46px;
color: $uni-text-color; color: $uni-text-color;
border-bottom: 1px solid #eee;
padding-bottom:20rpx;
.title{
@include btwBox();
.conversation_name { .conversation_name {
@include nomalEllipsis(); @include nomalEllipsis();
max-width: 40vw; max-width: 40vw;
font-size: 28rpx; font-size: 32rpx;
font-weight: 500;
}
.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 { .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> </style>
+11 -17
View File
@@ -53,7 +53,7 @@
<view class="action_bar"> <view class="action_bar">
<text>还没有账号<text class="register" @click="toRegisterOrForget(true)">立即注册</text></text> <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>
</view> </view>
</template> </template>
@@ -62,7 +62,6 @@
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import md5 from "md5"; import md5 from "md5";
import { version } from '@/common/config'
import { businessLogin, businessSendSms } from "@/api/login"; import { businessLogin, businessSendSms } from "@/api/login";
import AreaPicker from "@/components/AreaPicker"; import AreaPicker from "@/components/AreaPicker";
import { checkLoginError } from "@/util/common"; import { checkLoginError } from "@/util/common";
@@ -89,6 +88,7 @@
areaCode: "86", areaCode: "86",
verificationCode: "", verificationCode: "",
}, },
appversion:0,
eying: false, eying: false,
loading: false, loading: false,
count: 0, count: 0,
@@ -97,12 +97,7 @@
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters(["config"]),
"config",
]),
v() {
return this.config.name+' '+version
},
canLogin() { canLogin() {
return ( return (
(this.loginInfo.phoneNumber || this.loginInfo.email) && (this.loginInfo.phoneNumber || this.loginInfo.email) &&
@@ -111,16 +106,18 @@
}, },
}, },
onLoad(options) { onLoad(options) {
const _this = this;
plus.runtime.getProperty(plus.runtime.appid,(inf) => {
console.log(inf);
_this.appversion = inf.version
});
// if(options.isRedirect){ // if(options.isRedirect){
// plus.navigator.closeSplashscreen(); // plus.navigator.closeSplashscreen();
// } // }
this.version = version
this.init(); this.init();
}, },
methods: { methods: {
click({ click({index}) {
index
}) {
this.active = index; this.active = index;
}, },
copy() { copy() {
@@ -164,14 +161,11 @@
email: this.loginInfo.email, email: this.loginInfo.email,
areaCode: `+${this.loginInfo.areaCode}`, areaCode: `+${this.loginInfo.areaCode}`,
password: this.isPwdLogin ? md5(this.loginInfo.password) : "", password: this.isPwdLogin ? md5(this.loginInfo.password) : "",
platform: uni.$u.os() === "ios" ? 1 : 2, platform: uni.$u.os(),
type: this.active === 0 ? 'mobile' : 'email', type: this.active === 0 ? 'mobile' : 'email',
code: this.loginInfo.verificationCode, code: this.loginInfo.verificationCode,
}); });
const { const {imToken,userID} = data;
imToken,
userID
} = data;
await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), { await IMSDK.asyncApi(IMSDK.IMMethods.Login, uuidv4(), {
userID, userID,
token: imToken, token: imToken,
+1 -1
View File
@@ -106,7 +106,7 @@
areaCode: `+${this.userInfo.areaCode}`, areaCode: `+${this.userInfo.areaCode}`,
code: this.codeValue, code: this.codeValue,
password: this.formData.password, password: this.formData.password,
platform: uni.$u.os() === "ios" ? 1 : 2, platform: uni.$u.os(),
operationID: Date.now() + "", operationID: Date.now() + "",
}; };
businessReset(options) businessReset(options)
+12 -15
View File
@@ -27,7 +27,7 @@
</u-form> </u-form>
<view class="btn"> <view class="btn">
<u-button :loading="loading" type="primary" @click="doNext"> <u-button :loading="loading" type="primary" @click="doNext">
进入OpenIM 进入{{config.name}}
</u-button> </u-button>
</view> </view>
</view> </view>
@@ -36,12 +36,9 @@
<script> <script>
import md5 from "md5"; import md5 from "md5";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import { import { mapGetters } from "vuex";
businessRegister import { businessRegister } from "@/api/login";
} from "@/api/login"; import { checkLoginError } from "@/util/common";
import {
checkLoginError
} from "@/util/common";
export default { export default {
components: { components: {
MyAvatar, MyAvatar,
@@ -100,19 +97,19 @@
}, },
}; };
}, },
computed:{
...mapGetters(["config"]),
},
onLoad(options) { onLoad(options) {
const { const {userInfo,codeValue} = options;
userInfo,
codeValue
} = options;
this.userInfo = { this.userInfo = {
...this.userInfo, ...this.userInfo,
...JSON.parse(userInfo), ...JSON.parse(userInfo),
}; };
this.codeValue = codeValue; this.codeValue = codeValue;
if(process.env.NODE_ENV == 'development'){ if(process.env.NODE_ENV == 'development'){
this.userInfo.email = "commiu@outlook.com"; //this.userInfo.email = "commiu@outlook.com";
this.userInfo.nickname = "commiu"; this.userInfo.nickname = "";
this.userInfo.password = "qwe123"; this.userInfo.password = "qwe123";
this.userInfo.confirmPassword = "qwe123"; this.userInfo.confirmPassword = "qwe123";
} }
@@ -135,12 +132,12 @@
this.loading = true; this.loading = true;
const options = { const options = {
code: this.codeValue, code: this.codeValue,
platform: uni.$u.os() === "ios" ? 1 : 2, platform: uni.$u.os(),
autoLogin: true, autoLogin: true,
...this.userInfo, ...this.userInfo,
areaCode: `+${this.userInfo.areaCode}`, areaCode: `+${this.userInfo.areaCode}`,
password: md5(this.userInfo.password), password: md5(this.userInfo.password),
mobile: `+${this.userInfo.phoneNumber}`, mobile: this.userInfo.phoneNumber
}; };
try { try {
await businessRegister(options); await businessRegister(options);
+64 -39
View File
@@ -3,22 +3,20 @@
<custom-nav-bar title="关于我们" /> <custom-nav-bar title="关于我们" />
<view class="logo_area"> <view class="logo_area">
<image src="@/static/images/about_logo.png" mode=""></image> <image src="@/static/images/about_logo.png" mode=""></image>
<view>{{ v }}</view> <view>{{ appversion }}</view>
<info-item <info-item @click="checkUpdate" class="check" title="检测更新" content="" />
@click="show = true" <info-item @click="openurl('http://baidu.com')" class="check" title="官方网站" content="" />
class="check" <info-item @click="goto('/pages/common/article?type=article&name=coom&title=商务合作')" class="check" title="商务合作" content="" />
title="上传调试日志" <info-item @click="goto('/pages/common/article?type=article&name=contract&title=用户协议')" class="check" title="用户协议" content="" />
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="" />
<u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false"> <u-modal showCancelButton :show="show" title="上传日志" @confirm="uploadLog" @cancel="show = false">
<view class="slot-content"> <view class="slot-content">
<u--input <u--input placeholder="日志数量" border="surround" v-model="line"></u--input>
placeholder="日志数量"
border="surround"
v-model="line"
></u--input>
</view> </view>
</u-modal> </u-modal>
</view> </view>
@@ -31,6 +29,7 @@ import { version } from '@/common/config'
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import {PageEvents } from "@/constant"; import {PageEvents } from "@/constant";
import InfoItem from "../selfInfo/InfoItem.vue"; import InfoItem from "../selfInfo/InfoItem.vue";
import {checkUpgrade} from "@/api/login.js"
export default { export default {
components: { components: {
CustomNavBar, CustomNavBar,
@@ -40,21 +39,12 @@ export default {
return { return {
show: false, show: false,
line: 10000, line: 10000,
version: "", appversion: "",
loading: false, loading: false,
}; };
}, },
computed: {
v(){
return version
}
},
onLoad() { onLoad() {
this.getAppVersion(); this.getAppVersion();
uni.$on(PageEvents.CheckForUpdateResp, this.checkRespHandler);
},
onUnload() {
uni.$off(PageEvents.CheckForUpdateResp, this.checkRespHandler);
}, },
mounted() { mounted() {
IMSDK.subscribe('uploadLogsProgress', this.uploadHandler); IMSDK.subscribe('uploadLogsProgress', this.uploadHandler);
@@ -65,22 +55,16 @@ export default {
methods: { methods: {
uploadLog() { uploadLog() {
this.show = false this.show = false
IMSDK.asyncApi( IMSDK.asyncApi('uploadLogs',IMSDK.uuid(), {
'uploadLogs',
IMSDK.uuid(),
{
line: this.line, line: this.line,
ex: "" ex: ""
} })
)
uni.showLoading({ uni.showLoading({
title: '上传中', title: '上传中',
mask: true, mask: true,
}); });
}, },
uploadHandler({ uploadHandler({data: {current,size},}) {
data: { current, size },
}) {
console.log('uploadHandler', current, size) console.log('uploadHandler', current, size)
if (current >= size) { if (current >= size) {
uni.hideLoading(); uni.hideLoading();
@@ -92,18 +76,59 @@ export default {
} }
}, },
getAppVersion() { getAppVersion() {
plus.runtime.getProperty( let system = uni.getSystemInfoSync();
plus.runtime.appid, const _this = this;
({ version }) => (this.appVersion = version), plus.runtime.getProperty(plus.runtime.appid,(inf) => {
); console.log(inf);
}, _this.appversion = inf.version
updateCheck() { });
this.loading = true;
uni.$emit(PageEvents.CheckForUpdate, true);
}, },
checkRespHandler() { checkRespHandler() {
this.loading = false; 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> </script>
+8 -5
View File
@@ -86,17 +86,20 @@
}); });
}, },
logoutConfirm() { logoutConfirm() {
IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()) console.log(1)
.then(() => { IMSDK.asyncApi(IMSDK.IMMethods.Logout, IMSDK.uuid()).then(() => {
console.log(2)
uni.removeStorage({ uni.removeStorage({
key: "IMToken", key: "IMToken",
}); });
uni.removeStorage({ uni.removeStorage({
key: "BusinessToken", key: "BusinessToken",
}); });
}) }).catch((err) => {
.catch((err) => console.log(err)) console.log(3)
.finally(() => { console.log(err)
}).finally(() => {
console.log(4)
uni.$u.route("/pages/login/index"); uni.$u.route("/pages/login/index");
}); });
}, },
+3 -6
View File
@@ -7,12 +7,7 @@
<slot name="value"> <slot name="value">
<text class="content">{{ content }}</text> <text class="content">{{ content }}</text>
</slot> </slot>
<u-icon <u-icon v-if="showArrow" name="arrow-right" size="16" color="#999"></u-icon>
v-if="showArrow"
name="arrow-right"
size="16"
color="#999"
></u-icon>
</view> </view>
<u-loading-icon v-show="loading" class="loading_icon"></u-loading-icon> <u-loading-icon v-show="loading" class="loading_icon"></u-loading-icon>
</view> </view>
@@ -55,10 +50,12 @@ export default {
.right_value { .right_value {
@include vCenterBox(); @include vCenterBox();
.content { .content {
font-size: 28rpx; font-size: 28rpx;
color: #999; color: #999;
} }
.u-icon { .u-icon {
margin-left: 12rpx; margin-left: 12rpx;
} }
+34 -70
View File
@@ -3,70 +3,37 @@
<custom-nav-bar title="个人资料" /> <custom-nav-bar title="个人资料" />
<view class="info_wrap"> <view class="info_wrap">
<info-item <info-item :loading="loadingState.faceURL" @click="updateAvatar" title="头像">
:loading="loadingState.faceURL" <my-avatar :src="selfInfo.faceURL" :desc="selfInfo.nickname" size="30" slot="value" />
@click="updateAvatar"
title="头像"
>
<my-avatar
:src="selfInfo.faceURL"
:desc="selfInfo.nickname"
size="30"
slot="value"
/>
</info-item> </info-item>
<info-item <info-item @click="updateNickname" title="姓名" :content="selfInfo.nickname" />
@click="updateNickname" <info-item :loading="loadingState.gender" @click="updateGender" title="性别" :content="getGender" />
title="姓名" <info-item :loading="loadingState.birth" @click="() => (showDatePicker = true)" title="生日"
:content="selfInfo.nickname" :content="getBirth" />
/>
<info-item
:loading="loadingState.gender"
@click="updateGender"
title="性别"
:content="getGender"
/>
<info-item
:loading="loadingState.birth"
@click="() => (showDatePicker = true)"
title="生日"
:content="getBirth"
/>
</view> </view>
<view class="info_wrap"> <view class="info_wrap">
<info-item <info-item :showArrow="false" title="手机号码" :content="selfInfo.mobile || '-'" />
:showArrow="false" <info-item :showArrow="false" title="邮箱" :content="selfInfo.email || '-'" />
title="手机号码"
:content="selfInfo.phoneNumber || '-'"
/>
<info-item
:showArrow="false"
title="邮箱"
:content="selfInfo.email || '-'"
/>
</view> </view>
<u-datetime-picker <u-datetime-picker :minDate="0" :maxDate="nowDate" :show="showDatePicker" @confirm="confirmDate"
:minDate="0" @cancel="() => (showDatePicker = false)" v-model="selfInfo.birth" mode="date" />
:maxDate="nowDate"
:show="showDatePicker"
@confirm="confirmDate"
@cancel="() => (showDatePicker = false)"
v-model="selfInfo.birth"
mode="date"
/>
</view> </view>
</template> </template>
<script> <script>
import { businessInfoUpdate } from "@/api/login"; import {
businessInfoUpdate
} from "@/api/login";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill";
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import InfoItem from "./InfoItem.vue"; import InfoItem from "./InfoItem.vue";
import { getPurePath } from "@/util/common"; import {
getPurePath
} from "@/util/common";
export default { export default {
components: { components: {
CustomNavBar, CustomNavBar,
@@ -89,16 +56,17 @@ export default {
return this.$store.getters.storeSelfInfo; return this.$store.getters.storeSelfInfo;
}, },
getGender() { getGender() {
if (this.selfInfo.gender === 0) { if (this.selfInfo.sex === 0) {
return "保密"; return "保密";
} }
if (this.selfInfo.gender === 1) { if (this.selfInfo.sex === 1) {
return "男"; return "男";
} }
return "女"; return "女";
}, },
getBirth() { getBirth() {
const birth = this.selfInfo.birth ?? 0; console.log(this.selfInfo);
const birth = this.selfInfo.birthday ?? 0;
return dayjs(birth).format("YYYY-MM-DD"); return dayjs(birth).format("YYYY-MM-DD");
}, },
}, },
@@ -112,15 +80,12 @@ export default {
}, },
updateGender() { updateGender() {
uni.showActionSheet({ uni.showActionSheet({
itemList: ["男", "女"], itemList: ['保密',"男", "女"],
success: async ({ tapIndex }) => { success: async ({
tapIndex
}) => {
this.loadingState.gender = true; this.loadingState.gender = true;
await this.updateSelfInfo( await this.updateSelfInfo({gender: tapIndex,},"gender",);
{
gender: tapIndex + 1,
},
"gender",
);
}, },
}); });
}, },
@@ -128,7 +93,9 @@ export default {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sizeType: ["compressed"], sizeType: ["compressed"],
success: async ({ tempFilePaths }) => { success: async ({
tempFilePaths
}) => {
const path = tempFilePaths[0]; const path = tempFilePaths[0];
const nameIdx = path.lastIndexOf("/") + 1; const nameIdx = path.lastIndexOf("/") + 1;
const typeIdx = path.lastIndexOf(".") + 1; const typeIdx = path.lastIndexOf(".") + 1;
@@ -136,7 +103,9 @@ export default {
const fileType = path.slice(typeIdx); const fileType = path.slice(typeIdx);
this.loadingState.faceURL = true; this.loadingState.faceURL = true;
const { const {
data: { url }, data: {
url
},
} = await IMSDK.asyncApi(IMSDK.IMMethods.UploadFile, IMSDK.uuid(), { } = await IMSDK.asyncApi(IMSDK.IMMethods.UploadFile, IMSDK.uuid(), {
filepath: getPurePath(tempFilePaths[0]), filepath: getPurePath(tempFilePaths[0]),
name: fileName, name: fileName,
@@ -144,8 +113,7 @@ export default {
uuid: IMSDK.uuid(), uuid: IMSDK.uuid(),
}); });
console.log(url); console.log(url);
this.updateSelfInfo( this.updateSelfInfo({
{
faceURL: url, faceURL: url,
}, },
"faceURL", "faceURL",
@@ -172,6 +140,7 @@ export default {
}, },
async updateSelfInfo(data, key) { async updateSelfInfo(data, key) {
try { try {
console.log(data);
await businessInfoUpdate({ await businessInfoUpdate({
userID: this.selfInfo.userID, userID: this.selfInfo.userID,
...data, ...data,
@@ -186,12 +155,7 @@ export default {
}, },
confirmDate({value}) { confirmDate({value}) {
this.loadingState.birth = true; this.loadingState.birth = true;
this.updateSelfInfo( this.updateSelfInfo({birth: value,},"birth",);
{
birth: value,
},
"birth",
);
this.showDatePicker = false; this.showDatePicker = false;
}, },
}, },
@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
+256 -17
View File
@@ -1,31 +1,270 @@
<template> <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> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
linkUrl: "", 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() { onShow: function() {
this.linkUrl = 'https://doc.rentsoft.cn/' this.changeDefaultAvatar(1,10);
let unreadCount= 1;//this.vuex_friendCircleUnreadCount+"";
this.localGroupApi.setTabBarBadge(2,unreadCount);
}, },
onReady() { methods: {
// #ifdef APP-PLUS changeDefaultAvatar:function(min,max){
setTimeout(() => { let that=this;
this.$scope that.$u.api.friendCircle.checkFriendCircleUpdate().then(res => {
.$getAppWebview() if(res.code==200){
.children()[0] console.log("查询朋友圈更新情况",res.data);
.setStyle({ if(res.data&&res.data.length>0){
top: uni.getWindowInfo().statusBarHeight, that.newCircleInfo=res.data[0];
height: uni.getWindowInfo().safeArea.height, }else{
}); that.newCircleInfo=null;
}); }
// #endif }
})
}, },
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> </script>
<style lang="scss"></style> <style lang="scss" scoped>
.content {}
</style>
<style>
page {
background-color: #f4f4f5 !important;
}
</style>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

+8 -25
View File
@@ -1,6 +1,4 @@
import { import {v4 as uuidv4} from "uuid";
v4 as uuidv4
} from "uuid";
import IMSDK from "openim-uniapp-polyfill"; import IMSDK from "openim-uniapp-polyfill";
const state = { const state = {
@@ -46,14 +44,9 @@ const mutations = {
}; };
const actions = { const actions = {
async getConversationList({ async getConversationList({state,commit}, isFirstPage = true) {
state,
commit
}, isFirstPage = true) {
try { try {
const { const {data} = await IMSDK.asyncApi(
data
} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetConversationListSplit, IMSDK.IMMethods.GetConversationListSplit,
uuidv4(), { uuidv4(), {
offset: isFirstPage ? 0 : state.conversationList.length, offset: isFirstPage ? 0 : state.conversationList.length,
@@ -71,9 +64,7 @@ const actions = {
return []; return [];
} }
}, },
getCurrentGroup({ getCurrentGroup({commit}, groupID) {
commit
}, groupID) {
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [ IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupsInfo, uuidv4(), [
groupID, groupID,
]).then(({ ]).then(({
@@ -82,10 +73,7 @@ const actions = {
commit("SET_CURRENT_GROUP", data[0] ?? {}); commit("SET_CURRENT_GROUP", data[0] ?? {});
}); });
}, },
getCurrentMemberInGroup({ getCurrentMemberInGroup({commit,rootState}, groupID) {
commit,
rootState
}, groupID) {
IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), { IMSDK.asyncApi(IMSDK.IMMethods.GetSpecifiedGroupMembersInfo, uuidv4(), {
groupID, groupID,
userIDList: [rootState.user.selfInfo.userID], userIDList: [rootState.user.selfInfo.userID],
@@ -95,20 +83,15 @@ const actions = {
commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {}); commit("SET_CURRENT_MEMBER_IN_GROUP", data[0] ?? {});
}); });
}, },
getUnReadCount({ getUnReadCount({commit}) {
commit
}) {
IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then( IMSDK.asyncApi(IMSDK.IMMethods.GetTotalUnreadMsgCount, uuidv4()).then(
(res) => { (res) => {
console.log(res); //console.log(res);
commit("SET_UNREAD_COUNT", res.data); commit("SET_UNREAD_COUNT", res.data);
}, },
); );
}, },
updateCurrentMemberInGroup({ updateCurrentMemberInGroup({commit,state}, memberInfo) {
commit,
state
}, memberInfo) {
console.log(memberInfo); console.log(memberInfo);
if ( if (
memberInfo.groupID === state.currentMemberInGroup.groupID && memberInfo.groupID === state.currentMemberInGroup.groupID &&
+3 -9
View File
@@ -48,19 +48,13 @@ const actions = {
commit commit
}) { }) {
try { try {
const { const result = await IMSDK.asyncApi(IMSDK.IMMethods.GetSelfUserInfo,uuidv4(),);
data const res = await businessGetUserInfo(result.data.userID);
} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetSelfUserInfo,
uuidv4(),
);
const res = await businessGetUserInfo(data.userID);
//console.log(res.data);
const businessData = res.data[0] ?? {}; const businessData = res.data[0] ?? {};
filterEmptyValue(businessData); filterEmptyValue(businessData);
commit("SET_SELF_INFO", { commit("SET_SELF_INFO", {
...data, ...result.data,
...businessData, ...businessData,
}); });
} catch (e) { } catch (e) {
+17 -18
View File
@@ -11,7 +11,9 @@ import IMSDK, {
SessionType, SessionType,
} from "openim-uniapp-polyfill"; } from "openim-uniapp-polyfill";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { isThisYear } from "date-fns"; import {
isThisYear
} from "date-fns";
import calendar from "dayjs/plugin/calendar"; import calendar from "dayjs/plugin/calendar";
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from "dayjs/plugin/relativeTime";
@@ -60,13 +62,13 @@ export const conversationSort = (conversationList) => {
filterArr.sort((a, b) => { filterArr.sort((a, b) => {
if (a.isPinned === b.isPinned) { if (a.isPinned === b.isPinned) {
const aCompare = const aCompare =
a.draftTextTime > a.latestMsgSendTime a.draftTextTime > a.latestMsgSendTime ?
? a.draftTextTime a.draftTextTime :
: a.latestMsgSendTime; a.latestMsgSendTime;
const bCompare = const bCompare =
b.draftTextTime > b.latestMsgSendTime b.draftTextTime > b.latestMsgSendTime ?
? b.draftTextTime b.draftTextTime :
: b.latestMsgSendTime; b.latestMsgSendTime;
if (aCompare > bCompare) { if (aCompare > bCompare) {
return -1; return -1;
} else if (aCompare < bCompare) { } else if (aCompare < bCompare) {
@@ -118,9 +120,9 @@ export const sec2Time = (seconds) => {
export const parseMessageByType = (pmsg) => { export const parseMessageByType = (pmsg) => {
const getName = (user) => { const getName = (user) => {
return user.userID === store.getters.storeCurrentUserID return user.userID === store.getters.storeCurrentUserID ?
? "你" "你" :
: user.nickname; user.nickname;
}; };
switch (pmsg.contentType) { switch (pmsg.contentType) {
@@ -319,17 +321,14 @@ export const prepareConversationState = (conversation, back2Tab = false) => {
}, 300) }, 300)
}; };
export const navigateToDesignatedConversation = ( export const navigateToDesignatedConversation = (sourceID,sessionType,back2Tab = false,) => {
sourceID,
sessionType,
back2Tab = false,
) => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const { data } = await IMSDK.asyncApi( const {
data
} = await IMSDK.asyncApi(
IMSDK.IMMethods.GetOneConversation, IMSDK.IMMethods.GetOneConversation,
IMSDK.uuid(), IMSDK.uuid(), {
{
sessionType, sessionType,
sourceID, sourceID,
}, },