开始做登录
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { login } from "../../service/user"
|
||||
import { alertError, loadingFunc, wxLogin } from "../../utils/index"
|
||||
import { OK } from "../../utils/request"
|
||||
// pages/login/index.js
|
||||
Page({
|
||||
|
||||
@@ -21,7 +24,23 @@ Page({
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
onClose() {
|
||||
wx.exitMiniProgram()
|
||||
},
|
||||
onConfirm() {
|
||||
this.handleLogin()
|
||||
},
|
||||
async handleLogin() {
|
||||
loadingFunc(async () => {
|
||||
const wxLoginCode = await wxLogin()
|
||||
const { code, message, data } = await login({ code: wxLoginCode })
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
console.log('data', data)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
|
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
"usingComponents": {
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"select": "/components/select/index"
|
||||
}
|
||||
}
|
@@ -1,5 +1,17 @@
|
||||
<!--pages/login/index.wxml-->
|
||||
<view class="content">
|
||||
<input model:value="{{input}}" />
|
||||
{{input}}1
|
||||
<van-dialog
|
||||
use-slot
|
||||
title="提示"
|
||||
show="{{ true }}"
|
||||
show-cancel-button
|
||||
bind:close="onClose"
|
||||
bind:confirm="onConfirm"
|
||||
>
|
||||
<view class="confirmWrapper">
|
||||
使用本系统,代表您已阅读并同意 <text class="agreementText">《用电管理服务条款》</text>、<text class="agreementText">《用电管理登录政策》</text><text class="agreementText">《隐私政策》</text>。
|
||||
</view>
|
||||
</van-dialog>
|
||||
<!-- <select />
|
||||
<select /> -->
|
||||
</view>
|
@@ -1,6 +1,6 @@
|
||||
/* pages/login/index.wxss */
|
||||
.content {
|
||||
width: 600rpx;
|
||||
/* width: 600rpx;
|
||||
height: 500rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
@@ -9,5 +9,13 @@
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
margin: auto;
|
||||
padding: 20rpx 24rpx;
|
||||
padding: 20rpx 24rpx; */
|
||||
}
|
||||
|
||||
.confirmWrapper {
|
||||
margin: 32rpx 40rpx;
|
||||
}
|
||||
|
||||
.agreementText {
|
||||
color: rgb(211, 155, 52);
|
||||
}
|
Reference in New Issue
Block a user