You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
5.5 KiB
243 lines
5.5 KiB
<template>
|
|
<view class="">
|
|
<navigation>
|
|
<image :src="logoUrl" mode="aspectFit" class="logo" slot="logo"></image>
|
|
Login
|
|
</navigation>
|
|
<view class="login-body">
|
|
<view class="input-item flex">
|
|
<view class="login-sigh flex">
|
|
<view class="imgcon">
|
|
<image src="../../static/login/[email protected]" mode=""></image>
|
|
</view>
|
|
<span class="quhao">+{{areacode}}</span>
|
|
</view>
|
|
<input type="text" value="" placeholder="mobile number"
|
|
placeholder-style="color: #BFC2CCFF;font-size:14px;" v-model="mobile" @input="btnControl()" />
|
|
</view>
|
|
<view class="input-item flex">
|
|
<view class="login-sigh login-sigh2 flex">
|
|
<view class="imgcon">
|
|
<image src="../../static/login/[email protected]" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<input type="password" value="" placeholder="New password"
|
|
placeholder-style="color: #BFC2CCFF;font-size:14px;" v-model="password" />
|
|
</view>
|
|
<view class="rePass" @click="gores()">
|
|
Reset Password
|
|
</view>
|
|
<button class="login-btn" @click="login()" :class="btncol==1?'on':''" :disabled="btncol==1?false:true">
|
|
Login
|
|
</button>
|
|
<view class="login-re" @click="goReg()">
|
|
Register
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import api from '@/utils/api'
|
|
import utils from '@/utils'
|
|
import md5 from 'js-md5'
|
|
import store from '@/store'
|
|
import cont from "@/components/navigation/navigation.vue"
|
|
export default {
|
|
data() {
|
|
return {
|
|
mobile: '',
|
|
password: '',
|
|
siteInfoData: {},
|
|
countryCode: {},
|
|
logoUrl: '',
|
|
btncol: 0,
|
|
areacode: '',
|
|
siteName: '',
|
|
|
|
}
|
|
},
|
|
|
|
onLoad() {
|
|
this.siteInfoData = uni.getStorageSync('siteInfo')
|
|
this.countryCode = uni.getStorageSync('countryCode')
|
|
|
|
console.log(this.siteInfoData, 9999)
|
|
console.log(this.countryCode, 99999)
|
|
const siteInfo = api.siteInfo()
|
|
siteInfo.then(d => {
|
|
let that = this
|
|
uni.setStorage({
|
|
key: 'siteInfo',
|
|
data: d.data,
|
|
success: function() {
|
|
console.log('success')
|
|
that.logoUrl = d.data.siteDomain + d.data.siteLogo
|
|
that.siteName = d.data.siteName
|
|
that.areacode = d.data.areaCode
|
|
}
|
|
});
|
|
this.siteInfoData = d.data
|
|
|
|
})
|
|
.catch((e) => {
|
|
console.log(e)
|
|
})
|
|
this.logoUrl = this.siteInfoData.siteDomain + this.siteInfoData.siteLogo
|
|
this.siteName = this.siteInfoData.siteName
|
|
// const ticket = this.$store.state.ticket
|
|
<<<<<<< HEAD
|
|
const ticket= uni.getStorageSync('logInfo').data;
|
|
console.log(ticket,7777777777777777777)
|
|
// if(ticket != undefined){
|
|
// uni.reLaunch({
|
|
// url: '../menu/index/index'
|
|
// })
|
|
|
|
// }else{
|
|
// // location.reload()
|
|
|
|
// }
|
|
|
|
=======
|
|
const ticket = uni.getStorageSync('logInfo').data;
|
|
console.log(ticket, 7777777777777777777)
|
|
// if (ticket) {
|
|
// uni.reLaunch({
|
|
// url: '../menu/index/index'
|
|
// })
|
|
|
|
// } else {
|
|
// // location.reload()
|
|
|
|
// }
|
|
|
|
>>>>>>> 568bf6045ac1252bb15844d528ceabdb0f66ad2f
|
|
},
|
|
methods: {
|
|
btnControl() {
|
|
this.btncol = 1;
|
|
if (this.mobile == '') {
|
|
this.btncol = 0;
|
|
}
|
|
|
|
},
|
|
gores() {
|
|
uni.reLaunch({
|
|
url: './resetPassword/index'
|
|
})
|
|
},
|
|
goReg() {
|
|
uni.reLaunch({
|
|
url: '../register/index'
|
|
})
|
|
},
|
|
login() {
|
|
uni.showLoading({
|
|
title: 'loading'
|
|
});
|
|
if (this.mobile == '') {
|
|
uni.showToast({
|
|
title: 'Please input mobile phone number',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return;
|
|
}
|
|
var a = /^[0-9]{4,14}$/;
|
|
if (!a.test(this.mobile)) {
|
|
uni.showToast({
|
|
title: 'Wrong format of mobile phone number',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return;
|
|
}
|
|
if (this.password == '') {
|
|
uni.showToast({
|
|
title: 'password is empty',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return;
|
|
}
|
|
var a = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,19}$/;
|
|
if (!a.test(this.password)) {
|
|
uni.showToast({
|
|
title: 'Incorrect password format,a password requires a combination of numbers and letters',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return;
|
|
}
|
|
|
|
|
|
uni.request({
|
|
url: '/start/api/user/login',
|
|
data: {
|
|
"mobile": this.mobile,
|
|
'password': md5(this.password),
|
|
},
|
|
header: {
|
|
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8' //自定义请求头信息
|
|
},
|
|
method: 'POST', //请求方式 或GET,必须为大写
|
|
success: (res) => {
|
|
var that = this;
|
|
if (res.data.errCode == "SUCCESS") {
|
|
|
|
uni.setStorage({
|
|
key: 'logInfo',
|
|
data: res.data,
|
|
success: function() {
|
|
console.log('success')
|
|
}
|
|
});
|
|
uni.setStorage({
|
|
key: 'loginMobile',
|
|
data: this.mobile,
|
|
success: function() {
|
|
console.log('success', 8686668)
|
|
}
|
|
});
|
|
uni.showToast({
|
|
title: 'Successful login',
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
setTimeout(function() {
|
|
uni.reLaunch({
|
|
url: '../menu/index/index'
|
|
})
|
|
}, 1500)
|
|
console.log(uni.getStorageSync('logInfo').data, 66666666666666666666)
|
|
} else {
|
|
uni.showToast({
|
|
title: res.data.errMsg,
|
|
icon: 'none',
|
|
duration: 2500
|
|
})
|
|
}
|
|
|
|
|
|
|
|
},
|
|
fail: (res) => {
|
|
uni.showToast({
|
|
title: res.data.errMsg,
|
|
icon: 'none',
|
|
duration: 2500
|
|
})
|
|
console.log(res.data);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@import './index.css';
|
|
</style>
|
|
|