四零语境前端代码仓库
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.

228 lines
4.9 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="submit-container">
  3. <!-- 主体内容 -->
  4. <view class="main-content">
  5. <!-- 表单卡片 -->
  6. <view class="form-card">
  7. <!-- 标题 -->
  8. <view class="title-section">
  9. <text class="main-title">信息填写</text>
  10. </view>
  11. <!-- 姓名 -->
  12. <view class="form-item">
  13. <text class="form-label">姓名</text>
  14. <uv-input
  15. v-model="formData.name"
  16. placeholder="请输入"
  17. border="bottom"
  18. :custom-style="{
  19. backgroundColor: '#fff',
  20. borderRadius: '12rpx',
  21. paddingLeft: '-24rpx',
  22. fontSize: '32rpx'
  23. }"
  24. ></uv-input>
  25. </view>
  26. <!-- 联系方式 -->
  27. <view class="form-item">
  28. <text class="form-label">联系方式</text>
  29. <uv-input
  30. v-model="formData.phone"
  31. placeholder="请输入"
  32. border="bottom"
  33. :custom-style="{
  34. backgroundColor: '#fff',
  35. paddingLeft: '-24rpx',
  36. fontSize: '32rpx'
  37. }"
  38. ></uv-input>
  39. </view>
  40. <!-- 个人期待 -->
  41. <view class="form-item">
  42. <text class="form-label">个人期待</text>
  43. <uv-textarea
  44. v-model="formData.looking"
  45. placeholder="请输入"
  46. border="bottom"
  47. :auto-height="true"
  48. :custom-style="{
  49. backgroundColor: '#fff',
  50. paddingLeft: '-24rpx',
  51. fontSize: '32rpx',
  52. }"
  53. ></uv-textarea>
  54. </view>
  55. <!-- 文化背景 -->
  56. <view class="form-item">
  57. <text class="form-label">文化背景</text>
  58. <uv-textarea
  59. v-model="formData.background"
  60. placeholder="请输入"
  61. border="none"
  62. :auto-height="true"
  63. :custom-style="{
  64. backgroundColor: '#fff',
  65. paddingLeft: '-24rpx',
  66. fontSize: '32rpx',
  67. }"
  68. ></uv-textarea>
  69. </view>
  70. </view>
  71. </view>
  72. <!-- 底部固定提交栏 -->
  73. <view class="bottom-bar">
  74. <uv-button
  75. type="primary"
  76. text="提交"
  77. :custom-style="{
  78. width: '100%',
  79. height: '82rpx',
  80. borderRadius: '44rpx',
  81. backgroundColor: '#06DADC',
  82. fontSize: '36rpx',
  83. fontWeight: '500',
  84. border: '1px solid #06DADC'
  85. }"
  86. @click="handleSubmit"
  87. ></uv-button>
  88. <uv-safe-bottom></uv-safe-bottom>
  89. </view>
  90. </view>
  91. </template>
  92. <script>
  93. export default {
  94. data() {
  95. return {
  96. formData: {
  97. name: '',
  98. phone: '',
  99. looking: '',
  100. background: '',
  101. linkId: this.linkId
  102. }
  103. }
  104. },
  105. methods: {
  106. async handleSubmit() {
  107. console.log('提交表单', this.formData)
  108. // 这里添加表单提交逻辑
  109. if (!this.formData.name) {
  110. uni.showToast({
  111. title: '请输入姓名',
  112. icon: 'none'
  113. })
  114. return
  115. }
  116. if (!this.formData.phone) {
  117. uni.showToast({
  118. title: '请输入联系方式',
  119. icon: 'none'
  120. })
  121. return
  122. }
  123. try{
  124. const subRes = await this.$api.home.getSignup({
  125. ...this.formData
  126. })
  127. if (subRes.code === 200) {
  128. uni.showToast({
  129. title: '提交成功',
  130. icon: 'success'
  131. })
  132. setTimeout(() => {
  133. uni.navigateBack()
  134. }, 800)
  135. } else {
  136. uni.showToast({
  137. title: subRes.msg,
  138. icon: 'none'
  139. })
  140. }
  141. } catch (error) {
  142. uni.showToast({
  143. title: error.msg,
  144. icon: 'none'
  145. })
  146. }
  147. }
  148. },
  149. onLoad(options) {
  150. this.formData.linkId = options.id
  151. }
  152. }
  153. </script>
  154. <style scoped lang="scss">
  155. .submit-container {
  156. background: #F2F2F2;
  157. min-height: 100vh;
  158. display: flex;
  159. flex-direction: column;
  160. }
  161. .main-content {
  162. flex: 1;
  163. padding: 40rpx 32rpx 120rpx;
  164. }
  165. .form-card {
  166. display: flex;
  167. flex-direction: column;
  168. background: #fff;
  169. margin: 0 18rpx;
  170. height: 732rpx;
  171. border-radius: 32rpx;
  172. padding-top: 40rpx;
  173. padding-right: 32rpx;
  174. padding-bottom: 40rpx;
  175. padding-left: 32rpx;
  176. gap: 44rpx;
  177. // box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  178. .title-section {
  179. // margin-bottom: 40rpx;
  180. .main-title {
  181. font-size: 32rpx;
  182. font-weight: 500;
  183. color: $primary-text-color;
  184. line-height: 1.4;
  185. }
  186. }
  187. }
  188. .form-item {
  189. // margin-bottom: 48rpx;
  190. &:last-child {
  191. margin-bottom: 0;
  192. }
  193. .form-label {
  194. display: block;
  195. font-size: 26rpx;
  196. line-height: 1.4;
  197. color: $primary-text-color;
  198. margin-bottom: 10rpx;
  199. }
  200. }
  201. .bottom-bar {
  202. position: fixed;
  203. bottom: 0;
  204. left: 0;
  205. right: 0;
  206. background: #fff;
  207. padding: 24rpx 50rpx;
  208. z-index: 999;
  209. }
  210. </style>