Commit 30cf6679 authored by 王炽's avatar 王炽

66666

parent 85c42be1
...@@ -43,7 +43,6 @@ const request = (options = {}) => { ...@@ -43,7 +43,6 @@ const request = (options = {}) => {
}, },
}) })
.then((data) => { .then((data) => {
console.log('request data6666666 ===>', data);
if (data.statusCode !== HTTP_STATUS.SUCCESS) { if (data.statusCode !== HTTP_STATUS.SUCCESS) {
uni.showToast({ uni.showToast({
title: data.errMsg, title: data.errMsg,
...@@ -72,7 +71,6 @@ const request = (options = {}) => { ...@@ -72,7 +71,6 @@ const request = (options = {}) => {
}; };
const get = (url, data, options = {}) => { const get = (url, data, options = {}) => {
console.log('6666666666');
options.type = "GET"; options.type = "GET";
options.data = data; options.data = data;
options.url = url; options.url = url;
...@@ -80,7 +78,6 @@ const get = (url, data, options = {}) => { ...@@ -80,7 +78,6 @@ const get = (url, data, options = {}) => {
}; };
const post = (url, data, options = {}) => { const post = (url, data, options = {}) => {
console.log('5555555555=', url, data, options);
options.type = "POST"; options.type = "POST";
options.data = data; options.data = data;
......
...@@ -179,6 +179,17 @@ ...@@ -179,6 +179,17 @@
<image v-if="guideIndex == 1" class="guide-img1" src="/static/shengzhangTool/guide1.png" mode="aspectFit"></image> <image v-if="guideIndex == 1" class="guide-img1" src="/static/shengzhangTool/guide1.png" mode="aspectFit"></image>
<image v-if="guideIndex == 2" class="guide-img2" src="/static/shengzhangTool/guide2.png" mode="aspectFit"></image> <image v-if="guideIndex == 2" class="guide-img2" src="/static/shengzhangTool/guide2.png" mode="aspectFit"></image>
</view> </view>
<view class="loading-container" v-if="showLoading">
<view class="loading-content">
<view class="star-container">
<image class="loading-star" src="/static/shengzhangTool/loadingActImg.png" mode="aspectFit"></image>
</view>
<view class="loading-text">
<text class="loading-title">正在计算宝宝的生长测评得分</text>
<text class="loading-subtitle">请耐心等待~</text>
</view>
</view>
</view>
</view> </view>
<!-- 在页面底部添加弹窗组件 --> <!-- 在页面底部添加弹窗组件 -->
...@@ -216,9 +227,10 @@ import BabySwitchPopup from '@/components/BabySwitchPopup.vue' ...@@ -216,9 +227,10 @@ import BabySwitchPopup from '@/components/BabySwitchPopup.vue'
import BabyFeedSwitchPopup from '@/components/BabyFeedSwitchPopup.vue' import BabyFeedSwitchPopup from '@/components/BabyFeedSwitchPopup.vue'
import DatePickerPopup from '@/components/DatePickerPopup.vue' import DatePickerPopup from '@/components/DatePickerPopup.vue'
import BabyTestTipsPopup from '@/components/BabyTestTipsPopup.vue' import BabyTestTipsPopup from '@/components/BabyTestTipsPopup.vue'
import { growthHome, guideCompleted, assessmentSave } from '../../api/shengzhangTools' import { growthHome, guideCompleted } from '../../api/shengzhangTools'
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import { throttleTap } from '../../utils/index.js'; import { throttleTap,jump, JumpType } from '../../utils/index.js';
import { useShengzhangStore } from '../../stores/shengzhangResult.js';
const swiperData = ref([ const swiperData = ref([
{ bannerImg: '/static/shengzhangTool/banner1.png' }, { bannerImg: '/static/shengzhangTool/banner1.png' },
...@@ -230,9 +242,12 @@ const babyName = ref('宝宝名称') ...@@ -230,9 +242,12 @@ const babyName = ref('宝宝名称')
const babyAge = ref('8月龄') const babyAge = ref('8月龄')
const babyBirthday = ref('2024-10-20') const babyBirthday = ref('2024-10-20')
const babyGender = ref('M') const babyGender = ref('M')
const babyAvatar = ref('/static/shengzhangTool/avatar.png') const babyAvatar = ref('/static/shengzhangTool/avatar.png');
const shengzhangStore = useShengzhangStore();
const guideFlag = ref(false); const guideFlag = ref(false);
const showLoading = ref(false);
const bannerHandler = (item) => { const bannerHandler = (item) => {
console.log(item) console.log(item)
...@@ -271,8 +286,6 @@ const headCircumference = ref('34.5') ...@@ -271,8 +286,6 @@ const headCircumference = ref('34.5')
const babyId = ref(0); const babyId = ref(0);
const assessmentDate = ref(''); const assessmentDate = ref('');
const feedingType = ref(''); const feedingType = ref('');
// 添加picker-view相关数据 // 添加picker-view相关数据
const indicatorStyle = `height: 40px; border: none;` const indicatorStyle = `height: 40px; border: none;`
...@@ -366,6 +379,7 @@ const convertFeedingType = (type) => { ...@@ -366,6 +379,7 @@ const convertFeedingType = (type) => {
} }
} }
const submitData = throttleTap(async () => { const submitData = throttleTap(async () => {
showLoading.value = true;
const submitData = { const submitData = {
babyId: babyId.value, babyId: babyId.value,
height: height.value, height: height.value,
...@@ -375,15 +389,17 @@ const submitData = throttleTap(async () => { ...@@ -375,15 +389,17 @@ const submitData = throttleTap(async () => {
feedingType: convertFeedingType(selectedFeedText.value) feedingType: convertFeedingType(selectedFeedText.value)
}; };
console.log('提交数据', submitData);
const data = await assessmentSave(submitData); await shengzhangStore.assessmentSave(submitData);
if(data.success){ console.log('shengzhangStore=', shengzhangStore.shengzhangInfo);
uni.showToast({
title: '提交成功', if(shengzhangStore.shengzhangInfo.success){
icon: 'success' jump({
type: JumpType.INNER,
url: "/pages/shengzhangTestResult/shengzhangTestResult"
}) })
} }
showLoading.value = false;
}, 1000) }, 1000)
// 添加以下数据 // 添加以下数据
...@@ -972,5 +988,74 @@ const formatDate = (timestamp) => { ...@@ -972,5 +988,74 @@ const formatDate = (timestamp) => {
left: 0; left: 0;
} }
} }
.loading-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
.loading-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.star-container {
margin-bottom: 60rpx;
position: relative;
.loading-star {
width: 750rpx;
height: 1624rpx;
animation: breathe 2s ease-in-out infinite;
}
}
.loading-text {
// background-color: rgba(128, 59, 59, 0.7);
position: absolute;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
top: 850rpx;
.loading-title {
font-size: 32rpx;
color: #ffffff;
font-weight: 500;
line-height: 1.4;
}
.loading-subtitle {
top: 40rpx;
font-size: 32rpx;
color: #ffffff;
font-weight: 500;
line-height: 1.4;
}
}
}
}
@keyframes breathe {
0% {
opacity: 0.6;
}
50% {
opacity: 1;
}
100% {
opacity: 0.6;
}
}
} }
</style> </style>
\ No newline at end of file
import { defineStore } from "pinia";
import {
assessmentSave
} from "../api/shengzhangTools.js";
export const useShengzhangStore = defineStore("shengzhangInfo", {
state: () => {
return {
shengzhangInfo: null,
};
},
actions: {
/**
* 设置生长测评结果
* @param {Object} userInfo
*/
setShengzhangInfo(shengzhangInfo) {
this.shengzhangInfo = shengzhangInfo;
},
async assessmentSave(submitData) {
const data = await assessmentSave(submitData);
if(data.success){
data.data.success = data.success;
this.setShengzhangInfo(data.data);
}
},
},
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment