vue2-client 1.18.62 → 1.18.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.claude/settings.local.json +28 -28
  2. package/.eslintrc.js +74 -74
  3. package/Components.md +60 -60
  4. package/docs/index.md +30 -30
  5. package/index.js +31 -31
  6. package/jest-transform-stub.js +8 -8
  7. package/jest.setup.js +7 -7
  8. package/package.json +1 -1
  9. package/src/assets/img/querySlotDemo.svg +15 -15
  10. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  11. package/src/base-client/components/common/CitySelect/index.js +3 -3
  12. package/src/base-client/components/common/CitySelect/index.md +109 -109
  13. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  14. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  15. package/src/base-client/components/common/HIS/HTab/HTab.vue +1 -0
  16. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  17. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  18. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  19. package/src/base-client/components/common/Tree/index.js +2 -2
  20. package/src/base-client/components/common/Upload/index.js +3 -3
  21. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  22. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  23. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  24. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  25. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  26. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  27. package/src/base-client/components/common/XDescriptions/index.md +322 -322
  28. package/src/base-client/components/common/XForm/index.md +178 -178
  29. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  30. package/src/base-client/components/common/XStepView/index.js +3 -3
  31. package/src/base-client/components/common/XStepView/index.md +31 -31
  32. package/src/base-client/components/common/XTable/XTable.vue +1715 -1715
  33. package/src/base-client/components/common/XTable/XTableWrapper.vue +786 -786
  34. package/src/base-client/components/common/XTable/index.md +255 -255
  35. package/src/base-client/components/his/XTitle/XTitle.vue +10 -0
  36. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  37. package/src/base-client/plugins/Config.js +19 -19
  38. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  39. package/src/components/Charts/Bar.vue +62 -62
  40. package/src/components/Charts/ChartCard.vue +134 -134
  41. package/src/components/Charts/Liquid.vue +67 -67
  42. package/src/components/Charts/MiniArea.vue +39 -39
  43. package/src/components/Charts/MiniBar.vue +39 -39
  44. package/src/components/Charts/MiniProgress.vue +75 -75
  45. package/src/components/Charts/MiniSmoothArea.vue +40 -40
  46. package/src/components/Charts/Radar.vue +68 -68
  47. package/src/components/Charts/RankList.vue +77 -77
  48. package/src/components/Charts/TagCloud.vue +113 -113
  49. package/src/components/Charts/TransferBar.vue +64 -64
  50. package/src/components/Charts/Trend.vue +82 -82
  51. package/src/components/Charts/chart.less +12 -12
  52. package/src/components/Charts/smooth.area.less +13 -13
  53. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  54. package/src/components/NumberInfo/index.js +3 -3
  55. package/src/components/NumberInfo/index.less +54 -54
  56. package/src/components/NumberInfo/index.md +43 -43
  57. package/src/components/card/ChartCard.vue +79 -79
  58. package/src/components/chart/Bar.vue +60 -60
  59. package/src/components/chart/MiniArea.vue +67 -67
  60. package/src/components/chart/MiniBar.vue +59 -59
  61. package/src/components/chart/MiniProgress.vue +57 -57
  62. package/src/components/chart/Radar.vue +80 -80
  63. package/src/components/chart/RankingList.vue +60 -60
  64. package/src/components/chart/Trend.vue +79 -79
  65. package/src/components/chart/index.less +9 -9
  66. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  67. package/src/components/input/IInput.vue +66 -66
  68. package/src/components/menu/SideMenu.vue +75 -75
  69. package/src/components/menu/menu.js +273 -273
  70. package/src/components/tool/AStepItem.vue +60 -60
  71. package/src/layouts/BlankView.vue +16 -14
  72. package/src/layouts/CommonLayout.vue +56 -56
  73. package/src/layouts/header/HeaderNotice.vue +177 -177
  74. package/src/lib.js +1 -1
  75. package/src/mock/extend/index.js +84 -84
  76. package/src/mock/goods/index.js +108 -108
  77. package/src/pages/dashboard/workplace/WorkPlace.vue +141 -141
  78. package/src/pages/system/dictionary/index.vue +44 -44
  79. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  80. package/src/pages/system/monitor/operLog/index.vue +37 -37
  81. package/src/pages/userInfoDetailManage/uploadFilesHistory/ImagePreview.vue +58 -4
  82. package/src/pages/userInfoDetailManage/uploadFilesHistory/index.vue +57 -11
  83. package/src/services/api/cas.js +79 -79
  84. package/src/store/modules/setting.js +119 -119
  85. package/src/utils/authority-utils.js +85 -85
  86. package/src/utils/errorCode.js +6 -6
  87. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,44 +1,44 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <dictionary-details-view
