wjt
2024-06-20 82265520c440140660d9b9a4cb381cf899fc506e
数据看板添加
1个文件已添加
3个文件已修改
241 ■■■■■ 已修改文件
pages.json 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
policy/changePhone/changePhone.vue 199 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
policy/components/mine.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
policy/dataLook/dataLook.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -61,7 +61,14 @@
                    "path" : "changePhone/changePhone",
                    "style" : 
                    {
                        "navigationBarTitleText" : ""
                        "navigationBarTitleText" : "修改手机号"
                    }
                },
                {
                    "path" : "dataLook/dataLook",
                    "style" :
                    {
                        "navigationBarTitleText" : "数据看板"
                    }
                }
            ]
policy/changePhone/changePhone.vue
@@ -1,22 +1,207 @@
<!-- 企业登录 -->
<template>
    <view>
    <view class="companylogin">
        <view class="content-box">
            <view class="form">
                <view class="form-item margin-bottom">
                    <view class="form-label">
                        手机号
                    </view>
                    <view class="form-input">
                        <input type="number"  placeholder="请输入11位手机号"/>
                    </view>
                </view>
                <view class="form-item">
                    <view class="form-label">
                        验证码
                    </view>
                    <view class="form-input set-flex set-flex-content-between">
                        <input type="number" placeholder="请输入验证码"/>
                        <view @click="getCode">
                            <text class="driver"></text>
                            <text class="getcode">{{tips}}</text>
                        </view>
                    </view>
                </view>
            </view>
            <view style="margin-top: 56rpx;">
                <view class="per-button" @click="loging">修改手机号</view>
            </view>
        </view>
    </view>
</template>
<script>
    // 00营商办,01执法,02企业 区分不同的登陆页面
    import { getCode, codeLogin, getInfo } from '@/api/auth.js'
    export default {
        data() {
            return {
                tips: '获取验证码',
                form: {
                    phone: '',
                    code: '',
                    userType: ''
                },
                loginToken: '',
                isSendCode: false,
                countdownTime: 20,
                timer: ''
            }
        },
        onLoad(options) {
            if(options.code) {
                this.form.userType = options.code
            }
        },
        onUnload() {
            if(this.timer) {
                clearTimeout(this.timer)
                this.timer = null
            }
        },
        methods: {
            getCode() {
                if(!this.form.phone){
                    uni.showToast({
                        title: '请输入手机号',
                        icon: 'none'
                    })
                    return
                }
                if(!this.$u.test.mobile(this.form.phone)){
                    uni.showToast({
                        title: '请输入正确的手机号',
                        icon: 'none'
                    })
                    return
                }
                if (!this.isSendCode) {
                    this.isSendCode = true
                    uni.showLoading({
                        title: '正在获取验证码'
                    })
                    getCode({phone: this.form.phone }).then(val => {
                            this.startCountdown()
                            uni.hideLoading();
                            uni.$u.toast('验证码已发送');
                    })
                } else {
                    uni.$u.toast('倒计时结束后再发送');
                }
            },
            startCountdown() {
                if(this.timer) {
                    clearTimeout(this.timer)
                    this.timer = null
                }
                if(this.countdownTime <= 0) {
                    this.tips = "重新获取"
                    this.isSendCode = false
                    this.countdownTime = 20
                    return
                }
                this.timer = setTimeout(() => {
                    this.countdownTime--
                    this.tips = `${this.countdownTime}s后重新获取`
                    this.startCountdown()
                }, 1000)
            },
            loging() {
                codeLogin(this.form).then(val => {
                    if(val.data.token) {
                        this.loginToken = val.data.token
                        uni.setStorageSync('sessionToken', this.loginToken)
                        this.getInfo()
                    }
                })
            },
            getInfo() {
                getInfo().then(val => {
                    console.log(val)
                    uni.setStorageSync('userInfo',  val.data.data)
                    if(this.form.userType == '02') {
                        uni.redirectTo({
                            url:`/pages/companyIndex/companyIndex`
                        })
                    } else if(this.form.userType == '01'){
                        uni.redirectTo({
                            url:`/policy/policyIndex/policyIndex`
                        })
                    }
                })
            },
            goRegister() {
                uni.navigateTo({
                    url: `/pages/registerCompany/registerCompany`
                })
            }
        }
    }
</script>
<style>
</style>
<style scoped lang="scss">
    .companylogin {
        padding-top: 60rpx;
        &>.image-box {
            width: 100%;
            height: 345rpx;
            text-align: center;
            background-color: #111;
            &>image{
                width: 100%;
                height: 345rpx;
            }
        }
        .content-box{
            border-radius: 40rpx 40rpx 0 0;
            padding: 40rpx 32rpx;
            position: relative;
            top: -40rpx;
            background-color: white;
            .form {
                .form-item{
                    .form-label{
                        font-size: 34rpx;
                        margin: 0 0 24rpx 16rpx;
                    }
                    .form-input{
                        background-color: #F7F7F7;
                        padding: 20rpx;
                        border-radius: 20rpx;
                    }
                }
            }
            .margin-bottom{
                margin-bottom: 36rpx;
            }
            .getcode{
                color: #1171E0;
                font-size: 34rpx;
                font-weight: 500;
                width: 20%;
            }
            .driver{
                display: inline-block;
                vertical-align: middle;
                margin-right: 20rpx;
                width: 2rpx;
                height: 48rpx;
                background-color: #C3C6CD;
            }
        }
        .company-register{
            position: fixed;
            bottom: 32rpx;
            left: 50%;
            transform: translateX(-50%);
            padding: 16rpx 46rpx;
            color: #1171E0;
            display: inline-block;
            border-radius: 12rpx;
            border: 2rpx solid #ABD2FF;
            background: #F0F8FF;
        }
    }
</style>
policy/components/mine.vue
@@ -20,10 +20,10 @@
                <text class="label">联系电话</text>
                <text>168****4164</text>
            </view>
            <view class="show-phone-number">
            <view class="show-phone-number" @click="goChangePhone">
                <view class="set-flex">
                    <u-icon name="phone" size="22"></u-icon>
                    <text class="change">修改手机号</text>
                    <text class="change" >修改手机号</text>
                </view>
                <u-icon name="arrow-right"></u-icon>
            </view>
@@ -40,6 +40,13 @@
            return {
                src: ''
            }
        },
        methods: {
            goChangePhone() {
                uni.navigateTo({
                    url: '/policy/changePhone/changePhone'
                })
            }
        }
    }
</script>
policy/dataLook/dataLook.vue
New file
@@ -0,0 +1,22 @@
<template>
    <view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
            }
        },
        methods: {
        }
    }
</script>
<style>
</style>