diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 374b767..01c029b 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -22,10 +22,10 @@ const install = (Vue, vm) => { uni.setStorageSync('deptId', 100); Vue.prototype.$u.http.setConfig({ // baseUrl: 'http://61.174.243.28:15861', - // baseUrl: 'http://192.168.2.14:8080', + baseUrl: 'http://192.168.2.46:8080', // baseUrl: 'http://124.221.246.124:2289', // baseUrl: 'https://dianche.chuantewulian.cn/prod-api', - baseUrl: 'https://dche.ccttiot.com/prod-api', + // baseUrl: 'https://dche.ccttiot.com/prod-api', loadingText: '努力加载中~', loadingTime: 50000, @@ -52,9 +52,9 @@ const install = (Vue, vm) => { // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 - const token = uni.getStorageSync('token'); + // const token = uni.getStorageSync('token'); - // const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE1ZmE2YzM0LWM0Y2YtNGEwMS05YjY2LTE1M2M4YWY1YzU1YSJ9.Wze_tAjY7cCfw2K6mtDpTSd-QFLRF4A49Fx7bq7g2tVLKL4v5bqqHfpG0VQy7_a_CUQch5RPBTBIKMVCDupIqg" + const token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQ0ZDljYzBlLThjZjEtNGFkOC05OGFjLThlNThjMWIxYjQ3OSJ9.v-aMkp9t7Z_QfjfsZy6d_1Ng76hPYa0A--SWScMJY9to7UlNv9IxHQnTJylLKdYKGrr8fRZ47Bu12UPm1DgMQg" // console.log("我是token", token) config.header.Authorization = token; diff --git a/pages/bind_mac.vue b/pages/bind_mac.vue index 26a87b3..a0873f1 100644 --- a/pages/bind_mac.vue +++ b/pages/bind_mac.vue @@ -17,8 +17,18 @@ - + + + + 版本: 版本id: + + + + + 版本介绍: + + 确认添加 @@ -91,8 +101,9 @@ }, sn:'', carstause:false, - isbands:false - + isbands:false, + show:false, + list:[] @@ -104,6 +115,9 @@ this.isbands=false this.carstause=false }, + onShow() { + this.getlist() + }, onUnload: function() { xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); xBlufi.notifyStartDiscoverBle({ @@ -128,6 +142,29 @@ }, methods: { + confirm(e){ + // console.log(e); + uni.setStorageSync('adminAreaid', e[0].value); + this.areaId= e[0].value + + + }, + getlist(){ + this.$u.get('/app/hardwareVersion/list').then((res) => { + if (res.code === 200) { + this.list = res.data.map(item => ({ + value: item.id, + label: item.version + })); + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }, send(){ this.$u.post('/app/device/ring?sn=' + this.sn).then((res) => { if (res.code === 200) { @@ -639,6 +676,10 @@ font-size: 32rpx; color: #FFFFFF; } + .tips{ + margin: 28rpx auto 0; + width: 658rpx; + } .iptbox { display: flex; align-items: center; diff --git a/pages/login/login.vue b/pages/login/login.vue index 474c165..c4dac13 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -25,13 +25,62 @@ 微信登录 - 授权登录 + 手机号登录 - + + + 登录 + + + + 手机号 + + + + + + + 验证码 + + + + + {{ codeButtonText }} + + + + + 密码 + + + + + + 注册并登录 + + + 已有帐号?立即登录 + + + + 其他登录方式 + + + + + + + + 登录 @@ -41,7 +90,52 @@ - + + + + + 密码 + + + + + + + + + + 忘记密码 + + + 登录 + + + 没有账号?立即注册 + + + + 其他登录方式 + + + + + + + + + + + + + 手机号 + + + + @@ -50,38 +144,45 @@ 验证码 - - - - 获取验证码 + + {{ codeButtonText2 }} - 密码 + 新密码 - - - - 注册并登录 + + + 确认密码 - - 已有帐号?立即登录 + + + - - - 其他登录方式 - + + + + + - - + + 确定 + + + @@ -113,14 +214,338 @@ usertype: '', login: false, deptId: '', - pageindex: 1, + pageindex: 0, + phone: '', + phoneCode: '', + password: '', + isCodeButtonDisabled: false, + codeButtonText: '获取验证码', + countdown: 60, + uuid: '', + isSubButtonActive: false, + isSubButtonActive1: false, + isSubButtonActive2:false, + phone1:'', + password1:'', + interval:null, + phone2:'', + phoneCode2:'', + password2:'', + subpassword2:'', + isCodeButtonDisabled2: false, + codeButtonText2: '获取验证码', + countdown2: 60, } }, onLoad() { this.deptId = uni.getStorageSync('deptId'); // this.deptId = 101 }, + computed: { + codeButtonStyle() { + return this.isCodeButtonDisabled ? 'background: #979797;' : ''; + }, + + }, + watch: { + phone() { + this.checkInputFields(); + }, + phoneCode() { + this.checkInputFields(); + }, + password() { + this.checkInputFields(); + }, + phone1(){ + this.checkInputFields1(); + }, + password1() { + this.checkInputFields1(); + }, + + phone2(){ + this.checkInputFields2(); + }, + phoneCode2() { + this.checkInputFields2(); + }, + password2(){ + this.checkInputFields2(); + }, + subpassword2() { + this.checkInputFields2(); + }, + }, methods: { + page3(){ + this.pageindex=3 + this.phone1='' + this.password1='' + }, + page1(){ + // clearInterval(this.interval) + this.pageindex=1 + this.phone1='' + + this.password1='' + }, + page2(){ + // clearInterval(this.interval) + this.pageindex=2 + this.phone='' + this.phoneCode='' + this.password='' + }, + sub3(){ + if (!this.phone2 || !this.phoneCode2|| !this.password2|| !this.subpassword2) { + + uni.showToast({ + title: '请完整填写信息', + icon: 'none', + duration: 2000 + }); + return; + } + if (!this.validatePhone(this.phone2)) { + uni.showToast({ + title: '手机号格式不正确', + icon: 'none', + duration: 2000 + }); + return; + } + if (this.subpassword2 != this.password2) { + + uni.showToast({ + title: '两次密码输入不一致', + icon: 'none', + duration: 2000 + }); + return; + } + this.$u.put("/app/forgetAppPwd?phone="+this.phone2+'&newPassword='+this.password2+'&phoneCode='+this.phoneCode2+'&uuid='+this.uuid).then((res) => { + if (res.code == 200) { + // 登录成功后的操作 + this.pageindex=2 + this.phone2='' + this.phoneCode2='' + this.uuid='' + this.password2='' + this.subpassword2='' + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + }, + // 密码登录 + sub2(){ + if (!this.phone1 || !this.password1) { + + uni.showToast({ + title: '请完整填写信息', + icon: 'none', + duration: 2000 + }); + return; + } + if (!this.validatePhone(this.phone1)) { + uni.showToast({ + title: '手机号格式不正确', + icon: 'none', + duration: 2000 + }); + return; + } + let areaId = uni.getStorageSync('areaId'); + let data = { + phone: this.phone1, + password: this.password1, + areaId: areaId, + + + } + this.$u.post("/appCodeLogin", data).then((res) => { + if (res.code == 200) { + // 登录成功后的操作 + wx.setStorageSync('token', res.token); + this.ceshi() + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + }, + checkInputFields2() { + if (this.phone2&& this.phoneCode2 && this.password2&&this.subpassword2) { + this.isSubButtonActive2 = true; + } else { + this.isSubButtonActive2 = false; + } + }, + checkInputFields1() { + if (this.phone1 && this.password1) { + this.isSubButtonActive1 = true; + } else { + this.isSubButtonActive1 = false; + } + }, + checkInputFields() { + if (this.phone && this.phoneCode && this.password) { + this.isSubButtonActive = true; + } else { + this.isSubButtonActive = false; + } + }, + validatePhone(phone) { + const phoneRegex = /^1[3-9]\d{9}$/; + return phoneRegex.test(phone); + }, + getcode() { + if (this.isCodeButtonDisabled) return; + if (!this.phone) { + uni.showToast({ + title: '请输入手机号', + icon: 'none', + duration: 2000 + }); + return; + } + if (!this.validatePhone(this.phone)) { + uni.showToast({ + title: '手机号格式不正确', + icon: 'none', + duration: 2000 + }); + return; + } + this.isCodeButtonDisabled = true; + this.$u.get("/appCaptcha?type=1&phone=" + this.phone).then((res) => { + if (res.code == 200) { + this.uuid = res.uuid + this.startCountdown(); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + this.isCodeButtonDisabled = false; + } + }); + }, + getcode2() { + if (this.isCodeButtonDisabled) return; + if (!this.phone2) { + uni.showToast({ + title: '请输入手机号', + icon: 'none', + duration: 2000 + }); + return; + } + if (!this.validatePhone(this.phone2)) { + uni.showToast({ + title: '手机号格式不正确', + icon: 'none', + duration: 2000 + }); + return; + } + this.isCodeButtonDisabled2 = true; + this.$u.get("/appCaptcha?type=1&phone=" + this.phone2).then((res) => { + if (res.code == 200) { + this.uuid = res.uuid + this.startCountdown2(); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + this.isCodeButtonDisabled2 = false; + } + }); + }, + startCountdown2() { + this.codeButtonText2 = `${this.countdown}秒后重发`; + const interval = setInterval(() => { + this.countdown2--; + if (this.countdown2 <= 0) { + clearInterval(interval); + this.codeButtonText2 = '获取验证码'; + this.isCodeButtonDisabled2 = false; + this.countdown2 = 60; + } else { + this.codeButtonText2 = `${this.countdown2}秒后重发`; + } + }, 1000); + }, + startCountdown() { + this.codeButtonText = `${this.countdown}秒后重发`; + this.interval = setInterval(() => { + this.countdown--; + if (this.countdown <= 0) { + clearInterval(interval); + this.codeButtonText = '获取验证码'; + this.isCodeButtonDisabled = false; + this.countdown = 60; + } else { + this.codeButtonText = `${this.countdown}秒后重发`; + } + }, 1000); + }, + sub1() { + if (!this.phone || !this.phoneCode || !this.password) { + + uni.showToast({ + title: '请完整填写信息', + icon: 'none', + duration: 2000 + }); + return; + } + if (!this.validatePhone(this.phone)) { + uni.showToast({ + title: '手机号格式不正确', + icon: 'none', + duration: 2000 + }); + return; + } + let areaId = uni.getStorageSync('areaId'); + let data = { + phone: this.phone, + password: this.password, + areaId: areaId, + phoneCode: this.phoneCode, + uuid: this.uuid + } + this.$u.post("/appCodeLogin", data).then((res) => { + if (res.code == 200) { + // 登录成功后的操作 + wx.setStorageSync('token', res.token); + this.ceshi() + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + }, + towx() { + console.log('dianjile '); + this.pageindex = 0 + }, userType(num) { this.chooseType = false this.login = true @@ -222,12 +647,24 @@ padding: 200rpx 60rpx 0 60rpx; + .tipss { + margin-top: 42rpx; + padding-right: 30rpx; + width: 620rpx; + display: flex; + justify-content: space-between; + font-weight: 400; + font-size: 28rpx; + color: #64B6A8; + } + .line_box { .lines { width: 162rpx; height: 0rpx; border: 1rpx solid #D8D8D8; } + margin-top: 134rpx; width: 620rpx; display: flex; @@ -238,19 +675,22 @@ font-size: 32rpx; color: #808080; } - .wxbtn{ - + + .wxbtn { + width: 100%; margin-top: 30rpx; display: flex; align-items: center; justify-content: center; - image{ + + image { height: 64rpx; - width: 64rpx; + width: 64rpx; } - + } + .tips { width: 258rpx; margin: 0 auto; @@ -332,6 +772,12 @@ color: #FFFFFF; } + .disabled { + pointer-events: none; + opacity: 0.6; + background: #979797; + } + .ips { width: 100%; }