|
@@ -21,10 +21,8 @@
|
|
|
<Footer page="index"></Footer>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
import Footer from "@/components/Footer";
|
|
|
-
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -43,6 +41,18 @@
|
|
|
created() {
|
|
|
},
|
|
|
mounted() {
|
|
|
+ // if(this.user.companyName == '比基尼小镇'){
|
|
|
+ // let consoleScript = document.createElement("script");
|
|
|
+ // consoleScript.src = "https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js";
|
|
|
+ // consoleScript.onload = function () {
|
|
|
+ // new VConsole()
|
|
|
+ // }
|
|
|
+ // document.head.appendChild(consoleScript);
|
|
|
+ // }
|
|
|
+ // console.log('userNameNeedTranslate',window.location.href);
|
|
|
+ if(this.user.userNameNeedTranslate == '1'){
|
|
|
+ this.agentConfig()
|
|
|
+ }
|
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
|
if (ua.indexOf("wxwork") > 0) {
|
|
|
this.isCorpWX = true;
|
|
@@ -97,29 +107,14 @@
|
|
|
if (localStorage.userInfo != null) {
|
|
|
this.getAccountInfo();
|
|
|
}
|
|
|
- // this.routers.push({
|
|
|
- // name: '自动计时',
|
|
|
- // url: '/timetool',
|
|
|
- // icon: 'clock-o',
|
|
|
- // info: this.unreadNum
|
|
|
- // });
|
|
|
- // if (this.user.companyId==634 || this.user.companyId==7 || this.user.companyId==431) {
|
|
|
- // this.routers.push({
|
|
|
- // name: '请假审批',
|
|
|
- // url: '/exaLeave',
|
|
|
- // icon: 'todo-list-o',
|
|
|
- // });
|
|
|
- // }
|
|
|
|
|
|
this.getMessage();
|
|
|
this.bindIfNessary();
|
|
|
if (localStorage.userInfo != null) {
|
|
|
this.getAccountInfo();
|
|
|
}
|
|
|
- console.log('userNameNeedTranslate',window.location.href);
|
|
|
- if(this.user.userNameNeedTranslate == '1'){
|
|
|
- this.agentConfig()
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
components: {
|
|
|
Footer
|
|
@@ -132,49 +127,52 @@
|
|
|
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('版本过低请升级')
|
|
|
- }
|
|
|
+ if(res.code == 'ok'){
|
|
|
+ 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.$axios.post('/wxcorp/getCorpWXAgentConfig', {
|
|
|
+ url: curUrl,
|
|
|
+ token: that.user.id
|
|
|
+ }).then(res => {
|
|
|
+ if(res.code == 'ok'){
|
|
|
+ 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('版本过低请升级')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ if (err.errMsg.indexOf('function not exist') > -1) {
|
|
|
+ alert('版本过低请升级')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
}).catch(err => {
|
|
|
|
|
|
})
|