index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view>
  3. <view style="background: #fff;margin: auto;border-radius: 5%;padding: 50rpx 80rpx;">
  4. <view>
  5. <picker @change="bindPickerChange" :value="index" :range="array">
  6. <view class="text_2 jiantou" style="color: #000;line-height: 90rpx;padding-left: 40rpx;">
  7. {{array[index]}}
  8. </view>
  9. </picker>
  10. </view>
  11. <view><input class="text_2" placeholder="请输入昵称" v-model="data.nick_name" /></view>
  12. <view><input class="text_2" placeholder="请输入手机号码" v-model="data.mobilephone" /></view>
  13. <view class="text_2"><input class="text_2" placeholder="短信验证码" v-model="data.yzm"
  14. style="float: left;width:150rpx;" />
  15. <view class="yzm" v-show="showTime == false" @click="yan">获取</view>
  16. <view class="yzm" v-show="showTime == true"> {{time}}</view>
  17. </view>
  18. <view><input class="text_2" password="true" type="safe-password" placeholder="请输入登录密码"
  19. v-model="data.mobilepwd" /></view>
  20. <view><input class="text_2" password="true" type="safe-password" placeholder="请再输入一次登录密码"
  21. v-model="data.mobilepwd1" /></view>
  22. <view><input class="text_2" password="true" type="safe-password" placeholder="请输入支付密码"
  23. v-model="data.paypwd" /></view><button class="text_6" @click="onClick_1">确认注册</button><button
  24. class="text_7" @click="onClick_2">
  25. <image src="../../static/anzhuo.png" style="width: 48rpx;height: 54rpx;"><text>下载app</text>
  26. </button>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. constants: {},
  35. data: {
  36. pid: '0',
  37. nick_name: '',
  38. mobilephone: '',
  39. mobilepwd: '',
  40. mobilepwd1: '',
  41. paypwd: '',
  42. yzm: '',
  43. zd: '请选择战队'
  44. },
  45. array: ['请选择战队',
  46. '西南区',
  47. '西北区',
  48. '华东区',
  49. '华南区',
  50. '华中区'
  51. ],
  52. index: 0,
  53. time: 60,
  54. showTime: false
  55. }
  56. },
  57. onLoad(option) {
  58. // console.log(option);
  59. if (option.pid > 0) {
  60. // console.log('option');
  61. this.data.pid = option.pid;
  62. // console.log(this.data.pid);
  63. }
  64. },
  65. methods: {
  66. dao() {
  67. var that = this
  68. var data = setTimeout(function() {
  69. that.time--; //console.log(that.time);
  70. that.dao();
  71. }, 1000)
  72. if (that.time == 0) {
  73. this.time = 60;
  74. that.showTime = false;
  75. clearTimeout(data);
  76. }
  77. },
  78. yan() {
  79. var myreg = /^[1][3,4,5,7,8,9][0 - 9] {9}$ /;
  80. var that = this;
  81. if (this.data.mobilephone == '') {
  82. uni.showToast({
  83. icon: 'none',
  84. duration: 800,
  85. title: '请先输入手机号'
  86. })
  87. } else {
  88. this.dao();
  89. this.showTime = true;
  90. var data = new Object();
  91. data.tel = this.data.mobilephone;
  92. this.$api.MhPostModel(data, "sms/yzm").then(res => {}).catch(
  93. err => {});
  94. }
  95. },
  96. bindPickerChange: function(e) {
  97. this.index = e.detail.value;
  98. this.data.zd = this.array[this.index];
  99. },
  100. onClick_1() {
  101. var data = new Object();
  102. data.sjh = this.data.mobilephone;
  103. data.mm = this.data.mobilepwd;
  104. data.pid = this.data.pid;
  105. data.nichen = this.data.nick_name;
  106. data.zd = this.data.zd;
  107. data.paypwd = this.data.paypwd;
  108. data.yzm = this.data.yzm;
  109. if (!data.sjh || !data.mm || !data.nichen || !data.paypwd || !data.yzm || data.zd == '请选择战队') {
  110. uni.showToast({
  111. title: "请输入完整信息后注册",
  112. icon: "none"
  113. });
  114. return;
  115. }
  116. if (data.zd == '请选择战队') {
  117. uni.showToast({
  118. title: "请选择战队",
  119. icon: "none"
  120. });
  121. return;
  122. }
  123. this.$api.MhPostModel(data, "user/reg").then(res => {
  124. // console.log('user/reg信息', JSON.stringify(res));
  125. if (res.data.code != 1) {
  126. uni.showToast({
  127. title: res.data.msg,
  128. icon: 'none'
  129. });
  130. return;
  131. }
  132. uni.showToast({
  133. title: '注册成功',
  134. icon: 'none'
  135. });
  136. setTimeout(function() {
  137. uni.navigateTo({
  138. url: '/pages/lanhu_login/index'
  139. });
  140. }, 2000);
  141. }).catch(err => {
  142. // console.log('request fail', JSON.stringify(err));
  143. });
  144. },
  145. onClick_2() {
  146. location.href = "https://aixiangcheng.qicaihong.info/down";
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="css">
  152. page {
  153. background: url(../../static/loginbg.png) #fff no-repeat;
  154. background-size: 100% auto;
  155. background-position: top;
  156. padding: 0;
  157. height: auto;
  158. margin: 0;
  159. padding-top: 480rpx;
  160. }
  161. .text_2 {
  162. background: #f5f5f8;
  163. font-size: 28rpx;
  164. height: 90rpx;
  165. line-height: 90rpx;
  166. padding-left: 20rpx;
  167. margin-bottom: 30rpx;
  168. border-radius: 10rpx;
  169. }
  170. .yzm {
  171. float: right;
  172. margin-right: 30rpx;
  173. background: #98a737;
  174. height: 60rpx;
  175. line-height: 60rpx;
  176. margin-top: 15rpx;
  177. padding: 0 20rpx;
  178. border-radius: 10rpx;
  179. font-size: 28rpx;
  180. color: #fff;
  181. }
  182. .text_6 {
  183. background-image: linear-gradient(#829c52, #59723b);
  184. color: #fff;
  185. border: 0;
  186. font-size: 28rpx;
  187. height: 90rpx;
  188. line-height: 90rpx;
  189. }
  190. .text_7 {
  191. margin-top: 30rpx;
  192. background: #fff;
  193. border: #59723b solid 1rpx;
  194. font-size: 28rpx;
  195. height: 90rpx;
  196. line-height: 90rpx;
  197. color: #59723b;
  198. }
  199. .text_7 image {
  200. display: inline-block;
  201. vertical-align: middle;
  202. padding-bottom: 15rpx;
  203. }
  204. .text_7 text {
  205. display: inline-block;
  206. margin-left: 20rpx;
  207. }
  208. .jiantou {
  209. background: url(../../static/jiantou.png) #f5f5f8 no-repeat;
  210. background-position: 98% center;
  211. background-size: 50rpx;
  212. }
  213. </style>