qingyiay
2023-10-07 21fb37c7162d5b47a14d6438870377c85fcc0b52
pages/driver-page/drvier-my/drvier-my.vue
@@ -1,17 +1,31 @@
<template>
   <view class="driver-my">
      <view class="driver-banner">
         <view class="navgation">我的</view>
         <view class="avatar">
            <view class="avatar-imgage"
               style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/driverava.png')no-repeat;background-size: cover;">
      <view class=""
         style="height: 446rpx;width: 100%;">
         <view class="driver-banner">
            <view class="navgation">我的</view>
            <view class="avatar">
               <view class="avatar-imgage"
                  style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/driverava.png')no-repeat;background-size: cover;">
               </view>
               <view class="avatar-name">{{ userInfo.name || '' }}</view>
               <view class="edit-button"><u-button type="primary"
                     @click="editBtnClick"
                     shape="circle"
                     :disabled="userInfo.isRegister!==2"
                     plain>编辑个人资料</u-button></view>
            </view>
            <view class="avatar-name">{{ userInfo.name || '' }}</view>
            <view class="edit-button"><u-button type="primary"
                  @click="editBtnClick"
                  shape="circle"
                  plain>编辑个人资料</u-button></view>
         </view>
      </view>
      <view class="process-state">
         <view class="state-text">
            审核状态
         </view>
         <u--text :type="userInfo.isRegister===0?'primary':userInfo.isRegister===1?'error':'success'"
            :text="userInfo.isRegister===0?'待审核':userInfo.isRegister===1?'未通过':'已审核'"
            size="32"></u--text>
      </view>
      <view class="information-block">
         <view class="personal-information">
            <view class="personal-information-block">
               <view class="block-main">
@@ -111,13 +125,36 @@
         </view>
      </view>
      <view class="loginout">
         <view class="loginout-main"><u-button text="重置密码"
               type="primary"
               @click="initPwd"
               shape="circle"
               plain></u-button></view>
         <view class="loginout-main"><u-button text="退出登录"
               type="primary"
               @click="logout"
               shape="circle"
               plain></u-button></view>
      </view>
      <!-- 引导页 -->
      <view class="noob-tour"
         style="margin-top: 80rpx;">
         <combined-title title="操作指引"></combined-title>
         <u-cell-group>
            <u-cell title="新手指引"
               name='1'
               :clickable="true"
               @click="noobTour">
               <u-badge type="primary"
                  value="01"
                  slot='icon'></u-badge>
               <u-icon slot="value"
                  name="arrow-right"
                  size="30"
                  color="#b8b8b8"></u-icon>
            </u-cell>
         </u-cell-group>
      </view>
      <!-- 图片预览弹出框 -->
      <view class="previewImage-container">
         <u-popup :show="previewImageShow"
@@ -129,7 +166,12 @@
               height="400px"></u--image>
         </u-popup>
      </view>
      <!-- 引导图片弹出 -->
      <view class="previewImage-container">
         <previewImage ref="previewImage"
            :imgs="driverTourImgList"
            :saveBtn='false'></previewImage>
      </view>
      <!-- 修改弹出框 -->
      <view class="editDriverPopup-container">
         <u-popup :show="editDriverPopupShow"
@@ -152,6 +194,14 @@
                        inputAlign="left"></u--input>
                  </u-form-item>
                  <u-form-item labelWidth="20%"
                     label="密码"
                     prop="password"
                     required>
                     <u--input v-model="editUserInfo.password"
                        border="none"
                        inputAlign="left"></u--input>
                  </u-form-item>
                  <u-form-item labelWidth="20%"
                     label="身份证号"
                     prop="idCard"
                     required>
@@ -167,14 +217,14 @@
                        border="none"
                        inputAlign="left"></u--input>
                  </u-form-item>
                  <u-form-item labelWidth="20%"
                  <!-- <u-form-item labelWidth="20%"
                     label="车牌号"
                     prop="carNo"
                     required>
                     <u--input v-model="editUserInfo.carNo"
                        border="none"
                        inputAlign="left"></u--input>
                  </u-form-item>
                  </u-form-item> -->
                  <u-form-item labelWidth="20%"
                     label="体重"
                     prop="weight"
@@ -238,14 +288,30 @@
            @confirm="logoutConfirm"
            @cancel="logoutCancel"></u-modal>
      </view>
      <view class="initPwdModal">
         <u-modal :show="initPwdShow"
            title="重置密码"
            showCancelButton
            content="初始密码将变更为123456,是否确认重置"
            @confirm="initPwdConfirm"
            @cancel="initPwdCancel"></u-modal>
      </view>
   </view>
