add upload permission
This commit is contained in:
@ -5,6 +5,7 @@ import { TravelApi } from "../../../../api/TravelApi";
|
||||
import { TravelLocationApi } from "../../../../api/TravelLocationApi";
|
||||
import config from "../../../../config/index";
|
||||
import { Travel, TravelStatusLabel, TravelStatusIcon, TransportationTypeLabel, TravelLocation, TravelLocationTypeLabel, TravelLocationTypeIcon, TransportationTypeIcon, TravelLocationType } from "../../../../types/Travel";
|
||||
import Permission from "../../../../utils/Permission";
|
||||
|
||||
interface TravelLocationView extends TravelLocation {
|
||||
/** 预览图 */
|
||||
@ -42,6 +43,8 @@ interface TravelDetailData {
|
||||
deleteDialogVisible: boolean;
|
||||
/** 删除确认文本 */
|
||||
deleteConfirmText: string;
|
||||
/** 是否允许上传 */
|
||||
canUpload: boolean;
|
||||
}
|
||||
|
||||
Page({
|
||||
@ -60,7 +63,8 @@ Page({
|
||||
locationTypes: ["全部", ...Object.values(TravelLocationTypeLabel)],
|
||||
selectedLocationTypeIndex: 0,
|
||||
deleteDialogVisible: false,
|
||||
deleteConfirmText: ""
|
||||
deleteConfirmText: "",
|
||||
canUpload: false
|
||||
},
|
||||
|
||||
onLoad(options: any) {
|
||||
@ -79,10 +83,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.travelId && !this.data.isLoading) {
|
||||
this.fetchLocations(this.data.travelId);
|
||||
await this.fetchLocations(this.data.travelId);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user