Преглед изворни кода

1.使用 gemini 优化 src/views/Index.vue 和 src/components/layout/NavBar.vue 页面的 UI
2.删除无用的 vue 文件

reghao пре 1 дан
родитељ
комит
e3fe12857c

+ 0 - 49
src/components/layout/FooterBar.vue

@@ -1,49 +0,0 @@
-<template>
-  <div id="footer-bar">
-    <img class="logo" src="@/assets/img/logo.png" alt="">
-  </div>
-</template>
-
-<script>
-export default {
-  name: 'FooterBar'
-}
-</script>
-
-<style scoped>
-#footer-bar {
-  position: relative;
-  bottom: 0;
-  left: 0;
-  right: 0;
-
-  padding-left: 6%;
-  padding-right: 6%;
-  margin-top: 30px;
-  height: 60px;
-  border-top: 2px solid rgba(34, 36, 38, 0.15);
-  box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15);
-  text-align: center;
-}
-
-.content {
-  padding-top: 10px;
-  font-size: 14px;
-}
-.logo {
-  width: 30px;
-  cursor: pointer;
-}
-.author,
-.statement {
-  padding-top: 5px;
-}
-
-.weixin {
-  width: 30px;
-  cursor: pointer;
-}
-.er {
-  width: 150px;
-}
-</style>

+ 324 - 283
src/components/layout/NavBar.vue

@@ -1,157 +1,101 @@
 <template>
-  <el-row class="el-menu-demo">
-    <el-col :md="2">
-      <ul role="menubar" class="el-menu--horizontal el-menu">
-        <li role="menuitem" class="el-menu-item">
-          <a href="/" style="color: #007bff;text-decoration-line: none">
-            <img src="@/assets/img/logo.png" class="logo" alt="img">
-            tnbapp
+  <div class="header-wrapper">
+    <div class="nav-bar-container">
+      <el-row type="flex" align="middle" class="nav-content">
+        <el-col :xs="3" :sm="2" :md="3" class="logo-wrapper">
+          <a href="/" class="logo-link">
+            <img src="@/assets/img/logo.png" class="logo-img" alt="logo">
+            <span class="logo-text hidden-xs-only">TNBAPP</span>
           </a>
