support change type
This commit is contained in:
@ -2,7 +2,9 @@
|
|||||||
"component": true,
|
"component": true,
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||||
|
"t-radio": "tdesign-miniprogram/radio/radio",
|
||||||
"t-button": "tdesign-miniprogram/button/button",
|
"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%;
|
width: 100%;
|
||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
|
|
||||||
|
&.type {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.radio {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.time {
|
&.time {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import Events from "../../../utils/Events";
|
|||||||
import Time from "../../../utils/Time";
|
import Time from "../../../utils/Time";
|
||||||
import Toolkit from "../../../utils/Toolkit";
|
import Toolkit from "../../../utils/Toolkit";
|
||||||
import config from "../../../config/index";
|
import config from "../../../config/index";
|
||||||
|
import { JournalType } from "../../../types/Journal";
|
||||||
|
|
||||||
enum MediaItemType {
|
enum MediaItemType {
|
||||||
IMAGE,
|
IMAGE,
|
||||||
@ -28,6 +29,7 @@ interface JournalEditorData {
|
|||||||
idea: string;
|
idea: string;
|
||||||
date: string;
|
date: string;
|
||||||
time: string;
|
time: string;
|
||||||
|
type: JournalType;
|
||||||
mediaList: MediaItem[];
|
mediaList: MediaItem[];
|
||||||
location?: Location;
|
location?: Location;
|
||||||
qqMapSDK?: any;
|
qqMapSDK?: any;
|
||||||
@ -39,6 +41,7 @@ Page({
|
|||||||
idea: "",
|
idea: "",
|
||||||
date: "2025-06-28",
|
date: "2025-06-28",
|
||||||
time: "16:00",
|
time: "16:00",
|
||||||
|
type: JournalType.NORMAL,
|
||||||
mediaList: [],
|
mediaList: [],
|
||||||
location: undefined,
|
location: undefined,
|
||||||
submitText: "提交",
|
submitText: "提交",
|
||||||
@ -97,6 +100,10 @@ Page({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onChangeType(e: any) {
|
||||||
|
const { value } = e.detail;
|
||||||
|
this.setData({ type: value });
|
||||||
|
},
|
||||||
async chooseLocation() {
|
async chooseLocation() {
|
||||||
const location = await wx.chooseLocation({});
|
const location = await wx.chooseLocation({});
|
||||||
this.setData({
|
this.setData({
|
||||||
@ -276,13 +283,13 @@ Page({
|
|||||||
Key: wx.getStorageSync("key")
|
Key: wx.getStorageSync("key")
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
type: "NORMAL",
|
|
||||||
idea: this.data.idea,
|
idea: this.data.idea,
|
||||||
createdAt: Date.parse(`${this.data.date} ${this.data.time}`),
|
type: this.data.type,
|
||||||
lat: this.data.location?.lat,
|
lat: this.data.location?.lat,
|
||||||
lng: this.data.location?.lng,
|
lng: this.data.location?.lng,
|
||||||
location: this.data.location?.text,
|
location: this.data.location?.text,
|
||||||
pusher: openId,
|
pusher: openId,
|
||||||
|
createdAt: Date.parse(`${this.data.date} ${this.data.time}`),
|
||||||
tempFileIds
|
tempFileIds
|
||||||
},
|
},
|
||||||
success: async (resp: any) => {
|
success: async (resp: any) => {
|
||||||
|
|||||||
@ -17,6 +17,13 @@
|
|||||||
model:value="{{idea}}"
|
model:value="{{idea}}"
|
||||||
/>
|
/>
|
||||||
</view>
|
</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">
|
<view class="section time">
|
||||||
<text class="label">时间:</text>
|
<text class="label">时间:</text>
|
||||||
<picker class="picker" mode="date" model:value="{{date}}">
|
<picker class="picker" mode="date" model:value="{{date}}">
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
"component": true,
|
"component": true,
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
"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-button": "tdesign-miniprogram/button/button",
|
||||||
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
"t-navbar": "tdesign-miniprogram/navbar/navbar",
|
||||||
"t-dialog": "tdesign-miniprogram/dialog/dialog",
|
"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%;
|
width: 100%;
|
||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
|
|
||||||
|
&.type {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
.radio {
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.time {
|
&.time {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import Time from "../../../utils/Time";
|
|||||||
import Toolkit from "../../../utils/Toolkit";
|
import Toolkit from "../../../utils/Toolkit";
|
||||||
import config from "../../../config/index";
|
import config from "../../../config/index";
|
||||||
import { Location, MediaItem, MediaItemType, WechatMediaItem } from "../../../types/UI";
|
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";
|
import { MediaAttachExt, MediaAttachType } from "../../../types/Attachment";
|
||||||
|
|
||||||
interface JournalEditorData {
|
interface JournalEditorData {
|
||||||
@ -12,6 +12,7 @@ interface JournalEditorData {
|
|||||||
idea: string;
|
idea: string;
|
||||||
date: string;
|
date: string;
|
||||||
time: string;
|
time: string;
|
||||||
|
type: JournalType;
|
||||||
mediaList: MediaItem[];
|
mediaList: MediaItem[];
|
||||||
newMediaList: WechatMediaItem[];
|
newMediaList: WechatMediaItem[];
|
||||||
location?: Location;
|
location?: Location;
|
||||||
@ -31,6 +32,7 @@ Page({
|
|||||||
idea: "",
|
idea: "",
|
||||||
date: "2025-06-28",
|
date: "2025-06-28",
|
||||||
time: "16:00",
|
time: "16:00",
|
||||||
|
type: JournalType.NORMAL,
|
||||||
mediaList: [],
|
mediaList: [],
|
||||||
newMediaList: [],
|
newMediaList: [],
|
||||||
location: undefined,
|
location: undefined,
|
||||||
@ -114,6 +116,7 @@ Page({
|
|||||||
idea: journal.idea || "",
|
idea: journal.idea || "",
|
||||||
date: Time.toDate(journal.createdAt),
|
date: Time.toDate(journal.createdAt),
|
||||||
time: Time.toTime(journal.createdAt),
|
time: Time.toTime(journal.createdAt),
|
||||||
|
type: journal.type,
|
||||||
location: journal.location ? {
|
location: journal.location ? {
|
||||||
lat: journal.lat,
|
lat: journal.lat,
|
||||||
lng: journal.lng,
|
lng: journal.lng,
|
||||||
@ -134,6 +137,10 @@ Page({
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onChangeType(e: any) {
|
||||||
|
const { value } = e.detail;
|
||||||
|
this.setData({ type: value });
|
||||||
|
},
|
||||||
/** 选择位置 */
|
/** 选择位置 */
|
||||||
async chooseLocation() {
|
async chooseLocation() {
|
||||||
const location = await wx.chooseLocation({});
|
const location = await wx.chooseLocation({});
|
||||||
@ -353,6 +360,7 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
id: this.data.id,
|
id: this.data.id,
|
||||||
idea: this.data.idea,
|
idea: this.data.idea,
|
||||||
|
type: this.data.type,
|
||||||
lat: this.data.location?.lat,
|
lat: this.data.location?.lat,
|
||||||
lng: this.data.location?.lng,
|
lng: this.data.location?.lng,
|
||||||
location: this.data.location?.text,
|
location: this.data.location?.text,
|
||||||
|
|||||||
@ -21,6 +21,13 @@
|
|||||||
model:value="{{idea}}"
|
model:value="{{idea}}"
|
||||||
/>
|
/>
|
||||||
</view>
|
</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">
|
<view class="section time">
|
||||||
<text class="label">时间:</text>
|
<text class="label">时间:</text>
|
||||||
<picker class="picker" mode="date" model:value="{{date}}">
|
<picker class="picker" mode="date" model:value="{{date}}">
|
||||||
|
|||||||
Reference in New Issue
Block a user