forget.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. type:'mobile',
  95. mobile: obj.phone,
  96. captcha: obj.code,
  97. newpassword: obj.password,
  98. }).then(function(e) {
  99. console.log(e)
  100. obj.$api.msg('修改成功');
  101. uni.navigateTo({
  102. url: '/pages/public/login'
  103. });
  104. }).catch((e) => {
  105. console.log(e);
  106. });
  107. },
  108. //发送验证码
  109. verification() {
  110. let obj = this;
  111. if (this.phone == '') {
  112. this.$api.msg('请输入手机号');
  113. return;
  114. }
  115. if (this.phone.length < 11) {
  116. this.$api.msg('请输入正确的手机号');
  117. return;
  118. }
  119. // 判断是否在倒计时
  120. if (obj.countDown > 0) {
  121. return false;
  122. } else {
  123. obj.countDown = 60;
  124. obj.time = setInterval(() => {
  125. obj.countDown--;
  126. }, 1000);
  127. //调用验证码接口
  128. verify({
  129. mobile: obj.phone,
  130. event: 'resetpwd'
  131. })
  132. .then(({ data }) => {})
  133. .catch(err => {
  134. console.log(err);
  135. });
  136. }
  137. },
  138. login() {
  139. //返回登录
  140. uni.navigateTo({
  141. url: '/pages/public/login'
  142. });
  143. }
  144. }
  145. };
  146. </script>
  147. <style lang="scss">
  148. page {
  149. height: 100%;
  150. }
  151. .container {
  152. width: 100%;
  153. height: 100%;
  154. background-size: 100%;
  155. }
  156. .container_text {
  157. width: 100%;
  158. height: 500rpx;
  159. top: 0rpx;
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: center;
  163. align-items: center;
  164. .banner-img {
  165. width: 100%;
  166. height: 100%;
  167. }
  168. .logo {
  169. width: 186rpx;
  170. height: 196rpx;
  171. }
  172. .logo-tit {
  173. text-align: center;
  174. font-size: 36rpx;
  175. font-family: PingFang SC;
  176. font-weight: 400;
  177. color: #FAD6B0;
  178. }
  179. }
  180. .login_text {
  181. margin: auto 30rpx;
  182. position: relative;
  183. padding: 50rpx 102rpx 0;
  184. background-color: #000;
  185. // margin-top: -180rpx;
  186. border-radius: 20rpx;
  187. .login_input {
  188. padding-bottom: 20rpx;
  189. border-bottom: 1px solid #f0f0f0;
  190. margin-bottom: 65rpx;
  191. .login_img image {
  192. height: 35rpx;
  193. width: 29rpx;
  194. margin-right: 20rpx;
  195. }
  196. .uni-input {
  197. text-align: left;
  198. width: 470rpx;
  199. font-size: 28rpx !important;
  200. }
  201. .login_name {
  202. color: #fff;
  203. .width {
  204. width: 325rpx !important;
  205. }
  206. .code {
  207. color: #dbb189;
  208. font-size: 23rpx;
  209. border-left: 1px solid #eeeeee;
  210. width: 150rpx;
  211. flex-shrink: 0;
  212. text-align: center;
  213. }
  214. }
  215. }
  216. .uni-button-green {
  217. background: linear-gradient(-74deg, #CE9C6D, #FFECD6);
  218. // border: 1px solid;
  219. border-image: linear-gradient(115deg, #FEEBD5, #FFFFFF, #E1AD7D) 1 1;
  220. box-shadow: 3rpx 4rpx 5rpx 0px rgba(151, 118, 74, 0.5);
  221. border-radius: 10rpx;
  222. font-size: 34rpx;
  223. font-family: PingFang SC;
  224. font-weight: 500;
  225. color: #874B19;
  226. }
  227. .uni-button {
  228. height: 85rpx;
  229. line-height: 85rpx;
  230. }
  231. }
  232. .loginTitle {
  233. position: absolute;
  234. top: 250rpx;
  235. width: 100%;
  236. text-align: center;
  237. color: white;
  238. font-size: 40rpx;
  239. }
  240. uni-button {
  241. height: 80rpx !important;
  242. line-height: 80rpx !important;
  243. }
  244. </style>