Skip to content

Commit c665d9c

Browse files
author
yqz
committed
Revert "大更新"
This reverts commit a471feb.
1 parent a471feb commit c665d9c

21 files changed

Lines changed: 17 additions & 748 deletions

.cursor/rules/rule.mdc

Lines changed: 0 additions & 5 deletions
This file was deleted.

frontend/src/api/feedback-admin.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

frontend/src/api/feedback.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

frontend/src/api/http.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ function resolveApiBase() {
1010
const v = import.meta.env.VITE_API_BASE
1111
if (v === '') return ''
1212
if (v != null && v !== '') return v
13-
// 开发环境默认走同域 /api(由 Vite proxy 转到本机后端),避免误连远端导致 token/权限不一致
14-
return ''
13+
return import.meta.env.DEV ? 'http://8.138.32.217:8082' : ''
1514
}
1615

1716
export const API_BASE = resolveApiBase()
@@ -70,14 +69,12 @@ export async function request(path, options = {}) {
7069
const err = new Error(msg)
7170
err.code = json.code
7271
err.httpStatus = res.status
73-
err.traceId = json.traceId
7472
throw err
7573
}
7674

7775
if (!res.ok) {
7876
const err = new Error(`HTTP ${res.status}`)
7977
err.httpStatus = res.status
80-
err.traceId = json?.traceId
8178
throw err
8279
}
8380

Lines changed: 14 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<template>
2-
<div>
3-
<header class="site-top-bar" role="banner">
4-
<div class="site-top-bar-inner">
5-
<div class="site-top-actions">
2+
<header class="site-top-bar" role="banner">
3+
<div class="site-top-bar-inner">
4+
<div class="site-top-actions">
65
<a
76
class="top-action-btn"
87
href="https://github.com/yyyCode/OpenBlog.git"
@@ -19,14 +18,15 @@
1918
</span>
2019
项目源码
2120
</a>
22-
<button type="button" class="top-action-btn" aria-label="问题反馈" @click="openFeedback">
21+
<button type="button" class="top-action-btn" aria-label="面试内容" @click="onInterviewClick">
2322
<span class="top-action-ico" aria-hidden="true">
2423
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
25-
<path d="M4 4h16v16H4z" />
26-
<path d="M22 6l-10 7L2 6" />
24+
<path d="M9 2h6v3H9z" />
25+
<path d="M7 5h10a2 2 0 0 1 2 2v12a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V7a2 2 0 0 1 2-2z" />
26+
<path d="M9 11h6M9 15h6" />
2727
</svg>
2828
</span>
29-
问题反馈
29+
面试内容
3030
</button>
3131
</div>
3232
<button
@@ -37,60 +37,17 @@
3737
>
3838
<span class="theme-toggle-icon" aria-hidden="true">{{ isDark ? '☀' : '☽' }}</span>
3939
<span class="theme-toggle-text">{{ isDark ? '浅色' : '深色' }}</span>
40-
</button>
41-
</div>
42-
</header>
43-
44-
<Teleport to="body">
45-
<div v-if="feedbackOpen" class="ob-dialog-overlay" role="dialog" aria-modal="true" aria-label="问题反馈">
46-
<div class="ob-dialog card">
47-
<div class="ob-dialog-title">问题反馈</div>
48-
<div class="ob-dialog-desc">欢迎提交问题与建议(同一 IP 每天仅可提交一次)。</div>
49-
50-
<div class="field" style="margin-top: 14px">
51-
<div class="label">提交者名字</div>
52-
<input v-model="fbName" class="input" type="text" maxlength="50" placeholder="例如:张三" />
53-
</div>
54-
<div class="field">
55-
<div class="label">内容</div>
56-
<textarea
57-
v-model="fbContent"
58-
class="textarea"
59-
rows="6"
60-
maxlength="2000"
61-
placeholder="请描述你遇到的问题或建议"
62-
></textarea>
63-
</div>
64-
65-
<div style="display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px">
66-
<button type="button" class="btn" :disabled="fbLoading" @click="closeFeedback">取消</button>
67-
<button type="button" class="btn primary" :disabled="fbLoading || !canSubmit" @click="submitFeedback">
68-
{{ fbLoading ? '提交中…' : '提交' }}
69-
</button>
70-
</div>
71-
</div>
72-
</div>
73-
</Teleport>
74-
</div>
40+
</button>
41+
</div>
42+
</header>
7543
</template>
7644

