迁移党史

This commit is contained in:
aixianling
2021-12-20 10:31:12 +08:00
parent 58bd5237da
commit 6d0810031d
12 changed files with 34 additions and 2795 deletions

View File

@@ -0,0 +1,389 @@
<template>
<section class="AppPartyHistory">
<div v-if="isShow" style="height: 100%">
<!-- 头部搜索样式 -->
<div class="fixed-top" style="width:100%;">
<div class="search-box">
<div class="search-input flex-row" @click="changeSearchBox">
<img src="https://cdn.cunwuyun.cn/img/search-red.svg"/>
<span class="color-fff">请输入文章标题</span>
</div>
</div>
<!-- 选择时间和类型 -->
<div class="slect flex-row">
<!-- 类型选择 -->
<div class="uni-list type-slect">
<div class="uni-list-cell">
<div class="uni-list-cell-db">
<picker @change="bindPickerChange" :value="index" :range="array" range-key="dictName">
<div class="uni-input">{{ partyType }}</div>
<img src="https://cdn.cunwuyun.cn/img/down.svg"/>
</picker>
</div>
</div>
</div>
<!-- 时间选择 -->
<div class="uni-list type-slect">
<div class="uni-list-cell">
<div class="uni-list-cell-db">
<picker
mode="date"
:value="date"
:start="startDate"
:end="endDate"
@change="bindDateChange"
fields="month"
>
<div class="uni-input">{{ day }}</div>
<img src="https://cdn.cunwuyun.cn/img/down.svg"/>
</picker>
</div>
</div>
</div>
</div>
</div>
<!-- 党务公开列表 -->
<div class="affairs-list">
<div class="affairs" v-if="affairsList.length > 0">
<!-- 循环 v-for -->
<div v-for="(item, index) in affairsList" :key="index">
<div class="affairs-item" @click="getDetail(item.id)">
<div class="break-word">
<span class="type">{{ $dict.getLabel(`partyHistoryType${style}`, item.type) }}</span>
<span class="affirs-title">{{ item.title }}</span>
</div>
<div class="created-unit flex-row">
<span>{{ item.organizationName || "" }}</span>
<span>{{ item.createDate }}</span>
</div>
</div>
</div>
</div>
</div>
<AiEmpty v-if="affairsList.length == 0"/>
</div>
<div v-if="!isShow" class="search-input">
<div class="input-box flex-row">
<input
type="text"
class="input"
placeholder="请输入文章标题"
focus="false"
v-model="searchValue"
@blur="onBlur"
/>
<img
class="sousuo"
src="https://cdn.cunwuyun.cn/img/search-active.svg"
/>
<img
v-if="searchValue"
@tap="clearInput"
class="clear"
src="https://cdn.cunwuyun.cn/img/empty-Input.svg"
/>
<div class="search-word" @click="search">搜索</div>
</div>
</div>
</section>
</template>
<script>
import {mapState} from "vuex";
export default {
name: "AppPartyHistory",
appName: "党史文章",
data() {
const currentDate = this.getDate({
format: true,
});
return {
inputValue: "请输入文章标题",
isShow: true,
array: [],
index: 0,
partyType: "类型",
partyTypeIndex: "", //类型index 0:党务公开,1:三会一课
date: currentDate,
day: "时间",
createData: "", //创建时间
affairsList: [],
searchValue: "", //搜索框输入值
pageNum: 1,
pageSize: 10,
pages: 2,
style: '',
};
},
computed: {
startDate() {
return this.getDate("start");
},
endDate() {
return this.getDate("end");
},
...mapState(["user"]),
},
onLoad(option) {
this.style = option.style
this.$dict.load("partyHistoryType0", "partyHistoryType1", "partyHistoryType2").then(() => {
this.array = this.$dict.getDict(`partyHistoryType${this.style}`)
this.array.unshift({dictName: "全部类型", dictValue: ""})
this.getPartyList()
})
},
methods: {
bindPickerChange(e) {
this.partyType = this.array[e.detail.value].dictName;
this.partyTypeIndex = this.array[e.detail.value].dictValue;
this.pageNum = 1;
this.pages = 2;
this.pageSize = 10;
this.getPartyList();
},
bindDateChange: function (e) {
this.day = e.target.value;
this.createData =
e.target.value + "-" + "08" + " " + "00" + ":" + "00" + ":" + "00";
this.pageNum = 1;
this.pages = 2;
this.pageSize = 10;
this.getPartyList();
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === "start") {
year = year - 60;
} else if (type === "end") {
year = year + 2;
}
month = month > 9 ? month : "0" + month;
day = day > 9 ? day : "0" + day;
return `${year}-${month}-08 00:00:00 `;
},
changeSearchBox() {
this.isShow = false;
},
onBlur(e) {
this.searchValue = e.target.value;
if (this.searchValue) {
this.inputValue = this.searchValue;
} else {
this.inputValue = "请输入文章标题";
}
},
search() {
this.isShow = true;
this.pageNum = 1;
this.pageSize = 10;
this.pages = 2;
this.getPartyList();
},
clearInput() {
this.searchValue = "";
this.inputValue = "请输入文章标题";
},
getDetail(id) {
uni.navigateTo({
url: `./detail?id=${id}`,
});
},
getPartyList() {
if (this.pageNum > this.pages) return;
this.$http.post(`/app/apppartyhistory/listWechat`, {
condition: this.searchValue,
style: this.style,
type: this.partyTypeIndex,
createDate: this.createData,
current: this.pageNum,
size: this.pageSize,
// organizationId: this.user.partyOrgId
}).then((res) => {
if (res.code == 0) {
const affairsList = this.pageNum > 1 ? [...this.affairsList, ...res.data.records] : res.data.records;
this.pages = Math.ceil(res.data.total / 10);
this.affairsList = affairsList;
}
});
},
},
onReachBottom() {
this.pageNum = this.pageNum + 1;
this.getPartyList();
},
};
</script>
<style lang="scss" scope>
@import "../../../common/common.css";
.AppPartyHistory {
.search-box {
width: 100%;
height: 112px;
background-color: #e60012;
padding: 24px 32px;
box-sizing: border-box;
.search-input {
line-height: 64px;
width: 100%;
height: 100%;
background: #ce0010;
// background:rgba(0,0,0,1);
border-radius: 32px;
// opacity: 0.1;
color: #f0cbcd;
font-size: 26px;
img {
width: 40px;
height: 40px;
margin: 8px 8px 8px 24px;
position: relative;
top: 6px;
}
.color-fff {
color: #fff;
}
}
}
.slect {
width: 100%;
height: 96px;
background-color: #fff;
color: #666;
.type-slect {
width: 50%;
border-right: 1px solid #f7f7f7;
margin: 30px 0;
box-sizing: border-box;
text-align: center;
font-size: 26px;
.uni-input {
display: inline-block;
}
img {
width: 32px;
height: 32px;
display: inline-block;
position: relative;
top: 6px;
margin-left: 8 srpx;
}
}
.type-slect:nth-child(2) {
border: none;
}
}
.affairs-list {
width: 100%;
// height:calc(100% - 210rpx);
// overflow-y: auto;
padding-top: 200px;
.affairs {
background-color: #fff;
margin: 32px;
.affairs-item {
padding: 32px;
box-sizing: border-box;
.type {
padding: 8px;
box-sizing: border-box;
background-color: #e6edf7;
color: #135ab8;
font-size: 26px;
margin-right: 16px;
border-radius: 8px;
}
.affirs-title {
color: #333333;
font-size: 32px;
}
.created-unit {
font-size: 28px;
color: #999;
justify-content: space-between;
margin-top: 16px;
}
}
}
}
.no-affairs {
width: 100%;
height: calc(100% - 210rpx);
display: flex;
justify-content: center;
align-items: center;
}
.search-input {
// width:100%;
// height:112rpx;
.input-box {
width: 100%;
height: 112px;
background-color: #fff;
padding: 24px 32px;
box-sizing: border-box;
position: relative;
.sousuo {
position: absolute;
top: 35px;
left: 60px;
width: 40px;
height: 40px;
}
.input {
background-color: #f3f3f3;
width: 598px;
height: 64px;
color: #999999;
font-size: 26px;
margin-left: 8px;
border-radius: 32px;
padding-left: 70px;
padding-right: 60px;
box-sizing: border-box;
}
.clear {
width: 32px;
height: 32px;
position: absolute;
top: 40px;
right: 130px;
z-index: 10;
}
.search-word {
font-size: 28px;
color: #135ab8;
line-height: 60px;
margin-left: 20px;
}
}
}
}
</style>

