shuishen
2022-02-21 69ae4c5a2836be71ce81ad0a33343d864a8ffba0
注册
1 files modified
206 ■■■■ changed files
pages/registerUser/registerUser.vue 206 ●●●● patch | view | raw | blame | history
pages/registerUser/registerUser.vue
@@ -1,9 +1,9 @@
<template>
    <view class="registerUser">
        <u-form :model="form" ref="uForm">
            <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img"
            <u-form-item :label="item.title" :prop="item.froms" label-width="200" :left-icon="item.img"
                :required="item.requireds" v-for="(item, index) in list" :key="index">
                <u-input v-model="form[item.froms]" :placeholder="item.placeholder" />
                <u-input v-model="form[item.froms]" :placeholder="item.placeholder" :type="item.type" />
            </u-form-item>
            <u-form-item label="角色" prop="role" left-icon="account-fill" label-width="200" :required="true">
                <u-input v-model="form.role" type="select" placeholder="请选择角色" :border="true" @click="depl" />
@@ -15,8 +15,9 @@
                <u-input v-model="form.obj" placeholder="请输入工作单位" />
            </u-form-item>
            <u-form-item label="辖区" prop="xq" left-icon="account-fill" label-width="200" :required="true">
                <u-input v-model="form.xq" type="select" placeholder="请选择辖区" :border="true" @click="openLoginMap" />
                <!-- <u-select v-model="showxq" mode="mutil-column-auto" :list="listxq" @confirm="confirmxq"></u-select> -->
                <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="性别" label-width="200" left-icon="man">
                <u-radio-group v-model="form.sex">
