From c04d741f6daddd9e445a0d00adc42d1c8c45f67f Mon Sep 17 00:00:00 2001
From: weimingfei <fei_gaming@sina.com>
Date: 星期五, 23 一月 2026 10:40:33 +0800
Subject: [PATCH] 钥匙柜同步柜格实际钥匙数据
---
admin/src/views/login.vue | 240 ++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 177 insertions(+), 63 deletions(-)
diff --git a/admin/src/views/login.vue b/admin/src/views/login.vue
index 652081b..5c64f46 100644
--- a/admin/src/views/login.vue
+++ b/admin/src/views/login.vue
@@ -3,45 +3,64 @@
<img src="@/assets/images/bg@2x.png" class="main_bg" alt="">
<div class="login_wrap">
<div class="login_img">
- <div class="h3">鏅烘収鐗╂祦鍥尯瀹夋秷涓�浣撳寲绯荤粺</div>
+ <div class="h3" style="font-size: 30px; margin-bottom: 0;">{{sysConfig.title || ''}}</div>
+ <div class="h3">{{sysConfig.subtitle || title}}</div>
</div>
<div class="form_wrap">
- <!-- <div class="tabs">
- <div class="tab active">
+ <div class="tabs">
+ <div class="tab" @click="tabClick('0')" :class="{ active: activeTab == '0' }">
<div class="name">甯愬彿鐧诲綍</div>
<div class="icon"></div>
</div>
- <div class="tab">
+ <div class="tab" @click="tabClick('1')" :class="{ active: activeTab == '1' }">
<div class="name">鎵嬫満鐧诲綍</div>
<div class="icon"></div>
</div>
- </div> -->
- <div class="df_ac">
- <div class="label">甯愬彿</div>
- <div class="line">
- <el-input v-model="username" placeholder="璇疯緭鍏ュ笎鍙�" maxlength="50" v-trim />
- </div>
</div>
- <div class="df_ac">
- <div class="label">瀵嗙爜</div>
- <div class="line">
- <el-input v-model="password" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" maxlength="30" show-password />
+ <template v-if="activeTab == '0'">
+ <div class="df_ac">
+ <div class="label">甯愬彿</div>
+ <div class="line">
+ <el-input v-model="username" placeholder="璇疯緭鍏ュ笎鍙�" maxlength="50" v-trim />
+ </div>
</div>
- </div>
+ <div class="df_ac">
+ <div class="label">瀵嗙爜</div>
+ <div class="line">
+ <el-input v-model="password" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" maxlength="30" show-password />
+ </div>
+ </div>
+ <div class="df_ac">
+ <div class="label">楠岃瘉鐮�</div>
+ <div class="line">
+ <el-input v-model="captcha.value" placeholder="璇疯緭鍏ラ獙璇佺爜" maxlength="4" @keypress.enter.native="login" />
+ <img v-if="!captcha.loading" class="code_image" :src="captcha.uri" @click="refreshCaptcha">
+ <span v-else><i class="el-icon-loading"></i></span>
+ </div>
+ </div>
+ </template>
+ <template v-if="activeTab == '1'">
+ <div class="df_ac">
+ <div class="label">鎵嬫満鍙�</div>
+ <div class="line">
+ <el-input v-model="phone" placeholder="璇疯緭鍏ユ墜鏈哄彿" type="text" maxlength="16" />
+ </div>
+ </div>
+ <div class="df_ac">
+ <div class="label">楠岃瘉鐮�</div>
+ <div class="line">
+ <el-input v-model="smsCode" placeholder="璇疯緭鍏ラ獙璇佺爜" maxlength="6" @keypress.enter.native="login" />
+ <span v-if="downTime == 0" class="code_get" @click="getCode">鑾峰彇楠岃瘉鐮�</span>
+ <span v-else class="code_get downtime">{{ downTime }}</span>
+ </div>
+ </div>
+ </template>
- <div class="df_ac">
- <div class="label">楠岃瘉鐮�</div>
- <div class="line">
- <el-input v-model="captcha.value" placeholder="璇疯緭鍏ラ獙璇佺爜" maxlength="4" @keypress.enter.native="login" />
- <img v-if="!captcha.loading" class="code_image" :src="captcha.uri" @click="refreshCaptcha">
- <span v-else><i class="el-icon-loading"></i></span>
- </div>
- </div>
- <el-button :loading="loading" type="primary" class="login_btn"
- @click.native.prevent="login">绔嬪嵆鐧诲綍</el-button>
+ <el-button :loading="loading" type="primary" class="login_btn" @click.native.prevent="login">绔嬪嵆鐧诲綍</el-button>
<div class="btn_wrap">
<el-checkbox v-model="isRemPsd">
- <span style="font-size: 13px; font-weight: 400" class="placeholder9">璁颁綇瀵嗙爜</span>
+ <span style="font-size: 13px; font-weight: 400" class="placeholder9">{{ activeTab == 0 ? '璁颁綇瀵嗙爜' : '璁颁綇鎵嬫満鍙�'
+ }}</span>
</el-checkbox>
</div>
<div class="google">
@@ -54,18 +73,24 @@
</template>
<script>
-import { mapMutations } from 'vuex'
-import { getCaptcha, loginByPassword } from '@/api/system/common'
-import Cookies from "js-cookie"
+import { mapMutations, mapState } from 'vuex'
+import { getCaptcha, loginByPassword, sendSmsPost, loginByPhone, getSystemConfig } from '@/api/system/common'
+import Cookies from 'js-cookie'
+import { Message } from 'element-ui'
export default {
name: 'Login',
- data() {
+ data () {
return {
+ title: process.env.VUE_APP_TITLE,
loading: false,
isRemPsd: false,
username: '',
password: '',
+ phone: '',
+ downTime: 0,
+ smsCode: '',
+ activeTab: '0',
// 楠岃瘉鐮�
captcha: {
loading: false,
@@ -75,54 +100,108 @@
}
}
},
- mounted() {
+ computed: {
+ ...mapState(['sysConfig'])
+ },
+ mounted () {
this.username = localStorage.getItem('username') || ''
this.password = localStorage.getItem('password') || ''
+ this.phone = localStorage.getItem('phone') || ''
const isRemPsd = localStorage.getItem('isRemPsd') || false
this.isRemPsd = JSON.parse(isRemPsd)
this.refreshCaptcha()
+ this.getSystemConfig()
},
methods: {
- ...mapMutations(['setUserInfo']),
+ ...mapMutations(['setUserInfo', 'setSysconfig']),
+ getSystemConfig () {
+ getSystemConfig()
+ .then((res) => {
+ if (res && res.subtitle) {
+ this.setSysconfig(res)
+ }
+ })
+ },
// 鐧诲綍
- login() {
+ login () {
if (this.loading) {
return
}
- 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((res) => {
- // window.location.href = process.env.VUE_APP_CONTEXT_PATH
+ if (this.activeTab == 0) {
+ 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((res) => {
+ // window.location.href = process.env.VUE_APP_CONTEXT_PATH
+ if (this.isRemPsd) {
+ localStorage.setItem('username', this.username.trim())
+ localStorage.setItem('password', this.password.trim())
+ localStorage.setItem('isRemPsd', this.isRemPsd)
+ } else {
+ localStorage.removeItem('username')
+ localStorage.removeItem('password')
+ localStorage.removeItem('isRemPsd')
+ }
+ Cookies.set('dm_user_token', res)
+ this.$router.push('index')
+ })
+ .catch(e => {
+ this.refreshCaptcha()
+ })
+ .finally(() => {
+ this.loading = false
+ })
+ } else {
+ const { smsCode, phone } = this
+ if (!phone || phone.length != 11) {
+ return Message.error('璇疯緭鍏ユ纭殑鎵嬫満鍙�')
+ }
+ if (!smsCode) {
+ return Message.error('璇疯緭鍏ラ獙璇佺爜')
+ }
+ this.loading = true
+ loginByPhone({ phone, code: smsCode }).then(res => {
if (this.isRemPsd) {
- localStorage.setItem('username', this.username.trim())
- localStorage.setItem('password', this.password.trim())
- localStorage.setItem('isRemPsd', this.isRemPsd)
- } else {
- localStorage.removeItem('username')
- localStorage.removeItem('password')
- localStorage.removeItem('isRemPsd')
+ localStorage.setItem('phone', this.username.trim())
}
Cookies.set('dm_user_token', res)
this.$router.push('index')
- })
- .catch(e => {
+ }).catch(e => {
this.refreshCaptcha()
- // this.$tip.apiFailed(e)
- })
- .finally(() => {
+ }).finally(() => {
this.loading = false
})
+ }
+ },
+ getCode () {
+ console.log('getCode')
+ const { phone } = this
+ if (!phone || phone.length != 11) {
+ return Message.error('璇疯緭鍏ユ纭殑鎵嬫満鍙�')
+ }
+ sendSmsPost({ phone, type: 0 }).then(res => {
+ Message.success('鐭俊鍙戦�佹垚鍔�')
+ this.downTime = 60
+ const timer = setInterval(() => {
+ if (this.downTime == 0) {
+ return clearInterval(timer)
+ }
+ this.downTime--
+ }, 1000)
+ })
+ },
+ tabClick (val) {
+ this.activeTab = val
},
// 鍒锋柊楠岃瘉鐮�
- refreshCaptcha() {
+ refreshCaptcha () {
this.captcha.loading = true
getCaptcha()
.then(data => {
@@ -139,7 +218,7 @@
})
},
// 鐧诲綍鍓嶉獙璇�
- __check() {
+ __check () {
if (this.username.trim() === '') {
this.$tip.error('璇疯緭鍏ョ敤鎴峰悕')
return false
@@ -154,7 +233,7 @@
}
return true
}
- },
+ }
}
</script>
@@ -199,10 +278,24 @@
height: 600px;
background: url("../assets/images/login_img@2x.png");
background-size: 100% 100%;
- padding-left: 40px;
- padding-top: 80px;
+ padding-top: 60px;
+
+ .h2 {
+ color: $primary-color;
+ background-color: #fff;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 4px;
+ text-align: center;
+ width: 208px;
+ display: flex;
+ margin-bottom: 12px;
+ }
.h3 {
+ text-align: center;
font-size: 28px;
font-weight: 700;
color: #fff;
@@ -221,7 +314,7 @@
background-color: #fff;
box-sizing: border-box;
/* padding: 50px 80px 20px; */
- padding: 80px 80px 20px;
+ padding: 50px 80px 20px;
position: relative;
.tabs {
@@ -236,6 +329,7 @@
flex-direction: column;
justify-content: center;
align-items: center;
+ cursor: pointer;
.icon {
width: 36px;
@@ -287,9 +381,12 @@
margin-bottom: 17px;
display: flex;
width: 100%;
+ align-items: center;
+ position: relative;
.el-input {
height: 40px;
+ flex: 1;
// font-size: 14px;
::v-deep .el-input__inner {
@@ -301,6 +398,23 @@
width: 100px;
margin-left: 10px;
}
+
+ .code_get {
+ position: absolute;
+ top: 10px;
+ right: 10px;
+ font-size: 14px;
+ width: 72px;
+ z-index: 11;
+ margin-left: 10px;
+ cursor: pointer;
+ color: $primary-color;
+ text-align: right;
+ }
+
+ .downtime {
+ color: #999999;
+ }
}
.forget {
--
Gitblit v1.9.3