-        </li>
-      </ul>
-    </el-col>
-    <el-col :md="8">
-      <el-menu
-        mode="horizontal"
-      >
-        <el-menu-item index="1">
-          <a href="/video" style="text-decoration-line: none">
-            <span style="color: #007bff">分区</span>
-          </a>
-        </el-menu-item>
-        <el-menu-item index="2">
-          <a href="/shortvideo" style="text-decoration-line: none">
-            <span style="color: #007bff">短视频</span>
-          </a>
-        </el-menu-item>
-        <el-menu-item index="3">
-          <a href="/playlist" style="text-decoration-line: none">
-            <span style="color: #007bff">播放列表</span>
-          </a>
-        </el-menu-item>
-      </el-menu>
-    </el-col>
-    <el-col :md="6">
-      <ul class="el-menu--horizontal el-menu">
-        <li class="el-menu-item">
-          <el-autocomplete
-            v-model="keyword"
-            :fetch-suggestions="querySearchAsync"
-            :placeholder="searchHint"
-            clearable
-            suffix-icon="el-icon-search"
-            size="medium"
-            :debounce="1000"
-            @keyup.enter.native="onSearch"
-            @select="onSearch"
-          />
-        </li>
-      </ul>
-    </el-col>
-    <el-col :md="8">
-      <ul class="el-menu--horizontal el-menu">
-        <li class="el-menu-item">
-          <el-dropdown v-if="user">
-            <img
-              :src="user.avatarUrl"
-              class="el-avatar--circle el-avatar--medium"
-              alt=""
+        </el-col>
+
+        <el-col :sm="6" :md="7" class="hidden-xs-only">
+          <div class="nav-links">
+            <router-link to="/video" class="nav-item-link">分区</router-link>
+            <router-link to="/shortvideo" class="nav-item-link">短视频</router-link>
+            <router-link to="/playlist" class="nav-item-link">播放列表</router-link>
+          </div>
+        </el-col>
+
+        <el-col :xs="15" :sm="8" :md="6">
+          <div class="search-wrapper">
+            <el-autocomplete
+                v-model="keyword"
+                :fetch-suggestions="querySearchAsync"
+                :placeholder="searchHint"
+                prefix-icon="el-icon-search"
+                class="custom-search"
+                size="small"
+                @keyup.enter.native="onSearch"
+            />
+          </div>
+        </el-col>
+
+        <el-col :xs="6" :sm="8" :md="8" class="user-actions">
+          <div class="action-icons hidden-xs-only">
+            <div class="icon-item-wrapper" @click="goToTimeline">
+              <el-badge :value="statusCount" :max="99" :hidden="statusCount <= 0" class="badge-item">
+                <i class="el-icon-video-camera-solid custom-icon"></i>
+              </el-badge>
+              <span class="icon-label">动态</span>
+            </div>
+
+            <div class="icon-item-wrapper" @click="goToMessage">
+              <el-badge :value="msgCount" :max="99" :hidden="msgCount <= 0" class="badge-item">
+                <i class="el-icon-message-solid custom-icon"></i>
+              </el-badge>
+              <span class="icon-label">消息</span>
+            </div>
+          </div>
+
+          <div class="user-profile-wrapper">
+            <el-dropdown v-if="user" trigger="hover" placement="bottom" class="user-dropdown-trigger">
+              <div class="avatar-wrapper">
+                <img :src="user.avatarUrl" class="user-avatar" alt="avatar">
+              </div>
+              <el-dropdown-menu slot="dropdown" class="user-dropdown-menu">
+                <div class="user-name-header">{{ user.screenName || '用户' }}</div>
+                <el-dropdown-item icon="el-icon-collection" @click.native="goToPlaylist">收藏列表</el-dropdown-item>
+                <el-dropdown-item icon="el-icon-collection" @click.native="goToHistory">历史记录</el-dropdown-item>
+                <el-dropdown-item icon="el-icon-collection" @click.native="goToBackground">进入后台</el-dropdown-item>
+                <el-dropdown-item icon="el-icon-switch-button" divided @click.native="goToLogout">退出登录</el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
+
+            <el-button v-else type="text" class="login-btn-text" @click="login">登录</el-button>
+
+            <el-button
+                type="primary"
+                class="upload-btn-blue hidden-xs-only"
+                @click="goToPublish"
             >
