接口域名更改,取消H5域名跨域配置

master
chen 2022-04-02 09:17:26 +08:00
parent 8e65b1c87b
commit 476de6e246
4 changed files with 16 additions and 21 deletions

View File

@ -10,12 +10,10 @@
onLaunch: function() {
//
// #ifdef APP-PLUS
// uni.setStorageSync('hostapi','http://maintain.7and5.cn');
getApp().globalData.hostapi = 'http://maintain.7and5.cn';
getApp().globalData.hostapi = 'https://7and5.cn';
// #endif
// #ifdef MP-WEIXIN
// uni.setStorageSync('hostapi','http://maintain.7and5.cn');
this.globalData.hostapi = 'http://maintain.7and5.cn';
this.globalData.hostapi = 'https://7and5.cn';
// #endif
// #ifdef H5
// uni.setStorageSync('hostapi','/web');

View File

@ -3,13 +3,14 @@ const ENV = process.env.NODE_ENV;
console.log(ENV,'当前环境'); // development开发环境 test测试环境 production生产环境
// 配置全局域名
// #ifdef APP-PLUS
const hostapi = 'http://maintain.7and5.cn';
const hostapi = 'https://7and5.cn';
// #endif
// #ifdef MP-WEIXIN
const hostapi = 'http://maintain.7and5.cn';
const hostapi = 'https://7and5.cn';
// #endif
// #ifdef H5
const hostapi = '/web';
// const hostapi = '/web';
const hostapi = 'https://7and5.cn';
// #endif
// 清理所有缓存并前往授权页
const goLogin = () => {
@ -88,11 +89,14 @@ const request = (method, url, options) => {
if(options!=undefined) params = options;
// params.token = uni.getStorageSync('token');
return new Promise((resolve, reject) => {
console.log(hostapi,91);
uni.request({
url: `${hostapi}${url}`,
method: methods,
data: params,
header: headers,
// sslVerify:false,//验证 ssl 证书 仅App安卓端支持
// withCredentials:true,//跨域请求时是否携带凭证cookies仅H5支持
success: res => {
console.log(`${url}返的结果===>`,res);
if (res.statusCode == 200) {
@ -117,7 +121,6 @@ const request = (method, url, options) => {
// 上传文件 封装请求
const uploadFile = (url, options) => {
let tempData = options || {}
console.log(tempData,108);
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${hostapi}${url}`,
@ -125,6 +128,8 @@ const uploadFile = (url, options) => {
name: 'image',
fileType:'image',
formData: tempData,
// sslVerify:false,//验证 ssl 证书 仅App安卓端支持
// withCredentials:true,//跨域请求时是否携带凭证cookies仅H5支持
header: {
'Content-Type': 'multipart/form-data;charset=UTF-8',
'Authorization': 'Bearer '+uni.getStorageSync('token') || '',

View File

@ -111,7 +111,7 @@
"https" : false,
"proxy" : {
"/web" : {
"target" : "http://maintain.7and5.cn",
"target" : "https://7and5.cn",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {

View File

@ -59,8 +59,7 @@
<!-- <cmd-progress type="circle" :percent="item.num" :width="60" :stroke-color="['#00a2e9','#e87c00','#0b56ec'][index]" :circleStrokeColor="['#c6e6f5','#f4dfc6','#c8d7f5'][index]" :strokeShape="'square'"></cmd-progress> -->
<arprogress :percent="item.num" :inactiveColor="['#c6e6f5','#f4dfc6','#c8d7f5'][index]"
:activeColor="['#00a2e9','#e87c00','#0b56ec'][index]" :borderWidth="7.8" :width="120"
:duration="500" bgColor="transparent"><text
:style="{color: ['#00a2e9','#e87c00','#0b56ec'][index]}">{{item.num}}%</text>
:duration="500" bgColor="transparent"><text :style="{color: ['#00a2e9','#e87c00','#0b56ec'][index]}">{{item.num}}%</text>
</arprogress>
<view class="fon24 mar-s20">{{item.title}}</view>
</view>
@ -123,15 +122,15 @@
],
percentageList: [{
title: '预约及时率',
num: 100
num: 0
},
{
title: '上门准时率',
num: 60
num: 0
},
{
title: '项目报修率',
num: 40
num: 0
},
],
gridList: [{
@ -197,13 +196,6 @@
this.$toolAll.tools.showToast('退出成功');
//
uni.clearStorageSync();
//
// #ifdef APP-PLUS
uni.setStorageSync('hostapi', 'http://maintain.7and5.cn');
// #endif
// #ifdef H5
uni.setStorageSync('hostapi', '/web');
// #endif
setTimeout(() => {
uni.reLaunch({
url: '/pages/login/login'