guide.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="children-container">
  3. <!-- 标题 -->
  4. <view class="tips">
  5. <view class="title" v-show="!show">欢迎您的使用</view>
  6. <view style="font-weight: bold;font-size: 36rpx;color: #b0b0b1;margin-left: 40rpx;margin-top: 20rpx;"
  7. v-show="!show">醍摩豆家长助您孩子成长</view>
  8. <view class="title" v-show="show">选择您的孩子</view>
  9. <view class="detail-image" v-show="!show"></view>
  10. <button class="detail-button" plain="true" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
  11. v-show="!show">获取您的孩子信息</button>
  12. </view>
  13. <!-- 孩子选择界面 -->
  14. <view class="children-item" v-show="show">
  15. <view class="com-box">
  16. <view class="item" v-for="(item,index) in parentdetail.childrenList" :key="index"
  17. @click="chooseChildren(item)">
  18. <view class="item-text">{{item.name}}</view>
  19. <view class="avatar-box">
  20. <u-avatar size="120" class="item-avatar" :src="item.avatar" mode="aspectFill"></u-avatar>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 动画 -->
  26. <view class="ocean"></view>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. mapState,
  32. mapMutations
  33. } from 'vuex'
  34. //引入解密工具
  35. import WXBizDataCrypt from "@/utils/WXBizDataCrypt.js";
  36. export default {
  37. data() {
  38. return {
  39. show: false,
  40. };
  41. },
  42. computed: {
  43. ...mapState('m_parent', ['parentdetail', 'token']),
  44. ...mapState('m_children', ['semesterList'])
  45. },
  46. onLoad() {
  47. //判断用户信息
  48. this.hasParentDetail()
  49. },
  50. methods: {
  51. ...mapMutations('m_children', ['updateChildrenInfo', 'updateChildrenSemester']),
  52. ...mapMutations('m_parent', ['updateParentInfo', 'updateParentDetail']),
  53. //选择孩子并跳转首页传入id查询显示孩子信息
  54. chooseChildren(item) {
  55. console.log(item.tmdid);
  56. this.updateChildrenInfo(item)
  57. //默认学期
  58. this.updateChildrenSemester(this.semesterList[0][0])
  59. uni.switchTab({
  60. url: '/pages/home/home'
  61. })
  62. },
  63. //判断用户基本信息是否存在
  64. hasParentDetail() {
  65. if (uni.getStorageSync('parentdetail'))
  66. this.show = true
  67. else
  68. this.show = false
  69. },
  70. //获取用户手机号
  71. async getPhoneNumber(e) {
  72. if (e.detail.errMsg !== "getPhoneNumber:ok") {
  73. //用户决绝授权
  74. return uni.$showMsg('拒绝授权获取不到您的孩子信息!')
  75. } else {
  76. if (this.token) {
  77. let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
  78. let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
  79. console.log(numData.phoneNumber)
  80. // const parentDetailData = await uni.$http.post('',numData.phoneNumber)
  81. this.updateParentDetail({
  82. phoneNumber: '17882237075',
  83. name: '家长姓名',
  84. childrenList: [{
  85. avatar: '/static/default-icons/boy.png',
  86. name: '张三',
  87. classid: '0301',
  88. class: '三年级一班',
  89. tmdid: 'tmdid01',
  90. schoolname: '研发学校'
  91. }, {
  92. avatar: '/static/default-icons/girl.png',
  93. name: '张梅',
  94. classid: '0504',
  95. class: '五年级四班',
  96. tmdid: 'tmdid03',
  97. schoolname: '研发学校'
  98. }, ]
  99. })
  100. this.show = true
  101. }
  102. }
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss">
  108. .children-container {
  109. display: flex;
  110. flex-direction: column;
  111. justify-content: center;
  112. align-items: center;
  113. .tips {
  114. width: 100%;
  115. display: flex;
  116. flex-direction: column;
  117. z-index: 99;
  118. .title {
  119. padding-top: 200rpx;
  120. padding-left: 40rpx;
  121. line-height: 70rpx;
  122. font-weight: bold;
  123. font-size: 50rpx;
  124. color: #4169E1;
  125. // background-clip: text; //裁剪成文字的前景色
  126. // color: transparent; //文字颜色变成透明
  127. }
  128. .detail-image {
  129. margin-top: 80rpx;
  130. margin-bottom: 20rpx;
  131. width: 100%;
  132. height: 500rpx;
  133. background: $guide-back-base64;
  134. background-size: cover; //背景图片自适应
  135. }
  136. .detail-button {
  137. line-height: 80rpx;
  138. height: 80rpx;
  139. width: 80%;
  140. font-weight: bold;
  141. font-size: 36rpx;
  142. border-radius: 80rpx;
  143. position: relative;
  144. margin: 100rpx auto; //relative相对定位居中
  145. border: none;
  146. color: #FFFFFF;
  147. background: linear-gradient(to right, #506AE7, #87CEFA);
  148. }
  149. }
  150. .children-item {
  151. .com-box {
  152. display: flex;
  153. flex-direction: row;
  154. justify-content: center;
  155. align-items: center;
  156. flex-wrap: wrap; //元素换行
  157. margin-top: 60rpx;
  158. .item {
  159. margin: 10rpx 20rpx 10rpx 20rpx;
  160. padding: 20rpx;
  161. display: flex;
  162. flex-direction: column;
  163. justify-content: center;
  164. align-items: center;
  165. box-shadow: 0 8rpx 16rpx rgba(153, 153, 153, 0.5);
  166. background-color: #FFFFFF;
  167. border-radius: 20rpx;
  168. width: 280rpx;
  169. height: 300rpx;
  170. z-index: 99;
  171. .item-text {
  172. margin: -7rpx 0 20rpx 20rpx;
  173. width: 100%;
  174. line-height: 40rpx;
  175. font-weight: bold;
  176. font-size: 35rpx;
  177. color: #696969;
  178. }
  179. .avatar-box {
  180. .item-avatar {
  181. width: 220rpx;
  182. height: 220rpx;
  183. }
  184. }
  185. }
  186. }
  187. }
  188. }
  189. .ocean {
  190. display: flex;
  191. margin-top: -600rpx;
  192. width: 1800rpx;
  193. height: 1800rpx;
  194. background-color: #4169E1;
  195. border-radius: 50%;
  196. &::before,
  197. &::after {
  198. content: "";
  199. position: absolute;
  200. margin-top: 870rpx;
  201. width: 1600rpx;
  202. height: 1600rpx;
  203. top: 0;
  204. left: 50%;
  205. border-radius: 43%;
  206. background-color: #FFFFFF;
  207. transform: translate(-50%, -70%) rotate(0);
  208. animation: rotate 6s linear infinite;
  209. z-index: 2;
  210. }
  211. &::after {
  212. border-radius: 46%;
  213. background-color: #FFFFFF;
  214. opacity: 0.7;
  215. transform: translate(-50%, -70%) rotate(0);
  216. animation: rotate 10s linear -5s infinite;
  217. z-index: 3;
  218. }
  219. &::after {
  220. border-radius: 40%;
  221. background-color: #FFFFFF;
  222. opacity: 0.5;
  223. transform: translate(-50%, -70%) rotate(0);
  224. animation: rotate 10s linear -5s infinite;
  225. z-index: 3;
  226. }
  227. }
  228. @keyframes rotate {
  229. 50% {
  230. transform: translate(-50%, -73%) rotate(180deg);
  231. }
  232. 100% {
  233. transform: translate(-50%, -70%) rotate(360deg);
  234. }
  235. }
  236. </style>