feat: fix user boughts
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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">¥{{ discountPrice }}</span>
|
||||
</template>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -185,7 +185,7 @@ onUnmounted(() => {
|
||||
<div class="text-orange-600 text-2xl">
|
||||
<span class="mr-2 text-xl">¥</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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user