App.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. <template>
  2. <div
  3. id="app"
  4. :class="{
  5. appNoWidth:
  6. $route.path == '/data' ||
  7. $route.path == '/note' ||
  8. $route.path == '/works',
  9. appNoHeight: $route.path == '/liveRoom',
  10. GMBg:
  11. this.$route.query.org == 'eb2af5e9-ac3d-46b6-9fe3-3c1c364f0217' &&
  12. $route.path != '/courseGM' &&
  13. $route.path != '/course/addCourseGM' &&
  14. $route.path != '/dataGM',
  15. testBg: $route.path == '/test'
  16. }"
  17. >
  18. <button @click="toggleVConsole" class="openV"></button>
  19. <!-- <div class="app_head" :class="{stuWidth:$route.path == '/student'}"> -->
  20. <!-- <div class="logo" @click="goTo('/course')"></div>
  21. <span style="margin-left: 10px; color: #fff; font-weight: 600" @click="goTo('/course')"
  22. >PBL项目管理平台</span
  23. >
  24. <div class="user_head" v-if="this.$store.state.isLogin">
  25. <div class="noticeBox">
  26. <i class="noticeI" @click="goTo('/works')"></i>
  27. <span v-if="this.$store.state.nCount != 0">{{
  28. this.$store.state.nCount > 99 ? "99+" : this.$store.state.nCount
  29. }}</span>
  30. </div>
  31. <span class="user_name">{{
  32. this.$store.state.userInfo ? this.$store.state.userInfo.name : "用户"
  33. }}</span>
  34. <div @click="exit">
  35. <i class="exitI"></i>
  36. <el-button type="text" style="color: white"
  37. >退出</el-button
  38. >
  39. </div>
  40. </div>-->
  41. <!-- </div> -->
  42. <div
  43. :class="{
  44. gHeight: $route.path == '/Grid',
  45. getOverView: $route.path == '/myReport',
  46. }"
  47. style="width: 100%; height: 100%"
  48. :style="{ overflow: $route.path == '/liveRoom' ? 'hidden' : '' }"
  49. >
  50. <!-- main 内容 -->
  51. <keep-alive>
  52. <!-- 这里是会被缓存的视图组件 -->
  53. <router-view
  54. v-if="$route.meta.keepAlive"
  55. :class="{ pb_body: isShowNav }"
  56. />
  57. </keep-alive>
  58. <!-- 这里是不被缓存的视图组件 -->
  59. <router-view
  60. v-if="!$route.meta.keepAlive"
  61. :class="{ pb_body: isShowNav }"
  62. />
  63. <!-- 底部导航 -->
  64. <!-- <footer-nav
  65. v-if="isShowNav"
  66. :luyou="this.$store.state.luyou"
  67. ></footer-nav>-->
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. // import leftBar from "./components/tools/leftBar";
  73. import { Message } from "element-ui";
  74. import VConsole from 'vconsole';
  75. export default {
  76. name: "App",
  77. data() {
  78. return {
  79. isShowNav: true, // 是否显示导航 Tab
  80. navTabs: [
  81. "/class",
  82. "/course",
  83. "/courseGM",
  84. "/data",
  85. "/dataGM",
  86. "/notice",
  87. "/student",
  88. "/works",
  89. "/worksGM",
  90. "/worksDetail",
  91. "/course/courseDetail",
  92. "/library",
  93. "/libraryGM",
  94. "/classRoom",
  95. "/liveRoom",
  96. "/addPPt",
  97. "/studyLibrary",
  98. "/GridList",
  99. "/wordList",
  100. "/Ttype",
  101. "/banner",
  102. "/studentCourse",
  103. "/scourse",
  104. "/studentCheckCourse",
  105. "/tcData",
  106. "/studioCourse",
  107. "/teacherSource",
  108. "/grade",
  109. "/test",
  110. "/testStudent",
  111. "/checkToTest"
  112. // "/eventCenter",
  113. // "/addRace",
  114. // "/anliDetail",
  115. // "/course/addCourse",
  116. // "/ask",
  117. // "/ask/askList",
  118. ], // 导航
  119. vConsoleEnabled: false,
  120. vConsoleInstance: null,
  121. };
  122. },
  123. // components: {
  124. // "footer-nav": leftBar,
  125. // },
  126. created: function () {
  127. this.routerP();
  128. // this.getnCount();
  129. setInterval(() => {
  130. // this.getnCount();
  131. }, 60000);
  132. },
  133. methods: {
  134. toggleVConsole() {
  135. if (this.vConsoleEnabled) {
  136. // 关闭 vConsole
  137. this.vConsoleInstance.destroy();
  138. this.vConsoleInstance = null;
  139. } else {
  140. // 开启 vConsole
  141. this.vConsoleInstance = new VConsole();
  142. }
  143. this.vConsoleEnabled = !this.vConsoleEnabled;
  144. },
  145. isLogin() {
  146. const loading = this.$loading.service({
  147. background: "rgba(255, 255, 255)",
  148. target: document.querySelector("body"),
  149. });
  150. var _isLogin = this.$cookies.get("tlogin");
  151. var userInfo = this.$cookies.get("teacherInfo");
  152. // if (_isLogin == "1" && userInfo) {
  153. loading.close();
  154. this.$store.commit("update", ["isLogin", true]);
  155. // var info = JSON.parse(window.sessionStorage.getItem("userInfo"));
  156. this.$store.commit("update", ["userInfo", userInfo]);
  157. let router_path = this.$route.path;
  158. if (router_path == "/") {
  159. this.$router.push("/course");
  160. }
  161. // } else {
  162. // this.$store.commit("update", ["isLogin", false]);
  163. // Message({
  164. // message: "未登录,请登录",
  165. // type: "warning",
  166. // });
  167. // setTimeout(() => {
  168. // loading.close();
  169. // this.$router.push("/login");
  170. // }, 2000);
  171. // }
  172. },
  173. getnCount() {
  174. let params = {
  175. bid: this.$store.state.userInfo.userid,
  176. };
  177. this.ajax
  178. .get(this.$store.state.api + "getNcount", params)
  179. .then((res) => {
  180. console.log(res);
  181. if (res.data[0].length > 0) {
  182. this.$store.commit("update", ["nCount", res.data[0][0].num]);
  183. } else {
  184. this.$store.commit("update", ["nCount", 0]);
  185. }
  186. })
  187. .catch((err) => {
  188. console.error(err);
  189. });
  190. },
  191. routerP() {
  192. const { navTabs } = this.$data;
  193. let router_path = this.$route.path;
  194. console.log(router_path);
  195. if (router_path != "/login") {
  196. this.isLogin();
  197. }
  198. var a = 0;
  199. for (var i = 0; i < navTabs.length; i++) {
  200. if (router_path == navTabs[i]) {
  201. this.isShowNav = true;
  202. a = 1;
  203. break;
  204. }
  205. }
  206. if (a == 0) {
  207. this.isShowNav = false;
  208. }
  209. },
  210. exit() {
  211. sessionStorage.clear();
  212. this.$cookies.remove("tlogin");
  213. this.$cookies.remove("teacherInfo");
  214. this.$store.commit("update", ["isLogin", false]);
  215. this.$store.commit("update", ["userInfo", {}]);
  216. Message({
  217. message: "退出成功",
  218. type: "success",
  219. });
  220. this.$router.push("/login");
  221. },
  222. goTo(path) {
  223. this.$router.push(path);
  224. },
  225. },
  226. watch: {
  227. $route(to, from) {
  228. const { navTabs } = this.$data;
  229. const toPath = to.path;
  230. const fromName = from.name;
  231. var a = 0;
  232. for (var i = 0; i < navTabs.length; i++) {
  233. if (toPath == navTabs[i]) {
  234. this.isShowNav = true;
  235. a = 1;
  236. break;
  237. }
  238. }
  239. if (a == 0) {
  240. this.isShowNav = false;
  241. }
  242. },
  243. },
  244. };
  245. </script>
  246. <style>
  247. * {
  248. margin: 0;
  249. padding: 0;
  250. }
  251. /* body {
  252. font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
  253. "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  254. } */
  255. #app {
  256. height: 100%;
  257. width: 100%;
  258. background: #e6eaf0;
  259. /* min-width: 1380px; */
  260. /* min-width: 1250px; */
  261. }
  262. .appNoWidth {
  263. min-width: unset !important;
  264. display: inline-block !important;
  265. min-width: 550px;
  266. }
  267. .appNoHeight {
  268. min-height: 750px;
  269. }
  270. .app_head {
  271. height: 67.5px;
  272. width: 100%;
  273. background-color: rgb(61, 103, 188);
  274. display: flex;
  275. align-items: center;
  276. min-width: 1000px;
  277. }
  278. .logo {
  279. height: 48px;
  280. width: 73px;
  281. background: url("./assets/logo.png");
  282. background-size: 100% 100%;
  283. margin-left: 20px;
  284. }
  285. .pb_body {
  286. /* padding: 20px; */
  287. /* width: 98%; */
  288. /* min-width: 745px;*/
  289. /* display: inline-block; */
  290. /* height: 95%; */
  291. /* min-height: 750px; */
  292. background: #fff;
  293. border-radius: 5px;
  294. /* position: absolute; */
  295. }
  296. .pb_head {
  297. font-size: 26px;
  298. /* font-weight: 600; */
  299. width: 95%;
  300. margin: 10px auto;
  301. padding: 10px 5px;
  302. border-bottom: 1px solid #eee;
  303. }
  304. .pb_content {
  305. /* height: 100%; */
  306. }
  307. .pb_content_body {
  308. width: 94%;
  309. margin: 10px auto;
  310. /* overflow: auto;
  311. height: calc(100% - 120px); */
  312. }
  313. .user_head {
  314. display: flex;
  315. align-items: center;
  316. margin-left: auto;
  317. margin-right: 20px;
  318. font-size: 18px;
  319. font-weight: 600;
  320. }
  321. .user_head .user_name {
  322. color: #fff;
  323. margin-right: 10px;
  324. }
  325. .user_head div {
  326. display: flex;
  327. align-items: center;
  328. cursor: pointer;
  329. }
  330. .user_head .exitI {
  331. background-image: url("./assets/exit.png");
  332. width: 25px;
  333. height: 25px;
  334. background-size: 100% 100%;
  335. margin-top: 1px;
  336. line-height: 25px;
  337. vertical-align: text-top;
  338. background-repeat: no-repeat;
  339. }
  340. .noticeBox {
  341. position: relative;
  342. margin-right: 10px;
  343. }
  344. .user_head .noticeI {
  345. background-image: url("./assets/icon/noticeA.png");
  346. width: 25px;
  347. height: 25px;
  348. background-size: 100% 100%;
  349. margin-top: 1px;
  350. line-height: 25px;
  351. vertical-align: text-top;
  352. background-repeat: no-repeat;
  353. cursor: pointer;
  354. }
  355. .noticeBox span {
  356. position: absolute;
  357. background: red;
  358. width: 15px;
  359. height: 15px;
  360. border-radius: 30px;
  361. color: #fff;
  362. text-align: center;
  363. font-size: 12px;
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. top: -3px;
  368. right: -3px;
  369. }
  370. .stuWidth {
  371. min-width: 1180px;
  372. }
  373. .gHeight {
  374. height: 100%;
  375. }
  376. html::-webkit-scrollbar {
  377. /*滚动条整体样式*/
  378. width: 6px;
  379. /*高宽分别对应横竖滚动条的尺寸*/
  380. height: 6px;
  381. }
  382. /*定义滚动条轨道 内阴影+圆角*/
  383. html::-webkit-scrollbar {
  384. border-radius: 10px;
  385. background-color: #eee;
  386. }
  387. /*定义滑块 内阴影+圆角*/
  388. html::-webkit-scrollbar-thumb {
  389. border-radius: 10px;
  390. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
  391. background-color: rgba(0, 0, 0, 0.1);
  392. }
  393. .btnClassGM {
  394. background: #8681b7 !important;
  395. border-color: #8681b7 !important;
  396. }
  397. .btnClassGM:focus,
  398. .btnClassGM:hover {
  399. background: #8681b7 !important;
  400. border-color: #8681b7 !important;
  401. }
  402. .GMBg {
  403. background: rgb(184, 181, 202) !important;
  404. }
  405. .testBg{
  406. background: #f0f2f5;
  407. }
  408. .cancelbtnGM:focus,
  409. .cancelbtnGM:hover {
  410. color: rgb(92, 84, 159) !important;
  411. border-color: #5c549f !important;
  412. background-color: #dbd7ff !important;
  413. }
  414. .text_tooltip {
  415. max-width: 350px !important;
  416. }
  417. .text_tooltip2 {
  418. max-width: 400px !important;
  419. }
  420. .getOverView{
  421. overflow-x: auto;
  422. }
  423. .showtip{
  424. z-index: 999999999 !important;
  425. }
  426. .el-message-box{
  427. padding-bottom: 20px !important;
  428. }
  429. .el-message-box__header{
  430. font-weight: 700 !important;
  431. }
  432. .el-message-box__content{
  433. padding: 10px 15px 25px !important;
  434. }
  435. .el-icon-warning:before{
  436. content: '' !important;
  437. width: 20px !important;
  438. height: 20px !important;
  439. display: block !important;
  440. background-image: url("./assets/icon/new/tips.png") !important;
  441. background-size: 100% 100% !important;
  442. }
  443. .el-message-box__status+.el-message-box__message{
  444. padding-left: 30px !important;
  445. }
  446. .el-message-box__btns{
  447. text-align: center !important;
  448. }
  449. .el-message-box__btns > .el-button--small{
  450. border: 1px solid #CAD1DC !important;
  451. background: #E7EBF1 !important;
  452. color: #060E17 !important;
  453. }
  454. .el-message-box__btns > .el-button--small:hover{
  455. background: #CAD1DC !important;
  456. color: #060E17 !important;
  457. }
  458. .el-message-box__btns > .el-button--primary{
  459. border: 1px solid #EE3E3E !important;
  460. background: #EE3E3E !important;
  461. color: #fff !important;
  462. }
  463. .el-message-box__btns > .el-button--primary:hover{
  464. border: 1px solid #cd3434 !important;
  465. background: #cd3434 !important;
  466. color: #fff !important;
  467. }
  468. .el-checkbox:hover .el-checkbox__label{
  469. color:#409EFF;
  470. }
  471. .el-checkbox .el-checkbox__label{
  472. color: #0E1E33;
  473. }
  474. .el-checkbox:hover .el-checkbox__inner{
  475. border-color: #409EFF;
  476. }
  477. .el-checkbox .el-checkbox, .el-checkbox .el-checkbox__input{
  478. display: flex;
  479. align-items: center;
  480. }
  481. .el-cascader-node__label{
  482. max-width: 150px;
  483. }
  484. .el-pagination.is-background .el-pager li:not(.disabled).active{
  485. background-color: #0061FF !important;
  486. color: #FFF !important;
  487. }
  488. .el-pagination.is-background .el-pager li:not(.disabled):hover {
  489. color: #0061FF !important;
  490. }
  491. .el-pagination.is-background .el-pager li:not(.disabled).active {
  492. background-color: #0061FF !important;
  493. color: #FFF !important;
  494. }
  495. .tooltip {
  496. position: absolute; /* 确保tooltip处于正确的定位 */
  497. top: 0;
  498. }
  499. .el-table-filter__checkbox-group label.el-checkbox {
  500. display: flex !important;
  501. }
  502. .el-table-filter__bottom{
  503. display: flex;
  504. justify-content: flex-end;
  505. }
  506. .custom-confirm-box{
  507. width: 450px;
  508. }
  509. .openV {
  510. position: absolute;
  511. width: 20px;
  512. height: 20px;
  513. border: none;
  514. background: none;
  515. z-index: 99999;
  516. }
  517. .count-node {
  518. position: absolute;
  519. top: 2px;
  520. display: none;
  521. height: 24px;
  522. padding: 0 8px;
  523. line-height: 22px;
  524. margin-left: 6px;
  525. background-color: #f4f4f5;
  526. border: 1px solid #e9e9eb;
  527. border-radius: 4px;
  528. color: #909399;
  529. font-size: 12px;
  530. box-sizing: border-box;
  531. }
  532. .file_mySelect .el-input {
  533. width: 80px !important;
  534. }
  535. .file_mySelect .el-input .el-input__inner{
  536. height: 28px !important;
  537. }
  538. .file_mySelect .el-input__suffix{
  539. display: flex;
  540. align-items: center;
  541. }
  542. </style>