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

359 lines
7.1 KiB

3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <!-- <div>宠物信息页 </div> -->
  3. <view class="box">
  4. <view class="top box-size">
  5. <view class="form-title">
  6. 宠物头像
  7. </view>
  8. <view class="img">
  9. <image :src="petInfo.headImage" mode="" style="width: 157rpx;height: 157rpx;"
  10. :style="{borderRadius:'100rpx'}"></image>
  11. <!-- <view >
  12. 点击更换头像
  13. <view class="top_item">
  14. <image src="/static/images/tabBar/Group 1000001460@2x.png" mode=""
  15. style="width: 55rpx;height: 55rpx;" :style="{borderRadius:'50rpx'}"></image>
  16. </view>
  17. </view> -->
  18. </view>
  19. </view>
  20. <view class="information">
  21. <view class="form-title">
  22. 宠物基本信息
  23. </view>
  24. <view class="information_item box-size margin_top_3%">
  25. <view class="level name box-size pad_4">
  26. 昵称
  27. <!-- <input type="text" placeholder="请输入宠物名字" /> -->
  28. <view class="item_">
  29. {{ petInfo.nickName }}
  30. </view>
  31. </view>
  32. <view class="line1">
  33. </view>
  34. <view class="level name box-size pad_4">
  35. 性别
  36. <!-- <view>
  37. <up-picker :show="show" :columns="columns"></up-picker>
  38. <up-button @click="show = true">请选择</up-button>
  39. </view> -->
  40. <view class="item_">
  41. {{ petInfo.sex == 0 ? '男' : '女' }}
  42. </view>
  43. </view>
  44. <view class="line1">
  45. </view>
  46. <view class="level name box-size pad_4">
  47. 品种
  48. <view class="item_">
  49. {{ petInfo.type }}
  50. </view>
  51. </view>
  52. <view class="line1">
  53. </view>
  54. <view class="level name box-size pad_4">
  55. 出生年月
  56. <view class="item_">
  57. {{ petInfo.birthday }}
  58. </view>
  59. </view>
  60. <view class="line1">
  61. </view>
  62. <view class="level name box-size pad_4">
  63. 体重
  64. <view class="item_">
  65. {{ petInfo.weight }}
  66. </view>
  67. </view>
  68. <view class="line1">
  69. </view>
  70. <view class="level name box-size pad_4">
  71. 性格
  72. <view class="item_">
  73. {{ petInfo.personality }}
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="information">
  79. <view class="form-title">
  80. 宠物健康情况
  81. </view>
  82. <view class="information_item box-size margin_top_3% item">
  83. <view class="level name box-size pad_4">
  84. 疫苗
  85. <!-- <input type="text" placeholder="请输入宠物名字" /> -->
  86. <view class="item_">
  87. <!-- 有免疫史 -->
  88. {{ vaccineText }}
  89. </view>
  90. </view>
  91. <view class="line1">
  92. </view>
  93. <view class="level name box-size pad_4">
  94. 驱虫
  95. <!-- <view>
  96. <up-picker :show="show" :columns="columns"></up-picker>
  97. <up-button @click="show = true">请选择</up-button>
  98. </view> -->
  99. <view class="item_">
  100. {{ dewormText }}
  101. <!-- 未驱虫 -->
  102. </view>
  103. </view>
  104. <view class="line1">
  105. </view>
  106. <view class="level name box-size pad_4">
  107. 绝育
  108. <view class="item_">
  109. {{ neuteredText }}
  110. <!-- 已绝育 -->
  111. </view>
  112. </view>
  113. <view class="line1">
  114. </view>
  115. <view class="level name box-size pad_4">
  116. 健康
  117. </view>
  118. </view>
  119. </view>
  120. <view class="container box-size">
  121. <view class="container_item level">
  122. <view class="icon" :style="{borderRadius:'30rpx'}">
  123. <!-- <up-icon name="checkbox-mark" color="#FFFFFF" size="40"></up-icon> -->
  124. </view>
  125. 身体健康无异常
  126. </view>
  127. <view class="container_item level">
  128. <view class="icon_" :style="{borderRadius:'30rpx'}">
  129. <!-- <up-icon name="checkbox-mark" color="#FFFFFF" size="40"></up-icon> -->
  130. </view>
  131. 近三个月有做过手术
  132. </view>
  133. <view class="bottom box-size" :style="{borderRadius:'8rpx'}">
  134. 右腿骨折右眼有轻微白内障
  135. </view>
  136. </view>
  137. </view>
  138. </template>
  139. <script setup>
  140. import {
  141. ref,
  142. reactive,
  143. computed,
  144. } from "vue"
  145. import {
  146. onLoad,
  147. onShow
  148. } from '@dcloudio/uni-app'
  149. import {
  150. getByPetId
  151. } from "@/api/pet/index.js"
  152. import { getDictList } from "@/api/system/user"
  153. onLoad((options) => {
  154. petId.value = options.id || null;
  155. });
  156. onShow(() => {
  157. getPetDetail()
  158. })
  159. const vaccineText = computed(() => {
  160. const vaccineMap = {
  161. 0: '每年都免疫',
  162. 1: '有免疫史',
  163. 2: '未免疫'
  164. };
  165. return vaccineMap[petInfo.value.vaccine] || ''
  166. });
  167. const dewormText = computed(() => {
  168. const dewormMap = {
  169. 0: '未驱虫',
  170. 1: '定期驱虫',
  171. 2: '有驱虫史'
  172. };
  173. return dewormMap[petInfo.value.deworm] || ''
  174. });
  175. const neuteredText = computed(() => {
  176. const neuteredMap = {
  177. 0: '已绝育',
  178. 1: '未绝育'
  179. };
  180. return neuteredMap[petInfo.value.neutered] || ''
  181. });
  182. const petCartText = computed(() => {
  183. const petCartMap = {
  184. 0: '是',
  185. 1: '否'
  186. };
  187. return petCartMap[petInfo.value.petCard] || ''
  188. });
  189. const petId = ref(null);
  190. const petInfo = ref({})
  191. const getPetDetail = async () => {
  192. if (!petId.value) return;
  193. let response = await getByPetId({
  194. id: petId.value
  195. })
  196. if (response.code == 200 && response.data) {
  197. petInfo.value = response.data;
  198. }
  199. }
  200. function getDictListInfo(){
  201. getDictList('')
  202. }
  203. </script>
  204. <style lang="scss">
  205. .box {
  206. width: 100vw;
  207. height: 100vh;
  208. .top {
  209. width: 100vw;
  210. height: 300rpx;
  211. background-color: #FFFFFF;
  212. padding: 0 1%;
  213. .img {
  214. width: 165rpx;
  215. height: 165rpx;
  216. // background-color: pink;
  217. color: #7D8196;
  218. font-size: 28rpx;
  219. margin: 1% 39%;
  220. display: grid;
  221. jplace-items: center;
  222. // position: relative;
  223. // .top_item {
  224. // position: absolute;
  225. // top: 100rpx;
  226. // left: 100rpx;
  227. // }
  228. }
  229. }
  230. .item {
  231. height: 360rpx !important;
  232. }
  233. .information {
  234. width: 100vw;
  235. height: auto;
  236. background-color: #FFFFFF;
  237. margin-top: 17rpx;
  238. padding: 0 1%;
  239. .information_item {
  240. width: 100vw;
  241. height: 550rpx;
  242. font-size: 30rpx;
  243. display: grid;
  244. justify-content: space-around;
  245. .item_ {
  246. width: auto;
  247. height: 40rpx;
  248. }
  249. .name {
  250. width: 100vw;
  251. height: 40rpx;
  252. justify-content: space-between;
  253. // .name input {
  254. // width: 50rpx;
  255. // background-color: #FFFFFF;
  256. // }
  257. }
  258. // .sex {
  259. // width: 200rpx;
  260. // height: 40rpx;
  261. // background-color: #7D8196;
  262. // }
  263. .line1 {
  264. position: relative;
  265. margin-bottom: 30rpx;
  266. &::before {
  267. position: absolute;
  268. top: 5rpx;
  269. left: 17rpx;
  270. content: "";
  271. width: 706rpx;
  272. height: 0.5rpx;
  273. background-color: #EFEFEF;
  274. // background-color: red;
  275. }
  276. }
  277. }
  278. }
  279. .container {
  280. width: 100vw;
  281. height: 500rpx;
  282. background-color: #FFF4E4;
  283. padding: 3% 3% 5% 5%;
  284. font-size: 30rpx;
  285. .container_item {
  286. width: auto;
  287. height: 40rpx;
  288. margin-bottom: 20rpx;
  289. .icon {
  290. width: 40rpx;
  291. height: 40rpx;
  292. background-color: #FFBF60;
  293. margin-right: 15rpx;
  294. }
  295. .icon_ {
  296. width: 38rpx;
  297. height: 38rpx;
  298. border: 1rpx solid gray;
  299. background-color: #FFF;
  300. margin-right: 15rpx;
  301. }
  302. }
  303. .bottom {
  304. width: 680rpx;
  305. height: 80rpx;
  306. background-color: #FFFFFF;
  307. padding-left: 2%;
  308. border: 1rpx solid #FFBF60;
  309. line-height: 80rpx;
  310. }
  311. }
  312. }
  313. .box-size {
  314. box-sizing: border-box;
  315. }
  316. .level {
  317. display: flex;
  318. }
  319. .pad_4 {
  320. padding: 0 4%;
  321. }
  322. .margin_top_3 {
  323. margin-top: 3%;
  324. }
  325. </style>