(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/index/index_phone"],{

/***/ 195:
/*!*****************************************************************************************************!*\
  !*** C:/workplay/workplay/workplay/kxz-app-phone-h5/main.js?{"page":"pages%2Findex%2Findex_phone"} ***!
  \*****************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(wx, createPage) {

var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
__webpack_require__(/*! uni-pages */ 26);
var _vue = _interopRequireDefault(__webpack_require__(/*! vue */ 25));
var _index_phone = _interopRequireDefault(__webpack_require__(/*! ./pages/index/index_phone.vue */ 196));
// @ts-ignore
wx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;
createPage(_index_phone.default);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["createPage"]))

/***/ }),

/***/ 196:
/*!**********************************************************************************!*\
  !*** C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue ***!
  \**********************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index_phone.vue?vue&type=template&id=c0db7e4a& */ 197);
/* harmony import */ var _index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index_phone.vue?vue&type=script&lang=js& */ 199);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var _index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index_phone.vue?vue&type=style&index=0&lang=scss& */ 295);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js */ 63);

var renderjs





/* normalize component */

var component = Object(_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  _index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  _index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["render"],
  _index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  false,
  null,
  null,
  null,
  false,
  _index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["components"],
  renderjs
)

component.options.__file = "pages/index/index_phone.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);

/***/ }),

/***/ 197:
/*!*****************************************************************************************************************!*\
  !*** C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=template&id=c0db7e4a& ***!
  \*****************************************************************************************************************/
/*! exports provided: render, staticRenderFns, recyclableRender, components */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_17_0_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_template_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_uni_app_loader_page_meta_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--17-0!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index_phone.vue?vue&type=template&id=c0db7e4a& */ 198);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_17_0_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_template_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_uni_app_loader_page_meta_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["render"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_17_0_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_template_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_uni_app_loader_page_meta_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recyclableRender", function() { return _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_17_0_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_template_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_uni_app_loader_page_meta_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["recyclableRender"]; });

/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "components", function() { return _HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_17_0_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_template_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_uni_app_loader_page_meta_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_template_id_c0db7e4a___WEBPACK_IMPORTED_MODULE_0__["components"]; });



/***/ }),

/***/ 198:
/*!*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--17-0!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=template&id=c0db7e4a& ***!
  \*****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns, recyclableRender, components */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recyclableRender", function() { return recyclableRender; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "components", function() { return components; });
var components
var render = function () {
  var _vm = this
  var _h = _vm.$createElement
  var _c = _vm._self._c || _h
  var g0 = !_vm.guide_left && _vm.active ? _vm.data.itemList.length : null
  var g1 = !_vm.guide_left && _vm.active ? _vm.data.itemList.length : null
  var g2 = _vm.data.itemList.length
  var g3 = _vm.$tool.isPc()
  var g4 = _vm.$tool.isPc()
  var g5 = _vm.isShowPop ? _vm.$tool.isPc() : null
  var g6 = _vm.isShowPop ? _vm.$tool.isPc() : null
  var g7 = _vm.isShowPop ? _vm.brandList.length : null
  var g8 = _vm.isShowPop ? _vm.datalist.length : null
  var g9 = _vm.isShowPop ? _vm.brandList.length : null
  _vm.$mp.data = Object.assign(
    {},
    {
      $root: {
        g0: g0,
        g1: g1,
        g2: g2,
        g3: g3,
        g4: g4,
        g5: g5,
        g6: g6,
        g7: g7,
        g8: g8,
        g9: g9,
      },
    }
  )
}
var recyclableRender = false
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ 199:
/*!***********************************************************************************************************!*\
  !*** C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=script&lang=js& ***!
  \***********************************************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--13-1!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index_phone.vue?vue&type=script&lang=js& */ 200);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_HBuilderX_plugins_uniapp_cli_node_modules_babel_loader_lib_index_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_13_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_script_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

