修复后台空白页:更正base模板标签闭合与脚本兼容性
变更项: 1. 修复 base.html 顶栏修改密码按钮闭合错误(el-button 被误写为 div)。 2. 移除可选链写法,改为兼容语法,避免低版本浏览器脚本解析失败。 3. 调整 app-container 默认可见,避免脚本异常时整页因 opacity=0 看起来空白。 4. 确认密码校验函数使用稳定上下文引用,避免 this 访问异常。
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
|
||||
.app-container {
|
||||
min-height: 100vh;
|
||||
opacity: 0;
|
||||
opacity: 1;
|
||||
transition: opacity .24s ease;
|
||||
}
|
||||
|
||||
@@ -764,7 +764,7 @@
|
||||
</div>
|
||||
<el-button type="text" class="account-btn" @click="openPasswordDialog">
|
||||
<i class="el-icon-lock"></i> 修改密码
|
||||
</div>
|
||||
</el-button>
|
||||
<el-button type="text" class="logout-btn" @click="logout">
|
||||
<i class="el-icon-switch-button"></i> 退出
|
||||
</el-button>
|
||||
@@ -917,6 +917,7 @@
|
||||
|
||||
const baseApp = {
|
||||
data() {
|
||||
const vm = this;
|
||||
return {
|
||||
currentView: '1',
|
||||
timeRange: '7',
|
||||
@@ -941,8 +942,8 @@
|
||||
confirm_password: [
|
||||
{ required: true, message: '请再次输入新密码', trigger: 'blur' },
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value !== this.passwordForm.new_password) {
|
||||
validator: function(rule, value, callback) {
|
||||
if (value !== vm.passwordForm.new_password) {
|
||||
callback(new Error('两次输入的新密码不一致'));
|
||||
return;
|
||||
}
|
||||
@@ -1065,7 +1066,14 @@
|
||||
this.passwordDialogVisible = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
const errorMsg = error?.response?.data?.error || '修改密码失败,请稍后重试';
|
||||
let errorMsg = '修改密码失败,请稍后重试';
|
||||
try {
|
||||
if (error && error.response && error.response.data && error.response.data.error) {
|
||||
errorMsg = error.response.data.error;
|
||||
}
|
||||
} catch (e) {
|
||||
// 读取错误信息失败时保持默认文案即可。
|
||||
}
|
||||
this.$message.error(errorMsg);
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user