-            <el-dropdown-menu v-if="user" slot="dropdown" class="iconsize">
-              <el-dropdown-item
-                icon="el-icon-s-home"
-                class="size"
-                @click.native="goToUserHome"
-              >我的主页</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-collection"
-                class="size"
-                @click.native="goToPlaylist"
-              >播放列表</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-s-data"
-                class="size"
-                @click.native="goToHistory"
-              >历史记录
-              </el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-menu"
-                class="size"
-                @click.native="goToBackground"
-              >进入后台</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-error"
-                class="size"
-                @click.native="goToLogout"
-              >登出</el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-          <span
-            v-else
-            style="color: #007bff"
-            @click="login"
-          >登入</span>
-        </li>
-        <li class="el-menu-item" @click="goToTimeline">
-          <el-badge class="item" :value="statusCount" :max="99">
-            <span class="el-icon-view" style="color: #007bff">状态</span>
-          </el-badge>
-        </li>
-        <li class="el-menu-item" @click="goToMessage">
-          <el-badge class="item" :value="msgCount" :max="99">
-            <span class="el-icon-bell" style="color: #007bff">消息</span>
-          </el-badge>
-        </li>
-        <li class="el-menu-item">
-          <el-button size="mini" type="upload" icon="el-icon-upload" @click="goToPublish">投稿</el-button>
-        </li>
-      </ul>
-    </el-col>
-
-    <!--登入弹窗-->
-    <el-dialog
-      title="用户登入"
-      append-to-body
-      :visible.sync="dialogVisible"
-      width="30%"
-      center
-    >
-      <el-form ref="form" :model="userLogin">
-        <el-form-item label="帐号">
-          <el-input
-            v-model="userLogin.principal"
-            placeholder="请输入手机号或邮箱"
-            style="width: 70%; padding-right: 2px"
-            clearable
-          />
-        </el-form-item>
-        <el-form-item label="密码">
-          <el-input
-            v-model="userLogin.credential"
-            placeholder="请输入验证码"
-            style="width: 45%; padding-right: 2px"
-          />
-          <el-button :disabled="isBtn" @click="loginVerifyCode">{{ code }}</el-button>
-        </el-form-item>
-        <el-form-item label="图形验证码" label-width="90px">
-          <el-image :src="captchaCode" @click="getCaptcha" />
-          <el-input
-            v-model="userLogin.captchaCode"
-            placeholder="请输入图形验证码"
-            style="width: 45%; padding-right: 2px"
-          />
-        </el-form-item>
-        <el-form-item>
-          <el-button
-            type="primary"
-            :loading="isLoading"
-            @click.native="loginBtn"
-          >登 入</el-button>
-          <el-button type="plain" @click="register">注册/忘记密码?</el-button>
-        </el-form-item>
-      </el-form>
-    </el-dialog>
-  </el-row>
+              <i class="el-icon-upload"></i>
+              <span>投稿</span>
+            </el-button>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
+
+    <nav class="bottom-nav hidden-sm-and-up">
+      <router-link to="/" class="bottom-nav-item" exact-active-class="is-active">
+        <i class="el-icon-house"></i>
+        <span>首页</span>
+      </router-link>
+      <router-link to="/video" class="bottom-nav-item" active-class="is-active">
+        <i class="el-icon-menu"></i>
+        <span>分区</span>
+      </router-link>
+      <router-link to="/shortvideo" class="bottom-nav-item" active-class="is-active">
+        <i class="el-icon-video-camera"></i>
+        <span>短视频</span>
+      </router-link>
+      <router-link :to="user ? `/user/${user.userIdStr}` : '/login'" class="bottom-nav-item" active-class="is-active">
+        <i class="el-icon-user"></i>
+        <span>我的</span>
+      </router-link>
+    </nav>
+  </div>
 </template>
 
 <script>
@@ -168,15 +112,12 @@ export default {
       user: null,
       restaurants: [],
       searchHint: '想要搜点神马呢',
-      searchType: '1',
       keyword: '',
       statusCount: 0,
       msgCount: 0
     }
   },
   created() {
-    /* const userdata = Vue.$cookies.get('USERDATA')
-    const userId = userdata.split(':')[0]*/
     const userInfo = getAuthedUser()
     if (userInfo !== null) {
       this.user = userInfo
@@ -188,163 +129,263 @@ export default {
     }
   },
   methods: {
-    handleSelect(key, keyPath) {
-      console.log(key, keyPath)
-    },
-    // ****************************************************************************************************************
-    // 重点:当框中的改变时触发该方法,elementui自动设置了防抖,参见debounce属性
-    // queryString 为输入框中的值。cb为返回显示列表的回调函数
     querySearchAsync(queryString, cb) {
-      if (queryString === '') {
-        return
-      }
-
+      if (!queryString) return
       setTimeout(() => {
         keywordSuggest(queryString).then(res => {
           if (res.code === 0) {
-            this.restaurants = res.data.map((item) => {
-              return {
-                value: item.keyword,
-                rank: 1
-              }
-            })
-
-            // 如果 cb 返回一个空数组, 那么模糊搜索输入建议的下拉选项会因为 length 为 0 而消失
-            // cb([])
-            cb(this.restaurants)
-            // eslint-disable-next-line no-empty
-          } else {
+            const results = res.data.map(item => ({ value: item.keyword }))
+            cb(results)
           }
         })
-      }, 500)
+      }, 300)
     },
