123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <template>
- <view class="page">
- <view class="list_info">
- <view class="name">旧手机号码:</view>
- <view class="item">
- <input type="text" class="input" placeholder="请输入旧手机号码" v-model="mobile1" maxlength="11" />
- </view>
- <view class="name">新手机号码:</view>
- <view class="item">
- <input type="text" class="input" placeholder="请输入新手机号码" v-model="mobile2" maxlength="11" />
- </view>
- <view class="name">验证码:</view>
- <view class="item">
- <input type="text" class="input" placeholder="请输入验证码" v-model="code" maxlength="6" />
- <view class="btn" v-if="captchaTime === 0" @click="getCode">获取验证码</view>
- <view class="btn" v-if="captchaTime > 0">{{captchaTime}}秒后重试</view>
- </view>
- <view class="blankHeight"></view>
- </view>
- <view class="btn_submit" @click="submitData">提交修改</view>
- <DialogBox ref="DialogBox"></DialogBox>
- </view>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- title: '',
- mobile1: '',
- mobile2: '',
- code: '',
- captchaTime: 0,
- }
- },
- onLoad() {},
- onShow() {
- // this.loadData();
- },
- methods: {
- onBack() {},
- chkSel() {
- if (this.sel == 1) {
- this.sel = 0;
- } else {
- this.sel = 1;
- }
- },
- getCodeTime() {
- this.captchaTime = 60;
- let timer = setInterval(() => {
- this.captchaTime--;
- // console.log(this.captchaTime)
- if (this.captchaTime < 1) {
- clearInterval(timer);
- this.captchaTime = 0
- }
- }, 1000)
- },
- getCode() {
- if (this.mobile2.length != 11) {
- uni.showToast({
- title: '请输入新手机号',
- icon: 'none'
- });
- return;
- }
- if (this.captchaTime > 0) {
- uni.showToast({
- title: '不能重复获取',
- icon: 'none'
- });
- return;
- }
- this.captchaTime = 60;
- uni.request({
- url: this.$apiHost + '/Web/getcode', //仅为示例,并非真实接口地址。
- data: {
- skey: this.skey,
- mobile: this.mobile2,
- },
- header: {
- 'content-type': 'application/json' //自定义请求头信息
- },
- success: (res) => {
- console.log("----", res.data)
- uni.showToast({
- title: res.data.str,
- icon: 'none'
- })
- if (res.data.success == 'yes') {
- this.getCodeTime();
- } else {
- this.captchaTime = 0;
- }
- }
- });
- },
- submitData() {
- if (this.mobile1 == "") {
- uni.showToast({
- title: "请输入旧手机号码",
- icon: 'none'
- });
- return;
- }
- if (this.mobile2 == "") {
- uni.showToast({
- title: "请输入新手机号码",
- icon: 'none'
- });
- return;
- }
- if (this.code == "") {
- uni.showToast({
- title: "请输入验证码",
- icon: 'none'
- });
- return;
- }
- uni.request({
- url: this.$apiHost + '/Member/editMobile',
- data: {
- uuid: getApp().globalData.uuid,
- mobile1: this.mobile1,
- mobile2: this.mobile2,
- code: this.code,
- },
- header: {
- 'content-type': 'application/json'
- },
- success: (res) => {
- console.log("----", res.data);
- uni.showToast({
- title: res.data.str,
- icon: 'none'
- });
- if (res.data.success == "yes") {
- }
- }
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- @import 'normal.scss';
- </style>
|