update: 优化友链提交配置

This commit is contained in:
小莫唐尼 2024-06-02 19:38:27 +08:00
parent 19c4e12a5b
commit 620354b77a
6 changed files with 718 additions and 653 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ config/halo.config.js
config/ad.config.js config/ad.config.js
config/love.config.js config/love.config.js
config/token.config.js config/token.config.js
config/plugins.config.js

24
config/plugins.config.js Normal file
View File

@ -0,0 +1,24 @@
/** 插件相关配置 */
const PluginsConfig = Object.freeze({
// 友链提交配置
autoSubmitLink: {
// 可以考虑配置一个插件id检测是否开启了友链提交插件
pluginId:"",
// 是否开启(可能不启用插件)
enabled: false,
// 我的友链信息
blogDetail: {
// 博客名称
name: "uni-halo 博客",
// 博客地址
url: "https://uni-halo.925i.cn/",
// 博客logo
logo: "https://uni-halo.925i.cn/logo.png",
// 博客简介
description: "一个基于Halo2.0 API 的博客小程序开源项目。",
}
}
})
export default PluginsConfig;

View File

@ -0,0 +1,24 @@
/** 插件相关配置 */
const PluginsConfig = Object.freeze({
// 友链提交配置
autoSubmitLink: {
// 可以考虑配置一个插件id检测是否开启了友链提交插件暂未使用
pluginId: "",
// 是否开启(可能后台没有安装或未不启用插件)
enabled: true,
// 我的友链信息
blogDetail: {
// 博客名称
name: "",
// 博客地址
url: "",
// 博客logo
logo: "",
// 博客简介
description: "",
}
}
})
export default PluginsConfig;

View File

@ -69,6 +69,11 @@ Vue.prototype.$baseApiUrl = HaloTokenConfig.BASE_API
import HaloAdConfig from '@/config/ad.config.js' import HaloAdConfig from '@/config/ad.config.js'
Vue.prototype.$haloAdConfig = HaloAdConfig Vue.prototype.$haloAdConfig = HaloAdConfig
import HaloPluginsConfig from '@/config/plugins.config.js'
Vue.prototype.$haloPluginsConfig = HaloPluginsConfig
// 由于微信小程序的运行机制问题需声明如下一行H5和APP非必填 // 由于微信小程序的运行机制问题需声明如下一行H5和APP非必填
Vue.prototype._i18n = i18n; Vue.prototype._i18n = i18n;

View File

@ -120,8 +120,8 @@
<!-- 返回顶部 --> <!-- 返回顶部 -->
<tm-flotbutton color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton> <tm-flotbutton color="light-blue" @click="fnToTopPage" size="m" icon="icon-angle-up"></tm-flotbutton>
<tm-flotbutton :offset="[16,80]" label="申请" actions-pos="left" :show-text="true" color="bg-gradient-orange-accent" @click="toSubmitLinkPage"></tm-flotbutton> <tm-flotbutton v-if="$haloPluginsConfig.autoSubmitLink.enabled" :offset="[16,80]" label="申请" actions-pos="left" :show-text="true" color="bg-gradient-orange-accent"
@click="toSubmitLinkPage"></tm-flotbutton>
<!-- 详情弹窗 --> <!-- 详情弹窗 -->
<tm-poup v-model="detail.show" :width="640" height="auto" position="center" :round="6"> <tm-poup v-model="detail.show" :width="640" height="auto" position="center" :round="6">
<view class="poup pa-36"> <view class="poup pa-36">
@ -164,18 +164,18 @@
</template> </template>
<script> <script>
import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue'; import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue'; import tmTranslate from '@/tm-vuetify/components/tm-translate/tm-translate.vue';
import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue'; import tmFlotbutton from '@/tm-vuetify/components/tm-flotbutton/tm-flotbutton.vue';
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'; import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue';
import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue'; import tmEmpty from '@/tm-vuetify/components/tm-empty/tm-empty.vue';
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue'; import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue'; import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
import {
GetRandomNumberByRange import {GetRandomNumberByRange} from '@/utils/random.js';
} from '@/utils/random.js';
export default { export default {
components: { components: {
tmSkeleton, tmSkeleton,
tmTranslate, tmTranslate,
@ -196,7 +196,7 @@
show: false, show: false,
data: {} data: {}
}, },
hasNext:false, hasNext: false,
isLoadMore: false, isLoadMore: false,
loadMoreText: '', loadMoreText: '',
dataList: [], dataList: [],
@ -334,24 +334,24 @@
}); });
} }
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.app-page { .app-page {
width: 100vw; width: 100vw;
min-height: 100vh; min-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #fafafd; background-color: #fafafd;
} }
.loading-wrap { .loading-wrap {
padding: 24rpx; padding: 24rpx;
min-height: 100vh; min-height: 100vh;
} }
.content { .content {
padding: 0 24rpx; padding: 0 24rpx;
padding-top: 24rpx; padding-top: 24rpx;
@ -361,9 +361,9 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
} }
.link-card { .link-card {
border-bottom: 2rpx solid #f5f5f5; border-bottom: 2rpx solid #f5f5f5;
background-color: #ffffff; background-color: #ffffff;
@ -407,20 +407,20 @@
font-size: 28rpx; font-size: 28rpx;
} }
} }
} }
.link-card_name { .link-card_name {
// color: #303133; // color: #303133;
// color: #0080fe; // color: #0080fe;
} }
.link-card_desc { .link-card_desc {
font-size: 24rpx; font-size: 24rpx;
line-height: 1.6; line-height: 1.6;
color: #303133; color: #303133;
} }
.link-logo { .link-logo {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
@ -428,9 +428,9 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.poup-logo { .poup-logo {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border-radius: 50%; border-radius: 50%;
@ -440,22 +440,22 @@
height: 100%; height: 100%;
border-radius: 50%; border-radius: 50%;
} }
} }
.info-detail { .info-detail {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
justify-content: center; justify-content: center;
} }
.poup-desc { .poup-desc {
font-size: 28rpx; font-size: 28rpx;
line-height: 1.6; line-height: 1.6;
color: #555 !important; color: #555 !important;
} }
.preview-site { .preview-site {
width: 100%; width: 100%;
height: 300rpx; height: 300rpx;
} }
</style> </style>

