index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="container">
  3. <view class="container_text" >
  4. <!-- <image class="banner-img" src="/static/img/img01.png" mode="scaleToFill"></image> -->
  5. <view class="banner-img">
  6. <image src="../../static/img/logo2.png" mode=""></image>
  7. </view>
  8. </view>
  9. <!-- <view class="loginTitle"><text>注册</text></view> -->
  10. <view class="login_text">
  11. <view class="login_input flex">
  12. <view class="login_img"><image src="/static/icon/img03.png"></image></view>
  13. <view class="login_name"><input class="uni-input" v-model="phone" focus placeholder="请输入手机号" /></view>
  14. </view>
  15. <view class="login_input flex">
  16. <view class="login_img"><image src="/static/icon/img04.png"></image></view>
  17. <view class="login_name"><input class="uni-input" type="password" v-model="password" focus placeholder="请输入密码" /></view>
  18. </view>
  19. <view class="login_input flex">
  20. <view class="login_img"><image src="/static/icon/img04.png"></image></view>
  21. <view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus placeholder="请重复输入密码" /></view>
  22. </view>
  23. <view class="login_input flex">
  24. <view class="login_img"><image src="/static/icon/img07.png"></image></view>
  25. <view class="login_name"><input class="uni-input" type="text" v-model="invitation" focus placeholder="请输入邀请码" /></view>
  26. </view>
  27. <!-- <view class="login_input flex">
  28. <view class="login_img"><image src="/static/icon/img06.png"></image></view>
  29. <view class="login_name flex">
  30. <input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
  31. <view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
  32. </view>
  33. </view> -->
  34. <view><button type="green" @click="register" class="uni-button uni-button-green">注册账号</button></view>
  35. <!-- <view><a class="uni-button uni-button-green uni-button-green-plain" type="green" plain="true" hover-class="none" style="display: inline-block;">下载APP</a></view> -->
  36. <view class="flex">
  37. <view class="forget">
  38. <navigator @click="goDown">下载APP</navigator>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import { register, verify ,getAppInfo} from '@/api/login.js';
  46. export default {
  47. data() {
  48. return {
  49. phone: '', //用户
  50. password: '', //密码
  51. repassword: '',
  52. invitation: '', //邀请码
  53. code: '123456', //验证码
  54. time: '', //保存倒计时对象
  55. countDown: 0 ,//倒计时
  56. };
  57. },
  58. onLoad(opt) {
  59. // 获取扫码邀请人id
  60. // this.invitation = uni.getStorageSync('spread')||'';
  61. if(opt.spread) {
  62. this.invitation = opt.spread
  63. }
  64. },
  65. watch: {
  66. // 监听倒计时
  67. countDown(i) {
  68. if (i == 0) {
  69. clearInterval(this.time);
  70. }
  71. }
  72. },
  73. methods: {
  74. goDown() {
  75. getAppInfo().then(res => {
  76. window.open(res.data.url)
  77. })
  78. },
  79. // 注册
  80. register() {
  81. let obj = this;
  82. if (obj.phone == '') {
  83. obj.$api.msg('请输入电话号码');
  84. return;
  85. }
  86. if (!/(^1[2|3|4|5|6|7|8|9][0-9]{9}$)/.test(this.phone)) {
  87. obj.$api.msg('请输入正确的手机号');
  88. return;
  89. }
  90. if (obj.password == '') {
  91. obj.$api.msg('请输入密码');
  92. return;
  93. }
  94. if (obj.repassword == '') {
  95. obj.$api.msg('请再次输入密码');
  96. return;
  97. }
  98. if (obj.repassword != obj.password) {
  99. obj.$api.msg('两次密码不正确');
  100. return;
  101. }
  102. // if (obj.invitation == '') {
  103. // obj.$api.msg('请输入邀请码');
  104. // return;
  105. // }
  106. // if (obj.code == '') {
  107. // obj.$api.msg('请输入验证码');
  108. // return;
  109. // }
  110. register({
  111. account: obj.phone, //账号
  112. captcha: obj.code, //验证码
  113. password: obj.password ,//密码
  114. spread:this.invitation//上级推广人
  115. }).then(function(e) {
  116. uni.showToast({
  117. title:'注册成功',
  118. duration:2000,
  119. position:'top'
  120. });
  121. // setTimeout(function () {
  122. // uni.navigateTo({
  123. // url: '/pages/public/login'
  124. // });
  125. // },1000)
  126. });
  127. //调用注册接口,成功跳转登录页
  128. },
  129. //发送验证码
  130. verification() {
  131. let obj = this;
  132. if (this.phone == '') {
  133. this.$api.msg('请输入电话号码');
  134. return;
  135. }
  136. if (this.phone.length < 11) {
  137. this.$api.msg('请输入正确的手机号');
  138. return;
  139. }
  140. // 判断是否在倒计时
  141. if (obj.countDown > 0) {
  142. return false;
  143. } else {
  144. obj.countDown = 60;
  145. obj.time = setInterval(() => {
  146. obj.countDown--;
  147. }, 1000);
  148. //调用验证码接口
  149. verify({
  150. phone: obj.phone,
  151. type: 'register'
  152. })
  153. .then(({ data }) => {})
  154. .catch(err => {
  155. console.log(err);
  156. });
  157. }
  158. },
  159. login() {
  160. //返回登录
  161. uni.navigateTo({
  162. url: '/pages/public/login'
  163. });
  164. }
  165. }
  166. };
  167. </script>
  168. <style lang="scss">
  169. page {
  170. height: 100%;
  171. }
  172. .container {
  173. width: 100%;
  174. height: 100%;
  175. background-size: 100%;
  176. }
  177. .container_text {
  178. width: 100%;
  179. height: 500rpx;
  180. top: 0rpx;
  181. .banner-img {
  182. width: 100%;
  183. height: 100%;
  184. background-color: $base-color;
  185. position: relative;
  186. image {
  187. width: 150rpx;
  188. height:150rpx;
  189. border-radius: 50%;
  190. position: absolute;
  191. left: 0;
  192. right: 0;
  193. top:150rpx;
  194. margin: auto;
  195. }
  196. }
  197. }
  198. .login_text {
  199. margin: auto 30rpx;
  200. position: relative;
  201. padding: 100rpx 102rpx;
  202. background-color: #ffffff;
  203. margin-top: -180rpx;
  204. border-radius: 20rpx;
  205. .login_input {
  206. border-bottom: 1px solid #f0f0f0;
  207. margin-bottom: 65rpx;
  208. .login_img image {
  209. height: 35rpx;
  210. width: 29rpx;
  211. margin-right: 20rpx;
  212. }
  213. .uni-input {
  214. text-align: left;
  215. width: 470rpx;
  216. font-size: 28rpx !important;
  217. }
  218. .login_name {
  219. color: #333333;
  220. }
  221. }
  222. .other {
  223. margin-top: 60rpx;
  224. .fenge {
  225. width: 30%;
  226. height: 2rpx;
  227. background-color: #eeeeee;
  228. }
  229. .qita {
  230. font-size: 28rpx;
  231. color: #999999;
  232. }
  233. }
  234. .weixin {
  235. width: 75rpx;
  236. height: 75rpx;
  237. margin: 25rpx auto;
  238. }
  239. .weixin image {
  240. width: 100%;
  241. height: 100%;
  242. }
  243. .weixin_text {
  244. text-align: center;
  245. font-size: 28rpx;
  246. color: #999999;
  247. }
  248. .forget {
  249. font-size: 28rpx;
  250. width: 100%;
  251. text-align: right;
  252. color: #999999;
  253. }
  254. .uni-button-green {
  255. color: #ffffff;
  256. background-color: $base-color;
  257. margin: 40rpx 10rpx;
  258. border-radius: 50rpx;
  259. }
  260. .uni-button-green-plain {
  261. border: 1px solid $base-color;
  262. margin: 40rpx 10rpx;
  263. border-radius: 50rpx;
  264. color: $base-color;
  265. background-color: #ffffff;
  266. }
  267. .uni-button {
  268. height: 85rpx;
  269. line-height: 85rpx;
  270. }
  271. }
  272. .loginTitle {
  273. position: absolute;
  274. top: 250rpx;
  275. width: 100%;
  276. text-align: center;
  277. color: white;
  278. font-size: 40rpx;
  279. }
  280. .forget {
  281. width: 100rpx;
  282. font-size: 24rpx;
  283. color: #ffffff;
  284. margin: 0px auto;
  285. border-bottom: 1px solid #ffffff;
  286. }
  287. .width {
  288. width: 325rpx !important;
  289. }
  290. .code {
  291. color: $base-color;
  292. font-size: 23rpx;
  293. border-left: 1px solid #eeeeee;
  294. width: 150rpx;
  295. flex-shrink: 0;
  296. text-align: center;
  297. }
  298. uni-button {
  299. height: 80rpx !important;
  300. line-height: 80rpx !important;
  301. }
  302. </style>