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

修改bug

上级 355309ac
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
src="https://webapp-pub.ezijing.com/highway/h5/form_minus.png" src="https://webapp-pub.ezijing.com/highway/h5/form_minus.png"
class="btn_minus" class="btn_minus"
@click="handleMinus(formIndex)" @click="handleMinus(formIndex)"
v-if="formIndex !== 0" v-if="!isRemoveInfo(listIt)"
/> />
<div class="formItemList_item" v-for="(item, index) in listIt" :key="index"> <div class="formItemList_item" v-for="(item, index) in listIt" :key="index">
<!-- 输入框 --> <!-- 输入框 -->
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
:rules="[{ required: item.required, message: item.placeholder }]" :rules="[{ required: item.required, message: item.placeholder }]"
clearable clearable
:border="true" :border="true"
:disabled="formIndex === 0 && (item.key === 'mobile' || item.key === 'name')" :disabled="!item.enable_edit"
/> />
<div class="line"></div> <div class="line"></div>
</div> </div>
...@@ -143,6 +143,9 @@ export default { ...@@ -143,6 +143,9 @@ export default {
}, },
mounted() {}, mounted() {},
methods: { methods: {
isRemoveInfo(item) {
return !!item.find(f => f.enable_edit === false)
},
// 提交 // 提交
onSubmit() { onSubmit() {
console.log(this.data, '123') console.log(this.data, '123')
...@@ -174,9 +177,13 @@ export default { ...@@ -174,9 +177,13 @@ export default {
this.$emit('next', res.data) this.$emit('next', res.data)
} }
} else { } else {
console.log(res.data, 'rers') if (this.stepList[this.stepList.length - 1].num === this.data.num) {
// 完成步骤跳转
this.$router.push({ path: '/' })
} else {
this.$emit('next', res.data) this.$emit('next', res.data)
} }
}
this.checkedPay = false this.checkedPay = false
} }
}) })
...@@ -190,6 +197,7 @@ export default { ...@@ -190,6 +197,7 @@ export default {
const baseUserFields = this.data.user_fields[0].map(item => { const baseUserFields = this.data.user_fields[0].map(item => {
const copyItem = Object.assign({}, item) const copyItem = Object.assign({}, item)
copyItem.value = '' copyItem.value = ''
copyItem.enable_edit = true
return copyItem return copyItem
}) })
this.data.user_fields.push(baseUserFields) this.data.user_fields.push(baseUserFields)
......
...@@ -98,12 +98,18 @@ export default { ...@@ -98,12 +98,18 @@ export default {
} }
}, },
handlePay(item) { handlePay(item) {
console.log(item, 'item') const payRecord = item.list[0].pay_record
const stepDetails = item.activity.details.find(d => d.id === payRecord.activity_detail_id)
stepDetails.list = item.list.map((list, index) => {
list.mobile === JSON.parse(window.localStorage.userInfo).mobile ? list.index = 0 : list.index = index + 1
return list
}).sort((a, b) => a.index - b.index)
delete item.activity.details
stepDetails.activityInfo = item.activity
stepDetails.join_rand = item.join_rand
window.localStorage.orderStepDetails = JSON.stringify([stepDetails])
this.$router.push({ this.$router.push({
path: '/SignMainPage', path: '/SignMainPage'
query: {
id: item.activity.id
}
}) })
} }
} }
......
...@@ -43,6 +43,7 @@ export default { ...@@ -43,6 +43,7 @@ export default {
components: { SignForm, ImgShow, OrderConfirm }, components: { SignForm, ImgShow, OrderConfirm },
data() { data() {
return { return {
userMobile: '',
title: '报名主页面', title: '报名主页面',
stepIndex: 0, stepIndex: 0,
isShowSkip: '', isShowSkip: '',
...@@ -59,8 +60,12 @@ export default { ...@@ -59,8 +60,12 @@ export default {
} }
}, },
mounted() { mounted() {
this.activity_detail_id = this.$route.query.activity_detail_id this.userMobile = JSON.parse(window.localStorage.userInfo).mobile
if (this.$route.query.id) {
this.getActivityDetail() this.getActivityDetail()
} else {
this.setData(JSON.parse(window.localStorage.orderStepDetails))
}
}, },
methods: { methods: {
// 获取活动详情 // 获取活动详情
...@@ -106,10 +111,10 @@ export default { ...@@ -106,10 +111,10 @@ export default {
// 判断有没有返回人员 没返回吧自己的信息push进去 // 判断有没有返回人员 没返回吧自己的信息push进去
if (data[fields].list.length) { if (data[fields].list.length) {
// list有可能不会返回自己的信息,不返回push进去 // list有可能不会返回自己的信息,不返回push进去
const findOwn = data[fields].list.find(info => info.mobile === data.info.mobile) // const findOwn = data[fields].list.find(info => info.mobile === data.info.mobile)
if (!findOwn) { // if (!findOwn) {
data[fields].list.push(data.info) // data[fields].list.push(data.info)
} // }
// 添加index用于用户排序 // 添加index用于用户排序
item.list = data[fields].list.map((item, index) => { item.list = data[fields].list.map((item, index) => {
item.mobile === data.info.mobile ? (item.index = 0) : (item.index = index + 1) item.mobile === data.info.mobile ? (item.index = 0) : (item.index = index + 1)
...@@ -139,7 +144,7 @@ export default { ...@@ -139,7 +144,7 @@ export default {
}) })
}, },
setData(data) { setData(data) {
// console.log(data, 'datas') console.log(data, 'datas')
// 处理数据 // 处理数据
this.stepList = data.reduce((a, b) => { this.stepList = data.reduce((a, b) => {
// type: 1 是展示不用处理 // type: 1 是展示不用处理
...@@ -163,8 +168,15 @@ export default { ...@@ -163,8 +168,15 @@ export default {
allFormList.find(f => f.key === dd.key) allFormList.find(f => f.key === dd.key)
) )
fData.value = d[dd.key] fData.value = d[dd.key]
// 判断当前form信息是不是登录人的 是的话给个标记(作为后面表单填写不可编辑的标识)
if (fData.key === 'mobile') {
if (fData.value === this.userMobile) {
fData.enable_edit = false
}
}
fields.push(fData) fields.push(fData)
}) })
// console.log(fields.find(f => !f.enable_edit), 'fields')
userFieldsStore.push(fields) userFieldsStore.push(fields)
}) })
b.user_fields = userFieldsStore b.user_fields = userFieldsStore
...@@ -200,7 +212,7 @@ export default { ...@@ -200,7 +212,7 @@ export default {
} }
}, },
handleNext(data) { handleNext(data) {
if (this.setpItem.num !== this.stepList) { if (this.setpItem.num !== this.stepList.length) {
this.stepIndex++ this.stepIndex++
if (data) { if (data) {
this.setpItem.payData = data this.setpItem.payData = data
......
...@@ -40,6 +40,7 @@ const store = new Vuex.Store({ ...@@ -40,6 +40,7 @@ const store = new Vuex.Store({
const isLogin = await getUser() const isLogin = await getUser()
.then(response => { .then(response => {
if (response.code === 0) { if (response.code === 0) {
window.localStorage.userInfo = JSON.stringify(response.data)
commit('setUser', response.data) commit('setUser', response.data)
return true return true
} else { } else {
......
...@@ -15,6 +15,7 @@ const allFormList = [ ...@@ -15,6 +15,7 @@ const allFormList = [
key: 'gender', key: 'gender',
required: true, required: true,
value: '0', value: '0',
enable_edit: true,
optionList: [ optionList: [
{ id: '0', option: '未知' }, { id: '0', option: '未知' },
{ id: '1', option: '男' }, { id: '1', option: '男' },
...@@ -140,7 +141,8 @@ const allFormList = [ ...@@ -140,7 +141,8 @@ const allFormList = [
value: '', value: '',
required: true, required: true,
optionList: ['有', '无'], optionList: ['有', '无'],
showPicker: false showPicker: false,
enable_edit: true
}, },
{ {
type: 'select', type: 'select',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论