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

229 lines
4.9 KiB

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. id: this.id
  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. id: this.id
  127. })
  128. if (subRes.code === 200) {
  129. uni.showToast({
  130. title: '提交成功',
  131. icon: 'success'
  132. })
  133. setTimeout(() => {
  134. uni.navigateBack()
  135. }, 800)
  136. } else {
  137. uni.showToast({
  138. title: subRes.msg,
  139. icon: 'none'
  140. })
  141. }
  142. } catch (error) {
  143. uni.showToast({
  144. title: error.msg,
  145. icon: 'none'
  146. })
  147. }
  148. }
  149. },
  150. onLoad(options) {
  151. this.linkId = options.id
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .submit-container {
  157. background: #F2F2F2;
  158. min-height: 100vh;
  159. display: flex;
  160. flex-direction: column;
  161. }
  162. .main-content {
  163. flex: 1;
  164. padding: 40rpx 32rpx 120rpx;
  165. }
  166. .form-card {
  167. display: flex;
  168. flex-direction: column;
  169. background: #fff;
  170. margin: 0 18rpx;
  171. height: 732rpx;
  172. border-radius: 32rpx;
  173. padding-top: 40rpx;
  174. padding-right: 32rpx;
  175. padding-bottom: 40rpx;
  176. padding-left: 32rpx;
  177. gap: 44rpx;
  178. // box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  179. .title-section {
  180. // margin-bottom: 40rpx;
  181. .main-title {
  182. font-size: 32rpx;
  183. font-weight: 500;
  184. color: $primary-text-color;
  185. line-height: 1.4;
  186. }
  187. }
  188. }
  189. .form-item {
  190. // margin-bottom: 48rpx;
  191. &:last-child {
  192. margin-bottom: 0;
  193. }
  194. .form-label {
  195. display: block;
  196. font-size: 26rpx;
  197. line-height: 1.4;
  198. color: $primary-text-color;
  199. margin-bottom: 10rpx;
  200. }
  201. }
  202. .bottom-bar {
  203. position: fixed;
  204. bottom: 0;
  205. left: 0;
  206. right: 0;
  207. background: #fff;
  208. padding: 24rpx 50rpx;
  209. z-index: 999;
  210. }
  211. </style>