"use strict";Component({properties:{},data:{parmList:[{key:"",value:""}],typeList:[{value:"navigateTo",name:"打开新页面",checked:!0},{value:"redirectTo",name:"页面重定向"},{value:"reLaunch",name:"重启动"},{value:"switchTab",name:"Tab切换"}],pageList:[],pageUrl:"",goType:"navigateTo"},lifetimes:{attached:function(){this.setData({pageList:__wxConfig.pages})}},methods:{onGoBack:function(){this.triggerEvent("toggle",{componentType:"dokit"})},textareaChange:function(a){this.setData({pageUrl:a.detail.value})},bindPickerChange:function(a){var t="/"+this.data.pageList[a.detail.value];this.setData({pageUrl:t})},radioChange:function(a){this.setData({goType:a.detail.value})},addParm:function(){var a=this.data.parmList;a.push({key:"",value:""}),this.setData({parmList:a})},changeParmkey:function(a){var t=a.currentTarget.dataset.index,e=a.detail.value,i=this.data.parmList;i[t].key=e,this.setData({parmList:i})},changeParmValue:function(a){var t=a.currentTarget.dataset.index,e=a.detail.value,i=this.data.parmList;i[t].value=e,this.setData({parmList:i})},makeUrl:function(){var a=this.data.pageUrl,t=this.data.parmList;if(!a)return wx.showToast({title:"请输入页面路径",icon:"error"}),"";a=this.data.pageUrl+"?";for(var e=0;e<t.length;e++){if(""==t[e].key||""==t[e].value){if(""==t[e].key&&""==t[e].value)continue;return wx.showToast({title:"参数不完整",icon:"error"}),""}a=a+t[e].key+"="+t[e].value+"&"}return a},goPage:function(){var a=this.makeUrl(),t=this.data.goType;if(""!=a){if("switchTab"==t){for(var e=0;e<a.length&&"?"!=a[e];e++);a=a.substring(0,e)}wx[t]({url:a,fail:function(a){wx.showModal({title:"跳转失败",content:"错误信息："+a.errMsg})}})}}}});