refactor pages struct
This commit is contained in:
9
miniprogram/pages/main/tabs/about/index.json
Normal file
9
miniprogram/pages/main/tabs/about/index.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"snowflake": "/components/background/snowflake"
|
||||
}
|
||||
}
|
||||
106
miniprogram/pages/main/tabs/about/index.less
Normal file
106
miniprogram/pages/main/tabs/about/index.less
Normal file
@@ -0,0 +1,106 @@
|
||||
/* pages/info/info.less */
|
||||
page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.info {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
padding: 100rpx 0;
|
||||
box-sizing: border-box;
|
||||
flex-direction: column;
|
||||
|
||||
.cotainer {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
|
||||
.logo {
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
display: block;
|
||||
border-radius: 4px;
|
||||
box-shadow: 2px 2px 8px var(--theme-shadow-medium);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin: 0 .5rem;
|
||||
display: inline-block;
|
||||
|
||||
&.gao {
|
||||
color: var(--theme-brand-gao);
|
||||
}
|
||||
|
||||
&.yeyu {
|
||||
color: var(--theme-brand-yeyu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.text {
|
||||
color: var(--theme-text-secondary);
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
|
||||
.love {
|
||||
color: transparent;
|
||||
font-size: 1.25rem;
|
||||
animation: loveGradient 1000ms linear infinite;
|
||||
text-align: center;
|
||||
background: linear-gradient(90deg, var(--theme-brand-gao-light), var(--theme-brand-gao), var(--theme-brand-gao-dark), var(--theme-brand-gao), var(--theme-brand-gao-light));
|
||||
font-weight: bold;
|
||||
font-family: "Arial", sans-serif;
|
||||
margin-bottom: 1rem;
|
||||
background-size: 200% 100%;
|
||||
background-clip: text;
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
@keyframes loveGradient {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 200% 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
.exit {
|
||||
color: var(--theme-error);
|
||||
width: 10rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.item {
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
|
||||
.label {
|
||||
color: var(--theme-text-secondary);
|
||||
}
|
||||
|
||||
&.copyright {
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
miniprogram/pages/main/tabs/about/index.ts
Normal file
64
miniprogram/pages/main/tabs/about/index.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
// pages/info/info.ts
|
||||
|
||||
import Time from "../../../../utils/Time";
|
||||
import config from "../../../../config/index"
|
||||
|
||||
interface IAboutData {
|
||||
timer?: number;
|
||||
total?: number;
|
||||
beginFriendText: string;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <IAboutData>{
|
||||
copyright: `Copyright © 2017 - ${new Date().getFullYear()} imyeyu.com`,
|
||||
timer: undefined,
|
||||
total: undefined,
|
||||
beginFriendText: "相识 -- 天 -- 小时 -- 分钟 -- 秒",
|
||||
beginLoveText: "相恋 -- 天 -- 小时 -- 分钟 -- 秒"
|
||||
},
|
||||
onShow() {
|
||||
const beginLove = new Date("2025/11/10 00:10:00");
|
||||
const beginFriend = new Date("2025/06/28 16:00:00");
|
||||
|
||||
const timer = setInterval(() => {
|
||||
{
|
||||
const r = Time.between(beginLove)
|
||||
this.setData({
|
||||
beginLoveText: `相恋 ${r.d} 天 ${r.h} 小时 ${r.m.toString().padStart(2, "0")} 分钟 ${r.s.toString().padStart(2, "0")} 秒`
|
||||
})
|
||||
}
|
||||
{
|
||||
const r = Time.between(beginFriend)
|
||||
this.setData({
|
||||
beginFriendText: `相识 ${r.d} 天 ${r.h} 小时 ${r.m.toString().padStart(2, "0")} 分钟 ${r.s.toString().padStart(2, "0")} 秒`
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
this.setData({
|
||||
timer
|
||||
});
|
||||
|
||||
|
||||
wx.request({
|
||||
url: `${config.url}/journal/total`,
|
||||
method: "GET",
|
||||
header: {
|
||||
Key: wx.getStorageSync("key")
|
||||
},
|
||||
success: (resp: any) => {
|
||||
this.setData({
|
||||
total: resp.data.data
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onHide() {
|
||||
this.data.timer && clearInterval(this.data.timer);
|
||||
},
|
||||
exit() {
|
||||
wx.redirectTo({
|
||||
"url": "/pages/index/index?from=info"
|
||||
})
|
||||
}
|
||||
})
|
||||
37
miniprogram/pages/main/tabs/about/index.wxml
Normal file
37
miniprogram/pages/main/tabs/about/index.wxml
Normal file
@@ -0,0 +1,37 @@
|
||||
<!--pages/info/info.wxml-->
|
||||
<snowflake />
|
||||
<t-navbar title="关于我们" placeholder />
|
||||
<scroll-view class="info" scroll-y>
|
||||
<view class="cotainer">
|
||||
<view class="header">
|
||||
<image class="logo" src="/assets/image/logo.png"></image>
|
||||
<view>
|
||||
<text>记录</text>
|
||||
<text class="name gao">小糕</text>
|
||||
<text>和</text>
|
||||
<text class="name yeyu">夜雨</text>
|
||||
<text>的美好回忆</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="love">{{beginLoveText}}</view>
|
||||
<view>{{beginFriendText}}</view>
|
||||
<view wx:if="{{total}}">已留住 {{total}} 个我们的瞬间</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
<t-button class="exit" bind:tap="exit">退出</t-button>
|
||||
<view class="item">
|
||||
<text class="label">开发者:</text>
|
||||
<text>夜雨</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="label">版本:</text>
|
||||
<text>1.6.6</text>
|
||||
</view>
|
||||
<view class="item copyright">
|
||||
<text>{{copyright}}</text>
|
||||
<text>All Rights Reserved 夜雨 版权所有</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
12
miniprogram/pages/main/tabs/journal/index.json
Normal file
12
miniprogram/pages/main/tabs/journal/index.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-indexes": "tdesign-miniprogram/indexes/indexes",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
|
||||
"t-indexes-anchor": "tdesign-miniprogram/indexes-anchor/indexes-anchor"
|
||||
},
|
||||
"styleIsolation": "shared"
|
||||
}
|
||||
130
miniprogram/pages/main/tabs/journal/index.less
Normal file
130
miniprogram/pages/main/tabs/journal/index.less
Normal file
@@ -0,0 +1,130 @@
|
||||
.more-menu {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
position: fixed;
|
||||
background: var(--theme-bg-overlay);
|
||||
|
||||
.content {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
background: var(--theme-bg-menu);
|
||||
box-shadow: 0 0 12px var(--theme-shadow-medium);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.journal-list {
|
||||
width: 100vw;
|
||||
|
||||
.content {
|
||||
|
||||
.date {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.text,
|
||||
.items {
|
||||
position: relative;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
> .text {
|
||||
color: var(--theme-text-primary);
|
||||
width: calc(100% - 32px - 2rem);
|
||||
padding: 8px 16px;
|
||||
margin: .5rem 1rem 1rem 1rem;
|
||||
position: relative;
|
||||
background: var(--theme-bg-journal);
|
||||
box-shadow: 0 2px 10px var(--theme-shadow-medium);
|
||||
border-radius: 2px;
|
||||
|
||||
// 纸张纹理效果
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background:
|
||||
linear-gradient(90deg,
|
||||
var(--theme-texture-light) 0%,
|
||||
var(--theme-texture-bright) 50%,
|
||||
var(--theme-texture-light) 100%),
|
||||
linear-gradient(var(--theme-texture-line) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--theme-texture-line) 1px, transparent 1px);
|
||||
pointer-events: none;
|
||||
background-size: 100% 100%, 10px 10px, 10px 10px;
|
||||
}
|
||||
|
||||
.location {
|
||||
gap: 6rpx;
|
||||
display: flex;
|
||||
margin-top: 16rpx;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
|
||||
.icon {
|
||||
color: var(--theme-wx);
|
||||
}
|
||||
|
||||
.text {
|
||||
color: var(--theme-text-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.items {
|
||||
gap: .25rem;
|
||||
display: flex;
|
||||
padding-bottom: 2rem;
|
||||
align-items: flex-start;
|
||||
|
||||
.column {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.item {
|
||||
overflow: hidden;
|
||||
background: var(--theme-bg-card);
|
||||
margin-bottom: .25rem;
|
||||
|
||||
&.thumbnail {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&.video {
|
||||
height: auto;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
top: 50%;
|
||||
left: 53%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
transform: translate(-50%, -50%);
|
||||
border-top: 16px solid transparent;
|
||||
border-left: 24px solid var(--theme-video-play);
|
||||
border-bottom: 16px solid transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.start {
|
||||
color: var(--theme-text-secondary);
|
||||
padding: 1rem 0;
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
244
miniprogram/pages/main/tabs/journal/index.ts
Normal file
244
miniprogram/pages/main/tabs/journal/index.ts
Normal file
@@ -0,0 +1,244 @@
|
||||
// pages/journal/index.ts
|
||||
|
||||
import Time from "../../../../utils/Time";
|
||||
import config from "../../../../config/index"
|
||||
import Events from "../../../../utils/Events";
|
||||
import Toolkit from "../../../../utils/Toolkit";
|
||||
import { Journal, JournalPage, JournalPageType } from "../../../../types/Journal";
|
||||
import { OrderType } from "../../../../types/Model";
|
||||
import { PreviewImageMetadata } from "../../../../types/Attachment";
|
||||
import { MediaItem, MediaItemType } from "../../../../types/UI";
|
||||
import { JournalApi } from "../../../../api/JournalApi";
|
||||
|
||||
interface JournalData {
|
||||
page: JournalPage;
|
||||
list: Journal[];
|
||||
dateFilterMin: number;
|
||||
dateFilterMax: number;
|
||||
dateFilterAllows: number[];
|
||||
dateFilterVisible: boolean;
|
||||
isFetching: boolean;
|
||||
isFinished: boolean;
|
||||
stickyOffset: number;
|
||||
isShowMoreMenu: boolean;
|
||||
menuTop: number;
|
||||
menuLeft: number;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <JournalData>{
|
||||
page: {
|
||||
index: 0,
|
||||
size: 8,
|
||||
type: JournalPageType.NORMAL,
|
||||
likeMap: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
dateFilterMin: new Date("2025/06/28 16:00:00").getTime(),
|
||||
dateFilterMax: new Date(2026, 1, 15).getTime(),
|
||||
dateFilterAllows: [
|
||||
new Date(2025, 11, 15).getTime(),
|
||||
new Date(2025, 11, 20).getTime(),
|
||||
new Date(2025, 11, 10).getTime(),
|
||||
],
|
||||
dateFilterVisible: false,
|
||||
isFetching: false,
|
||||
isFinished: false,
|
||||
stickyOffset: 0,
|
||||
isShowMoreMenu: false,
|
||||
menuTop: 0,
|
||||
menuLeft: 0
|
||||
},
|
||||
onLoad() {
|
||||
Events.reset("JOURNAL_REFRESH", () => {
|
||||
this.setData({
|
||||
page: {
|
||||
index: 0,
|
||||
size: 8,
|
||||
type: JournalPageType.NORMAL,
|
||||
equalsExample: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
isFetching: false,
|
||||
isFinished: false
|
||||
});
|
||||
this.fetch();
|
||||
});
|
||||
this.setData({
|
||||
list: []
|
||||
})
|
||||
this.fetch();
|
||||
},
|
||||
onReady() {
|
||||
this.getCustomNavbarHeight();
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowMoreMenu: false
|
||||
})
|
||||
},
|
||||
onReachBottom() {
|
||||
this.fetch();
|
||||
},
|
||||
getCustomNavbarHeight() {
|
||||
const query = wx.createSelectorQuery();
|
||||
query.select(".custom-navbar").boundingClientRect();
|
||||
query.exec((res) => {
|
||||
const { height = 0 } = res[0] || {};
|
||||
this.setData({ stickyOffset: height });
|
||||
});
|
||||
},
|
||||
toggleMoreMenu() {
|
||||
if (!this.data.isShowMoreMenu) {
|
||||
// 打开菜单时计算位置
|
||||
const query = wx.createSelectorQuery();
|
||||
query.select(".more").boundingClientRect();
|
||||
query.exec((res) => {
|
||||
if (res[0]) {
|
||||
const { top, left, height } = res[0];
|
||||
this.setData({
|
||||
isShowMoreMenu: true,
|
||||
menuTop: top + height + 16, // 按钮下方 8px
|
||||
menuLeft: left
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 关闭菜单
|
||||
this.setData({
|
||||
isShowMoreMenu: false
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 阻止事件冒泡 */
|
||||
stopPropagation() {
|
||||
// 空函数,仅用于阻止事件冒泡
|
||||
},
|
||||
toCreater() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/main/journal/editor/index?from=journal"
|
||||
})
|
||||
},
|
||||
toSearch() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/main/journal/search/index"
|
||||
})
|
||||
},
|
||||
toMap() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/main/journal/map/index"
|
||||
})
|
||||
},
|
||||
toDate() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/main/journal/date/index"
|
||||
})
|
||||
},
|
||||
async fetch() {
|
||||
if (this.data.isFetching || this.data.isFinished) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
isFetching: true
|
||||
});
|
||||
try {
|
||||
const pageResult = await JournalApi.getList(this.data.page);
|
||||
const list = pageResult.list;
|
||||
if (!list || list.length === 0) {
|
||||
this.setData({
|
||||
isFinished: true,
|
||||
isFetching: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
list.forEach(journal => {
|
||||
const mediaItems = journal.items!.filter((item) => item.attachType === "THUMB").map((thumbItem, index) => {
|
||||
const metadata = (typeof thumbItem.metadata === "string" ? JSON.parse(thumbItem.metadata) : thumbItem.metadata) as PreviewImageMetadata;
|
||||
const thumbURL = `${config.url}/attachment/read/${thumbItem.mongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${metadata.sourceMongoId}`;
|
||||
const isVideo = metadata.sourceMimeType?.startsWith("video/");
|
||||
return {
|
||||
type: isVideo ? MediaItemType.VIDEO : MediaItemType.IMAGE,
|
||||
thumbURL,
|
||||
sourceURL,
|
||||
size: thumbItem.size || 0,
|
||||
attachmentId: thumbItem.id,
|
||||
width: metadata.width,
|
||||
height: metadata.height,
|
||||
originalIndex: index
|
||||
} as MediaItem;
|
||||
});
|
||||
journal.date = Time.toDate(journal.createdAt);
|
||||
journal.time = Time.toTime(journal.createdAt);
|
||||
journal.datetime = Time.toPassedDateTime(journal.createdAt);
|
||||
journal.mediaItems = mediaItems;
|
||||
journal.columnedItems = Toolkit.splitItemsIntoColumns(mediaItems, 3, (item) => {
|
||||
if (item.width && item.height && 0 < item.width) {
|
||||
return item.height / item.width;
|
||||
}
|
||||
return 1;
|
||||
})
|
||||
});
|
||||
this.setData({
|
||||
page: {
|
||||
index: this.data.page.index + 1,
|
||||
size: 8,
|
||||
type: JournalPageType.NORMAL,
|
||||
equalsExample: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: this.data.list.concat(list),
|
||||
isFinished: list.length < this.data.page.size,
|
||||
isFetching: false
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("加载日记失败:", error);
|
||||
this.setData({ isFetching: false });
|
||||
}
|
||||
},
|
||||
preview(e: WechatMiniprogram.BaseEvent) {
|
||||
const { journalIndex, itemIndex } = e.currentTarget.dataset;
|
||||
const journal = this.data.list[journalIndex];
|
||||
const items = journal.mediaItems!;
|
||||
const total = items.length;
|
||||
|
||||
const startIndex = Math.max(0, itemIndex - 25);
|
||||
const endIndex = Math.min(total, startIndex + 50);
|
||||
const newCurrentIndex = itemIndex - startIndex;
|
||||
|
||||
const sources = items.slice(startIndex, endIndex).map((item) => {
|
||||
return {
|
||||
url: item.sourceURL,
|
||||
type: item.type === MediaItemType.IMAGE ? "image" : "video"
|
||||
}
|
||||
}) as any;
|
||||
wx.previewMedia({
|
||||
current: newCurrentIndex,
|
||||
sources
|
||||
})
|
||||
},
|
||||
openLocation(e: WechatMiniprogram.BaseEvent) {
|
||||
const { journalIndex } = e.currentTarget.dataset;
|
||||
const journal = this.data.list[journalIndex] as Journal;
|
||||
if (journal.lat && journal.lng) {
|
||||
wx.openLocation({
|
||||
latitude: journal.lat,
|
||||
longitude: journal.lng,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
56
miniprogram/pages/main/tabs/journal/index.wxml
Normal file
56
miniprogram/pages/main/tabs/journal/index.wxml
Normal file
@@ -0,0 +1,56 @@
|
||||
<view class="custom-navbar">
|
||||
<t-navbar title="我们的记录" placeholder>
|
||||
<view slot="left" class="more" bind:tap="toggleMoreMenu">
|
||||
<t-icon name="view-list" size="24px" />
|
||||
</view>
|
||||
</t-navbar>
|
||||
</view>
|
||||
<view wx:if="{{isShowMoreMenu}}" class="more-menu" catchtap="toggleMoreMenu">
|
||||
<t-cell-group
|
||||
class="content"
|
||||
theme="card"
|
||||
style="top: {{menuTop}}px; left: {{menuLeft}}px;"
|
||||
catchtap="stopPropagation"
|
||||
>
|
||||
<t-cell title="新纪录" leftIcon="add" bind:tap="toCreater" />
|
||||
<t-cell title="按列表查找" leftIcon="view-list" bind:tap="toSearch" />
|
||||
<t-cell title="按日期查找" leftIcon="calendar-1" bind:tap="toDate" />
|
||||
<t-cell title="按地图查找" leftIcon="location" bind:tap="toMap" />
|
||||
</t-cell-group>
|
||||
</view>
|
||||
<t-indexes
|
||||
class="journal-list"
|
||||
bind:scroll="onScroll"
|
||||
sticky-offset="{{stickyOffset}}"
|
||||
>
|
||||
<view class="content" wx:for="{{list}}" wx:for-item="journal" wx:for-index="journalIndex" wx:key="index">
|
||||
<t-indexes-anchor class="date" index="{{journal.datetime}}" />
|
||||
<view wx:if="{{journal.idea || journal.location}}" class="text">
|
||||
<text class="idea">{{journal.idea}}</text>
|
||||
<view
|
||||
wx:if="{{journal.location}}"
|
||||
class="location"
|
||||
bind:tap="openLocation"
|
||||
data-journal-index="{{journalIndex}}"
|
||||
>
|
||||
<t-icon class="icon" name="location-filled" />
|
||||
<text class="text">{{journal.location}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{journal.columnedItems}}" class="items">
|
||||
<view wx:for="{{journal.columnedItems}}" wx:for-item="column" wx:for-index="columnIndex" wx:key="columnIndex" class="column">
|
||||
<block wx:for="{{column}}" wx:for-item="item" wx:for-index="itemIndex" wx:key="attachmentId">
|
||||
<image
|
||||
class="item thumbnail {{item.type}}"
|
||||
src="{{item.thumbURL}}"
|
||||
mode="widthFix"
|
||||
bindtap="preview"
|
||||
data-item-index="{{item.originalIndex}}"
|
||||
data-journal-index="{{journalIndex}}"
|
||||
></image>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{isFinished}}" class="start">已回到最初的起点</view>
|
||||
</t-indexes>
|
||||
14
miniprogram/pages/main/tabs/moment/index.json
Normal file
14
miniprogram/pages/main/tabs/moment/index.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-popup": "tdesign-miniprogram/popup/popup",
|
||||
"t-radio": "tdesign-miniprogram/radio/radio",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group",
|
||||
"journal-list": "/components/journal-list/index",
|
||||
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
|
||||
},
|
||||
"styleIsolation": "shared"
|
||||
}
|
||||
190
miniprogram/pages/main/tabs/moment/index.less
Normal file
190
miniprogram/pages/main/tabs/moment/index.less
Normal file
@@ -0,0 +1,190 @@
|
||||
/* pages/main/moment/index.wxss */
|
||||
.moment {
|
||||
|
||||
.tips {
|
||||
padding: 4px 12px;
|
||||
font-size: .8rem;
|
||||
text-align: justify;
|
||||
text-indent: 2em;
|
||||
}
|
||||
|
||||
.action {
|
||||
padding: 8px 12px;
|
||||
|
||||
.line {
|
||||
display: flex;
|
||||
margin-bottom: .5rem;
|
||||
justify-content: space-between;
|
||||
|
||||
.btn {
|
||||
width: 50%;
|
||||
margin-right: 1rem;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.uploading {
|
||||
padding: 4px 12px;
|
||||
margin-bottom: 12rpx;
|
||||
|
||||
.progress {
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
color: var(--theme-text-secondary);
|
||||
display: flex;
|
||||
font-size: .8rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
|
||||
.items {
|
||||
column-gap: .25rem;
|
||||
column-count: 4;
|
||||
padding-bottom: 2rem;
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
|
||||
.thumbnail {
|
||||
width: 100%;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
background: var(--theme-bg-card);
|
||||
break-inside: avoid;
|
||||
margin-bottom: .25rem;
|
||||
|
||||
&.video {
|
||||
height: auto;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
top: 50%;
|
||||
left: 53%;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
transform: translate(-50%, -50%);
|
||||
border-top: 16px solid transparent;
|
||||
border-left: 24px solid var(--theme-video-play);
|
||||
border-bottom: 16px solid transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox {
|
||||
top: 0;
|
||||
right: 0;
|
||||
padding: 16rpx 0 16rpx 16rpx;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.checkbox-fill {
|
||||
top: 24rpx;
|
||||
right: 26rpx;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
background: var(--theme-bg-card);
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.t-popup--bottom {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.archive-popup {
|
||||
|
||||
.container {
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
background: var(--td-bg-color-container);
|
||||
flex-direction: column;
|
||||
border-top-left-radius: 16rpx;
|
||||
border-top-right-radius: 16rpx;
|
||||
|
||||
&.select-journal {
|
||||
height: 80vh;
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.form {
|
||||
padding-bottom: 32rpx;
|
||||
|
||||
.content {
|
||||
padding: 16rpx 32rpx;
|
||||
|
||||
.section {
|
||||
width: 100%;
|
||||
margin-top: 1.5rem;
|
||||
|
||||
.label {
|
||||
color: var(--theme-text-secondary);
|
||||
}
|
||||
|
||||
&.type {
|
||||
display: flex;
|
||||
|
||||
.radio {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&.time {
|
||||
display: flex;
|
||||
|
||||
.picker {
|
||||
margin-right: .25rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 116rpx;
|
||||
border-bottom: 1px solid var(--td-component-stroke);
|
||||
|
||||
.title {
|
||||
flex: 1;
|
||||
color: var(--td-text-color-primary);
|
||||
font-size: 36rpx;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
width: 128rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin: 0 .5rem;
|
||||
|
||||
&.back,
|
||||
&.cancel {
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
462
miniprogram/pages/main/tabs/moment/index.ts
Normal file
462
miniprogram/pages/main/tabs/moment/index.ts
Normal file
@@ -0,0 +1,462 @@
|
||||
// pages/main/moment/index.ts
|
||||
import config from "../../../../config/index";
|
||||
import Events from "../../../../utils/Events";
|
||||
import IOSize, { Unit } from "../../../../utils/IOSize";
|
||||
import Time from "../../../../utils/Time";
|
||||
import Toolkit from "../../../../utils/Toolkit";
|
||||
import { Location, MediaItemType } from "../../../../types/UI";
|
||||
import { PreviewImageMetadata } from "../../../../types/Attachment";
|
||||
import { MomentApi } from "../../../../api/MomentApi";
|
||||
import { JournalApi } from "../../../../api/JournalApi";
|
||||
import { Network } from "../../../../utils/Network";
|
||||
|
||||
type Item = {
|
||||
id: number;
|
||||
type: MediaItemType;
|
||||
thumbURL: string;
|
||||
sourceURL: string;
|
||||
checked: boolean;
|
||||
}
|
||||
|
||||
type MD5Result = {
|
||||
path: string;
|
||||
md5: string;
|
||||
}
|
||||
|
||||
type ArchiveStep = "select-type" | "select-journal" | "form";
|
||||
|
||||
interface MomentData {
|
||||
list: Item[];
|
||||
type: string;
|
||||
idea: string;
|
||||
date: string;
|
||||
time: string;
|
||||
location?: Location;
|
||||
qqMapSDK?: any;
|
||||
uploaded: string;
|
||||
hasChecked: boolean;
|
||||
isUploading: boolean;
|
||||
isArchiving: boolean;
|
||||
uploadSpeed: string;
|
||||
uploadTotal: string;
|
||||
uploadProgress: number;
|
||||
isAuthLocation: boolean;
|
||||
isVisibleArchivePopup: boolean;
|
||||
archiveStep: ArchiveStep;
|
||||
selectedJournalId: number | null;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <MomentData>{
|
||||
list: [],
|
||||
type: "NORMAL",
|
||||
idea: "",
|
||||
date: "2025-06-28",
|
||||
time: "16:00",
|
||||
location: undefined,
|
||||
uploaded: "0",
|
||||
hasChecked: false,
|
||||
isUploading: false,
|
||||
isArchiving: false,
|
||||
uploadSpeed: "0 MB / s",
|
||||
uploadTotal: "0 MB",
|
||||
uploadProgress: 0,
|
||||
isAuthLocation: false,
|
||||
isVisibleArchivePopup: false,
|
||||
archiveStep: "select-type",
|
||||
selectedJournalId: null
|
||||
},
|
||||
async onLoad() {
|
||||
this.fetch();
|
||||
|
||||
// 授权定位
|
||||
const setting = await wx.getSetting();
|
||||
wx.setStorageSync("isAuthLocation", setting.authSetting["scope.userLocation"] || false);
|
||||
let isAuthLocation = JSON.parse(wx.getStorageSync("isAuthLocation"));
|
||||
this.setData({ isAuthLocation });
|
||||
if (!isAuthLocation) {
|
||||
wx.authorize({
|
||||
scope: "scope.userLocation"
|
||||
}).then(() => {
|
||||
isAuthLocation = true;
|
||||
this.setData({ isAuthLocation });
|
||||
});
|
||||
}
|
||||
const unixTime = new Date().getTime();
|
||||
this.setData({
|
||||
idea: this.data.idea,
|
||||
date: Time.toDate(unixTime),
|
||||
time: Time.toTime(unixTime)
|
||||
});
|
||||
// 获取默认定位
|
||||
wx.getLocation({
|
||||
type: "gcj02"
|
||||
}).then(resp => {
|
||||
this.setData({
|
||||
location: {
|
||||
lat: resp.latitude,
|
||||
lng: resp.longitude
|
||||
},
|
||||
});
|
||||
const argLoc = `location=${this.data.location!.lat},${this.data.location!.lng}`;
|
||||
const argKey = "key=WW5BZ-J4LCM-UIT6I-65MXY-Z5HDT-VRFFU";
|
||||
wx.request({
|
||||
url: `https://apis.map.qq.com/ws/geocoder/v1/?${argLoc}&${argKey}`,
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
this.setData({
|
||||
location: {
|
||||
lat: this.data.location!.lat,
|
||||
lng: this.data.location!.lng,
|
||||
text: (res.data as any).result?.formatted_addresses?.recommend
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
async chooseLocation() {
|
||||
const location = await wx.chooseLocation({});
|
||||
this.setData({
|
||||
location: {
|
||||
lat: location.latitude,
|
||||
lng: location.longitude,
|
||||
text: location.name
|
||||
}
|
||||
});
|
||||
},
|
||||
async fetch() {
|
||||
try {
|
||||
const list = await MomentApi.getList();
|
||||
if (!list || list.length === 0) {
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
list: list.map((item: any) => {
|
||||
const metadata = (typeof item.metadata === "string" ? JSON.parse(item.metadata) : item.metadata) as PreviewImageMetadata;
|
||||
const thumbURL = `${config.url}/attachment/read/${item.mongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${metadata.sourceMongoId}`;
|
||||
const isImage = metadata.sourceMimeType?.startsWith("image/");
|
||||
return {
|
||||
id: item.id,
|
||||
type: isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
thumbURL,
|
||||
sourceURL,
|
||||
checked: false
|
||||
} as Item;
|
||||
})
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("加载 moment 列表失败:", error);
|
||||
}
|
||||
},
|
||||
updateHasChecked() {
|
||||
this.setData({ hasChecked: this.data.list.some(item => item.checked) });
|
||||
},
|
||||
onCheckChange(e: WechatMiniprogram.BaseEvent) {
|
||||
const index = e.currentTarget.dataset.index;
|
||||
const list = [...this.data.list];
|
||||
list[index].checked = !list[index].checked;
|
||||
this.setData({ list });
|
||||
this.updateHasChecked();
|
||||
},
|
||||
preview(e: WechatMiniprogram.BaseEvent) {
|
||||
const index = e.currentTarget.dataset.index;
|
||||
const total = this.data.list.length;
|
||||
|
||||
const startIndex = Math.max(0, index - 25);
|
||||
const endIndex = Math.min(total, startIndex + 50);
|
||||
const newCurrentIndex = index - startIndex;
|
||||
|
||||
const sources = this.data.list.slice(startIndex, endIndex).map((item: Item) => {
|
||||
return {
|
||||
url: item.sourceURL,
|
||||
type: item.type.toLowerCase()
|
||||
}
|
||||
}) as any;
|
||||
wx.previewMedia({
|
||||
current: newCurrentIndex,
|
||||
sources
|
||||
})
|
||||
},
|
||||
uploadMedia() {
|
||||
const handleFail = (e?: any) => {
|
||||
wx.showToast({ title: "上传失败", icon: "error" });
|
||||
wx.hideLoading();
|
||||
this.setData({
|
||||
isUploading: false,
|
||||
});
|
||||
wx.reportEvent("wxdata_perf_monitor", {
|
||||
wxdata_perf_monitor_id: "MOMENT_UPLOAD",
|
||||
wxdata_perf_monitor_level: 9,
|
||||
wxdata_perf_error_code: 1,
|
||||
wxdata_perf_error_msg: e?.message
|
||||
});
|
||||
};
|
||||
const that = this;
|
||||
wx.chooseMedia({
|
||||
mediaType: ["mix"],
|
||||
sourceType: ["album", "camera"],
|
||||
camera: "back",
|
||||
async success(res) {
|
||||
that.setData({
|
||||
isUploading: true
|
||||
});
|
||||
wx.showLoading({
|
||||
title: "正在读取..",
|
||||
mask: true
|
||||
})
|
||||
let files = res.tempFiles;
|
||||
// 计算 MD5
|
||||
const md5Results: MD5Result[] = [];
|
||||
await Promise.all(files.map(async (file) => {
|
||||
const md5 = await new Promise((resolve, reject) => {
|
||||
wx.getFileSystemManager().getFileInfo({
|
||||
filePath: file.tempFilePath,
|
||||
digestAlgorithm: "md5",
|
||||
success: res => resolve(res.digest),
|
||||
fail: () => reject(`读取失败: ${file.tempFilePath}`)
|
||||
});
|
||||
});
|
||||
md5Results.push({
|
||||
path: file.tempFilePath,
|
||||
md5: md5,
|
||||
} as MD5Result);
|
||||
}));
|
||||
// 查重
|
||||
const filterMD5Result: string[] = await MomentApi.filterByMD5(
|
||||
md5Results.map(item => item.md5)
|
||||
);
|
||||
// 过滤文件
|
||||
const filterPath = md5Results.filter(item => filterMD5Result.indexOf(item.md5) !== -1)
|
||||
.map(item => item.path);
|
||||
files = files.filter(file => filterPath.indexOf(file.tempFilePath) !== -1);
|
||||
if (files.length === 0) {
|
||||
wx.hideLoading();
|
||||
that.setData({ isUploading: false });
|
||||
return;
|
||||
}
|
||||
|
||||
// 使用 Network.uploadFiles 上传文件
|
||||
try {
|
||||
const tempFileIds = await Network.uploadFiles({
|
||||
mediaList: files.map(file => ({
|
||||
path: file.tempFilePath,
|
||||
size: file.size
|
||||
})),
|
||||
onProgress: (progress) => {
|
||||
that.setData({
|
||||
uploaded: IOSize.formatWithoutUnit(progress.uploaded, 2, Unit.MB),
|
||||
uploadTotal: IOSize.format(progress.total, 2, Unit.MB),
|
||||
uploadSpeed: `${IOSize.format(progress.speed)} / s`,
|
||||
uploadProgress: progress.percent
|
||||
});
|
||||
},
|
||||
showLoading: true
|
||||
});
|
||||
|
||||
// 上传完成转附件
|
||||
const list = await MomentApi.create(tempFileIds);
|
||||
wx.showToast({ title: "上传成功", icon: "success" });
|
||||
const added = list.map((item: any) => {
|
||||
const metadata = (typeof item.metadata === "string" ? JSON.parse(item.metadata) : item.metadata) as PreviewImageMetadata;
|
||||
const thumbURL = `${config.url}/attachment/read/${item.mongoId}`;
|
||||
const sourceURL = `${config.url}/attachment/read/${metadata.sourceMongoId}`;
|
||||
const isImage = item.mimeType?.startsWith("image/");
|
||||
return {
|
||||
id: item.id,
|
||||
type: isImage ? MediaItemType.IMAGE : MediaItemType.VIDEO,
|
||||
thumbURL,
|
||||
sourceURL,
|
||||
checked: false
|
||||
} as Item;
|
||||
});
|
||||
// 前插列表
|
||||
that.data.list.unshift(...added);
|
||||
that.setData({
|
||||
list: that.data.list,
|
||||
isUploading: false,
|
||||
uploaded: "0",
|
||||
uploadTotal: "0 MB",
|
||||
uploadProgress: 0
|
||||
});
|
||||
that.updateHasChecked();
|
||||
} catch (error) {
|
||||
handleFail(error);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
showArchivePopup() {
|
||||
this.setData({
|
||||
isVisibleArchivePopup: true,
|
||||
archiveStep: "select-type",
|
||||
selectedJournalId: null
|
||||
});
|
||||
},
|
||||
onArchiveToNew() {
|
||||
this.setData({
|
||||
archiveStep: "form",
|
||||
selectedJournalId: null
|
||||
});
|
||||
},
|
||||
onArchiveToExisting() {
|
||||
this.setData({
|
||||
archiveStep: "select-journal",
|
||||
selectedJournalId: null
|
||||
});
|
||||
},
|
||||
onJournalListSelect(e: any) {
|
||||
const { id } = e.detail;
|
||||
this.setData({
|
||||
selectedJournalId: id
|
||||
});
|
||||
},
|
||||
onJournalListConfirm() {
|
||||
if (this.data.selectedJournalId) {
|
||||
this.archiveChecked();
|
||||
}
|
||||
},
|
||||
onJournalListCancel() {
|
||||
this.setData({
|
||||
archiveStep: "select-type",
|
||||
selectedJournalId: null
|
||||
});
|
||||
},
|
||||
onNewJournalBack() {
|
||||
this.setData({
|
||||
archiveStep: "select-type"
|
||||
});
|
||||
},
|
||||
toggleArchivePopup() {
|
||||
this.setData({
|
||||
isVisibleArchivePopup: !this.data.isVisibleArchivePopup
|
||||
});
|
||||
},
|
||||
onArchivePopupVisibleChange(e: any) {
|
||||
this.setData({
|
||||
isVisibleArchivePopup: e.detail.visible
|
||||
});
|
||||
},
|
||||
onChangeArchiveType(e: any) {
|
||||
const { value } = e.detail;
|
||||
this.setData({ type: value });
|
||||
},
|
||||
async archiveChecked() {
|
||||
const handleFail = () => {
|
||||
wx.showToast({ title: "归档失败", icon: "error" });
|
||||
wx.hideLoading();
|
||||
this.setData({
|
||||
isArchiving: false
|
||||
});
|
||||
};
|
||||
this.setData({
|
||||
isArchiving: true
|
||||
});
|
||||
wx.showLoading({
|
||||
title: "正在归档..",
|
||||
mask: true
|
||||
})
|
||||
const openId = await new Promise<string>((resolve, reject) => {
|
||||
wx.login({
|
||||
success: async (res) => {
|
||||
if (res.code) {
|
||||
try {
|
||||
const openId = await JournalApi.getOpenId(res.code);
|
||||
resolve(openId);
|
||||
} catch (error) {
|
||||
reject(new Error("获取 openId 失败"));
|
||||
}
|
||||
} else {
|
||||
reject(new Error("获取登录凭证失败"));
|
||||
}
|
||||
},
|
||||
fail: handleFail
|
||||
});
|
||||
});
|
||||
const archiveData: any = {
|
||||
type: this.data.type,
|
||||
idea: this.data.idea,
|
||||
lat: this.data.location?.lat,
|
||||
lng: this.data.location?.lng,
|
||||
location: this.data.location?.text,
|
||||
pusher: openId,
|
||||
thumbIds: this.data.list.filter(item => item.checked).map(item => item.id)
|
||||
};
|
||||
// 如果选择了已存在的记录,添加 id 参数
|
||||
if (this.data.selectedJournalId) {
|
||||
archiveData.id = this.data.selectedJournalId;
|
||||
}
|
||||
try {
|
||||
await MomentApi.archive(archiveData);
|
||||
Events.emit("JOURNAL_REFRESH");
|
||||
wx.showToast({ title: "归档成功", icon: "success" });
|
||||
this.setData({
|
||||
idea: "",
|
||||
list: [],
|
||||
hasChecked: false,
|
||||
isArchiving: false,
|
||||
selectedJournalId: undefined,
|
||||
isVisibleArchivePopup: false
|
||||
});
|
||||
await Toolkit.sleep(1000);
|
||||
this.fetch();
|
||||
} catch (error) {
|
||||
handleFail();
|
||||
}
|
||||
},
|
||||
allChecked() {
|
||||
this.data.list.forEach(item => item.checked = true);
|
||||
this.setData({
|
||||
list: this.data.list
|
||||
});
|
||||
this.updateHasChecked();
|
||||
},
|
||||
clearChecked() {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确认清空已选照片或视频吗?",
|
||||
confirmText: "清空已选",
|
||||
confirmColor: "#E64340",
|
||||
cancelText: "取消",
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
this.data.list.forEach(item => {
|
||||
item.checked = false;
|
||||
})
|
||||
this.setData({
|
||||
list: this.data.list
|
||||
});
|
||||
this.updateHasChecked();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
deleteChecked() {
|
||||
wx.showModal({
|
||||
title: "提示",
|
||||
content: "确认删除已选照片或视频吗?",
|
||||
confirmText: "删除已选",
|
||||
confirmColor: "#E64340",
|
||||
cancelText: "取消",
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
const selected = this.data.list.filter(item => item.checked);
|
||||
try {
|
||||
await MomentApi.delete(selected.map(item => item.id));
|
||||
wx.showToast({ title: "删除成功", icon: "success" });
|
||||
const list = this.data.list.filter(item => !item.checked);
|
||||
this.setData({
|
||||
list
|
||||
});
|
||||
this.updateHasChecked();
|
||||
} catch (error) {
|
||||
console.error("删除 moment 失败:", error);
|
||||
wx.showToast({ title: "删除失败", icon: "error" });
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
193
miniprogram/pages/main/tabs/moment/index.wxml
Normal file
193
miniprogram/pages/main/tabs/moment/index.wxml
Normal file
@@ -0,0 +1,193 @@
|
||||
<!--pages/main/moment/index.wxml-->
|
||||
<view class="custom-navbar">
|
||||
<t-navbar class="custom-navbar" title="瞬间" placeholder />
|
||||
</view>
|
||||
<view class="moment">
|
||||
<view class="tips">
|
||||
<text>由于微信限制,一次只能上传 20 张照片或视频,可以先在此页面分批次将所有照片或视频上传,</text>
|
||||
<text style="color: #F30">记得勾选原图</text>
|
||||
<text>。无需担心重复选择,已上传的文件不会再次上传。上传后有空再挑选归档,归档后此页面不再显示该照片或视频。</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
<view class="line">
|
||||
<t-button
|
||||
class="btn upload"
|
||||
theme="primary"
|
||||
plain="true"
|
||||
disabled="{{isSubmitting}}"
|
||||
bind:tap="uploadMedia"
|
||||
>上传照片/视频</t-button>
|
||||
<t-button
|
||||
class="btn archive"
|
||||
theme="primary"
|
||||
plain="true"
|
||||
bind:tap="showArchivePopup"
|
||||
disabled="{{isSubmitting || list.length === 0 || !hasChecked}}"
|
||||
>归档已选</t-button>
|
||||
</view>
|
||||
<view class="line">
|
||||
<t-button
|
||||
class="btn clear"
|
||||
theme="primary"
|
||||
variant="outline"
|
||||
bind:tap="allChecked"
|
||||
disabled="{{isSubmitting || list.length === 0}}"
|
||||
>全选</t-button>
|
||||
<t-button
|
||||
class="btn clear"
|
||||
theme="danger"
|
||||
variant="outline"
|
||||
bind:tap="clearChecked"
|
||||
disabled="{{isSubmitting || list.length === 0 || !hasChecked}}"
|
||||
>清空已选</t-button>
|
||||
<t-button
|
||||
class="btn delete"
|
||||
theme="danger"
|
||||
variant="outline"
|
||||
bind:tap="deleteChecked"
|
||||
disabled="{{isSubmitting || list.length === 0 || !hasChecked}}"
|
||||
>删除已选</t-button>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{isUploading}}" class="uploading">
|
||||
<progress
|
||||
class="progress"
|
||||
percent="{{uploadProgress}}"
|
||||
stroke-width="6"
|
||||
/>
|
||||
<view class="text">
|
||||
<view>{{uploaded}} / {{uploadTotal}}</view>
|
||||
<view>{{uploadSpeed}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="items">
|
||||
<view class="item" wx:for="{{list}}" wx:key="mongoId">
|
||||
<image
|
||||
class="thumbnail {{item.type}}"
|
||||
src="{{item.thumbURL}}"
|
||||
mode="widthFix"
|
||||
bind:tap="preview"
|
||||
data-index="{{index}}"
|
||||
></image>
|
||||
<t-checkbox
|
||||
class="checkbox"
|
||||
block="{{true}}"
|
||||
checked="{{item.checked}}"
|
||||
bind:change="onCheckChange"
|
||||
data-index="{{index}}"
|
||||
/>
|
||||
<view wx:if="{{item.checked}}" class="checkbox-fill"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<t-popup
|
||||
class="archive-popup"
|
||||
visible="{{isVisibleArchivePopup}}"
|
||||
placement="bottom"
|
||||
usingCustomNavbar
|
||||
bind:visible-change="onArchivePopupVisibleChange"
|
||||
>
|
||||
<!-- 选择归档方式 -->
|
||||
<view wx:if="{{archiveStep === 'select-type'}}" class="container select-type">
|
||||
<view class="header">
|
||||
<t-button
|
||||
class="btn cancel"
|
||||
bind:tap="toggleArchivePopup"
|
||||
variant="text"
|
||||
>取消</t-button>
|
||||
<view class="title">归档到</view>
|
||||
<view class="placeholder"></view>
|
||||
</view>
|
||||
<t-cell-group class="content">
|
||||
<t-cell
|
||||
title="新纪录"
|
||||
leftIcon="bookmark-add"
|
||||
arrow
|
||||
bind:tap="onArchiveToNew"
|
||||
/>
|
||||
<t-cell
|
||||
title="已存在记录"
|
||||
leftIcon="view-list"
|
||||
arrow
|
||||
bind:tap="onArchiveToExisting"
|
||||
/>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
<!-- 归档表单 -->
|
||||
<view wx:if="{{archiveStep === 'form'}}" class="container form">
|
||||
<view class="header">
|
||||
<t-button
|
||||
class="btn back"
|
||||
bind:tap="onNewJournalBack"
|
||||
variant="text"
|
||||
>返回</t-button>
|
||||
<view class="title">归档到新纪录</view>
|
||||
<t-button
|
||||
class="btn confirm"
|
||||
theme="primary"
|
||||
bind:tap="archiveChecked"
|
||||
variant="text"
|
||||
>确定</t-button>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="section">
|
||||
<textarea
|
||||
class="idea"
|
||||
placeholder="那一刻的想法..."
|
||||
model:value="{{idea}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="section type">
|
||||
<text class="label">类型:</text>
|
||||
<t-radio-group bind:change="onChangeArchiveType" default-value="NORMAL" borderless t-class="box">
|
||||
<t-radio class="radio" block="{{false}}" label="日常" value="NORMAL" />
|
||||
<t-radio class="radio" block="{{false}}" label="专拍" value="PORTFOLIO" />
|
||||
</t-radio-group>
|
||||
</view>
|
||||
<view class="section time">
|
||||
<text class="label">时间:</text>
|
||||
<picker class="picker" mode="date" model:value="{{date}}">
|
||||
<view class="picker">
|
||||
{{date}}
|
||||
</view>
|
||||
</picker>
|
||||
<picker class="picker" mode="time" model:value="{{time}}">
|
||||
<view class="picker">
|
||||
{{time}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="section location">
|
||||
<text class="label">位置:</text>
|
||||
<text wx:if="{{location}}" bind:tap="chooseLocation">{{location.text}}</text>
|
||||
<text wx:else bind:tap="chooseLocation">选择位置..</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 选择已存在记录 -->
|
||||
<view wx:if="{{archiveStep === 'select-journal'}}" class="container select-journal">
|
||||
<view class="header">
|
||||
<t-button
|
||||
class="btn back"
|
||||
bind:tap="onJournalListCancel"
|
||||
variant="text"
|
||||
>返回</t-button>
|
||||
<view class="title">归档到已存在记录</view>
|
||||
<t-button
|
||||
class="btn confirm"
|
||||
bind:tap="onJournalListConfirm"
|
||||
theme="primary"
|
||||
variant="text"
|
||||
disabled="{{!selectedJournalId}}"
|
||||
>确定</t-button>
|
||||
</view>
|
||||
<view class="content">
|
||||
<journal-list
|
||||
visible="{{archiveStep === 'select-journal'}}"
|
||||
searchable="{{true}}"
|
||||
selectedId="{{selectedJournalId}}"
|
||||
bind:select="onJournalListSelect"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</t-popup>
|
||||
7
miniprogram/pages/main/tabs/other/index.json
Normal file
7
miniprogram/pages/main/tabs/other/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
|
||||
}
|
||||
}
|
||||
0
miniprogram/pages/main/tabs/other/index.less
Normal file
0
miniprogram/pages/main/tabs/other/index.less
Normal file
33
miniprogram/pages/main/tabs/other/index.ts
Normal file
33
miniprogram/pages/main/tabs/other/index.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
type NavItem = {
|
||||
title: string;
|
||||
icon: string;
|
||||
url: string;
|
||||
};
|
||||
|
||||
interface OtherData {
|
||||
navList: NavItem[];
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <OtherData>{
|
||||
navList: [
|
||||
{
|
||||
title: "备忘录",
|
||||
icon: "task-checked",
|
||||
url: "/pages/main/other/portfolio/index"
|
||||
},
|
||||
{
|
||||
title: "专拍",
|
||||
icon: "face-retouching",
|
||||
url: "/pages/main/other/portfolio/index"
|
||||
}
|
||||
],
|
||||
},
|
||||
onNavTap(e: WechatMiniprogram.BaseEvent) {
|
||||
const { url } = e.currentTarget.dataset as { url?: string };
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
wx.navigateTo({ url });
|
||||
}
|
||||
});
|
||||
17
miniprogram/pages/main/tabs/other/index.wxml
Normal file
17
miniprogram/pages/main/tabs/other/index.wxml
Normal file
@@ -0,0 +1,17 @@
|
||||
<view class="custom-navbar">
|
||||
<t-navbar title="其他" placeholder />
|
||||
</view>
|
||||
<view class="setting-bg">
|
||||
<t-cell-group class="list">
|
||||
<t-cell
|
||||
wx:for="{{navList}}"
|
||||
wx:for-item="item"
|
||||
wx:key="title"
|
||||
title="{{item.title}}"
|
||||
leftIcon="{{item.icon}}"
|
||||
arrow
|
||||
bind:tap="onNavTap"
|
||||
data-url="{{item.url}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
13
miniprogram/pages/main/tabs/travel/index.json
Normal file
13
miniprogram/pages/main/tabs/travel/index.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-tag": "tdesign-miniprogram/tag/tag",
|
||||
"t-cell": "tdesign-miniprogram/cell/cell",
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-empty": "tdesign-miniprogram/empty/empty",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-cell-group": "tdesign-miniprogram/cell-group/cell-group"
|
||||
},
|
||||
"styleIsolation": "shared",
|
||||
"enablePullDownRefresh": true
|
||||
}
|
||||
118
miniprogram/pages/main/tabs/travel/index.less
Normal file
118
miniprogram/pages/main/tabs/travel/index.less
Normal file
@@ -0,0 +1,118 @@
|
||||
// pages/main/travel/index.less
|
||||
|
||||
.filter-menu {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 999;
|
||||
position: fixed;
|
||||
background: var(--theme-bg-overlay);
|
||||
|
||||
.content {
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
background: var(--theme-bg-menu);
|
||||
box-shadow: 0 0 12px var(--theme-shadow-medium);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.travels {
|
||||
width: 100vw;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 120rpx;
|
||||
|
||||
.travel {
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 12px var(--theme-shadow-light);
|
||||
transition: all .3s;
|
||||
background: var(--theme-bg-card);
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 16rpx;
|
||||
|
||||
&:active {
|
||||
transform: scale(.98);
|
||||
box-shadow: 0 2px 8px var(--theme-shadow-light);
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 24rpx;
|
||||
border-bottom: 1px solid var(--theme-border-light);
|
||||
}
|
||||
|
||||
.body {
|
||||
padding: 24rpx;
|
||||
|
||||
.title {
|
||||
color: var(--theme-text-primary);
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 16rpx;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.content {
|
||||
color: var(--theme-text-secondary);
|
||||
font-size: 28rpx;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 24rpx;
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.meta {
|
||||
gap: 32rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.item {
|
||||
gap: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.icon {
|
||||
color: var(--theme-text-secondary);
|
||||
}
|
||||
|
||||
.text {
|
||||
color: var(--theme-text-secondary);
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.finished {
|
||||
color: var(--theme-text-secondary);
|
||||
padding: 32rpx 0;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.fab {
|
||||
right: 32rpx;
|
||||
width: 112rpx;
|
||||
bottom: 120rpx;
|
||||
height: 112rpx;
|
||||
display: flex;
|
||||
z-index: 9999;
|
||||
position: fixed;
|
||||
background: var(--theme-wx);
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
justify-content: center;
|
||||
box-shadow: 0 8px 24px rgba(102, 126, 234, .4);
|
||||
transition: all .3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(.9);
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, .3);
|
||||
}
|
||||
}
|
||||
176
miniprogram/pages/main/tabs/travel/index.ts
Normal file
176
miniprogram/pages/main/tabs/travel/index.ts
Normal file
@@ -0,0 +1,176 @@
|
||||
// pages/main/travel/index.ts
|
||||
|
||||
import Time from "../../../../utils/Time";
|
||||
import { TravelApi } from "../../../../api/TravelApi";
|
||||
import { Travel, TravelPage, TravelStatus, TravelStatusLabel, TravelStatusIcon, TransportationTypeLabel, TransportationTypeIcon } from "../../../../types/Travel";
|
||||
|
||||
interface TravelData {
|
||||
/** 分页参数 */
|
||||
page: TravelPage;
|
||||
/** 出行列表 */
|
||||
list: Travel[];
|
||||
/** 当前筛选状态 */
|
||||
currentStatus: TravelStatus | "ALL";
|
||||
/** 是否正在加载 */
|
||||
isFetching: boolean;
|
||||
/** 是否已加载完成 */
|
||||
isFinished: boolean;
|
||||
/** 是否显示筛选菜单 */
|
||||
isShowFilterMenu: boolean;
|
||||
/** 菜单位置 */
|
||||
menuTop: number;
|
||||
menuLeft: number;
|
||||
/** 状态标签映射 */
|
||||
statusLabels: typeof TravelStatusLabel;
|
||||
/** 状态图标映射 */
|
||||
statusIcons: typeof TravelStatusIcon;
|
||||
/** 交通类型标签映射 */
|
||||
transportLabels: typeof TransportationTypeLabel;
|
||||
/** 交通类型图标映射 */
|
||||
transportIcons: typeof TransportationTypeIcon;
|
||||
}
|
||||
|
||||
Page({
|
||||
data: <TravelData>{
|
||||
page: {
|
||||
index: 0,
|
||||
size: 10
|
||||
},
|
||||
list: [],
|
||||
currentStatus: "ALL",
|
||||
isFetching: false,
|
||||
isFinished: false,
|
||||
isShowFilterMenu: false,
|
||||
menuTop: 0,
|
||||
menuLeft: 0,
|
||||
statusLabels: TravelStatusLabel,
|
||||
statusIcons: TravelStatusIcon,
|
||||
transportLabels: TransportationTypeLabel,
|
||||
transportIcons: TransportationTypeIcon
|
||||
},
|
||||
onLoad() {
|
||||
this.resetAndFetch();
|
||||
},
|
||||
onShow() {
|
||||
// 页面显示时刷新数据(从编辑页返回时)
|
||||
if (0 < this.data.list.length) {
|
||||
this.resetAndFetch();
|
||||
}
|
||||
},
|
||||
onHide() {
|
||||
this.setData({
|
||||
isShowFilterMenu: false
|
||||
});
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.resetAndFetch();
|
||||
wx.stopPullDownRefresh();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.fetch();
|
||||
},
|
||||
/** 重置并获取数据 */
|
||||
resetAndFetch() {
|
||||
this.setData({
|
||||
page: {
|
||||
index: 0,
|
||||
size: 10,
|
||||
equalsExample: this.data.currentStatus === "ALL" ? undefined : {
|
||||
status: this.data.currentStatus as TravelStatus
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
isFetching: false,
|
||||
isFinished: false
|
||||
});
|
||||
this.fetch();
|
||||
},
|
||||
/** 获取出行列表 */
|
||||
async fetch() {
|
||||
if (this.data.isFetching || this.data.isFinished) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setData({ isFetching: true });
|
||||
|
||||
try {
|
||||
const pageResult = await TravelApi.getList(this.data.page);
|
||||
const list = pageResult.list || [];
|
||||
|
||||
if (list.length === 0) {
|
||||
this.setData({ isFinished: true });
|
||||
return;
|
||||
}
|
||||
|
||||
// 格式化数据
|
||||
list.forEach(travel => {
|
||||
if (travel.travelAt) {
|
||||
travel.travelDate = Time.toDate(travel.travelAt);
|
||||
travel.travelTime = Time.toTime(travel.travelAt);
|
||||
}
|
||||
});
|
||||
|
||||
this.setData({
|
||||
page: {
|
||||
...this.data.page,
|
||||
index: this.data.page.index + 1
|
||||
},
|
||||
list: this.data.list.concat(list),
|
||||
isFinished: list.length < this.data.page.size
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("获取出行列表失败:", error);
|
||||
} finally {
|
||||
this.setData({ isFetching: false });
|
||||
}
|
||||
},
|
||||
/** 切换筛选菜单 */
|
||||
toggleFilterMenu() {
|
||||
if (!this.data.isShowFilterMenu) {
|
||||
// 打开菜单时计算位置
|
||||
const query = wx.createSelectorQuery();
|
||||
query.select(".filter-btn").boundingClientRect();
|
||||
query.exec((res) => {
|
||||
if (res[0]) {
|
||||
const { top, left, height } = res[0];
|
||||
this.setData({
|
||||
isShowFilterMenu: true,
|
||||
menuTop: top + height + 16,
|
||||
menuLeft: left
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 关闭菜单
|
||||
this.setData({
|
||||
isShowFilterMenu: false
|
||||
});
|
||||
}
|
||||
},
|
||||
/** 阻止事件冒泡 */
|
||||
stopPropagation() {
|
||||
// 空函数,仅用于阻止事件冒泡
|
||||
},
|
||||
/** 筛选状态 */
|
||||
filterByStatus(e: WechatMiniprogram.BaseEvent) {
|
||||
const status = e.currentTarget.dataset.status as TravelStatus | "ALL";
|
||||
this.setData({
|
||||
currentStatus: status,
|
||||
isShowFilterMenu: false
|
||||
});
|
||||
this.resetAndFetch();
|
||||
},
|
||||
/** 新建出行 */
|
||||
toCreate() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/main/travel/editor/index"
|
||||
});
|
||||
},
|
||||
/** 查看详情 */
|
||||
toDetail(e: WechatMiniprogram.BaseEvent) {
|
||||
const { id } = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: `/pages/main/travel/detail/index?id=${id}`
|
||||
});
|
||||
},
|
||||
});
|
||||
101
miniprogram/pages/main/tabs/travel/index.wxml
Normal file
101
miniprogram/pages/main/tabs/travel/index.wxml
Normal file
@@ -0,0 +1,101 @@
|
||||
<!--pages/main/travel/index.wxml-->
|
||||
<view class="custom-navbar">
|
||||
<t-navbar title="出行计划" placeholder>
|
||||
<view slot="left" class="filter-btn" bind:tap="toggleFilterMenu">
|
||||
<t-icon name="filter" size="24px" />
|
||||
</view>
|
||||
</t-navbar>
|
||||
</view>
|
||||
|
||||
<!-- 筛选菜单 -->
|
||||
<view wx:if="{{isShowFilterMenu}}" class="filter-menu" catchtap="toggleFilterMenu">
|
||||
<t-cell-group
|
||||
class="content"
|
||||
theme="card"
|
||||
style="top: {{menuTop}}px; left: {{menuLeft}}px;"
|
||||
catchtap="stopPropagation"
|
||||
>
|
||||
<t-cell
|
||||
title="全部"
|
||||
leftIcon="bulletpoint"
|
||||
bind:tap="filterByStatus"
|
||||
data-status="ALL"
|
||||
rightIcon="{{currentStatus === 'ALL' ? 'check' : ''}}"
|
||||
/>
|
||||
<t-cell
|
||||
title="计划中"
|
||||
leftIcon="calendar"
|
||||
bind:tap="filterByStatus"
|
||||
data-status="PLANNING"
|
||||
rightIcon="{{currentStatus === 'PLANNING' ? 'check' : ''}}"
|
||||
/>
|
||||
<t-cell
|
||||
title="进行中"
|
||||
leftIcon="play-circle"
|
||||
bind:tap="filterByStatus"
|
||||
data-status="ONGOING"
|
||||
rightIcon="{{currentStatus === 'ONGOING' ? 'check' : ''}}"
|
||||
/>
|
||||
<t-cell
|
||||
title="已完成"
|
||||
leftIcon="check-circle"
|
||||
bind:tap="filterByStatus"
|
||||
data-status="COMPLETED"
|
||||
rightIcon="{{currentStatus === 'COMPLETED' ? 'check' : ''}}"
|
||||
/>
|
||||
</t-cell-group>
|
||||
</view>
|
||||
|
||||
<!-- 出行列表 -->
|
||||
<view class="travels">
|
||||
<!-- 空状态 -->
|
||||
<t-empty
|
||||
wx:if="{{!isFetching && list.length === 0}}"
|
||||
icon="travel"
|
||||
description="暂无出行计划"
|
||||
/>
|
||||
<!-- 列表内容 -->
|
||||
<view
|
||||
wx:for="{{list}}"
|
||||
wx:for-item="travel"
|
||||
wx:for-index="travelIndex"
|
||||
wx:key="id"
|
||||
class="travel"
|
||||
bind:tap="toDetail"
|
||||
data-id="{{travel.id}}"
|
||||
>
|
||||
<view class="header">
|
||||
<t-tag
|
||||
theme="{{travel.status === 'PLANNING' ? 'default' : travel.status === 'ONGOING' ? 'warning' : 'success'}}"
|
||||
variant="light"
|
||||
icon="{{statusIcons[travel.status]}}"
|
||||
>
|
||||
{{statusLabels[travel.status]}}
|
||||
</t-tag>
|
||||
</view>
|
||||
<view class="body">
|
||||
<view class="title">{{travel.title || '未命名出行'}}</view>
|
||||
<view wx:if="{{travel.content}}" class="content">{{travel.content}}</view>
|
||||
<view class="meta">
|
||||
<view wx:if="{{travel.travelDate}}" class="item">
|
||||
<t-icon name="time" size="16px" class="icon" />
|
||||
<text class="text">{{travel.travelDate}}</text>
|
||||
</view>
|
||||
<view wx:if="{{travel.days}}" class="item">
|
||||
<t-icon name="calendar" size="16px" class="icon" />
|
||||
<text class="text">{{travel.days}} 天</text>
|
||||
</view>
|
||||
<view wx:if="{{travel.transportationType}}" class="item">
|
||||
<t-icon name="{{transportIcons[travel.transportationType]}}" size="16px" class="icon" />
|
||||
<text class="text">{{transportLabels[travel.transportationType]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 加载完成提示 -->
|
||||
<view wx:if="{{isFinished && 0 < list.length}}" class="finished">没有更多了</view>
|
||||
</view>
|
||||
<!-- 新建按钮 -->
|
||||
<view class="fab" bind:tap="toCreate">
|
||||
<t-icon name="add" size="24px" color="#fff" />
|
||||
</view>
|
||||
Reference in New Issue
Block a user