Selaa lähdekoodia

分享&检查认证

panhui 4 vuotta sitten
vanhempi
commit
5091f220f0

+ 31 - 7
src/main/pc-space/src/components/Share.vue

@@ -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));
         }
     }
 };

+ 13 - 0
src/main/pc-space/src/mixins/common.js

@@ -104,6 +104,19 @@ export default {
                 return Promise.reject();
             }
         },
+        //去认证
+        checkAuth() {
+            if (this.authStatus === '已认证') {
+                return Promise.resolve();
+            } else {
+                this.$confirm('用户未认证,是否立即认证', '提示', {
+                    confirmButtonText: '立即认证'
+                }).then(() => {
+                    this.$router.push('/authentication');
+                });
+                return Promise.reject();
+            }
+        },
         getLabelName(val = '', list = []) {
             let info = list.find(item => {
                 return item.value === val;

+ 17 - 7
src/main/pc-space/src/views/AssetDetail.vue

@@ -31,10 +31,14 @@
                 <div class="title">
                     <div class="title1">{{ info.name }}</div>
                     <div class="text">
-                        <div class="text1">
-                            <img class="img1" src="../assets/img/fenxiang-icon@3x.png" alt="" />
-                            <div class="text2">分享</div>
-                        </div>
+                        <el-popover placement="bottom" trigger="hover">
+                            <div class="text1" slot="reference">
+                                <img class="img1" src="../assets/img/fenxiang-icon@3x.png" alt="" />
+                                <div class="text2">分享</div>
+                            </div>
+
+                            <share :info="info" pageType="assetDetail"> </share>
+                        </el-popover>
                     </div>
                 </div>
                 <div class="name-list">
@@ -88,7 +92,7 @@
                                 <i class="font_family icon-icon-gongkaizhanshi"></i>
                                 <span>{{ info.publicShow ? '取消展示' : '公开展示' }}</span>
                             </div>
-                            <div class="btn-item" @click="show = true">
+                            <div class="btn-item" @click="send">
                                 <i class="font_family icon-icon-zengsong"></i>
                                 <span>赠送好友</span>
                             </div>
@@ -169,7 +173,7 @@
             </collection-info>
         </div>
 
-        <send :show="show"></send>
+        <send ref="send"></send>
     </div>
 </template>
 <script>
@@ -180,8 +184,9 @@ import 'swiper/css/swiper.css';
 import CollectionInfo from '../components/CollectionInfo.vue';
 import { mapState } from 'vuex';
 import Send from './Send.vue';
+import Share from '../components/Share.vue';
 export default {
-    components: { Swiper, SwiperSlide, CollectionInfo, Send },
+    components: { Swiper, SwiperSlide, CollectionInfo, Send, Share },
     mixins: [asset, product],
     data() {
         return {
@@ -323,6 +328,11 @@ export default {
                         this.$message.success('取消展示');
                     });
             }
+        },
+        send() {
+            this.checkAuth().then(() => {
+                this.$refs.send.show = true;
+            });
         }
     }
 };

+ 1 - 1
src/main/pc-space/src/views/CastingDetail.vue

@@ -27,7 +27,7 @@
                     </el-button>
                     <el-popover placement="bottom" trigger="hover">
                         <el-button style="margin-left: 20px" slot="reference" plain round size="mini">分享</el-button>
-                        <share :info="info"> </share>
+                        <share :info="info" pageType="caseDetail"> </share>
                     </el-popover>
                 </div>
 

+ 11 - 5
src/main/pc-space/src/views/CollectionDetail.vue

@@ -34,10 +34,15 @@
                         <like-button size="large" :isLike="info.liked" @like="likeProduct">
                             {{ info.likes }}
                         </like-button>
-                        <div class="text1">
-                            <img class="img1" src="../assets/img/fenxiang-icon@3x.png" alt="" />
-                            <div class="text2">分享</div>
-                        </div>
+
+                        <el-popover placement="bottom" trigger="hover">
+                            <div class="text1" slot="reference">
+                                <img class="img1" src="../assets/img/fenxiang-icon@3x.png" alt="" />
+                                <div class="text2">分享</div>
+                            </div>
+
+                            <share :info="info" pageType="collectionDetail"> </share>
+                        </el-popover>
                     </div>
                 </div>
                 <div class="name-list">
@@ -176,8 +181,9 @@ import 'swiper/css/swiper.css';
 import LikeButton from '../components/LikeButton.vue';
 import CollectionInfo from '../components/CollectionInfo.vue';
 import Submit from './Submit.vue';
+import Share from '../components/Share.vue';
 export default {
-    components: { Swiper, SwiperSlide, LikeButton, CollectionInfo, Submit },
+    components: { Swiper, SwiperSlide, LikeButton, CollectionInfo, Submit, Share },
     mixins: [product],
     data() {
         return {

+ 1 - 7
src/main/pc-space/src/views/Send.vue

@@ -63,17 +63,11 @@
 </template>
 
 <script>
-import { boolean } from 'mathjs';
 export default {
-    props: {
-        show: {
-            type: boolean,
-            default: false
-        }
-    },
     data() {
         return {
             payMethods: 'ALIPAY',
+            show: false,
             payList: [
                 {
                     icon: require('../assets/alipay.png'),