123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <template>
- <view class="zai-box">
- <view class="zai-viewl">
- <image src="/static/theme/default/logo.png" mode='aspectFit' class="zai-logo"></image>
- </view>
- <view class="zai-form">
- <input class="zai-input" v-model="form.username" placeholder="请输入手机号" />
- <view class="form-code" >
- <input class="code-input" v-model="form.sms_code" placeholder="请输入验证码" />
- <button class="code" @tap="getCode" v-if="showText"> 获取验证码</button>
- <button class="code" v-else>{{second}}重新发送</button>
- </view>
- <!-- <input class="zai-input" placeholder-class password placeholder="请输入密码"/> -->
- <input class="zai-input" v-model="form.password" type="password" placeholder="请输入密码"/>
- <button :class="['landing',checkIn ? 'landing_true' : 'landing_false']"
- :disabled="checkIn ? false : true" class="zai-btn" @tap="subForge">确认</button>
- <navigator url="./login" open-type='navigateBack' hover-class="none" class="zai-label">已有账号,点此去登录.</navigator>
- </view>
- <!-- <view class="zai-footer" @tap="goPath">《使用条款和隐私政策》</view> -->
- <view class="zai-footer">
- <text class="tips" @tap="goTerms">《服务协议》</text><text class="tips" @tap="goPrivacy">《隐私协议》</text>
- </view>
- <uni-popup ref="popup" type="confirm">
- <uni-popup-confirm title="温馨提示" :beforeClose="true" @close="close" :content="popuMsg" @confirm = "confirm"> </uni-popup-confirm>
- </uni-popup>
- </view>
- </template>
- <script>
- import uniPopup from '../../components/uni-popup/uni-popup.vue';
- import uniPopupConfirm from '../../components/uni-popup/uni-popup-confirm.vue';
- import _get from "../../common/_get";
- export default {
- data () {
- return {
- miaoqiang:'',
- popuMsg:'恭喜您注册成功,是否立即更改资料?',
- showPassword: true,
- showText:true,
- second:60,
- form: {
- mobileCode:1,
- username: '',
- password: '',
- client_id:'',
- sms_code:'',
- type:'FORGET_PASSWORD',
- }
- }
- },
- components:{
- uniPopup,
- uniPopupConfirm
- },
- onLoad () {
- },
- onShow(){
- console.log(this.form.mobileCode);
- let _this = this;
- // #ifdef APP-PLUS
- // plus.push.getClientInfoAsync(function(info){
- // _this.form.client_id = info.clientid;
- // },function(e){
- // });
- // #endif
- },
- computed: {
- checkIn () {
- return this.form.password != '' && this.form.username != '' && this.form.password.length > 5 && this.form.username.length > 5;
- }
- },
- methods: {
- goTerms() {
- uni.navigateTo({
- 'url': '/pages/in/terms'
- })
- },
- goPrivacy() {
- uni.navigateTo({
- 'url': '/pages/in/privacy'
- })
- },
- goPath(){
- uni.navigateTo({'url':'/pages/in/web'})
- },
- close(){
- let _this = this;
- uni.reLaunch({
- url: '../chat/index',
- success:function () {
- _this.$refs.popup.close();
- }
- });
- },
- confirm(e){
- let _this = this;
- uni.redirectTo({
- url: '/pages/my/details',
- success:function () {
- _this.$refs.popup.close();
- }
- });
- },
- isPoneAvailable($poneInput) {
- let myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
- if (!myreg.test($poneInput)) {
- return false;
- } else {
- return true;
- }
- },
- getCode(){
- let _this = this;
- if(this.form.username.trim() == ''){
- uni.showToast({
- title: '请输入手机号',
- icon:'none'
- });
- return false;
- }
- if(!this.isPoneAvailable(this.form.username.trim())){
- uni.showToast({
- title: '请输入正确的手机号',
- icon:'none'
- });
- return false;
- }
- _get.getSms({mobile:this.form.username,type:_this.form.type},function (res) {
- _this.cutDown();
- },function (res) {
- uni.showToast({
- title: res.msg,
- duration:2000,
- icon:'none'
- });
- })
- },
- cutDown(val){//倒计时
- //获取验证码
- this.showText = false;
- var interval = setInterval(() => {
- let times = --this.second;
- times = times < 0 ? 0 : times;
- this.second = times<10?'0'+times:times //小于10秒补 0
- }, 1000)
- setTimeout(() => {
- clearInterval(interval)
- this.second=60
- this.showText = true
- }, 60000)
- },
- changePassword () {
- this.showPassword = !this.showPassword;
- },
- delInputUsernameText () {
- this.form.username = ''
- },
- delInputPasswordText () {
- this.form.password = ''
- },
- subForge () {
- let _this = this;
- if (!_this.checkIn) {
- return;
- }
- if (!(/^\w{1,20}$/.test(this.form.username))) {
- uni.showModal({
- content: '新聊号只能包括下划线、数字、字母,并且不能超过20个',
- });
- return;
- }
- if (!(/^\w{1,20}$/.test(this.form.password))) {
- uni.showModal({
- content: '密码只能包括下划线、数字、字母,长度6-20位',
- });
- return;
- }
- uni.showLoading({title:''})
- _this.$httpSend({
- path: '/im/in/forgetPassword',
- data: _this.form,
- success: (data) => {
- uni.showToast('修改成功');
- setTimeout(function () {
- uni.redirectTo({url:'login'});
- },1500)
- }
- });
- },
- go_forget () {
- uni.navigateTo({
- url: '../../pages/in/forget'
- })
- },
- go_register () {
- uni.navigateTo({
- url: '../../pages/in/reg'
- })
- }
- }
- }
- </script>
- <style>
- page{
- background-color: #FFFFFF;
- }
- .zai-viewl{
- width: 100%;
- display: flex;
- justify-content: center;
- }
- .zai-box{
- padding: 0 100upx;
- position: relative;
- }
- .zai-logo{
- width: 160upx;
- width: 160upx;
- height: 160upx;
- margin-top: 100upx;
- }
- .zai-title{
- position: absolute;
- top: 0;
- line-height: 360upx;
- font-size: 68upx;
- color: #fff;
- text-align: center;
- width: 100%;
- margin-left: -100upx;
- }
- .zai-form{
- margin-top: 150upx;
- }
- .form-code{
- margin-top: 30upx;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100%;
- }
- .form-code .code{
- height: 100%;
- border-radius: 50px;
- text-align: center;
- font-size: 14px;
- background: #6dcef7;
- color: #ffffff;
- }
- .zai-input{
- background: #e2f5fc;
- margin-top: 30upx;
- border-radius: 100upx;
- padding: 20upx 40upx;
- font-size: 36upx;
- }
- .code-input{
- background: #e2f5fc;
- border-radius: 100upx;
- padding: 20upx 40upx;
- font-size: 36upx;
- width: 40%;
- }
- .input-placeholder, .zai-input{
- color: #94afce;
- }
- .zai-label{
- padding: 60upx 0;
- text-align: center;
- font-size: 30upx;
- color: #a7b6d0;
- }
- .zai-btn{
- background: #ff65a3;
- color: #fff;
- border: 0;
- border-radius: 100upx;
- font-size: 36upx;
- margin-top: 60upx;
- }
- .zai-btn:after{
- border: 0;
- }
- /*按钮点击效果*/
- .zai-btn.button-hover{
- transform: translate(1upx, 1upx);
- }
- .zai-footer{
- display: flex;
- justify-content: center;
- align-items: center;
- color: #a7b6d0;
- padding-top: 10px;
- }
- </style>
|