Browse Source

合并代码

13127578837 11 months ago
parent
commit
2db9428865

+ 1 - 0
src/assets/img/news/arrow.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1712633201030" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2402" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M256 0 768 512 256 1024Z" p-id="2403" fill="#409EFF"></path></svg>

+ 98 - 1
src/assets/styles/common/style.css

@@ -6868,4 +6868,101 @@
                     opacity:1
                 }
             }
-            /* 移动端导航样式 end */
+            /* 移动端导航样式 end */
+
+
+            /* 新闻新模板 start */
+
+            .news2-box>div{
+                     box-shadow: 0px 2px 17px 4px rgb(158 158 158 / 15%);
+                     padding:10px;
+
+            }
+            .news2-box .news-right-list{
+                padding:10px 20px 0 20px
+
+            }
+            .timeRight{
+                float:right
+            }
+            .news2-box .news-right-list li:last-child{
+                border-bottom: 0px dashed #D5D5D5;
+
+            }
+            .news-left-list{
+                margin-right:30px
+            }
+            .news-left-list .active{
+                color:#409EFF;
+                cursor: pointer;
+            }
+            .news2-box>div ul li{
+                border-bottom: 1px dashed #D5D5D5;
+                line-height:56px;
+                color:#666666;
+                
+
+            }
+            .news2-box>div ul li:hover{
+                color:#409EFF;
+                cursor: pointer;
+            }
+            .news2-box>div .title{
+                font-size:18px;
+                font-weight: 400;
+                line-height:56px;
+                color: #333333;
+                border-bottom: 1px dashed #D5D5D5;
+            }
+
+
+            @media(min-width:768px) {
+                .news-left-list {
+                    width:218px!important
+                }
+                .news-right-list {
+                    width:calc(100% - 218px)!important
+                }
+            }
+
+
+            @media(max-width:992px) {
+                .news2-box{
+                    display:block!important
+                }
+                .news-left-list {
+                    width:100%!important;
+                }
+              
+                .news-right-list {
+                    width:calc(100% - 0px)!important
+                }
+                .timeRight{
+                    float:none;
+                    display:block;
+                    text-align:left;
+                    margin-left:20px;
+                    line-height:20px;
+                    margin-bottom:10px
+                }
+                .news-right-list .text_nowrap{
+                    display:block
+                }
+                .newsTitleLeft{
+                    display:block;
+                    white-space: nowrap;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                }
+                .news2-box .news-right-list{
+                    padding:10px;
+                   
+                }
+                .news2-box .title{
+                    text-align:center
+                }
+            }
+
+
+
+              /* 新闻新模板 end */

+ 21 - 1
src/router/index.ts

@@ -7,6 +7,8 @@ const services_Read = () => import('@/views/services/read.vue')
 const news = () => import('@/views/news/index.vue')
 const news_Read = () => import('@/views/news/read.vue')
 const about = () => import('@/views/about/index.vue')
+const news2 = () => import('@/views/news2/index.vue')
+const news2_Read = () => import('@/views/news2/read.vue')
 import { createRouter, createMemoryHistory, createWebHistory } from 'vue-router'
 const routes = [
     {
@@ -83,7 +85,25 @@ const routes = [
             title: "关于永天",
             keepAlive: false
         }
-    }
+    },
+    {
+        path: "/news2",
+        name: "新闻动态2",
+        component: news2,
+        meta: {
+            title: "新闻动态2",
+            keepAlive: false
+        }
+    },
+    {
+        path: "/news2_Read",
+        name: "新闻详情2",
+        component: news2_Read,
+        meta: {
+            title: "新闻详情",
+            keepAlive: false
+        }
+    },
 
 ]
 

+ 13 - 4
src/store/index.ts

@@ -124,14 +124,22 @@ export const store = createStore({
                                 }
                             }
                         }
