|
|
|
<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="tips">提示:由于11月27、28日系统升级导致部分打卡未成功的学员,现可以根据自己需求进行补卡操作。</view>
|
|
|
|
<view class="isShow-box acea-row row-middle row-right">
|
|
|
|
<text>是否为补打卡内容:</text>
|
|
|
|
<switch :checked="isBuka" @change="switchChange2" color="#FDBF68" />
|
|
|
|
<text>{{isBuka == 1 ? '是' : '否'}}</text>
|
|
|
|
</view>
|
|
|
|
<view class="isShow-box acea-row row-middle row-right" v-if="isBuka">
|
|
|
|
<text>请选择补卡日期:</text>
|
|
|
|
<radio-group @change="choseDate">
|
|
|
|
<label>
|
|
|
|
<radio value="2021-11-27" /><text>2021-11-27</text>
|
|
|
|
</label>
|
|
|
|
<label>
|
|
|
|
<radio value="2021-11-28" /><text>2021-11-28</text>
|
|
|
|
</label>
|
|
|
|
</radio-group>
|
|
|
|
</view>
|
|
|
|
<view class="submit-btn" @click="submitClick()">发布</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { chooseImages } from "@/utils"
|
|
|
|
import { studyListPublish, studyListRepublish } from "@/api/knowledge"
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
// VueCoreImageUpload
|
|
|
|
},
|
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
isShow: 1,
|
|
|
|
studyId: '',
|
|
|
|
uploadPictures: [],
|
|
|
|
content: "",
|
|
|
|
unique: "",
|
|
|
|
isBuka: 0,
|
|
|
|
republishTime: ''
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onLoad(){
|
|
|
|
this.studyId = this.$yroute.query.id;
|
|
|
|
},
|
|
|
|
methods:{
|
|
|
|
switchChange(e){
|
|
|
|
this.isShow = e.target.value ? 1 : 0
|
|
|
|
},
|
|
|
|
switchChange2(e){
|
|
|
|
this.isBuka = e.target.value ? 1 : 0
|
|
|
|
},
|
|
|
|
choseDate(e){
|
|
|
|
this.republishTime = e.detail.value
|
|
|
|
},
|
|
|
|
chooseImage() {
|
|
|
|
chooseImages(img => {
|
|
|
|
console.log(img)
|
|
|
|
this.uploadPictures.push(img);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
submitClick(){
|
|
|
|
if(this.content == ''){
|
|
|
|
return uni.showToast({
|
|
|
|
title: '请填写分享内容',
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
if(this.isBuka == 1 && this.republishTime == ''){
|
|
|
|
return uni.showToast({
|
|
|
|
title: '请选择补卡日期',
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
}
|
|
|
|
const data = {
|
|
|
|
content: this.content,
|
|
|
|
imgPaths: this.uploadPictures,
|
|
|
|
studylistId: this.studyId,
|
|
|
|
isShow: this.isShow
|
|
|
|
}
|
|
|
|
if(this.isBuka){ //补打卡
|
|
|
|
data.republishTime = this.republishTime
|
|
|
|
studyListRepublish(data).then((res)=>{
|
|
|
|
this.fnCallBack(res)
|
|
|
|
})
|
|
|
|
} else{
|
|
|
|
studyListPublish(data).then((res)=>{
|
|
|
|
this.fnCallBack(res)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fnCallBack(res){
|
|
|
|
if(res.success){
|
|
|
|
uni.showToast({
|
|
|
|
title: '发布成功!',
|
|
|
|
type: 'success',
|
|
|
|
duration:1500
|
|
|
|
})
|
|
|
|
setTimeout(()=>{
|
|
|
|
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,.tips{
|
|
|
|
font-size: 24rpx;
|
|
|
|
}
|
|
|
|
.tips{
|
|
|
|
color: #E2B35D;
|
|
|
|
}
|
|
|
|
.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>
|