新增模块促使两个SpringBoot 服务之间联系
This commit is contained in:
parent
e51d2019f5
commit
2d3c285e0c
@ -1,8 +1,8 @@
|
||||
<route lang="json5">
|
||||
{
|
||||
style: {
|
||||
navigationBarTitleText: "我的页面",
|
||||
navigationStyle: "custom",
|
||||
navigationBarTitleText: '我的页面',
|
||||
navigationStyle: 'custom',
|
||||
},
|
||||
needLogin: true,
|
||||
}
|
||||
@ -22,11 +22,7 @@
|
||||
:height="100"
|
||||
round
|
||||
mode="aspectFill"
|
||||
:src="
|
||||
userInfo.avatar == ''
|
||||
? imgUrl('@/static/my/avatar.jpg')
|
||||
: baseUrl + userInfo.avatar
|
||||
"
|
||||
:src="userInfo.avatar == '' ? imgUrl('@/static/my/avatar.jpg') : imgUrl(userInfo.avatar)"
|
||||
></wd-img>
|
||||
<view class="info">
|
||||
<view class="name">{{ userInfo.nickname }}</view>
|
||||
@ -70,20 +66,13 @@
|
||||
|
||||
<!-- 判断该用户是否为宠托师 -->
|
||||
<view v-if="userInfo.isPetNursery" class="services-container card">
|
||||
<button class="w-full bg-[#ffc107]" @click="toPath('/pages/order/take')">
|
||||
接单页面
|
||||
</button>
|
||||
<button class="w-full bg-[#ffc107]" @click="toPath('/pages/order/take')">接单页面</button>
|
||||
</view>
|
||||
|
||||
<view class="pets-container card">
|
||||
<view class="pets-title">我的宠物</view>
|
||||
<view class="pets-list scroll-x overflow-x-auto" scroll-x>
|
||||
<view
|
||||
class="pet-item"
|
||||
v-for="(pet, index) in pets"
|
||||
@click="editPet(pet)"
|
||||
:key="index"
|
||||
>
|
||||
<view class="pet-item" v-for="(pet, index) in pets" @click="editPet(pet)" :key="index">
|
||||
<wd-img :width="60" :height="60" round :src="pet.icon" class="pet-avatar" />
|
||||
<view class="pet-label">{{ pet.name }}</view>
|
||||
</view>
|
||||
@ -121,101 +110,101 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { useUserStore } from "@/store/user";
|
||||
import { baseUrl, imgUrl, toast } from "@/utils/commUtils";
|
||||
import { httpGet } from "@/utils/http"; // 假设你已经封装好了这个方法
|
||||
import Tabbar from "@/components/Tabbar.vue";
|
||||
import { ref } from 'vue'
|
||||
import { useUserStore } from '@/store/user'
|
||||
import { baseUrl, imgUrl, toast } from '@/utils/commUtils'
|
||||
import { httpGet } from '@/utils/http' // 假设你已经封装好了这个方法
|
||||
import Tabbar from '@/components/Tabbar.vue'
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userStore = useUserStore()
|
||||
|
||||
const userInfo = userStore.userInfo;
|
||||
const userInfo = userStore.userInfo
|
||||
|
||||
const stats = ref([
|
||||
{ number: 0, label: "粉丝" },
|
||||
{ number: 0, label: "关注" },
|
||||
{ number: 0, label: "收藏" },
|
||||
{ number: 0, label: "获赞" },
|
||||
]);
|
||||
{ number: 0, label: '粉丝' },
|
||||
{ number: 0, label: '关注' },
|
||||
{ number: 0, label: '收藏' },
|
||||
{ number: 0, label: '获赞' },
|
||||
])
|
||||
|
||||
const services = [
|
||||
{ icon: "@/static/my/order.png", label: "我的订单", path: "/pages/order/index" },
|
||||
{ icon: "@/static/my/pet.png", label: "我的服务", path: "/pages/service/my-service" },
|
||||
{ icon: "@/static/my/wash.png", label: "我的评价", path: "/pages/order/index" },
|
||||
{ icon: "@/static/my/service.png", label: "售后服务", path: "/pages/order/index" },
|
||||
];
|
||||
{ icon: '@/static/my/order.png', label: '我的订单', path: '/pages/order/index' },
|
||||
{ icon: '@/static/my/pet.png', label: '我的服务', path: '/pages/service/my-service' },
|
||||
{ icon: '@/static/my/wash.png', label: '我的评价', path: '/pages/order/index' },
|
||||
{ icon: '@/static/my/service.png', label: '售后服务', path: '/pages/order/index' },
|
||||
]
|
||||
|
||||
const pets = ref([]);
|
||||
const pets = ref([])
|
||||
|
||||
onShow(async () => {
|
||||
await fetchActivities();
|
||||
await fetchPets();
|
||||
});
|
||||
await fetchActivities()
|
||||
await fetchPets()
|
||||
})
|
||||
|
||||
// 获取社区活动的信息
|
||||
const fetchActivities = async () => {
|
||||
try {
|
||||
const response = await httpGet("/posts/community");
|
||||
const response = await httpGet('/posts/community')
|
||||
if (response.code == 200) {
|
||||
const index = 0;
|
||||
const index = 0
|
||||
for (const key in response.data) {
|
||||
if (response.data[key]) {
|
||||
stats.value[index] = { number: response.data[key], label: key };
|
||||
stats.value[index] = { number: response.data[key], label: key }
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(response);
|
||||
console.log(response)
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const fetchPets = async () => {
|
||||
try {
|
||||
const response = await httpGet("/petInfo/select", { userId: userStore.userInfo.id });
|
||||
const response = await httpGet('/petInfo/select', { userId: userStore.userInfo.id })
|
||||
pets.value = response.records.map((pet) => ({
|
||||
...pet,
|
||||
icon: baseUrl + pet.profileUrl,
|
||||
}));
|
||||
}))
|
||||
} catch (error) {
|
||||
uni.showToast({ title: "网络错误,请重试", icon: "error" });
|
||||
uni.showToast({ title: '网络错误,请重试', icon: 'error' })
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const editPet = (pet) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/pet/pet-add-page?id=${pet.id}&name=${pet.name}&icon=${pet.icon}&breed=${pet.breed}&color=${pet.color}&birthday=${pet.birthday}&gender=${pet.gender}&userId=${pet.userId}`,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
|
||||
const items = [
|
||||
{ icon: "@/static/my/send.png", label: "我的发布", to: "/pages/publish/index" },
|
||||
{ icon: '@/static/my/send.png', label: '我的发布', to: '/pages/publish/index' },
|
||||
{
|
||||
icon: "@/static/my/handshake.png",
|
||||
label: "帮助中心",
|
||||
to: "/pages/others/official-account",
|
||||
icon: '@/static/my/handshake.png',
|
||||
label: '帮助中心',
|
||||
to: '/pages/others/official-account',
|
||||
},
|
||||
{
|
||||
icon: "@/static/my/feedback.png",
|
||||
label: "建议反馈",
|
||||
to: "/pages/others/official-account",
|
||||
icon: '@/static/my/feedback.png',
|
||||
label: '建议反馈',
|
||||
to: '/pages/others/official-account',
|
||||
},
|
||||
{
|
||||
icon: "@/static/my/badge.png",
|
||||
label: "宠托师认证",
|
||||
to: "/pages/certification/index",
|
||||
icon: '@/static/my/badge.png',
|
||||
label: '宠托师认证',
|
||||
to: '/pages/certification/index',
|
||||
},
|
||||
{ icon: "@/static/my/address.png", label: "我的地址", to: "/pages/address/index" },
|
||||
{ icon: "@/static/my/settings.png", label: "设置", to: "/pages/settings/index" },
|
||||
{ icon: "@/static/my/address.png", label: "地址", to: "/pages/map/index" },
|
||||
];
|
||||
{ icon: '@/static/my/address.png', label: '我的地址', to: '/pages/address/index' },
|
||||
{ icon: '@/static/my/settings.png', label: '设置', to: '/pages/settings/index' },
|
||||
{ icon: '@/static/my/address.png', label: '地址', to: '/pages/map/index' },
|
||||
]
|
||||
|
||||
const toPath = (path) => {
|
||||
uni.navigateTo({
|
||||
url: path,
|
||||
});
|
||||
};
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user