From 5d745c2c8854d2c1e94e5ee9004d5219681f6d7c Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期五, 29 十二月 2023 11:02:50 +0800
Subject: [PATCH] 增加图片验证码和登录日志
---
admin-web/src/views/login/index.vue | 127 ++++++++++++++++---------
admin-web/src/views/systemSetting/logs/loginLogs.vue | 111 ++++++++++++++++++++++
admin-web/public/static/config.js | 10 +-
admin-web/src/utils/auth.js | 2
4 files changed, 198 insertions(+), 52 deletions(-)
diff --git a/admin-web/public/static/config.js b/admin-web/public/static/config.js
index 547f1bd..4d0e4aa 100644
--- a/admin-web/public/static/config.js
+++ b/admin-web/public/static/config.js
@@ -4,12 +4,12 @@
const SettingIplatform = {
// 鏈嶅姟鍣ㄥ湴鍧�
// 涓婁紶璺緞
- ftpUrl: 'https://yqzx.jinmingyuan.com/lowConsum',//娴嬭瘯
- // ftpUrl: protocol + '//'+ host + '/file',// 姝e紡,
+ /*ftpUrl: 'https://yqzx.jinmingyuan.com/lowConsum',//娴嬭瘯
+ apiBaseURL: 'https://yqzx.jinmingyuan.com/lowConsum',//娴嬭瘯*/
// 鎺ュ彛璇锋眰鍦板潃
- // apiBaseURL: 'https://yqzx.jinmingyuan.com/lowConsum',//娴嬭瘯
- // apiBaseURL: 'http://127.0.0.1:8083/lowConsum',//寮�鍙�
- // apiBaseURL: 'http://172.16.60.155:8083/lowConsum',//寮�鍙�
+ /*ftpUrl: 'http://172.16.20.6:8083/lowConsum',//寮�鍙�
+ apiBaseURL: 'http://172.16.20.6:8083/lowConsum',//寮�鍙�*/
+ ftpUrl: protocol + '//'+ host + '/file',// 姝e紡,
apiBaseURL: protocol + '//'+ host + '/lowapi',// 姝e紡,
debug: false //璋冭瘯寮�鍏� true鏃朵細杈撳嚭璇锋眰鏃ュ織
};
diff --git a/admin-web/src/utils/auth.js b/admin-web/src/utils/auth.js
index 7607ab9..b490a6b 100644
--- a/admin-web/src/utils/auth.js
+++ b/admin-web/src/utils/auth.js
@@ -1,6 +1,6 @@
import storage from 'store';
-const TokenKey = 'iplatform_token';
+const TokenKey = 'low_consum_iplatform_token';
const userKey = 'user'
const userInfo = 'userInfo'
export function getToken() {
diff --git a/admin-web/src/views/login/index.vue b/admin-web/src/views/login/index.vue
index f0a9ca2..bbec4a5 100644
--- a/admin-web/src/views/login/index.vue
+++ b/admin-web/src/views/login/index.vue
@@ -52,24 +52,20 @@
:icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"
/></span>
</el-form-item>
-<!-- <el-form-item prop="code" class="captcha" v-if="loginForm.verifyType==='code' && captchaEnabled">-->
-<!-- <div class="captcha">-->
-<!-- <el-input-->
-<!-- v-model.trim="loginForm.code"-->
-<!-- style="width: 218px"-->
-<!-- prefix-icon="el-icon-message"-->
-<!-- placeholder="楠岃瘉鐮�"-->
-<!-- type="text"-->
-<!-- tabindex="3"-->
-<!-- autocomplete="off"-->
-<!-- />-->
-<!-- <div class="imgs" @click="getCode()">-->
-<!-- <!– <img :src="captchatImg" />–>-->
-<!-- <img :src="codeUrl"/>-->
-<!-- <span v-show="showCaptchatImg">宸插け鏁�</span>-->
-<!-- </div>-->
-<!-- </div>-->
-<!-- </el-form-item>-->
+ <el-form-item prop="code" class="captcha" v-if="loginForm.verifyType==='code' && captchaEnabled">
+ <el-input
+ v-model.trim="loginForm.code"
+ style="width: 218px"
+ placeholder="楠岃瘉鐮�"
+ type="text"
+ tabindex="3"
+ autocomplete="off"
+ />
+ <div class="imgs" @click="getCode()">
+ <img :src="codeUrl"/>
+ <span v-show="showCaptchatImg">宸插け鏁�</span>
+ </div>
+ </el-form-item>
<el-button
id="loginBtn"
:loading="loading"
@@ -127,18 +123,13 @@
},
},
loginForm: {
- account: 'jmy123456', // admin
- password: 'Adu_8097',
+ account: '', // admin
+ password: '',
// key: '',
uuid: '',
code: '',
loginType: 'user_pass', // 鐢ㄦ埛鍚嶃�佸瘑鐮佹柟寮忕櫥褰�
verifyType: 'code' // 'code': 楠岃瘉鐮� 'slide':婊戝潡 'jigsaw':鎷煎浘
- // captcha: {
- // captchaVerification: '',
- // secretKey: '',
- // token: '',
- // },
},
loginRules: {
account: [{required: true, trigger: 'blur', message: '璇疯緭鍏ョ敤鎴峰悕'}], // validator: validateUsername
@@ -154,7 +145,7 @@
disabled: false,
isWeixin: this.$wechat.isWeixin(),
// 楠岃瘉鐮佸紑鍏�
- captchaEnabled: true
+ captchaEnabled: false
};
},
components: {},
@@ -272,7 +263,7 @@
if (this.loginForm.verifyType === 'code') {
getCodeImg().then(data => {
this.captchaEnabled = data.captchaEnabled === undefined ? true : data.captchaEnabled;
- console.log("captchaEnabled = " + this.captchaEnabled);
+
if (this.captchaEnabled) {
this.codeUrl = "data:image/jpeg;base64," + data.img;
}
@@ -328,16 +319,20 @@
color: $cursor;
}
}
+
.flex-1 {
flex: 1;
}
+
.min-1200 {
min-width: 1200px;
}
+
/* reset element-ui css */
.login-container {
- padding:50px;
+ padding: 50px;
line-height: 54px;
+
.el-form-item__content {
display: flex;
flex: 1;
@@ -347,18 +342,20 @@
background-color: #F1F3F5;
border-radius: 4px;
}
+
.el-input {
flex: 1;
margin-left: 6px;
position: relative;
background-color: #F1F3F5;
top: 3px;
+
input {
border: none;
padding: 0;
font-size: 16px;
line-height: 54px;
- background: #F1F3F5;
+ // background: #F1F3F5;
color: #333333;
}
}
@@ -366,9 +363,34 @@
</style>
<style lang="scss" scoped>
+.captcha {
+ display: flex;
+ align-items: flex-start;
+}
+
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;
+.imgs {
+ position: relative;
+ height: 36px;
+ cursor: pointer;
+
+ img {
+ height: 100%;
+ }
+
+ span {
+ width: 84px;
+ line-height: 36px;
+ display: inline-block;
+ background: rgba(0, 0, 0, 0.4);
+ position: absolute;
+ left: 0;
+ color: #fff;
+ }
+}
+
.login-container {
height: 100%;
width: 100%;
@@ -377,45 +399,53 @@
background-size: cover;
position: relative;
}
-.school-logo{
+
+.school-logo {
position: absolute;
- top:30px;
+ top: 30px;
left: 40px;
}
-.form-main{
+
+.form-main {
background-color: #FFFFFF;
overflow: hidden;
border-radius: 8px;
}
->>>.el-button{
+
+> > > .el-button {
font-size: 16px;
}
-.logo-name{
- width: 336px;
- height: 51px;
+
+.logo-name {
margin-bottom: 30px;
}
-.logo-lf{
- width:100%;
+
+.logo-lf {
+ width: 100%;
}
-.login-box{
- padding:100px;
- .title{
+
+.login-box {
+ padding: 100px;
+
+ .title {
font-size: 22px;
font-weight: bold;
}
- .f-lable{
+
+ .f-lable {
line-height: 20px;
margin-bottom: 10px;
font-size: 14px;
color: #333333;
}
}
+
.w1050 {
width: 1050px;
margin: 0 auto;
overflow: hidden;
}
+
.login-btn {
width: 100%;
height: 45px;
@@ -424,11 +454,13 @@
color: #FFFFFF;
background-color: #0d997c;
}
+
.logo-txt {
position: absolute;
top: 5%;
left: 2%;
}
+
.txtBox {
color: #fff;
opacity: 0.7;
@@ -441,24 +473,27 @@
line-height: 30px;
width: 610px;
}
-.show-pwd{
+
+.show-pwd {
position: relative;
- top:5px;
+ top: 5px;
right: 5px;
cursor: pointer;
}
+
.td-outer-wrapper {
width: 1200px !important;
margin: 0 auto !important;
}
+
@media screen and(max-width: 1400px) {
.w1050 {
width: 850px;
margin: 0 auto;
overflow: hidden;
}
- .login-box{
- padding:40px;
+ .login-box {
+ padding: 40px;
}
}
</style>
diff --git a/admin-web/src/views/systemSetting/logs/loginLogs.vue b/admin-web/src/views/systemSetting/logs/loginLogs.vue
new file mode 100644
index 0000000..b05036c
--- /dev/null
+++ b/admin-web/src/views/systemSetting/logs/loginLogs.vue
@@ -0,0 +1,111 @@
+<template>
+ <div class="app-container">
+ <el-card class="box-card" shadow="never" style="width: 100%">
+ <!--鎼滅储鏉′欢-->
+ <div class="filter-container">
+ <my-search ref="searchBar" :items="items" @search="fifterForm"></my-search>
+ </div>
+ <div style="margin-top: 15px">
+ <!--鍒楄〃-->
+ <my-table-v2 ref="myTable" :filter="filterFrom" :table="table"/>
+ </div>
+
+ </el-card>
+ </div>
+</template>
+
+<script>
+import MyTableV2 from "@/components/myTable/myTableV2";
+import SettingIplatform from "@/utils/settingIplatform";
+import {LongToDateTime} from "@/utils/DateFormatter";
+
+export default {
+ components: {MyTableV2},
+ data() {
+ return {
+ items: [
+ {
+ type: 'text',
+ dataIndex: 'userName',
+ label: '鐧诲綍璐﹀彿',
+ placeholder: '璇疯緭鍏�',
+ defaultValue: ''
+ }
+ ],
+ // 鎼滅储鏉′欢
+ filterFrom: {
+ userName: null,
+ },
+ // 琛ㄦ牸鏁版嵁
+ table: {
+ showIndex: true, // 鏄惁鏄剧ず搴忓彿
+ expand: false, // 鏄惁鏄剧ず璇︽儏鏁版嵁
+ url: SettingIplatform.apiBaseURL + '/pc/p/login/info/list', // 璇锋眰鍦板潃
+ // 宸ュ叿鏉�
+ tools: {
+ columnsCtrl: {// 鍒楁帶鍒舵寜閽�
+ show: false
+ },
+ generalExport: {// 閫氱敤瀵煎嚭鎸夐挳
+ show: false
+ },
+ // 鑷畾涔夊伐鍏锋潯鎸夐挳
+ custom: []
+ },
+ // 鍒椾俊鎭�
+ columns: [
+ {title: '鐧诲綍璐﹀彿', field: 'userName', align: 'left', minWidth: 110},
+ {title: '鐧诲綍IP', field: 'ipaddr', align: 'center'},
+ {title: '娴忚鍣ㄧ被鍨�', field: 'browser', align: 'center'},
+ {
+ title: '鐧诲綍鐘舵��', field: 'status', align: 'center', formatter: row => {
+ return {value: row.status == 1 ? '鐧诲綍鎴愬姛' : '鐧诲綍澶辫触'}
+ }
+ },
+ {title: '鎻愮ず娑堟伅', field: 'msg', align: 'left'},
+ {
+ title: '璁块棶鏃堕棿', field: 'login_time', align: 'center', width: 180, formatter: row => {
+ return {value: LongToDateTime(row.loginTime)}
+ }
+ },
+ ],
+ // 鎿嶄綔淇℃伅
+ operation: {
+ show: false, // 鏄剧ず鎿嶄綔鍒�
+ },
+ paging: {
+ show: true, // 鏄剧ず鍒嗛〉
+ // 鍒嗛〉淇℃伅
+ page: {
+ small: false,
+ pageNumber: 1,
+ pageSize: 10,
+ total: 0
+ }
+ }
+ },
+ }
+ },
+ mounted() {
+ },
+ methods: {
+
+ // 鏌ヨtable鍒楄〃
+ search(pageNumber) {
+ if (pageNumber != undefined) {
+ this.$refs.myTable.search(pageNumber)
+ } else {
+ this.$refs.myTable.search()
+ }
+ },
+ fifterForm(params) {
+ this.filterFrom = Object.assign(this.filterFrom, params)
+ this.search(1)
+ },
+ }
+}
+</script>
+
+<style scoped>
+
+</style>
--
Gitblit v1.9.1