|
@@ -18,6 +18,7 @@
|
|
|
<button @click="getPhoneNumber" v-else>支付宝登录</button> -->
|
|
|
<view class="login-btn">
|
|
|
<button if="canIUseAuthButton" open-type="getAuthorize" @getAuthorize="onGetAuthorize" @error="onAuthError" scope='phoneNumber'>支付宝登录</button>
|
|
|
+ <button @click="onCode">获取code</button>
|
|
|
</view>
|
|
|
<!-- #endif -->
|
|
|
<!-- #ifndef MP-ALIPAY -->
|
|
@@ -186,28 +187,41 @@
|
|
|
})
|
|
|
},
|
|
|
onAuthError(e) {
|
|
|
- console.log(e);
|
|
|
+ console.log("err",e);
|
|
|
},
|
|
|
onGetAuthorize(e){
|
|
|
my.getPhoneNumber({
|
|
|
success: (res) => {
|
|
|
let encryptedData = res.response;
|
|
|
- console.log(encryptedData);
|
|
|
$http.post('/api/v1/mp/user/aliAuth/mobile', {
|
|
|
encryptedData,
|
|
|
identity: 1,
|
|
|
noToken: true
|
|
|
}).then(res=>{
|
|
|
- console.log(res);
|
|
|
+ console.log("successres",res);
|
|
|
})
|
|
|
},
|
|
|
fail: (res) => {
|
|
|
- console.log(res);
|
|
|
+ console.log("faukres",res);
|
|
|
console.log('getPhoneNumber_fail');
|
|
|
},
|
|
|
});
|
|
|
- console.log(e);
|
|
|
+ console.log("phone",e);
|
|
|
},
|
|
|
+ onCode() {
|
|
|
+ console.log("1111");
|
|
|
+
|
|
|
+ my.getAuthCode ({
|
|
|
+ scopes : ['auth_user'],
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res);
|
|
|
+ my.alert({
|
|
|
+ content: res.authCode,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
}
|
|
|
</script>
|