View File

@ -1,97 +1,104 @@
<template> <template>
<tm-fullView> <tm-fullView>
<view class="ma-32"><tm-coupon :hdata="d_3" color="blue" @click="blogDetailPoupShow=true"></tm-coupon></view> <view class="ma-32">
<tm-coupon :hdata="calcBlogCoupon" color="blue" @click="blogDetailPoupShow=true"></tm-coupon>
</view>
<view class="pb-50"> <view class="pb-50">
<tm-form @submit="fnOnSubmit"> <tm-form @submit="fnOnSubmit">
<tm-sheet color="blue" :shadow="24"> <tm-sheet :shadow="24" color="blue">
<view class="text-size-s text-weight-b mb-24">友链信息提交</view> <view class="text-size-s text-weight-b mb-24">友链信息提交</view>
<tm-sheet :margin="[0,0]" :padding="[0,0]" classname="overflow" :shadow="24"> <tm-sheet :margin="[0,0]" :padding="[0,0]" :shadow="24" classname="overflow">
<tm-input name="displayName" required title="名称" v-model="form.displayName" placeholder="请输入网站名称" align="right"></tm-input> <tm-input v-model="form.displayName" align="right" name="displayName" placeholder="请输入网站名称"
<tm-input name="url" required title="网址" v-model="form.url" placeholder="请输入网站地址" align="right"></tm-input> required title="名称"></tm-input>
<tm-input name="logo" required title="Logo" v-model="form.logo" placeholder="请输入网站Logo" align="right"></tm-input> <tm-input v-model="form.url" align="right" name="url" placeholder="请输入网站地址" required
<tm-input name="email" required title="邮箱" v-model="form.email" placeholder="请输入邮箱" align="right"></tm-input> title="网址"></tm-input>
<tm-input name="linkPageUrl" title="友链页面" v-model="form.linkPageUrl" placeholder="请输入友链页面地址" align="right"></tm-input> <tm-input v-model="form.logo" align="right" name="logo" placeholder="请输入网站Logo" required
title="Logo"></tm-input>
<tm-input v-model="form.email" align="right" name="email" placeholder="请输入邮箱" required
title="邮箱"></tm-input>
<tm-input v-model="form.linkPageUrl" align="right" name="linkPageUrl" placeholder="请输入友链页面地址"
title="友链页面"></tm-input>
<view class="py-12 px-24 mx-12 round-3 border-b-1 grey text"> <view class="py-12 px-24 mx-12 round-3 border-b-1 grey text">
<text class="text-grey text-size-xs px-10"> <text class="text-grey text-size-xs px-10">
<tm-helpTips color="bg-gradient-blue-lighten-b" <tm-helpTips :show="true" color="bg-gradient-blue-lighten-b" direction="bottom"
:show="true" direction="bottom" tip-direction="left" label="展示本站链接的页面地址,用于校验是否添加本站友链" ment-direction="left" tip-direction="left">
label="展示本站链接的页面地址,用于校验是否添加本站友链" ment-direction="left">
<tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons> <tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons>
</tm-helpTips> </tm-helpTips>
贵站友情链接页面地址即包含本站链接也页面 贵站友情链接页面地址即包含本站链接也页面
</text> </text>
</view> </view>
<tm-input name="rssUrl" title="RSS地址" v-model="form.rssUrl" placeholder="请输入RSS地址" align="right"></tm-input> <tm-input v-model="form.rssUrl" align="right" name="rssUrl" placeholder="请输入RSS地址"
title="RSS地址"></tm-input>
<view class="py-12 px-24 mx-12 round-3 border-b-1 grey text"> <view class="py-12 px-24 mx-12 round-3 border-b-1 grey text">
<text class="text-grey text-size-xs px-10"> <text class="text-grey text-size-xs px-10">
<tm-helpTips color="bg-gradient-blue-lighten-b" <tm-helpTips :show="true" color="bg-gradient-blue-lighten-b" direction="bottom"
:show="true" direction="bottom" tip-direction="left" label="用于抓取文章" ment-direction="left" tip-direction="left">
label="用于抓取文章" ment-direction="left">
<tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons> <tm-icons :fllowTheme="true" name="icon-question-circle"></tm-icons>
</tm-helpTips> </tm-helpTips>
用于抓取文章 用于抓取文章
</text> </text>
</view> </view>
<tm-input name="description" :border-bottom="false" :vertical="true" required :height="100" <tm-input v-model="form.description" :border-bottom="false" :height="100" :maxlength="30"
input-type="textarea" bg-color="grey-lighten-5" :maxlength="30" title="网站描述" :vertical="true" bg-color="grey-lighten-5" input-type="textarea" name="description"
placeholder="请输入网站描述,不超过30字符" v-model="form.description"></tm-input> placeholder="请输入网站描述,不超过30字符" required title="网站描述"></tm-input>
<view class="px-24"> <view class="px-24">
<tm-button navtie-type="form" theme="bg-gradient-blue-accent" block>提交数据</tm-button> <tm-button block navtie-type="form" theme="bg-gradient-blue-accent">提交数据</tm-button>
<view class="py-32 text-size-s text-grey text-align-center">友链申请</view> <view class="py-32 text-size-s text-grey text-align-center">友链申请</view>
</view> </view>
</tm-sheet> </tm-sheet>
</tm-sheet> </tm-sheet>
</tm-form> </tm-form>
<tm-poup v-model="blogDetailPoupShow" :width="640" height="auto" position="center" :round="6"> <tm-poup v-model="blogDetailPoupShow" :round="6" :width="640" height="auto" position="center">
<view class="poup pa-36"> <view class="poup pa-36" scroll-y="auto">
<view class="info flex"> <view class="info flex">
<view class="poup-logo bg-gradient-amber-accent pa-4 shadow-24"> <view class="poup-logo pa-4 shadow-24">
<image class="poup-logo_img" :src="blogDetail.logo" mode="aspectFill"></image> <image :src="blogDetail.logo" class="poup-logo_img" mode="aspectFill"></image>
</view> </view>
<view class="pl-24 info-detail"> <view class="pl-24 info-detail">
<view class="poup-name text-size-lg text-weight-b">{{ blogDetail.name }}</view> <view class="poup-name text-size-lg text-weight-b">{{ blogDetail.name }}</view>
<view class="poup-tag ml--10"> <view class="poup-tag ml--10 text-size-n mt-10 text-grey">
<tm-tags color="bg-gradient-amber-accent" size="n" {{ blogDetail.description }}
model="fill">{{ blogDetail.description }}</tm-tags>
</view>
<view class="poup-link text-size-m" @click="fnCopyLink(blogDetail.url)">
<text class="text-orange">点击复制友链交换信息</text>
<text class="iconfont icon-copy text-size-s ml-6 text-grey"></text>
</view> </view>
</view> </view>
</view> </view>
<view class="poup-desc mt-20"> <view class="poup-desc">
<text>{{ blogDetail.content}}</text> <text>{{ calcBlogContent }}</text>
</view> </view>
<!-- 博客预览图 --> <!-- 博客预览图 -->
<view class="mt-24"><tm-images :width="568" :round="2" :src="caclSiteThumbnail(blogDetail.url)" <view class="mt-24">
mode="aspectFill"></tm-images></view> <tm-images :round="2" :src="caclSiteThumbnail(blogDetail.url)" :width="568"
mode="aspectFill"></tm-images>
</view>
</view>
<view class="poup-link flex flex-center mb-24">
<tm-button theme="light-blue" size="n" @click="fnCopyLink(blogDetail.url)">复制友链交换信息</tm-button>
<tm-button text theme="white" @click="blogDetailPoupShow = false">关闭</tm-button>
</view> </view>
</tm-poup> </tm-poup>
</view> </view>
</tm-fullView> </tm-fullView>
</template> </template>
<script> <script>
import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue" import tmFullView from "@/tm-vuetify/components/tm-fullView/tm-fullView.vue"
import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue" import tmMenubars from "@/tm-vuetify/components/tm-menubars/tm-menubars.vue"
import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue" import tmSheet from "@/tm-vuetify/components/tm-sheet/tm-sheet.vue"
import tmForm from "@/tm-vuetify/components/tm-form/tm-form.vue" import tmForm from "@/tm-vuetify/components/tm-form/tm-form.vue"
import tmActionSheet from "@/tm-vuetify/components/tm-actionSheet/tm-actionSheet.vue" import tmActionSheet from "@/tm-vuetify/components/tm-actionSheet/tm-actionSheet.vue"
import tmButton from "@/tm-vuetify/components/tm-button/tm-button.vue" import tmButton from "@/tm-vuetify/components/tm-button/tm-button.vue"
import tmInput from "@/tm-vuetify/components/tm-input/tm-input.vue" import tmInput from "@/tm-vuetify/components/tm-input/tm-input.vue"
import tmHelpTips from "@/tm-vuetify/components/tm-helpTips/tm-helpTips.vue" import tmHelpTips from "@/tm-vuetify/components/tm-helpTips/tm-helpTips.vue"
import tmIcons from "@/tm-vuetify/components/tm-icons/tm-icons.vue" import tmIcons from "@/tm-vuetify/components/tm-icons/tm-icons.vue"
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue' import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue'
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue' import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue'
import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue' import tmTags from '@/tm-vuetify/components/tm-tags/tm-tags.vue'
import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue' import tmCoupon from '@/tm-vuetify/components/tm-coupon/tm-coupon.vue'
export default {
export default {
components: { components: {
tmFullView, tmFullView,
tmSheet, tmSheet,
@ -110,13 +117,7 @@
data() { data() {
return { return {
blogDetailPoupShow: false, blogDetailPoupShow: false,
blogDetail: { blogDetail: this.$haloPluginsConfig.autoSubmitLink.blogDetail,
name: "柳意梧情博客",
url: "https://lywq.muyin.site",
logo: "https://lywq.muyin.site/logo.png",
description: "心在哪里收获就在哪里",
content: "博客名称:柳意梧情博客 \n博客地址https://lywq.muyin.site \n博客logohttps://lywq.muyin.site/logo \n博客简介柳意梧情博客-心在哪里收获就在哪里"
},
form: { form: {
url: '', // url: '', //
name: '', // name: '', //
@ -124,12 +125,6 @@
linkPageUrl: '', // linkPageUrl: '', //
team: '自助提交', // team: '自助提交', //
description: '' // description: '' //
},
d_3: {
img: 'https://lywq.muyin.site/logo.png',
title: '柳意梧情博客',
time: '心在哪里收获就在哪里',
btnText: '友链详情'
} }
}; };
}, },
@ -142,8 +137,23 @@
} }
return 'https://image.thum.io/get/width/1000/crop/800/' + val; return 'https://image.thum.io/get/width/1000/crop/800/' + val;
}; };
},
calcBlogContent() {
return `
博客名称${this.blogDetail.name}
博客地址${this.blogDetail.url}
博客logo${this.blogDetail.logo}
博客简介${this.blogDetail.description}
`
},
calcBlogCoupon() {
return {
img: this.blogDetail.logo,
title: this.blogDetail.name,
time: this.blogDetail.description,
btnText: '友链详情'
}
} }
}, },
onLoad() { onLoad() {
this.fnSetPageTitle('友链申请'); this.fnSetPageTitle('友链申请');
@ -176,7 +186,7 @@
}); });
this.$httpApi.v2.submitLink(this.form) this.$httpApi.v2.submitLink(this.form)
.then(res => { .then(res => {
if (res.code == 200) { if (res.code === 200) {
uni.$tm.toast('友链提交成功!'); uni.$tm.toast('友链提交成功!');
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
@ -198,7 +208,7 @@
}, },
fnCopyLink() { fnCopyLink() {
uni.setClipboardData({ uni.setClipboardData({
data: this.blogDetail.content, data: this.calcBlogContent,
showToast: false, showToast: false,
success: () => { success: () => {
uni.showToast({ uni.showToast({
@ -215,38 +225,39 @@
}); });
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.poup-logo { .poup-logo {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border-radius: 50%; border-radius: 24rpx;
overflow: hidden;
&_img { &_img {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%;
}
} }
}
.poup-desc { .poup-desc {
margin-top: -20rpx;
font-size: 28rpx; font-size: 28rpx;
line-height: 1.6; line-height: 1.8;
color: #555 !important; color: #555 !important;
} }
.info-detail { .info-detail {
width: 0; width: 0;
flex-grow: 1; flex-grow: 1;
justify-content: center; justify-content: center;
} }
pre { pre {
// //
white-space: pre-wrap; white-space: pre-wrap;
// //
overflow-x: auto; overflow-x: auto;
} }
</style> </style>