|
@@ -3,71 +3,57 @@
|
|
|
<view class="logo">
|
|
|
<image
|
|
|
style="height:104rpx;width:104rpx"
|
|
|
- src="/static/czzn-img/login/logo.jpg"
|
|
|
+ src="/static/logo.png"
|
|
|
mode="aspectFit"
|
|
|
/>
|
|
|
- <view class="app-name">{{$t('login.e')}}</view>
|
|
|
</view>
|
|
|
<view class="login-title">
|
|
|
<span>{{$t('login.register')}}</span>
|
|
|
</view>
|
|
|
- <!-- 公司编号 -->
|
|
|
+ <!-- 账号密码登录 -->
|
|
|
<view class="inp_box">
|
|
|
- <input type="text" v-model="registerForm.code" :placeholder="this.$t('login.codePlaceholder')" @blur="getUrl" />
|
|
|
+ <u-input type="text" :border="false" v-model="registerForm.phone" placeholder="请输入用户名" />
|
|
|
</view>
|
|
|
- <!-- 名称 -->
|
|
|
+ <!-- 账号密码登录 -->
|
|
|
<view class="inp_box">
|
|
|
- <input type="text" v-model="registerForm.displayName" :placeholder="this.$t('login.displayNamePlaceholder')" />
|
|
|
+ <u-input type="text" :border="false" v-model="registerForm.displayName" placeholder="请输入显示名" />
|
|
|
</view>
|
|
|
- <!-- 手机号 -->
|
|
|
+ <!-- 账号密码登录 -->
|
|
|
<view class="inp_box">
|
|
|
- <input type="text" maxlength="11" @input="phoneInput" v-model="registerForm.phone" :placeholder="this.$t('login.phonePlaceholder')" />
|
|
|
+ <u-input type="password" :border="false" v-model="registerForm.password" placeholder="请输入密码" />
|
|
|
</view>
|
|
|
- <!-- 密码 -->
|
|
|
+
|
|
|
<view class="inp_box">
|
|
|
- <input type="text" v-model="registerForm.password" :placeholder="this.$t('login.passwordPlaceholder')" />
|
|
|
+ <u-input type="password" :border="false" v-model="registerForm.password2" placeholder="请输入确认密码" />
|
|
|
</view>
|
|
|
- <!-- 验证码
|
|
|
- <view class="inp_box">
|
|
|
- <input v-model="registerForm.verificationCode"
|
|
|
- :placeholder="this.$t('login.verifyCodePlaceholder')" />
|
|
|
- <button :class="time!=0?'load-reget':''" @click="getCode" :disabled='time!=0'
|
|
|
- class="get-code-btn">{{isGetCode?$t("login.reGetCode"):$t("login.getCode")}}{{time?`(${time}s)`:''}}</button>
|
|
|
- </view> -->
|
|
|
- <view class="btn-wrap">
|
|
|
|
|
|
- <button @click="phoneLogin" :class="urlFlag ? 'bind-btn' : 'btn-disabled'" :disabled="!urlFlag">{{$t('login.register')}}</button>
|
|
|
- </view>
|
|
|
+ <u-button type="primary" shape="circle" @click="phoneLogin">{{$t('login.register')}}</u-button>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import {
|
|
|
getRegTelCode,
|
|
|
- register,
|
|
|
- getUrlByCode,
|
|
|
- bindNameCode
|
|
|
+ register
|
|
|
} from '../../api/login'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- serverStatus:'',
|
|
|
- agree: [],
|
|
|
time: 0,
|
|
|
timer: '',
|
|
|
isGetCode: false,
|
|
|
+
|
|
|
option: [{
|
|
|
text: '',
|
|
|
value: 1,
|
|
|
}],
|
|
|
registerForm: {
|
|
|
- code:"",
|
|
|
phone: "",
|
|
|
password:"",
|
|
|
displayName: "",
|
|
|
verificationCode: "",
|
|
|
type: "",
|
|
|
+ password2:'',
|
|
|
},
|
|
|
- urlFlag:false,
|
|
|
roleList: [{
|
|
|
value: 0,
|
|
|
text: this.$t("login.dealer")
|
|
@@ -76,48 +62,13 @@
|
|
|
value: 1,
|
|
|
text: this.$t("login.driver")
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- this.registerForm.type = options.type
|
|
|
- this.serverStatus=uni.getStorageSync('serverStatus');
|
|
|
+ this.registerForm.type = '3'
|
|
|
},
|
|
|
methods: {
|
|
|
- //手机号输入
|
|
|
- phoneInput(){
|
|
|
- if(this.registerForm.phone.length >11){
|
|
|
- uni.showToast({
|
|
|
- title: this.$t('base.smsCode.phoneTooLong'),
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- //获取请求地址
|
|
|
- getUrl(){
|
|
|
- if (this.registerForm.code == '') {
|
|
|
- uni.showToast({
|
|
|
- title: this.$t('login.codePlaceholder'),
|
|
|
- icon: "none",
|
|
|
- duration: 2500,
|
|
|
- })
|
|
|
- }else{
|
|
|
- getUrlByCode(this.registerForm.code).then(r=>{
|
|
|
- if (r.statusCode === 200 && r.data.code === 0) {
|
|
|
- let data = r.data.data
|
|
|
- uni.setStorageSync('serverAddress', data.requestUrl);
|
|
|
- uni.setStorageSync('serverPrefix', data.methodPrefix);
|
|
|
- this.urlFlag = true
|
|
|
- }else{
|
|
|
- uni.showToast({
|
|
|
- title: r.data.msg,
|
|
|
- icon: "none",
|
|
|
- duration: 2500,
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
backLogin() {
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
@@ -125,7 +76,7 @@
|
|
|
},
|
|
|
//获取验证码
|
|
|
getCode() {
|
|
|
- let phone = /^\d{9}$/
|
|
|
+ let phone = /^1[3-9]\d{9}$/
|
|
|
if (!this.registerForm.type) {
|
|
|
uni.showToast({
|
|
|
title: this.$t('login.displayNamePlaceholder'),
|
|
@@ -152,7 +103,7 @@
|
|
|
}
|
|
|
if (!this.registerForm.phone) {
|
|
|
uni.showToast({
|
|
|
- title: this.$t('login.phonePlaceholder'),
|
|
|
+ title: "请输入用户名",
|
|
|
icon: "none",
|
|
|
duration: 2500,
|
|
|
})
|
|
@@ -191,15 +142,7 @@
|
|
|
},
|
|
|
//注册并登录
|
|
|
phoneLogin() {
|
|
|
- let phone = /^\d{9}$/
|
|
|
- if (this.registerForm.code == '' || !this.urlFlag) {
|
|
|
- uni.showToast({
|
|
|
- title: this.$t('login.codePlaceholder'),
|
|
|
- icon: "none",
|
|
|
- duration: 2500,
|
|
|
- })
|
|
|
- return;
|
|
|
- }
|
|
|
+ let phone = /^1[3-9]\d{9}$/
|
|
|
if (this.registerForm.displayName == '') {
|
|
|
uni.showToast({
|
|
|
title: this.$t('login.displayNamePlaceholder'),
|
|
@@ -218,7 +161,7 @@
|
|
|
}
|
|
|
if (this.registerForm.phone == '') {
|
|
|
uni.showToast({
|
|
|
- title: this.$t('login.phonePlaceholder'),
|
|
|
+ title: "请输入用户名",
|
|
|
icon: "none",
|
|
|
duration: 2500,
|
|
|
})
|
|
@@ -232,27 +175,27 @@
|
|
|
// })
|
|
|
// return;
|
|
|
// }
|
|
|
- // if (this.registerForm.verificationCode == '') {
|
|
|
- // uni.showToast({
|
|
|
- // title: this.$t('login.verifyCodePlaceholder'),
|
|
|
- // icon: "none",
|
|
|
- // duration: 2500,
|
|
|
- // })
|
|
|
- // return;
|
|
|
- // }
|
|
|
- let datasss = JSON.parse(JSON.stringify(this.registerForm))
|
|
|
- datasss.tenantId = this.registerForm.code
|
|
|
- register(datasss).then(res => {
|
|
|
- if (res.statusCode == 200 && res.data.code==0) {
|
|
|
- let data = {
|
|
|
- username: this.registerForm.phone,
|
|
|
- companyCode: this.registerForm.code
|
|
|
- }
|
|
|
- bindNameCode(data).then(res=>{
|
|
|
- if (res.statusCode === 200 && res.data.data.code === 0) {
|
|
|
- uni.showToast({
|
|
|
- title: '注册成功',
|
|
|
+ if (this.registerForm.password!=this.registerForm.password2) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '两次密码不一样',
|
|
|
+ icon: "none",
|
|
|
+ duration: 2500,
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.registerForm.username=this.registerForm.phone
|
|
|
+ uni.showLoading({
|
|
|
+ title: '注册中',
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
+ register(this.registerForm).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.data == this.registerForm.phone) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '注册成功,稍等跳转',
|
|
|
icon: "none",
|
|
|
+ mask:true,
|
|
|
duration: 2000,
|
|
|
})
|
|
|
setTimeout(() => {
|
|
@@ -260,17 +203,14 @@
|
|
|
url: `/pages/login/login?username=${this.registerForm.phone}`
|
|
|
})
|
|
|
}, 2000)
|
|
|
- }else{
|
|
|
- this.canLogin = false
|
|
|
- uni.showToast({
|
|
|
- title: res.data.data.msg,
|
|
|
- icon: "none",
|
|
|
- duration: 2500,
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
}
|
|
|
+ uni.hideLoading()
|
|
|
+ // this.registerForm.phone=''
|
|
|
+ this.registerForm.password=''
|
|
|
+ this.registerForm.password2=''
|
|
|
+ this.registerForm.displayName=''
|
|
|
+ }).finally(()=>{
|
|
|
+ uni.hideLoading()
|
|
|
})
|
|
|
|
|
|
},
|