Merge branch 'main' of github.com:nagisa77/OpenIsle

This commit is contained in:
Tim
2025-08-04 17:05:03 +08:00
10 changed files with 212 additions and 5 deletions

View File

@@ -44,6 +44,10 @@
<div class="profile-info-item-label">最后发帖时间:</div>
<div class="profile-info-item-value">{{ formatDate(user.lastPostTime) }}</div>
</div>
<div class="profile-info-item">
<div class="profile-info-item-label">最后评论时间:</div>
<div class="profile-info-item-value">{{ user.lastCommentTime!=null?formatDate(user.lastCommentTime):"暂无评论" }}</div>
</div>
<div class="profile-info-item">
<div class="profile-info-item-label">浏览量:</div>
<div class="profile-info-item-value">{{ user.totalViews }}</div>

View File

@@ -1,5 +1,11 @@
<template>
<div class="settings-page">
<AvatarCropper
:src="tempAvatar"
:show="showCropper"
@close="showCropper = false"
@crop="onCropped"
/>
<div v-if="isLoadingPage" class="loading-page">
<l-hatch size="20" stroke="4" speed="3.5" color="var(--primary-color)"></l-hatch>
</div>
@@ -59,11 +65,12 @@ import { API_BASE_URL, toast } from '../main'
import { getToken, fetchCurrentUser, setToken } from '../utils/auth'
import BaseInput from '../components/BaseInput.vue'
import Dropdown from '../components/Dropdown.vue'
import AvatarCropper from '../components/AvatarCropper.vue'
import { hatch } from 'ldrs'
hatch.register()
export default {
name: 'SettingsPageView',
components: { BaseInput, Dropdown },
components: { BaseInput, Dropdown, AvatarCropper },
data() {
return {
username: '',
@@ -71,6 +78,8 @@ export default {
usernameError: '',
avatar: '',
avatarFile: null,
tempAvatar: '',
showCropper: false,
role: '',
publishMode: 'DIRECT',
passwordStrength: 'LOW',
@@ -101,15 +110,19 @@ export default {
methods: {
onAvatarChange(e) {
const file = e.target.files[0]
this.avatarFile = file
if (file) {
const reader = new FileReader()
reader.onload = () => {
this.avatar = reader.result
this.tempAvatar = reader.result
this.showCropper = true
}
reader.readAsDataURL(file)
}
},
onCropped({ file, url }) {
this.avatarFile = file
this.avatar = url
},
fetchPublishModes() {
return Promise.resolve([
{ id: 'DIRECT', name: '直接发布', icon: 'fas fa-bolt' },