+                        if(data[i].categoryStyle == 6){
+                            data[i].path = "/news2"
+                            if(data[i].children.length>0){
+                                for(let ii=0;ii<data[i].children.length;ii++){
+                                    data[i].children[ii].path = "/news2?categoryid=" + data[i].children[ii].id
+                                }
+                            }
+                        }
                     }
                     const menuList = res.data
                         for(let i=0;i<menuList.length;i++){
                             if((menuList[i].path == params.path) && !params.query.categoryid){//一级菜单
                                 if(!params.query.dup && !menuList[i].sname){
-                                    commit("setMeta",{title:menuList[i].categoryName,keywords:menuList[i].metakeywords,description:menuList[i].metadescription})
+                                    commit("setMeta",{title:menuList[i].title?menuList[i].title:menuList[i].categoryName,keywords:menuList[i].metakeywords,description:menuList[i].metadescription})
                                 }else if(params.query.dup && menuList[i].sname){
-                                    commit("setMeta",{title:menuList[i].categoryName,keywords:menuList[i].metakeywords,description:menuList[i].metadescription})
+                                    commit("setMeta",{title:menuList[i].title?menuList[i].title:menuList[i].categoryName,keywords:menuList[i].metakeywords,description:menuList[i].metadescription})
                                 }
                             }else if(menuList[i].children.length>0){//二级菜单
                                 for(let ii=0;ii<menuList[i].children.length;ii++){
@@ -170,9 +178,10 @@ export const store = createStore({
                 //cases页类型活动id
                 if(
                     data.params?.categoryid && (data.index == "/cases"  || 
-                    data.index == "/services") || data.index == "/news" || 
+                    data.index == "/services") || data.index == "/news" || data.index == "/news2" || 
                     data.index == "/news_Read" && data.params.acitve ||
-                    data.index == "/services_Read" && data.params.acitve
+                    data.index == "/services_Read" && data.params.acitve||
+                    data.index == "/news2_Read" && data.params.acitve
                     ){
                     commit('setAcitveId',data.params.categoryid)
                 }

+ 1 - 1
src/views/about/index.vue

@@ -9,7 +9,7 @@ export default defineComponent({
         const requestParams = ref({})//active类型
         let paramsData = reactive({})
         let oldCategoryId= ref()
-        if (store.state.route.hash) {
+        if (store.state.route.query.type) {
             setTimeout(()=>{
                 var  ids = store.state.columnTypes.filter((item:any) => item.title == '联系我们');
                 var ahchorEle = ids[0].id

+ 194 - 0
src/views/news2/index.vue

@@ -0,0 +1,194 @@
+<script lang="ts">
+import { ref, reactive, defineComponent } from 'vue'
+import { useStore  } from 'vuex'
+import { useRouter } from "vue-router";
+import banner from '@/components/layout/banner.vue'
+import pagination from '@/components/layout/pagination.vue'
+export default defineComponent({
+    setup(){
+        const store = useStore()
+        const router = useRouter()
+        let requestParams:any = reactive({})//active类型
+        let paramsData = reactive({
+            params:{
+                categoryid: 0,
+                pageNum:1,
+                pageSize:10,
+                order:"sortindex",
+                acitve:true
+            },
+            index:"",
+            sub:0
+        })
+        const pageStatus = ref(false)
+        let oldCategoryId= ref(store.state.columnTypes[0].id)
+
+
+        const columnActive=ref({})
+        var columnOne= store.state.columnTypes.filter((item:any) => {
+            return item.id == store.state.acitveId;
+        });
+        columnActive.value=columnOne[0]
+
+
+        //类型切换
+        function facilityClick(item:any){
+            columnActive.value=item
+            //防抖
+            if(item.id != oldCategoryId.value){
+                requestParams = item
+                paramsData = {
+                    params:{
+                        categoryid: item.id,
+                        pageNum:1,
+                        pageSize:10,
+                        order:"sortindex",
+                        acitve:true,
+                    },
+                    index:store.state.currentPagePath,
+                    sub:store.state.sub
+                }
+                oldCategoryId.value = item.id
+                store.dispatch('getPageData',paramsData)
+            }
+        }
+        //详情页
+        function details(item:any){
+            let params = {
+                path: `/news2_Read`,
+                query: {
+                    categoryid: item.categoryid,
+                    id: item.id,
+                    isUrlId: 1
+                }
+            }
+            store.commit("setRoute",params)
+            router.push(params)
+        }
+        //分页
+        function handleCurrentChange(val:number){
+            paramsData.params.pageNum = val
+            store.dispatch('getPageData',paramsData)
+        }
+        setTimeout(()=>{
+            pageStatus.value = true
+        },300)
+        return { store, facilityClick, handleCurrentChange, details, pageStatus,columnActive }
+    },
+    components:{
+        banner,
+        pagination
+    },
+    asyncData({ store,route } :any){
+        let params = reactive(route.value) //路由参数
+        //获取菜单列表
+        return store.dispatch('getMenuList',params).then(()=>{
+            const data = reactive(store.state.menuList)
+            let paramsData:any = reactive({})//页面主题内容请求参数
+            let str = ref("")
+            if(params.path.indexOf("_")>-1){
+                str.value = params.path.split("_")[0]
+            }
+            for(let i=0;i<data.length;i++){
+                if(!data[i].sname && params.path == data[i].path || data[i].path == str.value){
+                    paramsData = {
+                        params:{
+                            categoryid: data[i].id,
+                            pageNum:1,
+                            pageSize:100,
+                        //   order:"sortindex",
+                        },
+                        index:params.path,
+                        sub:i
+                    }
+                    if(!params.query?.categoryid){
+                        paramsData.params.categoryid = data[i].children[0].id
+                    }else{
+                        paramsData.params.categoryid = params.query.categoryid
+                    }
+                    return store.dispatch('getPageData',paramsData).then(()=>{
+                        store.commit("setColumnTypes",store.state.menuList[store.state.sub].children)
+                    })
+                }
+            }
+        })
+    }
+})
+</script>
+<template>
+    <div class="pageContain">
+        <section class="common-bradcrumb-section">
+            <banner />
+        </section>
+
+        <section class="news-content-section pt-70"  >
+            <div class="container">
+                <div style="display:flex" class="news2-box">
+                    <div class=" news-left-list">
+                        <div class="title">新闻动态</div>
+                        <ul>
+                            <li  v-for="(item,index) in store.state.columnTypes" :key="index" style="display:flex">
+                                <img src="@/assets/img/news/arrow.svg" alt="" :style="{'opacity':item.id == store.state.acitveId?'1':'0'}" style="width:12px;margin-right:5px">
+                                <div  :class="item.id == store.state.acitveId  ? 'active' : ''" v-on:mouseover="facilityClick(item)">{{item.categoryName}} </div>
+                            </li>
+                        </ul>
+                        
+                    </div>
+                    <div class="news-right-list"  >
+                        <div class="title" v-if="columnActive.categoryName">{{columnActive.categoryName}}</div>
+                        <ul>
+                            <li class="" v-for="(item,index) in store.state.pageContent" :key="index"  v-show="pageStatus">
+                                <div  @click="details(item)">
+                                    <a class="newsTitleLeft"><span style="width: 8px;height: 8px;background: #B7B7B7;border-radius: 50%;margin-right:10px"></span>{{item.title}}</a>
+                                    <span  class="timeRight" >{{ item.createdate }}</span>
+                                </div>
+                            </li>
+
+
+                        </ul>
+                    </div>
+                </div>
+                
+                
+            </div>
+
+        </section>
+        <br>
+        <br>
+        <!-- <section style=" background:#F7F7F7">
+            <div class="container">
+                <div class="row newTypeBox">
+                    <div class="col-lg-6 col-md-6"  v-for="(item,index) in store.state.columnTypes" :key="index">
+                        <div class="titleOne" :class="item.id == store.state.acitveId  ? 'active' : ''" v-on:mouseover="facilityClick(item)">{{item.categoryName}} </div>
+                    </div>
+                </div>
+            </div>
+        </section> -->
+        <!-- <section class="news-content-section pt-70" v-show="pageStatus">
+                <div class="container">
+                    <div class="row">
+                        <div class="col-lg-12 col-md-12 content">
+                            <ul>
+                                <div class="row">
+                                    <div class="col-md-4 newItemOne lazyContainer" v-for="(item,index) in store.state.pageContent" :key="index" >
+                                        <div class="oneInnerBox" @click="details(item)">
+                                            <div class="img" style="overflow:hidden">
+                                                <el-image  :src="item.image" alt="" :data-src="item.image" fit="contain"  style="display:block"  />   
+                                            </div>
+                                            <a class="line-two">{{item.title}}</a>
+                                            <span>{{ item.createdate }}</span>
+                                        </div>
+                                    </div>
+                                </div>
+                            </ul>
+                            <pagination :data="store.state.pagination" @pagination="handleCurrentChange" />
+                        </div>
+                    </div>
+                </div>
+            </section> -->
+    </div>
+            
+</template>
+<style lang="scss" scoped>
+
+</style>

+ 105 - 0
src/views/news2/read.vue

@@ -0,0 +1,105 @@
+<script lang="ts">
+    import { ref, reactive, defineComponent } from 'vue'
+    import { useStore  } from 'vuex'
+    import { useRoute } from "vue-router"
+    import banner from '@/components/layout/banner.vue'
+    import recomMendation from '@/components/layout/recomMendation.vue'
+    export default defineComponent({
+    setup(){
+        const store = useStore()
+        const route = useRoute()
+        const pageStatus = ref(false)
+        const recomMendationList:any = reactive(recomMendationFilter(store.state.recomMendation)) //推荐内容
+        //推荐内容过滤
+        function recomMendationFilter(data:any){
+            let array = []
+            for(let i =0;i<data.length;i++){
+                if(data[i].id != route.query?.id){
+                    array.push(data[i])
+                }
+            }
+            return array
+        }
+        setTimeout(()=>{
+            pageStatus.value = true
+        })
+        return { store, recomMendationList,pageStatus }
+    },
+    components:{
+        banner,
+        recomMendation
+    },
+    asyncData({ store,route }:any){
+        //获取菜单列表
+        let params:any = reactive({}) //路由参数
+        if(route.value.query?.id){
+            params = route.value
+        }else{
+            params = store.state.route
+        }
+        //获取菜单列表
+        return store.dispatch('getMenuList',params).then(()=>{
+            const data = reactive(store.state.menuList)
+            let str = ref("")
+            let sub = ref()
+            let paramsData = reactive({})
+            if(params.path.indexOf("_")){
+                str.value = params.path.split("_")[0]
+            }
+            for(let i=0;i<data.length;i++){
+                if(params.path == data[i].path || str.value == data[i].path){
+                    if(params.query?.categoryid  && !data[i].sname){
+                        sub.value = i
+                        if(params.query?.id  && !params.query.dup){
+                            paramsData = {
+                                params:{
+                                    categoryid: params.query?.categoryid,
+                                    pageNum:1,
+                                    pageSize:1,
+                                    order:"sortindex",
+                                    articleid: params.query?.id,
+                                    id: params.query?.id,
+                                    details:true
+                                },
+                                index:params.path,
+                                sub:sub.value
+                            }
+                            return store.dispatch('getPageData',paramsData)
+                        }
+                    }
+                }
+            }
+           
+        })
+    }
+})
+</script>
+<template>
+    <div class="pageContain">
+        <section class="common-bradcrumb-section" >
+            <banner />
+        </section>
+        <section class="news-content-section pt-60" v-show="pageStatus">
+            <div class="container" v-if="store.state.pageContent.length>0">
+                <div class="row">
+                    <div class="col-lg-12 col-md-12 content">
+                        <div  class="read_content mb-60">
+                            <div class="section-title text-left both-border mb-60 d-flex justify-content-between">
+                                <div >
+                                    <span class="title-tag2">{{store.state.pageContent[0].title}}</span>
+                                    <div class="new-read-title2">
+                                        <span>{{ store.state.pageContent[0].createdate.split(" ")[0] }}</span>
+                                        <span style="margin-left:10px">点击量:{{store.state.pageContent[0].hits}}</span>
+                                    </div>
+                                </div>
+                                <a href="javascript:history.back(-1)"><img src="@/assets/img/product/close.png" alt=""></a>
+                            </div>                            
+                            <div v-html="store.state.pageContent[0].content" class="new-read-body"></div>
+                        </div>
+                        <recomMendation :data="recomMendationList"  v-if="recomMendationList.length>0"/>
+                    </div>
+                </div>
+            </div>
+        </section>
+    </div>
+</template>