modal.vue 2.7 KB

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