support change type

This commit is contained in:
Timi
2025-12-11 00:46:11 +08:00
parent 2cb8f16ccc
commit 861ae8baff
8 changed files with 54 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import Time from "../../../utils/Time";
import Toolkit from "../../../utils/Toolkit";
import config from "../../../config/index";
import { Location, MediaItem, MediaItemType, WechatMediaItem } from "../../../types/UI";
import { Journal } from "../../../types/Journal";
import { Journal, JournalType } from "../../../types/Journal";
import { MediaAttachExt, MediaAttachType } from "../../../types/Attachment";
interface JournalEditorData {
@ -12,6 +12,7 @@ interface JournalEditorData {
idea: string;
date: string;
time: string;
type: JournalType;
mediaList: MediaItem[];
newMediaList: WechatMediaItem[];
location?: Location;
@ -31,6 +32,7 @@ Page({
idea: "",
date: "2025-06-28",
time: "16:00",
type: JournalType.NORMAL,
mediaList: [],
newMediaList: [],
location: undefined,
@ -114,6 +116,7 @@ Page({
idea: journal.idea || "",
date: Time.toDate(journal.createdAt),
time: Time.toTime(journal.createdAt),
type: journal.type,
location: journal.location ? {
lat: journal.lat,
lng: journal.lng,
@ -134,6 +137,10 @@ Page({
}, 1500);
}
},
onChangeType(e: any) {
const { value } = e.detail;
this.setData({ type: value });
},
/** 选择位置 */
async chooseLocation() {
const location = await wx.chooseLocation({});
@ -353,6 +360,7 @@ Page({
data: {
id: this.data.id,
idea: this.data.idea,
type: this.data.type,
lat: this.data.location?.lat,
lng: this.data.location?.lng,
location: this.data.location?.text,