114 lines
2.6 KiB
Plaintext
114 lines
2.6 KiB
Plaintext
<template>
|
|
<view style="margin: 20rpx 40rpx;">
|
|
<up-form labelPosition="left" labelWidth='90' :model="data" ref="form1">
|
|
<up-form-item v-if="data.phone" label="手机号:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
|
<up-input inputAlign='right' v-model="data.phone" readonly='true' border="none"></up-input>
|
|
</up-form-item>
|
|
<up-form-item :label="data.phone? '新手机号':'手机号'" prop="userInfo.name" :borderBottom="true" ref="item1">
|
|
<up-input inputAlign='right' v-model="data.newPhone" placeholder="请输入手机号" border="none"></up-input>
|
|
</up-form-item>
|
|
|
|
<up-form-item label="验证码:" prop="userInfo.name" :borderBottom="true" ref="item1">
|
|
<up-input inputAlign='right' type='number' v-model="data.code" clearable='true' placeholder="请输入验证码"
|
|
border="none">
|
|
<template #suffix>
|
|
<up-code ref="uCodeRef" @change="codeChange" seconds="60" changeText="X秒重新获取"></up-code>
|
|
<up-button @tap="getCode" :text="tips" type="success" size="mini"></up-button>
|
|
</template>
|
|
</up-input>
|
|
</up-form-item>
|
|
|
|
</up-form>
|
|
<view class="" style="margin-top: 20rpx;">
|
|
<button @click="save()" class="logout-btn"> {{ data.phone?'修改手机号':'添加手机号' }} </button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { onShow, onLoad } from "@dcloudio/uni-app";
|
|
import { ref } from "vue";
|
|
import { Service } from "../../Service/Service";
|
|
|
|
|
|
|
|
|
|
let data = ref({
|
|
realPhone: '',
|
|
phone: '',
|
|
code: '',
|
|
newPhone: ''
|
|
})
|
|
|
|
|
|
let tips = ref('')
|
|
const uCodeRef = ref(null);
|
|
|
|
onLoad((data : any) => {
|
|
getData()
|
|
});
|
|
|
|
onShow(() => {
|
|
|
|
});
|
|
|
|
const getData = () => {
|
|
}
|
|
|
|
|
|
|
|
// 验证码
|
|
const codeChange = (text) => {
|
|
tips.value = text;
|
|
};
|
|
|
|
const getCode = () => {
|
|
|
|
// if(data.value.phone===data.value.newPhone && data.value.phone ){
|
|
// Service.Msg('新手机号不能与原手机号相同')
|
|
// return
|
|
// }
|
|
// if(!data.value.newPhone){
|
|
// Service.Msg('请填写手机号')
|
|
// return
|
|
// }
|
|
|
|
|
|
if (uCodeRef.value.canGetCode) {
|
|
// 模拟向后端请求验证码
|
|
uni.showLoading({
|
|
title: '正在获取验证码',
|
|
});
|
|
|
|
} else {
|
|
uni.$u.toast('倒计时结束后再发送');
|
|
}
|
|
};
|
|
|
|
const change = (e) => {
|
|
console.log('change', e);
|
|
};
|
|
|
|
const save = () => {
|
|
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
background-color: #fff;
|
|
}
|
|
|
|
.logout-btn {
|
|
background-color: var(--nav-mian);
|
|
color: #fff;
|
|
font-weight: 500;
|
|
border-radius: 10rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
font-size: 30rpx;
|
|
margin: 0;
|
|
border: none;
|
|
}
|
|
</style> |