| | |
| | | <template> |
| | | <view class="attachment-upload"> |
| | | <!-- 附件悬浮按钮 --> |
| | | <view |
| | | class="attachment-btn" |
| | | :style="{ |
| | | <view class="attachment-btn" :style="{ |
| | | right: position.right, |
| | | bottom: position.bottom, |
| | | backgroundColor: bgColor, |
| | | display: showButton ? 'flex' : 'none', |
| | | }" |
| | | @click="togglePopup" |
| | | > |
| | | }" @click="togglePopup"> |
| | | <text>附件</text> |
| | | <text class="badge" v-if="totalFileCount > 0">{{ totalFileCount }}</text> |
| | | </view> |
| | | |
| | | <!-- 附件弹层 --> |
| | | <uni-popup |
| | | ref="popup" |
| | | type="bottom" |
| | | :safe-area="false" |
| | | @change="onPopupChange" |
| | | > |
| | | <uni-popup ref="popup" type="bottom" :safe-area="false" @change="onPopupChange"> |
| | | <view class="attachment-popup"> |
| | | <!-- 弹层标题 --> |
| | | <view class="popup-header"> |
| | | <text class="title">附件管理</text> |
| | | <uni-icons |
| | | v-if="!readonly" |
| | | type="plus" |
| | | size="24" |
| | | :color="mainColor" |
| | | @click="chooseFile" |
| | | /> |
| | | <uni-icons v-if="!readonly" type="plus" size="24" :color="mainColor" @click="chooseFile" /> |
| | | <uni-icons type="close" size="24" color="#999" @click="closePopup" /> |
| | | </view> |
| | | |
| | | <!-- 标签页切换 --> |
| | | <view v-if="showGradeSlip" class="attachment-tabs"> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentTab === 'base' }" |
| | | @click="currentTab = 'base'" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentTab === 'base' }" @click="currentTab = 'base'"> |
| | | <text>基础附件</text> |
| | | </view> |
| | | <view |
| | | class="tab-item" |
| | | :class="{ active: currentTab === 'grade' }" |
| | | @click="currentTab = 'grade'" |
| | | > |
| | | <view class="tab-item" :class="{ active: currentTab === 'grade' }" @click="currentTab = 'grade'"> |
| | | <text>成绩单附件</text> |
| | | <text class="required-mark" v-if="isGradeRequired">*</text> |
| | | </view> |
| | |
| | | <scroll-view scroll-y class="file-list"> |
| | | <!-- 基础附件列表 --> |
| | | <template v-if="currentTab === 'base' || !showGradeSlip"> |
| | | <view |
| | | class="file-item" |
| | | v-for="(file, index) in baseFiles" |
| | | :key="'base-' + index" |
| | | > |
| | | <view class="file-item" v-for="(file, index) in baseFiles" :key="'base-' + index"> |
| | | <view class="file-icon" @click="previewFile(file)"> |
| | | <uni-icons |
| | | :type="getFileIcon(file.type)" |
| | | size="24" |
| | | :color="getFileColor(file.type)" |
| | | /> |
| | | <uni-icons :type="getFileIcon(file.type)" size="24" :color="getFileColor(file.type)" /> |
| | | </view> |
| | | <view class="file-info" @click="previewFile(file)"> |
| | | <text class="file-name">{{ file.originalFilename || file.name }}</text> |
| | |
| | | <text class="file-status" v-if="file.status === 'uploading'">上传中...</text> |
| | | <text class="file-status error" v-else-if="file.status === 'error'">上传失败</text> |
| | | </view> |
| | | <uni-icons |
| | | v-if="!readonly" |
| | | type="trash" |
| | | size="20" |
| | | color="#ff4d4f" |
| | | @click="(e) => removeFile('base', index, e)" |
| | | /> |
| | | <uni-icons v-if="!readonly" type="trash" size="20" color="#ff4d4f" |
| | | @click="(e) => removeFile('base', index, e)" /> |
| | | </view> |
| | | </template> |
| | | |
| | | <!-- 成绩单附件列表 --> |
| | | <template v-if="currentTab === 'grade' && showGradeSlip"> |
| | | <view |
| | | class="file-item" |
| | | v-for="(file, index) in gradeFiles" |
| | | :key="'grade-' + index" |
| | | > |
| | | <view class="file-item" v-for="(file, index) in gradeFiles" :key="'grade-' + index"> |
| | | <view class="file-icon" @click="previewFile(file)"> |
| | | <uni-icons |
| | | :type="getFileIcon(file.type)" |
| | | size="24" |
| | | :color="getFileColor(file.type)" |
| | | /> |
| | | <uni-icons :type="getFileIcon(file.type)" size="24" :color="getFileColor(file.type)" /> |
| | | </view> |
| | | <view class="file-info" @click="previewFile(file)"> |
| | | <text class="file-name">{{ file.originalFilename || file.name }}</text> |
| | |
| | | <text class="file-status" v-if="file.status === 'uploading'">上传中...</text> |
| | | <text class="file-status error" v-else-if="file.status === 'error'">上传失败</text> |
| | | </view> |
| | | <uni-icons |
| | | v-if="!readonly" |
| | | type="trash" |
| | | size="20" |
| | | color="#ff4d4f" |
| | | @click="(e) => removeFile('grade', index, e)" |
| | | /> |
| | | <uni-icons v-if="!readonly" type="trash" size="20" color="#ff4d4f" |
| | | @click="(e) => removeFile('grade', index, e)" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | </uni-popup> |
| | | |
| | | <!-- 文件选择器 --> |
| | | <uni-file-picker |
| | | ref="filePicker" |
| | | v-if="!readonly" |
| | | :auto-upload="false" |
| | | file-mediatype="all" |
| | | :limit="maxCount - currentFileList.length" |
| | | :image-styles="imageStyles" |
| | | @select="onFileSelect" |
| | | @delete="onFileDelete" |
| | | style="display: none" |
| | | /> |
| | | <uni-file-picker ref="filePicker" v-if="!readonly" :auto-upload="false" file-mediatype="all" |
| | | :limit="maxCount - currentFileList.length" :image-styles="imageStyles" @select="onFileSelect" |
| | | @delete="onFileDelete" style="display: none" /> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | |
| | | .uni-icons { |
| | | padding: 10rpx; |
| | | |
| | | &:active { |
| | | opacity: 0.7; |
| | | } |
| | |
| | | |
| | | .uni-icons { |
| | | padding: 10rpx; |
| | | |
| | | &:active { |
| | | opacity: 0.7; |
| | | } |