Browse Source

文章h5分享页面

lipengtao 6 years ago
parent
commit
935a3a026f
3 changed files with 60 additions and 14 deletions
  1. 3 3
      src/pages/content/show.vue
  2. 43 3
      src/pages/h5/views/content/content.vue
  3. 14 8
      static/plat-info.js

+ 3 - 3
src/pages/content/show.vue

@ -82,9 +82,9 @@
82 82
    },
83 83
    created() {
84 84
      this.contentId = urlParse('id');
85
      // if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
86
      //   location.href="http://" + window.location.host + "/h5.html#/content?id="+this.contentId;
87
      // }
85
      if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){
86
        location.href="http://" + window.location.host + "/h5.html#/content?id="+this.contentId;
87
      }
88 88
      this.elurl = window.location.href;
89 89
      this.getContentInfo();
90 90
      this.getPlatExperts();

+ 43 - 3
src/pages/h5/views/content/content.vue

@ -48,11 +48,24 @@
48 48
              <baseCompany v-for="item in platCompanys" :key="item.index" :itemSingle="item"></baseCompany>
49 49
            </div>
50 50
          </div>
51
          <div class="block-wrapper" v-if="adinfo.shareAdBottom.length">
52
            <a class="ad-wrapper" v-for="item in adinfo.shareAdBottom" :key="item.index" :href="item.adUrl" target="_blank">
51
          <div class="block-wrapper" v-if="adinfo.shareAdCenter.length">
52
            <a class="ad-wrapper" v-for="item in adinfo.shareAdCenter" :key="item.index" :href="item.adUrl" target="_blank">
53 53
              <img :src="item.imgUrl" width="100%">
54 54
            </a>
55 55
          </div>
56
          <div class="inner-wrapper" v-if="paltNews && paltNews.length">
57
              <div class="content-title">
58
                <span>最新文章</span>
59
              </div>
60
              <div class="content" id="conNonedis">
61
                  <baseContent v-for="item in paltNews" :key="item.index" :itemSingle="item" :showOwner="false"></baseContent>
62
              </div>
63
            </div>
64
            <div class="block-wrapper" v-if="adinfo.shareAdBottom.length">
65
                <a class="ad-wrapper" v-for="item in adinfo.shareAdBottom" :key="item.index" :href="item.adUrl" target="_blank">
66
                  <img :src="item.imgUrl" width="100%">
67
                </a>
68
              </div>
56 69
        </div>
57 70
      </div>
58 71
    </div>
@ -65,10 +78,12 @@
65 78
  import baseExpert from '@/components/subTemplate/BaseExpert';
66 79
  import baseOrg from '@/components/subTemplate/BaseOrg';
67 80
  import baseCompany from '@/components/subTemplate/BaseCompany';
81
  import baseContent from '@/components/subTemplate/BaseContent';
68 82
  export default {
69 83
    data() {
70 84
      return {
71 85
        /* eslint-disable no-undef */
86
        paltNews: [],
72 87
        adinfo: PLAT.info.adinfo,
73 88
        contentInfo: '',
74 89
        platExperts: '',
@ -82,13 +97,38 @@
82 97
      this.getPlatExperts();
83 98
      this.getPlatOrgs();
84 99
      this.getPlatCompanys();
100
      this.queryPaltNews();
85 101
    },
86 102
    components: {
87 103
      baseExpert,
88 104
      baseOrg,
89
      baseCompany
105
      baseCompany,
106
      baseContent
90 107
    },
91 108
    methods: {
109
      queryPaltNews() {
110
        this.$axios.get('/ajax/article/pq', {
111
          published: 1,
112
          pageSize: 6,
113
          pageNo: 1
114
        }, (res) => {
115
          if (res.success && res.data) {
116
            var $info = res.data.data;
117
            if ($info.length > 0) {
118
              for (let i = 0; i < $info.length; ++i) {
119
                if($info[i].id === this.contentId) {
120
                  $info.splice(i,1)
121
                  continue
122
                }
123
                if ($info[i].modifyTime) {
124
                  $info[i].modifyTime = commenTime($info[i].modifyTime, true)
125
                }
126
              }
127
              this.paltNews = $info.slice(0,5)
128
            }
129
          };
130
        });
131
      },
92 132
      getContentInfo() {
93 133
        this.$axios.get('/ajax/article/qo', {
94 134
          id: this.contentId

+ 14 - 8
static/plat-info.js

@ -16,16 +16,22 @@ PLAT.info = {
16 16
  'platimgurl': '/static/xtkfq/platimg.jpg',
17 17
  'adinfo': {
18 18
    'shareAdTop': [
19
      {
20
        'adUrl': 'javascript:void(0)',
21
        'imgUrl': '/static/xtkfq/banner.jpg'
22
      }
19
      // {
20
      //   'adUrl': 'javascript:void(0)',
21
      //   'imgUrl': '/static/xtkfq/banner.jpg'
22
      // }
23
    ],
24
    'shareAdCenter': [
25
      // {
26
      //   'adUrl': 'javascript:void(0)',
27
      //   'imgUrl': '/static/xtkfq/banner.jpg'
28
      // }
23 29
    ],
24 30
    'shareAdBottom': [
25
      {
26
        'adUrl': 'javascript:void(0)',
27
        'imgUrl': '/static/xtkfq/banner.jpg'
28
      }
31
      // {
32
      //   'adUrl': 'javascript:void(0)',
33
      //   'imgUrl': '/static/xtkfq/banner.jpg'
34
      // }
29 35
    ],
30 36
    'searchAd': [
31 37
      // {