提交 eb22c685 authored 作者: lihuihui's avatar lihuihui

update: 优化代码

上级 66a4e929
...@@ -86,7 +86,6 @@ export default { ...@@ -86,7 +86,6 @@ export default {
.getCondition() .getCondition()
.then(response => { .then(response => {
this.allOption = response.data.get_score this.allOption = response.data.get_score
console.log(this.allOption)
}) })
.finally(() => {}) .finally(() => {})
} }
......
...@@ -56,27 +56,14 @@ export default { ...@@ -56,27 +56,14 @@ export default {
infoItem: [] infoItem: []
} }
}, },
mounted() {},
computed: {},
methods: { methods: {
setDate(date) { setDate(date) {
const substringDate = date.substring(0, date.indexOf(' ')) const substringDate = date.substring(0, date.indexOf(' '))
const splitDate = substringDate.split('-') const splitDate = substringDate.split('-')
const enMonth = { const enMonth = {
'01': 'Jan', 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sept', 10: 'Oct', 11: 'Nov', 12: 'Dec'
'02': 'Feb', }
'03': 'Mar', return `${enMonth[parseInt(splitDate[1])]} ${splitDate[2]}. ${splitDate[0]}`
'04': 'Apr',
'05': 'May',
'06': 'Jun',
'07': 'Jul',
'08': 'Aug',
'09': 'Sept',
10: 'Oct',
11: 'Nov',
12: 'Dec'
}
return `${enMonth[splitDate[1]]} ${splitDate[2]}. ${splitDate[0]}`
} }
}, },
watch: { watch: {
...@@ -107,9 +94,7 @@ export default { ...@@ -107,9 +94,7 @@ export default {
}, },
{ {
name: this.$t('shmsLang.score.date'), name: this.$t('shmsLang.score.date'),
value: this.data.student_info.pubdate value: this.data.student_info.pubdate ? this.setDate(this.data.student_info.pubdate) : ''
? this.setDate(this.data.student_info.pubdate)
: ''
} }
] ]
] ]
......
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
</div> </div>
<div class="info-temp m-t17"> <div class="info-temp m-t17">
<div class="name w140"> <div class="name w140">
<div>{{ $t('shmsLang.status.graduated') }}</div></div> <div>{{ $t('shmsLang.status.graduated') }}</div>
</div>
<div class="value" v-if="info.graduation_time"> <div class="value" v-if="info.graduation_time">
{{ setDate(info.graduation_time) }} {{ setDate(info.graduation_time) }}
</div> </div>
...@@ -72,19 +73,16 @@ export default { ...@@ -72,19 +73,16 @@ export default {
dialogVisible: false dialogVisible: false
} }
}, },
computed: { computed: {},
setSex() { mounted() {
return n => { this.emailValue = this.info.email
const sex = { },
1: this.$t('shmsLang.status.sexMan'), methods: {
0: this.$t('shmsLang.status.sexWoMan'), setSex(n) {
2: this.$t('shmsLang.status.sexUnknown') const sex = { 0: this.$t('shmsLang.status.sexWoMan'), 1: this.$t('shmsLang.status.sexMan'), 2: this.$t('shmsLang.status.sexUnknown') }
}
return sex[n] return sex[n]
}
}, },
setStatus() { setStatus(n) {
return n => {
const status = { const status = {
1: this.$t('shmsLang.status.enrolled'), 1: this.$t('shmsLang.status.enrolled'),
2: this.$t('shmsLang.status.graduate'), 2: this.$t('shmsLang.status.graduate'),
...@@ -93,13 +91,7 @@ export default { ...@@ -93,13 +91,7 @@ export default {
5: this.$t('shmsLang.status.withdraw') 5: this.$t('shmsLang.status.withdraw')
} }
return status[n] return status[n]
}
}
}, },
mounted() {
this.emailValue = this.info.email
},
methods: {
updateInfo() { updateInfo() {
const reg = /^([a-zA-Z]|[0-9])(\w|-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ const reg = /^([a-zA-Z]|[0-9])(\w|-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/
if (!reg.test(this.emailValue)) { if (!reg.test(this.emailValue)) {
...@@ -124,20 +116,9 @@ export default { ...@@ -124,20 +116,9 @@ export default {
const substringDate = date.substring(0, date.indexOf(' ')) const substringDate = date.substring(0, date.indexOf(' '))
const splitDate = substringDate.split('-') const splitDate = substringDate.split('-')
const enMonth = { const enMonth = {
'01': 'Jan', 1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Aug', 9: 'Sept', 10: 'Oct', 11: 'Nov', 12: 'Dec'
'02': 'Feb', }
'03': 'Mar', return `${enMonth[parseInt(splitDate[1])]} ${splitDate[2]}. ${splitDate[0]}`
'04': 'Apr',
'05': 'May',
'06': 'Jun',
'07': 'Jul',
'08': 'Aug',
'09': 'Sept',
10: 'Oct',
11: 'Nov',
12: 'Dec'
}
return `${enMonth[splitDate[1]]} ${splitDate[2]}. ${splitDate[0]}`
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论