Browse Source

2022.9.22 企业微信适配调试

ggooalice 2 năm trước cách đây
mục cha
commit
6925089c4a

+ 7 - 7
fhKeeper/formulahousekeeper/timesheet/package-lock.json

@@ -2774,11 +2774,11 @@
       }
     },
     "echarts": {
-      "version": "3.8.5",
-      "resolved": "https://registry.npmjs.org/echarts/-/echarts-3.8.5.tgz",
-      "integrity": "sha512-E+nnROMfCeiLeoT/fZyX8SE8mKzwkTjyemyoBF543oqjRtjTSKQAVDEihMXy4oC6pJS0tYGdMqCA2ATk8onyRg==",
+      "version": "4.9.0",
+      "resolved": "https://registry.npmjs.org/echarts/-/echarts-4.9.0.tgz",
+      "integrity": "sha512-+ugizgtJ+KmsJyyDPxaw2Br5FqzuBnyOWwcxPKO6y0gc5caYcfnEUIlNStx02necw8jmKmTafmpHhGo4XDtEIA==",
       "requires": {
-        "zrender": "3.7.4"
+        "zrender": "4.3.2"
       }
     },
     "editorconfig": {
@@ -9393,9 +9393,9 @@
       }
     },
     "zrender": {
-      "version": "3.7.4",
-      "resolved": "https://registry.npmjs.org/zrender/-/zrender-3.7.4.tgz",
-      "integrity": "sha512-5Nz7+L1wIoL0+Pp/iOP56jD6eD017qC9VRSgUBheXBiAHgOBJZ4uh4/g6e83acIwa8RKSyZf/FlceKu5ntUuxQ=="
+      "version": "4.3.2",
+      "resolved": "https://registry.npmjs.org/zrender/-/zrender-4.3.2.tgz",
+      "integrity": "sha512-bIusJLS8c4DkIcdiK+s13HiQ/zjQQVgpNohtd8d94Y2DnJqgM1yjh/jpDb8DoL6hd7r8Awagw8e3qK/oLaWr3g=="
     }
   }
 }

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/package.json

@@ -15,7 +15,7 @@
     "dayjs": "^1.10.4",
     "dhtmlx-gantt": "^7.1.6",
     "dingtalk-jsapi": "^2.13.42",
-    "echarts": "^3.8.5",
+    "echarts": "^4.9.0",
     "el-table-infinite-scroll": "^2.0.0",
     "element-ui": "^2.15.3",
     "font-awesome": "^4.7.0",

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -137,7 +137,7 @@
                         </el-popover>
                     </div>
                 </el-form-item>
-                <el-form-item v-if="($t('other.project') || radio == $t('lable.department') || radio == $t('projectclassification')) && exportParam.type == '0'">
+                <el-form-item v-if="(radio == $t('other.project') || radio == $t('lable.department') || radio == $t('projectclassification')) && exportParam.type == '0'">
                     <el-checkbox v-model="exportParam.projectSum" >{{ $t('individualprojectdata') }}</el-checkbox>
                 </el-form-item>
 

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/count/count.vue

@@ -90,7 +90,8 @@
         <template v-else>
             <van-cell v-for="item in showList" :key="item.id" title-style="color:#666">
                 <template #title>
-                    <div style="text-align:left;margin-left:0.42667rem;">{{item.name}}</div>
+                    <div style="text-align:left;margin-left:0.42667rem;" v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='item.name'></ww-open-data></div>
+                    <div style="text-align:left;margin-left:0.42667rem;" v-else>{{item.name}}</div>
                 </template>
                 <template #default>
                     <div style="text-align:right;margin-right:0.42667rem;">{{item.department}}</div>

+ 59 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -116,11 +116,70 @@
             if (localStorage.userInfo != null) {
                 this.getAccountInfo();
             }
+            console.log('userNameNeedTranslate',window.location.href);
+            if(this.user.userNameNeedTranslate == '1'){
+                this.agentConfig()
+            }
         },
         components: {
             Footer
         },
         methods: {
+            // 获取企业微信参数
+            agentConfig(){
+                let curUrl = window.location.href.split('#')[0]
+                this.$axios.post('/wxcorp/getCorpWXConfig',{
+                    url: curUrl,
+                    token: this.user.id
+                }).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'] 
+                    })
+                    let that = this
+                    wx.ready(function(){
+                    // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
+                        that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
+                            if (res.code == "ok") {
+                            console.log()
+                                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'], //必填,传入需要使用的接口名称
+                                    success: function (result) {
+                                        // console.log(result, '请求微信成功')
+                                        // console.log(window, 'window')
+                                        //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+                                        window.WWOpenData.bind(document.querySelector('ww-open-data'))
+                                    },
+                                    fail: function (res) {
+                                        // console.log('查看错误信息', res)
+                                        if (res.errMsg.indexOf('function not exist') > -1) {
+                                            alert('版本过低请升级')
+                                        }
+                                    },
+                                })
+                            }
+                        }, (error) => {
+                            console.log('查看错误信息' + res)
+                            if (error.errMsg.indexOf('function not exist') > -1) {
+                                alert('版本过低请升级')
+                            }
+                        })
+                    });
+                }).catch(err => {
+
+                })
+            },
+
             //获取账户信息
             getAccountInfo() {
                 this.$axios.get('/user/loginByUserId', {params:{userId: this.user.id}})

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/my/children/center.vue

@@ -5,7 +5,8 @@
             <div class="beijin"></div>
             <div class="flex aic users pixed" style="width:50%;">
                 <img :src="require('../../../assets/img/personal/userHead.png')" class="imege" />
-                <span class="f16 fff ml-20">{{userInfo.name}} </span>
+                <span class="f16 fff ml-20" v-if="userInfo.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='userInfo.name'></ww-open-data></span>
+                <span class="f16 fff ml-20" v-else>{{userInfo.name}} </span>
             </div>
         </header>