下面展示一些 内联代码片。
// An highlighted block
<!-- #ifdef MP-WEIXIN -->
<view>
<view>
<view class='header'>
<image src='/static/common/WeChat.png'></image>
</view>
<view class='content'>
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称,头像、地区等)</text>
</view>
<button class='bottom' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @getuserinfo="wxLogin">
授权登录
</button>
</view>
</view>
<!-- #endif -->
// An highlighted block
<!-- #ifdef MP-WEIXIN -->
<view>
<view>
<view class='header'>
<image src='/static/common/WeChat.png'></image>
</view>
<view class='content'>
<view>申请获取以下权限</view>
<text>获得你的公开信息(昵称,头像、地区等)</text>
</view>
<button class='bottom' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @getuserinfo="wxLogin">
授权登录
</button>
</view>
</view>
<!-- #endif -->
// An highlighted block
wxLogin(e) {
let _this = this;
if (e.detail.userInfo) {
uni.login({
provider: "weixin",
success(res) {
//获得微信授权码
var code = res.code
_this.$LoadingMsg("登录中")
uni.request({
url: _this.$api.getAccessToken,
data: {
code: code,
},
method: 'GET',
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success(res) {
if (res.data.code == 0) {
uni.hideLoading()
if(res.data.data.code){
uni.navigateTo({
url:"/pages/login/sms?openId="+res.data.data.openId
})
}else{
}
}
}
})
}
})
} else {
console.log("拒绝")
}
}

被折叠的 条评论
为什么被折叠?



