fix location icon
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 638 B |
@ -35,8 +35,8 @@
|
|||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
width: 32rpx;
|
color: var(--theme-wx);
|
||||||
height: 32rpx;
|
font-size: 48rpx;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,9 +81,21 @@
|
|||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
|
|
||||||
.location {
|
.location {
|
||||||
|
gap: 8rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
flex-basis: 100%;
|
display: flex;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
flex-basis: 100%;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: var(--theme-wx);
|
||||||
|
font-size: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
|
|||||||
@ -4,6 +4,8 @@ interface JournalInfo {
|
|||||||
id: number;
|
id: number;
|
||||||
date: string;
|
date: string;
|
||||||
time: string;
|
time: string;
|
||||||
|
lat?: number;
|
||||||
|
lng?: number;
|
||||||
location?: string;
|
location?: string;
|
||||||
idea?: string;
|
idea?: string;
|
||||||
items: Array<{
|
items: Array<{
|
||||||
@ -79,6 +81,18 @@ Component({
|
|||||||
currentJournalIndex: e.detail.current
|
currentJournalIndex: e.detail.current
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
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) {
|
previewMedia(e: WechatMiniprogram.BaseEvent) {
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
<view class="header">
|
<view class="header">
|
||||||
<view class="info">
|
<view class="info">
|
||||||
<view wx:if="{{title}}" class="title">
|
<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>
|
<text>{{title}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -26,7 +26,15 @@
|
|||||||
<swiper-item class="swiper-item-wrapper">
|
<swiper-item class="swiper-item-wrapper">
|
||||||
<view class="journal-item">
|
<view class="journal-item">
|
||||||
<view class="journal-header">
|
<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 wx:if="{{showJournalDate}}" class="date">{{item.date}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{item.idea}}" class="idea">{{item.idea}}</view>
|
<view wx:if="{{item.idea}}" class="idea">{{item.idea}}</view>
|
||||||
|
|||||||
@ -8,6 +8,8 @@ interface JournalInfo {
|
|||||||
id: number;
|
id: number;
|
||||||
date: string;
|
date: string;
|
||||||
time: string;
|
time: string;
|
||||||
|
lat?: number;
|
||||||
|
lng?: number;
|
||||||
location?: string;
|
location?: string;
|
||||||
idea?: string;
|
idea?: string;
|
||||||
items: Array<{
|
items: Array<{
|
||||||
@ -145,6 +147,8 @@ Page({
|
|||||||
id: journal.id,
|
id: journal.id,
|
||||||
date: Time.toPassedDateTime(journal.createdAt),
|
date: Time.toPassedDateTime(journal.createdAt),
|
||||||
time: `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`,
|
time: `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`,
|
||||||
|
lat: journal.lat,
|
||||||
|
lng: journal.lng,
|
||||||
location: journal.location,
|
location: journal.location,
|
||||||
idea: journal.idea,
|
idea: journal.idea,
|
||||||
items: journal.items
|
items: journal.items
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
> .text {
|
||||||
color: var(--theme-text-primary);
|
color: var(--theme-text-primary);
|
||||||
width: calc(100% - 32px - 2rem);
|
width: calc(100% - 32px - 2rem);
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
@ -64,8 +64,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.location {
|
.location {
|
||||||
color: var(--theme-text-secondary);
|
gap: 6rpx;
|
||||||
text-align: right;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
color: var(--theme-wx);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
color: var(--theme-text-secondary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,10 @@
|
|||||||
class="location"
|
class="location"
|
||||||
bind:tap="openLocation"
|
bind:tap="openLocation"
|
||||||
data-journal-index="{{journalIndex}}"
|
data-journal-index="{{journalIndex}}"
|
||||||
>📍 {{journal.location}}</view>
|
>
|
||||||
|
<t-icon class="icon" name="location-filled" />
|
||||||
|
<text class="text">{{journal.location}}</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{journal.items}}" class="items">
|
<view wx:if="{{journal.items}}" class="items">
|
||||||
<block wx:for="{{journal.items}}" wx:for-item="item" wx:for-index="itemIndex" wx:key="date">
|
<block wx:for="{{journal.items}}" wx:for-item="item" wx:for-index="itemIndex" wx:key="date">
|
||||||
|
|||||||
Reference in New Issue
Block a user