login.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. // uni.switchTab({
  69. // url: '/pages/index/index'
  70. // })
  71. // if(this.isMsg==1){
  72. // uni.setStorageSync('msgLogin', '1');
  73. // uni.switchTab({
  74. // url: '/pages/message/message'
  75. // })
  76. // }else{
  77. // const value = uni.setStorageSync('login', '1');
  78. // uni.switchTab({
  79. // url: '/pages/index/index'
  80. // })
  81. // }
  82. },
  83. goto() {
  84. uni.navigateTo({
  85. url: "/pages/login_two/login_two"
  86. })
  87. },
  88. radioCheck() {
  89. this.isOK = !this.isOK
  90. },
  91. isDui() {
  92. this.isShow = !this.isShow
  93. }
  94. },
  95. onLoad(opt) {
  96. console.log(opt);
  97. this.isMsg = opt.id
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .login {
  103. background-color: #ffffff;
  104. height: 100vh;
  105. .avatar-wrapper {
  106. width: 300rpx;
  107. background-color: #fff;
  108. margin: auto;
  109. }
  110. .avatar {
  111. width: 60rpx;
  112. height: 60rpx;
  113. }
  114. .img {
  115. // padding: 10vh 0;
  116. padding-top: 10vh;
  117. margin-bottom: 10vh;
  118. width: 750rpx;
  119. display: flex;
  120. justify-content: center;
  121. image {
  122. width: 200rpx;
  123. height: 200rpx;
  124. border-radius: 50%;
  125. }
  126. }
  127. .mid {
  128. display: flex;
  129. justify-content: flex-start;
  130. width: 750rpx;
  131. padding: 0rpx 50rpx;
  132. font-size: 13px;
  133. .quan {
  134. position: absolute;
  135. flex-shrink: 0;
  136. top: 0;
  137. left: -10rpx;
  138. width: 32rpx;
  139. height: 32rpx;
  140. border-radius: 50%;
  141. margin-top: 5rpx;
  142. margin-right: 10rpx;
  143. border: 1px #bdbdbd solid;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. .dui {
  148. width: 32rpx;
  149. height: 32rpx;
  150. }
  151. }
  152. text {
  153. color: #4a97f2;
  154. }
  155. }
  156. .btn {
  157. background-color: #0056a8;
  158. color: #ffffff;
  159. border-radius: 30px;
  160. margin: 30rpx 55rpx;
  161. padding: 10rpx 0;
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. // padding: 0rpx 10rpx;
  166. font-size: 16px;
  167. }
  168. .footer {
  169. display: flex;
  170. justify-content: center;
  171. font-size: 14px;
  172. margin: auto;
  173. color: #666666;
  174. }
  175. }
  176. </style>