Browse Source

修改注册

feature
战立标 2 years ago
parent
commit
6d327be819
  1. BIN
      public/favicon.ico
  2. 19
      public/index.html
  3. 4
      src/components/Picker/index.vue
  4. 4
      src/plugins/vant.js
  5. 6
      src/router/index.js
  6. 2
      src/router/router.config.js
  7. 187
      src/views/userInfo/index.vue

BIN
public/favicon.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

19
public/index.html

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= webpackConfig.name %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script src="//res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script>
<!-- <script type="text/javascript" src="//mapapi.qq.com/web/mapComponents/geoLocation/v/geolocation.min.js"></script>-->
</body>
</html>

4
src/components/Picker/index.vue

@ -55,13 +55,13 @@ export default {
value(val) { value(val) {
let values = this.items.map(item => item.value) let values = this.items.map(item => item.value)
this.index = values.indexOf(val) this.index = values.indexOf(val)
console.log(this.index, this.value) console.log(this.index, this.value, this.items)
}, },
items: { items: {
handler() { handler() {
let values = this.items.map(item => item.value) let values = this.items.map(item => item.value)
this.index = values.indexOf(this.value) this.index = values.indexOf(this.value)
// this.index = -1 console.log(this.items, this.index, this.value)
}, },
deep: true deep: true
} }

4
src/plugins/vant.js

@ -20,7 +20,8 @@ import {
Tag, Tag,
Steps, Steps,
Step, Step,
Divider Divider,
List
} from 'vant' } from 'vant'
Vue.use(Button) Vue.use(Button)
@ -43,3 +44,4 @@ Vue.use(Button)
.use(Steps) .use(Steps)
.use(Step) .use(Step)
.use(Divider) .use(Divider)
.use(List)

6
src/router/index.js

