-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from j10ccc/feat-lostfound
feat(lostfound): 添加失物招领模块
- Loading branch information
Showing
35 changed files
with
1,054 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/components/FixedQuickView/InformationQuickView/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<view class="information quick-view-container" @tap="handleClick"> | ||
<view class="header"> | ||
<view class="title">公告栏</view> | ||
</view> | ||
<view v-if="currentPost" class="content"> | ||
<text> {{ currentPost.content.slice(0, 60) }}</text> | ||
</view> | ||
<view v-else :class="['quick-view-container', 'empty']"> | ||
<text> 暂时公告信息 </text> | ||
</view> | ||
</view> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from "vue"; | ||
import Taro from "@tarojs/taro"; | ||
import { serviceStore } from "@/store"; | ||
const handleClick = () => { | ||
if (currentPost.value.type === "announcement") { | ||
Taro.navigateTo({ | ||
url: "/pages/announcement/index?tab=announcement", | ||
}); | ||
} else { | ||
Taro.navigateTo({ | ||
url: "/pages/announcement/index?tab=information", | ||
}); | ||
} | ||
}; | ||
const currentPost = ref<{ type: string; content: string }>({ | ||
type: "announcement", | ||
content: serviceStore.announcement.announcements[ | ||
serviceStore.announcement.announcements.length - 1 || 0 | ||
].content.replace(/\\n/g, "\n"), | ||
}); | ||
</script> |
56 changes: 56 additions & 0 deletions
56
src/components/FixedQuickView/LostfoundQuickView/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<template> | ||
<view class="quick-view-container" @tap="handleClick"> | ||
<view class="header"> | ||
<view class="title">失物寻物</view> | ||
</view> | ||
<view v-if="randomContent" class="content"> | ||
<text> {{ randomContent }}</text> | ||
</view> | ||
<view v-else :class="['content', 'empty']"> | ||
<text class="campus">{{ defaultCampus }} </text> | ||
<text> 校区暂时没有失物寻物信息 </text> | ||
</view> | ||
</view> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { useRequest } from "@/hooks"; | ||
import { LostfoundService } from "@/services"; | ||
import { computed, watch } from "vue"; | ||
import Taro from "@tarojs/taro"; | ||
import { serviceStore } from "@/store"; | ||
const defaultCampus = computed(() => { | ||
return serviceStore.lostfound.lastOpenCampus; | ||
}); | ||
watch([defaultCampus], ([newValue]) => { | ||
getRecords({ | ||
campus: newValue, | ||
page_num: 1, | ||
page_size: 5, | ||
}); | ||
}); | ||
const { data, run: getRecords } = useRequest(LostfoundService.getRecords, { | ||
defaultParams: { | ||
campus: defaultCampus.value, | ||
page_num: 1, | ||
page_size: 5, | ||
}, | ||
}); | ||
const handleClick = () => { | ||
Taro.navigateTo({ | ||
url: "/pages/lostfound/index", | ||
}); | ||
}; | ||
const randomContent = computed(() => { | ||
const list = data.value?.data.data; | ||
const realLength = list?.length || 0; | ||
return list?.length | ||
? list[Math.floor(Math.random() * realLength)].content | ||
: ""; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@import "@/style/theme"; | ||
|
||
.fixed-quick-view-container { | ||
border-radius: 8Px; | ||
@include shadow; | ||
padding: 0 20Px; | ||
background-color: var(--wjh-color-white); | ||
opacity: 95%; | ||
} | ||
|
||
.quick-view-container { | ||
.header { | ||
padding: 12Px 0 8Px 0; | ||
border-bottom: 2Px solid var(--wjh-color-border); | ||
text-align: center; | ||
|
||
.title { | ||
font-size: 1.1rem; | ||
} | ||
} | ||
|
||
.content { | ||
padding: 8Px 0 16Px 0; | ||
} | ||
|
||
.empty { | ||
padding-top: 16Px; | ||
text-align: center; | ||
|
||
.campus { | ||
color: var(--wjh-color-cyan); | ||
} | ||
} | ||
|
||
} | ||
|
||
.quick-view-container:not(:last-child) { | ||
border-bottom: 6Px solid var(--wjh-color-cyan-light); | ||
} | ||
|
||
.information { | ||
.content text { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
display: -webkit-box; | ||
-webkit-box-orient: vertical; | ||
-webkit-line-clamp: 3; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script setup lang="ts"> | ||
import LostfoundQuickView from "./LostfoundQuickView/index.vue"; | ||
import InformationQuickView from "./InformationQuickView/index.vue"; | ||
import "./index.scss"; | ||
</script> | ||
|
||
<template> | ||
<view class="fixed-quick-view-container"> | ||
<information-quick-view /> | ||
<lostfound-quick-view /> | ||
</view> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@import "@/style/theme"; | ||
|
||
.container { | ||
background-color: var(--wjh-color-white); | ||
padding: 16Px; | ||
display: flex; | ||
gap: .8rem; | ||
flex-direction: column; | ||
} | ||
|
||
.line:first-child { | ||
width: 40%; | ||
margin-bottom: .5rem; | ||
} | ||
|
||
.line:last-child { | ||
width: 60%; | ||
} | ||
|
||
.line { | ||
background-image: linear-gradient(90deg, #00000022 25%, #00000011 37%, #00000022 63%); | ||
width: 100%; | ||
height: 1.1rem; | ||
border-radius: 4Px; | ||
background-size: 400% 100%; | ||
background-position: 100% 50%; | ||
animation: skeleton-loading 1.4s ease infinite; | ||
} | ||
|
||
@keyframes skeleton-loading { | ||
0% { | ||
background-position: 100% 50%; | ||
} | ||
|
||
100% { | ||
background-position: 0 50%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup lang="ts"> | ||
import { CSSProperties } from "vue"; | ||
import styles from "./index.module.scss"; | ||
const props = defineProps<{ | ||
row?: number; | ||
style?: CSSProperties; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<view :class="styles.container" :style="props.style"> | ||
<view | ||
v-for="(_, index) in row || 5" | ||
:key="index" | ||
:class="styles.line" | ||
/> | ||
</view> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.