Browse Source

修改一件诊断

armg 6 days ago
parent
commit
c3153f9382

+ 12 - 0
src/api/indexAI.js

@@ -277,4 +277,16 @@ export function diagUpdateReadState(query) {
         method: 'post',
         method: 'post',
         data: query
         data: query
     })
     })
+}
+
+// 获取ticket
+export function wecomTicket(query) {
+    const auth = getAuthCredentials();
+    query.append('loginMark', auth.loginMark);
+    query.append('token', auth.token);
+    return request({
+        url: '/aidesign/wecom/ticket',
+        method: 'post',
+        data: query
+    })
 }
 }

+ 82 - 0
src/utils/index.ts

@@ -1,4 +1,6 @@
 import router from "../router";
 import router from "../router";
+import { wecomTicket } from "../api/indexAI";
+declare let wx: any;
 export const dateFormat = (fmt: string, x: Date | string) => {
 export const dateFormat = (fmt: string, x: Date | string) => {
   const date = typeof x === "string" ? new Date(x) : x;
   const date = typeof x === "string" ? new Date(x) : x;
   let ret;
   let ret;
@@ -70,3 +72,83 @@ export const toLBHome = () => {
   router.replace('/');
   router.replace('/');
 }
 }
 
 
+export const toXiaoChengxu = (appid) => {
+  let url = window.location.href.split("#")[0];
+  wx.ready(function () {
+    wx.checkJsApi({
+      jsApiList: ["agentConfig", "launchMiniprogram"], // 需要检测的JS接口列表
+      success: function (res) {
+        const formData = new FormData();
+        formData.append('url', url);
+        formData.append('agent', '1');
+        wecomTicket(formData).then(response => {
+          if (response.status == 200) {
+            let yingyongData = response.Data;
+            wx.agentConfig({
+              corpid: yingyongData.appid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+              agentid: process.env.VUE_APP_AGENTID, // 必填,企业微信的应用id (e.g. 1000247)
+              timestamp: yingyongData.timestamp, // 必填,生成签名的时间戳
+              nonceStr: yingyongData.noncestr, // 必填,生成签名的随机串
+              signature: yingyongData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+              jsApiList: ["launchMiniprogram"], //必填,传入需要使用的接口名称
+              success: function (res) {
+                wx.invoke(
+                  "launchMiniprogram",
+                  {
+                    appid: appid, // 需跳转的小程序appid
+                    path: "" // 所需跳转的小程序内页面路径及参数。非必填
+                  },
+                  function (res) {
+                    if (res.err_msg == "launchMiniprogram:ok") {
+                      // 正常
+                      console.log("正常");
+                    } else {
+                      // 错误处理
+                    }
+                  }
+                );
+              },
+              fail: function (res) {
+                if (res.errMsg.indexOf("function not exist") > -1) {
+                  alert("版本过低请升级");
+                }
+              }
+            });
+          }
+        });
+      }
+    });
+  });
+}
+
+// 获取微信API授权信息
+export const getWxconfig = () => {
+  const jsApiList = ['getSetting', 'authorize', 'showModal', 'openSetting', 'downloadFile', 'saveImageToPhotosAlbum'];
+  let url = window.location.href.split("#")[0];
+  const formData = new FormData();
+  formData.append('url', url);
+  formData.append('agent', '1');
+  wecomTicket(formData).then(response => {
+    if (response.status == 200) {
+      let qiyeData = response.Data;
+      wx.agentConfig({
+        debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+        corpid: qiyeData.appid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+        agentid: process.env.VUE_APP_AGENTID, // 必填,企业微信的应用id (e.g. 1000247)
+        timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
+        nonceStr: qiyeData.noncestr, // 必填,生成签名的随机串
+        signature: qiyeData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+        jsApiList: [...jsApiList], //必填,传入需要使用的接口名称
+        success: function (res) {
+          console.log('获取签名成功');
+        },
+        fail: function (res) {
+          console.log(res);
+          if (res.errMsg.indexOf('function not exist') > -1) {
+            alert('版本过低请升级');
+          }
+        },
+      });
+    }
+  });
+}

+ 10 - 10
src/utils/magnetLogAdd.js

@@ -36,17 +36,17 @@ magnetLogAdd.setLog = (magnetName,callback) => {
         magnetName: magnetName
         magnetName: magnetName
     };
     };
     if(agentFrom == 'stoneLikePaint' || agentFrom == 'goldShop'){
     if(agentFrom == 'stoneLikePaint' || agentFrom == 'goldShop'){
-        // let loginTypeList = userInfo.loginTypeList?userInfo.loginTypeList:[];
-        // let shopList = [];
-        // loginTypeList.forEach(function (item) {
-        //     if (item.shopType == agentFrom) {
-        //         shopList = item.shopList;
-        //         return
-        //     }
-        // });
-        // obj.level = shopList.length>0?shopList[0].sales_level:''
+        let loginTypeList = userInfo.loginTypeList?userInfo.loginTypeList:[];
+        let shopList = [];
+        loginTypeList.forEach(function (item) {
+            if (item.shopType == agentFrom) {
+                shopList = item.shopList;
+                return
+            }
+        });
+        obj.level = shopList.length>0?shopList[0].sales_level:''
     };
     };