@@ -138,6 +139,7 @@
                    },
                    {
                        title: '密码',
                        type: 'password',
                        img: 'lock-fill',
                        froms: 'pass',
                        requireds: true,
@@ -145,6 +147,7 @@
                    },
                    {
                        title: '确认密码',
                        type: 'password',
                        img: 'lock-fill',
                        froms: 'passTwo',
                        requireds: true,
@@ -287,7 +290,7 @@
                roleList: [{
                        label: '群众',
                        value: "1416225849858883585"
                    },{
                    }, {
                        label: '民警',
                        value: "1417092295132561409"
                    },
@@ -320,52 +323,69 @@
                        value: "1416225906918195201"
                    }
                ],
                region: [{
                        label: '民警',
                        value: 1417092295132561409
                regionList: [{
                        label: '东湖区',
                        value: '1415619841521414145'
                    },
                    {
                        label: '治保会队伍',
                        value: 1424615693403414529
                        label: '西湖区',
                        value: '1415619917295710209'
                    },
                    {
                        label: '内保干部队伍',
                        value: 1424615773594312705
                        label: '青云谱区',
                        value: '1415619986417840129'
                    },
                    {
                        label: '治安巡防队伍',
                        value: 1424615835435130881
                        label: '湾里区',
                        value: '1415620058526314497'
                    },
                    {
                        label: '信息员队伍',
                        value: 1424615909959524354
                        label: '青山湖区',
                        value: '1415620118307729409'
                    },
                    {
                        label: '保安员队伍',
                        value: 1424615972718895106
                        label: '新建区',
                        value: '1415620188289691649'
                    },
                    {
                        label: '警务辅助队伍',
                        value: 1424616047083905026
                        label: '南昌县',
                        value: '1415620235718881282'
                    },
                    {
                        label: '平安志愿者',
                        value: 1494565079268491266
                        label: '安义县',
                        value: '1415620288487419906'
                    },
                    {
                        label: '进贤县',
                        value: '1415620344112279553'
                    },
                    {
                        label: '经济技术开发区区',
                        value: '1415620404103409666'
                    },
                    {
                        label: '红谷滩区',
                        value: '1415620472965492738'
                    },
                    {
                        label: '高新技术开发区',
                        value: '1415620707473223681'
                    }
                ]
                ],
                regionShow: false
            };
        },
        onShow() {
            let that = this
            uni.$on('updateDataRegionName', function(data) {
                that.regionName = data
                that.form.xq = that.regionName
            })
        },
        methods: {
            regionClick() {
                this.regionShow = true;
            },
            regionSelect() {
                this.form.xq = e[0].label
                this.form.xqobjId = e[0].value
                this.regionShow = false;
            },
            handleMessage(name) {
                console.log(name)
                if (name.indexOf('区') != -1) {
                    that.regionName = name.replace('区', '派出所');
                } else if (name.indexOf('县') != -1) {
@@ -373,8 +393,6 @@
                } else if (name.indexOf('市') != -1) {
                    that.regionName = name.replace('市', '市派出所');
                }
            },
            zc() {
                var that = this;
@@ -396,7 +414,7 @@
                            return
                        }
                        var that = this;
                        var d = that.form;
                        var url = that.$store.state.piAPI + '/zc/inster',
@@ -408,10 +426,10 @@
                                sex: d.sex == '男' ? 1 : 2,
                                sname: d.name,
                                username: d.user,
                                deptid:d.objId,
                                parentId:d.jsid,
                                jurisdiction:d.xqobjId,
                                cardid:d.carId
                                deptid: d.objId,
                                parentId: d.jsid,
                                jurisdiction: d.xqobjId,
                                cardid: d.carId
                            }
                        uni.request({
                            url: url,
@@ -420,112 +438,23 @@
                            success: (res) => {
                                uni.showToast({
                                    title: '注册成功,请等待审核',
                                    icon:'none',
                                    icon: 'none',
                                    duration: 2000
                                });
                                setTimeout(function(){
                                setTimeout(function() {
                                    uni.navigateTo({
                                        url: '/pages/loging/loging'
                                    })
                                },2000);
                                }, 2000);
                            }
                        });
                        // that.$refs.uForm.validate(valid => {
                        //     if (valid) {
                        //         var d = that.form;
                        //         uni.navigateTo({
                        //             url: '/pages/registerUser/idphoto?data= ' +
                        //                 encodeURIComponent(JSON.stringify(
                        //                     d))
                        //         });
                        //     }
                        // });
                    }
                });
            },
            depl() {
                var that = this;
                that.show = true;
            },
            // depl() {
            //     var that = this;
            //     uni.request({
            //         url: that.$store.state.piAPI + "/blade-system/dept/trees",
            //         method: 'get',
            //         success: (res) => {
            //             var routerArr = res.data.data;
            //             var arr = that.formatRoutes(routerArr);
            //             var list = [];
            //             if (that.deptXb != "") {
            //                 list.push(arr[that.deptXb]);
            //                 for (var i = 0; i < list.length; i++) {
            //                     list[i].children.unshift({
            //                         label: '--请选择--',
            //                         value: 0,
            //                         children: []
            //                     })
            //                     for (var j = 0; j < list[i].children.length; j++) {
            //                         list[i].children[j].children.unshift({
            //                             label: '--请选择--',
            //                             value: 0,
            //                         })
            //                     }
            //                 }
            //                 that.listbm = list;
            //                 that.show = true;
            //             } else {
            //                 uni.showToast({
            //                     title: '请选择角色',
            //                     icon: "none",
            //                     duration: 1000
            //                 });
            //             }
            //         }
            //     })
            // },
            deplxq() {
                var that = this;
                uni.request({
                    url: that.$store.state.piAPI + "/jurisdiction/tree",
                    method: 'get',
                    success: (res) => {
                        var routerArr = res.data.data;
                        var arr = that.formatRoutes(routerArr);
                        var list = [];
                        list.push(arr);
                        for (var i = 0; i < arr.length; i++) {
                            arr[i].children.unshift({
                                label: '--请选择--',
                                value: 0,
                                children: []
                            })
                            for (var j = 0; j < arr[i].children.length; j++) {
                                arr[i].children[j].children.unshift({
                                    label: '--请选择--',
                                    value: 0,
                                })
                            }
                        }
                        that.listxq = arr;
                        that.showxq = true;
                    }
                })
            },
            confirmxq(e) {
                var arr = "";
                var data = [];
                for (var i = 0; i < e.length; i++) {
                    if (e[i].value != "0") {
                        arr += e[i].value + ",";
                        data.push(e[i]);
                    }
                }
                var obj = arr.substr(0, arr.length - 1);
                this.form.xq = data[data.length - 1].label;
                this.form.xqobjId = obj;
                console.log(obj)
                this.show = true;
            },
            formatRoutes(routerArr) {
                var that = this;
@@ -558,19 +487,6 @@
                    arr.push(obj);
                })
                return arr;
            },
            startRecord() {
                this.flag = true;
                // this.$message.success('开始录制')
                this.$refs.video.startRecord();
            },
            stopRecord() {
                this.flag = false;
                // this.$message.success('请看控制台视频文件的base64')
                this.$refs.video.stopRecord();
            },
            dataChange(data) {
                console.log(data);
            },
            // 选中任一radio时,由radio-group触发
            radioGroupChange(e) {