"use strict";function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(e):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,a=new Array(r);e<r;e++)a[e]=t[e];return a}var img=require("../../utils/imgbase64");Component({data:{qrCodeUrl:"",historyUrlList:[],isShowWebView:!1,img:img},lifetimes:{created:function(){},attached:function(){this.getHistoryUrlList()},detached:function(){}},methods:{getHistoryUrlList:function(){var t=[],r=wx.getStorageSync("h5door-url");t=r?t.concat(r.split(",")):[],this.setData({historyUrlList:t})},setQrCode:function(t){this.setData({qrCodeUrl:t.target.dataset.qrCode})},qrCodeArouse:function(){var r=this,t={scanType:["qrCode"],success:function(t){r.setData({qrCodeUrl:t.result}),r.goWebview()}};wx.scanCode(t)},textareaChange:function(t){this.setData({qrCodeUrl:t.detail.value})},clearAll:function(){wx.clearStorageSync(),this.getHistoryUrlList()},addUrlToStorage:function(){var t=this.data.historyUrlList;if(t.push(this.data.qrCodeUrl),this.setData({historyUrlList:t}),0<this.data.historyUrlList.length){var r=new Set(this.data.historyUrlList);this.setData({historyUrlList:_toConsumableArray(r)}),wx.setStorageSync("h5door-url",this.data.historyUrlList.join(","))}},goWebview:function(){this.data.qrCodeUrl?(this.addUrlToStorage(),this.setData({isShowWebView:!0})):wx.showToast({title:"请输入跳转链接"})},onGoBack:function(){this.triggerEvent("toggle",{componentType:"dokit"})}}});