-    // axios.post(`${process.env.VUE_APP_BASE_API}/wxportal/magnetLogAdd`,obj,{timeout:5000}).finally(callback);
+    axios.post(`${process.env.VUE_APP_BASE_API}/wxportal/magnetLogAdd`,obj,{timeout:5000}).finally(callback);
 }
 }
 
 
 export default magnetLogAdd;
 export default magnetLogAdd;

+ 2 - 54
src/views/AIDesign/design.vue

@@ -347,7 +347,7 @@ import { Component, Vue } from "vue-property-decorator";
 import { CreateDesign, GetEntity, GetReadState, UpdateReadState, GetProjectlist, GetDictList } from "@/api/indexAI";
 import { CreateDesign, GetEntity, GetReadState, UpdateReadState, GetProjectlist, GetDictList } from "@/api/indexAI";
 import { ImagePreview, Popover } from 'vant';
 import { ImagePreview, Popover } from 'vant';
 import { Dialog } from 'vant';
 import { Dialog } from 'vant';
-import { getWecomType , toLBHome } from '@/utils/index';
+import { getWecomType , toLBHome ,toXiaoChengxu } from '@/utils/index';
 declare let wx: any;
 declare let wx: any;
 import axios from "axios";
 import axios from "axios";
 
 
@@ -983,7 +983,7 @@ export default class extends Vue {
 
 
   //跳转小程序
   //跳转小程序
   private toXiaoCX() {
   private toXiaoCX() {
-    this.toXiaoChengxu(`${process.env.VUE_APP_BASE_DISID6}`);
+    toXiaoChengxu(`${process.env.VUE_APP_BASE_DISID6}`);
   }
   }
 
 
   //跳转项目报备链接
   //跳转项目报备链接
@@ -1073,58 +1073,6 @@ export default class extends Vue {
     that.projectActionListShow = false;
     that.projectActionListShow = false;
     // }
     // }
   }
   }
-
-  //跳转微信小程序
-  toXiaoChengxu(appid) {
-    let url = window.location.href.split("#")[0];
-    wx.ready(function () {
-      wx.checkJsApi({
-        jsApiList: ["agentConfig", "launchMiniprogram"], // 需要检测的JS接口列表
-        success: function (res) {
-          axios.get(`${process.env.VUE_APP_BASE_API}wx/ticket`, {
-            params: {
-              url: url,
-              agent: 1
-            }
-          }).then(response => {
-            if (response.status == 200) {
-              let yingyongData = response.data.data;
-              wx.agentConfig({
-                corpid: yingyongData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-                agentid: yingyongData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-                timestamp: yingyongData.timestamp, // 必填,生成签名的时间戳
-                nonceStr: yingyongData.nonceStr, // 必填,生成签名的随机串
-                signature: yingyongData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-                jsApiList: ["launchMiniprogram"], //必填,传入需要使用的接口名称
-                success: function (res) {
-                  wx.invoke(
-                    "launchMiniprogram",
-                    {
-                      appid: appid, // 需跳转的小程序appid
-                      path: "" // 所需跳转的小程序内页面路径及参数。非必填
-                    },
-                    function (res) {
-                      if (res.err_msg == "launchMiniprogram:ok") {
-                        // 正常
-                        console.log("正常");
-                      } else {
-                        // 错误处理
-                      }
-                    }
-                  );
-                },
-                fail: function (res) {
-                  if (res.errMsg.indexOf("function not exist") > -1) {
-                    alert("版本过低请升级");
-                  }
-                }
-              });
-            }
-          });
-        }
-      });
-    });
-  }
 }
 }
 </script>
 </script>
 <style>
 <style>

+ 4 - 4
src/views/AIDesign/diagnose.vue

