|
|
@ -22,9 +22,19 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
import { ref } from 'vue'; |
|
|
import { ref, computed } from 'vue'; |
|
|
|
|
|
import { useStore } from 'vuex'; |
|
|
|
|
|
import Config from '@/common/js/config.js'; |
|
|
|
|
|
|
|
|
|
|
|
const store = useStore(); |
|
|
const list = ref([]); |
|
|
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(); |
|
|
getList(); |
|
|
|
|
|
|
|
|
@ -44,19 +54,17 @@ |
|
|
const res = await uni.$u.api.import(); |
|
|
const res = await uni.$u.api.import(); |
|
|
// 导入WBS成功后 |
|
|
// 导入WBS成功后 |
|
|
// 直接打开导入的项目 |
|
|
// 直接打开导入的项目 |
|
|
// emit('success'); |
|
|
|
|
|
uni.$ui.showToast('导入成功,即将打开新项目', 3000); |
|
|
uni.$ui.showToast('导入成功,即将打开新项目', 3000); |
|
|
const { apiUrl } = Config; |
|
|
const { apiUrl } = Config; |
|
|
const defaultwbs = `${apiUrl}/defaultwbs`; |
|
|
const defaultwbs = `${apiUrl}/defaultwbs`; |
|
|
res.url && (defaultwbs = res.url); |
|
|
res.url && (defaultwbs = res.url); |
|
|
setTimeout(() => { |
|
|
setTimeout(() => { |
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: `/pages/project/project?u=${userId.value}&p=${res.id}&pname=${res.pname}&url=${res.url}` |
|
|
url: `/pages/project/project?u=${user.value.id}&p=${res.id}&pname=${res.name}&url=${encodeURIComponent(res.url)}` |
|
|
}); |
|
|
}); |
|
|
}, 2000); |
|
|
}, 2000); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('error: ', error); |
|
|
console.error('error: ', error); |
|
|
// emit('error', error); |
|
|
|
|
|
uni.$ui.showToast('导入失败', 6000); |
|
|
uni.$ui.showToast('导入失败', 6000); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|