123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <view class="children-container">
- <!-- 标题 -->
- <view class="tips">
- <view class="title" v-show="!show">欢迎您的使用</view>
- <view style="font-weight: bold;font-size: 36rpx;color: #b0b0b1;margin-left: 40rpx;margin-top: 20rpx;"
- v-show="!show">醍摩豆家长助您孩子成长</view>
- <view class="title" v-show="show">选择您的孩子</view>
- <view class="detail-image" v-show="!show"></view>
- <button class="detail-button" plain="true" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
- v-show="!show">获取您的孩子信息</button>
- </view>
- <!-- 孩子选择界面 -->
- <view class="children-item" v-show="show">
- <view class="com-box">
- <view class="item" v-for="(item,index) in parentdetail.childrenList" :key="index"
- @click="chooseChildren(item)">
- <view class="item-text">{{item.name}}</view>
- <view class="avatar-box">
- <u-avatar size="120" class="item-avatar" :src="item.avatar" mode="aspectFill"></u-avatar>
- </view>
- </view>
- </view>
- </view>
- <!-- 动画 -->
- <view class="ocean"></view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex'
- //引入解密工具
- import WXBizDataCrypt from "@/utils/WXBizDataCrypt.js";
- export default {
- data() {
- return {
- show: false,
- };
- },
- computed: {
- ...mapState('m_parent', ['parentdetail', 'token']),
- ...mapState('m_children', ['semesterList'])
- },
- onLoad() {
- //判断用户信息
- this.hasParentDetail()
- },
- methods: {
- ...mapMutations('m_children', ['updateChildrenInfo', 'updateChildrenSemester']),
- ...mapMutations('m_parent', ['updateParentInfo', 'updateParentDetail']),
- //选择孩子并跳转首页传入id查询显示孩子信息
- chooseChildren(item) {
- console.log(item.tmdid);
- this.updateChildrenInfo(item)
- //默认学期
- this.updateChildrenSemester(this.semesterList[0][0])
- uni.switchTab({
- url: '/pages/home/home'
- })
- },
- //判断用户基本信息是否存在
- hasParentDetail() {
- if (uni.getStorageSync('parentdetail'))
- this.show = true
- else
- this.show = false
- },
- //获取用户手机号
- async getPhoneNumber(e) {
- if (e.detail.errMsg !== "getPhoneNumber:ok") {
- //用户决绝授权
- return uni.$showMsg('拒绝授权获取不到您的孩子信息!')
- } else {
- if (this.token) {
- let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
- let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
- console.log(numData.phoneNumber)
- // const parentDetailData = await uni.$http.post('',numData.phoneNumber)
- this.updateParentDetail({
- phoneNumber: '17882237075',
- name: '家长姓名',
- childrenList: [{
- avatar: '/static/default-icons/boy.png',
- name: '张三',
- classid: '0301',
- class: '三年级一班',
- tmdid: 'tmdid01',
- schoolname: '研发学校'
- }, {
- avatar: '/static/default-icons/girl.png',
- name: '张梅',
- classid: '0504',
- class: '五年级四班',
- tmdid: 'tmdid03',
- schoolname: '研发学校'
- }, ]
- })
- this.show = true
- }
- }
- },
- }
- }
- </script>
- <style lang="scss">
- .children-container {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- .tips {
- width: 100%;
- display: flex;
- flex-direction: column;
- z-index: 99;
- .title {
- padding-top: 200rpx;
- padding-left: 40rpx;
- line-height: 70rpx;
- font-weight: bold;
- font-size: 50rpx;
- color: #4169E1;
- // background-clip: text; //裁剪成文字的前景色
- // color: transparent; //文字颜色变成透明
- }
- .detail-image {
- margin-top: 80rpx;
- margin-bottom: 20rpx;
- width: 100%;
- height: 500rpx;
- background: $guide-back-base64;
- background-size: cover; //背景图片自适应
- }
- .detail-button {
- line-height: 80rpx;
- height: 80rpx;
- width: 80%;
- font-weight: bold;
- font-size: 36rpx;
- border-radius: 80rpx;
- position: relative;
- margin: 100rpx auto; //relative相对定位居中
- border: none;
- color: #FFFFFF;
- background: linear-gradient(to right, #506AE7, #87CEFA);
- }
- }
- .children-item {
- .com-box {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- flex-wrap: wrap; //元素换行
- margin-top: 60rpx;
- .item {
- margin: 10rpx 20rpx 10rpx 20rpx;
- padding: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- box-shadow: 0 8rpx 16rpx rgba(153, 153, 153, 0.5);
- background-color: #FFFFFF;
- border-radius: 20rpx;
- width: 280rpx;
- height: 300rpx;
- z-index: 99;
- .item-text {
- margin: -7rpx 0 20rpx 20rpx;
- width: 100%;
- line-height: 40rpx;
- font-weight: bold;
- font-size: 35rpx;
- color: #696969;
- }
- .avatar-box {
- .item-avatar {
- width: 220rpx;
- height: 220rpx;
- }
- }
- }
- }
- }
- }
- .ocean {
- display: flex;
- margin-top: -600rpx;
- width: 1800rpx;
- height: 1800rpx;
- background-color: #4169E1;
- border-radius: 50%;
- &::before,
- &::after {
- content: "";
- position: absolute;
- margin-top: 870rpx;
- width: 1600rpx;
- height: 1600rpx;
- top: 0;
- left: 50%;
- border-radius: 43%;
- background-color: #FFFFFF;
- transform: translate(-50%, -70%) rotate(0);
- animation: rotate 6s linear infinite;
- z-index: 2;
- }
- &::after {
- border-radius: 46%;
- background-color: #FFFFFF;
- opacity: 0.7;
- transform: translate(-50%, -70%) rotate(0);
- animation: rotate 10s linear -5s infinite;
- z-index: 3;
- }
- &::after {
- border-radius: 40%;
- background-color: #FFFFFF;
- opacity: 0.5;
- transform: translate(-50%, -70%) rotate(0);
- animation: rotate 10s linear -5s infinite;
- z-index: 3;
- }
- }
- @keyframes rotate {
- 50% {
- transform: translate(-50%, -73%) rotate(180deg);
- }
- 100% {
- transform: translate(-50%, -70%) rotate(360deg);
- }
- }
- </style>
|