Skip to content

Commit

Permalink
[*] Better newyear view
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Jan 26, 2025
1 parent b4410ae commit 66b7202
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 149 deletions.
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"tabWidth": 2,
"singleQuote": true,
"printWidth": 100,
"endOfLine": "lf",
"trailingComma": "none"
}
3 changes: 2 additions & 1 deletion auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// Generated by unplugin-auto-import
// biome-ignore lint: disable
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
Expand Down Expand Up @@ -69,6 +70,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
8 changes: 1 addition & 7 deletions components.d.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
/* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}

/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
GuestSidebar: typeof import('./src/components/sidebar/GuestSidebar.vue')['default']
LoadingBar: typeof import('./src/components/LoadingBar.vue')['default']
MainSidebar: typeof import('./src/components/sidebar/MainSidebar.vue')['default']
MSLogin: typeof import('./src/components/MSLogin.vue')['default']
NAlert: typeof import('naive-ui')['NAlert']
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NDivider: typeof import('naive-ui')['NDivider']
NDrawer: typeof import('naive-ui')['NDrawer']
NDrawerContent: typeof import('naive-ui')['NDrawerContent']
Expand All @@ -30,7 +27,6 @@ declare module 'vue' {
NH2: typeof import('naive-ui')['NH2']
NH5: typeof import('naive-ui')['NH5']
NIcon: typeof import('naive-ui')['NIcon']
NImage: typeof import('naive-ui')['NImage']
NInput: typeof import('naive-ui')['NInput']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutContent: typeof import('naive-ui')['NLayoutContent']
Expand All @@ -40,8 +36,6 @@ declare module 'vue' {
NModal: typeof import('naive-ui')['NModal']
NNumberAnimation: typeof import('naive-ui')['NNumberAnimation']
NP: typeof import('naive-ui')['NP']
NQrCode: typeof import('naive-ui')['NQrCode']
NSkeleton: typeof import('naive-ui')['NSkeleton']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NStatistic: typeof import('naive-ui')['NStatistic']
Expand Down
3 changes: 1 addition & 2 deletions src/api/v2/comment.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const getCommentList = async (user_id: number) => {
return base.buildResponse(await rs)
}


/**
* 添加评论
*/
Expand All @@ -26,7 +25,7 @@ const postComment = async (user_id: number, comment: string) => {

const comment = {
get: getCommentList,
post: postComment,
post: postComment
}

export default comment
6 changes: 3 additions & 3 deletions src/api/v2/prize/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import root from "./root.api"
import root from './root.api'

export default {
root: root
}
root: root
}
12 changes: 6 additions & 6 deletions src/api/v2/prize/root.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ const getPrize = async (user_id: number) => {
}

const joinPrize = async (user_id: number, prize_id: number) => {
const rs = post(`${base.api_v2_url}/prize`, {
user_id: user_id,
prize_id: prize_id
})
return base.buildResponse(await rs)
const rs = post(`${base.api_v2_url}/prize`, {
user_id: user_id,
prize_id: prize_id
})
return base.buildResponse(await rs)
}

const prize = {
get: getPrize,
join: joinPrize
}

