App.vue 12 KB

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