|
|
|
<template>
|
|
|
|
<view class="editdabang-box">
|
|
|
|
<view class="edit-box">
|
|
|
|
<textarea v-model="content" placeholder="请在此输入文字..." />
|
|
|
|
</view>
|
|
|
|
<view class="upload-img-box acea-row row-middle">
|
|
|
|
<view class="pictrue" v-for="(item, uploadPicturesIndex) in uploadPictures"
|
|
|
|
:key="uploadPicturesIndex">
|
|
|
|
<image :src="item" mode="aspectFill"/>
|
|
|
|
<text class="reduce iconfont icon-guanbi1 font-color-red"
|
|
|
|
@click="uploadPictures.splice(uploadPicturesIndex, 1)"></text>
|
|
|
|
</view>
|
|
|
|
<view class="pictrue uploadBnt acea-row row-center-wrapper row-column" @tap="chooseImage">
|
|
|
|
<text class="iconfont icon-icon25201"></text>
|
|
|
|
<view>上传图片</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="isShow-box acea-row row-middle row-right">
|
|
|
|
<text>是否显示打卡内容:</text>
|
|
|
|
<switch checked @change="switchChange" color="#FDBF68" />
|
|
|
|
<text>{{isShow == 1 ? '显示' : '不显示'}}</text>
|
|
|
|
</view>
|
|
|
|
<view class="submit-btn" @click="submitClick()">发布</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { chooseImages } from "@/utils"
|
|
|
|
import { studyListPublish } from "@/api/knowledge"
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
// VueCoreImageUpload
|
|
|
|
},
|
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
isShow: 1,
|
|
|
|
studyId: '',
|
|
|
|
uploadPictures: [],
|
|
|
|
content: "",
|
|
|
|
unique: ""
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad(){
|
|
|
|
this.studyId = this.$yroute.query.id;
|
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
switchChange(e){
|
|
|
|
this.isShow = e.target.value ? 1 : 0
|
|
|
|
},
|
|
|
|
chooseImage() {
|
|
|
|
chooseImages(img => {
|
|
|
|
console.log(img)
|
|
|
|
this.uploadPictures.push(img);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submitClick(){
|
|
|
|
if(this.content == ''){
|
|
|
|
uni.showToast({
|
|
|
|
title: '请填写分享内容',
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
return
|
|
|
|
}
|
|
|
|
let data = {
|
|
|
|
content: this.content,
|
|
|
|
imgPaths: this.uploadPictures,
|
|
|
|
studylistId: this.studyId,
|
|
|
|
isShow: this.isShow
|
|
|
|
}
|
|
|
|
studyListPublish(data).then((res)=>{
|
|
|
|
if(res.success){
|
|
|
|
uni.showToast({
|
|
|
|
title: '发布成功!',
|
|
|
|
type: 'success',
|
|
|
|
duration:1500
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
// uni.navigateBack({
|
|
|
|
// delta:1
|
|
|
|
// })
|
|
|
|
uni.redirectTo({
|
|
|
|
url: '/pages/study/dabang?id=' + this.studyId
|
|
|
|
});
|
|
|
|
},1500)
|
|
|
|
} else{
|
|
|
|
uni.showToast({
|
|
|
|
title: res.msg,
|
|
|
|
icon:'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
.editdabang-box{
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
padding: 0 30rpx;
|
|
|
|
background: #fff;
|
|
|
|
}
|
|
|
|
.edit-box{
|
|
|
|
width: 100%;
|
|
|
|
padding: 50rpx 0;
|
|
|
|
border-bottom: 1px solid #ececec;
|
|
|
|
textarea{
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.upload-img-box{
|
|
|
|
margin-top: 50rpx;
|
|
|
|
.pictrue{
|
|
|
|
width: 200rpx;
|
|
|
|
height: 200rpx;
|
|
|
|
border-radius: 10rpx;
|
|
|
|
background: #F6F6F6;
|
|
|
|
color: #E2B35D;
|
|
|
|
position: relative;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
image{
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.reduce{
|
|
|
|
position: absolute;
|
|
|
|
top: -12rpx;
|
|
|
|
right: -12rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
.isShow-box{
|
|
|
|
font-size: 24rpx;
|
|
|
|
}
|
|
|
|
.submit-btn{
|
|
|
|
width: 340rpx;
|
|
|
|
height: 88rpx;
|
|
|
|
background: linear-gradient(180deg, #F7D08E 0%, #E2B35D 100%);
|
|
|
|
border-radius: 44rpx;
|
|
|
|
text-align: center;
|
|
|
|
line-height: 88rpx;
|
|
|
|
font-size: 32rpx;
|
|
|
|
color: #fff;
|
|
|
|
margin: 72rpx auto;
|
|
|
|
}
|
|
|
|
switch{
|
|
|
|
transform: scale(0.7);
|
|
|
|
}
|
|
|
|
</style>
|