Эх сурвалжийг харах

完成详情页与搜索页

完成详情页与搜索页
dangyunlong 2 өдөр өмнө
parent
commit
f706483c6f

+ 158 - 319
assets/css/search.less

@@ -1,7 +1,8 @@
 //导航条
 .breadcrumb {
-    width: 100%;
-    height: 22px;
+    width: 1200px;
+    margin: 0 auto;
+    height: 52px;
     margin-bottom: 30px;
     font-family: Microsoft YaHei, Microsoft YaHei;
     font-weight: 400;
@@ -11,12 +12,11 @@
     text-align: left;
     font-style: normal;
     text-transform: none;
-
+    border-bottom: 1px solid #D9D9D9;
     :deep(.el-breadcrumb) {
         display: inline-block;
         vertical-align: -4px;
     }
-
     :deep(.el-breadcrumb__inner a),
     :deep(.el-breadcrumb__inner.is-link) {
         color: #666666;
@@ -24,7 +24,6 @@
         text-decoration: none;
         transition: var(--el-transition-color);
     }
-
     span {
         font-family: Microsoft YaHei, Microsoft YaHei;
         font-weight: 400;
@@ -35,11 +34,9 @@
         font-style: normal;
         text-transform: none;
     }
-
     span:hover {
         color: #666666;
     }
-
     .location {
         margin-right: 20px;
         width: 100px;
@@ -54,7 +51,6 @@
         text-transform: none;
     }
 }
-
 .empty {
     div {
         display: flex;
@@ -62,45 +58,72 @@
         align-items: center;
         padding-top: 200px;
     }
-
     width: 100%;
     height: 600px;
     font-size: 26px;
     color: #CCCCCC;
-
     img {
         display: inline-block;
     }
 }
 
