Z1hgq 7 năm trước cách đây
mục cha
commit
a9ea413556

BIN
Album/.DS_Store


+ 7 - 0
Album/game.js

xqd
@@ -0,0 +1,7 @@
+import './js/libs/weapp-adapter'
+import './js/libs/symbol'
+
+import Main from './js/main.js'
+
+new Main()
+

+ 6 - 0
Album/game.json

xqd
@@ -0,0 +1,6 @@
+{
+         "deviceOrientation":"landscape",
+  "networkTimeout": {
+    "request": 5000
+  }
+}

BIN
Album/js/.DS_Store


BIN
Album/js/draw/.DS_Store


+ 72 - 0
Album/js/draw/FirstLevelDirectory.js

xqd
@@ -0,0 +1,72 @@
+/*
+绘制一级目录列表
+*/
+//获取手机屏幕大小信息
+const screenWidth  = window.innerWidth
+const screenHeight = window.innerHeight
+
+
+export default class FLD {
+  drawFLD(context, image, status, index, text) {
+    //console.log(index)
+    //当未被选中时
+    if (status == false) {
+      //根据是第几个一级目录画图标
+      image.onload = function () {
+        context.drawImage(image, screenWidth - 48, index * 50, 50, 35)
+      }
+      //把目录名字加上
+      //drawText(text, index)
+      context.fillStyle = '#000'
+      context.font = "1px Arial"
+      if (text.length == 2) {
+        context.fillText(text, screenWidth - 37, (index + 2) * 50 - 2)
+      }
+      if (text.length == 3) {
+        context.fillText(text, screenWidth - 43, (index + 2) * 50 - 2)
+      }
+      if (text.length == 4) {
+        context.fillText(text, screenWidth - 50, (index + 2) * 50 - 2)
+      }
+    }
+    else {
+      //将选项背景换成白色,左边界变成红色
+      context.fillStyle = '#fff'
+      context.fillRect(screenWidth - 48, index * 50+50, 50, 50)
+      context.fillStyle = 'red'
+      context.fillRect(screenWidth - 50, index * 50+50, 2, 50)
+      image.onload = function () {
+        context.drawImage(image, screenWidth - 48, index * 50, 50, 35)
+      }
+      //drawText(text, index)
+      context.fillStyle = '#000'
+      context.font = "1px Arial"
+      if (text.length == 2) {
+        context.fillText(text, screenWidth - 37, (index + 2) * 50 - 2)
+      }
+      if (text.length == 3) {
+        context.fillText(text, screenWidth - 43, (index + 2) * 50 - 2)
+      }
+      if (text.length == 4) {
+        context.fillText(text, screenWidth - 50, (index + 2) * 50 - 2)
+      }
+    }
+    index++
+    //console.log(index)
+  }
+  //目录名字长度不同情况下居中对齐,暂时考虑2,3,4个字
+  /* drawText(text, index) {
+     context.fillStyle = '#000'
+     context.font = "1px Arial"
+     if (text.length == 2) {
+       context.fillText(text, screenWidth - 37, (index + 1) * 50 - 2)
+     }
+     if (text.length == 3) {
+       context.fillText(text, screenWidth - 46, (index + 1) * 50 - 2)
+     }
+     if (text.length == 4) {
+       context.fillText(text, screenWidth - 50, (index + 1) * 50 - 2)
+     }
+   }*/
+
+}

+ 54 - 0
Album/js/draw/SecondLevelDirectory.js

xqd
@@ -0,0 +1,54 @@
+
+/*
+绘制二级目录列表
+*/
+//获取手机屏幕大小信息
+const screenWidth  = window.innerWidth
+const screenHeight = window.innerHeight
+
+
+//绘制子目录列表
+export default class SLD {
+  drawSLD(context, status, index, text) {
+    //未被选中时
+    if (status == false) {
+      //圆填充颜色与背景色相同
+      context.fillStyle = '#ddd'
+      context.beginPath()
+      context.arc(20, index * 40 + 20, 18, 0, 360, false)
+      context.fillStyle = '#f8f8f8'
+      context.fill()
+      context.strokeStyle = '#ddd'
+      context.stroke()
+      context.closePath()
+      //绘制文字,选中和未选中状态下文字颜色不一样
+      context.fillStyle = '#ddd'
+      context.font = "1px Arial"
+      //文字总是保持居中,只考虑了2个和3个字
+      if (text.length == 3) {
+        context.fillText(text, 2, index * 40 + 25)
+      }
+      if (text.length == 2) {
+        context.fillText(text, 8, index * 40 + 25)
+      }
+    }
+    else {//当被选中时,突出显示
+      context.fillStyle = '#ddd'
+      context.beginPath()
+      context.arc(20, index * 40 + 20, 18, 0, 360, false)
+      context.fillStyle = '#ff5541'
+      context.fill()
+      context.closePath()
+      //绘制文字,选中和未选中状态下文字颜色不一样
+      context.fillStyle = '#fff'
+      context.font = "1px Arial"
+      //文字总是保持居中,只考虑了2个和3个字
+      if (text.length == 3) {
+        context.fillText(text, 2, index * 40 + 25)
+      }
+      if (text.length == 2) {
+        context.fillText(text, 8, index * 40 + 25)
+      }
+    }
+  }
+}

+ 18 - 0
Album/js/draw/base.js

xqd
@@ -0,0 +1,18 @@
+//获取手机屏幕大小信息
+const screenWidth = window.innerWidth
+const screenHeight = window.innerHeight
+
+/*
+画两边的灰色选择栏和下一页按钮
+*/
+function  basePage(context) {
+    context.fillStyle = '#f8f8f8'
+    context.fillRect(0, 0, 40, screenHeight)
+    context.fillRect(screenWidth - 50, 0, 50, screenHeight)
+    context.fillStyle = '#ff5541'
+    context.fillRect(screenWidth - 50, screenHeight-30,50,30)
+    context.fillStyle = '#fff'
+    context.font = "13px Arial"
+    context.fillText('下一页', screenWidth - 46,screenHeight-9)
+  }
+export{basePage}

+ 75 - 0
Album/js/draw/content.js

xqd
@@ -0,0 +1,75 @@
+/*
+主体内容绘制
+*/
+
+//获取手机屏幕大小信息
+const screenWidth = window.innerWidth
+const screenHeight = window.innerHeight
+
+const imgX = (screenWidth - 130) / 3
+const imgY = (screenHeight - 78) / 3
+
+//每个页面放九个元素,每个元素依据它的下标来确定放置的位置
+export default class Content {
+  drawContent(context, image, index, text) {
+    context.fillStyle = '#000'
+    context.font = "1px Arial"
+    if (index % 9 == 0) {
+      //先绘制示例图
+      image.onload = function () {
+        context.drawImage(image, 40 + 10, 2, imgX, imgY)
+      }
+      //绘制描述文字
+      context.fillText(text, 40 + 10 + 15, imgY + 2 + 15)
+    }
+    if (index % 9 == 1) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10, 2, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + 15, imgY + 2 + 15)
+    }
+    if (index % 9 == 2) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10 + imgX + 10, 2, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + imgX + 10 + 15, imgY + 2 + 15)
+    }
+    if (index % 9 == 3) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10, 2 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15)
+    }
+    if (index % 9 == 4) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10, 2 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15)
+
+    }
+    if (index % 9 == 5) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10 + imgX + 10, 2 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + imgX + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15)
+    }
+    if (index % 9 == 6) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10, 2 + imgY + 15 + 10 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15 + imgY + 10 + 15)
+    }
+    if (index % 9 == 7) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10, 2 + imgY + 15 + 10 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15 + imgY + 10 + 15)
+    }
+    if (index % 9 == 8) {
+      image.onload = function () {
+        context.drawImage(image, 40 + 10 + imgX + 10 + imgX + 10, 2 + imgY + 15 + 10 + imgY + 15 + 10, imgX, imgY)
+      }
+      context.fillText(text, 40 + 10 + imgX + 10 + imgX + 10 + 15, imgY + 2 + 15 + imgY + 10 + 15 + imgY + 15 + 10)
+    }
+  }
+}

+ 61 - 0
Album/js/draw/details.js

