Merge pull request '登录' (#36) from chenxuelian into dev
Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/36
This commit is contained in:
@@ -46,6 +46,15 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/my/login/login",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "登录",
|
||||||
|
"navigationBarTextStyle": "white",
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/detail/productsDetail/productsDetail",
|
"path": "pages/detail/productsDetail/productsDetail",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
56
pages/my/login/login.vue
Normal file
56
pages/my/login/login.vue
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<u-button type="primary" open-type="getPhoneNumber" size="medium" @getphonenumber="getphonenumber">
|
||||||
|
获取电话号码</u-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {loginSys} from '@/service/request.js'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getphonenumber(e) {
|
||||||
|
const {
|
||||||
|
phoneCode
|
||||||
|
} = e.detail;
|
||||||
|
console.log("手机code : ", phoneCode);
|
||||||
|
uni.login({
|
||||||
|
"provider": "weixin",
|
||||||
|
"onlyAuthorize": true, // 微信登录仅请求授权认证
|
||||||
|
success: function(event) {
|
||||||
|
const {
|
||||||
|
code
|
||||||
|
} = event
|
||||||
|
|
||||||
|
console.log("登录code", code);
|
||||||
|
//客户端成功获取授权临时票据(code),向业务服务器发起登录请求。
|
||||||
|
|
||||||
|
|
||||||
|
// 调用登录接口 拿到token 传手机code,更新手机号码
|
||||||
|
loginSys(code).then(res=>{
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
|
||||||
|
//接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: function(err) {
|
||||||
|
// 登录授权失败
|
||||||
|
// err.code是错误码
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user