Compare commits
41 Commits
eae895f181
...
IM
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d73085bc | |||
| ca40d790b1 | |||
|
|
aadef3c148 | ||
| 81d4b9017d | |||
| 335a3aa8d6 | |||
| 9628c8ccec | |||
| dbda19870f | |||
| 04d9d772c4 | |||
| bce7822e51 | |||
| 39b8f158c0 | |||
| bf94cca533 | |||
| e8e496cf37 | |||
| 3e1275fc74 | |||
| 033d0e6317 | |||
| fb3d8ff950 | |||
| 76064b3ea2 | |||
| cd63785274 | |||
|
|
33f1899b75 | ||
|
|
76854d3714 | ||
| 1b027783ea | |||
|
|
0b61a8c7f4 | ||
|
|
17899df882 | ||
| c69722491c | |||
| e9184b90c1 | |||
| 748ff74731 | |||
| d3b33e3c26 | |||
|
|
d9f379d489 | ||
|
|
92d43c50bc | ||
| 013c030963 | |||
| 7b204e4a50 | |||
| 3a28e34c3d | |||
| ab3d5933a8 | |||
| 2a1590172e | |||
| 9bba6e4ef4 | |||
| 9d9c0cdaf8 | |||
| e0185e589d | |||
| 90584f1101 | |||
|
|
31846e54a7 | ||
|
|
75d73e9c87 | ||
|
|
81543cdcdc | ||
|
|
3ea3a2decd |
2
App.vue
2
App.vue
@@ -7,7 +7,7 @@
|
|||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
im.initIm('lmxuhwaglu76d')
|
im.initIm('lmxuhwaglu76d')
|
||||||
return
|
// return
|
||||||
//#ifdef APP-PLUS
|
//#ifdef APP-PLUS
|
||||||
// 获取系统版本号
|
// 获取系统版本号
|
||||||
getVersions({
|
getVersions({
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
# ZhHealth
|
# ZhHealth
|
||||||
|
|
||||||
ZH健康
|
ZH健康
|
||||||
|
|
||||||
|
## uni-icons图标组件
|
||||||
|
[图标组件](https://hellouniapp.dcloud.net.cn/pages/extUI/icons/icons)
|
||||||
188
components/tki-file-manager/tki-file-manager.vue
Normal file
188
components/tki-file-manager/tki-file-manager.vue
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
<template xlang="wxml" minapp="mpvue">
|
||||||
|
<view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'tki-file-manager',
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
_openFile() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (plus.os.name.toLowerCase() != "android") {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '仅支持Android平台',
|
||||||
|
success: function(res) {}
|
||||||
|
});
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
let that = this
|
||||||
|
// java 代码来自 http://www.cnblogs.com/panhouye/archive/2017/04/23/6751710.html
|
||||||
|
let main = plus.android.runtimeMainActivity();
|
||||||
|
let Intent = plus.android.importClass("android.content.Intent");
|
||||||
|
|
||||||
|
//
|
||||||
|
let fileIntent = new Intent(Intent.ACTION_GET_CONTENT)
|
||||||
|
//fileIntent.setType(“image/*”);//选择图片
|
||||||
|
//fileIntent.setType(“audio/*”); //选择音频
|
||||||
|
//fileIntent.setType(“video/*”); //选择视频 (mp4 3gp 是android支持的视频格式)
|
||||||
|
//fileIntent.setType(“video/*;image/*”);//同时选择视频和图片
|
||||||
|
fileIntent.setType("*/*"); //无类型限制
|
||||||
|
fileIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
|
main.startActivityForResult(fileIntent, 1);
|
||||||
|
// 获取回调
|
||||||
|
main.onActivityResult = function(requestCode, resultCode, data) {
|
||||||
|
let Activity = plus.android.importClass("android.app.Activity");
|
||||||
|
let ContentUris = plus.android.importClass("android.content.ContentUris");
|
||||||
|
let Cursor = plus.android.importClass("android.database.Cursor");
|
||||||
|
let Uri = plus.android.importClass("android.net.Uri");
|
||||||
|
let Build = plus.android.importClass("android.os.Build");
|
||||||
|
let Environment = plus.android.importClass("android.os.Environment");
|
||||||
|
let DocumentsContract = plus.android.importClass("android.provider.DocumentsContract");
|
||||||
|
let MediaStore = plus.android.importClass("android.provider.MediaStore");
|
||||||
|
// 给系统导入 contentResolver
|
||||||
|
let contentResolver = main.getContentResolver()
|
||||||
|
plus.android.importClass(contentResolver);
|
||||||
|
// 返回路径
|
||||||
|
let path = '';
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
let uri = data.getData()
|
||||||
|
|
||||||
|
if ("file" == uri.getScheme().toLowerCase()) { //使用第三方应用打开
|
||||||
|
path = uri.getPath();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) { //4.4以后
|
||||||
|
path = getPath(this, uri);
|
||||||
|
} else { //4.4以下下系统调用方法
|
||||||
|
path = getRealPathFromURI(uri)
|
||||||
|
}
|
||||||
|
// 回调
|
||||||
|
that.$emit('result', path)
|
||||||
|
}
|
||||||
|
// 4.4 以上 从Uri 获取文件绝对路径
|
||||||
|
function getPath(context, uri) {
|
||||||
|
let isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||||
|
let scheme = uri.getScheme().toLowerCase()
|
||||||
|
|
||||||
|
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
|
||||||
|
// ExternalStorageProvider
|
||||||
|
if (isExternalStorageDocument(uri)) {
|
||||||
|
let docId = DocumentsContract.getDocumentId(uri);
|
||||||
|
let split = docId.split(":");
|
||||||
|
let type = split[0];
|
||||||
|
// 如果是手机内部存储
|
||||||
|
if ("primary" == type.toLowerCase()) {
|
||||||
|
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||||
|
} else {
|
||||||
|
return '/storage/' + type + "/" + split[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// DownloadsProvider
|
||||||
|
else if (isDownloadsDocument(uri)) {
|
||||||
|
let docId = DocumentsContract.getDocumentId(uri);
|
||||||
|
let split = docId.split(":");
|
||||||
|
return split[1]
|
||||||
|
// console.log(id)
|
||||||
|
// let contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), id);
|
||||||
|
// return getDataColumn(context, contentUri, null, null);
|
||||||
|
}
|
||||||
|
// MediaProvider
|
||||||
|
else if (isMediaDocument(uri)) {
|
||||||
|
let docId = DocumentsContract.getDocumentId(uri);
|
||||||
|
let split = docId.split(":");
|
||||||
|
let type = split[0];
|
||||||
|
let contentUri = null;
|
||||||
|
if ("image" == type.toLowerCase()) {
|
||||||
|
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||||
|
} else if ("video" == type.toLowerCase()) {
|
||||||
|
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||||
|
} else if ("audio" == type.toLowerCase()) {
|
||||||
|
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||||
|
}
|
||||||
|
let selection = "_id=?";
|
||||||
|
let selectionArgs = [split[1]];
|
||||||
|
return getDataColumn(context, contentUri, selection, selectionArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// MediaStore (and general)
|
||||||
|
else if ("content" == scheme) {
|
||||||
|
return getDataColumn(context, uri, null, null);
|
||||||
|
}
|
||||||
|
// File
|
||||||
|
else if ("file" == scheme) {
|
||||||
|
return uri.getPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 4.4 以下 获取 绝对路径
|
||||||
|
function getRealPathFromURI(uri) {
|
||||||
|
let res = null
|
||||||
|
let proj = [MediaStore.Images.Media.DATA]
|
||||||
|
let cursor = contentResolver.query(uri, proj, null, null, null);
|
||||||
|
if (null != cursor && cursor.moveToFirst()) {
|
||||||
|
;
|
||||||
|
let column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||||
|
res = cursor.getString(column_index);
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// 通过uri 查找出绝对路径
|
||||||
|
function getDataColumn(context, uri, selection, selectionArgs) {
|
||||||
|
let cursor = null;
|
||||||
|
let column = "_data";
|
||||||
|
let projection = [column];
|
||||||
|
// let contentResolver = context.getContentResolver()
|
||||||
|
// plus.android.importClass(contentResolver);
|
||||||
|
cursor = contentResolver.query(uri, projection, selection, selectionArgs, null);
|
||||||
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
|
let column_index = cursor.getColumnIndexOrThrow(column);
|
||||||
|
return cursor.getString(column_index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isExternalStorageDocument(uri) {
|
||||||
|
return "com.android.externalstorage.documents" == uri.getAuthority() ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDownloadsDocument(uri) {
|
||||||
|
return "com.android.providers.downloads.documents" == uri.getAuthority() ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMediaDocument(uri) {
|
||||||
|
return "com.android.providers.media.documents" == uri.getAuthority() ? true : false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '仅支持Android平台',
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// plus.io.resolveLocalFileSystemURL( '/storage/emulated/0', function(fs) {
|
||||||
|
// var directoryReader = fs.createReader();
|
||||||
|
// directoryReader.readEntries(function(entries) {
|
||||||
|
// var i;
|
||||||
|
// for (i = 0; i < entries.length; i++) {
|
||||||
|
// console.log(entries[i].name);
|
||||||
|
// }
|
||||||
|
// }, function(e) {
|
||||||
|
// console.log("Read entries failed: " + e.message);
|
||||||
|
// });
|
||||||
|
// }, function(e) {
|
||||||
|
// console.log("Request file system failed: " + e.message);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
25
main.js
25
main.js
@@ -10,15 +10,16 @@ import Vue from 'vue'
|
|||||||
import store from './store'
|
import store from './store'
|
||||||
import uView from 'uview-ui'
|
import uView from 'uview-ui'
|
||||||
import filters from './utils/filters.js'
|
import filters from './utils/filters.js'
|
||||||
import {
|
|
||||||
usqlite
|
|
||||||
} from '@/uni_modules/onemue-USQLite/js_sdk/usqlite.js'
|
|
||||||
import model from '@/utils/im/models.js'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
router,
|
router,
|
||||||
RouterMount
|
RouterMount
|
||||||
} from 'router'
|
} from 'router'
|
||||||
|
import {
|
||||||
|
usqlite
|
||||||
|
} from '@/uni_modules/onemue-USQLite/js_sdk/usqlite.js'
|
||||||
|
import {
|
||||||
|
contactModel
|
||||||
|
} from '@/utils/im/models.js'
|
||||||
|
|
||||||
Object.keys(filters).forEach(key => {
|
Object.keys(filters).forEach(key => {
|
||||||
Vue.filter(key, filters[key])
|
Vue.filter(key, filters[key])
|
||||||
@@ -29,12 +30,20 @@ Vue.use(router)
|
|||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.prototype.$store = store
|
Vue.prototype.$store = store
|
||||||
uni.$sql = usqlite
|
|
||||||
uni.model = model
|
|
||||||
|
|
||||||
uni.$sql.connect({
|
uni.$sql = usqlite.connect({
|
||||||
name: 'zh-health', // 数据库名称
|
name: 'zh-health', // 数据库名称
|
||||||
path: '_doc/health.db', // 路径
|
path: '_doc/health.db', // 路径
|
||||||
|
}, (err, res) => {
|
||||||
|
uni.getStorage({
|
||||||
|
key: 'FIRST_RUN',
|
||||||
|
fail: () => {
|
||||||
|
contactModel.create((err, res) => {
|
||||||
|
console.error('SQLITE 创建表格', err, res)
|
||||||
|
uni.setStorageSync('FIRST_RUN', true)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name" : "ZH-HEALTH",
|
"name" : "ZH-HEALTH",
|
||||||
"appid" : "__UNI__C29473D",
|
"appid" : "__UNI__C29473D",
|
||||||
"description" : "ZH-HEALTH,您手上的健康管理专家",
|
"description" : "ZH-HEALTH,您手上的健康管理专家",
|
||||||
"versionName" : "1.0.17",
|
"versionName" : "1.0.22",
|
||||||
"versionCode" : 100,
|
"versionCode" : 100,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
|
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||||
@@ -59,7 +60,15 @@
|
|||||||
"autoSdkPermissions" : true
|
"autoSdkPermissions" : true
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {},
|
"ios" : {
|
||||||
|
"privacyDescription" : {
|
||||||
|
"NSMicrophoneUsageDescription" : "发送语音消息以及音视频通话",
|
||||||
|
"NSCameraUsageDescription" : "发送图文消息以及视频通话",
|
||||||
|
"NSPhotoLibraryUsageDescription" : "发送图文消息",
|
||||||
|
"NSPhotoLibraryAddUsageDescription" : "保存图片消息",
|
||||||
|
"NSLocationWhenInUseUsageDescription" : "发送当前位置信息"
|
||||||
|
}
|
||||||
|
},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs" : {
|
"sdkConfigs" : {
|
||||||
"oauth" : {
|
"oauth" : {
|
||||||
@@ -89,7 +98,7 @@
|
|||||||
"amap" : {
|
"amap" : {
|
||||||
"__platform__" : [ "android" ],
|
"__platform__" : [ "android" ],
|
||||||
"appkey_ios" : "",
|
"appkey_ios" : "",
|
||||||
"appkey_android" : "05b7f32ca9c897c8b63c505d92cd654b"
|
"appkey_android" : "1dfbe526a37dcb1f13263e0b5871ca4d"
|
||||||
},
|
},
|
||||||
"system" : {
|
"system" : {
|
||||||
"__platform__" : [ "android" ]
|
"__platform__" : [ "android" ]
|
||||||
@@ -98,7 +107,7 @@
|
|||||||
"maps" : {
|
"maps" : {
|
||||||
"amap" : {
|
"amap" : {
|
||||||
"appkey_ios" : "",
|
"appkey_ios" : "",
|
||||||
"appkey_android" : "05b7f32ca9c897c8b63c505d92cd654b"
|
"appkey_android" : "1dfbe526a37dcb1f13263e0b5871ca4d"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,6 +142,9 @@
|
|||||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"splashscreen" : {
|
||||||
|
"androidStyle" : "common"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nativePlugins" : {
|
"nativePlugins" : {
|
||||||
|
|||||||
14
pages.json
14
pages.json
@@ -373,6 +373,18 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/im/private/chat",
|
"path": "pages/im/private/chat",
|
||||||
"style": {
|
"style": {
|
||||||
|
"navigationBarTitleText": "",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"type": "default",
|
||||||
|
"buttons": [{
|
||||||
|
"float": "right",
|
||||||
|
"fontSrc": "/static/iconfont.ttf",
|
||||||
|
"text": "\ue607",
|
||||||
|
"fontSize": "20px"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -418,7 +430,7 @@
|
|||||||
"path": "pages/im/friends/info",
|
"path": "pages/im/friends/info",
|
||||||
"name": "imFriendsInfo",
|
"name": "imFriendsInfo",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "用户资料"
|
"navigationBarTitleText": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
pages/.DS_Store
vendored
BIN
pages/.DS_Store
vendored
Binary file not shown.
@@ -7,33 +7,36 @@
|
|||||||
<view class="preview" v-if="msg.objectName=='RC:TxtMsg'">
|
<view class="preview" v-if="msg.objectName=='RC:TxtMsg'">
|
||||||
<text v-if="conversationType == 3">{{ user.name }}:</text>{{ msg.content || '' }}
|
<text v-if="conversationType == 3">{{ user.name }}:</text>{{ msg.content || '' }}
|
||||||
</view>
|
</view>
|
||||||
<view class="preview" v-if="msg.objectName=='RC:HQVCMsg'">
|
<view class="preview" v-else-if="msg.objectName=='RC:HQVCMsg'">
|
||||||
<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:ImgMsg'">
|
<view class="preview" v-else-if="msg.objectName=='RC:ImgMsg'">
|
||||||
<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:GIFMsg'">
|
<view class="preview" v-else-if="msg.objectName=='RC:GIFMsg'">
|
||||||
<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:FileMsg'">
|
<view class="preview" v-else-if="msg.objectName=='RC:FileMsg'">
|
||||||
<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:LBSMsg'">
|
<view class="preview" v-else-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:InfoNtf' && JSON.parse(msg.message).mediaType==0">
|
<view class="preview" v-else-if="msg.objectName=='RC:AudioMsg'">
|
||||||
<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:InfoNtf' && JSON.parse(msg.message).mediaType==1">
|
<view class="preview" v-else-if="msg.objectName=='RC:VideoMsg'">
|
||||||
<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-else-if="msg.objectName=='RC:GrpNtf'">
|
||||||
[{{ msg.message }}]
|
[{{ msg.message }}]
|
||||||
</view>
|
</view>
|
||||||
<view class="preview" v-if="msg.objectName=='RC:RcNtf'">
|
<view class="preview" v-else-if="msg.objectName=='RC:RcNtf'">
|
||||||
<text v-if="conversationType == 3">{{ user.name }}:</text> 撤回了一条消息
|
<text v-if="conversationType == 3">{{ user.name }}:</text> 撤回了一条消息
|
||||||
</view>
|
</view>
|
||||||
|
<view class="preview" v-else>
|
||||||
|
{{ msg.objectName }}
|
||||||
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -18,9 +18,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="loadmore">
|
<view class="loadmore" @click="loadMore" v-if="members > users.length">
|
||||||
<u-icon name="arrow-right" @click="loadMore" v-if="members > users.length" color="#999" labelColor="#999"
|
查看更多群成员 <uni-icons size="30rpx" type="right"></uni-icons>
|
||||||
label="查看更多群成员" labelPos="left" :labelSize="labelSize" :size="iconSize" />
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<u-action-sheet :actions="actionMap" :title="actionTitle" cancelText="取消" @close="hideAction"
|
<u-action-sheet :actions="actionMap" :title="actionTitle" cancelText="取消" @close="hideAction"
|
||||||
@@ -66,14 +65,11 @@
|
|||||||
actionMap: [],
|
actionMap: [],
|
||||||
actionTitle: '',
|
actionTitle: '',
|
||||||
currentUser: {},
|
currentUser: {},
|
||||||
avatarSize: 40,
|
|
||||||
labelSize: 14,
|
labelSize: 14,
|
||||||
iconSize: 14
|
iconSize: 14
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.avatarSize = utils.rpx2px(84)
|
|
||||||
this.labelSize = utils.rpx2px(24)
|
|
||||||
this.iconSize = utils.rpx2px(26)
|
this.iconSize = utils.rpx2px(26)
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -324,12 +320,16 @@
|
|||||||
|
|
||||||
.loadmore {
|
.loadmore {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: $text-gray-m;
|
color: $text-gray-m !important;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.uni-icons {
|
||||||
|
color: $text-gray-m !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
87
pages/im/components/sent/sentEmoji.vue
Normal file
87
pages/im/components/sent/sentEmoji.vue
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<view class="emoji--lay" v-show="show">
|
||||||
|
<scroll-view class="scroll" :scroll-y="true">
|
||||||
|
<view class="emoji-flex">
|
||||||
|
<view class="item" v-for="(item, index) in emojiArr" :key="index" @click="$emit('onEmoji', item)">
|
||||||
|
{{item.emoji}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="tool">
|
||||||
|
<!-- <view class="item" @click="$emit('delete')">删除</view> -->
|
||||||
|
<view class="item sent" @click="$emit('sent')">发送</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import emoji from '@/static/im/emoji'
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: () => {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
emojiArr: emoji
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.emoji--lay {
|
||||||
|
height: 600rpx;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.scroll {
|
||||||
|
height: 600rpx;
|
||||||
|
|
||||||
|
.emoji-flex {
|
||||||
|
padding: 15rpx 15rpx 120rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
margin: 10rpx 15rpx;
|
||||||
|
font-size: 52rpx;
|
||||||
|
width: calc(12.5% - 30rpx);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tool {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-image: linear-gradient(to top, #FFF, rgba(255, 255, 255, .0));
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding: 20rpx 30rpx 30rpx;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
line-height: 70rpx;
|
||||||
|
border-radius: 35rpx;
|
||||||
|
width: 140rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
background: white;
|
||||||
|
border: solid 1rpx #f5f5f5;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&.sent {
|
||||||
|
border-color: #34CE98;
|
||||||
|
background: #34CE98;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
<text class="text">文件</text>
|
<text class="text">文件</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<tki-file-manager ref="filemanager" @result="sendFileMessage"></tki-file-manager>
|
||||||
|
|
||||||
<u-action-sheet :actions="callActions" cancelText="取消" @close="callShow = false" @select="singleCall"
|
<u-action-sheet :actions="callActions" cancelText="取消" @close="callShow = false" @select="singleCall"
|
||||||
:show="callShow">
|
:show="callShow">
|
||||||
</u-action-sheet>
|
</u-action-sheet>
|
||||||
@@ -34,11 +36,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import im from '@/utils/im/index.js'
|
import im from '@/utils/im/index.js'
|
||||||
import imBase from '../../mixins/imBase.js'
|
import imBase from '../../mixins/imBase.js'
|
||||||
|
import tkiFileManager from "@/components/tki-file-manager/tki-file-manager.vue"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [
|
mixins: [
|
||||||
imBase
|
imBase
|
||||||
],
|
],
|
||||||
|
components: {
|
||||||
|
tkiFileManager
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
callActions: [{
|
callActions: [{
|
||||||
@@ -68,6 +74,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
sendFileMessage(path) {
|
||||||
|
if (path) {
|
||||||
|
im.sentFile(this.conversationType, this.targetId, path).then(res => {
|
||||||
|
this.success()
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '发送文件失败' + err
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '选择文件失败'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
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 +
|
||||||
@@ -81,8 +104,13 @@
|
|||||||
count: 9,
|
count: 9,
|
||||||
sourceType: ['album'],
|
sourceType: ['album'],
|
||||||
success: res => {
|
success: res => {
|
||||||
im.sentImage(this.conversationType, this.targetId, res.tempFilePaths[0],
|
let funs = []
|
||||||
this.sender, (res) => {
|
res.tempFilePaths.map((item, index) => {
|
||||||
|
funs[index] = im.sentImage(this.conversationType, this
|
||||||
|
.targetId, item)
|
||||||
|
})
|
||||||
|
|
||||||
|
Promise.all(funs).then(res => {
|
||||||
this.success()
|
this.success()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -92,8 +120,8 @@
|
|||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
sourceType: ['camera'],
|
sourceType: ['camera'],
|
||||||
success: res => {
|
success: res => {
|
||||||
im.sentImage(this.conversationType, this.targetId, res.tempFilePaths[0],
|
im.sentImage(this.conversationType, this.targetId, res.tempFilePaths[0])
|
||||||
this.sender, (res) => {
|
.then((res) => {
|
||||||
this.success()
|
this.success()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -103,16 +131,16 @@
|
|||||||
this.callShow = true
|
this.callShow = true
|
||||||
break;
|
break;
|
||||||
case 'location':
|
case 'location':
|
||||||
// uni.showToast({
|
uni.chooseLocation({
|
||||||
// icon: 'none',
|
success: (location) => {
|
||||||
// title: '功能正在开发中'
|
const thumbnail = ''
|
||||||
// })
|
// 通过 location 的经纬度,合成一张图片,再把图片的base64发送出去
|
||||||
// uni.chooseLocation({
|
im.sentLocation(this.conversationType, this.targetId, location, thumbnail)
|
||||||
// success: res => {
|
.then(() => {
|
||||||
// console.log(res);
|
this.success()
|
||||||
// // this.success()
|
})
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
break;
|
break;
|
||||||
case 'redpacket':
|
case 'redpacket':
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -121,10 +149,7 @@
|
|||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'file':
|
||||||
uni.showToast({
|
this.$refs.filemanager._openFile()
|
||||||
icon: 'none',
|
|
||||||
title: '功能正在开发中'
|
|
||||||
})
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="sent--text">
|
<view class="sent--text">
|
||||||
<input class="input" type="text" :auto-blur="true" @focus="focus" @blur="blur" :focus="focusState"
|
<input class="input" type="text" :auto-blur="true" :focus="focusState" v-model="inputTxt" confirm-type="send"
|
||||||
v-model="inputTxt" confirm-type="send" @confirm="sent" cursor-spacing="10" />
|
cursor-spacing="10" @focus="focus" @blur="blur" @confirm="sent" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.inputTxt.length === 0
|
return this.inputTxt.length === 0
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({
|
RongIMLib.getTextMessageDraft(this.conversationType, this.targetId, ({
|
||||||
@@ -46,10 +46,16 @@
|
|||||||
inputTxt: ''
|
inputTxt: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
uni.$on('emojiValue', res => {
|
||||||
|
this.inputTxt = res.value
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
sent() {
|
sent() {
|
||||||
if (!this.disabled) {
|
if (!this.disabled) {
|
||||||
im.sentText(this.conversationType, this.targetId, this.inputTxt, this.sender, () => {
|
im.sentText(this.conversationType, this.targetId, this.inputTxt).then(() => {
|
||||||
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
RongIMLib.clearTextMessageDraft(this.conversationType, this.targetId)
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
this.inputTxt = ''
|
this.inputTxt = ''
|
||||||
@@ -59,10 +65,13 @@
|
|||||||
focus() {
|
focus() {
|
||||||
this.$emit('focus')
|
this.$emit('focus')
|
||||||
},
|
},
|
||||||
blur() {
|
blur(e) {
|
||||||
uni.hideKeyboard()
|
uni.hideKeyboard()
|
||||||
this.$emit('blur')
|
this.$emit('blur', e.detail)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
uni.$off('emojiValue')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -72,10 +81,11 @@
|
|||||||
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: 460rpx;
|
width: 400rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin-right: 15rpx;
|
margin-right: 15rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="send--voice">
|
<view class="send--voice">
|
||||||
<view class="voice" hover-class="chat-hover" @touchstart="startRecord" @touchend="stopRecord" @touchmove="touchmove">
|
<view class="voice" hover-class="chat-hover" @touchstart="startRecord" @touchend="stopRecord"
|
||||||
|
@touchmove="touchmove">
|
||||||
<text class="button">按住 说话</text>
|
<text class="button">按住 说话</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 录音层 -->
|
<!-- 录音层 -->
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
maxRecordTime: 60,
|
maxRecordTime: 60,
|
||||||
recorderManager: null,
|
recorderManager: null,
|
||||||
mp3AudioSrc: null,
|
mp3AudioSrc: null,
|
||||||
|
isMoveCancel: false,
|
||||||
isBetaPlay: false, // 暂时无用
|
isBetaPlay: false, // 暂时无用
|
||||||
startOffsetTop: 0
|
startOffsetTop: 0
|
||||||
}
|
}
|
||||||
@@ -69,7 +71,6 @@
|
|||||||
this.getAndroidPermission().then(code => {
|
this.getAndroidPermission().then(code => {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
this.showConfirm = true
|
|
||||||
this.startOffsetTop = e.target.offsetTop
|
this.startOffsetTop = e.target.offsetTop
|
||||||
this.showRecordTip = true
|
this.showRecordTip = true
|
||||||
this.recorderManager.start()
|
this.recorderManager.start()
|
||||||
@@ -104,6 +105,18 @@
|
|||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
// 监听录音结束
|
// 监听录音结束
|
||||||
this.recorderManager.onStop(res => {
|
this.recorderManager.onStop(res => {
|
||||||
|
if (this.isMoveCancel) {
|
||||||
|
this.isMoveCancel = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ((this.maxRecordTime - this.recordTime) <= 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '说话时间太短',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
this.showRecordTip = false
|
||||||
|
return
|
||||||
|
}
|
||||||
this.mp3AudioSrc = res.tempFilePath
|
this.mp3AudioSrc = res.tempFilePath
|
||||||
this.showRecordTip = false
|
this.showRecordTip = false
|
||||||
this.senVoice()
|
this.senVoice()
|
||||||
@@ -120,11 +133,12 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
im.sentVoice(this.conversationType, this.targetId, this.mp3AudioSrc, (this.maxRecordTime -
|
im.sentVoice(this.conversationType, this.targetId, this.mp3AudioSrc, (this.maxRecordTime -
|
||||||
this.recordTime), this.sender, () => {
|
this.recordTime)).then(() => {
|
||||||
this.recordTime = this.maxRecordTime
|
this.recordTime = this.maxRecordTime
|
||||||
this.mp3AudioSrc = null
|
this.mp3AudioSrc = null
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$emit('success')
|
this.$emit('success')
|
||||||
|
this.toastAudiMp3()
|
||||||
}, 500)
|
}, 500)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -132,9 +146,10 @@
|
|||||||
touchmove(e) {
|
touchmove(e) {
|
||||||
if (this.startOffsetTop - e.changedTouches[0].pageY > 100) {
|
if (this.startOffsetTop - e.changedTouches[0].pageY > 100) {
|
||||||
if (this.showRecordTip) {
|
if (this.showRecordTip) {
|
||||||
|
this.isMoveCancel = true
|
||||||
this.showRecordTip = false
|
this.showRecordTip = false
|
||||||
clearInterval(this.interval)
|
|
||||||
this.recorderManager.stop()
|
this.recorderManager.stop()
|
||||||
|
clearInterval(this.interval)
|
||||||
this.recordTime = this.maxRecordTime
|
this.recordTime = this.maxRecordTime
|
||||||
this.mp3AudioSrc = null
|
this.mp3AudioSrc = null
|
||||||
return
|
return
|
||||||
@@ -164,6 +179,16 @@
|
|||||||
this.isBetaPlay = false;
|
this.isBetaPlay = false;
|
||||||
betaAudio.destroy()
|
betaAudio.destroy()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
// 播放提示音乐
|
||||||
|
toastAudiMp3() {
|
||||||
|
let toastAudio = uni.createInnerAudioContext()
|
||||||
|
toastAudio.src = require('@/static/im/toast/sentVoice.mp3')
|
||||||
|
toastAudio.autoplay = true
|
||||||
|
toastAudio.volume = .1
|
||||||
|
toastAudio.onEnded(() => {
|
||||||
|
toastAudio.destroy()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,15 +223,18 @@
|
|||||||
line-height: 70rpx;
|
line-height: 70rpx;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 500rpx;
|
width: 400rpx;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin-right: 15rpx;
|
margin-right: 15rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lay {
|
.lay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -216,11 +244,13 @@
|
|||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
.lay-header {
|
.lay-header {
|
||||||
height: calc(100vh - 140px);
|
height: calc(100vh - 140px);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
display: flex;
|
display: flex;
|
||||||
background: rgba(0, 0, 0, .6);
|
background: rgba(0, 0, 0, .6);
|
||||||
@@ -232,6 +262,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 88rpx;
|
width: 88rpx;
|
||||||
height: 88rpx;
|
height: 88rpx;
|
||||||
@@ -243,11 +274,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lay-toast {
|
.lay-toast {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: rgba($color: #fff, $alpha: .8);
|
color: rgba($color: #fff, $alpha: .8);
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lay-footer {
|
.lay-footer {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
@@ -261,10 +294,12 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.lay-footer-icon {
|
.lay-footer-icon {
|
||||||
width: 58rpx;
|
width: 58rpx;
|
||||||
height: 58rpx;
|
height: 58rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lay-footer-text {
|
.lay-footer-text {
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
color: gray;
|
color: gray;
|
||||||
|
|||||||
@@ -7,11 +7,19 @@
|
|||||||
<image class="icon" src="@/static/icon/msg-icon.png" v-if="chatType === 1" mode="widthFix" />
|
<image class="icon" src="@/static/icon/msg-icon.png" v-if="chatType === 1" mode="widthFix" />
|
||||||
</view>
|
</view>
|
||||||
<sent-voice v-if="chatType === 0" :conversationType="conversationType" :targetId="targetId" @success="onSuccess" />
|
<sent-voice v-if="chatType === 0" :conversationType="conversationType" :targetId="targetId" @success="onSuccess" />
|
||||||
<sent-text v-if="chatType === 1" :conversationType="conversationType" :targetId="targetId" @success="onSuccess" />
|
<sent-text ref="textView" v-if="chatType === 1" :conversationType="conversationType" :targetId="targetId" @success="onSuccess" @blur="onBlur" />
|
||||||
<view class="msg-type msg-popups" @click="showPopups = !showPopups"> <image class="icon" src="@/static/icon/popups-icon.png" /> </view>
|
<view class="msg-type msg-popups" @click="onShowEmoji">
|
||||||
|
<image class="icon" src="@/static/icon/emoji-icon.png" />
|
||||||
|
<!-- 考虑唤起键盘,暂时保留v-show -->
|
||||||
|
<!-- <image v-show="!showEmoji" class="icon" src="@/static/icon/emoji-icon.png" /> -->
|
||||||
|
<!-- <image v-show="showEmoji" class="icon" src="@/static/icon/key-icon.png" /> -->
|
||||||
|
</view>
|
||||||
|
<view class="msg-type msg-popups" @click="() => {showPopups = !showPopups, showEmoji = false}"> <image class="icon" src="@/static/icon/popups-icon.png" /> </view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 弹出层 -->
|
<!-- 弹出层 -->
|
||||||
<sent-popups :show="showPopups" :conversationType="conversationType" :targetId="targetId" @success="() => {showPopups = false, onSuccess()}" />
|
<sent-popups :show="showPopups" :conversationType="conversationType" :targetId="targetId" @success="() => {showPopups = false, onSuccess()}" />
|
||||||
|
<!-- 表情包 -->
|
||||||
|
<sent-emoji :show="showEmoji" @onEmoji="onEmoji" @delete="onDelete" @sent="onSent"></sent-emoji>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -19,6 +27,7 @@
|
|||||||
import sentText from './sent/sentText'
|
import sentText from './sent/sentText'
|
||||||
import sentVoice from './sent/sentVoice'
|
import sentVoice from './sent/sentVoice'
|
||||||
import sentPopups from './sent/sentPopups'
|
import sentPopups from './sent/sentPopups'
|
||||||
|
import sentEmoji from './sent/sentEmoji'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@@ -34,27 +43,69 @@
|
|||||||
components: {
|
components: {
|
||||||
sentText,
|
sentText,
|
||||||
sentVoice,
|
sentVoice,
|
||||||
sentPopups
|
sentPopups,
|
||||||
|
sentEmoji
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chatType : 1, // 0 语音,1 文本
|
chatType : 1, // 0 语音,1 文本
|
||||||
showPopups: false
|
showPopups : false,
|
||||||
|
showEmoji : false,
|
||||||
|
chatText : {
|
||||||
|
value : "",
|
||||||
|
cursor : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 切换聊天类型,语音/文本
|
// 切换聊天类型,语音/文本
|
||||||
changeMessageType() {
|
changeMessageType() {
|
||||||
this.chatType = this.chatType === 1 ? 0 : 1
|
this.chatType = this.chatType === 1 ? 0 : 1
|
||||||
|
if(this.showEmoji) this.showEmoji = false
|
||||||
|
if(this.showPopups) this.showPopups = false
|
||||||
},
|
},
|
||||||
onSuccess() {
|
onSuccess() {
|
||||||
this.$emit('onSuccess')
|
this.$emit('onSuccess')
|
||||||
|
this.chatText = { value: "", cursor: 0}
|
||||||
},
|
},
|
||||||
// 处理弹出层
|
// 处理弹出层
|
||||||
onHidePopus(){
|
onHidePopus(){
|
||||||
if(this.showPopups){
|
if(this.showPopups){
|
||||||
this.showPopups = false
|
this.showPopups = false
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 输入表情
|
||||||
|
onEmoji(e){
|
||||||
|
let atMsg = this.chatText
|
||||||
|
let newMsg = () => {
|
||||||
|
return atMsg.value.slice(0, atMsg.cursor) + e.emoji + atMsg.value.slice(atMsg.cursor)
|
||||||
|
}
|
||||||
|
atMsg.value = newMsg()
|
||||||
|
atMsg.cursor += 2
|
||||||
|
// 全局通讯
|
||||||
|
uni.$emit('emojiValue', atMsg)
|
||||||
|
},
|
||||||
|
// 删除表情
|
||||||
|
onDelete(){
|
||||||
|
console.log('删除')
|
||||||
|
},
|
||||||
|
// 发送消息
|
||||||
|
onSent(){
|
||||||
|
this.$refs.textView.sent()
|
||||||
|
this.chatText = {
|
||||||
|
value : "",
|
||||||
|
cursor : 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取输入框文字最新状态
|
||||||
|
onBlur(e){
|
||||||
|
this.chatText = e
|
||||||
|
},
|
||||||
|
// 显示emoji表情
|
||||||
|
onShowEmoji(){
|
||||||
|
this.showEmoji = !this.showEmoji
|
||||||
|
this.chatType = 1
|
||||||
|
if(this.showPopups) this.showPopups = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,12 @@
|
|||||||
<view v-if="!isRemote">
|
<view v-if="!isRemote">
|
||||||
<view class="state" v-if="isGroup">
|
<view class="state" v-if="isGroup">
|
||||||
<!-- 已发送 -->
|
<!-- 已发送 -->
|
||||||
<u-icon name="checkbox-mark" :size="iconSize" class="sent"
|
<uni-icons class="sent" type="checkmarkempty" size="28rpx" :color="message.sentStatus >= 30 ? '#34CE98' : '#999999'" />
|
||||||
:color="message.sentStatus >= 30 ? '#34CE98' : '#999999' " />
|
|
||||||
<!-- 已阅读 -->
|
|
||||||
<text class="readers">{{ readers }}</text>
|
<text class="readers">{{ readers }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="state" v-else>
|
<view class="state" v-else>
|
||||||
<!-- 已发送 -->
|
<uni-icons class="sent" type="checkmarkempty" size="28rpx" :color="message.sentStatus >= 30 ? '#34CE98' : '#999999'" />
|
||||||
<u-icon name="checkbox-mark" :size="iconSize" class="sent"
|
<uni-icons class="receive" type="checkmarkempty" size="28rpx" :color="message.sentStatus >= 50 ? '#34CE98' : '#999999'" />
|
||||||
:color="message.sentStatus >= 30 ? '#34CE98' : '#999999' " />
|
|
||||||
<!-- 已阅读 -->
|
|
||||||
<u-icon name="checkbox-mark" :size="iconSize" class="receive"
|
|
||||||
:color="message.sentStatus >= 50 ? '#34CE98' : '#999999' " />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<view class="msg--call">
|
<view class="msg--call">
|
||||||
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||||
<view class="im--text" :class="isRemote ? 'left': 'right'">
|
<view class="im--text" :class="isRemote ? 'left': 'right'">
|
||||||
<u-icon name="camera" size="22" v-if="msg.mediaType == 1" :label="label" />
|
<uni-icons type="phone" size="44rpx" />
|
||||||
<u-icon name="phone" size="22" v-else :label="label" />
|
{{ label }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -17,7 +17,6 @@
|
|||||||
mixins: [
|
mixins: [
|
||||||
imBase
|
imBase
|
||||||
],
|
],
|
||||||
name: 'showText',
|
|
||||||
props: {
|
props: {
|
||||||
message: {
|
message: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -30,23 +29,18 @@
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
msg() {
|
|
||||||
return JSON.parse(this.message.content.message)
|
|
||||||
},
|
|
||||||
label() {
|
label() {
|
||||||
return this.msg.connected ? '通话时长:' + duration : '未接通'
|
return this.message.content.customFields.status == 1 ? '通话时长:' + duration : '未接通'
|
||||||
},
|
},
|
||||||
isRemote() {
|
isRemote() {
|
||||||
return this.message.messageDirection == 2
|
return this.message.messageDirection == 2
|
||||||
},
|
},
|
||||||
duration() {
|
duration() {
|
||||||
if (this.message.duration > 3600) {
|
if (this.message.content.customFields.duration > 3600) {
|
||||||
return moment.utc(this.message.duration * 1000).format('HH:mm:ss')
|
return moment.utc(this.message.content.customFields.duration * 1000).format('HH:mm:ss')
|
||||||
} else {
|
} else {
|
||||||
return moment.utc(this.message.duration * 1000).format('mm:ss')
|
return moment.utc(this.message.content.customFields.duration * 1000).format('mm:ss')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,6 +63,7 @@
|
|||||||
color: $text-color;
|
color: $text-color;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
&.left {
|
&.left {
|
||||||
border-radius: 0 20rpx 20rpx 20rpx;
|
border-radius: 0 20rpx 20rpx 20rpx;
|
||||||
@@ -80,8 +75,8 @@
|
|||||||
background: $main-color;
|
background: $main-color;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
.u-icon {
|
.uni-icons {
|
||||||
color: white;
|
color: white !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
95
pages/im/components/show/showFile.vue
Normal file
95
pages/im/components/show/showFile.vue
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<view class="msg--file">
|
||||||
|
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
||||||
|
|
||||||
|
<view class="">
|
||||||
|
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||||
|
<view class="file" :class="isRemote ? 'left': 'right'">
|
||||||
|
<view class="img">
|
||||||
|
{{ content.fileType }}
|
||||||
|
{{ content.name }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- "content": {
|
||||||
|
"fileType": "jpg",
|
||||||
|
"remote": "https://rongcloud-spic.ronghub.com/Xl1PRVpHVldeRQAGVgEHAAcBBgYGBgcDAwMGMjA3MA%3D%3D.jpg?e=1661583313&token=livk5rb3__JZjCtEiMxXpQ8QscLxbNLehwhHySnX:t58hs4uvM1RFsBeKLTcDbVW-k5w=",
|
||||||
|
"size": 347062,
|
||||||
|
"objectName": "RC:FileMsg",
|
||||||
|
"name": "Screenshot_2022-02-25-14-44-55-886_io.zhhealth.app.jpg",
|
||||||
|
"local": "file:///storage/emulated/0/DCIM/Screenshots/Screenshot_2022-02-25-14-44-55-886_io.zhhealth.app.jpg",
|
||||||
|
"userInfo": {
|
||||||
|
"userId": "10051",
|
||||||
|
"name": "Jason.电信",
|
||||||
|
"extra": "",
|
||||||
|
"portraitUrl": "http://storage.zh.shangkelian.cn/uploads/2022/02/16/29b13f5301694721ad7acd8b8b67bbd9.jpg"
|
||||||
|
}
|
||||||
|
}, -->
|
||||||
|
<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
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isRemote() {
|
||||||
|
return this.message.messageDirection == 2
|
||||||
|
},
|
||||||
|
content() {
|
||||||
|
return this.message.content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.msg--file {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: $text-gray-m;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file {
|
||||||
|
.img {
|
||||||
|
width: 180rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.left {
|
||||||
|
.img {
|
||||||
|
border-radius: 0 10rpx 10rpx 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right {
|
||||||
|
.img {
|
||||||
|
border-radius: 10rpx 0 10rpx 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
||||||
112
pages/im/components/show/showLocation.vue
Normal file
112
pages/im/components/show/showLocation.vue
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
<template>
|
||||||
|
<view class="msg--location">
|
||||||
|
<message-state :message="message" :isGroup="isGroup" :isRemote="isRemote" />
|
||||||
|
|
||||||
|
<view class="">
|
||||||
|
<view class="name" v-if="isGroup && isRemote">{{ contact(message.senderUserId).name }}</view>
|
||||||
|
<view class="location" :class="isRemote ? 'left': 'right'" @click="showLocation">
|
||||||
|
<view class="location--name">
|
||||||
|
{{ content.customFields.name }}
|
||||||
|
</view>
|
||||||
|
<view class="location--address">
|
||||||
|
{{ content.customFields.address }}
|
||||||
|
</view>
|
||||||
|
<image class="map" :src="require('@/static/imgs/map.jpeg')" mode="aspectFill" />
|
||||||
|
</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: {
|
||||||
|
showLocation() {
|
||||||
|
uni.openLocation({
|
||||||
|
latitude: Number(this.content.customFields.latitude),
|
||||||
|
longitude: Number(this.content.customFields.longitude),
|
||||||
|
fail: (err) => {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '打开地图失败'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.msg--location {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
|
||||||
|
.name {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: $text-gray-m;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location {
|
||||||
|
position: relative;
|
||||||
|
width: 400rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
padding: 10rpx;
|
||||||
|
|
||||||
|
.location--name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location--address {
|
||||||
|
padding-bottom: 10rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: $text-gray-m;
|
||||||
|
}
|
||||||
|
|
||||||
|
.map {
|
||||||
|
width: 400rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.left {
|
||||||
|
border-radius: 0 10rpx 10rpx 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right {
|
||||||
|
border-radius: 10rpx 0 10rpx 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
36
pages/im/components/show/showNormal.vue
Normal file
36
pages/im/components/show/showNormal.vue
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<template>
|
||||||
|
<view class="">
|
||||||
|
<show-location v-if="message.content.objectName == 'RC:LBSMsg'" :message="message" :isGroup="isGroup" />
|
||||||
|
<show-video v-else-if="message.content.objectName == 'RC:VideoMsg'" :message="message" :isGroup="isGroup" />
|
||||||
|
<show-audio v-else-if="message.content.objectName == 'RC:AudioMsg'" :message="message" :isGroup="isGroup" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import showLocation from './showLocation'
|
||||||
|
import showAudio from './showAudio'
|
||||||
|
import showVideo from './showVideo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
message: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isGroup: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
showLocation,
|
||||||
|
showAudio,
|
||||||
|
showVideo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
84
pages/im/components/show/showVideo.vue
Normal file
84
pages/im/components/show/showVideo.vue
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<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'">
|
||||||
|
<uni-icons type="videocam" size="44rpx" />
|
||||||
|
{{ 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
|
||||||
|
],
|
||||||
|
props: {
|
||||||
|
message: {
|
||||||
|
type: Object,
|
||||||
|
default: () => {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isGroup: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
label() {
|
||||||
|
return this.message.content.customFields.status == 1 ? '通话时长:' + duration : '未接通'
|
||||||
|
},
|
||||||
|
isRemote() {
|
||||||
|
return this.message.messageDirection == 2
|
||||||
|
},
|
||||||
|
duration() {
|
||||||
|
if (this.message.content.customFields.duration > 3600) {
|
||||||
|
return moment.utc(this.message.content.customFields.duration * 1000).format('HH:mm:ss')
|
||||||
|
} else {
|
||||||
|
return moment.utc(this.message.content.customFields.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;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&.left {
|
||||||
|
border-radius: 0 20rpx 20rpx 20rpx;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.right {
|
||||||
|
border-radius: 20rpx 0 20rpx 20rpx;
|
||||||
|
background: $main-color;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
.uni-icons {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
<view class="notify" v-else-if="message.objectName === 'RC:RcNtf'">
|
<view class="notify" v-else-if="message.objectName === 'RC:RcNtf'">
|
||||||
{{ contact(message.senderUserId).name }} 撤回了一条消息
|
{{ contact(message.senderUserId).name }} 撤回了一条消息
|
||||||
</view>
|
</view>
|
||||||
|
<view class="notify" v-else-if="message.objectName === 'RC:InfoNtf'">
|
||||||
|
{{ message.sentTime|timeCustomCN }}
|
||||||
|
</view>
|
||||||
<view v-else :class="['cell-item', message.messageDirection == 1 ? 'right' : 'left']">
|
<view v-else :class="['cell-item', message.messageDirection == 1 ? 'right' : 'left']">
|
||||||
<u-avatar class="avatar" @click="toUser(message)" :size="avatarSize" shape="square"
|
<u-avatar class="avatar" @click="toUser(message)" :size="avatarSize" shape="square"
|
||||||
:src="contact(message.senderUserId).portraitUrl" />
|
:src="contact(message.senderUserId).portraitUrl" />
|
||||||
@@ -15,7 +18,9 @@
|
|||||||
<show-text v-if="message.objectName === 'RC:TxtMsg'" :message="message" :isGroup="isGroup" />
|
<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-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-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" />
|
<show-file v-else-if="message.objectName === 'RC:FileMsg'" :message="message" :isGroup="isGroup" />
|
||||||
|
<show-normal v-else-if="message.objectName === 'RC:IWNormalMsg'" :message="message" :isGroup="isGroup" />
|
||||||
|
|
||||||
<view v-else class="">
|
<view v-else class="">
|
||||||
[未处理的消息类型 {{ message.objectName }}]
|
[未处理的消息类型 {{ message.objectName }}]
|
||||||
</view>
|
</view>
|
||||||
@@ -33,7 +38,8 @@
|
|||||||
import showVoice from './show/showVoice'
|
import showVoice from './show/showVoice'
|
||||||
import showImage from './show/showImage'
|
import showImage from './show/showImage'
|
||||||
import showText from './show/showText'
|
import showText from './show/showText'
|
||||||
import showCall from './show/showCall'
|
import showFile from './show/showFile'
|
||||||
|
import showNormal from './show/showNormal'
|
||||||
import utils from '@/utils/index.js'
|
import utils from '@/utils/index.js'
|
||||||
import imBase from '../mixins/imBase.js'
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
@@ -42,10 +48,11 @@
|
|||||||
imBase
|
imBase
|
||||||
],
|
],
|
||||||
components: {
|
components: {
|
||||||
showCall,
|
|
||||||
showVoice,
|
showVoice,
|
||||||
showImage,
|
showImage,
|
||||||
showText
|
showText,
|
||||||
|
showFile,
|
||||||
|
showNormal
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
message: {
|
message: {
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
<view class="content">
|
<view class="content">
|
||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="info-flex">
|
<view class="info-flex">
|
||||||
<u-avatar :src="userInfo.portraitUrl || require('@/static/user/cover.png')" shape="square" size="50"
|
<u-avatar :src="userInfo.portraitUrl || require('@/static/user/cover.png')" shape="square"
|
||||||
bg-color="#fff"></u-avatar>
|
:size="rpx2px(100)" bg-color="#fff" @click="previeImg(userInfo.portraitUrl)" />
|
||||||
<view class="info-text">
|
<view class="info-text">
|
||||||
<view class="nickname">{{ userInfo.name }}</view>
|
<view class="nickname">{{ contact(targetId).name }} </view>
|
||||||
|
<view class="address" @longpress="copyAddress">昵称:{{ userInfo.name }}</view>
|
||||||
<view class="address" @longpress="copyAddress">地址:{{ userInfo.address }}</view>
|
<view class="address" @longpress="copyAddress">地址:{{ userInfo.address }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -14,20 +15,16 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<label>性别</label>
|
<label>性别</label>
|
||||||
<view class="text" v-if="userInfo.gender === 0">保密</view>
|
<view class="text" v-if="userInfo.gender === 0">保密</view>
|
||||||
<view class="text" v-if="userInfo.gender === 1">男</view>
|
<view class="text" v-else-if="userInfo.gender === 1">男</view>
|
||||||
<view class="text" v-if="userInfo.gender === 2">女</view>
|
<view class="text" v-else>女</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 如果是好友 -->
|
||||||
<block v-if="userInfo.friendship ==='accepted'">
|
<block v-if="userInfo.friendship ==='accepted'">
|
||||||
<view class="info-btns">
|
<view class="info-btns">
|
||||||
<view class="item u-border-bottom" @click="setRemark">
|
<view class="item u-border-bottom" @click="setRemark">
|
||||||
<label>设置备注</label>
|
<label>设置备注</label>
|
||||||
<u-icon name="arrow-right" color="#eee" size="16" />
|
<uni-icons type="right" size="32rpx" />
|
||||||
</view>
|
|
||||||
<view class="item u-border-bottom" @click="setRemark">
|
|
||||||
<label>设置标签</label>
|
|
||||||
<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>
|
||||||
@@ -41,7 +38,7 @@
|
|||||||
<view class="footer">
|
<view class="footer">
|
||||||
<view class="footer-item" @click="deleteFriend">
|
<view class="footer-item" @click="deleteFriend">
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
<u-icon class="icon-u" name="close-circle-fill" color="#fff" size="30" />
|
<u-icon class="icon-u" name="minus-people-fill" color="#fff" size="30" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text">删除好友</view>
|
<view class="text">删除好友</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -53,7 +50,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="footer-item" @click="callShow = true">
|
<view class="footer-item" @click="callShow = true">
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
<u-icon class="icon-u" name="camera-fill" color="#fff" size="30" />
|
<u-icon class="icon-u" :name="require('@/static/imgs/tel-call.png')" color="#fff" size="30" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text">音/视频通话</view>
|
<view class="text">音/视频通话</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -69,6 +66,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
|
<u-modal negativeTop="300" :show="modalShow" title="修改备注" showCancelButton @cancel="onHideModal"
|
||||||
|
@confirm="onChangeRemark">
|
||||||
|
<view class="slot-content">
|
||||||
|
<u--input placeholder="好友备注" border="surround" focus v-model="contactRemark" maxlength="12" />
|
||||||
|
</view>
|
||||||
|
</u-modal>
|
||||||
|
|
||||||
<u-action-sheet :actions="callActions" cancelText="取消" @close="callShow = false" @select="singleCall"
|
<u-action-sheet :actions="callActions" cancelText="取消" @close="callShow = false" @select="singleCall"
|
||||||
:show="callShow">
|
:show="callShow">
|
||||||
</u-action-sheet>
|
</u-action-sheet>
|
||||||
@@ -83,12 +88,17 @@
|
|||||||
} 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 * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
|
import imBase from '../mixins/imBase.js'
|
||||||
|
|
||||||
// friendship: '' 没有好友关系
|
// friendship: '' 没有好友关系
|
||||||
// accepted 好友
|
// accepted 好友
|
||||||
// pending 申请中
|
// pending 申请中
|
||||||
// denied 拒绝
|
// denied 拒绝
|
||||||
// blocked 黑名单
|
// blocked 黑名单
|
||||||
export default {
|
export default {
|
||||||
|
mixins: [
|
||||||
|
imBase
|
||||||
|
],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targetId: '',
|
targetId: '',
|
||||||
@@ -107,7 +117,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
callShow: false,
|
callShow: false,
|
||||||
hasPeding: false
|
hasPeding: false,
|
||||||
|
modalShow: false,
|
||||||
|
contactRemark: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -116,9 +128,9 @@
|
|||||||
this.userInfo = res
|
this.userInfo = res
|
||||||
// 获取到用户信息之后,去检查一下要不要更新
|
// 获取到用户信息之后,去检查一下要不要更新
|
||||||
this.$store.dispatch('updateContact', res)
|
this.$store.dispatch('updateContact', res)
|
||||||
uni.setNavigationBarTitle({
|
// uni.setNavigationBarTitle({
|
||||||
title: res.name
|
// title: res.name
|
||||||
})
|
// })
|
||||||
})
|
})
|
||||||
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
|
RongIMLib.getConversationNotificationStatus(this.conversationType, this.targetId, ({
|
||||||
status
|
status
|
||||||
@@ -146,12 +158,36 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
previeImg(url){
|
||||||
|
uni.previewImage({
|
||||||
|
urls:[url]
|
||||||
|
})
|
||||||
|
},
|
||||||
toPrivate() {
|
toPrivate() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/im/private/chat?targetId=' + this.targetId
|
url: '/pages/im/private/chat?targetId=' + this.targetId
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
// 设置好友备注操作
|
||||||
setRemark() {
|
setRemark() {
|
||||||
|
this.modalShow = true
|
||||||
|
this.contactRemark = this.$store.getters.contactInfo(this.targetId).name
|
||||||
|
},
|
||||||
|
onHideModal() {
|
||||||
|
this.modalShow = false
|
||||||
|
},
|
||||||
|
onChangeRemark() {
|
||||||
|
this.$store.dispatch('setContactRemark', {
|
||||||
|
targetId: this.targetId,
|
||||||
|
remark: this.contactRemark
|
||||||
|
})
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '备注设置成功'
|
||||||
|
})
|
||||||
|
this.onHideModal()
|
||||||
|
},
|
||||||
|
setTag() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '开发中',
|
title: '开发中',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@@ -280,7 +316,7 @@
|
|||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
padding: $padding*2 $padding;
|
padding: $padding*2 $padding * 2 $padding*4 $padding *2;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|
||||||
@@ -344,6 +380,10 @@
|
|||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uni-icons {
|
||||||
|
color: $text-gray-m !important;
|
||||||
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
width: calc(100% - 200rpx);
|
width: calc(100% - 200rpx);
|
||||||
color: $text-gray-m;
|
color: $text-gray-m;
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
<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="输入手机号码搜索" 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>
|
||||||
<block v-if="pendings.length > 0">
|
<block v-if="pendings.length > 0">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="chat">
|
<view class="chat">
|
||||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
<sent-message-bar id="msgbar" :conversationType="conversationType" :targetId="targetId"
|
||||||
|
@onSuccess="getNewMessage()" />
|
||||||
|
|
||||||
<view class="shade" @click="hidePop" v-show="showPop">
|
<view class="shade" @click="hidePop" v-show="showPop">
|
||||||
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
<view class="pop" :style="popStyle" :class="{'show':showPop}">
|
||||||
@@ -11,7 +12,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="body">
|
<view class="body">
|
||||||
<view class="scroll">
|
<view class="place" :style="{ height: placeHeight + 'px' }"></view>
|
||||||
|
<view class="scroll" id="scroll">
|
||||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||||
<show-message-cell :message="message" isGroup @messageAction="messageAction" />
|
<show-message-cell :message="message" isGroup @messageAction="messageAction" />
|
||||||
</view>
|
</view>
|
||||||
@@ -51,7 +53,9 @@
|
|||||||
messages: [],
|
messages: [],
|
||||||
groupInfo: {
|
groupInfo: {
|
||||||
name: ''
|
name: ''
|
||||||
}
|
},
|
||||||
|
placeHeight: uni.getSystemInfoSync().windowHeight,
|
||||||
|
bottomHeihgt: 56
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -69,6 +73,20 @@
|
|||||||
this.initGroupInfo()
|
this.initGroupInfo()
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
|
this.$nextTick(function() {
|
||||||
|
query.select('#msgbar').boundingClientRect(bottom => {
|
||||||
|
this.bottomHeihgt = bottom.height
|
||||||
|
}).exec();
|
||||||
|
})
|
||||||
|
// 监听键盘高度变化
|
||||||
|
uni.onKeyboardHeightChange(keyboard => {
|
||||||
|
query.select('#scroll').boundingClientRect(scroll => {
|
||||||
|
const placeHeight = this.windowHeight - scroll.height - keyboard.height - this
|
||||||
|
.bottomHeihgt
|
||||||
|
this.placeHeight = placeHeight > 0 ? placeHeight : 0
|
||||||
|
}).exec();
|
||||||
|
})
|
||||||
this.targetId = e.targetId
|
this.targetId = e.targetId
|
||||||
// 获取历史消息列表
|
// 获取历史消息列表
|
||||||
this.getMessageList()
|
this.getMessageList()
|
||||||
@@ -138,14 +156,25 @@
|
|||||||
this.$refs.messageBar.onHidePopus()
|
this.$refs.messageBar.onHidePopus()
|
||||||
},
|
},
|
||||||
getNewMessage() {
|
getNewMessage() {
|
||||||
|
if (new Date().getTime() - this.latestMessage.sentTime > 18000000) {
|
||||||
|
// 在本地插入一条时间的消息
|
||||||
|
const messageContent = {
|
||||||
|
objectName: 'RC:InfoNtf',
|
||||||
|
message: 'DateInfo'
|
||||||
|
}
|
||||||
|
RongIMLib.insertOutgoingMessage(this.conversationType, this.targetId, 50, messageContent, 0)
|
||||||
|
}
|
||||||
|
|
||||||
im.getMessageList(
|
im.getMessageList(
|
||||||
this.conversationType,
|
this.conversationType,
|
||||||
this.targetId,
|
this.targetId,
|
||||||
this.latestMessage.sentTime,
|
this.latestMessage.sentTime || 0,
|
||||||
10,
|
10,
|
||||||
false,
|
false,
|
||||||
(messages) => {
|
(messages) => {
|
||||||
this.messages.unshift(...messages)
|
console.log(messages);
|
||||||
|
//
|
||||||
|
this.messages.unshift(...messages.reverse())
|
||||||
this.scrollBottom()
|
this.scrollBottom()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -158,12 +187,9 @@
|
|||||||
20,
|
20,
|
||||||
true,
|
true,
|
||||||
(messages) => {
|
(messages) => {
|
||||||
console.log('获取消息列表', messages);
|
|
||||||
const msgs = messages.filter(item => item.receivedStatus == 0)
|
const msgs = messages.filter(item => item.receivedStatus == 0)
|
||||||
console.log('未读消息', msgs);
|
|
||||||
if (msgs.length) {
|
if (msgs.length) {
|
||||||
RongIMLib.sendReadReceiptResponse(3, this.targetId, msgs, (res) => {
|
RongIMLib.sendReadReceiptResponse(3, this.targetId, msgs, (res) => {
|
||||||
console.error('发送群聊已读回执成功', res);
|
|
||||||
msgs.map(item => {
|
msgs.map(item => {
|
||||||
RongIMLib.setMessageReceivedStatus(item.messageId, 1)
|
RongIMLib.setMessageReceivedStatus(item.messageId, 1)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
</u-checkbox-group>
|
</u-checkbox-group>
|
||||||
</u-index-list>
|
</u-index-list>
|
||||||
<view class="bottom">
|
<view class="bottom">
|
||||||
<span class="onInvite" @click="onInvite">完成<span>{{`(${checkboxValue.length})` || ''}}</span></span>
|
<span class="onInvite" v-if="canInvite"> 添加中<span>{{`(${checkboxValue.length})` || ''}}</span></span>
|
||||||
|
<span class="onInvite" v-else @click="onInvite">完成<span>{{`(${checkboxValue.length})` || ''}}</span></span>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
<view class="no-lists" v-else>
|
<view class="no-lists" v-else>
|
||||||
@@ -63,7 +64,8 @@
|
|||||||
friends: [],
|
friends: [],
|
||||||
orignalFriends: [],
|
orignalFriends: [],
|
||||||
checkboxValue: [],
|
checkboxValue: [],
|
||||||
selectValue: []
|
selectValue: [],
|
||||||
|
canInvite:false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
@@ -124,6 +126,7 @@
|
|||||||
onInvite() {
|
onInvite() {
|
||||||
console.log(this.checkboxValue, 'userIds.....')
|
console.log(this.checkboxValue, 'userIds.....')
|
||||||
console.log(this.selectValue, 'userIds.....')
|
console.log(this.selectValue, 'userIds.....')
|
||||||
|
this.canInvite = true
|
||||||
let userIds = []
|
let userIds = []
|
||||||
this.checkboxValue.filter(item => {
|
this.checkboxValue.filter(item => {
|
||||||
if (!utils.inArray(item, this.selectValue)) {
|
if (!utils.inArray(item, this.selectValue)) {
|
||||||
@@ -137,8 +140,10 @@
|
|||||||
animationType: 'pop-out',
|
animationType: 'pop-out',
|
||||||
animationDuration: 200
|
animationDuration: 200
|
||||||
});
|
});
|
||||||
|
this.canInvite = false
|
||||||
uni.$emit('groupInvitedUser')
|
uni.$emit('groupInvitedUser')
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
this.canInvite = false
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: err.message
|
title: err.message
|
||||||
|
|||||||
@@ -138,10 +138,12 @@
|
|||||||
color: $text-color;
|
color: $text-color;
|
||||||
padding-bottom: 6rpx;
|
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;
|
padding-top: $padding - 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +152,7 @@
|
|||||||
color: #Fff;
|
color: #Fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: $title-size-m;
|
font-size: $title-size-m;
|
||||||
padding: 6rpx 20rpx;
|
padding: $padding - 22 $padding - 10;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,15 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- content -->
|
<!-- content -->
|
||||||
<view v-if="$store.state.token !== ''">
|
<view v-if="$store.state.token !== ''">
|
||||||
|
<block v-if="conversations.length>0">
|
||||||
<connection-status :connection="connection" />
|
<connection-status :connection="connection" />
|
||||||
<conversation-list @refresh="getConversationList()" :conversations="conversations" />
|
<conversation-list @refresh="getConversationList()" :conversations="conversations" />
|
||||||
|
</block>
|
||||||
|
<view class="no-lists" v-else>
|
||||||
|
<u-image class="cover" radius="4" width="500rpx" height="500rpx"
|
||||||
|
:src="require('@/static/imgs/no-new-news.png')" :lazy-load="true" />
|
||||||
|
<span> 空空如也~</span>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 未登录 -->
|
<!-- 未登录 -->
|
||||||
<view v-else class="vertical null-list">
|
<view v-else class="vertical null-list">
|
||||||
@@ -55,6 +62,11 @@
|
|||||||
connectionStatus
|
connectionStatus
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
RongIMLib.getCurrentUserId(({
|
||||||
|
userId
|
||||||
|
}) => {
|
||||||
|
console.log('getCurrentUserId', userId);
|
||||||
|
})
|
||||||
// 监听新的好友申请
|
// 监听新的好友申请
|
||||||
uni.$on('onNewContactConversation', () => {
|
uni.$on('onNewContactConversation', () => {
|
||||||
console.log('更新好友申请数量');
|
console.log('更新好友申请数量');
|
||||||
@@ -107,6 +119,7 @@
|
|||||||
conversations
|
conversations
|
||||||
}) => {
|
}) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
console.log('获取会话列表', conversations);
|
||||||
this.conversations = conversations
|
this.conversations = conversations
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -214,4 +227,21 @@
|
|||||||
.u-border-bottom {
|
.u-border-bottom {
|
||||||
border-bottom: solid 1rpx #f9f9f9 !important;
|
border-bottom: solid 1rpx #f9f9f9 !important;
|
||||||
}
|
}
|
||||||
|
.no-lists {
|
||||||
|
min-height: 80vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
color: $text-gray-m;
|
||||||
|
.cover{
|
||||||
|
opacity: 0.8!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
padding-top: $padding;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -12,6 +12,14 @@ export default {
|
|||||||
},
|
},
|
||||||
sender() {
|
sender() {
|
||||||
return this.$store.getters.sender
|
return this.$store.getters.sender
|
||||||
|
},
|
||||||
|
windowHeight() {
|
||||||
|
return uni.getSystemInfoSync().windowHeight
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
rpx2px(size) {
|
||||||
|
return utils.rpx2px(size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,8 @@ export default {
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: '消息撤回成功'
|
title: '消息撤回成功'
|
||||||
})
|
})
|
||||||
IMLib.getMessage(msg.messageId, res => {
|
msg.objectName = 'RC:RcNtf'
|
||||||
uni.$emit('onRecallMessage_' + msg.targetId, res.message)
|
uni.$emit('onRecallMessage_' + msg.targetId, msg)
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|||||||
@@ -133,23 +133,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
afterHangup() {
|
afterHangup() {
|
||||||
clearInterval(this.interval)
|
clearInterval(this.interval)
|
||||||
const targetId = this.targetId
|
// duration: this.duration
|
||||||
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, {
|
uni.$emit('onReceiveMessage_' + this.targetId, {
|
||||||
targetId: this.targetId
|
targetId: this.targetId
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="chat">
|
<view class="chat">
|
||||||
<sent-message-bar :conversationType="conversationType" :targetId="targetId" @onSuccess="getNewMessage()" />
|
<sent-message-bar id="msgbar" :conversationType="conversationType" :targetId="targetId"
|
||||||
|
@onSuccess="getNewMessage()" />
|
||||||
<view class="shade" @click="hidePop" v-show="showPop">
|
<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(item)">
|
<view v-for="(item, index) in popButton" :key="index" @click="pickerMenu(item)">
|
||||||
@@ -9,10 +9,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- chat -->
|
<!-- chat -->
|
||||||
<view class="body">
|
<view class="body">
|
||||||
<view class="scroll">
|
<view class="place" :style="{ height: placeHeight + 'px' }"></view>
|
||||||
|
<view class="scroll" id="scroll">
|
||||||
<view class="cell" v-for="(message, index) in messages" :key="index">
|
<view class="cell" v-for="(message, index) in messages" :key="index">
|
||||||
<show-message-cell :message="message" @messageAction="messageAction" />
|
<show-message-cell :message="message" @messageAction="messageAction" />
|
||||||
</view>
|
</view>
|
||||||
@@ -48,7 +48,9 @@
|
|||||||
name: '',
|
name: '',
|
||||||
userId: '',
|
userId: '',
|
||||||
portraitUrl: ''
|
portraitUrl: ''
|
||||||
}
|
},
|
||||||
|
placeHeight: uni.getSystemInfoSync().windowHeight,
|
||||||
|
bottomHeihgt: 56
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -62,12 +64,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(e) {
|
onShow() {
|
||||||
this.targetId = e.targetId
|
|
||||||
this.userInfo = this.$store.getters.contactInfo(this.targetId)
|
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: this.contact(this.targetId).name
|
title: this.contact(this.targetId).name
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
const query = uni.createSelectorQuery().in(this);
|
||||||
|
this.$nextTick(function() {
|
||||||
|
query.select('#msgbar').boundingClientRect(bottom => {
|
||||||
|
this.bottomHeihgt = bottom.height
|
||||||
|
}).exec();
|
||||||
|
})
|
||||||
|
// 监听键盘高度变化
|
||||||
|
uni.onKeyboardHeightChange(keyboard => {
|
||||||
|
query.select('#scroll').boundingClientRect(scroll => {
|
||||||
|
const placeHeight = this.windowHeight - scroll.height - keyboard.height - this
|
||||||
|
.bottomHeihgt
|
||||||
|
this.placeHeight = placeHeight > 0 ? placeHeight : 0
|
||||||
|
}).exec();
|
||||||
|
})
|
||||||
|
this.targetId = e.targetId
|
||||||
|
this.userInfo = this.$store.getters.contactInfo(this.targetId)
|
||||||
// 获取消息列表
|
// 获取消息列表
|
||||||
this.getMessageList()
|
this.getMessageList()
|
||||||
// 监听新消息
|
// 监听新消息
|
||||||
@@ -106,22 +124,41 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
uni.offKeyboardHeightChange(res => {
|
||||||
|
console.log('卸载监听键盘高度变化', res);
|
||||||
|
})
|
||||||
uni.$off('onUserDelete_' + this.targetId)
|
uni.$off('onUserDelete_' + this.targetId)
|
||||||
uni.$off('onReceiveMessage_' + this.targetId)
|
uni.$off('onReceiveMessage_' + this.targetId)
|
||||||
uni.$off('onRecallMessage_' + this.targetId)
|
uni.$off('onRecallMessage_' + this.targetId)
|
||||||
uni.$off('onRecallMessage')
|
uni.$off('onRecallMessage')
|
||||||
uni.$off('onReadReceiptReceived')
|
uni.$off('onReadReceiptReceived')
|
||||||
},
|
},
|
||||||
|
onNavigationBarButtonTap() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/im/friends/info?targetId=' + this.targetId
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getNewMessage() {
|
getNewMessage() {
|
||||||
|
if (new Date().getTime() - this.latestMessage.sentTime > 18000000) {
|
||||||
|
// 在本地插入一条时间的消息
|
||||||
|
const messageContent = {
|
||||||
|
objectName: 'RC:InfoNtf',
|
||||||
|
message: 'DateInfo'
|
||||||
|
}
|
||||||
|
RongIMLib.insertOutgoingMessage(this.conversationType, this.targetId, 50, messageContent, 0)
|
||||||
|
}
|
||||||
|
|
||||||
im.getMessageList(
|
im.getMessageList(
|
||||||
this.conversationType,
|
this.conversationType,
|
||||||
this.targetId,
|
this.targetId,
|
||||||
this.latestMessage.sentTime || 0,
|
this.latestMessage.sentTime || 0,
|
||||||
1,
|
10,
|
||||||
false,
|
false,
|
||||||
(messages) => {
|
(messages) => {
|
||||||
this.messages.unshift(...messages)
|
console.log(messages);
|
||||||
|
//
|
||||||
|
this.messages.unshift(...messages.reverse())
|
||||||
this.scrollBottom()
|
this.scrollBottom()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -155,6 +192,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.place {}
|
||||||
|
|
||||||
/* 窗口 */
|
/* 窗口 */
|
||||||
.chat {
|
.chat {
|
||||||
background: $window-color;
|
background: $window-color;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<!-- 头像 -->
|
<!-- 头像 -->
|
||||||
<view class="user" @click="$Router.back()">
|
<view class="user" @click="$Router.back()">
|
||||||
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true" />
|
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true" />
|
||||||
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="user.avatar ? user.avatar : require('../../static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="user.avatar ? user.avatar : require('@/static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
||||||
<view class="nickname">{{user.nickname}}</view> -->
|
<view class="nickname">{{user.nickname}}</view> -->
|
||||||
<!-- <u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1"/> -->
|
<!-- <u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1"/> -->
|
||||||
</view>
|
</view>
|
||||||
@@ -42,7 +42,6 @@
|
|||||||
<!-- 体重管理模块 -->
|
<!-- 体重管理模块 -->
|
||||||
<view class="weight-manage">
|
<view class="weight-manage">
|
||||||
<!-- 体重管理 -->
|
<!-- 体重管理 -->
|
||||||
<!-- @click="$Router.push({name:'EssentialInfo'})" -->
|
|
||||||
<view class="manage">体重管理</view>
|
<view class="manage">体重管理</view>
|
||||||
<!-- 单位:公斤 -->
|
<!-- 单位:公斤 -->
|
||||||
<u-icon class="eye" name="eye" color="#fff" size="14" :bold="true" label="单位 : 公斤" labelPos="left" labelSize="12" labelColor="#fff" space="6" />
|
<u-icon class="eye" name="eye" color="#fff" size="14" :bold="true" label="单位 : 公斤" labelPos="left" labelSize="12" labelColor="#fff" space="6" />
|
||||||
@@ -81,13 +80,13 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 健康测评 -->
|
<!-- 健康测评 -->
|
||||||
<u-image
|
<u-image
|
||||||
:src="banner.cover || require('../../static/imgs/health1.png')"
|
:src="banner.cover || require('@/static/imgs/health1.png')"
|
||||||
class="eval-img"
|
class="eval-img"
|
||||||
@click="$Router.push({ name: 'EvaluationList' })"
|
@click="$Router.push({ name: 'EvaluationList' })"
|
||||||
:lazy-load="true"
|
:lazy-load="true"
|
||||||
radius="10rpx"
|
radius="10rpx"
|
||||||
mode="widthFix"
|
|
||||||
width="100%"
|
width="100%"
|
||||||
|
height="300rpx"
|
||||||
/>
|
/>
|
||||||
<!-- 健康记录 -->
|
<!-- 健康记录 -->
|
||||||
<view class="title">健康记录</view>
|
<view class="title">健康记录</view>
|
||||||
@@ -101,7 +100,7 @@
|
|||||||
千卡
|
千卡
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" />
|
<u-image class="h-icon" :src="require('@/static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="150rpx" height="150rpx"/>
|
||||||
</view>
|
</view>
|
||||||
<view class="health-2">
|
<view class="health-2">
|
||||||
<view class="health" @click="$Router.push({ name: 'Drink' })">
|
<view class="health" @click="$Router.push({ name: 'Drink' })">
|
||||||
@@ -115,7 +114,7 @@
|
|||||||
毫升
|
毫升
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="110rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="120rpx" class="h-icon" height="120rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view class="health" @click="$Router.push({ name: 'Weight' })">
|
<view class="health" @click="$Router.push({ name: 'Weight' })">
|
||||||
<view>
|
<view>
|
||||||
@@ -127,18 +126,18 @@
|
|||||||
公斤
|
公斤
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" height="140rpx" class="h-icon" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 营养管理 -->
|
<!-- 营养管理 -->
|
||||||
<view class="title">营养管理</view>
|
<view class="title">营养管理</view>
|
||||||
<view class="nutrition">
|
<view class="nutrition">
|
||||||
<view class="--item" @click="$Router.push({ name: 'VipFoods' })">
|
<view class="--item" @click="$Router.push({ name: 'VipFoods' })">
|
||||||
<u-icon :name="require('../../static/icon/vip.png')" size="20" :bold="true" label="会员专享食谱" labelPos="right" labelSize="16" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/vip.png')" size="20" :bold="true" label="会员专享食谱" labelPos="right" labelSize="16" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
<view class="--item mt20" @click="$Router.push({ name: 'topicIndex' })">
|
<view class="--item mt20" @click="$Router.push({ name: 'topicIndex' })">
|
||||||
<u-icon :name="require('../../static/icon/helper.png')" size="20" :bold="true" label="营养小助手" labelPos="right" labelSize="16" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/helper.png')" size="20" :bold="true" label="营养小助手" labelPos="right" labelSize="16" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -149,7 +148,7 @@
|
|||||||
<view class="search" >
|
<view class="search" >
|
||||||
<!-- 头像 -->
|
<!-- 头像 -->
|
||||||
<view class="user" @click="$Router.back()">
|
<view class="user" @click="$Router.back()">
|
||||||
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="require('../../static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="require('@/static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
||||||
<u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1" /> -->
|
<u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1" /> -->
|
||||||
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true"/>
|
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true"/>
|
||||||
</view>
|
</view>
|
||||||
@@ -201,7 +200,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 健康测评 -->
|
<!-- 健康测评 -->
|
||||||
<u-image :src="banner.cover || require('../../static/imgs/health1.png')" class="eval-img" @click="Login" :lazy-load="true" radius="10rpx" mode="widthFix" width="100%" />
|
<u-image :src="banner.cover || require('@/static/imgs/health1.png')" class="eval-img" @click="Login" :lazy-load="true" radius="10rpx" mode="widthFix" width="100%" />
|
||||||
<!-- 健康记录 -->
|
<!-- 健康记录 -->
|
||||||
<view class="title">健康记录</view>
|
<view class="title">健康记录</view>
|
||||||
<view class="health" @click="Login">
|
<view class="health" @click="Login">
|
||||||
@@ -210,7 +209,7 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" />
|
<u-image :src="require('@/static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view class="health-2">
|
<view class="health-2">
|
||||||
<view class="health" @click="Login">
|
<view class="health" @click="Login">
|
||||||
@@ -219,7 +218,7 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="110rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="110rpx" class="h-icon" />
|
||||||
</view>
|
</view>
|
||||||
<view class="health" @click="Login">
|
<view class="health" @click="Login">
|
||||||
<view>
|
<view>
|
||||||
@@ -227,18 +226,18 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" class="h-icon" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 营养管理 -->
|
<!-- 营养管理 -->
|
||||||
<view class="title">营养管理</view>
|
<view class="title">营养管理</view>
|
||||||
<view class="nutrition">
|
<view class="nutrition">
|
||||||
<view class="--item" @click="Login">
|
<view class="--item" @click="Login">
|
||||||
<u-icon :name="require('../../static/icon/vip.png')" size="24" :bold="true" label="会员专享食谱" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/vip.png')" size="24" :bold="true" label="会员专享食谱" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
<view class="--item mt20" @click="Login">
|
<view class="--item mt20" @click="Login">
|
||||||
<u-icon :name="require('../../static/icon/helper.png')" size="24" :bold="true" label="营养小助手" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/helper.png')" size="24" :bold="true" label="营养小助手" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -249,7 +248,7 @@
|
|||||||
<view class="search" >
|
<view class="search" >
|
||||||
<!-- 头像 -->
|
<!-- 头像 -->
|
||||||
<view class="user" @click='$Router.back()'>
|
<view class="user" @click='$Router.back()'>
|
||||||
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="require('../../static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
<!-- <u-image class="avatar" width="90rpx" height="90rpx" :src="require('@/static/imgs/avatar.png')" :lazy-load="true" shape="circle" />
|
||||||
<u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1" /> -->
|
<u-icon name="arrow-down-fill" color="#525252" size="10" class="downIcon" :bold="true" space="1" /> -->
|
||||||
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true"/>
|
<u-icon name="arrow-left" color="#525252" size="22" class="downIcon" :bold="true"/>
|
||||||
</view>
|
</view>
|
||||||
@@ -302,7 +301,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- 健康测评 -->
|
<!-- 健康测评 -->
|
||||||
<u-image
|
<u-image
|
||||||
:src="banner.cover || require('../../static/imgs/health1.png')"
|
:src="banner.cover || require('@/static/imgs/health1.png')"
|
||||||
class="eval-img"
|
class="eval-img"
|
||||||
@click="toCreateInfo"
|
@click="toCreateInfo"
|
||||||
:lazy-load="true"
|
:lazy-load="true"
|
||||||
@@ -318,7 +317,7 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" />
|
<u-image :src="require('@/static/imgs/eat.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view class="health-2">
|
<view class="health-2">
|
||||||
<view class="health" @click="toCreateInfo">
|
<view class="health" @click="toCreateInfo">
|
||||||
@@ -327,7 +326,7 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="110rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/drink.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="110rpx" class="h-icon" />
|
||||||
</view>
|
</view>
|
||||||
<view class="health" @click="toCreateInfo">
|
<view class="health" @click="toCreateInfo">
|
||||||
<view>
|
<view>
|
||||||
@@ -335,18 +334,18 @@
|
|||||||
<!-- <view class="h-date">--</view> -->
|
<!-- <view class="h-date">--</view> -->
|
||||||
<view class="h-eat"><span>--</span></view>
|
<view class="h-eat"><span>--</span></view>
|
||||||
</view>
|
</view>
|
||||||
<u-image :src="require('../../static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" class="h-icon" />
|
<u-image :src="require('@/static/imgs/weight.png')" :lazy-load="true" radius="10rpx" mode="widthFix" width="140rpx" class="h-icon" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 营养管理 -->
|
<!-- 营养管理 -->
|
||||||
<view class="title">营养管理</view>
|
<view class="title">营养管理</view>
|
||||||
<view class="nutrition">
|
<view class="nutrition">
|
||||||
<view class="--item" @click="toCreateInfo">
|
<view class="--item" @click="toCreateInfo">
|
||||||
<u-icon :name="require('../../static/icon/vip.png')" size="24" :bold="true" label="会员专享食谱" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/vip.png')" size="24" :bold="true" label="会员专享食谱" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
<view class="--item mt20" @click="toCreateInfo">
|
<view class="--item mt20" @click="toCreateInfo">
|
||||||
<u-icon :name="require('../../static/icon/helper.png')" size="24" :bold="true" label="营养小助手" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
<u-icon :name="require('@/static/icon/helper.png')" size="24" :bold="true" label="营养小助手" labelPos="right" labelSize="17" labelColor="#525252" space="10" />
|
||||||
<u-icon name="arrow-right" color="#999" />
|
<u-icon name="arrow-right" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -498,7 +497,7 @@ export default {
|
|||||||
// 体重管理
|
// 体重管理
|
||||||
.weight-manage {
|
.weight-manage {
|
||||||
height: 288rpx;
|
height: 288rpx;
|
||||||
background-image: url(../../static/imgs/banner-bg.png);
|
background-image: url(@/static/imgs/banner-bg.png);
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
border-radius: $radius + 1;
|
border-radius: $radius + 1;
|
||||||
|
|||||||
BIN
static/.DS_Store
vendored
BIN
static/.DS_Store
vendored
Binary file not shown.
BIN
static/icon/emoji-icon.png
Normal file
BIN
static/icon/emoji-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
795
static/im/emoji.js
Normal file
795
static/im/emoji.js
Normal file
@@ -0,0 +1,795 @@
|
|||||||
|
var EmojiFactory = {
|
||||||
|
"u1F603": {
|
||||||
|
"en": "Smiley Face",
|
||||||
|
"zh": "绗戣劯",
|
||||||
|
"tag": "\uD83D\uDE03",
|
||||||
|
"position": "-75px 0px"
|
||||||
|
},
|
||||||
|
"u1F600": {
|
||||||
|
"en": "Grinning Face",
|
||||||
|
"zh": "绗戝樆鍢<E6A886>",
|
||||||
|
"tag": "\uD83D\uDE00",
|
||||||
|
"position": "0px 0px"
|
||||||
|
},
|
||||||
|
"u1F60A": {
|
||||||
|
"en": "Smiley",
|
||||||
|
"zh": "寰瑧",
|
||||||
|
"tag": "\uD83D\uDE0A",
|
||||||
|
"position": "-1725px 0px"
|
||||||
|
},
|
||||||
|
"u263A": {
|
||||||
|
"en": "Cute",
|
||||||
|
"zh": "钀岃悓鍝<E68293>",
|
||||||
|
"tag": "\u263A",
|
||||||
|
"position": "-2950px 0px"
|
||||||
|
},
|
||||||
|
"u1F609": {
|
||||||
|
"en": "Winking Face",
|
||||||
|
"zh": "鐪ㄧ溂",
|
||||||
|
"tag": "\uD83D\uDE09",
|
||||||
|
"position": "-200px 0px"
|
||||||
|
},
|
||||||
|
"u1F60D": {
|
||||||
|
"en": "Heart Eyes",
|
||||||
|
"zh": "鑹茶糠杩<E7B3A0>",
|
||||||
|
"tag": "\uD83D\uDE0D",
|
||||||
|
"position": "-1800px 0px"
|
||||||
|
},
|
||||||
|
"u1F618": {
|
||||||
|
"en": "Blowing Kiss",
|
||||||
|
"zh": "椋炲惢",
|
||||||
|
"tag": "\uD83D\uDE18",
|
||||||
|
"position": "-375px 0px"
|
||||||
|
},
|
||||||
|
"u1F61A": {
|
||||||
|
"en": "Kiss Face",
|
||||||
|
"zh": "涔堜箞鍝<E7AE9E>",
|
||||||
|
"tag": "\uD83D\uDE1A",
|
||||||
|
"position": "-1875px 0px"
|
||||||
|
},
|
||||||
|
"u1F61C": {
|
||||||
|
"en": "Crazy Face",
|
||||||
|
"zh": "璋冪毊",
|
||||||
|
"tag": "\uD83D\uDE1C",
|
||||||
|
"position": "-1900px 0px"
|
||||||
|
},
|
||||||
|
"u1F61D": {
|
||||||
|
"en": "Tongue Out",
|
||||||
|
"zh": "鍚愯垖澶<E59E96>",
|
||||||
|
"tag": "\uD83D\uDE1D",
|
||||||
|
"position": "-1925px 0px"
|
||||||
|
},
|
||||||
|
"u1F633": {
|
||||||
|
"en": "Flushed Face",
|
||||||
|
"zh": "鑴哥孩",
|
||||||
|
"tag": "\uD83D\uDE33",
|
||||||
|
"position": "-625px 0px"
|
||||||
|
},
|
||||||
|
"u1F601": {
|
||||||
|
"en": "Grinning With Smiling",
|
||||||
|
"zh": "闇查娇鑰岀瑧",
|
||||||
|
"tag": "\uD83D\uDE01",
|
||||||
|
"position": "-25px 0px"
|
||||||
|
},
|
||||||
|
"u1F614": {
|
||||||
|
"en": "Pensive",
|
||||||
|
"zh": "娌夋€<E5A48B>",
|
||||||
|
"tag": "\uD83D\uDE14",
|
||||||
|
"position": "-300px 0px"
|
||||||
|
},
|
||||||
|
"u1F60C": {
|
||||||
|
"en": "Pleased",
|
||||||
|
"zh": "婊℃剰",
|
||||||
|
"tag": "\uD83D\uDE0C",
|
||||||
|
"position": "-1775px 0px"
|
||||||
|
},
|
||||||
|
"u1F612": {
|
||||||
|
"en": "Dissatisfied",
|
||||||
|
"zh": "涓嶆弧",
|
||||||
|
"tag": "\uD83D\uDE12",
|
||||||
|
"position": "-250px 0px"
|
||||||
|
},
|
||||||
|
"u1F61F": {
|
||||||
|
"en": "Worried Face",
|
||||||
|
"zh": "鑻︾摐鑴<E69190>",
|
||||||
|
"tag": "\uD83D\uDE1F",
|
||||||
|
"position": "-1975px 0px"
|
||||||
|
},
|
||||||
|
"u1F61E": {
|
||||||
|
"en": "Disappointed Face",
|
||||||
|
"zh": "澶辨湜",
|
||||||
|
"tag": "\uD83D\uDE1E",
|
||||||
|
"position": "-1950px 0px"
|
||||||
|
},
|
||||||
|
"u1F623": {
|
||||||
|
"en": "Helpless Face",
|
||||||
|
"zh": "鏃犲姪",
|
||||||
|
"tag": "\uD83D\uDE23",
|
||||||
|
"position": "-450px 0px"
|
||||||
|
},
|
||||||
|
"u1F62D": {
|
||||||
|
"en": "Crying",
|
||||||
|
"zh": "浼ゅ績",
|
||||||
|
"tag": "\uD83D\uDE22",
|
||||||
|
"position": "-425px 0px"
|
||||||
|
},
|
||||||
|
"u1F602": {
|
||||||
|
"en": "Laughing Tears",
|
||||||
|
"zh": "鍠滄瀬鑰屾常",
|
||||||
|
"tag": "\uD83D\uDE02",
|
||||||
|
"position": "-50px 0px"
|
||||||
|
},
|
||||||
|
"u1F622": {
|
||||||
|
"en": "Sobbing",
|
||||||
|
"zh": "鍝常",
|
||||||
|
"tag": "\uD83D\uDE2D",
|
||||||
|
"position": "-2075px 0px"
|
||||||
|
},
|
||||||
|
"u1F62A": {
|
||||||
|
"en": "Sleepy Face",
|
||||||
|
"zh": "鍥<>",
|
||||||
|
"tag": "\uD83D\uDE2A",
|
||||||
|
"position": "-2000px 0px"
|
||||||
|
},
|
||||||
|
"u1F630": {
|
||||||
|
"en": "Cold Sweat",
|
||||||
|
"zh": "鍐锋睏",
|
||||||
|
"tag": "\uD83D\uDE30",
|
||||||
|
"position": "-550px 0px"
|
||||||
|
},
|
||||||
|
"u1F605": {
|
||||||
|
"en": "Happy Sweat",
|
||||||
|
"zh": "灏村艾",
|
||||||
|
"tag": "\uD83D\uDE05",
|
||||||
|
"position": "-100px 0px"
|
||||||
|
},
|
||||||
|
"u1F613": {
|
||||||
|
"en": "Sweat",
|
||||||
|
"zh": "姹<>",
|
||||||
|
"tag": "\uD83D\uDE13",
|
||||||
|
"position": "-275px 0px"
|
||||||
|
},
|
||||||
|
"u1F62B": {
|
||||||
|
"en": "Tired Face",
|
||||||
|
"zh": "鎶撶媯",
|
||||||
|
"tag": "\uD83D\uDE2B",
|
||||||
|
"position": "-2025px 0px"
|
||||||
|
},
|
||||||
|
"u1F629": {
|
||||||
|
"en": "Weary Face",
|
||||||
|
"zh": "鐤叉儷",
|
||||||
|
"tag": "\uD83D\uDE29",
|
||||||
|
"position": "-525px 0px"
|
||||||
|
},
|
||||||
|
"u1F628": {
|
||||||
|
"en": "Fearful Face",
|
||||||
|
"zh": "鍙€<EE889B>",
|
||||||
|
"tag": "\uD83D\uDE28",
|
||||||
|
"position": "-500px 0px"
|
||||||
|
},
|
||||||
|
"u1F631": {
|
||||||
|
"en": "Scream",
|
||||||
|
"zh": "灏栧彨",
|
||||||
|
"tag": "\uD83D\uDE31",
|
||||||
|
"position": "-575px 0px"
|
||||||
|
},
|
||||||
|
"u1F621": {
|
||||||
|
"en": "Angry Face",
|
||||||
|
"zh": "鐢熸皵",
|
||||||
|
"tag": "\uD83D\uDE21",
|
||||||
|
"position": "-400px 0px"
|
||||||
|
},
|
||||||
|
"u1F624": {
|
||||||
|
"en": "Mad Face",
|
||||||
|
"zh": "鎬掓皵鍐插啿",
|
||||||
|
"tag": "\uD83D\uDE24",
|
||||||
|
"position": "-475px 0px"
|
||||||
|
},
|
||||||
|
"u1F616": {
|
||||||
|
"en": "Confounded Face",
|
||||||
|
"zh": "钂欑緸",
|
||||||
|
"tag": "\uD83D\uDE16",
|
||||||
|
"position": "-350px 0px"
|
||||||
|
},
|
||||||
|
"u1F606": {
|
||||||
|
"en": "Big Grin",
|
||||||
|
"zh": "澶х瑧",
|
||||||
|
"tag": "\uD83D\uDE06",
|
||||||
|
"position": "-125px 0px"
|
||||||
|
},
|
||||||
|
"u1F60B": {
|
||||||
|
"en": "Hungry",
|
||||||
|
"zh": "棣<>",
|
||||||
|
"tag": "\uD83D\uDE0B",
|
||||||
|
"position": "-1750px 0px"
|
||||||
|
},
|
||||||
|
"u1F637": {
|
||||||
|
"en": "Mask Face",
|
||||||
|
"zh": "鍙g僵",
|
||||||
|
"tag": "\uD83D\uDE37",
|
||||||
|
"position": "-725px 0px"
|
||||||
|
},
|
||||||
|
"u1F60E": {
|
||||||
|
"en": "Sunglasses",
|
||||||
|
"zh": "澧ㄩ暅",
|
||||||
|
"tag": "\uD83D\uDE0E",
|
||||||
|
"position": "-1825px 0px"
|
||||||
|
},
|
||||||
|
"u1F634": {
|
||||||
|
"en": "Sleeping",
|
||||||
|
"zh": "鐫$湢",
|
||||||
|
"tag": "\uD83D\uDE34",
|
||||||
|
"position": "-650px 0px"
|
||||||
|
},
|
||||||
|
"u1F635": {
|
||||||
|
"en": "Dizzy Face",
|
||||||
|
"zh": "澶存檿鐪艰姳",
|
||||||
|
"tag": "\uD83D\uDE35",
|
||||||
|
"position": "-675px 0px"
|
||||||
|
},
|
||||||
|
"u1F632": {
|
||||||
|
"en": "Shocked Face",
|
||||||
|
"zh": "闇囨儕",
|
||||||
|
"tag": "\uD83D\uDE32",
|
||||||
|
"position": "-600px 0px"
|
||||||
|
},
|
||||||
|
"u1F608": {
|
||||||
|
"en": "Purple Devil",
|
||||||
|
"zh": "灏忔伓榄<E4BC93>",
|
||||||
|
"tag": "\uD83D\uDE08",
|
||||||
|
"position": "-175px 0px"
|
||||||
|
},
|
||||||
|
"u1F47F": {
|
||||||
|
"en": "Devil",
|
||||||
|
"zh": "鎭堕瓟",
|
||||||
|
"tag": "\uD83D\uDC7F",
|
||||||
|
"position": "-1600px 0px"
|
||||||
|
},
|
||||||
|
"u1F62F": {
|
||||||
|
"en": "Surprised Face",
|
||||||
|
"zh": "鎯婂憜",
|
||||||
|
"tag": "\uD83D\uDE2F",
|
||||||
|
"position": "-2100px 0px"
|
||||||
|
},
|
||||||
|
"u1F62C": {
|
||||||
|
"en": "Grimacing Face",
|
||||||
|
"zh": "鎵鑴<EE8397>",
|
||||||
|
"tag": "\uD83D\uDE2C",
|
||||||
|
"position": "-2050px 0px"
|
||||||
|
},
|
||||||
|
"u1F615": {
|
||||||
|
"en": "Confused",
|
||||||
|
"zh": "鍥版儜",
|
||||||
|
"tag": "\uD83D\uDE15",
|
||||||
|
"position": "-325px 0px"
|
||||||
|
},
|
||||||
|
"u1F636": {
|
||||||
|
"en": "Mouthless",
|
||||||
|
"zh": "鏃犲彛",
|
||||||
|
"tag": "\uD83D\uDE36",
|
||||||
|
"position": "-700px 0px"
|
||||||
|
},
|
||||||
|
"u1F607": {
|
||||||
|
"en": "Halo",
|
||||||
|
"zh": "澶╀娇鍏夌幆",
|
||||||
|
"tag": "\uD83D\uDE07",
|
||||||
|
"position": "-150px 0px"
|
||||||
|
},
|
||||||
|
"u1F60F": {
|
||||||
|
"en": "Smirking Face",
|
||||||
|
"zh": "鍌荤瑧",
|
||||||
|
"tag": "\uD83D\uDE0F",
|
||||||
|
"position": "-1850px 0px"
|
||||||
|
},
|
||||||
|
"u1F611": {
|
||||||
|
"en": "Expressionless Face",
|
||||||
|
"zh": "闈㈡棤琛ㄦ儏",
|
||||||
|
"tag": "\uD83D\uDE11",
|
||||||
|
"position": "-225px 0px"
|
||||||
|
},
|
||||||
|
"u1F648": {
|
||||||
|
"en": "See No Monkey",
|
||||||
|
"zh": "涓嶇湅",
|
||||||
|
"tag": "\uD83D\uDE48",
|
||||||
|
"position": "-2675px 0px"
|
||||||
|
},
|
||||||
|
"u1F649": {
|
||||||
|
"en": "Hear No Monkey",
|
||||||
|
"zh": "涓嶅惉",
|
||||||
|
"tag": "\uD83D\uDE49",
|
||||||
|
"position": "-2700px 0px"
|
||||||
|
},
|
||||||
|
"u1F64A": {
|
||||||
|
"en": "No Speaking",
|
||||||
|
"zh": "闂槾",
|
||||||
|
"tag": "\uD83D\uDE4A",
|
||||||
|
"position": "-2125px 0px"
|
||||||
|
},
|
||||||
|
"u1F47D": {
|
||||||
|
"en": "Alien",
|
||||||
|
"zh": "澶栨槦浜<E6A7A6>",
|
||||||
|
"tag": "\uD83D\uDC7D",
|
||||||
|
"position": "-1575px 0px"
|
||||||
|
},
|
||||||
|
"u1F4A9": {
|
||||||
|
"en": "Pile Of Poo",
|
||||||
|
"zh": "渚夸究",
|
||||||
|
"tag": "\uD83D\uDCA9",
|
||||||
|
"position": "-1025px 0px"
|
||||||
|
},
|
||||||
|
"u1F494": {
|
||||||
|
"en": "Broken Heart",
|
||||||
|
"zh": "蹇冪",
|
||||||
|
"tag": "\uD83D\uDC94",
|
||||||
|
"position": "-2600px 0px"
|
||||||
|
},
|
||||||
|
"u1F525": {
|
||||||
|
"en": "Fire",
|
||||||
|
"zh": "鐏<>",
|
||||||
|
"tag": "\uD83D\uDD25",
|
||||||
|
"position": "-2625px 0px"
|
||||||
|
},
|
||||||
|
"u1F4A2": {
|
||||||
|
"en": "Anger",
|
||||||
|
"zh": "鎰ゆ€<E38286>",
|
||||||
|
"tag": "\uD83D\uDCA2",
|
||||||
|
"position": "-950px 0px"
|
||||||
|
},
|
||||||
|
"u1F4A4": {
|
||||||
|
"en": "Zzz",
|
||||||
|
"zh": "ZZZ",
|
||||||
|
"tag": "\uD83D\uDCA4",
|
||||||
|
"position": "-1000px 0px"
|
||||||
|
},
|
||||||
|
"u1F6AB": {
|
||||||
|
"en": "Prohibited",
|
||||||
|
"zh": "绂佹",
|
||||||
|
"tag": "\uD83D\uDEAB",
|
||||||
|
"position": "-1175px 0px"
|
||||||
|
},
|
||||||
|
"u2B50": {
|
||||||
|
"en": "Star",
|
||||||
|
"zh": "鏄熸槦",
|
||||||
|
"tag": "\u2B50",
|
||||||
|
"position": "-2750px 0px"
|
||||||
|
},
|
||||||
|
"u26A1": {
|
||||||
|
"en": "Lightning Bolt",
|
||||||
|
"zh": "闂數",
|
||||||
|
"tag": "\u26A1",
|
||||||
|
"position": "-2825px 0px"
|
||||||
|
},
|
||||||
|
"u1F319": {
|
||||||
|
"en": "Drescent Moon",
|
||||||
|
"zh": "寮湀",
|
||||||
|
"tag": "\uD83C\uDF19",
|
||||||
|
"position": "-2175px 0px"
|
||||||
|
},
|
||||||
|
"u2600": {
|
||||||
|
"en": "Sunny",
|
||||||
|
"zh": "鏅存湕",
|
||||||
|
"tag": "\u2600",
|
||||||
|
"position": "-3075px 0px"
|
||||||
|
},
|
||||||
|
"u26C5": {
|
||||||
|
"en": "Cloudy",
|
||||||
|
"zh": "澶氫簯",
|
||||||
|
"tag": "\u26C5",
|
||||||
|
"position": "-2900px 0px"
|
||||||
|
},
|
||||||
|
"u2601": {
|
||||||
|
"en": "Cloud",
|
||||||
|
"zh": "浜戝僵",
|
||||||
|
"tag": "\u2601",
|
||||||
|
"position": "-3100px 0px"
|
||||||
|
},
|
||||||
|
"u2744": {
|
||||||
|
"en": "Snowflake",
|
||||||
|
"zh": "闆姳",
|
||||||
|
"tag": "\u2744",
|
||||||
|
"position": "-3175px 0px"
|
||||||
|
},
|
||||||
|
"u2614": {
|
||||||
|
"en": "Umbrella",
|
||||||
|
"zh": "闆ㄤ紴",
|
||||||
|
"tag": "\u2614",
|
||||||
|
"position": "-3125px 0px"
|
||||||
|
},
|
||||||
|
"u26C4": {
|
||||||
|
"en": "Snowman",
|
||||||
|
"zh": "闆汉",
|
||||||
|
"tag": "\u26C4",
|
||||||
|
"position": "-2875px 0px"
|
||||||
|
},
|
||||||
|
"u1F44D": {
|
||||||
|
"en": "Thumbs Up",
|
||||||
|
"zh": "璧<>",
|
||||||
|
"tag": "\uD83D\uDC4D",
|
||||||
|
"position": "-1400px 0px"
|
||||||
|
},
|
||||||
|
"u1F44E": {
|
||||||
|
"en": "Thumbs Down",
|
||||||
|
"zh": "鍠濆€掑僵",
|
||||||
|
"tag": "\uD83D\uDC4E",
|
||||||
|
"position": "-1425px 0px"
|
||||||
|
},
|
||||||
|
"u1F91D": {
|
||||||
|
"en": "Handshake",
|
||||||
|
"zh": "鎻℃墜",
|
||||||
|
"tag": "\uD83E\uDD1D",
|
||||||
|
"position": "-3200px 0px"
|
||||||
|
},
|
||||||
|
"u1F44C": {
|
||||||
|
"en": "Ok Hand",
|
||||||
|
"zh": "娌¢棶棰<E6A3B6>",
|
||||||
|
"tag": "\uD83D\uDC4C",
|
||||||
|
"position": "-1375px 0px"
|
||||||
|
},
|
||||||
|
"u1F44A": {
|
||||||
|
"en": "Raised Fist",
|
||||||
|
"zh": "涓捐捣鎷冲ご",
|
||||||
|
"tag": "\u270A",
|
||||||
|
"position": "-2975px 0px"
|
||||||
|
},
|
||||||
|
"u270A": {
|
||||||
|
"en": "Oncoming Fist",
|
||||||
|
"zh": "鍑绘嫵",
|
||||||
|
"tag": "\uD83D\uDC4A",
|
||||||
|
"position": "-1350px 0px"
|
||||||
|
},
|
||||||
|
"u270C": {
|
||||||
|
"en": "Victory Hand",
|
||||||
|
"zh": "鑰<>",
|
||||||
|
"tag": "\u270C",
|
||||||
|
"position": "-3025px 0px"
|
||||||
|
},
|
||||||
|
"u270B": {
|
||||||
|
"en": "Raised Hand",
|
||||||
|
"zh": "涓炬墜",
|
||||||
|
"tag": "\u270B",
|
||||||
|
"position": "-3000px 0px"
|
||||||
|
},
|
||||||
|
"u1F64F": {
|
||||||
|
"en": "Folded Hands",
|
||||||
|
"zh": "绁堢シ",
|
||||||
|
"tag": "\uD83D\uDE4F",
|
||||||
|
"position": "-2150px 0px"
|
||||||
|
},
|
||||||
|
"u261D": {
|
||||||
|
"en": "Pointing Up",
|
||||||
|
"zh": "绗竴",
|
||||||
|
"tag": "\u261D",
|
||||||
|
"position": "-2925px 0px"
|
||||||
|
},
|
||||||
|
"u1F44F": {
|
||||||
|
"en": "Clapping Hands",
|
||||||
|
"zh": "榧撴帉",
|
||||||
|
"tag": "\uD83D\uDC4F",
|
||||||
|
"position": "-1450px 0px"
|
||||||
|
},
|
||||||
|
"u1F4AA": {
|
||||||
|
"en": "Flexed Biceps",
|
||||||
|
"zh": "鑲岃倝",
|
||||||
|
"tag": "\uD83D\uDCAA",
|
||||||
|
"position": "-1050px 0px"
|
||||||
|
},
|
||||||
|
"u1F46A": {
|
||||||
|
"en": "Family",
|
||||||
|
"zh": "瀹跺涵",
|
||||||
|
"tag": "\uD83D\uDC6A",
|
||||||
|
"position": "-1475px 0px"
|
||||||
|
},
|
||||||
|
"u1F46B": {
|
||||||
|
"en": "Couple",
|
||||||
|
"zh": "鎯呬荆",
|
||||||
|
"tag": "\uD83D\uDC6B",
|
||||||
|
"position": "-1500px 0px"
|
||||||
|
},
|
||||||
|
"u1F47C": {
|
||||||
|
"en": "Baby Angel",
|
||||||
|
"zh": "瀹濊礉澶╀娇",
|
||||||
|
"tag": "\uD83D\uDC7C",
|
||||||
|
"position": "-1550px 0px"
|
||||||
|
},
|
||||||
|
"u1F434": {
|
||||||
|
"en": "Horse",
|
||||||
|
"zh": "椹<>",
|
||||||
|
"tag": "\uD83D\uDC34",
|
||||||
|
"position": "-2475px 0px"
|
||||||
|
},
|
||||||
|
"u1F436": {
|
||||||
|
"en": "Dog",
|
||||||
|
"zh": "鐙<>",
|
||||||
|
"tag": "\uD83D\uDC36",
|
||||||
|
"position": "-2500px 0px"
|
||||||
|
},
|
||||||
|
"u1F437": {
|
||||||
|
"en": "Pig",
|
||||||
|
"zh": "鐚<>",
|
||||||
|
"tag": "\uD83D\uDC37",
|
||||||
|
"position": "-2525px 0px"
|
||||||
|
},
|
||||||
|
"u1F47B": {
|
||||||
|
"en": "Ghost",
|
||||||
|
"zh": "楝<>",
|
||||||
|
"tag": "\uD83D\uDC7B",
|
||||||
|
"position": "-1525px 0px"
|
||||||
|
},
|
||||||
|
"u1F339": {
|
||||||
|
"en": "Rose",
|
||||||
|
"zh": "鐜懓",
|
||||||
|
"tag": "\uD83C\uDF39",
|
||||||
|
"position": "-2225px 0px"
|
||||||
|
},
|
||||||
|
"u1F33B": {
|
||||||
|
"en": "Sunflower",
|
||||||
|
"zh": "鍚戞棩钁<E6A3A9>",
|
||||||
|
"tag": "\uD83C\uDF3B",
|
||||||
|
"position": "-1250px 0px"
|
||||||
|
},
|
||||||
|
"u1F332": {
|
||||||
|
"en": "Pine Tree",
|
||||||
|
"zh": "鏉炬爲",
|
||||||
|
"tag": "\uD83C\uDF32",
|
||||||
|
"position": "-2200px 0px"
|
||||||
|
},
|
||||||
|
"u1F384": {
|
||||||
|
"en": "Christmas Tree",
|
||||||
|
"zh": "鍦h癁鏍<E79981>",
|
||||||
|
"tag": "\uD83C\uDF84",
|
||||||
|
"position": "-2400px 0px"
|
||||||
|
},
|
||||||
|
"u1F381": {
|
||||||
|
"en": "Wrapped Gift",
|
||||||
|
"zh": "绀肩墿",
|
||||||
|
"tag": "\uD83C\uDF81",
|
||||||
|
"position": "-2350px 0px"
|
||||||
|
},
|
||||||
|
"u1F389": {
|
||||||
|
"en": "Party Popper",
|
||||||
|
"zh": "鑱氫細绀艰姳",
|
||||||
|
"tag": "\uD83C\uDF89",
|
||||||
|
"position": "-2425px 0px"
|
||||||
|
},
|
||||||
|
"u1F4B0": {
|
||||||
|
"en": "Money Bag",
|
||||||
|
"zh": "閽辫",
|
||||||
|
"tag": "\uD83D\uDCB0",
|
||||||
|
"position": "-1075px 0px"
|
||||||
|
},
|
||||||
|
"u1F382": {
|
||||||
|
"en": "Birthday Cake",
|
||||||
|
"zh": "鐢熸棩铔嬬硶",
|
||||||
|
"tag": "\uD83C\uDF82",
|
||||||
|
"position": "-2375px 0px"
|
||||||
|
},
|
||||||
|
"u1F356": {
|
||||||
|
"en": "Barbecue",
|
||||||
|
"zh": "BBQ",
|
||||||
|
"tag": "\uD83C\uDF56",
|
||||||
|
"position": "-2275px 0px"
|
||||||
|
},
|
||||||
|
"u1F35A": {
|
||||||
|
"en": "Cooked Rice",
|
||||||
|
"zh": "绫抽キ",
|
||||||
|
"tag": "\uD83C\uDF5A",
|
||||||
|
"position": "-1275px 0px"
|
||||||
|
},
|
||||||
|
"u1F366": {
|
||||||
|
"en": "Ice Cream",
|
||||||
|
"zh": "鍐版穱娣<E7A9B1>",
|
||||||
|
"tag": "\uD83C\uDF66",
|
||||||
|
"position": "-2300px 0px"
|
||||||
|
},
|
||||||
|
"u1F36B": {
|
||||||
|
"en": "Chocolate Bar",
|
||||||
|
"zh": "宸у厠鍔<E58EA0>",
|
||||||
|
"tag": "\uD83C\uDF6B",
|
||||||
|
"position": "-1300px 0px"
|
||||||
|
},
|
||||||
|
"u1F349": {
|
||||||
|
"en": "Watermelon",
|
||||||
|
"zh": "瑗跨摐",
|
||||||
|
"tag": "\uD83C\uDF49",
|
||||||
|
"position": "-2250px 0px"
|
||||||
|
},
|
||||||
|
"u1F377": {
|
||||||
|
"en": "Wine Glass",
|
||||||
|
"zh": "绾㈤厭",
|
||||||
|
"tag": "\uD83C\uDF77",
|
||||||
|
"position": "-2325px 0px"
|
||||||
|
},
|
||||||
|
"u1F37B": {
|
||||||
|
"en": "Cheers",
|
||||||
|
"zh": "骞叉澂",
|
||||||
|
"tag": "\uD83C\uDF7B",
|
||||||
|
"position": "-1325px 0px"
|
||||||
|
},
|
||||||
|
"u2615": {
|
||||||
|
"en": "Coffee",
|
||||||
|
"zh": "鍜栧暋",
|
||||||
|
"tag": "\u2615",
|
||||||
|
"position": "-3150px 0px"
|
||||||
|
},
|
||||||
|
"u1F3C0": {
|
||||||
|
"en": "Basketball",
|
||||||
|
"zh": "绡悆",
|
||||||
|
"tag": "\uD83C\uDFC0",
|
||||||
|
"position": "-825px 0px"
|
||||||
|
},
|
||||||
|
"u26BD": {
|
||||||
|
"en": "Soccer Ball",
|
||||||
|
"zh": "瓒崇悆",
|
||||||
|
"tag": "\u26BD",
|
||||||
|
"position": "-2850px 0px"
|
||||||
|
},
|
||||||
|
"u1F3C2": {
|
||||||
|
"en": "Snowboarder",
|
||||||
|
"zh": "鍗曟澘婊戦洩",
|
||||||
|
"tag": "\uD83C\uDFC2",
|
||||||
|
"position": "-850px 0px"
|
||||||
|
},
|
||||||
|
"u1F3A4": {
|
||||||
|
"en": "Microphone",
|
||||||
|
"zh": "楹﹀厠椋<E58EA0>",
|
||||||
|
"tag": "\uD83C\uDFA4",
|
||||||
|
"position": "-750px 0px"
|
||||||
|
},
|
||||||
|
"u1F3B5": {
|
||||||
|
"en": "Musical Note",
|
||||||
|
"zh": "闊充箰",
|
||||||
|
"tag": "\uD83C\uDFB5",
|
||||||
|
"position": "-800px 0px"
|
||||||
|
},
|
||||||
|
"u1F3B2": {
|
||||||
|
"en": "Game Die",
|
||||||
|
"zh": "楠板瓙",
|
||||||
|
"tag": "\uD83C\uDFB2",
|
||||||
|
"position": "-775px 0px"
|
||||||
|
},
|
||||||
|
"u1F004": {
|
||||||
|
"en": "Mahjong Red Dragon",
|
||||||
|
"zh": "楹诲皢",
|
||||||
|
"tag": "\uD83C\uDC04",
|
||||||
|
"position": "-900px 0px"
|
||||||
|
},
|
||||||
|
"u1F451": {
|
||||||
|
"en": "Crown",
|
||||||
|
"zh": "鐜嬪啝",
|
||||||
|
"tag": "\uD83D\uDC51",
|
||||||
|
"position": "-2550px 0px"
|
||||||
|
},
|
||||||
|
"u1F484": {
|
||||||
|
"en": "Lipstick",
|
||||||
|
"zh": "鍙g孩",
|
||||||
|
"tag": "\uD83D\uDC84",
|
||||||
|
"position": "-2575px 0px"
|
||||||
|
},
|
||||||
|
"u1F48B": {
|
||||||
|
"en": "Kiss",
|
||||||
|
"zh": "鍚<>",
|
||||||
|
"tag": "\uD83D\uDC8B",
|
||||||
|
"position": "-1650px 0px"
|
||||||
|
},
|
||||||
|
"u1F48D": {
|
||||||
|
"en": "Ring",
|
||||||
|
"zh": "鎴掓寚",
|
||||||
|
"tag": "\uD83D\uDC8D",
|
||||||
|
"position": "-1675px 0px"
|
||||||
|
},
|
||||||
|
"u1F4DA": {
|
||||||
|
"en": "Books",
|
||||||
|
"zh": "涔︾睄",
|
||||||
|
"tag": "\uD83D\uDCDA",
|
||||||
|
"position": "-1100px 0px"
|
||||||
|
},
|
||||||
|
"u1F393": {
|
||||||
|
"en": "Graduation Cap",
|
||||||
|
"zh": "姣曚笟甯<E7AC9F>",
|
||||||
|
"tag": "\uD83C\uDF93",
|
||||||
|
"position": "-2450px 0px"
|
||||||
|
},
|
||||||
|
"u270F": {
|
||||||
|
"en": "Pencil",
|
||||||
|
"zh": "閾呯瑪",
|
||||||
|
"tag": "\u270F",
|
||||||
|
"position": "-3050px 0px"
|
||||||
|
},
|
||||||
|
"u1F3E1": {
|
||||||
|
"en": "House With Garden",
|
||||||
|
"zh": "鎴垮瓙",
|
||||||
|
"tag": "\uD83C\uDFE1",
|
||||||
|
"position": "-875px 0px"
|
||||||
|
},
|
||||||
|
"u1F6BF": {
|
||||||
|
"en": "Shower",
|
||||||
|
"zh": "娣嬫荡",
|
||||||
|
"tag": "\uD83D\uDEBF",
|
||||||
|
"position": "-1200px 0px"
|
||||||
|
},
|
||||||
|
"u1F4A1": {
|
||||||
|
"en": "Light Bulb",
|
||||||
|
"zh": "鐏场",
|
||||||
|
"tag": "\uD83D\uDCA1",
|
||||||
|
"position": "-925px 0px"
|
||||||
|
},
|
||||||
|
"u1F4DE": {
|
||||||
|
"en": "Telephone Receiver",
|
||||||
|
"zh": "鐢佃瘽鍚瓛",
|
||||||
|
"tag": "\uD83D\uDCDE",
|
||||||
|
"position": "-1125px 0px"
|
||||||
|
},
|
||||||
|
"u1F4E2": {
|
||||||
|
"en": "Loudspeaker",
|
||||||
|
"zh": "鎵╅煶鍣<E785B6>",
|
||||||
|
"tag": "\uD83D\uDCE2",
|
||||||
|
"position": "-1150px 0px"
|
||||||
|
},
|
||||||
|
"u1F556": {
|
||||||
|
"en": "Clock",
|
||||||
|
"zh": "琛<>",
|
||||||
|
"tag": "\uD83D\uDD56",
|
||||||
|
"position": "-2650px 0px"
|
||||||
|
},
|
||||||
|
"u23F0": {
|
||||||
|
"en": "Alarm Clock",
|
||||||
|
"zh": "闂归挓",
|
||||||
|
"tag": "\u23F0",
|
||||||
|
"position": "-2775px 0px"
|
||||||
|
},
|
||||||
|
"u23F3": {
|
||||||
|
"en": "Hourglass",
|
||||||
|
"zh": "娌欐紡",
|
||||||
|
"tag": "\u23F3",
|
||||||
|
"position": "-2800px 0px"
|
||||||
|
},
|
||||||
|
"u1F4A3": {
|
||||||
|
"en": "Bomb",
|
||||||
|
"zh": "鐐稿脊",
|
||||||
|
"tag": "\uD83D\uDCA3",
|
||||||
|
"position": "-975px 0px"
|
||||||
|
},
|
||||||
|
"u1F52B": {
|
||||||
|
"en": "Pistol",
|
||||||
|
"zh": "鎵嬫灙",
|
||||||
|
"tag": "\uD83D\uDD2B",
|
||||||
|
"position": "-1700px 0px"
|
||||||
|
},
|
||||||
|
"u1F48A": {
|
||||||
|
"en": "Capsule",
|
||||||
|
"zh": "鑽<>",
|
||||||
|
"tag": "\uD83D\uDC8A",
|
||||||
|
"position": "-1625px 0px"
|
||||||
|
},
|
||||||
|
"u1F680": {
|
||||||
|
"en": "Rocket",
|
||||||
|
"zh": "鐏",
|
||||||
|
"tag": "\uD83D\uDE80",
|
||||||
|
"position": "-2725px 0px"
|
||||||
|
},
|
||||||
|
"u1F30F": {
|
||||||
|
"en": "Globe",
|
||||||
|
"zh": "鍦扮悆",
|
||||||
|
"tag": "\uD83C\uDF0F",
|
||||||
|
"position": "-1225px 0px"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let EmojiList = []
|
||||||
|
|
||||||
|
function setEmojiList() {
|
||||||
|
EmojiList.length = 0;
|
||||||
|
for (var unicode in EmojiFactory) {
|
||||||
|
var detail = EmojiFactory[unicode];
|
||||||
|
if (detail.tag) {
|
||||||
|
var lang = 'en';
|
||||||
|
var symbol = detail[lang];
|
||||||
|
EmojiList.push({
|
||||||
|
unicode: unicode,
|
||||||
|
symbol: '[' + symbol + ']',
|
||||||
|
emoji: detail.tag,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setEmojiList()
|
||||||
|
export default EmojiList
|
||||||
BIN
static/im/toast/sentVoice.mp3
Executable file
BIN
static/im/toast/sentVoice.mp3
Executable file
Binary file not shown.
BIN
static/imgs/map.jpeg
Normal file
BIN
static/imgs/map.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
static/imgs/no-new-news.png
Normal file
BIN
static/imgs/no-new-news.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
static/imgs/tel-call.png
Normal file
BIN
static/imgs/tel-call.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
@@ -1,4 +1,7 @@
|
|||||||
import im from "@/utils/im/index.js"
|
import im from "@/utils/im/index.js"
|
||||||
|
import {
|
||||||
|
contactModel
|
||||||
|
} from '@/utils/im/models.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
state: {
|
state: {
|
||||||
@@ -14,7 +17,7 @@ export default {
|
|||||||
const info = state.contacts[targetId]
|
const info = state.contacts[targetId]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: info.name,
|
name: info.remark ? info.remark : info.name,
|
||||||
hash: info.hash,
|
hash: info.hash,
|
||||||
portraitUrl: info.localAvatar ? info.localAvatar : require('@/static/user/cover.png')
|
portraitUrl: info.localAvatar ? info.localAvatar : require('@/static/user/cover.png')
|
||||||
}
|
}
|
||||||
@@ -38,18 +41,40 @@ export default {
|
|||||||
updateContactInfo(state, contactInfo) {
|
updateContactInfo(state, contactInfo) {
|
||||||
Vue.set(state.contacts, contactInfo.targetId, contactInfo)
|
Vue.set(state.contacts, contactInfo.targetId, contactInfo)
|
||||||
},
|
},
|
||||||
|
// 设置我的资料
|
||||||
setSenderInfo(state, contactInfo) {
|
setSenderInfo(state, contactInfo) {
|
||||||
state.myInfo = {
|
state.myInfo = {
|
||||||
userId: contactInfo.targetId,
|
userId: contactInfo.targetId,
|
||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
portraitUrl: contactInfo.portraitUrl
|
portraitUrl: contactInfo.portraitUrl
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setContactRemark(state, contactInfo) {
|
||||||
|
Vue.set(state.contacts, contactInfo.targetId, contactInfo)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setSenderInfo({
|
setContactRemark({
|
||||||
commit
|
commit
|
||||||
|
}, {
|
||||||
|
targetId,
|
||||||
|
remark
|
||||||
|
}) {
|
||||||
|
contactModel.find('targetId="' + targetId + '"', (err, result) => {
|
||||||
|
if (!err && result.length > 0) {
|
||||||
|
result[0].remark = remark
|
||||||
|
contactModel.update('targetId="' + targetId + '"', result[0], (err, res) => {
|
||||||
|
commit('setContactRemark', result[0])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
setSenderInfo({
|
||||||
|
commit,
|
||||||
|
dispatch
|
||||||
}, contactInfo) {
|
}, contactInfo) {
|
||||||
|
contactInfo.type = 0 // type 更改为0,标记是我自己
|
||||||
|
dispatch('updateContact', contactInfo)
|
||||||
commit('setSenderInfo', contactInfo)
|
commit('setSenderInfo', contactInfo)
|
||||||
},
|
},
|
||||||
// 载入好友信息
|
// 载入好友信息
|
||||||
@@ -63,8 +88,7 @@ export default {
|
|||||||
commit,
|
commit,
|
||||||
dispatch
|
dispatch
|
||||||
}, contactInfo) {
|
}, contactInfo) {
|
||||||
const model = uni.model.contactModel
|
contactModel.find('targetId="' + contactInfo.targetId + '"', (err, result) => {
|
||||||
model.find('targetId="' + contactInfo.targetId + '"', (err, result) => {
|
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
// 没有数据,直接新增一条
|
// 没有数据,直接新增一条
|
||||||
dispatch('initContact', contactInfo)
|
dispatch('initContact', contactInfo)
|
||||||
@@ -75,13 +99,13 @@ export default {
|
|||||||
targetId: contactInfo.targetId,
|
targetId: contactInfo.targetId,
|
||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
|
type: contactInfo.type,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: savedFilePath,
|
localAvatar: savedFilePath
|
||||||
type: contactInfo.type
|
|
||||||
}
|
}
|
||||||
model.update('targetId="' + contactInfo.targetId + '"', info, (err,
|
contactModel.update('targetId="' + contactInfo.targetId + '"', info, (err,
|
||||||
res) => {
|
res) => {
|
||||||
console.log('UPDATE AVATAR, ERR', err, info);
|
console.log('UPDATE AVATAR, ERR', err, info)
|
||||||
})
|
})
|
||||||
commit('updateContactInfo', info)
|
commit('updateContactInfo', info)
|
||||||
})
|
})
|
||||||
@@ -90,17 +114,17 @@ export default {
|
|||||||
targetId: contactInfo.targetId,
|
targetId: contactInfo.targetId,
|
||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
|
type: contactInfo.type,
|
||||||
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) => {
|
contactModel.update('targetId="' + contactInfo.targetId + '"', info, (err, res) => {
|
||||||
console.log('UPDATE NAME, ERR', err, info);
|
console.log('UPDATE NAME, ERR', err, info);
|
||||||
})
|
})
|
||||||
commit('updateContactInfo', info)
|
commit('updateContactInfo', info)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('updateContact, 无操作');
|
console.log('updateContact, 无操作')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -110,7 +134,6 @@ export default {
|
|||||||
}, contactInfo) {
|
}, contactInfo) {
|
||||||
// 将好友信息保存到vuex的内存中,方便立即使用
|
// 将好友信息保存到vuex的内存中,方便立即使用
|
||||||
commit('updateContactInfo', contactInfo)
|
commit('updateContactInfo', contactInfo)
|
||||||
const model = uni.model.contactModel
|
|
||||||
// 用户头像,是否需要下载到本地
|
// 用户头像,是否需要下载到本地
|
||||||
if (contactInfo.portraitUrl) {
|
if (contactInfo.portraitUrl) {
|
||||||
saveAvatar(contactInfo, (savedFilePath) => {
|
saveAvatar(contactInfo, (savedFilePath) => {
|
||||||
@@ -118,11 +141,13 @@ export default {
|
|||||||
targetId: contactInfo.targetId,
|
targetId: contactInfo.targetId,
|
||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
|
type: contactInfo.type,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: savedFilePath,
|
localAvatar: savedFilePath
|
||||||
type: contactInfo.type
|
|
||||||
}
|
}
|
||||||
model.insert(info, (err, res) => {})
|
contactModel.insert(info, (err, res) => {
|
||||||
|
console.error('保存头像', err, res)
|
||||||
|
})
|
||||||
// 保存头像后,更新信息
|
// 保存头像后,更新信息
|
||||||
commit('updateContactInfo', info)
|
commit('updateContactInfo', info)
|
||||||
})
|
})
|
||||||
@@ -132,11 +157,13 @@ export default {
|
|||||||
targetId: contactInfo.targetId,
|
targetId: contactInfo.targetId,
|
||||||
name: contactInfo.name,
|
name: contactInfo.name,
|
||||||
hash: contactInfo.hash,
|
hash: contactInfo.hash,
|
||||||
|
type: contactInfo.type,
|
||||||
portraitUrl: contactInfo.portraitUrl,
|
portraitUrl: contactInfo.portraitUrl,
|
||||||
localAvatar: '',
|
localAvatar: ''
|
||||||
type: contactInfo.type
|
|
||||||
}
|
}
|
||||||
model.insert(info, (err, res) => {})
|
contactModel.insert(info, (err, res) => {
|
||||||
|
console.error('没保存头像', err, res)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
uni_modules/onemue-USQLite/.DS_Store
vendored
Normal file
BIN
uni_modules/onemue-USQLite/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -1,7 +1,10 @@
|
|||||||
## 2.1.0(2022-01-14)
|
## 2.2.2(2022-02-18)
|
||||||
1. 新增了添加多个数据的事件选项(options, index)(感谢`@风扬`)
|
1. 解决了自增约束的部分bug
|
||||||
## 2.1.2(2022-01-14)
|
2. 解决了处理类型的问题
|
||||||
1. 新增了添加多个数据的事件选项(options, index)(感谢`@风扬`)
|
## 2.2.0(2022-02-16)
|
||||||
|
1. 重新处理了判断类型的方法
|
||||||
|
2. 解决了`no connect`的问题
|
||||||
|
3. 新增了自增约束,需要为数字类型
|
||||||
## 2.1.0(2022-01-14)
|
## 2.1.0(2022-01-14)
|
||||||
1. 新增了添加多个数据的事件选项(options, index)(感谢`@风扬`)
|
1. 新增了添加多个数据的事件选项(options, index)(感谢`@风扬`)
|
||||||
## 2.0.2(2022-01-05)
|
## 2.0.2(2022-01-05)
|
||||||
|
|||||||
@@ -37,10 +37,13 @@ class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.log(primaryKeyArr.length);
|
Utils.log(primaryKeyArr.length);
|
||||||
if (primaryKeyArr.length>=1) {
|
if (primaryKeyArr.length>1) {
|
||||||
sql = `CREATE TABLE '${name}' (${sqlArr.join(', ')}, PRIMARY KEY (${primaryKeyArr.join()}))`;
|
|
||||||
}else{
|
sql = `CREATE TABLE '${name}' (${sqlArr.join(', ').replaceAll(' PRIMARY KEY','')}, PRIMARY KEY (${primaryKeyArr.join()}))`;
|
||||||
|
}
|
||||||
|
else{
|
||||||
sql = `CREATE TABLE '${name}' (${sqlArr.join(', ')})`;
|
sql = `CREATE TABLE '${name}' (${sqlArr.join(', ')})`;
|
||||||
}
|
}
|
||||||
Utils.log(`modelSql :${sql}`);
|
Utils.log(`modelSql :${sql}`);
|
||||||
@@ -59,6 +62,22 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
restrainArray.push(Utils.toType(options.type));
|
restrainArray.push(Utils.toType(options.type));
|
||||||
|
|
||||||
|
// 主键
|
||||||
|
if (options.primaryKey == true) {
|
||||||
|
if(options.autoIncrement != true){
|
||||||
|
restrainArray.push('PRIMARY KEY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自增
|
||||||
|
if (Utils.isNumber(options.type)&&options.autoIncrement == true) {
|
||||||
|
restrainArray.pop();
|
||||||
|
restrainArray.push('INTEGER');
|
||||||
|
restrainArray.push('PRIMARY KEY');
|
||||||
|
restrainArray.push('AUTOINCREMENT');
|
||||||
|
}
|
||||||
|
|
||||||
// 非空
|
// 非空
|
||||||
if (options.notNull == true) {
|
if (options.notNull == true) {
|
||||||
restrainArray.push('NOT NULL');
|
restrainArray.push('NOT NULL');
|
||||||
@@ -74,10 +93,6 @@ class Utils {
|
|||||||
restrainArray.push('UNIQUE');
|
restrainArray.push('UNIQUE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主键
|
|
||||||
// if (options.primaryKey === true) {
|
|
||||||
// restrainArray.push('PRIMARY KEY');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 检查
|
// 检查
|
||||||
if (options.check) {
|
if (options.check) {
|
||||||
@@ -87,27 +102,44 @@ class Utils {
|
|||||||
return restrainArray.join(' ');
|
return restrainArray.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 联合主键
|
|
||||||
static getUnionPrimaryKey() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static toType(jsType) {
|
static toType(jsType) {
|
||||||
let sqliteType = '';
|
let sqliteType = '';
|
||||||
if (jsType == Number) {
|
if (Utils.isNumber(jsType)) {
|
||||||
sqliteType = 'numeric';
|
sqliteType = 'numeric';
|
||||||
} else if (jsType == Date) {
|
} else if (Utils.isDate(jsType)) {
|
||||||
sqliteType = 'timestamp';
|
sqliteType = 'timestamp';
|
||||||
} else {
|
} else {
|
||||||
sqliteType = 'varchar';
|
sqliteType = 'varchar';
|
||||||
}
|
}
|
||||||
return sqliteType;
|
return sqliteType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static log() {
|
static log() {
|
||||||
if (config.deBug) {
|
if (config.deBug) {
|
||||||
console.log.apply(null, arguments);
|
console.log.apply(null, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static warn() {
|
||||||
|
if (config.deBug) {
|
||||||
|
console.warn.apply(null, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static error() {
|
||||||
|
console.error.apply(null, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
static isArray(value){ return Object.prototype.toString.call(value) === '[object Array]'}
|
||||||
|
static isObject(value){ return Object.prototype.toString.call(value) === '[object Object]'}
|
||||||
|
static isString(value){ return Object.prototype.toString.call(value) === '[object String]'}
|
||||||
|
static isFunction(value){ return (value === Function || Object.prototype.toString.call(value) === '[object Function]')}
|
||||||
|
static isNumber(value){ return (value === Number || Object.prototype.toString.call(value) === '[object Number]')}
|
||||||
|
static isNaN(value){ return (Object.prototype.toString.call(value) === '[object Number]' && isNaN(value))}
|
||||||
|
static isBoolean(value){ return Object.prototype.toString.call(value) === '[object Boolean]'}
|
||||||
|
static isUndefined(value){ return Object.prototype.toString.call(value) === '[object Undefined]'}
|
||||||
|
static isModel(value){ return Object.prototype.toString.call(value) === '[object Model]'}
|
||||||
|
static isDate(value){ return (value === Date||Object.prototype.toString.call(value) === '[object Date]')}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -118,7 +150,7 @@ class Model {
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {String} name 数据库表名
|
* @param {String} name 数据库表名
|
||||||
* @param {Object} options 数据表列对象
|
* @param {} options 数据表列对象
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
constructor(name, options) {
|
constructor(name, options) {
|
||||||
@@ -129,7 +161,10 @@ class Model {
|
|||||||
if (config.isConnect) {
|
if (config.isConnect) {
|
||||||
self.repair();
|
self.repair();
|
||||||
} else {
|
} else {
|
||||||
console.error('no connect');
|
if(!config.name||!config.path){
|
||||||
|
console.error('"config.name" or "config.path" is empty');
|
||||||
|
}
|
||||||
|
usqlite.connect(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,21 +173,27 @@ class Model {
|
|||||||
* @param {String|Array} options
|
* @param {String|Array} options
|
||||||
* - String WHERE 内容
|
* - String WHERE 内容
|
||||||
* - Array 需要查询的列
|
* - Array 需要查询的列
|
||||||
* @param {*} callback
|
* @param {Function} callback
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
find(options, callback) {
|
find(options, callback) {
|
||||||
let sql = '';
|
let sql = '';
|
||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
if (!callback) {
|
if(!(Utils.isString(options)||Utils.isArray(options)||Utils.isFunction(options))) {
|
||||||
|
Utils.error('The first parameter of Model.find should be "Array", "String" or "Function" (when there is only one parameter).')
|
||||||
|
}
|
||||||
|
if(!callback&&!(Utils.isFunction(options))) {
|
||||||
|
Utils.error('The second parameter of Model.find should be "Function".')
|
||||||
|
}
|
||||||
|
if (!callback&&Utils.isFunction(options)) {
|
||||||
sql = `SELECT * FROM '${this.name}'`; // 查找全部
|
sql = `SELECT * FROM '${this.name}'`; // 查找全部
|
||||||
callback = options;
|
callback = options;
|
||||||
} else if (options.constructor == Array) {
|
} else if (Utils.isArray(options)) {
|
||||||
sql = `SELECT ${options.join()} FROM '${this.name}'`; // 查找制定列
|
sql = `SELECT ${options.join()} FROM '${this.name}'`; // 查找制定列
|
||||||
} else if (options.constructor == String) {
|
} else if (Utils.isString(options)) {
|
||||||
sql = `SELECT * FROM '${this.name}' WHERE ${options}`; // 制定条件查询
|
sql = `SELECT * FROM '${this.name}' WHERE ${options}`; // 制定条件查询
|
||||||
};
|
}
|
||||||
|
|
||||||
Utils.log(`find: ${sql}`);
|
Utils.log(`find: ${sql}`);
|
||||||
|
|
||||||
@@ -180,6 +221,12 @@ class Model {
|
|||||||
let sql = '';
|
let sql = '';
|
||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
|
if(!Utils.isObject(options)){
|
||||||
|
Utils.error('The first parameter of Model.limit should be "Object".')
|
||||||
|
}
|
||||||
|
if(!Utils.isFunction(callback)){
|
||||||
|
Utils.error('The second parameter of Model.limit should be "Function".')
|
||||||
|
}
|
||||||
|
|
||||||
if (!options.where) {
|
if (!options.where) {
|
||||||
// 不存在 where
|
// 不存在 where
|
||||||
@@ -215,12 +262,19 @@ class Model {
|
|||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
|
|
||||||
|
if(!(Utils.isObject(options)||Util.isArray(options))){
|
||||||
|
Utils.error('The first parameter of Model.insert should be "Object" or "Array".')
|
||||||
|
}
|
||||||
|
if(!Utils.isFunction(callback)){
|
||||||
|
Utils.error('The second parameter of Model.insert should be "Function".')
|
||||||
|
}
|
||||||
|
|
||||||
if (config.isConnect) {
|
if (config.isConnect) {
|
||||||
if (options.constructor == Array) {
|
if (Utils.isArray(options)) {
|
||||||
for (var i = 0; i < options.length; i++) {
|
for (var i = 0; i < options.length; i++) {
|
||||||
this.insert(options[i], callback, i);
|
this.insert(options[i], callback, i);
|
||||||
}
|
}
|
||||||
} else if (options.constructor == Object) {
|
} else if (Utils.isObject(options)) {
|
||||||
let keys = [];
|
let keys = [];
|
||||||
let values = [];
|
let values = [];
|
||||||
let index = arguments[3]??null;
|
let index = arguments[3]??null;
|
||||||
@@ -255,7 +309,7 @@ class Model {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 更新数据
|
* @description 更新数据
|
||||||
* @param {Object} options:可选参数 更新条件
|
* @param {String} options:可选参数 更新条件
|
||||||
* @param {Object} obj: 修改后的数据
|
* @param {Object} obj: 修改后的数据
|
||||||
* @param {Function} callback :(err,results)=>{}
|
* @param {Function} callback :(err,results)=>{}
|
||||||
*/
|
*/
|
||||||
@@ -265,6 +319,13 @@ class Model {
|
|||||||
let items = [];
|
let items = [];
|
||||||
self.repair();
|
self.repair();
|
||||||
|
|
||||||
|
if(!(Utils.isObject(options)||Utils.isString(options))){
|
||||||
|
Utils.error('The first parameter of Model.update should be "Object" or "String".')
|
||||||
|
}
|
||||||
|
if(!(Utils.isObject(obj)||Utils.isFunction(obj))){
|
||||||
|
Utils.error('The second parameter of Model.update should be "Objrct" or "Function".')
|
||||||
|
}
|
||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
// 不存在options
|
// 不存在options
|
||||||
callback = obj;
|
callback = obj;
|
||||||
@@ -298,7 +359,7 @@ class Model {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 删除数据
|
* @description 删除数据
|
||||||
* @param {Object} options :可选参数 删除条件
|
* @param {String} options :可选参数 删除条件
|
||||||
* @param {Function} callback :(err,results)=>{}
|
* @param {Function} callback :(err,results)=>{}
|
||||||
*/
|
*/
|
||||||
delete(options, callback) {
|
delete(options, callback) {
|
||||||
@@ -306,6 +367,13 @@ class Model {
|
|||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
|
|
||||||
|
if(!(Utils.isString(options)||Utils.isFunction(options))){
|
||||||
|
Utils.error('The first parameter of Model.delete should be "Object" or "Function".')
|
||||||
|
}
|
||||||
|
if(callback&&!Utils.isFunction(callback)){
|
||||||
|
Utils.error('The second parameter of Model.delete should be "Function".')
|
||||||
|
}
|
||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
sql = `DELETE FROM '${this.name}'`;
|
sql = `DELETE FROM '${this.name}'`;
|
||||||
callback = options;
|
callback = options;
|
||||||
@@ -330,7 +398,7 @@ class Model {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 重命名或者新增列
|
* @description 重命名或者新增列
|
||||||
* @param {Object} options 参数 数组为新增多列 对象为新增单列{aa} 字符串重命名
|
* @param {Object|Array|String} options 参数 数组为新增多列 对象为新增单列{aa} 字符串重命名
|
||||||
* @param {Function} callback :(err,results)=>{}
|
* @param {Function} callback :(err,results)=>{}
|
||||||
* @return:
|
* @return:
|
||||||
*/
|
*/
|
||||||
@@ -338,12 +406,18 @@ class Model {
|
|||||||
let self = this;
|
let self = this;
|
||||||
let sql = '';
|
let sql = '';
|
||||||
self.repair();
|
self.repair();
|
||||||
|
if(!(Utils.isObject(options)||Utils.isArray(options)||Utils.isString(options))){
|
||||||
|
Utils.error('The first parameter of Model.alter should be "Object", "Array" or "String".')
|
||||||
|
}
|
||||||
|
if(!Utils.isFunction(callback)){
|
||||||
|
Utils.error('The second parameter of Model.alter should be "Function".')
|
||||||
|
}
|
||||||
|
|
||||||
if (options.constructor == Array) { // 新增多列
|
if (Utils.isArray(options)) { // 新增多列
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
self.alter(options[i], callback);
|
self.alter(options[i], callback);
|
||||||
}
|
}
|
||||||
} else if (options.constructor == Object) { // 新增单列
|
} else if (Utils.isObject(options)) { // 新增单列
|
||||||
let column = Utils.restrain(options.name, options.option);
|
let column = Utils.restrain(options.name, options.option);
|
||||||
sql = `ALTER TABLE '${this.name}' ADD COLUMN ${column}`
|
sql = `ALTER TABLE '${this.name}' ADD COLUMN ${column}`
|
||||||
} else if (options.constructor == String) { // 重命名
|
} else if (options.constructor == String) { // 重命名
|
||||||
@@ -374,13 +448,13 @@ class Model {
|
|||||||
*/
|
*/
|
||||||
join(model, options, callback) {
|
join(model, options, callback) {
|
||||||
if (!model) {
|
if (!model) {
|
||||||
console.error('"model" cannot be empty.');
|
Utils.error('"model" cannot be empty.');
|
||||||
}
|
}
|
||||||
if (options.constructor != Object) {
|
if (!Utils.isObject(options)) {
|
||||||
console.error('The type of "options" is wrong, it should be "Object".');
|
Utils.error('The type of "options" is wrong, it should be "Object".');
|
||||||
}
|
}
|
||||||
if (!options.type || !options.predicate) {
|
if (!options.type || !options.predicate) {
|
||||||
console.error('Missing required parameters');
|
Utils.error('Missing required parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
let leftName = this.name;
|
let leftName = this.name;
|
||||||
@@ -427,6 +501,13 @@ class Model {
|
|||||||
* @param {Function} callback :(err,results)=>{}
|
* @param {Function} callback :(err,results)=>{}
|
||||||
*/
|
*/
|
||||||
sql(sql, callback) {
|
sql(sql, callback) {
|
||||||
|
if (!Utils.isString(sql)) {
|
||||||
|
Utils.error('"The type of "sql" is wrong, it should be "String".');
|
||||||
|
}
|
||||||
|
if (callback&&!Utils.isFunction(callback)) {
|
||||||
|
Utils.error('The type of "callback" is wrong, it should be "Function".');
|
||||||
|
}
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
|
|
||||||
@@ -449,6 +530,10 @@ class Model {
|
|||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
isExist(callback) {
|
isExist(callback) {
|
||||||
|
if (callback&&!Utils.isFunction(callback)) {
|
||||||
|
Utils.error('The type of "callback" is wrong, it should be "Function".');
|
||||||
|
}
|
||||||
|
|
||||||
let sql = `SELECT count(*) AS isExist FROM sqlite_master WHERE type='table' AND name='${this.name}'`;
|
let sql = `SELECT count(*) AS isExist FROM sqlite_master WHERE type='table' AND name='${this.name}'`;
|
||||||
let self = this;
|
let self = this;
|
||||||
Utils.log(`isExist: ${sql}`);
|
Utils.log(`isExist: ${sql}`);
|
||||||
@@ -470,6 +555,10 @@ class Model {
|
|||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
drop(callback) {
|
drop(callback) {
|
||||||
|
if (callback&&!Utils.isFunction(callback)) {
|
||||||
|
Utils.error('The type of "callback" is wrong, it should be "Function".');
|
||||||
|
}
|
||||||
|
|
||||||
var sql = `DROP TABLE '${this.name}'`;
|
var sql = `DROP TABLE '${this.name}'`;
|
||||||
let self = this;
|
let self = this;
|
||||||
self.repair();
|
self.repair();
|
||||||
@@ -493,6 +582,10 @@ class Model {
|
|||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
create(callback) {
|
create(callback) {
|
||||||
|
if (callback&&!Utils.isFunction(callback)) {
|
||||||
|
Utils.error('The type of "callback" is wrong, it should be "Function".');
|
||||||
|
}
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
let sql = Utils.modelSql(self.name, self.options);
|
let sql = Utils.modelSql(self.name, self.options);
|
||||||
Utils.log(`create: ${sql}`);
|
Utils.log(`create: ${sql}`);
|
||||||
@@ -574,6 +667,7 @@ export class usqlite {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 断开数据库
|
* @description 断开数据库
|
||||||
* @param {*} callback
|
* @param {*} callback
|
||||||
@@ -591,6 +685,19 @@ export class usqlite {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
static closeAsync(options){
|
||||||
|
plus.sqlite.closeDatabase({
|
||||||
|
name: config.name, //数据库名称
|
||||||
|
path: config.path, //数据库地址
|
||||||
|
success(e) {
|
||||||
|
config.isConnect = false;
|
||||||
|
callback(null, e);
|
||||||
|
},
|
||||||
|
fail(e) {
|
||||||
|
callback(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @description 创建 Model 对象
|
* @description 创建 Model 对象
|
||||||
* @example
|
* @example
|
||||||
|
|||||||
BIN
uni_modules/onemue-USQLite/js_sdk/usqlite.js.zip
Normal file
BIN
uni_modules/onemue-USQLite/js_sdk/usqlite.js.zip
Normal file
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "onemue-USQLite",
|
"id": "onemue-USQLite",
|
||||||
"displayName": "u-SQLite V2",
|
"displayName": "u-SQLite V2",
|
||||||
"version": "2.1.0",
|
"version": "2.2.2",
|
||||||
"description": "基于ORM技术,使用对象的方式来操作sqlite数据库,而无需编写任何sql语句.",
|
"description": "基于ORM技术,使用对象的方式来操作sqlite数据库,而无需编写任何sql语句.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"USQLite,数据库操作,缓存,大数据缓存,sqlite,sql,orm"
|
"USQLite,数据库操作,缓存,大数据缓存,sqlite,sql,orm"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<h2>onemue-USQLite</h2>
|
<h2>onemue-USQLite</h2><h2>onemue-USQLite</h2>
|
||||||
|
|
||||||
|
<h2 style="color:red">没有特别说明,均为异步函数</h2>
|
||||||
> u-SQLite 交流群:643867519
|
> u-SQLite 交流群:643867519
|
||||||
> 如果觉的当前插件对你有帮助可以前往 [github](https://github.com/onemue/u-sqlite) 点 star!
|
> 如果觉的当前插件对你有帮助可以前往 [github](https://github.com/onemue/u-sqlite) 点 star!
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ let studentModel = uni.$sql.model('student',{
|
|||||||
- unique UNIQUE 不重复
|
- unique UNIQUE 不重复
|
||||||
- default DEFAULT 默认值
|
- default DEFAULT 默认值
|
||||||
- notNull NOT NULL 非空
|
- notNull NOT NULL 非空
|
||||||
|
- autoIncrement AUTOINCREMENT 非空
|
||||||
|
|
||||||
**联合主键**
|
**联合主键**
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
## 1.3.5(2022-01-24)
|
||||||
|
- 优化 size 属性可以传入不带单位的字符串数值
|
||||||
|
## 1.3.4(2022-01-24)
|
||||||
|
- 优化 size 支持其他单位
|
||||||
|
## 1.3.3(2022-01-17)
|
||||||
|
- 修复 nvue 有些图标不显示的bug,兼容老版本图标
|
||||||
## 1.3.2(2021-12-01)
|
## 1.3.2(2021-12-01)
|
||||||
- 优化 示例可复制图标名称
|
- 优化 示例可复制图标名称
|
||||||
## 1.3.1(2021-11-23)
|
## 1.3.1(2021-11-23)
|
||||||
|
|||||||
@@ -173,6 +173,13 @@ export default {
|
|||||||
"unicode": "e6bb",
|
"unicode": "e6bb",
|
||||||
"unicode_decimal": 59067
|
"unicode_decimal": 59067
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923353",
|
||||||
|
"name": "arrowthinright",
|
||||||
|
"font_class": "arrowthinright",
|
||||||
|
"unicode": "e6bb",
|
||||||
|
"unicode_decimal": 59067
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923354",
|
"icon_id": "24923354",
|
||||||
"name": "arrowthinleft",
|
"name": "arrowthinleft",
|
||||||
@@ -180,6 +187,13 @@ export default {
|
|||||||
"unicode": "e6bc",
|
"unicode": "e6bc",
|
||||||
"unicode_decimal": 59068
|
"unicode_decimal": 59068
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923354",
|
||||||
|
"name": "arrowthinleft",
|
||||||
|
"font_class": "arrowthinleft",
|
||||||
|
"unicode": "e6bc",
|
||||||
|
"unicode_decimal": 59068
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923355",
|
"icon_id": "24923355",
|
||||||
"name": "arrowthinup",
|
"name": "arrowthinup",
|
||||||
@@ -187,12 +201,25 @@ export default {
|
|||||||
"unicode": "e6bd",
|
"unicode": "e6bd",
|
||||||
"unicode_decimal": 59069
|
"unicode_decimal": 59069
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923355",
|
||||||
|
"name": "arrowthinup",
|
||||||
|
"font_class": "arrowthinup",
|
||||||
|
"unicode": "e6bd",
|
||||||
|
"unicode_decimal": 59069
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923356",
|
"icon_id": "24923356",
|
||||||
"name": "arrowthindown",
|
"name": "arrowthindown",
|
||||||
"font_class": "arrow-down",
|
"font_class": "arrow-down",
|
||||||
"unicode": "e6be",
|
"unicode": "e6be",
|
||||||
"unicode_decimal": 59070
|
"unicode_decimal": 59070
|
||||||
|
},{
|
||||||
|
"icon_id": "24923356",
|
||||||
|
"name": "arrowthindown",
|
||||||
|
"font_class": "arrowthindown",
|
||||||
|
"unicode": "e6be",
|
||||||
|
"unicode_decimal": 59070
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923349",
|
"icon_id": "24923349",
|
||||||
@@ -200,6 +227,12 @@ export default {
|
|||||||
"font_class": "bottom",
|
"font_class": "bottom",
|
||||||
"unicode": "e6b8",
|
"unicode": "e6b8",
|
||||||
"unicode_decimal": 59064
|
"unicode_decimal": 59064
|
||||||
|
},{
|
||||||
|
"icon_id": "24923349",
|
||||||
|
"name": "arrowdown",
|
||||||
|
"font_class": "arrowdown",
|
||||||
|
"unicode": "e6b8",
|
||||||
|
"unicode_decimal": 59064
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923346",
|
"icon_id": "24923346",
|
||||||
@@ -208,6 +241,13 @@ export default {
|
|||||||
"unicode": "e6b5",
|
"unicode": "e6b5",
|
||||||
"unicode_decimal": 59061
|
"unicode_decimal": 59061
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923346",
|
||||||
|
"name": "arrowright",
|
||||||
|
"font_class": "arrowright",
|
||||||
|
"unicode": "e6b5",
|
||||||
|
"unicode_decimal": 59061
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923347",
|
"icon_id": "24923347",
|
||||||
"name": "arrowup",
|
"name": "arrowup",
|
||||||
@@ -215,6 +255,13 @@ export default {
|
|||||||
"unicode": "e6b6",
|
"unicode": "e6b6",
|
||||||
"unicode_decimal": 59062
|
"unicode_decimal": 59062
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923347",
|
||||||
|
"name": "arrowup",
|
||||||
|
"font_class": "arrowup",
|
||||||
|
"unicode": "e6b6",
|
||||||
|
"unicode_decimal": 59062
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923348",
|
"icon_id": "24923348",
|
||||||
"name": "arrowleft",
|
"name": "arrowleft",
|
||||||
@@ -222,6 +269,13 @@ export default {
|
|||||||
"unicode": "e6b7",
|
"unicode": "e6b7",
|
||||||
"unicode_decimal": 59063
|
"unicode_decimal": 59063
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"icon_id": "24923348",
|
||||||
|
"name": "arrowleft",
|
||||||
|
"font_class": "arrowleft",
|
||||||
|
"unicode": "e6b7",
|
||||||
|
"unicode_decimal": 59063
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "24923334",
|
"icon_id": "24923334",
|
||||||
"name": "eye",
|
"name": "eye",
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- #ifdef APP-NVUE -->
|
<!-- #ifdef APP-NVUE -->
|
||||||
<text :style="{ color: color, 'font-size': size + 'px' }" class="uni-icons" @click="_onClick">{{unicode}}</text>
|
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" @click="_onClick">{{unicode}}</text>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- #ifndef APP-NVUE -->
|
<!-- #ifndef APP-NVUE -->
|
||||||
<text :style="{ color: color, 'font-size': size + 'px' }" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"></text>
|
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"></text>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import icons from './icons.js';
|
import icons from './icons.js';
|
||||||
|
const getVal = (val) => {
|
||||||
|
const reg = /^[0-9]*$/g
|
||||||
|
return (typeof val === 'number' || reg.test(val) )? val + 'px' : val;
|
||||||
|
}
|
||||||
// #ifdef APP-NVUE
|
// #ifdef APP-NVUE
|
||||||
var domModule = weex.requireModule('dom');
|
var domModule = weex.requireModule('dom');
|
||||||
import iconUrl from './uniicons.ttf'
|
import iconUrl from './uniicons.ttf'
|
||||||
@@ -61,6 +65,9 @@
|
|||||||
return unescape(`%u${code.unicode}`)
|
return unescape(`%u${code.unicode}`)
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
|
},
|
||||||
|
iconSize(){
|
||||||
|
return getVal(this.size)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-icons",
|
"id": "uni-icons",
|
||||||
"displayName": "uni-icons 图标",
|
"displayName": "uni-icons 图标",
|
||||||
"version": "1.3.2",
|
"version": "1.3.5",
|
||||||
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
|
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-ui",
|
"uni-ui",
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
## 3.3.12(2022-01-15)
|
||||||
|
- 新增 preferedAppPlatform 配置用于解决uni-app vue2版本vue3版本获取platform不一致的问题 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=prefered-app-platform)
|
||||||
|
- 修复 checkToken 未返回自定义token内容的Bug
|
||||||
|
## 3.3.11(2022-01-11)
|
||||||
|
- 修复用户名密码登录时多个应用出现重复用户名登录报错的Bug
|
||||||
|
## 3.3.10(2022-01-07)
|
||||||
|
- 新增 自定义国际化语言支持 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=custom-i8n)
|
||||||
|
- 修复 一键登录时未校验重复手机号是否已验证的Bug
|
||||||
|
- 修复 Apple登录时用户邮箱为空时报错的Bug
|
||||||
|
- 修复 登录接口未传username时错误提示不正确的Bug
|
||||||
## 3.3.9(2021-11-09)
|
## 3.3.9(2021-11-09)
|
||||||
- 去除重复的context.xxx未找到的提示语
|
- 去除重复的context.xxx未找到的提示语
|
||||||
## 3.3.8(2021-10-28)
|
## 3.3.8(2021-10-28)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-id",
|
"id": "uni-id",
|
||||||
"displayName": "uni-id",
|
"displayName": "uni-id",
|
||||||
"version": "3.3.9",
|
"version": "3.3.12",
|
||||||
"description": "简单、统一、可扩展的用户中心",
|
"description": "简单、统一、可扩展的用户中心",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uniid",
|
"uniid",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "uni-id",
|
"name": "uni-id",
|
||||||
"version": "3.3.5",
|
"version": "3.3.12",
|
||||||
"description": "uni-id for uniCloud",
|
"description": "uni-id for uniCloud",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
|
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
## 1.0.3(2022-01-21)
|
||||||
|
- 优化 组件示例
|
||||||
## 1.0.2(2021-11-22)
|
## 1.0.2(2021-11-22)
|
||||||
- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题
|
- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题
|
||||||
## 1.0.1(2021-11-22)
|
## 1.0.1(2021-11-22)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "uni-scss",
|
"id": "uni-scss",
|
||||||
"displayName": "uni-scss 辅助样式",
|
"displayName": "uni-scss 辅助样式",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。",
|
"description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uni-scss",
|
"uni-scss",
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"category": [
|
"category": [
|
||||||
"uni-app前端模板",
|
"JS SDK",
|
||||||
"前端页面模板"
|
"通用 SDK"
|
||||||
],
|
],
|
||||||
"sale": {
|
"sale": {
|
||||||
"regular": {
|
"regular": {
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import {
|
|||||||
getImToken,
|
getImToken,
|
||||||
getMyGroups
|
getMyGroups
|
||||||
} from '@/apis/interfaces/im.js'
|
} from '@/apis/interfaces/im.js'
|
||||||
|
import {
|
||||||
|
contactModel
|
||||||
|
} from './models.js'
|
||||||
|
|
||||||
const initIm = (KEY) => {
|
const initIm = (KEY) => {
|
||||||
RongIMLib.init(KEY)
|
RongIMLib.init(KEY)
|
||||||
@@ -20,6 +23,8 @@ const initIm = (KEY) => {
|
|||||||
getImToken().then(res => {
|
getImToken().then(res => {
|
||||||
connect(res.token, res.userInfo, (res) => {
|
connect(res.token, res.userInfo, (res) => {
|
||||||
console.log('IM.CONNECT', res);
|
console.log('IM.CONNECT', res);
|
||||||
|
// 发布全局事件,有新消息,刷新会话列表
|
||||||
|
uni.$emit('onReceiveMessage')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -62,13 +67,13 @@ const connect = (token, userInfo, callback) => {
|
|||||||
// 设置未读消息数量
|
// 设置未读消息数量
|
||||||
setNotifyBadge()
|
setNotifyBadge()
|
||||||
// 首次运行获取好友列表
|
// 首次运行获取好友列表
|
||||||
const FK = 'ZH_V_' + userInfo.targetId
|
const FK = 'ZH_CONTACT_' + userInfo.targetId
|
||||||
|
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: FK,
|
key: FK,
|
||||||
success: () => {
|
success: () => {
|
||||||
const model = uni.model.contactModel
|
contactModel.find((err, results) => {
|
||||||
model.find((err, results) => {
|
console.log('初始化联系人信息', results);
|
||||||
results.map(item => {
|
results.map(item => {
|
||||||
store.dispatch('launchContact', item)
|
store.dispatch('launchContact', item)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ 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,
|
||||||
|
'RC:IWNormalMsg'
|
||||||
]
|
]
|
||||||
|
|
||||||
const imLibListeners = () => {
|
const imLibListeners = () => {
|
||||||
@@ -92,6 +93,8 @@ const imLibListeners = () => {
|
|||||||
uni.$emit('onReceiveMessage', message)
|
uni.$emit('onReceiveMessage', message)
|
||||||
}
|
}
|
||||||
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
} else if (message.objectName === IMLib.ObjectName.GroupNotification) {
|
||||||
|
// 这个是为了更新消息列表页的
|
||||||
|
uni.$emit('onReceiveMessage_' + message.targetId, message)
|
||||||
// 解散群
|
// 解散群
|
||||||
if (message.content.operation === 'Dismiss') {
|
if (message.content.operation === 'Dismiss') {
|
||||||
IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime,
|
IMLib.cleanHistoryMessages(3, message.targetId, message.sentTime,
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ const getMessageList = (conversationType, targetId, timeStamp, count, isForward,
|
|||||||
'RC:CombineMsg',
|
'RC:CombineMsg',
|
||||||
'RC:GrpNtf',
|
'RC:GrpNtf',
|
||||||
'RC:InfoNtf',
|
'RC:InfoNtf',
|
||||||
'RC:RcNtf'
|
'RC:RcNtf',
|
||||||
|
'RC:IWNormalMsg'
|
||||||
]
|
]
|
||||||
|
|
||||||
RongIMLib.getHistoryMessagesByTimestamp(
|
RongIMLib.getHistoryMessagesByTimestamp(
|
||||||
@@ -80,35 +81,23 @@ const getGroupPendinglist = (targetId, callback) => {
|
|||||||
* @param {string} content 消息内容
|
* @param {string} content 消息内容
|
||||||
* @param {function} callback 回调函数
|
* @param {function} callback 回调函数
|
||||||
*/
|
*/
|
||||||
const sentText = (conversationType, targetId, content, user, callback) => {
|
const sentText = (conversationType, targetId, content) => {
|
||||||
const msg = {
|
return new Promise((resolve, reject) => {
|
||||||
|
const message = {
|
||||||
conversationType: conversationType,
|
conversationType: conversationType,
|
||||||
targetId: String(targetId),
|
targetId: String(targetId),
|
||||||
content: {
|
content: {
|
||||||
objectName: 'RC:TxtMsg',
|
objectName: 'RC:TxtMsg',
|
||||||
content: content,
|
content: content,
|
||||||
userInfo: user
|
userInfo: store.getters.sender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RongIMLib.sendMessage(msg, ({
|
sendCommonMessage(message, (messageId) => {
|
||||||
code,
|
resolve(messageId)
|
||||||
messageId
|
}, (errCode) => {
|
||||||
}) => {
|
reject(errCode)
|
||||||
if (code === 0) {
|
|
||||||
if (conversationType == 3) {
|
|
||||||
RongIMLib.sendReadReceiptRequest(messageId, (res) => {
|
|
||||||
console.log('发送回执请求', res);
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
callback(messageId)
|
|
||||||
} else {
|
|
||||||
console.log('发送失败', msg);
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: '发送失败' + code
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,111 +107,199 @@ const sentText = (conversationType, targetId, content, user, callback) => {
|
|||||||
* @param {string} targetId 会话id
|
* @param {string} targetId 会话id
|
||||||
* @param {string} voiceUrl 录音的本地路径
|
* @param {string} voiceUrl 录音的本地路径
|
||||||
* @param {integer} time 录音时长
|
* @param {integer} time 录音时长
|
||||||
* @param {function} callback 录音时长
|
* @param {function} user 本人信息
|
||||||
*/
|
*/
|
||||||
const sentVoice = (conversationType, targetId, voiceUrl, time, user, callback) => {
|
const sentVoice = (conversationType, targetId, voiceUrl, time) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
const msg = {
|
const msg = {
|
||||||
conversationType: conversationType,
|
conversationType: conversationType,
|
||||||
targetId: String(targetId),
|
targetId: String(targetId),
|
||||||
content: {
|
content: {
|
||||||
objectName: 'RC:HQVCMsg',
|
objectName: 'RC:HQVCMsg',
|
||||||
local: 'file:///' + plus.io.convertLocalFileSystemURL(voiceUrl),
|
local: 'file://' + plus.io.convertLocalFileSystemURL(voiceUrl),
|
||||||
duration: time == 0 ? 1 : time,
|
duration: time == 0 ? 1 : time,
|
||||||
userInfo: user
|
userInfo: store.getters.sender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RongIMLib.sendMediaMessage(msg, {
|
RongIMLib.sendMediaMessage(msg, {
|
||||||
success: (messageId) => {
|
success: (messageId) => {
|
||||||
callback(messageId);
|
if (conversationType == 3) {
|
||||||
},
|
RongIMLib.sendReadReceiptRequest(messageId)
|
||||||
progress: (progress, messageId) => {
|
|
||||||
console.log(messageId);
|
|
||||||
},
|
|
||||||
cancel: (messageId) => {
|
|
||||||
// 发送取消回调
|
|
||||||
},
|
|
||||||
error: (errorCode, messageId) => {
|
|
||||||
console.log(errorCode, messageId);
|
|
||||||
}
|
}
|
||||||
|
resolve(messageId)
|
||||||
|
},
|
||||||
|
progress: (progress, messageId) => {},
|
||||||
|
cancel: (messageId) => {},
|
||||||
|
error: (errorCode, messageId) => {
|
||||||
|
reject(errorCode)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const sentImage = (conversationType, targetId, imageUrl, user, callback) => {
|
// 发送的图片,可能会涉及到一次多张,用Promise来确保前端一次性清算
|
||||||
|
const sentImage = (conversationType, targetId, imageUrl) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.getImageInfo({
|
||||||
|
src: imageUrl,
|
||||||
|
success: (imgInfo) => {
|
||||||
const msg = {
|
const msg = {
|
||||||
conversationType: conversationType,
|
conversationType: conversationType,
|
||||||
targetId: String(targetId),
|
targetId: String(targetId),
|
||||||
content: {
|
content: {
|
||||||
objectName: 'RC:ImgMsg',
|
objectName: 'RC:ImgMsg',
|
||||||
local: 'file:///' + plus.io.convertLocalFileSystemURL(imageUrl),
|
local: imgInfo.path,
|
||||||
userInfo: user
|
userInfo: store.getters.sender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RongIMLib.sendMediaMessage(msg, {
|
RongIMLib.sendMediaMessage(msg, {
|
||||||
success: (messageId) => {
|
success: (messageId) => {
|
||||||
callback(messageId);
|
if (conversationType == 3) {
|
||||||
},
|
RongIMLib.sendReadReceiptRequest(messageId)
|
||||||
progress: (progress, messageId) => {
|
}
|
||||||
console.log(messageId);
|
resolve(messageId)
|
||||||
},
|
|
||||||
cancel: (messageId) => {
|
|
||||||
// 发送取消回调
|
|
||||||
},
|
},
|
||||||
|
progress: (progress, messageId) => {},
|
||||||
|
cancel: (messageId) => {},
|
||||||
error: (errorCode, messageId) => {
|
error: (errorCode, messageId) => {
|
||||||
console.log(errorCode, messageId);
|
reject(errorCode)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
})
|
||||||
const sentGif = (conversationType, targetId, gifUrl, time, user, callback) => {
|
|
||||||
const msg = {
|
|
||||||
conversationType: conversationType,
|
|
||||||
targetId: String(targetId),
|
|
||||||
content: {
|
|
||||||
objectName: 'RC:GIFMsg',
|
|
||||||
local: 'file:///' + plus.io.convertLocalFileSystemURL(gifUrl),
|
|
||||||
duration: time,
|
|
||||||
userInfo: user
|
|
||||||
}
|
|
||||||
}
|
|
||||||
RongIMLib.sendMediaMessage(msg, {
|
|
||||||
success: (messageId) => {
|
|
||||||
callback(messageId);
|
|
||||||
},
|
|
||||||
progress: (progress, messageId) => {
|
|
||||||
console.log(messageId);
|
|
||||||
},
|
|
||||||
cancel: (messageId) => {
|
|
||||||
// 发送取消回调
|
|
||||||
},
|
|
||||||
error: (errorCode, messageId) => {
|
|
||||||
console.log(errorCode, messageId);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendFile = (conversationType, targetId, fileUrl, time, user, callback) => {
|
const sentFile = (conversationType, targetId, fileUrl) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
const msg = {
|
const msg = {
|
||||||
conversationType: conversationType,
|
conversationType: conversationType,
|
||||||
targetId: String(targetId),
|
targetId: String(targetId),
|
||||||
content: {
|
content: {
|
||||||
objectName: 'RC:FileMsg',
|
objectName: 'RC:FileMsg',
|
||||||
local: 'file:///' + plus.io.convertLocalFileSystemURL(fileUrl),
|
local: plus.io.convertLocalFileSystemURL(fileUrl),
|
||||||
duration: time,
|
userInfo: store.getters.sender
|
||||||
userInfo: user
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RongIMLib.sendMediaMessage(msg, {
|
RongIMLib.sendMediaMessage(msg, {
|
||||||
success: (messageId) => {
|
success: (messageId) => {
|
||||||
callback(messageId);
|
if (conversationType == 3) {
|
||||||
},
|
RongIMLib.sendReadReceiptRequest(messageId)
|
||||||
progress: (progress, messageId) => {
|
}
|
||||||
console.log(messageId);
|
resolve(messageId)
|
||||||
},
|
|
||||||
cancel: (messageId) => {
|
|
||||||
// 发送取消回调
|
|
||||||
},
|
},
|
||||||
|
progress: (progress, messageId) => {},
|
||||||
|
cancel: (messageId) => {},
|
||||||
error: (errorCode, messageId) => {
|
error: (errorCode, messageId) => {
|
||||||
console.log(errorCode, messageId);
|
reject(errorCode)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送地理位置
|
||||||
|
const sentLocation = (conversationType, targetId, location, thumbnail) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const message = {
|
||||||
|
conversationType: conversationType,
|
||||||
|
targetId: String(targetId),
|
||||||
|
content: {
|
||||||
|
customType: 2,
|
||||||
|
objectName: 'RC:LBSMsg',
|
||||||
|
customFields: {
|
||||||
|
name: location.name,
|
||||||
|
address: location.address,
|
||||||
|
latitude: Number(location.latitude),
|
||||||
|
longitude: Number(location.longitude),
|
||||||
|
thumbnail: thumbnail
|
||||||
|
},
|
||||||
|
userInfo: store.getters.sender,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendCommonMessage(message, (messageId) => {
|
||||||
|
resolve(messageId)
|
||||||
|
}, (errCode) => {
|
||||||
|
reject(errCode)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送视频通话结果
|
||||||
|
*/
|
||||||
|
const sentVideo = (conversationType, targetId, status, time) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const message = {
|
||||||
|
conversationType: conversationType,
|
||||||
|
targetId: String(targetId),
|
||||||
|
content: {
|
||||||
|
customType: 2,
|
||||||
|
objectName: 'RC:VideoMsg',
|
||||||
|
customFields: {
|
||||||
|
status: status,
|
||||||
|
duration: time
|
||||||
|
},
|
||||||
|
userInfo: store.getters.sender,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendCommonMessage(message, (messageId) => {
|
||||||
|
resolve(messageId)
|
||||||
|
}, (errCode) => {
|
||||||
|
reject(errCode)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送语音通话结果
|
||||||
|
*/
|
||||||
|
const sentAudio = (conversationType, targetId, status, time) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const message = {
|
||||||
|
conversationType: conversationType,
|
||||||
|
targetId: String(targetId),
|
||||||
|
content: {
|
||||||
|
customType: 2,
|
||||||
|
objectName: 'RC:AudioMsg',
|
||||||
|
customFields: {
|
||||||
|
status: status,
|
||||||
|
duration: time
|
||||||
|
},
|
||||||
|
userInfo: store.getters.sender,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendCommonMessage(message, (messageId) => {
|
||||||
|
resolve(messageId)
|
||||||
|
}, (errCode) => {
|
||||||
|
reject(errCode)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送普通消息
|
||||||
|
*/
|
||||||
|
const sendCommonMessage = (message, success, fail) => {
|
||||||
|
RongIMLib.sendMessage(message, ({
|
||||||
|
code,
|
||||||
|
messageId
|
||||||
|
}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
if (message.conversationType == 3) {
|
||||||
|
RongIMLib.sendReadReceiptRequest(messageId)
|
||||||
|
}
|
||||||
|
|
||||||
|
success(messageId)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '发送失败' + code
|
||||||
|
})
|
||||||
|
fail(code)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -234,6 +311,8 @@ export default {
|
|||||||
sentText,
|
sentText,
|
||||||
sentVoice,
|
sentVoice,
|
||||||
sentImage,
|
sentImage,
|
||||||
sentGif,
|
sentFile,
|
||||||
sendFile
|
sentLocation,
|
||||||
|
sentVideo,
|
||||||
|
sentAudio
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const contactModel = usqlite.model('contacts', {
|
|||||||
unique: true
|
unique: true
|
||||||
},
|
},
|
||||||
name: String,
|
name: String,
|
||||||
|
remark: String,
|
||||||
hash: {
|
hash: {
|
||||||
type: String,
|
type: String,
|
||||||
unique: true
|
unique: true
|
||||||
@@ -21,6 +22,6 @@ const contactModel = usqlite.model('contacts', {
|
|||||||
localAvatar: String
|
localAvatar: String
|
||||||
})
|
})
|
||||||
|
|
||||||
export default {
|
export {
|
||||||
contactModel
|
contactModel
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user