halfScreen.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. uni.navigateTo({
  49. url:"/pages/web/web?type="+type
  50. })
  51. },
  52. toLoginCheck(){
  53. if (!this.checkTrueState) {
  54. uni.showToast({
  55. title: "请先阅读同意用户协议",
  56. icon:"none"
  57. })
  58. return ;
  59. }
  60. },
  61. getPhoneNumberData(event){
  62. uni.login({
  63. success: async (resp)=> {
  64. if (event.detail.errNo) {
  65. return uni.showToast({
  66. title: "请重试一次",
  67. icon:"none"
  68. })
  69. }
  70. var detail = event.detail
  71. detail.login = resp.code;
  72. var aresp = await this.$api.auth.mobile.post(detail);
  73. if (aresp.code !== 1) {
  74. return show(aresp.msg);
  75. }
  76. uni.setStorageSync("user_token", aresp.data.access_token)
  77. uni.showTabBar()
  78. this.$nextTick(()=>{
  79. this.$refs.loginPop.close()
  80. })
  81. this.$emit('success',aresp.data.access_token);
  82. }
  83. })
  84. },
  85. open() {
  86. uni.hideTabBar();
  87. this.$nextTick(()=>{
  88. this.$refs.loginPop.open()
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. .login-popup{padding: 20rpx;min-height: 30vh;}
  96. .login-popup .login-title{display: flex;align-items: center;justify-content: space-between;}
  97. .login-popup .login-title .login-logo{display: flex;align-items: center;gap: 15rpx;}
  98. .login-popup .login-title .login-logo image{width: 50rpx;height: 50rpx;border-radius: 100%;}
  99. .login-popup .login-title .name{font-weight: bold;font-family: "bluevBold";color: #000;font-size: 28rpx;}
  100. .login-desc{line-height: 2;color: #666;font-size: 24rpx;margin: 20rpx 0;text-align: center;}
  101. .login-footer{font-size: 28rpx;color: #666;height: 20%;display: flex;align-items: center;justify-content: center;}
  102. .login-footer text{color: #ff5a25;}
  103. .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;}
  104. .checkBox text{display: block;color: #fff;}
  105. .checkBox.active{background-color: #ff5a25;}
  106. .checkBox.active text{color: #fff;}
  107. .logi-btn{width: 60%;margin: 20upx auto;height: 40%;}
  108. .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;}
  109. .logi-btn .u-button::after{border: 0;}
  110. .logi-btn .u-button.full{background-color: rgba(33, 34, 38, 1);color: #fff;}
  111. </style>