Commit 681485b2 authored by lijiongliang's avatar lijiongliang

接口修改

parent 526e7290
...@@ -5,7 +5,7 @@ import store from "./store"; ...@@ -5,7 +5,7 @@ import store from "./store";
Vue.prototype.$store = store; Vue.prototype.$store = store;
import http from "./common/api/api.js" import http from "./common/api/api.js"
import $http from '@/common/zhouWei-request/requestConfig'; import $http from '@/common/request/requestConfig';
Vue.config.productionTip = false Vue.config.productionTip = false
import ActiveForm from "@/common/active-form/active-form"; import ActiveForm from "@/common/active-form/active-form";
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
//检查挪车码存在、是否绑定 //检查挪车码存在、是否绑定
getCheckMoveCode() { getCheckMoveCode() {
let opts = { let opts = {
url: '/app/user/check/move/code', url: '/app/user/c/m/c',
method: 'post' method: 'post'
}; };
this.http.httpTokenRequest(opts, { this.http.httpTokenRequest(opts, {
...@@ -170,7 +170,7 @@ ...@@ -170,7 +170,7 @@
code: this.scene code: this.scene
} }
opts = { opts = {
url: '/app/user/check/move/code', url: '/app/user/c/m/c',
method: 'post' method: 'post'
} }
that.http.httpTokenRequest(opts, param).then(res => { that.http.httpTokenRequest(opts, param).then(res => {
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
code: this.scene code: this.scene
} }
opts = { opts = {
url: '/app/user/check/move/code', url: '/app/user/c/m/c',
method: 'post' method: 'post'
} }
that.http.httpTokenRequest(opts, param).then(res => { that.http.httpTokenRequest(opts, param).then(res => {
......
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
code: scene code: scene
} }
let opts = { let opts = {
url: '/app/user/check/move/code', url: '/app/user/c/m/c',
method: 'post' method: 'post'
} }
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
let paths = path.split('?')[1] let paths = path.split('?')[1]
let scene = paths.split("=")[1] let scene = paths.split("=")[1]
// this.$http.request({ // this.$http.request({
// url:'/app/user/check/move/code', // url:'/app/user/c/m/c',
// method:'post', // method:'post',
// data:{ // data:{
// code: scene // code: scene
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
// 扫一扫 // 扫一扫
goScene(scene){ goScene(scene){
this.$http.request({ this.$http.request({
url:'/app/user/check/move/code', url:'/app/user/c/m/c',
method:'post', method:'post',
data:{ data:{
code: scene code: scene
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
//扫码后得到的参数 //扫码后得到的参数
this.goScene(that.scene) this.goScene(that.scene)
// that.http.httpTokenRequest({ // that.http.httpTokenRequest({
// url: '/app/user/check/move/code', // url: '/app/user/c/m/c',
// method: 'post' // method: 'post'
// }, { // }, {
// code: that.scene // code: that.scene
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
let paths = path.split('?')[1] let paths = path.split('?')[1]
let scene = paths.split("=")[1] let scene = paths.split("=")[1]
this.$http.request({ this.$http.request({
url:'/app/user/check/move/code', url:'/app/user/c/m/c',
method:'post', method:'post',
data:{ data:{
code: scene code: scene
......
...@@ -110,17 +110,6 @@ export default { ...@@ -110,17 +110,6 @@ export default {
this.deleteShow = false this.deleteShow = false
}, },
getCarList(){ getCarList(){
// uni.showLoading({
// title: '加载中',
// mask:true
// });
// let opts = { url: '/app/vehicleAdmin/list', method: 'get' };
// this.http.httpTokenRequest(opts, {}).then(res => {
// if (res.statusCode == 200) {
// uni.hideLoading()
// this.carList = res.data || []
// }
// })
this.$http.request({ this.$http.request({
url:'/app/vehicleAdmin/list', url:'/app/vehicleAdmin/list',
method:'get', method:'get',
......
...@@ -138,7 +138,8 @@ ...@@ -138,7 +138,8 @@
<script> <script>
import CarNumber from "@/common/codecook-carnumber/codecook-carnumber.vue"; import CarNumber from "@/common/codecook-carnumber/codecook-carnumber.vue";
import tools from "@/static/js/crypto-js.js"; import CryptoJS from "crypto-js";
export default { export default {
components: { components: {
CarNumber, CarNumber,
...@@ -169,6 +170,8 @@ export default { ...@@ -169,6 +170,8 @@ export default {
codeTime:60 codeTime:60
}, // 验证码 }, // 验证码
clickStatus:false, // 节流 clickStatus:false, // 节流
key:null, // 加密key
iv:null // 加密iv
} }
}, },
methods: { methods: {
...@@ -286,32 +289,37 @@ export default { ...@@ -286,32 +289,37 @@ export default {
return; return;
} }
this.$http.request({ this.$http.request({
url:'/app/moveCode/binding', url:'/app/moveCode/bind',
method:'put', method:'put',
data:this.model1, data:this.model1,
isFactory:false,
}).then(res => { }).then(res => {
uni.showToast({ if (res.data.code == 200) {
title: "绑定成功", //展示绑定成功
icon: "success", uni.showToast({
}); title: "绑定成功",
setTimeout(()=>{ icon: "success",
uni.navigateTo({ });
url: '/pagesB/pages/move-car/myMoveCar' setTimeout(()=>{
}) uni.navigateTo({
},500) url: '/pagesB/pages/move-car/myMoveCar'
})
},500)
} else if(res.data.code == 1000000002){
uni.showToast({
title: res.data.msg,
icon: "none",
});
this.setAES(this.moveCode,this.key)
} else {
//绑定失败,展示失败信息
uni.hideLoading()
uni.showToast({
title: res.data.msg,
icon: "none",
});
}
}) })
},
getCarInfo() {
if (this.carId) {
this.$http.request({
url:'/app/vehicleAdmin/' + this.carId,
method:'get',
data:{},
isFactory:false,
}).then(res => {
this.model1.carInfo = res
})
}
}, },
// 跳转协议政策页面 // 跳转协议政策页面
goArticle(index) { goArticle(index) {
...@@ -340,18 +348,65 @@ export default { ...@@ -340,18 +348,65 @@ export default {
}); });
} }
}) })
} },
// 获取加密key
getKey(){
this.$http.request({
url:'/app/user/c/i',
method:'get',
data:{},
isFactory:false,
}).then(res => {
if (res.data.code == 200) {
let data = res.data.data
try{
let str = data.s3.padStart(8,0)
let ivs = data.s3
let str2 = data.l1
if(str2.length == 4){
let str3 = str2.substring(0,2)
let str4 = str2.substring(2,4)
this.key = str.substring(str3,str4)
let str5;
if(ivs.length > 8){
str5 = ivs.substring(ivs.length-8,ivs.length)
this.iv = String(str2 + str5).padStart(16,0)
}else{
str5 = ivs.padStart(8,0)
this.iv = String(str2 + str5).padStart(16,0)
}
this.setAES(this.moveCode,this.key)
}
}catch(err){
}
} else {
uni.showToast({
title: res.data.msg,
icon: "none",
});
}
})
},
// 加密
setAES(str,keys) {
// const data = CryptoJS.enc.Utf8.parse(str);
const key = CryptoJS.enc.Utf8.parse(keys);
const iv = CryptoJS.enc.Utf8.parse(this.iv);
var option = {
iv: iv,
mode: CryptoJS.mode['CBC'],//看需求变“CBC”
padding: CryptoJS.pad['Pkcs7']//看需求变“ZeroPadding”
};
var encrypted = CryptoJS.AES.encrypt(str, key, option);
const words = encrypted.ciphertext.toString();
// console.log(words,'加密后222222')
this.model1.moveCode = words
},
}, },
onLoad(option) { onLoad(option) {
this.moveCode = option.moveCode this.moveCode = option.moveCode
this.model1.moveCode = option.moveCode this.getKey()
let datajAes = tools.setAES('69703333');
console.log(datajAes,88888888888888)
},
onShow:function(){
this.getCarInfo()
//console.log( this.$store.state.selectedCar);
} }
} }
</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