From 09da100729793848bc01b51f7b05ca3f1e7ec64f Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 20 六月 2024 14:05:35 +0800
Subject: [PATCH] 提交一把
---
company/src/views/login.vue | 367 ++++++++++++++++++++++++++++++----------------------
1 files changed, 213 insertions(+), 154 deletions(-)
diff --git a/company/src/views/login.vue b/company/src/views/login.vue
index b459972..9faf637 100644
--- a/company/src/views/login.vue
+++ b/company/src/views/login.vue
@@ -1,7 +1,7 @@
<template>
<div class="wrap">
<div class="introduce">
- <h2>棰勯�夋竻鍗曟煡璇㈢郴缁�</h2>
+ <h2>{{systemTitle}}</h2>
</div>
<div class="login">
<h1>绯荤粺鐧诲綍 / LOGIN IN</h1>
@@ -22,173 +22,222 @@
<template v-else>
<el-input v-model="phone" placeholder="璇疯緭鍏ユ墜鏈哄彿" prefix-icon="el-icon-phone" maxlength="11" v-trim/>
<div class="captcha-input">
- <el-input v-model="code" placeholder="璇疯緭鍏ラ獙璇佺爜" prefix-icon="eva-icon-shield" maxlength="4" @keypress.enter.native="login" v-trim/>
+ <el-input v-model="code" placeholder="璇疯緭鍏ラ獙璇佺爜" prefix-icon="eva-icon-shield" @keypress.enter.native="login" v-trim/>
<el-button type="primary" style="width: 120px; margin-left: 20px;" @click="send" v-if="num === 0">鍙戦�侀獙璇佺爜</el-button>
<el-button type="primary" style="width: 120px; margin-left: 20px;" v-else>{{num}}</el-button>
</div>
</template>
</div>
- <el-button :loading="loading" @click="login">鐧� 褰�</el-button>
+ <div style="text-align: left;margin-bottom: 15px;font-size: 14px">
+ <el-checkbox :true-label="1" :false-label="0" v-model="readed"/>
+ 鎴戝凡闃呰鍜屽悓鎰忋��<span @click="agreeType=0;title1='鏈嶅姟鍗忚';visible1=true" style="color: dodgerblue;cursor: pointer">鏈嶅姟鍗忚</span>銆嬪拰
+ 銆�<span @click="agreeType=1;title1='闅愮鍗忚';visible1=true" style="color: dodgerblue;cursor: pointer">闅愮鍗忚</span>銆�
+ </div>
+ <el-button :loading="loading" @click="login">鐧� 褰�</el-button>
</div>
+ <el-dialog
+ class="center-title"
+ :title="title1"
+ width="70%"
+ height="70%"
+ text="鐢ㄦ埛鍗忚"
+ :visible.sync="visible1"
+ >
+ <div class="agree-list" v-if="agreeType==0" v-html="agreement0">
+ </div>
+ <div class="agree-list" v-else v-html="agreement1">
+ </div>
+ <template v-slot:footer>
+ <el-button type="primary" @click="readed=1;visible1=false">鍚屾剰</el-button>
+ <el-button @click="visible1=false">杩斿洖</el-button>
+ </template>
+ </el-dialog>
</div>
+
</template>
-
<script>
- import { mapMutations } from 'vuex'
- import { getCaptcha, loginByPassword, loginByPhone } from '@/api/system/common'
- import { sendSms } from '@/api/business/smsEmail'
+import { mapMutations } from 'vuex'
+import { getCaptcha, loginByPassword, loginByPhone } from '@/api/system/common'
+import { sendSms } from '@/api/business/smsEmail'
+import { getAgreement } from '@/api/system/dict'
- export default {
- name: 'Login',
- data () {
- return {
- loading: false,
- username: '',
- password: '',
- phone: '',
- code: '',
- active: 1,
- num: 0,
- timer: null,
- // 楠岃瘉鐮�
- captcha: {
- loading: false,
- value: '',
- uuid: '',
- uri: ''
- }
- }
- },
- methods: {
- ...mapMutations(['setUserInfo']),
- handleClick(e) {
- this.active = e
- this.username = ''
- this.password = ''
- this.phone = ''
- this.code = ''
- },
- send() {
- if (!this.phone) {
- this.$message.warning('璇峰厛杈撳叆鎵嬫満鍙�')
- return
- }
- var reg = /^1[3456789]\d{9}$/;
- if (!reg.test(this.phone)) {
- this.$message.warning('鎵嬫満鍙蜂笉鍚堟硶')
- return
- }
- sendSms({
- phone: this.phone
- }).then(res => {
- this.num = 60
- this.setTimer()
- })
- },
- setTimer () {
- this.timer = setInterval(() => {
- if (this.num === 0) {
- this.num = 0
- clearInterval(this.timer)
- this.timer = null
- return
- }
- this.num -= 1
- }, 1000)
- },
- // 鐧诲綍
- login () {
- if (this.loading) {
- return
- }
- if (this.active === 1) {
- if (!this.__check()) {
- return
- }
- this.loading = true
- loginByPassword({
- username: this.username.trim(),
- password: this.password,
- code: this.captcha.value.trim(),
- uuid: this.captcha.uuid
- })
- .then(() => {
- window.location.href = process.env.VUE_APP_CONTEXT_PATH
- })
- .catch(e => {
- this.refreshCaptcha()
- this.$tip.apiFailed(e)
- })
- .finally(() => {
- this.loading = false
- })
- } else {
- if (!this.phone) {
- this.$tip.error('璇疯緭鍏ユ墜鏈哄彿')
- return
- }
- if (!this.code) {
- this.$tip.error('璇疯緭鍏ラ獙璇佺爜')
- return
- }
- this.loading = true
- loginByPhone({
- phone: this.phone,
- code: this.code.trim()
- })
- .then(() => {
- window.location.href = process.env.VUE_APP_CONTEXT_PATH
- })
- .catch(e => {
- this.$tip.apiFailed(e)
- })
- .finally(() => {
- this.loading = false
- })
- }
- },
- // 鍒锋柊楠岃瘉鐮�
- refreshCaptcha () {
- this.captcha.loading = true
- getCaptcha()
- .then(data => {
- this.captcha.uri = data.image
- this.captcha.uuid = data.uuid
- })
- .catch(e => {
- this.$tip.apiFailed(e)
- })
- .finally(() => {
- setTimeout(() => {
- this.captcha.loading = false
- }, 150)
- })
- },
- // 鐧诲綍鍓嶉獙璇�
- __check () {
- if (this.username.trim() === '') {
- this.$tip.error('璇疯緭鍏ョ敤鎴峰悕')
- return false
- }
- if (this.password === '') {
- this.$tip.error('璇疯緭鍏ュ瘑鐮�')
- return false
- }
- if (this.captcha.value.trim() === '') {
- this.$tip.error('璇疯緭鍏ュ浘鐗囬獙璇佺爜')
- return false
- }
- return true
- }
- },
- created () {
- this.refreshCaptcha()
- }
+export default {
+ name: 'Login',
+ data () {
+ return {
+ title1:'鏈嶅姟鍗忚',
+ systemTitle: process.env.VUE_APP_SYSTEM_TITLE,
+ loading: false,
+ username: '',
+ password: '',
+ phone: '',
+ visible1:false,
+ code: '',
+ readed: 0,
+ agreeType:'',
+ active: 1,
+ num: 0,
+ timer: null,
+ agreement0: '杩欐槸鏈嶅姟鍗忚',
+ agreement1: '杩欐槸闅愮鍗忚',
+ // 楠岃瘉鐮�
+ captcha: {
+ loading: false,
+ value: '',
+ uuid: '',
+ uri: ''
+ }
}
+ },
+ methods: {
+ ...mapMutations(['setUserInfo']),
+ handleClick (e) {
+ this.active = e
+ this.username = ''
+ this.password = ''
+ this.phone = ''
+ this.code = ''
+ },
+ getAgree () {
+ getAgreement({}).then(res => {
+ if (res && res.length >= 2) {
+ this.agreement0 = res[0]
+ this.agreement1 = res[1]
+ }
+ })
+ },
+ send () {
+ if (!this.phone) {
+ this.$message.warning('璇峰厛杈撳叆鎵嬫満鍙�')
+ return
+ }
+ var reg = /^1[3456789]\d{9}$/
+ if (!reg.test(this.phone)) {
+ this.$message.warning('鎵嬫満鍙蜂笉鍚堟硶')
+ return
+ }
+ sendSms({
+ phone: this.phone
+ }).then(res => {
+ this.num = 60
+ this.setTimer()
+ })
+ },
+ setTimer () {
+ this.timer = setInterval(() => {
+ if (this.num === 0) {
+ this.num = 0
+ clearInterval(this.timer)
+ this.timer = null
+ return
+ }
+ this.num -= 1
+ }, 1000)
+ },
+ // 鐧诲綍
+ login () {
+ if (this.loading) {
+ return
+ }
+ if (this.readed != 1) {
+ this.$message.error('璇峰厛闃呰鍜屽悓鎰忋�婃湇鍔″崗璁�嬪拰銆婇殣绉佸崗璁��')
+ return
+ }
+ if (this.active === 1) {
+ if (!this.__check()) {
+ return
+ }
+ this.loading = true
+ loginByPassword({
+ username: this.username.trim(),
+ password: this.password,
+ code: this.captcha.value.trim(),
+ uuid: this.captcha.uuid
+ })
+ .then(() => {
+ window.location.href = process.env.VUE_APP_CONTEXT_PATH
+ })
+ .catch(e => {
+ this.refreshCaptcha()
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.loading = false
+ })
+ } else {
+ if (!this.phone) {
+ this.$tip.error('璇疯緭鍏ユ墜鏈哄彿')
+ return
+ }
+ if (!this.code) {
+ this.$tip.error('璇疯緭鍏ラ獙璇佺爜')
+ return
+ }
+ this.loading = true
+ loginByPhone({
+ phone: this.phone,
+ code: this.code.trim()
+ })
+ .then(() => {
+ window.location.href = process.env.VUE_APP_CONTEXT_PATH
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ this.loading = false
+ })
+ }
+ },
+ // 鍒锋柊楠岃瘉鐮�
+ refreshCaptcha () {
+ this.captcha.loading = true
+ getCaptcha()
+ .then(data => {
+ this.captcha.uri = data.image
+ this.captcha.uuid = data.uuid
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ .finally(() => {
+ setTimeout(() => {
+ this.captcha.loading = false
+ }, 150)
+ })
+ },
+ // 鐧诲綍鍓嶉獙璇�
+ __check () {
+ if (this.username.trim() === '') {
+ this.$tip.error('璇疯緭鍏ョ敤鎴峰悕')
+ return false
+ }
+ if (this.password === '') {
+ this.$tip.error('璇疯緭鍏ュ瘑鐮�')
+ return false
+ }
+ if (this.captcha.value.trim() === '') {
+ this.$tip.error('璇疯緭鍏ュ浘鐗囬獙璇佺爜')
+ return false
+ }
+ return true
+ }
+ },
+ created () {
+ this.refreshCaptcha()
+ this.getAgree()
+ document.title = this.systemTitle
+ }
+}
</script>
<style scoped lang="scss">
@import "@/assets/style/variables.scss";
+ .agree-list{
+ height: 550px;
+ //max-height: 50%;
+ overflow: auto;
+ }
$input-gap: 30px;
.wrap {
display: flex;
@@ -263,7 +312,7 @@
}
}
.info-input {
- margin-bottom: 60px;
+ margin-bottom: 15px;
/deep/ .el-input {
margin-top: 30px;
&:first-child {
@@ -311,4 +360,14 @@
}
}
}
+ ::v-deep .center-title .el-dialog__title {
+ text-align: center;
+ width: 100%;
+ font-size: 18px;
+ font-weight: bold;
+
+ }
+ ::v-deep .el-dialog__header{
+ text-align: center;
+ }
</style>
--
Gitblit v1.9.3