index.vue 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. <template>
  2. <view class="page_workspace"
  3. :style="{ paddingBottom: safeAreaBottom + 150 + 'rpx' }">
  4. <!-- <pageHeader></pageHeader> -->
  5. <nav-bar height="112" :title="state.schoolName" rightType="select" :onlyTitle="false" :showFilterPicker="false" :showTabs="false" :showTabBtns="false" leftWidth="0rpx" rightWidth="0rpx">
  6. <template #headRightIcon>
  7. <view class="select_box" v-if="schoolsList?.length>1" @click="ChangeSchoolInfo">
  8. <view class="select_label">切换学校</view>
  9. <image src="@/static/image/icon/arrow_down.png" class="select_icon"></image>
  10. </view>
  11. </template>
  12. </nav-bar>
  13. <view class="workspace_content">
  14. <!-- 系统列表 -->
  15. <view class="system_list">
  16. <template v-if="largeCard?.visible">
  17. <view class="system_grid_with_large">
  18. <view class="large_card" @click="handleSystemClick(largeCard)">
  19. <view class="card_dot" >
  20. <img :src="getModulePermission(largeCard.id) == 1 ? './static/image/workspace/throughIcon.png' : './static/image/workspace/authorityIcon.png'" class="dot_img" alt="">
  21. </view>
  22. <image :src="largeCard.image" class="large_icon" mode="aspectFit"></image>
  23. <text class="large_name">{{ largeCard.name }}</text>
  24. </view>
  25. <view class="right_top_grid">
  26. <view v-for="(item, index) in rightTopCards" :key="index" class="small_item"
  27. @click="handleSystemClick(item)">
  28. <view class="card_dot" >
  29. <img :src="getModulePermission(item.id) == 1 ? './static/image/workspace/throughIcon.png' : './static/image/workspace/authorityIcon.png'" class="dot_img" alt="">
  30. </view>
  31. <image :src="item.image" class="small_icon" mode="aspectFit"></image>
  32. <text class="small_name">{{ item.name }}</text>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="bottom_grid">
  37. <view v-for="(item, index) in bottomCards" :key="index" class="small_item"
  38. @click="handleSystemClick(item)">
  39. <view class="card_dot" >
  40. <img :src="getModulePermission(item.id) == 1 ? './static/image/workspace/throughIcon.png' : './static/image/workspace/authorityIcon.png'" class="dot_img" alt="">
  41. </view>
  42. <image :src="item.image" class="small_icon" mode="aspectFit"></image>
  43. <text class="small_name">{{ item.name }}</text>
  44. </view>
  45. </view>
  46. </template>
  47. <template v-else>
  48. <view class="system_grid_full">
  49. <view v-for="(item, index) in allSmallCards" :key="index" class="small_item"
  50. @click="handleSystemClick(item)">
  51. <view class="card_dot" :class="{ 'dot-green': getModulePermission(item.id) == 1, 'dot-red': getModulePermission(item.id) == 0 }"></view>
  52. <image :src="item.image" class="small_icon" mode="aspectFit"></image>
  53. <text class="small_name">{{ item.name }}</text>
  54. </view>
  55. </view>
  56. </template>
  57. </view>
  58. <!-- 校历安排 -->
  59. <view class="calendar_section">
  60. <view class="calendar_header">
  61. <text class="section_title">校历安排</text>
  62. <text class="view_schedule" @click="handleViewSchedule">查看日程</text>
  63. </view>
  64. <!-- 日历工具栏 -->
  65. <view class="calendar_toolbar">
  66. <view class="year_month_select">
  67. <picker :value="yearIndex" :range="yearList" @change="handleYearChange" class="select_item">
  68. <view class="select_content">
  69. <text class="select_text">{{ yearList[yearIndex] }}</text>
  70. <uni-icons type="down" size="20" color="#999999"></uni-icons>
  71. </view>
  72. </picker>
  73. <picker :value="monthIndex" :range="monthList" @change="handleMonthChange" class="select_item">
  74. <view class="select_content">
  75. <text class="select_text">{{ monthList[monthIndex] }}</text>
  76. <uni-icons type="down" size="20" color="#999999"></uni-icons>
  77. </view>
  78. </picker>
  79. </view>
  80. <view class="week_nav">
  81. <view class="nav_btn" @click="handlePrevWeek">
  82. <text class="nav_text">上一周</text>
  83. </view>
  84. <view class="nav_btn" @click="handleNextWeek">
  85. <text class="nav_text">下一周</text>
  86. </view>
  87. </view>
  88. </view>
  89. <!-- 日历网格 -->
  90. <view v-if="isLoading" class="loading-container">
  91. <view class="loading-spinner"></view>
  92. <text class="loading-text">加载中...</text>
  93. </view>
  94. <view v-else class="calendar_grid">
  95. <view class="calendar_weekday">
  96. <text v-for="day in weekdays" :key="day" class="weekday_text">{{ day }}</text>
  97. </view>
  98. <view class="calendar_days">
  99. <view v-for="day in calendarDays" :key="day.fullDate" class="day_item"
  100. :class="{ active: day.isActive, weekend: day.isWeekend, today: day.isToday }"
  101. @click="handleDayClick(day)">
  102. <text class="day_text">{{ day.date }}</text>
  103. <view class="schedule_dot" :class="{ visible: day.hasSchedule }"></view>
  104. </view>
  105. </view>
  106. </view>
  107. <!-- 日程列表 -->
  108. <view class="schedule_list">
  109. <view class="schedule_title">当日日程</view>
  110. <noData v-if="scheduleList.length === 0" text="暂无日程安排" />
  111. <view v-else v-for="item in scheduleList" :key="item.id" class="schedule_item">
  112. <view class="schedule_dot"></view>
  113. <view class="schedule_text_container">
  114. <text class="schedule_text" :class="{ expanded: expandedItems[item.id] }">{{ item.title
  115. }}</text>
  116. </view>
  117. </view>
  118. </view>
  119. <view v-if="isSchoolManager" class="add_schedule_btn" @click="handleAddSchedule">
  120. <image src="@/static/image/workspace/add_icon.png" class="add_icon" mode="aspectFit"></image>
  121. <text class="btn_text">新增日程</text>
  122. </view>
  123. </view>
  124. </view>
  125. <view v-if="showAddScheduleModal" class="modal-overlay" @click="handleCloseModal">
  126. <view class="modal-content" @click.stop>
  127. <view class="modal-header">
  128. <text class="modal-title">新增日程</text>
  129. <view class="modal-close" @click="handleCloseModal">
  130. <image src="@/static/image/workspace/close.png" class="close-icon" mode="aspectFit"></image>
  131. </view>
  132. </view>
  133. <view class="modal-body">
  134. <text class="modal-date">{{ currentYear }}-{{ String(currentMonth).padStart(2, '0') }}-{{
  135. String(currentDay).padStart(2, '0') }}日程</text>
  136. <textarea class="schedule-textarea" v-model="scheduleContent" placeholder="请输入日程内容"
  137. placeholder-class="textarea-placeholder"></textarea>
  138. </view>
  139. <view class="modal-footer">
  140. <view class="modal-btn cancel-btn" @click="handleCloseModal">
  141. <text>取消</text>
  142. </view>
  143. <view class="modal-btn confirm-btn" @click="handleConfirmSchedule">
  144. <text>确定</text>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. </view>
  150. <common-tabbar></common-tabbar>
  151. <!-- 提示框 -->
  152. <popup-dialog ref="schoolPopupDialogRef" popType="custom" title="选择学校" @DialogConfirm="DialogSchoolConfirm">
  153. <view class="school_list">
  154. <view :class="['list_item',{active:state.schoolId==item.schoolId}]" @click="SelectSchool(item.schoolId)" v-for="item in schoolsList" :key="item.schoolId">
  155. <view class="school_logo">
  156. <image class="logo" v-if="item.schoolLogoUrl" :src="item.schoolLogoUrl"></image>
  157. <image class="logo" v-else src="@/static/image/bg/default_user.png"></image>
  158. </view>
  159. <text class="school_name">{{item.schoolName}}</text>
  160. <uni-icons class="item_right" type="right"></uni-icons>
  161. </view>
  162. </view>
  163. </popup-dialog>
  164. </template>
  165. <script setup>
  166. import { ref, onMounted,reactive, computed } from 'vue';
  167. import { onShow } from '@dcloudio/uni-app';
  168. import { useStore } from 'vuex';
  169. import workspaceApi from '@/reqApi/workspace.js';
  170. import navBar from '@/components/navBar.vue';
  171. import popupDialog from '@/components/popupDialog.vue';
  172. // import PageHeader from '@/components/pageHeader.vue';
  173. import NoData from '@/components/noData.vue';
  174. import CommonTabbar from '@/components/commonTabbar.vue';
  175. import { useSafeArea } from '@/common/safeArea';
  176. import user from '@/reqApi/user.js';
  177. const store = useStore();
  178. const { statusBarHeight, safeAreaBottom, initSafeArea } = useSafeArea();
  179. const systemItems = ref([
  180. { name: '大数据精准教学诊断平台', id: '1', key: 'bigData', image: '/static/image/workspace/iconLeft.png', isLarge: true, visible: true },
  181. { name: '选择题判分', id: '3', key: '', image: '/static/image/workspace/icon1.png', isLarge: false, visible: true },
  182. { name: '材料采集', id: '7', key: 'materialCollection', image: '/static/image/workspace/icon2.png', isLarge: false, visible: true },
  183. { name: '教师研修', id: '9', key: 'teacherStudy', image: '/static/image/workspace/icon3.png', isLarge: false, visible: true },
  184. { name: '学生学习', id: '13', key: 'studentStudy', image: '/static/image/workspace/icon4.png', isLarge: false, visible: true },
  185. { name: '智能选课', id: '4', key: '', image: '/static/image/workspace/icon5.png', isLarge: false, visible: true },
  186. { name: '教师发展', id: '8', key: 'teacherHonor', image: '/static/image/workspace/icon6.png', isLarge: false, visible: true },
  187. { name: '协同备课', id: '10', key: '', image: '/static/image/workspace/icon7.png', isLarge: false, visible: true },
  188. { name: '校内通知', id: '12', key: 'notice', image: '/static/image/workspace/icon8.png', isLarge: false, visible: true },
  189. { name: '评教评学', id: '5', key: '', image: '/static/image/workspace/icon9.png', isLarge: false, visible: true },
  190. { name: '考场编排', id: '6', key: '', image: '/static/image/workspace/icon10.png', isLarge: false, visible: true },
  191. { name: '听课评课', id: '11', key: '', image: '/static/image/workspace/icon11.png', isLarge: false, visible: true },
  192. { name: '基础数据', id: '2', key: '', image: '/static/image/workspace/icon12.png', isLarge: false, visible: true }
  193. ]);
  194. const schoolPopupDialogRef = ref(null);//选择学校
  195. const schoolsList = computed(()=>store.state.userStore.schoolsList);
  196. const isSchoolManager = computed(() => {
  197. const userInfo = store.state.userStore.userInfo || uni.getStorageSync('userInfo') || {};
  198. const roleCodes = userInfo.roleCodes || [];
  199. return Array.isArray(roleCodes) && roleCodes.includes('SCHOOL_MANAGER');
  200. });
  201. const state = reactive({
  202. schoolName:'',
  203. schoolId:''
  204. });
  205. const modulesList = ref([]);
  206. const moduleMap = computed(() => {
  207. const map = {};
  208. (modulesList.value || []).forEach(item => {
  209. if (item == null || item.id == null) return;
  210. map[String(item.id)] = item;
  211. });
  212. return map;
  213. });
  214. const getModulePermission = (itemId) => {
  215. const module = moduleMap.value[String(itemId)];
  216. return module && module.isSelect == 1 ? 1 : 0;
  217. };
  218. const largeCard = computed(() => systemItems.value.find(item => item.isLarge));
  219. const smallCards = computed(() => systemItems.value.filter(item => !item.isLarge));
  220. const rightTopCards = computed(() => smallCards.value.slice(0, 4));
  221. const bottomCards = computed(() => smallCards.value.slice(4));
  222. const allSmallCards = computed(() => smallCards.value);
  223. const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
  224. const calendarDays = ref([]);
  225. const scheduleEvents = ref({});
  226. const isLoading = ref(false);
  227. const today = new Date();
  228. const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`;
  229. const currentYear = ref(new Date().getFullYear());
  230. const currentMonth = ref(new Date().getMonth() + 1);
  231. const currentDay = ref(new Date().getDate());
  232. const weekStartDate = ref(null);
  233. const weekEndDate = ref(null);
  234. const yearList = ref([]);
  235. const monthList = ref([]);
  236. const yearIndex = ref(0);
  237. const monthIndex = ref(0);
  238. const expandedItems = ref({});
  239. const toggleExpand = (id) => {
  240. expandedItems.value[id] = !expandedItems.value[id];
  241. };
  242. const scheduleList = computed(() => {
  243. const dateKey = `${currentYear.value}-${String(currentMonth.value).padStart(2, '0')}-${String(currentDay.value).padStart(2, '0')}`;
  244. return scheduleEvents.value[dateKey] || [];
  245. });
  246. const weekDateRange = computed(() => {
  247. if (!weekStartDate.value || !weekEndDate.value) return '';
  248. return `${weekStartDate.value.getFullYear()}年${weekStartDate.value.getMonth() + 1}月${weekStartDate.value.getDate()}日 - ${weekEndDate.value.getFullYear()}年${weekEndDate.value.getMonth() + 1}月${weekEndDate.value.getDate()}日`;
  249. });
  250. const generateYearList = () => {
  251. const years = [];
  252. for (let i = currentYear.value - 5; i <= currentYear.value + 5; i++) {
  253. years.push(`${i}年`);
  254. }
  255. yearList.value = years;
  256. };
  257. const generateMonthList = () => {
  258. const months = [];
  259. for (let i = 1; i <= 12; i++) {
  260. months.push(`${i}月`);
  261. }
  262. monthList.value = months;
  263. };
  264. const getWeekRange = (date) => {
  265. const d = new Date(date);
  266. const day = d.getDay();
  267. const diff = day === 0 ? -6 : 1 - day;
  268. const monday = new Date(d);
  269. monday.setDate(d.getDate() + diff);
  270. monday.setHours(0, 0, 0, 0);
  271. const sunday = new Date(monday);
  272. sunday.setDate(monday.getDate() + 6);
  273. sunday.setHours(23, 59, 59, 999);
  274. return { monday, sunday };
  275. };
  276. const updateCalendarDays = () => {
  277. const days = [];
  278. const { monday } = getWeekRange(new Date(currentYear.value, currentMonth.value - 1, currentDay.value));
  279. weekStartDate.value = monday;
  280. const sunday = new Date(monday);
  281. sunday.setDate(monday.getDate() + 6);
  282. weekEndDate.value = sunday;
  283. for (let i = 0; i < 7; i++) {
  284. const date = new Date(monday);
  285. date.setDate(monday.getDate() + i);
  286. const dayOfWeek = date.getDay();
  287. const dateKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
  288. days.push({
  289. date: date.getDate(),
  290. fullDate: dateKey,
  291. year: date.getFullYear(),
  292. month: date.getMonth() + 1,
  293. isActive: date.getDate() === currentDay.value && date.getMonth() + 1 === currentMonth.value && date.getFullYear() === currentYear.value,
  294. isWeekend: dayOfWeek === 0 || dayOfWeek === 6,
  295. isToday: dateKey === todayStr,
  296. hasSchedule: !!scheduleEvents.value[dateKey] && scheduleEvents.value[dateKey].length > 0
  297. });
  298. }
  299. calendarDays.value = days;
  300. };
  301. const fetchScheduleList = async () => {
  302. const { monday, sunday } = getWeekRange(new Date(currentYear.value, currentMonth.value - 1, currentDay.value));
  303. const startDate = `${monday.getFullYear()}-${String(monday.getMonth() + 1).padStart(2, '0')}-${String(monday.getDate()).padStart(2, '0')}`;
  304. const endDate = `${sunday.getFullYear()}-${String(sunday.getMonth() + 1).padStart(2, '0')}-${String(sunday.getDate()).padStart(2, '0')}`;
  305. isLoading.value = true;
  306. try {
  307. const res = await workspaceApi.getSchedule({ startDate, endDate });
  308. updateScheduleEvents(res.data);
  309. } catch (error) {
  310. console.error('获取日程列表失败:', error);
  311. uni.showToast({ title: '获取日程失败,请稍后重试', icon: 'none', duration: 3000 });
  312. } finally {
  313. isLoading.value = false;
  314. }
  315. };
  316. const updateScheduleEvents = (data) => {
  317. Object.keys(scheduleEvents.value).forEach(key => {
  318. delete scheduleEvents.value[key];
  319. });
  320. Object.keys(data).forEach(dateKey => {
  321. const list = data[dateKey] || [];
  322. scheduleEvents.value[dateKey] = list.map(item => ({
  323. id: String(item.id),
  324. title: item.content || ''
  325. }));
  326. });
  327. updateCalendarDays();
  328. };
  329. const updateYearMonthIndex = () => {
  330. yearIndex.value = yearList.value.indexOf(`${currentYear.value}年`);
  331. monthIndex.value = monthList.value.indexOf(`${currentMonth.value}月`);
  332. };
  333. onMounted(() => {
  334. getSchoolInfo();
  335. initSafeArea();
  336. generateYearList();
  337. generateMonthList();
  338. updateYearMonthIndex();
  339. updateCalendarDays();
  340. });
  341. onShow(() => {
  342. pageInit();
  343. });
  344. const getSchoolsList = () => {
  345. const list = store.state.userStore.schoolsList || uni.getStorageSync('schoolsList') || [];
  346. return Array.isArray(list) ? list : [];
  347. };
  348. const getLoginSchoolModules = () => {
  349. const schools = getSchoolsList();
  350. const schoolId = store.state.userStore.userInfo?.schoolId || state.schoolId;
  351. const currentSchool = schools.find(item => item && item.schoolId == schoolId);
  352. const school = currentSchool || schools[0];
  353. if (school && school.modules != null) {
  354. return Array.isArray(school.modules) ? school.modules : [];
  355. }
  356. const schoolWithModules = schools.find(item => item && item.modules != null);
  357. if (schoolWithModules) {
  358. return Array.isArray(schoolWithModules.modules) ? schoolWithModules.modules : [];
  359. }
  360. return null;
  361. };
  362. const resolveModulesList = () => {
  363. const loginModules = getLoginSchoolModules();
  364. if (loginModules != null) {
  365. return loginModules;
  366. }
  367. const fromStore = store.state.userStore.modulesList;
  368. if (Array.isArray(fromStore) && fromStore.length) {
  369. return fromStore;
  370. }
  371. const fromStorage = uni.getStorageSync('modulesList');
  372. if (Array.isArray(fromStorage) && fromStorage.length) {
  373. return fromStorage;
  374. }
  375. return [];
  376. };
  377. const pageInit = () => {
  378. const modules = resolveModulesList();
  379. modulesList.value = modules;
  380. store.dispatch('setModulesList', modules);
  381. uni.setStorageSync('modulesList', modules);
  382. fetchScheduleList();
  383. }
  384. const handleSystemClick = (item) => {
  385. console.log(item,9888)
  386. const isSelect = getModulePermission(item.id);
  387. if (isSelect != 1) {
  388. uni.showToast({ title: '暂无权限,敬请期待!', icon: 'none' });
  389. return;
  390. }
  391. if (item.key === 'notice') {
  392. const userInfo = store.state.userStore.userInfo || uni.getStorageSync('userInfo') || {};
  393. const roleCodes = userInfo.roleCodes || [];
  394. const isSchoolManager = Array.isArray(roleCodes) && roleCodes.includes('SCHOOL_MANAGER');
  395. if (isSchoolManager) {
  396. uni.navigateTo({
  397. url: '/pages/notice/overview/index'
  398. });
  399. } else {
  400. uni.navigateTo({
  401. url: '/pages/notice/mine/index?hideTabbar=true'
  402. });
  403. }
  404. } else if (item.key === 'materialCollection' || item.key == 'teacherStudy' || item.key == 'studentStudy' || item.key == 'teacherHonor') {//材料采集 教师研修 学生学习 教师发展
  405. uni.navigateTo({
  406. url: `/pages/${item.key}/index`
  407. });
  408. }else if(item.key === 'bigData'){
  409. uni.navigateTo({
  410. url: `/pages/webview/teacherApp`
  411. });
  412. } else {
  413. uni.showToast({ title: `即将打开:${item.name}`, icon: 'none' });
  414. }
  415. };
  416. const handleViewSchedule = () => {
  417. uni.navigateTo({
  418. url: '/pages/workspace/schedule'
  419. });
  420. };
  421. const handlePrevWeek = () => {
  422. const currentDate = new Date(currentYear.value, currentMonth.value - 1, currentDay.value);
  423. currentDate.setDate(currentDate.getDate() - 7);
  424. currentYear.value = currentDate.getFullYear();
  425. currentMonth.value = currentDate.getMonth() + 1;
  426. currentDay.value = currentDate.getDate();
  427. updateYearMonthIndex();
  428. updateCalendarDays();
  429. fetchScheduleList();
  430. };
  431. const handleNextWeek = () => {
  432. const currentDate = new Date(currentYear.value, currentMonth.value - 1, currentDay.value);
  433. currentDate.setDate(currentDate.getDate() + 7);
  434. currentYear.value = currentDate.getFullYear();
  435. currentMonth.value = currentDate.getMonth() + 1;
  436. currentDay.value = currentDate.getDate();
  437. updateYearMonthIndex();
  438. updateCalendarDays();
  439. fetchScheduleList();
  440. };
  441. const handleDayClick = (day) => {
  442. calendarDays.value.forEach(d => d.isActive = false);
  443. day.isActive = true;
  444. currentYear.value = day.year;
  445. currentMonth.value = day.month;
  446. currentDay.value = day.date;
  447. updateYearMonthIndex();
  448. };
  449. const handleYearChange = (e) => {
  450. yearIndex.value = e.detail.value;
  451. currentYear.value = parseInt(yearList.value[e.detail.value].replace('年', ''));
  452. updateCalendarDays();
  453. fetchScheduleList();
  454. };
  455. const handleMonthChange = (e) => {
  456. monthIndex.value = e.detail.value;
  457. currentMonth.value = parseInt(monthList.value[e.detail.value].replace('月', ''));
  458. updateCalendarDays();
  459. fetchScheduleList();
  460. };
  461. const showAddScheduleModal = ref(false);
  462. const scheduleContent = ref('');
  463. const handleAddSchedule = () => {
  464. if (!isSchoolManager.value) return;
  465. showAddScheduleModal.value = true;
  466. scheduleContent.value = '';
  467. };
  468. const handleCloseModal = () => {
  469. showAddScheduleModal.value = false;
  470. scheduleContent.value = '';
  471. };
  472. const handleConfirmSchedule = async () => {
  473. if (!scheduleContent.value.trim()) {
  474. uni.showToast({ title: '请输入日程内容', icon: 'none' });
  475. return;
  476. }
  477. const scheduleDate = `${currentYear.value}-${String(currentMonth.value).padStart(2, '0')}-${String(currentDay.value).padStart(2, '0')}`;
  478. try {
  479. await workspaceApi.saveSchedule({
  480. content: scheduleContent.value.trim(),
  481. scheduleDate
  482. });
  483. uni.showToast({ title: '添加成功', icon: 'success' });
  484. showAddScheduleModal.value = false;
  485. scheduleContent.value = '';
  486. fetchScheduleList();
  487. } catch (error) {
  488. console.error('添加日程失败:', error);
  489. uni.showToast({ title: '添加日程失败,请稍后重试', icon: 'none', duration: 3000 });
  490. }
  491. };
  492. //获取学生信息
  493. const getSchoolInfo = () => {
  494. state.schoolName = store.state.userStore.userInfo.schoolName;
  495. state.schoolId = store.state.userStore.userInfo.schoolId;
  496. }
  497. //切换学校弹框
  498. const ChangeSchoolInfo = () => {
  499. schoolPopupDialogRef.value.OpenDialog();
  500. }
  501. const SelectSchool = (schoolId) => {
  502. state.schoolId = schoolId;
  503. }
  504. //切换学校
  505. const DialogSchoolConfirm = () => {
  506. user.chooseBelongSchool({
  507. schoolId:state.schoolId,
  508. deviceType:'APP'
  509. }).then(async res=>{
  510. if(res.code == 200){
  511. // state.schoolName = res?.data?.schoolName || '';
  512. const modules = res?.data?.modules || [];
  513. store.dispatch('setModulesList', modules);
  514. uni.setStorageSync('modulesList', modules);
  515. await store.dispatch('setUserInfo');
  516. pageInit();
  517. }
  518. })
  519. }
  520. </script>
  521. <style lang="scss">
  522. $primary-color: #2E64FA;
  523. $text-primary: #333333;
  524. $text-secondary: #666666;
  525. $text-tertiary: #999999;
  526. $bg-color: #F5F7FA;
  527. $bg-white: #FFFFFF;
  528. $border-color: #F0F0F0;
  529. $header-border: #EEEEEE;
  530. $font-lg: 44rpx;
  531. $font-md: 34rpx;
  532. $font-sm: 32rpx;
  533. $font-xs: 26rpx;
  534. $font-xxs: 24rpx;
  535. $radius-lg: 20rpx;
  536. $radius-md: 12rpx;
  537. $radius-sm: 8rpx;
  538. $radius-circle: 50%;
  539. $spacing-xl: 80rpx;
  540. $spacing-lg: 32rpx;
  541. $spacing-md: 24rpx;
  542. $spacing-sm: 24rpx;
  543. $spacing-xs: 16rpx;
  544. $spacing-xxs: 12rpx;
  545. $shadow-sm: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  546. @mixin flex-center {
  547. display: flex;
  548. justify-content: center;
  549. align-items: center;
  550. }
  551. @mixin flex-between {
  552. display: flex;
  553. justify-content: space-between;
  554. align-items: center;
  555. }
  556. @mixin flex-column {
  557. display: flex;
  558. flex-direction: column;
  559. align-items: center;
  560. }
  561. @mixin bg-card {
  562. background-color: $bg-white;
  563. border-radius: $radius-lg;
  564. padding: $spacing-md;
  565. }
  566. @mixin text-ellipsis {
  567. overflow: hidden;
  568. text-overflow: ellipsis;
  569. white-space: nowrap;
  570. }
  571. .page_workspace {
  572. height: 100vh;
  573. display: flex;
  574. flex-direction: column;
  575. background-color: #F8F9FD;
  576. box-sizing: border-box;
  577. overflow: hidden;
  578. }
  579. .workspace_content {
  580. padding: 24rpx 24rpx 0;
  581. flex:1;
  582. box-sizing: border-box;
  583. overflow: auto;
  584. }
  585. // 系统列表
  586. .system_list {
  587. @include bg-card;
  588. margin-bottom: $spacing-sm;
  589. .section_title {
  590. font-size: $font-sm;
  591. font-weight: 500;
  592. color: $text-primary;
  593. margin-bottom: $spacing-sm;
  594. }
  595. .system_grid_with_large {
  596. display: flex;
  597. gap: 20rpx;
  598. margin-bottom: 20rpx;
  599. .large_card {
  600. flex: 1;
  601. display: flex;
  602. flex-direction: column;
  603. align-items: center;
  604. justify-content: center;
  605. background-color: #EAF0FF;
  606. border-radius: 20rpx;
  607. width: 324rpx;
  608. height: 352rpx;
  609. position: relative;
  610. .card_dot {
  611. position: absolute;
  612. top: -6rpx;
  613. right: -12rpx;
  614. width: 32rpx;
  615. height: 32rpx;
  616. img {
  617. width: 100%;
  618. height: 100%;
  619. }
  620. }
  621. .dot-green {
  622. background-color: #52C41A;
  623. }
  624. .dot-red {
  625. background-color: #F5222D;
  626. }
  627. .large_icon {
  628. width: 160rpx;
  629. height: 160rpx;
  630. margin-bottom: 32rpx;
  631. }
  632. .large_name {
  633. font-size: 32rpx;
  634. color: #333333;
  635. font-weight: 500;
  636. text-align: center;
  637. line-height: 48rpx;
  638. width: 276rpx;
  639. }
  640. }
  641. .right_top_grid {
  642. flex: 1;
  643. display: grid;
  644. grid-template-columns: repeat(2, 1fr);
  645. gap: 16rpx;
  646. .small_item {
  647. display: flex;
  648. flex-direction: column;
  649. align-items: center;
  650. justify-content: center;
  651. background-color: #FFFFFF;
  652. position: relative;
  653. .card_dot {
  654. position: absolute;
  655. top: -2rpx;
  656. right: 12rpx;
  657. width: 32rpx;
  658. height: 32rpx;
  659. z-index: 10;
  660. img{
  661. width: 32rpx;
  662. height: 32rpx;
  663. }
  664. }
  665. .dot-green {
  666. background-color: #52C41A;
  667. }
  668. .dot-red {
  669. background-color: #F5222D;
  670. }
  671. .small_icon {
  672. width: 96rpx;
  673. height: 96rpx;
  674. margin-bottom: 20rpx;
  675. }
  676. .small_name {
  677. font-size: 28rpx;
  678. color: $text-secondary;
  679. text-align: center;
  680. }
  681. }
  682. }
  683. }
  684. .bottom_grid {
  685. display: grid;
  686. grid-template-columns: repeat(4, 1fr);
  687. gap: 16rpx;
  688. .small_item {
  689. display: flex;
  690. flex-direction: column;
  691. align-items: center;
  692. justify-content: center;
  693. background-color: #FFFFFF;
  694. border-radius: 12rpx;
  695. padding: 20rpx 0;
  696. position: relative;
  697. .card_dot {
  698. position: absolute;
  699. top: 12rpx;
  700. right: 12rpx;
  701. width: 32rpx;
  702. height: 32rpx;
  703. z-index: 10;
  704. img{
  705. width: 32rpx;
  706. height: 32rpx;
  707. }
  708. }
  709. .dot-green {
  710. background-color: #52C41A;
  711. }
  712. .dot-red {
  713. background-color: #F5222D;
  714. }
  715. .small_icon {
  716. width: 96rpx;
  717. height: 96rpx;
  718. margin-bottom: 20rpx;
  719. }
  720. .small_name {
  721. font-size: 28rpx;
  722. color: $text-secondary;
  723. text-align: center;
  724. }
  725. }
  726. }
  727. .system_grid_full {
  728. display: grid;
  729. grid-template-columns: repeat(4, 1fr);
  730. gap: 16rpx;
  731. .small_item {
  732. display: flex;
  733. flex-direction: column;
  734. align-items: center;
  735. justify-content: center;
  736. background-color: #FFFFFF;
  737. border-radius: 12rpx;
  738. padding: 20rpx 0;
  739. position: relative;
  740. .card_dot {
  741. position: absolute;
  742. top: 12rpx;
  743. right: 12rpx;
  744. width: 12rpx;
  745. height: 12rpx;
  746. border-radius: 50%;
  747. img{
  748. width: 12rpx;
  749. height: 12rpx;
  750. }
  751. }
  752. .dot-green {
  753. background-color: #52C41A;
  754. }
  755. .dot-red {
  756. background-color: #F5222D;
  757. }
  758. .small_icon {
  759. width: 64rpx;
  760. height: 64rpx;
  761. margin-bottom: 12rpx;
  762. }
  763. .small_name {
  764. font-size: 22rpx;
  765. color: $text-secondary;
  766. text-align: center;
  767. }
  768. }
  769. }
  770. }
  771. // 日程
  772. .calendar_section {
  773. @include bg-card;
  774. .calendar_header {
  775. @include flex-between;
  776. margin-bottom: 32rpx;
  777. .section_title {
  778. font-size: $font-sm;
  779. font-weight: 500;
  780. color: $text-primary;
  781. }
  782. .view_schedule {
  783. font-size: 28rpx;
  784. color: $primary-color;
  785. }
  786. }
  787. .calendar_toolbar {
  788. display: flex;
  789. gap: 18rpx;
  790. padding-bottom: 32rpx;
  791. .year_month_select {
  792. display: flex;
  793. gap: 18rpx;
  794. flex: 1;
  795. .select_item {
  796. flex: 1;
  797. // @include flex-center;
  798. gap: 8rpx;
  799. padding: 0;
  800. height: 72rpx;
  801. background-color: #FFFFFF;
  802. border-radius: 8rpx;
  803. border: 2rpx solid #DCDFE6;
  804. .select_content {
  805. display: flex;
  806. justify-content: space-between;
  807. align-items: center;
  808. width: 81%;
  809. padding: 0 16rpx;
  810. height: 72rpx;
  811. }
  812. .select_text {
  813. font-size: $font-xs;
  814. color: $text-primary;
  815. }
  816. }
  817. }
  818. .week_nav {
  819. display: flex;
  820. gap: 18rpx;
  821. .nav_btn {
  822. width: 122rpx;
  823. height: 72rpx;
  824. @include flex-center;
  825. background-color: #FFFFFF;
  826. border-radius: 8rpx;
  827. border: 2rpx solid #DCDFE6;
  828. .nav_text {
  829. font-size: $font-xs;
  830. color: $text-secondary;
  831. }
  832. }
  833. }
  834. }
  835. .calendar_grid {
  836. margin-bottom: $spacing-lg;
  837. .calendar_weekday {
  838. display: flex;
  839. margin-bottom: $spacing-xs;
  840. .weekday_text {
  841. flex: 1;
  842. text-align: center;
  843. font-size: 28rpx;
  844. color: $text-secondary;
  845. }
  846. }
  847. .calendar_days {
  848. display: flex;
  849. justify-content: space-around;
  850. align-items: center;
  851. height: 80rpx;
  852. .day_item {
  853. flex-shrink: 0;
  854. box-sizing: border-box;
  855. display: flex;
  856. justify-content: center;
  857. align-items: center;
  858. width: 80rpx;
  859. height: 80rpx;
  860. border-radius: 50%;
  861. border: 2rpx solid transparent;
  862. position: relative;
  863. &.active {
  864. background-color: rgba(46, 100, 250, 0.1);
  865. border-color: #2E64FA;
  866. .day_text {
  867. color: #2E64FA;
  868. }
  869. }
  870. .day_text {
  871. font-size: $font-sm;
  872. color: $text-primary;
  873. }
  874. &.weekend:not(.active) {
  875. .day_text {
  876. color: #999999;
  877. }
  878. }
  879. .schedule_dot {
  880. position: absolute;
  881. bottom: 12rpx;
  882. width: 8rpx;
  883. height: 8rpx;
  884. background-color: transparent;
  885. border-radius: 50%;
  886. &.visible {
  887. background-color: #2E64FA;
  888. }
  889. }
  890. }
  891. }
  892. }
  893. .schedule_list {
  894. margin-bottom: $spacing-lg;
  895. background: #F9FAFF;
  896. border-radius: 20rpx 20rpx 20rpx 20rpx;
  897. padding: $spacing-lg;
  898. .schedule_title {
  899. font-size: 28rpx;
  900. font-weight: 500;
  901. color: $text-primary;
  902. margin-bottom: $spacing-xs;
  903. }
  904. .schedule_item {
  905. display: flex;
  906. align-items: flex-start;
  907. padding: 24rpx 0;
  908. border-bottom: 2rpx solid #EBEEF5;
  909. &:last-child {
  910. border-bottom: none;
  911. }
  912. .schedule_dot {
  913. width: 16rpx;
  914. height: 16rpx;
  915. background-color: $primary-color;
  916. border-radius: $radius-circle;
  917. margin-top: 14rpx;
  918. margin-right: 14rpx;
  919. flex-shrink: 0;
  920. }
  921. .schedule_text_container {
  922. flex: 1;
  923. position: relative;
  924. }
  925. .schedule_text {
  926. font-size: 28rpx;
  927. color: #666666;
  928. line-height: 1.6;
  929. display: -webkit-box;
  930. flex: 1;
  931. text-align: justify;
  932. &.expanded {
  933. -webkit-line-clamp: unset;
  934. overflow: visible;
  935. text-overflow: unset;
  936. padding-right: 0;
  937. }
  938. }
  939. .toggle_text {
  940. font-size: 28rpx;
  941. color: #2E64FA;
  942. position: absolute;
  943. right: 0;
  944. bottom: 0;
  945. line-height: 1.6;
  946. }
  947. }
  948. }
  949. .add_schedule_btn {
  950. @include flex-center;
  951. gap: 16rpx;
  952. height: 56rpx;
  953. background-color: #FFFFFF;
  954. border-radius: 12rpx 12rpx 12rpx 12rpx;
  955. ;
  956. border: 1px solid #2E64FA;
  957. .btn_text {
  958. font-size: 28rpx;
  959. color: #2E64FA;
  960. font-weight: 500;
  961. }
  962. .add_icon {
  963. width: 32rpx;
  964. height: 32rpx;
  965. }
  966. }
  967. }
  968. .modal-overlay {
  969. position: fixed;
  970. top: 0;
  971. left: 0;
  972. right: 0;
  973. bottom: 0;
  974. background-color: rgba(0, 0, 0, 0.5);
  975. display: flex;
  976. justify-content: center;
  977. align-items: center;
  978. z-index: 1000;
  979. }
  980. .modal-content {
  981. width: 702rpx;
  982. background-color: #FFFFFF;
  983. border-radius: 16rpx;
  984. overflow: hidden;
  985. .modal-header {
  986. display: flex;
  987. justify-content: space-between;
  988. align-items: center;
  989. height: 96rpx;
  990. padding: 0 40rpx;
  991. background-color: #F5F7FA;
  992. .modal-title {
  993. font-size: 32rpx;
  994. font-weight: 500;
  995. color: #303133;
  996. }
  997. .modal-close {
  998. width: 60rpx;
  999. height: 60rpx;
  1000. display: flex;
  1001. justify-content: center;
  1002. align-items: center;
  1003. }
  1004. .close-icon {
  1005. width: 40rpx;
  1006. height: 40rpx;
  1007. }
  1008. }
  1009. .modal-body {
  1010. padding: 24rpx;
  1011. .modal-date {
  1012. font-size: 32rpx;
  1013. color: #333333;
  1014. margin-bottom: 24rpx;
  1015. display: block;
  1016. }
  1017. .schedule-textarea {
  1018. width: 100%;
  1019. height: 364rpx;
  1020. padding: 20rpx;
  1021. border: 2rpx solid #E8E8E8;
  1022. border-radius: 12rpx;
  1023. font-size: 28rpx;
  1024. color: #333333;
  1025. box-sizing: border-box;
  1026. }
  1027. .textarea-placeholder {
  1028. color: #999999;
  1029. }
  1030. }
  1031. .modal-footer {
  1032. display: flex;
  1033. justify-content: flex-end;
  1034. align-items: center;
  1035. padding: 28rpx 40rpx;
  1036. gap: 16rpx;
  1037. border-top: 2rpx solid #EBEEF5;
  1038. .modal-btn {
  1039. height: 72rpx;
  1040. // padding: 0 48rpx;
  1041. width: 136rpx;
  1042. display: flex;
  1043. justify-content: center;
  1044. align-items: center;
  1045. font-size: 28rpx;
  1046. border-radius: 8rpx;
  1047. flex-shrink: 0;
  1048. &.cancel-btn {
  1049. color: #666666;
  1050. background-color: #FFFFFF;
  1051. border: 2rpx solid #DCDFE6;
  1052. height: 68rpx;
  1053. }
  1054. &.confirm-btn {
  1055. color: #FFFFFF;
  1056. background-color: #2E64FA;
  1057. border: none;
  1058. }
  1059. }
  1060. }
  1061. }
  1062. .select_box{
  1063. width: 168rpx;
  1064. height: 48rpx;
  1065. padding: 16rpx;
  1066. flex-shrink: 0;
  1067. display: flex;
  1068. align-items: center;
  1069. box-sizing: border-box;
  1070. background: rgba(46,100,250,0.1);
  1071. border-radius: 8rpx;
  1072. font-weight: 400;
  1073. font-size: 28rpx;
  1074. color: #2E64FA;
  1075. .select_label{
  1076. flex:1;
  1077. white-space: nowrap;
  1078. overflow: hidden;
  1079. text-overflow: ellipsis;
  1080. }
  1081. .select_icon{
  1082. width: 16rpx;
  1083. height:16rpx;
  1084. margin-left: 8rpx;
  1085. }
  1086. }
  1087. :deep(.school_list){
  1088. padding:0 30rpx;
  1089. width: 100%;
  1090. box-sizing: border-box;
  1091. .list_item{
  1092. margin-top: 20rpx;
  1093. display: flex;
  1094. align-items: center;
  1095. width: 100%;
  1096. height: 108rpx;
  1097. background-color: #FFFFFF;
  1098. border-radius: 12rpx;
  1099. border: 1px solid #E4E7ED;
  1100. padding: 20rpx 38rpx 20rpx 24rpx;
  1101. box-sizing: border-box;
  1102. &.active{
  1103. border: 1px solid #2E64FA;
  1104. background-color: rgba(46,100,250,0.1);
  1105. }
  1106. .school_logo{
  1107. width: 68rpx;
  1108. height: 68rpx;
  1109. background: #C2D2FF;
  1110. border-radius: 50%;
  1111. overflow: hidden;
  1112. margin-right: 28rpx;
  1113. .logo{
  1114. width: 100%;
  1115. height: 100%;
  1116. border-radius: 50%;
  1117. }
  1118. }
  1119. .school_name{
  1120. flex: 1;
  1121. height: 68rpx;
  1122. display: inline-flex;
  1123. align-items: center;
  1124. justify-content: flex-start;
  1125. font-weight: 500;
  1126. font-size: 24rpx;
  1127. color: #000000;
  1128. span{
  1129. display: -webkit-box;
  1130. -webkit-line-clamp: 2;
  1131. -webkit-box-orient: vertical;
  1132. overflow: hidden;
  1133. word-break: break-all;
  1134. }
  1135. }
  1136. .item_right{
  1137. margin-left: 28rpx;
  1138. font-size: 36rpx !important;
  1139. color: #999999 !important;
  1140. }
  1141. }
  1142. }
  1143. </style>