Home.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <el-row class="height100">
  3. <el-col :span="24" class="">
  4. <div class="conterLayout">
  5. <div class="main_header">
  6. <MenuComponent></MenuComponent>
  7. <!--<div class="main_header_user">-->
  8. <!--<el-dropdown @command="handleCommand">-->
  9. <!--<div class="el-dropdown-link" style="position: relative;cursor: pointer;">-->
  10. <!--<span style="margin-right:30px; font-size: .14rem;"> {{getUser.name}} </span>-->
  11. <!--&lt;!&ndash;<i class="el-icon-caret-right"></i>&ndash;&gt;-->
  12. <!--<span class="out">退出</span>-->
  13. <!--</div>-->
  14. <!--<el-dropdown-menu slot="dropdown">-->
  15. <!--<el-dropdown-item command="modifyPwd">修改密码</el-dropdown-item>-->
  16. <!--<el-dropdown-item command="logDown" divided>退出登录</el-dropdown-item>-->
  17. <!--</el-dropdown-menu>-->
  18. <!--</el-dropdown>-->
  19. <!--</div>-->
  20. </div>
  21. <div class="main_conter">
  22. <router-view></router-view>
  23. </div>
  24. </div>
  25. </el-col>
  26. </el-row>
  27. </template>
  28. <script type="es6">
  29. import NavMenuComponent from "@/components/NavMenuComponent";
  30. import MenuComponent from "@/components/MenuComponent";
  31. import UserInfoView from "@/components/UserInfoView";
  32. import { mapGetters, mapActions } from "vuex";
  33. export default {
  34. components: { NavMenuComponent, UserInfoView, MenuComponent },
  35. name: "home",
  36. data() {
  37. return {
  38. userImgPath: "",
  39. filters: {
  40. activitySerachListen: 0,
  41. timeFrame: []
  42. },
  43. filterstwo: {
  44. activityMonitoringListen: 0,
  45. timeType: "0",
  46. timeFrame: []
  47. },
  48. name: "在线人员管理CRM",
  49. userName: "超级管理员",
  50. // 菜单相关
  51. router: true,
  52. navHeight: 0,
  53. navsData: [],
  54. breadcrumb: "",
  55. // 修改密码
  56. modifyPwdFormRules: {
  57. oldPassword: [
  58. { required: true, message: "密码不能为空", trigger: "blur" },
  59. { min: 5, message: "密码长度不能小于6", trigger: "blur" },
  60. { max: 18, message: "密码长度不能大于18", trigger: "blur" }
  61. ],
  62. newPassword: [
  63. { required: true, message: "新密码不能为空", trigger: "blur" },
  64. { min: 5, message: "新密码长度不能小于6", trigger: "blur" },
  65. { max: 18, message: "新密码长度不能大于18", trigger: "blur" }
  66. ],
  67. newPassword2: {
  68. validator: (rule, value, callback) => {
  69. if (value === "") {
  70. callback(new Error("请再次输入密码"));
  71. } else if (value !== this.modifyPwdForm.newPassword) {
  72. callback(new Error("两次输入密码不一致!"));
  73. } else {
  74. callback();
  75. }
  76. },
  77. trigger: "blur"
  78. }
  79. },
  80. modifyPwdForm: { oldPassword: "", newPassword: "" },
  81. userModifyPwdVisible: false,
  82. modifyPwdFormLoading: false,
  83. };
  84. },
  85. watch: {
  86. },
  87. computed: {
  88. ...mapGetters(["getUser", "getAtivityTimeFrameData"])
  89. },
  90. // async beforeCreate() {
  91. // let {
  92. // success,
  93. // permissionsMap
  94. // } = await this.$dao.sysDao.findPagePermissions();
  95. // if (success) this.setPagePermissions(permissionsMap);
  96. // // 判断用户是否登录
  97. // if (sessionStorage.user === undefined) {
  98. // this.$router.push("/");
  99. // return this.$message("请先登录!");
  100. // }
  101. // let menuList = this.$dao.sysDao.getMenuList();
  102. // if (menuList.length < 1) {
  103. // this.$router.push("/");
  104. // }
  105. // this.navsData = menuList;
  106. // this.twoMenu = this.$util.twoMenu(menuList);
  107. // },
  108. methods: {
  109. ...mapActions([
  110. ]),
  111. ...mapGetters([""]),
  112. // 修改密码框显示
  113. userModifyPwdShow() {
  114. const self = this;
  115. self.userAddFormLoading = false;
  116. self.userModifyPwdVisible = true;
  117. self.modifyPwdForm = { oldPassword: "", newPassword: "" };
  118. },
  119. // 修改密码提交
  120. userModifyPwdSubmit() {
  121. const self = this;
  122. self.$refs.modifyPwdForm.validate(async valid => {
  123. if (!valid) return false;
  124. self.userAddFormLoading = true;
  125. let data = {
  126. oldPassword: self.modifyPwdForm.oldPassword,
  127. newPassword: self.modifyPwdForm.newPassword
  128. };
  129. let { success } = await self.$dao.sysDao.userModifyPwd(data);
  130. if (success) {
  131. self.userModifyPwdVisible = false;
  132. self.$util.messageMethod("success", "修改密码成功!");
  133. }
  134. self.userAddFormLoading = false;
  135. });
  136. },
  137. // 账号管理、退出登录
  138. handleCommand(command) {
  139. const self = this;
  140. if (command === `logDown`) {
  141. this.$confirm("您确定退出吗?", "提示", {
  142. confirmButtonText: "确定",
  143. cancelButtonText: "取消",
  144. type: "warning"
  145. })
  146. .then(() => {
  147. this.$dao.logout();
  148. this.$router.replace("/");
  149. this.$util.messageMethod("success", "退出成功!");
  150. // location.reload()
  151. })
  152. .catch(() => {
  153. // console.log(err)
  154. self.$message("已取消操作!");
  155. });
  156. } else if (command === `modifyPwd`) {
  157. // self.$router.replace('/accountManagement')
  158. self.userModifyPwdShow();
  159. } else if (command === `accountManagement`) {
  160. self.$router.replace("/accountManagement");
  161. }
  162. },
  163. // 路由切换
  164. // routerDataPath() {
  165. // const path = this.$route.path;
  166. // if (this.dashboard.indexOf(path) !== -1) this.activeName = path;
  167. // if (path !== "/accountManagement") {
  168. // return path;
  169. // } else {
  170. // return "";
  171. // }
  172. // }
  173. },
  174. mounted() {
  175. // this.userImgPath = this.getUser.imagePath;
  176. this.breadcrumb = this.$route.name;
  177. // this.$nextTick(() => {
  178. // this.navHeight =
  179. // document.body.clientHeight - this.$refs.logoUser.offsetHeight;
  180. // });
  181. }
  182. };
  183. </script>
  184. <style scoped>
  185. .el-input__inner, .el-checkbox__inner, .el-textarea__inner, .el-button {
  186. font-size: 0.3125rem;
  187. text-align: center;
  188. line-height: 0!important;
  189. padding: 12px 20px!important;
  190. }
  191. .main_conter{
  192. min-height: 1000px;
  193. }
  194. .out{
  195. margin-left:10px;
  196. color:#333333;
  197. }
  198. .navlink{
  199. float:left;
  200. margin-right:24px;
  201. color:#999999 ;
  202. font-size: 9px;
  203. }
  204. .menu {
  205. /* overflow-y: auto; */
  206. position: relative;
  207. z-index: 1;
  208. background-color: #00253f;
  209. box-shadow: 3px 0px 7px #cfcfcf;
  210. }
  211. .logoUser {
  212. position: relative;
  213. width: 100%;
  214. color: #fff;
  215. border-bottom: 1px solid #001625;
  216. }
  217. .logoImg {
  218. padding: 0.2rem;
  219. }
  220. .logoImg > img {
  221. display: inline-block;
  222. width: 1.8rem;
  223. height: 0.38rem;
  224. }
  225. .logoImg > h2 {
  226. font-size: 0.14rem;
  227. color: #82b5d7;
  228. }
  229. .userImg {
  230. display: inline-block;
  231. height: 0.9rem;
  232. width: 0.9rem;
  233. border: 2px solid #00c1de;
  234. }
  235. .userImg,
  236. .userImg > img {
  237. border-radius: 50%;
  238. }
  239. .userTitle > p {
  240. margin: 0.1rem 0;
  241. font-size: 0.16rem;
  242. color: #6e828a;
  243. }
  244. .userAdmin {
  245. display: inline-block;
  246. margin-bottom: 0.35rem;
  247. padding: 0 0.14rem;
  248. height: 0.25rem;
  249. background-color: #37bf5b;
  250. border-radius: 0.1rem;
  251. }
  252. .userAdmin > span {
  253. font-size: 0.12rem;
  254. color: #def0e3;
  255. line-height: 0.2rem;
  256. }
  257. .conterLayout {
  258. background-color: #eef1f6;
  259. width: 100%;
  260. height: 100%;
  261. }
  262. .main_header {
  263. display: flex;
  264. position: relative;
  265. height: 110px;
  266. line-height: 110px;
  267. background-color: #fff;
  268. box-shadow: 0px 0px 20px #eaeaea;
  269. }
  270. .el-breadcrumb {
  271. line-height: 50px;
  272. }
  273. .el-breadcrumb .el-breadcrumb__item {
  274. padding-top: 13px;
  275. line-height: 26px;
  276. font-size: 18px;
  277. }
  278. .main_header_user {
  279. position: absolute;
  280. right: 30px;
  281. }
  282. .main_header_user .el-dropdown {
  283. color: #333333;
  284. }
  285. .main_header_user .el-icon-caret-right {
  286. transform: rotate(43deg);
  287. position: absolute;
  288. right: 30px;
  289. bottom: 16px;
  290. }
  291. .ativityTimeFrame .el-radio {
  292. margin-left: 15px;
  293. }
  294. </style>