Commit 71b95ece by fengzhaoyu

权限 上传

parent e953b9b0
......@@ -186,7 +186,7 @@ export function uploadPermissions() {
})
}
// 文件预览
export function previewPermissions(fileIds) {
export function previewPermissions(fileIds) {
return $http({
method: 'get',
url: `/admin/ddOpenApi/getCustomSpaceAndGrantCustomSpace?type=download&ddUserId=${getApp().globalData.userid}&fileIds=${fileIds}`
......@@ -196,7 +196,7 @@ export function previewPermissions(fileIds) {
export function modifySchedule(data) {
return $http({
method: 'post',
data: JSON.stringify(data),
data: JSON.stringify(data),
url: `/meet/schedule/modifySchedule`
})
}
......@@ -204,7 +204,38 @@ export function modifySchedule(data) {
export function deleteSchedule(data) {
return $http({
method: 'post',
data: JSON.stringify(data),
data: JSON.stringify(data),
url: `/meet/schedule/deleteSchedule`
})
}
// 获取动态展示
export function getDynamic(data) {
return $http({
method: 'post',
data: JSON.stringify(data),
url: `/meet/meeting-log/list`
})
}
// 获取动态展示
export function saveFileInfo(data) {
return $http({
method: 'post',
data: JSON.stringify(data),
url: `/meet/schedule-accessory/save`
})
}
// 删除文件
export function delFile(data) {
return $http({
method: 'get',
url: `/meet/schedule-accessory/remove/${data}`
})
}
// 编辑文件
export function editFile(data) {
return $http({
method: 'post',
data: JSON.stringify(data),
url: `/meet/schedule-accessory/update`
})
}
\ No newline at end of file
{
"pages": [
"pages/index/index",
"pages/uploadFile/uploadFile",
"pages/repetitionTime/repetitionTime",
"pages/repeatMechanism/repeatMechanism",
"pages/attendingSituation/attendingSituation",
......@@ -9,9 +10,7 @@
"pages/remind/remind",
"pages/scheduleDetail/scheduleDetail",
"pages/place/place",
"pages/participantsDetail/participantsDetail"
],
"window": {
"defaultTitle": "My App"
}
"pages/participantsDetail/participantsDetail",
"pages/editFile/editFile"
]
}
......@@ -153,29 +153,29 @@
</view>
</view>
<!-- 编辑列表 -->
<view class="editList" a:if="{{!!scheduleItem?(organizer==permissions?true:false):true}}">
<view a:if="{{!locationName}}" class="listGroup" onTap="editSchedule" data-icon="icondingwei">
<view class="editList">
<view a:if="{{!!scheduleItem?organizer==permissions&&!locationName:!locationName}}" class="listGroup" onTap="editSchedule" data-icon="icondingwei">
<view class="listIcon iconfont icondingwei">
</view>
<view class="listText">
地点
</view>
</view>
<view a:if="{{!aheadTimes.length}}" class="listGroup" onTap="editSchedule" data-icon="iconhuiqiantixing">
<view a:if="{{!!scheduleItem?!aheadTimes.length&&organizer==permissions:!aheadTimes.length}}" class="listGroup" onTap="editSchedule" data-icon="iconhuiqiantixing">
<view class="listIcon iconfont iconhuiqiantixing">
</view>
<view class="listText">
提醒
</view>
</view>
<view a:if="{{!repeatable&&!!scheduleItem}}" class="listGroup" onTap="editSchedule" data-icon="iconchongfu">
<view a:if="{{!repeatable&&!!scheduleItem&&organizer==permissions}}" class="listGroup" onTap="editSchedule" data-icon="iconchongfu">
<view class="listIcon iconfont iconchongfu">
</view>
<view class="listText">
重复
</view>
</view>
<view a:if="{{!remark&&!!scheduleItem}}" class="listGroup" onTap="editSchedule" data-icon="icondidianmiaoshu">
<view a:if="{{!remark&&!!scheduleItem&&organizer==permissions}}" class="listGroup" onTap="editSchedule" data-icon="icondidianmiaoshu">
<view class="listIcon iconfont icondidianmiaoshu">
</view>
<view class="listText">
......
......@@ -64,7 +64,7 @@ create.Page({
type: event.type,
permissions: getApp().globalData.userid,
repeatWeek: this.data.repeatWeek,
title:title
title: title
})
if (!!event.scheduleItem) {
let scheduleItem = JSON.parse(event.scheduleItem)
......@@ -333,13 +333,13 @@ create.Page({
}
break;
case 'icondidianmiaoshu':
this.store.data.remark = null
this.store.data.remark = ''
break;
case 'iconhuiqiantixing':
this.store.data.aheadTimes = []
break;
case 'icondingwei':
this.store.data.locationName = null
this.store.data.locationName = ''
break;
}
this.update()
......@@ -424,9 +424,17 @@ create.Page({
dd.navigateTo({ url: './../place/place' })
break;
case 'iconshanchu':
let identify = 'major'
if (!!this.data.scheduleItem) {
if (this.data.organizer == this.data.permissions) {
identify = 'major'
} else {
identify = 'secondary'
}
}
let data = {
scheduleId: this.data.scheduleItem.id,
identify: 'major',
identify: identify,
deleteModel: 'only'
}
dd.confirm({
......@@ -496,16 +504,12 @@ create.Page({
// 保存重复日程
saveRepeat(event) {
let modifyModel = ''
switch (event.detail.value) {
case '0':
modifyModel = 'only'
break;
case '1':
modifyModel = 'future'
break;
case '2':
modifyModel = 'all'
break;
if (event.detail.value == 0) {
modifyModel = 'only'
} else if (event.detail.value == 1) {
modifyModel = 'future'
} else {
modifyModel = 'all'
}
this.setData({
modifyModel: modifyModel
......@@ -515,17 +519,20 @@ create.Page({
// 删除重复日程
deleteRepeatSchedule(event) {
let deleteModel = ''
console.log(event.detail.value)
switch (event.detail.value) {
case '0':
deleteModel = 'only';
break;
case '1':
deleteModel = 'future';
break;
case '2':
deleteModel = 'all';
break;
let identify = 'major'
if (!!this.data.scheduleItem) {
if (this.data.organizer == this.data.permissions) {
identify = 'major'
} else {
identify = 'secondary'
}
}
if (event.detail.value == 0) {
deleteModel = 'only';
} else if (event.detail.value == 1) {
deleteModel = 'future';
} else {
deleteModel = 'all';
}
this.setData({
deleteModel: deleteModel
......@@ -533,7 +540,7 @@ create.Page({
let data = {
planDate: this.data.scheduleItem.planDate,
templateId: this.data.scheduleItem.scheduleTemplateId,
identify: 'major',
identify: identify,
deleteModel: deleteModel
}
deleteSchedule(data).then(res => {
......
@import "../../font/iconfont.acss";
page {
background: #fff;
font-family: PingFangSC-Regular;
font-size: 34rpx;
color: #191F25;
padding-bottom: 180rpx;
}
.fileList {
margin-top: 32rpx;
padding: 0 32rpx;
display: flex;
justify-content: space-between;
}
.file {
background: #F6F7F8;
border-radius: 2rpx;
width: 634rpx;
height: 88rpx;
line-height: 88rpx;
display: flex;
overflow: hidden;
}
.fileimage{
width: 60rpx;
height: 72rpx;
background: #3296Fa;
margin: 8rpx 16rpx 8rpx 8rpx;
}
.fileName {
font-size: 26rpx;
}
.close {
line-height: 88rpx;
font-size: 30rpx;
color: rgba(25, 31, 37, 0.40);
text-align: right;
}
.add {
padding: 0 32rpx;
margin-top: 40rpx;
}
.icontianjia {
line-height: 33rpx;
color: #3296fa;
margin-right: 16rpx;
}
.addText {
vertical-align: top;
font-size: 24rpx;
color: #3296FA;
}
.save {
padding: 32rpx 34rpx;
position: fixed;
bottom: 0;
}
.saveButton {
font-size: 36rpx;
width: 686rpx;
line-height: 96rpx;
text-align: center;
color: #fff;
background: #3296FA;
border: 1rpx solid rgba(25, 31, 37, 0.12);
border-radius: 48rpx;
}
\ No newline at end of file
<view class="uploadFile">
<view class="describe">
<textarea class="textarea" value="{{descript}}" onInput="inputDes" placeholder="添加文件描述..." maxlength="-1" />
</view>
<view class="save">
<view class="saveButton" onTap="save">
保存
</view>
</view>
</view>
\ No newline at end of file
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import { editFile } from '../../api/request.js'
create.Page({
store: exampleStore,
useAll: true,
data: {
descript: '',
fileInfos: ''
},
onLoad(event) {
dd.setNavigationBar({
title: '编辑文件'
})
this.setData({
fileInfos: JSON.parse(event.file),
descript: JSON.parse(event.file).descript
})
},
inputDes(event) {
let value = event.detail.value
this.setData({
descript: value
})
},
// 点击保存
save() {
let data = {
id: this.data.fileInfos.id,
uploader: getApp().globalData.userid,
uploaderInfo: JSON.stringify({
userId: getApp().globalData.userid,
username: getApp().globalData.name,
headUrl: getApp().globalData.avatar
}),
thirdStoreTenant: 'dingTalk',
fileInfos: JSON.stringify(this.data.fileInfos.fileInfos),
descript: this.data.descript
}
editFile(data).then(res => {
dd.navigateBack({
delta: 1
})
})
}
});
{}
\ No newline at end of file
<!-- <mw-select></mw-select> -->
版本号:90版
<scroll-view a:if="{{todayStr !== ''}}" scroll-y="{{true}}" upper-threshold="50" lower-threshold="50" onScrollToLower="lower" style="height: 100vh;" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}">
......
......@@ -37,7 +37,7 @@ page {
border-radius: 50%;
}
.headImg image {
vertical-align: middle;
vertical-align: top;
width: 64rpx;
height: 64rpx;
border-radius: 50%;
......
......@@ -4,6 +4,7 @@ page {
font-family: PingFangSC-Regular;
font-size: 34rpx;
color: #191F25;
padding-bottom: 180rpx;
}
::-webkit-scrollbar {
......@@ -74,11 +75,13 @@ page {
background: #3296Fa;
margin-right: 16rpx;
}
.imageGroup image {
vertical-align: top;
width: 58rpx;
height: 58rpx;
border-radius: 50%;
}
}
.number {
margin-right: 16rpx;
......@@ -136,13 +139,96 @@ page {
margin-left: 4rpx;
}
.tip {
.dynamicDetail {
background: #fff;
overflow: hidden;
padding: 48rpx 32rpx;
}
.latestTip {
text-align: center;
margin-top: 48rpx;
font-size: 24rpx;
font-size: 26rpx;
color: rgba(25, 31, 37, 0.56);
}
.dynamicList {
display: flex;
margin-top: 32rpx;
}
.dynamicleft {
text-align: center;
color: #fff;
font-size: 30rpx;
width: 58rpx;
margin-right: 16rpx;
height: 58rpx;
line-height: 58rpx;
border-radius: 50%;
background: #3296FA;
vertical-align: top;
}
.dynamicleft>image, .dynamicleft>text {
display: inline-block;
flex: 0 0 58rpx;
vertical-align: top;
width: 58rpx;
height: 58rpx;
border-radius: 50%;
background: #3296FA;
}
.dynamicMinutes>text {
margin-right: 10rpx;
font-size: 26rpx;
color: rgba(25, 31, 37, 0.40);
line-height: 37rpx;
}
.dynamicDetail .describe {
font-size: 26rpx;
line-height: 37rpx;
margin-top: 8rpx;
}
.file {
width: 612rpx;
padding-right: 8rpx;
height: 88rpx;
line-height: 88rpx;
background: #F6F7F8;
border-radius: 2px;
margin-top: 16rpx;
border-bottom: 1rpx solid transparent;
display: flex;
position: relative;
}
.fileImage {
width: 60rpx;
flex: 0 0 60rpx;
height: 72rpx;
margin: 8rpx 37rpx 8rpx 8rpx;
background: url(../../assests/all.png) center /100% 100%;
}
.fileName {
padding-right: 8rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 26rpx;
}
.otherTip {
text-align: center;
font-size: 26rpx;
color: rgba(25, 31, 37, 0.40);
line-height: 37rpx;
margin-top: 32rpx;
}
.bottom {
width: 686rpx;
display: flex;
......@@ -178,6 +264,42 @@ page {
line-height: 44rpx;
}
.modFile {
padding: 0;
display: flex;
color: white;
height: 57rpx;
border-radius: 6px;
background: rgba(0, 0, 0, 0.8);
position: absolute;
top: -73rpx;
left: 50%;
}
.modFile>view {
width: 95rpx;
line-height: 57rpx;
text-align: center;
font-size: 26rpx;
}
.ediFile {
border-right: 1rpx solid #fff;
}
.modFile .triangle {
position: absolute;
bottom: -28rpx;
width: 0;
left: 50%;
margin-left: -16rpx;
height: 0;
border-top: 16rpx solid rgba(0, 0, 0, 0.8);
border-bottom: 16rpx solid rgba(0, 0, 0, 0);
border-right: 16rpx solid rgba(0, 0, 0, 0);
border-left: 16rpx solid rgba(0, 0, 0, 0);
}
.participatorStaus {
width: 20rpx;
height: 20rpx;
......@@ -195,11 +317,50 @@ page {
.cancel {
background: #E60012;
}
.blank {
width: 650rpx;
overflow-x: scroll;
white-space: nowrap;
}
.blank>text {
margin-right: 10rpx;
}
.pdf {
background: url(../../assests/pdf.png) center /100% 100%;
}
.image {
background: url(../../assests/image.png) center /100% 100%;
}
.docx {
background: url(../../assests/docx.png) center /100% 100%;
}
.mov {
background: url(../../assests/mp4.png) center /100% 100%;
}
.mp4 {
background: url(../../assests/mp4.png) center /100% 100%;
}
.ppt {
background: url(../../assests/ppt.png) center /100% 100%;
}
.pptx {
background: url(../../assests/ppt.png) center /100% 100%;
}
.pdf {
background: url(../../assests/pdf.png) center /100% 100%;
}
.xlsx {
background: url(../../assests/xlsx.png) center /100% 100%;
}
.zip {
background: url(../../assests/zip.png) center /100% 100%;
}
\ No newline at end of file
......@@ -21,10 +21,12 @@
<view class="icon iconshijian iconfont">
</view>
<view class="text" a:if="{{isAcrossDay}}">
{{`
${startTime.substring(5, 7)}月${startTime.substring(8, 10)}日 ${startTime.substring(11, 16)} 至
${endTime.substring(5, 7)}月${endTime.substring(8, 10)}日 ${endTime.substring(11, 16)}
`}}
<view>
{{`
${startTime.substring(5, 7)}月${startTime.substring(8, 10)}日 ${startTime.substring(11, 16)} 至
${endTime.substring(5, 7)}月${endTime.substring(8, 10)}日 ${endTime.substring(11, 16)}
`}}
</view>
</view>
<view class="text" a:else>
{{`${startTime.substring(5, 7)}月${startTime.substring(8, 10)}日 ${week} ${startTime.substring(11, 16)}-${endTime.substring(11, 16)}`}}
......@@ -35,12 +37,12 @@
<view class="participants" onTap="nextPage" data-nextPage="participants">
<view class="icon iconcanhuiren1 iconfont">
</view>
<view class="scroll" v-if="{{!!userList.length}}" >
<view class="scroll" v-if="{{!!userList.length}}">
<text class="imageGroup" a:for="{{userList}}" a:for-item="item">
<text>
<image a:if="{{!!item.participator.headUrl}}" mode="scaleToFill" src="{{item.participator.headUrl}}"/>
<text a:else class="name">{{item.participator.username.substring(item.participator.username.length - 2, item.participator.username.length)}}</text>
<text a:if="{{!!item.participator.confirmAttendance}}" class="participatorStaus {{item.participator.confirmAttendance==1?'accept':'cancel'}} " ></text>
<text a:if="{{!!item.participator.confirmAttendance}}" class="participatorStaus {{item.participator.confirmAttendance==1?'accept':'cancel'}} "></text>
</text>
</text>
</view>
......@@ -70,7 +72,7 @@
<view class="icon iconhuiyimiaoshu iconfont">
</view>
<view class="text">
{{remark}}
{{remark}}
</view>
</view>
<!-- 会议动态 -->
......@@ -85,10 +87,54 @@
<text class="icontianjia iconfont"></text>
</view>
</view>
<!-- 动态展示 -->
<view class="tip">
李文 修改了会议 2月12日 12:10
<!-- 动态详情展示 -->
<view class="dynamicDetail">
<view class="latestTip">
李文 修改了会议 2月12日 12:10
</view>
<view class="dynamicList" a:for="{{allFileInfo}}">
<view class="dynamicleft">
<image a:if="{{!!item.uploaderInfo.headUrl}}" mode="scaleToFill" src="{{item.uploaderInfo.headUrl}}"/>
<text a:else>{{item.uploaderInfo.username.substring(0,1)}}</text>
</view>
<view class="dynamicright">
<view class="dynamicMinutes">
<text>{{item.username}}</text>
<text>5分钟前</text>
</view>
<view class="describe" a:if="{{!!item.descript}}">
{{item.descript}}
</view>
<view class="file" data-file="{{item2}}" onTap="preview" a:for="{{item.fileInfos}}" a:for-item="item2" onTouchStart="touchStart" onTouchEnd="touchEnd" onLongTap="longPress">
<view class="fileImage {{item2.fileType==('png' || 'jpg' || 'svg' || 'jpeg') ?'image': item2.fileType}}">
</view>
<view class="fileName">
{{item2.fileName}}
</view>
<view class="modFile" a:if="{{organizer == pemissions?(item2.fileId == fileId):(item2.fileId == fileId&&item.uploaderInfo.userId==pemissions)}}">
<view class="ediFile" data-nextPage="editFile" catchTap="nextPage" data-file="{{item}}">
编辑
</view>
<view class="delFile" catchTap="delFile" data-file="{{item}}">
删除
</view>
<view class="triangle">
</view>
</view>
</view>
</view>
</view>
<view class="otherTip">
大鹏 将 海棠 添加到会议 17:03
</view>
<view class="otherTip">
大鹏 修改了会议 今天 16:14
</view>
<view class="otherTip">
大鹏 修改了会议 今天 16:14
</view>
</view>
<!-- 底部按钮 -->
<view class="bottom">
<view class="buttonGroup" data-nextPage="edit" onTap="nextPage">
<text class="icondidianmiaoshu iconfont"></text>
......
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import { deleteSchedule, getScheduleDetail, uploadPermissions, previewPermissions } from '../../api/request.js'
import { getDynamicTip, addSchedule, delFile, getDynamic, deleteSchedule, getScheduleDetail, uploadPermissions, previewPermissions } from '../../api/request.js'
create.Page({
store: exampleStore,
useAll: true,
......@@ -16,19 +16,27 @@ create.Page({
previewSpaceId: '',
scheduleItem: '',
planDate: '',
scheduleTemplateId: ''
allFileInfo: '',
scheduleTemplateId: '',
getDynamicTip: [],
fileId: '',
organizer: '',
pemissions: ''
},
onLoad(event) {
let scheduleItem = JSON.parse(event.scheduleItem)
this.setData({
scheduleItem: scheduleItem
scheduleItem: scheduleItem,
pemissions: getApp().globalData.userid
})
dd.setNavigationBar({
title: '会议详情'
})
},
onShow() {
this.setData({
fileId: ''
})
let data = {
id: this.data.scheduleItem.id,
planDate: this.data.scheduleItem.planDate,
......@@ -40,6 +48,7 @@ create.Page({
location: res.data.data.location,
startTime: res.data.data.startTime,
endTime: res.data.data.endTime,
organizer: res.data.data.organizer,
week: this.data.weeks[new Date(res.data.data.startTime).getDay() - 1]
})
this.store.data.userList = res.data.data.userList
......@@ -53,7 +62,19 @@ create.Page({
uploadSpaceId: res.data.data
})
})
// 获取动态详情
if (!!this.data.scheduleItem.id) {
this.showFile(this.data.scheduleItem.id)
} else {
let getId = {
scheduleTemplateId: this.data.scheduleItem.scheduleTemplateId,
planDate: this.data.scheduleItem.planDate,
createModel: 'auto'
}
addSchedule(getId).then(success => {
this.showFile(success.data.id)
})
}
},
// 是否跨天
acrossDay(time1, time2) {
......@@ -84,17 +105,11 @@ create.Page({
upload() {
const _that = this
dd.uploadAttachmentToDingTalk({
image: { multiple: true, compress: false, max: 9, spaceId: this.data.uploadSpaceId },
space: { spaceId: this.data.uploadSpaceId, isCopy: 1, max: 9 },
file: { spaceId: this.data.uploadSpaceId, max: 1 },
types: ["photo", "camera", "space"],//PC端仅支持["photo","file","space"]
image: { multiple: true, compress: true, max: 9, spaceId: _that.data.uploadSpaceId },
space: { spaceId: _that.data.uploadSpaceId, compress: true, isCopy: 1, max: 9 },
types: ["photo", "camera", "space"],
success: (res) => {
previewPermissions(res.data[0].fileId).then(success => {
_that.setData({
previewSpaceId: success.data.data
})
_that.preview(res.data[0].fileId, res.data[0].fileSize, res.data[0].fileType, res.data[0].fileName)
})
dd.navigateTo({ url: `./../uploadFile/uploadFile?scheduleItem=${JSON.stringify(_that.data.scheduleItem)}&upLoadInfo=${JSON.stringify(res)}` })
},
fail: (err) => {
dd.alert({
......@@ -103,6 +118,90 @@ create.Page({
}
})
},
// 文件预览
preview(event) {
const _that = this
let file = event.target.dataset.file
previewPermissions(file.fileId).then(res => {
_that.setData({
previewSpaceId: res.data.data
})
console.log(res.data.data)
dd.previewFileInDingTalk({
corpId: dd.corpId,
spaceId: _that.data.previewSpaceId,
fileId: file.fileId,
fileName: file.fileName,
fileSize: file.fileSize,
fileType: file.fileType
})
})
},
// 删除文件
delFile(event) {
const _that = this
this.setData({
fileId: ''
})
let data = event.target.dataset.file.id
dd.confirm({
title: '温馨提示',
content: '确认删除本次上传文件吗',
confirmButtonText: '确定',
cancelButtonText: '取消',
success: (success) => {
if (!!success.confirm) {
if (!!this.data.scheduleItem.id) {
delFile(data).then(res => {
_that.showFile(this.data.scheduleItem.id)
})
} else {
let getId = {
scheduleTemplateId: _that.data.scheduleItem.scheduleTemplateId,
planDate: _that.data.scheduleItem.planDate,
createModel: 'auto'
}
addSchedule(getId).then(success => {
delFile(data).then(res => {
_that.showFile(success.data.id)
})
})
}
}
}
})
},
// 展示文件动态信息
showFile(id) {
let data = {
scheduleId: id,
}
getDynamic(data).then(res => {
let allFileInfo = []
if (!!res.data.data) {
res.data.data.forEach((item, index) => {
if (!!item.scheduleAccessory) {
item.scheduleAccessory.fileInfos = JSON.parse(item.scheduleAccessory.fileInfos)
item.scheduleAccessory.uploaderInfo = JSON.parse(item.scheduleAccessory.uploaderInfo)
allFileInfo.push(item.scheduleAccessory)
}
})
}
this.setData({
allFileInfo: allFileInfo
})
})
},
touchStart(event) {
},
onTouchEnd(event) {
},
// 长按事件
longPress(event) {
this.setData({
fileId: event.target.dataset.file.fileId
})
},
// 跳转下一页
nextPage(event) {
switch (event.target.dataset.nextPage) {
......@@ -110,23 +209,14 @@ create.Page({
dd.navigateTo({ url: `./../attendingSituation/attendingSituation?userList=${JSON.stringify(this.store.data.userList)}` })
break;
case 'edit':
console.log(this.data.scheduleItem.id)
dd.navigateTo({ url: `./../createOrEditSchedule/createOrEditSchedule?scheduleItem=${JSON.stringify(this.data.scheduleItem)}` })
break;
case 'editFile':
this.setData({
fileId: ''
})
dd.navigateTo({ url: `./../editFile/editFile?file=${JSON.stringify(event.target.dataset.file)}` })
break;
}
},
// 预览文件
preview(fileId, fileSize, fileType, fileName) {
dd.previewFileInDingTalk({
corpId: dd.corpId,
spaceId: this.data.previewSpaceId,
fileId: fileId,
fileName: fileName,
fileSize: fileSize,
fileType: fileType
})
}
});
@import "../../font/iconfont.acss";
page {
background: #fff;
font-family: PingFangSC-Regular;
font-size: 34rpx;
color: #191F25;
padding-bottom: 180rpx;
}
.fileList {
margin-top: 32rpx;
padding: 0 32rpx;
display: flex;
justify-content: space-between;
}
.file {
background: #F6F7F8;
border-radius: 2rpx;
width: 634rpx;
height: 88rpx;
line-height: 88rpx;
display: flex;
overflow: hidden;
}
.fileimage {
flex: 0 0 58rpx;
width: 60rpx;
height: 72rpx;
background: url(../../assests/all.png) center /100% 100%;
margin: 8rpx 16rpx 8rpx 8rpx;
}
.fileName {
font-size: 26rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.close {
line-height: 88rpx;
font-size: 30rpx;
color: rgba(25, 31, 37, 0.40);
text-align: right;
}
.add {
padding: 0 32rpx;
margin-top: 40rpx;
}
.icontianjia {
line-height: 33rpx;
color: #3296fa;
margin-right: 16rpx;
}
.addText {
vertical-align: top;
font-size: 24rpx;
color: #3296FA;
}
.save {
padding: 32rpx 34rpx;
position: fixed;
bottom: 0;
}
.saveButton {
font-size: 36rpx;
width: 686rpx;
line-height: 96rpx;
text-align: center;
color: #fff;
background: #3296FA;
border: 1rpx solid rgba(25, 31, 37, 0.12);
border-radius: 48rpx;
}
.pdf {
background: url(../../assests/pdf.png) center /100% 100%;
}
.image {
background: url(../../assests/image.png) center /100% 100%;
}
.docx {
background: url(../../assests/docx.png) center /100% 100%;
}
.mov {
background: url(../../assests/mp4.png) center /100% 100%;
}
.mp4 {
background: url(../../assests/mp4.png) center /100% 100%;
}
.ppt {
background: url(../../assests/ppt.png) center /100% 100%;
}
.pptx {
background: url(../../assests/ppt.png) center /100% 100%;
}
.pdf {
background: url(../../assests/pdf.png) center /100% 100%;
}
.xlsx {
background: url(../../assests/xlsx.png) center /100% 100%;
}
.zip {
background: url(../../assests/zip.png) center /100% 100%;
}
\ No newline at end of file
<view class="uploadFile">
<view class="describe">
<textarea class="textarea" onInput="inputDes" placeholder="添加文件描述..." maxlength="-1" />
</view>
<view class="fileList" a:for="{{upLoadInfo.data}}">
<view class="file">
<view class="fileimage {{item.fileType==('png' || 'jpg' || 'svg' || 'jpeg' || 'JPG') ?'image': item.fileType}}">
</view>
<view class="fileName">
{{item.fileName}}
</view>
</view>
<view class="close iconshanchu iconfont" data-item="{{item}}" onTap="close">
</view>
</view>
<view class="add" onTap="add">
<text class="icontianjia iconfont"></text>
<text class="addText">继续添加</text>
</view>
<view class="save">
<view class="saveButton" onTap="save">
保存
</view>
</view>
</view>
\ No newline at end of file
import create from 'dd-store'
import exampleStore from '/stores/exampleStore'
import { saveFileInfo, addSchedule, uploadPermissions, previewPermissions } from '../../api/request.js'
create.Page({
store: exampleStore,
useAll: true,
data: {
scheduleItem: '',
upLoadInfo: '',
descript: '',
uploadSpaceId: ''
},
onLoad(event) {
let scheduleItem = JSON.parse(event.scheduleItem)
let upLoadInfo = JSON.parse(event.upLoadInfo)
this.setData({
scheduleItem: scheduleItem,
upLoadInfo: upLoadInfo
})
dd.setNavigationBar({
title: '上传文件'
})
},
onShow() {
},
inputDes(event) {
let value = event.detail.value
this.setData({
descript: value
})
},
close(event) {
let fileId = event.target.dataset.item.fileId
this.data.upLoadInfo.data.forEach((item, index) => {
if (item.fileId == fileId) {
this.data.upLoadInfo.data.splice(index, 1)
return
}
})
this.setData({
upLoadInfo: this.data.upLoadInfo
})
},
add() {
uploadPermissions().then(res => {
this.setData({
uploadSpaceId: res.data.data
})
const _that = this
dd.uploadAttachmentToDingTalk({
image: { multiple: true, compress: false, max: 9, spaceId: this.data.uploadSpaceId },
space: { spaceId: this.data.uploadSpaceId, max: 9 },
file: { spaceId: this.data.uploadSpaceId, max: 9 },
types: ["photo", "camera", "space"],//PC端仅支持["photo","file","space"]
success: (res) => {
_that.data.upLoadInfo.data.push(...res.data)
_that.setData({
upLoadInfo: _that.data.upLoadInfo
})
},
fail: (err) => {
}
})
})
},
// 点击保存
save() {
if (!!this.data.scheduleItem.id) {
this.saveUpload(this.data.scheduleItem.id)
} else {
let getId = {
scheduleTemplateId: this.data.scheduleItem.scheduleTemplateId,
planDate: this.data.scheduleItem.planDate,
createModel: 'auto'
}
addSchedule(getId).then(success => {
this.data.saveUpload(success.data.id)
})
}
},
// 保存的接口
saveUpload(id) {
let data = {
scheduleId: id,
uploader: getApp().globalData.userid,
uploaderInfo: JSON.stringify({
userId: getApp().globalData.userid,
username: getApp().globalData.name,
headUrl: getApp().globalData.avatar
}),
thirdStoreTenant: 'dingTalk',
fileInfos: JSON.stringify(this.data.upLoadInfo.data),
descript: this.data.descript
}
saveFileInfo(data).then(res => {
dd.navigateBack({
delta: 1
})
})
}
});
{}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment