Browse Source

修复文件预览打不开的问题

master
parent
commit
4e15d4f17a
  1. 96
      manifest.json
  2. 248
      sub/task/detail.vue

96
manifest.json

@ -1,23 +1,23 @@
{
"name" : "智慧生态",
"appid" : "__UNI__CECFD0D",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : 1,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,
"nvueCompiler" : "uni-app",
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
"name": "智慧生态",
"appid": "__UNI__CECFD0D",
"description": "",
"versionName": "1.0.0",
"versionCode": 1,
"transformPx": false,
"app-plus": {
"usingComponents": true,
"nvueCompiler": "uni-app",
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
"modules" : {},
"distribute" : {
"android" : {
"permissions" : [
"modules": {},
"distribute": {
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
@ -35,45 +35,45 @@
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
"ios" : {},
"sdkConfigs" : {}
"ios": {},
"sdkConfigs": {}
}
},
"quickapp" : {},
"mp-weixin" : {
"appid" : "wx6d80755768234f3b",
"setting" : {
"urlCheck" : false,
"es6" : true,
"minified" : true,
"postcss" : true
"quickapp": {},
"mp-weixin": {
"appid": "wx6d80755768234f3b",
"setting": {
"urlCheck": false,
"es6": true,
"minified": true,
"postcss": true
},
"optimization" : {
"subPackages" : true
"optimization": {
"subPackages": true
},
"usingComponents" : true,
"lazyCodeLoading" : "requiredComponents",
"permission" : {
"scope.record" : {
"desc" : "用于语音输入"
"usingComponents": true,
"lazyCodeLoading": "requiredComponents",
"permission": {
"scope.record": {
"desc": "用于语音输入"
},
"scope.userLocation" : {
"desc" : "获取企业位置"
"scope.userLocation": {
"desc": "获取企业位置"
}
},
"requiredPrivateInfos" : [ "getLocation", "chooseLocation" ]
"requiredPrivateInfos": ["getLocation", "chooseLocation"]
},
"vueVersion" : "2",
"h5" : {
"template" : "static/index.html",
"devServer" : {
"port" : 9090,
"https" : false
"vueVersion": "2",
"h5": {
"template": "static/index.html",
"devServer": {
"port": 9090,
"https": false
},
"title" : "nature-secure-miniapp",
"router" : {
"mode" : "hash",
"base" : "./"
"title": "nature-secure-miniapp",
"router": {
"mode": "hash",
"base": "./"
}
}
}

248
sub/task/detail.vue

@ -1,8 +1,11 @@
<template>
<cs-page>
<view class="detail-container" :style="{
<view
class="detail-container"
:style="{
paddingBottom: isSelect.length > 0 ? '140rpx' : '40rpx'
}">
}"
>
<view class="box detail">
<text class="wd-font-800 wd-text-16" style="color: #071437">
{{ detail.title }}
@ -16,14 +19,24 @@
$dict.echoDicValue(dictMap.task_priority, detail.priority)
}}
</view>
<view v-for="(tag, index) in detail.tagList" :key="index" class="tag">
<view
v-for="(tag, index) in detail.tagList"
:key="index"
class="tag"
>
{{ tag }}
</view>
</view>
<view class="wd-flex wd-text-13" style="justify-content: space-between">
<view
class="wd-flex wd-text-13"
style="justify-content: space-between"
>
<view class="wd-flex" style="align-items: center; gap: 8rpx">
<u-icon name="calendar" color="#17C653" size="16" />
<text class="wd-text-13" style="font-weight: bold; margin-right: 8rpx">
<text
class="wd-text-13"
style="font-weight: bold; margin-right: 8rpx"
>
{{
`${$util.formatDate(
detail.startDate,
@ -35,39 +48,69 @@
</view>
<cs-text-more :value="detail.description" />
<view class="file-list" v-if="files && files.length > 0">
<view class="file" v-for="(file, index) in files" :key="index" @click="openFile(file)"
style="cursor: pointer; width: 48%;">
<view
class="file"
v-for="(file, index) in files"
:key="index"
@click="openFile(file)"
>
<u-icon name="attach" color="#17C653" size="16" />
<text class="name" style="var(--LightMode-Grey-Grey-900, #071437);">{{ file.name }}</text>
<text
class="name"
style="var(--LightMode-Grey-Grey-900, #071437);"
>
{{ file.name }}
</text>
</view>
</view>
<view class="audit">
<cs-dict-tag :dict="dictMap.task_state" :value="detail.status"></cs-dict-tag>
<cs-dict-tag
:dict="dictMap.task_state"
:value="detail.status"
></cs-dict-tag>
</view>
</view>
<u-sticky>
<view :class="[
<view
:class="[
'options-container',
OptionsOffset.isTop ? 'isTop' : ''
]" ref="optionRef" id="options">
]"
ref="optionRef"
id="options"
>
<van-dropdown-menu active-color="#17C653" style="flex: 1">
<van-dropdown-item v-if="showItem(['director'])" :value="queryParams.departmentId"
:options="dropOption.dept" @change="
<van-dropdown-item
v-if="showItem(['director'])"
:value="queryParams.departmentId"
:options="dropOption.dept"
@change="
v => {
querySelect(v, 'departmentId')
}
" />
<van-dropdown-item v-if="showItem(['queue', 'director'])" :value="queryParams.userId" use-before-toggle
@before-toggle="getUserOption" :options="userList" @change="
"
/>
<van-dropdown-item
v-if="showItem(['queue', 'director'])"
:value="queryParams.userId"
use-before-toggle
@before-toggle="getUserOption"
:options="userList"
@change="
v => {
querySelect(v, 'userId')
}
" />
<van-dropdown-item :value="queryParams.Inspections_status" :options="dropOption.status" @change="
"
/>
<van-dropdown-item
:value="queryParams.Inspections_status"
:options="dropOption.status"
@change="
v => {
querySelect(v, 'inspectionsStatus')
}
" />
"
/>
</van-dropdown-menu>
<view style="flex: 0 0 120rpx">
<text style="color: #17c653">{{ list.length }}</text>
@ -75,11 +118,20 @@
</view>
</view>
</u-sticky>
<view class="record" v-for="record in list" :key="record.id" @tap="goRecord(record)">
<view :class="{
<view
class="record"
v-for="record in list"
:key="record.id"
@tap="goRecord(record)"
>
<view
:class="{
select: true,
isSelect: isSelect.includes(record.id)
}" @tap.native.stop="select(record.id)" v-if="['3', null].includes(record.inspectionStatus)">
}"
@tap.native.stop="select(record.id)"
v-if="['3', null].includes(record.inspectionStatus)"
>
<u-icon name="checkbox-mark" size="16" color="#fff"></u-icon>
</view>
<view class="disable" v-else></view>
@ -87,7 +139,8 @@
<view class="name">
{{ record.enterpriseName }}
</view>
<view style="
<view
style="
font-size: 26rpx;
padding-right: 3rem;
margin-bottom: 4rpx;
@ -95,26 +148,44 @@
text-overflow: ellipsis;
width: 528rpx;
overflow: hidden;
">
"
>
{{ record.enterpriseAddress }}
</view>
<view class="tagList" style="margin-top: 16rpx">
<view v-for="(item, index) in record.tagList" :key="index" class="tag">
<view
v-for="(item, index) in record.tagList"
:key="index"
class="tag"
>
{{ item }}
</view>
</view>
</view>
<view class="audit" v-show="record.inspectionStatus">
<cs-dict-tag :dict="dictMap.Inspections_status" :value="record.inspectionStatus"></cs-dict-tag>
<cs-dict-tag
:dict="dictMap.Inspections_status"
:value="record.inspectionStatus"
></cs-dict-tag>
</view>
</view>
<u-loadmore :status="load" marginTop="12" marginBottom="12" v-if="load != 'nomore'" />
<u-loadmore
:status="load"
marginTop="12"
marginBottom="12"
v-if="load != 'nomore'"
/>
<view class="btn-box" v-if="isSelect.length > 0">
<view class="confirm-btn" @tap="replay">
已选择({{ isSelect.length }})
</view>
</view>
<u-modal :show="model.show" closeOnClickOverlay @close="closeModel" borderRadius="32rpx">
<u-modal
:show="model.show"
closeOnClickOverlay
@close="closeModel"
borderRadius="32rpx"
>
<view class="wd-flex wd-flex-col" style="gap: 20px">
<view class="header">
<view class="row-1">
@ -125,17 +196,31 @@
<view class="row-2">每次只能选择一人</view>
</view>
<view class="staff-list">
<view class="staff" v-for="staff in model.list" :key="staff.userId" :style="{
<view
class="staff"
v-for="staff in model.list"
:key="staff.userId"
:style="{
'--select-color':
model.isSelect == staff.userId ? '#17c653' : '#f1f1f4'
}" @click="selectUser(staff.userId)">
<u-avatar size="40" shape="circle" :src="staff.avatar"></u-avatar>
}"
@click="selectUser(staff.userId)"
>
<u-avatar
size="40"
shape="circle"
:src="staff.avatar"
></u-avatar>
<view class="info">
<view class="name">{{ staff.realName }}</view>
<view class="dept">{{ staff.roleName[0] }}</view>
</view>
<view class="isSelect">
<u-icon name="checkbox-mark" size="16px" color="#fff"></u-icon>
<u-icon
name="checkbox-mark"
size="16px"
color="#fff"
></u-icon>
</view>
</view>
</view>
@ -151,20 +236,11 @@
</template>
<script>
import {
getDeptTree,
getDictBatchByType
} from '@/api/system/dict.js'
import {
TaskApi
} from '@/api/task/index.js'
import {
InspectionsApi
} from '@/api/inspections/index.js'
import {
getUserList
} from '@/api/system/user.js'
export default {
import { getDeptTree, getDictBatchByType } from '@/api/system/dict.js'
import { TaskApi } from '@/api/task/index.js'
import { InspectionsApi } from '@/api/inspections/index.js'
import { getUserList } from '@/api/system/user.js'
export default {
data() {
return {
//
@ -199,10 +275,12 @@
list: [],
isSelect: ''
},
userList: [{
userList: [
{
value: '',
text: '按人员'
}],
}
],
//
dropOption: {
dept: [],
@ -233,21 +311,25 @@
},
methods: {
openFile(file) {
uni.downloadFile({
url: file.url,
success: function (res) {
var filePath = res.tempFilePath;
const filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {
console.log('打开文档成功');
fail(err) {
uni.showToast({
title: '文件打开失败',
icon: 'none'
})
}
});
})
},
fail(err) {
uni.showToast({ title: '文件下载失败', icon: 'none' })
}
});
})
},
getOptionOffset() {
const query = uni.createSelectorQuery().in(this)
@ -276,7 +358,8 @@
dept: dept.data
}
this.dropOption = {
dept: [{
dept: [
{
value: '',
text: '按部门'
},
@ -287,7 +370,8 @@
}
})
],
status: [{
status: [
{
value: '',
text: '按状态'
},
@ -364,9 +448,7 @@
icon: 'loading'
})
this.load = 'loading'
const {
data
} = await InspectionsApi.getList({
const { data } = await InspectionsApi.getList({
...this.queryParams,
taskId: this.detail.id
})
@ -379,11 +461,10 @@
uni.stopPullDownRefresh()
uni.hideToast()
},
getUserOption({
detail
}) {
getUserOption({ detail }) {
this.getUser().then(res => {
this.userList = [{
this.userList = [
{
value: '',
text: '按人员'
},
@ -476,11 +557,11 @@
})
}
}
}
}
</script>
<style lang="scss" scoped>
.detail-container {
.detail-container {
position: relative;
color: $cs-color-grey;
@ -508,24 +589,25 @@
.file-list {
border-radius: 4px;
background: var(--LightMode-Grey-Grey-100, #F9F9F9);
background: var(--LightMode-Grey-Grey-100, #f9f9f9);
padding: 8rpx 16rpx;
display: flex;
flex-wrap: wrap;
gap: 24rpx;
width: 100%;
.file {
display: flex;
flex-flow:row nowarp;
gap:8rpx;
flex-flow: row nowarp;
gap: 8rpx;
cursor: pointer;
align-items: center;
.name {
color: var(--LightMode-Grey-Grey-900, #071437);
font-family: "PingFang SC";
font-size: 24rpx;
font-family: 'PingFang SC';
font-size: 26rpx;
font-style: normal;
font-weight: 400;
line-height: normal;
line-height: 160%;
text-decoration-line: underline;
text-decoration-style: solid;
text-decoration-skip-ink: auto;
@ -688,18 +770,20 @@
top: 0;
width: 30px;
height: 30px;
background-image: linear-gradient(45deg,
background-image: linear-gradient(
45deg,
rgba(255, 255, 255, 0) 50%,
var(--select-color, #f1f1f4) 50%);
var(--select-color, #f1f1f4) 50%
);
display: flex;
justify-content: flex-end;
align-items: flex-start;
}
}
}
}
}
.options-container {
.options-container {
overflow: hidden;
margin: 12px;
border-radius: 8px;
@ -727,14 +811,14 @@
}
}
}
}
}
.isTop {
.isTop {
margin: 12px 0;
border-radius: 0px;
}
}
::v-deep .u-popup__content {
::v-deep .u-popup__content {
border-radius: 32rpx;
}
}
</style>
Loading…
Cancel
Save