-    // select 事件或 enter 键事件
     onSearch() {
-      console.log('回车事件')
-      // 正则去空格
-      if (this.keyword.replace(/\s*/g, '')) {
+      if (this.keyword.trim()) {
         this.toSearchPage()
       } else {
-        this.$message({
-          showClose: true,
-          message: '不能为空!',
-          type: 'warning'
-        })
+        this.$message.warning('不能为空!')
       }
     },
-    // 跳转搜索页面,传递搜索框的参数
     toSearchPage() {
-      const currentPath = this.$route.path
-      if (currentPath === '/search') {
-        this.$router.push({
-          path: '/search',
-          query: {
-            searchType: 1,
-            keyword: this.keyword,
-            pn: 1
-          }
-        })
-        this.$router.go(0)
+      const query = { searchType: 1, keyword: this.keyword, pn: 1 }
+      if (this.$route.path === '/search') {
+        this.$router.push({ path: '/search', query }).catch(() => {})
       } else {
-        const routeUrl = this.$router.resolve({
-          path: '/search',
-          query: {
-            searchType: 1,
-            keyword: this.keyword,
-            pn: 1
-          }
-        })
+        const routeUrl = this.$router.resolve({ path: '/search', query })
         window.open(routeUrl.href, '_blank')
       }
     },
-    // ****************************************************************************************************************
     login() {
-      const path = '/login'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
+      this.$router.push('/login').catch(() => {})
     },
-    register() {
-      console.log('帐号注册')
-    },
-    // ****************************************************************************************************************
-    goToUserHome() {
-      const path = '/user/' + this.user.userIdStr
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToPlaylist() {
-      const path = '/bg/my/album'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToHistory() {
-      const path = '/bg/my/history'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToBackground() {
-      const path = '/bg'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToTimeline() {
-      const path = '/timeline'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToMessage() {
-      const path = '/bg/account/message'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToPublish() {
-      const path = '/bg/post/video'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    }
+    goToUserHome() { this.$router.push('/user/' + this.user.userIdStr) },
+    goToPlaylist() { this.$router.push('/bg/my/album') },
+    goToHistory() { this.$router.push('/bg/my/history') },
+    goToBackground() { this.$router.push('/bg') },
+    goToTimeline() { this.$router.push('/timeline') },
+    goToMessage() { this.$router.push('/bg/account/message') },
+    goToPublish() { this.$router.push('/bg/post/video') }
   }
 }
 </script>
 
-<style scoped>
-@media screen and (max-width: 768px) {
+<style lang="scss" scoped>
+/* 变量定义 */
+$primary-blue: #00a1d6;
+$hover-blue: #00b5e5;
+$text-main: #18191c;
+$text-second: #61666d;
+$bg-grey: #f1f2f3;
+
+/* 1. 顶部主容器 */
+.nav-bar-container {
+  position: fixed; /* 强制固定 */
+  top: 0;
+  left: 0;
+  right: 0;
+  z-index: 2000; /* 提高层级,确保在弹窗之下但在内容之上 */
+  height: 64px;
+  background: #fff;
+  /* 如果想要毛玻璃效果,取消下面两行的注释 */
+  /* background: rgba(255, 255, 255, 0.9); */
+  /* backdrop-filter: blur(10px); */
+  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
+  display: flex;
+  align-items: center;
+  padding: 0 20px;
 }
 
-.logo {
-  width: 30px;
-  position: relative;
+.nav-content {
+  width: 100%;
+  max-width: 1400px;
+  margin: 0 auto;
 }
 
-.size {
-  font-size: 16px;
+/* 2. Logo 样式 */
+.logo-link {
+  display: flex;
+  align-items: center;
+  text-decoration: none;
+  .logo-img { width: 30px; height: 30px; }
+  .logo-text {
+    color: $primary-blue;
+    font-weight: bold;
+    font-size: 18px;
+    margin-left: 8px;
+  }
 }
 
-.item {
-  margin-top: 10px;
-  margin-right: 10px;
+/* 3. PC端菜单链接 */
+.nav-links {
+  display: flex;
+  gap: 20px;
+  .nav-item-link {
+    text-decoration: none;
+    color: $text-main;
+    font-size: 15px;
+    transition: color 0.2s;
+    &:hover { color: $primary-blue; }
+  }
+}
+
+/* 4. 搜索框美化 */
+.custom-search {
+  width: 100%;
+  ::v-deep .el-input__inner {
+    border-radius: 20px;
+    background-color: $bg-grey;
+    border: 1px solid transparent;
+    padding-left: 35px;
+    transition: all 0.3s ease;
+    &:focus {
+      background-color: #fff;
+      border-color: $primary-blue;
+      box-shadow: 0 0 8px rgba(0, 161, 214, 0.15);
+    }
+  }
+}
+
+/* 5. 右侧操作区总布局 */
+.user-actions {
+  display: flex;
+  align-items: center;
+  justify-content: flex-end;
+  height: 100%;
+}
+
+/* 图标组 (动态/消息) */
+.action-icons {
+  display: flex;
+  align-items: center;
+  margin-right: 20px;
+
+  .icon-item-wrapper {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    margin-left: 18px;
+    cursor: pointer;
+    transition: transform 0.2s ease;
+
+    .custom-icon {
+      font-size: 20px;
+      color: $text-second;
+      transition: color 0.2s;
+    }
+    .icon-label {
+      font-size: 11px;
+      color: $text-second;
+      margin-top: 2px;
+    }
+
+    &:hover {
+      transform: translateY(-2px);
+      .custom-icon, .icon-label { color: $primary-blue; }
+    }
+  }
+}
+
+/* 头像与按钮包装 */
+.user-profile-wrapper {
+  display: flex;
+  align-items: center;
+}
+
+.avatar-wrapper {
+  display: flex;
+  align-items: center;
+  padding: 0 8px;
+  cursor: pointer;
+}
+
+.user-avatar {
+  width: 36px;
+  height: 36px;
+  border-radius: 50%;
+  object-fit: cover;
+  border: 1px solid transparent;
+  transition: all 0.3s;
+  &:hover {
+    transform: scale(1.1);
+    border-color: $primary-blue;
+  }
+}
+
+.login-btn-text {
+  color: $primary-blue;
+  font-weight: 500;
+  margin-right: 15px;
+}
+
+/* 蓝色投稿按钮 */
+.upload-btn-blue {
+  background-color: $primary-blue !important;
+  border: none !important;
+  border-radius: 8px !important;
+  height: 34px;
+  padding: 0 16px !important;
+  display: flex;
+  align-items: center;
+  margin-left: 10px !important;
+  transition: all 0.3s !important;
+
+  i { font-size: 16px; margin-right: 4px; }
+  span { font-size: 14px; }
+
+  &:hover {
+    background-color: $hover-blue !important;
+    box-shadow: 0 4px 12px rgba(0, 161, 214, 0.2);
+  }
+}
+
+/* 6. 移动端底部导航 */
+.bottom-nav {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  right: 0;
+  height: 56px;
+  background: rgba(255, 255, 255, 0.96);
+  backdrop-filter: blur(15px);
+  display: flex;
+  border-top: 1px solid #f1f2f3;
+  z-index: 2000;
+  padding-bottom: env(safe-area-inset-bottom);
+
+  .bottom-nav-item {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    text-decoration: none;
+    color: $text-second;
+    i { font-size: 20px; margin-bottom: 2px; }
+    span { font-size: 10px; }
+    &.is-active { color: $primary-blue; i { font-weight: bold; } }
+  }
+}
+
+/* 7. 移动端适配补丁 */
+@media screen and (max-width: 768px) {
+  .nav-bar-container { padding: 0 10px; height: 56px; }
+  .user-profile-wrapper { margin-right: 5px; }
+  .logo-wrapper { flex: 0 0 auto; width: 40px; }
+  .custom-search {
+    ::v-deep .el-input__inner { height: 32px; line-height: 32px; }
+  }
+}
+
+/* 下拉菜单修饰 */
+.user-dropdown-menu {
+  .user-name-header {
+    padding: 12px 20px;
+    font-weight: bold;
+    color: $text-main;
+    border-bottom: 1px solid #f1f2f3;
+    margin-bottom: 5px;
+    text-align: center;
+  }
 }
 </style>

+ 0 - 194
src/components/layout/NavBarNoSearch.vue

@@ -1,194 +0,0 @@
-<template>
-  <el-row class="el-menu-demo">
-    <el-col :md="2">
-      <ul role="menubar" class="el-menu--horizontal el-menu">
-        <li role="menuitem" class="el-menu-item">
-          <a href="/" style="color: #007bff;text-decoration-line: none">
-            <img src="@/assets/img/logo.png" class="logo" alt="img">
-            tnbapp
-          </a>
-        </li>
-      </ul>
-    </el-col>
-    <el-col :md="8">
-      <ul class="el-menu--horizontal el-menu">
-        <li class="el-menu-item">
-          <el-dropdown v-if="user">
-            <img
-              :src="user.avatarUrl"
-              class="el-avatar--circle el-avatar--medium"
-              alt=""
-            >
-            <el-dropdown-menu v-if="user" slot="dropdown" class="iconsize">
-              <el-dropdown-item
-                icon="el-icon-s-home"
-                class="size"
-                @click.native="goToUserHome"
-              >我的主页</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-collection"
-                class="size"
-                @click.native="goToPlaylist"
-              >播放列表</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-s-data"
-                class="size"
-                @click.native="goToHistory"
-              >历史记录
-              </el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-menu"
-                class="size"
-                @click.native="goToBackground"
-              >进入后台</el-dropdown-item>
-              <el-dropdown-item
-                icon="el-icon-error"
-                class="size"
-                @click.native="goToLogout"
-              >登出</el-dropdown-item>
-            </el-dropdown-menu>
-          </el-dropdown>
-          <span
-            v-else
-            style="color: #007bff"
-            @click="login"
-          >登入</span>
-        </li>
-        <li class="el-menu-item" @click="goToTimeline">
-          <el-badge class="item" :value="statusCount" :max="99">
-            <span class="el-icon-view" style="color: #007bff">状态</span>
-          </el-badge>
-        </li>
-        <li class="el-menu-item" @click="goToMessage">
-          <el-badge class="item" :value="msgCount" :max="99">
-            <span class="el-icon-bell" style="color: #007bff">消息</span>
-          </el-badge>
-        </li>
-      </ul>
-    </el-col>
-  </el-row>
-</template>
-
-<script>
-import { userMixin } from 'assets/js/mixin'
-import { getAuthedUser } from '@/utils/auth'
-import { getUnreadCount } from '@/api/user'
-
-export default {
-  name: 'NavBar',
-  mixins: [userMixin],
-  data() {
-    return {
-      user: null,
-      activeIndex: '1',
-      restaurants: [],
-      searchType: '1',
-      keyword: '',
-      statusCount: 0,
-      msgCount: 0
-    }
-  },
-  created() {
-    /* const userdata = Vue.$cookies.get('USERDATA')
-    const userId = userdata.split(':')[0]*/
-    const userInfo = getAuthedUser()
-    if (userInfo !== null) {
-      this.user = userInfo
-      getUnreadCount().then(resp => {
-        if (resp.code === 0) {
-          this.msgCount = resp.data.total
-        }
-      })
-    }
-  },
-  methods: {
-    login() {
-      const path = '/login'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    register() {
-      console.log('帐号注册')
-    },
-    // ****************************************************************************************************************
-    goToUserHome() {
-      const path = '/user/' + this.user.userIdStr
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToPlaylist() {
-      const path = '/bg/my/album'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToHistory() {
-      const path = '/bg/my/history'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToBackground() {
-      const path = '/bg'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToTimeline() {
-      const path = '/timeline'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToMessage() {
-      const path = '/bg/account/message'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    goToPublish() {
-      const path = '/bg/post/video'
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    }
-  }
-}
-</script>
-
-<style scoped>
-@media screen and (max-width: 768px) {
-}
-
-.logo {
-  width: 30px;
-  position: relative;
-}
-
-.size {
-  font-size: 16px;
-}
-
-.item {
-  margin-top: 10px;
-  margin-right: 10px;
-}
-</style>

+ 44 - 34
src/views/Index.vue

@@ -1,8 +1,11 @@
 <template>
-  <el-container>
-    <el-main>
-      <nav-bar />
-      <router-view />
+  <el-container class="app-wrapper">
+    <nav-bar />
+
+    <el-main class="main-container">
+      <div class="content-view">
+        <router-view />
+      </div>
     </el-main>
   </el-container>
 </template>
@@ -15,43 +18,50 @@ export default {
   components: {
     NavBar
   },
-  data() {
-    return {
-      isCollapse: false,
-      navList: [
-        { path: '/my', name: '我的帐号', icon: 'el-icon-upload' }
-      ]
-    }
-  },
-  /*  watch: {
-    // 地址栏 url 发生变化时重新加载本页面
-    $route() {
-      this.$router.go()
-    }
-  },*/
   created() {
     document.title = 'tnbapp'
-  },
-  methods: {
-    handleOpen(key, keyPath) {
-      console.log(key, keyPath)
-    },
-    handleClose(key, keyPath) {
-      console.log(key, keyPath)
-    }
   }
 }
 </script>
 
-<style>
-.el-menu-vertical-demo:not(.el-menu--collapse) {
-  width: 200px;
-  min-height: 800px;
+<style scoped>
+/* 1. 整体容器铺满全屏 */
+.app-wrapper {
+  min-height: 100vh;
+  background-color: #f4f5f7; /* 设置一个淡灰色背景,更具质感 */
+}
+
+/* 2. 核心:主区域避让固定导航栏 */
+.main-container {
+  padding: 0 !important; /* 覆盖 el-main 默认内边距 */
+  overflow: visible;     /* 允许内容正常流动 */
 }
 
-#aside-style {
-  min-width: 120px;
-  max-width: 240px;
-  width: 30%;
+.content-view {
+  /* PC端避让:64px 是 NavBar 的高度 */
+  padding-top: 64px;
+  min-height: calc(100vh - 64px);
+  margin: 0 auto;
+  max-width: 1400px; /* 限制内容最大宽度,居中对齐,大屏更美观 */
+}
+
+/* 3. 移动端响应式适配 */
+@media screen and (max-width: 768px) {
+  .content-view {
+    /* 移动端顶部避让:56px */
+    padding-top: 56px;
+    /* 移动端底部避让:56px 是底部导航栏高度 + 10px 间距 */
+    padding-bottom: 66px;
+    min-height: calc(100vh - 56px - 66px);
+  }
 }
 </style>
+
+<style>
+/* 全局样式覆盖(可选):去掉 body 默认边距 */
+body {
+  margin: 0;
+  padding: 0;
+  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
+}
+</style>

+ 0 - 3
src/views/search/SearchIndex.vue

@@ -1,7 +1,6 @@
 <template>
   <el-container>
     <el-main>
-      <nav-bar-no-search />
       <el-row style="padding: 5px">
         <el-input
           v-model="keyword"
@@ -242,14 +241,12 @@
 </template>
 
 <script>
-import NavBarNoSearch from 'components/layout/NavBarNoSearch'
 import SearchVideoCard from '@/components/card/SearchVideoCard'
 import { videoQuery, getWenshuDetail, wenshuQuery, keywordSuggest, hotKeyword } from '@/api/search'
 
 export default {
   name: 'SearchIndex',
   components: {
-    NavBarNoSearch,
     SearchVideoCard
   },
   data() {