1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-06-11 12:49:30 +08:00

新增文章访问验证码功能

使用教程:https://blog.muyin.site/archives/3gysn5O9
This commit is contained in:
liuyiwuqing
2024-05-27 22:29:15 +08:00
parent 7d8e4ad559
commit 4747d593be
5 changed files with 339 additions and 79 deletions
+30 -1
View File
@@ -20,7 +20,11 @@ export default {
* @param {String} name 分类名称
*/
getPostByName: (name) => {
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {})
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
header: {
'Wechat-Session-Id': uni.getStorageSync('openid'),
}
})
},
/**
@@ -140,4 +144,29 @@ export default {
getFriendLinkList: (params) => {
return HttpHandler.Get(`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links`, params)
},
/**
* 校验文章访问密码
*/
checkPostVerifyCode: (verifyCode, postId) => {
return HttpHandler.Get(`/tools/verificationCode/check?code=${verifyCode}`, null, {
header: {
'Authorization': 'Tools工具箱插件设置的认证token',
'Wechat-Session-Id': uni.getStorageSync('openid'),
'Post-Id': postId
}
})
},
/**
* 获取文章验证码
*/
getPostVerifyCode: () => {
return HttpHandler.Get(`/tools/verificationCode/create`, null, {
header: {
'Authorization': 'Tools工具箱插件设置的认证token'
}
})
},
}