feat: 增加数据获取接口请求
This commit is contained in:
@@ -102,7 +102,6 @@
|
||||
const token = ref('');
|
||||
|
||||
onLoad((e) => {
|
||||
console.log('onLoad: ---------', e);
|
||||
token.value = e.token;
|
||||
uni.setStorageSync('token', e.token);
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<view class="">
|
||||
<view class="info-main">
|
||||
<view class="info-basic">
|
||||
<text class="gender">{{ userFaceInfo.gender }}</text>
|
||||
<text class="gender">{{ userFaceInfo.sex }}</text>
|
||||
<text class="birthday">| {{ userFaceInfo.createTime }}</text>
|
||||
</view>
|
||||
<view class="info-desc">
|
||||
@@ -35,11 +35,11 @@
|
||||
<view class="info-columns">
|
||||
<view class="col-item">
|
||||
<text class="col-label">身高</text>
|
||||
<text class="col-value">{{ userFaceInfo.stature || "-" }}cm</text>
|
||||
<text class="col-value">{{ userFaceInfo.height || "-" }}cm</text>
|
||||
</view>
|
||||
<view class="col-item">
|
||||
<text class="col-label">体重</text>
|
||||
<text class="col-value">{{ userFaceInfo.bodyWeight || "-" }}kg</text>
|
||||
<text class="col-value">{{ userFaceInfo.weight || "-" }}kg</text>
|
||||
</view>
|
||||
<view class="col-item">
|
||||
<text class="col-label">修饰目标</text>
|
||||
@@ -62,13 +62,21 @@ const props = defineProps({
|
||||
default: {},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
// console.log('9999999999999999999999999', props.userFaceInfo)
|
||||
|
||||
|
||||
|
||||
const userFaceInfo = ref({});
|
||||
|
||||
watch(
|
||||
() => props.userFaceInfo,
|
||||
(newVal) => {
|
||||
console.log('newVal: xxxxxxxx', newVal);
|
||||
userFaceInfo.value = newVal;
|
||||
},
|
||||
{ deep: true }
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
+36
-36
@@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<view style="overflow-x: hidden; font-size: 0">
|
||||
<view id="headerBox">
|
||||
<Header v-if="!!userFaceInfo" :userFaceInfo="userFaceInfo" />
|
||||
<!-- <Header v-if="!!userFaceInfo" :userFaceInfo="userFaceInfo" /> -->
|
||||
<Header v-if="collect" :userFaceInfo="collect" />
|
||||
|
||||
<view class="report">
|
||||
<view class="report-title"> 美学诊断报告 </view>
|
||||
<view class="report-title-en"> FD Aesthetic Diagnosis Report </view>
|
||||
@@ -417,6 +419,8 @@ import SensoryTypes from "./component/FirstStyleType/SensoryTypes.vue";
|
||||
import TypeOfMass from "./component/FirstStyleType/TypeOfMass.vue";
|
||||
import Movementtype from "./component/FirstStyleType/Movementtype.vue";
|
||||
import ReportApi from "../../sheep/api/report";
|
||||
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
const {
|
||||
praiseTextApi,
|
||||
getStyleApi,
|
||||
@@ -425,7 +429,33 @@ const {
|
||||
hairStyleListApi,
|
||||
addHairApi,
|
||||
getHairApi,
|
||||
getAiFaceResult,
|
||||
getUserInfo
|
||||
} = ReportApi;
|
||||
|
||||
|
||||
const collect = ref(null)
|
||||
|
||||
|
||||
onLoad((options) => {
|
||||
uni.setStorageSync('token', options?.token ?? '92d2805a85ca422e90dd7d50eef49a85');
|
||||
console.log('🚀 ~ URL上的token ~ options?.token: ', options?.token);
|
||||
|
||||
Promise.all([getUserInfo(), getAiFaceResult()]).then(result => {
|
||||
const [res1, res2] = result
|
||||
|
||||
const {data} = JSON.parse(res2.result[0].thridResp)
|
||||
|
||||
collect.value = Object.assign({}, JSON.parse(res1.data.dataJson), data.face_figure)
|
||||
|
||||
console.log('collect.value: ', collect.value);
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// if (
|
||||
// typeof window !== "undefined" &&
|
||||
// /MicroMessenger/i.test(navigator.userAgent)
|
||||
@@ -951,43 +981,8 @@ const getPraiseText = (callWord, type) => {
|
||||
luckyTxtList.value = formatShengXiao(res.data);
|
||||
} else if (callWord === "three") {
|
||||
let obj = JSON.parse(res.data);
|
||||
// let obj = {
|
||||
// choices: [
|
||||
// {
|
||||
// finish_reason: "stop",
|
||||
// index: 0,
|
||||
// logprobs: null,
|
||||
// message: {
|
||||
// content:
|
||||
// '\n{\n "content": {\n "text": "\u003cdiv\u003e\u003cp\u003e1. 五行主属性和八字:此八字中五行水的个数为3个,金、木、火的个数均为1个,土的个数为0个,五行主属性为水,八字为癸亥年、乙酉月、癸巳日。\u003c/p\u003e\u003cp\u003e2. 五行命理和适合颜色:五行命理水旺,土较弱。适合颜色为黑色、深蓝色(水属性),金色、白色(金能生水),也可适当搭配黄色、棕色(补土)。\u003c/p\u003e\u003cp\u003e3. 场景化搭配建议:日常穿着可多选择黑色、深蓝色衣物,搭配金色或白色饰品;家居装饰中,客厅可选用蓝色系窗帘,摆放白色摆件,同时可放置一些黄色的绿植花盆来补土。\u003c/p\u003e\u003cp\u003e4. 动态调整建议:冬季可多使用黑色、深蓝色,增强水的能量;秋季可侧重金色、白色,借助金的力量生水;在土属性相关的场合,如参加户外活动时,可穿戴黄色衣物进行调整。\u003c/p\u003e\u003c/div\u003e",\n "arr": ["猪", "1", "1", "3", "1", "0"]\n }\n}',
|
||||
// reasoning_content:
|
||||
// '\n用户需要根据生日计算年柱、月柱、日柱的五行属性个数,不考虑时柱和藏干,然后生成颜色报告。首先,我需要确定用户的出生日期对应的八字。阳历1983年10月5日,转换成农历可能需要查万年历。1983年是癸亥年,10月5日对应的农历应该是九月初一左右,但具体的月柱需要根据节气来确定。因为八字中的月份是按节气划分的,不是农历月份。比如,1983年的寒露是10月9日,所以10月5日属于白露到寒露之间,应该是酉月,也就是乙酉月。日柱的话,10月5日查万年历应该是癸巳日。\n\n接下来,确定各柱的五行属性。年柱癸亥,癸属水,亥属水,所以年柱五行是水。月柱乙酉,乙属木,酉属金,所以月柱是木和金。日柱癸巳,癸属水,巳属火,所以日柱是水和火。现在计算五行个数:水出现的次数是年柱癸、亥,日柱癸,共3次;火是日柱巳,1次;木是月柱乙,1次;金是月柱酉,1次;土没有出现,所以土是0。\n\n然后,属相是根据年份来的,1983年是癸亥年,属猪,所以属相是猪。\n\n接下来生成颜色报告。五行主属性方面,水最多,所以主属性是水,八字中五行水3个,金1个,木1个,火1个,土0个。五行命理水旺,适合的颜色应该是水对应的黑色、深蓝色,以及金生水的金色、白色,因为土弱,可能需要补土,土的颜色是黄色、棕色。场景化搭配建议比如日常穿着、家居装饰用适合的颜色,动态调整建议根据季节变化,比如冬季多用水色,秋季用金色等。\n\n最后,构建数组arr,属相是猪,五行个数依次是金1,木1,水3,火1,土0,所以数组是["猪", "1", "1", "3", "1", "0"]。需要确保格式正确,使用指定的HTML标签,并且内容符合要求。\n',
|
||||
// role: "assistant",
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// created: 1753862444,
|
||||
// id: "0217538624170875e9da5334f92484a34371d3058e6715876e3da",
|
||||
// model: "doubao-1-5-thinking-pro-m-250428",
|
||||
// service_tier: "default",
|
||||
// object: "chat.completion",
|
||||
// usage: {
|
||||
// completion_tokens: 783,
|
||||
// prompt_tokens: 435,
|
||||
// total_tokens: 1218,
|
||||
// prompt_tokens_details: { cached_tokens: 0 },
|
||||
// completion_tokens_details: { reasoning_tokens: 506 },
|
||||
// },
|
||||
// };
|
||||
// console.log(text, "text33333333333333333333");
|
||||
|
||||
// if (text.startsWith('"') && text.endsWith('"')) {
|
||||
// text = text.slice(1, -1);
|
||||
// }
|
||||
|
||||
// let obj = JSON.parse(text);
|
||||
|
||||
// let shengxiaoList = JSON.parse(obj.choices[0].message.content);
|
||||
let shengxiaoContent = JSON.parse(obj.choices[0].message.content).content;
|
||||
luckyTxtList.value = formatShengXiao(shengxiaoContent.text);
|
||||
// console.log(shengxiaoContent, "shengxiaoContent");
|
||||
@@ -1054,7 +1049,12 @@ const getHairstyleList = () => {
|
||||
// console.log(res, "发型列表 -----------------");
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
getHairstyleList();
|
||||
|
||||
|
||||
const pollExchangeHairHistory = (requestId, maxTries = 30, interval = 2000) => {
|
||||
let tries = 0;
|
||||
const poll = (resolve, reject) => {
|
||||
|
||||
@@ -69,6 +69,12 @@ const ReportApi = {
|
||||
},
|
||||
}),
|
||||
|
||||
getUserInfo: () =>
|
||||
request({
|
||||
url: '/digital/records/get-by-user-id',
|
||||
method: 'get',
|
||||
}),
|
||||
|
||||
// https://puton.huimeimeta.com/app-api/cloth/getFaceList
|
||||
};
|
||||
export default ReportApi;
|
||||
|
||||
Reference in New Issue
Block a user