mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-08 10:26:45 +08:00
2022年5月29日 从svn移到git
This commit is contained in:
413
pages/plus/addArticle.vue
Normal file
413
pages/plus/addArticle.vue
Normal file
@@ -0,0 +1,413 @@
|
||||
<template>
|
||||
<!--添加文章-->
|
||||
<view class="">
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<view>
|
||||
<!-- <page-title :showBack="true">发文章</page-title> -->
|
||||
<!-- 发文章 -->
|
||||
<!-- <view class="">
|
||||
<text>取消</text><text>写文章</text><text></text>
|
||||
</view> -->
|
||||
<view class="feed-title">
|
||||
<text class="title-left" @click="toBack()">取消</text>
|
||||
<!-- <text class="title-con">写文章</text> -->
|
||||
<view class="title-right" >
|
||||
<text style="padding-right: 20rpx;" @click="saveDraft()">保存草稿</text>
|
||||
<text style="padding-right: 20rpx;" @click="submit()">提交</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="big-box-content">
|
||||
<view class="row">
|
||||
<u--input placeholder="请输入标题" maxlength="50" placeholder-style="font-size:30upx;color:#c1c1c1;font-weight: normal;" border="surround" v-model="article.title" ></u--input>
|
||||
</view>
|
||||
<view class="row row-upload">
|
||||
<text class="upload-text">设置封面</text>
|
||||
<u-upload uploadIcon="plus" :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="coverImg" :maxCount="1">
|
||||
</u-upload>
|
||||
</view>
|
||||
<!-- <view v-if="hasKeyword" class="row">
|
||||
<u--input :height="25" maxlength="20" placeholder-style="font-size:30upx;color:#c1c1c1;font-weight: normal;" v-model="article.keyword" placeholder="关键字"></u--input>
|
||||
</view> -->
|
||||
<view v-if="hasSummary" class="row">
|
||||
<u--textarea placeholder="摘要" maxlength="150" placeholder-style="font-size:30upx;color:#c1c1c1;font-weight: normal;" border="surround" v-model="article.summary" ></u--textarea>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>
|
||||
<!-- <u--textarea :height="250" v-model="value1" placeholder="请输入正文"></u--textarea> -->
|
||||
<editor id="editor" class="editor-content" placeholder="请输入正文"
|
||||
:show-img-size="true"
|
||||
:show-img-toolbar="true"
|
||||
:show-img-resize="true"
|
||||
@statuschange="onStatusChange"
|
||||
@ready="onEditorReady">
|
||||
</editor>
|
||||
</view>
|
||||
<view style="padding-left: 30upx;display: flex;">
|
||||
<!-- <view class="addbtn" v-if="!hasKeyword"><u-icon name="plus" @click="addKeyword()" label="关键字"></u-icon> </view> -->
|
||||
<view class="addbtn" v-if="!hasSummary" style="margin-left: 20px;"><u-icon @click="addSummary()" name="plus" label="摘要"></u-icon> </view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="display: flex;justify-content:space-around;">
|
||||
<!-- <view><text class="editor-btn" @tap="format('color','hex color')">颜色</text></view>
|
||||
<view><text class="editor-btn" @tap="format('bold','')">加粗</text></view> -->
|
||||
<!-- <view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertLabel()">
|
||||
<image src="../../static/images/article/label.png" mode=""></image>
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertImage()">
|
||||
<image src="../../static/images/article/image.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<!-- <view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertDate()">
|
||||
<image src="../../static/images/article/time.png" mode=""></image>
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="undo()">
|
||||
<image src="../../static/images/article/quash.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="redo()">
|
||||
<image src="../../static/images/article/redo.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="clear()">
|
||||
<image src="../../static/images/article/empty.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiArtice from '@/api/modules/article.js'
|
||||
import config from '@/config/index.js'
|
||||
import uploadUtil from '@/utils/upload.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
editorCtx: '',
|
||||
formats: {},
|
||||
hasKeyword:false,
|
||||
hasSummary:false,
|
||||
article:{
|
||||
title:'',
|
||||
coverurl:'',
|
||||
summary:'',
|
||||
keyword:'',
|
||||
content:'',
|
||||
status:1 // 1 表草稿,2表已提交待审核,3表审核不通过,5表审核通过,9表已发布
|
||||
},
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
uni.onKeyboardHeightChange(res => {
|
||||
this.editorCtx.scrollIntoView({
|
||||
success: res=> {
|
||||
//console.log(res)
|
||||
},
|
||||
fail: (error) => {
|
||||
console.error(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
onLoad(option){
|
||||
// if(option.value){
|
||||
// this.article=JSON.parse(option.value)
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
addKeyword(){
|
||||
this.hasKeyword=true;
|
||||
},
|
||||
addSummary(){
|
||||
this.hasSummary=true;
|
||||
},
|
||||
saveDraft(){
|
||||
this.article.status=1;
|
||||
this.saveArticle();
|
||||
},
|
||||
submit(){
|
||||
this.article.status=9;
|
||||
this.saveArticle();
|
||||
},
|
||||
saveArticle(){
|
||||
let $this=this;
|
||||
uni.showLoading({
|
||||
title:'正在保存...'
|
||||
})
|
||||
this.editorCtx.getContents({
|
||||
success(res){
|
||||
$this.article.content=res.html;
|
||||
apiArtice.save($this.article).then((res)=>{
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
if(res.status==200){
|
||||
if(res.result.status==1){
|
||||
$this.$refs.messager.show({message:'保存成功',type:'success'});
|
||||
$this.article=res.result;
|
||||
}else if(res.result.status==3){
|
||||
$this.$refs.messager.show({message:'审核未通过已转人工审核',type:'error'});
|
||||
}else if(res.result.status==9){
|
||||
uni.redirectTo({
|
||||
url:'/pages/resource/articeDetail?id='+res.result.id
|
||||
})
|
||||
}
|
||||
}else{
|
||||
$this.$refs.messager.show({message:res.message,type:'error'});
|
||||
}
|
||||
}).catch((err)=>{
|
||||
console.log(err);
|
||||
$this.$refs.messager.show({message:err,type:'error'});
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
toBack(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
//初始化富文本编辑器
|
||||
onEditorReady() {
|
||||
let $this=this;
|
||||
/** #ifdef APP-PLUS || H5 ||MP-WEIXIN */
|
||||
uni.createSelectorQuery().select('#editor').context((res) => {
|
||||
//将内容写入编辑器
|
||||
$this.editorCtx = res.context;
|
||||
}).exec();
|
||||
/** #endif */
|
||||
},
|
||||
onStatusChange(e){
|
||||
const myFormats = e.detail;
|
||||
this.formats = myFormats;
|
||||
},
|
||||
undo(){
|
||||
this.editorCtx.undo()
|
||||
},
|
||||
redo(){
|
||||
this.editorCtx.redo()
|
||||
},
|
||||
clear() {
|
||||
this.editorCtx.clear({
|
||||
success: function(res) {
|
||||
console.log("clear success")
|
||||
}
|
||||
})
|
||||
},
|
||||
removeFormat() {
|
||||
this.editorCtx.removeFormat()
|
||||
},
|
||||
format(name,value){
|
||||
//console.log()
|
||||
//let {name,value} = e.target.dataset
|
||||
if(!name) {return}
|
||||
console.log('format', name, value);
|
||||
this.editorCtx.format(name,value);
|
||||
},
|
||||
getEditorContent(e) {
|
||||
this.content = e.detail.html;
|
||||
//this.contentText = e.detail.text;
|
||||
},
|
||||
insertLabel(){
|
||||
// this.editorCtx.insertText({
|
||||
// text: formatText
|
||||
// })
|
||||
let $this=this;
|
||||
this.editorCtx.getContents({
|
||||
success(data) {
|
||||
// 获取编辑器中的文本
|
||||
let _html = data.html;
|
||||
// 去掉文本中默认的标签
|
||||
_html = _html.replace('<p><br></p>','');
|
||||
// 接去掉文本中最后面的</p>标签
|
||||
_html = _html.substring(0,_html.length-4);
|
||||
// 重新拼接文本,并在末尾添加</p>标签
|
||||
let html = `${_html}<span style="color: #3a8afb;"> #标签名#</span><i style="font-style: normal;"> </i></p>`;
|
||||
// 给富文本设置内容
|
||||
$this.editorCtx.setContents({html});
|
||||
}
|
||||
})
|
||||
},
|
||||
insertDate() {
|
||||
const date = new Date()
|
||||
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
|
||||
this.editorCtx.insertText({
|
||||
text: formatDate
|
||||
})
|
||||
},
|
||||
insertImage() {
|
||||
let $this=this;
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
success: (res) => {
|
||||
uploadUtil.uploadFile(res.tempFilePaths[0]).then(rs=>{
|
||||
if(rs.status==200){
|
||||
$this.editorCtx.insertImage({
|
||||
src: rs.result.httpPath,
|
||||
alt: '图像',
|
||||
success: function() {
|
||||
//console.log('insert image success')
|
||||
$this.editorCtx.scrollIntoView();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
//删除图片
|
||||
deletePic(event) {
|
||||
this.fileList.splice(event.index, 1);
|
||||
},
|
||||
//新增图片
|
||||
async afterRead(event) {
|
||||
//当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
//console.log(event.file);
|
||||
uni.showLoading({
|
||||
title: '正在上传'
|
||||
})
|
||||
uploadUtil.uploadFile(event.file.url).then(rs=>{
|
||||
//console.log(rs);
|
||||
this.coverImage=rs.result.httpPath;
|
||||
this.article.coverurl=rs.result.filePath;
|
||||
//this.fileList.push(rs.result.httpPath)
|
||||
this.fileList.push({
|
||||
status: 'success',
|
||||
message: '已上传',
|
||||
url:rs.result.httpPath
|
||||
})
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title-left{
|
||||
font-size: 32upx;
|
||||
color: #7F7F7F;
|
||||
font-family: Source Han Sans CN;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.title-con{
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
color: #0D0D0D;
|
||||
}
|
||||
.title-right{
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.addbtn{
|
||||
padding: 10upx 20upx;
|
||||
background-color: #e8e8e8;
|
||||
color: #595959;
|
||||
border-radius: 20upx;
|
||||
}
|
||||
.Articleicon{
|
||||
background-color: #fff;
|
||||
}
|
||||
.editor-btn{
|
||||
padding: 6upx 12upx;
|
||||
margin: 6upx;
|
||||
color: #656565;
|
||||
border-radius: 6upx;
|
||||
image{
|
||||
width: 35upx;
|
||||
height: 35upx;
|
||||
}
|
||||
}
|
||||
.editor-content{
|
||||
min-height: 400upx;
|
||||
}
|
||||
.feed-title{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
.titlt-left{
|
||||
color: #7F7F7F;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
|
||||
}
|
||||
.title-right{
|
||||
// position: absolute;
|
||||
right: 18rpx;
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
}
|
||||
.row-index{
|
||||
display: flex;
|
||||
margin-bottom: 25upx;
|
||||
.row-input{
|
||||
margin-left: 50rpx;
|
||||
margin: 0 30rpx;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
}
|
||||
text{
|
||||
color: #D2D2D2;
|
||||
width: 25%;
|
||||
line-height: 54rpx;
|
||||
margin-left: 50rpx;
|
||||
}
|
||||
input{
|
||||
flex: 1;
|
||||
border: 1px solid #d2d2d2;
|
||||
margin-right: 35rpx;
|
||||
border-radius: 5rpx;
|
||||
height: 54rpx;
|
||||
}
|
||||
}
|
||||
.row-upload{
|
||||
display: flex;
|
||||
padding-bottom:20rpx ;
|
||||
.upload-text{
|
||||
padding: 0 20rpx;
|
||||
color: #bdbdbd;
|
||||
}
|
||||
}
|
||||
.u-border {
|
||||
border: none;
|
||||
}
|
||||
.row {
|
||||
margin-bottom: 25upx;
|
||||
padding-bottom: 10rpx;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
margin-left: 35rpx;
|
||||
font-size: 30rpx;
|
||||
input {
|
||||
font-size: 42rpx;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
.row-input{
|
||||
// margin: 0rpx 35rpx;
|
||||
font-size: 42rpx;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
214
pages/plus/addQuestion.vue
Normal file
214
pages/plus/addQuestion.vue
Normal file
@@ -0,0 +1,214 @@
|
||||
<template>
|
||||
<!--添加文章-->
|
||||
<view style="background-color: #fff;">
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<!-- <page-title :showBack="true">提问题</page-title> -->
|
||||
<view style="background-color: #fff;padding-top: 18rpx;">
|
||||
<view class="bar-box">
|
||||
<view class="bar-cancel" @click="toBack()">取消</view>
|
||||
<!-- <view class="bar-center">提问题</view> -->
|
||||
<view @click="goSubmit()" class="bar-go">提交</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="big-box-content">
|
||||
<view class="row row-lin">
|
||||
<u--input placeholder="请输入标题" placeholder-style="font-size:42upx;color:#c1c1c1;font-weight: normal;" maxlength="30" class="row-input" border="surround" v-model="qa.title" @change="change"></u--input>
|
||||
</view>
|
||||
<view class="row ">
|
||||
<u--textarea class="row-input row-text" placeholder-style="font-size:42upx;color:#c1c1c1;font-weight: normal;" :height="300" count maxlength="500" v-model="qa.content" placeholder="请输入正文"></u--textarea>
|
||||
</view>
|
||||
<view class="row">
|
||||
<u-upload uploadIcon="plus" :fileList="fileList" multiple @afterRead="afterRead" @delete="deletePic" name="coverImg" :maxCount="1">
|
||||
</u-upload>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view style="margin-top: 20px;">
|
||||
<view>
|
||||
<u-button type="primary" text="提交问题"></u-button>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import apiQa from '@/api/modules/qa.js'
|
||||
import uploadUtil from '@/utils/upload.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fileUrl:this.$config.fileUrl,
|
||||
qa:{
|
||||
id:'',
|
||||
title:'',
|
||||
content:'',
|
||||
images:''
|
||||
},
|
||||
fileList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toBack(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
goSubmit() {
|
||||
|
||||
let images=[];
|
||||
this.fileList.forEach(file=>{
|
||||
images.push(file.path);
|
||||
})
|
||||
this.qa.images=images.join();
|
||||
uni.showLoading({title:'提交中...'})
|
||||
apiQa.save(this.qa).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'提交成功',type:'success'});
|
||||
uni.redirectTo({
|
||||
url:'/pages/resource/qaDetail?id='+rs.result.id
|
||||
})
|
||||
}else{
|
||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
}
|
||||
})
|
||||
},
|
||||
change(e) {
|
||||
//console.log('change', e);
|
||||
},
|
||||
|
||||
//删除图片
|
||||
deletePic(event) {
|
||||
this.fileList.splice(event.index, 1);
|
||||
},
|
||||
//新增图片
|
||||
async afterRead(event) {
|
||||
//当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
//console.log(event.file);
|
||||
let $this=this;
|
||||
event.file.forEach(img=>{
|
||||
uploadUtil.uploadFile(img.url).then(rs=>{
|
||||
//console.log(rs);
|
||||
|
||||
let item={
|
||||
status: 'success',
|
||||
message: '已上传',
|
||||
path:rs.result.filePath,
|
||||
url:rs.result.httpPath
|
||||
}
|
||||
|
||||
this.fileList.push(item)
|
||||
|
||||
uni.hideLoading();
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
reverse() {
|
||||
uni.navigateBack({
|
||||
url: '/pages/plus/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sub-box{
|
||||
padding: 20rpx;
|
||||
|
||||
.sub-success{
|
||||
.sub-title{
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
line-height: 45rpx;
|
||||
margin-bottom: 10rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.sub-text{
|
||||
font-size: 30rpx;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.sub-bar{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
border-bottom: 2rpx solid #ccc;
|
||||
.bar-time{
|
||||
font-size: 26rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
.bar-reply{
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
.field-icon{
|
||||
display: block;
|
||||
width: 40rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.bar-cor{
|
||||
height: 20rpx;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
.bar-bon{
|
||||
text-align: center;
|
||||
min-height: 600rpx;
|
||||
margin-top: 35rpx;
|
||||
.bon-icon{
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
.bon-text{
|
||||
display: inline-block;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bar-box{
|
||||
display: flex;
|
||||
margin: 18rpx;
|
||||
justify-content: space-between;
|
||||
// position: relative;
|
||||
|
||||
.bar-cancel{
|
||||
font-size: 32upx;
|
||||
color: #7F7F7F;
|
||||
font-family: Source Han Sans CN;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.bar-center{
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
color: #0D0D0D;
|
||||
}
|
||||
.bar-go{
|
||||
// position: absolute;
|
||||
// right: 18rpx;
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
}
|
||||
.row {
|
||||
margin-bottom: 10rpx;
|
||||
.row-input{
|
||||
border: none;
|
||||
}
|
||||
|
||||
}
|
||||
.row-lin{
|
||||
// border-top: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
184
pages/plus/articeDetail.vue
Normal file
184
pages/plus/articeDetail.vue
Normal file
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<!--文章详细页面-->
|
||||
<view><watermark></watermark>
|
||||
<page-title :showBack="true">文章详细信息</page-title>
|
||||
<u-toast ref="articleToast"></u-toast>
|
||||
<view class="adetail content">
|
||||
<!--文章内容-->
|
||||
<view class="adetail-title">{{ detail.title }}</view>
|
||||
<view class="adetail-info">
|
||||
<view style="display: flex;line-height: 40upx;">
|
||||
<author-info :name="detail.sysCreateBy" :avatar="detail.avatar"></author-info>
|
||||
</view>
|
||||
<view style="padding: 10upx 0upx 10upx 40upx;"> {{ detail.sysCreateTime }}</view>
|
||||
</view>
|
||||
<view class="adetail-body">
|
||||
<view class="html-cont">
|
||||
<u-parse :content="detail.content"></u-parse>
|
||||
</view>
|
||||
<view v-if="userInfo.aid==detail.sysCreateAid" style="display: flex;justify-content: flex-end;color: #b1b1b1;padding-top: 10px;">
|
||||
<u-icon name="edit-pen-fill" label="编辑"></u-icon>
|
||||
<u-icon style="margin-left: 20px;" name="trash" label="删除"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<comments ref="comComments" v-if="id!=''" :objType="2" :objId="id"></comments>
|
||||
<interact-fixed v-if="detail.id" :type="2" :praises="false" @comment-success="commentSuccess" :data="detail"></interact-fixed>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiArticle from '@/api/modules/article.js'
|
||||
import apiUser from '@/api/system/user.js'
|
||||
import { mapGetters } from 'vuex';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id:'',
|
||||
detail:{avatar:''},
|
||||
loadStatus:'more',
|
||||
page:1,//当前页数
|
||||
pagesize:10, //总页数
|
||||
fileUrl:this.$config.fileUrl
|
||||
}
|
||||
},
|
||||
|
||||
onLoad (options) {
|
||||
//console.log(options.id);
|
||||
this.id = options.id;
|
||||
this.getDetail();
|
||||
},
|
||||
onReachBottom(){
|
||||
this.getDetail()
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
methods: {
|
||||
getDetail(){
|
||||
uni.showLoading({title:'加载中...'});
|
||||
let $this=this;
|
||||
apiArticle.detail(this.id,true).then(res=>{
|
||||
if(res.status == 200){
|
||||
apiUser.getByIds([res.result.sysCreateAid]).then(rs=>{
|
||||
setTimeout(function(){ uni.hideLoading() },1000);
|
||||
if(rs.status==200){
|
||||
if(rs.result!='' && rs.result.length>0){
|
||||
let author=rs.result[0];
|
||||
res.result.avatar=$this.fileUrl+author.avatar;
|
||||
res.result.orgInfo=author.orgInfo;
|
||||
res.result.ucode=author.code;
|
||||
}
|
||||
$this.detail = res.result;
|
||||
}else{
|
||||
$this.detail = res.result;
|
||||
}
|
||||
})
|
||||
}else{
|
||||
setTimeout(function(){ uni.hideLoading() },1);
|
||||
this.$refs.articleToast.show({message:'加载内容失败',type:'error'});
|
||||
console.log(res.message+res.error);
|
||||
}
|
||||
|
||||
}).catch(err=>{
|
||||
setTimeout(function(){ uni.hideLoading() },1000);
|
||||
})
|
||||
},
|
||||
commentSuccess(rs){
|
||||
//console.log(rs,'success');
|
||||
this.$refs.comComments.loadData(false);
|
||||
},
|
||||
toEdit(){
|
||||
uni.navigateTo({
|
||||
url:'/pages/plus/editArticle?id='+this.id
|
||||
})
|
||||
},
|
||||
del(){
|
||||
let $this=this;
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您确定要删除此文章吗?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
//$this.del();
|
||||
apiArticle.del($this.id).then(res=>{
|
||||
if(res.status=200){
|
||||
this.$refs.articleToast.show({message:'删除成功',type:'success'});
|
||||
//
|
||||
let pages =getCurrentPages();
|
||||
//console.log(pages);
|
||||
const prevPage=pages[pages.length-2];
|
||||
if(!prevPage){
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
}else{
|
||||
uni.navigateBack();
|
||||
}
|
||||
}else{
|
||||
this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});
|
||||
}
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.adetail{
|
||||
.adetail-title{
|
||||
font-weight: 600;
|
||||
font-size: 1.5em;
|
||||
padding: 10upx;
|
||||
word-break:break-all;
|
||||
width: 100%;
|
||||
}
|
||||
.adetail-info{
|
||||
padding-top: 10px;
|
||||
line-height: 50upx;
|
||||
color: #7e7e7e;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.adetail-body{
|
||||
padding-top: 15px;
|
||||
line-height: 55upx;
|
||||
|
||||
background-color: #FFFFFF;
|
||||
>div{
|
||||
text-indent:24px
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.comments{
|
||||
margin-top: 10px;
|
||||
background-color: #FFFFFF;
|
||||
.comments-top{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding-bottom:30upx;
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
font-weight: 500;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
.comments-items{
|
||||
padding-top: 20upx;
|
||||
.comments-item{
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.comments-avatar{
|
||||
height: 60upx;
|
||||
width: 60upx;
|
||||
border-radius: 10%;
|
||||
border: 1px solid #f3f3f3;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
428
pages/plus/editArticle.vue
Normal file
428
pages/plus/editArticle.vue
Normal file
@@ -0,0 +1,428 @@
|
||||
<template>
|
||||
<!--编辑文章-->
|
||||
<view class="">
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<view>
|
||||
<view class="feed-title">
|
||||
<text class="title-left" @click="toBack()">取消</text>
|
||||
<text class="title-con"></text>
|
||||
<view class="title-right" >
|
||||
<text style="padding-right: 20rpx;" @click="saveDraft()">保存草稿</text>
|
||||
<text style="padding-right: 20rpx;" @click="submit()">提交</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="big-box-content">
|
||||
<view class="row">
|
||||
<u--input placeholder="请输入标题" maxlength="50" placeholder-style="font-size:30upx;color:#c1c1c1;font-weight: normal;" border="surround" v-model="article.title" ></u--input>
|
||||
</view>
|
||||
<view class="row row-upload">
|
||||
<text class="upload-text">设置封面</text>
|
||||
<u-upload uploadIcon="plus" :fileList="fileList" @afterRead="afterRead" @delete="deletePic" name="coverImg" :maxCount="1">
|
||||
</u-upload>
|
||||
</view>
|
||||
<view v-if="hasKeyword" class="row">
|
||||
<u--input :height="25" maxlength="20" placeholder-style="font-size:30upx;color:#c1c1c1;font-weight: normal;" v-model="article.keyword" placeholder="关键字"></u--input>
|
||||
</view>
|
||||
<view v-if="hasSummary" class="row">
|
||||
<u--textarea placeholder="摘要" maxlength="150" rows="6" placeholder-style="font-size:30upx; color:#c1c1c1;font-weight: normal;" border="surround" v-model="article.summary" ></u--textarea>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view>
|
||||
<!-- <u--textarea :height="250" v-model="value1" placeholder="请输入正文"></u--textarea> -->
|
||||
<editor id="editor" class="editor-content" placeholder="请输入正文"
|
||||
:show-img-size="true"
|
||||
:show-img-toolbar="true"
|
||||
:show-img-resize="true"
|
||||
@statuschange="onStatusChange"
|
||||
@ready="onEditorReady">
|
||||
</editor>
|
||||
</view>
|
||||
<view style="padding-left: 30upx;display: flex;">
|
||||
<!-- <view class="addbtn" v-if="!hasKeyword"><u-icon name="plus" @click="addKeyword()" label="关键字"></u-icon> </view> -->
|
||||
<view class="addbtn" v-if="!hasSummary" style="margin-left: 20px;"><u-icon @click="addSummary()" name="plus" label="摘要"></u-icon> </view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view style="display: flex;justify-content:space-around;">
|
||||
<!-- <view><text class="editor-btn" @tap="format('color','hex color')">颜色</text></view>
|
||||
<view><text class="editor-btn" @tap="format('bold','')">加粗</text></view> -->
|
||||
<!-- <view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertLabel()">
|
||||
<image src="../../static/images/article/label.png" mode=""></image>
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertImage()">
|
||||
<image src="../../static/images/article/image.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<!-- <view class="Articleicon">
|
||||
<text class="editor-btn" @tap="insertDate()">
|
||||
<image src="../../static/images/article/time.png" mode=""></image>
|
||||
</text>
|
||||
</view> -->
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="undo()">
|
||||
<image src="../../static/images/article/quash.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="redo()">
|
||||
<image src="../../static/images/article/redo.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
<view class="Articleicon">
|
||||
<text class="editor-btn" @tap="clear()">
|
||||
<image src="../../static/images/article/empty.png" mode=""></image>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiArtice from '@/api/modules/article.js'
|
||||
import config from '@/config/index.js'
|
||||
import uploadUtil from '@/utils/upload.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
curArticleId:'',
|
||||
editorCtx: '',
|
||||
formats: {},
|
||||
hasKeyword:false,
|
||||
hasSummary:false,
|
||||
article:{
|
||||
title:'',
|
||||
coverurl:'',
|
||||
summary:'',
|
||||
keyword:'',
|
||||
content:'',
|
||||
status:1 // 1 表草稿,2表已提交待审核,3表审核不通过,5表审核通过,9表已发布
|
||||
},
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
uni.onKeyboardHeightChange(res => {
|
||||
this.editorCtx.scrollIntoView({
|
||||
success: res=> {
|
||||
//console.log(res)
|
||||
},
|
||||
fail: (error) => {
|
||||
//console.error(error)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
onLoad(option){
|
||||
if(option.id){
|
||||
this.curArticleId=option.id;
|
||||
this.loadDetail();
|
||||
}else{
|
||||
//this.$refs.messager.show({message:'参数错误',type:'error'});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadDetail(){
|
||||
apiArtice.detail(this.curArticleId,false).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.article=rs.result;
|
||||
if(this.article.keyword!=''){
|
||||
this.hasKeyword=true;
|
||||
}
|
||||
if(this.article.summary!=''){
|
||||
this.hasSummary=true;
|
||||
}
|
||||
this.editorCtx.setContents({
|
||||
html:rs.result.content
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
addKeyword(){
|
||||
this.hasKeyword=true;
|
||||
},
|
||||
addSummary(){
|
||||
this.hasSummary=true;
|
||||
},
|
||||
saveDraft(){
|
||||
this.article.status=1;
|
||||
this.saveArticle();
|
||||
},
|
||||
submit(){
|
||||
this.article.status=9;
|
||||
this.saveArticle();
|
||||
},
|
||||
saveArticle(){
|
||||
let $this=this;
|
||||
uni.showLoading({
|
||||
title:'正在保存...'
|
||||
})
|
||||
this.editorCtx.getContents({
|
||||
success(res){
|
||||
$this.article.content=res.html;
|
||||
apiArtice.save($this.article).then((res)=>{
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
if(res.status==200){
|
||||
if(res.result.status==1){
|
||||
$this.$refs.messager.show({message:'保存成功',type:'success'});
|
||||
$this.article=res.result;
|
||||
}else if(res.result.status==3){
|
||||
$this.$refs.messager.show({message:'审核未通过已转人工审核',type:'error'});
|
||||
}else if(res.result.status==9){
|
||||
uni.redirectTo({
|
||||
url:'/pages/resource/articeDetail?id='+res.result.id
|
||||
})
|
||||
}
|
||||
}else{
|
||||
$this.$refs.messager.show({message:res.message,type:'error'});
|
||||
}
|
||||
}).catch((err)=>{
|
||||
console.log(err);
|
||||
$this.$refs.messager.show({message:err,type:'error'});
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
toBack(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
//初始化富文本编辑器
|
||||
onEditorReady() {
|
||||
let $this=this;
|
||||
/** #ifdef APP-PLUS || H5 ||MP-WEIXIN */
|
||||
uni.createSelectorQuery().select('#editor').context((res) => {
|
||||
//将内容写入编辑器
|
||||
$this.editorCtx = res.context;
|
||||
}).exec();
|
||||
/** #endif */
|
||||
},
|
||||
onStatusChange(e){
|
||||
const myFormats = e.detail;
|
||||
this.formats = myFormats;
|
||||
},
|
||||
undo(){
|
||||
this.editorCtx.undo()
|
||||
},
|
||||
redo(){
|
||||
this.editorCtx.redo()
|
||||
},
|
||||
clear() {
|
||||
this.editorCtx.clear({
|
||||
success: function(res) {
|
||||
console.log("clear success")
|
||||
}
|
||||
})
|
||||
},
|
||||
removeFormat() {
|
||||
this.editorCtx.removeFormat()
|
||||
},
|
||||
format(name,value){
|
||||
//console.log()
|
||||
//let {name,value} = e.target.dataset
|
||||
if(!name) {return}
|
||||
//console.log('format', name, value);
|
||||
this.editorCtx.format(name,value);
|
||||
},
|
||||
getEditorContent(e) {
|
||||
this.content = e.detail.html;
|
||||
//this.contentText = e.detail.text;
|
||||
},
|
||||
insertLabel(){
|
||||
// this.editorCtx.insertText({
|
||||
// text: formatText
|
||||
// })
|
||||
let $this=this;
|
||||
this.editorCtx.getContents({
|
||||
success(data) {
|
||||
// 获取编辑器中的文本
|
||||
let _html = data.html;
|
||||
// 去掉文本中默认的标签
|
||||
_html = _html.replace('<p><br></p>','');
|
||||
// 接去掉文本中最后面的</p>标签
|
||||
_html = _html.substring(0,_html.length-4);
|
||||
// 重新拼接文本,并在末尾添加</p>标签
|
||||
let html = `${_html}<span style="color: #3a8afb;"> #标签名#</span><i style="font-style: normal;"> </i></p>`;
|
||||
// 给富文本设置内容
|
||||
$this.editorCtx.setContents({html});
|
||||
}
|
||||
})
|
||||
},
|
||||
insertDate() {
|
||||
const date = new Date()
|
||||
const formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
|
||||
this.editorCtx.insertText({
|
||||
text: formatDate
|
||||
})
|
||||
},
|
||||
insertImage() {
|
||||
let $this=this;
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
success: (res) => {
|
||||
uploadUtil.uploadFile(res.tempFilePaths[0]).then(rs=>{
|
||||
if(rs.status==200){
|
||||
$this.editorCtx.insertImage({
|
||||
src: rs.result.httpPath,
|
||||
alt: '图像',
|
||||
success: function() {
|
||||
//console.log('insert image success')
|
||||
$this.editorCtx.scrollIntoView();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
//删除图片
|
||||
deletePic(event) {
|
||||
this.fileList.splice(event.index, 1);
|
||||
},
|
||||
//新增图片
|
||||
async afterRead(event) {
|
||||
//当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
//console.log(event.file);
|
||||
uni.showLoading({
|
||||
title: '正在上传'
|
||||
})
|
||||
uploadUtil.uploadFile(event.file.url).then(rs=>{
|
||||
//console.log(rs);
|
||||
this.coverImage=rs.result.httpPath;
|
||||
this.article.coverurl=rs.result.filePath;
|
||||
//this.fileList.push(rs.result.httpPath)
|
||||
this.fileList.push({
|
||||
status: 'success',
|
||||
message: '已上传',
|
||||
url:rs.result.httpPath
|
||||
})
|
||||
uni.hideLoading();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.title-left{
|
||||
font-size: 32upx;
|
||||
color: #7F7F7F;
|
||||
font-family: Source Han Sans CN;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.title-con{
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
color: #0D0D0D;
|
||||
}
|
||||
.title-right{
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.addbtn{
|
||||
padding: 10upx 20upx;
|
||||
background-color: #e8e8e8;
|
||||
color: #595959;
|
||||
border-radius: 20upx;
|
||||
}
|
||||
.Articleicon{
|
||||
background-color: #fff;
|
||||
}
|
||||
.editor-btn{
|
||||
padding: 6upx 12upx;
|
||||
margin: 6upx;
|
||||
color: #656565;
|
||||
border-radius: 6upx;
|
||||
image{
|
||||
width: 35upx;
|
||||
height: 35upx;
|
||||
}
|
||||
}
|
||||
.editor-content{
|
||||
min-height: 400upx;
|
||||
}
|
||||
.feed-title{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
.titlt-left{
|
||||
color: #7F7F7F;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
|
||||
}
|
||||
.title-right{
|
||||
// position: absolute;
|
||||
right: 18rpx;
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
}
|
||||
.row-index{
|
||||
display: flex;
|
||||
margin-bottom: 25upx;
|
||||
.row-input{
|
||||
margin-left: 50rpx;
|
||||
margin: 0 30rpx;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
}
|
||||
text{
|
||||
color: #D2D2D2;
|
||||
width: 25%;
|
||||
line-height: 54rpx;
|
||||
margin-left: 50rpx;
|
||||
}
|
||||
input{
|
||||
flex: 1;
|
||||
border: 1px solid #d2d2d2;
|
||||
margin-right: 35rpx;
|
||||
border-radius: 5rpx;
|
||||
height: 54rpx;
|
||||
}
|
||||
}
|
||||
.row-upload{
|
||||
display: flex;
|
||||
padding-bottom:20rpx ;
|
||||
.upload-text{
|
||||
padding: 0 20rpx;
|
||||
color: #bdbdbd;
|
||||
}
|
||||
}
|
||||
.u-border {
|
||||
border: none;
|
||||
}
|
||||
.row {
|
||||
margin-bottom: 25upx;
|
||||
padding-bottom: 10rpx;
|
||||
border-bottom: 1rpx solid #e2e2e2;
|
||||
margin-left: 35rpx;
|
||||
font-size: 30rpx;
|
||||
input {
|
||||
font-size: 42rpx;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
.row-input{
|
||||
// margin: 0rpx 35rpx;
|
||||
font-size: 42rpx;
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
219
pages/plus/editQuestion.vue
Normal file
219
pages/plus/editQuestion.vue
Normal file
@@ -0,0 +1,219 @@
|
||||
<template>
|
||||
<!--添加文章-->
|
||||
<view style="background-color: #fff;">
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<!-- <page-title :showBack="true">编辑问题</page-title> -->
|
||||
<view style="background-color: #fff;padding-top: 18rpx;">
|
||||
<view class="bar-box">
|
||||
<view class="bar-cancel" @click="toBack()">取消</view>
|
||||
<view class="bar-center">编辑问题</view>
|
||||
<view @click="goSubmit()" class="bar-go">提交</view>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="big-box-content">
|
||||
<view class="row row-lin">
|
||||
<u--input placeholder="请输入标题" placeholder-style="font-size:42upx;color:#c1c1c1;font-weight: normal;" maxlength="30" class="row-input" border="surround" v-model="qa.title" @change="change"></u--input>
|
||||
</view>
|
||||
<view class="row ">
|
||||
<u--textarea class="row-input row-text" placeholder-style="font-size:42upx;color:#c1c1c1;font-weight: normal;" :height="300" count maxlength="500" v-model="qa.content" placeholder="请输入正文"></u--textarea>
|
||||
</view>
|
||||
<view class="row">
|
||||
<u-upload uploadIcon="plus" :fileList="fileList" multiple @afterRead="afterRead" @delete="deletePic" name="coverImg" :maxCount="5">
|
||||
</u-upload>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view style="margin-top: 20px;">
|
||||
<view>
|
||||
<u-button type="primary" text="提交问题"></u-button>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiQa from '@/api/modules/qa.js'
|
||||
import uploadUtil from '@/utils/upload.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
fileUrl:this.$config.fileUrl,
|
||||
qa:{
|
||||
id:'',
|
||||
title:'',
|
||||
content:'',
|
||||
images:''
|
||||
},
|
||||
fileList: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toBack(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
goSubmit() {
|
||||
|
||||
let images=[];
|
||||
this.fileList.forEach(file=>{
|
||||
images.push(file.path);
|
||||
})
|
||||
this.qa.images=images.join();
|
||||
uni.showLoading({title:'提交中...'})
|
||||
apiQa.update(this.qa).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.$refs.messager.show({message:'提交成功',type:'success'});
|
||||
uni.redirectTo({
|
||||
url:'/pages/resource/qaDetail?id='+rs.result.id
|
||||
})
|
||||
}else{
|
||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||
setTimeout(function(){uni.hideLoading()},1000);
|
||||
}
|
||||
})
|
||||
},
|
||||
change(e) {
|
||||
//没有任何处理,打印console.log无意义
|
||||
//console.log('change', e);
|
||||
},
|
||||
|
||||
//删除图片
|
||||
deletePic(event) {
|
||||
this.fileList.splice(event.index, 1);
|
||||
},
|
||||
//新增图片
|
||||
async afterRead(event) {
|
||||
//当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
//console.log(event.file);
|
||||
let $this=this;
|
||||
event.file.forEach(img=>{
|
||||
uploadUtil.uploadFile(img.url).then(rs=>{
|
||||
//console.log(rs);
|
||||
|
||||
let item={
|
||||
status: 'success',
|
||||
message: '已上传',
|
||||
path:rs.result.filePath,
|
||||
url:rs.result.httpPath
|
||||
}
|
||||
|
||||
this.fileList.push(item)
|
||||
|
||||
uni.hideLoading();
|
||||
});
|
||||
})
|
||||
|
||||
},
|
||||
reverse() {
|
||||
uni.navigateBack({
|
||||
url: '/pages/plus/index'
|
||||
})
|
||||
}
|
||||
},
|
||||
onLoad(option){
|
||||
if(option.value){
|
||||
this.qa=JSON.parse(option.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sub-box{
|
||||
padding: 20rpx;
|
||||
|
||||
.sub-success{
|
||||
.sub-title{
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
line-height: 45rpx;
|
||||
margin-bottom: 10rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.sub-text{
|
||||
font-size: 30rpx;
|
||||
line-height: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.sub-bar{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
border-bottom: 2rpx solid #ccc;
|
||||
.bar-time{
|
||||
font-size: 26rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
.bar-reply{
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
.field-icon{
|
||||
display: block;
|
||||
width: 40rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.bar-cor{
|
||||
height: 20rpx;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
.bar-bon{
|
||||
text-align: center;
|
||||
min-height: 600rpx;
|
||||
margin-top: 35rpx;
|
||||
.bon-icon{
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
.bon-text{
|
||||
display: inline-block;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.bar-box{
|
||||
display: flex;
|
||||
margin: 18rpx;
|
||||
justify-content: space-between;
|
||||
// position: relative;
|
||||
|
||||
.bar-cancel{
|
||||
font-size: 32upx;
|
||||
color: #7F7F7F;
|
||||
font-family: Source Han Sans CN;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.bar-center{
|
||||
font-size: 36upx;
|
||||
font-weight: 600;
|
||||
color: #0D0D0D;
|
||||
}
|
||||
.bar-go{
|
||||
// position: absolute;
|
||||
// right: 18rpx;
|
||||
color: #588AFC;
|
||||
font-size: 30rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
}
|
||||
.row {
|
||||
margin-bottom: 10rpx;
|
||||
.row-input{
|
||||
border: none;
|
||||
}
|
||||
|
||||
}
|
||||
.row-lin{
|
||||
// border-top: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
223
pages/plus/feedback.vue
Normal file
223
pages/plus/feedback.vue
Normal file
@@ -0,0 +1,223 @@
|
||||
<template>
|
||||
<!--提意见,反馈意见-->
|
||||
<view>
|
||||
<u-toast ref="messager"></u-toast>
|
||||
<!-- <page-title :showBack="true">提意见</page-title> -->
|
||||
<view class="feed-box" v-if="isShow">
|
||||
<!-- <page-title :showBack="true">提意见</page-title> -->
|
||||
<!-- <page-add-title :showBack="true">提意见</page-add-title> -->
|
||||
<view class="feed-title">
|
||||
<text class="title-left" @click="toBack()">取消</text>
|
||||
<!-- <text class="title-con">提意见</text> -->
|
||||
<text class="title-right" @click="goSubmit()">提交</text>
|
||||
</view>
|
||||
<view class="content">
|
||||
<view class="" style="display: flex;margin-bottom: 10upx;">
|
||||
<u-button class="content-text" text="关于内容" @click="isClick('课程问题')" :class="{'active':info.type=='课程问题'}" style="margin-right: 10upx;"></u-button>
|
||||
<u-button class="content-text" text="关于平台操作" @click="isClick('系统问题')" :class="{'active':info.type=='系统问题'}" style="margin-left: 10upx;"></u-button>
|
||||
</view>
|
||||
<u--textarea :height="300" v-model="info.content" placeholder="请尽量详细描述您的问题,管理员将会及时对您的问题进行反馈,您可以在消息中查看管理员的反馈。"></u--textarea>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sub-box" v-else>
|
||||
<page-title :showBack="true">意见详情</page-title>
|
||||
<view class="sub-success" style="margin-top: 20px;">
|
||||
<view class="sub-text">{{result.content}}</view>
|
||||
<view class="sub-bar">
|
||||
<view class="bar-time">{{result.sysCreateTime}}</view>
|
||||
<!-- <view class="bar-right" style="display: flex;">
|
||||
<u-avatar class="u-img" v-if="authorInfo.avatar==''" :size="20" shape="square" icon="account"></u-avatar>
|
||||
<u-avatar class="u-img" v-else :size="20" shape="square" :src="authorInfo.avatar"></u-avatar>
|
||||
<text style="font-size: 20rpx;color: #666666;">{{result.sysCreateBy}}</text>
|
||||
</view> -->
|
||||
<author-info :name="result.sysCreateBy" :avatar="authorInfo.avatar"></author-info>
|
||||
</view>
|
||||
<view class="bar-cor">
|
||||
</view>
|
||||
<view class="bar-bon">
|
||||
<u-icon name="checkmark-circle" color="#489f6e" size="18" class="bon-icon"></u-icon>
|
||||
<text class="bon-text">感谢您宝贵的意见</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiFeedback from '@/api/modules/feedback.js'
|
||||
import apiUser from '@/api/system/user.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isShow:true,
|
||||
info: {
|
||||
type: '课程问题',
|
||||
content: ''
|
||||
},
|
||||
authorInfo:{aid:'',name:'',code:'',orgInfo:''},
|
||||
result:{},
|
||||
typesShow: false,
|
||||
index: 0
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
isClick(type) {
|
||||
this.info.type = type;
|
||||
},
|
||||
toBack(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
goSubmit() {
|
||||
if(this.info.type == '') {
|
||||
this.$refs.messager.show({message:'请选择意见类型!',type:'warning'});
|
||||
return;
|
||||
}
|
||||
if(this.info.content == '') {
|
||||
this.$refs.messager.show({message:'请输入问题描述!',type:'warning'});
|
||||
return;
|
||||
}
|
||||
uni.showLoading({title:'提交中...'})
|
||||
apiFeedback.save(this.info).then(rs=>{
|
||||
if(rs.status==200){
|
||||
this.result = rs.result;
|
||||
this.loadUserInfo(rs.result.sysCreateAid)
|
||||
uni.hideLoading()
|
||||
this.isShow = false;
|
||||
// uni.redirectTo({
|
||||
// url:'/pages/resource/qaDetail?id='+rs.result.id
|
||||
// })
|
||||
}else{
|
||||
this.$refs.messager.show({message:rs.message,type:'error'});
|
||||
}
|
||||
})
|
||||
},
|
||||
loadUserInfo(uid){
|
||||
apiUser.getByIds([uid]).then(res=>{
|
||||
if(res.status==200){
|
||||
this.authorInfo=res.result[0];
|
||||
}
|
||||
})
|
||||
},
|
||||
hideKeyboard() {
|
||||
|
||||
},
|
||||
chooseType(e) {
|
||||
this.info.qtype = e.name
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-img{
|
||||
vertical-align: middle;
|
||||
margin-right: 10upx;
|
||||
}
|
||||
.active{
|
||||
background-color: #87adff !important;
|
||||
color: #fff;
|
||||
}
|
||||
.content-text{
|
||||
background-color: #eee;
|
||||
}
|
||||
.sub-box{
|
||||
// padding: 20rpx;
|
||||
background-color: #fff;
|
||||
.sub-success{
|
||||
.sub-title{
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
line-height: 45rpx;
|
||||
margin-bottom: 10rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
.sub-text{
|
||||
font-size: 34rpx;
|
||||
line-height: 50rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding: 20rpx;
|
||||
font-weight: 500;
|
||||
font-family: Source Han Sans CN;
|
||||
}
|
||||
.sub-bar{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
// border-bottom: 2rpx solid #ccc;
|
||||
.bar-time{
|
||||
font-size: 26rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
.bar-reply{
|
||||
text-align: center;
|
||||
padding: 30rpx;
|
||||
.field-icon{
|
||||
display: block;
|
||||
width: 40rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
.bar-cor{
|
||||
height: 20rpx;
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
.bar-bon{
|
||||
text-align: center;
|
||||
height: 600rpx;
|
||||
margin-top: 80rpx;
|
||||
.bon-icon{
|
||||
display: inline-block;
|
||||
|
||||
}
|
||||
.bon-text{
|
||||
display: inline-block;
|
||||
margin-right: 10rpx;
|
||||
font-family: Source Han Sans CN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.feed-box{
|
||||
height: 100vh;
|
||||
background-color: #fff;
|
||||
.feed-title{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx;
|
||||
// background-color: #fff;
|
||||
.title-left{
|
||||
color: #7F7F7F;
|
||||
font-size: 32upx;
|
||||
font-family: Source Han Sans CN;
|
||||
// font-weight: bold;
|
||||
color: #7F7F7F;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.title-con{
|
||||
font-size: 32upx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: 600;
|
||||
color: #0D0D0D;
|
||||
}
|
||||
.title-right{
|
||||
// position: absolute;
|
||||
// right: 18rpx;
|
||||
color: #588AFC;
|
||||
font-size: 32upx;
|
||||
font-family: Source Han Sans CN;
|
||||
font-weight: bold;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.row {
|
||||
margin-bottom: 50upx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
200
pages/plus/index.vue
Normal file
200
pages/plus/index.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<view class="content" :class="{'active':active}">
|
||||
<view style="padding: 60rpx 60rpx 0 30rpx;color: #8a8a8a;overflow: auto;">
|
||||
<view style="text-align: center;font-size: 50upx;padding-bottom:50rpx ;">京东方大学堂内容发布须知</view>
|
||||
<view style="line-height: 60upx;white-space:pre-line;">
|
||||
<!-- <u-parse :content="context"></u-parse> -->
|
||||
<text v-html="context"></text>
|
||||
<!-- <view style="display: flex;margin-bottom: 10rpx;">
|
||||
<view style="margin-right: 10rpx;">
|
||||
1.
|
||||
</view>
|
||||
<view>
|
||||
文章内容要求导向正确,内容健康向上,观点鲜明,结构完整,语句流畅。
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;margin-bottom: 10rpx;">
|
||||
<view style="margin-right: 10rpx;">
|
||||
2.
|
||||
</view>
|
||||
<view>
|
||||
所发布内容应为本人原创,或在不对他人构成侵权的基础上进行转载且注明原作者及出处。
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: flex;margin-bottom: 10rpx;"> -->
|
||||
<!-- <view style="margin-right: 10rpx;">
|
||||
3.
|
||||
</view>
|
||||
<view>
|
||||
在尊重作者观点和论述的完整性的基础上,管理员保留对内容的编辑权和删改权。若不同意删改,请在来信中特别注明。
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view style="height: 300px;"></view>
|
||||
</view>
|
||||
<view class="tabbar-box-wrap">
|
||||
<view class="tabbar-box">
|
||||
<view class="tabbar-box-item" @tap="goToPage('addArticle')">
|
||||
<!-- <image class="box-image" src="../../static/images/release.png" mode="aspectFit"></image> -->
|
||||
<image class="box-image" src="../../static/images/icon/article2.png" mode="aspectFit"></image>
|
||||
<!-- <u-icon style="flex-direction: column;" name="file-text" color="#2979ff" size="30"></u-icon> -->
|
||||
<view class="explain">写文章</view>
|
||||
</view>
|
||||
|
||||
<view class="tabbar-box-item" @click="goToPage('addQuestion')">
|
||||
<!-- <image class="box-image" src="../../static/images/video.png" mode="aspectFit"></image> -->
|
||||
<image class="box-image" src="../../static/images/icon/question2.png" mode="aspectFit"></image>
|
||||
<!-- <u-icon style="flex-direction: column;" name="order" color="#2979ff" size="30"></u-icon> -->
|
||||
<view class="explain">提问题</view>
|
||||
</view>
|
||||
<view class="tabbar-box-item" @click="goToPage('feedback')">
|
||||
<!-- <image class="box-image" src="../../static/images/qa.png" mode="aspectFit"></image> -->
|
||||
<image class="box-image" src="../../static/images/icon/disagree2.png" mode="aspectFit"></image>
|
||||
<!-- <u-icon style="flex-direction: column;" name="error-circle" color="#2979ff" size="30"></u-icon> -->
|
||||
<view class="explain">提意见</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 100px;"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiProtocol from '@/api/modules/protocol.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: false,
|
||||
context:'',
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
this.getprotocol();
|
||||
},
|
||||
onShow() {
|
||||
// setTimeout(() => {
|
||||
this.active = true;
|
||||
// }, 500);
|
||||
},
|
||||
onHide() {
|
||||
this.active = false;
|
||||
},
|
||||
methods: {
|
||||
getprotocol() {
|
||||
apiProtocol.query(1).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.context = res.result.content;
|
||||
}
|
||||
})
|
||||
},
|
||||
goToPage(url) {
|
||||
if (!url) return;
|
||||
uni.navigateTo({
|
||||
url
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
width: 100%;
|
||||
/* #ifdef H5 */
|
||||
// height: calc(100vh - var(--window-bottom) - var(--window-top));
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
transition: opacity 0.3s;
|
||||
background: #ffffff;
|
||||
opacity: 0;
|
||||
|
||||
&.active {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: relative;
|
||||
margin-top: -400upx;
|
||||
width: 200upx;
|
||||
height: 200upx;
|
||||
// z-index: -1;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
|
||||
&.active {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tabbar-box-wrap {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
padding: 50upx;
|
||||
box-sizing: border-box;
|
||||
bottom: 70upx;
|
||||
left: 0;
|
||||
|
||||
.tabbar-box {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
border-radius: 20upx;
|
||||
padding: 15upx 20upx;
|
||||
box-sizing: border-box;
|
||||
z-index: 2;
|
||||
box-shadow: 0px 2px 5px 2px rgba(0, 0, 0, 0.1);
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -16upx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: auto;
|
||||
width: 50upx;
|
||||
height: 50upx;
|
||||
transform: rotate(45deg);
|
||||
background: #fff;
|
||||
z-index: 1;
|
||||
box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 20upx;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.tabbar-box-item {
|
||||
// position: relative;
|
||||
width: 100%;
|
||||
// color: #007AFF;
|
||||
z-index: 3;
|
||||
margin: 10upx;
|
||||
text-align: center;
|
||||
font-size: $uni-font-size-base;
|
||||
|
||||
.box-image {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user