shuishen
2022-02-25 cbd978c1fe6a9ff281c785c72cecb328d82692e4
注册页面更改
2 files modified
1 files added
394 ■■■■ changed files
pages/registerUser/map-副本.vue 3 ●●●● patch | view | raw | blame | history
pages/registerUser/registerUser.vue 391 ●●●● patch | view | raw | blame | history
static/img/location.png patch | view | raw | blame | history
pages/registerUser/map-副本.vue
@@ -1,6 +1,7 @@
<template>
    <view class="registerUser">
        <map style="width:100%;height:85vh;" :latitude="latitude" :polyline="polyline" :longitude="longitude"></map>
        <map style="width:100%;height:85vh;" :latitude="latitude" :polyline="polyline" :longitude="longitude"
            :markers="markers"></map>
    </view>
</template>
pages/registerUser/registerUser.vue
@@ -10,26 +10,25 @@
                <u-select v-model="show" mode="mutil-column-auto" :list="roleList" @confirm="radioGroupChange">
                </u-select>
            </u-form-item>
            <u-form-item v-show="form.role == '民警'" label=" " prop="warnNum" label-width="200" :required="true">
                <u-input v-model="form.warnNum" placeholder="请输入警号" />
            <u-form-item v-show="form.role == '民警'" label="警号" prop="signals" left-icon="edit-pen" label-width="200"
                :required="true">
                <u-input v-model="form.signals" placeholder="请输入警号" />
            </u-form-item>
            <u-form-item label="工作单位" left-icon="home-fill" label-width="200" :required="false">
            <u-form-item label="工作单位" left-icon="home-fill" label-width="200" :required="true">
                <u-radio-group v-model="jobValue">
                    <u-radio v-for="(item, index) in jobList" :key="index" :name="item.name" :disabled="item.disabled">
                        {{item.name}}
                    </u-radio>
                </u-radio-group>
            </u-form-item>
            <u-form-item v-show="jobValue == '有'" label=" " prop="obj" label-width="200" :required="false">
                <u-input v-model="form.obj" placeholder="请输入工作单位" />
            <u-form-item v-show="jobValue == '有'" label="工作地点" prop="xq" left-icon="map-fill" label-width="200"
                :required="true">
                <u-input v-model="form.xq" type="select" placeholder="请选择工作地点" :border="true"
                    @click="regionClick('工作地点')" />
            </u-form-item>
            <u-form-item label="所在地区" prop="xq" left-icon="map-fill" label-width="200" :required="true">
                <u-input v-model="form.xq" type="select" placeholder="请选择所在地区" :border="true" @click="regionClick" />
                <u-select v-model="regionShow" mode="mutil-column-auto" :list="regionList" @confirm="regionSelect">
                </u-select>
            </u-form-item>
            <u-form-item label="居住地" prop="address" left-icon="map" label-width="200" :required="false">
                <u-input v-model="form.address" placeholder="居住地" />
            <u-form-item label="居住地" prop="address" left-icon="map" label-width="200" :required="true">
                <u-input v-model="form.address" type="select" placeholder="请选择居住地" :border="true"
                    @click="placeClick('居住地')" />
            </u-form-item>
            <u-form-item label="性别" label-width="200" left-icon="man">
                <u-radio-group v-model="form.sex">
@@ -57,22 +56,25 @@
                <text class="a" @click="agreement(1)">隐私政策</text>
            </u-checkbox>
        </view>
        <div class="login-map-bc" v-if="mapShow">
            <div @click="mapShow = false">
            </div>
            <div class="login-map-content">
                <u-icon class="login-map-close" name="close" @click="mapShow = false"></u-icon>
                <view style="width: 100%; height: 100%; position: absolute; ">
                    <web-view :src="loginMapUrl"></web-view>
                </view>
            </div>
        </div>
        <u-button class="submit" @click="zc">
            注册</u-button>
        <map v-show="signLocation" id="SignLocationMap"
            style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 99;"
            @regionchange="regionChange" :latitude="latitude" :longitude="longitude" :scale="scale">
            <cover-view class="dingwBut">
                <cover-image class="location-log" src="../../static/img/location.png">
                </cover-image>
            </cover-view>
            <cover-view class="confirmBtn" @click="confirmChangeBtn">
                获取地址
            </cover-view>
        </map>
        <!-- <u-button @click="signLocation = true">dakai</u-button> -->
        <!-- <u-button class="submit" @click="submit">提交</u-button> -->
    </view>
