reghao 7 月之前
父節點
當前提交
74fffeeb86
共有 3 個文件被更改,包括 60 次插入92 次删除
  1. 27 86
      src/components/layout/NavBar.vue
  2. 2 2
      src/views/Login.vue
  3. 31 4
      src/views/admin/TopNav.vue

+ 27 - 86
src/components/layout/NavBar.vue

@@ -42,7 +42,7 @@
           <el-autocomplete
             v-model="keyword"
             :fetch-suggestions="querySearchAsync"
-            :placeholder="placeholder"
+            :placeholder="searchHint"
             clearable
             suffix-icon="el-icon-search"
             size="medium"
@@ -64,10 +64,10 @@
             >
             <el-dropdown-menu v-if="user" slot="dropdown" class="iconsize">
               <el-dropdown-item
-                icon="el-icon-user-solid"
+                icon="el-icon-s-home"
                 class="size"
-                @click.native="goToProfile"
-              >我的帐号</el-dropdown-item>
+                @click.native="goToUserHome"
+              >我的主页</el-dropdown-item>
               <el-dropdown-item
                 icon="el-icon-collection"
                 class="size"
@@ -80,36 +80,15 @@
               >历史记录
               </el-dropdown-item>
               <el-dropdown-item
-                icon="el-icon-s-home"
+                icon="el-icon-menu"
                 class="size"
-                @click.native="goToUserHome"
-              >我的主页</el-dropdown-item>
+                @click.native="goToBackground"
+              >进入后台</el-dropdown-item>
               <el-dropdown-item
                 icon="el-icon-error"
                 class="size"
                 @click.native="goToLogout"
-              >退出</el-dropdown-item>
-              <el-divider />
-              <el-dropdown-item
-                icon="el-icon-s-home"
-                class="size"
-                @click.native="goToExam"
-              >我的考试</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-map-location"
-                class="size"
-                @click.native="goToMap"
-              >我的地图</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-goods"
-                class="size"
-                @click.native="goToMall"
-              >我的商城</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-chat-dot-round"
-                class="size"
-                @click.native="goToChat"
-              >我的IM</el-dropdown-item>
+              >登出</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
           <span
@@ -172,7 +151,7 @@
             type="primary"
             :loading="isLoading"
             @click.native="loginBtn"
-          >登 </el-button>
+          >登 </el-button>
           <el-button type="plain" @click="register">注册/忘记密码?</el-button>
         </el-form-item>
       </el-form>
