fix: BUG修改

This commit is contained in:
kun 2024-04-21 09:50:53 +08:00
parent 13ce4f5397
commit 18a7dc4759
2 changed files with 129 additions and 105 deletions

View File

@ -9,8 +9,9 @@
<view class="searchBox">
<form @submit="formSubmit">
<view class="uni-form-item">
<input class="uni-input" name="searchName" v-model="searchName" @input="searchFile" placeholder="请输入文件名" />
<button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button>
<input class="uni-input" name="searchName" v-model="searchName" @input="searchFile"
placeholder="请输入文件名" />
<button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button>
<!-- <uni-icons class="search-icon" type="search" @click="loadData"></uni-icons> -->
</view>
</form>
@ -24,8 +25,8 @@
<image @click="downloadFn(item)" class="ellipsis" src="../../static/ellipsis.png"></image>
</view>
</view>
<view class="placeholderBox" v-else>
<image src="/static/noData.png" class="noDataImg"></image>
<view class="text">
@ -39,77 +40,85 @@
<script>
import headers from '../../components/headers/headers.vue'
export default {
components:{headers},
components: {
headers
},
data() {
return {
searchName:'',
fileList:[],
searchName: '',
fileList: [],
timer: null,
fileImg1: require("../../static/ppt.png"),
fileImg2: require("../../static/excel.png"),
fileImg3: require("../../static/pdf.png"),
fileImg4: require("../../static/word.png"),
fileImg2: require("../../static/excel.png"),
fileImg3: require("../../static/pdf.png"),
fileImg4: require("../../static/word.png"),
};
},
mounted(){
mounted() {
this.loadData()
},
methods:{
methods: {
parseFileImgFn(url) {
var type = url.split(".")[1];
if (type == "ppt" || type == "pptx") {
return this.fileImg1;
}
if (type == "xls" || type == "xlsx") {
return this.fileImg2;
}
if (type == "pdf") {
return this.fileImg3;
}
if (type == "doc" || type == "docx") {
return this.fileImg4;
}
},
formSubmit(e){
var type = url.split(".")[1];
if (type == "ppt" || type == "pptx") {
return this.fileImg1;
}
if (type == "xls" || type == "xlsx") {
return this.fileImg2;
}
if (type == "pdf") {
return this.fileImg3;
}
if (type == "doc" || type == "docx") {
return this.fileImg4;
}
},
formSubmit(e) {
// console.log(e)
this.searchName = e.detail.value.searchName
this.loadData()
},
searchFile(e){
searchFile(e) {
this.searchName = e.detail.value
},
loadData(){
var json={
companySn: JSON.parse(uni.getStorageSync('userInfo')).headquartersSn,
loadData() {
var json = {
// companySn: JSON.parse(uni.getStorageSync('userInfo')).headquartersSn,
fileName: this.searchName,
pageNo: 1,
pageSize: 100
}
if ([2, 3, 4, 7].includes(JSON.parse(uni.getStorageSync('userInfo')).accountType)) {
json.companySn = JSON.parse(uni.getStorageSync('userInfo')).sn
}
if ([5, 6, 10].includes(JSON.parse(uni.getStorageSync('userInfo')).accountType)) {
json.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
}
var that = this
this.sendRequest({
url: "xmgl/companyFile/list",
data: json,
method: "POST",
success(res){
console.log('文件数据',res);
that.fileList=res.result.page.records
success(res) {
console.log('文件数据', res);
that.fileList = res.result.page.records
}
})
},
downloadFn(item){
downloadFn(item) {
var that = this
uni.showModal({
title: '提示',
content: item.fileName,
confirmText:'下载',
success: function (res) {
if (res.confirm) {
title: '提示',
content: item.fileName,
confirmText: '下载',
success: function(res) {
if (res.confirm) {
uni.downloadFile({
url: that.url_config+'image/'+item.filePath, //
success: (res) => {
url: that.url_config + 'image/' + item.filePath, //
success: (res) => {
console.log(res)
if (res.statusCode === 200) {
if (res.statusCode === 200) {
// uni.showToast({
// title:''
// })
@ -121,21 +130,21 @@
console.log(res);
console.log('打开文档成功');
uni.showToast({
title:'打开文档成功'
title: '打开文档成功'
})
}
});
}else{
} else {
uni.showToast({
title:'下载失败'
title: '下载失败'
})
}
}
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
}
@ -143,61 +152,70 @@
</script>
<style lang="scss" scoped>
.filePage{
background-color: white;
height: 100%;
}
.searchBox{
background-color: white;
}
.uni-input{
border-radius: 15px;
margin: 10px 10px;
background-color: #f2f2f2;
height: 30px;
line-height: 30px;
padding: 0 20px;
font-size: 14px;
width: 65%;
}
.fileItem{
font-size: 15px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 0;
margin: 0 10px;
color: $uni-text-color;
border-bottom: 1px solid rgba(221, 221, 221,0.8);
.left{
.filePage {
background-color: white;
height: 100%;
}
.searchBox {
background-color: white;
}
.uni-input {
border-radius: 15px;
margin: 10px 10px;
background-color: #f2f2f2;
height: 30px;
line-height: 30px;
padding: 0 20px;
font-size: 14px;
width: 65%;
}
.fileItem {
font-size: 15px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px 0;
margin: 0 10px;
color: $uni-text-color;
border-bottom: 1px solid rgba(221, 221, 221, 0.8);
.left {
display: flex;
align-items: center;
}
.fileIcon {
width: 20px;
height: 22px;
margin-right: 10px;
}
.ellipsis {
width: 20px;
height: 5px;
}
}
.fileIcon{
width: 20px;
height: 22px;
margin-right: 10px;
.uni-form-item {
position: relative;
.search-icon {
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
}
}
.ellipsis{
width: 20px;
height: 5px;
}
}
.uni-form-item{
position: relative;
.search-icon{
.mini-btn {
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
right: 6px;
top: 0px;
border-radius: 15px;
height: 30px;
line-height: 30px;
}
}
.mini-btn{
position: absolute;
right: 6px;
top: 0px;
border-radius: 15px;
height: 30px;
line-height: 30px;
}
</style>
</style>

View File

@ -81,11 +81,17 @@
},
loadData(){
var json={
companySn: JSON.parse(uni.getStorageSync('userInfo')).headquartersSn,
// companySn: JSON.parse(uni.getStorageSync('userInfo')).headquartersSn,
fileName: this.searchName,
pageNo: 1,
pageSize: 100
}
if ([2, 3, 4, 7].includes(JSON.parse(uni.getStorageSync('userInfo')).accountType)) {
json.companySn = JSON.parse(uni.getStorageSync('userInfo')).sn
}
if ([5, 6, 10].includes(JSON.parse(uni.getStorageSync('userInfo')).accountType)) {
json.projectSn = JSON.parse(uni.getStorageSync('userInfo')).sn
}
var that = this
this.sendRequest({
url: "xmgl/companyFile/list",