Explorar el Código

提交相关代码

Lijy hace 4 meses
padre
commit
daf4433ee4

+ 76 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/App.vue

@@ -13,7 +13,83 @@
 <style scoped></style>
 <script setup>
 import {useTheme} from "@hooks/useTheme.js";
+import { useLifecycle } from "@hooks/useCommon.js";
 import {ref} from "vue";
+import requests from "@common/requests"
 
 let themeVars = ref(useTheme());
+
+function obtainEnterpriseWeChatParameters(data = {}) {
+  const token = data.id
+  // const curUrl = window.location.href.split('home')[0]
+  const curUrl = window.location.href
+  requests.post('/wxcorp/getCorpWXConfig', { url: curUrl, token }).then((res) => {
+    wx.config({
+      beta: true,
+      debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+      appId: res.data.appid, // 必填,公众号的唯一标识 
+      timestamp: res.data.timestamp, // 必填,生成签名的时间戳 
+      nonceStr: res.data.noncestr, // 必填,生成签名的随机串 
+      signature: res.data.sign, // 必填,签名,见附录1 
+      jsApiList: ['chooseImage', 'previewImage', 'uploadImage', 'downloadImage', 'previewFile', 'getLocation', 'agentConfig']
+    })
+
+    wx.ready(function () {
+      // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
+      requests.post('/wxcorp/getCorpWXAgentConfig', { url: curUrl, token }).then((res) => {
+        console.log(res, '<====== 返回的参数 /wxcorp/getCorpWXAgentConfig')
+        wx.agentConfig({
+          corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+          agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
+          timestamp: res.data.timestamp, // 必填,生成签名的时间戳
+          nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
+          signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+          jsApiList: ['selectExternalContact', 'openThirdAppServiceChat', 'openAppManage'], //必填,传入需要使用的接口名称
+          success: function (result) {
+            //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+            window.WWOpenData.bind(document.querySelector('ww-open-data'))
+          },
+          fail: function (res) {
+            if (res.errMsg.indexOf('function not exist') > -1) {
+              alert('版本过低请升级')
+            }
+          },
+        })
+      }).catch(err => {
+        if (err.errMsg.indexOf('function not exist') > -1) {
+          alert('版本过低请升级')
+        }
+      })
+    })
+    wx.error(function (res) {
+      // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
+      // alert('wxConfig发生异常:'+JSON.stringify(res));
+      // 企业第一次授权安装进入后会报not in reliable domain的错误,刷新后正常
+      // location.reload();
+    });
+  }).catch(err => {
+    alert(err);
+  })
+}
+
+useLifecycle({
+  load: () => {
+
+  },
+  init: () => {
+    const currentEnvironment = navigator.userAgent.toLowerCase();
+    const isCorpWX = currentEnvironment.indexOf("wxwork") > 0 ? true : false
+    const token = sessionStorage.getItem('token')
+
+    if(isCorpWX && token) {
+        console.log('企业微信转译执行')
+        setTimeout(() => {
+            const userInfo = JSON.parse(sessionStorage.getItem('userInfo'))
+            console.log(userInfo, '<====== userInfo')
+            obtainEnterpriseWeChatParameters(userInfo.userInfo)
+        }, 500)
+    }
+  }
+});
+
 </script>

+ 12 - 7
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/components/common/translationComponent.vue

@@ -1,15 +1,20 @@
 <template>
-  <template v-if="userInfo.userInfo.userNameNeedTranslate == 1">
-    <template v-if="Array.isArray(openId)">
-      <template v-for="(item, index) in openId">
-        <ww-open-data :type='type' :openid='item'></ww-open-data>
-        <span v-if="index < openId.length - 1">,</span>
+  <template v-if="openId">
+    <template v-if="userInfo.userInfo.userNameNeedTranslate == 1">
+      <template v-if="Array.isArray(openId)">
+        <template v-for="(item, index) in openId">
+          <ww-open-data :type='type' :openid='item'></ww-open-data>
+          <span v-if="index < openId.length - 1">,</span>
+        </template>
       </template>
+      <ww-open-data :type='type' :openid='openId' v-else></ww-open-data>
+    </template>
+    <template v-else>
+      {{ Array.isArray(openId) ? openId.join(',') : openId }}
     </template>
-    <ww-open-data :type='type' :openid='openId' v-else></ww-open-data>
   </template>
   <template v-else>
-    {{ Array.isArray(openId) ? openId.join(',') : openId }}
+    
   </template>
 </template>
 

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/moduleList/moduleList.vue

@@ -117,7 +117,7 @@
                                 <TranslationComponent :openId="item.inchargerName" />
                               </div>
                               <div class="text-[#B9B9B9] text-size-small w-2/5 truncate text-right">库存:{{
-                                item.unit || 0 }}</div>
+                                item.inventory || 0 }}</div>
                             </div>
                           </div>
                         </template>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/product/productInfo.vue

@@ -10,7 +10,7 @@
           <span class="text-[#FF8B32]" v-if="info.price">¥ {{ info.price }}</span>
         </template>
       </van-cell>
-      <van-cell title="库存" :value="info.unit" />
+      <van-cell title="库存" :value="info.inventory" />
       <van-cell title="状态" :value="info.status == 1 ? '上架' : '下架'" />
       <van-cell title="负责人">
         <template #default>