xqd
@@ -0,0 +1,61 @@
+
+//获取手机屏幕大小信息
+const screenWidth = window.innerWidth
+const screenHeight = window.innerHeight
+
+
+export default class Details {
+  showDetails(context,image, text, price) {
+    //黑色背景
+    context.fillStyle = '#000'
+    context.fillRect(0, 0, screenWidth, screenHeight)
+
+
+    //功能栏
+    context.fillStyle = '#ddd'
+    context.beginPath()
+    context.arc(screenWidth - 20, 40 + 20, 18, 0, 360, false)
+    context.arc(screenWidth - 20, 40 + 20 + 40, 18, 0, 360, false)
+    context.arc(screenWidth - 20, 40 + 20 + 40 + 40, 18, 0, 360, false)
+    context.arc(screenWidth - 20, 40 + 20 + 40 + 40 + 40, 18, 0, 360, false)
+    context.arc(screenWidth - 20, screenHeight - 20, 18, 0, 360, false)
+    context.fillStyle = '#f8f8f8'
+    context.fill()
+    context.strokeStyle = '#ddd'
+    context.stroke()
+    context.closePath()
+
+    context.fillStyle = '#ddd'
+    context.beginPath()
+    context.arc(screenWidth - 60, screenHeight - 20, 18, 0, 360, false)
+    context.fillStyle = '#f8f8f8'
+    context.fill()
+    context.strokeStyle = '#ddd'
+    context.stroke()
+    context.closePath()
+
+    context.fillStyle = '#000'
+    context.font = "1px Arial"
+    context.fillText('返回', screenWidth - 33, 40 + 25)
+    context.fillText('分享', screenWidth - 33, 40 + 25 + 40)
+    context.fillText('名片', screenWidth - 33, 40 + 25 + 40 + 40)
+    context.fillText('电话', screenWidth - 33, 40 + 25 + 40 + 40 + 40)
+
+    context.fillText('尺寸', screenWidth - 33, screenHeight - 15)
+    context.fillText('详情', screenWidth - 33 - 40, screenHeight - 15)
+
+
+    //加载大图
+    image.onload = function () {
+      context.drawImage(image, 40, 40, screenWidth - 100, screenHeight - 80)
+    }
+
+
+    //编号和单价
+    context.fillStyle = '#fff'
+    context.fillText(text + ' 单价:', 10, screenHeight - 15)
+
+    context.fillStyle = 'red'
+    context.fillText('¥' + price, 175, screenHeight - 15)
+  }
+}

+ 17 - 0
Album/js/libs/symbol.js

xqd
@@ -0,0 +1,17 @@
+/**
+ * 对于ES6中Symbol的极简兼容
+ * 方便模拟私有变量
+ */
+
+let Symbol  = window.Symbol
+let idCounter = 0
+
+if (!Symbol) {
+  Symbol = function Symbol(key) {
+    return `__${key}_${Math.floor(Math.random() * 1e9)}_${++idCounter}__`
+  }
+
+  Symbol.iterator = Symbol('Symbol.iterator')
+}
+
+window.Symbol = Symbol

+ 1594 - 0
Album/js/libs/weapp-adapter.js

