You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

195 lines
4.4 KiB

3 years ago
<template>
<view class="editdabang-box">
<view class="edit-box">
3 years ago
<textarea v-model="content" placeholder="请在此输入文字..." />
3 years ago
</view>
<view class="upload-img-box acea-row row-middle">
<view class="pictrue" v-for="(item, uploadPicturesIndex) in uploadPictures"
:key="uploadPicturesIndex">
3 years ago
<image :src="item" mode="aspectFill"/>
3 years ago
<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>
3 years ago
<view class="isShow-box acea-row row-middle row-right">
<text>是否显示打卡内容</text>
<switch checked @change="switchChange" color="#FDBF68" />
<text>{{isShow == 1 ? '显示' : '不显示'}}</text>
</view>
3 years ago
<view class="tips">提示由于11月2728日系统升级导致部分打卡未成功的学员现可以根据自己需求进行补卡操作</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>
3 years ago
<view class="submit-btn" @click="submitClick()">发布</view>
3 years ago
</view>
</template>
<script>
3 years ago
import { chooseImages } from "@/utils"
3 years ago
import { studyListPublish, studyListRepublish } from "@/api/knowledge"
3 years ago
export default {
components: {
// VueCoreImageUpload
},
data: function() {
return {
3 years ago
isShow: 1,
3 years ago
studyId: '',
3 years ago
uploadPictures: [],
3 years ago
content: "",
3 years ago
unique: "",
isBuka: 0,
republishTime: ''
3 years ago
};
},
3 years ago
onLoad(){
this.studyId = this.$yroute.query.id;
},
3 years ago
methods:{
3 years ago
switchChange(e){
this.isShow = e.target.value ? 1 : 0
},
3 years ago
switchChange2(e){
this.isBuka = e.target.value ? 1 : 0
},
choseDate(e){
this.republishTime = e.detail.value
},
3 years ago
chooseImage() {
3 years ago
chooseImages(img => {
console.log(img)
3 years ago
this.uploadPictures.push(img);
});
},
3 years ago
submitClick(){
if(this.content == ''){
3 years ago
return uni.showToast({
3 years ago
title: '请填写分享内容',
icon: 'none'
})
}
3 years ago
if(this.isBuka == 1 && this.republishTime == ''){
return uni.showToast({
title: '请选择补卡日期',
icon: 'none'
})
}
const data = {
3 years ago
content: this.content,
imgPaths: this.uploadPictures,
3 years ago
studylistId: this.studyId,
isShow: this.isShow
3 years ago
}
3 years ago
if(this.isBuka){ //补打卡
data.republishTime = this.republishTime
studyListRepublish(data).then((res)=>{
this.fnCallBack(res)
})
} else{
studyListPublish(data).then((res)=>{
this.fnCallBack(res)
})
}
3 years ago
},
3 years ago
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'
})
}
}
3 years ago
}
}
3 years ago
</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;
3 years ago
textarea{
width: 100%;
}
3 years ago
}
.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;
3 years ago
margin-bottom: 20rpx;
3 years ago
image{
width: 100%;
height: 100%;
}
.reduce{
position: absolute;
top: -12rpx;
right: -12rpx;
}
}
3 years ago
}
3 years ago
.isShow-box,.tips{
3 years ago
font-size: 24rpx;
3 years ago
}
3 years ago
.tips{
color: #E2B35D;
}
3 years ago
.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;
}
3 years ago
switch{
transform: scale(0.7);
}
3 years ago
</style>