add upload permission
This commit is contained in:
@@ -9,6 +9,7 @@ import { OrderType } from "../../../../types/Model";
|
||||
import { PreviewImageMetadata } from "../../../../types/Attachment";
|
||||
import { MediaItem, MediaItemType } from "../../../../types/UI";
|
||||
import { JournalApi } from "../../../../api/JournalApi";
|
||||
import Permission from "../../../../utils/Permission";
|
||||
|
||||
interface JournalData {
|
||||
page: JournalPage;
|
||||
@@ -23,6 +24,7 @@ interface JournalData {
|
||||
isShowMoreMenu: boolean;
|
||||
menuTop: number;
|
||||
menuLeft: number;
|
||||
canUpload: boolean;
|
||||
}
|
||||
|
||||
Page({
|
||||
@@ -52,7 +54,17 @@ Page({
|
||||
stickyOffset: 0,
|
||||
isShowMoreMenu: false,
|
||||
menuTop: 0,
|
||||
menuLeft: 0
|
||||
menuLeft: 0,
|
||||
canUpload: false
|
||||
},
|
||||
async onShow() {
|
||||
const cached = Permission.getCachedUploadPermission();
|
||||
if (cached !== null) {
|
||||
this.setData({ canUpload: cached });
|
||||
return;
|
||||
}
|
||||
const canUpload = await Permission.checkAndCacheUploadPermission();
|
||||
this.setData({ canUpload });
|
||||
},
|
||||
onLoad() {
|
||||
Events.reset("JOURNAL_REFRESH", () => {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
style="top: {{menuTop}}px; left: {{menuLeft}}px;"
|
||||
catchtap="stopPropagation"
|
||||
>
|
||||
<t-cell title="新纪录" leftIcon="add" bind:tap="toCreater" />
|
||||
<t-cell title="按列表查找" leftIcon="view-list" bind:tap="toSearch" />
|
||||
<t-cell wx:if="{{canUpload}}" title="新纪录" leftIcon="add" bind:tap="toCreater" />
|
||||
<t-cell wx:if="{{canUpload}}" title="按列表查找" leftIcon="view-list" bind:tap="toSearch" />
|
||||
<t-cell title="按日期查找" leftIcon="calendar-1" bind:tap="toDate" />
|
||||
<t-cell title="按地图查找" leftIcon="location" bind:tap="toMap" />
|
||||
</t-cell-group>
|
||||
@@ -53,4 +53,4 @@
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{isFinished}}" class="start">已回到最初的起点</view>
|
||||
</t-indexes>
|
||||
</t-indexes>
|
||||
|
||||
Reference in New Issue
Block a user