File tree Expand file tree Collapse file tree 4 files changed +74
-17
lines changed Expand file tree Collapse file tree 4 files changed +74
-17
lines changed Original file line number Diff line number Diff line change 249
249
})
250
250
},
251
251
async loginByApple (provider , res ) {
252
- // 获取用户信息
253
- const [getUserInfoErr , result ] = await uni .getUserInfo ({
252
+ // 获取用户信息
253
+ let getUserInfoErr, result
254
+ // #ifndef VUE3
255
+ [getUserInfoErr, result] = await uni .getUserInfo ({
254
256
provider
255
- });
257
+ });
258
+ // #endif
259
+
260
+ // #ifdef VUE3
261
+ try {
262
+ result = await uni .getUserInfo ({
263
+ provider
264
+ });
265
+ } catch (e) {
266
+ getUserInfoErr = e
267
+ }
268
+ // #endif
269
+
256
270
if (getUserInfoErr) {
257
271
let content = getUserInfoErr .errMsg ;
258
272
if (~ content .indexOf (' uni.login' )) {
Original file line number Diff line number Diff line change 71
71
}
72
72
});
73
73
},
74
- _requestPromise () {
74
+ _requestPromise () {
75
+ // #ifndef VUE3
75
76
uni .request ({
76
77
url: requestUrl,
77
78
dataType: ' text' ,
87
88
duration: duration
88
89
});
89
90
this .res = ' 请求结果 : ' + JSON .stringify (res[1 ]);
90
-
91
91
this .loading = false ;
92
92
}).catch (err => {
93
93
console .log (' request fail' , err);
97
97
});
98
98
99
99
this .loading = false ;
100
- });
100
+ });
101
+ // #endif
102
+
103
+ // #ifdef VUE3
104
+ uni .request ({
105
+ url: requestUrl,
106
+ dataType: ' text' ,
107
+ data: {
108
+ noncestr: Date .now ()
109
+ }
110
+ }).then (res => {
111
+ console .log (' request success' , res);
112
+ uni .showToast ({
113
+ title: ' 请求成功' ,
114
+ icon: ' success' ,
115
+ mask: true ,
116
+ duration: duration
117
+ });
118
+ this .res = ' 请求结果 : ' + JSON .stringify (res);
119
+
120
+ this .loading = false ;
121
+ }).catch (err => {
122
+ console .log (' request fail' , err);
123
+ uni .showModal ({
124
+ content: err .errMsg ,
125
+ showCancel: false
126
+ });
127
+
128
+ this .loading = false ;
129
+ });
130
+ // #endif
101
131
},
102
- async _requestAwait () {
103
- const [err , res ] = await uni .request ({
132
+ async _requestAwait () {
133
+ let res, err
134
+ // #ifndef VUE3
135
+ [err, res] = await uni .request ({
104
136
url: requestUrl,
105
137
dataType: ' text' ,
106
138
data: {
107
139
noncestr: Date .now ()
108
140
}
109
- });
141
+ });
142
+ // #endif
143
+ // #ifdef VUE3
144
+ try {
145
+ res = await uni .request ({
146
+ url: requestUrl,
147
+ dataType: ' text' ,
148
+ data: {
149
+ noncestr: Date .now ()
150
+ }
151
+ });
152
+ } catch (e){
153
+ err= e
154
+ }
155
+ // #endif
110
156
if (err) {
111
157
console .log (' request fail' , err);
112
158
uni .showModal ({
Original file line number Diff line number Diff line change 80
80
open: false,
81
81
pages: [
82
82
'image',
83
- 'video',
84
- // #ifndef MP-ALIPAY || MP-TOUTIAO || VUE3
85
- 'audio',
86
- // #endif
83
+ 'video'
87
84
],
88
85
},
89
86
// #ifndef MP-TOUTIAO
Original file line number Diff line number Diff line change 79
79
url: 'component-communication'
80
80
},
81
81
// #ifndef MP-QQ || QUICKAPP-WEBVIEW
82
- {
83
- name: 'uCharts 图表',
84
- url: 'ucharts'
85
- },
82
+ // {
83
+ // name: 'uCharts 图表',
84
+ // url: 'ucharts'
85
+ // },
86
86
// #endif
87
87
// #ifndef QUICKAPP-WEBVIEW
88
88
{
You can’t perform that action at this time.
0 commit comments