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.
178 lines
4.0 KiB
178 lines
4.0 KiB
<template> |
|
<!-- <u-navbar title="离线上传" placeholder border=true :autoBack="true" leftIconSize='35'></u-navbar> --> |
|
<u-navbar title="离线上传" bgColor='#D3832A' leftIconColor='#ffffff' titleStyle='color:#ffffff' placeholder |
|
:autoBack="true" leftIconSize='35'></u-navbar> |
|
<scroll-view scroll-y="true" class="scview"> |
|
<view class="maxbx"> |
|
<view class="item" v-for="(item,index) in taslarr"> |
|
<view>{{item.name}}</view> |
|
<view class="but"> |
|
<view @click="edit(index)">编辑</view> |
|
<view @click="removetask(index)">删除</view> |
|
</view> |
|
</view> |
|
</view> |
|
</scroll-view> |
|
<view class="buts"> |
|
<view @click="createTask">创建任务</view> |
|
<view>一键上传</view> |
|
</view> |
|
<tips ref="tip"></tips> |
|
<tiplist ref="tiplists"></tiplist> |
|
</template> |
|
|
|
<script lang="ts" setup> |
|
import { |
|
onLoad, |
|
onShow, |
|
onHide, |
|
onUnload |
|
} from '@dcloudio/uni-app' |
|
import { ref } from "vue"; |
|
const tiplists = ref(null) |
|
const tip = ref(null) |
|
let taslarr = ref(null) |
|
onShow(() => { |
|
// #ifdef APP |
|
uni.$off('scancodedate') |
|
// #endif |
|
console.log('onshow'); |
|
taslarr.value = uni.getStorageSync('HistoryDate') |
|
}) |
|
function edit(index) { |
|
uni.navigateTo({ |
|
url: '/pagesHome/pages/createTask/createTask?name=' + taslarr.value[index].name + '&editindex=' + index |
|
}) |
|
} |
|
function createTask() { |
|
tiplists.value.setdetails({ |
|
isshow: true, |
|
tipstate: 1, |
|
title: '请输入创建任务的别名', |
|
placeholder: '请输入别名', |
|
inputtext: '', |
|
success: (detail) => { |
|
// let chekarr=uni.getStorageSync('HistoryDate') |
|
// if(!chekarr){ |
|
// uni.setStorageSync('HistoryDate',[{name:detail.inputtext,numberarr:[]}]) |
|
// }else{ |
|
// chekarr.push({name:detail.inputtext,numberarr:[]}) |
|
// uni.setStorageSync('HistoryDate',chekarr) |
|
// } |
|
uni.navigateTo({ |
|
url: '/pagesHome/pages/createTask/createTask?name=' + detail.inputtext |
|
}) |
|
tiplists.value.setdetails({ isshow: false }) |
|
}, |
|
cancel: () => { |
|
tiplists.value.setdetails({ isshow: false }) |
|
}, |
|
close: () => { |
|
tiplists.value.setdetails({ isshow: false }) |
|
} |
|
}) |
|
} |
|
function removetask(index : number) { |
|
tip.value.setdetails({ |
|
content: '确认删除?', |
|
isshow: true, |
|
confirmTxt: '删除', |
|
success: () => { |
|
let taskarr = uni.getStorageSync('HistoryDate') |
|
taskarr.splice(index, 1) |
|
uni.setStorageSync('HistoryDate', taskarr) |
|
taslarr.value = uni.getStorageSync('HistoryDate') |
|
uni.showToast({ |
|
title: '删除成功', |
|
icon: 'none' |
|
}) |
|
tip.value.setdetails({ isshow: false }) |
|
}, |
|
cancel: () => { |
|
tip.value.setdetails({ isshow: false }) |
|
}, |
|
close: () => { |
|
tip.value.setdetails({ isshow: false }) |
|
}, |
|
}) |
|
} |
|
</script> |
|
|
|
<style lang="scss"> |
|
.maxbx { |
|
display: flex; |
|
flex-direction: column; |
|
align-items: center; |
|
|
|
.item { |
|
width: 680upx; |
|
background-color: #FFFFFF; |
|
padding: 20upx 30upx; |
|
box-sizing: border-box; |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-between; |
|
padding: 20upx 15upx; |
|
box-sizing: border-box; |
|
border-radius: 8upx; |
|
box-shadow: 0upx 1upx 10upx 0upx #e2e2e3; |
|
margin-top: 30upx; |
|
font-size: 28upx; |
|
|
|
>.but { |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
|
|
>view { |
|
font-size: 26upx; |
|
width: 120upx; |
|
height: 60upx; |
|
color: #FFFFFF; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
border-radius: 8upx; |
|
|
|
&:nth-of-type(1) { |
|
margin-right: 20upx; |
|
background-color: #D3832A; |
|
} |
|
|
|
&:nth-of-type(2) { |
|
background-color: #e20000; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
.scview { |
|
width: 100%; |
|
height: 70vh; |
|
// padding: 30upx 0; |
|
box-sizing: border-box; |
|
// background-color: #ffffff; |
|
} |
|
|
|
.buts { |
|
width: 100%; |
|
display: flex; |
|
align-items: center; |
|
justify-content: space-around; |
|
margin-top: 30upx; |
|
|
|
>view { |
|
width: 320upx; |
|
height: 88upx; |
|
background: #D3832A; |
|
border-radius: 8upx; |
|
font-size: 32upx; |
|
font-weight: 400; |
|
color: #FFFFFF; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
} |
|
} |
|
</style> |