Răsfoiți Sursa

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

panhui 4 ani în urmă
părinte
comite
97389e0a00

+ 4 - 0
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -194,6 +194,10 @@ public class AssetService {
         }
         Collection collection = collectionRepo.findById(asset.getPublicCollectionId())
                 .orElseThrow(new BusinessException("无展示记录"));
+        collectionRepo.delete(collection);
 
+        asset.setPublicShow(false);
+        asset.setCollectionId(null);
+        assetRepo.save(asset);
     }
 }

+ 5 - 0
src/main/java/com/izouma/nineth/web/AssetController.java

@@ -62,5 +62,10 @@ public class AssetController extends BaseController {
     public void publicShow(@RequestParam Long id) {
         assetService.publicShow(id);
     }
+
+    @PostMapping("/cancelPublic")
+    public void cancelPublic(@RequestParam Long id) {
+        assetService.cancelPublic(id);
+    }
 }
 

+ 1 - 0
src/main/nine-space/.env.development

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=http://localhost:8080

+ 1 - 0
src/main/nine-space/.env.production

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=/

+ 89 - 103
src/main/nine-space/src/plugins/http.js

@@ -1,123 +1,109 @@
 import axios from 'axios';
 import qs from 'qs';
 /* eslint-disable */
-let baseUrl = "http://localhost:8080";
-switch (process.env.NODE_ENV) {
-  case "development":
-    // baseUrl = 'http://zhirongip.izouma.com';
-    // baseUrl = 'http://192.168.50.190:8080';
-    baseUrl = "https://nft.9space.vip";
-    // baseUrl = 'http://192.168.50.190:8080';
-    break;
-  case "test":
-    baseUrl = "http://localhost:8080";
-    break;
-  case "production":
-    baseUrl = "../../";
-    break;
-}
+let baseUrl = process.env.VUE_APP_BASE_URL;
 const axiosInstance = axios.create({
-  baseURL: baseUrl
+    baseURL: baseUrl
 });
 
 axiosInstance.interceptors.request.use(
-  function (config) {
-    config.headers = config.headers || {};
-    let token = localStorage.getItem("nineToken");
-    if (token) {
-      config.headers["Authorization"] = "Bearer " + token;
+    function (config) {
+        config.headers = config.headers || {};
+        let token = localStorage.getItem('nineToken');
+        if (token) {
+            config.headers['Authorization'] = 'Bearer ' + token;
+        }
+        return config;
+    },
+    function (error) {
+        return Promise.reject(error);
     }
-    return config;
-  },
-  function (error) {
-    return Promise.reject(error);
-  }
 );
 
 axiosInstance.interceptors.response.use(
-  function (response) {
-    return response;
-  },
-  function (error) {
-    let errorData = {};
-    if (!error.response) {
-      errorData = {
-        error: "网络错误,请检查网络链接"
-      };
-    } else {
-      errorData = error.response.data;
-      // if (401 === error.response.status) {
-      //     if (router.currentRoute.name !== 'login') {
-      //         router.replace({
-      //             name: 'login',
-      //             params: {
-      //                 from: router.currentRoute.name
-      //             }
-      //         });
-      //     } else {
-      //     }
-      // }
+    function (response) {
+        return response;
+    },
+    function (error) {
+        let errorData = {};
+        if (!error.response) {
+            errorData = {
+                error: '网络错误,请检查网络链接'
+            };
+        } else {
+            errorData = error.response.data;
+            // if (401 === error.response.status) {
+            //     if (router.currentRoute.name !== 'login') {
+            //         router.replace({
+            //             name: 'login',
+            //             params: {
+            //                 from: router.currentRoute.name
+            //             }
+            //         });
+            //     } else {
+            //     }
+            // }
+        }
+        console.log(typeof errorData);
+        if (typeof errorData != 'object') {
+            errorData = {
+                error: '请求失败' + error.response.status
+            };
+        }
+        return Promise.reject(errorData);
     }
-    console.log(typeof errorData);
-    if (typeof errorData != "object") {
-      errorData = {
-        error: "请求失败" + error.response.status
-      };
-    }
-    return Promise.reject(errorData);
-  }
 );
 
 const http = {
-  get(url, params) {
-    params = params || {};
-    return new Promise((resolve, reject) => {
-      axiosInstance
-        .get(
-          url,
-          {
-            params: params
-          },
-          {
-            withCredentials: true
-          }
-        )
-        .then((res) => {
-          resolve(res.data);
-        })
-        .catch((e) => {
-          reject(e);
+    get(url, params) {
+        params = params || {};
+        return new Promise((resolve, reject) => {
+            axiosInstance
+                .get(
+                    url,
+                    {
+                        params: params
+                    },
+                    {
+                        withCredentials: true
+                    }
+                )
+                .then(res => {
+                    resolve(res.data);
+                })
+                .catch(e => {
+                    reject(e);
+                });
         });
-    });
-  },
-  post(url, body, options) {
-    options = options || {};
-    body = body || {};
-    if (!(body instanceof FormData)) {
-      if (options.body !== "json") {
-        body = qs.stringify(body);
-      }
-    }
-    return new Promise((resolve, reject) => {
-      axiosInstance
-        .post(url, body, {
-          withCredentials: true
-        })
-        .then((res) => {
-          resolve(res.data);
-        })
-        .catch((e) => {
-          reject(e);
+    },
+    post(url, body, options) {
+        options = options || {};
+        body = body || {};
+        if (!(body instanceof FormData)) {
+            if (options.body !== 'json') {
+                body = qs.stringify(body);
+            }
+        }
+        return new Promise((resolve, reject) => {
+            axiosInstance
+                .post(url, body, {
+                    withCredentials: true
+                })
+                .then(res => {
+                    resolve(res.data);
+                })
+                .catch(e => {
+                    reject(e);
+                });
         });
-    });
-  }
+    }
 };
 export default {
-  axios: axiosInstance,
-  http: http,
-  install(app, options) {
-    app.config.globalProperties.$baseUrl = baseUrl;
-    app.config.globalProperties.$axios = axiosInstance;
-    app.config.globalProperties.$http = http;
-  }
+    axios: axiosInstance,
+    http: http,
+    install(app, options) {
+        app.config.globalProperties.$baseUrl = baseUrl;
+        app.config.globalProperties.$axios = axiosInstance;
+        app.config.globalProperties.$http = http;
+    }
 };

+ 1 - 0
src/main/vue/.env.development

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=http://localhost:8080

+ 1 - 0
src/main/vue/.env.production

@@ -0,0 +1 @@
+VUE_APP_BASE_URL=./

+ 1 - 13
src/main/vue/src/plugins/http.js

@@ -2,19 +2,7 @@ import axios from 'axios';
 import router from '../router';
 import qs from 'qs';
 /* eslint-disable */
-let baseUrl = 'http://localhost:8080';
-switch (process.env.NODE_ENV) {
-    case 'development':
-        baseUrl = 'http://localhost:8080';
-        // baseUrl = 'http://192.168.50.127:8080';
-        break;
-    case 'test':
-        baseUrl = 'http://localhost:8080';
-        break;
-    case 'production':
-        baseUrl = '../';
-        break;
-}
+let baseUrl = process.env.VUE_APP_BASE_URL;
 const axiosInstance = axios.create({
     baseURL: baseUrl
 });