mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-11-13 22:11:42 +08:00
feat&refactor: 完成项目多轮优化与功能迭代
1. 调整开发环境与生产环境接口地址为局域网地址 2. 新增页面滚动监听hook、版权组件与小尺寸阴影工具类 3. 优化多处组件样式、导航栏与tabbar配置 4. 重构恋爱模块配置类型与移除冗余接口 5. 修复多处代码细节与优化用户体验
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
VITE_APP_TITLE = 'uni-halo'
|
VITE_APP_TITLE = 'uni-halo'
|
||||||
VITE_APP_PORT = 9520
|
VITE_APP_PORT = 5200
|
||||||
|
|
||||||
VITE_UNI_APPID = '__UNI__5748B6E'
|
VITE_UNI_APPID = '__UNI__5748B6E'
|
||||||
VITE_WX_APPID = 'wx1bb161867082c72f'
|
VITE_WX_APPID = 'wx1bb161867082c72f'
|
||||||
@@ -8,7 +8,7 @@ VITE_WX_APPID = 'wx1bb161867082c72f'
|
|||||||
# macOS 示例:
|
# macOS 示例:
|
||||||
# WECHAT_DEVTOOLS_CLI_PATH = '/Applications/wechatwebdevtools.app/Contents/MacOS/cli'
|
# WECHAT_DEVTOOLS_CLI_PATH = '/Applications/wechatwebdevtools.app/Contents/MacOS/cli'
|
||||||
# Windows 示例:
|
# Windows 示例:
|
||||||
# WECHAT_DEVTOOLS_CLI_PATH = 'C:\Program Files (x86)\Tencent\微信web开发者工具\cli.bat'
|
WECHAT_DEVTOOLS_CLI_PATH = 'D:\DevUtils\Tencent\微信web开发者工具\cli.bat'
|
||||||
|
|
||||||
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
||||||
# https://uniapp.dcloud.net.cn/collocation/manifest.html#h5-router
|
# https://uniapp.dcloud.net.cn/collocation/manifest.html#h5-router
|
||||||
@@ -21,13 +21,14 @@ VITE_APP_HALO_TOKEN = ''
|
|||||||
# 默认后台请求地址
|
# 默认后台请求地址
|
||||||
# 不同命令会按 mode 叠加读取 .env.development / .env.test / .env.production。
|
# 不同命令会按 mode 叠加读取 .env.development / .env.test / .env.production。
|
||||||
# 微信小程序如果没有配置下面的专用地址,也会回退使用这个值。
|
# 微信小程序如果没有配置下面的专用地址,也会回退使用这个值。
|
||||||
VITE_SERVER_BASEURL = 'http://localhost:8090'
|
# VITE_SERVER_BASEURL = 'http://localhost:8090'
|
||||||
|
VITE_SERVER_BASEURL = 'http://192.168.1.2:8090'
|
||||||
|
|
||||||
# 微信小程序专用后台请求地址,按微信开发者工具 envVersion 区分。
|
# 微信小程序专用后台请求地址,按微信开发者工具 envVersion 区分。
|
||||||
# 不配置时会回退使用 VITE_SERVER_BASEURL。
|
# 不配置时会回退使用 VITE_SERVER_BASEURL。
|
||||||
VITE_SERVER_BASEURL__WEIXIN_DEVELOP = ''
|
VITE_SERVER_BASEURL__WEIXIN_DEVELOP = 'http://192.168.1.2:8090'
|
||||||
VITE_SERVER_BASEURL__WEIXIN_TRIAL = ''
|
VITE_SERVER_BASEURL__WEIXIN_TRIAL = 'http://192.168.1.2:8090'
|
||||||
VITE_SERVER_BASEURL__WEIXIN_RELEASE = ''
|
VITE_SERVER_BASEURL__WEIXIN_RELEASE = 'http://192.168.1.2:8090'
|
||||||
|
|
||||||
# h5是否需要配置代理
|
# h5是否需要配置代理
|
||||||
VITE_APP_PROXY_ENABLE = false
|
VITE_APP_PROXY_ENABLE = false
|
||||||
|
|||||||
Vendored
+2
-1
@@ -9,4 +9,5 @@ VITE_SHOW_SOURCEMAP = false
|
|||||||
VITE_APP_HALO_TOKEN = ''
|
VITE_APP_HALO_TOKEN = ''
|
||||||
|
|
||||||
# development mode 后台请求地址
|
# development mode 后台请求地址
|
||||||
VITE_SERVER_BASEURL = 'http://localhost:8090'
|
# VITE_SERVER_BASEURL = 'http://localhost:8090'
|
||||||
|
VITE_SERVER_BASEURL = 'http://192.168.1.2:8090'
|
||||||
|
|||||||
+5
-2
@@ -2,10 +2,13 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { isPageTabbar } from './tabbar/store'
|
import { isPageTabbar } from './tabbar/store'
|
||||||
import { currRoute } from './utils'
|
import { currRoute } from './utils'
|
||||||
|
import { useSettingsPopup } from '@/hooks/useSettingsPopup'
|
||||||
import CustomTabbar from '@/tabbar/index.vue'
|
import CustomTabbar from '@/tabbar/index.vue'
|
||||||
|
|
||||||
const isCurrentPageTabbar = ref(true)
|
const isCurrentPageTabbar = ref(true)
|
||||||
const globalSettingsVisible = ref(false)
|
const globalSettingsVisible = ref(false)
|
||||||
|
|
||||||
|
const { settingsPopupVisible, openSettingsPopup } = useSettingsPopup()
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
const { path } = currRoute()
|
const { path } = currRoute()
|
||||||
if (path === '/') {
|
if (path === '/') {
|
||||||
@@ -21,10 +24,10 @@
|
|||||||
<view>
|
<view>
|
||||||
<uh-global-actions>
|
<uh-global-actions>
|
||||||
<uh-scrolltop-button :fixed="false" />
|
<uh-scrolltop-button :fixed="false" />
|
||||||
<uh-settings-button :fixed="false" @click="globalSettingsVisible = !globalSettingsVisible" />
|
<uh-settings-button :fixed="false" @action-click="openSettingsPopup()" />
|
||||||
</uh-global-actions>
|
</uh-global-actions>
|
||||||
|
|
||||||
<uh-settings-popup v-model="globalSettingsVisible" @close="globalSettingsVisible = false" />
|
<uh-settings-popup v-model="settingsPopupVisible" />
|
||||||
|
|
||||||
<KuRootView />
|
<KuRootView />
|
||||||
|
|
||||||
|
|||||||
+56
-12
@@ -112,8 +112,7 @@ export interface IPageConfig {
|
|||||||
categoryConfig?: { type?: string }
|
categoryConfig?: { type?: string }
|
||||||
momentConfig?: { useTagRandomColor?: boolean }
|
momentConfig?: { useTagRandomColor?: boolean }
|
||||||
galleryConfig?: { pageTitle?: string }
|
galleryConfig?: { pageTitle?: string }
|
||||||
/** 恋爱日记页(插件端「通用配置 → 页面设置 → 恋爱日记」配置;
|
/** 恋爱日记页(插件端「通用配置 → 页面设置 → 恋爱日记」配置) */
|
||||||
* 2026-09-11 起恋爱页背景图由 loveConfig.pageImages 迁入此处) */
|
|
||||||
loveDiaryConfig?: {
|
loveDiaryConfig?: {
|
||||||
pageTitle?: string
|
pageTitle?: string
|
||||||
/** 恋爱页背景图(留空客户端内置回退) */
|
/** 恋爱页背景图(留空客户端内置回退) */
|
||||||
@@ -188,10 +187,11 @@ export interface IAppConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 恋爱配置(入口显隐由模块入口开关
|
* 恋爱配置(恋爱日记入口仅密码状态无开关;三模块入口自身即 app 端入口列表数据:
|
||||||
* (ourStory/lovePhoto/loveDaily.enabled)与 navList 统一管理,客户端按模块开关判定)
|
* title/subTitle/颜色(hex8)/iconBgColor/path/priority,按 priority 降序下发;
|
||||||
|
* app 端按模块 key 直接渲染入口列表,locked=passwordEnabled 且本地无有效 token)
|
||||||
*/
|
*/
|
||||||
loveConfig?: Record<string, unknown>
|
loveConfig?: ILoveConfigGroup
|
||||||
imagesConfig?: IImagesConfig
|
imagesConfig?: IImagesConfig
|
||||||
/**
|
/**
|
||||||
* 博主与社交(blogger 含
|
* 博主与社交(blogger 含
|
||||||
@@ -482,13 +482,57 @@ export interface INoticeDetail {
|
|||||||
|
|
||||||
/* ---------- 恋爱模块(plugin-uni-halo love) ---------- */
|
/* ---------- 恋爱模块(plugin-uni-halo love) ---------- */
|
||||||
|
|
||||||
export interface ILoveConfig {
|
/** 恋爱模块入口(三模块共用;loveDiary 仅使用密码相关字段) */
|
||||||
/** 纪念日 */
|
export interface ILoveModuleConfig {
|
||||||
anniversary?: string
|
/** 是否在恋爱页展示该模块入口(loveDiary 不使用:入口显隐由快捷导航/功能入口注册表控制) */
|
||||||
/** 恋人信息 */
|
enabled?: boolean
|
||||||
lovers?: {
|
/** 入口名称(app 端入口列表标题) */
|
||||||
name?: string
|
title?: string
|
||||||
avatar?: string
|
/** 入口副标题(app 端入口列表副标题) */
|
||||||
|
subTitle?: string
|
||||||
|
/** 标题颜色(hex8 #rrggbbaa) */
|
||||||
|
titleColor?: string
|
||||||
|
/** 副标题颜色(hex8 #rrggbbaa) */
|
||||||
|
subTitleColor?: string
|
||||||
|
/** 图标背景色(hex8 #rrggbbaa) */
|
||||||
|
iconBgColor?: string
|
||||||
|
/** 图标字体前缀(如 uhlove-icon,app 端渲染入口图标) */
|
||||||
|
iconPrefix?: string
|
||||||
|
/** 图标名(app 端渲染入口图标) */
|
||||||
|
icon?: string
|
||||||
|
/** app 端跳转路径 */
|
||||||
|
path?: string
|
||||||
|
/** 排序字段(越大越靠前,插件端按 priority 降序输出) */
|
||||||
|
priority?: number
|
||||||
|
/** 是否已设置密码(app 端据此显示锁定态:passwordEnabled && 本地无有效 token) */
|
||||||
|
passwordEnabled?: boolean
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
/** getConfigs loveConfig 组(恋爱日记仅密码状态;三模块入口即 app 端入口列表数据) */
|
||||||
|
export interface ILoveConfigGroup {
|
||||||
|
/** 恋爱日记入口(恋爱页本身,仅密码状态,无 enabled 开关) */
|
||||||
|
loveDiary?: Pick<ILoveModuleConfig, 'passwordEnabled'>
|
||||||
|
/** 恋爱故事模块入口 */
|
||||||
|
ourStory?: ILoveModuleConfig
|
||||||
|
/** 恋爱相册模块入口 */
|
||||||
|
lovePhoto?: ILoveModuleConfig
|
||||||
|
/** 恋爱清单模块入口 */
|
||||||
|
loveDaily?: ILoveModuleConfig
|
||||||
|
/** 恋爱信息(纪念日 + 恋人信息;经 getConfigs loveConfig.loveInfo 下发) */
|
||||||
|
loveInfo?: {
|
||||||
|
/** 纪念日标题(默认「这是我们一起走过的」) */
|
||||||
|
loveDateTitle?: string
|
||||||
|
/** 恋爱纪念日(yyyy-MM-dd),用于计算恋爱天数 */
|
||||||
|
loveDate?: string
|
||||||
|
/** 男生昵称 */
|
||||||
|
boyNickname?: string
|
||||||
|
/** 男生头像 */
|
||||||
|
boyAvatar?: string
|
||||||
|
/** 女生昵称 */
|
||||||
|
girlNickname?: string
|
||||||
|
/** 女生头像 */
|
||||||
|
girlAvatar?: string
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import type {
|
|||||||
ILoveAlbum,
|
ILoveAlbum,
|
||||||
ILoveAlbumListReq,
|
ILoveAlbumListReq,
|
||||||
ILoveAlbumListRes,
|
ILoveAlbumListRes,
|
||||||
ILoveConfig,
|
|
||||||
ILoveDailyItem,
|
ILoveDailyItem,
|
||||||
ILoveDailyItemListReq,
|
ILoveDailyItemListReq,
|
||||||
ILoveDailyItemListRes,
|
ILoveDailyItemListRes,
|
||||||
@@ -201,19 +200,6 @@ export function getNoticeDetail(name: string) {
|
|||||||
|
|
||||||
/* ==================== 恋爱模块 ==================== */
|
/* ==================== 恋爱模块 ==================== */
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取恋爱配置(纪念日 + 恋人信息;恋爱日记入口 loveDiary 设密码时
|
|
||||||
* 需携带模块解锁 token,未解锁返回 401 locked)
|
|
||||||
*/
|
|
||||||
export function getLoveConfig() {
|
|
||||||
const token = getLoveModuleToken('loveDiary')
|
|
||||||
return http.Get<IResponse<ILoveConfig>>('/apis/api.unihalo.ialley.cn/v1alpha1/plugins/plugin-uni-halo/love-config', {
|
|
||||||
params: token ? { token } : {},
|
|
||||||
cacheFor: 0,
|
|
||||||
meta: { requestFrom: RequestFrom.Halo },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取恋爱相册列表(lovePhoto 模块设密码时需携带模块解锁 token)
|
* 获取恋爱相册列表(lovePhoto 模块设密码时需携带模块解锁 token)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -38,11 +38,10 @@
|
|||||||
|
|
||||||
const isGrid = computed(() => props.variant === 'grid')
|
const isGrid = computed(() => props.variant === 'grid')
|
||||||
|
|
||||||
/** 单一事实源:每种布局的完整形态,模板不再有任何 order / 条件分支 */
|
|
||||||
const CARD_LAYOUTS = computed(()=> ({
|
const CARD_LAYOUTS = computed(()=> ({
|
||||||
image_top: {
|
image_top: {
|
||||||
container: `flex flex-col gap-y-2 ${isGrid.value ? '!p-0' : ''}`,
|
container: `flex flex-col gap-y-2 ${isGrid.value ? '!p-0' : ''}`,
|
||||||
cover: `${isGrid.value ? 'rounded-lb-0 rounded-rb-0' : ''}`,
|
cover: `mb-1 ${isGrid.value ? 'rounded-lb-0 rounded-rb-0' : ''}`,
|
||||||
contentWrapper: `box-border w-full ${isGrid.value ? 'p-2 pt-0' : ''}`,
|
contentWrapper: `box-border w-full ${isGrid.value ? 'p-2 pt-0' : ''}`,
|
||||||
footer: 'flex items-center',
|
footer: 'flex items-center',
|
||||||
authorGroup: 'flex-1 items-center justify-start gap-x-1',
|
authorGroup: 'flex-1 items-center justify-start gap-x-1',
|
||||||
@@ -159,17 +158,16 @@
|
|||||||
</text>
|
</text>
|
||||||
<view class="relative overflow-hidden" :class="[isGrid ? 'w-full h-24 rounded-lg' : 'w-full h-36 rounded-lg', cardLayout.cover]">
|
<view class="relative overflow-hidden" :class="[isGrid ? 'w-full h-24 rounded-lg' : 'w-full h-36 rounded-lg', cardLayout.cover]">
|
||||||
<image class="w-full h-full block" :src="checkThumbnailUrl(article.spec.cover)" mode="aspectFill" lazy-load />
|
<image class="w-full h-full block" :src="checkThumbnailUrl(article.spec.cover)" mode="aspectFill" lazy-load />
|
||||||
<!-- <view v-if="isGrid" class="absolute left-0 bottom-0 w-full h-4 bg-gradient-to-b from-white/0 to-white" /> -->
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex flex-col gap-y-2 text-sm" :class="cardLayout.contentWrapper">
|
<view class="flex flex-col gap-y-3 text-sm" :class="cardLayout.contentWrapper">
|
||||||
<view class="truncate font-bold">
|
<view class="truncate font-bold text-3xs">
|
||||||
{{ article.spec.title }}
|
{{ article.spec.title }}
|
||||||
</view>
|
</view>
|
||||||
<view :class="isGrid ? 'content line-clamp-1 text-gray-600' : 'content line-clamp-2 text-gray-600'">
|
<view class="text-xs" :class="isGrid ? 'line-clamp-1 text-gray-600' : 'line-clamp-2 text-gray-600'">
|
||||||
{{ article.status?.excerpt }}
|
{{ article.status?.excerpt }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!isGrid" class="my-1 box-border flex flex-wrap gap-2" :class="cardLayout.tagCategory">
|
<view v-if="!isGrid" class="box-border flex flex-wrap gap-2" :class="cardLayout.tagCategory">
|
||||||
<template v-if="article.categories && article.categories.length !== 0">
|
<template v-if="article.categories && article.categories.length !== 0">
|
||||||
<text v-for="cate in article.categories" :key="cate.metadata.name"
|
<text v-for="cate in article.categories" :key="cate.metadata.name"
|
||||||
class="box-border uh-global-card-glass border uh-shadow-xs rounded-xl bg-secondary px-2 py-0.5 text-xs">
|
class="box-border uh-global-card-glass border uh-shadow-xs rounded-xl bg-secondary px-2 py-0.5 text-xs">
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
customClass ?: string | Array<string>;
|
customClass ?: string | Array<string>;
|
||||||
}
|
}
|
||||||
@@ -8,11 +14,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<IProps>();
|
const props = defineProps<IProps>();
|
||||||
const emit = defineEmits<IEmits>();
|
const emits = defineEmits<IEmits>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border bg-primary uh-shadow-xs text-black flex items-center justify-center text-sm px-4 py-1.5 rounded-lg" :class="props.customClass" @click="emit('click')">
|
<view
|
||||||
<slot></slot>
|
class="box-border bg-primary uh-shadow-xs text-black flex items-center justify-center text-sm px-4 py-1.5 rounded-lg"
|
||||||
|
:class="props.customClass" @click="emits('click')">
|
||||||
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -146,13 +146,8 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<block v-else>
|
<block v-else>
|
||||||
<view v-if="disallowComment && dataList.length !== 0"
|
<view v-if="dataList.length === 0" class=" py-12">
|
||||||
class="rounded-xl bg-gray-50 px-3 py-2 text-xs text-red-400">
|
<view class=" flex flex-col items-center">
|
||||||
Ծ‸Ծ 博主已设置该文章禁止评论!
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view v-if="dataList.length === 0" class="empty py-12">
|
|
||||||
<view class="empty-box flex flex-col items-center">
|
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-confused" size="100rpx" class="text-primary" />
|
<wd-icon class-prefix="uhemoji-icon" name="-confused" size="100rpx" class="text-primary" />
|
||||||
<text class="mt-2 text-sm text-gray-500">暂无评论</text>
|
<text class="mt-2 text-sm text-gray-500">暂无评论</text>
|
||||||
<view v-if="disallowComment" class="mt-2 text-xs text-red-400">
|
<view v-if="disallowComment" class="mt-2 text-xs text-red-400">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { checkUrl } from '@/utils/url'
|
import { checkUrl } from '@/utils/url'
|
||||||
import type { DataLoadingStatus } from '@/hooks/useDataLoading'
|
import type { DataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
loadingStatus ?: DataLoadingStatus
|
loadingStatus ?: DataLoadingStatus
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="w-full py-5 flex items-center justify-center gap-x-2 text-xs text-gray-400">
|
<view class="w-full py-4 flex items-center justify-center gap-x-2 text-xs text-gray-400">
|
||||||
<wd-loading v-if="props.status==='loading'" size="32rpx" color="#D7F94C"></wd-loading> {{ props.text }}
|
<wd-loading v-if="props.status==='loading'" size="32rpx" color="#D7F94C"></wd-loading> {{ props.text }}
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
/** 单列选项(wd-picker PickerOption 的宽松形态,label/value 与 wot 一致) */
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
interface IPickerOption {
|
interface IPickerOption {
|
||||||
label ?: string | number
|
label ?: string | number
|
||||||
value ?: string | number
|
value ?: string | number
|
||||||
@@ -11,7 +16,6 @@ interface IPickerOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
/** v-model:visible 是否显示 */
|
|
||||||
visible : boolean
|
visible : boolean
|
||||||
/** 弹层标题 */
|
/** 弹层标题 */
|
||||||
title ?: string
|
title ?: string
|
||||||
@@ -79,19 +83,16 @@ function handleCancel() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<wd-picker
|
<wd-picker :visible="visible" :title="title" :columns="columns" :model-value="modelValue"
|
||||||
:visible="visible" :title="title" :columns="columns" :model-value="modelValue"
|
|
||||||
:confirm-button-text="confirmButtonText" :cancel-button-text="cancelButtonText" :z-index="zIndex"
|
:confirm-button-text="confirmButtonText" :cancel-button-text="cancelButtonText" :z-index="zIndex"
|
||||||
:close-on-click-modal="closeOnClickModal" :safe-area-inset-bottom="safeAreaInsetBottom"
|
:close-on-click-modal="closeOnClickModal" :safe-area-inset-bottom="safeAreaInsetBottom"
|
||||||
:custom-class="pickerClass" @update:visible="handleUpdateVisible" @update:model-value="handleUpdateModelValue"
|
:custom-class="pickerClass" @update:visible="handleUpdateVisible" @update:model-value="handleUpdateModelValue"
|
||||||
@confirm="handleConfirm" @open="handleOpen" @cancel="handleCancel"
|
@confirm="handleConfirm" @open="handleOpen" @cancel="handleCancel">
|
||||||
>
|
|
||||||
<slot />
|
<slot />
|
||||||
</wd-picker>
|
</wd-picker>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
/* 弹层面板玻璃质感(与 uh-glass-popup 同款;wd-picker 内层 popup 挂 .wd-picker__popup) */
|
|
||||||
:deep(.wd-picker__popup .wd-popup) {
|
:deep(.wd-picker__popup .wd-popup) {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: rgb(255 255 255 / 85%);
|
background-color: rgb(255 255 255 / 85%);
|
||||||
@@ -103,7 +104,6 @@ function handleCancel() {
|
|||||||
-webkit-backdrop-filter: blur(24rpx) saturate(160%);
|
-webkit-backdrop-filter: blur(24rpx) saturate(160%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
|
|
||||||
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||||
:deep(.wd-picker__popup .wd-popup) {
|
:deep(.wd-picker__popup .wd-popup) {
|
||||||
background-color: rgb(255 255 255 / 88%);
|
background-color: rgb(255 255 255 / 88%);
|
||||||
|
|||||||
@@ -1,9 +1,30 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
/**
|
defineOptions({
|
||||||
* 玻璃质感弹窗:对 wd-popup 的二层封装。
|
options: {
|
||||||
* wd-popup 无背景/边框配置能力(index.scss 仅暴露 --wot-popup-bg 纯色变量),
|
styleIsolation: 'apply-shared',
|
||||||
* 故通过 custom-class 落到面板根元素后,用 :deep 覆盖为 uh-global-card-glass 同款效果。
|
},
|
||||||
*/
|
})
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
|
position: 'center',
|
||||||
|
zIndex: 10,
|
||||||
|
closable: false,
|
||||||
|
modal: true,
|
||||||
|
closeOnClickModal: true,
|
||||||
|
safeAreaInsetBottom: false,
|
||||||
|
radius: '',
|
||||||
|
round: false,
|
||||||
|
lazyRender: true,
|
||||||
|
hideWhenClose: true,
|
||||||
|
customStyle: '',
|
||||||
|
customClass: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<IEmits>()
|
||||||
|
|
||||||
|
/** 动画时长(ms),与 wd-popup 默认一致 */
|
||||||
|
const DURATION = 300
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
/** v-model:是否显示 */
|
/** v-model:是否显示 */
|
||||||
modelValue : boolean
|
modelValue : boolean
|
||||||
@@ -19,14 +40,17 @@
|
|||||||
closeOnClickModal ?: boolean
|
closeOnClickModal ?: boolean
|
||||||
/** 底部安全距离适配(iphone X 类机型) */
|
/** 底部安全距离适配(iphone X 类机型) */
|
||||||
safeAreaInsetBottom ?: boolean
|
safeAreaInsetBottom ?: boolean
|
||||||
/** 面板圆角(内联生效,优先级最高);传 wot 自带 round 时圆角由位置自动适配 */
|
/** 面板圆角(内联生效,优先级最高);与 round 二选一 */
|
||||||
radius ?: string
|
radius ?: string
|
||||||
/** 是否开启 wot 位置自适应圆角(bottom→上圆角 / center→四圆角等),与 radius 二选一 */
|
/** 位置自适应圆角(bottom→上圆角 / center→四圆角等),与 radius 二选一 */
|
||||||
round ?: boolean
|
round ?: boolean
|
||||||
|
/** 弹层内容懒渲染,首次显示时才渲染 */
|
||||||
lazyRender ?: boolean
|
lazyRender ?: boolean
|
||||||
|
/** 关闭动画结束后是否隐藏面板(display:none);false 时保留渲染(内部状态不丢) */
|
||||||
hideWhenClose ?: boolean
|
hideWhenClose ?: boolean
|
||||||
/** 追加到面板的内联样式,如宽度:width:640rpx; */
|
/** 追加到面板的内联样式,如宽度:width:640rpx; */
|
||||||
customStyle ?: string
|
customStyle ?: string
|
||||||
|
/** 追加到面板的类名(如 UnoCSS 原子类) */
|
||||||
customClass ?: string
|
customClass ?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,76 +61,362 @@
|
|||||||
(e : 'click-modal') : void
|
(e : 'click-modal') : void
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<IProps>(), {
|
/* ---------------- 动画状态机 ---------------- */
|
||||||
position: 'center',
|
/** 首次显示后才渲染(lazyRender) */
|
||||||
zIndex: 10,
|
const inited = ref(false)
|
||||||
closable: false,
|
/** 是否渲染显示(关闭动画结束后 hideWhenClose 时置 false) */
|
||||||
modal: true,
|
const display = ref(false)
|
||||||
closeOnClickModal: true,
|
/** 动画阶段: enter / enter-to / leave / leave-to / '' */
|
||||||
safeAreaInsetBottom: false,
|
const phase = ref('')
|
||||||
radius: '',
|
|
||||||
round: false,
|
/** 动画名称(按位置):center 组合 zoom-in + fade */
|
||||||
lazyRender: true,
|
const transitionName = computed(() => {
|
||||||
hideWhenClose: true,
|
switch (props.position) {
|
||||||
customStyle: '',
|
case 'center':
|
||||||
customClass:''
|
return ['zoom-in', 'fade']
|
||||||
|
case 'left':
|
||||||
|
return 'slide-left'
|
||||||
|
case 'right':
|
||||||
|
return 'slide-right'
|
||||||
|
case 'top':
|
||||||
|
return 'slide-down'
|
||||||
|
default:
|
||||||
|
return 'slide-up'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<IEmits>()
|
const isShow = computed(() => !props.lazyRender || inited.value)
|
||||||
|
|
||||||
|
const panelClasses = computed(() => {
|
||||||
|
const names = Array.isArray(transitionName.value) ? transitionName.value : [transitionName.value]
|
||||||
|
let cls = `uh-glass-popup-panel uh-glass-popup-panel--${props.position} ${props.customClass}`
|
||||||
|
if (props.round) { cls += ' is-round' }
|
||||||
|
if (phase.value) {
|
||||||
|
const act = phase.value.startsWith('enter') ? 'enter-active' : 'leave-active'
|
||||||
|
for (const name of names) {
|
||||||
|
cls += ` uh-glass-popup-anim--${name}-${phase.value} uh-glass-popup-anim--${name}-${act}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cls
|
||||||
|
})
|
||||||
|
|
||||||
|
const maskClasses = computed(() => {
|
||||||
|
if (!phase.value) { return 'uh-glass-popup__mask' }
|
||||||
|
const act = phase.value.startsWith('enter') ? 'enter-active' : 'leave-active'
|
||||||
|
return `uh-glass-popup__mask uh-glass-popup-anim--fade-${phase.value} uh-glass-popup-anim--fade-${act}`
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 底部安全距离 */
|
||||||
|
const safeBottom = ref(0)
|
||||||
|
|
||||||
const panelStyle = computed(() => {
|
const panelStyle = computed(() => {
|
||||||
return props.customStyle
|
let style = `z-index:${props.zIndex};`
|
||||||
|
// hideWhenClose 且关闭动画结束:display:none 释放层级
|
||||||
|
if (!display.value && props.hideWhenClose) { style += 'display:none;' }
|
||||||
|
// 静止隐藏态(未开过或关闭后动画结束):透明 + 不拦截点击
|
||||||
|
if (!props.modelValue && !phase.value) { style += 'opacity:0;' }
|
||||||
|
if (!props.modelValue) { style += 'pointer-events:none;' }
|
||||||
|
if (safeBottom.value) { style += `padding-bottom:${safeBottom.value}px;` }
|
||||||
|
if (props.radius) { style += `border-radius:${props.radius};` }
|
||||||
|
return style + props.customStyle
|
||||||
})
|
})
|
||||||
|
|
||||||
const panelClass = computed(() =>{
|
const maskStyle = computed(() => {
|
||||||
return `uh-glass-popup-panel ${props.customClass}`
|
let style = `z-index:${props.zIndex};`
|
||||||
|
// 遮罩跟随面板的显隐
|
||||||
|
if (!display.value && props.hideWhenClose) { style += 'display:none;' }
|
||||||
|
if (!props.modelValue && !phase.value) { style += 'opacity:0;' }
|
||||||
|
// 关闭后透明且不拦截点击(hideWhenClose=false 保留渲染时仍需可穿透)
|
||||||
|
if (!props.modelValue) { style += 'pointer-events:none;' }
|
||||||
|
return style
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function sleep(ms : number) {
|
||||||
|
return new Promise<void>(resolve => setTimeout(resolve, ms))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 状态机是否在运行(防重入) */
|
||||||
|
let running = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动画状态机:以 modelValue 为目标循环推进,
|
||||||
|
* 运行期间若目标变化(快速开关)则重新评估,直到状态稳定
|
||||||
|
*/
|
||||||
|
async function runTransition() {
|
||||||
|
if (running) { return }
|
||||||
|
running = true
|
||||||
|
try {
|
||||||
|
// 首次打开才渲染内容(lazyRender)
|
||||||
|
if (props.modelValue) {
|
||||||
|
inited.value = true
|
||||||
|
display.value = true
|
||||||
|
}
|
||||||
|
// 循环推进直到与 modelValue 一致
|
||||||
|
while (true) {
|
||||||
|
const target = props.modelValue
|
||||||
|
if (target) {
|
||||||
|
phase.value = 'enter'
|
||||||
|
await sleep(50)
|
||||||
|
if (props.modelValue !== target) { continue }
|
||||||
|
phase.value = 'enter-to'
|
||||||
|
emit('open')
|
||||||
|
await sleep(DURATION)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!display.value) {
|
||||||
|
// 从未渲染,无需动画
|
||||||
|
break
|
||||||
|
}
|
||||||
|
phase.value = 'leave'
|
||||||
|
await sleep(50)
|
||||||
|
if (props.modelValue !== target) { continue }
|
||||||
|
phase.value = 'leave-to'
|
||||||
|
await sleep(DURATION + 50)
|
||||||
|
if (props.modelValue !== target) { continue }
|
||||||
|
if (props.hideWhenClose) { display.value = false }
|
||||||
|
}
|
||||||
|
if (props.modelValue === target) {
|
||||||
|
// 状态稳定
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
running = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
() => {
|
||||||
|
runTransition()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
/* ---------------- 遮罩与安全区 ---------------- */
|
||||||
|
function handleClickModal() {
|
||||||
|
emit('click-modal')
|
||||||
|
if (props.closeOnClickModal)
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
emit('close')
|
||||||
|
emit('update:modelValue', false)
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
if (props.safeAreaInsetBottom) {
|
||||||
|
const { safeArea, screenHeight, safeAreaInsets } = uni.getWindowInfo()
|
||||||
|
|
||||||
|
if (safeArea) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
safeBottom.value = screenHeight - (safeArea.bottom || 0)
|
||||||
|
// #endif
|
||||||
|
// #ifndef MP-WEIXIN
|
||||||
|
safeBottom.value = safeAreaInsets ? safeAreaInsets.bottom : 0
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
safeBottom.value = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 初始即为打开状态:直接播放进入动画
|
||||||
|
if (props.modelValue) { runTransition() }
|
||||||
|
})
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
// 锁定 body 滚动,防止弹层打开时页面穿透滚动
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(val) => {
|
||||||
|
document.body.style.overflow = val ? 'hidden' : ''
|
||||||
|
},
|
||||||
|
)
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
// 卸载时若弹层仍打开,恢复 body 滚动,避免滚动锁残留
|
||||||
|
document.body.style.overflow = ''
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<wd-popup
|
<view v-if="isShow">
|
||||||
:model-value="modelValue"
|
<!-- 遮罩层 -->
|
||||||
:position="position"
|
<view v-if="modal" class="uh-glass-popup__mask" :class="maskClasses" :style="maskStyle"
|
||||||
:z-index="zIndex"
|
@click="handleClickModal" @touchmove.stop.prevent />
|
||||||
:closable="closable"
|
<!-- 面板层 -->
|
||||||
:modal="modal"
|
<view :class="panelClasses" :style="panelStyle">
|
||||||
:close-on-click-modal="closeOnClickModal"
|
<slot />
|
||||||
:hide-when-close="hideWhenClose"
|
<view v-if="closable" class="uh-glass-popup__close" @click="close">
|
||||||
:safe-area-inset-bottom="safeAreaInsetBottom"
|
<text class="uh-glass-popup__close-icon">×</text>
|
||||||
:round="round"
|
</view>
|
||||||
:custom-style="panelStyle"
|
</view>
|
||||||
:custom-class="panelClass"
|
</view>
|
||||||
:lazy-render="lazyRender"
|
|
||||||
@update:model-value="(value: boolean) => emit('update:modelValue', value)"
|
|
||||||
@close="emit('close')"
|
|
||||||
@enter="emit('open')"
|
|
||||||
@click-modal="emit('click-modal')"
|
|
||||||
>
|
|
||||||
<slot></slot>
|
|
||||||
</wd-popup>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
/* 面板根元素(.wd-popup)同挂 custom-class,双类选择器提高优先级,覆盖 wot 默认纯白底 */
|
.uh-glass-popup__mask {
|
||||||
:deep(.wd-popup.uh-glass-popup-panel) {
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgb(0 0 0 / 55%);
|
||||||
|
transition-timing-function: ease;
|
||||||
|
transition-duration: 300ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
position: fixed;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
background-color: rgb(255 255 255 / 85%);
|
background-color: rgb(255 255 255 / 85%);
|
||||||
border: 4rpx solid rgb(255 255 255 / 90%);
|
border: 4rpx solid rgb(255 255 255 / 90%);
|
||||||
box-shadow: inset 0 1rpx 0 rgb(255 255 255 / 75%), 0 8rpx 32rpx rgb(90 105 200 / 14%);
|
box-shadow:
|
||||||
|
inset 0 1rpx 0 rgb(255 255 255 / 75%),
|
||||||
|
0 8rpx 32rpx rgb(90 105 200 / 14%);
|
||||||
backdrop-filter: blur(24rpx) saturate(160%);
|
backdrop-filter: blur(24rpx) saturate(160%);
|
||||||
-webkit-backdrop-filter: blur(24rpx) saturate(160%);
|
-webkit-backdrop-filter: blur(24rpx) saturate(160%);
|
||||||
}
|
transition-timing-function: ease;
|
||||||
|
transition-duration: 300ms;
|
||||||
|
|
||||||
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
|
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
|
||||||
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||||
:deep(.wd-popup.uh-glass-popup-panel) {
|
|
||||||
background-color: rgb(255 255 255 / 88%);
|
background-color: rgb(255 255 255 / 88%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.wd-popup--bottom){
|
/* 位置 */
|
||||||
|
.uh-glass-popup-panel--center {
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translate3d(-50%, -50%, 0);
|
||||||
|
transform-origin: 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--top {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--bottom {
|
||||||
left: 24rpx;
|
left: 24rpx;
|
||||||
bottom: 24rpx;
|
bottom: 24rpx;
|
||||||
right: 24rpx;
|
right: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--left {
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--right {
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 位置自适应圆角(round) */
|
||||||
|
.uh-glass-popup-panel--bottom.is-round {
|
||||||
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--top.is-round {
|
||||||
|
border-radius: 0 0 16rpx 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--left.is-round {
|
||||||
|
border-radius: 0 16rpx 16rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--right.is-round {
|
||||||
|
border-radius: 16rpx 0 0 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-panel--center.is-round {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 动画帧(enter 与 leave-to) */
|
||||||
|
.uh-glass-popup-anim--slide-up-enter,
|
||||||
|
.uh-glass-popup-anim--slide-up-leave-to {
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--slide-down-enter,
|
||||||
|
.uh-glass-popup-anim--slide-down-leave-to {
|
||||||
|
transform: translate3d(0, -100%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--slide-left-enter,
|
||||||
|
.uh-glass-popup-anim--slide-left-leave-to {
|
||||||
|
transform: translate3d(-100%, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--slide-right-enter,
|
||||||
|
.uh-glass-popup-anim--slide-right-leave-to {
|
||||||
|
transform: translate3d(100%, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--zoom-in-enter,
|
||||||
|
.uh-glass-popup-anim--zoom-in-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--fade-enter,
|
||||||
|
.uh-glass-popup-anim--fade-leave-to {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 动画激活态(transition-property) */
|
||||||
|
.uh-glass-popup-anim--slide-up-enter-active,
|
||||||
|
.uh-glass-popup-anim--slide-up-leave-active,
|
||||||
|
.uh-glass-popup-anim--slide-down-enter-active,
|
||||||
|
.uh-glass-popup-anim--slide-down-leave-active,
|
||||||
|
.uh-glass-popup-anim--slide-left-enter-active,
|
||||||
|
.uh-glass-popup-anim--slide-left-leave-active,
|
||||||
|
.uh-glass-popup-anim--slide-right-enter-active,
|
||||||
|
.uh-glass-popup-anim--slide-right-leave-active {
|
||||||
|
transition-property: transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup-anim--zoom-in-enter-active,
|
||||||
|
.uh-glass-popup-anim--zoom-in-leave-active,
|
||||||
|
.uh-glass-popup-anim--fade-enter-active,
|
||||||
|
.uh-glass-popup-anim--fade-leave-active {
|
||||||
|
transition-property: opacity, transform;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* center 缩放需叠加居中位移 */
|
||||||
|
.uh-glass-popup-panel--center.uh-glass-popup-anim--zoom-in-enter,
|
||||||
|
.uh-glass-popup-panel--center.uh-glass-popup-anim--zoom-in-leave-to {
|
||||||
|
transform: scale(0.8) translate3d(-50%, -50%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 右上角关闭按钮 */
|
||||||
|
.uh-glass-popup__close {
|
||||||
|
position: absolute;
|
||||||
|
top: 32rpx;
|
||||||
|
right: 32rpx;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-glass-popup__close-icon {
|
||||||
|
font-size: 48rpx;
|
||||||
|
line-height: 1;
|
||||||
|
color: rgb(0 0 0 / 45%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
/** v-model:是否显示 */
|
||||||
|
modelValue : boolean
|
||||||
|
/** 弹出位置 */
|
||||||
|
position ?: 'center' | 'top' | 'right' | 'bottom' | 'left'
|
||||||
|
/** 层级 */
|
||||||
|
zIndex ?: number
|
||||||
|
/** 是否显示右上角关闭图标 */
|
||||||
|
closable ?: boolean
|
||||||
|
/** 是否显示遮罩 */
|
||||||
|
modal ?: boolean
|
||||||
|
/** 点击遮罩是否关闭 */
|
||||||
|
closeOnClickModal ?: boolean
|
||||||
|
/** 底部安全距离适配(iphone X 类机型) */
|
||||||
|
safeAreaInsetBottom ?: boolean
|
||||||
|
/** 面板圆角(内联生效,优先级最高);传 wot 自带 round 时圆角由位置自动适配 */
|
||||||
|
radius ?: string
|
||||||
|
/** 是否开启 wot 位置自适应圆角(bottom→上圆角 / center→四圆角等),与 radius 二选一 */
|
||||||
|
round ?: boolean
|
||||||
|
lazyRender ?: boolean
|
||||||
|
hideWhenClose?: boolean
|
||||||
|
/** 追加到面板的内联样式,如宽度:width:640rpx; */
|
||||||
|
customStyle ?: string
|
||||||
|
customClass? :string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IEmits {
|
||||||
|
(e : 'update:modelValue', value : boolean) : void
|
||||||
|
(e : 'close') : void
|
||||||
|
(e : 'open') : void
|
||||||
|
(e : 'click-modal') : void
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
|
position: 'center',
|
||||||
|
zIndex: 10,
|
||||||
|
closable: false,
|
||||||
|
modal: true,
|
||||||
|
closeOnClickModal: true,
|
||||||
|
safeAreaInsetBottom: false,
|
||||||
|
radius: '',
|
||||||
|
round: false,
|
||||||
|
lazyRender: true,
|
||||||
|
hideWhenClose: true,
|
||||||
|
customStyle: '',
|
||||||
|
customClass:''
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<IEmits>()
|
||||||
|
|
||||||
|
const panelStyle = computed(() => {
|
||||||
|
return props.customStyle
|
||||||
|
})
|
||||||
|
|
||||||
|
const panelClass = computed(() =>{
|
||||||
|
return `uh-glass-popup-panel ${props.customClass}`
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<wd-popup
|
||||||
|
:model-value="modelValue"
|
||||||
|
:position="position"
|
||||||
|
:z-index="zIndex"
|
||||||
|
:closable="closable"
|
||||||
|
:modal="modal"
|
||||||
|
:close-on-click-modal="closeOnClickModal"
|
||||||
|
:hide-when-close="hideWhenClose"
|
||||||
|
:safe-area-inset-bottom="safeAreaInsetBottom"
|
||||||
|
:round="round"
|
||||||
|
:custom-style="panelStyle"
|
||||||
|
:custom-class="panelClass"
|
||||||
|
:lazy-render="lazyRender"
|
||||||
|
@update:model-value="(value: boolean) => emit('update:modelValue', value)"
|
||||||
|
@close="emit('close')"
|
||||||
|
@enter="emit('open')"
|
||||||
|
@click-modal="emit('click-modal')"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</wd-popup>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
:deep(.wd-popup.uh-glass-popup-panel) {
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: rgb(255 255 255 / 85%);
|
||||||
|
border: 4rpx solid rgb(255 255 255 / 90%);
|
||||||
|
box-shadow: inset 0 1rpx 0 rgb(255 255 255 / 75%), 0 8rpx 32rpx rgb(90 105 200 / 14%);
|
||||||
|
backdrop-filter: blur(24rpx) saturate(160%);
|
||||||
|
-webkit-backdrop-filter: blur(24rpx) saturate(160%);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
|
||||||
|
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
||||||
|
:deep(.wd-popup.uh-glass-popup-panel) {
|
||||||
|
background-color: rgb(255 255 255 / 88%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.wd-popup--bottom){
|
||||||
|
left:24rpx;
|
||||||
|
bottom:24rpx;
|
||||||
|
right:24rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="absolute bottom-0 left-0 right-0 h-12 w-full bg-gradient-to-b from-white/0 to-page" />
|
<view class="absolute bottom-0 left-0 right-0 h-12 w-full bg-gradient-to-b from-white/0 to-page" />
|
||||||
<view class="absolute left-0 right-0 z-10 flex items-center justify-center -translate-y-6">
|
<view class="absolute left-0 right-0 z-10 flex items-center justify-center uh-translate-y-n6">
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass border w-4/5 rounded-full px-4 py-2 text-sm text-gray-600 flex items-center justify-center gap-x-2"
|
class="uh-global-card-glass border w-4/5 rounded-full px-4 py-2 text-sm text-gray-600 flex items-center justify-center gap-x-2"
|
||||||
@click="handleToSearch()">
|
@click="handleToSearch()">
|
||||||
@@ -130,3 +130,10 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 向上偏移定位 */
|
||||||
|
.uh-translate-y-n6 {
|
||||||
|
transform: translateY(-1.5rem);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -75,8 +75,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="isEnableCategoryModule" class="mb-6">
|
<view v-if="isEnableCategoryModule" class="overflow-hidden box-border mb-6 px-3">
|
||||||
<uh-section-title class="mb-4 px-3 box-border">
|
<uh-section-title>
|
||||||
精选分类
|
精选分类
|
||||||
<template #right>
|
<template #right>
|
||||||
<view class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
|
<view class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
|
||||||
@@ -86,21 +86,21 @@
|
|||||||
</template>
|
</template>
|
||||||
</uh-section-title>
|
</uh-section-title>
|
||||||
|
|
||||||
<view v-if="loading!=='success'" class="box-border px-3">
|
<view v-if="loading!=='success'" class="mt-4 box-border">
|
||||||
<view class="uh-global-card-glass shadow-none rounded-xl">
|
<view class="uh-global-card-glass shadow-none rounded-xl">
|
||||||
<uh-data-loading :loading-status="loading" min-height="28vh" size="small" :use-refresh-button="true"
|
<uh-data-loading :loading-status="loading" min-height="28vh" size="small" :use-refresh-button="true"
|
||||||
@refresh="handleGetCategoryList()" />
|
@refresh="handleGetCategoryList()" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else class="w-full grid grid-cols-2 grid-rows-auto h-42 box-border px-3 gap-2">
|
<view v-else class="mt-4 w-full grid grid-cols-2 grid-rows-auto h-42 box-border gap-2">
|
||||||
<view v-for="(category,index) in categoryList" :key="category.metadata.name"
|
<view v-for="(category,index) in categoryList" :key="category.metadata.name"
|
||||||
class="uh-global-card-glass relative w-full h-full overflow-hidden rounded-xl text-center text-white"
|
class="uh-global-card-glass relative w-full h-full overflow-hidden rounded-xl text-center text-white"
|
||||||
:class="{'grid-row-span-2':index===0 }" @click="handleToCategoryBy(category)">
|
:class="{'grid-row-span-2':index===0 }" @click="handleToCategoryBy(category)">
|
||||||
<image :src="category.spec.cover" class="w-full h-full" mode="aspectFill" lazy-load />
|
<image :src="category.spec.cover" class="w-full h-full" mode="aspectFill" lazy-load />
|
||||||
<view class="absolute bottom-0 left-0 h-[140rpx] w-full bg-gradient-to-b from-black/0 to-black/30" />
|
<view class="absolute bottom-0 left-0 h-16 w-full bg-gradient-to-b from-black/0 to-black/30" />
|
||||||
<view class="absolute left-2 bottom-2 flex z-2 flex-col text-left">
|
<view class="absolute left-2 bottom-2 flex z-2 flex-col text-left">
|
||||||
<text class="text-sm font-bold">
|
<text class="text-2xs font-semibold">
|
||||||
{{ category.spec.displayName }}
|
{{ category.spec.displayName }}
|
||||||
</text>
|
</text>
|
||||||
<text class="mt-1 text-xs text-gray-200">共 {{ category.postCount ?? 0 }} 篇</text>
|
<text class="mt-1 text-xs text-gray-200">共 {{ category.postCount ?? 0 }} 篇</text>
|
||||||
|
|||||||
@@ -8,106 +8,26 @@
|
|||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
const calcIsShowQuickNavigationEnabled = computed(() => haloConfigs.value.pageConfig?.homeConfig?.useQuickNavigation)
|
const calcIsShowQuickNavigationEnabled = computed(() => haloConfigs.value.pageConfig?.homeConfig?.useQuickNavigation)
|
||||||
|
|
||||||
interface QuickNavItem {
|
|
||||||
key : string
|
|
||||||
title ?: string
|
|
||||||
subTitle ?: string
|
|
||||||
color ?: string
|
|
||||||
bgColor ?: string
|
|
||||||
iconPrefix ?: string
|
|
||||||
icon ?: string
|
|
||||||
path ?: string
|
|
||||||
visible ?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const useLocalNav = false
|
|
||||||
const DEFAULT_NAV_LIST : QuickNavItem[] = [
|
|
||||||
{
|
|
||||||
key: 'archives',
|
|
||||||
title: '文章归档',
|
|
||||||
subTitle: '全部文章',
|
|
||||||
color: '#03A9F4',
|
|
||||||
bgColor: '#03A9F424',
|
|
||||||
iconPrefix: 'uhemoji2-icon',
|
|
||||||
icon: '-mask',
|
|
||||||
path: '/pages-blog/archives/archives',
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'vote',
|
|
||||||
title: '投票中心',
|
|
||||||
color: '#00BCD4',
|
|
||||||
bgColor: '#00BCD424',
|
|
||||||
iconPrefix: 'uhemoji2-icon',
|
|
||||||
icon: '-confused',
|
|
||||||
path: '/pages-blog/votes/votes',
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'disclaimers',
|
|
||||||
title: '友情链接',
|
|
||||||
color: '#009688',
|
|
||||||
bgColor: '#00968824',
|
|
||||||
iconPrefix: 'uhemoji2-icon',
|
|
||||||
icon: '-wink',
|
|
||||||
path: '/pages-blog/friend-links/friend-links',
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'love',
|
|
||||||
title: '恋爱日记',
|
|
||||||
color: '#FF4C67',
|
|
||||||
bgColor: '#FF4C6724',
|
|
||||||
iconPrefix: 'uhemoji2-icon',
|
|
||||||
icon: '-in-love',
|
|
||||||
path: '/pages-blog/love/love',
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'contact-blogger',
|
|
||||||
title: '联系博主',
|
|
||||||
color: '#FF9800',
|
|
||||||
bgColor: '#FF980024',
|
|
||||||
iconPrefix: 'uhemoji2-icon',
|
|
||||||
icon: '-cool',
|
|
||||||
path: '/pages-blog/contact/contact',
|
|
||||||
visible: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const navList = computed(() => {
|
const navList = computed(() => {
|
||||||
const configured = haloConfigs.value.pageConfig?.homeConfig?.quickNavigation
|
const configured = haloConfigs.value.pageConfig?.homeConfig?.quickNavigation
|
||||||
let list : QuickNavItem[]
|
return configured.filter(item => item.visible !== false)
|
||||||
if (!useLocalNav && configured && configured.length) {
|
|
||||||
list = configured.map(item => {
|
|
||||||
const fallback = DEFAULT_NAV_LIST.find(d => d.key === item.key) || DEFAULT_NAV_LIST[0]
|
|
||||||
return { ...fallback, ...item }
|
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
list = DEFAULT_NAV_LIST;
|
|
||||||
}
|
|
||||||
return list.filter(item => item.visible !== false)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
function handleClickNav(item : { path ?: string }) {
|
function handleClickNav(item : { path ?: string }) {
|
||||||
if (!item.path)
|
if (!item.path) { return }
|
||||||
return
|
|
||||||
uni.navigateTo({ url: item.path })
|
uni.navigateTo({ url: item.path })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="calcIsShowQuickNavigationEnabled && navList.length"
|
<view v-if="calcIsShowQuickNavigationEnabled && navList.length"
|
||||||
class="box-border overflow-hidden rounded-xl p-3 px-4 mb-3">
|
class="box-border overflow-hidden rounded-xl p-3 mb-3">
|
||||||
<uh-section-title class="mb-4">
|
<uh-section-title> 快捷导航 </uh-section-title>
|
||||||
快捷导航
|
<view class="mt-4 grid grid-cols-5 gap-4">
|
||||||
</uh-section-title>
|
|
||||||
<view class="grid grid-cols-5 gap-4">
|
|
||||||
<view v-for="item in navList" :key="item.key" class="flex flex-col items-center gap-2"
|
<view v-for="item in navList" :key="item.key" class="flex flex-col items-center gap-2"
|
||||||
@click="handleClickNav(item)">
|
@click="handleClickNav(item)">
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass uh-shadow-xs h-13 w-13 flex items-center justify-center rounded-2xl border transition-transform active:scale-90"
|
class="uh-global-card-glass uh-shadow-xs h-13 w-13 flex items-center justify-center rounded-2xl border"
|
||||||
:style="{
|
:style="{
|
||||||
backgroundColor: item.bgColor
|
backgroundColor: item.bgColor
|
||||||
}">
|
}">
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
/**
|
defineOptions({
|
||||||
* 友链底部悬浮操作栏(通用组件)
|
options: {
|
||||||
* 通过 :actions 控制显示的按钮,事件回调 emit('apply') / emit('info')
|
styleIsolation: 'apply-shared'
|
||||||
* 站点 tab / 小程序 tab 分别引入(如 :actions="['apply','info']" @apply=... @info=...)
|
}
|
||||||
*/
|
})
|
||||||
withDefaults(defineProps<{
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
/** 需要显示的按钮:apply=提交申请,info=友链信息;包含即显示 */
|
/** 需要显示的按钮:apply=提交申请,info=友链信息;包含即显示 */
|
||||||
actions ?: string[]
|
actions ?: string[]
|
||||||
}>(), {
|
}>(), {
|
||||||
@@ -18,24 +19,27 @@ const emit = defineEmits<{
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
|
<view class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
|
||||||
<view class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
|
||||||
<view
|
<view
|
||||||
v-if="actions.includes('apply')"
|
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
||||||
|
<view v-if="actions.includes('apply')"
|
||||||
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
|
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
|
||||||
@click="emit('apply')"
|
@click="emit('apply')">
|
||||||
>
|
|
||||||
<wd-icon name="edit" size="36rpx" />
|
<wd-icon name="edit" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold">提交申请</text>
|
<text class="shrink-0 text-sm text-gray-900 font-semibold">提交申请</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view v-if="actions.includes('info')"
|
||||||
v-if="actions.includes('info')"
|
|
||||||
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
|
class="uh-global-card-glass box-border h-9 flex flex-1 items-center justify-center gap-x-1 border rounded-full px-8 shadow-none"
|
||||||
@click="emit('info')"
|
@click="emit('info')">
|
||||||
>
|
|
||||||
<wd-icon name="info" size="36rpx" />
|
<wd-icon name="info" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold">友链信息</text>
|
<text class="shrink-0 text-sm text-gray-900 font-semibold">友链信息</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.uh-translate-x-center {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -3,6 +3,12 @@
|
|||||||
import { getPluginCaptcha, submitMiniProgramLinkApplication } from '@/api/uni-halo'
|
import { getPluginCaptcha, submitMiniProgramLinkApplication } from '@/api/uni-halo'
|
||||||
import type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
|
import type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
show ?: boolean
|
show ?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
/**
|
|
||||||
* 小程序友链信息弹窗
|
|
||||||
* 展示本站小程序申请提交的信息,字段结构与小程序提交申请弹窗(uh-links-mini-apply)一致:
|
|
||||||
* 小程序名称/太阳码/跳转地址/作者昵称/作者头像/作者网站/描述/申请说明/邮箱
|
|
||||||
* 数据源:插件端 getConfigs.pluginConfig.linkInfo(字段名与插件端一致,无映射;
|
|
||||||
* displayName/miniProgramCode/link/description/applyRemark/authorName/avatar/website;
|
|
||||||
* email 不在插件端维护,读不到时弹窗该栏自动隐藏)
|
|
||||||
*/
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
show ?: boolean
|
show ?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
@@ -109,19 +107,15 @@ watch(() => props.show, (val) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<uh-glass-popup
|
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" custom-class="!border rounded-xl"
|
||||||
v-model="isShow" :z-index="100" position="bottom"
|
@close="handleClose">
|
||||||
custom-class="!border rounded-xl" @close="handleClose"
|
|
||||||
>
|
|
||||||
<view class="relative box-border w-full flex items-center justify-around px-4 pt-4">
|
<view class="relative box-border w-full flex items-center justify-around px-4 pt-4">
|
||||||
<view class="w-full flex flex-col gap-y-1">
|
<view class="w-full flex flex-col gap-y-1">
|
||||||
<text class="text-md font-bold">小程序友链信息</text>
|
<text class="text-md font-bold">小程序友链信息</text>
|
||||||
<text class="text-xs text-gray-500">本站小程序申请提交的信息,欢迎互换</text>
|
<text class="text-xs text-gray-500">本站小程序申请提交的信息,欢迎互换</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
||||||
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
@click="handleClose">
|
||||||
@click="handleClose"
|
|
||||||
>
|
|
||||||
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -135,11 +129,8 @@ watch(() => props.show, (val) => {
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<!-- 太阳码大图(点击预览) -->
|
<!-- 太阳码大图(点击预览) -->
|
||||||
<view v-if="miniInfo.miniProgramCode" class="code-area flex flex-col items-center">
|
<view v-if="miniInfo.miniProgramCode" class="code-area flex flex-col items-center">
|
||||||
<image
|
<image class="code-img h-32 w-32 rounded-xl" :src="checkImageUrl(miniInfo.miniProgramCode)"
|
||||||
class="code-img h-32 w-32 rounded-xl"
|
mode="aspectFill" @click="handlePreviewCode" />
|
||||||
:src="checkImageUrl(miniInfo.miniProgramCode)" mode="aspectFill"
|
|
||||||
@click="handlePreviewCode"
|
|
||||||
/>
|
|
||||||
<view class="code-tip mt-3 flex items-center text-xs text-gray-400">
|
<view class="code-tip mt-3 flex items-center text-xs text-gray-400">
|
||||||
<wd-icon name="picture" size="14px" color="#a8a294" />
|
<wd-icon name="picture" size="14px" color="#a8a294" />
|
||||||
<text class="ml-1">点击预览太阳码</text>
|
<text class="ml-1">点击预览太阳码</text>
|
||||||
@@ -157,43 +148,34 @@ watch(() => props.show, (val) => {
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 作者信息 -->
|
<!-- 作者信息 -->
|
||||||
<view
|
<view v-if="miniInfo.authorName || miniInfo.avatar || miniInfo.website"
|
||||||
v-if="miniInfo.authorName || miniInfo.avatar || miniInfo.website"
|
class="mini-author-info mt-5 flex items-center rounded-xl bg-[#f6f3ee] p-4">
|
||||||
class="mini-author-info mt-5 flex items-center rounded-xl bg-[#f6f3ee] p-4"
|
<image v-if="miniInfo.avatar" class="author-avatar h-[72rpx] w-[72rpx] shrink-0 rounded-full"
|
||||||
>
|
:src="checkAvatarUrl(miniInfo.avatar)" mode="aspectFill" />
|
||||||
<image
|
|
||||||
v-if="miniInfo.avatar" class="author-avatar h-[72rpx] w-[72rpx] shrink-0 rounded-full"
|
|
||||||
:src="checkAvatarUrl(miniInfo.avatar)" mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view class="author-detail ml-4 flex flex-1 flex-col">
|
<view class="author-detail ml-4 flex flex-1 flex-col">
|
||||||
<text
|
<text v-if="miniInfo.authorName" class="author-name text-[28rpx] text-gray-900 font-medium">
|
||||||
v-if="miniInfo.authorName"
|
|
||||||
class="author-name text-[28rpx] text-gray-900 font-medium"
|
|
||||||
>
|
|
||||||
{{ miniInfo.authorName }}
|
{{ miniInfo.authorName }}
|
||||||
</text>
|
</text>
|
||||||
<text
|
<text v-if="miniInfo.website"
|
||||||
v-if="miniInfo.website"
|
class="author-website mt-1 overflow-hidden truncate whitespace-nowrap text-xs text-gray-400">
|
||||||
class="author-website mt-1 overflow-hidden truncate whitespace-nowrap text-xs text-gray-400"
|
|
||||||
>
|
|
||||||
网站:{{ miniInfo.website }}
|
网站:{{ miniInfo.website }}
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 跳转地址 -->
|
<!-- 跳转地址 -->
|
||||||
<view v-if="miniInfo.link" class="mini-link mt-5 flex items-center justify-between rounded-xl bg-secondary p-4">
|
<view v-if="miniInfo.link"
|
||||||
<view class="link-text flex-1 overflow-hidden truncate whitespace-nowrap text-[26rpx] text-[#4d7c0f]">
|
class="mini-link mt-5 flex items-center justify-between rounded-xl bg-secondary p-4">
|
||||||
|
<view
|
||||||
|
class="link-text flex-1 overflow-hidden truncate whitespace-nowrap text-[26rpx] text-[#4d7c0f]">
|
||||||
{{ miniInfo.link }}
|
{{ miniInfo.link }}
|
||||||
</view>
|
</view>
|
||||||
<text class="ml-3 shrink-0 text-[26rpx] text-[#4d7c0f] font-bold" @click="handleCopyLink">复制</text>
|
<text class="ml-3 shrink-0 text-[26rpx] text-[#4d7c0f] font-bold" @click="handleCopyLink">复制</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 申请说明 / 邮箱 -->
|
<!-- 申请说明 / 邮箱 -->
|
||||||
<view
|
<view v-if="miniInfo.applyRemark || miniInfo.email"
|
||||||
v-if="miniInfo.applyRemark || miniInfo.email"
|
class="mini-extra mt-5 flex flex-col gap-2 rounded-xl bg-[#f6f3ee] p-4 text-xs text-gray-500">
|
||||||
class="mini-extra mt-5 flex flex-col gap-2 rounded-xl bg-[#f6f3ee] p-4 text-xs text-gray-500"
|
|
||||||
>
|
|
||||||
<view v-if="miniInfo.applyRemark">
|
<view v-if="miniInfo.applyRemark">
|
||||||
<text class="text-gray-400">申请说明:</text>{{ miniInfo.applyRemark }}
|
<text class="text-gray-400">申请说明:</text>{{ miniInfo.applyRemark }}
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
/**
|
|
||||||
* 友链申请表单弹窗(站点版)
|
|
||||||
* 提交后等待站长审核,通过后展示在「站点」列表中
|
|
||||||
*/
|
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
show ?: boolean
|
show ?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
@@ -109,66 +111,52 @@ watch(() => props.show, (val) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<uh-glass-popup
|
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" custom-class="!border rounded-xl"
|
||||||
v-model="isShow" :z-index="100" position="bottom"
|
@close="handleClose(false)">
|
||||||
custom-class="!border rounded-xl" @close="handleClose(false)"
|
|
||||||
>
|
|
||||||
<view class="relative mb-4 box-border w-full flex items-center justify-around px-4 pt-4">
|
<view class="relative mb-4 box-border w-full flex items-center justify-around px-4 pt-4">
|
||||||
<view class="w-full flex flex-col gap-y-1">
|
<view class="w-full flex flex-col gap-y-1">
|
||||||
<text class="text-md font-bold">申请友链</text>
|
<text class="text-md font-bold">申请友链</text>
|
||||||
<text class="text-xs text-gray-500">提交后等待站长审核,通过后展示在「站点」列表中</text>
|
<text class="text-xs text-gray-500">提交后等待站长审核,通过后展示在「站点」列表中</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
||||||
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
@click="handleClose(false)">
|
||||||
@click="handleClose(false)"
|
|
||||||
>
|
|
||||||
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4 pt-0">
|
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4 pt-0">
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">名称 *</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">名称 *</text>
|
||||||
<input
|
<input v-model="form.name"
|
||||||
v-model="form.name"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="请输入网站名称"
|
placeholder="请输入网站名称">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">网址 *</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">网址 *</text>
|
||||||
<input
|
<input v-model="form.url"
|
||||||
v-model="form.url"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="请输入网站地址"
|
placeholder="请输入网站地址">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">Logo</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">Logo</text>
|
||||||
<input
|
<input v-model="form.logo"
|
||||||
v-model="form.logo"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="请输入网站Logo(选填)"
|
placeholder="请输入网站Logo(选填)">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">邮箱</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">邮箱</text>
|
||||||
<input
|
<input v-model="form.email"
|
||||||
v-model="form.email"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="请输入邮箱(选填)"
|
placeholder="请输入邮箱(选填)">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">友链页面</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">友链页面</text>
|
||||||
<input
|
<input v-model="form.linkPageUrl"
|
||||||
v-model="form.linkPageUrl"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="贵站友情链接页面地址(选填)"
|
placeholder="贵站友情链接页面地址(选填)">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="mb-2 pl-[140rpx] text-xs text-gray-400 -mt-3">
|
<view class="mb-2 pl-[140rpx] text-xs text-gray-400 -mt-3">
|
||||||
(即包含本站链接的页面)
|
(即包含本站链接的页面)
|
||||||
@@ -176,20 +164,16 @@ watch(() => props.show, (val) => {
|
|||||||
|
|
||||||
<view class="mb-5 flex items-center">
|
<view class="mb-5 flex items-center">
|
||||||
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">RSS地址</text>
|
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">RSS地址</text>
|
||||||
<input
|
<input v-model="form.rssUrl"
|
||||||
v-model="form.rssUrl"
|
|
||||||
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
|
||||||
placeholder="用于抓取文章(选填)"
|
placeholder="用于抓取文章(选填)">
|
||||||
>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mb-5">
|
<view class="mb-5">
|
||||||
<text class="label mb-2 block text-sm text-[#666]">网站描述</text>
|
<text class="label mb-2 block text-sm text-[#666]">网站描述</text>
|
||||||
<textarea
|
<textarea v-model="form.description"
|
||||||
v-model="form.description"
|
|
||||||
class="uh-global-card-glass box-border h-24 w-full flex-1 border rounded-xl p-3 text-sm shadow-none"
|
class="uh-global-card-glass box-border h-24 w-full flex-1 border rounded-xl p-3 text-sm shadow-none"
|
||||||
placeholder="请输入网站描述,不超过30字符(选填)" :maxlength="30"
|
placeholder="请输入网站描述,不超过30字符(选填)" :maxlength="30" />
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="my-6">
|
<view class="my-6">
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
/**
|
|
||||||
* 站点友链信息弹窗
|
|
||||||
* 展示本站友链交换信息(博客名片 + 复制交换信息 + 站点缩略图)
|
|
||||||
* 数据源为插件端 linkInfo.siteInfo 配置(字段对齐 Halo 官方友链提交 API:displayName/url/logo/description/email/backlink/feedUrls)
|
|
||||||
*/
|
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { checkAvatarUrl } from '@/utils/url'
|
import { checkAvatarUrl } from '@/utils/url'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
show ?: boolean
|
show ?: boolean
|
||||||
}>(), {
|
}>(), {
|
||||||
@@ -39,8 +40,7 @@ const calcBlogContent = computed(() => `
|
|||||||
`)
|
`)
|
||||||
|
|
||||||
function calcSiteThumbnail(val ?: string) : string {
|
function calcSiteThumbnail(val ?: string) : string {
|
||||||
if (!val)
|
if (!val) { return '' }
|
||||||
return ''
|
|
||||||
const _val = val.endsWith('/') ? val : `${val}/`
|
const _val = val.endsWith('/') ? val : `${val}/`
|
||||||
return `https://image.thum.io/get/width/1000/crop/800/${_val}`
|
return `https://image.thum.io/get/width/1000/crop/800/${_val}`
|
||||||
}
|
}
|
||||||
@@ -69,29 +69,23 @@ watch(() => props.show, (val) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<uh-glass-popup
|
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" custom-class="!border rounded-xl"
|
||||||
v-model="isShow" :z-index="100" position="bottom"
|
@close="handleClose">
|
||||||
custom-class="!border rounded-xl" @close="handleClose"
|
|
||||||
>
|
|
||||||
<view class="relative box-border w-full flex items-center justify-around px-4 pt-4">
|
<view class="relative box-border w-full flex items-center justify-around px-4 pt-4">
|
||||||
<view class="w-full flex flex-col gap-y-1">
|
<view class="w-full flex flex-col gap-y-1">
|
||||||
<text class="text-md font-bold">友链信息</text>
|
<text class="text-md font-bold">友链信息</text>
|
||||||
<text class="text-xs text-gray-500">本站友链交换信息,欢迎申请互换友链</text>
|
<text class="text-xs text-gray-500">本站友链交换信息,欢迎申请互换友链</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
||||||
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
|
@click="handleClose">
|
||||||
@click="handleClose"
|
|
||||||
>
|
|
||||||
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
<wd-icon name="close" size="32rpx" class="text-gray-500" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
|
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
|
||||||
<!-- 博客名片 -->
|
<!-- 博客名片 -->
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<image
|
<image class="uh-global-card-glass h-20 w-20 shrink-0 rounded-2xl"
|
||||||
class="uh-global-card-glass h-20 w-20 shrink-0 rounded-2xl"
|
:src="checkAvatarUrl(blogDetail.logo)" mode="aspectFill" />
|
||||||
:src="checkAvatarUrl(blogDetail.logo)" mode="aspectFill"
|
|
||||||
/>
|
|
||||||
<view class="ml-4 flex flex-1 flex-col justify-center gap-y-1">
|
<view class="ml-4 flex flex-1 flex-col justify-center gap-y-1">
|
||||||
<text class="text-md text-gray-900 font-bold">
|
<text class="text-md text-gray-900 font-bold">
|
||||||
{{ blogDetail.displayName || '未命名博客' }}
|
{{ blogDetail.displayName || '未命名博客' }}
|
||||||
@@ -108,10 +102,8 @@ watch(() => props.show, (val) => {
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 站点缩略图 -->
|
<!-- 站点缩略图 -->
|
||||||
<image
|
<image v-if="blogDetail.url" class="mt-4 h-[320rpx] w-full rounded-xl"
|
||||||
v-if="blogDetail.url" class="mt-4 h-[320rpx] w-full rounded-xl"
|
:src="calcSiteThumbnail(blogDetail.url)" mode="aspectFill" />
|
||||||
:src="calcSiteThumbnail(blogDetail.url)" mode="aspectFill"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<view class="my-6">
|
<view class="my-6">
|
||||||
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyLink">
|
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyLink">
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
modelValue ?: boolean
|
modelValue ?: boolean
|
||||||
content ?: string
|
content ?: string
|
||||||
@@ -30,18 +36,18 @@
|
|||||||
<uh-glass-popup v-model="show" position="bottom" :z-index="100" :safe-area-inset-bottom="true"
|
<uh-glass-popup v-model="show" position="bottom" :z-index="100" :safe-area-inset-bottom="true"
|
||||||
custom-class="rounded-xl">
|
custom-class="rounded-xl">
|
||||||
<view class="box-border px-4 py-4 text-center">
|
<view class="box-border px-4 py-4 text-center">
|
||||||
<text class="text-md text-gray-900 font-bold">
|
<text class="text-sm text-gray-900 font-bold">
|
||||||
维护详情
|
维护详情
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<scroll-view scroll-y :show-scrollbar="false"
|
<scroll-view scroll-y :show-scrollbar="false"
|
||||||
class="box-border max-h-[60vh] px-4 text-sm text-gray-900 leading-5">
|
class="box-border max-h-[60vh] px-4 text-2xs text-gray-900 leading-5">
|
||||||
<mp-html :content="content" lazy-load :domain="markdownConfig.domain" scroll-table selectable
|
<mp-html :content="content" lazy-load :domain="markdownConfig.domain" scroll-table selectable
|
||||||
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
||||||
copy-by-long-press />
|
copy-by-long-press />
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
<view class="w-full box-border flex items-center p-3">
|
<view class="w-full box-border flex items-center p-3">
|
||||||
<uh-button custom-class="flex-1 shadow-none bg-white text-primary" @click="close()">关闭</uh-button>
|
<uh-button class="w-full flex-1" custom-class="w-full flex-1 shadow-none bg-white text-primary" @click="close()">关闭</uh-button>
|
||||||
</view>
|
</view>
|
||||||
</uh-glass-popup>
|
</uh-glass-popup>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,39 +1,41 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onPageScroll } from '@dcloudio/uni-app'
|
import { computed, ref } from 'vue'
|
||||||
import { ref, computed, useSlots, onMounted } from 'vue'
|
|
||||||
import { tabbarList } from '@/tabbar/config'
|
import { tabbarList } from '@/tabbar/config'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
useBack : boolean;
|
useBack : boolean
|
||||||
useTitle : boolean;
|
useTitle : boolean
|
||||||
defaultTitle ?: string;
|
defaultTitle ?: string
|
||||||
titleColor ?: string;
|
titleColor ?: string
|
||||||
scrollTitle ?: string;
|
scrollTitle ?: string
|
||||||
needPlaceholder ?: boolean;
|
needPlaceholder ?: boolean
|
||||||
backClass ?: string;
|
backClass ?: string
|
||||||
backStyle ?: string;
|
backStyle ?: string
|
||||||
|
scrollY ?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<IProps>(), {
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
useBack: true,
|
useBack: true,
|
||||||
useTitle: true,
|
useTitle: true,
|
||||||
needPlaceholder: true,
|
needPlaceholder: true,
|
||||||
backClass: 'text-gray-900'
|
backClass: 'text-gray-900',
|
||||||
})
|
})
|
||||||
|
|
||||||
const slots = useSlots()
|
|
||||||
|
|
||||||
const scrollY = ref(0)
|
|
||||||
const maxAlpha = ref(0.65)
|
const maxAlpha = ref(0.65)
|
||||||
|
|
||||||
const customStyle = computed(() => {
|
const customStyle = computed(() => {
|
||||||
const alpha = Math.min(scrollY.value / 360, maxAlpha.value)
|
const alpha = Math.min(props.scrollY / 360, maxAlpha.value)
|
||||||
return {
|
return {
|
||||||
backgroundColor: `rgba(255, 255, 255, ${alpha})`,
|
backgroundColor: `rgba(255, 255, 255, ${alpha})`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const scrollThreshold = computed(() => {
|
const scrollThreshold = computed(() => {
|
||||||
return scrollY.value / 360 <= 0.5;
|
return props.scrollY / 360 <= 0.5
|
||||||
})
|
})
|
||||||
|
|
||||||
const customCalss = computed(() => {
|
const customCalss = computed(() => {
|
||||||
@@ -44,7 +46,7 @@
|
|||||||
else {
|
else {
|
||||||
_class.push('text-gray-900')
|
_class.push('text-gray-900')
|
||||||
}
|
}
|
||||||
return _class;
|
return _class
|
||||||
})
|
})
|
||||||
|
|
||||||
const titleColorClass = computed(() => {
|
const titleColorClass = computed(() => {
|
||||||
@@ -53,12 +55,12 @@
|
|||||||
|
|
||||||
const visibleTitle = computed(() => {
|
const visibleTitle = computed(() => {
|
||||||
if (!props.scrollTitle) {
|
if (!props.scrollTitle) {
|
||||||
return props.defaultTitle;
|
return props.defaultTitle
|
||||||
}
|
}
|
||||||
if (scrollThreshold.value) {
|
if (scrollThreshold.value) {
|
||||||
return props.defaultTitle;
|
return props.defaultTitle
|
||||||
}
|
}
|
||||||
return props.scrollTitle;
|
return props.scrollTitle
|
||||||
})
|
})
|
||||||
|
|
||||||
// 如果是从分享进来的,我们需要处理为返回 home页面
|
// 如果是从分享进来的,我们需要处理为返回 home页面
|
||||||
@@ -69,52 +71,45 @@
|
|||||||
homePage,
|
homePage,
|
||||||
'pages/maintenance/maintenance',
|
'pages/maintenance/maintenance',
|
||||||
...tabbarList.map((item : any) => item.pagePath),
|
...tabbarList.map((item : any) => item.pagePath),
|
||||||
] as string[];
|
] as string[]
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleBack() {
|
function handleBack() {
|
||||||
const currentPage = getCurrentPages()[0]
|
const currentPage = getCurrentPages()[0]
|
||||||
if (!allEntryPages.value.some(pagePath => pagePath == currentPage.route)) {
|
if (!allEntryPages.value.some(pagePath => pagePath == currentPage.route)) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: `/${homePage}`
|
url: `/${homePage}`,
|
||||||
})
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
uni.navigateBack({ delta: 1 })
|
uni.navigateBack({ delta: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageScroll((e : any) => {
|
|
||||||
scrollY.value = e.scrollTop
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="w-full box-border">
|
<view class="fixed left-0 top-0 z-100 box-border w-full pt-safe" :class="customCalss" :style="[customStyle]">
|
||||||
<view class="box-border pt-safe w-full fixed left-0 top-0 z-100" :class="customCalss" :style="[customStyle]">
|
<view class="box-border h-[46px] w-full flex items-center gap-x-4 px-3" style="backdrop-filter: blur(2rpx);">
|
||||||
<view class="w-full h-[46px] flex items-center gap-x-4 box-border px-3 backdrop-blur-[2rpx]">
|
|
||||||
<!-- 左边 -->
|
<!-- 左边 -->
|
||||||
<view class="shrink-0 min-w-18" @click="handleBack()">
|
<view class="min-w-18 shrink-0" @click="handleBack()">
|
||||||
<view v-if="props.useBack"
|
<view v-if="props.useBack"
|
||||||
class="uh-global-card-glass uh-shadow-xs h-8 px-3 rounded-full border flex items-center gap-x-2 text-sm"
|
class="uh-global-card-glass uh-shadow-xs h-8 flex items-center gap-x-2 border rounded-full px-3 text-sm"
|
||||||
:class="props.backClass" :style="[props.backStyle]">
|
:class="props.backClass" :style="[props.backStyle]">
|
||||||
<wd-icon name="arrow-left" size="34rpx"></wd-icon>
|
<wd-icon name="arrow-left" size="30rpx" />
|
||||||
<view class="w-[1px] h-4 bg-white/60" />
|
<view class="h-4 w-[1px] bg-white/60" />
|
||||||
<text class="text-sm font-bold">返回</text>
|
<text class="text-[26rpx] font-bold">返回</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 中间 -->
|
<!-- 中间 -->
|
||||||
<view class="flex-1 truncate text-center font-bold transition-colors duration-300"
|
<view class="flex-1 truncate text-center font-bold transition-colors duration-300" :class="titleColorClass">
|
||||||
:class="titleColorClass">
|
{{props.scrollY}} <slot> {{ visibleTitle }} </slot>
|
||||||
<slot> {{visibleTitle}} </slot>
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 右边 -->
|
<!-- 右边 -->
|
||||||
<view class="shrink-0 min-w-18">
|
<view class="min-w-18 shrink-0">
|
||||||
<slot name="right"></slot>
|
<slot name="right" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="props.needPlaceholder" class="box-border w-full pt-safe">
|
<view v-if="props.needPlaceholder" class="box-border w-full pt-safe">
|
||||||
<view class="w-full h-[46px]"></view>
|
<view class="h-[46px] w-full" />
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<view class="flex items-center gap-2">
|
<view class="flex items-center gap-2">
|
||||||
<wd-icon class-prefix="uhemoji2-icon" name="-happy-" size="36rpx" />
|
<wd-icon class-prefix="uhemoji2-icon" name="-happy-" size="36rpx" />
|
||||||
<text class="text-md font-bold text-gray-900">
|
<text class="text-md font-semibold text-gray-900">
|
||||||
最新公告
|
最新公告
|
||||||
</text>
|
</text>
|
||||||
<view v-if="notice.typeDisplayName" class="rounded px-1.5 py-0.5 text-xs" :style="{
|
<view v-if="notice.typeDisplayName" class="rounded px-1.5 py-0.5 text-xs" :style="{
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { computed } from 'vue'
|
||||||
|
import { storeToRefs } from 'pinia'
|
||||||
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
|
|
||||||
|
const {configs} = storeToRefs(useAppConfigStore())
|
||||||
|
const copyrightConfig = computed(() => configs.value?.pageConfig?.aboutConfig?.copyrightConfig)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view v-if="copyrightConfig?.enabled" class="box-border mt-6 px-6 text-center text-xs text-gray-400">
|
||||||
|
<text>{{copyrightConfig.content }}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
@@ -74,7 +74,7 @@ function onTouchEnd() {
|
|||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="showButton" class="button-container absolute left-1/2 top-1/2 z-2 flex flex-col items-center -translate-x-1/2 -translate-y-1/2">
|
<view v-if="showButton" class="button-container absolute left-1/2 top-1/2 z-2 flex flex-col items-center uh-translate-center">
|
||||||
<text
|
<text
|
||||||
v-if="tipText"
|
v-if="tipText"
|
||||||
class="tip-text mb-5 text-center leading-[1.4]"
|
class="tip-text mb-5 text-center leading-[1.4]"
|
||||||
@@ -154,4 +154,9 @@ function onTouchEnd() {
|
|||||||
background-position: 0 50%;
|
background-position: 0 50%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 完全居中定位 */
|
||||||
|
.uh-translate-center {
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useSlots } from 'vue'
|
|
||||||
const slots = useSlots();
|
|
||||||
const hasRightSlot = computed(() => !!slots.right?.())
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="w-full flex items-center justify-between">
|
<view class="w-full flex items-center justify-between">
|
||||||
<view class="shrink-0 relative">
|
<view class="relative shrink-0">
|
||||||
<text class="font-bold relative z-2">
|
<text class="relative z-2 text-2xs font-semibold">
|
||||||
<slot></slot>
|
<slot />
|
||||||
</text>
|
</text>
|
||||||
<view class="absolute z-1 -right-1 -bottom-0.5 rounded-xl bg-secondary h-4 w-4/5"></view>
|
<view class="absolute z-1 h-4 w-4/5 rounded-xl bg-secondary -bottom-0.5 -right-1" />
|
||||||
</view>
|
</view>
|
||||||
<view v-if="hasRightSlot" class="flex-1 flex items-center justify-end">
|
<view class="flex flex-1 items-center justify-end">
|
||||||
<slot name="right"></slot>
|
<slot name="right" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -5,6 +5,10 @@
|
|||||||
fixed ?: boolean;
|
fixed ?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits<{
|
||||||
|
(e : 'action-click') : void
|
||||||
|
}>()
|
||||||
|
|
||||||
const props = withDefaults(defineProps<IProps>(), {
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
customClass: '',
|
customClass: '',
|
||||||
fixed: true,
|
fixed: true,
|
||||||
@@ -17,10 +21,15 @@
|
|||||||
const visible = computed(() => {
|
const visible = computed(() => {
|
||||||
return whiteList.includes(currentPage.route)
|
return whiteList.includes(currentPage.route)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
emits('action-click')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="visible" :class="[props.fixed?'fixed bottom-22 right-3 z-50 pb-safe':'',props.containerClass]">
|
<view v-if="visible" :class="[props.fixed?'fixed bottom-22 right-3 z-50 pb-safe':'',props.containerClass]"
|
||||||
|
@click="handleClick">
|
||||||
<view class="uh-global-card-glass border h-11 w-11 flex items-center justify-center rounded-full text-primary"
|
<view class="uh-global-card-glass border h-11 w-11 flex items-center justify-center rounded-full text-primary"
|
||||||
:class="props.customClass">
|
:class="props.customClass">
|
||||||
<wd-icon name="settings" size="42rpx" />
|
<wd-icon name="settings" size="42rpx" />
|
||||||
|
|||||||
@@ -2,9 +2,23 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { useSettingStore } from '@/store/setting'
|
import { useSettingStore } from '@/store/setting'
|
||||||
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
|
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
|
||||||
import { useSettingsPopup } from '@/hooks/useSettingsPopup'
|
import { isWechat } from '@/utils/platform'
|
||||||
|
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
options: {
|
||||||
|
styleIsolation: 'apply-shared'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
/** v-model:是否显示 */
|
||||||
|
modelValue : boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<IProps>()
|
||||||
|
|
||||||
const {
|
const {
|
||||||
SETTING_TABS,
|
SETTING_TABS,
|
||||||
layoutGroups,
|
layoutGroups,
|
||||||
@@ -17,9 +31,17 @@
|
|||||||
isCardTypeOptionDisabled,
|
isCardTypeOptionDisabled,
|
||||||
} = usePreferenceRows()
|
} = usePreferenceRows()
|
||||||
|
|
||||||
const { settingsPopupVisible } = useSettingsPopup()
|
interface IEmits {
|
||||||
|
(e : 'update:modelValue', value : boolean) : void,
|
||||||
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['close', 'open'])
|
const emits = defineEmits<IEmits>()
|
||||||
|
|
||||||
|
/** v-model 代理:将 uh-glass-popup 的 modelValue 转发给父组件,避免直接写 readonly props */
|
||||||
|
const popupVisible = computed({
|
||||||
|
get : () => props.modelValue,
|
||||||
|
set : (value : boolean) => emits('update:modelValue', value),
|
||||||
|
})
|
||||||
|
|
||||||
const activeTab = ref<'layout' | 'feature'>('layout')
|
const activeTab = ref<'layout' | 'feature'>('layout')
|
||||||
|
|
||||||
@@ -59,23 +81,20 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClose() {
|
function handleClose() {
|
||||||
emits('close')
|
emits('update:modelValue', false)
|
||||||
}
|
|
||||||
function onOpen() {
|
|
||||||
emits('open')
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<uh-glass-popup v-model="settingsPopupVisible" position="bottom" custom-class="rounded-xl !border"
|
<uh-glass-popup v-model="popupVisible" position="bottom" custom-class="rounded-xl !border"
|
||||||
safe-area-inset-bottom :z-index="110" hide-when-close @close="onClose" @open="onOpen">
|
safe-area-inset-bottom :z-index="110" hide-when-close>
|
||||||
<view class="box-border px-3 pt-3">
|
<view class="box-border px-3 pt-3">
|
||||||
<view class="mb-3 flex items-center justify-between">
|
<view class="mb-3 flex items-center justify-between">
|
||||||
<text class="text-md font-bold">偏好设置</text>
|
<text class="text-md font-bold">偏好设置</text>
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass shadow-none !bg-white/5 border flex h-6 w-6 items-center justify-center rounded-lg text-gray-500"
|
class="uh-global-card-glass shadow-none !bg-white/5 border flex h-6 w-6 items-center justify-center rounded-lg text-gray-500"
|
||||||
@click="onClose()">
|
@click="handleClose()">
|
||||||
<wd-icon name="close" size="16px" />
|
<wd-icon name="close" size="16px" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -123,8 +142,7 @@
|
|||||||
:class="[
|
:class="[
|
||||||
currentValueOf(row.path) === opt.value ? 'bg-secondary font-bold' : 'border-gray-100 text-gray-500',
|
currentValueOf(row.path) === opt.value ? 'bg-secondary font-bold' : 'border-gray-100 text-gray-500',
|
||||||
isCardTypeOptionDisabled(row.path, opt.value) ? 'opacity-40' : ''
|
isCardTypeOptionDisabled(row.path, opt.value) ? 'opacity-40' : ''
|
||||||
]"
|
]" @click="isCardTypeOptionDisabled(row.path, opt.value) ? null : handleInlineChoose(row.path, opt.value)">
|
||||||
@click="isCardTypeOptionDisabled(row.path, opt.value) ? null : handleInlineChoose(row.path, opt.value)">
|
|
||||||
{{ opt.label }}
|
{{ opt.label }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -148,9 +166,11 @@
|
|||||||
<view v-if="row.kind === 'bool'" class="box-border p-3"
|
<view v-if="row.kind === 'bool'" class="box-border p-3"
|
||||||
:class="index < featureRows.length - 1 ? 'border-b border-black/5' : ''">
|
:class="index < featureRows.length - 1 ? 'border-b border-black/5' : ''">
|
||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<text class="row-label text-sm text-gray-900 font-bold">{{ row.label }}</text>
|
<text
|
||||||
|
class="row-label text-sm text-gray-900 font-bold">{{ row.label }}</text>
|
||||||
<view class="flex items-center gap-2">
|
<view class="flex items-center gap-2">
|
||||||
<text v-if="row.following" class="row-sub text-2xs text-gray-400">默认</text>
|
<text v-if="row.following"
|
||||||
|
class="row-sub text-2xs text-gray-400">默认</text>
|
||||||
<view v-else
|
<view v-else
|
||||||
class="rounded-full bg-secondary px-2 py-1 text-xs text-gray-900 leading-none">
|
class="rounded-full bg-secondary px-2 py-1 text-xs text-gray-900 leading-none">
|
||||||
已自定义
|
已自定义
|
||||||
@@ -215,12 +235,13 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
<!-- 底部操作栏 -->
|
<!-- 底部操作栏 -->
|
||||||
<view class="box-border w-full pb-4 pt-3 flex items-center gap-x-2">
|
<view class="box-border w-full pt-3 flex items-center gap-x-2" :class="[isWechat?'':'pb-3']">
|
||||||
<uh-button custom-class="flex-1 uh-global-card-glass bg-white/90 border py-2 !rounded-xl"
|
<uh-button class="flex-1" custom-class="flex-1 uh-global-card-glass bg-white/90 border py-2 !rounded-xl"
|
||||||
@click="onClose()">
|
@click="handleClose()">
|
||||||
关闭
|
关闭
|
||||||
</uh-button>
|
</uh-button>
|
||||||
<uh-button custom-class="flex-1 uh-global-card-glass border py-2 !rounded-xl" @click="handleResetAll">
|
<uh-button class="flex-1" custom-class="flex-1 uh-global-card-glass border py-2 !rounded-xl"
|
||||||
|
@click="handleResetAll">
|
||||||
恢复默认
|
恢复默认
|
||||||
</uh-button>
|
</uh-button>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
}
|
}
|
||||||
const props = withDefaults(defineProps<IProps>(), {
|
const props = withDefaults(defineProps<IProps>(), {
|
||||||
customClass: '',
|
customClass: '',
|
||||||
lineClass: '!h-2/5 -rotate-5',
|
lineClass: '!h-2/5 uh-rotate-n5',
|
||||||
textClass: 'font-bold'
|
textClass: 'font-bold'
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -20,3 +20,9 @@
|
|||||||
</text>
|
</text>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 下划线轻微旋转 */
|
||||||
|
.uh-rotate-n5 {
|
||||||
|
transform: rotate(-5deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -16,9 +16,8 @@ const LoadMoreStatusText = {
|
|||||||
noNetwork: '呜呜,网络好像有点问题哦~'
|
noNetwork: '呜呜,网络好像有点问题哦~'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type LoadMoreStatus = keyof typeof LoadMoreStatusText
|
export type LoadMoreStatus = keyof typeof LoadMoreStatusText;
|
||||||
|
|
||||||
/** 加载更多内部状态(完整形态,区别于可选的 LoadMoreStatusOption) */
|
|
||||||
export interface LoadMoreStatusState {
|
export interface LoadMoreStatusState {
|
||||||
active: boolean;
|
active: boolean;
|
||||||
hasNext: boolean;
|
hasNext: boolean;
|
||||||
@@ -27,7 +26,6 @@ export interface LoadMoreStatusState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface LoadMoreStatusOption {
|
export interface LoadMoreStatusOption {
|
||||||
// 是否激活加载
|
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
status?: LoadMoreStatus;
|
status?: LoadMoreStatus;
|
||||||
text?: string;
|
text?: string;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
import { onPageScroll } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
|
export function usePageScroll() {
|
||||||
|
const scrollY = ref(0);
|
||||||
|
|
||||||
|
onPageScroll((e: any) => {
|
||||||
|
scrollY.value = e.scrollTop;
|
||||||
|
console.log('滚动数据', scrollY.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
return { scrollY };
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ export function useSettingsPopup() {
|
|||||||
|
|
||||||
function closeSettingsPopup() {
|
function closeSettingsPopup() {
|
||||||
settingsPopupVisible.value = false;
|
settingsPopupVisible.value = false;
|
||||||
console.log('Settings popup closed', settingsPopupVisible.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { settingsPopupVisible, openSettingsPopup, closeSettingsPopup };
|
return { settingsPopupVisible, openSettingsPopup, closeSettingsPopup };
|
||||||
|
|||||||
+1
-3
@@ -3,9 +3,7 @@
|
|||||||
"tabbar.category": "Category",
|
"tabbar.category": "Category",
|
||||||
"tabbar.gallery": "Gallery",
|
"tabbar.gallery": "Gallery",
|
||||||
"tabbar.moments": "Moments",
|
"tabbar.moments": "Moments",
|
||||||
"tabbar.about": "About",
|
"tabbar.mine": "About",
|
||||||
"tabbar.me": "Me",
|
|
||||||
"tabbar.i18n": "I18n",
|
|
||||||
"page.home.title": "Home",
|
"page.home.title": "Home",
|
||||||
"page.category.title": "Category",
|
"page.category.title": "Category",
|
||||||
"page.gallery.title": "Gallery",
|
"page.gallery.title": "Gallery",
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
"tabbar.category": "分类",
|
"tabbar.category": "分类",
|
||||||
"tabbar.gallery": "图库",
|
"tabbar.gallery": "图库",
|
||||||
"tabbar.moments": "瞬间",
|
"tabbar.moments": "瞬间",
|
||||||
"tabbar.about": "关于",
|
"tabbar.mine": "关于",
|
||||||
"tabbar.me": "我的",
|
|
||||||
"tabbar.i18n": "多语言",
|
|
||||||
"page.home.title": "首页",
|
"page.home.title": "首页",
|
||||||
"page.category.title": "分类",
|
"page.category.title": "分类",
|
||||||
"page.gallery.title": "图库",
|
"page.gallery.title": "图库",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { checkUrl } from '@/utils/url'
|
import { checkUrl } from '@/utils/url'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
style: {
|
style: {
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
const appInfo = computed(() => {
|
const appInfo = computed(() => {
|
||||||
@@ -20,8 +22,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const links = [
|
const links = [
|
||||||
{ title: '开源组织', value: '巷子工坊', copy: 'https://www.ialley.cn', tip: '巷子工坊官网已复制成功!', tileColor: '#5c6bc0', tileLetter: '组' },
|
{ title: '小莫唐尼', value: 'https://www.xiaoxiaomo.cn', copy: 'https://www.xiaoxiaomo.cn', tip: '作者主页地址已复制', tileColor: '#26a69a', tileLetter: '作' },
|
||||||
{ title: '开源作者', value: '小莫唐尼', copy: 'https://www.xiaoxiaomo.cn', tip: '作者主页地址已复制', tileColor: '#26a69a', tileLetter: '作' },
|
|
||||||
{ title: '作者博客', value: 'https://blog.xiaoxiaomo.cn', copy: 'https://blog.xiaoxiaomo.cn', tip: '作者博客地址已复制', tileColor: '#7e57c2', tileLetter: '博' },
|
{ title: '作者博客', value: 'https://blog.xiaoxiaomo.cn', copy: 'https://blog.xiaoxiaomo.cn', tip: '作者博客地址已复制', tileColor: '#7e57c2', tileLetter: '博' },
|
||||||
{ title: '文档地址', value: 'https://uni-halo.925i.cn', copy: 'https://uni-halo.925i.cn', tip: '项目码云仓库已复制', tileColor: '#039be5', tileLetter: '文' },
|
{ title: '文档地址', value: 'https://uni-halo.925i.cn', copy: 'https://uni-halo.925i.cn', tip: '项目码云仓库已复制', tileColor: '#039be5', tileLetter: '文' },
|
||||||
{ title: '码云仓库', value: 'https://gitee.com/ialley-workshop-open/uni-halo', copy: 'https://gitee.com/ialley-workshop-open/uni-halo', tip: '码云仓库地址已复制', tileColor: '#c71d23', tileLetter: '码' },
|
{ title: '码云仓库', value: 'https://gitee.com/ialley-workshop-open/uni-halo', copy: 'https://gitee.com/ialley-workshop-open/uni-halo', tip: '码云仓库地址已复制', tileColor: '#c71d23', tileLetter: '码' },
|
||||||
@@ -46,14 +47,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col overflow-hidden bg-page px-4 pb-8 pt-2">
|
<view class="box-border min-h-screen w-screen flex flex-col overflow-hidden bg-page px-4 pb-8 pt-2">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="关于项目" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="关于项目" title-color="text-gray-900" />
|
||||||
|
|
||||||
<view class="fixed -right-8 top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl" />
|
<view class="fixed -right-8 top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl" />
|
||||||
<view class="fixed -left-10 top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl" />
|
<view class="fixed -left-10 top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl" />
|
||||||
|
|
||||||
<view class="relative">
|
<view class="relative">
|
||||||
<view class="uh-global-card-glass relative flex flex-col items-center rounded-2xl px-6 pb-7 pt-10">
|
<view class="uh-global-card-glass relative flex flex-col items-center rounded-2xl px-6 pb-7 pt-10">
|
||||||
<image class="uh-global-card-glass uh-shadow-xs border h-18 w-18 rounded-2xl" :src="appInfo.logo" mode="aspectFill" />
|
<image class="uh-global-card-glass uh-shadow-xs border h-18 w-18 rounded-2xl" :src="appInfo.logo"
|
||||||
|
mode="aspectFill" />
|
||||||
<view class="mt-4 text-xl text- font-bold">
|
<view class="mt-4 text-xl text- font-bold">
|
||||||
{{appInfo.name}}
|
{{appInfo.name}}
|
||||||
</view>
|
</view>
|
||||||
@@ -87,9 +89,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 版权 -->
|
<uh-page-copyright />
|
||||||
<view class="copyright mt-auto pt-8 text-center text-[22rpx] text-gray-400">
|
|
||||||
<view>「 2022 uni-halo 丨 开源项目丨巷子工坊@小莫唐尼 」</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -4,6 +4,7 @@ import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
|||||||
import { getPostList } from '@/api/halo'
|
import { getPostList } from '@/api/halo'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { useSettingStore } from '@/store/setting'
|
import { useSettingStore } from '@/store/setting'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import type { IPost } from '@/api/types/halo'
|
import type { IPost } from '@/api/types/halo'
|
||||||
@@ -16,6 +17,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
@@ -252,7 +254,7 @@ onReachBottom(() => {
|
|||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen w-screen flex flex-col bg-page">
|
<view class="min-h-screen w-screen flex flex-col bg-page">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="内容归档" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="内容归档" title-color="text-gray-900" />
|
||||||
|
|
||||||
<!-- 顶部-->
|
<!-- 顶部-->
|
||||||
<wd-sticky>
|
<wd-sticky>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||||
import { getPostByName, getPostCommentReplyList, postTrackersCounter } from '@/api/halo'
|
import { getPostByName, getPostCommentReplyList, postTrackersCounter } from '@/api/halo'
|
||||||
import { useUpvote } from '@/hooks/useUpvote'
|
import { useUpvote } from '@/hooks/useUpvote'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { createVerificationCode, requestRestrictReadCheck } from '@/api/uni-halo'
|
import { createVerificationCode, requestRestrictReadCheck } from '@/api/uni-halo'
|
||||||
import { formatTime } from '@/utils/formatTime'
|
import { formatTime } from '@/utils/formatTime'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const favoritesStore = useFavoritesStore()
|
const favoritesStore = useFavoritesStore()
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
@@ -297,8 +299,6 @@
|
|||||||
|
|
||||||
/* ---------------- 评论 ---------------- */
|
/* ---------------- 评论 ---------------- */
|
||||||
function handleToComment() {
|
function handleToComment() {
|
||||||
console.log('calcIsShowComment.value', calcIsShowComment.value)
|
|
||||||
console.log('result.value', result.value)
|
|
||||||
if (!result.value) {
|
if (!result.value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -443,16 +443,16 @@
|
|||||||
|
|
||||||
const globalAppSettings = computed(() => settingStore.settings)
|
const globalAppSettings = computed(() => settingStore.settings)
|
||||||
|
|
||||||
onMounted(() => {
|
onPageScroll((e : any) => {
|
||||||
console.log('获取当前所有的页面')
|
console.log('滚动', e)
|
||||||
console.log(getCurrentPages())
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
|
||||||
<!-- 顶部导航 -->
|
<!-- 顶部导航 -->
|
||||||
<uh-navbar default-title="内容详情" :need-placeholder="false" :scroll-title="result?.spec?.title" />
|
<uh-navbar :scroll-y="scrollY" default-title="内容详情" :need-placeholder="false"
|
||||||
|
:scroll-title="result?.spec?.title" />
|
||||||
|
|
||||||
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus"
|
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus"
|
||||||
@refresh="handleGetData()" />
|
@refresh="handleGetData()" />
|
||||||
@@ -465,12 +465,12 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border overflow-hidden border rounded-lt-3xl rounded-rt-3xl border-b-none -translate-y-12"
|
class="uh-global-card-glass box-border overflow-hidden border rounded-lt-3xl rounded-rt-3xl border-b-none uh-content-lift"
|
||||||
:style="{
|
:style="{
|
||||||
boxShadow: '0 -16rpx 12rpx rgba(0, 0, 0, 0.035)',
|
boxShadow: '0 -16rpx 12rpx rgba(0, 0, 0, 0.035)',
|
||||||
}">
|
}">
|
||||||
<!-- 顶部信息 -->
|
<!-- 顶部信息 -->
|
||||||
<view class="box-border flex flex-col gap-3 p-3 pb-2">
|
<view class="box-border flex flex-col gap-3 p-4 pb-2">
|
||||||
<view class="flex items-center gap-x-2">
|
<view class="flex items-center gap-x-2">
|
||||||
<image :src="result.owner.avatar" class="uh-global-card-glass block h-6 w-6 rounded-full"
|
<image :src="result.owner.avatar" class="uh-global-card-glass block h-6 w-6 rounded-full"
|
||||||
mode="aspectFill" />
|
mode="aspectFill" />
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view class="box-border flex flex-col gap-y-3 p-3 text-gray-900 text-sm">
|
<view class="box-border flex flex-col gap-y-3 p-4 pt-2 text-gray-900 text-3xs">
|
||||||
<!-- 受限阅读 -->
|
<!-- 受限阅读 -->
|
||||||
<template v-if="checkPostRestrictRead(result!)">
|
<template v-if="checkPostRestrictRead(result!)">
|
||||||
<view v-if="showContentArr.length === 0">
|
<view v-if="showContentArr.length === 0">
|
||||||
@@ -565,14 +565,14 @@
|
|||||||
<view v-if="postDetailConfig?.copyrightEnabled" class="box-border px-2 mb-3">
|
<view v-if="postDetailConfig?.copyrightEnabled" class="box-border px-2 mb-3">
|
||||||
<view class="uh-global-card-glass uh-shadow-xs rounded-xl p-3">
|
<view class="uh-global-card-glass uh-shadow-xs rounded-xl p-3">
|
||||||
<uh-section-title>版权声明</uh-section-title>
|
<uh-section-title>版权声明</uh-section-title>
|
||||||
<view class="mt-3 flex flex-col gap-y-2 text-gray-600">
|
<view class="mt-3 flex flex-col gap-y-2 text-gray-600 text-2xs">
|
||||||
<view v-if="postDetailConfig.copyrightAuthor" class="text-sm leading-5">
|
<view v-if="postDetailConfig.copyrightAuthor" class="leading-5">
|
||||||
版权归属:{{ postDetailConfig.copyrightAuthor }}
|
版权归属:{{ postDetailConfig.copyrightAuthor }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="postDetailConfig.copyrightDesc" class="text-sm leading-5">
|
<view v-if="postDetailConfig.copyrightDesc" class="leading-5">
|
||||||
版权说明:{{ postDetailConfig.copyrightDesc }}
|
版权说明:{{ postDetailConfig.copyrightDesc }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="postDetailConfig.copyrightViolation" class="text-sm text-red-400 leading-5">
|
<view v-if="postDetailConfig.copyrightViolation" class="text-red-400 leading-5">
|
||||||
侵权处理:{{ postDetailConfig.copyrightViolation }}
|
侵权处理:{{ postDetailConfig.copyrightViolation }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -581,36 +581,38 @@
|
|||||||
|
|
||||||
<!-- 评论区域 -->
|
<!-- 评论区域 -->
|
||||||
<view class="box-border px-2">
|
<view class="box-border px-2">
|
||||||
<uh-comment-list v-if="calcIsShowComment && result" :disallow-comment="!result.spec.allowComment"
|
<uh-comment-list v-if="calcIsShowComment && result"
|
||||||
:post-name="result.metadata.name" :post="result" @on-comment="handleOnComment"
|
:disallow-comment="!result.spec.allowComment" :post-name="result.metadata.name"
|
||||||
@on-comment-detail="handleOnShowCommentDetail" @on-loaded="handleCommentLoaded" />
|
:post="result" @on-comment="handleOnComment" @on-comment-detail="handleOnShowCommentDetail"
|
||||||
|
@on-loaded="handleCommentLoaded" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 悬浮操作 -->
|
<!-- 悬浮操作 -->
|
||||||
<view class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
|
<view class="fixed bottom-4 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
|
||||||
<!-- #7BE200 -->
|
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
||||||
:class="{ active: hasUpvoted() }" @click="handleDoLikesClick">
|
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold">点赞</text>
|
<text class="shrink-0 text-3xs font-semibold">点赞</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="calcIsShowComment"
|
<view v-if="calcIsShowComment"
|
||||||
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
||||||
@click="handleToComment()">
|
@click="handleToComment()">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold">评论</text>
|
<text class="shrink-0 text-3xs text-gray-900 font-semibold">评论</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
||||||
@click="handleTogglePostFavorite">
|
@click="handleTogglePostFavorite">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold"
|
<text class="shrink-0 text-3xs font-semibold"
|
||||||
:style="hasFavorited() ? { color: '#ffb300' } : ''">{{ hasFavorited() ? '已收藏' : '收藏' }}</text>
|
:class="[hasFavorited()?'text-primary':'text-gray-900']">
|
||||||
|
{{ hasFavorited() ? '已收藏' : '收藏' }}
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -639,3 +641,15 @@
|
|||||||
:title="commentModal.title" :post-name="commentModal.postName" @on-close="handleOnCommentModalClose" />
|
:title="commentModal.title" :post-name="commentModal.postName" @on-close="handleOnCommentModalClose" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 内容区域上移 */
|
||||||
|
.uh-content-lift {
|
||||||
|
transform: translateY(-3rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 水平居中定位 */
|
||||||
|
.uh-translate-x-center {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -4,6 +4,7 @@ import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
|||||||
import { getCategoryList, getCategoryPostList, getPostList } from '@/api/halo'
|
import { getCategoryList, getCategoryPostList, getPostList } from '@/api/halo'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { useSettingStore } from '@/store/setting'
|
import { useSettingStore } from '@/store/setting'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { checkAvatarUrl } from '@/utils/url'
|
import { checkAvatarUrl } from '@/utils/url'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
@@ -17,6 +18,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
|
|
||||||
@@ -200,7 +202,7 @@ onReachBottom(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen w-screen flex flex-col bg-page">
|
<view class="min-h-screen w-screen flex flex-col bg-page">
|
||||||
<uh-navbar default-title="文章列表" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="文章列表" title-color="text-gray-900" />
|
||||||
|
|
||||||
<wd-sticky v-if="categoryOptions.length > 1" class="w-full">
|
<wd-sticky v-if="categoryOptions.length > 1" class="w-full">
|
||||||
<scroll-view :scroll-x="true" :show-scrollbar="false" class="w-full whitespace-nowrap pt-2">
|
<scroll-view :scroll-x="true" :show-scrollbar="false" class="w-full whitespace-nowrap pt-2">
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { copyToClipboard } from '@/utils/restrictRead'
|
|||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { IBannerPublicDetail } from '@/api/types/uni-halo'
|
import type { IBannerPublicDetail } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -22,6 +23,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
||||||
const name = ref('')
|
const name = ref('')
|
||||||
const detail = ref<IBannerPublicDetail | null>(null)
|
const detail = ref<IBannerPublicDetail | null>(null)
|
||||||
@@ -106,7 +108,7 @@ function handleOpenLink() {
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen bg-page pb-safe">
|
<view class="box-border min-h-screen w-screen bg-page pb-safe">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="轮播详情" title-color="text-gray-900" :scroll-title="detail?.title" />
|
<uh-navbar :scroll-y="scrollY" default-title="轮播详情" title-color="text-gray-900" :scroll-title="detail?.title" />
|
||||||
|
|
||||||
<!-- 加载/错误/空态(状态机) -->
|
<!-- 加载/错误/空态(状态机) -->
|
||||||
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
|
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { onLoad, onPullDownRefresh, onReachBottom, onShareAppMessage, onShareTim
|
|||||||
import { getCategoryPostList } from '@/api/halo'
|
import { getCategoryPostList } from '@/api/halo'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { IPost, IPostListReq } from '@/api/types/halo'
|
import type { IPost, IPostListReq } from '@/api/types/halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -14,6 +15,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { loadingStatus, loadMoreStatus, updateLoadingStatus, updateLoadMoreStatus, resetLoadMoreStatus } = useDataLoadingStatus()
|
const { loadingStatus, loadMoreStatus, updateLoadingStatus, updateLoadMoreStatus, resetLoadMoreStatus } = useDataLoadingStatus()
|
||||||
const queryParams = ref({ size: 10, page: 0 })
|
const queryParams = ref({ size: 10, page: 0 })
|
||||||
const name = ref('')
|
const name = ref('')
|
||||||
@@ -137,7 +139,7 @@ onShareTimeline(() => ({
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page min-h-screen w-screen flex flex-col" style="background-color: #fafafd;">
|
<view class="app-page min-h-screen w-screen flex flex-col" style="background-color: #fafafd;">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar :default-title="navbarTitle" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" :default-title="navbarTitle" title-color="text-gray-900" />
|
||||||
|
|
||||||
<!-- 排序切换:默认 / 按置顶 / 按最新 / 按最旧 -->
|
<!-- 排序切换:默认 / 按置顶 / 按最新 / 按最旧 -->
|
||||||
<view class="box-border flex items-center gap-2 px-3 py-2">
|
<view class="box-border flex items-center gap-2 px-3 py-2">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
|
import { computed, onUnmounted, ref, watch, watchEffect } from 'vue'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { checkAvatarUrl } from '@/utils/url'
|
import { checkAvatarUrl } from '@/utils/url'
|
||||||
import { formatTime } from '@/utils/formatTime'
|
import { formatTime } from '@/utils/formatTime'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
@@ -16,12 +17,13 @@
|
|||||||
interface ISoical {
|
interface ISoical {
|
||||||
name: string
|
name: string
|
||||||
content: string
|
content: string
|
||||||
color : string,
|
color: string
|
||||||
bgColor : string,
|
bgColor: string
|
||||||
priority ?: number,
|
priority?: number
|
||||||
visible ?: boolean,
|
visible?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const authorConfig = computed(() => appConfigStore.configs.authorConfig)
|
const authorConfig = computed(() => appConfigStore.configs.authorConfig)
|
||||||
|
|
||||||
@@ -82,18 +84,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen overflow-hidden bg-page px-4 pb-10 pt-2">
|
<view class="box-border min-h-screen w-screen overflow-hidden bg-page px-4 pb-10 pt-2">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="联系博主" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="联系博主" title-color="text-gray-900" />
|
||||||
|
|
||||||
<view class="fixed -right-8 top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl" />
|
<view class="fixed top-8 h-28 w-28 rounded-full bg-[rgba(185,228,36,0.32)] blur-xl -right-8" />
|
||||||
<view class="fixed -left-10 top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl" />
|
<view class="fixed top-36 h-24 w-24 rounded-full bg-[rgba(215,249,76,0.45)] blur-xl -left-10" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="box-border relative flex items-center justify-between uh-global-card-glass uh-shadow-xs rounded-xl p-4">
|
class="uh-global-card-glass uh-shadow-xs relative box-border flex items-center justify-between rounded-xl p-4"
|
||||||
<view class="flex-1 relative flex flex-col rounded-2xl">
|
>
|
||||||
|
<view class="relative flex flex-1 flex-col rounded-2xl">
|
||||||
<view class="flex items-center gap-x-2 text-xs text-primary">
|
<view class="flex items-center gap-x-2 text-xs text-primary">
|
||||||
TO <text class="text-sm">·</text> 收
|
TO <text class="text-sm">·</text> 收
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-2 text-md text-gray-900 tracking-wider">
|
<view class="text-md mt-2 text-gray-900 tracking-wider">
|
||||||
素未谋面的朋友
|
素未谋面的朋友
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-2 text-xs text-black/60">
|
<view class="mt-2 text-xs text-black/60">
|
||||||
@@ -104,45 +107,53 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="shrink-0 uh-global-card-glass uh-shadow-xs border relative rotate-3 box-border w-22 overflow-hidden flex flex-col gap-y-1 items-center justify-center p-2">
|
class="uh-global-card-glass uh-shadow-xs uh-rotate-3 relative box-border w-22 flex shrink-0 flex-col items-center justify-center gap-y-1 overflow-hidden border p-2"
|
||||||
|
>
|
||||||
<image class="h-18 w-full" :src="bloggerInfo.avatar" mode="aspectFill" />
|
<image class="h-18 w-full" :src="bloggerInfo.avatar" mode="aspectFill" />
|
||||||
<text class="text-xs font-normal truncate">{{ bloggerInfo.nickname }}</text>
|
<text class="truncate text-xs font-normal">{{ bloggerInfo.nickname }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-4 flex flex-col gap-y-6 box-border uh-global-card-glass uh-shadow-xs rounded-xl px-4 py-3">
|
<view class="uh-global-card-glass uh-shadow-xs mt-4 box-border flex flex-col gap-y-6 rounded-xl px-4 py-3">
|
||||||
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="65vh"
|
<uh-data-loading
|
||||||
empty-text="暂无联系方式" empty-sub-text="" />
|
v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="65vh"
|
||||||
|
empty-text="暂无联系方式" empty-sub-text=""
|
||||||
|
/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<view class="w-full flex flex-col gap-y-3">
|
<view class="w-full flex flex-col gap-y-3">
|
||||||
<view class="text-md text-gray-900">
|
<view class="text-md text-gray-900">
|
||||||
展信安:
|
展信安:
|
||||||
</view>
|
</view>
|
||||||
<view v-if="bloggerInfo.intro" class="text-gray-900 text-sm">
|
<view v-if="bloggerInfo.intro" class="text-sm text-gray-900">
|
||||||
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
|
<mp-html
|
||||||
|
lazy-load :domain="markdownConfig.domain ?? ''"
|
||||||
:loading-img="markdownConfig.loadingGif" scroll-table selectable
|
:loading-img="markdownConfig.loadingGif" scroll-table selectable
|
||||||
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
||||||
:content="bloggerInfo.intro" :markdown="true" :show-line-number="true"
|
:content="bloggerInfo.intro" :markdown="true" :show-line-number="true"
|
||||||
:show-language-name="true" copy-by-long-press />
|
:show-language-name="true" copy-by-long-press
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="text-gray-600 text-sm py-4">
|
<view v-else class="py-4 text-sm text-gray-600">
|
||||||
祝你早安,午安,晚安。每天都有好心情,生活愉快!
|
祝你早安,午安,晚安。每天都有好心情,生活愉快!
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-2 w-full flex items-end flex-col gap-y-3">
|
<view class="mt-2 w-full flex flex-col items-end gap-y-3">
|
||||||
<text class="text-md font-semibold text-gray-900">{{ bloggerInfo.nickname }}</text>
|
<text class="text-md text-gray-900 font-semibold">{{ bloggerInfo.nickname }}</text>
|
||||||
<text class="text-xs text-black/60">{{ nowText }}</text>
|
<text class="text-xs text-black/60">{{ nowText }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="box-border pt-4 w-full flex flex-col gap-y-2 border-t border-t-dashed border-gray-200">
|
<view class="box-border w-full flex flex-col gap-y-2 border-t border-gray-200 border-t-dashed pt-4">
|
||||||
<view class="mb-2 text-md text-gray-900">
|
<view class="text-md mb-2 text-gray-900">
|
||||||
若有意,可依此觅:
|
若有意,可依此觅:
|
||||||
</view>
|
</view>
|
||||||
<view v-for="item in socialList" :key="item.name" class="flex items-center gap-3"
|
|
||||||
@click="handleOnClick(item)">
|
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass uh-shadow-xs border h-11 w-11 flex shrink-0 items-center justify-center rounded-xl"
|
v-for="item in socialList" :key="item.name" class="flex items-center gap-3"
|
||||||
:style="{ backgroundColor: item.bgColor ,color:item.color }">
|
@click="handleOnClick(item)"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="uh-global-card-glass uh-shadow-xs h-11 w-11 flex shrink-0 items-center justify-center border rounded-xl"
|
||||||
|
:style="{ backgroundColor: item.bgColor, color: item.color }"
|
||||||
|
>
|
||||||
<text class="text-sm font-bold" :style="{ color: item.color }">
|
<text class="text-sm font-bold" :style="{ color: item.color }">
|
||||||
{{ item.name ? item.name.charAt(0) : '' }}
|
{{ item.name ? item.name.charAt(0) : '' }}
|
||||||
</text>
|
</text>
|
||||||
@@ -160,3 +171,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.uh-rotate-3 {
|
||||||
|
transform: rotate(3deg);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
import { onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getChartData } from '@/api/uni-halo'
|
import { getChartData } from '@/api/uni-halo'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
import type { IDataStatistics } from '@/api/uni-halo'
|
import type { IDataStatistics } from '@/api/uni-halo'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
/** 依赖插件(plugin-data-statistics,参考 gallery 对象传参模式) */
|
/** 依赖插件(plugin-data-statistics,参考 gallery 对象传参模式) */
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { pluginId, checking, tips, available: uniHaloPluginAvailable, check: checkPluginAvailable } = usePluginAvailable({
|
const { pluginId, checking, tips, available: uniHaloPluginAvailable, check: checkPluginAvailable } = usePluginAvailable({
|
||||||
pluginId: NeedPluginIds.PluginDataStatistics,
|
pluginId: NeedPluginIds.PluginDataStatistics,
|
||||||
tips: '阿偶,检测到当前插件没有安装或者启用,无法使用功能哦,请联系管理员',
|
tips: '阿偶,检测到当前插件没有安装或者启用,无法使用功能哦,请联系管理员',
|
||||||
@@ -171,7 +173,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="bg-page box-border min-h-screen w-screen p-3">
|
<view class="bg-page box-border min-h-screen w-screen p-3">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="数据看板" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="数据看板" title-color="text-gray-900" />
|
||||||
|
|
||||||
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
||||||
:checking="checking" @on-refresh="handlePluginRefresh" />
|
:checking="checking" @on-refresh="handlePluginRefresh" />
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
style: {
|
style: {
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen bg-page p-3 pt-2">
|
<view class="box-border min-h-screen bg-page p-3 pt-2">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="免责声明" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="免责声明" title-color="text-gray-900" />
|
||||||
|
|
||||||
<view class="w-full h-full uh-global-card-glass uh-shadow-xs rounded-xl">
|
<view class="w-full h-full uh-global-card-glass uh-shadow-xs rounded-xl">
|
||||||
<!-- 通过配置 -->
|
<!-- 通过配置 -->
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { computed, ref, watchEffect } from 'vue'
|
|||||||
import { formatTime } from '@/utils/formatTime'
|
import { formatTime } from '@/utils/formatTime'
|
||||||
import { useFavoritesStore } from '@/store/favorites'
|
import { useFavoritesStore } from '@/store/favorites'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { FavoriteKind, IFavoriteItem } from '@/utils/favorite'
|
import type { FavoriteKind, IFavoriteItem } from '@/utils/favorite'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -12,6 +13,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const favoritesStore = useFavoritesStore()
|
const favoritesStore = useFavoritesStore()
|
||||||
|
|
||||||
/* ---------------- Tab(文章/瞬间) ---------------- */
|
/* ---------------- Tab(文章/瞬间) ---------------- */
|
||||||
@@ -70,7 +72,7 @@ const emptyText = computed(() => (activeKind.value === 'post' ? '还没有收藏
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen bg-page pb-10">
|
<view class="box-border min-h-screen w-screen bg-page pb-10">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="我的收藏" title-color="text-gray-900"></uh-navbar>
|
<uh-navbar :scroll-y="scrollY" default-title="我的收藏" title-color="text-gray-900"></uh-navbar>
|
||||||
|
|
||||||
<!-- 顶部类型 Tab(与图库页同款:吸顶玻璃胶囊 chip) -->
|
<!-- 顶部类型 Tab(与图库页同款:吸顶玻璃胶囊 chip) -->
|
||||||
<wd-sticky>
|
<wd-sticky>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useAppConfigStore } from '@/store/appConfig'
|
|||||||
import { useSettingStore } from '@/store/setting'
|
import { useSettingStore } from '@/store/setting'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
import type { ILink, ILinkGroup } from '@/api/types/halo'
|
import type { ILink, ILinkGroup } from '@/api/types/halo'
|
||||||
@@ -20,6 +21,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
|
|
||||||
@@ -407,7 +409,7 @@ onReachBottom(() => {
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="友情链接" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="友情链接" title-color="text-gray-900" />
|
||||||
|
|
||||||
<!-- 顶部 -->
|
<!-- 顶部 -->
|
||||||
<wd-sticky>
|
<wd-sticky>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { getCache, setCache } from '@/utils/storage'
|
|||||||
import { handleLoveModuleLocked } from '@/utils/loveModuleToken'
|
import { handleLoveModuleLocked } from '@/utils/loveModuleToken'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { ILoveAlbum, ILovePhoto } from '@/api/types/uni-halo'
|
import type { ILoveAlbum, ILovePhoto } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -19,6 +20,7 @@ definePage({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const loveConfig = computed(() => appConfigStore.configs.loveConfig)
|
const loveConfig = computed(() => appConfigStore.configs.loveConfig)
|
||||||
|
|
||||||
@@ -240,7 +242,7 @@ onReachBottom(() => {
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page box-border min-h-screen w-screen flex flex-col pb-safe">
|
<view class="app-page box-border min-h-screen w-screen flex flex-col pb-safe">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="恋爱相册" title-color="text-love" back-class="text-love" />
|
<uh-navbar :scroll-y="scrollY" default-title="恋爱相册" title-color="text-love" back-class="text-love" />
|
||||||
|
|
||||||
<!-- 加载/错误/空占位(状态机) -->
|
<!-- 加载/错误/空占位(状态机) -->
|
||||||
<uh-data-loading
|
<uh-data-loading
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import { checkImageUrl } from '@/utils/url'
|
import { checkImageUrl } from '@/utils/url'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { ILoveDailyItem } from '@/api/types/uni-halo'
|
import type { ILoveDailyItem } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -16,6 +17,8 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
|
|
||||||
/* ---------------- 展示层类型 ---------------- */
|
/* ---------------- 展示层类型 ---------------- */
|
||||||
/** 清单展示卡片(script 预处理后的干净展示数据) */
|
/** 清单展示卡片(script 预处理后的干净展示数据) */
|
||||||
interface ILoveItemCard {
|
interface ILoveItemCard {
|
||||||
@@ -278,7 +281,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="uh-global-love-page box-border min-h-screen w-screen flex flex-col">
|
<view class="uh-global-love-page box-border min-h-screen w-screen flex flex-col">
|
||||||
<uh-navbar default-title="恋爱清单" title-color="text-love" back-class="text-love"/>
|
<uh-navbar :scroll-y="scrollY" default-title="恋爱清单" title-color="text-love" back-class="text-love"/>
|
||||||
|
|
||||||
<wd-sticky>
|
<wd-sticky>
|
||||||
<view class="box-border px-3 pb-1 pt-2">
|
<view class="box-border px-3 pb-1 pt-2">
|
||||||
|
|||||||
+106
-146
@@ -5,6 +5,8 @@
|
|||||||
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
||||||
import { getPluginCaptcha, unlockLoveModule, type ICaptchaQuery, type IPluginCaptcha } from '@/api/uni-halo'
|
import { getPluginCaptcha, unlockLoveModule, type ICaptchaQuery, type IPluginCaptcha } from '@/api/uni-halo'
|
||||||
import { getLoveModuleToken, setLoveModuleToken, type LoveModuleKey } from '@/utils/loveModuleToken'
|
import { getLoveModuleToken, setLoveModuleToken, type LoveModuleKey } from '@/utils/loveModuleToken'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
|
import type { ILoveConfigGroup, ILoveModuleConfig } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
style: {
|
style: {
|
||||||
@@ -13,127 +15,72 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
/* ---------------- 恋爱配置 ---------------- */
|
/* ---------------- 恋爱配置 ---------------- */
|
||||||
interface ILoveConfigPage {
|
/** 恋爱配置(数据源为 getConfigs.loveConfig 组:恋爱日记仅密码状态;
|
||||||
|
* 三模块入口即 app 端入口列表数据,2026-09-12 起 /love-config 已下线) */
|
||||||
|
interface ILoveConfigPage extends Partial<ILoveConfigGroup> {
|
||||||
enabled : boolean
|
enabled : boolean
|
||||||
loveDateTitle : string
|
loveDateTitle : string
|
||||||
loveDate : string
|
loveDate : string
|
||||||
loveInfo : {
|
|
||||||
boyNickname : string
|
|
||||||
boyAvatar : string
|
|
||||||
girlNickname : string
|
|
||||||
girlAvatar : string
|
|
||||||
}
|
|
||||||
pageImages : {
|
|
||||||
bgImageUrl : string
|
|
||||||
waveImageUrl : string
|
|
||||||
heartImageUrl : string
|
|
||||||
}
|
|
||||||
loveDiary : { enabled : boolean, passwordEnabled ?: boolean }
|
|
||||||
ourStory : { enabled : boolean, passwordEnabled ?: boolean }
|
|
||||||
lovePhoto : { enabled : boolean, passwordEnabled ?: boolean }
|
|
||||||
loveDaily : { enabled : boolean, passwordEnabled ?: boolean }
|
|
||||||
navList ?: ILoveNavItem[]
|
|
||||||
[key : string] : unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ILoveNavItem {
|
|
||||||
key : string
|
|
||||||
title ?: string
|
|
||||||
subTitle ?: string
|
|
||||||
priority ?: number
|
|
||||||
visible ?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const loveConfig = ref<ILoveConfigPage>({
|
const loveConfig = ref<ILoveConfigPage>({
|
||||||
enabled: false,
|
enabled: false,
|
||||||
loveDateTitle: '',
|
loveDateTitle: '',
|
||||||
loveDate: '',
|
loveDate: '',
|
||||||
loveInfo: {
|
loveDiary: { passwordEnabled: false },
|
||||||
boyNickname: '',
|
|
||||||
boyAvatar: '',
|
|
||||||
girlNickname: '',
|
|
||||||
girlAvatar: '',
|
|
||||||
},
|
|
||||||
pageImages: {
|
|
||||||
bgImageUrl: '',
|
|
||||||
waveImageUrl: '',
|
|
||||||
heartImageUrl: '',
|
|
||||||
},
|
|
||||||
loveDiary: { enabled: false, passwordEnabled: false },
|
|
||||||
ourStory: { enabled: false, passwordEnabled: false },
|
ourStory: { enabled: false, passwordEnabled: false },
|
||||||
lovePhoto: { enabled: false, passwordEnabled: false },
|
lovePhoto: { enabled: false, passwordEnabled: false },
|
||||||
loveDaily: { enabled: false, passwordEnabled: false },
|
loveDaily: { enabled: false, passwordEnabled: false },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/** 恋爱页背景图 */
|
||||||
|
const loveBgImage = ref('')
|
||||||
|
|
||||||
const loveDayCount = ref({ d: 0, h: 0, m: 0, s: 0 })
|
const loveDayCount = ref({ d: 0, h: 0, m: 0, s: 0 })
|
||||||
let loveDayTimer : ReturnType<typeof setTimeout> | null = null
|
let loveDayTimer : ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
interface ILoveNavRenderItem {
|
interface ILoveNavRenderItem {
|
||||||
key : string
|
moduleKey : LoveModuleKey
|
||||||
use : boolean
|
use : boolean
|
||||||
locked : boolean
|
locked : boolean
|
||||||
iconPrefix : string
|
iconPrefix : string
|
||||||
icon : string
|
icon : string
|
||||||
|
/** 跳转路径(插件下发,直接 navigateTo) */
|
||||||
|
path : string
|
||||||
title : string
|
title : string
|
||||||
subTitle : string
|
subTitle : string
|
||||||
}
|
titleColor : string
|
||||||
|
subTitleColor : string
|
||||||
const useLocalNav = false
|
iconBgColor : string
|
||||||
|
|
||||||
const DEFAULT_NAV_LIST : ILoveNavItem[] = [
|
|
||||||
{ key: 'stories', title: '恋爱故事', subTitle: '我们一起度过的那些经历', priority: 1, visible: true },
|
|
||||||
{ key: 'album', title: '恋爱相册', subTitle: '定格了我们的那些小美好', priority: 2, visible: true },
|
|
||||||
{ key: 'list', title: '恋爱清单', subTitle: '你我之间的约定我们都在努力实现', priority: 3, visible: true },
|
|
||||||
]
|
|
||||||
|
|
||||||
const NAV_META: Record<string, { iconPrefix: string, icon: string, page: string }> = {
|
|
||||||
stories: { iconPrefix: 'uhlove-icon', icon: 'gushi', page: 'stories' },
|
|
||||||
album: { iconPrefix: 'uhlove-icon', icon: 'xiangce', page: 'album' },
|
|
||||||
list: { iconPrefix: 'uhlove-icon', icon: 'liebiao', page: 'list' },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const navList = ref<ILoveNavRenderItem[]>([])
|
const navList = ref<ILoveNavRenderItem[]>([])
|
||||||
|
|
||||||
/* ---------------- 数据加载 ---------------- */
|
/* ---------------- 数据加载 ---------------- */
|
||||||
function syncLoveConfigFromStore() {
|
function syncLoveConfigFromStore() {
|
||||||
const storeLove = appConfigStore.loveConfig
|
const loveConfigs = appConfigStore.configs.loveConfig
|
||||||
const appConfigs = appConfigStore.configs
|
|
||||||
|
|
||||||
loveConfig.value = {
|
loveConfig.value = {
|
||||||
...loveConfig.value,
|
...loveConfig.value,
|
||||||
...(storeLove.loveDateTitle ? { loveDateTitle: storeLove.loveDateTitle } : {}),
|
...(loveConfigs?.loveInfo?.loveDateTitle ? { loveDateTitle: loveConfigs.loveInfo.loveDateTitle } : {}),
|
||||||
...(storeLove.loveDate ? { loveDate: storeLove.loveDate } : {}),
|
...(loveConfigs?.loveInfo?.loveDate ? { loveDate: loveConfigs.loveInfo.loveDate } : {}),
|
||||||
...(storeLove.enabled !== undefined ? { enabled: storeLove.enabled } : {}),
|
|
||||||
loveInfo: {
|
|
||||||
...loveConfig.value.loveInfo,
|
|
||||||
...(storeLove.loveInfo || {}),
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const loveModuleConfig = appConfigs.loveConfig as Partial<ILoveConfigPage> | undefined
|
// 恋爱页背景图:读自 pageConfig.loveDiaryConfig.bgImageUrl
|
||||||
// 恋爱页背景图:2026-09-11 起插件端由 loveConfig.pageImages 迁至
|
const loveDiaryPageConfig = appConfigStore.configs.pageConfig?.loveDiaryConfig as
|
||||||
// pageConfig.loveDiaryConfig.bgImageUrl,优先读新位置、兼容回退旧值
|
|
||||||
const loveDiaryPageConfig = appConfigs.pageConfig?.loveDiaryConfig as
|
|
||||||
{ bgImageUrl ?: string } | undefined
|
{ bgImageUrl ?: string } | undefined
|
||||||
const pageImagesBg =
|
loveBgImage.value = loveDiaryPageConfig?.bgImageUrl || ''
|
||||||
loveDiaryPageConfig?.bgImageUrl
|
if (loveConfigs) {
|
||||||
|| loveModuleConfig?.pageImages?.bgImageUrl
|
|
||||||
|| loveConfig.value.pageImages.bgImageUrl
|
|
||||||
if (loveModuleConfig || loveDiaryPageConfig) {
|
|
||||||
loveConfig.value = {
|
loveConfig.value = {
|
||||||
...loveConfig.value,
|
...loveConfig.value,
|
||||||
pageImages: {
|
loveDiary: loveConfigs.loveDiary || loveConfig.value.loveDiary,
|
||||||
...loveConfig.value.pageImages,
|
ourStory: loveConfigs.ourStory || loveConfig.value.ourStory,
|
||||||
bgImageUrl: pageImagesBg,
|
lovePhoto: loveConfigs.lovePhoto || loveConfig.value.lovePhoto,
|
||||||
},
|
loveDaily: loveConfigs.loveDaily || loveConfig.value.loveDaily,
|
||||||
loveDiary: loveModuleConfig?.loveDiary || loveConfig.value.loveDiary,
|
|
||||||
ourStory: loveModuleConfig?.ourStory || loveConfig.value.ourStory,
|
|
||||||
lovePhoto: loveModuleConfig?.lovePhoto || loveConfig.value.lovePhoto,
|
|
||||||
loveDaily: loveModuleConfig?.loveDaily || loveConfig.value.loveDaily,
|
|
||||||
navList: loveModuleConfig?.navList || loveConfig.value.navList,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,35 +90,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 入口列表:由三模块配置构建(模块 key 即唯一标识,图标/跳转路径均用插件下发字段) */
|
||||||
function initList() {
|
function initList() {
|
||||||
const configs = loveConfig.value
|
const configs = loveConfig.value
|
||||||
const configured = configs.navList
|
const moduleKeys : LoveModuleKey[] = ['ourStory', 'lovePhoto', 'loveDaily']
|
||||||
let source : ILoveNavItem[]
|
// 插件端已按 priority 降序输出,此处仍按 priority 排序兜底(缺失视为 0)
|
||||||
if (!useLocalNav && configured && configured.length) {
|
const sorted = [...moduleKeys].sort((a, b) =>
|
||||||
source = configured
|
((configs[b] as ILoveModuleConfig | undefined)?.priority ?? 0) -
|
||||||
} else {
|
((configs[a] as ILoveModuleConfig | undefined)?.priority ?? 0))
|
||||||
source = DEFAULT_NAV_LIST;
|
navList.value = sorted.map((moduleKey) => {
|
||||||
}
|
const moduleCfg = configs[moduleKey] as ILoveModuleConfig | undefined
|
||||||
const sorted = [...source].sort((a, b) => (b.priority ?? 0) - (a.priority ?? 0))
|
if (!moduleCfg) {
|
||||||
navList.value = sorted.map((item) => {
|
|
||||||
const meta = NAV_META[item.key]
|
|
||||||
if (!meta) {
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
const moduleKey = MODULE_KEY_MAP[item.key]
|
|
||||||
const moduleCfg = moduleKey
|
|
||||||
? (configs[moduleKey] as { enabled ?: boolean, passwordEnabled ?: boolean } | undefined)
|
|
||||||
: undefined
|
|
||||||
const fallback = DEFAULT_NAV_LIST.find((d) => d.key === item.key)
|
|
||||||
return {
|
return {
|
||||||
key: item.key,
|
moduleKey,
|
||||||
use: !!moduleCfg?.enabled && item.visible !== false,
|
use: !!moduleCfg.enabled,
|
||||||
// 模块设了密码且本地无有效 token → 显示 lock;解锁后恢复箭头
|
// 模块设了密码且本地无有效 token → 锁定态;解锁后恢复箭头
|
||||||
locked: !!moduleCfg?.passwordEnabled && !(moduleKey && getLoveModuleToken(moduleKey)),
|
locked: !!moduleCfg.passwordEnabled && !getLoveModuleToken(moduleKey),
|
||||||
iconPrefix: meta.iconPrefix,
|
// 图标/跳转路径直接消费插件下发字段(不再本地映射)
|
||||||
icon: meta.icon,
|
iconPrefix: moduleCfg.iconPrefix || 'uhlove-icon',
|
||||||
title: item.title || fallback?.title || '',
|
icon: moduleCfg.icon || '',
|
||||||
subTitle: item.subTitle || fallback?.subTitle || '',
|
path: moduleCfg.path || '',
|
||||||
|
title: moduleCfg.title || '',
|
||||||
|
subTitle: moduleCfg.subTitle || '',
|
||||||
|
// 颜色直接消费插件下发的 hex8(#rrggbbaa),缺失回退内置默认
|
||||||
|
titleColor: moduleCfg.titleColor || '#f83856',
|
||||||
|
subTitleColor: moduleCfg.subTitleColor || '#f8385699',
|
||||||
|
iconBgColor: moduleCfg.iconBgColor || '#fce7f3',
|
||||||
}
|
}
|
||||||
}).filter((item) : item is ILoveNavRenderItem => item !== null)
|
}).filter((item) : item is ILoveNavRenderItem => item !== null)
|
||||||
}
|
}
|
||||||
@@ -202,37 +148,38 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- 跳转(模块密码拦截) ---------------- */
|
/* ---------------- 跳转(模块密码拦截) ---------------- */
|
||||||
const MODULE_KEY_MAP: Record<string, LoveModuleKey> = {
|
|
||||||
stories: 'ourStory',
|
|
||||||
album: 'lovePhoto',
|
|
||||||
list: 'loveDaily',
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 模块密码弹窗状态 */
|
/** 模块密码弹窗状态 */
|
||||||
const unlockModalVisible = ref(false)
|
const unlockModalVisible = ref(false)
|
||||||
const pendingPage = ref('')
|
/** 待跳转路径(模块下发的完整 path,解锁成功后 navigateTo) */
|
||||||
|
const pendingPath = ref('')
|
||||||
const pendingModule = ref<LoveModuleKey>('ourStory')
|
const pendingModule = ref<LoveModuleKey>('ourStory')
|
||||||
|
|
||||||
/** 恋爱日记入口(love 页本身)是否锁定:设了密码且本地无有效 token */
|
/** 恋爱日记入口(love 页本身)是否锁定:设了密码且本地无有效 token */
|
||||||
const loveDiaryLocked = computed(() =>
|
const loveDiaryLocked = computed(() =>
|
||||||
!!loveConfig.value.loveDiary?.passwordEnabled && !getLoveModuleToken('loveDiary'))
|
!!loveConfig.value.loveDiary?.passwordEnabled && !getLoveModuleToken('loveDiary'))
|
||||||
|
|
||||||
function handleToPage(pageName : string) {
|
const unlockTip = computed(() => {
|
||||||
const module = MODULE_KEY_MAP[pageName]
|
const moduleCfg = loveConfig.value[pendingModule.value] as ILoveModuleConfig | undefined
|
||||||
const moduleCfg = module
|
const tip = moduleCfg?.title || ''
|
||||||
? (loveConfig.value[module] as { enabled ?: boolean, passwordEnabled ?: boolean })
|
return `${tip}已设置访问密码,输入后进入`
|
||||||
: undefined
|
})
|
||||||
|
|
||||||
|
function handleToPage(moduleKey : LoveModuleKey) {
|
||||||
|
const moduleCfg = loveConfig.value[moduleKey] as ILoveModuleConfig | undefined
|
||||||
// 模块设了密码且本地无有效 token → 先弹密码框验证
|
// 模块设了密码且本地无有效 token → 先弹密码框验证
|
||||||
if (moduleCfg?.passwordEnabled && !getLoveModuleToken(module)) {
|
if (moduleCfg?.passwordEnabled && !getLoveModuleToken(moduleKey)) {
|
||||||
pendingPage.value = pageName
|
pendingPath.value = moduleCfg.path || ''
|
||||||
pendingModule.value = module
|
pendingModule.value = moduleKey
|
||||||
unlockModalVisible.value = true
|
unlockModalVisible.value = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// 跳转直接使用插件下发的 path
|
||||||
|
if (moduleCfg?.path) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages-blog/love/${pageName}`,
|
url: moduleCfg.path,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 通用解锁弹窗请求:unlock 签发 token(插件端要求验证码,403 附新码由弹窗展示重试) */
|
/** 通用解锁弹窗请求:unlock 签发 token(插件端要求验证码,403 附新码由弹窗展示重试) */
|
||||||
async function handleUnlockRequest(password : string, captcha ?: ICaptchaQuery | null) {
|
async function handleUnlockRequest(password : string, captcha ?: ICaptchaQuery | null) {
|
||||||
@@ -240,16 +187,16 @@
|
|||||||
return res.data as { token ?: string, [key : string] : unknown } | null | undefined
|
return res.data as { token ?: string, [key : string] : unknown } | null | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 解锁成功:存 token;恋爱日记入口(loveDiary)重新拉取恋爱信息,其余进入模块 */
|
/** 解锁成功:存 token;恋爱日记入口(loveDiary)重新拉取配置,其余进入模块 */
|
||||||
function handleUnlockSuccess(data : { token ?: string }) {
|
function handleUnlockSuccess(data : { token ?: string }) {
|
||||||
if (data.token) {
|
if (data.token) {
|
||||||
setLoveModuleToken(pendingModule.value, data.token)
|
setLoveModuleToken(pendingModule.value, data.token)
|
||||||
if (pendingModule.value === 'loveDiary') {
|
if (pendingModule.value === 'loveDiary') {
|
||||||
// 恋爱日记入口解锁:重新拉取 /love-config 并刷新页面状态
|
// 恋爱日记入口解锁:恋爱配置已并入 getConfigs loveConfig 组,刷新后重读
|
||||||
appConfigStore.fetchLoveConfig().then(() => syncLoveConfigFromStore())
|
appConfigStore.refreshStatic().then(() => syncLoveConfigFromStore())
|
||||||
}
|
}
|
||||||
else {
|
else if (pendingPath.value) {
|
||||||
uni.navigateTo({ url: `/pages-blog/love/${pendingPage.value}` })
|
uni.navigateTo({ url: pendingPath.value })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -267,7 +214,7 @@
|
|||||||
syncLoveConfigFromStore()
|
syncLoveConfigFromStore()
|
||||||
// 恋爱日记入口(love 页本身)设了密码且本地无 token → 先弹密码框验证
|
// 恋爱日记入口(love 页本身)设了密码且本地无 token → 先弹密码框验证
|
||||||
if (loveDiaryLocked.value) {
|
if (loveDiaryLocked.value) {
|
||||||
pendingPage.value = ''
|
pendingPath.value = ''
|
||||||
pendingModule.value = 'loveDiary'
|
pendingModule.value = 'loveDiary'
|
||||||
unlockModalVisible.value = true
|
unlockModalVisible.value = true
|
||||||
}
|
}
|
||||||
@@ -282,32 +229,33 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="bg-pink-50 min-h-screen w-screen">
|
<view class="bg-pink-50 min-h-screen w-screen">
|
||||||
<uh-navbar default-title="恋爱日记" :need-placeholder="false" back-class="text-love"
|
<uh-navbar :scroll-y="scrollY" default-title="恋爱日记" :need-placeholder="false" back-class="text-love"
|
||||||
title-color="!text-love"></uh-navbar>
|
title-color="!text-love"></uh-navbar>
|
||||||
|
|
||||||
<!-- 情侣信息 -->
|
<!-- 情侣信息 -->
|
||||||
<view class="box-border pt-12 relative z-10 h-92 w-screen flex flex-col items-center justify-center">
|
<view class="box-border pt-12 relative z-10 h-92 w-screen flex flex-col items-center justify-center">
|
||||||
<view class="relative z-10 w-full h-full flex items-center justify-center rounded-xl">
|
<view class="relative z-10 w-full h-full flex items-center justify-center rounded-xl">
|
||||||
<view class="boy flex flex-col items-center justify-center translate-x-0.5">
|
<view class="boy flex flex-col items-center justify-center uh-boy-offset">
|
||||||
<image class="uh-global-card-glass border-3 box-border border-blue-400 h-26 w-26 rounded-full"
|
<image class="uh-global-card-glass border-3 box-border border-blue-400 h-26 w-26 rounded-full"
|
||||||
:src="checkAvatarUrl(loveConfig.loveInfo.boyAvatar)" mode="aspectFill" />
|
:src="checkAvatarUrl(loveConfig.loveInfo?.boyAvatar)" mode="aspectFill" />
|
||||||
<view class="bg-blue-500 mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
|
<view class="bg-blue-500 mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
|
||||||
{{ loveConfig.loveInfo.boyNickname }}
|
{{ loveConfig.loveInfo?.boyNickname }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 心动呼吸动画 -->
|
<!-- 心动呼吸动画 -->
|
||||||
<text class="heart-beat absolute z-10"><wd-icon class-prefix="uhlove-icon" name="aixin" size="72rpx"></wd-icon></text>
|
<text class="heart-beat absolute z-10"><wd-icon class-prefix="uhlove-icon" name="aixin"
|
||||||
<view class="girl flex flex-col items-center justify-center -translate-x-0.5">
|
size="72rpx"></wd-icon></text>
|
||||||
|
<view class="girl flex flex-col items-center justify-center uh-girl-offset">
|
||||||
<image class="uh-global-card-glass border-3 box-border border-love h-26 w-26 rounded-full"
|
<image class="uh-global-card-glass border-3 box-border border-love h-26 w-26 rounded-full"
|
||||||
:src="checkAvatarUrl(loveConfig.loveInfo.girlAvatar)" mode="aspectFill" />
|
:src="checkAvatarUrl(loveConfig.loveInfo?.girlAvatar)" mode="aspectFill" />
|
||||||
<view class="bg-love mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
|
<view class="bg-love mt-2 text-center text-xs text-white font-bold px-2 py-1 rounded-lg">
|
||||||
{{ loveConfig.loveInfo.girlNickname }}
|
{{ loveConfig.loveInfo?.girlNickname }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image :src="checkImageUrl(loveConfig.pageImages.bgImageUrl)" class="absolute z-0 inset-0 w-full h-full"
|
<image :src="checkImageUrl(loveBgImage)" class="absolute z-0 inset-0 w-full h-full" mode="aspectFill" />
|
||||||
mode="aspectFill" />
|
<view
|
||||||
<view class="absolute z-2 left-0 bottom-0 w-full h-36 bg-gradient-to-b from-white/0 via-pink-50/50 to-pink-50" />
|
class="absolute z-2 left-0 bottom-0 w-full h-36 bg-gradient-to-b from-white/0 via-pink-50/50 to-pink-50" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 恋爱记时 -->
|
<!-- 恋爱记时 -->
|
||||||
@@ -338,33 +286,34 @@
|
|||||||
|
|
||||||
<!-- 功能导航 -->
|
<!-- 功能导航 -->
|
||||||
<view class="mt-6 box-border flex flex-col items-center justify-center gap-y-4 px-4">
|
<view class="mt-6 box-border flex flex-col items-center justify-center gap-y-4 px-4">
|
||||||
<block v-for="(nav, index) in navList" :key="index">
|
<block v-for="(nav, index) in navList" :key="nav.moduleKey">
|
||||||
<view v-if="nav.use"
|
<view v-if="nav.use"
|
||||||
class="box-border list-item uh-global-card-glass bg-white/60 p-3 w-full flex items-center justify-around gap-x-4 rounded-2xl"
|
class="box-border list-item uh-global-card-glass bg-white/60 p-3 w-full flex items-center justify-around gap-x-4 rounded-2xl"
|
||||||
:class="`list-item-${index + 1}`" @click="handleToPage(nav.key)">
|
:class="`list-item-${index + 1}`" @click="handleToPage(nav.moduleKey)">
|
||||||
<view class="flex items-center justify-center h-12 w-12 rounded-xl opacity-70" :class="[index%2===0?'bg-pink-100':'bg-blue-100']">
|
<view class="flex items-center justify-center h-12 w-12 rounded-xl opacity-70"
|
||||||
|
:style="{ backgroundColor: nav.iconBgColor }">
|
||||||
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="66rpx" />
|
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="66rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view class="box-border flex flex-1 flex-col justify-center gap-y-1">
|
<view class="box-border flex flex-1 flex-col justify-center gap-y-1">
|
||||||
<view class="name text-md font-bold" :class="[index%2===0?'text-love':'text-blue-400']">
|
<view class="name text-md font-bold" :style="{ color: nav.titleColor }">
|
||||||
{{ nav.title }}
|
{{ nav.title }}
|
||||||
</view>
|
</view>
|
||||||
<view class="text-xs truncate" :class="[index%2===0?'text-love/60':'text-blue-300']">
|
<view class="text-xs truncate" :style="{ color: nav.subTitleColor }">
|
||||||
{{ nav.subTitle }}
|
{{ nav.subTitle }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="shrink-0">
|
<view class="shrink-0">
|
||||||
<wd-icon :name="nav.locked ? 'lock' : 'arrow-right'" :class="[index%2===0?'text-love':'text-blue-400']"
|
<wd-icon :name="nav.locked ? 'lock' : 'arrow-right'"
|
||||||
size="32rpx"></wd-icon>
|
:style="{ color: nav.titleColor }" size="32rpx"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 模块密码验证弹窗(通用解锁弹窗;恋爱日记入口与模块共用;插件端要求验证码,403 附新码) -->
|
<!-- 模块密码验证弹窗-->
|
||||||
<uh-unlock-popup v-model:show="unlockModalVisible" title="请输入访问密码" captcha-enabled
|
<uh-unlock-popup v-model:show="unlockModalVisible" title="请输入访问密码" captcha-enabled
|
||||||
:tip="`${pendingModule === 'loveDiary' ? '恋爱日记' : pendingModule === 'ourStory' ? '恋爱故事' : pendingModule === 'lovePhoto' ? '恋爱相册' : '恋爱清单'}已设置访问密码,输入后进入`"
|
:tip="unlockTip"
|
||||||
placeholder="请输入密码" confirm-text="进入" :request="handleUnlockRequest" @success="handleUnlockSuccess" />
|
placeholder="请输入密码" confirm-text="进入" :request="handleUnlockRequest" @success="handleUnlockSuccess" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -375,6 +324,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes heartBeat {
|
@keyframes heartBeat {
|
||||||
|
|
||||||
0%,
|
0%,
|
||||||
100% {
|
100% {
|
||||||
transform: translateY(-1rem) scale(1);
|
transform: translateY(-1rem) scale(1);
|
||||||
@@ -446,4 +396,14 @@
|
|||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 男孩头像微偏右 */
|
||||||
|
.uh-boy-offset {
|
||||||
|
transform: translateX(0.125rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 女孩头像微偏左 */
|
||||||
|
.uh-girl-offset {
|
||||||
|
transform: translateX(-0.125rem);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
import { checkImageUrl } from '@/utils/url'
|
import { checkImageUrl } from '@/utils/url'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { ILoveStory } from '@/api/types/uni-halo'
|
import type { ILoveStory } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
/* ---------------- 展示层类型 ---------------- */
|
/* ---------------- 展示层类型 ---------------- */
|
||||||
@@ -254,7 +256,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page box-border min-h-screen w-screen flex flex-col">
|
<view class="app-page box-border min-h-screen w-screen flex flex-col">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="恋爱故事" title-color="text-love" back-class="text-love" />
|
<uh-navbar :scroll-y="scrollY" default-title="恋爱故事" title-color="text-love" back-class="text-love" />
|
||||||
|
|
||||||
<!-- 加载/错误/空占位(状态机) -->
|
<!-- 加载/错误/空占位(状态机) -->
|
||||||
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import { randomTagColor } from '@/utils/random'
|
import { randomTagColor } from '@/utils/random'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import type { IMoment } from '@/api/types/halo'
|
import type { IMoment } from '@/api/types/halo'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const favoritesStore = useFavoritesStore()
|
const favoritesStore = useFavoritesStore()
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
@@ -268,18 +270,19 @@
|
|||||||
title: moment.value?.owner?.displayName || '',
|
title: moment.value?.owner?.displayName || '',
|
||||||
query: moment.value ? `name=${moment.value.metadata.name}` : '',
|
query: moment.value ? `name=${moment.value.metadata.name}` : '',
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
onPageScroll((e : any) => {
|
||||||
|
console.log('滚动', e)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="app-page box-border min-h-screen w-screen bg-page pb-safe">
|
<view class="app-page box-border min-h-screen w-screen bg-page pb-safe">
|
||||||
<!-- 自定义导航 -->
|
<uh-navbar :scroll-y="scrollY" default-title="瞬间详情" title-color="text-gray-900" />
|
||||||
<uh-navbar default-title="瞬间详情" title-color="text-gray-900" />
|
|
||||||
|
|
||||||
<!-- 状态区(加载中/失败可重试/空) -->
|
|
||||||
<uh-data-loading v-if="status !== 'success'" :loading-status="status" min-height="60vh" error-text="瞬间内容加载失败"
|
<uh-data-loading v-if="status !== 'success'" :loading-status="status" min-height="60vh" error-text="瞬间内容加载失败"
|
||||||
empty-text="瞬间不存在或已被删除" @refresh="loadMoment" />
|
empty-text="瞬间不存在或已被删除" @refresh="loadMoment" />
|
||||||
|
|
||||||
<!-- 瞬间内页(日记式:大字日期刊头 + 阅读正文 + 媒体 + 互动脚注) -->
|
|
||||||
<view v-else-if="moment" class="box-border px-3 pt-2 pb-12">
|
<view v-else-if="moment" class="box-border px-3 pt-2 pb-12">
|
||||||
<view class="mb-3 uh-global-card-glass uh-shadow-xs overflow-hidden rounded-2xl box-border pb-4">
|
<view class="mb-3 uh-global-card-glass uh-shadow-xs overflow-hidden rounded-2xl box-border pb-4">
|
||||||
<!-- 刊头:大字日期 -->
|
<!-- 刊头:大字日期 -->
|
||||||
@@ -309,11 +312,10 @@
|
|||||||
|
|
||||||
<!-- 正文 -->
|
<!-- 正文 -->
|
||||||
<view class="content px-4 mt-6 text-gray-900 text-sm">
|
<view class="content px-4 mt-6 text-gray-900 text-sm">
|
||||||
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
|
<mp-html lazy-load :domain="markdownConfig.domain ?? ''" :loading-img="markdownConfig.loadingGif"
|
||||||
:loading-img="markdownConfig.loadingGif" scroll-table selectable
|
scroll-table selectable :tag-style="markdownConfig.tagStyle"
|
||||||
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
:container-style="markdownConfig.containStyle" :content="moment.spec.newHtml || ''"
|
||||||
:content="moment.spec.newHtml || ''" :markdown="true" :show-line-number="true"
|
:markdown="true" :show-line-number="true" :show-language-name="true" copy-by-long-press />
|
||||||
:show-language-name="true" copy-by-long-press />
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 图片附件 -->
|
<!-- 图片附件 -->
|
||||||
@@ -361,14 +363,16 @@
|
|||||||
<uh-comment-list v-if="moment" ref="commentListRef" :post-name="moment.metadata.name" :post="moment"
|
<uh-comment-list v-if="moment" ref="commentListRef" :post-name="moment.metadata.name" :post="moment"
|
||||||
kind="Moment" :disallow-comment="!moment.spec.allowComment" @on-comment="handleOnComment" />
|
kind="Moment" :disallow-comment="!moment.spec.allowComment" @on-comment="handleOnComment" />
|
||||||
</view>
|
</view>
|
||||||
<!-- 悬浮操作(与文章详情一致:点赞/评论/收藏) -->
|
|
||||||
<view v-if="moment" class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
|
<!-- 悬浮操作 -->
|
||||||
|
<view v-if="moment"
|
||||||
|
class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe uh-translate-x-center">
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
class="uh-global-card-glass box-border flex items-center justify-center gap-2 border rounded-full p-1 text-primary">
|
||||||
<!-- 点赞 -->
|
<!-- 点赞 -->
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
class="uh-global-card-glass box-border h-[72rpx] flex flex-1 items-center justify-center gap-x-1 border rounded-full px-4 shadow-none"
|
||||||
:class="{ active: hasUpvoted() }" @click="handleDoLikesClick">
|
:class="[hasUpvoted()?'text-primary':'text-gray-900']" @click="handleDoLikesClick">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm text-gray-900 font-semibold">点赞</text>
|
<text class="shrink-0 text-sm text-gray-900 font-semibold">点赞</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -385,7 +389,7 @@
|
|||||||
@click="handleToggleMomentFavorite">
|
@click="handleToggleMomentFavorite">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="36rpx" />
|
||||||
<text class="shrink-0 text-sm font-semibold"
|
<text class="shrink-0 text-sm font-semibold"
|
||||||
:class="momentFavorited ? 'text-primary' : 'text-gray-900'">{{ momentFavorited ? '已收藏' : '收藏' }}</text>
|
:class="[momentFavorited ? 'text-primary' : 'text-gray-900']">{{ momentFavorited ? '已收藏' : '收藏' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -396,3 +400,10 @@
|
|||||||
@on-close="handleOnCommentModalClose" />
|
@on-close="handleOnCommentModalClose" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
/* 水平居中定位 */
|
||||||
|
.uh-translate-x-center {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,337 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
/**
|
|
||||||
* 瞬间详情页(源自旧项目 pagesA/moment-detail,新建复刻)
|
|
||||||
* 展示瞬间内容(mp-html) + 图片/音频/视频附件
|
|
||||||
* 试点:useDataLoading 状态机接管加载四态 + 壁纸光斑玻璃卡设计
|
|
||||||
*/
|
|
||||||
import { computed, ref } from 'vue'
|
|
||||||
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
|
||||||
import { getMomentByName } from '@/api/halo'
|
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
|
||||||
import { checkAvatarUrl, checkThumbnailUrl } from '@/utils/url'
|
|
||||||
import { generateUUID } from '@/utils/uuid'
|
|
||||||
import { formatTime as formatTimeUtil } from '@/utils/formatTime'
|
|
||||||
import { randomTagColor } from '@/utils/random'
|
|
||||||
import { markdownConfig } from '@/config/markdown'
|
|
||||||
import { useDataLoading } from '@/hooks/useDataLoading'
|
|
||||||
import type { IMoment } from '@/api/types/halo'
|
|
||||||
|
|
||||||
definePage({
|
|
||||||
style: {
|
|
||||||
navigationBarTitleText: '瞬间详情',
|
|
||||||
enablePullDownRefresh: true,
|
|
||||||
// 下拉/回弹露出的窗口底色对齐页面底色,壁纸光斑由页面内提供
|
|
||||||
backgroundColor: '#f6f3ee',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const appConfigStore = useAppConfigStore()
|
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
|
||||||
|
|
||||||
const bloggerInfo = computed(() => {
|
|
||||||
const blogger = haloConfigs.value.authorConfig?.blogger as { nickname?: string, avatar?: string } | undefined
|
|
||||||
return {
|
|
||||||
nickname: blogger?.nickname || '',
|
|
||||||
avatar: checkAvatarUrl(blogger?.avatar),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const calcUseTagRandomColor = computed(() => !!haloConfigs.value.pageConfig?.momentConfig?.useTagRandomColor)
|
|
||||||
|
|
||||||
/** 站点名称(原 startConfig.title 已随启动页下线,改读 appConfig.appInfo.name) */
|
|
||||||
const siteName = computed(() => {
|
|
||||||
const appInfo = haloConfigs.value.appConfig?.appInfo as { name?: string } | undefined
|
|
||||||
return appInfo?.name || bloggerInfo.value.nickname || 'uni-halo'
|
|
||||||
})
|
|
||||||
|
|
||||||
/* ---------------- 状态 ---------------- */
|
|
||||||
const queryName = ref('')
|
|
||||||
const videoContexts = ref<Record<string, UniApp.VideoContext | undefined>>({})
|
|
||||||
const currentVideoId = ref<string | null>(null)
|
|
||||||
|
|
||||||
/** 瞬间卡片(medium 按类型拆为 images/videos/audios + 正文 tag 清理) */
|
|
||||||
type MomentCard = IMoment & {
|
|
||||||
images?: { type?: string, url: string }[]
|
|
||||||
videos?: { id?: string, url: string }[]
|
|
||||||
audios?: { type?: string, url: string }[]
|
|
||||||
spec: IMoment['spec'] & { newHtml?: string }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 移除 tag 链接 */
|
|
||||||
function removeTagLinksCompletely(htmlString: string): string {
|
|
||||||
const regex = /<a\b[^>]+class=(['"])[^'"]*\btag\b[^'"]*\1[^>]*>[\s\S]*?<\/a>/gi
|
|
||||||
return htmlString.replace(regex, '')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 瞬间详情 → 展示卡片(作者兜底 + medium 拆分 + tag 清理) */
|
|
||||||
function buildMomentCard(res: IMoment): MomentCard {
|
|
||||||
const medium = (res.spec.content?.medium || [])
|
|
||||||
.map(x => ({ ...x, url: x.url || '' }))
|
|
||||||
const owner = res.owner
|
|
||||||
return {
|
|
||||||
...res,
|
|
||||||
// 无顶层 owner(如个别历史接口)时兜底为博主信息
|
|
||||||
owner: owner?.displayName
|
|
||||||
? owner
|
|
||||||
: { displayName: bloggerInfo.value.nickname || '', name: bloggerInfo.value.nickname || '', avatar: bloggerInfo.value.avatar },
|
|
||||||
spec: {
|
|
||||||
...res.spec,
|
|
||||||
newHtml: removeTagLinksCompletely(res.spec.content?.html || ''),
|
|
||||||
},
|
|
||||||
images: medium.filter(x => x.type === 'PHOTO').map(x => ({ ...x, url: checkThumbnailUrl(x.url, true) })),
|
|
||||||
videos: medium.filter(x => x.type === 'VIDEO').map(x => ({ ...x, id: generateUUID() })),
|
|
||||||
audios: medium.filter(x => x.type === 'AUDIO'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 数据加载(useDataLoading 试点:状态由 hook 接管) ---------------- */
|
|
||||||
const { data: moment, status, run: loadMoment } = useDataLoading(
|
|
||||||
async (): Promise<MomentCard> => {
|
|
||||||
const res = await getMomentByName(queryName.value)
|
|
||||||
uni.setNavigationBarTitle({ title: '瞬间详情' })
|
|
||||||
return buildMomentCard(res.data)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
onSuccess: (card) => {
|
|
||||||
nextTick(() => {
|
|
||||||
createVideoContexts(card.videos || [])
|
|
||||||
})
|
|
||||||
},
|
|
||||||
onError: () => {
|
|
||||||
uni.setNavigationBarTitle({ title: '瞬间详情' })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
/** 标签颜色(随机模式下按数据稳定,避免每次渲染重新随机变色) */
|
|
||||||
const calcTagColors = computed(() => {
|
|
||||||
const tags = moment.value?.spec.tags || []
|
|
||||||
return tags.map(() => (calcUseTagRandomColor.value ? randomTagColor() : '#4d7c0f'))
|
|
||||||
})
|
|
||||||
|
|
||||||
function formatTime(time?: string): string {
|
|
||||||
// 与旧项目一致:yyyy年MM月dd日 星期w
|
|
||||||
return time ? formatTimeUtil({ d: time, f: 'yyyy年MM月dd日 星期w' }) : ''
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 视频互斥 ---------------- */
|
|
||||||
function createVideoContexts(videos: { id?: string }[]) {
|
|
||||||
stopAllVideos()
|
|
||||||
videos.forEach((item) => {
|
|
||||||
if (item.id) {
|
|
||||||
videoContexts.value[item.id] = uni.createVideoContext(`video_${item.id}`)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopAllVideos(excludesVideoId: string | null = null) {
|
|
||||||
Object.keys(videoContexts.value).forEach((videoId) => {
|
|
||||||
if (!excludesVideoId || excludesVideoId !== videoId) {
|
|
||||||
videoContexts.value[videoId]?.pause()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVideoPlay(videoId: string) {
|
|
||||||
currentVideoId.value = videoId
|
|
||||||
stopAllVideos(videoId)
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVideoPause(videoId: string) {
|
|
||||||
if (currentVideoId.value === videoId) {
|
|
||||||
currentVideoId.value = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVideoEnded() {
|
|
||||||
currentVideoId.value = null
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 交互 ---------------- */
|
|
||||||
function handlePreview(index: number, list: { url: string }[]) {
|
|
||||||
uni.previewImage({
|
|
||||||
current: index,
|
|
||||||
urls: list.map(item => item.url),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleToTopPage(duration = 500) {
|
|
||||||
uni.pageScrollTo({
|
|
||||||
scrollTop: 0,
|
|
||||||
duration,
|
|
||||||
fail: (err) => {
|
|
||||||
console.error('回顶失败', err)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 生命周期 ---------------- */
|
|
||||||
onLoad((options) => {
|
|
||||||
uni.setNavigationBarTitle({ title: '瞬间加载中...' })
|
|
||||||
queryName.value = options?.name || ''
|
|
||||||
loadMoment()
|
|
||||||
})
|
|
||||||
|
|
||||||
onPullDownRefresh(async () => {
|
|
||||||
videoContexts.value = {}
|
|
||||||
currentVideoId.value = null
|
|
||||||
await loadMoment()
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
})
|
|
||||||
|
|
||||||
onShareAppMessage(() => ({
|
|
||||||
path: `/pages-blog/moment-detail/moment-detail?name=${moment.value?.metadata.name}`,
|
|
||||||
title: moment.value?.owner?.displayName || '',
|
|
||||||
}))
|
|
||||||
|
|
||||||
onShareTimeline(() => ({
|
|
||||||
title: moment.value?.owner?.displayName || '',
|
|
||||||
query: moment.value ? `name=${moment.value.metadata.name}` : '',
|
|
||||||
}))
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<view class="app-page relative box-border min-h-screen w-screen bg-page pb-8">
|
|
||||||
<!-- 壁纸(柔和光斑为卡片毛玻璃取色,固定不随滚动) -->
|
|
||||||
<view class="pointer-events-none fixed inset-0 z-0 overflow-hidden">
|
|
||||||
<view class="absolute h-[420rpx] w-[420rpx] rounded-full bg-[rgba(103,164,242,0.16)] -left-[120rpx] -top-[60rpx]" />
|
|
||||||
<view class="absolute top-[240rpx] h-[360rpx] w-[360rpx] rounded-full bg-[rgba(244,143,177,0.15)] -right-[130rpx]" />
|
|
||||||
<view class="absolute top-[760rpx] h-[400rpx] w-[400rpx] rounded-full bg-[rgba(179,157,219,0.14)] -left-[150rpx]" />
|
|
||||||
<view class="absolute top-[1220rpx] h-[380rpx] w-[380rpx] rounded-full bg-[rgba(185,228,36,0.15)] -right-[120rpx]" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 状态区(加载中/失败可重试/空) -->
|
|
||||||
<uh-data-loading
|
|
||||||
v-if="status !== 'success'"
|
|
||||||
class="relative z-1"
|
|
||||||
:loading-status="status"
|
|
||||||
min-height="60vh"
|
|
||||||
error-text="瞬间内容加载失败"
|
|
||||||
empty-text="瞬间不存在或已被删除"
|
|
||||||
@refresh="loadMoment"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<!-- 瞬间内容(悬浮玻璃卡) -->
|
|
||||||
<view v-else-if="moment" class="moment-card uh-global-card-glass relative z-1 mx-4 mt-5 flex flex-col rounded-[32rpx] p-5">
|
|
||||||
<!-- 用户区 -->
|
|
||||||
<view class="user flex items-center gap-3">
|
|
||||||
<image class="h-[96rpx] w-[96rpx] shrink-0 border-4 border-white/90 rounded-full shadow-lg" :src="moment.owner?.avatar || bloggerInfo.avatar" mode="aspectFill" />
|
|
||||||
<view class="nickname min-w-0 flex flex-1 flex-col">
|
|
||||||
<view class="nickname-text text-[32rpx] text-gray-900 font-bold">
|
|
||||||
{{ moment.owner?.displayName || bloggerInfo.nickname }}
|
|
||||||
</view>
|
|
||||||
<view class="release-time mt-1 text-[24rpx] text-gray-400">
|
|
||||||
{{ formatTime(moment.spec.releaseTime) }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 互动数据(点赞/评论) -->
|
|
||||||
<view v-if="moment.stats && ((moment.stats.totalComment ?? 0) > 0 || (moment.stats.upvote ?? 0) > 0)" class="stats flex shrink-0 items-center gap-2">
|
|
||||||
<view class="flex items-center gap-1 rounded-full bg-black/5 px-2.5 py-1 text-[22rpx] text-gray-500">
|
|
||||||
<wd-icon name="heart" size="12px" color="#f08585" />
|
|
||||||
<text>{{ moment.stats.upvote || 0 }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center gap-1 rounded-full bg-black/5 px-2.5 py-1 text-[22rpx] text-gray-500">
|
|
||||||
<wd-icon name="message" size="12px" color="#7f8ea3" />
|
|
||||||
<text>{{ moment.stats.totalComment || 0 }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 标签 -->
|
|
||||||
<view v-if="moment.spec.tags && moment.spec.tags.length !== 0" class="tags mt-4 flex flex-wrap gap-2">
|
|
||||||
<view v-for="(tag, tagIndex) in moment.spec.tags" :key="tagIndex" class="rounded-full bg-black/5 px-3 py-1 text-[22rpx] font-bold" :style="{ color: calcTagColors[tagIndex] }">
|
|
||||||
# {{ tag }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 内容 -->
|
|
||||||
<view class="content mt-4">
|
|
||||||
<mp-html
|
|
||||||
class="evan-markdown"
|
|
||||||
lazy-load
|
|
||||||
:domain="markdownConfig.domain ?? ''"
|
|
||||||
:loading-img="markdownConfig.loadingGif"
|
|
||||||
scroll-table
|
|
||||||
selectable
|
|
||||||
:tag-style="markdownConfig.tagStyle"
|
|
||||||
:container-style="markdownConfig.containStyle"
|
|
||||||
:content="moment.spec.newHtml || ''"
|
|
||||||
:markdown="true"
|
|
||||||
:show-line-number="true"
|
|
||||||
:show-language-name="true"
|
|
||||||
copy-by-long-press
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 图片附件 -->
|
|
||||||
<view v-if="moment.images && moment.images.length !== 0" class="mt-5">
|
|
||||||
<view class="mb-3 flex items-center gap-2">
|
|
||||||
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
|
|
||||||
<text class="text-[26rpx] text-gray-500 font-bold">图片附件</text>
|
|
||||||
</view>
|
|
||||||
<view class="images flex flex-wrap items-start">
|
|
||||||
<view
|
|
||||||
v-for="(image, mediumIndex) in moment.images"
|
|
||||||
:key="mediumIndex"
|
|
||||||
class="image-item box-border p-1.5"
|
|
||||||
:class="moment.images && moment.images.length === 1 ? 'h-[350rpx] w-full' : (moment.images && moment.images.length === 2 ? 'h-[250rpx] w-1/2' : 'h-[200rpx] w-1/3')"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
mode="aspectFill"
|
|
||||||
class="image-src h-full w-full rounded-lg"
|
|
||||||
:src="image.url"
|
|
||||||
@click="handlePreview(mediumIndex, moment.images || [])"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 音频附件 -->
|
|
||||||
<view v-if="moment.audios && moment.audios.length !== 0" class="mt-5">
|
|
||||||
<view class="mb-3 flex items-center gap-2">
|
|
||||||
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
|
|
||||||
<text class="text-[26rpx] text-gray-500 font-bold">音频附件</text>
|
|
||||||
</view>
|
|
||||||
<view class="audio-list flex flex-col gap-3">
|
|
||||||
<uh-audio-player
|
|
||||||
v-for="audio in moment.audios"
|
|
||||||
:key="audio.url"
|
|
||||||
:src="audio.url"
|
|
||||||
:poster="bloggerInfo.avatar"
|
|
||||||
:name="`来自${siteName}的声音`"
|
|
||||||
:author="bloggerInfo.nickname"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 视频附件 -->
|
|
||||||
<view v-if="moment.videos && moment.videos.length !== 0" class="mt-5">
|
|
||||||
<view class="mb-3 flex items-center gap-2">
|
|
||||||
<view class="h-[24rpx] w-[6rpx] rounded-full bg-secondary" />
|
|
||||||
<text class="text-[26rpx] text-gray-500 font-bold">视频附件</text>
|
|
||||||
</view>
|
|
||||||
<view class="video-list w-full flex flex-col gap-3">
|
|
||||||
<video
|
|
||||||
v-for="(video, index) in moment.videos"
|
|
||||||
:id="`video_${video.id}`"
|
|
||||||
:key="index"
|
|
||||||
class="video-src h-[400rpx] w-full rounded-xl"
|
|
||||||
:src="video.url"
|
|
||||||
:show-mute-btn="true"
|
|
||||||
:controls="true"
|
|
||||||
:show-center-play-btn="true"
|
|
||||||
:enable-progress-gesture="true"
|
|
||||||
@play="onVideoPlay(video.id || '')"
|
|
||||||
@pause="onVideoPause(video.id || '')"
|
|
||||||
@ended="onVideoEnded"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 回顶 -->
|
|
||||||
<view class="to-top-btn uh-global-card-glass fixed bottom-[100rpx] right-6 z-6 h-[72rpx] w-[72rpx] flex items-center justify-center rounded-full" @click="handleToTopPage()">
|
|
||||||
<wd-icon name="arrow-up" size="20px" color="#6b7280" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getNoticeDetail } from '@/api/uni-halo'
|
import { getNoticeDetail } from '@/api/uni-halo'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { checkImageUrl, checkIsUrl } from '@/utils/url'
|
import { checkImageUrl, checkIsUrl } from '@/utils/url'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
||||||
const name = ref('')
|
const name = ref('')
|
||||||
const detail = ref<INoticeDetail | null>(null)
|
const detail = ref<INoticeDetail | null>(null)
|
||||||
@@ -90,7 +92,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen bg-page pb-safe">
|
<view class="box-border min-h-screen w-screen bg-page pb-safe">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="公告详情" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="公告详情" title-color="text-gray-900" />
|
||||||
|
|
||||||
<!-- 加载/错误/空态(状态机) -->
|
<!-- 加载/错误/空态(状态机) -->
|
||||||
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
|
<uh-data-loading v-if="loadingStatus !== 'success'" :loading-status="loadingStatus" min-height="75vh"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import { getNotices } from '@/api/uni-halo'
|
import { getNotices } from '@/api/uni-halo'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { checkImageUrl } from '@/utils/url'
|
import { checkImageUrl } from '@/utils/url'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import type { INoticeListVo } from '@/api/types/uni-halo'
|
import type { INoticeListVo } from '@/api/types/uni-halo'
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const PAGE_SIZE = 100
|
const PAGE_SIZE = 100
|
||||||
|
|
||||||
/** 状态机:首屏/下拉刷新 loading、empty、error;触底加载失败仅提示,不切整页错误态 */
|
/** 状态机:首屏/下拉刷新 loading、empty、error;触底加载失败仅提示,不切整页错误态 */
|
||||||
@@ -180,7 +182,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="公告中心" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="公告中心" title-color="text-gray-900" />
|
||||||
|
|
||||||
<wd-sticky>
|
<wd-sticky>
|
||||||
<scroll-view scroll-x class="w-full whitespace-nowrap" :show-scrollbar="false">
|
<scroll-view scroll-x class="w-full whitespace-nowrap" :show-scrollbar="false">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
import { markdownConfig } from '@/config/markdown'
|
import { markdownConfig } from '@/config/markdown'
|
||||||
import { debounce } from '@/utils/debounce'
|
import { debounce } from '@/utils/debounce'
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
|
|
||||||
@@ -206,7 +208,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-6">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-6">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar default-title="内容搜索" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="内容搜索" title-color="text-gray-900" />
|
||||||
|
|
||||||
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
||||||
:checking="checking" @on-refresh="handlePluginRefresh" />
|
:checking="checking" @on-refresh="handlePluginRefresh" />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { useSettingStore } from '@/store/setting'
|
import { useSettingStore } from '@/store/setting'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { collectSiteDefaults } from '@/utils/preference'
|
import { collectSiteDefaults } from '@/utils/preference'
|
||||||
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
|
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
|
||||||
import type { PrefDef } from '@/hooks/usePreferenceRows'
|
import type { PrefDef } from '@/hooks/usePreferenceRows'
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const settingStore = useSettingStore()
|
const settingStore = useSettingStore()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
@@ -116,7 +118,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen bg-page">
|
<view class="box-border min-h-screen bg-page">
|
||||||
<!-- 自定义标题 -->
|
<!-- 自定义标题 -->
|
||||||
<uh-navbar default-title="偏好设置" title-color="text-gray-900" :need-placeholder="true" />
|
<uh-navbar :scroll-y="scrollY" default-title="偏好设置" title-color="text-gray-900" :need-placeholder="true" />
|
||||||
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<view class="box-border flex flex-col gap-y-6 p-3">
|
<view class="box-border flex flex-col gap-y-6 p-3">
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
style: {
|
style: {
|
||||||
@@ -7,6 +8,7 @@
|
|||||||
navigationStyle: 'custom',
|
navigationStyle: 'custom',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -16,7 +18,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="w-full min-h-screen bg-page">
|
<view class="w-full min-h-screen bg-page">
|
||||||
<uh-navbar default-title="测试页面" :need-placeholder="true" title-color="text-gray-900"></uh-navbar>
|
<uh-navbar :scroll-y="scrollY" default-title="测试页面" :need-placeholder="true" title-color="text-gray-900"></uh-navbar>
|
||||||
|
|
||||||
<!-- 内容区:由于 uh-navbar 内置有占位,所以我们的页面的主要内容应该从这里开始,比如这里就可以设置内边距或者其他样式,最外层的 <view class="w-full min-h-screen bg-page"> 仅作为容器-->
|
<!-- 内容区:由于 uh-navbar 内置有占位,所以我们的页面的主要内容应该从这里开始,比如这里就可以设置内边距或者其他样式,最外层的 <view class="w-full min-h-screen bg-page"> 仅作为容器-->
|
||||||
<view class="box-border px-3">
|
<view class="box-border px-3">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue'
|
|||||||
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
import { onLoad, onPullDownRefresh, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
|
||||||
import { getVoteDetail, submitVote } from '@/api/uni-halo'
|
import { getVoteDetail, submitVote } from '@/api/uni-halo'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { calcVotePercent, calcVoteState, VOTE_TYPES, voteCacheUtil } from '@/utils/vote'
|
import { calcVotePercent, calcVoteState, VOTE_TYPES, voteCacheUtil } from '@/utils/vote'
|
||||||
import { formatTime as formatTimeUtil } from '@/utils/formatTime'
|
import { formatTime as formatTimeUtil } from '@/utils/formatTime'
|
||||||
import type { IVote, IVoteDetail, IVoteOption } from '@/api/types/uni-halo'
|
import type { IVote, IVoteDetail, IVoteOption } from '@/api/types/uni-halo'
|
||||||
@@ -16,6 +17,7 @@ definePage({
|
|||||||
})
|
})
|
||||||
|
|
||||||
/* ---------------- 状态 ---------------- */
|
/* ---------------- 状态 ---------------- */
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
const { loadingStatus, updateLoadingStatus } = useDataLoadingStatus()
|
||||||
const submitLoading = ref(false)
|
const submitLoading = ref(false)
|
||||||
const pageTitle = ref('加载中...')
|
const pageTitle = ref('加载中...')
|
||||||
@@ -262,7 +264,7 @@ onShareTimeline(() => ({
|
|||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-safe">
|
||||||
<!-- 自定义导航 -->
|
<!-- 自定义导航 -->
|
||||||
<uh-navbar :default-title="pageTitle" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" :default-title="pageTitle" title-color="text-gray-900" />
|
||||||
|
|
||||||
<!-- 加载/错误/空占位(状态机) -->
|
<!-- 加载/错误/空占位(状态机) -->
|
||||||
<uh-data-loading
|
<uh-data-loading
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
||||||
import { getVoteList } from '@/api/uni-halo'
|
import { getVoteList } from '@/api/uni-halo'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { debounce } from '@/utils/debounce'
|
import { debounce } from '@/utils/debounce'
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
|
|
||||||
@@ -300,7 +302,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
<view class="app-page min-h-screen w-screen flex flex-col bg-page">
|
||||||
<uh-navbar default-title="投票中心" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" default-title="投票中心" title-color="text-gray-900" />
|
||||||
|
|
||||||
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
||||||
:checking="checking" @on-refresh="handlePluginRefresh" />
|
:checking="checking" @on-refresh="handlePluginRefresh" />
|
||||||
|
|||||||
@@ -266,17 +266,17 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="relative min-h-screen flex flex-col justify-center bg-[#f5fae8]">
|
<view class="relative min-h-screen w-screen flex flex-col justify-center bg-[#f5fae8] overflow-hidden">
|
||||||
<!-- 背景 -->
|
<!-- 背景 -->
|
||||||
<view
|
<view
|
||||||
class="absolute lef-0 top-0 w-full h-[46vh] from-[#d9f77f] via-[#e8fbaf] to-[#f5fae8] bg-gradient-to-b" />
|
class="fixed lef-0 top-0 z-0 w-full h-[46vh] from-[#d9f77f] via-[#e8fbaf] to-[#f5fae8] bg-gradient-to-b" />
|
||||||
|
|
||||||
<!-- 刷新 -->
|
<!-- 刷新 -->
|
||||||
<uh-data-loading v-if="viewState === 'loading'" />
|
<uh-data-loading v-if="viewState === 'loading'" />
|
||||||
|
|
||||||
<!-- 拉取失败(手动进入,通常为服务器停机中) -->
|
<!-- 拉取失败 -->
|
||||||
<view v-else-if="viewState === 'error'"
|
<view v-else-if="viewState === 'error'"
|
||||||
class="relative z-10 flex flex-col items-center justify-center px-10 py-48 text-center">
|
class="w-full relative z-10 flex flex-col items-center justify-center px-10 py-48 text-center">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="140rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="140rpx" />
|
||||||
<text class="mt-6 text-md text-gray-900 font-bold">
|
<text class="mt-6 text-md text-gray-900 font-bold">
|
||||||
服务暂时无法访问
|
服务暂时无法访问
|
||||||
@@ -290,38 +290,37 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 维护页-->
|
<!-- 维护页-->
|
||||||
<view v-else class="relative z-10 w-full min-h-screen flex items-center justify-center flex-col ">
|
<view v-else class="w-full relative z-10 w-full min-h-screen flex items-center justify-center flex-col">
|
||||||
|
<view class="w-full relative px-[40rpx] pb-[64rpx] pt-[calc(var(--status-bar-height)+76rpx)] text-center">
|
||||||
<view
|
<view
|
||||||
class="w-full relative overflow-hidden px-[40rpx] pb-[64rpx] pt-[calc(var(--status-bar-height)+76rpx)] text-center">
|
class="breathe pointer-events-none absolute left-[-60rpx] top-[104rpx] z-0 h-[260rpx] w-[260rpx] rounded-full bg-white/40 uh-blur-52" />
|
||||||
<view
|
<view
|
||||||
class="breathe pointer-events-none absolute left-[-60rpx] top-[104rpx] z-0 h-[260rpx] w-[260rpx] rounded-full bg-white/40 blur-[52rpx]" />
|
class="pointer-events-none absolute right-[-48rpx] top-[40rpx] z-0 h-[200rpx] w-[200rpx] rounded-full bg-[rgba(184,236,63,0.28)] uh-blur-52" />
|
||||||
<view
|
<view
|
||||||
class="pointer-events-none absolute right-[-48rpx] top-[40rpx] z-0 h-[200rpx] w-[200rpx] rounded-full bg-[rgba(184,236,63,0.28)] blur-[52rpx]" />
|
class="pointer-events-none absolute bottom-[-40rpx] right-[72rpx] z-0 h-[160rpx] w-[160rpx] rounded-full bg-white/40 uh-blur-52" />
|
||||||
<view
|
|
||||||
class="pointer-events-none absolute bottom-[-40rpx] right-[72rpx] z-0 h-[160rpx] w-[160rpx] rounded-full bg-white/40 blur-[52rpx]" />
|
|
||||||
|
|
||||||
<view class="relative z-2 mx-auto mt-[44rpx] h-[236rpx] w-[236rpx]">
|
<view class="relative z-2 mx-auto mt-[44rpx] h-[236rpx] w-[236rpx]">
|
||||||
<view
|
<view
|
||||||
class="bob flex items-center justify-center absolute inset-0 rounded-full from-[#ebfabf] to-[#b8ec3f] bg-gradient-to-br shadow-[0_0_0_12rpx_#fff,0_28rpx_60rpx_rgba(98,124,44,0.22)]">
|
class="bob flex items-center justify-center absolute inset-0 rounded-full from-[#ebfabf] to-[#b8ec3f] bg-gradient-to-br uh-global-card-glass border-4 border-white">
|
||||||
<image v-if="appLogo" class="h-full w-full rounded-full" :src="appLogo" mode="aspectFill" />
|
<image v-if="appLogo" class="h-full w-full rounded-full" :src="appLogo" mode="aspectFill" />
|
||||||
<wd-icon v-else class-prefix="uhemoji-icon" name="-thinking" size="140rpx"
|
<wd-icon v-else class-prefix="uhemoji-icon" name="-thinking" size="140rpx"
|
||||||
class="text-gray-900" />
|
class="text-gray-900" />
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="gear-spin absolute right-[-28rpx] top-[-16rpx] h-[68rpx] w-[68rpx] flex items-center justify-center">
|
class="gear-spin absolute right-[-28rpx] top-[-16rpx] h-[68rpx] w-[68rpx] flex items-center justify-center">
|
||||||
<wd-icon name="settings" size="24px" />
|
<wd-icon name="settings" size="45rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="gear-spin-reverse absolute bottom-[16rpx] left-[-32rpx] h-[48rpx] w-[48rpx] flex items-center justify-center">
|
class="gear-spin-reverse absolute bottom-[16rpx] left-[-32rpx] h-[48rpx] w-[48rpx] flex items-center justify-center">
|
||||||
<wd-icon name="settings" size="16px" />
|
<wd-icon name="settings" size="32rpx" />
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="absolute bottom-[-28rpx] left-1/2 inline-flex items-center whitespace-nowrap border-2 border-solid border-[#ebfabf] rounded-full bg-[#ebfabf] px-[24rpx] py-[12rpx] text-[22rpx] font-extrabold leading-none shadow-[0_10rpx_28rpx_rgba(90,110,45,0.18)] -translate-x-1/2 -rotate-5">
|
class="absolute bottom-[-28rpx] left-1/2 inline-flex items-center whitespace-nowrap border-2 border-solid border-[#ebfabf] rounded-full bg-[#ebfabf] px-[24rpx] py-[12rpx] text-[22rpx] font-extrabold leading-none uh-shadow-sm uh-badge">
|
||||||
MAINTENANCE
|
MAINTENANCE
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="relative z-2 mt-8 text-6 font-black leading-8">
|
<view class="relative z-2 mt-8 text-5 font-black leading-8">
|
||||||
<uh-text-underline>{{ title }}</uh-text-underline>
|
<uh-text-underline>{{ title }}</uh-text-underline>
|
||||||
</view>
|
</view>
|
||||||
<view class="relative z-2 mt-6 px-[16rpx] text-[25rpx] text-balck/50 font-medium leading-[1.7]">
|
<view class="relative z-2 mt-6 px-[16rpx] text-[25rpx] text-balck/50 font-medium leading-[1.7]">
|
||||||
@@ -340,14 +339,14 @@
|
|||||||
<!-- ===== 内容区 ===== -->
|
<!-- ===== 内容区 ===== -->
|
||||||
<view class="relative z-10 w-full">
|
<view class="relative z-10 w-full">
|
||||||
<view
|
<view
|
||||||
class="pointer-events-none absolute left-[64rpx] top-[-52rpx] z-0 h-[192rpx] w-[192rpx] rounded-full bg-[#ebfabf] opacity-90 blur-[44rpx]" />
|
class="pointer-events-none absolute left-[64rpx] top-[-52rpx] z-0 h-[192rpx] w-[192rpx] rounded-full bg-[#ebfabf] opacity-90 uh-blur-44" />
|
||||||
<view
|
<view
|
||||||
class="pointer-events-none absolute right-[-52rpx] top-[300rpx] z-0 h-[168rpx] w-[168rpx] rounded-full bg-[#ffd53d] opacity-20 blur-[44rpx]" />
|
class="pointer-events-none absolute right-[-52rpx] top-[300rpx] z-0 h-[168rpx] w-[168rpx] rounded-full bg-[#ffd53d] opacity-20 uh-blur-44" />
|
||||||
<view
|
<view
|
||||||
class="relative box-border w-full z-1 flex flex-col items-center gap-[28rpx] px-6 pb-[68rpx] pt-[32rpx]">
|
class="relative box-border w-full z-1 flex flex-col items-center gap-[28rpx] px-6 pb-[68rpx] pt-[32rpx]">
|
||||||
<!-- 恢复倒计时 -->
|
<!-- 恢复倒计时 -->
|
||||||
<view v-if="countdownParts"
|
<view v-if="countdownParts"
|
||||||
class="relative w-full uh-global-card-glass overflow-hidden border rounded-2xl p-[32rpx] text-center shadow-[0_4rpx_24rpx_rgba(98,124,44,0.08)]">
|
class="relative w-full uh-global-card-glass border rounded-2xl overflow-hidden p-[32rpx] text-center shadow-[0_4rpx_24rpx_rgba(98,124,44,0.08)]">
|
||||||
<view
|
<view
|
||||||
class="absolute bottom-[-48rpx] right-[-12rpx] text-[176rpx] text-[#a7e93b] font-black leading-none opacity-10">
|
class="absolute bottom-[-48rpx] right-[-12rpx] text-[176rpx] text-[#a7e93b] font-black leading-none opacity-10">
|
||||||
GO!
|
GO!
|
||||||
@@ -393,10 +392,11 @@
|
|||||||
|
|
||||||
<!-- 操作 -->
|
<!-- 操作 -->
|
||||||
<view class="mt-2 w-full flex flex-col gap-4">
|
<view class="mt-2 w-full flex flex-col gap-4">
|
||||||
<uh-button custom-class="uh-global-card-glass border flex-1 py-3 !rounded-full font-semibold"
|
<uh-button
|
||||||
|
custom-class="uh-global-card-glass w-full border flex-1 py-3 !rounded-full font-semibold"
|
||||||
@click="handleRefresh">{{ spinning?'请稍等...':'刷新试试'}}</uh-button>
|
@click="handleRefresh">{{ spinning?'请稍等...':'刷新试试'}}</uh-button>
|
||||||
<view v-if="detailHtml"
|
<view v-if="detailHtml"
|
||||||
class="uh-global-card-glass py-2 flex flex-1 items-center justify-center rounded-full bg-white text-sm text-primary font-extrabold uh-shadow-xs"
|
class="uh-global-card-glass w-full py-2 flex flex-1 items-center justify-center rounded-full bg-white text-sm text-primary font-extrabold uh-shadow-xs"
|
||||||
@click="showDetail = true">
|
@click="showDetail = true">
|
||||||
维护详情
|
维护详情
|
||||||
</view>
|
</view>
|
||||||
@@ -414,7 +414,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="toast"
|
<view v-if="toast"
|
||||||
class="uh-global-card-glass border fixed bottom-[calc(72rpx+env(safe-area-inset-bottom))] left-1/2 z-60 whitespace-nowrap rounded-full px-6 py-2 text-xs font-bold -translate-x-1/2">
|
class="uh-global-card-glass border fixed bottom-[calc(72rpx+env(safe-area-inset-bottom))] left-1/2 z-60 whitespace-nowrap rounded-full px-6 py-2 text-xs font-bold uh-translate-x-center">
|
||||||
{{ toast }}
|
{{ toast }}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -424,6 +424,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
.uh-blur-44 {
|
||||||
|
filter: blur(44rpx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uh-blur-52 {
|
||||||
|
filter: blur(52rpx);
|
||||||
|
}
|
||||||
|
|
||||||
/* 光斑呼吸 */
|
/* 光斑呼吸 */
|
||||||
.breathe {
|
.breathe {
|
||||||
animation: breathe 5s ease-in-out infinite;
|
animation: breathe 5s ease-in-out infinite;
|
||||||
@@ -492,4 +500,14 @@
|
|||||||
.press:active {
|
.press:active {
|
||||||
transform: scale(0.94);
|
transform: scale(0.94);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MAINTENANCE 徽章:居中 + 轻微旋转 */
|
||||||
|
.uh-badge {
|
||||||
|
transform: translateX(-50%) rotate(-5deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 水平居中定位 */
|
||||||
|
.uh-translate-x-center {
|
||||||
|
transform: translateX(-50%);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,266 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
/**
|
|
||||||
* 关于页
|
|
||||||
* 功能:博主信息 + 站点统计 + 功能导航 + 版权
|
|
||||||
* 风格:对齐全站设计语言(bg-page + uh-global-card-glass + uh-section-title + 彩色图标块)
|
|
||||||
*/
|
|
||||||
import { computed, ref, watch } from 'vue'
|
|
||||||
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
|
|
||||||
import { getBlogStatistics } from '@/api/halo'
|
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
|
||||||
import { useFavoritesStore } from '@/store/favorites'
|
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
|
||||||
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
|
||||||
import { checkHasAdminLogin } from '@/utils/auth'
|
|
||||||
import { t } from '@/locale'
|
|
||||||
import type { IBlogStats } from '@/api/types/halo'
|
|
||||||
|
|
||||||
definePage({
|
|
||||||
style: {
|
|
||||||
navigationBarTitleText: '关于',
|
|
||||||
enablePullDownRefresh: true,
|
|
||||||
navigationStyle: 'custom',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const appConfigStore = useAppConfigStore()
|
|
||||||
const favoritesStore = useFavoritesStore()
|
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
|
||||||
/** 数据看板插件可用性(供导航项显隐判断,参考 gallery 对象传参模式) */
|
|
||||||
const { check: checkDataVisualPlugin } = usePluginAvailable({
|
|
||||||
pluginId: NeedPluginIds.PluginDataStatistics,
|
|
||||||
})
|
|
||||||
/** 投票插件可用性(投票中心导航项显隐) */
|
|
||||||
const { check: checkVotePluginAvailable } = usePluginAvailable({
|
|
||||||
pluginId: NeedPluginIds.PluginVote,
|
|
||||||
})
|
|
||||||
/** 链接插件可用性(友情链接导航项显隐) */
|
|
||||||
const { check: checkLinksPluginAvailable } = usePluginAvailable({
|
|
||||||
pluginId: NeedPluginIds.PluginLinks,
|
|
||||||
})
|
|
||||||
|
|
||||||
/* ---------------- 计算属性 ---------------- */
|
|
||||||
const bloggerInfo = computed(() => {
|
|
||||||
const blogger = haloConfigs.value.authorConfig?.blogger as
|
|
||||||
| { nickname ?: string, avatar ?: string, description ?: string }
|
|
||||||
| undefined
|
|
||||||
return {
|
|
||||||
nickname: blogger?.nickname || '',
|
|
||||||
avatar: checkAvatarUrl(blogger?.avatar),
|
|
||||||
description: blogger?.description || '',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as
|
|
||||||
| { bgImageUrl ?: string, waveImageUrl ?: string, copyrightConfig ?: { enabled ?: boolean, content ?: string } }
|
|
||||||
| undefined)
|
|
||||||
|
|
||||||
const calcProfileStyle = computed(() => ({
|
|
||||||
backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl))
|
|
||||||
|
|
||||||
const copyrightConfig = computed(() => pageConfig.value?.copyrightConfig)
|
|
||||||
|
|
||||||
/* ---------------- 状态 ---------------- */
|
|
||||||
const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 })
|
|
||||||
|
|
||||||
/** 主行统计*/
|
|
||||||
const allStats = computed(() => [
|
|
||||||
{ key: 'post', label: '内容', value: statistics.value.post },
|
|
||||||
{ key: 'visit', label: '访客', value: statistics.value.visit },
|
|
||||||
{ key: 'category', label: '分类', value: statistics.value.category },
|
|
||||||
{ key: 'comment', label: '评论', value: statistics.value.comment },
|
|
||||||
{ key: 'upvote', label: '点赞', value: statistics.value.upvote },
|
|
||||||
])
|
|
||||||
|
|
||||||
interface INavItem {
|
|
||||||
key : string
|
|
||||||
title : string
|
|
||||||
iconPrefix ?: string
|
|
||||||
icon : string
|
|
||||||
bgColor : string
|
|
||||||
color ?: string
|
|
||||||
subTitle ?: string
|
|
||||||
path : string | null
|
|
||||||
openType ?: string
|
|
||||||
show : boolean
|
|
||||||
group : 'blog' | 'more'
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IMyPageEntry {
|
|
||||||
key ?: string
|
|
||||||
title ?: string
|
|
||||||
subTitle ?: string
|
|
||||||
color ?: string
|
|
||||||
bgColor ?: string
|
|
||||||
iconPrefix ?: string
|
|
||||||
icon ?: string
|
|
||||||
path ?: string
|
|
||||||
visible ?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
const configuredFeatures = computed(() => {
|
|
||||||
const mp = haloConfigs.value.pageConfig?.myPageConfig as
|
|
||||||
| { commonFeatures ?: IMyPageEntry[], otherFeatures ?: IMyPageEntry[] }
|
|
||||||
| undefined
|
|
||||||
if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
return mp
|
|
||||||
})
|
|
||||||
|
|
||||||
const navList = ref<INavItem[]>([])
|
|
||||||
|
|
||||||
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */
|
|
||||||
const calcNavGroups = computed(() => {
|
|
||||||
const visible = navList.value.filter(n => n.show)
|
|
||||||
const groupDefs : { key : 'blog' | 'more', title : string }[] = [
|
|
||||||
{ key: 'blog', title: '常用功能' },
|
|
||||||
{ key: 'more', title: '其他功能' },
|
|
||||||
]
|
|
||||||
return groupDefs
|
|
||||||
.map(def => ({ ...def, items: visible.filter(n => n.group === def.key) }))
|
|
||||||
.filter(group => group.items.length > 0)
|
|
||||||
})
|
|
||||||
|
|
||||||
/* ---------------- 功能导航 ---------------- */
|
|
||||||
|
|
||||||
async function handleGetNavList() {
|
|
||||||
// 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more),
|
|
||||||
// 未配置/为空时回退本地内置默认(保留原显隐推导)
|
|
||||||
const mp = configuredFeatures.value
|
|
||||||
if (mp) {
|
|
||||||
const mapEntry = (e : IMyPageEntry, group : 'blog' | 'more') : INavItem | null => {
|
|
||||||
if (!e.key) { return null }
|
|
||||||
return {
|
|
||||||
key: e.key,
|
|
||||||
title: e.title || '',
|
|
||||||
iconPrefix: e.iconPrefix,
|
|
||||||
icon: e.icon || '',
|
|
||||||
bgColor: e.bgColor || '#969696F2',
|
|
||||||
color: e.color,
|
|
||||||
subTitle: e.subTitle || '',
|
|
||||||
path: e.path || null,
|
|
||||||
show: e.visible !== false,
|
|
||||||
group,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
navList.value = [
|
|
||||||
...(mp.commonFeatures || []).map(e => mapEntry(e, 'blog')).filter((n) : n is INavItem => n !== null),
|
|
||||||
...(mp.otherFeatures || []).map(e => mapEntry(e, 'more')).filter((n) : n is INavItem => n !== null),
|
|
||||||
]
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const [dataVisualAvailable, voteAvailable, linksAvailable] = await Promise.all([
|
|
||||||
checkDataVisualPlugin(),
|
|
||||||
checkVotePluginAvailable(),
|
|
||||||
checkLinksPluginAvailable(),
|
|
||||||
])
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 数据加载 ---------------- */
|
|
||||||
async function handleGetData() {
|
|
||||||
try {
|
|
||||||
const res = await getBlogStatistics()
|
|
||||||
statistics.value = res.data
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.error('获取统计失败', err)
|
|
||||||
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 交互 ---------------- */
|
|
||||||
function handleOnNav(data : { path : string | null, isAdmin ?: boolean }) {
|
|
||||||
const { path, isAdmin } = data
|
|
||||||
if (!path)
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
uni.navigateTo({ url: path })
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------- 生命周期 ---------------- */
|
|
||||||
watch(haloConfigs, () => {
|
|
||||||
handleGetNavList()
|
|
||||||
}, { deep: true, immediate: true })
|
|
||||||
|
|
||||||
handleGetData()
|
|
||||||
|
|
||||||
onPullDownRefresh(() => {
|
|
||||||
handleGetData()
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<view class="box-border min-h-screen w-screen bg-page pb-8">
|
|
||||||
<!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) -->
|
|
||||||
<view class="blogger-info relative h-76 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]">
|
|
||||||
<!-- 背景遮罩 -->
|
|
||||||
<view class="absolute left-0 top-0 z-0 h-full w-full bg-black/30 backdrop-blur-[2rpx]" />
|
|
||||||
<view class="relative z-6 h-full flex flex-col items-center justify-center pb-[140rpx] pt-safe">
|
|
||||||
<image class="uh-global-card-glass h-20 w-20 rounded-full" :src="bloggerInfo.avatar"
|
|
||||||
mode="aspectFill" />
|
|
||||||
<view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
|
|
||||||
{{ bloggerInfo.nickname }}
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="desc mt-2 px-10 text-center text-[26rpx] text-white/90 leading-relaxed text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
|
|
||||||
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<image v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill"
|
|
||||||
class="gif-wave absolute bottom-0 left-0 z-99 h-[100rpx] w-full" style="mix-blend-mode: screen;" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 站点统计 -->
|
|
||||||
<view class="uh-global-card-glass uh-shadow-xs relative z-100 mx-4 flex border rounded-2xl -mt-12">
|
|
||||||
<view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center">
|
|
||||||
<wd-count-to :key="`${item.key}-${item.value}`" :start-val="0" :end-val="item.value" :duration="900"
|
|
||||||
separator="" color="#111827" custom-class="text-lg font-bold" />
|
|
||||||
<view class="mt-1 text-xs text-gray-500">
|
|
||||||
{{ item.label }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 功能导航-->
|
|
||||||
<template v-for="group in calcNavGroups" :key="group.key">
|
|
||||||
<uh-section-title class="mx-4 mb-3 mt-8">
|
|
||||||
{{ group.title }}
|
|
||||||
</uh-section-title>
|
|
||||||
<view class="uh-global-card-glass mx-4 overflow-hidden rounded-2xl">
|
|
||||||
<view v-for="(nav, index) in group.items" :key="nav.key"
|
|
||||||
class="nav-item flex items-center justify-between px-4"
|
|
||||||
:class="index < group.items.length - 1 ? 'border-b border-b-solid border-black/5' : ''"
|
|
||||||
@click="handleOnNav(nav)">
|
|
||||||
<view class="nav-left flex items-center gap-3 py-3">
|
|
||||||
<view
|
|
||||||
class="uh-global-card-glass border uh-shadow-xs h-8 w-8 flex items-center justify-center rounded-xl"
|
|
||||||
:style="{ backgroundColor: nav.bgColor }">
|
|
||||||
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="36rpx" />
|
|
||||||
</view>
|
|
||||||
<text class="nav-title text-sm text-gray-900 font-bold"
|
|
||||||
:style="{color:nav.color}">{{ nav.title }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="nav-right flex items-center gap-2">
|
|
||||||
<text class="nav-right-text text-xs text-gray-400">{{ nav.subTitle }}</text>
|
|
||||||
<wd-icon name="arrow-right" size="24rpx" class="text-gray-400" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<!-- 版权 -->
|
|
||||||
<view v-if="copyrightConfig?.enabled" class="mt-6 px-6 text-center text-xs text-gray-400">
|
|
||||||
<view>{{ copyrightConfig.content }}</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { checkThumbnailUrl } from '@/utils/url'
|
import { checkThumbnailUrl } from '@/utils/url'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { t } from '@/locale'
|
import { t } from '@/locale'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
import type { ICategory } from '@/api/types/halo'
|
import type { ICategory } from '@/api/types/halo'
|
||||||
@@ -18,7 +19,10 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
|
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
|
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
|
|
||||||
@@ -158,7 +162,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
|
||||||
<uh-navbar :use-back="false" default-title="分类" title-color="text-gray-900"></uh-navbar>
|
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="分类" title-color="text-gray-900"></uh-navbar>
|
||||||
|
|
||||||
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus" />
|
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus" />
|
||||||
|
|
||||||
@@ -171,7 +175,7 @@
|
|||||||
<view
|
<view
|
||||||
class="absolute bottom-0 left-0 h-[140rpx] w-full from-black/0 to-black/30 bg-gradient-to-b" />
|
class="absolute bottom-0 left-0 h-[140rpx] w-full from-black/0 to-black/30 bg-gradient-to-b" />
|
||||||
<view class="absolute bottom-0 left-0 box-border w-full flex flex-col gap-1 p-2.5">
|
<view class="absolute bottom-0 left-0 box-border w-full flex flex-col gap-1 p-2.5">
|
||||||
<text class="truncate text-sm text-white font-bold">
|
<text class="truncate text-2xs text-white font-bold">
|
||||||
{{ item.spec.displayName }}
|
{{ item.spec.displayName }}
|
||||||
</text>
|
</text>
|
||||||
<text class="text-xs text-white opacity-80">
|
<text class="text-xs text-white opacity-80">
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { checkImageUrl } from '@/utils/url'
|
import { checkImageUrl } from '@/utils/url'
|
||||||
import { usePluginAvailable } from '@/hooks/usePluginAvailable'
|
import { usePluginAvailable } from '@/hooks/usePluginAvailable'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { sleep } from '@/utils/common'
|
import { sleep } from '@/utils/common'
|
||||||
import { t } from '@/locale'
|
import { t } from '@/locale'
|
||||||
|
import { isWechat } from '@/utils/platform'
|
||||||
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
import { DataLoadingStatusEnum, useDataLoadingStatus } from '@/hooks/useDataLoadingStatus'
|
||||||
import type { IPhoto, IPhotoGroup } from '@/api/types/halo'
|
import type { IPhoto, IPhotoGroup } from '@/api/types/halo'
|
||||||
|
|
||||||
@@ -18,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
@@ -207,17 +210,17 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page pb-6">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
|
||||||
<uh-navbar :use-back="false" default-title="我的图库" title-color="text-gray-900"></uh-navbar>
|
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="我的图库" title-color="text-gray-900"></uh-navbar>
|
||||||
|
|
||||||
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
||||||
:checking="checking" @on-refresh="checkPluginAvailable" />
|
:checking="checking" @on-refresh="checkPluginAvailable" />
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<wd-sticky v-if="category.list.length!==0" class="w-full">
|
<wd-sticky v-if="category.list.length!==0" class="w-full" :offset-top="isWechat?56:0">
|
||||||
<scroll-view :scroll-x="true" class="w-full whitespace-nowrap pt-2">
|
<scroll-view :scroll-x="true" class="w-full whitespace-nowrap pt-2">
|
||||||
<view v-for="(cate, index) in category.list" :key="cate.spec.displayName"
|
<view v-for="(cate, index) in category.list" :key="cate.spec.displayName"
|
||||||
class="uh-global-card-glass uh-shadow-xs mb-1 ml-3 inline-flex border rounded-2xl px-4 py-1 text-sm"
|
class="uh-global-card-glass uh-shadow-xs mb-1 ml-3 inline-flex border rounded-2xl px-4 py-1.5 text-2xs"
|
||||||
:class="{ 'bg-primary text-gray-900 font-bold': index === category.activeIndex }"
|
:class="{ 'bg-primary text-gray-900 font-bold': index === category.activeIndex }"
|
||||||
@click="handleGetDataByCategory(index, cate)">
|
@click="handleGetDataByCategory(index, cate)">
|
||||||
{{ cate.spec.displayName }}
|
{{ cate.spec.displayName }}
|
||||||
@@ -231,7 +234,7 @@
|
|||||||
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
||||||
@refresh="handleGetCategory" />
|
@refresh="handleGetCategory" />
|
||||||
|
|
||||||
<view v-else class="box-border w-full p-3">
|
<view v-else class="box-border w-full p-3 pb-0">
|
||||||
<view class="grid grid-cols-2 gap-2.5">
|
<view class="grid grid-cols-2 gap-2.5">
|
||||||
<view v-for="(item, index) in dataList" :key="index"
|
<view v-for="(item, index) in dataList" :key="index"
|
||||||
class="relative uh-global-card-glass h-38 w-full overflow-hidden rounded-xl">
|
class="relative uh-global-card-glass h-38 w-full overflow-hidden rounded-xl">
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
definePage({
|
definePage({
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '首页',
|
|
||||||
enablePullDownRefresh: true,
|
enablePullDownRefresh: true,
|
||||||
navigationStyle: 'custom',
|
navigationStyle: 'custom',
|
||||||
},
|
},
|
||||||
@@ -241,29 +240,27 @@
|
|||||||
<uh-home-category />
|
<uh-home-category />
|
||||||
|
|
||||||
<!-- 最新文章 -->
|
<!-- 最新文章 -->
|
||||||
<uh-section-title class="mb-4 box-border px-3">
|
<view class="mb-4 box-border px-3">
|
||||||
|
<uh-section-title>
|
||||||
最新推荐
|
最新推荐
|
||||||
<template #right>
|
<template #right>
|
||||||
<view class="flex items-center gap-2">
|
<view class="flex items-center gap-2">
|
||||||
<!-- 推荐模式分段器:默认 / 置顶 / 最新 -->
|
|
||||||
<view class="uh-global-card-glass uh-shadow-xs flex items-center border rounded-lg p-0.5">
|
<view class="uh-global-card-glass uh-shadow-xs flex items-center border rounded-lg p-0.5">
|
||||||
<view v-for="tab in recommendTabs" :key="tab.value" class="rounded-md px-2 py-0.5 text-xs"
|
<view v-for="tab in recommendTabs" :key="tab.value" class="rounded-md px-2 py-0.5 text-10px"
|
||||||
:class="recommendMode === tab.value ? 'bg-secondary text-gray-900' : 'text-gray-500'"
|
:class="recommendMode === tab.value ? 'bg-secondary text-gray-900' : 'text-gray-500'"
|
||||||
@click="handleRecommendModeChange(tab.value as 'default' | 'pinned' | 'latest' | 'oldest')">
|
@click="handleRecommendModeChange(tab.value as 'default' | 'pinned' | 'latest' | 'oldest')">
|
||||||
{{ tab.label }}
|
{{ tab.label }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="false" class="rounded-md px-2 py-0.5 text-xs text-gray-500" @click="handleToArticles()">
|
|
||||||
更多
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
|
class="uh-global-card-glass uh-shadow-xs border flex items-center justify-center rounded-md p-1 text-gray-400"
|
||||||
@click="handleToArticles()">
|
@click="handleToArticles()">
|
||||||
<wd-icon name="arrow-right" size="28rpx" />
|
<wd-icon name="arrow-right" size="14px" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</uh-section-title>
|
</uh-section-title>
|
||||||
|
</view>
|
||||||
|
|
||||||
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
||||||
min-height="36vh" @refresh="handleQuery" />
|
min-height="36vh" @refresh="handleQuery" />
|
||||||
@@ -277,5 +274,6 @@
|
|||||||
<uh-data-loadmore :status="loadMoreStatus.status" :text="loadMoreStatus.text" />
|
<uh-data-loadmore :status="loadMoreStatus.status" :text="loadMoreStatus.text" />
|
||||||
</block>
|
</block>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<uh-notify-dialog />
|
<uh-notify-dialog />
|
||||||
</template>
|
</template>
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed, ref, watch } from 'vue'
|
||||||
|
import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
|
||||||
|
import { getBlogStatistics } from '@/api/halo'
|
||||||
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
|
import { useFavoritesStore } from '@/store/favorites'
|
||||||
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
|
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
|
||||||
|
import { checkHasAdminLogin } from '@/utils/auth'
|
||||||
|
import { t } from '@/locale'
|
||||||
|
import type { IBlogStats } from '@/api/types/halo'
|
||||||
|
|
||||||
|
definePage({
|
||||||
|
style: {
|
||||||
|
navigationBarTitleText: '关于',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const appConfigStore = useAppConfigStore()
|
||||||
|
const favoritesStore = useFavoritesStore()
|
||||||
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
|
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
|
||||||
|
/** 数据看板插件可用性(供导航项显隐判断,参考 gallery 对象传参模式) */
|
||||||
|
const { check: checkDataVisualPlugin } = usePluginAvailable({
|
||||||
|
pluginId: NeedPluginIds.PluginDataStatistics,
|
||||||
|
})
|
||||||
|
/** 投票插件可用性(投票中心导航项显隐) */
|
||||||
|
const { check: checkVotePluginAvailable } = usePluginAvailable({
|
||||||
|
pluginId: NeedPluginIds.PluginVote,
|
||||||
|
})
|
||||||
|
/** 链接插件可用性(友情链接导航项显隐) */
|
||||||
|
const { check: checkLinksPluginAvailable } = usePluginAvailable({
|
||||||
|
pluginId: NeedPluginIds.PluginLinks,
|
||||||
|
})
|
||||||
|
|
||||||
|
/* ---------------- 计算属性 ---------------- */
|
||||||
|
const bloggerInfo = computed(() => {
|
||||||
|
const blogger = haloConfigs.value.authorConfig?.blogger as
|
||||||
|
| { nickname?: string, avatar?: string, description?: string }
|
||||||
|
| undefined
|
||||||
|
return {
|
||||||
|
nickname: blogger?.nickname || '',
|
||||||
|
avatar: checkAvatarUrl(blogger?.avatar),
|
||||||
|
description: blogger?.description || '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageConfig = computed(() => haloConfigs.value.pageConfig?.aboutConfig as
|
||||||
|
| { bgImageUrl?: string, waveImageUrl?: string}
|
||||||
|
| undefined)
|
||||||
|
|
||||||
|
const calcProfileStyle = computed(() => ({
|
||||||
|
backgroundImage: `url(${checkImageUrl(pageConfig.value?.bgImageUrl)})`,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const calcWaveUrl = computed(() => checkImageUrl(pageConfig.value?.waveImageUrl))
|
||||||
|
|
||||||
|
/* ---------------- 状态 ---------------- */
|
||||||
|
const statistics = ref<IBlogStats>({ post: 0, comment: 0, category: 0, visit: 0, upvote: 0 })
|
||||||
|
|
||||||
|
/** 主行统计 */
|
||||||
|
const allStats = computed(() => [
|
||||||
|
{ key: 'post', label: '内容', value: statistics.value.post },
|
||||||
|
{ key: 'visit', label: '访客', value: statistics.value.visit },
|
||||||
|
{ key: 'category', label: '分类', value: statistics.value.category },
|
||||||
|
{ key: 'comment', label: '评论', value: statistics.value.comment },
|
||||||
|
{ key: 'upvote', label: '点赞', value: statistics.value.upvote },
|
||||||
|
])
|
||||||
|
|
||||||
|
interface INavItem {
|
||||||
|
key: string
|
||||||
|
title: string
|
||||||
|
iconPrefix?: string
|
||||||
|
icon: string
|
||||||
|
bgColor: string
|
||||||
|
color?: string
|
||||||
|
subTitle?: string
|
||||||
|
path: string | null
|
||||||
|
openType?: string
|
||||||
|
show: boolean
|
||||||
|
group: 'blog' | 'more'
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IMyPageEntry {
|
||||||
|
key?: string
|
||||||
|
title?: string
|
||||||
|
subTitle?: string
|
||||||
|
color?: string
|
||||||
|
bgColor?: string
|
||||||
|
iconPrefix?: string
|
||||||
|
icon?: string
|
||||||
|
path?: string
|
||||||
|
visible?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const configuredFeatures = computed(() => {
|
||||||
|
const mp = haloConfigs.value.pageConfig?.myPageConfig as
|
||||||
|
| { commonFeatures?: IMyPageEntry[], otherFeatures?: IMyPageEntry[] }
|
||||||
|
| undefined
|
||||||
|
if (!mp || (!mp.commonFeatures?.length && !mp.otherFeatures?.length)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return mp
|
||||||
|
})
|
||||||
|
|
||||||
|
const navList = ref<INavItem[]>([])
|
||||||
|
|
||||||
|
/** 分组渲染(过滤后空组整组隐藏;组标题对齐插件端:常用功能/其他功能) */
|
||||||
|
const calcNavGroups = computed(() => {
|
||||||
|
const visible = navList.value.filter(n => n.show)
|
||||||
|
const groupDefs: { key: 'blog' | 'more', title: string }[] = [
|
||||||
|
{ key: 'blog', title: '常用功能' },
|
||||||
|
{ key: 'more', title: '其他功能' },
|
||||||
|
]
|
||||||
|
return groupDefs
|
||||||
|
.map(def => ({ ...def, items: visible.filter(n => n.group === def.key) }))
|
||||||
|
.filter(group => group.items.length > 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
/* ---------------- 功能导航 ---------------- */
|
||||||
|
|
||||||
|
async function handleGetNavList() {
|
||||||
|
// 配置模式:插件端 myPageConfig 两组(常用功能→blog、其他功能→more),
|
||||||
|
// 未配置/为空时回退本地内置默认(保留原显隐推导)
|
||||||
|
const mp = configuredFeatures.value
|
||||||
|
if (mp) {
|
||||||
|
const mapEntry = (e: IMyPageEntry, group: 'blog' | 'more'): INavItem | null => {
|
||||||
|
if (!e.key) { return null }
|
||||||
|
return {
|
||||||
|
key: e.key,
|
||||||
|
title: e.title || '',
|
||||||
|
iconPrefix: e.iconPrefix,
|
||||||
|
icon: e.icon || '',
|
||||||
|
bgColor: e.bgColor || '#969696F2',
|
||||||
|
color: e.color,
|
||||||
|
subTitle: e.subTitle || '',
|
||||||
|
path: e.path || null,
|
||||||
|
show: e.visible !== false,
|
||||||
|
group,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
navList.value = [
|
||||||
|
...(mp.commonFeatures || []).map(e => mapEntry(e, 'blog')).filter((n): n is INavItem => n !== null),
|
||||||
|
...(mp.otherFeatures || []).map(e => mapEntry(e, 'more')).filter((n): n is INavItem => n !== null),
|
||||||
|
]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const [dataVisualAvailable, voteAvailable, linksAvailable] = await Promise.all([
|
||||||
|
checkDataVisualPlugin(),
|
||||||
|
checkVotePluginAvailable(),
|
||||||
|
checkLinksPluginAvailable(),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------- 数据加载 ---------------- */
|
||||||
|
async function handleGetData() {
|
||||||
|
try {
|
||||||
|
const res = await getBlogStatistics()
|
||||||
|
statistics.value = res.data
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error('获取统计失败', err)
|
||||||
|
uni.showToast({ icon: 'none', title: t('common.loadFailedRetry') })
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------- 交互 ---------------- */
|
||||||
|
function handleOnNav(data: { path: string | null, isAdmin?: boolean }) {
|
||||||
|
const { path, isAdmin } = data
|
||||||
|
if (!path)
|
||||||
|
return
|
||||||
|
|
||||||
|
uni.navigateTo({ url: path })
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------- 生命周期 ---------------- */
|
||||||
|
watch(haloConfigs, () => {
|
||||||
|
handleGetNavList()
|
||||||
|
}, { deep: true, immediate: true })
|
||||||
|
|
||||||
|
handleGetData()
|
||||||
|
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
handleGetData()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<view class="box-border min-h-screen w-screen bg-page pb-2">
|
||||||
|
<!-- 头部:博主信息(背景图 + 遮罩 + wave,内容区做状态栏适配) -->
|
||||||
|
<view class="relative h-88 w-full bg-cover bg-no-repeat" :style="[calcProfileStyle]">
|
||||||
|
<!-- 背景遮罩 -->
|
||||||
|
<view class="absolute left-0 top-0 z-0 h-full w-full bg-black/30" style="backdrop-filter:blur(2rpx)"/>
|
||||||
|
<view class="relative z-6 h-full flex flex-col items-center justify-center">
|
||||||
|
<image
|
||||||
|
class="uh-global-card-glass h-20 w-20 rounded-full" :src="bloggerInfo.avatar"
|
||||||
|
mode="aspectFill"
|
||||||
|
/>
|
||||||
|
<view class="mt-4 text-lg text-white font-bold text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]">
|
||||||
|
{{ bloggerInfo.nickname }}
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="desc mt-2 px-10 text-center text-2xs text-white/90 leading-relaxed text-shadow-[0_2rpx_8rpx_rgba(0,0,0,0.4)]"
|
||||||
|
>
|
||||||
|
{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image
|
||||||
|
v-if="calcWaveUrl" :src="calcWaveUrl" mode="scaleToFill"
|
||||||
|
class="gif-wave absolute bottom-0 left-0 z-99 h-[100rpx] w-full" style="mix-blend-mode: screen;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 站点统计 -->
|
||||||
|
<view class="uh-global-card-glass uh-shadow-xs relative z-100 mx-4 flex border rounded-2xl -mt-12">
|
||||||
|
<view v-for="item in allStats" :key="item.key" class="flex-1 py-4 text-center">
|
||||||
|
<wd-count-to
|
||||||
|
:key="`${item.key}-${item.value}`" :start-val="0" :end-val="item.value" :duration="900"
|
||||||
|
separator="" color="#111827" custom-class="text-lg font-bold"
|
||||||
|
/>
|
||||||
|
<view class="mt-1 text-xs text-gray-500">
|
||||||
|
{{ item.label }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 功能导航 -->
|
||||||
|
<template v-for="group in calcNavGroups" :key="group.key">
|
||||||
|
<view class="box-border px-4">
|
||||||
|
<uh-section-title class="mb-3 mt-8">
|
||||||
|
{{ group.title }}
|
||||||
|
</uh-section-title>
|
||||||
|
</view>
|
||||||
|
<view class="uh-global-card-glass mx-4 overflow-hidden rounded-2xl">
|
||||||
|
<view
|
||||||
|
v-for="(nav, index) in group.items" :key="nav.key"
|
||||||
|
class="nav-item flex items-center justify-between px-4"
|
||||||
|
:class="index < group.items.length - 1 ? 'border-b border-b-solid border-black/5' : ''"
|
||||||
|
@click="handleOnNav(nav)"
|
||||||
|
>
|
||||||
|
<view class="nav-left flex items-center gap-3 py-3">
|
||||||
|
<view
|
||||||
|
class="uh-global-card-glass uh-shadow-xs h-8 w-8 flex items-center justify-center border rounded-xl"
|
||||||
|
:style="{ backgroundColor: nav.bgColor }"
|
||||||
|
>
|
||||||
|
<wd-icon :class-prefix="nav.iconPrefix" :name="nav.icon" size="36rpx" />
|
||||||
|
</view>
|
||||||
|
<text
|
||||||
|
class="nav-title text-sm text-gray-900"
|
||||||
|
:style="{ color: nav.color }"
|
||||||
|
>
|
||||||
|
{{ nav.title }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="nav-right flex items-center gap-2">
|
||||||
|
<text class="nav-right-text text-xs text-gray-400">{{ nav.subTitle }}</text>
|
||||||
|
<wd-icon name="arrow-right" size="24rpx" class="text-gray-400" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<uh-page-copyright />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
import { getMomentList } from '@/api/halo'
|
import { getMomentList } from '@/api/halo'
|
||||||
import { useAppConfigStore } from '@/store/appConfig'
|
import { useAppConfigStore } from '@/store/appConfig'
|
||||||
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
import { NeedPluginIds } from '@/hooks/usePluginAvailable'
|
||||||
|
import { usePageScroll } from '@/hooks/usePageScroll'
|
||||||
import { useFavoritesStore } from '@/store/favorites'
|
import { useFavoritesStore } from '@/store/favorites'
|
||||||
import { checkAvatarUrl, checkThumbnailUrl } from '@/utils/url'
|
import { checkAvatarUrl, checkThumbnailUrl } from '@/utils/url'
|
||||||
import { buildMomentFavoriteItem } from '@/utils/favorite'
|
import { buildMomentFavoriteItem } from '@/utils/favorite'
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { scrollY } = usePageScroll()
|
||||||
const appConfigStore = useAppConfigStore()
|
const appConfigStore = useAppConfigStore()
|
||||||
const favoritesStore = useFavoritesStore()
|
const favoritesStore = useFavoritesStore()
|
||||||
const haloConfigs = computed(() => appConfigStore.configs)
|
const haloConfigs = computed(() => appConfigStore.configs)
|
||||||
@@ -333,7 +335,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
|
<view class="box-border min-h-screen w-screen flex flex-col bg-page">
|
||||||
<uh-navbar :use-back="false" default-title="我的日常" title-color="text-gray-900" />
|
<uh-navbar :scroll-y="scrollY" :use-back="false" default-title="我的日常" title-color="text-gray-900" />
|
||||||
|
|
||||||
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
<uh-plugin-unavailable v-if="!uniHaloPluginAvailable" :plugin-id="pluginId" :error-text="tips"
|
||||||
:checking="checking" @on-refresh="handlePluginRefresh" />
|
:checking="checking" @on-refresh="handlePluginRefresh" />
|
||||||
@@ -342,7 +344,7 @@
|
|||||||
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
<uh-data-loading v-if="loadingStatus !== DataLoadingStatusEnum.Success" :loading-status="loadingStatus"
|
||||||
min-height="75vh" @refresh="handleGetData" />
|
min-height="75vh" @refresh="handleGetData" />
|
||||||
|
|
||||||
<view v-else class="box-border flex flex-col gap-3 p-3 pt-0">
|
<view v-else class="box-border flex flex-col gap-3 px-3">
|
||||||
<!-- 瞬间卡片 -->
|
<!-- 瞬间卡片 -->
|
||||||
<view v-for="moment in dataList" :key="moment.metadata.name" class="flex gap-x-2">
|
<view v-for="moment in dataList" :key="moment.metadata.name" class="flex gap-x-2">
|
||||||
<view class="shrink-0 flex flex-col gap-y-2 w-13">
|
<view class="shrink-0 flex flex-col gap-y-2 w-13">
|
||||||
@@ -363,8 +365,8 @@
|
|||||||
<image class="avatar h-9 w-9 shrink-0 rounded-full"
|
<image class="avatar h-9 w-9 shrink-0 rounded-full"
|
||||||
:src="checkAvatarUrl(moment.owner?.avatar || bloggerInfo.avatar)"
|
:src="checkAvatarUrl(moment.owner?.avatar || bloggerInfo.avatar)"
|
||||||
mode="aspectFill" />
|
mode="aspectFill" />
|
||||||
<view class="ml-2 flex flex-col">
|
<view class="ml-2 flex flex-col gap-y-1">
|
||||||
<view class="text-sm text-gray-900 font-bold">
|
<view class="text-3xs text-gray-900 font-bold">
|
||||||
{{ moment.owner?.displayName || bloggerInfo.nickname }}
|
{{ moment.owner?.displayName || bloggerInfo.nickname }}
|
||||||
</view>
|
</view>
|
||||||
<view class="text-xs text-gray-400">
|
<view class="text-xs text-gray-400">
|
||||||
@@ -373,7 +375,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="shrink-0">
|
<view class="shrink-0">
|
||||||
<uh-button custom-class="!py-1 bg-secondary text-xs font-semibold"
|
<uh-button custom-class="!py-1.5 bg-secondary text-xs"
|
||||||
@click="handleToMomentDetail(moment)">
|
@click="handleToMomentDetail(moment)">
|
||||||
详情
|
详情
|
||||||
</uh-button>
|
</uh-button>
|
||||||
@@ -382,7 +384,7 @@
|
|||||||
|
|
||||||
<!-- 正文 -->
|
<!-- 正文 -->
|
||||||
<view class="box-border px-4 pt-3">
|
<view class="box-border px-4 pt-3">
|
||||||
<view class="relative box-border rounded-lg bg-page p-3 text-gray-900 text-sm">
|
<view class="relative box-border rounded-lg bg-page p-3 text-gray-900 text-3xs">
|
||||||
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
|
<mp-html lazy-load :domain="markdownConfig.domain ?? ''"
|
||||||
:loading-img="markdownConfig.loadingGif" scroll-table selectable
|
:loading-img="markdownConfig.loadingGif" scroll-table selectable
|
||||||
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
|
||||||
@@ -412,10 +414,11 @@
|
|||||||
|
|
||||||
<!-- (点赞/评论) -->
|
<!-- (点赞/评论) -->
|
||||||
<view
|
<view
|
||||||
class="mb-1 mt-2 box-border w-full flex items-center justify-between border-t border-black/5 px-4 py-3 text-xs text-gray-400">
|
class="mb-1 mt-2 box-border w-full flex items-center border-t border-black/5 px-4 py-3 text-xs text-gray-400"
|
||||||
|
:class="[moment.spec.allowComment?'justify-between':'gap-x-6']">
|
||||||
<view class="flex items-center gap-x-1" @click.stop="handleMomentLike(moment)">
|
<view class="flex items-center gap-x-1" @click.stop="handleMomentLike(moment)">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="32rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-kiss-" size="32rpx" />
|
||||||
<text class="text-sm"
|
<text class="text-3xs"
|
||||||
:class="hasUpvoted(moment.metadata.name) ? 'text-primary' : 'text-gray-600'">
|
:class="hasUpvoted(moment.metadata.name) ? 'text-primary' : 'text-gray-600'">
|
||||||
点赞 {{ moment.stats.upvote || 0 }}
|
点赞 {{ moment.stats.upvote || 0 }}
|
||||||
</text>
|
</text>
|
||||||
@@ -423,11 +426,11 @@
|
|||||||
<view v-if="moment.spec.allowComment" class="flex items-center gap-x-1"
|
<view v-if="moment.spec.allowComment" class="flex items-center gap-x-1"
|
||||||
@click.stop="handleMomentComment(moment)">
|
@click.stop="handleMomentComment(moment)">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="32rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-thinking" size="32rpx" />
|
||||||
<text class="text-sm text-gray-600">评论 {{ moment.stats.totalComment || 0 }}</text>
|
<text class="text-3xs text-gray-600">评论 {{ moment.stats.totalComment || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center gap-x-1" @click.stop="handleToggleMomentFavorite(moment)">
|
<view class="flex items-center gap-x-1" @click.stop="handleToggleMomentFavorite(moment)">
|
||||||
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="32rpx" />
|
<wd-icon class-prefix="uhemoji-icon" name="-smile-" size="32rpx" />
|
||||||
<text class="text-sm"
|
<text class="text-3xs"
|
||||||
:class="isMomentFavorite(moment) ? 'text-primary' : 'text-gray-600'">
|
:class="isMomentFavorite(moment) ? 'text-primary' : 'text-gray-600'">
|
||||||
{{ isMomentFavorite(moment) ? '已收藏' : '收藏' }}
|
{{ isMomentFavorite(moment) ? '已收藏' : '收藏' }}
|
||||||
</text>
|
</text>
|
||||||
|
|||||||
+5
-48
@@ -3,30 +3,14 @@
|
|||||||
*/
|
*/
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { getAppConfigs, getAuditData, getLoveConfig } from '@/api/uni-halo'
|
import { getAppConfigs, getAuditData } from '@/api/uni-halo'
|
||||||
import { DefaultAppConfigs } from '@/config/appConfig'
|
import { DefaultAppConfigs } from '@/config/appConfig'
|
||||||
import { deepMerge } from '@/utils/merge'
|
import { deepMerge } from '@/utils/merge'
|
||||||
import { setCache } from '@/utils/storage'
|
import { setCache } from '@/utils/storage'
|
||||||
import { clearLoveModuleToken } from '@/utils/loveModuleToken'
|
|
||||||
import type { IAppConfig, IAuditDataResult } from '@/api/types/uni-halo'
|
import type { IAppConfig, IAuditDataResult } from '@/api/types/uni-halo'
|
||||||
|
|
||||||
/** 合并后配置缓存 key(与 utils/url.ts / api/uni-halo.ts 的 APP_GLOBAL_CONFIGS 读取保持一致) */
|
/** 合并后配置缓存 key(与 utils/url.ts / api/uni-halo.ts 的 APP_GLOBAL_CONFIGS 读取保持一致) */
|
||||||
const APP_GLOBAL_CONFIGS_KEY = 'APP_GLOBAL_CONFIGS'
|
const APP_GLOBAL_CONFIGS_KEY = 'APP_GLOBAL_CONFIGS'
|
||||||
/**
|
|
||||||
* 恋爱配置内容(公开 GET /love-config 返回: enabled + 纪念日/恋人信息;
|
|
||||||
* 恋爱开关与页面图片仍在 configs.loveConfig, 由 love.vue 组合读取)
|
|
||||||
*/
|
|
||||||
export interface IStaticLoveConfig {
|
|
||||||
enabled?: boolean
|
|
||||||
loveDateTitle?: string
|
|
||||||
loveDate?: string
|
|
||||||
loveInfo?: {
|
|
||||||
boyNickname?: string
|
|
||||||
boyAvatar?: string
|
|
||||||
girlNickname?: string
|
|
||||||
girlAvatar?: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 静态配置后台刷新间隔(ms): onShow 距上次拉取在 TTL 内则不再重复请求
|
* 静态配置后台刷新间隔(ms): onShow 距上次拉取在 TTL 内则不再重复请求
|
||||||
*/
|
*/
|
||||||
@@ -42,8 +26,6 @@ export const useAppConfigStore = defineStore(
|
|||||||
const auditModeEnabled = computed(() => !!auditData.value.enabled)
|
const auditModeEnabled = computed(() => !!auditData.value.enabled)
|
||||||
/** 维护模式信息(configs 顶层 additive maintenance 键;undefined=未维护/已到点自动结束) */
|
/** 维护模式信息(configs 顶层 additive maintenance 键;undefined=未维护/已到点自动结束) */
|
||||||
const maintenance = computed(() => configs.value.maintenance)
|
const maintenance = computed(() => configs.value.maintenance)
|
||||||
/** 恋爱配置内容(公开 /love-config;bootstrap 统一拉取,随 store persist 持久化) */
|
|
||||||
const loveConfig = ref<IStaticLoveConfig>({ enabled: false })
|
|
||||||
/** 最近一次静态配置拉取时间戳(ms,0=从未拉取;TTL 判定依据) */
|
/** 最近一次静态配置拉取时间戳(ms,0=从未拉取;TTL 判定依据) */
|
||||||
const fetchedAt = ref(0)
|
const fetchedAt = ref(0)
|
||||||
|
|
||||||
@@ -51,7 +33,6 @@ export const useAppConfigStore = defineStore(
|
|||||||
const setDefaultAppSettings = () => {
|
const setDefaultAppSettings = () => {
|
||||||
configs.value = JSON.parse(JSON.stringify(DefaultAppConfigs))
|
configs.value = JSON.parse(JSON.stringify(DefaultAppConfigs))
|
||||||
auditData.value = { enabled: false }
|
auditData.value = { enabled: false }
|
||||||
loveConfig.value = { enabled: false }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取应用配置(与默认值深合并,并存储 token) */
|
/** 获取应用配置(与默认值深合并,并存储 token) */
|
||||||
@@ -88,42 +69,20 @@ export const useAppConfigStore = defineStore(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取恋爱配置内容(公开 /love-config;恋爱日记入口 loveDiary 设密码时
|
|
||||||
* 需携带模块解锁 token;401 locked 表示 token 缺失/失效,清除本地 token
|
|
||||||
* 交由 love.vue 重新弹密码框解锁) */
|
|
||||||
const fetchLoveConfig = async () => {
|
|
||||||
try {
|
|
||||||
const res = await getLoveConfig()
|
|
||||||
const body = res.data as unknown as IStaticLoveConfig | undefined
|
|
||||||
loveConfig.value = body && Object.keys(body).length > 0
|
|
||||||
? body
|
|
||||||
: { enabled: false }
|
|
||||||
return loveConfig.value
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.error('获取恋爱配置失败', err)
|
|
||||||
// 401 locked:恋爱日记锁定且本地 token 失效/缺失,清除后由 love.vue 引导解锁
|
|
||||||
const status = (err as { cause?: { response?: { status?: number } } })?.cause?.response?.status
|
|
||||||
if (status === 401) {
|
|
||||||
clearLoveModuleToken('loveDiary')
|
|
||||||
}
|
|
||||||
loveConfig.value = { enabled: false }
|
|
||||||
return loveConfig.value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一拉取静态配置:
|
* 统一拉取静态配置:
|
||||||
* getConfigs + audit-data + love-config 并行一次;TTL 内(默认 5 分钟,persist 恢复后
|
* getConfigs + audit-data 并行一次;TTL 内(默认 5 分钟,persist 恢复后
|
||||||
* 亦生效)直接返回缓存,避免每次冷启动/onShow 重复请求;force=true 强制刷新。
|
* 亦生效)直接返回缓存,避免每次冷启动/onShow 重复请求;force=true 强制刷新。
|
||||||
* 返回 ok = getConfigs 是否成功(失败时走内置默认/旧缓存,由调用方决定后续)。
|
* 返回 ok = getConfigs 是否成功(失败时走内置默认/旧缓存,由调用方决定后续)。
|
||||||
|
* 恋爱配置已并入 getConfigs 的 loveConfig 组(2026-09-12 起 /love-config 下线),
|
||||||
|
* 由 love.vue 直接读 configs.loveConfig。
|
||||||
*/
|
*/
|
||||||
const bootstrap = async (options?: { force?: boolean }): Promise<{ ok: boolean, fromCache: boolean }> => {
|
const bootstrap = async (options?: { force?: boolean }): Promise<{ ok: boolean, fromCache: boolean }> => {
|
||||||
const force = options?.force ?? false
|
const force = options?.force ?? false
|
||||||
if (!force && fetchedAt.value > 0 && Date.now() - fetchedAt.value < STATIC_TTL) {
|
if (!force && fetchedAt.value > 0 && Date.now() - fetchedAt.value < STATIC_TTL) {
|
||||||
return { ok: true, fromCache: true }
|
return { ok: true, fromCache: true }
|
||||||
}
|
}
|
||||||
const [cfg] = await Promise.all([fetchConfigs(), fetchAuditData(), fetchLoveConfig()])
|
const [cfg] = await Promise.all([fetchConfigs(), fetchAuditData()])
|
||||||
fetchedAt.value = Date.now()
|
fetchedAt.value = Date.now()
|
||||||
return { ok: !!cfg, fromCache: false }
|
return { ok: !!cfg, fromCache: false }
|
||||||
}
|
}
|
||||||
@@ -136,12 +95,10 @@ export const useAppConfigStore = defineStore(
|
|||||||
auditData,
|
auditData,
|
||||||
auditModeEnabled,
|
auditModeEnabled,
|
||||||
maintenance,
|
maintenance,
|
||||||
loveConfig,
|
|
||||||
fetchedAt,
|
fetchedAt,
|
||||||
fetchConfigs,
|
fetchConfigs,
|
||||||
setDefaultAppSettings,
|
setDefaultAppSettings,
|
||||||
fetchAuditData,
|
fetchAuditData,
|
||||||
fetchLoveConfig,
|
|
||||||
bootstrap,
|
bootstrap,
|
||||||
refreshStatic,
|
refreshStatic,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ page {
|
|||||||
box-shadow: inset 0 1rpx 0 rgb(255 255 255 / 75%), 0 8rpx 32rpx rgb(90 105 200 / 7%);
|
box-shadow: inset 0 1rpx 0 rgb(255 255 255 / 75%), 0 8rpx 32rpx rgb(90 105 200 / 7%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.uh-shadow-sm{
|
||||||
|
box-shadow: 0 0 24rpx rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.uh-global-love-page {
|
.uh-global-love-page {
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
135deg,
|
135deg,
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
import type { CustomTabBarItem } from './types'
|
|
||||||
import { mount } from '@vue/test-utils'
|
|
||||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
||||||
import TabbarItem from './TabbarItem.vue'
|
|
||||||
|
|
||||||
// mock tabbar store,避免 uni.getStorageSync 在模块加载时执行
|
|
||||||
vi.mock('./store', () => ({
|
|
||||||
tabbarStore: { curIdx: 0 },
|
|
||||||
}))
|
|
||||||
|
|
||||||
const baseItem: CustomTabBarItem = {
|
|
||||||
text: '首页',
|
|
||||||
pagePath: 'pages/index/index',
|
|
||||||
iconType: 'unocss',
|
|
||||||
icon: 'i-carbon-home',
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('tabbarItem', () => {
|
|
||||||
let wrapper: ReturnType<typeof mount>
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
wrapper?.unmount()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('渲染 text 文本', () => {
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item: baseItem, index: 0 },
|
|
||||||
})
|
|
||||||
expect(wrapper.text()).toContain('首页')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('isBulge=true 时不渲染文本', () => {
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item: baseItem, index: 0, isBulge: true },
|
|
||||||
})
|
|
||||||
expect(wrapper.text()).not.toContain('首页')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('iconType=unocss 时渲染图标 class', () => {
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item: baseItem, index: 0 },
|
|
||||||
})
|
|
||||||
expect(wrapper.html()).toContain('i-carbon-home')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('badge=dot 时渲染小红点(包含 rounded-full 样式)', () => {
|
|
||||||
const item: CustomTabBarItem = { ...baseItem, badge: 'dot' }
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item, index: 0 },
|
|
||||||
})
|
|
||||||
expect(wrapper.html()).toContain('rounded-full')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('badge 为数字时渲染数字角标', () => {
|
|
||||||
const item: CustomTabBarItem = { ...baseItem, badge: 5 }
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item, index: 0 },
|
|
||||||
})
|
|
||||||
expect(wrapper.text()).toContain('5')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('badge > 99 时显示 99+', () => {
|
|
||||||
const item: CustomTabBarItem = { ...baseItem, badge: 100 }
|
|
||||||
wrapper = mount(TabbarItem, {
|
|
||||||
props: { item, index: 0 },
|
|
||||||
})
|
|
||||||
expect(wrapper.text()).toContain('99+')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -6,7 +6,7 @@ import { tabbarStore } from './store'
|
|||||||
defineProps<{
|
defineProps<{
|
||||||
item: CustomTabBarItem
|
item: CustomTabBarItem
|
||||||
index: number
|
index: number
|
||||||
isBulge?: boolean
|
customClass?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
function getImageByIndex(index: number, item: CustomTabBarItem) {
|
function getImageByIndex(index: number, item: CustomTabBarItem) {
|
||||||
@@ -23,21 +23,21 @@ function isActive(index: number) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="box-border py-0.5 flex flex-col items-center justify-center rounded-full">
|
<view class="overflow-hidden box-border py-0.5 flex flex-col items-center justify-center rounded-full" :class="customClass">
|
||||||
<template v-if="item.iconType === 'uiLib'">
|
<template v-if="item.iconType === 'uiLib'">
|
||||||
<!-- TODO: 以下内容请根据选择的UI库自行替换 -->
|
<!-- TODO: 以下内容请根据选择的UI库自行替换 -->
|
||||||
<!-- 如:<wd-icon name="home" /> (https://wot-design-uni.cn/component/icon.html) -->
|
<!-- 如:<wd-icon name="home" /> (https://wot-design-uni.cn/component/icon.html) -->
|
||||||
<!-- 如:<uv-icon name="home" /> (https://www.uvui.cn/components/icon.html) -->
|
<!-- 如:<uv-icon name="home" /> (https://www.uvui.cn/components/icon.html) -->
|
||||||
<!-- 如:<sar-icon name="image" /> (https://sard.wzt.zone/sard-uniapp-docs/components/icon)(sar没有home图标^_^) -->
|
<!-- 如:<sar-icon name="image" /> (https://sard.wzt.zone/sard-uniapp-docs/components/icon)(sar没有home图标^_^) -->
|
||||||
<text class="text-primary"><wd-icon :name="item.icon" size="50rpx" /></text>
|
<view class="text-primary"><wd-icon :name="item.icon" size="56rpx" /></view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="item.iconType === 'unocss' || item.iconType === 'iconfont'">
|
<template v-if="item.iconType === 'unocss' || item.iconType === 'iconfont'">
|
||||||
<view class="flex-1" :class="[item.icon, isBulge ? 'text-80px' : 'text-20px']" />
|
<view class="flex-1 text-20px" :class="[item.icon]" />
|
||||||
</template>
|
</template>
|
||||||
<template v-if="item.iconType === 'image'">
|
<template v-if="item.iconType === 'image'">
|
||||||
<image :src="getImageByIndex(index, item)" mode="scaleToFill" class="shrink-0" :class="[isBulge?'h-26px w-26px':'h-20px w-20px']" />
|
<image :src="getImageByIndex(index, item)" mode="scaleToFill" class="shrink-0 h-6 w-6" />
|
||||||
</template>
|
</template>
|
||||||
<view v-if="!isBulge" class="mt-1px text-10px shrink-0">
|
<view class="mt-1px text-xs shrink-0">
|
||||||
{{ getI18nText(item.text) }}
|
{{ getI18nText(item.text) }}
|
||||||
</view>
|
</view>
|
||||||
<!-- 角标显示 -->
|
<!-- 角标显示 -->
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ export const nativeTabbarList: NativeTabBarItem[] = [
|
|||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/select_mine.png',
|
iconPath: 'static/tabbar/select_mine.png',
|
||||||
selectedIconPath: 'static/tabbar/select_mine_active.png',
|
selectedIconPath: 'static/tabbar/select_mine_active.png',
|
||||||
pagePath: 'pages/tabbar/about/about',
|
pagePath: 'pages/tabbar/mine/mine',
|
||||||
text: '%tabbar.about%'
|
text: '%tabbar.mine%'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@ export const customTabbarList: CustomTabBarItem[] = [
|
|||||||
icon: '/static/tabbar/select_mine.png',
|
icon: '/static/tabbar/select_mine.png',
|
||||||
iconActive: '/static/tabbar/select_mine_active.png',
|
iconActive: '/static/tabbar/select_mine_active.png',
|
||||||
iconType: 'image',
|
iconType: 'image',
|
||||||
pagePath: 'pages/tabbar/about/about',
|
pagePath: 'pages/tabbar/mine/mine',
|
||||||
text: '%tabbar.about%'
|
text: '%tabbar.mine%'
|
||||||
},
|
},
|
||||||
|
|
||||||
// 搜索按钮
|
// 搜索按钮
|
||||||
|
|||||||
@@ -100,15 +100,15 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view v-if="customTabbarEnable" class="h-56px pb-safe bg-page">
|
<view v-if="customTabbarEnable" class="h-56px pb-safe bg-page overflow-hidden">
|
||||||
<view class="box-border fixed bottom-3 z-100 w-full px-3">
|
<view class="box-border fixed bottom-0 z-100 w-full px-12">
|
||||||
<view class="flex box-border w-full items-center justify-between gap-x-2" @touchmove.stop.prevent>
|
<view class="flex box-border w-full items-center justify-between gap-x-2" @touchmove.stop.prevent>
|
||||||
<view
|
<view
|
||||||
class="flex-1 box-border uh-global-card-glass bg-white/75 border rounded-full p-1 h-50px flex items-center gap-x-1">
|
class="flex-1 box-border uh-global-card-glass bg-white/75 border rounded-full p-1 flex items-center gap-x-1">
|
||||||
<view v-for="(item, index) in noRightTabbarList" :key="index" class="text-gray-900 flex-1"
|
<view v-for="(item, index) in noRightTabbarList" :key="index" class="text-gray-900 flex-1"
|
||||||
:style="{ color: getColorByIndex(index) }" @click="handleClick(index)">
|
:style="{ color: getColorByIndex(index) }" @click="handleClick(index)">
|
||||||
<TabbarItem :item="item" :index="index" class="relative"
|
<TabbarItem :item="item" :index="index"
|
||||||
:class="[isActive(index)?'uh-global-card-glass bg-white/0 border':'']" />
|
:custom-class="isActive(index)?'relative uh-global-card-glass border':''" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="rightButton.item"
|
<view v-if="rightButton.item"
|
||||||
|
|||||||
+29
-45
@@ -1,28 +1,23 @@
|
|||||||
import type { Preset } from 'unocss'
|
import type { Preset } from 'unocss';
|
||||||
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders'
|
import { FileSystemIconLoader } from '@iconify/utils/lib/loader/node-loaders';
|
||||||
|
|
||||||
// https://www.npmjs.com/package/@uni-helper/unocss-preset-uni
|
// https://www.npmjs.com/package/@uni-helper/unocss-preset-uni
|
||||||
import { presetUni } from '@uni-helper/unocss-preset-uni'
|
import { presetUni } from '@uni-helper/unocss-preset-uni';
|
||||||
// @see https://unocss.dev/presets/legacy-compat
|
// @see https://unocss.dev/presets/legacy-compat
|
||||||
import { presetLegacyCompat } from '@unocss/preset-legacy-compat'
|
import { presetLegacyCompat } from '@unocss/preset-legacy-compat';
|
||||||
import {
|
import { defineConfig, presetIcons, transformerDirectives, transformerVariantGroup } from 'unocss';
|
||||||
defineConfig,
|
|
||||||
presetIcons,
|
|
||||||
transformerDirectives,
|
|
||||||
transformerVariantGroup,
|
|
||||||
} from 'unocss'
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
presets: [
|
presets: [
|
||||||
presetUni({
|
presetUni({
|
||||||
attributify: false,
|
attributify: false
|
||||||
}),
|
}),
|
||||||
presetIcons({
|
presetIcons({
|
||||||
scale: 1.2,
|
scale: 1.2,
|
||||||
warn: true,
|
warn: true,
|
||||||
extraProperties: {
|
extraProperties: {
|
||||||
'display': 'inline-block',
|
display: 'inline-block',
|
||||||
'vertical-align': 'middle',
|
'vertical-align': 'middle'
|
||||||
},
|
},
|
||||||
collections: {
|
collections: {
|
||||||
// 注册本地 SVG 图标集合, 从本地文件系统加载图标
|
// 注册本地 SVG 图标集合, 从本地文件系统加载图标
|
||||||
@@ -32,22 +27,18 @@ export default defineConfig({
|
|||||||
'./src/static/my-icons',
|
'./src/static/my-icons',
|
||||||
// 可选的,你可以提供一个 transform 回调来更改每个图标
|
// 可选的,你可以提供一个 transform 回调来更改每个图标
|
||||||
(svg) => {
|
(svg) => {
|
||||||
let svgStr = svg
|
let svgStr = svg;
|
||||||
|
|
||||||
// 如果 SVG 文件未定义 `fill` 属性,则默认填充 `currentColor`, 这样图标颜色会继承文本颜色,方便在不同场景下适配
|
// 如果 SVG 文件未定义 `fill` 属性,则默认填充 `currentColor`, 这样图标颜色会继承文本颜色,方便在不同场景下适配
|
||||||
svgStr = svgStr.includes('fill="')
|
svgStr = svgStr.includes('fill="') ? svgStr : svgStr.replace(/^<svg /, '<svg fill="currentColor" ');
|
||||||
? svgStr
|
|
||||||
: svgStr.replace(/^<svg /, '<svg fill="currentColor" ')
|
|
||||||
|
|
||||||
// 如果 svg 有 width, 和 height 属性,将这些属性改为 1em,否则无法显示图标
|
// 如果 svg 有 width, 和 height 属性,将这些属性改为 1em,否则无法显示图标
|
||||||
svgStr = svgStr
|
svgStr = svgStr.replace(/(<svg.*?width=)"(.*?)"/, '$1"1em"').replace(/(<svg.*?height=)"(.*?)"/, '$1"1em"');
|
||||||
.replace(/(<svg.*?width=)"(.*?)"/, '$1"1em"')
|
|
||||||
.replace(/(<svg.*?height=)"(.*?)"/, '$1"1em"')
|
|
||||||
|
|
||||||
return svgStr
|
return svgStr;
|
||||||
},
|
}
|
||||||
),
|
)
|
||||||
},
|
}
|
||||||
}),
|
}),
|
||||||
// TODO: check 是否会有别的影响
|
// TODO: check 是否会有别的影响
|
||||||
// 处理低端安卓机的样式问题
|
// 处理低端安卓机的样式问题
|
||||||
@@ -56,40 +47,33 @@ export default defineConfig({
|
|||||||
// `rgba(255 0 0 / 0.5)` -> `rgba(255, 0, 0, 0.5)`
|
// `rgba(255 0 0 / 0.5)` -> `rgba(255, 0, 0, 0.5)`
|
||||||
presetLegacyCompat({
|
presetLegacyCompat({
|
||||||
commaStyleColorFunction: true,
|
commaStyleColorFunction: true,
|
||||||
legacyColorSpace: true, // by QQ4群-量子蔷薇
|
legacyColorSpace: true // by QQ4群-量子蔷薇
|
||||||
// @菲鸽 unocss 配置中,建议在 presetLegacyCompat 中添加 legacyColorSpace: true,以去除生成的颜色样式中的 in oklch 关键字,现在发现有些渐变色生成不符合预期
|
// @菲鸽 unocss 配置中,建议在 presetLegacyCompat 中添加 legacyColorSpace: true,以去除生成的颜色样式中的 in oklch 关键字,现在发现有些渐变色生成不符合预期
|
||||||
}) as Preset,
|
}) as Preset
|
||||||
],
|
],
|
||||||
transformers: [
|
transformers: [
|
||||||
// 启用指令功能:主要用于支持 @apply、@screen 和 theme() 等 CSS 指令
|
// 启用指令功能:主要用于支持 @apply、@screen 和 theme() 等 CSS 指令
|
||||||
transformerDirectives(),
|
transformerDirectives(),
|
||||||
// 启用 () 分组功能
|
// 启用 () 分组功能
|
||||||
// 支持css class组合,eg: `<div class="hover:(bg-gray-400 font-medium) font-(light mono)">测试 unocss</div>`
|
// 支持css class组合,eg: `<div class="hover:(bg-gray-400 font-medium) font-(light mono)">测试 unocss</div>`
|
||||||
transformerVariantGroup(),
|
transformerVariantGroup()
|
||||||
],
|
],
|
||||||
shortcuts: [
|
shortcuts: [
|
||||||
{
|
{
|
||||||
center: 'flex justify-center items-center',
|
center: 'flex justify-center items-center'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
// 动态图标需要在这里配置,或者写在vue页面中注释掉
|
// 动态图标需要在这里配置,或者写在vue页面中注释掉
|
||||||
safelist: [
|
safelist: ['i-carbon-code', 'i-carbon-home', 'i-carbon-user', 'i-carbon-ibm-watson-language-translator', 'i-carbon-menu'],
|
||||||
'i-carbon-code',
|
|
||||||
'i-carbon-home',
|
|
||||||
'i-carbon-user',
|
|
||||||
'i-carbon-ibm-watson-language-translator',
|
|
||||||
'i-carbon-menu',
|
|
||||||
],
|
|
||||||
rules: [
|
rules: [
|
||||||
[
|
[
|
||||||
'p-safe',
|
'p-safe',
|
||||||
{
|
{
|
||||||
padding:
|
padding: 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)'
|
||||||
'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)',
|
}
|
||||||
},
|
|
||||||
],
|
],
|
||||||
['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }],
|
['pt-safe', { 'padding-top': 'env(safe-area-inset-top)' }],
|
||||||
['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }],
|
['pb-safe', { 'padding-bottom': 'env(safe-area-inset-bottom)' }]
|
||||||
],
|
],
|
||||||
theme: {
|
theme: {
|
||||||
colors: {
|
colors: {
|
||||||
@@ -101,10 +85,10 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
fontSize: {
|
fontSize: {
|
||||||
/** 提供更小号的字体,用法如:text-2xs */
|
/** 提供更小号的字体,用法如:text-2xs */
|
||||||
'2xs': ['20rpx', '28rpx'],
|
'2xs': ['28rpx'],
|
||||||
'3xs': ['18rpx', '26rpx'],
|
'3xs': ['26rpx']
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
// windows 系统会报错:[plugin:unocss:transformers:pre] Cannot overwrite a zero-length range - use append Left or prependRight instead.
|
// windows 系统会报错:[plugin:unocss:transformers:pre] Cannot overwrite a zero-length range - use append Left or prependRight instead.
|
||||||
// 去掉下面的就正常了
|
// 去掉下面的就正常了
|
||||||
// content: {
|
// content: {
|
||||||
@@ -127,4 +111,4 @@ export default defineConfig({
|
|||||||
// ],
|
// ],
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
})
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user