mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
refactor: 将页面配置通过插件动态化配置(plugin-uni-halo)
This commit is contained in:
+5
-5
@@ -10,19 +10,19 @@
|
||||
* 修改时间:
|
||||
*/
|
||||
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
// 2.0接口
|
||||
import v2 from './v2/all.api.js'
|
||||
import v2Config from './v2/all.config.js'
|
||||
|
||||
const ApiManager = {
|
||||
v2
|
||||
v2,
|
||||
v2Config,
|
||||
};
|
||||
|
||||
const install = (Vue) => {
|
||||
Vue.prototype.$httpApi = ApiManager
|
||||
Vue.prototype.$httpApi = ApiManager
|
||||
}
|
||||
|
||||
export default {
|
||||
install
|
||||
install
|
||||
}
|
||||
|
||||
+165
-164
@@ -3,191 +3,192 @@
|
||||
*/
|
||||
import HaloTokenConfig from '@/config/token.config.js'
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
import {
|
||||
getCache
|
||||
} from '@/utils/storage.js'
|
||||
import HaloPluginsConfig from '@/config/plugins.config.js'
|
||||
getAppConfigs
|
||||
} from '@/config/index.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取文章列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
|
||||
},
|
||||
/**
|
||||
* 获取文章列表
|
||||
* @param {Object} params 参数
|
||||
*/
|
||||
getPostList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据名称获取文章
|
||||
* @param {String} name 分类名称
|
||||
*/
|
||||
getPostByName: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
||||
header: {
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 根据名称获取文章
|
||||
* @param {String} name 分类名称
|
||||
*/
|
||||
getPostByName: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
||||
header: {
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 搜索文章
|
||||
* @param {Object} params 数据
|
||||
*/
|
||||
getPostListByKeyword: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/indices/post`, params)
|
||||
},
|
||||
/**
|
||||
* 搜索文章
|
||||
* @param {Object} params 数据
|
||||
*/
|
||||
getPostListByKeyword: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/indices/post`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询分类列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryList: (params) => {
|
||||
return HttpHandler.Get('/apis/api.content.halo.run/v1alpha1/categories', params)
|
||||
},
|
||||
/**
|
||||
* 查询分类下的文章
|
||||
* @param {String} name 分类名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryPostList: (name, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
|
||||
},
|
||||
/**
|
||||
* 查询分类列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryList: (params) => {
|
||||
return HttpHandler.Get('/apis/api.content.halo.run/v1alpha1/categories', params)
|
||||
},
|
||||
/**
|
||||
* 查询分类下的文章
|
||||
* @param {String} name 分类名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getCategoryPostList: (name, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/categories/${name}/posts`, params)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论列表接口(列表数据)
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, params)
|
||||
},
|
||||
/**
|
||||
* 获取评论列表接口(列表数据)
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取回复列表
|
||||
* @param {String} commentName 名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentReplyList: (commentName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, params)
|
||||
},
|
||||
/**
|
||||
* 获取回复列表
|
||||
* @param {String} commentName 名称
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostCommentReplyList: (commentName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/comments/${commentName}/reply`, params)
|
||||
},
|
||||
|
||||
// 提交评论
|
||||
addPostComment: (data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
|
||||
},
|
||||
// 提交回复
|
||||
addPostCommentReply: (commentName, data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/replay`, data)
|
||||
},
|
||||
// 提交评论
|
||||
addPostComment: (data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments`, data)
|
||||
},
|
||||
// 提交回复
|
||||
addPostCommentReply: (commentName, data) => {
|
||||
return HttpHandler.Post(`/apis/api.halo.run/v1alpha1/comments/${commentName}/replay`, data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getTagList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
|
||||
},
|
||||
/**
|
||||
* 获取标签列表
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getTagList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 根据标签获取文章列表
|
||||
* @param {String} tagName 参数
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostByTagName: (tagName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
|
||||
},
|
||||
/**
|
||||
* 根据标签获取文章列表
|
||||
* @param {String} tagName 参数
|
||||
* @param {Object} params 查询参数
|
||||
*/
|
||||
getPostByTagName: (tagName, params) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/tags/${tagName}/posts`, params)
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取瞬间列表
|
||||
*/
|
||||
getMomentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取瞬间列表
|
||||
*/
|
||||
getMomentList: (params) => {
|
||||
return HttpHandler.Get(`/apis/moment.halo.run/v1alpha1/moments`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询站点统计信息
|
||||
*/
|
||||
getBlogStatistics: () => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/stats/-`, {})
|
||||
},
|
||||
/**
|
||||
* 查询站点统计信息
|
||||
*/
|
||||
getBlogStatistics: () => {
|
||||
return HttpHandler.Get(`/apis/api.halo.run/v1alpha1/stats/-`, {})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取相册分组
|
||||
*/
|
||||
getPhotoGroupList: (params) => {
|
||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/photogroups`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取相册分组
|
||||
*/
|
||||
getPhotoGroupList: (params) => {
|
||||
return HttpHandler.Get(`/apis/core.halo.run/v1alpha1/photogroups`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 根据分组获取相册
|
||||
*/
|
||||
getPhotoListByGroupName: (params) => {
|
||||
return HttpHandler.Get(`/apis/console.api.photo.halo.run/v1alpha1/photos`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 根据分组获取相册
|
||||
*/
|
||||
getPhotoListByGroupName: (params) => {
|
||||
return HttpHandler.Get(`/apis/console.api.photo.halo.run/v1alpha1/photos`, params, {
|
||||
custom: {
|
||||
systemToken: HaloTokenConfig.systemToken
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取友链
|
||||
*/
|
||||
getFriendLinkList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
|
||||
},
|
||||
/**
|
||||
* 获取友链
|
||||
*/
|
||||
getFriendLinkList: (params) => {
|
||||
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 校验文章访问密码
|
||||
*/
|
||||
checkPostVerifyCode: (verifyCode, postId) => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/verificationCode/check?code=${verifyCode}`, null, {
|
||||
header: {
|
||||
'Authorization': HaloPluginsConfig.toolsPlugin.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Post-Id': postId
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 校验文章访问密码
|
||||
*/
|
||||
checkPostVerifyCode: (verifyCode, postId) => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/verificationCode/check?code=${verifyCode}`, null, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Post-Id': postId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 校验文章访问密码
|
||||
*/
|
||||
checkPostPasswordAccess: (password, postId) => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/visitPassword/checkPost?password=${password}`, null, {
|
||||
header: {
|
||||
'Authorization': HaloPluginsConfig.toolsPlugin.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Post-Id': postId
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 校验文章访问密码
|
||||
*/
|
||||
checkPostPasswordAccess: (password, postId) => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/visitPassword/checkPost?password=${password}`,
|
||||
null, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Post-Id': postId
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取文章验证码
|
||||
*/
|
||||
getPostVerifyCode: () => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/verificationCode/create`, null, {
|
||||
header: {
|
||||
'Authorization': HaloPluginsConfig.toolsPlugin.Authorization
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 提交友情链接
|
||||
*/
|
||||
submitLink(form) {
|
||||
return HttpHandler.Post(`/apis/linksSubmit.muyin.site/v1alpha1/submit`, form, null)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取文章验证码
|
||||
*/
|
||||
getPostVerifyCode: () => {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/verificationCode/create`, null, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 提交友情链接
|
||||
*/
|
||||
submitLink(form) {
|
||||
return HttpHandler.Post(`/apis/linksSubmit.muyin.site/v1alpha1/submit`, form, null)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import HttpHandler from '@/common/http/request.js'
|
||||
|
||||
export default {
|
||||
/**
|
||||
* 获取应用基本配置
|
||||
*/
|
||||
getAppConfigs: () => {
|
||||
return HttpHandler.Get(`/apis/api.uni.uhalo.pro/v1alpha1/plugins/plugin-uni-halo/getConfigs`, {})
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user