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. 4
      src/router/index.js
  6. 2
      src/router/router.config.js
  7. 93
      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) {
let values = this.items.map(item => item.value)
this.index = values.indexOf(val)
console.log(this.index, this.value)
console.log(this.index, this.value, this.items)
},
items: {
handler() {
let values = this.items.map(item => item.value)
this.index = values.indexOf(this.value)
// this.index = -1
console.log(this.items, this.index, this.value)
},
deep: true
}

4
src/plugins/vant.js

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

4
src/router/index.js

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

2
src/router/router.config.js

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

93
src/views/userInfo/index.vue

@ -22,8 +22,8 @@
</template>
</van-field>
</template>
</div>
<div class="block">
<!-- </div>
<div class="block">-->
<Picker
required
label="所在街道"
@ -34,13 +34,13 @@
/>
<Picker
required
label="居住社区"
label="所在社区"
placeholder="请选择"
v-model="communityId"
:items="communityOptions"
@change="e => setVal('community', e, 'getQuartersForCommunity')"
/>
<Picker
<!-- <Picker
required
label="小区"
placeholder="请选择"
@ -71,15 +71,16 @@
v-model="houseNumberId"
:items="houseOptions"
@change="e => setVal('houseNumber', e)"
/>
/>-->
</div>
<Perfect v-if="type === 'edit'" />
<van-button round block @click="submit" color="linear-gradient(to right, #81B5FB, #3E92FF)">提交</van-button>
</div>
</template>
<script>
import Picker from '@/components/Picker'
import Perfect from '@/components/Perfect'
import {
buildingoption,
getAllAgencyStreet,
@ -94,7 +95,7 @@ import {
var leftTime
export default {
name: 'userInfo',
components: { Picker },
components: { Picker, Perfect },
data() {
return {
form: {},
@ -123,38 +124,72 @@ export default {
buildingOptions: [],
unitOptions: [],
houseOptions: [],
type: ''
type: '',
city: ''
}
},
mounted() {
this.init()
},
destroyed() {
clearInterval(leftTime)
},
watch: {
'$route.params.type'() {
this.init()
}
},
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
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.$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.getChildAgencyByPid()
this.getQuartersForCommunity()
this.buildingoption()
this.unitoption()
this.houseoption()
this.houseoption()*/
} else {
//
this.geolocation = new qq.maps.Geolocation('LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO', 'myapp')
//
this.getMyLocation()
}
},
destroyed() {
clearInterval(leftTime)
//
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('定位失败,再次进行定位')
},
watch: {},
methods: {
submit() {
let params = {
gender: this.gender,
@ -197,10 +232,10 @@ export default {
return
}
if (!params.communityId) {
this.$toast.fail('请选择居住社区')
this.$toast.fail('请选择所在社区')
return
}
if (!params.quarterId) {
/* if (!params.quarterId) {
this.$toast.fail('请选择小区')
return
}
@ -215,7 +250,7 @@ export default {
if (!params.houseNumberId) {
this.$toast.fail('请选择门牌号')
return
}
}*/
if (this.type !== 'edit') {
register(params).then(res => {
localStorage.setItem('token', res.token)
@ -300,7 +335,6 @@ export default {
//
getAllAgencyStreet() {
getAllAgencyStreet({}).then(res => {
console.log(res, 'resresres')
this.streetOptions = res
? res.map(item => {
return {
@ -311,6 +345,17 @@ export default {
})
: []
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()
}
})
},
//
@ -326,7 +371,7 @@ export default {
}
})
: []
this.gridOptions = []
// this.quarterOptions = []
})
},
//
@ -343,7 +388,7 @@ export default {
}
})
: []
this.buildingOptions = []
// this.buildingOptions = []
})
},
//
@ -359,7 +404,7 @@ export default {
}
})
: []
this.unitOptions = []
// this.unitOptions = []
})
},
//
@ -375,7 +420,7 @@ export default {
}
})
: []
this.houseOptions = []
// this.houseOptions = []
})
},
//

Loading…
Cancel
Save