|
|
@@ -3,10 +3,12 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import SocialShare from 'vue-social-share';
|
|
|
+import resolveUrl from 'resolve-url';
|
|
|
+import product from '../mixins/product';
|
|
|
export default {
|
|
|
name: 'share',
|
|
|
props: {
|
|
|
- isBrand: {
|
|
|
+ isCasting: {
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
},
|
|
|
@@ -16,26 +18,48 @@ export default {
|
|
|
return {};
|
|
|
}
|
|
|
},
|
|
|
- local: {
|
|
|
+ pageType: {
|
|
|
type: String,
|
|
|
- default: 'zh'
|
|
|
+ default: 'collectionDetail'
|
|
|
}
|
|
|
},
|
|
|
+ mixins: [product],
|
|
|
components: {
|
|
|
SocialShare
|
|
|
},
|
|
|
computed: {
|
|
|
shareConfig() {
|
|
|
return {
|
|
|
- url: 'https://www.imttech.cn/index/productDetail?id=' + this.info.id,
|
|
|
- title: this.info.nickname, // 标题,默认读取 document.title 或者 <meta name="title" content="share.js" />
|
|
|
- description: this.info.intro, // 描述, 默认读取head标签:<meta name="description" content="PHP弱类型的实现原理分析" />
|
|
|
- image: this.info.avatar, // 图片, 默认取网页中第一个img标签
|
|
|
+ url: resolveUrl(this.$baseUrl, this.pageType + '?id=' + this.info.id),
|
|
|
+ title: this.shareTitle, // 标题,默认读取 document.title 或者 <meta name="title" content="share.js" />
|
|
|
+ description: this.description, // 描述, 默认读取head标签:<meta name="description" content="PHP弱类型的实现原理分析" />
|
|
|
+ image: this.image, // 图片, 默认取网页中第一个img标签
|
|
|
sites: ['qq', 'weibo', 'wechat', 'twitter'], // 启用的站点
|
|
|
disabled: [], // 禁用的站点
|
|
|
wechatQrcodeTitle: '微信扫一扫',
|
|
|
wechatQrcodeHelper: '<p>微信里点“+”,扫一扫</p>'
|
|
|
};
|
|
|
+ },
|
|
|
+ shareTitle() {
|
|
|
+ return this.pageType == 'collectionDetail'
|
|
|
+ ? `收藏品——${this.info.name}`
|
|
|
+ : this.pageType === 'caseDetail'
|
|
|
+ ? `铸造者——${this.info.name}`
|
|
|
+ : `收藏品——${this.info.name}`;
|
|
|
+ },
|
|
|
+ description() {
|
|
|
+ return this.pageType == 'collectionDetail'
|
|
|
+ ? `铸造者——${this.info.minter}`
|
|
|
+ : this.pageType === 'caseDetail'
|
|
|
+ ? this.info.intro
|
|
|
+ : `铸造者——${this.info.minter}`;
|
|
|
+ },
|
|
|
+ image() {
|
|
|
+ return this.pageType == 'collectionDetail'
|
|
|
+ ? this.getImg(this.changeImgs(this.info.pic))
|
|
|
+ : this.pageType === 'caseDetail'
|
|
|
+ ? this.info.avatar
|
|
|
+ : this.getImg(this.changeImgs(this.info.pic));
|
|
|
}
|
|
|
}
|
|
|
};
|