forget.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="zai-box">
  3. <view class="zai-viewl">
  4. <image src="/static/theme/default/logo.png" mode='aspectFit' class="zai-logo"></image>
  5. </view>
  6. <view class="zai-form">
  7. <input class="zai-input" v-model="form.username" placeholder="请输入手机号" />
  8. <view class="form-code" >
  9. <input class="code-input" v-model="form.sms_code" placeholder="请输入验证码" />
  10. <button class="code" @tap="getCode" v-if="showText"> 获取验证码</button>
  11. <button class="code" v-else>{{second}}重新发送</button>
  12. </view>
  13. <!-- <input class="zai-input" placeholder-class password placeholder="请输入密码"/> -->
  14. <input class="zai-input" v-model="form.password" type="password" placeholder="请输入密码"/>
  15. <button :class="['landing',checkIn ? 'landing_true' : 'landing_false']"
  16. :disabled="checkIn ? false : true" class="zai-btn" @tap="subForge">确认</button>
  17. <navigator url="./login" open-type='navigateBack' hover-class="none" class="zai-label">已有账号,点此去登录.</navigator>
  18. </view>
  19. <!-- <view class="zai-footer" @tap="goPath">《使用条款和隐私政策》</view> -->
  20. <view class="zai-footer">
  21. <text class="tips" @tap="goTerms">《服务协议》</text><text class="tips" @tap="goPrivacy">《隐私协议》</text>
  22. </view>
  23. <uni-popup ref="popup" type="confirm">
  24. <uni-popup-confirm title="温馨提示" :beforeClose="true" @close="close" :content="popuMsg" @confirm = "confirm"> </uni-popup-confirm>
  25. </uni-popup>
  26. </view>
  27. </template>
  28. <script>
  29. import uniPopup from '../../components/uni-popup/uni-popup.vue';
  30. import uniPopupConfirm from '../../components/uni-popup/uni-popup-confirm.vue';
  31. import _get from "../../common/_get";
  32. export default {
  33. data () {
  34. return {
  35. miaoqiang:'',
  36. popuMsg:'恭喜您注册成功,是否立即更改资料?',
  37. showPassword: true,
  38. showText:true,
  39. second:60,
  40. form: {
  41. mobileCode:1,
  42. username: '',
  43. password: '',
  44. client_id:'',
  45. sms_code:'',
  46. type:'FORGET_PASSWORD',
  47. }
  48. }
  49. },
  50. components:{
  51. uniPopup,
  52. uniPopupConfirm
  53. },
  54. onLoad () {
  55. },
  56. onShow(){
  57. console.log(this.form.mobileCode);
  58. let _this = this;
  59. // #ifdef APP-PLUS
  60. // plus.push.getClientInfoAsync(function(info){
  61. // _this.form.client_id = info.clientid;
  62. // },function(e){
  63. // });
  64. // #endif
  65. },
  66. computed: {
  67. checkIn () {
  68. return this.form.password != '' && this.form.username != '' && this.form.password.length > 5 && this.form.username.length > 5;
  69. }
  70. },
  71. methods: {
  72. goTerms() {
  73. uni.navigateTo({
  74. 'url': '/pages/in/terms'
  75. })
  76. },
  77. goPrivacy() {
  78. uni.navigateTo({
  79. 'url': '/pages/in/privacy'
  80. })
  81. },
  82. goPath(){
  83. uni.navigateTo({'url':'/pages/in/web'})
  84. },
  85. close(){
  86. let _this = this;
  87. uni.reLaunch({
  88. url: '../chat/index',
  89. success:function () {
  90. _this.$refs.popup.close();
  91. }
  92. });
  93. },
  94. confirm(e){
  95. let _this = this;
  96. uni.redirectTo({
  97. url: '/pages/my/details',
  98. success:function () {
  99. _this.$refs.popup.close();
  100. }
  101. });
  102. },
  103. isPoneAvailable($poneInput) {
  104. let myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  105. if (!myreg.test($poneInput)) {
  106. return false;
  107. } else {
  108. return true;
  109. }
  110. },
  111. getCode(){
  112. let _this = this;
  113. if(this.form.username.trim() == ''){
  114. uni.showToast({
  115. title: '请输入手机号',
  116. icon:'none'
  117. });
  118. return false;
  119. }
  120. if(!this.isPoneAvailable(this.form.username.trim())){
  121. uni.showToast({
  122. title: '请输入正确的手机号',
  123. icon:'none'
  124. });
  125. return false;
  126. }
  127. _get.getSms({mobile:this.form.username,type:_this.form.type},function (res) {
  128. _this.cutDown();
  129. },function (res) {
  130. uni.showToast({
  131. title: res.msg,
  132. duration:2000,
  133. icon:'none'
  134. });
  135. })
  136. },
  137. cutDown(val){//倒计时
  138. //获取验证码
  139. this.showText = false;
  140. var interval = setInterval(() => {
  141. let times = --this.second;
  142. times = times < 0 ? 0 : times;
  143. this.second = times<10?'0'+times:times //小于10秒补 0
  144. }, 1000)
  145. setTimeout(() => {
  146. clearInterval(interval)
  147. this.second=60
  148. this.showText = true
  149. }, 60000)
  150. },
  151. changePassword () {
  152. this.showPassword = !this.showPassword;
  153. },
  154. delInputUsernameText () {
  155. this.form.username = ''
  156. },
  157. delInputPasswordText () {
  158. this.form.password = ''
  159. },
  160. subForge () {
  161. let _this = this;
  162. if (!_this.checkIn) {
  163. return;
  164. }
  165. if (!(/^\w{1,20}$/.test(this.form.username))) {
  166. uni.showModal({
  167. content: '新聊号只能包括下划线、数字、字母,并且不能超过20个',
  168. });
  169. return;
  170. }
  171. if (!(/^\w{1,20}$/.test(this.form.password))) {
  172. uni.showModal({
  173. content: '密码只能包括下划线、数字、字母,长度6-20位',
  174. });
  175. return;
  176. }
  177. uni.showLoading({title:''})
  178. _this.$httpSend({
  179. path: '/im/in/forgetPassword',
  180. data: _this.form,
  181. success: (data) => {
  182. uni.showToast('修改成功');
  183. setTimeout(function () {
  184. uni.redirectTo({url:'login'});
  185. },1500)
  186. }
  187. });
  188. },
  189. go_forget () {
  190. uni.navigateTo({
  191. url: '../../pages/in/forget'
  192. })
  193. },
  194. go_register () {
  195. uni.navigateTo({
  196. url: '../../pages/in/reg'
  197. })
  198. }
  199. }
  200. }
  201. </script>
  202. <style>
  203. page{
  204. background-color: #FFFFFF;
  205. }
  206. .zai-viewl{
  207. width: 100%;
  208. display: flex;
  209. justify-content: center;
  210. }
  211. .zai-box{
  212. padding: 0 100upx;
  213. position: relative;
  214. }
  215. .zai-logo{
  216. width: 160upx;
  217. width: 160upx;
  218. height: 160upx;
  219. margin-top: 100upx;
  220. }
  221. .zai-title{
  222. position: absolute;
  223. top: 0;
  224. line-height: 360upx;
  225. font-size: 68upx;
  226. color: #fff;
  227. text-align: center;
  228. width: 100%;
  229. margin-left: -100upx;
  230. }
  231. .zai-form{
  232. margin-top: 150upx;
  233. }
  234. .form-code{
  235. margin-top: 30upx;
  236. display: flex;
  237. justify-content: center;
  238. align-items: center;
  239. height: 100%;
  240. }
  241. .form-code .code{
  242. height: 100%;
  243. border-radius: 50px;
  244. text-align: center;
  245. font-size: 14px;
  246. background: #6dcef7;
  247. color: #ffffff;
  248. }
  249. .zai-input{
  250. background: #e2f5fc;
  251. margin-top: 30upx;
  252. border-radius: 100upx;
  253. padding: 20upx 40upx;
  254. font-size: 36upx;
  255. }
  256. .code-input{
  257. background: #e2f5fc;
  258. border-radius: 100upx;
  259. padding: 20upx 40upx;
  260. font-size: 36upx;
  261. width: 40%;
  262. }
  263. .input-placeholder, .zai-input{
  264. color: #94afce;
  265. }
  266. .zai-label{
  267. padding: 60upx 0;
  268. text-align: center;
  269. font-size: 30upx;
  270. color: #a7b6d0;
  271. }
  272. .zai-btn{
  273. background: #ff65a3;
  274. color: #fff;
  275. border: 0;
  276. border-radius: 100upx;
  277. font-size: 36upx;
  278. margin-top: 60upx;
  279. }
  280. .zai-btn:after{
  281. border: 0;
  282. }
  283. /*按钮点击效果*/
  284. .zai-btn.button-hover{
  285. transform: translate(1upx, 1upx);
  286. }
  287. .zai-footer{
  288. display: flex;
  289. justify-content: center;
  290. align-items: center;
  291. color: #a7b6d0;
  292. padding-top: 10px;
  293. }
  294. </style>