</template>
<script>
   import { customerId, userInfo, redirectLogin } from '@/utils/status';
   import { redirectLogin } from '@/utils/status';
   import { BaseUrl } from '@/api/publicInterface.js';
   import { mapMutations } from 'vuex';
   import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue';
   import { mapMutations, mapState } from 'vuex';
   export default {
      components: { previewImage },
      computed: {
         ...mapState(['driverTourImgList']),
         roleType() {
            return uni.getStorageSync('roleType');
         },
      },
      data() {
         return {
            // 获取的司机详情
@@ -262,7 +328,9 @@
               drivingImg: '',
               axleNum: '',
               weight: '',
               userId: ''
               userId: '',
               password: "",
               isRegister: ''
            },
            rules: {
               name: {
@@ -304,8 +372,19 @@
               weight: {
                  type: 'number',
                  required: true,
                  message: '请填写体重',
                  trigger: ['blur', 'change']
                  trigger: ['blur', 'change'],
                  transform(value) {
                     return Number(value);
                  },
                  validator: (rule, value, callback) => {
                     if (!value) {
                        callback(new Error('请填写体重'))
                     } else if (value > 200) {
                        callback(new Error('请填写合理体重'))
                     } else {
                        callback()
                     }
                  }
               },
               carNo: [{
                     type: 'string',
@@ -359,7 +438,9 @@
            logoutShow: false,
            logoutTitle: '提示',
            logoutContent: '是否确认退出',
            BaseUrl
            BaseUrl,
            initPwdShow: false
         };
      },
      onShow() {
@@ -397,6 +478,7 @@
                     this.editUserInfo[item] = res.data[item];
                  }
               });
               this.editUserInfo.password = ''
            });
         },
         // 修改按钮点击
@@ -496,7 +578,8 @@
            this.editUserInfo = {
               ...this.editUserInfo,
               carImg: uni.getStorageSync('carImg'),
               drivingImg: uni.getStorageSync('drivingImg')
               drivingImg: uni.getStorageSync('drivingImg'),
               isRegister: 0
            };
            this.$refs.editRef
               .validate()
@@ -520,6 +603,35 @@
                  this.$u.toast('修改失败');
               });
         },
         initPwd() {
            this.initPwdShow = true
         },
         initPwdConfirm() {
            this.initPwdShow = false
            uni.showLoading({
               title: '加载中...'
            });
            this.editUserInfo.password = '123456';
            this.editUserInfo.carImg = uni.getStorageSync('carImg');
            this.editUserInfo.drivingImg = uni.getStorageSync('drivingImg')
            this.$reqPost('updateUser', this.editUserInfo, 'json').then(res => {
               uni.hideLoading()
               if (res.code == 0) {
                  uni.showToast({
                     title: '重置成功',
                     duration: 2000,
                     icon: 'success'
                  })
               } else {
                  this.$u.toast(res.msg ? res.msg : '修改失败');
               }
            }).catch(err => {
               this.$u.toast('修改失败');
            });
         },
         initPwdCancel() {
            this.initPwdShow = false
         },
         logout() {
            this.logoutShow = true;
         },
@@ -536,7 +648,10 @@
            uni.navigateTo({
               url: '/pages/customer-page/customer-my/faYunstatistics/faYunstatistics'
            });
         }
         },
         noobTour() {
            this.$refs.previewImage.open('https://mx.jzeg.cn:9096/appimg/image/tour/driver/sj1.png')
         },
      }
   };
</script>
@@ -549,15 +664,11 @@
      align-items: center;
   }
   .statistics {
      margin-top: vww(10);
      margin-bottom: vww(10);
   }
   ::v-deep.driver-my {
      width: 100%;
      margin: 0 auto;
      padding-bottom: vww(60);
      padding-bottom: vww(100);
      .driver-banner {
         width: 100%;
@@ -610,13 +721,32 @@
               top: vww(4);
            }
         }
      }
      .process-state {
         width: 300rpx;
         height: 50rpx;
         margin: 0 auto;
         position: fixed;
         top: 284rpx;
         left: 37rpx;
         display: flex;
         align-items: center;
         .state-text {
            margin-right: vww(6);
         }
      }
      .information-block {
         width: 100%;
         .personal-information {
            width: 100%;
            display: flex;
            justify-content: center;
            position: relative;
            top: vww(20);
            top: vww(-30);
            &-block {
               width: 690rpx;
@@ -676,7 +806,6 @@
      .car-information {
         width: 100%;
         position: relative;
         top: vww(410);
         @include flex justify-content: center;
         .information-main {
@@ -720,11 +849,13 @@
      .loginout {
         width: 100%;
         height: 74rpx;
         height: 200rpx;
         @include flex;
         justify-content: center;
         justify-content: space-around;
         flex-direction: column;
         align-items: center;
         position: relative;
         bottom: vww(-430);
         top: vww(20);
         .loginout-main {
            width: 84%;