|
@@ -0,0 +1,690 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="journalism">
|
|
|
|
+ <!-- 头部细节部分 -->
|
|
|
|
+ <div class="title">
|
|
|
|
+ <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-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>
|
|
|
|
+ <!-- 头部细节部分结束 -->
|
|
|
|
+ <!-- 表格部分 -->
|
|
|
|
+ <template>
|
|
|
|
+ <el-table
|
|
|
|
+ v-loading="loading"
|
|
|
|
+ ref="multipleTable"
|
|
|
|
+ :data="usertable"
|
|
|
|
+ border
|
|
|
|
+ tooltip-effect="dark">
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="新闻标题"
|
|
|
|
+ prop="title"
|
|
|
|
+ show-overflow-tooltip>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="newsAbstract"
|
|
|
|
+ label="新闻摘要"
|
|
|
|
+ show-overflow-tooltip>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ label="创建时间"
|
|
|
|
+ show-overflow-tooltip>
|
|
|
|
+ <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">
|
|
|
|
+ <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>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ <!-- 分页 -->
|
|
|
|
+ <div class="block">
|
|
|
|
+ <el-pagination
|
|
|
|
+ @size-change="handleSizeChange"
|
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
|
+ :current-page="current"
|
|
|
|
+ :page-sizes="[6, 8, 10]"
|
|
|
|
+ :page-size="pagesize"
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
+ :total="total">
|
|
|
|
+ </el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <!-- 新增新闻 -->
|
|
|
|
+ <el-dialog
|
|
|
|
+ @close="handleEditDialogClose"
|
|
|
|
+ :visible.sync="addUserList"
|
|
|
|
+ style="font-size: 0px;">
|
|
|
|
+ <div class="tou">新闻--添加</div>
|
|
|
|
+ <div class="line"></div>
|
|
|
|
+ <el-form
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="80px"
|
|
|
|
+ :rules="rules"
|
|
|
|
+ ref="ruleForm"
|
|
|
|
+ :model="formList">
|
|
|
|
+
|
|
|
|
+ <el-form-item label="新闻标题" prop="title">
|
|
|
|
+ <el-input v-model="formList.title" auto-complete="off" placeholder="请输入新闻标题"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="新闻摘要" prop="newsAbstract">
|
|
|
|
+ <el-input v-model="formList.newsAbstract" auto-complete="off" placeholder="请输入新闻摘要"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="新闻封面" prop="photoId">
|
|
|
|
+ <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>
|
|
|
|
+ </el-upload>
|
|
|
|
+ </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"
|
|
|
|
+ style="font-size: 0px;">
|
|
|
|
+ </el-tree>
|
|
|
|
+ </el-form-item>
|
|
|
|
+
|
|
|
|
+ <el-form-item label="新闻内容" prop="content">
|
|
|
|
+ <template>
|
|
|
|
+ <!-- 图片上传组件辅助 -->
|
|
|
|
+ <el-upload
|
|
|
|
+ class="avatar-uploader"
|
|
|
|
+ :action="serverUrl"
|
|
|
|
+ name="photo"
|
|
|
|
+ :headers="header"
|
|
|
|
+ :show-file-list="false"
|
|
|
|
+ :on-success="uploadSuccess"
|
|
|
|
+ :on-error="uploadError"
|
|
|
|
+ :before-upload="beforeUpload">
|
|
|
|
+ </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>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="addUserList = false" type="info">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="addData('ruleForm')">新 增</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ <!-- 修改新闻 -->
|
|
|
|
+ <!-- <el-dialog
|
|
|
|
+ @close="handleEditDialogClose"
|
|
|
|
+ :visible.sync="changeUser"
|
|
|
|
+ style="font-size: 0px;">
|
|
|
|
+ <div class="tou">用户--修改</div>
|
|
|
|
+ <div class="line"></div>
|
|
|
|
+ <el-form
|
|
|
|
+ label-position="right"
|
|
|
|
+ label-width="80px"
|
|
|
|
+ :model="formChangeList">
|
|
|
|
+
|
|
|
|
+ <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="联系人" prop="contactName">
|
|
|
|
+ <el-input v-model="formChangeList.contactName" auto-complete="off" placeholder="请输入密码"></el-input>
|
|
|
|
+ </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="单价" prop="price">
|
|
|
|
+ <el-input v-model="formChangeList.price" auto-complete="off" placeholder="请输入单价"></el-input>
|
|
|
|
+ </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>
|
|
|
|
+
|
|
|
|
+ </el-form>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="changeUser = false" type="info">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="changeData">修 改</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog> -->
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script type="text/javascript">
|
|
|
|
+const toolbarOptions = [
|
|
|
|
+ ['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
|
|
|
+ ['blockquote', 'code-block'],
|
|
|
|
+
|
|
|
|
+ [{'header': 1}, {'header': 2}], // custom button values
|
|
|
|
+ [{'list': 'ordered'}, {'list': 'bullet'}],
|
|
|
|
+ [{'script': 'sub'}, {'script': 'super'}], // superscript/subscript
|
|
|
|
+ [{'indent': '-1'}, {'indent': '+1'}], // outdent/indent
|
|
|
|
+ [{'direction': 'rtl'}], // text direction
|
|
|
|
+
|
|
|
|
+ [{'size': ['small', false, 'large', 'huge']}], // custom dropdown
|
|
|
|
+ [{'header': [1, 2, 3, 4, 5, 6, false]}],
|
|
|
|
+
|
|
|
|
+ [{'color': []}, {'background': []}], // dropdown with defaults from theme
|
|
|
|
+ [{'font': []}],
|
|
|
|
+ [{'align': []}],
|
|
|
|
+ ['link', 'image', 'video'],
|
|
|
|
+ ['clean'] // remove formatting button
|
|
|
|
+]
|
|
|
|
+export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ usertable: [],
|
|
|
|
+ formList: {
|
|
|
|
+ "urlList": [],
|
|
|
|
+ "title": "",
|
|
|
|
+ "newsAbstract": "",
|
|
|
|
+ "photo": "",
|
|
|
|
+ "navigationBarId": "1",
|
|
|
|
+ "content": "",
|
|
|
|
+ },
|
|
|
|
+ editorOption: {},
|
|
|
|
+ defaultProps: {
|
|
|
|
+ children: 'children',
|
|
|
|
+ label: 'label'
|
|
|
|
+ },
|
|
|
|
+ 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'
|
|
|
|
+ }]
|
|
|
|
+ }],
|
|
|
|
+ haveRight:[],
|
|
|
|
+ // formChangeList: {
|
|
|
|
+ // "id": "",
|
|
|
|
+ // "password": "",
|
|
|
|
+ // "company": "",
|
|
|
|
+ // "contactName": "",
|
|
|
|
+ // "telephone": "",
|
|
|
|
+ // "price": "",
|
|
|
|
+ // "status": ""
|
|
|
|
+ // },
|
|
|
|
+
|
|
|
|
+ optionone: [{
|
|
|
|
+ value: '1',
|
|
|
|
+ label: '正常'
|
|
|
|
+ }, {
|
|
|
|
+ value: '2',
|
|
|
|
+ label: '锁定'
|
|
|
|
+ }],
|
|
|
|
+ current: 1,
|
|
|
|
+ pagesize: 10,
|
|
|
|
+ // 总共有多少条数据
|
|
|
|
+ total: 0,
|
|
|
|
+ addUserList: false,
|
|
|
|
+ changeUser: false,
|
|
|
|
+ photo: '',
|
|
|
|
+ quillUpdateImg: false,
|
|
|
|
+ // serverUrl: '',
|
|
|
|
+ serverUrl: 'http://localhost:8088/api/app/upload', // 这里写你要上传的图片服务器地址
|
|
|
|
+ header: {Authorization: 'Bearer ' + sessionStorage.token}, //有的图片服务器要求请求头需要有token之类的参数,写在这里
|
|
|
|
+ detailContent: '', // 富文本内容
|
|
|
|
+ editorOption: {
|
|
|
|
+ placeholder: '',
|
|
|
|
+ theme: 'snow', // or 'bubble'
|
|
|
|
+ modules: {
|
|
|
|
+ toolbar: {
|
|
|
|
+ container: toolbarOptions, // 工具栏
|
|
|
|
+ // handlers: {
|
|
|
|
+ // 'image': function (value) {
|
|
|
|
+ // if (value) {
|
|
|
|
+ // alert(1)
|
|
|
|
+ // } else {
|
|
|
|
+ // this.quill.format('image', false);
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ handlers: {
|
|
|
|
+ 'image': function (value) {
|
|
|
|
+ if (value) {
|
|
|
|
+ // 触发input框选择图片文件
|
|
|
|
+ document.querySelector('.avatar-uploader input').click()
|
|
|
|
+ } else {
|
|
|
|
+ this.quill.format('image', false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ created() {
|
|
|
|
+ this.loadData();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 列表展示
|
|
|
|
+ async loadData() {
|
|
|
|
+ const response = await this.$http.get(`app/page/newsArticle?¤t=${this.current}&size=${this.pagesize}`);
|
|
|
|
+ if (response.data.code === 1) {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ this.usertable = response.data.responseData.records;
|
|
|
|
+ // console.log(response.data.responseData);
|
|
|
|
+ this.total = response.data.responseData.total;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //查询
|
|
|
|
+ // 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;
|
|
|
|
+ // }
|
|
|
|
+ // },
|
|
|
|
+ // 新增新闻
|
|
|
|
+ addData(formName) {
|
|
|
|
+ this.$refs[formName].validate(async (valid) => {
|
|
|
|
+ if(valid) {
|
|
|
|
+ const formData = new FormData();
|
|
|
|
+ formData.append('photo', this.formList.photo);
|
|
|
|
+ formData.append('title', this.formList.title);
|
|
|
|
+ formData.append('newsAbstract', this.formList.newsAbstract);
|
|
|
|
+ formData.append('navigationBarId', this.formList.navigationBarId);
|
|
|
|
+ formData.append('content', this.formList.content);
|
|
|
|
+ formData.append('urlList', this.formList.urlList);
|
|
|
|
+ const response = await this.$http.post(`app/newsArticle`, formData);
|
|
|
|
+ if(response.data.code === 1) {
|
|
|
|
+ this.loadData();
|
|
|
|
+ this.addUserList = false;
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '添加新闻成功'
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message: '添加新闻失败'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ this.$message.error('请查看是否有选项未填写或填错项');
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 富文本图片上传前
|
|
|
|
+ beforeUpload() {
|
|
|
|
+ // 显示loading动画
|
|
|
|
+ this.quillUpdateImg = true;
|
|
|
|
+ },
|
|
|
|
+ uploadSuccess(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.formList.urlList.push(res.responseData);
|
|
|
|
+ console.log(this.formList.urlList);
|
|
|
|
+ // 调整光标到最后
|
|
|
|
+ quill.setSelection(length + 1);
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error('图片插入失败');
|
|
|
|
+ }
|
|
|
|
+ // loading动画消失
|
|
|
|
+ this.quillUpdateImg = false;
|
|
|
|
+ },
|
|
|
|
+ // 富文本图片上传失败
|
|
|
|
+ uploadError() {
|
|
|
|
+ // loading动画消失
|
|
|
|
+ this.quillUpdateImg = false;
|
|
|
|
+ this.$message.error('图片插入失败');
|
|
|
|
+ },
|
|
|
|
+ // 新增新闻内容
|
|
|
|
+ onEditorReady(editor) { // 准备编辑器
|
|
|
|
+ },
|
|
|
|
+ onEditorBlur(){}, // 失去焦点事件
|
|
|
|
+ onEditorFocus(){}, // 获得焦点事件
|
|
|
|
+ onEditorChange(event){
|
|
|
|
+ this.formList.content = event.html;
|
|
|
|
+ console.log(this.formList.content)
|
|
|
|
+ }, // 内容改变事件
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 打开修改并赋予信息
|
|
|
|
+ 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;
|
|
|
|
+ },
|
|
|
|
+ // 修改用户
|
|
|
|
+ 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: '修改失败'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 点击删除按钮
|
|
|
|
+ Delete(id) {
|
|
|
|
+ this.$confirm('是否删除该用户', '提示' ,{
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(async () => {
|
|
|
|
+ const response = await this.$http.put(`app/newsArticle/${id}`);
|
|
|
|
+ if(response.data.code === 1) {
|
|
|
|
+ this.loadData();
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'success',
|
|
|
|
+ message: '删除成功'
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: 'error',
|
|
|
|
+ message: '删除失败'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.$message({ type: 'info', message: '已取消删除'});
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 打开修改状态弹框
|
|
|
|
+ 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);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ handlePreview(file) {
|
|
|
|
+ console.log(file);
|
|
|
|
+ },
|
|
|
|
+ handleSuccess (a) {
|
|
|
|
+ this.formList.photo = a.raw;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ // 清空表单数据
|
|
|
|
+ handleEditDialogClose() {
|
|
|
|
+ for (var key in this.formList) {
|
|
|
|
+ this.formList[key] = '';
|
|
|
|
+ };
|
|
|
|
+ this.formList.urlList = [];
|
|
|
|
+
|
|
|
|
+ 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] = '';
|
|
|
|
+ // };
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 分页方法
|
|
|
|
+ handleSizeChange(val) {
|
|
|
|
+ this.pagesize = val;
|
|
|
|
+ if(this.username !== '' || this.company !== '' || this.appKey !== '') {
|
|
|
|
+ this.queryLook();
|
|
|
|
+ }else{
|
|
|
|
+ this.loadData();
|
|
|
|
+ };
|
|
|
|
+ console.log(`每页 ${val} 条`);
|
|
|
|
+ },
|
|
|
|
+ handleCurrentChange(val) {
|
|
|
|
+ this.current = val;
|
|
|
|
+ if(this.username !== '' || this.company !== '' || this.appKey !== '') {
|
|
|
|
+ this.queryLook();
|
|
|
|
+ }else{
|
|
|
|
+ this.loadData();
|
|
|
|
+ };
|
|
|
|
+ console.log(`当前页: ${val}`);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style>
|
|
|
|
+.journalism {
|
|
|
|
+ border: 1px solid #d9d9d9;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+}
|
|
|
|
+.journalism .title {
|
|
|
|
+ font-size: 5px;
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
+}
|
|
|
|
+.journalism .top {
|
|
|
|
+ padding-top: 20px;
|
|
|
|
+ padding-left: 20px;
|
|
|
|
+}
|
|
|
|
+.journalism .text {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ color: #000;
|
|
|
|
+ font-size: 16px ;
|
|
|
|
+ margin-left: 1%;
|
|
|
|
+}
|
|
|
|
+.journalism .input-demo {
|
|
|
|
+ display: inline-block;
|
|
|
|
+ width: 20%;
|
|
|
|
+ margin-left: 1%;
|
|
|
|
+}
|
|
|
|
+.journalism .block {
|
|
|
|
+ font-size: 5px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin-top: 25px;
|
|
|
|
+ margin-bottom: 25px;
|
|
|
|
+}
|
|
|
|
+.journalism .el-dialog {
|
|
|
|
+ width: 60%;
|
|
|
|
+}
|
|
|
|
+.journalism .el-dialog__header, .el-dialog__body {
|
|
|
|
+ padding: 0 20px;
|
|
|
|
+}
|
|
|
|
+.journalism .tou {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ height: 30px;
|
|
|
|
+ line-height: 30px;
|
|
|
|
+ padding-top: 15px;
|
|
|
|
+}
|
|
|
|
+.journalism .line {
|
|
|
|
+ margin-top: 15px;
|
|
|
|
+ margin-bottom: 15px;
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 2px;
|
|
|
|
+ background-color: #d9d9d9;
|
|
|
|
+}
|
|
|
|
+.journalism .xinxi {
|
|
|
|
+ text-align: center;
|
|
|
|
+ margin: 15px auto;
|
|
|
|
+ font-size: 18px;
|
|
|
|
+}
|
|
|
|
+</style>
|
|
|
|
+
|