Browse Source

feat: 插件调用

test2
xuesinan 4 years ago
parent
commit
9146b40c91
  1. 1
      CHANGELOG.md
  2. 53
      components/Render/Render.vue
  3. 2
      pages/checkLog/checkLog.vue
  4. 6
      pages/project/project.vue
  5. 2
      pages/submitLog/submitLog.vue
  6. 2
      plugins/p-deliver-check/p-deliver-check.vue
  7. 12
      store/index.js

1
CHANGELOG.md

@ -23,6 +23,7 @@
- | 广告页、引导页 | [fe87d00](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fe87d00) - | 广告页、引导页 | [fe87d00](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/fe87d00)
- | 广告页、引导页 | [1c89806](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1c89806) - | 广告页、引导页 | [1c89806](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/1c89806)
- | 广告页、引导页改为组件 | [2be7903](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2be7903) - | 广告页、引导页改为组件 | [2be7903](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2be7903)
- | 广告页时长 | [6c6ea6e](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/6c6ea6e)
- | 缓存改变 | [9685d55](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9685d55) - | 缓存改变 | [9685d55](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/9685d55)
- | 获取交付物信息 | [5ae68e2](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5ae68e2) - | 获取交付物信息 | [5ae68e2](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/5ae68e2)
- | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8) - | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8)

53
components/Render/Render.vue

