index.vue 3.55 KB
Newer Older
潘琦 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<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>
          <div class="list-item-cell tool">
            <i class="glyphicon glyphicon-share"></i>
          </div>
        </div>
      </div>
      <div class="content" v-html="data.content"></div>
    </div>
  </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'
27
import { wxpermission, initWXShare } from '@/wxpermission'
潘琦 committed
28
import { removeUrlParam } from '@/util/index'
潘琦 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

export default {
  name: 'Home',
  data () {
    return {
      imprId: this.$route.query.imprId,
      data: {
        producerPicUrl: '',
        producerName: '',
        producerOrgName: '',
        content: ''
      }
    }
  },
  created () {
    this.getContentInfoFn(this.imprId)
  },
  mounted: function () {
47
    wxpermission(1, () => {})
潘琦 committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  },
  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
63 64
            content: res.data.content,
            mainTitle: res.data.mainTitle,
65 66
            subheading: res.data.subheading,
            cover: res.data.cover
潘琦 committed
67
          }
潘琦 committed
68
          console.log('getContentInfo')
69 70
          let that = this
          let newShareLink = removeUrlParam('code')
潘琦 committed
71
          newShareLink = newShareLink.split('#')[0] + '#/content?imprId=' + this.imprId
72 73 74 75 76 77 78
          const shareData = {
            title: that.data.mainTitle,
            imgUrl: that.data.cover,
            desc: that.data.subheading !== '' ? that.data.subheading : '凯歌健康券',
            link: newShareLink
          }
          initWXShare(shareData)
潘琦 committed
79 80 81 82 83 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
        }
      }).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;
127
    font-size: 1.6em;
潘琦 committed
128 129 130 131 132
    color: #43d1be;
    text-align: right;
    border-bottom:1px solid #ccc;
  }
</style>