add button store diary list
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div v-can="pageAccess" class="store-diary-edit">
|
||||
<t-form class="form" label-align="left" label-width="5rem" v-entrance-transition>
|
||||
<t-form-item label="所属门店">
|
||||
<div class="picker-text" v-text="selectedStoreName" />
|
||||
</t-form-item>
|
||||
<t-form-item label="日记标题" required-mark>
|
||||
<t-input
|
||||
v-model.trim="article.title"
|
||||
@@ -127,6 +124,11 @@ function updateArticle(value: ArticleEditorArticle): void {
|
||||
};
|
||||
}
|
||||
|
||||
function getCreateTitle(): string {
|
||||
const title = route.query.title;
|
||||
return Array.isArray(title) ? String(title[0] || "") : String(title || "");
|
||||
}
|
||||
|
||||
// ---------- 附加照片 ----------
|
||||
|
||||
const photoInputRef = ref<HTMLInputElement>();
|
||||
@@ -204,12 +206,6 @@ function buildAdditionalAttachmentList(): Attachment[] {
|
||||
});
|
||||
}
|
||||
|
||||
const selectedStoreName = computed(() => {
|
||||
const store = currentStoreStore.storeList.find(item => item.id === article.value.bizId)
|
||||
|| (currentStoreStore.loginStore?.id === article.value.bizId ? currentStoreStore.loginStore : undefined);
|
||||
return store?.name || store?.code || "请选择门店";
|
||||
});
|
||||
|
||||
// ---------- 媒体上传 ----------
|
||||
|
||||
async function uploadMedia(file: File): Promise<UploadResult> {
|
||||
@@ -334,6 +330,7 @@ async function loadArticle(): Promise<void> {
|
||||
if (isCreateMode.value) {
|
||||
article.value = {
|
||||
...createEmptyArticle(),
|
||||
title: getCreateTitle(),
|
||||
bizId: article.value.bizId || currentStoreStore.currentStoreId
|
||||
};
|
||||
photoItemList.value = [];
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<template>
|
||||
<div v-can="permissionCodes.storeDiary.read" class="store-diary-list">
|
||||
<t-pull-down-refresh
|
||||
class="list-wrapper"
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="refresh"
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<t-pull-down-refresh
|
||||
v-can="permissionCodes.storeDiary.read"
|
||||
class="store-diary-list"
|
||||
v-model="isRefreshing"
|
||||
:refresh-timeout="30000"
|
||||
@refresh="refresh"
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<div class="content">
|
||||
<section class="calendar" v-entrance-transition>
|
||||
<t-calendar
|
||||
:key="calendarRenderKey"
|
||||
@@ -20,6 +21,15 @@
|
||||
@select="selectCalendarDate"
|
||||
/>
|
||||
</section>
|
||||
<t-button
|
||||
v-if="canCreate"
|
||||
class="cell-button"
|
||||
theme="primary"
|
||||
block
|
||||
@click="toCreateToday"
|
||||
>
|
||||
新增今天日记
|
||||
</t-button>
|
||||
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line" theme="card">
|
||||
<t-swipe-cell
|
||||
v-for="(item, index) in pageResult.list"
|
||||
@@ -41,8 +51,8 @@
|
||||
</t-swipe-cell>
|
||||
</t-cell-group>
|
||||
<div class="center-tips" v-text="loadStateText" />
|
||||
</t-pull-down-refresh>
|
||||
</div>
|
||||
</div>
|
||||
</t-pull-down-refresh>
|
||||
<nav-bar-action-menu v-if="canShowActionMenu" :actions="actionList" />
|
||||
<bottom-popup
|
||||
v-model="diaryPopupVisible"
|
||||
@@ -343,6 +353,13 @@ async function toCreate(): Promise<void> {
|
||||
await router.push({ name: "StoreDiaryCreate" });
|
||||
}
|
||||
|
||||
async function toCreateToday(): Promise<void> {
|
||||
await router.push({
|
||||
name: "StoreDiaryCreate",
|
||||
query: { title: Time.formatDate(new Date()) }
|
||||
});
|
||||
}
|
||||
|
||||
async function toDetail(item: StoreDiary): Promise<void> {
|
||||
if (!item.id) {
|
||||
return;
|
||||
@@ -417,12 +434,15 @@ onUnmounted(() => navBarStore.clearRight());
|
||||
<style scoped lang="less">
|
||||
.store-diary-list {
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
|
||||
min-height: 70vh;
|
||||
|
||||
.list-wrapper {
|
||||
min-height: 70vh;
|
||||
.content {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.calendar {
|
||||
margin: 0 1rem 1rem;
|
||||
margin: 0 1rem;
|
||||
overflow: hidden;
|
||||
background: var(--td-bg-color-container);
|
||||
box-shadow: var(--td-shadow-1);
|
||||
@@ -460,13 +480,13 @@ onUnmounted(() => navBarStore.clearRight());
|
||||
.items {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.center-tips {
|
||||
padding: 1rem;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: .8125rem;
|
||||
text-align: center;
|
||||
.center-tips {
|
||||
padding: 1rem;
|
||||
color: var(--td-text-color-placeholder);
|
||||
font-size: .8125rem;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user