123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- <template>
- <!-- 导航 -->
- <div class="navigate">
- <div class="partOne">
- <div class="inner">
- <!-- 导航一 -->
- <div class="navLeft">
- <div class="navIndex">
- <NuxtLink to="/" title="首页">
- 首页
- </NuxtLink>
- </div>
- <div class="navClass">
- <div>乡村资讯</div>
- <div>社会资讯</div>
- </div>
- </div>
- <ul class="navigationOne" v-if="navigation1.length > 0">
- <li v-for="(item, index) in navigation1" :key="index">
- <NuxtLink :to="getLinkPath(item)" :target="item.is_url == 1 ? '_blank' : '_self'">
- <span>{{ item.alias }}</span>
- </NuxtLink>
- </li>
- </ul>
- <div class="navRight" v-if="navigation2.length > 0">
- <div class="nav111" v-for="(item, index) in navigation2" :key="index">
- <NuxtLink :to="getLinkPath(item)" :target="item.is_url == 1 ? '_blank' : '_self'">
- <span>{{ item.alias }}</span>
- </NuxtLink>
- </div>
- </div>
- </div>
- </div>
- <div class="partTwo">
- <div class="inner">
- <h3>
- 深度服务
- </h3>
- <ul class="partTwoTitle" v-if="navigation3.length > 0">
- <li class="titleList" v-for="(item, index) in navigation3" :key="index">
- <NuxtLink :to="getLinkPath(item)" :target="item.is_url == 1 ? '_blank' : '_self'">
- <span>{{ item.alias }}</span>
- </NuxtLink>
- </li>
- </ul>
- <div class="searchBox">
- <input v-model="keywords" type="text" placeholder="请输入关键词" @keydown.enter="goToSearch">
- <img src="../../public/image/search.png" @keydown.enter="goToSearch" @click="goSearch">
- </div>
- </div>
- </div>
- <div class="littleNav">
- <div class="inner">
- <img src="../../public/index/hdpt.png" alt="">
- <ul class="leftPart" v-if="navigation4.length > 0">
- <li class="navList" v-for="item in navigation4" :key="index">
- <NuxtLink :to="getLinkPath(item)" :target="item.is_url == 1 ? '_blank' : '_self'">
- <span>{{ item.alias }}</span>
- </NuxtLink>
- </li>
- </ul>
- <ul class="rightPart" v-if="navigation4data2.length > 0">
- <li class="navList" v-for="item in navigation4data2" :key="index">
- <NuxtLink :to="getLinkPath(item)" :target="item.is_url == 1 ? '_blank' : '_self'">
- <span>{{ item.alias }}</span>
- </NuxtLink>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- //1.加载依赖 start ---------------------------------------->
- //1.加载依赖 end ---------------------------------------->
- //2.页面公用方法 start ---------------------------------------->
- const getLinkPath = (item) => {
- if (item.is_url == 1) {
- return `${item.web_url}`;
- } else if (item.children_count == 0) {
- //return `/newsList/${item.category_id}?page=1`;
- return `/${item.aLIas_pinyin}/list-1.html`;
- } else {
- //return `/primaryNavigation/${item.aLIas_pinyin}/`;
- return `/${item.aLIas_pinyin}/index.html`;
- }
- }
- //搜索跳转
- //点击搜索按钮
- let goSearch = () => {
- const route = `/search/search?keyword=${keywords.value}`;
- window.location.href = route;
- }
- //2.页面公用方法 end ---------------------------------------->
- //3.获取导航菜单 start ---------------------------------------->
- const navigation1 = ref([]);
- //2是那个独立的2个
- const navigation2 = ref([]);
- const navigation3 = ref([]);
- //下面一行是2边分开的 一边5个
- const navigation4 = ref([]);
- const navigation4data2 = ref([]);
- //获取导航菜单1
- async function getNavigation1() {
- const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
- method: 'GET',
- query: {
- 'pid': 0,
- 'num': 20,
- 'placeid': 1
- },
- });
- navigation1.value = mkdata.data;
- }
- getNavigation1();
- //获取导航菜单2
- async function getNavigation2() {
- const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
- method: 'GET',
- query: {
- 'pid': 0,
- 'num': 2,
- 'placeid': 21
- },
- });
- navigation2.value = mkdata.data;
- }
- getNavigation2();
- //获取导航菜单4
- async function getNavigation4() {
- const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
- method: 'GET',
- query: {
- 'pid': 0,
- 'num': 10,
- 'placeid': 23
- },
- });
- for (let i in mkdata.data) {
- if (i < 5) {
- navigation4.value.push(mkdata.data[i]);
- } else {
- navigation4data2.value.push(mkdata.data[i]);
- }
- }
- //navigation4.value = mkdata.data;
- //navigation4data2.value = mkdata.data;
- }
- getNavigation4();
- //获取导航菜单3
- async function getNavigation3() {
- const mkdata = await requestDataPromise('/web/getWebsiteModelCategory', {
- method: 'GET',
- query: {
- 'pid': 0,
- 'num': 6,
- 'placeid': 33
- },
- });
- navigation3.value = mkdata.data;
- }
- getNavigation3();
- //3.获取导航菜单 end ---------------------------------------->
- //4.跳转到搜索页面 start ---------------------------------------->
- const keywords = ref("")
- let goToSearch = () => {
- const route = "/search/search?keyword=" + keywords.value;
- window.open(route, '_blank');
- }
- //4.跳转到搜索页面 end ---------------------------------------->
- </script>
- <style lang="less" scoped>
- // 导航部分
- .partOne .navigationOne,
- .partOne .navigationOne>li {
- float: left;
- }
- .partOne {
- width: 100%;
- height: 133px;
- // margin-bottom: 10px;
- background-color: #a01c0e;
- font-size: 20px;
- font-family: PingFang SC-Semibold;
- .inner {
- display: flex;
- justify-content: space-between;
- .navLeft {
- width: 160px;
- font-size: 16px;
- display: flex;
- }
- .navIndex {
- height: 100px;
- line-height: 130px;
- a {
- font-weight: bold;
- font-size: 16px;
- color: #F8ECD2;
- }
- }
- .navClass {
- padding-top: 35px;
- padding-left: 30px;
- font-weight: bold;
- color: #F8ECD2;
- div:nth-child(2) {
- padding-top: 17px;
- }
- }
- }
- .navigationOne {
- width: 1200px;
- color: #333;
- display: flex;
- flex-wrap: wrap;
- padding-top: 24px;
- li {
- width: 74px;
- font-family: PingFang SC;
- height: 42px;
- line-height: 42px;
- //font-weight: 600;
- font-size: 16px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- margin: 0 10px;
- text-align: center;
- a {
- font-weight: 400;
- font-size: 16px;
- color: #FFFFFF;
- display: block;
- }
- }
- >li:hover a {
- color: #F8ECD2;
- }
- .active {
- color: #F8ECD2;
- }
- }
- .navRight {
- width: 135px;
- height: 75px;
- font-size: 16px;
- margin-top: 30px;
- background: url(https://img.bjzxtw.org.cn/master/www/xcw/nav_bg.png) no-repeat;
- .nav111 {
- width: 98px;
- height: 30px;
- line-height: 44px;
- text-align: center;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- a {
- font-weight: bold;
- background: linear-gradient(to bottom, #FFF6B1 0%, #F5BC38 100%);
- -webkit-background-clip: text;
- color: transparent;
- }
- }
- }
- }
- .partTwo {
- width: 100%;
- height: 60px;
- line-height: 60px;
- // border-bottom: 1px solid #e3e3e3;
- background-color: #fafafa;
- .inner {
- width: 1200px;
- height: 57px;
- display: flex;
- // justify-content: space-between;
- h3 {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- padding-left: 60px;
- a {
- color: #333333;
- }
- }
- .partTwoTitle {
- display: flex;
- justify-content: flex-start;
- width: 633px;
- padding-left: 30px;
- padding-right: 30px;
- .titleList {
- font-size: 16px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- margin-right: 25px;
- a {
- color: #333333;
- }
- }
- .titleList:hover a {
- color: #A01C0E;
- }
- }
- .searchBox {
- width: 356px;
- height: 40px;
- line-height: 40px;
- background-color: #fff;
- margin-top: 10px;
- border-radius: 25px;
- border: 1px solid #ededed;
- input {
- width: 285px;
- height: 35px;
- line-height: 35px;
- margin-left: 20px;
- border: none;
- outline: none;
- }
- img {
- width: 32px;
- height: 32px;
- vertical-align: middle;
- cursor: pointer;
- }
- }
- }
- }
- //小导航
- .littleNav {
- width: 100%;
- height: 88px;
- margin-top: 15px;
- .inner {
- width: 1200px;
- height: 88px;
- line-height: 88px;
- margin: 0 auto;
- display: flex;
- border: 1px solid #D3D5D8;
- background-color: #fafafa;
- img {
- width: 138px;
- height: 28px;
- margin-top: 30px;
- margin-left: 25px;
- }
- .leftPart {
- margin-left: 40px;
- margin-right: 10px;
- }
- .leftPart,
- .rightPart {
- width: 470px;
- height: 78px;
- margin-top: 5px;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 10px;
- border-bottom: 3px solid #A01C0E;
- .navList {
- a {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- }
- }
- .navList:hover a {
- color: #A01C0E;
- }
- }
- }
- }
- </style>
|