App.vue 11 KB

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