mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-12 21:29:31 +08:00
fix: 修复插件状态检测功能
This commit is contained in:
@@ -6,23 +6,31 @@ import {
|
||||
NeedPlugins,
|
||||
checkNeedPluginAvailable
|
||||
} from "@/utils/plugin.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
|
||||
const HaloPluginAvailableMixin = {
|
||||
components: {
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
uniHaloPluginAvailableError: "",
|
||||
uniHaloPluginAvailable: true,
|
||||
uniHaloPluginPageClass: "",
|
||||
uniHaloPluginId: "", // 当前需要的插件
|
||||
uniHaloPluginInfo: "" // 当前插件信息
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
uniHaloPluginAvailable: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.uniHaloPluginPageClass = ""
|
||||
} else {
|
||||
this.uniHaloPluginPageClass = "box-border items-center justify-center"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 设置插件ID */
|
||||
setPluginId(pluginId) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<view v-if="pluginInfo" class="plugin-unavailable flex flex-col flex-center">
|
||||
<view v-if="pluginInfo" class="plugin-unavailable flex flex-col flex-center"
|
||||
:class="{border:useBorder,'decoration':useDecoration}" :style="[calcCustomStyle]">
|
||||
<!-- 图标 -->
|
||||
<image class="plugin-logo" :src="pluginInfo.logo" mode="scaleToFill"></image>
|
||||
<!-- 名称 -->
|
||||
@@ -21,9 +22,14 @@
|
||||
插件地址:{{ pluginInfo.url }}
|
||||
</view>
|
||||
<!-- 反馈按钮/复制地址 -->
|
||||
<view class="plugin-btns">
|
||||
<tm-button theme="light-blue" open-type="contact" plan text>复制地址</tm-button>
|
||||
<tm-button theme="light-blue">提交反馈</tm-button>
|
||||
<view class="plugin-btns w-full flex-center">
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<tm-button theme="light-blue" :block="true" class="w-full" :height="70" @click="copy">复制地址</tm-button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<tm-button theme="light-blue" plan text :height="70" @click="copy">复制地址</tm-button>
|
||||
<tm-button theme="light-blue" open-type="contact" :height="70">提交反馈</tm-button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
||||
<view class="plugin-copyright">
|
||||
@@ -55,17 +61,48 @@
|
||||
errorText: {
|
||||
type: String,
|
||||
default: ""
|
||||
},
|
||||
useDecoration: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
useBorder: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
customStyle: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
pluginInfo: null
|
||||
pluginInfo: null,
|
||||
defaultStyle: {
|
||||
width: "80vw",
|
||||
borderRadius: "24rpx"
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.pluginInfo = NeedPlugins.get(this.pluginId)
|
||||
computed: {
|
||||
calcCustomStyle() {
|
||||
const style = this.customStyle ?? {}
|
||||
return {
|
||||
...this.defaultStyle,
|
||||
...style
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pluginId: {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
handler(newVal, oldVal) {
|
||||
this.pluginInfo = NeedPlugins.get(newVal)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
copy() {
|
||||
@@ -79,22 +116,29 @@
|
||||
.plugin-unavailable {
|
||||
box-sizing: border-box;
|
||||
margin: auto;
|
||||
width: 80vw;
|
||||
padding: 100rpx 36rpx;
|
||||
gap: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
border: 2rpx solid #E2E8F0;
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
box-shadow: 0 0 12rpx rgba(226, 232, 240, 0.5);
|
||||
backdrop-filter: blur(6rpx);
|
||||
font-size: 28rpx;
|
||||
border-top: 12rpx solid #03A9F4;
|
||||
|
||||
&.border {
|
||||
// border: 2rpx solid #E2E8F0;
|
||||
border: 2rpx solid #eee;
|
||||
}
|
||||
|
||||
&.decoration {
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
box-shadow: 0 0 12rpx rgba(226, 232, 240, 0.35);
|
||||
backdrop-filter: blur(6rpx);
|
||||
border-top: 12rpx solid rgba(3, 169, 244, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.plugin-logo {
|
||||
box-sizing: border-box;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.plugin-name {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<view class="app-page flex flex-center">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
:error-text="uniHaloPluginAvailableError" :use-border="false" :use-decoration="false" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
const homePagePath = '/pages/tabbar/home/home'
|
||||
const startPagePath = '/pagesA/start/start'
|
||||
@@ -17,7 +18,10 @@
|
||||
const _DEV_TO_PATH_ = ""
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailable],
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
PluginUnavailable
|
||||
},
|
||||
computed: {
|
||||
configs() {
|
||||
return this.$tm.vx.getters().getConfigs;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
@@ -75,7 +75,7 @@
|
||||
import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
|
||||
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
export default {
|
||||
options: {
|
||||
multipleSlots: true
|
||||
@@ -91,7 +91,8 @@
|
||||
tmImages,
|
||||
tmFlowLayoutCustom,
|
||||
tmTabs,
|
||||
tmButton
|
||||
tmButton,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -130,7 +131,7 @@
|
||||
},
|
||||
watch: {
|
||||
galleryConfig: {
|
||||
async handler(newValue, oldValue) {
|
||||
async handler(newValue, oldValue) {
|
||||
if (!newValue) return;
|
||||
this.fnSetPageTitle(newValue.pageTitle);
|
||||
this.fnGetCategory();
|
||||
@@ -146,7 +147,11 @@
|
||||
await this.checkPluginAvailable()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.dataList = []
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
@@ -98,17 +98,19 @@
|
||||
generateUUID
|
||||
} from '@/utils/uuid.js';
|
||||
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailable],
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmFlotbutton,
|
||||
tmTranslate,
|
||||
tmEmpty,
|
||||
tmTags,
|
||||
mpHtml
|
||||
mpHtml,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -159,7 +161,11 @@
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
this.videoContexts = {};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
@@ -80,9 +80,11 @@
|
||||
import MarkdownConfig from '@/common/markdown/markdown.config.js';
|
||||
import mpHtml from '@/components/mp-html/components/mp-html/mp-html.vue';
|
||||
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailable],
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmSearch,
|
||||
@@ -91,7 +93,8 @@
|
||||
tmFlotbutton,
|
||||
tmEmpty,
|
||||
tmTags,
|
||||
mpHtml
|
||||
mpHtml,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -126,7 +129,7 @@
|
||||
this.fnSetPageTitle('内容搜索');
|
||||
// 检查插件
|
||||
this.setPluginId(this.NeedPluginIds.PluginSearchWidget)
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用瞬间功能哦,请联系管理员")
|
||||
this.setPluginError("阿偶,检测到当前插件没有安装或者启用,无法使用搜索功能哦,请联系管理员")
|
||||
if (!await this.checkPluginAvailable()) return
|
||||
if (!this.queryParams.keyword) {
|
||||
this.loading = 'success'
|
||||
@@ -136,9 +139,12 @@
|
||||
},
|
||||
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.fnGetData();
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.fnOnSearch()
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="app-page card-shadow">
|
||||
<view class="app-page card-shadow" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
@@ -121,10 +121,11 @@
|
||||
import tmImages from '@/tm-vuetify/components/tm-images/tm-images.vue';
|
||||
import tmPoup from '@/tm-vuetify/components/tm-poup/tm-poup.vue';
|
||||
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
mixins: [pluginAvailable],
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmTranslate,
|
||||
@@ -132,7 +133,8 @@
|
||||
tmTags,
|
||||
tmEmpty,
|
||||
tmImages,
|
||||
tmPoup
|
||||
tmPoup,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -189,7 +191,11 @@
|
||||
this.fnGetLinkGroupData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 1;
|
||||
this.dataList = []
|
||||
|
||||
+17
-7
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<view class="app-page">
|
||||
<view class="app-page" :class="[uniHaloPluginPageClass]">
|
||||
<PluginUnavailable v-if="!uniHaloPluginAvailable" :pluginId="uniHaloPluginId"
|
||||
:error-text="uniHaloPluginAvailableError" />
|
||||
<template v-else>
|
||||
<!-- 顶部切换 -->
|
||||
<view class="e-fixed">
|
||||
<view class="e-fixed filter-box">
|
||||
<tm-search v-model="queryParams.keyword" :round="24" :shadow="0" color="light-blue"
|
||||
insert-color="light-blue" :clear="true" @input="fnOnSearch" @confirm="fnOnSearch"></tm-search>
|
||||
<tm-dropDownMenu :shadow="1" color="light-blue" active-color="light-blue"
|
||||
<tm-dropDownMenu :shadow="0" color="light-blue" active-color="light-blue"
|
||||
:default-selected="filterOption.selected" :list="filterOption.list"
|
||||
@confirm="fnOnFilterConfirm"></tm-dropDownMenu>
|
||||
</view>
|
||||
@@ -58,13 +58,14 @@
|
||||
import {
|
||||
voteCacheUtil
|
||||
} from '@/utils/vote.js'
|
||||
import pluginAvailable from "@/common/mixins/pluginAvailable.js"
|
||||
import pluginAvailableMixin from "@/common/mixins/pluginAvailable.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
export default {
|
||||
options: {
|
||||
styleIsolation: 'shared'
|
||||
},
|
||||
mixins: [pluginAvailable],
|
||||
mixins: [pluginAvailableMixin],
|
||||
components: {
|
||||
tmSkeleton,
|
||||
tmSearch,
|
||||
@@ -74,7 +75,8 @@
|
||||
tmEmpty,
|
||||
tmTags,
|
||||
tmDropDownMenu,
|
||||
VoteCard
|
||||
VoteCard,
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -199,7 +201,11 @@
|
||||
this.fnGetData();
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
if (!this.uniHaloPluginAvailable) return;
|
||||
if (!this.uniHaloPluginAvailable) {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
return
|
||||
}
|
||||
this.fnResetSetAniWaitIndex();
|
||||
this.isLoadMore = false;
|
||||
this.queryParams.page = 0;
|
||||
@@ -385,6 +391,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.filter-box {
|
||||
box-shadow: 0rpx 0rpx 12rpx rgba(0, 0, 0, 0.035);
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 24rpx;
|
||||
}
|
||||
|
||||
+5
-5
@@ -16,7 +16,7 @@ export const NeedPlugins = new Map([
|
||||
NeedPluginIds.PluginUniHalo, {
|
||||
id: "plugin-uni-halo",
|
||||
name: "UniHalo配置",
|
||||
desc: "uni-halo 核心插件,未安装和启用的情况下,将无法使用 uni-halo,请检查是否已安装和启用。",
|
||||
desc: "uni-halo 核心插件,未安装和启用的情况下,将无法使用 uni-halo,请检查是否已安装和启用",
|
||||
logo: utils.checkUrl("/plugins/plugin-uni-halo/assets/logo.png"),
|
||||
url: "https://www.halo.run/store/apps/app-ryemX"
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export const NeedPlugins = new Map([
|
||||
NeedPluginIds.PluginPhotos, {
|
||||
id: "PluginPhotos",
|
||||
name: "图库管理",
|
||||
desc: "图库功能模块所需要的插件,用于展示",
|
||||
desc: "图库功能模块所需要的插件",
|
||||
logo: utils.checkUrl("/plugins/PluginPhotos/assets/logo.svg"),
|
||||
url: "https://www.halo.run/store/apps/app-BmQJW"
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export const NeedPlugins = new Map([
|
||||
NeedPluginIds.PluginLinks, {
|
||||
id: "PluginLinks",
|
||||
name: "链接管理",
|
||||
desc: "链接管理模块,用于网站友情链接功能模块。",
|
||||
desc: "链接管理模块,用于网站友情链接功能模块",
|
||||
logo: utils.checkUrl("/plugins/PluginLinks/assets/logo.svg"),
|
||||
url: "https://www.halo.run/store/apps/app-hfbQg"
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export const NeedPlugins = new Map([
|
||||
NeedPluginIds.PluginMoments, {
|
||||
id: "PluginMoments",
|
||||
name: "瞬间",
|
||||
desc: "提供一个轻量级的内容图文、视频、音频等内容展示。",
|
||||
desc: "提供一个轻量级的内容图文、视频、音频等内容展示",
|
||||
logo: utils.checkUrl("/plugins/PluginMoments/assets/logo.svg"),
|
||||
url: "https://www.halo.run/store/apps/app-SnwWD"
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export const NeedPlugins = new Map([
|
||||
NeedPluginIds.PluginSearchWidget, {
|
||||
id: "PluginSearchWidget",
|
||||
name: "搜索组件",
|
||||
desc: "为应用提供统一的搜索组件。",
|
||||
desc: "为应用提供统一的搜索组件",
|
||||
logo: utils.checkUrl("/plugins/PluginSearchWidget/assets/logo.svg"),
|
||||
url: "https://www.halo.run/store/apps/app-DlacW"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user