Explorar el Código

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

QuYueTing hace 4 meses
padre
commit
77804a8d29

+ 3 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/index.html

@@ -5,6 +5,9 @@
     <link rel="icon" type="image/svg+xml" href="/vite.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>客户管家</title>
+    <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" referrerpolicy="origin"></script>
+    <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" referrerpolicy="origin"></script>
+    <script src="https://s.url.cn/qqun/qun/qqweb/m/qun/confession/js/vconsole.min.js "></script>
   </head>
   <body>
     <div id="app"></div>

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

@@ -1,15 +1,15 @@
 <template>
-  <template v-if="userInfo.userNameNeedTranslate == 1">
-    <!-- <template v-if="Array.isArray(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> -->
+    <ww-open-data :type='type' :openid='openId' v-else></ww-open-data>
   </template>
   <template v-else>
-    {{ Array.isArray(openId) ? openId.join(',') : openId }} 😔
+    {{ Array.isArray(openId) ? openId.join(',') : openId }}
   </template>
 </template>
 

+ 10 - 7
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/login.vue

@@ -18,7 +18,8 @@
 import { ref } from "vue";
 import { useLifecycle } from "@hooks/useCommon.js";
 import { LOGIN_INTERFACE, USER_ID_LOGIN, WE_CHAT_LOGIN, GET_MESSAGE_LIST } from "@hooks/useApi.js";
-import { addressRedirection, obtainEnterpriseWeChatParameters } from "@utility/corpWXparam"
+// import { addressRedirection, obtainEnterpriseWeChatParameters } from "@utility/corpWXparam"
+import { addressRedirection } from "@utility/corpWXparam"
 import useShowToast from "../hooks/useToast";
 import useRouterStore from "@store/useRouterStore.js";
 import useInfoStore from "@store/useInfoStore.js";
@@ -37,6 +38,9 @@ const isWX = ref(false)
 useLifecycle({
   load: () => {
     verifyLoginEnvironment()
+  },
+  init: () => {
+    verifyLoginEnvironment()
   }
 });
 
@@ -46,7 +50,7 @@ function verifyLoginEnvironment() {
   isWX.value = currentEnvironment.indexOf("micromessenger") > 0 ? true : false
   const href = window.location.href;
   if (href.indexOf("userId") > 0) {
-    const loginUserId = href.substring(href.indexOf("userId=") + "userId=".length);
+    let loginUserId = href.substring(href.indexOf("userId=") + "userId=".length);
     if (loginUserId.includes('#/')) {
       loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
     }
@@ -62,7 +66,7 @@ function verifyLoginEnvironment() {
           tryAutoLogin()
         } else {
           //后台经过验证后,重定向过来带上了userId
-          const loginUserId = href.substring(href.indexOf("userId=") + "userId=".length);
+          let loginUserId = href.substring(href.indexOf("userId=") + "userId=".length);
           if (loginUserId.includes('#/')) {
             loginUserId = loginUserId.substring(0, loginUserId.indexOf('#/'));
           }
@@ -84,7 +88,8 @@ function onSubmit(fromVal) {
 // userId登录
 function loginByUserId(userId) {
   toastLoading('登陆中...', 0)
-  requests.post(USER_ID_LOGIN, { params: { userId } }).then(({ data }) => {
+  // requests.post(USER_ID_LOGIN, { params: { userId } }).then(({ data }) => {
+  requests.post(USER_ID_LOGIN, {  userId }).then(({ data }) => {
     loginProcessing(data)
   })
 }
@@ -133,6 +138,7 @@ function bindIfNessary() {
 
 // 登陆前的处理
 function loginProcessing(data = {}) {
+  sessionStorage.setItem('token', data.id)
   userInfo.updateState({
     userInfo: data,
     token: data.id,
@@ -142,9 +148,6 @@ function loginProcessing(data = {}) {
   router.switchTabBar({
     pathName: 'home',
     success: function () {
-      if (isCorpWX.value) {
-        obtainEnterpriseWeChatParameters(data)
-      }
       toastSuccess('登陆成功')
       setTimeout(() => {
         getMessageList()

+ 1 - 1
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/pageComponents/contacts/addEditor.vue

@@ -37,7 +37,7 @@ function onSubmit() {
       return
     }
     toastLoading('保存中', 0)
-    const url = props.formValue.id ? '/contacts/updateContacts' : CUSTOMER_ADDED_EDITOR
+    const url = props.formValue.id ? '/contacts/updateContacts' : CONTACT_PERSON_ADDITION_EDITOR
     requests.post(url, { ...props.formValue, ...res.data }).then(() => {
       toastSuccess('保存成功')
       setTimeout(() => {

+ 2 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/tabbar/home/component/workbench.vue

@@ -292,7 +292,7 @@ function processForms() {
   )
 
   commonExpressionsHaveBeenNodded.value = allFormList.filter(item =>
-    selectedForm.some(arrItem => arrItem.path !== item.path)
+    !selectedForm.some(arrItem => arrItem.path === item.path)
   )
 }
 
@@ -326,7 +326,7 @@ function getAllData() {
   if (areYouRequesting.value) {
     return
   }
-  displayFrequentlyUsedContacts.value = useInfo.modularList.filter(item => item.path === 'contacts').length
+  displayFrequentlyUsedContacts.value = useInfo.modularList.filter(item => item.path === '/contacts').length
   areYouRequesting.value = true
   Promise.all([
     getVisitorPlan(),

+ 65 - 0
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/pages/tabbar/home/index.vue

@@ -86,9 +86,74 @@ function returnImageAddress(rows) {
   return row.homeImage
 }
 
+function obtainEnterpriseWeChatParameters(data = {}) {
+  const token = data.id
+  const curUrl = window.location.href.split('#')[0]
+  console.log(wx, '开始调用接口')
+  requests.post('/wxcorp/getCorpWXConfig', { url: curUrl, token }).then((res) => {
+    console.log(res, '<====== 返回的参数 /wxcorp/getCorpWXConfig')
+    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) {
+            console.log(result, '《+========== 成功1')
+            //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+            window.WWOpenData.bind(document.querySelector('ww-open-data'))
+          },
+          fail: function (res) {
+            console.log(res, '<===== 失败1')
+            if (res.errMsg.indexOf('function not exist') > -1) {
+              alert('版本过低请升级')
+            }
+          },
+        })
+      }).catch(err => {
+        console.log(err, '<===== 失败2')
+        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: () => {
+    console.log('执行一次')
+    const currentEnvironment = navigator.userAgent.toLowerCase();
+    const isCorpWX = currentEnvironment.indexOf("wxwork") > 0 ? true : false
+    if(isCorpWX) {
+      obtainEnterpriseWeChatParameters(userInfo.userInfo)
+    }
   }
 });
 

+ 10 - 2
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/corpWXparam.js

@@ -1,10 +1,11 @@
 import requests from "@common/requests";
 
 const wxTokenUrl = 'http://mobworktime.ttkuaiban.com/api/wechat/loginByWXCode'
-const coprWxTokenUrl = 'http://worktime.ttkuaiban.com/api/corpWXAuth'
+const coprWxTokenUrl = 'https://mobcrm.ttkuaiban.com/api/corpWXAuth'
 
 export const WX_APPID = 'wx749c84daac654e1e' // 微信appId
-export const CORP_WX_APPID = 'ww4e237fd6abb635af' // 企业微信appId
+// export const CORP_WX_APPID = 'ww4e237fd6abb635af' // 企业微信appId
+export const CORP_WX_APPID = 'wwdd1137a65ce0fc87' // 企业微信appId
 
 /**
  * 企业微信重定向地址
@@ -12,6 +13,7 @@ export const CORP_WX_APPID = 'ww4e237fd6abb635af' // 企业微信appId
  * @returns 企业微信重定向地址
  */
 export function addressRedirection(isCorpWx = false) {
+  console.log(wx, '<==== wx')
   const appId = isCorpWx ? CORP_WX_APPID : WX_APPID
   const url = isCorpWx ? coprWxTokenUrl : wxTokenUrl
   return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURI(url)}&response_type=code&scope=snsapi_base&state=0#wechat_redirect`
@@ -24,7 +26,9 @@ export function addressRedirection(isCorpWx = false) {
 export function obtainEnterpriseWeChatParameters(data = {}) {
   const token = data.id
   const curUrl = window.location.href.split('#')[0]
+  console.log('开始调用接口')
   requests.post(`/wxcorp/getCorpWXConfig`, { url: curUrl, token }).then((res) => {
+    console.log(res, '<====== 返回的参数 /wxcorp/getCorpWXConfig')
     wx.config({
       beta: true,
       debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
@@ -38,6 +42,7 @@ export function obtainEnterpriseWeChatParameters(data = {}) {
     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)
@@ -46,16 +51,19 @@ export function obtainEnterpriseWeChatParameters(data = {}) {
           signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
           jsApiList: ['selectExternalContact', 'openThirdAppServiceChat', 'openAppManage'], //必填,传入需要使用的接口名称
           success: function (result) {
+            console.log(result, '《+========== 成功1')
             //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
             window.WWOpenData.bind(document.querySelector('ww-open-data'))
           },
           fail: function (res) {
+            console.log(res, '<===== 失败1')
             if (res.errMsg.indexOf('function not exist') > -1) {
               alert('版本过低请升级')
             }
           },
         })
       }).catch(err => {
+        console.log(err, '<===== 失败2')
         if (err.errMsg.indexOf('function not exist') > -1) {
           alert('版本过低请升级')
         }

+ 16 - 16
fhKeeper/formulahousekeeper/customerBuler-crm-h5/src/utility/generalVariables.js

@@ -12,8 +12,8 @@ export const routingInfos = {
     addEditingInterface: NEW_BUSINESS_OPPORTUNITY_EDITING, // 新增/编辑请求接口
     topMountedInterface: TOP_OF_BUSINESS_OPPORTUNITIES, // 顶置接口
     cancelTheTopMountedInterface: CANCEL_THE_TOP_PLACEMENT_OF_BUSINESS_OPPORTUNITIES, // 取消顶置接口
-    homeImage: '/src/assets/image/module/min_business.png', // 首页图片
-    moduleImage: '/src/assets/image/module/business.png', // 模块图片
+    homeImage: new URL('/src/assets/image/module/min_business.png', import.meta.url).href, // 首页图片
+    moduleImage: new URL('/src/assets/image/module/business.png', import.meta.url).href, // 模块图片
     searchFiled: { search: 'name' }, // 搜索字段
     image: '', // 图片
     jurisdiction: { // 权限
@@ -33,8 +33,8 @@ export const routingInfos = {
     addEditingInterface: NEW_CLUE_EDITING,
     topMountedInterface: TOP_OF_CLUES,
     cancelTheTopMountedInterface: CANCEL_THE_TOP_PLACEMENT_OF_CLUES,
-    homeImage: '/src/assets/image/module/min_thread.png',
-    moduleImage: '/src/assets/image/module/thread.png',
+    homeImage: new URL('/src/assets/image/module/min_thread.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/thread.png', import.meta.url).href,
     searchFiled: { search: 'clueName' },
     image: '',
     jurisdiction: {
@@ -54,8 +54,8 @@ export const routingInfos = {
     addEditingInterface: CUSTOMER_ADDED_EDITOR,
     topMountedInterface: CUSTOMER_TOP_MOUNTED,
     cancelTheTopMountedInterface: CUSTOMER_CANCELS_TOP_PLACEMENT,
-    homeImage: '/src/assets/image/module/min_customer.png',
-    moduleImage: '/src/assets/image/module/customer.png',
+    homeImage: new URL('/src/assets/image/module/min_customer.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/customer.png', import.meta.url).href,
     searchFiled: { search: 'customName' },
     image: '',
     jurisdiction: {
@@ -75,8 +75,8 @@ export const routingInfos = {
     addEditingInterface: CONTACT_PERSON_ADDITION_EDITOR,
     topMountedInterface: CONTACT_TOP,
     cancelTheTopMountedInterface: CONTACT_PERSON_CANCELS_TOP_PLACEMENT,
-    homeImage: '/src/assets/image/module/min_contacts.png',
-    moduleImage: '/src/assets/image/module/contacts.png',
+    homeImage: new URL('/src/assets/image/module/min_contacts.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/contacts.png', import.meta.url).href,
     searchFiled: { search: 'name' },
     image: '',
     jurisdiction: {
@@ -96,8 +96,8 @@ export const routingInfos = {
     addEditingInterface: TASK_ADD_EDIT,
     topMountedInterface: TASK_TOP,
     cancelTheTopMountedInterface: TASK_CANCELLATION_TOP,
-    homeImage: '/src/assets/image/module/min_tasks.png',
-    moduleImage: '/src/assets/image/module/tasks.png',
+    homeImage: new URL('/src/assets/image/module/min_tasks.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/tasks.png', import.meta.url).href,
     searchFiled: { search: 'taskName' },
     image: '',
     jurisdiction: {
@@ -117,8 +117,8 @@ export const routingInfos = {
     addEditingInterface: PRODUCT_ADD_EDITOR,
     topMountedInterface: TOP_MOUNTED_PRODUCT,
     cancelTheTopMountedInterface: CANCEL_THE_TOP_PLACEMENT_OF_THE_PRODUCT,
-    homeImage: '/src/assets/image/module/min_product.png',
-    moduleImage: '/src/assets/image/module/product.png',
+    homeImage: new URL('/src/assets/image/module/min_product.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/product.png', import.meta.url).href,
     searchFiled: { search: 'productName' },
     image: '',
     jurisdiction: {
@@ -138,8 +138,8 @@ export const routingInfos = {
     addEditingInterface: CONTRACT_ADDITION_EDITING,
     topMountedInterface: TOP_OF_THE_CONTRACT,
     cancelTheTopMountedInterface: CONTRACT_CANCELLATION_WITH_TOP_PLACEMENT,
-    homeImage: '/src/assets/image/module/min_contract.png',
-    moduleImage: '/src/assets/image/module/contract.png',
+    homeImage: new URL('/src/assets/image/module/min_contract.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/contract.png', import.meta.url).href,
     searchFiled: { search: 'name' },
     image: '',
     jurisdiction: {
@@ -159,8 +159,8 @@ export const routingInfos = {
     addEditingInterface: ORDER_ADDITION_EDITING,
     topMountedInterface: SALES_ORDER_TOP_PLACEMENT,
     cancelTheTopMountedInterface: CANCEL_THE_TOP_PLACEMENT_OF_THE_SALES_ORDER,
-    homeImage: '/src/assets/image/module/min_order.png',
-    moduleImage: '/src/assets/image/module/order.png',
+    homeImage: new URL('/src/assets/image/module/min_order.png', import.meta.url).href,
+    moduleImage: new URL('/src/assets/image/module/order.png', import.meta.url).href,
     searchFiled: { search: 'orderName' },
     image: '',
     jurisdiction: {

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

@@ -43,7 +43,7 @@ export default defineConfig({
     }
   },
   build: {
-    chunkSizeWarningLimit: 1600,
+    chunkSizeWarningLimit: 1600
   },
   vue: {
     compilerOptions: {

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 4 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/WeiXinCorpController.java


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 5 - 5
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/UserServiceImpl.java