@@ -194,7 +173,8 @@ export default {
       user: null,
       activeIndex: '1',
       restaurants: [],
-      placeholder: '想要搜点神马呢',
+      searchHint: '想要搜点神马呢',
+      searchType: '1',
       keyword: '',
       statusCount: 0,
       msgCount: 0
@@ -294,101 +274,62 @@ export default {
       console.log('帐号注册')
     },
     // ****************************************************************************************************************
-    goToPlaylist() {
-      const path = '/post/album'
+    goToUserHome() {
+      const path = '/user/' + this.user.userId
       if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
       this.$router.push(path)
     },
-    goToDisk() {
-      const path = '/disk'
+    goToPlaylist() {
+      const path = '/background/my/album'
       if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
       this.$router.push(path)
     },
-    goToProfile() {
-      const path = '/my'
+    goToHistory() {
+      const path = '/background/my/history'
       if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
       this.$router.push(path)
     },
-    goToTimeline() {
-      const path = '/timeline'
+    goToBackground() {
+      const path = '/background'
       if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
       this.$router.push(path)
     },
-    goToUserHome() {
-      const path = '/user/' + this.user.userId
+    goToTimeline() {
+      const path = '/timeline'
       if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
       this.$router.push(path)
     },
-    goToHistory() {
-      if (this.$route.path === '/post/history') {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push('/post/history')
-    },
     goToMessage() {
-      if (this.$route.path === '/my/message') {
+      const path = '/background/my/message'
+      if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
-      this.$router.push('/my/message')
+      this.$router.push(path)
     },
     goToPublish() {
-      if (this.$route.path === '/post/video/list') {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push('/post/video/list')
-    },
-    // ************************************************************************
-    // 我的考试
-    goToExam() {
-      if (this.$route.path === '/exam') {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push('/exam')
-    },
-    // 我的地图
-    goToMap() {
-      if (this.$route.path === '/map') {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push('/map')
-    },
-    // 我的商城
-    goToMall() {
-      if (this.$route.path === '/mall') {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push('/mall')
-    },
-    // 我的IM
-    goToChat() {
-      if (this.$route.path === '/chat') {
+      const path = '/background/post/video'
+      if (this.$route.path === path) {
         this.$router.go(0)
         return
       }
-      this.$router.push('/chat')
+      this.$router.push(path)
     }
-    // ************************************************************************
   }
 }
 </script>

+ 2 - 2
src/views/Login.vue

@@ -42,7 +42,7 @@
                         />
                       </el-form-item>
                       <el-form-item>
-                        <el-button type="primary" size="mini" :loading="isLoading" @click.native="loginBtn">登 </el-button>
+                        <el-button type="primary" size="mini" :loading="isLoading" @click.native="loginBtn">登 </el-button>
                         <el-button type="plain" size="mini" @click="register">注册帐号</el-button>
                         <el-button type="plain" size="mini" @click="forgot">忘记密码</el-button>
                       </el-form-item>
@@ -82,7 +82,7 @@
                         />
                       </el-form-item>
                       <el-form-item>
-                        <el-button type="primary" size="mini" :loading="isLoading" @click.native="loginByVerifyCode">登 </el-button>
+                        <el-button type="primary" size="mini" :loading="isLoading" @click.native="loginByVerifyCode">登 </el-button>
                         <el-button type="plain" size="mini" @click="register">注册帐号</el-button>
                         <el-button type="plain" size="mini" @click="forgot">忘记密码</el-button>
                       </el-form-item>

+ 31 - 4
src/views/admin/TopNav.vue

@@ -4,29 +4,56 @@
       <img class="showimg" :src="collapsed ? imgshow : imgsq" @click="doToggle()">
     </el-button>
     <el-submenu index="2" class="submenu">
-      <template slot="title">超级管理员</template>
-      <el-menu-item index="2-1">设置</el-menu-item>
-      <el-menu-item index="2-2">个人中心</el-menu-item>
-      <el-menu-item index="2-3" @click="exit()">退出</el-menu-item>
+      <template slot="title">{{ user.screenName }}</template>
+      <el-menu-item index="2-1" @click="backToHome">
+        <i class="el-icon-s-home" />
+        <span slot="title">回到主站</span>
+      </el-menu-item>
+      <el-menu-item index="2-2" @click="onClickUser">
+        <i class="el-icon-user" />
+        <span slot="title">个人中心</span>
+      </el-menu-item>
+      <el-menu-item index="2-3" @click="exit">
+        <i class="el-icon-close" />
+        <span slot="title">登出</span>
+      </el-menu-item>
     </el-submenu>
   </el-menu>
 </template>
 
 <script>
+import { getAuthedUser } from '@/utils/auth'
+
 export default {
   name: 'TopNav',
   data: function() {
     return {
+      user: null,
       collapsed: true,
       imgshow: require('@/assets/img/logo.png'),
       imgsq: require('@/assets/img/logo.png')
     }
   },
+  created() {
+    this.user = getAuthedUser()
+    console.log(this.user)
+  },
   methods: {
     doToggle() { // 主要控制collapsed为true和false
       this.collapsed = !this.collapsed
       this.$root.Bus.$emit('Handle', this.collapsed)
     },
+    backToHome() {
+      const path = '/'
+      if (this.$route.path === path) {
+        this.$router.go(0)
+        return
+      }
+      this.$router.push(path)
+    },
+    onClickUser() {
+      this.$message.info('click user')
+    },
     exit() {
       this.$message.info('logout system')
     }