numberKeyModel.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class="showModel">
  3. <view class="showModel__wrap">
  4. <view class="showModel__header">
  5. 数字密钥
  6. </view>
  7. <view class="content">
  8. <view class="content-tip">请输入数字密钥。</view>
  9. <view class="content-box">
  10. <input class="content-item" v-for="(i, index) in keyArr" :key="index" v-model="i.value"/>
  11. </view>
  12. </view>
  13. <view class="bottom">
  14. <button class="bottom-btn confirm-btn" @click="confirm">确定</button>
  15. <button class="bottom-btn" @click="cancel">取消</button>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. get,
  23. post,
  24. SM
  25. } from "../../http/http.js";
  26. export default {
  27. data() {
  28. return {
  29. };
  30. },
  31. watch: {
  32. },
  33. props: {
  34. keyArr:{
  35. type:Array,
  36. default:[]
  37. }
  38. },
  39. created(){
  40. for(let i of this.keyArr){
  41. i.value = null
  42. }
  43. },
  44. methods: {
  45. confirm(){
  46. for(let i of this.keyArr){
  47. if(!i.value){
  48. uni.showToast({
  49. title: `数字密钥为${this.keyArr.length}位数`,
  50. duration: 1000,
  51. icon:'none'
  52. });
  53. return
  54. }
  55. }
  56. let arr = []
  57. for(let i of this.keyArr){
  58. arr.push(i.value)
  59. }
  60. post(`/dept/check/${arr.join('')}`).then((res) => {
  61. if (res.status == 200) {
  62. this.$emit('confirm',res.data)
  63. }else{
  64. uni.showToast({
  65. title: res.msg,
  66. duration: 1000,
  67. icon:'none'
  68. });
  69. }
  70. });
  71. },
  72. cancel(){
  73. this.$emit('cancel')
  74. },
  75. },
  76. };
  77. </script>
  78. <style lang="less" scoped>
  79. .showModel {
  80. position: fixed;
  81. left: 0;
  82. right: 0;
  83. top: 0;
  84. bottom: 0;
  85. background-color: rgba(0, 0, 0, 0.2);
  86. z-index: 99;
  87. .showModel__wrap {
  88. width: 90%;
  89. position: absolute;
  90. left: 50%;
  91. top: 50%;
  92. transform: translate(-50%, -50%);
  93. background-color: #fff;
  94. border-radius: 12rpx;
  95. .showModel__header {
  96. font-size: 36rpx;
  97. color: #000;
  98. font-weight: bold;
  99. height: 84rpx;
  100. display: flex;
  101. justify-content: center;
  102. align-items: center;
  103. }
  104. .content{
  105. background: #FAFBFD;
  106. border: 1px solid #E6E6E6;
  107. margin-bottom: 20rpx;
  108. .content-tip{
  109. text-align: center;
  110. padding: 50rpx 0 30rpx 0;
  111. font-size: 28rpx;
  112. }
  113. .content-box{
  114. display: flex;
  115. justify-content: space-around;
  116. margin-bottom: 20rpx;
  117. .content-item{
  118. width: 100rpx;
  119. height: 100rpx;
  120. border-radius: 10rpx;
  121. border: 1px solid #CCCCCC;
  122. color: #000;
  123. font-size: 32rpx;
  124. // margin: 0 20rpx;
  125. text-align: center;
  126. }
  127. }
  128. }
  129. .bottom{
  130. border-top: 1px solid #ccc;
  131. display: flex;
  132. uni-button{
  133. border-radius: 0 !important;
  134. background: #fff !important;
  135. }
  136. uni-button:after{
  137. border: none !important;
  138. }
  139. .bottom-btn{
  140. color: #A8A8A8;
  141. font-size: 30rpx;
  142. padding: 20rpx 0;
  143. width: 50%;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. }
  148. .confirm-btn{
  149. color: #5DAC6B;
  150. border-right: 1px solid #ccc;
  151. }
  152. }
  153. }
  154. }
  155. </style>