Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 09fb576

Browse files
committed
演示版超级管理员无法修改个人信息
1 parent c97260f commit 09fb576

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

‎api/app/Http/Controllers/Admin/AdminController.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public function modify(Request $request)
323323
$info = $this->getErrorInfo($validator);
324324
return $this->errorWithInfo($info, 422);
325325
}
326-
$id = Auth::guard('admin')->id();
326+
$id = Auth::guard('api')->id();
327327
$user = Admin::find($id);
328328
$pwd = $user->password;
329329
if (Hash::check($old_password, $pwd)){ // 老密码相等才会修改
@@ -355,7 +355,7 @@ public function modify(Request $request)
355355
}
356356
$data['avatar'] = $avatar;
357357
$data['updated_at'] = Carbon::now();
358-
$id = Auth::guard('admin')->id();
358+
$id = Auth::guard('api')->id();
359359
$oldAvatar = $this->model::find($id)->avatar;
360360
if ($avatar !== $oldAvatar && !empty($oldAvatar)) {
361361
// 删除旧的头像文件 http://lv6.test//storage/axS9bUx4LkOFqwFmmfB5f2TRJBXWGmX4neGMR7RR.png
@@ -382,7 +382,7 @@ public function modify(Request $request)
382382
if (empty($data['phone'])) {
383383
unset($data['phone']);
384384
}
385-
$id = Auth::guard('admin')->id();;
385+
$id = Auth::guard('api')->id();;
386386
$data['updated_at'] = Carbon::now();
387387
DB::table('admins')->where('id', $id)->update($data);
388388
return $this->successWithInfo("用户信息修改成功");

‎element/src/views/info/index.vue‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
22
<div class="personal">
3+
<el-alert
4+
title="演示版本超级管理员无法修改个人信息, 部署时大家自行修改相关代码即可以"
5+
type="error"
6+
show-icon
7+
v-if="name === 'admin'">
8+
</el-alert>
39
<el-tabs v-model="tab" tab-position="left">
410
<el-tab-pane label="基本设置" name="base">
511
<el-row>
@@ -44,7 +50,7 @@
4450
</el-upload>
4551
</el-form>
4652
<div style="margin-top: 10px;">
47-
<el-button type="primary" @click="saveData()">保 存</el-button>
53+
<el-button type="primary" @click="saveData()"v-if="name !== 'admin'">保 存</el-button>
4854
</div>
4955
</el-col>
5056
</el-row>
@@ -75,7 +81,7 @@
7581
</el-form>
7682
<div style="margin-top: 10px;">
7783
<el-button type="primary" @click="modifyPwd('pwdForm')"
78-
>修 改</el-button
84+
v-if="name !== 'admin'">修 改</el-button
7985
>
8086
</div>
8187
</el-col>
@@ -88,6 +94,7 @@
8894
<script>
8995
import { modify } from "@/api/admin";
9096
import { getInfo } from "@/api/user";
97+
import {mapGetters} from 'vuex'
9198
export default {
9299
name: "PersonalIndex",
93100
data() {
@@ -140,6 +147,9 @@ export default {
140147
}
141148
};
142149
},
150+
computed:{
151+
...mapGetters(['name'])
152+
},
143153
async created() {
144154
const { data } = await getInfo();
145155
this.formData.nickname = data.nickname;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /