1、发布信息页面的同意协议可以取消同意
3、修改发布信息的页面:同意协议可以取消同意;上传图片的组件的新上传图片和删除的方法调整 4、s-uploader组件的上传图片的组件的新上传图片和删除的方法跟随修改发布信息相关逻辑进行调整 5、收藏页面的可查看列表的详情 6、隐藏商城的收藏和客服
This commit is contained in:
parent
fea492042f
commit
b88707b245
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<s-layout title="修改发布信息" :bgStyle="{ color: '#f7f7f7' }">
|
<s-layout title="修改发布信息" :bgStyle="{ color: '#f7f7f7' }">
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view class="backImg flex flex-column align-items">
|
<scroll-view scroll-y="true" class="backImg flex flex-column align-items">
|
||||||
<view class="scroll-container box flex flex-column align-items">
|
<view class="scroll-container box flex flex-column align-items">
|
||||||
<view class="first flex flex-column align-items justify-start" style="padding: 30rpx;">
|
<view class="first flex flex-column align-items justify-start" style="padding: 30rpx;">
|
||||||
<view class="row flex align-items" style="padding: 0 30rpx;">
|
<view class="row flex align-items" style="padding: 0 30rpx;">
|
||||||
@ -78,8 +78,10 @@
|
|||||||
placeholder="请输入你的招标详细信息"></textarea>
|
placeholder="请输入你的招标详细信息"></textarea>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 图片 -->
|
<!-- 图片 :value="state.formData.images" @success="handleUploadSuccess" @del-file="handleDelFile"
|
||||||
<s-uploader v-model:url="state.formData.images" fileMediatype="image" limit="9" mode="grid"
|
v-model:url="state.formData.images"-->
|
||||||
|
<s-uploader ref="uploaderRef" :url="state.formData.images" @success="handleUploadSuccess"
|
||||||
|
@delete="handleDelFile" fileMediatype="image" limit="9" mode="grid"
|
||||||
:imageStyles="{ width: '168rpx', height: '168rpx'}"></s-uploader>
|
:imageStyles="{ width: '168rpx', height: '168rpx'}"></s-uploader>
|
||||||
</view>
|
</view>
|
||||||
<span class="line-row" style="margin: 30rpx 0;"></span>
|
<span class="line-row" style="margin: 30rpx 0;"></span>
|
||||||
@ -112,7 +114,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="checkedLabel" style="margin-top: 26rpx;" v-if="selectTagslist.length != 0">
|
<view class="checkedLabel" style="margin-top: 26rpx;" v-if="selectTagslist.length != 0">
|
||||||
<view class="tagLab" v-for="(item, index) in selectTagslist" :key="index" style="">
|
<view class="tagLab" v-for="(item, index) in selectTagslist" :key="index" style="">
|
||||||
<view>
|
<view style="font-size: 24rpx;line-height: 22rpx;color: #F76100;">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</view>
|
</view>
|
||||||
<view style="height: 30rpx;width: 1rpx;background-color: #f76100;margin: 0 20rpx;">
|
<view style="height: 30rpx;width: 1rpx;background-color: #f76100;margin: 0 20rpx;">
|
||||||
@ -129,18 +131,20 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
<view style="height: 370rpx;width: 100%;color: #f7f7f7;"></view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view style="height: 200rpx;width: 100%;color: #f7f7f7;"></view>
|
</scroll-view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<view class="bottomBtn">
|
<view class="bottomBtn">
|
||||||
<view style="margin:30rpx 0 0 0;display: flex;align-items: center;justify-content: center;">
|
<view style="margin:30rpx 0 0 0;display: flex;align-items: center;justify-content: center;">
|
||||||
<view v-if="agreeAdd == false" style="width: 31rpx;height: 32rpx;
|
<view v-if="agreeAdd == false" style="width: 31rpx;height: 32rpx;
|
||||||
border: 2rpx solid #999999;border-radius: 50%;" @click="show = true"></view>
|
border: 2rpx solid #999999;border-radius: 50%;" @click="show = true"></view>
|
||||||
<image v-if="agreeAdd == true" style="width: 32rpx;height: 32rpx;"
|
<image v-if="agreeAdd == true" style="width: 32rpx;height: 32rpx;"
|
||||||
src="https://jiangxiaoxian.0rui.cn/fbxySelected.png"></image>
|
src="https://jiangxiaoxian.0rui.cn/fbxySelected.png" @click="agreeAdd = false"></image>
|
||||||
<view style="font-size: 22rpx;line-height: 31rpx;color: #9C9C9C;display: flex;
|
<view style="font-size: 22rpx;line-height: 31rpx;color: #9C9C9C;display: flex;
|
||||||
justify-content: center;align-items: center;margin-left: 20rpx;" @click="show = true">我已阅读并同意
|
justify-content: center;align-items: center;margin-left: 20rpx;" @click="show = true">我已阅读并同意
|
||||||
<view style="margin-left: 20rpx;color: #FCC74E;">《发布须知》</view>
|
<view style="margin-left: 20rpx;color: #FCC74E;">《发布须知》</view>
|
||||||
@ -321,14 +325,26 @@
|
|||||||
const status = ref(0)
|
const status = ref(0)
|
||||||
const rentEditId = ref(0)
|
const rentEditId = ref(0)
|
||||||
|
|
||||||
|
const tagList = ref([])
|
||||||
|
const showPopbq = ref(false)
|
||||||
|
const tagShowList = ref([])
|
||||||
|
const selectTagslist = ref([]); //已选择标签
|
||||||
|
const tagSelectedNum = ref(0)
|
||||||
|
const typeList = ref([])
|
||||||
|
const typeShowList = ref([])
|
||||||
|
const showType = ref(false)
|
||||||
|
const typeIndex = ref(0); //已选择项目类型
|
||||||
|
// 定义上传组件的引用
|
||||||
|
const uploaderRef = ref(null); // 与标签上的 ref 名称对应
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
getFbKnow();
|
getFbKnow();
|
||||||
getTagList();
|
getTagList();
|
||||||
getTypeList();
|
// getTypeList();
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
rentEditId.value = options.id
|
rentEditId.value = options.id
|
||||||
console.log('编辑接参ID', rentEditId.value);
|
console.log('编辑接参ID', rentEditId.value);
|
||||||
getDetail()
|
// getDetail()
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -386,6 +402,7 @@
|
|||||||
const res = await sheep.$api.rent.tagsList({});
|
const res = await sheep.$api.rent.tagsList({});
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
tagList.value = res.data.list
|
tagList.value = res.data.list
|
||||||
|
console.log('getTagList', tagList.value);
|
||||||
tagShowList.value = tagList.value.map(({
|
tagShowList.value = tagList.value.map(({
|
||||||
name,
|
name,
|
||||||
id
|
id
|
||||||
@ -393,15 +410,16 @@
|
|||||||
name,
|
name,
|
||||||
id
|
id
|
||||||
}));
|
}));
|
||||||
|
console.log('getTagList222', tagList.value);
|
||||||
tagShowList.value.forEach(item => {
|
tagShowList.value.forEach(item => {
|
||||||
item.isSelect = false;
|
item.isSelect = false;
|
||||||
})
|
})
|
||||||
console.log('tagList', tagList.value, tagShowList.value);
|
console.log('tagList', tagList.value, tagShowList.value);
|
||||||
|
getTypeList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const typeList = ref([])
|
|
||||||
const typeShowList = ref([])
|
|
||||||
async function getTypeList() {
|
async function getTypeList() {
|
||||||
const res = await sheep.$api.rent.listType({});
|
const res = await sheep.$api.rent.listType({});
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
@ -410,13 +428,14 @@
|
|||||||
|
|
||||||
typeShowList.value = Object.values(typeList.value)
|
typeShowList.value = Object.values(typeList.value)
|
||||||
console.log('typeList', typeList.value, typeShowList.value);
|
console.log('typeList', typeList.value, typeShowList.value);
|
||||||
|
if (rentEditId.value) {
|
||||||
|
getDetail()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//项目类型
|
//项目类型
|
||||||
const showType = ref(false)
|
|
||||||
const typeIndex = ref(0); //已选择项目类型
|
|
||||||
function closeType() {
|
function closeType() {
|
||||||
console.log('取消type', typeIndex.value);
|
console.log('取消type', typeIndex.value);
|
||||||
showType.value = false
|
showType.value = false
|
||||||
@ -436,12 +455,6 @@
|
|||||||
|
|
||||||
|
|
||||||
//标签
|
//标签
|
||||||
const showPopbq = ref(false)
|
|
||||||
const tagList = ref([])
|
|
||||||
const tagShowList = ref([])
|
|
||||||
const selectTagslist = ref([]); //已选择标签
|
|
||||||
const tagSelectedNum = ref(0)
|
|
||||||
|
|
||||||
function openPopbq() {
|
function openPopbq() {
|
||||||
showPopbq.value = true;
|
showPopbq.value = true;
|
||||||
}
|
}
|
||||||
@ -512,14 +525,15 @@
|
|||||||
|
|
||||||
//详情
|
//详情
|
||||||
function getDetail() {
|
function getDetail() {
|
||||||
console.log('详情1',tagList.value);
|
console.log('详情1', tagList.value, uni.getStorageSync('tagList'));
|
||||||
if (tagList.value.length == 0) {
|
if (tagList.value.length == 0) {
|
||||||
tagList.value = uni.getStorageInfoSync('tagList');
|
console.log('详情-tagList.value.length == 0', tagList.value, uni.getStorageSync('tagList'));
|
||||||
|
tagList.value = uni.getStorageSync('tagList');
|
||||||
tagShowList.value = tagList.value
|
tagShowList.value = tagList.value
|
||||||
}
|
}
|
||||||
console.log('详情', tagList.value, tagShowList.value);
|
console.log('详情', tagList.value, tagShowList.value);
|
||||||
if (typeList.value.length == 0) {
|
if (typeList.value.length == 0) {
|
||||||
typeList.value = uni.getStorageInfoSync('typeList');
|
typeList.value = uni.getStorageSync('typeList');
|
||||||
}
|
}
|
||||||
sheep.$api.rent.rentInfo(rentEditId.value).then((res) => {
|
sheep.$api.rent.rentInfo(rentEditId.value).then((res) => {
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
@ -535,6 +549,7 @@
|
|||||||
form.value.typeName = form.value.type_text
|
form.value.typeName = form.value.type_text
|
||||||
typeIndex.value = typeShowList.value.findIndex(item => item == form.value.type_text)
|
typeIndex.value = typeShowList.value.findIndex(item => item == form.value.type_text)
|
||||||
state.formData.images = form.value.images
|
state.formData.images = form.value.images
|
||||||
|
console.log('form.value.images', form.value.images);
|
||||||
const arr2Names = selectTagslist.value.map(item => item.name);
|
const arr2Names = selectTagslist.value.map(item => item.name);
|
||||||
tagShowList.value.forEach(item => {
|
tagShowList.value.forEach(item => {
|
||||||
if (arr2Names.includes(item.name)) {
|
if (arr2Names.includes(item.name)) {
|
||||||
@ -546,6 +561,25 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//上传图片成功
|
||||||
|
const handleUploadSuccess = (res) => {
|
||||||
|
console.log('handleUploadSuccess', res.tempFilePaths);
|
||||||
|
// res.tempFilePaths 是新上传的临时路径数组
|
||||||
|
// const newImages = res.tempFilePaths.map(url => ({ url })); // 转为对象数组
|
||||||
|
// 合并原有图片和新图片(去重可选)
|
||||||
|
state.formData.images.push(...res.tempFilePaths);
|
||||||
|
};
|
||||||
|
// rentEdit.vue 中添加删除处理
|
||||||
|
const handleDelFile = (newList) => {
|
||||||
|
console.log('newList', newList);
|
||||||
|
var newListA = state.formData.images;
|
||||||
|
// // // 从数组中移除对应索引的图片
|
||||||
|
newListA.splice(newList.delIndex, 1);
|
||||||
|
state.formData.images =newListA;
|
||||||
|
//console.log('newList', state.formData.images);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
async function apply() {
|
async function apply() {
|
||||||
if (agreeAdd.value == false) {
|
if (agreeAdd.value == false) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -558,6 +592,7 @@
|
|||||||
console.log('cate_ids', form.value.cate_ids, state.formData.images);
|
console.log('cate_ids', form.value.cate_ids, state.formData.images);
|
||||||
|
|
||||||
form.value.images = state.formData.images.join(',');
|
form.value.images = state.formData.images.join(',');
|
||||||
|
// form.value.images = state.formData.images.map(item => item.url).join(',');
|
||||||
console.log('images', form.value.images);
|
console.log('images', form.value.images);
|
||||||
|
|
||||||
if (form.value.title == '') {
|
if (form.value.title == '') {
|
||||||
@ -638,6 +673,7 @@
|
|||||||
console.log('修改成功');
|
console.log('修改成功');
|
||||||
agreeAdd.value = false;
|
agreeAdd.value = false;
|
||||||
selectTagslist.value = []
|
selectTagslist.value = []
|
||||||
|
tagSelectedNum.value = 0;
|
||||||
form.value = {
|
form.value = {
|
||||||
title: '',
|
title: '',
|
||||||
area: '',
|
area: '',
|
||||||
@ -654,7 +690,16 @@
|
|||||||
cateName: '',
|
cateName: '',
|
||||||
imageList: [],
|
imageList: [],
|
||||||
}
|
}
|
||||||
state.formData.images = []
|
state.formData.images = [];
|
||||||
|
state.imageFiles = []
|
||||||
|
console.log('state.formData.images', state.formData.images, uploaderRef.value);
|
||||||
|
// 2. 清空上传组件内部缓存(关键步骤)
|
||||||
|
if (uploaderRef.value) { // 确保组件实例存在
|
||||||
|
uploaderRef.value.clearFiles(); // 调用组件内置的清空方法
|
||||||
|
}
|
||||||
|
|
||||||
|
state.currentCityIndex = [0, 0]
|
||||||
|
console.log('currentCityIndex', state.currentCityIndex);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
@ -663,6 +708,11 @@
|
|||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -726,10 +776,10 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.tagLab {
|
.tagLab {
|
||||||
width: 197rpx;
|
width: 182rpx;
|
||||||
height: 30rpx;
|
height: 30rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 8rpx;
|
||||||
margin-bottom: 20rpx;
|
margin-top: 20rpx;
|
||||||
// display: grid;
|
// display: grid;
|
||||||
// box-sizing: border-box;
|
// box-sizing: border-box;
|
||||||
// column-gap: 20rpx;
|
// column-gap: 20rpx;
|
||||||
@ -747,7 +797,7 @@
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
.backImg {
|
.backImg {
|
||||||
height: 90vh;
|
height: 78vh;
|
||||||
// background: linear-gradient(to bottom, #F1F2F8 0%, #F1F2F8 50%, #FFFFFF 100%);
|
// background: linear-gradient(to bottom, #F1F2F8 0%, #F1F2F8 50%, #FFFFFF 100%);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<su-fixed bottom placeholder bg="bg-white">
|
<su-fixed bottom placeholder bg="bg-white">
|
||||||
<view class="ui-tabbar-box">
|
<view class="ui-tabbar-box">
|
||||||
<view class="ui-tabbar ss-flex ss-col-center ss-row-between">
|
<view class="ui-tabbar ss-flex ss-col-center ss-row-between">
|
||||||
<view
|
<!-- <view
|
||||||
v-if="collectIcon"
|
v-if="collectIcon"
|
||||||
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||||
@tap="onFavorite"
|
@tap="onFavorite"
|
||||||
@ -35,7 +35,7 @@
|
|||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
></image>
|
></image>
|
||||||
<view class="item-title">客服</view>
|
<view class="item-title">客服</view>
|
||||||
</view>
|
</view>-->
|
||||||
<view
|
<view
|
||||||
v-if="shareIcon"
|
v-if="shareIcon"
|
||||||
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
class="detail-tabbar-item ss-flex ss-flex-col ss-row-center ss-col-center"
|
||||||
|
@ -134,7 +134,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- <view class="width:100%;height:200rpx"></view> -->
|
<!-- <view class="width:100%;height:200rpx"></view> -->
|
||||||
<view style="height: 370rpx;width: 100%;color: #f7f7f7;"></view>
|
<view style="height: 200rpx;width: 100%;color: #f7f7f7;"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +147,7 @@
|
|||||||
<view v-if="agreeAdd == false" style="width: 31rpx;height: 32rpx;
|
<view v-if="agreeAdd == false" style="width: 31rpx;height: 32rpx;
|
||||||
border: 2rpx solid #999999;border-radius: 50%;" @click="show = true"></view>
|
border: 2rpx solid #999999;border-radius: 50%;" @click="show = true"></view>
|
||||||
<image v-if="agreeAdd == true" style="width: 32rpx;height: 32rpx;"
|
<image v-if="agreeAdd == true" style="width: 32rpx;height: 32rpx;"
|
||||||
src="https://jiangxiaoxian.0rui.cn/fbxySelected.png"></image>
|
src="https://jiangxiaoxian.0rui.cn/fbxySelected.png" @click="agreeAdd = false"></image>
|
||||||
<view style="font-size: 22rpx;line-height: 31rpx;color: #9C9C9C;display: flex;
|
<view style="font-size: 22rpx;line-height: 31rpx;color: #9C9C9C;display: flex;
|
||||||
justify-content: center;align-items: center;margin-left: 20rpx;" @click="show = true">我已阅读并同意
|
justify-content: center;align-items: center;margin-left: 20rpx;" @click="show = true">我已阅读并同意
|
||||||
<view style="margin-left: 6rpx;color: #FCC74E;font-size: 22rpx;line-height: 31rpx;">《发布须知》
|
<view style="margin-left: 6rpx;color: #FCC74E;font-size: 22rpx;line-height: 31rpx;">《发布须知》
|
||||||
@ -694,6 +694,7 @@
|
|||||||
console.log('发布成功');
|
console.log('发布成功');
|
||||||
agreeAdd.value = false;
|
agreeAdd.value = false;
|
||||||
selectTagslist.value = []
|
selectTagslist.value = []
|
||||||
|
tagSelectedNum.value = 0;
|
||||||
form.value = {
|
form.value = {
|
||||||
title: '',
|
title: '',
|
||||||
area: '',
|
area: '',
|
||||||
@ -724,6 +725,11 @@
|
|||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
url: '/pages/index/user'
|
url: '/pages/index/user'
|
||||||
})
|
})
|
||||||
|
}else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'error'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!-- 食堂招租 -->
|
<!-- 食堂招租 -->
|
||||||
<view class="recommend-box" v-if="currentTab == 0">
|
<view class="recommend-box" v-if="currentTab == 0">
|
||||||
<view class="rrecommList" v-for="(item,index) in collectRentList" :key="index">
|
<view class="rrecommList" v-for="(item,index) in collectRentList" :key="index" @click="toDetail(item)">
|
||||||
<view class="reListItem">
|
<view class="reListItem">
|
||||||
<!-- 左侧图片 -->
|
<!-- 左侧图片 -->
|
||||||
<view class="listItem-images">
|
<view class="listItem-images">
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<!-- 平台课程 -->
|
<!-- 平台课程 -->
|
||||||
<view class="exChangeBox" v-if="currentTab == 1">
|
<view class="exChangeBox" v-if="currentTab == 1">
|
||||||
<view class="couponsList">
|
<view class="couponsList">
|
||||||
<view class="list-item" v-for="(item,index) in collectSchoolList" :key="index">
|
<view class="list-item" v-for="(item,index) in collectSchoolList" :key="index" @click="toDetail(item)">
|
||||||
<image style="width: 330rpx;height: 200rpx;border-radius: 18rpx 18rpx 0 0;"
|
<image style="width: 330rpx;height: 200rpx;border-radius: 18rpx 18rpx 0 0;"
|
||||||
:src="item.image">
|
:src="item.image">
|
||||||
</image>
|
</image>
|
||||||
@ -342,6 +342,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toDetail(e) {
|
||||||
|
console.log('跳转详情', e,currentTab.value);
|
||||||
|
if(currentTab.value == 0) {
|
||||||
|
console.log('收藏-招租');
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/canteenRent/rentDetail?id=' + e.id
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
console.log('收藏-课程');
|
||||||
|
uni.navigateTo({
|
||||||
|
url:'/pages/school/classesDetail?id=' + e.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
onReachBottom(() => {});
|
onReachBottom(() => {});
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
getRentList();
|
getRentList();
|
||||||
|
@ -7,18 +7,9 @@
|
|||||||
<view v-if="subtitle" class="file-subtitle">
|
<view v-if="subtitle" class="file-subtitle">
|
||||||
<view>{{ subtitle }}</view>
|
<view>{{ subtitle }}</view>
|
||||||
</view>
|
</view>
|
||||||
<upload-image
|
<upload-image v-if="fileMediatype === 'image' && showType === 'grid'" :readonly="readonly"
|
||||||
v-if="fileMediatype === 'image' && showType === 'grid'"
|
:image-styles="imageStyles" :files-list="url" :limit="limitLength" :disablePreview="disablePreview"
|
||||||
:readonly="readonly"
|
:delIcon="delIcon" @uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
|
||||||
:image-styles="imageStyles"
|
|
||||||
:files-list="url"
|
|
||||||
:limit="limitLength"
|
|
||||||
:disablePreview="disablePreview"
|
|
||||||
:delIcon="delIcon"
|
|
||||||
@uploadFiles="uploadFiles"
|
|
||||||
@choose="choose"
|
|
||||||
@delFile="delFile"
|
|
||||||
>
|
|
||||||
<slot>
|
<slot>
|
||||||
<view class="is-add">
|
<view class="is-add">
|
||||||
<!-- <image :src="imgsrc" class="add-icon"></image> -->
|
<!-- <image :src="imgsrc" class="add-icon"></image> -->
|
||||||
@ -28,24 +19,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
</upload-image>
|
</upload-image>
|
||||||
<upload-file
|
<upload-file v-if="fileMediatype !== 'image' || showType !== 'grid'" :readonly="readonly"
|
||||||
v-if="fileMediatype !== 'image' || showType !== 'grid'"
|
:list-styles="listStyles" :files-list="filesList" :showType="showType" :delIcon="delIcon"
|
||||||
:readonly="readonly"
|
@uploadFiles="uploadFiles" @choose="choose" @delFile="delFile">
|
||||||
:list-styles="listStyles"
|
|
||||||
:files-list="filesList"
|
|
||||||
:showType="showType"
|
|
||||||
:delIcon="delIcon"
|
|
||||||
@uploadFiles="uploadFiles"
|
|
||||||
@choose="choose"
|
|
||||||
@delFile="delFile"
|
|
||||||
>
|
|
||||||
<slot><button type="primary" size="mini">选择文件</button></slot>
|
<slot><button type="primary" size="mini">选择文件</button></slot>
|
||||||
</upload-file>
|
</upload-file>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { chooseAndUploadFile, uploadCloudFiles } from './choose-and-upload-file.js';
|
import {
|
||||||
|
chooseAndUploadFile,
|
||||||
|
uploadCloudFiles
|
||||||
|
} from './choose-and-upload-file.js';
|
||||||
import {
|
import {
|
||||||
get_file_ext,
|
get_file_ext,
|
||||||
get_extname,
|
get_extname,
|
||||||
@ -56,7 +42,9 @@
|
|||||||
import uploadImage from './upload-image.vue';
|
import uploadImage from './upload-image.vue';
|
||||||
import uploadFile from './upload-file.vue';
|
import uploadFile from './upload-file.vue';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
import { isEmpty } from 'lodash';
|
import {
|
||||||
|
isEmpty
|
||||||
|
} from 'lodash';
|
||||||
|
|
||||||
let fileInput = null;
|
let fileInput = null;
|
||||||
/**
|
/**
|
||||||
@ -297,6 +285,8 @@
|
|||||||
return this.uploadFiles(files);
|
return this.uploadFiles(files);
|
||||||
},
|
},
|
||||||
async setValue(newVal, oldVal) {
|
async setValue(newVal, oldVal) {
|
||||||
|
console.log('初始化或更新组件的内部数据',newVal);
|
||||||
|
console.log('初始化或更新组件的内部数据',oldVal);
|
||||||
const newData = async (v) => {
|
const newData = async (v) => {
|
||||||
const reg = /cloud:\/\/([\w.]+\/?)\S*/;
|
const reg = /cloud:\/\/([\w.]+\/?)\S*/;
|
||||||
let url = '';
|
let url = '';
|
||||||
@ -394,7 +384,10 @@
|
|||||||
this.files = [];
|
this.files = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
let { filePaths, files } = get_files_and_is_max(res, _extname);
|
let {
|
||||||
|
filePaths,
|
||||||
|
files
|
||||||
|
} = get_files_and_is_max(res, _extname);
|
||||||
if (!(_extname && _extname.length > 0)) {
|
if (!(_extname && _extname.length > 0)) {
|
||||||
filePaths = res.tempFilePaths;
|
filePaths = res.tempFilePaths;
|
||||||
files = res.tempFiles;
|
files = res.tempFiles;
|
||||||
@ -527,15 +520,19 @@
|
|||||||
* @param {Object} index
|
* @param {Object} index
|
||||||
*/
|
*/
|
||||||
delFile(index) {
|
delFile(index) {
|
||||||
|
console.log('s-uploader——delFile',index,this.files);
|
||||||
if (!isEmpty(this.files)) {
|
if (!isEmpty(this.files)) {
|
||||||
|
console.log('s-uploader——!isEmpty',index,this.files);
|
||||||
this.$emit('delete', {
|
this.$emit('delete', {
|
||||||
tempFile: this.files[index],
|
tempFile: this.files[index],
|
||||||
tempFilePath: this.files[index].url,
|
tempFilePath: this.files[index].url,
|
||||||
});
|
});
|
||||||
this.files.splice(index, 1);
|
this.files.splice(index, 1);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('s-uploader——!isEmpty',index,this.files);
|
||||||
this.$emit('delete', {
|
this.$emit('delete', {
|
||||||
tempFilePath: this.url,
|
tempFilePath: this.url,
|
||||||
|
delIndex:index
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,10 +668,12 @@
|
|||||||
color: #3D3D3D;
|
color: #3D3D3D;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.add-icon {
|
.add-icon {
|
||||||
width: 57rpx;
|
width: 57rpx;
|
||||||
height: 49rpx;
|
height: 49rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-subtitle {
|
.file-subtitle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
@ -153,6 +153,13 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getImageUrl(url) {
|
getImageUrl(url) {
|
||||||
|
console.log('getImageUrl', url);
|
||||||
|
// 若URL已包含http/https,直接返回(不处理)
|
||||||
|
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||||
|
return url;
|
||||||
|
}else {
|
||||||
|
return sheep.$url.cdn(url);
|
||||||
|
}
|
||||||
if ('blob:http:' === url.substr(0, 10)) {
|
if ('blob:http:' === url.substr(0, 10)) {
|
||||||
return url;
|
return url;
|
||||||
} else {
|
} else {
|
||||||
@ -166,6 +173,7 @@
|
|||||||
this.$emit('choose');
|
this.$emit('choose');
|
||||||
},
|
},
|
||||||
delFile(index) {
|
delFile(index) {
|
||||||
|
console.log('uploader-image——delFile');
|
||||||
this.$emit('delFile', index);
|
this.$emit('delFile', index);
|
||||||
},
|
},
|
||||||
previewImage(img, index) {
|
previewImage(img, index) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user