/***/ 200:
/*!******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--13-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=script&lang=js& ***!
  \******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(uni, wx) {

var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ 4);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ 201));
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ 203));
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
var _Env = _interopRequireDefault(__webpack_require__(/*! @/util/Env.js */ 35));
var _http = _interopRequireDefault(__webpack_require__(/*! @/util/http.js */ 70));
var _loadFont = _interopRequireDefault(__webpack_require__(/*! @/util/loadFont.js */ 204));
var _UserService = _interopRequireDefault(__webpack_require__(/*! @/service/UserService */ 205));
var _homeservice = _interopRequireDefault(__webpack_require__(/*! @/service/homeservice.js */ 59));
var _wxTouchEvent = _interopRequireDefault(__webpack_require__(/*! ./js/wx-touch-event.js */ 207));
var _drag = _interopRequireDefault(__webpack_require__(/*! ./js/drag.js */ 208));
var _script = _interopRequireDefault(__webpack_require__(/*! ../../util/script.js */ 209));
var _axios = _interopRequireDefault(__webpack_require__(/*! axios */ 246));
var _imageTools = __webpack_require__(/*! image-tools */ 293);
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var kpsImageCutter = function kpsImageCutter() {
  __webpack_require__.e(/*! require.ensure | components/ksp-image-cutter/ksp-image-cutter */ "components/ksp-image-cutter/ksp-image-cutter").then((function () {
    return resolve(__webpack_require__(/*! @/components/ksp-image-cutter/ksp-image-cutter.vue */ 482));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var ProgressBar = function ProgressBar() {
  __webpack_require__.e(/*! require.ensure | components/Progress-Bar/Progress-Bar */ "components/Progress-Bar/Progress-Bar").then((function () {
    return resolve(__webpack_require__(/*! @/components/Progress-Bar/Progress-Bar.vue */ 489));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var myhead = function myhead() {
  __webpack_require__.e(/*! require.ensure | pages/index/head/head */ "pages/index/head/head").then((function () {
    return resolve(__webpack_require__(/*! ./head/head.vue */ 461));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var Mapping = function Mapping() {
  __webpack_require__.e(/*! require.ensure | pages/index/Mapping */ "pages/index/Mapping").then((function () {
    return resolve(__webpack_require__(/*! ./Mapping.vue */ 496));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var switchBrands = function switchBrands() {
  Promise.all(/*! require.ensure | pages/index/assembly/switchBrands */[__webpack_require__.e("common/vendor"), __webpack_require__.e("pages/index/assembly/switchBrands")]).then((function () {
    return resolve(__webpack_require__(/*! ./assembly/switchBrands.vue */ 503));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var tuya = function tuya() {
  __webpack_require__.e(/*! require.ensure | pages/index/tuya */ "pages/index/tuya").then((function () {
    return resolve(__webpack_require__(/*! ./tuya.vue */ 511));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var uniPopup = function uniPopup() {
  __webpack_require__.e(/*! require.ensure | pages/index/common/uni-popup/uni-popup */ "pages/index/common/uni-popup/uni-popup").then((function () {
    return resolve(__webpack_require__(/*! ./common/uni-popup/uni-popup.vue */ 475));
  }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
};
var OSS = __webpack_require__(/*! ali-oss */ 294);
//import scrollModeView from './assembly/scrollModeView.vue'; // 贴图

/*** 色彩公园图片 DIY 功能页*/
var app = getApp(); // 当前APP实例
var items = []; // 当前显示的图片列表
var index = 0; // 所点击的图片的索引
var maxFontSize = 50;
var heightRate = 1.8;
var snapshot = []; // 操作历史记录
var snapshotIndex = -1;
var infoListTouchEvent = new _wxTouchEvent.default(); //在 Page外实例化函数,可以直接复制给 Page 中的回调函数
var isclick = true;
var _default = {
  components: {
    kpsImageCutter: kpsImageCutter,
    myhead: myhead,
    ProgressBar: ProgressBar,
    switchBrands: switchBrands,
    Mapping: Mapping,
    tuya: tuya,
    uniPopup: uniPopup
    /*scrollModeView */
  },

  computed: {},
  data: function data() {
    var _ref;
    return _ref = {
      collection_currentId: 0,
      //点赞选中Id
      collection_currentIndex: null,
      //点赞选中坐标
      wallpaper_currentId: 0,
      //壁纸选中Id
      wallpaper_currentIndex: null,
      //壁纸选中坐标
      wallpaper_material_series_currentId: null,
      //壁纸系列选中
      mapping_currentId: 0,
      //贴图选中Id
      mapping_currentIndex: null,
      //贴图选中坐标
      mapping_material_series_currentId: null,
      //贴纸系列选中
      isShowNexAndUp: true,
      //控制是否显示上一步下一步
      classificationHeight: 0,
      backgroundColor: false,
      //控制底色
      Adlists: [],
      diy_backList: [],
      diy_bannerList: [],
      getStocklist: [],
      //查询货到库存
      type: '',
      content: '底部弹出 popup',
      active: false,
      currentId: 0,
      /* 控制被选中 */
      currentIndex: null,
      /* 控制位置 */
      currentId_Works: 0,
      /* 控制被选中 */
      currentIndex_Works: null,
      /* 控制位置 */
      currentId_Material: 0,
      /* 控制被选中 */
      currentIndex_Material: null,
      /* 控制位置 */
      currentId_wallpaper: 0,
      /* 控制被选中 */
      currentIndex_wallpaper: null,
      /* 控制位置 */
      material_series_currentId: null,
      /* 控制被选中 */
      brands: [],
      e_active: null,
      //判断弹框是贴图还是文本
      addtext: false,
      //判断加减文字
      bg_text_color: false,
      //判断加减文字
      Works_category: [],
      //作品分类
      Works_category_id: null,
      //作品选中分类id
      Works_categorydatalist: [],
      //作品分类作品列表
      Material_category: [],
      //贴图分类
      Material_category_id: null,
      //贴图选中分类
      Material_categorydatalist: [],
      //贴图分类贴图列表
      wallpaper_category: [],
      //壁纸分类
      wallpaper_category_id: null,
      //壁纸选中分类
      wallpaper_categorydatalist: [],
      //壁纸列表
      material_series_list: [],
      //二级分类
      datalist: [],
      //作品、贴图列表
      queryPage: {
        s: '',
        page: 1,
        //分页
        per_page: 40,
        //分页
        is_revise: '1',
        //可调整
        is_edit: '1',
        //模板属性
        machine_id: null,
        //设备id
        goods_category_id: null,
        //星形接口列表增加,产品分类参数
        works_category_id: null,
        //作品选中分类id
        material_category_id: null,
        //贴图壁纸选择值一级分类
        material_series_id: null,
        //贴图壁纸选择值二级分类
        is_new: null,
        //最新
        is_hot: null,
        //热门
        goods_id: null,
        //商品id
        is_under: 0,
        //贴图是否为背景图
        partner_id: null
      },
      works_id: null,
      //作品id
      createWorkstext: '生成',
      machine_id: null,
      //设备id
      key: 2,
      //1直营配送站 2 万能通用版 3色彩自助站
      sn: null,
      design_color: '#131319',
      mix_scale: 1,
      //图片比率
      design_width: 280,
      design_height: 380
    }, (0, _defineProperty2.default)(_ref, "design_width", 280), (0, _defineProperty2.default)(_ref, "print_height", 380), (0, _defineProperty2.default)(_ref, "design_widthrate", 1), (0, _defineProperty2.default)(_ref, "design_heightrate", 1), (0, _defineProperty2.default)(_ref, "guide_left", false), (0, _defineProperty2.default)(_ref, "guide_top", false), (0, _defineProperty2.default)(_ref, "editor_top", 0), (0, _defineProperty2.default)(_ref, "center_scale", 0), (0, _defineProperty2.default)(_ref, "location_scale", 0), (0, _defineProperty2.default)(_ref, "editory", 200), (0, _defineProperty2.default)(_ref, "lastTapTime", 0), (0, _defineProperty2.default)(_ref, "properties", {}), (0, _defineProperty2.default)(_ref, "state", false), (0, _defineProperty2.default)(_ref, "isRotate", false), (0, _defineProperty2.default)(_ref, "data", {
      user_id: null,
      //用户id
      goods_id: 1,
      //背景图id
      template: null,
      //源作品id
      template_price: null,
      //源作品sales_price
      template_user_id: null,
      //源作品user_id
      works_idlenght: 0,
      //模板个数
      windowWidth: 0,
      // 屏幕宽度
      windowHeight: 0,
      // 屏幕高度
      editorWidth: 280,
      // 设计宽度
      editorHeight: 380,
      // 设计高度
      bgImage: '',
      // 背景图
      bgWidth: 0,
      // 画布宽度
      bgHeight: 0,
      // 画布高度
      pixelRate: null,
      listActive: true,
      currentText: '',
      cidx: 0,
      itemList: [],
      loadbgImageheight: '100%',
      loadbgImageheightstate: false //白底图
    }), (0, _defineProperty2.default)(_ref, "titlename", ""), (0, _defineProperty2.default)(_ref, "loading", null), (0, _defineProperty2.default)(_ref, "percent", 0), (0, _defineProperty2.default)(_ref, "shape_image", ''), (0, _defineProperty2.default)(_ref, "shape_id", ''), (0, _defineProperty2.default)(_ref, "shape_price", ''), (0, _defineProperty2.default)(_ref, "dict_id", null), (0, _defineProperty2.default)(_ref, "goods_id", null), (0, _defineProperty2.default)(_ref, "goods_size", null), (0, _defineProperty2.default)(_ref, "front_image_long", false), (0, _defineProperty2.default)(_ref, "available", 1), (0, _defineProperty2.default)(_ref, "support_pay", null), (0, _defineProperty2.default)(_ref, "textHeight", null), (0, _defineProperty2.default)(_ref, "background_color", null), (0, _defineProperty2.default)(_ref, "background_surface_color", null), (0, _defineProperty2.default)(_ref, "background_surface_image", null), (0, _defineProperty2.default)(_ref, "tColorPicker_color", {
      r: 0,
      g: 0,
      b: 0,
      a: 1
    }), (0, _defineProperty2.default)(_ref, "animationData", {}), (0, _defineProperty2.default)(_ref, "animation", null), (0, _defineProperty2.default)(_ref, "deleteTop", 0), (0, _defineProperty2.default)(_ref, "deleteWrap", false), (0, _defineProperty2.default)(_ref, "delete_wrap_state", true), (0, _defineProperty2.default)(_ref, "translateX", -400), (0, _defineProperty2.default)(_ref, "translateXState", 1), (0, _defineProperty2.default)(_ref, "translateLeft", null), (0, _defineProperty2.default)(_ref, "translateHide", null), (0, _defineProperty2.default)(_ref, "functionHide", null), (0, _defineProperty2.default)(_ref, "transformscale", 1), (0, _defineProperty2.default)(_ref, "functionScale", null), (0, _defineProperty2.default)(_ref, "isReady", false), (0, _defineProperty2.default)(_ref, "orderUpdateTime", null), (0, _defineProperty2.default)(_ref, "titleHeight", 0), (0, _defineProperty2.default)(_ref, "surface_type", 0), (0, _defineProperty2.default)(_ref, "surfaceName", null), (0, _defineProperty2.default)(_ref, "support_paypal", 0), (0, _defineProperty2.default)(_ref, "coupon", null), (0, _defineProperty2.default)(_ref, "support_oversea", 0), (0, _defineProperty2.default)(_ref, "machineDetail", null), (0, _defineProperty2.default)(_ref, "diy_upload_menu", 1), (0, _defineProperty2.default)(_ref, "isCustomize", false), (0, _defineProperty2.default)(_ref, "isCustomizeComplete", false), (0, _defineProperty2.default)(_ref, "pixel_scale", 1), (0, _defineProperty2.default)(_ref, "options", {}), (0, _defineProperty2.default)(_ref, "pixelScale", 0.5), (0, _defineProperty2.default)(_ref, "filletSize", 0), (0, _defineProperty2.default)(_ref, "real_print_width", 0), (0, _defineProperty2.default)(_ref, "real_print_height", 0), (0, _defineProperty2.default)(_ref, "clipLeft", 0), (0, _defineProperty2.default)(_ref, "clipRight", 0), (0, _defineProperty2.default)(_ref, "clipTop", 0), (0, _defineProperty2.default)(_ref, "clipButtom", 0), (0, _defineProperty2.default)(_ref, "getComeSizeData", null), (0, _defineProperty2.default)(_ref, "isUpLoadImage", false), (0, _defineProperty2.default)(_ref, "customize_size_id", ""), (0, _defineProperty2.default)(_ref, "history_bannerList", []), (0, _defineProperty2.default)(_ref, "isShowPc", false), (0, _defineProperty2.default)(_ref, "isMouseMove", false), (0, _defineProperty2.default)(_ref, "windowWidth", 0), (0, _defineProperty2.default)(_ref, "selectChangeType", 1), (0, _defineProperty2.default)(_ref, "currentIdBrand", 0), (0, _defineProperty2.default)(_ref, "brandList", []), (0, _defineProperty2.default)(_ref, "sizestock", ""), (0, _defineProperty2.default)(_ref, "channel_no", ""), (0, _defineProperty2.default)(_ref, "dict_id", ""), (0, _defineProperty2.default)(_ref, "goods_id_e", {}), (0, _defineProperty2.default)(_ref, "datalist", []), (0, _defineProperty2.default)(_ref, "isShowPop", false), (0, _defineProperty2.default)(_ref, "brandCurrentId", 0), (0, _defineProperty2.default)(_ref, "modeltext", ""), (0, _defineProperty2.default)(_ref, "coupon", null), (0, _defineProperty2.default)(_ref, "sizetext_id", ""), (0, _defineProperty2.default)(_ref, "sizetext", ""), (0, _defineProperty2.default)(_ref, "support_juhe", 1), (0, _defineProperty2.default)(_ref, "headheight", 60), (0, _defineProperty2.default)(_ref, "menuButtonInfoTop", 14), _ref;
  },
  created: function created() {},
  methods: {
    brandclick: function brandclick(index, item) {
      this.brandCurrentId = index;
      item.machine_id = this.machine_id;
      this.open(item);
    },
    open: function open(item) {
      var _this2 = this;
      this.machine_id = item.machine_id;
      _homeservice.default.queryListPhone({
        s: 'Product.getBrandProducts',
        //新接口
        goods_brand_id: item.id,
        //品牌id
        machine_id: item.machine_id,
        key: "3"
      }).then(function (result) {
        _this2.datalist = result; // 品牌机型
        _this2.isShowPop = true;
      }).catch(function (err) {
        _this2.isShowPop = true;
        uni.showToast({
          title: err.msg,
          icon: 'none'
        });
      });
    },
    modeDetail: function modeDetail(item) {
      var _this3 = this;
      this.brandsitem = item;
      _homeservice.default.queryListPhone({
        s: 'Product.machineDetail',
        //新接口
        machine_id: this.machine_id,
        id: this.brandsitem.id //商品id
      }).then(function (result) {
        _this3.modeltext = _this3.brandsitem.name; //机型名
        _this3.goods_id = _this3.brandsitem.id; //产品id
        _this3.dict_id = result.dict_id; //产品属性id
        _this3.goods_id_e = {
          brandtext: _this3.brandsitem.name,
          // 品牌名
          modeltext: _this3.brandsitem.name,
          // 机型商品名
          goods_id: _this3.brandsitem.id,
          // 产品id
          dict_id: result.dict_id // 产品属性
        };

        _this3.goodsbrands({
          goods_id_e: _this3.goods_id_e
        });
      }).catch(function (err) {});
    },
    selectPicturePopColse: function selectPicturePopColse() {
      this.$refs["showpicture"].close();
    },
    showAiChangeClose: function showAiChangeClose() {
      this.selectChangeType = 1;
      this.$refs["showAiChange"].close();
    },
    //显示Ai转换
    showAiChange: function showAiChange() {
      if (this.data == null) {
        uni.showToast({
          icon: "none",
          title: this.$i18n.messages[this.$i18n.locale]["上传人物图片"],
          duration: 2000
        });
        return;
      }
      if (this.data.itemList == null || this.data.itemList.length == 0) {
        uni.showToast({
          icon: "none",
          title: this.$i18n.messages[this.$i18n.locale]["上传人物图片"],
          duration: 2000
        });
        return;
      }
      if (this.data.itemList[this.data.itemList.length - 1].type == 0 && this.data.itemList[this.data.itemList.length - 1].isUpLoadImage) {
        this.selectChangeType = 1;
        this.$refs["showAiChange"].open();
      } else {
        uni.showToast({
          icon: "none",
          //title: "Ai必须是上传图片类型",
          title: "Ai " + this.$i18n.messages[this.$i18n.locale]["必须是上传图片类型"],
          //title: "Ai必须是上传图片类型",
          duration: 2000
        });
      }
    },
    showAiChangeType: function showAiChangeType(type) {
      this.selectChangeType = type;
      this.changeHumanPortrait();
    },
    //图片地址转Flie
    getImageFileFromUrl: function getImageFileFromUrl(url, imageName) {
      return new Promise(function (resolve, reject) {
        var blob = null;
        var xhr = new XMLHttpRequest();
        xhr.open("GET", url);
        xhr.responseType = "blob";
        xhr.onload = function () {
          blob = xhr.response;
          var options = {
            type: 'image/jpeg',
            endings: 'native'
          };
          var imgFile = new File([blob], imageName + ".jpg", options);
          resolve(imgFile);
        };
        xhr.onerror = function (e) {
          reject(e);
        };
        xhr.send();
      });
    },
    //人画像
    changeHumanPortrait: function changeHumanPortrait() {
      var item = this.data.itemList[this.data.cidx];
      if (item == null) {
        return;
      }
      var imageUrl = item.content + "?x-oss-process=image/resize,lfit,w_1000";
      if (item.isChangeAi) {
        imageUrl = item.contentOld + "?x-oss-process=image/resize,lfit,w_1000";
      }
      uni.showLoading({
        title: 'AI' + this.$i18n.messages[this.$i18n.locale]['正在加载中'],
        mask: true
      });
      setTimeout(function () {
        uni.hideLoading();
      }, 6000);
      var that = this;
      var fileName = _script.default.signNRandom();
      this.getImageFileFromUrl(imageUrl, fileName).then(function (imageFile) {
        that.getOssStsToken(imageFile, function (resultImage) {
          _script.default.callRecognizeBankCard(resultImage, uni, that.selectChangeType, function (result) {
            uni.hideLoading();
            if (result.Code) {
              uni.showToast({
                icon: "none",
                title: that.$i18n.messages[that.$i18n.locale]['处理失败!图片中无清晰的真人头像'],
                duration: 2000
              });
            } else {
              if (result.Data) {
                var imageURL = result.Data.ImageURL;
                imageURL = imageURL.replace("http:", "https:");
                if (!item.isChangeAi) {
                  item.contentOld = item.content;
                }
                item.content = imageURL;
                item.isChangeAi = true;
                that.data.itemList[that.data.cidx];
              }
            }
            that.$refs["showAiChange"].close();
          }.bind(this));
        });
      });
    },
    //获取osstoken
    getOssStsToken: function getOssStsToken(filePath, callback) {
      var _this4 = this;
      //这里endpoint为API访问域名,与类目相关,具体类目的API访问域名请参考:https://help.aliyun.com/document_detail/143103.html
      var endpoint = "viapiutils.cn-shanghai.aliyuncs.com";
      var Action = "GetOssStsToken";
      //API_VERSION为API版本,与类目相关,具体类目的API版本请参考:https://help.aliyun.com/document_detail/464194.html
      var API_VERSION = "2020-04-01";
      var API_HTTP_METHOD = "POST";
      var request_ = {};
      //系统参数
      request_["SignatureMethod"] = "HMAC-SHA1";
      request_["SignatureNonce"] = _script.default.signNRandom();
      request_["AccessKeyId"] = "LTAI5tDPiEBZgfqNcWBqaFEc";
      request_["SignatureVersion"] = "1.0";
      request_["Timestamp"] = _script.default.getTimestamp();
      request_["Format"] = "JSON";
      request_["RegionId"] = "cn-shanghai";
      request_["Version"] = API_VERSION;
      request_["Action"] = Action;
      var url = _script.default.generateUrl(request_, API_HTTP_METHOD, endpoint, "amI84BLFbHz6dhOVbuArrERmeemmnx");
      _axios.default.post(url).then(function (result) {
        var ossStsToken = result.data;
        var ossClient = new OSS({
          accessKeyId: ossStsToken.Data.AccessKeyId,
          accessKeySecret: ossStsToken.Data.AccessKeySecret,
          stsToken: ossStsToken.Data.SecurityToken,
          region: "oss-cn-shanghai",
          bucket: 'viapi-customer-temp'
        });
        var ins = filePath;
        var fileName = ".jpg";
        var accessKeyId = "LTAI5tDPiEBZgfqNcWBqaFEc";
        var objectName = "".concat(accessKeyId, "/").concat(_this4.getNonce(6), "/").concat(fileName);
        putObject(ins);
        function putObject(_x) {
          return _putObject.apply(this, arguments);
        }
        function _putObject() {
          _putObject = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(data) {
            var _result;
            return _regenerator.default.wrap(function _callee$(_context) {
              while (1) {
                switch (_context.prev = _context.next) {
                  case 0:
                    _context.prev = 0;
                    _context.next = 3;
                    return ossClient.put(objectName, data);
                  case 3:
                    _result = _context.sent;
                    return _context.abrupt("return", typeof callback == "function" && callback(_result.url));
                  case 7:
                    _context.prev = 7;
                    _context.t0 = _context["catch"](0);
                  case 9:
                  case "end":
                    return _context.stop();
                }
              }
            }, _callee, null, [[0, 7]]);
          }));
          return _putObject.apply(this, arguments);
        }
      }).catch(function (error) {
        return typeof callback == "function" && callback(error.data);
      });
    },
    //随机字符串
    getNonce: function getNonce(length) {
      var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
      var result = '';
      for (var i = length; i > 0; --i) {
        result += str[Math.floor(Math.random() * str.length)];
      }
      return result;
    },
    //返回上一级
    backUpperPage: function backUpperPage() {
      uni.navigateBack();
    },
    ontuya: function ontuya() {
      var _this5 = this;
      this.$nextTick(function () {
        _this5.$refs['tuya'].open({
          data: _this5.data
        });
      });
    },
    tuyaimg: function tuyaimg(e) {
      var index = items.length;
      items.push({
        support_zoom: 1,
        // 0是不支持缩放,为1时支持缩放
        support_drag: 1,
        // 0是不支持拖动,为1时支持拖动
        is_under: 0,
        //贴图是否为背景图
        is_discount: 0,
        //贴图是否用卷
        id: index + 1,
        type: 0,
        //0为图片,1为文字,2为素材
        material_id: 0,
        original_id: 0,
        index: index,
        font_family: '',
        font_style: '',
        font_size: '',
        font_color: '',
        under_color: '',
        content: e,
        // 图片地址
        top: this.editor_top - this.data.editorHeight / 2,
        // 初始图片Y坐标,根据画布高/2-图片高/2
        left: this.data.editorWidth / 2 - this.data.editorWidth / 2,
        // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
        x: this.data.editorWidth / 2,
        // 初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
        y: this.editor_top,
        scale: 1,
        // 缩放比例  1为不缩放
        lastScale: 1,
        // 上一次的绽放比例
        oScale: 1,
        // 缩放比例  1为不缩放
        angle: 0,
        // 旋转角度
        rotate: 0,
        // 旋转值
        active: false,
        // 判定点击状态
        width: this.data.editorWidth,
        // 预设生成图片的宽度
        height: this.data.editorHeight,
        // 预设生成图片的高度
        rScale: 1,
        // 图片原始缩放比例
        //新增加默认属性
        activeguide: false,
        // 开启辅助线
        activescale: false,
        // 开启旋转状态
        activehorn: false,
        // 开启角状态
        activeedge: false,
        // 开启边状态
        initialScale: 1,
        // 图片缩放比例
        initialscaling: 1,
        // 图片初始时缩放比例
        initialScalex: 1,
        // 图片宽缩放比例
        initialScaley: 1,
        // 图片高缩放比例
        initialWidth: this.data.editorWidth,
        // 图片原始宽度
        initialHeight: this.data.editorHeight,
        // 图片原始高度
        frame_left: null,
        // 裁剪窗口x
        image_left: null,
        // 图片x
        frame_top: null,
        // 裁剪窗口y
        image_top: null // 图片y
      });

      this.data.itemList = items;
      this.saveSnapshot();
    },
    eliminateBackgroundColor: function eliminateBackgroundColor() {
      if (this.$base.surfaceData.surface_type == 2) {
        //定制壳
        this.background_color = 'none';
      }
      if (this.$base.surfaceData.surface_type == 0) {
        //默认
        this.background_color = null;
      }
    },
    //壁纸推荐
    wallpaperOnclick: function wallpaperOnclick() {
      var _this6 = this;
      var that = this;
      _homeservice.default.queryListPhone({
        s: 'Material.randomMaterial',
        machine_id: that.machine_id,
        goods_id: that.data.goods_id
      }).then(function (result) {
        uni.showLoading({
          title: _this6.$i18n.messages[_this6.$i18n.locale]['正在加载中'],
          mask: true
        });
        // 读取主图遮罩
        uni.getImageInfo({
          src: result.url,
          success: function success(image) {
            //清空历史记录
            items = []; // 当前显示的图片列表
            index = 0; // 所点击的图片的索引
            snapshot = []; // 操作历史记录清空
            snapshotIndex = -1;
            uni.hideLoading();
            var index = items.length;
            var width = 0;
            var height = 0;
            var top = 0;
            var lef = 0;
            var ratio = image.width / image.height;
            var ratiowidth = that.data.editorWidth * that.mix_scale / image.width;
            var ratioheight = that.data.editorHeight * that.mix_scale / image.height;
            var resultmix_scale = result.mix_scale || 1;
            //if (ratio >= 1) { //长方形
            width = that.data.editorWidth * that.mix_scale * resultmix_scale;
            height = image.height * ratiowidth * resultmix_scale;
            if (result.is_under == 1) {
              //贴图是否为背景图
              var number_index = 0;
              var _iterator = _createForOfIteratorHelper(items),
                _step;
              try {
                for (_iterator.s(); !(_step = _iterator.n()).done;) {
                  var item = _step.value;
                  if (item.is_under == 0) {
                    item.index = item.index + 1;
                  } else if (item.is_under == 1) {
                    number_index++;
                  }
                }
              } catch (err) {
                _iterator.e(err);
              } finally {
                _iterator.f();
              }
              index = number_index;
            }
            items.push({
              support_zoom: result.support_zoom,
              // 0是不支持缩放,为1时支持缩放
              support_drag: result.support_drag,
              // 0是不支持拖动,为1时支持拖动
              is_under: result.is_under,
              //贴图是否为背景图
              is_discount: result.is_discount,
              //贴图是否用卷
              id: items.length + 1,
              type: 2,
              //0图片 1文字 2贴图
              material_id: result.id,
              //贴图id
              original_id: result.id,
              index: index,
              font_family: '',
              font_style: '',
              font_size: '',
              font_color: '',
              under_color: '',
              content: result.url,
              //贴图地址
              top: that.editor_top - height / 2,
              //初始图片Y坐标,根据画布高/2-图片高/2
              left: that.data.editorWidth / 2 - width / 2,
              // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
              x: that.data.editorWidth / 2,
              //初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
              y: that.editor_top,
              scale: 1,
              // 缩放比例  1为不缩放
              lastScale: 1,
              // 上一次的绽放比例
              oScale: 1,
              // 缩放比例  1为不缩放
              angle: 0,
              // 旋转角度
              rotate: 0,
              // 旋转值
              active: false,
              // 判定点击状态
              width: width,
              // 预设生成图片的宽度
              height: height,
              // 预设生成图片的高度
              rScale: 1,
              // 贴图原始缩放比例
              activeguide: false,
              // 开启辅助线
              activescale: false,
              // 开启旋转状态
              activehorn: false,
              // 开启角状态
              activeedge: false,
              // 开启边状态
              //分界线
              initialScale: 1,
              // 图片缩放比例
              initialscaling: 1,
              // 图片初始时缩放比例
              initialScalex: 1,
              // 图片宽缩放比例
              initialScaley: 1,
              // 图片高缩放比例
              initialWidth: width,
              // 图片原始宽度
              initialHeight: height,
              // 图片原始高度
              frame_left: null,
              // 裁剪窗口x
              image_left: null,
              // 图片x
              frame_top: null,
              // 裁剪窗口y
              image_top: null // 图片y
            });
            //提示用户此贴图可用卷
            if (result.is_discount == '1') {
              if (that.$base.coupon_flag_desc == '') return;
              uni.showToast({
                title: that.$base.coupon_flag_desc,
                icon: 'none',
                duration: 2000,
                mask: false
              });
            }
            //赋值
            that.data.itemList = items;
            that.saveSnapshot();
          },
          fail: function fail(err) {
            uni.hideLoading();
          }
        });
      }).catch(function (err) {
        // uni.showToast({
        // 	title: err.msg,
        // 	icon: 'none'
        // });
      });
    },
    //切换手机型号控件
    goodsbrands: function goodsbrands(obj) {
      this.isShowPop = false;
      this.isCustomize = false; //充值自定义
      this.filletSize = 0; //设置圆角
      this.isCustomizeComplete = false;
      this.clipButtom = 0;
      this.clipTop = 0;
      this.clipLeft = 0;
      this.clipRight = 0;
      this.filletSize = 0;
      this.options.type = 2;
      this.data.loadbgImageheightstate = false;
      this.data.goods_id = obj.goods_id_e.goods_id; // 商品id
      this.dict_id = obj.goods_id_e.dict_id; //产品属性id
      this.goods_id = obj.goods_id_e.goods_id; //产品id
      this.goods_size = obj.goods_id_e.modeltext; // 品牌名
      this.goodslist(); // 获取产品详情数据
      this.orderNewLockAttrStock();
    },
    orderNewLockAttrStock: function orderNewLockAttrStock() {
      var _this7 = this;
      _homeservice.default.queryListPhone({
        // 释放锁定库存
        s: 'Order.newLockAttrStock',
        machine_id: this.machine_id,
        //设备id
        goods_id: null,
        //产品
        dict_id: null,
        //产品属性id
        old_sn: null,
        onlyClear: 1
      }).then(function (result) {}).catch(function (err) {});
      //锁定库存
      _homeservice.default.queryListPhone({
        s: 'Order.newLockAttrStock',
        machine_id: this.machine_id,
        //设备id
        goods_id: this.goods_id,
        //产品
        dict_id: this.dict_id,
        //产品属性id
        old_sn: this.sn
      }).then(function (result) {
        _this7.$base.lockInventory = result; //锁库存储存信息
        _this7.sn = result.sn;
        _this7.sizetext_id = _this7.$base.lockInventory.id;
        _this7.sizetext = _this7.$base.lockInventory.goods_size;
        _this7.sizestock = _this7.$base.lockInventory.stock;
        _this7.channel_no = _this7.$base.lockInventory.channel_no;
        _this7.dict_id = _this7.$base.lockInventory.dict_id;
        _this7.orderUpdateSn(); //定时器锁库存
      }).catch(function (err) {
        uni.showToast({
          title: err.msg || err.data,
          icon: 'none'
        });
      });
    },
    orderUpdateSn: function orderUpdateSn() {
      clearInterval(this.orderUpdateTime);
      this.orderUpdateTime = null;
      this.orderUpdateTime = setInterval(function () {
        var _this8 = this;
        _homeservice.default.queryListPhone({
          s: 'Order.updateStockTime',
          machine_id: this.machine_id,
          sn: this.sn
        }).then(function (res) {
          _this8.sn = res.sn;
        }).catch(function (err) {
          uni.showToast({
            title: err.msg,
            icon: 'none'
          });
        });
      }.bind(this), 120000);
    },
    preservationBase: function preservationBase() {
      try {
        //数据缓存 同步 一定要用try catch 包裹
        uni.setStorageSync('base', this.$base);
      } catch (e) {}
      ;
    },
    //移除遮罩形状
    empty: function empty() {},
    /* 创建作品*/createWorks: function createWorks(e) {
      if (this.available == 0) return;
      var that = this;
      //if (isclick == true) {
      //isclick = false;
      if (this.machine_id != undefined && this.machine_id != null && this.machine_id != '') {
        this.machine_item = this.machineDetail;
        this.support_paypal = this.machineDetail.support_paypal;
        if (this.machineDetail.support_oversea && this.machineDetail.support_oversea != "undefined") {
          this.support_oversea = this.machineDetail.support_oversea;
        }
        this.createWorks_one(e);
      } else {
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['必须扫码才能使用'],
          icon: 'none'
        });
        isclick = true;
      }
      //}
    },
    createWorks_one: function createWorks_one(e) {
      var _this9 = this;
      var pixelRate = this.data.pixelRate;
      var components = [];
      var scalePos = {};
      var width = 0.00;
      var height = 0.00;
      var left = 0.00;
      var top = 0.00;
      // 循环当前的组件数据
      var _iterator2 = _createForOfIteratorHelper(this.data.itemList),
        _step2;
      try {
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
          var item = _step2.value;
          item.rotate = item.angle;
          width = item.width * item.scale;
          height = item.height * item.scale;
          scalePos = this.calNoScalePos(item.left, item.top, item.width, item.height);
          left = item.left;
          top = item.top;
          item.centerPos = {
            x: item.left + width / 2,
            y: item.top + height / 2
          };
          item.x = item.centerPos.x;
          item.y = item.centerPos.y;
          if (item.angle != 0) {
            scalePos = this.calRocatePos(scalePos, {
              x: item.x,
              y: item.y
            }, item.angle);
          }
          var widScale = pixelRate * this.design_widthrate; //宽度比例
          var heiScale = pixelRate * this.design_heightrate; //高度比例
          var comlist = {
            support_zoom: item.support_zoom,
            // 0是不支持缩放,为1时支持缩放
            support_drag: item.support_drag,
            // 0是不支持拖动,为1时支持拖动
            is_under: item.is_under ? item.is_under : 0,
            //贴图是否为背景图
            is_discount: item.is_discount ? item.is_discount : 0,
            //贴图是否用卷
            id: item.idone ? item.idone : null,
            type: item.type,
            material_id: item.material_id,
            works_id: item.works_id ? item.works_id : null,
            original_id: item.original_id,
            index: item.index,
            font_family: item.font_family + '.ttf',
            font_dict_id: item.font_dict_id,
            font_style: "regular",
            font_size: item.font_size / widScale,
            font_color: item.font_color,
            under_color: item.under_color ? item.under_color : "#00000000",
            width: width / widScale,
            height: height / heiScale,
            top: top / heiScale,
            left: left / widScale,
            zoom: item.scale,
            rotate: item.rotate,
            content: item.content,
            upper_left_x: scalePos.leftTopX / widScale,
            upper_left_y: scalePos.leftTopY / heiScale,
            upper_right_x: scalePos.rightTopX / widScale,
            upper_right_y: scalePos.rightTopY / heiScale,
            lower_left_x: scalePos.leftBottomX / widScale,
            lower_left_y: scalePos.leftBottomY / heiScale,
            lower_right_x: scalePos.rightBottomX / widScale,
            lower_right_y: scalePos.rightBottomY / heiScale,
            center_x: item.x / widScale,
            center_y: item.y / heiScale
          };
          // type: 0, //0为图片,1为文字,2为素材
          if (item.type == 0) {
            //新添加的参数
            comlist.image_left = item.image_left ? (item.image_left + item.left) / widScale : left / widScale; // 图片的x
            comlist.image_top = item.image_top ? (item.image_top + item.top) / heiScale : top / heiScale; // 图片的y
            comlist.image_width = item.initialWidth * item.initialScale / widScale; // 图片宽度
            comlist.image_height = item.initialHeight * item.initialScale / heiScale; // 图片高度
          }
          //创建组件数据
          components.push(comlist);
        }
      } catch (err) {
        _iterator2.e(err);
      } finally {
        _iterator2.f();
      }
      if (this.data.works_idlenght == 0 && this.works_id == null) {
        this.data.template = null; //源作品id
        this.data.template_price = null; //源作品sales_price
        this.data.template_user_id = null; //源作品user_id
      }

      var loading = false;
      if (loading) return;
      if (components.length <= 0) {
        isclick = true;
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['抱歉作品还是一片荒漠'],
          icon: 'none'
        });
        return false;
      }
      loading = true;
      uni.showLoading({
        title: this.$i18n.messages[this.$i18n.locale]['作品正在绘制'],
        mask: true
      });
      if (loading) {
        var customize;
        var name;
        var print_width;
        var print_height;
        var print_left;
        var print_top;
        var print_radius;
        var data = {
          s: 'Works.save',
          components: components,
          works_id: this.works_id,
          goods_id: this.data.goods_id,
          template: this.data.template,
          //源作品id
          template_price: this.data.template_price,
          //源作品sales_price
          template_user_id: this.data.template_user_id,
          //源作品user_id
          user_id: this.data.user_id,
          //用户user_id
          platform: 4,
          shape_image: this.shape_image,
          //形状图片
          shape_id: this.shape_id,
          //形状id
          shape_price: this.shape_price,
          //形状价格
          machine_id: this.machine_id,
          //设备idmachine_id
          terminal: 2,
          //终端,1:平板, 2:手机,3:抖音
          background_color: this.background_color //手机壳背景颜色
        };

        _homeservice.default.WorkssavePhone(data).then(function (result) {
          isclick == true;
          uni.hideLoading();
          uni.showToast({
            title: _this9.$i18n.messages[_this9.$i18n.locale]['作品绘制成功'],
            icon: 'none',
            mask: true
          });
          _homeservice.default.setCate({
            goodid: result.id,
            machine_id: _this9.machine_id,
            goods_id: _this9.data.goods_id
          });
          /*this.customize_size_id = "";
          if (result.customize_size_id) {
          	this.customize_size_id = result.customize_size_id;
          }*/
          _this9.self_help(loading, result.id);
        }).catch(function (err) {
          uni.hideLoading();
          loading = false;
          uni.showToast({
            title: err.msg || err.data,
            icon: 'none'
          });
          isclick = true;
        });
      }
    },
    self_help: function self_help(loading, works_id) {
      var _data,
        _this10 = this;
      var type = 3;
      if (this.machineDetail && this.machineDetail.support_juhe == 0) {
        type = 2;
      }
      if (this.machineDetail != null && (this.machineDetail.support_juhe == 1 || this.machineDetail.support_yunguanjia == 1)) {
        uni.navigateTo({
          url: '../mine/order?goodid=' + works_id + '&machine_id=' + this.machine_id + '&goods_id=' + this.data.goods_id + "&support_oversea=" + this.support_oversea + "&support_juhe=" + this.machineDetail.support_juhe + "&support_yunguanjia=" + this.machineDetail.support_yunguanjia + "&titleName=" + this.titlename
        });
        return;
      }
      var data = (_data = {
        s: 'Order.create',
        type: type,
        //1:配送版,2:单机版,3:自助版
        machine_id: this.machine_id,
        //设备
        goods_id: this.data.goods_id,
        //产品 
        works_id: works_id,
        //作品
        channel_no: this.channel_no,
        //货道
        sn: this.sn,
        //前端查询标志
        dict_id: this.dict_id,
        //属性字典id
        goods_size: this.sizetext
      }, (0, _defineProperty2.default)(_data, "dict_id", this.dict_id), (0, _defineProperty2.default)(_data, "works_num", null), (0, _defineProperty2.default)(_data, "shop_id", this.tabletext ? this.machine_item.shop_id : null), (0, _defineProperty2.default)(_data, "sn", null), (0, _defineProperty2.default)(_data, "coupon_id", null), (0, _defineProperty2.default)(_data, "user_address", null), (0, _defineProperty2.default)(_data, "surface_type", this.$base.surfaceData.surface_type), (0, _defineProperty2.default)(_data, "surface_id", this.$base.surfaceData.surface_id), (0, _defineProperty2.default)(_data, "surface_color_series_id", this.$base.surfaceData.surface_color_series_id), (0, _defineProperty2.default)(_data, "surface_color_id", this.$base.surfaceData.surface_color_id), (0, _defineProperty2.default)(_data, "language", this._i18n.locale), (0, _defineProperty2.default)(_data, "support_paypal", ""), (0, _defineProperty2.default)(_data, "promoter_id", ""), (0, _defineProperty2.default)(_data, "terminal", 4), (0, _defineProperty2.default)(_data, "customize_size_id", this.customize_size_id), (0, _defineProperty2.default)(_data, "create_time", Date.parse(new Date()) / 1000), (0, _defineProperty2.default)(_data, "support_juhe", this.machineDetail ? this.machineDetail.support_juhe : 0), _data);
      if (this.coupon.ids != undefined && this.coupon != null) {
        data.coupon_id = this.coupon.ids.join("-");
      }
      uni.showLoading({
        title: this.$i18n.messages[this.$i18n.locale]['正在生成订单'],
        mask: true
      });
      _homeservice.default.WorksListPhone(data).then(function (result) {
        //uni.hideLoading();
        //isclick = true;
        if (_this10.machineDetail != null && _this10.machineDetail.support_juhe == 1) {
          var url_pay = result.data.link;
          window.location.href = url_pay;
        } else {
          uni.navigateTo({
            url: '../mall/lineUp?machine_id=' + _this10.machine_id
          });
        }
        uni.hideLoading();
        setTimeout(function () {
          isclick = true;
        }, 1000);
      }).catch(function (err) {
        loading = false;
        uni.hideLoading();
        uni.showToast({
          title: err.msg || err.data,
          icon: 'none'
        });
        isclick = true;
      });
    },
    //切换手机
    topagecategory: function topagecategory(e) {
      var _this11 = this;
      var that = this;
      _homeservice.default.queryListPhone({
        s: 'Product.getBrands',
        //新接口
        machine_id: this.machine_id,
        key: "3"
      }).then(function (result) {
        _this11.brandList = result;
        if (_this11.brandList != null && _this11.brandList.length > 0) {
          setTimeout(function () {
            that.brandclick(0, that.brandList[0]);
          }, 100);
        }
      }).catch(function (err) {
        uni.showToast({
          title: err.msg,
          icon: 'none'
        });
      });
    },
    onok: function onok(item) {
      this.state = false;
      items[index] = item; //赋值就移动了
      _drag.default.initPos(items[index]); // 初始化的位置
      _drag.default.getTransferPosition(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
      this.data.itemList = items;
    },
    oncancle: function oncancle() {
      this.state = false;
    },
    touchMove: function touchMove(ev) {
      ev.preventDefault();
      var item = items[index]; //获取当前选中的部件
      if (ev.touches.length == 1 && item != undefined) {
        if (item.typetext == "left-top" || item.typetext == "left-bottom" || item.typetext == "right-top" || item.typetext == "right-bottom") {
          //四角缩放
          _drag.default.scaleMove(ev, item, this.data);
        } else if (item.typetext == "left" || item.typetext == "right" || item.typetext == "top" || item.typetext == "bottom") {
          //四边伸缩
          _drag.default.edgeMove(ev, item, this.data);
        }
      } else if (ev.touches.length == 2 && ev.touches.length == 2) {
        //双指头操作
      }
    },
    touchEnd: function touchEnd(ev) {
      //获取当前选中的部件
      var item = items[index];
      if (item != undefined) {
        item.typetext = null;
      }
    },
    //边框移动
    edgeStart: function edgeStart(e, type) {
      //获取当前选中的部件
      var item = items[index];
      item.typetext = type; //判断边框
      //获取作为移动前坐标
      item.edgestartX = e.touches[0].clientX;
      item.edgestartY = e.touches[0].clientY;
      item.min_width = item.width;
      item.min_height = item.height;
      if (item.min_width == 50) {
        item.min_width = 55;
      }
      if (item.min_height == 50) {
        item.min_height = 55;
      }
      //记录坐标
      item.scaleone = item.width / item.height;
      //获取编辑框的左边距和上边距
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      item.mLeft = mLeft;
      item.mTop = mTop;
      _drag.default.recordPressDownData(item);
    },
    //边框移动结束
    edgeEnd: function edgeEnd(e) {
      //获取当前选中的部件
      var item = items[index];
      item.typetext = null;
      item.active = true; //辅助线
      item.activeguide = false; //辅助线
      item.activescale = true; // 旋转状态
      item.activehorn = true; // 角状态
      item.activeedge = true; // 边状态
      _drag.default.getTransferPosition(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
      this.saveSnapshot();
    },
    designcolor: function designcolor(e) {
      //多个商品时切换商品
      snapshot = []; // 操作历史记录清空
      snapshotIndex = -1;
      this.data.goods_id = e.id;
      // 获取产品详情数据
      this.goodslist();
    },
    //获取作品详情
    Worksdetail: function Worksdetail(item) {
      this.delete_wrap_state = true;
      if (wx.pageScrollTo) {
        wx.pageScrollTo({
          scrollTop: 0
        });
      }
      var that = this;
      if (this.e_active == 1) {
        if (items.length > 0) {
          /* uni.showModal({
          	title: '温馨提示',
          	content: '更换当前模版会清空DIY区域内容,确认要更新吗?',
          	cancelText: '取消',
          	confirmText: '确定',
          	confirmColor: '#ff3b32',
          	success: async function(res) {
          		if (res.confirm) {
          			that.Worksdetaildata(item)
          		} else if (res.cancel) {
          			}
          	}
          }); */
        } else {
          that.Worksdetaildata(item);
        }
      } else if (this.e_active == 2 || this.e_active == 23 || this.e_active == 99) {
        that.Worksdetaildata(item);
      } else if (this.e_active == 22) {
        //特效
        this.shape_image = item.image;
        this.shape_id = item.id;
        this.shape_price = item.sales_price;
        if (this.shape_image != '' && this.data.itemList.length == 0) {
          // this.showone = !this.showone
        }
      }
    },
    Worksdetaildata: function Worksdetaildata(item) {
      var _this12 = this;
      var s_data = 'Works';
      var isWork = item.isWork;
      if (this.e_active == 1) {
        items = [];
      } else if (this.e_active == 2 || this.e_active == 23 || this.e_active == 99) {
        if (isWork) {
          s_data = 'Works';
        } else {
          s_data = 'Material';
        }
      }
      uni.showLoading({
        title: this.$i18n.messages[this.$i18n.locale]['正在加载中'],
        mask: true
      });
      _homeservice.default.queryListPhone({
        s: s_data + '.detail',
        id: item.id
      }).then(function (result) {
        if (_this12.e_active == 2 || _this12.e_active == 23 || _this12.e_active == 99) {
          //贴图
          uni.showLoading({
            title: _this12.$i18n.messages[_this12.$i18n.locale]['正在加载中'],
            mask: true
          });
          var _index = items.length;
          var support_zoom = 1; // 0是不支持缩放,为1时支持缩放
          var support_drag = 1; // 0是不支持拖动,为1时支持拖动
          var is_under = 0; //贴图是否为背景图
          var is_discount = 0; //贴图是否用卷
          var urlData;
          var material_id = 0; //贴图id
          var original_id = 0;
          if (isWork) {
            urlData = result.image;
            result.mix_scale = 1;
            result.is_under = 0;
          } else {
            urlData = result.url;
            support_zoom = result.support_zoom; // 0是不支持缩放,为1时支持缩放
            support_drag = result.support_drag; // 0是不支持拖动,为1时支持拖动
            is_under = result.is_under; //贴图是否为背景图
            is_discount = result.is_discount; //贴图是否用卷
            material_id = result.id;
            original_id = result.id;
          }

          //读取主图遮罩
          uni.getImageInfo({
            src: urlData,
            success: function success(image) {
              if (_this12.e_active == 23) {
                //清空历史记录
                items = []; // 当前显示的图片列表
                _index = 0; // 所点击的图片的索引
                snapshot = []; // 操作历史记录清空
                snapshotIndex = -1;
              }
              uni.hideLoading();
              var width = 0;
              var height = 0;
              var top = 0;
              var lef = 0;
              var ratio = image.width / image.height;
              var ratiowidth = _this12.data.editorWidth * _this12.mix_scale / image.width;
              var ratioheight = _this12.data.editorHeight * _this12.mix_scale / image.height;
              //width = this.data.editorWidth * this.mix_scale
              //height = image.height * ratiowidth
              //if (ratio >= 1) { //长方形
              //width = this.data.editorWidth * this.mix_scale * resultmix_scale
              //height = image.height * ratiowidth * resultmix_scale
              // } else if (ratio < 1) { //长高方形
              height = _this12.data.editorHeight * _this12.mix_scale;
              width = image.width * ratioheight;
              // }

              items.push({
                support_zoom: support_zoom,
                // 0是不支持缩放,为1时支持缩放
                support_drag: support_drag,
                // 0是不支持拖动,为1时支持拖动
                is_under: is_under,
                //贴图是否为背景图
                is_discount: is_discount,
                //贴图是否用卷
                id: items.length + 1,
                type: 2,
                //0图片 1文字 2贴图
                material_id: material_id,
                //贴图id
                original_id: original_id,
                index: _index,
                font_family: '',
                font_style: '',
                font_size: '',
                font_color: '',
                under_color: '',
                content: urlData,
                // 贴图地址
                top: _this12.editor_top - height / 2,
                // 初始图片Y坐标,根据画布高/2-图片高/2
                left: _this12.data.editorWidth / 2 - width / 2,
                // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
                x: _this12.data.editorWidth / 2,
                // 初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
                y: _this12.editor_top,
                scale: 1,
                // 缩放比例  1为不缩放
                lastScale: 1,
                // 上一次的绽放比例
                oScale: 1,
                // 缩放比例  1为不缩放
                angle: 0,
                // 旋转角度
                rotate: 0,
                // 旋转值
                active: false,
                // 判定点击状态
                width: width,
                // 预设生成图片的宽度
                height: height,
                // 预设生成图片的高度
                rScale: 1,
                // 贴图原始缩放比例
                activeguide: false,
                // 开启辅助线
                activescale: false,
                // 开启旋转状态
                activehorn: false,
                // 开启角状态
                activeedge: false,
                // 开启边状态
                initialScale: 1,
                // 图片缩放比例
                initialscaling: 1,
                // 图片初始时缩放比例
                initialScalex: 1,
                // 图片宽缩放比例
                initialScaley: 1,
                // 图片高缩放比例
                initialWidth: width,
                // 图片原始宽度
                initialHeight: height,
                // 图片原始高度
                frame_left: null,
                // 裁剪窗口x
                image_left: null,
                // 图片x
                frame_top: null,
                // 裁剪窗口y
                image_top: null // 图片y
              });

              _this12.data.itemList = items;
              _this12.saveSnapshot();
            },
            fail: function fail(err) {
              uni.hideLoading();
              uni.showToast({
                title: this.$i18n.messages[this.$i18n.locale]['加载失败'],
                icon: 'none'
              });
            }
          });
        }
      }).catch(function (err) {
        uni.hideLoading();
        uni.showToast({
          title: err.msg,
          icon: 'none'
        });
      });
    },
    bgColorAssembly: function bgColorAssembly(bg) {
      this.background_color = bg;
    },
    bgColorClick: function bgColorClick() {
      this.classificationHeight = 0;
      this.queryPage.page = 1;
      this.backgroundColor = !this.backgroundColor;
      if (this.backgroundColor) {
        this.$refs.Mapping.open({
          machine_id: this.machine_id,
          e: 24,
          queryPage: {
            s: 'Material.colorList',
            page: 1,
            per_page: 20
          }
        });
      } else {
        this.$refs.Mapping.open({
          machine_id: this.machine_id,
          e: this.e_active,
          queryPage: this.queryPage
        });
      }
    },
    material_series_handleScroll: function material_series_handleScroll(e) {
      var index = e.index;
      var item = e.item;
      this.queryPage.page = 1;
      this.material_series_currentId = item.id;
      this.queryPage.material_series_id = item.id;
      var valColorValue = "";
      if (this.e_active == 23) {
        //壁纸
        this.wallpaper_material_series_currentId = item.id;
      } else if (this.e_active == 2) {
        //贴图
        this.mapping_material_series_currentId = item.id;
        valColorValue = this.brands[this.currentId_Material].val;
      }
      this.$refs.Mapping.open({
        machine_id: this.machine_id,
        e: this.e_active,
        queryPage: this.queryPage,
        val: valColorValue
      });
    },
    handleScroll: function handleScroll(e) {
      var _this13 = this;
      //选中
      var index = e.index;
      var item = e.item;
      this.queryPage.material_series_id = 0;
      this.material_series_currentId = 0;
      //判断系列
      if (this.e_active == 23) {
        this.wallpaper_material_series_currentId = 0;
      } else if (this.e_active == 2) {
        this.mapping_material_series_currentId = 0;
      }
      this.backgroundColor = false;
      if (this.e_active == 2) {
        //贴图
        this.currentId_Material = index;
        this.currentIndex_Material = Math.max(0, index - 1);
        this.Material_categorydatalist = [];
        this.queryPage.page = 1;
        this.Material_category_id = item.id;
        if (this.brands[this.currentId_Material].title == '热门') {
          this.classificationHeight = 0;
          this.material_series_list = [];
          this.queryPage.is_hot = 1;
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = null;
        } else if (this.brands[this.currentId_Material].title == '最新') {
          this.classificationHeight = 0;
          this.material_series_list = [];
          this.queryPage.is_new = 1;
          this.queryPage.is_hot = null;
          this.queryPage.material_category_id = null;
        } else {
          this.queryPage.is_hot = null;
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = item.id;
        }
        this.currentId = index;
        this.currentIndex = Math.max(0, index - 1);
        if (this.brands[this.currentId_Material].title == '我的') {
          this.classificationHeight = 0;
          this.material_series_list = [];
          this.$refs.Mapping.open({
            machine_id: this.machine_id,
            e: this.e_active,
            queryPage: {
              s: 'Material.myMaterial',
              page: 1,
              per_page: 50
            }
          });
        } else {
          this.MaterialseriesList();
          this.$refs.Mapping.open({
            machine_id: this.machine_id,
            e: this.e_active,
            queryPage: this.queryPage,
            val: this.brands[this.currentId_Material].val
          });
        }
      } else if (this.e_active == 23) {
        //壁纸
        this.currentId_wallpaper = index;
        this.currentIndex_wallpaper = Math.max(0, index - 1);
        this.wallpaper_categorydatalist = []; //壁纸列表
        this.queryPage.page = 1;
        this.wallpaper_category_id = item.id; //记录壁纸选中分类
        if (this.brands[this.currentId_wallpaper].title == '热门') {
          this.classificationHeight = 0;
          this.material_series_list = [];
          this.queryPage.is_hot = '1';
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = null;
        } else if (this.brands[this.currentId_wallpaper].title == '最新') {
          this.classificationHeight = 0;
          this.material_series_list = [];
          this.queryPage.is_new = '1';
          this.queryPage.is_hot = null;
          this.queryPage.material_category_id = null;
        } else {
          this.queryPage.is_hot = null;
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = item.id;
        }
        this.currentId = index;
        this.currentIndex = Math.max(0, index - 1);
        this.MaterialseriesList();
        this.$refs.Mapping.open({
          machine_id: this.machine_id,
          e: this.e_active,
          queryPage: this.queryPage
        });
      } else if (this.e_active == 99) {
        //历史作品
        this.currentId = index;
        this.currentIndex = Math.max(0, index - 1);
        this.collection_currentId = this.currentId;
        this.collection_currentIndex = this.currentIndex;
        this.$nextTick(function () {
          _this13.$refs.Mapping.open({
            machine_id: _this13.machine_id,
            e: _this13.e_active,
            goods_id: _this13.data.goods_id,
            queryPage: {
              currentId: _this13.currentId
            }
          });
        });
      }
    },
    MaterialseriesList: function MaterialseriesList() {
      var _this14 = this;
      //查询分类下二级分类
      this.material_series_list = [];
      _homeservice.default.queryListPhone({
        s: 'Material.seriesList',
        category_id: this.queryPage.material_category_id
      }).then(function (result) {
        _this14.queryPage.material_series_id = 0;
        _this14.material_series_list = result;
        if (_this14.material_series_list.length > 0) {
          if (_this14.e_active == 23) {
            if (_this14.wallpaper_material_series_currentId != 0) {
              _this14.queryPage.material_series_id = _this14.wallpaper_material_series_currentId;
              _this14.material_series_currentId = _this14.wallpaper_material_series_currentId;
            } else {
              _this14.queryPage.material_series_id = _this14.material_series_list[0].id;
              _this14.material_series_currentId = _this14.material_series_list[0].id;
            }
          } else if (_this14.e_active == 2) {
            if (_this14.mapping_material_series_currentId != 0) {
              _this14.queryPage.material_series_id = _this14.mapping_material_series_currentId;
              _this14.material_series_currentId = _this14.mapping_material_series_currentId;
            } else {
              _this14.queryPage.material_series_id = _this14.material_series_list[0].id;
              _this14.material_series_currentId = _this14.material_series_list[0].id;
            }
          } else {
            _this14.queryPage.material_series_id = _this14.material_series_list[0].id;
            _this14.material_series_currentId = _this14.material_series_list[0].id;
          }
          var that = _this14;
          setTimeout(function () {
            var query = wx.createSelectorQuery();
            query.select('#classification').boundingClientRect();
            query.exec(function (res) {
              that.classificationHeight = res[0].height;
              that.setData({
                classificationHeight: that.classificationHeight
              });
            });
          }.bind(_this14), 100);
        } else {
          _this14.classificationHeight = 0;
        }
      }).catch(function (err) {
        uni.showToast({
          title: err.msg,
          icon: 'none'
        });
      });
    },
    showPopup: function showPopup(e, isShow) {
      var _this15 = this;
      //打开弹框 1模板 2贴图 3字体 4编辑 22添加相框 23壁纸  24 上传图片 25 背景底色
      this.material_series_list = [];
      this.queryPage.material_series_id = 0;
      this.material_series_currentId = 0;
      this.delete_wrap_state = false;
      this.e_active = e;
      this.queryPage.page = 1;
      if (e == 2) {
        //图库贴纸
        this.queryPage.goods_id = this.data.goods_id;
        this.brands = this.Material_category;
        this.currentId = this.currentId_Material;
        this.currentIndex = this.currentIndex_Material;
        this.queryPage.s = 'Material.list';
        this.queryPage.works_category_id = null;
        this.queryPage.material_category_id = null;
        if (this.brands[this.currentId].title == '热门') {
          this.queryPage.is_hot = 1;
          this.queryPage.is_new = null;
        } else if (this.brands[this.currentId].title == '最新') {
          this.queryPage.is_new = 1;
          this.queryPage.is_hot = null;
        } else {
          this.queryPage.is_hot = null;
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = this.Material_category[0].id;
          if (this.Material_category_id) {
            this.queryPage.material_category_id = this.Material_category_id;
          }
        }
        if (this.mapping_material_series_currentId != 0) {
          this.queryPage.material_series_id = this.mapping_material_series_currentId;
          this.material_series_currentId = this.mapping_material_series_currentId;
        }
        this.MaterialseriesList();
        this.$refs.Mapping.open({
          machine_id: this.machine_id,
          e: this.e_active,
          queryPage: this.queryPage,
          val: this.brands[this.currentId].val
        });
      } else if (e == 3) {
        //文本
        index = null;
        this.addtext = true;
        this.data.currentText = '';
        this.$refs.Mapping.inittext({
          data: this.data,
          bg_text_color: this.bg_text_color,
          text: ''
        });
      } else if (e == 4) {
        //文本
        this.addtext = false;
        this.$refs.Mapping.inittext({
          data: this.data,
          bg_text_color: this.bg_text_color,
          text: ''
        });
      } else if (e == 23) {
        //壁纸
        this.queryPage.goods_id = this.data.goods_id;
        this.brands = this.wallpaper_category; //壁纸分类
        this.currentId = this.currentId_wallpaper; /* 控制被选中 */
        this.currentIndex = this.currentIndex_wallpaper; /* 控制位置 */
        this.queryPage.s = 'Material.list';
        this.queryPage.works_category_id = null; //作品选中分类id
        this.queryPage.material_category_id = null; //贴图选中分类
        if (this.brands[this.currentId].title == '热门') {
          this.queryPage.is_hot = '1';
          this.queryPage.is_new = null;
        } else if (this.brands[this.currentId].title == '最新') {
          this.queryPage.is_new = '1';
          this.queryPage.is_hot = null;
        } else {
          this.queryPage.is_hot = null;
          this.queryPage.is_new = null;
          this.queryPage.material_category_id = this.wallpaper_category[0].id;
          if (this.wallpaper_category_id) {
            this.queryPage.material_category_id = this.wallpaper_category_id;
          }
        }
        if (this.wallpaper_material_series_currentId != 0) {
          this.queryPage.material_series_id = this.wallpaper_material_series_currentId;
          this.material_series_currentId = this.wallpaper_material_series_currentId;
        }
        this.MaterialseriesList();
        this.$refs.Mapping.open({
          machine_id: this.machine_id,
          e: this.e_active,
          queryPage: this.queryPage
        });
      } else if (e == 24) {
        //
        this.$refs["showpicture"].open();
      } else if (e == 25) {
        this.backgroundColor = false;
        this.bgColorClick();
      } else if (e == 99) {
        //收藏
        this.Adlists = this.history_bannerList;
        this.brands = [{
          icon: "../../static/icon/icon_history_sticker.png",
          icon_click: "../../static/icon/icon_history_sticker-o.png",
          title: "我的历史"
        }, {
          icon: "../../static/icon/my.png",
          icon_click: "../../static/icon/my-o.png",
          title: "我的作品"
        }];
        if (this.collection_currentId != 0) {
          this.currentId = this.collection_currentId;
          this.currentIndex = this.collection_currentIndex;
        } else {
          this.currentId = 0;
          this.currentIndex = 0; /* 控制位置 */
        }

        this.MaterialseriesList();
        this.$nextTick(function () {
          _this15.$refs.Mapping.open({
            machine_id: _this15.machine_id,
            e: _this15.e_active,
            goods_id: _this15.data.goods_id,
            queryPage: {
              currentId: _this15.currentId
            }
          });
        });
      }
    },
    cancel: function cancel(type) {
      //关闭弹框
      this.isUpLoadImage = false;
      this.addtext = false;
      var item = items[index];
      if (wx.pageScrollTo) {
        wx.pageScrollTo({
          scrollTop: 0
        });
      }
      this.delete_wrap_state = true;
      this.isShowPop = false;
    },
    typefaceshow: function typefaceshow(type) {
      //关闭弹框
      //获取当前选中的部件
      var item = items[index];
      if (item != undefined && item.type == 1) {
        this.$refs.Mapping.inittext({
          data: this.data,
          bg_text_color: this.bg_text_color,
          text: 'typeface'
        });
      } else {
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['抱歉请先输入或者选择文字内容哦'],
          icon: 'none'
        });
      }
    },
    //关闭所有弹窗回调事件
    change: function change(e) {
      if (items != null && items.length >= 1) {
        var index = items.length - 1;
        var item = items[index];
        if (item != undefined && item.type == 1) {
          if (items[index].content == "" || items[index].content == null) {
            items.splice(index, 1); //删除指定的部件
            this.setData({
              'data': this.data
            });
            this.active = false;
          }
        }
      }
    },
    togglePopup: function togglePopup(type, open) {
      var _this16 = this;
      //打开弹框
      switch (type) {
        case 'bottom':
          this.content = '底部弹出 popup';
          break;
      }
      this.type = type;
      this.$nextTick(function () {
        _this16.$refs['show' + open].open();
      });
    },
    bgtextcolor: function bgtextcolor() {
      this.bg_text_color = !this.bg_text_color;
      this.$refs.Mapping.inittext({
        data: this.data,
        bg_text_color: this.bg_text_color
      });
    },
    //文本字体
    typefaceClick: function typefaceClick(typeface) {
      //获取当前选中的部件
      var item = items[index];
      if (item != undefined && item.type == 1) {
        item.font_family = typeface.key;
        item.font_dict_id = typeface.id;
        //字体行高变化
        if (typeface.title == '思源黑体') {
          heightRate = 1.48;
        } else if (typeface.title == '字体视界法棍体') {
          heightRate = 1.14;
        } else if (typeface.title == '千图小兔体') {
          heightRate = 1.2;
        } else if (typeface.title == '仓耳小字体') {
          heightRate = 1.26;
        } else if (typeface.title == '站酷酷黑') {
          heightRate = 1.14;
        } else if (typeface.title == '站酷快乐体') {
          heightRate = 1.14;
        }
        var that = this;
        var query = uni.createSelectorQuery();
        query.select('#item-text').boundingClientRect();
        query.exec(function (res) {
          var width = res[0].width;
          var rate = item.width / width;
          var tmpSize = item.font_size * rate;
          if (tmpSize > maxFontSize) {
            item.font_size = maxFontSize;
            item.height = maxFontSize * heightRate;
            item.top = item.y - item.height / 2;
          } else {
            item.font_size = item.font_size * rate;
            item.height = item.height * rate;
            item.top = item.y - item.height / 2;
          }
          that.setData({
            data: that.data
          });
          that.data.itemList = items;
        });
        this.$refs.Mapping.inittextSelect({
          data: this.data
        });
      } else {
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['抱歉你还没有输入内容哦'],
          icon: 'none'
        });
      }
      this.saveSnapshot();
    },
    //文本加粗
    workweight: function workweight() {
      // 获取当前选中的部件
      var item = items[index];
      if (item != undefined && item.type == 1) {
        item.font_style = item.font_style == "" ? "bold" : "";
      } else {
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['抱歉你还没有输入内容哦'],
          icon: 'none'
        });
      }
      this.saveSnapshot();
    },
    //文本颜色
    workcolor: function workcolor(color) {
      //获取当前选中的部件
      var item = items[index];
      if (item != undefined && item.type == 1) {
        if (this.bg_text_color) {
          item.under_color = color == item.under_color ? '' : color;
        } else {
          item.font_color = color == item.font_color ? '#000000' : color;
        }
      } else {
        uni.showToast({
          title: this.$i18n.messages[this.$i18n.locale]['抱歉你还没有输入内容哦'],
          icon: 'none'
        });
      }
      this.saveSnapshot();
    },
    /**
     * 通过旧坐标、旋转角度、圆心计算旋转后点的新坐标
     */
    calNewPos: function calNewPos(origin, center, angle) {
      //计算
      var radian = Math.PI / 180 * angle;
      var newX = (origin.x - center.x) * Math.cos(radian) - (origin.y - center.y) * Math.sin(radian) + center.x;
      var newY = (origin.y - center.y) * Math.cos(radian) + (origin.x - center.x) * Math.sin(radian) + center.y;
      //取10位小数
      newX = newX.toFixed(10);
      newY = newY.toFixed(10);
      return {
        x: newX,
        y: newY
      };
    },
    /**
     * 通当新坐标、旋转角度、圆心计算旋转后点的旧坐标
     */
    calOldPos: function calOldPos(origin, center, angle) {
      //计算
      var radian = -Math.PI / 180 * angle;
      var oldX = (origin.x - center.x) * Math.cos(radian) - (origin.y - center.y) * Math.sin(radian) + center.x;
      var oldY = (origin.y - center.y) * Math.cos(radian) + (origin.x - center.x) * Math.sin(radian) + center.y;
      //取10位小数
      oldX = oldX.toFixed(10);
      oldY = oldY.toFixed(10);
      return {
        x: oldX,
        y: oldY
      };
    },
    /**
     * 计算伸缩后的四个顶部坐标
     */
    calScalePos: function calScalePos(scale, left, top, width, height) {
      // 计算单边需要伸缩的比例,可为正可为负
      var rate = (scale - 1) / 2;
      // 通过比例计算宽和高的差值
      var widthDiff = rate * width;
      var heightDiff = rate * height;
      // 左上顶点的坐标
      var leftTopX = left - widthDiff;
      var leftTopY = top - heightDiff;
      // 右上顶点的坐标
      var rightTopX = left + width + widthDiff;
      var rightTopY = leftTopY;
      // 左下顶点的坐标
      var leftBottomX = leftTopX;
      var leftBottomY = top + height + heightDiff;
      // 右下顶点的坐标
      var rightBottomX = rightTopX;
      var rightBottomY = leftBottomY;
      // 返回所有的8个坐标
      return {
        leftTopX: leftTopX.toFixed(10),
        leftTopY: leftTopY.toFixed(10),
        rightTopX: rightTopX.toFixed(10),
        rightTopY: rightTopY.toFixed(10),
        leftBottomX: leftBottomX.toFixed(10),
        leftBottomY: leftBottomY.toFixed(10),
        rightBottomX: rightBottomX.toFixed(10),
        rightBottomY: rightBottomY.toFixed(10),
        centerX: (rightTopX - leftTopX) / 2,
        centerY: (rightTopY - leftTopY) / 2
      };
    },
    /**
     * 计算未伸缩时的四个顶点坐标
     */
    calNoScalePos: function calNoScalePos(left, top, width, height) {
      //左上顶点的坐标
      var leftTopX = left;
      var leftTopY = top;
      //右上顶点的坐标
      var rightTopX = left + width;
      var rightTopY = leftTopY;
      //左下顶点的坐标
      var leftBottomX = leftTopX;
      var leftBottomY = top + height;
      //右下顶点的坐标
      var rightBottomX = rightTopX;
      var rightBottomY = leftBottomY;
      //返回所有的8个坐标
      return {
        leftTopX: leftTopX.toFixed(10),
        leftTopY: leftTopY.toFixed(10),
        rightTopX: rightTopX.toFixed(10),
        rightTopY: rightTopY.toFixed(10),
        leftBottomX: leftBottomX.toFixed(10),
        leftBottomY: leftBottomY.toFixed(10),
        rightBottomX: rightBottomX.toFixed(10),
        rightBottomY: rightBottomY.toFixed(10),
        centerX: (rightTopX - leftTopX) / 2,
        centerY: (rightTopY - leftTopY) / 2
      };
    },
    /**
     * 计算四个顶点旋转后的坐标系 */
    calRocatePos: function calRocatePos(scalePos, center, angle) {
      // 左上顶点的坐标
      var leftTop = this.calNewPos({
        x: scalePos.leftTopX,
        y: scalePos.leftTopY
      }, center, angle);
      // 右上顶点的坐标
      var rightTop = this.calNewPos({
        x: scalePos.rightTopX,
        y: scalePos.rightTopY
      }, center, angle);
      // 左下顶点的坐标
      var leftBottom = this.calNewPos({
        x: scalePos.leftBottomX,
        y: scalePos.leftBottomY
      }, center, angle);
      // 右下顶点的坐标
      var rightBottom = this.calNewPos({
        x: scalePos.rightBottomX,
        y: scalePos.rightBottomY
      }, center, angle);
      // 返回所有的8个坐标
      return {
        leftTopX: leftTop.x,
        leftTopY: leftTop.y,
        rightTopX: rightTop.x,
        rightTopY: rightTop.y,
        leftBottomX: leftBottom.x,
        leftBottomY: leftBottom.y,
        rightBottomX: rightBottom.x,
        rightBottomY: rightBottom.y,
        centerX: (scalePos.rightTopX - scalePos.leftTopX) / 2 + scalePos.leftTopX,
        centerY: (scalePos.rightTopY - scalePos.leftTopY) / 2 + scalePos.leftTopY
      };
    },
    /**
     * 计算四个顶点旋转后的旧坐标
     */
    calOldRocatePos: function calOldRocatePos(scalePos, center, angle) {
      // 左上顶点的坐标
      var leftTop = this.calOldPos({
        x: scalePos.leftTopX,
        y: scalePos.leftTopY
      }, center, angle);

      // 右上顶点的坐标
      var rightTop = this.calOldPos({
        x: scalePos.rightTopX,
        y: scalePos.rightTopY
      }, center, angle);

      // 左下顶点的坐标
      var leftBottom = this.calOldPos({
        x: scalePos.leftBottomX,
        y: scalePos.leftBottomY
      }, center, angle);

      // 右下顶点的坐标
      var rightBottom = this.calOldPos({
        x: scalePos.rightBottomX,
        y: scalePos.rightBottomY
      }, center, angle);
      //返回所有的8个坐标
      return {
        leftTopX: leftTop.x,
        leftTopY: leftTop.y,
        rightTopX: rightTop.x,
        rightTopY: rightTop.y,
        leftBottomX: leftBottom.x,
        leftBottomY: leftBottom.y,
        rightBottomX: rightBottom.x,
        rightBottomY: rightBottom.y,
        centerX: (rightTopX - leftTopX) / 2,
        centerY: (rightTopY - leftTopY) / 2
      };
    },
    /**
     * 读取图片操作
     */
    loadbgImage: function loadbgImage(e) {
      var id = e.currentTarget.dataset.id;
      var width = e.detail.width * this.data.pixelRate * this.design_widthrate; //获取图片真实宽度
      var height = e.detail.height * this.data.pixelRate * this.design_widthrate; //获取图片真实高度
      var rScale = width / this.data.bgWidth;
      this.data.loadbgImageheight = height / rScale;
      this.data.loadbgImageheightstate = true;
    },
    /**
     * 读取图片操作
     */
    loadImage: function loadImage(e) {
      var id = e.currentTarget.dataset.id;
      var width = 0;
      var height = 0;
      var ratio = e.detail.width / e.detail.height;
      var ratiowidth = this.print_width / e.detail.width;
      var ratioheight = this.print_height / e.detail.height;
      if (ratio >= 1) {
        //长方形
        width = this.print_width * this.data.pixelRate * this.mix_scale * this.design_widthrate;
        height = e.detail.height * ratiowidth * this.data.pixelRate * this.mix_scale * this.design_heightrate;
        if (height / 2 > this.editor_top) {
          width = width * (this.editor_top * 2 / height);
          height = this.editor_top * 2;
        }
      } else if (ratio < 1) {
        //长高方形
        height = this.print_height * this.data.pixelRate * this.mix_scale * this.design_widthrate;
        width = e.detail.width * ratioheight * this.data.pixelRate * this.mix_scale * this.design_heightrate;
        if (height / 2 > this.editor_top) {
          width = width * (this.editor_top * 2 / height);
          height = this.editor_top * 2;
        }
      }
      items[id - 1]['width'] = width;
      items[id - 1]['height'] = height;
      items[id - 1]['top'] = items[id - 1]['y'] - items[id - 1]['height'] / 2;
      items[id - 1]['left'] = items[id - 1]['x'] - items[id - 1]['width'] / 2;
    },
    /**
     * 部件点击事件
     */
    itemClick: function itemClick(e) {
      // 循环数据找到点击点
      for (var i = 0; i < items.length; i++) {
        //关闭点击属性
        items[i].active = false; //选中状态
        items[i].activeguide = false; // 辅助线状态
        items[i].activescale = false; // 旋转状态
        items[i].activehorn = false; // 角状态
        items[i].activeedge = false; // 边状态
        if (e.currentTarget.dataset.id == items[i].id) {
          //记录下标
          index = i;
          //开启点击属性
          items[index].active = true; //选中状态
          items[index].activeguide = false; // 辅助线状态
          items[index].activescale = true; // 旋转状态
          items[index].activehorn = true; // 角状态
          items[index].activeedge = true; // 边状态
        }
      }

      this.active = true;
      this.data.listActive = true;
      this.data.cidx = index;
      // 初始化的位置
      _drag.default.initPos(items[index]);
    },
    /**
     * 点击画布区域取消聚焦
     */
    itemCancel: function itemCancel(e) {
      if (this.isMouseMove) {
        return;
      }
      if (items.length > 0) {
        for (var i = 0; i < items.length; i++) {
          items[i].active = false;
          items[i].active = false; //辅助线
          items[i].activeguide = false; //辅助线
          items[i].activescale = false; // 旋转状态
          items[i].activehorn = false; // 角状态
          items[i].activeedge = false; // 边状态
        }

        this.data.itemList = items;
        this.data.listActive = false;
        this.active = false;
      }
    },
    /**
     * 获取编辑区域左边距
     */
    getLeft: function getLeft() {
      return (750 - this.design_width) / 2 * this.data.pixelRate;
    },
    /**
     * 获取编辑区域上边距
     */
    getTop: function getTop() {
      return (this.data.bgHeight - this.data.editorHeight) / 2;
    },
    /**
     * 图片拖动开始事件
     */
    dragStart: function dragStart(e) {
      //剪切数据
      this.properties = items[index];
      //点击选中部件
      this.itemClick(e);
      //获取当前选中的部件
      var item = items[index];
      if (e.touches.length > 1) {
        //获取作为移动前角度的坐标
        item.touchX = e.touches[0].clientX;
        item.touchY = e.touches[0].clientY;
        //当两根手指放上去的时候,将距离(distance)初始化。
        var xMove = e.touches[1].clientX - e.touches[0].clientX;
        var yMove = e.touches[1].clientY - e.touches[0].clientY;
        //计算开始触发两个手指坐标的距离
        item.distance = Math.sqrt(xMove * xMove + yMove * yMove);
        //获取图片半径
        item.r = this.computeDistance(item.x, item.y, item.left, item.top);
      } else {
        if (e.type == "touchstart") {
          item.startX = e.touches[0].clientX;
          item.startY = e.touches[0].clientY;
        } else {
          item.startX = e.clientX;
          item.startY = e.clientY;
        }
      }
      var currentText = '';
      if (item.type == 1) {
        currentText = item.content;
      }
      item.mLeft = item.left;
      item.mTop = item.top;
      _drag.default.recordPressDownData(item);
      //赋值
      this.data.listActive = true;
      this.data.cidx = index;
      this.data.currentText = currentText;
      this.data.itemList = items;
    },
    /**
     * 图片拖动中事件
     */
    dragMove: function dragMove(e) {
      this.deleteTop = this.data.windowHeight - 90;
      //获取当前选中的部件
      var item = items[index];
      if (e.touches.length > 1) {} else {
        _drag.default.dragMove(e, item, this.data, this.editor_top);
        this.guide_left = true; // 开启辅助线
        this.guide_top = true; // 开启辅助线
        this.delete_wrap_state = true;
        if (e.changedTouches[0].pageY - 10 > this.deleteTop) {
          //如果图片容器底部距离大于删除框顶部距离就删除图片
          this.deleteWrap = true;
        } else {
          this.deleteWrap = false;
        }
      }
      //赋值就移动了
      this.data.itemList = items;
    },
    /**
     * 拖动结束事件
     */
    dragEnd: function dragEnd(e) {
      //赋值
      this.guide_top = false;
      this.guide_left = false;
      //获取当前选中的部件
      var item = items[index];
      item.lastScale = item.scale;
      //属性
      item.active = true; //辅助线
      item.activeguide = false; //辅助线
      item.activescale = true; // 旋转状态
      item.activehorn = true; // 角状态
      item.activeedge = true; // 边状态
      //恢复
      if (item.heart_startX != undefined) {
        item.startX = item.heart_startX;
        item.startY = item.heart_startY;
      }
      if (item.xheart != undefined) {
        item.x = item.xheart;
        item.y = item.yheart;
      }
      //赋值就移动了
      this.data.itemList = items;
      //赋值
      this.saveSnapshot();
    },
    /**
     * 部件缩放开始事件
     */
    scaleStart: function scaleStart(e, type) {
      // 点击选中部件
      this.itemClick(e);
      // 获取当前选中的部件
      var item = items[index];
      item.typetext = type;
      //获取作为移动前角度的坐标
      item.touchX = e.touches[0].clientX;
      item.touchY = e.touches[0].clientY;
      //获取图片半径
      item.r = this.computeDistance(item.x, item.y, item.left, item.top);
      // 记录坐标
      item.scaleone = item.width / item.height;
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      item.mLeft = mLeft;
      item.mTop = mTop;
      _drag.default.recordPressDownData(item);
      //赋值
      this.data.listActive = true;
    },
    /**
     * 部件旋转开始事件
     */
    rotateStart: function rotateStart(e) {
      // 点击选中部件
      this.itemClick(e);
      // 获取当前选中的部件
      var item = items[index];
      item.typetext = 'rotate';
      //获取作为移动前角度的坐标
      item.touchX = e.touches[0].clientX;
      item.touchY = e.touches[0].clientY;
      // 获取编辑框的左边距和上边距
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      item.anglePre = item.angle;
      //获取图片半径
      item.r = this.computeDistance(item.x, item.y, item.left, item.top);
      //赋值
      this.data.listActive = true;
    },
    /**
     * 部件缩放中事件
     */
    scaleMove: function scaleMove(e) {
      //获取当前选中的部件
      var item = items[index];
      //记录移动后的位置
      item.touchMoveX = e.touches[0].clientX;
      item.touchMoveY = e.touches[0].clientY;
      //属性
      item.active = false; //辅助线
      item.activeguide = false; //辅助线
      item.activescale = false; // 旋转状态
      item.activehorn = true; // 角状态
      item.activeedge = false; // 边状态
      // 获取编辑框的左边距和上边距
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      //移动的点到圆心的距离
      item.disPtoO = this.computeDistance(item.x, item.y, item.touchMoveX - mLeft, item.touchMoveY - mTop);
      //手指滑动的点到圆心的距离与半径的比值作为图片的放大比例
      item.scale = item.disPtoO / item.r;
      //设置最大缩放为10倍
      if (Math.abs(item.scale) > 10) {
        item.scale = 10;
      }
      //设置最小缩放为0.3倍
      if (Math.abs(item.scale) < 0.3) {
        item.scale = 0.3;
      }
      //图片放大响应的右下角按钮同比缩小
      item.oScale = 1 / item.scale;
      _drag.default.initPos(item);
      //赋值setData渲染
      this.data.itemList = items;
    },
    /**
     * 部件旋转中事件
     */
    rotateMove: function rotateMove(e) {
      //获取当前选中的部件
      var distanceX = (this.windowWidth - this.$base.isPcWidth) / 2 + this.$base.isPcWidth / 2 - this.data.editorWidth / 2;
      var distanceY = (this.data.windowHeight - this.data.editorHeight) / 2;
      var item = items[index];
      item.touchMoveX = e.touches[0].clientX;
      item.touchMoveY = e.touches[0].clientY;
      var cx = item.x + distanceX;
      var cy = item.y + distanceY;
      var c1 = Math.atan2(item.touchY - cy, item.touchX - cx) * 180 / Math.PI;
      var c2 = Math.atan2(item.touchMoveY - cy, item.touchMoveX - cx) * 180 / Math.PI;
      var angleC;
      c1 = c1 <= -90 ? 360 + c1 : c1;
      c2 = c2 <= -90 ? 360 + c2 : c2;
      //夹角获取
      angleC = Math.floor(c2 - c1);
      angleC = angleC < 0 ? angleC + 360 : angleC;
      var startAngle = item.anglePre;
      var deg, rotate;
      //顺时针旋转
      if (item.touchMoveX - item.touchX > 0) {
        deg = startAngle + angleC;
        rotate = deg > 360 ? deg - 360 : deg;
      } else {
        //逆时针旋转
        angleC = 360 - angleC;
        deg = startAngle - angleC;
        rotate = deg < 0 ? deg + 360 : deg;
      }
      item.rotate = rotate;
      item.angle = item.rotate; //赋值
      var roat = Math.abs(item.angle) % 360;
      if (item.angle < 0) {
        var multiple = Math.ceil(Math.abs(item.angle) / 360);
        roat = item.angle + multiple * 360;
      }
      _drag.default.initPos(item);
      if (roat <= 5 || roat >= 355) {
        item.angle = 0.00;
      } else if (roat <= 50 && roat >= 40) {
        item.angle = 45;
      } else if (roat <= 95 && roat >= 85) {
        item.angle = 90;
      } else if (roat <= 140 && roat >= 130) {
        item.angle = 135;
      } else if (roat <= 185 && roat >= 175) {
        item.angle = 180;
      } else if (roat <= 230 && roat >= 220) {
        item.angle = 225;
      } else if (roat <= 275 && roat >= 265) {
        item.angle = 270;
      } else if (roat <= 320 && roat >= 310) {
        item.angle = 315;
      }
      item.active = false; //辅助线
      item.activeguide = true; //开启辅助线
      item.activescale = true; // 旋转状态
      item.activehorn = false; // 角状态
      item.activeedge = false; // 边状态
      this.data.itemList = items;
    },
    /**
     * 部件缩放结束事件
     */
    scaleEnd: function scaleEnd(e) {
      // 获取当前选中的部件
      var item = items[index];
      item.typetext = null;
      //关闭点击属性
      item.active = true; //辅助线
      item.activeguide = false; // 辅助线状态
      item.activescale = true; // 旋转状态
      item.activehorn = true; // 角状态
      item.activeedge = true; // 边状态
      _drag.default.getTransferPosition(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
      this.saveSnapshot();
    },
    /**
     *  部件旋转结束事件
     */
    rotateEnd: function rotateEnd(e) {
      //获取当前选中的部件
      var item = items[index];
      item.typetext = null;
      //关闭点击属性
      item.active = true; //辅助线
      item.activeguide = false; // 辅助线状态
      item.activescale = true; // 旋转状态
      item.activehorn = true; // 角状态
      item.activeedge = true; // 边状态
      this.saveSnapshot();
    },
    /**
     * 计算手点击坐标到圆心的角度
     */
    computeAngle: function computeAngle(centerX, centerY, x, y) {
      var diffX = x - centerX;
      var diffY = y - centerY;
      var rate = Math.abs(diffX / diffY);
      //鼠标相对于旋转中心的角度
      var angle = Math.atan(rate) / (2 * Math.PI) * 360;
      if (diffX < 0 && diffY < 0) {
        // 右下角,第四象限
        angle = -angle;
      } else if (diffX <= 0 && diffY >= 0) {
        // 左下角,第三象限
        angle = -(180 - angle);
      } else if (diffX > 0 && diffY < 0) {
        // 右上角,第一象限
        angle = angle;
      } else if (diffX > 0 && diffY > 0) {
        // 左上角,第二象限
        angle = 180 - angle;
      }
      return angle;
    },
    /**
     * 获得两点之间连线的角度
     * @param startX
     * @param py
     * @param mx
     * @param my
     * @returns {number}
     */
    computeMouseAngle: function computeMouseAngle(startX, startY, mouseX, mouseY) {
      var x = Math.abs(startX - mouseX);
      var y = Math.abs(startY - mouseY);
      var z = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
      var cos = y / z;
      var radina = Math.acos(cos); //用反三角函数求弧度
      var angle = Math.floor(180 / (Math.PI / radina)); //将弧度转换成角度
      if (mouseX > startX && mouseY > startY) {
        //鼠标在第四象限
        angle = 180 - angle;
      }
      if (mouseX == startX && mouseY > startY) {
        //鼠标在y轴负方向上
        angle = 180;
      }
      if (mouseX > startX && mouseY == startY) {
        //鼠标在x轴正方向上
        angle = 90;
      }
      if (mouseX < startX && mouseY > startY) {
        //鼠标在第三象限
        angle = 180 + angle;
      }
      if (mouseX < startX && mouseY == startY) {
        //鼠标在x轴负方向
        angle = 270;
      }
      if (mouseX < startX && mouseY < startY) {
        //鼠标在第二象限
        angle = 360 - angle;
      }
      return angle;
    },
    /*
     * 计算触摸点到圆心的距离
     */
    computeDistance: function computeDistance(centerX, centerY, x, y) {
      var diffX = x - centerX;
      var diffY = y - centerY;
      return Math.sqrt(diffX * diffX + diffY * diffY);
    },
    /* 函数描述:作为上传文件时递归上传的函数体体;
     * 参数描述: 
     * filePaths是文件路径数组
     * successUp是成功上传的个数->0
     * failUp是上传失败的个数->0
     * i是文件路径数组的指标->0
     * length是文件路径数组的长度
     */
    uploadDIY: function uploadDIY(tempFilePaths, successUp, failUp, i, length, formatImage) {
      var machine_id = this.machine_id || 0;
      var user_id = _UserService.default.getUserInfo().id || 0;
      var _this = this;
      wx.request({
        url: _Env.default.getDevBaseURL() + '/api/AliossSign/getSign',
        method: 'GET',
        data: '',
        header: {
          'content-type': 'application/x-www-form-urlencoded',
          'Accept': 'application/json'
        },
        success: function success(res) {
          //这里是进度条
          _this.percent = 0;
          var atter = res.data;
          var time = new Date().getTime() + Math.floor(Math.random() * 1000 + 1);
          var Imagecensor = '';
          var uploadTask = uni.uploadFile({
            url: atter.host.replace("http:", "https:"),
            filePath: tempFilePaths[i],
            name: 'file',
            formData: {
              'key': atter.dir + time + '.' + formatImage,
              'OSSAccessKeyId': atter.accessid,
              'policy': atter.policy,
              'Signature': atter.signature,
              'success_action_status': '200',
              'callback': atter.callback
            },
            success: function success(res) {
              successUp++;
              if (res.statusCode != 200) {
                return;
              }
              if (res.statusCode == 200) {
                var host = atter.host.replace("http:", "https:");
                Imagecensor = host + '/' + atter.dir + time + '.' + formatImage;
                if (formatImage == "tiff" || formatImage == "tif") {
                  Imagecensor = Imagecensor + "?x-oss-process=image/format,png";
                }
                console.log(Imagecensor);
                _this.percent = 100;
                uni.showToast({
                  title: _this.$i18n.messages[_this.$i18n.locale]['上传成功'],
                  icon: 'none',
                  duration: 3000
                });
                _this.testingImage(tempFilePaths[i], Imagecensor);
              }
            },
            fail: function fail(err) {
              failUp++;
              _this.percent = 100;
              wx.showToast({
                title: _this.$i18n.messages[_this.$i18n.locale]['上传失败'],
                icon: 'none',
                duration: 1200
              });
            },
            complete: function complete(err) {}
          });
          uploadTask.onProgressUpdate(function (res) {
            _this.percent = res.progress - 1;
          });
        }
      });
    },
    testingImage: function testingImage(tempFilePaths, Imagecensor) {
      var _this = this;
      uni.getImageInfo({
        src: Imagecensor,
        success: function success(image) {
          var width = 0;
          var height = 0;
          var top = 0;
          var lef = 0;
          var ratio = image.width / image.height;
          var ratiowidth = _this.data.editorWidth * _this.mix_scale / image.width;
          var ratioheight = _this.data.editorHeight * _this.mix_scale / image.height;
          height = _this.data.editorHeight * _this.mix_scale;
          width = image.width * ratioheight;
          //width = _this.data.editorWidth * _this.mix_scale
          //height = image.height * ratiowidth
          var index = items.length;
          items.push({
            id: index + 1,
            type: 0,
            //0为图片,1为文字,2为素材
            material_id: 0,
            original_id: 0,
            index: index,
            font_family: '',
            font_style: '',
            font_size: '',
            font_color: '',
            under_color: '',
            content: Imagecensor,
            // 图片地址
            top: _this.editor_top - height / 2,
            // 初始图片Y坐标,根据画布高/2-图片高/2
            left: _this.data.editorWidth / 2 - width / 2,
            // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
            x: _this.data.editorWidth / 2,
            // 初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
            y: _this.editor_top,
            scale: 1,
            // 缩放比例  1为不缩放
            lastScale: 1,
            // 上一次的绽放比例
            oScale: 1,
            // 缩放比例  1为不缩放
            angle: 0,
            // 旋转角度
            rotate: 0,
            // 旋转值
            active: false,
            // 判定点击状态
            width: width,
            // 预设生成图片的宽度
            height: height,
            // 预设生成图片的高度
            rScale: 1,
            // 图片原始缩放比例
            activeguide: false,
            // 开启辅助线
            activescale: false,
            // 开启旋转状态
            activehorn: false,
            // 开启角状态
            activeedge: false,
            // 开启边状态
            initialScale: 1,
            // 图片缩放比例
            initialscaling: 1,
            // 图片初始时缩放比例
            initialScalex: 1,
            // 图片宽缩放比例
            initialScaley: 1,
            // 图片高缩放比例
            initialWidth: width,
            // 图片原始宽度
            initialHeight: height,
            // 图片原始高度
            frame_left: null,
            // 裁剪窗口x
            image_left: null,
            // 图片x
            frame_top: null,
            // 裁剪窗口y
            image_top: null,
            // 图片y
            isUpLoadImage: true
          });
          _this.isUpLoadImage = false;
          _this.data.itemList = items;
          _this.saveSnapshot();
        }
      });
    },
    /**
     * 新增部件
     */
    addItem: function () {
      var _addItem = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(e) {
        var _this17 = this;
        var _this;
        return _regenerator.default.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _this = this;
                this.isUpLoadImage = true;
                uni.chooseImage({
                  sizeType: ['original'],
                  //可以指定是original原图还是compressed压缩图,默认二者都有
                  sourceType: ['camera', 'album'],
                  //从相册选择
                  count: 1,
                  success: function success(res) {
                    var tempFilePaths = res.tempFilePaths;
                    var size = res.tempFiles[0].size;
                    var path = res.tempFiles[0].path ? res.tempFiles[0].path : res.tempFiles[0].name;
                    var name = res.tempFiles[0].name;
                    var formatImage = name.split(".")[name.split(".").length - 1];
                    _this17.uploadDIY(tempFilePaths, 0, 0, 0, tempFilePaths.length, formatImage);
                  }
                });
                this.selectPicturePopColse();
              case 4:
              case "end":
                return _context2.stop();
            }
          }
        }, _callee2, this);
      }));
      function addItem(_x2) {
        return _addItem.apply(this, arguments);
      }
      return addItem;
    }(),
    //移除图片
    removedeleteItem: function removedeleteItem(item, ix) {
      index = items.length - 1;
      items.splice(index, 1); // 删除指定的部件
      this.setData({
        'data': this.data
      });
      this.saveSnapshot();
    },
    /*删除部件 */deleteItem: function deleteItem(item, ix) {
      var currentItem = items[index]; // 当前选中的部件
      if (currentItem) {
        if (currentItem.works_id) {
          // 判断删除的是否是模板组件
          this.data.works_idlenght--;
        }
      }
      if (currentItem.works_id) {
        // 判断删除的是否是模板组件
        this.data.works_idlenght--;
      }
      var zIndex = items[index].index;
      var zid = items[index].id;
      //删除指定的部件
      items.splice(index, 1);
      //后面的部件index需要减1
      var _iterator3 = _createForOfIteratorHelper(items),
        _step3;
      try {
        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
          var item = _step3.value;
          if (item.index > zIndex) {
            item.index = item.index - 1;
          }
        }
      } catch (err) {
        _iterator3.e(err);
      } finally {
        _iterator3.f();
      }
      var _iterator4 = _createForOfIteratorHelper(items),
        _step4;
      try {
        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
          var item = _step4.value;
          if (item.id > zid) {
            item.id = item.id - 1;
          }
        }
      } catch (err) {
        _iterator4.e(err);
      } finally {
        _iterator4.f();
      }
      this.data.itemList = items;
      this.setData({
        'data': this.data
      });
      this.saveSnapshot();
      this.active = false;
    },
    /* 检测文字的输入 */textInput: function textInput(content) {
      if (content == undefined) {
        return;
      }
      if (this.addtext) {
        var index_id = items.length;
        items.push({
          id: index_id + 1,
          type: 1,
          material_id: 0,
          index: index_id,
          font_family: 'SOURCEHANSANSCN-REGULAR.OTF',
          font_style: '',
          font_size: '50',
          font_color: '#000000',
          under_color: '',
          content: content,
          // 文本
          top: this.editor_top - 74 / 2,
          // 初始图片Y坐标,根据画布高/2-图片高/2
          left: 0,
          // 初始图片X坐标,因为div是相对定位,所以计算是要多减一次移动的距离
          x: this.data.editorWidth / 2,
          // 初始圆心位置,可再downImg之后又宽高和初始的图片位置得出
          y: this.editor_top,
          scale: 1,
          // 缩放比例  1为不缩放
          lastScale: 1,
          // 上一次的绽放比例
          oScale: 1,
          // 缩放比例  1为不缩放
          fontscale: 1,
          // 文本缩放比例  1为不缩放
          angle: 0.00,
          // 旋转角度
          rotate: 0.00,
          // 旋转值
          active: false,
          // 判定点击状态
          width: this.data.editorWidth,
          // 预设生成图片的宽度
          height: 74,
          // 预设生成图片的高度
          rScale: 1 // 图片原始缩放比例
        });

        this.data.itemList = items;
        this.addtext = false;
        this.saveSnapshot();
        index = items.length - 1;
        this.data.cidx = index;
        this.setData({
          data: this.data
        });
        this.text_awaitone(content);
      } else {
        this.text_await(content);
      }
    },
    text_awaitone: function text_awaitone(content) {
      var _this18 = this;
      return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
        var item, that, query;
        return _regenerator.default.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                //获取当前选中的部件
                item = items[index];
                item.content = content;
                that = _this18; //赋值
                _this18.data.currentText = content;
                _this18.data.itemList = items;
                _context3.next = 7;
                return _this18.setData({
                  data: _this18.data
                });
              case 7:
                query = uni.createSelectorQuery();
                query.select('#item-text').boundingClientRect();
                setTimeout(function () {
                  query.exec(function (res) {
                    var width = res[0].width;
                    var rate = item.width / width;
                    var tmpSize = item.font_size * rate;
                    if (tmpSize > maxFontSize) {
                      item.font_size = maxFontSize;
                      item.height = maxFontSize * heightRate;
                      item.top = item.y - item.height / 2;
                    } else {
                      item.font_size = item.font_size * rate;
                      item.height = item.height * rate;
                      item.top = item.y - item.height / 2;
                    }
                    that.setData({
                      data: that.data
                    });
                    that.data.itemList = items;
                  });
                }, 500);
              case 10:
              case "end":
                return _context3.stop();
            }
          }
        }, _callee3);
      }))();
    },
    text_await: function text_await(content) {
      var _this19 = this;
      return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
        var item, that, query;
        return _regenerator.default.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                // 获取当前选中的部件
                item = items[index];
                if (!(content != item.content)) {
                  _context4.next = 11;
                  break;
                }
                item.content = content;
                that = _this19; //赋值
                _this19.data.currentText = content;
                _this19.data.itemList = items;
                _context4.next = 8;
                return _this19.setData({
                  data: _this19.data
                });
              case 8:
                query = uni.createSelectorQuery();
                query.select('#item-text').boundingClientRect();
                setTimeout(function () {
                  query.exec(function (res) {
                    var width = res[0].width;
                    var rate = item.width / width;
                    var tmpSize = item.font_size * rate;
                    if (tmpSize > maxFontSize) {
                      item.font_size = maxFontSize;
                      item.height = maxFontSize * heightRate;
                      item.top = item.y - item.height / 2;
                    } else {
                      item.font_size = item.font_size * rate;
                      item.height = item.height * rate;
                      item.top = item.y - item.height / 2;
                    }
                    that.setData({
                      data: that.data
                    });
                    that.data.itemList = items;
                  });
                }, 500);
              case 11:
              case "end":
                return _context4.stop();
            }
          }
        }, _callee4);
      }))();
    },
    /**
     * 保存当前作品的快照
     */
    saveSnapshot: function saveSnapshot() {
      var currentSnapshot = JSON.stringify(this.data);
      var lastSnapshot = "";
      if (snapshot.length > 0) {
        lastSnapshot = JSON.stringify(snapshot[snapshotIndex]);
      }
      if (currentSnapshot != lastSnapshot) {
        //清除当前步骤后面的所有步骤
        if (snapshot.length > 0 && snapshot.length - 1 > snapshotIndex) {
          for (var i = snapshotIndex + 1; i < snapshot.length; i++) {
            snapshot.pop();
          }
        }
        //加入快照
        snapshot.push(currentSnapshot);
        snapshotIndex = snapshotIndex + 1;
      }
    },
    //上一步功能
    prev: function prev() {
      if (snapshotIndex > 0) {
        snapshotIndex = snapshotIndex - 1;
        this.data = JSON.parse(snapshot[snapshotIndex]);
        items = this.data.itemList;
        index = this.data.cidx;
      } else {
        // wx.showToast({title: this.language.phonefirststep,icon: 'success',duration: 2000});
      }
    },
    //下一步
    next: function next() {
      if (snapshotIndex < snapshot.length - 1) {
        snapshotIndex = snapshotIndex + 1;
        this.data = JSON.parse(snapshot[snapshotIndex]);
        items = this.data.itemList;
        index = this.data.cidx;
      } else {
        // wx.showToast({title: this.language.phonenextstep,icon: 'success',duration: 2000});
      }
    },
    setData: function setData(obj) {
      var that = this;
      var keys = [];
      var val, data;
      Object.keys(obj).forEach(function (key) {
        keys = key.split('.');
        val = obj[key];
        data = that.$data;
        keys.forEach(function (key2, index) {
          if (index + 1 == keys.length) {
            that.$set(data, key2, val);
          } else {
            if (!data[key2]) {
              that.$set(data, key2, {});
            }
          }
          data = data[key2];
        });
      });
    },
    //获取自定义产品详情数据
    getCustomDetail: function getCustomDetail() {
      var _this20 = this;
      this.data.bgImage = null;
      if (this.data.goods_id) {
        this.front_image_long = false;
        _homeservice.default.queryListPhone({
          s: 'Product.getCustomize',
          id: this.data.goods_id
        }).then(function (result) {
          _this20.queryPage.goods_category_id = result.goods_category_id; //星形接口列表增加,产品分类参数
          //读取背景图
          uni.getImageInfo({
            src: result.front_image_old,
            success: function success(front_image) {
              _this20.data.bgHeight = front_image.height * (_this20.data.bgWidth / front_image.width); // 画布高度
              _this20.editory = result.center_scale * (_this20.data.bgWidth / front_image.width); //辅助线距离
              _this20.front_image_long = true;
            }
          });
          _this20.isCustomizeComplete = true;
          _this20.titlename = _this20.options.name;
          uni.setNavigationBarTitle({
            title: _this20.titlename
          }); //修改头部名称
          _this20.data.bgImage = result.front_image_old; // 背景图
          _this20.data.bgImage_old = result.front_image_old; // 旧背景图
          if (_this20.$base.surfaceData.surface_type == 0) {
            //默认
            _this20.background_surface_color = result.design_color; //定制壳手机壳底色
          }

          _this20.$base.goods_feature_id = result.goods_feature_id;
          _this20.mix_scale = result.mix_scale; //上传图片比率
          _this20.design_height = result.design_height; // 设计宽度
          _this20.design_width = result.design_width; // 设计高度
          _this20.print_height = result.print_height; // 设计基础宽度
          _this20.print_width = result.print_width; // 设计基础高度
          _this20.design_widthrate = result.design_width / result.print_width; // 设计区放大宽度比率
          _this20.design_heightrate = result.design_height / result.print_height; // 设计区放大高度比率
          _this20.data.editorWidth = _this20.design_width * _this20.data.pixelRate; // 设计宽度
          _this20.data.editorHeight = _this20.design_height * _this20.data.pixelRate; // 设计高度
          _this20.center_scale = result.center_scale; // 设计区中心点比率
          _this20.location_scale = result.location_scale; // 辅助线比率
          _this20.editor_top = _this20.data.editorHeight * Number(_this20.location_scale); //辅助线距离
          var scaleWidth = _this20.data.editorWidth / 100;
          var scaleHeight = _this20.data.editorHeight / 185;
          _this20.real_print_height = _this20.options.HeightIndex / 3 * scaleWidth; // 设计宽度
          _this20.real_print_width = _this20.options.WidthIndex / 3 * scaleHeight;
          _this20.clipLeft = (Number(_this20.data.editorWidth) - _this20.real_print_width) / 2;
          _this20.clipRight = _this20.clipLeft;
          _this20.clipTop = (_this20.data.editorHeight - _this20.real_print_height) / 2;
          _this20.clipButtom = _this20.clipTop;
          _this20.filletSize = _this20.options.fillet / 3 * scaleWidth;
          if (snapshot.length > 0) {
            var listSnapshot = [];
            snapshot.forEach(function (item, index) {
              var list = JSON.parse(item);
              list.bgImage = _this20.data.bgImage;
              list.bgImage_old = _this20.data.bgImage_old;
              list.goods_id = _this20.data.goods_id;
              listSnapshot.push(JSON.stringify(list));
            });
            snapshot = listSnapshot;
          }
        }).catch(function (err) {});
      }
    },
    //获取产品详情数据
    goodslist: function goodslist() {
      var _this21 = this;
      this.data.bgImage = null;
      if (this.data.goods_id) {
        this.front_image_long = false;
        _homeservice.default.queryListPhone({
          s: 'Product.detail',
          id: this.data.goods_id
        }).then(function (result) {
          _this21.queryPage.goods_category_id = result.goods_category_id; //星形接口列表增加,产品分类参数
          //读取背景图
          uni.getImageInfo({
            src: result.front_image_old,
            success: function success(front_image) {
              _this21.data.bgHeight = front_image.height * (_this21.data.bgWidth / front_image.width); // 画布高度
              _this21.editory = result.center_scale * (_this21.data.bgWidth / front_image.width); //辅助线距离
              _this21.front_image_long = true;
            }
          });
          _this21.titlename = result.alias_name;
          uni.setNavigationBarTitle({
            title: result.alias_name
          }); //修改头部名称
          _this21.data.bgImage = result.front_image; // 背景图
          _this21.data.bgImage_old = result.front_image; // 旧背景图
          if (_this21.$base.surfaceData.surface_type == 0) {
            //默认
            _this21.background_surface_color = result.design_color; //定制壳手机壳底色
          }

          _this21.mix_scale = result.mix_scale; //上传图片比率
          _this21.design_height = result.design_height; // 设计宽度
          _this21.design_width = result.design_width; // 设计高度
          _this21.print_height = result.print_height; // 设计基础宽度
          _this21.print_width = result.print_width; // 设计基础高度
          _this21.design_widthrate = result.design_width / result.print_width; // 设计区放大宽度比率
          _this21.design_heightrate = result.design_height / result.print_height; // 设计区放大高度比率
          _this21.data.editorWidth = _this21.design_width * _this21.data.pixelRate; // 设计宽度
          _this21.data.editorHeight = _this21.design_height * _this21.data.pixelRate; // 设计高度
          _this21.center_scale = result.center_scale; // 设计区中心点比率
          _this21.location_scale = result.location_scale; // 辅助线比率
          _this21.editor_top = _this21.data.editorHeight * Number(_this21.location_scale); //辅助线距离
          if (snapshot.length > 0) {
            var listSnapshot = [];
            snapshot.forEach(function (item, index) {
              var list = JSON.parse(item);
              list.bgImage = _this21.data.bgImage;
              list.bgImage_old = _this21.data.bgImage_old;
              list.goods_id = _this21.data.goods_id;
              listSnapshot.push(JSON.stringify(list));
            });
            snapshot = listSnapsho;
          }
        }).catch(function (err) {});
      }
    },
    category: function category() {
      var _this22 = this;
      //查询贴图分类 key=0贴图
      _homeservice.default.queryListPhone({
        s: 'Material.category',
        machine_id: this.machine_id || null,
        key: 0,
        surface_color_series_id: this.$base.surfaceData.surface_color_series_id //色系编号
      }).then(function (result) {
        _this22.Material_category = result;
      }).catch(function (err) {});
      //查询壁纸分类 key=1壁纸
      _homeservice.default.queryListPhone({
        s: 'Material.category',
        machine_id: this.machine_id,
        key: 1,
        surface_color_series_id: this.$base.surfaceData.surface_color_series_id //色系编号
      }).then(function (result) {
        _this22.wallpaper_category = result;
      }).catch(function (err) {});
    },
    getmachine_id: function getmachine_id() {
      this.available = this.machineDetail.available;
      this.support_paypal = this.machineDetail.support_paypal;
      if (this.support_paypal = 1) {
        this.getMachineStock();
      }
    },
    //获取库存与优惠券信息
    getMachineStock: function getMachineStock() {
      var _this23 = this;
      _homeservice.default.queryListPhone({
        s: 'Machine.getMachineStock',
        machine_id: this.machine_id,
        key: "3"
      }).then(function (result) {
        _this23.coupon = result.coupon;
        _this23.sizetext_id = _this23.$base.lockInventory.id;
        _this23.sizetext = _this23.$base.lockInventory.goods_size;
        _this23.sizestock = _this23.$base.lockInventory.stock;
        _this23.channel_no = _this23.$base.lockInventory.channel_no;
        _this23.dict_id = _this23.$base.lockInventory.dict_id;
      }).catch(function (err) {});
    },
    itemlongtap: function itemlongtap(e) {//长按事件
    },
    itemTouchStart: infoListTouchEvent.start.bind(infoListTouchEvent),
    itemTouchMove: infoListTouchEvent.move.bind(infoListTouchEvent),
    itemTouchEnd: infoListTouchEvent.end.bind(infoListTouchEvent),
    itemTouchCancel: infoListTouchEvent.cancel.bind(infoListTouchEvent),
    //鼠标边框移动
    edgeMouseStart: function edgeMouseStart(e, type) {
      this.isMouseMove = true;
      var item = items[index]; //获取当前选中的部件
      item.typetext = type; //判断边框
      //获取作为移动前坐标
      item.edgestartX = e.clientX;
      item.edgestartY = e.clientY;
      //获取编辑框的左边距和上边距
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      item.mLeft = mLeft;
      item.mTop = mTop;
      //记录按下事件
      _drag.default.recordPressDownData(item);
      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
      ;
      var that = this;
      document.onmousemove = function (e) {
        _drag.default.edgeMove(e, item, that.data, that.allLineListData, that.data.editorWidth, that.data.editorHeight);
      };
      document.onmouseup = function (e) {
        document.onmousemove = null;
        document.onmouseup = null;
        that.edgeMouseEnd();
        setTimeout(function () {
          that.isMouseMove = false;
        }, 100);
      };
    },
    edgeMouseEnd: function edgeMouseEnd() {
      var item = items[index]; // 获取当前选中的部件
      var that = this;
      setTimeout(function () {
        item.typetext = null;
        //属性
        item.active = true; //辅助线
        item.activeguide = false; //辅助线
        item.activescale = true; // 旋转状态
        item.activehorn = true; // 角状态
        item.activeedge = true; // 边状态
        that.guide_left = false;
        that.active = true;
      }, 0);
      //赋值
      _drag.default.getTransferPosition(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
      this.saveSnapshot();
    },
    itemMouseDown: function itemMouseDown(e) {
      this.isMouseMove = true;
      var item = items[index];
      this.isRotate = false;
      this.dragStart(e);
      this.deleteWrap = false;
      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
      ;
      var that = this;
      document.onmousemove = function (e) {
        var item = items[index];
        if (item.support_drag == 0) return; // 0不支持拖动,1支持拖动
        if (!that.isRotate) {
          that.dragMouseMove(e);
        }
      };
      document.onmouseup = function (e) {
        document.onmousemove = null;
        document.onmouseup = null;
        that.itemMouseUp(e);
        setTimeout(function () {
          that.isMouseMove = false;
        }, 100);
      };
    },
    //鼠标双击事件
    mouseDoubleClick: function mouseDoubleClick() {
      var item = items[index];
      if (item != null && item.type == 0) {
        //this.showCropView();
      }
    },
    //显示裁剪图片按钮
    showCropView: function showCropView() {
      /* var selectItem = items[index]
      let that = this;
      setTimeout(() => {
      	that.properties = selectItem
      	that.state = true;
      	that.$refs.index.init();
      }, 0); */
    },
    //图片拖动中事件
    dragMouseMove: function dragMouseMove(e) {
      var item = items[index];
      _drag.default.dragMove(e, item, this.data, this.editor_top, this.allLineListData);
      this.guide_left = true; // 开启辅助线
      this.guide_top = true; // 开启辅助线
      this.delete_wrap_state = true;
      this.deleteTop = this.data.windowHeight - 70;
      if (e.pageY - 10 > this.deleteTop) {
        //如果图片容器底部距离大于删除框顶部距离就删除图片
        this.deleteWrap = true;
      } else {
        this.deleteWrap = false;
      }
      //赋值就移动了
      this.data.itemList = items;
    },
    itemMouseUp: function itemMouseUp(e) {
      var item = items[index];
      this.dragEnd(e);
      if (item.scale != 1) {
        _drag.default.initPosscale(item);
        _drag.default.getTransferPositionangle(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
        item.scale = 1;
        item.lastScale = 1;
        //图片放大响应的右下角按钮同比缩小
        item.oScale = 1 / item.scale;
      }
      _drag.default.getConterScale(item);
      if (this.deleteWrap == true) {
        this.deleteItem();
        this.deleteWrap = false;
      } else {
        var that = this;
        setTimeout(function () {
          item.isDrag = true;
          item.active = true; //选中状态
          item.activeguide = false; // 辅助线状态
          item.activescale = true; // 旋转状态
          item.activehorn = true; // 角状态
          item.activeedge = true; // 边状态,400);
          that.guide_left = false;
          that.active = true;
        }, 0);
      }
    },
    //鼠标部件缩放开始事件
    scaleMouseStart: function scaleMouseStart(e, type) {
      this.isMouseMove = true;
      this.itemClick(e); // 点击选中部件
      var item = items[index]; // 获取当前选中的部件
      if (item.support_zoom == 0) return; // 0不支持缩放,1时支持缩放
      item.typetext = type;
      item.touchX = e.clientX;
      item.touchY = e.clientY;
      //获取图片半径
      item.r = this.computeDistance(item.x, item.y, item.left, item.top);
      //获取编辑框的左边距和上边距
      var mLeft = this.getLeft();
      var mTop = this.getTop();
      item.mLeft = mLeft;
      item.mTop = mTop;
      _drag.default.recordPressDownData(item);
      //赋值
      this.data.listActive = true;
      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
      ;
      var that = this;
      document.onmousemove = function (e) {
        //获取当前选中的部件
        _drag.default.scaleMove(e, item, that.data, that.allLineListData, that.data.editorWidth, that.data.editorHeight);
      };
      document.onmouseup = function (e) {
        //鼠标抬起后,取消按下和抬起事件
        document.onmousedown = null;
        document.onmousemove = null;
        that.scaleMouseEnd();
        setTimeout(function () {
          that.isMouseMove = false;
        }, 100);
      };
    },
    //部件缩放结束事件
    scaleMouseEnd: function scaleMouseEnd(e) {
      var item = items[index]; // 获取当前选中的部件
      if (item.support_zoom == 0) return; // 0不支持缩放,1时支持缩放
      var that = this;
      setTimeout(function () {
        item.typetext = null;
        item.isDrag = true;
        item.active = true; //选中状态
        item.activeguide = false; // 辅助线状态
        item.activescale = true; // 旋转状态
        item.activehorn = true; // 角状态
        item.activeedge = true; // 边状态,400);
        that.guide_left = false;
        that.active = true;
      }, 0);
      _drag.default.getTransferPosition(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
      this.data.itemList = items;
      this.$set(this.data.itemList, index, item);
      this.saveSnapshot();
    },
    //鼠标部件旋转开始事件
    rotateMouseStart: function rotateMouseStart(e) {
      this.isMouseMove = true;
      //点击选中部件
      this.itemClick(e);
      // 获取当前选中的部件
      var item = items[index];
      item.typetext = 'rotate';
      //记录中心位置
      item.centerPos = {
        x: item.left + item.width / 2,
        y: item.top + item.height / 2
      };
      item.x = item.centerPos.x;
      item.y = item.centerPos.y;
      //获取作为移动前角度的坐标
      item.touchX = e.clientX;
      item.touchY = e.clientY;
      //获取编辑框的左边距和上边距
      var distanceX = (this.windowWidth - this.$base.isPcWidth) / 2 + this.$base.isPcWidth / 2 - this.data.editorWidth / 2;
      var distanceY = (this.data.windowHeight - this.data.editorHeight) / 2;
      var mLeft = item.left;
      var mTop = item.top;
      //移动前的角度
      item.anglePre = item.angle;
      //获取图片半径
      item.r = this.computeDistance(item.x, item.y, item.left, item.top);
      //赋值
      this.data.listActive = true;
      if (e.preventDefault) {
        e.preventDefault();
      } else {
        e.returnValue = false;
      }
      ;
      var that = this;
      document.onmousemove = function (e) {
        var item = items[index];
        item.touchMoveX = e.clientX;
        item.touchMoveY = e.clientY;
        var cx = item.x + distanceX;
        var cy = item.y + distanceY;
        var c1 = Math.atan2(item.touchY - cy, item.touchX - cx) * 180 / Math.PI;
        var c2 = Math.atan2(item.touchMoveY - cy, item.touchMoveX - cx) * 180 / Math.PI;
        var angleC;
        c1 = c1 <= -90 ? 360 + c1 : c1;
        c2 = c2 <= -90 ? 360 + c2 : c2;
        //夹角获取
        angleC = Math.floor(c2 - c1);
        angleC = angleC < 0 ? angleC + 360 : angleC;
        var startAngle = item.anglePre;
        var deg, rotate;
        //顺时针旋转
        if (item.touchMoveX - item.touchX > 0) {
          deg = startAngle + angleC;
          rotate = deg > 360 ? deg - 360 : deg;
        } else {
          //逆时针旋转
          angleC = 360 - angleC;
          deg = startAngle - angleC;
          rotate = deg < 0 ? deg + 360 : deg;
        }
        item.rotate = rotate;
        item.angle = item.rotate; //赋值
        var roat = Math.abs(item.angle) % 360;
        if (item.angle < 0) {
          var multiple = Math.ceil(Math.abs(item.angle) / 360);
          roat = item.angle + multiple * 360;
        }
        if (roat <= 5 || roat >= 355) {
          item.angle = 0.00;
        } else if (roat <= 50 && roat >= 40) {
          item.angle = 45;
        } else if (roat <= 95 && roat >= 85) {
          item.angle = 90;
        } else if (roat <= 140 && roat >= 130) {
          item.angle = 135;
        } else if (roat <= 185 && roat >= 175) {
          item.angle = 180;
        } else if (roat <= 230 && roat >= 220) {
          item.angle = 225;
        } else if (roat <= 275 && roat >= 265) {
          item.angle = 270;
        } else if (roat <= 320 && roat >= 310) {
          item.angle = 315;
        }
        that.data.itemList = items;
      };
      document.onmouseup = function (e) {
        document.onmousemove = null;
        document.onmouseup = null;
        that.rotateMouseEnd();
        setTimeout(function () {
          that.isMouseMove = false;
        }, 100);
      };
    },
    //鼠标部件旋转结束事件
    rotateMouseEnd: function rotateMouseEnd(e) {
      var item = items[index]; // 获取当前选中的部件
      var that = this;
      item.typetext = null;
      setTimeout(function () {
        item.typetext = null;
        item.activeguide = false; // 辅助线状态
        item.activescale = true; // 旋转状态
        item.activehorn = true; // 角状态
        item.activeedge = true; // 边状态
        that.isDrag = true;
        that.active = true;
        that.activeedge = true; // 边状态,400);
        that.guide_left = false;
      }, 0);
      this.data.itemList = items;
      this.$set(this.data.itemList, index, item);
      this.saveSnapshot();
    }
  },
  onLoad: function onLoad(options) {
    var that = this;
    this.options = options;
    items = [];
    this.infoListTouchEvent = infoListTouchEvent;
    this.infoListTouchEvent.bind({
      doubleTap: function doubleTap(e) {//双击事件
        /* if (items[index].type == 0) {
        	that.state = true
        	that.$refs.index.init();
        } */
      },
      tap: function tap(e) {
        if (items == null || items.length == 0) {
          that.active = false;
          that.guide_left = false;
        } else {
          that.itemClick(e);
          // var curTime = e.timeStamp
          // var lastTime = e.currentTarget.dataset.time //通过e.currentTarget.dataset.time 访问到绑定到该组件的自定义数据
          // if (curTime - lastTime > 0) {
          // 	if (curTime - lastTime < 300) { //是双击事件
          // 		if (items[index].type == 0) {
          // 			that.state = true
          // 			that.$refs.index.init();
          // 		}
          // 	} else {
          // 		//点击选中部件
          // 		that.itemClick(e);
          // 	 }
          // }
          //that.lastTapTime = curTime
        }
      },

      touchStart: function touchStart(e) {
        that.isRotate = e.touches.length > 1;
        that.dragStart(e);
        //底部删除框出现动画
        that.animation.bottom(0).step();
        that.setData({
          animationData: that.animation.export()
        });
        that.deleteWrap = false;
      },
      touchEnd: function touchEnd(e) {
        that.dragEnd(e);
        var item = items[index];
        if (item.scale != 1) {
          //初始化的位置
          _drag.default.initPosscale(item);
          _drag.default.getTransferPositionangle(item.left, item.top, item.width, item.height, item.angle, item.centerPos, item);
          //缩放
          item.scale = 1;
          item.lastScale = 1;
          //图片放大响应的右下角按钮同比缩小
          item.oScale = 1 / item.scale;
        }
        //底部删除框出现动画
        that.animation.bottom(-100).step();
        that.setData({
          animationData: that.animation.export()
        });
        if (that.deleteWrap == true) {
          that.deleteItem();
          that.deleteWrap = false;
        }
      },
      touchCancel: function (e) {}.bind(this),
      rotate: function (e) {
        var item = items[index];
        var oldWidth = item.width * item.scale * e.scale;
        if (oldWidth > 1500) {
          return;
        }
        var newScale = Math.max(e.scale * item.lastScale, .01);
        newScale || (newScale = item.lastScale);
        item.rotate += e.angle;
        item.angle = item.rotate;
        item.scale = newScale;
        item.oScale = 1 / item.scale;
        item.active = false; //辅助线
        item.activeguide = true; //开启辅助线
        item.activescale = false; // 旋转状态
        item.activehorn = false; // 角状态
        item.activeedge = false; // 边状态
        this.data.itemList = items;
      }.bind(this),
      pressMove: function pressMove(e) {
        if (!that.isRotate) {
          that.dragMove(e);
        }
      }
    });
    if (options.machineDetail != undefined && options.machineDetail != "") {
      this.machineDetail = JSON.parse(options.machineDetail); //获取设备详情数据
      this.diy_upload_menu = this.machineDetail.diy_upload_menu;
      this.support_juhe = this.machineDetail.support_juhe; //聚合支付
    }

    if (options.type) {
      if (options.type == 3) {
        this.isCustomize = true;
        this.translateX = 0;
      } else {
        this.isCustomize = false;
        this.translateX = -400;
      }
    }
    if (options.machine_id != undefined) {
      // 判断是从设备进来
      this.machine_id = options.machine_id; // 设备id
      this.queryPage.machine_id = options.machine_id; // 设备id
    }
    //获取屏幕宽高
    uni.getSystemInfo({
      success: function success(res) {
        that.isShowPc = that.$tool.isPc();
        that.windowWidth = res.windowWidth;
        if (that.isShowPc) {
          res.windowWidth = that.$base.isPcWidth;
        }
        var pixelRate = res.windowWidth / 800;
        that.data.windowWidth = res.windowWidth; // 屏幕宽度
        that.data.windowHeight = res.windowHeight; // 屏幕高度
        that.data.bgWidth = res.windowWidth; // 画布宽度
        that.data.bgHeight = res.windowHeight * (861 / 1196);
        that.data.pixelRate = pixelRate; // 屏幕宽度比率
        if (options.works_id == undefined) {
          if (options.machine_id != undefined && options.machine_id != 'undefined') {
            // 判断是从设备进来
            that.data.goods_id = options.goods_id; // 商品id
            that.sn = options.sn;
            that.dict_id = options.dict_id; // //产品属性id
            that.createWorkstext = '下单';
            try {
              var base = uni.getStorageSync('base');
              if (base) {
                that.$base = base;
              }
            } catch (e) {}
            ;
            that.surface_type = that.$base.surfaceData.surface_type;
            that.surfaceName = that.$base.surfaceData.surfaceName;
            if (that.$base.surfaceData.surface_type == 0) {
              //默认
              that.background_color = null; //手机底色
              that.background_surface_color = null; //定制壳手机壳底色
            }

            if (that.$base.surfaceData.surface_type == 1) {
              //自带壳
              that.background_color = that.$base.surfaceData.surface_color_id_text; //手机底色 
              that.background_surface_color = null; //定制壳手机壳底色
              items = []; // 当前显示的图片列表
              index = 0; // 所点击的图片的索引
              snapshot = []; // 操作历史记录清空
              snapshotIndex = -1;
            }
            if (that.$base.surfaceData.surface_type == 2) {
              //定制壳
              that.background_color = 'none'; //手机底色 
              that.background_surface_color = that.$base.surfaceData.surface_color; //定制壳手机壳底色
            }

            if (that.isCustomize) {
              that.getCustomDetail();
              that.getmachine_id(); // 判断设备是否正常
            } else {
              that.goodslist(); // 获取产品详情数据
              that.getmachine_id(); // 判断设备是否正常
            }
          } else {
            //首页进入-默认背景图
            that.data.goods_id = options.goods_id ? options.goods_id : 21; // 商品id
            that.createWorkstext = '保存';
            that.goodslist(); // 获取产品详情数据
          }
          //作品分类 贴图分类
          that.category();
        }
      }
    });
    //保存到全局变量,以后每次移动或者旋转缩放都先保存到该变量,结束时再setData
    items = this.data.itemList;
    this.getMachineStock();
  },
  onShow: function onShow() {
    this.isShowPc = this.$tool.isPc();
    if (this.options && this.options != null) {
      if (this.options.type == 3) {
        this.isCustomize = true;
        this.data.goods_id = this.options.goods_id; // 商品id
      }
    }

    if (this.isCustomize) {
      if (!this.isUpLoadImage) {
        this.getCustomDetail();
      }
    }
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease'
    });
    this.animation = animation;
    this.getMachineStock();
  },
  //卸载程序
  onUnload: function onUnload() {
    items = []; // 当前显示的图片列表
    index = 0; // 所点击的图片的索引
    snapshot = []; // 操作历史记录
    snapshotIndex = -1;
    _homeservice.default.setSnapshot(items);
    uni.reLaunch({
      url: '/pages/index/detailsphone?machine_id=' + this.queryPage.machine_id
    });
  }
};
exports.default = _default;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"], __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/wx.js */ 1)["default"]))

