guide.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="children-container">
  3. <!-- 标题 -->
  4. <view class="tips">
  5. <view class="title">欢迎您的使用</view>
  6. <view style="font-weight: bold;font-size: 36rpx;color: #b0b0b1;margin-left: 40rpx;margin-top: 20rpx;">
  7. 醍摩豆家长助您孩子成长</view>
  8. <view class="detail-image" :style="{backgroundImage:`url(${image})`}"></view>
  9. <button class="detail-button" plain="true" open-type="getPhoneNumber"
  10. @getphonenumber="getPhoneNumber">获取您的孩子信息</button>
  11. </view>
  12. <!-- 动画 -->
  13. <view class="ocean"></view>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. mapState,
  19. mapMutations
  20. } from 'vuex'
  21. //引入解密工具
  22. import WXBizDataCrypt from "@/utils/WXBizDataCrypt.js";
  23. export default {
  24. computed: {
  25. ...mapState('m_parent', ['token'])
  26. },
  27. data() {
  28. return {
  29. image: 'https://image.meiye.art/pic_1631411821366jJzYRG2jdJOxwXZk_jz7o'
  30. };
  31. },
  32. methods: {
  33. ...mapMutations('m_parent', ['updateParentDetail']),
  34. //获取用户手机号
  35. async getPhoneNumber(e) {
  36. if (e.detail.errMsg !== "getPhoneNumber:ok") {
  37. //用户决绝授权
  38. return uni.$showMsg('拒绝授权获取不到您的孩子信息!')
  39. } else {
  40. if (this.token) {
  41. let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
  42. let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
  43. console.log(numData.phoneNumber)
  44. // const parentDetailData = await uni.$http.post('',numData.phoneNumber)
  45. this.updateParentDetail({
  46. phoneNumber: '17882237075',
  47. name: '家长姓名',
  48. childrenList: [{
  49. avatar: '/static/default-icons/boy.png',
  50. name: '张三',
  51. classid: '0301',
  52. class: '三年级一班',
  53. tmdid: 'tmdid01',
  54. schoolname: '研发学校'
  55. }, {
  56. avatar: '/static/default-icons/girl.png',
  57. name: '张梅',
  58. classid: '0504',
  59. class: '五年级四班',
  60. tmdid: 'tmdid03',
  61. schoolname: '研发学校'
  62. }, ]
  63. })
  64. uni.navigateTo({
  65. url:'/subpkg/childrenlist/childrenlist'
  66. })
  67. }
  68. }
  69. },
  70. }
  71. }
  72. </script>
  73. <style lang="scss">
  74. @import '@/subpkg/common/ocean.scss';
  75. .children-container {
  76. display: flex;
  77. flex-direction: column;
  78. .tips {
  79. width: 100%;
  80. display: flex;
  81. flex-direction: column;
  82. z-index: 99;
  83. .title {
  84. padding-top: 200rpx;
  85. padding-left: 40rpx;
  86. line-height: 70rpx;
  87. font-weight: bold;
  88. font-size: 50rpx;
  89. color: #4169E1;
  90. // background-clip: text; //裁剪成文字的前景色
  91. // color: transparent; //文字颜色变成透明
  92. }
  93. .detail-image {
  94. margin-top: 80rpx;
  95. margin-bottom: 20rpx;
  96. width: 100%;
  97. height: 500rpx;
  98. background-size: cover; //背景图片自适应
  99. }
  100. .detail-button {
  101. line-height: 100rpx;
  102. height: 100rpx;
  103. width: 80%;
  104. font-weight: bold;
  105. font-size: 36rpx;
  106. color: #FFFFFF;
  107. border-radius: 100rpx;
  108. position: relative;
  109. margin: 100rpx auto; //relative相对定位居中
  110. border: none;
  111. background: linear-gradient(to right, #506AE7, #87CEFA);
  112. }
  113. }
  114. }
  115. </style>