Parcourir la source

feat: 三级也layout组件新增无广告位时是否需要铺满参数控制

cuiyalong il y a 4 ans
Parent
commit
6fd5868b7b

+ 4 - 0
src/App.vue

@@ -41,6 +41,10 @@ export default {
 </script>
 <style lang="scss">
 @import "~@/assets/style/reset-ele.scss";
+.w1200 {
+  width: 1200px;
+  margin: 0 auto;
+}
 .page--big-member.bg-white {
   background-color: #fff;
   .page-container {

+ 10 - 3
src/components/common/ContentLayout.vue

@@ -1,9 +1,9 @@
 <template>
-  <div class="content-container">
+  <div class="content-container w1200">
     <div class="content-main">
       <slot name="default"></slot>
     </div>
-    <div class="content-right ad-container" :class="{ nothing: adList.length === 0 }">
+    <div class="content-right ad-container" :class="{ nothing: adList.length === 0 && autoExpand }">
       <slot name="right">
         <slot name="right-top"></slot>
         <div class="ad-list">
@@ -27,6 +27,7 @@ import { getAdList } from '@/api/modules/'
 export default {
   name: 'content-layout',
   props: {
+    // 是否需要获取广告位列表(不获取则不会显示广告位)
     needAd: {
       type: Boolean,
       default: true
@@ -38,6 +39,11 @@ export default {
     adNum: {
       type: Number,
       default: 2
+    },
+    // 如果没有广告位,是否宽度自适应铺满
+    autoExpand: {
+      type: Boolean,
+      default: true
     }
   },
   data () {
@@ -77,7 +83,7 @@ export default {
       const { data } = await getAdList(params)
 
       if (Array.isArray(data)) {
-        this.adList = data
+        this.adList = []
       }
     }
   }
@@ -91,6 +97,7 @@ export default {
   padding-bottom: 60px;
   .content-main {
     flex: 1;
+    transition: .1s;
   }
   .content-right {
     width: 264px;

+ 9 - 2
src/components/push-list/ProjectList.vue

@@ -161,8 +161,15 @@ export default {
       }
     },
     toDetail (item) {
-      const { sid } = item
-      window.open(`/article/content/${sid}.html`)
+      const { sid, fid } = item
+      let link = this.$router.resolve({
+        path: '/project/info',
+        query: {
+          sid,
+          fid
+        }
+      })
+      window.open(link.href, '_blank')
     },
     onPageChange (p) {
       this.listState.pageNum = p