Przeglądaj źródła

修改个人中心

Z 1 rok temu
rodzic
commit
938edf164b

+ 10 - 0
src/api/system/file/index.js

@@ -66,3 +66,13 @@ export async function removeFiles(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 获取文件路径
+ */
+export async function getPathAddress () {
+  const res = await request.post('/main/file/getPathAddress');
+  if (res.data.code === '0') {
+    return res.data.data;
+  }
+  return Promise.reject();
+}

BIN
src/assets/xyy.jpg


+ 10 - 6
src/layout/components/header-tools.vue

@@ -22,7 +22,11 @@
       <el-dropdown @command="onUserDropClick">
         <div class="ele-admin-header-avatar">
           <el-avatar
-            :src="loginUser && loginUser.avatar ? loginUser.avatar : ''"
+            :src="
+              loginUser && loginUser.avatarAddress
+                ? loginUser.avatarAddress
+                : ''
+            "
           />
           <span class="hidden-xs-only">{{
             loginUser && loginUser.name ? loginUser.name : ''
@@ -31,9 +35,9 @@
         </div>
         <template v-slot:dropdown>
           <el-dropdown-menu>
-            <!-- <el-dropdown-item command="profile" icon="el-icon-user">
+            <el-dropdown-item command="profile" icon="el-icon-user">
               {{ $t('layout.header.profile') }}
-            </el-dropdown-item>-->
+            </el-dropdown-item>
             <el-dropdown-item command="password" icon="el-icon-key">
               {{ $t('layout.header.password') }}
             </el-dropdown-item>
@@ -63,12 +67,11 @@
   import HeaderNotice from './header-notice.vue';
   import PasswordModal from './password-modal.vue';
   import SettingDrawer from './setting-drawer.vue';
-  import I18nIcon from './i18n-icon.vue';
   import { logout } from '@/utils/page-tab-util';
   import { userLogout } from '@/api/system/user';
 
   export default {
-    components: { HeaderNotice, PasswordModal, SettingDrawer, I18nIcon },
+    components: { HeaderNotice, PasswordModal, SettingDrawer },
     props: {
       // 是否是全屏
       fullscreen: Boolean
@@ -94,7 +97,8 @@
           this.passwordVisible = true;
         } else if (command === 'profile') {
           if (this.$route.fullPath !== '/user/profile') {
-            this.$router.push('/user/profile');
+            // this.$router.push('/user/profile');
+            window.history.pushState(null, '', '/page-wt/user/profile');
           }
         } else if (command === 'logout') {
           // 退出登录

+ 3 - 1
src/store/modules/user.js

@@ -54,7 +54,9 @@ export default {
     // 当前登录用户的权限路由
     authoritiesRouter: [],
     // 当前登录用户的角色
-    roles: []
+    roles: [],
+    // 当前登录用户的数据权限部门数据
+    authorityDept: {}
   },
   mutations: {
     // 设置登录用户的信息

+ 16 - 11
src/views/login/index.vue

@@ -4,13 +4,13 @@
     ['', 'login-form-right', 'login-form-left'][direction]
   ]">
     <el-form ref="form" size="large" :model="form" :rules="rules" class="login-form ele-bg-white"
-      @keyup.enter.native="submit">
+             @keyup.enter.native="submit">
       <h4>{{ $t('login.title') }}</h4>
       <el-form-item prop="loginName">
-        <el-input clearable v-model="form.loginName" prefix-icon="el-icon-user" placeholder="请输入登录账号"  />
+        <el-input clearable v-model="form.loginName" prefix-icon="el-icon-user" placeholder="请输入登录账号"/>
       </el-form-item>
       <el-form-item prop="loginPwd">
-        <el-input show-password v-model="form.loginPwd" prefix-icon="el-icon-lock" placeholder="请输入登录密码"  />
+        <el-input show-password v-model="form.loginPwd" prefix-icon="el-icon-lock" placeholder="请输入登录密码"/>
       </el-form-item>
       <!-- <el-form-item prop="code">
         <div class="login-input-group">
@@ -53,7 +53,7 @@
     </div>
     <!-- 多语言切换 -->
     <div style="position: absolute; right: 30px; top: 20px">
-      <i18n-icon :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }" />
+      <i18n-icon :icon-style="{ fontSize: '22px', color: '#fff', cursor: 'pointer' }"/>
     </div>
     <!-- 实际项目去掉这段 -->
     <div class="hidden-xs-only" style="position: absolute; right: 30px; bottom: 20px; z-index: 9">
@@ -68,17 +68,19 @@
 
 <script>
 import I18nIcon from '@/layout/components/i18n-icon.vue';
-import { getToken } from '@/utils/token-util';
-import { login, getCaptcha } from '@/api/login';
-
+import {getToken} from '@/utils/token-util';
+import {login, getCaptcha} from '@/api/login';
+import xyy from '@/assets/xyy.jpg'
+import {getPathAddress} from "@/api/system/file";
 
 export default {
   // eslint-disable-next-line vue/multi-word-component-names
   name: 'Login',
-  components: { I18nIcon },
+  components: {I18nIcon},
   data() {
     return {
       // 登录框方向, 0居中, 1居右, 2居左
+      xyy,
       direction: 0,
       // 加载状态
       loading: false,
@@ -134,9 +136,11 @@ export default {
         }
         this.loading = true;
         login(this.form)
-          .then((res) => {
+          .then(async (res) => {
             localStorage.setItem('userId', res.data.userId);
             // 用户信息
+            const filePath = await getPathAddress()
+            res.data.avatarAddress = res.data.avatar && res.data.avatar.length ? filePath + res.data.avatar[0].storePath : xyy
             this.$store.commit('user/setUserInfo', res.data);
             this.loading = false;
             this.$message.success(res.message);
@@ -158,7 +162,8 @@ export default {
     },
     /* 跳转到首页 */
     goHome() {
-      this.$router.push(this.$route?.query?.from ?? '/').catch(() => { });
+      this.$router.push(this.$route?.query?.from ?? '/').catch(() => {
+      });
     },
     /* 更换图形验证码 */
     changeCaptcha() {
@@ -221,7 +226,7 @@ export default {
     margin: 0 0 25px 0;
   }
 
-  &>.el-form-item {
+  & > .el-form-item {
     margin-bottom: 25px;
   }
 }

+ 1 - 1
vue.config.js

@@ -22,7 +22,7 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.147:18086',
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {