This commit is contained in:
cansnow
2025-12-08 18:10:51 +08:00
parent 22ee59cd3d
commit b2e1b8930e
19 changed files with 218 additions and 300 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
</template> </template>
<script> <script>
import defaultGroupIcon from "static/images/contact_my_group.png"; import defaultGroupIcon from "@/static/images/contact_my_group.png";
import defaultNotifyIcon from "static/images/default_notify_icon.png"; import defaultNotifyIcon from "@/static/images/default_notify_icon.png";
import util from "@/util"; import util from "@/util";
export default { export default {
name: "MyAvatar", name: "MyAvatar",
+1 -1
View File
@@ -17,7 +17,7 @@
<!--preload-links--> <!--preload-links-->
<!--app-context--> <!--app-context-->
</head> </head>
<body> <body class="body">
<div id="app"><!--app-html--></div> <div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script> <script type="module" src="/main.js"></script>
</body> </body>
+3 -1
View File
@@ -54,6 +54,8 @@ const app = new Vue({
}); });
// 引入请求封装 // 引入请求封装
require("./util/request/index")(app); import request from "./util/request/index";
request(app)
//require("./util/request/index")(app);
app.$mount(); app.$mount();
+1
View File
@@ -269,6 +269,7 @@
{ {
"path": "pages/common/webview", "path": "pages/common/webview",
"style": { "style": {
"navigationStyle": "default",
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
+46 -13
View File
@@ -1,7 +1,25 @@
<template> <template>
<view class="scan_page"> <view class="scan_page" :style="{height:windowHeight+'px'}">
<uni-nav-bar left-icon="back" fixed backgroundColor="transparent" statusBar></uni-nav-bar> <uni-nav-bar
<barcode id='1' class="barcode" autostart="true" ref="barcode" background="rgb(0,0,0)" frameColor="#1C86EE" scanbarColor="#1C86EE" :filters="fil" @marked="success1" @error="fail1"></barcode> left-icon="back"
@clickLeft="back"
fixed
backgroundColor="#FFF"
statusBar
>
</uni-nav-bar>
<barcode id='1'
class="barcode"
ref="barcode"
:autostart="true"
background="rgb(0,0,0)"
frameColor="#07c160"
scanbarColor="#07c160"
:style="{height:windowHeight+'px'}"
:filters="fil"
@marked="success"
@error="fail">
</barcode>
<view class="overlay"> <view class="overlay">
<button class="btn" @click="toStart">开始扫码识别</button> <button class="btn" @click="toStart">开始扫码识别</button>
<button class="btn" @click="tocancel">取消扫码识别</button> <button class="btn" @click="tocancel">取消扫码识别</button>
@@ -13,20 +31,30 @@
<script> <script>
export default { export default {
onLoad() {
},
data() { data() {
return { return {
fil: [0, 2, 1] fil: [0, 2, 1,3,4,12],
windowHeight:500,
} }
}, },
onLoad() {
uni.scanCode({
complete(res) {
console.log(res)
}
})
},
created() {
const info = uni.getSystemInfoSync();
console.log(info);
this.windowHeight = info.screenHeight;
},
methods: { methods: {
success1(e) { success(e) {
console.log("success1:" + JSON.stringify(e)); console.log("success1:" + JSON.stringify(e));
}, },
fail1(e) { fail(e) {
console.log("fail1:" + JSON.stringify(e)); console.log("fail1:" + JSON.stringify(e));
}, },
toStart: function() { toStart: function() {
@@ -49,6 +77,9 @@
,(e)=>{ ,(e)=>{
console.log("scan_error:"+JSON.stringify(e)); console.log("scan_error:"+JSON.stringify(e));
}); });
},
back(){
uni.navigateBack();
} }
} }
} }
@@ -57,12 +88,9 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.scan_page{ .scan_page{
width: 750rpx; width: 750rpx;
height: 100vh;
position: relative; position: relative;
background: #800000;
.barcode { .barcode {
width: 100vw; width: 750rpx;
height: 100vh;
background-color: #808080; background-color: #808080;
} }
@@ -76,6 +104,11 @@
} }
.overlay{ .overlay{
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
position: absolute;
bottom: 100rpx;
left: 0;
right: 0;
height: 200rpx;
} }
} }
</style> </style>
+4 -2
View File
@@ -9,8 +9,10 @@
linkUrl: "", linkUrl: "",
}; };
}, },
onShow() { onLoad(opt) {
this.linkUrl = 'https://doc.rentsoft.cn/' if(opt.url){
this.linkUrl = opt.url;
}
}, },
onReady() { onReady() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
+6 -3
View File
@@ -12,6 +12,9 @@
<script> <script>
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import ActionItem from "./ActionItem.vue"; import ActionItem from "./ActionItem.vue";
import contact_add_search_user_img from "static/images/contact_add_search_user.png"
import contact_add_join_group_img from "static/images/contact_add_join_group.png"
import contact_add_create_group_img from "static/images/contact_add_create_group.png"
export default { export default {
components: { components: {
CustomNavBar, CustomNavBar,
@@ -24,13 +27,13 @@
idx: 0, idx: 0,
title: "创建群聊", title: "创建群聊",
desc: "创建群聊,全面使用OpenIM", desc: "创建群聊,全面使用OpenIM",
icon: require("static/images/contact_add_create_group.png"), icon: contact_add_create_group_img,
}, },
{ {
idx: 1, idx: 1,
title: "添加群聊", title: "添加群聊",
desc: "向管理员或团队成员询问ID", desc: "向管理员或团队成员询问ID",
icon: require("static/images/contact_add_join_group.png"), icon: rcontact_add_join_group_img,
}, },
], ],
friendActionMenus: [ friendActionMenus: [
@@ -38,7 +41,7 @@
idx: 0, idx: 0,
title: "添加好友", title: "添加好友",
desc: "通过手机号/ID号/搜索添加", desc: "通过手机号/ID号/搜索添加",
icon: require("static/images/contact_add_search_user.png"), icon: contact_add_search_user_img,
}, },
], ],
}; };
@@ -30,6 +30,10 @@
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import {ContactMenuTypes} from "@/constant"; import {ContactMenuTypes} from "@/constant";
import contact_new_friend_img from "@/static/images/contact_new_friend.png";
import contact_new_group_img from "@/static/images/contact_new_group.png";
import contact_my_friend_img from "@/static/images/contact_my_friend.png";
import contact_my_group_img from "@/static/images/contact_my_group.png";
export default { export default {
name: "", name: "",
@@ -43,13 +47,13 @@
idx: 0, idx: 0,
type: ContactMenuTypes.NewFriend, type: ContactMenuTypes.NewFriend,
title: "新的好友", title: "新的好友",
icon: require("static/images/contact_new_friend.png"), icon: contact_new_friend_img,
}, },
// { // {
// idx: 1, // idx: 1,
// type: ContactMenuTypes.NewGroup, // type: ContactMenuTypes.NewGroup,
// title: "新的群组", // title: "新的群组",
// icon: require("static/images/contact_new_group.png"), // icon: contact_new_group_img,
// }, // },
]; ];
}, },
@@ -59,14 +63,14 @@
// idx: 2, // idx: 2,
// type: ContactMenuTypes.MyFriend, // type: ContactMenuTypes.MyFriend,
// title: "我的好友", // title: "我的好友",
// icon: require("static/images/contact_my_friend.png"), // icon: contact_my_friend_img,
// badge: 0, // badge: 0,
// }, // },
{ {
idx: 3, idx: 3,
type: ContactMenuTypes.MyGroup, type: ContactMenuTypes.MyGroup,
title: "群聊", title: "群聊",
icon: require("static/images/contact_my_group.png"), icon: contact_my_group_img,
badge: 0, badge: 0,
}, },
]; ];
+2 -1
View File
@@ -24,6 +24,7 @@
<script> <script>
import CustomNavBar from "@/components/CustomNavBar/index.vue"; import CustomNavBar from "@/components/CustomNavBar/index.vue";
import ActionItem from "../contactAdd/ActionItem.vue"; import ActionItem from "../contactAdd/ActionItem.vue";
import switch_join_id_img from "@/static/images/switch_join_id.png";
export default { export default {
components: { components: {
CustomNavBar, CustomNavBar,
@@ -36,7 +37,7 @@ export default {
idx: 1, idx: 1,
title: "群ID号加入", title: "群ID号加入",
desc: "向管理员或团队成员询问ID", desc: "向管理员或团队成员询问ID",
icon: require("static/images/switch_join_id.png"), icon: switch_join_id_img,
}, },
], ],
}; };
@@ -9,7 +9,8 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<view style="padding:0rpx 20rpx;position: absolute;bottom: 1rpx;right: 10rpx; <view style="padding:0rpx 20rpx;position: absolute;bottom: 1rpx;right: 10rpx;
width: 250rpx;height: 150rpx;z-index: 1000;opacity: 0.9;" class="u-flex u-row-right u-col-center"> width: 250rpx;height: 150rpx;z-index: 1000;opacity: 0.9;"
class="u-flex u-row-right u-col-center">
<view class="u-flex u-row-center u-col-center" <view class="u-flex u-row-center u-col-center"
style="border: 1px solid #f1f1f1;border-radius: 10rpx; background-color: #82848a;width: 100rpx;padding: 15rpx 20rpx;margin-right: 8rpx;"> style="border: 1px solid #f1f1f1;border-radius: 10rpx; background-color: #82848a;width: 100rpx;padding: 15rpx 20rpx;margin-right: 8rpx;">
<view @click="delSendStr()" @longpress="clearSendStr()"> <view @click="delSendStr()" @longpress="clearSendStr()">
@@ -25,7 +26,7 @@
<u-row class="action_row" v-else> <u-row class="action_row" v-else>
<u-col v-for="item in actionList" :key="item.idx" @click="actionClick(item)" span="3"> <u-col v-for="item in actionList" :key="item.idx" @click="actionClick(item)" span="3">
<view class="action_item"> <view class="action_item">
<image :src="item.icon" alt="" srcset="" /> <image class="img" :src="item.icon" alt="" srcset="" />
<text class="action_item_title">{{ item.title }}</text> <text class="action_item_title">{{ item.title }}</text>
</view> </view>
</u-col> </u-col>
@@ -36,6 +37,10 @@
<script> <script>
import {ChatingFooterActionTypes,} from "@/constant"; import {ChatingFooterActionTypes,} from "@/constant";
import emojis from "@/common/emojis.js" import emojis from "@/common/emojis.js"
import chating_action_image from "@/static/images/chating_action_image.png";
import chating_action_camera from "@/static/images/chating_action_camera.png";
import chating_action_call from "@/static/images/chating_action_call.png";
import chating_action_location from "@/static/images/chating_action_location.png";
export default { export default {
props:{ props:{
@@ -59,37 +64,37 @@
idx: 0, idx: 0,
type: ChatingFooterActionTypes.Album, type: ChatingFooterActionTypes.Album,
title: "照片", title: "照片",
icon: require("static/images/chating_action_image.png"), icon: chating_action_image,
}, },
{ {
idx: 1, idx: 1,
type: ChatingFooterActionTypes.Camera, type: ChatingFooterActionTypes.Camera,
title: "拍摄", title: "拍摄",
icon: require("static/images/chating_action_camera.png"), icon: chating_action_camera,
}, },
{ {
idx: 2, idx: 2,
type: ChatingFooterActionTypes.Video, type: ChatingFooterActionTypes.Video,
title: "视频通话", title: "视频通话",
icon: require("static/images/chating_action_call.png"), icon: chating_action_call,
}, },
{ {
idx: 3, idx: 3,
type: ChatingFooterActionTypes.Location, type: ChatingFooterActionTypes.Location,
title: "位置", title: "位置",
icon: require("static/images/chating_action_location.png"), icon: chating_action_location,
}, },
// { // {
// idx: 0, // idx: 0,
// type: ChatingFooterActionTypes.Album, // type: ChatingFooterActionTypes.Album,
// title: "红包", // title: "红包",
// icon: require("static/images/chating_action_image.png"), // icon: chating_action_image,
// }, // },
// { // {
// idx: 0, // idx: 0,
// type: ChatingFooterActionTypes.Album, // type: ChatingFooterActionTypes.Album,
// title: "转账", // title: "转账",
// icon: require("static/images/chating_action_image.png"), // icon: chating_action_image,
// } // }
], ],
}; };
@@ -127,7 +132,7 @@
position: relative; position: relative;
background: #ececec; background: #ececec;
padding: 24rpx 36rpx; padding: 24rpx 36rpx;
.action_row { .action_row {
flex-wrap: wrap; flex-wrap: wrap;
margin-bottom: 24rpx; margin-bottom: 24rpx;
@@ -138,7 +143,7 @@
flex-direction: column; flex-direction: column;
margin-top: 24rpx; margin-top: 24rpx;
image { .img {
width: 96rpx; width: 96rpx;
height: 96rpx; height: 96rpx;
} }
@@ -154,7 +159,7 @@
} }
} }
.emoji-swiper { .emoji-swiper {
height: 400rpx; height: 400rpx;
@@ -58,8 +58,8 @@
import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant"; import {ChatingFooterActionTypes,UpdateMessageTypes,} from "@/constant";
import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill"; import IMSDK, {IMMethods,MessageStatus,MessageType,} from "openim-uniapp-polyfill";
import UParse from "@/components/gaoyia-parse/parse.vue"; import UParse from "@/components/gaoyia-parse/parse.vue";
import CustomEditor from "./CustomEditor.vue"; import CustomEditor from "./CustomEditor";
import ChatingActionBar from "./ChatingActionBar.vue"; import ChatingActionBar from "./ChatingActionBar";
const needClearTypes = [MessageType.TextMessage]; const needClearTypes = [MessageType.TextMessage];
@@ -533,7 +533,7 @@
.emoji_action { .emoji_action {
margin-right: 24rpx; margin-right: 24rpx;
} }
image { image {
width: 26px; width: 26px;
height: 26px; height: 26px;
@@ -544,7 +544,7 @@
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
background-color: $uni-color-success; background-color: $uni-color-success;
padding: 0 8px; padding: 0 8px;
border-radius: 4px; border-radius: 4px;
color: #fff; color: #fff;
} }
@@ -1,7 +1,7 @@
<template> <template>
<u-navbar @click="click" placeholder class="chating_header" bgColor="transparent"> <u-navbar @click="click" placeholder class="chating_header" bgColor="transparent">
<view @click="routeBack" class="u-nav-slot" slot="left"> <view @click="routeBack" class="u-nav-slot" slot="left">
<img class="back_icon" width="12" height="20" src="static/images/common_left_arrow.png" alt="" srcset="" /> <image class="back_icon" style="width: 12px; height: 20px;" src="/static/images/common_left_arrow.png"></image>
</view> </view>
<view class="u-nav-slot" slot="center"> <view class="u-nav-slot" slot="center">
<view class="chating_info" :class="{ chating_info_single: isSingle }"> <view class="chating_info" :class="{ chating_info_single: isSingle }">
@@ -122,7 +122,7 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
@include vCenterBox(); @include vCenterBox();
.title { .title {
@include nomalEllipsis(); @include nomalEllipsis();
max-width: 280rpx; max-width: 280rpx;
@@ -179,7 +179,7 @@
} }
} }
} }
.group_announcement_tab { .group_announcement_tab {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -218,7 +218,7 @@
min-width: 16px; min-width: 16px;
} }
} }
.group_calling_tab { .group_calling_tab {
position: absolute; position: absolute;
left: 0; left: 0;
@@ -25,7 +25,7 @@
<script> <script>
import {mapGetters,mapActions} from "vuex"; import {mapGetters,mapActions} from "vuex";
import MessageItemRender from "./MessageItem/index.vue"; import MessageItemRender from "./MessageItem/index";
export default { export default {
name: "", name: "",
@@ -58,24 +58,24 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.media_message_container { .media_message_container {
position: relative; position: relative;
border-radius: 16rpx; border-radius: 16rpx;
overflow: hidden; overflow: hidden;
.play_icon { .play_icon {
width: 48px; width: 48px;
height: 48px; height: 48px;
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
.video_duration { .video_duration {
position: absolute; position: absolute;
bottom: 12rpx; bottom: 12rpx;
right: 24rpx; right: 24rpx;
color: #fff; color: #fff;
} }
} }
</style> </style>
@@ -12,7 +12,7 @@
<view style="height: 100%;display: flex;justify-items: center;align-items: center;"> <view style="height: 100%;display: flex;justify-items: center;align-items: center;">
<view class="message_send_state"> <view class="message_send_state">
<u-loading-icon v-if="showSending && !isPreview" /> <u-loading-icon v-if="showSending && !isPreview" />
<image v-if="isFailedMessage && !isPreview" src="@/static/images/chating_message_failed.png" /> <image v-if="isFailedMessage && !isPreview" class="state_img" src="@/static/images/chating_message_failed.png" />
</view> </view>
</view> </view>
<view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)"> <view class="message_content_wrap message_content_wrap_shadow" :id="`message_content_wrap_${source.clientMsgID}`" @longtap.stop.prevent="longtapEvent($event)">
@@ -23,12 +23,6 @@
</view> </view>
</view> </view>
<!-- 长按菜单 -->
<chunLei-popups v-model="toolTipFlag" :popData="toolTipData" @tapPopup="tapPopup"
:x="toolTipX" :y="toolTipY" :placement="popPostion"
:triangle="false"
direction="row" theme="dark" :dynamic="true">
</chunLei-popups>
</view> </view>
<view v-else class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`"> <view v-else class="notice_message_container" style="margin: 0 auto;" :id="`auchor${source.clientMsgID}`">
@@ -39,11 +33,10 @@
<script> <script>
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import {MessageStatus,MessageType,SessionType,} from "openim-uniapp-polyfill"; import {MessageStatus,MessageType,SessionType,} from "openim-uniapp-polyfill";
import chunLeiPopups from "@/components/chunLei-popups.vue";
import MyAvatar from "@/components/MyAvatar/index.vue"; import MyAvatar from "@/components/MyAvatar/index.vue";
import TextMessageRender from "./TextMessageRender.vue"; import TextMessageRender from "./TextMessageRender";
import MediaMessageRender from "./MediaMessageRender.vue"; import MediaMessageRender from "./MediaMessageRender";
import ErrorMessageRender from "./ErrorMessageRender.vue"; import ErrorMessageRender from "./ErrorMessageRender";
import {noticeMessageTypes} from "@/constant"; import {noticeMessageTypes} from "@/constant";
import {tipMessaggeFormat,formatMessageTime} from "@/util/imCommon"; import {tipMessaggeFormat,formatMessageTime} from "@/util/imCommon";
@@ -56,8 +49,7 @@
MyAvatar, MyAvatar,
TextMessageRender, TextMessageRender,
MediaMessageRender, MediaMessageRender,
ErrorMessageRender, ErrorMessageRender
chunLeiPopups
}, },
props: { props: {
source: Object, source: Object,
@@ -139,123 +131,9 @@
}, },
longtapEvent(e){ longtapEvent(e){
console.log('longtapEvent'); console.log('longtapEvent');
// console.log("#"+e.currentTarget.id,e);
// let view = uni.createSelectorQuery().in(this).select("#"+e.currentTarget.id.replace('message_content_wrap_','auchor'));
// console.log(e.touches[0].clientX,e.touches[0].clientY);
// view.boundingClientRect((data) => {
// console.log(data.left,data.top);
// //console.log("得到布局位置信息" + JSON.stringify(data));
// }).exec();
this.$emit('userEvent',{type:"longtapMsgContent"},this.source); this.$emit('userEvent',{type:"longtapMsgContent"},this.source);
//this.showToolTip(e);
},
//操作项
showToolTip: function(e) {
let that = this;
that.toolTipData=[
{
id: 1,
icon: '/static/images/chat/longTipIcon/copy.png',
title: '复制',
disabled: false
},
{
id: 4,
icon: '/static/images/chat/longTipIcon/zhuanfa.png',
title: '转发',
disabled: false
},
{
id: 6,
icon: '/static/images/chat/longTipIcon/select.png',
title: '多选',
disabled: false
},
{
id: 7,
icon: '/static/images/chat/longTipIcon/delete.png',
title: '删除',
disabled: false
},
// {
// id: 5,
// icon: '/static/images/chat/longTipIcon/tag.png',
// title: '编辑',
// disabled: false
// }
];
that.toolTipX =e.touches[0].clientX;
that.toolTipY = e.touches[0].clientY-20;
that.toolTipFlag = !that.toolTipFlag;
if(that.toolTipFlag==true){
let nowTime=new Date().getTime();
let msgTime=that.source.createTime;
let diff= nowTime-msgTime;
if(this.isSender&&diff<120000){
that.toolTipData.push({
id: 3,
icon: '/static/images/chat/longTipIcon/revert.png',
title: '撤回',
disabled: false
})
}
}
},
tapPopup(e) {
let that = this;
let currentHandleMsg=that.source;
console.log(currentHandleMsg);
if (e.title == "撤回") {
that.toolTipFlag = false;
that.$emit('userEvent',{type:'revokeMessage'},that.source);
}
if (e.title == "复制") {
let content = currentHandleMsg.textElem?.content;
if (content) {
let copyContent =content.text;
let formatStr = copyContent;
//let formatStr = this.replaceReseverEmoji(copyContent);
uni.setClipboardData({
data:formatStr,
success: (res) => {
uni.showToast({
title: res,
icon: 'none'
})
},
error: (e) => {
uni.showToast({
title: e,
icon: 'none',
duration: 3000,
})
}
})
}
that.toolTipFlag = false;
return;
}
if (e.title == "转发") {
that.$emit('userEvent',{type:'forward'},that.source);
that.toolTipFlag = false;
return
}
if(e.title=="调换"){
that.toolTipFlag = false;
return;
}
if (e.title == "多选") {
that.$emit('userEvent',{type:'select'},that.source);
that.toolTipFlag = false;
return
}
if (e.title == "删除") {
that.toolTipFlag = false;
that.$emit('userEvent',{type:'deleteMsg'},that.source);
return
}
}, },
}, },
}; };
</script> </script>
@@ -346,7 +224,7 @@
color: #999; color: #999;
} }
image { .state_img {
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
@@ -376,7 +254,7 @@
} }
.message_content_wrap { .message_content_wrap {
flex-direction: row-reverse; flex-direction: row-reverse;
.bg_container { .bg_container {
border-radius: 12rpx 0 12rpx 12rpx; border-radius: 12rpx 0 12rpx 12rpx;
background-color: #94ec68 !important; background-color: #94ec68 !important;
@@ -398,7 +276,7 @@
background-color: #fdf5e9; background-color: #fdf5e9;
} }
} }
.notice_message_container { .notice_message_container {
@include ellipsisWithLine(2); @include ellipsisWithLine(2);
text-align: center; text-align: center;
@@ -51,7 +51,7 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
@include vCenterBox(); @include vCenterBox();
.title { .title {
@include nomalEllipsis(); @include nomalEllipsis();
max-width: 280rpx; max-width: 280rpx;
+86 -87
View File
@@ -1,8 +1,8 @@
<template> <template>
<view class="chating_container"> <view class="chating_container">
<SelectHeader v-if="selectFlag" :count="selectItems.length" @leftClick="onUserMessageEvent({type:'cancelSelect'})" ref="selectHeaderRef" /> <SelectHeader v-if="selectFlag" :count="selectItems.length" @leftClick="onUserMessageEvent({type:'cancelSelect'})" ref="selectHeaderRef" />
<chating-header v-else @click="pageClick" ref="chatingHeaderRef" /> <ChatingHeader v-else @click="pageClick" ref="chatingHeaderRef" />
<chating-list <ChatingList
@userEvent="onUserMessageEvent" @userEvent="onUserMessageEvent"
@click="pageClick" @click="pageClick"
:selectItems="selectItems" :selectItems="selectItems"
@@ -10,7 +10,7 @@
ref="chatingListRef" ref="chatingListRef"
@initSuccess="initSuccess" /> @initSuccess="initSuccess" />
<SelectFooter v-if="selectFlag" ref="selectFooterRef" @userEvent="onUserMessageEvent" /> <SelectFooter v-if="selectFlag" ref="selectFooterRef" @userEvent="onUserMessageEvent" />
<chating-footer v-else ref="chatingFooterRef" :footerOutsideFlag="footerOutsideFlag" <ChatingFooter v-else ref="chatingFooterRef" :footerOutsideFlag="footerOutsideFlag"
@scrollToBottom="scrollToBottom" /> @scrollToBottom="scrollToBottom" />
<u-loading-page :loading="initLoading"></u-loading-page> <u-loading-page :loading="initLoading"></u-loading-page>
</view> </view>
@@ -19,15 +19,14 @@
<script> <script>
import {mapActions,mapGetters} from "vuex"; import {mapActions,mapGetters} from "vuex";
import {offlinePushInfo} from "@/util/imCommon"; import {offlinePushInfo} from "@/util/imCommon";
import {PageEvents,ContactChooseTypes} from "@/constant"; import {PageEvents,ContactChooseTypes } from "@/constant";
import ChatingHeader from "./components/ChatingHeader.vue"; import ChatingHeader from "./components/ChatingHeader";
import ChatingFooter from "./components/ChatingFooter/index.vue"; import ChatingFooter from "./components/ChatingFooter/index";
import ChatingList from "./components/ChatingList.vue"; import ChatingList from "./components/ChatingList";
import SelectHeader from "./components/SelectHeader.vue"; import SelectHeader from "./components/SelectHeader";
import SelectFooter from "./components/SelectFooter.vue"; import SelectFooter from "./components/SelectFooter";
import {markConversationAsRead} from "@/util/imCommon"; import {markConversationAsRead} from "@/util/imCommon";
import IMSDK,{MessageType} from "openim-uniapp-polyfill"; import IMSDK, {MessageType} from "openim-uniapp-polyfill";
export default { export default {
components: { components: {
ChatingHeader, ChatingHeader,
@@ -42,16 +41,16 @@
footerOutsideFlag: 0, footerOutsideFlag: 0,
initLoading: true, initLoading: true,
back2Tab: false, back2Tab: false,
selectFlag:false, selectFlag: false,
selectItems:[], selectItems: [],
forwardItems:[], forwardItems: [],
forwardMerge:false forwardMerge: false
}; };
}, },
computed:{ computed: {
...mapGetters([ ...mapGetters([
"storeCurrentConversation", "storeCurrentConversation",
]), ]),
}, },
onLoad(options) { onLoad(options) {
//console.log("onload"); //console.log("onload");
@@ -72,7 +71,7 @@
this.resetMessageState(); this.resetMessageState();
}, },
methods: { methods: {
...mapActions("message", ["resetMessageState", "deleteMessages","pushNewMessage", "updateOneMessage"]), ...mapActions("message", ["resetMessageState", "deleteMessages", "pushNewMessage", "updateOneMessage"]),
...mapActions("conversation", ["resetConversationState"]), ...mapActions("conversation", ["resetConversationState"]),
scrollToBottom(isRecv = false) { scrollToBottom(isRecv = false) {
this.$refs.chatingListRef.scrollToBottom(false, isRecv); this.$refs.chatingListRef.scrollToBottom(false, isRecv);
@@ -92,46 +91,46 @@
uni.$off(PageEvents.ScrollToBottom, this.scrollToBottom); uni.$off(PageEvents.ScrollToBottom, this.scrollToBottom);
}, },
//选择会话列表的回调 //选择会话列表的回调
async onForwardTargetSelected(userList,groupList){ async onForwardTargetSelected(userList, groupList) {
const _this = this; const _this = this;
//console.log(userList,groupList); //console.log(userList,groupList);
if(this.forwardItems.length === 0){ if (this.forwardItems.length === 0) {
return false; return false;
} }
if(this.forwardMerge && this.forwardItems.length>1){ if (this.forwardMerge && this.forwardItems.length > 1) {
const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateMergerMessage, IMSDK.uuid(), { const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateMergerMessage, IMSDK.uuid(), {
messageList: _this.forwardItems, messageList: _this.forwardItems,
title: "转发的消息", title: "转发的消息",
summaryList: ["summaryList","summaryList"] summaryList: ["summaryList", "summaryList"]
}); });
//console.log(res ); //console.log(res );
if(res){ if (res) {
await _this.doForwarMsg(userList,groupList,res); await _this.doForwarMsg(userList, groupList, res);
} }
}else{ } else {
for (var mi = 0; mi < this.forwardItems.length; mi++) { for (var mi = 0; mi < this.forwardItems.length; mi++) {
var msg = this.forwardItems[mi]; var msg = this.forwardItems[mi];
const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateForwardMessage, IMSDK.uuid(), msg); const res = await IMSDK.asyncApi(IMSDK.IMMethods.CreateForwardMessage, IMSDK.uuid(), msg);
//console.log(res ); //console.log(res );
if(res){ if (res) {
await _this.doForwarMsg(userList,groupList,res); await _this.doForwarMsg(userList, groupList, res);
} }
} }
} }
this.onUserMessageEvent({type:'cancelSelect'}); this.onUserMessageEvent({type: 'cancelSelect'});
}, },
async doForwarMsg(userList,groupList,msgiem) async doForwarMsg(userList, groupList, msgiem)
{ {
//console.log(userList,groupList); //console.log(userList,groupList);
const _this = this; const _this = this;
for (var i = 0; i < userList.length; i++) { for (var i = 0; i < userList.length; i++) {
this.sendMessage(msgiem,userList[i].userID,""); this.sendMessage(msgiem, userList[i].userID, "");
} }
for (var i = 0; i < groupList.length; i++) { for (var i = 0; i < groupList.length; i++) {
this.sendMessage(msgiem,"",groupList[i].groupID); this.sendMessage(msgiem, "", groupList[i].groupID);
} }
}, },
sendMessage(message,user_id,group_id) { sendMessage(message, user_id, group_id) {
//this.scrollToBottom(); //this.scrollToBottom();
//console.log(message); //console.log(message);
//console.log(user_id,group_id); //console.log(user_id,group_id);
@@ -145,149 +144,149 @@
console.log(data); console.log(data);
this.pushNewMessage(message); this.pushNewMessage(message);
}) })
.catch((res={data,errCode,errMsg}) => { .catch((res = {data,errCode,errMsg}) => {
console.log(res); console.log(res);
uni.$u.toast(errMsg); uni.$u.toast(errMsg);
}); });
}, },
onUserMessageEvent(e,data){ onUserMessageEvent(e, data) {
const _this = this; const _this = this;
if(e.type == 'select'){ if (e.type == 'select') {
this.selectFlag = true; this.selectFlag = true;
this.selectItems = [data]; this.selectItems = [data];
this.$refs.chatingListRef.scrollToAnchor(`auchor${data.clientMsgID}`); this.$refs.chatingListRef.scrollToAnchor(`auchor${data.clientMsgID}`);
return ; return;
} }
if(e.type == 'cancelSelect'){ if (e.type == 'cancelSelect') {
this.selectFlag = false; this.selectFlag = false;
this.selectItems = []; this.selectItems = [];
return ; return;
} }
if(e.type == 'selected'){ if (e.type == 'selected') {
if(this.selectFlag == true){ if (this.selectFlag == true) {
let founded = false; let founded = false;
let arr = []; let arr = [];
for (var index = 0; index < this.selectItems.length; index++) { for (var index = 0; index < this.selectItems.length; index++) {
var v = this.selectItems[index]; var v = this.selectItems[index];
if(v.clientMsgID == data.clientMsgID){ if (v.clientMsgID == data.clientMsgID) {
founded = true; founded = true;
}else{ } else {
arr.push(v); arr.push(v);
} }
} }
if(!founded){ if (!founded) {
arr.push(data); arr.push(data);
} }
console.log(arr.length); console.log(arr.length);
this.selectItems = [...arr]; this.selectItems = [...arr];
} }
return ; return;
} }
if(e.type == 'deleteMsg'){ if (e.type == 'deleteMsg') {
let deleteMsgs = []; let deleteMsgs = [];
if(!data){ if (!data) {
deleteMsgs = [...this.selectItems]; deleteMsgs = [...this.selectItems];
}else{ } else {
deleteMsgs = [{...data}]; deleteMsgs = [{...data}];
} }
for (let i = 0; i < deleteMsgs.length; i++) { for (let i = 0; i < deleteMsgs.length; i++) {
let element = deleteMsgs[i]; let element = deleteMsgs[i];
IMSDK.asyncApi('deleteMessageFromLocalStorage',IMSDK.uuid(), { IMSDK.asyncApi('deleteMessageFromLocalStorage', IMSDK.uuid(), {
conversationID: _this.storeCurrentConversation.conversationID, conversationID: _this.storeCurrentConversation.conversationID,
clientMsgID: element.clientMsgID clientMsgID: element.clientMsgID
}).then(res=>{ }).then(res => {
//console.log(res); //console.log(res);
}).catch(res=>{ }).catch(res => {
//console.log(res); //console.log(res);
}).finally(()=>{ }).finally(() => {
//console.log(arguments); //console.log(arguments);
}) })
} }
this.selectItems = []; this.selectItems = [];
this.$refs.chatingListRef.loadMessageList(); this.$refs.chatingListRef.loadMessageList();
return ; return;
} }
if(e.type == 'forward'){ if (e.type == 'forward') {
if(!data){ if (!data) {
this.forwardItems = [...this.selectItems]; this.forwardItems = [...this.selectItems];
let menu = ['逐条转发','合并转发']; let menu = ['逐条转发', '合并转发'];
uni.showActionSheet({ uni.showActionSheet({
itemList:menu, itemList: menu,
success({tapIndex}){ success({tapIndex}) {
if(menu[tapIndex] == '逐条转发'){ if (menu[tapIndex] == '逐条转发') {
this.forwardMerge = false; this.forwardMerge = false;
} }
if(menu[tapIndex] == '合并转发'){ if (menu[tapIndex] == '合并转发') {
this.forwardMerge = true; this.forwardMerge = true;
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`, url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`,
events:{ events: {
onSelectedConfirm(userList,groupList){ onSelectedConfirm(userList, groupList) {
//console.log(userList,groupList); //console.log(userList,groupList);
_this.onForwardTargetSelected(userList,groupList) _this.onForwardTargetSelected(userList, groupList)
} }
} }
}); });
} }
}); });
}else{ } else {
this.forwardItems = [{...data}]; this.forwardItems = [{...data}];
this.forwardMerge = false; this.forwardMerge = false;
uni.navigateTo({ uni.navigateTo({
url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`, url: `/pages/common/contactChoose/choose?type=${ContactChooseTypes.GetList}&checkedUserIDList=[]`,
events:{ events: {
onSelectedConfirm(userList,groupList){ onSelectedConfirm(userList, groupList) {
//console.log(userList,groupList); //console.log(userList,groupList);
_this.onForwardTargetSelected(userList,groupList) _this.onForwardTargetSelected(userList, groupList)
} }
} }
}); });
} }
return ; return;
} }
if(e.type == 'revokeMessage'){ if (e.type == 'revokeMessage') {
IMSDK.asyncApi('revokeMessage', IMSDK.uuid(), { IMSDK.asyncApi('revokeMessage', IMSDK.uuid(), {
conversationID: _this.storeCurrentConversation.conversationID, conversationID: _this.storeCurrentConversation.conversationID,
clientMsgID: data.clientMsgID clientMsgID: data.clientMsgID
}).then(res=>{ }).then(res => {
console.log(res); console.log(res);
}).catch(res=>{ }).catch(res => {
console.log(res); console.log(res);
}).finally(()=>{ }).finally(() => {
console.log(arguments); console.log(arguments);
}) })
return ; return;
} }
if(e.type == 'longtapMsgContent'){ if (e.type == 'longtapMsgContent') {
let menu = []; let menu = [];
if(data.contentType == MessageType.TextMessage){ if (data.contentType == MessageType.TextMessage) {
menu.push('复制') menu.push('复制')
} }
menu.push('转发'); menu.push('转发');
menu.push('多选'); menu.push('多选');
menu.push('删除'); menu.push('删除');
let nowTime=new Date().getTime(); let nowTime = new Date().getTime();
let msgTime=data.createTime; let msgTime = data.createTime;
let diff= nowTime-msgTime; let diff = nowTime - msgTime;
if(this.isSender&&diff<120000){ if (this.isSender && diff < 120000) {
menu.push('撤回') menu.push('撤回')
} }
uni.showActionSheet({ uni.showActionSheet({
itemList:menu, itemList: menu,
success({tapIndex}){ success({tapIndex}) {
const title = menu[tapIndex]; const title = menu[tapIndex];
switch (title) { switch (title) {
case "撤回": case "撤回":
_this.onUserMessageEvent({type:'revokeMessage'},data); _this.onUserMessageEvent({type: 'revokeMessage'}, data);
break; break;
case "复制": case "复制":
let content = data.textElem?.content; let content = data.textElem?.content;
if (content) { if (content) {
//let formatStr = this.replaceReseverEmoji(copyContent); //let formatStr = this.replaceReseverEmoji(copyContent);
uni.setClipboardData({ uni.setClipboardData({
data:content, data: content,
success: (res) => { success: (res) => {
uni.showToast({ uni.showToast({
title: res, title: res,
@@ -305,20 +304,20 @@
} }
break; break;
case "转发": case "转发":
_this.onUserMessageEvent({type:'forward'},data); _this.onUserMessageEvent({type: 'forward'}, data);
break; break;
case "多选": case "多选":
_this.onUserMessageEvent({type:'select'},data); _this.onUserMessageEvent({type: 'select'}, data);
break; break;
case "删除": case "删除":
_this.onUserMessageEvent({type:'deleteMsg'},data); _this.onUserMessageEvent({type: 'deleteMsg'}, data);
break; break;
default: default:
break; break;
} }
} }
}) })
return ; return;
} }
} }
}, },
+3 -14
View File
@@ -1,19 +1,8 @@
import store from "@/store"; import store from "@/store";
import { import {CustomType,GroupSystemMessageTypes,AddFriendQrCodePrefix,AddGroupQrCodePrefix} from "@/constant";
CustomType, import IMSDK, {GroupAtType,MessageType,SessionType} from "openim-uniapp-polyfill";
GroupSystemMessageTypes,
AddFriendQrCodePrefix,
AddGroupQrCodePrefix,
} from "@/constant";
import IMSDK, {
GroupAtType,
MessageType,
SessionType,
} from "openim-uniapp-polyfill";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { import {isThisYear} from "date-fns";
isThisYear
} from "date-fns";
import calendar from "dayjs/plugin/calendar"; import calendar from "dayjs/plugin/calendar";
import relativeTime from "dayjs/plugin/relativeTime"; import relativeTime from "dayjs/plugin/relativeTime";
+4 -3
View File
@@ -6,8 +6,9 @@ uni.$u.http.setConfig((defaultConfig) => {
defaultConfig.baseURL = config.getRegisterUrl(); /* 根域名 */ defaultConfig.baseURL = config.getRegisterUrl(); /* 根域名 */
return defaultConfig; return defaultConfig;
}); });
import requestInterceptors from "./requestInterceptors";
import responseInterceptors from "./responseInterceptors";
module.exports = (vm) => { module.exports = (vm) => {
require("./requestInterceptors")(vm); requestInterceptors(vm);
require("./responseInterceptors")(vm); responseInterceptors(vm);
}; };