提交 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',
'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]}` return `${enMonth[parseInt(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,34 +73,25 @@ export default { ...@@ -72,34 +73,25 @@ export default {
dialogVisible: false dialogVisible: false
} }
}, },
computed: { computed: {},
setSex() {
return n => {
const sex = {
1: this.$t('shmsLang.status.sexMan'),
0: this.$t('shmsLang.status.sexWoMan'),
2: this.$t('shmsLang.status.sexUnknown')
}
return sex[n]
}
},
setStatus() {
return n => {
const status = {
1: this.$t('shmsLang.status.enrolled'),
2: this.$t('shmsLang.status.graduate'),
3: this.$t('shmsLang.status.Lose'),
4: this.$t('shmsLang.status.gap'),
5: this.$t('shmsLang.status.withdraw')
}
return status[n]
}
}
},
mounted() { mounted() {
this.emailValue = this.info.email this.emailValue = this.info.email
}, },
methods: { methods: {
setSex(n) {
const sex = { 0: this.$t('shmsLang.status.sexWoMan'), 1: this.$t('shmsLang.status.sexMan'), 2: this.$t('shmsLang.status.sexUnknown') }
return sex[n]
},
setStatus(n) {
const status = {
1: this.$t('shmsLang.status.enrolled'),
2: this.$t('shmsLang.status.graduate'),
3: this.$t('shmsLang.status.Lose'),
4: this.$t('shmsLang.status.gap'),
5: this.$t('shmsLang.status.withdraw')
}
return status[n]
},
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',
'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]}` return `${enMonth[parseInt(splitDate[1])]} ${splitDate[2]}. ${splitDate[0]}`
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论