完成AI模块和后端的对接操作,信息填写界面和登录界面的对接全部完成

master
Gary 3 months ago
parent 5a1e37bc96
commit d8d79bacc6

@ -28,10 +28,10 @@ import ai_recongize_recipe from './components/ai_recongize_recipe/ai_recongize_r
export default { export default {
globalData: { globalData: {
// //
fit_journey_basic_address: 'http://47.122.61.54:8086',//TODO: fit_journey_basic_address: 'http://127.0.0.1:8086',//TODO:
fit_journey_community_address: 'http://47.122.61.54:8082',//TODO: fit_journey_community_address: 'http://47.122.61.54:8082',//TODO:
fit_journey_ai_address: 'http://47.122.61.54:8081',//TODO fit_journey_ai_address: 'http://127.0.0.1:8081',//TODO
fit_journey_login_address: 'http://127.0.0.1:8084',//TODO: fit_journey_login_address: 'http://47.122.61.54:8084',//TODO:
fit_journey_recipe_address: 'http://47.122.61.54:8087',//TODO: fit_journey_recipe_address: 'http://47.122.61.54:8087',//TODO:
fit_journey_exercise_address: 'http://47.122.61.54:8080',//TODO: fit_journey_exercise_address: 'http://47.122.61.54:8080',//TODO:
fit_journey_admin_address: 'http://47.122.61.54:8085',//TODO: fit_journey_admin_address: 'http://47.122.61.54:8085',//TODO:

@ -26,9 +26,14 @@ export default {
methods:{ methods:{
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_fruit/ai_recongize_fruit' url: '/pages/homepages/homes/ai_recognize_fruit/ai_recognize_fruit'
}) })
} uni.showToast({
title: '跳转成功',
icon: 'success',
})
},
} }
} }

@ -26,7 +26,11 @@ export default {
methods:{ methods:{
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_hot/ai_recongize_hot' url: '/pages/homepages/homes/ai_recognize_hot/ai_recognize_hot'
})
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }

@ -26,7 +26,11 @@ export default {
methods:{ methods:{
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_plan/ai_recongize_plan' url: '/pages/homepages/homes/ai_recognize_plan/ai_recognize_plan'
})
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }

@ -26,7 +26,11 @@ export default {
methods:{ methods:{
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_recipe/ai_recongize_recipe' url: '/pages/homepages/homes/ai_recognize_recipe/ai_recognize_recipe'
})
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }

@ -26,7 +26,7 @@ export default {
methods: { methods: {
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_fruit/ai_recongize_fruit' url: '/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary'
}) })
} }

@ -26,10 +26,15 @@ export default {
methods: { methods: {
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_fruit/ai_recongize_fruit' url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan'
}) ;
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }
} }
} }
</script> </script>

@ -26,7 +26,11 @@ export default {
methods: { methods: {
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_fruit/ai_recongize_fruit' url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan'
})
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }

@ -26,7 +26,10 @@ export default {
methods: { methods: {
go_to_page() { go_to_page() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/ai_recongize_fruit/ai_recongize_fruit' url: '/pages/homepages/homes/choice_book/choice_book'
})
uni.showToast({
title: '跳转成功',
}) })
} }

@ -1,7 +1,7 @@
<template> <template>
<view :class="['container', extend_class]"> <view :class="['container', extend_class]">
<image class="background" src="@/static/components/swiper/exercise/background.png"></image> <image class="background" src="@/static/components/swiper/exercise/background.png"></image>
<image class="button" @click="go_to_exercise" src="@/static/components/swiper/exercise/button.png"></image> <image class="button" @click="go_to_my_exercise_plan" src="@/static/components/swiper/exercise/button.png"></image>
</view> </view>
</template> </template>
@ -19,6 +19,10 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan' url: '/pages/homepages/homes/my_exercise_plan/my_exercise_plan'
}) })
uni.showToast({
title: '跳转',
icon: 'success',
})
} }
} }
} }

@ -20,6 +20,10 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/puppy_chat/puppy_chat' url: '/pages/homepages/puppy_chat/puppy_chat'
}) })
uni.showToast({
title: '跳转成功',
icon: 'success',
})
} }
} }
} }

@ -17,7 +17,11 @@ export default {
methods:{ methods:{
go_to_choice_book() { go_to_choice_book() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/homes/choice_book/choice_book' url: '/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary'
})
uni.showToast({
title: '跳转成功',
icon: 'success',
}) })
} }