7745
<script setup>
78-
import { computed, onMounted, ref } from 'vue'
46+
import { onMounted, ref } from 'vue'
7947
import { toggleTheme as applyToggle } from '../theme'
8048
import { showMessage } from '../utils/message'
81-
import { createFeedback } from '../api/feedback'
8249
8350
const isDark = ref(false)
84-
const feedbackOpen = ref(false)
85-
const fbName = ref('')
86-
const fbContent = ref('')
87-
const fbLoading = ref(false)
88-
89-
const canSubmit = computed(() => {
90-
const n = (fbName.value || '').trim()
91-
const c = (fbContent.value || '').trim()
92-
return n.length > 0 && c.length > 0
93-
})
9451
9552
function sync() {
9653
isDark.value = document.documentElement.getAttribute('data-theme') === 'dark'
@@ -105,68 +62,7 @@ function onToggle() {
10562
sync()
10663
}
10764
108-
function openFeedback() {
109-
feedbackOpen.value = true
110-
}
111-
112-
function closeFeedback() {
113-
if (fbLoading.value) return
114-
feedbackOpen.value = false
115-
}
116-
117-
async function submitFeedback() {
118-
if (!canSubmit.value || fbLoading.value) return
119-
fbLoading.value = true
120-
try {
121-
await createFeedback({
122-
submitterName: fbName.value.trim(),
123-
content: fbContent.value.trim()
124-
})
125-
showMessage('提交成功,感谢反馈')
126-
fbName.value = ''
127-
fbContent.value = ''
128-
feedbackOpen.value = false
129-
} catch (e) {
130-
const traceId = e?.traceId ? `(traceId ${e.traceId}` : ''
131-
const prefix = e?.code ? `错误码 ${e.code}` : e?.httpStatus ? `HTTP ${e.httpStatus}` : ''
132-
const msg = e?.message || '提交失败'
133-
showMessage(`${prefix ? prefix + '' : ''}${msg}${traceId}`)
134-
} finally {
135-
fbLoading.value = false
136-
}
65+
function onInterviewClick() {
66+
showMessage('功能暂未开放')
13767
}
13868
</script>
139-
140-
<style scoped>
141-
.ob-dialog-overlay {
142-
position: fixed;
143-
inset: 0;
144-
z-index: 10060;
145-
display: flex;
146-
align-items: center;
147-
justify-content: center;
148-
padding: 24px;
149-
background: rgba(0, 0, 0, 0.42);
150-
backdrop-filter: blur(6px);
151-
-webkit-backdrop-filter: blur(6px);
152-
}
153-
154-
.ob-dialog {
155-
width: min(520px, 100%);
156-
padding: 20px 18px 18px;
157-
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
158-
}
159-
160-
.ob-dialog-title {
161-
font-size: 18px;
162-
font-weight: 950;
163-
color: var(--text);
164-
}
165-
166-
.ob-dialog-desc {
167-
margin-top: 8px;
168-
font-size: 13px;
169-
line-height: 1.6;
170-
color: var(--muted);
171-
}
172-
</style>

frontend/src/layouts/ConsoleLayout.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@
7474
</span>
7575
评论
7676
</router-link>
77-
<router-link to="/console/feedback" class="console-nav-item" active-class="active">
78-
<span class="console-nav-ico" aria-hidden="true">
79-
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
80-
<path d="M4 4h16v16H4z" />
81-
<path d="M22 6l-10 7L2 6" />
82-
</svg>
83-
</span>
84-
问题反馈
85-
</router-link>
8677
<router-link to="/console/attachments" class="console-nav-item" active-class="active">
8778
<span class="console-nav-ico" aria-hidden="true">
8879
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">

frontend/src/router/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ConsoleChangelogView from '../views/ConsoleChangelogView.vue'
1717
import ConsoleAttachmentsView from '../views/ConsoleAttachmentsView.vue'
1818
import ConsoleCommentsView from '../views/ConsoleCommentsView.vue'
1919
import ConsoleSystemView from '../views/ConsoleSystemView.vue'
20-
import ConsoleFeedbackView from '../views/ConsoleFeedbackView.vue'
2120

2221
const routes = [
2322
{
@@ -45,7 +44,6 @@ const routes = [
4544
{ path: 'articles/manage', name: 'consoleArticleManage', component: ConsoleArticleManageView },
4645
{ path: 'articles/new', name: 'consoleArticleCompose', component: ConsoleArticleComposeView },
4746
{ path: 'changelog', name: 'consoleChangelog', component: ConsoleChangelogView },
48-
{ path: 'feedback', name: 'consoleFeedback', component: ConsoleFeedbackView },
4947
{ path: 'attachments', name: 'consoleAttachments', component: ConsoleAttachmentsView },
5048
{ path: 'comments', name: 'consoleComments', component: ConsoleCommentsView },
5149
{ path: 'system', name: 'consoleSystem', component: ConsoleSystemView }

frontend/src/views/ConsoleChangelogView.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,8 @@ async function saveChangelog() {
198198
} catch (e) {
199199
const apiCode = e?.code
200200
const httpStatus = e?.httpStatus
201-
const traceId = e?.traceId ? `traceId ${e.traceId}` : ''
202201
const prefix = apiCode ? `错误码 ${apiCode}` : httpStatus ? `HTTP ${httpStatus}` : ''
203-
const head = [prefix, traceId].filter(Boolean).join('')
204-
changelogError.value = head ? `${head}${e?.message || '保存失败'}` : e?.message || '保存失败'
202+
changelogError.value = prefix ? `${prefix}${e?.message || '保存失败'}` : e?.message || '保存失败'
205203
changelogSuccess.value = ''
206204
}
207205
}
@@ -218,10 +216,8 @@ async function removeChangelog() {
218216
} catch (e) {
219217
const apiCode = e?.code
220218
const httpStatus = e?.httpStatus
221-
const traceId = e?.traceId ? `traceId ${e.traceId}` : ''
222219
const prefix = apiCode ? `错误码 ${apiCode}` : httpStatus ? `HTTP ${httpStatus}` : ''
223-
const head = [prefix, traceId].filter(Boolean).join(',')
224-
changelogError.value = head ? `${head}:${e?.message || '删除失败'}` : e?.message || '删除失败'
220+
changelogError.value = prefix ? `${prefix}:${e?.message || '删除失败'}` : e?.message || '删除失败'
225221
changelogSuccess.value = ''
226222
}
227223
}

frontend/src/views/ConsoleFeedbackView.vue

Lines changed: 0 additions & 89 deletions
This file was deleted.

src/main/java/com/yqz/openblog/common/GlobalExceptionHandler.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import org.slf4j.LoggerFactory;
88
import org.springframework.web.bind.annotation.ExceptionHandler;
99
import org.springframework.web.bind.annotation.RestControllerAdvice;
10-
import org.springframework.security.access.AccessDeniedException;
11-
import org.springframework.security.authorization.AuthorizationDeniedException;
1210

1311
/**
1412
* 统一异常处理(MVP)。
@@ -31,15 +29,6 @@ public ResponseEntity<ApiResponse<Object>> onValidation(MethodArgumentNotValidEx
3129
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ApiResponse.fail(4001, "参数校验失败"));
3230
}
3331

34-
/**
35-
* 方法级鉴权(@PreAuthorize)失败会抛出 AuthorizationDeniedException;
36-
* 以前会落到兜底 Exception -> 5001,导致前端误判为“服务器异常”。
37-
*/
38-
@ExceptionHandler({AuthorizationDeniedException.class, AccessDeniedException.class})
39-
public ResponseEntity<ApiResponse<Object>> onAccessDenied(Exception ex) {
40-
return ResponseEntity.status(HttpStatus.FORBIDDEN).body(ApiResponse.fail(4030, "无权限"));
41-
}
42-
4332
@ExceptionHandler(Exception.class)
4433
public ResponseEntity<ApiResponse<Object>> onOther(Exception ex) {
4534
log.error("unhandled server error", ex);

0 commit comments

Comments
 (0)