manageMain.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <template>
  2. <el-container>
  3. <el-header class="shadow-menu">
  4. <el-row class="admin-header-content">
  5. <el-col :span="12">
  6. <div class="admin-logo-content">
  7. <!-- <img src="../../assets/manage/manage_logo.png" alt="" />-->
  8. 锦泓税务报告
  9. </div>
  10. </el-col>
  11. <!--<el-col :offset="15" :span="1">-->
  12. <!--<div class="admin-head-content" key="large">-->
  13. <!--<el-avatar :size="size" :src="circleUrl"></el-avatar>-->
  14. <!--</div>-->
  15. <!--</el-col>-->
  16. <el-col :span="12" class="just-right">
  17. <el-menu
  18. :default-active="activeIndex"
  19. class="el-menu-demo"
  20. mode="horizontal"
  21. background-color="#57ACBB"
  22. text-color="#fff"
  23. active-text-color="#fff"
  24. >
  25. <el-submenu index="2" class="rightExit">
  26. <template slot="title" :size="size" :src="circleUrl">{{
  27. userInfo.name
  28. }}</template>
  29. <el-menu-item v-if="userType == 2" index="2-1" @click="downCode(userInfo.name+'-'+userInfo.userNumber)">下载专属邀请码</el-menu-item>
  30. <el-menu-item index="2-1" @click="escape()">退出</el-menu-item>
  31. <el-menu-item index="2-1" @click="changePwd()"
  32. >修改密码</el-menu-item
  33. >
  34. </el-submenu>
  35. </el-menu>
  36. <!-- <vue-qr v-show='false' :ref="'Qrcode'+userInfo.id" :text='urlJump+userInfo.invitationCode' :size="500" :width='1' ></vue-qr>-->
  37. <vue-qr v-show='false' :ref="userInfo.name+'-'+userInfo.userNumber" :text='urlJump+userInfo.invitationCode' :size="500" :width='1' ></vue-qr>
  38. </el-col>
  39. </el-row>
  40. </el-header>
  41. <el-container>
  42. <el-aside style="width: auto">
  43. <el-menu
  44. ref='menu'
  45. class="el-menu-vertical-demo shadow-menu aside-menu"
  46. :router="true"
  47. :default-active="active"
  48. :collapse="isCollapse"
  49. text-color="#333"
  50. active-text-color="#fff"
  51. @select="selectMenu"
  52. >
  53. <el-menu-item
  54. v-for="item in menuList"
  55. :key="item.id"
  56. :index="item.path"
  57. v-show="item.showItem"
  58. >
  59. <i :class="item.icon"></i>
  60. <span slot="title">{{ item.name }}</span>
  61. </el-menu-item>
  62. </el-menu>
  63. </el-aside>
  64. <el-container>
  65. <el-header class="main-header">
  66. <el-row>
  67. <el-col :span="1">
  68. <div class="menu-hide" @click="changeMenu">
  69. <i class="el-icon-s-fold" style="color: #000"></i>
  70. </div>
  71. </el-col>
  72. <el-col :span="10">
  73. <el-breadcrumb class="admin-breadcrumb" separator="/">
  74. <el-breadcrumb-item>{{ crumbParent }}</el-breadcrumb-item>
  75. <el-breadcrumb-item v-if="crumbChild && crumbChild != null">{{
  76. crumbChild
  77. }}</el-breadcrumb-item>
  78. </el-breadcrumb>
  79. </el-col>
  80. </el-row>
  81. </el-header>
  82. <el-main class="el-mains" style="background-color: #f5f5f5">
  83. <transition name="fade" mode="out-in">
  84. <router-view></router-view>
  85. </transition>
  86. </el-main>
  87. </el-container>
  88. </el-container>
  89. <!-- <Footer
  90. /> -->
  91. <el-footer style="padding-left: 0px; padding-right: 0px"
  92. ><Footer
  93. /></el-footer>
  94. <!---lxh-修改密码-->
  95. <el-dialog
  96. title="修改密码"
  97. :visible.sync="dialogVisible"
  98. :close-on-click-modal="false"
  99. width="40%"
  100. >
  101. <div>
  102. <el-form
  103. :model="ruleForm"
  104. :rules="rules"
  105. ref="ruleForm"
  106. label-width="150px"
  107. class="demo-ruleForm"
  108. >
  109. <el-form-item label="请输入旧密码" prop="oldpass">
  110. <el-input
  111. type="password"
  112. v-model="ruleForm.oldpass"
  113. autocomplete="off"
  114. ></el-input>
  115. </el-form-item>
  116. <el-form-item label="请输入新密码" prop="pass">
  117. <el-input
  118. type="password"
  119. v-model="ruleForm.pass"
  120. autocomplete="off"
  121. ></el-input>
  122. </el-form-item>
  123. <el-form-item label="确认新密码" prop="checkPass">
  124. <el-input
  125. type="password"
  126. v-model="ruleForm.checkPass"
  127. autocomplete="off"
  128. ></el-input>
  129. </el-form-item>
  130. <el-form-item>
  131. <el-button type="primary" @click="submitForm('ruleForm')"
  132. >提交</el-button
  133. >
  134. <el-button @click="resetForm('ruleForm')">重置</el-button>
  135. </el-form-item>
  136. </el-form>
  137. </div>
  138. </el-dialog>
  139. </el-container>
  140. </template>
  141. <script>
  142. import md5 from "md5";
  143. import vueQr from 'vue-qr'
  144. import { mapGetters, mapActions } from "vuex";
  145. import { oSessionStorage } from "@/utils/utils";
  146. import register from "@/components/Register";
  147. import Footer from "@/components/Footer";
  148. export default {
  149. name: "manageMain",
  150. components: {
  151. vueQr,
  152. Footer
  153. },
  154. computed: {
  155. // ...mapGetters(['sacleListName']),
  156. // ...mapGetters(['menuActive']),
  157. },
  158. data() {
  159. var validatePassOld = (rule, value, callback) => {
  160. // if (value === "") {
  161. // callback(new Error("请输入密码"));
  162. // } else {
  163. // let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
  164. // if (!juPassword.test(this.ruleForm.oldpass)) {
  165. // callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
  166. // } else {
  167. // callback();
  168. // }
  169. // }
  170. if (value === "") {
  171. callback(new Error("请输入旧密码"));
  172. } else {
  173. if (value.length < 6 || value.length > 18) {
  174. callback(new Error("密码长度需在6~18位之间"));
  175. } else {
  176. this.$refs.ruleForm.validateField("pass");
  177. }
  178. callback();
  179. }
  180. };
  181. var validatePass = (rule, value, callback) => {
  182. // if (value === "") {
  183. // callback(new Error("请输入密码"));
  184. // } else {
  185. // let juPassword = /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{8,16}$/;
  186. // if (!juPassword.test(this.ruleForm.pass)) {
  187. // callback(new Error("格式为数字+英文字母+特殊字符(~!@#$%^&*)8-16位"));
  188. // } else {
  189. // callback();
  190. // }
  191. // }
  192. if (value === "") {
  193. callback(new Error("请输入新密码"));
  194. } else {
  195. if (value.length < 6 || value.length > 18) {
  196. callback(new Error("密码长度需在6~18位之间"));
  197. } else {
  198. this.$refs.ruleForm.validateField("checkPass");
  199. }
  200. callback();
  201. }
  202. };
  203. var validatePass2 = (rule, value, callback) => {
  204. if (value === "") {
  205. callback(new Error("请再次输入密码"));
  206. } else if (value !== this.ruleForm.pass) {
  207. callback(new Error("两次输入密码不一致!"));
  208. } else if (value == this.ruleForm.oldpass) {
  209. callback(new Error("旧密码和新密码相同!"));
  210. } else {
  211. callback();
  212. }
  213. };
  214. return {
  215. userInfo: {}, //用户信息
  216. dialogVisible: false, //弹出窗是否可见
  217. size: "small",
  218. circleUrl:
  219. "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
  220. activeIndex: "10",
  221. activeIndex2: "1",
  222. isCollapse: false,
  223. userType: "",
  224. menuList: [
  225. {
  226. id: 0,
  227. name: "首页",
  228. icon: "el-icon-s-home",
  229. path: "/manage/adminHome",
  230. showItem: true,
  231. },
  232. {
  233. id: 1,
  234. name: "代理管理",
  235. icon: "el-icon-user-solid",
  236. path: "/manage/agencyUserManage",
  237. showItem: true,
  238. },
  239. {
  240. id: 2,
  241. name: "医生管理",
  242. icon: "el-icon-user-solid",
  243. path: "/manage/doctorUserManage",
  244. showItem: true,
  245. },
  246. // {
  247. // id: 2,
  248. // name: "医生用户管理",
  249. // icon: "el-icon-user-solid",
  250. // path: "2",
  251. // showItem: true,
  252. // },
  253. {
  254. id: 3,
  255. name: "用户管理",
  256. icon: "el-icon-user-solid",
  257. path: "/manage/userManage",
  258. showItem: true,
  259. },
  260. // {
  261. // id: 4,
  262. // name: "用户记录",
  263. // icon: "el-icon-s-order",
  264. // path: "/manage/userRecord",
  265. // showItem: true,
  266. // },
  267. {
  268. id: 5,
  269. name: "游戏记录",
  270. icon: "el-icon-s-order",
  271. path: "/manage/gameRecord",
  272. showItem: true,
  273. },
  274. ],
  275. //面包屑页签
  276. crumbParent: "首页",
  277. crumbChild: null,
  278. //修改密码
  279. ruleForm: {
  280. pass: "",
  281. checkPass: "",
  282. oldpass: "",
  283. },
  284. upPass: {
  285. institutionNo: "",
  286. password: "",
  287. },
  288. rules: {
  289. pass: [{ required: true, validator: validatePass, trigger: "blur" }],
  290. checkPass: [
  291. { required: true, validator: validatePass2, trigger: "blur" },
  292. ],
  293. oldpass: [
  294. { required: true, validator: validatePassOld, trigger: "blur" },
  295. ],
  296. },
  297. ifAdmin: false,
  298. ifSupAdmin: false,
  299. active: "/manage/adminHome",
  300. urlJump:'http://152.136.24.101:8997?invitationCode=', //二维码跳转链接
  301. };
  302. },
  303. created() {
  304. if (oSessionStorage.getItem("userInfo")) {
  305. this.userInfo = JSON.parse(oSessionStorage.getItem("userInfo"));
  306. this.userType = this.userInfo.roleType;
  307. console.log(this.userInfo, "有用户信息吗");
  308. //假如是代理用户则 //代理用户菜单不显示
  309. if (this.userType == "3") {
  310. for (let i = 0; i < this.menuList.length; i++) {
  311. if (this.menuList[i].id == "1") {
  312. this.menuList[i].showItem = false;
  313. }
  314. }
  315. } else if (this.userType == "2") {
  316. for (let i = 0; i < this.menuList.length; i++) {
  317. if (this.menuList[i].id == "2") {
  318. this.menuList[i].showItem = false;
  319. }
  320. if (this.menuList[i].id == "1") {
  321. this.menuList[i].showItem = false;
  322. }
  323. }
  324. }
  325. }
  326. },
  327. mounted() {
  328. let codeImage = sessionStorage.getItem('codeImage');
  329. this.urlJump=codeImage+'?invitationCode='
  330. let that =this;
  331. // 页面初始化或者刷新页面初始化页签及激活菜单-2020-03-17 lwl
  332. this.active = this.$route.path;
  333. // debugger;
  334. this.selectMenu(this.$route.path);
  335. this.bus.$on("menuStatusUpdate", (e) => {
  336. console.log(that.$refs.menu.activeIndex)
  337. that.$refs.menu.activeIndex=e
  338. that.active = e;
  339. // that.$forceUpdate()
  340. that.selectMenu(e);
  341. });
  342. //得到用户信息,根据角色信息判断哪个显示哪个不显示
  343. },
  344. methods: {
  345. ...mapActions({
  346. // setSacleListName:"setSacleListName",
  347. // setMenuActive:"setMenuActive"
  348. }),
  349. changeMenu: function () {
  350. this.isCollapse = !this.isCollapse;
  351. },
  352. //匹配获取页签名称-2020-03-17 lwl
  353. selectMenu(param) {
  354. console.log(param, "888");
  355. this.menuList.forEach((item) => {
  356. if (item.path == param) {
  357. this.crumbParent = item.name;
  358. this.crumbChild = null;
  359. return;
  360. }
  361. });
  362. },
  363. //下载专属二维码
  364. downCode(linkId) {
  365. const iconUrl =this.$refs[linkId].$el.src;
  366. const a = document.createElement('a');
  367. const event =new MouseEvent('click');
  368. a.download=linkId;
  369. a.href=iconUrl;
  370. a.dispatchEvent(event)
  371. },
  372. // 退出
  373. escape() {
  374. // localStorage.clear();
  375. // sessionStorage.clear();
  376. //
  377. // this.$router.push({
  378. // path: "/",
  379. // });
  380. oSessionStorage.removeItem("userInfo");
  381. oSessionStorage.removeItem("token");
  382. this.$router.push({ path: "/" });
  383. },
  384. /*lxh-修改密码*/
  385. submitForm(formName) {
  386. console.log(this.userInfo)
  387. this.$refs[formName].validate((valid) => {
  388. if (valid) {
  389. this.$http.post(
  390. "/v1/system/updatePassword",
  391. {
  392. id: this.userInfo.id,
  393. password: md5(this.ruleForm.pass),
  394. oldPassword: md5(this.ruleForm.oldpass),
  395. },
  396. (res) => {
  397. (this.ruleForm.oldpass = ""),
  398. (this.ruleForm.pass = ""),
  399. (this.ruleForm.checkPass = ""),
  400. (this.dialogVisible = false);
  401. this.$message({
  402. message: "密码修改完成!",
  403. type: "success",
  404. });
  405. sessionStorage.clear();
  406. this.$router.push({
  407. path: "/",
  408. });
  409. }
  410. );
  411. } else {
  412. console.log("error submit!!");
  413. return false;
  414. }
  415. });
  416. },
  417. // 重置表单
  418. resetForm(formName) {
  419. this.$refs[formName].resetFields();
  420. console.log(this.userType);
  421. },
  422. // 修改密码
  423. changePwd() {
  424. this.dialogVisible = true;
  425. },
  426. },
  427. };
  428. </script>
  429. <style lang="less" scoped>
  430. .el-menu-vertical-demo:not(.el-menu--collapse) {
  431. width: 200px;
  432. min-height: 400px;
  433. }
  434. .shadow-menu {
  435. box-shadow: 0 4px 12px 2px rgba(0, 0, 0, 0.1);
  436. }
  437. #app {
  438. margin-top: 0px;
  439. }
  440. .el-header {
  441. padding: 0 0px !important;
  442. box-sizing: border-box;
  443. flex-shrink: 0;
  444. }
  445. .menu-top-left {
  446. background-color: black;
  447. height: 3.75rem;
  448. display: flex;
  449. align-items: center;
  450. font-size: 16px;
  451. line-height: 2;
  452. }
  453. .menu-top-left i img {
  454. width: 30px;
  455. height: 30px;
  456. }
  457. .menu-top-left-title {
  458. color: #ffffff;
  459. font-size: 1rem;
  460. }
  461. /*.el-menu--horizontal > .el-submenu {*/
  462. /*float: right;*/
  463. /*}*/
  464. /*.el-menu--horizontal > .el-menu-item {*/
  465. /*float: right;*/
  466. /*height: 60px;*/
  467. /*line-height: 60px;*/
  468. /*margin: 0;*/
  469. /*border-bottom: 2px solid transparent;*/
  470. /*color: #909399;*/
  471. /*}*/
  472. .top-menu-control {
  473. float: left;
  474. }
  475. .aside-menu {
  476. /*height: 98vh;*/
  477. height: 92vh;
  478. text-align: left;
  479. /*padding-top: 60px;*/
  480. }
  481. .aside-menu .el-menu-item.is-active {
  482. background: #57acbb !important;
  483. }
  484. .el-menu-item-group .el-menu-item.is-active {
  485. background: #57acbb !important;
  486. }
  487. .fade-enter {
  488. opacity: 0;
  489. }
  490. .fade-leave {
  491. opacity: 1;
  492. }
  493. .fade-leave-active,
  494. .fade-enter-active {
  495. transition: opacity 0s;
  496. }
  497. /*.rightExit {*/
  498. /*float: right !important;*/
  499. /*}*/
  500. .main-header {
  501. height: 40px !important;
  502. padding: 20px 0 0 20px !important;
  503. .menu-hide {
  504. height: 20px !important;
  505. text-align: left;
  506. line-height: 20px !important;
  507. }
  508. }
  509. .admin-header-content {
  510. background: #57acbb;
  511. height: 100% !important;
  512. display: flex;
  513. flex-direction: row;
  514. justify-content: space-between;
  515. align-items: center;
  516. }
  517. .admin-header-content .el-col {
  518. height: 100% !important;
  519. }
  520. .admin-header-content .admin-logo-content {
  521. /*box-sizing: border-box;*/
  522. /*width: 100%;*/
  523. /*height: 100%;*/
  524. width: 165px;
  525. height: 45px;
  526. padding: 8px 0 8px 20px;
  527. font-size: 18px;
  528. color: #fff;
  529. text-align: left;
  530. line-height: 45px;
  531. }
  532. .admin-header-content .admin-logo-content img {
  533. width: 100%;
  534. height: 100%;
  535. }
  536. .admin-header-content .admin-head-content {
  537. width: 100%;
  538. height: 100%;
  539. display: flex;
  540. flex-direction: column;
  541. justify-content: space-between;
  542. align-items: center;
  543. flex: 1;
  544. }
  545. .admin-header-content .el-menu-demo {
  546. height: 100%;
  547. }
  548. .el-menu--horizontal > .el-submenu .el-submenu__title,
  549. /deep/.el-menu--horizontal > .el-submenu.is-active .el-submenu__title {
  550. border-bottom: none !important;
  551. }
  552. /deep/.el-menu--horizontal > .el-submenu .el-submenu__icon-arrow {
  553. color: #fff;
  554. }
  555. .el-menu.el-menu--horizontal {
  556. border-bottom: none;
  557. }
  558. .admin-breadcrumb {
  559. padding-top: 3px;
  560. margin-left: -18px;
  561. }
  562. .just-right {
  563. display: flex;
  564. flex-direction: row;
  565. justify-content: flex-end;
  566. }
  567. </style>