Skip to content

Commit

Permalink
[feat] 新增支持接入业务系统token
Browse files Browse the repository at this point in the history
  • Loading branch information
minliuhua committed Nov 12, 2024
1 parent 3d096d4 commit 557bfab
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 437 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @author warm
*/
@RestController
@RequestMapping("/warm-flow-ui")
@RequestMapping("/warm-flow")
public class WarmFlowUiController {

private static final Logger log = LoggerFactory.getLogger(WarmFlowUiController.class);
Expand Down

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const urlPrefix = import.meta.env.VITE_URL_PREFIX
// 保存流程定义
export function saveXml(data) {
return request({
url: urlPrefix + 'warm-flow-ui/save-xml',
url: urlPrefix + 'warm-flow/save-xml',
method: 'post',
data: data
})
Expand All @@ -14,23 +14,23 @@ export function saveXml(data) {
// 获取流程定义xml字符串
export function getXmlString(id) {
return request({
url: urlPrefix + 'warm-flow-ui/xml-string/' + id,
url: urlPrefix + 'warm-flow/xml-string/' + id,
method: 'get'
})
}

// 办理人权限设置列表tabs页签
export function handlerType() {
return request({
url: urlPrefix + 'warm-flow-ui/handler-type',
url: urlPrefix + 'warm-flow/handler-type',
method: 'get',
})
}

// 办理人权限设置列表结果
export function handlerResult(query) {
return request({
url: urlPrefix + 'warm-flow-ui/handler-result',
url: urlPrefix + 'warm-flow/handler-result',
method: 'get',
params: query
})
Expand Down
4 changes: 4 additions & 0 deletions warm-flow-ui/warm-flow-vue3-logic-flow/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import store from './store'

// 注册指令
import plugins from './plugins' // plugins
import {TokenKey} from "./utils/auth.js";

// svg图标
import 'virtual:svg-icons-register'
Expand All @@ -26,6 +27,9 @@ const app = createApp(App)
const urlParams = new URLSearchParams(window.location.search);
const params = {};
for (const [key, value] of urlParams.entries()) {
if ("token" === key) {
Cookies.set(TokenKey, value)
}
params[key] = value;
}

Expand Down
15 changes: 15 additions & 0 deletions warm-flow-ui/warm-flow-vue3-logic-flow/src/utils/auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Cookies from 'js-cookie'

export const TokenKey = 'Warm-Token'

export function getToken() {
return Cookies.get(TokenKey)
}

export function setToken(token) {
return Cookies.set(TokenKey, token)
}

export function removeToken() {
return Cookies.remove(TokenKey)
}
7 changes: 4 additions & 3 deletions warm-flow-ui/warm-flow-vue3-logic-flow/src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import axios from 'axios'
import { ElNotification , ElMessage } from 'element-plus'
import { tansParams } from '@/utils/ruoyi'
import cache from '@/plugins/cache'

// 是否显示重新登录
export let isRelogin = { show: false };
import {getToken} from "./auth.js";

axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
Expand All @@ -19,6 +17,9 @@ const service = axios.create({
service.interceptors.request.use(config => {
// 是否需要防止数据重复提交
const isRepeatSubmit = (config.headers || {}).repeatSubmit === false
if (getToken()) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?' + tansParams(config.params);
Expand Down

0 comments on commit 557bfab

Please sign in to comment.