@ -50,7 +50,11 @@ function paramsFormat(params) {
} }
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
document.title = to.meta.title ? to.meta.title : title if (to.params.type) {
document.title = to.params.type === 'edit' ? '编辑' : '注册'
} else {
document.title = to.meta.title ? to.meta.title : title
}
if (localStorage.getItem('token')) { if (localStorage.getItem('token')) {
store.dispatch('getUserInfo').then(() => { store.dispatch('getUserInfo').then(() => {
next() next()

2
src/router/router.config.js

@ -30,7 +30,7 @@ export const constantRouterMap = [
path: '/userInfo/:type', path: '/userInfo/:type',
name: 'userInfo', name: 'userInfo',
component: () => import('@/views/userInfo'), component: () => import('@/views/userInfo'),
meta: { title: '完善信息', keepAlive: false } meta: { title: '', keepAlive: false }
}, },
{ {
path: '/demand', path: '/demand',

187
src/views/userInfo/index.vue

@ -22,8 +22,8 @@
</template> </template>
</van-field> </van-field>
</template> </template>
</div> <!-- </div>
<div class="block"> <div class="block">-->
<Picker <Picker
required required
label="所在街道" label="所在街道"
@ -34,13 +34,13 @@
/> />
<Picker <Picker
required required
label="居住社区" label="所在社区"
placeholder="请选择" placeholder="请选择"
v-model="communityId" v-model="communityId"
:items="communityOptions" :items="communityOptions"
@change="e => setVal('community', e, 'getQuartersForCommunity')" @change="e => setVal('community', e, 'getQuartersForCommunity')"
/> />
<Picker <!-- <Picker
required required
label="小区" label="小区"
placeholder="请选择" placeholder="请选择"
@ -71,15 +71,16 @@
v-model="houseNumberId" v-model="houseNumberId"
:items="houseOptions" :items="houseOptions"
@change="e => setVal('houseNumber', e)" @change="e => setVal('houseNumber', e)"
/> />-->
</div> </div>
<Perfect v-if="type === 'edit'" />
<van-button round block @click="submit" color="linear-gradient(to right, #81B5FB, #3E92FF)">提交</van-button> <van-button round block @click="submit" color="linear-gradient(to right, #81B5FB, #3E92FF)">提交</van-button>
</div> </div>
</template> </template>
<script> <script>
import Picker from '@/components/Picker' import Picker from '@/components/Picker'
import Perfect from '@/components/Perfect'
import { import {
buildingoption, buildingoption,
getAllAgencyStreet, getAllAgencyStreet,
@ -94,7 +95,7 @@ import {
var leftTime var leftTime
export default { export default {
name: 'userInfo', name: 'userInfo',
components: { Picker }, components: { Picker, Perfect },
data() { data() {
return { return {
form: {}, form: {},
@ -123,38 +124,72 @@ export default {
buildingOptions: [], buildingOptions: [],
unitOptions: [], unitOptions: [],
houseOptions: [], houseOptions: [],
type: '' type: '',
city: ''
} }
}, },
mounted() { mounted() {
this.type = this.$route.params.type ? this.$route.params.type : '' this.init()
this.userInfo = this.$store.state.app.userInfo
this.gender = this.$store.state.app.userInfo.gender
this.getAllAgencyStreet()
if (this.type === 'edit') {
this.surName = this.userInfo.realName
this.gender = this.userInfo.gender
this.streetId = this.userInfo.streetId
this.customerId = this.userInfo.customerId
this.communityId = this.userInfo.communityId
this.quarterId = this.userInfo.quarterId
this.buildingId = this.userInfo.buildingId
this.unitId = this.userInfo.unitId
this.houseNumberId = this.userInfo.houseNumberId
this.homeId = this.userInfo.homeId
this.gridId = this.userInfo.gridId
this.getChildAgencyByPid()
this.getQuartersForCommunity()
this.buildingoption()
this.unitoption()
this.houseoption()
}
}, },
destroyed() { destroyed() {
clearInterval(leftTime) clearInterval(leftTime)
}, },
watch: {}, watch: {
'$route.params.type'() {
this.init()
}
},
methods: { methods: {
init() {
this.type = this.$route.params.type ? this.$route.params.type : ''
document.title = this.$route.params.type === 'edit' ? '编辑' : '注册'
this.userInfo = this.$store.state.app.userInfo
this.gender = this.$store.state.app.userInfo.gender
if (this.type === 'edit') {
this.surName = this.userInfo.realName
this.gender = this.userInfo.gender
this.streetId = this.userInfo.streetId
this.customerId = this.userInfo.customerId
this.communityId = this.userInfo.communityId
this.$nextTick(() => {
this.getAllAgencyStreet()
this.getChildAgencyByPid()
console.log(this.streetId, 'this.streetId')
})
/* this.quarterId = this.userInfo.quarterId
this.buildingId = this.userInfo.buildingId
this.unitId = this.userInfo.unitId
this.houseNumberId = this.userInfo.houseNumberId
this.homeId = this.userInfo.homeId
this.gridId = this.userInfo.gridId
this.getQuartersForCommunity()
this.buildingoption()
this.unitoption()
this.houseoption()*/
} else {
//
this.geolocation = new qq.maps.Geolocation('LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO', 'myapp')
//
this.getMyLocation()
}
},
//
getMyLocation() {
this.geolocation.getLocation(this.showPosition, this.errorPosition) //
},
//
showPosition(position) {
this.longitude = position.lng
this.latitude = position.lat
this.address = position.city + position.addr
this.city = position.city
this.getAllAgencyStreet()
},
errorPosition() {
console.log('定位失败,再次进行定位')
},
submit() { submit() {
let params = { let params = {
gender: this.gender, gender: this.gender,
@ -197,10 +232,10 @@ export default {
return return
} }
if (!params.communityId) { if (!params.communityId) {
this.$toast.fail('请选择居住社区') this.$toast.fail('请选择所在社区')
return return
} }
if (!params.quarterId) { /* if (!params.quarterId) {
this.$toast.fail('请选择小区') this.$toast.fail('请选择小区')
return return
} }
@ -215,7 +250,7 @@ export default {
if (!params.houseNumberId) { if (!params.houseNumberId) {
this.$toast.fail('请选择门牌号') this.$toast.fail('请选择门牌号')
return return
} }*/
if (this.type !== 'edit') { if (this.type !== 'edit') {
register(params).then(res => { register(params).then(res => {
localStorage.setItem('token', res.token) localStorage.setItem('token', res.token)
@ -300,17 +335,27 @@ export default {
// //
getAllAgencyStreet() { getAllAgencyStreet() {
getAllAgencyStreet({}).then(res => { getAllAgencyStreet({}).then(res => {
console.log(res, 'resresres')
this.streetOptions = res this.streetOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.organizationName, label: item.organizationName,
value: item.id, value: item.id,
customerId: item.customerId customerId: item.customerId
} }
}) })
: [] : []
this.communityOptions = [] this.communityOptions = []
console.log(this.city)
if (this.city === '青岛市') {
this.streetOptions.forEach(item => {
if (item.label === '海伦路街道') {
this.streetId = item.value
this.customerId = item.customerId
console.log(item)
}
})
this.getChildAgencyByPid()
}
}) })
}, },
// //
@ -320,13 +365,13 @@ export default {
}).then(res => { }).then(res => {
this.communityOptions = res this.communityOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.organizationName, label: item.organizationName,
value: item.id value: item.id
} }
}) })
: [] : []
this.gridOptions = [] // this.quarterOptions = []
}) })
}, },
// //
@ -336,14 +381,14 @@ export default {
}).then(res => { }).then(res => {
this.quarterOptions = res this.quarterOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value, value: item.value,
gridId: item.pid gridId: item.pid
} }
}) })
: [] : []
this.buildingOptions = [] // this.buildingOptions = []
}) })
}, },
// //
@ -353,13 +398,13 @@ export default {
}).then(res => { }).then(res => {
this.buildingOptions = res this.buildingOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
this.unitOptions = [] // this.unitOptions = []
}) })
}, },
// //
@ -369,13 +414,13 @@ export default {
}).then(res => { }).then(res => {
this.unitOptions = res this.unitOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
this.houseOptions = [] // this.houseOptions = []
}) })
}, },
// //
@ -385,11 +430,11 @@ export default {
}).then(res => { }).then(res => {
this.houseOptions = res this.houseOptions = res
? res.map(item => { ? res.map(item => {
return { return {
label: item.label, label: item.label,
value: item.value value: item.value
} }
}) })
: [] : []
}) })
} }

Loading…
Cancel
Save