quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
mobile/pages2/login/mplogin.vue
@@ -1,6 +1,6 @@
<template>
   <view class="login-container" v-if="!loadding">
      <view class="wechatapp">
         <view class="header">
            <text class="icon iconfont icon-xuanze"></text>
@@ -11,7 +11,7 @@
      <view class="login-btn">
         <button class="btn-normal" @click="closeWindow">关闭页面</button>
      </view>
   </view>
</template>
@@ -29,9 +29,11 @@
         /*获取个人中心数据*/
         this.getData();
      },
      onLoad(){
      onLoad(options){
         let self = this;
         //#ifdef MP-WEIXIN
         console.log('开始微信授权');
         wx.login({
            success(res) {
               // 发送用户信息
@@ -43,6 +45,13 @@
            }
         });
         //#endif
         //#ifdef H5
         // H5环境直接显示成功页面
         setTimeout(() => {
            self.loadding = false;
         }, 1000);
         //#endif
      },
      methods: {
         /*获取数据*/
@@ -52,13 +61,23 @@
            self._get('user.index/detail', {
               url: self.url
            }, function(res) {
               uni.showToast({
                  title:res.msg
               });
               self.loadding = false;
               uni.stopPullDownRefresh();
               self.isloadding = false;
            });
         },
         closeWindow() {
            WeixinJSBridge.call('closeWindow');
            if (typeof WeixinJSBridge !== 'undefined') {
               WeixinJSBridge.call('closeWindow');
            } else {
               uni.showToast({
                  title: '请在微信浏览器中使用',
                  icon: 'none'
               });
            }
         }
      }
   }