11wqe1 2 months ago
parent
commit
2d3d707822

BIN
src/assets/img/cocoloading.gif


+ 22 - 0
src/common/apiConfig.js

@@ -65,6 +65,28 @@ export const API_CONFIG = {
   ajax_morHotApp: {
     functionName: "select_morHotApp",
   },
+
+    // 查询常用应用
+    ajax_addedUsuallyApp: {
+      functionName: "select_addedUsuallyApp",
+    },
+
+    // 查询已添加常用应用
+    ajax_usuallyApp: {
+      functionName: "select_schUsuallyApp",
+    },
+
+  //新增学校应用
+  ajax_add_usuallyApp: {
+    functionName: "insert_usuallyApp",
+  },
+
+  //删除学校应用
+  ajax_del_usuallyApp: {
+    functionName: "del_usuallyApp",
+  },
+
+
   ////////////// 以下是账号审核的数据接口
 
   moveUser: {

+ 16 - 9
src/components/sidebarL.vue

@@ -62,9 +62,9 @@
                         <span>{{ barCopyTit }}</span>
                         <span @click="closeCopy" class="cha" style="color: #6B7280;font-size: 23px;cursor: pointer;">⨯</span>
                     </div>
-
-                    <div style="padding: 16px;box-sizing: border-box;">
-                        <div class="ulTCopyTxt" v-for="(i,ind) in appSignL(barCopy)" @click="levTwo(i)" :key="ind+'a'">
+                    <div style="padding: 16px;box-sizing: border-box;display: flex;flex-direction: column;gap: 10px;">
+                        
+                        <div class="ulTCopyTxt" :style="{background : (activeLTwo === activeL +'+' + ind)? '#E6F0FF' : ''}" v-for="(i,ind) in appSignL(barCopy)" @click="levTwo(i,ind)" :key="ind+'a'">
                             <div>
                                 <div style="display: flex;justify-content: space-between;align-items: center;" v-for="(p,pin) in AppCon(i.url)" :key="pin+'p'">
                                     <img style="width: 30px;object-fit: contain;margin-right: 5px;"  
@@ -140,6 +140,8 @@ import store from '../store'
                 isShow:false,
                 // 一级选中第几个
                 activeL:0,
+                // 二级选中第几个
+                activeLTwo: null,
                 // 二级分类
                 barCopy:[],
                 barCopyTit:''
@@ -178,7 +180,7 @@ import store from '../store'
             // 点击一级导航
             async goto(index,val = null){
                 // console.log('goto',val);
-                
+              
                 // val = null 就是点击了首页
                 if (val) {
                     this.activeL = index + 1               
@@ -188,7 +190,8 @@ import store from '../store'
                     this.$emit('update:urlAddress','')
 
                     this.$emit('getPer')
-
+                    // 清空选中状态
+                    this.activeLTwo = ''
                     this.isShow = false
                     this.activeL = index
                     return
@@ -212,7 +215,8 @@ import store from '../store'
                     let url = ''
                     // 查出对应账号的应用区域地址
                     val.url.forEach(e => {
-                        if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                         // if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                        if (e.region == "beta") {
                             url = e.url
                         }
                     });
@@ -273,8 +277,10 @@ import store from '../store'
                 }
             },
             // 点击二级导航
-            async levTwo(val){
+            async levTwo(val,index){
               
+                this.activeLTwo = `${this.activeL}+${index}`
+
                 // 点击相同应用不刷新
                 if (this.appSign == val.toolId) return
 
@@ -283,7 +289,8 @@ import store from '../store'
                 
                 let url = ''
                 val.url.forEach(e => {
-                    if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                    // if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                    if (e.region == "beta") {
                         url = e.url
                     }
                 });
@@ -453,7 +460,7 @@ import store from '../store'
     cursor: pointer;
 }
 .ulTCopyTxt:hover{
-    background-color: #f3f4f6;
+    background-color: #f3f4f6 !important;
 }
 .cha:hover{
     color: #000 !important;

+ 265 - 10
src/components/topPage.vue

@@ -53,22 +53,60 @@
                             </span>
                         </el-tooltip>
                     </div>
+                    <div class="cha" v-if="userinfo.type == 1 && userinfo.role == 1" @click.stop="delApp(item.lid)">
+                        ✖ 
+                    </div>
                 </div>
-                <!-- <div class="footListCon footListCon2">
+                <div v-if="userinfo.type == 1 && userinfo.role == 1" @click="openUsuallyApp" class="footListCon footListCon2">
                     <div style="margin-bottom: 8px;font-size: 40px;color: #0354D7;">+</div>
                     <div class="TabListBri">添加常用应用</div>
-                </div> -->
+                </div> 
             </div>
         </div>
+
+        <!-- 常见应用弹框 -->
+        <el-dialog
+        title="应用列表"
+        :visible.sync="dialogVisible"
+        class="moreDia"
+        :close-on-click-modal="false"
+        :modal="false"
+        width="60%"
+        :before-close="handleClose">
+            <div v-loading="loading" style="display: grid;grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));gap: 16px;height: 300px;overflow: auto;">
+                <div v-for="(item,index) in isAdd(usuallyList)" class="tabCon" @click="addApp(item.id)"  :key="index" style="min-width: 308px;">
+                        <div class="AppList">
+                            <img class="appImg" :src="JSON.parse(item.json).icon" alt="">
+                            <div class="con">
+                                <div class="tit">{{ item.name }}</div>
+                                <div class="bri">
+                                    <el-tooltip class="item" effect="light" :content="item.detail" placement="bottom">
+                                        <span>
+                                            {{ item.detail }}
+                                        </span>
+                                    </el-tooltip>
+                                </div>
+                            </div>
+                            <div style="position: absolute;top: 6px;right: 15px;" v-if="tab.includes(item.id)">
+                                ✔
+                            </div>
+                    </div>
+                </div>
+            </div>
+            <div style="height: 45px;line-height: 45px;text-align: end;">
+                <el-button @click="handleClose">取消</el-button>
+                <el-button @click="addUsuallyApp" type="primary">确认</el-button>
+            </div>
+        </el-dialog>
     </div>
 </template>
 
 <script>
 import { mapGetters } from 'vuex';
 import store from '../store'
+import { API_CONFIG } from "@/common/apiConfig";
 
     export default {
-        props:['CocoFlowList'],
         computed: {
             ...mapGetters(['userinfo','fromL']),
               // 如果hk,com没有图标,默认使用cn的
@@ -111,30 +149,182 @@ import store from '../store'
                     }
                     return data
                 }
+            },
+            isAdd(){
+                return function(val){
+                    const difference = val.filter(item1 => 
+                        !this.CocoFlowList.some(item2 => item1.id === item2.id)
+                    );
+                    // console.log('difference',difference);
+                    
+                //    let data = val.filter(e=>{
+                //     return !this.CocoFlowList.includes(e.id) 
+                //    })
+                    return difference
+                }
             }
         },
         data() {
             return {
-              
+                dialogVisible:false, 
+                //常见ai应用列表
+                usuallyList:[], 
+                loading:false,
+                 //选中应用列表
+                tab:[],
+                // 已添加ai应用数组
+                CocoFlowList:[]
             }
         },
         methods: {
-            async openApp(val){
+            // 删除应用
+            delApp(val){
+                console.log(val);
+
+                let params = [
+                    {
+                        functionName: API_CONFIG.ajax_del_usuallyApp.functionName,
+                        aid: val, 
+                    },
+                ];
                 
+                this.$ajax
+                    .post(API_CONFIG.baseUrl, params)
+                    .then(() => {
+                        this.$message.success('删除成功')
+                        this.getData()
+                    })
+                    .catch((err) => {
+                        console.log(err);
+                        this.$message.error("删除失败");
+                    });
+                
+            },
+            handleClose(){
+                this.usuallyList= []
+                this.tab= []
+                this.dialogVisible = false
+            },
+            // 弹框选着添加应用
+            addApp(val){
+
+                let data = this.CocoFlowList.filter(e=>{
+                    return e.id == val 
+                })
+                if (data.length != 0) return this.$message.info('常用列表已添加')
+
+
+
+                const index = this.tab.indexOf(val);
+                if (index !== -1) {
+                    this.tab.splice(index, 1); // 删除第一个匹配项
+                } else {
+                    this.tab.push(val);    // 添加元素到末尾
+                }
+            },
+            // 打开常见应用弹框
+            openUsuallyApp(){
+                this.dialogVisible = true
+                this.loading = true
+                let params = [
+                    {
+                        functionName: API_CONFIG.ajax_usuallyApp.functionName,
+                        uid: this.userinfo.userid, 
+                        cn: this.userinfo.schoolArea ? this.userinfo.schoolArea : this.userinfo.orgArea, //学校id
+                    },
+                ];
+                
+                this.$ajax
+                    .post(API_CONFIG.baseUrl, params)
+                    .then((res) => {
+                        this.usuallyList = res.data[0]
+                        
+                       
+                        this.loading = false
+
+                    })
+                    .catch((err) => {
+                        console.log(err);
+                        this.loading = false
+                        this.$message.error("获取工具数据失败");
+                    });
+            },
+            // 添加常用确定按钮
+            async addUsuallyApp(){
+
+                const uploadYn = async files => {
+                    for (let index = 0; index < files.length; index++) {
+                        await this.XAdd(files[index]);
+                        console.log(index);
+                        
+                    }
+                }
+                await uploadYn(this.tab);
+                console.log('完成了');
+
+
+                this.getData()
+
+            },
+            XAdd(val){
+                return new Promise((resolve) => {
+                    let params = [
+                        {
+                            functionName: API_CONFIG.ajax_add_usuallyApp.functionName,
+                            oid:this.userinfo.organizeid,
+                            aid: val,
+                            uid: this.userinfo.userid,
+                        },
+                    ];
+                    
+                    this.$ajax
+                        .post(API_CONFIG.baseUrl, params)
+                        .then(() => {
+                            resolve(1)
+                        })
+                        .catch((err) => {
+                            console.log(err);
+                        });
+                    })
+            },
+
+            // 获取已添加cocoFlow应用
+            getData(){
+                let params = [
+                    {
+                        functionName: API_CONFIG.ajax_addedUsuallyApp.functionName,
+                        oid: this.userinfo.organizeid, 
+                    },
+                ];
+                
+                this.$ajax
+                    .post(API_CONFIG.baseUrl, params)
+                    .then((res) => {
+                        this.CocoFlowList = res.data[0]
+                    })
+                    .catch((err) => {
+                        console.log(err);
+                        this.$message.error("获取工具数据失败");
+                    });
+            },
+
+
+
+
+            // 打开平台应用
+            async openApp(val){
                 // 点击相同应用不刷新
                 if (this.appSign == val.toolId) return
                 // 更新标识
                 await store.commit('user/SET_AppSIGN', val.toolId)
                 
-                
                 let url = ''
                 val.url.forEach(e => {
-                    if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                     // if (e.region == this.userinfo.schoolArea || e.region == this.userinfo.orgArea) {
+                    if (e.region == "beta") {
                         url = e.url
                     }
                 });
-                console.log('url111111111111',url);
-                
 
                 let _userinfo = this.userinfo, //登录用户信息
                 { userid: _userid, organizeid: _oid, type: _type, org: _org, role: _role, classid: _classId } = _userinfo; // 解构赋值获取用户信息
@@ -186,6 +376,7 @@ import store from '../store'
                 // window.topU.U.MD.D.I.openApplicationWai(val.toolId, url, dom,val.argumentList)
                 
             },
+            // 打开CocoFlow应用
             openNewWindow(val) {
                 console.log(val);
                 
@@ -197,7 +388,64 @@ import store from '../store'
 </script>
 
 <style scoped>
+.moreDia >>> .el-dialog{
+    border-radius: 10px;
+}
+.moreDia >>> .el-dialog__body{
+    height: 345px;
+    /* overflow: auto; */
+    border-top: 1px #e7e7e7 solid;
+}
+.conBlock{
+    background-color: #fff;
+    padding: 24px;
+    box-sizing: border-box;
+    margin-bottom: 24px;
+    border-radius: 10px;
+}
+.tabCon{
+    transition: all 0.3s ease; /* 统一过渡效果 */
+    border-radius: 10px;
+    cursor: pointer;
+}
 
+.con{
+    flex: 1;
+    margin-left: 12px;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+}
+.tit{
+    color: #1f2937;font-size: 16px;height: 24px;line-height: 24px;
+    -webkit-line-clamp: 1;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+.bri{
+    color: #6b7280;font-size: 12px;height: 16px;line-height: 16px;
+    overflow: hidden;
+    -webkit-line-clamp: 1;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+.appImg{
+    width: 48px;
+    height: 48px;
+    border-radius: 50%;
+    object-fit: cover;
+}
+.AppList{
+    flex-wrap: wrap;display: flex;
+    justify-content: space-between;
+    border: 1px rgb(243 244 246 / var(--tw-border-opacity, 1)) solid;
+    border-radius: 10px;padding: 16px;box-sizing: border-box;
+    position: relative;
+}
 .footCon{
     display: flex;
     justify-content: space-between;
@@ -213,7 +461,7 @@ import store from '../store'
     justify-content: center;
     flex-direction: column;
     align-items: center;
-  
+    max-width: 187px;
 }
 .footListCon{
     background-color: #fff;
@@ -226,11 +474,18 @@ import store from '../store'
     background-image: radial-gradient(#E6F0FF 1px, transparent 1px);
     background-size: 20px 20px;
     cursor: pointer;
+    position: relative;
 }
 .footListCon:hover{
     transform: translateY(-5px); /* 向上位移 */
     box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
 }
+.cha{
+    display: none;position: absolute;top: 10px;right: 10px;
+}
+.footListCon:hover .cha{
+    display: block;
+}
 .footConLeft{
     padding: 25px;
     min-width: 50px;

+ 24 - 6
src/views/HomeView.vue

@@ -17,14 +17,21 @@
          <homepageL @AddAppJson="AddAppJson" :urlAddress.sync="urlAddress" v-show="!appSign" ref="homepageLRef"></homepageL>
 
          <!-- 应用  -->
-          <div  v-for="(item,index) in AppJSon" :key="index">
+          <div
+              v-for="(item,index) in AppJSon" :key="index">
             <div style="height: 100vh;" v-show="item.stateL">
               <div style="height: 100%;"  v-html="item.json"></div>
             </div>
           </div>
         
-         
-         <!-- <div style="height: 100%;" id="pageCon"></div> -->
+         <div v-if="loading" style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;background-color: #fff;
+              display: flex;justify-content: center;align-items: center;">
+          <div style="display: flex;flex-direction: column;align-items: center;">
+            <img style="height: 75px;transform: scale(2);" src="../assets/img/cocoloading.gif" alt="">
+            <div style="color: #0354D7;">拼命加载中...</div>
+          </div>  
+
+         </div>
       </div>
     </div>
   </div>
@@ -51,7 +58,8 @@ export default {
       toolList:[],
       form:{},
       urlAddress:'',
-      AppJSon:[]
+      AppJSon:[],
+      loading:false
     }
   },
   computed: {
@@ -63,7 +71,11 @@ export default {
     }),
     AddAppJson(val){
       console.log('val',val);
-     
+      this.loading = true
+
+      setTimeout(() => {
+        this.loading = false
+      }, 2000);
       
       let data = this.AppJSon.filter(e=>{
         return val.toolId == e.toolId
@@ -76,6 +88,8 @@ export default {
         })
 
         this.AppJSon.push(val)
+        
+        
       }else{
         this.AppJSon.forEach(e=>{
           if (val.toolId == e.toolId) {
@@ -240,16 +254,20 @@ export default {
   width: 100%;
   height: 100vh;
 }
+.container >>> .el-loading-mask{
+  z-index: 0;
+}
 .table-container {
   /* display: flex;
   flex: 1;
   justify-content: center; */
   width: 100%;
   background-color: #F9FAFB;
+  position: relative;
 }
 .leftBar{
   /* box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px 6px rgb(0 0 0 / 0.1); */
   /* overflow: visible;  */
-  z-index: 999999999999999;
+  z-index: 999;
 }
 </style>

+ 2 - 1
src/views/homepageL.vue

@@ -1,7 +1,7 @@
 <template>
     <div class="allPage">
         <div class="packageL">
-            <topPage @cutUrl="cutUrl"  :CocoFlowList="CocoFlowList" ref="topPageRef"></topPage>
+            <topPage @cutUrl="cutUrl" ref="topPageRef"></topPage>
             <div style="height: 30px;width: 100%;"></div>
             <botPage :hotApp="hotApp" ref="botPageRef"></botPage>
         </div>
@@ -34,6 +34,7 @@ import { API_CONFIG } from "@/common/apiConfig";
 
         methods: {
             getData(){
+                this.$refs.topPageRef.getData()
                 let params = [
                     {
                     functionName: API_CONFIG.ajax_allApp.functionName, // 调用存储过程的名称