Commit a8156271 authored by 黄韬's avatar 黄韬

Merge branch '20250528-dev-ht' into 'dev'

fix: 修复上传

See merge request sparkprojects/20250528_FHQ1!12
parents 03055b1d c8b89655
......@@ -15,7 +15,7 @@ const {
// request.js
// 通常可以吧 baseUrl 单独放在一个 js 文件了
const baseUrl = "http://172.16.230.108:7777/pmall";
const baseUrl = "http://172.16.224.178:7777/pmall";
const request = (options = {}) => {
// 在这里可以对请求头进行一些设置
......
......@@ -521,6 +521,13 @@ const onSubmit = async (e) => {
data.id = babyId.value;
}
// 移除空值属性
Object.keys(data).forEach(key => {
if (data[key] === '') {
delete data[key];
}
});
console.log("提交数据", data);
showLoading();
......@@ -577,7 +584,7 @@ const handleUploadBackground = async (e) => {
success: async (res) => {
const tempFilePath = res.tempFilePaths[0];
const fs = uni.getFileSystemManager();
const base64 = "data:image/jpeg;base64," + fs.readFileSync(tempFilePath);
const base64 = "data:image/jpeg;base64," + fs.readFileSync(tempFilePath, "base64");
showLoading();
const uploadRes = await uploadImage(base64);
......@@ -657,7 +664,7 @@ onLoad((options) => {
formData.value.productPreference = baby.content?.productPreference || "";
formData.value.followInfo = baby.content?.followInfo || "";
formData.value.purchaseChannel = baby.content?.purchaseChannel || "";
formData.value.babyAvatar = baby.babyAvatar || "";
formData.value.babyAvatar = baby.content?.babyAvatar || "";
formData.value.backgroundImg = baby.content?.backgroundImg || "";
formData.value.gestationalWeeks = baby.content?.gestationalWeeks || "";
......
......@@ -41,7 +41,7 @@
<image
class="avatar"
:src="
babyInfo?.babyAvatar || $baseUrl + 'common/default_avatar.png'
babyInfo?.content?.babyAvatar || $baseUrl + 'common/default_avatar.png'
"
mode="aspectFill"
/>
......@@ -242,11 +242,7 @@ const onRegisterConfirm = (data) => {
// 获取用户信息
const initData = async () => {
if (
!userStore.userInfo ||
JSON.stringify(userStore.userInfo) == "{}" ||
userStore.userInfo.memberId == "not_login"
) {
if (!userStore?.userInfo?.memberId || userStore?.userInfo?.memberId == "not_login") {
cfgStatus.value.isRegister = false;
cfgStatus.value.showDetail = false;
return;
......@@ -307,10 +303,12 @@ function onAddBaby() {
// 页面加载
onMounted(() => {
console.log("onMounted");
initData();
});
watch(babyInfo, () => {
watch([() => userStore.userInfo, () => userStore.babyInfo], () => {
console.log("userInfo/babyInfo变化", userStore.userInfo, userStore.babyInfo);
initData();
});
......
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