完善uniapp

This commit is contained in:
2026-07-16 00:35:50 +08:00
parent 61a937f7a3
commit 834c088aa2
29 changed files with 4444 additions and 305 deletions
+48 -101
View File
@@ -1,138 +1,85 @@
import { generateId } from '@/api/request.js'
const STORAGE_KEY = 'app_notes'
function readLocal() {
return uni.getStorageSync(STORAGE_KEY) || []
}
function writeLocal(list) {
uni.setStorageSync(STORAGE_KEY, list)
}
function seedIfEmpty() {
const list = readLocal()
if (list.length) return list
const now = Date.now()
const seeded = [
{
id: generateId(),
title: '欢迎使用记事本',
content: '在这里记录灵感、待办或任何想法。支持置顶、搜索与编辑,后续可一键接入云端同步。',
pinned: true,
createdAt: now - 86400000,
updatedAt: now - 3600000
},
{
id: generateId(),
title: '项目会议要点',
content: '1. 确认 Q3 目标\n2. 排期评审\n3. 接口联调时间',
pinned: false,
createdAt: now - 172800000,
updatedAt: now - 7200000
}
]
writeLocal(seeded)
return seeded
}
function sortNotes(list) {
return [...list].sort((a, b) => {
if (a.pinned !== b.pinned) return a.pinned ? -1 : 1
return (b.updatedAt || 0) - (a.updatedAt || 0)
})
}
import { request } from '@/api/request.js'
/**
* 获取笔记列表
* @param {{ keyword?: string }} params
* @returns {Promise<{ list: Array, total: number }>}
*/
export async function fetchNotes(params = {}) {
// TODO: return request({ url: '/api/notes', data: params })
let list = seedIfEmpty()
const keyword = (params.keyword || '').trim().toLowerCase()
if (keyword) {
list = list.filter(
item =>
item.title.toLowerCase().includes(keyword) ||
item.content.toLowerCase().includes(keyword)
)
}
list = sortNotes(list)
return { list, total: list.length }
const data = await request({
url: '/app/notebook/list',
data: {
keyword: params.keyword || ''
}
})
const list = (data.list || []).map(item => ({
...item,
pinned: !!item.pinned,
createdAt: item.created_at ? new Date(item.created_at.replace(' ', 'T')).getTime() : 0,
updatedAt: item.updated_at ? new Date(item.updated_at.replace(' ', 'T')).getTime() : 0
}))
return { list, total: data.total || 0 }
}
/**
* 获取单条笔记
* @param {string} id
*/
export async function getNote(id) {
// TODO: return request({ url: `/api/notes/${id}` })
const list = readLocal()
return list.find(item => item.id === id) || null
const data = await request({ url: `/app/notebook/${id}` })
if (!data) return null
return {
...data,
pinned: !!data.pinned,
createdAt: data.created_at ? new Date(data.created_at.replace(' ', 'T')).getTime() : 0,
updatedAt: data.updated_at ? new Date(data.updated_at.replace(' ', 'T')).getTime() : 0
}
}
/**
* 创建笔记
* @param {{ title: string, content: string, pinned?: boolean }} data
*/
export async function createNote(data) {
// TODO: return request({ url: '/api/notes', method: 'POST', data })
const now = Date.now()
const note = {
id: generateId(),
title: (data.title || '').trim() || '无标题',
content: (data.content || '').trim(),
pinned: !!data.pinned,
createdAt: now,
updatedAt: now
}
const list = readLocal()
list.unshift(note)
writeLocal(list)
return note
const res = await request({
url: '/app/notebook',
method: 'POST',
data: {
title: data.title || '',
content: data.content || '',
pinned: !!data.pinned
}
})
return res
}
/**
* 更新笔记
* @param {string} id
* @param {{ title?: string, content?: string, pinned?: boolean }} data
*/
export async function updateNote(id, data) {
// TODO: return request({ url: `/api/notes/${id}`, method: 'PUT', data })
const list = readLocal()
const index = list.findIndex(item => item.id === id)
if (index === -1) throw new Error('笔记不存在')
const note = {
...list[index],
...data,
title: data.title !== undefined ? (data.title.trim() || '无标题') : list[index].title,
content: data.content !== undefined ? data.content.trim() : list[index].content,
updatedAt: Date.now()
}
list[index] = note
writeLocal(list)
return note
const res = await request({
url: `/app/notebook/${id}`,
method: 'PUT',
data: {
title: data.title || '',
content: data.content || '',
pinned: data.pinned
}
})
return res
}
/**
* 删除笔记
* @param {string} id
*/
export async function deleteNote(id) {
// TODO: return request({ url: `/api/notes/${id}`, method: 'DELETE' })
const list = readLocal().filter(item => item.id !== id)
writeLocal(list)
await request({ url: `/app/notebook/${id}`, method: 'DELETE' })
return true
}
/**
* 切换置顶
* @param {string} id
*/
export async function toggleNotePin(id) {
const note = await getNote(id)
if (!note) throw new Error('笔记不存在')
return updateNote(id, { pinned: !note.pinned })
const res = await request({
url: `/app/notebook/${id}/togglePin`,
method: 'POST'
})
return res
}
+76 -149
View File
@@ -1,15 +1,4 @@
import { generateId } from '@/api/request.js'
import { startOfDay, endOfDay } from '@/utils/date.js'
const STORAGE_KEY = 'app_schedules'
const PRIORITY = {
low: { value: 'low', label: '低', color: '#909399' },
medium: { value: 'medium', label: '中', color: '#3c9cff' },
high: { value: 'high', label: '高', color: '#f56c6c' }
}
export const PRIORITY_OPTIONS = Object.values(PRIORITY)
import { request } from '@/api/request.js'
export const REMIND_CHANNEL_OPTIONS = [
{ value: 'sms', label: '短信' },
@@ -30,181 +19,112 @@ export const REMIND_MINUTES_OPTIONS = [
{ label: '提前 1 天', value: 1440 }
]
function readLocal() {
const list = uni.getStorageSync(STORAGE_KEY) || []
return list.map(normalizeSchedule)
}
function writeLocal(list) {
uni.setStorageSync(STORAGE_KEY, list)
}
export function normalizeSchedule(item) {
const content = (item.content || item.title || '').trim()
const title = (item.title || content.split('\n')[0] || '无标题').trim().slice(0, 60)
let remindChannels = item.remindChannels
let remindChannels = item.remindChannels || item.remind_channels || []
if (!Array.isArray(remindChannels)) {
remindChannels = item.remindMinutes > 0 ? ['app'] : []
remindChannels = []
}
remindChannels = remindChannels.map(ch => ch === 'SITE_MSG' ? 'app' : ch.toLowerCase())
const datetime = item.schedule_time
? new Date(item.schedule_time.replace(' ', 'T')).getTime()
: item.datetime || 0
const createdAt = item.created_at
? new Date(item.created_at.replace(' ', 'T')).getTime()
: item.createdAt || datetime
const updatedAt = item.updated_at
? new Date(item.updated_at.replace(' ', 'T')).getTime()
: item.updatedAt || datetime
return {
...item,
id: item.id,
title,
content,
remindChannels,
remindMinutes: item.remindMinutes ?? 15
remindMinutes: item.advance_minutes ?? item.remindMinutes ?? 15,
completed: item.is_finished ?? item.completed ?? false,
datetime,
createdAt,
updatedAt
}
}
function buildTitle(content) {
const line = (content || '').split('\n')[0].trim()
return line.slice(0, 60) || '无标题'
}
function seedIfEmpty() {
const raw = uni.getStorageSync(STORAGE_KEY)
if (raw && raw.length) return raw.map(normalizeSchedule)
const now = Date.now()
const today = new Date()
const seeded = [
{
id: generateId(),
content: '团队周会\n汇报本周进度,讨论下周计划',
datetime: new Date(today.getFullYear(), today.getMonth(), today.getDate(), 10, 0).getTime(),
remindChannels: ['app', 'site'],
remindMinutes: 15,
priority: 'high',
completed: false,
createdAt: now - 86400000,
updatedAt: now - 86400000
},
{
id: generateId(),
content: '提交月报\n整理本月数据并发送给主管',
datetime: new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1, 18, 0).getTime(),
remindChannels: ['email', 'site'],
remindMinutes: 30,
priority: 'medium',
completed: false,
createdAt: now - 43200000,
updatedAt: now - 43200000
},
{
id: generateId(),
content: '健身打卡\n有氧运动 30 分钟',
datetime: new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1, 19, 30).getTime(),
remindChannels: ['bark', 'app'],
remindMinutes: 10,
priority: 'low',
completed: true,
createdAt: now - 259200000,
updatedAt: now - 86400000
}
].map(normalizeSchedule)
writeLocal(seeded)
return seeded
}
function sortSchedules(list) {
return [...list].sort((a, b) => {
if (a.completed !== b.completed) return a.completed ? 1 : -1
return (a.datetime || 0) - (b.datetime || 0)
})
}
/**
* 获取日程列表
*/
export async function fetchSchedules(params = {}) {
// TODO: return request({ url: '/api/schedules', data: params })
let list = seedIfEmpty()
const keyword = (params.keyword || '').trim().toLowerCase()
const status = params.status || 'all'
if (keyword) {
list = list.filter(item => {
const text = `${item.title} ${item.content}`.toLowerCase()
return text.includes(keyword)
})
}
if (status === 'pending') list = list.filter(item => !item.completed)
if (status === 'done') list = list.filter(item => item.completed)
if (params.date) {
const dayStart = startOfDay(params.date).getTime()
const dayEnd = endOfDay(params.date).getTime()
list = list.filter(item => item.datetime >= dayStart && item.datetime <= dayEnd)
}
list = sortSchedules(list)
return { list, total: list.length }
const data = await request({
url: '/app/schedule/list',
data: {
page: params.page || 1,
pageSize: params.pageSize || 50,
keyword: params.keyword || '',
status: params.status || ''
}
})
const list = (data.list || []).map(normalizeSchedule)
return { list, total: data.total || 0 }
}
/**
* 获取单条日程
*/
export async function getSchedule(id) {
// TODO: return request({ url: `/api/schedules/${id}` })
const list = readLocal()
const item = list.find(entry => entry.id === id)
return item ? normalizeSchedule(item) : null
const data = await request({ url: `/app/schedule/${id}` })
return data ? normalizeSchedule(data) : null
}
/**
* 创建日程
* @param {{ content: string, datetime: number, remindChannels?: string[], remindMinutes?: number }} data
*/
export async function createSchedule(data) {
// TODO: return request({ url: '/api/schedules', method: 'POST', data })
const now = Date.now()
const content = (data.content || '').trim()
const schedule = normalizeSchedule({
id: generateId(),
title: buildTitle(content),
content,
datetime: data.datetime,
remindChannels: data.remindChannels || [],
remindMinutes: data.remindMinutes ?? 15,
priority: data.priority || 'medium',
completed: false,
createdAt: now,
updatedAt: now
const channels = (data.remindChannels || []).map(ch => {
if (ch === 'app') return 'SITE_MSG'
return ch.toUpperCase()
})
const list = readLocal()
list.push(schedule)
writeLocal(list)
return schedule
const res = await request({
url: '/app/schedule',
method: 'POST',
data: {
content: data.content,
schedule_time: formatDateTime(data.datetime),
remind_channels: channels,
advance_minutes: data.remindMinutes ?? 15
}
})
return res
}
/**
* 更新日程
*/
export async function updateSchedule(id, data) {
// TODO: return request({ url: `/api/schedules/${id}`, method: 'PUT', data })
const list = readLocal()
const index = list.findIndex(item => item.id === id)
if (index === -1) throw new Error('日程不存在')
const prev = list[index]
const content = data.content !== undefined ? data.content.trim() : prev.content
const schedule = normalizeSchedule({
...prev,
...data,
title: data.content !== undefined ? buildTitle(content) : prev.title,
content,
updatedAt: Date.now()
const channels = (data.remindChannels || []).map(ch => {
if (ch === 'app') return 'SITE_MSG'
return ch.toUpperCase()
})
await request({
url: `/app/schedule/${id}`,
method: 'PUT',
data: {
content: data.content,
schedule_time: formatDateTime(data.datetime),
remind_channels: channels,
advance_minutes: data.remindMinutes ?? 15
}
})
list[index] = schedule
writeLocal(list)
return schedule
}
/**
* 删除日程
*/
export async function deleteSchedule(id) {
// TODO: return request({ url: `/api/schedules/${id}`, method: 'DELETE' })
const list = readLocal().filter(item => item.id !== id)
writeLocal(list)
await request({ url: `/app/schedule/${id}`, method: 'DELETE' })
return true
}
@@ -212,13 +132,20 @@ export async function deleteSchedule(id) {
* 切换完成状态
*/
export async function toggleScheduleComplete(id) {
const item = await getSchedule(id)
if (!item) throw new Error('日程不存在')
return updateSchedule(id, { completed: !item.completed })
const res = await request({
url: `/app/schedule/${id}/toggle`,
method: 'POST'
})
return {
...res,
completed: res?.is_finished ?? false
}
}
export function getPriorityMeta(value) {
return PRIORITY[value] || PRIORITY.medium
function formatDateTime(timestamp) {
const d = new Date(timestamp)
const pad = n => String(n).padStart(2, '0')
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
}
export function getRemindChannelLabel(value) {
+120 -25
View File
@@ -50,13 +50,13 @@
<view class="section">
<view class="section-header">
<text class="section-title">最近动态</text>
<text class="section-more">查看全部</text>
</view>
<view class="activity-card">
<view class="activity-item" v-for="(item, index) in activities" :key="index">
<view class="activity-icon">
<FaIcon name="circle" color="#3c9cff" :size="8" />
</view>
<view v-if="activities.length === 0" class="activity-empty">
<text class="activity-empty-text">暂无动态</text>
</view>
<view class="activity-item" v-for="(item, index) in activities" :key="index" @tap="onActivityTap(item)">
<view class="activity-dot" :class="item.type" />
<view class="activity-body">
<text class="activity-title">{{ item.title }}</text>
<text class="activity-time">{{ item.time }}</text>
@@ -75,7 +75,11 @@
<script setup>
import { ref, computed, onMounted } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { getUser, isLoggedIn } from '@/utils/auth.js'
import { fetchNotes } from '@/api/note.js'
import { fetchSchedules } from '@/api/schedule.js'
import { request } from '@/api/request.js'
import AppTabbar from '@/components/AppTabbar.vue'
const user = ref(null)
@@ -92,26 +96,71 @@ const avatarText = computed(() => {
return name.charAt(0).toUpperCase()
})
const stats = ref([
{ label: '今日访问', value: '2,847', trend: '12%', up: true },
{ label: '活跃用户', value: '1,256', trend: '8%', up: true },
{ label: '转化率', value: '68.5%', trend: '3%', up: false },
{ label: '总收入', value: '¥8.2k', trend: '15%', up: true }
const noteCount = ref(0)
const scheduleCount = ref(0)
const schedulePending = ref(0)
const stats = computed(() => [
{ label: '记事本', value: String(noteCount.value), trend: '条笔记', up: true },
{ label: '日程提醒', value: String(scheduleCount.value), trend: '条日程', up: true },
{ label: '待办事项', value: String(schedulePending.value), trend: '项待办', up: schedulePending.value > 0 },
{ label: '活跃天数', value: '1', trend: '今天', up: true }
])
const quickActions = ref([
{ name: '数据分析', icon: 'chart-line' },
{ name: '消息中心', icon: 'bell' },
{ name: '订单管理', icon: 'clipboard-list' },
{ name: '设置', icon: 'gear' }
{ name: '记事本', icon: 'note-sticky', route: '/pages/tools/notepad/index' },
{ name: '日程提醒', icon: 'calendar-days', route: '/pages/tools/schedule/index' },
{ name: '新建笔记', icon: 'pen-to-square', route: '/pages/tools/notepad/edit' },
{ name: '新建日程', icon: 'clock', route: '/pages/tools/schedule/edit' }
])
const activities = ref([
{ title: '新用户注册 +128', time: '5 分钟前' },
{ title: '系统更新完成 v2.1', time: '1 小时前' },
{ title: '订单 #8821 已发货', time: '2 小时前' },
{ title: '数据备份成功', time: '昨天 23:00' }
])
const activities = ref([])
function formatTime(ts) {
if (!ts) return ''
const now = Date.now()
const diff = now - ts
const minute = 60 * 1000
const hour = 60 * minute
const day = 24 * hour
if (diff < minute) return '刚刚'
if (diff < hour) return `${Math.floor(diff / minute)} 分钟前`
if (diff < day) return `${Math.floor(diff / hour)} 小时前`
if (diff < 7 * day) return `${Math.floor(diff / day)} 天前`
const d = new Date(ts)
return `${d.getMonth() + 1}/${d.getDate()}`
}
function formatTimeStr(dateStr) {
if (!dateStr) return ''
const ts = new Date(dateStr.replace(' ', 'T')).getTime()
return formatTime(ts)
}
async function loadDashboard() {
try {
const [noteRes, schedRes, actRes] = await Promise.all([
fetchNotes({ keyword: '' }).catch(() => ({ list: [], total: 0 })),
fetchSchedules({ keyword: '', status: 'all' }).catch(() => ({ list: [], total: 0 })),
request({ url: '/app/activity/list', data: { limit: 8 } }).catch(() => [])
])
noteCount.value = noteRes.total || 0
scheduleCount.value = schedRes.total || 0
schedulePending.value = (schedRes.list || []).filter(s => !s.completed).length
const actList = Array.isArray(actRes) ? actRes : (actRes?.list || actRes || [])
activities.value = actList.map(item => ({
type: item.target_type || 'other',
title: item.title || `${item.target_type} ${item.action}`,
time: formatTimeStr(item.created_at),
route: item.target_type === 'note' ? '/pages/tools/notepad/index' : '/pages/tools/schedule/index'
})).slice(0, 5)
} catch (e) {
console.error('loadDashboard error:', e)
}
}
onMounted(() => {
if (!isLoggedIn()) {
@@ -119,10 +168,25 @@ onMounted(() => {
return
}
user.value = getUser()
loadDashboard()
})
onShow(() => {
if (isLoggedIn()) loadDashboard()
})
function onQuickTap(item) {
uni.showToast({ title: item.name, icon: 'none' })
if (item.route) {
uni.navigateTo({ url: item.route })
} else {
uni.showToast({ title: item.name, icon: 'none' })
}
}
function onActivityTap(item) {
if (item.route) {
uni.navigateTo({ url: item.route })
}
}
</script>
@@ -294,6 +358,16 @@ function onQuickTap(item) {
overflow: hidden;
}
.activity-empty {
padding: 48rpx 0;
text-align: center;
}
.activity-empty-text {
font-size: 26rpx;
color: $color-text-muted;
}
.activity-item {
display: flex;
align-items: center;
@@ -309,10 +383,28 @@ function onQuickTap(item) {
}
}
.activity-icon {
width: 32rpx;
display: flex;
justify-content: center;
.activity-dot {
width: 16rpx;
height: 16rpx;
border-radius: 50%;
flex-shrink: 0;
background: #909399;
&.notebook {
background: #67c23a;
}
&.schedule {
background: $color-primary;
}
&.erp {
background: #e6a23c;
}
&.file {
background: #f56c6c;
}
}
.activity-body {
@@ -324,6 +416,9 @@ function onQuickTap(item) {
display: block;
font-size: 28rpx;
color: $color-text;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.activity-time {
+123 -17
View File
@@ -15,16 +15,29 @@
<view class="field content-field">
<text class="field-label">内容</text>
<textarea
class="field-textarea"
v-model="form.content"
placeholder="记录你的想法..."
placeholder-class="placeholder"
:auto-height="false"
maxlength="5000"
:show-confirm-bar="false"
/>
<text class="char-count">{{ form.content.length }}/5000</text>
<view class="editor-wrap">
<editor
id="noteEditor"
class="note-editor"
:placeholder="'记录你的想法...'"
:value="form.content"
@ready="onEditorReady"
@input="onEditorInput"
@focus="editorFocused = true"
@blur="editorFocused = false"
/>
<view class="editor-toolbar">
<view
v-for="btn in toolbarBtns"
:key="btn.name"
class="toolbar-btn"
:class="{ active: btn.active }"
@tap="execCommand(btn)"
>
<text>{{ btn.label }}</text>
</view>
</view>
</view>
</view>
<view class="switch-row" @tap="form.pinned = !form.pinned">
@@ -57,6 +70,8 @@ import { formatDate } from '@/utils/date.js'
const noteId = ref('')
const saving = ref(false)
const editorCtx = ref(null)
const editorFocused = ref(false)
const form = reactive({
title: '',
content: '',
@@ -66,6 +81,18 @@ const meta = reactive({
updatedAt: 0
})
const toolbarBtns = reactive([
{ name: 'bold', label: 'B', active: false, value: 'bold' },
{ name: 'italic', label: 'I', active: false, value: 'italic' },
{ name: 'underline', label: 'U', active: false, value: 'underline' },
{ name: 'strike', label: 'S', active: false, value: 'strikeThrough' },
{ name: 'header', label: 'H', active: false, value: 'header' },
{ name: 'list', label: '•', active: false, value: 'insertUnorderedList' },
{ name: 'indent', label: '→', active: false, value: 'indent' },
{ name: 'outdent', label: '←', active: false, value: 'outdent' },
{ name: 'divider', label: '—', active: false, value: 'insertHorizontalRule' },
])
onLoad(async (query) => {
if (query?.id) {
noteId.value = query.id
@@ -76,6 +103,30 @@ onLoad(async (query) => {
}
})
function onEditorReady() {
uni.createSelectorQuery().select('#noteEditor').context((res) => {
if (res && res.context) {
editorCtx.value = res.context
if (form.content) {
editorCtx.value.setContents({ html: form.content })
}
}
}).exec()
}
function onEditorInput(e) {
form.content = e.detail.html || ''
}
function execCommand(btn) {
if (!editorCtx.value) return
if (btn.name === 'header') {
editorCtx.value.format('header', 'H2')
} else {
editorCtx.value.format(btn.value)
}
}
async function loadNote(id) {
try {
const note = await getNote(id)
@@ -88,6 +139,9 @@ async function loadNote(id) {
form.content = note.content
form.pinned = !!note.pinned
meta.updatedAt = note.updatedAt
if (editorCtx.value && note.content) {
editorCtx.value.setContents({ html: note.content })
}
} catch (e) {
uni.showToast({ title: '加载失败', icon: 'none' })
}
@@ -147,13 +201,19 @@ function onDelete() {
.page {
min-height: 100vh;
background: $color-bg-page;
padding: 24rpx $page-padding-x;
padding-bottom: calc(180rpx + env(safe-area-inset-bottom));
display: flex;
flex-direction: column;
padding: 24rpx $page-padding-x 0;
padding-bottom: calc(130rpx + env(safe-area-inset-bottom));
}
.form-card {
@include card;
padding: 8rpx 0;
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
}
.field {
@@ -183,12 +243,57 @@ function onDelete() {
}
.content-field {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
padding-bottom: 0;
overflow: hidden;
}
.field-textarea {
height: 480rpx;
line-height: 1.7;
.editor-wrap {
background: $color-bg-page;
border-radius: $radius-md;
overflow: hidden;
flex: 1;
display: flex;
flex-direction: column;
}
.note-editor {
width: 100%;
flex: 1;
min-height: 0;
padding: 20rpx;
font-size: 28rpx;
color: $color-text;
box-sizing: border-box;
overflow-y: auto;
}
.editor-toolbar {
display: flex;
flex-wrap: wrap;
gap: 8rpx;
padding: 16rpx 20rpx;
border-top: 1rpx solid $color-divider;
background: $color-card;
}
.toolbar-btn {
padding: 10rpx 20rpx;
border-radius: $radius-sm;
font-size: 24rpx;
color: $color-text-secondary;
background: $color-bg-page;
&.active {
color: $color-primary;
background: $color-primary-bg;
}
&:active {
opacity: 0.7;
}
}
.placeholder {
@@ -237,7 +342,7 @@ function onDelete() {
}
.meta {
margin-top: 20rpx;
margin: 20rpx 0;
padding: 0 8rpx;
font-size: 24rpx;
color: $color-text-muted;
@@ -255,6 +360,7 @@ function onDelete() {
background: $color-card;
border-top: 1rpx solid $color-border;
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.04);
z-index: 10;
}
.btn-primary,
+1 -1
View File
@@ -111,7 +111,7 @@ function clearSearch() {
}
function preview(content) {
const text = (content || '').replace(/\s+/g, ' ').trim()
const text = (content || '').replace(/<[^>]+>/g, '').replace(/&nbsp;/g, ' ').replace(/\s+/g, ' ').trim()
if (!text) return '暂无内容'
return text.length > 60 ? `${text.slice(0, 60)}...` : text
}