index.js 5.6 KB

12345678910
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/genAvatarComp/index"],{3798:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return o}));var o={uUpload:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-upload/u-upload")]).then(n.bind(null,"a20e"))},uDivider:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-divider/u-divider")]).then(n.bind(null,"290a"))},uIcon:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-icon/u-icon")]).then(n.bind(null,"f391"))},"u-Text":function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u--text/u--text")]).then(n.bind(null,"e664"))}},r=function(){var e=this.$createElement;this._self._c},i=[]},3888:function(e,t,n){},4617:function(e,t,n){"use strict";n.r(t);var o=n("b41a"),r=n.n(o);for(var i in o)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(i);t["default"]=r.a},b41a:function(e,t,n){"use strict";(function(e){var o=n("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=o(n("2eee")),i=o(n("9523")),a=o(n("c973"));function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s={data:function(){return{userInfo:e.getStorageSync("userInfo"),value:0,is_show:!1,fileList1:[],stepUrl:"",isGen:!1,showGenBtn:!0,fileListUp:[],aiPath:"",showDelBtn:!0,exampleList:[{text:"五官清晰",url:n("b86d")},{text:"不是正面",url:n("cc73")},{text:"有遮挡",url:n("e49c")},{text:"过于模糊",url:n("9d0c")}]}},onLoad:function(){},watch:{stepUrl:function(e,t){""!=e?(this.isGen=!0,this.showGenBtn=!0):(this.isGen=!1,this.showGenBtn=!1)}},methods:{previewImg:function(t,n){var o=[];t.forEach((function(e,t){o.push(e.url)})),console.log("listr",o),e.previewImage({current:n,urls:o,loop:!0,indicator:"default"})},reset:function(){this.stepUrl="",this.fileList1=[],this.isGen=!1,this.showDelBtn=!0},change:function(){},click:function(){},deletePic:function(e){this["fileList".concat(e.name)].splice(e.index,1),this.stepUrl="",console.log("event",e)},afterRead:function(t){var n=this;return(0,a.default)(r.default.mark((function o(){var i,a,u,s,l;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.getStorageSync("token")){o.next=4;break}return n.$toast("请登录后上传"),setTimeout((function(){e.reLaunch({url:"/pages/main/index"})}),1500),o.abrupt("return");case 4:console.log("afterRead------:",t),i=[].concat(t.file),a=n["fileList".concat(t.name)].length,i.map((function(e){n["fileList".concat(t.name)].push(c(c({},e),{},{status:"uploading",message:"上传中"}))})),u=0;case 9:if(!(u<i.length)){o.next=19;break}return o.next=12,n.uploadFilePromise(i[u].url);case 12:s=o.sent,l=n["fileList".concat(t.name)][a],n["fileList".concat(t.name)].splice(a,1,Object.assign(l,{status:"success",message:"",url:s})),a++;case 16:u++,o.next=9;break;case 19:case"end":return o.stop()}}),o)})))()},uploadFilePromise:function(t){var n=this;return(0,a.default)(r.default.mark((function o(){var i;return r.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:return i=n,o.abrupt("return",new Promise((function(n,o){e.uploadFile({url:i.$baseUrl+"/api/attachments",filePath:t,name:"file",header:{Authorization:e.getStorageSync("token")},formData:{tag:"camera"},success:function(e){var t=JSON.parse(e.data);0==t.code&&(i.stepUrl=t.data.file,console.log("上传并校验图片返回值--头像:",i.stepUrl),setTimeout((function(){n(e.data.data)}),1e3))}})})));case 2:case"end":return o.stop()}}),o)})))()},buildPicTrue:function(){if(!this.stepUrl)return e.showToast({title:"请上传图片",icon:"none"});e.showLoading({title:"生成中..."});var t=this;e.request({url:t.$baseUrl+"/api/buildPicTrue",method:"POST",data:{pathPictrue:this.stepUrl},header:{Authorization:e.getStorageSync("token")},success:function(n){e.request({url:t.$baseUrl+"/api/getImage",method:"POST",data:{file_name:n.data.data.result},header:{Authorization:e.getStorageSync("token")},success:function(n){t.showDelBtn=!1,t.showGenBtn=!1,console.log(n),console.log("制作商城的图片地址:",n.data.data.url),t.fileList1=[{url:n.data.data.url}],e.hideLoading()}}),console.log("请求成功",n.data)},fail:function(e){console.log("请求失败",e)},complete:function(){console.log("请求完成")}})}}};t.default=s}).call(this,n("543d")["default"])},d334:function(e,t,n){"use strict";n.r(t);var o=n("3798"),r=n("4617");for(var i in r)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return r[e]}))}(i);n("f8ef");var a=n("f0c5"),u=Object(a["a"])(r["default"],o["b"],o["c"],!1,null,"65ae0e82",null,!1,o["a"],void 0);t["default"]=u.exports},f8ef:function(e,t,n){"use strict";var o=n("3888"),r=n.n(o);r.a}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'components/genAvatarComp/index-create-component',
  4. {
  5. 'components/genAvatarComp/index-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("d334"))
  7. })
  8. },
  9. [['components/genAvatarComp/index-create-component']]
  10. ]);