@@ -1,54 +1,61 @@
|
||||
<template>
|
||||
<view>
|
||||
<button @click="open">关闭</button>
|
||||
<uni-popup ref="popupLogin" :mask-click="false" type="bottom">
|
||||
<!-- <uni-popup ref="popupLogin" :mask-click="false" type="bottom"> -->
|
||||
<view class="content">
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-forms-item label="姓名" name="name">
|
||||
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入姓名" />
|
||||
<uni-forms ref="loginform" :modelValue="formData" :rules="rules" errShowType="modal">
|
||||
<uni-forms-item name="account">
|
||||
<uni-easyinput prefixIcon="person" type="text" v-model="formData.account" placeholder="请输入账号" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="邮箱" name="email">
|
||||
<uni-easyinput type="text" v-model="formData.email" placeholder="请输入用户名" />
|
||||
<uni-forms-item name="password">
|
||||
<uni-easyinput prefixIcon="locked" type="password" v-model="formData.password"
|
||||
placeholder="请输入密码" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button @click="submit">Submit</button>
|
||||
<button @click="submitLogin">立 即 登 录</button>
|
||||
<view class="footer">
|
||||
<uni-icons type="weixin" color="#00aa00" size="48"></uni-icons>
|
||||
<uni-icons type="qq" color="#686868" size="48"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
<!-- <uni-popup ref="popupReg" :mask-click="false" type="bottom"> -->
|
||||
<!-- </uni-popup> -->
|
||||
<uni-popup ref="popupReg" :mask-click="false" type="bottom">
|
||||
<view class="content">
|
||||
<text>用户注册</text>
|
||||
<uni-forms ref="form" :modelValue="formDataReg" :rules="rules">
|
||||
<uni-forms-item label="头像" name="avatarUrl" labelWidth="80">
|
||||
<button type="primary" class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" plain>
|
||||
<uni-forms ref="regForm" :modelValue="formDataReg" :rules="rules" errShowType="modal">
|
||||
<uni-forms-item name="avatarUrl">
|
||||
<button type="primary" class="avatar-wrapper" open-type="chooseAvatar"
|
||||
@chooseavatar="onChooseAvatar" plain>
|
||||
<image class="avatar" :src="formDataReg.avatarUrl"></image>
|
||||
</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="昵称" name="nickname" labelWidth="80">
|
||||
<uni-easyinput type="nickname" placeholder="请输入昵称" v-model="formDataReg.nickname" suffixIcon="phone">
|
||||
<uni-forms-item name="nickname">
|
||||
<uni-easyinput prefixIcon="person" type="nickname" placeholder="请输入 您的昵称"
|
||||
v-model="formDataReg.nickname">
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="电话" name="mobile" labelWidth="80">
|
||||
<uni-easyinput placeholder="请输入昵称" v-model="formDataReg.mobile" suffixIcon="phone"></uni-easyinput>
|
||||
<button size="mini" type="primary" open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber" plain>使用微信手机号</button>
|
||||
<uni-forms-item name="mobile">
|
||||
<uni-easyinput prefixIcon="phone" placeholder="请输入 手机号" v-model="formDataReg.mobile">
|
||||
</uni-easyinput>
|
||||
<button size="mini" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
|
||||
plain>使用微信手机号</button>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="密码" name="password" labelWidth="80">
|
||||
<uni-easyinput type="password" placeholder="请输入密码" v-model="formDataReg.password" suffixIcon="phone">
|
||||
<uni-forms-item name="password">
|
||||
<uni-easyinput prefixIcon="locked" type="password" placeholder="请输入 用户密码"
|
||||
v-model="formDataReg.password" suffixIcon="phone">
|
||||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button @click="submit">Submit</button>
|
||||
<button @click="submitReg">立 即 注 册</button>
|
||||
</view>
|
||||
<!-- </uni-popup> -->
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from 'vuex'
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
export default {
|
||||
name: "ywxAuthModel",
|
||||
computed: {
|
||||
@@ -61,8 +68,8 @@
|
||||
return {
|
||||
// 表单数据
|
||||
formData: {
|
||||
name: 'LiMing',
|
||||
email: 'dcloud@email.com'
|
||||
account: 'LiMing',
|
||||
password: 'dcloud@email.com'
|
||||
},
|
||||
formDataReg: {
|
||||
nickname: '',
|
||||
@@ -113,6 +120,30 @@
|
||||
|
||||
this.formDataReg.avatarUrl = avatarUrl
|
||||
},
|
||||
submitLogin(loginform) {
|
||||
let self = this;
|
||||
this.$refs.loginform.validate().then(res => {
|
||||
console.log('表单数据信息:', res);
|
||||
self.$ajax.post("User/login", self.formData)
|
||||
.then(e => {
|
||||
if(e.code == 0)
|
||||
uni.reLaunch({
|
||||
url: "/pages/tabbar/home/home"
|
||||
})
|
||||
|
||||
});
|
||||
}).catch(err => {
|
||||
console.log('表单错误信息:', err);
|
||||
})
|
||||
},
|
||||
submitReg(loginform) {
|
||||
let self = this;
|
||||
this.$refs.loginform.validate().then(res => {
|
||||
console.log('表单数据信息:', res);
|
||||
}).catch(err => {
|
||||
console.log('表单错误信息:', err);
|
||||
})
|
||||
},
|
||||
open() {
|
||||
this.$refs.popupReg.open()
|
||||
},
|
||||
@@ -143,7 +174,7 @@
|
||||
|
||||
<style>
|
||||
.content {
|
||||
padding: 35rpx;
|
||||
padding: 55rpx;
|
||||
background-color: aliceblue;
|
||||
}
|
||||
|
||||
@@ -153,6 +184,7 @@
|
||||
justify-content: space-evenly;
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -160,9 +192,20 @@
|
||||
padding: 20rpx 5rpx;
|
||||
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.uni-forms-item button {
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.uni-forms-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user