index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="authorizedLogin-container" v-if="show">
  3. <image src="/static/logo.png" class="logo"></image>
  4. <view class="statement">
  5. <label>
  6. <label class="radio" @click="changecheck">
  7. <radio class="check-bt" value="1" :checked="checked" style="transform:scale(0.6)" />
  8. <text>我已阅读并同意</text>
  9. <text class="link" @click="statement">《隐私政策》</text>
  10. <text>首次使用自动注册登录</text>
  11. </label>
  12. </label>
  13. </view>
  14. <div class="btn-submit" @click="loginsubmit">一键登录</div>
  15. </view>
  16. </template>
  17. <script>
  18. import { wxLogin} from '@/api/openApi.js'
  19. export default {
  20. name:"AuthorizedLogin",
  21. data() {
  22. return {
  23. show:true,
  24. checked:true
  25. };
  26. },
  27. methods:{
  28. loginsubmit(){
  29. let self=this;
  30. uni.getProvider({
  31. service:"oauth",
  32. success(res){
  33. let provider=res.provider
  34. uni.login({
  35. provider,
  36. success: function (loginRes) {
  37. let code=loginRes.code;
  38. wxLogin(code).then((resp)=>{
  39. const { code, data, msg } = resp
  40. debugger
  41. if(data){
  42. if(data&&data.unionid){
  43. uni.setStorageSync('unionid',data.unionid)
  44. }
  45. }
  46. })
  47. }
  48. })
  49. }
  50. })
  51. },
  52. changecheck(){
  53. this.checked= !this.checked
  54. },
  55. statement(){
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .authorizedLogin-container{
  62. position: fixed;
  63. left: 0;
  64. right: 0;
  65. top: 0;
  66. bottom: 0;
  67. background-color: rgba(255,255,255,1);
  68. z-index: 999;
  69. padding: 20rpx;
  70. box-sizing: border-box;
  71. .logo{
  72. display: block;
  73. width: 100rpx;
  74. height: 100rpx;
  75. margin: 100rpx auto;
  76. }
  77. .statement{
  78. font-size: 24rpx;
  79. color: #666;
  80. .check-bt{
  81. ::v-deep .uni-radio-input{
  82. margin-right: 0 !important;
  83. }
  84. }
  85. .link{
  86. color: #3D90F4;
  87. }
  88. }
  89. .btn-submit{
  90. width: 600rpx;
  91. height: 72rpx;
  92. line-height: 72rpx;
  93. text-align: center;
  94. background:#3D90F4;
  95. border-radius: 42rpx;
  96. font-size: 32rpx;
  97. font-family: PingFang SC;
  98. font-weight: 400;
  99. color: #FFFFFF;
  100. z-index: 999;
  101. margin: 50rpx auto;
  102. }
  103. }
  104. </style>