个人中心切图

This commit is contained in:
仲么了
2023-01-13 16:32:56 +08:00
parent 36bcbab647
commit 25482cb612
41 changed files with 1090 additions and 75 deletions

165
pages/user/changePhone.vue Normal file
View File

@@ -0,0 +1,165 @@
<template>
<Cn-page :loading="loading">
<view slot="body">
<view class="index">
<template v-if="step == 1">
<uni-forms ref="form">
<uni-forms-item name="phone">
<uni-easyinput disabled type="text" v-model="formData.phone" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input mt40">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="firstSubmit">下一步</button>
</template>
<template v-else>
<uni-forms ref="form">
<uni-forms-item name="phone">
<uni-easyinput type="number" v-model="formData.phone2" placeholder="请输入新手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input mt40">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="secondSubmit">提交</button>
</template>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
name: "jiaban",
data () {
return {
step: 1,
loading: false,
waitTime: 0,
// 表单数据
formData: {
phone: '150****0083',
code: '',
phone2: '',
code2: '',
},
rules: {
phone: {
rules: [
{
required: true,
errorMessage: "请填写手机号"
}
]
},
code: {
rules: [
{
required: true,
errorMessage: "请填写验证码"
}
]
},
password: {
rules: [
{
required: true,
errorMessage: "请填写新密码"
}
]
},
password2: {
rules: [
{
required: true,
errorMessage: "请填写确认密码"
}
]
}
}
};
},
onLoad () {
},
methods: {
getCode () {
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
firstSubmit () {
this.step = 2
},
secondSubmit () {
uni.navigateBack({ delta: 1 })
}
}
};
</script>
<style lang="scss">
.index {
padding: 34rpx;
.submit-btn {
background: $uni-theme-blue;
color: #fff;
}
.login-box-tips {
margin-top: 60rpx;
display: flex;
justify-content: center;
font-size: 20rpx;
}
.login-box-input {
display: flex;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
.login-box-input-icon {
width: 40rpx;
margin-right: 40rpx;
}
.login-box-input-main {
font-size: 28rpx;
flex: 1;
height: 100rpx;
line-height: 100rpx;
}
.login-box-input-btn {
width: 200rpx;
margin-left: 40rpx;
background: $uni-theme-blue;
color: #fff;
}
.login-box-input-img {
margin-left: 40rpx;
background: skyblue;
height: 80rpx;
width: 200rpx;
}
}
}
</style>

155
pages/user/changePwd.vue Normal file
View File

@@ -0,0 +1,155 @@
<template>
<Cn-page :loading="loading">
<view slot="body">
<view class="index">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item name="phone">
<uni-easyinput disabled type="text" v-model="formData.phone" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input mt40">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入手机验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
<uni-forms-item name="password">
<uni-easyinput type="text" v-model="formData.password" placeholder="请输入新的登录密码" />
</uni-forms-item>
<uni-forms-item name="password2">
<uni-easyinput type="text" v-model="formData.password2" placeholder="请再次确认密码" />
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="submit">提交</button>
<view class="login-box-tips">
<view style="color:#999">说明密码长度为6-18</view>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
name: "ChangePWd",
data () {
return {
loading: false,
waitTime: 0,
// 表单数据
formData: {
phone: '150****0083',
code: '',
password: '',
password2: ''
},
rules: {
phone: {
rules: [
{
required: true,
errorMessage: "请填写手机号"
}
]
},
code: {
rules: [
{
required: true,
errorMessage: "请填写验证码"
}
]
},
password: {
rules: [
{
required: true,
errorMessage: "请填写新密码"
}
]
},
password2: {
rules: [
{
required: true,
errorMessage: "请填写确认密码"
}
]
}
}
};
},
onLoad () {
},
methods: {
getCode () {
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
submit () {
this.$refs.form.validate((valid) => {
console.log(valid);
if (!valid) {
uni.navigateBack({ delta: 1 })
}
})
},
}
};
</script>
<style lang="scss">
.index {
padding: 34rpx;
.submit-btn {
background: $uni-theme-blue;
color: #fff;
}
.login-box-tips {
margin-top: 60rpx;
display: flex;
justify-content: center;
font-size: 20rpx;
}
.login-box-input {
display: flex;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
.login-box-input-icon {
width: 40rpx;
margin-right: 40rpx;
}
.login-box-input-main {
font-size: 28rpx;
flex: 1;
height: 100rpx;
line-height: 100rpx;
}
.login-box-input-btn {
width: 200rpx;
margin-left: 40rpx;
background: $uni-theme-blue;
color: #fff;
}
.login-box-input-img {
margin-left: 40rpx;
background: skyblue;
height: 80rpx;
width: 200rpx;
}
}
}
</style>

