Commit 5318f27c by 潘琦

签约新增需求,cookie保存用户输入的签约信息;

parent 4aa3e4ae
......@@ -28,6 +28,7 @@ import {
} from 'mint-ui'
import 'mint-ui/lib/style.css'
import vueSignature from 'vue-signature'
import VueCookies from 'vue-cookies'
Vue.component(TabContainer.name, TabContainer)
Vue.component(TabContainerItem.name, TabContainerItem)
......@@ -46,6 +47,8 @@ Vue.component(Radio.name, Radio)
Vue.component(Checklist.name, Checklist)
Vue.use(InfiniteScroll)
Vue.use(vueSignature)
Vue.use(VueCookies)
VueCookies.config('7d')
Vue.prototype.$toast = Toast
Vue.prototype.$MessageBox = MessageBox
......
......@@ -4,6 +4,7 @@ const getters = {
userInfo: state => state.user.userInfo,
code: state => state.user.code,
authId: state => state.user.authId,
accountId: state => state.user.accountId
accountId: state => state.user.accountId,
signInfo: state => state.user.signInfo
}
export default getters
......@@ -17,6 +17,9 @@ const user = {
accountId: getStore({
name: 'account_id'
}) || '',
signInfo: getStore({
name: 'signInfo'
}),
userInfo: {}
},
actions: {
......@@ -34,6 +37,9 @@ const user = {
},
setAccountId ({ commit }, param) {
commit('SET_ACCOUNTID', param)
},
setSignInfo ({ commit }, param) {
commit('SET_SIGNINFO', param)
}
},
mutations: {
......@@ -80,6 +86,14 @@ const user = {
},
SET_USERIFNO: (state, userInfo) => {
state.userInfo = userInfo
},
SET_SIGNINFO: (state, info) => {
state.signInfo = info
setStore({
name: 'signInfo',
content: state.signInfo,
type: 'session'
})
}
}
}
......
......@@ -66,7 +66,7 @@
<div class="td-table" @click="openPopupAddress">
<div class="td-table-cell text">
<p class="m-b-normal">
<span v-if="BaseForm.address === ''">请选择现在居住地址</span>
<span v-if="BaseForm.address === '' || BaseForm.address === ' '">请选择现在居住地址</span>
<span v-else class="light">{{BaseForm.address}}</span>
<!-- {{BaseForm.address==''? '请选择现在居住地址':BaseForm.address}} -->
</p>
......@@ -525,7 +525,9 @@ export default {
code: '',
orgName: '',
chooseImages: [], // 身份证图片
chooseImages2: [] // 怀孕资料图片
chooseImagesIds: [], // 身份证图片微信本地图片id
chooseImages2: [], // 怀孕资料图片
chooseImages2Ids: [] // 怀孕资料图片微信本地图片id
},
BaseValidate: { // 表单各个列是否合法状态
nameState: true,
......@@ -547,14 +549,14 @@ export default {
addressPopupVisible: false, // “现住址”popup显示状态
orgPopupVisible: false, // “所在卫生服务机构”popup显示状态
addressForm: {
province: '江苏省',
city: '苏州市',
area: '张江港市',
province: '',
city: '',
area: '',
street: '',
villages: '',
ProvinceCode: '320000',
CityCode: '320500',
AreaCode: '320582',
ProvinceCode: '',
CityCode: '',
AreaCode: '',
StreetCode: '',
VillagesCode: ''
},
......@@ -597,6 +599,7 @@ export default {
console.log('created')
// wxpermission(0, () => {})
// this.getOrgInfoFn()
// 根据来源,省市区联动相对应显示默认值
if (this.from !== '') {
switch (this.from) {
case '320582':
......@@ -606,12 +609,12 @@ export default {
this.addressForm.ProvinceCode = '320000'
this.addressForm.CityCode = '320500'
this.addressForm.AreaCode = '320582'
this.stepCurrent = 3
break
default:
this.stepCurrent = 1
break
}
this.stepCurrent = 3
} else {
this.stepCurrent = 1
}
......@@ -695,6 +698,7 @@ export default {
this.ChoosePlusVisible = false
} else {
this.signStatus = 'create'
this.getSignInfoCookies() // 获取用户签约cookie信息
return false
}
this.accountId = data.accountId
......@@ -821,6 +825,7 @@ export default {
if (this.pageType === 0) {
this.BaseFormIntoTab1()
}
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
BaseValidateIdCard () { // 身份证验证
if (cardid(this.BaseForm.idCard)[0]) {
......@@ -831,6 +836,7 @@ export default {
if (this.pageType === 0) {
this.BaseFormIntoTab1()
}
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
// BaseValidateIdCardKid () { // 子女身份证验证
// if (cardid(this.userData.idCardKid)[0]) {
......@@ -858,6 +864,7 @@ export default {
if (this.pageType === 0) {
this.BaseFormIntoTab1()
}
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
BaseValidateAddress () { // 现住址验证
if (this.BaseForm.address === '') {
......@@ -875,6 +882,7 @@ export default {
if (this.pageType === 0) {
this.BaseFormIntoTab1()
}
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
BaseValidateOrg () { // 所在社区服务机构验证
if (!this.BaseForm.orgId || this.BaseForm.orgId === '') {
......@@ -929,6 +937,7 @@ export default {
day = '0' + day
}
this.BaseForm.lastMensesTime = selectedDate.getFullYear() + '-' + month + '-' + day
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
openPickerBirth (index) { // 打开出生日期控件
this.pickerOpenIndex = index
......@@ -973,7 +982,7 @@ export default {
if (this.addressForm.city !== '') {
this.BaseForm.address = this.BaseForm.address + ' ' + this.addressForm.city
}
if (this.addressForm.region !== '') {
if (this.addressForm.area !== '') {
this.BaseForm.address = this.BaseForm.address + ' ' + this.addressForm.area
}
if (this.addressForm.street !== '') {
......@@ -1209,6 +1218,7 @@ export default {
this.addressForm.StreetCode = ''
this.addressForm.VillagesCode = ''
this.stepCurrent = 2
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
getCity (parentCode) { // 根据省会code获取城市信息
let params = {
......@@ -1228,6 +1238,7 @@ export default {
this.addressForm.villages = ''
this.addressForm.VillagesCode = ''
this.stepCurrent = 3
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
getArea (parentCode) { // 根据城市code获取区域信息
let params = {
......@@ -1245,6 +1256,7 @@ export default {
this.addressForm.villages = ''
this.addressForm.VillagesCode = ''
this.stepCurrent = 4
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
getStreet (parentCode) { // 根据区域code获取街道信息
let params = {
......@@ -1260,6 +1272,7 @@ export default {
this.addressForm.villages = ''
this.addressForm.VillagesCode = ''
this.stepCurrent = 5
this.saveSignInfoToCookie() // 储存用户签约录入信息
},
getVillages (parentCode) { // 根据街道code获取居委会信息
let params = {
......@@ -1272,6 +1285,7 @@ export default {
this.addressForm.villages = val
this.addressForm.VillagesCode = code
// this.stepCurrent = 5
this.saveSignInfoToCookie() // 储存用户签约录入信息
this.cancelPopupAddress()
},
setOrgId (item) {
......@@ -1315,6 +1329,12 @@ export default {
success: function (res) {
let localIds = res.localIds // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
console.log(localIds, type)
if (type === 1) {
that.BaseForm.chooseImagesIds = localIds
} else if (type === 2) {
that.BaseForm.chooseImages2Ids = localIds
}
that.saveSignInfoToCookie() // 储存用户签约录入信息
that.wxGetLocalImgData(localIds, type)
}
})
......@@ -1396,6 +1416,91 @@ export default {
handelLightBoxClose () {
this.lightBoxImage = ''
this.lightBoxVisible = false
},
saveSignInfoToCookie () { // 将签约信息存入session
// if (this.signId === '' || !this.signId) {
// let signInfoJSON = {
// BaseForm: {
// name: this.BaseForm.name,
// idCard: this.BaseForm.idCard,
// phone: this.BaseForm.phone,
// lastMensesTime: this.BaseForm.lastMensesTime, // 末次月经时间
// address: this.BaseForm.address,
// subAddress: this.BaseForm.subAddress,
// street: this.BaseForm.street,
// chooseImagesIds: this.BaseForm.chooseImagesIds, // 身份证图片微信本地图片id
// chooseImages2Ids: this.BaseForm.chooseImages2Ids // 怀孕资料图片微信本地图片id
// },
// addressForm: this.addressForm
// }
// this.$cookies.set('signInfo', JSON.stringify(signInfoJSON), 60 * 60 * 24 * 7)
// // store.dispatch('setSignInfo', JSON.stringify(signInfoJSON))
// }
},
getSignInfoCookies () { // 获取用户签约信息cookie
// let signInfo = this.$cookies.get('signInfo')
// if (signInfo !== '' && signInfo) {
// this.BaseForm.name = signInfo.BaseForm.name
// this.BaseForm.idCard = signInfo.BaseForm.idCard
// this.BaseForm.phone = signInfo.BaseForm.phone
// this.BaseForm.lastMensesTime = signInfo.BaseForm.lastMensesTime // 末次月经时间
// // this.BaseForm.address = signInfo.addressForm.province + ' ' + signInfo.addressForm.city + ' ' + signInfo.addressForm.area
// // this.BaseForm.subAddress = signInfo.addressForm.street + ' ' + signInfo.addressForm.villages
// if (signInfo.addressForm.province !== '') {
// this.BaseForm.address = signInfo.addressForm.province
// }
// if (signInfo.addressForm.city !== '') {
// this.BaseForm.address = this.BaseForm.address + ' ' + signInfo.addressForm.city
// }
// if (signInfo.addressForm.area !== '') {
// this.BaseForm.address = this.BaseForm.address + ' ' + signInfo.addressForm.area
// }
// if (signInfo.addressForm.street !== '') {
// this.BaseForm.subAddress = signInfo.addressForm.street
// }
// if (signInfo.addressForm.villages !== '') {
// this.BaseForm.subAddress = this.BaseForm.subAddress + ' ' + signInfo.addressForm.villages
// }
// this.BaseForm.street = signInfo.BaseForm.street
// this.BaseForm.chooseImagesIds = signInfo.BaseForm.chooseImagesIds // 身份证图片微信本地图片id
// this.BaseForm.chooseImages2Ids = signInfo.BaseForm.chooseImages2Ids // 怀孕资料图片微信本地图片id
// if (this.BaseForm.chooseImagesIds.length > 0) {
// this.getWXLocalImgDataById(0, 1)
// }
// // this.wxGetLocalImgData(signInfo.BaseForm.chooseImages2Ids, 2)
// this.addressForm = signInfo.addressForm
// this.$toast({
// message: signInfo.BaseForm.chooseImagesIds,
// position: 'center',
// duration: 3000
// })
// }
},
getWXLocalImgDataById (index, type) {
// let that = this
// let localId = that.BaseForm.chooseImagesIds[index]
// wx.getLocalImgData({
// localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
// success: function (res) {
// let localData = res.localData
// let imageBase64 = ''
// // 自处目的是为了解决android图片前没有“data:image/jpeg;base64,”图片无法显示问题
// if (localData.indexOf('data:image') === 0) {
// imageBase64 = localData
// } else {
// imageBase64 = 'data:image/jpeg;base64,' + localData.replace(/\n/g, '')
// }
// if (type === 1) {
// that.BaseForm.chooseImages.push(imageBase64)
// } else if (type === 2) {
// that.BaseForm.chooseImages2.push(imageBase64)
// }
// if (index + 1 < that.BaseForm.chooseImagesIds.length) {
// that.getWXLocalImgDataById(index + 1, type)
// }
// that.uploadImgBtnHandel()
// }
// })
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment