fix location icon

This commit is contained in:
Timi
2025-12-10 17:17:57 +08:00
parent 920b3c87e8
commit 18c6a41549
7 changed files with 60 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

View File

@ -35,8 +35,8 @@
margin-bottom: 8rpx;
.icon {
width: 32rpx;
height: 32rpx;
color: var(--theme-wx);
font-size: 48rpx;
margin-right: 8rpx;
}
}
@ -81,9 +81,21 @@
align-items: baseline;
.location {
gap: 8rpx;
color: #666;
flex-basis: 100%;
display: flex;
font-size: 24rpx;
flex-basis: 100%;
align-items: center;
.icon {
color: var(--theme-wx);
font-size: 32rpx;
}
.text {
font-size: 24rpx;
}
}
.date {

View File

@ -4,6 +4,8 @@ interface JournalInfo {
id: number;
date: string;
time: string;
lat?: number;
lng?: number;
location?: string;
idea?: string;
items: Array<{
@ -80,6 +82,18 @@ Component({
});
},
openLocation(e: WechatMiniprogram.BaseEvent) {
const { journalIndex } = e.currentTarget.dataset;
const journals = this.properties.journals as JournalInfo[];
const journal = journals[journalIndex];
if (journal.lat && journal.lng) {
wx.openLocation({
latitude: journal.lat,
longitude: journal.lng,
});
}
},
/** 预览媒体 */
previewMedia(e: WechatMiniprogram.BaseEvent) {
const { mediaIndex } = e.currentTarget.dataset;

View File

@ -10,7 +10,7 @@
<view class="header">
<view class="info">
<view wx:if="{{title}}" class="title">
<image wx:if="{{showLocationIcon}}" class="icon" src="../../assets/image/location.png" />
<t-icon wx:if="{{showLocationIcon}}" class="icon" name="location-filled" />
<text>{{title}}</text>
</view>
</view>
@ -26,7 +26,15 @@
<swiper-item class="swiper-item-wrapper">
<view class="journal-item">
<view class="journal-header">
<view wx:if="{{item.location && showJournalLocation}}" class="location">📍 {{item.location}}</view>
<view
wx:if="{{item.location && showJournalLocation}}"
class="location"
catchtap="openLocation"
data-journal-index="{{currentJournalIndex}}"
>
<t-icon class="icon" name="location-filled" />
<text class="text">{{item.location}}</text>
</view>
<view wx:if="{{showJournalDate}}" class="date">{{item.date}}</view>
</view>
<view wx:if="{{item.idea}}" class="idea">{{item.idea}}</view>

View File

@ -8,6 +8,8 @@ interface JournalInfo {
id: number;
date: string;
time: string;
lat?: number;
lng?: number;
location?: string;
idea?: string;
items: Array<{
@ -145,6 +147,8 @@ Page({
id: journal.id,
date: Time.toPassedDateTime(journal.createdAt),
time: `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`,
lat: journal.lat,
lng: journal.lng,
location: journal.location,
idea: journal.idea,
items: journal.items

View File

@ -34,7 +34,7 @@
font-size: 14px;
}
.text {
> .text {
color: var(--theme-text-primary);
width: calc(100% - 32px - 2rem);
padding: 8px 16px;
@ -64,8 +64,18 @@
}
.location {
gap: 6rpx;
display: flex;
align-items: center;
justify-content: flex-end;
.icon {
color: var(--theme-wx);
}
.text {
color: var(--theme-text-secondary);
text-align: right;
}
}
}

View File

@ -27,7 +27,10 @@
class="location"
bind:tap="openLocation"
data-journal-index="{{journalIndex}}"
>📍 {{journal.location}}</view>
>
<t-icon class="icon" name="location-filled" />
<text class="text">{{journal.location}}</text>
</view>
</view>
<view wx:if="{{journal.items}}" class="items">
<block wx:for="{{journal.items}}" wx:for-item="item" wx:for-index="itemIndex" wx:key="date">