修正http请求加密和缓存控制

- 在httpRequest.js中,修正了AES加密的条件判断符号,确保加密功能在需要时正确实施。
- 添加'Cache-Control': 'no-cache'头,以防止不必要的浏览器缓存影响请求的数据新鲜度。
- 调整了get请求的数据加密方式,与post请求保持一致,增强数据传输安全性。
- 优化了条件判断结构,以更加清晰和标准的代码格式排列。
lu_quan_dev
Tuzki 1 year ago
parent 932b3c9447
commit 39a3069d1d
  1. 4
      common/config.js
  2. 17
      common/httpRequest.js
  3. 19
      pages/index/index.vue

@ -1,9 +1,9 @@
// const REAUEST_ROOTPATH = "https://hdyjy.jiangongtong.cn/";
// const REAUEST_ROOTPATH = "https://app.xawl.gov.cn/";
// const ROOTPATH = "https://app.xawl.gov.cn/";
const REAUEST_ROOTPATH = "http://192.168.130.205:8083";
const REAUEST_ROOTPATH = "http://192.168.110.113:8083";
// const REAUEST_ROOTPATH = "http://192.168.0.181:8083/";
const ROOTPATH = "http://192.168.130.205:8083";
const ROOTPATH = "http://192.168.110.113:8083";
//票务根
const PWPATH = "http://192.168.130.157:48080/app-api";
//手绘图项目名称

@ -27,7 +27,7 @@ module.exports = {
post: function (url, data, headerContentType, tentId, needAes, auth) {
console.log(url, data, headerContentType, tentId, needAes, 'post请求参数');
if (needAes !== false) {
if (needAes != false) {
for (var key in data) {
data[key] = aes.aesMinEncrypt(data[key]);
}
@ -36,10 +36,11 @@ module.exports = {
headerContentType = headerContentType == "json" ? "application/json" : "application/x-www-form-urlencoded";
let headers = {
"content-type": headerContentType
"content-type": headerContentType,
'Cache-Control': 'no-cache'
};
if (auth==true) {
if (auth == true) {
const tok = store.state.userInfo.accessToken || uni.getStorageSync('userInfo').accessToken;
headers['Authorization'] = 'Bearer ' + tok;
}
@ -69,10 +70,18 @@ module.exports = {
get: function (url, data, headerContentType, tentId, needAes, auth) {
console.log(url, data, headerContentType, tentId, needAes, 'get请求参数');
if (needAes != false) {
for (var key in data) {
data[key] = aes.aesMinEncrypt(data[key]); // 进行加密
}
}
headerContentType = headerContentType ? headerContentType : "application/x-www-form-urlencoded";
let headers = {
"content-type": headerContentType
"content-type": headerContentType,
'Cache-Control': 'no-cache'
};
if (auth == true) {

@ -181,7 +181,7 @@
</view>
</view>
<!-- 旅游线路 -->
<view class="amb_60" v-if="lineList && lineList.length > 0">
<view class="amb_60" v-if="lineList && lineList.length > 0 || lineOneList && lineOneList!={}">
<view class="an_box_2">
<view class="an_t" @click="goToPages('line')">
<view class="an_t_1">旅游线路</view>
@ -440,13 +440,18 @@ export default {
var list = [];
for (var i = 0; i < lineLength; i++) {
lineList[i].llogo = this.$config.ROOTPATH + lineList[i].llogo;
if (i == 0) {
this.lineOneList = lineList[i];
} else {
list.push(lineList[i]);
}
// if (i == 0) {
// this.lineOneList = lineList[i];
// } else {
list.push(lineList[i]);
// }
}
this.lineList = list;
this.lineOneList = list[0]; //
this.lineList = list.slice(1); //
// this.lineList = list;
console.log(this.lineOneList, this.lineList)
//
debugger
var hotelList = initData.hotelList;

Loading…
Cancel
Save