Merge branch 'master' of http://218.28.192.34:9999/r/sqys/sqys_xcx
| | |
| | | // 新注册获取验证码 /verify/getNew |
| | | export function getNewVerify(data) { |
| | | return http.get(`/verify/getNew`, {params: data}); |
| | | } |
| | | // 更换手机号码 updatePhone |
| | | export function updatePhone(data) { |
| | | return http.post(`/system/user/profile/updatePhone/${data.phone}`, data); |
| | | } |
| | |
| | | export function orderUpd(data) { |
| | | return http.post(`/enforce/order/doResultOrder`, data, { custom: { loading: true }}); |
| | | } |
| | | // 企业被执法次数 /report/team/getCompanyCount |
| | | export function getCompanyCount(data) { |
| | | return http.get(`/report/team/getCompanyCount`, data, { custom: { loading: true }}); |
| | | } |
| | |
| | | // vm.$u.vuex('userInfo', null) |
| | | // vm.$u.vuex('token', null) |
| | | // uni.removeStorageSync("sessionToken") |
| | | // uni.clearStorageSync() // 清楚所有的缓存 |
| | | uni.clearStorageSync() // 清楚所有的缓存 |
| | | uni.showToast({ |
| | | title: '授权过期,请重新登录', |
| | | icon: 'none', |
| | |
| | | 手机号 |
| | | </view> |
| | | <view class="form-input"> |
| | | <input type="number" placeholder="请输入11位手机号"/> |
| | | <input type="number" placeholder="请输入11位手机号" v-model="form.phone"/> |
| | | </view> |
| | | </view> |
| | | <view class="form-item"> |
| | |
| | | 验证码 |
| | | </view> |
| | | <view class="form-input set-flex set-flex-content-between"> |
| | | <input type="number" placeholder="请输入验证码"/> |
| | | <input type="number" placeholder="请输入验证码" v-model="form.code"/> |
| | | <view @click="getCode"> |
| | | <text class="driver"></text> |
| | | <text class="getcode">{{tips}}</text> |
| | |
| | | </view> |
| | | </view> |
| | | <view style="margin-top: 56rpx;"> |
| | | <view class="per-button" @click="loging">修改手机号</view> |
| | | <view class="per-button" @click="changeCode">修改手机号</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | // 00营商办,01执法,02企业 区分不同的登陆页面 |
| | | import { getCode, codeLogin, getInfo } from '@/api/auth.js' |
| | | import { getNewVerify, getInfo, checkCode, updatePhone } from '@/api/auth.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | console.log(options) |
| | | if(options.code) { |
| | | this.form.userType = options.code |
| | | } |
| | |
| | | uni.showLoading({ |
| | | title: '正在获取验证码' |
| | | }) |
| | | getCode({phone: this.form.phone }).then(val => { |
| | | this.startCountdown() |
| | | uni.hideLoading(); |
| | | uni.$u.toast('验证码已发送'); |
| | | getNewVerify({phone: this.form.phone }).then(val => { |
| | | if(val.data.code == 200) { |
| | | this.startCountdown() |
| | | uni.hideLoading(); |
| | | this.tips = `${this.countdownTime}s后重新获取` |
| | | uni.$u.toast('验证码已发送'); |
| | | } |
| | | }) |
| | | } else { |
| | | uni.$u.toast('倒计时结束后再发送'); |
| | |
| | | this.startCountdown() |
| | | }, 1000) |
| | | }, |
| | | loging() { |
| | | codeLogin(this.form).then(val => { |
| | | if(val.data.token) { |
| | | this.loginToken = val.data.token |
| | | uni.setStorageSync('sessionToken', this.loginToken) |
| | | this.getInfo() |
| | | async checkCode() { |
| | | try{ |
| | | const { data } = await checkCode(this.form) |
| | | if(data.code == 200 && data.data) { |
| | | return Promise.resolve() |
| | | } else { |
| | | uni.showToast({ |
| | | title: '验证码错误', |
| | | icon: 'none' |
| | | }) |
| | | throw "验证码错误" |
| | | return Promise.reject('验证码错误') |
| | | } |
| | | } catch(err) { |
| | | uni.showToast({ |
| | | title: '验证码错误', |
| | | icon: 'none' |
| | | }) |
| | | throw "验证码错误" |
| | | } |
| | | }, |
| | | async changeCode() { |
| | | await this.checkCode() |
| | | if(!this.form.phone){ |
| | | uni.showToast({ |
| | | title: '请输入手机号', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | if(!this.$u.test.mobile(this.form.phone)){ |
| | | uni.showToast({ |
| | | title: '请输入正确的手机号', |
| | | icon: 'none' |
| | | }) |
| | | return |
| | | } |
| | | updatePhone(this.form).then(val => { |
| | | if(val.data.code == 200) { |
| | | uni.showToast({ |
| | | title: '修改成功', |
| | | icon: 'none' |
| | | }) |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 500) |
| | | } |
| | | |
| | | }) |
| | | }, |
| | | getInfo() { |
| | |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="logout"> |
| | | <view class="logout" @click="logOut"> |
| | | 退出登录 |
| | | </view> |
| | | </view> |
| | |
| | | methods: { |
| | | goChangePhone() { |
| | | uni.navigateTo({ |
| | | url: '/policy/changePhone/changePhone' |
| | | url: `/policy/changePhone/changePhone?code=${this.userInfo.data.userType}` |
| | | }) |
| | | }, |
| | | logOut() { |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '确认退出登录?', |
| | | success: res => { |
| | | if(res.confirm) { |
| | | uni.clearStorageSync() |
| | | uni.redirectTo({ |
| | | url: '/pages/index/index' |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |