support change type
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-radio": "tdesign-miniprogram/radio/radio",
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar"
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,14 @@
|
||||
width: 100%;
|
||||
margin-top: 1.5rem;
|
||||
|
||||
&.type {
|
||||
display: flex;
|
||||
|
||||
.radio {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&.time {
|
||||
display: flex;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import Events from "../../../utils/Events";
|
||||
import Time from "../../../utils/Time";
|
||||
import Toolkit from "../../../utils/Toolkit";
|
||||
import config from "../../../config/index";
|
||||
import { JournalType } from "../../../types/Journal";
|
||||
|
||||
enum MediaItemType {
|
||||
IMAGE,
|
||||
@ -28,6 +29,7 @@ interface JournalEditorData {
|
||||
idea: string;
|
||||
date: string;
|
||||
time: string;
|
||||
type: JournalType;
|
||||
mediaList: MediaItem[];
|
||||
location?: Location;
|
||||
qqMapSDK?: any;
|
||||
@ -39,6 +41,7 @@ Page({
|
||||
idea: "",
|
||||
date: "2025-06-28",
|
||||
time: "16:00",
|
||||
type: JournalType.NORMAL,
|
||||
mediaList: [],
|
||||
location: undefined,
|
||||
submitText: "提交",
|
||||
@ -97,6 +100,10 @@ Page({
|
||||
});
|
||||
});
|
||||
},
|
||||
onChangeType(e: any) {
|
||||
const { value } = e.detail;
|
||||
this.setData({ type: value });
|
||||
},
|
||||
async chooseLocation() {
|
||||
const location = await wx.chooseLocation({});
|
||||
this.setData({
|
||||
@ -276,13 +283,13 @@ Page({
|
||||
Key: wx.getStorageSync("key")
|
||||
},
|
||||
data: {
|
||||
type: "NORMAL",
|
||||
idea: this.data.idea,
|
||||
createdAt: Date.parse(`${this.data.date} ${this.data.time}`),
|
||||
type: this.data.type,
|
||||
lat: this.data.location?.lat,
|
||||
lng: this.data.location?.lng,
|
||||
location: this.data.location?.text,
|
||||
pusher: openId,
|
||||
createdAt: Date.parse(`${this.data.date} ${this.data.time}`),
|
||||
tempFileIds
|
||||
},
|
||||
success: async (resp: any) => {
|
||||
|
||||
@ -17,6 +17,13 @@
|
||||
model:value="{{idea}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="section type">
|
||||
<text class="label">类型:</text>
|
||||
<t-radio-group bind:change="onChangeType" 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}}">
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-input": "tdesign-miniprogram/input/input",
|
||||
"t-radio": "tdesign-miniprogram/radio/radio",
|
||||
"t-button": "tdesign-miniprogram/button/button",
|
||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog",
|
||||
"t-input": "tdesign-miniprogram/input/input"
|
||||
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,14 @@
|
||||
width: 100%;
|
||||
margin-top: 1.5rem;
|
||||
|
||||
&.type {
|
||||
display: flex;
|
||||
|
||||
.radio {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
&.time {
|
||||
display: flex;
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -21,6 +21,13 @@
|
||||
model:value="{{idea}}"
|
||||
/>
|
||||
</view>
|
||||
<view class="section type">
|
||||
<text class="label">类型:</text>
|
||||
<t-radio-group bind:change="onChangeType" default-value="{{type}}" 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}}">
|
||||
|
||||
Reference in New Issue
Block a user