xs-common-plugins 1.2.2 → 1.2.3

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 (56) hide show
  1. package/README.md +298 -298
  2. package/common.js +110 -110
  3. package/index.js +1 -1
  4. package/package.json +16 -16
  5. package/src/common/common.js +548 -548
  6. package/src/components/CheckBox_Cmp/index.vue +62 -62
  7. package/src/components/FormItem/index.vue +92 -92
  8. package/src/components/ReportCmp/index.vue +76 -76
  9. package/src/components/Search/index.scss +219 -219
  10. package/src/components/Search/index.vue +410 -410
  11. package/src/components/Search/product_option/index.scss +1 -1
  12. package/src/components/Search_filter/index.scss +104 -104
  13. package/src/components/TableItem/TableItem.vue +55 -55
  14. package/src/components/TextOVer/index.vue +55 -55
  15. package/src/components/UploadImg/index.vue +177 -177
  16. package/src/components/im/index.vue +155 -155
  17. package/src/components/im/pages/chatList/index.vue +45 -45
  18. package/src/components/im/pages/chatRoom/index.vue +159 -159
  19. package/src/components/xsSelect/index.vue +125 -125
  20. package/src/mixin/keepAlive.js +52 -0
  21. package/src/plugins/im/components/chat/index.scss +163 -163
  22. package/src/plugins/im/components/chat/index.vue +144 -144
  23. package/src/plugins/im/components/chat/methods.js +149 -149
  24. package/src/plugins/im/components/msg-image/index.vue +40 -40
  25. package/src/plugins/im/components/send-msg/index.scss +164 -164
  26. package/src/plugins/im/components/send-msg/index.vue +107 -107
  27. package/src/plugins/im/components/send-msg/methods.js +125 -125
  28. package/src/plugins/im/components/template-message/index.vue +76 -76
  29. package/src/plugins/im/components/without.vue +19 -19
  30. package/src/plugins/im/index.js +31 -31
  31. package/src/plugins/im/utils/services.js +625 -625
  32. package/src/plugins/index.js +60 -60
  33. package/src/plugins/row-col-cmp/index.js +20 -20
  34. package/src/router/permission.js +126 -126
  35. package/src/store/modules/dic.js +74 -74
  36. package/src/store/modules/oss.js +40 -40
  37. package/src/styles/index.scss +91 -91
  38. package/src/styles/table.scss +90 -90
  39. package/src/utils/api.js +54 -54
  40. package/src/utils/auth.js +38 -38
  41. package/src/utils/concat_batch_btns.js +88 -88
  42. package/src/utils/enum.js +150 -150
  43. package/src/utils/filter.js +5 -5
  44. package/src/utils/filterRules.js +55 -55
  45. package/src/utils/getMenu.js +82 -82
  46. package/src/utils/global_directive.js +10 -0
  47. package/src/utils/ossService.js +55 -55
  48. package/src/utils/prototype.js +46 -46
  49. package/src/utils/search.js +33 -33
  50. package/src/utils/signalR.js +24 -24
  51. package/src/views/callback/index.vue +35 -35
  52. package/src/views/home/index.vue +25 -25
  53. package/src/views/layout/components/AppMain.vue +21 -5
  54. package/src/views/layout/components/Navbar.vue +20 -13
  55. package/src/views/layout/components/TagsView/index.vue +130 -91
  56. package/src/views/slienceAuth/index.vue +42 -42
