Browse Source

feat: 打卡插件

text-draggable
xuesinan 4 years ago
parent
commit
9d6fb5329a
  1. 1
      .eslintrc.js
  2. 17
      package-lock.json
  3. 2
      package.json
  4. 26
      src/App.vue
  5. 22
      src/apis/index.js
  6. 4665
      src/assets/tailwind.css
  7. 140
      src/components/tall/Render/Render.vue
  8. 42
      src/components/tall/left/Index.vue
  9. 13
      src/components/tall/plugin/Plugin.vue
  10. 11
      src/components/tall/right/DetailWebview.vue
  11. 3
      src/main.js
  12. 18
      src/plugins/p-deliver.vue
  13. 31
      src/store/tall/layout/actions.js
  14. 4
      src/store/tall/layout/index.js
  15. 45
      src/store/tall/layout/mutations.js
  16. 9
      src/store/tall/layout/state.js
  17. 9
      src/store/tall/projects/index.js
  18. 10
      src/store/tall/task/index.js
  19. 36
      src/utils/storage.js
  20. 189
      src/views/detail/Test.vue
  21. 60
      src/views/home/Index.vue
  22. 10
      yarn.lock

1
.eslintrc.js

@ -8,6 +8,7 @@ module.exports = {
ecmaVersion: 12,
sourceType: 'module',
},
parser: "vue-eslint-parser", // 添加这一句
plugins: ['vue'],
rules: {
'no-loop-func': 'off',

17
package-lock.json

@ -34,7 +34,7 @@
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.19.1",
"eslint-plugin-vue": "^7.20.0",
"husky": "^7.0.2",
"lint-staged": "^11.2.3",
"prettier": "^2.4.1",
@ -4926,11 +4926,10 @@
}
},
"node_modules/eslint-plugin-vue": {
"version": "7.19.1",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/download/eslint-plugin-vue-7.19.1.tgz",
"integrity": "sha1-Q1+yznEoQqlTCyjqy4g2gOjqpPM=",
"version": "7.20.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-7.20.0.tgz",
"integrity": "sha512-oVNDqzBC9h3GO+NTgWeLMhhGigy6/bQaQbHS+0z7C4YEu/qK/yxHvca/2PTZtGNPsCrHwOTgKMrwu02A9iPBmw==",
"dev": true,
"license": "MIT",
"dependencies": {
"eslint-utils": "^2.1.0",
"natural-compare": "^1.4.0",
@ -4941,7 +4940,7 @@
"node": ">=8.10"
},
"peerDependencies": {
"eslint": "^6.2.0 || ^7.0.0 || ^8.0.0-0"
"eslint": "^6.2.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/eslint-plugin-vue/node_modules/semver": {
@ -12931,9 +12930,9 @@
}
},
"eslint-plugin-vue": {
"version": "7.19.1",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/download/eslint-plugin-vue-7.19.1.tgz",
"integrity": "sha1-Q1+yznEoQqlTCyjqy4g2gOjqpPM=",
"version": "7.20.0",
"resolved": "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-7.20.0.tgz",
"integrity": "sha512-oVNDqzBC9h3GO+NTgWeLMhhGigy6/bQaQbHS+0z7C4YEu/qK/yxHvca/2PTZtGNPsCrHwOTgKMrwu02A9iPBmw==",
"dev": true,
"requires": {
"eslint-utils": "^2.1.0",

2
package.json

@ -40,7 +40,7 @@
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.19.1",
"eslint-plugin-vue": "^7.20.0",
"husky": "^7.0.2",
"lint-staged": "^11.2.3",
"prettier": "^2.4.1",

26
src/App.vue

@ -5,6 +5,7 @@
</template>
<script setup>
// import '@/assets/tailwind.css';
import { useStore } from 'vuex';
import { v4 as uuidv4 } from 'uuid';
@ -20,6 +21,31 @@ if (userString) {
const user = JSON.parse(userString);
store.commit('user/setUser', user);
}
//
if (!sessionStorage.getItem('businessPlugin')) {
getServices();
getPlugins();
}
setInterval(() => {
getServices();
getPlugins();
}, 60000);
/**
* 查询服务
*/
async function getServices() {
store.dispatch('layout/getBusinessPlugin');
}
/**
* 查询插件
*/
async function getPlugins() {
store.dispatch('layout/getAllPlugin');
}
</script>
<style>

22
src/apis/index.js

@ -29,6 +29,18 @@ export const getImageCode = () => http.get(`${tall}/users/code`);
// 获取短信验证码
export const getSmsCode = params => http.get(`${tall}/users/smscode`, { params });
// 查询服务
export const getBusinessPlugin = params => http.post(`${tall}/business/query/businessPlugin`, { params });
// 查询本域所有插件
export const getAllPlugin = params => http.post(`${tall}/business/query/plugin`, { params });
// 获取插件信息
export const getOtherPlugin = params => http.post(`${apiUrl}/opt/business/businessPluginById`, { params });
// 根据插件id获取服务config
export const getConfigInfo = params => http.post(`${apiUrl}/ptostall/business/byBusinessPluginId`, { params });
/**
* 项目相关
*/
@ -57,12 +69,6 @@ export const getPermanent = (params, url) => http.post(`${url}/tall/task/permane
// 查找定期任务
export const getRegularTask = (params, url) => http.post(`${url}/tall/task/regular/page`, params);
// 添加任务
export const saveTask = params => http.post(`${experiment}/task/save`, params);
// 查询子任务
export const findSonTask = params => http.post(`${experiment}/task/findSonTask`, params);
/**
* 导入wbs
* @param {object} e
@ -76,9 +82,5 @@ export const importWbs = async e => {
return result;
};
// 新建课题 -- 根据模板新建课题
export const create = param => http.post(`${experiment}/experiment/create`, { params: { param } });
// 上传文件
// export const uploadImg = `${filedeal}/file/upload/multiple`;
export const uploadImg = `${experiment}/import/upload`;

4665
src/assets/tailwind.css

File diff suppressed because it is too large

140
src/components/tall/Render/Render.vue

@ -0,0 +1,140 @@
<template>
<view class="render-box shadow-lg block w-full">
<view
class="render-content block w-full"
:id="`render-${props.task.id}`"
:data-did="props.task.detailId"
:data-param="props.param"
:data-pdu="props.task.planDuration"
:data-pid="project.id"
:data-pstart="props.task.planStart"
:data-rdu="props.task.realDuration"
:data-rid="roleId"
:data-tid="props.task.id"
:data-tname="props.task.name"
:data-token="token"
:data-rstart="props.task.realStart"
:data-uid="userId"
:data-url="project.url"
:data-type="1"
></view>
</view>
</template>
<script setup>
import { ref, computed, onMounted, defineProps } from 'vue';
import { useStore } from 'vuex';
import { getOtherPlugin, getConfigInfo } from 'apis';
const props = defineProps({
task: { default: () => {}, type: Object },
pluginId: { default: '1', type: String },
styleType: { default: 0, type: Number },
pluginTaskId: { default: '', type: String },
businessPluginId: { default: '', type: String },
param: { type: String, default: '' },
});
const store = useStore();
const project = computed(() => store.state.projects.project); //
const userId = computed(() => store.getters['user/userId']);
const roleId = computed(() => store.state.role.roleId); // id
const allPlugin = computed(() => store.state.layout.allPlugin); //
const businessPlugin = computed(() => store.state.layout.businessPlugin); //
const token = store.getters['user/token'];
const pluginInfo = ref(null);
onMounted(async () => {
await getPlugin();
if (props.param && pluginInfo.value) {
// const configParam = JSON.parse(props.param);
pluginInfo.value.config = `var p${props.pluginId}_config = ${props.param}`;
} else {
await getConfig();
}
if (pluginInfo.value.html) {
// : 2022130 this.pluginTaskIdAPP
// bug
const content = window.document.getElementById(`render-${pluginInfo.value.renderId}`);
content.innerHTML = pluginInfo.value.html;
}
if (pluginInfo.value.config) {
const scriptConfig = window.document.createElement('script');
scriptConfig.innerHTML = pluginInfo.value.config;
window.document.body.appendChild(scriptConfig);
}
if (pluginInfo.value.js) {
const scriptJs = window.document.createElement('script');
scriptJs.innerHTML = pluginInfo.value.js;
window.document.body.appendChild(scriptJs);
}
});
async function getPlugin() {
const plugins = allPlugin.value || sessionStorage.getItem('allPlugin');
if (plugins && JSON.parse(plugins)) {
//
try {
const pluginLists = JSON.parse(plugins);
// pluginLists find,catch
const pluginTarget = pluginLists.find(item => item.id === props.pluginId);
pluginTarget.renderId = props.task.id;
pluginInfo.value = pluginTarget || null;
} catch (error) {
console.error('error: ', error);
pluginInfo.value = null;
}
} else {
// API
const params = { businessPluginId: props.businessPluginId };
try {
const res = await getOtherPlugin(params);
res.renderId = props.task.id;
pluginInfo.value = res || null;
} catch (err) {
pluginInfo.value = null;
console.error('err: ', err);
}
}
}
async function getConfig() {
const businessPlugins = businessPlugin.value || sessionStorage.getItem('businessPlugin');
if (businessPlugins && JSON.parse(businessPlugins)) {
//
const businessPluginLists = JSON.parse(businessPlugins);
businessPluginLists.forEach(item => {
if (item.pluginConfigs) {
const pluginConfig = item.pluginConfigs.find(plugin => plugin.businessPluginId === props.businessPluginId);
if (pluginConfig && pluginConfig.config && pluginInfo.value) {
pluginInfo.value.config = pluginConfig.config;
}
}
});
} else {
// API
const params = { id: props.businessPluginId };
try {
const res = await getConfigInfo(params);
if (pluginInfo.value && res.config) {
pluginInfo.value.config = res.config;
}
} catch (err) {
console.error('err: ', err);
}
}
}
</script>
<style scoped>
.render-box {
overflow: hidden;
}
</style>

42
src/components/tall/left/Index.vue

@ -18,10 +18,10 @@ import { ref } from 'vue';
import { useStore } from 'vuex';
// import dayjs from 'dayjs';
import { PlusCircleFilled } from '@ant-design/icons-vue';
import { create } from 'apis';
import { message } from 'ant-design-vue';
import Calendar from './Calendar.vue';
import Projects from './Projects.vue';
// import { create } from 'apis';
// import { message } from 'ant-design-vue';
// import Calendar from './Calendar.vue';
// import Projects from './Projects.vue';
// import { importWbs } from 'apis';
@ -34,26 +34,26 @@ const showModal = () => {
const handleOk = async () => {
visible.value = false;
await createExperiment();
// await createExperiment();
};
//
async function createExperiment() {
try {
const data = await create();
const obj = {
id: data.projectId,
name: data.projectName,
};
store.commit('projects/setProject', obj);
// store.commit('task/setTaskDetail', null);
store.commit('layout/setRefreshProjects');
return data;
} catch (error) {
message.info(error);
throw new Error(error);
}
}
// async function createExperiment() {
// try {
// const data = await create();
// const obj = {
// id: data.projectId,
// name: data.projectName,
// };
// store.commit('projects/setProject', obj);
// // store.commit('task/setTaskDetail', null);
// store.commit('layout/setRefreshProjects');
// return data;
// } catch (error) {
// message.info(error);
// throw new Error(error);
// }
// }
function changeTime(data) {
store.commit('layout/setSelectTime', data);

13
src/components/tall/plugin/Plugin.vue

@ -2,7 +2,7 @@
<p-task-title :task="task" v-if="pluginId === '1'" class="p-2" />
<!-- 交付物插件 -->
<!-- <p-deliver v-else-if="pluginId === '15'" /> -->
<p-deliver v-else-if="pluginId === '15'" />
<!-- <p-source-manage v-else-if="pluginId === '16'" class="p-2" /> -->
<!-- <p-finance-audit v-else-if="pluginId === '17'" class="p-2" /> -->
<!-- <p-finance v-else-if="pluginId === '18'" class="p-2" /> -->
@ -14,12 +14,23 @@
<!-- 任务名和跳转详情页箭头 -->
<!-- <p-task-to-detail :task="task" v-else-if="pluginId === '24'" class="p-2"></p-task-to-detail> -->
<Render
v-else
:task="task"
:pluginId="pluginId"
:styleType="styleType"
:pluginTaskId="pluginTaskId"
:businessPluginId="businessPluginId"
:param="param"
/>
</template>
<script setup>
import { provide, defineProps } from 'vue';
// import { useStore } from 'vuex';
import pTaskTitle from '@/plugins/p-task-title.vue';
import pDeliver from '@/plugins/p-deliver.vue';
const props = defineProps({
task: { default: () => {}, type: Object },

11
src/components/tall/right/DetailWebview.vue

@ -0,0 +1,11 @@
<template>
<iframe :src="taskDetailUrl" class="w-full h-full"></iframe>
</template>
<script setup>
import { computed } from 'vue';
import { useStore } from 'vuex';
const store = useStore();
const taskDetailUrl = computed(() => store.state.task.taskDetailUrl); // iframe
</script>

3
src/main.js

@ -1,9 +1,10 @@
// noinspection ES6UnusedImports
import 'virtual:windi.css';
import './assets/tailwind.css';
import { createApp } from 'vue';
// eslint-disable-next-line no-unused-vars
import { createApp } from 'vue';
import App from './App.vue';
import router from './routers/index';
import store from './store/index';

18
src/plugins/p-deliver.vue

@ -0,0 +1,18 @@
<template>
<!-- 任务名插件 -->
<div class="u-font-14">
{{ deliver.deliverName }}
</div>
</template>
<script setup>
// import { useStore } from 'vuex';
import { ref, inject } from 'vue';
// const store = useStore();
// const task = inject('task');
const pluginInfo = inject('pluginInfo');
const deliver = ref(null); //
deliver.value = pluginInfo && pluginInfo.data ? JSON.parse(pluginInfo.data) : null;
</script>

31
src/store/tall/layout/actions.js

@ -0,0 +1,31 @@
import { getAllPlugin, getBusinessPlugin } from 'apis';
import { message } from 'ant-design-vue';
const actions = {
async getBusinessPlugin({ commit }) {
try {
const res = await getBusinessPlugin();
sessionStorage.setItem('businessPlugin', JSON.stringify(res) || '');
commit('setBusinessPlugin', JSON.stringify(res) || '');
return res;
} catch (error) {
message.info(error.msg);
throw error;
}
},
async getAllPlugin({ commit }) {
try {
const res = await getAllPlugin();
sessionStorage.setItem('allPlugin', JSON.stringify(res) || '');
commit('setAllPlugin', JSON.stringify(res) || '');
return res;
} catch (error) {
message.info(error.msg);
throw error;
}
},
};
export default actions;

4
src/store/tall/layout/index.js

@ -1,8 +1,10 @@
import state from './state';
import actions from './actions';
import mutations from './mutations';
import state from './state';
export default {
namespaced: true,
state,
mutations,
actions,
};

45
src/store/tall/layout/mutations.js

@ -9,11 +9,6 @@ const mutations = {
state.display[prop] = show;
},
// 设置是否显示列表
setListStatus(state, data) {
state.isShowListStatus = data;
},
// 设置选择的时间
setSelectTime(state, data) {
state.startTime = data.startTime;
@ -25,33 +20,27 @@ const mutations = {
state.refreshProjects = !state.refreshProjects;
},
// 设置课题开始时间-结束时间
setFirPlanTime(state, data) {
state.planStartTime = data.startTime;
state.planEndTime = data.endTime;
sessionStorage.setItem('planStartTime', data.startTime);
sessionStorage.setItem('planEndTime', data.endTime);
},
// 设置子课题开始时间-结束时间
setSecPlanTime(state, data) {
state.subStartTime = data.startTime;
state.subEndTime = data.endTime;
sessionStorage.setItem('subStartTime', data.startTime);
sessionStorage.setItem('subEndTime', data.endTime);
// 设置唯一标识
setDeviceId(state, data) {
state.deviceId = data;
},
// 设置实验开始时间-结束时间
setThirdPlanTime(state, data) {
state.expreStartTime = data.startTime;
state.expreEndTime = data.endTime;
sessionStorage.setItem('expreStartTime', data.startTime);
sessionStorage.setItem('expreEndTime', data.endTime);
/**
* 设置服务列表
* @param {Object} state
* @param {Object} data
*/
setBusinessPlugin(state, data) {
state.businessPlugin = data;
},
// 设置唯一标识
setDeviceId(state, data) {
state.deviceId = data;
/**
* 设置插件列表
* @param {Object} state
* @param {Object} data
*/
setAllPlugin(state, data) {
state.allPlugin = data;
},
};

9
src/store/tall/layout/state.js

@ -3,17 +3,12 @@ const state = {
display: {
left: true, // 是否显示左栏
},
isShowListStatus: false, // 是否显示任务详情列表
startTime: '',
endTime: '',
refreshProjects: false, // 刷新项目
planStartTime: '', // 课题开始时间
planEndTime: '', // 课题结束时间
subStartTime: '', // 子课题开始时间
subEndTime: '', // 子课题结束时间
expreStartTime: '', // 实验开始时间
expreEndTime: '', // 实验结束时间
deviceId: '', // 唯一标识
businessPlugin: '', // 所有服务
allPlugin: '', // 所有插件
};
export default state;

9
src/store/tall/projects/index.js

@ -6,7 +6,6 @@ export default {
projects: [], // 项目列表
dotList: [], // 小红点
newProject: {}, // 新建项目信息
expreStatus: 0, // 实验状态
},
getters: {
@ -94,14 +93,6 @@ export default {
setDotList(state, data) {
state.dotList = data;
},
/**
* 设置实验状态
*/
setExpreimentStatus(state, data) {
state.expreStatus = data || 0;
sessionStorage.setItem('expreStatus', state.expreStatus);
},
},
actions: {},

10
src/store/tall/task/index.js

@ -34,6 +34,7 @@ export default {
timeLineType: 1, // 时间轴模式
upNextPage: 1, // 向上下一页的值
downNextPage: 1, // 向下下一页的值
taskDetailUrl: '', // iframe详情页链接
},
getters: {
@ -392,6 +393,15 @@ export default {
setDownNextPage(state, data) {
state.downNextPage = data;
},
/**
* 设置iframe详情页链接
* @param {Object} state
* @param {Object} data
*/
setTaskDetailUrl(state, data) {
state.taskDetailUrl = data;
},
},
actions: {},

36
src/utils/storage.js

@ -0,0 +1,36 @@
// 用闭包实现局部对象storage(注意Storage的方法都重写一遍,不然调用其对象原型方法会报错。)
const sessionStorageMock = (function (win) {
const storage = win.sessionStorage;
return {
setItem(key, value) {
const setItemEvent = new Event('setItemEvent');
const oldValue = storage[key];
setItemEvent.key = key;
// 新旧值深度判断,派发监听事件
if (oldValue !== value) {
setItemEvent.newValue = value;
setItemEvent.oldValue = oldValue;
win.dispatchEvent(setItemEvent);
storage[key] = value;
return true;
}
return false;
},
getItem(key) {
return storage[key];
},
removeItem(key) {
storage[key] = null;
return true;
},
clear: () => {
storage.clear();
return true;
},
key(index) {
return storage.key(index);
},
};
})(window);
Object.defineProperty(window, 'sessionStorage', { value: sessionStorageMock, writable: true });

189
src/views/detail/Test.vue

@ -1,196 +1,33 @@
<template>
<div class="task-detail">
<div class="task-con flex">
<!-- {{ taskInfo.name }} -->
<div class="task-con-box">
<!-- <div>{{ label }}</div> -->
</div>
<DetailWebview></DetailWebview>
<!-- <div class="task-con flex"> -->
<!-- {{ taskInfo.name }} -->
<!-- <div class="task-con-box"> -->
<!-- <div>{{ label }}</div> -->
<!-- <div class="task-con-list" v-if="isShowList">
<!-- </div> -->
<!-- <div class="task-con-list" v-if="isShowList">
<TaskConList />
</div> -->
</div>
<!-- </div> -->
</div>
</template>
<script setup>
// import { computed, watch, ref } from 'vue';
// import { useStore } from 'vuex';
// const store = useStore();
// const taskDetail = computed(() => store.state.task.taskDetail); //
// const label = ref(null);
// const sessionTaskDetail = sessionStorage.getItem('taskDetail');
// const isShowList = computed(() => store.state.layout.isShowListStatus); //
// if (sessionTaskDetail) {
// const taskInfo = JSON.parse(sessionTaskDetail);
// if (taskInfo.plugins && taskInfo.plugins.length > 0) {
// taskInfo.plugins.forEach(item => {
// if (Number(item[0].pluginId) === 1) {
// label.value = item[0].param;
// store.commit('task/setLabel', label.value);
// }
// });
// }
// }
// //
// watch([taskDetail], () => {
// if (!taskDetail.value) return;
// const taskInfo = taskDetail.value;
// if (taskInfo.plugins && taskInfo.plugins.length > 0) {
// taskInfo.plugins.forEach(item => {
// if (Number(item[0].pluginId) === 1) {
// label.value = item[0].param;
// store.commit('task/setLabel', label.value);
// }
// });
// }
// });
import DetailWebview from '@/components/tall/Right/DetailWebview.vue';
</script>
<style scoped>
.task-detail {
width: 100%;
height: 100%;
padding: 16px;
/* padding: 16px; */
overflow: auto;
}
.task-con {
min-width: 760px;
min-height: 500px;
}
.task-con-box {
max-width: 100%;
flex: 1;
}
.task-form {
padding: 24px;
display: flex;
justify-content: center;
}
.task-form :deep(.ant-form) {
width: 100%;
max-width: 680px;
}
.task-con-list {
min-width: 320px;
max-width: 460px;
background: #fff;
border-radius: 10px;
box-shadow: -5px 0px 5px 0px rgba(3, 27, 49, 0.1);
}
:deep(.ant-input) {
height: 38px;
border: 1px solid #cccccc;
border-radius: 4px;
}
:deep(.ant-btn-primary) {
width: 180px;
height: 38px;
font-size: 16px;
border-radius: 6px;
letter-spacing: 2px;
}
:deep(.ant-space) {
width: 100%;
}
:deep(.ant-picker) {
height: 38px;
width: 100%;
border: 1px solid #cccccc;
border-radius: 4px;
}
:deep(.ant-select-single:not(.ant-select-customize-input) .ant-select-selector) {
height: 38px;
}
:deep(.ant-select-single:not(.ant-select-customize-input) .ant-select-selector .ant-select-selection-search-input) {
height: 38px;
}
:deep(.ant-select-single .ant-select-selector .ant-select-selection-item),
:deep(.ant-select-single .ant-select-selector .ant-select-selection-placeholder) {
line-height: 36px;
}
:deep(.ant-upload) {
width: 100%;
}
/* 上传样式 */
:deep(.ant-upload) .upload-box {
padding: 20px 0;
border: 1px dashed #cccccc;
background: #fafafa;
border-radius: 4px;
}
:deep(.ant-upload) .upload-box img {
width: 32px;
}
:deep(.ant-upload) .upload-box p:first-of-type {
margin-top: 24px;
line-height: 1;
}
:deep(.ant-upload) .upload-box p:last-of-type {
margin-top: 16px;
line-height: 1;
}
:deep(.form-item-dad) {
margin-bottom: 0 !important;
}
.form-item-son {
padding-left: 16px;
}
/* 表格 */
:deep(.ant-table-thead > tr > th),
:deep(.ant-table-tbody > tr > td) {
height: 60px;
}
:deep(.ant-table-thead > tr > th) {
background: #fff;
font-size: 16px;
color: #333;
}
:deep(.ant-table-thead
> tr
> th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before) {
width: 0;
}
:deep(.ant-checkbox-group) {
width: 100%;
}
/* 单选 */
:deep(.ant-radio-group) {
width: 100%;
display: flex;
align-items: center;
}
:deep(.ant-radio-wrapper) {
display: flex !important;
.task-detail::-webkit-scrollbar {
width: 0 !important;
}
</style>

60
src/views/home/Index.vue

@ -11,15 +11,13 @@
<a-layout-sider v-if="projectInfo.id" class="project-detail"><Center /></a-layout-sider>
<a-layout v-if="taskDetail && taskDetail.id">
<!-- 导航栏 -->
<a-layout-header style="background: #fff">
<a-layout v-if="taskDetailUrl">
<!-- 导航栏 - 详情页导航 -->
<!-- <a-layout-header style="background: #fff">
<Navbar />
</a-layout-header>
<!-- 内容区 -->
</a-layout-header> -->
<!-- 内容区 - 详情页 -->
<a-layout-content><router-view></router-view></a-layout-content>
<!-- 脚部 -->
<!-- <a-layout-footer>Footer</a-layout-footer> -->
</a-layout>
</a-layout>
</a-layout>
@ -28,30 +26,28 @@
</template>
<script setup>
import { computed } from 'vue';
import { computed, onMounted } from 'vue';
import { useStore } from 'vuex';
// import { useRoute, useRouter } from 'vue-router';
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import Left from 'components/tall/left/Index.vue';
import Navbar from 'components/tall/top/Navbar.vue';
import TopNavbar from 'components/tall/top/TopNavbar.vue';
import Center from 'components/tall/center/Index.vue';
import Intro from 'components/tall/right/Intro.vue';
import Left from 'components/tall/Left/Index.vue';
// import Navbar from 'components/tall/Top/Navbar.vue';
import TopNavbar from 'components/tall/Top/TopNavbar.vue';
import Center from 'components/tall/Center/Index.vue';
import Intro from 'components/tall/Right/Intro.vue';
import '@/utils/storage.js';
const locale = zhCN;
const store = useStore();
const collapsed = computed(() => store.state.layout.display.left); //
// const projectId = ref(null);
const projectInfo = computed(() => store.state.projects.project); //
const sessionProject = sessionStorage.getItem('project'); //
// const sessionProjectId = sessionStorage.getItem('projectId');
// projectId.value = sessionProjectId;
// const taskId = ref(null);
const sessionTask = sessionStorage.getItem('taskDetail');
// taskId.value = sessionTaskId;
const taskDetail = computed(() => store.state.task.taskDetail); //
// const sessionTask = sessionStorage.getItem('taskDetail');
// const taskDetail = computed(() => store.state.task.taskDetail); //
const taskDetailUrl = computed(() => store.state.task.taskDetailUrl); // iframe
const targetUrl = sessionStorage.getItem('targetUrl'); //
if (sessionProject && !projectInfo.value.id) {
const info = JSON.parse(sessionProject);
@ -60,12 +56,28 @@ if (sessionProject && !projectInfo.value.id) {
store.commit('task/setBusinessCode', info.businessCode);
}
if (sessionTask && !taskDetail.value.id) {
const info = JSON.parse(sessionTask);
console.log(info);
// store.commit('task/setTaskDetail', info);
if (targetUrl) {
store.commit('task/setTaskDetailUrl', targetUrl);
}
// if (sessionTask && !taskDetail.value.id) {
// const info = JSON.parse(sessionTask);
// console.log(info);
// // store.commit('task/setTaskDetail', info);
// }
onMounted(() => {
window.addEventListener('storage', e => {
store.commit('task/setTaskDetailUrl', e.newValue);
console.log('别的浏览器页签storage发生变化啦:', e);
});
window.addEventListener('setItemEvent', e => {
store.commit('task/setTaskDetailUrl', e.newValue);
console.log('sessionStorage值发生变化后触发:', e.newValue);
});
});
// queryu token
// const route = useRoute();
// const router = useRouter();

10
yarn.lock

@ -2370,10 +2370,10 @@
dependencies:
"prettier-linter-helpers" "^1.0.0"
"eslint-plugin-vue@^7.19.1":
"integrity" "sha1-Q1+yznEoQqlTCyjqy4g2gOjqpPM="
"resolved" "https://registry.npmmirror.com/eslint-plugin-vue/download/eslint-plugin-vue-7.19.1.tgz"
"version" "7.19.1"
"eslint-plugin-vue@^7.20.0":
"integrity" "sha512-oVNDqzBC9h3GO+NTgWeLMhhGigy6/bQaQbHS+0z7C4YEu/qK/yxHvca/2PTZtGNPsCrHwOTgKMrwu02A9iPBmw=="
"resolved" "https://registry.npmmirror.com/eslint-plugin-vue/-/eslint-plugin-vue-7.20.0.tgz"
"version" "7.20.0"
dependencies:
"eslint-utils" "^2.1.0"
"natural-compare" "^1.4.0"
@ -2410,7 +2410,7 @@
"resolved" "https://registry.nlark.com/eslint-visitor-keys/download/eslint-visitor-keys-2.1.0.tgz"
"version" "2.1.0"
"eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8", "eslint@^5.16.0 || ^6.8.0 || ^7.2.0", "eslint@^6.2.0 || ^7.0.0 || ^8.0.0-0", "eslint@^7.32.0", "eslint@>=5.0.0", "eslint@>=7.0.0", "eslint@>=7.28.0":
"eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8", "eslint@^5.16.0 || ^6.8.0 || ^7.2.0", "eslint@^6.2.0 || ^7.0.0 || ^8.0.0", "eslint@^7.32.0", "eslint@>=5.0.0", "eslint@>=7.0.0", "eslint@>=7.28.0":
"integrity" "sha1-xtMooUvj+wjI0dIeEsAv23oqgS0="
"resolved" "https://registry.npmmirror.com/eslint/download/eslint-7.32.0.tgz?cache=0&sync_timestamp=1634180157931&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Feslint%2Fdownload%2Feslint-7.32.0.tgz"
"version" "7.32.0"

Loading…
Cancel
Save