Commit 249594b5efb9e8a402bceccdcc667a257aec3bea
1 parent
ea291b39
提交登陆
Showing
4 changed files
with
76 additions
and
9 deletions
src/api/mycar.js
@@ -9,3 +9,29 @@ export function getPersonCarNumPC() { | @@ -9,3 +9,29 @@ export function getPersonCarNumPC() { | ||
9 | method: 'post' | 9 | method: 'post' |
10 | }) | 10 | }) |
11 | } | 11 | } |
12 | + | ||
13 | +/** | ||
14 | + * 绑定车牌 | ||
15 | + * @param params | ||
16 | + */ | ||
17 | +export function boundCarNum(params) { | ||
18 | + return request({ | ||
19 | + url: '/personCarNumPc/boundCarNum', | ||
20 | + method: 'post', | ||
21 | + params | ||
22 | + }) | ||
23 | +} | ||
24 | + | ||
25 | +/** | ||
26 | + * 解绑车牌 | ||
27 | + * @param params | ||
28 | + */ | ||
29 | +export function unboundCarNum(params) { | ||
30 | + return request({ | ||
31 | + url: '/personCarNumPc/unboundCarNum', | ||
32 | + method: 'post', | ||
33 | + params | ||
34 | + }) | ||
35 | +} | ||
36 | + | ||
37 | + |
src/store/modules/user.js
@@ -32,7 +32,6 @@ const actions = { | @@ -32,7 +32,6 @@ const actions = { | ||
32 | return new Promise((resolve, reject) => { | 32 | return new Promise((resolve, reject) => { |
33 | login({ userPhone: phone.trim(), validatorCode: password }).then(response => { | 33 | login({ userPhone: phone.trim(), validatorCode: password }).then(response => { |
34 | const { data } = response | 34 | const { data } = response |
35 | - debugger; | ||
36 | commit('SET_TOKEN', data.token) | 35 | commit('SET_TOKEN', data.token) |
37 | setToken(data.token) | 36 | setToken(data.token) |
38 | resolve() | 37 | resolve() |
@@ -47,11 +46,9 @@ const actions = { | @@ -47,11 +46,9 @@ const actions = { | ||
47 | return new Promise((resolve, reject) => { | 46 | return new Promise((resolve, reject) => { |
48 | getInfo(state.token).then(response => { | 47 | getInfo(state.token).then(response => { |
49 | const { data } = response | 48 | const { data } = response |
50 | - | ||
51 | if (!data) { | 49 | if (!data) { |
52 | reject('Verification failed, please Login again.') | 50 | reject('Verification failed, please Login again.') |
53 | } | 51 | } |
54 | - | ||
55 | const { custName, headPicUrl } = data | 52 | const { custName, headPicUrl } = data |
56 | 53 | ||
57 | commit('SET_NAME', custName) | 54 | commit('SET_NAME', custName) |
src/views/login/index.vue
@@ -110,7 +110,6 @@ export default { | @@ -110,7 +110,6 @@ export default { | ||
110 | else { | 110 | else { |
111 | sendValidatorCode(phone).then(response =>{ | 111 | sendValidatorCode(phone).then(response =>{ |
112 | let data = response.data; | 112 | let data = response.data; |
113 | - debugger; | ||
114 | if(data.code=='8888'){ | 113 | if(data.code=='8888'){ |
115 | this.$message({ | 114 | this.$message({ |
116 | type: 'success', | 115 | type: 'success', |
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} from '@/api/mycar.js'; | 70 | + import {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) => { |
@@ -75,7 +75,7 @@ | @@ -75,7 +75,7 @@ | ||
75 | callback(new Error('请输入车牌号')); | 75 | callback(new Error('请输入车牌号')); |
76 | } | 76 | } |
77 | 77 | ||
78 | - if ( !/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/.test(this.bondform.carNum)||this.bondform.carNum.length<8) { | 78 | + if (!/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/.test(this.bondform.carNum)||this.bondform.carNum.length<7) { |
79 | callback(new Error('请输入正确的车牌号')); | 79 | callback(new Error('请输入正确的车牌号')); |
80 | } | 80 | } |
81 | callback(); | 81 | callback(); |
@@ -84,7 +84,7 @@ | @@ -84,7 +84,7 @@ | ||
84 | return { | 84 | return { |
85 | form: { | 85 | form: { |
86 | custId: '', | 86 | custId: '', |
87 | - phone: '' | 87 | + phone: '', |
88 | }, | 88 | }, |
89 | /**绑定车牌.*/ | 89 | /**绑定车牌.*/ |
90 | bondform: { | 90 | bondform: { |
@@ -108,9 +108,27 @@ | @@ -108,9 +108,27 @@ | ||
108 | methods: { | 108 | methods: { |
109 | /**绑定车牌*/ | 109 | /**绑定车牌*/ |
110 | bondCarNum:function(formName){ | 110 | bondCarNum:function(formName){ |
111 | + let that = this; | ||
112 | + let custId = this.form.custId; | ||
113 | + let carNum = this.bondform.carNum; | ||
111 | this.$refs[formName].validate((valid) => { | 114 | this.$refs[formName].validate((valid) => { |
112 | if (valid) { | 115 | if (valid) { |
113 | - alert('submit!'); | 116 | + let req ={ |
117 | + custId:custId, | ||
118 | + carNumber:carNum, | ||
119 | + sysCode:'1001', | ||
120 | + carBindingStatus:1, //绑定 | ||
121 | + }; | ||
122 | + boundCarNum(req).then(response =>{ | ||
123 | + if(response.code='8888'){ | ||
124 | + that.bondform.carNum=''; | ||
125 | + this.$message({ | ||
126 | + type: 'success', | ||
127 | + message: '车牌绑定成功!' | ||
128 | + }); | ||
129 | + | ||
130 | + } | ||
131 | + }); | ||
114 | } else { | 132 | } else { |
115 | console.log('error submit!!'); | 133 | console.log('error submit!!'); |
116 | return false; | 134 | return false; |
@@ -129,7 +147,34 @@ | @@ -129,7 +147,34 @@ | ||
129 | }, | 147 | }, |
130 | /**解绑车牌.*/ | 148 | /**解绑车牌.*/ |
131 | alredyBoundCarBtn:function (carNum) { | 149 | alredyBoundCarBtn:function (carNum) { |
132 | - debugger | 150 | + if("" == carNum || null ==carNum || undefined == carNum){ |
151 | + this.$message({ | ||
152 | + type: 'error', | ||
153 | + message: '解绑的车牌不能为空' | ||
154 | + }); | ||
155 | + } | ||
156 | + let that =this; | ||
157 | + let custId = this.form.custId; | ||
158 | + let req ={ | ||
159 | + custId:custId, | ||
160 | + carNumber:carNum, | ||
161 | + sysCode:'1001', | ||
162 | + carBindingStatus:2, //解绑 | ||
163 | + }; | ||
164 | + unboundCarNum(req).then(response =>{ | ||
165 | + if(response.code ='8888'){ | ||
166 | + this.$message({ | ||
167 | + type: 'success', | ||
168 | + message: '车牌解绑成功!' | ||
169 | + }); | ||
170 | + this.getPersonCarNumPC(); | ||
171 | + }else{ | ||
172 | + this.$message({ | ||
173 | + type: 'error', | ||
174 | + message: '车牌解绑失败!' | ||
175 | + }); | ||
176 | + } | ||
177 | + }); | ||
133 | } | 178 | } |
134 | }, | 179 | }, |
135 | mounted:function(){ | 180 | mounted:function(){ |