feat: 增加发型合成照片
This commit is contained in:
+25
-30
@@ -1,51 +1,46 @@
|
|||||||
import { request } from "../../http/index.js";
|
// import { request } from "../../http/index.js";
|
||||||
|
|
||||||
let baseUrl = "https://llshop.zglvling.com/soapi/";
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
|
let baseUrl = 'https://llshop.zglvling.com/soapi/';
|
||||||
// let baseUrl = "https://test.zglvling.com/soapi/";
|
// let baseUrl = "https://test.zglvling.com/soapi/";
|
||||||
// const praiseTextApi = (params) =>
|
// const praiseTextApi = (params) =>
|
||||||
// request.post(baseUrl + "ai/praiseTexttwo", params);
|
// request.post(baseUrl + "ai/praiseTexttwo", params);
|
||||||
|
|
||||||
|
|
||||||
const praiseTextApi = (params) => {
|
const praiseTextApi = (params) => {
|
||||||
console.log('params: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', params);
|
console.log('params: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', params);
|
||||||
|
|
||||||
return request.post('https://ark.cn-beijing.volces.com/api/v3/chat/completions', params);
|
return request.post('https://ark.cn-beijing.volces.com/api/v3/chat/completions', params);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const userFaceInoApi = (params) => request.post(baseUrl + 'userinfo/get_user_face_info', params);
|
||||||
|
|
||||||
const userFaceInoApi = (params) =>
|
|
||||||
request.post(baseUrl + "userinfo/get_user_face_info", params);
|
|
||||||
const hairstyleListApi = (params) =>
|
const hairstyleListApi = (params) =>
|
||||||
request.post(
|
request.post('https://puton.meidaojia.com/api/v1/test/getHairDetails', params);
|
||||||
"https://puton.meidaojia.com/api/v1/test/getHairDetails",
|
|
||||||
params
|
|
||||||
);
|
|
||||||
const exchangeHairApi = (params) =>
|
const exchangeHairApi = (params) =>
|
||||||
request.post("https://puton.meidaojia.com/api/v1/test/exchangeHair", params);
|
request.post('https://puton.meidaojia.com/api/v1/test/exchangeHair', params);
|
||||||
const exchangeHairHistoryByTaskId = (params) =>
|
|
||||||
request.post(
|
|
||||||
"https://puton.meidaojia.com/api/v1/test/exchangeHairHistoryByTaskId",
|
|
||||||
params
|
|
||||||
);
|
|
||||||
|
|
||||||
const wardrobeListApi = (params) =>
|
// const exchangeHairHistoryByTaskId = (params) =>
|
||||||
request.post(baseUrl + "wardrobe/clothes_list", params);
|
// request.post('https://puton.meidaojia.com/api/v1/test/exchangeHairHistoryByTaskId', params);
|
||||||
|
const exchangeHairHistoryByTaskId = (data) =>
|
||||||
|
request({
|
||||||
|
url: 'https://puton.meidaojia.com/api/v1/test/exchangeHairHistoryByTaskId',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
custom: {
|
||||||
|
showLoading: false
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const getStyleApi = (params) =>
|
const wardrobeListApi = (params) => request.post(baseUrl + 'wardrobe/clothes_list', params);
|
||||||
request.post(baseUrl + "userinfo/get_user_face_info", params);
|
|
||||||
|
const getStyleApi = (params) => request.post(baseUrl + 'userinfo/get_user_face_info', params);
|
||||||
|
|
||||||
const hairStyleListApi = (params) =>
|
const hairStyleListApi = (params) =>
|
||||||
request.post(
|
request.post('https://puton.meidaojia.com/api/v1/test/getHairDetails', params);
|
||||||
"https://puton.meidaojia.com/api/v1/test/getHairDetails",
|
|
||||||
params
|
|
||||||
);
|
|
||||||
|
|
||||||
const addHairApi = (params) =>
|
const addHairApi = (params) => request.post(baseUrl + 'userinfo/add_hair_data', params);
|
||||||
request.post(baseUrl + "userinfo/add_hair_data", params);
|
|
||||||
|
|
||||||
const getHairApi = (params) =>
|
const getHairApi = (params) => request.post(baseUrl + 'userinfo/get_hair_data', params);
|
||||||
request.post(baseUrl + "userinfo/get_hair_data", params);
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
praiseTextApi,
|
praiseTextApi,
|
||||||
|
|||||||
+59
-51
@@ -1,7 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<view style="overflow-x: hidden; font-size: 0">
|
<view style="overflow-x: hidden; font-size: 0">
|
||||||
|
<img
|
||||||
<img v-if="isInPptr" src="/static/header.png" style="width: 100%;display: block;margin-bottom: -600rpx;" />
|
v-if="isInPptr"
|
||||||
|
src="/static/header.png"
|
||||||
|
style="width: 100%; display: block; margin-bottom: -600rpx"
|
||||||
|
/>
|
||||||
|
|
||||||
<view id="headerBox">
|
<view id="headerBox">
|
||||||
<!-- <Header v-if="!!userFaceInfo" :userFaceInfo="userFaceInfo" /> -->
|
<!-- <Header v-if="!!userFaceInfo" :userFaceInfo="userFaceInfo" /> -->
|
||||||
@@ -22,14 +25,14 @@
|
|||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<view
|
||||||
<view style="display: block;background-color: white;position: relative;z-index: 2;" v-if="isInPptr">
|
style="display: block; background-color: white; position: relative; z-index: 2"
|
||||||
<img src="/static/nav-1.png" style="width: 100%;display: block;" />
|
v-if="isInPptr"
|
||||||
<img src="/static/nav-2.png" style="width: 100%;display: block;" />
|
>
|
||||||
|
<img src="/static/nav-1.png" style="width: 100%; display: block" />
|
||||||
|
<img src="/static/nav-2.png" style="width: 100%; display: block" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view :class="classFixed" style="width: 100%" v-if="!isInPptr">
|
<view :class="classFixed" style="width: 100%" v-if="!isInPptr">
|
||||||
<Tabs :tabs="tabsList" :activeTab="activeTab" @update:activeTab="onTabChange"> </Tabs>
|
<Tabs :tabs="tabsList" :activeTab="activeTab" @update:activeTab="onTabChange"> </Tabs>
|
||||||
</view>
|
</view>
|
||||||
@@ -110,16 +113,16 @@
|
|||||||
<!-- 个人分格描述报告-->
|
<!-- 个人分格描述报告-->
|
||||||
<StyleDiagnosticReport :html="customerStyle" />
|
<StyleDiagnosticReport :html="customerStyle" />
|
||||||
|
|
||||||
<BottomPic
|
<!-- <BottomPic
|
||||||
:style-type="collect?.type"
|
:style-type="collect?.type"
|
||||||
:psychological-style="collect?.psychological_style"
|
:psychological-style="collect?.psychological_style"
|
||||||
:gender="collect.sex"
|
:gender="collect.sex"
|
||||||
/>
|
/> -->
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="isInPptr ? true :activeTab === 1">
|
<view v-if="isInPptr ? true : activeTab === 1">
|
||||||
<view class="style-type">
|
<view class="style-type">
|
||||||
<view class="title">四季色彩定位</view>
|
<view class="title">四季色彩定位</view>
|
||||||
<view class="swiper-container">
|
<view class="swiper-container">
|
||||||
@@ -267,7 +270,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isInPptr ? true :activeTab === 3">
|
<view v-if="isInPptr ? true : activeTab === 3">
|
||||||
<view class="style-type" style="overflow-y: hidden">
|
<view class="style-type" style="overflow-y: hidden">
|
||||||
<view class="lucky-color-box" style="overflow-y: hidden">
|
<view class="lucky-color-box" style="overflow-y: hidden">
|
||||||
<view class="shengxiao">
|
<view class="shengxiao">
|
||||||
@@ -351,7 +354,7 @@
|
|||||||
<button class="next-btn" @click="openEmailDialog">发送到邮件</button>
|
<button class="next-btn" @click="openEmailDialog">发送到邮件</button>
|
||||||
</view> -->
|
</view> -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<view class="m-dialog" v-if="dialog.visible">
|
<view class="m-dialog" v-if="dialog.visible">
|
||||||
<div class="m-dialog-main">
|
<div class="m-dialog-main">
|
||||||
<div class="email">
|
<div class="email">
|
||||||
@@ -392,6 +395,9 @@
|
|||||||
import Movementtype from './component/FirstStyleType/Movementtype.vue';
|
import Movementtype from './component/FirstStyleType/Movementtype.vue';
|
||||||
import ReportApi from '../../sheep/api/report';
|
import ReportApi from '../../sheep/api/report';
|
||||||
|
|
||||||
|
import * as abc from './api';
|
||||||
|
console.log('exchangeHairHistoryByTaskId: xxxxxxxxxx', abc.exchangeHairHistoryByTaskId);
|
||||||
|
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import {
|
import {
|
||||||
hairText,
|
hairText,
|
||||||
@@ -402,7 +408,7 @@
|
|||||||
} from '@/constant/aiText';
|
} from '@/constant/aiText';
|
||||||
import { praiseTextApi } from '@/sheep/api/doubao';
|
import { praiseTextApi } from '@/sheep/api/doubao';
|
||||||
|
|
||||||
const email = ref('');
|
// const email = ref('');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
// praiseTextApi,
|
// praiseTextApi,
|
||||||
@@ -416,7 +422,7 @@
|
|||||||
getUserInfo,
|
getUserInfo,
|
||||||
getUserAvatar,
|
getUserAvatar,
|
||||||
sendMail,
|
sendMail,
|
||||||
getImage
|
getImage,
|
||||||
} = ReportApi;
|
} = ReportApi;
|
||||||
|
|
||||||
const collect = ref(null);
|
const collect = ref(null);
|
||||||
@@ -424,8 +430,7 @@
|
|||||||
const isInPptr = ref(false);
|
const isInPptr = ref(false);
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
|
isInPptr.value = options?.isInPptr == '1';
|
||||||
isInPptr.value = options?.isInPptr == '1'
|
|
||||||
|
|
||||||
uni.setStorageSync('token', options?.token ?? '92d2805a85ca422e90dd7d50eef49a85');
|
uni.setStorageSync('token', options?.token ?? '92d2805a85ca422e90dd7d50eef49a85');
|
||||||
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token);
|
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token);
|
||||||
@@ -433,7 +438,7 @@
|
|||||||
Promise.all([getUserInfo(), getAiFaceResult(), getUserAvatar(), getImage()]).then((result) => {
|
Promise.all([getUserInfo(), getAiFaceResult(), getUserAvatar(), getImage()]).then((result) => {
|
||||||
const [res1, res2, res3, res4] = result;
|
const [res1, res2, res3, res4] = result;
|
||||||
console.log('res4: zzzzzzzzzzzzz', res4.data.list);
|
console.log('res4: zzzzzzzzzzzzz', res4.data.list);
|
||||||
const [{firstImageUrl, secondImageUrl, thirdImageUrl}] =res4.data.list
|
const [{ firstImageUrl, secondImageUrl, thirdImageUrl }] = res4.data.list;
|
||||||
|
|
||||||
const { data } = JSON.parse(res2.result[0].thridResp);
|
const { data } = JSON.parse(res2.result[0].thridResp);
|
||||||
|
|
||||||
@@ -442,10 +447,10 @@
|
|||||||
firstImageUrl,
|
firstImageUrl,
|
||||||
secondImageUrl,
|
secondImageUrl,
|
||||||
thirdImageUrl,
|
thirdImageUrl,
|
||||||
avatar_img_url: options.img
|
avatar_img_url: options.img,
|
||||||
});
|
});
|
||||||
|
|
||||||
target.gender = target.sex;
|
target.gender = target.sex || '女';
|
||||||
collect.value = target;
|
collect.value = target;
|
||||||
|
|
||||||
// collect.value.avatar = collect.value.avatar || 'https://puton.huimeimeta.com/imgs/default_avatar.png'
|
// collect.value.avatar = collect.value.avatar || 'https://puton.huimeimeta.com/imgs/default_avatar.png'
|
||||||
@@ -770,17 +775,15 @@
|
|||||||
const pollExchangeHairHistory = (requestId, maxTries = 30, interval = 2000) => {
|
const pollExchangeHairHistory = (requestId, maxTries = 30, interval = 2000) => {
|
||||||
let tries = 0;
|
let tries = 0;
|
||||||
const poll = (resolve, reject) => {
|
const poll = (resolve, reject) => {
|
||||||
exchangeHairHistoryByTaskId({ taskId: requestId })
|
abc
|
||||||
|
.exchangeHairHistoryByTaskId({ taskId: requestId })
|
||||||
.then((ress) => {
|
.then((ress) => {
|
||||||
// console.log("轮询结果", ress);
|
console.log('轮询结果', ress);
|
||||||
if (
|
|
||||||
ress.result[0].url !==
|
const siteImg = 'https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png'
|
||||||
'https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png' &&
|
const images = ress.result.map(i => i.url).filter(i => i != siteImg)
|
||||||
ress.result[1].url !==
|
|
||||||
'https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png' &&
|
if ([...new Set(images)].length === 3) {
|
||||||
ress.result[2].url !==
|
|
||||||
'https://cdn.meidaojia.com/aidigitalfield/digital_cloth/static/1720084773937.png'
|
|
||||||
) {
|
|
||||||
resolve(ress);
|
resolve(ress);
|
||||||
} else if (tries >= maxTries) {
|
} else if (tries >= maxTries) {
|
||||||
reject(new Error('轮询超时'));
|
reject(new Error('轮询超时'));
|
||||||
@@ -788,6 +791,12 @@
|
|||||||
tries++;
|
tries++;
|
||||||
setTimeout(() => poll(resolve, reject), interval);
|
setTimeout(() => poll(resolve, reject), interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if(ress.result.length !== 3) {
|
||||||
|
// setTimeout(() => poll(resolve, reject), interval);
|
||||||
|
// } else {
|
||||||
|
// resolve(ress);
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject(err);
|
reject(err);
|
||||||
@@ -822,7 +831,7 @@
|
|||||||
colorTypeInfo.value = newColorTypeList.value[0];
|
colorTypeInfo.value = newColorTypeList.value[0];
|
||||||
|
|
||||||
// userFaceInfo.value = res.data || {};
|
// userFaceInfo.value = res.data || {};
|
||||||
userFaceInfo.value = collect.value
|
userFaceInfo.value = collect.value;
|
||||||
// if (!userFaceInfo.value.avatar_img_url) {
|
// if (!userFaceInfo.value.avatar_img_url) {
|
||||||
// userFaceInfo.value.avatar_img_url = 'https://llshop.zglvling.com/shop/img/jpg/avatar.jpg';
|
// userFaceInfo.value.avatar_img_url = 'https://llshop.zglvling.com/shop/img/jpg/avatar.jpg';
|
||||||
// }
|
// }
|
||||||
@@ -854,7 +863,8 @@
|
|||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('phone', '17600222111');
|
formData.append('phone', '17600222111');
|
||||||
formData.append('isHr', 'false');
|
formData.append('isHr', 'false');
|
||||||
formData.append('sex', userFaceInfo?.value.gender);
|
// formData.append('sex', userFaceInfo?.value.gender);
|
||||||
|
formData.append('sex', collect.value?.gender == '男' ? 'male' : 'female');
|
||||||
formData.append('hairIds', hairIds.value);
|
formData.append('hairIds', hairIds.value);
|
||||||
// 如果有图片/文件需要上传
|
// 如果有图片/文件需要上传
|
||||||
if (blob) {
|
if (blob) {
|
||||||
@@ -862,14 +872,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let taskInfo = await uploadFormData(formData);
|
let taskInfo = await uploadFormData(formData);
|
||||||
|
console.log('taskInfo: cccccccccccccccccc', taskInfo);
|
||||||
let ress = null;
|
let ress = null;
|
||||||
if (enterType === 'weixin') {
|
if (enterType === 'weixin') {
|
||||||
ress = await getHair();
|
ress = await getHair();
|
||||||
} else {
|
} else {
|
||||||
// ress = await pollExchangeHairHistory(taskInfo.requestId);
|
const uuuress = await pollExchangeHairHistory(taskInfo.requestId);
|
||||||
|
console.log('uuuress: xxxxxxxxxxxx', uuuress);
|
||||||
// await addHair(ress);
|
// await addHair(ress);
|
||||||
|
avatarList.value = uuuress.result;
|
||||||
}
|
}
|
||||||
// avatarList.value = ress.result;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -942,10 +954,9 @@
|
|||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const openEmailDialog = async () => {
|
const openEmailDialog = async () => {
|
||||||
console.log('openEmailDialog: ');
|
console.log('openEmailDialog: ');
|
||||||
const emailVal = window.prompt('请输入邮箱')
|
const emailVal = window.prompt('请输入邮箱').trim();
|
||||||
|
|
||||||
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||||
|
|
||||||
@@ -955,10 +966,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
timeout: 100 * 1000,
|
timeout: 120 * 1000,
|
||||||
url: window.location.href+'&isInPptr=1',
|
url: window.location.href + '&isInPptr=1',
|
||||||
email: emailVal
|
email: emailVal,
|
||||||
}
|
};
|
||||||
|
|
||||||
console.log('data: xxxxxxxxxx', data);
|
console.log('data: xxxxxxxxxx', data);
|
||||||
|
|
||||||
@@ -1433,9 +1444,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
||||||
.download {
|
.download {
|
||||||
background-color: #D9D9D9;
|
background-color: #d9d9d9;
|
||||||
height: 128rpx;
|
height: 128rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -1444,8 +1454,6 @@
|
|||||||
padding: 0 24rpx;
|
padding: 0 24rpx;
|
||||||
|
|
||||||
.download-left {
|
.download-left {
|
||||||
|
|
||||||
|
|
||||||
.pdf-icon {
|
.pdf-icon {
|
||||||
width: 102rpx;
|
width: 102rpx;
|
||||||
height: 102rpx;
|
height: 102rpx;
|
||||||
@@ -1453,13 +1461,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.download-center {
|
.download-center {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
color: #979797;
|
color: #979797;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.download-right {
|
.download-right {
|
||||||
|
|||||||
Reference in New Issue
Block a user