|
|
@@ -1,12 +1,6 @@
|
|
|
<template>
|
|
|
<div class="info-layout">
|
|
|
- <edit
|
|
|
- :name="langAccount.info"
|
|
|
- @clickOper="handleOper('infoStatus')"
|
|
|
- :oper="infoStatus?langAccount.edit:langAccount.show"
|
|
|
- :isActive="infoStatus"
|
|
|
- class=""
|
|
|
- >
|
|
|
+ <edit :name="langAccount.info" @clickOper="handleOper('infoStatus')" :oper="infoStatus?langAccount.edit:langAccount.show" :isActive="infoStatus" class="">
|
|
|
<div class="info" :class="{'info-en':language==='en'}" slot="show">
|
|
|
<div class="s-tx">
|
|
|
<p>{{langAccount.avatar}}</p>
|
|
|
@@ -21,7 +15,7 @@
|
|
|
<div class="i-tx">
|
|
|
<p>{{langAccount.avatar}}</p>
|
|
|
<div class="itx-con">
|
|
|
- <div class="card-img avatar" :style="{backgroundImage: info.head?`url(${info.head})`:'#e6e6e6'}"></div>
|
|
|
+ <div class="card-img avatar" :style="{backgroundImage: info.head?`url(${info.head})`:'#e6e6e6'}"></div>
|
|
|
<div class="btn choose">
|
|
|
<input class="el-upload" ref="uploadInput" name="file" type="file" @change="update" alt="sadasdasd">
|
|
|
<span>{{langAccount.select}}</span>
|
|
|
@@ -32,25 +26,11 @@
|
|
|
<p><span>{{langAccount.account}}</span><span>{{info.userName}}</span></p>
|
|
|
<p>
|
|
|
<span>{{langAccount.nickname}}</span>
|
|
|
- <input
|
|
|
- autofocus
|
|
|
- v-model="editinfo.nickName"
|
|
|
- :placeholder="langAccount.placeholder.nickname"
|
|
|
- class="nickname"
|
|
|
- maxlength="10"
|
|
|
- type="text"
|
|
|
- >
|
|
|
+ <input autofocus v-model="editinfo.nickName" :placeholder="langAccount.placeholder.nickname" class="nickname" maxlength="10" type="text">
|
|
|
</p>
|
|
|
<p>
|
|
|
<span>{{langAccount.email}}</span>
|
|
|
- <input
|
|
|
- autofocus
|
|
|
- v-model="editinfo.email"
|
|
|
- :placeholder="langAccount.placeholder.email"
|
|
|
- class="nickname"
|
|
|
- maxlength="40"
|
|
|
- type="text"
|
|
|
- >
|
|
|
+ <input autofocus v-model="editinfo.email" :placeholder="langAccount.placeholder.email" class="nickname" maxlength="40" type="text">
|
|
|
</p>
|
|
|
<!-- <label class="check-con" @click="isReceive=!isReceive">
|
|
|
<span class="check-box">
|
|
|
@@ -123,46 +103,58 @@ export default {
|
|
|
components: { edit, citySelect },
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
- info: state => state.user.info,
|
|
|
- langAccount: state => state.language.home.manage.account,
|
|
|
- language: state => state.language.current,
|
|
|
- langToast: state => state.language.home.toast,
|
|
|
- editinfo: state => cloneObj(state.user.info),
|
|
|
- token: state => state.user.token,
|
|
|
- invoice2: state => {
|
|
|
+ info: (state) => state.user.info,
|
|
|
+ langAccount: (state) => state.language.home.manage.account,
|
|
|
+ language: (state) => state.language.current,
|
|
|
+ langToast: (state) => state.language.home.toast,
|
|
|
+ editinfo: (state) => cloneObj(state.user.info),
|
|
|
+ token: (state) => state.user.token,
|
|
|
+ invoice2: (state) => {
|
|
|
let type = Object.prototype.toString.call(state.user.invoice2)
|
|
|
if (type === '[object Object]') {
|
|
|
return state.user.invoice2
|
|
|
}
|
|
|
- let condition = state.user.invoice2 && state.user.invoice2 !== 'null' && type !== '[object Array]'
|
|
|
- return (condition ? JSON.parse(state.user.invoice2) : {})
|
|
|
+ let condition =
|
|
|
+ state.user.invoice2 &&
|
|
|
+ state.user.invoice2 !== 'null' &&
|
|
|
+ type !== '[object Array]'
|
|
|
+ return condition ? JSON.parse(state.user.invoice2) : {}
|
|
|
},
|
|
|
- editInvoice2: state => {
|
|
|
+ editInvoice2: (state) => {
|
|
|
let type = Object.prototype.toString.call(state.user.invoice2)
|
|
|
if (type === '[object Object]') {
|
|
|
return state.user.invoice2
|
|
|
}
|
|
|
- let condition = state.user.invoice2 && state.user.invoice2 !== 'null' && type !== '[object Array]'
|
|
|
+ let condition =
|
|
|
+ state.user.invoice2 &&
|
|
|
+ state.user.invoice2 !== 'null' &&
|
|
|
+ type !== '[object Array]'
|
|
|
return cloneObj(condition ? JSON.parse(state.user.invoice2) : {})
|
|
|
},
|
|
|
- invoice3: state => {
|
|
|
+ invoice3: (state) => {
|
|
|
let type = Object.prototype.toString.call(state.user.invoice3)
|
|
|
if (type === '[object Object]') {
|
|
|
return state.user.invoice3
|
|
|
}
|
|
|
- let condition = state.user.invoice3 && state.user.invoice3 !== 'null' && type !== '[object Array]'
|
|
|
- return (condition ? JSON.parse(state.user.invoice3) : {})
|
|
|
+ let condition =
|
|
|
+ state.user.invoice3 &&
|
|
|
+ state.user.invoice3 !== 'null' &&
|
|
|
+ type !== '[object Array]'
|
|
|
+ return condition ? JSON.parse(state.user.invoice3) : {}
|
|
|
},
|
|
|
- editInvoice3: state => {
|
|
|
+ editInvoice3: (state) => {
|
|
|
let type = Object.prototype.toString.call(state.user.invoice3)
|
|
|
if (type === '[object Object]') {
|
|
|
return state.user.invoice3
|
|
|
}
|
|
|
- let condition = state.user.invoice3 && state.user.invoice3 !== 'null' && type !== '[object Array]'
|
|
|
+ let condition =
|
|
|
+ state.user.invoice3 &&
|
|
|
+ state.user.invoice3 !== 'null' &&
|
|
|
+ type !== '[object Array]'
|
|
|
return cloneObj(condition ? JSON.parse(state.user.invoice3) : {})
|
|
|
},
|
|
|
- address: state => state.user.address || {},
|
|
|
- editAdd: state => cloneObj(state.user.address) || {}
|
|
|
+ address: (state) => state.user.address || {},
|
|
|
+ editAdd: (state) => cloneObj(state.user.address) || {}
|
|
|
})
|
|
|
},
|
|
|
data () {
|
|
|
@@ -191,29 +183,31 @@ export default {
|
|
|
if (this.editinfo.email.trim() && !reg.email.test(this.editinfo.email)) {
|
|
|
return this.$toast.show('warn', this.langToast['8'])
|
|
|
}
|
|
|
- let res = await this.$http
|
|
|
- .post(
|
|
|
- '/user/updateUserDetail',
|
|
|
- {
|
|
|
- nickName: this.editinfo.nickName,
|
|
|
- email: this.editinfo.email || null,
|
|
|
- isNotice: Number(this.isReceive)
|
|
|
- },
|
|
|
- {
|
|
|
- headers: {
|
|
|
- token: this.token
|
|
|
- }
|
|
|
+ let res = await this.$http.post(
|
|
|
+ '/user/updateUserDetail',
|
|
|
+ {
|
|
|
+ nickName: this.editinfo.nickName,
|
|
|
+ email: this.editinfo.email || null,
|
|
|
+ isNotice: Number(this.isReceive)
|
|
|
+ },
|
|
|
+ {
|
|
|
+ headers: {
|
|
|
+ token: this.token
|
|
|
}
|
|
|
- )
|
|
|
+ }
|
|
|
+ )
|
|
|
let data = res.data
|
|
|
if (data.code === 0) {
|
|
|
this.infoStatus = true
|
|
|
- this.$store.dispatch('getInfo', {url: '/user/getUserInfo', name: 'info'})
|
|
|
+ this.$store.dispatch('getInfo', {
|
|
|
+ url: '/user/getUserInfo',
|
|
|
+ name: 'info'
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$toast.show('warn', this.langToast[data.code], async () => {
|
|
|
if (data.code === 3004) {
|
|
|
await this.$store.dispatch('logout')
|
|
|
- this.$router.push({name: 'home'})
|
|
|
+ this.$router.push({ name: 'home' })
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
@@ -225,10 +219,14 @@ export default {
|
|
|
}
|
|
|
let params = {}
|
|
|
let invoiceType = ''
|
|
|
- let check = value => {
|
|
|
+ let check = (value) => {
|
|
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
|
if (!value[i].val) {
|
|
|
- return this.$toast.show('warn', (this.language === 'en' ? value[i].En : value[i].name) + this.langToast['7'])
|
|
|
+ return this.$toast.show(
|
|
|
+ 'warn',
|
|
|
+ (this.language === 'en' ? value[i].En : value[i].name) +
|
|
|
+ this.langToast['7']
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
return true
|
|
|
@@ -259,7 +257,14 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
- let {title: title1, code: code1, organizedAddress: organizedAddress1, registerPhone: registerPhone1, bankName: bankName1, bankAccount: bankAccount1} = this.editInvoice3
|
|
|
+ let {
|
|
|
+ title: title1,
|
|
|
+ code: code1,
|
|
|
+ organizedAddress: organizedAddress1,
|
|
|
+ registerPhone: registerPhone1,
|
|
|
+ bankName: bankName1,
|
|
|
+ bankAccount: bankAccount1
|
|
|
+ } = this.editInvoice3
|
|
|
invoiceType = 3
|
|
|
|
|
|
let title = isObject(title1)
|
|
|
@@ -321,7 +326,7 @@ export default {
|
|
|
token: this.token
|
|
|
}
|
|
|
})
|
|
|
- .then(data => {
|
|
|
+ .then((data) => {
|
|
|
this.invoiceStatus = true
|
|
|
this.$store.dispatch('getInvoice', {
|
|
|
type: invoiceType,
|
|
|
@@ -345,10 +350,14 @@ export default {
|
|
|
id
|
|
|
} = this.editAdd
|
|
|
|
|
|
- let check = value => {
|
|
|
+ let check = (value) => {
|
|
|
for (let i = 0, len = value.length; i < len; i++) {
|
|
|
if (!value[i].val) {
|
|
|
- return this.$toast.show('warn', (this.language === 'en' ? value[i].En : value[i].name) + this.langToast['7'])
|
|
|
+ return this.$toast.show(
|
|
|
+ 'warn',
|
|
|
+ (this.language === 'en' ? value[i].En : value[i].name) +
|
|
|
+ this.langToast['7']
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
return true
|
|
|
@@ -390,7 +399,7 @@ export default {
|
|
|
token: this.token
|
|
|
}
|
|
|
})
|
|
|
- .then(data => {
|
|
|
+ .then((data) => {
|
|
|
this.addressStatus = true
|
|
|
this.$store.dispatch('getInfo', {
|
|
|
url: '/user/getReceiverInfo',
|
|
|
@@ -400,26 +409,34 @@ export default {
|
|
|
},
|
|
|
update (e) {
|
|
|
let file = e.target.files[0]
|
|
|
- let type = file.type.toLowerCase()
|
|
|
- if (type !== 'image/jpeg' && type !== 'image/png') {
|
|
|
- return this.$toast.show('warn', this.langToast['36'])
|
|
|
- }
|
|
|
+ try {
|
|
|
+ let type = file.type.toLowerCase()
|
|
|
+ console.log(file.size / 1000)
|
|
|
+ if (type !== 'image/jpeg' && type !== 'image/png') {
|
|
|
+ return this.$toast.show('warn', this.langToast['36'])
|
|
|
+ }
|
|
|
+ if (file.size / 1000 > 1024) {
|
|
|
+ return this.$toast.show('warn', this.langToast['46'])
|
|
|
+ }
|
|
|
|
|
|
- let token = this.token
|
|
|
- let config = {
|
|
|
- headers: {
|
|
|
- token
|
|
|
+ let token = this.token
|
|
|
+ let config = {
|
|
|
+ headers: {
|
|
|
+ token
|
|
|
+ }
|
|
|
+ } // 添加请求头
|
|
|
+ var reader = new FileReader()
|
|
|
+ reader.onload = async (e) => {
|
|
|
+ let imgdata = e.target.result
|
|
|
+ this.$http
|
|
|
+ .post('/user/uploadHead', { imgdata }, config)
|
|
|
+ .then((data) => {
|
|
|
+ this.info.head = data.data.msg
|
|
|
+ localStorage.setItem('info', JSON.stringify(this.info))
|
|
|
+ })
|
|
|
}
|
|
|
- } // 添加请求头
|
|
|
- var reader = new FileReader()
|
|
|
- reader.onload = async e => {
|
|
|
- let imgdata = e.target.result
|
|
|
- this.$http.post('/user/uploadHead', { imgdata }, config).then(data => {
|
|
|
- this.info.head = data.data.msg
|
|
|
- localStorage.setItem('info', JSON.stringify(this.info))
|
|
|
- })
|
|
|
- }
|
|
|
- reader.readAsDataURL(file)
|
|
|
+ reader.readAsDataURL(file)
|
|
|
+ } catch (err) {}
|
|
|
}
|
|
|
},
|
|
|
watch: {},
|
|
|
@@ -428,18 +445,20 @@ export default {
|
|
|
url: '/user/getReceiverInfo',
|
|
|
name: 'address'
|
|
|
})
|
|
|
- Object.keys(this.invoice2).length === 0 && this.$store.dispatch('getInvoice', {
|
|
|
- type: 2,
|
|
|
- params: {
|
|
|
- invoiceType: 2
|
|
|
- }
|
|
|
- })
|
|
|
- Object.keys(this.invoice3).length === 0 && this.$store.dispatch('getInvoice', {
|
|
|
- type: 3,
|
|
|
- params: {
|
|
|
- invoiceType: 3
|
|
|
- }
|
|
|
- })
|
|
|
+ Object.keys(this.invoice2).length === 0 &&
|
|
|
+ this.$store.dispatch('getInvoice', {
|
|
|
+ type: 2,
|
|
|
+ params: {
|
|
|
+ invoiceType: 2
|
|
|
+ }
|
|
|
+ })
|
|
|
+ Object.keys(this.invoice3).length === 0 &&
|
|
|
+ this.$store.dispatch('getInvoice', {
|
|
|
+ type: 3,
|
|
|
+ params: {
|
|
|
+ invoiceType: 3
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -481,7 +500,7 @@ export default {
|
|
|
height: 26px;
|
|
|
font-size: 12px;
|
|
|
margin: 12px 0 20px;
|
|
|
- &:hover{
|
|
|
+ &:hover {
|
|
|
background: #1fe4dc;
|
|
|
}
|
|
|
}
|
|
|
@@ -499,7 +518,7 @@ export default {
|
|
|
color: #a0a0a0;
|
|
|
line-height: 24px;
|
|
|
}
|
|
|
- .card-img{
|
|
|
+ .card-img {
|
|
|
font-size: 0;
|
|
|
display: inline-block;
|
|
|
cursor: pointer;
|
|
|
@@ -520,37 +539,37 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .info{
|
|
|
- .s-tx{
|
|
|
+ .info {
|
|
|
+ .s-tx {
|
|
|
position: relative;
|
|
|
- &>p{
|
|
|
+ & > p {
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
top: 0;
|
|
|
}
|
|
|
- .avatar{
|
|
|
- margin-left: 80px
|
|
|
+ .avatar {
|
|
|
+ margin-left: 80px;
|
|
|
}
|
|
|
}
|
|
|
- p{
|
|
|
- span{
|
|
|
+ p {
|
|
|
+ span {
|
|
|
display: inline-block;
|
|
|
- &:first-of-type{
|
|
|
+ &:first-of-type {
|
|
|
width: 80px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .info-en{
|
|
|
- .s-tx{
|
|
|
- .avatar{
|
|
|
+ .info-en {
|
|
|
+ .s-tx {
|
|
|
+ .avatar {
|
|
|
margin-left: $info-width;
|
|
|
}
|
|
|
}
|
|
|
- p{
|
|
|
- span{
|
|
|
- &:first-of-type{
|
|
|
+ p {
|
|
|
+ span {
|
|
|
+ &:first-of-type {
|
|
|
width: $info-width;
|
|
|
}
|
|
|
}
|
|
|
@@ -560,18 +579,18 @@ export default {
|
|
|
.edit-info {
|
|
|
display: flex;
|
|
|
.info-left {
|
|
|
- &>p{
|
|
|
+ & > p {
|
|
|
margin: 10px 0;
|
|
|
}
|
|
|
min-width: 210px;
|
|
|
- .i-tx{
|
|
|
+ .i-tx {
|
|
|
position: relative;
|
|
|
- &>p{
|
|
|
+ & > p {
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
top: 0;
|
|
|
}
|
|
|
- .itx-con{
|
|
|
+ .itx-con {
|
|
|
margin-left: 80px;
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
@@ -601,10 +620,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- .edit-en{
|
|
|
- .info-left {
|
|
|
- .i-tx{
|
|
|
- .itx-con{
|
|
|
+ .edit-en {
|
|
|
+ .info-left {
|
|
|
+ .i-tx {
|
|
|
+ .itx-con {
|
|
|
margin-left: $info-width;
|
|
|
}
|
|
|
}
|
|
|
@@ -665,7 +684,7 @@ export default {
|
|
|
}
|
|
|
@media screen and (min-width: 2000px) {
|
|
|
.edit-layout {
|
|
|
- max-width: 75%!important;
|
|
|
+ max-width: 75% !important;
|
|
|
}
|
|
|
}
|
|
|
</style>
|