h5
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.2 KiB

<template>
<!-- 这里是适配的状态栏的代码 -->
<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">
<view class="business-info">
<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">
<view class="name">{{val.projectName}}</view>
<!-- <view class="desc">{{val}}</view> -->
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
const list = ref([]);
getList();
async function getList() {
try {
const res = await uni.$u.api.getBusinessList();
list.value = res;
} catch (error) {
console.error('error: ', error);
}
}
async function toUpload() {
try {
const res = await uni.$u.api.import();
// 导入WBS成功后
// 直接打开导入的项目
// emit('success');
uni.$ui.showToast('导入成功,即将打开新项目', 3000);
const { apiUrl } = Config;
const defaultwbs = `${apiUrl}/defaultwbs`;
res.url && (defaultwbs = res.url);
setTimeout(() => {
uni.navigateTo({
url: `/pages/project/project?u=${userId.value}&p=${res.id}&pname=${res.pname}&url=${res.url}`
});
}, 2000);
} catch (error) {
console.error('error: ', error);
// emit('error', error);
uni.$ui.showToast('导入失败', 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;
}
.mwbs-list {
padding-left: 16px;
.mwbs-item:last-child {
border-bottom: none;
}
}
}
</style>