-// 资讯列表
-.newsList {
+//资讯推荐
+.searchBox {
+    text-align: center;
+    padding-bottom: 40px;
+}
+.search {
+    width: 100%;
+    height: 100px;
+    // background-color: #f5f5f5;
+    .inner {
+        width: 1200px;
+        padding-top: 10px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        input {
+            width: 582px;
+            height: 46px;
+            outline: none;
+            border: 1px solid #E6E6E6;
+            border-radius: 0;
+            padding-left: 20px;
+            vertical-align: 0px;
+            font-size: 16px;
+            color: #666666
+        }
+        button {
+            width: 120px;
+            height: 48px;
+            color: #fff;
+            border: none;
+            border-radius: 0;
+            cursor: pointer;
+        }
+    }
+}
+
+
+//皮肤样式1
+//搜索样式
+.searchStyle1 {
+    background-color: #1C5468;
+}
+//列表样式
+.newsListStyle1 {
     width: 1200px;
     margin: 0 auto;
     //height: 675px;
     margin-bottom: 70px;
-
     .inner {
         width: 1200px;
-
         .innerLeft {
             width: 100%;
-        }
-
-        .innerLeft,
-        .innerRight {
-            border-top: 1px solid #D9D9D9;
             clear: both;
             float: none;
-        }
-
-        .innerLeft {
-            //height: 675px;
-
             .list {
-                //height: 570px;
                 margin-bottom: 70px;
-
                 li {
                     width: 100%;
                     height: 56px;
@@ -108,8 +131,6 @@
                     overflow: hidden;
                     text-overflow: ellipsis;
                     line-height: 56px;
-
-
                     a {
                         width: 360px;
                         height: 26px;
@@ -122,7 +143,6 @@
                         font-style: normal;
                         text-transform: none;
                     }
-
                     .listText {
                         display: inline-block;
                         width: 1000px;
@@ -130,7 +150,15 @@
                         overflow: hidden;
                         text-overflow: ellipsis;
                     }
-
+                    &:nth-child(1) a span.listText::after,
+                    &:nth-child(2) a span.listText::after {
+                        content: "热";
+                        margin-left: 13px;
+                        background: #DD7D18;
+                        color: #fff;
+                        font-size: 14px;
+                        padding: 0px 2px;
+                    }
                     .time {
                         float: right;
                         font-family: Microsoft YaHei, Microsoft YaHei;
@@ -139,28 +167,20 @@
                         color: #333333;
                         padding-top: 15px;
                     }
-
+                    &:nth-child(1) a ,&:nth-child(6) a,&:nth-child(11) a,&:nth-child(16) a {
+                        font-weight: bold;
+                    }
+                    &:nth-child(6),&:nth-child(11),&:nth-child(16){
+                        margin-top: 20px;
+                    }
                 }
-
                 >li:hover>a {
-                    color: #DD7D18;
-                }
-
-                >li:nth-child(1)::after,
-                >li:nth-child(2)::after {
-                    content: "热";
-                    margin-left: 13px;
-                    background: #DD7D18;
-                    color: #fff;
-                    font-size: 14px;
-                    padding: 0px 2px;
+                    color: #1C5468;
                 }
-
                 >li:nth-child(5n) {
                     border-bottom: 1px solid #D9D9D9;
                 }
             }
-
             >.pagination {
                 width: 100%;
                 height: 34px;
@@ -168,12 +188,10 @@
                 display: flex;
                 justify-content: center;
                 margin: 0;
-
                 // 鼠标移入后字体颜色
                 .el-pagination::v-deep :hover {
-                    color: #DD7D18;
+                    color: #1C5468;
                 }
-
                 .el-pagination.is-background::v-deep .btn-next,
                 .el-pagination.is-background::v-deep .btn-prev {
                     width: 70px;
@@ -181,308 +199,129 @@
                     margin: 0px 10px;
                     border-radius: 4px;
                 }
-
                 .el-pagination.is-background::v-deep .el-pager li {
                     margin: 0px 10px;
                     width: 38px;
                     height: 34px;
                     border-radius: 4px;
                 }
-
                 .el-pagination.is-background::v-deep .btn-next.is-active,
                 .el-pagination.is-background::v-deep .btn-prev.is-active,
                 .el-pagination.is-background::v-deep .el-pager li.is-active {
-                    background-color: #DD7D18;
+                    background-color: #1C5468;
                     color: #fff;
                 }
-
-
             }
         }
-
-        .innerRight {
-            width: 381px;
-            height: 605px;
-            clear: both;
-            overflow: hidden;
-        }
     }
 }
 
-//资讯推荐
-.zixuntuijian {
-    width: 100%;
-    height: 290px;
+//皮肤样式2
+.searchStyle2 {
+    background-color: #A91B33;
+}
+//列表样式
+.newsListStyle2 {
+    width: 1200px;
+    margin: 0 auto;
+    //height: 675px;
     margin-bottom: 70px;
-
-    .innerLeft {
-
-        // 左侧
-        .zixunLeft {
-            margin-right: 30px;
-        }
-
-        .zixunRight,
-        .zixunLeft {
-            float: left;
-            width: 380px;
-            height: 290px;
-
-            // 标题部分
-            >.title {
-                width: 380px;
-            }
-
-            >.title>h3 {
-                height: 36px;
-                font-family: Source Han Sans, Source Han Sans;
-                font-weight: bold;
-                font-size: 24px;
-                color: #000000;
-                line-height: 28px;
-                text-align: left;
-                font-style: normal;
-                text-transform: none;
-                border-bottom: 1px solid #DD7D18;
-
-            }
-
-            >.title>h3>span {
-                float: right;
-                width: 56px;
-                height: 20px;
-                line-height: 24px;
-                font-weight: 400;
-                font-size: 14px;
-                color: #999999;
-                font-style: normal;
-                text-transform: none;
-            }
-
-            .photo_text {
-
-                >li:first-child {
-                    width: 380px;
-                    height: 120px;
-                    margin-top: 20px;
-                    margin-bottom: 15px;
-                    position: relative;
-
-                    >img {
-                        float: left;
-                        width: 160px;
-                        height: 120px;
-                    }
-
-                    >div {
-                        float: left;
-                        width: 220px;
-                        height: 120px;
-                        padding-left: 15px;
-                        padding-top: 6px;
-                        box-sizing: border-box;
-                        background-color: #f6f6f6;
-
-
-                        >h5 {
-                            width: 200px;
-                            height: 54px;
-                            display: -webkit-box;
-                            -webkit-box-orient: vertical;
-                            -webkit-line-clamp: 2;
-                            overflow: hidden;
-                            text-overflow: ellipsis;
-                            word-break: break-all;
-                            font-family: Source Han Sans, Source Han Sans;
-                            font-weight: 500;
-                            font-size: 18px;
-                            color: #333333;
-                            line-height: 26px;
-                            text-align: left;
-                            font-style: normal;
-                            text-transform: none;
-                        }
-
-                        >p {
-                            width: 200px;
-                            height: 22px;
-                            line-height: 20px;
-                            position: absolute;
-                            bottom: 5px;
-                            right: 0;
-
-                            >span {
-                                display: inline-block;
-                                // width: 100px;
-                                height: 18px;
-                                font-family: Source Han Sans, Source Han Sans;
-                                font-weight: 400;
-                                font-size: 12px;
-                                color: #999999;
-                                text-align: left;
-                                line-height: 14px;
-                                font-style: normal;
-                                text-transform: none;
-                            }
-
-                            >span:last-child {
-                                // width: 90px;
-                                text-align: right;
-                                margin-left: 20px;
-                            }
-
-                        }
-                    }
-                }
-
-                >li {
-                    width: 380px;
-                    height: 25px;
+    .inner {
+        width: 1200px;
+        .innerLeft {
+            width: 100%;
+            clear: both;
+            float: none;
+            .list {
+                margin-bottom: 70px;
+                li {
+                    width: 100%;
+                    height: 56px;
                     white-space: nowrap;
                     overflow: hidden;
                     text-overflow: ellipsis;
-                    font-family: PingFang SC, PingFang SC;
-                    font-weight: 500;
-                    font-size: 18px;
-                    color: #333333;
-                    line-height: 21px;
-                    text-align: left;
-                    font-style: normal;
-                    text-transform: none;
-                    margin-bottom: 10px;
-
-                    em {
+                    line-height: 56px;
+                    a {
+                        width: 360px;
+                        height: 26px;
+                        font-family: Microsoft YaHei, Microsoft YaHei;
+                        font-weight: 400;
+                        font-size: 20px;
+                        color: #333333;
+                        line-height: 26px;
+                        text-align: left;
+                        font-style: normal;
+                        text-transform: none;
+                    }
+                    .listText {
                         display: inline-block;
-                        width: 8px;
-                        height: 8px;
-                        border-radius: 8px;
-                        margin-right: 10px;
-                        background-color: #d9d9d9;
+                        width: 1000px;
+                        white-space: nowrap;
+                        overflow: hidden;
+                        text-overflow: ellipsis;
+                    }
+                    &:nth-child(1) a span.listText::after,
+                    &:nth-child(2) a span.listText::after {
+                        content: "热";
+                        margin-left: 13px;
+                        background: #DD7D18;
+                        color: #fff;
+                        font-size: 14px;
+                        padding: 0px 2px;
+                    }
+                    .time {
+                        float: right;
+                        font-family: Microsoft YaHei, Microsoft YaHei;
+                        font-weight: 400;
+                        font-size: 18px;
+                        color: #333333;
+                        padding-top: 15px;
+                    }
+                    &:nth-child(1) a ,&:nth-child(6) a,&:nth-child(11) a,&:nth-child(16) a {
+                        font-weight: bold;
+                    }
+                    &:nth-child(6),&:nth-child(11),&:nth-child(16){
+                        margin-top: 20px;
                     }
                 }
-
-                >li:hover {
-                    color: #139602;
+                >li:hover>a {
+                    color: #A91B33;
                 }
-
-                >li:hover em {
-                    background-color: #139602;
+                >li:nth-child(5n) {
+                    border-bottom: 1px solid #D9D9D9;
                 }
             }
-        }
-    }
-
-    .innerRight {
-        width: 381px;
-        height: 290px;
-        background-color: #fbfbfb;
-
-        >.title {
-            width: 380px;
-            height: 40px;
-            line-height: 40px;
-            border-top: 1px solid #139602;
-            border-bottom: 1px solid #e7e7e7;
-
-            >h4 {
-                font-family: Microsoft YaHei, Microsoft YaHei;
-                font-weight: 400;
-                margin-left: 20px;
-                font-size: 20px;
-                color: #000000;
-                text-align: left;
-                font-style: normal;
-                text-transform: none;
-
-                >span {
-                    float: right;
-                    font-family: Microsoft YaHei, Microsoft YaHei;
-                    font-weight: 400;
-                    font-size: 14px;
-                    margin-right: 10px;
-                    color: #999999;
-                    text-align: left;
-                    font-style: normal;
-                    text-transform: none;
+            >.pagination {
+                width: 100%;
+                height: 34px;
+                margin-left: 141px;
+                display: flex;
+                justify-content: center;
+                margin: 0;
+                // 鼠标移入后字体颜色
+                .el-pagination::v-deep :hover {
+                    color: #A91B33;
                 }
-            }
-
-        }
-
-        .rightList {
-            height: 540px;
-            margin-top: 20px;
-
-            >li {
-                height: 100px;
-                margin-bottom: 10px;
-
-                >img {
-                    width: 150px;
-                    height: 100px;
+                .el-pagination.is-background::v-deep .btn-next,
+                .el-pagination.is-background::v-deep .btn-prev {
+                    width: 70px;
+                    height: 34px;
+                    margin: 0px 10px;
+                    border-radius: 4px;
                 }
-
-                >p {
-                    width: 219px;
-                    height: 100px;
-                    padding-left: 12px;
-                    font-family: PingFang SC, PingFang SC;
-                    font-weight: 400;
-                    font-size: 16px;
-                    color: #333333;
-                    line-height: 22px;
-                    text-align: left;
-                    font-style: normal;
-                    text-transform: none;
-
+                .el-pagination.is-background::v-deep .el-pager li {
+                    margin: 0px 10px;
+                    width: 38px;
+                    height: 34px;
+                    border-radius: 4px;
                 }
-
-                >p:hover {
-                    box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
+                .el-pagination.is-background::v-deep .btn-next.is-active,
+                .el-pagination.is-background::v-deep .btn-prev.is-active,
+                .el-pagination.is-background::v-deep .el-pager li.is-active {
+                    background-color: #A91B33;
+                    color: #fff;
                 }
             }
         }
-
-    }
-}
-
-.searchBox {
-    text-align: center;
-    padding-bottom: 40px;
-}
-
-.search {
-    width: 100%;
-    height: 100px;
-    // background-color: #f5f5f5;
-
-    .inner {
-        width: 1200px;
-        height: 100px;
-        // line-height: 100px;
-        padding-top: 10px;
-        text-align: center;
-
-        input {
-            width: 582px;
-            height: 46px;
-            outline: none;
-            border: 1px solid #E6E6E6;
-            border-radius: 0;
-            padding-left: 20px;
-            vertical-align: 0px;
-            font-size: 16px;
-            color: #666666
-        }
-
-        button {
-            width: 120px;
-            height: 48px;
-            background-color: #DD7D18;
-            color: #fff;
-            border: none;
-            border-radius: 0;
-            cursor: pointer;
-        }
     }
 }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 107 - 0
components/template/component/article/900x1384/1.vue


+ 5 - 4
components/template/sector/body/article/article/1200x1710/1.vue

@@ -6,7 +6,7 @@
             </div>
             <div class="articleContentBox">
                 <div class="articleContentBoxLeft">
-                    <article1Style :templateData="articleData" />
+                    <article1Style :templateData="articleData" :skinId="skinId" />
                 </div>
                 <div class="articleContentBoxRight">
                     <div class="articleContentBoxRightTop">
@@ -57,11 +57,11 @@ const props = defineProps({
 <style lang="less" scoped>
 .articleBigBox{
     width: 100%;
-    height: 1587px;
+    //height: 1587px;
     margin-bottom: 30px;
     .articleBox{
         width: 1200px;
-        height: 1587px;
+        //height: 1587px;
         margin: 0 auto;
         .listRouterBox{
             border-bottom: 1px solid #D9D9D9;
@@ -73,12 +73,13 @@ const props = defineProps({
             margin-top: 17px;
             .articleContentBoxLeft {
                 width: 900px;
-                height: 1384px;
+                //height: 1384px;
                 position: relative;
             }
             .articleContentBoxRight {
                 width: 270px;
                 height: 1050px;
+                margin-bottom: 30px;
                 .articleContentBoxRightTop {
                     width: 270px;
                     height: 440px;

+ 125 - 0
components/template/sector/body/search/list/1200x1300/1.vue

@@ -0,0 +1,125 @@
+<template>
+    <div class="search">
+        <div class="inner">
+            <input v-model="keywordInput" type="text" placeholder="请输入搜索内容">
+            <button @click="goSearch" :class="'searchStyle' + skinId">搜索</button>
+        </div>
+    </div>
+    <div class="breadcrumb">
+        <div class="inner">
+            <span class="location">当前位置:</span>
+            <el-breadcrumb :separator-icon="ArrowRight">
+                <el-breadcrumb-item>
+                    <NuxtLink to="/">首页</NuxtLink>
+                </el-breadcrumb-item>
+                <el-breadcrumb-item>搜索</el-breadcrumb-item>
+            </el-breadcrumb>
+        </div>
+    </div>
+    <div :class="'newsListStyle' + skinId">
+        <div class="inner">
+            <div class="innerLeft">
+                <ul class="list" v-if="newsList.length >= 0">
+                    <li v-for="(item, index) in newsList" :key="index">
+                        <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
+                            :target="item.islink == 1 ? '_blank' : '_self'">
+                            <span class="listText"> {{ item.title }}</span>
+                            <span class="time">{{ getTime(item.updated_at, 'month', 1) }}</span>
+                        </NuxtLink>
+                    </li>
+                </ul>
+                <div v-if="newsList.length == 0" class="empty">
+                    <div>
+                        <img src="http://img.bjzxtw.org.cn/pre/image/png/20250721/1753076876631321.png" alt="暂无内容">
+                        <p>暂无搜索数据</p>
+                    </div>
+                </div>
+                <div class="pagination" v-if="total > 0">
+                    <el-pagination 
+                        size="small" 
+                        background layout="prev, pager, next" 
+                        :total="total" class="mt-4"
+                        :page-size="pageSize" 
+                        prev-text="上一页" 
+                        next-text="下一页" 
+                        @change="changePage" 
+                    />
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
+import { ArrowRight } from '@element-plus/icons-vue'
+//获得皮肤编号
+const props = defineProps({
+    skinId:String,
+});
+//搜索栏 start---------------------------------------->
+//自助建站没有城市,部门的功能
+// const route = useRoute();
+// const pageCatids = ""
+// if (route.params.id == 'search') {
+// } else {
+//     const pageCatids = route.params.id
+// }
+//const pageDepartment_id = route.query.department_id;
+//关键词
+let total = useState("total", () => 0)
+let page = useState("page", () => 1)
+let pageSize = useState("pageSize", () => 20)
+//格式化跳转链接
+const getLinkPathDetail = (item) => {
+    if (item.islink == 1) {
+        return `${item.linkurl}`;
+    } else {
+        return `/${item.pinyin}/${item.id}.html`;
+    }
+}
+//搜索栏 end---------------------------------------->
+//新闻列表 start---------------------------------------->
+// 新闻列表
+const newsList = ref([]);
+let keywordInput = ref("");
+//搜索
+let goSearch = async () => {
+    console.log(page.value)
+    console.log(pageSize.value)
+    console.log(keywordInput.value)
+    //console.log(pageCatids)
+    //console.log(pageDepartment_id)
+    const listData = await requestDataPromise('/web/selectWebsiteCategory', {
+        method: 'GET',
+        query: {
+            'page': page.value,
+            'pageSize': pageSize.value,
+            'keyword': keywordInput.value,
+            //'cityid': pageCatids,
+            //'department_id': pageDepartment_id
+        },
+    });
+    if (listData.data.rows) {
+        console.log(listData)
+        newsList.value = listData.data.rows;
+        total.value = listData.data.count;
+    } else {
+        newsList.value = [];
+        total.value = 0;
+    }
+}
+goSearch();
+//分页事件
+let changePage = (value) => {
+    console.log("当前页码", value);
+    page.value = value
+    console.log(page.value);
+    goSearch()
+}
+//新闻列表 end---------------------------------------->
+</script>
+
+<style lang="less" scoped>
+@import url('@/assets/css/search.less');
+</style>

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 20 - 21
pages/[dir]/[id].vue


+ 68 - 279
pages/search/[id].vue

@@ -1,296 +1,85 @@
 <template>
     <div id="newsList">
-        <!-- 页面头部 -->
-        <HomePageHead></HomePageHead>
-        <!-- 导航栏 -->
-        <HomePageNavigation1></HomePageNavigation1>
-        <!-- 列表页广告一 -->
-        <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
-        <!-- 搜索框 -->
-        <div class="search">
-            <div class="inner">
-                <input v-model="keywordInput" type="text" placeholder="请输入搜索内容">
-                <button @click="goSearch">搜索</button>
-            </div>
+        <!-- 头部 -->
+        <templateHead></templateHead>
+        <!-- 菜单 -->
+        <templateMenu></templateMenu>
+        <div>
+            <!--广告组件 农民网-->
+            <templateAd :adTag="'nmw_search_0001'" :skinId="skinId" :adData="adData"></templateAd>
+            <!--搜索组件-->
+            <templateSearch :skinId="skinId" :templateData="testTemplateData"></templateSearch>
+            <!--广告组件 农民网-->
+            <templateAd :adTag="'nmw_search_0002'" :skinId="skinId" :adData="adData"></templateAd>
         </div>
-        <div class="breadcrumb">
-            <div class="inner">
-                <span class="location">当前位置:</span>
-                <el-breadcrumb :separator-icon="ArrowRight">
-                    <el-breadcrumb-item>
-                        <NuxtLink to="/">首页</NuxtLink>
-                    </el-breadcrumb-item>
-                    <el-breadcrumb-item>搜索</el-breadcrumb-item>
-                </el-breadcrumb>
-            </div>
-        </div>
-        <div class="newsList">
-            <div class="inner">
-                <div class="innerLeft">
-                    <ul class="list" v-if="newsList.length >= 0">
-                        <li v-for="(item, index) in newsList" :key="index">
-                            <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
-                                :target="item.islink == 1 ? '_blank' : '_self'">
-                                <span class="listText"> {{ item.title }}</span>
-                                <span class="time">{{ getTime(item.updated_at, 'month', 1) }}</span>
-                            </NuxtLink>
-                        </li>
-                    </ul>
-                    <div v-if="newsList.length == 0" class="empty">
-                        <div>
-                            <img src="../../public/search/empty.png" alt="暂无内容">
-                            <p>暂无搜索数据</p>
-                        </div>
-                    </div>
-                    <!-- 分页器 -->
-                    <div class="pagination" v-if="total > 0">
-                        <el-pagination size="small" background layout="prev, pager, next" :total="total" class="mt-4"
-                            :page-size="pageSize" prev-text="上一页" next-text="下一页" @change="changePage" />
-                    </div>
-                </div>
-            </div>
-        </div>
-        <!-- 列表页广告二 -->
-        <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
-        <!-- 页面底部 -->
-        <HomeFoot></HomeFoot>
+        <!-- 底部 -->
+        <templateFoot></templateFoot>
     </div>
 </template>
 
 <script setup>
-//1.页面依赖 start ---------------------------------------->
-import { ElBreadcrumb, ElBreadcrumbItem, ElPagination } from 'element-plus'
-import { ArrowRight } from '@element-plus/icons-vue'
+//0.加载全局模板组件 start---------------------------------------->
+//0.1 全局通栏
+import templateHead from '@/components/template/sector/head/1200x200/1.vue'
+import templateMenu from '@/components/template/sector/menu/1200x130/1.vue'
+import templateFoot from '@/components/template/sector/foot/1200x580/1.vue'
+//0.2.1 广告组件
+import templateAd from '@/components/template/sector/body/ad/1200x90/1.vue'
+//0.2.2 搜索组件
+import templateSearch from '@/components/template/sector/body/search/list/1200x1300/1.vue'
+//0.加载全局模板组件 end---------------------------------------->
+
+//1.获得基本信息单元 start---------------------------------------->
+//1.1获得页面依赖
 import { ref, onMounted } from 'vue';
-
-const route = useRoute();
-//const pageCatids = route.query.catids;
-const pageCatids = ""
-if (route.params.id == 'search') {
-
-} else {
-    const pageCatids = route.params.id
-}
-
-const pageDepartment_id = route.query.department_id;
-
-//const category_id = route.query.category_id; //获得该页面的id
-// const searchKey = route.query.keyword
-// const catids = ref([]);
-
-//关键词
-let total = useState("total", () => 0)
-let page = useState("page", () => 1)
-let pageSize = useState("pageSize", () => 20)
-
-//格式化跳转链接
-const getLinkPathDetail = (item) => {
-    if (item.islink == 1) {
-        return `${item.linkurl}`;
-    } else {
-        return `/${item.pinyin}/${item.id}.html`;
-    }
-}
-//1.页面依赖 end ---------------------------------------->
-
-//2.页面数据 start ---------------------------------------->
-//2.1 广告
-let adImg1 = ref([]);
-let adImg2 = ref([]);
-onMounted(async () => {
-    //从客户端获取行政职能部门 加快打开速度
-    const { $webUrl, $CwebUrl } = useNuxtApp();
-    //广告1
-    let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_search_0001`
-    const responseAd1 = await fetch(url, {
-        headers: {
-            'Content-Type': 'application/json',
-            'Userurl': $CwebUrl,
-            'Origin': $CwebUrl
-        }
-    });
-    const resultAd1 = await responseAd1.json();
-    adImg1.value = resultAd1.data[0];
-
-    //广告2
-    let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_search_0002`
-    const responseAd2 = await fetch(url2, {
-        headers: {
-            'Content-Type': 'application/json',
-            'Userurl': $CwebUrl,
-            'Origin': $CwebUrl
-        }
-    });
-    const resultAd2 = await responseAd2.json();
-    adImg2.value = resultAd2.data[0];
-})
-
-
-// 新闻列表
-const newsList = ref([]);
-let keywordInput = ref("");
-
-//搜索
-let goSearch = async () => {
-    console.log(page.value)
-    console.log(pageSize.value)
-    console.log(keywordInput.value)
-    console.log(pageCatids)
-    console.log(pageDepartment_id)
-
-    const listData = await requestDataPromise('/web/selectWebsiteCategory', {
-        method: 'GET',
-        query: {
-            'page': page.value,
-            'pageSize': pageSize.value,
-            'keyword': keywordInput.value,
-            'cityid': pageCatids,
-            'department_id': pageDepartment_id
-        },
+//1.2获得pinia源
+import { useTemplateBaseStore } from '@/stores/templateBase'
+const templateBaseStore = useTemplateBaseStore()
+//1.3获得该页的皮肤id - 在每个组件中也是同样的获得方法
+const skinId = ref("")
+const websiteId = ref("")
+//1.4获得站点基本信息
+const responseStatus = await requestDataPromise('/web/getWebsiteAllinfo', {
+    method: 'GET',
+    query: {
+        'link_textnum':24,
+        'link_imgnum':18,
+        'link_footnum':4
+    },
+});
+if (responseStatus.code == 200) {
+    //0.3.1设置站点基本信息
+    templateBaseStore.setWebSiteInfo(responseStatus.data)
+    websiteId.value = responseStatus.data.website_head.id;//获得网站id
+    //0.3.2设置皮肤id
+    skinId.value = templateBaseStore.webSiteInfo.website_foot.foot_info.template_id;
+    console.log("当前的网站id:"+responseStatus.data.website_head.id)
+    //0.3.3设置seo信息
+    let seoTitle = templateBaseStore.webSiteInfo.website_head.title;
+    let seoDescription = templateBaseStore.webSiteInfo.website_head.description;
+    let seoKeywords = templateBaseStore.webSiteInfo.website_head.keywords;
+    let seoSuffix = templateBaseStore.webSiteInfo.website_head.suffix;
+    let seoName = templateBaseStore.webSiteInfo.website_head.website_name;
+    useSeoMeta({
+        title: seoTitle + "_" + seoSuffix,
+        meta: [
+            { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
+            { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
+        ]
     });
-    if (listData.data.rows) {
-        console.log(listData)
-        newsList.value = listData.data.rows;
-        total.value = listData.data.count;
-    } else {
-        newsList.value = [];
-        total.value = 0;
-    }
-
-}
-
-goSearch();
-//基于导航池搜索
-// let goSearchFont = async (font) => {
-//     const listData =  await requestDataPromise('/web/getWebsiteArticleList', {
-//         method: 'GET',
-//         query: {
-//             'page': page.value,
-//             'pageSize': pageSize.value,
-//             'catid': font
-//         },
-//     });
-//     newsList.value = listData.data.rows;
-//     total.value = listData.data.count;
-// }
-
-// //基于导航池与关键词搜索
-// let goSearchFontandCid = async (font) => {
-//     const listData =  await requestDataPromise('/web/getWebsiteArticleList', {
-//         method: 'GET',
-//         query: {
-//             'page': page.value,
-//             'pageSize': pageSize.value,
-//             'catid': category_id,
-//             'keyword':searchKey
-//         },
-//     });
-//     newsList.value = listData.data.rows;
-//     total.value = listData.data.count;
-// }
-
-
-//直接查新闻
-// const newslists = async () => {
-//     try {
-//         // 从地区跳转
-//         if (route.query.catids && route.query.catids.length > 0) {
-//             // 将字符串转换回数组,并过滤掉可能的空值
-//             catids.value = route.query.catids.split(',').filter(id => id);
-
-//             if (catids.value.length > 0) {
-//                 // 有效的 catids 数组,可以进行后续操作
-//                 console.log('接收到的分类ID数组:', catids.value);
-//                 let font = catids.value.join(",")
-//                 font = "[" + font + "]"
-
-//                 goSearchFont(font);
-//             } else {
-//                 // 处理空数组情况
-//                 console.log('未接收到有效的分类ID');
-//             }
-//         } else {
-//             if (category_id == undefined) {
-//                 //直接搜索 默认进来没有导航池的话 不执行搜索
-//                 goSearch();
-//             } else {
-//                 goSearchFontandCid();
-//             }
-//         }
-//     } catch (error) {
-//         console.error(error);
-//     }
-// }
-// newslists();
-
-
-// 查询导航池的方法
-// const newslists = async () => {
-//     try {
-//         // 从地区跳转
-//         if (route.query.catids && route.query.catids.length > 0) {
-//             // 将字符串转换回数组,并过滤掉可能的空值
-//             catids.value = route.query.catids.split(',').filter(id => id);
-
-//             if (catids.value.length > 0) {
-//                 // 有效的 catids 数组,可以进行后续操作
-//                 console.log('接收到的分类ID数组:', catids.value);
-//                 let font = catids.value.join(",")
-//                 font = "[" + font + "]"
-
-//                 goSearchFont(font);
-//             } else {
-//                 // 处理空数组情况
-//                 console.log('未接收到有效的分类ID');
-//             }
-//         } else {
-//             if (category_id == undefined) {
-//                 //直接搜索 默认进来没有导航池的话 不执行搜索
-//                 goSearch();
-//             } else {
-//                 goSearchFontandCid();
-//             }
-//         }
-//     } catch (error) {
-//         console.error(error);
-//     }
-// }
-
-// newslists();
-
-//分页事件
-let changePage = (value) => {
-    console.log("当前页码", value);
-    page.value = value
-    console.log(page.value);
-    goSearch()
 }
-//2.页面数据 end ---------------------------------------->
-
-
-//4.设置seo信息 start---------------------------------------->
-//4.1 设置seo信息
-const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
+//1.5获得广告池
+const adData = ref([]);
+const adResponseStatus = await requestDataPromise('/web/getWebsiteAdvertisement', {
     method: 'GET',
     query: {},
 });
-
-let seoTitle = setData.data.website_head.title;
-let seoDescription = setData.data.website_head.description;
-let seoKeywords = setData.data.website_head.keywords;
-let seoSuffix = setData.data.website_head.suffix;
-let seoName = setData.data.website_head.website_name;
-
-useSeoMeta({
-    title: seoTitle + "_" + seoSuffix,
-    meta: [
-        { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
-        { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
-    ]
-});
-//4.设置seo信息 end---------------------------------------->
+if (adResponseStatus.code == 200) {
+    adData.value = adResponseStatus.data;
+    templateBaseStore.setAdList(adResponseStatus.data)
+}
+//1.获得基本信息单元 end---------------------------------------->
 </script>
 
 <style lang="less" scoped>
-@import url('@/assets/css/search.less');
 </style>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно