goods-detail.js 4.9 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/app_admin/goods-detail/goods-detail"],{1082:function(t,e,i){"use strict";(function(t){i("8748");n(i("66fd"));var e=n(i("2de1"));function n(t){return t&&t.__esModule?t:{default:t}}t(e.default)}).call(this,i("543d")["createPage"])},"2de1":function(t,e,i){"use strict";i.r(e);var n=i("ae51"),o=i("65aa");for(var s in o)"default"!==s&&function(t){i.d(e,t,(function(){return o[t]}))}(s);i("6953");var a,c=i("f0c5"),r=Object(c["a"])(o["default"],n["b"],n["c"],!1,null,"b8a7823c",null,!1,n["a"],a);e["default"]=r.exports},"65aa":function(t,e,i){"use strict";i.r(e);var n=i("ce13"),o=i.n(n);for(var s in n)"default"!==s&&function(t){i.d(e,t,(function(){return n[t]}))}(s);e["default"]=o.a},6953:function(t,e,i){"use strict";var n=i("c7fb"),o=i.n(n);o.a},ae51:function(t,e,i){"use strict";var n,o=function(){var t=this,e=t.$createElement;t._self._c},s=[];i.d(e,"b",(function(){return o})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){return n}))},c7fb:function(t,e,i){},ce13:function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=i("2f62");function o(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function s(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?o(Object(i),!0).forEach((function(e){a(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var c={data:function(){var t;return t={tempFilePaths:"",imgheight:0,menu:!1,txt:null,list:[]},a(t,"txt",""),a(t,"textDialog",!1),a(t,"is_delete",!1),a(t,"toToggle",!1),a(t,"index",0),a(t,"reEdit",!1),a(t,"loadingImg",!1),a(t,"iphone_x",!1),t},computed:s({},(0,n.mapState)({theme:function(t){return t.mallConfig.theme},userInfo:function(t){return t.user.info},adminImg:function(t){return t.mallConfig.__wxapp_img.app_admin}})),methods:{onEditorReady:function(){var e=this;t.createSelectorQuery().select("#editor").context((function(t){console.log(t),e.editorCtx=t.context;var i={html:e.list};e.editorCtx.setContents(i)})).exec()},contentChange:function(t){console.log(t.detail)},toList:function(){this.textDialog=!1;var t={type:"text",text:this.txt};this.reEdit?(this.list.splice(this.index,1,t),this.reEdit=!1):this.list.splice(this.index,0,t)},editText:function(t,e){this.txt=e.text,this.reEdit=!0,this.textDialog=!0,this.index=t},move:function(t,e,i){this.list.splice(e,1),1==t?this.list.splice(e+1,0,i):this.list.splice(e-1,0,i)},toRemove:function(t){this.txt=null,this.is_delete=!0,this.index=t},cancel:function(){this.is_delete=!1},remove:function(){this.is_delete=!1,this.list.splice(this.index,1)},showMenu:function(t){t>-1?(this.index=t+1,this.menu=!0,this.txt="",this.toToggle=!1):(this.txt.length>0?this.toList():this.textDialog=!1,this.menu=!1)},toggle:function(t){this.index=t,this.toToggle=!0,this.menu=!0},addLine:function(){var t={type:"line"};this.list.splice(this.index,0,t),this.menu=!1},showText:function(){this.textDialog=!this.textDialog,this.menu=!1},add:function(e){var i=this;this.menu=!1,t.chooseImage({count:1,sizeType:["original","compressed"],sourceType:[e],success:function(e){var n=e.tempFilePaths,o=i.list;n.forEach((function(e,s){var a={pic_url:"",type:"img",id:0};i.loadingImg=!0,i.toToggle?(console.log(1),o.splice(i.index,1,a)):(console.log(2),o.splice(i.index,0,a)),i.list=o;var c="";t.uploadFile({url:i.$api.upload.file,filePath:e,name:"file",fileType:"image",formData:{file:e,file_name:c},success:function(e){var a=JSON.parse(e.data);if(0==a.code)for(var c in o)"img"==o[c].type&&""==o[c].pic_url&&(o[c].pic_url=a.data.url,o[c].id=a.data.id);i.list=o,s==n.length-1&&(i.loadingImg=!1,t.hideLoading())}})}))}})},imageLoad:function(t,e){var i=e.detail.height,n=e.detail.width,o=i*(750/n);this.list[t].height=o+"rpx",this.$forceUpdate()},clear:function(e){this.img.splice(e,1),t.setStorage({key:"goods_detail",data:this.list})},save:function(){this.loadingImg?t.showToast({title:"上传图片中,请稍后...",icon:"none",duration:1e3}):(t.setStorage({key:"goods_detail",data:this.list}),setTimeout((function(){t.navigateBack()}),500))}},onLoad:function(e){var i=this;t.getStorage({key:"goods_detail",success:function(t){t.data&&(i.list=t.data)}}),t.getSystemInfo({success:function(t){(t.model.indexOf("iPhone X")>-1||t.model.indexOf("iPhone 11")>-1||t.model.indexOf("iPhone11")>-1||t.model.indexOf("iPhone12")>-1||t.model.indexOf("Unknown Device")>-1)&&(i.iphone_x=!0)}})}};e.default=c}).call(this,i("543d")["default"])}},[["1082","common/runtime","common/vendor"]]]);