123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <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>
- <view class="detail-box">
- <text class="detail" @click="select = true">{{semester}}</text>
- <!-- 选择学期 -->
- <view class="select-box">
- <u-picker class="picker" :show="select" :closeOnClickOverlay="true" :columns="semesterList" ref="uPicker" @confirm="selectSemester" @cancel="selectCancel"></u-picker>
- <view class="t-icon t-icon-youjiantou" @click="select = true"></view>
- </view>
- </view>
- </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)">
- <view class="item-box">
- <image class="item-avatar" :src="item.avatar"></image>
- <text class="item-text">{{item.name}}</text>
- </view>
- </view>
- </view>
-
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
-
- export default {
- name: "top-box",
- data() {
- return {
-
- show: false,
-
- select: false,
- semesterList:[
- ['19学年上学期','19学年下学期','20学年上学期','20学年下学期']
- ],
-
- };
- },
- computed: {
- ...mapState('m_children', ['childreninfo','semester']),
- ...mapState('m_parent',['parentdetail'])
- },
- methods: {
- ...mapMutations('m_children',['updateChildrenInfo','updateChildrenSemester']),
-
- //学期选择
- selectSemester(e){
- console.log('selectSemester',e)
- uni.$showMsg('切换完成')
- this.updateChildrenSemester(e.value[0])
- this.select = false
- },
- //取消选择
- selectCancel(){
- uni.$showMsg('取消选择')
- this.select = false
- },
-
- //头部孩子选择
- showChildrenList(e){
- console.log('chooseChildren' + e)
- this.show = !this.show
- },
- 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: 22rpx;
- margin-left: 40rpx;
- width: 96rpx;
- height: 96rpx;
- border-radius: 50rpx;
- border: 4rpx solid #FFFFFF;
- box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.2);
- }
- .children-name {
- margin-top: 44rpx;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- .name {
- color: #3B4144;
- font-size: 32rpx;
- margin: 4rpx 0 0 10rpx;
- font-weight: bold;
- }
- .detail-box{
- display: flex;
- .detail {
- color: #2197ef;
- font-weight: bold;
- font-size: 28rpx;
- margin: 10rpx 0rpx 0 10rpx;
- }
- .select-box{
- margin: 10rpx;
- }
- }
- }
- }
- .list-box{
- margin: -120rpx 40rpx 120rpx 30rpx;
- display: flex;
- flex-wrap: wrap;
- .children-item{
- margin: 0 10rpx 0 10rpx;
- .item-box{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .item-avatar{
- width: 90rpx;
- height: 90rpx;
- border-radius: 50rpx;
- border: 4rpx solid #FFFFFF;
- }
- .item-text{
- font-size: 24rpx;
- font-weight: bold;
- color: #6b778d;
- }
- }
- }
- }
- .t-icon{
- width: 40rpx;
- height: 40rpx;
- }
- .picker{
- z-index: 99;
- }
- </style>
|