上传代码
This commit is contained in:
64
uniapp04/pages/run/run.vue
Normal file
64
uniapp04/pages/run/run.vue
Normal file
@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="page-section">
|
||||
<view>请不要一进入小程序就弹框授权,建议先了解小程序的服务内容</view>
|
||||
<button type="primary" onTap="getAuthCode">
|
||||
获取授权码
|
||||
</button>
|
||||
<button type="primary" onTap="myrequest">
|
||||
我的请求
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
Page({
|
||||
onLoad() { },
|
||||
data: {},
|
||||
getAuthCode: () => {
|
||||
my.getAuthCode({
|
||||
scopes: 'auth_user',
|
||||
success: ({ authCode }) => {
|
||||
console.log(`authCode:`, authCode);
|
||||
my.alert({
|
||||
content: authCode,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
myrequest: () => {
|
||||
my.getAuthCode({
|
||||
scopes: 'auth_user',
|
||||
success: ({ authCode }) => {
|
||||
console.log(`authCode:`, authCode);
|
||||
my.request({
|
||||
url: 'http://localhost:9999/api/user/login/alipay',
|
||||
method: 'GET',
|
||||
data: {
|
||||
authCode: authCode
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
my.alert({
|
||||
content: res,
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
Reference in New Issue
Block a user