mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-11-13 22:11:42 +08:00
chore: 废弃第三方友链提交功能,重构友链相关配置与分类逻辑
1. 移除linksSubmitPlugin相关配置与提交接口代码 2. 重构友链配置数据结构,拆分linkInfo为miniInfo/siteInfo/authorInfo 3. 优化分类页审核模式渲染逻辑,补充postCount默认值处理 4. 更新所有关联页面与组件的数据源读取逻辑
This commit is contained in:
@@ -34,7 +34,8 @@
|
||||
slug: '',
|
||||
cover: checkThumbnailUrl(c.cover),
|
||||
priority: c.priority,
|
||||
}
|
||||
},
|
||||
postCount: c.postCount ?? 0,
|
||||
} as ICategory))
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -24,20 +24,21 @@ const emit = defineEmits<{
|
||||
const isShow = ref(false)
|
||||
const appConfigStore = useAppConfigStore()
|
||||
|
||||
/** 小程序申请信息(字段与 uh-links-mini-apply 表单一致,从插件端 linkInfo 配置直接读取,字段名无映射) */
|
||||
/** 小程序申请信息(字段与 uh-links-mini-apply 表单一致;小程序信息读 linkInfo.miniInfo、作者信息读 linkInfo.authorInfo,字段名无映射) */
|
||||
const miniInfo = computed(() => {
|
||||
const cfg = (appConfigStore.configs.pluginConfig?.linkInfo || {}) as Record<string, unknown>
|
||||
const str = (key: string, fallback = '') => String(cfg[key] || fallback || '')
|
||||
const miniCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.miniInfo || {}) as Record<string, unknown>
|
||||
const authorCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.authorInfo || {}) as Record<string, unknown>
|
||||
const str = (cfg: Record<string, unknown>, key: string, fallback = '') => String(cfg[key] || fallback || '')
|
||||
return {
|
||||
displayName: str('displayName'),
|
||||
miniProgramCode: str('miniProgramCode'),
|
||||
link: str('link'),
|
||||
authorName: str('authorName'),
|
||||
avatar: str('avatar'),
|
||||
website: str('website'),
|
||||
description: str('description'),
|
||||
applyRemark: str('applyRemark'),
|
||||
email: str('email'),
|
||||
displayName: str(miniCfg, 'displayName'),
|
||||
miniProgramCode: str(miniCfg, 'miniProgramCode'),
|
||||
link: str(miniCfg, 'link'),
|
||||
authorName: str(authorCfg, 'authorName'),
|
||||
avatar: str(authorCfg, 'avatar'),
|
||||
website: str(authorCfg, 'website'),
|
||||
description: str(miniCfg, 'description'),
|
||||
applyRemark: str(miniCfg, 'applyRemark'),
|
||||
email: str(miniCfg, 'email'),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* 提交后等待站长审核,通过后展示在「站点」列表中
|
||||
*/
|
||||
import { ref, watch } from 'vue'
|
||||
import { submitLink } from '@/api/uni-halo'
|
||||
import type { ISubmitLinkForm } from '@/api/types/uni-halo'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
show?: boolean
|
||||
@@ -88,34 +86,9 @@ async function handleSubmit() {
|
||||
if (!validateForm())
|
||||
return
|
||||
|
||||
submitting.value = true
|
||||
uni.showLoading({ title: '正在提交...' })
|
||||
try {
|
||||
const payload: ISubmitLinkForm = {
|
||||
name: form.value.name.trim(),
|
||||
url: form.value.url.trim(),
|
||||
logo: form.value.logo.trim() || undefined,
|
||||
linkPageUrl: form.value.linkPageUrl.trim() || undefined,
|
||||
email: form.value.email.trim() || undefined,
|
||||
rssUrl: form.value.rssUrl.trim() || undefined,
|
||||
description: form.value.description.trim() || undefined,
|
||||
}
|
||||
const res = await submitLink(payload)
|
||||
const msg = res.data?.msg || res.data?.message || res.message || '提交成功'
|
||||
uni.showToast({ icon: 'none', title: msg })
|
||||
if (res.code === 200 || res.code === undefined) {
|
||||
handleClose(true)
|
||||
handleResetForm()
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error('友链申请提交失败', err)
|
||||
uni.showToast({ icon: 'none', title: '提交失败,请稍后重试!' })
|
||||
}
|
||||
finally {
|
||||
submitting.value = false
|
||||
uni.hideLoading()
|
||||
}
|
||||
// linksSubmitPlugin 已弃用(2026-09-08),第三方友链自助提交暂未开放;
|
||||
// 后续可对接 Halo 官方 plugin-links link-applications 接口
|
||||
uni.showToast({ icon: 'none', title: '友链申请功能暂未开放,请联系站长' })
|
||||
}
|
||||
|
||||
function handleOnChange(isOpen: boolean) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* 站点友链信息弹窗(源自旧页面 pages-blog/submit-link 的博客详情弹窗,重设计为底部玻璃弹窗)
|
||||
* 展示本站友链交换信息(博客名片 + 复制交换信息 + 站点缩略图)
|
||||
* 数据源为 linksSubmitPlugin 配置(即本站申请提交的信息)
|
||||
* 数据源为插件端 linkInfo.siteInfo 配置(字段对齐 Halo 官方友链提交 API:displayName/url/logo/description/email/backlink/feedUrls)
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useAppConfigStore } from '@/store/appConfig'
|
||||
@@ -21,19 +21,22 @@ const emit = defineEmits<{
|
||||
const isShow = ref(false)
|
||||
const appConfigStore = useAppConfigStore()
|
||||
|
||||
const blogDetail = computed(() => (appConfigStore.configs.pluginConfig?.linksSubmitPlugin as {
|
||||
blogName?: string
|
||||
blogUrl?: string
|
||||
blogLogo?: string
|
||||
blogDesc?: string
|
||||
const blogDetail = computed(() => (appConfigStore.configs.pluginConfig?.linkInfo?.siteInfo as {
|
||||
displayName?: string
|
||||
url?: string
|
||||
logo?: string
|
||||
description?: string
|
||||
email?: string
|
||||
backlink?: string
|
||||
feedUrls?: string[]
|
||||
} | undefined) || {})
|
||||
|
||||
/** 友链交换信息文案(复制用) */
|
||||
const calcBlogContent = computed(() => `
|
||||
博客名称:${blogDetail.value.blogName || ''}
|
||||
博客地址:${blogDetail.value.blogUrl || ''}
|
||||
博客logo:${checkAvatarUrl(blogDetail.value.blogLogo)}
|
||||
博客简介:${blogDetail.value.blogDesc || ''}
|
||||
博客名称:${blogDetail.value.displayName || ''}
|
||||
博客地址:${blogDetail.value.url || ''}
|
||||
博客logo:${checkAvatarUrl(blogDetail.value.logo)}
|
||||
博客简介:${blogDetail.value.description || ''}
|
||||
`)
|
||||
|
||||
function calcSiteThumbnail(val?: string): string {
|
||||
@@ -88,14 +91,14 @@ watch(() => props.show, (val) => {
|
||||
<view class="flex items-center">
|
||||
<image
|
||||
class="uh-global-card-glass h-20 w-20 shrink-0 rounded-2xl"
|
||||
:src="checkAvatarUrl(blogDetail.blogLogo)" mode="aspectFill"
|
||||
:src="checkAvatarUrl(blogDetail.logo)" mode="aspectFill"
|
||||
/>
|
||||
<view class="ml-4 flex flex-1 flex-col justify-center gap-y-1">
|
||||
<text class="text-md text-gray-900 font-bold">
|
||||
{{ blogDetail.blogName || '未命名博客' }}
|
||||
{{ blogDetail.displayName || '未命名博客' }}
|
||||
</text>
|
||||
<text class="text-xs text-gray-500">
|
||||
{{ blogDetail.blogDesc || '这个博主很懒,没写简介~' }}
|
||||
{{ blogDetail.description || '这个博主很懒,没写简介~' }}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -107,8 +110,8 @@ watch(() => props.show, (val) => {
|
||||
|
||||
<!-- 站点缩略图 -->
|
||||
<image
|
||||
v-if="blogDetail.blogUrl" class="mt-4 h-[320rpx] w-full rounded-xl"
|
||||
:src="calcSiteThumbnail(blogDetail.blogUrl)" mode="aspectFill"
|
||||
v-if="blogDetail.url" class="mt-4 h-[320rpx] w-full rounded-xl"
|
||||
:src="calcSiteThumbnail(blogDetail.url)" mode="aspectFill"
|
||||
/>
|
||||
|
||||
<view class="my-6">
|
||||
|
||||
Reference in New Issue
Block a user