chakanyyzz.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="app-container">
  3. <view class="code-container" v-if="isShowCode">
  4. <view class="title">请完成安全验证</view>
  5. <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>
  6. </view>
  7. <image v-else :src="imagesUrl" style="width:100%" mode="widthFix"></image>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. mapState
  13. } from 'vuex';
  14. export default {
  15. data() {
  16. return {
  17. imagesUrl:'',
  18. code: '',
  19. isShowCode: true,
  20. codeObj: {
  21. bigImage: '',
  22. smallImage: '',
  23. key: '',
  24. yHeight: '',
  25. isSuccess: false,
  26. isFail: false,
  27. }
  28. }
  29. },
  30. computed: {
  31. ...mapState(['userInfo', 'isLogin', 'userId', 'websitData']),
  32. },
  33. onLoad() {
  34. this.init();
  35. },
  36. methods: {
  37. // 获取图片验证码
  38. init(){
  39. this.$axios({
  40. url: '/common/getVerifi',
  41. method: 'get',
  42. params: {},
  43. isLoading: 1
  44. }).then(res => {
  45. this.codeObj = res.data;
  46. })
  47. },
  48. // 刷新验证码
  49. refresh(){
  50. this.isShowCode = true
  51. this.init()
  52. },
  53. // 验证结束
  54. finish(value){
  55. this.$axios({
  56. url: '/user/user/detail',
  57. method: 'get',
  58. params: {
  59. userId: this.userId,
  60. },
  61. }).then((res) => {
  62. this.$axios({
  63. url: '/user/websitUrl',
  64. params: {
  65. websitId: res?.data?.adminWebsit?.websitId,
  66. key: this.codeObj.key,
  67. vrifyCode: Math.round(value)
  68. },
  69. isLoading: 1
  70. }).then(res => {
  71. this.imagesUrl = res.data
  72. this.isShowCode = false
  73. }).catch(err => {
  74. })
  75. });
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. .app-container {
  82. background: #F4F2F2;
  83. box-sizing: border-box;
  84. }
  85. .banner {
  86. image {
  87. width: 100%;
  88. }
  89. }
  90. .code-container {
  91. position: fixed;
  92. top: calc(50vh - 150px);
  93. left: calc(50vw - 170px);
  94. z-index: 999;
  95. background: #FFFFFF;
  96. padding: 20px;
  97. border-radius: 10rpx;
  98. display: flex;
  99. flex-direction: column;
  100. align-items: center;
  101. .title {
  102. font-size: 28rpx;
  103. color: #333333;
  104. width: 100%;
  105. text-align: left;
  106. margin-bottom: 10px;
  107. }
  108. .button {
  109. margin-top: 20px;
  110. color: #666666;
  111. width: 200rpx;
  112. line-height: 60rpx;
  113. border: 1px solid #eaeaea;
  114. border-radius: 10rpx;
  115. text-align: center;
  116. }
  117. }
  118. .main {
  119. padding: 50rpx;
  120. .title {
  121. font-size: 32rpx;
  122. color: #333333;
  123. text-align: center;
  124. }
  125. .button {
  126. margin-top: 120rpx;
  127. width: 100%;
  128. text-align: center;
  129. line-height: 88rpx;
  130. border-radius: 88rpx;
  131. font-size: 32rpx;
  132. color: #FFFFFF;
  133. background: linear-gradient(-90deg,#ff3f42 0%, #fe781f 100%);
  134. &.disabled {
  135. background: #C1C1C1;
  136. }
  137. }
  138. .tips {
  139. font-size: 24rpx;
  140. color: #FE781F;
  141. line-height: 24rpx;
  142. margin-top: 20rpx;
  143. height: 24rpx;
  144. margin-left: 10rpx;
  145. }
  146. .form {
  147. margin-top: 60rpx;
  148. .row {
  149. &:last-child {
  150. margin-top: 40rpx;
  151. display: flex;
  152. align-items: flex-end;
  153. .btn {
  154. width: 180rpx;
  155. height: 50rpx;
  156. border-radius: 50rpx;
  157. display: flex;
  158. align-items: center;
  159. justify-content: center;
  160. font-size: 24rpx;
  161. color: #FFFFFF;
  162. background: linear-gradient(-90deg,#ff3f42 0%, #fe781f 100%);
  163. margin-left: 30rpx;
  164. &.disabled {
  165. background: #C1C1C1;
  166. }
  167. }
  168. }
  169. .row-c {
  170. height: 60rpx;
  171. display: flex;
  172. align-items: center;
  173. border-bottom: 1px solid #D1D1D1;
  174. .left {
  175. width: 140rpx;
  176. height: 28rpx;
  177. border-right: 1px solid #D1D1D1;
  178. font-size: 30rpx;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. flex-shrink: 0;
  183. }
  184. .input {
  185. width: 100%;
  186. input {
  187. font-size: 30rpx;
  188. width: 100%;
  189. padding: 0 25rpx;
  190. box-sizing: border-box;
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. </style>