feat: fix user boughts

This commit is contained in:
Rogee
2025-04-30 21:44:18 +08:00
parent 9c88b14202
commit 53b3556ee9
6 changed files with 11 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ type UserInfo struct {
ID int64 `json:"id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
Username string `json:"username,omitempty"`
Avatar string `json:"avatar,omitempty"`
}
// @Router /users/profile [get]
@@ -26,6 +27,7 @@ func (ctl *users) Profile(ctx fiber.Ctx, user *model.Users) (*UserInfo, error) {
ID: user.ID,
CreatedAt: user.CreatedAt,
Username: user.Username,
Avatar: *user.Avatar,
}, nil
}

View File

@@ -3,7 +3,7 @@
<head>
<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>
<link href="/src/styles.css" rel="stylesheet">
</head>

View File

@@ -17,7 +17,7 @@ const formattedDate = 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) => {
@@ -68,7 +68,7 @@ const showArticle = (article) => {
</span>
<template v-else>
<span v-if="article.discount < 100" class="text-xs line-through text-gray-500">
¥{{ article.price }}
¥{{ (article.price / 100).toFixed(2) }}
</span>
<span class="text-xl text-orange-600">&yen;{{ discountPrice }}</span>
</template>

View File

@@ -30,7 +30,7 @@ const switchTab = (index, route) => {
<nav class="flex-none bg-white border-t border-gray-200">
<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="[
activeTab === index
? 'text-blue-600'
@@ -38,7 +38,7 @@ const switchTab = (index, route) => {
]" @click="switchTab(index, tab.route)">
<component :is="tab.icon" class="w-6 h-6" />
<span class="mt-1 text-xs">{{ tab.label }}</span>
</button>
</div>
</div>
</nav>
</div>

View File

@@ -185,7 +185,7 @@ onUnmounted(() => {
<div class="text-orange-600 text-2xl">
<span class="mr-2 text-xl">&yen;</span>
<span class="font-bold font-mono">
{{ (article.price / 100).toFixed(2) }}
{{ (article.price * article.discount / (100 * 100)).toFixed(2) }}
</span>
</div>
<button @click="handleBuy" :disabled="buying"

View File

@@ -47,9 +47,10 @@ const menuGroups = [
<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="w-16 h-16 rounded-full bg-gray-200 overflow-hidden"
:style="{ backgroundImage: `url(${userInfo.avatar})` }">
<div class="w-16 h-16 border rounded-full border-gray-200 bg-gray-200 overflow-hidden">
<img :src="userInfo.avatar" :alt="userInfo.username" class="w-full h-full object-cover" />
</div>
<div>
<h3 class="text-xl font-medium">{{ userInfo.username }}</h3>
<span class="text-gray-500">ID: {{ userInfo.id }}</span>