mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
feat(auth): 限制阅读支持评论后访问
- 引入 getOpenid 和 getNologinEmail 方法统一管理认证信息 - 替换原有直接读取 storage 方式为封装方法调用 - 优化文章详情页按钮文案展示逻辑 - 新增评论后自动刷新限制阅读内容功能 - 调整评论权限提示逻辑,跳转至评论弹窗而非 toast 提示
This commit is contained in:
+7
-4
@@ -10,6 +10,7 @@ import qs from 'qs'
|
||||
import {
|
||||
getAppConfigs
|
||||
} from '@/config/index.js'
|
||||
import {getNologinEmail, getOpenid} from "@/utils/auth";
|
||||
|
||||
export default {
|
||||
/**
|
||||
@@ -27,7 +28,8 @@ export default {
|
||||
getPostByName: (name) => {
|
||||
return HttpHandler.Get(`/apis/api.content.halo.run/v1alpha1/posts/${name}`, {}, {
|
||||
header: {
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Wechat-Session-Id': getOpenid(),
|
||||
'nologin-email': getNologinEmail()
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -197,7 +199,8 @@ export default {
|
||||
return HttpHandler.Post(`/apis/tools.muyin.site/v1alpha1/restrict-read/check`, params, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Wechat-Session-Id': getOpenid(),
|
||||
'nologin-email': getNologinEmail()
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -209,7 +212,7 @@ export default {
|
||||
return HttpHandler.Get(`/apis/tools.muyin.site/v1alpha1/restrict-read/create`, null, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.toolsPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Wechat-Session-Id': getOpenid(),
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -221,7 +224,7 @@ export default {
|
||||
return HttpHandler.Post(`/apis/linkssubmit.muyin.site/v1alpha1/submit`, form, {
|
||||
header: {
|
||||
'Authorization': getAppConfigs().pluginConfig.linksSubmitPlugin?.Authorization,
|
||||
'Wechat-Session-Id': uni.getStorageSync('openid'),
|
||||
'Wechat-Session-Id': getOpenid(),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user