Compare commits
93 Commits
1.0.11
...
da6b60131d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da6b60131d | ||
|
|
ae0fa1bde3 | ||
|
|
8b888e250f | ||
| 4888cf2ad1 | |||
| 0eb6be37be | |||
| 831776f7dd | |||
| 519caab9e5 | |||
| aead0f5ed1 | |||
| fb6f5697c7 | |||
| 4760adc504 | |||
| b8291a4222 | |||
|
|
33eacb2a5b | ||
|
|
5c5445d630 | ||
| 056224881e | |||
|
|
f77a91eafe | ||
|
|
54cf21f211 | ||
|
|
da78a3ac11 | ||
| 7c4874a5e1 | |||
| 6f508d906d | |||
| 08ffc0fa53 | |||
| e72d6b3a91 | |||
| 8b7a259c00 | |||
| 4a31ba32f7 | |||
| 32e3e0ef30 | |||
| a7dccde63a | |||
| 9c7a8c8ee1 | |||
| 18173995ab | |||
| 07f707f94a | |||
| d1f5f75355 | |||
| 2d97294c9d | |||
| 78d4611fb2 | |||
| 358372cdba | |||
| ef785ab05f | |||
| 8f3c741ad1 | |||
| f4e44de777 | |||
| 853c4611ef | |||
| 1d648f2dc1 | |||
| d9748d0827 | |||
| 103679c372 | |||
|
|
8c32758e37 | ||
|
|
29757fadeb | ||
| 8a8e55600f | |||
| 768edb8e87 | |||
| 2ce4bb827f | |||
| f68e5fa1fd | |||
| 8bb646a520 | |||
| 20317cc1df | |||
| a5bd5a898c | |||
|
|
00836ac209 | ||
| c840e9ee6b | |||
| 18f0ee457c | |||
| a12d8a2c40 | |||
| 1407d677de | |||
| 8b10fd95fe | |||
| 3b3dda18ca | |||
| c7ba7bd426 | |||
| db9f5f6bde | |||
| 2a61a263de | |||
| 31c60bb319 | |||
| 36f70e1b5e | |||
| 6e2414f160 | |||
| 17e443fdeb | |||
|
|
e21d0e928d | ||
| 5a52bdf2dd | |||
| 01627f6794 | |||
|
|
054a84dae7 | ||
|
|
cdcfc95f88 | ||
|
|
91144195cf | ||
|
|
d92fb30648 | ||
|
|
d1c1c6d5ba | ||
| ab35229331 | |||
|
|
b92fc0fc7e | ||
| 66092967cb | |||
| d812ac2862 | |||
| a396f75041 | |||
| f03c3a0989 | |||
| 914f3f9371 | |||
| 7220c3466d | |||
|
|
ca9f7e80ca | ||
|
|
ee3087b320 | ||
| d8b90f97d1 | |||
| fbe1add9cf | |||
| 883f32f54c | |||
| 1be73f5bbb | |||
|
|
ad40d0d4d1 | ||
|
|
936a66a8aa | ||
| da59b2c31d | |||
| 77ed9dd6f9 | |||
|
|
e99ef72050 | ||
|
|
57cba65206 | ||
| 31ff366457 | |||
| f4b06bbf01 | |||
| ce954c5dcc |
2
App.vue
2
App.vue
@@ -12,7 +12,7 @@
|
||||
// 获取系统版本号
|
||||
getVersions({
|
||||
platform: plus.os.name,
|
||||
version: plus.runtime.versionCode
|
||||
version: plus.runtime.version
|
||||
}).then(res => {
|
||||
if (res.update) {
|
||||
uni.showModal({
|
||||
|
||||
@@ -126,13 +126,13 @@ const getGroupUsers = (groupId, limit) => {
|
||||
url: 'im/groups/' + groupId + '/users?limit=' + limit
|
||||
})
|
||||
}
|
||||
|
||||
// 公告列表
|
||||
const getGroupAnnouncements = (groupId) => {
|
||||
return request({
|
||||
url: 'im/groups/' + groupId + '/announcements'
|
||||
})
|
||||
}
|
||||
|
||||
// 创建公告
|
||||
const createGroupAnnouncement = (groupId, content) => {
|
||||
return request({
|
||||
method: 'POST',
|
||||
@@ -142,13 +142,27 @@ const createGroupAnnouncement = (groupId, content) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 查看该公告详情
|
||||
const getGroupAnnouncement = (groupId, announcementId) => {
|
||||
return request({
|
||||
method: 'GET',
|
||||
url: 'im/groups/' + groupId + '/announcements/' + announcementId
|
||||
})
|
||||
}
|
||||
// 删除该公告
|
||||
const deleteGroupAnnouncement = (groupId, announcementId) => {
|
||||
return request({
|
||||
method: 'DELETE',
|
||||
url: 'im/groups/' + groupId + '/announcements/' + announcementId
|
||||
})
|
||||
}
|
||||
// 置顶群公告
|
||||
const topGroupAnnouncement = (groupId, announcementId) => {
|
||||
return request({
|
||||
method: 'POST',
|
||||
url: 'im/groups/' + groupId + '/announcements/' + announcementId + '/top',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建群聊
|
||||
@@ -227,12 +241,13 @@ const removeGroupUser = (groupId, userId) => {
|
||||
/**
|
||||
* 邀请群成员
|
||||
*/
|
||||
const inviteGroupUser = (groupId, userIds) => {
|
||||
const inviteGroupUser = (groupId, userIds, allowIds) => {
|
||||
return request({
|
||||
method: 'POST',
|
||||
url: 'im/groups/' + groupId + '/invite',
|
||||
data: {
|
||||
userIds
|
||||
userIds: userIds,
|
||||
allowIds: allowIds
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -267,19 +282,16 @@ const transferGroupOwner = (groupId, userId) => {
|
||||
})
|
||||
}
|
||||
|
||||
// //群成员待审核表 -- 废弃
|
||||
// const getGroupMakeSure = (groupId) => {
|
||||
// return request({
|
||||
// url:`im/groups/${groupId}/makesure`
|
||||
// })
|
||||
// }
|
||||
// // 群成员审核通过
|
||||
// const getGroupMakeSureAllow = (groupId, userId) => {
|
||||
// return request({
|
||||
// method: 'POST',
|
||||
// url: 'im/groups/' + groupId + '/owner/' + userId
|
||||
// })
|
||||
// }
|
||||
|
||||
// 通过审核验证群成员
|
||||
const groupMakeSure = (groupId, user) => {
|
||||
return request({
|
||||
url: `im/groups/${groupId}/makesure/${user}`,
|
||||
method: 'POST'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
export {
|
||||
getImToken,
|
||||
@@ -300,8 +312,10 @@ export {
|
||||
getGroupBase,
|
||||
getGroupUsers,
|
||||
getGroupAnnouncements,
|
||||
getGroupAnnouncement,
|
||||
createGroupAnnouncement,
|
||||
deleteGroupAnnouncement,
|
||||
topGroupAnnouncement,
|
||||
searchGroup,
|
||||
joinGroupPre,
|
||||
joinGroup,
|
||||
@@ -309,8 +323,8 @@ export {
|
||||
dismissGroup,
|
||||
inviteGroupUser,
|
||||
removeGroupUser,
|
||||
transferGroupOwner,
|
||||
setGroupAdmin,
|
||||
removeGroupAdmin,
|
||||
// transferGroupOwner, // -废弃待审核列表
|
||||
// getGroupMakeSure // -废弃待审核列表
|
||||
groupMakeSure, // 通过审核
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name" : "ZH-HEALTH",
|
||||
"appid" : "__UNI__C29473D",
|
||||
"description" : "ZH-HEALTH,您手上的健康管理专家",
|
||||
"versionName" : "1.0.10",
|
||||
"versionCode" : 110,
|
||||
"versionName" : "1.0.16",
|
||||
"versionCode" : 100,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
@@ -24,7 +24,9 @@
|
||||
"SQLite" : {},
|
||||
"VideoPlayer" : {},
|
||||
"Geolocation" : {},
|
||||
"Fingerprint" : {}
|
||||
"Fingerprint" : {},
|
||||
"Maps" : {},
|
||||
"Push" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
@@ -80,7 +82,9 @@
|
||||
}
|
||||
},
|
||||
"ad" : {},
|
||||
"push" : {},
|
||||
"push" : {
|
||||
"unipush" : {}
|
||||
},
|
||||
"geolocation" : {
|
||||
"amap" : {
|
||||
"__platform__" : [ "android" ],
|
||||
@@ -90,6 +94,12 @@
|
||||
"system" : {
|
||||
"__platform__" : [ "android" ]
|
||||
}
|
||||
},
|
||||
"maps" : {
|
||||
"amap" : {
|
||||
"appkey_ios" : "",
|
||||
"appkey_android" : "05b7f32ca9c897c8b63c505d92cd654b"
|
||||
}
|
||||
}
|
||||
},
|
||||
"icons" : {
|
||||
|
||||
383
package-lock.json
generated
383
package-lock.json
generated
@@ -9,8 +9,6 @@
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bitcore-lib": "^8.25.25",
|
||||
"bitcore-mnemonic": "^8.25.25",
|
||||
"moment": "^2.29.1",
|
||||
"uni-read-pages": "^1.0.5",
|
||||
"uni-simple-router": "^2.0.7",
|
||||
@@ -19,171 +17,6 @@
|
||||
},
|
||||
"devDependencies": {}
|
||||
},
|
||||
"node_modules/base-x": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
|
||||
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bech32": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
|
||||
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
|
||||
},
|
||||
"node_modules/bigi": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
|
||||
"integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU="
|
||||
},
|
||||
"node_modules/bip-schnorr": {
|
||||
"version": "0.6.4",
|
||||
"resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz",
|
||||
"integrity": "sha512-dNKw7Lea8B0wMIN4OjEmOk/Z5qUGqoPDY0P2QttLqGk1hmDPytLWW8PR5Pb6Vxy6CprcdEgfJpOjUu+ONQveyg==",
|
||||
"dependencies": {
|
||||
"bigi": "^1.4.2",
|
||||
"ecurve": "^1.0.6",
|
||||
"js-sha256": "^0.9.0",
|
||||
"randombytes": "^2.1.0",
|
||||
"safe-buffer": "^5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bitcore-lib": {
|
||||
"version": "8.25.25",
|
||||
"resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.25.tgz",
|
||||
"integrity": "sha512-H6qNCVl4M8/MglXhvc04mmeus1d6nrmqTJGQ+xezJLvL7hs7R3dyBPtOqSP3YSw0iq/GWspMd8f5OOlyXVipJQ==",
|
||||
"dependencies": {
|
||||
"bech32": "=2.0.0",
|
||||
"bip-schnorr": "=0.6.4",
|
||||
"bn.js": "=4.11.8",
|
||||
"bs58": "^4.0.1",
|
||||
"buffer-compare": "=1.1.1",
|
||||
"elliptic": "^6.5.3",
|
||||
"inherits": "=2.0.1",
|
||||
"lodash": "^4.17.20"
|
||||
}
|
||||
},
|
||||
"node_modules/bitcore-mnemonic": {
|
||||
"version": "8.25.25",
|
||||
"resolved": "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.25.tgz",
|
||||
"integrity": "sha512-7HvRxHrmd+Rh0Ohl0SEDMKQBAM+FoevXbCFnxGju6H+uZjtWMOToHA8vUg0+B91pfEMjdt9mQVB/wSA8GMqnCA==",
|
||||
"dependencies": {
|
||||
"bitcore-lib": "^8.25.25",
|
||||
"unorm": "^1.4.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bitcore-lib": "^8.20.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bn.js": {
|
||||
"version": "4.11.8",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
|
||||
"integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA=="
|
||||
},
|
||||
"node_modules/brorand": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
|
||||
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
|
||||
},
|
||||
"node_modules/bs58": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
|
||||
"integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=",
|
||||
"dependencies": {
|
||||
"base-x": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-compare": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz",
|
||||
"integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY="
|
||||
},
|
||||
"node_modules/ecurve": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz",
|
||||
"integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==",
|
||||
"dependencies": {
|
||||
"bigi": "^1.1.0",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/elliptic": {
|
||||
"version": "6.5.4",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
|
||||
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
|
||||
"dependencies": {
|
||||
"bn.js": "^4.11.9",
|
||||
"brorand": "^1.1.0",
|
||||
"hash.js": "^1.0.0",
|
||||
"hmac-drbg": "^1.0.1",
|
||||
"inherits": "^2.0.4",
|
||||
"minimalistic-assert": "^1.0.1",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/elliptic/node_modules/bn.js": {
|
||||
"version": "4.12.0",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
|
||||
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
|
||||
},
|
||||
"node_modules/elliptic/node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/hash.js": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
|
||||
"integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"minimalistic-assert": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/hash.js/node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/hmac-drbg": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
||||
"integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
|
||||
"dependencies": {
|
||||
"hash.js": "^1.0.3",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE="
|
||||
},
|
||||
"node_modules/js-sha256": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz",
|
||||
"integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA=="
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/minimalistic-assert": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
|
||||
"integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
|
||||
},
|
||||
"node_modules/minimalistic-crypto-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
|
||||
"integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
@@ -192,33 +25,6 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/uni-read-pages": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
|
||||
@@ -230,14 +36,6 @@
|
||||
"resolved": "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz",
|
||||
"integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA=="
|
||||
},
|
||||
"node_modules/unorm": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz",
|
||||
"integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uview-ui": {
|
||||
"version": "2.0.19",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
||||
@@ -256,187 +54,11 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"base-x": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
|
||||
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"bech32": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
|
||||
"integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg=="
|
||||
},
|
||||
"bigi": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.2.tgz",
|
||||
"integrity": "sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU="
|
||||
},
|
||||
"bip-schnorr": {
|
||||
"version": "0.6.4",
|
||||
"resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.6.4.tgz",
|
||||
"integrity": "sha512-dNKw7Lea8B0wMIN4OjEmOk/Z5qUGqoPDY0P2QttLqGk1hmDPytLWW8PR5Pb6Vxy6CprcdEgfJpOjUu+ONQveyg==",
|
||||
"requires": {
|
||||
"bigi": "^1.4.2",
|
||||
"ecurve": "^1.0.6",
|
||||
"js-sha256": "^0.9.0",
|
||||
"randombytes": "^2.1.0",
|
||||
"safe-buffer": "^5.2.1"
|
||||
}
|
||||
},
|
||||
"bitcore-lib": {
|
||||
"version": "8.25.25",
|
||||
"resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-8.25.25.tgz",
|
||||
"integrity": "sha512-H6qNCVl4M8/MglXhvc04mmeus1d6nrmqTJGQ+xezJLvL7hs7R3dyBPtOqSP3YSw0iq/GWspMd8f5OOlyXVipJQ==",
|
||||
"requires": {
|
||||
"bech32": "=2.0.0",
|
||||
"bip-schnorr": "=0.6.4",
|
||||
"bn.js": "=4.11.8",
|
||||
"bs58": "^4.0.1",
|
||||
"buffer-compare": "=1.1.1",
|
||||
"elliptic": "^6.5.3",
|
||||
"inherits": "=2.0.1",
|
||||
"lodash": "^4.17.20"
|
||||
}
|
||||
},
|
||||
"bitcore-mnemonic": {
|
||||
"version": "8.25.25",
|
||||
"resolved": "https://registry.npmjs.org/bitcore-mnemonic/-/bitcore-mnemonic-8.25.25.tgz",
|
||||
"integrity": "sha512-7HvRxHrmd+Rh0Ohl0SEDMKQBAM+FoevXbCFnxGju6H+uZjtWMOToHA8vUg0+B91pfEMjdt9mQVB/wSA8GMqnCA==",
|
||||
"requires": {
|
||||
"bitcore-lib": "^8.25.25",
|
||||
"unorm": "^1.4.1"
|
||||
}
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "4.11.8",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
|
||||
"integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA=="
|
||||
},
|
||||
"brorand": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz",
|
||||
"integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8="
|
||||
},
|
||||
"bs58": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
|
||||
"integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=",
|
||||
"requires": {
|
||||
"base-x": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"buffer-compare": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.1.1.tgz",
|
||||
"integrity": "sha1-W+e+hTr4kZjR9N3AkNHWakiu9ZY="
|
||||
},
|
||||
"ecurve": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz",
|
||||
"integrity": "sha512-/BzEjNfiSuB7jIWKcS/z8FK9jNjmEWvUV2YZ4RLSmcDtP7Lq0m6FvDuSnJpBlDpGRpfRQeTLGLBI8H+kEv0r+w==",
|
||||
"requires": {
|
||||
"bigi": "^1.1.0",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.5.4",
|
||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
|
||||
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
|
||||
"requires": {
|
||||
"bn.js": "^4.11.9",
|
||||
"brorand": "^1.1.0",
|
||||
"hash.js": "^1.0.0",
|
||||
"hmac-drbg": "^1.0.1",
|
||||
"inherits": "^2.0.4",
|
||||
"minimalistic-assert": "^1.0.1",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"bn.js": {
|
||||
"version": "4.12.0",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz",
|
||||
"integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA=="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"hash.js": {
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz",
|
||||
"integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"minimalistic-assert": "^1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"hmac-drbg": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
|
||||
"integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
|
||||
"requires": {
|
||||
"hash.js": "^1.0.3",
|
||||
"minimalistic-assert": "^1.0.0",
|
||||
"minimalistic-crypto-utils": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
|
||||
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE="
|
||||
},
|
||||
"js-sha256": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz",
|
||||
"integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA=="
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"minimalistic-assert": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz",
|
||||
"integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="
|
||||
},
|
||||
"minimalistic-crypto-utils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz",
|
||||
"integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo="
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
||||
},
|
||||
"randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
},
|
||||
"uni-read-pages": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
|
||||
@@ -447,11 +69,6 @@
|
||||
"resolved": "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz",
|
||||
"integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA=="
|
||||
},
|
||||
"unorm": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz",
|
||||
"integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA=="
|
||||
},
|
||||
"uview-ui": {
|
||||
"version": "2.0.19",
|
||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
||||
|
||||
@@ -7,10 +7,8 @@
|
||||
"moment": "^2.29.1",
|
||||
"uni-read-pages": "^1.0.5",
|
||||
"uni-simple-router": "^2.0.7",
|
||||
"uview-ui": "^2.0.19",
|
||||
"vuex": "^3.6.2"
|
||||
"uview-ui": "^2.0.27"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
|
||||
13
pages.json
13
pages.json
@@ -373,19 +373,6 @@
|
||||
{
|
||||
"path": "pages/im/private/chat",
|
||||
"style": {
|
||||
"navigationBarBackgroundColor":"#FFFFFF",
|
||||
"disableScroll": false,
|
||||
"app-plus": {
|
||||
"titleNView": {
|
||||
"type": "default",
|
||||
"buttons": [{
|
||||
"float": "right",
|
||||
"fontSrc": "/static/iconfont.ttf",
|
||||
"text": "\ue607",
|
||||
"fontSize": "20px"
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
BIN
pages/.DS_Store
vendored
BIN
pages/.DS_Store
vendored
Binary file not shown.
@@ -2,12 +2,14 @@
|
||||
<view class="message--cell">
|
||||
<view class="avatar">
|
||||
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
||||
<u-avatar :src="contact(item.targetId).portraitUrl" shape="square" size="44" />
|
||||
<u-avatar :src="contact(item.targetId).portraitUrl" shape="square" :size="avatarSize" />
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="header">
|
||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
|
||||
class='qun'>[群]</text></view>
|
||||
<view class="name">
|
||||
{{ contact(item.targetId).name }}
|
||||
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||
</view>
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
</view>
|
||||
<message-preview class="preview" :msg="item.latestMessage" :draft="item.draft"
|
||||
@@ -18,8 +20,13 @@
|
||||
|
||||
<script>
|
||||
import messagePreview from './messagePreview'
|
||||
import utils from '@/utils/index.js'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
@@ -28,16 +35,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.item);
|
||||
},
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
messagePreview
|
||||
}
|
||||
@@ -51,6 +48,7 @@
|
||||
|
||||
.avatar {
|
||||
position: relative;
|
||||
padding-top: 5rpx;
|
||||
|
||||
.u-badge {
|
||||
z-index: 998;
|
||||
@@ -62,10 +60,8 @@
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
|
||||
|
||||
border-bottom-width: 0.5px !important;
|
||||
border-color: #f9f9f9 !important;
|
||||
border-color: #eee !important;
|
||||
border-bottom-style: solid;
|
||||
|
||||
.header {
|
||||
@@ -75,10 +71,8 @@
|
||||
.name {
|
||||
font-size: $title-size + 2;
|
||||
color: #454545;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.qun {
|
||||
.group {
|
||||
color: $main-color;
|
||||
font-size: $title-size-m - 4;
|
||||
margin-left: 4px;
|
||||
@@ -22,15 +22,18 @@
|
||||
<view class="preview" v-if="msg.objectName=='RC:LBSMsg'">
|
||||
<text v-if="conversationType == 3">{{ user.name }}:</text>[位置]
|
||||
</view>
|
||||
<view class="preview" v-if="msg.objectName=='RC:AudioMsg'">
|
||||
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && JSON.parse(msg.message).mediaType==0">
|
||||
<text v-if="conversationType == 3">{{ user.name }}:</text>[语音通话]
|
||||
</view>
|
||||
<view class="preview" v-if="msg.objectName=='RC:VideoMsg'">
|
||||
<view class="preview" v-if="msg.objectName=='RC:InfoNtf' && JSON.parse(msg.message).mediaType==1">
|
||||
<text v-if="conversationType == 3">{{ user.name }}:</text>[视频通话]
|
||||
</view>
|
||||
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">
|
||||
[{{ msg.message }}]
|
||||
</view>
|
||||
<view class="preview" v-if="msg.objectName=='RC:RcNtf'">
|
||||
<text v-if="conversationType == 3">{{ user.name }}:</text> 撤回了一条消息
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
@@ -1,24 +1,24 @@
|
||||
<template>
|
||||
<view>
|
||||
<view v-for="(item, index) in conversations" :key="index" :class="['message', { 'is-top': item.isTop }]"
|
||||
:data-item="item" @longpress="onLongPress" @click="toDetail(item)">
|
||||
<message-cell :item="item" />
|
||||
</view>
|
||||
|
||||
<view class="shade" @click="hidePop" v-show="showPop">
|
||||
<view class="shade" @click="hidePop" @touchmove="hidePop" v-show="showPop">
|
||||
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
||||
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu" :data-index="index">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-for="(item, index) in conversations" :key="index"
|
||||
:class="['message', { 'is-top': item.isTop, 'is-active': pickedItem.targetId == item.targetId }]"
|
||||
:data-item="item" @longpress="onLongPress" @click="toDetail(item)">
|
||||
<message-cell :item="item" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import messageCell from './messageCell'
|
||||
import messageCell from './conversation/messageCell'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -132,6 +132,10 @@
|
||||
&.is-top {
|
||||
background: $window-color;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background: #F8FAFF;
|
||||
}
|
||||
}
|
||||
|
||||
/* 遮罩 */
|
||||
@@ -139,6 +143,7 @@
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
|
||||
.pop {
|
||||
position: fixed;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="apply--cell">
|
||||
<view class="avatar">
|
||||
<u-avatar :src="user.portraitUrl || require('@/static/user/cover.png')" shape="square" size="46" />
|
||||
<u-avatar :src="user.portraitUrl || require('@/static/user/cover.png')" shape="square" :size="avatarSize" />
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name"> {{ user.name }}</view>
|
||||
@@ -20,8 +20,12 @@
|
||||
resolveFriend,
|
||||
rejectFriend
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
@@ -36,7 +40,6 @@
|
||||
methods: {
|
||||
resolve() {
|
||||
resolveFriend(this.message.sourceUserId).then(res => {
|
||||
this.clearMessages()
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '通过好友申请'
|
||||
@@ -47,6 +50,8 @@
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
}).finally(() => {
|
||||
this.clearMessages()
|
||||
})
|
||||
},
|
||||
reject() {
|
||||
@@ -70,7 +75,9 @@
|
||||
clearMessages() {
|
||||
RongIMLib.deleteMessages(RongIMLib.ConversationType.SYSTEM, this.message.sourceUserId)
|
||||
this.$emit('success')
|
||||
uni.$emit('onContactNotification')
|
||||
uni.$emit('onNewContactConversation')
|
||||
uni.$emit('onNewContactFriends')
|
||||
uni.$emit('onNewContactPendings')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
||||
<view class="lists">
|
||||
<view class="" style="width: 100rpx;height: 100rpx;">
|
||||
<u-avatar :src="JSON.parse(item.latestMessage.extra).portraitUrl" shape="square" size="44" />
|
||||
<u-avatar :src="JSON.parse(item.latestMessage.extra).portraitUrl" shape="square" :size="avatarSize" />
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title">
|
||||
@@ -14,7 +14,8 @@
|
||||
<span v-if="isAgree" @click="action('agree', item)">通过</span>
|
||||
<span v-if="isAgree" @click="action('reject', item)">拒绝</span>
|
||||
<span v-if="isApply && !item.is_friend" @click="action('apply', item)">查看</span>
|
||||
<span class="isFri" v-if="isApply && item.is_friend" @click="action('isFriend', item)">已是好友</span>
|
||||
<span class="isFri" v-if="isApply && item.is_friend"
|
||||
@click="action('isFriend', item)">已是好友</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -23,7 +24,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins:[
|
||||
imBase
|
||||
],
|
||||
name: 'friend-apply-reject-agree',
|
||||
props: {
|
||||
lists: {
|
||||
@@ -50,16 +56,23 @@ export default {
|
||||
action(type, item) {
|
||||
if (type === 'isFriend') {
|
||||
// ,后期可以跳转到信息介绍页面,先留在这里
|
||||
return uni.showToast({ title: '已是好友,无需重复添加', icon: 'none', duration:2000});
|
||||
return uni.showToast({
|
||||
title: '已是好友,无需重复添加',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
this.$emit('action', { type, item });
|
||||
this.$emit('action', {
|
||||
type,
|
||||
item
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.lists {
|
||||
.lists {
|
||||
padding: 0 $padding;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -72,6 +85,7 @@ export default {
|
||||
.cover {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 570rpx;
|
||||
margin-left: $margin - 10;
|
||||
@@ -81,8 +95,10 @@ export default {
|
||||
justify-content: space-between;
|
||||
padding: $padding 0;
|
||||
border-bottom: solid 1rpx #f9f9f9;
|
||||
|
||||
.title {
|
||||
width: 370rpx;
|
||||
|
||||
.name {
|
||||
width: 100%;
|
||||
color: $text-color;
|
||||
@@ -91,6 +107,7 @@ export default {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.des {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
@@ -102,25 +119,29 @@ export default {
|
||||
color: $text-gray-m;
|
||||
}
|
||||
}
|
||||
|
||||
.agress-btn {
|
||||
display: flex;
|
||||
color: #fff;
|
||||
font-size: $title-size-m;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
padding: 6rpx 14rpx;
|
||||
background-color: $text-price;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
span:nth-child(1) {
|
||||
background-color: $main-color;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.isFri {
|
||||
background-color: #f9f9f9 !important;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
||||
<view class="lists">
|
||||
<view class="" style="width: 100rpx;height: 100rpx;">
|
||||
<u-avatar :src="item.portraitUrl || require('@/static/user/cover.png')" shape="square" size="44" />
|
||||
<u-avatar :src="item.portraitUrl || require('@/static/user/cover.png')" shape="square" :size="avatarSize" />
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="title">
|
||||
@@ -21,7 +21,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
name: 'friend-apply-reject-agree',
|
||||
props: {
|
||||
lists: {
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
<view :class="['user', {'active': item.targetId === currentUser.targetId}]" @longpress="showAction(item)"
|
||||
v-for="(item, index) in users" :key="index" @click="toUser(item)">
|
||||
<view class="avatar">
|
||||
<u-avatar :size="avatarSize" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||
<u-avatar :size="avatarSize" shape="square"
|
||||
:src="contact(item.targetId).portraitUrl || require('@/static/user/cover.png')" />
|
||||
<view class="admin" v-if="item.is_admin === 1">管理</view>
|
||||
<view class="owner" v-if="item.is_admin === 2">群主</view>
|
||||
</view>
|
||||
<view class="name">{{ item.name }}</view>
|
||||
</view>
|
||||
<view class="user" v-if="isAdmin">
|
||||
<u-avatar @click="inviteUser" :size="avatarSize" shape="square" icon="plus" bgColor="#f9f9f9" color="#c7c7c7" />
|
||||
<view class="user" v-if="canInvite">
|
||||
<u-avatar @click="inviteUser" :size="avatarSize" shape="square" icon="plus" bgColor="#f9f9f9"
|
||||
color="#c7c7c7" />
|
||||
<view class="name">邀请好友</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -36,8 +38,12 @@
|
||||
transferGroupOwner
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import utils from '@/utils/index.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
targetId: {
|
||||
type: String,
|
||||
@@ -53,26 +59,20 @@
|
||||
users: [],
|
||||
isOwner: false,
|
||||
isAdmin: false,
|
||||
canInvite: false, // 是否可以开启邀请
|
||||
adminUid: 0,
|
||||
members: 0,
|
||||
actionShow: false,
|
||||
actionMap: [],
|
||||
actionTitle: '',
|
||||
currentUser: {},
|
||||
avatarSize: 45,
|
||||
avatarSize: 40,
|
||||
labelSize: 14,
|
||||
iconSize: 14
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.avatarSize = utils.rpx2px(90)
|
||||
this.avatarSize = utils.rpx2px(84)
|
||||
this.labelSize = utils.rpx2px(24)
|
||||
this.iconSize = utils.rpx2px(26)
|
||||
},
|
||||
@@ -92,6 +92,7 @@
|
||||
this.isAdmin = res.is_admin
|
||||
this.adminUid = res.user_id
|
||||
this.members = res.members
|
||||
this.canInvite = res.can_invite
|
||||
})
|
||||
},
|
||||
initUsers() {
|
||||
@@ -104,6 +105,9 @@
|
||||
this.actionShow = false
|
||||
},
|
||||
showAction(item) {
|
||||
if (item.is_admin == 2) {
|
||||
return
|
||||
}
|
||||
this.currentUser = item
|
||||
this.actionTitle = item.name
|
||||
// 只有管理员以上才会弹窗
|
||||
@@ -271,8 +275,7 @@
|
||||
.avatar {
|
||||
border-radius: 0 8rpx 0 0;
|
||||
position: relative;
|
||||
width: 90rpx;
|
||||
height: 90rpx;
|
||||
width: 84rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.admin {
|
||||
|
||||
@@ -33,9 +33,12 @@
|
||||
|
||||
<script>
|
||||
import im from '@/utils/im/index.js'
|
||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
callActions: [{
|
||||
@@ -64,15 +67,11 @@
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sender() {
|
||||
return this.$store.getters.sender
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
singleCall(e) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type +
|
||||
'&isCall=true'
|
||||
})
|
||||
},
|
||||
onPopupsItem(type) {
|
||||
@@ -144,6 +143,7 @@
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
|
||||
.item {
|
||||
width: 150rpx;
|
||||
margin: 15rpx;
|
||||
@@ -1,16 +1,19 @@
|
||||
<template>
|
||||
<view class="sent--text">
|
||||
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState" v-model="inputTxt" confirm-type="send"
|
||||
@confirm="sent" cursor-spacing="10" />
|
||||
<!-- <button class="button" size="mini" :disabled="disabled" @click="demo">{{focusState ? '失焦': '聚焦'}}</button> -->
|
||||
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState"
|
||||
v-model="inputTxt" confirm-type="send" @confirm="sent" cursor-spacing="10" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import im from '@/utils/im/index.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
conversationType: {
|
||||
type: Number,
|
||||
@@ -19,21 +22,14 @@
|
||||
targetId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
inputTxt: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.inputTxt.length === 0
|
||||
},
|
||||
sender() {
|
||||
return this.$store.getters.sender
|
||||
}
|
||||
},
|
||||
created() {
|
||||
mounted() {
|
||||
RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({
|
||||
draft
|
||||
}) => {
|
||||
@@ -41,31 +37,25 @@
|
||||
})
|
||||
},
|
||||
beforeDestroy() {
|
||||
RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt, (res) => {
|
||||
console.log('销毁组件之前,保存草稿信息,但是没有执行', res);
|
||||
})
|
||||
// 保存草稿
|
||||
RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt)
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
focusState: false,
|
||||
inputTxt: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 发送文本消息
|
||||
sent() {
|
||||
if (!this.disabled) {
|
||||
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
||||
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
|
||||
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
||||
this.$emit('success')
|
||||
this.inputTxt = ''
|
||||
})
|
||||
}
|
||||
},
|
||||
demo(){
|
||||
console.log(this.focusState)
|
||||
|
||||
this.focusState = !this.focusState
|
||||
},
|
||||
focus() {
|
||||
this.$emit('focus')
|
||||
},
|
||||
@@ -82,11 +72,10 @@
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
|
||||
.input {
|
||||
background: #F3F6FB;
|
||||
height: 70rpx;
|
||||
width: 500rpx;
|
||||
width: 460rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 15rpx;
|
||||
padding: 0 20rpx;
|
||||
276
pages/im/components/sent/sentVoice.vue
Normal file
276
pages/im/components/sent/sentVoice.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<view class="send--voice">
|
||||
<view class="voice" hover-class="chat-hover" @touchstart="startRecord" @touchend="stopRecord" @touchmove="touchmove">
|
||||
<text class="button">按住说话</text>
|
||||
</view>
|
||||
<!-- 录音层 -->
|
||||
<view class="lay" v-if="showRecordTip">
|
||||
<view class="lay-header">
|
||||
<view class="modal">
|
||||
<image class="icon" src="@/static/icon/record-icon.png" mode="widthFix"></image>
|
||||
<text class="text">录音中 {{recordTime}} s</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="lay-toast">上滑取消</view>
|
||||
<view class="lay-footer">
|
||||
<image class="lay-footer-icon videoFlicker" src="@/static/icon/audio_green.png" mode="widthFix"></image>
|
||||
<view class="lay-footer-text">松开发送</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import im from '@/utils/im/index.js'
|
||||
import permision from '@/utils/permission.js'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
conversationType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
targetId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRecordTip: false,
|
||||
recordTime: 60,
|
||||
interval: 0,
|
||||
maxRecordTime: 60,
|
||||
recorderManager: null,
|
||||
mp3AudioSrc: null,
|
||||
isBetaPlay: false, // 暂时无用
|
||||
startOffsetTop: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sender() {
|
||||
return this.$store.getters.sender
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.recorderManager = uni.getRecorderManager()
|
||||
},
|
||||
methods: {
|
||||
// 检查安卓录制权限
|
||||
async getAndroidPermission() {
|
||||
return await permision.requestAndroidPermission('android.permission.RECORD_AUDIO')
|
||||
},
|
||||
// 录制语音消息
|
||||
startRecord(e) {
|
||||
this.getAndroidPermission().then(code => {
|
||||
switch (code) {
|
||||
case 1:
|
||||
this.showConfirm = true
|
||||
this.startOffsetTop = e.target.offsetTop
|
||||
this.showRecordTip = true
|
||||
this.recorderManager.start()
|
||||
this.interval = setInterval(() => {
|
||||
this.recordTime -= 1
|
||||
if (this.recordTime === 0) {
|
||||
this.stopRecord()
|
||||
}
|
||||
}, 1000)
|
||||
break;
|
||||
case 0:
|
||||
uni.showToast({
|
||||
title: '暂无麦克风权限,请前往应用设置开启麦克风',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
case -1:
|
||||
uni.showToast({
|
||||
title: '应用权限错误',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 结束录音
|
||||
stopRecord(e) {
|
||||
if (!this.showRecordTip) return
|
||||
// 延迟500毫秒结束录音
|
||||
setTimeout(()=> {
|
||||
this.recorderManager.stop()
|
||||
clearInterval(this.interval)
|
||||
// 监听录音结束
|
||||
this.recorderManager.onStop(res => {
|
||||
this.mp3AudioSrc = res.tempFilePath
|
||||
this.showRecordTip = false
|
||||
this.senVoice()
|
||||
})
|
||||
},500)
|
||||
},
|
||||
// 发送语音消息
|
||||
senVoice(){
|
||||
if(this.mp3AudioSrc === null) {
|
||||
uni.showToast({
|
||||
title: '发送失败, 暂无音频信息',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
im.sentVoice(this.conversationType, this.targetId, this.mp3AudioSrc, (this.maxRecordTime -
|
||||
this.recordTime), this.sender, () => {
|
||||
this.recordTime = this.maxRecordTime
|
||||
this.mp3AudioSrc = null
|
||||
setTimeout(() => {
|
||||
this.$emit('success')
|
||||
}, 500)
|
||||
})
|
||||
},
|
||||
// 移动按钮
|
||||
touchmove(e){
|
||||
if(this.startOffsetTop - e.changedTouches[0].pageY > 100){
|
||||
if(this.showRecordTip){
|
||||
this.showRecordTip = false
|
||||
clearInterval(this.interval)
|
||||
this.recorderManager.stop()
|
||||
this.recordTime = this.maxRecordTime
|
||||
this.mp3AudioSrc = null
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
// 试听语音
|
||||
startPlay() {
|
||||
let betaAudio = uni.createInnerAudioContext()
|
||||
betaAudio.src = this.mp3AudioSrc;
|
||||
// 在播放中
|
||||
if(this.isBetaPlay){
|
||||
betaAudio.stop()
|
||||
betaAudio.onStop(() => {
|
||||
this.isBetaPlay = false;
|
||||
betaAudio.destroy()
|
||||
})
|
||||
return
|
||||
}
|
||||
// 监听音频播放中
|
||||
betaAudio.play()
|
||||
betaAudio.onPlay(() => {
|
||||
this.isBetaPlay = true;
|
||||
})
|
||||
// 监听音频结束
|
||||
betaAudio.onEnded(() => {
|
||||
this.isBetaPlay = false;
|
||||
betaAudio.destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes playFlicker {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.videoFlicker {
|
||||
animation: playFlicker 1s infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.send--voice {
|
||||
.voice {
|
||||
display: flex;
|
||||
background: $window-color;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 500rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 15rpx;
|
||||
|
||||
.button {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.lay{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
z-index: 9;
|
||||
background: rgba($color: #000000, $alpha: .5);
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
box-sizing: border-box;
|
||||
.lay-header{
|
||||
height: calc(100vh - 140px);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.modal {
|
||||
display: flex;
|
||||
background: rgba(0, 0, 0, .6);
|
||||
position: fixed;
|
||||
height: 200rpx;
|
||||
width: 300rpx;
|
||||
border-radius: 10rpx;
|
||||
z-index: 99;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
.icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
.lay-toast{
|
||||
text-align: center;
|
||||
color: rgba($color: #fff, $alpha: .8);
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.lay-footer{
|
||||
background-color: white;
|
||||
height: 100px;
|
||||
border-radius: 50% 50% 0 0;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.lay-footer-icon{
|
||||
width: 58rpx;
|
||||
height: 58rpx;
|
||||
}
|
||||
.lay-footer-text{
|
||||
line-height: 40rpx;
|
||||
color: gray;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -16,9 +16,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sentText from '../components/sentText'
|
||||
import sentVoice from '../components/sentVoice'
|
||||
import sentPopups from '../components/sentPopups'
|
||||
import sentText from './sent/sentText'
|
||||
import sentVoice from './sent/sentVoice'
|
||||
import sentPopups from './sent/sentPopups'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
<template>
|
||||
<view class="send--voice">
|
||||
<view class="voice" hover-class="chat-hover" @touchstart="startRecord" @touchend="stopRecord">
|
||||
<text class="button">按住说话</text>
|
||||
</view>
|
||||
<!-- 录音中提示 -->
|
||||
<view class="modal" v-if="showRecordTip">
|
||||
<image class="icon" src="@/static/icon/record-icon.png" mode="widthFix"></image>
|
||||
<text class="text">录音中 {{recordTime}} s</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import im from '@/utils/im/index.js'
|
||||
import permision from '@/utils/permission.js'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
conversationType: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
targetId: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showRecordTip: false,
|
||||
recordTime: 60,
|
||||
interval: 0,
|
||||
maxRecordTime: 60,
|
||||
recorderManager: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
sender() {
|
||||
return this.$store.getters.sender
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.recorderManager = uni.getRecorderManager()
|
||||
},
|
||||
methods: {
|
||||
// 检查安卓录制权限
|
||||
async getAndroidPermission() {
|
||||
return await permision.requestAndroidPermission('android.permission.RECORD_AUDIO')
|
||||
},
|
||||
// 录制语音消息
|
||||
startRecord() {
|
||||
this.getAndroidPermission().then(code => {
|
||||
switch (code) {
|
||||
case 1:
|
||||
this.showRecordTip = true
|
||||
this.recorderManager.start()
|
||||
this.interval = setInterval(() => {
|
||||
this.recordTime -= 1
|
||||
if (this.recordTime === 0) {
|
||||
this.stopRecord()
|
||||
}
|
||||
}, 1000)
|
||||
break;
|
||||
case 0:
|
||||
uni.showToast({
|
||||
title: '暂无麦克风权限,请前往应用设置开启麦克风',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
case -1:
|
||||
uni.showToast({
|
||||
title: '应用权限错误',
|
||||
icon: 'none'
|
||||
})
|
||||
break;
|
||||
}
|
||||
})
|
||||
},
|
||||
// 结束录音
|
||||
stopRecord(e) {
|
||||
if (!this.showRecordTip) return
|
||||
this.recorderManager.stop()
|
||||
clearInterval(this.interval)
|
||||
// 监听录音结束
|
||||
this.recorderManager.onStop(res => {
|
||||
im.sentVoice(this.conversationType, this.targetId, res.tempFilePath, (this.maxRecordTime -
|
||||
this.recordTime), this.sender, () => {
|
||||
setTimeout(() => {
|
||||
this.$emit('success')
|
||||
}, 500)
|
||||
})
|
||||
this.recordTime = this.maxRecordTime
|
||||
this.showRecordTip = false
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.send--voice {
|
||||
.voice {
|
||||
background: $window-color;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 500rpx;
|
||||
border-radius: 10rpx;
|
||||
margin-right: 15rpx;
|
||||
|
||||
.button {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.modal {
|
||||
background: rgba(0, 0, 0, .6);
|
||||
position: fixed;
|
||||
height: 200rpx;
|
||||
width: 300rpx;
|
||||
border-radius: 10rpx;
|
||||
z-index: 99;
|
||||
top: 550rpx;
|
||||
left: 225rpx;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
.icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
81
pages/im/components/show/messageState.vue
Normal file
81
pages/im/components/show/messageState.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<view v-if="!isRemote">
|
||||
<view class="state" v-if="isGroup">
|
||||
<!-- 已发送 -->
|
||||
<u-icon name="checkbox-mark" :size="iconSize" class="sent"
|
||||
:color="message.sentStatus >= 30 ? '#34CE98' : '#999999' " />
|
||||
<!-- 已阅读 -->
|
||||
<text class="readers">{{ readers }}</text>
|
||||
</view>
|
||||
<view class="state" v-else>
|
||||
<!-- 已发送 -->
|
||||
<u-icon name="checkbox-mark" :size="iconSize" class="sent"
|
||||
:color="message.sentStatus >= 30 ? '#34CE98' : '#999999' " />
|
||||
<!-- 已阅读 -->
|
||||
<u-icon name="checkbox-mark" :size="iconSize" class="receive"
|
||||
:color="message.sentStatus >= 50 ? '#34CE98' : '#999999' " />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
name: 'showText',
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isRemote: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
iconSize() {
|
||||
return utils.rpx2px(28)
|
||||
},
|
||||
readers() {
|
||||
if (this.message.extra) {
|
||||
return JSON.parse(this.message.extra).readers || 0
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.state {
|
||||
padding: 10rpx;
|
||||
border-radius: 30rpx;
|
||||
background-color: #ddd;
|
||||
display: flex;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.sent {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.receive {
|
||||
z-index: 1;
|
||||
margin-left: -20rpx;
|
||||
}
|
||||
|
||||
.readers {
|
||||
font-size: 20rpx;
|
||||
margin-left: -6rpx;
|
||||
color: $text-gray-m;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
89
pages/im/components/show/showCall.vue
Normal file
89
pages/im/components/show/showCall.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<view class="msg--call">
|
||||
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||
<view class="im--text" :class="isRemote ? 'left': 'right'">
|
||||
<u-icon name="camera" size="22" v-if="msg.mediaType == 1" :label="label" />
|
||||
<u-icon name="phone" size="22" v-else :label="label" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import utils from '@/utils/index.js'
|
||||
import moment from 'moment'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
name: 'showText',
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
computed: {
|
||||
msg() {
|
||||
return JSON.parse(this.message.content.message)
|
||||
},
|
||||
label() {
|
||||
return this.msg.connected ? '通话时长:' + duration : '未接通'
|
||||
},
|
||||
isRemote() {
|
||||
return this.message.messageDirection == 2
|
||||
},
|
||||
duration() {
|
||||
if (this.message.duration > 3600) {
|
||||
return moment.utc(this.message.duration * 1000).format('HH:mm:ss')
|
||||
} else {
|
||||
return moment.utc(this.message.duration * 1000).format('mm:ss')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.msg--call {
|
||||
.name {
|
||||
font-size: 26rpx;
|
||||
color: $text-gray-m;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.im--text {
|
||||
max-width: 508rpx;
|
||||
padding: 20rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 32rpx;
|
||||
color: $text-color;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
background: white;
|
||||
}
|
||||
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background: $main-color;
|
||||
color: white;
|
||||
|
||||
.u-icon {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
105
pages/im/components/show/showImage.vue
Normal file
105
pages/im/components/show/showImage.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<view class="msg--image">
|
||||
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
||||
|
||||
<view class="">
|
||||
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||
<view class="image" :class="isRemote ? 'left': 'right'">
|
||||
<image class="img" :src="content.thumbnail" @click="previewImage" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import messageState from './messageState'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
name: 'showImage',
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
messageState
|
||||
},
|
||||
computed: {
|
||||
isRemote() {
|
||||
return this.message.messageDirection == 2
|
||||
},
|
||||
content() {
|
||||
return this.message.content
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showImage(path) {
|
||||
uni.previewImage({
|
||||
urls: [
|
||||
path
|
||||
]
|
||||
})
|
||||
},
|
||||
previewImage() {
|
||||
if (this.content.local && this.content.local.indexOf('///data/user/') < 0) {
|
||||
this.showImage(this.content.local)
|
||||
} else {
|
||||
this.showImage(this.content.remote)
|
||||
RongIMLib.downloadMediaMessage(this.message.messageId, {
|
||||
success: (path) => {
|
||||
this.content.local = path
|
||||
},
|
||||
error: (errorCode, messageId) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: errorCode
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.msg--image {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
color: $text-gray-m;
|
||||
}
|
||||
|
||||
.image {
|
||||
.img {
|
||||
width: 180rpx;
|
||||
}
|
||||
|
||||
&.left {
|
||||
.img {
|
||||
border-radius: 0 10rpx 10rpx 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.right {
|
||||
.img {
|
||||
border-radius: 10rpx 0 10rpx 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
78
pages/im/components/show/showText.vue
Normal file
78
pages/im/components/show/showText.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<view class="msg--text">
|
||||
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
||||
|
||||
<view class="">
|
||||
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||
<view :class="['text', isRemote ? 'left': 'right']">{{ content }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import messageState from './messageState'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
name: 'showText',
|
||||
mixins: [
|
||||
imBase,
|
||||
],
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
messageState
|
||||
},
|
||||
computed: {
|
||||
isRemote() {
|
||||
return this.message.messageDirection == 2
|
||||
},
|
||||
content() {
|
||||
return this.message.content.content
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.msg--text {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
color: $text-gray-m;
|
||||
}
|
||||
|
||||
.text {
|
||||
box-sizing: border-box;
|
||||
max-width: 502rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 32rpx;
|
||||
color: $text-color;
|
||||
word-break: break-all;
|
||||
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
background: white;
|
||||
}
|
||||
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background: $main-color;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
247
pages/im/components/show/showVoice.vue
Normal file
247
pages/im/components/show/showVoice.vue
Normal file
@@ -0,0 +1,247 @@
|
||||
<template>
|
||||
<view class="msg--voice">
|
||||
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
||||
|
||||
<view class="">
|
||||
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||
<view class="msg-voice">
|
||||
<view :class="['voice', isRemote ? 'left': 'right', {'onPlay': onPlay}]" :style="{width: width + 'rpx'}"
|
||||
@click="startPlay">
|
||||
<image v-if="isRemote" class="icon"
|
||||
:class="{ 'videoFlicker' : onPlay && msgId == message.messageId }"
|
||||
src="@/static/icon/audio_green.png" mode="widthFix"></image>
|
||||
<image v-else class="icon" :class="{ 'videoFlicker' : onPlay && msgId == message.messageId }"
|
||||
src="@/static/icon/audio_white.png" mode="widthFix"></image>
|
||||
<text class="duration">{{ duration }}"</text>
|
||||
</view>
|
||||
<u-badge isDot :show="message.content.local =='' && isRemote" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import messageState from './messageState'
|
||||
import imBase from '../../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
messageState
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
onPlay: false,
|
||||
innerAC: null,
|
||||
msgId: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return this.message.content.duration
|
||||
},
|
||||
isRemote() {
|
||||
return this.message.messageDirection == 2
|
||||
},
|
||||
width() {
|
||||
if (this.duration > 3) {
|
||||
return (this.duration * 5) + 150
|
||||
} else {
|
||||
return 120
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 这样能临时解决,但是会一直监听
|
||||
uni.$on('onVoiceMessagePlay', (messageId) => {
|
||||
if (this.message.messageId != messageId) {
|
||||
this.stopPlay()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 播放语音消息
|
||||
startPlay() {
|
||||
// 如果是正在播放的,停止当前播放
|
||||
if (this.onPlay) {
|
||||
this.stopPlay()
|
||||
return
|
||||
}
|
||||
this.onPlay = true
|
||||
// 如果下载到了本地,那么直接播放,否则调用下载语音消息接口,下载后再播放
|
||||
if (this.message.content.local && this.message.content.local.indexOf('///data/user/') < 0) {
|
||||
this.playVoice(this.message.content.local)
|
||||
} else {
|
||||
RongIMLib.downloadMediaMessage(this.message.messageId, {
|
||||
success: (path) => {
|
||||
this.message.content.local = path
|
||||
this.playVoice(path)
|
||||
},
|
||||
progress: (progress, messageId) => {},
|
||||
cancel: (messageId) => {},
|
||||
error: (errorCode, messageId) => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '语音播放失败'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
playVoice(path) {
|
||||
console.log('准备播放', this.message.content);
|
||||
this.innerAC = uni.createInnerAudioContext()
|
||||
this.innerAC.src = path
|
||||
this.innerAC.autoplay = false
|
||||
this.msgId = this.message.messageId
|
||||
this.innerAC.onCanplay(res => {
|
||||
console.log('onCanplay')
|
||||
this.innerAC.play()
|
||||
})
|
||||
this.innerAC.onPlay(res => {
|
||||
console.log('onPlay')
|
||||
uni.$emit('onVoiceMessagePlay', this.message.messageId)
|
||||
})
|
||||
this.innerAC.onEnded(res => {
|
||||
this.innerAC.stop()
|
||||
})
|
||||
this.innerAC.onStop(() => {
|
||||
this.onPlay = false
|
||||
this.innerAC.destroy()
|
||||
this.innerAC = null
|
||||
this.msgId = null
|
||||
uni.$emit('onVoiceMessageStop', this.message.messageId)
|
||||
})
|
||||
this.innerAC.onError(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '语音播放失败'
|
||||
})
|
||||
})
|
||||
},
|
||||
stopPlay() {
|
||||
if (this.innerAC) {
|
||||
this.innerAC.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@keyframes playFlicker {
|
||||
0% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.videoFlicker {
|
||||
animation: playFlicker 1s infinite;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.msg--voice {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.state {
|
||||
padding: 10rpx;
|
||||
border-radius: 30rpx;
|
||||
width: 40rpx;
|
||||
background-color: #ddd;
|
||||
display: flex;
|
||||
margin-right: 10rpx;
|
||||
|
||||
.sent {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.receive {
|
||||
z-index: 1;
|
||||
margin-left: -20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
color: $text-gray-m;
|
||||
}
|
||||
|
||||
.msg-voice {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.u-badge {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.voice {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 84rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
background: white;
|
||||
|
||||
&.onPlay {
|
||||
background-color: #EEEEEE;
|
||||
}
|
||||
|
||||
.duration {
|
||||
color: #333;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background: $main-color;
|
||||
flex-direction: row-reverse;
|
||||
|
||||
&.onPlay {
|
||||
background-color: darken($main-color, 10);
|
||||
}
|
||||
|
||||
.duration {
|
||||
color: white;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,74 +0,0 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<text class="name" v-if="!guest && name">{{ name }}</text>
|
||||
<view class="msg--image" :class="guest ? 'right': 'left'">
|
||||
<image class="img" :src="msg.thumbnail" @click="previewImage" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'showImage',
|
||||
props: {
|
||||
msg: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
local: '',
|
||||
remote: '',
|
||||
objectName: '',
|
||||
thumbnail: '',
|
||||
isFull: false
|
||||
}
|
||||
}
|
||||
},
|
||||
guest: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
previewImage() {
|
||||
uni.previewImage({
|
||||
urls: [
|
||||
this.msg.remote
|
||||
],
|
||||
current: 1
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: $text-gray-m;
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.msg--image {
|
||||
// padding: 20rpx;
|
||||
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
// background: white;
|
||||
}
|
||||
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
// background: #34CE98;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: 150rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
174
pages/im/components/showMessageCell.vue
Normal file
174
pages/im/components/showMessageCell.vue
Normal file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="notify" v-if="message.objectName === 'RC:GrpNtf'">
|
||||
{{ message.content.message }}
|
||||
<text class="link" @click="toAnnounce(message)" v-if="message.content.operation == 'ANNOUNCEMENT'">点击查看
|
||||
</text>
|
||||
</view>
|
||||
<view class="notify" v-else-if="message.objectName === 'RC:RcNtf'">
|
||||
{{ contact(message.senderUserId).name }} 撤回了一条消息
|
||||
</view>
|
||||
<view v-else :class="['cell-item', message.messageDirection == 1 ? 'right' : 'left']">
|
||||
<u-avatar class="avatar" @click="toUser(message)" :size="avatarSize" shape="square"
|
||||
:src="contact(message.senderUserId).portraitUrl" />
|
||||
<view class="msg" @longpress="backMessage">
|
||||
<show-text v-if="message.objectName === 'RC:TxtMsg'" :message="message" :isGroup="isGroup" />
|
||||
<show-voice v-else-if="message.objectName === 'RC:HQVCMsg'" :message="message" :isGroup="isGroup" />
|
||||
<show-image v-else-if="message.objectName === 'RC:ImgMsg'" :message="message" :isGroup="isGroup" />
|
||||
<show-call v-else-if="message.objectName === 'RC:InfoNtf'" :message="message" :isGroup="isGroup" />
|
||||
<view v-else class="">
|
||||
[未处理的消息类型 {{ message.objectName }}]
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="time">{{ item.sentTime|timeCustomCN }}</view> 时间判断,最好是隔一段时间没有消息才展示一个 -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getGroupAnnouncement
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import showVoice from './show/showVoice'
|
||||
import showImage from './show/showImage'
|
||||
import showText from './show/showText'
|
||||
import showCall from './show/showCall'
|
||||
import utils from '@/utils/index.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
components: {
|
||||
showCall,
|
||||
showVoice,
|
||||
showImage,
|
||||
showText
|
||||
},
|
||||
props: {
|
||||
message: {
|
||||
type: Object,
|
||||
default: function() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
isGroup: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toUser(item) {
|
||||
if (item.messageDirection == 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/mine?targetId=' + item.senderUserId
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/info?targetId=' + item.senderUserId
|
||||
})
|
||||
}
|
||||
},
|
||||
// 跳转群公告
|
||||
toAnnounce(message) {
|
||||
if (message.content.extra) {
|
||||
getGroupAnnouncement(message.targetId, message.content.extra).then(res => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/group/announceCreate?type=check&targetId=' + message
|
||||
.targetId + '&aId=' + message.content.extra
|
||||
})
|
||||
}).catch(err => {
|
||||
IMLib.deleteMessagesByIds([message.messageId], ({
|
||||
code
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
uni.$emit('remove_message_' + message.targetId, message.messageId)
|
||||
}
|
||||
})
|
||||
uni.showToast({
|
||||
title: '公告不存在或已删除',
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '旧版本,无链接'
|
||||
})
|
||||
}
|
||||
},
|
||||
// 撤回消息测试
|
||||
backMessage() {
|
||||
if (this.$store.getters.sender.userId != this.message.senderUserId) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '不能撤回别人的消息'
|
||||
})
|
||||
return
|
||||
}
|
||||
// 判断时间超过了多久 就不能撤回 TODO
|
||||
// this.message.sentTime
|
||||
const pushContent = this.$store.getters.sender.name + '撤回了一条消息'
|
||||
IMLib.recallMessage(this.message.messageId, pushContent,
|
||||
({
|
||||
code,
|
||||
message
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '消息撤回成功'
|
||||
})
|
||||
IMLib.getMessage(this.message.messageId, res => {
|
||||
uni.$emit('onRecallMessage_' + this.message.targetId, res.message)
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '撤回失败' + code
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.notify {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
.link {
|
||||
color: $main-color;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.cell-item {
|
||||
display: flex;
|
||||
width: 710rpx;
|
||||
justify-content: flex-start;
|
||||
|
||||
&.left {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
&.right {
|
||||
flex-direction: row-reverse;
|
||||
|
||||
.state {
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.msg {
|
||||
margin: 0 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,58 +0,0 @@
|
||||
<template>
|
||||
<view class="msg--text">
|
||||
<text class="name" v-if="!guest && name">{{ name }}</text>
|
||||
<view>
|
||||
<text class="im--text" :class="guest ? 'right': 'left'">{{ msg.content }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'showText',
|
||||
props: {
|
||||
msg: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
guest: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.msg--text {
|
||||
.name {
|
||||
font-size: 26rpx;
|
||||
color: $text-gray-m;
|
||||
display: inline-block;
|
||||
}
|
||||
.im--text {
|
||||
max-width: 508rpx;
|
||||
padding: 20rpx;
|
||||
line-height: 46rpx;
|
||||
font-size: 32rpx;
|
||||
color: $text-color;
|
||||
display: inline-block;
|
||||
word-break: break-all;
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
background: white;
|
||||
}
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background: $main-color;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,106 +0,0 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<text class="name" v-if="!guest && name">{{ name }}</text>
|
||||
<view class="msg--voice" :class="guest ? 'right': 'left'" @click="onPlayMsg">
|
||||
<image v-if="!guest" class="icon" src="@/static/icon/audio_green.png" mode="widthFix"></image>
|
||||
<text class="duration">{{msg.duration}}"</text>
|
||||
<image v-if="guest" class="icon" src="@/static/icon/audio_white.png" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'showVoice',
|
||||
props: {
|
||||
msg: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
local: '',
|
||||
remote: '',
|
||||
objectName: '',
|
||||
duration: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
guest: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 播放语音消息
|
||||
onPlayMsg() {
|
||||
uni.downloadFile({
|
||||
url: this.msg.remote,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
let innerAudioContext = uni.createInnerAudioContext()
|
||||
innerAudioContext.src = res.tempFilePath
|
||||
if (this.audioContextPaused) {
|
||||
innerAudioContext.play()
|
||||
this.audioContextPaused = false
|
||||
return
|
||||
}
|
||||
innerAudioContext.stop()
|
||||
innerAudioContext.onStop(resStop => {
|
||||
this.audioContextPaused = true
|
||||
})
|
||||
innerAudioContext.onError(err => {
|
||||
console.log(err);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.name {
|
||||
font-size: 24rpx;
|
||||
line-height: 34rpx;
|
||||
color: $text-gray-m;
|
||||
}
|
||||
|
||||
.msg--voice {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 79rpx;
|
||||
width: 170rpx;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
}
|
||||
|
||||
&.left {
|
||||
border-radius: 0 20rpx 20rpx 20rpx;
|
||||
background: white;
|
||||
|
||||
.duration {
|
||||
color: #333;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&.right {
|
||||
border-radius: 20rpx 0 20rpx 20rpx;
|
||||
background: $main-color;
|
||||
|
||||
.duration {
|
||||
color: white;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -2,32 +2,33 @@
|
||||
<view>
|
||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||
<view class="friend-flex" @click="toPending">
|
||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_01.png')"></u-avatar>
|
||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_01.png')" />
|
||||
<u-badge max="99" absolute :offset="[23, 20]" :value="pendingCount" />
|
||||
<view class="info">新的朋友</view>
|
||||
</view>
|
||||
<view class="friend-flex" @click="toGroup">
|
||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_00.png')"></u-avatar>
|
||||
<u-avatar class="cover" size="40" shape="square" :src="require('@/static/im/im_00.png')" />
|
||||
<view class="info">我的群聊</view>
|
||||
</view>
|
||||
<block v-if="friends.length > 0">
|
||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
||||
<u-index-anchor :text="indexs[fkey]" bgColor="#ededed" height="20" size="12" color="#666"
|
||||
style="padding:10rpx 30rpx" />
|
||||
<u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666"
|
||||
class="anchor" />
|
||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||
@click="toFriend(friendItem.targetId)">
|
||||
<u-avatar class="avatar-img" size="40" shape="square"
|
||||
:src="contact(friendItem.targetId).portraitUrl" />
|
||||
<view class="info">
|
||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
||||
<!-- <view class="address">地址:{{ friendItem.address }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</u-index-item>
|
||||
</block>
|
||||
<block v-else>
|
||||
<u-empty class="pages-null" mode="data" text="暂无好友" />
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src=" require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span>暂无好友列表~</span>
|
||||
</view>
|
||||
</u-index-list>
|
||||
</view>
|
||||
</template>
|
||||
@@ -37,8 +38,13 @@
|
||||
getFriendsLetter
|
||||
} from '@/apis/interfaces/im';
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
indexs: [],
|
||||
@@ -54,9 +60,14 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
uni.$on('onNewContactFriends', this.checkNewFriendPending)
|
||||
},
|
||||
onShow() {
|
||||
this.getFriendList()
|
||||
this.checkNewFriendPending()
|
||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("onNewContactFriends")
|
||||
},
|
||||
methods: {
|
||||
getFriendList() {
|
||||
@@ -72,10 +83,7 @@
|
||||
},
|
||||
toGroup() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/group/index',
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
}
|
||||
url: '/pages/im/group/index'
|
||||
})
|
||||
},
|
||||
toFriend(targetId) {
|
||||
@@ -85,24 +93,15 @@
|
||||
},
|
||||
// 新朋友
|
||||
toPending() {
|
||||
// if (this.pendingCount > 0) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/pending'
|
||||
});
|
||||
// } else {
|
||||
// uni.showToast({
|
||||
// title: ` 暂无好友申请 ~ `,
|
||||
// icon: "none",
|
||||
// mask: true,
|
||||
// duration: 3000
|
||||
// })
|
||||
// }
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/search'
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -113,6 +112,12 @@
|
||||
height: 70vh;
|
||||
}
|
||||
|
||||
.anchor {
|
||||
background-color: #f9f9f9 !important;
|
||||
padding: 10rpx 30rpx;
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
// 好友列表
|
||||
.friend-flex {
|
||||
position: relative;
|
||||
@@ -126,6 +131,8 @@
|
||||
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.info {
|
||||
flex: 1;
|
||||
margin-left: $padding;
|
||||
@@ -163,4 +170,19 @@
|
||||
line-height: 24px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 3;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
|
||||
span {
|
||||
padding-top: $padding;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<u-icon name="arrow-right" color="#eee" size="16" />
|
||||
</view>
|
||||
<view class="item u-border-bottom">
|
||||
<label>聊天免打扰</label>
|
||||
<label>消息免打扰</label>
|
||||
<u-switch size="22" v-model="status" activeColor="#34CE98" @change="setStatus"></u-switch>
|
||||
</view>
|
||||
<view class="item">
|
||||
@@ -113,7 +113,6 @@
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
getFriendInfo(e.targetId).then(res => {
|
||||
console.log(res, "获取朋友的信息")
|
||||
this.userInfo = res
|
||||
// 获取到用户信息之后,去检查一下要不要更新
|
||||
this.$store.dispatch('updateContact', res)
|
||||
@@ -148,7 +147,7 @@
|
||||
})
|
||||
},
|
||||
toPrivate() {
|
||||
uni.redirectTo({
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/chat?targetId=' + this.targetId
|
||||
});
|
||||
},
|
||||
@@ -209,7 +208,7 @@
|
||||
})
|
||||
return
|
||||
}
|
||||
pedingFriend(this.targetId, 'message').then(res => {
|
||||
pedingFriend(this.targetId, '').then(res => {
|
||||
uni.showToast({
|
||||
title: ` 申请成功,等待审核 `,
|
||||
icon: 'none',
|
||||
@@ -228,8 +227,9 @@
|
||||
})
|
||||
},
|
||||
singleCall(e) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/call?targetId=' + this.targetId + '&mediaType=' + e.type +
|
||||
'&isCall=true'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- 用户信息 -->
|
||||
<view class="info-flex">
|
||||
<view class="info-flex-item">
|
||||
<u-avatar :src="infoObj.portraitUrl" shape="square" size="210rpx" bg-color="#fff" class="avatar" />
|
||||
<u-avatar :src="infoObj.portraitUrl" @click='previewImg(infoObj.portraitUrl)' shape="square" size="210rpx" bg-color="#fff" class="avatar" />
|
||||
<view class="nickname">{{infoObj.name}}</view>
|
||||
<view class="address">{{infoObj.address}}</view>
|
||||
<view class="info-code">
|
||||
@@ -23,7 +23,8 @@
|
||||
<script>
|
||||
import {
|
||||
getUserInfo
|
||||
} from '@/apis/interfaces/im'
|
||||
} from '@/apis/interfaces/im.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -47,6 +48,12 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
previewImg(item){
|
||||
console.log(item)
|
||||
uni.previewImage({
|
||||
urls:[item]
|
||||
})
|
||||
},
|
||||
copy() {
|
||||
uni.setClipboardData({
|
||||
data: this.downUrl,
|
||||
@@ -99,7 +106,7 @@
|
||||
|
||||
.avatar {
|
||||
// padding: 14rpx;
|
||||
border-radius: 10rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: #fff;
|
||||
border: solid 14rpx rgba($color: #fff, $alpha:1);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,20 @@
|
||||
<view class="pending">
|
||||
<u-sticky>
|
||||
<view class="header-search" @click="$Router.push({ name: 'SearchFriend' })">
|
||||
<u-search placeholder="输入手机号码搜索" height="74" searchIcon="search" inputAlign="center" bgColor="white"
|
||||
<u-search placeholder="输入手机号码搜索" searchIcon="search" inputAlign="center" bgColor="white"
|
||||
:disabled="true" :show-action="false" />
|
||||
</view>
|
||||
</u-sticky>
|
||||
<block v-if="pendings.length > 0">
|
||||
<view v-for="(item, index) in pendings" :key="index">
|
||||
<apply-cell :message="item.latestMessage" @success="getPendingList" />
|
||||
</view>
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span> 暂无好友申请 ~ </span>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -22,16 +29,26 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pendings: []
|
||||
pendings: [],
|
||||
bg: '#fff'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
onShow() {
|
||||
this.getPendingList()
|
||||
uni.$on('onContactNotification', this.getPendingList)
|
||||
uni.$on('onNewContactPendings', this.getPendingList)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('onNewContactPendings')
|
||||
},
|
||||
methods: {
|
||||
getPendingList() {
|
||||
im.getPendingList((pendings) => {
|
||||
console.log(pendings, 'res......')
|
||||
if (pendings.length > 0) {
|
||||
this.bg = '#f9f9f9'
|
||||
} else {
|
||||
this.bg = '#fff'
|
||||
}
|
||||
this.pendings = pendings
|
||||
})
|
||||
}
|
||||
@@ -46,7 +63,7 @@
|
||||
}
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 3;
|
||||
padding-top: $padding * 5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@@ -8,17 +8,19 @@
|
||||
|
||||
<template>
|
||||
<view class="search">
|
||||
<!-- 搜索 、 -->
|
||||
<!-- 搜索 -->
|
||||
<u-sticky>
|
||||
<view class="header-search">
|
||||
<u-search placeholder="输入用户账号、手机号" height="74" searchIcon="search" @custom="search" v-model="searchValue" @search="search" bgColor="#f9f9f9" :focus="focused" />
|
||||
<u-search placeholder="输入用户账号、手机号" searchIcon="search" @custom="search" v-model="searchValue"
|
||||
@search="search" bgColor="#F3F6FB" :focus="focused" />
|
||||
</view>
|
||||
</u-sticky>
|
||||
<block v-if="searchResult.length > 0">
|
||||
<applyFriend :lists="searchResult" :isApply="true" @action="action" />
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src="require('@/static/imgs/no-search.png')" :lazy-load="true" />
|
||||
<view class="no-lists" v-if="searchResult.length === 0 && searchValue.length > 1">
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src="require('@/static/imgs/no-search.png')" :lazy-load="true" />
|
||||
<span>暂无匹配内容~</span>
|
||||
</view>
|
||||
</view>
|
||||
@@ -30,6 +32,7 @@
|
||||
pedingFriend
|
||||
} from '@/apis/interfaces/im.js';
|
||||
import applyFriend from '../components/friendSearchList.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
applyFriend
|
||||
@@ -41,6 +44,20 @@
|
||||
focused: true
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
searchValue(value) {
|
||||
console.log(value.length, 'length...')
|
||||
if (value.length > 1) {
|
||||
this.searchResult = []
|
||||
this.search()
|
||||
return
|
||||
}
|
||||
if(value.length === 0){
|
||||
this.searchResult = []
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
// friendship: '' 没有好友关系
|
||||
|
||||
@@ -1,25 +1,61 @@
|
||||
<template>
|
||||
<view class="create">
|
||||
<view class="create-title">公告内容</view>
|
||||
|
||||
<block v-if="type === 'check'">
|
||||
<view class="content"> {{content}} </view>
|
||||
</block>
|
||||
|
||||
<block v-else>
|
||||
<u--textarea v-model="content" count height="240" maxlength="240" placeholder="请输入公告内容" />
|
||||
<u-button type="primary" text="发布" :disabled="disabled" @click="onCreate" color="#34CE98" />
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createGroupAnnouncement
|
||||
createGroupAnnouncement,
|
||||
getGroupAnnouncement
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
content: ''
|
||||
content: '',
|
||||
aId: '',
|
||||
type: '' // cheack ' 查看详情'
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
if (e.aId) {
|
||||
this.type = e.type
|
||||
uni.setNavigationBarTitle({
|
||||
title: '群公告'
|
||||
})
|
||||
this.aId = e.aId
|
||||
getGroupAnnouncement(this.targetId, this.aId).then(res => {
|
||||
this.content = res.content
|
||||
}).catch(err => {
|
||||
if (err.status_code == 404) {
|
||||
this.$nextTick(() => {
|
||||
uni.navigateBack()
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none',
|
||||
mask: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
@@ -52,15 +88,16 @@
|
||||
<style lang="scss" scoped>
|
||||
.create {
|
||||
padding: $padding;
|
||||
.create-title{
|
||||
|
||||
.create-title {
|
||||
font-size: $title-size + 4;
|
||||
padding: $padding - 10 0 $padding - 10 $padding - 10 ;
|
||||
padding: $padding - 10 0 $padding - 10 $padding - 10;
|
||||
color: $text-color;
|
||||
font-weight: 800;
|
||||
position: relative;
|
||||
|
||||
&::before{
|
||||
content:"";
|
||||
&::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 10rpx;
|
||||
height: 34rpx;
|
||||
@@ -69,6 +106,13 @@
|
||||
top: 26rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
color: $text-color;
|
||||
font-size: $title-size;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.u-button {
|
||||
margin-top: $padding;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
<template>
|
||||
<view class="announce">
|
||||
<view class="announce" :style="`background-color:${bg};`">
|
||||
<!-- 有列表 -->
|
||||
<u-skeleton rows="2" :loading="loading" avatar :rows="5" v-if="announcements.length>0">
|
||||
<view v-for="(item,index) in announcements" :key="index" class="item" >
|
||||
<view class="header">
|
||||
<u-avatar :src="item.user.portraitUrl" />
|
||||
<view v-for="(item,index) in announcements" :key="index" class="item"
|
||||
@longpress="actions(item.announcement_id)" @click="tabA(item.announcement_id)">
|
||||
<view class="content-a"><span v-if="item.is_top">置顶</span>{{ item.content }}</view>
|
||||
<view class="user">
|
||||
<u-avatar :src="item.user.portraitUrl" size="40rpx" />
|
||||
<view class="name">{{ item.user.name }}</view>
|
||||
<view class="time">{{ item.created_at }}</view>
|
||||
</view>
|
||||
<view class="delete" v-if="isAdmin" @click="onDelete(item.announcement_id)">删除</view>
|
||||
</view>
|
||||
<view class="content">{{ item.content }}</view>
|
||||
<!-- <view class="delete" v-if="isAdmin" @click="onDelete(item.announcement_id)">删除</view> -->
|
||||
</view>
|
||||
</u-skeleton>
|
||||
|
||||
<!-- 没有列表 -->
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src="require('@/static/imgs/no-level-list.png')" :lazy-load="true" />
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src="require('@/static/imgs/no-level-list.png')" :lazy-load="true" />
|
||||
<span>暂无公告内容~</span>
|
||||
</view>
|
||||
|
||||
<!-- 弹出 -->
|
||||
<u-action-sheet :actions="actionMap" :title="actionTitle" :show="actionShow" cancelText="取消"
|
||||
@close="actionShow = false" @select="handleAction" />
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -24,16 +32,36 @@
|
||||
import {
|
||||
getGroupInfo,
|
||||
getGroupAnnouncements,
|
||||
deleteGroupAnnouncement
|
||||
deleteGroupAnnouncement,
|
||||
topGroupAnnouncement
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
announcements: [],
|
||||
groupAnnouncementId: '', // 选择公告 id
|
||||
announcements: [], // 公告列表
|
||||
loading: true,
|
||||
isAdmin: false
|
||||
isAdmin: false,
|
||||
actionShow: false,
|
||||
actionMap: [{
|
||||
key: 2,
|
||||
name: ' 删除该公告',
|
||||
disabled: false
|
||||
}, {
|
||||
key: 3,
|
||||
name: '置顶该公告',
|
||||
disabled: false
|
||||
}],
|
||||
actionTitle: '请选择操作',
|
||||
bg: '#fff'
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -60,35 +88,73 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取公告信息
|
||||
initData() {
|
||||
getGroupAnnouncements(this.targetId).then(res => {
|
||||
if (res.length > 0) {
|
||||
this.bg = '#f9f9f9'
|
||||
} else {
|
||||
this.bg = '#fff'
|
||||
}
|
||||
this.announcements = res
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 选择公告 并显示操作弹窗
|
||||
actions(id) {
|
||||
if (this.isAdmin) {
|
||||
this.groupAnnouncementId = id
|
||||
this.actionShow = true
|
||||
}
|
||||
},
|
||||
// 选择了操作出发事件
|
||||
handleAction(e) {
|
||||
console.log(e.key)
|
||||
switch (e.key) {
|
||||
case 2:
|
||||
this.onDelete(this.groupAnnouncementId)
|
||||
break;
|
||||
case 3:
|
||||
this.onTop(this.groupAnnouncementId)
|
||||
break;
|
||||
}
|
||||
},
|
||||
tabA(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/group/announceCreate?type=check&targetId=' + this.targetId + '&aId=' + id
|
||||
})
|
||||
},
|
||||
onTop(aId) {
|
||||
topGroupAnnouncement(this.targetId, aId).then(res => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: ' 置顶成功',
|
||||
mask: true
|
||||
})
|
||||
uni.$emit('updateAnnouncement')
|
||||
this.initData()
|
||||
})
|
||||
},
|
||||
// 删除公告
|
||||
onDelete(aId) {
|
||||
uni.showModal({
|
||||
title: '删除公告',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
deleteGroupAnnouncement(this.targetId, aId).then(res => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '删除成功'
|
||||
title: '删除成功',
|
||||
mask: true
|
||||
})
|
||||
uni.$emit('updateAnnouncement')
|
||||
this.initData()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.announce {
|
||||
padding: 0 $padding $padding $padding;
|
||||
min-height: 99vh;
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 5;
|
||||
display: flex;
|
||||
@@ -103,41 +169,55 @@
|
||||
padding-top: $padding;
|
||||
}
|
||||
}
|
||||
.item {
|
||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
||||
padding-top: $padding;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.item {
|
||||
background-color: #fff;
|
||||
padding: $padding $padding + 10 10rpx $padding + 10;
|
||||
border-bottom: $padding solid #f9f9f9;
|
||||
|
||||
|
||||
.user {
|
||||
margin-left: $padding;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
padding: 20rpx 10rpx 10rpx 10rpx;
|
||||
border-top: solid 1rpx #F9F9F9;
|
||||
|
||||
.name {}
|
||||
.name {
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 24rpx;
|
||||
color: $text-gray-m;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.delete {
|
||||
color: $text-price;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20rpx $padding;
|
||||
.content-a {
|
||||
font-size: $title-size;
|
||||
color: $text-gray;
|
||||
color: $text-color;
|
||||
max-width: 100%;
|
||||
margin-bottom: 10rpx;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
overflow: hidden;
|
||||
line-height: 1.5;
|
||||
|
||||
span {
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
border-radius: 10rpx;
|
||||
background-color: $main-color;
|
||||
font-size: $title-size-m - 4;
|
||||
padding: 4rpx 10rpx;
|
||||
margin-right: 10rpx;
|
||||
line-height: 1.4;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,14 @@
|
||||
joinGroupPre,
|
||||
joinGroup
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
|
||||
@@ -4,20 +4,8 @@
|
||||
|
||||
<view class="body">
|
||||
<view class="scroll">
|
||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
||||
<view class="time" v-if="item.senderUserId === '__system__'">{{ item.content.message }}</view>
|
||||
<view v-else :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
||||
<u-avatar class="avatar" @click="toUser(item)" size="36" shape="square"
|
||||
:src="contact(item.senderUserId).portraitUrl" />
|
||||
<view class="msg">
|
||||
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" :name="contact(item.senderUserId).name" />
|
||||
<show-image v-if="item.objectName === 'RC:ImgMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" :name="contact(item.senderUserId).name" />
|
||||
<show-text v-if="item.objectName === 'RC:TxtMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" :name="contact(item.senderUserId).name" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||
<show-message-cell :message="message" isGroup />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -25,28 +13,29 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
timeCustomCN
|
||||
} from '@/utils/filters.js'
|
||||
import {
|
||||
getGroupBase
|
||||
} from '@/apis/interfaces/im.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import showVoice from '../components/showVoice'
|
||||
import showImage from '../components/showImage'
|
||||
import showText from '../components/showText'
|
||||
import sentMessageBar from '../components/sentMessageBar'
|
||||
import showMessageCell from '../components/showMessageCell'
|
||||
import utils from '@/utils/index.js'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
components: {
|
||||
showVoice,
|
||||
showImage,
|
||||
showText,
|
||||
sentMessageBar
|
||||
sentMessageBar,
|
||||
showMessageCell
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
avatarRpx: 84,
|
||||
targetId: '',
|
||||
conversationType: RongIMLib.ConversationType.GROUP,
|
||||
messages: [],
|
||||
@@ -64,31 +53,62 @@
|
||||
sentTime: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
onShow() {
|
||||
this.initGroupInfo()
|
||||
},
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
// 获取群成员数量
|
||||
getGroupBase(this.targetId).then(res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.groupInfo.name + `(${res.members})`
|
||||
})
|
||||
})
|
||||
// 获取历史消息列表
|
||||
this.getMessageList()
|
||||
// 监听收到本群的消息,追加消息
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||
this.getNewMessage()
|
||||
})
|
||||
uni.$on('onReceiptRequest', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
RongIMLib.getMessageByUId(msg.messageUId, (result) => {
|
||||
RongIMLib.sendReadReceiptResponse(3, this.targetId, [result.message], (res) => {
|
||||
console.error('发送群聊已读回执成功', res);
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
// 群已读回执
|
||||
uni.$on('onReceiptResponse', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
this.messages = this.messages.map(item => {
|
||||
if (msg.messageId == item.messageId) {
|
||||
return msg
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
// 清理聊天记录
|
||||
uni.$once('cleanGroupMessage', this.getMessageList)
|
||||
uni.$on('onRecallMessage_' + this.targetId, (message) => {
|
||||
this.messages = this.messages.map(item => {
|
||||
if (message.messageId == item.messageId) {
|
||||
return message
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
})
|
||||
uni.$on('remove_message_' + this.targetId, (messageId) => {
|
||||
this.messages = this.messages.filter(item => item.messageId != messageId)
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('remove_message_' + this.targetId)
|
||||
uni.$off('onReceiveMessage_' + this.targetId)
|
||||
uni.$off('onUpdateProfile_' + this.targetId)
|
||||
uni.$off('onRecallMessage_' + this.targetId)
|
||||
uni.$off('onReceiptRequest')
|
||||
uni.$off('onReceiptResponse')
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
uni.navigateTo({
|
||||
@@ -96,23 +116,17 @@
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
initGroupInfo() {
|
||||
// 获取群信息,成员数量,设置标题
|
||||
getGroupBase(this.targetId).then(res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.name + `(${res.members})`
|
||||
})
|
||||
})
|
||||
},
|
||||
onScroll(e) {
|
||||
this.$refs.messageBar.onHidePopus()
|
||||
},
|
||||
toUser(item) {
|
||||
if (item.senderUserId == '__system__') {
|
||||
return
|
||||
}
|
||||
if (item.messageDirection == 1) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/mine?targetId=' + item.senderUserId
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/friends/info?targetId=' + item.senderUserId
|
||||
})
|
||||
}
|
||||
},
|
||||
getNewMessage() {
|
||||
im.getMessageList(
|
||||
this.conversationType,
|
||||
@@ -134,6 +148,18 @@
|
||||
20,
|
||||
true,
|
||||
(messages) => {
|
||||
console.log('获取消息列表', messages);
|
||||
const msgs = messages.filter(item => item.receivedStatus == 0)
|
||||
console.log('未读消息', msgs);
|
||||
if (msgs.length) {
|
||||
RongIMLib.sendReadReceiptResponse(3, this.targetId, msgs, (res) => {
|
||||
console.error('发送群聊已读回执成功', res);
|
||||
msgs.map(item => {
|
||||
RongIMLib.setMessageReceivedStatus(item.messageId, 1)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.messages = messages
|
||||
this.scrollBottom()
|
||||
})
|
||||
@@ -144,12 +170,14 @@
|
||||
// 清理当前会话,未读消息数量
|
||||
RongIMLib.clearMessagesUnreadStatus(this.conversationType, this.targetId, this.latestMessage
|
||||
.sentTime)
|
||||
// // 发送消息已读状态给对方
|
||||
// RongIMLib.sendReadReceiptMessage(this.conversationType, this.targetId, this.latestMessage.sentTime)
|
||||
// 更新badge提醒数量
|
||||
im.setNotifyBadge()
|
||||
}
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
// console.log(JSON.stringify(this.$refs))
|
||||
// this.$refs.voice.stopPlay()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -175,53 +203,9 @@
|
||||
justify-content: flex-end;
|
||||
|
||||
.cell {
|
||||
padding: 10rpx 30rpx;
|
||||
.time {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
padding: 10rpx 20rpx;
|
||||
|
||||
.cell-item {
|
||||
display: flex;
|
||||
width: 690rpx;
|
||||
justify-content: flex-start;
|
||||
|
||||
&.left {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
&.right {
|
||||
flex-direction: row-reverse;
|
||||
|
||||
.state {
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
|
||||
.msg {
|
||||
margin: 0 20rpx;
|
||||
|
||||
.state {
|
||||
padding-top: 10rpx;
|
||||
|
||||
.state-text {
|
||||
font-size: $title-size-m - 2;
|
||||
color: rgba($color: $main-color, $alpha: 0.3)
|
||||
}
|
||||
|
||||
.state-text-active {
|
||||
font-size: $title-size-m - 2;
|
||||
color: #cecece;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cell-footer {
|
||||
height: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
<template>
|
||||
<view class="group">
|
||||
<view class="group" :style="`background-color:${bg};`">
|
||||
<block v-if="groups.length > 0">
|
||||
<view class="title"> 群聊 </view>
|
||||
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
||||
<u-avatar size="38" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||
<u-avatar size="36" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||
<view class="info">
|
||||
<view class="name">{{ item.name }}</view>
|
||||
<view class="name">{{ item.name }} <span class="total">共{{ item.members }} 成员</span></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="group-count"> {{groups.length}}个群聊 </view>
|
||||
<view class="group-count"> {{ groups.length }}个群聊 </view>
|
||||
</block>
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx" :src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span>空空如也~</span>
|
||||
</view>
|
||||
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
|
||||
@confirm="onCreateGroup">
|
||||
<view class="slot-content">
|
||||
@@ -28,7 +34,8 @@
|
||||
return {
|
||||
groups: [],
|
||||
createModal: false,
|
||||
groupName: ''
|
||||
groupName: '',
|
||||
bg: '#fff'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -41,13 +48,19 @@
|
||||
onNavigationBarButtonTap() {
|
||||
this.createModal = true
|
||||
},
|
||||
onLoad() {
|
||||
onShow() {
|
||||
this.initData()
|
||||
uni.$on('onGroupDismiss', this.initData)
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
getMyGroups().then((res) => {
|
||||
console.log(res,'res...')
|
||||
if (res.length > 0) {
|
||||
this.bg = '#f9f9f9'
|
||||
} else {
|
||||
this.bg = '#fff'
|
||||
}
|
||||
this.groups = res
|
||||
res.map(item => {
|
||||
this.$store.dispatch('updateContact', item)
|
||||
@@ -88,17 +101,19 @@
|
||||
.group {
|
||||
min-height: 100vh;
|
||||
background-color: $window-color;
|
||||
.title{
|
||||
|
||||
.title {
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
padding: 10rpx $padding;
|
||||
}
|
||||
.group-count{
|
||||
|
||||
.group-count {
|
||||
text-align: center;
|
||||
font-size: $title-size;
|
||||
color: $text-gray;
|
||||
background-color: #fff;
|
||||
padding: 10rpx $padding $padding $padding;
|
||||
padding: 10rpx $padding 20rpx $padding;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
@@ -123,6 +138,11 @@
|
||||
font-size: $title-size + 1;
|
||||
color: #454545 !important;
|
||||
}
|
||||
.total{
|
||||
color: $text-gray-m;
|
||||
font-size: $title-size-m - 5;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
.address {
|
||||
color: $text-gray-m;
|
||||
@@ -130,4 +150,19 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
|
||||
span {
|
||||
padding-top: $padding;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,23 +4,26 @@
|
||||
<group-user-list ref="userList" :targetId="targetId" :count="14" />
|
||||
</view>
|
||||
|
||||
<u-cell-group class="cells" :border="false" >
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="群公告" :label="announcement" @click="toAnnouncement" />
|
||||
<u-cell-group class="cells" :border="false">
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="群公告" @click="toAnnouncement">
|
||||
<view slot="label" class="announcement-label "> {{announcement}} </view>
|
||||
</u-cell>
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="二维码" @click="showGroupQrCode" />
|
||||
<u-cell :border="false" class="u-border-bottom" v-if="group.can_makesure" isLink title="群聊邀请确认" @click="showGroupsSure" />
|
||||
<u-cell :border="false" class="u-border-bottom" title="聊天置顶">
|
||||
<u-switch slot="value" size="20" v-model="isTop" activeColor="#34CE98" @change="setTop" />
|
||||
</u-cell>
|
||||
<u-cell class="u-border-bottom" :border="false" title="免打扰">
|
||||
<u-cell class="u-border-bottom" :border="false" title="消息免打扰">
|
||||
<u-switch slot="value" size="20" v-model="status" activeColor="#34CE98" @change="setStatus" />
|
||||
</u-cell>
|
||||
</u-cell-group>
|
||||
|
||||
<u-cell-group class="cells" v-if="group.is_admin" :border="false">
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群聊名称" :value="groupName" @click="onGroupName" />
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群头像" @click="onGroupAvatar">
|
||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群聊名称" :value="groupName"
|
||||
@click="onGroupName" />
|
||||
<!-- <u-cell :border="false" class="u-border-bottom" isLink title="修改群头像" @click="onGroupAvatar">
|
||||
<u-avatar slot="value" size="25" shape="square" :src="group.cover" />
|
||||
</u-cell>
|
||||
</u-cell> -->
|
||||
<u-cell :border="false" class="u-border-bottom" isLink v-if="group.is_owner" title="准入方式" :value="joinType" @click="onChangeJoinType" />
|
||||
</u-cell-group>
|
||||
|
||||
@@ -31,15 +34,11 @@
|
||||
</view>
|
||||
|
||||
<u-modal negativeTop="300" :show="modalShow" title="修改群名称" showCancelButton @cancel="onHideModal" @confirm="onChangeGroupName">
|
||||
<view class="slot-content">
|
||||
<u--input placeholder="群名称" border="surround" focus v-model="groupName" />
|
||||
</view>
|
||||
<view class="slot-content"> <u--input placeholder="群名称" border="surround" focus v-model="groupName" maxlength="12" /> </view>
|
||||
</u-modal>
|
||||
|
||||
<u-modal :show="qrCodeShow" :title="group.name" @confirm="qrCodeShow = false">
|
||||
<view class="slot-content">
|
||||
<uqrcode class="info-code-src" :size="198" :text="qrContent" />
|
||||
</view>
|
||||
<view class="slot-content"> <uqrcode class="info-code-src" :size="198" :text="qrContent" /> </view>
|
||||
</u-modal>
|
||||
|
||||
<u-action-sheet @select="doAction" :actions="joinTypeMap" cancelText="取消" :show="showActions" @close="showActions=false" />
|
||||
@@ -58,11 +57,17 @@
|
||||
} from '@/apis/interfaces/uploading'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import groupUserList from '../components/groupUserList'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
groupUserList
|
||||
},
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
@@ -84,10 +89,15 @@
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
this.qrContent += e.targetId
|
||||
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({status}) => {
|
||||
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
|
||||
status
|
||||
}) => {
|
||||
this.status = !Boolean(status)
|
||||
})
|
||||
RongIMLib.getConversation(this.conversationType, this.targetId, ({code,conversation}) => {
|
||||
RongIMLib.getConversation(this.conversationType, this.targetId, ({
|
||||
code,
|
||||
conversation
|
||||
}) => {
|
||||
if (code == 0) {
|
||||
this.isTop = conversation.isTop
|
||||
}
|
||||
@@ -95,9 +105,12 @@
|
||||
this.initData()
|
||||
uni.$on('groupAnnouncementCreated', this.initData)
|
||||
uni.$on('groupInvitedUser', this.updateUserList)
|
||||
uni.$on('updateAnnouncement', this.initData)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('groupAnnouncementCreated')
|
||||
uni.$off('groupInvitedUser')
|
||||
uni.$off('updateAnnouncement')
|
||||
},
|
||||
methods: {
|
||||
updateUserList() {
|
||||
@@ -105,7 +118,6 @@
|
||||
},
|
||||
initData() {
|
||||
getGroupInfo(this.targetId).then(res => {
|
||||
console.log(res,'群信息。。。。。')
|
||||
this.group = res.group
|
||||
this.groupName = res.group.name
|
||||
this.announcement = res.announcement
|
||||
@@ -119,7 +131,6 @@
|
||||
return item.key == res.join_type
|
||||
})[0].name
|
||||
}).catch(err => {
|
||||
console.log('getGroupInfo ERR', err);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '群不存在'
|
||||
@@ -152,9 +163,9 @@
|
||||
this.qrCodeShow = true
|
||||
},
|
||||
// 群聊邀请待确认
|
||||
showGroupsSure(){
|
||||
showGroupsSure() {
|
||||
uni.navigateTo({
|
||||
url:"/pages/im/group/reviewed?id="+this.targetId
|
||||
url: "/pages/im/group/reviewed?targetId=" + this.targetId
|
||||
})
|
||||
},
|
||||
onGroupName() {
|
||||
@@ -243,8 +254,11 @@
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.initData()
|
||||
this.joinType = e.name
|
||||
this.$nextTick(() => {
|
||||
this.$refs.userList.initGroupInfo()
|
||||
this.initData()
|
||||
})
|
||||
this.showActions = false
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
@@ -326,6 +340,20 @@
|
||||
.cells {
|
||||
margin-top: $padding;
|
||||
background-color: white;
|
||||
|
||||
.announcement-label {
|
||||
font-size: $title-size-m + 2;
|
||||
padding-top: 10rpx;
|
||||
color: $text-gray-m;
|
||||
overflow: hidden;
|
||||
width: 620rpx;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
}
|
||||
|
||||
.members {
|
||||
@@ -347,5 +375,4 @@
|
||||
.u-border-bottom {
|
||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<view class="invite">
|
||||
<view class="search">
|
||||
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt"
|
||||
<view class="search u-border-bottom">
|
||||
<u--input class="search-input" placeholder="搜索好友" border="none" prefixIcon="search" v-model="searchTxt"
|
||||
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" @change="onSearch" />
|
||||
</view>
|
||||
<block v-if="friends.length > 0">
|
||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
|
||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
||||
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#ededed" height="20" size="12"
|
||||
color="#666" style="padding:10rpx 30rpx" />
|
||||
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#f9f9f9f" height="20"
|
||||
size="12" color="#666"
|
||||
style="border:none !important;padding: 10rpx 30rpx;background-color: #f9f9f9 !important;" />
|
||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||
@click="addContact(friendItem.targetId)">
|
||||
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
|
||||
@@ -44,10 +45,15 @@
|
||||
getGroupUsers
|
||||
} from '@/apis/interfaces/im';
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
searchTxt: '',
|
||||
@@ -60,32 +66,24 @@
|
||||
selectValue: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
this.getFriendList()
|
||||
},
|
||||
methods: {
|
||||
onSearch(val) {
|
||||
if (val) {
|
||||
var ix = []
|
||||
onSearch() {
|
||||
if (this.searchTxt) {
|
||||
this.friends = this.orignalFriends.map((list, index) => {
|
||||
const resList = list.filter(item => item.name.indexOf(val) > 0)
|
||||
if (resList.length > 0) {
|
||||
this.indexs = this.orignalIndexs.map((t, i) => {})
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const resList = list.filter(item => {
|
||||
return item.name.indexOf(this.searchTxt) >= 0
|
||||
})
|
||||
return resList
|
||||
})
|
||||
this.friends = this.friends.filter(n => n)
|
||||
|
||||
this.indexs = this.orignalIndexs.map((t, i) => {
|
||||
if (this.friends[i].length > 0) {
|
||||
return t
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.friends = this.orignalFriends
|
||||
this.indexs = this.orignalIndexs
|
||||
@@ -103,6 +101,7 @@
|
||||
})
|
||||
getGroupUsers(this.targetId).then(res => {
|
||||
res.map(res => {
|
||||
console.log(res)
|
||||
this.checkboxValue.push(String(res.targetId))
|
||||
this.selectValue.push(String(res.targetId))
|
||||
})
|
||||
@@ -123,8 +122,16 @@
|
||||
|
||||
},
|
||||
onInvite() {
|
||||
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
|
||||
console.log(res, 'res')
|
||||
console.log(this.checkboxValue, 'userIds.....')
|
||||
console.log(this.selectValue, 'userIds.....')
|
||||
let userIds = []
|
||||
this.checkboxValue.filter(item => {
|
||||
if (!utils.inArray(item, this.selectValue)) {
|
||||
userIds.push(item)
|
||||
}
|
||||
})
|
||||
// console.log(userIds)
|
||||
inviteGroupUser(this.targetId, this.checkboxValue, userIds).then(res => {
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
animationType: 'pop-out',
|
||||
|
||||
@@ -1,35 +1,113 @@
|
||||
<!-- 群聊邀请确认列表页面 -->
|
||||
<template>
|
||||
<view class="reviewed">
|
||||
<view class="reviewed-item">
|
||||
<u-avatar class="avatar" src="require('@/static/user/cover.png')" shape="square" size="36" />
|
||||
<view style="flex:1;">
|
||||
<view class="nickname"><span>{{`艾米的猫儿 `}}</span>想邀请<span>{{` 用户8066`}}</span>加入群聊</view>
|
||||
<view> 申请原因:{{`呵呵哒。。`}}</view>
|
||||
<block v-if="pendings.length > 0">
|
||||
<view class="reviewed-item" v-for="(item, index) in pendings" :key="index">
|
||||
<u-avatar class="avatar"
|
||||
:src="JSON.parse(item.content.extra).portraitUrl || require('@/static/user/cover.png')"
|
||||
shape="square" size="46" />
|
||||
<view style="flex:1;" v-if="item.content.operation == 'GroupPending'">
|
||||
<view class="nickname">{{ JSON.parse(item.content.extra).name }} 申请加入群聊</view>
|
||||
<view> 申请原因:{{ item.content.message }}</view>
|
||||
</view>
|
||||
<view class="sure" @click="sure(2)"> 通过 </view>
|
||||
<view style="flex:1;" v-if="item.content.operation == 'GroupInvite'">
|
||||
<view class="nickname">
|
||||
<text>{{ contact(item.content.sourceUserId).name }}</text>想邀请<span>{{ JSON.parse(item.content.extra).name }}</span>加入群聊
|
||||
</view>
|
||||
</view>
|
||||
<view class="sure" @click="sure(item.content.targetUserId,item.messageId)"> 通过 </view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<view class="no-lists" v-else>
|
||||
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||
:src="require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||
<span>暂无群聊申请数据</span>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getGroupMakeSure,
|
||||
getGroupMakeSureAllow
|
||||
getGroupMakeSureAllow,
|
||||
groupMakeSure
|
||||
} from "@/apis/interfaces/im.js"
|
||||
import im from '@/utils/im/message.js'
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase,
|
||||
onGroupDismiss
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
lists: [],
|
||||
targetId: '',
|
||||
pendings: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.targetId = e.targetId
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
|
||||
sure(id) {
|
||||
console.log(id, '....')
|
||||
uni.navigateTo({
|
||||
url: "/pages/im/group/reviewedInfo?id=" + id
|
||||
getList() {
|
||||
im.getGroupPendinglist(this.targetId, (result) => {
|
||||
console.log(result)
|
||||
this.pendings = result
|
||||
})
|
||||
},
|
||||
sure(userId, latestMessageId) {
|
||||
groupMakeSure(this.targetId, userId).then(res => {
|
||||
// 清除聊天列表
|
||||
RongIMLib.deleteMessagesByIds([latestMessageId], ({
|
||||
code
|
||||
}) => {
|
||||
console.log('code', code)
|
||||
if (code == 0) {
|
||||
uni.showToast({
|
||||
title: ` 通过 `,
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
uni.$emit('groupInvitedUser')
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: err.message,
|
||||
// icon: 'none',
|
||||
// mask: true,
|
||||
// duration: 2000
|
||||
// })
|
||||
RongIMLib.deleteMessagesByIds([latestMessageId], ({
|
||||
code
|
||||
}) => {
|
||||
console.log('code', code)
|
||||
if (code == 0) {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
uni.$emit('groupInvitedUser')
|
||||
}
|
||||
})
|
||||
})
|
||||
// 直接调用通过或拒绝的接口
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -45,7 +123,7 @@
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
border-bottom: solid 1rpx #f9f9f9;
|
||||
font-size: $title-size-m - 2;
|
||||
font-size: $title-size-m;
|
||||
padding-bottom: 20rpx;
|
||||
color: $text-gray-m;
|
||||
|
||||
@@ -56,11 +134,14 @@
|
||||
}
|
||||
|
||||
.nickname {
|
||||
font-size: $title-size-m;
|
||||
font-size: $title-size;
|
||||
color: $text-color;
|
||||
padding-bottom: 6rpx;
|
||||
|
||||
span {
|
||||
color: $text-color;
|
||||
font-size: $title-size-m +1;
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +157,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.no-lists {
|
||||
padding-top: $padding * 5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray-m;
|
||||
|
||||
span {
|
||||
padding-top: $padding;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<!-- 群聊邀请确认列表页面 -->
|
||||
<template>
|
||||
<view class="reviewed">
|
||||
确认信息页面
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
lists: [],
|
||||
};
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
sure(id) {
|
||||
uni.navigateTo({
|
||||
url:"/pages/im/group/reviewedInfo?id="+id
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.reviewed {
|
||||
.reviewed-item {
|
||||
margin: $padding;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
box-sizing: border-box;
|
||||
border-bottom: solid 1rpx #f9f9f9;
|
||||
font-size: $title-size-m;
|
||||
padding-bottom: 20rpx;
|
||||
color: $text-gray;
|
||||
|
||||
.add-icon {
|
||||
background-color: $main-color;
|
||||
padding: 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.sure {
|
||||
// width: 140rpx;
|
||||
// background-color: $main-color;
|
||||
color: $main-color;
|
||||
text-align: center;
|
||||
font-size: $title-size-m;
|
||||
padding: 6rpx 20rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,12 @@
|
||||
|
||||
<script>
|
||||
import groupUserList from '../components/groupUserList'
|
||||
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
onGroupDismiss
|
||||
],
|
||||
components: {
|
||||
groupUserList
|
||||
},
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
return {
|
||||
conversations: [], // 会话列表
|
||||
connection: 0,
|
||||
hasNewFriends: 0
|
||||
hasNewFriends: 0,
|
||||
perPage: 200
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -54,35 +55,37 @@
|
||||
connectionStatus
|
||||
},
|
||||
onLoad() {
|
||||
// 好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
// 监听新的好友申请
|
||||
uni.$on('onContactNotification', () => {
|
||||
uni.$on('onNewContactConversation', () => {
|
||||
console.log('更新好友申请数量');
|
||||
// 更新好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
// 好友申请数量
|
||||
this.checkNewFriendPending()
|
||||
|
||||
if (this.$store.state.token !== '') {
|
||||
this.getConversationList()
|
||||
}
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
})
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
this.getConversationList()
|
||||
})
|
||||
// 监听网络状态变化
|
||||
uni.$on('onConnectionStatusChange', (status) => {
|
||||
this.connection = status
|
||||
if (status == 0) {
|
||||
this.getConversationList()
|
||||
}
|
||||
})
|
||||
},
|
||||
onHide() {
|
||||
uni.$off('onReceiveMessage')
|
||||
uni.$off('onConnectionStatusChange')
|
||||
},
|
||||
methods: {
|
||||
onDemo(){
|
||||
console.log('1111')
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/chatDemo'
|
||||
})
|
||||
},
|
||||
checkNewFriendPending() {
|
||||
im.getPendingList((pendings) => {
|
||||
this.hasNewFriends = pendings.length
|
||||
@@ -97,11 +100,9 @@
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 获取私聊的会话列表
|
||||
// 获取会话列表,最新的一千条
|
||||
getConversationList() {
|
||||
const count = 1000
|
||||
const timestamp = 0
|
||||
RongIMLib.getConversationList([1, 3], count, timestamp, ({
|
||||
RongIMLib.getConversationList([1, 3], this.perPage, 0, ({
|
||||
code,
|
||||
conversations
|
||||
}) => {
|
||||
|
||||
17
pages/im/mixins/imBase.js
Normal file
17
pages/im/mixins/imBase.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
},
|
||||
avatarSize() {
|
||||
return utils.rpx2px(84)
|
||||
},
|
||||
sender() {
|
||||
return this.$store.getters.sender
|
||||
}
|
||||
}
|
||||
}
|
||||
34
pages/im/mixins/onGroupDismiss.js
Normal file
34
pages/im/mixins/onGroupDismiss.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// 监听群解散的消息,直接跳转到会话列表页面
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTargetId: ''
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.currentTargetId = e.targetId
|
||||
|
||||
uni.$once('onGroupDismiss_' + e.targetId, () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '当前群已解散'
|
||||
})
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
})
|
||||
uni.$once('onGroupRemoveYou_' + e.targetId, () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '您已被移出群聊'
|
||||
})
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('onGroupDismiss_' + this.currentTargetId)
|
||||
uni.$off('onGroupRemoveYou_' + this.currentTargetId)
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,30 @@
|
||||
<template>
|
||||
<view class="call">
|
||||
<view class="video">
|
||||
<RongCloud-Call-RCUniCallView ref="bigVideoView" :style="{width:windowWidth+'px',height:windowHeight+'px'}"
|
||||
class="bigVideoView">
|
||||
<RongCloud-Call-RCUniCallView ref="bigVideoView" :style="bigVideoStyle" class="bigVideoView">
|
||||
</RongCloud-Call-RCUniCallView>
|
||||
<RongCloud-Call-RCUniCallView ref="smallVideoView" class="smallVideoView">
|
||||
|
||||
<movable-area class="movableArea" :style="movableAreaStyle">
|
||||
<movable-view class="movableView" direction="all" :x="50" :y="50" v-if="mediaType == 1 && connected">
|
||||
<RongCloud-Call-RCUniCallView ref="smallVideoView" class="smallVideoView" @click="changeMine">
|
||||
</RongCloud-Call-RCUniCallView>
|
||||
</movable-view>
|
||||
</movable-area>
|
||||
</view>
|
||||
|
||||
<view class="status" v-if="!connected || mediaType == 0">
|
||||
<view class="status" v-if="!connected">
|
||||
<view class="remote">
|
||||
<u-avatar :src="contact(targetId).portraitUrl" shape="square" size="96" bgColor="#fff" />
|
||||
<u-avatar :src="contact(targetId).portraitUrl" shape="square" :size="avatarSize" bgColor="#fff" />
|
||||
<view><text class="nickname">{{ contact(targetId).name }}</text></view>
|
||||
<view v-if="remoteRinging"><text class="mediaType">等待对方接听</text></view>
|
||||
<view v-if="connected"><text class="mediaType">已接通</text></view>
|
||||
<view v-else><text class="mediaType">{{ mediaType == 0 ? '邀请您语音通话' : '邀请您视频通话' }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="buttons">
|
||||
<view class="btn" v-if="connected" @click="changeMicrophone">
|
||||
<view class="icon">
|
||||
<u-icon name="mic" color="#ffffff" size="30" />
|
||||
<u-icon name="mic-off" color="#ffffff" size="30" />
|
||||
<u-icon name="mic-off" color="#ffffff" size="30" v-if="micOff" />
|
||||
<u-icon name="mic" color="#ffffff" size="30" v-else />
|
||||
</view>
|
||||
<text class="text">麦克风</text>
|
||||
</view>
|
||||
@@ -31,7 +34,7 @@
|
||||
</view>
|
||||
<text class="text">挂断</text>
|
||||
</view>
|
||||
<view class="btn" v-if="!connected" @click="accept">
|
||||
<view class="btn" v-if="!connected && this.isCall == false" @click="accept">
|
||||
<view class="icon">
|
||||
<u-icon name="checkmark" color="#ffffff" size="30" />
|
||||
</view>
|
||||
@@ -39,8 +42,8 @@
|
||||
</view>
|
||||
<view class="btn" v-if="connected" @click="changeSpeaker">
|
||||
<view class="icon">
|
||||
<u-icon name="volume-fill" color="#ffffff" size="27" />
|
||||
<u-icon name="volume-off-fill" color="#ffffff" size="27" />
|
||||
<u-icon name="volume-off-fill" color="#ffffff" size="27" v-if="volumeOff" />
|
||||
<u-icon name="volume-fill" color="#ffffff" size="27" v-else />
|
||||
</view>
|
||||
<text class="text">扬声器</text>
|
||||
</view>
|
||||
@@ -51,25 +54,46 @@
|
||||
<script>
|
||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import utils from '@/utils/index.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
targetId: '',
|
||||
mediaType: 0, // 0 语音 1 视频
|
||||
isOut: false,
|
||||
connected: false,
|
||||
micStatus: false,
|
||||
speStatus: false,
|
||||
remoteRinging: false,
|
||||
ring: null
|
||||
ring: null,
|
||||
isCall: false,
|
||||
avatarSize: 96,
|
||||
bigVideoStyle: {},
|
||||
movableAreaStyle: {},
|
||||
// 关闭麦克风
|
||||
micOff: false,
|
||||
// 关闭扬声器
|
||||
volumeOff: false,
|
||||
// 通话时长
|
||||
duration: 0,
|
||||
interval: null
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.avatarSize = utils.rpx2px(200)
|
||||
this.targetId = e.targetId
|
||||
this.mediaType = e.mediaType
|
||||
this.isCall = Boolean(e.isCall)
|
||||
// 进入页面开启外呼
|
||||
if (this.isCall) {
|
||||
CallLib.startSingleCall(this.targetId, this.mediaType, '');
|
||||
if (this.mediaType == 1) {
|
||||
const session = CallLib.getCurrentCallSession()
|
||||
setTimeout(() => {
|
||||
CallLib.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0, false)
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
// 响铃
|
||||
this.startRing()
|
||||
// 监听通话链接状态
|
||||
@@ -81,6 +105,14 @@
|
||||
uni.$once('onRemoteUserJoined', () => {
|
||||
this.remoteRinging = false
|
||||
})
|
||||
this.bigVideoStyle = {
|
||||
width: this.windowWidth + 'px',
|
||||
height: this.windowHeight + 'px',
|
||||
}
|
||||
this.movableAreaStyle = {
|
||||
width: this.windowWidth + 'px',
|
||||
height: this.windowHeight + 'px',
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
@@ -99,11 +131,36 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
afterHangup() {
|
||||
clearInterval(this.interval)
|
||||
const targetId = this.targetId
|
||||
const sentStatus = 30
|
||||
const messageContent = {
|
||||
objectName: 'RC:InfoNtf',
|
||||
userInfo: this.$store.getters.sender,
|
||||
message: JSON.stringify({
|
||||
mediaType: this.mediaType,
|
||||
connected: this.connected,
|
||||
duration: this.duration
|
||||
})
|
||||
}
|
||||
const sentTime = 0
|
||||
if (this.isCall) {
|
||||
IMLib.insertOutgoingMessage(1, targetId, sentStatus, messageContent, sentTime)
|
||||
} else {
|
||||
IMLib.insertIncomingMessage(1, targetId, targetId, sentStatus, messageContent, sentTime)
|
||||
}
|
||||
uni.$emit('onReceiveMessage_' + this.targetId, {
|
||||
targetId: this.targetId
|
||||
})
|
||||
},
|
||||
changeMicrophone() {
|
||||
this.micOff = !this.micOff
|
||||
CallLib.enableMicrophone(this.micStatus)
|
||||
this.micStatus = !this.micStatus
|
||||
},
|
||||
changeSpeaker() {
|
||||
this.volumeOff = !this.volumeOff
|
||||
CallLib.enableSpeaker(this.speStatus)
|
||||
this.speStatus = !this.speStatus
|
||||
},
|
||||
@@ -123,9 +180,30 @@
|
||||
CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
|
||||
}, 200)
|
||||
}
|
||||
this.interval = setInterval(() => {
|
||||
this.duration++
|
||||
}, 1000)
|
||||
},
|
||||
// 切换主屏显示人
|
||||
changeMine() {
|
||||
// if (this.isCall) {
|
||||
// const session = CallLib.getCurrentCallSession()
|
||||
// setTimeout(() => {
|
||||
// CallLib.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false)
|
||||
// CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
|
||||
// }, 200)
|
||||
// } else {
|
||||
// const session = CallLib.getCurrentCallSession()
|
||||
// setTimeout(() => {
|
||||
// CallLib.setVideoView(session.targetId, this.$refs.smallVideoView.ref, 0, true)
|
||||
// CallLib.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0, false)
|
||||
// }, 200)
|
||||
// }
|
||||
// this.isCall = !this.isCall
|
||||
},
|
||||
hangup() {
|
||||
CallLib.hangup()
|
||||
this.afterHangup()
|
||||
this.stopRing()
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -171,23 +249,33 @@
|
||||
position: relative;
|
||||
|
||||
.video {
|
||||
.bigVideoView {
|
||||
background: #000;
|
||||
}
|
||||
.movableArea {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
|
||||
.smallVideoView {
|
||||
background: blue;
|
||||
position: absolute;
|
||||
right: 100rpx;
|
||||
top: 100rpx;
|
||||
.movableView {
|
||||
width: 180rpx;
|
||||
height: 320rpx;
|
||||
position: relative;
|
||||
|
||||
.smallVideoView {
|
||||
width: 180rpx;
|
||||
height: 320rpx;
|
||||
background-color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bigVideoView {
|
||||
background-color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
flex: 1;
|
||||
background: #666;
|
||||
width: 750rpx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
@@ -226,10 +314,6 @@
|
||||
.btn {
|
||||
align-items: center;
|
||||
|
||||
&.hangup {
|
||||
background: $text-price;
|
||||
}
|
||||
|
||||
.icon {
|
||||
background: $main-color;
|
||||
width: 132rpx;
|
||||
@@ -238,6 +322,10 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&.hangup {
|
||||
background-color: $text-price;
|
||||
}
|
||||
}
|
||||
|
||||
.text {
|
||||
|
||||
@@ -4,43 +4,29 @@
|
||||
<!-- chat -->
|
||||
<view class="body">
|
||||
<view class="scroll">
|
||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||
<view :class="['cell-item', item.messageDirection == 1 ? 'right' : 'left']">
|
||||
<u-avatar class="avatar" size="40" shape="square"
|
||||
@click="showUser(item.senderUserId, item.messageDirection)"
|
||||
:src="contact(item.senderUserId).portraitUrl" />
|
||||
<view class="msg">
|
||||
<show-voice v-if="item.objectName === 'RC:HQVCMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" />
|
||||
<show-image v-if="item.objectName === 'RC:ImgMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" />
|
||||
<show-text v-if="item.objectName === 'RC:TxtMsg'" :guest="item.messageDirection == 1"
|
||||
:msg="item.content" />
|
||||
<view class="state" v-if="item.messageDirection == 1">
|
||||
<text
|
||||
:class="item.sentStatus === 50?'state-text':'state-text-active'">{{ item.sentStatus == 50 ? '已读': '未读'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||
<show-message-cell :message="message" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||
import im from '@/utils/im/index.js'
|
||||
import showVoice from '../components/showVoice'
|
||||
import showImage from '../components/showImage'
|
||||
import showText from '../components/showText'
|
||||
import sentMessageBar from '../components/sentMessageBar'
|
||||
import showMessageCell from '../components/showMessageCell'
|
||||
import utils from '@/utils/index.js'
|
||||
import imBase from '../mixins/imBase.js'
|
||||
|
||||
export default {
|
||||
mixins: [
|
||||
imBase
|
||||
],
|
||||
components: {
|
||||
sentMessageBar,
|
||||
showVoice,
|
||||
showImage,
|
||||
showText
|
||||
showMessageCell
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -63,11 +49,6 @@
|
||||
sentTime: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
contact() {
|
||||
return function(targetId) {
|
||||
return this.$store.getters.contactInfo(targetId)
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -78,6 +59,10 @@
|
||||
})
|
||||
// 获取消息列表
|
||||
this.getMessageList()
|
||||
// 监听新消息
|
||||
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||
this.getNewMessage()
|
||||
})
|
||||
// 监听消息已读状态
|
||||
uni.$on('onReadReceiptReceived', (data) => {
|
||||
if (data.targetId == this.targetId) {
|
||||
@@ -90,14 +75,30 @@
|
||||
})
|
||||
}
|
||||
})
|
||||
// 监听收到新消息,判断是否是当前会话,更新会话内容
|
||||
uni.$on('onReceiveMessage', (msg) => {
|
||||
if (msg.targetId == this.targetId) {
|
||||
this.getNewMessage()
|
||||
uni.$on('onRecallMessage_' + this.targetId, (message) => {
|
||||
this.messages = this.messages.map(item => {
|
||||
if (message.messageId == item.messageId) {
|
||||
return message
|
||||
} else {
|
||||
return item
|
||||
}
|
||||
})
|
||||
})
|
||||
uni.$once('onUserDelete_' + this.targetId, () => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '好友关系已解除'
|
||||
})
|
||||
uni.switchTab({
|
||||
url: '/pages/im/index'
|
||||
})
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('onUserDelete_' + this.targetId)
|
||||
uni.$off('onReceiveMessage_' + this.targetId)
|
||||
uni.$off('onRecallMessage_' + this.targetId)
|
||||
uni.$off('onRecallMessage')
|
||||
uni.$off('onReadReceiptReceived')
|
||||
},
|
||||
methods: {
|
||||
@@ -126,13 +127,6 @@
|
||||
this.scrollBottom()
|
||||
})
|
||||
},
|
||||
// 展示好友信息, type 1 是自己, 2 是对方
|
||||
showUser(targetId, type) {
|
||||
uni.navigateTo({
|
||||
url: type === 1 ? '/pages/im/friends/mine?targetId=' + targetId :
|
||||
'/pages/im/friends/info?targetId=' + targetId
|
||||
})
|
||||
},
|
||||
// 滚动到底部
|
||||
scrollBottom(type) {
|
||||
if (this.latestMessage) {
|
||||
@@ -170,17 +164,18 @@
|
||||
justify-content: flex-end;
|
||||
|
||||
.cell {
|
||||
padding: 10rpx 30rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
|
||||
.time {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.cell-item {
|
||||
display: flex;
|
||||
width: 690rpx;
|
||||
width: 710rpx;
|
||||
justify-content: flex-start;
|
||||
|
||||
&.left {
|
||||
@@ -189,23 +184,14 @@
|
||||
|
||||
&.right {
|
||||
flex-direction: row-reverse;
|
||||
|
||||
.state {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
|
||||
.msg {
|
||||
margin: 0 20rpx;
|
||||
.state {
|
||||
padding-top: 10rpx;
|
||||
.state-text {
|
||||
font-size: $title-size-m - 2;
|
||||
color: rgba($color: $main-color, $alpha: 0.3)
|
||||
}
|
||||
.state-text-active {
|
||||
font-size: $title-size-m - 2;
|
||||
color: #cecece;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class="info-box">
|
||||
<image src="@/static/user/user_back.png" mode="aspectFill" />
|
||||
<view class="user-flex">
|
||||
<image class="cover" @click="$Router.push({ name: 'Setting' })"
|
||||
<image class="cover" @click="goSetting"
|
||||
:src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill" />
|
||||
<view class="user-content">
|
||||
<block v-if="$store.state.token != ''">
|
||||
@@ -234,6 +234,11 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
goSetting(){
|
||||
if (this.isLogin()) {
|
||||
this.$Router.push({ name: 'Setting' })
|
||||
}
|
||||
},
|
||||
// 检查登录
|
||||
isLogin() {
|
||||
if (this.$store.state.token === '') {
|
||||
|
||||
BIN
static/.DS_Store
vendored
BIN
static/.DS_Store
vendored
Binary file not shown.
BIN
static/user/cover-s.png
Normal file
BIN
static/user/cover-s.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -76,7 +76,8 @@ export default {
|
||||
name: contactInfo.name,
|
||||
hash: contactInfo.hash,
|
||||
portraitUrl: contactInfo.portraitUrl,
|
||||
localAvatar: savedFilePath
|
||||
localAvatar: savedFilePath,
|
||||
type: contactInfo.type
|
||||
}
|
||||
model.update('targetId="' + contactInfo.targetId + '"', info, (err,
|
||||
res) => {
|
||||
@@ -90,7 +91,8 @@ export default {
|
||||
name: contactInfo.name,
|
||||
hash: contactInfo.hash,
|
||||
portraitUrl: contactInfo.portraitUrl,
|
||||
localAvatar: result[0].localAvatar
|
||||
localAvatar: result[0].localAvatar,
|
||||
type: contactInfo.type
|
||||
}
|
||||
model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => {
|
||||
console.log('UPDATE NAME, ERR', err, info);
|
||||
@@ -117,7 +119,8 @@ export default {
|
||||
name: contactInfo.name,
|
||||
hash: contactInfo.hash,
|
||||
portraitUrl: contactInfo.portraitUrl,
|
||||
localAvatar: savedFilePath
|
||||
localAvatar: savedFilePath,
|
||||
type: contactInfo.type
|
||||
}
|
||||
model.insert(info, (err, res) => {})
|
||||
// 保存头像后,更新信息
|
||||
@@ -130,7 +133,8 @@ export default {
|
||||
name: contactInfo.name,
|
||||
hash: contactInfo.hash,
|
||||
portraitUrl: contactInfo.portraitUrl,
|
||||
localAvatar: ''
|
||||
localAvatar: '',
|
||||
type: contactInfo.type
|
||||
}
|
||||
model.insert(info, (err, res) => {})
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ const connect = (token, userInfo, callback) => {
|
||||
// 设置未读消息数量
|
||||
setNotifyBadge()
|
||||
// 首次运行获取好友列表
|
||||
const FK = 'ZHKD_' + userInfo.targetId
|
||||
const FK = 'ZH_V_' + userInfo.targetId
|
||||
|
||||
uni.getStorage({
|
||||
key: FK,
|
||||
|
||||
@@ -20,7 +20,30 @@ const onReceiveMessage = (message) => {
|
||||
}
|
||||
})
|
||||
im.setNotifyBadge()
|
||||
// 发布全局事件,有新消息,刷新会话列表
|
||||
uni.$emit('onReceiveMessage', message)
|
||||
// 这个是为了更新消息列表页的
|
||||
uni.$emit('onReceiveMessage_' + message.targetId, message)
|
||||
}
|
||||
|
||||
// 检测联系人信息,不存在的时候,从服务端获取
|
||||
const checkContactExists = (message) => {
|
||||
if (!store.getters.contactIsExist(message.targetId)) {
|
||||
getUserInfo(message.targetId).then(res => {
|
||||
console.log('targetId', res);
|
||||
store.dispatch('initContact', res)
|
||||
}).catch(err => {
|
||||
console.error('getUserInfo ERR', err)
|
||||
})
|
||||
}
|
||||
if (!store.getters.contactIsExist(message.senderUserId)) {
|
||||
getUserInfo(message.senderUserId).then(res => {
|
||||
console.log('senderUserId', message.senderUserId, res);
|
||||
store.dispatch('initContact', res)
|
||||
}).catch(err => {
|
||||
console.error('getUserInfo ERR', err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 允许通知的消息类型,触发更新消息列表操作,提示音
|
||||
@@ -32,66 +55,115 @@ const notifyMsgTypes = [
|
||||
IMLib.ObjectName.Location,
|
||||
IMLib.ObjectName.Voice,
|
||||
IMLib.ObjectName.HQVoice,
|
||||
IMLib.ObjectName.Sight,
|
||||
IMLib.ObjectName.Text,
|
||||
IMLib.ObjectName.Text,
|
||||
IMLib.ObjectName.Text
|
||||
IMLib.ObjectName.Sight
|
||||
]
|
||||
|
||||
const imLibListeners = () => {
|
||||
// 添加连接状态监听函数
|
||||
IMLib.addConnectionStatusListener((res) => {
|
||||
console.log('连接状态监听', res.data.status)
|
||||
console.error('连接状态监听', res.data.status)
|
||||
uni.$emit('onConnectionStatusChange', res.data.status)
|
||||
})
|
||||
// 添加消息监听函数
|
||||
IMLib.addReceiveMessageListener((res) => {
|
||||
const message = res.data.message
|
||||
console.error('[收到消息]', message)
|
||||
checkContactExists(message)
|
||||
if (utils.inArray(message.objectName, notifyMsgTypes)) {
|
||||
if (!store.getters.contactIsExist(message.targetId)) {
|
||||
getUserInfo(message.targetId).then(res => {
|
||||
store.dispatch('initContact', res)
|
||||
}).catch(err => {
|
||||
console.error('getUserInfo ERR', err)
|
||||
})
|
||||
}
|
||||
if (!store.getters.contactIsExist(message.senderUserId)) {
|
||||
getUserInfo(message.senderUserId).then(res => {
|
||||
store.dispatch('initContact', res)
|
||||
}).catch(err => {
|
||||
console.error('getUserInfo ERR', err)
|
||||
})
|
||||
}
|
||||
onReceiveMessage(message)
|
||||
} else if (message.objectName === IMLib.ObjectName.ProfileNotification) {
|
||||
// 更新会话信息
|
||||
uni.$emit('onUpdateProfile_' + message.targetId)
|
||||
// 更新联系人信息
|
||||
store.dispatch('updateContact', JSON.parse(message.content.data))
|
||||
// 调用完更新之后,删除这条消息
|
||||
IMLib.deleteMessagesByIds([message.messageId])
|
||||
} else if (message.objectName === IMLib.ObjectName.ContactNotification) {
|
||||
console.error('触发一个新好友的通知事件', message);
|
||||
// 触发一个新好友的通知事件
|
||||
uni.$emit('onContactNotification', message)
|
||||
if (message.content.operation === 'Request') {
|
||||
// 触发一个新好友的通知事件,【会话列表,通讯录,新朋友】页面
|
||||
uni.$emit('onNewContactConversation', message)
|
||||
uni.$emit('onNewContactFriends', message)
|
||||
uni.$emit('onNewContactPendings', message)
|
||||
} else if (message.content.operation === 'Delete') {
|
||||
IMLib.cleanHistoryMessages(1, message.targetId, message.sentTime, false)
|
||||
// 解散了就删了吧
|
||||
IMLib.removeConversation(1, message.targetId)
|
||||
// 刷新会话列表
|
||||
uni.$emit('onUserDelete_' + message.targetId)
|
||||
uni.$emit('onReceiveMessage', message)
|
||||
}
|
||||
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
||||
// 解散群
|
||||
if (message.content.operation === 'Dismiss') {
|
||||
IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime,
|
||||
IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime,
|
||||
false)
|
||||
// 解散了就删了吧
|
||||
IMLib.removeConversation(message.conversationType, message.targetId)
|
||||
uni.$emit('onGroupDismiss', message.targetId)
|
||||
IMLib.removeConversation(3, message.targetId)
|
||||
// 发布群解散的消息
|
||||
uni.$emit('onGroupDismiss')
|
||||
uni.$emit('onGroupDismiss_' + message.targetId)
|
||||
} else if (message.content.operation === 'REMOVE') {
|
||||
// 要判断是否当前用户,然后把当前用户踢出到主页去, 删除聊天记录,会话列表
|
||||
if (message.content.extra == store.getters.sender.userId) {
|
||||
IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime,
|
||||
false)
|
||||
// 解散了就删了吧
|
||||
IMLib.removeConversation(3, message.targetId)
|
||||
// 为了更新群列表
|
||||
uni.$emit('onGroupDismiss')
|
||||
uni.$emit('onGroupRemoveYou_' + message.targetId)
|
||||
}
|
||||
uni.$emit('onReceiveMessage_' + message.targetId, message)
|
||||
// 这个是为了更新消息列表页的
|
||||
}
|
||||
// 触发刷新会话列表
|
||||
uni.$emit('onReceiveMessage', message)
|
||||
}
|
||||
})
|
||||
|
||||
// 监听消息回执
|
||||
// 监听私聊消息已读回执
|
||||
IMLib.addReadReceiptReceivedListener(({
|
||||
data
|
||||
}) => {
|
||||
console.error("监听私聊消息已读回执: ", data);
|
||||
uni.$emit('onReadReceiptReceived', data)
|
||||
})
|
||||
// 监听消息撤回操作
|
||||
IMLib.addRecallMessageListener(({
|
||||
data
|
||||
}) => {
|
||||
IMLib.getMessage(data.messageId, ({
|
||||
message
|
||||
}) => {
|
||||
console.error("消息撤回: ", message);
|
||||
im.setNotifyBadge()
|
||||
uni.$emit('onReceiveMessage', message)
|
||||
uni.$emit('onRecallMessage_' + message.targetId, message)
|
||||
})
|
||||
})
|
||||
// 监听需要群聊消息回执
|
||||
IMLib.addReceiptRequestListener(({
|
||||
data
|
||||
}) => {
|
||||
uni.$emit('onReceiptRequest', data)
|
||||
})
|
||||
// 群消息已读的回执
|
||||
IMLib.addReceiptResponseListener(({
|
||||
data
|
||||
}) => {
|
||||
// 获取本地消息
|
||||
IMLib.getMessageByUId(data.messageUId, ({
|
||||
message
|
||||
}) => {
|
||||
const readers = Object.keys(data.users).length
|
||||
const extra = JSON.stringify({
|
||||
readers
|
||||
})
|
||||
// 在消息的扩展数据中,设置已读数量
|
||||
IMLib.setMessageExtra(message.messageId, extra, (result) => {
|
||||
message.extra = extra
|
||||
uni.$emit('onReceiptResponse', message)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const callLibListeners = () => {
|
||||
@@ -100,7 +172,7 @@ const callLibListeners = () => {
|
||||
CallLib.onCallReceived(({
|
||||
data
|
||||
}) => {
|
||||
console.log('onCallReceived');
|
||||
console.error('onCallReceived');
|
||||
uni.navigateTo({
|
||||
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
|
||||
data.mediaType
|
||||
@@ -112,27 +184,27 @@ const callLibListeners = () => {
|
||||
})
|
||||
// 外呼
|
||||
CallLib.onCallOutgoing((res) => {
|
||||
console.log('onCallOutgoing', res);
|
||||
console.error('onCallOutgoing', res);
|
||||
uni.$emit('onCallOutgoing')
|
||||
})
|
||||
// 远端响铃
|
||||
CallLib.onRemoteUserRinging((res) => {
|
||||
console.log('onRemoteUserRinging', res);
|
||||
console.error('onRemoteUserRinging', res);
|
||||
uni.$emit('onRemoteUserRinging')
|
||||
})
|
||||
// 远端加入
|
||||
CallLib.onRemoteUserJoined((res) => {
|
||||
console.log('远端接听');
|
||||
console.error('远端接听');
|
||||
uni.$emit('onRemoteUserJoined')
|
||||
})
|
||||
// 断开链接
|
||||
CallLib.onCallDisconnected((res) => {
|
||||
console.log('断开链接', res)
|
||||
console.error('断开链接', res)
|
||||
uni.$emit('onCallDisconnected')
|
||||
})
|
||||
// 远端挂断
|
||||
CallLib.onRemoteUserLeft((res) => {
|
||||
console.log('远端离开', res)
|
||||
console.error('远端离开', res)
|
||||
uni.$emit('onRemoteUserLeft')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
|
||||
'RC:SightMsg',
|
||||
'RC:ReferenceMsg',
|
||||
'RC:CombineMsg',
|
||||
'RC:GrpNtf'
|
||||
'RC:GrpNtf',
|
||||
'RC:InfoNtf',
|
||||
'RC:RcNtf'
|
||||
]
|
||||
|
||||
RongIMLib.getHistoryMessagesByTimestamp(
|
||||
@@ -59,18 +61,16 @@ const getPendingList = (callback, total) => {
|
||||
|
||||
// 群组申请列表,邀请列表
|
||||
const getGroupPendinglist = (targetId, callback) => {
|
||||
total = total || 100
|
||||
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], total, 0, (res) => {
|
||||
if (res.code === 0) {
|
||||
const pendings = res.conversations.filter((item) => {
|
||||
return item.targetId == targetId &&
|
||||
item.objectName == RongIMLib.ObjectName.ContactNotification &&
|
||||
item.latestMessage.operation === 'GroupPending'
|
||||
})
|
||||
const conversationType = RongIMLib.ConversationType.SYSTEM
|
||||
const objectNames = ['RC:ContactNtf']
|
||||
|
||||
callback(pendings)
|
||||
RongIMLib.getHistoryMessagesByTimestamp(conversationType, targetId, objectNames, 0, 1000, true,
|
||||
({
|
||||
messages
|
||||
}) => {
|
||||
callback(messages)
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +96,11 @@ const sentText = (conversationType, targetId, content, user, callback) => {
|
||||
messageId
|
||||
}) => {
|
||||
if (code === 0) {
|
||||
if (conversationType == 3) {
|
||||
RongIMLib.sendReadReceiptRequest(messageId, (res) => {
|
||||
console.log('发送回执请求', res);
|
||||
})
|
||||
}
|
||||
callback(messageId)
|
||||
} else {
|
||||
console.log('发送失败', msg);
|
||||
|
||||
@@ -13,6 +13,10 @@ const contactModel = usqlite.model('contacts', {
|
||||
type: String,
|
||||
unique: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
portraitUrl: String,
|
||||
localAvatar: String
|
||||
})
|
||||
|
||||
13
yarn.lock
13
yarn.lock
@@ -17,12 +17,7 @@ uni-simple-router@^2.0.7:
|
||||
resolved "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz"
|
||||
integrity sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==
|
||||
|
||||
uview-ui@^2.0.19:
|
||||
version "2.0.19"
|
||||
resolved "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz"
|
||||
integrity sha512-ddZiaP7R9wsUxMzAuhuXgh5OswgCm2lKuulTqjnRXFr0uUWsgL1iBifU3GbOwpwP0LtTHKJOo9rYv1LP0WXmzA==
|
||||
|
||||
vuex@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz"
|
||||
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==
|
||||
uview-ui@^2.0.27:
|
||||
version "2.0.27"
|
||||
resolved "https://registry.yarnpkg.com/uview-ui/-/uview-ui-2.0.27.tgz#1a7dde9c6246e851d768f3efd44b5fb26774a2e1"
|
||||
integrity sha512-fl35rlguNPfXnwNoVv0w4zS1blFFxxSPuGR1+9SbpFGC33aiTBaoFWs/4Fppj0foS/kDCqSWcJiymNmQjPBD4g==
|
||||
|
||||
Reference in New Issue
Block a user