1
0
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:
小莫唐尼
2026-09-12 22:33:50 +08:00
parent 885646ec0c
commit e5e3ad3d8b
74 changed files with 2262 additions and 2238 deletions
@@ -38,11 +38,10 @@
const isGrid = computed(() => props.variant === 'grid')
/** 单一事实源:每种布局的完整形态,模板不再有任何 order / 条件分支 */
const CARD_LAYOUTS = computed(()=> ({
image_top: {
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' : ''}`,
footer: 'flex items-center',
authorGroup: 'flex-1 items-center justify-start gap-x-1',
@@ -159,17 +158,16 @@
</text>
<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 />
<!-- <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 class="flex flex-col gap-y-2 text-sm" :class="cardLayout.contentWrapper">
<view class="truncate font-bold">
<view class="flex flex-col gap-y-3 text-sm" :class="cardLayout.contentWrapper">
<view class="truncate font-bold text-3xs">
{{ article.spec.title }}
</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 }}
</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">
<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">
+12 -4
View File
@@ -1,4 +1,10 @@
<script setup lang="ts">
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
interface IProps {
customClass ?: string | Array<string>;
}
@@ -8,11 +14,13 @@
}
const props = defineProps<IProps>();
const emit = defineEmits<IEmits>();
const emits = defineEmits<IEmits>();
</script>
<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')">
<slot></slot>
<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="emits('click')">
<slot />
</view>
</template>
</template>
@@ -146,13 +146,8 @@
</view>
<block v-else>
<view v-if="disallowComment && dataList.length !== 0"
class="rounded-xl bg-gray-50 px-3 py-2 text-xs text-red-400">
Ծ‸Ծ 博主已设置该文章禁止评论!
</view>
<view v-if="dataList.length === 0" class="empty py-12">
<view class="empty-box flex flex-col items-center">
<view v-if="dataList.length === 0" class=" py-12">
<view class=" flex flex-col items-center">
<wd-icon class-prefix="uhemoji-icon" name="-confused" size="100rpx" class="text-primary" />
<text class="mt-2 text-sm text-gray-500">暂无评论</text>
<view v-if="disallowComment" class="mt-2 text-xs text-red-400">
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue'
import { checkUrl } from '@/utils/url'
import type { DataLoadingStatus } from '@/hooks/useDataLoading'
import type { DataLoadingStatus } from '@/hooks/useDataLoadingStatus'
interface IProps {
loadingStatus ?: DataLoadingStatus
@@ -9,7 +9,7 @@
</script>
<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 }}
</view>
</template>
@@ -1,118 +1,118 @@
<script setup lang="ts">
import { computed } from 'vue'
import { computed } from 'vue'
/** 单列选项(wd-picker PickerOption 的宽松形态,label/value 与 wot 一致) */
interface IPickerOption {
label?: string | number
value?: string | number
disabled?: boolean
children?: IPickerOption[]
[key: string]: unknown
}
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
interface IPickerOption {
label ?: string | number
value ?: string | number
disabled ?: boolean
children ?: IPickerOption[]
[key : string] : unknown
}
interface IProps {
/** v-model:visible 是否显示 */
visible: boolean
/** 弹层标题 */
title?: string
/** 选择器数据(单列/多列;与 wd-picker columns 一致) */
columns?: Array<IPickerOption | IPickerOption[]>
/** 选中项(单列如 ['value']) */
modelValue?: (string | number)[]
/** 确认/取消按钮文案 */
confirmButtonText?: string
cancelButtonText?: string
/** 自定义层级 */
zIndex?: number
/** 点击遮罩是否关闭 */
closeOnClickModal?: boolean
/** 底部安全距离适配 */
safeAreaInsetBottom?: boolean
/** 追加到选择器根元素的自定义类 */
customClass?: string
}
interface IProps {
visible : boolean
/** 弹层标题 */
title ?: string
/** 选择器数据(单列/多列;与 wd-picker columns 一致) */
columns ?: Array<IPickerOption | IPickerOption[]>
/** 选中项(单列如 ['value']) */
modelValue ?: (string | number)[]
/** 确认/取消按钮文案 */
confirmButtonText ?: string
cancelButtonText ?: string
/** 自定义层级 */
zIndex ?: number
/** 点击遮罩是否关闭 */
closeOnClickModal ?: boolean
/** 底部安全距离适配 */
safeAreaInsetBottom ?: boolean
/** 追加到选择器根元素的自定义类 */
customClass ?: string
}
interface IEmits {
(e: 'update:visible', value: boolean): void
(e: 'update:modelValue', value: (string | number)[]): void
(e: 'confirm', payload: { value: (string | number)[] }): void
(e: 'open'): void
(e: 'cancel'): void
}
interface IEmits {
(e : 'update:visible', value : boolean) : void
(e : 'update:modelValue', value : (string | number)[]) : void
(e : 'confirm', payload : { value : (string | number)[] }) : void
(e : 'open') : void
(e : 'cancel') : void
}
const props = withDefaults(defineProps<IProps>(), {
title: '',
columns: () => [],
modelValue: () => [],
confirmButtonText: '确定',
cancelButtonText: '取消',
zIndex: 15,
closeOnClickModal: true,
safeAreaInsetBottom: true,
customClass: '',
})
const props = withDefaults(defineProps<IProps>(), {
title: '',
columns: () => [],
modelValue: () => [],
confirmButtonText: '确定',
cancelButtonText: '取消',
zIndex: 15,
closeOnClickModal: true,
safeAreaInsetBottom: true,
customClass: '',
})
const emit = defineEmits<IEmits>()
const emit = defineEmits<IEmits>()
const pickerClass = computed(() => `uh-picker ${props.customClass}`.trim())
const pickerClass = computed(() => `uh-picker ${props.customClass}`.trim())
/* ---------------- wd-picker 事件转发(在 script 处理,模板只做绑定) ---------------- */
function handleUpdateVisible(value: boolean) {
emit('update:visible', value)
}
/* ---------------- wd-picker 事件转发(在 script 处理,模板只做绑定) ---------------- */
function handleUpdateVisible(value : boolean) {
emit('update:visible', value)
}
function handleUpdateModelValue(value: (string | number)[]) {
emit('update:modelValue', value)
}
function handleUpdateModelValue(value : (string | number)[]) {
emit('update:modelValue', value)
}
function handleConfirm(payload: { value: (string | number)[] }) {
emit('confirm', payload)
}
function handleConfirm(payload : { value : (string | number)[] }) {
emit('confirm', payload)
}
function handleOpen() {
emit('open')
}
function handleOpen() {
emit('open')
}
function handleCancel() {
emit('cancel')
}
function handleCancel() {
emit('cancel')
}
</script>
<template>
<wd-picker
:visible="visible" :title="title" :columns="columns" :model-value="modelValue"
:confirm-button-text="confirmButtonText" :cancel-button-text="cancelButtonText" :z-index="zIndex"
:close-on-click-modal="closeOnClickModal" :safe-area-inset-bottom="safeAreaInsetBottom"
:custom-class="pickerClass" @update:visible="handleUpdateVisible" @update:model-value="handleUpdateModelValue"
@confirm="handleConfirm" @open="handleOpen" @cancel="handleCancel"
>
<slot />
</wd-picker>
<wd-picker :visible="visible" :title="title" :columns="columns" :model-value="modelValue"
:confirm-button-text="confirmButtonText" :cancel-button-text="cancelButtonText" :z-index="zIndex"
:close-on-click-modal="closeOnClickModal" :safe-area-inset-bottom="safeAreaInsetBottom"
:custom-class="pickerClass" @update:visible="handleUpdateVisible" @update:model-value="handleUpdateModelValue"
@confirm="handleConfirm" @open="handleOpen" @cancel="handleCancel">
<slot />
</wd-picker>
</template>
<style scoped lang="scss">
/* 弹层面板玻璃质感(与 uh-glass-popup 同款;wd-picker 内层 popup 挂 .wd-picker__popup) */
:deep(.wd-picker__popup .wd-popup) {
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%);
}
:deep(.wd-picker__popup .wd-popup) {
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-picker__popup .wd-popup) {
background-color: rgb(255 255 255 / 88%);
}
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
:deep(.wd-picker__popup .wd-popup) {
background-color: rgb(255 255 255 / 88%);
}
}
:deep(.wd-popup--bottom) {
left: 24rpx;
bottom: 24rpx;
right: 24rpx;
}
</style>
:deep(.wd-popup--bottom) {
left: 24rpx;
bottom: 24rpx;
right: 24rpx;
}
</style>
+374 -64
View File
@@ -1,9 +1,30 @@
<script lang="ts" setup>
/**
* 玻璃质感弹窗:对 wd-popup 的二层封装。
* wd-popup 无背景/边框配置能力(index.scss 仅暴露 --wot-popup-bg 纯色变量),
* 故通过 custom-class 落到面板根元素后,用 :deep 覆盖为 uh-global-card-glass 同款效果。
*/
defineOptions({
options: {
styleIsolation: 'apply-shared',
},
})
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 {
/** v-model:是否显示 */
modelValue : boolean
@@ -19,15 +40,18 @@
closeOnClickModal ?: boolean
/** 底部安全距离适配(iphone X 类机型) */
safeAreaInsetBottom ?: boolean
/** 面板圆角(内联生效,优先级最高);传 wot 自带 round 时圆角由位置自动适配 */
/** 面板圆角(内联生效,优先级最高);与 round 二选一 */
radius ?: string
/** 是否开启 wot 位置自适应圆角(bottom→上圆角 / center→四圆角等),与 radius 二选一 */
/** 位置自适应圆角(bottom→上圆角 / center→四圆角等),与 radius 二选一 */
round ?: boolean
/** 弹层内容懒渲染,首次显示时才渲染 */
lazyRender ?: boolean
hideWhenClose?: boolean
/** 关闭动画结束后是否隐藏面板(display:none);false 时保留渲染(内部状态不丢) */
hideWhenClose ?: boolean
/** 追加到面板的内联样式,如宽度:width:640rpx; */
customStyle ?: string
customClass? :string
/** 追加到面板的类名(如 UnoCSS 原子类) */
customClass ?: string
}
interface IEmits {
@@ -37,76 +61,362 @@
(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:''
/* ---------------- 动画状态机 ---------------- */
/** 首次显示后才渲染(lazyRender) */
const inited = ref(false)
/** 是否渲染显示(关闭动画结束后 hideWhenClose 时置 false) */
const display = ref(false)
/** 动画阶段: enter / enter-to / leave / leave-to / '' */
const phase = ref('')
/** 动画名称(按位置):center 组合 zoom-in + fade */
const transitionName = computed(() => {
switch (props.position) {
case 'center':
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(() => {
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(() =>{
return `uh-glass-popup-panel ${props.customClass}`
const maskStyle = computed(() => {
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>
<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></slot>
</wd-popup>
<view v-if="isShow">
<!-- 遮罩层 -->
<view v-if="modal" class="uh-glass-popup__mask" :class="maskClasses" :style="maskStyle"
@click="handleClickModal" @touchmove.stop.prevent />
<!-- 面板层 -->
<view :class="panelClasses" :style="panelStyle">
<slot />
<view v-if="closable" class="uh-glass-popup__close" @click="close">
<text class="uh-glass-popup__close-icon">×</text>
</view>
</view>
</view>
</template>
<style scoped lang="scss">
/* 面板根元素(.wd-popup)同挂 custom-class,双类选择器提高优先级,覆盖 wot 默认纯白底 */
: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%);
.uh-glass-popup__mask {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
background-color: rgb(0 0 0 / 55%);
transition-timing-function: ease;
transition-duration: 300ms;
}
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
:deep(.wd-popup.uh-glass-popup-panel) {
.uh-glass-popup-panel {
box-sizing: border-box;
position: fixed;
max-height: 100%;
overflow-y: auto;
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%);
transition-timing-function: ease;
transition-duration: 300ms;
/* 低端 WebView 不支持 backdrop-filter 的兜底:提高不透明度保证可读性 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
background-color: rgb(255 255 255 / 88%);
}
}
:deep(.wd-popup--bottom){
left:24rpx;
bottom:24rpx;
right:24rpx;
/* 位置 */
.uh-glass-popup-panel--center {
left: 50%;
top: 50%;
transform: translate3d(-50%, -50%, 0);
transform-origin: 0 0;
}
</style>
.uh-glass-popup-panel--top {
top: 0;
left: 0;
right: 0;
}
.uh-glass-popup-panel--bottom {
left: 24rpx;
bottom: 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>
@@ -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">
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
</script>
<template>
@@ -120,7 +120,7 @@
</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 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
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()">
@@ -129,4 +129,11 @@
</view>
</view>
</view>
</template>
</template>
<style scoped lang="scss">
/* 向上偏移定位 */
.uh-translate-y-n6 {
transform: translateY(-1.5rem);
}
</style>
@@ -75,8 +75,8 @@
</script>
<template>
<view v-if="isEnableCategoryModule" class="mb-6">
<uh-section-title class="mb-4 px-3 box-border">
<view v-if="isEnableCategoryModule" class="overflow-hidden box-border mb-6 px-3">
<uh-section-title>
精选分类
<template #right>
<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>
</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">
<uh-data-loading :loading-status="loading" min-height="28vh" size="small" :use-refresh-button="true"
@refresh="handleGetCategoryList()" />
</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"
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)">
<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">
<text class="text-sm font-bold">
<text class="text-2xs font-semibold">
{{ category.spec.displayName }}
</text>
<text class="mt-1 text-xs text-gray-200">共 {{ category.postCount ?? 0 }} 篇</text>
@@ -8,106 +8,26 @@
const calcAuditModeEnabled = computed(() => appConfigStore.auditModeEnabled)
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 configured = haloConfigs.value.pageConfig?.homeConfig?.quickNavigation
let list : QuickNavItem[]
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)
return configured.filter(item => item.visible !== false)
})
function handleClickNav(item : { path ?: string }) {
if (!item.path)
return
if (!item.path) { return }
uni.navigateTo({ url: item.path })
}
</script>
<template>
<view v-if="calcIsShowQuickNavigationEnabled && navList.length"
class="box-border overflow-hidden rounded-xl p-3 px-4 mb-3">
<uh-section-title class="mb-4">
快捷导航
</uh-section-title>
<view class="grid grid-cols-5 gap-4">
class="box-border overflow-hidden rounded-xl p-3 mb-3">
<uh-section-title> 快捷导航 </uh-section-title>
<view class="mt-4 grid grid-cols-5 gap-4">
<view v-for="item in navList" :key="item.key" class="flex flex-col items-center gap-2"
@click="handleClickNav(item)">
<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="{
backgroundColor: item.bgColor
}">
@@ -121,4 +41,4 @@
</view>
</view>
</view>
</template>
</template>
@@ -1,41 +1,45 @@
<script lang="ts" setup>
/**
* 友链底部悬浮操作栏(通用组件)
* 通过 :actions 控制显示的按钮,事件回调 emit('apply') / emit('info')
* 站点 tab / 小程序 tab 分别引入(如 :actions="['apply','info']" @apply=... @info=...)
*/
withDefaults(defineProps<{
/** 需要显示的按钮:apply=提交申请,info=友链信息;包含即显示 */
actions?: string[]
}>(), {
actions: () => ['apply', 'info'],
})
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const props = withDefaults(defineProps<{
/** 需要显示的按钮:apply=提交申请,info=友链信息;包含即显示 */
actions ?: string[]
}>(), {
actions: () => ['apply', 'info'],
})
const emit = defineEmits<{
(e: 'apply'): void
(e: 'info'): void
}>()
const emit = defineEmits<{
(e : 'apply') : void
(e : 'info') : void
}>()
</script>
<template>
<view class="fixed bottom-8 left-1/2 z-10 flex items-center justify-center pb-safe -translate-x-1/2">
<view 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"
@click="emit('apply')"
>
<wd-icon name="edit" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">提交申请</text>
</view>
<view
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"
@click="emit('info')"
>
<wd-icon name="info" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">友链信息</text>
</view>
</view>
</view>
<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 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"
@click="emit('apply')">
<wd-icon name="edit" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">提交申请</text>
</view>
<view 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"
@click="emit('info')">
<wd-icon name="info" size="36rpx" />
<text class="shrink-0 text-sm text-gray-900 font-semibold">友链信息</text>
</view>
</view>
</view>
</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 type { ICaptchaQuery, IPluginCaptcha } from '@/api/uni-halo'
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const props = withDefaults(defineProps<{
show ?: boolean
}>(), {
@@ -1,213 +1,195 @@
<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 { useAppConfigStore } from '@/store/appConfig'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
import { computed, ref, watch } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { checkAvatarUrl, checkImageUrl } from '@/utils/url'
const props = withDefaults(defineProps<{
show?: boolean
}>(), {
show: false,
})
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const emit = defineEmits<{
(e: 'on-close'): void
}>()
const props = withDefaults(defineProps<{
show ?: boolean
}>(), {
show: false,
})
const isShow = ref(false)
const appConfigStore = useAppConfigStore()
const emit = defineEmits<{
(e : 'on-close') : void
}>()
/** 小程序申请信息(字段与 uh-links-mini-apply 表单一致;小程序信息读 linkInfo.miniInfo;
* 作者信息读应用设置-博主资料 authorConfig.blogger,字段名无映射) */
const miniInfo = computed(() => {
const miniCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.miniInfo || {}) as Record<string, unknown>
const blogger = (appConfigStore.configs.authorConfig?.blogger || {}) as Record<string, unknown>
const str = (cfg: Record<string, unknown>, key: string, fallback = '') => String(cfg[key] || fallback || '')
return {
displayName: str(miniCfg, 'displayName'),
miniProgramCode: str(miniCfg, 'miniProgramCode'),
link: str(miniCfg, 'link'),
// 作者信息:博主资料 nickname/avatar/website
authorName: str(blogger, 'nickname'),
avatar: str(blogger, 'avatar'),
website: str(blogger, 'website'),
description: str(miniCfg, 'description'),
applyRemark: str(miniCfg, 'applyRemark'),
email: str(miniCfg, 'email'),
}
})
const isShow = ref(false)
const appConfigStore = useAppConfigStore()
const hasInfo = computed(() => !!(miniInfo.value.displayName || miniInfo.value.miniProgramCode))
/** 小程序申请信息(字段与 uh-links-mini-apply 表单一致;小程序信息读 linkInfo.miniInfo;
* 作者信息读应用设置-博主资料 authorConfig.blogger,字段名无映射) */
const miniInfo = computed(() => {
const miniCfg = (appConfigStore.configs.pluginConfig?.linkInfo?.miniInfo || {}) as Record<string, unknown>
const blogger = (appConfigStore.configs.authorConfig?.blogger || {}) as Record<string, unknown>
const str = (cfg : Record<string, unknown>, key : string, fallback = '') => String(cfg[key] || fallback || '')
return {
displayName: str(miniCfg, 'displayName'),
miniProgramCode: str(miniCfg, 'miniProgramCode'),
link: str(miniCfg, 'link'),
// 作者信息:博主资料 nickname/avatar/website
authorName: str(blogger, 'nickname'),
avatar: str(blogger, 'avatar'),
website: str(blogger, 'website'),
description: str(miniCfg, 'description'),
applyRemark: str(miniCfg, 'applyRemark'),
email: str(miniCfg, 'email'),
}
})
/** 复制跳转地址 */
function handleCopyLink() {
if (!miniInfo.value.link) {
uni.showToast({ icon: 'none', title: '暂未填写跳转地址' })
return
}
uni.setClipboardData({
data: miniInfo.value.link,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '地址复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
const hasInfo = computed(() => !!(miniInfo.value.displayName || miniInfo.value.miniProgramCode))
/** 复制小程序申请信息(拼接文案) */
function handleCopyInfo() {
const info = miniInfo.value
const text = [
info.displayName ? `小程序名称:${info.displayName}` : '',
info.link ? `小程序地址:${info.link}` : '',
info.authorName ? `作者昵称:${info.authorName}` : '',
info.website ? `作者网站:${info.website}` : '',
info.description ? `小程序描述:${info.description}` : '',
info.applyRemark ? `申请说明:${info.applyRemark}` : '',
info.email ? `通知邮箱:${info.email}` : '',
].filter(Boolean).join('\n')
uni.setClipboardData({
data: text,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
/** 复制跳转地址 */
function handleCopyLink() {
if (!miniInfo.value.link) {
uni.showToast({ icon: 'none', title: '暂未填写跳转地址' })
return
}
uni.setClipboardData({
data: miniInfo.value.link,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '地址复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
/** 预览太阳码 */
function handlePreviewCode() {
if (!miniInfo.value.miniProgramCode)
return
uni.previewImage({
urls: [checkImageUrl(miniInfo.value.miniProgramCode)],
current: checkImageUrl(miniInfo.value.miniProgramCode),
})
}
/** 复制小程序申请信息(拼接文案) */
function handleCopyInfo() {
const info = miniInfo.value
const text = [
info.displayName ? `小程序名称:${info.displayName}` : '',
info.link ? `小程序地址:${info.link}` : '',
info.authorName ? `作者昵称:${info.authorName}` : '',
info.website ? `作者网站:${info.website}` : '',
info.description ? `小程序描述:${info.description}` : '',
info.applyRemark ? `申请说明:${info.applyRemark}` : '',
info.email ? `通知邮箱:${info.email}` : '',
].filter(Boolean).join('\n')
uni.setClipboardData({
data: text,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
function handleClose() {
isShow.value = false
emit('on-close')
}
/** 预览太阳码 */
function handlePreviewCode() {
if (!miniInfo.value.miniProgramCode)
return
uni.previewImage({
urls: [checkImageUrl(miniInfo.value.miniProgramCode)],
current: checkImageUrl(miniInfo.value.miniProgramCode),
})
}
watch(() => props.show, (val) => {
isShow.value = val
})
function handleClose() {
isShow.value = false
emit('on-close')
}
watch(() => props.show, (val) => {
isShow.value = val
})
</script>
<template>
<uh-glass-popup
v-model="isShow" :z-index="100" position="bottom"
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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">小程序友链信息</text>
<text class="text-xs text-gray-500">本站小程序申请提交的信息,欢迎互换</text>
</view>
<view
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose"
>
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" 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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">小程序友链信息</text>
<text class="text-xs text-gray-500">本站小程序申请提交的信息,欢迎互换</text>
</view>
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose">
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
<!-- 未配置信息占位 -->
<view v-if="!hasInfo" class="py-10 text-center text-xs text-gray-400">
暂未配置小程序申请信息
</view>
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
<!-- 未配置信息占位 -->
<view v-if="!hasInfo" class="py-10 text-center text-xs text-gray-400">
暂未配置小程序申请信息
</view>
<template v-else>
<!-- 太阳码大图(点击预览) -->
<view v-if="miniInfo.miniProgramCode" class="code-area flex flex-col items-center">
<image
class="code-img h-32 w-32 rounded-xl"
:src="checkImageUrl(miniInfo.miniProgramCode)" mode="aspectFill"
@click="handlePreviewCode"
/>
<view class="code-tip mt-3 flex items-center text-xs text-gray-400">
<wd-icon name="picture" size="14px" color="#a8a294" />
<text class="ml-1">点击预览太阳码</text>
</view>
</view>
<template v-else>
<!-- 太阳码大图(点击预览) -->
<view v-if="miniInfo.miniProgramCode" class="code-area flex flex-col items-center">
<image class="code-img h-32 w-32 rounded-xl" :src="checkImageUrl(miniInfo.miniProgramCode)"
mode="aspectFill" @click="handlePreviewCode" />
<view class="code-tip mt-3 flex items-center text-xs text-gray-400">
<wd-icon name="picture" size="14px" color="#a8a294" />
<text class="ml-1">点击预览太阳码</text>
</view>
</view>
<!-- 名称 -->
<view v-if="miniInfo.displayName" class="mini-head mt-5 flex items-center">
<text class="mini-name text-[34rpx] text-gray-900 font-bold">{{ miniInfo.displayName }}</text>
</view>
<!-- 名称 -->
<view v-if="miniInfo.displayName" class="mini-head mt-5 flex items-center">
<text class="mini-name text-[34rpx] text-gray-900 font-bold">{{ miniInfo.displayName }}</text>
</view>
<!-- 描述 -->
<view v-if="miniInfo.description" class="mini-desc mt-4 text-[28rpx] text-gray-600 leading-[1.6]">
{{ miniInfo.description }}
</view>
<!-- 描述 -->
<view v-if="miniInfo.description" class="mini-desc mt-4 text-[28rpx] text-gray-600 leading-[1.6]">
{{ miniInfo.description }}
</view>
<!-- 作者信息 -->
<view
v-if="miniInfo.authorName || miniInfo.avatar || miniInfo.website"
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"
/>
<view class="author-detail ml-4 flex flex-1 flex-col">
<text
v-if="miniInfo.authorName"
class="author-name text-[28rpx] text-gray-900 font-medium"
>
{{ miniInfo.authorName }}
</text>
<text
v-if="miniInfo.website"
class="author-website mt-1 overflow-hidden truncate whitespace-nowrap text-xs text-gray-400"
>
网站:{{ miniInfo.website }}
</text>
</view>
</view>
<!-- 作者信息 -->
<view v-if="miniInfo.authorName || miniInfo.avatar || miniInfo.website"
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" />
<view class="author-detail ml-4 flex flex-1 flex-col">
<text v-if="miniInfo.authorName" class="author-name text-[28rpx] text-gray-900 font-medium">
{{ miniInfo.authorName }}
</text>
<text v-if="miniInfo.website"
class="author-website mt-1 overflow-hidden truncate whitespace-nowrap text-xs text-gray-400">
网站:{{ miniInfo.website }}
</text>
</view>
</view>
<!-- 跳转地址 -->
<view v-if="miniInfo.link" 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 }}
</view>
<text class="ml-3 shrink-0 text-[26rpx] text-[#4d7c0f] font-bold" @click="handleCopyLink">复制</text>
</view>
<!-- 跳转地址 -->
<view v-if="miniInfo.link"
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 }}
</view>
<text class="ml-3 shrink-0 text-[26rpx] text-[#4d7c0f] font-bold" @click="handleCopyLink">复制</text>
</view>
<!-- 申请说明 / 邮箱 -->
<view
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"
>
<view v-if="miniInfo.applyRemark">
<text class="text-gray-400">申请说明:</text>{{ miniInfo.applyRemark }}
</view>
<view v-if="miniInfo.email">
<text class="text-gray-400">通知邮箱:</text>{{ miniInfo.email }}
</view>
</view>
<!-- 申请说明 / 邮箱 -->
<view 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">
<view v-if="miniInfo.applyRemark">
<text class="text-gray-400">申请说明:</text>{{ miniInfo.applyRemark }}
</view>
<view v-if="miniInfo.email">
<text class="text-gray-400">通知邮箱:</text>{{ miniInfo.email }}
</view>
</view>
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyInfo">
复制小程序申请信息
</uh-button>
</view>
</template>
</scroll-view>
</uh-glass-popup>
</template>
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyInfo">
复制小程序申请信息
</uh-button>
</view>
</template>
</scroll-view>
</uh-glass-popup>
</template>
@@ -1,202 +1,186 @@
<script lang="ts" setup>
/**
* 友链申请表单弹窗(站点版)
* 提交后等待站长审核,通过后展示在「站点」列表中
*/
import { ref, watch } from 'vue'
import { ref, watch } from 'vue'
const props = withDefaults(defineProps<{
show?: boolean
}>(), {
show: false,
})
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const emit = defineEmits<{
(e: 'on-close', data: { isSubmit: boolean, refresh: boolean }): void
}>()
const props = withDefaults(defineProps<{
show ?: boolean
}>(), {
show: false,
})
const isShow = ref(false)
const emit = defineEmits<{
(e : 'on-close', data : { isSubmit : boolean, refresh : boolean }) : void
}>()
interface IApplyForm {
name: string
url: string
logo: string
linkPageUrl: string
email: string
rssUrl: string
description: string
}
const isShow = ref(false)
const form = ref<IApplyForm>({
name: '',
url: '',
logo: '',
linkPageUrl: '',
email: '',
rssUrl: '',
description: '',
})
interface IApplyForm {
name : string
url : string
logo : string
linkPageUrl : string
email : string
rssUrl : string
description : string
}
const submitting = ref(false)
const form = ref<IApplyForm>({
name: '',
url: '',
logo: '',
linkPageUrl: '',
email: '',
rssUrl: '',
description: '',
})
function handleResetForm() {
form.value = {
name: '',
url: '',
logo: '',
linkPageUrl: '',
email: '',
rssUrl: '',
description: '',
}
}
const submitting = ref(false)
function checkIsUrl(url: string): boolean {
return /^https?:\/\//i.test(url)
}
function handleResetForm() {
form.value = {
name: '',
url: '',
logo: '',
linkPageUrl: '',
email: '',
rssUrl: '',
description: '',
}
}
function checkIsEmail(email: string): boolean {
return /^[\w.-]+@[\w-]+(?:\.[\w-]+)+$/.test(email)
}
function checkIsUrl(url : string) : boolean {
return /^https?:\/\//i.test(url)
}
/** 提交校验 */
function validateForm(): boolean {
if (!form.value.name.trim()) {
uni.showToast({ icon: 'none', title: '请输入网站名称!' })
return false
}
if (!checkIsUrl(form.value.url)) {
uni.showToast({ icon: 'none', title: '请输入正确的网站地址!' })
return false
}
if (form.value.logo.trim() && !checkIsUrl(form.value.logo.trim())) {
uni.showToast({ icon: 'none', title: '请输入正确的Logo地址!' })
return false
}
if (form.value.email.trim() && !checkIsEmail(form.value.email.trim())) {
uni.showToast({ icon: 'none', title: '请输入正确的邮箱地址!' })
return false
}
return true
}
function checkIsEmail(email : string) : boolean {
return /^[\w.-]+@[\w-]+(?:\.[\w-]+)+$/.test(email)
}
/** 提交申请 */
async function handleSubmit() {
if (!validateForm())
return
/** 提交校验 */
function validateForm() : boolean {
if (!form.value.name.trim()) {
uni.showToast({ icon: 'none', title: '请输入网站名称!' })
return false
}
if (!checkIsUrl(form.value.url)) {
uni.showToast({ icon: 'none', title: '请输入正确的网站地址!' })
return false
}
if (form.value.logo.trim() && !checkIsUrl(form.value.logo.trim())) {
uni.showToast({ icon: 'none', title: '请输入正确的Logo地址!' })
return false
}
if (form.value.email.trim() && !checkIsEmail(form.value.email.trim())) {
uni.showToast({ icon: 'none', title: '请输入正确的邮箱地址!' })
return false
}
return true
}
// 第三方友链自助提交暂未开放
uni.showToast({ icon: 'none', title: '友链申请功能暂未开放,请联系站长' })
}
/** 提交申请 */
async function handleSubmit() {
if (!validateForm())
return
function handleOnChange(isOpen: boolean) {
isShow.value = isOpen
if (!isOpen)
emit('on-close', { isSubmit: false, refresh: false })
}
// 第三方友链自助提交暂未开放
uni.showToast({ icon: 'none', title: '友链申请功能暂未开放,请联系站长' })
}
function handleClose(refresh = false) {
isShow.value = false
emit('on-close', { isSubmit: true, refresh })
}
function handleOnChange(isOpen : boolean) {
isShow.value = isOpen
if (!isOpen)
emit('on-close', { isSubmit: false, refresh: false })
}
watch(() => props.show, (val) => {
if (!val)
return
isShow.value = true
handleResetForm()
})
function handleClose(refresh = false) {
isShow.value = false
emit('on-close', { isSubmit: true, refresh })
}
watch(() => props.show, (val) => {
if (!val)
return
isShow.value = true
handleResetForm()
})
</script>
<template>
<uh-glass-popup
v-model="isShow" :z-index="100" position="bottom"
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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">申请友链</text>
<text class="text-xs text-gray-500">提交后等待站长审核,通过后展示在「站点」列表中</text>
</view>
<view
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose(false)"
>
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<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">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">名称 *</text>
<input
v-model="form.name"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站名称"
>
</view>
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" 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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">申请友链</text>
<text class="text-xs text-gray-500">提交后等待站长审核,通过后展示在「站点」列表中</text>
</view>
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose(false)">
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<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">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">名称 *</text>
<input v-model="form.name"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站名称">
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">网址 *</text>
<input
v-model="form.url"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站地址"
>
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">网址 *</text>
<input v-model="form.url"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站地址">
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">Logo</text>
<input
v-model="form.logo"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站Logo(选填)"
>
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">Logo</text>
<input v-model="form.logo"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入网站Logo(选填)">
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">邮箱</text>
<input
v-model="form.email"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入邮箱(选填)"
>
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">邮箱</text>
<input v-model="form.email"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="请输入邮箱(选填)">
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">友链页面</text>
<input
v-model="form.linkPageUrl"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="贵站友情链接页面地址(选填)"
>
</view>
<view class="mb-2 pl-[140rpx] text-xs text-gray-400 -mt-3">
(即包含本站链接的页面)
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">友链页面</text>
<input v-model="form.linkPageUrl"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="贵站友情链接页面地址(选填)">
</view>
<view class="mb-2 pl-[140rpx] text-xs text-gray-400 -mt-3">
(即包含本站链接的页面)
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">RSS地址</text>
<input
v-model="form.rssUrl"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="用于抓取文章(选填)"
>
</view>
<view class="mb-5 flex items-center">
<text class="label w-[140rpx] shrink-0 text-sm text-[#666]">RSS地址</text>
<input v-model="form.rssUrl"
class="uh-global-card-glass h-9 flex-1 border rounded-xl px-4 text-sm shadow-none"
placeholder="用于抓取文章(选填)">
</view>
<view class="mb-5">
<text class="label mb-2 block text-sm text-[#666]">网站描述</text>
<textarea
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"
placeholder="请输入网站描述,不超过30字符(选填)" :maxlength="30"
/>
</view>
<view class="mb-5">
<text class="label mb-2 block text-sm text-[#666]">网站描述</text>
<textarea 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"
placeholder="请输入网站描述,不超过30字符(选填)" :maxlength="30" />
</view>
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" :loading="submitting" @click="handleSubmit">
提交申请
</uh-button>
</view>
</scroll-view>
</uh-glass-popup>
</template>
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" :loading="submitting" @click="handleSubmit">
提交申请
</uh-button>
</view>
</scroll-view>
</uh-glass-popup>
</template>
@@ -1,123 +1,115 @@
<script lang="ts" setup>
/**
* 站点友链信息弹窗
* 展示本站友链交换信息(博客名片 + 复制交换信息 + 站点缩略图)
* 数据源为插件端 linkInfo.siteInfo 配置(字段对齐 Halo 官方友链提交 API:displayName/url/logo/description/email/backlink/feedUrls)
*/
import { computed, ref, watch } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { checkAvatarUrl } from '@/utils/url'
import { computed, ref, watch } from 'vue'
import { useAppConfigStore } from '@/store/appConfig'
import { checkAvatarUrl } from '@/utils/url'
const props = withDefaults(defineProps<{
show?: boolean
}>(), {
show: false,
})
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const emit = defineEmits<{
(e: 'on-close'): void
}>()
const props = withDefaults(defineProps<{
show ?: boolean
}>(), {
show: false,
})
const isShow = ref(false)
const appConfigStore = useAppConfigStore()
const emit = defineEmits<{
(e : 'on-close') : void
}>()
const blogDetail = computed(() => (appConfigStore.configs.pluginConfig?.linkInfo?.siteInfo as {
displayName?: string
url?: string
logo?: string
description?: string
backlink?: string
feedUrls?: string[]
} | undefined) || {})
const isShow = ref(false)
const appConfigStore = useAppConfigStore()
/** 友链交换信息文案(复制用) */
const calcBlogContent = computed(() => `
博客名称:${blogDetail.value.displayName || ''}
博客地址:${blogDetail.value.url || ''}
博客logo:${checkAvatarUrl(blogDetail.value.logo)}
博客简介:${blogDetail.value.description || ''}
`)
const blogDetail = computed(() => (appConfigStore.configs.pluginConfig?.linkInfo?.siteInfo as {
displayName ?: string
url ?: string
logo ?: string
description ?: string
backlink ?: string
feedUrls ?: string[]
} | undefined) || {})
function calcSiteThumbnail(val?: string): string {
if (!val)
return ''
const _val = val.endsWith('/') ? val : `${val}/`
return `https://image.thum.io/get/width/1000/crop/800/${_val}`
}
/** 友链交换信息文案(复制用) */
const calcBlogContent = computed(() => `
博客名称:${blogDetail.value.displayName || ''}
博客地址:${blogDetail.value.url || ''}
博客logo:${checkAvatarUrl(blogDetail.value.logo)}
博客简介:${blogDetail.value.description || ''}
`)
function handleCopyLink() {
uni.setClipboardData({
data: calcBlogContent.value,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
function calcSiteThumbnail(val ?: string) : string {
if (!val) { return '' }
const _val = val.endsWith('/') ? val : `${val}/`
return `https://image.thum.io/get/width/1000/crop/800/${_val}`
}
function handleClose() {
isShow.value = false
emit('on-close')
}
function handleCopyLink() {
uni.setClipboardData({
data: calcBlogContent.value,
showToast: false,
success: () => {
uni.showToast({ icon: 'none', title: '复制成功!' })
},
fail: () => {
uni.showToast({ icon: 'none', title: '复制失败!' })
},
})
}
watch(() => props.show, (val) => {
isShow.value = val
})
function handleClose() {
isShow.value = false
emit('on-close')
}
watch(() => props.show, (val) => {
isShow.value = val
})
</script>
<template>
<uh-glass-popup
v-model="isShow" :z-index="100" position="bottom"
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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">友链信息</text>
<text class="text-xs text-gray-500">本站友链交换信息,欢迎申请互换友链</text>
</view>
<view
class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose"
>
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
<!-- 博客名片 -->
<view class="flex items-center">
<image
class="uh-global-card-glass h-20 w-20 shrink-0 rounded-2xl"
:src="checkAvatarUrl(blogDetail.logo)" mode="aspectFill"
/>
<view class="ml-4 flex flex-1 flex-col justify-center gap-y-1">
<text class="text-md text-gray-900 font-bold">
{{ blogDetail.displayName || '未命名博客' }}
</text>
<text class="text-xs text-gray-500">
{{ blogDetail.description || '这个博主很懒,没写简介~' }}
</text>
</view>
</view>
<uh-glass-popup v-model="isShow" :z-index="100" position="bottom" 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="w-full flex flex-col gap-y-1">
<text class="text-md font-bold">友链信息</text>
<text class="text-xs text-gray-500">本站友链交换信息,欢迎申请互换友链</text>
</view>
<view class="uh-global-card-glass absolute right-4 top-4 h-6 w-6 border rounded-lg text-center shadow-none"
@click="handleClose">
<wd-icon name="close" size="32rpx" class="text-gray-500" />
</view>
</view>
<scroll-view :scroll-y="true" :show-scrollbar="false" class="box-border max-h-[60vh] p-4">
<!-- 博客名片 -->
<view class="flex items-center">
<image class="uh-global-card-glass h-20 w-20 shrink-0 rounded-2xl"
:src="checkAvatarUrl(blogDetail.logo)" mode="aspectFill" />
<view class="ml-4 flex flex-1 flex-col justify-center gap-y-1">
<text class="text-md text-gray-900 font-bold">
{{ blogDetail.displayName || '未命名博客' }}
</text>
<text class="text-xs text-gray-500">
{{ blogDetail.description || '这个博主很懒,没写简介~' }}
</text>
</view>
</view>
<!-- 交换信息文案 -->
<view class="mt-4 whitespace-pre-wrap text-xs text-gray-600 leading-5">
<text>{{ calcBlogContent }}</text>
</view>
<!-- 交换信息文案 -->
<view class="mt-4 whitespace-pre-wrap text-xs text-gray-600 leading-5">
<text>{{ calcBlogContent }}</text>
</view>
<!-- 站点缩略图 -->
<image
v-if="blogDetail.url" class="mt-4 h-[320rpx] w-full rounded-xl"
:src="calcSiteThumbnail(blogDetail.url)" mode="aspectFill"
/>
<!-- 站点缩略图 -->
<image v-if="blogDetail.url" class="mt-4 h-[320rpx] w-full rounded-xl"
:src="calcSiteThumbnail(blogDetail.url)" mode="aspectFill" />
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyLink">
复制友链交换信息
</uh-button>
</view>
</scroll-view>
</uh-glass-popup>
</template>
<view class="my-6">
<uh-button custom-class="py-2 !rounded-xl" @click="handleCopyLink">
复制友链交换信息
</uh-button>
</view>
</scroll-view>
</uh-glass-popup>
</template>
@@ -2,6 +2,12 @@
import { computed } from 'vue'
import { markdownConfig } from '@/config/markdown'
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
const props = withDefaults(defineProps<{
modelValue ?: boolean
content ?: string
@@ -30,18 +36,18 @@
<uh-glass-popup v-model="show" position="bottom" :z-index="100" :safe-area-inset-bottom="true"
custom-class="rounded-xl">
<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>
</view>
<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
:tag-style="markdownConfig.tagStyle" :container-style="markdownConfig.containStyle"
copy-by-long-press />
</scroll-view>
<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>
</uh-glass-popup>
</template>
+48 -53
View File
@@ -1,39 +1,41 @@
<script setup lang="ts">
import { onPageScroll } from '@dcloudio/uni-app'
import { ref, computed, useSlots, onMounted } from 'vue'
import { computed, ref } from 'vue'
import { tabbarList } from '@/tabbar/config'
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
interface IProps {
useBack : boolean;
useTitle : boolean;
defaultTitle ?: string;
titleColor ?: string;
scrollTitle ?: string;
needPlaceholder ?: boolean;
backClass ?: string;
backStyle ?: string;
useBack : boolean
useTitle : boolean
defaultTitle ?: string
titleColor ?: string
scrollTitle ?: string
needPlaceholder ?: boolean
backClass ?: string
backStyle ?: string
scrollY ?: number
}
const props = withDefaults(defineProps<IProps>(), {
useBack: true,
useTitle: 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 alpha = Math.min(scrollY.value / 360, maxAlpha.value)
const alpha = Math.min(props.scrollY / 360, maxAlpha.value)
return {
backgroundColor: `rgba(255, 255, 255, ${alpha})`,
}
})
const scrollThreshold = computed(() => {
return scrollY.value / 360 <= 0.5;
return props.scrollY / 360 <= 0.5
})
const customCalss = computed(() => {
@@ -44,7 +46,7 @@
else {
_class.push('text-gray-900')
}
return _class;
return _class
})
const titleColorClass = computed(() => {
@@ -53,12 +55,12 @@
const visibleTitle = computed(() => {
if (!props.scrollTitle) {
return props.defaultTitle;
return props.defaultTitle
}
if (scrollThreshold.value) {
return props.defaultTitle;
return props.defaultTitle
}
return props.scrollTitle;
return props.scrollTitle
})
// 如果是从分享进来的,我们需要处理为返回 home页面
@@ -69,52 +71,45 @@
homePage,
'pages/maintenance/maintenance',
...tabbarList.map((item : any) => item.pagePath),
] as string[];
] as string[]
})
function handleBack() {
const currentPage = getCurrentPages()[0]
if (!allEntryPages.value.some(pagePath => pagePath == currentPage.route)) {
uni.reLaunch({
url: `/${homePage}`
url: `/${homePage}`,
})
return;
return
}
uni.navigateBack({ delta: 1 })
}
onPageScroll((e : any) => {
scrollY.value = e.scrollTop
})
</script>
<template>
<view class="w-full box-border">
<view class="box-border pt-safe w-full fixed left-0 top-0 z-100" :class="customCalss" :style="[customStyle]">
<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 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="props.backClass" :style="[props.backStyle]">
<wd-icon name="arrow-left" size="34rpx"></wd-icon>
<view class="w-[1px] h-4 bg-white/60" />
<text class="text-sm font-bold">返回</text>
</view>
</view>
<!-- 中间 -->
<view class="flex-1 truncate text-center font-bold transition-colors duration-300"
:class="titleColorClass">
<slot> {{visibleTitle}} </slot>
</view>
<!-- 右边 -->
<view class="shrink-0 min-w-18">
<slot name="right"></slot>
<view class="fixed left-0 top-0 z-100 box-border w-full pt-safe" :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="min-w-18 shrink-0" @click="handleBack()">
<view v-if="props.useBack"
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]">
<wd-icon name="arrow-left" size="30rpx" />
<view class="h-4 w-[1px] bg-white/60" />
<text class="text-[26rpx] font-bold">返回</text>
</view>
</view>
</view>
<view v-if="props.needPlaceholder" class="box-border w-full pt-safe">
<view class="w-full h-[46px]"></view>
<!-- 中间 -->
<view class="flex-1 truncate text-center font-bold transition-colors duration-300" :class="titleColorClass">
{{props.scrollY}} <slot> {{ visibleTitle }} </slot>
</view>
<!-- 右边 -->
<view class="min-w-18 shrink-0">
<slot name="right" />
</view>
</view>
</view>
<view v-if="props.needPlaceholder" class="box-border w-full pt-safe">
<view class="h-[46px] w-full" />
</view>
</template>
@@ -82,7 +82,7 @@
<view class="flex items-center justify-between">
<view class="flex items-center gap-2">
<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>
<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 />
</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
v-if="tipText"
class="tip-text mb-5 text-center leading-[1.4]"
@@ -154,4 +154,9 @@ function onTouchEnd() {
background-position: 0 50%;
}
}
/* 完全居中定位 */
.uh-translate-center {
transform: translate(-50%, -50%);
}
</style>
@@ -1,20 +1,16 @@
<script setup lang="ts">
import { useSlots } from 'vue'
const slots = useSlots();
const hasRightSlot = computed(() => !!slots.right?.())
</script>
<template>
<view class="w-full flex items-center justify-between">
<view class="shrink-0 relative">
<text class="font-bold relative z-2">
<slot></slot>
</text>
<view class="absolute z-1 -right-1 -bottom-0.5 rounded-xl bg-secondary h-4 w-4/5"></view>
</view>
<view v-if="hasRightSlot" class="flex-1 flex items-center justify-end">
<slot name="right"></slot>
</view>
</view>
</template>
<template>
<view class="w-full flex items-center justify-between">
<view class="relative shrink-0">
<text class="relative z-2 text-2xs font-semibold">
<slot />
</text>
<view class="absolute z-1 h-4 w-4/5 rounded-xl bg-secondary -bottom-0.5 -right-1" />
</view>
<view class="flex flex-1 items-center justify-end">
<slot name="right" />
</view>
</view>
</template>
@@ -5,6 +5,10 @@
fixed ?: boolean;
}
const emits = defineEmits<{
(e : 'action-click') : void
}>()
const props = withDefaults(defineProps<IProps>(), {
customClass: '',
fixed: true,
@@ -17,10 +21,15 @@
const visible = computed(() => {
return whiteList.includes(currentPage.route)
})
function handleClick() {
emits('action-click')
}
</script>
<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"
:class="props.customClass">
<wd-icon name="settings" size="42rpx" />
@@ -2,9 +2,23 @@
import { ref } from 'vue'
import { useSettingStore } from '@/store/setting'
import { usePreferenceRows } from '@/hooks/usePreferenceRows'
import { useSettingsPopup } from '@/hooks/useSettingsPopup'
import { isWechat } from '@/utils/platform'
const settingStore = useSettingStore()
defineOptions({
options: {
styleIsolation: 'apply-shared'
}
})
interface IProps {
/** v-model:是否显示 */
modelValue : boolean
}
const props = defineProps<IProps>()
const {
SETTING_TABS,
layoutGroups,
@@ -17,13 +31,21 @@
isCardTypeOptionDisabled,
} = 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 pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const filterLayoutGroups = computed(() => {
@@ -31,7 +53,7 @@
return currentPage.route.split('/').pop() === group.key
})
})
/* ---------------- 交互 ---------------- */
function currentValueOf(path : string[]) : string | null {
return isFollowing(path) ? null : String(prefValueOf(path) ?? '')
@@ -59,23 +81,20 @@
})
}
function onClose() {
emits('close')
}
function onOpen() {
emits('open')
function handleClose() {
emits('update:modelValue', false)
}
</script>
<template>
<uh-glass-popup v-model="settingsPopupVisible" position="bottom" custom-class="rounded-xl !border"
safe-area-inset-bottom :z-index="110" hide-when-close @close="onClose" @open="onOpen">
<uh-glass-popup v-model="popupVisible" position="bottom" custom-class="rounded-xl !border"
safe-area-inset-bottom :z-index="110" hide-when-close>
<view class="box-border px-3 pt-3">
<view class="mb-3 flex items-center justify-between">
<text class="text-md font-bold">偏好设置</text>
<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"
@click="onClose()">
@click="handleClose()">
<wd-icon name="close" size="16px" />
</view>
</view>
@@ -123,8 +142,7 @@
:class="[
currentValueOf(row.path) === opt.value ? 'bg-secondary font-bold' : 'border-gray-100 text-gray-500',
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 }}
</view>
</view>
@@ -148,9 +166,11 @@
<view v-if="row.kind === 'bool'" class="box-border p-3"
:class="index < featureRows.length - 1 ? 'border-b border-black/5' : ''">
<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">
<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
class="rounded-full bg-secondary px-2 py-1 text-xs text-gray-900 leading-none">
已自定义
@@ -215,15 +235,16 @@
</scroll-view>
<!-- 底部操作栏 -->
<view class="box-border w-full pb-4 pt-3 flex items-center gap-x-2">
<uh-button custom-class="flex-1 uh-global-card-glass bg-white/90 border py-2 !rounded-xl"
@click="onClose()">
<view class="box-border w-full pt-3 flex items-center gap-x-2" :class="[isWechat?'':'pb-3']">
<uh-button class="flex-1" custom-class="flex-1 uh-global-card-glass bg-white/90 border py-2 !rounded-xl"
@click="handleClose()">
关闭
</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>
</view>
</view>
</uh-glass-popup>
</template>
</template>
@@ -6,7 +6,7 @@
}
const props = withDefaults(defineProps<IProps>(), {
customClass: '',
lineClass: '!h-2/5 -rotate-5',
lineClass: '!h-2/5 uh-rotate-n5',
textClass: 'font-bold'
})
</script>
@@ -19,4 +19,10 @@
<text class="absolute z-1 -right-1 -bottom-0.5 transform rounded-xl bg-secondary h-3/5 w-4/5" :class="[props.lineClass]"></text>
</text>
</template>
<style scoped lang="scss">
/* 下划线轻微旋转 */
.uh-rotate-n5 {
transform: rotate(-5deg);
}
</style>