Browse Source

fix: renderjs打包h5不触发change事件

test2
xuesinan 3 years ago
parent
commit
1e0f50c6d8
  1. 3
      CHANGELOG.md
  2. 2
      apis/plugin.js
  3. 2
      components/Plugin/Plugin.vue
  4. 25
      components/Render/Render.vue
  5. 43
      components/Roles/Roles.vue
  6. 80
      components/Upload/Upload.vue
  7. 3
      manifest.json
  8. 166
      pages/business/business.vue
  9. 1
      pages/project/project.vue
  10. 10
      plugins/p-deliver-check/p-deliver-check.vue
  11. 4
      plugins/p-deliver-upload/p-deliver-upload.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 1.0.0 (2022-03-07)
# 1.0.0 (2022-03-09)
### 🌟 新功能
范围|描述|commitId
@ -137,6 +137,7 @@
- | 时间轴tab切换角色任务错乱 | [760888b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/760888b)
- | 时间轴tab切换数据不更新 | [6141ff9](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6141ff9)
- | 退出登录 | [6922f24](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6922f24)
- | 未登录时查询成员列表出错,导致角色任务获取出错问题 | [04fddb7](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/04fddb7)
- | 向上查向下查 | [1933e1b](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1933e1b)
- | 项目列表排序 | [ad0ce75](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ad0ce75)
- | 小红点修复 | [ef33187](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/ef33187)

2
apis/plugin.js