xqd
@@ -0,0 +1,1594 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ 	// The module cache
+/******/ 	var installedModules = {};
+
+/******/ 	// The require function
+/******/ 	function __webpack_require__(moduleId) {
+
+/******/ 		// Check if module is in cache
+/******/ 		if(installedModules[moduleId])
+/******/ 			return installedModules[moduleId].exports;
+
+/******/ 		// Create a new module (and put it into the cache)
+/******/ 		var module = installedModules[moduleId] = {
+/******/ 			exports: {},
+/******/ 			id: moduleId,
+/******/ 			loaded: false
+/******/ 		};
+
+/******/ 		// Execute the module function
+/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ 		// Flag the module as loaded
+/******/ 		module.loaded = true;
+
+/******/ 		// Return the exports of the module
+/******/ 		return module.exports;
+/******/ 	}
+
+
+/******/ 	// expose the modules object (__webpack_modules__)
+/******/ 	__webpack_require__.m = modules;
+
+/******/ 	// expose the module cache
+/******/ 	__webpack_require__.c = installedModules;
+
+/******/ 	// __webpack_public_path__
+/******/ 	__webpack_require__.p = "";
+
+/******/ 	// Load entry module and return exports
+/******/ 	return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var _window2 = __webpack_require__(1);
+
+	var _window = _interopRequireWildcard(_window2);
+
+	var _HTMLElement = __webpack_require__(5);
+
+	var _HTMLElement2 = _interopRequireDefault(_HTMLElement);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+	var global = GameGlobal;
+
+	function inject() {
+	  _window.addEventListener = function (type, listener) {
+	    _window.document.addEventListener(type, listener);
+	  };
+	  _window.removeEventListener = function (type, listener) {
+	    _window.document.removeEventListener(type, listener);
+	  };
+
+	  if (_window.canvas) {
+	    _window.canvas.addEventListener = _window.addEventListener;
+	    _window.canvas.removeEventListener = _window.removeEventListener;
+	  }
+
+	  var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
+	      platform = _wx$getSystemInfoSync.platform;
+
+	  // 开发者工具无法重定义 window
+
+
+	  if (platform === 'devtools') {
+	    for (var key in _window) {
+	      var descriptor = Object.getOwnPropertyDescriptor(global, key);
+
+	      if (!descriptor || descriptor.configurable === true) {
+	        Object.defineProperty(window, key, {
+	          value: _window[key]
+	        });
+	      }
+	    }
+
+	    for (var _key in _window.document) {
+	      var _descriptor = Object.getOwnPropertyDescriptor(global.document, _key);
+
+	      if (!_descriptor || _descriptor.configurable === true) {
+	        Object.defineProperty(global.document, _key, {
+	          value: _window.document[_key]
+	        });
+	      }
+	    }
+	    window.parent = window;
+	  } else {
+	    for (var _key2 in _window) {
+	      global[_key2] = _window[_key2];
+	    }
+	    global.window = _window;
+	    window = global;
+	    window.top = window.parent = window;
+	  }
+	}
+
+	if (!GameGlobal.__isAdapterInjected) {
+	  GameGlobal.__isAdapterInjected = true;
+	  inject();
+	}
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.clearInterval = exports.clearTimeout = exports.setInterval = exports.setTimeout = exports.canvas = exports.location = exports.localStorage = exports.HTMLElement = exports.FileReader = exports.Audio = exports.Image = exports.WebSocket = exports.XMLHttpRequest = exports.navigator = exports.document = undefined;
+
+	var _WindowProperties = __webpack_require__(2);
+
+	Object.keys(_WindowProperties).forEach(function (key) {
+	  if (key === "default" || key === "__esModule") return;
+	  Object.defineProperty(exports, key, {
+	    enumerable: true,
+	    get: function get() {
+	      return _WindowProperties[key];
+	    }
+	  });
+	});
+
+	var _constructor = __webpack_require__(4);
+
+	Object.keys(_constructor).forEach(function (key) {
+	  if (key === "default" || key === "__esModule") return;
+	  Object.defineProperty(exports, key, {
+	    enumerable: true,
+	    get: function get() {
+	      return _constructor[key];
+	    }
+	  });
+	});
+
+	var _Canvas = __webpack_require__(10);
+
+	var _Canvas2 = _interopRequireDefault(_Canvas);
+
+	var _document2 = __webpack_require__(11);
+
+	var _document3 = _interopRequireDefault(_document2);
+
+	var _navigator2 = __webpack_require__(18);
+
+	var _navigator3 = _interopRequireDefault(_navigator2);
+
+	var _XMLHttpRequest2 = __webpack_require__(19);
+
+	var _XMLHttpRequest3 = _interopRequireDefault(_XMLHttpRequest2);
+
+	var _WebSocket2 = __webpack_require__(20);
+
+	var _WebSocket3 = _interopRequireDefault(_WebSocket2);
+
+	var _Image2 = __webpack_require__(12);
+
+	var _Image3 = _interopRequireDefault(_Image2);
+
+	var _Audio2 = __webpack_require__(13);
+
+	var _Audio3 = _interopRequireDefault(_Audio2);
+
+	var _FileReader2 = __webpack_require__(21);
+
+	var _FileReader3 = _interopRequireDefault(_FileReader2);
+
+	var _HTMLElement2 = __webpack_require__(5);
+
+	var _HTMLElement3 = _interopRequireDefault(_HTMLElement2);
+
+	var _localStorage2 = __webpack_require__(22);
+
+	var _localStorage3 = _interopRequireDefault(_localStorage2);
+
+	var _location2 = __webpack_require__(23);
+
+	var _location3 = _interopRequireDefault(_location2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	exports.document = _document3.default;
+	exports.navigator = _navigator3.default;
+	exports.XMLHttpRequest = _XMLHttpRequest3.default;
+	exports.WebSocket = _WebSocket3.default;
+	exports.Image = _Image3.default;
+	exports.Audio = _Audio3.default;
+	exports.FileReader = _FileReader3.default;
+	exports.HTMLElement = _HTMLElement3.default;
+	exports.localStorage = _localStorage3.default;
+	exports.location = _location3.default;
+
+
+	// 暴露全局的 canvas
+	var canvas = new _Canvas2.default();
+
+	exports.canvas = canvas;
+	exports.setTimeout = setTimeout;
+	exports.setInterval = setInterval;
+	exports.clearTimeout = clearTimeout;
+	exports.clearInterval = clearInterval;
+	exports.requestAnimationFrame = requestAnimationFrame;
+	exports.cancelAnimationFrame = cancelAnimationFrame;
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.performance = exports.ontouchend = exports.ontouchmove = exports.ontouchstart = exports.screen = exports.devicePixelRatio = exports.innerHeight = exports.innerWidth = undefined;
+
+	var _performance2 = __webpack_require__(3);
+
+	var _performance3 = _interopRequireDefault(_performance2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
+	    screenWidth = _wx$getSystemInfoSync.screenWidth,
+	    screenHeight = _wx$getSystemInfoSync.screenHeight,
+	    devicePixelRatio = _wx$getSystemInfoSync.devicePixelRatio;
+
+	var innerWidth = exports.innerWidth = screenWidth;
+	var innerHeight = exports.innerHeight = screenHeight;
+	exports.devicePixelRatio = devicePixelRatio;
+	var screen = exports.screen = {
+	  availWidth: innerWidth,
+	  availHeight: innerHeight
+	};
+	var ontouchstart = exports.ontouchstart = null;
+	var ontouchmove = exports.ontouchmove = null;
+	var ontouchend = exports.ontouchend = null;
+
+	exports.performance = _performance3.default;
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	var performance = void 0;
+
+	if (wx.getPerformance) {
+	  var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
+	      platform = _wx$getSystemInfoSync.platform;
+
+	  var wxPerf = wx.getPerformance();
+	  var initTime = wxPerf.now();
+
+	  var clientPerfAdapter = Object.assign({}, wxPerf, {
+	    now: function now() {
+	      return (wxPerf.now() - initTime) / 1000;
+	    }
+	  });
+
+	  performance = platform === 'devtools' ? wxPerf : clientPerfAdapter;
+	}
+
+	exports.default = performance;
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.HTMLCanvasElement = exports.HTMLImageElement = undefined;
+
+	var _HTMLElement3 = __webpack_require__(5);
+
+	var _HTMLElement4 = _interopRequireDefault(_HTMLElement3);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var HTMLImageElement = exports.HTMLImageElement = function (_HTMLElement) {
+	  _inherits(HTMLImageElement, _HTMLElement);
+
+	  function HTMLImageElement() {
+	    _classCallCheck(this, HTMLImageElement);
+
+	    return _possibleConstructorReturn(this, (HTMLImageElement.__proto__ || Object.getPrototypeOf(HTMLImageElement)).call(this, 'img'));
+	  }
+
+	  return HTMLImageElement;
+	}(_HTMLElement4.default);
+
+	var HTMLCanvasElement = exports.HTMLCanvasElement = function (_HTMLElement2) {
+	  _inherits(HTMLCanvasElement, _HTMLElement2);
+
+	  function HTMLCanvasElement() {
+	    _classCallCheck(this, HTMLCanvasElement);
+
+	    return _possibleConstructorReturn(this, (HTMLCanvasElement.__proto__ || Object.getPrototypeOf(HTMLCanvasElement)).call(this, 'canvas'));
+	  }
+
+	  return HTMLCanvasElement;
+	}(_HTMLElement4.default);
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	var _Element2 = __webpack_require__(6);
+
+	var _Element3 = _interopRequireDefault(_Element2);
+
+	var _util = __webpack_require__(9);
+
+	var _WindowProperties = __webpack_require__(2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var HTMLElement = function (_Element) {
+	  _inherits(HTMLElement, _Element);
+
+	  function HTMLElement() {
+	    var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+
+	    _classCallCheck(this, HTMLElement);
+
+	    var _this = _possibleConstructorReturn(this, (HTMLElement.__proto__ || Object.getPrototypeOf(HTMLElement)).call(this));
+
+	    _this.className = '';
+	    _this.childern = [];
+	    _this.style = {
+	      width: _WindowProperties.innerWidth + 'px',
+	      height: _WindowProperties.innerHeight + 'px'
+	    };
+	    _this.insertBefore = _util.noop;
+	    _this.innerHTML = '';
+
+	    _this.tagName = tagName.toUpperCase();
+	    return _this;
+	  }
+
+	  _createClass(HTMLElement, [{
+	    key: 'setAttribute',
+	    value: function setAttribute(name, value) {
+	      this[name] = value;
+	    }
+	  }, {
+	    key: 'getAttribute',
+	    value: function getAttribute(name) {
+	      return this[name];
+	    }
+	  }, {
+	    key: 'getBoundingClientRect',
+	    value: function getBoundingClientRect() {
+	      return {
+	        top: 0,
+	        left: 0,
+	        width: _WindowProperties.innerWidth,
+	        height: _WindowProperties.innerHeight
+	      };
+	    }
+	  }, {
+	    key: 'focus',
+	    value: function focus() {}
+	  }, {
+	    key: 'clientWidth',
+	    get: function get() {
+	      var ret = parseInt(this.style.fontSize, 10) * this.innerHTML.length;
+
+	      return Number.isNaN(ret) ? 0 : ret;
+	    }
+	  }, {
+	    key: 'clientHeight',
+	    get: function get() {
+	      var ret = parseInt(this.style.fontSize, 10);
+
+	      return Number.isNaN(ret) ? 0 : ret;
+	    }
+	  }]);
+
+	  return HTMLElement;
+	}(_Element3.default);
+
+	exports.default = HTMLElement;
+
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _Node2 = __webpack_require__(7);
+
+	var _Node3 = _interopRequireDefault(_Node2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var ELement = function (_Node) {
+	  _inherits(ELement, _Node);
+
+	  function ELement() {
+	    _classCallCheck(this, ELement);
+
+	    var _this = _possibleConstructorReturn(this, (ELement.__proto__ || Object.getPrototypeOf(ELement)).call(this));
+
+	    _this.className = '';
+	    _this.children = [];
+	    return _this;
+	  }
+
+	  return ELement;
+	}(_Node3.default);
+
+	exports.default = ELement;
+
+/***/ }),
+/* 7 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	var _EventTarget2 = __webpack_require__(8);
+
+	var _EventTarget3 = _interopRequireDefault(_EventTarget2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var Node = function (_EventTarget) {
+	  _inherits(Node, _EventTarget);
+
+	  function Node() {
+	    _classCallCheck(this, Node);
+
+	    var _this = _possibleConstructorReturn(this, (Node.__proto__ || Object.getPrototypeOf(Node)).call(this));
+
+	    _this.childNodes = [];
+	    return _this;
+	  }
+
+	  _createClass(Node, [{
+	    key: 'appendChild',
+	    value: function appendChild(node) {
+	      if (node instanceof Node) {
+	        this.childNodes.push(node);
+	      } else {
+	        throw new TypeError('Failed to executed \'appendChild\' on \'Node\': parameter 1 is not of type \'Node\'.');
+	      }
+	    }
+	  }, {
+	    key: 'cloneNode',
+	    value: function cloneNode() {
+	      var copyNode = Object.create(this);
+
+	      Object.assign(copyNode, this);
+	      return copyNode;
+	    }
+	  }, {
+	    key: 'removeChild',
+	    value: function removeChild(node) {
+	      var index = this.childNodes.findIndex(function (child) {
+	        return child === node;
+	      });
+
+	      if (index > -1) {
+	        return this.childNodes.splice(index, 1);
+	      }
+	      return null;
+	    }
+	  }]);
+
+	  return Node;
+	}(_EventTarget3.default);
+
+	exports.default = Node;
+
+/***/ }),
+/* 8 */
+/***/ (function(module, exports) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	var _events = new WeakMap();
+
+	var EventTarget = function () {
+	  function EventTarget() {
+	    _classCallCheck(this, EventTarget);
+
+	    _events.set(this, {});
+	  }
+
+	  _createClass(EventTarget, [{
+	    key: 'addEventListener',
+	    value: function addEventListener(type, listener) {
+	      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
+
+	      var events = _events.get(this);
+
+	      if (!events) {
+	        events = {};
+	        _events.set(this, events);
+	      }
+	      if (!events[type]) {
+	        events[type] = [];
+	      }
+	      events[type].push(listener);
+
+	      if (options.capture) {
+	        console.warn('EventTarget.addEventListener: options.capture is not implemented.');
+	      }
+	      if (options.once) {
+	        console.warn('EventTarget.addEventListener: options.once is not implemented.');
+	      }
+	      if (options.passive) {
+	        console.warn('EventTarget.addEventListener: options.passive is not implemented.');
+	      }
+	    }
+	  }, {
+	    key: 'removeEventListener',
+	    value: function removeEventListener(type, listener) {
+	      var listeners = _events.get(this)[type];
+
+	      if (listeners && listeners.length > 0) {
+	        for (var i = listeners.length; i--; i > 0) {
+	          if (listeners[i] === listener) {
+	            listeners.splice(i, 1);
+	            break;
+	          }
+	        }
+	      }
+	    }
+	  }, {
+	    key: 'dispatchEvent',
+	    value: function dispatchEvent() {
+	      var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+
+	      var listeners = _events.get(this)[event.type];
+
+	      if (listeners) {
+	        for (var i = 0; i < listeners.length; i++) {
+	          listeners[i](event);
+	        }
+	      }
+	    }
+	  }]);
+
+	  return EventTarget;
+	}();
+
+	exports.default = EventTarget;
+
+/***/ }),
+/* 9 */
+/***/ (function(module, exports) {
+
+	"use strict";
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.noop = noop;
+	function noop() {}
+
+/***/ }),
+/* 10 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.default = Canvas;
+
+	var _constructor = __webpack_require__(4);
+
+	var _HTMLElement = __webpack_require__(5);
+
+	var _HTMLElement2 = _interopRequireDefault(_HTMLElement);
+
+	var _document = __webpack_require__(11);
+
+	var _document2 = _interopRequireDefault(_document);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	var hasModifiedCanvasPrototype = false;
+	var hasInit2DContextConstructor = false;
+	var hasInitWebGLContextConstructor = false;
+
+	function Canvas() {
+	  var canvas = wx.createCanvas();
+
+	  canvas.type = 'canvas';
+
+	  canvas.__proto__.__proto__ = new _HTMLElement2.default('canvas');
+
+	  var _getContext = canvas.getContext;
+
+	  canvas.getBoundingClientRect = function () {
+	    var ret = {
+	      top: 0,
+	      left: 0,
+	      width: window.innerWidth,
+	      height: window.innerHeight
+	    };
+	    return ret;
+	  };
+
+	  return canvas;
+	}
+
+/***/ }),
+/* 11 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _window = __webpack_require__(1);
+
+	var window = _interopRequireWildcard(_window);
+
+	var _HTMLElement = __webpack_require__(5);
+
+	var _HTMLElement2 = _interopRequireDefault(_HTMLElement);
+
+	var _Image = __webpack_require__(12);
+
+	var _Image2 = _interopRequireDefault(_Image);
+
+	var _Audio = __webpack_require__(13);
+
+	var _Audio2 = _interopRequireDefault(_Audio);
+
+	var _Canvas = __webpack_require__(10);
+
+	var _Canvas2 = _interopRequireDefault(_Canvas);
+
+	__webpack_require__(16);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+	var events = {};
+
+	var document = {
+	  readyState: 'complete',
+	  visibilityState: 'visible',
+	  documentElement: window,
+	  hidden: false,
+	  style: {},
+	  location: window.location,
+	  ontouchstart: null,
+	  ontouchmove: null,
+	  ontouchend: null,
+
+	  head: new _HTMLElement2.default('head'),
+	  body: new _HTMLElement2.default('body'),
+
+	  createElement: function createElement(tagName) {
+	    if (tagName === 'canvas') {
+	      return new _Canvas2.default();
+	    } else if (tagName === 'audio') {
+	      return new _Audio2.default();
+	    } else if (tagName === 'img') {
+	      return new _Image2.default();
+	    }
+
+	    return new _HTMLElement2.default(tagName);
+	  },
+	  getElementById: function getElementById(id) {
+	    if (id === window.canvas.id) {
+	      return window.canvas;
+	    }
+	    return null;
+	  },
+	  getElementsByTagName: function getElementsByTagName(tagName) {
+	    if (tagName === 'head') {
+	      return [document.head];
+	    } else if (tagName === 'body') {
+	      return [document.body];
+	    } else if (tagName === 'canvas') {
+	      return [window.canvas];
+	    }
+	    return [];
+	  },
+	  getElementsByName: function getElementsByName(tagName) {
+	    if (tagName === 'head') {
+	      return [document.head];
+	    } else if (tagName === 'body') {
+	      return [document.body];
+	    } else if (tagName === 'canvas') {
+	      return [window.canvas];
+	    }
+	    return [];
+	  },
+	  querySelector: function querySelector(query) {
+	    if (query === 'head') {
+	      return document.head;
+	    } else if (query === 'body') {
+	      return document.body;
+	    } else if (query === 'canvas') {
+	      return window.canvas;
+	    } else if (query === '#' + window.canvas.id) {
+	      return window.canvas;
+	    }
+	    return null;
+	  },
+	  querySelectorAll: function querySelectorAll(query) {
+	    if (query === 'head') {
+	      return [document.head];
+	    } else if (query === 'body') {
+	      return [document.body];
+	    } else if (query === 'canvas') {
+	      return [window.canvas];
+	    }
+	    return [];
+	  },
+	  addEventListener: function addEventListener(type, listener) {
+	    if (!events[type]) {
+	      events[type] = [];
+	    }
+	    events[type].push(listener);
+	  },
+	  removeEventListener: function removeEventListener(type, listener) {
+	    var listeners = events[type];
+
+	    if (listeners && listeners.length > 0) {
+	      for (var i = listeners.length; i--; i > 0) {
+	        if (listeners[i] === listener) {
+	          listeners.splice(i, 1);
+	          break;
+	        }
+	      }
+	    }
+	  },
+	  dispatchEvent: function dispatchEvent(event) {
+	    var listeners = events[event.type];
+
+	    if (listeners) {
+	      for (var i = 0; i < listeners.length; i++) {
+	        listeners[i](event);
+	      }
+	    }
+	  }
+	};
+
+	exports.default = document;
+
+/***/ }),
+/* 12 */
+/***/ (function(module, exports) {
+
+	"use strict";
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	exports.default = Image;
+	function Image() {
+	  var image = wx.createImage();
+
+	  return image;
+	}
+
+/***/ }),
+/* 13 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	var _HTMLAudioElement2 = __webpack_require__(14);
+
+	var _HTMLAudioElement3 = _interopRequireDefault(_HTMLAudioElement2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var HAVE_NOTHING = 0;
+	var HAVE_METADATA = 1;
+	var HAVE_CURRENT_DATA = 2;
+	var HAVE_FUTURE_DATA = 3;
+	var HAVE_ENOUGH_DATA = 4;
+
+	var _innerAudioContext = new WeakMap();
+	var _src = new WeakMap();
+	var _loop = new WeakMap();
+	var _autoplay = new WeakMap();
+
+	var Audio = function (_HTMLAudioElement) {
+	  _inherits(Audio, _HTMLAudioElement);
+
+	  function Audio(url) {
+	    _classCallCheck(this, Audio);
+
+	    var _this = _possibleConstructorReturn(this, (Audio.__proto__ || Object.getPrototypeOf(Audio)).call(this));
+
+	    _this.HAVE_NOTHING = HAVE_NOTHING;
+	    _this.HAVE_METADATA = HAVE_METADATA;
+	    _this.HAVE_CURRENT_DATA = HAVE_CURRENT_DATA;
+	    _this.HAVE_FUTURE_DATA = HAVE_FUTURE_DATA;
+	    _this.HAVE_ENOUGH_DATA = HAVE_ENOUGH_DATA;
+	    _this.readyState = HAVE_NOTHING;
+
+
+	    _src.set(_this, '');
+
+	    var innerAudioContext = wx.createInnerAudioContext();
+
+	    _innerAudioContext.set(_this, innerAudioContext);
+
+	    innerAudioContext.onCanplay(function () {
+	      _this.dispatchEvent({ type: 'load' });
+	      _this.dispatchEvent({ type: 'loadend' });
+	      _this.dispatchEvent({ type: 'canplay' });
+	      _this.dispatchEvent({ type: 'canplaythrough' });
+	      _this.dispatchEvent({ type: 'loadedmetadata' });
+	      _this.readyState = HAVE_CURRENT_DATA;
+	    });
+	    innerAudioContext.onPlay(function () {
+	      _this.dispatchEvent({ type: 'play' });
+	    });
+	    innerAudioContext.onPause(function () {
+	      _this.dispatchEvent({ type: 'pause' });
+	    });
+	    innerAudioContext.onEnded(function () {
+	      _this.dispatchEvent({ type: 'ended' });
+	      _this.readyState = HAVE_ENOUGH_DATA;
+	    });
+	    innerAudioContext.onError(function () {
+	      _this.dispatchEvent({ type: 'error' });
+	    });
+
+	    if (url) {
+	      _innerAudioContext.get(_this).src = url;
+	    }
+	    return _this;
+	  }
+
+	  _createClass(Audio, [{
+	    key: 'load',
+	    value: function load() {
+	      console.warn('HTMLAudioElement.load() is not implemented.');
+	    }
+	  }, {
+	    key: 'play',
+	    value: function play() {
+	      _innerAudioContext.get(this).play();
+	    }
+	  }, {
+	    key: 'pause',
+	    value: function pause() {
+	      _innerAudioContext.get(this).pause();
+	    }
+	  }, {
+	    key: 'canPlayType',
+	    value: function canPlayType() {
+	      var mediaType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+
+	      if (typeof mediaType !== 'string') {
+	        return '';
+	      }
+
+	      if (mediaType.indexOf('audio/mpeg') > -1 || mediaType.indexOf('audio/mp4')) {
+	        return 'probably';
+	      }
+	      return '';
+	    }
+	  }, {
+	    key: 'cloneNode',
+	    value: function cloneNode() {
+	      var newAudio = new Audio();
+	      newAudio.loop = _innerAudioContext.get(this).loop;
+	      newAudio.autoplay = _innerAudioContext.get(this).autoplay;
+	      newAudio.src = this.src;
+	      return newAudio;
+	    }
+	  }, {
+	    key: 'currentTime',
+	    get: function get() {
+	      return _innerAudioContext.get(this).currentTime;
+	    },
+	    set: function set(value) {
+	      _innerAudioContext.get(this).seek(value);
+	    }
+	  }, {
+	    key: 'src',
+	    get: function get() {
+	      return _src.get(this);
+	    },
+	    set: function set(value) {
+	      _src.set(this, value);
+	      _innerAudioContext.get(this).src = value;
+	    }
+	  }, {
+	    key: 'loop',
+	    get: function get() {
+	      return _innerAudioContext.get(this).loop;
+	    },
+	    set: function set(value) {
+	      _innerAudioContext.get(this).loop = value;
+	    }
+	  }, {
+	    key: 'autoplay',
+	    get: function get() {
+	      return _innerAudioContext.get(this).autoplay;
+	    },
+	    set: function set(value) {
+	      _innerAudioContext.get(this).autoplay = value;
+	    }
+	  }, {
+	    key: 'paused',
+	    get: function get() {
+	      return _innerAudioContext.get(this).paused;
+	    }
+	  }]);
+
+	  return Audio;
+	}(_HTMLAudioElement3.default);
+
+	exports.default = Audio;
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _HTMLMediaElement2 = __webpack_require__(15);
+
+	var _HTMLMediaElement3 = _interopRequireDefault(_HTMLMediaElement2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var HTMLAudioElement = function (_HTMLMediaElement) {
+	  _inherits(HTMLAudioElement, _HTMLMediaElement);
+
+	  function HTMLAudioElement() {
+	    _classCallCheck(this, HTMLAudioElement);
+
+	    return _possibleConstructorReturn(this, (HTMLAudioElement.__proto__ || Object.getPrototypeOf(HTMLAudioElement)).call(this, 'audio'));
+	  }
+
+	  return HTMLAudioElement;
+	}(_HTMLMediaElement3.default);
+
+	exports.default = HTMLAudioElement;
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	var _HTMLElement2 = __webpack_require__(5);
+
+	var _HTMLElement3 = _interopRequireDefault(_HTMLElement2);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+	function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+	var HTMLMediaElement = function (_HTMLElement) {
+	  _inherits(HTMLMediaElement, _HTMLElement);
+
+	  function HTMLMediaElement(type) {
+	    _classCallCheck(this, HTMLMediaElement);
+
+	    return _possibleConstructorReturn(this, (HTMLMediaElement.__proto__ || Object.getPrototypeOf(HTMLMediaElement)).call(this, type));
+	  }
+
+	  _createClass(HTMLMediaElement, [{
+	    key: 'addTextTrack',
+	    value: function addTextTrack() {}
+	  }, {
+	    key: 'captureStream',
+	    value: function captureStream() {}
+	  }, {
+	    key: 'fastSeek',
+	    value: function fastSeek() {}
+	  }, {
+	    key: 'load',
+	    value: function load() {}
+	  }, {
+	    key: 'pause',
+	    value: function pause() {}
+	  }, {
+	    key: 'play',
+	    value: function play() {}
+	  }]);
+
+	  return HTMLMediaElement;
+	}(_HTMLElement3.default);
+
+	exports.default = HTMLMediaElement;
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	__webpack_require__(17);
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	var _window = __webpack_require__(1);
+
+	var window = _interopRequireWildcard(_window);
+
+	var _document = __webpack_require__(11);
+
+	var _document2 = _interopRequireDefault(_document);
+
+	var _util = __webpack_require__(9);
+
+	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+	function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	var TouchEvent = function TouchEvent(type) {
+	  _classCallCheck(this, TouchEvent);
+
+	  this.target = window.canvas;
+	  this.currentTarget = window.canvas;
+	  this.touches = [];
+	  this.targetTouches = [];
+	  this.changedTouches = [];
+	  this.preventDefault = _util.noop;
+	  this.stopPropagation = _util.noop;
+
+	  this.type = type;
+	};
+
+	function touchEventHandlerFactory(type) {
+	  return function (event) {
+	    var touchEvent = new TouchEvent(type);
+
+	    touchEvent.touches = event.touches;
+	    touchEvent.targetTouches = Array.prototype.slice.call(event.touches);
+	    touchEvent.changedTouches = event.changedTouches;
+	    touchEvent.timeStamp = event.timeStamp;
+	    _document2.default.dispatchEvent(touchEvent);
+	  };
+	}
+
+	wx.onTouchStart(touchEventHandlerFactory('touchstart'));
+	wx.onTouchMove(touchEventHandlerFactory('touchmove'));
+	wx.onTouchEnd(touchEventHandlerFactory('touchend'));
+	wx.onTouchCancel(touchEventHandlerFactory('touchcancel'));
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __webpack_require__) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _util = __webpack_require__(9);
+
+	// TODO 需要 wx.getSystemInfo 获取更详细信息
+	var _wx$getSystemInfoSync = wx.getSystemInfoSync(),
+	    platform = _wx$getSystemInfoSync.platform;
+
+	var navigator = {
+	  platform: platform,
+	  language: 'zh-cn',
+	  appVersion: '5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
+	  userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/zh_CN',
+	  onLine: true, // TODO 用 wx.getNetworkStateChange 和 wx.onNetworkStateChange 来返回真实的状态
+
+	  // TODO 用 wx.getLocation 来封装 geolocation
+	  geolocation: {
+	    getCurrentPosition: _util.noop,
+	    watchPosition: _util.noop,
+	    clearWatch: _util.noop
+	  }
+	};
+
+	exports.default = navigator;
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	var _url = new WeakMap();
+	var _method = new WeakMap();
+	var _requestHeader = new WeakMap();
+	var _responseHeader = new WeakMap();
+	var _requestTask = new WeakMap();
+
+	function _triggerEvent(type) {
+	  if (typeof this['on' + type] === 'function') {
+	    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+	      args[_key - 1] = arguments[_key];
+	    }
+
+	    this['on' + type].apply(this, args);
+	  }
+	}
+
+	function _changeReadyState(readyState) {
+	  this.readyState = readyState;
+	  _triggerEvent.call(this, 'readystatechange');
+	}
+
+	var XMLHttpRequest = function () {
+	  // TODO 没法模拟 HEADERS_RECEIVED 和 LOADING 两个状态
+	  function XMLHttpRequest() {
+	    _classCallCheck(this, XMLHttpRequest);
+
+	    this.onabort = null;
+	    this.onerror = null;
+	    this.onload = null;
+	    this.onloadstart = null;
+	    this.onprogress = null;
+	    this.ontimeout = null;
+	    this.onloadend = null;
+	    this.onreadystatechange = null;
+	    this.readyState = 0;
+	    this.response = null;
+	    this.responseText = null;
+	    this.responseType = '';
+	    this.responseXML = null;
+	    this.status = 0;
+	    this.statusText = '';
+	    this.upload = {};
+	    this.withCredentials = false;
+
+	    _requestHeader.set(this, {
+	      'content-type': 'application/x-www-form-urlencoded'
+	    });
+	    _responseHeader.set(this, {});
+	  }
+
+	  /*
+	   * TODO 这一批事件应该是在 XMLHttpRequestEventTarget.prototype 上面的
+	   */
+
+
+	  _createClass(XMLHttpRequest, [{
+	    key: 'abort',
+	    value: function abort() {
+	      var myRequestTask = _requestTask.get(this);
+
+	      if (myRequestTask) {
+	        myRequestTask.abort();
+	      }
+	    }
+	  }, {
+	    key: 'getAllResponseHeaders',
+	    value: function getAllResponseHeaders() {
+	      var responseHeader = _responseHeader.get(this);
+
+	      return Object.keys(responseHeader).map(function (header) {
+	        return header + ': ' + responseHeader[header];
+	      }).join('\n');
+	    }
+	  }, {
+	    key: 'getResponseHeader',
+	    value: function getResponseHeader(header) {
+	      return _responseHeader.get(this)[header];
+	    }
+	  }, {
+	    key: 'open',
+	    value: function open(method, url /* async, user, password 这几个参数在小程序内不支持*/) {
+	      _method.set(this, method);
+	      _url.set(this, url);
+	      _changeReadyState.call(this, XMLHttpRequest.OPENED);
+	    }
+	  }, {
+	    key: 'overrideMimeType',
+	    value: function overrideMimeType() {}
+	  }, {
+	    key: 'send',
+	    value: function send() {
+	      var _this = this;
+
+	      var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+
+	      if (this.readyState !== XMLHttpRequest.OPENED) {
+	        throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");
+	      } else {
+	        wx.request({
+	          data: data,
+	          url: _url.get(this),
+	          method: _method.get(this),
+	          header: _requestHeader.get(this),
+	          responseType: this.responseType,
+	          success: function success(_ref) {
+	            var data = _ref.data,
+	                statusCode = _ref.statusCode,
+	                header = _ref.header;
+
+	            if (typeof data !== 'string' && !(data instanceof ArrayBuffer)) {
+	              try {
+	                data = JSON.stringify(data);
+	              } catch (e) {
+	                data = data;
+	              }
+	            }
+
+	            _this.status = statusCode;
+	            _responseHeader.set(_this, header);
+	            _triggerEvent.call(_this, 'loadstart');
+	            _changeReadyState.call(_this, XMLHttpRequest.HEADERS_RECEIVED);
+	            _changeReadyState.call(_this, XMLHttpRequest.LOADING);
+
+	            _this.response = data;
+
+	            if (data instanceof ArrayBuffer) {
+	              _this.responseText = '';
+	              var bytes = new Uint8Array(data);
+	              var len = bytes.byteLength;
+
+	              for (var i = 0; i < len; i++) {
+	                _this.responseText += String.fromCharCode(bytes[i]);
+	              }
+	            } else {
+	              _this.responseText = data;
+	            }
+	            _changeReadyState.call(_this, XMLHttpRequest.DONE);
+	            _triggerEvent.call(_this, 'load');
+	            _triggerEvent.call(_this, 'loadend');
+	          },
+	          fail: function fail(_ref2) {
+	            var errMsg = _ref2.errMsg;
+
+	            // TODO 规范错误
+	            if (errMsg.indexOf('abort') !== -1) {
+	              _triggerEvent.call(_this, 'abort');
+	            } else {
+	              _triggerEvent.call(_this, 'error', errMsg);
+	            }
+	            _triggerEvent.call(_this, 'loadend');
+	          }
+	        });
+	      }
+	    }
+	  }, {
+	    key: 'setRequestHeader',
+	    value: function setRequestHeader(header, value) {
+	      var myHeader = _requestHeader.get(this);
+
+	      myHeader[header] = value;
+	      _requestHeader.set(this, myHeader);
+	    }
+	  }]);
+
+	  return XMLHttpRequest;
+	}();
+
+	XMLHttpRequest.UNSEND = 0;
+	XMLHttpRequest.OPENED = 1;
+	XMLHttpRequest.HEADERS_RECEIVED = 2;
+	XMLHttpRequest.LOADING = 3;
+	XMLHttpRequest.DONE = 4;
+	exports.default = XMLHttpRequest;
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	var _socketTask = new WeakMap();
+
+	var WebSocket = function () {
+	  // TODO 更新 binaryType
+	  // The connection is in the process of closing.
+	  // The connection is not yet open.
+	  function WebSocket(url) {
+	    var _this = this;
+
+	    var protocols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
+
+	    _classCallCheck(this, WebSocket);
+
+	    this.binaryType = '';
+	    this.bufferedAmount = 0;
+	    this.extensions = '';
+	    this.onclose = null;
+	    this.onerror = null;
+	    this.onmessage = null;
+	    this.onopen = null;
+	    this.protocol = '';
+	    this.readyState = 3;
+
+	    if (typeof url !== 'string' || !/(^ws:\/\/)|(^wss:\/\/)/.test(url)) {
+	      throw new TypeError('Failed to construct \'WebSocket\': The URL \'' + url + '\' is invalid');
+	    }
+
+	    this.url = url;
+	    this.readyState = WebSocket.CONNECTING;
+
+	    var socketTask = wx.connectSocket({
+	      url: url,
+	      protocols: Array.isArray(protocols) ? protocols : [protocols]
+	    });
+
+	    _socketTask.set(this, socketTask);
+
+	    socketTask.onClose(function (res) {
+	      _this.readyState = WebSocket.CLOSED;
+	      if (typeof _this.onclose === 'function') {
+	        _this.onclose(res);
+	      }
+	    });
+
+	    socketTask.onMessage(function (res) {
+	      if (typeof _this.onmessage === 'function') {
+	        _this.onmessage(res);
+	      }
+	    });
+
+	    socketTask.onOpen(function () {
+	      _this.readyState = WebSocket.OPEN;
+	      if (typeof _this.onopen === 'function') {
+	        _this.onopen();
+	      }
+	    });
+
+	    socketTask.onError(function (res) {
+	      if (typeof _this.onerror === 'function') {
+	        _this.onerror(new Error(res.errMsg));
+	      }
+	    });
+
+	    return this;
+	  } // TODO 小程序内目前获取不到,实际上需要根据服务器选择的 sub-protocol 返回
+	  // TODO 更新 bufferedAmount
+	  // The connection is closed or couldn't be opened.
+
+	  // The connection is open and ready to communicate.
+
+
+	  _createClass(WebSocket, [{
+	    key: 'close',
+	    value: function close(code, reason) {
+	      this.readyState = WebSocket.CLOSING;
+	      var socketTask = _socketTask.get(this);
+
+	      socketTask.close({
+	        code: code,
+	        reason: reason
+	      });
+	    }
+	  }, {
+	    key: 'send',
+	    value: function send(data) {
+	      if (typeof data !== 'string' && !(data instanceof ArrayBuffer)) {
+	        throw new TypeError('Failed to send message: The data ' + data + ' is invalid');
+	      }
+
+	      var socketTask = _socketTask.get(this);
+
+	      socketTask.send({
+	        data: data
+	      });
+	    }
+	  }]);
+
+	  return WebSocket;
+	}();
+
+	WebSocket.CONNECTING = 0;
+	WebSocket.OPEN = 1;
+	WebSocket.CLOSING = 2;
+	WebSocket.CLOSED = 3;
+	exports.default = WebSocket;
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports) {
+
+	"use strict";
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+
+	var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+	/*
+	 * TODO 使用 wx.readFile 来封装 FileReader
+	 */
+	var FileReader = function () {
+	  function FileReader() {
+	    _classCallCheck(this, FileReader);
+	  }
+
+	  _createClass(FileReader, [{
+	    key: "construct",
+	    value: function construct() {}
+	  }]);
+
+	  return FileReader;
+	}();
+
+	exports.default = FileReader;
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports) {
+
+	"use strict";
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	var localStorage = {
+	  get length() {
+	    var _wx$getStorageInfoSyn = wx.getStorageInfoSync(),
+	        keys = _wx$getStorageInfoSyn.keys;
+
+	    return keys.length;
+	  },
+
+	  key: function key(n) {
+	    var _wx$getStorageInfoSyn2 = wx.getStorageInfoSync(),
+	        keys = _wx$getStorageInfoSyn2.keys;
+
+	    return keys[n];
+	  },
+	  getItem: function getItem(key) {
+	    return wx.getStorageSync(key);
+	  },
+	  setItem: function setItem(key, value) {
+	    return wx.setStorageSync(key, value);
+	  },
+	  removeItem: function removeItem(key) {
+	    wx.removeStorageSync(key);
+	  },
+	  clear: function clear() {
+	    wx.clearStorageSync();
+	  }
+	};
+
+	exports.default = localStorage;
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports) {
+
+	'use strict';
+
+	Object.defineProperty(exports, "__esModule", {
+	  value: true
+	});
+	var location = {
+	  href: 'game.js',
+	  reload: function reload() {}
+	};
+
+	exports.default = location;
+
+/***/ })
+/******/ ]);

