From 89aa365af94d7757edf5fb452230f0f0f7f9eb28 Mon Sep 17 00:00:00 2001 From: Qing Date: Thu, 21 Dec 2023 00:43:43 +0800 Subject: [PATCH] solve nav active bug --- .env.development | 6 +++++ src/api/api.js | 28 ++++------------------ src/assets/css/home-style.css | 1 + src/components/home/HomeHeader.vue | 38 +++++++++++++++++++++--------- src/components/hotNews/HotNews.vue | 13 ++++++---- src/main.js | 3 --- src/utils/request.js | 4 ++-- vue.config.js | 18 +------------- 8 files changed, 50 insertions(+), 61 deletions(-) create mode 100644 .env.development diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..ecc9435 --- /dev/null +++ b/.env.development @@ -0,0 +1,6 @@ +# 开发环境配置 +ENV = 'development' + +# 开发环境 +VUE_APP_BASE_API = '/api' + diff --git a/src/api/api.js b/src/api/api.js index 76cc292..16b3b36 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,32 +1,12 @@ import request from "@/utils/request.js"; import qs from "qs"; -const baseUrl = '/api/jwt/auth' +const baseUrl = '/api/' -//登录 -export function authCodeLogin(params) { +export function getHotNews() { return request({ - url: baseUrl + "/authCodeLogin/" + params.code, + url: "/api", method: "get", }); -} -//退出 -export function authLogout(params) { - return request({ - url: baseUrl + "/logout", - method: "get", - }); -} -//获取用户数据 -export function getUserInfo(params) { - return request({ - url: baseUrl + "/getUserInfo", - method: "get", - params:qs.stringfy(params) - }); -} - -//其实,也不一定就是params,也可以是 query 还有 data 的呀! -//params是添加到url的请求字符串中的,用于get请求。会将参数加到 url后面。所以,传递的都是字符串。无法传递参数中含有json格式的数据 -//而data是添加到请求体(body)中的, 用于post请求。添加到请求体(body)中,json 格式也是可以的。 \ No newline at end of file +} \ No newline at end of file diff --git a/src/assets/css/home-style.css b/src/assets/css/home-style.css index 7585d5e..81d1fa0 100644 --- a/src/assets/css/home-style.css +++ b/src/assets/css/home-style.css @@ -174,6 +174,7 @@ body.light-mode .video-bg:before { border-bottom: 2px solid transparent; transition: 0.3s; } + @media screen and (max-width: 610px) { .header-menu a:not(.main-header-link) { display: none; diff --git a/src/components/home/HomeHeader.vue b/src/components/home/HomeHeader.vue index c930da8..145e4c4 100644 --- a/src/components/home/HomeHeader.vue +++ b/src/components/home/HomeHeader.vue @@ -2,14 +2,14 @@
- - - - ALL - HotNews - Discover - Market + {{item.libel}}
+ + + + + + @@ -35,8 +35,9 @@ :visible.sync="loginDialogVisible" width="30vw" append-to-body - :close-on-click-modal="false" - :before-close="modalClose" + :show-close="false" + :close-on-click-modal="true" + > @@ -172,6 +173,12 @@ export default { components: {}, data() { return { + tabList:[ + {path:'/home',libel:'ALL'}, + {path:'/news',libel:'HotNews'}, + {path:'/navDetail',libel:'navDetail'}, + {path:'/#',libel:'TEST'}, + ], loginDialogVisible: false, passwordVisible: "password", icon: "el-icon-view", @@ -190,7 +197,8 @@ export default { captcha:null, password: null, repassword:null, - } + }, + ind: '0', // 用ind作为选择标识 } }, mounted() { @@ -202,6 +210,8 @@ export default { }, computed: {}, methods: { + + // 打开登陆注册 openLoginDialog() { this.loginDialogVisible = true; @@ -288,10 +298,16 @@ export default { } - diff --git a/src/components/hotNews/HotNews.vue b/src/components/hotNews/HotNews.vue index 2649bd5..c9ed0e0 100644 --- a/src/components/hotNews/HotNews.vue +++ b/src/components/hotNews/HotNews.vue @@ -1,11 +1,10 @@ - -