|
|
@@ -35,7 +35,10 @@ export default Vue.extend({
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.expo_key = this.$route.params.url
|
|
|
- if (this.token) {
|
|
|
+ const form_data = sessionStorage.getItem('form_cache')
|
|
|
+ if (form_data) {
|
|
|
+ this.from_data = JSON.parse(form_data)
|
|
|
+ } else {
|
|
|
getExpoInfo(this.expo_key).then(res => {
|
|
|
this.from_data = res.data
|
|
|
this.from_data.form_fields.forEach(item => {
|
|
|
@@ -46,13 +49,6 @@ export default Vue.extend({
|
|
|
this.expo_id = res.data.id
|
|
|
}).catch(err => {
|
|
|
})
|
|
|
- } else {
|
|
|
- this.$router.push({
|
|
|
- name: 'userRegister',
|
|
|
- query: {
|
|
|
- expo_key: this.expo_key
|
|
|
- }
|
|
|
- })
|
|
|
}
|
|
|
},
|
|
|
share(way) {
|
|
|
@@ -106,30 +102,47 @@ export default Vue.extend({
|
|
|
})
|
|
|
},
|
|
|
submit() {
|
|
|
- if (this.loading) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.loading = true
|
|
|
- const form_data = {}
|
|
|
- for (let i = 0; i < this.from_data.form_fields.length; i++) {
|
|
|
- if (this.from_data.form_fields[i].field_name) {
|
|
|
- form_data[this.from_data.form_fields[i].field_name] = this.from_data.form_fields[i].value
|
|
|
- } else {
|
|
|
- form_data['field_' + this.from_data.form_fields[i].id] = this.from_data.form_fields[i].value
|
|
|
+ if (this.token) {
|
|
|
+ if (this.loading) {
|
|
|
+ return
|
|
|
}
|
|
|
+ this.loading = true
|
|
|
+ const form_data = {}
|
|
|
+ for (let i = 0; i < this.from_data.form_fields.length; i++) {
|
|
|
+ if (this.from_data.form_fields[i].field_name) {
|
|
|
+ form_data[this.from_data.form_fields[i].field_name] = this.from_data.form_fields[i].value
|
|
|
+ } else {
|
|
|
+ form_data['field_' + this.from_data.form_fields[i].id] = this.from_data.form_fields[i].value
|
|
|
+ }
|
|
|
|
|
|
- if (this.from_data.form_fields[i].is_required && !this.from_data.form_fields[i].value) {
|
|
|
- this.$message.error('请填写必填项')
|
|
|
- this.loading = false
|
|
|
- return
|
|
|
+ if (this.from_data.form_fields[i].is_required && !this.from_data.form_fields[i].value) {
|
|
|
+ this.$message.error('请填写必填项')
|
|
|
+ this.loading = false
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+ submitForm(this.expo_id, form_data).then(res => {
|
|
|
+ this.isOk = true
|
|
|
+ this.loading = false
|
|
|
+ }).catch(err => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$confirm('请先登录', '提示', {
|
|
|
+ type: 'warning',
|
|
|
+ callback: action => {
|
|
|
+ if (action === 'confirm') {
|
|
|
+ sessionStorage.setItem('form_cache', JSON.stringify(this.from_data))
|
|
|
+ this.$router.push({
|
|
|
+ name: 'userRegister',
|
|
|
+ query: {
|
|
|
+ expo_key: this.expo_key
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- submitForm(this.expo_id, form_data).then(res => {
|
|
|
- this.isOk = true
|
|
|
- this.loading = false
|
|
|
- }).catch(err => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
},
|
|
|
returnWidth(name) {
|
|
|
if (['email', 'address'].includes(name)) {
|
|
|
@@ -297,8 +310,7 @@ export default Vue.extend({
|
|
|
<div v-if="from_data.show_official_footer" class="power-by">
|
|
|
<a target="_blank" href="/">多果表单</a>提供技术支持 by <a target="_blank" href="https://matchexpo.cn/">MatchExpo</a>
|
|
|
</div>
|
|
|
- <div v-else class="power-by">
|
|
|
- </div>
|
|
|
+ <div v-else class="power-by" />
|
|
|
<div class="share">
|
|
|
<div class="text">分享至:</div>
|
|
|
<div class="share-list">
|