Ver código fonte

商品详情分享到小程序

git-svn-id: svn://svn7.apicloud.com/A6007457911931/%E5%9C%88%E5%A4%9A%E5%A4%9A@632 0e1a2743-8d03-4e5a-a60c-7e26af42b145
1149931599@qq.com 4 anos atrás
pai
commit
5172b066e0
2 arquivos alterados com 49 adições e 32 exclusões
  1. 1 0
      html/frame2.html
  2. 48 32
      html/home/showgoods.html

+ 1 - 0
html/frame2.html

@@ -231,6 +231,7 @@ function getRouteData() {
         success: function(datas) {
             if (datas.result) {
                 var _html = '';
+	
                 console.log(JSON.stringify(datas.data.order_list))
                 if (datas.data.order_list.length > 0) {
                     $.each(datas.data.order_list, function(index, item) {

+ 48 - 32
html/home/showgoods.html

@@ -13,9 +13,6 @@
     <link rel="stylesheet" type="text/css" href="../../css/star-rating-svg.css" />
     <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css" />
     <style>
-        body, html{
-
-        }
         .back-header {
             background: rgb(0, 0, 0, 0);
         }
@@ -95,9 +92,6 @@
         }
         .goods-desc-right li{
           float:right;
-        }
-        .goods-desc-tag{
-
         }
         .goods-desc-mtotal {
           /*width:100%;*/
@@ -358,18 +352,18 @@
       .back-top {
         bottom: 60px;
       }
-        .nav_fixed {
+      .nav_fixed {
             position: fixed;
             margin-top: 0.86rem;
             top: 0;
-        }
-        .goods-tab-b.goods-tab img {
+      }
+      .goods-tab-b.goods-tab img {
           max-width: 100% !important;
           height: auto !important;
-        }
-        .buy-kuc-tip {
+      }
+      .buy-kuc-tip {
           display: none;
-        }
+      }
     </style>
     <script>
         (function(w, d, m) {
@@ -547,6 +541,8 @@ var _shareurl = '';
 var _storeid_url = '';
 var _sku_data = {};
 var _sku_spec_map = {};
+var imgUrl="";
+
 apiready = function() {
     _keyid = api.pageParam.keyid;
     _storeid = api.pageParam.storeid;
@@ -617,7 +613,6 @@ function getRouteData(_keyid, _storeid) {
                     }
                 }
                 if (datas.data.points == 0) {
-                    //rgba(0, 0, 0, 0)
                     $(".goods-costprice").css("color", "rgba(0, 0, 0, 0)");
                     $(".goods-costprice").parent("p").css("color", "rgba(0, 0, 0, 0)");
                 } else {
@@ -687,6 +682,9 @@ function getRouteData(_keyid, _storeid) {
                         _images.push(siteurl + "uploads/home/store/goods/" + item_b.goodsimage_url.substr(0, item_b.goodsimage_url.indexOf("\_")) + "/" + item_b.goodsimage_url);
                     })
                 }
+				if(datas.data.images.length > 0){
+					imgUrl=_images[0];
+				}
                 var swiper = new Swiper('.swiper-container', {
                     allowSlidePrev: true,
                     pagination: {
@@ -908,26 +906,44 @@ function closePhotoViewer() {
     UIPhotoViewer.close();
 }
 $(".share-item-friend").on("tap", function() {
-
     var wx = api.require('wx');
-
-    wx.shareProgram({
-        apiKey: '',
-        scene: 'session',
-        title: _title,
-        description: _description,
-        thumb: 'widget://image/logo2.png',
-        webpageUrl: _shareurl,
-        userName: 'gh_344fb21bce0f',
-        path: 'pages/index/shop?id='+_keyid+'&store_id'+_storeid,
-    }, function(ret, err) {
-        if (ret.status) {
-            alert('分享成功');
-        } else {
-            alert(err.code);
-        }
-    });
-
+	api.download({
+	    url: _shareimg,
+	    // savePath: 'widget://'+_storeid+'.png',
+	    report: false,
+	    cache: true,
+	    allowResume: true
+	}, function(ret, err) {
+		 if (ret.state == 1) {
+			console.log(JSON.stringify(ret));
+			console.log('pages/index/shop?id='+_keyid+'&store_id'+_storeid);
+			var str=ret.savePath.slice(-3);
+			var str2="";
+			if(str=='png'){
+				str2=ret.savePath;
+			}else{
+				str2="widget://image/logo2.png";
+			}
+			wx.shareProgram({
+				scene: 'session',
+				title: _title,
+				description: _description,
+				thumb: str2,
+				webpageUrl: _shareurl,
+				userName: 'gh_344fb21bce0f',
+				path: 'pages/index/shop?id='+_keyid+'&store_id'+_storeid,
+			}, function(ret, err) {
+				console.log(JSON.stringify(err));
+				if (ret.status) {
+					alert('分享成功');
+				} else {
+					alert(err.code);
+				}
+			})
+		}
+	})
+	
+	
     /*wx.shareWebpage({
         scene: 'session',
         title: _title,