Browse Source

商品分享图片显示

skyblued 2 years ago
parent
commit
d54f12ac36

+ 18 - 1
src/views/shop-mall/goods-detail/index.module.less

@@ -230,17 +230,28 @@
   .shareLeft {
     margin-right: 10px;
   }
+  .shareRight{
+    flex: 1;
+    overflow: hidden;
+  }
   .shareShopTitle {
     font-size: 16px;
     font-weight: 400;
     color: #333333;
-
+    display: -webkit-box;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    -webkit-line-clamp: 2;
+    -webkit-box-orient: vertical;
   }
   .shareShopDes {
     font-size: 14px;
     font-weight: 400;
     color: #999999;
     margin: 10px 0 20px 0;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
   }
   .shareShopValue {
     font-size: 16px;
@@ -250,4 +261,10 @@
     color: #E5E5E5;
     margin-left: 5px;
   }
+
+  :global{
+    .van-card{
+      background: transparent;
+    }
+  }
 }

+ 25 - 12
src/views/shop-mall/goods-detail/index.tsx

@@ -20,7 +20,8 @@ import {
   Badge,
   Toast,
   Popup,
-  SubmitBar
+  SubmitBar,
+  Card
 } from 'vant'
 import { defineComponent } from 'vue'
 import styles from './index.module.less'
@@ -47,7 +48,7 @@ export default defineComponent({
       selectGoodsItem: {},
       cartCount: 0,
       showType: 'cart',
-      shareShow: false, // 分享弹窗
+      shareShow: false // 分享弹窗
     }
   },
   computed: {
@@ -93,9 +94,10 @@ export default defineComponent({
       return 0
     },
 
-    shareUrl(){ // 分享链接
+    shareUrl() {
+      // 分享链接
       const productId = this.product.id as any
-      if (browser().isApp){
+      if (browser().isApp) {
         return `${location.origin}/teacher/#/shareMall?bizId=${productId}&userId=${state.user.data.userId}`
       } else {
         return `${location.origin}/teacher.html#/shareMall?bizId=${productId}&userId=${state.user.data.userId}`
@@ -103,7 +105,6 @@ export default defineComponent({
     }
   },
   async mounted() {
-    
     try {
       this.loading = true
       const res = await request.get(
@@ -191,7 +192,7 @@ export default defineComponent({
           this.cartCount = data.length
         }
       } catch (err) {}
-    },
+    }
   },
   render() {
     const product = this.product
@@ -201,7 +202,8 @@ export default defineComponent({
         <ColHeader
           v-slots={{
             right: () => {
-              if (state.platformType === 'TEACHER') {
+              console.log(state.platformType)
+              if (state.platformType === 'STUDENT') {
                 return (
                   <div
                     class={styles.shareBtn}
@@ -385,8 +387,16 @@ export default defineComponent({
           />
         </Popup>
 
-        <Popup style={{background: 'transparent'}} show={this.shareShow} onClose={() => (this.shareShow = false)}>
-          <ColShare shareUrl={this.shareUrl} teacherId={state.user.data.userId} shareType="mall">
+        <Popup
+          style={{ background: 'transparent' }}
+          show={this.shareShow}
+          onClose={() => (this.shareShow = false)}
+        >
+          <ColShare
+            shareUrl={this.shareUrl}
+            teacherId={state.user.data.userId}
+            shareType="mall"
+          >
             <div class={styles.shareWrap}>
               <div class={styles.shareLeft}>
                 <img crossorigin="anonymous" class={styles.sharePic} src={this.product.pic}></img>
@@ -400,11 +410,14 @@ export default defineComponent({
                   <span class={styles.shareShopPrice}>
                     {moneyFormat(this.getPrice)}
                   </span>
-                  {/* <del class={styles.shareShopOldPrice}>
-                    {moneyFormat(product.originalPrice)}
-                  </del> */}
                 </div>
               </div>
+              {/* <Card
+                price={this.getPrice}
+                desc={selectSku.sku}
+                title={this.product.name}
+                thumb={this.product.pic}
+              /> */}
             </div>
           </ColShare>
         </Popup>