account.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="wrap">
  3. <view class="content">
  4. <view class="title">欢迎登录</view>
  5. <input v-model="loginName" class="u-border-bottom" placeholder="请输入手机号" type="number"/>
  6. <view class="tips">未注册的手机号验证后自动创建账号</view>
  7. <u-button :style="[inputStyle]" class="getCaptcha" @click="submit">获取短信验证码</u-button>
  8. <view class="alternative">
  9. <view class="account" @click="accountLogin">密码登录</view>
  10. <view class="issue" @click="problem">遇到问题</view>
  11. </view>
  12. </view>
  13. <!-- <view class="buttom">
  14. <view class="loginType">
  15. <view class="wechat item">
  16. <view class="icon"><u-icon size="60" name="server-man" color="#999" @click="server"></u-icon></view>
  17. </view>
  18. </view>
  19. </view> -->
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. loginName: ''
  27. }
  28. },
  29. onLoad() {
  30. // 在页面中定义激励视频广告
  31. let videoAd = null
  32. // 在页面onLoad回调事件中创建激励视频广告实例
  33. if (wx.createRewardedVideoAd) {
  34. videoAd = wx.createRewardedVideoAd({
  35. adUnitId: 'adunit-8cd5789a01a51891'
  36. })
  37. videoAd.onLoad(() => {
  38. })
  39. videoAd.onError((err) => {
  40. })
  41. videoAd.onClose((res) => {
  42. })
  43. }
  44. // 用户触发广告后,显示激励视频广告
  45. if (videoAd) {
  46. videoAd.show().catch(() => {
  47. // 失败重试
  48. videoAd.load()
  49. .then(() => videoAd.show())
  50. .catch(err => {
  51. console.log('激励视频 广告显示失败')
  52. })
  53. })
  54. }
  55. },
  56. computed: {
  57. // 小程序端无效
  58. inputStyle() {
  59. let style = {};
  60. if (this.loginName && this.$u.test.mobile(this.loginName)) {
  61. style.color = "#fff";
  62. style.backgroundColor = this.$u.color['primary'];
  63. }
  64. return style;
  65. }
  66. },
  67. methods: {
  68. submit() {
  69. if (this.$u.test.mobile(this.loginName)) {
  70. this.$u.route({
  71. url: 'pages/login/code',
  72. params: {
  73. loginName: this.loginName
  74. }
  75. })
  76. } else {
  77. this.$mytip.toast('请输入有效的手机号码')
  78. }
  79. },
  80. accountLogin() {
  81. this.$u.route({
  82. url: 'pages/login/login'
  83. })
  84. },
  85. problem() {
  86. this.$u.route({
  87. url: 'pages/login/problem'
  88. })
  89. },
  90. server() {
  91. window.open('https://sourcebyte.cn')
  92. }
  93. }
  94. };
  95. </script>
  96. <style>
  97. page {
  98. overflow: hidden;
  99. background-color: #ffffff;
  100. }
  101. </style>
  102. <style lang="scss" scoped>
  103. .wrap {
  104. font-size: 28 rpx;
  105. .content {
  106. width: 600 rpx;
  107. margin: 80 rpx auto 0;
  108. .title {
  109. text-align: left;
  110. font-size: 60 rpx;
  111. font-weight: 500;
  112. margin-bottom: 100 rpx;
  113. }
  114. input {
  115. text-align: left;
  116. margin-bottom: 10 rpx;
  117. padding-bottom: 6 rpx;
  118. }
  119. .tips {
  120. color: $u-type-info;
  121. margin-bottom: 60 rpx;
  122. margin-top: 8 rpx;
  123. }
  124. .getCaptcha {
  125. background-color: rgba(0, 0, 0, .1);
  126. color: $u-tips-color;
  127. border: none;
  128. font-size: 30 rpx;
  129. padding: 12 rpx 0;
  130. &::after {
  131. border: none;
  132. }
  133. }
  134. .alternative {
  135. color: $u-tips-color;
  136. display: flex;
  137. justify-content: space-between;
  138. margin-top: 30 rpx;
  139. .account {
  140. &:active {
  141. background-color: #ededed;
  142. }
  143. }
  144. }
  145. }
  146. .buttom {
  147. .loginType {
  148. font-size: 14px;
  149. position: fixed;
  150. right: 50 rpx;
  151. bottom: 50 rpx;
  152. width: 60px;
  153. height: 60px;
  154. padding: 4px;
  155. cursor: pointer;
  156. background: #FFF;
  157. text-align: center;
  158. line-height: 60px;
  159. border-radius: 100%;
  160. -webkit-box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  161. box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1), inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  162. }
  163. }
  164. }
  165. </style>