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.
46 lines
1.2 KiB
46 lines
1.2 KiB
<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" @click="handleUpload"></u-icon>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue';
|
|
import { useStore } from 'vuex';
|
|
import Config from '@/common/js/config.js';
|
|
|
|
const emit = defineEmits(['success', 'error']);
|
|
|
|
const store = useStore();
|
|
const userId = computed(() => store.getters['user/userId']);
|
|
|
|
// 导入wbs
|
|
const handleUpload = async cur => {
|
|
try {
|
|
const res = await uni.$u.api.import();
|
|
// 导入WBS成功后
|
|
// 直接打开导入的项目
|
|
emit('success');
|
|
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);
|
|
}
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.upload {
|
|
position: absolute;
|
|
right: 10px;
|
|
bottom: 0;
|
|
transform: translate3d(0, 50%, 0);
|
|
color: $uni-color-primary !important;
|
|
}
|
|
</style>
|
|
|