modal.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="modal-view">
  3. <view class="content">
  4. <view class="title">
  5. <text>方案名称</text>
  6. </view>
  7. <!-- <view class="label">
  8. <text>请输入方案的名称</text>
  9. </view> -->
  10. <view class="input-box">
  11. <input
  12. class="input"
  13. maxlength="16"
  14. placeholder="限2~16个字符"
  15. placeholder-style="color: #A1A7B3"
  16. @blur="changeImproveScheme"
  17. />
  18. </view>
  19. <view class="btn-box">
  20. <view class="btn" @click="close">
  21. <text>取消</text>
  22. </view>
  23. <view class="btn" @click="save">
  24. <text>保存</text>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. // 不认可原因
  32. export default {
  33. data() {
  34. return {
  35. // 方案名称
  36. improveScheme: ''
  37. }
  38. },
  39. methods: {
  40. changeImproveScheme(e) {
  41. this.improveScheme = e.detail.value;
  42. this.checkImproveScheme(e.detail.value);
  43. },
  44. // 校验方案名称
  45. checkImproveScheme(name) {
  46. if(name.length < 2 || name.length > 16){
  47. uni.showToast({
  48. title: '限2~16个字符!',
  49. icon: 'none',
  50. duration: 500
  51. });
  52. return true;
  53. }
  54. },
  55. // 保存
  56. save() {
  57. if(this.checkImproveScheme(this.improveScheme)) return;
  58. this.$emit('sure', this.improveScheme);
  59. },
  60. close() {
  61. this.$emit('close');
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="less">
  67. .modal-view {
  68. position: absolute;
  69. top: 0;
  70. right: 0;
  71. bottom: 0;
  72. left: 0;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. background: rgba(18, 20, 26, .5);
  77. .content {
  78. width: 562.5rpx;
  79. border-radius: 15rpx;
  80. background-color: #fff;
  81. overflow: hidden;
  82. .title {
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. height: 95rpx;
  87. font-size: 25rpx;
  88. font-weight: bold;
  89. color: #292C33;
  90. }
  91. .label {
  92. display: flex;
  93. align-items: center;
  94. height: 78.75rpx;
  95. padding-left: 25rpx;
  96. font-size: 22.5rpx;
  97. color: #B8BECC;
  98. }
  99. .input-box {
  100. border-top: 0.62rpx solid #DADEE6;
  101. border-bottom: 0.62rpx solid #DADEE6;
  102. .input {
  103. width: 100%;
  104. min-height: 103.12rpx;
  105. padding: 0 25rpx;
  106. line-height: 26.25rpx;
  107. font-size: 22.5rpx;
  108. color: #525866;
  109. box-sizing: border-box;
  110. }
  111. }
  112. .btn-box {
  113. display: flex;
  114. height: 75rpx;
  115. .btn {
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. flex: 1;
  120. font-size: 22.5rpx;
  121. color: #3377FF;
  122. &:last-child {
  123. background-color: #007AFF;
  124. color: #fff;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. </style>