123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view>
- <u-navbar :back-text="i18n('Back')" title-width="300" :back-text-style="backStyle" back-icon-color="#fff"
- title-color="#fff" :background="background" :title="$i18n.locale=='zh'?'更改手机号':'Change mobile number'">
- </u-navbar>
- <view class="Unbundling">
- {{$i18n.locale=='zh'?'请输入新的手机号码,验证码会发送到新手机上':'Please enter a new mobile phone number and the verification code will be sent to the new mobile phone'}}
- </view>
- <view class="Unbundling-input">
- <u-form :model="form" ref="uForm">
- <u-form-item label="" :label-width="120">
- <view class="moblie">
- <view @click="toGR" style="display: inline-block;">
- <text
- style="max-width:106upx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;display: inline-block;vertical-align: middle;">
- {{selectName}}</text>
- <text style="vertical-align: middle;"> ({{'+' + select}})</text>
- </view>
- </view>
- <u-input v-model="form.moblie" :border="true" :placeholder="i18n('EnterMobile')" />
- </u-form-item>
- <u-form-item label="" :label-width="120" style="">
- <u-input v-model="form.validCode" :border="true" :placeholder="i18n('EnterVerification')" />
- <text class="code-send" v-if="showText==true" @click="getCodeFor">{{i18n('GetVerification')}}</text>
- <text v-else class=" code">{{second}}s{{i18n('resend')}}</text>
- </u-form-item>
- </u-form>
- <view class="next">
- <u-button type="primary" @click="update">{{i18n('submit')}}</u-button>
- </view>
- </view>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- import listCell from '@/components/JumpBox';
- import {
- addIntegral
- } from '@/components/addPointDetailByTaskDict'
- export default {
- components: {
- listCell,
- addIntegral
- },
- data() {
- return {
- second: 60,
- showText: true,
- form: {
- moblie: '',
- validCode: '',
- },
- select: '0086',
- selectName: this.$i18n.locale == 'zh' ? '中国' : 'China',
- selectList: '',
- regLogStyle: '3',
- phoneUserNum: "",
- active: '0',
- background: {
- backgroundImage: 'linear-gradient(270deg, #4BC0E2 0%, #538BE7 100%)',
- },
- backStyle: {
- color: '#FFFFFF',
- },
- };
- },
- onLoad(options) {
- this.selectList = options.data ? JSON.parse(options.data) : {};
- this.select = this.selectList.id ? this.selectList.id : this.select;
- let countryName = this.$i18n.locale == 'zh' ? this.selectList.cnValue : this.selectList.enValue;
- this.selectName = countryName ? countryName : this.selectName;
- },
- onShow() {
- },
- methods: {
- toGR() {
- uni.navigateTo({
- url: '/pages/public/GlobalRoaming?regLogStyle=' + this.regLogStyle
- })
- },
- navTo(route) {
- this.$mRouter.push({
- route
- });
- },
- async update() {
- if (!this.form.moblie) {
- this.msg(this.i18n('Mobilephonenumbercannotbeempty'), "warning");
- return;
- }
- if (!this.form.validCode) {
- this.msg(this.i18n('Verificationcodecannotbeempty'), "warning");
- return false;
- }
- this.phoneUserNum = this.select + this.form.moblie;
- const result = await this.$myRequest({
- url: '/uc/securitySetting/updateMobile',
- data: {
- mobile: this.phoneUserNum,
- code: this.form.validCode
- }
- });
- if (result.status == '200') {
- this.msg('绑定成功', "success");
- addIntegral("point_task_bind_phone", "20");
- setTimeout(function() {
- uni.navigateTo({
- url: '/pages/profile/profileSetUp/accountSecurity'
- })
- }, 1500);
- } else {
- if (this.$i18n.locale == 'zh') {
- this.msg(result.msg, "error");
- } else {
- this.msg(
- 'Please confirm that the mobile phone number is not registered and the verification code is entered correctly',
- "error");
- }
- }
- },
- async getCodeFor() {
- if (!this.form.moblie) {
- this.msg(this.i18n('Mobilephonenumbercannotbeempty'), "warning");
- return false;
- }
- let language = this.$i18n.locale;
- this.phoneUserNum = this.select + this.form.moblie;
- //获取验证码信息
- const result = await this.$myRequest({
- url: '/ums/umsUsers/registCode',
- data: {
- account: this.phoneUserNum,
- service: "TX",
- language
- }
- });
- if (result.status == '200') {
- this.msg(this.i18n('Verificationcodehasbeensent'), "success");
- } else {
- this.msg(result.msg, "error");
- }
- this.showText = false
- let interval = setInterval(() => {
- let times = --this.second
- }, 1000)
- setTimeout(() => {
- clearInterval(interval)
- this.second = 60
- this.showText = true
- }, 60000)
- },
- msg(msg, type) {
- if (msg == 'error') {
- msg = this.i18n('ThesystemisbusyPleasetryagainlater') + "!" //系统繁忙,请稍后再试
- }
- return this.$refs.uToast.show({
- title: msg,
- type: type,
- // url: '/pages/user/index'
- })
- },
- i18n(data) {
- return this.$t('common.' + data);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- page,
- body.pages-profile-profileSetUp-setUp uni-page-body {
- background-color: #fff !important;
- .Unbundling {
- margin: 30upx 40upx 40upx 40upx;
- color: #333;
- font-size: 38upx;
- text-align: center;
- }
- .Unbundling-input {
- margin: 0 40upx;
- .getCode {
- margin-left: 20upx;
- color: #0000ff;
- }
- .code-send {
- margin-left: 48upx;
- color: #0000BF;
- }
- .moblie {
- color: #0000BF;
- margin-right: 20upx;
- }
- .next {
- margin-top: 100upx;
- }
- }
- }
- </style>
|