|
@@ -5,22 +5,12 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<div class="top">
|
|
|
- <el-input placeholder="用户名称" class="input-demo" v-model="username"></el-input>
|
|
|
- <el-input placeholder="公司名称" class="input-demo" v-model="company"></el-input>
|
|
|
- <el-input placeholder="appKey" class="input-demo" v-model="appKey"></el-input>
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <div class="top">
|
|
|
+ <el-input placeholder="新闻标题" class="input-demo" v-model="title"></el-input>
|
|
|
<el-button type="success" style="margin-left: 1%;" @click="queryLook">查询</el-button>
|
|
|
<el-button type="success" style="margin-left: 1%;" @click="addUserList = true">添加</el-button>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
-
|
|
|
</div>
|
|
|
<!-- 头部细节部分结束 -->
|
|
|
<!-- 表格部分 -->
|
|
@@ -43,22 +33,15 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
label="创建时间"
|
|
|
- show-overflow-tooltip>
|
|
|
+ show-overflow-tooltip
|
|
|
+ width="180">
|
|
|
<template slot-scope="scope" show-overflow-tooltip>
|
|
|
<span>{{scope.row.createTime | fmtDate}}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- <el-table-column
|
|
|
- label="状态"
|
|
|
- show-overflow-tooltip>
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.status == 1">正常</span>
|
|
|
- <span v-else-if="scope.row.status == 2" style="color: red">锁定</span>
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
<el-table-column
|
|
|
label="操作"
|
|
|
- width="200">
|
|
|
+ width="120">
|
|
|
<template slot-scope="scope" show-overflow-tooltip>
|
|
|
<span style="cursor:pointer;" @click="openChange(scope.row)">修改</span>
|
|
|
<span style="margin-left: 10px; cursor:pointer; color: red;" @click="Delete(scope.row.id)">删除</span>
|
|
@@ -83,8 +66,7 @@
|
|
|
<!-- 新增新闻 -->
|
|
|
<el-dialog
|
|
|
@close="handleEditDialogClose"
|
|
|
- :visible.sync="addUserList"
|
|
|
- style="font-size: 0px;">
|
|
|
+ :visible.sync="addUserList">
|
|
|
<div class="tou">新闻--添加</div>
|
|
|
<div class="line"></div>
|
|
|
<el-form
|
|
@@ -102,7 +84,20 @@
|
|
|
<el-input v-model="formList.newsAbstract" auto-complete="off" placeholder="请输入新闻摘要"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="新闻封面" prop="photoId">
|
|
|
+ <el-form-item label="新闻封面">
|
|
|
+ <el-upload
|
|
|
+ ref='upload'
|
|
|
+ action="http://192.168.1.199:18083/newsmess/save_news"
|
|
|
+ list-type="picture-card"
|
|
|
+ :on-preview="handlePreview"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :on-change="handleSuccess"
|
|
|
+ :auto-upload="false">
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <!-- <el-form-item label="新闻封面" prop="photoId">
|
|
|
<el-upload
|
|
|
class="anniu"
|
|
|
ref="upload"
|
|
@@ -113,7 +108,7 @@
|
|
|
:auto-upload="false">
|
|
|
<el-button slot="trigger" size="small" type="primary">选取封面</el-button>
|
|
|
</el-upload>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
<el-form-item label="导航分类">
|
|
|
<el-tree
|
|
@@ -146,11 +141,11 @@
|
|
|
<!-- 富文本编辑器组件 -->
|
|
|
<el-row v-loading="quillUpdateImg">
|
|
|
<quill-editor
|
|
|
- v-model="detailContent"
|
|
|
- ref="myQuillEditor"
|
|
|
- :options="editorOption"
|
|
|
- @change="onEditorChange($event)"
|
|
|
- @ready="onEditorReady($event)">
|
|
|
+ v-model="detailContent"
|
|
|
+ ref="myQuillEditor"
|
|
|
+ :options="editorOption"
|
|
|
+ @change="onEditorChange($event)"
|
|
|
+ @ready="onEditorReady($event)">
|
|
|
</quill-editor>
|
|
|
</el-row>
|
|
|
</template>
|
|
@@ -163,46 +158,89 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- 修改新闻 -->
|
|
|
- <!-- <el-dialog
|
|
|
+ <el-dialog
|
|
|
@close="handleEditDialogClose"
|
|
|
- :visible.sync="changeUser"
|
|
|
- style="font-size: 0px;">
|
|
|
- <div class="tou">用户--修改</div>
|
|
|
+ :visible.sync="changeUser">
|
|
|
+ <div class="tou">新闻--修改</div>
|
|
|
<div class="line"></div>
|
|
|
<el-form
|
|
|
label-position="right"
|
|
|
label-width="80px"
|
|
|
:model="formChangeList">
|
|
|
+ <el-form-item label="新闻标题">
|
|
|
+ <el-input v-model="formChangeList.title" auto-complete="off" placeholder="请输入新闻标题"></el-input>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-form-item label="密码" prop="password">
|
|
|
- <el-input v-model="formChangeList.password" auto-complete="off" placeholder="请输入密码"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="公司名称" prop="company">
|
|
|
- <el-input v-model="formChangeList.company" auto-complete="off" placeholder="请输入公司名称"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="新闻摘要">
|
|
|
+ <el-input v-model="formChangeList.newsAbstract" auto-complete="off" placeholder="请输入新闻摘要"></el-input>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-form-item label="联系人" prop="contactName">
|
|
|
- <el-input v-model="formChangeList.contactName" auto-complete="off" placeholder="请输入密码"></el-input>
|
|
|
+ <el-form-item label="新闻封面">
|
|
|
+ <el-upload
|
|
|
+ ref='upload'
|
|
|
+ action="http://192.168.1.199:18083/app/photo"
|
|
|
+ list-type="picture-card"
|
|
|
+ :on-preview="handlePreview"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :on-change="handleSuccess"
|
|
|
+ :auto-upload="false">
|
|
|
+ <i class="el-icon-plus"></i>
|
|
|
+ </el-upload>
|
|
|
+ <img style="width: 150px; height: 150px;" :src="dialogImageUrl" alt="">
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="手机号" prop="telephone">
|
|
|
- <el-input v-model="formChangeList.telephone" auto-complete="off" placeholder="请输入手机号"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <!-- <el-form-item label="新闻封面">
|
|
|
+ <el-upload
|
|
|
+ class="anniu"
|
|
|
+ ref="upload"
|
|
|
+ action="http://192.168.1.199:18083/newsmess/save_news"
|
|
|
+ :on-preview="handlePreview"
|
|
|
+ :on-remove="handleRemove"
|
|
|
+ :on-change="handleSuccess"
|
|
|
+ :auto-upload="false">
|
|
|
+ <el-button slot="trigger" size="small" type="primary">选取封面</el-button>
|
|
|
+ <img style="width: 150px; height: 150px;" :src= "dialogImageUrl" alt="">
|
|
|
+ </el-upload>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
- <el-form-item label="单价" prop="price">
|
|
|
- <el-input v-model="formChangeList.price" auto-complete="off" placeholder="请输入单价"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="导航分类">
|
|
|
+ <el-tree
|
|
|
+ :data="menuList"
|
|
|
+ show-checkbox
|
|
|
+ default-expand-all
|
|
|
+ check-strictly
|
|
|
+ node-key="id"
|
|
|
+ ref="tree"
|
|
|
+ highlight-current
|
|
|
+ :default-checked-keys="haveRight"
|
|
|
+ :props="defaultProps">
|
|
|
+ </el-tree>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- <el-form-item label="用户状态">
|
|
|
- <el-select v-model="formChangeList.status" placeholder="用户状态" style="width: 100%">
|
|
|
- <el-option
|
|
|
- v-for="item in optionone"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-form-item label="新闻内容">
|
|
|
+ <template>
|
|
|
+ <!-- 图片上传组件辅助 -->
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action="serverUrl"
|
|
|
+ name="photo"
|
|
|
+ :headers="header"
|
|
|
+ :show-file-list="false"
|
|
|
+ :on-success="uploadSuccessOne"
|
|
|
+ :on-error="uploadErrorOne"
|
|
|
+ :before-upload="beforeUploadOne">
|
|
|
+ </el-upload>
|
|
|
+ <!-- 富文本编辑器组件 -->
|
|
|
+ <el-row v-loading="quillUpdateImg">
|
|
|
+ <quill-editor
|
|
|
+ v-model="detailContent"
|
|
|
+ ref="myQuillEditor"
|
|
|
+ :options="editorOption"
|
|
|
+ @change="onEditorChange($event)"
|
|
|
+ @ready="onEditorReady($event)">
|
|
|
+ </quill-editor>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
@@ -210,7 +248,7 @@
|
|
|
<el-button @click="changeUser = false" type="info">取 消</el-button>
|
|
|
<el-button type="primary" @click="changeData">修 改</el-button>
|
|
|
</div>
|
|
|
- </el-dialog> -->
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -237,73 +275,36 @@ const toolbarOptions = [
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ title: "",
|
|
|
usertable: [],
|
|
|
formList: {
|
|
|
"urlList": [],
|
|
|
"title": "",
|
|
|
"newsAbstract": "",
|
|
|
"photo": "",
|
|
|
- "navigationBarId": "1",
|
|
|
+ "navigationBarIds": [],
|
|
|
"content": "",
|
|
|
},
|
|
|
- editorOption: {},
|
|
|
defaultProps: {
|
|
|
- children: 'children',
|
|
|
- label: 'label'
|
|
|
+ children: 'childList',
|
|
|
+ label: 'name'
|
|
|
},
|
|
|
- menuList: [{
|
|
|
- id: 1,
|
|
|
- label: '一级 1',
|
|
|
- children: [{
|
|
|
- id: 4,
|
|
|
- label: '二级 1-1',
|
|
|
- children: [{
|
|
|
- id: 9,
|
|
|
- label: '三级 1-1-1'
|
|
|
- }, {
|
|
|
- id: 10,
|
|
|
- label: '三级 1-1-2'
|
|
|
- }]
|
|
|
- }]
|
|
|
- }, {
|
|
|
- id: 2,
|
|
|
- label: '一级 2',
|
|
|
- children: [{
|
|
|
- id: 5,
|
|
|
- label: '二级 2-1'
|
|
|
- }, {
|
|
|
- id: 6,
|
|
|
- label: '二级 2-2'
|
|
|
- }]
|
|
|
- }, {
|
|
|
- id: 3,
|
|
|
- label: '一级 3',
|
|
|
- children: [{
|
|
|
- id: 7,
|
|
|
- label: '二级 3-1'
|
|
|
- }, {
|
|
|
- id: 8,
|
|
|
- label: '二级 3-2'
|
|
|
- }]
|
|
|
- }],
|
|
|
+ menuList: [],
|
|
|
haveRight:[],
|
|
|
- // formChangeList: {
|
|
|
- // "id": "",
|
|
|
- // "password": "",
|
|
|
- // "company": "",
|
|
|
- // "contactName": "",
|
|
|
- // "telephone": "",
|
|
|
- // "price": "",
|
|
|
- // "status": ""
|
|
|
- // },
|
|
|
-
|
|
|
- optionone: [{
|
|
|
- value: '1',
|
|
|
- label: '正常'
|
|
|
- }, {
|
|
|
- value: '2',
|
|
|
- label: '锁定'
|
|
|
- }],
|
|
|
+ treeIds:[],
|
|
|
+ dialogImageUrl:"",
|
|
|
+ flag: 0,
|
|
|
+ formChangeList: {
|
|
|
+ "id": "",
|
|
|
+ "urlList": [],
|
|
|
+ "title": "",
|
|
|
+ "newsAbstract": "",
|
|
|
+ "photo": "",
|
|
|
+ "navigationBarIds": [],
|
|
|
+ "content": "",
|
|
|
+ },
|
|
|
+ picList: [],
|
|
|
+ photoList: [],
|
|
|
current: 1,
|
|
|
pagesize: 10,
|
|
|
// 总共有多少条数据
|
|
@@ -322,15 +323,6 @@ export default {
|
|
|
modules: {
|
|
|
toolbar: {
|
|
|
container: toolbarOptions, // 工具栏
|
|
|
- // handlers: {
|
|
|
- // 'image': function (value) {
|
|
|
- // if (value) {
|
|
|
- // alert(1)
|
|
|
- // } else {
|
|
|
- // this.quill.format('image', false);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
handlers: {
|
|
|
'image': function (value) {
|
|
|
if (value) {
|
|
@@ -349,6 +341,7 @@ export default {
|
|
|
|
|
|
created() {
|
|
|
this.loadData();
|
|
|
+ this.loadTree();
|
|
|
},
|
|
|
methods: {
|
|
|
// 列表展示
|
|
@@ -361,15 +354,24 @@ export default {
|
|
|
this.total = response.data.responseData.total;
|
|
|
}
|
|
|
},
|
|
|
+ //展示树形导航
|
|
|
+ async loadTree() {
|
|
|
+ const response = await this.$http.get(`app/menu`);
|
|
|
+ if (response.data.code === 1) {
|
|
|
+ // console.log(response.data.responseData)
|
|
|
+ this.menuList = response.data.responseData;
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
//查询
|
|
|
- // async queryLook() {
|
|
|
- // const response = await this.$http.get(`app/page/newsArticle?¤t=${this.current}&size=${this.pagesize}&appKey=${this.appKey}&username=${this.username}&company=${this.company}`);
|
|
|
- // if (response.data.code === 1) {
|
|
|
- // this.loading = false;
|
|
|
- // this.usertable = response.data.responseData.records;
|
|
|
- // this.total = response.data.responseData.total;
|
|
|
- // }
|
|
|
- // },
|
|
|
+ async queryLook() {
|
|
|
+ const response = await this.$http.get(`app/page/newsArticle?¤t=${this.current}&size=${this.pagesize}&title=${this.title}`);
|
|
|
+ if (response.data.code === 1) {
|
|
|
+ this.loading = false;
|
|
|
+ this.usertable = response.data.responseData.records;
|
|
|
+ this.total = response.data.responseData.total;
|
|
|
+ }
|
|
|
+ },
|
|
|
// 新增新闻
|
|
|
addData(formName) {
|
|
|
this.$refs[formName].validate(async (valid) => {
|
|
@@ -378,7 +380,11 @@ export default {
|
|
|
formData.append('photo', this.formList.photo);
|
|
|
formData.append('title', this.formList.title);
|
|
|
formData.append('newsAbstract', this.formList.newsAbstract);
|
|
|
- formData.append('navigationBarId', this.formList.navigationBarId);
|
|
|
+ this.treeIds = this.$refs.tree.getCheckedNodes(false, true);
|
|
|
+ for(var i = 0; i < this.treeIds.length; i++) {
|
|
|
+ this.formList.navigationBarIds.push(this.treeIds[i].id);
|
|
|
+ };
|
|
|
+ formData.append('navigationBarIds', this.formList.navigationBarIds);
|
|
|
formData.append('content', this.formList.content);
|
|
|
formData.append('urlList', this.formList.urlList);
|
|
|
const response = await this.$http.post(`app/newsArticle`, formData);
|
|
@@ -403,9 +409,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 富文本图片上传前
|
|
|
- beforeUpload() {
|
|
|
+ beforeUpload(file) {
|
|
|
// 显示loading动画
|
|
|
this.quillUpdateImg = true;
|
|
|
+
|
|
|
},
|
|
|
uploadSuccess(res, file) {
|
|
|
// res为图片服务器返回的数据
|
|
@@ -421,7 +428,7 @@ export default {
|
|
|
quill.insertEmbed(length, 'image', res.responseData);
|
|
|
// alert(res.responseData)
|
|
|
this.formList.urlList.push(res.responseData);
|
|
|
- console.log(this.formList.urlList);
|
|
|
+ // console.log(this.formList.urlList);
|
|
|
// 调整光标到最后
|
|
|
quill.setSelection(length + 1);
|
|
|
} else {
|
|
@@ -436,44 +443,126 @@ export default {
|
|
|
this.quillUpdateImg = false;
|
|
|
this.$message.error('图片插入失败');
|
|
|
},
|
|
|
- // 新增新闻内容
|
|
|
- onEditorReady(editor) { // 准备编辑器
|
|
|
+
|
|
|
+ //修改新闻内容时候上传的图片地址
|
|
|
+ // 富文本图片上传前
|
|
|
+ beforeUploadOne(file) {
|
|
|
+ // 显示loading动画
|
|
|
+ this.quillUpdateImg = true;
|
|
|
+
|
|
|
+ },
|
|
|
+ uploadSuccessOne(res, file) {
|
|
|
+ // res为图片服务器返回的数据
|
|
|
+ // 获取富文本组件实例
|
|
|
+ let quill = this.$refs.myQuillEditor.quill;
|
|
|
+ // console.log(quill)
|
|
|
+ // 如果上传成功
|
|
|
+ if (res.code == 1) {
|
|
|
+ // 获取光标所在位置
|
|
|
+ let length = quill.getSelection().index;
|
|
|
+ // console.log(length)
|
|
|
+ // 插入图片 res.info为服务器返回的图片地址
|
|
|
+ quill.insertEmbed(length, 'image', res.responseData);
|
|
|
+ // alert(res.responseData)
|
|
|
+ this.formChangeList.urlList.push(res.responseData);
|
|
|
+ // console.log(this.formList.urlList);
|
|
|
+ // 调整光标到最后
|
|
|
+ quill.setSelection(length + 1);
|
|
|
+ } else {
|
|
|
+ this.$message.error('图片插入失败');
|
|
|
+ }
|
|
|
+ // loading动画消失
|
|
|
+ this.quillUpdateImg = false;
|
|
|
},
|
|
|
+ // 富文本图片上传失败
|
|
|
+ uploadErrorOne() {
|
|
|
+ // loading动画消失
|
|
|
+ this.quillUpdateImg = false;
|
|
|
+ this.$message.error('图片插入失败');
|
|
|
+ },
|
|
|
+ // 新增新闻内容
|
|
|
+ onEditorReady(editor) { },// 准备编辑器
|
|
|
onEditorBlur(){}, // 失去焦点事件
|
|
|
onEditorFocus(){}, // 获得焦点事件
|
|
|
onEditorChange(event){
|
|
|
this.formList.content = event.html;
|
|
|
- console.log(this.formList.content)
|
|
|
- }, // 内容改变事件
|
|
|
|
|
|
|
|
|
+ var imgReg = /<img.*?(?:>|\/>)/gi;
|
|
|
+ var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i;
|
|
|
+ this.picList = event.html.match(imgReg);
|
|
|
+ if( this.picList == []) {
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ for (var i = 0; i < this.picList.length; i++) {
|
|
|
+ var src = this.picList[i].match(srcReg);
|
|
|
+ //获取图片地址
|
|
|
+ // console.log('图片地址'+(i+1)+':'+src[1]);
|
|
|
+ // console.log(src[1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.photoList.push(src);
|
|
|
+ // console.log(this.photoList);
|
|
|
+ // console.log(event.html)
|
|
|
+ // console.log(document.getElementsByTagName('img'));
|
|
|
+ // this.picList.push(document.getElementsByTagName('img').src);
|
|
|
+ // console.log(this.picList)
|
|
|
+ // console.log(this.formList.content)
|
|
|
+ }, // 内容改变事件
|
|
|
+
|
|
|
// 打开修改并赋予信息
|
|
|
- openChange(user) {
|
|
|
+ async openChange(user) {
|
|
|
this.changeUser = true;
|
|
|
this.formChangeList.id = user.id;
|
|
|
- this.formChangeList.password = user.password;
|
|
|
- this.formChangeList.company = user.company;
|
|
|
- this.formChangeList.contactName = user.contactName;
|
|
|
- this.formChangeList.telephone = user.telephone;
|
|
|
- this.formChangeList.price = user.price;
|
|
|
- // this.formChangeList.status = user.status;
|
|
|
+ this.formChangeList.title = user.title;
|
|
|
+ this.formChangeList.newsAbstract = user.newsAbstract;
|
|
|
+ this.dialogImageUrl = user.photoUrl;
|
|
|
+ this.detailContent = user.content;
|
|
|
+ const response = await this.$http.get(`app/newsArticle/${user.id}`);
|
|
|
+ if(response.data.code === 1) {
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.haveRight = response.data.responseData.navigationBarIds;
|
|
|
+ this.formChangeList.urlList = response.data.responseData.urlList;
|
|
|
+ console.log(this.formChangeList.urlList);
|
|
|
+ // console.log(response.data.responseData)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- // 修改用户
|
|
|
+ // 修改新闻
|
|
|
async changeData() {
|
|
|
- const response = await this.$http.put(`app/user`, this.formChangeList);
|
|
|
- if(response.data.code === 1) {
|
|
|
- this.loadData();
|
|
|
- this.changeUser = false;
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '修改成功'
|
|
|
- });
|
|
|
- }else {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '修改失败'
|
|
|
- });
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('id', this.formChangeList.id);
|
|
|
+ if(this.flag == 1) {
|
|
|
+ formData.append('photo', this.formChangeList.photo);
|
|
|
}
|
|
|
+
|
|
|
+ formData.append('title', this.formChangeList.title);
|
|
|
+ formData.append('newsAbstract', this.formChangeList.newsAbstract);
|
|
|
+ formData.append('urlList', this.formChangeList.urlList);
|
|
|
+ console.log(this.formChangeList.urlList)
|
|
|
+ this.treeIds = this.$refs.tree.getCheckedNodes(false, true);
|
|
|
+ for(var i = 0; i < this.treeIds.length; i++) {
|
|
|
+ this.formChangeList.navigationBarIds.push(this.treeIds[i].id);
|
|
|
+ };
|
|
|
+ formData.append('navigationBarIds', this.formChangeList.navigationBarIds);
|
|
|
+ formData.append('content', this.detailContent);
|
|
|
+
|
|
|
+ // const response = await this.$http.put(`app/newsArticle`, formData);
|
|
|
+ // if(response.data.code === 1) {
|
|
|
+ // this.loadData();
|
|
|
+ // this.changeUser = false;
|
|
|
+ // this.$message({
|
|
|
+ // type: 'success',
|
|
|
+ // message: '修改新闻成功'
|
|
|
+ // });
|
|
|
+ // }else {
|
|
|
+ // this.$message({
|
|
|
+ // type: 'error',
|
|
|
+ // message: '修改新闻失败'
|
|
|
+ // });
|
|
|
+ // }
|
|
|
},
|
|
|
// 点击删除按钮
|
|
|
Delete(id) {
|
|
@@ -487,12 +576,12 @@ export default {
|
|
|
this.loadData();
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
- message: '删除成功'
|
|
|
+ message: '删除新闻成功'
|
|
|
});
|
|
|
}else {
|
|
|
this.$message({
|
|
|
type: 'error',
|
|
|
- message: '删除失败'
|
|
|
+ message: '删除新闻失败'
|
|
|
});
|
|
|
}
|
|
|
}).catch(() => {
|
|
@@ -500,74 +589,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
- // 打开修改状态弹框
|
|
|
- openisLock(user) {
|
|
|
- this.changelocks = true;
|
|
|
- this.formStateList.id = user.id;
|
|
|
- },
|
|
|
- // 修改用户状态
|
|
|
- async changeLock() {
|
|
|
- const response = await this.$http.put(`app/user`, this.formStateList);
|
|
|
- if(response.data.code === 1) {
|
|
|
- this.loadData();
|
|
|
- this.changelocks = false;
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '修改成功'
|
|
|
- });
|
|
|
- }else {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '修改失败'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- //打开用户添加角色
|
|
|
- openRole(id) {
|
|
|
- this.changeRole= true;
|
|
|
- this.formRoList.userId = id;
|
|
|
- // console.log(this.formRoleList.userId);
|
|
|
- },
|
|
|
- //用户添加角色
|
|
|
- async userAddRole() {
|
|
|
- const response = await this.$http.post(`app/userRolePermission`, this.formRoList);
|
|
|
- if(response.data.code === 1) {
|
|
|
- this.loadData();
|
|
|
- this.changeRole = false;
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '添加成功'
|
|
|
- });
|
|
|
- }else {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '添加失败'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- // 充值打开弹框
|
|
|
- openMoney(id) {
|
|
|
- this.changeMoney = true;
|
|
|
- this.formMoneyList.userId = id + '';
|
|
|
- },
|
|
|
- //充值
|
|
|
- async userChangeMoney() {
|
|
|
- const response = await this.$http.post(`app/recharge`, this.formMoneyList);
|
|
|
- if(response.data.code === 1) {
|
|
|
- this.loadData();
|
|
|
- this.changeMoney = false;
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '充值成功'
|
|
|
- });
|
|
|
- }else {
|
|
|
- this.$message({
|
|
|
- type: 'error',
|
|
|
- message: '充值失败'
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
// 上传图片功能
|
|
|
handleRemove(file, fileList) {
|
|
|
console.log(file, fileList);
|
|
@@ -578,6 +599,12 @@ export default {
|
|
|
},
|
|
|
handleSuccess (a) {
|
|
|
this.formList.photo = a.raw;
|
|
|
+ if(a !== '') {
|
|
|
+ this.flag = 1
|
|
|
+ this.formChangeList.photo = a.raw;
|
|
|
+ }else {
|
|
|
+ this.flag = 0
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
// 清空表单数据
|
|
@@ -586,32 +613,21 @@ export default {
|
|
|
this.formList[key] = '';
|
|
|
};
|
|
|
this.formList.urlList = [];
|
|
|
+ this.formList.navigationBarIds = [];
|
|
|
+ //清除图片缓存
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
|
|
|
this.formList.content = '';
|
|
|
- // this.$refs.myQuillEditor.quill = '';
|
|
|
-
|
|
|
- // this.$refs.myQuillEditor.html = '';
|
|
|
-
|
|
|
- // this.$refs.myQuillEditor = '';
|
|
|
-
|
|
|
- // for (var key in this.formChangeList) {
|
|
|
- // this.formChangeList[key] = '';
|
|
|
- // };
|
|
|
- // for (var key in this.formStateList) {
|
|
|
- // this.formStateList[key] = '';
|
|
|
- // };
|
|
|
- // for (var key in formRoleList) {
|
|
|
- // formRoleList[key] = '';
|
|
|
- // };
|
|
|
- // for (var key in formMoneyList) {
|
|
|
- // formMoneyList[key] = '';
|
|
|
- // };
|
|
|
|
|
|
+ this.$refs.tree.setCheckedKeys([]);
|
|
|
+ this.haveRight = [];
|
|
|
+ this.detailContent = '';
|
|
|
+ this.formChangeList.navigationBarIds = [];
|
|
|
},
|
|
|
// 分页方法
|
|
|
handleSizeChange(val) {
|
|
|
this.pagesize = val;
|
|
|
- if(this.username !== '' || this.company !== '' || this.appKey !== '') {
|
|
|
+ if(this.title !== '') {
|
|
|
this.queryLook();
|
|
|
}else{
|
|
|
this.loadData();
|
|
@@ -620,7 +636,7 @@ export default {
|
|
|
},
|
|
|
handleCurrentChange(val) {
|
|
|
this.current = val;
|
|
|
- if(this.username !== '' || this.company !== '' || this.appKey !== '') {
|
|
|
+ if(this.title !== '') {
|
|
|
this.queryLook();
|
|
|
}else{
|
|
|
this.loadData();
|