index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /*layout模板*/
  2. <template>
  3. <div>
  4. <div class="lbg_color1" :class="['header',fixedHeader?'fixed-header':'']" >
  5. <router-link to="/home/myproject">
  6. <div class="logo">
  7. <el-image :src="logo" fit="cover" /> </div>
  8. </router-link>
  9. <div
  10. v-if="
  11. $route.path !== '/login' &&
  12. $route.path !== '/register' &&
  13. $route.path !== '/forget' &&
  14. $route.path !== '/protocol'
  15. "
  16. class="nav"
  17. >
  18. <el-menu
  19. mode="horizontal"
  20. :unique-opened="true"
  21. text-color="#333"
  22. active-text-color="#333"
  23. background-color="background-color: rgba($color: #0158a8, $alpha: 0);"
  24. :default-active="activeMenu"
  25. >
  26. <div class="headericon">
  27. <ul>
  28. <li class="text_color"><el-tooltip class="item" effect="dark" content="任务" placement="bottom"><i class="el-icon-s-fold"></i> </el-tooltip> </li>
  29. <li class="text_color"><el-tooltip class="item" effect="dark" content="团队" placement="bottom"><i class="el-icon-s-custom"></i> </el-tooltip></li>
  30. <li class="text_color" @click="dialogsystem=true"><i class="el-icon-s-tools"></i></li>
  31. <li class="text_color">
  32. <span > <i class="el-icon-question" style="padding:1px 0"></i>
  33. <i style="font-size:12px;padding:5px 0" class="el-icon-arrow-down"></i>
  34. </span>
  35. </li>
  36. </ul>
  37. </div>
  38. <el-menu-item index="/home/myproject" >
  39. <router-link to="/home/myproject" ><span class="text_color">控制台</span></router-link>
  40. </el-menu-item>
  41. <el-menu-item background-color="background-color: rgba($color: #0158a8, $alpha: 0.1);"
  42. v-if="loginStatus"
  43. :class="currentMenu == 'user' ? 'itemOn' : ''"
  44. >
  45. <router-link to="/userLayout">
  46. <div class="user">
  47. <el-dropdown>
  48. <div>
  49. <span class="login text_color" :title="name">{{ name }}</span>
  50. <i class="el-icon-arrow-down" />
  51. </div>
  52. <el-dropdown-menu slot="dropdown">
  53. <el-dropdown-item @click.native="logout"
  54. >退出登录</el-dropdown-item
  55. >
  56. </el-dropdown-menu>
  57. </el-dropdown>
  58. </div>
  59. </router-link>
  60. </el-menu-item>
  61. <el-menu-item v-else style=" background:none;">
  62. <p @click="toLogin" class="login text_color">登录/注册</p>
  63. </el-menu-item>
  64. </el-menu>
  65. </div>
  66. </div>
  67. <section class="app-main lbg_color2">
  68. <transition name="fade-transform" mode="out-in">
  69. <router-view :key="key" />
  70. </transition>
  71. </section>
  72. <div class="lbg_color2"
  73. :class="[
  74. 'footer',
  75. fixedHeader ? 'fixed-footer' : '',
  76. /^\/indexLayout([\/][\D]+)?$/.test($route.path)|| /^\/matchLayout([\/][\D]+)?$/.test($route.path)||/^\/topic([\/][\D]+)?$/.test($route.path)||
  77. /^\/detailbzs1([\/][\D]+)?$/.test($route.path)|| /^\/detailbzs2([\/][\D]+)?$/.test($route.path)|| /^\/detailbzs3([\/][\D]+)?$/.test($route.path)|| /^\/detailbzs4([\/][\D]+)?$/.test($route.path)
  78. ? 'footer-index'
  79. : /^\/login\/index$/.test($route.path)
  80. ? 'footer-login'
  81. : '',
  82. ]"
  83. >
  84. <a href="https://www.xichain.com.cn/xichain/" target="_blank"
  85. >Copyright ©2015-2018 西安前沿动力有限公司All Rights Reserved</a
  86. >
  87. <a href="http://www.beian.miit.gov.cn/" target="_blank"
  88. >版权所有:西安前沿动力软件开发有限责任公司 陕ICP备13000621号</a
  89. >
  90. <!-- <img class="police" src="../assets/img/police.png" />
  91. <a
  92. href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=50010302003067"
  93. target="_blank"
  94. >渝公网安备 50010302003067号</a
  95. > -->
  96. <!-- <span v-show="xglogo">服务热线:023-63410620</span> -->
  97. </div>
  98. <el-dialog
  99. :visible.sync="dialogsystem"
  100. title="主题更换"
  101. width="480px"
  102. >
  103. <div>
  104. <button v-for="(item,index) in itemlist" :key='index' @click="clicksel(index)">{{item.name}}</button>
  105. </div>
  106. <!-- <span :data-theme='theme'></span> -->
  107. <span slot="footer" class="dialog-footer">
  108. <el-button @click="dialogsystem = false">关闭</el-button>
  109. </span>
  110. </el-dialog>
  111. <Login :loginShow="loginShow" @putLogin="getLogin" />
  112. <Register :registerShow="registerShow" @putRegister="getRegister" />
  113. <Forget :forgetShow="forgetShow" @putForget="getForget" />
  114. </div>
  115. </template>
  116. <script>
  117. import { parseTime } from '@/utils/index'
  118. import { request } from '@/utils/request'
  119. import { resetRouter } from '@/router'
  120. import { mapGetters } from 'vuex'
  121. import { MenuItem } from './components'
  122. // import countTo from 'vue-count-to'
  123. // import logo from '@/assets/index/logo.png'
  124. // import qylogo from '@/assets/index/qylogo.png'
  125. // import count from '@/assets/index/count.png'
  126. import logo from '@/assets/hcfd_images/adilog.png'
  127. import Login from '@/components/Login'
  128. import Register from '@/components/Register'
  129. import Forget from '@/components/Forget'
  130. export default {
  131. name: 'Layout',
  132. components: {
  133. MenuItem,
  134. // countTo,
  135. Login,
  136. Register,
  137. Forget,
  138. },
  139. data() {
  140. return {
  141. zhucenum:false,
  142. flag: false,
  143. logo:logo,
  144. yingyong:false,
  145. runProject: 0,
  146. totalProject: 0,
  147. user: 0,
  148. activeUser: 0,
  149. redirect: undefined,
  150. dialogsystem:false,
  151. loginShow: false,
  152. registerShow: false,
  153. forgetShow: false,
  154. currentMenu: '',
  155. itemlist:[
  156. {
  157. id:0,name:"黑色",
  158. },
  159. {
  160. id:1,name:"白色",
  161. }
  162. ],
  163. num:0,
  164. }
  165. },
  166. watch: {
  167. $route: {
  168. handler: function (route) {
  169. this.redirect = route.query && route.query.redirect
  170. },
  171. immediate: true,
  172. },
  173. },
  174. mounted(){
  175. setTimeout(function(){
  176. if(localStorage.getItem("num")==0){
  177. document.getElementById('theme').href="/static/black.css"
  178. }else{
  179. document.getElementById('theme').href="/static/white.css"
  180. }
  181. },100)
  182. },
  183. created() {
  184. },
  185. // 父组件中返回要传给下级的数据
  186. provide() {
  187. return {
  188. toLogin: this.toLogin,
  189. }
  190. },
  191. computed: {
  192. fixedHeader() {
  193. return this.$store.getters.fixedHeader
  194. },
  195. lesseeId() {
  196. return this.$store.getters.lesseeId
  197. },
  198. ...mapGetters(['name', 'userType', 'loginStatus']),
  199. key() {
  200. return this.$route.path
  201. },
  202. routes() {
  203. return this.$router.options.routes // 导航栏是使用 router.options.routes来遍历生成
  204. },
  205. activeMenu() {
  206. const route = this.$route
  207. const { meta, path } = route
  208. let pathArr = path.split('/')
  209. if (pathArr.length == 3 && pathArr[1] == 'userLayout') {
  210. this.currentMenu = 'user'
  211. } else if (
  212. pathArr.length == 3 &&
  213. pathArr[1] == 'indexLayout' &&
  214. pathArr[2] == 'my-workbench'
  215. ) {
  216. this.currentMenu = pathArr[2]
  217. } else {
  218. this.currentMenu = ''
  219. }
  220. // 如果设置了路径,侧边栏将突出显示您设置的路径
  221. if (meta.activeMenu) {
  222. return meta.activeMenu
  223. }
  224. return path
  225. },
  226. },
  227. methods: {
  228. routerclik(){
  229. const path=this.$route.path
  230. let id= sessionStorage.getItem("id",id);
  231. let pretreatment= sessionStorage.getItem("pretreatment",pretreatment);
  232. let solver= sessionStorage.getItem("pretreatment",solver);
  233. this.$router.replace({
  234. path: '/indexLayout/index',
  235. query: {id, pretreatment, solver },
  236. })
  237. // if(path=="/indexLayout/design"){
  238. // }else{
  239. // this.$router.replace({
  240. // path: '/indexLayout',
  241. // })
  242. // }
  243. },
  244. toLogin() {
  245. this.loginShow = true
  246. console.log(this.loginShow);
  247. },
  248. getLogin(data) {
  249. this.loginShow = false
  250. if (data) {
  251. if (data.type == 'register') {
  252. this.registerShow = true
  253. } else if (data.type == 'forget') {
  254. this.forgetShow = true
  255. }
  256. }
  257. },
  258. getRegister(data) {
  259. this.registerShow = false
  260. if (data && data.type == 'login') {
  261. this.loginShow = true
  262. }
  263. },
  264. getForget(data) {
  265. this.forgetShow = false
  266. if (data && data.type == 'login') {
  267. this.loginShow = true
  268. }
  269. },
  270. quit() {
  271. this.$store.dispatch('user/changeState', {
  272. key: 'token',
  273. value: '',
  274. })
  275. this.$store.dispatch('user/changeState', {
  276. key: 'name',
  277. value: '',
  278. })
  279. this.$store.dispatch('user/changeState', {
  280. key: 'userId',
  281. value: '',
  282. })
  283. this.$store.dispatch('user/changeState', {
  284. key: 'userRole',
  285. value: '',
  286. })
  287. this.$store.dispatch('user/changeState', {
  288. key: 'cfdUrl',
  289. value: '',
  290. })
  291. this.$store.dispatch('user/changeState', {
  292. key: 'loginStatus',
  293. value: false,
  294. })
  295. resetRouter()
  296. this.$message.success('退出成功!')
  297. setTimeout(() => {
  298. // this.$router.replace(`/login?redirect=${this.$route.fullPath}`)
  299. this.$router.replace(`/indexLayout/index`)
  300. }, 1000)
  301. },
  302. logout() {
  303. this.$confirm('此操作将退出登录, 是否继续?', '提示', {
  304. confirmButtonText: '确定',
  305. cancelButtonText: '取消',
  306. center: true,
  307. type: 'warning',
  308. })
  309. .then(() => {
  310. request({ transCode: 'A00004' })
  311. .then(() => {
  312. this.quit()
  313. })
  314. .catch((err) => {
  315. this.quit()
  316. })
  317. })
  318. .catch(() => {
  319. this.$message.info('已取消')
  320. })
  321. },
  322. // 主题替换
  323. clicksel(index){
  324. if(index==0){
  325. this.num=index;
  326. localStorage.setItem("num",this.num);
  327. document.getElementById('theme').href="/static/black.css"
  328. }else if(index==1){
  329. console.log(222)
  330. this.num=1;
  331. localStorage.setItem("num",this.num);
  332. document.getElementById('theme').href="/static/white.css"
  333. }else{
  334. }
  335. },
  336. },
  337. }
  338. </script>
  339. <style lang="scss" scoped>
  340. @import '@/styles/variables.scss';
  341. @import '@/styles/mixin.scss';
  342. // @import '@/styles/transition.scss';
  343. .fixed {
  344. &-header {
  345. // @include position(fixed, 0, auto, 0, 0, 9);
  346. @include w_h();
  347. }
  348. &-footer {
  349. // @include position(fixed, auto, 0, 0, 0, 9);
  350. @include w_h();
  351. }
  352. }
  353. .fixed-footer{
  354. position: fixed;
  355. top: auto;
  356. bottom: 0;
  357. left: 0;
  358. right: 0;
  359. z-index: 9;
  360. width: 100%;
  361. height: auto;
  362. }
  363. .show{
  364. background: $color_f;
  365. }
  366. .hidden{
  367. }
  368. .header {
  369. padding: 0 20px;
  370. @include flex();
  371. @include w_h(100%, 40px);
  372. min-width: 1000px;
  373. //background: $color_f;
  374. box-shadow: 0px 7px 7px 0px rgba(0, 0, 0, 0.04);
  375. .logo {
  376. @include w_h(100px);
  377. &:hover {
  378. cursor: pointer;
  379. }
  380. }
  381. .count {
  382. @include flex(flex-start);
  383. @include w_h(auto, 35px);
  384. padding: 0 $pad;
  385. font-size: 12px;
  386. color: $color_3;
  387. .item {
  388. margin: 0 20px;
  389. }
  390. .icon {
  391. @include w_h(14px);
  392. margin-right: 3px;
  393. vertical-align: bottom;
  394. }
  395. span {
  396. span {
  397. color: $color_on;
  398. }
  399. }
  400. }
  401. .nav {
  402. @include flex();
  403. height: 100%;
  404. font-size: 12px;
  405. .el-menu {
  406. height: 100%;
  407. border: none;
  408. background:none;
  409. color: #0470cc;
  410. .itemOn {
  411. // color: $color_on !important;
  412. // border-bottom: 2px solid $color_on !important;
  413. color: rgba($color: #0158a8, $alpha: 1)!important;
  414. border-bottom: 2px solid #0158a8!important;
  415. }
  416. }
  417. .user {
  418. color: inherit;
  419. span {
  420. display: inline-block;
  421. max-width: 100px;
  422. font-size: 14px;
  423. white-space: nowrap;
  424. text-overflow: ellipsis;
  425. overflow: hidden;
  426. }
  427. &:hover span {
  428. color: #f66420;
  429. }
  430. .el-icon-arrow-down {
  431. font-size: 12px;
  432. }
  433. }
  434. }
  435. }
  436. .app-main {
  437. width: 100%;
  438. height: calc(100vh - 75px);
  439. }
  440. .footer {
  441. @include w_h(100%, 35px);
  442. line-height: 35px;
  443. font-size: 12px;
  444. text-align: center;
  445. color: #747474;
  446. .police {
  447. vertical-align: sub;
  448. }
  449. a {
  450. padding-right: 10px;
  451. }
  452. a:hover {
  453. color: $color_9;
  454. }
  455. &-login {
  456. background: $color_f;
  457. }
  458. &-index {
  459. background: #2b2828;
  460. }
  461. }
  462. </style>
  463. <style lang="scss">
  464. @import '@/styles/variables.scss';
  465. .el-image__inner--center {
  466. left: 0 !important;
  467. transform: translate(0) !important;
  468. }
  469. .nav {
  470. .el-dropdown {
  471. color: inherit;
  472. }
  473. .el-menu-item,
  474. .el-submenu__title,
  475. .el-menu--horizontal > .el-menu-item {
  476. height: 40px;
  477. line-height: 40px;
  478. color: $color_3;
  479. border: none;
  480. padding: 0 5px;
  481. margin: 0 15px;
  482. background-color: rgba($color: #0158a8, $alpha: 0)!important;;
  483. a {
  484. display: block;
  485. }
  486. &.is-active {
  487. border: none;
  488. }
  489. }
  490. }
  491. .dasai{
  492. .yingyong{
  493. font-size: 14px;
  494. color: #303133;
  495. }
  496. &:hover .yingyong{
  497. color: #f66420 !important;
  498. }
  499. }
  500. .headericon{
  501. ul{
  502. display: flex;
  503. li{
  504. flex: 1;
  505. padding: 5px 5px;
  506. font-size: 20px;
  507. cursor: pointer;
  508. &:hover{
  509. background-color: rgba($color: #fff, $alpha: 0.3) !important;
  510. }
  511. span{
  512. display: flex;
  513. }
  514. }
  515. }
  516. }
  517. .title{
  518. font-size: 24px;
  519. }
  520. .login{
  521. padding:0;
  522. margin: 0;
  523. }
  524. </style>
  525. <style>
  526. p{
  527. padding: 0;
  528. margin: 0;
  529. }
  530. </style>