mirror of https://github.com/halo-dev/halo-admin
Browse Source
* 1.3.0-beta.2 * fix: token expire. * pref: #291 * refactor: use js-sdk/admin-api * chore: remove unnecessary files * chore: remove unnecessary files * chore: remove unnecessary files * chore: remove unnecessary files * refactor: developer/Environment.vue * chore: remove unnecessary files * refactor: login auth * refactor: login auth * refactor: remove api url setting * refactor: custom sheet list * style: reformat code * refactor: logout * refactor: remove setTimeout when fetch api * fix: auto login error * fix: post update error * fix: backup * fix: turn on developer mode error * fix: mfa setting error * chore: remove unnecessary files * feat: add interceptors * refactor: api client * refactor: api client * chore(deps): upgrade admin-api * refactor: 重构认证 * fix: 修复认证请求头参数 * refactor: login * feat: add error handle * refactor: api client * refactor: refresh token * refactor: attachment upload * refactor: upload component * refactor: upload * fix: tag save * fix: github api request * fix: installation page * feat: add version field for html * fix: option.list to option.listAsMapView * fix: directory base path of static storage * chore: upgrade halo sdk version Co-authored-by: guqing <1484563614@qq.com>pull/381/head
Ryan Wang
3 years ago
committed by
GitHub
141 changed files with 2793 additions and 4373 deletions
@ -1,2 +1,3 @@
|
||||
NODE_ENV=development |
||||
PUBLIC_PATH=/ |
||||
VUE_APP_API_URL=http://localhost:8090 |
||||
|
@ -1,2 +1,3 @@
|
||||
NODE_ENV=production |
||||
PUBLIC_PATH=https://cdn.jsdelivr.net/npm/halo-admin@1.4.13/dist/ |
||||
VUE_APP_API_URL=/ |
||||
|
@ -1,84 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/actuator' |
||||
|
||||
const actuatorApi = {} |
||||
|
||||
actuatorApi.logfile = () => { |
||||
return service({ |
||||
url: `${baseUrl}/logfile`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.env = () => { |
||||
return service({ |
||||
url: `${baseUrl}/env`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getSystemCpuCount = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/system.cpu.count`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getSystemCpuUsage = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/system.cpu.usage`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getProcessUptime = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/process.uptime`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getProcessStartTime = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/process.start.time`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getProcessCpuUsage = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/process.cpu.usage`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getJvmMemoryMax = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/jvm.memory.max`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getJvmMemoryCommitted = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/jvm.memory.committed`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getJvmMemoryUsed = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/jvm.memory.used`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
actuatorApi.getJvmGcPause = () => { |
||||
return service({ |
||||
url: `${baseUrl}/metrics/jvm.gc.pause`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default actuatorApi |
@ -1,117 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin' |
||||
|
||||
const adminApi = {} |
||||
|
||||
adminApi.counts = () => { |
||||
return service({ |
||||
url: `${baseUrl}/counts`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
adminApi.isInstalled = () => { |
||||
return service({ |
||||
url: `${baseUrl}/is_installed`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
adminApi.environments = () => { |
||||
return service({ |
||||
url: `${baseUrl}/environments`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
adminApi.install = data => { |
||||
return service({ |
||||
url: `${baseUrl}/installations`, |
||||
data: data, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.loginPreCheck = (username, password) => { |
||||
return service({ |
||||
url: `${baseUrl}/login/precheck`, |
||||
data: { |
||||
username: username, |
||||
password: password |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.login = (username, password, authcode) => { |
||||
return service({ |
||||
url: `${baseUrl}/login`, |
||||
data: { |
||||
username: username, |
||||
password: password, |
||||
authcode: authcode |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.logout = () => { |
||||
return service({ |
||||
url: `${baseUrl}/logout`, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.refreshToken = refreshToken => { |
||||
return service({ |
||||
url: `${baseUrl}/refresh/${refreshToken}`, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.sendResetCode = param => { |
||||
return service({ |
||||
url: `${baseUrl}/password/code`, |
||||
data: param, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
adminApi.resetPassword = param => { |
||||
return service({ |
||||
url: `${baseUrl}/password/reset`, |
||||
data: param, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
adminApi.updateAdminAssets = () => { |
||||
return service({ |
||||
url: `${baseUrl}/halo-admin`, |
||||
method: 'put', |
||||
timeout: 600 * 1000 |
||||
}) |
||||
} |
||||
|
||||
adminApi.getLogFiles = lines => { |
||||
return service({ |
||||
url: `${baseUrl}/halo/logfile`, |
||||
params: { |
||||
lines: lines |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
adminApi.downloadLogFiles = lines => { |
||||
return service({ |
||||
url: `${baseUrl}/halo/logfile/download`, |
||||
params: { |
||||
lines: lines |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default adminApi |
@ -1,127 +0,0 @@
|
||||
import axios from 'axios' |
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/attachments' |
||||
|
||||
const attachmentApi = {} |
||||
|
||||
attachmentApi.query = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.get = attachmentId => { |
||||
return service({ |
||||
url: `${baseUrl}/${attachmentId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.delete = attachmentId => { |
||||
return service({ |
||||
url: `${baseUrl}/${attachmentId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.deleteInBatch = attachmentIds => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
method: 'delete', |
||||
data: attachmentIds, |
||||
headers: { |
||||
'Content-Type': 'application/json;charset=UTF-8' |
||||
} |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.update = (attachmentId, attachment) => { |
||||
return service({ |
||||
url: `${baseUrl}/${attachmentId}`, |
||||
method: 'put', |
||||
data: attachment |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.getMediaTypes = () => { |
||||
return service({ |
||||
url: `${baseUrl}/media_types`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.getTypes = () => { |
||||
return service({ |
||||
url: `${baseUrl}/types`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.CancelToken = axios.CancelToken |
||||
attachmentApi.isCancel = axios.isCancel |
||||
|
||||
attachmentApi.upload = (formData, uploadProgress, cancelToken) => { |
||||
return service({ |
||||
url: `${baseUrl}/upload`, |
||||
timeout: 8640000, // 24 hours
|
||||
data: formData, // form data
|
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.uploads = (formDatas, uploadProgress, cancelToken) => { |
||||
return service({ |
||||
url: `${baseUrl}/uploads`, |
||||
timeout: 8640000, // 24 hours
|
||||
data: formDatas, // form data
|
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
attachmentApi.type = { |
||||
LOCAL: { |
||||
type: 'LOCAL', |
||||
text: '本地' |
||||
}, |
||||
SMMS: { |
||||
type: 'SMMS', |
||||
text: 'SM.MS' |
||||
}, |
||||
UPOSS: { |
||||
type: 'UPOSS', |
||||
text: '又拍云' |
||||
}, |
||||
QINIUOSS: { |
||||
type: 'QINIUOSS', |
||||
text: '七牛云' |
||||
}, |
||||
ALIOSS: { |
||||
type: 'ALIOSS', |
||||
text: '阿里云' |
||||
}, |
||||
BAIDUBOS: { |
||||
type: 'BAIDUBOS', |
||||
text: '百度云' |
||||
}, |
||||
TENCENTCOS: { |
||||
type: 'TENCENTCOS', |
||||
text: '腾讯云' |
||||
}, |
||||
HUAWEIOBS: { |
||||
type: 'HUAWEIOBS', |
||||
text: '华为云' |
||||
}, |
||||
MINIO: { |
||||
type: 'MINIO', |
||||
text: 'MinIO' |
||||
} |
||||
} |
||||
|
||||
export default attachmentApi |
@ -1,125 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/backups' |
||||
|
||||
const backupApi = {} |
||||
|
||||
backupApi.importMarkdown = (formData, uploadProgress, cancelToken) => { |
||||
return service({ |
||||
url: `${baseUrl}/markdown/import`, |
||||
timeout: 8640000, // 24 hours
|
||||
data: formData, // form data
|
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
backupApi.backupWorkDir = options => { |
||||
return service({ |
||||
url: `${baseUrl}/work-dir`, |
||||
method: 'post', |
||||
data: options, |
||||
timeout: 8640000 // 24 hours
|
||||
}) |
||||
} |
||||
|
||||
backupApi.listWorkDirOptions = () => { |
||||
return service({ |
||||
url: `${baseUrl}/work-dir/options`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.listWorkDirBackups = () => { |
||||
return service({ |
||||
url: `${baseUrl}/work-dir`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.fetchWorkDir = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/work-dir/fetch?filename=${filename}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.deleteWorkDirBackup = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/work-dir`, |
||||
params: { |
||||
filename: filename |
||||
}, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
backupApi.exportData = () => { |
||||
return service({ |
||||
url: `${baseUrl}/data`, |
||||
method: 'post', |
||||
timeout: 8640000 // 24 hours
|
||||
}) |
||||
} |
||||
|
||||
backupApi.listExportedData = () => { |
||||
return service({ |
||||
url: `${baseUrl}/data`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.fetchData = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/data/fetch?filename=${filename}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.deleteExportedData = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/data`, |
||||
params: { |
||||
filename: filename |
||||
}, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
backupApi.exportMarkdowns = needFrontMatter => { |
||||
return service({ |
||||
url: `${baseUrl}/markdown/export`, |
||||
method: 'post', |
||||
data: { |
||||
needFrontMatter: needFrontMatter |
||||
}, |
||||
timeout: 8640000 // 24 hours
|
||||
}) |
||||
} |
||||
|
||||
backupApi.listExportedMarkdowns = () => { |
||||
return service({ |
||||
url: `${baseUrl}/markdown/export`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.fetchMarkdown = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/markdown/fetch?filename=${filename}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
backupApi.deleteExportedMarkdown = filename => { |
||||
return service({ |
||||
url: `${baseUrl}/markdown/export`, |
||||
params: { |
||||
filename: filename |
||||
}, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
export default backupApi |
@ -1,85 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/categories' |
||||
|
||||
const categoryApi = {} |
||||
|
||||
categoryApi.listAll = (more = false) => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
params: { |
||||
more: more |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
categoryApi.listTree = () => { |
||||
return service({ |
||||
url: `${baseUrl}/tree_view`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
categoryApi.create = category => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: category, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
categoryApi.delete = categoryId => { |
||||
return service({ |
||||
url: `${baseUrl}/${categoryId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
categoryApi.get = categoryId => { |
||||
return service({ |
||||
url: `${baseUrl}/${categoryId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
categoryApi.update = (categoryId, category) => { |
||||
return service({ |
||||
url: `${baseUrl}/${categoryId}`, |
||||
data: category, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
function concreteTree(parentCategory, categories) { |
||||
categories.forEach(category => { |
||||
if (parentCategory.key === category.parentId) { |
||||
if (!parentCategory.children) { |
||||
parentCategory.children = [] |
||||
} |
||||
parentCategory.children.push({ |
||||
key: category.id, |
||||
title: category.name, |
||||
isLeaf: false |
||||
}) |
||||
} |
||||
}) |
||||
|
||||
if (parentCategory.children) { |
||||
parentCategory.children.forEach(category => concreteTree(category, categories)) |
||||
} else { |
||||
parentCategory.isLeaf = true |
||||
} |
||||
} |
||||
|
||||
categoryApi.concreteTree = categories => { |
||||
const topCategoryNode = { |
||||
key: 0, |
||||
title: 'top', |
||||
children: [] |
||||
} |
||||
concreteTree(topCategoryNode, categories) |
||||
return topCategoryNode.children |
||||
} |
||||
|
||||
export default categoryApi |
@ -1,140 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin' |
||||
|
||||
const commentApi = {} |
||||
|
||||
commentApi.latestComment = (target, top, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/latest`, |
||||
params: { |
||||
top: top, |
||||
status: status |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
commentApi.queryComment = (target, params) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments`, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
commentApi.commentTree = (target, id, params) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/${id}/tree_view`, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
commentApi.updateStatus = (target, commentId, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/${commentId}/status/${status}`, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
commentApi.updateStatusInBatch = (target, ids, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/status/${status}`, |
||||
data: ids, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
commentApi.delete = (target, commentId) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/${commentId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
commentApi.deleteInBatch = (target, ids) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments`, |
||||
data: ids, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
commentApi.create = (target, comment) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments`, |
||||
data: comment, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
commentApi.update = (target, commentId, comment) => { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments/${commentId}`, |
||||
data: comment, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* Creates a comment. |
||||
* @param {String} target |
||||
* @param {Object} comment |
||||
*/ |
||||
function createComment(target, comment) { |
||||
return service({ |
||||
url: `${baseUrl}/${target}/comments`, |
||||
method: 'post', |
||||
data: comment |
||||
}) |
||||
} |
||||
|
||||
// Creation api
|
||||
|
||||
commentApi.createPostComment = comment => { |
||||
return createComment('posts', comment) |
||||
} |
||||
|
||||
commentApi.createSheetComment = comment => { |
||||
return createComment('sheets', comment) |
||||
} |
||||
|
||||
commentApi.createJournalComment = comment => { |
||||
return createComment('journals', comment) |
||||
} |
||||
|
||||
commentApi.createComment = (comment, type) => { |
||||
if (type === 'sheet') { |
||||
return commentApi.createSheetComment(comment) |
||||
} |
||||
|
||||
if (type === 'journal') { |
||||
return commentApi.createJournalComment(comment) |
||||
} |
||||
|
||||
return commentApi.createPostComment(comment) |
||||
} |
||||
|
||||
commentApi.commentStatus = { |
||||
PUBLISHED: { |
||||
value: 'PUBLISHED', |
||||
color: 'green', |
||||
status: 'success', |
||||
text: '已发布' |
||||
}, |
||||
AUDITING: { |
||||
value: 'AUDITING', |
||||
color: 'yellow', |
||||
status: 'warning', |
||||
text: '待审核' |
||||
}, |
||||
RECYCLE: { |
||||
value: 'RECYCLE', |
||||
color: 'red', |
||||
status: 'error', |
||||
text: '回收站' |
||||
} |
||||
} |
||||
|
||||
export default commentApi |
@ -1,54 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/journals' |
||||
|
||||
const journalApi = {} |
||||
|
||||
journalApi.query = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
journalApi.create = journal => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: journal, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
journalApi.update = (journalId, journal) => { |
||||
return service({ |
||||
url: `${baseUrl}/${journalId}`, |
||||
data: journal, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
journalApi.delete = journalId => { |
||||
return service({ |
||||
url: `${baseUrl}/${journalId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
journalApi.commentTree = journalId => { |
||||
return service({ |
||||
url: `${baseUrl}/${journalId}/comments/tree_view`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
journalApi.journalType = { |
||||
PUBLIC: { |
||||
text: '公开' |
||||
}, |
||||
INTIMATE: { |
||||
text: '私密' |
||||
} |
||||
} |
||||
|
||||
export default journalApi |
@ -1,22 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/journals/comments' |
||||
|
||||
const journalCommentApi = {} |
||||
|
||||
journalCommentApi.create = comment => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: comment, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
journalCommentApi.delete = commentId => { |
||||
return service({ |
||||
url: `${baseUrl}/${commentId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
export default journalCommentApi |
@ -1,61 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/links' |
||||
|
||||
const linkApi = {} |
||||
|
||||
linkApi.listAll = () => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
linkApi.create = link => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: link, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
linkApi.get = linkId => { |
||||
return service({ |
||||
url: `${baseUrl}/${linkId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
linkApi.getByParse = url => { |
||||
return service({ |
||||
url: `${baseUrl}/parse`, |
||||
params: { |
||||
url: url |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
linkApi.update = (linkId, link) => { |
||||
return service({ |
||||
url: `${baseUrl}/${linkId}`, |
||||
data: link, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
linkApi.delete = linkId => { |
||||
return service({ |
||||
url: `${baseUrl}/${linkId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
linkApi.listTeams = () => { |
||||
return service({ |
||||
url: `${baseUrl}/teams`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default linkApi |
@ -1,91 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/logs' |
||||
|
||||
const logApi = {} |
||||
|
||||
logApi.listLatest = top => { |
||||
return service({ |
||||
url: `${baseUrl}/latest`, |
||||
params: { |
||||
top: top |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
logApi.pageBy = logPagination => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: logPagination, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
logApi.clear = () => { |
||||
return service({ |
||||
url: `${baseUrl}/clear`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
logApi.logTypes = { |
||||
BLOG_INITIALIZED: { |
||||
value: 0, |
||||
text: '博客初始化' |
||||
}, |
||||
POST_PUBLISHED: { |
||||
value: 5, |
||||
text: '文章发布' |
||||
}, |
||||
POST_EDITED: { |
||||
value: 15, |
||||
text: '文章修改' |
||||
}, |
||||
POST_DELETED: { |
||||
value: 20, |
||||
text: '文章删除' |
||||
}, |
||||
LOGGED_IN: { |
||||
value: 25, |
||||
text: '用户登录' |
||||
}, |
||||
LOGGED_OUT: { |
||||
value: 30, |
||||
text: '注销登录' |
||||
}, |
||||
LOGIN_FAILED: { |
||||
value: 35, |
||||
text: '登录失败' |
||||
}, |
||||
PASSWORD_UPDATED: { |
||||
value: 40, |
||||
text: '修改密码' |
||||
}, |
||||
PROFILE_UPDATED: { |
||||
value: 45, |
||||
text: '资料修改' |
||||
}, |
||||
SHEET_PUBLISHED: { |
||||
value: 50, |
||||
text: '页面发布' |
||||
}, |
||||
SHEET_EDITED: { |
||||
value: 55, |
||||
text: '页面修改' |
||||
}, |
||||
SHEET_DELETED: { |
||||
value: 60, |
||||
text: '页面删除' |
||||
}, |
||||
MFA_UPDATED: { |
||||
value: 65, |
||||
text: '两步验证' |
||||
}, |
||||
LOGGED_PRE_CHECK: { |
||||
value: 70, |
||||
text: '登录验证' |
||||
} |
||||
} |
||||
|
||||
export default logApi |
@ -1,15 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/mails' |
||||
|
||||
const mailApi = {} |
||||
|
||||
mailApi.testMail = mailData => { |
||||
return service({ |
||||
url: `${baseUrl}/test`, |
||||
method: 'post', |
||||
data: mailData |
||||
}) |
||||
} |
||||
|
||||
export default mailApi |
@ -1,92 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/menus' |
||||
|
||||
const menuApi = {} |
||||
|
||||
menuApi.listAll = () => { |
||||
return service({ |
||||
url: baseUrl, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
menuApi.listTree = () => { |
||||
return service({ |
||||
url: `${baseUrl}/tree_view`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
menuApi.listTreeByTeam = team => { |
||||
return service({ |
||||
url: `${baseUrl}/team/tree_view`, |
||||
params: { |
||||
team: team |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
menuApi.create = menu => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: menu, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
menuApi.createBatch = menus => { |
||||
return service({ |
||||
url: `${baseUrl}/batch`, |
||||
data: menus, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
menuApi.updateBatch = menus => { |
||||
return service({ |
||||
url: `${baseUrl}/batch`, |
||||
data: menus, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
menuApi.delete = menuId => { |
||||
return service({ |
||||
url: `${baseUrl}/${menuId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
menuApi.deleteBatch = menuIds => { |
||||
return service({ |
||||
url: `${baseUrl}/batch`, |
||||
data: menuIds, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
menuApi.get = menuId => { |
||||
return service({ |
||||
url: `${baseUrl}/${menuId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
menuApi.update = (menuId, menu) => { |
||||
return service({ |
||||
url: `${baseUrl}/${menuId}`, |
||||
data: menu, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
menuApi.listTeams = () => { |
||||
return service({ |
||||
url: `${baseUrl}/teams`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default menuApi |
@ -1,15 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/migrations' |
||||
|
||||
const migrateApi = {} |
||||
|
||||
migrateApi.migrate = formData => { |
||||
return service({ |
||||
url: `${baseUrl}/halo`, |
||||
data: formData, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
export default migrateApi |
@ -1,79 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/options' |
||||
|
||||
const optionApi = {} |
||||
|
||||
optionApi.listAll = () => { |
||||
return service({ |
||||
url: `${baseUrl}/map_view`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
optionApi.listAllByKeys = keys => { |
||||
return service({ |
||||
url: `${baseUrl}/map_view/keys`, |
||||
data: keys, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
optionApi.query = params => { |
||||
return service({ |
||||
url: `${baseUrl}/list_view`, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
optionApi.save = options => { |
||||
return service({ |
||||
url: `${baseUrl}/map_view/saving`, |
||||
method: 'post', |
||||
data: options |
||||
}) |
||||
} |
||||
|
||||
optionApi.create = option => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: option, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
optionApi.delete = optionId => { |
||||
return service({ |
||||
url: `${baseUrl}/${optionId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
optionApi.get = optionId => { |
||||
return service({ |
||||
url: `${baseUrl}/${optionId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
optionApi.update = (optionId, option) => { |
||||
return service({ |
||||
url: `${baseUrl}/${optionId}`, |
||||
data: option, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
optionApi.type = { |
||||
INTERNAL: { |
||||
value: 'INTERNAL', |
||||
text: '系统' |
||||
}, |
||||
CUSTOM: { |
||||
value: 'CUSTOM', |
||||
text: '自定义' |
||||
} |
||||
} |
||||
|
||||
export default optionApi |
@ -1,45 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/photos' |
||||
|
||||
const photoApi = {} |
||||
|
||||
photoApi.query = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
photoApi.create = photo => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: photo, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
photoApi.update = (photoId, photo) => { |
||||
return service({ |
||||
url: `${baseUrl}/${photoId}`, |
||||
method: 'put', |
||||
data: photo |
||||
}) |
||||
} |
||||
|
||||
photoApi.delete = photoId => { |
||||
return service({ |
||||
url: `${baseUrl}/${photoId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
photoApi.listTeams = () => { |
||||
return service({ |
||||
url: `${baseUrl}/teams`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default photoApi |
@ -1,154 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/posts' |
||||
|
||||
const postApi = {} |
||||
|
||||
postApi.listLatest = top => { |
||||
return service({ |
||||
url: `${baseUrl}/latest`, |
||||
params: { |
||||
top: top |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postApi.query = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postApi.get = postId => { |
||||
return service({ |
||||
url: `${baseUrl}/${postId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postApi.create = (postToCreate, autoSave) => { |
||||
return service({ |
||||
url: baseUrl, |
||||
method: 'post', |
||||
data: postToCreate, |
||||
params: { |
||||
autoSave: autoSave |
||||
} |
||||
}) |
||||
} |
||||
|
||||
postApi.update = (postId, postToUpdate, autoSave) => { |
||||
return service({ |
||||
url: `${baseUrl}/${postId}`, |
||||
method: 'put', |
||||
data: postToUpdate, |
||||
params: { |
||||
autoSave: autoSave |
||||
} |
||||
}) |
||||
} |
||||
|
||||
postApi.updateDraft = (postId, content) => { |
||||
return service({ |
||||
url: `${baseUrl}/${postId}/status/draft/content`, |
||||
method: 'put', |
||||
data: { |
||||
content: content |
||||
} |
||||
}) |
||||
} |
||||
|
||||
postApi.updateStatus = (postId, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${postId}/status/${status}`, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
postApi.updateStatusInBatch = (ids, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/status/${status}`, |
||||
data: ids, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
postApi.delete = postId => { |
||||
return service({ |
||||
url: `${baseUrl}/${postId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
postApi.deleteInBatch = ids => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
data: ids, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
postApi.preview = postId => { |
||||
return service({ |
||||
url: `${baseUrl}/preview/${postId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postApi.postStatus = { |
||||
PUBLISHED: { |
||||
value: 'PUBLISHED', |
||||
color: 'green', |
||||
status: 'success', |
||||
text: '已发布' |
||||
}, |
||||
DRAFT: { |
||||
value: 'DRAFT', |
||||
color: 'yellow', |
||||
status: 'warning', |
||||
text: '草稿' |
||||
}, |
||||
RECYCLE: { |
||||
value: 'RECYCLE', |
||||
color: 'red', |
||||
status: 'error', |
||||
text: '回收站' |
||||
}, |
||||
INTIMATE: { |
||||
value: 'INTIMATE', |
||||
color: 'blue', |
||||
status: 'success', |
||||
text: '私密' |
||||
} |
||||
} |
||||
|
||||
postApi.permalinkType = { |
||||
DEFAULT: { |
||||
type: 'DEFAULT', |
||||
text: '默认' |
||||
}, |
||||
YEAR: { |
||||
type: 'YEAR', |
||||
text: '年份型' |
||||
}, |
||||
DATE: { |
||||
type: 'DATE', |
||||
text: '年月型' |
||||
}, |
||||
DAY: { |
||||
type: 'DAY', |
||||
text: '年月日型' |
||||
}, |
||||
ID: { |
||||
type: 'ID', |
||||
text: 'ID 型' |
||||
}, |
||||
ID_SLUG: { |
||||
type: 'ID_SLUG', |
||||
text: 'ID 别名型' |
||||
} |
||||
} |
||||
export default postApi |
@ -1,66 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/posts/comments' |
||||
|
||||
const postCommentApi = {} |
||||
|
||||
postCommentApi.listLatest = (top, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/latest`, |
||||
params: { |
||||
top: top, |
||||
status: status |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postCommentApi.query = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
postCommentApi.updateStatus = (commentId, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${commentId}/status/${status}`, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
postCommentApi.delete = commentId => { |
||||
return service({ |
||||
url: `${baseUrl}/${commentId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
postCommentApi.create = comment => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: comment, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
postCommentApi.commentStatus = { |
||||
PUBLISHED: { |
||||
color: 'green', |
||||
status: 'success', |
||||
text: '已发布' |
||||
}, |
||||
AUDITING: { |
||||
color: 'yellow', |
||||
status: 'warning', |
||||
text: '待审核' |
||||
}, |
||||
RECYCLE: { |
||||
color: 'red', |
||||
status: 'error', |
||||
text: '回收站' |
||||
} |
||||
} |
||||
|
||||
export default postCommentApi |
@ -1,110 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/sheets' |
||||
|
||||
const sheetApi = {} |
||||
|
||||
sheetApi.list = params => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: params, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.listIndependent = () => { |
||||
return service({ |
||||
url: `${baseUrl}/independent`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.get = sheetId => { |
||||
return service({ |
||||
url: `${baseUrl}/${sheetId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.create = (sheetToCreate, autoSave) => { |
||||
return service({ |
||||
url: baseUrl, |
||||
method: 'post', |
||||
data: sheetToCreate, |
||||
params: { |
||||
autoSave: autoSave |
||||
} |
||||
}) |
||||
} |
||||
|
||||
sheetApi.update = (sheetId, sheetToUpdate, autoSave) => { |
||||
return service({ |
||||
url: `${baseUrl}/${sheetId}`, |
||||
method: 'put', |
||||
data: sheetToUpdate, |
||||
params: { |
||||
autoSave: autoSave |
||||
} |
||||
}) |
||||
} |
||||
|
||||
sheetApi.updateDraft = (sheetId, content) => { |
||||
return service({ |
||||
url: `${baseUrl}/${sheetId}/status/draft/content`, |
||||
method: 'put', |
||||
data: { |
||||
content: content |
||||
} |
||||
}) |
||||
} |
||||
|
||||
sheetApi.updateStatus = (sheetId, status) => { |
||||
return service({ |
||||
url: `${baseUrl}/${sheetId}/${status}`, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.delete = sheetId => { |
||||
return service({ |
||||
url: `${baseUrl}/${sheetId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.preview = sheetId => { |
||||
return service({ |
||||
url: `${baseUrl}/preview/${sheetId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
sheetApi.sheetStatus = { |
||||
PUBLISHED: { |
||||
color: 'green', |
||||
status: 'success', |
||||
text: '已发布' |
||||
}, |
||||
DRAFT: { |
||||
color: 'yellow', |
||||
status: 'warning', |
||||
text: '草稿' |
||||
}, |
||||
RECYCLE: { |
||||
color: 'red', |
||||
status: 'error', |
||||
text: '回收站' |
||||
} |
||||
} |
||||
|
||||
sheetApi.permalinkType = { |
||||
SECONDARY: { |
||||
type: 'SECONDARY', |
||||
text: '二级路径' |
||||
}, |
||||
ROOT: { |
||||
type: 'ROOT', |
||||
text: '根路径' |
||||
} |
||||
} |
||||
export default sheetApi |
@ -1,78 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/statics' |
||||
|
||||
const staticApi = {} |
||||
|
||||
staticApi.list = () => { |
||||
return service({ |
||||
url: baseUrl, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
staticApi.delete = path => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: { |
||||
path: path |
||||
}, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
staticApi.createFolder = (basePath, folderName) => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: { |
||||
basePath: basePath, |
||||
folderName: folderName |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
staticApi.upload = (formData, uploadProgress, cancelToken, basePath) => { |
||||
return service({ |
||||
url: `${baseUrl}/upload`, |
||||
timeout: 8640000, |
||||
data: formData, |
||||
params: { |
||||
basePath: basePath |
||||
}, |
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
staticApi.rename = (basePath, newName) => { |
||||
return service({ |
||||
url: `${baseUrl}/rename`, |
||||
params: { |
||||
basePath: basePath, |
||||
newName: newName |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
staticApi.getContent = url => { |
||||
return service({ |
||||
url: `${url}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
staticApi.save = (path, content) => { |
||||
return service({ |
||||
url: `${baseUrl}/files`, |
||||
data: { |
||||
path: path, |
||||
content: content |
||||
}, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
export default staticApi |
@ -1,21 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/statistics' |
||||
|
||||
const statisticsApi = {} |
||||
|
||||
statisticsApi.statistics = () => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
statisticsApi.statisticsWithUser = () => { |
||||
return service({ |
||||
url: `${baseUrl}/user`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
export default statisticsApi |
@ -1,50 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/tags' |
||||
|
||||
const tagApi = {} |
||||
|
||||
tagApi.listAll = (more = false) => { |
||||
return service({ |
||||
url: baseUrl, |
||||
params: { |
||||
more: more |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
tagApi.createWithName = name => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: { |
||||
name: name |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
tagApi.create = tag => { |
||||
return service({ |
||||
url: baseUrl, |
||||
data: tag, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
tagApi.update = (tagId, tag) => { |
||||
return service({ |
||||
url: `${baseUrl}/${tagId}`, |
||||
data: tag, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
tagApi.delete = tagId => { |
||||
return service({ |
||||
url: `${baseUrl}/${tagId}`, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
export default tagApi |
@ -1,195 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/themes' |
||||
|
||||
const themeApi = {} |
||||
|
||||
themeApi.list = () => { |
||||
return service({ |
||||
url: `${baseUrl}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.listFilesActivated = () => { |
||||
return service({ |
||||
url: `${baseUrl}/activation/files`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.listFiles = themeId => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/files`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.customSheetTpls = () => { |
||||
return service({ |
||||
url: `${baseUrl}/activation/template/custom/sheet`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.customPostTpls = () => { |
||||
return service({ |
||||
url: `${baseUrl}/activation/template/custom/post`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.active = theme => { |
||||
return service({ |
||||
url: `${baseUrl}/${theme}/activation`, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
themeApi.getActivatedTheme = () => { |
||||
return service({ |
||||
url: `${baseUrl}/activation`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.update = themeId => { |
||||
return service({ |
||||
url: `${baseUrl}/fetching/${themeId}`, |
||||
timeout: 60000, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
themeApi.delete = (key, deleteSettings) => { |
||||
return service({ |
||||
url: `${baseUrl}/${key}`, |
||||
params: { |
||||
deleteSettings: deleteSettings |
||||
}, |
||||
method: 'delete' |
||||
}) |
||||
} |
||||
|
||||
themeApi.fetchConfiguration = themeId => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/configurations`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.fetchSettings = themeId => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/settings`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.saveSettings = (themeId, settings) => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/settings`, |
||||
data: settings, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
themeApi.getProperty = themeId => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.upload = (formData, uploadProgress, cancelToken) => { |
||||
return service({ |
||||
url: `${baseUrl}/upload`, |
||||
timeout: 86400000, // 24 hours
|
||||
data: formData, // form data
|
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
themeApi.updateByUpload = (formData, uploadProgress, cancelToken, themeId) => { |
||||
return service({ |
||||
url: `${baseUrl}/upload/${themeId}`, |
||||
timeout: 86400000, // 24 hours
|
||||
data: formData, // form data
|
||||
onUploadProgress: uploadProgress, |
||||
cancelToken: cancelToken, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
themeApi.fetching = url => { |
||||
return service({ |
||||
url: `${baseUrl}/fetching`, |
||||
timeout: 60000, |
||||
params: { |
||||
uri: url |
||||
}, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
themeApi.getContent = path => { |
||||
return service({ |
||||
url: `${baseUrl}/files/content`, |
||||
params: { |
||||
path: path |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.getContent = (themeId, path) => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/files/content`, |
||||
params: { |
||||
path: path |
||||
}, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
themeApi.saveContent = (path, content) => { |
||||
return service({ |
||||
url: `${baseUrl}/files/content`, |
||||
data: { |
||||
path: path, |
||||
content: content |
||||
}, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
themeApi.saveContent = (themeId, path, content) => { |
||||
return service({ |
||||
url: `${baseUrl}/${themeId}/files/content`, |
||||
data: { |
||||
path: path, |
||||
content: content |
||||
}, |
||||
method: 'put' |
||||
}) |
||||
} |
||||
|
||||
themeApi.reload = () => { |
||||
return service({ |
||||
url: `${baseUrl}/reload`, |
||||
method: 'post' |
||||
}) |
||||
} |
||||
|
||||
themeApi.exists = template => { |
||||
return service({ |
||||
url: `${baseUrl}/activation/template/exists`, |
||||
method: 'get', |
||||
params: { |
||||
template: template |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export default themeApi |
@ -1,65 +0,0 @@
|
||||
import service from '@/utils/service' |
||||
|
||||
const baseUrl = '/api/admin/users' |
||||
|
||||
const userApi = {} |
||||
|
||||
userApi.getProfile = () => { |
||||
return service({ |
||||
url: `${baseUrl}/profiles`, |
||||
method: 'get' |
||||
}) |
||||
} |
||||
|
||||
userApi.updateProfile = profile => { |
||||
return service({ |
||||
url: `${baseUrl}/profiles`, |
||||
method: 'put', |
||||
data: profile |
||||
}) |
||||
} |
||||
|
||||
userApi.updatePassword = (oldPassword, newPassword) => { |
||||
return service({ |
||||
url: `${baseUrl}/profiles/password`, |
||||
method: 'put', |
||||
data: { |
||||
oldPassword: oldPassword, |
||||
newPassword: newPassword |
||||
} |
||||
}) |
||||
} |
||||
|
||||
userApi.mfaGenerate = mfaType => { |
||||
return service({ |
||||
url: `${baseUrl}/mfa/generate`, |
||||
method: 'put', |
||||
data: { |
||||
mfaType: mfaType |
||||
} |
||||
}) |
||||
} |
||||
|
||||
userApi.mfaUpdate = (mfaType, mfaKey, authcode) => { |
||||
return service({ |
||||
url: `${baseUrl}/mfa/update`, |
||||
method: 'put', |
||||
data: { |
||||
mfaType: mfaType, |
||||
mfaKey: mfaKey, |
||||
authcode: authcode |
||||
} |
||||
}) |
||||
} |
||||
|
||||
userApi.mfaCheck = authcode => { |
||||
return service({ |
||||
url: `${baseUrl}/mfa/check`, |
||||
method: 'put', |
||||
data: { |
||||
authcode: authcode |
||||
} |
||||
}) |
||||
} |
||||
|
||||
export default userApi |
@ -0,0 +1,39 @@
|
||||
<template> |
||||
<a-modal v-model="modalVisible" :afterClose="onClose" :footer="null" destroyOnClose title="上传附件"> |
||||
<FilePondUpload ref="upload" :uploadHandler="uploadHandler"></FilePondUpload> |
||||
</a-modal> |
||||
</template> |
||||
<script> |
||||
import apiClient from '@/utils/api-client' |
||||
|
||||
export default { |
||||
name: 'AttachmentUploadModal', |
||||
props: { |
||||
visible: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
uploadHandler: (file, options) => apiClient.attachment.upload(file, options) |
||||
} |
||||
}, |
||||
computed: { |
||||
modalVisible: { |
||||
get() { |
||||
return this.visible |
||||
}, |
||||
set(value) { |
||||
this.$emit('update:visible', value) |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
onClose() { |
||||
this.$refs.upload.handleClearFileList() |
||||
this.$emit('close') |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -1,2 +1,3 @@
|
||||
import GlobalFooter from './GlobalFooter' |
||||
|
||||
export default GlobalFooter |
||||
|
@ -1,2 +1,3 @@
|
||||
import GlobalHeader from './GlobalHeader' |
||||
|
||||
export default GlobalHeader |
||||
|
@ -1,2 +1,3 @@
|
||||
import SMenu from './menu' |
||||
|
||||
export default SMenu |
||||
|
@ -1,2 +1,3 @@
|
||||
import SettingDrawer from './SettingDrawer' |
||||
|
||||
export default SettingDrawer |
||||
|
@ -1,33 +0,0 @@
|
||||
/** |
||||
* 获取字符串长度,英文字符 长度1,中文字符长度2 |
||||
* @param {*} str |
||||
*/ |
||||
export const getStrFullLength = (str = '') => |
||||
str.split('').reduce((pre, cur) => { |
||||
const charCode = cur.charCodeAt(0) |
||||
if (charCode >= 0 && charCode <= 128) { |
||||
return pre + 1 |
||||
} |
||||
return pre + 2 |
||||
}, 0) |
||||
|
||||
/** |
||||
* 截取字符串,根据 maxLength 截取后返回 |
||||
* @param {*} str |
||||
* @param {*} maxLength |
||||
*/ |
||||
export const cutStrByFullLength = (str = '', maxLength) => { |
||||
let showLength = 0 |
||||
return str.split('').reduce((pre, cur) => { |
||||
const charCode = cur.charCodeAt(0) |
||||
if (charCode >= 0 && charCode <= 128) { |
||||
showLength += 1 |
||||
} else { |
||||
showLength += 2 |
||||
} |
||||
if (showLength <= maxLength) { |
||||
return pre + cur |
||||
} |
||||
return pre |
||||
}, '') |
||||
} |
@ -1,60 +0,0 @@
|
||||
import { asyncRouterMap, constantRouterMap } from '@/config/router.config' |
||||
|
||||
/** |
||||
* 过滤账户是否拥有某一个权限,并将菜单从加载列表移除 |
||||
* |
||||
* @param permission |
||||
* @param route |
||||
* @returns {boolean} |
||||
*/ |
||||
function hasPermission(permission, route) { |
||||
if (route.meta && route.meta.permission) { |
||||
let flag = false |
||||
for (let i = 0, len = permission.length; i < len; i++) { |
||||
flag = route.meta.permission.includes(permission[i]) |
||||
if (flag) { |
||||
return true |
||||
} |
||||
} |
||||
return false |
||||
} |
||||
return true |
||||
} |
||||
|
||||
function filterAsyncRouter(routerMap, roles) { |
||||
const accessedRouters = routerMap.filter(route => { |
||||
if (hasPermission(roles.permissionList, route)) { |
||||
if (route.children && route.children.length) { |
||||
route.children = filterAsyncRouter(route.children, roles) |
||||
} |
||||
return true |
||||
} |
||||
return false |
||||
}) |
||||
return accessedRouters |
||||
} |
||||
|
||||
const permission = { |
||||
state: { |
||||
routers: constantRouterMap, |
||||
addRouters: [] |
||||
}, |
||||
mutations: { |
||||
SET_ROUTERS: (state, routers) => { |
||||
state.addRouters = routers |
||||
state.routers = constantRouterMap.concat(routers) |
||||
} |
||||
}, |
||||
actions: { |
||||
GenerateRoutes({ commit }, data) { |
||||
return new Promise(resolve => { |
||||
const { roles } = data |
||||
const accessedRouters = filterAsyncRouter(asyncRouterMap, roles) |
||||
commit('SET_ROUTERS', accessedRouters) |
||||
resolve() |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
|
||||
export default permission |
@ -0,0 +1,117 @@
|
||||
import { AdminApiClient, Axios, HaloRestAPIClient } from '@halo-dev/admin-api' |
||||
import store from '@/store' |
||||
import { message, notification } from 'ant-design-vue' |
||||
import { isObject } from './util' |
||||
|
||||
const apiUrl = process.env.VUE_APP_API_URL ? process.env.VUE_APP_API_URL : 'http://localhost:8080' |
||||
|
||||
const haloRestApiClient = new HaloRestAPIClient({ |
||||
baseUrl: apiUrl |
||||
}) |
||||
|
||||
const apiClient = new AdminApiClient(haloRestApiClient) |
||||
|
||||
haloRestApiClient.interceptors.request.use( |
||||
config => { |
||||
const token = store.getters.token |
||||
if (token && token.access_token) { |
||||
config.headers['Admin-Authorization'] = token.access_token |
||||
} |
||||
return config |
||||
}, |
||||
error => { |
||||
console.log('request error', error) |
||||
return Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
let isRefreshingToken = false |
||||
let pendingRequests = [] |
||||
|
||||
haloRestApiClient.interceptors.response.use( |
||||
response => { |
||||
return response |
||||
}, |
||||
async error => { |
||||
if (Axios.isCancel(error)) { |
||||
return Promise.reject(error) |
||||
} |
||||
|
||||
if (/Network Error/.test(error.message)) { |
||||
message.error('网络错误,请检查网络连接') |
||||
return Promise.reject(error) |
||||
} |
||||
|
||||
const token = store.getters.token |
||||
const originalRequest = error.config |
||||
|
||||
const response = error.response |
||||
|
||||
const data = response ? response.data : null |
||||
|
||||
if (data) { |
||||
if (data.status === 400) { |
||||
const params = data.data |
||||
|
||||
if (isObject(params)) { |
||||
const paramMessages = Object.keys(params || {}).map(key => params[key]) |
||||
notification.error({ |
||||
message: data.message, |
||||
description: h => { |
||||
const errorNodes = paramMessages.map(errorDetail => { |
||||
return h('a-alert', { |
||||
props: { |
||||
message: errorDetail, |
||||
banner: true, |
||||
showIcon: false, |
||||
type: 'error' |
||||
} |
||||
}) |
||||
}) |
||||
return h('div', errorNodes) |
||||
}, |
||||
duration: 10 |
||||
}) |
||||
} else { |
||||
message.error(data.message) |
||||
} |
||||
|
||||
return Promise.reject(error) |
||||
} |
||||
if (data.status === 401) { |
||||
if (!isRefreshingToken) { |
||||
isRefreshingToken = true |
||||
try { |
||||
await store.dispatch('refreshToken', token.refresh_token) |
||||
|
||||
pendingRequests.forEach(callback => callback()) |
||||
pendingRequests = [] |
||||
|
||||
return Axios(originalRequest) |
||||
} catch (e) { |
||||
message.warning('当前登录状态已失效,请重新登录') |
||||
await store.dispatch('ToggleLoginModal', true) |
||||
return Promise.reject(e) |
||||
} finally { |
||||
isRefreshingToken = false |
||||
} |
||||
} else { |
||||
return new Promise(resolve => { |
||||
pendingRequests.push(() => { |
||||
resolve(Axios(originalRequest)) |
||||
}) |
||||
}) |
||||
} |
||||
} |
||||
message.error(data.message || '服务器错误') |
||||
return Promise.reject(error) |
||||
} |
||||
|
||||
message.error('网络异常') |
||||
return Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
export default apiClient |
||||
|
||||
export { haloRestApiClient } |
@ -0,0 +1,20 @@
|
||||
import CryptoJS from 'crypto-js' |
||||
|
||||
const CRYPTO_KEY = 'halo-crypt' |
||||
|
||||
export default { |
||||
encrypt(plaintObject) { |
||||
if (!plaintObject) { |
||||
return undefined |
||||
} |
||||
return CryptoJS.AES.encrypt(JSON.stringify(plaintObject), CRYPTO_KEY).toString() |
||||
}, |
||||
|
||||
decrypt(ciphertext) { |
||||
if (!ciphertext) { |
||||
return undefined |
||||
} |
||||
const bytes = CryptoJS.AES.decrypt(ciphertext, CRYPTO_KEY) |
||||
return JSON.parse(bytes.toString(CryptoJS.enc.Utf8)) |
||||
} |
||||
} |
@ -1,145 +0,0 @@
|
||||
import axios from 'axios' |
||||
import Vue from 'vue' |
||||
import { message, notification } from 'ant-design-vue' |
||||
import store from '@/store' |
||||
import { isObject } from './util' |
||||
|
||||
const service = axios.create({ |
||||
timeout: 10000, |
||||
withCredentials: true |
||||
}) |
||||
|
||||
function setTokenToHeader(config) { |
||||
// set token
|
||||
const token = store.getters.token |
||||
Vue.$log.debug('Got token from store', token) |
||||
if (token && token.access_token) { |
||||
config.headers['Admin-Authorization'] = token.access_token |
||||
} |
||||
} |
||||
|
||||
async function reRequest(error) { |
||||
const config = error.response.config |
||||
setTokenToHeader(config) |
||||
return await axios.request(config) |
||||
} |
||||
|
||||
let refreshTask = null |
||||
|
||||
async function refreshToken(error) { |
||||
const refreshToken = store.getters.token.refresh_token |
||||
try { |
||||
if (refreshTask === null) { |
||||
refreshTask = store.dispatch('refreshToken', refreshToken) |
||||
} |
||||
|
||||
await refreshTask |
||||
} catch (err) { |
||||
if (err.response && err.response.data && err.response.data.data === refreshToken) { |
||||
message.warning('当前登录状态已失效,请重新登录') |
||||
store.dispatch('ToggleLoginModal', true) |
||||
} |
||||
Vue.$log.error('Failed to refresh token', err) |
||||
} finally { |
||||
refreshTask = null |
||||
} |
||||
// Rerequest the request
|
||||
return reRequest(error) |
||||
} |
||||
|
||||
function getFieldValidationError(data) { |
||||
if (!isObject(data) || !isObject(data.data)) { |
||||
return null |
||||
} |
||||
|
||||
const errorDetail = data.data |
||||
|
||||
return Object.keys(errorDetail).map(key => errorDetail[key]) |
||||
} |
||||
|
||||
service.interceptors.request.use( |
||||
config => { |
||||
config.baseURL = store.getters.apiUrl |
||||
setTokenToHeader(config) |
||||
return config |
||||
}, |
||||
error => { |
||||
return Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
service.interceptors.response.use( |
||||
response => { |
||||
return response |
||||
}, |
||||
error => { |
||||
if (axios.isCancel(error)) { |
||||
Vue.$log.debug('Cancelled uploading by user.') |
||||
return Promise.reject(error) |
||||
} |
||||
|
||||
Vue.$log.error('Response failed', error) |
||||
|
||||
const response = error.response |
||||
const status = response ? response.status : -1 |
||||
Vue.$log.error('Server response status', status) |
||||
|
||||
const data = response ? response.data : null |
||||
if (data) { |
||||
let handled = false |
||||
// Business response
|
||||
Vue.$log.error('Business response status', data.status) |
||||
if (data.status === 400) { |
||||
const errorDetails = getFieldValidationError(data) |
||||
if (errorDetails) { |
||||
handled = true |
||||
|
||||
notification.error({ |
||||
message: data.message, |
||||
description: h => { |
||||
const errorNodes = errorDetails.map(errorDetail => { |
||||
return h('a-alert', { |
||||
props: { |
||||
message: errorDetail, |
||||
banner: true, |
||||
showIcon: false, |
||||
type: 'error' |
||||
} |
||||
}) |
||||
}) |
||||
return h('div', errorNodes) |
||||
}, |
||||
duration: 10 |
||||
}) |
||||
} |
||||
} else if (data.status === 401) { |
||||
if (store.getters.token && store.getters.token.access_token === data.data) { |
||||
const res = refreshToken(error) |
||||
if (res !== error) { |
||||
return res |
||||
} |
||||
} else { |
||||
// Login
|
||||
message.warning('当前登录状态已失效,请重新登录') |
||||
store.dispatch('ToggleLoginModal', true) |
||||
} |
||||
} else if (data.status === 403) { |
||||
// TODO handle 403 status error
|
||||
} else if (data.status === 404) { |
||||
// TODO handle 404 status error
|
||||
} else if (data.status === 500) { |
||||
// TODO handle 500 status error
|
||||
} |
||||
|
||||
if (!handled) { |
||||
message.error(data.message) |
||||
} |
||||
} else { |
||||
message.error('网络异常') |
||||
} |
||||
|
||||
return Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
export default service |
@ -1,131 +0,0 @@
|
||||
<template> |
||||
<a-drawer |
||||
title="评论详情" |
||||
:width="isMobile() ? '100%' : '480'" |
||||
closable |
||||
:visible="visible" |
||||
destroyOnClose |
||||
@close="onClose" |
||||
> |
||||
<a-row type="flex" align="middle"> |
||||
<a-col :span="24"> |
||||
<a-list itemLayout="horizontal"> |
||||
<a-list-item> |
||||
<a-list-item-meta :description="comment.author"> |
||||
<span slot="title">评论者昵称:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta :description="comment.email"> |
||||
<span slot="title">评论者邮箱:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta :description="comment.ipAddress"> |
||||
<span slot="title">评论者 IP:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta> |
||||
<a slot="description" target="_blank" :href="comment.authorUrl">{{ comment.authorUrl }}</a> |
||||
<span slot="title">评论者网址:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta> |
||||
<span slot="description"> |
||||
<a-badge :status="comment.statusProperty.status" :text="comment.statusProperty.text" /> |
||||
</span> |
||||
<span slot="title">评论状态:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta> |
||||
<a slot="description" target="_blank" :href="comment.post.fullPath" v-if="this.type == 'posts'">{{ |
||||
comment.post.title |
||||
}}</a> |
||||
<a slot="description" target="_blank" :href="comment.sheet.fullPath" v-else-if="this.type == 'sheets'">{{ |
||||
comment.sheet.title |
||||
}}</a> |
||||
<span slot="title" v-if="this.type == 'posts'">评论文章:</span> |
||||
<span slot="title" v-else-if="this.type == 'sheets'">评论页面:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
<a-list-item> |
||||
<a-list-item-meta> |
||||
<template slot="description" v-if="editable"> |
||||
<a-input type="textarea" :autoSize="{ minRows: 5 }" v-model="comment.content" /> |
||||
</template> |
||||
<span slot="description" v-html="comment.content" v-else></span> |
||||
<span slot="title">评论内容:</span> |
||||
</a-list-item-meta> |
||||
</a-list-item> |
||||
</a-list> |
||||
</a-col> |
||||
</a-row> |
||||
<a-divider class="divider-transparent" /> |
||||
<div class="bottom-control"> |
||||
<a-space> |
||||
<a-button type="dashed" @click="handleEditComment" v-if="!editable">编辑</a-button> |
||||
<a-button type="primary" @click="handleUpdateComment" v-if="editable">保存</a-button> |
||||
<a-popconfirm title="你确定要将此评论者加入黑名单?" okText="确定" cancelText="取消"> |
||||
<a-button type="danger">加入黑名单</a-button> |
||||
</a-popconfirm> |
||||
</a-space> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
<script> |
||||
import { mixin, mixinDevice } from '@/mixins/mixin.js' |
||||
import commentApi from '@/api/comment' |
||||
export default { |
||||
name: 'CommentDetail', |
||||
mixins: [mixin, mixinDevice], |
||||
components: {}, |
||||
data() { |
||||
return { |
||||
editable: false, |
||||
commentStatus: commentApi.commentStatus, |
||||
keys: ['blog_url'] |
||||
} |
||||
}, |
||||
model: { |
||||
prop: 'visible', |
||||
event: 'close' |
||||
}, |
||||
props: { |
||||
comment: { |
||||
type: Object, |
||||
required: true |
||||
}, |
||||
visible: { |
||||
type: Boolean, |
||||
required: false, |
||||
default: true |
||||
}, |
||||
type: { |
||||
type: String, |
||||
required: false, |
||||
default: 'posts', |
||||
validator: function(value) { |
||||
return ['posts', 'sheets', 'journals'].indexOf(value) !== -1 |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
handleEditComment() { |
||||
this.editable = true |
||||
}, |
||||
handleUpdateComment() { |
||||
commentApi.update(this.type, this.comment.id, this.comment).then(response => { |
||||
this.$log.debug('Updated comment', response.data.data) |
||||
this.$message.success('评论修改成功!') |
||||
}) |
||||
this.editable = false |
||||
}, |
||||
onClose() { |
||||
this.$emit('close', false) |
||||
} |
||||
} |
||||
} |
||||
</script> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue