index.vue 31 KB

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