forget.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="container">
  3. <view class="container_text" >
  4. <image src="../../static/icon/logo.png" mode="" class="logo"></image>
  5. <view class="logo-tit"><text>博·赢</text></view>
  6. <!-- <image class="banner-img" src="/static/img/img01.png" mode="scaleToFill"></image> -->
  7. </view>
  8. <!-- <view class="loginTitle"><text>手机号登录</text></view> -->
  9. <view class="login_text">
  10. <view class="login_input flex">
  11. <view class="login_img"><image src="../../static/icon/icon-phone.png"></image></view>
  12. <view class="login_name"><input class="uni-input" v-model="phone" focus :placeholder="$t('hea.srsj')" /></view>
  13. </view>
  14. <view class="login_input flex">
  15. <view class="login_img"><image src="../../static/icon/icon-code.png"></image></view>
  16. <view class="login_name"><input class="uni-input" type="password" v-model="password" focus :placeholder="$t('hea.srxmm')" /></view>
  17. </view>
  18. <view class="login_input flex">
  19. <view class="login_img"><image src="../../static/icon/icon-code.png"></image></view>
  20. <view class="login_name"><input class="uni-input" type="password" v-model="repassword" focus :placeholder="$t('hea.srxmmt')" /></view>
  21. </view>
  22. <view class="login_input flex">
  23. <view class="login_img"><image src="../../static/icon/icon-yzm.png"></image></view>
  24. <view class="login_name flex">
  25. <input class="uni-input width" v-model="code" focus :placeholder="$t('hea.sryzm')" />
  26. <view class="code" @click="verification">{{ countDown == 0 ? $t('hea.yzm') : countDown }}</view>
  27. </view>
  28. </view>
  29. <view>
  30. <button type="green" @click="loding?register():''" class="uni-button uni-button-green">{{$t('hea.qrxg')}}</button>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { mapMutations } from 'vuex';
  37. import { verify, loginMobile, getUserInfo } from '@/api/login.js';
  38. import { registerReset } from '@/api/set.js';
  39. export default {
  40. data() {
  41. return {
  42. phone: '', //用户
  43. code: '', //验证码
  44. time: '', //保存倒计时对象
  45. countDown: 0, //倒计时
  46. password: '',
  47. repassword: '',
  48. loding:true,//是否载入中
  49. };
  50. },
  51. onLoad() {
  52. uni.setNavigationBarTitle({
  53. title:this.$t('foo.wjmm')
  54. })
  55. },
  56. watch: {
  57. // 监听倒计时
  58. countDown(i) {
  59. if (i == 0) {
  60. clearInterval(this.time);
  61. }
  62. }
  63. },
  64. methods: {
  65. ...mapMutations('user', ['setUserInfo', 'login']),
  66. // 手机登录
  67. register() {
  68. let obj = this;
  69. console.log('dianji')
  70. if (obj.phone == '') {
  71. obj.$api.msg('请输入电话号码');
  72. return;
  73. }
  74. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(this.phone)) {
  75. obj.$api.msg('请输入正确的手机号');
  76. return;
  77. }
  78. if(obj.password == '') {
  79. obj.$api.msg('请输入新密码')
  80. return
  81. }
  82. if(obj.password != obj.repassword) {
  83. obj.$api.msg('两次密码不一致')
  84. return
  85. }
  86. if (obj.code == '') {
  87. obj.$api.msg('请输入验证码');
  88. return;
  89. }
  90. obj.loding = false
  91. registerReset({
  92. // phone: obj.phone, //账号
  93. // captcha: obj.code,
  94. account: obj.account,
  95. captcha: obj.code,
  96. password: obj.password,
  97. }).then(function(e) {
  98. // uni.setStorageSync('token', e.data.token);
  99. // getUserInfo({}).then(e => {
  100. // obj.login();
  101. // // 保存返回用户数据
  102. // obj.setUserInfo(e.data);
  103. // //成功跳转首页
  104. // uni.switchTab({
  105. // url: '/pages/index/index'
  106. // });
  107. // });
  108. }).catch((e) => {
  109. console.log(e);
  110. });
  111. },
  112. //发送验证码
  113. verification() {
  114. let obj = this;
  115. if (this.phone == '') {
  116. this.$api.msg('请输入电话号码');
  117. return;
  118. }
  119. if (this.phone.length < 11) {
  120. this.$api.msg('请输入正确的手机号');
  121. return;
  122. }
  123. // 判断是否在倒计时
  124. if (obj.countDown > 0) {
  125. return false;
  126. } else {
  127. obj.countDown = 60;
  128. obj.time = setInterval(() => {
  129. obj.countDown--;
  130. }, 1000);
  131. //调用验证码接口
  132. verify({
  133. phone: obj.phone,
  134. type: 'login'
  135. })
  136. .then(({ data }) => {})
  137. .catch(err => {
  138. console.log(err);
  139. });
  140. }
  141. },
  142. login() {
  143. //返回登录
  144. uni.navigateTo({
  145. url: '/pages/public/login'
  146. });
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="scss">
  152. page {
  153. height: 100%;
  154. }
  155. .container {
  156. width: 100%;
  157. height: 100%;
  158. background-size: 100%;
  159. }
  160. .container_text {
  161. width: 100%;
  162. height: 500rpx;
  163. top: 0rpx;
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: center;
  167. align-items: center;
  168. .banner-img {
  169. width: 100%;
  170. height: 100%;
  171. }
  172. .logo {
  173. width: 186rpx;
  174. height: 196rpx;
  175. }
  176. .logo-tit {
  177. text-align: center;
  178. font-size: 36rpx;
  179. font-family: PingFang SC;
  180. font-weight: 400;
  181. color: #FAD6B0;
  182. }
  183. }
  184. .login_text {
  185. margin: auto 30rpx;
  186. position: relative;
  187. padding: 50rpx 102rpx 0;
  188. background-color: #000;
  189. // margin-top: -180rpx;
  190. border-radius: 20rpx;
  191. .login_input {
  192. padding-bottom: 20rpx;
  193. border-bottom: 1px solid #f0f0f0;
  194. margin-bottom: 65rpx;
  195. .login_img image {
  196. height: 35rpx;
  197. width: 29rpx;
  198. margin-right: 20rpx;
  199. }
  200. .uni-input {
  201. text-align: left;
  202. width: 470rpx;
  203. font-size: 28rpx !important;
  204. }
  205. .login_name {
  206. color: #fff;
  207. .width {
  208. width: 325rpx !important;
  209. }
  210. .code {
  211. color: #dbb189;
  212. font-size: 23rpx;
  213. border-left: 1px solid #eeeeee;
  214. width: 150rpx;
  215. flex-shrink: 0;
  216. text-align: center;
  217. }
  218. }
  219. }
  220. .uni-button-green {
  221. background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
  222. // border: 1px solid;
  223. border-image: linear-gradient(115deg, #FEEBD5, #FFFFFF, #E1AD7D) 1 1;
  224. box-shadow: 3rpx 4rpx 5rpx 0px rgba(151, 118, 74, 0.5);
  225. border-radius: 10rpx;
  226. font-size: 34rpx;
  227. font-family: PingFang SC;
  228. font-weight: 500;
  229. color: #874B19;
  230. }
  231. .uni-button {
  232. height: 85rpx;
  233. line-height: 85rpx;
  234. }
  235. }
  236. .loginTitle {
  237. position: absolute;
  238. top: 250rpx;
  239. width: 100%;
  240. text-align: center;
  241. color: white;
  242. font-size: 40rpx;
  243. }
  244. uni-button {
  245. height: 80rpx !important;
  246. line-height: 80rpx !important;
  247. }
  248. </style>