Commit 9c5cd8be authored by Mac's avatar Mac

修改

parent 38e2ca79
...@@ -238,12 +238,12 @@ ...@@ -238,12 +238,12 @@
</view> </view>
</view> </view>
<view class="box_conent_basic" v-if="detailsData && detailsData.ListState==3"> <view class="box_conent_basic" v-if="detailsData && detailsData.ListState==3 && detailsData.RankList.length>0">
<view class="box_conent_basic_img"> <view class="box_conent_basic_img">
<view class="box_conent_basic_img_t">评比结果</view> <view class="box_conent_basic_img_t">评比结果</view>
</view> </view>
<view class="box_conent_basic_c" style="padding: 0 5px;" v-if="detailsData"> <view class="box_conent_basic_c" style="padding: 0 5px;" v-if="detailsData">
<view v-for="(x,y) in RankList" :key='y' class="box_c_b_c_item"> <view v-for="(x,y) in detailsData.RankList" :key='y' class="box_c_b_c_item" @click="goxiangqin(x)">
<view class="cbc_item_l"> <view class="cbc_item_l">
<view v-if="detailsData.EnableRank==1" class="cbc_item_l"> <view v-if="detailsData.EnableRank==1" class="cbc_item_l">
<image v-if="y==0" src='https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/bdbando.png' style="width: 100%;height: 100%;"></image> <image v-if="y==0" src='https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/bdbando.png' style="width: 100%;height: 100%;"></image>
...@@ -319,6 +319,12 @@ ...@@ -319,6 +319,12 @@
<view class="cans_c_l">{{item.CompData.Name}}:</view> <view class="cans_c_l">{{item.CompData.Name}}:</view>
<view class="cans_c_r">{{getDorpDownData(item.CompData.OptionValue,item.CompData.OptionList)}}</view> <view class="cans_c_r">{{getDorpDownData(item.CompData.OptionValue,item.CompData.OptionList)}}</view>
</view> </view>
<view class="cans_c" style="display: flex;align-items: flex-start;width: 100%;" v-if="item.CompKey=='CommonUploadComp' && item.CompData.FileList && item.CompData.FileList.length>0">
<view class="cans_c_l">{{item.CompData.Name}}:</view>
<view class="cans_c_r">
<view v-for="(src, sindex) in item.CompData.FileListName">{{src}}</view>
</view>
</view>
</view> </view>
<view class="btn_bm" v-if="detailsData.ListState==1" @click="goeditsignUp(x)">编辑</view> <view class="btn_bm" v-if="detailsData.ListState==1" @click="goeditsignUp(x)">编辑</view>
...@@ -404,6 +410,7 @@ ...@@ -404,6 +410,7 @@
if(this.detailsData.EnrollList && this.detailsData.EnrollList.length>0){ if(this.detailsData.EnrollList && this.detailsData.EnrollList.length>0){
this.detailsData.EnrollList.forEach(x=>{ this.detailsData.EnrollList.forEach(x=>{
x.Content = JSON.parse(x.Content) x.Content = JSON.parse(x.Content)
}) })
} }
...@@ -446,7 +453,7 @@ ...@@ -446,7 +453,7 @@
}); });
}, },
getDorpDownData(value,list){ getDorpDownData(value,list){
console.log(data,'split')
let data = value.toString().split(',') let data = value.toString().split(',')
let text = '' let text = ''
...@@ -465,6 +472,19 @@ ...@@ -465,6 +472,19 @@
}) })
return text return text
}, },
goxiangqin(item){//点击放榜列表 进入详情
if(item.ObjectType==1){//品牌
uni.navigateTo({
url:"/pages/kotra/brand/detail?id="+item.ObjectId
})
}else if(item.ObjectType==2){//载体
uni.navigateTo({
url:"/pages/kotra/carrier/detail?id="+item.ObjectId
})
}
}
} }
} }
......
<template>
<view class="u-upload" v-if="!disabled">
<view v-if="showUploadList" class="u-list-item u-preview-wrap" v-for="(item, index) in lists" :key="index" :style="{
width: width + 'rpx',
height: width + 'rpx'
}">
<view v-if="deletable" class="u-delete-icon" @tap.stop="deleteItem(index)">
<u-icon class="u-icon" name="cross" size="20" color="#ffffff"></u-icon>
</view>
<u-line-progress v-if="showProgress && item.progress > 0 && !item.error" :show-percent="false" height="16" class="u-progress" :percent="item.progress"></u-line-progress>
<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
<image @tap.stop="doPreviewImage(item.url || item.path, index)" class="u-preview-image" v-if="!item.isImage" :src=" item.url || item.path "
:mode="imageMode"></image>
</view>
<slot name="file" :file="lists"></slot>
<view style="display: inline-block;" @tap="selectFile" v-if="maxCount > lists.length">
<slot name="addBtn"></slot>
<view v-if="!customBtn" class="u-list-item u-add-wrap" hover-class="u-add-wrap__hover" hover-stay-time="150" :style="{
width: width + 'rpx',
height: width + 'rpx'
}">
<u-icon name="plus" class="u-add-btn" size="40"></u-icon>
<view class="u-add-tips">{{uploadText}}</view>
</view>
</view>
</view>
</template>
<script>
/**
* upload 图片上传
* @description 该组件用于上传图片场景
* @tutorial https://www.uviewui.com/components/upload.html
* @property {String} action 服务器上传地址
* @property {String Number} max-count 最大选择图片的数量(默认99)
* @property {Boolean} custom-btn 如果需要自定义选择图片的按钮,设置为true(默认false)
* @property {Boolean} show-progress 是否显示进度条(默认true)
* @property {Boolean} disabled 是否启用(显示/移仓)组件(默认false)
* @property {String} image-mode 预览图片等显示模式,可选值为uni的image的mode属性值(默认aspectFill)
* @property {Object} header 上传携带的头信息,对象形式
* @property {Object} form-data 上传额外携带的参数
* @property {String} name 上传文件的字段名,供后端获取使用(默认file)
* @property {Array<String>} size-type original 原图,compressed 压缩图,默认二者都有(默认['original', 'compressed'])
* @property {Array<String>} source-type 选择图片的来源,album-从相册选图,camera-使用相机,默认二者都有(默认['album', 'camera'])
* @property {Boolean} preview-full-image 是否可以通过uni.previewImage预览已选择的图片(默认true)
* @property {Boolean} multiple 是否开启图片多选,部分安卓机型不支持(默认true)
* @property {Boolean} deletable 是否显示删除图片的按钮(默认true)
* @property {String Number} max-size 选择单个文件的最大大小,单位B(byte),默认不限制(默认Number.MAX_VALUE)
* @property {Array<Object>} file-list 默认显示的图片列表,数组元素为对象,必须提供url属性
* @property {Boolean} upload-text 选择图片按钮的提示文字(默认“选择图片”)
* @property {Boolean} auto-upload 选择完图片是否自动上传,见上方说明(默认true)
* @property {Boolean} show-tips 特殊情况下是否自动提示toast,见上方说明(默认true)
* @property {Boolean} show-upload-list 是否显示组件内部的图片预览(默认true)
* @event {Function} on-oversize 图片大小超出最大允许大小
* @event {Function} on-preview 全屏预览图片时触发
* @event {Function} on-remove 移除图片时触发
* @event {Function} on-success 图片上传成功时触发
* @event {Function} on-change 图片上传后,无论成功或者失败都会触发
* @event {Function} on-error 图片上传失败时触发
* @event {Function} on-progress 图片上传过程中的进度变化过程触发
* @event {Function} on-uploaded 所有图片上传完毕触发
* @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
* @example <u-upload :action="action" :file-list="fileList" ></u-upload>
*/
export default {
name: 'u-upload',
props: {
//是否显示组件自带的图片预览功能
showUploadList: {
type: Boolean,
default: true
},
// 后端地址
action: {
type: String,
default: ''
},
// 最大上传数量
maxCount: {
type: [String, Number],
default: 52
},
// 是否显示进度条
showProgress: {
type: Boolean,
default: true
},
// 是否启用
disabled: {
type: Boolean,
default: false
},
// 预览上传的图片时的裁剪模式,和image组件mode属性一致
imageMode: {
type: String,
default: 'aspectFill'
},
// 头部信息
header: {
type: Object,
default () {
return {}
}
},
// 额外携带的参数
formData: {
type: Object,
default () {
return {}
}
},
// 上传的文件字段名
name: {
type: String,
default: 'file'
},
// 所选的图片的尺寸, 可选值为original compressed
sizeType: {
type: Array,
default () {
return ['original', 'compressed']
}
},
sourceType: {
type: Array,
default () {
return ['album', 'camera']
}
},
// 是否在点击预览图后展示全屏图片预览
previewFullImage: {
type: Boolean,
default: true
},
// 是否开启图片多选,部分安卓机型不支持
multiple: {
type: Boolean,
default: true
},
// 是否展示删除按钮
deletable: {
type: Boolean,
default: true
},
// 文件大小限制,单位为byte
maxSize: {
type: [String, Number],
default: Number.MAX_VALUE
},
// 显示已上传的文件列表
fileList: {
type: Array,
default () {
return []
}
},
// 上传区域的提示文字
uploadText: {
type: String,
default: '选择图片'
},
// 是否自动上传
autoUpload: {
type: Boolean,
default: true
},
// 是否显示toast消息提示
showTips: {
type: Boolean,
default: true
},
// 是否通过slot自定义传入选择图标的按钮
customBtn: {
type: Boolean,
default: false
},
// 内部预览图片区域和选择图片按钮的区域宽度,高等于宽
width: {
type: [String, Number],
default: 200
}
},
mounted() {
},
data() {
return {
lists: [],
isInCount: true,
uploading: false
}
},
watch: {
fileList: {
immediate: true,
handler(val) {
val.map(value => {
this.lists.push({url: value.url, error: false, progress: 100});
})
}
},
},
methods: {
// 清除列表
clear() {
this.lists = [];
// 如果是清空形式的话,发出"on-list-change"事件
this.$emit('on-list-change', this.lists);
},
// 重新上传队列中上传失败的所有文件
reUpload() {
this.uploadFile();
},
// 选择图片
selectFile() {
if (this.disabled) return;
const {
name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType
} = this;
let chooseFile = null;
const newMaxCount = maxCount - lists.length;
// 设置为只选择图片的时候使用 chooseImage 来实现
chooseFile = new Promise((resolve, reject) => {
uni.chooseImage({
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
sourceType: sourceType,
sizeType,
success: resolve,
fail: reject
});
});
chooseFile
.then((res) => {
let file = null;
let listOldLength = this.lists.length;
res.tempFiles.map((val, index) => {
// 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
if (!multiple && index >= 1) return;
if(val.size< (2*1024*1024)){
uni.showToast({
title:'图片不能小于2M',
icon:'none'
})
}else if (val.size > maxSize) {
this.$emit('on-oversize', val, this.lists);
this.showToast('超出允许的文件大小');
} else {
if(maxCount <= lists.length) {
this.$emit('on-exceed', val, this.lists);
this.showToast('超出最大允许的文件个数');
return ;
}
lists.push({
url: val.path,
progress: 0,
error: false
});
// 列表发生改变,发出事件,第二个参数为当前发生变化的项的索引
this.$emit('on-list-change', this.lists);
}
})
// 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
this.$emit('on-choose-complete', this.lists);
if(this.autoUpload) this.uploadFile(listOldLength);
})
.catch(error => {
// this.$emit('on-error', error);
});
},
// 提示用户消息
showToast(message, force = false) {
if(this.showTips || force) {
uni.showToast({
title: message,
icon: "none"
});
}
},
// 该方法供用户通过ref调用,手动上传
upload() {
this.uploadFile();
},
// 对失败的图片重新上传
retry(index) {
this.lists[index].progress = 0;
this.lists[index].error = false;
this.lists[index].response = null;
uni.showLoading({
title: '重新上传'
});
this.uploadFile(index);
},
// 上传图片
uploadFile(index = 0) {
if (this.disabled) return;
if(this.uploading) return ;
// 全部上传完成
if (index >= this.lists.length) {
this.$emit('on-uploaded', this.lists);
return ;
}
// 检查上传地址
if (!this.action) {
this.showToast('请配置上传地址', true);
return;
}
// 检查是否是已上传或者正在上传中
if (this.lists[index].progress == 100) {
if(this.autoUpload == false) this.uploadFile(index + 1);
return;
}
this.lists[index].error = false;
this.uploading = true;
// 创建上传对象
// uni.compressImage({
// src: this.lists[index].url,
// quality: 80,
// success: res => {
// console.log(res)
const task = uni.uploadFile({
url: this.action,
filePath: this.lists[index].url,
name: this.name,
formData: this.formData,
header: this.header,
success: (res) => {
if (res.statusCode != 200) {
this.uploadError(index, res.data);
} else {
// 上传成功
this.lists[index].response = res.data;
this.lists[index].progress = 100;
this.lists[index].error = false;
this.$emit('on-success', res.data, index, this.lists);
}
},
fail: (e) => {
this.uploadError(index, e);
},
complete: (res) => {
uni.hideLoading();
this.uploading = false;
this.uploadFile(index + 1);
this.$emit('on-change', res, index, this.lists);
}
});
task.onProgressUpdate((res) => {
if (res.progress > 0) {
this.lists[index].progress = res.progress;
this.$emit('on-progress', res, index, this.lists);
}
});
// }
// })
},
// 上传失败
uploadError(index, err) {
this.lists[index].progress = 0;
this.lists[index].error = true;
this.lists[index].response = null;
this.$emit('on-error', err, index, this.lists);
this.showToast('上传失败,请重试');
},
// 删除一个图片
deleteItem(index) {
uni.showModal({
title: '提示',
content: '您确定要删除此项吗?',
success: res => {
if (res.confirm) {
if (this.lists[index].process < 100 && this.lists[index].process > 0) {
typeof this.lists[index].uploadTask != 'undefined' && this.lists[index].uploadTask.abort();
}
this.lists.splice(index, 1);
this.$forceUpdate();
this.$emit('on-remove', index, this.lists);
this.showToast('移除成功');
// 列表发生改变,发出事件
this.$emit('on-list-change', this.lists);
}
}
});
},
// 用户通过ref手动的形式,移除一张图片
remove(index) {
// 判断索引的合法范围
if(index >= 0 && index < this.lists.length) {
this.lists.splice(index, 1);
this.$emit('on-list-change', this.lists);
}
},
// 预览图片
doPreviewImage(url, index) {
if (!this.previewFullImage)
return;
const images = this.lists.map(item => item.url || item.path);
uni.previewImage({
urls: images,
current: url,
success: () => {
this.$emit('on-preview', url, this.lists);
},
fail: () => {
uni.showToast({
title: '预览图片失败',
icon: 'none'
});
}
});
}
}
}
</script>
<style lang="scss" scoped>
.u-upload {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.u-list-item {
width: 200rpx;
height: 200rpx;
overflow: hidden;
margin: 10rpx;
background: rgb(244, 245, 246);
position: relative;
border-radius: 10rpx;
display: inline-flex;
align-items: center;
justify-content: center;
}
.u-preview-wrap {
border: 1px solid rgb(235, 236, 238);
}
.u-add-wrap {
flex-direction: column;
color: $u-content-color;
font-size: 28rpx;
}
.u-add-tips {
margin-top: 20rpx;
}
.u-add-wrap__hover {
background-color: rgb(235, 236, 238);
}
.u-preview-image {
display: block;
width: 100%;
height: 100%;
}
.u-delete-icon {
position: absolute;
top: 10rpx;
right: 10rpx;
z-index: 10;
background-color: $u-type-error;
border-radius: 100rpx;
width: 44rpx;
height: 44rpx;
display: flex;
align-items: center;
justify-content: center;
}
.u-icon {
display: flex;
align-items: center;
justify-content: center;
}
.u-progress {
position: absolute;
bottom: 10rpx;
left: 8rpx;
right: 8rpx;
z-index: 9;
width: auto;
}
.u-error-btn {
color: #FFFFFF;
background-color: $u-type-error;
font-size: 20rpx;
padding: 4px 0;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
right: 0;
z-index: 9;
line-height: 1;
}
</style>
...@@ -62,8 +62,10 @@ ...@@ -62,8 +62,10 @@
@success="datasuccess()"></selectChoice> @success="datasuccess()"></selectChoice>
<pictureUpload v-if="item.CompKey=='ImageUploadComp'" :CompData="item.CompData" :index='index' <pictureUpload v-if="item.CompKey=='ImageUploadComp'" :CompData="item.CompData" :index='index'
@success="datasuccess()"></pictureUpload> @success="datasuccess()"></pictureUpload>
<videoUpload v-if="item.CompKey=='VideoUploadComp'" :CompData="item.CompData" :index='index' @enlarge='enlarge()' <videoUpload v-if="item.CompKey=='VideoUploadComp'" :CompData="item.CompData" :index='index'
@success="datasuccess()"></videoUpload> @success="datasuccess()"></videoUpload>
<fileType v-if="item.CompKey=='CommonUploadComp'" :CompData="item.CompData" :index='index'
@success="datasuccess()"></fileType>
</template> </template>
<view class="btn" @click="setapply()"> <view class="btn" @click="setapply()">
提交申请 提交申请
...@@ -86,6 +88,7 @@ ...@@ -86,6 +88,7 @@
import selectChoice from "./plugin/selectChoice" import selectChoice from "./plugin/selectChoice"
import pictureUpload from "./plugin/pictureUpload" import pictureUpload from "./plugin/pictureUpload"
import videoUpload from "./plugin/videoUpload" import videoUpload from "./plugin/videoUpload"
import fileType from "./plugin/fileType"
export default { export default {
components: { components: {
...@@ -94,6 +97,7 @@ ...@@ -94,6 +97,7 @@
selectChoice, selectChoice,
pictureUpload, pictureUpload,
videoUpload, videoUpload,
fileType
}, },
data() { data() {
...@@ -271,10 +275,10 @@ ...@@ -271,10 +275,10 @@
}, },
datasuccess(data, index) { datasuccess(data, index) {
this.dataList[index].CompData = data this.dataList[index].CompData = data
console.log(data)
}, },
setapply() { setapply() {
console.log('提交', this.dataList)
let show = false let show = false
//验证必填 //验证必填
if(this.addMsg.ObjectId==0 || this.addMsg.ObjectId==null || this.addMsg.ObjectId==''){ if(this.addMsg.ObjectId==0 || this.addMsg.ObjectId==null || this.addMsg.ObjectId==''){
......
<template>
<view>
<view class="single_Phone">
<span style="color:red;margin-right:5rpx;" v-show="CompData.IsRequire">*</span>{{CompData.Name}}
</view>
<view class="fliebox" v-for="(x,y) in CompData.FileListName" :key='y'>
<view class="fliebox_l">{{x}}</view>
<view class="fliebox_r">
<u-icon name="cross" color="#909399" size="36" @click='getdelete(y)'></u-icon>
</view>
</view>
<u-button type="primary" size='mini' @click="xzfile">上传文件</u-button>
<view class="single_Remark" v-if="CompData.Remark">{{CompData.Remark}}</view>
</view>
</template>
<script>
export default {
props: ["CompData",'index'],
data() {
return {
action: '',
FileList:'',
}
},
created() {
this.FileList = JSON.parse((JSON.stringify(this.CompData.FileList)))
var newPath = "/korea/Test/Upload/";
this.action = this.UploadConfig().UploadUrl + "?fileSavePath=" + newPath;
if(this.CompData.FileListName==undefined){
this.CompData.FileListName = []
}
},
methods: {
getdelete(index){
this.CompData.FileList.splice(index,1)
this.CompData.FileListName.splice(index,1)
this.$emit('success', this.CompData, this.index)
},
xzfile(){
let that = this
wx.chooseMessageFile({
count: this.CompData.FileCount==0?9999999:this.CompData.FileCount,
type: 'file',
success (res) {
const tempFilePaths = res.tempFiles
let show = false
tempFilePaths.map((x,index)=>{//判断是否是文件
if(show == true){return}
if(x.type!='file'){
uni.showToast({
title:'请选择正确文件',
icon:'none'
})
show = true
}else{
if(that.CompData.FileType.indexOf(that.gethou(x.path))==-1){
uni.showToast({
title:'请选择正确文件',
icon:'none'
})
show = true
}else{
if(that.CompData.FileSizeLimit>0){//大于0 进入判断
let size = res.size
if(x.size>(that.CompData.FileSizeLimit*1024*1024)){
uni.showToast({
title:'文件超出指定大小',
icon:'none'
})
show = true
}else{
that.upFile(x.path,x.name)
}
}else{
that.upFile(x.path,x.name)
}
}
}
})
}
})
},
upFile(filePath,name) {
let action = this.action
let that = this
uni.uploadFile({
url: action,
filePath: filePath,
name: 'file',
formData: {
user: 'tesdt'
},
success: (uploadFileRes) => {
uni.hideLoading()
var jsonData=JSON.parse(uploadFileRes.data);
if (jsonData.StatusCode == 1) {
var url= that.UploadConfig().ImageUrl+ jsonData.FilePath;
that.CompData.FileList.push(url)
that.CompData.FileListName.push(name)
that.$emit('success', that.CompData, that.index)
}
},
fail: function(res) {
wx.showToast({
title: '上传失败!',
icon: 'none',
duration: 1000
})
}
});
},
gethou(filename){//获取后缀名
var index = filename.lastIndexOf(".");
var suffix = filename.substring(index+1);
return suffix
}
}
}
</script>
<style>
.slot-btn {
width: 220rpx;
height: 220rpx;
background: #F5F5F5;
border-radius: 17rpx;
display: flex;
align-items: center;
justify-content: center;
}
.slot-btn .image {
width: 54rpx;
height: auto;
}
.mmyVideo {
width: 100%;
height: 100%;
}
.fliebox{
width: 100%;
height: 30px;
padding: 0 10px;
border:1px solid #e2e2e2;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 4px;
font-size: 12px;
margin-bottom: 5px;
}
.fliebox_l{
width: 1px;
flex:1;
overflow: hidden;display: inline-block;white-space: nowrap; text-overflow:ellipsis;
}
.fliebox_r{
width: 36rpx;
}
</style>
...@@ -3,33 +3,33 @@ ...@@ -3,33 +3,33 @@
<view class="single_Phone"> <view class="single_Phone">
<span style="color:red;margin-right:5rpx;" v-show="CompData.IsRequire">*</span>{{CompData.Name}} <span style="color:red;margin-right:5rpx;" v-show="CompData.IsRequire">*</span>{{CompData.Name}}
</view> </view>
<u-upload ref="uUpload" :action="action" :show-tips="false" @on-remove="onRemove" <imgupload ref="uUpload" :action="action" :show-tips="false" @on-remove="onRemove"
@on-oversize="onversize" @on-oversize="onversize"
@on-exceed="onexceed" @on-exceed="onexceed"
:max-size="CompData.FileSizeLimit==0?99999* 1024 * 1024:CompData.FileSizeLimit * 1024 * 1024" :max-size="CompData.FileSizeLimit==0?99999* 1024 * 1024:CompData.FileSizeLimit * 1024 * 1024"
:max-count="CompData.FileCount==0?'999999':CompData.FileCount" :max-count="CompData.FileCount==0?'999999':CompData.FileCount"
:file-list="fileList" :file-list="fileList"
@on-success="uploadSuccessHandler" @on-success="uploadSuccessHandler"
></u-upload> ></imgupload>
<view style="width: 100%;height: 1px;background: #e2e2e2;"></view> <view style="width: 100%;height: 1px;background: #e2e2e2;"></view>
<view class="single_Remark" v-if="CompData.Remark">{{CompData.Remark}}</view> <view class="single_Remark" v-if="CompData.Remark">{{CompData.Remark}}</view>
</view> </view>
</template> </template>
<script> <script>
import imgupload from '../components/img-upload.vue'
export default { export default {
props: ["CompData",'index'], props: ["CompData",'index'],
components: { imgupload},
data(){ data(){
return{ return{
action: this.host2 + "/api/File/UploadTencent", action: '',
fileList:[], fileList:[],
} }
}, },
created() { created() {
let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId : 1; let MallBaseId = uni.getStorageSync("mall_UserInfo").MallBaseId ? uni.getStorageSync("mall_UserInfo").MallBaseId : 1;
// this.action = this.host2 + '/api/File/UploadTencent?MallBaseId=' + MallBaseId var newPath = "/korea/Test/Upload/";
var newPath = "/EduSystem/Test/Upload/";
this.action = this.UploadConfig().UploadUrl + "?fileSavePath=" + newPath; this.action = this.UploadConfig().UploadUrl + "?fileSavePath=" + newPath;
if(this.CompData.FileList.length>0){ if(this.CompData.FileList.length>0){
this.fileList=[] this.fileList=[]
...@@ -46,11 +46,9 @@ ...@@ -46,11 +46,9 @@
methods:{ methods:{
uploadSuccessHandler(data, index, lists) { uploadSuccessHandler(data, index, lists) {
let r = JSON.parse(data); let r = JSON.parse(data);
console.log(r,index,lists,'listslistslistslists')
var url= this.UploadConfig().ImageUrl+ r.FilePath; var url= this.UploadConfig().ImageUrl+ r.FilePath;
console.log(url) console.log(url)
this.CompData.FileList.push(url);
this.CompData.FileList.push(r.data);
this.$emit('success', this.CompData, this.index) this.$emit('success', this.CompData, this.index)
}, },
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
" @tap.stop="CompData.FileList.splice(y,1),FileList.splice(y,1)"> " @tap.stop="getdelete(y)">
<u-icon class="u-icon" name="cross" size="30" color="#ffffff"></u-icon> <u-icon class="u-icon" name="cross" size="30" color="#ffffff"></u-icon>
</view> </view>
...@@ -60,6 +60,11 @@ ...@@ -60,6 +60,11 @@
this.FileList = JSON.parse((JSON.stringify(this.CompData.FileList))) this.FileList = JSON.parse((JSON.stringify(this.CompData.FileList)))
}, },
methods: { methods: {
getdelete(index){
this.CompData.FileList.splice(index,1)
this.FileList.splice(index,1)
this.$emit('success', this.CompData, this.index)
},
enlarge(file) { enlarge(file) {
// 全屏 // 全屏
...@@ -106,7 +111,7 @@ ...@@ -106,7 +111,7 @@
}); });
}, },
upFile(filePath, type) { upFile(filePath, type) {
var newPath = "/EduSystem/Test/Upload/"; var newPath = "/korea/Test/Upload/";
let action = this.UploadConfig().UploadUrl + "?fileSavePath=" + newPath; let action = this.UploadConfig().UploadUrl + "?fileSavePath=" + newPath;
......
...@@ -8,10 +8,10 @@ export default { ...@@ -8,10 +8,10 @@ export default {
// Vue.prototype.host2 = "http://192.168.20.17:8014" // Vue.prototype.host2 = "http://192.168.20.17:8014"
// Vue.prototype.host2 = "http://192.168.20.17:8014" // Vue.prototype.host2 = "http://192.168.20.17:8014"
// Vue.prototype.host2 = "http://testmall.oytour.com/" // Vue.prototype.host2 = "http://testmall.oytour.com/"
Vue.prototype.UploadConfig = function() { Vue.prototype.UploadConfig = function() {//本地上传配置
return { return {
UploadUrl: "http://192.168.20.214:8120/Upload/AppUpload", UploadUrl:this.host2.indexOf('mallApi')!=-1 ? "https://upload.oytour.com/Upload/AppUpload":"http://192.168.20.214:8120/Upload/AppUpload",
ImageUrl: "http://192.168.20.214:8130" ImageUrl:this.host2.indexOf('mallApi')!=-1? "https://imgfile.oytour.com":"http://192.168.20.214:8130",
} }
} }
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
......
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