diff --git a/src/page/profile/children/children/children/add.vue b/src/page/profile/children/children/children/add.vue index 3b7d97c7f013a8ba9b0a659a0857a65c94d1502f..141ae8061a41750f34533ae8b028be163ca80508 100644 --- a/src/page/profile/children/children/children/add.vue +++ b/src/page/profile/children/children/children/add.vue @@ -56,11 +56,11 @@ standbytele:'', standbytelenum:'', addSearch:false, - //newAddress:{}, //增加数组的元素 + newAddress:{}, //增加数组的元素 } }, created(){ - console.log(this.addAddress) + }, mixins: [getImgPath], components: { @@ -69,14 +69,15 @@ }, computed:{ ...mapState([ - 'addAddress', + 'addAddress','removeAddress','newAddress', ]), - ...mapMutations([ - 'ADD_ADDRESS' - ]) + }, props:[], methods: { + ...mapMutations([ + 'ADD_ADDRESS' + ]), inputThing(){ (!this.message) ? this.verify=true : this.verify=false; this.bindThing() @@ -122,9 +123,19 @@ } }, submitThing(){ - if(this.butpart){ - //this.ADD_ADDRESS({"name":this.message,"address":this.mesthree,"address_detail":}) - } + //if(this.butpart){ + this.ADD_ADDRESS({ + name: this.message, + address: this.mesthree, + address_detail: this.addAddress, + geohash: 'wtw37r7cxep4', + phone: this.telenum, + phone_bk: this.standbytelenum, + poi: this.addAddress, + poi_type: 0, + }); + this.$router.go(-1); + //} } } } diff --git a/src/store/action.js b/src/store/action.js index 922643b9ccf1c2418063592a86e28959bca4b45b..a98d25aa9207b3f12f9d16897855c849ffeb8f77 100644 --- a/src/store/action.js +++ b/src/store/action.js @@ -25,10 +25,10 @@ export default { if(state.removeAddress.length > 0) return; - let addres = await getAddressList(state.userInfo.user_id).then( res =>{ - return res - }); - + // let addres = await getAddressList(state.userInfo.user_id).then( res =>{ + // return res + // }); + let addres = await getAddressList() commit(SAVE_ADDRESS, addres); }, } \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index bee8e2298b56dcd0a8be25afd0cec6d7d8c7eb8a..e5c8c0b055185a3387063459e426fb2043b550a1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -31,8 +31,6 @@ const state = { removeAddress:[],//移除地址 addAddress:'', //新增地址 question: null,//问题详情 - //增加地址的几个key值 - newAddress:{}, } export default new Vuex.Store({ diff --git a/src/store/mutations.js b/src/store/mutations.js index 3b334588982887706dca4d3ed3e85f7f7eb6a62e..63d7a1ee0723751fd633861b927d4482ceff66a6 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -27,6 +27,7 @@ import { SAVE_QUESTION, ADD_ADDRESS, } from './mutation-types.js' + import { setStore, getStore, @@ -262,8 +263,9 @@ export default { [SAVE_QUESTION](state, question) { state.question = {...question}; }, - [ADD_ADDRESS](state, obj){ - state.newAddress = {...obj}; - state.removeAddress = state.removeAddress.unshift(state.newAddress) + + [ADD_ADDRESS](state, obj) { + console.log(state.removeAddress) + state.removeAddress = [...state.removeAddress, obj]; } } \ No newline at end of file