159
pages/user/forget.vue Normal file
View File

@@ -0,0 +1,159 @@
<template>
<Cn-page :loading="loading">
<view slot="body">
<view class="index">
<uni-forms ref="form" :modelValue="formData" :rules="rules">
<uni-forms-item name="phone">
<uni-easyinput type="number" v-model="formData.phone" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input mt40">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
<uni-forms-item name="password">
<uni-easyinput type="text" v-model="formData.password" placeholder="请输入新的登录密码" />
</uni-forms-item>
<uni-forms-item name="password2">
<uni-easyinput type="text" v-model="formData.password2" placeholder="请再次确认密码" />
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="submit">提交</button>
<view class="login-box-tips">
<view style="color:#999">说明密码长度为6-18</view>
</view>
<view class="login-box-tips">
<view style="color:#999">点击提交即表示同意</view>
<navigator url="/pages/mine/agreement" hover-class="none">用户协议</navigator>
<navigator url="/pages/mine/policy" hover-class="none">个人信息保护政策</navigator>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
name: "jiaban",
data () {
return {
loading: false,
waitTime: 0,
// 表单数据
formData: {
phone: '',
code: '',
password: '',
password2: ''
},
rules: {
phone: {
rules: [
{
required: true,
errorMessage: "请填写手机号"
}
]
},
code: {
rules: [
{
required: true,
errorMessage: "请填写验证码"
}
]
},
password: {
rules: [
{
required: true,
errorMessage: "请填写新密码"
}
]
},
password2: {
rules: [
{
required: true,
errorMessage: "请填写确认密码"
}
]
}
}
};
},
onLoad () {
},
methods: {
getCode () {
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
submit () {
this.$refs.form.validate((valid) => {
console.log(valid);
if (valid) {
}
})
},
}
};
</script>
<style lang="scss">
.index {
padding: 34rpx;
.submit-btn {
background: $uni-theme-blue;
color: #fff;
}
.login-box-tips {
margin-top: 60rpx;
display: flex;
justify-content: center;
font-size: 20rpx;
}
.login-box-input {
display: flex;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
.login-box-input-icon {
width: 40rpx;
margin-right: 40rpx;
}
.login-box-input-main {
font-size: 28rpx;
flex: 1;
height: 100rpx;
line-height: 100rpx;
}
.login-box-input-btn {
width: 200rpx;
margin-left: 40rpx;
background: $uni-theme-blue;
color: #fff;
}
.login-box-input-img {
margin-left: 40rpx;
background: skyblue;
height: 80rpx;
width: 200rpx;
}
}
}
</style>

300
pages/user/login.vue Normal file
View File

