联调完成
This commit is contained in:
+3
-2
@@ -3,5 +3,6 @@ ENV = 'development'
|
||||
# 'development'
|
||||
|
||||
# base api
|
||||
# VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
|
||||
VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
|
||||
VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
|
||||
# 苗扬
|
||||
# VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
|
||||
|
||||
+8
-6
@@ -7,8 +7,6 @@ import {
|
||||
|
||||
|
||||
export const uploadFile = (file, data) => {
|
||||
|
||||
|
||||
const url = '/plimg/fileUpload/stuMgrUploadImg';
|
||||
const base_url = get_base_url(url);
|
||||
const token = getToken();
|
||||
@@ -43,19 +41,23 @@ export const uploadFile = (file, data) => {
|
||||
|
||||
|
||||
// 对象存储预览 /traoss/tras3/show/{文件ID}
|
||||
export function previewFile(id,responseType = 'blob') {
|
||||
export function previewFile(id,responseType = 'arraybuffer') {
|
||||
const token = getToken();
|
||||
const header = {};
|
||||
const header = {
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
};
|
||||
if (token)
|
||||
header['summary'] = token
|
||||
let baseUrl = get_base_url();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `/traoss/tras3/show/${id}`,
|
||||
url: `${baseUrl}/traoss/tras3/show/${id}`,
|
||||
header,
|
||||
responseType,
|
||||
success(result) {
|
||||
resolve(result.data)
|
||||
let _blob = new Blob([result.data],{type:result.header['content-type'].split(';')[0]})
|
||||
resolve(_blob)
|
||||
},
|
||||
fail(error) {
|
||||
reject(new Error('Upload failed'));
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
height: 170rpx;
|
||||
float: left;
|
||||
position: relative;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
.img-box{
|
||||
width: 170rpx;
|
||||
height: 170rpx;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<image :src="imgUrlShow"></image>
|
||||
<image :src="imgUrlShow" fit="cover"></image>
|
||||
<!-- <image class="img" src="@/static/images/test/1.png"></image> -->
|
||||
</template>
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
getPreviewUrlBlob(id) {
|
||||
// this.imgUrlShow = '@/static/images/index/message_b.png'
|
||||
previewFile(id).then((res) => {
|
||||
console.log(res)
|
||||
this.imgUrlShow = URL.createObjectURL(res);
|
||||
// const reader = new FileReader();
|
||||
// reader.readAsDataURL(res)
|
||||
|
||||
Reference in New Issue
Block a user