Skip to content

Commit bbc839b

Browse files
committed
style(mock): restyle mock page 💄
1 parent f44a05a commit bbc839b

File tree

8 files changed

+104
-33
lines changed

8 files changed

+104
-33
lines changed

components.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import '@vue/runtime-core'
55

66
declare module '@vue/runtime-core' {
77
export interface GlobalComponents {
8+
VanButton: typeof import('vant/es')['Button']
89
VanCell: typeof import('vant/es')['Cell']
910
VanCellGroup: typeof import('vant/es')['CellGroup']
1011
VanConfigProvider: typeof import('vant/es')['ConfigProvider']
12+
VanEmpty: typeof import('vant/es')['Empty']
1113
VanNavBar: typeof import('vant/es')['NavBar']
1214
VanSwitch: typeof import('vant/es')['Switch']
1315
VanTag: typeof import('vant/es')['Tag']

mock/dashboard/workplace.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

mock/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const dashboardWorkplace = require('./dashboard/workplace.js')
1+
const prose = require('./modules/prose')
22

33
module.exports = {
4-
...dashboardWorkplace
4+
...prose
55
}

mock/modules/prose.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
const list = [
3+
{ prose: '🔖 躲在某一时间,想念一段时光的掌纹;躲在某一地点,想念一个站在来路也站在去路的,让我牵挂的人。' },
4+
{ prose: '🔖 天空一碧如洗,灿烂的阳光正从密密的松针的缝隙间射下来,形成一束束粗粗细细的光柱,把飘荡着轻纱般薄雾的林荫照得通亮。' },
5+
{ prose: '🔖 这一次相遇,美得彻骨,美得震颤,美得孤绝,美得惊艳。' },
6+
{ prose: '🔖 沉默的状态,能让我感觉到呼吸的自由和自己原来就处于的本色位置。' },
7+
{ prose: '🔖 青春,是一包象征着阳光的向日葵种子,在现在洒下,就会在未来得到收获,那一株株饱含青春的花朵。' },
8+
{ prose: '🔖 燕子去了,有再来的时候;杨柳枯了,有再青的时候;桃花谢了,有再开的时候。但是,聪明的,你告诉我,我们的日子为什么一去不复返呢?' },
9+
{ prose: '🔖 毕业了,青春在无形之中离去,我们即将翻开人生的另一页。' },
10+
{ prose: '🔖 成长,是每个孩子的权力,也是他们必经的征程,或平坦、或崎岖,有悲欢,有离合。' },
11+
{ prose: '🔖 旧时光里的人和事,琐碎而零乱。我的记忆很模糊,好像大部分都成了一种温馨的符号,静静的沉在我心底。' },
12+
{ prose: '🔖 生活是一部大百科全书,包罗万象;生活是一把六弦琴,弹奏出多重美妙的旋律:生活是一座飞马牌大钟,上紧发条,便会使人获得浓缩的生命。' },
13+
{ prose: '🔖 毕业了,身边的朋友一个个各奔东西,开始学会自己撑起生命的暖色。' },
14+
{ prose: '🔖 已经走到尽头的东西,重生也不过是再一次的消亡。就像所有的开始,其实都只是一个写好了的结局。' },
15+
{ prose: '🔖 下午茶的芬香熏陶着房内的任何一个角落,午后的阳光透过窗帘的间隙洒在木制的桌面上,一份思念随着红茶顺滑至心中。' },
16+
{ prose: '🔖 这里再不是我们的校园,当我们就此离开我们的青葱岁月。' },
17+
{ prose: '🔖 很久找你,一直没有找到,微风吹过的时候,我深深的呼吸,才感觉到你也在陪伴着我呼吸。' }
18+
]
19+
20+
21+
module.exports = {
22+
'GET /api/project/prose': (req, res) => {
23+
res.json(list[Math.floor(Math.random() * 8)])
24+
}
25+
}

src/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import request from '@/utils/request'
22

3-
export async function queryProjectNotice(): Promise<any> {
4-
return request('/project/notice')
3+
export async function queryProse(): Promise<any> {
4+
return request('/project/prose')
55
}

src/app.less

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
body {
22
overflow: hidden;
33
}
4+
45
#app {
56
height: 100%;
67
overflow-x: hidden;
@@ -17,5 +18,18 @@ body {
1718
&,
1819
* {
1920
color-scheme: dark !important;
21+
transition: background-color 300ms;
22+
}
23+
}
24+
25+
[data-theme='light'] {
26+
&,
27+
* {
28+
color-scheme: light !important;
29+
transition: background-color 300ms;
30+
}
31+
32+
body {
33+
background-color: #eff2f5;
2034
}
2135
}

src/views/index.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<div class="container">
3-
<van-cell-group inset>
4-
<van-cell center title="暗黑模式">
3+
<van-cell-group title="Do more difficult things" inset>
4+
<van-cell center title="🌗 暗黑模式">
55
<template #right-icon>
66
<van-switch v-model="checked" size="18px" />
77
</template>
88
</van-cell>
99

10-
<van-cell title="mock 指南" to="mock" is-link />
10+
<van-cell title="💿 mock 指南" to="mock" is-link />
1111

1212
<van-cell center>
1313
<template #title>
14-
<span class="custom-title">小游戏</span>
14+
<span class="custom-title">🎨 小游戏</span>
1515
<van-tag type="primary">敬请期待</van-tag>
1616
</template>
1717
</van-cell>
@@ -50,7 +50,6 @@ watch(checked,() => {
5050
height: 100vh;
5151
padding-top: 80px;
5252
position: relative;
53-
// background: #eff2f5;
5453
5554
.custom-title {
5655
margin-right: 4px;

src/views/mock/index.vue

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,73 @@
11
<template>
2-
<van-nav-bar title="mock 指南" left-arrow @click-left="onClickLeft"/>
2+
<van-nav-bar title="💿 mock 指南" left-arrow @click-left="onClickLeft"/>
3+
34
<div class="container">
4-
<span style="margin-bottom: 10px;">这是请求的数据</span>
5-
<span>{{ projects.dataSource.name }}</span>
5+
<div class="data-label"> 来自异步请求的数据 </div>
6+
<div class="data-content">
7+
<div v-if="messages">{{ messages }}</div>
8+
<van-empty v-else description="暂无数据" />
9+
</div>
10+
11+
<van-button round block type="primary" @click="pull">请求</van-button>
12+
<van-button round block type="default" @click="reset">清空</van-button>
613
</div>
714
</template>
815

916
<script setup lang="ts">
10-
import { useFetchData } from '@/utils/hooks/useFetchData'
11-
import { queryProjectNotice } from '@/api'
17+
import { ref } from 'vue'
18+
import { queryProse } from '@/api'
1219
13-
const onClickLeft = () => history.back()
20+
const messages = ref<string>('')
1421
15-
const { context: projects } = useFetchData(() => {
16-
return queryProjectNotice().then(res => {
17-
return {
18-
data: res
19-
}
22+
const pull = () => {
23+
queryProse().then(res => {
24+
messages.value = res.prose
2025
})
21-
})
26+
}
27+
28+
// reset data
29+
const reset = () => messages.value = ''
30+
31+
// back
32+
const onClickLeft = () => history.back()
2233
2334
</script>
2435

2536
<style lang="less" scoped>
2637
.container {
2738
width: 100vw;
2839
height: 100vh;
29-
display: flex;
30-
flex-direction: column;
31-
align-items: center;
32-
justify-content: center;
33-
position: relative;
40+
overflow: hidden;
41+
padding: 30px;
42+
43+
.data-label {
44+
color: #969799;
45+
font-weight: 400;
46+
font-size: 14px;
47+
line-height: 16px;
48+
}
49+
50+
.data-content {
51+
height: 300px;
52+
padding: 20px;
53+
line-height: 30px;
54+
background: #fff;
55+
margin-top: 20px;
56+
border-radius: 15px;
57+
display: flex;
58+
align-items: center;
59+
justify-content: center;
60+
}
61+
}
62+
63+
[data-theme='dark'] {
64+
.data-content {
65+
background: #222;
66+
color: #fff;
67+
}
68+
}
69+
70+
.van-button--block {
71+
margin-top: 15px;
3472
}
3573
</style>

0 commit comments

Comments
 (0)