refactor(admin): 重构评论管理界面样式和功能
feat(login): 添加API地址配置功能并支持本地存储 fix(api): 移除CWD_CONFIG_KV相关配置改用数据库存储 fix(cors): 修改跨域配置允许所有来源 perf(email): 添加邮件发送日志记录和调试信息 perf(comments): 优化评论提交和邮件通知逻辑 docs(backend): 更新后端配置文档移除CWD_CONFIG_KV相关说明 chore: 更新端口号和示例配置
This commit is contained in:
@@ -159,19 +159,15 @@ export class CommentForm extends Component {
|
||||
updateErrors(formErrors) {
|
||||
if (!this.elements.root) return;
|
||||
|
||||
// 昵称错误
|
||||
const authorInput = this.elements.root.querySelector('input[placeholder*="昵称"]');
|
||||
const authorInput = this.elements.root.querySelector('input[name="author"]');
|
||||
this.updateFieldError(authorInput, formErrors?.author);
|
||||
|
||||
// 邮箱错误
|
||||
const emailInput = this.elements.root.querySelector('input[placeholder*="邮箱"]');
|
||||
const emailInput = this.elements.root.querySelector('input[name="email"]');
|
||||
this.updateFieldError(emailInput, formErrors?.email);
|
||||
|
||||
// 网址错误
|
||||
const urlInput = this.elements.root.querySelector('input[placeholder*="网址"]');
|
||||
const urlInput = this.elements.root.querySelector('input[name="url"]');
|
||||
this.updateFieldError(urlInput, formErrors?.url);
|
||||
|
||||
// 内容错误
|
||||
const contentTextarea = this.elements.root.querySelector('textarea');
|
||||
this.updateFieldError(contentTextarea, formErrors?.content);
|
||||
}
|
||||
@@ -216,7 +212,8 @@ export class CommentForm extends Component {
|
||||
className: `cwd-form-input ${error ? 'cwd-input-error' : ''}`,
|
||||
attributes: {
|
||||
type,
|
||||
placeholder,
|
||||
name: fieldName,
|
||||
value: value || '',
|
||||
disabled: this.props.submitting,
|
||||
onInput: (e) => this.handleFieldChange(fieldName, e.target.value),
|
||||
},
|
||||
@@ -230,9 +227,9 @@ export class CommentForm extends Component {
|
||||
* 设置输入框的值
|
||||
*/
|
||||
setInputValues(root, form) {
|
||||
const authorInput = root.querySelector('input[placeholder*="昵称"]');
|
||||
const emailInput = root.querySelector('input[placeholder*="邮箱"]');
|
||||
const urlInput = root.querySelector('input[placeholder*="网址"]');
|
||||
const authorInput = root.querySelector('input[name="author"]');
|
||||
const emailInput = root.querySelector('input[name="email"]');
|
||||
const urlInput = root.querySelector('input[name="url"]');
|
||||
const contentTextarea = root.querySelector('textarea');
|
||||
|
||||
if (authorInput) authorInput.value = form.author || '';
|
||||
|
||||
@@ -10,7 +10,7 @@ const STORAGE_KEY = 'cwd-dev-config';
|
||||
// 默认配置
|
||||
const DEFAULT_CONFIG = {
|
||||
apiBaseUrl: 'http://localhost:8788',
|
||||
postSlug: 'demo-post',
|
||||
postSlug: "https://zishu.me/message",
|
||||
theme: 'light',
|
||||
avatarPrefix: 'https://gravatar.com/avatar',
|
||||
};
|
||||
|
||||
@@ -3,34 +3,30 @@ import { resolve } from 'path';
|
||||
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [cssInjectedByJsPlugin()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src')
|
||||
}
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
name: 'CWDComments',
|
||||
entry: resolve(__dirname, 'src/index.js'),
|
||||
formats: ['umd'],
|
||||
fileName: (format) => `cwd-comments.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
exports: 'named'
|
||||
}
|
||||
},
|
||||
sourcemap: false,
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: false
|
||||
}
|
||||
}
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
open: false
|
||||
}
|
||||
plugins: [cssInjectedByJsPlugin()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
name: 'CWDComments',
|
||||
entry: resolve(__dirname, 'src/index.js'),
|
||||
formats: ['umd'],
|
||||
fileName: (format) => `cwd-comments.js`,
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
exports: 'named',
|
||||
},
|
||||
},
|
||||
sourcemap: false,
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user