Compare commits
95 Commits
1.0.11
...
3cd11c5863
| Author | SHA1 | Date | |
|---|---|---|---|
| 3cd11c5863 | |||
| f5da4e7a2c | |||
|
|
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({
|
getVersions({
|
||||||
platform: plus.os.name,
|
platform: plus.os.name,
|
||||||
version: plus.runtime.versionCode
|
version: plus.runtime.version
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.update) {
|
if (res.update) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ const getGroupUsers = (groupId, limit) => {
|
|||||||
url: 'im/groups/' + groupId + '/users?limit=' + limit
|
url: 'im/groups/' + groupId + '/users?limit=' + limit
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 公告列表
|
||||||
const getGroupAnnouncements = (groupId) => {
|
const getGroupAnnouncements = (groupId) => {
|
||||||
return request({
|
return request({
|
||||||
url: 'im/groups/' + groupId + '/announcements'
|
url: 'im/groups/' + groupId + '/announcements'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 创建公告
|
||||||
const createGroupAnnouncement = (groupId, content) => {
|
const createGroupAnnouncement = (groupId, content) => {
|
||||||
return request({
|
return request({
|
||||||
method: 'POST',
|
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) => {
|
const deleteGroupAnnouncement = (groupId, announcementId) => {
|
||||||
return request({
|
return request({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: 'im/groups/' + groupId + '/announcements/' + announcementId
|
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({
|
return request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: 'im/groups/' + groupId + '/invite',
|
url: 'im/groups/' + groupId + '/invite',
|
||||||
data: {
|
data: {
|
||||||
userIds
|
userIds: userIds,
|
||||||
|
allowIds: allowIds
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -267,19 +282,16 @@ const transferGroupOwner = (groupId, userId) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// //群成员待审核表 -- 废弃
|
|
||||||
// const getGroupMakeSure = (groupId) => {
|
// 通过审核验证群成员
|
||||||
// return request({
|
const groupMakeSure = (groupId, user) => {
|
||||||
// url:`im/groups/${groupId}/makesure`
|
return request({
|
||||||
// })
|
url: `im/groups/${groupId}/makesure/${user}`,
|
||||||
// }
|
method: 'POST'
|
||||||
// // 群成员审核通过
|
})
|
||||||
// const getGroupMakeSureAllow = (groupId, userId) => {
|
}
|
||||||
// return request({
|
|
||||||
// method: 'POST',
|
|
||||||
// url: 'im/groups/' + groupId + '/owner/' + userId
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getImToken,
|
getImToken,
|
||||||
@@ -300,8 +312,10 @@ export {
|
|||||||
getGroupBase,
|
getGroupBase,
|
||||||
getGroupUsers,
|
getGroupUsers,
|
||||||
getGroupAnnouncements,
|
getGroupAnnouncements,
|
||||||
|
getGroupAnnouncement,
|
||||||
createGroupAnnouncement,
|
createGroupAnnouncement,
|
||||||
deleteGroupAnnouncement,
|
deleteGroupAnnouncement,
|
||||||
|
topGroupAnnouncement,
|
||||||
searchGroup,
|
searchGroup,
|
||||||
joinGroupPre,
|
joinGroupPre,
|
||||||
joinGroup,
|
joinGroup,
|
||||||
@@ -309,8 +323,8 @@ export {
|
|||||||
dismissGroup,
|
dismissGroup,
|
||||||
inviteGroupUser,
|
inviteGroupUser,
|
||||||
removeGroupUser,
|
removeGroupUser,
|
||||||
|
transferGroupOwner,
|
||||||
setGroupAdmin,
|
setGroupAdmin,
|
||||||
removeGroupAdmin,
|
removeGroupAdmin,
|
||||||
// transferGroupOwner, // -废弃待审核列表
|
groupMakeSure, // 通过审核
|
||||||
// getGroupMakeSure // -废弃待审核列表
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"name" : "ZH-HEALTH",
|
"name" : "ZH-HEALTH",
|
||||||
"appid" : "__UNI__C29473D",
|
"appid" : "__UNI__C29473D",
|
||||||
"description" : "ZH-HEALTH,您手上的健康管理专家",
|
"description" : "ZH-HEALTH,您手上的健康管理专家",
|
||||||
"versionName" : "1.0.10",
|
"versionName" : "1.0.16",
|
||||||
"versionCode" : 110,
|
"versionCode" : 100,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
@@ -24,7 +24,9 @@
|
|||||||
"SQLite" : {},
|
"SQLite" : {},
|
||||||
"VideoPlayer" : {},
|
"VideoPlayer" : {},
|
||||||
"Geolocation" : {},
|
"Geolocation" : {},
|
||||||
"Fingerprint" : {}
|
"Fingerprint" : {},
|
||||||
|
"Maps" : {},
|
||||||
|
"Push" : {}
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@@ -80,7 +82,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ad" : {},
|
"ad" : {},
|
||||||
"push" : {},
|
"push" : {
|
||||||
|
"unipush" : {}
|
||||||
|
},
|
||||||
"geolocation" : {
|
"geolocation" : {
|
||||||
"amap" : {
|
"amap" : {
|
||||||
"__platform__" : [ "android" ],
|
"__platform__" : [ "android" ],
|
||||||
@@ -90,6 +94,12 @@
|
|||||||
"system" : {
|
"system" : {
|
||||||
"__platform__" : [ "android" ]
|
"__platform__" : [ "android" ]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"maps" : {
|
||||||
|
"amap" : {
|
||||||
|
"appkey_ios" : "",
|
||||||
|
"appkey_android" : "05b7f32ca9c897c8b63c505d92cd654b"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"icons" : {
|
"icons" : {
|
||||||
|
|||||||
383
package-lock.json
generated
383
package-lock.json
generated
@@ -9,8 +9,6 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bitcore-lib": "^8.25.25",
|
|
||||||
"bitcore-mnemonic": "^8.25.25",
|
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"uni-read-pages": "^1.0.5",
|
"uni-read-pages": "^1.0.5",
|
||||||
"uni-simple-router": "^2.0.7",
|
"uni-simple-router": "^2.0.7",
|
||||||
@@ -19,171 +17,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {}
|
"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": {
|
"node_modules/moment": {
|
||||||
"version": "2.29.1",
|
"version": "2.29.1",
|
||||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||||
@@ -192,33 +25,6 @@
|
|||||||
"node": "*"
|
"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": {
|
"node_modules/uni-read-pages": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
|
"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",
|
"resolved": "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz",
|
||||||
"integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA=="
|
"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": {
|
"node_modules/uview-ui": {
|
||||||
"version": "2.0.19",
|
"version": "2.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
||||||
@@ -256,187 +54,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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": {
|
"moment": {
|
||||||
"version": "2.29.1",
|
"version": "2.29.1",
|
||||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
"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": {
|
"uni-read-pages": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
|
"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",
|
"resolved": "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz",
|
||||||
"integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA=="
|
"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": {
|
"uview-ui": {
|
||||||
"version": "2.0.19",
|
"version": "2.0.19",
|
||||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz",
|
||||||
|
|||||||
@@ -7,10 +7,8 @@
|
|||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"uni-read-pages": "^1.0.5",
|
"uni-read-pages": "^1.0.5",
|
||||||
"uni-simple-router": "^2.0.7",
|
"uni-simple-router": "^2.0.7",
|
||||||
"uview-ui": "^2.0.19",
|
"uview-ui": "^2.0.27"
|
||||||
"vuex": "^3.6.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
|
|||||||
13
pages.json
13
pages.json
@@ -373,19 +373,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/im/private/chat",
|
"path": "pages/im/private/chat",
|
||||||
"style": {
|
"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.
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<u-alert type="warning" v-if="connection != 0" :description="description" show-icon />
|
<u-alert type="warning" v-if="connection != 0" :description="description" show-icon />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
<view class="message--cell">
|
<view class="message--cell">
|
||||||
<view class="avatar">
|
<view class="avatar">
|
||||||
<u-badge max="99" shape="horn" absolute :offset="[-5, -8]" :value="item.unreadMessageCount" />
|
<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>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="name">{{ contact(item.targetId).name }} <text v-if="item.conversationType === 3"
|
<view class="name">
|
||||||
class='qun'>[群]</text></view>
|
{{ contact(item.targetId).name }}
|
||||||
|
<text v-if="item.conversationType === 3" class='group'>[群]</text>
|
||||||
|
</view>
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
||||||
</view>
|
</view>
|
||||||
<message-preview class="preview" :msg="item.latestMessage" :draft="item.draft"
|
<message-preview class="preview" :msg="item.latestMessage" :draft="item.draft"
|
||||||
@@ -18,8 +20,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import messagePreview from './messagePreview'
|
import messagePreview from './messagePreview'
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '../../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
item: {
|
item: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -28,16 +35,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
console.log(this.item);
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
components: {
|
||||||
messagePreview
|
messagePreview
|
||||||
}
|
}
|
||||||
@@ -51,6 +48,7 @@
|
|||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
padding-top: 5rpx;
|
||||||
|
|
||||||
.u-badge {
|
.u-badge {
|
||||||
z-index: 998;
|
z-index: 998;
|
||||||
@@ -62,10 +60,8 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
|
||||||
border-bottom-width: 0.5px !important;
|
border-bottom-width: 0.5px !important;
|
||||||
border-color: #f9f9f9 !important;
|
border-color: #eee !important;
|
||||||
border-bottom-style: solid;
|
border-bottom-style: solid;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
@@ -75,10 +71,8 @@
|
|||||||
.name {
|
.name {
|
||||||
font-size: $title-size + 2;
|
font-size: $title-size + 2;
|
||||||
color: #454545;
|
color: #454545;
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.qun {
|
.group {
|
||||||
color: $main-color;
|
color: $main-color;
|
||||||
font-size: $title-size-m - 4;
|
font-size: $title-size-m - 4;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
@@ -22,15 +22,18 @@
|
|||||||
<view class="preview" v-if="msg.objectName=='RC:LBSMsg'">
|
<view class="preview" v-if="msg.objectName=='RC:LBSMsg'">
|
||||||
<text v-if="conversationType == 3">{{ user.name }}:</text>[位置]
|
<text v-if="conversationType == 3">{{ user.name }}:</text>[位置]
|
||||||
</view>
|
</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>[语音通话]
|
<text v-if="conversationType == 3">{{ user.name }}:</text>[语音通话]
|
||||||
</view>
|
</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>[视频通话]
|
<text v-if="conversationType == 3">{{ user.name }}:</text>[视频通话]
|
||||||
</view>
|
</view>
|
||||||
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">
|
<view class="preview" v-if="msg.objectName=='RC:GrpNtf'">
|
||||||
[{{ msg.message }}]
|
[{{ msg.message }}]
|
||||||
</view>
|
</view>
|
||||||
|
<view class="preview" v-if="msg.objectName=='RC:RcNtf'">
|
||||||
|
<text v-if="conversationType == 3">{{ user.name }}:</text> 撤回了一条消息
|
||||||
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view v-for="(item, index) in conversations" :key="index" :class="['message', { 'is-top': item.isTop }]"
|
<view class="shade" @click="hidePop" @touchmove="hidePop" v-show="showPop">
|
||||||
:data-item="item" @longpress="onLongPress" @click="toDetail(item)">
|
|
||||||
<message-cell :item="item" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="shade" @click="hidePop" v-show="showPop">
|
|
||||||
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
||||||
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu" :data-index="index">
|
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu(index)">
|
||||||
{{item}}
|
{{ item }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
import messageCell from './messageCell'
|
import messageCell from './conversation/messageCell'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -66,9 +66,7 @@
|
|||||||
}, 250)
|
}, 250)
|
||||||
},
|
},
|
||||||
// 点击会话功能菜单
|
// 点击会话功能菜单
|
||||||
pickerMenu(e) {
|
pickerMenu(index) {
|
||||||
const index = Number(e.currentTarget.dataset.index)
|
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
RongIMLib.setConversationToTop(this.pickedItem.conversationType, this.pickedItem.targetId, !this
|
RongIMLib.setConversationToTop(this.pickedItem.conversationType, this.pickedItem.targetId, !this
|
||||||
.pickedItem.isTop)
|
.pickedItem.isTop)
|
||||||
@@ -132,6 +130,10 @@
|
|||||||
&.is-top {
|
&.is-top {
|
||||||
background: $window-color;
|
background: $window-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
background: #F8FAFF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 遮罩 */
|
/* 遮罩 */
|
||||||
@@ -139,8 +141,10 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
z-index: 999;
|
||||||
|
|
||||||
.pop {
|
.pop {
|
||||||
|
border-radius: 10rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 101;
|
z-index: 101;
|
||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="apply--cell">
|
<view class="apply--cell">
|
||||||
<view class="avatar">
|
<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>
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name"> {{ user.name }}</view>
|
<view class="name"> {{ user.name }}</view>
|
||||||
@@ -20,8 +20,12 @@
|
|||||||
resolveFriend,
|
resolveFriend,
|
||||||
rejectFriend
|
rejectFriend
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
message: {
|
message: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -36,7 +40,6 @@
|
|||||||
methods: {
|
methods: {
|
||||||
resolve() {
|
resolve() {
|
||||||
resolveFriend(this.message.sourceUserId).then(res => {
|
resolveFriend(this.message.sourceUserId).then(res => {
|
||||||
this.clearMessages()
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '通过好友申请'
|
title: '通过好友申请'
|
||||||
@@ -47,6 +50,8 @@
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: err.message
|
title: err.message
|
||||||
})
|
})
|
||||||
|
}).finally(() => {
|
||||||
|
this.clearMessages()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
reject() {
|
reject() {
|
||||||
@@ -70,7 +75,9 @@
|
|||||||
clearMessages() {
|
clearMessages() {
|
||||||
RongIMLib.deleteMessages(RongIMLib.ConversationType.SYSTEM, this.message.sourceUserId)
|
RongIMLib.deleteMessages(RongIMLib.ConversationType.SYSTEM, this.message.sourceUserId)
|
||||||
this.$emit('success')
|
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">
|
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
||||||
<view class="lists">
|
<view class="lists">
|
||||||
<view class="" style="width: 100rpx;height: 100rpx;">
|
<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>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
<span v-if="isAgree" @click="action('agree', item)">通过</span>
|
<span v-if="isAgree" @click="action('agree', item)">通过</span>
|
||||||
<span v-if="isAgree" @click="action('reject', item)">拒绝</span>
|
<span v-if="isAgree" @click="action('reject', item)">拒绝</span>
|
||||||
<span v-if="isApply && !item.is_friend" @click="action('apply', 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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -23,104 +24,124 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
import imBase from '../mixins/imBase.js'
|
||||||
name: 'friend-apply-reject-agree',
|
|
||||||
props: {
|
export default {
|
||||||
lists: {
|
mixins:[
|
||||||
type: Array,
|
imBase
|
||||||
default: []
|
],
|
||||||
},
|
name: 'friend-apply-reject-agree',
|
||||||
isAgree: {
|
props: {
|
||||||
type: Boolean,
|
lists: {
|
||||||
default: false
|
type: Array,
|
||||||
},
|
default: []
|
||||||
isReject: {
|
},
|
||||||
type: Boolean,
|
isAgree: {
|
||||||
default: false
|
type: Boolean,
|
||||||
},
|
default: false
|
||||||
isApply: {
|
},
|
||||||
type: Boolean,
|
isReject: {
|
||||||
default: false
|
type: Boolean,
|
||||||
}
|
default: false
|
||||||
},
|
},
|
||||||
created() {
|
isApply: {
|
||||||
console.log(this.lists);
|
type: Boolean,
|
||||||
},
|
default: false
|
||||||
methods: {
|
}
|
||||||
action(type, item) {
|
},
|
||||||
if (type === 'isFriend') {
|
created() {
|
||||||
// ,后期可以跳转到信息介绍页面,先留在这里
|
console.log(this.lists);
|
||||||
return uni.showToast({ title: '已是好友,无需重复添加', icon: 'none', duration:2000});
|
},
|
||||||
|
methods: {
|
||||||
|
action(type, item) {
|
||||||
|
if (type === 'isFriend') {
|
||||||
|
// ,后期可以跳转到信息介绍页面,先留在这里
|
||||||
|
return uni.showToast({
|
||||||
|
title: '已是好友,无需重复添加',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.$emit('action', {
|
||||||
|
type,
|
||||||
|
item
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.$emit('action', { type, item });
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.lists {
|
.lists {
|
||||||
padding: 0 $padding;
|
padding: 0 $padding;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-start;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-size: $title-size;
|
|
||||||
color: $text-gray;
|
|
||||||
|
|
||||||
.cover {
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
.right {
|
|
||||||
width: 570rpx;
|
|
||||||
margin-left: $margin - 10;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: flex-start;
|
||||||
padding: $padding 0;
|
box-sizing: border-box;
|
||||||
border-bottom: solid 1rpx #f9f9f9;
|
font-size: $title-size;
|
||||||
.title {
|
color: $text-gray;
|
||||||
width: 370rpx;
|
|
||||||
.name {
|
.cover {
|
||||||
width: 100%;
|
background-color: #ffffff;
|
||||||
color: $text-color;
|
|
||||||
font-size: $title-size + 2;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.des {
|
|
||||||
width: 100%;
|
|
||||||
flex: 1;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
font-size: $title-size-m;
|
|
||||||
margin-top: $margin - 10;
|
|
||||||
color: $text-gray-m;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.agress-btn {
|
|
||||||
|
.right {
|
||||||
|
width: 570rpx;
|
||||||
|
margin-left: $margin - 10;
|
||||||
display: flex;
|
display: flex;
|
||||||
color: #fff;
|
flex-direction: row;
|
||||||
font-size: $title-size-m;
|
align-items: center;
|
||||||
span {
|
justify-content: space-between;
|
||||||
display: inline-block;
|
padding: $padding 0;
|
||||||
padding: 6rpx 14rpx;
|
border-bottom: solid 1rpx #f9f9f9;
|
||||||
background-color: $text-price;
|
|
||||||
border-radius: 10rpx;
|
.title {
|
||||||
|
width: 370rpx;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
width: 100%;
|
||||||
|
color: $text-color;
|
||||||
|
font-size: $title-size + 2;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.des {
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
margin-top: $margin - 10;
|
||||||
|
color: $text-gray-m;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
span:nth-child(1) {
|
|
||||||
background-color: $main-color;
|
.agress-btn {
|
||||||
margin-right: 10rpx;
|
display: flex;
|
||||||
}
|
color: #fff;
|
||||||
.isFri {
|
font-size: $title-size-m;
|
||||||
background-color: #f9f9f9 !important;
|
|
||||||
color: #666;
|
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>
|
</style>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
<block v-for="(item, index) in lists" v-if="lists.length > 0" :key="index">
|
||||||
<view class="lists">
|
<view class="lists">
|
||||||
<view class="" style="width: 100rpx;height: 100rpx;">
|
<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>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
@@ -21,7 +21,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
name: 'friend-apply-reject-agree',
|
name: 'friend-apply-reject-agree',
|
||||||
props: {
|
props: {
|
||||||
lists: {
|
lists: {
|
||||||
|
|||||||
@@ -4,14 +4,16 @@
|
|||||||
<view :class="['user', {'active': item.targetId === currentUser.targetId}]" @longpress="showAction(item)"
|
<view :class="['user', {'active': item.targetId === currentUser.targetId}]" @longpress="showAction(item)"
|
||||||
v-for="(item, index) in users" :key="index" @click="toUser(item)">
|
v-for="(item, index) in users" :key="index" @click="toUser(item)">
|
||||||
<view class="avatar">
|
<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="admin" v-if="item.is_admin === 1">管理</view>
|
||||||
<view class="owner" v-if="item.is_admin === 2">群主</view>
|
<view class="owner" v-if="item.is_admin === 2">群主</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="name">{{ item.name }}</view>
|
<view class="name">{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="user" v-if="isAdmin">
|
<view class="user" v-if="canInvite">
|
||||||
<u-avatar @click="inviteUser" :size="avatarSize" shape="square" icon="plus" bgColor="#f9f9f9" color="#c7c7c7" />
|
<u-avatar @click="inviteUser" :size="avatarSize" shape="square" icon="plus" bgColor="#f9f9f9"
|
||||||
|
color="#c7c7c7" />
|
||||||
<view class="name">邀请好友</view>
|
<view class="name">邀请好友</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -36,8 +38,12 @@
|
|||||||
transferGroupOwner
|
transferGroupOwner
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
targetId: {
|
targetId: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -53,26 +59,20 @@
|
|||||||
users: [],
|
users: [],
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
isAdmin: false,
|
isAdmin: false,
|
||||||
|
canInvite: false, // 是否可以开启邀请
|
||||||
adminUid: 0,
|
adminUid: 0,
|
||||||
members: 0,
|
members: 0,
|
||||||
actionShow: false,
|
actionShow: false,
|
||||||
actionMap: [],
|
actionMap: [],
|
||||||
actionTitle: '',
|
actionTitle: '',
|
||||||
currentUser: {},
|
currentUser: {},
|
||||||
avatarSize: 45,
|
avatarSize: 40,
|
||||||
labelSize: 14,
|
labelSize: 14,
|
||||||
iconSize: 14
|
iconSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
this.avatarSize = utils.rpx2px(90)
|
this.avatarSize = utils.rpx2px(84)
|
||||||
this.labelSize = utils.rpx2px(24)
|
this.labelSize = utils.rpx2px(24)
|
||||||
this.iconSize = utils.rpx2px(26)
|
this.iconSize = utils.rpx2px(26)
|
||||||
},
|
},
|
||||||
@@ -92,6 +92,7 @@
|
|||||||
this.isAdmin = res.is_admin
|
this.isAdmin = res.is_admin
|
||||||
this.adminUid = res.user_id
|
this.adminUid = res.user_id
|
||||||
this.members = res.members
|
this.members = res.members
|
||||||
|
this.canInvite = res.can_invite
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initUsers() {
|
initUsers() {
|
||||||
@@ -104,6 +105,9 @@
|
|||||||
this.actionShow = false
|
this.actionShow = false
|
||||||
},
|
},
|
||||||
showAction(item) {
|
showAction(item) {
|
||||||
|
if (item.is_admin == 2) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.currentUser = item
|
this.currentUser = item
|
||||||
this.actionTitle = item.name
|
this.actionTitle = item.name
|
||||||
// 只有管理员以上才会弹窗
|
// 只有管理员以上才会弹窗
|
||||||
@@ -271,8 +275,7 @@
|
|||||||
.avatar {
|
.avatar {
|
||||||
border-radius: 0 8rpx 0 0;
|
border-radius: 0 8rpx 0 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 90rpx;
|
width: 84rpx;
|
||||||
height: 90rpx;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
.admin {
|
.admin {
|
||||||
|
|||||||
@@ -33,9 +33,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import im from '@/utils/im/index.js'
|
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 {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
callActions: [{
|
callActions: [{
|
||||||
@@ -64,15 +67,11 @@
|
|||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
sender() {
|
|
||||||
return this.$store.getters.sender
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
singleCall(e) {
|
singleCall(e) {
|
||||||
uni.navigateTo({
|
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) {
|
onPopupsItem(type) {
|
||||||
@@ -144,6 +143,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
width: 150rpx;
|
width: 150rpx;
|
||||||
margin: 15rpx;
|
margin: 15rpx;
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="sent--text">
|
<view class="sent--text">
|
||||||
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState" v-model="inputTxt" confirm-type="send"
|
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState"
|
||||||
@confirm="sent" cursor-spacing="10" />
|
v-model="inputTxt" confirm-type="send" @confirm="sent" cursor-spacing="10" />
|
||||||
<!-- <button class="button" size="mini" :disabled="disabled" @click="demo">{{focusState ? '失焦': '聚焦'}}</button> -->
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
import imBase from '../../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
props: {
|
props: {
|
||||||
conversationType: {
|
conversationType: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -19,21 +22,14 @@
|
|||||||
targetId: {
|
targetId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
|
||||||
inputTxt: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.inputTxt.length === 0
|
return this.inputTxt.length === 0
|
||||||
},
|
|
||||||
sender() {
|
|
||||||
return this.$store.getters.sender
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
mounted() {
|
||||||
RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({
|
RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({
|
||||||
draft
|
draft
|
||||||
}) => {
|
}) => {
|
||||||
@@ -41,31 +37,25 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt, (res) => {
|
// 保存草稿
|
||||||
console.log('销毁组件之前,保存草稿信息,但是没有执行', res);
|
RongIMLib.saveTextMessageDraft(this.conversationType, this.targetId, this.inputTxt)
|
||||||
})
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
focusState: false,
|
focusState: false,
|
||||||
|
inputTxt: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 发送文本消息
|
|
||||||
sent() {
|
sent() {
|
||||||
if (!this.disabled) {
|
if (!this.disabled) {
|
||||||
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
|
||||||
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
|
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
|
||||||
|
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
this.inputTxt = ''
|
this.inputTxt = ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
demo(){
|
|
||||||
console.log(this.focusState)
|
|
||||||
|
|
||||||
this.focusState = !this.focusState
|
|
||||||
},
|
|
||||||
focus() {
|
focus() {
|
||||||
this.$emit('focus')
|
this.$emit('focus')
|
||||||
},
|
},
|
||||||
@@ -82,11 +72,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
background: #F3F6FB;
|
background: #F3F6FB;
|
||||||
height: 70rpx;
|
height: 70rpx;
|
||||||
width: 500rpx;
|
width: 460rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin-right: 15rpx;
|
margin-right: 15rpx;
|
||||||
padding: 0 20rpx;
|
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>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import sentText from '../components/sentText'
|
import sentText from './sent/sentText'
|
||||||
import sentVoice from '../components/sentVoice'
|
import sentVoice from './sent/sentVoice'
|
||||||
import sentPopups from '../components/sentPopups'
|
import sentPopups from './sent/sentPopups'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
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>
|
|
||||||
146
pages/im/components/showMessageCell.vue
Normal file
146
pages/im/components/showMessageCell.vue
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<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="messageAction($event, message)">
|
||||||
|
<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: {
|
||||||
|
messageAction(event, message) {
|
||||||
|
this.$emit('messageAction', {
|
||||||
|
event,
|
||||||
|
message
|
||||||
|
})
|
||||||
|
},
|
||||||
|
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: '旧版本,无链接'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</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>
|
<view>
|
||||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||||
<view class="friend-flex" @click="toPending">
|
<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" />
|
<u-badge max="99" absolute :offset="[23, 20]" :value="pendingCount" />
|
||||||
<view class="info">新的朋友</view>
|
<view class="info">新的朋友</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="friend-flex" @click="toGroup">
|
<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 class="info">我的群聊</view>
|
||||||
</view>
|
</view>
|
||||||
<block v-if="friends.length > 0">
|
<block v-if="friends.length > 0">
|
||||||
<u-index-item v-for="(item, fkey) in friends" :key="fkey">
|
<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"
|
<u-index-anchor :text="indexs[fkey]" bgColor="#f9f9f9" height="20" size="12" color="#666"
|
||||||
style="padding:10rpx 30rpx" />
|
class="anchor" />
|
||||||
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||||
@click="toFriend(friendItem.targetId)">
|
@click="toFriend(friendItem.targetId)">
|
||||||
<u-avatar class="avatar-img" size="40" shape="square"
|
<u-avatar class="avatar-img" size="40" shape="square"
|
||||||
:src="contact(friendItem.targetId).portraitUrl" />
|
:src="contact(friendItem.targetId).portraitUrl" />
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
<view class="name">{{ contact(friendItem.targetId).name }}</view>
|
||||||
<!-- <view class="address">地址:{{ friendItem.address }}</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</u-index-item>
|
</u-index-item>
|
||||||
</block>
|
</block>
|
||||||
<block v-else>
|
<view class="no-lists" v-else>
|
||||||
<u-empty class="pages-null" mode="data" text="暂无好友" />
|
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||||
</block>
|
:src=" require('@/static/imgs/no-friend.png')" :lazy-load="true" />
|
||||||
|
<span>暂无好友列表~</span>
|
||||||
|
</view>
|
||||||
</u-index-list>
|
</u-index-list>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -37,8 +38,13 @@
|
|||||||
getFriendsLetter
|
getFriendsLetter
|
||||||
} from '@/apis/interfaces/im';
|
} from '@/apis/interfaces/im';
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
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 {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
indexs: [],
|
indexs: [],
|
||||||
@@ -54,9 +60,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
uni.$on('onNewContactFriends', this.checkNewFriendPending)
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
this.getFriendList()
|
this.getFriendList()
|
||||||
this.checkNewFriendPending()
|
this.checkNewFriendPending()
|
||||||
uni.$on('onContactNotification', this.checkNewFriendPending)
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.$off("onNewContactFriends")
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getFriendList() {
|
getFriendList() {
|
||||||
@@ -72,10 +83,7 @@
|
|||||||
},
|
},
|
||||||
toGroup() {
|
toGroup() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/group/index',
|
url: '/pages/im/group/index'
|
||||||
fail(err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
toFriend(targetId) {
|
toFriend(targetId) {
|
||||||
@@ -85,24 +93,15 @@
|
|||||||
},
|
},
|
||||||
// 新朋友
|
// 新朋友
|
||||||
toPending() {
|
toPending() {
|
||||||
// if (this.pendingCount > 0) {
|
uni.navigateTo({
|
||||||
uni.navigateTo({
|
url: '/pages/im/friends/pending'
|
||||||
url: '/pages/im/friends/pending'
|
})
|
||||||
});
|
|
||||||
// } else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: ` 暂无好友申请 ~ `,
|
|
||||||
// icon: "none",
|
|
||||||
// mask: true,
|
|
||||||
// duration: 3000
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/friends/search'
|
url: '/pages/im/friends/search'
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -113,6 +112,12 @@
|
|||||||
height: 70vh;
|
height: 70vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.anchor {
|
||||||
|
background-color: #f9f9f9 !important;
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
border-bottom: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
// 好友列表
|
// 好友列表
|
||||||
.friend-flex {
|
.friend-flex {
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -126,6 +131,8 @@
|
|||||||
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
|
box-shadow: 0 0 20rpx rgba($color: $main-color, $alpha: 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-left: $padding;
|
margin-left: $padding;
|
||||||
@@ -163,4 +170,19 @@
|
|||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
background-color: #fff;
|
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>
|
</style>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<u-icon name="arrow-right" color="#eee" size="16" />
|
<u-icon name="arrow-right" color="#eee" size="16" />
|
||||||
</view>
|
</view>
|
||||||
<view class="item u-border-bottom">
|
<view class="item u-border-bottom">
|
||||||
<label>聊天免打扰</label>
|
<label>消息免打扰</label>
|
||||||
<u-switch size="22" v-model="status" activeColor="#34CE98" @change="setStatus"></u-switch>
|
<u-switch size="22" v-model="status" activeColor="#34CE98" @change="setStatus"></u-switch>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
@@ -113,7 +113,6 @@
|
|||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
getFriendInfo(e.targetId).then(res => {
|
getFriendInfo(e.targetId).then(res => {
|
||||||
console.log(res, "获取朋友的信息")
|
|
||||||
this.userInfo = res
|
this.userInfo = res
|
||||||
// 获取到用户信息之后,去检查一下要不要更新
|
// 获取到用户信息之后,去检查一下要不要更新
|
||||||
this.$store.dispatch('updateContact', res)
|
this.$store.dispatch('updateContact', res)
|
||||||
@@ -148,7 +147,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
toPrivate() {
|
toPrivate() {
|
||||||
uni.redirectTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/private/chat?targetId=' + this.targetId
|
url: '/pages/im/private/chat?targetId=' + this.targetId
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -209,7 +208,7 @@
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pedingFriend(this.targetId, 'message').then(res => {
|
pedingFriend(this.targetId, '').then(res => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: ` 申请成功,等待审核 `,
|
title: ` 申请成功,等待审核 `,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -228,8 +227,9 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
singleCall(e) {
|
singleCall(e) {
|
||||||
uni.redirectTo({
|
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'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="info-flex">
|
<view class="info-flex">
|
||||||
<view class="info-flex-item">
|
<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="nickname">{{infoObj.name}}</view>
|
||||||
<view class="address">{{infoObj.address}}</view>
|
<view class="address">{{infoObj.address}}</view>
|
||||||
<view class="info-code">
|
<view class="info-code">
|
||||||
@@ -23,7 +23,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getUserInfo
|
getUserInfo
|
||||||
} from '@/apis/interfaces/im'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -47,6 +48,12 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
previewImg(item){
|
||||||
|
console.log(item)
|
||||||
|
uni.previewImage({
|
||||||
|
urls:[item]
|
||||||
|
})
|
||||||
|
},
|
||||||
copy() {
|
copy() {
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
data: this.downUrl,
|
data: this.downUrl,
|
||||||
@@ -99,7 +106,7 @@
|
|||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
// padding: 14rpx;
|
// padding: 14rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 20rpx;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: solid 14rpx rgba($color: #fff, $alpha:1);
|
border: solid 14rpx rgba($color: #fff, $alpha:1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,19 @@
|
|||||||
<view class="pending">
|
<view class="pending">
|
||||||
<u-sticky>
|
<u-sticky>
|
||||||
<view class="header-search" @click="$Router.push({ name: 'SearchFriend' })">
|
<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" />
|
:disabled="true" :show-action="false" />
|
||||||
</view>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<view v-for="(item, index) in pendings" :key="index">
|
<block v-if="pendings.length > 0">
|
||||||
<apply-cell :message="item.latestMessage" @success="getPendingList" />
|
<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>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,16 +29,26 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pendings: []
|
pendings: [],
|
||||||
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onShow() {
|
||||||
this.getPendingList()
|
this.getPendingList()
|
||||||
uni.$on('onContactNotification', this.getPendingList)
|
uni.$on('onNewContactPendings', this.getPendingList)
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.$off('onNewContactPendings')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getPendingList() {
|
getPendingList() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
|
console.log(pendings, 'res......')
|
||||||
|
if (pendings.length > 0) {
|
||||||
|
this.bg = '#f9f9f9'
|
||||||
|
} else {
|
||||||
|
this.bg = '#fff'
|
||||||
|
}
|
||||||
this.pendings = pendings
|
this.pendings = pendings
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -46,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.no-lists {
|
.no-lists {
|
||||||
padding-top: $padding * 3;
|
padding-top: $padding * 5;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -8,17 +8,19 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="search">
|
<view class="search">
|
||||||
<!-- 搜索 、 -->
|
<!-- 搜索 -->
|
||||||
<u-sticky>
|
<u-sticky>
|
||||||
<view class="header-search">
|
<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>
|
</view>
|
||||||
</u-sticky>
|
</u-sticky>
|
||||||
<block v-if="searchResult.length > 0">
|
<block v-if="searchResult.length > 0">
|
||||||
<applyFriend :lists="searchResult" :isApply="true" @action="action" />
|
<applyFriend :lists="searchResult" :isApply="true" @action="action" />
|
||||||
</block>
|
</block>
|
||||||
<view class="no-lists" v-else>
|
<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" />
|
<u-image class="cover" radius="4" width="400rpx" height="400rpx"
|
||||||
|
:src="require('@/static/imgs/no-search.png')" :lazy-load="true" />
|
||||||
<span>暂无匹配内容~</span>
|
<span>暂无匹配内容~</span>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
pedingFriend
|
pedingFriend
|
||||||
} from '@/apis/interfaces/im.js';
|
} from '@/apis/interfaces/im.js';
|
||||||
import applyFriend from '../components/friendSearchList.vue';
|
import applyFriend from '../components/friendSearchList.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
applyFriend
|
applyFriend
|
||||||
@@ -41,13 +44,27 @@
|
|||||||
focused: true
|
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: {
|
methods: {
|
||||||
search() {
|
search() {
|
||||||
// friendship: '' 没有好友关系
|
// friendship: '' 没有好友关系
|
||||||
// accepted 好友
|
// accepted 好友
|
||||||
// pending 申请中
|
// pending 申请中
|
||||||
// denied 拒绝
|
// denied 拒绝
|
||||||
// blocked 黑名单
|
// blocked 黑名单
|
||||||
searchFriend(this.searchValue)
|
searchFriend(this.searchValue)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.searchResult = res;
|
this.searchResult = res;
|
||||||
|
|||||||
@@ -1,25 +1,61 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="create">
|
<view class="create">
|
||||||
<view class="create-title">公告内容</view>
|
<view class="create-title">公告内容</view>
|
||||||
<u--textarea v-model="content" count height="240" maxlength="240" placeholder="请输入公告内容" />
|
|
||||||
<u-button type="primary" text="发布" :disabled="disabled" @click="onCreate" color="#34CE98" />
|
<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>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
createGroupAnnouncement
|
createGroupAnnouncement,
|
||||||
|
getGroupAnnouncement
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
content: ''
|
content: '',
|
||||||
|
aId: '',
|
||||||
|
type: '' // cheack ' 查看详情'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
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: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
@@ -52,15 +88,16 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.create {
|
.create {
|
||||||
padding: $padding;
|
padding: $padding;
|
||||||
.create-title{
|
|
||||||
|
.create-title {
|
||||||
font-size: $title-size + 4;
|
font-size: $title-size + 4;
|
||||||
padding: $padding - 10 0 $padding - 10 $padding - 10 ;
|
padding: $padding - 10 0 $padding - 10 $padding - 10;
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&::before{
|
&::before {
|
||||||
content:"";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 10rpx;
|
width: 10rpx;
|
||||||
height: 34rpx;
|
height: 34rpx;
|
||||||
@@ -69,6 +106,13 @@
|
|||||||
top: 26rpx;
|
top: 26rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
color: $text-color;
|
||||||
|
font-size: $title-size;
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
|
||||||
.u-button {
|
.u-button {
|
||||||
margin-top: $padding;
|
margin-top: $padding;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
<template>
|
<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">
|
<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 v-for="(item,index) in announcements" :key="index" class="item"
|
||||||
<view class="header">
|
@longpress="actions(item.announcement_id)" @click="tabA(item.announcement_id)">
|
||||||
<u-avatar :src="item.user.portraitUrl" />
|
<view class="content-a"><span v-if="item.is_top">置顶</span>{{ item.content }}</view>
|
||||||
<view class="user">
|
<view class="user">
|
||||||
<view class="name">{{ item.user.name }}</view>
|
<u-avatar :src="item.user.portraitUrl" size="40rpx" />
|
||||||
<view class="time">{{ item.created_at }}</view>
|
<view class="name">{{ item.user.name }}</view>
|
||||||
</view>
|
<view class="time">{{ item.created_at }}</view>
|
||||||
<view class="delete" v-if="isAdmin" @click="onDelete(item.announcement_id)">删除</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="content">{{ item.content }}</view>
|
<!-- <view class="delete" v-if="isAdmin" @click="onDelete(item.announcement_id)">删除</view> -->
|
||||||
</view>
|
</view>
|
||||||
</u-skeleton>
|
</u-skeleton>
|
||||||
|
|
||||||
|
<!-- 没有列表 -->
|
||||||
<view class="no-lists" v-else>
|
<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>
|
<span>暂无公告内容~</span>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 弹出 -->
|
||||||
|
<u-action-sheet :actions="actionMap" :title="actionTitle" :show="actionShow" cancelText="取消"
|
||||||
|
@close="actionShow = false" @select="handleAction" />
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -24,16 +32,36 @@
|
|||||||
import {
|
import {
|
||||||
getGroupInfo,
|
getGroupInfo,
|
||||||
getGroupAnnouncements,
|
getGroupAnnouncements,
|
||||||
deleteGroupAnnouncement
|
deleteGroupAnnouncement,
|
||||||
|
topGroupAnnouncement
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
announcements: [],
|
groupAnnouncementId: '', // 选择公告 id
|
||||||
|
announcements: [], // 公告列表
|
||||||
loading: true,
|
loading: true,
|
||||||
isAdmin: false
|
isAdmin: false,
|
||||||
|
actionShow: false,
|
||||||
|
actionMap: [{
|
||||||
|
key: 2,
|
||||||
|
name: ' 删除该公告',
|
||||||
|
disabled: false
|
||||||
|
}, {
|
||||||
|
key: 3,
|
||||||
|
name: '置顶该公告',
|
||||||
|
disabled: false
|
||||||
|
}],
|
||||||
|
actionTitle: '请选择操作',
|
||||||
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -60,26 +88,63 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 获取公告信息
|
||||||
initData() {
|
initData() {
|
||||||
getGroupAnnouncements(this.targetId).then(res => {
|
getGroupAnnouncements(this.targetId).then(res => {
|
||||||
|
if (res.length > 0) {
|
||||||
|
this.bg = '#f9f9f9'
|
||||||
|
} else {
|
||||||
|
this.bg = '#fff'
|
||||||
|
}
|
||||||
this.announcements = res
|
this.announcements = res
|
||||||
this.loading = false
|
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) {
|
onDelete(aId) {
|
||||||
uni.showModal({
|
deleteGroupAnnouncement(this.targetId, aId).then(res => {
|
||||||
title: '删除公告',
|
uni.showToast({
|
||||||
success: (res) => {
|
icon: 'none',
|
||||||
if (res.confirm) {
|
title: '删除成功',
|
||||||
deleteGroupAnnouncement(this.targetId, aId).then(res => {
|
mask: true
|
||||||
uni.showToast({
|
})
|
||||||
icon: 'none',
|
uni.$emit('updateAnnouncement')
|
||||||
title: '删除成功'
|
this.initData()
|
||||||
})
|
|
||||||
this.initData()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +153,8 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.announce {
|
.announce {
|
||||||
padding: 0 $padding $padding $padding;
|
min-height: 99vh;
|
||||||
|
|
||||||
.no-lists {
|
.no-lists {
|
||||||
padding-top: $padding * 5;
|
padding-top: $padding * 5;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -103,41 +169,55 @@
|
|||||||
padding-top: $padding;
|
padding-top: $padding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.item {
|
|
||||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
|
||||||
padding-top: $padding;
|
|
||||||
|
|
||||||
.header {
|
.item {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: $padding $padding + 10 10rpx $padding + 10;
|
||||||
|
border-bottom: $padding solid #f9f9f9;
|
||||||
|
|
||||||
|
|
||||||
|
.user {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
justify-content: flex-start;
|
||||||
align-items: center;
|
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;
|
||||||
|
|
||||||
.user {
|
.name {
|
||||||
margin-left: $padding;
|
padding-left: 10rpx;
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
|
|
||||||
.name {}
|
|
||||||
|
|
||||||
.time {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: $text-gray-m;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.delete {
|
.time {
|
||||||
color: $text-price;
|
margin-left: 20rpx;
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content-a {
|
||||||
padding: 20rpx $padding;
|
|
||||||
font-size: $title-size;
|
font-size: $title-size;
|
||||||
color: $text-gray;
|
color: $text-color;
|
||||||
max-width: 100%;
|
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,
|
joinGroupPre,
|
||||||
joinGroup
|
joinGroup
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
|
|||||||
@@ -2,22 +2,18 @@
|
|||||||
<view class="chat">
|
<view class="chat">
|
||||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||||
|
|
||||||
|
<view class="shade" @click="hidePop" v-show="showPop">
|
||||||
|
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
||||||
|
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu(item)">
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="body">
|
<view class="body">
|
||||||
<view class="scroll">
|
<view class="scroll">
|
||||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||||
<view class="time" v-if="item.senderUserId === '__system__'">{{ item.content.message }}</view>
|
<show-message-cell :message="message" isGroup @messageAction="messageAction" />
|
||||||
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -25,28 +21,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
|
||||||
timeCustomCN
|
|
||||||
} from '@/utils/filters.js'
|
|
||||||
import {
|
import {
|
||||||
getGroupBase
|
getGroupBase
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import im from '@/utils/im/index.js'
|
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 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'
|
||||||
|
import messageActions from '../mixins/messageActions.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss,
|
||||||
|
messageActions
|
||||||
|
],
|
||||||
components: {
|
components: {
|
||||||
showVoice,
|
sentMessageBar,
|
||||||
showImage,
|
showMessageCell
|
||||||
showText,
|
|
||||||
sentMessageBar
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
avatarRpx: 84,
|
||||||
targetId: '',
|
targetId: '',
|
||||||
conversationType: RongIMLib.ConversationType.GROUP,
|
conversationType: RongIMLib.ConversationType.GROUP,
|
||||||
messages: [],
|
messages: [],
|
||||||
@@ -64,31 +63,62 @@
|
|||||||
sentTime: 0
|
sentTime: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
this.initGroupInfo()
|
||||||
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
// 获取群成员数量
|
|
||||||
getGroupBase(this.targetId).then(res => {
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: this.groupInfo.name + `(${res.members})`
|
|
||||||
})
|
|
||||||
})
|
|
||||||
// 获取历史消息列表
|
// 获取历史消息列表
|
||||||
this.getMessageList()
|
this.getMessageList()
|
||||||
// 监听收到本群的消息,追加消息
|
// 监听新消息
|
||||||
uni.$on('onReceiveMessage', (msg) => {
|
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||||
|
this.getNewMessage()
|
||||||
|
})
|
||||||
|
uni.$on('onReceiptRequest', (msg) => {
|
||||||
if (msg.targetId == this.targetId) {
|
if (msg.targetId == this.targetId) {
|
||||||
this.getNewMessage()
|
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.$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('onRemoveMessage_' + this.targetId, (messageId) => {
|
||||||
|
this.messages = this.messages.filter(item => item.messageId != messageId)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
uni.$off('onRemoveMessage_' + this.targetId)
|
||||||
|
uni.$off('onReceiveMessage_' + this.targetId)
|
||||||
|
uni.$off('onUpdateProfile_' + this.targetId)
|
||||||
|
uni.$off('onRecallMessage_' + this.targetId)
|
||||||
|
uni.$off('onReceiptRequest')
|
||||||
|
uni.$off('onReceiptResponse')
|
||||||
},
|
},
|
||||||
onNavigationBarButtonTap() {
|
onNavigationBarButtonTap() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -96,23 +126,17 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initGroupInfo() {
|
||||||
|
// 获取群信息,成员数量,设置标题
|
||||||
|
getGroupBase(this.targetId).then(res => {
|
||||||
|
uni.setNavigationBarTitle({
|
||||||
|
title: res.name + `(${res.members})`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
onScroll(e) {
|
onScroll(e) {
|
||||||
this.$refs.messageBar.onHidePopus()
|
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() {
|
getNewMessage() {
|
||||||
im.getMessageList(
|
im.getMessageList(
|
||||||
this.conversationType,
|
this.conversationType,
|
||||||
@@ -134,6 +158,18 @@
|
|||||||
20,
|
20,
|
||||||
true,
|
true,
|
||||||
(messages) => {
|
(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.messages = messages
|
||||||
this.scrollBottom()
|
this.scrollBottom()
|
||||||
})
|
})
|
||||||
@@ -144,12 +180,14 @@
|
|||||||
// 清理当前会话,未读消息数量
|
// 清理当前会话,未读消息数量
|
||||||
RongIMLib.clearMessagesUnreadStatus(this.conversationType, this.targetId, this.latestMessage
|
RongIMLib.clearMessagesUnreadStatus(this.conversationType, this.targetId, this.latestMessage
|
||||||
.sentTime)
|
.sentTime)
|
||||||
// // 发送消息已读状态给对方
|
|
||||||
// RongIMLib.sendReadReceiptMessage(this.conversationType, this.targetId, this.latestMessage.sentTime)
|
|
||||||
// 更新badge提醒数量
|
// 更新badge提醒数量
|
||||||
im.setNotifyBadge()
|
im.setNotifyBadge()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
// console.log(JSON.stringify(this.$refs))
|
||||||
|
// this.$refs.voice.stopPlay()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -175,53 +213,52 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
padding: 10rpx 30rpx;
|
padding: 10rpx 20rpx;
|
||||||
.time {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cell-item {
|
|
||||||
display: flex;
|
|
||||||
width: 690rpx;
|
|
||||||
justify-content: flex-start;
|
|
||||||
|
|
||||||
&.left {
|
}
|
||||||
flex-direction: row;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.right {
|
/* 遮罩 */
|
||||||
flex-direction: row-reverse;
|
.shade {
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 999;
|
||||||
|
|
||||||
.state {
|
.pop {
|
||||||
flex-direction: row;
|
border-radius: 10rpx;
|
||||||
justify-content: flex-end;
|
position: fixed;
|
||||||
}
|
z-index: 101;
|
||||||
}
|
width: 200rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 28rpx;
|
||||||
|
text-align: left;
|
||||||
|
color: #333;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
||||||
|
line-height: 80rpx;
|
||||||
|
transition: transform 0.15s ease-in-out 0s;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
transform: scale(0, 0);
|
||||||
|
|
||||||
.msg {
|
&.show {
|
||||||
margin: 0 20rpx;
|
transform: scale(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
.state {
|
&>view {
|
||||||
padding-top: 10rpx;
|
padding: 0 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
|
||||||
.state-text {
|
&:active {
|
||||||
font-size: $title-size-m - 2;
|
background-color: #f3f3f3;
|
||||||
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>
|
<template>
|
||||||
<view class="group">
|
<view class="group" :style="`background-color:${bg};`">
|
||||||
<view class="title"> 群聊 </view>
|
<block v-if="groups.length > 0">
|
||||||
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
<view class="title"> 群聊 </view>
|
||||||
<u-avatar size="38" shape="square" :src="contact(item.targetId).portraitUrl" />
|
<view v-for="(item, index) in groups" :key="index" class="friend-flex" @click="toGroup(item.targetId)">
|
||||||
<view class="info">
|
<u-avatar size="36" shape="square" :src="contact(item.targetId).portraitUrl" />
|
||||||
<view class="name">{{ item.name }}</view>
|
<view class="info">
|
||||||
|
<view class="name">{{ item.name }} <span class="total">共{{ item.members }} 成员</span></view>
|
||||||
|
</view>
|
||||||
</view>
|
</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>
|
</view>
|
||||||
<view class="group-count"> {{groups.length}}个群聊 </view>
|
|
||||||
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
|
<u-modal negativeTop="300" :show="createModal" title="创建群聊" showCancelButton @cancel="onHideModal"
|
||||||
@confirm="onCreateGroup">
|
@confirm="onCreateGroup">
|
||||||
<view class="slot-content">
|
<view class="slot-content">
|
||||||
@@ -28,7 +34,8 @@
|
|||||||
return {
|
return {
|
||||||
groups: [],
|
groups: [],
|
||||||
createModal: false,
|
createModal: false,
|
||||||
groupName: ''
|
groupName: '',
|
||||||
|
bg: '#fff'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -41,13 +48,19 @@
|
|||||||
onNavigationBarButtonTap() {
|
onNavigationBarButtonTap() {
|
||||||
this.createModal = true
|
this.createModal = true
|
||||||
},
|
},
|
||||||
onLoad() {
|
onShow() {
|
||||||
this.initData()
|
this.initData()
|
||||||
uni.$on('onGroupDismiss', this.initData)
|
uni.$on('onGroupDismiss', this.initData)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData() {
|
initData() {
|
||||||
getMyGroups().then((res) => {
|
getMyGroups().then((res) => {
|
||||||
|
console.log(res,'res...')
|
||||||
|
if (res.length > 0) {
|
||||||
|
this.bg = '#f9f9f9'
|
||||||
|
} else {
|
||||||
|
this.bg = '#fff'
|
||||||
|
}
|
||||||
this.groups = res
|
this.groups = res
|
||||||
res.map(item => {
|
res.map(item => {
|
||||||
this.$store.dispatch('updateContact', item)
|
this.$store.dispatch('updateContact', item)
|
||||||
@@ -88,17 +101,19 @@
|
|||||||
.group {
|
.group {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: $window-color;
|
background-color: $window-color;
|
||||||
.title{
|
|
||||||
|
.title {
|
||||||
font-size: $title-size-m;
|
font-size: $title-size-m;
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
padding: 10rpx $padding;
|
padding: 10rpx $padding;
|
||||||
}
|
}
|
||||||
.group-count{
|
|
||||||
|
.group-count {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: $title-size;
|
font-size: $title-size;
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
padding: 10rpx $padding $padding $padding;
|
padding: 10rpx $padding 20rpx $padding;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,6 +138,11 @@
|
|||||||
font-size: $title-size + 1;
|
font-size: $title-size + 1;
|
||||||
color: #454545 !important;
|
color: #454545 !important;
|
||||||
}
|
}
|
||||||
|
.total{
|
||||||
|
color: $text-gray-m;
|
||||||
|
font-size: $title-size-m - 5;
|
||||||
|
padding-left: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.address {
|
.address {
|
||||||
color: $text-gray-m;
|
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>
|
</style>
|
||||||
|
|||||||
@@ -4,23 +4,26 @@
|
|||||||
<group-user-list ref="userList" :targetId="targetId" :count="14" />
|
<group-user-list ref="userList" :targetId="targetId" :count="14" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-cell-group class="cells" :border="false" >
|
<u-cell-group class="cells" :border="false">
|
||||||
<u-cell :border="false" class="u-border-bottom" isLink title="群公告" :label="announcement" @click="toAnnouncement" />
|
<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" 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" v-if="group.can_makesure" isLink title="群聊邀请确认" @click="showGroupsSure" />
|
||||||
<u-cell :border="false" class="u-border-bottom" title="聊天置顶">
|
<u-cell :border="false" class="u-border-bottom" title="聊天置顶">
|
||||||
<u-switch slot="value" size="20" v-model="isTop" activeColor="#34CE98" @change="setTop" />
|
<u-switch slot="value" size="20" v-model="isTop" activeColor="#34CE98" @change="setTop" />
|
||||||
</u-cell>
|
</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-switch slot="value" size="20" v-model="status" activeColor="#34CE98" @change="setStatus" />
|
||||||
</u-cell>
|
</u-cell>
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
|
|
||||||
<u-cell-group class="cells" v-if="group.is_admin" :border="false">
|
<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="修改群聊名称" :value="groupName"
|
||||||
<u-cell :border="false" class="u-border-bottom" isLink title="修改群头像" @click="onGroupAvatar">
|
@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-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 :border="false" class="u-border-bottom" isLink v-if="group.is_owner" title="准入方式" :value="joinType" @click="onChangeJoinType" />
|
||||||
</u-cell-group>
|
</u-cell-group>
|
||||||
|
|
||||||
@@ -31,15 +34,11 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-modal negativeTop="300" :show="modalShow" title="修改群名称" showCancelButton @cancel="onHideModal" @confirm="onChangeGroupName">
|
<u-modal negativeTop="300" :show="modalShow" title="修改群名称" showCancelButton @cancel="onHideModal" @confirm="onChangeGroupName">
|
||||||
<view class="slot-content">
|
<view class="slot-content"> <u--input placeholder="群名称" border="surround" focus v-model="groupName" maxlength="12" /> </view>
|
||||||
<u--input placeholder="群名称" border="surround" focus v-model="groupName" />
|
|
||||||
</view>
|
|
||||||
</u-modal>
|
</u-modal>
|
||||||
|
|
||||||
<u-modal :show="qrCodeShow" :title="group.name" @confirm="qrCodeShow = false">
|
<u-modal :show="qrCodeShow" :title="group.name" @confirm="qrCodeShow = false">
|
||||||
<view class="slot-content">
|
<view class="slot-content"> <uqrcode class="info-code-src" :size="198" :text="qrContent" /> </view>
|
||||||
<uqrcode class="info-code-src" :size="198" :text="qrContent" />
|
|
||||||
</view>
|
|
||||||
</u-modal>
|
</u-modal>
|
||||||
|
|
||||||
<u-action-sheet @select="doAction" :actions="joinTypeMap" cancelText="取消" :show="showActions" @close="showActions=false" />
|
<u-action-sheet @select="doAction" :actions="joinTypeMap" cancelText="取消" :show="showActions" @close="showActions=false" />
|
||||||
@@ -58,11 +57,17 @@
|
|||||||
} from '@/apis/interfaces/uploading'
|
} from '@/apis/interfaces/uploading'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import groupUserList from '../components/groupUserList'
|
import groupUserList from '../components/groupUserList'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
groupUserList
|
groupUserList
|
||||||
},
|
},
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
@@ -84,10 +89,15 @@
|
|||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
this.qrContent += e.targetId
|
this.qrContent += e.targetId
|
||||||
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({status}) => {
|
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
|
||||||
|
status
|
||||||
|
}) => {
|
||||||
this.status = !Boolean(status)
|
this.status = !Boolean(status)
|
||||||
})
|
})
|
||||||
RongIMLib.getConversation(this.conversationType, this.targetId, ({code,conversation}) => {
|
RongIMLib.getConversation(this.conversationType, this.targetId, ({
|
||||||
|
code,
|
||||||
|
conversation
|
||||||
|
}) => {
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
this.isTop = conversation.isTop
|
this.isTop = conversation.isTop
|
||||||
}
|
}
|
||||||
@@ -95,9 +105,12 @@
|
|||||||
this.initData()
|
this.initData()
|
||||||
uni.$on('groupAnnouncementCreated', this.initData)
|
uni.$on('groupAnnouncementCreated', this.initData)
|
||||||
uni.$on('groupInvitedUser', this.updateUserList)
|
uni.$on('groupInvitedUser', this.updateUserList)
|
||||||
|
uni.$on('updateAnnouncement', this.initData)
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
uni.$off('groupAnnouncementCreated')
|
uni.$off('groupAnnouncementCreated')
|
||||||
|
uni.$off('groupInvitedUser')
|
||||||
|
uni.$off('updateAnnouncement')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateUserList() {
|
updateUserList() {
|
||||||
@@ -105,7 +118,6 @@
|
|||||||
},
|
},
|
||||||
initData() {
|
initData() {
|
||||||
getGroupInfo(this.targetId).then(res => {
|
getGroupInfo(this.targetId).then(res => {
|
||||||
console.log(res,'群信息。。。。。')
|
|
||||||
this.group = res.group
|
this.group = res.group
|
||||||
this.groupName = res.group.name
|
this.groupName = res.group.name
|
||||||
this.announcement = res.announcement
|
this.announcement = res.announcement
|
||||||
@@ -119,7 +131,6 @@
|
|||||||
return item.key == res.join_type
|
return item.key == res.join_type
|
||||||
})[0].name
|
})[0].name
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log('getGroupInfo ERR', err);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '群不存在'
|
title: '群不存在'
|
||||||
@@ -152,9 +163,9 @@
|
|||||||
this.qrCodeShow = true
|
this.qrCodeShow = true
|
||||||
},
|
},
|
||||||
// 群聊邀请待确认
|
// 群聊邀请待确认
|
||||||
showGroupsSure(){
|
showGroupsSure() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url:"/pages/im/group/reviewed?id="+this.targetId
|
url: "/pages/im/group/reviewed?targetId=" + this.targetId
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onGroupName() {
|
onGroupName() {
|
||||||
@@ -243,8 +254,11 @@
|
|||||||
}
|
}
|
||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
this.initData()
|
|
||||||
this.joinType = e.name
|
this.joinType = e.name
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.userList.initGroupInfo()
|
||||||
|
this.initData()
|
||||||
|
})
|
||||||
this.showActions = false
|
this.showActions = false
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -326,6 +340,20 @@
|
|||||||
.cells {
|
.cells {
|
||||||
margin-top: $padding;
|
margin-top: $padding;
|
||||||
background-color: white;
|
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 {
|
.members {
|
||||||
@@ -347,5 +375,4 @@
|
|||||||
.u-border-bottom {
|
.u-border-bottom {
|
||||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
border-bottom: solid 1rpx #f9f9f9 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="invite">
|
<view class="invite">
|
||||||
<view class="search">
|
<view class="search u-border-bottom">
|
||||||
<u--input class="search-input" placeholder="搜索" border="none" prefixIcon="search" v-model="searchTxt"
|
<u--input class="search-input" placeholder="搜索好友" border="none" prefixIcon="search" v-model="searchTxt"
|
||||||
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" @change="onSearch" />
|
disabledColor="#Fff" prefixIconStyle="font-size: 22px;color: #909399" @change="onSearch" />
|
||||||
</view>
|
</view>
|
||||||
<block v-if="friends.length > 0">
|
<block v-if="friends.length > 0">
|
||||||
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
<u-index-list :index-list="indexs" inactiveColor="#666" activeColor="#34CE98">
|
||||||
<u-checkbox-group v-if="friends.length > 0" v-model="checkboxValue" placement="column">
|
<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-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"
|
<u-index-anchor :text="indexs[fkey]" v-if="indexs[fkey]" bgColor="#f9f9f9f" height="20"
|
||||||
color="#666" style="padding:10rpx 30rpx" />
|
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"
|
<view v-for="(friendItem, index) in item" :key="index" class="friend-flex"
|
||||||
@click="addContact(friendItem.targetId)">
|
@click="addContact(friendItem.targetId)">
|
||||||
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
|
<u-checkbox :name="friendItem.targetId" shape="circle" activeColor="#34ce98"
|
||||||
@@ -44,10 +45,15 @@
|
|||||||
getGroupUsers
|
getGroupUsers
|
||||||
} from '@/apis/interfaces/im';
|
} from '@/apis/interfaces/im';
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
searchTxt: '',
|
searchTxt: '',
|
||||||
@@ -60,32 +66,24 @@
|
|||||||
selectValue: []
|
selectValue: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
this.getFriendList()
|
this.getFriendList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSearch(val) {
|
onSearch() {
|
||||||
if (val) {
|
if (this.searchTxt) {
|
||||||
var ix = []
|
|
||||||
this.friends = this.orignalFriends.map((list, index) => {
|
this.friends = this.orignalFriends.map((list, index) => {
|
||||||
const resList = list.filter(item => item.name.indexOf(val) > 0)
|
const resList = list.filter(item => {
|
||||||
if (resList.length > 0) {
|
return item.name.indexOf(this.searchTxt) >= 0
|
||||||
this.indexs = this.orignalIndexs.map((t, i) => {})
|
})
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return resList
|
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 {
|
} else {
|
||||||
this.friends = this.orignalFriends
|
this.friends = this.orignalFriends
|
||||||
this.indexs = this.orignalIndexs
|
this.indexs = this.orignalIndexs
|
||||||
@@ -103,6 +101,7 @@
|
|||||||
})
|
})
|
||||||
getGroupUsers(this.targetId).then(res => {
|
getGroupUsers(this.targetId).then(res => {
|
||||||
res.map(res => {
|
res.map(res => {
|
||||||
|
console.log(res)
|
||||||
this.checkboxValue.push(String(res.targetId))
|
this.checkboxValue.push(String(res.targetId))
|
||||||
this.selectValue.push(String(res.targetId))
|
this.selectValue.push(String(res.targetId))
|
||||||
})
|
})
|
||||||
@@ -123,8 +122,16 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onInvite() {
|
onInvite() {
|
||||||
inviteGroupUser(this.targetId, this.checkboxValue).then(res => {
|
console.log(this.checkboxValue, 'userIds.....')
|
||||||
console.log(res, 'res')
|
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({
|
uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
animationType: 'pop-out',
|
animationType: 'pop-out',
|
||||||
|
|||||||
@@ -1,35 +1,113 @@
|
|||||||
<!-- 群聊邀请确认列表页面 -->
|
<!-- 群聊邀请确认列表页面 -->
|
||||||
<template>
|
<template>
|
||||||
<view class="reviewed">
|
<view class="reviewed">
|
||||||
<view class="reviewed-item">
|
<block v-if="pendings.length > 0">
|
||||||
<u-avatar class="avatar" src="require('@/static/user/cover.png')" shape="square" size="36" />
|
<view class="reviewed-item" v-for="(item, index) in pendings" :key="index">
|
||||||
<view style="flex:1;">
|
<u-avatar class="avatar"
|
||||||
<view class="nickname"><span>{{`艾米的猫儿 `}}</span>想邀请<span>{{` 用户8066`}}</span>加入群聊</view>
|
:src="JSON.parse(item.content.extra).portraitUrl || require('@/static/user/cover.png')"
|
||||||
<view> 申请原因:{{`呵呵哒。。`}}</view>
|
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 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>
|
</view>
|
||||||
<view class="sure" @click="sure(2)"> 通过 </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>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import {
|
||||||
getGroupMakeSure,
|
getGroupMakeSure,
|
||||||
getGroupMakeSureAllow
|
getGroupMakeSureAllow,
|
||||||
|
groupMakeSure
|
||||||
} from "@/apis/interfaces/im.js"
|
} 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 {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lists: [],
|
targetId: '',
|
||||||
|
pendings: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
contact() {
|
||||||
|
return function(targetId) {
|
||||||
|
return this.$store.getters.contactInfo(targetId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
this.targetId = e.targetId
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getList() {
|
||||||
sure(id) {
|
im.getGroupPendinglist(this.targetId, (result) => {
|
||||||
console.log(id, '....')
|
console.log(result)
|
||||||
uni.navigateTo({
|
this.pendings = result
|
||||||
url: "/pages/im/group/reviewedInfo?id=" + id
|
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
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;
|
justify-content: flex-start;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border-bottom: solid 1rpx #f9f9f9;
|
border-bottom: solid 1rpx #f9f9f9;
|
||||||
font-size: $title-size-m - 2;
|
font-size: $title-size-m;
|
||||||
padding-bottom: 20rpx;
|
padding-bottom: 20rpx;
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
|
|
||||||
@@ -56,11 +134,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nickname {
|
.nickname {
|
||||||
font-size: $title-size-m;
|
font-size: $title-size;
|
||||||
|
color: $text-color;
|
||||||
|
padding-bottom: 6rpx;
|
||||||
|
|
||||||
span {
|
span {
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
font-size: $title-size-m +1;
|
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>
|
</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>
|
<script>
|
||||||
import groupUserList from '../components/groupUserList'
|
import groupUserList from '../components/groupUserList'
|
||||||
|
import onGroupDismiss from '../mixins/onGroupDismiss.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
onGroupDismiss
|
||||||
|
],
|
||||||
components: {
|
components: {
|
||||||
groupUserList
|
groupUserList
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -46,7 +46,8 @@
|
|||||||
return {
|
return {
|
||||||
conversations: [], // 会话列表
|
conversations: [], // 会话列表
|
||||||
connection: 0,
|
connection: 0,
|
||||||
hasNewFriends: 0
|
hasNewFriends: 0,
|
||||||
|
perPage: 200
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -54,35 +55,37 @@
|
|||||||
connectionStatus
|
connectionStatus
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 好友申请数量
|
|
||||||
this.checkNewFriendPending()
|
|
||||||
// 监听新的好友申请
|
// 监听新的好友申请
|
||||||
uni.$on('onContactNotification', () => {
|
uni.$on('onNewContactConversation', () => {
|
||||||
|
console.log('更新好友申请数量');
|
||||||
|
// 更新好友申请数量
|
||||||
this.checkNewFriendPending()
|
this.checkNewFriendPending()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
// 好友申请数量
|
||||||
|
this.checkNewFriendPending()
|
||||||
|
|
||||||
if (this.$store.state.token !== '') {
|
if (this.$store.state.token !== '') {
|
||||||
this.getConversationList()
|
this.getConversationList()
|
||||||
}
|
}
|
||||||
uni.$on('onConnectionStatusChange', (status) => {
|
|
||||||
this.connection = status
|
|
||||||
})
|
|
||||||
// 监听新消息
|
// 监听新消息
|
||||||
uni.$on('onReceiveMessage', (msg) => {
|
uni.$on('onReceiveMessage', (msg) => {
|
||||||
this.getConversationList()
|
this.getConversationList()
|
||||||
})
|
})
|
||||||
|
// 监听网络状态变化
|
||||||
|
uni.$on('onConnectionStatusChange', (status) => {
|
||||||
|
this.connection = status
|
||||||
|
if (status == 0) {
|
||||||
|
this.getConversationList()
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
uni.$off('onReceiveMessage')
|
uni.$off('onReceiveMessage')
|
||||||
|
uni.$off('onConnectionStatusChange')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onDemo(){
|
|
||||||
console.log('1111')
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/im/chatDemo'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
checkNewFriendPending() {
|
checkNewFriendPending() {
|
||||||
im.getPendingList((pendings) => {
|
im.getPendingList((pendings) => {
|
||||||
this.hasNewFriends = pendings.length
|
this.hasNewFriends = pendings.length
|
||||||
@@ -97,11 +100,9 @@
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
// 获取私聊的会话列表
|
// 获取会话列表,最新的一千条
|
||||||
getConversationList() {
|
getConversationList() {
|
||||||
const count = 1000
|
RongIMLib.getConversationList([1, 3], this.perPage, 0, ({
|
||||||
const timestamp = 0
|
|
||||||
RongIMLib.getConversationList([1, 3], count, timestamp, ({
|
|
||||||
code,
|
code,
|
||||||
conversations
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
134
pages/im/mixins/messageActions.js
Normal file
134
pages/im/mixins/messageActions.js
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
winSize: {},
|
||||||
|
showPop: false,
|
||||||
|
/* 弹窗按钮列表 */
|
||||||
|
popButton: ['复制', '删除', '撤回'],
|
||||||
|
/* 弹窗定位样式 */
|
||||||
|
popStyle: "",
|
||||||
|
pickedItem: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: (e) => {
|
||||||
|
this.winSize = {
|
||||||
|
width: e.windowWidth,
|
||||||
|
height: e.windowHeight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 隐藏功能菜单
|
||||||
|
hidePop() {
|
||||||
|
this.showPop = false
|
||||||
|
this.pickedItem = {}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.showShade = false
|
||||||
|
}, 250)
|
||||||
|
},
|
||||||
|
// 点击会话功能菜单
|
||||||
|
pickerMenu(e) {
|
||||||
|
const msg = this.pickedItem
|
||||||
|
console.log(msg);
|
||||||
|
switch (e) {
|
||||||
|
case '复制':
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: msg.content.content
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '复制成功'
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '删除':
|
||||||
|
IMLib.deleteMessagesByIds([msg.messageId], ({
|
||||||
|
code
|
||||||
|
}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
uni.$emit('onRemoveMessage_' + msg.targetId, msg.messageId)
|
||||||
|
uni.showToast({
|
||||||
|
title: '消息删除成功',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case '撤回':
|
||||||
|
const pushContent = this.$store.getters.sender.name + '撤回了一条消息'
|
||||||
|
IMLib.recallMessage(msg.messageId, pushContent,
|
||||||
|
({
|
||||||
|
code,
|
||||||
|
message
|
||||||
|
}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '消息撤回成功'
|
||||||
|
})
|
||||||
|
IMLib.getMessage(msg.messageId, res => {
|
||||||
|
uni.$emit('onRecallMessage_' + msg.targetId, res.message)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '撤回失败' + code
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.hidePop()
|
||||||
|
},
|
||||||
|
messageAction(e) {
|
||||||
|
let [touches, style, item] = [e.event.touches[0], "", e.message]
|
||||||
|
|
||||||
|
if (touches.clientY > (this.winSize.height / 2)) {
|
||||||
|
style = `bottom:${this.winSize.height-touches.clientY}px;`
|
||||||
|
} else {
|
||||||
|
style = `top:${touches.clientY}px;`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (touches.clientX > (this.winSize.width / 2)) {
|
||||||
|
style += `right:${this.winSize.width-touches.clientX}px`
|
||||||
|
} else {
|
||||||
|
style += `left:${touches.clientX}px`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.messageDirection == 2) {
|
||||||
|
if (item.objectName == 'RC:TxtMsg') {
|
||||||
|
this.popButton = ['复制', '删除']
|
||||||
|
} else {
|
||||||
|
this.popButton = ['删除']
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((new Date()).getTime() - item.sentTime > 120 * 1000) {
|
||||||
|
if (item.objectName == 'RC:TxtMsg') {
|
||||||
|
this.popButton = ['复制', '删除']
|
||||||
|
} else {
|
||||||
|
this.popButton = ['删除']
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (item.objectName == 'RC:TxtMsg') {
|
||||||
|
this.popButton = ['复制', '撤回']
|
||||||
|
} else {
|
||||||
|
this.popButton = ['删除']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.popStyle = style
|
||||||
|
this.pickedItem = item
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.showPop = true;
|
||||||
|
}, 10)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
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>
|
<template>
|
||||||
<view class="call">
|
<view class="call">
|
||||||
<view class="video">
|
<view class="video">
|
||||||
<RongCloud-Call-RCUniCallView ref="bigVideoView" :style="{width:windowWidth+'px',height:windowHeight+'px'}"
|
<RongCloud-Call-RCUniCallView ref="bigVideoView" :style="bigVideoStyle" class="bigVideoView">
|
||||||
class="bigVideoView">
|
|
||||||
</RongCloud-Call-RCUniCallView>
|
|
||||||
<RongCloud-Call-RCUniCallView ref="smallVideoView" class="smallVideoView">
|
|
||||||
</RongCloud-Call-RCUniCallView>
|
</RongCloud-Call-RCUniCallView>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<view class="status" v-if="!connected || mediaType == 0">
|
<view class="status" v-if="!connected">
|
||||||
<view class="remote">
|
<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><text class="nickname">{{ contact(targetId).name }}</text></view>
|
||||||
<view v-if="remoteRinging"><text class="mediaType">等待对方接听</text></view>
|
<view v-if="remoteRinging"><text class="mediaType">等待对方接听</text></view>
|
||||||
<view v-if="connected"><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>
|
</view>
|
||||||
<view class="buttons">
|
<view class="buttons">
|
||||||
<view class="btn" v-if="connected" @click="changeMicrophone">
|
<view class="btn" v-if="connected" @click="changeMicrophone">
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
<u-icon name="mic" color="#ffffff" size="30" />
|
<u-icon name="mic-off" color="#ffffff" size="30" v-if="micOff" />
|
||||||
<u-icon name="mic-off" color="#ffffff" size="30" />
|
<u-icon name="mic" color="#ffffff" size="30" v-else />
|
||||||
</view>
|
</view>
|
||||||
<text class="text">麦克风</text>
|
<text class="text">麦克风</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -31,7 +34,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<text class="text">挂断</text>
|
<text class="text">挂断</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="btn" v-if="!connected" @click="accept">
|
<view class="btn" v-if="!connected && this.isCall == false" @click="accept">
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
<u-icon name="checkmark" color="#ffffff" size="30" />
|
<u-icon name="checkmark" color="#ffffff" size="30" />
|
||||||
</view>
|
</view>
|
||||||
@@ -39,8 +42,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="btn" v-if="connected" @click="changeSpeaker">
|
<view class="btn" v-if="connected" @click="changeSpeaker">
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
<u-icon name="volume-fill" color="#ffffff" size="27" />
|
<u-icon name="volume-off-fill" color="#ffffff" size="27" v-if="volumeOff" />
|
||||||
<u-icon name="volume-off-fill" color="#ffffff" size="27" />
|
<u-icon name="volume-fill" color="#ffffff" size="27" v-else />
|
||||||
</view>
|
</view>
|
||||||
<text class="text">扬声器</text>
|
<text class="text">扬声器</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -51,25 +54,46 @@
|
|||||||
<script>
|
<script>
|
||||||
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as IMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
mediaType: 0, // 0 语音 1 视频
|
mediaType: 0, // 0 语音 1 视频
|
||||||
isOut: false,
|
|
||||||
connected: false,
|
connected: false,
|
||||||
micStatus: false,
|
micStatus: false,
|
||||||
speStatus: false,
|
speStatus: false,
|
||||||
remoteRinging: false,
|
remoteRinging: false,
|
||||||
ring: null
|
ring: null,
|
||||||
|
isCall: false,
|
||||||
|
avatarSize: 96,
|
||||||
|
bigVideoStyle: {},
|
||||||
|
movableAreaStyle: {},
|
||||||
|
// 关闭麦克风
|
||||||
|
micOff: false,
|
||||||
|
// 关闭扬声器
|
||||||
|
volumeOff: false,
|
||||||
|
// 通话时长
|
||||||
|
duration: 0,
|
||||||
|
interval: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
this.avatarSize = utils.rpx2px(200)
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
this.mediaType = e.mediaType
|
this.mediaType = e.mediaType
|
||||||
|
this.isCall = Boolean(e.isCall)
|
||||||
// 进入页面开启外呼
|
// 进入页面开启外呼
|
||||||
CallLib.startSingleCall(this.targetId, this.mediaType, '');
|
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()
|
this.startRing()
|
||||||
// 监听通话链接状态
|
// 监听通话链接状态
|
||||||
@@ -81,6 +105,14 @@
|
|||||||
uni.$once('onRemoteUserJoined', () => {
|
uni.$once('onRemoteUserJoined', () => {
|
||||||
this.remoteRinging = false
|
this.remoteRinging = false
|
||||||
})
|
})
|
||||||
|
this.bigVideoStyle = {
|
||||||
|
width: this.windowWidth + 'px',
|
||||||
|
height: this.windowHeight + 'px',
|
||||||
|
}
|
||||||
|
this.movableAreaStyle = {
|
||||||
|
width: this.windowWidth + 'px',
|
||||||
|
height: this.windowHeight + 'px',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
|
||||||
@@ -99,11 +131,36 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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() {
|
changeMicrophone() {
|
||||||
|
this.micOff = !this.micOff
|
||||||
CallLib.enableMicrophone(this.micStatus)
|
CallLib.enableMicrophone(this.micStatus)
|
||||||
this.micStatus = !this.micStatus
|
this.micStatus = !this.micStatus
|
||||||
},
|
},
|
||||||
changeSpeaker() {
|
changeSpeaker() {
|
||||||
|
this.volumeOff = !this.volumeOff
|
||||||
CallLib.enableSpeaker(this.speStatus)
|
CallLib.enableSpeaker(this.speStatus)
|
||||||
this.speStatus = !this.speStatus
|
this.speStatus = !this.speStatus
|
||||||
},
|
},
|
||||||
@@ -123,9 +180,30 @@
|
|||||||
CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
|
CallLib.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true)
|
||||||
}, 200)
|
}, 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() {
|
hangup() {
|
||||||
CallLib.hangup()
|
CallLib.hangup()
|
||||||
|
this.afterHangup()
|
||||||
this.stopRing()
|
this.stopRing()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -171,23 +249,33 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.video {
|
.video {
|
||||||
.bigVideoView {
|
.movableArea {
|
||||||
background: #000;
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
.movableView {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 320rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.smallVideoView {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 320rpx;
|
||||||
|
background-color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.smallVideoView {
|
.bigVideoView {
|
||||||
background: blue;
|
background-color: #666;
|
||||||
position: absolute;
|
|
||||||
right: 100rpx;
|
|
||||||
top: 100rpx;
|
|
||||||
width: 180rpx;
|
|
||||||
height: 320rpx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
background: #666;
|
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -226,10 +314,6 @@
|
|||||||
.btn {
|
.btn {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
&.hangup {
|
|
||||||
background: $text-price;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
background: $main-color;
|
background: $main-color;
|
||||||
width: 132rpx;
|
width: 132rpx;
|
||||||
@@ -238,6 +322,10 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
|
&.hangup {
|
||||||
|
background-color: $text-price;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
|||||||
@@ -1,46 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="chat">
|
<view class="chat">
|
||||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
||||||
|
|
||||||
|
<view class="shade" @click="hidePop" v-show="showPop">
|
||||||
|
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
||||||
|
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu(item)">
|
||||||
|
{{ item }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<!-- chat -->
|
<!-- chat -->
|
||||||
<view class="body">
|
<view class="body">
|
||||||
<view class="scroll">
|
<view class="scroll">
|
||||||
<view class="cell" v-for="(item, index) in messages" :key="index">
|
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||||
<view class="time">{{ item.sentTime|timeCustomCN }}</view>
|
<show-message-cell :message="message" @messageAction="messageAction" />
|
||||||
<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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
import * as RongIMLib from '@/uni_modules/RongCloud-IMWrapper/js_sdk/index'
|
||||||
import im from '@/utils/im/index.js'
|
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 sentMessageBar from '../components/sentMessageBar'
|
||||||
|
import showMessageCell from '../components/showMessageCell'
|
||||||
|
import utils from '@/utils/index.js'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
import messageActions from '../mixins/messageActions.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase,
|
||||||
|
messageActions
|
||||||
|
],
|
||||||
components: {
|
components: {
|
||||||
sentMessageBar,
|
sentMessageBar,
|
||||||
showVoice,
|
showMessageCell
|
||||||
showImage,
|
|
||||||
showText
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -63,11 +60,6 @@
|
|||||||
sentTime: 0
|
sentTime: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
contact() {
|
|
||||||
return function(targetId) {
|
|
||||||
return this.$store.getters.contactInfo(targetId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -78,6 +70,10 @@
|
|||||||
})
|
})
|
||||||
// 获取消息列表
|
// 获取消息列表
|
||||||
this.getMessageList()
|
this.getMessageList()
|
||||||
|
// 监听新消息
|
||||||
|
uni.$on('onReceiveMessage_' + this.targetId, (message) => {
|
||||||
|
this.getNewMessage()
|
||||||
|
})
|
||||||
// 监听消息已读状态
|
// 监听消息已读状态
|
||||||
uni.$on('onReadReceiptReceived', (data) => {
|
uni.$on('onReadReceiptReceived', (data) => {
|
||||||
if (data.targetId == this.targetId) {
|
if (data.targetId == this.targetId) {
|
||||||
@@ -90,14 +86,30 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 监听收到新消息,判断是否是当前会话,更新会话内容
|
uni.$on('onRecallMessage_' + this.targetId, (message) => {
|
||||||
uni.$on('onReceiveMessage', (msg) => {
|
this.messages = this.messages.map(item => {
|
||||||
if (msg.targetId == this.targetId) {
|
if (message.messageId == item.messageId) {
|
||||||
this.getNewMessage()
|
return message
|
||||||
}
|
} else {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
uni.$once('onUserDelete_' + this.targetId, () => {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '好友关系已解除'
|
||||||
|
})
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/im/index'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
uni.$off('onUserDelete_' + this.targetId)
|
||||||
|
uni.$off('onReceiveMessage_' + this.targetId)
|
||||||
|
uni.$off('onRecallMessage_' + this.targetId)
|
||||||
|
uni.$off('onRecallMessage')
|
||||||
uni.$off('onReadReceiptReceived')
|
uni.$off('onReadReceiptReceived')
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -126,13 +138,6 @@
|
|||||||
this.scrollBottom()
|
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) {
|
scrollBottom(type) {
|
||||||
if (this.latestMessage) {
|
if (this.latestMessage) {
|
||||||
@@ -170,17 +175,18 @@
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
padding: 10rpx 30rpx;
|
padding: 10rpx 20rpx;
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-item {
|
.cell-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 690rpx;
|
width: 710rpx;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
&.left {
|
&.left {
|
||||||
@@ -189,23 +195,14 @@
|
|||||||
|
|
||||||
&.right {
|
&.right {
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
|
|
||||||
.state {
|
.state {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.msg {
|
.msg {
|
||||||
margin: 0 20rpx;
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,4 +213,47 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 遮罩 */
|
||||||
|
.shade {
|
||||||
|
position: fixed;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 999;
|
||||||
|
|
||||||
|
.pop {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 101;
|
||||||
|
width: 200rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 28rpx;
|
||||||
|
text-align: left;
|
||||||
|
color: #333;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
|
||||||
|
line-height: 80rpx;
|
||||||
|
transition: transform 0.15s ease-in-out 0s;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
transform: scale(0, 0);
|
||||||
|
|
||||||
|
&.show {
|
||||||
|
transform: scale(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&>view {
|
||||||
|
padding: 0 20rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background-color: #f3f3f3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<view class="info-box">
|
<view class="info-box">
|
||||||
<image src="@/static/user/user_back.png" mode="aspectFill" />
|
<image src="@/static/user/user_back.png" mode="aspectFill" />
|
||||||
<view class="user-flex">
|
<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" />
|
:src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill" />
|
||||||
<view class="user-content">
|
<view class="user-content">
|
||||||
<block v-if="$store.state.token != ''">
|
<block v-if="$store.state.token != ''">
|
||||||
@@ -234,6 +234,11 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
goSetting(){
|
||||||
|
if (this.isLogin()) {
|
||||||
|
this.$Router.push({ name: 'Setting' })
|
||||||
|
}
|
||||||
|
},
|
||||||
// 检查登录
|
// 检查登录
|
||||||
isLogin() {
|
isLogin() {
|
||||||
if (this.$store.state.token === '') {
|
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,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: savedFilePath
|
localAvatar: savedFilePath,
|
||||||
|
type: contactInfo.type
|
||||||
}
|
}
|
||||||
model.update('targetId="' + contactInfo.targetId + '"', info, (err,
|
model.update('targetId="' + contactInfo.targetId + '"', info, (err,
|
||||||
res) => {
|
res) => {
|
||||||
@@ -90,7 +91,8 @@ export default {
|
|||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: result[0].localAvatar
|
localAvatar: result[0].localAvatar,
|
||||||
|
type: contactInfo.type
|
||||||
}
|
}
|
||||||
model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => {
|
model.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => {
|
||||||
console.log('UPDATE NAME, ERR', err, info);
|
console.log('UPDATE NAME, ERR', err, info);
|
||||||
@@ -117,7 +119,8 @@ export default {
|
|||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: savedFilePath
|
localAvatar: savedFilePath,
|
||||||
|
type: contactInfo.type
|
||||||
}
|
}
|
||||||
model.insert(info, (err, res) => {})
|
model.insert(info, (err, res) => {})
|
||||||
// 保存头像后,更新信息
|
// 保存头像后,更新信息
|
||||||
@@ -130,7 +133,8 @@ export default {
|
|||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: ''
|
localAvatar: '',
|
||||||
|
type: contactInfo.type
|
||||||
}
|
}
|
||||||
model.insert(info, (err, res) => {})
|
model.insert(info, (err, res) => {})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const connect = (token, userInfo, callback) => {
|
|||||||
// 设置未读消息数量
|
// 设置未读消息数量
|
||||||
setNotifyBadge()
|
setNotifyBadge()
|
||||||
// 首次运行获取好友列表
|
// 首次运行获取好友列表
|
||||||
const FK = 'ZHKD_' + userInfo.targetId
|
const FK = 'ZH_V_' + userInfo.targetId
|
||||||
|
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: FK,
|
key: FK,
|
||||||
|
|||||||
@@ -20,7 +20,30 @@ const onReceiveMessage = (message) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
im.setNotifyBadge()
|
im.setNotifyBadge()
|
||||||
|
// 发布全局事件,有新消息,刷新会话列表
|
||||||
uni.$emit('onReceiveMessage', message)
|
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.Location,
|
||||||
IMLib.ObjectName.Voice,
|
IMLib.ObjectName.Voice,
|
||||||
IMLib.ObjectName.HQVoice,
|
IMLib.ObjectName.HQVoice,
|
||||||
IMLib.ObjectName.Sight,
|
IMLib.ObjectName.Sight
|
||||||
IMLib.ObjectName.Text,
|
|
||||||
IMLib.ObjectName.Text,
|
|
||||||
IMLib.ObjectName.Text
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const imLibListeners = () => {
|
const imLibListeners = () => {
|
||||||
// 添加连接状态监听函数
|
// 添加连接状态监听函数
|
||||||
IMLib.addConnectionStatusListener((res) => {
|
IMLib.addConnectionStatusListener((res) => {
|
||||||
console.log('连接状态监听', res.data.status)
|
console.error('连接状态监听', res.data.status)
|
||||||
uni.$emit('onConnectionStatusChange', res.data.status)
|
uni.$emit('onConnectionStatusChange', res.data.status)
|
||||||
})
|
})
|
||||||
// 添加消息监听函数
|
// 添加消息监听函数
|
||||||
IMLib.addReceiveMessageListener((res) => {
|
IMLib.addReceiveMessageListener((res) => {
|
||||||
const message = res.data.message
|
const message = res.data.message
|
||||||
console.error('[收到消息]', message)
|
console.error('[收到消息]', message)
|
||||||
|
checkContactExists(message)
|
||||||
if (utils.inArray(message.objectName, notifyMsgTypes)) {
|
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)
|
onReceiveMessage(message)
|
||||||
} else if (message.objectName === IMLib.ObjectName.ProfileNotification) {
|
} else if (message.objectName === IMLib.ObjectName.ProfileNotification) {
|
||||||
// 更新会话信息
|
uni.$emit('onUpdateProfile_' + message.targetId)
|
||||||
|
// 更新联系人信息
|
||||||
store.dispatch('updateContact', JSON.parse(message.content.data))
|
store.dispatch('updateContact', JSON.parse(message.content.data))
|
||||||
// 调用完更新之后,删除这条消息
|
// 调用完更新之后,删除这条消息
|
||||||
IMLib.deleteMessagesByIds([message.messageId])
|
IMLib.deleteMessagesByIds([message.messageId])
|
||||||
} else if (message.objectName === IMLib.ObjectName.ContactNotification) {
|
} else if (message.objectName === IMLib.ObjectName.ContactNotification) {
|
||||||
console.error('触发一个新好友的通知事件', message);
|
if (message.content.operation === 'Request') {
|
||||||
// 触发一个新好友的通知事件
|
// 触发一个新好友的通知事件,【会话列表,通讯录,新朋友】页面
|
||||||
uni.$emit('onContactNotification', message)
|
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) {
|
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
||||||
// 解散群
|
// 解散群
|
||||||
if (message.content.operation === 'Dismiss') {
|
if (message.content.operation === 'Dismiss') {
|
||||||
IMLib.cleanHistoryMessages(message.conversationType, message.targetId, message.sentTime,
|
IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime,
|
||||||
false)
|
false)
|
||||||
// 解散了就删了吧
|
// 解散了就删了吧
|
||||||
IMLib.removeConversation(message.conversationType, message.targetId)
|
IMLib.removeConversation(3, message.targetId)
|
||||||
uni.$emit('onGroupDismiss', 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)
|
uni.$emit('onReceiveMessage', message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// 监听私聊消息已读回执
|
||||||
// 监听消息回执
|
|
||||||
IMLib.addReadReceiptReceivedListener(({
|
IMLib.addReadReceiptReceivedListener(({
|
||||||
data
|
data
|
||||||
}) => {
|
}) => {
|
||||||
|
console.error("监听私聊消息已读回执: ", data);
|
||||||
uni.$emit('onReadReceiptReceived', 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 = () => {
|
const callLibListeners = () => {
|
||||||
@@ -100,7 +172,7 @@ const callLibListeners = () => {
|
|||||||
CallLib.onCallReceived(({
|
CallLib.onCallReceived(({
|
||||||
data
|
data
|
||||||
}) => {
|
}) => {
|
||||||
console.log('onCallReceived');
|
console.error('onCallReceived');
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
|
url: '/pages/im/private/call?targetId=' + data.targetId + '&mediaType=' +
|
||||||
data.mediaType
|
data.mediaType
|
||||||
@@ -112,27 +184,27 @@ const callLibListeners = () => {
|
|||||||
})
|
})
|
||||||
// 外呼
|
// 外呼
|
||||||
CallLib.onCallOutgoing((res) => {
|
CallLib.onCallOutgoing((res) => {
|
||||||
console.log('onCallOutgoing', res);
|
console.error('onCallOutgoing', res);
|
||||||
uni.$emit('onCallOutgoing')
|
uni.$emit('onCallOutgoing')
|
||||||
})
|
})
|
||||||
// 远端响铃
|
// 远端响铃
|
||||||
CallLib.onRemoteUserRinging((res) => {
|
CallLib.onRemoteUserRinging((res) => {
|
||||||
console.log('onRemoteUserRinging', res);
|
console.error('onRemoteUserRinging', res);
|
||||||
uni.$emit('onRemoteUserRinging')
|
uni.$emit('onRemoteUserRinging')
|
||||||
})
|
})
|
||||||
// 远端加入
|
// 远端加入
|
||||||
CallLib.onRemoteUserJoined((res) => {
|
CallLib.onRemoteUserJoined((res) => {
|
||||||
console.log('远端接听');
|
console.error('远端接听');
|
||||||
uni.$emit('onRemoteUserJoined')
|
uni.$emit('onRemoteUserJoined')
|
||||||
})
|
})
|
||||||
// 断开链接
|
// 断开链接
|
||||||
CallLib.onCallDisconnected((res) => {
|
CallLib.onCallDisconnected((res) => {
|
||||||
console.log('断开链接', res)
|
console.error('断开链接', res)
|
||||||
uni.$emit('onCallDisconnected')
|
uni.$emit('onCallDisconnected')
|
||||||
})
|
})
|
||||||
// 远端挂断
|
// 远端挂断
|
||||||
CallLib.onRemoteUserLeft((res) => {
|
CallLib.onRemoteUserLeft((res) => {
|
||||||
console.log('远端离开', res)
|
console.error('远端离开', res)
|
||||||
uni.$emit('onRemoteUserLeft')
|
uni.$emit('onRemoteUserLeft')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
|
|||||||
'RC:SightMsg',
|
'RC:SightMsg',
|
||||||
'RC:ReferenceMsg',
|
'RC:ReferenceMsg',
|
||||||
'RC:CombineMsg',
|
'RC:CombineMsg',
|
||||||
'RC:GrpNtf'
|
'RC:GrpNtf',
|
||||||
|
'RC:InfoNtf',
|
||||||
|
'RC:RcNtf'
|
||||||
]
|
]
|
||||||
|
|
||||||
RongIMLib.getHistoryMessagesByTimestamp(
|
RongIMLib.getHistoryMessagesByTimestamp(
|
||||||
@@ -59,18 +61,16 @@ const getPendingList = (callback, total) => {
|
|||||||
|
|
||||||
// 群组申请列表,邀请列表
|
// 群组申请列表,邀请列表
|
||||||
const getGroupPendinglist = (targetId, callback) => {
|
const getGroupPendinglist = (targetId, callback) => {
|
||||||
total = total || 100
|
const conversationType = RongIMLib.ConversationType.SYSTEM
|
||||||
RongIMLib.getConversationList([RongIMLib.ConversationType.SYSTEM], total, 0, (res) => {
|
const objectNames = ['RC:ContactNtf']
|
||||||
if (res.code === 0) {
|
|
||||||
const pendings = res.conversations.filter((item) => {
|
|
||||||
return item.targetId == targetId &&
|
|
||||||
item.objectName == RongIMLib.ObjectName.ContactNotification &&
|
|
||||||
item.latestMessage.operation === 'GroupPending'
|
|
||||||
})
|
|
||||||
|
|
||||||
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
|
messageId
|
||||||
}) => {
|
}) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
if (conversationType == 3) {
|
||||||
|
RongIMLib.sendReadReceiptRequest(messageId, (res) => {
|
||||||
|
console.log('发送回执请求', res);
|
||||||
|
})
|
||||||
|
}
|
||||||
callback(messageId)
|
callback(messageId)
|
||||||
} else {
|
} else {
|
||||||
console.log('发送失败', msg);
|
console.log('发送失败', msg);
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ const contactModel = usqlite.model('contacts', {
|
|||||||
type: String,
|
type: String,
|
||||||
unique: true
|
unique: true
|
||||||
},
|
},
|
||||||
|
type: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
},
|
||||||
portraitUrl: String,
|
portraitUrl: String,
|
||||||
localAvatar: 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"
|
resolved "https://registry.npmjs.org/uni-simple-router/-/uni-simple-router-2.0.7.tgz"
|
||||||
integrity sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==
|
integrity sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA==
|
||||||
|
|
||||||
uview-ui@^2.0.19:
|
uview-ui@^2.0.27:
|
||||||
version "2.0.19"
|
version "2.0.27"
|
||||||
resolved "https://registry.npmjs.org/uview-ui/-/uview-ui-2.0.19.tgz"
|
resolved "https://registry.yarnpkg.com/uview-ui/-/uview-ui-2.0.27.tgz#1a7dde9c6246e851d768f3efd44b5fb26774a2e1"
|
||||||
integrity sha512-ddZiaP7R9wsUxMzAuhuXgh5OswgCm2lKuulTqjnRXFr0uUWsgL1iBifU3GbOwpwP0LtTHKJOo9rYv1LP0WXmzA==
|
integrity sha512-fl35rlguNPfXnwNoVv0w4zS1blFFxxSPuGR1+9SbpFGC33aiTBaoFWs/4Fppj0foS/kDCqSWcJiymNmQjPBD4g==
|
||||||
|
|
||||||
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==
|
|
||||||
|
|||||||
Reference in New Issue
Block a user