add upload permission
This commit is contained in:
@ -6,6 +6,7 @@ import { TravelLocation, TravelLocationTypeIcon, TravelLocationTypeLabel } from
|
||||
import { MediaAttachType, PreviewImageMetadata } from "../../../../types/Attachment";
|
||||
import { MapMarker, MediaItem, MediaItemType } from "../../../../types/UI";
|
||||
import Toolkit from "../../../../utils/Toolkit";
|
||||
import Permission from "../../../../utils/Permission";
|
||||
|
||||
interface TravelLocationView extends TravelLocation {
|
||||
/** 媒体列表 */
|
||||
@ -35,6 +36,8 @@ interface TravelLocationDetailData {
|
||||
deleteDialogVisible: boolean;
|
||||
/** 删除确认文本 */
|
||||
deleteConfirmText: string;
|
||||
/** 是否允许上传 */
|
||||
canUpload: boolean;
|
||||
}
|
||||
|
||||
Page({
|
||||
@ -51,7 +54,8 @@ Page({
|
||||
},
|
||||
mapMarkers: [],
|
||||
deleteDialogVisible: false,
|
||||
deleteConfirmText: ""
|
||||
deleteConfirmText: "",
|
||||
canUpload: false
|
||||
},
|
||||
|
||||
onLoad(options: any) {
|
||||
@ -73,10 +77,17 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
async onShow() {
|
||||
const cached = Permission.getCachedUploadPermission();
|
||||
if (cached !== null) {
|
||||
this.setData({ canUpload: cached });
|
||||
} else {
|
||||
const canUpload = await Permission.checkAndCacheUploadPermission();
|
||||
this.setData({ canUpload });
|
||||
}
|
||||
// 页面显示时刷新数据(从编辑页返回时)
|
||||
if (this.data.locationId && !this.data.isLoading && this.data.location) {
|
||||
this.fetchDetail(this.data.locationId);
|
||||
await this.fetchDetail(this.data.locationId);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user