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