|
@@ -60,16 +60,16 @@
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import { authLogin, loginByPass, loginBySmsCode, smsCode } from '@/api/login';
|
|
|
|
-import moment from '@/common/moment';
|
|
|
|
|
|
+import { authLogin, loginByPass, loginBySmsCode, smsCode } from '@/api/login'
|
|
|
|
+import moment from '@/common/moment'
|
|
export default {
|
|
export default {
|
|
- data() {
|
|
|
|
|
|
+ data () {
|
|
return {
|
|
return {
|
|
loginParams: {
|
|
loginParams: {
|
|
- username: 'xiudo',
|
|
|
|
|
|
+ username: '',
|
|
code: '',
|
|
code: '',
|
|
- password: '123456',
|
|
|
|
- uuid: null,
|
|
|
|
|
|
+ password: '',
|
|
|
|
+ uuid: null
|
|
},
|
|
},
|
|
codeImage: null,
|
|
codeImage: null,
|
|
btnLoading: false,
|
|
btnLoading: false,
|
|
@@ -78,90 +78,88 @@ export default {
|
|
loginByPass: true,
|
|
loginByPass: true,
|
|
smsCodeBtnDisabled: true,
|
|
smsCodeBtnDisabled: true,
|
|
userInfo: null
|
|
userInfo: null
|
|
- };
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
|
|
- onShow() {
|
|
|
|
|
|
+ onShow () {
|
|
if (this.$mStore.getters.hasLogin) {
|
|
if (this.$mStore.getters.hasLogin) {
|
|
- this.$mRouter.reLaunch({ route: '/pages/index/index' });
|
|
|
|
|
|
+ this.$mRouter.reLaunch({ route: '/pages/index/index' })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
// 页面生命周期 监听页面加载是否加载完成
|
|
// 页面生命周期 监听页面加载是否加载完成
|
|
- onLoad() {
|
|
|
|
- this.getCaptchaImage();
|
|
|
|
|
|
+ onLoad () {
|
|
|
|
+ this.getCaptchaImage()
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
// #ifdef MP-WEIXIN
|
|
- uni.hideHomeButton() // 会话过期更改页面跳转到登录页的跳转方式,并隐藏小房子
|
|
|
|
|
|
+ uni.hideHomeButton() // 会话过期更改页面跳转到登录页的跳转方式,并隐藏小房子
|
|
// #endif
|
|
// #endif
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
// 统一跳转路由
|
|
// 统一跳转路由
|
|
- navTo() {
|
|
|
|
- this.$mRouter.redirectTo({ route: '/pages/public/resetpassword' });
|
|
|
|
|
|
+ navTo () {
|
|
|
|
+ this.$mRouter.redirectTo({ route: '/pages/public/resetpassword' })
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
- // 获取验证码
|
|
|
|
- async getCaptchaImage() {
|
|
|
|
|
|
+ // 获取验证码
|
|
|
|
+ async getCaptchaImage () {
|
|
await this.$http
|
|
await this.$http
|
|
.get('/captchaImage', {})
|
|
.get('/captchaImage', {})
|
|
.then(async (r) => {
|
|
.then(async (r) => {
|
|
- this.codeImage = 'data:image/gif;base64,' + r.data.img;
|
|
|
|
- this.loginParams.uuid = r.data.uuid;
|
|
|
|
|
|
+ this.codeImage = 'data:image/gif;base64,' + r.data.img
|
|
|
|
+ this.loginParams.uuid = r.data.uuid
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
- this.loading = false;
|
|
|
|
- });
|
|
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 提交表单
|
|
// 提交表单
|
|
- async toLogin() {
|
|
|
|
- let cheRes, loginApi;
|
|
|
|
|
|
+ async toLogin () {
|
|
|
|
+ let cheRes, loginApi
|
|
if (this.loginByPass) {
|
|
if (this.loginByPass) {
|
|
- loginApi = loginByPass;
|
|
|
|
|
|
+ loginApi = loginByPass
|
|
cheRes = this.$mGraceChecker.check(
|
|
cheRes = this.$mGraceChecker.check(
|
|
this.loginParams,
|
|
this.loginParams,
|
|
this.$mFormRule.loginByPassRule
|
|
this.$mFormRule.loginByPassRule
|
|
- );
|
|
|
|
|
|
+ )
|
|
}
|
|
}
|
|
- //表单验证规则是否通过,否,终止登陆提示错误信息
|
|
|
|
|
|
+ // 表单验证规则是否通过,否,终止登陆提示错误信息
|
|
if (!cheRes) {
|
|
if (!cheRes) {
|
|
- this.$mHelper.toast(this.$mGraceChecker.error);
|
|
|
|
- return;
|
|
|
|
|
|
+ this.$mHelper.toast(this.$mGraceChecker.error)
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- this.handleLogin(this.loginParams, loginApi);
|
|
|
|
|
|
+ this.handleLogin(this.loginParams, loginApi)
|
|
},
|
|
},
|
|
// 登录
|
|
// 登录
|
|
- async handleLogin(params, loginApi) {
|
|
|
|
- this.btnLoading = true;
|
|
|
|
|
|
+ async handleLogin (params, loginApi) {
|
|
|
|
+ this.btnLoading = true
|
|
await this.$http
|
|
await this.$http
|
|
.post(loginApi, params)
|
|
.post(loginApi, params)
|
|
- .then( async r => {
|
|
|
|
- console.log(r);
|
|
|
|
- let rolelist = r.data.pages
|
|
|
|
- this.$mStore.commit('login', r.data);
|
|
|
|
|
|
+ .then(async r => {
|
|
|
|
+ console.log(r)
|
|
|
|
+ const rolelist = r.data.pages
|
|
|
|
+ this.$mStore.commit('login', r.data)
|
|
|
|
|
|
// 商家信息
|
|
// 商家信息
|
|
await this.$http.get('/getUserInfo').then(async (res) => {
|
|
await this.$http.get('/getUserInfo').then(async (res) => {
|
|
if (res.data) {
|
|
if (res.data) {
|
|
- console.log(res);
|
|
|
|
- this.$mStore.commit('setScenic',res.data)
|
|
|
|
|
|
+ console.log(res)
|
|
|
|
+ this.$mStore.commit('setScenic', res.data)
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ })
|
|
|
|
|
|
- this.$mHelper.toast('恭喜您,登录成功!');
|
|
|
|
-
|
|
|
|
- this.$mRouter.reLaunch({ route: `/pages/${rolelist[0].code}/${rolelist[0].code}`});
|
|
|
|
- this.btnLoading = false;
|
|
|
|
|
|
+ this.$mHelper.toast('恭喜您,登录成功!')
|
|
|
|
|
|
|
|
+ this.$mRouter.reLaunch({ route: `/pages/${rolelist[0].code}/${rolelist[0].code}` })
|
|
|
|
+ this.btnLoading = false
|
|
})
|
|
})
|
|
.catch(() => {
|
|
.catch(() => {
|
|
- this.btnLoading = false;
|
|
|
|
- });
|
|
|
|
|
|
+ this.btnLoading = false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- },
|
|
|
|
-};
|
|
|
|
|
|
+ }
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
@@ -275,7 +273,6 @@ export default {
|
|
background-color: #fff;
|
|
background-color: #fff;
|
|
border-bottom: 1px solid #e7e7e7;
|
|
border-bottom: 1px solid #e7e7e7;
|
|
|
|
|
|
-
|
|
|
|
.tit {
|
|
.tit {
|
|
height: 50upx;
|
|
height: 50upx;
|
|
line-height: 56upx;
|
|
line-height: 56upx;
|