Commit 373bae166a95aef9863686a23fa5493f7dc55b0f
1 parent
1e73ec12
登陆验证码提交
Showing
5 changed files
with
69 additions
and
31 deletions
src/api/mycar.js
| @@ -35,3 +35,17 @@ export function unboundCarNum(params) { | @@ -35,3 +35,17 @@ export function unboundCarNum(params) { | ||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | +/** | ||
| 39 | + * 校验车牌号是否被其他人绑定 | ||
| 40 | + * @param params | ||
| 41 | + */ | ||
| 42 | +export function checkCarNumIsbind(params) { | ||
| 43 | + return request({ | ||
| 44 | + url: '/personCarNumPc/checkCarNumIsbind', | ||
| 45 | + method: 'post', | ||
| 46 | + data:params | ||
| 47 | + }) | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + |
src/store/modules/user.js
| @@ -33,7 +33,7 @@ const actions = { | @@ -33,7 +33,7 @@ const actions = { | ||
| 33 | const { data } = response | 33 | const { data } = response |
| 34 | commit('SET_TOKEN', data.token) | 34 | commit('SET_TOKEN', data.token) |
| 35 | setToken(data.token) | 35 | setToken(data.token) |
| 36 | - resolve() | 36 | + resolve(response) |
| 37 | }).catch(error => { | 37 | }).catch(error => { |
| 38 | reject(error) | 38 | reject(error) |
| 39 | }) | 39 | }) |
src/views/login/index.vue
| @@ -169,9 +169,13 @@ export default { | @@ -169,9 +169,13 @@ export default { | ||
| 169 | this.$refs.loginForm.validate(valid => { | 169 | this.$refs.loginForm.validate(valid => { |
| 170 | if (valid) { | 170 | if (valid) { |
| 171 | this.loading = true | 171 | this.loading = true |
| 172 | - this.$store.dispatch('user/login', this.loginForm).then(() => { | ||
| 173 | - this.$router.push({ path: this.redirect || '/' }) | ||
| 174 | - this.loading = false | 172 | + this.$store.dispatch('user/login', this.loginForm).then((reponse) => { |
| 173 | + if(reponse.code =='8888'){ | ||
| 174 | + this.$router.push({ path: this.redirect || '/' }) | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + this.loading = false | ||
| 178 | + | ||
| 175 | }).catch(() => { | 179 | }).catch(() => { |
| 176 | this.loading = false | 180 | this.loading = false |
| 177 | }) | 181 | }) |
src/views/mycar/index.vue
| @@ -67,7 +67,7 @@ | @@ -67,7 +67,7 @@ | ||
| 67 | </template> | 67 | </template> |
| 68 | 68 | ||
| 69 | <script> | 69 | <script> |
| 70 | - import {getPersonCarNumPC,boundCarNum,unboundCarNum} from '@/api/mycar.js'; | 70 | + import {checkCarNumIsbind,getPersonCarNumPC,boundCarNum,unboundCarNum} from '@/api/mycar.js'; |
| 71 | export default { | 71 | export default { |
| 72 | data() { | 72 | data() { |
| 73 | var carNumValidator = (rule, value, callback) => { | 73 | var carNumValidator = (rule, value, callback) => { |
| @@ -115,32 +115,51 @@ | @@ -115,32 +115,51 @@ | ||
| 115 | let carNum = this.bondform.carNum; | 115 | let carNum = this.bondform.carNum; |
| 116 | let existFlg = false; | 116 | let existFlg = false; |
| 117 | this.$refs[formName].validate((valid) => { | 117 | this.$refs[formName].validate((valid) => { |
| 118 | - if (valid) { | ||
| 119 | - getPersonCarNumPC().then(response =>{ | ||
| 120 | - if(response.code ='8888'){ | ||
| 121 | - let data = response.data; | ||
| 122 | - data.forEach(function(item,index){ | ||
| 123 | - if(item.carNumber ==carNum){ | ||
| 124 | - existFlg=true; | ||
| 125 | - } | 118 | + if (!valid) return false; |
| 119 | + debugger | ||
| 120 | + | ||
| 121 | + if(null != that.alredyBoundCar && that.alredyBoundCar.length >0){ | ||
| 122 | + if(that.alredyBoundCar.length >5){ | ||
| 123 | + this.$message({ | ||
| 124 | + type: 'error', | ||
| 125 | + message: '最多只能绑定5个车牌!' | ||
| 126 | + }); | ||
| 127 | + return false | ||
| 128 | + }else{ | ||
| 129 | + let flg =false; | ||
| 130 | + that.alredyBoundCar.forEach((item,index)=>{ | ||
| 131 | + if(item.carNumber == carNum){ | ||
| 132 | + flg = true | ||
| 133 | + } | ||
| 134 | + }); | ||
| 135 | + if(flg){ | ||
| 136 | + this.$message({ | ||
| 137 | + type: 'error', | ||
| 138 | + message: '请勿做重复绑定!' | ||
| 126 | }); | 139 | }); |
| 127 | - if(data.length >=3){ | ||
| 128 | - this.$message({ | ||
| 129 | - type: 'error', | ||
| 130 | - message: '最多只能绑定3个车牌' | ||
| 131 | - }); | ||
| 132 | - }else if(existFlg){ | ||
| 133 | - this.$message({ | ||
| 134 | - type: 'error', | ||
| 135 | - message: '该车牌已经绑定!' | ||
| 136 | - }); | ||
| 137 | - }else { | ||
| 138 | - that.bondCarNum(custId,carNum); | 140 | + return false |
| 141 | + }else { | ||
| 142 | + let checkReq ={ | ||
| 143 | + carNumber:carNum | ||
| 139 | } | 144 | } |
| 140 | - | 145 | + checkCarNumIsbind(checkReq).then(response =>{ |
| 146 | + if(response.code =='8888'){ | ||
| 147 | + if(null != response.data && null != response.data.id){ | ||
| 148 | + this.$message({ | ||
| 149 | + type: 'error', | ||
| 150 | + message: '改车牌已被其他车主绑定!' | ||
| 151 | + }); | ||
| 152 | + return false | ||
| 153 | + }else{ | ||
| 154 | + that.bondCarNum(custId,carNum) | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + }); | ||
| 141 | } | 158 | } |
| 142 | - }); | 159 | + } |
| 160 | + | ||
| 143 | } | 161 | } |
| 162 | + | ||
| 144 | }); | 163 | }); |
| 145 | }, | 164 | }, |
| 146 | /**绑定车牌*/ | 165 | /**绑定车牌*/ |
src/views/myevaluate/index.vue
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | 20 | ||
| 21 | <el-card shadow="always" class="card-second-top"> | 21 | <el-card shadow="always" class="card-second-top"> |
| 22 | <div slot="header" class="clearfix" style="line-height: 32px;"> | 22 | <div slot="header" class="clearfix" style="line-height: 32px;"> |
| 23 | - <span>详细记录</span> | 23 | + <span style="float: left">详细记录</span> |
| 24 | <el-button type="primary" size="small" style="float: right" @click="dialogOpen">评价</el-button> | 24 | <el-button type="primary" size="small" style="float: right" @click="dialogOpen">评价</el-button> |
| 25 | </div> | 25 | </div> |
| 26 | <el-table | 26 | <el-table |
| @@ -55,7 +55,8 @@ | @@ -55,7 +55,8 @@ | ||
| 55 | </el-table> | 55 | </el-table> |
| 56 | <el-pagination | 56 | <el-pagination |
| 57 | :page-size="pageSize" | 57 | :page-size="pageSize" |
| 58 | - :pager-count="currentPage" | 58 | + :current-page="currentPage" |
| 59 | + :pager-count="5" | ||
| 59 | layout="prev, pager, next" | 60 | layout="prev, pager, next" |
| 60 | @current-change="handleCurrentChange" | 61 | @current-change="handleCurrentChange" |
| 61 | :total="total"> | 62 | :total="total"> |
| @@ -173,10 +174,10 @@ | @@ -173,10 +174,10 @@ | ||
| 173 | }, | 174 | }, |
| 174 | 175 | ||
| 175 | dialogOpen:function(){ | 176 | dialogOpen:function(){ |
| 176 | - let problemform= { | 177 | + this.problemform= { |
| 177 | resource: '1', | 178 | resource: '1', |
| 178 | desc:'' | 179 | desc:'' |
| 179 | - }; | 180 | + } |
| 180 | this.dialogFormVisible=true; | 181 | this.dialogFormVisible=true; |
| 181 | }, | 182 | }, |
| 182 | /**提交.*/ | 183 | /**提交.*/ |