猫妈狗爸伴宠师小程序前端代码
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.

225 lines
3.9 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <!-- <div>创建宠物档案</div> -->
  3. <view class="box">
  4. <view class="top box-size">
  5. <view class="title">
  6. 宠物头像
  7. </view>
  8. <view class="img">
  9. <image src="/static/images/ydd/profile.png" mode="" style="width: 157rpx;height: 157rpx;"
  10. :style="{borderRadius:'100rpx'}"></image>
  11. <view class="">
  12. 点击更换头像
  13. <view class="top_item">
  14. <image src="/static/images/ydd/photograph.png" mode="" style="width: 55rpx;height: 55rpx;"
  15. :style="{borderRadius:'50rpx'}"></image>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="base-info box-size">
  21. <view class="information">基本信息(必填)</view>
  22. <view class="information_">
  23. <DForm :list="state.list" @submit="handleSubmit" />
  24. </view>
  25. </view>
  26. <view class="base-info box-size">
  27. <view class="information">其他信息(非必填)</view>
  28. <view class="information_">
  29. <DForm :list="nostate.list" @submit="nohandleSubmit" />
  30. </view>
  31. </view>
  32. <view class="bottom box-size level">
  33. <view class="delet level" :style="{borderRadius:'12rpx'}">
  34. 删除
  35. </view>
  36. <view class="save level" :style="{borderRadius:'12rpx'}">
  37. 保存
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <script setup>
  43. import {
  44. reactive
  45. } from "vue";
  46. import DForm from "@/components/dForm/index.vue"
  47. const state = reactive({
  48. list: [{
  49. type: "input",
  50. label: "昵称 ",
  51. key: "name",
  52. placeholder: "请输入宠物名字",
  53. },
  54. {
  55. type: "select",
  56. label: "类别",
  57. key: "category",
  58. placeholder: "请选择",
  59. options: [{
  60. name: "猫咪"
  61. },
  62. {
  63. name: "狗狗"
  64. }
  65. ]
  66. },
  67. {
  68. type: "select",
  69. label: "性别",
  70. key: "sex",
  71. placeholder: "请选择",
  72. options: [{
  73. name: "男生"
  74. },
  75. {
  76. name: "女生"
  77. }
  78. ]
  79. },
  80. {
  81. type: "select",
  82. label: "品种",
  83. key: "variety",
  84. placeholder: "请选择",
  85. options: [{
  86. name: "男生"
  87. },
  88. {
  89. name: "女生"
  90. }
  91. ]
  92. },
  93. {
  94. type: "select",
  95. label: "体重",
  96. key: "variety",
  97. placeholder: "请选择",
  98. options: [{
  99. name: "小型(<10KG)"
  100. },
  101. {
  102. name: "中型(10~20KG)"
  103. },
  104. {
  105. name: "大型(20KG以上)"
  106. }
  107. ]
  108. }
  109. ]
  110. })
  111. const nostate = reactive({
  112. list: [{
  113. type: "select",
  114. label: "生日",
  115. key: "birthday",
  116. placeholder: "请选择",
  117. options: [{
  118. name: "猫咪"
  119. },
  120. {
  121. name: "狗狗"
  122. }
  123. ]
  124. },
  125. {
  126. type: "input",
  127. label: "性格",
  128. key: "character ",
  129. placeholder: "请描述",
  130. },
  131. {
  132. type: "select",
  133. label: "疫苗",
  134. key: "sex",
  135. placeholder: "请选择",
  136. options: [{
  137. name: "每年都免疫"
  138. },
  139. {
  140. name: "有免疫史"
  141. },
  142. {
  143. name: "未免疫"
  144. }
  145. ]
  146. },
  147. {
  148. type: "select",
  149. label: "驱虫",
  150. key: "variety",
  151. placeholder: "请选择",
  152. options: [{
  153. name: "未驱虫"
  154. },
  155. {
  156. name: "定期驱虫"
  157. },
  158. {
  159. name: "有驱虫史"
  160. }
  161. ]
  162. },
  163. {
  164. type: "select",
  165. label: "绝育",
  166. key: "variety",
  167. placeholder: "请选择",
  168. options: [{
  169. name: "未绝育"
  170. },
  171. {
  172. name: "已绝育"
  173. }
  174. ]
  175. },
  176. {
  177. type: "select",
  178. label: "健康",
  179. key: "variety",
  180. placeholder: "请选择(多选)",
  181. options: [{
  182. name: "小型(<10KG)"
  183. },
  184. {
  185. name: "中型(10~20KG)"
  186. },
  187. {
  188. name: "大型(20KG以上)"
  189. }
  190. ]
  191. }
  192. ]
  193. })
  194. const handleSubmit = (val) => {
  195. console.log("获取参数", val)
  196. }
  197. const nohandleSubmit = (val) => {
  198. console.log("获取参数", val)
  199. }
  200. </script>
  201. <style scoped lang="scss">
  202. @import"index.css";
  203. .line1 {
  204. position: relative;
  205. margin-bottom: 30rpx;
  206. &::before {
  207. position: absolute;
  208. top: 5rpx;
  209. left: 0;
  210. content: "";
  211. width: 670rpx;
  212. height: 0.5rpx;
  213. // background-color: #EFEFEF;
  214. background-color: red;
  215. }
  216. }
  217. </style>