|
@@ -42,6 +42,7 @@
|
|
|
<view @click="copy(userId)">复制userId</view>
|
|
|
<view>{{token}}</view>
|
|
|
<view @click="copy(token)">复制token</view> -->
|
|
|
+ <!-- <view>agentId:{{agentId}}</view> -->
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -76,14 +77,16 @@
|
|
|
this.token=uni.getStorageSync('token')
|
|
|
this.corpID=uni.getStorageSync('corpID')
|
|
|
this.agentId=uni.getStorageSync('agentId')
|
|
|
+ /* this.corpID='wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g'
|
|
|
+ this.agentId='1000051'
|
|
|
this.userId='wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA'
|
|
|
this.token='26AF53EA2DC528681ABD7B3AC46072E96F0A964431A2453CF0F1DA1C28732A1EAF945459643F62A3A6FD87751E6880BB'
|
|
|
-
|
|
|
+ */
|
|
|
//this.userId='wmMGjbBgAALroygkoaVBN4-W2O1daIkg'
|
|
|
//this.token='065BAA93971FEB1A37A08D682FCDB41CC69E76FC36BB038790FB99C5CD71C28EAF945459643F62A3A6FD87751E6880BB'
|
|
|
//this.userId='wmMGjbBgAAeKTdCmEN0CLKPNwJ4ACTxw'
|
|
|
//this.token='0A809B6077F4044EDECFC49762B59668E9508B2CA4C6C4791C8894B2B1A7338AAF945459643F62A3A6FD87751E6880BB'
|
|
|
- uni.setStorage({
|
|
|
+ /* uni.setStorage({
|
|
|
key: 'token',
|
|
|
data: that.token,
|
|
|
success: function () {
|
|
@@ -97,7 +100,7 @@
|
|
|
success: function () {
|
|
|
|
|
|
}
|
|
|
- });
|
|
|
+ }); */
|
|
|
/* this.code='aSBU0ums_4Z3ofjrfgSlYppwI9Cku5qtIg45ECkJTYY'
|
|
|
|
|
|
|
|
@@ -112,7 +115,7 @@
|
|
|
//this.init()
|
|
|
}
|
|
|
*/
|
|
|
- //this.authUserInfo()
|
|
|
+ this.authUserInfo()
|
|
|
//this.extUserDetail()
|
|
|
},
|
|
|
methods: {
|
|
@@ -138,11 +141,35 @@
|
|
|
extCustomerInfo(){
|
|
|
var that=this;
|
|
|
this.$http('enterprise/wechat/extCustomerInfo', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ //corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ corpID:that.corpID,
|
|
|
// extUserId:'wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA',
|
|
|
extUserId:this.userId,
|
|
|
token:this.token
|
|
|
}, 'GET').then(res => {
|
|
|
+ console.log(res.code)
|
|
|
+ uni.hideLoading();
|
|
|
+ if(res.code!=1){
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: res.msg,
|
|
|
+ success: function (res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ console.log('用户点击确定');
|
|
|
+ } else if (res.cancel) {
|
|
|
+ console.log('用户点击取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ //uni.clearStorageSync()
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ }
|
|
|
this.customerInfo=res.data.customerInfo
|
|
|
uni.setStorage({
|
|
|
key: 'integral',
|
|
@@ -174,7 +201,7 @@
|
|
|
var that=this;
|
|
|
|
|
|
this.$http('enterpriseWechat/auth/extUserDetail', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ corpID:that.corpID,
|
|
|
// extUserId:'wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA'
|
|
|
extUserId:this.userId
|
|
|
}, 'GET').then(res => {
|
|
@@ -187,12 +214,19 @@
|
|
|
var that=this;
|
|
|
this.extCustomerInfo()
|
|
|
this.$http('enterpriseWechat/auth/extUserDetail', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ corpID:that.corpID,
|
|
|
// extUserId:'wmMGjbBgAA0JAbGD5Vu8BzEuYgZhvhOA'
|
|
|
extUserId:this.userId
|
|
|
}, 'GET').then(res => {
|
|
|
uni.hideLoading();
|
|
|
this.userDetail=res.data
|
|
|
+ if(res.code!=1){
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
})
|
|
|
},
|
|
@@ -202,18 +236,26 @@
|
|
|
title: '加载中'
|
|
|
});
|
|
|
this.$http('enterpriseWechat/auth/authUserInfo', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ corpID:that.corpID,
|
|
|
code: this.code
|
|
|
}, 'GET').then(res => {
|
|
|
+ if(res.code!=1){
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: 'none',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.token=res.data.token
|
|
|
+ uni.setStorage({
|
|
|
+ key: 'token',
|
|
|
+ data: that.token,
|
|
|
+ success: function () {
|
|
|
+ that.init()
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- this.token=res.data.token
|
|
|
- uni.setStorage({
|
|
|
- key: 'token',
|
|
|
- data: that.token,
|
|
|
- success: function () {
|
|
|
- that.init()
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
//that.extUserDetail()
|
|
|
//that.extCustomerInfo()
|
|
@@ -235,12 +277,12 @@
|
|
|
} */
|
|
|
var that=this
|
|
|
this.$http('enterpriseWechat/auth/getAgentConfig', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
+ corpID:that.corpID,
|
|
|
url:'http://qw.66km.com.cn/'
|
|
|
}, 'GET').then(res => {
|
|
|
console.log(11)
|
|
|
that.$wx.agentConfig({
|
|
|
- corpid: 'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g', // 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
|
+ corpid:that.corpID,// 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
|
agentid:that.agentId, // 必填,企业微信的应用id (e.g. 1000247)
|
|
|
timestamp: res.data.timestamp, // 必填,生成签名的时间戳
|
|
|
nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
|
@@ -259,7 +301,7 @@
|
|
|
fail: function(err) {
|
|
|
console.log(err)
|
|
|
uni.showToast({
|
|
|
- title: 'agentConfig失败11',
|
|
|
+ title: 'agentConfig失败',
|
|
|
icon: 'none',
|
|
|
duration: 3000
|
|
|
});
|
|
@@ -313,100 +355,7 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- init2(){
|
|
|
- var that=this;
|
|
|
- console.log(this.$wx.config)
|
|
|
- if(this.code){
|
|
|
- if(that.$wx.config){
|
|
|
-
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title: 'agentConfig失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- }
|
|
|
- }else{
|
|
|
- uni.navigateTo({
|
|
|
- url:'auto'
|
|
|
- })
|
|
|
- }
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中'
|
|
|
- });
|
|
|
- /* this.$http('enterpriseWechat/auth/oAuth2', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
- redirectUri:'http://qw.66km.com.cn/#/',
|
|
|
- agentId:'1000036'
|
|
|
- }, 'GET').then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log(res.data)
|
|
|
- }).catch(err=>{
|
|
|
- uni.hideLoading();
|
|
|
- }) */
|
|
|
-
|
|
|
- this.$http('enterpriseWechat/auth/getAgentConfig', {
|
|
|
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
|
|
|
- url:'http://qw.66km.com.cn/'
|
|
|
- }, 'GET').then(res => {
|
|
|
- uni.hideLoading();
|
|
|
- console.log(this.$wx)
|
|
|
-
|
|
|
- this.$wx.config({
|
|
|
- debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
|
- appId: 'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g', // 必填,公众号的唯一标识
|
|
|
- timestamp: res.data.timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: res.data.signature,// 必填,签名
|
|
|
- jsApiList: [getCurExternalContact] // 必填,需要使用的JS接口列表
|
|
|
- });
|
|
|
- that.$wx.ready(() => {
|
|
|
- if(that.$wx.agentConfig){
|
|
|
-
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title: 'agentConfig失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- }
|
|
|
- // that.agentConfigFn()
|
|
|
- that.$wx.agentConfig({
|
|
|
- corpid: 'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g', // 必填,企业微信的corpid,必须与当前登录的企业一致
|
|
|
- agentid: '1000051', // 必填,企业微信的应用id (e.g. 1000247)
|
|
|
- timestamp: res.data.timestamp, // 必填,生成签名的时间戳
|
|
|
- nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
|
|
|
- signature: res.data.signature,// 必填,签名,见附录-JS-SDK使用权限签名算法
|
|
|
- jsApiList: ['getCurExternalContact'], //必填,传入需要使用的接口名称
|
|
|
- success: function(res) {
|
|
|
- console.log(res)
|
|
|
- uni.showToast({
|
|
|
- title: 'agentConfig成功',
|
|
|
- icon: 'none',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- // 回调
|
|
|
- taht.getContext()
|
|
|
- },
|
|
|
- fail: function(res) {
|
|
|
- console.log(res)
|
|
|
- uni.showToast({
|
|
|
- title: 'agentConfig失败',
|
|
|
- icon: 'none',
|
|
|
- duration: 3000
|
|
|
- });
|
|
|
- if(res.errMsg.indexOf('function not exist') > -1){
|
|
|
- alert('版本过低请升级')
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
- }).catch(err=>{
|
|
|
- uni.hideLoading();
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
agentConfigFn(){
|
|
|
|
|
|
},
|