@@ -0,0 +1,300 @@
<template>
<Cn-page :loading="loading">
<view slot="body">
<view class="login">
<view class="login-title">登录</view>
<view class="login-des">{{ companyName }}</view>
<view class="login-box">
<!-- <image class="login-box-logo" mode="widthFix" src="/static/logo.png"></image> -->
<image class="login-box-logo" mode="widthFix" src="/static/logo2.png"></image>
<template v-if="loginType == 'yzm'">
<view class="login-box-input mt100">
<input class="login-box-input-main" v-model="yzmForm.phone" placeholder="请输入手机号" />
</view>
<!-- <view class="login-box-input mt40">
<input class="login-box-input-main" v-model="yzmForm.imgCode" placeholder="图形验证码" />
<view class="login-box-input-img"></view>
</view> -->
<view class="login-box-input mt40">
<input class="login-box-input-main" v-model="yzmForm.code" placeholder="手机验证码" />
<view class="ml40" style="font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</template>
<template v-else>
<view class="login-box-input mt100">
<input class="login-box-input-main" v-model="pwdForm.account" placeholder="请输入账号" />
</view>
<view class="login-box-input mt40">
<input type="password" class="login-box-input-main" v-model="pwdForm.pwd"
placeholder="请输入密码" />
</view>
<!-- <view class="login-box-input mt40">
<view class="login-box-input-icon"></view>
<input class="login-box-input-main" v-model="pwdForm.imgCode" placeholder="图形验证码" />
<view class="login-box-input-img"></view>
</view> -->
</template>
<view class="login-box-btn" @click="login"> 登录 </view>
<view class="login-box-footer">
<view @click="loginType = 'pwd'" v-if="loginType == 'yzm'">账号密码登录</view>
<view @click="loginType = 'yzm'" v-else>短信验证码登录</view>
<view style="flex:1"></view>
<navigator url="/pages/user/forget" hover-class="none">忘记密码</navigator>
<view style="margin:0 10px;color:#999">|</view>
<navigator url="/pages/user/register" hover-class="none">快速注册</navigator>
</view>
<view class="login-box-tips">
<view style="color:#999">点击登录即表示同意</view>
<navigator url="/pages/mine/agreement" hover-class="none">用户协议</navigator>
<navigator url="/pages/mine/policy" hover-class="none">个人信息保护政策</navigator>
</view>
</view>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
data () {
return {
loading: false,
loginType: 'pwd',
pwdForm: {
account: '',
pwd: '',
imgCode: '',
},
yzmForm: {
phone: '',
code: '',
imgCode: '',
},
waitTime: 0,
tenantId: '',
companyName: '',
}
},
components: {},
methods: {
getCode () {
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
login () {
if (this.loginType == 'pwd') {
this.pwdLogin()
} else {
this.yzmLogin()
}
},
pwdLogin () {
if (!this.pwdForm.account && !this.pwdForm.pwd) {
return this.$util.toast('请填写登录信息!')
}
this.$request({
url: '/org/login/valid',
data: {
account: this.pwdForm.account.trim(),
password: this.pwdForm.pwd,
tenantId: this.tenantId,
},
method: 'POST',
}).then(res => {
uni.setStorageSync('login', true)
uni.setStorageSync('Authorization', res.data)
uni.setStorageSync('password', this.pwdForm.pwd)
uni.setStorageSync('account', this.pwdForm.account.trim())
this.$util.toast('登录成功!')
// #ifndef MP
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/index',
})
}, 100);
// #endif
this.$util.loadConfig(() => { }, true)
// #ifdef MP
uni.login({
provider: 'weixin',
success: loginRes => {
console.log(loginRes)
this.$request({
url: '/org/wxxcx/login',
data: {
code: loginRes.code,
tenantId: this.tenantId,
},
method: 'POST',
}).then(res => {
this.$request({
url: '/org/wxxcx/bindUser',
data: {
account: this.pwdForm.account.trim(),
password: this.pwdForm.pwd,
openid: res.data.openid,
tenantId: this.tenantId,
},
method: 'POST'
}).then(res => {
uni.reLaunch({
url: '/pages/index/index',
})
})
})
},
})
// #endif
})
},
yzmLogin () {
if (!this.yzmForm.phone && !this.yzmForm.code) {
return this.$util.toast('请填写登录信息!')
}
this.$request({
url: '/org/login/valid',
data: {
account: this.yzmForm.phone.trim(),
code: this.yzmForm.code,
tenantId: this.tenantId,
},
method: 'POST',
}).then(res => {
uni.setStorageSync('Authorization', res.data)
this.$util.toast('登录成功!')
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/index',
})
}, 1500)
})
},
},
onLoad (o) {
uni.removeStorageSync('Authorization')
if (o.alias) {
this.tenantId = o.alias
this.companyName = o.name
this.pwdForm.account = o.account
uni.setStorageSync('tenantId', this.tenantId)
uni.setStorageSync('companyName', this.companyName)
uni.setStorageSync('account', this.pwdForm.account)
} else {
this.tenantId = uni.getStorageSync('tenantId')
this.companyName = uni.getStorageSync('companyName')
this.pwdForm.account = uni.getStorageSync('account')
}
},
}
</script>
<style lang='scss'>
.login {
.login-title {
padding-left: 64rpx;
padding-top: 48rpx;
font-size: 56rpx;
font-weight: 600;
color: #111;
}
.login-des {
padding-left: 64rpx;
margin-top: 12rpx;
font-size: 28rpx;
color: #999;
}
.login-box {
display: flex;
flex-direction: column;
margin: 60rpx auto 0;
box-sizing: border-box;
width: 680rpx;
padding: 100rpx 40rpx;
border-radius: 40rpx;
background: #fff;
overflow: hidden;
.login-box-logo {
background: $uni-theme-blue;
height: 100rpx;
width: 100rpx;
margin: 0 auto;
}
.login-box-input {
height: 110rpx;
display: flex;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
.login-box-input-icon {
width: 40rpx;
margin-right: 40rpx;
}
.login-box-input-main {
font-size: 28rpx;
flex: 1;
height: 100rpx;
line-height: 100rpx;
}
.login-box-input-btn {
width: 200rpx;
margin-left: 40rpx;
background: $uni-theme-blue;
color: #fff;
}
.login-box-input-img {
margin-left: 40rpx;
background: skyblue;
height: 80rpx;
width: 200rpx;
}
}
.login-box-switch {
margin-top: 60rpx;
color: $uni-theme-blue;
font-size: 28rpx;
text-align: center;
}
.login-box-btn {
display: flex;
align-items: center;
justify-content: center;
margin-top: 80rpx;
width: 100%;
background: $uni-theme-blue;
color: #fff;
height: 80rpx;
border-radius: 12rpx;
}
.login-box-footer {
display: flex;
margin-top: 40rpx;
font-size: 28rpx;
color: $uni-theme-blue;
}
.login-box-tips {
margin-top: 60rpx;
display: flex;
justify-content: center;
font-size: 20rpx;
}
}
}
</style>

