4 changed files with 85 additions and 51 deletions
@ -1,49 +1,77 @@ |
|||||
<template> |
<template> |
||||
<view class="upload"> |
<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> |
<u-icon name="plus" size="24px" class="flex justify-center w-12 h-12 bg-blue-100 rounded-full shadow-md" |
||||
</view> |
@click="handleUpload"></u-icon> |
||||
</template> |
</view> |
||||
|
</template> |
||||
<script setup> |
|
||||
import { computed } from 'vue'; |
<script setup> |
||||
import { useStore } from 'vuex'; |
import { |
||||
import Config from '@/common/js/config.js'; |
computed, |
||||
|
ref |
||||
const emit = defineEmits(['success', 'error']); |
} from 'vue'; |
||||
|
import { |
||||
const store = useStore(); |
useStore |
||||
const userId = computed(() => store.getters['user/userId']); |
} from 'vuex'; |
||||
|
import Config from '@/common/js/config.js'; |
||||
// 导入wbs |
|
||||
const handleUpload = async cur => { |
const emit = defineEmits(['success', 'error']); |
||||
uni.navigateTo({ |
|
||||
url: '/pages/business/business' |
const store = useStore(); |
||||
}) |
const userId = computed(() => store.getters['user/userId']); |
||||
// try { |
const list = ref([]); |
||||
// const res = await uni.$u.api.import(); |
|
||||
// // 导入WBS成功后 |
getList(); |
||||
// // 直接打开导入的项目 |
|
||||
// emit('success'); |
// 导入wbs |
||||
// const { apiUrl } = Config; |
const handleUpload = async cur => { |
||||
// const defaultwbs = `${apiUrl}/defaultwbs`; |
if (list.value.length === 1) { |
||||
// res.url && (defaultwbs = res.url); |
uni.showModal({ |
||||
// setTimeout(() => { |
content: '是否上传到' + list.value[0].name, |
||||
// uni.navigateTo({ url: `/pages/project/project?u=${userId.value}&p=${res.id}&pname=${res.pname}&url=${res.url}` }); |
showCancel: true, |
||||
// }, 2000); |
success: async ({ confirm }) => { |
||||
// } catch (error) { |
if (confirm) { |
||||
// console.error('error: ', error); |
try { |
||||
// emit('error', error); |
const res = await uni.$u.api.import(); |
||||
// } |
// 导入WBS成功后 |
||||
}; |
// 直接打开导入的项目 |
||||
|
emit('success'); |
||||
</script> |
const { apiUrl } = Config; |
||||
|
const defaultwbs = `${apiUrl}/defaultwbs`; |
||||
<style lang="scss" scoped> |
res.url && (defaultwbs = res.url); |
||||
.upload { |
setTimeout(() => { |
||||
position: absolute; |
uni.navigateTo({ url: `/pages/project/project?u=${userId.value}&p=${res.id}&pname=${res.pname}&url=${res.url}` }); |
||||
right: 10px; |
}, 2000); |
||||
bottom: 0; |
} catch (error) { |
||||
transform: translate3d(0, 50%, 0); |
console.error('error: ', error); |
||||
color: $uni-color-primary !important; |
emit('error', error); |
||||
} |
} |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
} else { |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/business/business' |
||||
|
}) |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
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> |
</style> |
||||
|
|||||
Loading…
Reference in new issue