| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view class="my-info-page">
- <!-- 导航区域 -->
- <customNavbarVue title="个人信息" :show-back-btn="true" @back="handleBack"></customNavbarVue>
- <!-- 姓名 -->
- <view class="form-label-input">
- <view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
- <input v-model="data.realName" placeholder="请输入姓名" />
- <icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
- </view>
- <!-- 手机号 -->
- <view class="form-label-input">
- <view class="phone-form-label"><text class="form-label-require">*</text>手机号</view>
- <input v-model="data.userName" placeholder="请输入手机号" />
- <icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
- </view>
- <!-- 证件号 -->
- <view class="form-label-input">
- <view class="phone-form-label" @click="idCardChange">
- <text class="form-label-require">*</text>
- <text v-if="data.idtype ==1">身份证号</text>
- <text v-if="data.idtype ==2">护照号</text>
- <icon @click="idCardChange" class="change-icon">切换</icon>
- </view>
- <input v-model="data.idcard" placeholder="请输入证件号" />
- <icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
- </view>
- <view class="form-label-input">
- <view class="phone-form-label"><text class="form-label-require">*</text>具体地址</view>
- <input v-model="data.juzhuDizhi" placeholder="请输入具体地址" />
- <icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
- </view>
- <button type="default" class="phone-green-btn info-btn" @click="handleUpdate">修改资料</button>
- </view>
- </template>
- <script setup>
- import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
- import * as myApi from "@/api/my.js";
- import {getAliyunPolicy} from "@/api/jiazheng.js"
- import {ref,reactive} from "vue"
- import {onLoad} from "@dcloudio/uni-app"
- import cacheManager from '@/utils/cacheManager.js';
- const defaultImage1 = ref({
- url:'', extname: 'png', name: 'moren.png'
- })
- const imageStyles = ref({
- width: '50rpx',
- height: '50rpx',
- background: 'red'
- });
- const data = reactive({
- from: 'shouye', // my | kaoshi | shouye
- realName: '',
- idcard: '',
- userName: '',
- userId: null,
- jtIcon: '',
- juzhuDizhi: '',
- idtype: 1,
- })
- onLoad((options) => {
- data.from = options.from || 'shouye';
- data.jtIcon= cacheManager.get('projectImg').nav_bar_jt_bottom;
- initPage();
- })
-
- function idCardChange() {
- data.idtype = data.idtype == 1 ? 2 : 1;
- }
- function handleUpdate() {
- let arr = [];
- if (!data.realName) {
- arr.push('姓名');
- }
- if (!data.userName) {
- arr.push('电话');
- }
- if (!data.idcard) {
- arr.push('证件号');
- }
- if (!data.realName || !data.userName||!data.icon||!data.idcard) {
- uni.showToast({
- icon: 'none',
- title: `请完善${arr.join('、')}信息!`
- })
- return;
- }
-
- const opt = {
- juzhuDizhi: data.juzhuDizhi,
- idtype: data.idtype,
- idcard: data.idcard,
- realName: data.realName,
- userId: data.userId,
- userName: data.userName,
- }
- myApi.getMineUpdate(opt).then(res => {
- if (res.data) {
- uni.showToast({
- title: '更新成功'
- })
- handleBack();
- }
- })
- }
- function handleBack() {
- uni.navigateBack()
- }
- function initPage() {
- myApi.getMineUser().then(res => {
- const {juzhuDizhi,idtype,idcard,realName,userName,userId} = res.data;
- data.idtype = res.data.idtype;
- data.idcard = res.data.idcard;
- data.realName = res.data.realName;
- data.userName = res.data.userName;
- data.userId = res.data.userId;
- data.juzhuDizhi = res.data.juzhuDizhi
- })
- }
- </script>
- <style>
- </style>
|