鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
5.7 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="绑定申请" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />
  4. <view class="main">
  5. <view class="card">
  6. <view class="card-header">绑定申请</view>
  7. <view class="form">
  8. <uv-form
  9. ref="form"
  10. :model="form"
  11. :rules="rules"
  12. errorType="toast"
  13. >
  14. <view class="form-item">
  15. <uv-form-item prop="bindId" :customStyle="formItemStyle">
  16. <view class="form-item-label">绑定人ID</view>
  17. <view class="form-item-content">
  18. <view class="flex search">
  19. <uv-search
  20. v-model="keyword"
  21. placeholder="请输入"
  22. color="#181818"
  23. bgColor="transparent"
  24. :showAction="true"
  25. @custom="search"
  26. @search="search"
  27. >
  28. </uv-search>
  29. </view>
  30. </view>
  31. </uv-form-item>
  32. </view>
  33. <view class="form-item" v-for="item in list" :key="item.id">
  34. <view
  35. :class="['flex', 'list-item', item.id === form.id ? 'is-active' : '']"
  36. @click="onSelect(item.id)"
  37. >
  38. <view class="avatar">
  39. <image class="img" :src="item.avatar" mode="scaleToFill"></image>
  40. </view>
  41. <view>
  42. <view class="title">{{ item.name }}</view>
  43. <view class="desc">{{ `ID:${item.id}` }}</view>
  44. </view>
  45. </view>
  46. </view>
  47. </uv-form>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="bottom">
  52. <button class="btn" @click="onSubmit">申请</button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import mixinsList from '@/mixins/list.js'
  58. import formInput from '@/pages_order/components/formInput.vue'
  59. export default {
  60. mixins: [mixinsList],
  61. components: {
  62. formInput,
  63. },
  64. data() {
  65. return {
  66. keyword: '',
  67. queryParams: {
  68. pageNo: 1,
  69. pageSize: 1000,
  70. title: '',
  71. },
  72. // todo
  73. mixinsListApi: '',
  74. form: {
  75. bindId: null,
  76. },
  77. rules: {
  78. 'bindId': {
  79. type: 'string',
  80. required: true,
  81. message: '请选择绑定人',
  82. },
  83. },
  84. formItemStyle: { padding: 0 },
  85. }
  86. },
  87. methods: {
  88. search() {
  89. this.queryParams.title = this.keyword
  90. this.getData()
  91. },
  92. onSelect(bindId) {
  93. this.form.bindId = bindId
  94. },
  95. async onSubmit() {
  96. try {
  97. await this.$refs.form.validate()
  98. const {
  99. bindId,
  100. } = this.form
  101. const params = {
  102. bindId,
  103. userId: this.userInfo.id,
  104. }
  105. await this.$fetch('addBind', params)
  106. uni.showToast({
  107. icon: 'success',
  108. title: '提交成功',
  109. });
  110. setTimeout(() => {
  111. this.$utils.navigateBack()
  112. }, 800)
  113. } catch (err) {
  114. console.log('onSave err', err)
  115. }
  116. },
  117. },
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .page__view {
  122. width: 100vw;
  123. min-height: 100vh;
  124. background: $uni-bg-color;
  125. position: relative;
  126. /deep/ .nav-bar__view {
  127. position: fixed;
  128. top: 0;
  129. left: 0;
  130. }
  131. }
  132. .main {
  133. padding: calc(var(--status-bar-height) + 160rpx) 32rpx calc(env(safe-area-inset-bottom) + 198rpx) 32rpx;
  134. }
  135. .card {
  136. min-height: calc(100vh - (var(--status-bar-height) + 160rpx) - calc(env(safe-area-inset-bottom) + 198rpx));
  137. padding: 40rpx 32rpx;
  138. box-sizing: border-box;
  139. background: #FFFFFF;
  140. border: 2rpx solid #FFFFFF;
  141. border-radius: 32rpx;
  142. &-header {
  143. font-family: PingFang SC;
  144. font-weight: 500;
  145. font-size: 36rpx;
  146. line-height: 1.4;
  147. color: #252545;
  148. }
  149. }
  150. .form {
  151. padding: 8rpx 0 0 0;
  152. &-item {
  153. margin-top: 40rpx;
  154. border-bottom: 2rpx solid #EEEEEE;
  155. &:last-child {
  156. border: none;
  157. }
  158. &-label {
  159. font-family: PingFang SC;
  160. font-weight: 400;
  161. font-size: 26rpx;
  162. line-height: 1.4;
  163. color: #181818;
  164. }
  165. &-content {
  166. }
  167. }
  168. }
  169. .search {
  170. padding: 16rpx 0 8rpx 0;
  171. border-bottom: 2rpx solid #EEEEEE;
  172. /deep/ .uv-search__content {
  173. padding: 0;
  174. }
  175. /deep/ .uv-search__content__icon {
  176. display: none;
  177. }
  178. /deep/ .uv-search__content__input {
  179. margin: 0;
  180. }
  181. /deep/ .uv-search__action {
  182. color: #00A9FF;
  183. }
  184. }
  185. .list-item {
  186. justify-content: flex-start;
  187. column-gap: 24rpx;
  188. padding: 10rpx;
  189. border: 2rpx solid #EEEEEE;
  190. border-radius: 24rpx;
  191. .avatar {
  192. width: 96rpx;
  193. height: 96rpx;
  194. border-radius: 50%;
  195. .img {
  196. width: 100%;
  197. height: 100%;
  198. }
  199. }
  200. .title {
  201. font-size: 32rpx;
  202. font-weight: 600;
  203. color: #000000;
  204. }
  205. .desc {
  206. margin-top: 8rpx;
  207. font-size: 24rpx;
  208. color: #939393;
  209. }
  210. &.is-active {
  211. background: #E9F8FF;
  212. border-color: #00A9FF;
  213. }
  214. }
  215. .bottom {
  216. position: fixed;
  217. left: 0;
  218. bottom: 0;
  219. width: 100vw;
  220. // height: 200rpx;
  221. padding: 32rpx 40rpx;
  222. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  223. background: #FFFFFF;
  224. box-sizing: border-box;
  225. .btn {
  226. width: 100%;
  227. padding: 14rpx 0;
  228. box-sizing: border-box;
  229. font-family: PingFang SC;
  230. font-weight: 500;
  231. font-size: 36rpx;
  232. line-height: 1.4;
  233. color: #FFFFFF;
  234. background: linear-gradient(to right, #21FEEC, #019AF9);
  235. border: 2rpx solid #00A9FF;
  236. border-radius: 41rpx;
  237. }
  238. }
  239. </style>