guide.vue 5.3 KB

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