123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template>
- <view>
- <!-- 头部信息 -->
- <view class="home-topinfo">
- <image class="children-avatar" :src="childreninfo.avatar" @click="showChildrenList"></image>
- <view class="children-name">
- <text class="name">{{childreninfo.name}}</text>
- <text class="detail">{{childreninfo.className}}</text>
- </view>
- </view>
- <!-- 切换孩子 -->
- <view class="list-box" v-show="show">
- <view class="children-item" v-for="(item,index) in parentdetail.childrenList" :key="index" @click="switchChildren(item)">
- <image class="children-avatar-item" :src="item.avatar"></image>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
-
- export default {
- name: "top-box",
- data() {
- return {
- show: false,
- };
- },
- computed: {
- ...mapState('m_children', ['childreninfo']),
- ...mapState('m_parent',['parentdetail'])
- },
- methods: {
- ...mapMutations('m_children',['updateChildrenInfo']),
-
- showChildrenList(e){
- console.log('chooseChildren' + e)
- this.show = true
- },
- switchChildren(item){
- console.log(item);
- this.updateChildrenInfo(item)
- this.show = false
- }
- }
- }
- </script>
- <style lang="scss">
- .home-topinfo {
- height: 400rpx;
- background: linear-gradient(#0080ff, #f1f3f5);
- display: flex;
- justify-content: flex-start;
- align-items: center;
- .children-avatar {
- margin-top: 11px;
- margin-left: 20px;
- width: 48px;
- height: 48px;
- border-radius: 25px;
- border: 2px solid #FFFFFF;
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- }
- .children-name {
- margin-top: 12px;
- margin-left: 10px;
- display: flex;
- flex-direction: column;
- .name {
- color: #6b778d;
- font-size: 15px;
- margin: 2px 0px 0px 5px;
- font-weight: bold;
- }
- .detail {
- color: #3B4144;
- font-weight: bold;
- margin: 5px 0px 0px 5px;
- }
- }
- }
- .list-box{
- margin: -120rpx 20px 60px 15px;
- display: flex;
- flex-wrap: wrap;
- .children-item{
- margin: 0px 5px 0 5px;
- .children-avatar-item{
- width: 48px;
- height: 48px;
- border-radius: 25px;
- border: 2px solid #FFFFFF;
- }
- }
- }
- </style>
|