@@ -188,10 +188,10 @@ export default class extends Vue {
         // }
         // }
         // // 用户企微ID
         // // 用户企微ID
         // formData.append('WXuserid', userInfo.loginName);
         // formData.append('WXuserid', userInfo.loginName);
-        // // 企微类型
-        // const agentFrom = window.localStorage.getItem('agentFromAI');
-        // const wecomType = getWecomType(agentFrom);
-        // formData.append('wecomType', 5);
+        // 企微类型
+        const agentFrom = window.localStorage.getItem('agentFromAI');
+        const wecomType = getWecomType(agentFrom);
+        formData.append('wecomType', 5);
         // // 服务商代码
         // // 服务商代码
         // if (serviceCodeArray.length > 0) {
         // if (serviceCodeArray.length > 0) {
         //     formData.append('serivceCode', serviceCodeArray.join(','));
         //     formData.append('serivceCode', serviceCodeArray.join(','));

+ 14 - 43
src/views/AIDesign/diagnoseResult.vue

@@ -24,9 +24,9 @@
                         <img src="../../assets/AIDesign/diagnoseTit.png" class="diagnoseTitBg">
                         <img src="../../assets/AIDesign/diagnoseTit.png" class="diagnoseTitBg">
                         <!-- <van-image class="diagnosis-image" :src="UserFilePathUrl" fit="contain" v-if="UserFilePathUrl"
                         <!-- <van-image class="diagnosis-image" :src="UserFilePathUrl" fit="contain" v-if="UserFilePathUrl"
                             placeholder="加载中..." @click="imgClick(UserFilePathUrl)" id="diagnoseResultImg" /> -->
                             placeholder="加载中..." @click="imgClick(UserFilePathUrl)" id="diagnoseResultImg" /> -->
-                            <img class="diagnosis-image"  :src="UserFilePathUrl" v-show="UserFilePathUrl"
-                             @click="imgClick(UserFilePathUrl)"  style="object-fit: contain;"/>
-                              
+                        <img class="diagnosis-image" :src="UserFilePathUrl" v-show="UserFilePathUrl"
+                            @click="imgClick(UserFilePathUrl)" style="object-fit: contain;" />
+
                         <p v-show="!apiLoading && StateCode == 2">该建筑的墙面诊断报告如下,长按可保存分享</p>
                         <p v-show="!apiLoading && StateCode == 2">该建筑的墙面诊断报告如下,长按可保存分享</p>
                     </div>
                     </div>
                     <div class="diagnosis-content" v-if="!apiLoading && wallInfo && wallInfo.wallFinishing">
                     <div class="diagnosis-content" v-if="!apiLoading && wallInfo && wallInfo.wallFinishing">
@@ -184,6 +184,7 @@ import { Component, Vue, Ref, Watch } from 'vue-property-decorator';
 import html2canvas from 'html2canvas';
 import html2canvas from 'html2canvas';
 import { NavBar, Button, Image, Loading, Empty, Toast, ImagePreview } from 'vant';
 import { NavBar, Button, Image, Loading, Empty, Toast, ImagePreview } from 'vant';
 import { diagGetEntity, diagGetReadState, diagUpdateReadState } from "@/api/indexAI";
 import { diagGetEntity, diagGetReadState, diagUpdateReadState } from "@/api/indexAI";
+import { getWxconfig } from '@/utils/index';
 import axios from "axios";
 import axios from "axios";
 declare let wx: any;
 declare let wx: any;
 @Component({
 @Component({
@@ -241,7 +242,7 @@ export default class DiagnosisPage extends Vue {
     // }
     // }
     // 页面挂载时请求数据
     // 页面挂载时请求数据
     created() {
     created() {
-        this.getWxconfig();
+        getWxconfig();
     }
     }
     activated() {
     activated() {
         // 初始化数据
         // 初始化数据
@@ -288,7 +289,7 @@ export default class DiagnosisPage extends Vue {
             if (response.StatusCode == 200) {
             if (response.StatusCode == 200) {
                 if (response.Data == null) {
                 if (response.Data == null) {
                     that.isLoading = false;
                     that.isLoading = false;
-                    that.apiLoading= false;
+                    that.apiLoading = false;
                     that.regenerateDisable = true;
                     that.regenerateDisable = true;
                     that.StateCode = 1;
                     that.StateCode = 1;
                     if (that.timer) {
                     if (that.timer) {
@@ -344,7 +345,7 @@ export default class DiagnosisPage extends Vue {
             } else {
             } else {
                 this.$toast.fail(response.Info);
                 this.$toast.fail(response.Info);
                 that.isLoading = false;
                 that.isLoading = false;
-                that.apiLoading= false;
+                that.apiLoading = false;
             }
             }
         })
         })
     }
     }
@@ -387,7 +388,7 @@ export default class DiagnosisPage extends Vue {
                         that.wallInfo = response.Data.WallRepairAnalysis || '';
                         that.wallInfo = response.Data.WallRepairAnalysis || '';
                     }
                     }
                     // that.isLoading = false;
                     // that.isLoading = false;
-                    that.apiLoading= false;
+                    that.apiLoading = false;
                     sessionStorage.removeItem("diagnoseSelectedImage");
                     sessionStorage.removeItem("diagnoseSelectedImage");
                     // 生成图片
                     // 生成图片
                     that.longPressTimer = setTimeout(() => {
                     that.longPressTimer = setTimeout(() => {
@@ -406,7 +407,7 @@ export default class DiagnosisPage extends Vue {
                 }
                 }
             } else {
             } else {
                 that.isLoading = false;
                 that.isLoading = false;
-                that.apiLoading= false;
+                that.apiLoading = false;
                 this.$toast.fail(response.Info);
                 this.$toast.fail(response.Info);
             }
             }
         })
         })
@@ -415,39 +416,6 @@ export default class DiagnosisPage extends Vue {
     imgClick(url) {
     imgClick(url) {
         ImagePreview([url]);
         ImagePreview([url]);
     }
     }
-    // 获取微信API授权信息
-    getWxconfig() {
-        const jsApiList = ['getSetting', 'authorize', 'showModal', 'openSetting', 'downloadFile', 'saveImageToPhotosAlbum'];
-        let url = window.location.href.split("#")[0];
-        axios.get(`${process.env.VUE_APP_BASE_API}wx/ticket`, {
-            params: {
-                url: url,
-                agent: 1
-            }
-        }).then(response => {
-            if (response.status == 200) {
-                let qiyeData = response.data.data;
-                wx.agentConfig({
-                    debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-                    corpid: qiyeData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-                    agentid: qiyeData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-                    timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
-                    nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
-                    signature: qiyeData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-                    jsApiList: [...jsApiList], //必填,传入需要使用的接口名称
-                    success: function (res) {
-                        console.log('获取签名成功');
-                    },
-                    fail: function (res) {
-                        console.log(res);
-                        if (res.errMsg.indexOf('function not exist') > -1) {
-                            alert('版本过低请升级');
-                        }
-                    },
-                });
-            }
-        });
-    }
 
 
     GetReadStateFn() {
     GetReadStateFn() {
         const formData = new FormData();
         const formData = new FormData();
@@ -614,6 +582,7 @@ export default class DiagnosisPage extends Vue {
             height: 100%;
             height: 100%;
             z-index: 2;
             z-index: 2;
             opacity: 0;
             opacity: 0;
+
             img {
             img {
                 width: 100%;
                 width: 100%;
                 height: 100%;
                 height: 100%;
@@ -642,13 +611,15 @@ export default class DiagnosisPage extends Vue {
             display: flex;
             display: flex;
             flex-direction: column;
             flex-direction: column;
             align-items: center;
             align-items: center;
-            img{
+
+            img {
                 display: block;
                 display: block;
             }
             }
+
             .diagnoseTitBg {
             .diagnoseTitBg {
                 width: 228px;
                 width: 228px;
                 height: auto;
                 height: auto;
-                margin:0 auto 15px;
+                margin: 0 auto 15px;
 
 
             }
             }
 
 

+ 11 - 91
src/views/AIDesign/result.vue

@@ -63,6 +63,10 @@
           <van-icon class="icon" name="user-o" />
           <van-icon class="icon" name="user-o" />
           <span class="text">转人工设计(原别墅之星小程序)</span>
           <span class="text">转人工设计(原别墅之星小程序)</span>
         </button>
         </button>
+         <!-- <button class="action-button" @click="manualDesign">
+          <van-icon class="icon" name="user-o" />
+          <span class="text">测试跳转小程序</span>
+        </button> -->
       </div>
       </div>
     </div>
     </div>
 
 
@@ -71,8 +75,8 @@
 <script lang="ts">
 <script lang="ts">
 import { ImagePreview, Dialog } from 'vant';
 import { ImagePreview, Dialog } from 'vant';
 import { Component, Vue } from "vue-property-decorator";
 import { Component, Vue } from "vue-property-decorator";
-import { GetEntity, GetReadState, UpdateReadState, insideGetEntity, insideGetReadState, insideUpdateReadState, GetProjectlist, GetDictList } from "@/api/indexAI";
-import { getWecomType ,toLBHome } from '@/utils/index';
+import { GetEntity, GetReadState, UpdateReadState, insideGetEntity, insideGetReadState, insideUpdateReadState, GetProjectlist, GetDictList, wecomTicket } from "@/api/indexAI";
+import { getWecomType, toLBHome, toXiaoChengxu ,getWxconfig } from '@/utils/index';
 import axios from "axios";
 import axios from "axios";
 declare let wx: any;
 declare let wx: any;
 @Component
 @Component
@@ -120,7 +124,7 @@ export default class extends Vue {
   private projectDisableFlag = true;//转人工不可点击
   private projectDisableFlag = true;//转人工不可点击
   private serviceCodeArray = [];
   private serviceCodeArray = [];
   created() {
   created() {
-    this.getWxconfig();
+    getWxconfig();
     // this.getServiceCode();
     // this.getServiceCode();
   }
   }
 
 
@@ -374,39 +378,6 @@ export default class extends Vue {
       }
       }
     })
     })
   }
   }
-  // 获取微信API授权信息
-  getWxconfig() {
-    const jsApiList = ['getSetting', 'authorize', 'showModal', 'openSetting', 'downloadFile', 'saveImageToPhotosAlbum'];
-    let url = window.location.href.split("#")[0];
-    axios.get(`${process.env.VUE_APP_BASE_API}wx/ticket`, {
-      params: {
-        url: url,
-        agent: 1
-      }
-    }).then(response => {
-      if (response.status == 200) {
-        let qiyeData = response.data.data;
-        wx.agentConfig({
-          debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-          corpid: qiyeData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-          agentid: qiyeData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-          timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
-          nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
-          signature: qiyeData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-          jsApiList: [...jsApiList], //必填,传入需要使用的接口名称
-          success: function (res) {
-            console.log('获取签名成功');
-          },
-          fail: function (res) {
-            console.log(res);
-            if (res.errMsg.indexOf('function not exist') > -1) {
-              alert('版本过低请升级');
-            }
-          },
-        });
-      }
-    });
-  }
   // 点击保存图片按钮
   // 点击保存图片按钮
   saveImageToAlbum() {
   saveImageToAlbum() {
     const that = this;
     const that = this;
@@ -562,63 +533,12 @@ export default class extends Vue {
 
 
   private manualDesign(): void {
   private manualDesign(): void {
     let that = this;
     let that = this;
-    debugger
+    // debugger
     // console.log('转人工设计');
     // console.log('转人工设计');
     // 实现转人工设计逻辑
     // 实现转人工设计逻辑
-    that.$magnetlogadd.setLog('AI外墙设计-转人工设计', function () {
-      that.toXiaoChengxu(`${process.env.VUE_APP_BASE_DISID6}`);
-    })
-  }
-  //跳转微信小程序
-  toXiaoChengxu(appid) {
-    let url = window.location.href.split("#")[0];
-    wx.ready(function () {
-      wx.checkJsApi({
-        jsApiList: ["agentConfig", "launchMiniprogram"], // 需要检测的JS接口列表
-        success: function (res) {
-          axios.get(`${process.env.VUE_APP_BASE_API}wx/ticket`, {
-            params: {
-              url: url,
-              agent: 1
-            }
-          }).then(response => {
-            if (response.status == 200) {
-              let yingyongData = response.data.data;
-              wx.agentConfig({
-                corpid: yingyongData.appId, // 必填,企业微信的corpid,必须与当前登录的企业一致
-                agentid: yingyongData.agentId, // 必填,企业微信的应用id (e.g. 1000247)
-                timestamp: yingyongData.timestamp, // 必填,生成签名的时间戳
-                nonceStr: yingyongData.nonceStr, // 必填,生成签名的随机串
-                signature: yingyongData.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-                jsApiList: ["launchMiniprogram"], //必填,传入需要使用的接口名称
-                success: function (res) {
-                  wx.invoke(
-                    "launchMiniprogram",
-                    {
-                      appid: appid, // 需跳转的小程序appid
-                      path: "" // 所需跳转的小程序内页面路径及参数。非必填
-                    },
-                    function (res) {
-                      if (res.err_msg == "launchMiniprogram:ok") {
-                        // 正常
-                        console.log("正常");
-                      } else {
-                        // 错误处理
-                      }
-                    }
-                  );
-                },
-                fail: function (res) {
-                  if (res.errMsg.indexOf("function not exist") > -1) {
-                    alert("版本过低请升级");
-                  }
-                }
-              });
-            }
-          });
-        }
-      });
-    });
+    // that.$magnetlogadd.setLog('AI外墙设计-转人工设计', function () {
+    that.toXiaoChengxu(`${process.env.VUE_APP_BASE_DISID6}`);
+    // })
   }
   }
 }
 }
 </script>
 </script>