Z1hgq 7 лет назад
Родитель
Сommit
c6357d9795

BIN
Album/.DS_Store


BIN
Album/images/.DS_Store


BIN
Album/images/1.png


BIN
Album/images/2.png


BIN
Album/images/3.png


BIN
Album/images/4.png


BIN
Album/images/5.png


BIN
Album/images/6.png


BIN
Album/images/7.png


BIN
Album/images/back.png


BIN
Album/images/forward.png


+ 17 - 21
Album/js/draw/details.js

xqd xqd xqd
@@ -30,19 +30,20 @@ forward.src = 'images/forward.png'
 let back = wx.createImage()
 back.src = 'images/back.png'
 let ratio = img1.width / img1.height
-
+let loadingDown = false
 export default class Details {
   showDetails(context, image, text, price) {
+    console.log('detail begin')
     if (isiPhoneX) {
       //加载大图
-      image.onload = function () {
+      image.onload = function () {        
         context.clearRect(0, 0, screenWidth * 2, screenHeight * 2)
         context.drawImage(image, 70, 0, screenWidth * 2, screenHeight * 2)
         context.drawImage(img1, (screenWidth / 2 - 200) * 2 + 70, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
         context.drawImage(img2, (screenWidth / 2 - 100) * 2 + 70, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
         context.drawImage(img3, (screenWidth / 2) * 2 + 70, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
         context.drawImage(img4, (screenWidth / 2 + 100) * 2 + 70, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
-        context.drawImage(img5, 10 * 2 + 70, (screenHeight - 40) * 2, 40 * 2, 30 * 2)
+        context.drawImage(img5, 10 * 2 + 70, (screenHeight - 40) * 2, 30 * 2, 30 * 2)
         context.drawImage(forward, (screenWidth - 40) * 2, (screenHeight / 2 - 15) * 2, 60, 60)
         context.drawImage(back, 10 * 2 + 70, (screenHeight / 2 - 15) * 2, 60, 60)
         //编号和单价
@@ -51,10 +52,12 @@ export default class Details {
         context.font = "32px Arial"
         context.fillStyle = '#fff'
         context.fillText(text, 80 * 2, 25 * 2)
-        context.fillText('单价:', screenWidth, 25 * 2)
-        context.fillStyle = '#FFA500'
-        context.fillText('¥' + price, screenWidth + 90, 25 * 2)
-        wx.hideLoading()
+        if(price != ''){
+          context.fillText('单价:', screenWidth, 25 * 2)
+          context.fillStyle = '#FFA500'
+          context.fillText('¥' + price, screenWidth + 90, 25 * 2)
+        }  
+        wx.hideLoading()  
       }
     } else {
       //加载大图
@@ -67,26 +70,19 @@ export default class Details {
         context.font = "32px Arial"
         context.fillStyle = '#fff'
         context.fillText(text, 80 * 2, 25 * 2)
-        context.fillText('单价:',screenWidth,25*2)
-        context.fillStyle = '#FFA500'
-        context.fillText('¥'+price,screenWidth+90,25*2)
-
+        if(price != ''){
+          context.fillText('单价:', screenWidth, 25 * 2)
+          context.fillStyle = '#FFA500'
+          context.fillText('¥' + price, screenWidth + 90, 25 * 2)
+        }
         context.drawImage(img1, (screenWidth / 2 - 200) * 2, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
-
         context.drawImage(img2, (screenWidth / 2 - 100) * 2, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
-
         context.drawImage(img3, (screenWidth / 2) * 2, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
-
         context.drawImage(img4, (screenWidth / 2 + 100) * 2, (screenHeight - 35) * 2, 90 * 2, (90 / ratio) * 2)
-
-        context.drawImage(img5, 10 * 2, (screenHeight - 40) * 2, 40 * 2, 30 * 2)
-
+        context.drawImage(img5, 10 * 2, (screenHeight - 40) * 2, 30 * 2, 30 * 2)
         context.drawImage(forward, (screenWidth - 40) * 2, (screenHeight / 2 - 15) * 2, 60, 60)
-
-        context.drawImage(back, 10 * 2, (screenHeight / 2 - 15) * 2, 60, 60)
-        wx.hideLoading()
+        wx.hideLoading()  
       }
-
     }
   }
 }

+ 163 - 156
Album/js/main.js

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -58,20 +58,20 @@ let SLDbtnArea = []
 
 if (isiPhoneX) {
   //产品列表区域
-  var CA = [{ startX: 67 + 75, startY: 42, endX: 67 + imgX + 75, endY: 42 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42, endX: 87 + 75+ imgX + imgX + imgX, endY: 42 + 25 + imgY, status: false },
-    { startX: 67 + 75, startY: 42 + imgY + 25, endX: 67 + imgX + 75, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42 + imgY + 25, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42 + imgY + 25, endX: 87 + 75+ imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false },
-    { startX: 67 + 75, startY: 42 + imgY + 25 + imgY + 25, endX: 67 + 75 + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 87 + 75 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }]
+  var CA = [{ startX: 67 + 75, startY: 42, endX: 67 + imgX + 75, endY: 42 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42, endX: 87 + 75 + imgX + imgX + imgX, endY: 42 + 25 + imgY, status: false },
+  { startX: 67 + 75, startY: 42 + imgY + 25, endX: 67 + imgX + 75, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42 + imgY + 25, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42 + imgY + 25, endX: 87 + 75 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false },
+  { startX: 67 + 75, startY: 42 + imgY + 25 + imgY + 25, endX: 67 + 75 + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + 75 + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 77 + 75 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + 75 + imgX + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 87 + 75 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }]
   //详情界面按钮区域
-  var DA = [{ startX: 10 + 35, startY: screenHeight - 40, endX: 50 + 35, endY: screenHeight - 10 }, { startX: screenWidth / 2 - 200 + 35, startY: screenHeight - 35, endX: screenWidth / 2 - 110 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 - 100 + 35, startY: screenHeight - 35, endX: screenWidth / 2 - 10 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 35, startY: screenHeight - 35, endX: screenWidth / 2 + 90 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 100 + 35, startY: screenHeight - 35, endX: screenWidth / 2 + 190 + 35, endY: screenHeight - 12 }, { startX: 10 + 35, startY: screenHeight / 2 - 15, endX: 40 + 35, endY: screenHeight / 2 + 15 }, { startX: screenWidth - 40, startY: screenHeight / 2 - 15, endX: screenWidth - 10, endY: screenHeight / 2 + 15 }]
+  var DA = [{ startX: 35, startY: screenHeight - 50, endX: 50 + 35, endY: screenHeight }, { startX: screenWidth / 2 - 200 + 35, startY: screenHeight - 35, endX: screenWidth / 2 - 110 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 - 100 + 35, startY: screenHeight - 35, endX: screenWidth / 2 - 10 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 35, startY: screenHeight - 35, endX: screenWidth / 2 + 90 + 35, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 100 + 35, startY: screenHeight - 35, endX: screenWidth / 2 + 190 + 35, endY: screenHeight - 12 }, { startX: 10 + 35, startY: screenHeight / 2 - 15, endX: 40 + 35, endY: screenHeight / 2 + 15 }, { startX: screenWidth - 40, startY: screenHeight / 2 - 15, endX: screenWidth - 10, endY: screenHeight / 2 + 15 }]
   //新品上市,促销产品,风格
   var SA = [{ startX: 35, startY: 50, endX: 60, endY: 75, status: true }, { startX: 35, startY: 75, endX: 60, endY: 100, status: false }, { startX: 35, startY: 100, endX: 60, endY: 125, status: false }]
 } else {
   //产品列表区域
-  var CA = [{ startX: 67, startY: 42, endX: 67 + imgX, endY: 42 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42, endX: 77 + imgX + imgX, endY: 42 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42, endX: 87 + imgX + imgX + imgX, endY: 42+25+imgY, status: false },
-    { startX: 67, startY: 42 + imgY + 25, endX: 67 + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42 + imgY + 25, endX: 77 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42 + imgY + 25, endX: 87 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, 
-    { startX: 67, startY: 42 + imgY + 25 + imgY + 25, endX: 67 + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 77 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 87 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }]
+  var CA = [{ startX: 67, startY: 42, endX: 67 + imgX, endY: 42 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42, endX: 77 + imgX + imgX, endY: 42 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42, endX: 87 + imgX + imgX + imgX, endY: 42 + 25 + imgY, status: false },
+  { startX: 67, startY: 42 + imgY + 25, endX: 67 + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42 + imgY + 25, endX: 77 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42 + imgY + 25, endX: 87 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25, status: false },
+  { startX: 67, startY: 42 + imgY + 25 + imgY + 25, endX: 67 + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 77 + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 77 + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }, { startX: 87 + imgX + imgX, startY: 42 + imgY + 25 + imgY + 25, endX: 87 + imgX + imgX + imgX, endY: 42 + imgY + 25 + imgY + 25 + imgY + 25, status: false }]
   //详情界面按钮区域
-  var DA = [{ startX: 10, startY: screenHeight - 40, endX: 50, endY: screenHeight - 10 }, { startX: screenWidth / 2 - 200, startY: screenHeight - 35, endX: screenWidth / 2 - 110, endY: screenHeight - 12 }, { startX: screenWidth / 2 - 100, startY: screenHeight - 35, endX: screenWidth / 2 - 10, endY: screenHeight - 12 }, { startX: screenWidth / 2, startY: screenHeight - 35, endX: screenWidth / 2 + 90, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 100, startY: screenHeight - 35, endX: screenWidth / 2 + 190, endY: screenHeight - 12 }, { startX: 10, startY: screenHeight / 2 - 15, endX: 40, endY: screenHeight / 2 + 15 }, { startX: screenWidth - 40, startY: screenHeight / 2 - 15, endX: screenWidth - 10, endY: screenHeight / 2 + 15 }]
+  var DA = [{ startX: 0, startY: screenHeight - 50, endX: 50, endY: screenHeight }, { startX: screenWidth / 2 - 200, startY: screenHeight - 35, endX: screenWidth / 2 - 110, endY: screenHeight - 12 }, { startX: screenWidth / 2 - 100, startY: screenHeight - 35, endX: screenWidth / 2 - 10, endY: screenHeight - 12 }, { startX: screenWidth / 2, startY: screenHeight - 35, endX: screenWidth / 2 + 90, endY: screenHeight - 12 }, { startX: screenWidth / 2 + 100, startY: screenHeight - 35, endX: screenWidth / 2 + 190, endY: screenHeight - 12 }, { startX: 10, startY: screenHeight / 2 - 15, endX: 40, endY: screenHeight / 2 + 15 }, { startX: screenWidth - 40, startY: screenHeight / 2 - 15, endX: screenWidth - 10, endY: screenHeight / 2 + 15 }]
   //新品上市,促销产品,风格
   var SA = [{ startX: 0, startY: 50, endX: 25, endY: 75, status: true }, { startX: 0, startY: 75, endX: 25, endY: 100, status: false }, { startX: 0, startY: 100, endX: 25, endY: 125, status: false }]
 }
@@ -81,7 +81,7 @@ const DetailbtnArea = [...DA]
 const SLDArea = [...SA]
 
 //搜索按钮
-let SearchButton = [{ startX: 38, startY: 10, endX: 140, endY: 30 },{ startX: 150, startY: 10, endX: 200, endY: 30 }]
+let SearchButton = [{ startX: 38, startY: 10, endX: 140, endY: 30 }, { startX: 150, startY: 10, endX: 200, endY: 30 }]
 //翻页按钮
 const pageArea = [{ startX: screenWidth - 50, startY: screenHeight - 30, endX: screenWidth, endY: screenHeight }, { startX: screenWidth - 50, startY: screenHeight - 65, endX: screenWidth, endY: screenHeight - 35 }]
 //尺寸安装图片转换界面
@@ -100,6 +100,8 @@ let touchend = false
 let isAgent = false
 //是否到尺寸和安装图片转换界面
 let attrFlag = false
+//风格是否打开
+let styleOpen = true
 //定义当前页数
 let page = 0
 //手指开始点击的坐标,用于判断手势滑动的左右上下方向
@@ -148,7 +150,6 @@ function reStart() {
     }
     //绘制二级目录
     try {
-
       if (SLDArea[0].status == true) {
         context.fillStyle = '#f8f8f8'
         context.fillRect(SLDArea[0].startX * 2, SLDArea[0].startY * 2, 40 * 2, 25 * 2)
@@ -159,7 +160,7 @@ function reStart() {
         context.fillText('促销产品', SLDArea[1].startX * 2, (SLDArea[1].startY + 20) * 2)
         context.fillText('风格', SLDArea[2].startX * 2, (SLDArea[2].startY + 20) * 2)
       }
-      if (SLDArea[1].status == true){
+      if (SLDArea[1].status == true) {
         context.fillStyle = '#f8f8f8'
         context.fillRect(SLDArea[1].startX * 2, SLDArea[1].startY * 2, 40 * 2, 25 * 2)
         context.font = '20px Arial'
@@ -169,7 +170,7 @@ function reStart() {
         context.fillText('新品上市', SLDArea[0].startX * 2, (SLDArea[0].startY + 20) * 2)
         context.fillText('风格', SLDArea[2].startX * 2, (SLDArea[2].startY + 20) * 2)
       }
-      if (SLDArea[2].status == true){
+      if (SLDArea[2].status == true) {
         context.fillStyle = '#f8f8f8'
         context.fillRect(SLDArea[2].startX * 2, SLDArea[2].startY * 2, 40 * 2, 25 * 2)
         context.font = '20px Arial'
@@ -178,12 +179,29 @@ function reStart() {
         context.fillStyle = '#696969'
         context.fillText('新品上市', SLDArea[0].startX * 2, (SLDArea[0].startY + 20) * 2)
         context.fillText('促销产品', SLDArea[1].startX * 2, (SLDArea[1].startY + 20) * 2)
-        let dir2 = new SLD()
-        for (let i = 0; i < SLDbtnArea.length; i++) {
-          dir2.drawSLD(context, SLDbtnArea[i].status, i, SLDsource[i].name)
+      } else {
+        for (let i in SLDbtnArea) {
+          SLDbtnArea[i].status = false
+        }
+      }
+      if (styleOpen == true) {
+        let openImg = wx.createImage()
+        openImg.src = 'images/7.png'
+        openImg.onload = function () {
+          context.drawImage(openImg, SLDArea[2].startX * 2 + 25, SLDArea[2].startY * 2 - 5, 40 * 2, 40 * 2)
+          let dir2 = new SLD()
+          for (let i = 0; i < SLDbtnArea.length; i++) {
+            dir2.drawSLD(context, SLDbtnArea[i].status, i, SLDsource[i].name)
+          }
+        }
+      }
+      else {
+        let openImg = wx.createImage()
+        openImg.src = 'images/6.png'
+        openImg.onload = function () {
+          context.drawImage(openImg, SLDArea[2].startX * 2 + 25, SLDArea[2].startY * 2 - 5, 40 * 2, 40 * 2)
         }
       }
-      
     } catch (e) {
       console.log(e.message)
     }
@@ -227,8 +245,8 @@ function reStart() {
         } else {
           context.drawImage(img, 0, 0, screenWidth * 2, screenHeight * 2)
         }
-
       }
+
     } catch (e) {
       console.log(e.message)
       Detailstatus = false
@@ -281,23 +299,30 @@ wx.onTouchStart(((e) => {
         && x <= SLDbtnArea[btn].endX
         && y >= SLDbtnArea[btn].startY
         && y <= SLDbtnArea[btn].endY) {
-        for (let i in SLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
-          SLDbtnArea[i].status = false
-        }
-        for (let i in ContentbtnArea) {//发生页面切换时所有商品详情均为不活跃状态
-          ContentbtnArea[i].status = false
+        if (styleOpen == true) {
+          for (let i in SLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
+            SLDbtnArea[i].status = false
+          }
+          for (let i in ContentbtnArea) {//发生页面切换时所有商品详情均为不活跃状态
+            ContentbtnArea[i].status = false
+          }
+          SLDbtnArea[btn].status = true
+          status = 3
+          page = 0//发生页面切换时页数置0
+          flag2 = btn
+          SLDArea[0].status = false
+          SLDArea[1].status = false
+          SLDArea[2].status = true
+          //SLDbtnArea[btn].status = true
+          getSLDsource(callback2, FLDsource)//重绘
         }
-        page = 0//发生页面切换时页数置0
-        flag2 = btn
-        //SLDbtnArea[btn].status = true
-        getSLDsource(callback2, FLDsource)//重绘
       }
     }
     if (x >= SLDArea[0].startX
       && x <= SLDArea[0].endX
       && y >= SLDArea[0].startY
       && y <= SLDArea[0].endY) {
-        page = 0
+      page = 0
       flag2 = 0
       status = 2
       SLDArea[0].status = true
@@ -313,7 +338,7 @@ wx.onTouchStart(((e) => {
       && x <= SLDArea[1].endX
       && y >= SLDArea[1].startY
       && y <= SLDArea[1].endY) {
-        page = 0
+      page = 0
       flag2 = 0
       status = 1
       SLDArea[0].status = false
@@ -329,16 +354,20 @@ wx.onTouchStart(((e) => {
       && x <= SLDArea[2].endX
       && y >= SLDArea[2].startY
       && y <= SLDArea[2].endY) {
+      if (styleOpen == true) styleOpen = false
+      else styleOpen = true
+      if (styleOpen == true) {
         page = 0
-      flag2 = 0
-      status = 3
-      SLDArea[0].status = false
-      SLDArea[1].status = false
-      SLDArea[2].status = true
-      for (let i in SLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
-        SLDbtnArea[i].status = false
+        flag2 = 0
+        status = 3
+        SLDArea[0].status = false
+        SLDArea[1].status = false
+        SLDArea[2].status = true
+        for (let i in SLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
+          SLDbtnArea[i].status = false
+        }
+        SLDbtnArea[0].status = true
       }
-      SLDbtnArea[0].status = true
       getGoodsSource(callback3, SLDsource)
     }
     //翻页控制
@@ -373,74 +402,74 @@ wx.onTouchStart(((e) => {
     if (x >= SearchButton[0].startX
       && x <= SearchButton[0].endX
       && y >= SearchButton[0].startY
-      && y <= SearchButton[0].endY){
-        //清除目录控制状态 
-        SLDArea[0].status = false
-        SLDArea[1].status = false
-        SLDArea[2].status = false
-        for(let i in FLDbtnArea){
-          FLDbtnArea[i].status = false
-        }
-        GoodsSource = []
-        wx.showKeyboard({
-          defaultValue: '',
-          maxLength: 8,
-          multiple: false,
-          confirmHold: true,
-          confirmType: 'done',
-          success: function () {
-            wx.onKeyboardConfirm(((res) => {
-              KeyWord = res.value
-              context.fillStyle = '#fff'
-              context.fillRect(76,20,220,40)
-              context.font = "26px Arial"
-              context.fillStyle = '#696969'
-              context.fillText(KeyWord, 90, 50)
-              wx.hideKeyboard({})
-              wx.showToast({
-                title: '输入完成',
-                icon: 'success',
-                duration: 500
-              })
-            }))
-          }
-        })
-        reStart()
+      && y <= SearchButton[0].endY) {
+      //清除目录控制状态 
+      SLDArea[0].status = false
+      SLDArea[1].status = false
+      SLDArea[2].status = false
+      for (let i in FLDbtnArea) {
+        FLDbtnArea[i].status = false
       }
+      GoodsSource = []
+      wx.showKeyboard({
+        defaultValue: '',
+        maxLength: 8,
+        multiple: false,
+        confirmHold: true,
+        confirmType: 'done',
+        success: function () {
+          wx.onKeyboardConfirm(((res) => {
+            KeyWord = res.value
+            context.fillStyle = '#fff'
+            context.fillRect(76, 20, 220, 40)
+            context.font = "26px Arial"
+            context.fillStyle = '#696969'
+            context.fillText(KeyWord, 90, 50)
+            wx.hideKeyboard({})
+            wx.showToast({
+              title: '输入完成',
+              icon: 'success',
+              duration: 500
+            })
+          }))
+        }
+      })
+      reStart()
+    }
     if (x >= SearchButton[1].startX
       && x <= SearchButton[1].endX
       && y >= SearchButton[1].startY
-      && y <= SearchButton[1].endY){
-        if(KeyWord == ''){
-          //do nothing
-        }else[
-          wx.request({
-            url: 'https://t6.9026.com/api/album/search_goods',
-            data:{
-              store_id:1,
-              keywords:KeyWord
-            },
-            method:'GET',
-            success:function(res){
-              try {
-                let test = JSON.stringify(res.data)
-                let tet = JSON.parse(test)
-                GoodsSource.splice(0, GoodsSource.length)//每次调用重新填充数据的时候清空之前数据
-                for (let i in tet.data.goods) {
-                  GoodsSource.push(tet.data.goods[i])
-                }
-              } catch (e) {
-                wx.showToast({
-                  title: '请求异常',
-                  icon: 'none',
-                  duration: 800
-                })
+      && y <= SearchButton[1].endY) {
+      if (KeyWord == '') {
+        //do nothing
+      } else[
+        wx.request({
+          url: 'https://t6.9026.com/api/album/search_goods',
+          data: {
+            store_id: 1,
+            keywords: KeyWord
+          },
+          method: 'GET',
+          success: function (res) {
+            try {
+              let test = JSON.stringify(res.data)
+              let tet = JSON.parse(test)
+              GoodsSource.splice(0, GoodsSource.length)//每次调用重新填充数据的时候清空之前数据
+              for (let i in tet.data.goods) {
+                GoodsSource.push(tet.data.goods[i])
               }
-              callback3(GoodsSource)//导出商品列表
+            } catch (e) {
+              wx.showToast({
+                title: '请求异常',
+                icon: 'none',
+                duration: 800
+              })
             }
-          })
-        ]
-      }
+            callback3(GoodsSource)//导出商品列表
+          }
+        })
+      ]
+    }
     //内容点击进入详情控制
     for (let con in ContentbtnArea) {
       if (x >= ContentbtnArea[con].startX
@@ -477,7 +506,8 @@ wx.onTouchStart(((e) => {
         && y >= DetailbtnArea[1].startY
         && y <= DetailbtnArea[1].endY) {
         wx.shareAppMessage({
-          title: '经销商id:' + agent_id
+          //title: '经销商id:' + agent_id,
+          query: 'agent_id=' + agent_id
         })
       }
       //联系商家
@@ -525,11 +555,19 @@ wx.onTouchStart(((e) => {
           wx.setClipboardData({
             data: tel,
             success: function () {
-              wx.showToast({
-                title: '已复制到剪贴板',
-                icon: 'none',
-                duration: 800
-              })
+              if (tel == '') {
+                wx.showToast({
+                  title: '暂无商家联系电话',
+                  icon: 'none',
+                  duration: 800
+                })
+              } else {
+                wx.showToast({
+                  title: '电话' + tel + '已复制到剪贴板',
+                  icon: 'none',
+                  duration: 800
+                })
+              }
             }
           })
         }
@@ -579,10 +617,10 @@ wx.onTouchStart(((e) => {
           if (Buttonstatus == true) Buttonstatus = false
           else Buttonstatus = true
           let img = new wx.createImage()
-          img.src = GoodsDetail.detail_pic
+          img.src = GoodsDetail.detail
           img.onload = function () {
             let ratio = img.width / img.height
-            context.drawImage(img, 80, 60, (screenWidth - 80) * 2, (screenHeight - 80) * 2)
+            context.drawImage(img, screenWidth - (screenHeight - 80) * ratio, 60, (screenHeight - 80) * 2 * ratio, (screenHeight - 80) * 2)
           }
         }
       }
@@ -613,8 +651,7 @@ wx.onTouchStart(((e) => {
         && x <= DetailbtnArea[5].endX
         && y >= DetailbtnArea[5].startY
         && y <= DetailbtnArea[5].endY) {
-        if (Buttonstatus == true) Buttonstatus = false
-        else Buttonstatus = true
+        Buttonstatus = false
         if (flag3 <= 0) {
           wx.showToast({
             title: '已经是第一个了',
@@ -627,8 +664,6 @@ wx.onTouchStart(((e) => {
         if (flag3 > 0) {
           flag3 = flag3 - 1
           console.log('flag3:' + flag3)
-          if (Buttonstatus == true) Buttonstatus = false
-          else Buttonstatus = true
           getGoodsDetail(callback4, GoodsSource)
         }
       }
@@ -637,8 +672,7 @@ wx.onTouchStart(((e) => {
         && x <= DetailbtnArea[6].endX
         && y >= DetailbtnArea[6].startY
         && y <= DetailbtnArea[6].endY) {
-        if (Buttonstatus == true) Buttonstatus = false
-        else Buttonstatus = true
+        Buttonstatus = false
         if (flag3 == GoodsSource.length - 1) {
           wx.showToast({
             title: '已经是最后一个了',
@@ -649,8 +683,6 @@ wx.onTouchStart(((e) => {
         if (flag3 < GoodsSource.length - 1) {
           flag3 = flag3 + 1
           console.log('flag3:' + flag3)
-          if (Buttonstatus == true) Buttonstatus = false
-          else Buttonstatus = true
           getGoodsDetail(callback4, GoodsSource)
         }
       }
@@ -734,7 +766,8 @@ wx.onTouchEnd(((e) => {
   }
   if (Detailstatus == true) {//在详情界面,左右滑动,查看商品
     if (attrFlag == false) {
-      if (endX - startx > 0 || endY - starty > 0) {//向右滑动或向下
+      if (endX - startx > 0) {//向右滑动
+        Buttonstatus = false
         if (flag3 <= 0) {
           wx.showToast({
             title: '已经是第一个了',
@@ -747,26 +780,21 @@ wx.onTouchEnd(((e) => {
         if (flag3 > 0) {
           flag3 = flag3 - 1
           console.log('flag3:' + flag3)
-          if (Buttonstatus == true) Buttonstatus = false
-          else Buttonstatus = true
           getGoodsDetail(callback4, GoodsSource)
         }
       }
-      if (endX - startx < 0 || endY - starty < 0) {//向左滑动或者向上滑动
-        if (flag3 >= GoodsSource.length) {
+      if (endX - startx < 0) {//向左滑动
+        Buttonstatus = false
+        if (flag3 == GoodsSource.length - 1) {
           wx.showToast({
             title: '已经是最后一个了',
             icon: 'none',
             duration: 800
           })
-          flag3 = GoodsSource.length
-          reStart()
         }
-        if (flag3 < GoodsSource.length) {
+        if (flag3 < GoodsSource.length - 1) {
           flag3 = flag3 + 1
           console.log('flag3:' + flag3)
-          if (Buttonstatus == true) Buttonstatus = false
-          else Buttonstatus = true
           getGoodsDetail(callback4, GoodsSource)
         }
       }
@@ -918,7 +946,7 @@ function getGoodsSource(callback3, SLDsource) {
 
 }
 function callback3(res) {
-  console.log(GoodsSource)
+ // console.log(GoodsSource)
   reStart()
 }
 function getGoodsDetail(callback4, GoodsSource) {
@@ -929,7 +957,7 @@ function getGoodsDetail(callback4, GoodsSource) {
   } catch (e) {
     console.log(e.message)
     Detailstatus = false
-    reStart()
+    // reStart()
   }
   wx.request({
     url: ur,
@@ -938,6 +966,7 @@ function getGoodsDetail(callback4, GoodsSource) {
     method: 'GET',
     success: function (res) {
       try {
+        GoodsDetail = {}
         let test = JSON.stringify(res.data)
         let tet = JSON.parse(test)
         GoodsDetail = tet.data.goods
@@ -960,16 +989,13 @@ function callback4(res) {
     wx.showLoading({
       title: 'loading',
     })
-    console.log(GoodsDetail)
+    //console.log(GoodsDetail)
   }
   if (Detailstatus == true)//如果没获取到详情,说明所点击区域没有元素,不进行重绘
     reStart()
 }
+
 function UserLogin() {
-  wx.checkSession({
-    success: function () {
-    }
-  })
   wx.login({
     success: function (res) {
       let code = res.code
@@ -998,30 +1024,12 @@ function UserLogin() {
               }
               else {
                 isAgent = false
-                wx.showKeyboard({
-                  defaultValue: '删除本行,并输入经销商ID',
-                  maxLength: 13,
-                  multiple: false,
-                  confirmHold: true,
-                  confirmType: 'done',
-                  success: function () {
-                    wx.onKeyboardConfirm(((res) => {
-                     
-                      if (res.value == '' || res.value == '删除本行,并输入经销商ID')
-                      {
-                        agent_id = 0
-                      }else[
-                        agent_id = res.value
-                      ]
-                      wx.hideKeyboard({})
-                      wx.showToast({
-                        title: '输入完成',
-                        icon: 'success',
-                        duration: 500
-                      })
-                    }))
-                  }
-                })
+                var test = wx.getLaunchOptionsSync()
+                console.log(test)
+                agent_id = test.query.agent_id
+                if (agent_id == undefined)
+                  agent_id = 0
+                console.log(agent_id)
               }
             }
           })
@@ -1033,7 +1041,6 @@ function UserLogin() {
 function sleep(time) {
   return new Promise((resolve) => setTimeout(resolve, time));
 }
-
 /*
 主函数
 */

+ 1 - 1
Album/project.config.json

xqd
@@ -9,7 +9,7 @@
 	},
 	"compileType": "game",
 	"libVersion": "1.9.98",
-	"appid": "wxa60e27fe2e523515",
+	"appid": "wx605448628d21d682",
 	"projectname": "Album",
 	"isGameTourist": true,
 	"condition": {