solve nav active bug

This commit is contained in:
landaiqing 2023-12-21 00:43:43 +08:00
parent c0a044355b
commit 89aa365af9
8 changed files with 50 additions and 61 deletions

6
.env.development Normal file
View File

@ -0,0 +1,6 @@
# 开发环境配置
ENV = 'development'
# 开发环境
VUE_APP_BASE_API = '/api'

View File

@ -1,32 +1,12 @@
import request from "@/utils/request.js"; import request from "@/utils/request.js";
import qs from "qs"; import qs from "qs";
const baseUrl = '/api/jwt/auth' const baseUrl = '/api/'
//登录 export function getHotNews() {
export function authCodeLogin(params) {
return request({ return request({
url: baseUrl + "/authCodeLogin/" + params.code, url: "/api",
method: "get", 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请求。添加到请求体bodyjson 格式也是可以的。

View File

@ -174,6 +174,7 @@ body.light-mode .video-bg:before {
border-bottom: 2px solid transparent; border-bottom: 2px solid transparent;
transition: 0.3s; transition: 0.3s;
} }
@media screen and (max-width: 610px) { @media screen and (max-width: 610px) {
.header-menu a:not(.main-header-link) { .header-menu a:not(.main-header-link) {
display: none; display: none;

View File

@ -2,14 +2,14 @@
<div class="header"> <div class="header">
<div class="menu-circle"></div> <div class="menu-circle"></div>
<div class="header-menu"> <div class="header-menu">
<!-- <router-link class="router" to="/home"><a class="menu-link is-active" >ALL</a></router-link>--> <router-link class="menu-link" active-class="is-active" v-for="(item,index) in tabList" v-if="tabList.length>0" :key="item.index" :to="item.path" >{{item.libel}}</router-link>
<!-- <router-link class="router" to="/hotNews"><a class="menu-link notify">HotNews</a></router-link>-->
<!-- <router-link class="router" to="/navDetail"><a class="menu-link">Discover</a></router-link>-->
<router-link class="menu-link is-active" to="/home">ALL</router-link>
<router-link class="menu-link notify" to="/news">HotNews</router-link>
<router-link class="menu-link" to="/navDetail">Discover</router-link>
<router-link class="menu-link notify" to="#">Market</router-link>
</div> </div>
<!-- <el-menu class="header-menu" :default-active="$route.path" router background-color="#0C0F194C">-->
<!-- <el-menu-item class="menu-link is-active" index="/home">ALL</el-menu-item>-->
<!-- <el-menu-item class="menu-link notify" index="/news">HotNews</el-menu-item>-->
<!-- <el-menu-item class="menu-link" index="/navDetail">Discover</el-menu-item>-->
<!-- <el-menu-item class="menu-link notify" index="#">Market</el-menu-item>-->
<!-- </el-menu>-->
<div class="search-bar"> <div class="search-bar">
<input type="text" placeholder="Search"> <input type="text" placeholder="Search">
</div> </div>
@ -35,8 +35,9 @@
:visible.sync="loginDialogVisible" :visible.sync="loginDialogVisible"
width="30vw" width="30vw"
append-to-body append-to-body
:close-on-click-modal="false" :show-close="false"
:before-close="modalClose" :close-on-click-modal="true"
> >
<el-tabs type="border-card"> <el-tabs type="border-card">
<el-tab-pane> <el-tab-pane>
@ -172,6 +173,12 @@ export default {
components: {}, components: {},
data() { data() {
return { return {
tabList:[
{path:'/home',libel:'ALL'},
{path:'/news',libel:'HotNews'},
{path:'/navDetail',libel:'navDetail'},
{path:'/#',libel:'TEST'},
],
loginDialogVisible: false, loginDialogVisible: false,
passwordVisible: "password", passwordVisible: "password",
icon: "el-icon-view", icon: "el-icon-view",
@ -190,7 +197,8 @@ export default {
captcha:null, captcha:null,
password: null, password: null,
repassword:null, repassword:null,
} },
ind: '0', // ind
} }
}, },
mounted() { mounted() {
@ -202,6 +210,8 @@ export default {
}, },
computed: {}, computed: {},
methods: { methods: {
// //
openLoginDialog() { openLoginDialog() {
this.loginDialogVisible = true; this.loginDialogVisible = true;
@ -288,10 +298,16 @@ export default {
} }
</script> </script>
<style scoped> <style>
.dialog { .dialog {
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
} }
.el-dialog {
background: rgba(255, 255, 255, 0.98);
}
.el-dialog__header {
display: none;
}
</style> </style>

View File

@ -1,11 +1,10 @@
<template> <template>
<div> <div>
666 666
</div> </div>
</template> </template>
<script> <script>
import {getHotNews} from '@/api/api'
export default { export default {
name: "HotNews", name: "HotNews",
components: {}, components: {},
@ -13,13 +12,19 @@ export default {
return {} return {}
}, },
mounted() { mounted() {
this.getNews();
}, },
created() { created() {
}, },
computed: {}, computed: {},
methods: {} methods: {
getNews(){
getHotNews().then(response=>{
console.log(response);
})
}
}
} }
</script> </script>
<style scoped> <style scoped>

View File

@ -14,9 +14,6 @@ window.$ = $;
import * as echarts from 'echarts';//引入echarts import * as echarts from 'echarts';//引入echarts
Vue.prototype.$echarts = echarts //引入组件 Vue.prototype.$echarts = echarts //引入组件
import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(ElementUI); Vue.use(ElementUI);
new Vue({ new Vue({

View File

@ -2,11 +2,11 @@
// 导入axios // 导入axios
import axios from 'axios' import axios from 'axios'
// 使用element-ui Message做消息提醒 // 使用element-ui Message做消息提醒
import { Message} from 'element-plus'; import { Message} from 'element-ui';
//1. 创建新的axios实例 //1. 创建新的axios实例
const service = axios.create({ const service = axios.create({
// 公共接口--这里注意后面会讲 // 公共接口--这里注意后面会讲
baseURL: 'http://localhost:8080', baseURL: process.env.VUE_APP_BASE_API,
// 超时时间 单位是ms这里设置了3s的超时时间 // 超时时间 单位是ms这里设置了3s的超时时间
timeout: 3 * 1000 timeout: 3 * 1000
}) })

View File

@ -10,7 +10,7 @@ module.exports = defineConfig({
'/api': { '/api': {
//后端接口的baseurl //后端接口的baseurl
target: 'http://localhost:8082/helloGithub_war_exploded', target: 'https://open.tophub.today/daily',
//是否允许跨域 //是否允许跨域
changeOrigin: true, changeOrigin: true,
// ws: true, //是否代理 websockets // ws: true, //是否代理 websockets
@ -24,22 +24,6 @@ module.exports = defineConfig({
'^/api': '' '^/api': ''
} }
}, },
'/image': {
//后端接口的baseurl
target: 'https://tucdn.wpon.cn/api/',
//是否允许跨域
changeOrigin: true,
// ws: true, //是否代理 websockets
// secure: true,
// 'secure': true,
headers: {
Connection: "kepp-alive"
},
pathRewrite: {
//这里的作用是使用去掉api
'^/image': ''
}
},
} }
} }
}) })