4
- v-if="selectId"
5
- :id="selectId"
6
- :visible.sync="detailVisible"
7
- />
8
- <x-form-table
9
- serviceName="af-system"
10
- :queryParamsName="queryParamsName"
11
- title="字典"
12
- @action="toDetail">
13
- </x-form-table>
14
- </a-card>
15
- </template>
16
-
17
- <script>
18
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
19
- import DictionaryDetailsView from '@vue2-client/base-client/components/system/DictionaryDetailsView'
20
-
21
- export default {
22
- name: 'Dictionary',
23
- components: {
24
- XFormTable,
25
- DictionaryDetailsView
26
- },
27
- data () {
28
- return {
29
- // 选中的编号
30
- selectId: undefined,
31
- // 查询配置文件名
32
- queryParamsName: 'crud_dictionary_manage',
33
- // 是否显示详情抽屉
34
- detailVisible: false
35
- }
36
- },
37
- methods: {
38
- toDetail (record, id) {
39
- this.selectId = id + ''
40
- this.detailVisible = true
41
- }
42
- }
43
- }
44
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <dictionary-details-view
4
+ v-if="selectId"
5
+ :id="selectId"
6
+ :visible.sync="detailVisible"
7
+ />
8
+ <x-form-table
9
+ serviceName="af-system"
10
+ :queryParamsName="queryParamsName"
11
+ title="字典"
12
+ @action="toDetail">
13
+ </x-form-table>
14
+ </a-card>
15
+ </template>
16
+
17
+ <script>
18
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
19
+ import DictionaryDetailsView from '@vue2-client/base-client/components/system/DictionaryDetailsView'
20
+
21
+ export default {
22
+ name: 'Dictionary',
23
+ components: {
24
+ XFormTable,
25
+ DictionaryDetailsView
26
+ },
27
+ data () {
28
+ return {
29
+ // 选中的编号
30
+ selectId: undefined,
31
+ // 查询配置文件名
32
+ queryParamsName: 'crud_dictionary_manage',
33
+ // 是否显示详情抽屉
34
+ detailVisible: false
35
+ }
36
+ },
37
+ methods: {
38
+ toDetail (record, id) {
39
+ this.selectId = id + ''
40
+ this.detailVisible = true
41
+ }
42
+ }
43
+ }
44
+ </script>
@@ -1,37 +1,37 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <x-form-table
4
- title="登录日志"
5
- serviceName="af-system"
6
- :queryParamsName="queryParamsName"
7
- @action="toDetail">
8
- </x-form-table>
9
- </a-card>
10
- </template>
11
-
12
- <script>
13
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
14
-
15
- export default {
16
- name: 'LoginInfor',
17
- components: {
18
- XFormTable
19
- },
20
- data () {
21
- return {
22
- // 选中的编号
23
- selectNo: undefined,
24
- // 查询配置文件名
25
- queryParamsName: 'crud_login_infor_manage',
26
- // 是否显示详情抽屉
27
- detailVisible: false
28
- }
29
- },
30
- methods: {
31
- toDetail (record, id) {
32
- this.selectNo = id + ''
33
- this.detailVisible = true
34
- }
35
- }
36
- }
37
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <x-form-table
4
+ title="登录日志"
5
+ serviceName="af-system"
6
+ :queryParamsName="queryParamsName"
7
+ @action="toDetail">
8
+ </x-form-table>
9
+ </a-card>
10
+ </template>
11
+
12
+ <script>
13
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
14
+
15
+ export default {
16
+ name: 'LoginInfor',
17
+ components: {
18
+ XFormTable
19
+ },
20
+ data () {
21
+ return {
22
+ // 选中的编号
23
+ selectNo: undefined,
24
+ // 查询配置文件名
25
+ queryParamsName: 'crud_login_infor_manage',
26
+ // 是否显示详情抽屉
27
+ detailVisible: false
28
+ }
29
+ },
30
+ methods: {
31
+ toDetail (record, id) {
32
+ this.selectNo = id + ''
33
+ this.detailVisible = true
34
+ }
35
+ }
36
+ }
37
+ </script>
@@ -1,37 +1,37 @@
1
- <template>
2
- <a-card :bordered="false">
3
- <x-form-table
4
- title="操作日志"
5
- :queryParamsName="queryParamsName"
6
- serviceName="af-system"
7
- @action="toDetail">
8
- </x-form-table>
9
- </a-card>
10
- </template>
11
-
12
- <script>
13
- import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
14
-
15
- export default {
16
- name: 'OperLog',
17
- components: {
18
- XFormTable
19
- },
20
- data () {
21
- return {
22
- // 选中的编号
23
- selectNo: undefined,
24
- // 查询配置文件名
25
- queryParamsName: 'crud_oper_log_manage',
26
- // 是否显示详情抽屉
27
- detailVisible: false
28
- }
29
- },
30
- methods: {
31
- toDetail (record, id) {
32
- this.selectNo = id + ''
33
- this.detailVisible = true
34
- }
35
- }
36
- }
37
- </script>
1
+ <template>
2
+ <a-card :bordered="false">
3
+ <x-form-table
4
+ title="操作日志"
5
+ :queryParamsName="queryParamsName"
6
+ serviceName="af-system"
7
+ @action="toDetail">
8
+ </x-form-table>
9
+ </a-card>
10
+ </template>
11
+
12
+ <script>
13
+ import XFormTable from '@vue2-client/base-client/components/common/XFormTable/XFormTable'
14
+
15
+ export default {
16
+ name: 'OperLog',
17
+ components: {
18
+ XFormTable
19
+ },
20
+ data () {
21
+ return {
22
+ // 选中的编号
23
+ selectNo: undefined,
24
+ // 查询配置文件名
25
+ queryParamsName: 'crud_oper_log_manage',
26
+ // 是否显示详情抽屉
27
+ detailVisible: false
28
+ }
29
+ },
30
+ methods: {
31
+ toDetail (record, id) {
32
+ this.selectNo = id + ''
33
+ this.detailVisible = true
34
+ }
35
+ }
36
+ }
37
+ </script>
@@ -2,10 +2,11 @@
2
2
  <div v-if="visible" class="preview-mask">
