ソースを参照

优化自动填充

bzkf3 2 年 前
コミット
6bc103a2d3
共有1 個のファイルを変更した27 個の追加22 個の削除を含む
  1. 27 22
      src/pages/teacher/consult.vue

+ 27 - 22
src/pages/teacher/consult.vue

@@ -13,12 +13,32 @@ let dyaw_xlfw_zxhd = $ref<type_dyaw_xlfw_zxhd | undefined>()
 let dyaw_xlfw_zxhd_list = $ref<type_dyaw_xlfw_zxhd[] | undefined>()
 
 
+
+const searchValue = $ref('搜索')
+watch(
+  () => searchValue,
+  async (val, oldVal) => {
+    if (oldVal === '搜索') return;
+    dyaw_xlfw_zxhd_list = (await request({
+      url: '/dyaw/xlfw_zxhd/index',
+      data: {
+        dxz_tea_user_id: user.user_id,
+        dxz_stu_user_realname: searchValue === '搜索' ? undefined : searchValue,
+        limit: 20,
+        last_msg: 1
+      }
+    })).data.page_data
+  }
+)
+
+
 let timer: NodeJS.Timeout;
 (async function loop() {
   dyaw_xlfw_zxhd_list = (await request({
     url: '/dyaw/xlfw_zxhd/index',
     data: {
       dxz_tea_user_id: user.user_id,
+      dxz_stu_user_realname: searchValue === '搜索' ? undefined : searchValue,
       limit: 20,
       last_msg: 1
     }
@@ -35,22 +55,6 @@ let timer: NodeJS.Timeout;
   }, 60 * 1000);
 })();
 
-const searchValue = $ref('')
-watch(
-  () => searchValue,
-  async () => {
-    dyaw_xlfw_zxhd_list = (await request({
-      url: '/dyaw/xlfw_zxhd/index',
-      data: {
-        dxz_tea_user_id: user.user_id,
-        dxz_stu_user_realname: searchValue,
-        limit: 20,
-        last_msg: 1
-      }
-    })).data.page_data
-  }
-)
-
 let infoList = $ref<Array<type_dyaw_xlfw_zxhd_log>>([])
 let inputValue = $ref('')
 let isSending = $ref(false)
@@ -302,7 +306,8 @@ function emitUpdateInfo(info: type_dyaw_xlfw_zxhd_log, isUpdate?: boolean) {
   <div class="h-590px bg-hex-f2f2f295 flex justify-center divide-x">
     <div class="w-320px p-10px h-full flex flex-col justify-start bg-white space-y-4">
       <el-input autocomplete="off" name="searchValue" v-model="searchValue" size="large" :prefix-icon="Search"
-        clearable></el-input>
+        @focus="searchValue = ''" clearable placeholder="搜索"
+        :style="`${searchValue === '搜索' && '--el-input-text-color:var(--el-text-color-placeholder);'}`"></el-input>
       <div
         class="max-h-520px flex flex-col flex-none divide-y scrollbar scrollbar-thin scrollbar-thumb-rounded-md scrollbar-thumb-gray-200 scrollbar-track-transparent">
         <chat-stu-card v-for="item in dyaw_xlfw_zxhd_list" :d="item" @click="handleClickStuCard(item)"
@@ -326,11 +331,11 @@ function emitUpdateInfo(info: type_dyaw_xlfw_zxhd_log, isUpdate?: boolean) {
         </div>
         <!--  -->
         <!-- <div v-show="unreadNum > 10"
-                        class="absolute bg-white right-2 bottom-200px text-blue-400 rounded-l-full cursor-pointer z-100 flex items-center space-x-1 p-2 text-sm"
-                        @click="getAllUnreadMsg">
-                        <i:material-symbols:keyboard-double-arrow-up />
-                        <span>{{ unreadNum }}条消息</span>
-                      </div> -->
+                                    class="absolute bg-white right-2 bottom-200px text-blue-400 rounded-l-full cursor-pointer z-100 flex items-center space-x-1 p-2 text-sm"
+                                    @click="getAllUnreadMsg">
+                                    <i:material-symbols:keyboard-double-arrow-up />
+                                    <span>{{ unreadNum }}条消息</span>
+                                  </div> -->
         <div class="bg-white h-180px p-5px flex flex-col justify-between">
           <tinymce-area v-model="inputValue" ref="TinyRef" @click:audio="handleAudioChatStart"
             @click:video="handleVideoChatStart" @click:submit="handleClickSend"></tinymce-area>