+ 378 - 0
Album/js/main.js

xqd
@@ -0,0 +1,378 @@
+import { basePage } from './draw/base.js'
+import FLD from './draw/FirstLevelDirectory.js'
+import SLD from './draw/SecondLevelDirectory.js'
+import Content from './draw/content.js'
+import Details from './draw/details.js'
+
+//import canvas from './libs/weapp-adapter.js'
+
+var url = 'http://t6.9026.com/api/album/cat?parent_id=0&store_id=0'//初始顶级目录url
+var FLDsource = []//顶级目录对象列表
+var SLDsource = []//二级目录对象列表
+var GoodsSource = []//商品对象列表
+var GoodsDetail//商品详情
+var flag1 = 0//通过flag1来判断现在处于哪一个顶级目录,然后利用flag1传参数获取该顶级目录下的二级目录信息
+var flag2 = 0//通过flag1来判断现在处于哪一个二级目录,然后利用flag2传参数获取该顶级目录下的商品列表
+var flag3 = 0//通过flag3来判断选择的是哪一个商品,然后获取它的的详情
+
+//定义画布
+//let canvas = wx.createCanvas()
+let context = canvas.getContext('2d')
+//获取手机屏幕大小信息
+const screenWidth = window.innerWidth
+const screenHeight = window.innerHeight
+//中间商品列表显示区绘制辅助变量
+const imgX = (screenWidth - 90) / 3
+const imgY = screenHeight / 3
+
+//定义按钮区域
+//一级目录按钮区域
+let FLDbtnArea = []
+//二级目录按钮区域
+let SLDbtnArea = []
+//产品列表区域
+const ContentbtnArea = [{ startX: 40, startY: 0, endX: 40 + imgX, endY: imgY, status: false }, { startX: 40 + imgX, startY: 0, endX: 40 + imgX + imgX, endY: imgY, status: false }, { startX: 40 + imgX + imgX, startY: 0, endX: screenWidth - 50, endY: imgY, status: false },
+{ startX: 40, startY: imgY, endX: 40 + imgX, endY: imgY + imgY, status: false }, { startX: 40 + imgX, startY: imgY, endX: 40 + imgX + imgX, endY: imgY + imgY, status: false }, { startX: 40 + imgX + imgX, startY: imgY, endX: screenWidth - 50, endY: imgY + imgY, status: false }, { startX: 40, startY: imgY + imgY, endX: 40 + imgX, endY: screenHeight, status: false }, { startX: 40 + imgX, startY: imgY + imgY, endX: 40 + imgX + imgX, endY: screenHeight, status: false }, { startX: 40 + imgX + imgX, startY: imgY + imgY, endX: screenWidth - 50, endY: screenHeight, status: false }]
+//详情界面按钮区域
+const DetailbtnArea = [{ startX: screenWidth - 40, startY: 40, endX: screenWidth, endY: 80 }, { startX: screenWidth - 40, startY: 80, endX: screenWidth, endY: 120 }, { startX: screenWidth - 40, startY: 120, endX: screenWidth, endY: 160 }, { startX: screenWidth - 40, startY: 160, endX: screenWidth, endY: 200 }, { startX: screenWidth - 40, startY: screenHeight - 40, endX: screenWidth, endY: screenHeight }, { startX: screenWidth - 80, startY: screenHeight - 40, endX: screenWidth - 40, endY: screenHeight }]
+//测试按钮
+let testbtnArea = { startX: 0, startY: 40, endX: 40, endX: 80 }
+//翻页按钮
+const pageArea = { startX: screenWidth - 50, startY: screenHeight - 30, endX: screenWidth, endY: screenHeight }
+//定义目录选中状态
+let FLDstatus = false
+let SLDstatus = false
+//定义是否在详情界面状态
+let Detailstatus = false
+//定义当前页数
+let page = 0
+
+
+//绘制函数
+function reStart() {
+  console.log('reStartSuccess')//调用成功输出'reStartSuccess'
+  reset()//清空之前屏幕上的绘制内容,减少缓存占用,及信息重叠
+  //添加触摸响应事件
+  canvas.addEventListener(
+    'touchstart',
+    touchEventHandler
+  )
+  if (Detailstatus == false) {
+    //绘制两个侧边栏
+    basePage(context)
+    //绘制一级目录
+    let dir1 = new FLD()
+    for (let i = 0; i < FLDsource.length; i++) {
+      let img = wx.createImage()
+      img.src = FLDsource[i].pic_url
+      dir1.drawFLD(context, img, FLDbtnArea[i].status, i, FLDsource[i].name)
+    }
+    //绘制二级目录
+    let dir2 = new SLD()
+    for (let i = 0; i < SLDbtnArea.length; i++) {
+      dir2.drawSLD(context, SLDbtnArea[i].status, i, SLDsource[i].name)
+    }
+    //绘制内容
+    let dir3 = new Content()
+    if (GoodsSource.length < 10) {//当商品列表小于10的时候,无需翻页,直接绘制
+
+      for (let i = 0; i < GoodsSource.length; i++) {
+        let img = wx.createImage()
+        img.src = GoodsSource[i].cover_pic
+        dir3.drawContent(context, img, i, GoodsSource[i].name)
+      }
+    }
+    else {//当商品列表大于9的时候,需要翻页,通过变量page来控制绘制
+      for (let j = page * 9; j < (page + 1) * 9; j++) {
+        let img = wx.createImage()
+        img.src = GoodsSource[j].cover_pic
+        dir3.drawContent(context, img, j % 9, GoodsSource[j].name)
+      }
+      // if (page > (GoodsSource.length - 1) % 9) break //如果页数大于实际页数的话,停止绘制,避免出现获取不到资源而报错
+    }
+  } else {//绘制详细内容
+    let dt = new Details()
+    console.log('进入详情')
+
+    let img = wx.createImage()
+    img.src = GoodsDetail.attr
+    dt.showDetails(context, img, GoodsDetail.name, GoodsDetail.price)
+  }
+
+}
+//触摸响应函数
+function touchEventHandler(e) {
+  try {
+    e.preventDefault()
+    var x = e.touches[0].clientX
+    var y = e.touches[0].clientY
+  } catch (evt) {
+    console.log(evt.message)
+  }
+  if (Detailstatus == false) {//当不在详情界面时
+    //一级目录控制
+    for (let btn in FLDbtnArea) {
+      if (x >= FLDbtnArea[btn].startX
+        && x <= FLDbtnArea[btn].endX
+        && y >= FLDbtnArea[btn].startY
+        && y <= FLDbtnArea[btn].endY) {
+        for (let i in FLDbtnArea) {//点击该按钮的时候,它变为活跃状态status=true,而其他所有按钮变为非活跃状态status=false
+          FLDbtnArea[i].status = false
+        }
+        for (let i in ContentbtnArea) {//发生页面切换时所有商品详情均为不活跃状态
+          ContentbtnArea[i].status = false
+        }
+        page = 0//发生页面切换时页数置0
+        flag1 = btn
+        flag2 = 0//发生一级目录切换时,二级目录选中第一个
+        //FLDbtnArea[btn].status = true
+        getFLDsource(callback1, url)//重绘
+      }
+    }
+    //二级目录控制
+    for (let btn in SLDbtnArea) {
+      if (x >= SLDbtnArea[btn].startX
+        && 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
+        }
+        page = 0//发生页面切换时页数置0
+        flag2 = btn
+        //SLDbtnArea[btn].status = true
+        getSLDsource(callback2, FLDsource)//重绘
+      }
+    }
+    //翻页控制
+    if (x >= pageArea.startX
+      && x <= pageArea.endX
+      && y >= pageArea.startY
+      && y <= pageArea.endY) {
+      if (page < (GoodsSource.length - 1) % 9 + 1)//只有在当前页数小于实际页数的时候才能再往上+
+        page++//点击翻页时页数+1
+      console.log(page)
+      //getFLDsource(callback1, url)//重绘
+      reStart()
+    }
+    //内容点击进入详情控制
+    for (let con in ContentbtnArea) {
+      if (x >= ContentbtnArea[con].startX
+        && x <= ContentbtnArea[con].endX
+        && y >= ContentbtnArea[con].startY
+        && y <= ContentbtnArea[con].endY) {
+        Detailstatus = true
+        for (let x in ContentbtnArea) {
+          ContentbtnArea[x].status = false
+        }
+        ContentbtnArea[con].status = true//用于判断是否进入详情
+        con = parseInt(con)
+        flag3 = (page * 9) + con
+        getGoodsDetail(callback4, GoodsSource)
+        //reStart() //重绘
+      }
+    }
+
+  }
+  else {//在详情界面的时候
+    //  点击返回按钮返回原来界面
+    if (x >= DetailbtnArea[0].startX
+      && x <= DetailbtnArea[0].endX
+      && y >= DetailbtnArea[0].startY
+      && y <= DetailbtnArea[0].endY) {
+      Detailstatus = false
+      reStart() //重绘
+    }
+    if (x >= DetailbtnArea[1].startX
+      && x <= DetailbtnArea[1].endX
+      && y >= DetailbtnArea[1].startY
+      && y <= DetailbtnArea[1].endY) {
+
+    }
+    if (x >= DetailbtnArea[2].startX
+      && x <= DetailbtnArea[2].endX
+      && y >= DetailbtnArea[2].startY
+      && y <= DetailbtnArea[2].endY) {
+
+    }
+    if (x >= DetailbtnArea[3].startX
+      && x <= DetailbtnArea[3].endX
+      && y >= DetailbtnArea[3].startY
+      && y <= DetailbtnArea[3].endY) {
+      let tel = '10086'
+      makePhoneCall(tel)
+
+    }
+    if (x >= DetailbtnArea[4].startX
+      && x <= DetailbtnArea[4].endX
+      && y >= DetailbtnArea[4].startY
+      && y <= DetailbtnArea[4].endY) {
+
+    }
+    if (x >= DetailbtnArea[5].startX
+      && x <= DetailbtnArea[5].endX
+      && y >= DetailbtnArea[5].startY
+      && y <= DetailbtnArea[5].endY) {
+
+    }
+  }
+
+}
+//清除之前绘制内容
+function reset() {
+  context.clearRect(0, 0, screenWidth, screenHeight)
+}
+//获取顶级目录列表
+function getFLDsource(callback1, url) {
+  wx.request({
+    url: url,  //这里''里面填写你的服务器API接口的路径    
+    data: {
+    },  //这里是可以填写服务器需要的参数    
+    method: 'GET', // 声明GET请求    
+    // header: {}, // 设置请求的 header,GET请求可以不填    
+    success: function (res) {
+      if (res.statusCode == 200) {
+        let test = JSON.stringify(res.data)
+        let tet = JSON.parse(test)
+        FLDsource.splice(0, FLDsource.length)
+        for (let i in tet.data.cats) {
+          FLDsource.push(tet.data.cats[i])
+        }
+        callback1(FLDsource)//导出顶级目录列表
+      }
+      console.log(res.statusCode)
+    }
+  });
+}
+//在回调函数中通过顶级目录个数获得它的按钮区域
+function callback1(res) {
+  FLDbtnArea.splice(0, FLDbtnArea.length)//每次调用重新填充数据的时候清空之前数据
+  for (let i = 0; i < res.length; i++) {//通过顶级目录个数获得它的按钮区域
+    let s = false
+    if (i == flag1) s = true
+    let FLDobj = new Object()
+    FLDobj.startX = screenWidth - 50
+    FLDobj.startY = 50 * (i + 1)
+    FLDobj.endX = screenWidth
+    FLDobj.endY = 50 * (i + 2)
+    FLDobj.status = s
+    FLDbtnArea.push(FLDobj)
+  }
+  //console.log(FLDbtnArea)
+  //console.log(FLDsource)
+  getSLDsource(callback2, FLDsource)//获取二级目录信息
+}
+//根据获取第一个请求函数得到的顶级目录信息来获取二级目录信息
+function getSLDsource(callback2, FLDsource) {
+  //  通过flag1来判断现在处于哪一个顶级目录,然后利用flag1传参数获取该顶级目录下的二级目录信息
+  let u = 'http://t6.9026.com/api/album/cat' + '?store_id=0&parent_id=' + FLDsource[flag1].id
+  console.log(u)
+  wx.request({
+    url: u,
+    data: {
+    },
+    method: 'GET',
+    success: function (res) {
+      if (res.statusCode == 200) {
+        let test = JSON.stringify(res.data)
+        let tet = JSON.parse(test)
+        SLDsource.splice(0, SLDsource.length)//每次调用重新填充数据的时候清空之前数据
+        for (let i in tet.data.cats) {
+          SLDsource.push(tet.data.cats[i])
+        }
+        callback2(SLDsource)//导出二级目录列表
+      }
+      console.log(res.statusCode)
+    }
+  })
+}
+//通过二级目录列表的长度来得到它的按钮区域列表
+function callback2(res) {
+  SLDbtnArea.splice(0, SLDbtnArea.length)//每次调用重新填充数据的时候清空之前数据
+  for (let i = 0; i < res.length; i++) {
+    let s = false
+    if (i == flag2) s = true
+    let SLDobj = new Object()
+    SLDobj.startX = 0
+    SLDobj.startY = 40 * i
+    SLDobj.endX = 40
+    SLDobj.endY = 40 * (i + 1)
+    SLDobj.status = s
+    SLDbtnArea.push(SLDobj)
+  }
+  //console.log(SLDsource)
+  //console.log(SLDbtnArea)
+  getGoodsSource(callback3, SLDsource)
+}
+function getGoodsSource(callback3, SLDsource) {
+  let u = 'http://t6.9026.com/api/album/goods' + '?store_id=0&cat_id=' + SLDsource[flag2].id
+  console.log(u)
+  wx.request({
+    url: u,
+    data: {
+    },
+    method: 'GET',
+    success: function (res) {
+      if (res.statusCode == 200) {
+        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)//导出商品列表
+      }
+
+      console.log(res.statusCode)
+    }
+  })
+}
+function callback3(res) {
+  reStart()
+  console.log(GoodsSource)
+}
+function getGoodsDetail(callback4, GoodsSource) {
+  console.log(flag3)
+  console.log(GoodsSource[flag3].id)
+  let u = 'http://t6.9026.com/api/album/goods-detail?store_id=0&agent_id=10&goods_id=' + GoodsSource[flag3].id
+  console.log(u)
+  wx.request({
+    url: u,
+    data: {
+    },
+    method: 'GET',
+    success: function (res) {
+      let test = JSON.stringify(res.data)
+      let tet = JSON.parse(test)
+      GoodsDetail = tet.data.goods
+      callback4(GoodsDetail)//导出商品列表
+    }
+  })
+}
+function callback4(res) {
+  reStart()
+}
+function makePhoneCall(tel) {
+  wx.makePhoneCall({
+    phoneNumber: tel,
+    success: function (res) {
+      console.log('成功拨打电话')
+    },
+    fail: function (res) { },
+    complete: function (res) { },
+  })
+}
+
+/*
+主函数
+*/
+export default class Main {
+  constructor() {
+    getFLDsource(callback1, url)
+    //let tel = '10086'
+    //makePhoneCall(tel)
+  }
+}

