123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <view>
- <view class="app" v-if="isFirst && isInput">
- <view class="info-line" >
- <view class="il-top">
- <text>请收入手机号码</text>
- </view>
- <view class="il-bot">
- <input placeholder="输入手机号码" type="number" v-model="form.mobile"/>
- </view>
- </view>
-
-
- <view class="info-line">
- <view class="il-top">
- <text>验证码</text>
- </view>
- <view class="il-code">
- <input placeholder="验证码" type="number" v-model="form.verify" />
- <view class="ilc-btn" v-if="verifyCount == 0" @click="getverifyPhone">获取验证码</view>
- <view class="ilc-no-show" v-else>{{verifyCount}} s</view>
- </view>
- </view>
- <view class="update-btn" @click="tapBind">
- <text>绑定手机</text>
- </view>
- </view>
- <view v-else>
- <view class="top-bg">
- <view class="nav-top fx-h fx-bc">
- <image mode="widthFix" src="/static/img/subproof_success.png" style="width: 40vw;height: 30vw;"></image>
- <view class="title">已经绑定</view>
- </view>
- <view class="fx-h fx-bc fx-ac" style="height: calc(100vh - 350px);">
- <view class="btn" @tap="utils.navigateBack()">返回上一页</view>
- </view>
- </view>
-
-
- </view>
-
-
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- export default {
- computed: mapState(['user']),
- data() {
- return {
- form:{},
- verifyCount: 0,
- isInput : false,
- isFirst : false
- }
- },
- onLoad(options) {
- this.initView();
- },
- methods: {
- initView:function(){
- if(this.user.mobile != '') {
- this.isInput = false;
- } else {
- this.isInput = true;
- }
- this.isFirst = true;
- },
- getverifyPhone: function() {
- if (this.verifyCount > 0) return;
- uni.showLoading({
- title: "获取中..."
- });
-
- if(!this.utils.isPoneAvailable(this.form.mobile)) {
- uni.showToast({title: "请输入正确的手机号码",mask: true,icon: 'none'});
- return;
- }
-
- this
- .request
- .post("bindYzm", { mobile : this.form.mobile })
- .then(res => {
- uni.hideLoading();
- if (res.code == 200) {
- if (res.data.status == 2) {
- this.utils.CountDowm(res.data.time, (e, s) => {
- this.verifyCount = e;
- });
- }
- if (res.data.status == 1) {
- this.utils.CountDowm(120, (e, s) => {
- this.verifyCount = e;
- });
- }
- } else {
- uni.showToast({
- title: res.msg,
- mask: true,
- icon: 'none'
- });
- }
- })
- .catch(err => {
- uni.showToast({
- title: '获取失败',
- mask: true,
- icon: 'none'
- });
- uni.hideLoading();
- });
- },
- /**
- * 提交数据
- */
- tapBind:function(){
-
- if(this.form.mobile == ''){
- this.utils.Tip("请输入手机号码");
- return;
- }
-
- if(!this.utils.isPoneAvailable(this.form.mobile)) {
- uni.showToast({title: "请输入正确的手机号码",mask: true,icon: 'none'});
- return;
- }
-
- if(this.form.verify == ''){
- this.utils.Tip("请输入验证码");
- return;
- }
-
- this.utils.loadIng("提交中..");
- this
- .request
- .post("bindPhone",this.form)
- .then(res=>{
- uni.hideLoading();
- if(res.code == 200) {
- this.utils.Tip(res.msg,()=>{
- uni.navigateBack();
- });
- }else{
- this.utils.Tip(res.msg);
- }
- }).catch(function(){
- uni.hideLoading();
- this.utils.Tip("网络错误,请稍后尝试");
- });
-
- },
-
- },
- }
- </script>
- <style>
- page {
- background: #F5F5F5;
- }
- #box {
- padding-top: 90px;
- z-index: -1;
- }
- .info-line {
- height: 80px;
- padding: 0 15px;
- background-color: #fff;
- border-top: 1px #f5f5f5 solid;
- }
- .il-top {
- color: #333;
- font-size: 14px;
- margin-top: 10px;
- }
- .il-bot {
- margin-top: 10px;
- }
- .il-bot input {
- width: 100%;
- height: 100%;
- font-size: 13px;
- }
- .update-btn {
- width: 90%;
- height: 40px;
- text-align: center;
- line-height: 40px;
- margin: 30px auto;
- background: #db292b;
- color: #fff;
- border-radius: 100px;
- font-size: 16px;
- }
- .il-code {
- display: flex;
- align-items: center;
- margin-top: 10px;
- }
- .il-code input {
- width: 50%;
- height: 100%;
- font-size: 13px;
- }
- .ilc-btn {
- width: 90px;
- height: 30px;
- text-align: center;
- line-height: 30px;
- margin-left: auto;
- font-size: 12px;
- background: #db292b;
- color: #fff;
- border-radius: 100px;
- }
- .ilc-no-show {
- width: 90px;
- height: 30px;
- text-align: center;
- line-height: 30px;
- margin-left: auto;
- font-size: 12px;
- background: #eee;
- color: #999;
- border-radius: 100px;
- }
-
-
- .top-bg{position: relative;margin-top: 50px;}
- .nav-top{color: #e02e22;padding-top: 20px;}
- .nav-top .title{font-size: 40rpx;margin-top: 20px;}
- .nav-top .title-tag{font-size: 24rpx;color: #ffffff;margin-top: 24rpx;}
- .top-bg .btn{width: 290rpx;height:90rpx;border: solid 2px #e02e22;font-size: 32rpx;color: #e02e22;border-radius: 40px;text-align: center;line-height: 90rpx;}
- </style>
|