| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <style lang="scss">
- .preview {
- .el-form-item {
- margin-bottom: 15px;
- }
- label,
- p {
- line-height: 25px !important;
- }
- }
- .el-cascader {
- width: 100%;
- }
- a {
- text-decoration: none;
- color: #409eff;
- cursor: pointer;
- }
- // 右边
- .item-main {
- // margin:34px;
- // height:600px;
- // background: #FFFFFF;
- border: 1px solid #dddddd;
- box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.13);
- border-radius: 20px;
- .el-form.over_y {
- max-height: calc(100vh - 340px);
- }
- /deep/.el-form-item__label {
- float: none;
- }
- }
- // label样式
- .edit_label {
- /deep/.el-input__inner {
- background: #f5faff;
- border: 0px;
- padding: 0px;
- }
- }
- /deep/.opicon {
- font-weight: bold;
- padding: 5px;
- color: #3895fe;
- }
- .tpl_title {
- font-size: 18px;
- margin: 20px 0;
- }
- .tpl_form {
- margin: 20px;
- border: 1px solid #ccc;
- border-radius: 20px;
- /deep/.el-form-item {
- background: none;
- }
- /deep/.el-form-item__content {
- width: 100%;
- }
- }
- .survey_logo {
- position: relative;
- top: 15px;
- left: 20px;
- }
- .result_dialog .el-dialog {
- width: 40%;
- margin-top: 20vh !important;
- }
- .result-item {
- height: 35px;
- .label {
- font-weight: 600;
- }
- }
- .syncitem{
- height:72px;
- line-height:72px;
- display:flex;
- justify-content:space-between;
- border-bottom:1px solid #ccc;
- }
- .syncitem img{
- margin:10px;
- }
- .syncbtn{
- margin-top:20px;
- text-align: center;
- }
- </style>
- <template>
- <section>
- <p><span>信息管理></span>文章管理</p>
- <div class="content">
- <div class="filter">
- <el-form
- size="small"
- label-width="70px"
- :inline="true"
- label-position="left"
- >
- <el-form-item label="">
- <el-input
- clearable
- placeholder="请输入标题"
- v-model="form.name"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="search">搜索</el-button>
- </el-form-item>
- <el-form-item style="float: right">
- <el-button @click="syncToMP" type="primary"
- >同步到公众号</el-button
- >
- <el-button @click="addArticle" type="primary">发布文章</el-button>
- </el-form-item>
- </el-form>
- </div>
- <el-table
- class="table"
- :data="list"
- height="50vh"
- border
- v-loading="loading"
- default-expand-all
- row-key="id"
- style="width: 100%"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55"> </el-table-column>
- <el-table-column prop="name" label="文章名称"> </el-table-column>
- <el-table-column prop="img" label="封面图">
- <template slot-scope="scope">
- <img :src="scope.row.img" alt="" width="120" height="80">
- </template>
- </el-table-column>
- <el-table-column prop="author" label="作者"></el-table-column>
- <el-table-column prop="journal_name" label="来源"></el-table-column>
- <el-table-column prop="publish_time" label="出版时间"></el-table-column>
- <el-table-column prop="ctime" label="发布时间"></el-table-column>
- <el-table-column prop="read_num" label="阅读量"></el-table-column>
- <el-table-column prop="zip" width="150" label="操作">
- <template slot-scope="scope">
- <el-button class="edit" type="text" @click="edit(scope.row)"
- >编辑</el-button
- >
- <el-button class="del" @click="del(scope.row.id)" type="text"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- <Page
- ref="pageButton"
- :current="form.page"
- :page_size="form.page_size"
- :total="total"
- @pageChange="gopage"
- />
- <!-- 同步到微信公众号 -->
- <el-dialog
- class="fu-dialog"
- title="同步到微信公众号" width="375px"
- :close-on-click-modal="false"
- :visible.sync="dialogVisible"
- >
- <!-- <div>
- <img :src="journalLogo" alt="">
- </div> -->
- <div>
- <div v-if="multipleSelection" style="position:relative;">
- <img :src="multipleSelection[0].img" alt="" width="310px" height="157px">
- <p style="position:absolute;bottom:20px;left:20px;font-weight:bold;color:#ffffff;">{{multipleSelection[0].name}}</p>
- </div>
- <div v-if="multipleSelection">
- <div class="syncitem" v-for="(item,index) in multipleSelection" :key="index">
- <p>{{item.name.substring(0,20)}}</p>
- <img :src="item.img" alt="" width="48px" height="48px">
- </div>
- </div>
- </div>
- <div class="syncbtn">
- <el-button type="normal" size="small" @click="dialogVisible=false">取消</el-button>
- <el-button type="primary" size="small">确定</el-button>
- </div>
- </el-dialog>
- </div>
- </section>
- </template>
- <script>
- import Page from "../../components/Page";
- import fuEditor from "../../components/fuEditor";
- export default {
- components: {
- Page,
- fuEditor,
- },
- data() {
- return {
- form: { name: "", page: 1, page_size: 20 },
- total: 1,
- list: [{ name: "2333" }],
- loading: false,
- rules: {
- name: [{ required: true, message: "请输入标题", trigger: "blur" }],
- },
- dialogVisible:false,
- journalLogo:"",
- multipleSelection:''
- };
- },
- methods: {
- syncToMP(){
- if(!this.multipleSelection){
- this.$message.error("请勾选需要同步到公众号的文章!")
- return
- }
- console.log(this.multipleSelection)
- this.dialogVisible = true;
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- search() {
- let parm = this.form;
- this.getData();
- },
- openDiag() {
- this.form1 = {};
- this.dialogVisible = true;
- this.dialogTitle = "发送消息";
- },
- addArticle() {
- this.$router.push({ path: "/article/article/add" });
- },
- gopage(size) {
- if (size) {
- this.form.page_size = size;
- }
- this.form.page = this.$refs.pageButton.page;
- this.getData();
- },
- getData() {
- var parm = this.form;
- this.loading = true;
- this.$api.getArticleList(parm).then((res) => {
- console.log(res);
- this.list = res.data.data.list;
- this.total=res.data.data.total
- this.loading = false;
- });
- },
- del(id) {
- this.$confirm("确定删除吗", "提示", {
- type: "warning",
- }).then(() => {
- this.$api.delArticle({ id: id }).then((res) => {
- this.$message({
- message: "删除成功",
- type: "success",
- });
- this.getData();
- });
- });
- },
- edit(row) {
- this.$router.push({
- path: "/article/article/add",
- query: { id: row.id },
- });
- },
- save() {
- this.$refs["form1"].validate((valid) => {
- if (valid) {
- let parm = this.form1;
- let id = this.form1.id;
- parm.receiver_id = JSON.stringify(parm.receiver_id);
- if (id) {
- this.$api.editMessage(parm).then((res) => {
- if (res.data.code == 0) {
- this.$message({
- type: "success",
- message: "保存成功!",
- });
- } else {
- this.$message.error("保存失败!");
- }
- this.getData();
- this.dialogVisible = false;
- });
- } else {
- this.$api.addMessage(parm).then((res) => {
- if (res.data.code == 0) {
- this.$message({
- type: "success",
- message: "保存成功!",
- });
- } else {
- this.$message.error("保存失败!");
- }
- this.getData();
- this.dialogVisible = false;
- });
- }
- }
- });
- },
- },
- created() {
- this.getData();
- },
- };
- </script>
|