3
3
  <div class="preview-container">
4
4
  <img
5
- :src="src"
5
+ :src="imageSrc"
6
6
  :style="imgStyle"
7
7
  class="preview-img"
8
8
  @mousedown="startDrag"
9
+ @error="handleImageError"
9
10
  draggable="false"
10
11
  />
11
12
  <div class="preview-actions">
@@ -20,22 +21,43 @@
20
21
  </template>
21
22
 
22
23
  <script setup>
23
- import { ref, computed } from 'vue'
24
+ import { ref, computed, watch } from 'vue'
24
25
 
25
- defineProps({
26
+ const props = defineProps({
26
27
  src: {
27
28
  type: String,
28
29
  required: true
29
30
  },
31
+ originalPath: {
32
+ type: String,
33
+ default: ''
34
+ },
30
35
  visible: Boolean
31
36
  })
32
- const emits = defineEmits(['close'])
37
+ const emits = defineEmits(['close', 'src-updated'])
33
38
 
34
39
  const scale = ref(1)
35
40
  const rotate = ref(0)
36
41
  const offset = ref({ x: 0, y: 0 })
37
42
  const dragging = ref(false)
38
43
  const dragStart = ref({ x: 0, y: 0 })
44
+ const imageSrc = ref(props.src)
45
+ const isFixed = ref(false) // 标记是否已修复过路径
46
+
47
+ // 当src变化时,更新imageSrc(如果路径没有被修复过)
48
+ watch(() => props.src, (newSrc) => {
49
+ if (!isFixed.value) {
50
+ imageSrc.value = newSrc
51
+ }
52
+ })
53
+
54
+ // 当visible变化时,如果是打开状态,重置imageSrc和修复标记
55
+ watch(() => props.visible, (newVisible) => {
56
+ if (newVisible) {
57
+ imageSrc.value = props.src
58
+ isFixed.value = false
59
+ }
60
+ })
39
61
 
40
62
  const imgStyle = computed(() => ({
41
63
  transform: `scale(${scale.value}) rotate(${rotate.value}deg) translate(${offset.value.x}px, ${offset.value.y}px)`,
@@ -69,6 +91,38 @@ const stopDrag = () => {
69
91
  document.removeEventListener('mousemove', onDrag)
70
92
  document.removeEventListener('mouseup', stopDrag)
71
93
  }
94
+
95
+ const handleImageError = (event) => {
96
+ if (!event.target || !props.originalPath) return
97
+
98
+ const currentSrc = imageSrc.value || ''
99
+ console.log('ImagePreview error - currentSrc:', currentSrc, 'originalPath:', props.originalPath)
100
+
101
+ if (currentSrc.includes('/files/')) {
102
+ console.log('ImagePreview: 已经是新格式,不再处理')
103
+ return
104
+ }
105
+ if (!currentSrc.includes('/rs/image/file/')) {
106
+ console.log('ImagePreview: 不是旧格式,不再处理')
107
+ return
108
+ }
109
+
110
+ const baseUrl = `${window.location.protocol}//${window.location.host}`
111
+
112
+ // 如果是本地文件路径,尝试新格式(保留目录结构)
113
+ if (props.originalPath.match(/^[A-Za-z]:[/\\]/)) {
114
+ const normalizedPath = props.originalPath.replace(/\\/g, '/')
115
+ const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
116
+ if (filesIndex !== -1) {
117
+ const relativePath = normalizedPath.substring(filesIndex + 1)
118
+ const newUrl = `${baseUrl}/${relativePath}`
119
+ console.log('ImagePreview: 切换到新格式URL:', newUrl)
120
+ imageSrc.value = newUrl
121
+ isFixed.value = true // 标记已修复
122
+ emits('src-updated', newUrl) // 通知父组件更新路径
123
+ }
124
+ }
125
+ }
72
126
  </script>
73
127
 
74
128
  <style scoped>
@@ -23,6 +23,7 @@
23
23
  class="file-image"
24
24
  v-if="file.f_filetype.includes('jpg') || file.f_filetype.includes('png')"
25
25
  @click="openPreview(file.f_downloadpath)"
26
+ @error="(e) => handleImageError(e, file.f_downloadpath)"
26
27
  style="cursor: pointer"
27
28
  />
28
29
  <p>上传时间: {{ file.f_uploaddate }}</p>
@@ -36,7 +37,7 @@
36
37
  </div>
37
38
  </a-list-item>
38
39
  </a-list>
39
- <ImagePreview :src="previewImg" :visible="previewVisible" @close="previewVisible = false" />
40
+ <ImagePreview :src="previewImg" :original-path="previewOriginalPath" :visible="previewVisible" @close="previewVisible = false" @src-updated="handleSrcUpdated" />
40
41
  </div>
41
42
  </template>
42
43
 
@@ -60,7 +61,8 @@ export default {
60
61
  fusetypes: [],
61
62
  isDelete: '0',
62
63
  previewVisible: false,
63
- previewImg: ''
64
+ previewImg: '',
65
+ previewOriginalPath: ''
64
66
  }
65
67
  },
66
68
  methods: {
@@ -93,24 +95,62 @@ export default {
93
95
  this.getFiles()
94
96
  },
95
97
  openPreview(src) {
98
+ this.previewOriginalPath = src
96
99
  this.previewImg = this.getFileUrl(src)
97
100
  this.previewVisible = true
98
101
  },
102
+ handleImageError(event, path) {
103
+ if (!path || !event.target) return
104
+ const currentSrc = event.target.src || ''
105
+ console.log('列表图片error - currentSrc:', currentSrc, 'path:', path)
106
+
107
+ if (currentSrc.includes('/files/')) {
108
+ console.log('列表图片: 已经是新格式,不再处理')
109
+ return
110
+ }
111
+ if (!currentSrc.includes('/rs/image/file/')) {
112
+ console.log('列表图片: 不是旧格式,不再处理')
113
+ return
114
+ }
115
+ const baseUrl = `${window.location.protocol}//${window.location.host}`
116
+ // 如果是本地文件路径,尝试新格式(保留目录结构)
117
+ if (path.match(/^[A-Za-z]:[/\\]/)) {
118
+ const normalizedPath = path.replace(/\\/g, '/')
119
+ const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
120
+ if (filesIndex !== -1) {
121
+ const relativePath = normalizedPath.substring(filesIndex + 1)
122
+ const newUrl = `${baseUrl}/${relativePath}`
123
+ console.log('列表图片: 切换到新格式URL:', newUrl)
124
+ event.target.src = newUrl
125
+ }
126
+ }
127
+ },
128
+ handleSrcUpdated(newUrl) {
129
+ console.log('ImagePreview通知更新路径:', newUrl)
130
+ this.previewImg = newUrl
131
+ },
99
132
  getFileUrl(path) {
100
133
  if (!path) return ''
101
-
102
134
  console.log('原始路径:', path)
103
-
104
135
  // 获取当前域名和端口
105
136
  const baseUrl = `${window.location.protocol}//${window.location.host}`
106
-
107
- // 如果是本地文件路径,转换为新的转发路径
137
+ // 如果是本地文件路径,优先使用新格式(/files/...保留目录结构)
108
138
  if (path.match(/^[A-Za-z]:[/\\]/)) {
109
- // 提取文件名
110
- const fileName = path.split(/[/\\]/).pop()
111
- const newUrl = `${baseUrl}/rs/image/file/${fileName}`
112
- console.log('转换后路径:', newUrl)
113
- return newUrl
139
+ const normalizedPath = path.replace(/\\/g, '/')
140
+ const filesIndex = normalizedPath.toLowerCase().indexOf('/files/')
141
+ if (filesIndex !== -1) {
142
+ // 找到 /files/ 位置,使用新格式(保留目录结构)
143
+ const relativePath = normalizedPath.substring(filesIndex + 1)
144
+ const newUrl = `${baseUrl}/${relativePath}`
145
+ console.log('使用新格式路径:', newUrl)
146
+ return newUrl
147
+ } else {
148
+ // 如果路径中没有 /files/,使用旧格式
149
+ const fileName = normalizedPath.split('/').pop()
150
+ const newUrl = `${baseUrl}/rs/image/file/${encodeURIComponent(fileName)}`
151
+ console.log('使用旧格式路径:', newUrl)
152
+ return newUrl
153
+ }
114
154
  }
115
155
  // 如果已经是HTTP路径,直接返回
116
156
  if (path.startsWith('http')) {
@@ -123,6 +163,12 @@ export default {
123
163
  console.log('相对路径转换:', newUrl)
124
164
  return newUrl
125
165
  }
166
+ // 如果已经是 /files/ 开头的相对路径,直接添加域名前缀
167
+ if (path.startsWith('/files/')) {
168
+ const newUrl = `${baseUrl}${path}`
169
+ console.log('files相对路径转换:', newUrl)
170
+ return newUrl
171
+ }
126
172
  console.log('其他路径,直接返回:', path)
127
173
  return path
128
174
  }
@@ -1,79 +1,79 @@
1
- import { post } from '@vue2-client/services/api/restTools'
2
- import notification from 'ant-design-vue/lib/notification'
3
- import { logout } from '@vue2-client/services/user'
4
- import Cookie from 'js-cookie'
5
-
6
- const casApi = {
7
- // 根据用户信息校验服务访问权限并生成ST
8
- createSTByUserInfo: '/api/af-sso/logic/createSTByUserInfo',
9
- // 根据TGC生成ST
10
- createSTByTGC: '/api/af-sso/logic/createSTByTGC',
11
- // 验证ST
12
- serviceValidate: '/api/af-sso/logic/openapi/serviceValidate',
13
- // 其他验证
14
- otherValidate: '/api/af-sso/logic'
15
- }
16
-
17
- function setTGTCookie (cookie) {
18
- return Cookie.set('TGT-Cookie', cookie)
19
- }
20
- function removeTGTCookie () {
21
- return Cookie.remove('TGT-Cookie')
22
- }
23
- export function getTGTCookie () {
24
- return Cookie.get('TGT-Cookie')
25
- }
26
-
27
- export function CASLoginByAuth (serviceKey) {
28
- return new Promise((resolve, reject) => {
29
- post(casApi.createSTByUserInfo, {
30
- serviceKey: serviceKey
31
- }).then(res => {
32
- setTGTCookie(res.tgc)
33
- resolve(res)
34
- }).catch(msg => {
35
- reject(msg)
36
- })
37
- })
38
- }
39
-
40
- export function CASLogin (serviceKey, inner) {
41
- // 从第三方跳转登录
42
- const tgc = getTGTCookie()
43
- if (tgc && !inner) {
44
- return new Promise((resolve, reject) => {
45
- post(casApi.createSTByTGC, {
46
- serviceKey: serviceKey,
47
- tgc: tgc
48
- }).then(res => {
49
- resolve(res)
50
- }).catch(msg => {
51
- if (msg === '当前操作没有权限') {
52
- removeTGTCookie()
53
- notification.error({
54
- message: '授权已过期,请重新登录',
55
- description: '2秒后自动跳转回登陆页面'
56
- })
57
- logout().then(() => {
58
- setTimeout(() => {
59
- window.location.href = '/login?serviceKey=' + serviceKey
60
- }, 1500)
61
- })
62
- } else {
63
- reject(msg)
64
- }
65
- })
66
- })
67
- } else {
68
- return CASLoginByAuth(serviceKey)
69
- }
70
- }
71
-
72
- export function doOtherValidate (logicName, st, serviceKey) {
73
- return post(casApi.otherValidate + '/' + logicName, {
74
- st: st,
75
- serviceKey: serviceKey
76
- }, null)
77
- }
78
-
79
- export default casApi
1
+ import { post } from '@vue2-client/services/api/restTools'
2
+ import notification from 'ant-design-vue/lib/notification'
3
+ import { logout } from '@vue2-client/services/user'
4
+ import Cookie from 'js-cookie'
5
+
6
+ const casApi = {
7
+ // 根据用户信息校验服务访问权限并生成ST
8
+ createSTByUserInfo: '/api/af-sso/logic/createSTByUserInfo',
9
+ // 根据TGC生成ST
10
+ createSTByTGC: '/api/af-sso/logic/createSTByTGC',
11
+ // 验证ST
12
+ serviceValidate: '/api/af-sso/logic/openapi/serviceValidate',
13
+ // 其他验证
14
+ otherValidate: '/api/af-sso/logic'
15
+ }
16
+
17
+ function setTGTCookie (cookie) {
18
+ return Cookie.set('TGT-Cookie', cookie)
19
+ }
20
+ function removeTGTCookie () {
21
+ return Cookie.remove('TGT-Cookie')
22
+ }
23
+ export function getTGTCookie () {
24
+ return Cookie.get('TGT-Cookie')
25
+ }
26
+
27
+ export function CASLoginByAuth (serviceKey) {
28
+ return new Promise((resolve, reject) => {
29
+ post(casApi.createSTByUserInfo, {
30
+ serviceKey: serviceKey
31
+ }).then(res => {
32
+ setTGTCookie(res.tgc)
33
+ resolve(res)
34
+ }).catch(msg => {
35
+ reject(msg)
36
+ })
37
+ })
38
+ }
39
+
40
+ export function CASLogin (serviceKey, inner) {
41
+ // 从第三方跳转登录
42
+ const tgc = getTGTCookie()
43
+ if (tgc && !inner) {
44
+ return new Promise((resolve, reject) => {
45
+ post(casApi.createSTByTGC, {
46
+ serviceKey: serviceKey,
47
+ tgc: tgc
48
+ }).then(res => {
49
+ resolve(res)
50
+ }).catch(msg => {
51
+ if (msg === '当前操作没有权限') {
52
+ removeTGTCookie()
53
+ notification.error({
54
+ message: '授权已过期,请重新登录',
55
+ description: '2秒后自动跳转回登陆页面'
56
+ })
57
+ logout().then(() => {
58
+ setTimeout(() => {
59
+ window.location.href = '/login?serviceKey=' + serviceKey
60
+ }, 1500)
61
+ })
62
+ } else {
63
+ reject(msg)
64
+ }
65
+ })
66
+ })
67
+ } else {
68
+ return CASLoginByAuth(serviceKey)
69
+ }
70
+ }
71
+
72
+ export function doOtherValidate (logicName, st, serviceKey) {
73
+ return post(casApi.otherValidate + '/' + logicName, {
74
+ st: st,
75
+ serviceKey: serviceKey
76
+ }, null)
77
+ }
78
+
79
+ export default casApi