From 791e70f228a6878d02d1b664588bdccf983b8811 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期一, 31 八月 2026 16:20:53 +0800
Subject: [PATCH] feat: 数据导入页重构——选择数据类型/模板下载并排/失败明细表格/导入进度抽屉侧栏
---
traffic-audit-web/src/components/AppHeader.vue | 76 +++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 1 deletions(-)
diff --git a/traffic-audit-web/src/components/AppHeader.vue b/traffic-audit-web/src/components/AppHeader.vue
index f4e1b04..aeec948 100644
--- a/traffic-audit-web/src/components/AppHeader.vue
+++ b/traffic-audit-web/src/components/AppHeader.vue
@@ -5,18 +5,62 @@
<span class="header-user">
<i class="el-icon-user"></i> {{ username }}
</span>
+ <el-button type="text" class="header-link" @click="openChangePwd">
+ <i class="el-icon-key"></i> 淇敼瀵嗙爜
+ </el-button>
<el-button type="text" class="header-logout" @click="logout">
<i class="el-icon-switch-button"></i> 閫�鍑虹櫥褰�
</el-button>
</div>
+
+ <el-dialog title="淇敼瀵嗙爜" :visible.sync="pwdDialogVisible" width="420px" @closed="resetPwdForm">
+ <el-form ref="pwdForm" :model="pwdForm" :rules="pwdRules" label-width="90px">
+ <el-form-item label="鍘熷瘑鐮�" prop="oldPassword">
+ <el-input v-model="pwdForm.oldPassword" type="password" show-password placeholder="璇疯緭鍏ュ師瀵嗙爜"></el-input>
+ </el-form-item>
+ <el-form-item label="鏂板瘑鐮�" prop="newPassword">
+ <el-input v-model="pwdForm.newPassword" type="password" show-password placeholder="鑷冲皯 6 浣�"></el-input>
+ </el-form-item>
+ <el-form-item label="纭鏂板瘑鐮�" prop="confirmPassword">
+ <el-input v-model="pwdForm.confirmPassword" type="password" show-password placeholder="鍐嶆杈撳叆鏂板瘑鐮�"></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer">
+ <el-button @click="pwdDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" :loading="pwdSaving" @click="submitPwd">淇濆瓨</el-button>
+ </div>
+ </el-dialog>
</el-header>
</template>
<script>
+import api from '@/api'
+
export default {
name: 'AppHeader',
props: {
title: { type: String, required: true }
+ },
+ data() {
+ return {
+ pwdDialogVisible: false,
+ pwdSaving: false,
+ pwdForm: { oldPassword: '', newPassword: '', confirmPassword: '' },
+ pwdRules: {
+ oldPassword: [{ required: true, message: '璇疯緭鍏ュ師瀵嗙爜', trigger: 'blur' }],
+ newPassword: [
+ { required: true, message: '璇疯緭鍏ユ柊瀵嗙爜', trigger: 'blur' },
+ { min: 6, message: '鏂板瘑鐮侀暱搴︿笉鑳藉皯浜� 6 浣�', trigger: 'blur' }
+ ],
+ confirmPassword: [
+ { required: true, message: '璇峰啀娆¤緭鍏ユ柊瀵嗙爜', trigger: 'blur' },
+ {
+ validator: (rule, value, cb) => (value === this.pwdForm.newPassword ? cb() : cb(new Error('涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�'))),
+ trigger: 'blur'
+ }
+ ]
+ }
+ }
},
computed: {
username() {
@@ -24,6 +68,34 @@
}
},
methods: {
+ openChangePwd() {
+ this.pwdForm = { oldPassword: '', newPassword: '', confirmPassword: '' }
+ this.pwdDialogVisible = true
+ this.$nextTick(() => this.$refs.pwdForm && this.$refs.pwdForm.clearValidate())
+ },
+ resetPwdForm() {
+ this.$refs.pwdForm && this.$refs.pwdForm.clearValidate()
+ },
+ submitPwd() {
+ this.$refs.pwdForm.validate(valid => {
+ if (!valid) return
+ this.pwdSaving = true
+ api.post('/auth/change-password', {
+ oldPassword: this.pwdForm.oldPassword,
+ newPassword: this.pwdForm.newPassword
+ })
+ .then(() => {
+ this.$message.success('瀵嗙爜淇敼鎴愬姛')
+ this.pwdDialogVisible = false
+ })
+ .catch(err => {
+ if (err && err._toast) return
+ const d = err && err.response && err.response.data
+ this.$message.error((d && d.message) || '瀵嗙爜淇敼澶辫触')
+ })
+ .finally(() => { this.pwdSaving = false })
+ })
+ },
logout() {
this.$confirm('纭畾閫�鍑虹櫥褰曞悧锛�', '鎻愮ず', {
confirmButtonText: '閫�鍑�',
@@ -62,6 +134,8 @@
line-height: normal;
}
.header-user { opacity: 0.92; }
+.header-link { color: #fff; font-size: 14px; padding: 0; }
+.header-link:hover { color: #ffd04b; }
.header-logout { color: #fff; font-size: 14px; padding: 0; }
.header-logout:hover { color: #ffd04b; }
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.1