| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <template>
- <div class="mobile-fix-content">
- <div class="info">
- <div class="line">
- <input type="file"
- class="file-input"
- name="name"
- accept="image/jpeg,image/jpg,image/gif,image/bmp,image/png"
- @change="uploadImg"/>
- <span><i class="iconfont icon-tuxiang-" style="font-size: .29rem;"></i>头像:</span>
- <span class="describe"><img :src="imageUploadUrl ? imageUploadUrl : info.imageUrl ? info.imageUrl : '/images/component/default.png'" alt="">
- <i class="iconfont icon-xiangyou"></i></span>
- </div>
- <div class="line">
- <span><i class="iconfont icon-yonghuming"></i>用户名:</span>
- <span class="describe">{{info.userName}}</span>
- </div>
- <div class="line" @click="jumpSet('email')">
- <span><i class="iconfont icon-youxiang"></i>邮箱:</span>
- <span class="describe">{{info.userEmail}}
- <i class="iconfont icon-xiangyou"></i>
- </span>
- </div>
- <div class="line" @click="jumpSet('mobile')">
- <span><i class="iconfont icon-shouji"></i>手机:</span>
- <span class="describe">{{info.userTel}}
- <i class="iconfont icon-xiangyou"></i>
- </span>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- props: {
- info: {
- default: {},
- type: Object
- }
- },
- data () {
- return {
- imageUploadUrl: ''
- }
- },
- mounted: function () {
- this.$nextTick(() => {
- if (!this.$store.state.option.user.logged) {
- this.$router.push('/auth/login?returnUrl=' + window.location.href)
- }
- })
- },
- computed: {
- getEmail () {
- return this.$store.state.user.updateUser.email.data.content
- },
- getMobile () {
- return this.$store.state.user.updateUser.mobile.data.content
- }
- },
- methods: {
- uploadImg (e) {
- let file = e.target.files[0]
- if (file) {
- let param = new FormData()
- param.append('image', file, file.name)
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/api/images', param, config)
- .then(response => {
- if (response.data) {
- let imageUrl = response.data[0].path
- this.$http.post('/basic/user/setImageUrl', {imageUrl: imageUrl})
- .then(response => {
- if (response.data) {
- this.imageUploadUrl = response.data.imageUrl
- this.$store.dispatch('loadUserInfo')
- }
- })
- }
- })
- }
- },
- jumpSet (info) {
- if (info === 'email') {
- window.location.href = decodeURIComponent(this.getEmail)
- } else if (info === 'mobile') {
- window.location.href = decodeURIComponent(this.getMobile)
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .mobile-fix-content {
- background: #f1f3f6;
- }
- .info {
- width: 7.1rem;
- background: #fff;
- margin: 0 auto;
- height: 4.66rem;
- padding: 0 .24rem;
- font-size: .28rem;
- color: #999;
- border-radius: .05rem;
- margin-top: .3rem;
- .line {
- position: relative;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- height: 1.16rem;
- line-height: 1.16rem;
- border-bottom: .01rem solid #d9d9d9;
- &:last-child {
- border-bottom: none;
- }
- input{
- position: absolute;
- top: 0;
- left: 0;
- height: 1.16rem;
- width: 100%;
- opacity: 0;
- }
- span{
- display: inline-block;
- font-size: 0.28rem;
- color: #226ce7;
- text-align: left;
- i{
- margin-right: .15rem;
- font-size: .3rem;
- color: #f8953c;
- }
- }
- span.describe {
- float: right;
- color: #333;
- i{
- margin: 0 0 0 .1rem;
- font-size: .24rem;
- color: #bebebe;
- }
- img{
- width: .58rem;
- height: .58rem;
- /*border: 1px solid #bebebe;*/
- }
- }
- }
- }
- </style>
|