index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view :data-theme="theme" class="wrapper">
  3. <view class="bag"></view>
  4. <view class="system-height" :style="{height:statusBarHeight}"></view>
  5. <!-- #ifdef MP -->
  6. <view class="title-bar" style="height: 43px;">
  7. <view class="icon" @click="back" v-if="!isHome">
  8. <image class="img" src="../static/images/left.png"></image>
  9. </view>
  10. <view class="icon" @click="home" v-else>
  11. <image class="img" src="../static/images/home.png"></image>
  12. </view>
  13. 账户登录
  14. </view>
  15. <!-- #endif -->
  16. <view class="appBox">
  17. <view class="phone_name">绑定手机号</view>
  18. <view class="phone_tips">登录注册需绑定手机号</view>
  19. <mobileLogin :isUp="isUp" :isShow="isShow" :platform="platform" :isPos="isPos" :appleShow="appleShow"
  20. :authKey="authKey" @wechatPhone="wechatPhone" :wxCode="wxCode"></mobileLogin>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. // +----------------------------------------------------------------------
  26. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  27. // +----------------------------------------------------------------------
  28. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  29. // +----------------------------------------------------------------------
  30. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  31. // +----------------------------------------------------------------------
  32. // | Author: CRMEB Team <admin@crmeb.com>
  33. // +----------------------------------------------------------------------
  34. const app = getApp();
  35. let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
  36. import sendVerifyCode from "@/mixins/SendVerifyCode";
  37. import {
  38. registerVerify,
  39. } from "@/api/user";
  40. import mobileLogin from '../components/login_mobile/index.vue'
  41. export default {
  42. name: 'login_mobile',
  43. data() {
  44. return {
  45. theme: app.globalData.theme,
  46. options: '',
  47. account: '',
  48. codeNum: '',
  49. isUp: true,
  50. authKey: '',
  51. logoUrl: '',
  52. isShow: false,
  53. isPos: false, // 是否定位
  54. platform: '', // 手机平台
  55. appleShow: '', //是否是苹果登录
  56. statusBarHeight: statusBarHeight,
  57. wxCode: '' //小程序code值
  58. }
  59. },
  60. components: {
  61. mobileLogin
  62. },
  63. mixins: [sendVerifyCode],
  64. mounted() {
  65. },
  66. onLoad: function(options) {
  67. let that = this;
  68. // 获取系统信息
  69. uni.getSystemInfo({
  70. success(res) {
  71. that.platform = res.platform;
  72. }
  73. });
  74. const {
  75. code,
  76. state,
  77. scope,
  78. back_url,
  79. appleShow
  80. } = options;
  81. that.options = options
  82. if (options.authKey) that.authKey = options.authKey
  83. if (options.appleShow) that.appleShow = options.appleShow
  84. if (options.code) that.wxCode = options.code
  85. },
  86. methods: {
  87. // 返回
  88. back() {
  89. uni.navigateBack();
  90. },
  91. // 跳入首页
  92. home() {
  93. uni.switchTab({
  94. url: '/pages/index/index'
  95. })
  96. },
  97. wechatPhone() {
  98. this.$Cache.clear('snsapiKey');
  99. if (this.options.back_url) {
  100. let url = uni.getStorageSync('snRouter');
  101. url = url.indexOf('/pages/index/index') != -1 ? '/' : url;
  102. if (url.indexOf('/pages/users/wechat_login/index') !== -1) {
  103. url = '/';
  104. }
  105. if (!url) {
  106. url = '/pages/index/index';
  107. }
  108. this.isUp = false
  109. uni.showToast({
  110. title: '登录成功',
  111. icon: 'none'
  112. })
  113. setTimeout(res => {
  114. location.href = url
  115. }, 800)
  116. } else {
  117. uni.navigateBack()
  118. }
  119. },
  120. // 获取验证码
  121. async code() {
  122. let that = this;
  123. if (!that.account) return that.$util.Tips({
  124. title: '请填写手机号码'
  125. });
  126. if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
  127. title: '请输入正确的手机号码'
  128. });
  129. await registerVerify(that.account).then(res => {
  130. that.$util.Tips({
  131. title: res.msg
  132. });
  133. that.sendCode();
  134. }).catch(err => {
  135. return that.$util.Tips({
  136. title: err
  137. })
  138. })
  139. }
  140. }
  141. }
  142. </script>
  143. <style>
  144. page {
  145. background: #fff;
  146. height: 100%;
  147. }
  148. </style>
  149. <style lang="scss" scoped>
  150. .wrapper {
  151. background: #fff;
  152. height: 100%;
  153. position: relative;
  154. .bag {
  155. position: absolute;
  156. top: 0;
  157. left: 0;
  158. width: 750rpx;
  159. height: 460rpx;
  160. @include logn-gradient(theme);
  161. }
  162. }
  163. .title-bar {
  164. position: relative;
  165. display: flex;
  166. align-items: center;
  167. justify-content: center;
  168. font-size: 36rpx;
  169. }
  170. .icon {
  171. position: absolute;
  172. left: 30rpx;
  173. top: 0;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. width: 86rpx;
  178. height: 86rpx;
  179. .img {
  180. width: 50rpx;
  181. height: 50rpx;
  182. }
  183. }
  184. .phone {
  185. &_name {
  186. padding: 0 72rpx;
  187. font-size: 48rpx;
  188. font-weight: 500;
  189. color: #333333;
  190. line-height: 68rpx;
  191. margin-bottom: 16rpx;
  192. }
  193. &_tips {
  194. font-size: 28rpx;
  195. font-weight: 400;
  196. color: #333333;
  197. line-height: 40rpx;
  198. padding: 0 72rpx;
  199. }
  200. }
  201. .appBox {
  202. background-color: #fff;
  203. height: 100%;
  204. display: flex;
  205. flex-direction: column;
  206. overflow: hidden;
  207. margin-top: 146rpx;
  208. }
  209. .shading {
  210. display: flex;
  211. align-items: center;
  212. justify-content: center;
  213. width: 100%;
  214. image {
  215. width: 180rpx;
  216. height: 180rpx;
  217. }
  218. }
  219. .ChangePassword .phone {
  220. font-size: 32rpx;
  221. font-weight: bold;
  222. text-align: center;
  223. margin-top: 55rpx;
  224. }
  225. .ChangePassword .list {
  226. width: 580rpx;
  227. margin: 53rpx auto 0 auto;
  228. }
  229. .ChangePassword .list .item {
  230. width: 100%;
  231. height: 110rpx;
  232. border-bottom: 2rpx solid #f0f0f0;
  233. }
  234. .ChangePassword .list .item input {
  235. width: 100%;
  236. height: 100%;
  237. font-size: 32rpx;
  238. }
  239. .ChangePassword .list .item .placeholder {
  240. color: #b9b9bc;
  241. }
  242. .ChangePassword .list .item input.codeIput {
  243. width: 340rpx;
  244. }
  245. .ChangePassword .list .item .code {
  246. font-size: 32rpx;
  247. background-color: #fff;
  248. }
  249. .ChangePassword .list .item .code.on {
  250. color: #b9b9bc !important;
  251. }
  252. .ChangePassword .confirmBnt {
  253. font-size: 32rpx;
  254. width: 580rpx;
  255. height: 90rpx;
  256. border-radius: 45rpx;
  257. color: #fff;
  258. margin: 92rpx auto 0 auto;
  259. text-align: center;
  260. line-height: 90rpx;
  261. }
  262. </style>