|
|
@@ -44,7 +44,7 @@
|
|
|
<view class="schedule_container">
|
|
|
<view class="schedule_header">
|
|
|
<text class="schedule_date">{{ selectedDate }}</text>
|
|
|
- <view class="add_btn" @click="handleAddSchedule">
|
|
|
+ <view v-if="isSchoolManager" class="add_btn" @click="handleAddSchedule">
|
|
|
<!-- <uni-icons type="plus-filled" size="24" color="#fff"></uni-icons> -->
|
|
|
<image src="@/static/image/workspace/add.png" class="add_icon" mode="aspectFit"></image>
|
|
|
<text>新增日程</text>
|
|
|
@@ -59,7 +59,7 @@
|
|
|
<view class="schedule_text_container">
|
|
|
<text class="schedule_text" :class="{ expanded: expandedItems[item.id] }">{{ item.title }}</text>
|
|
|
</view>
|
|
|
- <view class="schedule_actions">
|
|
|
+ <view v-if="isSchoolManager" class="schedule_actions">
|
|
|
<text class="action_btn delete" @click="handleDelete(item.id)">删除</text>
|
|
|
<text class="action_btn edit" @click="handleEdit(item)">编辑</text>
|
|
|
</view>
|
|
|
@@ -94,13 +94,20 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, computed, onMounted } from 'vue';
|
|
|
+import { useStore } from 'vuex';
|
|
|
import workspaceApi from '@/reqApi/workspace';
|
|
|
import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
|
|
|
import { useSafeArea } from '@/common/safeArea';
|
|
|
import commonHeader from '@/components/commonHeader.vue';
|
|
|
import NoData from '@/components/noData.vue';
|
|
|
|
|
|
+const store = useStore();
|
|
|
const { statusBarHeight, safeAreaBottom, initSafeArea } = useSafeArea();
|
|
|
+const isSchoolManager = computed(() => {
|
|
|
+ const userInfo = store.state.userStore.userInfo || uni.getStorageSync('userInfo') || {};
|
|
|
+ const roleCodes = userInfo.roleCodes || [];
|
|
|
+ return Array.isArray(roleCodes) && roleCodes.includes('SCHOOL_MANAGER');
|
|
|
+});
|
|
|
|
|
|
interface CalendarDay {
|
|
|
date: number;
|
|
|
@@ -265,18 +272,21 @@ const handleBack = () => {
|
|
|
};
|
|
|
|
|
|
const handleAddSchedule = () => {
|
|
|
+ if (!isSchoolManager.value) return;
|
|
|
editItem.value = null;
|
|
|
scheduleContent.value = '';
|
|
|
showAddModal.value = true;
|
|
|
};
|
|
|
|
|
|
const handleEdit = (item: { id: string; title: string }) => {
|
|
|
+ if (!isSchoolManager.value) return;
|
|
|
editItem.value = item;
|
|
|
scheduleContent.value = item.title;
|
|
|
showAddModal.value = true;
|
|
|
};
|
|
|
|
|
|
const handleDelete = async (id: string) => {
|
|
|
+ if (!isSchoolManager.value) return;
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '确定要删除这条日程吗?',
|
|
|
@@ -302,6 +312,7 @@ const handleCloseModal = () => {
|
|
|
};
|
|
|
|
|
|
const handleConfirmSchedule = async () => {
|
|
|
+ if (!isSchoolManager.value) return;
|
|
|
if (!scheduleContent.value.trim()) {
|
|
|
uni.showToast({ title: '请输入日程内容', icon: 'none' });
|
|
|
return;
|