index.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514
  1. <template>
  2. <div>
  3. <Header @confirmExit="confirmExit" type="ranking"></Header>
  4. <div class="ranking">
  5. <div class="top">
  6. <div class="top-left">
  7. <div class="title1">{{ pageType == 1 ? "运动风云榜" : pageType == 2 ? currentClass.name : "" }} · {{
  8. projectObj.title
  9. }}</div>
  10. <div class="title2" @click="choiceClassWindow = true">{{ pageType == 1 ? "切换到班级榜" : pageType == 2 ? "切换到班级" :
  11. "" }}</div>
  12. </div>
  13. <div class="tab">
  14. <ul>
  15. <li @click="clickType(1)" :class="{ current: type == 1 }">男生</li>
  16. <li @click="clickType(2)" :class="{ current: type == 2 }">女生</li>
  17. </ul>
  18. <dl>
  19. <dt @click="getDateType(4)" :class="{ current: date.type == 4 }">上周</dt>
  20. <dt @click="getDateType(1)" :class="{ current: date.type == 1 }">本周</dt>
  21. <dt @click="getDateType(2)" :class="{ current: date.type == 2 }">月榜</dt>
  22. <dt @click="getDateType(3)" :class="{ current: date.type == 3 }">季度榜</dt>
  23. </dl>
  24. </div>
  25. </div>
  26. <div class="mainBox">
  27. <div class="main" v-show="pageType == 1 ? true : false">
  28. <div class="swiperBox">
  29. <!--年级排名开始-->
  30. <swiper ref="refSwiper" :slides-per-view="3" :slides-per-group="3" :space-between="10">
  31. <swiper-slide v-for="(item, index) in gradeData" :key="index">
  32. <div class="item">
  33. <div class="gradeTitle">{{ item.label }}</div>
  34. <ul :ref="(el: any) => { multipleItemRef(el, item.value) }" @scroll="getScroll($event, item.value)">
  35. <li :data-items="JSON.stringify(items)" v-for="items in item.list" :key="items.student_id"
  36. @click="openReport(items)">
  37. <div class="left">
  38. <i class="pai"
  39. :class="{ 'pai1': items.rank == 1, 'pai2': items.rank == 2, 'pai3': items.rank == 3 }">{{
  40. items.rank }}</i>
  41. <div class="userInfo">
  42. <div class="touxiang">
  43. <img v-if="items.logo_url" :src="items.logo_url" />
  44. <img v-else :src="logo" />
  45. </div>
  46. <div class="nameBox">
  47. <span class="studentName">{{ items.student_name }}</span>
  48. <span class="className">{{ items.class_name }}</span>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="right" v-if="['basketballv1'].includes(projectObj.exam_name)">
  53. <div class="score">{{ proxy?.$utils.runTime(items.result, true, false) }}
  54. </div>
  55. </div>
  56. <div class="right" v-else>
  57. <div class="score">{{ items.result }}
  58. </div>
  59. <div class="unit">{{ items.unit }}</div>
  60. </div>
  61. </li>
  62. </ul>
  63. </div>
  64. </swiper-slide>
  65. </swiper>
  66. <!-- 如果需要导航按钮 -->
  67. <div class="swiper-button-prev swiper-btn swiper-btn-left" slot="button-prev" @click="getStopPlaying()"
  68. v-if="gradeData.length > 3">
  69. </div>
  70. <div class="swiper-button-next swiper-btn swiper-btn-right" slot="button-next" @click="getStopPlaying()"
  71. v-if="gradeData.length > 3">
  72. </div>
  73. <!--年级排名结束-->
  74. </div>
  75. </div>
  76. <div class="main" v-show="pageType == 2 ? true : false">
  77. <div class="main-a">
  78. <!--学生排行榜-->
  79. <div class="main-a-center" v-if="studentTop.length">
  80. <div class="item" :class="{ one: index == 0, two: index == 1, three: index == 2 }"
  81. @click="openReport(item)" v-for="(item, index) in studentTop" :key="index">
  82. <div class="touxiang">
  83. <img v-if="item.logo_url" :src="item.logo_url" />
  84. <img v-else :src="logo" />
  85. </div>
  86. <div class="txt">
  87. <div class="number">NO.{{ item.rank }}</div>
  88. <div class="studentName">{{ item.student_name }}</div>
  89. <div class="scoreBox" v-if="['basketballv1'].includes(projectObj.exam_name)">
  90. <div class="score">{{
  91. proxy?.$utils.runTime(item.result, true, false) }}</div>
  92. </div>
  93. <div class="scoreBox" v-else>
  94. <div class="score">{{ item.result }}</div>
  95. <div class="unit">{{ item.unit }}</div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <div class="noData" v-else>
  101. <div>
  102. <img src="@/assets/images/ranking/noData.png" />
  103. <span>暂无更多数据</span>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="main-b">
  108. <div class="btn-left" @click="getPrevious"></div>
  109. <div class="main-b-center">
  110. <div class="columns" v-for="(item, index) in studentList" :key="index">
  111. <Transition name="fade" mode="out-in">
  112. <ul v-if="item.length">
  113. <li v-for="(items, indexs) in item" :key="indexs" @click="openReport(items)">
  114. <div class="txt">
  115. <i>{{ items.rank }}</i>
  116. <div class="studentName">{{ items.student_name }}</div>
  117. <div class="right" v-if="['basketballv1'].includes(projectObj.exam_name)">
  118. <div class="score">{{ proxy?.$utils.runTime(items.result, true, false) }}
  119. </div>
  120. </div>
  121. <div class="right" v-else>
  122. <div class="score">{{ items.result }}
  123. </div>
  124. <div class="unit">{{ items.unit }}</div>
  125. </div>
  126. </div>
  127. </li>
  128. </ul>
  129. <div class="noData" v-else>
  130. <div>
  131. <img src="@/assets/images/ranking/noData.png" />
  132. <span>暂无更多数据</span>
  133. </div>
  134. </div>
  135. </Transition>
  136. </div>
  137. </div>
  138. <div class="btn-right" @click="getNext"></div>
  139. </div>
  140. </div>
  141. <div class="footer">
  142. <div class="tab">
  143. <ul>
  144. <li @click="clickProject(item)" :class="{ current: projectObj.exam_name == item.exam_name }"
  145. v-for="item in projectList" :key="item.exam_name">
  146. {{ item.title }}
  147. </li>
  148. </ul>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="choiceClass" v-if="choiceClassWindow">
  153. <div class="choiceClass-content">
  154. <div v-for="(item, index) in classList" :key="item.value">
  155. <div class="classTitle">{{ item.label }}</div>
  156. <ul>
  157. <li @click="openClassPage(items)" v-for="(items, indexs) in item.child" :key="items.id">
  158. {{ items.name }}
  159. </li>
  160. </ul>
  161. </div>
  162. </div>
  163. <div class="choiceClass-btn-box">
  164. <div class="choiceClass-btn choiceClass-btn-all" @click="openAllPage">
  165. 全部排名
  166. </div>
  167. <div class="choiceClass-btn" @click="choiceClassWindow = false">
  168. 关闭
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. <ReportWindow ref="reportWindowRef" @returnData="returnData" />
  174. </div>
  175. </template>
  176. <script setup name="Ranking" lang="ts">
  177. import { Swiper, SwiperSlide } from 'swiper/vue';
  178. import dataDictionary from "@/utils/dataDictionary"
  179. import 'dayjs/locale/zh-cn'
  180. import dayjs from 'dayjs'
  181. import weekOfYear from 'dayjs/plugin/weekOfYear'
  182. import 'swiper/css';
  183. dayjs.locale('zh-cn')
  184. dayjs.extend(weekOfYear)
  185. const { proxy } = getCurrentInstance() as any;
  186. const router = useRouter();
  187. const refSwiper = ref();
  188. const reportWindowRef = ref();
  189. const data = reactive<any>({
  190. pageType: 1,//1年级排名2班级排名
  191. currentDate: "",
  192. projectList: [], //项目列表
  193. projectObj: {}, //当前项目
  194. studentTop: [], //学生前三
  195. studentList: [], //学生排名列表
  196. studentPage: {
  197. current: 1,
  198. size: 15,
  199. pages: 1,
  200. }, //学生分页
  201. type: 1, //1男生2女生
  202. timer: null, //定时器状态
  203. countDownTimer: null, //倒计时状态
  204. countDown: null, //倒计时20秒
  205. logo: "",
  206. gradeType: [],
  207. gradeData: [],
  208. classList: [],
  209. multipleItemRefList: [],
  210. currentClass: {},
  211. classIdKeyObj: {},
  212. choiceClassWindow: false,
  213. date: {
  214. type: 0, //1周2月3季度
  215. start: "",
  216. end: "",
  217. },
  218. debounceTime: '', //防抖状态
  219. swiperOption: {
  220. // 设置垂直轮播vertical, 水平轮播 horizontal
  221. direction: "horizontal",
  222. // 轮播图间距
  223. spaceBetween: 30,
  224. // 循环模式选项
  225. loop: false,
  226. slidesPerView: 3,
  227. slidesPerGroup: 3,
  228. initialSlide: 1,
  229. speed: 1600,
  230. // 自动滑动
  231. autoplay: {
  232. delay: 30000,
  233. // 如果设置为true,当切换到最后一个slide时停止自动切换。
  234. stopOnLastSlide: false,
  235. // 如果设置为false,用户操作swiper之后自动切换不会停止,每次都会重新启动autoplay
  236. disableOnInteraction: false,
  237. },
  238. // 轮播图的切换前进后退按钮,如果想放在轮播图中可以看swiper官方文档,这里写在了轮播外
  239. navigation: {
  240. nextEl: ".swiper-button-next",
  241. prevEl: ".swiper-button-prev",
  242. },
  243. on: {
  244. },
  245. },
  246. });
  247. const {
  248. pageType,
  249. currentDate,
  250. projectList,
  251. projectObj,
  252. studentTop,
  253. studentList,
  254. studentPage,
  255. type,
  256. timer,
  257. countDownTimer,
  258. countDown,
  259. logo,
  260. gradeType,
  261. gradeData,
  262. classList,
  263. multipleItemRefList,
  264. currentClass,
  265. classIdKeyObj,
  266. choiceClassWindow,
  267. date,
  268. debounceTime,
  269. swiperOption
  270. } = toRefs(data);
  271. /**
  272. * 创建组件实例
  273. */
  274. const multipleItemRef = (el: any, grade: any) => {
  275. multipleItemRefList.value[grade] = el;
  276. }
  277. //获取年级列表
  278. const getClass = () => {
  279. let params = {
  280. page: 1,
  281. per_page: 9999,
  282. };
  283. proxy?.$http.common.classList(params)
  284. .then((res: any) => {
  285. // 重新排序一次
  286. let list: any = [];
  287. dataDictionary.gradeList.forEach((item) => {
  288. res.data.forEach((items: any) => {
  289. // classIdKeyObj.value[items.id] = items
  290. if (items.grade == item.value) {
  291. list.push(items);
  292. }
  293. })
  294. });
  295. let myClassList = gradeType.value.map((item: any) => {
  296. let newList = list.filter((items: any) => {
  297. return items.grade == item.value;
  298. })
  299. item.child = newList || [];
  300. return item;
  301. });
  302. classList.value = myClassList;
  303. })
  304. };
  305. //获取项目
  306. const getProject = () => {
  307. let params = {};
  308. proxy?.$http.ranking.examlistShow(params).then((res: any) => {
  309. if (res.status == 200) {
  310. let dic: any = dataDictionary.project;
  311. let list = res.data.map((item: any) => {
  312. item.title = dic[item.exam_name];
  313. return item;
  314. });
  315. projectList.value = list;
  316. if (list.length) {
  317. projectObj.value = list[0];
  318. getData();
  319. getAutoplay();
  320. }
  321. }
  322. });
  323. };
  324. //自动切换排行榜
  325. const getAutoplay = () => {
  326. // refSwiper.value.autoplay.start();
  327. let qieTime = swiperOption.value.autoplay.delay * (gradeData.value.length / swiperOption.value.slidesPerGroup);//切换项目时间
  328. timer.value = setInterval((res: any) => {
  329. //切换类型
  330. let type1 = JSON.parse(JSON.stringify(type.value));
  331. if (type1 == 1) {
  332. type.value = 2;
  333. }
  334. if (type1 == 2) {
  335. type.value = 1;
  336. }
  337. //切换项目归为1后切换项目
  338. if (type.value == 1) {
  339. let projectIndex = projectList.value.findIndex((item: any) => {
  340. return item.exam_name == projectObj.value.exam_name;
  341. });
  342. if (projectIndex + 1 == projectList.value.length) {
  343. //最后一个就重新开始
  344. projectObj.value = projectList.value[0];
  345. } else {
  346. //项目从左到右
  347. projectObj.value = projectList.value[projectIndex + 1];
  348. }
  349. }
  350. getData();
  351. }, qieTime);
  352. };
  353. //停止切换排行榜
  354. const getStopPlaying = (myTime?: any) => {
  355. clearInterval(timer.value);
  356. clearInterval(countDownTimer.value);
  357. // refSwiper.value.$swiper.autoplay.stop();
  358. //30秒后重新自动运行
  359. countDown.value = myTime || 20;
  360. countDownTimer.value = setInterval((res: any) => {
  361. countDown.value--;
  362. console.log("即将启动自动切换", countDown.value);
  363. if (countDown.value <= 0) {
  364. getAutoplay();
  365. clearInterval(countDownTimer.value);
  366. }
  367. }, 1000);
  368. };
  369. //请求数据
  370. const getData = () => {
  371. if (pageType.value == 1) {
  372. gradeData.value.forEach((item: any, index: any) => {
  373. gradeData.value[index].page.current = 1;
  374. })
  375. getIniGrade();
  376. }
  377. if (pageType.value == 2) {
  378. studentPage.value.current = 1;
  379. getGoodStudent();
  380. getStudentList();
  381. }
  382. };
  383. //各项目的学生前三
  384. const getGoodStudent = () => {
  385. studentTop.value = [];
  386. let params: any = {
  387. exam_name: projectObj.value.exam_name,
  388. page: 1,
  389. per_page: 3,
  390. };
  391. if (date.value.type != 0) {
  392. params.start_date = date.value.start;
  393. params.end_date = date.value.end;
  394. }
  395. if (type.value == 1) {
  396. params.gender = 1;
  397. }
  398. if (type.value == 2) {
  399. params.gender = 0;
  400. }
  401. if (pageType.value == 2) {
  402. params.class_id = currentClass.value.id;
  403. }
  404. proxy?.$http.ranking.studentRanking(params).then((res: any) => {
  405. if (res.status == 200) {
  406. let list = res.data.map((item: any) => {
  407. if (projectObj.value.exam_name == 'solidball' || projectObj.value.exam_name == 'shotball') {
  408. item.result = item.result / 100
  409. }
  410. let result = null;
  411. if (item.result.toString().indexOf(".") != -1) {
  412. if (['jump', 'longjump', 'run50', 'run70', 'run100', 'run200', 'run400', 'run800', 'run1000', 'run15x4', 'run50x8', 'run10x4', 'basketballv1', 'basketballv1'].includes(projectObj.value.exam_name)) {
  413. result = item.result.toFixed(2)
  414. } else {
  415. result = item.result.toFixed(1);
  416. }
  417. } else {
  418. result = item.result
  419. }
  420. item.result = result;
  421. let dic: any = dataDictionary.unit;
  422. item.unit = dic[projectObj.value.exam_name];
  423. return item
  424. });
  425. studentTop.value = list;
  426. }
  427. });
  428. };
  429. //各项目的学生排名列表
  430. const getStudentList = () => {
  431. let params: any = {
  432. exam_name: projectObj.value.exam_name,
  433. page: studentPage.value.current,
  434. per_page: studentPage.value.size,
  435. offset: 3,
  436. };
  437. if (date.value.type != 0) {
  438. params.start_date = date.value.start;
  439. params.end_date = date.value.end;
  440. }
  441. if (type.value == 1) {
  442. params.gender = 1;
  443. }
  444. if (type.value == 2) {
  445. params.gender = 0;
  446. }
  447. if (pageType.value == 2) {
  448. params.class_id = currentClass.value.id;
  449. }
  450. proxy?.$http.ranking.studentRanking(params).then((res: any) => {
  451. if (res.status == 200) {
  452. let list: any = [[], [], []];
  453. let num = studentPage.value.size / 3;
  454. res.data
  455. .map((item: any) => {
  456. if (projectObj.value.exam_name == 'solidball' || projectObj.value.exam_name == 'shotball') {
  457. item.result = item.result / 100
  458. }
  459. let result = null;
  460. if (item.result.toString().indexOf(".") != -1) {
  461. if (['jump', 'longjump', 'run50', 'run70', 'run100', 'run200', 'run400', 'run800', 'run1000', 'run15x4', 'run50x8', 'run10x4', 'basketballv1'].includes(projectObj.value.exam_name)) {
  462. result = item.result.toFixed(2)
  463. } else {
  464. result = item.result.toFixed(1);
  465. }
  466. } else {
  467. result = item.result
  468. }
  469. item.result = result;
  470. let dic: any = dataDictionary.unit;
  471. item.unit = dic[projectObj.value.exam_name];
  472. return item
  473. })
  474. .forEach((item: any, index: any) => {
  475. if (index >= 0 && index <= num * 1 - 1) {
  476. list[0].push(item);
  477. }
  478. if (index >= num && index <= num * 2 - 1) {
  479. list[1].push(item);
  480. }
  481. if (index >= num * 2 && index <= num * 3 - 1) {
  482. list[2].push(item);
  483. }
  484. });
  485. studentList.value = list;
  486. getPages(res.total);
  487. }
  488. });
  489. };
  490. //获取班级排名
  491. const getGradeList = (grade: any) => {
  492. let index = gradeData.value.findIndex((item: any) => {
  493. return item.value == grade;
  494. })
  495. let params: any = {
  496. exam_name: projectObj.value.exam_name,
  497. page: gradeData.value[index].page.current,
  498. per_page: gradeData.value[index].page.size,
  499. grade: grade,
  500. };
  501. if (date.value.type != 0) {
  502. params.start_date = date.value.start;
  503. params.end_date = date.value.end;
  504. }
  505. if (type.value == 1) {
  506. params.gender = 1;
  507. }
  508. if (type.value == 2) {
  509. params.gender = 0;
  510. }
  511. proxy?.$http.ranking.studentRanking(params).then((res: any) => {
  512. if (res.status == 200) {
  513. let list = res.data
  514. .map((item: any) => {
  515. if (projectObj.value.exam_name == 'solidball' || projectObj.value.exam_name == 'shotball') {
  516. item.result = item.result / 100
  517. }
  518. let result = null;
  519. if (item.result.toString().indexOf(".") != -1) {
  520. if (['jump', 'longjump', 'run50', 'run70', 'run100', 'run200', 'run400', 'run800', 'run1000', 'run15x4', 'run50x8', 'run10x4', 'basketballv1', 'basketballv1'].includes(projectObj.value.exam_name)) {
  521. result = item.result.toFixed(2)
  522. } else {
  523. result = item.result.toFixed(1);
  524. }
  525. } else {
  526. result = item.result
  527. }
  528. item.result = result;
  529. let dic: any = dataDictionary.unit;
  530. item.unit = dic[projectObj.value.exam_name];
  531. return item
  532. })
  533. gradeData.value[index].page.current == 1 ?
  534. (gradeData.value[index].list = list) :
  535. gradeData.value[index].list.push(...list);
  536. getGradePages(res.total, grade);
  537. }
  538. });
  539. };
  540. //年级排名
  541. const getIniGrade = () => {
  542. gradeData.value = [];
  543. gradeType.value.forEach((item: any) => {
  544. //构建年级数据结构
  545. let obj: any = {
  546. label: item.label,
  547. value: item.value,
  548. page: {
  549. current: 1,
  550. size: 15,
  551. pages: 1,
  552. },
  553. list: [],
  554. }
  555. gradeData.value.push(obj);
  556. getGradeList(item.value);
  557. })
  558. };
  559. const getScroll = (event?: any, grade?: any) => {
  560. getStopPlaying();//滚动的停止执行切换
  561. let index = gradeData.value.findIndex((item: any) => {
  562. return item.value == grade;
  563. })
  564. if (gradeData.value[index].page.current == gradeData.value[index].page.pages) {
  565. return false;
  566. }
  567. let obj = multipleItemRefList.value[grade];
  568. let scrollHeight = obj.scrollHeight;
  569. let scrollTop = obj.scrollTop;
  570. let clientHeight = obj.clientHeight;
  571. //提前100高度加载数据
  572. if (scrollTop + clientHeight + 100 >= scrollHeight) {
  573. console.log('到底了!')
  574. //继续加载下一页
  575. if (debounceTime.value) {
  576. clearTimeout(debounceTime.value)
  577. }
  578. debounceTime.value = setTimeout(() => {
  579. gradeData.value[index].page.current++;
  580. getGradeList(grade);
  581. }, 500)
  582. } else {
  583. console.log('没到底')
  584. }
  585. };
  586. const openAllPage = () => {
  587. pageType.value = 1;
  588. choiceClassWindow.value = false;
  589. };
  590. const openClassPage = (data: any) => {
  591. currentClass.value = data;
  592. pageType.value = 2;
  593. getData();
  594. choiceClassWindow.value = false;
  595. };
  596. //切换排行榜
  597. const clickType = (data: any) => {
  598. type.value = data;
  599. getData();
  600. getStopPlaying();
  601. };
  602. //切换项目
  603. const clickProject = (data: any) => {
  604. projectObj.value = data;
  605. getData();
  606. getStopPlaying();
  607. };
  608. //时间类型
  609. const getDateType = (data: any) => {
  610. date.value.type = data;
  611. getTypeTime();
  612. getData();
  613. getStopPlaying();
  614. };
  615. //时间转化
  616. const getTypeTime = () => {
  617. //本周
  618. if (date.value.type == 1) {
  619. date.value.start = dayjs()
  620. .startOf("week")
  621. .format("YYYY-MM-DD");
  622. date.value.end = dayjs()
  623. .endOf("week")
  624. .format("YYYY-MM-DD");
  625. }
  626. //月
  627. if (date.value.type == 2) {
  628. date.value.start = dayjs().startOf("month").format("YYYY-MM-DD");
  629. date.value.end = dayjs().endOf("month").format("YYYY-MM-DD");
  630. }
  631. //季度
  632. if (date.value.type == 3) {
  633. let month = dayjs().month() + 1;
  634. let jiduArr = [
  635. [1, 3],
  636. [4, 6],
  637. [7, 9],
  638. [10, 12]
  639. ];
  640. let start = 0;
  641. let end = 0;
  642. let index = 0;
  643. if (month >= 1 && month <= 3) {
  644. index = 0
  645. }
  646. if (month >= 4 && month <= 6) {
  647. index = 1
  648. }
  649. if (month >= 7 && month <= 9) {
  650. index = 2
  651. }
  652. if (month >= 10 && month <= 12) {
  653. index = 3
  654. }
  655. start = jiduArr[index][0] - 1;
  656. end = jiduArr[index][1] - 1;
  657. date.value.start = dayjs().month(start).startOf("month").format("YYYY-MM-DD");
  658. date.value.end = dayjs().month(end).endOf("month").format("YYYY-MM-DD");
  659. }
  660. //上周
  661. if (date.value.type == 4) {
  662. date.value.start = dayjs()
  663. .add(-1, "week").startOf("week")
  664. .format("YYYY-MM-DD");
  665. date.value.end = dayjs()
  666. .add(-1, "week").startOf("week")
  667. .endOf("week")
  668. .format("YYYY-MM-DD");
  669. }
  670. //年
  671. if (date.value.type == 5) {
  672. date.value.start = dayjs().startOf("year").format("YYYY-MM-DD");
  673. date.value.end = dayjs().endOf("year").format("YYYY-MM-DD");
  674. }
  675. };
  676. //上一页
  677. const getPrevious = () => {
  678. if (studentPage.value.current == 1) {
  679. return false;
  680. }
  681. studentPage.value.current--;
  682. getStudentList();
  683. getStopPlaying();
  684. };
  685. //下一页
  686. const getNext = () => {
  687. if (studentPage.value.current == studentPage.value.pages) {
  688. return false;
  689. }
  690. studentPage.value.current++;
  691. getStudentList();
  692. getStopPlaying();
  693. };
  694. //计算页码
  695. const getPages = (data: any) => {
  696. studentPage.value.pages = Math.ceil(data / studentPage.value.size);
  697. };
  698. //计算年级页码
  699. const getGradePages = (data: any, grade: any) => {
  700. let index = gradeData.value.findIndex((item: any) => {
  701. return item.value == grade;
  702. })
  703. gradeData.value[index].page.pages = Math.ceil(data / gradeData.value[index].page.size);
  704. };
  705. //更新时间
  706. const setDate = () => {
  707. //currentDate.value = getDate();
  708. setTimeout(setDate, 1000);
  709. };
  710. //查看详情
  711. const openReport = (data: any) => {
  712. reportWindowRef.value.open(projectObj.value.exam_name, data);
  713. };
  714. //监听窗口事件
  715. const returnData = (data: any) => {
  716. console.log("111", data)
  717. if (data == true) {
  718. getStopPlaying(60 * 5);
  719. }
  720. if (data == false) {
  721. getStopPlaying();
  722. }
  723. };
  724. /**
  725. * 返回
  726. */
  727. const confirmExit = () => {
  728. router.go(-1);
  729. };
  730. onBeforeMount(() => {
  731. const myInfo: any = localStorage.getItem("userInfo");
  732. const userinfo = JSON.parse(myInfo)
  733. logo.value = userinfo.avatar_url;
  734. let obj: any = dataDictionary.gradeLists.find((item) => {
  735. return item.value == userinfo.category;
  736. })
  737. gradeType.value = obj.child;
  738. getClass();
  739. })
  740. onMounted(() => {
  741. getTypeTime();
  742. getProject();
  743. })
  744. onUnmounted(() => {
  745. clearInterval(timer.value);
  746. clearInterval(countDownTimer.value);
  747. })
  748. </script>
  749. <style lang="scss" scoped>
  750. html {
  751. font-size: calc(100vw / 106);
  752. }
  753. ul,
  754. ol {
  755. margin: 0;
  756. padding: 0;
  757. }
  758. ul li {
  759. list-style: none;
  760. }
  761. $waiPadding: 6.51rem;
  762. .ranking {
  763. width: calc(100% - ($waiPadding * 2));
  764. padding-top: 9rem;
  765. margin: 0 auto;
  766. display: flex;
  767. flex-direction: column;
  768. .top {
  769. width: 100%;
  770. color: #ffffff;
  771. margin-bottom: 1vh;
  772. display: flex;
  773. justify-content: space-between;
  774. .top-left {
  775. display: flex;
  776. align-items: flex-end;
  777. .title1 {
  778. font-size: 3.14rem;
  779. line-height: 1;
  780. color: #00FFE8;
  781. margin-right: 1.49rem;
  782. }
  783. .title2 {
  784. font-size: 1.65rem;
  785. line-height: 1;
  786. color: #F9F9F9;
  787. padding-right: 2.2rem;
  788. background: url("@/assets/images/ranking/arrow.png") right center no-repeat;
  789. background-size: 1.5rem 1.1rem;
  790. cursor: pointer;
  791. }
  792. }
  793. .tab {
  794. display: flex;
  795. justify-content: space-between;
  796. align-items: center;
  797. ul {
  798. display: flex;
  799. margin: 0;
  800. margin-right: 20px;
  801. border: 1px solid #E1E4E7;
  802. border-radius: 2.3rem;
  803. overflow: hidden;
  804. box-sizing: border-box;
  805. li {
  806. height: 4.6vh;
  807. line-height: 4.6vh;
  808. padding: 0 20px;
  809. font-size: 1.2rem;
  810. color: #E1E4E7;
  811. cursor: pointer;
  812. }
  813. .current {
  814. color: #1A293A;
  815. background: radial-gradient(239% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
  816. }
  817. }
  818. dl {
  819. display: flex;
  820. margin: 0;
  821. background: radial-gradient(96% 96% at 2% 32%, #FFFFFF 0%, #FCFDFD 54%, #E1E4E7 100%);
  822. border-radius: 2.3vh;
  823. height: 4.6vh;
  824. dt {
  825. height: 4.6vh;
  826. line-height: 4.6vh;
  827. padding: 0 25px;
  828. border-radius: 2.3vh;
  829. font-size: 1.2rem;
  830. color: #1A293A;
  831. cursor: pointer;
  832. }
  833. .current {
  834. background: radial-gradient(239% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
  835. }
  836. }
  837. }
  838. }
  839. .mainBox {
  840. border-radius: 1.6rem;
  841. background: linear-gradient(67deg, #092941 -85%, #2A484B 96%);
  842. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.3);
  843. .main {
  844. height: calc(80vh - 9rem);
  845. display: flex;
  846. flex-direction: column;
  847. padding: 2vh 2vh 0 2vh;
  848. box-sizing: border-box;
  849. .main-a {
  850. width: 100%;
  851. height: 27vh;
  852. position: relative;
  853. margin-bottom: 2.5vh;
  854. display: flex;
  855. .main-a-center {
  856. display: flex;
  857. justify-content: space-around;
  858. align-items: flex-end;
  859. width: 100%;
  860. box-sizing: border-box;
  861. .item {
  862. width: calc(100%/3 - 10px);
  863. height: 100%;
  864. color: #ffffff;
  865. border-radius: 1.66rem;
  866. box-sizing: border-box;
  867. display: flex;
  868. justify-content: center;
  869. align-items: center;
  870. font-size: 1.9rem;
  871. cursor: pointer;
  872. .touxiang {
  873. width: 16vh;
  874. height: 16vh;
  875. box-sizing: border-box;
  876. border-radius: 50%;
  877. background: #ffffff;
  878. border: 5px solid rgba(26, 41, 58, 0.6315);
  879. flex-shrink: 0;
  880. margin-right: 15px;
  881. position: relative;
  882. img {
  883. border-radius: 50%;
  884. width: 100%;
  885. height: 100%;
  886. overflow: hidden;
  887. }
  888. &::before {
  889. content: "";
  890. width: 6vh;
  891. height: 4vh;
  892. display: flex;
  893. position: absolute;
  894. left: 50%;
  895. margin-left: -3vh;
  896. top: calc(-4vh - 5px);
  897. background-size: 100% 100%;
  898. background-position: center center;
  899. background-repeat: no-repeat;
  900. background-image: url("@/assets/images/ranking/mao.png");
  901. }
  902. }
  903. }
  904. .txt {
  905. display: flex;
  906. justify-content: space-between;
  907. flex-direction: column;
  908. .number {
  909. color: #1A293A;
  910. font-size: 5.35rem;
  911. font-family: 'Saira-ExtraBold';
  912. line-height: 1;
  913. margin-bottom: 5px;
  914. }
  915. .studentName {
  916. display: block;
  917. white-space: nowrap;
  918. overflow: hidden;
  919. text-overflow: ellipsis;
  920. line-height: 1;
  921. text-align: center;
  922. border-radius: 3rem;
  923. padding: 0.5rem 0;
  924. background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.6571) 100%);
  925. color: #1A293A;
  926. box-sizing: border-box;
  927. border: 1px solid #FFFFFF;
  928. margin-bottom: 5px;
  929. }
  930. .scoreBox {
  931. display: flex;
  932. line-height: 1;
  933. align-items: center;
  934. justify-content: center;
  935. color: #1A293A;
  936. .score {
  937. font-size: 3.53rem;
  938. font-family: 'Saira-ExtraBold';
  939. }
  940. .unit {
  941. font-size: 2rem;
  942. margin-left: 4px;
  943. }
  944. }
  945. }
  946. }
  947. .one {
  948. background: radial-gradient(87% 129% at 96% 5%, #FAFF28 0%, #FFDC22 100%);
  949. }
  950. .two {
  951. background: radial-gradient(66% 97% at 96% 5%, #61FFC7 0%, #8BFF69 100%);
  952. }
  953. .three {
  954. background: radial-gradient(65% 96% at 96% 5%, #7BFFF1 0%, #67FFC6 100%);
  955. }
  956. }
  957. }
  958. .main-b {
  959. width: 100%;
  960. height: 40vh;
  961. position: relative;
  962. display: flex;
  963. .main-b-center {
  964. width: 100%;
  965. height: 100%;
  966. padding: 0px;
  967. box-sizing: border-box;
  968. display: flex;
  969. .columns {
  970. height: 100%;
  971. width: calc(100% / 3);
  972. flex: 1;
  973. box-sizing: border-box;
  974. padding: 0px 1.8rem;
  975. display: flex;
  976. border-right: 1.5px solid #48677E;
  977. flex-shrink: 0;
  978. &:last-child {
  979. border: none;
  980. }
  981. ul {
  982. width: 100%;
  983. li {
  984. height: 20%;
  985. color: #ffffff;
  986. font-size: 1.6rem;
  987. overflow: hidden;
  988. display: flex;
  989. align-items: center;
  990. cursor: pointer;
  991. border-bottom: 1px solid #979797;
  992. box-sizing: border-box;
  993. .txt {
  994. width: 100%;
  995. display: flex;
  996. align-items: center;
  997. justify-content: space-between;
  998. i {
  999. font-size: 1.65rem;
  1000. min-width: 2.5rem;
  1001. margin-right: 1.5rem;
  1002. font-style: normal;
  1003. text-align: center;
  1004. color: #13ED84;
  1005. font-family: 'Saira-ExtraBold';
  1006. }
  1007. .studentName {
  1008. max-width: 20rem;
  1009. font-size: 1.65rem;
  1010. color: #F9F9F9;
  1011. display: block;
  1012. white-space: nowrap;
  1013. overflow: hidden;
  1014. text-overflow: ellipsis;
  1015. flex: 1;
  1016. }
  1017. .right {
  1018. display: flex;
  1019. line-height: 1;
  1020. align-items: center;
  1021. justify-content: center;
  1022. color: #F9F9F9;
  1023. .score {
  1024. font-size: 1.3rem;
  1025. font-family: 'Saira-ExtraBold';
  1026. }
  1027. .unit {
  1028. font-size: 0.8rem;
  1029. margin-left: 4px;
  1030. }
  1031. }
  1032. }
  1033. &:last-child {
  1034. border: none
  1035. }
  1036. }
  1037. }
  1038. }
  1039. }
  1040. .btn-left {
  1041. cursor: pointer;
  1042. width: 16px;
  1043. height: 16px;
  1044. margin-left: 0px;
  1045. background: url("@/assets/images/ranking/btn-left.png") center center no-repeat;
  1046. background-size: 100% 100%;
  1047. flex-shrink: 0;
  1048. position: absolute;
  1049. left: 0;
  1050. top: 50%;
  1051. margin-top: -8px;
  1052. }
  1053. .btn-right {
  1054. cursor: pointer;
  1055. width: 16px;
  1056. height: 16px;
  1057. margin-right: 0px;
  1058. background: url("@/assets/images/ranking/btn-right.png") center center no-repeat;
  1059. background-size: 100% 100%;
  1060. flex-shrink: 0;
  1061. position: absolute;
  1062. right: 0;
  1063. top: 50%;
  1064. margin-top: -8px;
  1065. }
  1066. }
  1067. .swiperBox {
  1068. width: 100%;
  1069. .item {
  1070. .gradeTitle {
  1071. height: 6vh;
  1072. line-height: 6vh;
  1073. width: 100%;
  1074. text-align: center;
  1075. color: #1A293A;
  1076. font-size: 1.65rem;
  1077. background: radial-gradient(120% 126% at 5% 93%, #8EFFA9 0%, #07FFE7 100%);
  1078. border-top-left-radius: 1.6rem;
  1079. border-top-right-radius: 1.6rem;
  1080. }
  1081. ul {
  1082. height: calc(80vh - 9rem - 2vh - 6vh);
  1083. margin-bottom: 0.5vh;
  1084. overflow-y: scroll;
  1085. overflow-x: hidden;
  1086. border-left: 1px solid #48677E;
  1087. border-right: 1px solid #48677E;
  1088. box-sizing: border-box;
  1089. li {
  1090. * {
  1091. pointer-events: none;
  1092. }
  1093. height: 8.2vh;
  1094. display: flex;
  1095. align-items: center;
  1096. padding: 0px 30px;
  1097. color: #ffffff;
  1098. justify-content: space-between;
  1099. cursor: pointer;
  1100. border-bottom: 1px solid #48677E;
  1101. .left {
  1102. display: flex;
  1103. i {
  1104. font-size: 1.1rem;
  1105. min-width: 2.5rem;
  1106. margin-right: 1rem;
  1107. font-style: normal;
  1108. text-align: center;
  1109. color: #13ED84;
  1110. font-family: 'Saira-ExtraBold';
  1111. }
  1112. .pai {
  1113. width: 3.5rem;
  1114. height: 2.5rem;
  1115. box-sizing: border-box;
  1116. padding-top: 0.9rem;
  1117. color: #FFFFFF;
  1118. }
  1119. .pai1 {
  1120. background: url("@/assets/images/ranking/pai1.png") left center no-repeat;
  1121. background-size: 100% 100%;
  1122. }
  1123. .pai2 {
  1124. background: url("@/assets/images/ranking/pai2.png") left center no-repeat;
  1125. background-size: 100% 100%;
  1126. }
  1127. .pai3 {
  1128. background: url("@/assets/images/ranking/pai3.png") left center no-repeat;
  1129. background-size: 100% 100%;
  1130. }
  1131. .userInfo {
  1132. display: flex;
  1133. .touxiang {
  1134. width: 6vh;
  1135. height: 6vh;
  1136. box-sizing: border-box;
  1137. border-radius: 50%;
  1138. background: #ffffff;
  1139. margin-left: 10px;
  1140. margin-right: 13px;
  1141. flex-shrink: 0;
  1142. img {
  1143. border-radius: 50%;
  1144. width: 100%;
  1145. height: 100%;
  1146. overflow: hidden;
  1147. }
  1148. }
  1149. .nameBox {
  1150. display: flex;
  1151. text-align: left;
  1152. flex-direction: column;
  1153. .studentName {
  1154. color: #F9F9F9;
  1155. font-size: 1rem;
  1156. margin-bottom: 0.5vh;
  1157. }
  1158. .className {
  1159. font-size: 0.8rem;
  1160. color: #13ED84;
  1161. }
  1162. }
  1163. }
  1164. }
  1165. .right {
  1166. display: flex;
  1167. line-height: 1;
  1168. align-items: center;
  1169. justify-content: center;
  1170. color: #F9F9F9;
  1171. .score {
  1172. font-size: 1.3rem;
  1173. font-family: 'Saira-ExtraBold';
  1174. }
  1175. .unit {
  1176. font-size: 0.8rem;
  1177. margin-left: 4px;
  1178. }
  1179. }
  1180. }
  1181. &::-webkit-scrollbar {
  1182. width: 8px;
  1183. }
  1184. &::-webkit-scrollbar-thumb {
  1185. border-width: 2px;
  1186. border-radius: 4px;
  1187. border-style: dashed;
  1188. border-color: transparent;
  1189. background: rgb(27, 72, 92);
  1190. background-clip: padding-box;
  1191. }
  1192. &::-webkit-scrollbar-button:hover {
  1193. border-radius: 5px;
  1194. background: rgba(26, 62, 78, 1);
  1195. }
  1196. }
  1197. }
  1198. }
  1199. .noData {
  1200. display: flex;
  1201. justify-content: center;
  1202. align-items: center;
  1203. flex-direction: column;
  1204. font-size: 1rem;
  1205. color: #ffffff;
  1206. text-align: center;
  1207. margin: 0 auto;
  1208. img {
  1209. max-width: 70%;
  1210. margin-bottom: 10px;
  1211. }
  1212. span {
  1213. display: block;
  1214. }
  1215. }
  1216. .swiper-btn {
  1217. width: 2.5rem;
  1218. height: 2.5rem;
  1219. display: block;
  1220. &::after {
  1221. display: none;
  1222. }
  1223. }
  1224. .swiper-btn-left {
  1225. background: url("@/assets/images/ranking/btn-left.png") left center no-repeat;
  1226. background-size: 100% 100%;
  1227. }
  1228. .swiper-btn-right {
  1229. background: url("@/assets/images/ranking/btn-right.png") left center no-repeat;
  1230. background-size: 100% 100%;
  1231. }
  1232. }
  1233. .footer {
  1234. width: 100%;
  1235. display: flex;
  1236. align-items: center;
  1237. border-top: 1px solid #48677E;
  1238. overflow: hidden;
  1239. box-sizing: border-box;
  1240. padding: 0 2vh;
  1241. .tab {
  1242. width: 100%;
  1243. padding-top: 1.5rem;
  1244. ul {
  1245. display: flex;
  1246. padding-bottom: 0.1rem;
  1247. overflow-x: scroll;
  1248. li {
  1249. height: 4.6vh;
  1250. line-height: 4.6vh;
  1251. padding: 0 20px;
  1252. font-size: 1.2rem;
  1253. color: #F9F9F9;
  1254. margin: 0 0.6rem;
  1255. border-radius: 2.3vh;
  1256. cursor: pointer;
  1257. flex-shrink: 0;
  1258. &:hover {
  1259. background: #00FFE8;
  1260. color: #1A293A;
  1261. }
  1262. }
  1263. .current {
  1264. background: #00FFE8;
  1265. color: #1A293A;
  1266. }
  1267. &::-webkit-scrollbar {
  1268. width: 6px;
  1269. }
  1270. &::-webkit-scrollbar-thumb {
  1271. border-radius: 3px;
  1272. border-style: dashed;
  1273. border-color: transparent;
  1274. background: rgb(27, 72, 92);
  1275. background-clip: padding-box;
  1276. }
  1277. &::-webkit-scrollbar-button:hover {
  1278. border-radius: 3px;
  1279. background: rgba(26, 62, 78, 1);
  1280. }
  1281. }
  1282. }
  1283. }
  1284. }
  1285. .choiceClass {
  1286. width: calc(100% - ($waiPadding * 2));
  1287. position: absolute;
  1288. z-index: 2;
  1289. top: 10vh;
  1290. left: var($waiPadding);
  1291. background: rgba(11, 29, 39, 0.9);
  1292. border-radius: 10px;
  1293. padding: 20px;
  1294. box-sizing: border-box;
  1295. box-shadow: rgba(57, 187, 187, 0.48) 0px 0px 10px 10px inset;
  1296. border: 2px solid rgb(57, 187, 187);
  1297. .choiceClass-content {
  1298. color: #ffffff;
  1299. display: flex;
  1300. justify-content: space-around;
  1301. .classTitle {
  1302. font-size: 1.4rem;
  1303. margin-bottom: 20px;
  1304. }
  1305. ul {
  1306. height: 67vh;
  1307. margin-bottom: 2vh;
  1308. overflow-y: scroll;
  1309. li {
  1310. font-size: 1.2rem;
  1311. padding: 10px 0;
  1312. cursor: pointer;
  1313. &:hover {
  1314. color: #0936a3;
  1315. }
  1316. }
  1317. &::-webkit-scrollbar {
  1318. width: 10px;
  1319. }
  1320. &::-webkit-scrollbar-thumb {
  1321. border-width: 2px;
  1322. border-radius: 4px;
  1323. border-style: dashed;
  1324. border-color: transparent;
  1325. background-color: rgba(26, 62, 78, 0.5);
  1326. background-clip: padding-box;
  1327. }
  1328. &::-webkit-scrollbar-button:hover {
  1329. border-radius: 6px;
  1330. background: rgba(26, 62, 78, 1);
  1331. }
  1332. }
  1333. }
  1334. .choiceClass-btn-box {
  1335. display: flex;
  1336. justify-content: center;
  1337. .choiceClass-btn {
  1338. margin: 0 15px;
  1339. text-align: center;
  1340. width: 100px;
  1341. background: #39bbbb;
  1342. height: 35px;
  1343. line-height: 35px;
  1344. color: #fff;
  1345. cursor: pointer;
  1346. }
  1347. .choiceClass-btn-all {
  1348. background: rgba(13, 90, 245, 0.5);
  1349. }
  1350. }
  1351. }
  1352. .fade-enter-active,
  1353. .fade-leave-active {
  1354. transition: opacity 0.5s;
  1355. }
  1356. .fade-enter,
  1357. .fade-leave-to
  1358. /* .fade-leave-active below version 2.1.8 */
  1359. {
  1360. opacity: 0;
  1361. }
  1362. </style>