123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <view class="app-container">
- <view class="code-container" v-if="isShowCode">
- <view class="title">请完成安全验证</view>
- <pt-images-verification ref="verification" :top="codeObj.yHeight" :bgImg="codeObj.bigImage" :maskImg="codeObj.smallImage" :isSuccess="codeObj.isSuccess" :isFail="codeObj.isFail" @refresh="refresh" @finish="finish"></pt-images-verification>
- </view>
- <image v-else :src="imagesUrl" style="width:100%" mode="widthFix"></image>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- imagesUrl:'',
- code: '',
- isShowCode: true,
- codeObj: {
- bigImage: '',
- smallImage: '',
- key: '',
- yHeight: '',
- isSuccess: false,
- isFail: false,
- }
- }
- },
- computed: {
- ...mapState(['userInfo', 'isLogin', 'userId', 'websitData']),
- },
- onLoad() {
- this.init();
- },
- methods: {
- // 获取图片验证码
- init(){
- this.$axios({
- url: '/common/getVerifi',
- method: 'get',
- params: {},
- isLoading: 1
- }).then(res => {
- this.codeObj = res.data;
- })
- },
-
- // 刷新验证码
- refresh(){
- this.isShowCode = true
- this.init()
- },
-
- // 验证结束
- finish(value){
- this.$axios({
- url: '/user/user/detail',
- method: 'get',
- params: {
- userId: this.userId,
- },
- }).then((res) => {
- this.$axios({
- url: '/user/websitUrl',
- params: {
- websitId: res?.data?.adminWebsit?.websitId,
- key: this.codeObj.key,
- vrifyCode: Math.round(value)
- },
- isLoading: 1
- }).then(res => {
- this.imagesUrl = res.data
- this.isShowCode = false
- }).catch(err => {
-
- })
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .app-container {
- background: #F4F2F2;
- box-sizing: border-box;
- }
- .banner {
- image {
- width: 100%;
- }
- }
- .code-container {
- position: fixed;
- top: calc(50vh - 150px);
- left: calc(50vw - 170px);
- z-index: 999;
- background: #FFFFFF;
- padding: 20px;
- border-radius: 10rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .title {
- font-size: 28rpx;
- color: #333333;
- width: 100%;
- text-align: left;
- margin-bottom: 10px;
- }
- .button {
- margin-top: 20px;
- color: #666666;
- width: 200rpx;
- line-height: 60rpx;
- border: 1px solid #eaeaea;
- border-radius: 10rpx;
- text-align: center;
- }
- }
- .main {
- padding: 50rpx;
- .title {
- font-size: 32rpx;
- color: #333333;
- text-align: center;
- }
- .button {
- margin-top: 120rpx;
- width: 100%;
- text-align: center;
- line-height: 88rpx;
- border-radius: 88rpx;
- font-size: 32rpx;
- color: #FFFFFF;
- background: linear-gradient(-90deg,#ff3f42 0%, #fe781f 100%);
- &.disabled {
- background: #C1C1C1;
- }
- }
- .tips {
- font-size: 24rpx;
- color: #FE781F;
- line-height: 24rpx;
- margin-top: 20rpx;
- height: 24rpx;
- margin-left: 10rpx;
- }
- .form {
- margin-top: 60rpx;
- .row {
- &:last-child {
- margin-top: 40rpx;
- display: flex;
- align-items: flex-end;
- .btn {
- width: 180rpx;
- height: 50rpx;
- border-radius: 50rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- color: #FFFFFF;
- background: linear-gradient(-90deg,#ff3f42 0%, #fe781f 100%);
- margin-left: 30rpx;
- &.disabled {
- background: #C1C1C1;
- }
- }
- }
- .row-c {
- height: 60rpx;
- display: flex;
- align-items: center;
- border-bottom: 1px solid #D1D1D1;
- .left {
- width: 140rpx;
- height: 28rpx;
- border-right: 1px solid #D1D1D1;
- font-size: 30rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
- }
- .input {
- width: 100%;
- input {
- font-size: 30rpx;
- width: 100%;
- padding: 0 25rpx;
- box-sizing: border-box;
- }
- }
- }
- }
- }
- }
- </style>
|