init
This commit is contained in:
3
xhs-mini-demos/api-case/alipay-auth/alipay-auth.css
Normal file
3
xhs-mini-demos/api-case/alipay-auth/alipay-auth.css
Normal file
@@ -0,0 +1,3 @@
|
||||
.mt-8 {
|
||||
margin-top: 8px;
|
||||
}
|
||||
44
xhs-mini-demos/api-case/alipay-auth/alipay-auth.js
Normal file
44
xhs-mini-demos/api-case/alipay-auth/alipay-auth.js
Normal file
@@ -0,0 +1,44 @@
|
||||
Page({
|
||||
data: {
|
||||
authInfo: "",
|
||||
showLoading: true,
|
||||
},
|
||||
bindInput(e) {
|
||||
this.setData({
|
||||
authInfo: e.detail.value
|
||||
});
|
||||
},
|
||||
changeLoading(e) {
|
||||
this.setData({
|
||||
showLoading: e.detail.value
|
||||
});
|
||||
},
|
||||
auth() {
|
||||
if (!xhs.alipayAuth) {
|
||||
xhs.showModal({
|
||||
title: 'xhs.alipayAuth 方法不存在'
|
||||
});
|
||||
}
|
||||
|
||||
const { authInfo, showLoading } = this.data;
|
||||
console.log("%c Line:19 🍆 authInfo", "color:#ffdd4d", authInfo);
|
||||
console.log("%c Line:19 🌽 showLoading", "color:#ed9ec7", showLoading);
|
||||
|
||||
xhs.alipayAuth({
|
||||
authInfo,
|
||||
showLoading,
|
||||
success(res) {
|
||||
xhs.showModal({
|
||||
title: '支付宝授权成功',
|
||||
content: JSON.stringify(res),
|
||||
});
|
||||
},
|
||||
fail(err) {
|
||||
xhs.showModal({
|
||||
title: '支付宝授权失败',
|
||||
content: JSON.stringify(err),
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
7
xhs-mini-demos/api-case/alipay-auth/alipay-auth.json
Normal file
7
xhs-mini-demos/api-case/alipay-auth/alipay-auth.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "支付宝信息授权",
|
||||
"usingComponents": {
|
||||
"showbox": "../../common/component/showbox/index",
|
||||
"box": "../../common/component/container/index"
|
||||
}
|
||||
}
|
||||
34
xhs-mini-demos/api-case/alipay-auth/alipay-auth.xhsml
Normal file
34
xhs-mini-demos/api-case/alipay-auth/alipay-auth.xhsml
Normal file
@@ -0,0 +1,34 @@
|
||||
<view class="container">
|
||||
<showbox title="支付宝信息授权">
|
||||
<box>
|
||||
<view class="_ui-input">
|
||||
<text style="word-break:break-all;">输入的 authInfo 为: {{authInfo}}</text>
|
||||
</view>
|
||||
<view class="_ui-input">
|
||||
<input
|
||||
value="{{authInfo}}"
|
||||
placeholder="填参数 authInfo,类型字符串"
|
||||
placeholder-style="color: #3333334D;"
|
||||
bindinput="bindInput"
|
||||
maxlength="3000"
|
||||
/>
|
||||
</view>
|
||||
<view class="_ui-input">
|
||||
修改 showLoading
|
||||
<switch
|
||||
style="transform:scale(0.7)"
|
||||
checked="{{showLoading}}"
|
||||
color="rgba(255, 36, 66, 1)"
|
||||
bindchange="changeLoading"
|
||||
/>
|
||||
</view>
|
||||
<view class="_ui-space mt-8">
|
||||
<button
|
||||
class="_ui-button"
|
||||
hover-class="_ui-button-hover"
|
||||
bindtap="auth"
|
||||
>点击授权</button>
|
||||
</view>
|
||||
</box>
|
||||
</showbox>
|
||||
</view>
|
||||
Reference in New Issue
Block a user