From 269b41f9de3e34f06e123341c8f1fb7d9ef4b87f Mon Sep 17 00:00:00 2001 From: yangyin <18723093654@163.com> Date: 星期一, 02 十二月 2024 16:57:05 +0800 Subject: [PATCH] 修改文字大小 --- src/layout/component/sidebar/SidebarOther.vue | 153 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 144 insertions(+), 9 deletions(-) diff --git a/src/layout/component/sidebar/SidebarOther.vue b/src/layout/component/sidebar/SidebarOther.vue index 216d6a1..5c58773 100644 --- a/src/layout/component/sidebar/SidebarOther.vue +++ b/src/layout/component/sidebar/SidebarOther.vue @@ -32,6 +32,7 @@ <span class="use_name">{{ firstUserCharacter }}</span> </div> <div class="isShow_Profile" v-show="isShowExitLogin"> + <div class="exit" @click="feedbackClick"><i class="ywifont ywicon-youxiang"></i> 鐢ㄦ埛鍙嶉</div> <div class="exit" @click="logoutClick"><i class="ywifont ywicon-tuichu"></i> 閫�鍑虹櫥褰�</div> </div> </div> @@ -40,6 +41,30 @@ <span class="use_name">鐧�</span> </div> </div> + <div class="agent_line mt-4"></div> + + <el-popover placement="right-start" :width="136" trigger="hover"> + <template #reference> + <div class="nav__chat"> + <div class="nav__chat-icon"> + <span class="chat_img ywifont ywicon-shouji !text-[20px] text-[#fff]"></span> + </div> + </div> + </template> + <template #default> + <div class="relative"> + <div class="p-0 box-shadow-none rounded-[10px]"> + <p class="text-center text-[#5e6772] m-0 p-0 leading-5 text-[12px]">璇蜂娇鐢ㄦ墜鏈烘祻瑙堝櫒鎵弿浜岀淮鐮�</p> + <p class="text-center text-[red] m-0 p-0 leading-5 text-[12px]">(涓嶆敮鎸佸井淇℃壂鎻�)</p> + <div ref="setPhoneQRCode" class="mt-[8px] mb-[8px]"></div> + <p class="text-center text-[#5e6772] m-0 p-0 leading-5"> + 鎵爜涓嬭浇 <br /> + WI 姘村姟鏅鸿兘鍔╂墜 + </p> + </div> + </div> + </template> + </el-popover> </div> </div> <div class="nav_history_list bg-[#1c1e1d]" v-show="isShowHistoryChatRoom" ref="historyChatRoomRef"> @@ -51,7 +76,7 @@ </template> </el-input> <div - class="absolute hidden top-[100%] w-[84px] z-[1001] left-0 group-hover:block overflow-hidden rounded-md text-sm text-gray-500 bg-[#fff] py-1.5" + class="absolute hidden top-[100%] w-[84px] z-[1001] left-0 group-hover:block overflow-hidden rounded-md text-gray-500 bg-[#fff] py-1.5" > <div class="w100 relative hover:bg-[#e6f1ff]" @@ -78,8 +103,9 @@ @click="roomClick(item)" > <div class="ywifont ywicon-xiaoxi1 flex-0 mr-2.5"></div> - <div class="flex-auto text-ellipsis text-nowrap text-sm group-hover:text-[#0084ff]">{{ item.title }}</div> + <div class="flex-auto text-ellipsis text-nowrap group-hover:text-[#0084ff]">{{ item.title }}</div> <div class="text-gray-100 flex items-center space-x-2 ml-1"> + <div class="ywifont invisible ywicon-bianji group-hover:visible !" @click="editChat(item)"></div> <el-popconfirm title="纭畾鍒犻櫎鑱婂ぉ璁板綍?" @confirm.stop="confirmDeleteChatRoom(item)" width="180"> <template #reference> <div class="ywifont invisible ywicon-shanchu3 group-hover:visible"></div> @@ -90,15 +116,30 @@ </div> </div> </div> + <div class="expand-sidebar" @click="toggleSidebar" v-if="!isSharePage"> + <i class="text-[#fff] transition-all ywifont ywicon-zuoyoujiantou1"></i> + </div> + <el-dialog v-model="userFeedbackVisible" title="鐢ㄦ埛鍙嶉" width="500" :before-close="handleCloseFeedback"> + <el-input v-model="userFeedbackText" :rows="8" type="textarea" placeholder="娆㈣繋璇磋浣犵殑鎯虫硶" /> + <template #footer> + <div class="dialog-footer"> + <el-button @click="handleCloseFeedback">鍙栨秷</el-button> + <el-button type="primary" @click="confirmFeedback" :disabled="is_input_title"> 纭� 瀹� </el-button> + </div> + </template> + </el-dialog> </div> </template> <script setup lang="ts"> import { onClickOutside } from '@vueuse/core'; +import { ElMessage, ElMessageBox } from 'element-plus'; import moment from 'moment'; -import { computed, onMounted, ref, watch, watchEffect } from 'vue'; +import QRCode from 'qrcodejs2-fixes'; +import { computed, nextTick, onMounted, ref, watch, watchEffect } from 'vue'; import type { ChatRoomItem } from './components/types'; -import { DeleteHistoryGroups } from '/@/api/ai/chat'; +import { DeleteHistoryGroups, setHistoryGroupTitle } from '/@/api/ai/chat'; +import { SERVE_URL } from '/@/constants'; import { useSearch } from '/@/hooks/useSearch'; import { DateFilter, dateFilterMap } from '/@/model/types/date'; import { @@ -109,6 +150,7 @@ isSharePage, isShowLogin, newChatRoomClick, + selectFirstRoom, } from '/@/stores/chatRoom'; import emitter from '/@/utils/mitt'; import { accessSessionKey, userNameKey } from '/@/utils/request'; @@ -122,7 +164,7 @@ const isShowExitLogin = ref(false); isLoginStatus.value = !!Local.get(accessSessionKey); const toggleSidebar = () => { - emit('toggleSidebar', false); + emit('toggleSidebar', true); }; //#region ====================== 鍘嗗彶浼氳瘽 =================== const isShowHistoryChatRoom = ref(false); @@ -152,15 +194,67 @@ roomClick(chatRoomList.value[0]); chatRoomRef.value.firstElementChild?.scrollIntoView(); }; - -onClickOutside(historyChatRoomRef, () => { - isShowHistoryChatRoom.value = false; -}); +const editChat = (room: ChatRoomItem) => { + ElMessageBox.prompt('', '閲嶅懡鍚�', { + confirmButtonText: '纭', + cancelButtonText: '鍙栨秷', + inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, + inputValue: room.title, + inputErrorMessage: '璇疯緭鍏ユ柊鐨勫悕绉�', + }) + .then(async (edit) => { + const res = await setHistoryGroupTitle({ + history_group_id: room.id, + title: edit.value, + }); + if (res.json_ok) { + const foundIndex = chatRoomList.value.findIndex((item) => item.id === activeRoomId.value); + chatRoomList.value[foundIndex].title = edit.value; + chatRoomRef.value.firstElementChild?.scrollIntoView(); + } + }) + .catch(({ value }) => { + ElMessage({ + type: 'info', + message: '鍙栨秷淇敼', + }); + }); +}; +onClickOutside( + historyChatRoomRef, + () => { + isShowHistoryChatRoom.value = false; + }, + { + ignore: ['.el-message-box', '.el-popper'], + } +); //#endregion //#region ====================== 鍏徃淇℃伅 ====================== const companyClick = () => { gotoRoute({ name: 'AboutUs' }); }; +//#endregion +//#region ====================== 鐢ㄦ埛鍙嶉 ====================== +const userFeedbackVisible = ref(false); +const userFeedbackText = ref(''); +const is_input_title = computed(() => { + return userFeedbackText.value == '' ? true : false; +}); +const feedbackClick = () => { + userFeedbackVisible.value = true; +}; +const handleCloseFeedback = () => { + userFeedbackVisible.value = false; +}; +const confirmFeedback = () => { + const data = { + content: userFeedbackText.value, + contact: '鐢ㄦ埛鍙嶉', + }; //TODO 鍙戦�佺敤鎴峰弽棣� + handleCloseFeedback(); +}; + //#endregion //#region ====================== 鏄剧ず/閫�鍑虹櫥褰� ====================== //鐧诲綍 @@ -179,6 +273,7 @@ isLoginStatus.value = false; LoginInfo.remove(); }; + const toggleExitLoginBtnRef = ref<HTMLDivElement>(null); onClickOutside(toggleExitLoginBtnRef, () => { @@ -213,6 +308,24 @@ } }); //#endregion +//#region ====================== 鎵爜鎵嬫満绔笅杞� ====================== +const setPhoneQRCode = ref<HTMLElement | null>(null); +// 鍒濆鍖栫敓鎴愪簩缁寸爜 +const initQrcode = () => { + let currentTime = new Date().getTime(); + const url = `${SERVE_URL}ai_html/views/mobileDownload/index.html?v=${currentTime}`; + nextTick(() => { + (<HTMLElement>setPhoneQRCode.value).innerHTML = ''; + new QRCode(setPhoneQRCode.value, { + text: url, + width: 126, + height: 126, + colorDark: '#000000', + colorLight: '#ffffff', + }); + }); +}; +//#endregion //#region ====================== 鎼滅储鑱婂ぉ瀹� ====================== const { query, queryData } = useSearch(filteredChatRoomList, queryParams); const debounceQuery = debounce(query); @@ -228,6 +341,8 @@ userName.value = Local.get(userNameKey); }); onMounted(async () => { + selectFirstRoom(); + emitter.on('openLoginDlg', () => { if (isShowLogin.value || isLoginStatus.value) return; openLoginDlg(); @@ -235,6 +350,7 @@ emitter.on('logout', () => { logoutClick(); }); + initQrcode(); }); </script> @@ -355,6 +471,9 @@ padding: 16px 12px; gap: 8px; cursor: pointer; + &:hover { + background-color: rgba(0, 0, 0, 0.04); + } } } } @@ -402,4 +521,20 @@ width: 0; color: transparent; } +.expand-sidebar { + width: 20px; + height: 48px; + background: rgba(0, 0, 0, 0.2); + position: absolute; + top: 50%; + right: 0px; + transform: translate(100%, -50%); + z-index: 9; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + padding: 0 3px; + border-radius: 0px 5px 5px; +} </style> -- Gitblit v1.9.3