export default prize
export default prize
8 changes: 7 additions & 1 deletion src/components/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,13 @@ async function changePassword() {
}
let rs
try {
rs = await api.v2.user.password(data.user_id, undefined, data.oldPassword, data.newPassword, undefined)
rs = await api.v2.user.password(
data.user_id,
undefined,
data.oldPassword,
data.newPassword,
undefined
)
} catch (e) {
logger.error(e)
tPassword.value.isLoading = false
Expand Down
57 changes: 41 additions & 16 deletions src/components/sidebar/MainSidebar.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
<template>
<n-layout-sider bordered show-trigger :collapsed="collapsed" @collapse="collapsed = true" @expand="collapsed = false"
collapse-mode="width" :collapsed-width="64" :native-scrollbar="false" id="sider" style="height: 100%; bottom: 0">
<n-menu ref="menuInstRef" :collapsed="collapsed" :collapsed-width="64" :collapsed-icon-size="22"
:options="menuOptions" style="" :value="active" @update:value="handleUpdateValue" />
<n-layout-sider
bordered
show-trigger
:collapsed="collapsed"
@collapse="collapsed = true"
@expand="collapsed = false"
collapse-mode="width"
:collapsed-width="64"
:native-scrollbar="false"
id="sider"
style="height: 100%; bottom: 0"
>
<n-menu
ref="menuInstRef"
:collapsed="collapsed"
:collapsed-width="64"
:collapsed-icon-size="22"
:options="menuOptions"
style=""
:value="active"
@update:value="handleUpdateValue"
/>
</n-layout-sider>
</template>

Expand All @@ -23,9 +41,9 @@ import {
CompassSharp,
GameController
} from '@vicons/ionicons5'
import { GuiManagement, Api } from '@vicons/carbon'
import { GuiManagement, Api, Gift } from '@vicons/carbon'
import { MoreCircle20Filled, Box24Filled } from '@vicons/fluent'
import { AttachMoneyFilled, AccountTreeOutlined } from '@vicons/material'
import { AttachMoneyFilled, AccountTreeOutlined, AnchorTwotone, MessageOutlined } from '@vicons/material'
import router from '@router'
import { useRoute } from 'vue-router'
Expand All @@ -48,16 +66,23 @@ const menuOptions = [
icon: renderIcon(CompassSharp)
},
{
path: '/comment',
label: '留言',
key: 'comment',
icon: renderIcon(PencilSharp)
},
{
path: '/prize',
label: '抽奖',
key: 'prize',
icon: renderIcon(PencilSharp)
label: '新年活动',
key: 'newyear',
icon: renderIcon(AnchorTwotone),
children: [
{
path: '/comment',
label: '留言',
key: 'comment',
icon: renderIcon(MessageOutlined)
},
{
path: '/prize',
label: '抽奖',
key: 'prize',
icon: renderIcon(Gift)
}
]
},
{
path: '/verification',
Expand Down
27 changes: 16 additions & 11 deletions src/views/NewYearView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
<n-grid cols="1" item-responsive>
<n-grid-item span="1">
<n-form-item label="评论和祝福" path="comment">
<n-input v-model:value="newYear.comment" placeholder="您有什么想对 LoCyanFrp 全体用户说的吗" />
<n-input
v-model:value="newYear.comment"
placeholder="您有什么想对 LoCyanFrp 全体用户说的吗"
/>
</n-form-item>
</n-grid-item>
<n-gi span="1">
<n-space justify="end"><n-button type="primary" @click="submitComment()"> 提交</n-button></n-space>
<n-space justify="end"
><n-button type="primary" @click="submitComment()"> 提交</n-button></n-space
>
</n-gi>
</n-grid>
</n-form>
Expand Down Expand Up @@ -55,17 +60,17 @@ function timestampToTime(timestamp) {
async function submitComment() {
let rs
try {
rs = await api.v2.comment.post(userData.getters.get_user_id, newYear.value.comment);
rs = await api.v2.comment.post(userData.getters.get_user_id, newYear.value.comment)
} catch (e) {
logger.error(e);
message.error("接口请求失败:" + e);
logger.error(e)
message.error('接口请求失败:' + e)
}
if (!rs) return
if (rs.status === 200) {
message.success("提交成功");
getMessageList();
message.success('提交成功')
getMessageList()
} else {
message.error(rs.message);
message.error(rs.message)
}
}
Expand All @@ -74,14 +79,14 @@ async function getMessageList() {
try {
rs = await api.v2.comment.get(userData.getters.get_user_id)
} catch (e) {
logger.error(e);
message.error("接口请求失败:" + e);
logger.error(e)
message.error('接口请求失败:' + e)
}
if (!rs) return
if (rs.status === 200) {
commentList.value = rs.data.list
} else {
message.error(rs.message);
message.error(rs.message)
}
}
Expand Down
Loading

0 comments on commit 66b7202

Please sign in to comment.