修改bug

This commit is contained in:
A1300399510
2023-07-31 11:45:50 +08:00
parent 6793e4cd3e
commit 44d03fc9c3
10 changed files with 85 additions and 29 deletions

View File

@@ -7,10 +7,10 @@
<div class="index-top-navigation dis-f al-item body-maxWidth">
<div class="navigation-text" @click="topTabSelect(i, item)"
:class="{ 'navigation-text-click': item.key === topTabNum }" v-for="(item, i) in topTab.data" :key="i">
{{
item.name }}</div>
<div class="user-box">
{{ item.name }}</div>
<div class="user-box" v-if="user.data['uid'] > 0">
<img :src="user.data.avatar" class="user-img" alt="">
<!-- <img v-else src="@/assets/img/publicImage/defaultAvatar.png" class="user-img" alt=""> -->
<div class="user-out-box">
<div class="box-bg dis-f jus-x">
<div class="top-box"></div>
@@ -20,6 +20,11 @@
</div>
</div>
</div>
<div class="login-box" v-else>
<div class="login-box-item" @click="loginBtn('login')">登录</div>
<div class="login-box-item" @click="loginBtn('register')">注册</div>
</div>
</div>
</div>
<div class="dis-f jus-x al-item body-maxWidth" style="margin: auto;">
@@ -39,8 +44,7 @@
</el-carousel>
</div>
</div>
<div class="btm-seach-btn-box dis-f al-item jus-x"
v-if="pageTopBarShow">
<div class="btm-seach-btn-box dis-f al-item jus-x" v-if="pageTopBarShow">
<div class="body-maxWidth dis-f" style="height:48px;">
<div class="tab-btn dis-f al-item jus-x" :class="{ 'tab-btn-click': item.path === tabBtnType }"
v-for="(item, i) in seachTab.data" :key="i" @click="changeTabBtnType(item)">
@@ -62,6 +66,7 @@
import store from '../../store/index';
import { useRoute, useRouter } from 'vue-router'
import { reactive, watchEffect, ref, defineProps } from "vue";
import { goTologin } from '@/utils/util.js'
const props = defineProps({
bannerList: {
@@ -120,8 +125,13 @@ let topTabSelect = (type, item) => {
const router = useRouter()
let tabBtnType = ref('/')
let pageTopBarShow= router.currentRoute.value.meta.topBarShow
let pageTopBarShow = router.currentRoute.value.meta.topBarShow
let changeTabBtnType = (item) => {
// 判断点击进入 user 时是否已经登录
if (item['path'] == '/user' && user.data['uid'] == 0) {
loginBtn('login')
return
}
tabBtnType.value = item.path
router.push({
path: item.path
@@ -138,6 +148,16 @@ let routePath = ref('')
routePath.value = route.meta.path
tabBtnType.value = route.meta.path
// 点击登录注册 type login 登录 register注册
const loginBtn = type => {
if (type == 'login') {
store.state.showloginmodal = true
return
}
goTologin()
}
</script>
<style scoped>
.pos-r {
@@ -370,5 +390,31 @@ tabBtnType.value = route.meta.path
.dropdown {
background: #000;
}
.login-box {
font-size: 14px;
color: #333;
line-height: 40px;
text-align: right;
display: flex;
align-items: center;
.login-box-item {
background: #000;
color: #fff;
text-align: center;
border-radius: 57px;
width: 50px;
height: 26px;
line-height: 26px;
cursor: pointer;
&:last-child {
background: #fff;
color: #000;
margin-left: 18px;
}
}
}
</style>