index.vue 3.94 KB
Newer Older
潘琦 committed
1 2 3 4 5 6 7 8 9 10 11 12
<template>
  <div class="full-page">
    <div class="container contentPage">
      <div class="head">
        <div class="list-item">
          <div class="list-item-cell picture">
            <span class="avatar" :style="{backgroundImage:'url(' + data.producerPicUrl + ')'}"></span>
          </div>
          <div class="list-item-cell info">
            <div class="title">{{data.producerName}}</div>
            <p>{{data.producerOrgName}}</p>
          </div>
13
          <div class="list-item-cell tool" @click="shareVisible=true">
潘琦 committed
14 15 16 17 18 19
            <i class="glyphicon glyphicon-share"></i>
          </div>
        </div>
      </div>
      <div class="content" v-html="data.content"></div>
    </div>
20 21 22
    <div class="share-block" v-show="shareVisible">
      <img src="../../assets/images/share-img.png" @click="shareVisible=false"/>
    </div>
潘琦 committed
23 24 25 26 27 28 29
  </div>
</template>

<script>
// import { getUserCard, getunUsedCountById } from '@/api/apply/apply'
import { getContentInfo } from '@/api/apply/apply'
import defaultOrgImg from '../../assets/images/org-default-picture.png'
30
import { wxpermission, initWXShare } from '@/wxpermission'
潘琦 committed
31
import { removeUrlParam } from '@/util/index'
潘琦 committed
32 33 34 35 36 37 38 39 40 41 42

export default {
  name: 'Home',
  data () {
    return {
      imprId: this.$route.query.imprId,
      data: {
        producerPicUrl: '',
        producerName: '',
        producerOrgName: '',
        content: ''
43 44
      },
      shareVisible: false
潘琦 committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
    }
  },
  created () {
    this.getContentInfoFn(this.imprId)
  },
  mounted: function () {
  },
  computed: {
  },
  components: {
  },
  methods: {
    getContentInfoFn (imprId) {
      this.$Indicator.open()
      getContentInfo(imprId).then(res => {
        this.$Indicator.close()
        if (res.code === 0) {
          this.data = {
            producerPicUrl: res.data.producerPicUrl !== '' ? res.data.producerPicUrl : defaultOrgImg,
            producerName: res.data.producerName,
            producerOrgName: res.data.producerOrgName,
潘琦 committed
66 67
            content: res.data.content,
            mainTitle: res.data.mainTitle,
68 69
            subheading: res.data.subheading,
            cover: res.data.cover
潘琦 committed
70
          }
潘琦 committed
71
          console.log('getContentInfo')
72
          let that = this
73 74 75 76 77 78 79 80 81 82 83
          wxpermission(1, () => {
            let newShareLink = removeUrlParam('code')
            newShareLink = newShareLink.split('#')[0] + '#/content?imprId=' + this.imprId
            const shareData = {
              title: that.data.mainTitle,
              imgUrl: that.data.cover,
              desc: that.data.subheading !== '' ? that.data.subheading : '凯歌健康券',
              link: newShareLink
            }
            initWXShare(shareData)
          })
潘琦 committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
        }
      }).catch((error) => {
        this.$toast({
          message: error.message,
          position: 'center',
          duration: 3000
        })
      })
    }
  }
}
</script>

<style scoped>
  .full-page {
    background-color: #ffffff;
  }

  .contentPage .head {
    padding: 1em 0;
  }
  .contentPage .head > .list-item {
    display: table;
    width: 100%;
  }
  .contentPage .head > .list-item > .list-item-cell {
    display: table-cell;
    vertical-align: middle;
  }
  .contentPage .head > .list-item > .list-item-cell.picture {
    width: 4.5em;
  }
  .contentPage .head > .list-item > .list-item-cell.picture > .avatar{
    display: inline-block;
    width: 4em;
    height: 4em;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-size: 100% auto;
  }
  .contentPage .head > .list-item > .list-item-cell.info {
    border-bottom:1px solid #ccc;
  }
  .contentPage .head > .list-item > .list-item-cell.info > .title {
    font-size: 1.1em;
  }
  .contentPage .head > .list-item > .list-item-cell.tool {
    width: 2em;
132
    font-size: 1.6em;
潘琦 committed
133 134 135 136
    color: #43d1be;
    text-align: right;
    border-bottom:1px solid #ccc;
  }
137 138 139 140 141 142 143 144 145 146 147 148

  .share-block {
    position: fixed;
    z-index: 9999;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
  }
  .share-block img {
    width: 100%;
  }
潘琦 committed
149
</style>