Index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <el-container style="height: 100%">
  3. <el-header>
  4. <div v-if="userinfo.logo">
  5. <img :src="userinfo.logo" alt="" style="position: absolute;left: 20px;top: 20px;width: 250px;">
  6. </div>
  7. <div class="navbarBtn">
  8. <!-- 用户 -->
  9. <div class="userinfo">
  10. 欢迎您,{{ username }}
  11. </div>
  12. <!-- 标题 -->
  13. <div class="caption">
  14. <div v-if="userinfo.user_header" class="tit">{{userinfo.user_header}}</div>
  15. <div v-else class="tit">农业植保监测系统 智慧农业信息化</div>
  16. <div>
  17. Agricultural Plant Protection Monitoring System
  18. </div>
  19. </div>
  20. </div>
  21. </el-header>
  22. <div class="site" v-if="userinfo.site">
  23. <i class="iconfont icon-jidi"></i>
  24. <span>{{userinfo.site}}</span>
  25. </div>
  26. <el-container style="overflow: auto">
  27. <!-- 菜单 -->
  28. <el-aside width="200px">
  29. <el-menu
  30. :default-active="currRouter"
  31. :collapse-transition="false"
  32. class="el-menu-vertical-demo"
  33. unique-opened
  34. :router="isRouter"
  35. text-color="#333"
  36. active-text-color="#fff"
  37. >
  38. <el-menu-item
  39. :index="'/index/'+item.menu"
  40. v-for="item in menuList1"
  41. :key="item.pur_id"
  42. >
  43. <i :class="iconObj[item.pur_id]"></i>
  44. <span slot="title">{{ item.purview_name }}</span>
  45. </el-menu-item>
  46. </el-menu>
  47. </el-aside>
  48. <el-container>
  49. <el-main>
  50. <router-view></router-view>
  51. </el-main>
  52. </el-container>
  53. </el-container>
  54. </el-container>
  55. </template>
  56. <script>
  57. export default {
  58. data() {
  59. var validateNewPass = (rule, value, callback) => {
  60. if (value === '') {
  61. callback(new Error('请输入新密码'))
  62. } else {
  63. if (this.resetPassForm.checkPass !== '') {
  64. this.$refs.resetPassFormRef.validateField('checkNewPass')
  65. }
  66. callback()
  67. }
  68. }
  69. var validateCheckPass = (rule, value, callback) => {
  70. if (value === '') {
  71. callback(new Error('请再次输入密码'))
  72. } else if (value !== this.resetPassForm.newPass) {
  73. callback(new Error('两次输入密码不一致!'))
  74. } else {
  75. callback()
  76. }
  77. }
  78. return {
  79. isRouter: true,
  80. // 被激活导航地址
  81. // activePath:this.$store.state.activePath,
  82. changeHomedialogVisible: false,
  83. iconObj: {
  84. 1: 'iconfont icon-chouchongbug',
  85. 2: 'iconfont icon-weimingming-34',
  86. 3: 'iconfont icon-cebaoguanli',
  87. 4: 'iconfont icon-fangzhi',
  88. 5: 'iconfont icon-shebei',
  89. 6: 'iconfont icon-xitong'
  90. },
  91. userinfo:'',
  92. currRouter:'/index/bzy',
  93. menuList1: [{
  94. "purview_name": "智能性诱测报",
  95. "menu": "xycb",
  96. "parent_perm_id": 1,
  97. "pur_id": 1
  98. },
  99. {
  100. "purview_name": "植物孢子捕捉仪",
  101. "menu": "bzy",
  102. "parent_perm_id": 2,
  103. "pur_id": 2
  104. },
  105. {
  106. "purview_name": "物联网虫情测报",
  107. "menu": "cbd",
  108. "parent_perm_id": 3,
  109. "pur_id": 3
  110. },
  111. {
  112. "purview_name": "物联网杀虫灯",
  113. "menu": "scd",
  114. "parent_perm_id": 4,
  115. "pur_id": 4
  116. },
  117. {
  118. "purview_name": "设备管理",
  119. "menu": "equipList",
  120. "parent_perm_id": 5,
  121. "pur_id": 5
  122. },{
  123. "purview_name": "用户列表",
  124. "menu": "userManger",
  125. "parent_perm_id": 6,
  126. "pur_id": 6
  127. },], //首页菜单
  128. // activePath:'',
  129. username: '',
  130. userphoto:'',
  131. userHeadImg: '',
  132. resetPassDialogVisible: false,
  133. resetPassForm: {
  134. oldPass: '',
  135. newPass: '',
  136. checkNewPass: ''
  137. },
  138. resetPassFormRules: {
  139. oldPass: [
  140. { required: true, message: '请输入原始密码', trigger: 'blur' }
  141. ],
  142. newPass: [{ validator: validateNewPass, trigger: 'blur' }],
  143. checkNewPass: [{ validator: validateCheckPass, trigger: 'blur' }]
  144. },
  145. }
  146. },
  147. created: function () {
  148. this.getuserinfo()
  149. // this.$router.push('xycb')
  150. },
  151. computed: {
  152. },
  153. watch: {
  154. },
  155. mounted() {
  156. this.currRouter = this.$route.path
  157. },
  158. methods: {
  159. getuserinfo() {
  160. this.$axios({
  161. method: 'post',
  162. url: '/userinfo_'
  163. }).then((res) => {
  164. this.username = res.data.username
  165. this.userphoto = res.data.userphoto
  166. localStorage.setItem('username', res.data.username) // 0管理员 1用户
  167. })
  168. this.$axios({
  169. method: 'get',
  170. url: '/user_detail'
  171. }).then((res) => {
  172. this.userinfo = res.data
  173. localStorage.setItem('have_type', this.userinfo.have_type) // 0管理员 1用户 2项目
  174. localStorage.setItem('staff', this.userinfo.staff) // 1是admin
  175. })
  176. },
  177. }
  178. }
  179. </script>
  180. <style scoped lang="less">
  181. @keyframes ringing {
  182. 0% {
  183. transform: rotate(-15deg);
  184. }
  185. 2% {
  186. transform: rotate(15deg);
  187. }
  188. 12%,
  189. 4% {
  190. transform: rotate(-18deg);
  191. }
  192. 14%,
  193. 6% {
  194. transform: rotate(18deg);
  195. }
  196. 8% {
  197. transform: rotate(-22deg);
  198. }
  199. 10% {
  200. transform: rotate(22deg);
  201. }
  202. 16% {
  203. transform: rotate(-12deg);
  204. }
  205. 18% {
  206. transform: rotate(12deg);
  207. }
  208. 20% {
  209. transform: rotate(0);
  210. }
  211. }
  212. .el-header {
  213. height: 189px !important;
  214. background: url(../assets/images/headBj.png) no-repeat center;
  215. background-size: 100% 100%;
  216. .navbarBtn {
  217. color: #fff;
  218. .userinfo {
  219. font-size: 12px;
  220. text-align: right;
  221. margin-top: 10px;
  222. .userheadImg {
  223. width: 35px;
  224. height: 35px;
  225. border-radius: 50%;
  226. vertical-align: middle;
  227. margin-right: 6px;
  228. }
  229. }
  230. .caption {
  231. margin-top: 7px;
  232. text-align: center;
  233. font-size: 16px;
  234. letter-spacing: 0.5px;
  235. .tit {
  236. font-size: 26px;
  237. line-height: 46px;
  238. font-weight: 700;
  239. letter-spacing: 7px;
  240. }
  241. }
  242. }
  243. }
  244. .site{
  245. position: absolute;
  246. right: 10px;
  247. top: 199px;
  248. z-index: 888;
  249. font-size: 14px;
  250. color: #226a4d;
  251. span{
  252. color: #333;
  253. letter-spacing: 1px;
  254. font-size: 13px;
  255. }
  256. }
  257. /deep/.el-dropdown-menu__item {
  258. padding: 0 10px;
  259. }
  260. .el-popper.newsDropdown {
  261. padding: 0;
  262. margin: 0;
  263. h5 {
  264. background: #35a478;
  265. color: #fff;
  266. padding: 15px;
  267. text-transform: uppercase;
  268. font-size: 11px;
  269. margin: 0;
  270. }
  271. /deep/.popper__arrow {
  272. border-bottom-color: #35a478;
  273. &::after {
  274. border-bottom-color: #35a478;
  275. }
  276. }
  277. ul {
  278. border: 1px solid #ddd;
  279. border-top: 0;
  280. padding: 0 10px;
  281. .news {
  282. display: block;
  283. margin: 0;
  284. float: none;
  285. background: none;
  286. padding: 5px 5px;
  287. border-bottom: 1px solid #eee;
  288. .txtContent {
  289. max-width: 250px;
  290. white-space: nowrap;
  291. overflow: hidden;
  292. text-overflow: ellipsis;
  293. display: inline-block;
  294. min-width: 250px;
  295. // display: flex;
  296. a {
  297. color: #333;
  298. font-size: 12px;
  299. padding: 7px 10px;
  300. -moz-border-radius: 2px;
  301. -webkit-border-radius: 2px;
  302. border-radius: 2px;
  303. -moz-transition: all 0.2s ease-out 0s;
  304. -webkit-transition: all 0.2s ease-out 0s;
  305. transition: all 0.2s ease-out 0s;
  306. }
  307. a:hover {
  308. background: none;
  309. color: #428bca;
  310. text-decoration: none;
  311. }
  312. }
  313. }
  314. }
  315. }
  316. .sysAside {
  317. position: absolute;
  318. z-index: 999;
  319. left: 0;
  320. top: 60px;
  321. bottom: 0;
  322. z-index: 999;
  323. transition: all 0.5s;
  324. }
  325. .el-aside {
  326. // background-color: #3D4C5A;
  327. color: #333;
  328. // line-height: 200px;
  329. // .el-menu-item.is-active{background:#17BB89!important}
  330. // .el-submenu__title i{color:#fff}
  331. .el-menu {
  332. border: none;
  333. }
  334. .iconfont {font-size:18px;margin-right:10px;}
  335. .icon-chouchongbug{font-size:22px;}
  336. }
  337. .changeHomeItem {
  338. text-align: center;
  339. img {
  340. width: 100%;
  341. height: 110px;
  342. }
  343. .tit {
  344. margin-top: 10px;
  345. }
  346. }
  347. </style>