| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- <template>
- <view>
- <view>
- <button type="primary" :size="size" @click="chooseClick">上传文档</button>
- </view>
- <view class="file">
- <view class="fileSin" v-for="(item,index) in fileList" :key="index">
- <view class="left centerBox">
- <image src="./image/PDF.png" v-if="item.ext == 'pdf'"></image>
- <image src="./image/text.png" v-else-if="item.ext == 'text'"></image>
- <image src="./image/DOC.png" v-else-if="item.ext == 'doc' || item.ext == 'docx'"></image>
- <image src="./image/PDF.png" v-else-if="item.ext == 'png'"></image>
- <image src="./image/document_fill.png" v-else></image>
- </view>
- <view class="center">
- <text>55555555555555555555555555555555555555555555555555555555555555</text>
- </view>
- <view class="right centerBox">
- <image src="./image/dolc.png"></image>
- <image src="./image/del.png"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import http from '@/common/service/http.js'
- import {
- ACCESS_TOKEN,
- USER_NAME,
- USER_INFO
- } from "@/common/util/constants" // 拉取登录token,userName,userInfo
- export default {
- props: {
- size: {
- type: String,
- default: "mini"
- },
- fileList: {
- type: Array,
- default: () => []
- }
- },
- methods: {
- chooseClick() {
- let token = uni.getStorageSync(ACCESS_TOKEN)
- uni.chooseImage({
- success: (chooseImageRes) => {
- const tempFilePaths = chooseImageRes.tempFilePaths[0]
- // this.$emit('chooseClick')
- uni.uploadFile({
- // url: http.apiHosp + 'ibps/platform/v3/file/upload/mobile', //仅为示例,非真实的接口地址
- url: http.apiHosp + '/ibps/platform/v3/file/upload', //仅为示例,非真实的接口地址
- filePath: tempFilePaths,
- name: 'file',
- formData: {
- 'ext': '.jpg'
- },
- header: {
- 'X-Authorization-access_token': token,
- 'X-Authorization-systemid': ''
- },
- success: (uploadFileRes) => {
- }
- });
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .uploadBox {
- margin: 10rpx;
- }
- .file {
- .fileSin {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1rpx #e6e6e6 solid;
- margin: 10rpx;
- .left {
- width: 60rpx;
- height: 60rpx;
- margin-right: 10rpx;
- image {
- width: 50rpx;
- height: 50rpx;
- }
- }
- .center {
- width: calc(100% - 250);
- line-height: 60rpx;
- display: inline-block;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- text {
- font-size: 30rpx;
- color: #666666;
- }
- }
- .right {
- width: 120rpx;
- height: 60rpx;
- margin-left: 10rpx;
- image {
- margin-right: 10rpx;
- width: 30rpx;
- height: 30rpx;
- }
- }
- }
- }
- .centerBox {
- display: flex;
- justify-content: center;
- align-items: center;
- }
- </style>
|