JING 8 months ago
commit dda95f3404
  1. 11
      pages.json
  2. 19
      pages/card/card_face_1.vue
  3. 4
      pages/index/index.vue
  4. 2
      pagesA/photo/cartoon_1.vue
  5. 390
      pagesA/photo/face.vue
  6. 111
      pagesA/photo/photo_1.vue
  7. 92
      pagesA/photo/photo_2.vue

@ -61,6 +61,14 @@
"navigationBarTitleText": "注销账号",
"navigationStyle": "custom"
}
},
{
"path" : "pages/card/card_face_1",
"style" :
{
"navigationBarTitleText" : "面部档案",
"navigationStyle": "custom"
}
}
],
@ -70,7 +78,8 @@
"path": "photo/photo_1",
"style": {
"navigationBarTitleText": "AI写真",
"navigationStyle": "custom"
"navigationStyle": "custom",
"enablePullDownRefresh":false
}
},
{

@ -0,0 +1,19 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
};
}
}
</script>
<style lang="scss">
</style>

@ -18,13 +18,13 @@
<view class="contentBox">
<view class="navBox">
<view class="navItem" @click="goTo('/pagesA/photo/photo_1')">
<view class="navItem" @click="goTo('/pages/card/card_1')">
<image src="/static/img/index/zjhc.png" mode="widthFix"></image>
</view>
<view class="navItem" @click="goTo('/pagesA/color/index')">
<image src="/static/img/index/zjgs.png" mode="widthFix"></image>
</view>
<view class="navItem" @click="goTo('/pagesA/photo/face')">
<view class="navItem" @click="goTo('/pagesA/photo/photo_1')">
<image src="/static/img/index/aixz.png" mode="widthFix"></image>
</view>
<view class="navItem" @click="goTo('/pagesA/photo/cartoon_1')">

File diff suppressed because one or more lines are too long