+ 7 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/visitorProgram/visitorDetails.vue

@@ -137,6 +137,7 @@ import requests from "@common/requests";
 import useRouterStore from "@store/useRouterStore.js";
 import dayjs from "dayjs";
 import { routingInfos } from "@utility/generalVariables.js";
+import { useRoute } from 'vue-router';
 import useFixedData from "@store/useFixedData.js";
 import PullDownSelector from "@components/common/pullDownSelector.vue";
 
@@ -246,7 +247,12 @@ function processingDataSource(data) {
 
 useLifecycle({
   load: () => {
-    console.log('开始执行')
+    const route = useRoute();
+    const routerVal = route.query.id
+    if(routerVal) {
+      const val = { row: JSON.stringify({ id: routerVal }) }
+      processingDataSource(val);
+    }
     router.on("visitorDetailsParameter", (data) => {
       processingDataSource(data);
     });

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/vite.config.js

@@ -9,6 +9,7 @@ import { postcssConfig } from "./postcss.config.js";
 // const target = 'http://192.168.2.3:10010';
 // const target = 'http://192.168.2.17:10010';
 const target = 'http://47.101.180.183:10014';
+// const target = 'http://47.100.37.243:10070';
 
 export default defineConfig({
   define: {

+ 8 - 3
fhKeeper/formulahousekeeper/customerBuler-crm/src/components/translationComponent/textTranslation/textTranslation.vue

@@ -1,9 +1,14 @@
 <template>
-  <template v-if="!translationVal">
-    {{ translationValue }}
+  <template v-if="translationValue">
+    <template v-if="!translationVal">
+      {{ translationValue }}
+    </template>
+    <template v-else>
+      <ww-open-data :type="translationTypes" :openid="translationValue"></ww-open-data>
+    </template>
   </template>
   <template v-else>
-    <ww-open-data :type="translationTypes" :openid="translationValue"></ww-open-data>
+    
   </template>
 </template>
 <script lang="ts" setup>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/contacts/index.vue

@@ -114,7 +114,7 @@
         <div class="ml-4 mr-4">
           <div class="flex items-center">1、点击下载 <el-link type="primary"
               @click="downloadTemplate(IMPORTMOD, allText.importText)">{{ allText.importText }}</el-link></div>
-          <div class="mt-4">2、填写excel文件、联系人、客户名称必填</div>
+          <div class="mt-4">2、填写excel文件、联系人、客户、电话号码、负责人名称必填</div>
         </div>
       </div>
     </el-dialog>

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/product/component/information.vue

@@ -31,7 +31,7 @@
             </div>
             <div class="formItem flex pt-2 pb-1">
                 <div class="w-22 text-right text-gray-500">库存:</div>
-                <div class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap ml-1">{{ info.unit }}</div>
+                <div class="flex-1 overflow-hidden text-ellipsis whitespace-nowrap ml-1">{{ info.inventory }}</div>
             </div>
             <div class="formItem flex pt-2 pb-1">
                 <div class="w-22 text-right text-gray-500">状态:</div>

+ 1 - 0
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/constant.ts

@@ -19,4 +19,5 @@ export const DEYELWCLUE = `${prefix}/listDeleterClue`
 export const DETERDETELE = `${prefix}/deleterDelete`
 export const ROLLBACK = `${prefix}/rollback`
 export const URL_IMPORTTHREAD = `/user/importUser`
+export const URL_CLUE_IMPORTTHREAD = `/clue/importData`
 export const URL_EXPOERTHREAD = `${prefix}/exportData`

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm/src/pages/thread/index.vue

@@ -177,7 +177,7 @@
 
 <script lang="ts" setup>
 import { ref, reactive, onMounted, inject } from "vue";
-import { GETSYSFILED, MOD, IMPORMOD, GETPERSONNEL, GETTABLE, GETTEMPLATE, GETDETAIL, UNDATECLAIM, UNDATEFORM, DELTEROW, URL_IMPORTTHREAD, URL_EXPOERTHREAD } from './constant'
+import { GETSYSFILED, MOD, IMPORMOD, GETPERSONNEL, GETTABLE, GETTEMPLATE, GETDETAIL, UNDATECLAIM, UNDATEFORM, DELTEROW, URL_IMPORTTHREAD, URL_CLUE_IMPORTTHREAD, URL_EXPOERTHREAD } from './constant'
 import { getAllListByCode, getFromValue, resetFromValue, getFirstDayOfMonth, getLastDayOfMonth, formatDate, createTaskFromType, confirmAction, downloadTemplate, downloadFile } from '@/utils/tools'
 import { FormInstance, FormRules, ElMessageBox, ElTable, UploadRequestOptions } from 'element-plus'
 import { post, get, uploadFile } from "@/utils/request";
@@ -412,7 +412,7 @@ async function importProducts(param: UploadRequestOptions) {
   allLoading.importLoading = true
   const formData = new FormData();
   formData.append('multipartFile', param.file)
-  const res = await uploadFile(URL_IMPORTTHREAD, formData).finally(() => {
+  const res = await uploadFile(URL_CLUE_IMPORTTHREAD, formData).finally(() => {
     allLoading.importLoading = false
   })
   allLoading.importLoading = false