@ -4,7 +4,7 @@
<view <view
class="content" class="content"
style="border-radius: 8px;" style="border-radius: 8px;"
id="project" :id="`project-${task.id}`"
:data-did="task.detailId" :data-did="task.detailId"
:data-param="param" :data-param="param"
:data-pdu="task.planDuration" :data-pdu="task.planDuration"
@ -22,7 +22,7 @@
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<view <view
class="content" class="content"
id="project" :id="`project-${task.id}`"
:data-did="task.detailId" :data-did="task.detailId"
:data-param="param" :data-param="param"
:data-pdu="task.planDuration" :data-pdu="task.planDuration"
@ -41,7 +41,7 @@
</template> </template>
<script setup> <script setup>
import { computed, reactive } from 'vue'; import { computed, reactive, watch, ref } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
defineProps({ defineProps({
@ -60,6 +60,7 @@ const roleId = computed(() => store.state.role.roleId);
const token = computed(() => store.state.user.token); const token = computed(() => store.state.user.token);
const userId = computed(() => store.getters['user/userId']); const userId = computed(() => store.getters['user/userId']);
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const allPlugin = uni.$storage.getStorageSync('allPlugin');
</script> </script>
<script module="project" lang="renderjs"> <script module="project" lang="renderjs">
@ -69,6 +70,9 @@ export default {
pluginContent: null, pluginContent: null,
pluginJs: null, pluginJs: null,
show: false, show: false,
pluginlists: [],
flag: false,
pluginInfo: {}
}; };
}, },
@ -81,24 +85,39 @@ export default {
methods: { methods: {
// //
async getPlugin() { async getPlugin() {
const params = { businessPluginId: this.businessPluginId }; this.pluginlists = JSON.parse(this.allPlugin);
this.$catchReq.getOtherPlugin(params, (err, res) => { this.pluginlists.forEach(item => {
if (err) { if (this.pluginId === item.id) {
console.error('err: ', err); this.flag = true;
} else { this.pluginInfo = item;
if (!res || !res.id) return; this.show = true;
if (res.html && res.js) {
this.show = true;
this.$nextTick(() => {
this.init(res);
});
}
} }
}); })
if (this.flag) {
this.$nextTick(() => {
this.init(this.pluginInfo);
});
} else {
const params = { businessPluginId: this.businessPluginId };
this.$catchReq.getOtherPlugin(params, (err, res) => {
if (err) {
console.error('err: ', err);
} else {
if (!res) return;
if (res.html && res.js) {
this.show = true;
this.$nextTick(() => {
this.init(res);
});
}
}
});
}
}, },
init(res) { init(res) {
const content = document.querySelector('.content'); const content = document.getElementById(`project-${this.task.id}`);
content.innerHTML = res.html; content.innerHTML = res.html;
const script = document.createElement('script'); const script = document.createElement('script');

2
pages/checkLog/checkLog.vue

@ -17,7 +17,7 @@
<view class="mb-1 text-green-600" v-if="item.status === 1"> 已通过 </view> <view class="mb-1 text-green-600" v-if="item.status === 1"> 已通过 </view>
<view class="mb-1 text-red-600" v-if="item.status === 2"> 已驳回 </view> <view class="mb-1 text-red-600" v-if="item.status === 2"> 已驳回 </view>
<view v-if="+item.score > 0"> <view v-if="+item.score > 0">
<zwp-ring-timing mode="chart" :value="item.score" active-color="#F59E0B" radius="30" bar-width="4"> <zwp-ring-timing mode="chart" :value="item.score" active-color="#F59E0B" :radius="30" bar-width="4">
<text class="text-yellow-500 font-medium">{{ item.score }}</text> <text class="text-yellow-500 font-medium">{{ item.score }}</text>
</zwp-ring-timing> </zwp-ring-timing>
</view> </view>

6
pages/project/project.vue

@ -41,6 +41,7 @@ const initHook = useInit();
const getTasksHook = useGetTasks(); const getTasksHook = useGetTasks();
const store = useStore(); const store = useStore();
const projectId = computed(() => store.getters['project/projectId']); const projectId = computed(() => store.getters['project/projectId']);
const userInfo = computed(() => store.state.user.user);
const userId = computed(() => store.getters['user/userId']); const userId = computed(() => store.getters['user/userId']);
const roleId = computed(() => store.state.role.roleId); // id const roleId = computed(() => store.state.role.roleId); // id
const roleIndex = computed(() => store.state.role.roleIndex); // const roleIndex = computed(() => store.state.role.roleIndex); //
@ -59,6 +60,11 @@ onMounted(() => {
height.value = `${system.windowHeight}px`; height.value = `${system.windowHeight}px`;
}); });
if (!userInfo.value) {
let res = uni.$storage.getStorageSync('user');
store.commit('user/setUser', JSON.parse(res));
}
/** /**
* 当角色发生变化时 * 当角色发生变化时
* 重新查询永久日常任务和普通日常任务 * 重新查询永久日常任务和普通日常任务

2
pages/submitLog/submitLog.vue

@ -29,7 +29,7 @@
<view v-else-if="checkItem.status === 1"> <view v-else-if="checkItem.status === 1">
<view class="text-green-600 mb-1">已通过</view> <view class="text-green-600 mb-1">已通过</view>
<zwp-ring-timing mode="chart" :value="checkItem.score" active-color="#F59E0B" radius="30" bar-width="4"> <zwp-ring-timing mode="chart" :value="checkItem.score" active-color="#F59E0B" :radius="30" bar-width="4">
<text class="text-yellow-500 font-medium">{{ checkItem.score }}</text> <text class="text-yellow-500 font-medium">{{ checkItem.score }}</text>
</zwp-ring-timing> </zwp-ring-timing>
</view> </view>

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

@ -59,7 +59,7 @@
<text v-if="item.status === 1" class="text-green-600"> 已通过 </text> <text v-if="item.status === 1" class="text-green-600"> 已通过 </text>
<text v-else-if="item.status === 2" class="text-red-600"> 已驳回 </text> <text v-else-if="item.status === 2" class="text-red-600"> 已驳回 </text>
</view> </view>
<zwp-ring-timing mode="chart" :value="item.score" active-color="#F59E0B" radius="30" bar-width="4" v-if="item.score !== null"> <zwp-ring-timing mode="chart" :value="item.score" active-color="#F59E0B" :radius="30" bar-width="4" v-if="item.score !== null">
<text class="text-yellow-500 font-medium">{{ item.score }}</text> <text class="text-yellow-500 font-medium">{{ item.score }}</text>
</zwp-ring-timing> </zwp-ring-timing>
</view> </view>

12
store/index.js

@ -18,8 +18,8 @@ const state = {
domain: `${Config.apiUrl}/defaultwbs`, // 项目跳转域名 domain: `${Config.apiUrl}/defaultwbs`, // 项目跳转域名
guide: '', // 引导页图片json guide: '', // 引导页图片json
advs: '', // 广告图片json advs: '', // 广告图片json
businessPlugin: [], // 所有服务 businessPlugin: '', // 所有服务
allPlugin: [], // 所有插件 allPlugin: '', // 所有插件
firstOpenApp: false, // 是否是第一次打开APP或者引导页有更新,false表示从未打开过,true表示打开过 firstOpenApp: false, // 是否是第一次打开APP或者引导页有更新,false表示从未打开过,true表示打开过
isOpenApp: true, // 是否打开APP isOpenApp: true, // 是否打开APP
}; };
@ -128,8 +128,8 @@ const actions = {
async getBusinessPlugin({ commit }, param) { async getBusinessPlugin({ commit }, param) {
try { try {
const res = await uni.$u.api.getBusinessPlugin(); const res = await uni.$u.api.getBusinessPlugin();
uni.$storage.setStorageSync('businessPlugin', res); uni.$storage.setStorageSync('businessPlugin', JSON.stringify(res) || '');
commit('setBusinessPlugin', res || []); commit('setBusinessPlugin', JSON.stringify(res) || '');
return res; return res;
} catch (error) { } catch (error) {
uni.$ui.showToast(error.msg); uni.$ui.showToast(error.msg);
@ -140,8 +140,8 @@ const actions = {
async getAllPlugin({ commit }, param) { async getAllPlugin({ commit }, param) {
try { try {
const res = await uni.$u.api.getAllPlugin(); const res = await uni.$u.api.getAllPlugin();
uni.$storage.setStorageSync('allPlugin', res || []); uni.$storage.setStorageSync('allPlugin', JSON.stringify(res) || '');
commit('setAllPlugin', res); commit('setAllPlugin', JSON.stringify(res) || '');
return res; return res;
} catch (error) { } catch (error) {
uni.$ui.showToast(error.msg); uni.$ui.showToast(error.msg);

Loading…
Cancel
Save