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

326 lines
6.2 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. <template>
  2. <view class="containers po-r">
  3. <image src="" mode="" class="mainBg"></image>
  4. <view class="w-100 po-a content">
  5. <stepProgress :step="1"></stepProgress>
  6. <view class="bg-fff mt22 form ">
  7. <view class="title fw700 size-30 flex-rowl">
  8. 基本信息
  9. </view>
  10. <dForm ref="formRef" :list="state.list" labelWidth="220rpx" :isFooter="false" @input="onFormInput"></dForm>
  11. </view>
  12. <view class="license__view" v-if="form.license">
  13. <view class="license">
  14. <up-checkbox-group
  15. v-model="licenseData.selected"
  16. shape="circle"
  17. activeColor="#FFBF60"
  18. labelColor="#000000"
  19. labelSize="26rpx"
  20. >
  21. <view class="license-options">
  22. <up-checkbox
  23. v-for="item in LICENSE_OPTIONS"
  24. :key="`license-${item.value}`"
  25. :label="item.label"
  26. :name="item.value"
  27. >
  28. </up-checkbox>
  29. </view>
  30. </up-checkbox-group>
  31. <view class="tips">
  32. 温馨提示上传专业执照将大大增加通过概率且会快速晋升为高级伴宠师获取更高报酬
  33. </view>
  34. <up-upload
  35. :fileList="licenseData.fileList"
  36. @afterRead="afterRead"
  37. @delete="deletePic"
  38. multiple
  39. >
  40. <image src="../static/list/icon-upload.png" style="width: 144rpx;height: 144rpx;"></image>
  41. </up-upload>
  42. </view>
  43. </view>
  44. <view class="bg-fff mt22 form bt120">
  45. <view class="title fw700 size-30 flex-rowl">
  46. 个人宠物类型
  47. </view>
  48. <view class="flex-between wrap mt32">
  49. <view class="type">
  50. <image src="../static/list/cat.png" mode="widthFix" @click="onSelectPet('cat')"></image>
  51. <image class="active" v-if="petType === 'cat'" src="../static/list/cat-active.png" mode="widthFix"></image>
  52. </view>
  53. <view class="type">
  54. <image src="../static/list/dog.png" mode="widthFix" @click="onSelectPet('dog')"></image>
  55. <image class="active" v-if="petType === 'dog'" src="../static/list/dog-active.png" mode="widthFix"></image>
  56. </view>
  57. <view class="type">
  58. <image src="../static/list/special-pet.png" mode="widthFix" @click="onSelectPet('special-pet')"></image>
  59. <image class="active" v-if="petType === 'special-pet'" src="../static/list/special-pet-active.png" mode="widthFix"></image>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="footer-btn" @click="toNext">
  64. <view class="btn">
  65. 下一步
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script setup>
  72. import { ref, reactive } from "vue";
  73. import { ossUpload } from '@/utils/oss-upload/oss/index.js'
  74. import dForm from "@/components/dForm/index.vue"
  75. import stepProgress from '../components/stepProgress.vue';
  76. const state = reactive({
  77. list: [{
  78. type: "input",
  79. label: "姓名",
  80. key: "name",
  81. placeholder: "请输入您的真实姓名",
  82. },
  83. {
  84. type: "input",
  85. label: "身份证号",
  86. key: "idCard",
  87. placeholder: "请输入您的真实身份证号",
  88. },
  89. {
  90. type: "radio",
  91. label: "性别",
  92. key: "sex",
  93. options: [{
  94. name: "男",
  95. value: 0,
  96. },
  97. {
  98. name: "女",
  99. value: 1,
  100. }
  101. ]
  102. },
  103. {
  104. type: "input",
  105. label: "年龄",
  106. key: "gender",
  107. placeholder: "请输入您的年龄",
  108. },
  109. {
  110. type: "input",
  111. label: "养宠经验",
  112. key: "shij",
  113. placeholder: "请输入您的养宠年限",
  114. unit: "年"
  115. },
  116. {
  117. type: "radio",
  118. label: "是否有专业执照",
  119. key: "license",
  120. placeholder: "请选择",
  121. options: [{
  122. name: "是",
  123. value: 1,
  124. }, {
  125. name: "没有",
  126. value: 0,
  127. }]
  128. },
  129. ]
  130. })
  131. const formRef = ref()
  132. const form = ref({})
  133. const onFormInput = (e) => {
  134. form.value = e
  135. }
  136. const licenseData = reactive({
  137. selected: [],
  138. fileList: []
  139. })
  140. const LICENSE_OPTIONS = [
  141. {
  142. label: '兽医职称专业执照',
  143. value: 0,
  144. },
  145. {
  146. label: '宠物美容洗护专业执照',
  147. value: 1,
  148. },
  149. {
  150. label: '宠物康复护理专业执照',
  151. value: 2,
  152. },
  153. {
  154. label: '宠物膳食管理专业执照',
  155. value: 3,
  156. },
  157. {
  158. label: '其他专业执照',
  159. value: 4,
  160. },
  161. ]
  162. const afterRead = (event) => {
  163. event.file.forEach(n => {
  164. ossUpload(n.url)
  165. .then(url => {
  166. licenseData.fileList.push({
  167. url
  168. })
  169. })
  170. })
  171. };
  172. const deletePic = (event) => {
  173. licenseData.fileList.splice(event.index, 1);
  174. };
  175. const petType = ref()
  176. const onSelectPet = (type) => {
  177. petType.value = type
  178. }
  179. const toNext = () => {
  180. // todo: save data
  181. const data = {
  182. ...form.value,
  183. ...licenseData,
  184. petType: petType.value,
  185. }
  186. console.log('--data', data)
  187. uni.navigateTo({
  188. url: "/otherPages/authentication/examination/start"
  189. })
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .bt120 {
  194. margin-bottom: 120rpx;
  195. width: 716rpx;
  196. box-sizing: border-box;
  197. }
  198. .footer-btn {
  199. width: 100vw;
  200. height: 144rpx;
  201. background-color: #fff;
  202. display: flex;
  203. justify-content: center;
  204. position: fixed;
  205. bottom: 0;
  206. left: 0;
  207. align-items: center;
  208. .btn {
  209. font-size: 30rpx;
  210. color: #fff;
  211. display: flex;
  212. justify-content: center;
  213. align-items: center;
  214. width: 574rpx;
  215. height: 94rpx;
  216. border-radius: 94rpx;
  217. background-color: #FFBF60;
  218. }
  219. }
  220. .type {
  221. width: 190rpx;
  222. margin-bottom: 74rpx;
  223. position: relative;
  224. image {
  225. width: 100%;
  226. }
  227. .active {
  228. position: absolute;
  229. top: 0;
  230. left: 0;
  231. }
  232. }
  233. .form {
  234. padding: 40rpx 32rpx;
  235. box-sizing: border-box;
  236. width: 716rpx;
  237. }
  238. .title {
  239. &::before {
  240. content: "";
  241. display: block;
  242. width: 9rpx;
  243. height: 33rpx;
  244. background-color: #FFBF60;
  245. margin-right: 7rpx;
  246. }
  247. }
  248. .mb6 {
  249. margin-bottom: 6rpx;
  250. }
  251. .containers {
  252. .mainBg {
  253. width: 100vw;
  254. height: 442rpx;
  255. background-image: linear-gradient(to bottom, #FFBF60, #f5f5f5);
  256. }
  257. .content {
  258. top: 0;
  259. left: 0;
  260. padding: 16rpx;
  261. }
  262. }
  263. .license__view {
  264. width: 716rpx;
  265. padding-bottom: 40rpx;
  266. box-sizing: border-box;
  267. background-color: #FFFFFF;
  268. .license {
  269. width: 100%;
  270. padding: 13rpx 16rpx;
  271. box-sizing: border-box;
  272. background-color: #FFFCF1;
  273. &-options {
  274. display: grid;
  275. grid-template-columns: repeat(2, 1fr);
  276. }
  277. }
  278. .tips {
  279. margin: 22rpx 0 24rpx 0;
  280. color: #FFBF60;
  281. font-size: 22rpx;
  282. width: 100%;
  283. word-break: break-all;
  284. }
  285. }
  286. </style>