index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. console.log(res)
  77. window.open('http://xrbt.qiniu1314.com/down/xrbt.apk')
  78. })
  79. },
  80. // 注册
  81. register() {
  82. let obj = this;
  83. if (obj.phone == '') {
  84. obj.$api.msg('请输入电话号码');
  85. return;
  86. }
  87. if (!/(^1[2|3|4|5|6|7|8|9][0-9]{9}$)/.test(this.phone)) {
  88. obj.$api.msg('请输入正确的手机号');
  89. return;
  90. }
  91. if (obj.password == '') {
  92. obj.$api.msg('请输入密码');
  93. return;
  94. }
  95. if (obj.repassword == '') {
  96. obj.$api.msg('请再次输入密码');
  97. return;
  98. }
  99. if (obj.repassword != obj.password) {
  100. obj.$api.msg('两次密码不正确');
  101. return;
  102. }
  103. // if (obj.invitation == '') {
  104. // obj.$api.msg('请输入邀请码');
  105. // return;
  106. // }
  107. // if (obj.code == '') {
  108. // obj.$api.msg('请输入验证码');
  109. // return;
  110. // }
  111. register({
  112. account: obj.phone, //账号
  113. captcha: obj.code, //验证码
  114. password: obj.password ,//密码
  115. spread:this.invitation//上级推广人
  116. }).then(function(e) {
  117. uni.showToast({
  118. title:'注册成功',
  119. duration:2000,
  120. position:'top'
  121. });
  122. // setTimeout(function () {
  123. // uni.navigateTo({
  124. // url: '/pages/public/login'
  125. // });
  126. // },1000)
  127. });
  128. //调用注册接口,成功跳转登录页
  129. },
  130. //发送验证码
  131. verification() {
  132. let obj = this;
  133. if (this.phone == '') {
  134. this.$api.msg('请输入电话号码');
  135. return;
  136. }
  137. if (this.phone.length < 11) {
  138. this.$api.msg('请输入正确的手机号');
  139. return;
  140. }
  141. // 判断是否在倒计时
  142. if (obj.countDown > 0) {
  143. return false;
  144. } else {
  145. obj.countDown = 60;
  146. obj.time = setInterval(() => {
  147. obj.countDown--;
  148. }, 1000);
  149. //调用验证码接口
  150. verify({
  151. phone: obj.phone,
  152. type: 'register'
  153. })
  154. .then(({ data }) => {})
  155. .catch(err => {
  156. console.log(err);
  157. });
  158. }
  159. },
  160. login() {
  161. //返回登录
  162. uni.navigateTo({
  163. url: '/pages/public/login'
  164. });
  165. }
  166. }
  167. };
  168. </script>
  169. <style lang="scss">
  170. page {
  171. height: 100%;
  172. }
  173. .container {
  174. width: 100%;
  175. height: 100%;
  176. background-size: 100%;
  177. }
  178. .container_text {
  179. width: 100%;
  180. height: 500rpx;
  181. top: 0rpx;
  182. .banner-img {
  183. width: 100%;
  184. height: 100%;
  185. background-color: $base-color;
  186. position: relative;
  187. image {
  188. width: 150rpx;
  189. height:150rpx;
  190. border-radius: 50%;
  191. position: absolute;
  192. left: 0;
  193. right: 0;
  194. top:150rpx;
  195. margin: auto;
  196. }
  197. }
  198. }
  199. .login_text {
  200. margin: auto 30rpx;
  201. position: relative;
  202. padding: 100rpx 102rpx;
  203. background-color: #ffffff;
  204. margin-top: -180rpx;
  205. border-radius: 20rpx;
  206. .login_input {
  207. border-bottom: 1px solid #f0f0f0;
  208. margin-bottom: 65rpx;
  209. .login_img image {
  210. height: 35rpx;
  211. width: 29rpx;
  212. margin-right: 20rpx;
  213. }
  214. .uni-input {
  215. text-align: left;
  216. width: 470rpx;
  217. font-size: 28rpx !important;
  218. }
  219. .login_name {
  220. color: #333333;
  221. }
  222. }
  223. .other {
  224. margin-top: 60rpx;
  225. .fenge {
  226. width: 30%;
  227. height: 2rpx;
  228. background-color: #eeeeee;
  229. }
  230. .qita {
  231. font-size: 28rpx;
  232. color: #999999;
  233. }
  234. }
  235. .weixin {
  236. width: 75rpx;
  237. height: 75rpx;
  238. margin: 25rpx auto;
  239. }
  240. .weixin image {
  241. width: 100%;
  242. height: 100%;
  243. }
  244. .weixin_text {
  245. text-align: center;
  246. font-size: 28rpx;
  247. color: #999999;
  248. }
  249. .forget {
  250. font-size: 28rpx;
  251. width: 100%;
  252. text-align: right;
  253. color: #999999;
  254. }
  255. .uni-button-green {
  256. color: #ffffff;
  257. background-color: $base-color;
  258. margin: 40rpx 10rpx;
  259. border-radius: 50rpx;
  260. }
  261. .uni-button-green-plain {
  262. border: 1px solid $base-color;
  263. margin: 40rpx 10rpx;
  264. border-radius: 50rpx;
  265. color: $base-color;
  266. background-color: #ffffff;
  267. }
  268. .uni-button {
  269. height: 85rpx;
  270. line-height: 85rpx;
  271. }
  272. }
  273. .loginTitle {
  274. position: absolute;
  275. top: 250rpx;
  276. width: 100%;
  277. text-align: center;
  278. color: white;
  279. font-size: 40rpx;
  280. }
  281. .forget {
  282. width: 100rpx;
  283. font-size: 24rpx;
  284. color: #ffffff;
  285. margin: 0px auto;
  286. border-bottom: 1px solid #ffffff;
  287. }
  288. .width {
  289. width: 325rpx !important;
  290. }
  291. .code {
  292. color: $base-color;
  293. font-size: 23rpx;
  294. border-left: 1px solid #eeeeee;
  295. width: 150rpx;
  296. flex-shrink: 0;
  297. text-align: center;
  298. }
  299. uni-button {
  300. height: 80rpx !important;
  301. line-height: 80rpx !important;
  302. }
  303. </style>