|
@@ -5,7 +5,8 @@
|
|
|
@click="store.commit('setIsShowRight', false)"/>
|
|
|
<div class="common-pic" @click="showInfo">{{ store.state.chatUserInfo.friendName.charAt(0) }}</div>
|
|
|
<div class="username" @click="showInfo">{{ friendName }}</div>
|
|
|
- <van-popover v-model:show="showPopover"
|
|
|
+ <van-popover class="chat-popover"
|
|
|
+ v-model:show="showPopover"
|
|
|
:actions="actions[store.state.chatUserInfo.isGroup]"
|
|
|
placement="bottom-end"
|
|
|
:offset="[15, 5]"
|
|
@@ -50,25 +51,46 @@
|
|
|
size="small"
|
|
|
fix-pos="upleft"
|
|
|
v-model="message"
|
|
|
+ :send-msg="sendMsg"
|
|
|
/>
|
|
|
<van-button type="primary" size="small" :disabled="!message.trim()" class="send-btn" @click="sendMsg">
|
|
|
<span class="text">发送</span>
|
|
|
</van-button>
|
|
|
</div>
|
|
|
+ <van-popup v-model:show="show" class="common-pop">
|
|
|
+ <van-icon name="close" class="close" @click="show=false"/>
|
|
|
+ <div class="title">创建会议链接</div>
|
|
|
+ <div class="form">
|
|
|
+ <van-cell-group inset>
|
|
|
+ <van-field v-model="room" label="房间编号"/>
|
|
|
+ </van-cell-group>
|
|
|
+ </div>
|
|
|
+ <div class="footer" @click="createRoom">确定</div>
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import V3Emoji from '../../../../components/V3Emoji.vue'
|
|
|
-import {computed, defineComponent, reactive, ref, toRefs, watch, nextTick} from "vue";
|
|
|
+import {computed, defineComponent, reactive, ref, toRefs, watch, nextTick, onUnmounted} from "vue";
|
|
|
import Client from "../../../../utils/client";
|
|
|
import GroupClient from "../../../../utils/groupClient";
|
|
|
-import {messageList, sendMessageToUser, sendMessageToGroup, deleteFriend, deleteExitGroup} from "../../../../api";
|
|
|
+import {
|
|
|
+ messageList,
|
|
|
+ sendMessageToUser,
|
|
|
+ sendMessageToGroup,
|
|
|
+ deleteFriend,
|
|
|
+ deleteExitGroup, creatZoom
|
|
|
+} from "../../../../api";
|
|
|
import {useStore} from "vuex";
|
|
|
import {Obj, StrObj, StrNumObj} from "../../../../interface";
|
|
|
import {formatDateTime} from "../../../../utils"
|
|
|
import EmojiData from '../../../../assets/emojidata/emoji-data.json';
|
|
|
import RE from '../../../../utils/regExp'
|
|
|
+import {Toast, Dialog} from "vant"
|
|
|
+import useClipboard from "vue-clipboard3";
|
|
|
+
|
|
|
+const {toClipboard} = useClipboard()
|
|
|
|
|
|
const emojiData: Emoji.JsonData = EmojiData;
|
|
|
const emojiMap: any = {}
|
|
@@ -101,7 +123,8 @@ interface State {
|
|
|
showPopover: boolean,
|
|
|
actions: Obj,
|
|
|
currentAction: StrObj,
|
|
|
- windowName: Window | null
|
|
|
+ show: boolean,
|
|
|
+ room: string
|
|
|
}
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -117,11 +140,12 @@ export default defineComponent({
|
|
|
client: null,
|
|
|
showPopover: false,
|
|
|
actions: {
|
|
|
- 1: [{value: 'joinVideo', text: '加入视频'}, {value: 'deleteFriend', text: '删除好友'}],
|
|
|
- 2: [{value: 'joinVideo', text: '加入视频'}, {value: 'exitGroup', text: '离开群'}],
|
|
|
+ 1: [{value: 'createLink', text: '创建会议链接'}, {value: 'deleteFriend', text: '删除好友'}],
|
|
|
+ 2: [{value: 'createLink', text: '创建会议链接'}, {value: 'exitGroup', text: '离开群'}],
|
|
|
},
|
|
|
currentAction: {},
|
|
|
- windowName: null
|
|
|
+ show: false,
|
|
|
+ room: ''
|
|
|
})
|
|
|
|
|
|
const optionsName = {
|
|
@@ -281,6 +305,9 @@ export default defineComponent({
|
|
|
|
|
|
// 把表情包的英文名字转成表情包
|
|
|
const messageFormat = (msg: string) => {
|
|
|
+ if (/^https?:\/\//.test(msg)) {
|
|
|
+ return `<a href="${msg}" target="_blank">${msg}</a>`
|
|
|
+ }
|
|
|
return msg.replace(/__([^_]+)?__/g, (a, name) => `<b class="chat-emoji">${emojiMap[name] || ''}</b>`)
|
|
|
}
|
|
|
|
|
@@ -304,11 +331,46 @@ export default defineComponent({
|
|
|
store.commit('setIsShowChat', false)
|
|
|
store.commit('setIsShowRight', false)
|
|
|
}
|
|
|
- if (action.value === 'joinVideo') {
|
|
|
- state.windowName = window.open('https://www.ops777777.cc/?url=https%3A%2F%2Fm.ops777777.cc&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTk0MDU1MDgsImlzcyI6IkFQSUdQeEhqVTlpQ2dHbyIsIm5hbWUiOiJqYWNrc29uIiwibmJmIjoxNzE5MzE5MTA4LCJzdWIiOiJqYWNrc29uIiwidmlkZW8iOnsicm9vbSI6Im15LWZpcnN0LXJvb20xIiwicm9vbUpvaW4iOnRydWV9fQ.WMuv_8iHb9gAucxbi9SxbXUW3SAaqQn-noBwF0uKCoU#/room?url=https%3A%2F%2Fm.ops777777.cc&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTk0MDU1MDgsImlzcyI6IkFQSUdQeEhqVTlpQ2dHbyIsIm5hbWUiOiJqYWNrc29uIiwibmJmIjoxNzE5MzE5MTA4LCJzdWIiOiJqYWNrc29uIiwidmlkZW8iOnsicm9vbSI6Im15LWZpcnN0LXJvb20xIiwicm9vbUpvaW4iOnRydWV9fQ.WMuv_8iHb9gAucxbi9SxbXUW3SAaqQn-noBwF0uKCoU&videoEnabled=1&audioEnabled=1&simulcast=0&dynacast=0&adaptiveStream=0&videoDeviceId=88cc2f5ccef42f15c7eed1f10d687cc4c7bc7c8a204a3eaa26ab619f676f2ba1')
|
|
|
+ if (action.value === 'createLink') {
|
|
|
+ let {data} = await creatZoom({zoomName: store.state.userInfo.username})
|
|
|
+ let message = window.location.origin + '/#/zoomLoading?uuid=' + data.uuid
|
|
|
+ Dialog.alert({
|
|
|
+ title: '会议链接创建成功',
|
|
|
+ message,
|
|
|
+ confirmButtonText: '复制链接'
|
|
|
+ }).then(() => {
|
|
|
+ toClipboard(message).then(() => {
|
|
|
+ Toast.success('复制成功')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const createRoom = async () => {
|
|
|
+ if (!state.room.trim()) {
|
|
|
+ return Toast('请输入房间编号')
|
|
|
}
|
|
|
+ if (!/^\w+$/.test(state.room)) {
|
|
|
+ return Toast('房间编号由字母或数字组成')
|
|
|
+ }
|
|
|
+ Toast.loading('加载中...')
|
|
|
+ state.show = false
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ const handleKeydown = (e: KeyboardEvent) => {
|
|
|
+ if (state.message.trim() && !e.shiftKey && e.key === 'Enter') {
|
|
|
+ document.getElementById('textarea')?.blur()
|
|
|
+ sendMsg()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ window.addEventListener('keydown', handleKeydown)
|
|
|
+
|
|
|
+ onUnmounted(() => {
|
|
|
+ window.removeEventListener('keydown', handleKeydown)
|
|
|
+ })
|
|
|
+
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
store,
|
|
@@ -321,7 +383,8 @@ export default defineComponent({
|
|
|
optionsName,
|
|
|
messageFormat,
|
|
|
selectAction,
|
|
|
- clickEmoji
|
|
|
+ clickEmoji,
|
|
|
+ createRoom
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -333,6 +396,12 @@ export default defineComponent({
|
|
|
vertical-align: middle;
|
|
|
margin: 0 2px;
|
|
|
}
|
|
|
+
|
|
|
+.chat-popover {
|
|
|
+ .van-popover__action:hover {
|
|
|
+ background: #f1f1f1;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
@@ -430,7 +499,7 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
.send-btn {
|
|
|
- margin-left: 8px;
|
|
|
+ margin-left: 6px;
|
|
|
margin-bottom: 9px;
|
|
|
|
|
|
.text {
|