1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
| <template>
| <view class="login-container" v-if="!loadding">
|
| <view class="wechatapp">
| <view class="header">
| <text class="icon iconfont icon-xuanze"></text>
| </view>
| </view>
| <view class="auth-title">操作成功</view>
| <view class="auth-subtitle">您可以关闭页面了</view>
| <view class="login-btn">
| <button class="btn-normal" @click="closeWindow">关闭页面</button>
| </view>
|
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| isloadding: true,
| /*是否加载完成*/
| loadding: true,
| sessionKey: ''
| };
| },
| onShow() {
| /*获取个人中心数据*/
| this.getData();
| },
| onLoad(options){
| let self = this;
|
| //#ifdef MP-WEIXIN
| console.log('开始微信授权');
| wx.login({
| success(res) {
| // 发送用户信息
| self._post('user.user/getSession', {
| code: res.code
| }, result => {
| self.sessionKey = result.data.session_key;
| });
| }
| });
| //#endif
|
| //#ifdef H5
| // H5环境直接显示成功页面
| setTimeout(() => {
| self.loadding = false;
| }, 1000);
| //#endif
| },
| methods: {
| /*获取数据*/
| getData() {
| let self = this;
| self.isloadding = true;
| self._get('user.index/detail', {
| url: self.url
| }, function(res) {
| uni.showToast({
| title:res.msg
| });
| self.loadding = false;
| uni.stopPullDownRefresh();
| self.isloadding = false;
| });
| },
| closeWindow() {
| if (typeof WeixinJSBridge !== 'undefined') {
| WeixinJSBridge.call('closeWindow');
| } else {
| uni.showToast({
| title: '请在微信浏览器中使用',
| icon: 'none'
| });
| }
| }
| }
| }
| </script>
|
| <style>
| .login-container {
| padding: 30rpx;
| text-align: center;
| }
|
| .wechatapp {
| padding: 80rpx 0 48rpx;
| text-align: center;
| }
|
| .wechatapp .header {
| margin: 0rpx auto 0;
| overflow: hidden;
| }
|
| .header text {
| display: inline-block;
| font-size: 100rpx;
| color: #04be01;
| }
|
| .auth-title {
| color: #585858;
| font-size: 34rpx;
| margin-bottom: 40rpx;
| }
|
| .auth-subtitle {
| color: #888;
| margin-bottom: 88rpx;
| font-size: 28rpx;
| }
|
| .login-btn {
| padding: 0 20rpx;
| }
|
| .login-btn button {
| height: 88rpx;
| line-height: 88rpx;
| background: #04be01;
| color: #fff;
| font-size: 30rpx;
| border-radius: 999rpx;
| text-align: center;
| }
| </style>
|
|