167
pages/user/register.vue Normal file
View File

@@ -0,0 +1,167 @@
<template>
<Cn-page :loading="loading">
<view slot="body">
<view class="index">
<template v-if="step == 1">
<uni-forms ref="form">
<uni-forms-item name="phone">
<uni-easyinput type="number" v-model="formData.phone" placeholder="请输入手机号" />
</uni-forms-item>
<uni-forms-item name="code">
<view class="login-box-input mt40">
<uni-easyinput type="number" v-model="formData.code" placeholder="请输入验证码" />
<view class="ml40"
style="margin-left:40rpx;font-size: 28rpx; color: #666; width: 200rpx; text-align: center"
v-if="waitTime > 0">{{ waitTime + 's后重新获取' }}</view>
<button class="login-box-input-btn" v-else @click="getCode" size="mini">获取验证码</button>
</view>
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="firstSubmit">下一步</button>
<view class="login-box-tips">
<view style="color:#999">点击提交即表示同意</view>
<navigator url="/pages/mine/agreement" hover-class="none">用户协议</navigator>
<navigator url="/pages/mine/policy" hover-class="none">个人信息保护政策</navigator>
</view>
</template>
<template v-else>
<uni-forms ref="form">
<uni-forms-item name="password">
<uni-easyinput type="text" v-model="formData.password" placeholder="请输入登录密码" />
</uni-forms-item>
<uni-forms-item name="password2">
<uni-easyinput type="text" v-model="formData.password2" placeholder="请再次确认密码" />
</uni-forms-item>
</uni-forms>
<button type="default" class="submit-btn" @click="secondSubmit">提交</button>
<view class="login-box-tips">
<view style="color:#999">说明密码长度为6-18</view>
</view>
</template>
</view>
</view>
</Cn-page>
</template>
<script>
export default {
name: "jiaban",
data () {
return {
step: 1,
loading: false,
waitTime: 0,
// 表单数据
formData: {
phone: '',
code: '',
password: '',
password2: ''
},
rules: {
phone: {
rules: [
{
required: true,
errorMessage: "请填写手机号"
}
]
},
code: {
rules: [
{
required: true,
errorMessage: "请填写验证码"
}
]
},
password: {
rules: [
{
required: true,
errorMessage: "请填写新密码"
}
]
},
password2: {
rules: [
{
required: true,
errorMessage: "请填写确认密码"
}
]
}
}
};
},
onLoad () {
},
methods: {
getCode () {
this.waitTime = 60
this.inter = setInterval(() => {
if (this.waitTime == 0) {
clearInterval(this.inter)
} else {
this.waitTime--
}
}, 1000)
},
firstSubmit () {
this.step = 2
},
secondSubmit () {
}
}
};
</script>
<style lang="scss">
.index {
padding: 34rpx;
.submit-btn {
background: $uni-theme-blue;
color: #fff;
}
.login-box-tips {
margin-top: 60rpx;
display: flex;
justify-content: center;
font-size: 20rpx;
}
.login-box-input {
display: flex;
align-items: center;
border-bottom: 1rpx solid #f0f0f0;
.login-box-input-icon {
width: 40rpx;
margin-right: 40rpx;
}
.login-box-input-main {
font-size: 28rpx;
flex: 1;
height: 100rpx;
line-height: 100rpx;
}
.login-box-input-btn {
width: 200rpx;
margin-left: 40rpx;
background: $uni-theme-blue;
color: #fff;
}
.login-box-input-img {
margin-left: 40rpx;
background: skyblue;
height: 80rpx;
width: 200rpx;
}
}
}
</style>