Browse Source

feat: 状态栏、导入

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

1
CHANGELOG.md

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

124
components/Upload/Upload.vue

@ -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>

7
pages/business/business.vue

@ -1,4 +1,9 @@
<template> <template>
<!-- 这里是适配的状态栏的代码 -->
<view class="statbar">
<view class="status_bar"></view>
</view>
<view class="business-box"> <view class="business-box">
<view class="business-wrap" v-for="(item, index) in list" :key="index" @click="toUpload"> <view class="business-wrap" v-for="(item, index) in list" :key="index" @click="toUpload">
<view class="business-info"> <view class="business-info">

4
store/user/actions.js

@ -25,11 +25,11 @@ const actions = {
* @param {string} params.phone 手机号 * @param {string} params.phone 手机号
*/ */
async sendCode({ commit }, params) { async sendCode({ commit }, params) {
try{ try {
const res = await uni.$u.api.getSmsCode(params); const res = await uni.$u.api.getSmsCode(params);
uni.$ui.showToast('验证码发送成功'); uni.$ui.showToast('验证码发送成功');
} catch (error) { } catch (error) {
uni.$ui.showToast(error.msg || '发送失败'); uni.$ui.showToast(error.msg || '验证码发送失败');
throw error; throw error;
} }
}, },

Loading…
Cancel
Save