fund.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="switch-roles">
  3. <nav-bar title="福利待遇" color="#000"></nav-bar>
  4. <view class="roles-content">
  5. <view class="content">
  6. <view class="title">福利待遇</view>
  7. <view class="check-box">
  8. <textarea
  9. v-model="text"
  10. placeholder="请详细描述公司的福利待遇"
  11. maxlength="500"
  12. @input="onInput"
  13. class="textarea"
  14. ></textarea>
  15. <view class="word-count">
  16. <text>{{ text ? text.length : 0 }}</text> /500</view
  17. >
  18. </view>
  19. <view class="fund-box">
  20. <view
  21. class="fund-item"
  22. :class="{ 'fund-check': checkList.includes(index) }"
  23. v-for="(item, index) in fundList"
  24. :key="index"
  25. @click="checkFund(index)"
  26. >
  27. {{ item }}
  28. </view>
  29. </view>
  30. <view class="fund-desc-txt">已选{{ checkList.length }}个</view>
  31. </view>
  32. </view>
  33. <view class="submit-btn" @click="goBack">确定</view>
  34. </view>
  35. </template>
  36. <script>
  37. import navBar from "@/components/nav-bar/index.vue";
  38. export default {
  39. data() {
  40. return {
  41. fundList: [
  42. "五险一金",
  43. "定期体检",
  44. "年终奖",
  45. "带薪年假",
  46. "员工旅游",
  47. "节日福利",
  48. "绩效",
  49. "零食下午茶",
  50. ],
  51. text: "",
  52. checkList: [],
  53. };
  54. },
  55. components: {
  56. navBar,
  57. },
  58. onLoad(options) {
  59. if (options.text) {
  60. this.text = options.text;
  61. }
  62. },
  63. methods: {
  64. onInput(e) {
  65. // console.log(e);
  66. // 如果需要额外的输入控制
  67. // this.text = e.detail.value;
  68. },
  69. goBack() {
  70. uni.navigateBack();
  71. },
  72. checkFund(index) {
  73. const currentIndex = this.checkList.indexOf(index);
  74. if (currentIndex > -1) {
  75. // 如果已选中,移除
  76. this.checkList.splice(currentIndex, 1);
  77. } else {
  78. // 如果未选中,添加
  79. this.checkList.push(index);
  80. }
  81. },
  82. },
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .switch-roles {
  87. background-color: #fff;
  88. position: absolute;
  89. left: 0;
  90. right: 0;
  91. top: 0;
  92. bottom: 0;
  93. display: flex;
  94. flex-direction: column;
  95. .roles-content {
  96. width: 100%;
  97. flex: 1;
  98. overflow: hidden;
  99. overflow-y: auto;
  100. .content {
  101. padding: 40rpx;
  102. box-sizing: border-box;
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. justify-content: center;
  107. .title {
  108. color: #333;
  109. width: 100%;
  110. font-family: DM Sans;
  111. font-size: 40rpx;
  112. font-weight: 600;
  113. }
  114. .check-box {
  115. width: 100%;
  116. border-radius: 12rpx;
  117. background: rgba(240, 240, 240, 1);
  118. padding: 34rpx;
  119. padding-top: 40rpx;
  120. box-sizing: border-box;
  121. margin: 20rpx 0;
  122. .word-count {
  123. font-family: DM Sans;
  124. font-size: 20rpx;
  125. font-weight: 400;
  126. line-height: 26rpx;
  127. text-align: right;
  128. text {
  129. color: #016bf6;
  130. }
  131. }
  132. }
  133. }
  134. }
  135. .submit-btn {
  136. flex-shrink: 0;
  137. border-radius: 999px;
  138. box-shadow: 0px 2px 4px 0px rgba(9, 196, 116, 0.3);
  139. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  140. color: rgba(255, 255, 255, 1);
  141. font-family: DM Sans;
  142. font-size: 32rpx;
  143. font-weight: 400;
  144. line-height: 48rpx;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. padding: 16rpx 32rpx;
  149. box-sizing: border-box;
  150. margin: 60rpx 20rpx;
  151. }
  152. }
  153. .fund-desc-txt {
  154. color: #016bf6;
  155. font-family: DM Sans;
  156. font-size: 20rpx;
  157. font-weight: 400;
  158. line-height: 26rpx;
  159. width: 100%;
  160. margin-top: 8rpx;
  161. }
  162. .fund-box {
  163. display: flex;
  164. align-items: center;
  165. flex-wrap: wrap;
  166. gap: 8rpx;
  167. .fund-item {
  168. flex-shrink: 0;
  169. box-sizing: border-box;
  170. border: 1rpx solid rgba(255, 102, 0, 1);
  171. border-radius: 8rpx;
  172. padding: 8rpx;
  173. color: #016bf6;
  174. font-family: DM Sans;
  175. font-size: 16rpx;
  176. font-weight: 400;
  177. text-align: left;
  178. }
  179. .fund-check {
  180. background: #fce9dc;
  181. border-color: #fce9dc;
  182. }
  183. }
  184. ::v-deep .textarea-placeholder {
  185. color: rgba(153, 153, 153, 1);
  186. font-family: DM Sans;
  187. font-size: 20rpx !important;
  188. font-weight: 400;
  189. line-height: 26rpx;
  190. }
  191. ::v-deep .uni-textarea-textarea {
  192. font-size: 20rpx;
  193. }
  194. </style>