Procházet zdrojové kódy

关于我们中企业文化和荣誉跳转页面功能

linwei před 1 rokem
rodič
revize
f12293549d

+ 5 - 1
src/components/AboutUs/base/CorporateCulture.vue

@@ -78,7 +78,11 @@ const goto = (item) =>{
      if (item.type == '2') {
         window.open(item?.toUrl, "_blank");
      }else if(item.type == '3'){
-        router.push('/CompanyNews?openType=1&id='+item.id)
+        if (item?.detailsContent != '') {
+            counter.detailsContent = item?.detailsContent || '无内容'
+            router.push('/CompanyNews?openType=1&id='+item?.id 
+            + '&bodyType=4&title='+item?.title)
+        }
      }
 }
 

+ 12 - 5
src/components/AboutUs/base/HonoraryQualifications.vue

@@ -9,7 +9,7 @@
             <div class="small-title-line"></div>
         </div>
         <div class="flex ProductServicesbox">
-            <div class="boximg" v-for="(item,index) in list" :key="index">
+            <div class="boximg" v-for="(item,index) in list" @click="goto(item)" :key="index">
                 <div style="width: 100%;">
                     <img class="boximg_img" :src="item.imgUrl" alt="">
                 </div>
@@ -20,8 +20,12 @@
 
 <script setup>
 import {onMounted,ref,reactive,watch} from 'vue'
-import {HonorlistByOpen} from '@/http/api/common.js' 
+import {HonorlistByOpen,getArticleDetailByOpen} from '@/http/api/common.js' 
 import {useRouter} from 'vue-router'
+//使用pinia缓存数据
+import { useCounterStore } from '@/stores/counter'
+const counter = useCounterStore()
+
 const router=useRouter()
 const list = ref([
     {
@@ -100,13 +104,16 @@ onMounted(async() => {
     }
 
 });
-const goto = (item) =>{
-    console.log('check',item.type,item.id);
+const goto = async (item) =>{
      // 1-无跳转地址 2-跳转第三方地址 3-跳转详情页面(通过id获取详情)
      if (item.type == '2') {
         window.open(item?.toUrl, "_blank");
      }else if(item.type == '3'){
-        router.push('/CompanyNews?openType=1&id='+item.id)
+        if (item?.detailsContent != '') {
+            counter.detailsContent = item?.detailsContent || '无内容'
+            router.push('/CompanyNews?openType=1&id='+item?.id 
+            + '&bodyType=4&title='+item?.honorName)
+        }
      }
 }
 </script>

+ 8 - 5
src/components/NewsCom/NewsType1.vue

@@ -98,7 +98,6 @@ watch(()=>counter.menuName,(newVal)=>{
 watch(
   () => route.query,
   async(routeQuery) => {
-    console.log('newRouterName222222222',routeQuery)
     if (routeQuery?.ismeun == '1') {
         //如果是从导航栏过来的 
         let res = await getMenuDetailByOpen({
@@ -108,8 +107,10 @@ watch(
         newsHtml.value = res.data.content
     }else{
         //判断打开的是富文本还是视频详情页
-        //bodyType 正文类型1=富文本;2=视频;3=xxx
-        if (route?.query?.bodyType) {
+        //bodyType 正文类型1=富文本;2=视频;3=xxx 4取counter中数据
+        if (route?.query?.bodyType == '4') {
+            newsHtml.value = counter.detailsContent
+        } else {
             showVideo.value = route?.query?.bodyType == '1'? false:true
                 //添加阅读记录
                 await saveReadArticleNum({
@@ -165,8 +166,10 @@ onMounted(async() => {
   }
 
   //判断打开的是富文本还是视频详情页
-  //bodyType 正文类型1=富文本;2=视频;3=xxx
-   if (route?.query?.bodyType) {
+  //bodyType 正文类型1=富文本;2=视频;3=xxx 4取counter中数据
+    if (route?.query?.bodyType == '4') {
+        newsHtml.value = counter.detailsContent
+    } else  {
       showVideo.value = route?.query?.bodyType == '1'? false:true
         //添加阅读记录
         await saveReadArticleNum({

+ 4 - 1
src/stores/counter.js

@@ -14,5 +14,8 @@ export const useCounterStore = defineStore('counter',()=> {
   //获取当前菜单名字
   const menuName = ref('')
 
-  return { indexMeunKey,menulist,homeList,menuName }
+  //文章详情
+  const detailsContent = ref('')
+
+  return { indexMeunKey,menulist,homeList,menuName,detailsContent }
 })