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