guide.vue 3.1 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"></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. };
  30. },
  31. methods: {
  32. ...mapMutations('m_parent', ['updateParentDetail']),
  33. //获取用户手机号
  34. async getPhoneNumber(e) {
  35. if (e.detail.errMsg !== "getPhoneNumber:ok") {
  36. //用户决绝授权
  37. return uni.$showMsg('拒绝授权获取不到您的孩子信息!')
  38. } else {
  39. if (this.token) {
  40. let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
  41. let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
  42. console.log(numData.phoneNumber)
  43. // const parentDetailData = await uni.$http.post('',numData.phoneNumber)
  44. this.updateParentDetail({
  45. phoneNumber: '17882237075',
  46. name: '家长姓名',
  47. childrenList: [{
  48. avatar: '/static/default-icons/boy.png',
  49. name: '张三',
  50. classid: '0301',
  51. class: '三年级一班',
  52. tmdid: 'tmdid01',
  53. schoolname: '研发学校'
  54. }, {
  55. avatar: '/static/default-icons/girl.png',
  56. name: '张梅',
  57. classid: '0504',
  58. class: '五年级四班',
  59. tmdid: 'tmdid03',
  60. schoolname: '研发学校'
  61. }, ]
  62. })
  63. uni.navigateTo({
  64. url:'/subpkg/childrenlist/childrenlist'
  65. })
  66. }
  67. }
  68. },
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. @import '@/subpkg/common/ocean.scss';
  74. .children-container {
  75. display: flex;
  76. flex-direction: column;
  77. .tips {
  78. width: 100%;
  79. display: flex;
  80. flex-direction: column;
  81. z-index: 99;
  82. .title {
  83. padding-top: 200rpx;
  84. padding-left: 40rpx;
  85. line-height: 70rpx;
  86. font-weight: bold;
  87. font-size: 50rpx;
  88. color: #4169E1;
  89. // background-clip: text; //裁剪成文字的前景色
  90. // color: transparent; //文字颜色变成透明
  91. }
  92. .detail-image {
  93. margin-top: 80rpx;
  94. margin-bottom: 20rpx;
  95. width: 100%;
  96. height: 500rpx;
  97. background: $guide-back-base64;
  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>