Commit 681485b2 authored by lijiongliang's avatar lijiongliang

接口修改

parent 526e7290
......@@ -5,7 +5,7 @@ import store from "./store";
Vue.prototype.$store = store;
import http from "./common/api/api.js"
import $http from '@/common/zhouWei-request/requestConfig';
import $http from '@/common/request/requestConfig';
Vue.config.productionTip = false
import ActiveForm from "@/common/active-form/active-form";
......
......@@ -80,7 +80,7 @@
//检查挪车码存在、是否绑定
getCheckMoveCode() {
let opts = {
url: '/app/user/check/move/code',
url: '/app/user/c/m/c',
method: 'post'
};
this.http.httpTokenRequest(opts, {
......@@ -170,7 +170,7 @@
code: this.scene
}
opts = {
url: '/app/user/check/move/code',
url: '/app/user/c/m/c',
method: 'post'
}
that.http.httpTokenRequest(opts, param).then(res => {
......@@ -306,7 +306,7 @@
code: this.scene
}
opts = {
url: '/app/user/check/move/code',
url: '/app/user/c/m/c',
method: 'post'
}
that.http.httpTokenRequest(opts, param).then(res => {
......
......@@ -81,7 +81,7 @@ export default {
code: scene
}
let opts = {
url: '/app/user/check/move/code',
url: '/app/user/c/m/c',
method: 'post'
}
......
......@@ -102,7 +102,7 @@
let paths = path.split('?')[1]
let scene = paths.split("=")[1]
// this.$http.request({
// url:'/app/user/check/move/code',
// url:'/app/user/c/m/c',
// method:'post',
// data:{
// code: scene
......@@ -229,7 +229,7 @@
// 扫一扫
goScene(scene){
this.$http.request({
url:'/app/user/check/move/code',
url:'/app/user/c/m/c',
method:'post',
data:{
code: scene
......@@ -323,7 +323,7 @@
//扫码后得到的参数
this.goScene(that.scene)
// that.http.httpTokenRequest({
// url: '/app/user/check/move/code',
// url: '/app/user/c/m/c',
// method: 'post'
// }, {
// code: that.scene
......
......@@ -88,7 +88,7 @@
let paths = path.split('?')[1]
let scene = paths.split("=")[1]
this.$http.request({
url:'/app/user/check/move/code',
url:'/app/user/c/m/c',
method:'post',
data:{
code: scene
......
......@@ -110,17 +110,6 @@ export default {
this.deleteShow = false
},
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({
url:'/app/vehicleAdmin/list',
method:'get',
......
......@@ -138,7 +138,8 @@
<script>
import CarNumber from "@/common/codecook-carnumber/codecook-carnumber.vue";
import tools from "@/static/js/crypto-js.js";
import CryptoJS from "crypto-js";
export default {
components: {
CarNumber,
......@@ -169,6 +170,8 @@ export default {
codeTime:60
}, // 验证码
clickStatus:false, // 节流
key:null, // 加密key
iv:null // 加密iv
}
},
methods: {
......@@ -286,32 +289,37 @@ export default {
return;
}
this.$http.request({
url:'/app/moveCode/binding',
url:'/app/moveCode/bind',
method:'put',
data:this.model1,
isFactory:false,
}).then(res => {
uni.showToast({
title: "绑定成功",
icon: "success",
});
setTimeout(()=>{
uni.navigateTo({
url: '/pagesB/pages/move-car/myMoveCar'
})
},500)
if (res.data.code == 200) {
//展示绑定成功
uni.showToast({
title: "绑定成功",
icon: "success",
});
setTimeout(()=>{
uni.navigateTo({
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) {
......@@ -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) {
this.moveCode = option.moveCode
this.model1.moveCode = option.moveCode
let datajAes = tools.setAES('69703333');
console.log(datajAes,88888888888888)
},
onShow:function(){
this.getCarInfo()
//console.log( this.$store.state.selectedCar);
this.getKey()
}
}
</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