Browse Source

feat: 状态栏、导入

test2
xuesinan 4 years ago
parent
commit
f30bac2dbf
  1. 1
      CHANGELOG.md
  2. 64
      components/Upload/Upload.vue
  3. 5
      pages/business/business.vue
  4. 2
      store/user/actions.js

1
CHANGELOG.md

@ -15,6 +15,7 @@
- | 广告页、引导页 | [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)
- | 广告页、引导页改为组件 | [2be7903](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/2be7903)
- | 缓存改变 | [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)
- | 获取手机唯一码 | [3f60cf8](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/3f60cf8)
- | 将时间轴改成swiper滑动 | [12384f9](https://101.201.226.163:50022/TALL/TALL-MUI-4/commits/12384f9)

64
components/Upload/Upload.vue

@ -1,41 +1,69 @@
<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>
<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 {
computed,
ref
} 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']);
const list = ref([]);
getList();
// wbs
const handleUpload = async cur => {
if (list.value.length === 1) {
uni.showModal({
content: '是否上传到' + list.value[0].name,
showCancel: true,
success: async ({ confirm }) => {
if (confirm) {
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);
}
}
},
});
} else {
uni.navigateTo({
url: '/pages/business/business'
})
// 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);
// }
}
};
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>

5
pages/business/business.vue

@ -1,4 +1,9 @@
<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">

2
store/user/actions.js

@ -29,7 +29,7 @@ const actions = {
const res = await uni.$u.api.getSmsCode(params);
uni.$ui.showToast('验证码发送成功');
} catch (error) {
uni.$ui.showToast(error.msg || '发送失败');
uni.$ui.showToast(error.msg || '验证码发送失败');
throw error;
}
},

Loading…
Cancel
Save