Ver código fonte

分享人员头像

natasha 1 ano atrás
pai
commit
cc475c1820
2 arquivos alterados com 40 adições e 20 exclusões
  1. 39 19
      src/views/bookShelf/articleDetail.vue
  2. 1 1
      src/views/bookShelf/share.vue

+ 39 - 19
src/views/bookShelf/articleDetail.vue

@@ -115,7 +115,19 @@
             <h5>分享</h5>
             <i class="el-icon-close" @click="handleCloseShare"></i>
         </div>
-        <img :src="shareSrc" />
+        <template v-if="shareSrc">
+            <img :src="shareSrc" />
+        </template>
+        <template v-else>
+            <el-skeleton style="width: 240px" :loading="true" animated>
+                <template slot="template">
+                    <el-skeleton-item
+                        variant="image"
+                        style="width: 380px; height: 532px;"
+                    />
+                </template>
+            </el-skeleton>
+        </template>
         <div class="share-box-bottom">
             <el-button type="primary" @click="downLoadImg(shareSrc)" size="small">下载图片</el-button>
             <el-button @click="CopyToClipboard('copyDownUrl')" size="small" type="primary" plain>复制链接</el-button>
@@ -840,9 +852,15 @@ export default {
     },
     changeArticleType(type,e){
         if(type==='print'||type==='share'||type==='list'||type==='cloud'){
-            this.menuFeature = type
             if(type==='share'){
-                this.handleCreateShare()
+                if(this.userMessage){
+                    this.handleCreateShare()
+                    this.menuFeature = type
+                }else{
+                    this.$message.error('请先登录')
+                }
+            }else{
+                this.menuFeature = type
             }
         }else{
             this.menuType = type
@@ -893,23 +911,25 @@ export default {
     },
     // 创建分享
     handleCreateShare(){
-        this.shareLoading = true
-        let MethodName = "/ShopServer/Client/ShareManager/CreateShareRecord";
-        let data = {
-            goods_type: 21,
-            goods_id: this.articleId
-        }
-        getLogin(MethodName, data)
-        .then((res) => {
-            this.shareLoading = false
-            if(res.status===1){
-                this.share_url = res.share_url
-                this.shareSrc = 'data:image/jpeg;base64,'+res.image_content_base64
+        
+            this.shareLoading = true
+            let MethodName = "/ShopServer/Client/ShareManager/CreateShareRecord";
+            let data = {
+                goods_type: 21,
+                goods_id: this.articleId
             }
-        })
-        .catch(() => {
-            this.shareLoading = false
-        }); 
+            getLogin(MethodName, data)
+            .then((res) => {
+                this.shareLoading = false
+                if(res.status===1){
+                    this.share_url = res.share_url
+                    this.shareSrc = 'data:image/jpeg;base64,'+res.image_content_base64
+                }
+            })
+            .catch(() => {
+                this.shareLoading = false
+            }); 
+        
     },
     changeLike(type,list){
         this[type] = list

+ 1 - 1
src/views/bookShelf/share.vue

@@ -40,7 +40,7 @@ export default {
                 return
             }
             localStorage.setItem('share_person_name',res.share_record.person_name)
-            localStorage.setItem('share_person_touxiang',require('../../assets/avatar.png'))
+            localStorage.setItem('share_person_touxiang',res.share_record.person_image_url)
             this.$router.replace({
                 path: "/articleShareDetail",
                 query: {