123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <template>
- <view class="content">
- <!-- <view>11{{code}}</view> -->
- <view>{{agentId}}</view>
- <view>{{code}}</view>
- <view @click="copy(code)">复制code</view>
- <view style="color: red;">{{userId}}</view>
- <view @click="copy(userId)">复制userId</view>
- </view>
- </template>
- <script>
- export default {
- components: {
-
- },
-
- data() {
- return {
- code:'',
- corpID:'',
- agentId:'',
- }
- },
- onLoad(opt) {
- console.log(opt)
- this.agentId=opt.agentid
- this.corpID=opt.appid
- uni.showLoading({
- title: '加载中'
- });
- //const token = uni.getStorageSync('token');
- // this.init()
- // this.code= this.$common.getHashQuery('code')
- // this.code=uni.getStorageSync('code')
- if(opt.code){
- uni.hideLoading();
- this.code=opt.code
- uni.setStorage({
- key: 'code',
- data: opt.code,
- success: function () {
- /* uni.navigateTo({
- url:'index'
- }) */
- }
- });
- uni.setStorage({
- key: 'corpID',
- data: 'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
- success: function () {
-
- }
- });
- uni.setStorage({
- key: 'agentId',
- data: '1000051',
- success: function () {
-
- }
- });
- }else{
- this.$http('enterpriseWechat/auth/oAuth2', {
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
- redirectUri:'http://qw.66km.com.cn/pages/index/auto',
- agentId:'1000051'
- }, 'GET').then(res => {
- //console.log(res.data)
- location.href= res.data
-
- }).catch(err=>{
-
- })
- }
-
- },
- methods: {
- copy(e){
- uni.setClipboardData({
- data: e,
- success: function () {
-
- uni.showToast({
- title: '复制成功',
- icon: 'success',
- duration: 2000
- });
- },
- fail: function () {
- console.log('复制失败');
-
- }
- });
- },
- init(){
- this.code=uni.getStorageSync('code')
-
- uni.showLoading({
- title: '加载中'
- });
-
- this.$http('enterpriseWechat/auth/getAgentConfig', {
- corpID:'wpMGjbBgAA_zIu6wbKy48zFSbGiGeP8g',
- url:'http://qw.66km.com.cn/'
- }, 'GET').then(res => {
- uni.hideLoading();
- //console.log(this.$wx.agentConfig)
- this.$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
- });
- // 回调
- },
- 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();
- })
- },
- tabFn(num){
- this.tabIndex=num
- }
- }
- }
- </script>
- <style scoped>
- .top{
- background: #fff;
- }
- .top{
- display: flex;
- padding: 30rpx 24rpx;
- }
- .logo{
- width: 98rpx;height: 98rpx;
- }
- .topRight{
- padding-left: 20rpx;
- }
- .wxName{
- font-weight: 500;
- font-size: 32rpx;
- color: #333333;
- line-height: 45rpx;
- }
- .titleBox{
- display: flex;
- padding-top: 10rpx;
- }
- .title{
- height: 36rpx;
- border-radius: 4rpx;
- border: 1px solid #FF8113;
- line-height: 34rpx;
- font-size: 24rpx;
- color: #FF8113;
- padding: 0 8rpx;
- margin-right: 10rpx;
-
- }
- .tabBox{
- display: flex;justify-content: space-between;
- background: #fff;
- margin-top: 16rpx;
- padding: 30rpx 24rpx;
- font-size: 30rpx;
- color: #333333;
- line-height: 42rpx;
- }
- .tabActive{
- color: #FF8113;font-weight: 500;
- border-bottom: 2px solid #FF8113;
- }
- .tabline{
- padding-bottom: 8rpx;
- }
- </style>
|