From e9aa61b3236e35e6d146effdddeb48b0452571a1 Mon Sep 17 00:00:00 2001
From: hailu <962012470@qq.com>
Date: 星期四, 07 十一月 2024 18:06:40 +0800
Subject: [PATCH] 备份

---
 src/view/IntelligentAgent/allAgent.vue |   59 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 44 insertions(+), 15 deletions(-)

diff --git a/src/view/IntelligentAgent/allAgent.vue b/src/view/IntelligentAgent/allAgent.vue
index 527e53e..11c62e2 100644
--- a/src/view/IntelligentAgent/allAgent.vue
+++ b/src/view/IntelligentAgent/allAgent.vue
@@ -6,8 +6,12 @@
                 <!-- <Button size="large" @click="openaddModal" class="handleSubmit" type="primary">鍒涘缓AI鏅鸿兘浣�</Button> -->
             </div>
             <div class="search-bar">
-                <Input v-model="searchQuery" placeholder="鎼滅储..." size="large" />
-                <Button size="large" @click="changePage(1)" class="handleSubmit" type="primary" icon="ios-search">鎼滅储</Button>
+                <Input v-model="searchQuery" placeholder="璇疯緭鍏ユ劅鍏磋叮鐨勫叧閿瘝" size="large" />
+                <Button size="large" @click="changePage(1)" class="handleSubmit" type="primary"
+                    icon="ios-search">鎼滅储</Button>
+                <Button size="large" @click="clearSearch()" class="handleSubmit" type="primary"
+                    style="margin-left: 10px;"  icon="ios-trash-outline">娓呯┖</Button>
+
             </div>
             <div class="tabs">
                 <Tabs :value="type" @on-click="handleTabChange">
@@ -16,7 +20,10 @@
                     <TabPane label="琛屼笟" name="1">
                         <!-- 宸ヤ綔鍒嗙被鐨勪骇鍝� -->
                     </TabPane>
-                    <TabPane label="鎷涘晢" name="2">
+                    <TabPane label="瀹忚" name="2">
+                        <!-- 琛屼笟鍒嗙被鐨勪骇鍝� -->
+                    </TabPane>
+                    <TabPane label="鎷涘晢" name="3">
                         <!-- 瀛︿範鍒嗙被鐨勪骇鍝� -->
                     </TabPane>
                     <TabPane label="鎴戠殑鏀惰棌" name="-1">
@@ -25,16 +32,17 @@
                     <!-- 鏇村TabPane -->
                 </Tabs>
             </div>
-            <div class="products" v-if="products.length > 0">
+            <div class="products" v-if="products.length > 0 && loading == false">
                 <div class="product" v-for="item in products" :key="item.Id" @click="chat(item)">
                     <img :src="api + item.AvatarLink" style="width: 100px;height: 100px;" alt="" srcset="">
                     <div style="margin-left: 10px;">
                         <!-- <h2 class="title">{{ item.Name }}</h2> -->
-                        <Poptip :content="item.Name" placement="top" trigger="hover" word-wrap width="300">
-                            <h2 class="title">{{ item.Name.length > 15 ?
-                                item.Name.substring(0, 15) + '...' : item.Name }}</h2>
-                        </Poptip>
-
+                        <div>
+                            <Poptip :content="item.Name" placement="top" trigger="hover" word-wrap width="300">
+                                <h2 class="title">{{ item.Name.length > 15 ?
+                                    item.Name.substring(0, 15) + '...' : item.Name }}</h2>
+                            </Poptip>
+                        </div>
                         <Poptip :content="item.Description" placement="top" trigger="hover" word-wrap width="300">
                             <div>{{ item.Description.length > 20 ?
                                 item.Description.substring(0, 20) + '...' : item.Description }}</div>
@@ -51,15 +59,19 @@
                     </div>
                 </div>
             </div>
-            <div class="no-data" v-else>
+            <div class="no-data" v-if="products.length == 0 && loading == false">
                 <img src="../../assets/images/less.png" alt="">
                 <p>鏆傛棤鏁版嵁</p>
             </div>
+            <Spin  v-show="loading" style="padding-bottom: 50px;">
+                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
+                <div>Loading</div>
+            </Spin>
             <Page :current="PageNum" :page-size="PageSize" :total="total" @on-change="changePage" show-elevator
                 style="float: right;position: relative; top: -50px;" />
 
         </div>
-       
+
     </div>
 
 </template>
@@ -71,7 +83,8 @@
     },
     data() {
         return {
-            api: 'http://47.92.245.94:8070',
+            loading: false,
+            api: 'http://47.98.113.167',
             total: 0,
             userId: Number(localStorage.getItem('userId')),
             searchQuery: '',
@@ -122,9 +135,14 @@
         }
     },
     methods: {
+        clearSearch() {
+            this.searchQuery = ''
+            this.changePage(1)
+
+        },
         chat(item) {
             this.$router.push({
-                path: '/chat',
+                path: '/AgentChat',
                 query: {
                     chatInfo: JSON.stringify(item)
                 }
@@ -144,6 +162,7 @@
                 }
                 axios.request({
                     url: 'StarAgent/AddStarAgentData',
+                    
                     method: 'post',
                     data: data
                 }).then(res => {
@@ -208,7 +227,7 @@
         },
         // 鑾峰彇鏁版嵁鍒楄〃
         getAgentDataList() {
-            // this.products = []
+            this.loading = true;
             let data = {
                 Keyword: this.searchQuery,
                 PageNum: this.PageNum,
@@ -227,10 +246,20 @@
             }).then(res => {
                 if (res.data.Check) {
                     this.products = res.data.Data.Data;
+                    for (let i = 0; i < this.products.length; i++) {
+                        if (!this.products[i].Description) {
+                            this.products[i].Description = '鏆傛棤鎻忚堪'
+                        }
+                        if (!this.products[i].Prompt) {
+                            this.products[i].Prompt = '鏆傛棤鎻愮ず'
+                        }
+                    }
                     this.total = res.data.Data.TotalCount
+                    this.loading = false;
                 } else {
                     this.products = []
                     this.$Message.error('鑾峰彇鏁版嵁澶辫触');
+                    this.loading = false;
                 }
 
                 // console.log(res);
@@ -309,7 +338,7 @@
             // this.uploadList.push(this.apiTarget + res.data.fileUrl)
             // file.response.fileUrl = this.apiTarget + res.data.fileUrl
             // // // 鍥炴樉鏃朵細鐢ㄥ埌
-            this.dialogImageUrl = 'http://47.92.245.94:8070' + this.formItem.AvatarLink
+            this.dialogImageUrl = 'http://47.98.113.167' + this.formItem.AvatarLink
             console.log(this.dialogImageUrl);
 
             this.formValidate.imgId = file.response.fileUrl

--
Gitblit v1.8.0