123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <template>
- <view>
- <!-- 头部信息 -->
- <view class="home-topinfo">
- <!-- 更新时间戳 -->
- <view class="refresh-time"
- :style="'top:'+ capsuleBottom + 'px;left:'+ capsuleMiddle + 'px;'+'width:'+capsuleWidth+ 'px'">
- <text class="time-text">更新于: {{timeStamp}}</text>
- <!-- 订阅版本 -->
- <button class="estate" :style="{backgroundImage:`url(${backgroundImage})`}" @click="navSubscribe">{{myData.subscribeLevel}}</button>
- </view>
- </view>
- <view style="display: flex;margin-top: -450rpx;
- margin-bottom: 120rpx;">
- <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="setSemesterPicker = true">{{semester}}</text>
- <!-- 选择学期 -->
- <view class="select-icon">
- <u-icon name="arrow-down" color="#FFF" @click="setSemesterPicker = true"></u-icon>
- </view>
- </view>
- </view>
- </view>
- <u-picker class="picker" :show="setSemesterPicker" :closeOnClickOverlay="true" :columns="semesterList"
- ref="uPicker" @confirm="pickerConfirm" @cancel="pickerCancel" :immediateChange="true"></u-picker>
- <!-- 切换孩子 -->
- <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",
- props: {
- timeStamp: {
- type: String,
- default: false
- }
- },
- watch:{
- setSemesterPicker(newValue){
- if(newValue === true){
- uni.hideTabBar({})
- }
- if(newValue === false){
- uni.showTabBar({})
- }
- }
- },
- created() {
- this.$getCapsuleSite()
- },
- data() {
- return {
- setSemesterPicker: false,
- //胶囊坐标
- capsuleBottom: 0,
- capsuleMiddle: 0,
- capsuleWidth: 0,
- //订阅背景图片
- backgroundImage: 'https://tse1-mm.cn.bing.net/th/id/OIP-C.Vg_hgwLC0hRD46zTHmCD8wHaHr?pid=ImgDet&rs=1',
- };
- },
- computed: {
- ...mapState('m_children', ['childreninfo', 'semester', 'semesterList']),
- ...mapState('m_parent', ['parentdetail', 'myData'])
- },
- methods: {
- ...mapMutations('m_children', ['updateChildrenInfo', 'updateChildrenSemester']),
- //学期选择
- pickerConfirm(e) {
- //拼接图表数据
- this.updateChildrenSemester(e.value[0])
- uni.$showMsg('切换完成', 1000)
- this.setSemesterPicker = false
- },
- //取消选择
- pickerCancel() {
- uni.$showMsg('取消选择', 1000)
- this.setSemesterPicker = false
- },
- //头部孩子选择
- showChildrenList(e) {
- this.show = !this.show
- },
- switchChildren(item) {
- this.updateChildrenInfo(item)
- this.show = false
- },
- //订阅页面
- navSubscribe(){
- uni.navigateTo({
- url: '/subpkg/subscribecenter/subscribecenter'
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .home-topinfo {
- height: 600rpx;
- background: linear-gradient($color-blue, $page-background-color);
- }
- .children-avatar {
- margin-left: 40rpx;
- width: 100rpx;
- height: 100rpx;
- border-radius: 100%;
- border: 4rpx solid #FFFFFF;
- box-shadow: 0 10rpx 20rpx rgba(0, 0, 0, 0.2);
- }
- .children-name {
- margin-left: 25rpx;
- padding-top: 5rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- .name {
- color: #3B4144;
- font-size: 36rpx;
- font-weight: bold;
- }
- .detail-box {
- display: flex;
- .detail {
- color: #FFFFFF;
- font-weight: bold;
- font-size: 30rpx;
- }
- .select-icon {
- margin: 7rpx 0 0 10rpx;
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- .refresh-time {
- height: auto;
- position: relative;
- display: flex;
- flex-direction: column;
- .time-text {
- margin: 0 auto;
- font-size: 24rpx;
- color: #FFFFFF;
- font-weight: bold;
- }
- .estate {
- margin: 5rpx auto;
- font-size: 22rpx;
- line-height: 40rpx;
- height: 40rpx;
- width: 100%;
- color: #FFFFFF;
- font-weight: bold;
- border-radius: 20rpx;
- border: none;
- background-size: cover;
- background-repeat: no-repeat;
- }
- }
- .list-box {
- margin: -100rpx 40rpx 120rpx 33rpx;
- 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;
- }
- </style>
|