index.js 8.5 KB

1
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/index/index"],{1775:function(e,t,n){"use strict";(function(e,t){var a=n("4ea4");n("f91a");a(n("66fd"));var o=a(n("b973"));e.__webpack_require_UNI_MP_PLUGIN__=n,t(o.default)}).call(this,n("bc2e")["default"],n("543d")["createPage"])},"1ac0":function(e,t,n){},"76f9":function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return a}));var a={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"))},uPopup:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-popup/u-popup")]).then(n.bind(null,"bd40"))},uSubsection:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-subsection/u-subsection")]).then(n.bind(null,"8c01"))}},o=function(){var e=this,t=e.$createElement,n=(e._self._c,e.isGen?0!==e.fileListUp.length&&e.showGenBtn:null);e._isMounted||(e.e0=function(t){e.show=!0},e.e1=function(t){e.show=!1}),e.$mp.data=Object.assign({},{$root:{g0:n}})},i=[]},"9ffb":function(e,t,n){"use strict";var a=n("1ac0"),o=n.n(a);o.a},a0a9:function(e,t,n){"use strict";n.r(t);var a=n("e80f"),o=n.n(a);for(var i in a)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return a[e]}))}(i);t["default"]=o.a},b973:function(e,t,n){"use strict";n.r(t);var a=n("76f9"),o=n("a0a9");for(var i in o)["default"].indexOf(i)<0&&function(e){n.d(t,e,(function(){return o[e]}))}(i);n("9ffb");var r=n("f0c5"),u=Object(r["a"])(o["default"],a["b"],a["c"],!1,null,"9c4fa300",null,!1,a["a"],void 0);t["default"]=u.exports},e80f:function(e,t,n){"use strict";(function(e){var a=n("4ea4");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=a(n("2eee")),i=a(n("9523")),r=a(n("c973")),u=n("c0ba");function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){(0,i.default)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l={components:{genAvatarCom:function(){Promise.all([n.e("common/vendor"),n.e("components/genAvatarComp/index")]).then(function(){return resolve(n("d334"))}.bind(null,n)).catch(n.oe)}},data:function(){return{exampleList:[{text:"五官清晰",url:n("b86d")},{text:"不是正面",url:n("cc73")},{text:"有遮挡",url:n("e49c")},{text:"过于模糊",url:n("9d0c")}],show:!1,userInfo:e.getStorageSync("userInfo"),value:0,is_show:!1,fileList1:[],stepUrl:"",isGen:!1,showGenBtn:!0,fileListUp:[],aiPath:"",styles:{},manList:[],current:0,manCurrIndex:0,womanCurrIndex:-1,currModalCon:null}},onLoad:function(){var t=this;return(0,r.default)(o.default.mark((function n(){var a;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.getAiPath(),n.next=3,(0,u.getAiModel)({type:2});case 3:a=n.sent,0==a.code?(t.styles=a.data.styles,t.manList=Object.keys(a.data.styles),t.currModalCon={type:t.manList[0],name:a.data.styles[t.manList[0]][0].name,index:a.data.styles[t.manList[0]][0].index},console.log("ai模型列表返回值:",a,t.styles,t.currModalCon)):e.showToast({title:a.message,icon:"none"});case 5:case"end":return n.stop()}}),n)})))()},onShareAppMessage:function(e){if("button"===e.from||"menu"===e.from)return{title:"思维定制相机-首页",imageUrl:"",path:"/pages/index/index",mpId:this.$appId,type:this.$shareType}},watch:{fileListUp:function(e,t){var n=e.filter((function(e,t){return"success"==e}));n.length>=5?(this.isGen=!0,this.showGenBtn=!0):(this.isGen=!1,this.showGenBtn=!1)}},methods:{previewImg:function(t,n){var a=[];t.forEach((function(e,t){a.push(e.url)})),console.log("listr",a),e.previewImage({current:n,urls:a,loop:!0,indicator:"default"})},selM:function(e,t,n){0==e?(this.manCurrIndex=t,this.womanCurrIndex=-1):(this.womanCurrIndex=t,this.manCurrIndex=-1),this.currModalCon={type:e?"woman":"man",name:n.name,index:t},console.log("当前选择的模型",e,t,n,this.currModalCon)},sectionChange:function(e){this.current=e},open:function(){},close:function(){this.show=!1},testUp:function(){e.switchTab({url:"/pages/main/index"})},getAiPath:function(){var t=this;return(0,r.default)(o.default.mark((function n(){var a;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,(0,u.getAiModel)({type:3});case 2:a=n.sent,0==a.code?(console.log("ai模型返回值:",a.data.data_path),t.aiPath=a.data.data_path):e.showToast({title:"远程文件夹创建失败",icon:"none"});case 4:case"end":return n.stop()}}),n)})))()},toGenPic:function(){e.switchTab({url:"/pages/selAndGenPage/index"})},toMyPage:function(){e.switchTab({url:"/pages/main/index"})},deletePic:function(e){console.log("del",e),this["fileList".concat(e.name)].splice(e.index,1),this.fileListUp.splice(e.index,1),console.log("1213",this.fileListUp)},afterRead:function(t){var n=this;return(0,r.default)(o.default.mark((function a(){var i,r,u,s,l;return o.default.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(e.getStorageSync("token")){a.next=4;break}return n.$toast("请登录后上传"),setTimeout((function(){e.reLaunch({url:"/pages/main/index"})}),1500),a.abrupt("return");case 4:if(console.log("afterRead------:",t),!n.aiPath){a.next=21;break}i=[].concat(t.file),r=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 10:if(!(u<i.length)){a.next=21;break}return a.next=13,n.uploadFilePromise(i[u].url);case 13:s=a.sent,console.log("result------",s),l=n["fileList".concat(t.name)][r],n["fileList".concat(t.name)].splice(r,1,Object.assign(l,{status:s.type,message:"",url:s.data,errTxt:s.errTxt?s.errTxt:""})),r++;case 18:u++,a.next=10;break;case 21:case"end":return a.stop()}}),a)})))()},uploadFilePromise:function(t){var n=this;return(0,r.default)(o.default.mark((function a(){var i;return o.default.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return i=n,a.abrupt("return",new Promise((function(n,a){e.uploadFile({url:i.$baseUrl+"/api/checkAndUploadImg",filePath:t,name:"file",header:{Authorization:e.getStorageSync("token")},formData:{user:"test",tag:"lamp",pathId:i.aiPath},success:function(e){var t=JSON.parse(e.data);console.log("上传并校验图片返回值:",e),0==t.code&&(t.data.img_path?(i.fileListUp.push("success"),setTimeout((function(){n({data:e.data.data,type:"success"})}),1e3)):(i.$toast("图片不符合标准,请检查后重新上传"),i.fileListUp.push("failed"),setTimeout((function(){n({data:e.data.data,type:"failed",errTxt:t.data.data[0].msg})}),1e3)))}})})));case 2:case"end":return a.stop()}}),a)})))()},createRenwu:function(){var t=this;return(0,r.default)(o.default.mark((function n(){var a;return o.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!(t.fileListUp.length<5)){n.next=2;break}return n.abrupt("return",e.showToast({title:"请上传5张图片以上",icon:"none"}));case 2:return e.showLoading({title:"任务创建中..."}),t,console.log("创建任务参数:",{pathId:t.aiPath,cate:t.currModalCon.type,model_index:t.currModalCon.index,output_level:"-2"}),n.next=7,(0,u.createTask)({pathId:t.aiPath,cate:t.currModalCon.type,model_index:t.currModalCon.index,output_level:"-2"});case 7:a=n.sent,console.log("创建任务返回值:",a),0==a.code&&a.data.task_id&&(t.$toast("任务创建成功"),t.showGenBtn=!1,setTimeout((function(){e.switchTab({url:"/pages/my/index"})}),1500));case 10:case"end":return n.stop()}}),n)})))()},reCreate:function(){var e=this;return(0,r.default)(o.default.mark((function t(){return o.default.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.fileListUp=[],e.fileList1=[],e.isGen=!1,e.getAiPath();case 4:case"end":return t.stop()}}),t)})))()}}};t.default=l}).call(this,n("543d")["default"])}},[["1775","common/runtime","common/vendor"]]]);