diff --git a/pages/modify_visitor/modify_visitor.vue b/pages/modify_visitor/modify_visitor.vue index 7ced801..92c8e9d 100644 --- a/pages/modify_visitor/modify_visitor.vue +++ b/pages/modify_visitor/modify_visitor.vue @@ -41,22 +41,7 @@ if(option.vid) this.vid = option.vid }, onShow() { - if(this.vid){ - var visitor_info = uni.getStorageSync('visitor_info_'+this.vid) - if(!visitor_info) { - this.$func.toPage('/pages/index/index') - return - } - visitor_info = JSON.parse(visitor_info) - this.name = visitor_info.real_name - this.idcardExt = visitor_info.id_no - this.phone = visitor_info.mobile - this.nameRule = true - this.idcardExtRule = true - this.phoneRule = true - - this.checkSubmit() - } + if(this.vid) this.getVisitorInfo() }, methods: { add() { @@ -83,6 +68,22 @@ if(data == -1) return this.$func.toPage('/pages/visitors/visitors?type='+this.type) }); + }, + getVisitorInfo() { + this.$http.req('get_visitor_info', {id:this.vid}, 'GET', true).then(data=>{ + if(data == -1) { + this.$func.toPage('/pages/index/index') + return + } + + this.name = data.name + this.idcardExt = data.idcard_ext + this.phone = data.phone + this.nameRule = true + this.idcardExtRule = true + this.phoneRule = true + this.checkSubmit() + }); }, nameBlurEvent(value, res){ this.name = value