时空网前端
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.

137 lines
3.5 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. }
  45. },
  46. onLoad(){
  47. },
  48. methods: {
  49. // 进入查看协议
  50. enterAgree(){
  51. console.log("查看协议");
  52. },
  53. // 勾选协议发生变化
  54. checkboxChange(event){
  55. console.log(event)
  56. this.checked = event.detail.value.length > 0;
  57. },
  58. // 微信快捷登录获取手机号
  59. getPhoneNumber(event){
  60. console.log(event);
  61. if(event.detail.errMsg == 'getPhoneNumber:ok'){
  62. let encryptedData = event.detail.encryptedData;
  63. let iv = event.detail.iv;
  64. this.isLogin = true; // TODO 接口请求回来再赋值
  65. }
  66. },
  67. // 获取用户信息
  68. getUserProfile(){
  69. uni.getUserProfile({
  70. desc: '您的信息将用于时空网显示',
  71. lang: 'zh_CN',
  72. complete: result => {
  73. console.log(result)
  74. if(result.errMsg == 'getUserProfile:ok'){
  75. let encryptedData = result.encryptedData;
  76. let iv = result.iv;
  77. let signature = result.signature;
  78. let userInfo = result.userInfo;
  79. // 获取成功,请求接口完毕后返回页面
  80. this.$toBack();
  81. }
  82. }
  83. });
  84. }
  85. }
  86. }
  87. </script>
  88. <style>
  89. page{
  90. overflow: hidden;
  91. }
  92. </style>
  93. <style lang="scss" scoped="scoped">
  94. .box{
  95. padding: 60rpx 32rpx;
  96. width: 750rpx;
  97. height: auto;
  98. box-sizing: border-box;
  99. position: relative;
  100. .img{
  101. width: 180rpx;
  102. height: 180rpx;
  103. border-radius: 50%;
  104. background-color: #EEEEEE;
  105. }
  106. .btn{
  107. background-color: #09BB07;
  108. color: #FFFFFF;
  109. width: 100%;
  110. height: 88rpx;
  111. border-radius: 42rpx;
  112. font-size: 32rpx;
  113. line-height: 88rpx;
  114. margin-top: 80rpx;
  115. }
  116. }
  117. .fixed-bottom{
  118. position: fixed;
  119. bottom: 60rpx;
  120. left: 0;
  121. padding: 0 32rpx;
  122. .highlight{
  123. color: #1e90ff;
  124. }
  125. }
  126. .mask{
  127. position: absolute;
  128. bottom: 46rpx;
  129. left: 0;
  130. width: 100%;
  131. height: 190rpx;
  132. }
  133. </style>