From 0df518c15c4b746ced75c51745cfb849a9eba2ed Mon Sep 17 00:00:00 2001 From: JING Date: Tue, 6 Aug 2024 15:18:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E7=9C=9F=E9=A1=B5=E9=9D=A2=E6=95=B4?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 7 + pages/user/index.vue | 49 ++++- pages/user/photo/color.vue | 203 +++++++++++++++++++++ pagesA/photo/photo_1.vue | 2 +- pagesA/photo/photo_2.vue | 361 ++++++++++++++++++++++++++++++------- 5 files changed, 552 insertions(+), 70 deletions(-) create mode 100644 pages/user/photo/color.vue diff --git a/pages.json b/pages.json index 485261c..c837ae4 100644 --- a/pages.json +++ b/pages.json @@ -54,6 +54,13 @@ "navigationBarTitleText": "注销账号", "navigationStyle": "custom" } + }, + { + "path" : "pages/user/photo/color", + "style" : + { + "navigationBarTitleText" : "照片换底色详情" + } } ], diff --git a/pages/user/index.vue b/pages/user/index.vue index 45fab75..1275bf4 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -173,6 +173,43 @@ + + + + + + + {{item.album.title}} + + + + + 排队中... + 生成中... + 生成失败 + + + + + + + + + + + + {{item.cartoon.title}} + + + + + 排队中... + 生成中... + 生成失败 + + + + @@ -392,13 +429,13 @@ export default { _this.loadDataList('api/photo_synthesis/list'); break; case 2: - _this.loadDataList('/api/photo_back_color/list'); + _this.loadDataList('api/photo_back_color/list'); break; case 3: - + _this.loadDataList('api/photo_album/list'); break; case 4: - + _this.loadDataList('api/photo_cartoon/list'); break; } }, @@ -437,10 +474,10 @@ export default { break; case 3: - + Data[index].album.face = _this.$api.ossurl(item.album.face); break; case 4: - + Data[index].cartoon.face = _this.$api.ossurl(item.cartoon.face); break; } @@ -546,7 +583,7 @@ export default { break; case 2: uni.navigateTo({ - url:'/pages/user/photo/merge?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), + url:'/pages/user/photo/color?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), }) break; case 3: diff --git a/pages/user/photo/color.vue b/pages/user/photo/color.vue new file mode 100644 index 0000000..ebbcdcc --- /dev/null +++ b/pages/user/photo/color.vue @@ -0,0 +1,203 @@ + + + + + + diff --git a/pagesA/photo/photo_1.vue b/pagesA/photo/photo_1.vue index f0bcf6e..9767f99 100644 --- a/pagesA/photo/photo_1.vue +++ b/pagesA/photo/photo_1.vue @@ -41,7 +41,7 @@ diff --git a/pagesA/photo/photo_2.vue b/pagesA/photo/photo_2.vue index b0952da..b968c4a 100644 --- a/pagesA/photo/photo_2.vue +++ b/pagesA/photo/photo_2.vue @@ -6,12 +6,11 @@ - + - 复古港风 - 走进中国香港90年代的繁华 + {{album.title}} + {{album.describe}} @@ -21,7 +20,7 @@ - - + 使用模板生成 - - - - 提醒 - - - 目前系统还未存入您的面部档案信息,请先前往创建需要生成写真的面部档案 - - - - - 暂不生成 - - - 前往创建 - - - - - - - - - - 请选择需要生成写真的面部档案 - - - - - - - - - - + + + + 请选择需要生成写真的面部档案 + + + + + + + + 排队中 + 训练中 + 失败 + + + + + + + + + 取消 + 确认 + + + - - - - - - 暂不生成 - - - 确定 - - + + + + 提醒 + + + + + + + 暂不生成 + 前往创建 + + + - - @@ -107,6 +113,32 @@ navbar_title: 'AI写真', theme: "white", margin_top: 10, + album_id:0, //写真模版id + album:'', + portrait_id:0, + + + //选面部档案 弹窗 + select_show:false, + //弹窗 + tips_show: false, + content: `

目前系统还未存入您的面部档案信息,

+

请先前往创建需要生成写真的面部档案

+

创建成功后再次生成

`, + style: { + // 字符串的形式 + + p: 'font-weight: 400;font-size: 28rpx;color: #555555;line-height: 60rpx;', + + }, + + //选择面部档案 + selectList:[], + selectIndex:0,//默认选第一个 + show_btn:false, + + + photo_list: [ 'https://img30.360buyimg.com/sku/jfs/t1/221254/4/39390/74349/661e039aF46114279/48532008a0001dd0.jpg', @@ -116,19 +148,26 @@ has_face : 1 ,//是否已有模板 及数量 show_3:false, show_2:false, - show_btn:false, + face_list :[], select_index:0, select_id:'' } }, - - mounted() { - - }, - onLoad() { - this.getFace() + onLoad(option) { + //数据 + var _this =this; + var id = option.id; + if(_this.$com.isNull(id)) + { + uni.navigateBack({ + delta:1, + }) + } + _this.album_id = id; + _this.geAlbumtDetail(); + //_this.getFace() }, onShow() { @@ -157,9 +196,113 @@ selectThis(index,id){ this.select_id = id; this.select_index = index; - } - + }, + geAlbumtDetail() + { + var _this =this; + var post = { + id:_this.album_id, + }; + _this.$api.get('api/album/details',post,function(rs){ + console.log(rs); + var Data = rs; + Data.face = _this.$api.ossurl(Data.face); + var back_image = Data.back_image; + back_image.forEach((item, index) => { + back_image[index] = _this.$api.ossurl(item); + }); + Data.back_image = back_image; + _this.album = Data; + _this.show_btn = true; + }); + }, + checkHave() + { + var _this =this; + _this.getPortraitList(); + }, + //获取面部档案 + getPortraitList(){ + var _this =this; + var post = {}; + _this.$api.get('api/portrait/list', post, function(res) { + + var d = res; + console.log(d); + if(d.length == 0) + { + _this.tips_show = true; + } + else + { + var selectList = d; + selectList.forEach((item, index) => { + selectList[index].model_image = item.model_image ? _this.$api.ossurl(item.model_image): '/static/img/index/p_bg.png'; + selectList[index].model_image_thumbnail = item.model_image_thumbnail ? _this.$api.ossurl(item.model_image_thumbnail) : '/static/img/index/p_bg.png'; + }); + _this.selectList = selectList; + _this.selectIndex = 0; + _this.select_show = true; + } + }); + }, + //选择面部档案 + selectPortrait(index,item) + { + var _this =this; + if(item.status == 3) + { + _this.selectIndex = index; + } + }, + open(key) { + console.log('open',key); + }, + close(key) { + var _this = this; + _this[key] = false; + + }, + //自定义 确认 + submit(key){ + var _this =this; + + switch(key) + { + //显示提示信息 跳转到创建面部档案 + case 'tips_show': + _this.close(key); + uni.navigateTo({ + url:'/pagesA/merge/face_1' + }); + break; + //选择面部档案 跳转到选择模板信息 + case 'select_show': + _this.portrait_id = _this.selectList[_this.selectIndex].id; + _this.close(key); + var album_id = _this.album_id; + var portrait_id = _this.portrait_id; + var post = { + album_id:album_id, + portrait_id:portrait_id, + }; + _this.$com.showLoading('保存图片中'); + _this.$api.post('api/album/append', post,function(rs){ + console.log(rs); + _this.$com.hideLoading(); + uni.navigateTo({ + url:"/pagesA/merge/success" + }); + + }); + break; + + } + + + + }, } } @@ -167,4 +310,96 @@ \ No newline at end of file