login.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="login">
  3. <statusBar :item='navBarData'></statusBar>
  4. <view class="img">
  5. <image src="http://43.139.158.220:5007/img/static/yym/image7.png" mode="aspectFill"></image>
  6. </view>
  7. <view class="mid">
  8. <!-- <radio value="r1" @click="radioCheck" size="10" :checked="isOK" /> -->
  9. <view class="" style="position: relative;padding-left:30rpx;">
  10. 我已阅读并同意<text>《教育小程序服务条款》</text>和 <text>《 隐私协议》</text>新用户自动注册
  11. <view class="quan" @click="isDui">
  12. <image v-if="isShow" class="dui" src="http://43.139.158.220:5007/img/static/yym/dui.png"
  13. mode="aspectFill"></image>
  14. </view>
  15. </view>
  16. </view>
  17. <button class="btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  18. <image class="avatar" :src="avatarUrl"></image>
  19. </button>
  20. <button class="btn" @click="gotoIndex">一键登录</button>
  21. <!-- <button class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">一键登录</button> -->
  22. <view class="footer" @click="goto">
  23. <text>手机号登录/账号密码登录</text>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. avatarUrl: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
  32. isOK: false,
  33. navBarData: {
  34. title: '首页',
  35. btn: 1 //判断是否显示返回按钮
  36. },
  37. isMsg: 0,
  38. isShow: false
  39. };
  40. },
  41. methods: {
  42. onChooseAvatar(e) {
  43. console.log(e);
  44. const {
  45. avatarUrl
  46. } = e.detail
  47. this.avatarUrl = avatarUrl
  48. //对临时图片链接进行base64编码
  49. var avatarUrl_base64 = 'data:image/jpeg;base64,' + wx.getFileSystemManager().readFileSync(this.avatarUrl,
  50. 'base64')
  51. console.log(avatarUrl_base64);
  52. uni.request({
  53. url: 'http://localhost:3001/login2',
  54. method: 'POST',
  55. data: avatarUrl_base64,
  56. success(res) {
  57. console.log(res);
  58. }
  59. })
  60. },
  61. getPhoneNumber(e) {
  62. console.log(e.detail.code) // 动态令牌
  63. console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
  64. console.log(e.detail.errno) // 错误码(失败时返回)
  65. },
  66. gotoIndex() {
  67. const value = uni.setStorageSync('login', '1');
  68. this.$request('/a','GET',{u:1}).then(res=>{
  69. console.log(res);
  70. })
  71. },
  72. goto() {
  73. uni.navigateTo({
  74. url: "/pages/login_two/login_two"
  75. })
  76. },
  77. radioCheck() {
  78. this.isOK = !this.isOK
  79. },
  80. isDui() {
  81. this.isShow = !this.isShow
  82. }
  83. },
  84. onLoad(opt) {
  85. console.log(opt);
  86. this.isMsg = opt.id
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .login {
  92. background-color: #ffffff;
  93. height: 100vh;
  94. .avatar-wrapper {
  95. width: 300rpx;
  96. background-color: #fff;
  97. margin: auto;
  98. }
  99. .avatar {
  100. width: 60rpx;
  101. height: 60rpx;
  102. }
  103. .img {
  104. // padding: 10vh 0;
  105. padding-top: 10vh;
  106. margin-bottom: 10vh;
  107. width: 750rpx;
  108. display: flex;
  109. justify-content: center;
  110. image {
  111. width: 200rpx;
  112. height: 200rpx;
  113. border-radius: 50%;
  114. }
  115. }
  116. .mid {
  117. display: flex;
  118. justify-content: flex-start;
  119. width: 750rpx;
  120. padding: 0rpx 50rpx;
  121. font-size: 13px;
  122. .quan {
  123. position: absolute;
  124. flex-shrink: 0;
  125. top: 0;
  126. left: -10rpx;
  127. width: 32rpx;
  128. height: 32rpx;
  129. border-radius: 50%;
  130. margin-top: 5rpx;
  131. margin-right: 10rpx;
  132. border: 1px #bdbdbd solid;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. .dui {
  137. width: 32rpx;
  138. height: 32rpx;
  139. }
  140. }
  141. text {
  142. color: #4a97f2;
  143. }
  144. }
  145. .btn {
  146. background-color: #0056a8;
  147. color: #ffffff;
  148. border-radius: 30px;
  149. margin: 30rpx 55rpx;
  150. padding: 10rpx 0;
  151. display: flex;
  152. align-items: center;
  153. justify-content: center;
  154. // padding: 0rpx 10rpx;
  155. font-size: 16px;
  156. }
  157. .footer {
  158. display: flex;
  159. justify-content: center;
  160. font-size: 14px;
  161. margin: auto;
  162. color: #666666;
  163. }
  164. }
  165. </style>