时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
3.6 KiB

  1. <template>
  2. <view>
  3. <view class="lf-row-center lf-flex-column box">
  4. <image class="img"></image>
  5. <view class="lf-m-t-10 lf-font-32" v-if="isLogin">游客jdsfbuskdnko</view>
  6. <block v-if="isLogin">
  7. <button class="btn" @click="getUserProfile">
  8. <u-icon name="weixin-fill" color="#ffffff" size="60" class="lf-text-vertical"></u-icon>
  9. <text class="lf-m-l-20">绑定微信</text>
  10. </button>
  11. <view class="lf-m-t-40 lf-font-28" @click="$toBack()">暂不绑定继续操作</view>
  12. </block>
  13. <block v-else>
  14. <button class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  15. <u-icon name="weixin-fill" color="#ffffff" size="60" class="lf-text-vertical"></u-icon>
  16. <text class="lf-m-l-20">微信快捷登录</text>
  17. </button>
  18. <view class="lf-m-t-40 lf-font-28" @click="$url('/pages/login/accountLogin')">使用手机号登录</view>
  19. <view class="mask" v-if="!checked" @click="$msg('您未同意协议条款')"></view>
  20. </block>
  21. </view>
  22. <!-- 服务条款 -->
  23. <view class="fixed-bottom" v-if="!isLogin">
  24. <checkbox-group @change="checkboxChange" style="display: inline-block;">
  25. <checkbox class="lf-text-vertical" :checked="checked"></checkbox>
  26. </checkbox-group>
  27. <text class="lf-m-l-10 lf-font-24 lf-color-gray">
  28. <text>请认真阅读并同意</text>
  29. <text class="highlight" @click="enterAgree">时空网协议</text>
  30. <text>在小程序下单购买即表示您已默认同意</text>
  31. <text class="highlight" @click="enterAgree">时空网协议</text>
  32. <text>的所有条款</text>
  33. </text>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data(){
  40. return {
  41. checked: false, // 是否勾选协议
  42. isLogin: false, // 是否已登录
  43. userInfo: {},
  44. type: 'phone', // 页面授权类型 phone获取手机号 | userinfo获取用户信息
  45. }
  46. },
  47. onLoad(){
  48. },
  49. methods: {
  50. // 进入查看协议
  51. enterAgree(){
  52. console.log("查看协议");
  53. },
  54. // 勾选协议发生变化
  55. checkboxChange(event){
  56. console.log(event)
  57. this.checked = event.detail.value.length > 0;
  58. },
  59. // 微信快捷登录获取手机号
  60. getPhoneNumber(event){
  61. console.log(event);
  62. if(event.detail.errMsg == 'getPhoneNumber:ok'){
  63. let encryptedData = event.detail.encryptedData;
  64. let iv = event.detail.iv;
  65. this.isLogin = true; // TODO 接口请求回来再赋值
  66. }
  67. },
  68. // 获取用户信息
  69. getUserProfile(){
  70. uni.getUserProfile({
  71. desc: '您的信息将用于时空网显示',
  72. lang: 'zh_CN',
  73. complete: result => {
  74. console.log(result)
  75. if(result.errMsg == 'getUserProfile:ok'){
  76. let encryptedData = result.encryptedData;
  77. let iv = result.iv;
  78. let signature = result.signature;
  79. let userInfo = result.userInfo;
  80. // 获取成功,请求接口完毕后返回页面
  81. this.$toBack();
  82. }
  83. }
  84. });
  85. }
  86. }
  87. }
  88. </script>
  89. <style>
  90. page{
  91. overflow: hidden;
  92. }
  93. </style>
  94. <style lang="scss" scoped="scoped">
  95. .box{
  96. padding: 60rpx 32rpx;
  97. width: 750rpx;
  98. height: auto;
  99. box-sizing: border-box;
  100. position: relative;
  101. .img{
  102. width: 180rpx;
  103. height: 180rpx;
  104. border-radius: 50%;
  105. background-color: #EEEEEE;
  106. }
  107. .btn{
  108. background-color: #09BB07;
  109. color: #FFFFFF;
  110. width: 100%;
  111. height: 88rpx;
  112. border-radius: 42rpx;
  113. font-size: 32rpx;
  114. line-height: 88rpx;
  115. margin-top: 80rpx;
  116. }
  117. }
  118. .fixed-bottom{
  119. position: fixed;
  120. bottom: 60rpx;
  121. left: 0;
  122. padding: 0 32rpx;
  123. .highlight{
  124. color: #1e90ff;
  125. }
  126. }
  127. .mask{
  128. position: absolute;
  129. bottom: 46rpx;
  130. left: 0;
  131. width: 100%;
  132. height: 190rpx;
  133. }
  134. </style>