feat: fix user boughts
This commit is contained in:
@@ -17,6 +17,7 @@ type UserInfo struct {
|
|||||||
ID int64 `json:"id,omitempty"`
|
ID int64 `json:"id,omitempty"`
|
||||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
Username string `json:"username,omitempty"`
|
Username string `json:"username,omitempty"`
|
||||||
|
Avatar string `json:"avatar,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Router /users/profile [get]
|
// @Router /users/profile [get]
|
||||||
@@ -26,6 +27,7 @@ func (ctl *users) Profile(ctx fiber.Ctx, user *model.Users) (*UserInfo, error) {
|
|||||||
ID: user.ID,
|
ID: user.ID,
|
||||||
CreatedAt: user.CreatedAt,
|
CreatedAt: user.CreatedAt,
|
||||||
Username: user.Username,
|
Username: user.Username,
|
||||||
|
Avatar: *user.Avatar,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
|
||||||
<title>动态曲谱</title>
|
<title>动态曲谱</title>
|
||||||
<link href="/src/styles.css" rel="stylesheet">
|
<link href="/src/styles.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const formattedDate = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const discountPrice = computed(() => {
|
const discountPrice = computed(() => {
|
||||||
return (props.article.price * props.article.discount / 100).toFixed(2)
|
return (props.article.price * props.article.discount / (100 * 100)).toFixed(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
const showArticle = (article) => {
|
const showArticle = (article) => {
|
||||||
@@ -68,7 +68,7 @@ const showArticle = (article) => {
|
|||||||
</span>
|
</span>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span v-if="article.discount < 100" class="text-xs line-through text-gray-500">
|
<span v-if="article.discount < 100" class="text-xs line-through text-gray-500">
|
||||||
¥{{ article.price }}
|
¥{{ (article.price / 100).toFixed(2) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-xl text-orange-600">¥{{ discountPrice }}</span>
|
<span class="text-xl text-orange-600">¥{{ discountPrice }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const switchTab = (index, route) => {
|
|||||||
|
|
||||||
<nav class="flex-none bg-white border-t border-gray-200">
|
<nav class="flex-none bg-white border-t border-gray-200">
|
||||||
<div class="flex justify-around items-center h-14">
|
<div class="flex justify-around items-center h-14">
|
||||||
<button v-for="(tab, index) in tabs" :key="index"
|
<div v-for="(tab, index) in tabs" :key="index"
|
||||||
class="flex flex-col items-center justify-center w-full h-full py-1 focus:outline-none" :class="[
|
class="flex flex-col items-center justify-center w-full h-full py-1 focus:outline-none" :class="[
|
||||||
activeTab === index
|
activeTab === index
|
||||||
? 'text-blue-600'
|
? 'text-blue-600'
|
||||||
@@ -38,7 +38,7 @@ const switchTab = (index, route) => {
|
|||||||
]" @click="switchTab(index, tab.route)">
|
]" @click="switchTab(index, tab.route)">
|
||||||
<component :is="tab.icon" class="w-6 h-6" />
|
<component :is="tab.icon" class="w-6 h-6" />
|
||||||
<span class="mt-1 text-xs">{{ tab.label }}</span>
|
<span class="mt-1 text-xs">{{ tab.label }}</span>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ onUnmounted(() => {
|
|||||||
<div class="text-orange-600 text-2xl">
|
<div class="text-orange-600 text-2xl">
|
||||||
<span class="mr-2 text-xl">¥</span>
|
<span class="mr-2 text-xl">¥</span>
|
||||||
<span class="font-bold font-mono">
|
<span class="font-bold font-mono">
|
||||||
{{ (article.price / 100).toFixed(2) }}
|
{{ (article.price * article.discount / (100 * 100)).toFixed(2) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<button @click="handleBuy" :disabled="buying"
|
<button @click="handleBuy" :disabled="buying"
|
||||||
|
|||||||
@@ -47,9 +47,10 @@ const menuGroups = [
|
|||||||
|
|
||||||
<div class="bg-white p-4 shadow-lg border-b border-gray-300">
|
<div class="bg-white p-4 shadow-lg border-b border-gray-300">
|
||||||
<div class="flex items-center gap-4 p-4 border-gray-100">
|
<div class="flex items-center gap-4 p-4 border-gray-100">
|
||||||
<div class="w-16 h-16 rounded-full bg-gray-200 overflow-hidden"
|
<div class="w-16 h-16 border rounded-full border-gray-200 bg-gray-200 overflow-hidden">
|
||||||
:style="{ backgroundImage: `url(${userInfo.avatar})` }">
|
<img :src="userInfo.avatar" :alt="userInfo.username" class="w-full h-full object-cover" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-xl font-medium">{{ userInfo.username }}</h3>
|
<h3 class="text-xl font-medium">{{ userInfo.username }}</h3>
|
||||||
<span class="text-gray-500">ID: {{ userInfo.id }}</span>
|
<span class="text-gray-500">ID: {{ userInfo.id }}</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user