@ -5,7 +5,8 @@
<view class="photo_main_face" :style="'margin-top:-'+margin_top+'px'">
<view class="photo_main_face_head"></view>
<view class="photo_main_face_1">
<image src="/static/img/photo/face_1.png" />
<image src="/static/img/photo/face_5.png" v-if="uploadFiles.length >=5"/>
<image src="/static/img/photo/face_1.png" v-if="uploadFiles.length < 5"/>
</view>
<view class="photo_main_face_2">
<view class="photo_main_face_2_1">上传5-10有效照片越多生成效果越好</view>
@ -15,45 +16,43 @@
</view>
<view class="photo_main_face_3">
<view class="photo_main_face_3_one" v-for="n in 10" :class="{
this_class_0:n==0,
this_class_4:n==4,
this_class_5:n==5,
this_class_9:n==9
<view class="photo_main_face_3_one" v-for="(item,key) in successFiles" :key="key" :class="{
this_class_0:key==0,
this_class_4:key==4,
this_class_5:key==5,
this_class_9:key==9
}">
<image src="/static/img/index/banner.png" />
<view class="photo_main_face_3_one_icon">
<image :src="item" v-if="item" />
<view class="photo_main_face_3_one_icon" v-if="item" @tap="delPhoto(item)">
<image src="/static/img/common/common_22.png" />
</view>
</view>
</view>
<!-- <view class="photo_main_face_4" style="height: 88rpx;">
<image src="/static/img/photo/face_7.png" />
</view>
-->
<u-upload :fileList="photoList" @afterRead="afterRead" @delete="deletePic" name="up1" :maxCount="1"
v-if="uploadFiles.length < 10 && uploadFiles.length >= 1">
<view class="photo_main_face_4 " style="height: 88rpx;margin-left: 24rpx;margin-bottom: 0;">
<image src="/static/img/photo/face_7.png" />
</view>
</u-upload>
<u-upload
:fileList="photoList"
@afterRead="afterRead"
@delete="deletePic"
name="1"
multiple
:maxCount="10">
<!-- :fileList="photoList" @afterRead="afterRead" @delete="deletePic" name="1" :maxCount="5" -->
<u-upload :fileList="photoList" @afterRead="afterRead" @delete="deletePic" name="up2" :maxCount="1"
v-if="uploadFiles.length < 1">
<view class="photo_main_face_4 photo_full_blue_btn" style="margin-left: 24rpx;">
上传照片
</view>
</u-upload>
<!-- <view class="photo_main_face_4 photo_full_blue_btn">
<view class="photo_main_face_4 photo_full_blue_btn" v-if="uploadFiles.length >=5" @tap="subFace()">
提交制作 0/30
</view> -->
</view>
<view class="photo_main_face_5">以下照片不合格请重新上传</view>
<view class="photo_main_face_3">
<view class="photo_main_face_3_one" v-for="n in 3">
<view class="photo_main_face_5" v-if="errorFiles.length > 0">以下照片不合格请重新上传</view>
<view class="photo_main_face_3" v-if="errorFiles.length > 0">
<view class="photo_main_face_3_one" v-for="n in 3" :key="n">
<image src="/static/img/index/banner.png" />
</view>
</view>
@ -77,80 +76,13 @@
<view>2.生成高峰期可能会有排队情况请耐心等候</view>
<view>3.如需更换写真人物, 请前往我的增加人物的面部档案</view>
</view>
<view class="show_readme_div_3">
<view class="show_readme_div_3" @tap="subPhoto">
确认
</view>
</view>
</u-popup>
<u-popup :show="show_2" mode="center" bgColor="transparent" :round="12">
<view class="show_readme_div" style="height: 380rpx;">
<view class="show_readme_div_1">
提醒
</view>
<view class="show_readme_div_2">
<view>目前系统还未存入您的面部档案信息请先前往创建需要生成写真的面部档案</view>
</view>
<view class="show_readme_div_line">
<view class="show_readme_div_4" style="width: 220rpx;">
暂不生成
</view>
<view class="show_readme_div_3" style="width: 220rpx;">
前往创建
</view>
</view>
</view>
</u-popup>
<u-popup :show="show_3" mode="center" bgColor="transparent" :round="12">
<view class="show_readme_div" style="height: 440rpx;">
<view class="show_readme_div_1">
请选择需要生成写真的面部档案
</view>
<view class="show_readme_div_2" style="width: 520rpx;margin-left: 40rpx;">
<view class="show_readme_div_2_1">
<view class="show_readme_div_2_1_one">
<view class="show_readme_div_2_1_one_1">
<image src="../../static/img/index/banner.png" />
</view>
<view class="show_readme_div_2_1_one_2">
<image src="/static/img/common/photo_common_21.png" />
</view>
</view>
<view class="show_readme_div_2_1_one">
<view class="show_readme_div_2_1_one_1">
<image src="../../static/img/index/banner.png" />
</view>
<view class="show_readme_div_2_1_one_2">
<image src="/static/img/common/photo_common_21.png" />
</view>
</view>
<view class="show_readme_div_2_1_one">
<view class="show_readme_div_2_1_one_1">
<image src="../../static/img/index/banner.png" />
</view>
<view class="show_readme_div_2_1_one_2">
<image src="/static/img/common/photo_common_21.png" />
</view>
</view>
</view>
</view>
<view class="show_readme_div_line">
<view class="show_readme_div_4" style="width: 220rpx;">
暂不生成
</view>
<view class="show_readme_div_3" style="width: 220rpx;">
前往创建
</view>
</view>
</view>
</u-popup>
</view>
</template>
@ -171,6 +103,9 @@
show_2: false,
show_3: false,
photoList: [],
uploadFiles: [],
successFiles: [],
errorFiles: []
}
},
@ -188,19 +123,84 @@
}
},
onShow() {
var _this = this;
_this.checkAuth();
this.setSuccessFiles();
},
methods: {
setSuccessFiles() {
this.uploadFiles = uni.getStorageSync('ai_face_success');
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&', this.uploadFiles);
if (!this.uploadFiles) {
this.uploadFiles = [];
}
this.successFiles = [];
this.uploadFiles.forEach((item, index) => {
this.successFiles.push(item);
})
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&', this.successFiles);
let slen = this.successFiles.length;
for (let n = slen; n < 10; n++) {
this.successFiles.push('');
}
},
delPhoto(url) {
let tmp = uni.getStorageSync('ai_face_success');
if (tmp) {
const index = tmp.indexOf(url);
if (index !== -1) {
tmp.splice(index, 1);
}
uni.setStorageSync('ai_face_success', tmp);
this.setSuccessFiles();
}
},
getNavHeight(e) {
this.margin_top += e;
},
upPhoto() {
subPhoto(){
let data = {};
data.tmp_id = '';
let imgs = uni.getStorageSync('ai_face_success');
if(imgs.length < 5){
this.$com.showError('请上传至少5张照片!')
return false;
}
data.imgs = imgs;
//
uni.redirectTo({
url:'/pagesA/photo/cartoon_4?from=photo'
})
},
subFace(){
let data = {};
data.tmp_id = '';
let imgs = uni.getStorageSync('ai_face_success');
if(imgs.length < 5){
this.$com.showError('请上传至少5张照片!')
return false;
}
data.imgs = imgs;
this.show_1 = true;
},
//
checkAuth() {
var _this = this;
@ -227,130 +227,102 @@
},
async afterRead(event) {
var _this = this;
let lists = [].concat(event.file);
console.log(lists);
for (let i = 0; i < lists.length; i++) {
var edetail =lists[i].url;
let filePath = edetail;
let _date = new Date();
let ext_name = filePath.substr(filePath.lastIndexOf('.'));
let address = _date.getFullYear() + '' + (_date.getMonth() + 1) + '' + _date.getDate();
let fileName = address + _date.getTime() + ext_name;
const img_info = await unit.getImgInfo(filePath);
let { width, height } = img_info;
let maxWidth = 2480;
if (width > maxWidth) {
let scale = Math.ceil(width / maxWidth);
height = Math.ceil(height / scale);
width = Math.ceil(maxWidth);
}
let compress_path = '';
compress_path = await unit.compressImg(filePath, { compressedWidth: width }).catch((res) => {
console.log('上传压缩失败', err);
});
compress_path = compress_path ? compress_path : filePath;
console.log('&&&&&&&&&&',compress_path,fileName) ;
_this.upload_img(compress_path, fileName);
}
var _this = this;
let lists = [].concat(event.file);
},
uploadFilePromise(url) {
},
async upload_img(filePath, fileName) {
var _this =this;
try {
uni.showLoading({
title: '图片上传中',
});
const { file_url = '' } = await photoUploadFile(filePath, fileName,'user_avatar')
.finally(() => {
uni.hideLoading();
})
.catch((res) => {
console.log('ossUploadFile==', res);
uni.$u.toast('图片上传失败!!');
});
if (!file_url) {
uni.$u.toast('图片上传失败!!!!!');
return;
uni.showLoading({
title: '图片上传中',
});
for (let i = 0; i < lists.length; i++) {
var edetail = lists[i].url;
let filePath = edetail;
let _date = new Date();
let ext_name = filePath.substr(filePath.lastIndexOf('.'));
let address = _date.getFullYear() + '' + (_date.getMonth() + 1) + '' + _date.getDate();
let fileName = address + _date.getTime() + ext_name;
const img_info = await unit.getImgInfo(filePath);
let {
width,
height
} = img_info;
let maxWidth = 2480;
if (width > maxWidth) {
let scale = Math.ceil(width / maxWidth);
height = Math.ceil(height / scale);
width = Math.ceil(maxWidth);
}
console.log('success upload')
console.log(file_url);
_this.info.avatar = file_url;
_this.wxAvatar = [{url:ossurl(file_url, 'user_face')}];
updateUserInfo(_this.info).then(res => {
if (res.code != 200) {
uni.$u.toast(res.msg);
}
else
{
store.commit('userInfo/set_user_info', _this.info);
}
let compress_path = '';
compress_path = await unit.compressImg(filePath, {
compressedWidth: width
}).catch((res) => {
console.log('上传压缩失败', err);
return false;
});
} catch (err) {
console.log('图片上传失败', err);
uni.$u.toast('上传照片失败~~');
}
},
loadData() {
compress_path = compress_path ? compress_path : filePath;
//_this.upload_img(compress_path, fileName);
//
var upData = {
filePath: compress_path,
fileType: 'image',
scene: 'user_max'
};
_this.$api.ossUpload(upData, function(res) {
if (res.code == 200) {
let url = res.data.file_url;
url = _this.$api.ossurl(url);
//
let checkData = {
'url': url
}
// _this.$api.post('',checkData,function(rs){
// },function(err){
// console.log(err);
// });
//
_this.uploadFiles = uni.getStorageSync('ai_face_success');
if (!_this.uploadFiles) {
_this.uploadFiles = [];
}
if (_this.uploadFiles.length < 10) {
_this.uploadFiles.push(url);
uni.setStorageSync('ai_face_success', _this.uploadFiles);
_this.setSuccessFiles();
}
// _this.uploadFiles.push(url);
//
//_this.errorFiles.push(url);
},
async upload_img(filePath, fileName) {
var _this = this;
try {
uni.showLoading({
title: '图片上传中',
});
const {
file_url = ''
} = await photoUploadFile(filePath, fileName, 'user_avatar')
.finally(() => {
uni.hideLoading();
})
.catch((res) => {
console.log('ossUploadFile==', res);
uni.$u.toast('图片上传失败!!');
});
if (!file_url) {
uni.$u.toast('图片上传失败!!!!!');
return;
}
console.log('success upload')
console.log(file_url);
_this.info.avatar = file_url;
_this.wxAvatar = [{
url: ossurl(file_url, 'user_face')
}];
updateUserInfo(_this.info).then(res => {
if (res.code != 200) {
uni.$u.toast(res.msg);
} else {
store.commit('userInfo/set_user_info', _this.info);
}
}, function(err) {
console.log('ossUpload fail', err);
_this.$com.showError('上传图片错误!!')
});
} catch (err) {
console.log('图片上传失败', err);
uni.$u.toast('上传照片失败~~');
}
},
uni.hideLoading();
}
}
}
</script>

@ -4,7 +4,7 @@
<custom_navbar :title="navbar_title" @getNavHeight="getNavHeight" :theme="theme" />
<view class="photo_main" :style="'margin-top:'+margin_top+'px'">
<view class="search_div">
<view class="search_div" style="margin-top: 20rpx;">
<view class="search_div_1">
<image src="/static/img/common/search_icon.png" />
</view>
@ -16,7 +16,7 @@
<view class="tabs_div">
<u-tabs @click="changeTab()" :list="list1" lineWidth="25" lineHeight="10"
<u-tabs @click="changeTab()" :current="this_tab" :list="list1" lineWidth="25" lineHeight="10"
:lineColor="`url(${lineBg}) 100% 100%`" :activeStyle="{
color: '#333333',
fontWeight: 'bold',
@ -29,17 +29,23 @@
</view>
<scroll-view class="photo_list_div" enable-flex="true" scroll-y="true" @scrolltolower="lower" lower-threshold="2">
<scroll-view class="photo_list_div"
enable-flex="true"
scroll-y="true"
scroll-with-animation="true"
@scrolltolower="lower"
lower-threshold="50">
<view class="photo_list_div_one" v-for="n in 10">
<view class="photo_list_div_one" v-for="(item,key) in temList" :key="key" @tap="goThis(item.id)">
<view class="photo_list_div_one_img" >
<image
src="https://img30.360buyimg.com/sku/jfs/t1/221254/4/39390/74349/661e039aF46114279/48532008a0001dd0.jpg"
:src="item.url"
mode="aspectFill" />
</view>
<view class="photo_list_div_one_text">
港风复古-{{n}}
{{item.title}}
</view>
</view>
</scroll-view>
@ -65,15 +71,20 @@
navbar_title: 'AI写真',
theme: "white",
search_text: '',
margin_top: 10,
margin_top: 0,
lineBg: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAOCAYAAABDwm71AAAAAXNSR0IArs4c6QAAAm5JREFUSEu1lD1oFEEUx39vZhOCpghikUIwkMKAjYWFEEELQdQTRfwqLGyMgsFcNDEWEbYQNB+Sw7ugdilSBDQ2tikSsFCwsBFiIVikSBEwQoRLuMzT3ds9z8vtXcjHwOzCzs57v/ef/xshGmdeaLsVUgZQYeZ9t3yN13bz/bpf2wVSYQ7DTNdQMa8Ej1RO76JkRPBQ8JS8OAbfpeX5bkLlHumAcTyxihcIAuSBvlsjMi7nc3pY4TPQFJIq2GiKY3TpF49nfQk27NjwffX25RkzSreJckVggS4FhQ5JZbVHhEwpaxlYsMk4PjYYbk6m5dtOkGUG9ZBzTFjHsUCASrAgh0I6BKMMrFyxeJN15A28susMTTyUxa0A+v3auqeRHqP0GcWLTyURLDL9fOivCHfDpljFAFCZ8oS3P38z98aXlVqQvq/N4jjhKddNcYZApYKrK5ZXw9HQ/OfG9YEoo5UeK1VTcbwhuKPwN9m8VeYNLHqO5cAnxtFs4YBxdFilw4BnXdG3teLFHgO6Q/PHFZ/N6QUDU6I0JSpWL3iVAsrsUA8sr3Cja0SmS9dF6S7LameDMmmgrW6FtSCKTVNUiVDdeootoFy+PSqfYpaSYvGHi2PaIoaXhtAT/wXcFqyrfpQCE2ur9PZmZLncrxvA4sVLWe206+SscqSqWberGHwRSN97KnPVGigRLP75akZPNzjSxnHKgrdlFYuKFQzMWMez+wlAiUeZ1P5XhrV1r+GacZy0cNwo+2s2yT+PLXmOD1aZlTWmB4ZlYTP3YF3FkoLc8bVNGjkYNUqLB82R0VeMY9kTfqw6vg/7mwOpzPMHTiZrgwPNrpsAAAAASUVORK5CYII=',
list1: [{
name: '女生'
}, {
name: '男生',
}],
this_tab:0,
curPage: 0,
total: 0,
temList:[]
}
},
@ -85,33 +96,89 @@
methods: {
lower(){
console.log('this is lower')
this.loadMore();
},
loadMore() {
let isLoad = Math.ceil(this.total / 10) > this.curPage;
if (isLoad) {
this.getList();
}
},
getNavHeight(e) {
this.margin_top += e;
},
goSearch() {
console.log(this.search_text);
this.total =0;
this.temList=[];
this.curPage = 0;
this.getList();
},
changeTab(e) {
console.log(e)
this.this_tab = e.index;
this.total =0;
this.temList = [];
this.curPage = 0;
let that = this;
setTimeout(function(){
that.getList();
},1000)
},
initListHeight(){
onLoad(){
this.getList();
},
getListData(){
let list = [];
let n= 0;
for(n=0;n<10;n++){
let t = {};
t.url = 'https://img30.360buyimg.com/sku/jfs/t1/221254/4/39390/74349/661e039aF46114279/48532008a0001dd0.jpg'
t.id = '123';
t.title = '哈哈哈哈哈哈哈哈哈哈或或或哈哈哈哈哈哈哈哈哈哈或或或';
list.push(t);
}
return {total:32,list:list};
},
getScreenSize() {
uni.getSystemInfo({
success: (res) => {
const screenWidth = res.windowWidth; // px
const screenHeight = res.windowHeight; // px
console.log('屏幕宽度:', screenWidth);
console.log('屏幕高度:', screenHeight);
},
});
getList(){
let params = {
page: this.curPage + 1,
limit: 10,
sex: this.this_tab,
text:this.search_text
};
let res = this.getListData();
this.curPage = params.page;
this.total = res.total;
let datas = [...this.temList];
if (params.page > 1) {
datas.push(...res.list)
} else {
datas = res.list;
}
this.temList = datas;
},
goThis(id){
uni.navigateTo({
url:'/pagesA/photo/photo_2?id='+id
})
}
}
}
</script>

@ -32,13 +32,65 @@
</view>
<view class="photo_tem_2">
<view class="photo_tem_2" v-if="show_btn">
使用模板生成
</view>
</view>
</view>
<u-popup :show="show_2" mode="center" bgColor="transparent" :round="12">
<view class="show_readme_div" style="height: 380rpx;">
<view class="show_readme_div_1">
提醒
</view>
<view class="show_readme_div_2">
<view>目前系统还未存入您的面部档案信息请先前往创建需要生成写真的面部档案</view>
</view>
<view class="show_readme_div_line">
<view class="show_readme_div_4" style="width: 220rpx;">
暂不生成
</view>
<view class="show_readme_div_3" style="width: 220rpx;">
前往创建
</view>
</view>
</view>
</u-popup>
<u-popup :show="show_3" mode="center" bgColor="transparent" :round="12">
<view class="show_readme_div" style="height: 440rpx;">
<view class="show_readme_div_1">
请选择需要生成写真的面部档案
</view>
<view class="show_readme_div_2" style="width: 520rpx;margin-left: 40rpx;">
<view class="show_readme_div_2_1">
<view class="show_readme_div_2_1_one" v-for="(item,index) in face_list" :key="index" @tap="selectThis(index,id)">
<view class="show_readme_div_2_1_one_1">
<image :src="item.url" />
</view>
<view class="show_readme_div_2_1_one_2" v-if="index == select_index">
<image src="/static/img/common/photo_common_21.png" />
</view>
</view>
</view>
</view>
<view class="show_readme_div_line">
<view class="show_readme_div_4" style="width: 220rpx;">
暂不生成
</view>
<view class="show_readme_div_3" style="width: 220rpx;" @tap="goUrl('/pagesA/pohto/face')">
确定
</view>
</view>
</view>
</u-popup>
</view>
</template>
@ -61,6 +113,13 @@
'https://img30.360buyimg.com/sku/jfs/t1/221254/4/39390/74349/661e039aF46114279/48532008a0001dd0.jpg',
'https://img30.360buyimg.com/sku/jfs/t1/221254/4/39390/74349/661e039aF46114279/48532008a0001dd0.jpg',
],
has_face : 1 ,//
show_3:false,
show_2:false,
show_btn:false,
face_list :[],
select_index:0,
select_id:''
}
},
@ -68,12 +127,39 @@
mounted() {
},
onLoad() {
this.getFace()
},
onShow() {
},
methods: {
getNavHeight(e) {
this.margin_top += e;
}
,
getFace(){
if(this.has_face == 0){
this.show_2 = true
}else{
for(let n=0;n<3;n++){
let t = {};
t.url = '/static/img/index/banner.png';
this.face_list.push(t);
}
this.show_3 = true
}
},
selectThis(index,id){
this.select_id = id;
this.select_index = index;
}
}
}

Loading…
Cancel
Save