diff --git a/pages/index/index.vue b/pages/index/index.vue index 05113db..819c7ba 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -93,6 +93,24 @@ + + + + + {{tips_title}} + + + + + + + 取消 + 确认 + + + + + @@ -121,6 +139,19 @@ specs_list:[],//证件 album_list:[],//写真 cartoon_list:[],//卡通 + + //弹窗 + tips_title:'隐私协议', + tips_show: false, + content: `

在使用【合成照相馆】小程序服务之前,

+

请仔细阅读合成照相馆隐私协议。

+

如你同意该协议,请点击同意开始使用合成照相馆。

`, + style: { + // 字符串的形式 + + p: 'font-weight: 400;font-size: 28rpx;color: #555555;line-height: 60rpx;', + + }, } }, onPageScroll(e) { @@ -141,10 +172,20 @@ _this.getSceneMenu(); //热门 _this.getHotList(); + + var show_agreement = _this.$user.session('show_agreement'); + console.log('show_agreement',show_agreement); + if(_this.$com.isNull(show_agreement)) + { + _this.agreement(); + _this.tips_show = true; + } + //延时1秒请求,保证成功 setTimeout(function(res){ _this.getUploadConfig(); },1000); + }, onShareAppMessage() { @@ -303,6 +344,35 @@ url:'/pagesA/photo/cartoon_2?id='+id, }) }, + open(key) { + console.log('open',key); + }, + close(key) { + var _this = this; + _this[key] = false; + + }, + //协议 + agreement(){ + var _this = this; + var post = { + type:'user_protocol', + }; + _this.$api.get('api/treatyInfo',post,function(rs){ + console.log('协议',rs); + _this.content = rs.content; + _this.tips_show = true; + },function(err){ + console.log(err); + }); + + }, + submit(key) + { + var _this = this; + _this.$user.session('show_agreement',1); + _this.close(key); + }, } } @@ -440,4 +510,88 @@ text-overflow: ellipsis; //超 } + + +.popupBox{ + width: 600rpx; + height: auto; + border-radius: 24rpx; + background-color: #FFFFFF; +} +.popupTop{ + width: 600rpx; + height: 140rpx; + background: linear-gradient(to bottom, #D3D5FF 20%, #FFFFFF 50%); + border-radius: 24rpx 24rpx 0rpx 0rpx; + line-height: 140rpx; + text-align: center; + font-weight: 700; + font-size: 30rpx; + color: #333333; +} + +.popupBtn{ width: 100%; height: auto; + display: flex; flex-wrap: wrap; + justify-content: space-around; /* 使子元素在容器中均匀分布 */ + align-items: center; /* 如果需要垂直居中子元素 */ +} +.sbtnBox{ + margin: 30rpx auto; + width: 478rpx; + height: 80rpx; + font-weight: 700; + font-size: 30rpx; + line-height: 80rpx; + border: 2rpx solid #4D94FF; + text-align: center; + border-radius: 44rpx; + + +} + +.popupDesc{ + width:560rpx; + font-weight: 400; + font-size: 28rpx; + color: #555555; + height: auto; + padding: 0rpx 20rpx; +} + +.popupDesc1{ + width:480rpx; + font-weight: 400; + font-size: 28rpx; + color: #555555; + height: 700rpx; + overflow-x: hidden; + overflow-y: scroll; + padding: 0rpx 60rpx; +} +.sbtnBox1{ + margin: 30rpx auto; + width: 226rpx; + height: 80rpx; + font-weight: 700; + font-size: 30rpx; + line-height: 80rpx; + border: 2rpx solid #4D94FF; + text-align: center; + border-radius: 44rpx; + +} + +.a1{ + background: linear-gradient( 270deg, rgba(46,87,241,0.15) 0%, rgba(131,88,246,0.15) 100%); + color:#7A74F0; +} +.a2{ + background: linear-gradient( 270deg, #2E57F1 0%, #8358F6 100%); + color:#FFFFFF; +} +.a3{ + background: linear-gradient( 270deg, #2E57F1 0%, #8358F6 100%); + color:#FFFFFF; +} + diff --git a/pages/user/account/index.vue b/pages/user/account/index.vue index 483639c..ac73e19 100644 --- a/pages/user/account/index.vue +++ b/pages/user/account/index.vue @@ -66,8 +66,27 @@ - - 协议与说明 + + 隐私协议 + + + + + + + + + + + + + + + + + + + 用户协议 @@ -112,7 +131,7 @@ - 协议与说明 + {{tips_title}} @@ -162,6 +181,7 @@ }, uploadImg: [], //弹窗 + tips_title:'', show: false, content:'', style: { @@ -267,10 +287,18 @@ }); }, //协议 - agreement(){ + agreement(type){ var _this = this; + if(type == 'privacy_policy') + { + _this.tips_title = '用户协议'; + } + else + { + _this.tips_title = '隐私协议'; + } var post = { - type:'user_protocol', + type:type, }; _this.$api.get('api/treatyInfo',post,function(rs){ console.log('协议',rs); diff --git a/pages/user/account/logout.vue b/pages/user/account/logout.vue index 0d919b6..40e1431 100644 --- a/pages/user/account/logout.vue +++ b/pages/user/account/logout.vue @@ -87,6 +87,23 @@ }, yes(){ this.close(); + //api/photo_album/del + _this.$com.confirm('确认注销账户,清空所有信息吗?',function(res){ + + var post = { + id:id, + }; + _this.$api.post('api/user/logOut', post,function(rs){ + console.log(rs); + uni.reLaunch({ + url: '/pages/index/index' + }); + + + }); + + + },'警告'); }, } } diff --git a/pages/user/index.vue b/pages/user/index.vue index 0827e70..aa1a29e 100644 --- a/pages/user/index.vue +++ b/pages/user/index.vue @@ -146,7 +146,7 @@ 排队中... 生成中... - 生成失败 + 生成失败 @@ -156,7 +156,7 @@ - + @@ -167,7 +167,7 @@ 排队中... 生成中... - 生成失败 + 生成失败 @@ -176,17 +176,16 @@ - + {{item.album.title}} - + 排队中... - 生成中... - 生成失败 + @@ -205,7 +204,7 @@ 排队中... 生成中... - 生成失败 + 生成失败 @@ -325,11 +324,15 @@ export default { _this.getSceneMenu(); //面部档案 _this.getPortraitList(); + + + + }, + onLoad() { + var _this =this; setTimeout(function(res){ _this.tabChange({index:0}); },1000); - - }, onReachBottom () { @@ -469,7 +472,7 @@ export default { } else { - Data[index].merge_thumbnail = '/static/img/user/pic_bg.png'; + Data[index].merge_thumbnail = _this.$api.ossurl(item.users_image); } break; @@ -569,32 +572,79 @@ export default { viewDetail(item){ var _this =this; var type = _this.tabList[_this.current].type; - if(item.status != 3) - { - _this.$com.showError('照片生成中,请等待'); - return; - } + var status = item.status; + + switch(type) { case 1: - uni.navigateTo({ - url:'/pages/user/photo/merge?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), - }) + //1:排队中,2:训练中,3:完成,4:失败 + switch(item.status) + { + case 1: + _this.$com.showError('照片排队中,请等待'); + return; + break; + case 2: + _this.$com.showError('照片生成中,请等待'); + return; + break; + + } + uni.navigateTo({ + url:'/pages/user/photo/merge?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), + }) break; case 2: - uni.navigateTo({ - url:'/pages/user/photo/color?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), - }) + //1:排队中,2:训练中,3:完成,4:失败 + switch(item.status) + { + case 1: + _this.$com.showError('照片排队中,请等待'); + return; + break; + case 2: + _this.$com.showError('照片生成中,请等待'); + return; + break; + + } + uni.navigateTo({ + url:'/pages/user/photo/color?url='+encodeURIComponent(_this.$api.ossurl(item.merge_image)), + }) break; case 3: + //1:处理中,2:处理完成 + switch(item.status) + { + case 1: + _this.$com.showError('照片排队中,请等待'); + return; + break; + + + } uni.navigateTo({ url:'/pages/user/photo/ai?id='+item.id, }) break; case 4: - uni.navigateTo({ - url:'/pages/user/photo/cartoon?id='+item.id, - }) + //1:排队中,2:训练中,3:完成,4:失败 + switch(item.status) + { + case 1: + _this.$com.showError('照片排队中,请等待'); + return; + break; + case 2: + _this.$com.showError('照片生成中,请等待'); + return; + break; + + } + uni.navigateTo({ + url:'/pages/user/photo/cartoon?id='+item.id, + }) break; } }, diff --git a/pages/user/photo/ai.vue b/pages/user/photo/ai.vue index 8183fd0..f589ede 100644 --- a/pages/user/photo/ai.vue +++ b/pages/user/photo/ai.vue @@ -1,5 +1,30 @@ @@ -8,15 +33,206 @@ export default { data() { return { + id:0, + info:'', //详情 + + } + }, + onLoad(option) { + //数据 + var _this =this; + var id = option.id; + if(_this.$com.isNull(id)) + { + uni.navigateBack({ + delta:1, + }) } + _this.id = id; + _this.getDetail(); + }, + onShow() { + var _this = this; + _this.checkAuth(); }, methods: { + //判断 + checkAuth() { + var _this = this; + console.log('已授权---'); + uni.authorize({ + scope: 'scope.writePhotosAlbum', + success(res) { + console.log('已授权', res); + }, + fail(err) { + + uni.showModal({ + title: '授权失败', + content: '请在设置界面打开存储相关权限', + success: (res) => { + if (res.confirm) { + uni.openSetting() + } + } + }) + }, + }) + }, + deletePic() + { + var _this = this; + var id = _this.id; + //api/photo_album/del + _this.$com.confirm('确认删除此次写真集吗?',function(res){ + + var post = { + id:id, + }; + _this.$api.post('api/photo_album/del', post,function(rs){ + console.log(rs); + uni.navigateBack({ + delta:1, + }) + + + }); + + + },'提示'); + }, + //保存道相册 + savePic(){ + var _this =this; + var ai_list = _this.info.album_series; + ai_list.forEach((item, index) => { + var url = item.merge_image; + uni.getSetting({ + success(res) { + console.log(res.authSetting); + if(!res.authSetting['scope.writePhotosAlbum']) + { + uni.openSetting(); + } + else + { + // 下载图片 + uni.downloadFile({ + url: url, + success: downloadResult => { + if (downloadResult.statusCode === 200) { + // 下载成功,保存图片到相册 + uni.saveImageToPhotosAlbum({ + filePath: downloadResult.tempFilePath, + success: () => { + uni.showToast({ + title: '保存成功' + }); + }, + fail: () => { + uni.showToast({ + title: '保存失败', + icon: 'none' + }); + } + }); + } + }, + fail: () => { + uni.showToast({ + title: '下载失败', + icon: 'none' + }); + } + }); + } + } + }) + }); + + + + }, + getDetail() + { + var _this = this; + var id = _this.id; + if(id == 0) + { + uni.navigateBack({ + delta:1, + }); + return; + } + var post = { + id:id, + }; + _this.$api.get('api/photo_album/details', post,function(rs){ + console.log(rs); + var Data = rs; + Data.album_series.forEach((item, index) => { + Data.album_series[index].merge_image = _this.$api.ossurl(item.merge_image); + }); + _this.info = Data; + + + }); + }, } } - + diff --git a/pages/user/photo/cartoon.vue b/pages/user/photo/cartoon.vue index 8183fd0..4d80d6d 100644 --- a/pages/user/photo/cartoon.vue +++ b/pages/user/photo/cartoon.vue @@ -1,5 +1,41 @@ @@ -8,15 +44,209 @@ export default { data() { return { - + id:0, + info:'', //详情 + xurl:'', } }, + onLoad(option) { + //数据 + var _this =this; + var id = option.id; + if(_this.$com.isNull(id)) + { + uni.navigateBack({ + delta:1, + }) + } + _this.id = id; + _this.getDetail(); + }, + onShow() { + var _this = this; + _this.checkAuth(); + }, methods: { + //判断 + checkAuth() { + var _this = this; + console.log('已授权---'); + uni.authorize({ + scope: 'scope.writePhotosAlbum', + success(res) { + console.log('已授权', res); + }, + fail(err) { + + uni.showModal({ + title: '授权失败', + content: '请在设置界面打开存储相关权限', + success: (res) => { + if (res.confirm) { + uni.openSetting() + } + } + }) + }, + }) + }, + deletePic() + { + var _this = this; + var id = _this.id; + //api/photo_album/del + _this.$com.confirm('确认删除此张卡通风吗?',function(res){ + + var post = { + id:id, + }; + _this.$api.post('api/photo_cartoon/del', post,function(rs){ + console.log(rs); + uni.navigateBack({ + delta:1, + }) + + + }); + + + },'提示'); + }, + //保存道相册 + savePic(){ + var _this =this; + var url = _this.xurl; + uni.getSetting({ + success(res) { + console.log(res.authSetting); + if(!res.authSetting['scope.writePhotosAlbum']) + { + uni.openSetting(); + } + else + { + // 下载图片 + uni.downloadFile({ + url: url, + success: downloadResult => { + if (downloadResult.statusCode === 200) { + // 下载成功,保存图片到相册 + uni.saveImageToPhotosAlbum({ + filePath: downloadResult.tempFilePath, + success: () => { + uni.showToast({ + title: '保存成功' + }); + }, + fail: () => { + uni.showToast({ + title: '保存失败', + icon: 'none' + }); + } + }); + } + }, + fail: () => { + uni.showToast({ + title: '下载失败', + icon: 'none' + }); + } + }); + } + } + }) + + + }, + getDetail() + { + var _this = this; + var id = _this.id; + if(id == 0) + { + uni.navigateBack({ + delta:1, + }); + return; + } + var post = { + id:id, + }; + _this.$api.get('api/photo_cartoon/details', post,function(rs){ + console.log(rs); + var Data = rs; + if(Data.status == 3) + { + _this.xurl = _this.$api.ossurl(Data.merge_image); + } + else + { + _this.xurl = _this.$api.ossurl(Data.users_image); + } + Data.merge_image = _this.$api.ossurl(Data.merge_image); + Data.users_image = _this.$api.ossurl(Data.users_image); + + _this.info = Data; + + + }); + }, } } - + diff --git a/pages/user/portrait/detail.vue b/pages/user/portrait/detail.vue index c836ab0..ef90796 100644 --- a/pages/user/portrait/detail.vue +++ b/pages/user/portrait/detail.vue @@ -48,6 +48,11 @@ } }, newInfo(){ + var _this =this; + if(_this.id == 0) + { + _this.$user.session('ai_face_success',''); + } uni.navigateTo({ url:'/pagesA/merge/face_1' }) diff --git a/pagesA/merge/face_1.vue b/pagesA/merge/face_1.vue index e297148..0013b62 100644 --- a/pagesA/merge/face_1.vue +++ b/pagesA/merge/face_1.vue @@ -291,7 +291,7 @@ var upData = { filePath: compress_path, fileType: 'image', - scene: 'user_max' + scene: 'user_portrait' }; _this.$api.ossUpload(upData, function(res) { diff --git a/pagesA/merge/index.vue b/pagesA/merge/index.vue index 07f3469..8e9f15a 100644 --- a/pagesA/merge/index.vue +++ b/pagesA/merge/index.vue @@ -156,7 +156,7 @@ 训练中 失败 - +