index.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  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. <scroll-view scroll-y 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 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. </scroll-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: '', 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 state = reactive({
  197. schoolName:'',
  198. schoolId:''
  199. });
  200. const modulesList = ref([]);
  201. const moduleMap = computed(() => {
  202. const map = {};
  203. modulesList.value.forEach(item => {
  204. map[item.id] = item;
  205. });
  206. return map;
  207. });
  208. const getModulePermission = (itemId) => {
  209. const module = moduleMap.value[itemId];
  210. if (!module) return 1;
  211. return module.isSelect;
  212. };
  213. const largeCard = computed(() => systemItems.value.find(item => item.isLarge));
  214. const smallCards = computed(() => systemItems.value.filter(item => !item.isLarge));
  215. const rightTopCards = computed(() => smallCards.value.slice(0, 4));
  216. const bottomCards = computed(() => smallCards.value.slice(4));
  217. const allSmallCards = computed(() => smallCards.value);
  218. const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
  219. const calendarDays = ref([]);
  220. const scheduleEvents = ref({});
  221. const isLoading = ref(false);
  222. const today = new Date();
  223. const todayStr = `${today.getFullYear()}-${String(today.getMonth() + 1).padStart(2, '0')}-${String(today.getDate()).padStart(2, '0')}`;
  224. const currentYear = ref(new Date().getFullYear());
  225. const currentMonth = ref(new Date().getMonth() + 1);
  226. const currentDay = ref(new Date().getDate());
  227. const weekStartDate = ref(null);
  228. const weekEndDate = ref(null);
  229. const yearList = ref([]);
  230. const monthList = ref([]);
  231. const yearIndex = ref(0);
  232. const monthIndex = ref(0);
  233. const expandedItems = ref({});
  234. const toggleExpand = (id) => {
  235. expandedItems.value[id] = !expandedItems.value[id];
  236. };
  237. const scheduleList = computed(() => {
  238. const dateKey = `${currentYear.value}-${String(currentMonth.value).padStart(2, '0')}-${String(currentDay.value).padStart(2, '0')}`;
  239. return scheduleEvents.value[dateKey] || [];
  240. });
  241. const weekDateRange = computed(() => {
  242. if (!weekStartDate.value || !weekEndDate.value) return '';
  243. return `${weekStartDate.value.getFullYear()}年${weekStartDate.value.getMonth() + 1}月${weekStartDate.value.getDate()}日 - ${weekEndDate.value.getFullYear()}年${weekEndDate.value.getMonth() + 1}月${weekEndDate.value.getDate()}日`;
  244. });
  245. const generateYearList = () => {
  246. const years = [];
  247. for (let i = currentYear.value - 5; i <= currentYear.value + 5; i++) {
  248. years.push(`${i}年`);
  249. }
  250. yearList.value = years;
  251. };
  252. const generateMonthList = () => {
  253. const months = [];
  254. for (let i = 1; i <= 12; i++) {
  255. months.push(`${i}月`);
  256. }
  257. monthList.value = months;
  258. };
  259. const getWeekRange = (date) => {
  260. const d = new Date(date);
  261. const day = d.getDay();
  262. const diff = day === 0 ? -6 : 1 - day;
  263. const monday = new Date(d);
  264. monday.setDate(d.getDate() + diff);
  265. monday.setHours(0, 0, 0, 0);
  266. const sunday = new Date(monday);
  267. sunday.setDate(monday.getDate() + 6);
  268. sunday.setHours(23, 59, 59, 999);
  269. return { monday, sunday };
  270. };
  271. const updateCalendarDays = () => {
  272. const days = [];
  273. const { monday } = getWeekRange(new Date(currentYear.value, currentMonth.value - 1, currentDay.value));
  274. weekStartDate.value = monday;
  275. const sunday = new Date(monday);
  276. sunday.setDate(monday.getDate() + 6);
  277. weekEndDate.value = sunday;
  278. for (let i = 0; i < 7; i++) {
  279. const date = new Date(monday);
  280. date.setDate(monday.getDate() + i);
  281. const dayOfWeek = date.getDay();
  282. const dateKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
  283. days.push({
  284. date: date.getDate(),
  285. fullDate: dateKey,
  286. year: date.getFullYear(),
  287. month: date.getMonth() + 1,
  288. isActive: date.getDate() === currentDay.value && date.getMonth() + 1 === currentMonth.value && date.getFullYear() === currentYear.value,
  289. isWeekend: dayOfWeek === 0 || dayOfWeek === 6,
  290. isToday: dateKey === todayStr,
  291. hasSchedule: !!scheduleEvents.value[dateKey] && scheduleEvents.value[dateKey].length > 0
  292. });
  293. }
  294. calendarDays.value = days;
  295. };
  296. const fetchScheduleList = async () => {
  297. const { monday, sunday } = getWeekRange(new Date(currentYear.value, currentMonth.value - 1, currentDay.value));
  298. const startDate = `${monday.getFullYear()}-${String(monday.getMonth() + 1).padStart(2, '0')}-${String(monday.getDate()).padStart(2, '0')}`;
  299. const endDate = `${sunday.getFullYear()}-${String(sunday.getMonth() + 1).padStart(2, '0')}-${String(sunday.getDate()).padStart(2, '0')}`;
  300. isLoading.value = true;
  301. try {
  302. const res = await workspaceApi.getSchedule({ startDate, endDate });
  303. updateScheduleEvents(res.data);
  304. } catch (error) {
  305. console.error('获取日程列表失败:', error);
  306. uni.showToast({ title: '获取日程失败,请稍后重试', icon: 'none', duration: 3000 });
  307. } finally {
  308. isLoading.value = false;
  309. }
  310. };
  311. const updateScheduleEvents = (data) => {
  312. Object.keys(scheduleEvents.value).forEach(key => {
  313. delete scheduleEvents.value[key];
  314. });
  315. Object.keys(data).forEach(dateKey => {
  316. const list = data[dateKey] || [];
  317. scheduleEvents.value[dateKey] = list.map(item => ({
  318. id: String(item.id),
  319. title: item.content || ''
  320. }));
  321. });
  322. updateCalendarDays();
  323. };
  324. const updateYearMonthIndex = () => {
  325. yearIndex.value = yearList.value.indexOf(`${currentYear.value}年`);
  326. monthIndex.value = monthList.value.indexOf(`${currentMonth.value}月`);
  327. };
  328. onMounted(() => {
  329. getSchoolInfo();
  330. initSafeArea();
  331. generateYearList();
  332. generateMonthList();
  333. updateYearMonthIndex();
  334. updateCalendarDays();
  335. });
  336. onShow(() => {
  337. modulesList.value = store.state.userStore.modulesList || uni.getStorageSync('modulesList') || [];
  338. fetchScheduleList();
  339. });
  340. const handleSystemClick = (item) => {
  341. const isSelect = getModulePermission(item.id);
  342. if (isSelect == 0) {
  343. uni.showToast({ title: '暂无权限,敬请期待!', icon: 'none' });
  344. return;
  345. }
  346. if (item.key === 'notice') {
  347. const userInfo = store.state.userStore.userInfo || uni.getStorageSync('userInfo') || {};
  348. const roleCodes = userInfo.roleCodes || [];
  349. const isSchoolManager = Array.isArray(roleCodes) && roleCodes.includes('SCHOOL_MANAGER');
  350. if (isSchoolManager) {
  351. uni.navigateTo({
  352. url: '/pages/notice/overview/index'
  353. });
  354. } else {
  355. uni.navigateTo({
  356. url: '/pages/notice/mine/index?hideTabbar=true'
  357. });
  358. }
  359. } else if (item.key === 'materialCollection' || item.key == 'teacherStudy' || item.key == 'studentStudy' || item.key == 'teacherHonor') {//材料采集 教师研修 学生学习 教师发展
  360. uni.navigateTo({
  361. url: `/pages/${item.key}/index`
  362. });
  363. } else {
  364. uni.showToast({ title: `即将打开:${item.name}`, icon: 'none' });
  365. }
  366. };
  367. const handleViewSchedule = () => {
  368. uni.navigateTo({
  369. url: '/pages/workspace/schedule'
  370. });
  371. };
  372. const handlePrevWeek = () => {
  373. const currentDate = new Date(currentYear.value, currentMonth.value - 1, currentDay.value);
  374. currentDate.setDate(currentDate.getDate() - 7);
  375. currentYear.value = currentDate.getFullYear();
  376. currentMonth.value = currentDate.getMonth() + 1;
  377. currentDay.value = currentDate.getDate();
  378. updateYearMonthIndex();
  379. updateCalendarDays();
  380. fetchScheduleList();
  381. };
  382. const handleNextWeek = () => {
  383. const currentDate = new Date(currentYear.value, currentMonth.value - 1, currentDay.value);
  384. currentDate.setDate(currentDate.getDate() + 7);
  385. currentYear.value = currentDate.getFullYear();
  386. currentMonth.value = currentDate.getMonth() + 1;
  387. currentDay.value = currentDate.getDate();
  388. updateYearMonthIndex();
  389. updateCalendarDays();
  390. fetchScheduleList();
  391. };
  392. const handleDayClick = (day) => {
  393. calendarDays.value.forEach(d => d.isActive = false);
  394. day.isActive = true;
  395. currentYear.value = day.year;
  396. currentMonth.value = day.month;
  397. currentDay.value = day.date;
  398. updateYearMonthIndex();
  399. };
  400. const handleYearChange = (e) => {
  401. yearIndex.value = e.detail.value;
  402. currentYear.value = parseInt(yearList.value[e.detail.value].replace('年', ''));
  403. updateCalendarDays();
  404. fetchScheduleList();
  405. };
  406. const handleMonthChange = (e) => {
  407. monthIndex.value = e.detail.value;
  408. currentMonth.value = parseInt(monthList.value[e.detail.value].replace('月', ''));
  409. updateCalendarDays();
  410. fetchScheduleList();
  411. };
  412. const showAddScheduleModal = ref(false);
  413. const scheduleContent = ref('');
  414. const handleAddSchedule = () => {
  415. showAddScheduleModal.value = true;
  416. scheduleContent.value = '';
  417. };
  418. const handleCloseModal = () => {
  419. showAddScheduleModal.value = false;
  420. scheduleContent.value = '';
  421. };
  422. const handleConfirmSchedule = async () => {
  423. if (!scheduleContent.value.trim()) {
  424. uni.showToast({ title: '请输入日程内容', icon: 'none' });
  425. return;
  426. }
  427. const scheduleDate = `${currentYear.value}-${String(currentMonth.value).padStart(2, '0')}-${String(currentDay.value).padStart(2, '0')}`;
  428. try {
  429. await workspaceApi.saveSchedule({
  430. content: scheduleContent.value.trim(),
  431. scheduleDate
  432. });
  433. uni.showToast({ title: '添加成功', icon: 'success' });
  434. showAddScheduleModal.value = false;
  435. scheduleContent.value = '';
  436. fetchScheduleList();
  437. } catch (error) {
  438. console.error('添加日程失败:', error);
  439. uni.showToast({ title: '添加日程失败,请稍后重试', icon: 'none', duration: 3000 });
  440. }
  441. };
  442. //获取学生信息
  443. const getSchoolInfo = () => {
  444. state.schoolName = store.state.userStore.userInfo.schoolName;
  445. console.log(state.schoolName,323233)
  446. state.schoolId = store.state.userStore.userInfo.schoolId;
  447. }
  448. //切换学校弹框
  449. const ChangeSchoolInfo = () => {
  450. schoolPopupDialogRef.value.OpenDialog();
  451. }
  452. const SelectSchool = (schoolId) => {
  453. state.schoolId = schoolId;
  454. }
  455. //切换学校
  456. const DialogSchoolConfirm = () => {
  457. user.chooseBelongSchool({
  458. schoolId:state.schoolId,
  459. deviceType:'APP'
  460. }).then(res=>{
  461. if(res.code == 200){
  462. state.schoolName = res?.data?.schoolName || '';
  463. store.dispatch('setUserInfo');
  464. }
  465. })
  466. }
  467. </script>
  468. <style lang="scss">
  469. $primary-color: #2E64FA;
  470. $text-primary: #333333;
  471. $text-secondary: #666666;
  472. $text-tertiary: #999999;
  473. $bg-color: #F5F7FA;
  474. $bg-white: #FFFFFF;
  475. $border-color: #F0F0F0;
  476. $header-border: #EEEEEE;
  477. $font-lg: 44rpx;
  478. $font-md: 34rpx;
  479. $font-sm: 32rpx;
  480. $font-xs: 26rpx;
  481. $font-xxs: 24rpx;
  482. $radius-lg: 20rpx;
  483. $radius-md: 12rpx;
  484. $radius-sm: 8rpx;
  485. $radius-circle: 50%;
  486. $spacing-xl: 80rpx;
  487. $spacing-lg: 32rpx;
  488. $spacing-md: 24rpx;
  489. $spacing-sm: 24rpx;
  490. $spacing-xs: 16rpx;
  491. $spacing-xxs: 12rpx;
  492. $shadow-sm: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  493. @mixin flex-center {
  494. display: flex;
  495. justify-content: center;
  496. align-items: center;
  497. }
  498. @mixin flex-between {
  499. display: flex;
  500. justify-content: space-between;
  501. align-items: center;
  502. }
  503. @mixin flex-column {
  504. display: flex;
  505. flex-direction: column;
  506. align-items: center;
  507. }
  508. @mixin bg-card {
  509. background-color: $bg-white;
  510. border-radius: $radius-lg;
  511. padding: $spacing-md;
  512. }
  513. @mixin text-ellipsis {
  514. overflow: hidden;
  515. text-overflow: ellipsis;
  516. white-space: nowrap;
  517. }
  518. .page_workspace {
  519. min-height: 100vh;
  520. background-color: #F8F9FD;
  521. box-sizing: border-box;
  522. }
  523. .workspace_content {
  524. padding-left: 24rpx;
  525. padding-right: 24rpx;
  526. height: 100%;
  527. box-sizing: border-box;
  528. overflow: hidden;
  529. }
  530. // 系统列表
  531. .system_list {
  532. @include bg-card;
  533. margin-bottom: $spacing-sm;
  534. .section_title {
  535. font-size: $font-sm;
  536. font-weight: 500;
  537. color: $text-primary;
  538. margin-bottom: $spacing-sm;
  539. }
  540. .system_grid_with_large {
  541. display: flex;
  542. gap: 20rpx;
  543. margin-bottom: 20rpx;
  544. .large_card {
  545. flex: 1;
  546. display: flex;
  547. flex-direction: column;
  548. align-items: center;
  549. justify-content: center;
  550. background-color: #EAF0FF;
  551. border-radius: 20rpx;
  552. width: 324rpx;
  553. height: 352rpx;
  554. position: relative;
  555. .card_dot {
  556. position: absolute;
  557. top: -6rpx;
  558. right: -12rpx;
  559. width: 32rpx;
  560. height: 32rpx;
  561. img {
  562. width: 100%;
  563. height: 100%;
  564. }
  565. }
  566. .dot-green {
  567. background-color: #52C41A;
  568. }
  569. .dot-red {
  570. background-color: #F5222D;
  571. }
  572. .large_icon {
  573. width: 160rpx;
  574. height: 160rpx;
  575. margin-bottom: 32rpx;
  576. }
  577. .large_name {
  578. font-size: 32rpx;
  579. color: #333333;
  580. font-weight: 500;
  581. text-align: center;
  582. line-height: 48rpx;
  583. width: 276rpx;
  584. }
  585. }
  586. .right_top_grid {
  587. flex: 1;
  588. display: grid;
  589. grid-template-columns: repeat(2, 1fr);
  590. gap: 16rpx;
  591. .small_item {
  592. display: flex;
  593. flex-direction: column;
  594. align-items: center;
  595. justify-content: center;
  596. background-color: #FFFFFF;
  597. position: relative;
  598. .card_dot {
  599. position: absolute;
  600. top: -2rpx;
  601. right: 12rpx;
  602. width: 32rpx;
  603. height: 32rpx;
  604. z-index: 10;
  605. img{
  606. width: 32rpx;
  607. height: 32rpx;
  608. }
  609. }
  610. .dot-green {
  611. background-color: #52C41A;
  612. }
  613. .dot-red {
  614. background-color: #F5222D;
  615. }
  616. .small_icon {
  617. width: 96rpx;
  618. height: 96rpx;
  619. margin-bottom: 20rpx;
  620. }
  621. .small_name {
  622. font-size: 28rpx;
  623. color: $text-secondary;
  624. text-align: center;
  625. }
  626. }
  627. }
  628. }
  629. .bottom_grid {
  630. display: grid;
  631. grid-template-columns: repeat(4, 1fr);
  632. gap: 16rpx;
  633. .small_item {
  634. display: flex;
  635. flex-direction: column;
  636. align-items: center;
  637. justify-content: center;
  638. background-color: #FFFFFF;
  639. border-radius: 12rpx;
  640. padding: 20rpx 0;
  641. position: relative;
  642. .card_dot {
  643. position: absolute;
  644. top: 12rpx;
  645. right: 12rpx;
  646. width: 32rpx;
  647. height: 32rpx;
  648. z-index: 10;
  649. img{
  650. width: 32rpx;
  651. height: 32rpx;
  652. }
  653. }
  654. .dot-green {
  655. background-color: #52C41A;
  656. }
  657. .dot-red {
  658. background-color: #F5222D;
  659. }
  660. .small_icon {
  661. width: 96rpx;
  662. height: 96rpx;
  663. margin-bottom: 20rpx;
  664. }
  665. .small_name {
  666. font-size: 28rpx;
  667. color: $text-secondary;
  668. text-align: center;
  669. }
  670. }
  671. }
  672. .system_grid_full {
  673. display: grid;
  674. grid-template-columns: repeat(4, 1fr);
  675. gap: 16rpx;
  676. .small_item {
  677. display: flex;
  678. flex-direction: column;
  679. align-items: center;
  680. justify-content: center;
  681. background-color: #FFFFFF;
  682. border-radius: 12rpx;
  683. padding: 20rpx 0;
  684. position: relative;
  685. .card_dot {
  686. position: absolute;
  687. top: 12rpx;
  688. right: 12rpx;
  689. width: 12rpx;
  690. height: 12rpx;
  691. border-radius: 50%;
  692. img{
  693. width: 12rpx;
  694. height: 12rpx;
  695. }
  696. }
  697. .dot-green {
  698. background-color: #52C41A;
  699. }
  700. .dot-red {
  701. background-color: #F5222D;
  702. }
  703. .small_icon {
  704. width: 64rpx;
  705. height: 64rpx;
  706. margin-bottom: 12rpx;
  707. }
  708. .small_name {
  709. font-size: 22rpx;
  710. color: $text-secondary;
  711. text-align: center;
  712. }
  713. }
  714. }
  715. }
  716. // 日程
  717. .calendar_section {
  718. @include bg-card;
  719. .calendar_header {
  720. @include flex-between;
  721. margin-bottom: 32rpx;
  722. .section_title {
  723. font-size: $font-sm;
  724. font-weight: 500;
  725. color: $text-primary;
  726. }
  727. .view_schedule {
  728. font-size: 28rpx;
  729. color: $primary-color;
  730. }
  731. }
  732. .calendar_toolbar {
  733. display: flex;
  734. gap: 18rpx;
  735. padding-bottom: 32rpx;
  736. .year_month_select {
  737. display: flex;
  738. gap: 18rpx;
  739. flex: 1;
  740. .select_item {
  741. flex: 1;
  742. // @include flex-center;
  743. gap: 8rpx;
  744. padding: 0;
  745. height: 72rpx;
  746. background-color: #FFFFFF;
  747. border-radius: 8rpx;
  748. border: 2rpx solid #DCDFE6;
  749. .select_content {
  750. display: flex;
  751. justify-content: space-between;
  752. align-items: center;
  753. width: 81%;
  754. padding: 0 16rpx;
  755. height: 72rpx;
  756. }
  757. .select_text {
  758. font-size: $font-xs;
  759. color: $text-primary;
  760. }
  761. }
  762. }
  763. .week_nav {
  764. display: flex;
  765. gap: 18rpx;
  766. .nav_btn {
  767. width: 122rpx;
  768. height: 72rpx;
  769. @include flex-center;
  770. background-color: #FFFFFF;
  771. border-radius: 8rpx;
  772. border: 2rpx solid #DCDFE6;
  773. .nav_text {
  774. font-size: $font-xs;
  775. color: $text-secondary;
  776. }
  777. }
  778. }
  779. }
  780. .calendar_grid {
  781. margin-bottom: $spacing-lg;
  782. .calendar_weekday {
  783. display: flex;
  784. margin-bottom: $spacing-xs;
  785. .weekday_text {
  786. flex: 1;
  787. text-align: center;
  788. font-size: 28rpx;
  789. color: $text-secondary;
  790. }
  791. }
  792. .calendar_days {
  793. display: flex;
  794. justify-content: space-around;
  795. align-items: center;
  796. height: 80rpx;
  797. .day_item {
  798. flex-shrink: 0;
  799. box-sizing: border-box;
  800. display: flex;
  801. justify-content: center;
  802. align-items: center;
  803. width: 80rpx;
  804. height: 80rpx;
  805. border-radius: 50%;
  806. border: 2rpx solid transparent;
  807. position: relative;
  808. &.active {
  809. background-color: rgba(46, 100, 250, 0.1);
  810. border-color: #2E64FA;
  811. .day_text {
  812. color: #2E64FA;
  813. }
  814. }
  815. .day_text {
  816. font-size: $font-sm;
  817. color: $text-primary;
  818. }
  819. &.weekend:not(.active) {
  820. .day_text {
  821. color: #999999;
  822. }
  823. }
  824. .schedule_dot {
  825. position: absolute;
  826. bottom: 12rpx;
  827. width: 8rpx;
  828. height: 8rpx;
  829. background-color: transparent;
  830. border-radius: 50%;
  831. &.visible {
  832. background-color: #2E64FA;
  833. }
  834. }
  835. }
  836. }
  837. }
  838. .schedule_list {
  839. margin-bottom: $spacing-lg;
  840. background: #F9FAFF;
  841. border-radius: 20rpx 20rpx 20rpx 20rpx;
  842. padding: $spacing-lg;
  843. .schedule_title {
  844. font-size: 28rpx;
  845. font-weight: 500;
  846. color: $text-primary;
  847. margin-bottom: $spacing-xs;
  848. }
  849. .schedule_item {
  850. display: flex;
  851. align-items: flex-start;
  852. padding: 24rpx 0;
  853. border-bottom: 2rpx solid #EBEEF5;
  854. &:last-child {
  855. border-bottom: none;
  856. }
  857. .schedule_dot {
  858. width: 16rpx;
  859. height: 16rpx;
  860. background-color: $primary-color;
  861. border-radius: $radius-circle;
  862. margin-top: 14rpx;
  863. margin-right: 14rpx;
  864. flex-shrink: 0;
  865. }
  866. .schedule_text_container {
  867. flex: 1;
  868. position: relative;
  869. }
  870. .schedule_text {
  871. font-size: 28rpx;
  872. color: #666666;
  873. line-height: 1.6;
  874. display: -webkit-box;
  875. flex: 1;
  876. text-align: justify;
  877. &.expanded {
  878. -webkit-line-clamp: unset;
  879. overflow: visible;
  880. text-overflow: unset;
  881. padding-right: 0;
  882. }
  883. }
  884. .toggle_text {
  885. font-size: 28rpx;
  886. color: #2E64FA;
  887. position: absolute;
  888. right: 0;
  889. bottom: 0;
  890. line-height: 1.6;
  891. }
  892. }
  893. }
  894. .add_schedule_btn {
  895. @include flex-center;
  896. gap: 16rpx;
  897. height: 56rpx;
  898. background-color: #FFFFFF;
  899. border-radius: 12rpx 12rpx 12rpx 12rpx;
  900. ;
  901. border: 1px solid #2E64FA;
  902. .btn_text {
  903. font-size: 28rpx;
  904. color: #2E64FA;
  905. font-weight: 500;
  906. }
  907. .add_icon {
  908. width: 32rpx;
  909. height: 32rpx;
  910. }
  911. }
  912. }
  913. .modal-overlay {
  914. position: fixed;
  915. top: 0;
  916. left: 0;
  917. right: 0;
  918. bottom: 0;
  919. background-color: rgba(0, 0, 0, 0.5);
  920. display: flex;
  921. justify-content: center;
  922. align-items: center;
  923. z-index: 1000;
  924. }
  925. .modal-content {
  926. width: 702rpx;
  927. background-color: #FFFFFF;
  928. border-radius: 16rpx;
  929. overflow: hidden;
  930. .modal-header {
  931. display: flex;
  932. justify-content: space-between;
  933. align-items: center;
  934. height: 96rpx;
  935. padding: 0 40rpx;
  936. background-color: #F5F7FA;
  937. .modal-title {
  938. font-size: 32rpx;
  939. font-weight: 500;
  940. color: #303133;
  941. }
  942. .modal-close {
  943. width: 60rpx;
  944. height: 60rpx;
  945. display: flex;
  946. justify-content: center;
  947. align-items: center;
  948. }
  949. .close-icon {
  950. width: 40rpx;
  951. height: 40rpx;
  952. }
  953. }
  954. .modal-body {
  955. padding: 24rpx;
  956. .modal-date {
  957. font-size: 32rpx;
  958. color: #333333;
  959. margin-bottom: 24rpx;
  960. display: block;
  961. }
  962. .schedule-textarea {
  963. width: 100%;
  964. height: 364rpx;
  965. padding: 20rpx;
  966. border: 2rpx solid #E8E8E8;
  967. border-radius: 12rpx;
  968. font-size: 28rpx;
  969. color: #333333;
  970. box-sizing: border-box;
  971. }
  972. .textarea-placeholder {
  973. color: #999999;
  974. }
  975. }
  976. .modal-footer {
  977. display: flex;
  978. justify-content: flex-end;
  979. align-items: center;
  980. padding: 28rpx 40rpx;
  981. gap: 16rpx;
  982. border-top: 2rpx solid #EBEEF5;
  983. .modal-btn {
  984. height: 72rpx;
  985. // padding: 0 48rpx;
  986. width: 136rpx;
  987. display: flex;
  988. justify-content: center;
  989. align-items: center;
  990. font-size: 28rpx;
  991. border-radius: 8rpx;
  992. flex-shrink: 0;
  993. &.cancel-btn {
  994. color: #666666;
  995. background-color: #FFFFFF;
  996. border: 2rpx solid #DCDFE6;
  997. height: 68rpx;
  998. }
  999. &.confirm-btn {
  1000. color: #FFFFFF;
  1001. background-color: #2E64FA;
  1002. border: none;
  1003. }
  1004. }
  1005. }
  1006. }
  1007. .select_box{
  1008. width: 168rpx;
  1009. height: 48rpx;
  1010. padding: 16rpx;
  1011. flex-shrink: 0;
  1012. display: flex;
  1013. align-items: center;
  1014. box-sizing: border-box;
  1015. background: rgba(46,100,250,0.1);
  1016. border-radius: 8rpx;
  1017. font-weight: 400;
  1018. font-size: 28rpx;
  1019. color: #2E64FA;
  1020. .select_label{
  1021. flex:1;
  1022. white-space: nowrap;
  1023. overflow: hidden;
  1024. text-overflow: ellipsis;
  1025. }
  1026. .select_icon{
  1027. width: 16rpx;
  1028. height:16rpx;
  1029. margin-left: 8rpx;
  1030. }
  1031. }
  1032. :deep(.school_list){
  1033. padding:0 30rpx;
  1034. width: 100%;
  1035. box-sizing: border-box;
  1036. .list_item{
  1037. margin-top: 20rpx;
  1038. display: flex;
  1039. align-items: center;
  1040. width: 100%;
  1041. height: 108rpx;
  1042. background-color: #FFFFFF;
  1043. border-radius: 12rpx;
  1044. border: 1px solid #E4E7ED;
  1045. padding: 20rpx 38rpx 20rpx 24rpx;
  1046. box-sizing: border-box;
  1047. &.active{
  1048. border: 1px solid #2E64FA;
  1049. background-color: rgba(46,100,250,0.1);
  1050. }
  1051. .school_logo{
  1052. width: 68rpx;
  1053. height: 68rpx;
  1054. background: #C2D2FF;
  1055. border-radius: 50%;
  1056. overflow: hidden;
  1057. margin-right: 28rpx;
  1058. .logo{
  1059. width: 100%;
  1060. height: 100%;
  1061. border-radius: 50%;
  1062. }
  1063. }
  1064. .school_name{
  1065. flex: 1;
  1066. height: 68rpx;
  1067. display: inline-flex;
  1068. align-items: center;
  1069. justify-content: flex-start;
  1070. font-weight: 500;
  1071. font-size: 24rpx;
  1072. color: #000000;
  1073. span{
  1074. display: -webkit-box;
  1075. -webkit-line-clamp: 2;
  1076. -webkit-box-orient: vertical;
  1077. overflow: hidden;
  1078. word-break: break-all;
  1079. }
  1080. }
  1081. .item_right{
  1082. margin-left: 28rpx;
  1083. font-size: 36rpx !important;
  1084. color: #999999 !important;
  1085. }
  1086. }
  1087. }
  1088. </style>