View File

@@ -0,0 +1,145 @@
<template>
<div>
<scroll-view
scroll-y
class="commentList"
@scrolltolower="page.current++, getComments()"
>
<div class="comments-list" v-if="commentList.length">
<div
class="comments-item flex-row"
v-for="(item, i) in commentList"
:key="i"
>
<div class="user-avatar">
<image v-if="item.avatar" :src="item.avatar"></image>
<image v-else src="https://cdn.cunwuyun.cn/img/personal.png"></image>
</div>
<div class="content flex-column">
<div class="flex-row" style="justify-content: space-between">
<text>{{ item.createUser }}</text>
<text class="commentTime">{{ item.commentTime }}</text>
</div>
<div>{{ item.content }}</div>
</div>
</div>
</div>
<AiEmpty v-else />
<view class="tips" v-if="commentList.length"> 已加载全部评论</view>
</scroll-view>
</div>
</template>
<script>
export default {
name: "commentList",
props: {
detail: Object,
},
data() {
return {
commentList: [],
page: {
current: 1,
size: 10000,
},
};
},
methods: {
getComments() {
this.$http.post(`/app/apppartyhistorycomment/list?partyHistoryId=${this.detail.id}&size=10000`).then((res) => {
if (res && res.data) {
this.commentList = res.data.records;
this.$emit("comments", res.data.total);
}
});
},
},
mounted() {
this.$nextTick(() => this.getComments());
},
};
</script>
<style lang="scss" scoped>
.commentList {
width: 100%;
margin-bottom: 135px;
overflow-y: auto;
.comments-list {
width: 100%;
overflow-y: auto;
box-sizing: border-box;
.user-avatar {
display: inline-block;
width: 80rpx;
margin: 46rpx 20rpx 0 0;
image {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
.user-bg {
display: inline-block;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
line-height: 80rpx;
text-align: center;
background-color: #26f;
color: #fff;
font-size: 28rpx;
}
}
.comments-item {
border-bottom: 1px solid #f7f7f7;
padding: 0 32px;
color: #333;
font-size: 28px;
background-color: #fff;
& + .comments-item {
border-top: 4px solid #eee;
}
.content {
display: inline-block;
width: calc(100% - 120rpx);
background-color: #fff;
padding: 46px 0 32px 0;
box-sizing: border-box;
.name {
margin-bottom: 10px;
}
}
.commentTime {
color: #999;
font-size: 24px;
}
}
}
.tips {
line-height: 90px;
width: 100%;
color: #999;
font-size: 24px;
text-align: center;
background-color: #f3f6f9;
}
.no-comment-list {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
}
}
</style>

View File

@@ -0,0 +1,278 @@
<template>
<div class="page">
<div>
<div v-if="!showCommentList" class="detail">
<!-- 文章标题 -->
<div class="created-unit">
<div class="artical-title break-word">{{ affairs.title }}</div>
<div class="artical-unit">
<span> 发布党组织 {{ affairs.organizationName || "-" }}</span>
</div>
<div class="artical-unit">
<text>发布时间{{ affairs.createDate }}</text>
<text />
</div>
</div>
<!-- 文章内容 -->
<div class="artical-content break-word">
<u-parse :html="affairs.content" class="content" v-if="affairs.content"></u-parse>
</div>
<!-- 语音播报-->
<AiTransSpeech :src="affairs.speech" v-if="affairs.speech"/>
</div>
<commentList v-else :detail="affairs"></commentList>
<AiComment
:comment-count="commentCount"
@submitComment="submitComment"
@showCommentList="showCommentList = true"
/>
</div>
</div>
</template>
<script>
import { mapState } from "vuex";
import commentList from './commentList'
export default {
name: "policyDetail",
components: {commentList},
computed: {
...mapState(["user"]),
},
data() {
return {
affairs: {},
showCommentList: false,
commentCount: 0,
};
},
onLoad(options) {
this.$dict.load("policyPromotionType");
this.id = options.id;
this.getPartyAffairsDetail(this.id);
this.getCount();
},
methods: {
getCount() {
this.$http.post(`/app/apppartyhistorycomment/list?partyHistoryId=${this.id}`).then((res) => {
if (res && res.data) {
this.commentCount = res.data.total;
}
});
},
getPartyAffairsDetail(id) {
this.$http.post(`/app/apppartyhistory/queryDetailByIdWeChat?id=${id}`).then((res) => {
if (res && res.data) {
res.data.createDate = res.data.createDate.substring(0, 10);
const regex = new RegExp("<img", "gi");
res.data.content = res.data.content
.replace(
regex,
`<img style="max-width:100%!important;" calss="img"`
)
.replace(/<p([\s\w"=\/\.:;]+)((?:(class="[^"]+")))/gi, "<p")
.replace(/<p>/gi, '<p class="p_class">')
.replace(/style=""/g, 'style="max-width:100%!important;"');
res.data.content = res.data.content.replace(
/<img[^>]*>/gi,
function (match) {
return match.replace(
/style\s*?=\s*?(["])[\s\S]*?\1/gi,
'style="max-width:100%;"'
); // 替换style
}
);
if (res.data.files && res.data.files.length) {
res.data.files.map(item => {
var size = item.size / 1024;
item.fileSize = size.toFixed(0);
return item
})
}
this.affairs = { ...res.data };
}
});
},
back() {
if (getCurrentPages().length === 1) {
uni.switchTab({
url: "/pages/home/home",
});
return false;
}
this.showCommentList
? (this.showCommentList = false)
: uni.navigateBack();
},
submitComment(content) {
this.$http
.post("/app/apppartyhistorycomment/addOrUpdate", {
partyHistoryId: this.affairs.id,
content: content,
name: this.user.nickName,
avatar: this.user.avatarUrl,
organizationId: this.affairs.organizationId
})
.then((res) => {
if (res && res.code == 0) {
uni.showToast({ icon: "success", title: "评论成功" });
this.showCommentList = true
this.getCount()
} else {
uni.showToast({ icon: "none", title: res.msg });
}
})
.catch((err) => {
uni.showToast({ icon: "none", title: err });
});
},
},
};
</script>
<style lang="scss" scoped>
@import "../../../common/common.css";
.page {
.navHeadBar {
display: flex;
justify-content: space-between;
align-items: center;
background: #135ab8;
color: #fff;
font-size: 13px;
height: 40px;
}
.detail {
width: 100%;
overflow-y: auto;
.created-unit {
width: 100%;
padding: 32px;
box-sizing: border-box;
background-color: #D40A05;
color: #fff;
.artical-title {
font-size: 40px;
}
.artical-unit {
font-size: 28px;
margin-top: 16px;
opacity: 0.8;
}
}
.artical-content {
color: #666666;
font-size: 32px;
padding: 32px 32px 128px 32px;
box-sizing: border-box;
background-color: #fff;
.p_class {
margin-top: 40px;
font-size: 32px;
color: #333;
text-indent: 0;
width: 100%;
}
.img {
width: 100% !important;
}
}
.attachment {
width: 100%;
padding: 32px 32px 96px 32px;
box-sizing: border-box;
background-color: #ffffff;
margin-top: 16px;
.attachment-title {
font-size: 32px;
color: #333333;
font-weight: 500;
image {
width: 48px;
height: 48px;
vertical-align: middle;
}
}
}
}
}
.p_class {
margin-top: 40px;
font-size: 32px;
color: #333;
text-indent: 0;
width: 100%;
}
.img {
max-width: 100% !important;
}
.attachment {
width: 100%;
padding: 32px;
box-sizing: border-box;
background-color: #FFFFFF;
margin-top: 16px;
.attachment-title {
font-size: 32px;
color: #333333;
font-weight: 500;
image {
width: 48px;
height: 48px;
vertical-align: middle;
}
}
.attachment-item {
border: 1px solid rgba(204, 204, 204, 1);
padding: 16px;
box-sizing: border-box;
margin-top: 34px;
display: flex;
flex-direction: row;
justify-content: space-between;
border-radius: 8px;
.file-name {
justify-content: flex-start;
align-items: center;
image {
width: 96px;
height: 96px;
vertical-align: middle;
}
.title {
color: #333333;
font-size: 32px;
word-break: break-all;
flex: 1;
}
}
.size {
color: #999;
font-size: 28px;
display: flex;
justify-content: cemter;
align-items: center;
}
}
}
</style>