+ 33 - 0
Album/project.config.json

xqd
@@ -0,0 +1,33 @@
+{
+	"description": "项目配置文件。",
+	"setting": {
+		"urlCheck": false,
+		"es6": true,
+		"postcss": true,
+		"minified": true,
+		"newFeature": true
+	},
+	"compileType": "game",
+	"libVersion": "game",
+	"appid": "wxa60e27fe2e523515",
+	"projectname": "Album",
+	"isGameTourist": true,
+	"condition": {
+		"search": {
+			"current": -1,
+			"list": []
+		},
+		"conversation": {
+			"current": -1,
+			"list": []
+		},
+		"game": {
+			"currentL": -1,
+			"list": []
+		},
+		"miniprogram": {
+			"current": -1,
+			"list": []
+		}
+	}
+}

+ 14 - 0
Album/readme.md

xqd
@@ -0,0 +1,14 @@
+```
+./js
+|——draw
+|  |——base.js. 						//绘制两边的目录栏背景和下一页按钮
+|  |——FirstLevelDirectory.js		//绘制顶级目录
+|  |——SecondLevelDirectory.js  	    //绘制子目录
+|  |——content.js					//绘制商品列表
+|  |——details.js					//绘制商品详情
+|——lib
+|  |——symbol.js                     // ES6 Symbol简易兼容
+|  |——weapp-adapter.js              // 小游戏适配器
+|——main.js							//绘制入口
+```
+

+ 60 - 0
Album/sources.json

xqd
@@ -0,0 +1,60 @@
+{
+  "firstleveldirectory": [
+    {
+      "name": "帝澳尼",
+      "url": "./images/20170713100908_4721.png",
+      "secondleveldirectory": [
+        {
+          "name": "法式床",
+          "content":[
+            {
+              "name":"S6821 【法式双人床】",
+              "url":"./images/products/20170811163608_9341.jpg",
+              "price":"",
+              "detail":"",
+              "size":""
+            }
+          ]
+        },
+        {
+          "name": "电视柜",
+          "content":[]
+        },
+        {
+          "name": "茶几",
+          "content": []
+        },
+        {
+          "name": "妆台",
+          "content": []
+        },
+        {
+          "name": "衣柜",
+          "content": []
+        },
+        {
+          "name": "沙发",
+          "content": []
+        },
+        {
+          "name": "其他",
+          "content": []
+        }
+      ]
+    },
+    {
+      "name": "蓝城家居",
+      "url": "./images/20170713095359_2145.png",
+      "secondleveldirectory": [
+        {
+          "name": "电视柜",
+          "content": []
+        },
+        {
+          "name": "茶几",
+          "content": []
+        }
+      ]
+    }
+  ]
+}