123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- <template>
- <view class="top">
- <view class="back-btn cuIcon-back" @click="navBack"></view>
- <!-- 文字 -->
- <view class="top_one">请输入验证码</view>
- <view class="top_two">验证码已发送到<text class="text">{{phone}}</text></view>
- <!-- 六个显示框 -->
- <view class="top_three">
- <view :class="[ !inputList[0]||inputList.length>0 ? 'inb' : '' ]" class="input">
- <text>{{inputList[0]}}</text>
- <view v-if="!inputList[0]" class="fours"></view>
- </view>
- <view :class="[ inputList[0] && !inputList[1]||inputList.length>1 ? 'inb' : '' ]" class="input">
- <text>{{inputList[1]}}</text>
- <view v-if="inputList[0] && !inputList[1]" class="fours"></view>
- </view>
- <view :class="[ inputList[1] && !inputList[2]||inputList.length>2 ? 'inb' : '' ]" class="input">
- <text>{{inputList[2]}}</text>
- <view v-if="inputList[1] && !inputList[2]" class="fours"></view>
- </view>
- <view :class="[ inputList[2] && !inputList[3]||inputList.length>3 ? 'inb' : '' ]" class="input">
- <text>{{inputList[3]}}</text>
- <view v-if="inputList[2] && !inputList[3]" class="fours"></view>
- </view>
- <view :class="[ inputList[3] && !inputList[4]||inputList.length>4 ? 'inb' : '' ]" class="input">
- <text>{{inputList[4]}}</text>
- <view v-if="inputList[3] && !inputList[4]" class="fours"></view>
- </view>
- <view :class="[ inputList[4] && !inputList[5]||inputList.length>5 ? 'inb' : '' ]" class="input">
- <text>{{inputList[5]}}</text>
- <view v-if="inputList[4] && !inputList[5]" class="fours"></view>
- </view>
- </view>
- <!-- 隐藏的input -->
- <view class="top_four">
- <input type="number" class="input_show" maxlength="6" @input='submit' v-model="inputList" focus="true" />
- </view>
- <!-- 重新获取 regain -->
- <view class="top_five" @click='judge' :class="!status ? 'active' : '' "><text v-if="!status">重新发送</text><text
- v-if="status">{{count_down}}秒后重新发送</text></view>
- </view>
- </template>
- <script>
- import helper from '@/common/helper.js';
- export default {
- data() {
- return {
- // 电话
- phone: '',
- // 跟隐藏input绑定的数组
- inputList: [],
- //计时器
- count_down: 60,
- status: false,
- clientId:""
- }
- },
- onLoad(options) {
- // #ifdef APP-PLUS
- this.clientId = uni.getStorageSync("clientId")
- // #endif
-
- console.log("options", options.phone)
- this.phone = options.phone
- console.log("phone:", this.phone);
- if (this.phone) {
- this.regain()
- } else {
- uni.showToast({
- title: '请输入正确的手机号',
- icon: 'none',
- duration: 2000
- })
- }
- },
- methods: {
- navBack() {
- uni.navigateBack();
- },
- judge(){
- if(this.count_down > 0){
- return
- }else{
- this.regain()
- }
- },
- regain() {
- this.count_down = 60
- this.status = true
- // console.log(e)150500
- // 设定一个定时器 1000是1秒的意思
- var interval = setInterval(() => {
- --this.count_down
- }, 1000)
- if (this.count_down == 0) {
- this.status = false
- }
- // 设定一个定时器 60000就是六十秒
- setTimeout(() => {
- this.status = false
- clearInterval(interval) //括号里面的名字要与setInterval定义的相同
- }, 60000)
-
- this.$request.baseRequest('get', '/commonUser/sendVerifyCode', {
- phone: this.phone
- }).then(res => {
- // 获得数据
- if (res.code != 200) {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- }
- console.log(res);
- })
- .catch(res => {
- uni.showToast({
- title: res.errMsg,
- icon: 'none',
- duration: 2000
- })
- });
- },
- submit(e) {
- if (e.detail.value.length == 6) {
- var that = this
- that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
- driverPhone: this.phone,
- }).then(res => {
- if (res.data.authenticationStatus == '已禁用') {
- that.$refs.uToast.show({
- type: 'error',
- message: "账号审核中!"
- })
- return
- }
- uni.showLoading({
- title: '登录中',
- mask: true
- })
- that.$request.baseRequest('get', '/commonUser/loginVerifyCode', {
- phone: this.phone,
- verifyCode: this.inputList,
- loginFlag: 2,
- identification:1,
- cid:this.clientId
- }).then(res => {
- if (res.code == 200) {
- uni.setStorageSync('userInfo', res.data)
- that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
- reCommonId: res.data.id,
- }).then(res3 => {
- if (res3.data) {
- let name = 'myTip';
- let value = res3.data
- if (value == 0) {
- uni.removeTabBarBadge({
- index: 2
- })
- }
- that.$store.commit('$uStore', {
- name,
- value
- });
- if (value != 0 && value) {
- uni.setTabBarBadge({
- index: 2,
- text: value + ""
- })
- }
- }
- })
- uni.setStorageSync("shiro",encodeURIComponent(`ws_login_companySh041500ortName=
- '黑龙江中天昊元贸易有限公司'; ws_login_rememberMe=1; ws_login_account=${that.phone}; ws_login_pwd=${that.password}; shiro.session=65500189-7bb5-457f-9ff6-0db069150e78`))
- uni.setStorageSync('pcuserInfo', res.data)
- uni.setStorageSync('userInfo', res.data)
- uni.setStorageSync('firstAuthentication', res.data)
- helper.getListByUserId()
- that.$store.commit('login', res.data)
- var name = 'userInfo';
- var value = res.data;
- that.$store.commit('$uStore', {
- name,
- value
- });
- uni.switchTab({
- url: '/pages/goodSource/index'
- });
- uni.hideLoading()
- // that.liangxinLogin()
- uni.switchTab({
- url: '/pages/goodSource/index'
- });
- uni.hideLoading()
-
- } else {
- uni.hideLoading()
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- }
- })
- .catch(res => {
- uni.hideLoading()
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- })
- }
- }
- }
- }
- </script>1
- <style>
- .top {
- padding-top: 85px;
- position: relative;
- width: 100vw;
- height: calc(100vh - 85px);
- overflow: hidden;
- background: url('~@/static/images/mine/bg@2x.png');
- background-size: 100%;
- }
- .back-btn {
- position: absolute;
- left: 40upx;
- z-index: 9999;
- padding-top: var(--status-bar-height);
- top: 40upx;
- font-size: 40upx;
- color: $font-color-dark;
- }
- /* 文字 */
- .top_one {
- /* margin-top: 85px; */
- width: 90%;
- height: 90rpx;
- line-height: 90rpx;
- font-size: 44rpx;
- margin: auto;
- font-weight: bold;
- }
- .top_two {
- width: 90%;
- height: 40rpx;
- line-height: 40rpx;
- font-size: 24rpx;
- margin: auto;
- color: #545454;
- }
- .text {
- font-weight: bold;
- }
- /* 六个显示框容器 */
- .top_three {
- width: 80%;
- height: 200rpx;
- margin: auto;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- /* 六个框显示框 */
- .input {
- width: 14%;
- height: 80rpx;
- background-color: #F5F5F5;
- margin-right: 12rpx;
- text-align: center;
- line-height: 80rpx;
- font-size: 50rpx;
- border-radius: 3px;
- color: #181818;
- }
- /* 模拟的焦点 */
- .inb {
- background: #FFFFFF;
- box-shadow: 0px 9px 10px 4px rgba(0, 0, 0, 0.07);
- }
- .fours {
- width: 5rpx;
- height: 40rpx;
- margin: auto;
- background-color: #000000;
- margin-top: 20rpx;
- animation: show .8s linear infinite;
- }
- /* 模拟焦点动画 更改animation以更改动画样式*/
- @keyframes show {
- from {
- background-color: #000000;
- }
- to {
- background-color: #ffffff;
- }
- }
- /* 隐藏的inpit容器 */
- .top_four {
- width: 80%;
- height: 100rpx;
- margin: auto;
- margin-top: -140rpx;
- }
- .input_show {
- width: 100%;
- height: 100rpx;
- border-bottom: 2rpx solid #000000;
- margin: auto;
- opacity: 0;
- background-color: #c6c6c6;
- }
- /* 重新获取 */
- .top_five {
- width: 100%;
- height: 60rpx;
- margin-top: 180rpx;
- text-align: center;
- line-height: 60rpx;
- color: #959595;
- }
- /* 定时器结束的字体样式 */
- .active {
- color: #22C572;
- }
- .button {
- width: 80%;
- height: 100rpx;
- line-height: 100rpx;
- background-color: #5473E8;
- border-radius: 60rpx;
- }
- </style>
|