@ -112,7 +112,7 @@ export default {
left: 2.5%; /* 左侧2.5% */ left: 2.5%; /* 左侧2.5% */
background-color: khaki; /* 初始颜色 */ background-color: khaki; /* 初始颜色 */
border-radius: 37px; /* 圆角半径,可以根据需要调整 */ border-radius: 37px; /* 圆角半径,可以根据需要调整 */
z-index: -1; /* 使背景框在其他元素后面 */ z-index: 100; /* 使背景框在其他元素后面 */
animation: colorTransition 2s ease forwards; /* 添加颜色渐变动画 */ animation: colorTransition 2s ease forwards; /* 添加颜色渐变动画 */
} }
@ -121,6 +121,7 @@ export default {
width: 15%; width: 15%;
height: 6%; height: 6%;
bottom: 2%; bottom: 2%;
z-index: 100; /* 使背景框在其他元素后面 */
transition: opacity 1s ease; /* 添加渐变过渡 */ transition: opacity 1s ease; /* 添加渐变过渡 */
} }
.pick_up_home, .pick_up_community, .pick_up_assistant, .pick_up_user { .pick_up_home, .pick_up_community, .pick_up_assistant, .pick_up_user {
@ -129,6 +130,7 @@ export default {
height: 10%; height: 10%;
bottom: 2%; bottom: 2%;
transition: opacity 1s ease; /* 添加渐变过渡 */ transition: opacity 1s ease; /* 添加渐变过渡 */
z-index: 100; /* 使背景框在其他元素后面 */
} }
/* 图标位置调整 */ /* 图标位置调整 */

@ -175,37 +175,76 @@
} }
}, },
/*--------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------------------------------------------------------*/
{ {
"path": "pages/homepages/homes/home/home", "path": "pages/homepages/homes/home/home",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
/* { "path" : "pages/homepages/homes/ai_recognize_recipe/ai_recognize_recipe",
"path": "pages/homepages/homes/my_recipe_plan/my_recipe_plan", "style" :
{
"navigationStyle": "custom"
}
},//
{
"path": "pages/homepages/homes/ai_recognize_fruit/ai_recognize_fruit",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},*/ },//
/* { {
"path": "pages/homepages/temp/temp", "path": "pages/homepages/homes/ai_recognize_hot/ai_recognize_hot",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}*/ },//
{
"path": "pages/homepages/homes/my_recipe_plan/my_recipe_plan",
/*{
"path": "pages/homepages/homes/ai_recognize_fruit/ai_recognize_fruit",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}*/ },//
{
"path" : "pages/homepages/homes/ai_recognize_plan/ai_recognize_plan",
"style" :
{
"navigationStyle": "custom"
}
},//
{
"path": "pages/homepages/homes/my_exercise_plan/my_exercise_plan",
"style" :
{
"navigationStyle": "custom"
}
},//
{
"path": "pages/homepages/homes/choice_book/choice_book",
"style" :
{
"navigationStyle": "custom"
}
},//
{
"path": "pages/homepages/homes/knowledge_dictionary/knowledge_dictionary",
"style" :
{
"navigationStyle": "custom"
}
},//
/* { /* {
"path": "pages/homepages/homes/ai_recognize_hot/ai_recognize_hot "path": "pages/homepages/temp/temp",
",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
@ -271,13 +310,7 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path" : "pages/homepages/homes/ai_recognize_recipe/ai_recognize_recipe",
"style" :
{
"navigationStyle": "custom"
}
},
{ {
"path" : "pages/homepages/homes/ai_recognize_plan/ai_recognize_plan", "path" : "pages/homepages/homes/ai_recognize_plan/ai_recognize_plan",
"style" : "style" :
@ -472,27 +505,8 @@
/*------------------------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------*/
{
"path": "pages/homepages/homes/my_exercise_plan/my_exercise_plan",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path": "pages/homepages/homes/choice_book/choice_book",
"style" :
{
"navigationStyle": "custom"
}
},
{
"path": "pages/homepages/homes/knowlege_dictionary/knowlege_dictionary",
"style" :
{
"navigationStyle": "custom"
}
},
{ {
"path": "pages/homepages/community/community/community", "path": "pages/homepages/community/community/community",
"style" : "style" :

@ -24,6 +24,7 @@ export default {
return { return {
calorie: 0, calorie: 0,
name: '', name: '',
token:uni.getStorageSync("access_token")
}; };
}, },
methods: { methods: {
@ -52,19 +53,28 @@ export default {
// //
uni.uploadFile({ uni.uploadFile({
header: { header: {
'Authorization': app.globalData.token // token 'Authorization':this.token
}, },
url: app.globalData.fit_journey_ai_address + `/ai/fruit`, // url: app.globalData.fit_journey_ai_address + `/ai/fruit`, //
filePath: filePath, filePath: filePath,
name: 'file', // name: 'file', //
success: (uploadFileRes) => { success: (uploadFileRes) => {
console.log('上传结果:', uploadFileRes);
const response = JSON.parse(uploadFileRes.data); // const response = JSON.parse(uploadFileRes.data); //
if (response && response.data) { if (response && response.data) {
// let result = response.data; //
this.calorie = response.data.calorie || 0; console.log("识别到的果蔬信息:", result);
this.name = response.data.name || '识别失败,请重新上传图片';
//
for (let [name, calorie] of Object.entries(result)) {
this.name = name; //
this.calorie = calorie; //
console.log(`水果: ${name}, 卡路里: ${calorie} kcal/100g`);
}
uni.showToast({
title: '恭喜你AI识别成功了呢~',
icon: 'none',
});
} else { } else {
uni.showToast({ uni.showToast({
title: '识别失败,请重新上传图片', title: '识别失败,请重新上传图片',

@ -24,6 +24,7 @@ export default {
return { return {
calorie: 0, calorie: 0,
name: '', name: '',
token :uni.getStorageSync("access_token")
}; };
}, },
methods: { methods: {
@ -47,15 +48,13 @@ export default {
success: (chooseImageRes) => { success: (chooseImageRes) => {
const filePath = chooseImageRes.tempFilePaths[0]; // const filePath = chooseImageRes.tempFilePaths[0]; //
console.log('选择的图片路径:', filePath);
console.log("图片上传成功!");
// //
uni.uploadFile({ uni.uploadFile({
header: { header: {
'Authorization': app.globalData.token // token 'Authorization': this.token
}, },
url: app.globalData.fit_journey_ai_address+`/ai/hot`, // url: app.globalData.fit_journey_ai_address+`/ai/recipe`, //
filePath: filePath, filePath: filePath,
name: 'file', // name: 'file', //
success: (uploadFileRes) => { success: (uploadFileRes) => {
@ -65,7 +64,14 @@ export default {
// //
this.calorie = response.data.calorie || 0; this.calorie = response.data.calorie || 0;
this.name = response.data.name || '识别失败,请重新上传图片'; this.name = response.data.name || '识别失败,请重新上传图片';
uni.showToast({
title: '恭喜您AI识别成功啦~',
icon: 'none',
duration :2000,//2
});
} else { } else {
uni.showToast({ uni.showToast({
title: '识别失败,请重新上传图片', title: '识别失败,请重新上传图片',
icon: 'none', icon: 'none',

@ -1,90 +1,142 @@
<template> <template>
<view> <view>
<image class="background" src="/static/homepages/homes/ai_recognize_plan/pictures/background.png"></image> <image class="background" src="@/static/homepages/homes/ai_recognize_plan/pictures/background.png"></image>
<image class="back_button" src="/static/homepages/homes/ai_recognize_plan/pictures/button.png"></image> <image class="back_button" @click="go_back_to_home" src="@/static/homepages/homes/ai_recognize_plan/pictures/button.png"></image>
<image v-if="planImage" class="plan-image" :src="planImage"></image> <image v-if="planImage" class="plan-image" :src="planImage"></image>
<image class="generate_button" @click="generate()" src="/static/homepages/homes/ai_recognize_plan/pictures/generate.png"></image> <image class="generate_button" @click="generate()" src="@/static/homepages/homes/ai_recognize_plan/pictures/generate.png"></image>
</view> </view>
<!-- 生成成功的弹窗 -->
<view class="create_fail" v-if="is_create_success===1">
<text class="ai_create_text">AI生成的结果是</text>
<view class="result_area">
<text class="result">{{ result }}</text>
</view>
<image class="go_back" @click="go_back" src="@/static/homepages/homes/ai_recognize_recipe/pictures/go_back_button.png"></image>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
planImage: null // planImage: null ,//
is_create_success : -1,//-1
token: uni.getStorageSync("access_token"),
result:""
}; };
}, },
methods: { methods: {
go_back_to_home() {
uni.navigateTo({
url: '/pages/homepages/homes/home/home'
});
},
generate() { generate() {
uni.showToast({
title: '正在生成...',
icon: 'loading',
duration: 15000, // Toast 2
});
//
const app= getApp();
uni.request({ uni.request({
url: app.globalData.fit_journey_ai_address+`/ai/plan`, // URL url: app.globalData.fit_journey_ai_address + '/exercise_plan/ai/recipe/generate',
method: 'GET', method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'Authorization':this.token
},
data: {
},
success: (res) => { success: (res) => {
if (res.data && res.data.base64) { if(res.data.code===200){
this.saveBase64Image(res.data.base64); console.log("请求成功!请求数据是", res);
this.result = res.data.data;
}else {
uni.showToast({
title:"AI生成失败",
icon: 'none',
duration: 2000
})
this.result = res.data.msg;
} }
}
});
}, },
saveBase64Image(base64Data) { error: (res) => {
// console.log("请求失败!请求数据是", res);
plus.io.resolveLocalFileSystemURL(plus.io.convertLocalFileSystemURL('_doc/'), (entry) => {
//
const fileName = `_doc/${new Date().getTime()}.png`;
//
entry.getFile(fileName, {create: true}, (fileEntry) => {
// base64Blob
const arr = base64Data.split(',');
const mime = arr[0].match(/:(.*?);/)[1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
} }
const blob = new Blob([u8arr], {type: mime});
//
fileEntry.createWriter((fileWriter) => {
fileWriter.write(blob);
//
this.planImage = plus.io.convertLocalFileSystemURL(fileName);
}, (e) => {
console.log("Write file failed: " + e.message);
});
}, (e) => {
console.log("Get file failed: " + e.message);
});
}, (e) => {
console.log("Resolve file system failed: " + e.message);
}); });
//
setTimeout(() => {
this.is_create_success = 1;
}, 15000);
},
go_back(){
this.is_create_success = -1;
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.background { .background {
position: absolute; position: absolute;
width: 100%; width: 102%;
height: 100%; height: 102%;
top: 0%;
left: 0%; left: -1%;
} }
.back_button { .back_button {
position: absolute; position: absolute;
width: 3%; width: 3%;
height: 3%; height: 3%;
top: 4%; top: 4%;
left: 7%; left: 7%;
} }
.generate_button { .generate_button {
position: absolute; position: absolute;
width: 70%; width: 90%;
height: 12%; height: 12%;
top: 85%; top: 87%;
left: 14%; left: 5%;
} }
.plan-image { .plan-image {
position: absolute; position: absolute;
width: 80%; // width: 80%; //
height: auto; // height: auto; //
@ -92,5 +144,55 @@
left: 50%; // left: 50%; //
transform: translate(-50%, -50%); // 使transform transform: translate(-50%, -50%); // 使transform
z-index: 10; // z-index: 10; //
}
.create_fail{
position: absolute;
height: 80%;
width: 90%;
top: 7%;
left: 5%;
border-radius: 20px;
background-color: #b694d1;
z-index: 1;
.ai_create_text{
position: absolute;
width: 100%;
height: 10%;
top: 5%;
left: 0;
font-weight: bold;
font-size: 20px;
text-align: center;
color: #ffffff;
}
.go_back{
position: absolute;
width: 80%;
height: 13%;
top: 88.5%;
left: 10%;
}
.result_area{
position: absolute;
width: 80%;
height: 75%;
top: 12%;
left: 10%;
border-radius: 20px;
background-color: #cec1e4;
color: #000000;
.result{
position: relative;
left: 2%;
font-size: 16px; /* 设置文字大小 */
font-weight: bold; /* 文字加粗 */
line-height: 1.5; /* 行间距 */
padding: 10px; /* 添加内边距,使文字不贴边 */
word-break: break-word; /* 长单词换行 */
}
} }
}
</style> </style>

@ -1,9 +1,35 @@
<template> <template>
<view> <view>
<image class="background" src="/static/homepages/homes/ai_recognize_recipe/pictures/background.png"></image> <image class="background" src="/static/homepages/homes/ai_recognize_recipe/pictures/background.png"></image>
<image class="back_button" src="/static/homepages/homes/ai_recognize_recipe/pictures/button.png"></image> <image class="back_button" @click="go_back_to_home" src="/static/homepages/homes/ai_recognize_recipe/pictures/button.png" ></image>
<image v-if="recipeImage" class="recipe-image" :src="recipeImage"></image> <image v-if="recipeImage" class="recipe-image" :src="recipeImage"></image>
<image class="generate_button" @click="generate()" src="/static/homepages/homes/ai_recognize_recipe/pictures/generate.png"></image> <image class="generate_button" @click="generate" src="/static/homepages/homes/ai_recognize_recipe/pictures/generate.png"></image>
<!--
&lt;!&ndash; 生成成功的弹窗 &ndash;&gt;
<view class="create_success" v-if="is_create_success===true">
<text class="ai_create_text">AI生成的结果是</text>
&lt;!&ndash; 取消弹窗的按钮 &ndash;&gt;
<image class="go_back" src="@/static/homepages/homes/ai_recognize_recipe/pictures/go_back_button.png"></image>
<view class="result" v-text="result"></view>
</view>
-->
<!-- 生成成功的弹窗 -->
<view class="create_fail" v-if="is_create_success===0">
<text class="ai_create_text">AI生成的结果是</text>
<view class="result_area">
<text class="result">{{ result }}</text>
</view>
<image class="go_back" @click="go_back" src="@/static/homepages/homes/ai_recognize_recipe/pictures/go_back_button.png"></image>
</view>
</view> </view>
</template> </template>
@ -11,80 +37,184 @@
export default { export default {
data() { data() {
return { return {
recipeImage: null // is_create_success: -1,//01-1
can_generate_button_click: true, //
recipeImage: null, //
result: '这个',
token:uni.getStorageSync("access_token"),
}; };
}, },
methods: { methods: {
go_back_to_home() {
uni.navigateTo({
url: '/pages/homepages/homes/home/home'
});
},
generate() { generate() {
uni.showToast({
title: '正在生成...',
icon: 'loading',
duration: 12000, // Toast 2
});
//
const app= getApp();
uni.request({ uni.request({
url: app.globalData.fit_journey_ai_address+`/ai/recipe`, // URL url: app.globalData.fit_journey_ai_address + '/ai/recipe/generate',
method: 'GET', method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'Authorization':this.token
},
data: {
},
success: (res) => { success: (res) => {
if (res.data && res.data.base64) { if(res.data.code===200){
this.saveBase64Image(res.data.base64); console.log("请求成功!请求数据是", res);
this.result = res.data.data;
}else {
uni.showToast({
title:"AI生成失败",
icon: 'none',
duration: 2000
})
this.result = res.data.msg;
} }
}
});
}, },
saveBase64Image(base64Data) { error: (res) => {
// console.log("请求失败!请求数据是", res);
plus.io.resolveLocalFileSystemURL(plus.io.convertLocalFileSystemURL('_doc/'), (entry) => {
//
const fileName = `_doc/${new Date().getTime()}.png`;
//
entry.getFile(fileName, {create: true}, (fileEntry) => {
// base64Blob
const arr = base64Data.split(',');
const mime = arr[0].match(/:(.*?);/)[1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
} }
const blob = new Blob([u8arr], {type: mime});
//
fileEntry.createWriter((fileWriter) => {
fileWriter.write(blob);
//
this.recipeImage = plus.io.convertLocalFileSystemURL(fileName);
}, (e) => {
console.log("Write file failed: " + e.message);
});
}, (e) => {
console.log("Get file failed: " + e.message);
});
}, (e) => {
console.log("Resolve file system failed: " + e.message);
}); });
//
setTimeout(() => {
this.can_generate_button_click= false;
this.is_create_success = 0;
}, 12000);
/* //在20秒的时候清空result
setTimeout(() => {
this.result="";
}, 20000);*/
},
go_back(){
this.is_create_success = -1;
this.can_generate_button_click=true;
} }
} }
} }
</script> </script>
<style lang="scss"> <style scoped lang="scss">
.background { .background {
position: absolute; position: absolute;
width: 100%; width: 102%;
height: 100%; height: 102%;
top: 0%; top: 0;
left: 0%; left: -1%;
} z-index: -1;
.back_button { }
.back_button {
position: absolute; position: absolute;
width: 3%; width: 3%;
height: 3%; height: 3%;
top: 4%; top: 4%;
left: 7%; left: 7%;
} }
.generate_button { .generate_button {
position: absolute; position: absolute;
width: 70%; width: 90%;
height: 12%; height: 12%;
top: 85%; top: 87%;
left: 14%; left: 5%;
}
.create_fail{
position: absolute;
height: 80%;
width: 90%;
top: 7%;
left: 5%;
border-radius: 20px;
background-color: #92a9c6;
z-index: 1;
.ai_create_text{
position: absolute;
width: 100%;
height: 10%;
top: 5%;
left: 0;
font-weight: bold;
font-size: 20px;
text-align: center;
color: #ffffff;
}
.go_back{
position: absolute;
width: 80%;
height: 13%;
top: 88.5%;
left: 10%;
} }
.recipe-image { .result_area{
position: absolute;
width: 80%;
height: 75%;
top: 12%;
left: 10%;
border-radius: 20px;
background-color: #e4dfdf;
color: #000000;
.result{
position: relative;
left: 2%;
font-size: 16px; /* 设置文字大小 */
font-weight: bold; /* 文字加粗 */
line-height: 1.5; /* 行间距 */
padding: 10px; /* 添加内边距,使文字不贴边 */
word-break: break-word; /* 长单词换行 */
}
}
}
/*
.create_success{
position: absolute;
height: 80%;
width: 80%;
top: 10%;
left: 10%;
border-radius: 20px;
background-color: #2C405A;
z-index: 10;
border: 2px solid #ffffff;
!* .go_back{
position: absolute;
width: 10%;
height: 10%;
top: 5%;
left: 85%;
}
.ai_create_text{
z-index: 100;
color: #ffffff;
}*!
}
*/
.recipe-image {
position: absolute; position: absolute;
width: 80%; // width: 80%; //
height: auto; // height: auto; //
@ -92,5 +222,5 @@
left: 50%; // left: 50%; //
transform: translate(-50%, -50%); // 使transform transform: translate(-50%, -50%); // 使transform
z-index: 10; // z-index: 10; //
} }
</style> </style>

@ -40,10 +40,10 @@
<view class="read_area"> <view class="read_area">
<!-- 知识图谱--> <!-- 知识图谱-->
<image class="dictionary_background" src="@/static/components/dictionary/pictures/background.png"></image> <image class="dictionary_background" src="@/static/components/dictionary/pictures/background.png"></image>
<image class="dictionary_button" src="@/static/components/dictionary/pictures/button.png"></image> <image class="dictionary_button" @click="go_to_knowledge_dictionary" src="@/static/components/dictionary/pictures/button.png"></image>
<!-- 书籍阅读--> <!-- 书籍阅读-->
<image class="read_background" src="@/static/components/read/pictures/background.png"></image> <image class="read_background" src="@/static/components/read/pictures/background.png"></image>
<image class="read_button" src="/static/components/read/pictures/button.png"></image> <image class="read_button" @click="go_to_choice_book" src="/static/components/read/pictures/button.png"></image>
</view> </view>
<!--空白区域 --> <!--空白区域 -->
<view class="block_area"></view> <view class="block_area"></view>
@ -71,6 +71,22 @@ export default {
}; };
}, },
methods:{ methods:{
go_to_choice_book(){
uni.navigateTo({
url: '/pages/homepages/homes/choice_book/choice_book'
});
uni.showToast({
title: '跳转成功',
})
},
go_to_knowledge_dictionary(){
uni.navigateTo({
url: '/pages/homepages/homes/knowledge_dictionary/knowledge_dictionary'
});
uni.showToast({
title: '跳转成功',
})
},
onSwiperChange(e){ onSwiperChange(e){
this.current = e.detail.current; this.current = e.detail.current;
} }

@ -38,10 +38,11 @@
export default { export default {
data() { data() {
return { return {
token:uni.getStorageSync("access_token"),
input_message: '', input_message: '',
send_message:'', send_message:'',
send_messages: [], // send_messages: [], //
conversation_id: 'e97ec0f2-2a94-42e7-b6db-b04883d349e8', conversation_id: 'e97ec0f2-2a94-42e7-b6db-b04883d349e8',//id
answer: '', // AI answer: '', // AI
}; };
}, },
@ -57,7 +58,7 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
@ -70,6 +71,14 @@ export default {
console.log("请求失败!请求数据是", res); console.log("请求失败!请求数据是", res);
} }
}); });
this.send_messages.push({
sender: 'ai', //
message: ":" +"我是fit journey的专属AI小助手有什么问题都可以问我哦~"
});
}, },
methods: { methods: {
handleSendMessage() { handleSendMessage() {
@ -116,11 +125,11 @@ export default {
// //
uni.request({ uni.request({
url: 'http://localhost:8081' + '/ai/chat-with-no-stream',//TODO: url: app.globalData.fit_journey_ai_address + '/ai/chat-with-no-stream',//TODO:
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
conversationId: this.conversation_id, conversationId: this.conversation_id,

@ -19,7 +19,8 @@
export default { export default {
data(){ data(){
return{ return{
height:'' height:'',
token: uni.getStorageSync('access_token'),
}; };
}, },
onLoad(options){ onLoad(options){
@ -33,22 +34,25 @@ export default {
console.log(app.globalData.token); console.log(app.globalData.token);
console.log(app.globalData.fit_journey_basic_address); console.log(app.globalData.fit_journey_basic_address);
console.log("当前的身高是" + this.height); console.log("当前的身高是" + this.height);
// height "cm" // height "cm"
const numericHeight = parseFloat(this.height.replace('cm', '').trim()); const numericHeight = parseFloat(this.height.replace('cm', '').trim());
console.log("本地存储的token是"+this.token)
// //
uni.request({ uni.request({
url: app.globalData.fit_journey_basic_address + '/height/write_user_height', url: app.globalData.fit_journey_basic_address + '/height/write_user_height',
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
height: numericHeight, // height: numericHeight, //
}, },
success: (res) => { success: (res) => {
uni.showToast({
title: '提交成功',
icon: 'success',
})
console.log("请求成功!请求数据是", res); console.log("请求成功!请求数据是", res);
// 使 // 使
uni.navigateTo({ uni.navigateTo({

@ -17,6 +17,11 @@
<script> <script>
export default { export default {
data() {
return {
token: uni.getStorageSync("access_token"),
};
},
methods: { methods: {
navigateTo(page) { navigateTo(page) {
uni.navigateTo({ uni.navigateTo({
@ -33,7 +38,7 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization':this.token
}, },
data: { data: {
height: 175, // height: 175, //

@ -19,7 +19,8 @@
export default { export default {
data() { data() {
return { return {
weight: '' weight: '',
token : uni.getStorageSync("access_token")
}; };
}, },
onLoad(options) { onLoad(options) {
@ -47,13 +48,18 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
weight: numericWeight, // weight: numericWeight, //
}, },
success: (res) => { success: (res) => {
console.log("请求成功!请求数据是", res); console.log("请求成功!请求数据是", res);
uni.showToast({
title: '提交成功',
icon: 'success',
})
// //
this.navigateTo('/pages/information/boy_height_start/boy_height_start'); this.navigateTo('/pages/information/boy_height_start/boy_height_start');
}, },

@ -17,6 +17,11 @@
<script> <script>
export default { export default {
data() {
return {
token :uni.getStorageSync("access_token")
}
},
methods: { methods: {
go_to_height() { go_to_height() {
// //
@ -30,12 +35,16 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
weight: 65, // weight: 65, //
}, },
success: (res) => { success: (res) => {
uni.showToast({
title: '提交成功',
icon: 'success'
})
console.log("请求成功!请求数据是", res); console.log("请求成功!请求数据是", res);
// //
uni.navigateTo({ uni.navigateTo({

@ -19,7 +19,8 @@
export default { export default {
data() { data() {
return { return {
weight: '' weight: '',
token :uni.getStorageSync("access_token")
}; };
}, },
onLoad(options) { onLoad(options) {
@ -48,12 +49,16 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
weight: numericWeight, // weight: numericWeight, //
}, },
success: (res) => { success: (res) => {
uni.showToast({
title: '提交成功',
icon: 'success',
})
console.log("请求成功!请求数据是", res); console.log("请求成功!请求数据是", res);
// //
this.navigateTo('/pages/information/girl_height_start/girl_height_start'); this.navigateTo('/pages/information/girl_height_start/girl_height_start');

@ -17,6 +17,11 @@
<script> <script>
export default { export default {
data() {
return {
token :uni.getStorageSync("access_token"),
};
},
methods: { methods: {
navigateTo(page) { navigateTo(page) {
uni.navigateTo({ uni.navigateTo({
@ -36,12 +41,16 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
weight: 65, // weight: 65, //
}, },
success: (res) => { success: (res) => {
uni.showToast({
title: '提交成功',
icon: 'success',
})
console.log("请求成功!请求数据是", res); console.log("请求成功!请求数据是", res);
// //
this.navigateTo('/pages/information/girl_height_start/girl_height_start'); this.navigateTo('/pages/information/girl_height_start/girl_height_start');

@ -56,6 +56,7 @@ export default {
isGirlSelected: false, isGirlSelected: false,
isHumanVisible: false, // human isHumanVisible: false, // human
sex:-1,// 1 0 sex:-1,// 1 0
token:uni.getStorageSync("access_token")
}; };
}, },
@ -74,7 +75,7 @@ export default {
console.log('调用函数成功!'); // console.log('调用函数成功!'); //
// //
const app = getApp(); const app = getApp();
console.log('传递的token是:', app.globalData.token); // Token console.log('传递的token是:',this.token); // Token
console.log('后端的地址是', app.globalData.fit_journey_basic_address); // console.log('后端的地址是', app.globalData.fit_journey_basic_address); //
uni.request({ uni.request({
@ -82,17 +83,18 @@ export default {
method: 'POST', method: 'POST',
header: { header: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
'Authorization': app.globalData.token // TODOtoken 'Authorization': this.token
}, },
data: { data: {
sex: this.sex sex: this.sex
}, },
success: (res) => { success: (res) => {
console.log('Response:', res.data); // console.log('Response:', res.data); //
uni.showToast({
title: '提交成功',
icon: 'success',
})
console.log("开始跳转页面"); console.log("开始跳转页面");
// //
const targetPage = this.isBoySelected const targetPage = this.isBoySelected

@ -240,7 +240,7 @@ function login() {
}); });
} }
}); });
} else if (which_way_to_login.value === 1) { // } else { //
console.log("验证码登录部分开始运行了"); console.log("验证码登录部分开始运行了");
// //
const serverAddress = app.globalData.fit_journey_login_address + '/PhoneLogin/phoneLogin'; const serverAddress = app.globalData.fit_journey_login_address + '/PhoneLogin/phoneLogin';

@ -11,7 +11,7 @@ export default {
methods: { methods: {
click() { click() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/homepages/home/home' // url: '/pages/homepages/homes/home/home' //
}); });
} }
} }

@ -1,6 +1,6 @@
.background { .background {
background-image: url("@/static/homepages/homes/ai_recognize_recipe/pictures/background.png"); background-image: url("@/static/homepages/homes/ai_recognize_hot/pictures/background.png");
background-size: cover; background-size: cover;
background-position: center; background-position: center;
height: 100vh; height: 100vh;
@ -27,7 +27,7 @@
transform: translateX(-50%); /* 通过 translateX 使其居中 */ transform: translateX(-50%); /* 通过 translateX 使其居中 */
} }
.calorie_container { .calorie_container {
background-image: url("@/static/homepages/homes/ai_recognize_recipe/pictures/calorie.png"); background-image: url("@/static/homepages/homes/ai_recognize_hot/pictures/calorie.png");
background-size: cover; background-size: cover;
background-position: center; background-position: center;
display: flex; /* 使用 flex 布局 */ display: flex; /* 使用 flex 布局 */
@ -47,7 +47,7 @@
margin-top: 100%; /* 向下移动 100% */ margin-top: 100%; /* 向下移动 100% */
} }
.name_container{ .name_container{
background-image: url("@/static/homepages/homes/ai_recognize_recipe/pictures/name.png"); background-image: url("@/static/homepages/homes/ai_recognize_hot/pictures/name.png");
background-size: cover; background-size: cover;
background-position: center; background-position: center;
display: flex; /* 使用 flex 布局 */ display: flex; /* 使用 flex 布局 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

@ -1,6 +1,5 @@
.background { .background {
position: absolute; position: fixed;
width: 100%; width: 100%;
height: 75%; height: 75%;
top: 4%; top: 4%;
@ -10,7 +9,7 @@
.chat { .chat {
position: absolute; position: absolute;
width: 100%; width: 100%;
top: 10%; top: 12%;
height: 79%; height: 79%;
z-index: -1; z-index: -1;
padding: 10px; padding: 10px;

Loading…
Cancel
Save