Ver Fonte

尝试使用企业微信通讯组件

Lijy há 2 anos atrás
pai
commit
d319ed0963

+ 49 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -140,6 +140,7 @@
             </el-col>
 
             <!--列表-->
+            
             <el-table ref="handleSelectTable" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="handleSelectionZzjg">
                 <el-table-column type="selection" width="50"></el-table-column>
                 <el-table-column type="index" width="50">
@@ -147,7 +148,16 @@
                         {{scope.$index+1+(page-1)*size}}
                     </template>
                 </el-table-column>
-                <el-table-column prop="name" :label="$t('lable.name')" ></el-table-column>
+                <el-table-column prop="name" :label="$t('lable.name')" >
+                  <template slot-scope="scope">
+                    <div>
+                      <div v-if="user.userNameNeedTranslate == 1">
+                        <ww-open-data type='userName' :openid='scope.row.name'></ww-open-data>
+                      </div>
+                      <div v-else>{{scope.row.name}}</div>
+                    </div>
+                  </template>
+                </el-table-column>
                 <el-table-column prop="jobNumber" :label="$t('Worknumber')" ></el-table-column>
                 <el-table-column prop="phone" :label="$t('shou-ji')" width="120"></el-table-column>
                 <el-table-column prop="departmentName" :label="$t('lable.department')" width="220"></el-table-column>
@@ -2998,7 +3008,43 @@ export default {
                   //     that.$toast('wx init success==7 ');
                   //     that.getLocation();
                   // }
-                  that.getagentConfigs() 
+                  // that.getagentConfigs() 
+                    // var curUrl = location.href.split("#")[0];
+                      // let urls = curUrl + '&debug=1'
+                      that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
+                          if (res.code == "ok") {
+                          that.tixtass = "处理"
+                          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')
+                                    that.tixtass = '注入'
+                                    //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+                                    window.WWOpenData.bind(document.querySelector('ww-open-data'))
+                                },
+                                fail: function (res) {
+                                    that.tixtass = "错误了"
+                                    console.log('查看错误信息', res)
+                                    if (res.errMsg.indexOf('function not exist') > -1) {
+                                        alert('版本过低请升级')
+                                    }
+                                },
+                            })
+                          }
+                      }, (error) => {
+                          console.log('查看错误信息' + res)
+                          this.tixtass = "失败"
+                          if (error.errMsg.indexOf('function not exist') > -1) {
+                              alert('版本过低请升级')
+                          }
+                      })
               });
           }
        }, (error) => {
@@ -3006,7 +3052,7 @@ export default {
        })
     },
     getagentConfigs() {
-          this.tixtass = "进了"
+      this.tixtass = "进了"
       var curUrl = location.href.split("#")[0];
       let urls = curUrl + '&debug=1'
        this.http.post("/wxcorp/getCorpWXAgentConfig", {url: urls, token: this.user.id}, (res) => {