options.vue 2.1 KB

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