selectInterview.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container">
  3. <nav-bar :title="title" color="#000"></nav-bar>
  4. <view class="content">
  5. <view class="cell-box">
  6. <view class="cell-title">{{type == 'address'?'面试地点':'姓名'}}</view>
  7. <u-input v-model="address" type="text" :border="true" :placeholder="type == 'address'?'请输入办公大楼名称,例:碧桂园凤凰智谷':'请输入联系人姓名'" />
  8. </view>
  9. <view class="cell-box">
  10. <view class="cell-title">{{type == 'address'?'楼层/单元室':'电话'}}</view>
  11. <div class="input-wrapper">
  12. <u-input v-model="floor" :type="type == 'address'?'text':'number'" :border="true" :placeholder="type == 'address'?'楼层/单元室/门牌号,例:3层302室':'请输入联系人电话'"
  13. @input="handleInput" :maxlength="20" />
  14. <view class="word-count" v-if="type == 'address'">{{ floorLength }}/20</view>
  15. </div>
  16. </view>
  17. </view>
  18. <u-button class="btn" :disabled="!canSave" @click="goBack">保存</u-button>
  19. </view>
  20. </template>
  21. <script>
  22. import navBar from "@/components/nav-bar/index.vue";
  23. export default {
  24. components: {
  25. navBar
  26. },
  27. data() {
  28. return {
  29. title: '面试地址',
  30. id:'',
  31. address: '',
  32. floor: '',
  33. floorLength: 0,
  34. callback: null,
  35. type: ''
  36. };
  37. },
  38. onLoad(options) {
  39. this.type = options.type
  40. if (this.type === 'address') {
  41. this.title = '面试地址'
  42. } else if (this.type === 'addPerson') {
  43. this.title = '添加联系人'
  44. } else if (this.type === 'editPerson') {
  45. this.title = '编辑联系人'
  46. }
  47. const eventChannel = this.getOpenerEventChannel();
  48. this.callback = null;
  49. eventChannel.on('sendData', (data) => {
  50. this.callback = data.callback;
  51. if (data.type === 'editPerson' && data.item) {
  52. this.id = data.item.id
  53. this.address = data.item.name
  54. this.floor = data.item.phone
  55. }
  56. })
  57. },
  58. computed: {
  59. canSave() {
  60. return this.address.trim() !== '' && this.floor.trim() !== '';
  61. }
  62. },
  63. methods: {
  64. handleInput(val) {
  65. this.floorLength = val.length;
  66. },
  67. goBack() {
  68. if (this.callback) {
  69. if (this.type === 'address') {
  70. this.callback({ address: this.address, floor: this.floor })
  71. } else if (this.type === 'addPerson') {
  72. this.callback({ id: Date.now(), name: this.address, phone: this.floor })
  73. } else if (this.type === 'editPerson') {
  74. this.callback({ id: this.id, name: this.address, phone: this.floor })
  75. }
  76. }
  77. uni.navigateBack();
  78. }
  79. }
  80. };
  81. </script>
  82. <style scoped lang="scss">
  83. .container {
  84. display: flex;
  85. flex-direction: column;
  86. height: 100vh;
  87. .content {
  88. flex: 1;
  89. display: flex;
  90. flex-direction: column;
  91. z-index: 0;
  92. padding: 40rpx;
  93. .cell-box {
  94. margin-bottom: 32rpx;
  95. .cell-title {
  96. color: var(--Neutral/100, rgba(31, 44, 55, 1));
  97. font-family: DM Sans;
  98. font-size: 28rpx;
  99. font-weight: 500;
  100. line-height: 44rpx;
  101. letter-spacing: 0.5%;
  102. margin-bottom: 16rpx;
  103. }
  104. .input-wrapper {
  105. position: relative;
  106. .word-count {
  107. position: absolute;
  108. top: 50%;
  109. right: 26rpx;
  110. transform: translateY(-50%);
  111. color: rgba(153, 153, 153, 1);
  112. font-family: DM Sans;
  113. font-size: 24rpx;
  114. font-weight: 500;
  115. line-height: 48rpx;
  116. letter-spacing: 0.5%;
  117. }
  118. }
  119. ::v-deep .uni-input-placeholder {
  120. color: rgba(153, 153, 153, 1);
  121. font-family: DM Sans;
  122. font-size: 24rpx;
  123. font-weight: 500;
  124. line-height: 48rpx;
  125. letter-spacing: 0.5%;
  126. }
  127. ::v-deep .u-input {
  128. height: 70rpx;
  129. box-sizing: border-box;
  130. border: 1px solid rgba(227, 231, 236, 1);
  131. border-radius: 48rpx;
  132. background: rgba(255, 255, 255, 1);
  133. padding: 0 32rpx !important;
  134. box-sizing: border-box;
  135. text-align: left !important;
  136. }
  137. ::v-deep .uni-input-input {
  138. font-family: DM Sans;
  139. font-size: 24rpx !important;
  140. font-weight: 500;
  141. line-height: 48rpx;
  142. letter-spacing: 0.5%;
  143. color: #000 !important;
  144. }
  145. }
  146. }
  147. .btn {
  148. display: flex;
  149. height: 80rpx;
  150. padding: 16rpx 32rpx;
  151. border-radius: 999px;
  152. background: rgba(255, 102, 0, 1);
  153. margin: 60rpx;
  154. color: rgba(255, 255, 255, 1);
  155. font-family: DM Sans;
  156. font-size: 32rpx;
  157. font-weight: 400;
  158. line-height: 48rpx;
  159. letter-spacing: 0%;
  160. box-sizing: border-box;
  161. ::v-deep .u-hairline-border:after {
  162. border: none !important;
  163. }
  164. }
  165. }
  166. </style>