halfScreen.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view>
  3. <uni-popup ref="loginPop" type="bottom" border-radius="10px 10px 0 0" background-color="#ffffff" :mask-click="false">
  4. <view class="login-popup">
  5. <view class="login-title">
  6. <view class="login-logo">
  7. <view class="logo"><image src="/static/logo.jpg" mode="widthFix"></image></view>
  8. <view class="name">奥莱优品</view>
  9. </view>
  10. <view class="login-close" @click="closeLogin"><text class="cuIcon-close"></text></view>
  11. </view>
  12. <view class="login-desc">为了更好的为您提供服务,本次操作需要您关联手机号码</view>
  13. <view class="login-footer">
  14. <view :class="checkTrueState?'checkBox active':'checkBox'" @click="checkTrue">
  15. <text class="cuIcon-check"></text>
  16. </view>
  17. <view @click="checkTrue">我已阅读并同意</view>
  18. <text @click="toWeb('privacy')">用户协议、</text><text @click="toWeb('privacy')">隐私协议</text>
  19. </view>
  20. <view class="logi-btn">
  21. <button class="u-button full" open-type="getPhoneNumber" @getphonenumber="getPhoneNumberData" v-if="checkTrueState">快捷一键登录</button>
  22. <button class="u-button full" @click="toLoginCheck" v-else>快捷登录</button>
  23. <button class="u-button" @click="closeLogin">暂不登录</button>
  24. </view>
  25. </view>
  26. </uni-popup>
  27. </view>
  28. </template>
  29. <script>
  30. import { show } from '@/utils/js/index.js';
  31. export default {
  32. data() {
  33. return {
  34. checkTrueState:false
  35. }
  36. },
  37. methods: {
  38. closeLogin(){
  39. uni.showTabBar()
  40. this.$nextTick(()=>{
  41. this.$refs.loginPop.close()
  42. })
  43. },
  44. checkTrue(){
  45. this.checkTrueState = !this.checkTrueState;
  46. },
  47. toWeb(type){
  48. },
  49. toLoginCheck(){
  50. if (!this.checkTrueState) {
  51. uni.showToast({
  52. title: "请先阅读同意用户协议",
  53. icon:"none"
  54. })
  55. return ;
  56. }
  57. },
  58. getPhoneNumberData(event){
  59. uni.login({
  60. success: async (resp)=> {
  61. var detail = event.detail
  62. detail.login = resp.code;
  63. var aresp = await this.$api.auth.mobile.post(detail);
  64. if (aresp.code !== 1) {
  65. return show(aresp.msg);
  66. }
  67. uni.setStorageSync("user_token", aresp.data.access_token)
  68. uni.showTabBar()
  69. this.$nextTick(()=>{
  70. this.$refs.loginPop.close()
  71. })
  72. }
  73. })
  74. },
  75. open() {
  76. uni.hideTabBar();
  77. this.$nextTick(()=>{
  78. this.$refs.loginPop.open()
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style>
  85. .login-popup{padding: 20rpx;min-height: 30vh;}
  86. .login-popup .login-title{display: flex;align-items: center;justify-content: space-between;}
  87. .login-popup .login-title .login-logo{display: flex;align-items: center;gap: 15rpx;}
  88. .login-popup .login-title .login-logo image{width: 50rpx;height: 50rpx;border-radius: 100%;}
  89. .login-popup .login-title .name{font-weight: bold;font-family: "bluevBold";color: #000;font-size: 28rpx;}
  90. .login-desc{line-height: 2;color: #666;font-size: 24rpx;margin: 20rpx 0;text-align: center;}
  91. .login-footer{font-size: 28rpx;color: #666;height: 20%;display: flex;align-items: center;justify-content: center;}
  92. .login-footer text{color: #ff5a25;}
  93. .checkBox{width: 36upx;height: 36upx;margin-right: 20upx;border: 2upx solid #ff5a25;position: relative;border-radius: 36upx;display: flex;align-items: center;justify-content: center;}
  94. .checkBox text{display: block;color: #fff;}
  95. .checkBox.active{background-color: #ff5a25;}
  96. .checkBox.active text{color: #fff;}
  97. .logi-btn{width: 60%;margin: 20upx auto;height: 40%;}
  98. .logi-btn .u-button{font-size: 28upx;height: 80upx;border-radius: 40upx;line-height: 80upx;margin-top: 40upx;color: #333;border: 2upx solid rgba(33, 34, 38, 1);background-color: #fff;}
  99. .logi-btn .u-button::after{border: 0;}
  100. .logi-btn .u-button.full{background-color: rgba(33, 34, 38, 1);color: #fff;}
  101. </style>