login.vue 4.0 KB

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