Browse Source

应用中心控制

SanHQin 3 weeks ago
parent
commit
3a1caee968
1 changed files with 116 additions and 65 deletions
  1. 116 65
      src/components/pages/appStore/views/appManagement.vue

+ 116 - 65
src/components/pages/appStore/views/appManagement.vue

@@ -72,8 +72,8 @@
           @click="addApp"
           >添加应用</el-button
         >
-        <div class="ac_h_banner" v-if="bannerObj">
-          <img :src="bannerObj.poster" alt="banner图" />
+        <div class="ac_h_banner" v-if="controlsObj && controlsObj.bannerUrl">
+          <img :src="controlsObj.bannerUrl" alt="banner图" />
         </div>
         <div class="ac_h_bottom">
           <div class="ac_h_b_typeList">
@@ -785,6 +785,7 @@ export default {
       editAppCard: null,
       bannerObj: null,
       userName: null,
+      controlsObj: null
       // region:this.$route.query["region"]
     };
   },
@@ -803,10 +804,10 @@ export default {
         return _result;
       };
     },
-    region(){
+    region() {
       let _result = "cn";
-      let query = this.$route.query["region"]
-      if(query && (query == "cn" || query == "hk" || query == "all")){
+      let query = this.$route.query["region"];
+      if (query && (query == "cn" || query == "hk" || query == "all")) {
         _result = query;
       }
       return _result;
@@ -841,12 +842,13 @@ export default {
         label: this.selectLabel, //应用的标签搜索
         type: this.showType, //应用的类型
         juri: this.selectJuri, //应用权限 1:我的  2:组织内  3:所有人
-        stand: this.region?this.region:'cn', //cn站还是hk站
-        status: this.statusType
+        stand: this.region ? this.region : "cn", //cn站还是hk站
+        status: this.statusType,
+        exportType:(this.controlsObj&&this.controlsObj.exportTypeList&&this.controlsObj.exportTypeList.length>0)?this.controlsObj.exportTypeList.join(','):"",
       };
 
       this.ajax
-        .get(this.$store.state.api + "select_appStore", params)
+        .get(this.$store.state.api + "select_appStore_exportType", params)
         .then(res => {
           this.getDataLoading = false;
           let _data = res.data[0];
@@ -921,14 +923,14 @@ export default {
       })
         .then(async e => {
           let _status = await this.copyAgentOrWorkflow(item);
-          if(_status==1){
+          if (_status == 1) {
             this.$message.success("复制成功,已添加至我的工作流列表。");
-          }else if(_status==2){
+          } else if (_status == 2) {
             this.$message.success("复制成功,已添加至我的智能体列表。");
-          }else if(_status==3){
-            this.$message.error("复制失败,该应用无内容")
-          }else if(_status==0){
-            this.$message.error("复制失败")
+          } else if (_status == 3) {
+            this.$message.error("复制失败,该应用无内容");
+          } else if (_status == 0) {
+            this.$message.error("复制失败");
           }
           // console.log(item);
           // let url = item.url;
@@ -1005,19 +1007,20 @@ export default {
         let id =
           this.queryURLParams(url, "id") ||
           item.url.split("/")[item.url.split("/").length - 1];
-        if (!id){
-          console.log("该链接无对应id")
+        if (!id) {
+          console.log("该链接无对应id");
           return resolve(3);
           // return this.$message.error("复制失败,未找到对应id")
-        };
-        console.log(item)
-        if (item.label == "workflow") {//复制工作流
-          console.log("复制工作流")
+        }
+        console.log(item);
+        if (item.label == "workflow") {
+          //复制工作流
+          console.log("复制工作流");
           this.ajax
             .get(`https://appapi.cocorobo.cn/api/agents/muti_agent/${id}`)
             .then(async res => {
               let _data = res.data;
-              console.log(_data)
+              console.log(_data);
               let _idList = [];
               if (_data["dialoguePublishDataId"])
                 _idList.push(_data["dialoguePublishDataId"]);
@@ -1030,40 +1033,54 @@ export default {
                 return console.log("该应用无id");
               }
               // /api/agents/copy_mutiAgent
-              this.ajax.post('https://appapi.cocorobo.cn/api/agents/copy_mutiAgent',{
-                ids: _idList,
-                userId: this.userId,
-                username: this.userName?this.userName:await this.getUserName(this.userId),
-              }).then(_=>{
-                resolve(1);
-              }).catch(e=>{
-                console.log(e)
-                resolve(0)
-              })
+              this.ajax
+                .post("https://appapi.cocorobo.cn/api/agents/copy_mutiAgent", {
+                  ids: _idList,
+                  userId: this.userId,
+                  username: this.userName
+                    ? this.userName
+                    : await this.getUserName(this.userId)
+                })
+                .then(_ => {
+                  resolve(1);
+                })
+                .catch(e => {
+                  console.log(e);
+                  resolve(0);
+                });
+            });
+        } else if (item.label == "agent") {
+          //复制智能体
+          console.log("复制智能体");
+          this.ajax
+            .get(`https://appapi.cocorobo.cn/api/agents/agent/parent/${id}`)
+            .then(async res => {
+              let _id = res.data.id;
+              if (_id) {
+                let _idList = [_id];
+                this.ajax
+                  .post("https://appapi.cocorobo.cn/api/agents/copy_agent", {
+                    ids: _idList,
+                    userId: this.userId,
+                    username: this.userName
+                      ? this.userName
+                      : await this.getUserName(this.userId)
+                  })
+                  .then(_ => {
+                    resolve(2);
+                  })
+                  .catch(e => {
+                    console.log(e);
+                    resolve(0);
+                  });
+              }
+              console.log(res);
+            })
+            .catch(e => {
+              console.log(e);
+              resolve(0);
+              // this.$message.error("")
             });
-        } else if (item.label == "agent") {//复制智能体
-          console.log("复制智能体")
-          this.ajax.get(`https://appapi.cocorobo.cn/api/agents/agent/parent/${id}`).then(async res=>{
-            let _id = res.data.id;
-            if(_id){
-              let _idList = [_id];
-              this.ajax.post('https://appapi.cocorobo.cn/api/agents/copy_agent',{
-                ids: _idList,
-                userId: this.userId,
-                username: this.userName?this.userName:await this.getUserName(this.userId),
-              }).then(_=>{
-                resolve(2);
-              }).catch(e=>{
-                console.log(e)
-                resolve(0)
-              })
-            }
-            console.log(res)
-          }).catch(e=>{
-            console.log(e);
-            resolve(0)
-            // this.$message.error("")
-          })
           // let _idList = [id];
           // this.ajax.post('https://appapi.cocorobo.cn/api/agents/copy_agent',{
           //   ids: _idList,
@@ -1125,7 +1142,7 @@ export default {
             url: data.url, //app链接
             type: data.type, //app类型
             juri: data.juri, //app权限 1:我的 2:组织 3:所有人
-            stand: this.region?this.region:'cn', //语言
+            stand: this.region ? this.region : "cn", //语言
             json: JSON.stringify(data.json) //其他信息
           }
         ];
@@ -1156,7 +1173,7 @@ export default {
             url: data.url, //app链接
             type: data.type, //app类型
             juri: data.juri, //app权限 1:我的 2:组织 3:所有人
-            stand: this.region?this.region:'cn', //语言
+            stand: this.region ? this.region : "cn", //语言
             json: JSON.stringify(data.json) //其他信息
           }
         ];
@@ -1190,7 +1207,7 @@ export default {
           url: data.url, //app链接
           type: data.type, //app类型
           juri: data.juri, //app权限 1:我的 2:组织 3:所有人
-          stand: this.region?this.region:'cn', //语言
+          stand: this.region ? this.region : "cn", //语言
           json: JSON.stringify(data.json) //其他信息
         }
       ];
@@ -1216,11 +1233,12 @@ export default {
         suserid: this.userId, //用户ID
         sorg: this.org,
         soid: this.oid,
-        sstand: this.region?this.region:'cn'
+        sstand: this.region ? this.region : "cn",
+        exportType:(this.controlsObj&&this.controlsObj.exportTypeList&&this.controlsObj.exportTypeList.length>0)?this.controlsObj.exportTypeList.join(','):"",
       };
 
       this.ajax
-        .get(this.$store.state.api + "select_appStoreType", params)
+        .get(this.$store.state.api + "select_appStoreType_exceptType", params)
         .then(res => {
           let data = res.data[0];
           if (data.length > 0) {
@@ -1244,7 +1262,7 @@ export default {
         type === 0
       ) {
         await this.insertSave(item, 1);
-        this.getRecentUse()
+        this.getRecentUse();
       }
     },
 
@@ -1551,14 +1569,47 @@ export default {
             console.error(err);
           });
       });
+    },
+    async getAppStoreControl() {
+      return new Promise(resolve => {
+        let params = {
+          uid: this.userId,
+          org: this.org,
+          oid: this.oid
+        };
+
+        let controlsObj = {
+          logoUrl: "",
+          bannerUrl:"https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/default%2FFrame+30141733970358224.svg",
+          exportTypeList: []
+        };
+        this.ajax
+          .get(this.$store.state.api + "select_appStore_controls", params)
+          .then(res => {
+            let _data = res.data[0];
+            if (_data[0]) {
+              console.log(_data[0])
+              controlsObj = JSON.parse(_data[0].json);
+            }
+            this.controlsObj = controlsObj;
+            resolve();
+          })
+          .catch(err => {
+            console.log(err)
+            this.controlsObj = controlsObj;
+            resolve();
+          });
+      });
     }
   },
   mounted() {
-    this.getTypeList();
-    this.getData();
-    this.getCollect();
-    this.getRecentUse();
-    this.getBanner();
+    this.getAppStoreControl().then(_=>{
+      this.getTypeList();
+      this.getData();
+      this.getCollect();
+      this.getRecentUse();
+      // this.getBanner();
+    })
   }
 };
 </script>