mobile-auth.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <view class="mobile-frame" v-show="frame">
  3. <view class="frame">
  4. <image src="../../static/image/tips.png" mode=""></image>
  5. <view class="title">
  6. 当前操作需要授权手机号
  7. </view>
  8. <view class="submit" @click="frame=false">
  9. <button type="default" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">立即授权</button>
  10. </view>
  11. </view>
  12. <view class="close">
  13. <image src="../../static/image/close-white.png" mode=""></image>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. var app = getApp()
  19. export default {
  20. name: 'mobile-auth',
  21. data() {
  22. return{
  23. frame:false
  24. }
  25. },
  26. props: {
  27. frame: {
  28. default: false
  29. },
  30. },
  31. created(){
  32. },
  33. methods: {
  34. //获取手机号
  35. getPhoneNumber: function(e) {
  36. console.log(e.detail)
  37. let data = {
  38. session_key: uni.getStorageSync('session_key'),
  39. iv: e.detail.iv,
  40. encryptedData: e.detail.encryptedData
  41. }
  42. app.request('/user/sync-mobile', data, 'post').then(res => {
  43. this.frameIshow = false
  44. app.globalData.is_auth = true
  45. })
  46. },
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .mobile-frame {
  52. position: fixed;
  53. height: 100vh;
  54. width: 100%;
  55. background: rgba($color: #000000, $alpha: 0.6);
  56. z-index: 99999;
  57. top: 0;
  58. .frame {
  59. width: 50%;
  60. margin: 0 auto;
  61. padding: 50upx 30upx;
  62. margin-top: 40%;
  63. border-radius: 12upx;
  64. background-color: #FFFFFF;
  65. text-align: center;
  66. image {
  67. height: 90upx;
  68. width: 90upx;
  69. }
  70. .title {
  71. height: 70upx;
  72. line-height: 70upx;
  73. font-size: 28upx;
  74. }
  75. .submit {
  76. margin: 0 auto;
  77. width: 50%;
  78. margin-top: 30upx;
  79. button {
  80. background-color: $mine-background-color;
  81. height: 70upx;
  82. line-height: 70upx;
  83. text-align: center;
  84. font-size: 26upx;
  85. color: #FFFFFF;
  86. background-color: $mine-background-color;
  87. }
  88. }
  89. }
  90. .close {
  91. margin: 0 auto;
  92. height: 100upx;
  93. width: 100upx;
  94. text-align: center;
  95. margin-top: 10%;
  96. image {
  97. height: 50upx;
  98. width: 50upx;
  99. }
  100. }
  101. }
  102. </style>