options.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <top-return></top-return>
  4. <view class="top">
  5. <view class="YS-title" style="color: #4169E1;">选择您的孩子</view>
  6. </view>
  7. <!-- 孩子选择界面 -->
  8. <view class="card-box">
  9. <view class="card" v-for="(item,index) in childrenData" :key="index" @click="chooseChild(item)">
  10. <view class="flex-row" style="width: 100%;">
  11. <view class="front-tag"></view>
  12. <view class="card-title">{{item.name}}</view>
  13. </view>
  14. <view class="avatar-box">
  15. <image class="avatar" :src="item.gender==='M'?'/static/default_icons/boy_avatar.svg':item.gender===null?'/static/default_icons/boy_avatar.svg':'/static/default_icons/girl_avatar.svg'"></image>
  16. </view>
  17. </view>
  18. </view>
  19. <!-- 动画 -->
  20. <view class="ocean"></view>
  21. </view>
  22. </template>
  23. <script>
  24. import {
  25. mapState,
  26. mapMutations
  27. } from 'vuex'
  28. export default {
  29. computed: {
  30. ...mapState('m_parent', ['childrenData'])
  31. },
  32. data() {
  33. return {
  34. };
  35. },
  36. onLoad() {},
  37. methods: {
  38. ...mapMutations('m_children', ['updateChildInfo']),
  39. //选择孩子并跳转首页传入id查询显示孩子信息
  40. async chooseChild(item) {
  41. this.updateChildInfo(item)
  42. await this.$initTab()
  43. uni.switchTab({
  44. url: '/pages/tab_home/tab_home'
  45. })
  46. },
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. @import 'startup_pages.scss';
  52. .card-box {
  53. display: flex;
  54. justify-content: center;
  55. align-items: center;
  56. flex-wrap: wrap; //元素换行
  57. margin: 250rpx 0 0 0;
  58. .card {
  59. width: 280rpx;
  60. height: 280rpx;
  61. margin: 20rpx;
  62. padding: 20rpx;
  63. display: flex;
  64. flex-direction: column;
  65. justify-content: center;
  66. align-items: center;
  67. box-shadow: $box-shadow;
  68. background-color: #FFFFFF;
  69. border-radius: $border-radius;
  70. z-index: 99;
  71. .card-title {
  72. line-height: 35rpx;
  73. font-size: 35rpx;
  74. font-weight: bold;
  75. color: $title;
  76. }
  77. .avatar-box {
  78. padding-top: 10rpx;
  79. .avatar {
  80. width: 240rpx;
  81. height: 240rpx;
  82. }
  83. }
  84. }
  85. }
  86. </style>