11wqe1 1 month ago
parent
commit
b31398c603
2 changed files with 63 additions and 70 deletions
  1. 59 65
      src/components/topPage.vue
  2. 4 5
      src/mixins/mixin.js

+ 59 - 65
src/components/topPage.vue

@@ -89,7 +89,7 @@
 
                             <img
                             style="margin-bottom: 12px;height: 40px;width: 40px;object-fit: contain;"  
-                            v-else :src="JSON.parse(item.json).icon" alt="">
+                            v-else :src="item.json.icon" alt="">
                         </div>
                            
                             
@@ -120,7 +120,7 @@
                             <img v-if="fromL.admin.cocoFlow2[index].setIcon" 
                             class="footListConimgPic"
                             :src="fromL.admin.cocoFlow2[index].setIcon" alt="">
-                            <img v-else class="footListConimgPic" :src="JSON.parse(item.json).icon" alt="">
+                            <img v-else class="footListConimgPic" :src="item.json.icon" alt="">
                             
                             <!-- <img v-else class="footListConimgPic" :src="require('../assets/img/cocoflow2.svg')" alt=""> -->
                         </div>
@@ -305,40 +305,44 @@ import { myMixin } from "@/mixins/mixin.js"
             },
             // 获取cocoFlow2应用
             getData(){
-                let cocoFlowCopy = []
-                if (this.fromL.admin.cocoFlow2 && this.fromL.admin.cocoFlow2.length) {
-                    cocoFlowCopy = this.fromL.admin.cocoFlow2.map(item => item.id);
-                }else{
-                    return
-                }
-
 
-                    // let appList=[
-                    //     "4aed8607-19e1-11f0-a66a-005056924926",
-                    //     "337f9d06-1eb6-11f0-a66a-005056924926",
-                    //     "52b4aae8-088d-11f0-b508-005056924926",
-                    //     "5c95f692-1460-11f0-bad1-005056924926"
-                    // ]
-
-                    let params = [
-                        {
-                            functionName: API_CONFIG.ajax_AdminApp.functionName,
-                            con: cocoFlowCopy.join(','), 
-                        },
-                    ];
+                if (this.fromL.admin.cocoFlow2 && this.fromL.admin.cocoFlow2.length > 0) {
+                    this.CocoFlowList = this.fromL.admin.cocoFlow2
+                }
+                // let cocoFlowCopy = []
+                // if (this.fromL.admin.cocoFlow2 && this.fromL.admin.cocoFlow2.length) {
+                //     cocoFlowCopy = this.fromL.admin.cocoFlow2.map(item => item.id);
+                // }else{
+                //     return
+                // }
+
+
+                //     // let appList=[
+                //     //     "4aed8607-19e1-11f0-a66a-005056924926",
+                //     //     "337f9d06-1eb6-11f0-a66a-005056924926",
+                //     //     "52b4aae8-088d-11f0-b508-005056924926",
+                //     //     "5c95f692-1460-11f0-bad1-005056924926"
+                //     // ]
+
+                //     let params = [
+                //         {
+                //             functionName: API_CONFIG.ajax_AdminApp.functionName,
+                //             con: cocoFlowCopy.join(','), 
+                //         },
+                //     ];
                 
-                this.$ajax
-                    .post(API_CONFIG.baseUrl, params)
-                    .then((res) => {
-                        let _data = res.data[0];
-
-                        this.CocoFlowList = cocoFlowCopy.map(id => _data.find(item => item.id === id));
-
-                    })
-                    .catch((err) => {
-                        console.log(err);
-                        this.$message.error("获取工具数据失败");
-                    });
+                // this.$ajax
+                //     .post(API_CONFIG.baseUrl, params)
+                //     .then((res) => {
+                //         let _data = res.data[0];
+
+                //         this.CocoFlowList = cocoFlowCopy.map(id => _data.find(item => item.id === id));
+
+                //     })
+                //     .catch((err) => {
+                //         console.log(err);
+                //         this.$message.error("获取工具数据失败");
+                //     });
             },
             // 筛选可用平台工具,判断是否管理员可见,去除已删除工具
             siftCoco(){
@@ -369,12 +373,11 @@ import { myMixin } from "@/mixins/mixin.js"
             getAdmincocoFlow(){
                 // 筛选可用平台工具,判断是否管理员可见,去除已删除工具
                 this.siftCoco()
-                // console.log('getAdmincocoFlow',this.fromL);
 
-                let cocoFlowCopy = this.fromL.admin.cocoFlow.map(item => item.id);
-                console.log('cocoFlowCopy',cocoFlowCopy);
-                
-                let appList= [
+                if (this.fromL.admin.cocoFlow.length > 0) {
+                    this.admincocoFlow = JSON.parse(JSON.stringify(this.fromL.admin.cocoFlow))
+                } else {
+                    let appList= [
                         "d1edef14-ef6f-11ef-b508-005056924926",
                         "701615ab-ffe8-11ef-b508-005056924926",
                         "a8781a86-00d8-11f0-b508-005056924926",
@@ -384,34 +387,25 @@ import { myMixin } from "@/mixins/mixin.js"
                         "0d3d87bd-00b6-11f0-b508-005056924926",
                         "2d05a12a-f0e7-11ef-b508-005056924926",
                     ]
-                        
-                       
-
-                let params = [
-                    {
-                        functionName: API_CONFIG.ajax_AdminApp.functionName,
-                        con: cocoFlowCopy.length == 0 ? appList.join(',') : cocoFlowCopy.join(','), 
-                    },
-                ];
-                
-                this.$ajax
-                    .post(API_CONFIG.baseUrl, params)
-                    .then((res) => {
-                        let _data = res.data[0]
 
-                        if (cocoFlowCopy.length == 0) {
+                    let params = [
+                        {
+                            functionName: API_CONFIG.ajax_AdminApp.functionName,
+                            con: appList.join(',') 
+                        },
+                    ];
+                    
+                    this.$ajax
+                        .post(API_CONFIG.baseUrl, params)
+                        .then((res) => {
+                            let _data = res.data[0]
                             this.admincocoFlow = appList.map(id => _data.find(item => item.id === id));
-                        }else{
-                            this.admincocoFlow = cocoFlowCopy.map(id => _data.find(item => item.id === id));
-                        }
-
-
-
-                    })
-                    .catch((err) => {
-                        console.log(err);
-                        this.$message.error("获取工具数据失败");
-                    });
+                        })
+                        .catch((err) => {
+                            console.log(err);
+                            this.$message.error("获取工具数据失败");
+                        });
+                }
             },
 
             // 打开平台应用

+ 4 - 5
src/mixins/mixin.js

@@ -43,6 +43,8 @@ export const myMixin = {
       }
     },
     async addOp3(userTime, loadTime, object, status,account) {
+      if (!this.roleUser.userid) return
+
       try {
         if(!this.roleUser || !this.roleUser.accountNumber){
             let res = await this.$ajax.get('https://pbl.cocorobo.cn/api/pbl/selectUser', {
@@ -55,10 +57,7 @@ export const myMixin = {
       } catch (e) {
         console.log(e);
         return this.addOp3(userTime, loadTime, object, status);
-      }
-
-      console.log('777',this.roleUser);
-      
+      }  
 
       let _time = new Date()
         .toLocaleString("zh-CN", { hour12: false, timeZone: "Asia/Shanghai" })
@@ -77,7 +76,7 @@ export const myMixin = {
         object: JSON.stringify(object), //执行信息传json
         status: status //成功返回success。失败返回error的信息
       };
-      console.log('params',params);
+      console.log('...',params);
       
 
       this.$ajax