App.vue 9.8 KB

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