Browse Source

文件修改

huangyan 9 months ago
parent
commit
337ca59d0f

+ 3 - 3
src/api/contact.js

@@ -1,16 +1,16 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const getAllContact = (params) => {
-    return http.post('/contactall', params)
+    return http.post('/api/contactall', params)
 };
 // 添加资源
 const addContact = (params) => {
-    return http.post('/contact', params)
+    return http.post('/api/contact', params)
 };
 
 // 删除资源
 const deleteContact = (params) => {
-    return http.del('/contact', params)
+    return http.del('/api/contact', params)
 }
 export default {
     getAllContact, addContact, deleteContact

+ 5 - 5
src/api/contents.js

@@ -1,23 +1,23 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const  getAllrecruit=  (params) => {
-    return http.post('/allrecruit', params)
+    return http.post('/api/allrecruit', params)
 };
 // 获取资源详情
 const  getRecruitDetail= (params) => {
-    return http.get('/recruit', params)
+    return http.get('/api/recruit', params)
 };
 // 添加资源
 const   addRecruit= (params) => {
-    return http.post('/recruit', params)
+    return http.post('/api/recruit', params)
 };
 // 修改资源
 const   updateRecruit=(params) => {
-    return http.put('/recruit', params)
+    return http.put('/api/recruit', params)
 };
 // 删除资源
 const   deleteRecruit= (params) => {
-    return http.del('/recruit', params)
+    return http.del('/api/recruit', params)
 }
 export default {
     getAllrecruit, deleteRecruit, updateRecruit, addRecruit, getRecruitDetail

+ 5 - 5
src/api/dataModel.js

@@ -1,22 +1,22 @@
 import http from '../utils/http/http.js'
 // 获取数据资源列表
 const  getAllData=  (params) => {
-    return http.post('/datasall', params)
+    return http.post('/api/datasall', params)
 };
 // 添加数据
 const  addData= (params) => {
-    return http.post('/datas', params)
+    return http.post('/api/datas', params)
 };
 const  getDataType= () => {
-    return http.get('/getdatatype')
+    return http.get('/api/getdatatype')
 };
 // 修改数据
 const  updateData=(params) => {
-    return http.put('/datas', params)
+    return http.put('/api/datas', params)
 };
 // 删除数据
 const  deleteData= (params) => {
-    return http.del('/data', params)
+    return http.del('/api/data', params)
 }
 export default {
     getAllData, addData, updateData, deleteData,getDataType

+ 6 - 6
src/api/news.js

@@ -1,26 +1,26 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const  getAllNew=  (params) => {
-    return http.post('/news', params)
+    return http.post('/api/news', params)
 };
 // 获取资源详情
 const  getNewDetail= (params) => {
-    return http.get('/news', params)
+    return http.get('/api/news', params)
 };
 // 添加资源
 const   addNew= (params) => {
-    return http.post('/addnews', params)
+    return http.post('/api/addnews', params)
 };
 // 修改资源
 const   updateNew=(params) => {
-    return http.put('/news', params)
+    return http.put('/api/news', params)
 };
 // 删除资源
 const   deleteNew= (params) => {
-    return http.del('/news', params)
+    return http.del('/api/news', params)
 }
 const   getnewstype= (params) => {
-    return http.get('/newstype', params)
+    return http.get('/api/newstype', params)
 }
 export default {
     getAllNew, getNewDetail, addNew, updateNew, deleteNew,getnewstype

+ 6 - 6
src/api/product.js

@@ -1,27 +1,27 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const getProductList = (params) => {
-    return http.post('/productAll', params)
+    return http.post('/api/productAll', params)
 };
 // 获取资源详情
 const getProductDetail = (params) => {
-    return http.get('/product', params)
+    return http.get('/api/product', params)
 };
 // 添加资源
 const addProduct = (params) => {
-    return http.post('/product', params)
+    return http.post('/api/product', params)
 };
 // 修改资源
 const updateProduct = (params) => {
-    return http.put('/product', params)
+    return http.put('/api/product', params)
 };
 // 上传配套资源
 const uploadFile = (params) => {
-    return http.post('/file', params)
+    return http.post('/api/file', params)
 };
 // 删除资源
 const deleteProduct = (params) => {
-    return http.del('/product', params)
+    return http.del('/api/product', params)
 }
 export default {
     getProductList, getProductDetail, addProduct, updateProduct, deleteProduct, uploadFile

+ 6 - 6
src/api/resource.js

@@ -1,26 +1,26 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const getResourceList = (params) => {
-    return http.post('/resource', params)
+    return http.post('/api/resource', params)
 };
 // 获取资源详情
 const getResourceDetail = (params) => {
-    return http.get('/resource', params)
+    return http.get('/api/resource', params)
 };
 // 添加资源
 const addResource = (params) => {
-    return http.post('/upload', params)
+    return http.post('/api/upload', params)
 };
 // 修改资源
 const updateResource = (params) => {
-    return http.put('/updateResource', params)
+    return http.put('/api/updateResource', params)
 };
 // 删除资源
 const deleteResource = (params) => {
-    return http.del('/resource', params)
+    return http.del('/api/resource', params)
 }
 const uploadResource = (params) => {
-    return http.post('/upload', params)
+    return http.post('/api/upload', params)
 }
 
 export default {

+ 6 - 6
src/api/serve.js

@@ -1,26 +1,26 @@
 import http from '../utils/http/http.js'
 // 获取资源列表
 const  getAllService=  (params) => {
-    return http.post('/allservice', params)
+    return http.post('/api/allservice', params)
 };
 // 获取资源详情
 const  getServiceDetail= (params) => {
-    return http.get('/service', params)
+    return http.get('/api/service', params)
 };
 // 添加资源
 const   addService= (params) => {
-    return http.post('/service', params)
+    return http.post('/api/service', params)
 };
 // 修改资源
 const   updateService=(params) => {
-    return http.put('/service', params)
+    return http.put('/api/service', params)
 };
 // 删除资源
 const   deleteService= (params) => {
-    return http.del('/service', params)
+    return http.del('/api/service', params)
 }
 const   GetServiceType= (params) => {
-    return http.get('/getservice', params)
+    return http.get('/api/getservice', params)
 }
 export default {
     deleteService, updateService, addService, getServiceDetail,getAllService,GetServiceType

+ 8 - 3
src/utils/http/axios.js

@@ -1,10 +1,10 @@
 import axios from "axios";
-import {ElMessage} from 'element-plus'
+import { ElMessage } from 'element-plus'
 import router from "../../router/index.js";
 // 1. 创建axios实例
 const instance = axios.create({
     // 接口
-    baseURL: "http://localhost:8080/api",
+    baseURL: "http://localhost:8080",
     // 超时时间
     timeout: 50000,
 });
@@ -14,7 +14,7 @@ instance.interceptors.request.use(
         let token = localStorage.getItem('token')
         if (token) {
             config.headers['Authorization'] = token
-        }else{
+        } else {
             router.push("/login");
             ElMessage.error("未登录,请重新登录");
         }
@@ -38,6 +38,11 @@ instance.interceptors.response.use(
                 case 400:
                     ElMessage.error("请求错误");
                     break;
+                case 401:
+                    ElMessage.error("未授权,请重新登录");
+                    localStorage.removeItem('token')
+                    router.push("/login");
+                    break;
                 case 103:
                     ElMessage.error("未授权,请重新登录");
                     localStorage.removeItem('token')

+ 2 - 2
src/view/Home.vue

@@ -32,12 +32,12 @@
                         </el-icon>
                     </div>
                     <el-menu router :default-active="activePath" class="el-menu-vertical-demo" :collapse="isCollapse">
-                        <el-menu-item index="/index" @click="saveActiveNav('/index')">
+                        <!-- <el-menu-item index="/index" @click="saveActiveNav('/index')">
                             <el-icon>
                                 <house/>
                             </el-icon>
                             <span>首页</span>
-                        </el-menu-item>
+                        </el-menu-item> -->
                         <!--<el-sub-menu index="1">-->
                         <!--    <template #title>-->
                         <!--        <el-icon>-->

+ 1 - 1
src/view/Login.vue

@@ -60,7 +60,7 @@ const onSubmit = () => {
                 if (res.data.Code===200) {
                     // proxy.$commonJs.changeView('/home');
                     localStorage.setItem("token", res.data.Data);
-                    router.push("/home");
+                    router.push("/contact/list");
                 } else {
                     ElMessage.error(res.data.Msg);
                 }

+ 0 - 4
src/view/contents/contents.vue

@@ -82,10 +82,6 @@ const getRecruitAll = async () => {
   total.value = res.data.Data.Size;
 }
 
-function imageUrlWithPrefix(url) {
-  const prefix = 'http://localhost:8080'; // 这里替换为你的图片服务器基础路径
-  return prefix + url;
-}
 const handleCurrentChange = (current) => {
   searchForm.page = current;
   getRecruitAll();

+ 1 - 6
src/view/news/news.vue

@@ -13,7 +13,7 @@
         </el-table-column>
         <el-table-column label="图片" width="120">
           <template #default="scope">
-            <img :src="imageUrlWithPrefix(scope.row.image)" alt="图片" style="max-width: 100%; height: auto;">
+            <img :src="scope.row.image" alt="图片" style="max-width: 100%; height: auto;">
           </template>
         </el-table-column>
         <el-table-column prop="title" label="新闻标题" width="180">
@@ -117,11 +117,6 @@ const updateProduct = async (id,isIndex) => {
   }
 }
 
-function imageUrlWithPrefix(url) {
-  const prefix = 'http://localhost:8080'; // 这里替换为你的图片服务器基础路径
-  return prefix + url;
-}
-
 const handleSizeChange = (size) => {
   searchForm.size = size;
   getNewsAll();

+ 1 - 5
src/view/product/product.vue

@@ -13,7 +13,7 @@
                 </el-table-column>
                 <el-table-column label="图片" width="120">
                     <template #default="scope">
-                        <img :src="imageUrlWithPrefix(scope.row.url)" alt="图片" style="max-width: 100%; height: auto;">
+                        <img :src="scope.row.url" alt="图片" style="max-width: 100%; height: auto;">
                     </template>
                 </el-table-column>
                 <el-table-column prop="title" label="名称" width="180">
@@ -141,10 +141,6 @@ const updateProduct = async (id, isIndex) => {
     }
 }
 
-function imageUrlWithPrefix(url) {
-    const prefix = 'http://localhost:8080'; // 这里替换为你的图片服务器基础路径
-    return prefix + url;
-}
 
 const handleSizeChange = (size) => {
     searchForm.size = size;

+ 1 - 6
src/view/resource/Index.vue

@@ -16,7 +16,7 @@
         </el-table-column>
         <el-table-column label="图片" width="120">
           <template #default="scope">
-            <img :src="imageUrlWithPrefix(scope.row.url)" alt="图片" style="max-width: 100%; height: auto;">
+            <img :src="scope.row.url" alt="图片" style="max-width: 100%; height: auto;">
           </template>
         </el-table-column>
         <el-table-column prop="type" label="类型" width="180">
@@ -84,11 +84,6 @@ const getResourceList = async () => {
   total.value = res.data.Data.Size;
 }
 
-function imageUrlWithPrefix(url) {
-  const prefix = 'http://localhost:8080'; // 这里替换为你的图片服务器基础路径
-  return prefix + url;
-}
-
 const handleSizeChange = (size) => {
   searchForm.size = size;
   getResourceList();