用户信息
Showing
2 changed files
with
105 additions
and
57 deletions
| ... | @@ -17,49 +17,54 @@ | ... | @@ -17,49 +17,54 @@ |
| 17 | }}</span> | 17 | }}</span> |
| 18 | <span style="padding-right: 10px">{{ userInfo.name }}</span> | 18 | <span style="padding-right: 10px">{{ userInfo.name }}</span> |
| 19 | </p> | 19 | </p> |
| 20 | <el-dropdown> | ||
| 21 | <span class="el-dropdown-link"> | ||
| 20 | <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" /> | 22 | <img :src="avatar + '?imageView2/1/w/80/h/80'" class="user-avatar" /> |
| 23 | </span> | ||
| 24 | <el-dropdown-menu slot="dropdown"> | ||
| 25 | <el-dropdown-item command="user" @click.native="handleGetUser">用户信息</el-dropdown-item> | ||
| 26 | </el-dropdown-menu> | ||
| 27 | </el-dropdown> | ||
| 21 | </div> | 28 | </div> |
| 22 | <svg-icon | 29 | <svg-icon |
| 23 | class="shutdown" | 30 | class="shutdown" |
| 24 | @click.native="logout" | 31 | @click.native="logout" |
| 25 | icon-class="shutdown" | 32 | icon-class="shutdown" /> |
| 26 | /> | ||
| 27 | </div> | 33 | </div> |
| 28 | </div> | 34 | </div> |
| 29 | <NoticeBar | 35 | <NoticeBar |
| 30 | class="NoticeBar" | 36 | class="NoticeBar" |
| 31 | :noticeList="noticeList" | 37 | :noticeList="noticeList" |
| 32 | v-if="noticeList.length > 0" | 38 | v-if="noticeList.length > 0" /> |
| 33 | /> | ||
| 34 | </div> | 39 | </div> |
| 35 | </template> | 40 | </template> |
| 36 | <script> | 41 | <script> |
| 37 | import axios from "axios"; | 42 | import axios from "axios"; |
| 38 | import Cookies from "js-cookie"; | 43 | import Cookies from "js-cookie"; |
| 39 | import { mapGetters } from "vuex"; | 44 | import { mapGetters } from "vuex"; |
| 40 | import NoticeBar from "@/components/NoticeBar/index"; | 45 | import NoticeBar from "@/components/NoticeBar/index"; |
| 41 | import { getHomeNoticeList } from "@/api/home"; | 46 | import { getHomeNoticeList } from "@/api/home"; |
| 42 | import { setToken } from "@/utils/util"; | 47 | import { setToken } from "@/utils/util"; |
| 43 | export default { | 48 | export default { |
| 44 | components: { | 49 | components: { |
| 45 | NoticeBar, | 50 | NoticeBar, |
| 46 | }, | 51 | }, |
| 47 | computed: { | 52 | computed: { |
| 48 | ...mapGetters(["sidebar", "avatar", "name", "userInfo"]), | 53 | ...mapGetters(["sidebar", "avatar", "name", "userInfo"]), |
| 49 | baseUrl() { | 54 | baseUrl () { |
| 50 | return window._config.baseUrl; | 55 | return window._config.baseUrl; |
| 51 | }, | 56 | }, |
| 52 | }, | 57 | }, |
| 53 | data() { | 58 | data () { |
| 54 | return { | 59 | return { |
| 55 | logo: require("../../image/bdclogo.png"), | 60 | logo: require("../../image/bdclogo.png"), |
| 56 | noticeList: [], | 61 | noticeList: [], |
| 57 | }; | 62 | }; |
| 58 | }, | 63 | }, |
| 59 | created() { | 64 | created () { |
| 60 | this.queryNoticeList(); | 65 | this.queryNoticeList(); |
| 61 | }, | 66 | }, |
| 62 | mounted() { | 67 | mounted () { |
| 63 | let that = this; | 68 | let that = this; |
| 64 | window.addEventListener("message", function (messageEvent) { | 69 | window.addEventListener("message", function (messageEvent) { |
| 65 | if (messageEvent.data.update) { | 70 | if (messageEvent.data.update) { |
| ... | @@ -67,15 +72,23 @@ export default { | ... | @@ -67,15 +72,23 @@ export default { |
| 67 | } | 72 | } |
| 68 | }); | 73 | }); |
| 69 | }, | 74 | }, |
| 70 | destroyed() { | 75 | destroyed () { |
| 71 | window.removeEventListener("message"); | 76 | window.removeEventListener("message"); |
| 72 | }, | 77 | }, |
| 73 | methods: { | 78 | methods: { |
| 79 | |||
| 80 | /** | ||
| 81 | * @description: 获取用户信息 | ||
| 82 | * @author: renchao | ||
| 83 | */ | ||
| 84 | handleGetUser () { | ||
| 85 | this.$popupDialog('用户信息', 'system/userInfo/index', {}, '80%', true); | ||
| 86 | }, | ||
| 74 | /** | 87 | /** |
| 75 | * @description: queryNoticeList | 88 | * @description: queryNoticeList |
| 76 | * @author: renchao | 89 | * @author: renchao |
| 77 | */ | 90 | */ |
| 78 | queryNoticeList() { | 91 | queryNoticeList () { |
| 79 | getHomeNoticeList().then((res) => { | 92 | getHomeNoticeList().then((res) => { |
| 80 | if (res.result) { | 93 | if (res.result) { |
| 81 | this.noticeList = res.result.noticeList; | 94 | this.noticeList = res.result.noticeList; |
| ... | @@ -86,7 +99,7 @@ export default { | ... | @@ -86,7 +99,7 @@ export default { |
| 86 | * @description: logout | 99 | * @description: logout |
| 87 | * @author: renchao | 100 | * @author: renchao |
| 88 | */ | 101 | */ |
| 89 | logout() { | 102 | logout () { |
| 90 | axios | 103 | axios |
| 91 | .post(window._config.services.management + "/management/logout") | 104 | .post(window._config.services.management + "/management/logout") |
| 92 | .then(() => { | 105 | .then(() => { |
| ... | @@ -105,10 +118,10 @@ export default { | ... | @@ -105,10 +118,10 @@ export default { |
| 105 | * @param {*} val | 118 | * @param {*} val |
| 106 | * @author: renchao | 119 | * @author: renchao |
| 107 | */ | 120 | */ |
| 108 | themeChange(val) { | 121 | themeChange (val) { |
| 109 | this.$store.dispatch("app/updateTheme", val); | 122 | this.$store.dispatch("app/updateTheme", val); |
| 110 | }, | 123 | }, |
| 111 | searchMessageCenter() { | 124 | searchMessageCenter () { |
| 112 | this.$router.push({ name: "messagecenter" }); | 125 | this.$router.push({ name: "messagecenter" }); |
| 113 | }, | 126 | }, |
| 114 | /** | 127 | /** |
| ... | @@ -116,26 +129,28 @@ export default { | ... | @@ -116,26 +129,28 @@ export default { |
| 116 | * @param {*} command | 129 | * @param {*} command |
| 117 | * @author: renchao | 130 | * @author: renchao |
| 118 | */ | 131 | */ |
| 119 | handleCommand(command) { | 132 | handleCommand (command) { |
| 120 | if (command == "a") { | 133 | if (command == "a") { |
| 121 | //个人中心 | 134 | //个人中心 |
| 122 | this.$router.push({ name: "personal" }); | 135 | this.$router.push({ name: "personal" }); |
| 123 | } | 136 | } |
| 124 | }, | 137 | }, |
| 125 | }, | 138 | }, |
| 126 | }; | 139 | }; |
| 127 | </script> | 140 | </script> |
| 128 | <style lang="scss" scoped> | 141 | <style lang="scss" scoped> |
| 129 | .navbar-con { | 142 | .navbar-con { |
| 130 | position: relative; | 143 | position: relative; |
| 131 | } | 144 | } |
| 132 | 145 | /deep/.el-dropdown { | |
| 133 | .NoticeBar { | 146 | height: 32px; |
| 147 | } | ||
| 148 | .NoticeBar { | ||
| 134 | position: absolute; | 149 | position: absolute; |
| 135 | bottom: 0; | 150 | bottom: 0; |
| 136 | } | 151 | } |
| 137 | 152 | ||
| 138 | .el-dropdown-menu { | 153 | .el-dropdown-menu { |
| 139 | padding: 0 !important; | 154 | padding: 0 !important; |
| 140 | border: 1px solid #ebeef5; | 155 | border: 1px solid #ebeef5; |
| 141 | box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.12); | 156 | box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.12); |
| ... | @@ -168,9 +183,9 @@ export default { | ... | @@ -168,9 +183,9 @@ export default { |
| 168 | background: #f6f7f9; | 183 | background: #f6f7f9; |
| 169 | color: #4a4a4a; | 184 | color: #4a4a4a; |
| 170 | } | 185 | } |
| 171 | } | 186 | } |
| 172 | 187 | ||
| 173 | .navbar { | 188 | .navbar { |
| 174 | height: $headerHeight; | 189 | height: $headerHeight; |
| 175 | overflow: hidden; | 190 | overflow: hidden; |
| 176 | position: relative; | 191 | position: relative; |
| ... | @@ -321,5 +336,5 @@ export default { | ... | @@ -321,5 +336,5 @@ export default { |
| 321 | } | 336 | } |
| 322 | } | 337 | } |
| 323 | } | 338 | } |
| 324 | } | 339 | } |
| 325 | </style> | 340 | </style> | ... | ... |
| ... | @@ -2,32 +2,45 @@ | ... | @@ -2,32 +2,45 @@ |
| 2 | <div class="from-clues"> | 2 | <div class="from-clues"> |
| 3 | <!-- 表单部分 --> | 3 | <!-- 表单部分 --> |
| 4 | <div class="from-clues-header"> | 4 | <div class="from-clues-header"> |
| 5 | <el-form :model="ruleForm" label-width="80px"> | 5 | <el-form :model="ruleForm" label-width="100px"> |
| 6 | <el-row> | 6 | <el-row> |
| 7 | <el-col :span="5"> | 7 | <el-col :span="6"> |
| 8 | <el-form-item label="电子签名"> | 8 | <el-form-item label="用户名称:"> |
| 9 | <el-input v-model="ruleForm.dzqm"></el-input> | 9 | {{ruleForm.name}} |
| 10 | </el-form-item> | 10 | </el-form-item> |
| 11 | </el-col> | 11 | </el-col> |
| 12 | <el-col :span="19" class="btnColRight"> | 12 | <el-col :span="6"> |
| 13 | <el-form-item> | 13 | <el-form-item label="组织机构:"> |
| 14 | <el-button type="primary" native-type="submit">查询</el-button> | 14 | {{ruleForm.organizationName}} |
| 15 | </el-form-item> | ||
| 16 | </el-col> | ||
| 17 | <el-col :span="6"> | ||
| 18 | <el-form-item label="部门:"> | ||
| 19 | {{ruleForm.departmentName}} | ||
| 20 | </el-form-item> | ||
| 21 | </el-col> | ||
| 22 | </el-row> | ||
| 23 | <el-row> | ||
| 24 | <el-col :span="24"> | ||
| 25 | <el-form-item label="签名路径:"> | ||
| 26 | <img :src="ruleForm.dzqmurl" class="signature-image"> | ||
| 15 | </el-form-item> | 27 | </el-form-item> |
| 16 | </el-col> | 28 | </el-col> |
| 17 | </el-row> | 29 | </el-row> |
| 18 | </el-form> | 30 | </el-form> |
| 19 | </div> | 31 | </div> |
| 32 | |||
| 20 | <el-upload | 33 | <el-upload |
| 21 | class="upload-demo" | 34 | class="upload-demo" |
| 22 | action="" | 35 | action="" |
| 23 | :limit="1" | 36 | :limit="1" |
| 24 | multiple | 37 | multiple |
| 38 | :key="key" | ||
| 25 | :auto-upload="false" | 39 | :auto-upload="false" |
| 26 | accept=".jpg, .png" | 40 | accept=".jpg, .png, .jpeg" |
| 27 | :on-change="handleChange" | 41 | :on-change="handleChange" |
| 28 | :before-upload="beforeUpload" | 42 | :before-upload="beforeUpload" |
| 29 | :file-list="fileList" | 43 | :show-file-list="false" |
| 30 | list-type="picture" | ||
| 31 | drag> | 44 | drag> |
| 32 | <i class="el-icon-upload"></i> | 45 | <i class="el-icon-upload"></i> |
| 33 | <div class="el-upload__text">将图片拖到此处,或<em>点击上传</em></div> | 46 | <div class="el-upload__text">将图片拖到此处,或<em>点击上传</em></div> |
| ... | @@ -38,36 +51,51 @@ | ... | @@ -38,36 +51,51 @@ |
| 38 | </template> | 51 | </template> |
| 39 | <script> | 52 | <script> |
| 40 | import { dzqmUpload } from '@/api/dzqm' | 53 | import { dzqmUpload } from '@/api/dzqm' |
| 54 | import { getUserInfo } from '@/api/user' | ||
| 41 | export default { | 55 | export default { |
| 42 | name: "dzqm", | 56 | name: "dzqm", |
| 43 | data () { | 57 | data () { |
| 44 | return { | 58 | return { |
| 45 | ruleForm: { | 59 | ruleForm: {}, |
| 46 | dzqm: "" | 60 | key: 0, |
| 47 | }, | ||
| 48 | fileList: [], // 已上传文件列表 | ||
| 49 | } | 61 | } |
| 50 | }, | 62 | }, |
| 63 | mounted () { | ||
| 64 | this.getUserInfo() | ||
| 65 | }, | ||
| 51 | methods: { | 66 | methods: { |
| 67 | async getUserInfo () { | ||
| 68 | let res = await getUserInfo() | ||
| 69 | this.ruleForm = res.result | ||
| 70 | }, | ||
| 52 | beforeUpload (file) { | 71 | beforeUpload (file) { |
| 53 | // 上传文件之前的钩子,返回false则停止上传 | 72 | this.files = file; |
| 54 | const isJPGorPNG = file.type === 'image/jpeg' || file.type === 'image/png'; | 73 | const allowedExtensions = ['jpg', 'jpeg', 'png']; |
| 55 | const isLt2M = file.size / 1024 / 1024 < 5; | 74 | const maxFileSizeMB = 5; |
| 56 | if (!isJPGorPNG) { | 75 | |
| 57 | this.$message.error('上传图片只能是 JPG/PNG 格式!'); | 76 | const extension = allowedExtensions.includes(file.name.split('.').pop().toLowerCase()); |
| 58 | return false; | 77 | const isLt5M = file.size / 1024 / 1024 < maxFileSizeMB; |
| 59 | } | 78 | |
| 60 | if (!isLt2M) { | 79 | if (!extension) { |
| 61 | this.$message.error('上传图片大小不能超过 5MB!'); | 80 | this.$message.warning('上传模板只能是 jpg、jpeg、png 格式!'); |
| 62 | return false; | 81 | } else if (!isLt5M) { |
| 82 | this.$message.warning(`上传模板大小不能超过 ${maxFileSizeMB}MB!`); | ||
| 63 | } | 83 | } |
| 64 | return true; | 84 | |
| 85 | return extension && isLt5M; | ||
| 65 | }, | 86 | }, |
| 66 | async handleChange (file) { | 87 | async handleChange (file) { |
| 67 | var formdata = new FormData(); | 88 | var formdata = new FormData(); |
| 68 | formdata.append("file", file.raw); | 89 | formdata.append("file", file.raw); |
| 69 | dzqmUpload(formdata).then(res => { | 90 | dzqmUpload(formdata).then(res => { |
| 70 | console.log(res); | 91 | if (res.code == 200) { |
| 92 | this.$message({ | ||
| 93 | message: '上传成功!', | ||
| 94 | type: 'success' | ||
| 95 | }) | ||
| 96 | this.key++ | ||
| 97 | this.ruleForm.dzqmurl = res.message | ||
| 98 | } | ||
| 71 | }) | 99 | }) |
| 72 | } | 100 | } |
| 73 | } | 101 | } |
| ... | @@ -75,5 +103,10 @@ | ... | @@ -75,5 +103,10 @@ |
| 75 | </script> | 103 | </script> |
| 76 | <style scoped lang="scss"> | 104 | <style scoped lang="scss"> |
| 77 | @import "~@/styles/public.scss"; | 105 | @import "~@/styles/public.scss"; |
| 106 | .signature-image { | ||
| 107 | width: 100%; | ||
| 108 | max-height: 360px; | ||
| 109 | object-fit: contain; | ||
| 110 | } | ||
| 78 | </style> | 111 | </style> |
| 79 | 112 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment