Commit 20d3b6b9 authored by 石盼盼's avatar 石盼盼

Merge branch 'spp' into 'master'

Spp

See merge request !11
parents 3724199b 57beff4c
...@@ -9,7 +9,7 @@ const baseUrl = '/api' ...@@ -9,7 +9,7 @@ const baseUrl = '/api'
// todo: url // todo: url
const httpUrl = 'https://repairtest.zeruiedu.com' // 测试接口 const httpUrl = 'https://repairtest.zeruiedu.com' // 测试接口
const h5Url ='http://localhost:8080/' // 测试h5线上地址 const h5Url ='http://localhost:8080' // 测试h5线上地址
// const h5Url = 'http://repair.h5.zeruiedu.com/' // 测试h5线上地址 // const h5Url = 'http://repair.h5.zeruiedu.com/' // 测试h5线上地址
window.localStorage.setItem('httpUrl', httpUrl) window.localStorage.setItem('httpUrl', httpUrl)
window.localStorage.setItem('h5Url', h5Url) window.localStorage.setItem('h5Url', h5Url)
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
// url地址 // url地址
WINDOWHREF_LOGIN: `${httpUrl}${wxLogin}?callBack=${h5Url}/login&${curScope}`, // 身份失效跳转的登录 WINDOWHREF_LOGIN: `${httpUrl}${wxLogin}?callBack=${h5Url}/login&${curScope}`, // 身份失效跳转的登录
WINDOWHREF_LOGIN_TOKEN: `${httpUrl}${wxLogin}?callBack=${window.location.href}&${curScope}`, // 获取token和登录状态 WINDOWHREF_LOGIN_TOKEN: `${httpUrl}${wxLogin}?callBack=${window.location.href}&${curScope}`, // 获取token和登录状态
WINDOWHREF_INDEX: `${httpUrl}${wxLogin}?callBack=${h5Url}&${curScope}`, // WINDOWHREF_INDEX: `${httpUrl}${wxLogin}?callBack=${h5Url}&${curScope}`, // 没用到
WINDOWHREF_ASK: `${httpUrl}${wxLogin}?callBack=${h5Url}&scopes=snsapi_userinfo&type=1`, // 绑定后用户进行授权 WINDOWHREF_ASK: `${httpUrl}${wxLogin}?callBack=${h5Url}&scopes=snsapi_userinfo&type=1`, // 绑定后用户进行授权
// 登录相关 // 登录相关
...@@ -44,6 +44,7 @@ export default { ...@@ -44,6 +44,7 @@ export default {
REPAIR_TRANSFER: baseUrl + '/worker/repair/transfer', // 发起转单 REPAIR_TRANSFER: baseUrl + '/worker/repair/transfer', // 发起转单
REPAIR_COMPLETE: baseUrl + '/worker/repair/complete', // 确认完成 REPAIR_COMPLETE: baseUrl + '/worker/repair/complete', // 确认完成
REPAIR_APPRAISAL: baseUrl + '/worker/repair/appraisal', // 查看评论 REPAIR_APPRAISAL: baseUrl + '/worker/repair/appraisal', // 查看评论
USER_EDIT: baseUrl + '/worker/user/edit', // 修改手机号
// 管理员端 // 管理员端
GET_WORKER: baseUrl + '/worker/get/worker', // 查看评论 GET_WORKER: baseUrl + '/worker/get/worker', // 查看评论
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
min-height: 100vh; min-height: 100vh;
background: #ffffff; background: #ffffff;
} }
.tel input{ .code input{
width: 6.9rem; width: 6.9rem;
height: 0.97rem; height: 0.97rem;
border-bottom: 1px solid #F1F1F1; border-bottom: 1px solid #F1F1F1;
position: relative; position: relative;
margin: 0 auto; margin: 0 auto;
} }
.code input{ .tel input{
width: 6.9rem; width: 6.9rem;
height: 0.97rem; height: 0.97rem;
border-bottom: 1px solid #F1F1F1; border-bottom: 1px solid #F1F1F1;
...@@ -22,7 +22,10 @@ input::-webkit-input-placeholder{ ...@@ -22,7 +22,10 @@ input::-webkit-input-placeholder{
color: #C8C8C8; color: #C8C8C8;
font-size: 0.28rem; font-size: 0.28rem;
} }
.tel .getCode{ .code{
position: relative;
}
.code .getCode{
width: 2rem; width: 2rem;
height: 0.6rem; height: 0.6rem;
background: #0054FF; background: #0054FF;
......
...@@ -85,7 +85,7 @@ export default { ...@@ -85,7 +85,7 @@ export default {
const httpUrl = window.localStorage.getItem('httpUrl') const httpUrl = window.localStorage.getItem('httpUrl')
const h5Url = window.localStorage.getItem('h5Url') const h5Url = window.localStorage.getItem('h5Url')
const wxLogin = window.localStorage.getItem('wxLogin') const wxLogin = window.localStorage.getItem('wxLogin')
const t = res.role == 3 ? h5Url : `${h5Url}admin_home` // 测试h5线上地址 const t = res.role == 3 ? h5Url : `${h5Url}/admin_home` // 测试h5线上地址
let url = `${httpUrl}${wxLogin}?callBack=${t}&scopes=snsapi_userinfo&type=1` let url = `${httpUrl}${wxLogin}?callBack=${t}&scopes=snsapi_userinfo&type=1`
window.document.location = url // url- window.document.location = url // url-
}) })
......
<template> <template>
<div <div class="cont" v-if="user">
class="cont" <div class="top"></div>
v-if="user" <div class="info-item">
> <div class="photo">
<div class="top"></div> <img src="@assets/images/my/touxiang.png" alt />
<div class="info-item"> </div>
<div class="photo"> <div class="btn">{{user.online_status_display}}</div>
<img <div class="name">{{user.name}}</div>
src="@assets/images/my/touxiang.png" <div class="group">{{user.department.name}}</div>
alt <div class="tel flex-h" @click="goPhone">
/> <div class="telNumber">{{telToHide(user.phone)}}</div>
</div> <img src="@assets/images/my/bianji.png" alt />
<div class="btn">{{user.online_status_display}}</div> </div>
<div class="name">{{user.name}}</div>
<div class="group">{{user.department.name}}</div>
<div class="tel flex-h">
<div class="telNumber">{{user.phone}}</div>
<img
src="@assets/images/my/bianji.png"
alt
/>
</div>
</div>
<!-- tabbar -->
<my-tabbar curname="my"></my-tabbar>
</div> </div>
<!-- tabbar -->
<my-tabbar curname="my"></my-tabbar>
</div>
</template> </template>
<script> <script>
...@@ -43,6 +34,12 @@ export default { ...@@ -43,6 +34,12 @@ export default {
this.getUserInfo() this.getUserInfo()
}, },
methods: { methods: {
goPhone(){
this.$router.push({
path: '/modifyPhone',
query:{phone:this.user.phone}
})
},
getUserInfo () { getUserInfo () {
this.$http this.$http
.get(this.$myApi.USERINFO) .get(this.$myApi.USERINFO)
...@@ -50,6 +47,10 @@ export default { ...@@ -50,6 +47,10 @@ export default {
this.user = res this.user = res
}) })
.catch(() => {}) .catch(() => {})
},
telToHide (tel) {
var phone = tel.substr(0, 3) + '****' + tel.substring(7, 11);
return phone;
} }
} }
} }
...@@ -57,67 +58,67 @@ export default { ...@@ -57,67 +58,67 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.cont { .cont {
min-height: 100vh; min-height: 100vh;
background: #f7f7f7; background: #f7f7f7;
} }
.top { .top {
width: 100%; width: 100%;
height: 2.82rem; height: 2.82rem;
background: #0054ff; background: #0054ff;
position: relative; position: relative;
} }
.info-item { .info-item {
width: 7.5rem; width: 7.5rem;
height: 8.05rem; height: 8.05rem;
background: #ffffff; background: #ffffff;
border-radius: 0.28rem 0.28rem 0rem 0rem; border-radius: 0.28rem 0.28rem 0rem 0rem;
position: absolute; position: absolute;
top: 2.5rem; top: 2.5rem;
left: 0; left: 0;
text-align: center; text-align: center;
} }
.photo { .photo {
width: 1.7rem; width: 1.7rem;
height: 1.7rem; height: 1.7rem;
border-radius: 50%; border-radius: 50%;
background: #f1f1f1; background: #f1f1f1;
position: absolute; position: absolute;
top: -1rem; top: -1rem;
left: 2.9rem; left: 2.9rem;
} }
.btn { .btn {
width: 1.38rem; width: 1.38rem;
height: 0.48rem; height: 0.48rem;
background: #0054ff; background: #0054ff;
border-radius: 0.24rem; border-radius: 0.24rem;
color: #fff; color: #fff;
text-align: center; text-align: center;
line-height: 0.48rem; line-height: 0.48rem;
margin: 1.13rem auto 0.59rem; margin: 1.13rem auto 0.59rem;
} }
.name { .name {
color: #000000; color: #000000;
font-size: 0.38rem; font-size: 0.38rem;
margin-bottom: 0.27rem; margin-bottom: 0.27rem;
font-weight: bold; font-weight: bold;
} }
.group { .group {
color: #000000; color: #000000;
font-size: 0.3rem; font-size: 0.3rem;
margin-bottom: 0.48rem; margin-bottom: 0.48rem;
} }
.tel { .tel {
width: 2rem; width: 2rem;
height: 0.28rem; height: 0.28rem;
margin: 0 auto; margin: 0 auto;
} }
.tel .telNumber { .tel .telNumber {
color: #000000; color: #000000;
font-size: 0.3rem; font-size: 0.3rem;
margin-right: 0.2rem; margin-right: 0.2rem;
} }
.tel img { .tel img {
width: 0.28rem; width: 0.28rem;
height: 0.28rem; height: 0.28rem;
} }
</style> </style>
<template> <template>
<div class="cont"> <div class="cont">
<div class="tel flex-h"> <div class="tel">
<input type="number" placeholder="请输入新的手机号"> <input v-model.trim="old_tel" maxlength="11" type="number" placeholder="请输入原手机号" />
<div class="getCode">获取验证码</div> </div>
</div> <div class="tel">
<div class="code"> <input v-model.trim="tel" maxlength="11" type="number" placeholder="请输入新的手机号" />
<input type="number" placeholder="请输入验证码"> </div>
</div> <div class="code flex-h">
<div class="submit-btn">提交</div> <input v-model.trim="code" maxlength="6" type="number" placeholder="请输入验证码" />
<div class="getCode" @click="getCode">{{buttonText}}</div>
</div>
<div class="submit-btn" @click="submit">提交</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data () {
return {
old_tel: '',//旧手机号
tel: '', // 手机号
code: '', // 验证码
buttonText: '获取验证码',
isSending: false,
seconds: 60,
timer: null
}
},
methods: {
checkData () {
if(!this.checkCon()){
return
}
if (this.code.length !== 6) {
this.$toast('请正确输入验证码')
return false
}
return true
},
checkCon(){
if (this.old_tel != this.$route.query.phone) {
this.$toast('请正确输入原手机号码')
return false
}
if (this.tel.length !== 11) {
this.$toast('请正确输入新手机号码')
return false
}
if (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(this.tel))) {
this.$toast('请正确输入新手机号码')
return false
}
return true
},
getCode () {
if (this.isSending) return
if(!this.checkCon()){
return
}
const curParams = {
tel: this.tel,
old_tel: this.old_tel,
is_edit: 1
}
this.$http.post(this.$myApi.SENDCODE, curParams)
.then(res => {
this.isSending = true
this.countDown()
})
.catch(() => {})
},
countDown () {
let seconds = 60
this.timer = setInterval(() => {
seconds--
this.buttonText = `重新获取(${seconds}s)`
if (seconds < 1) {
this.isSending = false
this.buttonText = '重新获取'
clearInterval(this.timer)
}
}, 1000)
},
submit () {
if (!this.checkData()) return
const curParams = {
tel: this.tel,
code: this.code
}
this.$http.post(this.$myApi.USER_EDIT, curParams)
.then(res => {
this.$toast('修改成功')
this.$router.go(-1)
})
.catch(() => {})
},
fetchData (to, from) {
this.tel = '' // 手机号
this.code = '' // 验证码
this.buttonText = '获取验证码'
this.isSending = false
this.seconds = 60
this.timer = null
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.fetchData(to, from, next)
})
},
beforeRouteLeave (to, from, next) {
if (this.timer) {
clearInterval(this.timer)
}
next()
}
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment