create-weapp-vite 2.3.15 → 2.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-D8uqfCKh.js → src-C8kzMXK7.js} +1 -1
- package/package.json +1 -1
- package/templates/wevu/README.md +3 -3
- package/templates/wevu/package.json +1 -1
- package/templates/wevu/src/app.vue +1 -60
- package/templates/wevu/src/pages/index/index.vue +26 -194
- package/templates/wevu/src/pages/layouts/index.vue +0 -18
- package/templates/wevu/weapp-vite.config.ts +0 -7
- package/templates/wevu-tdesign/README.md +3 -6
- package/templates/wevu-tdesign/package.json +1 -1
- package/templates/wevu-tdesign/project.private.config.json +0 -66
- package/templates/wevu-tdesign/src/app.vue +1 -73
- package/templates/wevu-tdesign/src/pages/index/index.vue +19 -362
- package/templates/wevu/src/components/InfoPanel/index.vue +0 -52
- package/templates/wevu/src/components/StatusPill/index.vue +0 -42
- package/templates/wevu/src/packageA/pages/workspace/index.vue +0 -137
- package/templates/wevu/src/packageB/pages/settings/index.vue +0 -131
- package/templates/wevu/src/pages/overview/index.vue +0 -149
- package/templates/wevu-tdesign/public/tabbar/ability-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/ability.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/data-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/data.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/form-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/form.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/home-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/home.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/list-active.png +0 -0
- package/templates/wevu-tdesign/public/tabbar/list.png +0 -0
- package/templates/wevu-tdesign/src/components/EmptyState/index.vue +0 -36
- package/templates/wevu-tdesign/src/components/FilterBar/index.vue +0 -64
- package/templates/wevu-tdesign/src/components/FormRow/index.vue +0 -43
- package/templates/wevu-tdesign/src/components/FormStep/index.vue +0 -48
- package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +0 -145
- package/templates/wevu-tdesign/src/components/QuickActionGrid/index.vue +0 -79
- package/templates/wevu-tdesign/src/components/ResultCard/index.vue +0 -51
- package/templates/wevu-tdesign/src/components/SectionTitle/index.vue +0 -34
- package/templates/wevu-tdesign/src/components/TrendCard/index.vue +0 -101
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/BrokenCard.vue +0 -46
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/FixedExternalClassCard.vue +0 -50
- package/templates/wevu-tdesign/src/components/VirtualHostClassDemo/RecommendedCard.vue +0 -53
- package/templates/wevu-tdesign/src/hooks/useDialog.ts +0 -205
- package/templates/wevu-tdesign/src/hooks/useFormBinder.ts +0 -17
- package/templates/wevu-tdesign/src/hooks/useLayoutFeedbackBridge.ts +0 -17
- package/templates/wevu-tdesign/src/hooks/usePullDownRefresh.ts +0 -12
- package/templates/wevu-tdesign/src/hooks/useToast.ts +0 -100
- package/templates/wevu-tdesign/src/layouts/admin.vue +0 -41
- package/templates/wevu-tdesign/src/layouts/default.vue +0 -23
- package/templates/wevu-tdesign/src/pages/ability/index.vue +0 -164
- package/templates/wevu-tdesign/src/pages/data/index.vue +0 -189
- package/templates/wevu-tdesign/src/pages/form/index.vue +0 -271
- package/templates/wevu-tdesign/src/pages/layout-feedback/components/FeedbackCallerCard.vue +0 -79
- package/templates/wevu-tdesign/src/pages/layout-feedback/index.vue +0 -211
- package/templates/wevu-tdesign/src/pages/layout-store/index.vue +0 -127
- package/templates/wevu-tdesign/src/pages/layouts/index.vue +0 -120
- package/templates/wevu-tdesign/src/pages/list/index.vue +0 -146
- package/templates/wevu-tdesign/src/stores/layoutInteractionDemo.ts +0 -129
- package/templates/wevu-tdesign/src/subpackages/ability/index.vue +0 -103
- package/templates/wevu-tdesign/src/subpackages/lab/class-binding/index.vue +0 -440
- package/templates/wevu-tdesign/src/subpackages/lab/index.vue +0 -169
- package/templates/wevu-tdesign/src/subpackages/lab/virtual-host-class/index.vue +0 -94
- package/templates/wevu-tdesign/src/types/action.ts +0 -14
- package/templates/wevu-tdesign/src/types/list.ts +0 -17
- package/templates/wevu-tdesign/src/utils/changeEvent.ts +0 -53
- package/templates/wevu-tdesign/src/utils/listFilters.ts +0 -34
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import Toast from 'tdesign-miniprogram/toast/index'
|
|
2
|
-
import { getCurrentInstance, resolveLayoutBridge, resolveLayoutHost } from 'wevu'
|
|
3
|
-
import { LAYOUT_TOAST_BRIDGE_KEY } from '@/hooks/useLayoutFeedbackBridge'
|
|
4
|
-
|
|
5
|
-
export type ToastTheme = 'success' | 'warning' | 'error' | 'default' | 'loading'
|
|
6
|
-
|
|
7
|
-
export interface ShowToastPayload {
|
|
8
|
-
bridgeKey?: string
|
|
9
|
-
context?: any
|
|
10
|
-
duration?: number
|
|
11
|
-
icon?: string
|
|
12
|
-
message?: string
|
|
13
|
-
placement?: string
|
|
14
|
-
selector?: string
|
|
15
|
-
theme?: ToastTheme
|
|
16
|
-
title?: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ToastOptions {
|
|
20
|
-
bridgeKey?: string
|
|
21
|
-
selector?: string
|
|
22
|
-
duration?: number
|
|
23
|
-
theme?: ToastTheme
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function resolveToastContext(options: { bridgeKey?: string, context?: any }) {
|
|
27
|
-
return options.bridgeKey
|
|
28
|
-
? resolveLayoutBridge(options.bridgeKey, options.context ?? getCurrentInstance())
|
|
29
|
-
: options.context ?? getCurrentInstance()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function showToast(payload: string | ShowToastPayload, theme?: ToastTheme) {
|
|
33
|
-
const mpContext = getCurrentInstance()
|
|
34
|
-
const normalized = typeof payload === 'string'
|
|
35
|
-
? { message: payload, theme }
|
|
36
|
-
: payload
|
|
37
|
-
const bridgeKey = normalized.bridgeKey ?? LAYOUT_TOAST_BRIDGE_KEY
|
|
38
|
-
const selector = normalized.selector
|
|
39
|
-
const {
|
|
40
|
-
bridgeKey: _bridgeKey,
|
|
41
|
-
context: _context,
|
|
42
|
-
selector: _selector,
|
|
43
|
-
theme: nextTheme,
|
|
44
|
-
title,
|
|
45
|
-
message,
|
|
46
|
-
...rest
|
|
47
|
-
} = normalized
|
|
48
|
-
const options = {
|
|
49
|
-
message: message ?? title ?? '',
|
|
50
|
-
...rest,
|
|
51
|
-
...(nextTheme && nextTheme !== 'default' ? { theme: nextTheme } : {}),
|
|
52
|
-
}
|
|
53
|
-
const context = resolveToastContext({
|
|
54
|
-
bridgeKey,
|
|
55
|
-
context: normalized.context ?? mpContext,
|
|
56
|
-
})
|
|
57
|
-
const host = bridgeKey
|
|
58
|
-
? resolveLayoutHost<{
|
|
59
|
-
show?: (payload: typeof options) => void
|
|
60
|
-
}>(bridgeKey, { context })
|
|
61
|
-
: selector
|
|
62
|
-
? context?.selectComponent?.(selector) ?? null
|
|
63
|
-
: null
|
|
64
|
-
if (!context) {
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
if (host && typeof host.show === 'function') {
|
|
68
|
-
host.show(options)
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
if (!selector) {
|
|
72
|
-
return
|
|
73
|
-
}
|
|
74
|
-
Toast({
|
|
75
|
-
selector,
|
|
76
|
-
context: context as any,
|
|
77
|
-
...options,
|
|
78
|
-
} as any)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function useToast(options: ToastOptions = {}) {
|
|
82
|
-
const context = getCurrentInstance()
|
|
83
|
-
const bridgeKey = options.bridgeKey ?? LAYOUT_TOAST_BRIDGE_KEY
|
|
84
|
-
const selector = options.selector
|
|
85
|
-
const duration = options.duration ?? 1200
|
|
86
|
-
const defaultTheme = options.theme ?? 'success'
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
showToast(message: string, theme: ToastTheme = defaultTheme) {
|
|
90
|
-
return showToast({
|
|
91
|
-
bridgeKey,
|
|
92
|
-
context,
|
|
93
|
-
selector,
|
|
94
|
-
message,
|
|
95
|
-
duration,
|
|
96
|
-
...(theme === 'default' ? {} : { theme }),
|
|
97
|
-
})
|
|
98
|
-
},
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
const props = defineProps<{
|
|
3
|
-
subtitle?: string
|
|
4
|
-
title?: string
|
|
5
|
-
}>()
|
|
6
|
-
|
|
7
|
-
defineComponentJson({
|
|
8
|
-
component: true,
|
|
9
|
-
usingComponents: {
|
|
10
|
-
't-dialog': 'tdesign-miniprogram/dialog/dialog',
|
|
11
|
-
't-toast': 'tdesign-miniprogram/toast/toast',
|
|
12
|
-
},
|
|
13
|
-
})
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<template>
|
|
17
|
-
<view class="layout-admin min-h-full bg-[linear-gradient(180deg,#f8f7ff_0%,#f1efff_100%)]">
|
|
18
|
-
<view class="rounded-b-[32rpx] bg-[linear-gradient(145deg,#2f2b5f_0%,#4b3fb8_64%,#8b7bff_100%)] px-[32rpx] pb-[32rpx] pt-[36rpx] text-white shadow-[0_18rpx_42rpx_rgba(75,63,184,0.18)]">
|
|
19
|
-
<text class="inline-flex rounded-full bg-white/15 px-[16rpx] py-[8rpx] text-[22rpx]">
|
|
20
|
-
layouts/admin.vue
|
|
21
|
-
</text>
|
|
22
|
-
<text class="mt-[18rpx] block text-[46rpx] font-semibold">
|
|
23
|
-
{{ props.title || 'Admin Layout' }}
|
|
24
|
-
</text>
|
|
25
|
-
<text class="mt-[12rpx] block text-[24rpx] leading-[1.7] text-white/90">
|
|
26
|
-
{{ props.subtitle || '页面内容通过默认 slot 注入到布局中。' }}
|
|
27
|
-
</text>
|
|
28
|
-
</view>
|
|
29
|
-
<view class="pb-[32rpx]">
|
|
30
|
-
<slot />
|
|
31
|
-
</view>
|
|
32
|
-
<t-toast layout-host="layout-toast" />
|
|
33
|
-
<t-dialog layout-host="layout-dialog" />
|
|
34
|
-
</view>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<style>
|
|
38
|
-
.layout-admin {
|
|
39
|
-
min-height: 100%;
|
|
40
|
-
}
|
|
41
|
-
</style>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
defineComponentJson({
|
|
3
|
-
component: true,
|
|
4
|
-
usingComponents: {
|
|
5
|
-
't-dialog': 'tdesign-miniprogram/dialog/dialog',
|
|
6
|
-
't-toast': 'tdesign-miniprogram/toast/toast',
|
|
7
|
-
},
|
|
8
|
-
})
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<view class="layout-default">
|
|
13
|
-
<slot />
|
|
14
|
-
<t-toast layout-host="layout-toast" />
|
|
15
|
-
<t-dialog layout-host="layout-dialog" />
|
|
16
|
-
</view>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<style>
|
|
20
|
-
.layout-default {
|
|
21
|
-
min-height: 100%;
|
|
22
|
-
}
|
|
23
|
-
</style>
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'wevu'
|
|
3
|
-
import { wpi } from 'wevu/api'
|
|
4
|
-
|
|
5
|
-
import SectionTitle from '@/components/SectionTitle/index.vue'
|
|
6
|
-
import { useDialog } from '@/hooks/useDialog'
|
|
7
|
-
import { useToast } from '@/hooks/useToast'
|
|
8
|
-
|
|
9
|
-
definePageJson({
|
|
10
|
-
navigationBarTitleText: '能力',
|
|
11
|
-
backgroundColor: '#f6f7fb',
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const { alert } = useDialog()
|
|
15
|
-
const { showToast } = useToast()
|
|
16
|
-
|
|
17
|
-
const capabilityCards = ref([
|
|
18
|
-
{
|
|
19
|
-
key: 'scan',
|
|
20
|
-
title: '扫一扫',
|
|
21
|
-
desc: '识别条码或二维码',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
key: 'location',
|
|
25
|
-
title: '定位',
|
|
26
|
-
desc: '获取当前坐标',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
key: 'clipboard',
|
|
30
|
-
title: '剪贴板',
|
|
31
|
-
desc: '写入演示文本',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
key: 'share',
|
|
35
|
-
title: '分享',
|
|
36
|
-
desc: '唤起分享菜单',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
key: 'image',
|
|
40
|
-
title: '选择图片',
|
|
41
|
-
desc: '上传素材预览',
|
|
42
|
-
},
|
|
43
|
-
])
|
|
44
|
-
|
|
45
|
-
const subscribeTemplateId = ''
|
|
46
|
-
|
|
47
|
-
async function handleCapability(key: string) {
|
|
48
|
-
try {
|
|
49
|
-
switch (key) {
|
|
50
|
-
case 'scan': {
|
|
51
|
-
const result = await wpi.scanCode()
|
|
52
|
-
showToast(`识别结果:${result.result || '已完成'}`)
|
|
53
|
-
break
|
|
54
|
-
}
|
|
55
|
-
case 'location': {
|
|
56
|
-
const result = await wpi.getLocation({
|
|
57
|
-
type: 'wgs84',
|
|
58
|
-
})
|
|
59
|
-
showToast(`定位成功:${result.latitude.toFixed(2)}, ${result.longitude.toFixed(2)}`)
|
|
60
|
-
break
|
|
61
|
-
}
|
|
62
|
-
case 'clipboard':
|
|
63
|
-
await wpi.setClipboardData({
|
|
64
|
-
data: 'weapp-vite + wevu + TDesign',
|
|
65
|
-
})
|
|
66
|
-
showToast('已写入剪贴板')
|
|
67
|
-
break
|
|
68
|
-
case 'share':
|
|
69
|
-
await wpi.showShareMenu({
|
|
70
|
-
withShareTicket: true,
|
|
71
|
-
})
|
|
72
|
-
showToast('已开启分享菜单')
|
|
73
|
-
break
|
|
74
|
-
case 'image': {
|
|
75
|
-
const result = await wpi.chooseImage({
|
|
76
|
-
count: 3,
|
|
77
|
-
})
|
|
78
|
-
showToast(`已选择 ${result.tempFilePaths.length} 张图片`)
|
|
79
|
-
break
|
|
80
|
-
}
|
|
81
|
-
default:
|
|
82
|
-
break
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
const warningMap: Record<string, string> = {
|
|
87
|
-
scan: '扫码失败,请重试',
|
|
88
|
-
location: '未获取定位权限',
|
|
89
|
-
share: '分享菜单开启失败',
|
|
90
|
-
image: '未选择图片',
|
|
91
|
-
}
|
|
92
|
-
showToast(warningMap[key] || '操作失败,请重试', 'warning')
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async function requestSubscribe() {
|
|
97
|
-
if (!subscribeTemplateId) {
|
|
98
|
-
alert({
|
|
99
|
-
title: '订阅消息',
|
|
100
|
-
content: '请在 ability 页面配置订阅模板 ID 后再试。',
|
|
101
|
-
confirmBtn: '知道了',
|
|
102
|
-
})
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
await wpi.requestSubscribeMessage({
|
|
107
|
-
tmplIds: [subscribeTemplateId],
|
|
108
|
-
})
|
|
109
|
-
showToast('订阅成功')
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
showToast('订阅失败', 'warning')
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async function navigateTo(url: string) {
|
|
117
|
-
await wpi.navigateTo({
|
|
118
|
-
url,
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
</script>
|
|
122
|
-
|
|
123
|
-
<template>
|
|
124
|
-
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
|
|
125
|
-
<view class="rounded-[28rpx] bg-linear-to-br from-[#ecfeff] via-[#ffffff] to-[#e0f2fe] p-[20rpx]">
|
|
126
|
-
<SectionTitle title="小程序能力" subtitle="本页展示原生 API 与分包导航" />
|
|
127
|
-
</view>
|
|
128
|
-
|
|
129
|
-
<view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
130
|
-
<SectionTitle title="常用能力" subtitle="点击体验微信原生 API" />
|
|
131
|
-
<view class="mt-[12rpx] grid grid-cols-2 gap-[12rpx]">
|
|
132
|
-
<view
|
|
133
|
-
v-for="item in capabilityCards"
|
|
134
|
-
:key="item.key"
|
|
135
|
-
class="rounded-[18rpx] bg-[#f0f9ff] p-[16rpx]"
|
|
136
|
-
@tap="handleCapability(item.key)"
|
|
137
|
-
>
|
|
138
|
-
<text class="text-[24rpx] font-semibold text-[#1f1a3f]">
|
|
139
|
-
{{ item.title }}
|
|
140
|
-
</text>
|
|
141
|
-
<text class="mt-[6rpx] block text-[20rpx] text-[#6f6b8a]">
|
|
142
|
-
{{ item.desc }}
|
|
143
|
-
</text>
|
|
144
|
-
</view>
|
|
145
|
-
</view>
|
|
146
|
-
<view class="mt-[16rpx]">
|
|
147
|
-
<t-button block theme="primary" variant="outline" @tap="requestSubscribe">
|
|
148
|
-
订阅消息提醒
|
|
149
|
-
</t-button>
|
|
150
|
-
</view>
|
|
151
|
-
</view>
|
|
152
|
-
|
|
153
|
-
<view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
154
|
-
<SectionTitle title="分包演示" subtitle="weapp-vite 子包页面" />
|
|
155
|
-
<view class="mt-[12rpx]">
|
|
156
|
-
<t-cell-group>
|
|
157
|
-
<t-cell title="组件实验室" note="subpackages/lab" arrow @tap="navigateTo('/subpackages/lab/index')" />
|
|
158
|
-
<t-cell title="Class 绑定实验室" note="subpackages/lab/class-binding" arrow @tap="navigateTo('/subpackages/lab/class-binding/index')" />
|
|
159
|
-
<t-cell title="API 场景页" note="subpackages/ability" arrow @tap="navigateTo('/subpackages/ability/index')" />
|
|
160
|
-
</t-cell-group>
|
|
161
|
-
</view>
|
|
162
|
-
</view>
|
|
163
|
-
</view>
|
|
164
|
-
</template>
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, watch } from 'wevu'
|
|
3
|
-
|
|
4
|
-
import KpiBoard from '@/components/KpiBoard/index.vue'
|
|
5
|
-
import SectionTitle from '@/components/SectionTitle/index.vue'
|
|
6
|
-
import TrendCard from '@/components/TrendCard/index.vue'
|
|
7
|
-
import { resolveStringChangeValue } from '@/utils/changeEvent'
|
|
8
|
-
|
|
9
|
-
definePageJson({
|
|
10
|
-
navigationBarTitleText: '数据',
|
|
11
|
-
backgroundColor: '#f6f7fb',
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const ranges = [
|
|
15
|
-
{ value: 'today', label: '今日' },
|
|
16
|
-
{ value: 'week', label: '本周' },
|
|
17
|
-
{ value: 'month', label: '本月' },
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const activeRange = ref('week')
|
|
21
|
-
const refreshTick = ref(0)
|
|
22
|
-
|
|
23
|
-
const kpiItems = computed(() => {
|
|
24
|
-
const scale = activeRange.value === 'today' ? 1 : activeRange.value === 'month' ? 4 : 2
|
|
25
|
-
const drift = refreshTick.value
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
key: 'orders',
|
|
29
|
-
label: '订单量',
|
|
30
|
-
value: 268 * scale + drift,
|
|
31
|
-
unit: '单',
|
|
32
|
-
delta: 12 + drift,
|
|
33
|
-
footnote: '核心目标',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
key: 'gmv',
|
|
37
|
-
label: '成交额',
|
|
38
|
-
value: 42 * scale + drift,
|
|
39
|
-
unit: '万',
|
|
40
|
-
delta: 3 + drift,
|
|
41
|
-
footnote: 'GMV',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
key: 'retention',
|
|
45
|
-
label: '留存',
|
|
46
|
-
value: 62 + drift,
|
|
47
|
-
unit: '%',
|
|
48
|
-
delta: 4,
|
|
49
|
-
footnote: '用户粘性',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
key: 'nps',
|
|
53
|
-
label: 'NPS',
|
|
54
|
-
value: 48 + drift,
|
|
55
|
-
unit: '分',
|
|
56
|
-
delta: 2,
|
|
57
|
-
footnote: '满意度',
|
|
58
|
-
},
|
|
59
|
-
]
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
const trends = computed(() => [
|
|
63
|
-
{
|
|
64
|
-
key: 'active',
|
|
65
|
-
title: '活跃用户',
|
|
66
|
-
value: activeRange.value === 'today' ? 980 : activeRange.value === 'month' ? 8820 : 3560,
|
|
67
|
-
unit: '人',
|
|
68
|
-
delta: 12 + refreshTick.value,
|
|
69
|
-
progress: 78,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
key: 'conversion',
|
|
73
|
-
title: '转化漏斗',
|
|
74
|
-
value: activeRange.value === 'today' ? 21 : activeRange.value === 'month' ? 25 : 23,
|
|
75
|
-
unit: '%',
|
|
76
|
-
delta: 1,
|
|
77
|
-
progress: 56,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
key: 'response',
|
|
81
|
-
title: '响应时长',
|
|
82
|
-
value: activeRange.value === 'today' ? 1.6 : 1.8,
|
|
83
|
-
unit: 's',
|
|
84
|
-
delta: -0.2,
|
|
85
|
-
progress: 68,
|
|
86
|
-
},
|
|
87
|
-
])
|
|
88
|
-
|
|
89
|
-
const reportLines = computed(() => [
|
|
90
|
-
`分组:${ranges.find(range => range.value === activeRange.value)?.label ?? '本周'}`,
|
|
91
|
-
'渠道贡献 Top3:直播、社群、搜索',
|
|
92
|
-
'重点事项:提升转化 > 优化留存',
|
|
93
|
-
])
|
|
94
|
-
|
|
95
|
-
function onRangeChange(event: unknown) {
|
|
96
|
-
activeRange.value = resolveStringChangeValue(event, activeRange.value)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
watch(activeRange, () => {
|
|
100
|
-
refreshTick.value = Math.floor(Math.random() * 6)
|
|
101
|
-
})
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<template>
|
|
105
|
-
<view class="min-h-screen bg-[#f6f7fb] px-[28rpx] pb-[88rpx] pt-[24rpx] text-[#1c1c3c]">
|
|
106
|
-
<view class="rounded-[28rpx] bg-linear-to-br from-[#f1f5ff] via-[#eef2ff] to-[#ffffff] p-[20rpx]">
|
|
107
|
-
<SectionTitle title="经营仪表盘" subtitle="聚焦关键指标与趋势" />
|
|
108
|
-
<view class="mt-[12rpx]">
|
|
109
|
-
<t-tabs :value="activeRange" @change="onRangeChange">
|
|
110
|
-
<t-tab-panel v-for="range in ranges" :key="range.value" :value="range.value" :label="range.label" />
|
|
111
|
-
</t-tabs>
|
|
112
|
-
</view>
|
|
113
|
-
</view>
|
|
114
|
-
|
|
115
|
-
<view class="mt-[18rpx]">
|
|
116
|
-
<KpiBoard title="核心 KPI" subtitle="趋势随区间自动刷新" :items="kpiItems">
|
|
117
|
-
<template #action />
|
|
118
|
-
<template #items="{ items }">
|
|
119
|
-
<view v-for="card in items" :key="card.key">
|
|
120
|
-
<view class="rounded-[18rpx] bg-[#f7f7fb] p-[16rpx]">
|
|
121
|
-
<view class="flex items-center justify-between">
|
|
122
|
-
<view class="flex items-center gap-[8rpx]">
|
|
123
|
-
<view class="h-[8rpx] w-[8rpx] rounded-full" :class="card.tone === 'positive' ? 'bg-[#22c55e]' : card.tone === 'negative' ? 'bg-[#ef4444]' : 'bg-[#94a3b8]'" />
|
|
124
|
-
<text class="text-[22rpx] text-[#61618a]">
|
|
125
|
-
{{ card.item.label }}
|
|
126
|
-
</text>
|
|
127
|
-
</view>
|
|
128
|
-
<view v-if="card.isLeading" class="rounded-full bg-[#fff3c2] px-[10rpx] py-[4rpx]">
|
|
129
|
-
<text class="text-[18rpx] font-semibold text-[#8a5200]">
|
|
130
|
-
HOT
|
|
131
|
-
</text>
|
|
132
|
-
</view>
|
|
133
|
-
</view>
|
|
134
|
-
<view class="mt-[10rpx] flex items-end justify-between">
|
|
135
|
-
<view class="flex items-baseline gap-[6rpx]">
|
|
136
|
-
<text class="text-[32rpx] font-bold text-[#1c1c3c]">
|
|
137
|
-
{{ card.item.value }}
|
|
138
|
-
</text>
|
|
139
|
-
<text v-if="card.item.unit" class="text-[20rpx] text-[#7a7aa0]">
|
|
140
|
-
{{ card.item.unit }}
|
|
141
|
-
</text>
|
|
142
|
-
</view>
|
|
143
|
-
<view
|
|
144
|
-
class="rounded-full px-[10rpx] py-[4rpx]"
|
|
145
|
-
:class="card.tone === 'positive' ? 'bg-[#e7f7ee] text-[#1b7a3a]' : card.tone === 'negative' ? 'bg-[#ffe9e9] text-[#b42318]' : 'bg-[#edf1f7] text-[#64748b]'"
|
|
146
|
-
>
|
|
147
|
-
<text class="text-[20rpx] font-semibold">
|
|
148
|
-
{{ card.tone === 'positive' ? '↑' : card.tone === 'negative' ? '↓' : '→' }}
|
|
149
|
-
{{ card.item.delta == null ? '--' : card.item.delta + (card.item.unit ? card.item.unit : '') }}
|
|
150
|
-
</text>
|
|
151
|
-
</view>
|
|
152
|
-
</view>
|
|
153
|
-
<text v-if="card.item.footnote" class="mt-[6rpx] block text-[20rpx] text-[#8a8aa5]">
|
|
154
|
-
{{ card.item.footnote }}
|
|
155
|
-
</text>
|
|
156
|
-
</view>
|
|
157
|
-
</view>
|
|
158
|
-
</template>
|
|
159
|
-
</KpiBoard>
|
|
160
|
-
</view>
|
|
161
|
-
|
|
162
|
-
<view class="mt-[18rpx]">
|
|
163
|
-
<SectionTitle title="趋势追踪" subtitle="转化与体验指标" />
|
|
164
|
-
<view class="mt-[12rpx] grid gap-[12rpx]">
|
|
165
|
-
<TrendCard
|
|
166
|
-
v-for="card in trends"
|
|
167
|
-
:key="card.key"
|
|
168
|
-
:title="card.title"
|
|
169
|
-
:value="card.value"
|
|
170
|
-
:unit="card.unit"
|
|
171
|
-
:delta="card.delta"
|
|
172
|
-
:progress="card.progress"
|
|
173
|
-
/>
|
|
174
|
-
</view>
|
|
175
|
-
</view>
|
|
176
|
-
|
|
177
|
-
<view class="mt-[18rpx] rounded-[24rpx] bg-white p-[20rpx] shadow-[0_18rpx_40rpx_rgba(17,24,39,0.08)]">
|
|
178
|
-
<SectionTitle title="经营洞察" subtitle="跟进重点事项" />
|
|
179
|
-
<view class="mt-[12rpx] space-y-[10rpx]">
|
|
180
|
-
<view v-for="line in reportLines" :key="line" class="flex items-center gap-[8rpx]">
|
|
181
|
-
<view class="h-[8rpx] w-[8rpx] rounded-full bg-[#5a48c5]" />
|
|
182
|
-
<text class="text-[22rpx] text-[#4c4b68]">
|
|
183
|
-
{{ line }}
|
|
184
|
-
</text>
|
|
185
|
-
</view>
|
|
186
|
-
</view>
|
|
187
|
-
</view>
|
|
188
|
-
</view>
|
|
189
|
-
</template>
|