|
| xqd
@@ -6,6 +6,7 @@ import Details, { DetailbtnArea } from './draw/details.js'
|
|
|
import setPrice from './draw/price.js'
|
|
|
|
|
|
import ContactModal from './draw/ContactModal.js'
|
|
|
+import ProductModal from './draw/ProductModal.js'
|
|
|
//import canvas from './libs/weapp-adapter.js'
|
|
|
|
|
|
var url = 'https://t6.9026.com/api/album/cat?parent_id=0&store_id=1'//初始顶级目录url
|
|
| xqd
@@ -18,44 +19,19 @@ var flag1 = 0//通过flag1来判断现在处于哪一个顶级目录,然后利
|
|
|
var flag2 = 0//通过flag1来判断现在处于哪一个二级目录,然后利用flag2传参数获取该顶级目录下的商品列表
|
|
|
var flag3 = 0//通过flag3来判断选择的是哪一个商品,然后获取它的的详情
|
|
|
var flag4 = 0//价格设置参考参数
|
|
|
-//获取手机屏幕大小信息
|
|
|
|
|
|
-var sw = 0
|
|
|
-var sh = 0
|
|
|
//是否为iPhoneX
|
|
|
-let isiPhoneX = false
|
|
|
-wx.getSystemInfo({
|
|
|
- success: function (res) {
|
|
|
- sw = res.screenWidth
|
|
|
- sh = res.screenHeight
|
|
|
- let mobileType = res.model
|
|
|
- if (mobileType == 'iPhone X') isiPhoneX = true
|
|
|
- else isiPhoneX = false
|
|
|
- }
|
|
|
-})
|
|
|
-console.log('iphonex:' + isiPhoneX)
|
|
|
-const screenWidth = sw
|
|
|
-const screenHeight = sh
|
|
|
+let isiPhoneX
|
|
|
//定义画布
|
|
|
//let canvas = wx.createCanvas()
|
|
|
-let drawRatio = GameGlobal.drawRatio = 2
|
|
|
-canvas.height = screenHeight * drawRatio
|
|
|
-canvas.width = screenWidth * drawRatio
|
|
|
-let context = canvas.getContext('2d')
|
|
|
+let context
|
|
|
|
|
|
//中间商品列表显示区绘制辅助变量
|
|
|
-var imgx = 0
|
|
|
-var imgy = 0
|
|
|
-if (isiPhoneX) {
|
|
|
- imgx = (screenWidth - 240 - 35) / 3
|
|
|
- imgy = (screenHeight - 118) / 3
|
|
|
-} else {
|
|
|
- imgx = (screenWidth - 180) / 3
|
|
|
- imgy = (screenHeight - 118) / 3
|
|
|
-}
|
|
|
-const imgX = imgx
|
|
|
-const imgY = imgy
|
|
|
-const imgyy = (screenHeight - 95) / 9
|
|
|
+let imgx = 0
|
|
|
+let imgy = 0
|
|
|
+let imgX = 0
|
|
|
+let imgY = 0
|
|
|
+let imgyy = 0
|
|
|
|
|
|
//定义按钮区域
|
|
|
//一级目录按钮区域
|
|
| xqd
@@ -63,41 +39,90 @@ let FLDbtnArea = []
|
|
|
//二级目录按钮区域
|
|
|
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 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 }, { startX: 35, startY: screenHeight - 60, endX: 75, endY: screenHeight - 30 }, { startX: 35, startY: screenHeight - 30, endX: 75, endY: screenHeight }]
|
|
|
-} 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 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 }, { startX: 0, startY: screenHeight - 60, endX: 40, endY: screenHeight - 30 }, { startX: 0, startY: screenHeight - 30, endX: 40, endY: screenHeight }]
|
|
|
-}
|
|
|
+let CA = []
|
|
|
+let DA = []
|
|
|
+let SA = []
|
|
|
|
|
|
-const ContentbtnArea = [...CA]
|
|
|
-const SLDArea = [...SA]
|
|
|
+let ContentbtnArea
|
|
|
+let SLDArea
|
|
|
|
|
|
//搜索按钮
|
|
|
-let SearchButton = [{ startX: 38, startY: 10, endX: 140, endY: 30 }, { startX: 150, startY: 10, endX: 200, endY: 30 }]
|
|
|
+let SearchButton = []
|
|
|
//翻页按钮
|
|
|
-const pageArea = [{ startX: screenWidth - 50, startY: screenHeight - 30, endX: screenWidth, endY: screenHeight }, { startX: screenWidth - 50, startY: screenHeight - 65, endX: screenWidth, endY: screenHeight - 35 }]
|
|
|
+let pageArea = []
|
|
|
//尺寸安装图片转换界面
|
|
|
-const attrArea = [{ startX: (screenWidth - (screenHeight - 100) * 1.778) / 2, startY: 30, endX: screenWidth / 2, endY: 60 }, { startX: screenWidth / 2, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, endY: 60 }, { startX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2, endY: 60 }]
|
|
|
+let attrArea = []
|
|
|
//setprice
|
|
|
|
|
|
-const setpriceArea = [{ startX: screenWidth - 100, startY: 50, endX: screenWidth - 50, endY: 50 + imgyy + 5 }, { startX: screenWidth - 100, startY: 50 + imgyy + 5, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 2 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 2, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 3 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 3, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 4 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 4, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 5 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 5, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 6 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 6, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 7 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 7, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 8 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 8, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 9 }]
|
|
|
+let setpriceArea = []
|
|
|
// setprice ok
|
|
|
|
|
|
-const sp = [{ startX: screenWidth / 2 - 150, startY: screenHeight / 2 - 80, endX: screenWidth / 2 + 150, endY: screenHeight / 2 }, { startX: screenWidth / 2 - 40, startY: screenHeight / 2 + 30, endX: screenWidth / 2 + 40, endY: screenHeight / 2 + 70 },]
|
|
|
+let sp = []
|
|
|
+
|
|
|
+GameGlobal.isiPhoneX = false
|
|
|
+let res = wx.getSystemInfoSync()
|
|
|
+function init() {
|
|
|
+ console.log('init')
|
|
|
+ let mobileType = res.model
|
|
|
+
|
|
|
+ let drawRatio = GameGlobal.drawRatio = 2
|
|
|
+ canvas.width = res.screenWidth * drawRatio
|
|
|
+ canvas.height = res.screenHeight * drawRatio
|
|
|
+
|
|
|
+ context = canvas.getContext('2d')
|
|
|
+
|
|
|
+ if (mobileType == 'iPhone X') {
|
|
|
+ GameGlobal.isiPhoneX = true
|
|
|
+ context.translate(70, 0)
|
|
|
+ GameGlobal.offsetX = 70
|
|
|
+ } else {
|
|
|
+ GameGlobal.isiPhoneX = false
|
|
|
+ GameGlobal.offsetX = 0
|
|
|
+ }
|
|
|
+ GameGlobal.screenWidth = res.screenWidth * 2 - 70
|
|
|
+ GameGlobal.screenHeight = res.screenHeight * 2
|
|
|
+ GameGlobal.font_size = 28
|
|
|
+ console.log('screenWidth: ' + screenWidth + ', screenHeight: ' + screenHeight)
|
|
|
+
|
|
|
+ context.fillStyle = '#fff'
|
|
|
+ context.fillRect(0, 0, screenWidth * 2, screenHeight * 2)
|
|
|
+
|
|
|
+ if (isiPhoneX) {
|
|
|
+ imgx = (screenWidth - 240 - 35) / 3
|
|
|
+ imgy = (screenHeight - 118) / 3
|
|
|
+ } else {
|
|
|
+ imgx = (screenWidth - 180) / 3
|
|
|
+ imgy = (screenHeight - 118) / 3
|
|
|
+ }
|
|
|
+
|
|
|
+ imgX = imgx
|
|
|
+ imgY = imgy
|
|
|
+ imgyy = (screenHeight - 95) / 9
|
|
|
+
|
|
|
+ //产品列表区域
|
|
|
+ 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: 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 }, { startX: 0, startY: screenHeight - 60, endX: 40, endY: screenHeight - 30 }, { startX: 0, startY: screenHeight - 30, endX: 40, endY: screenHeight }]
|
|
|
+ ContentbtnArea = [...CA]
|
|
|
+ SLDArea = [...SA]
|
|
|
+ //搜索按钮
|
|
|
+ SearchButton = [{ startX: 38, startY: 10, endX: 140, endY: 30 }, { startX: 150, startY: 10, endX: 200, endY: 30 }]
|
|
|
+ //翻页按钮
|
|
|
+ pageArea = [{ startX: screenWidth - 50, startY: screenHeight - 30, endX: screenWidth, endY: screenHeight }, { startX: screenWidth - 50, startY: screenHeight - 65, endX: screenWidth, endY: screenHeight - 35 }]
|
|
|
+ //尺寸安装图片转换界面
|
|
|
+ attrArea = [{ startX: (screenWidth - (screenHeight - 100) * 1.778) / 2, startY: 30, endX: screenWidth / 2, endY: 60 }, { startX: screenWidth / 2, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, endY: 60 }, { startX: (screenWidth + (screenHeight - 100) * 1.778) / 2 - 30, startY: 30, endX: (screenWidth + (screenHeight - 100) * 1.778) / 2, endY: 60 }]
|
|
|
+ //setprice
|
|
|
+
|
|
|
+ setpriceArea = [{ startX: screenWidth - 100, startY: 50, endX: screenWidth - 50, endY: 50 + imgyy + 5 }, { startX: screenWidth - 100, startY: 50 + imgyy + 5, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 2 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 2, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 3 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 3, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 4 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 4, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 5 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 5, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 6 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 6, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 7 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 7, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 8 }, { startX: screenWidth - 100, startY: 50 + (imgyy + 5) * 8, endX: screenWidth - 50, endY: 50 + (imgyy + 5) * 9 }]
|
|
|
+ // setprice ok
|
|
|
+
|
|
|
+ sp = [{ startX: screenWidth / 2 - 150, startY: screenHeight / 2 - 80, endX: screenWidth / 2 + 150, endY: screenHeight / 2 }, { startX: screenWidth / 2 - 40, startY: screenHeight / 2 + 30, endX: screenWidth / 2 + 40, endY: screenHeight / 2 + 70 },]
|
|
|
+}
|
|
|
+init()
|
|
|
|
|
|
//定义目录选中状态
|
|
|
let FLDstatus = false
|
|
| xqd
@@ -339,8 +364,8 @@ function reStart() {
|
|
|
wx.onTouchStart(((e) => {
|
|
|
try {
|
|
|
//e.preventDefault()
|
|
|
- var x = e.touches[0].clientX
|
|
|
- var y = e.touches[0].clientY
|
|
|
+ var x = e.touches[0].clientX * 2 - offsetX
|
|
|
+ var y = e.touches[0].clientY * 2
|
|
|
startx = x
|
|
|
starty = y
|
|
|
} catch (evt) {
|
|
| xqd
@@ -553,7 +578,7 @@ wx.onTouchStart(((e) => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- if(isAgent == true){
|
|
|
+ if (isAgent == true) {
|
|
|
if (x >= SLDArea[3].startX
|
|
|
&& x <= SLDArea[3].endX
|
|
|
&& y >= SLDArea[3].startY
|
|
| xqd
@@ -688,7 +713,7 @@ wx.onTouchStart(((e) => {
|
|
|
method: 'GET',
|
|
|
success: function () {
|
|
|
wx.showToast({
|
|
|
- title: GoodsSource[flag4].name+'价格已更新为'+pricein,
|
|
|
+ title: GoodsSource[flag4].name + '价格已更新为' + pricein,
|
|
|
icon: 'none',
|
|
|
duration: 1500
|
|
|
})
|
|
| xqd
@@ -744,7 +769,7 @@ wx.onTouchStart(((e) => {
|
|
|
method: 'GET',
|
|
|
success: function () {
|
|
|
wx.showToast({
|
|
|
- title: '联系电话已更新为'+mobilein,
|
|
|
+ title: '联系电话已更新为' + mobilein,
|
|
|
icon: 'none',
|
|
|
duration: 1500
|
|
|
})
|
|
| xqd
@@ -756,8 +781,6 @@ wx.onTouchStart(((e) => {
|
|
|
}
|
|
|
else {//在详情界面的时候
|
|
|
if (attrFlag == false) {
|
|
|
- x = x * 2 - GameGlobal.offsetX
|
|
|
- y = y * 2
|
|
|
// 点击返回按钮返回原来界面
|
|
|
if (x >= DetailbtnArea[0].startX
|
|
|
&& x <= DetailbtnArea[0].endX
|
|
| xqd
@@ -809,12 +832,13 @@ wx.onTouchStart(((e) => {
|
|
|
&& y <= DetailbtnArea[3].endY) {
|
|
|
if (Buttonstatus == true) Buttonstatus = false
|
|
|
else Buttonstatus = true
|
|
|
- let img = new wx.createImage()
|
|
|
- img.src = GoodsDetail.detail
|
|
|
- img.onload = function () {
|
|
|
- let ratio = img.width / img.height
|
|
|
- context.drawImage(img, screenWidth - (screenHeight - 80) * ratio, 60, (screenHeight - 80) * 2 * ratio, (screenHeight - 80) * 2)
|
|
|
- }
|
|
|
+ // let img = new wx.createImage()
|
|
|
+ // img.src = GoodsDetail.detail
|
|
|
+ // img.onload = function () {
|
|
|
+ // let ratio = img.width / img.height
|
|
|
+ // context.drawImage(img, screenWidth - (screenHeight - 80) * ratio, 60, (screenHeight - 80) * 2 * ratio, (screenHeight - 80) * 2)
|
|
|
+ // }
|
|
|
+ new ProductModal(context, GoodsDetail).draw()
|
|
|
}
|
|
|
//尺寸&安装
|
|
|
if (x >= DetailbtnArea[4].startX
|
|
| xqd
@@ -843,46 +867,46 @@ wx.onTouchStart(((e) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- // //上一张
|
|
|
- // if (x >= DetailbtnArea[5].startX
|
|
|
- // && x <= DetailbtnArea[5].endX
|
|
|
- // && y >= DetailbtnArea[5].startY
|
|
|
- // && y <= DetailbtnArea[5].endY) {
|
|
|
- // Buttonstatus = false
|
|
|
- // if (flag3 <= 0) {
|
|
|
- // wx.showToast({
|
|
|
- // title: '已经是第一个了',
|
|
|
- // icon: 'none',
|
|
|
- // duration: 800
|
|
|
- // })
|
|
|
- // flag3 = 0
|
|
|
- // reStart()
|
|
|
- // }
|
|
|
- // if (flag3 > 0) {
|
|
|
- // flag3 = flag3 - 1
|
|
|
- // console.log('flag3:' + flag3)
|
|
|
- // getGoodsDetail(callback4, GoodsSource)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // //下一张
|
|
|
- // if (x >= DetailbtnArea[6].startX
|
|
|
- // && x <= DetailbtnArea[6].endX
|
|
|
- // && y >= DetailbtnArea[6].startY
|
|
|
- // && y <= DetailbtnArea[6].endY) {
|
|
|
- // Buttonstatus = false
|
|
|
- // if (flag3 == GoodsSource.length - 1) {
|
|
|
- // wx.showToast({
|
|
|
- // title: '已经是最后一个了',
|
|
|
- // icon: 'none',
|
|
|
- // duration: 800
|
|
|
- // })
|
|
|
- // }
|
|
|
- // if (flag3 < GoodsSource.length - 1) {
|
|
|
- // flag3 = flag3 + 1
|
|
|
- // console.log('flag3:' + flag3)
|
|
|
- // getGoodsDetail(callback4, GoodsSource)
|
|
|
- // }
|
|
|
- // }
|
|
|
+ //上一张
|
|
|
+ if (x >= DetailbtnArea[5].startX
|
|
|
+ && x <= DetailbtnArea[5].endX
|
|
|
+ && y >= DetailbtnArea[5].startY
|
|
|
+ && y <= DetailbtnArea[5].endY) {
|
|
|
+ Buttonstatus = false
|
|
|
+ if (flag3 <= 0) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '已经是第一个了',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 800
|
|
|
+ })
|
|
|
+ flag3 = 0
|
|
|
+ reStart()
|
|
|
+ }
|
|
|
+ if (flag3 > 0) {
|
|
|
+ flag3 = flag3 - 1
|
|
|
+ console.log('flag3:' + flag3)
|
|
|
+ getGoodsDetail(callback4, GoodsSource)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //下一张
|
|
|
+ if (x >= DetailbtnArea[6].startX
|
|
|
+ && x <= DetailbtnArea[6].endX
|
|
|
+ && y >= DetailbtnArea[6].startY
|
|
|
+ && y <= DetailbtnArea[6].endY) {
|
|
|
+ Buttonstatus = false
|
|
|
+ if (flag3 == GoodsSource.length - 1) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '已经是最后一个了',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 800
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (flag3 < GoodsSource.length - 1) {
|
|
|
+ flag3 = flag3 + 1
|
|
|
+ console.log('flag3:' + flag3)
|
|
|
+ getGoodsDetail(callback4, GoodsSource)
|
|
|
+ }
|
|
|
+ }
|
|
|
//隐藏或显示按钮
|
|
|
if (x >= DetailbtnArea[5].endX
|
|
|
&& x <= DetailbtnArea[6].startX
|
|
| xqd
@@ -965,8 +989,8 @@ wx.onTouchStart(((e) => {
|
|
|
}))
|
|
|
//滑动响应函数
|
|
|
wx.onTouchEnd(((e) => {
|
|
|
- var endX = e.changedTouches[0].clientX
|
|
|
- var endY = e.changedTouches[0].clientY
|
|
|
+ var endX = e.changedTouches[0].clientX * 2 - 70
|
|
|
+ var endY = e.changedTouches[0].clientY * 2
|
|
|
if (Detailstatus == false) {
|
|
|
|
|
|
}
|
|
| xqd
@@ -1049,10 +1073,10 @@ function callback1(res) {
|
|
|
let s = false
|
|
|
if (i == flag1) s = true
|
|
|
let FLDobj = new Object()
|
|
|
- FLDobj.startX = screenWidth - 50
|
|
|
- FLDobj.startY = 50 * (i + 1)
|
|
|
+ FLDobj.startX = screenWidth - 100
|
|
|
+ FLDobj.startY = 100 * (i + 1)
|
|
|
FLDobj.endX = screenWidth
|
|
|
- FLDobj.endY = 50 * (i + 2)
|
|
|
+ FLDobj.endY = 100 * (i + 2)
|
|
|
FLDobj.status = s
|
|
|
FLDbtnArea.push(FLDobj)
|
|
|
}
|
|
| xqd
@@ -1098,18 +1122,10 @@ function callback2(res) {
|
|
|
let s = false
|
|
|
if (i == flag2) s = true
|
|
|
let SLDobj = new Object()
|
|
|
- if (isiPhoneX) {
|
|
|
- SLDobj.startX = 35
|
|
|
- } else {
|
|
|
SLDobj.startX = 0
|
|
|
- }
|
|
|
- SLDobj.startY = 25 * (i + 4) + 35
|
|
|
- if (isiPhoneX) {
|
|
|
- SLDobj.endX = 70
|
|
|
- } else {
|
|
|
+ SLDobj.startY = 50 * (i + 4) + 70
|
|
|
SLDobj.endX = 40
|
|
|
- }
|
|
|
- SLDobj.endY = 25 * (i + 5) + 35
|
|
|
+ SLDobj.endY = 50 * (i + 5) + 70
|
|
|
SLDobj.status = s
|
|
|
SLDbtnArea.push(SLDobj)
|
|
|
}
|
|
| xqd
@@ -1201,8 +1217,7 @@ function callback4(res) {
|
|
|
}
|
|
|
|
|
|
function UserLogin() {
|
|
|
- context.fillStyle = '#fff'
|
|
|
- context.fillRect(0,0,screenWidth*2,screenHeight*2)
|
|
|
+
|
|
|
wx.showLoading({
|
|
|
title: '正在登录',
|
|
|
})
|
|
| xqd
@@ -1251,24 +1266,6 @@ function UserLogin() {
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- GameGlobal.isiPhoneX = false
|
|
|
- wx.getSystemInfo({
|
|
|
- success: function (res) {
|
|
|
- let mobileType = res.model
|
|
|
- if (mobileType == 'iPhone X') {
|
|
|
- GameGlobal.isiPhoneX = true
|
|
|
- context.translate(70, 0)
|
|
|
- GameGlobal.offsetX = 70
|
|
|
- } else {
|
|
|
- GameGlobal.isiPhoneX = false
|
|
|
- GameGlobal.offsetX = 0
|
|
|
- }
|
|
|
- GameGlobal.screenWidth = res.screenWidth * 2 - 70
|
|
|
- GameGlobal.screenHeight = res.screenHeight * 2
|
|
|
- GameGlobal.font_size = 28
|
|
|
- console.log('screenWidth: ' + screenWidth + ', screenHeight: ' + screenHeight)
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
function sleep(time) {
|
|
|
return new Promise((resolve) => setTimeout(resolve, time));
|