Bläddra i källkod

feat:新增文件流上传使用redis中转流时间常量

韩帛霖 11 månader sedan
förälder
incheckning
5962587e29

+ 11 - 7
zkqy-common/src/main/java/com/zkqy/common/constant/Constants.java

@@ -4,11 +4,10 @@ import io.jsonwebtoken.Claims;
 
 /**
  * 通用常量信息
- * 
+ *
  * @author ruoyi
  */
-public class Constants
-{
+public class Constants {
     /**
      * UTF-8 字符集
      */
@@ -63,12 +62,17 @@ public class Constants
      * 登录失败
      */
     public static final String LOGIN_FAIL = "Error";
- 
+
     /**
      * 验证码有效期(分钟)
      */
     public static final Integer CAPTCHA_EXPIRATION = 2;
 
+    /**
+     * 共通文件上传存放redis时间(分钟)
+     */
+    public static final Integer BYTESTREAM_EXPIRATION = 30;
+
     /**
      * 令牌
      */
@@ -132,11 +136,11 @@ public class Constants
     /**
      * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
      */
-    public static final String[] JOB_WHITELIST_STR = { "com.zkqy" };
+    public static final String[] JOB_WHITELIST_STR = {"com.zkqy"};
 
     /**
      * 定时任务违规的字符
      */
-    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
-            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
+    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
+            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"};
 }

+ 40 - 44
zkqy-ui/src/views/login.vue

@@ -59,7 +59,7 @@
           </el-col>
           <el-col :span="4" :offset="1">
             <div class="login-code">
-              <img :src="codeUrl" @click="getCode" class="login-code-img" />
+              <img :src="codeUrl" @click="getCode" class="login-code-img"/>
             </div>
           </el-col>
         </el-row>
@@ -70,7 +70,7 @@
           <img :src="codeUrl" @click="getCode" class="login-code-img" />
         </div> -->
         <el-checkbox v-model="loginForm.rememberMe" class="aaa"
-          >在这个设备上记住我
+        >在这个设备上记住我
         </el-checkbox>
       </el-row>
 
@@ -79,7 +79,7 @@
           class="logg"
           :loading="loading"
           @click.native.prevent="handleLogin"
-          >登录
+        >登录
         </el-col>
       </el-row>
     </el-form>
@@ -87,10 +87,10 @@
 </template>
 
 <script>
-import { getCodeImg, isTenantExist, ssoLogin } from "@/api/login";
-import { changeDatasource } from "@/api/dataEngine";
+import {getCodeImg, isTenantExist, ssoLogin} from "@/api/login";
+import {changeDatasource} from "@/api/dataEngine";
 import Cookies from "js-cookie";
-import { encrypt, decrypt } from "@/utils/jsencrypt";
+import {encrypt, decrypt} from "@/utils/jsencrypt";
 
 export default {
   name: "Login",
@@ -111,12 +111,12 @@ export default {
       },
       loginRules: {
         username: [
-          { required: true, trigger: "blur", message: "请输入您的账号" },
+          {required: true, trigger: "blur", message: "请输入您的账号"},
         ],
         password: [
-          { required: true, trigger: "blur", message: "请输入您的密码" },
+          {required: true, trigger: "blur", message: "请输入您的密码"},
         ],
-        code: [{ required: true, trigger: "blur", message: "请输入验证码" }],
+        code: [{required: true, trigger: "blur", message: "请输入验证码"}],
       },
       loading: true,
       // 验证码开关
@@ -142,15 +142,16 @@ export default {
   methods: {
     // client_id=x3qwrgrO1wYdz72joZ8YyIuD&scope=basic&response_type=code&state=AB1357&redirect_uri=http://127.0.0.1:8001/login
 
+
     // 校验url
     validateTenantId() {
       let tenantCode = this.$route.query["tenantCode"];
       if (tenantCode != null) {
         // 得到tenantId 查询裤中是否存在该租户
-        isTenantExist({ tenantCode: tenantCode }).then((res) => {
+        isTenantExist({tenantCode: tenantCode}).then((res) => {
           if (res == undefined) {
             this.$message.warning("请访问正确地址!");
-            this.$router.push({ path: "/401" });
+            this.$router.push({path: "/401"});
           } else if (res.data?.tenantId) {
             // 判断当前编号是否存在库中
             this.tenantId = res.data.tenantId;
@@ -164,11 +165,11 @@ export default {
             this.getCookie();
           } else {
             // 当前访问链接中的租户编号不存在
-            this.$router.push({ path: "/401" });
+            this.$router.push({path: "/401"});
           }
         });
       } else {
-        this.$router.push({ path: "/401" });
+        this.$router.push({path: "/401"});
       }
     },
     setConfig() {
@@ -190,9 +191,9 @@ export default {
 
           console.log(
             "" +
-              `url(${
-                process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
-              })`
+            `url(${
+              process.env.VUE_APP_BASE_IMG_API + loginPageBackgroundImage
+            })`
           );
         }
       }
@@ -268,7 +269,7 @@ export default {
         if (valid) {
           this.loading = true;
           if (this.loginForm.rememberMe) {
-            Cookies.set("username", this.loginForm.username, { expires: 30 });
+            Cookies.set("username", this.loginForm.username, {expires: 30});
             Cookies.set("password", encrypt(this.loginForm.password), {
               expires: 30,
             });
@@ -281,34 +282,29 @@ export default {
             Cookies.remove("rememberMe");
           }
           let form = {
-            uri: "?client_id=xzz&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.76:8066/oauth/callback",
+            uri: "?client_id=mestool&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.114:8066/oauth/callback",
             ...this.loginForm,
             tenantID: this.tenantId,
           };
           // 调用单点登录
-          ssoLogin(form)
-            .then((response) => {
-              this.loading = false;
-              if (response.code === 200) {
-                // Message({message: response.msg, type: "success"});
-                console.log("认证成功!", response);
-                // response.msg 当前用户唯一标识 跳转其他系统使用
-                // this.$store.dispatch("setoauthUUID", response.msg);
-                window.localStorage.setItem(
-                  "setoauthUUID" + this.loginForm.username,
-                  response.msg
-                );
-                setTimeout(() => {
-                  global.window.location.href = response.data;
-                }, 1000);
-              }
-            })
-            .catch(() => {
-              this.loading = false;
-              if (this.captchaEnabled) {
-                this.getCode();
-              }
-            });
+          ssoLogin(form).then((response) => {
+            this.loading = false;
+            if (response.code === 200) {
+              // Message({message: response.msg, type: "success"});
+              console.log("认证成功!", response)
+              // response.msg 当前用户唯一标识 跳转其他系统使用
+              // this.$store.dispatch("setoauthUUID", response.msg);
+              window.localStorage.setItem("setoauthUUID" + this.loginForm.username, response.msg);
+              setTimeout(() => {
+                global.window.location.href = response.data;
+              }, 1000);
+            }
+          }).catch(() => {
+            this.loading = false;
+            if (this.captchaEnabled) {
+              this.getCode();
+            }
+          });
 
           // this.$store
           //   .dispatch("Login", form)
@@ -379,9 +375,9 @@ export default {
   opacity: 1;
   border-radius: 27px;
   background: linear-gradient(
-    135deg,
-    rgba(79, 138, 255, 1) 0%,
-    rgba(75, 94, 255, 1) 100%
+      135deg,
+      rgba(79, 138, 255, 1) 0%,
+      rgba(75, 94, 255, 1) 100%
   );
   box-shadow: 0px 4px 16px rgba(179, 192, 231, 1);
   color: #fff;

+ 1 - 3
zkqy-ui/vue.config.js

@@ -38,9 +38,7 @@ module.exports = {
     proxy: {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
-        // target: `http://192.168.110.52:8066`,
-        // target: `http://192.168.110.59:8066`,
-        target: `http://192.168.110.15:8066/`,
+        target: `http://192.168.110.114:8066`,
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''