Browse Source

加入模版判断

13127578837 11 months ago
parent
commit
3d50a3f4f4

+ 16 - 0
src/assets/js/conmmon.js

@@ -0,0 +1,16 @@
+/**
+ * 获取网址后参数
+ * @param {*} url 
+ * @returns 
+ */
+function getParams(url) {
+    const pattern = /(\w+)=(\w+)/gi;
+    const params = {};
+    url.replace(pattern, function(match, key, value) {
+        params[key] = value;
+    });
+    return params;
+}
+export {
+    getParams,
+}

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

@@ -813,7 +813,7 @@
                 margin: 0px 40px 0 0;
                 position: static;
                 cursor: pointer;
-                border-bottom: 4px solid rgba(0, 0, 0, 0)
+                border-bottom: 4px solid rgba(0, 0, 0, 0);
             }
             
             header.header-two .mainmenu-area .main-menu {
@@ -857,6 +857,7 @@
                 /* font-weight: 500; */
                 text-transform: uppercase;
                 font-size: 18px;
+
             }
             
             @media only screen and (min-width: 992px) and (max-width: 1199px) {
@@ -6639,6 +6640,7 @@
                 color: #000;
                 background-image: url(@/assets/img/home/f_bg1.png);
                 background-size: 100% 100%;
+                font-family: Open Sans, sans-serif;;
             }
             
             .feedBackBox .contactInner li {
@@ -6653,6 +6655,7 @@
             .feedBackBox .contactInner li span:first-child {
                 width: 112px;
                 display: block;
+                text-align: right;
             }
             
             .feedBackBox .contactInner li &:not(:first-child) {

+ 12 - 0
src/components/layout/banner.vue

@@ -8,6 +8,18 @@ const columnImage  = ref("")//图片或视频地址
 const posterImg = ref(poster)//视频封面图
 modelType.value = store.state.menuList[store.state.sub]?.modelType
 columnImage.value =store.state.menuList[store.state.sub]?.imagePath
+if (typeof window !== 'undefined' && typeof window.globalThis.addEventListener === 'function') {
+    var element:any = document.getElementsByClassName("mainmenu-area")[0]
+    element.addEventListener('mouseenter', function() {
+        modelType.value = 1
+        columnImage.value = posterImg.value
+    })
+    element.addEventListener('mouseleave', function() {
+        modelType.value = 2
+        columnImage.value = store.state.menuList[store.state.sub]?.imagePath
+    })
+  // 处理鼠标移入事件
+}
 </script>
 <template>
     <div v-if="modelType==1" style="width:100%;height:100%;background-size:cover;background-position:center center;background-repeat:no-repeat; "

+ 8 - 8
src/components/layout/header.vue

@@ -43,13 +43,13 @@ if(typeof window !== 'undefined' && typeof window.globalThis.addEventListener ==
         }
     });
     //百度统计
-    var _hmt:any = _hmt || [];
-    (function() {
-    var hm = document.createElement("script");
-    hm.src = "https://hm.baidu.com/hm.js?082d841c5adb911dd14595d0885a7c69";
-    var s:any = document.getElementsByTagName("script")[0]; 
-    s.parentNode.insertBefore(hm, s);
-    })();
+    // var _hmt:any = _hmt || [];
+    // (function() {
+    // var hm = document.createElement("script");
+    // hm.src = "https://hm.baidu.com/hm.js?082d841c5adb911dd14595d0885a7c69";
+    // var s:any = document.getElementsByTagName("script")[0]; 
+    // s.parentNode.insertBefore(hm, s);
+    // })();
 }
 </script>
 <template>
@@ -64,7 +64,7 @@ if(typeof window !== 'undefined' && typeof window.globalThis.addEventListener ==
                             <div class="menu-items">
                                 <ul v-if="store.state.menuList.length>0">
                                     <li v-for="item in store.state.menuList" :key="item.id" 
-                                    :class="item.sname ?  `${currentPagePath}?dup=${item.sname}` ==   `${item.path}?dup=${item.sname}`  &&  pathTemplateQuery ? 'active' : ' '  : currentPagePath == item.path  &&  !pathTemplateQuery ? 'active' : ' ' "
+                                    :class="item.sname ?  `${currentPagePath}?dup=${item.sname}` ==   `${item.path}?dup=${item.sname}`  &&  pathTemplateQuery == item.sname   ? 'active' : ' '  : currentPagePath == item.path  &&  !pathTemplateQuery ? 'active' : '111 ' "
                                     >
                                         <a  :href="item.sname ? `${item.path}?dup=${item.sname}` : item.path
                                             ">{{item.categoryName}}</a>

+ 4 - 4
src/store/index.ts

@@ -141,10 +141,10 @@ export const store = createStore({
                                         }
                                     }
                                     if(!params.query.dup){
-                                        let path = menuList[i].children[ii].path.split("?")
-                                        if(`${path[0]}?dup=${menuList[i].children[ii].sname}` == `${params.path}?dup=${params.query.dup}`){ 
-                                            commit("setMeta",{title:menuList[i].children[ii].categoryName,keywords:menuList[i].children[ii].metakeywords,description:menuList[i].children[ii].metadescription})
-                                        }
+                                        // let path = menuList[i].children[ii].path.split("?")
+                                        // if(`${path[0]}?dup=${menuList[i].children[ii].sname}` == `${params.path}?dup=${params.query.dup}`){ 
+                                        //     commit("setMeta",{title:menuList[i].children[ii].categoryName,keywords:menuList[i].children[ii].metakeywords,description:menuList[i].children[ii].metadescription})
+                                        // }
                                     }
                                 }
                             }