/***/ }),

/***/ 295:
/*!********************************************************************************************************************!*\
  !*** C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=style&index=0&lang=scss& ***!
  \********************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-2!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src??ref--8-oneOf-1-3!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-5!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!../../../../../../工具/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./index_phone.vue?vue&type=style&index=0&lang=scss& */ 296);
/* harmony import */ var _HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));
 /* harmony default export */ __webpack_exports__["default"] = (_HBuilderX_plugins_uniapp_cli_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_HBuilderX_plugins_uniapp_cli_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_loaders_stylePostLoader_js_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_2_HBuilderX_plugins_uniapp_cli_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_3_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_sass_loader_dist_cjs_js_ref_8_oneOf_1_4_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_webpack_preprocess_loader_index_js_ref_8_oneOf_1_5_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_vue_cli_plugin_uni_packages_vue_loader_lib_index_js_vue_loader_options_HBuilderX_plugins_uniapp_cli_node_modules_dcloudio_webpack_uni_mp_loader_lib_style_js_index_phone_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default.a); 

/***/ }),

/***/ 296:
/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-2!./node_modules/postcss-loader/src??ref--8-oneOf-1-3!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--8-oneOf-1-5!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!C:/workplay/workplay/workplay/kxz-app-phone-h5/pages/index/index_phone.vue?vue&type=style&index=0&lang=scss& ***!
  \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin
    if(false) { var cssReload; }
  

/***/ })

},[[195,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index_phone.js.map