diff --git a/.history/src/tool/https_20240730122739.js b/.history/src/tool/https_20240730122739.js new file mode 100644 index 0000000..515e93e --- /dev/null +++ b/.history/src/tool/https_20240730122739.js @@ -0,0 +1,149 @@ +import axios from 'axios' +// import qs from 'qs' +// import message from '@/components/public/message/src' + +import router from '@/router/index' +import {getCookie} from '@/tool/cookie' +// import cookie from '@/tools/cookie.js' + +axios.defaults.timeout = 60000 * 60; //响应时间 +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; //配置请求头 +axios.defaults.withCredentials = true; //跨域携带cookie +import { message } from 'ant-design-vue'; +axios.defaults.baseURL = process.env.VUE_APP_BASE_URL; //配置接口地址 + +//POST传参序列化(添加请求拦截器) +axios.interceptors.request.use((config) => { + //在发送请求之前做某件事 + if(config.method === 'post' || config.method === 'put' || config.method === 'delete'){ + // config.data = qs.stringify(config.data); + // config.data = JSON.stringify(config.data); + } + + config.headers.Authorization = getCookie('token'); + return config; +},(error) =>{ + return Promise.reject(error); +}); + +//返回状态判断(添加响应拦截器) +axios.interceptors.response.use((res) =>{ + if (res.data) { + if (res.data.errCode === 0) { + return Promise.resolve(res.data.data); + + } else if(!res.data.errMsg){ + let obj = { + data:res.data, + type:res.headers['content-type'], + name:res.headers['content-disposition'], + } + return Promise.resolve(obj); + }else{ + message.error(res.data.errMsg) + return Promise.reject(res.data); + } + } else{ + message.error(res.data.errMsg) + return Promise.reject(res.data); + } + +}, function(error) { + if(error?.response?.status === 401){ + router.replace('/login') + return Promise.reject() + } + let data_new = error?.response?.data + message.error(data_new?.errMsg || 'Error: server exception') + return Promise.reject(data_new); + +}); + +export const Https = { + httpUrls: { + interfaceUrl: '', + accountLogin:'/api/account/login', //登入 + accountLogout:'/api/account/logout',//登出 + queryStorePage:'/api/store/queryStorePage',//门店分页列表 + sotreSaveOrEdit:'/api/store/saveOrEdit',//新增或编辑门店 + storeDelete:'/api/store/delete',//删除门店 + labelQueryStorePage:'/api/label/queryStorePage',//标签分页列表 + labelSaveOrEdit:'/api/label/saveOrEdit', //新增或编辑标签 + labelDelete:'/api/label/delete',//删除标签 + accountQueryUserPage:'/api/account/queryUserPage',//用户分页列表 + storeQueryAll:'/api/store/queryAll',//下拉-查询所有店铺 + roleQueryRolePage:'/api/role/queryRolePage', //角色分页列表 + roleQueryAll:'/api/role/queryAll', // 下拉-查询所有角色 + accountSaveOrEdit:'/api/account/saveOrEdit',//添加或编辑账号 + accountEnable:'/api/account/enable', // 禁用-停用账户 + accountDelete:'/api/account/delete',//删除账户 + roleQueryPermissionList:'/api/role/queryPermissionList',//查询权限列表 + roleSaveOrEdit:'/api/role/saveOrEdit', //新增或编辑角色 + roleDelete:'/api/role/delete', //删除角色 + queryProductPage:'/api/product/queryProductPage',//商品分页列表 + queryProductLabel:'/api/label/queryProductLabel',//下拉-查询所有商品标签 + queryProductAssortmentPage:'/api/product/queryProductAssortmentPage',//商品搭配分页列表 + attributeQueryAll:'/api/attribute/queryAll',//下拉-查询所有属性值 + productConfirmUpload:'/api/product/confirmUpload', + countWorkBench:'/api/product/countWorkBench',//首页工作台统计 + batchUploadProductRelation:'/api/product/batchUploadProductRelation',//批量上传商品后传对应的关联信息,新增商品 + productDelete:'/api/product/delete', //删除商品 + countProductUpdateProcess:'/api/product/countProductUpdateProcess', //统计商品批量上传进度 + productEdit:'/api/product/edit',//编辑商品 + productDetail:'/api/product/detail',//商品详情 + doOnSale:'/api/product/doOnSale', //上架-下架商品 + queryUsrPermission:'/api/role/queryUsrPermission',//菜单权限 + queryProductStore:'/api/store/queryProductStore', //下拉-查询所有商品店铺 + exportProduct:'/api/product/exportProduct', //商品导出 + miTuExportPage:'/api/miTuExport/miTuExportPage', //获取导出报表列表 + miTuExportExport:'/api/miTuExport/export', //商品导出 + salesIncentivesAddTask:'/api/salesIncentives/addTask', //创建激励任务 + salesIncentivesQueryPage:'/api/salesIncentives/queryPage', //激励任务列表 + salesIncentivesSalesRanking:'/api/salesIncentives/salesRanking', //激励任务列表 + }, + + axiosGet(url,config) { + return new Promise((resolve, reject) => { + axios.get(url,config).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosPut(url, data) { + return new Promise((resolve, reject) => { + axios.put(url, data).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosPost(url, data,config) { + return new Promise((resolve, reject) => { + axios.post(url, data,config).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosDelete(url, newData) { + return new Promise((resolve, reject) => { + axios.delete(url,{data:newData}).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + + + + +} diff --git a/.history/src/tool/https_20240814143954.js b/.history/src/tool/https_20240814143954.js new file mode 100644 index 0000000..5983a52 --- /dev/null +++ b/.history/src/tool/https_20240814143954.js @@ -0,0 +1,149 @@ +import axios from 'axios' +// import qs from 'qs' +// import message from '@/components/public/message/src' + +import router from '@/router/index' +import {getCookie} from '@/tool/cookie' +// import cookie from '@/tools/cookie.js' + +axios.defaults.timeout = 60000 * 60; //响应时间 +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'; //配置请求头 +axios.defaults.withCredentials = true; //跨域携带cookie +import { message } from 'ant-design-vue'; +axios.defaults.baseURL = process.env.VUE_APP_BASE_URL; //配置接口地址 +console.log(process.env.VUE_APP_BASE_URL); +//POST传参序列化(添加请求拦截器) +axios.interceptors.request.use((config) => { + //在发送请求之前做某件事 + if(config.method === 'post' || config.method === 'put' || config.method === 'delete'){ + // config.data = qs.stringify(config.data); + // config.data = JSON.stringify(config.data); + } + + config.headers.Authorization = getCookie('token'); + return config; +},(error) =>{ + return Promise.reject(error); +}); + +//返回状态判断(添加响应拦截器) +axios.interceptors.response.use((res) =>{ + if (res.data) { + if (res.data.errCode === 0) { + return Promise.resolve(res.data.data); + + } else if(!res.data.errMsg){ + let obj = { + data:res.data, + type:res.headers['content-type'], + name:res.headers['content-disposition'], + } + return Promise.resolve(obj); + }else{ + message.error(res.data.errMsg) + return Promise.reject(res.data); + } + } else{ + message.error(res.data.errMsg) + return Promise.reject(res.data); + } + +}, function(error) { + if(error?.response?.status === 401){ + router.replace('/login') + return Promise.reject() + } + let data_new = error?.response?.data + message.error(data_new?.errMsg || 'Error: server exception') + return Promise.reject(data_new); + +}); + +export const Https = { + httpUrls: { + interfaceUrl: '', + accountLogin:'/api/account/login', //登入 + accountLogout:'/api/account/logout',//登出 + queryStorePage:'/api/store/queryStorePage',//门店分页列表 + sotreSaveOrEdit:'/api/store/saveOrEdit',//新增或编辑门店 + storeDelete:'/api/store/delete',//删除门店 + labelQueryStorePage:'/api/label/queryStorePage',//标签分页列表 + labelSaveOrEdit:'/api/label/saveOrEdit', //新增或编辑标签 + labelDelete:'/api/label/delete',//删除标签 + accountQueryUserPage:'/api/account/queryUserPage',//用户分页列表 + storeQueryAll:'/api/store/queryAll',//下拉-查询所有店铺 + roleQueryRolePage:'/api/role/queryRolePage', //角色分页列表 + roleQueryAll:'/api/role/queryAll', // 下拉-查询所有角色 + accountSaveOrEdit:'/api/account/saveOrEdit',//添加或编辑账号 + accountEnable:'/api/account/enable', // 禁用-停用账户 + accountDelete:'/api/account/delete',//删除账户 + roleQueryPermissionList:'/api/role/queryPermissionList',//查询权限列表 + roleSaveOrEdit:'/api/role/saveOrEdit', //新增或编辑角色 + roleDelete:'/api/role/delete', //删除角色 + queryProductPage:'/api/product/queryProductPage',//商品分页列表 + queryProductLabel:'/api/label/queryProductLabel',//下拉-查询所有商品标签 + queryProductAssortmentPage:'/api/product/queryProductAssortmentPage',//商品搭配分页列表 + attributeQueryAll:'/api/attribute/queryAll',//下拉-查询所有属性值 + productConfirmUpload:'/api/product/confirmUpload', + countWorkBench:'/api/product/countWorkBench',//首页工作台统计 + batchUploadProductRelation:'/api/product/batchUploadProductRelation',//批量上传商品后传对应的关联信息,新增商品 + productDelete:'/api/product/delete', //删除商品 + countProductUpdateProcess:'/api/product/countProductUpdateProcess', //统计商品批量上传进度 + productEdit:'/api/product/edit',//编辑商品 + productDetail:'/api/product/detail',//商品详情 + doOnSale:'/api/product/doOnSale', //上架-下架商品 + queryUsrPermission:'/api/role/queryUsrPermission',//菜单权限 + queryProductStore:'/api/store/queryProductStore', //下拉-查询所有商品店铺 + exportProduct:'/api/product/exportProduct', //商品导出 + miTuExportPage:'/api/miTuExport/miTuExportPage', //获取导出报表列表 + miTuExportExport:'/api/miTuExport/export', //商品导出 + salesIncentivesAddTask:'/api/salesIncentives/addTask', //创建激励任务 + salesIncentivesQueryPage:'/api/salesIncentives/queryPage', //激励任务列表 + salesIncentivesSalesRanking:'/api/salesIncentives/salesRanking', //激励任务列表 + }, + + axiosGet(url,config) { + return new Promise((resolve, reject) => { + axios.get(url,config).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosPut(url, data) { + return new Promise((resolve, reject) => { + axios.put(url, data).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosPost(url, data,config) { + return new Promise((resolve, reject) => { + axios.post(url, data,config).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + axiosDelete(url, newData) { + return new Promise((resolve, reject) => { + axios.delete(url,{data:newData}).then(response => { + resolve(response) + }).catch((error) => { + reject(error) + }) + }); + }, + + + + + +} diff --git a/.history/vue.config_20240812101644.js b/.history/vue.config_20240812101644.js new file mode 100644 index 0000000..a8e8456 --- /dev/null +++ b/.history/vue.config_20240812101644.js @@ -0,0 +1,46 @@ +const {defineConfig} = require('@vue/cli-service') +const path = require('path'); +module.exports = defineConfig({ + transpileDependencies: ['vuetify'], + lintOnSave:false,//关闭语法检查 + devServer: { + // hot: true, // 热更新 + port: '8060', + proxy: { + "/api": { + // target: 'http://18.167.251.121:5568', //后端接口地址 + target: 'http://192.168.1.9:5560/', //后端接口地址 + // target: 'http://18.167.251.121:10220/', //后端接口地址 + changeOrigin: true, //是否允许跨越 + } + }, + }, + pluginOptions: { + "style-resources-loader": { + preProcessor: "less", + patterns: [ + // 存放less变量文件的路径 + path.resolve(__dirname, "./src/assets/style/style.less") + + ] + + } + + }, + + css: { + loaderOptions: { + less: { + lessOptions: { + modifyVars: { + 'primary-color': '#ec6800' + }, + javascriptEnabled: true, + }, + + }, + + }, + + } +}) \ No newline at end of file diff --git a/.history/vue.config_20240823234240.js b/.history/vue.config_20240823234240.js new file mode 100644 index 0000000..b5906ed --- /dev/null +++ b/.history/vue.config_20240823234240.js @@ -0,0 +1,46 @@ +const {defineConfig} = require('@vue/cli-service') +const path = require('path'); +module.exports = defineConfig({ + transpileDependencies: ['vuetify'], + lintOnSave:false,//关闭语法检查 + devServer: { + // hot: true, // 热更新 + port: '8060', + proxy: { + "/api": { + // target: 'http://18.167.251.121:5568', //后端接口地址 + // target: 'http://192.168.1.9:5560/', //后端接口地址 + target: 'http://18.167.251.121:10220/', //后端接口地址 + changeOrigin: true, //是否允许跨越 + } + }, + }, + pluginOptions: { + "style-resources-loader": { + preProcessor: "less", + patterns: [ + // 存放less变量文件的路径 + path.resolve(__dirname, "./src/assets/style/style.less") + + ] + + } + + }, + + css: { + loaderOptions: { + less: { + lessOptions: { + modifyVars: { + 'primary-color': '#ec6800' + }, + javascriptEnabled: true, + }, + + }, + + }, + + } +}) \ No newline at end of file diff --git a/public/index.html b/public/index.html index beec2a8..68bb00f 100644 --- a/public/index.html +++ b/public/index.html @@ -5,7 +5,7 @@ -