first commit

This commit is contained in:
675061370@qq.com
2024-04-04 21:28:09 +08:00
commit fe9661855e
4192 changed files with 618218 additions and 0 deletions
+320
View File
@@ -0,0 +1,320 @@
<!DOCTYPE html>
<html>
<head>
<title>{$node.node_title}</title>
{include file="common/header"/}
<el-form :inline="true" @submit.native.prevent>
<el-form-item>
<el-button icon="el-icon-plus" size="small" @click="clickAdd" plain>添加资源</el-button>
<el-button icon="el-icon-plus" size="small" @click="ImportShow" plain>导入资源</el-button>
</el-form-item>
<div style="float:right">
<el-form-item>
<el-input placeholder="输入关键词搜索" size="small" v-model="search.keyword" @keyup.enter.native="getList_search"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="getList_search" plain>搜索
</el-button>
<el-button icon="el-icon-refresh-left" size="small" @click="getList_search(0)" plain>重置</el-button>
</el-form-item>
</div>
</el-form>
<el-table :data="dataList.data" v-loading="loading">
<el-table-column prop="source_id" label="ID" width="60">
</el-table-column>
<el-table-column prop="title" label="资源名称">
</el-table-column>
<el-table-column prop="url" label="资源地址" align="center">
</el-table-column>
<el-table-column prop="create_time" label="入库时间" align="center" width="200">
</el-table-column>
<el-table-column prop="update_time" label="更新时间" align="center" width="200">
</el-table-column>
<el-table-column label="操作" width="180" align="center">
<template slot-scope="scope">
<div class="order-text">
<p>
<el-link type="success" @click="clickEdit(scope.row)" :underline="false">编辑</el-link>
</p>
<p>
<el-link type="danger" @click="clickDelete(scope.row)" :underline="false">删除</el-link>
</p>
</div>
</template>
</el-table-column>
</el-table>
<div class="page">
<el-pagination @size-change="handleSizeChange" :page-sizes="[10, 20, 50, 100,200,500]" :page-size="10"
layout="total, sizes, prev, pager, next, jumper" background @current-change="changeCurrentPage"
:current-page="dataList.current_page" :page-count="dataList.last_page" :total="dataList.total">
</el-pagination>
</div>
<!-- 添加框 -->
<el-dialog title="添加资源" :visible.sync="dialogFormAdd" :modal-append-to-body='false' append-to-body
:close-on-click-modal='false' width="680px">
<el-form :model="formAdd" :rules="rules" ref="formAdd">
<el-form-item prop="title" label="资源名称" :label-width="formLabelWidth">
<el-input size="medium" autocomplete="off" placeholder="请输入资源名称" v-model="formAdd.title"></el-input>
</el-form-item>
<el-form-item prop="url" label="资源地址" :label-width="formLabelWidth">
<el-input size="medium" autocomplete="off" placeholder="请输入资源地址" v-model="formAdd.url"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="postAdd()">确认添加</el-button>
</div>
</el-dialog>
<!-- 修改框 -->
<el-dialog title="修改资源" :visible.sync="dialogFormEdit" :modal-append-to-body='false' append-to-body
:close-on-click-modal='false' width="680px">
<el-form :model="formEdit" :rules="rules" ref="formEdit">
<el-form-item prop="title" label="资源名称" :label-width="formLabelWidth">
<el-input size="medium" autocomplete="off" placeholder="请输入资源名称" v-model="formEdit.title"></el-input>
</el-form-item>
<el-form-item prop="url" label="资源地址" :label-width="formLabelWidth">
<el-input size="medium" autocomplete="off" placeholder="请输入资源地址" v-model="formEdit.url"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="postEdit()">确认修改</el-button>
</div>
</el-dialog>
<!-- 导入数据 -->
<el-dialog title="导入资源" :visible.sync="dialogImport" :modal-append-to-body='false' append-to-body
:close-on-click-modal='false' width="600px">
<el-form :model="Importform">
<el-form-item label="" :label-width="formLabelWidth">
<el-upload class="upload-demo" :data="Importform" name="file"
ref="ImportUpload"
drag
:auto-upload="false"
limit="1"
:on-exceed="handleExceed"
:on-success="handleAvatarSuccess"
action="/admin/source/imports"
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
</el-upload>
<span style="color: #999;">请导入夸克官方导出的csv文件</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="ImportPost()">提交</el-button>
</div>
</el-dialog>
{include file="common/footer"/}
<script>
var app = new Vue({
el: '#app',
data() {
return {
search: {
keyword: "",
filter: "title"
},
formLabelWidth: '120px',
dialogFormAdd: false,
dialogFormEdit: false,
loading: true,
dataList: [],
form: {
page: 1,
per_page: 10,
order: 'source_id desc'
},
formAdd: {
},
formEdit: {
},
rules: {
title: [{ required: true, message: '请输入资源名称', trigger: 'blur' }],
url: [{ required: true, message: '请输入资源地址', trigger: 'blur' }],
},
dialogImport: false,
Importform: {
},
}
},
created() {
this.getList();
},
methods: {
getList_search(val) {
if (val == 0) {
this.search = {
keyword: "",
filter: "title"
}
}
this.form.page = 1;
this.getList();
},
handleSizeChange(per_page) {
this.form.per_page = per_page;
this.getList();
},
postEdit() {
var that = this;
that.$refs["formEdit"].validate((valid) => {
if (valid) {
axios.post('/admin/source/update', Object.assign({}, PostBase, that.formEdit))
.then(function (response) {
that.getList();
if (response.data.code == CODE_SUCCESS) {
that.$message({
message: response.data.message,
type: 'success'
});
that.dialogFormEdit = false;
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
console.log(error);
});
}
});
},
postAdd() {
var that = this;
that.$refs['formAdd'].validate((valid) => {
if (valid) {
axios.post('/admin/source/add', Object.assign({}, PostBase, that.formAdd))
.then(function (response) {
that.getList();
if (response.data.code == CODE_SUCCESS) {
that.$message({
message: response.data.message,
type: 'success'
});
that.dialogFormAdd = false;
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
});
}
});
},
clickAdd() {
var that = this;
that.formAdd = { status: 1, share_image: '' };
that.dialogFormAdd = true;
},
clickDelete(row) {
var that = this;
this.$confirm('删除后,资源将无法查看,是否继续删除?', '删除提醒', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.post('/admin/source/delete', Object.assign({}, PostBase, {
source_id: row.source_id
}))
.then(function (response) {
that.getList();
if (response.data.code == CODE_SUCCESS) {
that.$message({
message: response.data.message,
type: 'success'
});
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
});
}).catch(() => {
});
},
clickEdit(row) {
var that = this;
that.formEdit = row;
axios.post('/admin/source/detail', Object.assign({}, PostBase, {
source_id: row.source_id
}))
.then(function (response) {
if (response.data.code == CODE_SUCCESS) {
that.formEdit = response.data.data;
that.dialogFormEdit = true;
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.$message.error('服务器内部错误');
});
},
changeCurrentPage(page) {
this.form.page = page;
this.getList();
},
getList() {
var that = this;
that.loading = true;
axios.post('/admin/source/getList', Object.assign({}, PostBase, that.form, that.search))
.then(function (response) {
that.loading = false;
if (response.data.code == CODE_SUCCESS) {
that.dataList = response.data.data;
} else {
that.$message.error(response.data.message);
}
})
.catch(function (error) {
that.loading = false;
that.$message.error('服务器内部错误');
});
},
//导入数据
ImportShow() {
this.Importform = {
}
this.dialogImport = true
},
handleExceed(files, fileList) {
this.$message.warning(`只能选择一个文件`);
},
handleAvatarSuccess(res, file) {
if (res.code == 200) {
this.getList();
this.$message({
message: res.message,
type: 'success'
});
this.dialogImport = false;
} else {
this.$message.error(res.message);
}
this.$refs.ImportUpload.clearFiles();
},
ImportPost(){
this.Importform = Object.assign(this.Importform, PostBase)
this.$nextTick(() => {
this.$refs.ImportUpload.submit();
})
},
}
})
</script>
</html>