@ -22,8 +22,6 @@ export function setupPlugin(app) {
uni.$u.api.saveDeliver = param => uni.$u.post(`${domain.value}/deliver/save`, param);
// 查询任务的交付物历史记录
uni.$u.api.queryDeliverOfTask = param => uni.$u.post(`${domain.value}/deliver/queryDeliverOfTask`, param);
// 检查交付物
uni.$u.api.checkDeliver = param => uni.$u.post(`${domain.value}/deliver/checkDeliver`, param);
// v4.0
// 根据任务id获取任务的交付物信息(已成功)
uni.$u.api.getDeliverByTaskId = param => uni.$u.post(`${domain.value}/deliver/getDeliver`, param);

2
components/Plugin/Plugin.vue

@ -39,8 +39,6 @@
:businessPluginId="businessPluginId"
:param="param"
/>
<!-- #ifdef H5 -->
<!-- #endif -->
</view>
</template>

25
components/Render/Render.vue

@ -15,9 +15,8 @@
:data-token="token"
:data-rstart="task.realStart"
:data-uid="userId"
:pluginInfo="pluginInfo"
:change:pluginInfo="project.renderDom"
:prop="pluginInfo"
:change:prop="projectRender.renderDom"
></view>
</view>
</template>
@ -38,7 +37,6 @@ export default {
data() {
return {
pluginInfo: null,
configInfo: null
};
},
computed: {
@ -100,7 +98,7 @@ export default {
this.pluginInfo.config = pluginConfig.config;
}
}
})
});
} else {
// API
// const params = { businessPluginId: this.businessPluginId };
@ -113,17 +111,18 @@ export default {
// }
// });
}
}
},
},
};
</script>
<script module="project" lang="renderjs">
<script module="projectRender" lang="renderjs">
// TODO: 使
let pluginTaskId = '';
export default {
methods: {
/**
* 渲染dom
* @param {object|null} res 插件详情 监听的pluginInfo
@ -139,15 +138,15 @@ export default {
}
if (res.config) {
const script = window.document.createElement('script');
script.innerHTML = res.config;
window.document.body.appendChild(script);
const script_config = window.document.createElement('script');
script_config.innerHTML = res.config;
window.document.body.appendChild(script_config);
}
if (res.js) {
const script = window.document.createElement('script');
script.innerHTML = res.js;
window.document.body.appendChild(script);
const script_js = window.document.createElement('script');
script_js.innerHTML = res.js;
window.document.body.appendChild(script_js);
}
})
},

43
components/Roles/Roles.vue

@ -80,24 +80,24 @@ watchEffect(() => {
data.roles = visibleRoles.value;
data.loading = false;
}
if (allTasks.value.length > 0) {
allTasks.value.forEach(item => {
if (item.global) {
item.global.forEach(global => {
global.remindNum = 0;
global.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === global.id) {
global.remindNum++;
}
if (remind_data.data.taskId === global.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
@ -107,23 +107,23 @@ watchEffect(() => {
});
});
}
if (item.task) {
item.task.forEach(task => {
task.remindNum = 0;
if (task.plugins) {
task.plugins.forEach(pluginArr => {
pluginArr.forEach(plugin => {
plugin.remindNum = 0;
remindData.value.forEach(remind => {
const remind_data = JSON.parse(remind.data);
if (item.role.id === remind_data.data.roleId) {
if (remind_data.data.taskId === task.id) {
task.remindNum++;
}
if (remind_data.data.taskId === task.id && remind_data.data.pluginId === plugin.pluginTaskId) {
plugin.remindNum++;
}
@ -136,7 +136,7 @@ watchEffect(() => {
}
});
}
store.commit('task/setAllTasks', allTasks.value);
});
@ -236,14 +236,13 @@ function changeRole(id, index) {
const arr = [];
remindData.value.forEach(item => {
const remind_data = JSON.parse(item.data);
if (remind_data.data.taskType === 1) {
if (remind_data.data.taskType === 1 && remind_data.data.roleId === roleId.value) {
arr.push(item);
}
});
let nextLocationTaskId = '';
if (arr.length > 0) {
let nextLocationTaskId = '';
for (let i = 0; i < arr.length; i++) {
const first_option = JSON.parse(arr[0].data);
const curr_option = JSON.parse(arr[i].data);
@ -262,19 +261,17 @@ function changeRole(id, index) {
}
}
}
store.commit('socket/setCurrLocationTaskId', nextLocationTaskId);
store.commit('task/clearTasks'); //
store.commit('task/clearRealTasks'); //
store.commit('task/setUpNextPage', 1);
store.commit('task/setDownNextPage', 1);
// store.commit('task/setTimeLineType', timeLineType.value === 1 ? 2 : 1);
if (nextLocationTaskId) {
const params = { pageNum: 1, taskId: nextLocationTaskId };
getTasksHook.getTasks(params);
}
}
store.commit('socket/setCurrLocationTaskId', nextLocationTaskId);
store.commit('task/clearTasks'); //
store.commit('task/clearRealTasks'); //
store.commit('task/setUpNextPage', 1);
store.commit('task/setDownNextPage', 1);
const params = { pageNum: 1, taskId: nextLocationTaskId, timeNode: new Date().getTime() };
getTasksHook.getTasks(params);
}
data.clickNum = data.firstClickTime = data.secClickTime = 0;

80
components/Upload/Upload.vue

@ -1,20 +1,20 @@
<template>
<view class="upload">
<template>
<view class="upload">
<u-icon
name="plus"
size="24px"
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md"
class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md"
@click="handleUpload"
></u-icon>
</view>
</template>
<script setup>
import { computed, ref } from 'vue';
import { useStore } from 'vuex';
import Config from '@/common/js/config.js';
const store = useStore();
></u-icon>
</view>
</template>
<script setup>
import { computed, ref } from 'vue';
import { useStore } from 'vuex';
import Config from '@/common/js/config.js';
const store = useStore();
const list = ref([]);
const emit = defineEmits(['success', 'error']);
const user = computed(() => store.state.user.user);
@ -23,11 +23,11 @@
if (userJson) {
const user = JSON.parse(userJson);
store.commit('user/setUser', user);
}
getList();
// wbs
}
getList();
// wbs
const handleUpload = async cur => {
// #ifdef APP-PLUS
uni.$ui.showToast('APP暂不支持导入');
@ -48,7 +48,7 @@
//
emit('success');
const { apiUrl } = Config;
const defaultwbs = `${apiUrl}/defaultwbs`;
let defaultwbs = `${apiUrl}/defaultwbs`;
res.url && (defaultwbs = res.url);
setTimeout(() => {
uni.navigateTo({ url: `/pages/project/project?u=${user.value.id}&p=${res.id}&pname=${res.name}&url=${encodeURIComponent(res.url)}` });
@ -65,25 +65,25 @@
url: '/pages/business/business'
})
}
// #endif
};
async function getList() {
try {
const res = await uni.$u.api.getBusinessList();
list.value = res;
} catch (error) {
console.error('error: ', error);
}
}
</script>
<style lang="scss" scoped>
.upload {
position: absolute;
right: 10px;
bottom: 0;
transform: translate3d(0, 50%, 0);
color: $uni-color-primary !important;
}
// #endif
};
async function getList() {
try {
const res = await uni.$u.api.getBusinessList();
list.value = res;
} catch (error) {
console.error('error: ', error);
}
}
</script>
<style lang="scss" scoped>
.upload {
position: absolute;
right: 10px;
bottom: 0;
transform: translate3d(0, 50%, 0);
color: $uni-color-primary !important;
}
</style>

3
manifest.json

@ -122,6 +122,9 @@
"treeShaking" : {
"enable" : false
}
},
"devServer" : {
"https" : false
}
}
}

166
pages/business/business.vue

@ -3,102 +3,102 @@
<view class="statbar">
<view class="status_bar"></view>
</view>
<view class="business-box">
<view class="business-wrap" v-for="(item, index) in list" :key="index" @click="toUpload(item.url)">
<view class="business-box">
<view class="business-wrap" v-for="(item, index) in list" :key="index" @click="toUpload(item.url)">
<view class="business-info">
<view class="name">{{item.name}}</view>
<view class="name">{{ item.name }}</view>
<!-- <view class="desc">{{item.url}}</view> -->
</view>
<view class="mwbs-list" v-if="item.mwbsList && item.mwbsList.length > 0">
<view class="mwbs-item" v-for="(val, key) in item.mwbsList" :key="key" @click.stop="toUpload(item.url)">
<view class="name">{{val.projectName}}</view>
<view class="name">{{ val.projectName }}</view>
<!-- <view class="desc">{{val}}</view> -->
</view>
</view>
</view>
</view>
</template>
</view>
</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import Config from '@/common/js/config.js';
const store = useStore();
const list = ref([]);
const user = computed(() => store.state.user.user);
const userJson = uni.$storage.getStorageSync('user');
if (userJson) {
const user = JSON.parse(userJson);
store.commit('user/setUser', user);
import { ref, computed } from 'vue';
import { useStore } from 'vuex';
import Config from '@/common/js/config.js';
const store = useStore();
const list = ref([]);
const user = computed(() => store.state.user.user);
const userJson = uni.$storage.getStorageSync('user');
if (userJson) {
const user = JSON.parse(userJson);
store.commit('user/setUser', user);
}
getList();
async function getList() {
try {
const res = await uni.$u.api.getBusinessList();
list.value = res;
} catch (error) {
console.error('error: ', error);
}
}
getList();
async function toUpload(url) {
store.commit('setDomain', url);
async function getList() {
try {
const res = await uni.$u.api.getBusinessList();
list.value = res;
} catch (error) {
console.error('error: ', error);
}
try {
const res = await uni.$u.api.import();
// WBS
//
uni.$ui.showToast('导入成功,即将打开新项目', 3000);
const { apiUrl } = Config;
let defaultwbs = `${apiUrl}/defaultwbs`;
res.url && (defaultwbs = res.url);
setTimeout(() => {
uni.navigateTo({ url: `/pages/project/project?u=${user.value.id}&p=${res.id}&pname=${res.name}&url=${encodeURIComponent(res.url)}` });
}, 2000);
} catch (error) {
console.error('error: ', error);
uni.$ui.showToast(error || '导入失败', 6000);
}
async function toUpload(url) {
store.commit('setDomain', url);
try {
const res = await uni.$u.api.import();
// WBS
//
uni.$ui.showToast('导入成功,即将打开新项目', 3000);
const { apiUrl } = Config;
const defaultwbs = `${apiUrl}/defaultwbs`;
res.url && (defaultwbs = res.url);
setTimeout(() => {
uni.navigateTo({
url: `/pages/project/project?u=${user.value.id}&p=${res.id}&pname=${res.name}&url=${encodeURIComponent(res.url)}`
});
}, 2000);
} catch (error) {
console.error('error: ', error);
uni.$ui.showToast(error || '导入失败', 6000);
}
}
</script>
<style lang="scss" scoped>
.business-box {
padding: 0 16px;
}
.business-wrap {
width: 100%;
box-sizing: border-box;
.business-info, .mwbs-item {
padding: 10px;
border-bottom: 1px solid #eeeeee;
}
.name {
line-height: 36px;
}
.desc {
font-size: 12px;
color: #999;
}
}
</script>
.mwbs-list {
padding-left: 16px;
<style lang="scss" scoped>
.business-box {
padding: 0 16px;
}
.mwbs-item:last-child {
border-bottom: none;
}
}
}
.business-wrap {
width: 100%;
box-sizing: border-box;
.business-info,
.mwbs-item {
padding: 10px;
border-bottom: 1px solid #eeeeee;
}
.name {
line-height: 36px;
}
.desc {
font-size: 12px;
color: #999;
}
.mwbs-list {
padding-left: 16px;
.mwbs-item:last-child {
border-bottom: none;
}
}
}
</style>

1
pages/project/project.vue

@ -99,6 +99,7 @@ watch(roleId, () => {
currRoleRealTasks = allTasks.value[index].realTasks || [];
currRoleShowTasks = allTasks.value[index].task || [];
}
store.commit('socket/setCurrLocationTaskId', '');
store.commit('task/setCurrRoleRealTasks', currRoleRealTasks); //
store.commit('task/setCurrRoleShowTasks', currRoleShowTasks); //
}

10
plugins/p-deliver-check/p-deliver-check.vue

@ -6,7 +6,7 @@
{{ deliverData ? deliverData.deliverName : '' }}审核状态
<!-- 有提交记录 有检查人 检查人里有我 且状态是null或者0 才显示小红点 -->
<u-badge
<!-- <u-badge
size="mini"
:is-dot="true"
style="transform: translate3d(2em, -1em, 0)"
@ -17,7 +17,7 @@
deliverData.checkerList.length &&
deliverData.checkerList.find(item => item.isMine && !item.status)
"
></u-badge>
></u-badge> -->
</view>
<!-- 展开折叠按钮 -->
<u-icon :name="collapsed ? 'arrow-up' : 'arrow-down'"></u-icon>
@ -58,7 +58,7 @@
</view>
<!-- 自己是当前审核人 且未审核状态 -->
<view v-show="item.isMine === 1 && item.status === null">
<view v-show="item.isMine === 1 && (item.status === null || item.status === 0)">
<u-button size="mini" shape="circle" class="mr-4 h-1-4 leading-1-4" type="primary" @click="checkModal.mode = 'RESOLVE'">
通过
</u-button>
@ -68,7 +68,7 @@
</view>
<!-- 自己是审核人 且审核过 当前审核人的审核状态并展示得分情况 -->
<view v-show="item.isMine === 1 && item.status !== null" class="text-xs">
<view v-show="item.isMine === 1 && item.status > 0" class="text-xs">
<view class="mb-1">
<text v-if="item.status === 1" class="text-green-600"> 已通过 </text>
<text v-else-if="item.status === 2" class="text-red-600"> 已驳回 </text>
@ -96,7 +96,7 @@ import checkFormModal from './check-form-modal.vue';
const deliverData = inject('deliver');
defineEmits(['check-success']);
const collapsed = ref(false);
const collapsed = ref(false); // /
const checkModal = reactive({
mode: 'HIDE', // HIDE-> RESOLVE-> REJECT->

4
plugins/p-deliver-upload/p-deliver-upload.vue

@ -6,12 +6,12 @@
<view class="flex-1">
<view v-if="deliver.deliverName" class="relative inline-block">
{{ deliver.deliverName }}
<u-badge
<!-- <u-badge
size="mini"
:is-dot="true"
style="transform: translate3d(2em, -1em, 0)"
v-show="!deliver.details || !deliver.details.length"
></u-badge>
></u-badge> -->
</view>
</view>

Loading…
Cancel
Save