+ 3 - 2
src/utils/request.ts

@@ -3,8 +3,9 @@ import { tansParams } from './common.ts'
 // 创建axios实例
 const service: any = axios.create({
     // axios中请求配置有baseURL选项,表示请求URL公共部分
-    baseURL: import.meta.env.PROD ? 'http://gateWay.usky.cn/' : "http://localhost:13213",
-    // baseURL: import.meta.env.PROD ? 'http://172.16.120.165:13200/' : "http://localhost:13213",
+    baseURL: import.meta.env.PROD ? 'http://gateWay.usky.cn/' : "http://172.16.120.165:13200/",
+    // baseURL: import.meta.env.PROD ? 'http://gateWay.usky.cn/' : "http://172.16.120.165:13200/",
+    // baseURL: import.meta.env.PROD ? 'http://172.16.120.165:13200/' : "http://localhost:5173",
     // 超时
     timeout: 300000
 })

+ 15 - 11
src/views/about/index.vue

@@ -1,6 +1,7 @@
 <script lang="ts">
 import { ref, reactive, defineComponent } from 'vue'
 import { useStore  } from 'vuex'
+import { getParams } from '@/assets/js/conmmon'
 import banner from '@/components/layout/banner.vue'
 export default defineComponent({
     setup(){
@@ -8,13 +9,9 @@ export default defineComponent({
         const requestParams = ref({})//active类型
         let paramsData = reactive({})
         let oldCategoryId= ref()
-
-        console.log(store.state.columnTypes)
-        if (store.state.route.query.type) {
+        if (store.state.route.hash) {
             setTimeout(()=>{
-                var  ids = store.state.columnTypes.filter(item => item.title == '联系我们');
-                console.log(ids[0].id)
-                
+                var  ids = store.state.columnTypes.filter((item:any) => item.title == '联系我们');
                 var ahchorEle = ids[0].id
                 if(typeof window !== 'undefined' && typeof window.globalThis.addEventListener === 'function') {
                     document.getElementById(ahchorEle).scrollIntoView({
@@ -56,21 +53,29 @@ export default defineComponent({
     },
     asyncData({ store, route } :any){
         let params = reactive(route.value) //路由参数
-
          store.commit("setRoute",params)
-
         //获取菜单列表
         return store.dispatch('getMenuList',params).then(()=>{
             const data = store.state.menuList
             let paramsData:any = reactive({})//页面主题内容请求参数
+            //辅助判断参数
+            let str = ref("")
+            var dup = undefined
+            if(params.path.indexOf("_")>-1){
+                str.value = params.path.split("_")[0]
+            }
+            if (typeof window !== 'undefined'){
+                if(getParams(window.location.href)?.dup){
+                    dup = getParams(window.location.href).dup
+                }
+            }
             for(let i=0;i<data.length;i++){
-                if(!data[i].sname && params.path == data[i].path){
+                if((!data[i].sname && !dup  && (params.path == data[i].path || data[i].path == str.value)) ||(data[i].sname && dup && (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
@@ -90,7 +95,6 @@ export default defineComponent({
             <banner />
         </div>
         <section :id="arr.id" class="about-introduce-section course-section pt-40 pb-60 about-sec" v-for="(arr,index) in store.state.columnTypes" :style="{background:(index % 2 == 1?'#F4F8FD':'#fff')}">
-            <div  class="pointOffset">0</div>
             <div class="container">
                 <div class="row">
                     <div class="col-md-2 col-sm-12 text-center">

+ 26 - 22
src/views/cases/index.vue

@@ -2,6 +2,7 @@
 import { ref, reactive, defineComponent } from 'vue'
 import { useStore } from 'vuex'
 import { useRouter } from "vue-router";
+import { getParams } from '@/assets/js/conmmon'
 import banner from '@/components/layout/banner.vue'
 export default defineComponent({
     setup(){
@@ -58,35 +59,38 @@ export default defineComponent({
         return store.dispatch('getMenuList',params).then(()=>{
             //主页数据初始化
             const data = reactive(store.state.menuList)
-            let paramsData:any = reactive({
-                params:{
-                    categoryid: 0,
-                    pageNum:1,
-                    pageSize:100,
-                    order:"sortindex",
-                },
-                index:"",
-                sub:0
-            })//页面主题内容请求参数
-            for (let i = 0; i < data.length; i++) {
-                if (!data[i].sname && params.path == data[i].path) {
+            let paramsData:any = reactive({})//页面主题内容请求参数
+            //辅助判断参数
+            let str = ref("")
+            var dup = undefined
+            var sub = 0
+            if(params.path.indexOf("_")>-1){
+                str.value = params.path.split("_")[0]
+            }
+            if (typeof window !== 'undefined'){
+                if(getParams(window.location.href)?.dup){
+                    dup = getParams(window.location.href).dup
+                }
+            }
+            for(let i=0;i<data.length;i++){
+                if((!data[i].sname && !dup  && (params.path == data[i].path || data[i].path == str.value)) ||(data[i].sname && dup && (params.path == data[i].path || data[i].path == str.value))){
+                    sub = i
                     paramsData = {
-                        params: {
+                        params:{
                             categoryid: data[i].id,
-                            pageNum: 1,
-                            pageSize: 100,
-                            order: "sortindex",
+                            pageNum:1,
+                            pageSize:100,
                         },
-                        index: params.path,
-                        sub: i
+                        index:params.path,
+                        sub:i
                     }
-                    if (!params.query?.categoryid) {
+                    if(!params.query?.categoryid){
                         paramsData.params.categoryid = data[i].children[0].id
-                    } else {
+                    }else{
                         paramsData.params.categoryid = params.query.categoryid
                     }
-                    return store.dispatch('getPageData', paramsData).then(()=>{
-                        store.commit("setColumnTypes",store.state.menuList[store.state.sub].children)
+                    return store.dispatch('getPageData',paramsData).then(()=>{
+                        store.commit("setColumnTypes",store.state.menuList[sub].children)
                     })
                 }
             }

+ 33 - 16
src/views/index/index.vue

@@ -2,6 +2,7 @@
 <script lang="ts">
 import { defineComponent, reactive,ref} from 'vue'
 import { useStore  } from 'vuex'
+import { getParams } from '@/assets/js/conmmon'
 import banner from '@/components/layout/banner.vue'
 export default defineComponent({
     setup(){
@@ -27,32 +28,48 @@ export default defineComponent({
         //获取菜单列表
         return store.dispatch('getMenuList',params).then(()=>{
             const data = reactive(store.state.menuList)
-            let paramsData:any = reactive({
-                params:{
-                    categoryid: 0,
-                    pageNum:1,
-                    pageSize:100,
-                    order:"sortindex",
-                },
-                index:"/",
-                sub:0
-            })//页面主题内容请求参数
+            let paramsData:any = reactive({})//页面主题内容请求参数
+            // for(let i=0;i<data.length;i++){
+            //     //主页内容
+            //     if(!data[i].sname && params == data[i].path || !data[i].sname &&  data[i].path =="/"){
+            //         paramsData = {
+            //             params:{
+            //                 categoryid: data[i].id,
+            //                 pageNum:1,
+            //                 pageSize:100,
+            //                 order:"sortindex",
+            //             },
+            //             index:params.path,
+            //             sub:i
+            //         }
+            //         if(params.path == "/"){
+            //             paramsData.params.categoryid = data[i].id
+            //         }
+            //         return store.dispatch('getPageData',paramsData)
+            //     }
+            // }
+            //辅助判断参数
+            let str = ref("")
+            var dup = undefined
+            if(params.path.indexOf("_")>-1){
+                str.value = params.path.split("_")[0]
+            }
+            if (typeof window !== 'undefined'){
+                if(getParams(window.location.href)?.dup){
+                    dup = getParams(window.location.href).dup
+                }
+            }
             for(let i=0;i<data.length;i++){
-                //主页内容
-                if(!data[i].sname && params == data[i].path || !data[i].sname &&  data[i].path =="/"){
+                if((!data[i].sname && !dup  && (params.path == data[i].path || data[i].path == str.value)) ||(data[i].sname && dup && (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.path == "/"){
-                        paramsData.params.categoryid = data[i].id
-                    }
                     return store.dispatch('getPageData',paramsData)
                 }
             }

+ 12 - 3
src/views/news/index.vue

@@ -3,6 +3,7 @@ import { ref, reactive, defineComponent } from 'vue'
 import { useStore  } from 'vuex'
 import { useRouter } from "vue-router";
 import banner from '@/components/layout/banner.vue'
+import { getParams } from '@/assets/js/conmmon'
 import pagination from '@/components/layout/pagination.vue'
 export default defineComponent({
     setup(){
@@ -75,18 +76,26 @@ export default defineComponent({
         return store.dispatch('getMenuList',params).then(()=>{
             const data = reactive(store.state.menuList)
             let paramsData:any = reactive({})//页面主题内容请求参数
+            //辅助判断参数
             let str = ref("")
+            var dup = undefined
+            var sub = 0
             if(params.path.indexOf("_")>-1){
                 str.value = params.path.split("_")[0]
             }
+            if (typeof window !== 'undefined'){
+                if(getParams(window.location.href)?.dup){
+                    dup = getParams(window.location.href).dup
+                }
+            }
             for(let i=0;i<data.length;i++){
-                if(!data[i].sname && params.path == data[i].path || data[i].path == str.value){
+                if((!data[i].sname && !dup  && (params.path == data[i].path || data[i].path == str.value)) ||(data[i].sname && dup && (params.path == data[i].path || data[i].path == str.value))){
+                    sub = i
                     paramsData = {
                         params:{
                             categoryid: data[i].id,
                             pageNum:1,
                             pageSize:100,
-                        //   order:"sortindex",
                         },
                         index:params.path,
                         sub:i
@@ -97,7 +106,7 @@ export default defineComponent({
                         paramsData.params.categoryid = params.query.categoryid
                     }
                     return store.dispatch('getPageData',paramsData).then(()=>{
-                        store.commit("setColumnTypes",store.state.menuList[store.state.sub].children)
+                        store.commit("setColumnTypes",store.state.menuList[sub].children)
                     })
                 }
             }

+ 2 - 1
src/views/news/read.vue

@@ -32,6 +32,7 @@
     asyncData({ store,route }:any){
         //获取菜单列表
         let params:any = reactive({}) //路由参数
+        // store.commit("setRoute",route.value)
         if(route.value.query?.id){
             params = route.value
         }else{
@@ -92,7 +93,7 @@
                                         <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>
+                                <a href="javascript:history.go(-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>

+ 14 - 15
src/views/services/index.vue

@@ -3,6 +3,7 @@ import { ref, reactive, defineComponent } from 'vue'
 import { useStore  } from 'vuex'
 import { useRouter } from "vue-router";
 import banner from '@/components/layout/banner.vue'
+import { getParams } from '@/assets/js/conmmon'
 import pagination from '@/components/layout/pagination.vue'
 export default defineComponent({
     setup(){
@@ -80,29 +81,27 @@ export default defineComponent({
         //获取菜单列表
         return store.dispatch('getMenuList',params).then(()=>{
             const data = store.state.menuList
-            let paramsData = reactive({
-                params:{
-                    categoryid: 0,
-                    pageNum:1,
-                    pageSize:100,
-                    order:"sortindex",
-                },
-                index:"",
-                sub:0
-            })//页面主题内容请求参数
-            let str = ref("")
+            let paramsData:any = reactive({})//页面主题内容请求参数
+           //辅助判断参数
+           let str = ref("")
+           var dup = undefined
+           var sub = 0
             if(params.path.indexOf("_")>-1){
                 str.value = params.path.split("_")[0]
             }
+            if (typeof window !== 'undefined'){
+                if(getParams(window.location.href)?.dup){
+                    dup = getParams(window.location.href).dup
+                }
+            }
             for(let i=0;i<data.length;i++){
-                //主页数据初始化
-                if(!data[i].sname && params.path == data[i].path || data[i].path == str.value){
+                if((!data[i].sname && !dup  && (params.path == data[i].path || data[i].path == str.value)) ||(data[i].sname && dup && (params.path == data[i].path || data[i].path == str.value))){
+                    sub = i
                     paramsData = {
                         params:{
                             categoryid: data[i].id,
                             pageNum:1,
                             pageSize:100,
-                            order:"sortindex",
                         },
                         index:params.path,
                         sub:i
@@ -113,7 +112,7 @@ export default defineComponent({
                         paramsData.params.categoryid = params.query.categoryid
                     }
                     return store.dispatch('getPageData',paramsData).then(()=>{
-                        store.commit("setColumnTypes",store.state.menuList[store.state.sub].children)
+                        store.commit("setColumnTypes",store.state.menuList[sub].children)
                     })
                 }
             }

+ 0 - 1
vite.config.ts

@@ -4,7 +4,6 @@ import path from 'path'
 import AutoImport from 'unplugin-auto-import/vite'
 import Components from 'unplugin-vue-components/vite'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
-// https://vitejs.dev/config/
 export default defineConfig({
   plugins: [
     vue(),