</template>
@@ -106,6 +108,18 @@
            };
            return {
                // 记录地区获取居住地
                regionOrPlace: '',
                // 地图相关
                scale: 15, //缩放级别
                signLocation: false,
                latitude: 28.678983439095823,
                longitude: 115.84414205551147,
                mapLocationName: '',
                mapLocationLatitude: '',
                mapLocationLongitude: '',
                userConsent: false,
                jobValue: '无',
                jobList: [{
@@ -118,7 +132,6 @@
                    }
                ],
                regionName: '',
                loginMapUrl: "",
                radioList: [{
                        name: '是',
                        disabled: false
@@ -129,28 +142,7 @@
                    }
                ],
                radioValue: '否',
                mapShow: false,
                latitude: 28.68, //纬度
                longitude: 115.85, //经度
                scale: 12, //缩放级别
                polyline: [
                    //     { //指定一系列坐标点,从数组第一项连线至最后一项
                    //     points: [{
                    //             latitude: 34.79977,
                    //             longitude: 113.66072
                    //         },
                    //         {
                    //             latitude: 34.795541,
                    //             longitude: 113.681646
                    //         },
                    //     ],
                    //     color: "#0000AA", //线的颜色
                    //     width: 1, //线的宽度
                    //     //     dottedLine:true,//是否虚线
                    //     arrowLine: true, //带箭头的线 开发者工具暂不支持该属性
                    // },
                ],
                marker: [],
                show: false,
                showxq: false,
                listbm: [],
@@ -222,10 +214,11 @@
                    obj: '',
                    objId: '',
                    xq: '',
                    xqobjId: '',
                    jurisdiction: '',
                    jsid: '',
                    address: '',
                    warnNum: '',
                    signals: '',
                    workjurisdiction: ''
                },
                rules: {
                    user: [{
@@ -292,7 +285,7 @@
                        // 可以单个或者同时写两个触发验证方式 
                        trigger: ['change', 'blur'],
                    }],
                    warnNum: [{
                    signals: [{
                        required: true,
                        message: '请输入警号',
                        // 可以单个或者同时写两个触发验证方式 
@@ -348,56 +341,6 @@
                        value: "1495714378025480193"
                    }
                ],
                regionList: [{
                        label: '东湖区',
                        value: '1415619841521414145'
                    },
                    {
                        label: '西湖区',
                        value: '1415619917295710209'
                    },
                    {
                        label: '青云谱区',
                        value: '1415619986417840129'
                    },
                    {
                        label: '湾里区',
                        value: '1415620058526314497'
                    },
                    {
                        label: '青山湖区',
                        value: '1415620118307729409'
                    },
                    {
                        label: '新建区',
                        value: '1415620188289691649'
                    },
                    {
                        label: '南昌县',
                        value: '1415620235718881282'
                    },
                    {
                        label: '安义县',
                        value: '1415620288487419906'
                    },
                    {
                        label: '进贤县',
                        value: '1415620344112279553'
                    },
                    {
                        label: '经济技术开发区区',
                        value: '1415620404103409666'
                    },
                    {
                        label: '红谷滩区',
                        value: '1415620472965492738'
                    },
                    {
                        label: '高新技术开发区',
                        value: '1415620707473223681'
                    }
                ],
                regionShow: false
            };
        },
        methods: {
@@ -406,14 +349,13 @@
                    url: '/pages/registerUser/agreement?e=' + e
                });
            },
            regionClick() {
                this.regionShow = true;
            regionClick(e) {
                this.regionOrPlace = e
                this.signLocation = true
            },
            regionSelect(e) {
                this.form.xq = e[0].label
                this.form.xqobjId = e[0].value
                this.regionShow = false;
            placeClick(e) {
                this.regionOrPlace = e
                this.signLocation = true
            },
            zc() {
                if (this.userConsent == false) {
@@ -422,7 +364,7 @@
                        icon: 'none',
                        duration: 2000
                    });
                    return
                }
                var that = this;
@@ -444,41 +386,9 @@
                            return
                        }
                        var d = that.form;
                        var url = that.$store.state.piAPI + '/zc/inster',
                            data = {
                                // deptid: ,
                                password: d.pass,
                                password2: d.passTwo,
                                phone: d.phone,
                                sex: d.sex == '男' ? 1 : 2,
                                sname: d.name,
                                username: d.user,
                                deptid: d.objId,
                                parentId: d.jsid,
                                jurisdiction: d.xqobjId,
                                cardid: d.carId,
                                address: d.address,
                                workunit: d.obj
                            }
                        uni.request({
                            url: url,
                            method: 'POST',
                            data: data,
                            success: (res) => {
                                uni.showToast({
                                    title: '注册成功,请等待审核',
                                    icon: 'none',
                                    duration: 2000
                                });
                                setTimeout(function() {
                                    uni.navigateTo({
                                        url: '/pages/loging/loging'
                                    })
                                }, 2000);
                            }
                        });
                        that.registerEvent()
                        // that.$refs.uForm.validate(valid => {
                        //     if (valid) {
                        //         var d = that.form;
@@ -494,6 +404,51 @@
                });
            },
            registerEvent() {
                var d = this.form;
                var url = this.$store.state.piAPI + '/zc/inster',
                    data = {
                        // deptid: ,
                        password: d.pass,
                        password2: d.passTwo,
                        phone: d.phone,
                        sex: d.sex == '男' ? 1 : 2,
                        sname: d.name,
                        username: d.user,
                        parentId: d.jsid,
                        cardid: d.carId,
                        // 居住地址
                        address: d.address,
                        // 居住辖区
                        jurisdiction: d.jurisdiction,
                        // 工作地址
                        workaddress: d.xq,
                        // 工作辖区
                        workjurisdiction: d.workjurisdiction,
                        signals: d.signals
                    }
                uni.request({
                    url: url,
                    method: 'POST',
                    data: data,
                    success: (result) => {
                        console.log(result, 456)
                        uni.showToast({
                            title: '注册成功,请等待审核',
                            icon: 'none',
                            duration: 2000
                        });
                        setTimeout(function() {
                            uni.navigateTo({
                                url: '/pages/loging/loging'
                            })
                        }, 2000);
                    }
                });
            },
            depl() {
                this.show = true;
            },
@@ -504,6 +459,71 @@
                this.form.jsid = e[0].value
                this.show = false;
            },
            regionChange() { // 移动地图后重新获取门店
                var that = this
                uni.createMapContext('SignLocationMap', this).getCenterLocation({
                    success: res => {
                        that.getLocationInfor(res.longitude, res.latitude)
                    },
                    fail: res => {
                        uni.showModal({
                            content: '获取位置失败',
                            showCancel: false
                        })
                    }
                })
            },
            getLocationInfor(longitude, latitude) {
                var that = this
                var point = new plus.maps.Point(longitude, latitude);
                plus.maps.Map.reverseGeocode(
                    point, {},
                    function(event) {
                        var address = event.address; // 转换后的地理位置
                        var point = event.coord; // 转换后的坐标信息
                        var coordType = event.coordType; // 转换后的坐标系类型
                        that.mapLocationName = address
                        that.mapLocationLongitude = point.longitude
                        that.mapLocationLatitude = point.latitude
                    },
                    function(e) {}
                );
            },
            confirmChangeBtn() {
                var that = this
                if (this.mapLocationName == "") {
                    this.getLocationInfor(this.longitude, this.latitude)
                }
                if (this.regionOrPlace == "工作地点") {
                    this.form.xq = this.mapLocationName
                } else {
                    this.form.address = this.mapLocationName
                }
                uni.request({
                    url: that.$store.state.piAPI + '/jurisdiction/isOnArea',
                    method: 'get',
                    data: {
                        jd: that.mapLocationLongitude,
                        wd: that.mapLocationLatitude
                    },
                    success: (res) => {
                        if (this.regionOrPlace == "工作地点") {
                            this.form.workjurisdiction = res.data.data[0].id
                        } else {
                            this.form.jurisdiction = res.data.data[0].id
                        }
                    }
                });
                this.signLocation = false
            }
        },
        onReady() {
@@ -533,40 +553,6 @@
</script>
<style lang="scss" scoped>
    .login-map-bc {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 111;
        background: rgba(0, 0, 0, .3);
    }
    .login-map-content {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 222;
        border-radius: 15px 15px 0 0;
        overflow: hidden;
        iframe {
            border: none;
        }
    }
    .login-map-close {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 20px;
        height: 20px;
        z-index: 11;
    }
    .warp {
        display: flex;
        align-items: center;
@@ -626,4 +612,55 @@
            color: #103289;
        }
    }
    @keyframes StartJump {
        0% {
            transform: translateY(-22px);
        }
        50% {
            transform: translateY(-32px);
        }
        100% {
            transform: translateY(-22px);
        }
    }
    .dingwBut {
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: auto;
        z-index: 999;
        transform: translateY(-22px);
    }
    .confirmBtn {
        width: 96px;
        height: 36px;
        line-height: 32px;
        position: absolute;
        top: auto;
        left: 0;
        right: 0;
        bottom: 18rpx;
        margin: auto;
        z-index: 999;
        text-align: center;
        background: #103289;
        color: #fff;
        border-radius: 5px;
    }
</style>
static/img/location.png