@@ -1,83 +1,83 @@
1
- import { getToken } from '@/utils/auth.js'
2
- import { getConfig } from '@/utils/global-config'
3
- import menu from "@/automatically/menu.js"
4
- import ask from '@/automatically/api'
5
- import store from '@/store'
6
-
7
- function main () {
8
- // if(process.env.NODE_ENV == "development") return
9
- getVersion();
10
- }
11
-
12
- function getVersion() {
13
- const token = getToken(`${getConfig('CLIENT_ID')}_token`)
14
- if(!token) return;
15
- ask.ucmng.api.sysmng.MenuOper.GetVersion({clientId: window.$baseCfg.CLIENT_ID}).then((res)=> {
16
- if(res.code == 0) {
17
- getMenuTree(res.data)//获取菜单树
18
- }
19
- })
20
- }
21
-
22
- function getMenuTree (version) {
23
- let apiVersion = menu.version;
24
- if (version == null || apiVersion > version) {
25
- if(!(menu && menu.list)) return;
26
- let moduleName = menu.list[0].moduleName ? menu.list[0].moduleName : ''
27
- let menuList = menu.list;
28
- let obj = {
29
- clientId: window.$baseCfg ? window.$baseCfg.CLIENT_ID : '',
30
- moduleName: moduleName,
31
- menus: menuList,
32
- version: menu.version +''
33
- }
34
- ask.ucmng.api.sysmng.MenuOper.UpdateMenu.post(obj).then(() => {
35
- // 新版本菜单
36
- initMenu()
37
- });
38
- } else {
39
- // 新版本菜单
40
- initMenu()
41
- }
42
- }
43
-
44
- function initMenu () {
45
- ask.ucuser.api.sys.CurUser.InitMenu().then(res => {
46
- if(res.code == 0) {
47
- let { subItems } = hasChildren({subItems: res.data})
48
- store.dispatch("app/getMenuList", subItems);
49
- }
50
- })
51
- }
52
-
53
- function hasChildren(obj) {
54
- let list = obj.subItems
55
- if(list && list.length > 0) {
56
- if(list.every(i => i['hide'] === true)) {
57
- obj.subItems = []
58
- } else {
59
- obj.subItems = list.filter(item => item['hide'] !== true)
60
- obj.subItems.forEach(item => hasChildren(item))
61
- }
62
- }
63
- return obj
64
- }
65
-
66
-
67
- function getApis () {
68
- let obj = {}
69
- let apis = getConfig('apis')
70
- for (const key in apis) {
71
- let apiList = apis[key].EndPoint.split("/")
72
- let serverkey = apiList[apiList.length - 2]
73
- obj[serverkey] = key
74
- }
75
- return obj
76
- }
77
-
78
- export {
79
-
80
- main,
81
- initMenu
82
-
1
+ import { getToken } from '@/utils/auth.js'
2
+ import { getConfig } from '@/utils/global-config'
3
+ import menu from "@/automatically/menu.js"
4
+ import ask from '@/automatically/api'
5
+ import store from '@/store'
6
+
7
+ function main () {
8
+ // if(process.env.NODE_ENV == "development") return
9
+ getVersion();
10
+ }
11
+
12
+ function getVersion() {
13
+ const token = getToken(`${getConfig('CLIENT_ID')}_token`)
14
+ if(!token) return;
15
+ ask.ucmng.api.sysmng.MenuOper.GetVersion({clientId: window.$baseCfg.CLIENT_ID}).then((res)=> {
16
+ if(res.code == 0) {
17
+ getMenuTree(res.data)//获取菜单树
18
+ }
19
+ })
20
+ }
21
+
22
+ function getMenuTree (version) {
23
+ let apiVersion = menu.version;
24
+ if (version == null || apiVersion > version) {
25
+ if(!(menu && menu.list)) return;
26
+ let moduleName = menu.list[0].moduleName ? menu.list[0].moduleName : ''
27
+ let menuList = menu.list;
28
+ let obj = {
29
+ clientId: window.$baseCfg ? window.$baseCfg.CLIENT_ID : '',
30
+ moduleName: moduleName,
31
+ menus: menuList,
32
+ version: menu.version +''
33
+ }
34
+ ask.ucmng.api.sysmng.MenuOper.UpdateMenu.post(obj).then(() => {
35
+ // 新版本菜单
36
+ initMenu()
37
+ });
38
+ } else {
39
+ // 新版本菜单
40
+ initMenu()
41
+ }
42
+ }
43
+
44
+ function initMenu () {
45
+ ask.ucuser.api.sys.CurUser.InitMenu().then(res => {
46
+ if(res.code == 0) {
47
+ let { subItems } = hasChildren({subItems: res.data})
48
+ store.dispatch("app/getMenuList", subItems);
49
+ }
50
+ })
51
+ }
52
+
53
+ function hasChildren(obj) {
54
+ let list = obj.subItems
55
+ if(list && list.length > 0) {
56
+ if(list.every(i => i['hide'] === true)) {
57
+ obj.subItems = []
58
+ } else {
59
+ obj.subItems = list.filter(item => item['hide'] !== true)
60
+ obj.subItems.forEach(item => hasChildren(item))
61
+ }
62
+ }
63
+ return obj
64
+ }
65
+
66
+
67
+ function getApis () {
68
+ let obj = {}
69
+ let apis = getConfig('apis')
70
+ for (const key in apis) {
71
+ let apiList = apis[key].EndPoint.split("/")
72
+ let serverkey = apiList[apiList.length - 2]
73
+ obj[serverkey] = key
74
+ }
75
+ return obj
76
+ }
77
+
78
+ export {
79
+
80
+ main,
81
+ initMenu
82
+
83
83
  }
@@ -0,0 +1,10 @@
1
+ import Vue from 'vue'
2
+
3
+ Vue.directive('keep-alive', {
4
+ bind(el) {
5
+ const selectWrap = el.querySelector('.el-table__body-wrapper')
6
+ selectWrap.addEventListener('scroll', function () {
7
+ el.setAttribute('scrollTop', this.scrollTop)
8
+ })
9
+ },
10
+ })
@@ -1,55 +1,55 @@
1
- import OSS from 'ali-oss'
2
- import { requestApi as axios} from 'xs-request'
3
- import store from '../store/index'
4
- import { getLocalStorage } from "@/utils/localStorage";
5
- import {getConfig} from '@/utils/global-config'
6
-
7
- // 去哪个服务下 获取 token 信息
8
- function getOssToken () {
9
- return axios.get('@commng/UserCur/Oss/Config/' + getConfig('CLIENT_ID'))
10
- }
11
-
12
- let ossCfg = {}
13
- // 从 vuex 中 获取初始化值
14
- const initToken = function() {
15
- ossCfg = store.getters.ossCfg
16
- let timestamp = new Date().getTime()
17
- // 有效期内不发送获取token 请求
18
- if (ossCfg.region && ossCfg.timeout > timestamp) { return }
19
- getOssToken()
20
- .then(({ data }) => {
21
- ossCfg.region = data.ossEndpoint
22
- ossCfg.bucket = data.bucketName
23
- ossCfg.accessKeyId = data.stsAccessKeyId
24
- ossCfg.accessKeySecret = data.stsAccessKeySecret
25
- ossCfg.stsToken = data.stsSecurityToken
26
- ossCfg.baseDir = data.baseDir
27
- ossCfg.timeout = timestamp + (data.durationSeconds * 1000)
28
- store.commit("oss/SET_OSS", ossCfg)
29
- })
30
- .catch((err) => {
31
- console.log('获取Token错误', err)
32
- })
33
- }
34
- const newFileName = function(id = getConfig('CLIENT_ID'), userid = getLocalStorage("userProfile").id) {
35
- let dt = new Date()
36
- let y = dt.getFullYear()
37
- let m = dt.getMonth() + 1 < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth() + 1
38
- let d = dt.getDate() < 10 ? '0' + dt.getDate() : dt.getDate()
39
- return `${ossCfg.baseDir}/${userid}/${y}${m}${d}/${id}_${dt.getTime()}` // 定义唯一的文件名
40
- }
41
-
42
- const ossService = {
43
- token: ossCfg,
44
- initToken,
45
- newFileName,
46
- _ossClient: null,
47
- getOssClient() {
48
- if (this._ossClient == null) { this._ossClient = new OSS(ossCfg) }
49
- return this._ossClient
50
- }
51
- }
52
-
53
- export default ossService
54
-
55
-
1
+ import OSS from 'ali-oss'
2
+ import { requestApi as axios} from 'xs-request'
3
+ import store from '../store/index'
4
+ import { getLocalStorage } from "@/utils/localStorage";
5
+ import {getConfig} from '@/utils/global-config'
6
+
7
+ // 去哪个服务下 获取 token 信息
8
+ function getOssToken () {
9
+ return axios.get('@commng/UserCur/Oss/Config/' + getConfig('CLIENT_ID'))
10
+ }
11
+
12
+ let ossCfg = {}
13
+ // 从 vuex 中 获取初始化值
14
+ const initToken = function() {
15
+ ossCfg = store.getters.ossCfg
16
+ let timestamp = new Date().getTime()
17
+ // 有效期内不发送获取token 请求
18
+ if (ossCfg.region && ossCfg.timeout > timestamp) { return }
19
+ getOssToken()
20
+ .then(({ data }) => {
21
+ ossCfg.region = data.ossEndpoint
22
+ ossCfg.bucket = data.bucketName
23
+ ossCfg.accessKeyId = data.stsAccessKeyId
24
+ ossCfg.accessKeySecret = data.stsAccessKeySecret
25
+ ossCfg.stsToken = data.stsSecurityToken
26
+ ossCfg.baseDir = data.baseDir
27
+ ossCfg.timeout = timestamp + (data.durationSeconds * 1000)
28
+ store.commit("oss/SET_OSS", ossCfg)
29
+ })
30
+ .catch((err) => {
31
+ console.log('获取Token错误', err)
32
+ })
33
+ }
34
+ const newFileName = function(id = getConfig('CLIENT_ID'), userid = getLocalStorage("userProfile").id) {
35
+ let dt = new Date()
36
+ let y = dt.getFullYear()
37
+ let m = dt.getMonth() + 1 < 10 ? '0' + (dt.getMonth() + 1) : dt.getMonth() + 1
38
+ let d = dt.getDate() < 10 ? '0' + dt.getDate() : dt.getDate()
39
+ return `${ossCfg.baseDir}/${userid}/${y}${m}${d}/${id}_${dt.getTime()}` // 定义唯一的文件名
40
+ }
41
+
42
+ const ossService = {
43
+ token: ossCfg,
44
+ initToken,
45
+ newFileName,
46
+ _ossClient: null,
47
+ getOssClient() {
48
+ if (this._ossClient == null) { this._ossClient = new OSS(ossCfg) }
49
+ return this._ossClient
50
+ }
51
+ }
52
+
53
+ export default ossService
54
+
55
+
@@ -1,47 +1,47 @@
1
- import Vue from 'vue'
2
- import { Module_Search } from '@modules/module.config'
3
- import 'moment-duration-format'
4
- import moment from 'moment'// 导入文件
5
- import ask from '@/automatically/api'
6
- import {requestApi} from 'xs-request'
7
- import echarts from 'echarts';
8
- import {loadTableData, loadReportData, msg, countDownSetColor, showDlg} from '@/utils/index'
9
- import signalr from '@/utils/signalR'
10
- import {Enum, OrgEnum, EnumList} from '@/utils/enum'
11
- import common from '@/common/common'
12
- import Common_Search from '@/utils/search';
13
- import filterRules from './filterRules'
14
- import ossService from '@/utils/ossService'
15
-
16
- //新版api 请求
17
- Vue.prototype.$ask = ask
18
- //旧版 请求
19
- Vue.prototype.$http = requestApi
20
- Vue.prototype.$echarts = echarts;
21
- // 日期格式
22
- Vue.prototype.$moment = moment// 赋值使用
23
- // 加载表格数据
24
- Vue.prototype.loadTableData = loadTableData
25
- // 加载报表数据
26
- Vue.prototype.loadReportData = loadReportData
27
- // 消息
28
- Vue.prototype.$msg = msg
29
- Vue.$SearchTool = Object.assign({}, Common_Search, Module_Search ? Module_Search : {})
30
- Vue.prototype.countDownSetColor = countDownSetColor
31
- Vue.prototype.signalr = signalr
32
- Vue.prototype.$enum = Enum
33
- Vue.prototype.$orgEnum = OrgEnum
34
- Vue.prototype.$enumList = EnumList
35
- Vue.prototype.$common = common
36
- Vue.http = requestApi;
37
- Vue.Enum = Enum;
38
- Vue.OrgEnum = OrgEnum;
39
- Vue.EnumList = EnumList;
40
- // 显示弹出对话框
41
- Vue.prototype.showDlg =showDlg
42
-
43
- // 校验
44
- Vue.prototype.$filterRules = filterRules
45
-
46
- // oss 图片上次服务
1
+ import Vue from 'vue'
2
+ import { Module_Search } from '@modules/module.config'
3
+ import 'moment-duration-format'
4
+ import moment from 'moment'// 导入文件
5
+ import ask from '@/automatically/api'
6
+ import {requestApi} from 'xs-request'
7
+ import echarts from 'echarts';
8
+ import {loadTableData, loadReportData, msg, countDownSetColor, showDlg} from '@/utils/index'
9
+ import signalr from '@/utils/signalR'
10
+ import {Enum, OrgEnum, EnumList} from '@/utils/enum'
11
+ import common from '@/common/common'
12
+ import Common_Search from '@/utils/search';
13
+ import filterRules from './filterRules'
14
+ import ossService from '@/utils/ossService'
15
+
16
+ //新版api 请求
17
+ Vue.prototype.$ask = ask
18
+ //旧版 请求
19
+ Vue.prototype.$http = requestApi
20
+ Vue.prototype.$echarts = echarts;
21
+ // 日期格式
22
+ Vue.prototype.$moment = moment// 赋值使用
23
+ // 加载表格数据
24
+ Vue.prototype.loadTableData = loadTableData
25
+ // 加载报表数据
26
+ Vue.prototype.loadReportData = loadReportData
27
+ // 消息
28
+ Vue.prototype.$msg = msg
29
+ Vue.$SearchTool = Object.assign({}, Common_Search, Module_Search ? Module_Search : {})
30
+ Vue.prototype.countDownSetColor = countDownSetColor
31
+ Vue.prototype.signalr = signalr
32
+ Vue.prototype.$enum = Enum
33
+ Vue.prototype.$orgEnum = OrgEnum
34
+ Vue.prototype.$enumList = EnumList
35
+ Vue.prototype.$common = common
36
+ Vue.http = requestApi;
37
+ Vue.Enum = Enum;
38
+ Vue.OrgEnum = OrgEnum;
39
+ Vue.EnumList = EnumList;
40
+ // 显示弹出对话框
41
+ Vue.prototype.showDlg =showDlg
42
+
43
+ // 校验
44
+ Vue.prototype.$filterRules = filterRules
45
+
46
+ // oss 图片上次服务
47
47
  Vue.prototype.$ossService = ossService
@@ -1,34 +1,34 @@
1
- export function qcDateRange(_fieldName = '', _defaultValue = '', options) {
2
- return Object.assign({}, {
3
- fieldName: 'datepic',
4
- defaultValue: _defaultValue,
5
- conditionType: 4,
6
- url: '',
7
- dataSource: '',
8
- displayNam: '',
9
- dataSourceType: 1,
10
- sort: 0,
11
- isIndex: true
12
- }, options)
13
- }
14
-
15
- export function qcInput(_fieldName = '', _defaultValue, options) {
16
- return Object.assign({}, {
17
- displayName: "",
18
- fieldName: _fieldName,
19
- defaultValue: _defaultValue,
20
- conditionType: 0,
21
- url: "",
22
- dataSource: "",
23
- dataSourceType: 0,
24
- sort: 0,
25
- isIndex: true,
26
- }, options)
27
- }
28
-
29
-
30
- export default {
31
- qcDateRange,
32
- qcInput
33
- }
1
+ export function qcDateRange(_fieldName = '', _defaultValue = '', options) {
2
+ return Object.assign({}, {
3
+ fieldName: 'datepic',
4
+ defaultValue: _defaultValue,
5
+ conditionType: 4,
6
+ url: '',
7
+ dataSource: '',
8
+ displayNam: '',
9
+ dataSourceType: 1,
10
+ sort: 0,
11
+ isIndex: true
12
+ }, options)
13
+ }
14
+
15
+ export function qcInput(_fieldName = '', _defaultValue, options) {
16
+ return Object.assign({}, {
17
+ displayName: "",
18
+ fieldName: _fieldName,
19
+ defaultValue: _defaultValue,
20
+ conditionType: 0,
21
+ url: "",
22
+ dataSource: "",
23
+ dataSourceType: 0,
24
+ sort: 0,
25
+ isIndex: true,
26
+ }, options)
27
+ }
28
+
29
+
30
+ export default {
31
+ qcDateRange,
32
+ qcInput
33
+ }
34
34
 
@@ -1,24 +1,24 @@
1
- import * as signalR from '@microsoft/signalr'
2
- import { getToken } from '@/utils/auth'
3
-
4
- const signalr = create('signalR/WorkerHub')
5
- import { getConfig } from '@/utils/global-config'
6
- const tokenKey = `${getConfig('CLIENT_ID')}_token`
7
-
8
-
9
- function create(url) {
10
- const signalUrl = `../${url}`
11
-
12
- return new signalR.HubConnectionBuilder()
13
- // 服务器地址
14
- .withUrl(signalUrl, { accessTokenFactory: () => getToken(tokenKey) })
15
- .withAutomaticReconnect({
16
- nextRetryDelayInMilliseconds: retryContext => {
17
- console.log(retryContext.elapsedMilliseconds, '重新链接所花费的时间')
18
- return 1001 // 每秒请求
19
- }
20
- }) // 自动重连
21
- .build()
22
- }
23
-
24
- export default signalr
1
+ import * as signalR from '@microsoft/signalr'
2
+ import { getToken } from '@/utils/auth'
3
+
4
+ const signalr = create('signalR/WorkerHub')
5
+ import { getConfig } from '@/utils/global-config'
6
+ const tokenKey = `${getConfig('CLIENT_ID')}_token`
7
+
8
+
9
+ function create(url) {
10
+ const signalUrl = `../${url}`
11
+
12
+ return new signalR.HubConnectionBuilder()
13
+ // 服务器地址
14
+ .withUrl(signalUrl, { accessTokenFactory: () => getToken(tokenKey) })
15
+ .withAutomaticReconnect({
16
+ nextRetryDelayInMilliseconds: retryContext => {
17
+ console.log(retryContext.elapsedMilliseconds, '重新链接所花费的时间')
18
+ return 1001 // 每秒请求
19
+ }
20
+ }) // 自动重连
21
+ .build()
22
+ }
23
+
24
+ export default signalr
@@ -1,36 +1,36 @@
1
- <template></template>
2
- <script>
3
- import { setToken } from "@/utils/auth"; // get token from cookie
4
- import { getQuery } from "@/common/utils";
5
- import { getConfig } from "@/utils/global-config";
6
- import { setLocalStorage } from "@utils/localStorage";
7
- const endTimestamp = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1;
8
- export default {
9
- mounted() {
10
- if (getConfig("ID4_LOGINTYPE")) {
11
- const that = this;
12
- window.$mgr.signinRedirectCallback().then(function () {
13
- window.$mgr.getUser().then((user) => {
14
- setToken(user.access_token);
15
- setToken("LoginUserName", user.profile.name);
16
- setLocalStorage("userProfile", user.profile);
17
- localStorage.setItem("token", user.access_token);
18
- // 作为第三方系统被嵌套在iframe中使用
19
- sessionStorage.setItem("token", user.access_token);
20
- sessionStorage.setItem("iframeAuthExpireTime", endTimestamp);
21
- var redic_url = getQuery(window.location.href, "redic_url");
22
- that.$router.push(
23
- redic_url ? decodeURIComponent(redic_url).substr(1) : `/`
24
- );
25
- })
26
- .catch(function (e) {
27
- console.log("getUser", e);
28
- });
29
- })
30
- .catch(function (e) {
31
- console.log("getToken", e);
32
- });
33
- }
34
- },
35
- };
1
+ <template></template>
2
+ <script>
3
+ import { setToken } from "@/utils/auth"; // get token from cookie
4
+ import { getQuery } from "@/common/utils";
5
+ import { getConfig } from "@/utils/global-config";
6
+ import { setLocalStorage } from "@utils/localStorage";
7
+ const endTimestamp = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1;
8
+ export default {
9
+ mounted() {
10
+ if (getConfig("ID4_LOGINTYPE")) {
11
+ const that = this;
12
+ window.$mgr.signinRedirectCallback().then(function () {
13
+ window.$mgr.getUser().then((user) => {
14
+ setToken(user.access_token);
15
+ setToken("LoginUserName", user.profile.name);
16
+ setLocalStorage("userProfile", user.profile);
17
+ localStorage.setItem("token", user.access_token);
18
+ // 作为第三方系统被嵌套在iframe中使用
19
+ sessionStorage.setItem("token", user.access_token);
20
+ sessionStorage.setItem("iframeAuthExpireTime", endTimestamp);
21
+ var redic_url = getQuery(window.location.href, "redic_url");
22
+ that.$router.push(
23
+ redic_url ? decodeURIComponent(redic_url).substr(1) : `/`
24
+ );
25
+ })
26
+ .catch(function (e) {
27
+ console.log("getUser", e);
28
+ });
29
+ })
30
+ .catch(function (e) {
31
+ console.log("getToken", e);
32
+ });
33
+ }
34
+ },
35
+ };
36
36
  </script>
@@ -1,25 +1,25 @@
1
- <template>
2
- <div class="home-wrapper" />
3
- </template>
4
- <script>
5
- export default {
6
- beforeRouteEnter(to, from, next) {
7
- next((vm) => {
8
- vm.apartyGetToken(to, next, vm)
9
- })
10
- },
11
- methods: {
12
- async apartyGetToken(to, next, vm) {
13
- // 识别被哪个 iframe 引用;qualityTestParty=质检详情
14
- if (window.parent !== window.self && window.name === 'qualityTestParty') {
15
- if (to.query.orderId && to.query.orderId != 'undefined') {
16
- sessionStorage.setItem('iframeOrderId', to.query.orderId)
17
- }
18
- next('/zhijian-details')
19
- } else {
20
- next()
21
- }
22
- }
23
- }
24
- }
25
- </script>
1
+ <template>
2
+ <div class="home-wrapper" />
3
+ </template>
4
+ <script>
5
+ export default {
6
+ beforeRouteEnter(to, from, next) {
7
+ next((vm) => {
8
+ vm.apartyGetToken(to, next, vm)
9
+ })
10
+ },
11
+ methods: {
12
+ async apartyGetToken(to, next, vm) {
13
+ // 识别被哪个 iframe 引用;qualityTestParty=质检详情
14
+ if (window.parent !== window.self && window.name === 'qualityTestParty') {
15
+ if (to.query.orderId && to.query.orderId != 'undefined') {
16
+ sessionStorage.setItem('iframeOrderId', to.query.orderId)
17
+ }
18
+ next('/zhijian-details')
19
+ } else {
20
+ next()
21
+ }
22
+ }
23
+ }
24
+ }
25
+ </script>
@@ -1,6 +1,9 @@
1
1
  <template>
2
2
  <section class="app-main">
3
- <router-view :key="key" />
3
+ <keep-alive>
4
+ <router-view v-if="!$route.meta.noCache && isRouterAlive" :key="key" />
5
+ </keep-alive>
6
+ <router-view v-if="$route.meta.noCache" :key="key" />
4
7
  </section>
5
8
  </template>
6
9
 
@@ -9,19 +12,32 @@ export default {
9
12
  name: "AppMain",
10
13
  data() {
11
14
  return {
12
- framepath: ""
15
+ framepath: "",
16
+ isRouterAlive: true,
17
+ };
18
+ },
19
+ provide() {
20
+ return {
21
+ reload: this.reload,
13
22
  };
14
23
  },
15
24
  computed: {
16
25
  key() {
17
26
  return this.$route.path;
18
- }
19
- }
27
+ },
28
+ },
29
+ methods: {
30
+ reload() {
31
+ this.isRouterAlive = false;
32
+ this.$nextTick(function () {
33
+ this.isRouterAlive = true;
34
+ });
35
+ },
36
+ },
20
37
  };
21
38
  </script>
22
39
 
23
40
  <style lang="scss" scoped>
24
-
25
41
  .app-main {
26
42
  display: flex;
27
43
  /*50 = navbar */