backup: 2025-02-24

This commit is contained in:
Li Wei 2025-02-24 15:22:12 +08:00
commit 6d6bcf309d
9395 changed files with 702159 additions and 0 deletions

496
书店-图书-CPP/Books.h Normal file
View File

@ -0,0 +1,496 @@
#include <time.h>
#include <iostream>
#include <string>
#include <iomanip>
#define MAXSIZE 10000
using namespace std;
static int Bcount = 2;
static int Jcount = 2;
static double TTotal;
static int flag = 0;
class BookBase
{
private:
string ISBN = "00000000";
string Bname = "默认书籍";
int stock = 0;
double price = 0;
double total = 0;
public:
BookBase() {};
BookBase(string is, string nam, int s, double p)
{
ISBN = is;
Bname = nam;
stock = s;
price = p;
}
string getISBN() const { return ISBN; }
string getName() const { return Bname; }
int getStock() const { return stock; }
double getPrice() const { return price; }
double getTotal() const { return total; }
void modISBN(string i) { ISBN = i; }
void modName(string n) { Bname = n; }
void modStock(int st) { stock = st; }
void modPrice(double pr) { price = pr; }
void addStock(int s)
{
stock += s;
cout << "库存增加成功!目前库存为:" << getStock() << endl;
}
void outStock(int s)
{
if (s <= stock)
{
stock -= s;
cout << "销售成功!目前库存为:" << getStock() << endl;
total = s * price;
TTotal += total;
cout << "销售额为:" << getTotal() << endl;
flag = 1;
}
else
{
cerr << "库存不足,请检查,目前库存仅有" << getStock() << "" << endl;
return;
}
}
};
//期刊类
class Journal :public BookBase
{
private:
string express;
public:
Journal() {};
Journal(string is, string nam, int s, double p, string exp) :BookBase(is, nam, s, p) { express = exp; }
friend ostream& operator<<(ostream& output, const Journal& j);
string getExpress() const { return express; }
void modExpress(string ex) { express = ex; }
};
//输出流运算符重载
ostream& operator<<(ostream& output, const Journal& j)
{
cout.setf(ios_base::left);
output << j.getISBN() << "\t" << setw(25) << j.getName() << setw(20) << j.getExpress() << setw(15) << j.getPrice() << setw(15) << j.getStock() << endl;
return output;
}
//书籍类
class Book :public BookBase
{
private:
string author;
public:
Book() {};
Book(string is, string nam, int s, double p, string au) :BookBase(is, nam, s, p) { author = au; }
friend ostream& operator<<(ostream& output, const Book& b);
string getAuthor() const { return author; }
void modAuthor(string au) { author = au; }
};
//输出流运算符重载
ostream& operator<<(ostream& output, const Book& b)
{
cout.setf(ios_base::left);
output << b.getISBN() << "\t" << setw(25) << b.getName() << setw(20) << b.getAuthor() << setw(15) << b.getPrice() << setw(15) << b.getStock() << endl;
return output;
}
/*
*
*/
class Admin
{
private:
string ID;
public:
Admin() {};
string getID() const { return ID; }
Admin(string id) { ID = id; cout << this->getID() << ",欢迎您登陆管理系统!所有权限已开启。" << endl; }
void changeID(string id) { ID = id; }
void AddBook();
void DelBook();
void SearchBook();
void inStock();
void outStock();
void printAll();
void statics();
void modify();
};
//预置书籍类数据
static Book Books[MAXSIZE] = {
Book("9787302257646","程序设计基础",190,25,"张三"),
Book("9787302219972","单片机技术及应用",182,32,"李四")
};
//预置期刊类数据
static Journal Journals[MAXSIZE] = {
Journal("9787302257611","电脑爱好者",200,32,"北京大学出版社"),
Journal("9787302257622","无线电年刊",190,35,"江西财大出版社")
};
//输出所有Journal
void JournalsPrint()
{
cout << "———————— 期刊类 ————————" << endl;
cout.setf(ios_base::left);
cout << "序号\tISBN\t\t"<<setw(25)<<"期刊名"<<setw(20)<<"出版社"<<setw(15)<<"价格"<<setw(15)<<"库存" << endl;
for (int i = 0; i < Jcount; i++) cout << i + 1 << "\t" << Journals[i];
cout << endl;
}
//输出所有Book
void BooksPrint()
{
cout << "———————— 书籍类 ————————" << endl;
cout.setf(ios_base::left);
cout << "序号\tISBN\t\t" << setw(25) << "书名" << setw(20) << "作者" << setw(15) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Bcount; i++) cout << i + 1 << "\t" << Books[i];
cout << endl;
}
void Admin::statics()
{
char c;
if (flag)
{
cout << "------------------------------------------" << endl;
cout << setw(25) << internal << "销售统计" << endl;
cout << "总销售额:" << TTotal << endl;
cout << "是否将销售额导出至文件Y/N"; cin >> c;
if(c=='Y' || c=='y')
{
ofstream file;
file.open("销售额.txt", ios::out);
file << "总销售额:" << TTotal << endl;
file.close();
cout << "导出成功!" << endl;
}
cout << "------------------------------------------" << endl;
}
else
{
cerr << "无任何销售记录!" << endl;
}
}
//添加新书籍
void NewBook()
{
string ISBN;
string Bname;
int stock;
double price;
string author;
cout << "------------------------------------------" << endl;
cout << "正在添加新的书籍信息,当前已有书籍数目:" << Bcount << endl;
cout << "输入ISBN号"; cin >> ISBN;
cout << "请输入书名:"; cin >> Bname;
cout << "请输入库存:"; cin >> stock;
cout << "请输入价格:"; cin >> price;
cout << "请输入作者名:"; cin >> author;
Books[Bcount] = Book(ISBN, Bname, stock, price, author);
Bcount++;
cout << "添加成功!" << endl;
}
//添加新期刊
void NewJournal()
{
string ISBN;
string Bname;
int stock;
double price;
string express;
cout << "正在添加新的期刊信息,当前已有期刊数目:" << Bcount << endl;
cout << "输入ISBN号"; cin >> ISBN;
cout << "请输入期刊名:"; cin >> Bname;
cout << "请输入库存:"; cin >> stock;
cout << "请输入价格:"; cin >> price;
cout << "请输入作者名:"; cin >> express;
Journals[Jcount] = Journal(ISBN, Bname, stock, price, express);
Jcount++;
cout << "添加成功!" << endl;
}
//增加书刊
void Admin::AddBook()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>增加书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行增加操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: NewBook(); continue;
case 2: NewJournal(); continue;
case 0: break;
}
}
}
}
//删除书刊
void Admin::DelBook()
{
string s = "1";
while (1) {
cout << "请输入作者名、出版社名、期刊名、书名或ISBN号输入0返回主菜单";
cin >> s;
if (s == "0") break; //退出判断
int flag = 0; //查找成功状态符
//查找书籍类
for (int i = 0; i < Bcount; i++)
if (Books[i].getAuthor() == s || Books[i].getISBN() == s || Books[i].getName() == s)
{
flag = 1;
cout << "发现目标书籍如下是否删除该书籍信息Y 是 / N 否)"
<< endl << "------------------------"
<< endl << Books[i] << "------------------------" << endl << "请选择:";
char c; cin >> c;
if (c == 'Y' || c == 'y')
{
for (int j = i; j < Bcount - 1; j++)
{
Books[j] = Books[j + 1];
}
Bcount--;
}
else continue;
}
else continue;
//查找期刊类
for (int i = 0; i < Jcount; i++)
if (Journals[i].getExpress() == s || Journals[i].getISBN() == s || Journals[i].getName() == s)
{
flag = 1;
cout << "发现目标期刊如下是否删除该期刊信息Y 是 / N 否)"
<< endl << "------------------------"
<< endl << Journals[i] << "------------------------" << endl << "请选择:";
char c; cin >> c;
if (c == 'Y' || c == 'y')
{
for (int j = i; j < Jcount - 1; j++)
{
Journals[j] = Journals[j + 1];
}
Jcount--;
}
else continue;
}
else continue;
if (flag)cout << "删除成功!" << endl;
else cerr << "未找到目标书籍。" << endl;
}
}
//入库
void Admin::inStock()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>入库书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行入库操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1:
{
BooksPrint();
int a, b;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要增加的库存量是:"; cin >> b;
Books[a - 1].addStock(b);
continue;
}
case 2:
{
JournalsPrint();
int a, b;
cout << "要操作的期刊编号是:"; cin >> a;
if (a<1 || a>Jcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要增加的库存量是:"; cin >> b;
Books[a - 1].addStock(b);
continue;
}
case 0: break;
}
}
}
}
//修改书籍类
void modifyBook()
{
int select = 1;
BooksPrint();
int a, b;
string s;
int st;
double pr;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
}
else
{
cout << "1.ISBN\t2.书籍名称\t3.作者\t4.库存量\t5.价格\t0.放弃修改" << endl << "要修改的信息是:"; cin >> b;
switch (b)
{
case 1: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modISBN(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 2: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modName(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 3: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modAuthor(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 4: cout << "输入修改后的信息:"; cin >> st; Books[a - 1].modStock(st); cout << Books[a - 1] << "修改成功!" << endl; break;
case 5: cout << "输入修改后的信息:"; cin >> pr; Books[a - 1].modPrice(pr); cout << Books[a - 1] << "修改成功!" << endl; break;
case 0: break;
}
}
}
//修改期刊类
void modifyJournal()
{
int select = 1;
JournalsPrint();
int a, b;
string s;
int st;
double pr;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
}
else
{
cout << "1.ISBN\t2.书籍名称\t3.出版社\t4.库存量\t5.价格\t0.放弃修改" << endl << "要修改的信息是:"; cin >> b;
switch (b)
{
case 1: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modISBN(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 2: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modName(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 3: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modExpress(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 4: cout << "输入修改后的信息:"; cin >> st; Journals[a - 1].modStock(st); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 5: cout << "输入修改后的信息:"; cin >> pr; Journals[a - 1].modPrice(pr); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 0: break;
}
}
}
//修改书籍信息
void Admin::modify()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>修改书刊信息<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行修改操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: modifyBook(); continue;
case 2: modifyJournal(); continue;
case 0: break;
}
}
}
}
//入库
void Admin::outStock()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>销售书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行销售操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1:
{
BooksPrint();
int a, b;
cout << "要操作的书籍序号是:"; cin >> a;
if(a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "销售的库存量是:"; cin >> b;
Books[a - 1].outStock(b);
continue;
}
case 2:
{
JournalsPrint();
int a, b;
cout << "要操作的期刊序号是:"; cin >> a;
if (a<1 || a>Jcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要销售的库存量是:"; cin >> b;
Books[a - 1].outStock(b);
continue;
}
case 0: break;
}
}
}
}
//
inline void Admin::printAll()
{
BooksPrint();
JournalsPrint();
}

5
书店-图书-CPP/ID.txt Normal file
View File

@ -0,0 +1,5 @@
超级管理员
刘燕
李溦
钟琳
选此项以新建账户

View File

@ -0,0 +1,656 @@
#include <time.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
//#include “Book.h”
//#include “Admin.h”
#define MAXSIZE 10000
using namespace std;
//全局变量
string ID_Value; //存储新建账户名
string ID[5]; //存储ID列表
int ID_flag; //存储ID操作序号
fstream file; //文件对象
void MainLoop(); //声明RUNTIME函数
//book.h
static int Bcount = 2;
static int Jcount = 2;
static double TTotal;
static int flag = 0;
class BookBase
{
private:
string ISBN = "00000000";
string Bname = "默认书籍";
int stock = 0;
double price = 0;
double total = 0;
public:
BookBase() {};
BookBase(string is, string nam, int s, double p)
{
ISBN = is;
Bname = nam;
stock = s;
price = p;
}
string getISBN() const { return ISBN; }
string getName() const { return Bname; }
int getStock() const { return stock; }
double getPrice() const { return price; }
double getTotal() const { return total; }
void modISBN(string i) { ISBN = i; }
void modName(string n) { Bname = n; }
void modStock(int st) { stock = st; }
void modPrice(double pr) { price = pr; }
void addStock(int s)
{
stock += s;
cout << "库存增加成功!目前库存为:" << getStock() << endl;
}
void outStock(int s)
{
if (s <= stock)
{
stock -= s;
cout << "销售成功!目前库存为:" << getStock() << endl;
total = s * price;
TTotal += total;
cout << "销售额为:" << getTotal() << endl;
flag = 1;
}
else
{
cerr << "库存不足,请检查,目前库存仅有" << getStock() << "" << endl;
return;
}
}
};
//期刊类
class Journal :public BookBase
{
private:
string express;
public:
Journal() {};
Journal(string is, string nam, int s, double p, string exp) :BookBase(is, nam, s, p) { express = exp; }
friend ostream& operator<<(ostream& output, const Journal& j);
string getExpress() const { return express; }
void modExpress(string ex) { express = ex; }
};
//输出流运算符重载
ostream& operator<<(ostream& output, const Journal& j)
{
cout.setf(ios_base::left);
output << j.getISBN() << "\t" << setw(25) << j.getName() << setw(20) << j.getExpress() << setw(15) << j.getPrice() << setw(15) << j.getStock() << endl;
return output;
}
//书籍类
class Book :public BookBase
{
private:
string author;
public:
Book() {};
Book(string is, string nam, int s, double p, string au) :BookBase(is, nam, s, p) { author = au; }
friend ostream& operator<<(ostream& output, const Book& b);
string getAuthor() const { return author; }
void modAuthor(string au) { author = au; }
};
//输出流运算符重载
ostream& operator<<(ostream& output, const Book& b)
{
cout.setf(ios_base::left);
output << b.getISBN() << "\t" << setw(25) << b.getName() << setw(20) << b.getAuthor() << setw(15) << b.getPrice() << setw(15) << b.getStock() << endl;
return output;
}
/*
*
*/
//Admin.h
class Admin
{
private:
string ID;
public:
Admin() {};
string getID() const { return ID; }
Admin(string id) { ID = id; cout << this->getID() << ",欢迎您登陆管理系统!所有权限已开启。" << endl; }
void changeID(string id) { ID = id; }
void AddBook();
void DelBook();
void SearchBook();
void inStock();
void outStock();
void printAll();
void statics();
void modify();
};
//预置书籍类数据
static Book Books[MAXSIZE] = {
Book("9787302257646","程序设计基础",190,25,"张三"),
Book("9787302219972","单片机技术及应用",182,32,"李四")
};
//预置期刊类数据
static Journal Journals[MAXSIZE] = {
Journal("9787302257611","电脑爱好者",200,32,"北京大学出版社"),
Journal("9787302257622","无线电年刊",190,35,"江西财大出版社")
};
//输出所有Journal
void JournalsPrint()
{
cout << "———————— 期刊类 ————————" << endl;
cout.setf(ios_base::left);
cout << "序号\tISBN\t\t"<<setw(25)<<"期刊名"<<setw(20)<<"出版社"<<setw(15)<<"价格"<<setw(15)<<"库存" << endl;
for (int i = 0; i < Jcount; i++) cout << i + 1 << "\t" << Journals[i];
cout << endl;
}
//输出所有Book
void BooksPrint()
{
cout << "———————— 书籍类 ————————" << endl;
cout.setf(ios_base::left);
cout << "序号\tISBN\t\t" << setw(25) << "书名" << setw(20) << "作者" << setw(15) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Bcount; i++) cout << i + 1 << "\t" << Books[i];
cout << endl;
}
void Admin::statics()
{
char c;
if (flag)
{
cout << "------------------------------------------" << endl;
cout << setw(25) << internal << "销售统计" << endl;
cout << "总销售额:" << TTotal << endl;
cout << "是否将销售额导出至文件Y/N"; cin >> c;
if(c=='Y' || c=='y')
{
ofstream file;
file.open("销售额.txt", ios::out);
file << "总销售额:" << TTotal << endl;
file.close();
cout << "导出成功!" << endl;
}
cout << "------------------------------------------" << endl;
}
else
{
cerr << "无任何销售记录!" << endl;
}
}
//添加新书籍
void NewBook()
{
string ISBN;
string Bname;
int stock;
double price;
string author;
cout << "------------------------------------------" << endl;
cout << "正在添加新的书籍信息,当前已有书籍数目:" << Bcount << endl;
cout << "输入ISBN号"; cin >> ISBN;
cout << "请输入书名:"; cin >> Bname;
cout << "请输入库存:"; cin >> stock;
cout << "请输入价格:"; cin >> price;
cout << "请输入作者名:"; cin >> author;
Books[Bcount] = Book(ISBN, Bname, stock, price, author);
Bcount++;
cout << "添加成功!" << endl;
}
//添加新期刊
void NewJournal()
{
string ISBN;
string Bname;
int stock;
double price;
string express;
cout << "正在添加新的期刊信息,当前已有期刊数目:" << Bcount << endl;
cout << "输入ISBN号"; cin >> ISBN;
cout << "请输入期刊名:"; cin >> Bname;
cout << "请输入库存:"; cin >> stock;
cout << "请输入价格:"; cin >> price;
cout << "请输入作者名:"; cin >> express;
Journals[Jcount] = Journal(ISBN, Bname, stock, price, express);
Jcount++;
cout << "添加成功!" << endl;
}
//增加书刊
void Admin::AddBook()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>增加书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行增加操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: NewBook(); continue;
case 2: NewJournal(); continue;
case 0: break;
}
}
}
}
//删除书刊
void Admin::DelBook()
{
string s = "1";
while (1) {
cout << "请输入作者名、出版社名、期刊名、书名或ISBN号输入0返回主菜单";
cin >> s;
if (s == "0") break; //退出判断
int flag = 0; //查找成功状态符
//查找书籍类
for (int i = 0; i < Bcount; i++)
if (Books[i].getAuthor() == s || Books[i].getISBN() == s || Books[i].getName() == s)
{
flag = 1;
cout << "发现目标书籍如下是否删除该书籍信息Y 是 / N 否)"
<< endl << "------------------------"
<< endl << Books[i] << "------------------------" << endl << "请选择:";
char c; cin >> c;
if (c == 'Y' || c == 'y')
{
for (int j = i; j < Bcount - 1; j++)
{
Books[j] = Books[j + 1];
}
Bcount--;
}
else continue;
}
else continue;
//查找期刊类
for (int i = 0; i < Jcount; i++)
if (Journals[i].getExpress() == s || Journals[i].getISBN() == s || Journals[i].getName() == s)
{
flag = 1;
cout << "发现目标期刊如下是否删除该期刊信息Y 是 / N 否)"
<< endl << "------------------------"
<< endl << Journals[i] << "------------------------" << endl << "请选择:";
char c; cin >> c;
if (c == 'Y' || c == 'y')
{
for (int j = i; j < Jcount - 1; j++)
{
Journals[j] = Journals[j + 1];
}
Jcount--;
}
else continue;
}
else continue;
if (flag)cout << "删除成功!" << endl;
else cerr << "未找到目标书籍。" << endl;
}
}
//入库
void Admin::inStock()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>入库书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行入库操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1:
{
BooksPrint();
int a, b;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要增加的库存量是:"; cin >> b;
Books[a - 1].addStock(b);
continue;
}
case 2:
{
JournalsPrint();
int a, b;
cout << "要操作的期刊编号是:"; cin >> a;
if (a<1 || a>Jcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要增加的库存量是:"; cin >> b;
Books[a - 1].addStock(b);
continue;
}
case 0: break;
}
}
}
}
//修改书籍类
void modifyBook()
{
int select = 1;
BooksPrint();
int a, b;
string s;
int st;
double pr;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
}
else
{
cout << "1.ISBN\t2.书籍名称\t3.作者\t4.库存量\t5.价格\t0.放弃修改" << endl << "要修改的信息是:"; cin >> b;
switch (b)
{
case 1: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modISBN(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 2: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modName(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 3: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modAuthor(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 4: cout << "输入修改后的信息:"; cin >> st; Books[a - 1].modStock(st); cout << Books[a - 1] << "修改成功!" << endl; break;
case 5: cout << "输入修改后的信息:"; cin >> pr; Books[a - 1].modPrice(pr); cout << Books[a - 1] << "修改成功!" << endl; break;
case 0: break;
}
}
}
//修改期刊类
void modifyJournal()
{
int select = 1;
JournalsPrint();
int a, b;
string s;
int st;
double pr;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
}
else
{
cout << "1.ISBN\t2.书籍名称\t3.出版社\t4.库存量\t5.价格\t0.放弃修改" << endl << "要修改的信息是:"; cin >> b;
switch (b)
{
case 1: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modISBN(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 2: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modName(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 3: cout << "输入修改后的信息:"; cin >> s; Journals[a - 1].modExpress(s); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 4: cout << "输入修改后的信息:"; cin >> st; Journals[a - 1].modStock(st); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 5: cout << "输入修改后的信息:"; cin >> pr; Journals[a - 1].modPrice(pr); cout << Journals[a - 1] << "修改成功!" << endl; break;
case 0: break;
}
}
}
//修改书籍信息
void Admin::modify()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>修改书刊信息<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行修改操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: modifyBook(); continue;
case 2: modifyJournal(); continue;
case 0: break;
}
}
}
}
//入库
void Admin::outStock()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>销售书刊<<<<<<<<<<" << endl
<< setw(20) << "1.书籍类" << endl
<< setw(20) << "2.期刊类" << endl
<< setw(20) << "0.退出该操作" << endl;
while (select)
{
cout << "要对哪类进行销售操作输入0返回主菜单:";
cin >> select;
if (select < 0 || select > 2)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1:
{
BooksPrint();
int a, b;
cout << "要操作的书籍序号是:"; cin >> a;
if(a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "销售的库存量是:"; cin >> b;
Books[a - 1].outStock(b);
continue;
}
case 2:
{
JournalsPrint();
int a, b;
cout << "要操作的期刊序号是:"; cin >> a;
if (a<1 || a>Jcount)
{
cerr << "序号错误,请检查。" << endl;
break;
}
cout << "要销售的库存量是:"; cin >> b;
Books[a - 1].outStock(b);
continue;
}
case 0: break;
}
}
}
}
//输出所有库存
inline void Admin::printAll()
{
BooksPrint();
JournalsPrint();
}
//输出ID.txt
void ID_OUT()
{
file.open("ID.txt", ios::out);
if (!file)
{
cerr << "未检测到账户列表文件ID.txt保存失败。" << endl;
exit(1);
}
for (int i = 0; i < 5; i++)
file << ID[i] << endl;
file.close();
}
//读入ID.txt
void ID_IN()
{
file.open("ID.txt", ios::in);
if (!file)
{
cerr << "未检测到预置账户列表文件ID.txt请查看源代码末端的注释现已使用默认测试账户登录。" << endl;
ID_Value = "超级管理员";
MainLoop();
}
for (int i = 0; i < 5; i++)
file >> ID[i];
file.close();
}
//切换账户
void ID_Switch()
{
ID_IN();
for (int i = 0; i < 5; i++)
cout << i + 1 << "\t" << ID[i] << endl;
cout << "请选择要登录的账户:"; cin >> ID_flag;
if (ID_flag == 5 && ID[ID_flag-1] == "选此项以新建账户")
{
string tmp;
cout << "请输入新账户的ID"; cin >> tmp;
ID[4] = ID_Value = tmp;
cout << "新建账户成功并已写入账户列表!您现在拥有所有权限。" << endl;
ID_OUT();
}
else if (ID_flag < 1 || ID_flag>5)
{
cerr << "该账户不存在!程序将退出。" << endl;
abort();
}
else ID_Value = ID[ID_flag - 1];
cout << "-----------------------------------------------" << endl;
}
//导出库存信息
void fileOut()
{
file.open("书籍.txt", ios::out);
file<<"ISBN\t\t" << setw(25) << "书名" << setw(20) << "作者" << setw(15) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Bcount; i++) file << Books[i];
file.close();
file.open("期刊.txt", ios::out);
cout.setf(ios_base::left);
file << "ISBN\t\t" << setw(25) << "期刊名" << setw(20) << "出版社" << setw(20) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Jcount; i++)file << Journals[i];
cout << "已成功输出为'书籍.txt'与'期刊.txt'" << endl;
file.close();
}
//欢迎
void MainLoop()
{
cout << "==============================="
<< endl << setw(30) << "欢迎使用小型书店进销存管理系统"
<< endl << "==============================="
<< endl << "该程序仅用于江西财经大学张老师《C++程序设计语言》课程之期末综合性实验报告,作者:刘燕、李溦、钟琳"
<< endl << "-----------------------------------------------"
<< endl << "预置账户列表:" << endl;
ID_Switch();
MainLoop();
}
//运行中函数
void MainLoop()
{
Admin admin(ID_Value);
int select = 1;
while (select)
{
cout << setw(20) << "————————————————" << endl
<< "当前用户:" << admin.getID() << endl
<< "1.查看当前库存" << endl
<< "2.增加书刊信息" << endl
<< "3.修改书刊信息" << endl
<< "4.删除书刊信息" << endl
<< "5.增加书刊库存" << endl
<< "6.书刊销售系统" << endl
<< "7.当前财务统计" << endl
<< "8.更改管理员ID" << endl
<< "9.切换登录账户" << endl
<< "10.将库存信息输出至文件" << endl
<< "0.退出书店系统" << endl
<< setw(20) << "————————————————" << endl;
cout << "请输入操作序号:";
cin >> select;
if (select < 0 || select >10)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: admin.printAll(); continue;
case 2: admin.AddBook(); continue;
case 3: admin.modify();continue;
case 4: admin.DelBook(); continue;
case 5: admin.inStock(); continue;
case 6: admin.outStock(); continue;
case 7: admin.statics(); continue;
case 8:
{
string id;
cout << "输入目标ID";
cin >> id;
admin.changeID(id);
ID[ID_flag - 1] = id;
cout << "更改成功当前ID为" << id << endl;
ID_OUT();
continue;
}
case 9: system("cls"); MainLoop(); break;
case 10: fileOut(); continue;
case 0: break;
}
}
}
}
//主函数
int main()
{
MainLoop();
return 0;
}
/* 本程序使用外部文件实现了预置账户切换功能模块,该文件如下:
** exe文件目录中
** ID.txt
*/

View File

@ -0,0 +1,214 @@
#include <time.h>
#include <iostream>
#include <string>
#include <iomanip>
#define MAXSIZE 10000
using namespace std;
//全局变量
static int Bcount = 2;
static int flag = 0;
class Book
{
private:
string ISBN;
string Bname;
double price;
string author;
public:
Book() {};
Book(string is, string nam, double p, string au)
{
ISBN = is;
Bname = nam;
price = p;
author = au;
}
friend ostream& operator<<(ostream& output, const Book& b);
string getISBN() const { return ISBN; }
string getName() const { return Bname; }
string getAuthor() const { return author; }
double getPrice() const { return price; }
void modISBN(string i) { ISBN = i; }
void modName(string n) { Bname = n; }
void modPrice(double pr) { price = pr; }
void modAuthor(string au) { author = au; }
};
//输出流运算符重载
ostream& operator<<(ostream& output, const Book& b)
{
cout.setf(ios_base::left);
output << b.getISBN()<<"\t"<<b.getName() << "\t" << b.getAuthor() << "\t" << b.getPrice() << "\t" << endl;
return output;
}
//预置书籍类数据
Book Books[MAXSIZE] = {
Book("9787302257646","程序设计基础",25,"张三"),
Book("9787302219972","操作系统原理",32,"李四")
};
class Admin
{
public:
Admin() {};
void AddBook();
void DelBook();
void SearchBook();
void modify();
};
//输出所有Book
void BooksPrint()
{
cout << "———————— 书籍信息 ————————" << endl;
cout << "序号\tISBN\t\t书名\t\t作者\t价格" << endl;
for (int i = 0; i < Bcount; i++) cout << i + 1 << "\t" << Books[i];
cout << endl;
}
//添加新书籍
void NewBook()
{
string ISBN;
string Bname;
double price;
string author;
cout << "------------------------------------------" << endl;
cout << "正在添加新的书籍信息,当前已有书籍数目:" << Bcount << endl;
cout << "输入ISBN号"; cin >> ISBN;
cout << "请输入书名:"; cin >> Bname;
cout << "请输入价格:"; cin >> price;
cout << "请输入作者名:"; cin >> author;
Books[Bcount] = Book(ISBN, Bname, price, author);
Bcount++;
cout << "添加成功!" << endl;
}
//增加书刊
void Admin::AddBook()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>增加书刊<<<<<<<<<<" << endl;
while (select)
{
NewBook();
cout << "输入0退出该操作输入其他数字继续添加。" << endl << "请输入:";
cin >> select;
}
}
//删除书刊
void Admin::DelBook()
{
string s = "1";
while (1) {
cout << "请输入作者名、书名或ISBN号输入0返回主菜单";
cin >> s;
if (s == "0") break; //退出判断
int flag = 0; //查找成功状态符
//查找书籍类
for (int i = 0; i < Bcount; i++)
if (Books[i].getAuthor() == s || Books[i].getISBN() == s || Books[i].getName() == s)
{
flag = 1;
cout << "发现目标书籍如下是否删除该书籍信息Y 是 / N 否)"
<< endl << "------------------------"
<< endl << Books[i] << "------------------------" << endl << "请选择:";
char c; cin >> c;
if (c == 'Y' || c == 'y')
{
for (int j = i; j < Bcount - 1; j++)
{
Books[j] = Books[j + 1];
}
Bcount--;
}
else continue;
}
else continue;
if (flag) cout << "删除成功!" << endl;
else cerr << "未找到目标书籍。" << endl;
}
}
//修改书籍类
void modifyBook()
{
int select = 1;
BooksPrint();
int a, b;
string s = "";
double pr = 0;
cout << "要操作的书籍编号是:"; cin >> a;
if (a<1 || a>Bcount)
{
cerr << "序号错误,请检查。" << endl;
}
else
{
cout << "1.ISBN\t2.书籍名称\t3.作者\t4.价格\t0.放弃修改" << endl << "要修改的信息是:"; cin >> b;
switch (b)
{
case 1: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modISBN(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 2: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modName(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 3: cout << "输入修改后的信息:"; cin >> s; Books[a - 1].modAuthor(s); cout << Books[a - 1] << "修改成功!" << endl; break;
case 4: cout << "输入修改后的信息:"; cin >> pr; Books[a - 1].modPrice(pr); cout << Books[a - 1] << "修改成功!" << endl; break;
case 0: break;
}
}
}
//修改书籍信息
void Admin::modify()
{
int select = 1;
cout << setw(20) << ">>>>>>>>>>修改书刊信息<<<<<<<<<<" << endl;
while (select)
{
modifyBook();
cout << "输入 0 退出该操作,输入其他数字继续修改" << endl << "请输入:";
cin >> select;
}
}
//运行中函数
void MainLoop()
{
Admin admin;
int select = 1;
while (select)
{
cout << "==============================="
<< endl << "====欢迎使用图书管理系统===="
<< endl << "===============================" << endl
<< setw(20) << "————————————————" << endl
<< "1.增加书刊信息" << endl
<< "2.修改书刊信息" << endl
<< "3.删除书刊信息" << endl
<< "4.查看所有图书" << endl
<< "0.退出书店系统" << endl
<< setw(20) << "————————————————" << endl;
cout << "请输入操作序号:";
cin >> select;
if (select < 0 || select >4)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: admin.AddBook(); continue;
case 2: admin.modify(); continue;
case 3: admin.DelBook(); continue;
case 4: BooksPrint(); continue;
case 0: break;
}
}
}
}
//主函数
int main()
{
MainLoop();
return 0;
}

View File

@ -0,0 +1,151 @@
#include <iostream>
#include <cstring>
#include <fstream>
#include "Books.h"
using namespace std;
//全局变量
string ID_Value; //存储新建账户名
string ID[5]; //存储ID列表
int ID_flag; //存储ID操作序号
fstream file; //文件对象
void launch(); //声明RUNTIME函数
void ID_OUT()
{
file.open("ID.txt", ios::out);
if (!file)
{
cerr << "未检测到账户列表文件ID.txt保存失败。" << endl;
exit(1);
}
for (int i = 0; i < 5; i++)
file << ID[i] << endl;
file.close();
}
void ID_IN()
{
file.open("ID.txt", ios::in);
if (!file)
{
cerr << "未检测到预置账户列表文件ID.txt请查看源代码末端的注释现已使用默认测试账户登录。" << endl;
ID_Value = "超级管理员";
launch();
}
for (int i = 0; i < 5; i++)
file >> ID[i];
file.close();
}
void ID_Switch()
{
ID_IN();
for (int i = 0; i < 5; i++)
cout << i + 1 << "\t" << ID[i] << endl;
cout << "请选择要登录的账户:"; cin >> ID_flag;
if (ID_flag == 5 && ID[ID_flag-1] == "选此项以新建账户")
{
string tmp;
cout << "请输入新账户的ID"; cin >> tmp;
ID[4] = ID_Value = tmp;
cout << "新建账户成功并已写入账户列表!您现在拥有所有权限。" << endl;
ID_OUT();
}
else if (ID_flag < 1 || ID_flag>5)
{
cerr << "该账户不存在!程序将退出。" << endl;
abort();
}
else ID_Value = ID[ID_flag - 1];
cout << "-----------------------------------------------" << endl;
}
void fileOut()
{
file.open("书籍.txt", ios::out);
file<<"ISBN\t\t" << setw(25) << "书名" << setw(20) << "作者" << setw(15) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Bcount; i++) file << Books[i];
file.close();
file.open("期刊.txt", ios::out);
cout.setf(ios_base::left);
file << "ISBN\t\t" << setw(25) << "期刊名" << setw(20) << "出版社" << setw(20) << "价格" << setw(15) << "库存" << endl;
for (int i = 0; i < Jcount; i++)file << Journals[i];
cout << "已成功输出为'书籍.txt'与'期刊.txt'" << endl;
file.close();
}
void welcome()
{
cout << "==============================="
<< endl << setw(30) << "欢迎使用小型书店进销存管理系统"
<< endl << "==============================="
<< endl << "该程序仅用于江西财经大学张老师《C++程序设计语言》课程之期末综合性实验报告,作者:刘燕、李溦、钟琳"
<< endl << "-----------------------------------------------"
<< endl << "预置账户列表:" << endl;
ID_Switch();
launch();
}
void launch()
{
Admin admin(ID_Value);
int select = 1;
while (select)
{
cout << setw(20) << "————————————————" << endl
<< "当前用户:" << admin.getID() << endl
<< "1.查看当前库存" << endl
<< "2.增加书刊信息" << endl
<< "3.修改书刊信息" << endl
<< "4.删除书刊信息" << endl
<< "5.增加书刊库存" << endl
<< "6.书刊销售系统" << endl
<< "7.当前财务统计" << endl
<< "8.更改管理员ID" << endl
<< "9.切换登录账户" << endl
<< "10.将库存信息输出至文件" << endl
<< "0.退出书店系统" << endl
<< setw(20) << "————————————————" << endl;
cout << "请输入操作序号:";
cin >> select;
if (select < 0 || select >10)
{
cerr << "非法值,请重新输入。" << endl;
continue;
}
else
{
switch (select)
{
case 1: admin.printAll(); continue;
case 2: admin.AddBook(); continue;
case 3: admin.modify();continue;
case 4: admin.DelBook(); continue;
case 5: admin.inStock(); continue;
case 6: admin.outStock(); continue;
case 7: admin.statics(); continue;
case 8:
{
string id;
cout << "输入目标ID";
cin >> id;
admin.changeID(id);
ID[ID_flag - 1] = id;
cout << "更改成功当前ID为" << id << endl;
ID_OUT();
continue;
}
case 9: system("cls"); welcome(); break;
case 10: fileOut(); continue;
case 0: break;
}
}
}
}
int main()
{
welcome();
return 0;
}

Binary file not shown.

BIN
后事管理系统/.DS_Store vendored Normal file

Binary file not shown.

2
后事管理系统/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
package-lock.json

View File

@ -0,0 +1,12 @@
{
"presets": ["@babel/preset-env"],
"plugins": [
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
]
}

View File

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

View File

@ -0,0 +1,19 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: '@babel/eslint-parser'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"vue/multi-word-component-names": "off",
"no-unused-vars": ["error", { "args": "none" }]
}
}

View File

@ -0,0 +1,24 @@
# 后事管理系统后台
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View File

@ -0,0 +1,31 @@
// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
import * as echarts from 'echarts/core';
// 引入柱状图图表,图表后缀都为 Chart
import { LineChart } from 'echarts/charts';
// 引入提示框,标题,直角坐标系,数据集,内置数据转换器组件,组件后缀都为 Component
import {
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent
} from 'echarts/components';
// 标签自动布局、全局过渡动画等特性
import { LabelLayout, UniversalTransition } from 'echarts/features';
// 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers';
// 注册必须的组件
echarts.use([
TitleComponent,
TooltipComponent,
GridComponent,
DatasetComponent,
TransformComponent,
LineChart,
LabelLayout,
UniversalTransition,
CanvasRenderer
]);
export default echarts;

View File

@ -0,0 +1,59 @@
import Vue from 'vue'
import { Button } from 'element-ui'
import {
form, FormItem, Input, Message, Loading, Container, Header, Aside, Main,
DropdownItem, DropdownMenu, Dropdown, Dialog, Menu, Submenu, MenuItem, Card, Table, TableColumn, Pagination,
Tag, Image, Cascader, RadioGroup, RadioButton, DatePicker, Switch, TimePicker, MessageBox, Notification, Radio, Tooltip, Select, Option,
Upload, Backtop, Icon, Autocomplete, Tabs, TabPane, CollapseItem, Collapse, Alert, Tree
} from 'element-ui'
Vue.use(Button)
Vue.use(form)
Vue.use(FormItem)
Vue.use(Alert)
Vue.use(Input)
// Vue.use(Message)
Vue.prototype.$message = Message;
Vue.prototype.$loading = Loading.service;
Vue.use(Container)
Vue.use(Header)
Vue.use(Aside)
Vue.use(Main)
Vue.use(DropdownItem)
Vue.use(DropdownMenu)
Vue.use(Dropdown)
Vue.use(Dialog)
Vue.use(Menu)
Vue.use(Submenu)
Vue.use(MenuItem)
Vue.use(Card)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Tag)
Vue.use(Pagination)
Vue.use(Image)
Vue.use(Cascader)
Vue.use(RadioButton)
Vue.use(RadioGroup)
Vue.use(DatePicker)
Vue.use(Switch)
Vue.use(Radio)
Vue.use(Tooltip)
Vue.use(TimePicker)
Vue.use(Select)
Vue.use(Option)
Vue.use(Upload)
Vue.use(Backtop)
Vue.use(Icon)
Vue.use(Autocomplete)
Vue.use(Tabs)
Vue.use(TabPane)
Vue.use(CollapseItem)
Vue.use(Collapse)
Vue.use(Tree)
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$notify = Notification;

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#F6A96C;" d="M421.064,329.929h-30.012V209.882h30.012c33.104,0,60.023,26.92,60.023,60.023
S454.168,329.929,421.064,329.929z"/>
<path style="fill:#FFBD86;" d="M120.947,329.929H90.936c-33.104,0-60.023-26.92-60.023-60.023s26.92-60.023,60.023-60.023h30.012
V329.929z"/>
<path style="fill:#FED2A4;" d="M421.064,269.905v75.029C421.064,435.869,346.937,512,256,512S90.936,435.869,90.936,344.935v-75.029
l88.535-90.035h153.059L421.064,269.905z"/>
<path style="fill:#FFBD86;" d="M421.064,269.905v75.029C421.064,435.869,346.937,512,256,512V179.87h76.53L421.064,269.905z"/>
<path style="fill:#FF641A;" d="M320.824,382.449c-13.205,23.11-38.114,37.515-64.824,37.515s-51.619-14.405-64.824-37.515
l25.81-15.006c8.102,13.806,23.108,22.509,39.015,22.509s30.913-8.702,39.015-22.509L320.824,382.449z"/>
<rect x="301.018" y="269.905" style="fill:#444444;" width="30.012" height="30.012"/>
<rect x="180.971" y="269.905" style="fill:#5A5A5A;" width="30.012" height="30.012"/>
<path style="fill:#FF4B00;" d="M295.014,367.444l25.81,15.006c-13.205,23.11-38.114,37.515-64.824,37.515v-30.012
C271.907,389.952,286.913,381.249,295.014,367.444z"/>
<path style="fill:#FDBF00;" d="M391.053,98.537v-5.402c0-31.211-12.304-60.121-34.514-82.332L346.035,0l-10.503,10.804
c-16.507,16.207-39.016,25.01-61.824,25.01h-77.731c-36.913,0-67.827,27.01-73.83,62.124c-18.006,6.001-31.211,22.808-31.211,42.917
v129.05h15.006c36.315,0,66.625-25.81,73.529-60.023h153.059c6.904,34.213,37.215,60.023,73.529,60.023h15.006v-129.05
C421.064,121.346,408.46,104.54,391.053,98.537z"/>
<path style="fill:#FF9F00;" d="M421.064,140.855v129.05h-15.006c-36.315,0-66.625-25.81-73.529-60.023H256V35.814h17.708
c22.807,0,45.316-8.802,61.824-25.01L346.035,0l10.503,10.804c22.211,22.211,34.514,51.12,34.514,82.332v5.402
C408.46,104.54,421.064,121.346,421.064,140.855z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

View File

@ -0,0 +1,38 @@
{
"name": "admin",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.4.0",
"core-js": "^3.8.3",
"echarts": "^5.4.2",
"element-ui": "^2.15.13",
"html2canvas": "^1.4.1",
"vue": "^2.6.14",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.5.1"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@babel/preset-env": "^7.21.5",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"babel-plugin-component": "^1.1.1",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"vue-template-compiler": "^2.6.14"
},
"vue": {
"productionSourceMap": false
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</html>

View File

@ -0,0 +1,48 @@
<template>
<div id="app">
<router-view />
</div>
</template>
<style>
#app {
width: 100%;
height: 100%;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
background: #e0e0e0;
}
::-webkit-scrollbar-track {
border-radius: 10px;
background: #f1efef;
}
/* el-table 滚动条样式 */
.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar {
width: 10px;
}
.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar-thumb {
border-radius: 10px;
background: rgba(0, 0, 0, 0.1);
}
.el-table--scrollable-y .el-table__body-wrapper::-webkit-scrollbar-track {
border-radius: 10px;
background: rgba(0, 0, 0, 0.05);
}
.el-table__header-wrapper .has-gutter th:nth-last-child(2) {
border-right: 0;
}
/* el-table 滚动条样式结束 */
</style>

View File

@ -0,0 +1,97 @@
<template>
<div>
<div class="notfoud-container">
<div class="img-404">
</div>
<p class="notfound-p">哎呀迷路了...</p>
<div class="notfound-reason">
<p>可能的原因</p>
<ul>
<li>活动已经结束了</li>
<li>原来的页面不存在了</li>
<li>我们的服务器被外星人劫持了</li>
</ul>
</div>
<div class="notfound-btn-container">
<p class="notfound-btn" @click="gohome">返回上一页</p>
</div>
</div>
</div>
</template>
<script>
export default {
methods: {
gohome() {
this.$router.go(-1);
}
}
}
</script>
<style>
* {
padding: 0;
margin: 0
}
a {
text-decoration: none
}
.notfoud-container .img-404 {
height: 155px;
background: url('../../images/404.png') center center no-repeat;
background-size: 150px auto;
margin-top: 40px;
margin-bottom: 20px
}
.notfoud-container .notfound-p {
line-height: 22px;
font-size: 17px;
padding-bottom: 15px;
border-bottom: 1px solid #f6f6f6;
text-align: center;
color: #262b31
}
.notfoud-container .notfound-reason {
color: #9ca4ac;
font-size: 13px;
line-height: 13px;
text-align: left;
width: 210px;
margin: 0 auto
}
.notfoud-container .notfound-reason p {
margin-top: 13px
}
.notfoud-container .notfound-reason ul li {
margin-top: 10px;
margin-left: 36px
}
.notfoud-container .notfound-btn-container {
margin: 40px auto 0;
text-align: center
}
.notfoud-container .notfound-btn-container .notfound-btn {
display: inline-block;
border: 1px solid #ebedef;
background-color: #3982F7;
color: #fff;
font-size: 15px;
border-radius: 5px;
text-align: center;
padding: 10px;
line-height: 16px;
white-space: nowrap;
/* 鼠标样式 */
cursor: pointer;
}
</style>

View File

@ -0,0 +1,81 @@
<template>
<div class="main">
<span class="title">添加管理员</span>
<el-form label-width="100px">
<el-form-item label="管理员账号">
<el-input v-model="info.username" placeholder="请输入管理员账号" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="管理员昵称">
<el-input v-model="info.nickname" placeholder="请输入管理员昵称" style="width: 300px;"></el-input>
</el-form-item>
<el-form-item style="text-align: right; padding-right: 8px; width: 400px;">
<el-button type="primary" @click="clear()" plain>重置</el-button>
<el-button type="primary" @click="addAdmin">立即添加</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
info: {
username: '',
nickname: '',
}
}
},
methods: {
addAdmin() {
if (this.info.username == '' || this.info.nickname == '') {
this.$message({
message: '请填写完整信息',
type: 'error'
});
return false;
}
this.$http.post('admin//admin/add', this.info).then(res => {
if (res.data.code == 200) {
this.$alert(res.data.msg, '操作提示', {
confirmButtonText: '确定',
callback: action => {
this.clear()
}
});
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
},
clear() {
this.info.username = '';
this.info.nickname = '';
}
},
mounted() {
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
height: 100%;
background: #fff;
box-sizing: border-box;
padding: 20px;
text-align: left;
.title {
font-size: 18px;
font-weight: bold;
margin-bottom: 20px;
display: block;
}
}
</style>

View File

@ -0,0 +1,581 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-input style="width: 300px" :maxlength="25" show-word-limit clear="searchInput" clearable
placeholder="昵称搜索" prefix-icon="el-icon-search" v-model="search">
</el-input>
<el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button>
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="nickname" label="昵称" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="username" label="账号" min-width="160" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span class="username" style="color:#3799e9;" @click="copy(scope.row.username)">{{
scope.row.username
}}</span>
</template>
</el-table-column>
<el-table-column fixed prop="role_name" label="角色" min-width="100" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<el-tag style="height:25px; line-height:25px;"
:type="scope.row.role == '1' ? 'success' : scope.row.role == '2' ? 'primary' : scope.row.role == '3' ? 'danger' : 'info'"
disable-transitions>{{
scope.row.role_name
}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="create_time" label="创建时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="update_time" label="更新时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="status" label="状态" min-width="110" align="center">
<template slot-scope="scope">
<el-switch :value="scope.row.status == 0 ? true : false" @change="change(scope.row, scope.$index)"
active-color="#13ce66" inactive-color="#aaa">
</el-switch>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="380" align="left">
<template slot-scope="scope">
<el-tag type="warning" size="mini" style="margin-right: 10px;cursor: pointer;"
@click="resetting(scope.row, scope.$index)" effect="dark">重置密码</el-tag>
<el-tag type="success" size="mini" style="margin-right: 10px;cursor: pointer;" effect="dark"
@click="convert(scope.row, scope.$index)">添加为律师</el-tag>
<el-tag size="mini" style="margin-right: 10px;cursor: pointer;" effect="dark"
@click="updateShowBind(scope.$index)">设置角色</el-tag>
<el-tag type="danger" @click="del(scope.$index)" size="mini"
style="margin-right: 10px;cursor: pointer;" effect="dark">删除</el-tag>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
<el-dialog :visible.sync="convertShow" width="490px" height="257px" title="填写必要信息" style="text-align: left;">
<el-form label-width="80px">
<el-form-item label="性别">
<el-select v-model="convertInfo.gender" placeholder="请选择性别" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '男' }, { value: 1, lable: '女' }]"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="描述">
<el-input type="textarea" v-model="convertInfo.description" placeholder="请输入描述"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="convertShow = false"> </el-button>
<el-button type="primary" @click="convertPost()"> </el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="updateShow" width="490px" height="257px" title="设置角色" style="text-align: left;">
<el-form label-width="80px">
<el-form-item label="角色">
<el-select v-model="role" placeholder="请选择角色" value-key="value">
<el-option :label="item.name" :value="item.id" v-for="(item, index) in roleList"
:key="index"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="updateShow = false"> </el-button>
<el-button type="primary" @click="update()"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
convertShow: false,
updateShow: false,
status: 0,
index: 0,
convertInfo: {
gender: 0,
description: ''
},
roleList: [],
role: 1
}
},
activated() {
this.$http.get(`admin/admin/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
convert(item, index) {
this.$confirm('是否确认设为勾魂使者?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.index = index
this.convertShow = true
}).catch(() => {
});
},
updateShowBind(index) {
this.role = this.list[index].role
this.index = index
this.updateShow = true
},
update() {
this.$confirm('是否确认设置此用户角色?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('admin/role/admin', {
id: this.list[this.index].id,
role: this.role
}).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg)
this.updateShow = false
this.list[this.index].role = this.role
let name = ''
this.roleList.forEach(item => {
if (item.id == this.role) {
name = item.name
}
})
this.list[this.index].role_name = name
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
});
},
convertPost() {
if (this.convertInfo.description == '') return this.$message.error('请填写描述')
this.$http.put('admin/admin/reaper', {
id: this.list[this.index].id,
gender: this.convertInfo.gender,
description: this.convertInfo.description
}).then(res => {
if (res.data.code == 200) {
this.$alert(res.data.msg, '操作提示', {
confirmButtonText: '确定',
callback: action => {
this.convertShow = false
this.list[this.index].role = 2
this.list[this.index].role_name = '勾魂使者'
}
});
} else {
this.$message.error(res.data.msg)
}
})
},
resetting(item, index) {
this.$confirm('是否确认重置此用户密码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('admin/admin/reset', {
id: item.id,
}).then(res => {
if (res.data.code == 200) {
this.$alert(res.data.msg, '操作提示', {
confirmButtonText: '确定',
callback: action => {
}
});
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
});
},
change(item, index) {
let info = item.status == 1 ? '解封' : '禁用'
this.$confirm(`是否确认${info}此账号?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.put('admin/admin/status', {
id: item.id,
status: item.status == 0 ? 1 : 0
}).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg)
this.list[index].status = item.status == 0 ? 1 : 0
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
});
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,<span style="color:#a93a3a">管理员数据将不存在</span>,如确认删除,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('admin/admin/delete?id=' + this.list[index].id).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/admin/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/admin/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/admin/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
this.$http.get(`admin/role/list?page=1&limit=1000`).then(res => {
loading.close()
if (res.data.code == 200) {
let arr = res.data.data;
this.roleList = arr.filter(item => {
return item.id != 2
})
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
},
//
searchBind() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/admin/list?nickname=${this.search}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/admin/list?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
//
det(id) {
localStorage.setItem('menu', '/lifebook/data')
this.$router.push({
path: '/lifebook/info',
query: {
uuid: id
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,209 @@
<template>
<div class="main">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="受审人" style="width:500px">
<el-input placeholder="请选择受审人" v-model="user.name" @click="filebookShow = true"
@focus="filebookShow = true"></el-input>
</el-form-item>
<el-form :inline="true" label-width="80px">
<el-form-item label="打入地狱">
<el-select v-model="yu_type" placeholder="请选择所打入地狱" value-key="value" @change="yuChange">
<el-option :label="item.lable" :value="item.value" v-for="(item, index) in [{ value: '铁钳地狱', lable: '铁钳地狱' }, { value: '剪刀地狱', lable: '剪刀地狱' }
, { value: '铁树地狱', lable: '铁树地狱' }, { value: '孽镜地狱', lable: '孽镜地狱' }, { value: '蒸笼地狱', lable: '蒸笼地狱' }
, { value: '铜柱地狱', lable: '铜柱地狱' }, { value: '刀山地狱', lable: '刀山地狱' }, { value: '冰山地狱', lable: '冰山地狱' }
, { value: '油锅地狱', lable: '油锅地狱' }, { value: '牛坑地狱', lable: '牛坑地狱' }, { value: '石压地狱', lable: '石压地狱' }
, { value: '舂臼地狱', lable: '舂臼地狱' }, { value: '血池地狱', lable: '血池地狱' }, { value: '枉死牢地狱', lable: '枉死牢地狱' }
, { value: '磔刑地狱', lable: '磔刑地狱' }, { value: '火山地狱', lable: '火山地狱' }, { value: '石磨地狱', lable: '石磨地狱' }
, { value: '刀锯地狱', lable: '刀锯地狱' }]" :key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="受刑时间" style="width:400px">
<el-input placeholder="请输入受刑时间如10年" v-model="time"></el-input>
</el-form-item>
</el-form>
<el-form-item label="理由" style="width:800px">
<el-input :placeholder="'请输入' + type == 0 ? '轮回' : '打入地狱' + '理由'" v-model="reason" type="textarea"
:autosize="{ minRows: 4, maxRows: 8 }" :show-word-limit="true" maxlength="1000"></el-input>
</el-form-item>
<el-form-item style="margin-top: 45px;">
<el-button type="primary" @click="clear" plain> </el-button>
<el-button type="primary" style="margin-left: 20px;" @click="post">添加记录</el-button>
</el-form-item>
</el-form>
<el-dialog title="请选择生死簿记录" :visible.sync="filebookShow" width="580px" style="text-align: left;">
<el-form label-width="70px">
<el-form-item label="受审人">
<el-input placeholder="请输入uuid或姓名搜索" style="width:250px" v-model="filebookuuid"></el-input>
<el-button type="primary" style="margin-left:22px;" @click="querySearchAsync">搜索</el-button>
</el-form-item>
</el-form>
<div class="filelist">
<div class="file-item" v-for="(item, index) in filebook" :key="index">
<span class="name">{{ item.name }}</span>
<span class="uuid">{{ item.uuid }}</span>
<span class="info" @click="handleSelect(item)">选择</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="filebookShow = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
filebookShow: false,
filebookuuid: '',
filebook: [],
user: {},
info: {
lifebook_id: '',
record: '',
title: ''
},
type: 2,
lun_type: '',
time: '',
yu_type: '',
reason: '',
yu_index: 0
}
},
methods: {
querySearchAsync() {
if (this.filebookuuid == '') return this.$message.error('请输入完整')
let search = ''
let reg = /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/
if (reg.test(this.filebookuuid)) {
search = 'name=' + this.filebookuuid
} else {
let filebookuuid = this.filebookuuid.toLocaleUpperCase()
search = 'uuid=' + filebookuuid
}
this.$http.get('admin/lifeBookSearch?' + search).then(res => {
if (res.data.data.length > 0) {
this.filebook = res.data.data
} else {
this.$message.error('暂无数据')
}
})
},
handleSelect(item) {
this.user = item
this.filebookShow = false
this.info.lifebook_id = this.user.id
},
onSubmit_lun_show() {
},
yuChange(e) {
let map = { "铁钳地狱": 0, "剪刀地狱": 1, "铁树地狱": 2, "孽镜地狱": 3, "蒸笼地狱": 4, "铜柱地狱": 5, "刀山地狱": 6, "冰山地狱": 7, "油锅地狱": 8, "牛坑地狱": 9, "石压地狱": 10, "舂臼地狱": 11, "血池地狱": 12, "枉死牢地狱": 13, "磔刑地狱": 14, "火山地狱": 15, "石磨地狱": 16, "刀锯地狱": 17 }
this.yu_index = map[e]
},
clear() {
this.info = {
lifebook_id: '',
record: '',
title: ''
}
this.stance = ''
this.type = 2
this.filebookuuid = ''
this.filebook = []
this.user = {}
this.lun_type = ''
this.time = ''
this.yu_type = ''
},
post() {
if (this.info.lifebook_id == '') return this.$message.error('请选择生死簿记录');
//
if (this.yu_type == '') return this.$message.error('请选择打入的地狱');
if (this.time == '') return this.$message.error('请输入受刑时间');
if (this.reason == '') return this.$message.error('请输入处理理由');
this.$confirm('是否确认添加此数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.get('admin/helllist?floor=' + ((Number(this.yu_index)) + 1)).then(res => {
console.log(res.data)
let did = res.data.data[0].id
let data = {
uid: this.info.lifebook_id,
floor: this.yu_index + 1,
device: did,
time: this.time,
reason: this.reason,
}
this.$http.post('admin/hellrecordadd', data).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg);
} else {
this.$message.error(res.data.msg);
}
})
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
box-sizing: border-box;
padding: 20px;
text-align: left;
.filelist {
width: 100%;
padding: 10px;
box-sizing: border-box;
.file-item {
border-bottom: 1px solid #e6e6e6;
display: flex;
align-items: center;
height: 56px;
width: calc(100% - 180px);
margin-left: 100px;
box-sizing: border-box;
.info {
color: #185ed1;
display: block;
margin-left: 62px;
cursor: pointer;
}
.uuid {
display: clock;
}
.name {
display: block;
width: 80px;
text-align: left;
}
}
}
}
</style>

View File

@ -0,0 +1,473 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-select v-model="search" placeholder="请选择所在地狱" style="width: 300px;" @change="change">
<el-option v-for="item in dyList" :key="item.value" :label="item.lable" :value="item.value">
</el-option>
</el-select>
<el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button>
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
<el-button class="addButton" size="primary" plain @click="addBind">添加</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="name" label="姓名" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="user_uuid" label="身份号" min-width="160" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span class="uuid" style="color:#3799e9;" @click="copy(scope.row.user_uuid)">{{ scope.row.user_uuid
}}</span>
</template>
</el-table-column>
<el-table-column prop="gender" label="所在地狱" min-width="90" align="center" :sortable="true">
<template slot-scope="scope">
<span>{{ map[scope.row.floor] }}</span>
</template>
</el-table-column>
<el-table-column prop="description" label="受刑理由" min-width="240" align="left" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.reason)">{{
scope.row.reason }}</span>
</template>
</el-table-column>
<el-table-column prop="time" label="受刑时长" min-width="100" align="center">
</el-table-column>
<el-table-column prop="create_time" label="判处时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="180" align="center">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="edits(scope.row)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="del(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
<!-- 修改理由 -->
<el-dialog title="修改理由" :visible.sync="editShow" width="30%" :close-on-click-modal="false">
<el-form :model="item" label-width="80px" class="demo-ruleForm">
<el-form-item label="受刑理由" prop="reason">
<el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="edit.reason"></el-input>
</el-form-item>
<el-form-item label="受刑时间" prop="reason">
<el-input type="text" :rows="3" placeholder="请输入内容" v-model="edit.time"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editShow = false"> </el-button>
<el-button type="primary" @click="editSubmit()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
searchValue: 0,
editShow: false,
edit: {},
and: '',
dyList: [{ value: '1', lable: '铁钳地狱' }, { value: '2', lable: '剪刀地狱' }
, { value: '3', lable: '铁树地狱' }, { value: '4', lable: '孽镜地狱' }, { value: '5', lable: '蒸笼地狱' }
, { value: '6', lable: '铜柱地狱' }, { value: '7', lable: '刀山地狱' }, { value: '8', lable: '冰山地狱' }
, { value: '9', lable: '油锅地狱' }, { value: '10', lable: '牛坑地狱' }, { value: '11', lable: '石压地狱' }
, { value: '12', lable: '舂臼地狱' }, { value: '13', lable: '血池地狱' }, { value: '14', lable: '枉死牢地狱' }
, { value: '15', lable: '磔刑地狱' }, { value: '16', lable: '火山地狱' }, { value: '17', lable: '石磨地狱' }
, { value: '18', lable: '刀锯地狱' }],
map: { "1": "铁钳地狱", "2": "剪刀地狱", "3": "铁树地狱", "4": "孽镜地狱", "5": "蒸笼地狱", "6": "铜柱地狱", "7": "刀山地狱", "8": "冰山地狱", "9": "油锅地狱", "10": "牛坑地狱", "11": "石压地狱", "12": "舂臼地狱", "13": "血池地狱", "14": "枉死牢地狱", "15": "磔刑地狱", "16": "火山地狱", "17": "石磨地狱", "18": "刀锯地狱" }
}
},
activated() {
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}${this.and}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
addBind() {
this.$router.push('/hell/addHellLog')
},
edits(item) {
this.editShow = true
this.edit = item
},
editSubmit() {
if (this.edit.reason == '') {
this.$message.error('请输入受刑理由')
return
}
if (this.edit.time == '') {
this.$message.error('请输入受刑时间')
return
}
console.log(this.edit);
this.$http.put('admin/hellrecordedit', {
id: this.edit.id,
reason: this.edit.reason,
time: this.edit.time
}).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg)
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
lookDescription(info) {
this.$alert(info, '详情', {
confirmButtonText: '确定',
callback: action => {
}
});
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('/admin/hellrecorddel?id=' + this.list[index].id).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/hellrecordlist?page=${this.currentPage}&limit=${this.pageSize}${this.and}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/hellrecordlist?page=${this.currentPage}&limit=${this.pageSize}${this.and}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/hellrecordlist?page=${this.currentPage}&limit=${this.pageSize}${this.and}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
console.log(res.data);
} else {
this.$message.error(res.data.msg)
}
})
},
change(e) {
this.searchValue = this.dyList[e - 1].value
},
//
searchBind() {
this.and = ''
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/hellrecordlist?floor=${this.searchValue}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
this.and = ''
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/hellrecordlist?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
},
created() {
let id = this.$route.query.id
//id
if (id) {
this.and = `&device=${id}`
} else {
this.and = ''
}
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,298 @@
<template>
<div class="main">
<div class="tools">
<el-button type="primary" @click="showbind()" plain>添加设备</el-button>
</div>
<el-tabs type="border-card" style="width: 100%;min-height: calc(100% - 60px);" @tab-click="click" value="1">
<el-tab-pane :label="item.lable" v-for="(item, index) in tablelist" :key="index" :name="item.value">
<div class="box">
<span v-if="show.length == 0" class="nono">暂无数据</span>
<div class="item" v-for="(item, index) in show" :key="index">
<span class="name" @click="uigo(item.id)">{{ item.name }}</span>
<span class="time">创建于{{ item.create_time }}</span>
<el-switch :value="item.status == 0" active-color="#13ce66" :name="index + 'dev'"
inactive-color="#aaa" @change="change(index)">
</el-switch>
<i class="el-icon-edit" @click="edit(item, index)"></i>
<i class="el-icon-delete" @click="del(index, item.floor)"></i>
</div>
</div>
</el-tab-pane>
</el-tabs>
<el-dialog title="添加设备" :visible.sync="addShow" width="30%">
<el-form label-width="80px" class="demo-ruleForm">
<el-form-item label="设备名称" prop="name">
<el-input v-model="item.name"></el-input>
</el-form-item>
<el-form-item label="所属地狱">
<el-select v-model="item.floor" placeholder="请选择所属地狱">
<el-option :label="item.lable" :value="item.value" v-for="(item, index) in tablelist"
:key="index"></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="addShow = false"> </el-button>
<el-button type="primary" @click="add()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
show: [],
tablelist: [{ value: '1', lable: '铁钳地狱' }, { value: '2', lable: '剪刀地狱' }
, { value: '3', lable: '铁树地狱' }, { value: '4', lable: '孽镜地狱' }, { value: '5', lable: '蒸笼地狱' }
, { value: '6', lable: '铜柱地狱' }, { value: '7', lable: '刀山地狱' }, { value: '8', lable: '冰山地狱' }
, { value: '9', lable: '油锅地狱' }, { value: '10', lable: '牛坑地狱' }, { value: '11', lable: '石压地狱' }
, { value: '12', lable: '舂臼地狱' }, { value: '13', lable: '血池地狱' }, { value: '14', lable: '枉死牢地狱' }
, { value: '15', lable: '磔刑地狱' }, { value: '16', lable: '火山地狱' }, { value: '17', lable: '石磨地狱' }
, { value: '18', lable: '刀锯地狱' }],
item: {},
addShow: false,
floor: ''
}
},
methods: {
getInfo() {
//10
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.get('admin/helllist?floor=1').then(res => {
loading.close()
this.show = res.data.data
})
},
click(e) {
this.floor = e.name
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.get('admin/helllist?floor=' + e.name).then(res => {
console.log(res.data);
loading.close()
this.show = res.data.data
})
},
change(index) {
this.show[index].status = this.show[index].status == 0 ? 1 : 0
let data = {
id: this.show[index].id,
status: this.show[index].status
}
this.$http.put('admin/hellstatus', data).then(res => {
console.log(res.data);
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: 'success'
});
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
},
edit(item, index) {
this.item = item
this.editShow = true
this.$prompt('请新的设备名称', '修改设备名称', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /$/,
inputErrorMessage: '请输入新设备名称'
}).then(({ value }) => {
if (value == '' || value == null || value == ' ') return this.$message({
type: 'error',
message: '请输入新的名称'
});
let data = {
id: item.id,
name: value
}
this.$http.put('admin/hellupdate', data).then(res => {
console.log(res.data);
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: 'success'
});
this.show[index].name = value
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
}).catch(() => { });
},
del(index, floor) {
this.$confirm('此操作将永久删除该设备, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('/admin/helldel?id=' + this.show[index].id).then(res => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: 'success'
});
this.show.splice(index, 1)
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
showbind() {
this.addShow = true;
this.item = {
name: '',
floor: ''
}
},
add() {
if (this.item.name == '' || this.item.floor === '') return this.$message({
type: 'error',
message: '请填写完整信息'
});
this.$http.post('admin/helladd', this.item).then(res => {
console.log(res.data);
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: 'success'
});
this.addShow = false
this.getInfo()
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
},
uigo(id) {
this.$router.push({ path: '/hell/data', query: { id: id } })
}
},
mounted() {
this.getInfo()
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background-color: #fff;
box-sizing: border-box;
position: relative;
text-align: left;
.tools {
height: 60px;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 30px;
}
.nono {
display: block;
width: 100%;
line-height: 200px;
text-align: center;
font-size: 20px;
color: #aaa;
}
.box {
width: 100%;
height: calc(100vh - 230px);
overflow: auto;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-gap: 15px;
padding: 12px;
box-sizing: border-box;
.item {
width: 100%;
box-shadow: 0 0 20px #e5e5e5;
border-radius: 3px;
box-sizing: border-box;
padding: 12px;
position: relative;
height: 120px;
padding-top: 22px;
min-width: 230px;
.name {
display: block;
font-size: 19px;
color: #2e79f1;
cursor: pointer;
}
.time {
display: block;
font-size: 12px;
color: #aaa;
margin-top: 10px;
position: absolute;
bottom: 12px;
left: 12px;
}
.el-switch {
position: absolute;
right: 62px;
top: 22px;
}
.el-icon-edit {
position: absolute;
right: 12px;
bottom: 12px;
font-size: 20px;
color: #aaa;
cursor: pointer;
}
.el-icon-delete {
position: absolute;
right: 12px;
top: 22px;
font-size: 20px;
color: #f39c9c;
cursor: pointer;
}
}
}
}
</style>

View File

@ -0,0 +1,114 @@
<template>
<div class="main">
<el-collapse v-model="activeNames">
<el-collapse-item title="一致性 Consistency" name="1">
<template slot="title">
<span class="name">勾魂</span>
</template>
<div class="info"> 阎罗王的判官手中有一本记录着三界众生生卒年月时辰的本子人的阳寿将尽之时会有阴间的使者前来勾魂勾魂使者通常是黑白无常他们将生魂引出带领它们踏上阳间通往阴间的旅途
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="2">
<template slot="title">
<span class="name">过鬼门关</span>
</template>
<div class="info"> 阴阳交界之处有一座雄伟的牌楼上书苍劲有力的三个大字鬼门关鬼门关是入地府的必经关卡人死后先来鬼门关报道过了这一关人的魂魄就变成了鬼
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="3">
<template slot="title">
<span class="name">走黄泉路</span>
</template>
<div class="info"> 鬼门关一过便踏上了黄泉路这是一条接引之路路上还有很多孤魂野鬼他们是那些阳寿未尽而非正常死亡的他们既不能上天
也不能投胎更不能到阴间只能在黄泉路上游荡等待寿阳到了后才能到阴间报到听候阎罗王的发落
<br>
阴间有个枉死城轻生的人是无法转世投胎的须得在枉死城经受那百般折磨千般历练脱却有罪之身洗尽前世铅华方可重回六道
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="4">
<template slot="title">
<span class="name">上望乡台</span>
</template>
<div class="info">
走出了黄泉路便上了望乡台传说这望乡台是大慈大悲的观世音菩萨体恤众生不愿死亡惦念家中亲人的真情实意发愿而成鬼魂去地府报到前对阳世亲人十分挂念尽管鬼卒严催怒斥还是强登望乡台最后遥望家乡大哭一声才死心塌地继续前行望乡台被传说这亡魂最后一次向阳世亲人告别的地方
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="5">
<template slot="title">
<span class="name">过奈何桥</span>
</template>
<div class="info">
在黄泉路和冥府之间有一条河名叫忘川忘川河水呈血红色里面尽是不得投胎的孤魂野鬼腥风扑面奈何桥就架在忘川河上亡魂都要过奈河桥善者有神佛护佑顺利过桥恶者被打入血河池受罪相传奈何桥分三层善人的鬼魂可以安全通过上层的桥善恶兼半者过中间的桥
恶人的鬼魂过下层的桥多被鬼拦往桥下的污浊的波涛中被铜蛇铁狗狂咬<br><br>
奈何桥前坐着一个老婆婆叫孟婆要过忘川河必过奈何桥要过奈何桥就要喝孟婆汤不喝孟婆汤就过不得奈何桥过不得奈何桥就不得投生转世孟婆汤可以让人忘记一切彻底了却前尘过往所以死者心中所有对尘世执着都会化作奈何桥前的一声叹息这也是这座连接各世轮回的桥命名为奈何桥的原因<br><br>
奈何桥头还有一块三生石它一直立在奈何桥边张望着红尘中那些准备喝孟婆汤轮回投胎的人们传说三生石能照出人前世的模样前世的因今生的果宿命轮回缘起缘灭都重重地刻在了三生石上千百年来它见证了芸芸众生的苦与乐悲与欢笑与泪该了的债该还的情在三生石前都一笔勾销
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="6">
<template slot="title">
<span class="name">入阎王殿</span>
</template>
<div class="info"> 进入冥府后鬼魂就要接受十殿阎王的审讯了民间传说正式进入阎王殿前鬼魂还要喝下一碗迷魂水喝下便能口吐真言
<br>
十殿阎王分掌地府十殿统摄不同地狱掌握鬼魂投胎转世的生死大权鬼魂到了阎王面前阎王会根据其在阳间的所作所为进行奖惩以善恶定夺它入六道轮回中的哪一道
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="7">
<template slot="title">
<span class="name">进六道轮回</span>
</template>
<div class="info"> 轮回便是鬼魂转生前的最后一项鬼魂经阎王审判进入自己的轮回之道生平为善多于恶者入三善道天道阿修罗道人道;生平为恶多于善者入三恶道畜生道饿鬼道地狱道
<br><br>
天道也就是成仙成佛入极乐世界;阿修罗道中的阿修罗与我们常说的修罗不同阿修罗为梵语译成汉语为非天这些人有天人之福而无天人之德;人道就是转世成人苦乐参半;畜生道种类众多简言之就是转生成为动物六道中唯有人道畜生道的转生者拥有实体;饿鬼道化为鬼神妖魔;而地狱道是留给那些大奸大恶之人的堕入地狱受无尽之苦
<br><br>
所以生者在世时应多行善事死后才能有好的轮回
</div>
</el-collapse-item>
<el-collapse-item title="一致性 Consistency" name="8">
<template slot="title">
<span class="name">至此结束</span>
</template>
<div class="info"> 至此结束
</div>
</el-collapse-item>
</el-collapse>
</div>
</template>
<script>
export default {
data() {
return {
activeNames: ['1']
}
},
methods: {
},
mounted() {
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
text-align: left;
box-sizing: border-box;
padding: 20px;
.name {
color: #4089fd;
font-size: 16px;
}
.info {
padding-left: 30px;
padding-right: 65px;
box-sizing: border-box;
}
}
</style>

View File

@ -0,0 +1,236 @@
<template>
<el-container>
<!-- 头部区域 -->
<el-header>
<div class="title">后事管理系统</div>
<span class="time">{{ time }}</span>
<div class="back">
<el-dropdown trigger="click">
<span class="el-dropdown-link">{{ adminName }}<i class="el-icon-arrow-down el-icon--right"
style="color: #000"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><span @click="goBack">退出登录</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<el-container>
<!-- 侧边栏菜单 -->
<el-aside width="240px">
<el-menu background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" :unique-opened="true"
:router="true" :default-active="menu">
<el-menu-item index="/index" @click="saveMenu('/index')">
<i class="el-icon-s-home"></i>
<span slot="title">首页</span>
</el-menu-item>
<el-submenu :index="index.toString()" v-for="(item, index) in container"
:key="index + container.length">
<template slot="title">
<i :class="item.icon"></i>
<span>{{ item.name }}</span>
</template>
<el-menu-item v-for="(item, index) in item.children" :key="index" :index="item.path"
@click="saveMenu(item.path)">{{ item.name }}</el-menu-item>
</el-submenu>
</el-menu>
</el-aside>
<!-- main区域 -->
<el-main>
<router-view></router-view>
</el-main>
</el-container>
</el-container>
</template>
<script>
export default {
data() {
return {
adminName: '',
menu: '',
container: [],
time: ''
}
},
mounted() {
this.adminName = localStorage.getItem('adminName')
},
created() {
this.$http.get('admin/role').then(res => {
this.container = res.data.data
})
this.menu = localStorage.getItem('menu')
//this.time
setInterval(() => {
let date = new Date()
let year = date.getFullYear()
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
this.time = `${year}${month < 10 ? '0' + month : month}${day < 10 ? '0' + day : day}${hour < 10 ? '0' + hour : hour}:${minute < 10 ? '0' + minute : minute}:${second < 10 ? "0" + second : second}`
}, 1000)
},
methods: {
goBack() {
this.$confirm('确认退出登录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
localStorage.setItem('adminName', '')
localStorage.setItem('tokenStartTime', '')
localStorage.setItem('menu', '')
this.$router.push('/login')
}).catch(() => {
});
},
saveMenu(menu) {
localStorage.setItem('menu', menu)
this.menu = menu
console.log(this.menu);
},
},
}
</script>
<style lang="less" scoped>
/deep/.el-icon-arrow-down:before {
color: #fff !important;
}
.el-header {
background-color: #ffffff;
color: #333;
text-align: center;
// line-height: 60px;
display: flex;
padding: 0;
margin: 0;
justify-content: space-between;
padding-right: 30px;
box-sizing: border-box;
box-shadow: 0px 5px 5px rgb(215 215 215 / 35%) !important;
.time {
position: absolute;
left: 270px;
line-height: 60px;
}
.title {
font-size: 23px;
color: #fff;
// background: #1a7cff;
background: #545c64;
width: 240px;
height: 60px;
line-height: 60px;
}
.back {
display: flex;
align-items: center;
padding-right: 15px;
img {
width: 40px;
height: 40px;
border-radius: 100%;
// background: #1a7cff;
// border: 1px solid #ccc;
padding: 5px;
box-sizing: border-box;
margin-right: 10px;
}
.el-dropdown-link {
//
cursor: pointer;
}
.el-icon-arrow-down:before {
color: #000 !important;
font-size: 16px;
}
}
}
.el-aside {
// background-color: #1a7cff;
background: #545c64;
color: #333;
// text-align: center;
line-height: 200px;
.el-menu {
// border: 1px solid rgb(26, 124, 255);
border: 1px solid #545c64;
margin-top: 20px;
.el-submenu .el-menu-item {
padding-left: 70px !important;
}
i:before {
color: #fff;
}
.el-icon-arrow-down:before {
color: #fff;
font-size: 16px;
}
}
.el-menu-item:hover {
background: #41484e !important;
}
.el-menu-item.is-active {
// background: #006eff !important;
background: #41484e !important;
}
.el-submenu__title:focus,
.el-submenu__title:hover {
// background: #006eff !important;
background: #434950 !important;
}
.el-submenu /deep/ .el-submenu__title:hover {
// background: #006eff !important;
background: #4c5157 !important;
}
}
.el-main {
background-color: #f3f8ff;
color: #333;
text-align: center;
margin-top: 0px;
margin-right: 00px;
margin-left: 00px;
}
body>.el-container {
margin-bottom: 40px;
}
.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
line-height: 260px;
}
.el-container:nth-child(7) .el-aside {
line-height: 320px;
}
.el-container {
height: 100%;
overflow: auto;
}
</style>

View File

@ -0,0 +1,179 @@
<template>
<div class="main">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>请从左侧选择要使用的功能</span>
</div>
<div>
<span>死亡并不可怕忘记才可怕</span>
</div>
</el-card> </div>
</template>
<script>
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
* {
box-sizing: border-box;
}
.filelist {
width: 100%;
padding: 10px;
box-sizing: border-box;
.file-item {
border-bottom: 1px solid #e6e6e6;
display: flex;
align-items: center;
height: 56px;
width: calc(100% - 180px);
margin-left: 100px;
box-sizing: border-box;
.info {
color: #185ed1;
display: block;
margin-left: 62px;
cursor: pointer;
}
.uuid {
display: clock;
}
.name {
display: block;
width: 80px;
text-align: left;
}
}
}
.main {
width: calc(100% - 15px);
min-height: 100%;
height: auto;
background: #fff;
padding: 15px;
box-sizing: border-box;
.head {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 25px;
.head-block {
width: 23%;
height: 120px;
background: #fff;
border-radius: 5px;
box-shadow: 0 0 5px #ccc;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
p {
font-size: 14px;
color: #ebe9e9;
}
span {
font-size: 24px;
color: #fff;
}
}
}
.box {
width: 100%;
margin-top: 20px;
display: flex;
align-items: center;
justify-content: flex-start;
.tools-title {
display: block;
width: 100%;
font-size: 18px;
font-weight: bold;
color: #464646;
margin: 0;
text-align: left;
}
.tools {
width: calc(60% - 10px);
height: 350px;
// border: 1px solid #e9e7e7;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
overflow: hidden;
padding: 10px;
.toolsmain {
width: 100%;
height: calc(100% - 65px);
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
grid-gap: 10px;
border-radius: 5px;
margin-top: 25px;
}
.tools-item {
width: 100%;
height: 30%;
// border: 1px solid #dbd7d7;
min-height: 90px;
padding-top: 10px;
min-width: 90px;
cursor: pointer;
img {
width: 45px;
height: 45px;
display: block;
margin: 5px auto;
padding: 10px;
border: 1px solid #dbd7d7;
box-sizing: border-box;
border-radius: 100%;
}
span {
display: block;
text-align: center;
width: 100%;
font-size: 14px;
}
}
}
.box-number {
width: calc(40% - 10px);
height: 360px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
margin-left: 20px;
border-radius: 5px;
padding-left: 10px;
padding-top: 10px;
}
.box-item {
width: calc(50% - 10px);
height: 310px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
border-radius: 5px;
padding-left: 10px;
padding-top: 10px;
}
}
}
</style>

View File

@ -0,0 +1,201 @@
<template>
<div class="main">
<el-form ref="form" label-width="80px" style="padding-top:65px;">
<el-form-item label="姓名">
<el-input v-model="info.name" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="性别">
<el-select v-model="info.gender" placeholder="请选择性别" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '男' }, { value: 1, lable: '女' }]"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="info.status" placeholder="请选择当前状态" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '在职' }, { value: 1, lable: '休息' }, { value: 2, lable: '离职' }]"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="介绍">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="请输入该律师介绍"
:show-word-limit="true" maxlength="100" v-model="info.description">
</el-input>
</el-form-item>
<el-form-item style="width:100%;display: flex;justify-content: flex-end;margin-top: 52px; margin-bottom: 60px;">
<el-button type="primary" @click="clear" plain style="margin-right:15px;">清空</el-button>
</el-form-item>
</el-form>
<div class="tall">
<el-form label-width="80px"
style="width:100%;background: #fff; border-bottom: 1px solid #e1e1e1;position: relative;">
<el-form-item label="照片">
<el-upload style="margin-left:16px;" class="centerImg" :action="' '" list-type="picture-card"
:file-list="fileList" :auto-upload="false" :limit="1" :on-change="complete" ref="uploadicon">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmitPhoto" style="margin-left:68px;">立即添加</el-button>
</el-form-item>
<el-button class="searchButton" size="primary" plain @click="back()">返回上一页</el-button>
</el-form>
<el-backtop target=".el-main" :visibility-height="50"></el-backtop>
<p class="title">填写提示</p>
<span class="info">1. 状态包括在职休息和离职默认为在职</span>
<span class="info">2. 介绍内容100字之内</span>
</div>
</div>
</template>
<script>
export default {
data() {
return {
info: {
name: '',
gender: 0,
description: '',
status: 0
},
disabled: false,
imageUrl: '',
fileList: []
}
},
methods: {
clear() {
this.info = {
name: '',
gender: 0,
description: '',
status: 0
}
},
complete(file, fileList) {
const isJPG = file.raw.type === 'image/jpeg'
const isPNG = file.raw.type === 'image/png'
const isLt2M = file.raw.size / 1024 / 1024 < 5
this.hideUploadIcon = fileList.length >= 1;
if (!isPNG && !isJPG) {
this.$message.error('上传图片只能是 JPG/PNG 格式!')
return false
} else if (!isLt2M) {
this.$message.error('上传图片大小不能超过 5MB!')
return false
} else if (isLt2M && (isPNG || isJPG)) {
this.imageUrl = file.raw;//url
}
},
onSubmitPhoto() {
for (var key in this.info) {
if (this.info[key] === '') {
return this.$message.error('请填写完整信息');
}
}
if (this.imageUrl === '') return this.$message.error('请上传图片');
const loading = this.$loading({
lock: true,
text: '正在上传...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
let data = new FormData();
data.append('enchant', this.imageUrl);
data.append('name', this.info.name);
data.append('gender', this.info.gender);
data.append('description', this.info.description);
data.append('status', this.info.status);
this.$http.post('admin/addEnchanter', data, {
"Content-Type": "multipart/form-data"
}).then(res => {
loading.close();
if (res.data.code == 200) {
this.$message.success('添加成功');
this.clear()
this.fileList = []
} else {
console.log(res.data);
this.$message.error(res.data.msg);
}
})
},
back() {
this.$router.go(-1)
}
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
display: flex;
justify-content: flex-start;
position: relative;
.edit-title {
display: block;
font-size: 19px;
color: #185ed1;
position: absolute;
top: 20px;
left: 18px;
width: calc(50% - 60px);
text-align: left;
border-bottom: 1px solid #185ed1;
padding-bottom: 15px;
}
.el-form {
width: 50%;
padding: 20px;
box-sizing: border-box;
text-align: left;
padding-top: 30px;
}
.photo {
width: 149px;
height: 148px;
border-radius: 6px;
}
.searchButton {
position: absolute;
top: 20px;
right: 20px;
}
.tall {
width: calc(50% - 50px);
box-sizing: border-box;
padding: 10px;
margin-left: 50px;
background: #fbfbfb;
text-align: left;
.title {
display: block;
font-size: 18px;
font-weight: bold;
text-align: left;
}
.info {
display: block;
font-size: 16px;
line-height: 30px;
margin-top: 20px;
width: 100%;
text-align: left;
}
}
}
</style>

View File

@ -0,0 +1,590 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-input style="width: 300px" :maxlength="25" show-word-limit clear="searchInput" clearable
placeholder="姓名搜索" prefix-icon="el-icon-search" v-model="search">
</el-input>
<el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button>
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="name" label="姓名" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="photo" label="照片" min-width="60" align="center">
<template slot-scope="scope">
<el-image
style="width: 40px;top:3px; height: 40px;border:1px solid #eee; padding:1px;border-radius: 3px;"
:src="apiUrl + scope.row.photo" :preview-src-list="[apiUrl + list[scope.$index].photo]">
</el-image>
</template>
</el-table-column>
<el-table-column prop="uuid" label="身份号" min-width="160" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span class="uuid" style="color:#3799e9;" @click="copy(scope.row.uuid)">{{ scope.row.uuid
}}</span>
</template>
</el-table-column>
<el-table-column prop="gender" label="性别" min-width="90" align="center" :sortable="true">
<template slot-scope="scope">
<el-tag style="height:25px; line-height:25px;"
:type="scope.row.gender == '0' ? 'primary' : 'danger'" disable-transitions>{{
scope.row.gender == '0' ? "男" : "女"
}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="description" label="介绍" min-width="220" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.description)">{{
scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column prop="status" label="当前" min-width="100" align="center">
<template slot-scope="scope">
<el-tag style="height:25px; line-height:25px;"
:type="scope.row.status == '0' ? 'success' : scope.row.status == '1' ? 'primary' : 'danger'"
disable-transitions>{{
scope.row.status == '0' ? "在职" : scope.row.status == '1' ? "休息" : '离职'
}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="create_time" label="上任时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="type" label="是否是管理员" min-width="110" align="center">
<template slot-scope="scope">
<el-tag style="height:25px; line-height:25px;" :type="scope.row.type == '0' ? 'primary' : 'danger'"
disable-transitions>{{
scope.row.role == '2' ? "否" : "管理员"
}}
</el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="180" align="center">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-s-order" circle size="mini"
@click="card(scope.$index)"></el-button>
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="edit(scope.$index)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="del(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
<el-dialog :visible.sync="cardShow" width="490px" height="257px">
<div class="card" id="card">
<div class="card-head">
<img :src="apiUrl + item.photo" alt=""
style="width: 50px;height: 50px;border:1px solid #eee; padding:1px;border-radius: 3px;">
<div class="card-info">
<span class="card-name">{{ item.name }} <i
:style="{ color: item.gender == '0' ? '#185ed1' : 'red' }"
:class="item.gender == '0' ? 'el-icon-male' : 'el-icon-female'"></i> </span>
<span class="card-uuid">律师ID{{ item.uuid }}</span>
</div>
</div>
<span class="card-dosc">介绍{{ item.description }}</span>
<span class="card-status">律师</span>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="cardShow = false"> </el-button>
<el-button type="primary" @click="drow()"> </el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="editShow" width="550px" title="修改律师信息">
<el-form label-width="65px" style="text-align: left;">
<el-form-item label="名称">
<el-input v-model="item.name"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="item.status" placeholder="请选择状态" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '在职' }, { value: 1, lable: '休息' }, { value: 2, lable: '离职' }]"
:key="index"></el-option>
</el-select>
<el-button type="primary" @click="updateSet()" style="margin-left: 10px;">修改</el-button>
</el-form-item>
<el-form-item label="性别">
<el-select v-model="item.gender" placeholder="请选择性别" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '男' }, { value: 1, lable: '女' }]"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="介绍">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="请输入介绍内容.."
:show-word-limit="true" maxlength="100" v-model="item.description">
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editShow = false"> </el-button>
<el-button type="primary" @click="update()"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import html2canvas from 'html2canvas';
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
cardShow: false,
editShow: false,
status: 0
}
},
activated() {
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
lookDescription(info) {
this.$alert(info, '介绍', {
confirmButtonText: '确定',
callback: action => {
}
});
},
card(index) {
this.item = this.list[index]
this.cardShow = true
this.status = this.item.status
},
edit(index) {
this.item = this.list[index]
this.editShow = true
},
addBind() {
this.$router.push('/reaper/addReaper')
},
update() {
for (var key in this.item) {
if (this.item[key] === '') {
return this.$message.error('请填写完整信息');
}
}
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
let data = {
id: this.item.id,
name: this.item.name,
gender: this.item.gender,
description: this.item.description
}
this.$http.put('admin/updateEnchanter', data).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('修改成功')
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
updateSet() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
let data = {
set: 1,
id: this.item.id,
status: this.item.status
}
console.log(data);
this.$http.put('admin/updateEnchanter', data).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('修改成功')
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,<span style="color:#a93a3a">管理员律师会变成普通管理员</span>,如确认删除,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('/admin/deleteEnchanter?uuid=' + this.list[index].uuid).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
drow() {
let filename = '律师_' + this.item.name
html2canvas(document.getElementById('card'), {
useCORS: true, // 使
}).then(canvas => {
var myBlob = dataURLtoBlob(canvas.toDataURL('img/png', 0.92))
// blobURL
let url = URL.createObjectURL(myBlob)
// a
let a = document.createElement("a")
let clickEvent = document.createEvent("MouseEvents");
a.setAttribute("href", url)
a.setAttribute("download", filename)
a.setAttribute("target", '_blank')
clickEvent.initEvent('click', true, true)
a.dispatchEvent(clickEvent);
});
function dataURLtoBlob(dataurl) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
}
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
},
//
searchBind() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`/admin/getEnchanterList?name=${this.search}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`/admin/getEnchanterList?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
//
det(id) {
localStorage.setItem('menu', '/testament/data')
this.$router.push({
path: '/testament/info',
query: {
uuid: id
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,167 @@
<template>
<div class="main">
<div class="loginBox">
<div class="title">
<span class="xt_title">后事管理系统</span>
</div>
<el-form class="form" :rules="rules" ref="loginForm" :model="user">
<el-form-item prop="username">
<el-input prefix-icon="el-icon-user" placeholder="请输入登录账号" v-model="user.username"></el-input>
</el-form-item>
<el-form-item prop="password">
<el-input show-password prefix-icon="el-icon-warning-outline" placeholder="请输入密码"
v-model="user.password">
</el-input>
</el-form-item>
<span class="reg" @click="reg">注册账号</span>
<el-form-item>
<el-button type="primary" @click="login">登录</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
export default {
data() {
return {
user: {
username: '',
password: '',
},
rules: {
username: [{ required: true, message: '请输入账号', trigger: 'blur' }],
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
},
}
},
methods: {
reg() {
this.$alert('注册请联系管理员', '提示', {
confirmButtonText: '确定'
});
},
login() {
this.$refs.loginForm.validate(async (valid) => {
if (!valid) return
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
const { data: res } = await this.$http.post('api/login', {
username: this.user.username,
password: this.user.password,
})
loading.close()
if (res.code == 200) {
this.$message.success('登录成功')
//
var timestamp = Math.round(new Date().getTime() / 1000).toString()
localStorage.setItem('tokenStartTime', timestamp)
localStorage.setItem('adminToken', 'Bearer ' + res.token)
localStorage.setItem('adminName', res.adminName)
this.$router.push('/home')
} else {
this.$message.error(res.msg)
}
})
},
},
}
</script>
<style lang="less" scoped>
.info {
display: block;
text-align: center;
width: 100%;
font-size: 12px;
color: #8d8d8d;
position: absolute;
bottom: 12px;
left: 0;
}
.main {
width: 100%;
height: 100%;
background: url('../../images/index_bg.jpeg') no-repeat;
background-size: cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
bottom: 0px;
right: 0;
.loginBox {
background-image: url('../../images/u1.png');
height: 550px;
width: 480px;
padding: 10px 20px;
border: 1px solid #f2f2f2;
background-position: left top;
background-repeat: no-repeat;
background-attachment: fixed;
box-sizing: border-box;
position: relative;
top: -20px;
background-size: cover;
border-radius: 10px;
box-shadow: 2px 2px 2px #ccc;
.reg {
display: block;
width: 100%;
margin: 12px auto;
font-size: 13px;
color: #3b86ff;
text-align: right;
cursor: pointer;
}
.title {
width: 100%;
margin-top: 30px;
display: flex;
justify-content: center;
align-content: center;
.png {
height: 40px;
width: 40px;
display: block;
margin-right: 10px;
}
.xt_title {
font-family: '华文隶书 Bold', '华文隶书';
font-weight: 700;
font-style: normal;
font-size: 28px;
color: rgba(0, 0, 0, 0.627450980392157);
line-height: 45px;
}
}
.form {
margin: 0 auto;
margin-top: 30px;
width: 80%;
}
.el-button {
width: 100%;
margin-top: 30px;
}
}
}
</style>

View File

@ -0,0 +1,415 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-input placeholder="请输入搜索内容" v-model="search" class="input-with-select" style="width: 460px;">
<el-select style="width: 170px;" v-model="selectType" slot="prepend" placeholder="请选择搜索类型">
<el-option v-for="(item, index) in [{ label: '按收款人姓名搜索', value: 0 },
{ label: '按汇款人搜索', value: 1 }, { label: '收款人身份号', value: 2 }]" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
<el-button slot="append" icon="el-icon-search" @click="searchBind"></el-button>
</el-input>
<!-- <el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button> -->
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="name" label="收款人" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="uid" label="身份号" width="160" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span class="uuid" style="color:#3799e9;" @click="copy(scope.row.uid)">{{ scope.row.uid
}}</span>
</template>
</el-table-column>
<el-table-column prop="money" label="汇款数量" min-width="100" align="center" :sortable="true">
</el-table-column>
<el-table-column prop="yinmoney" label="账户余额" min-width="100" align="center" :sortable="true">
</el-table-column>
<el-table-column prop="relationship" label="汇款人" min-width="100" align="center">
</el-table-column>
<el-table-column prop="create_time" label="汇款时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="reason" label="汇款备注" min-width="220" align="left" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.reason)">{{
scope.row.reason }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="180" align="center">
<template slot-scope="scope">
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="del(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
selectType: 0,
}
},
activated() {
this.$http.get(`admin/remittance?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
lookDescription(info) {
this.$alert(info, '详情', {
confirmButtonText: '确定',
callback: action => {
}
});
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('admin/remittance?id=' + this.list[index].id).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/remittance?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/remittance?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/remittance?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
change(e) {
this.searchValue = this.dyList[e - 1].lable
},
//
searchBind() {
if (this.search == '') return this.$message.error('请输入搜索内容')
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
let search = ''
if (this.selectType == 0) {
search = `name=${this.search}`
} else if (this.selectType == 1) {
search = `relationship=${this.search}`
} else {
search = `uid=${this.search}`
}
this.$http.get(`admin/remittance?page=1&limit=12&${search}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/remittance?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 516px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,181 @@
<template>
<div class="main">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="汇款人" style="width: 500px;">
<el-input placeholder="请输入汇款人" v-model="info.relationship" type="text" maxlength="20"
show-word-limit></el-input>
</el-form-item>
<el-form-item label="收款人" style="width:500px">
<el-input placeholder="请选择收款人" v-model="user.name" @click="filebookShow = true"
@focus="filebookShow = true"></el-input>
</el-form-item>
<el-form-item label="汇款金额" style="width: 500px;">
<el-input placeholder="请输入汇款金额" v-model="info.money" type="number" maxlength="10"
show-word-limit></el-input>
</el-form-item>
<el-form-item label="汇款备注" style="width:800px">
<el-input placeholder="请输入轮回理由" v-model="info.reason" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }"
:show-word-limit="true" maxlength="1000"></el-input>
</el-form-item>
<el-form-item style="margin-top: 45px;">
<el-button type="primary" @click="clear" plain> </el-button>
<el-button type="primary" style="margin-left: 20px;" @click="post">确认汇款</el-button>
</el-form-item>
</el-form>
<el-dialog title="请选择生死簿记录" :visible.sync="filebookShow" width="620px" style="text-align: left;">
<el-form label-width="70px">
<el-form-item label="收款人">
<el-input placeholder="请输入uuid或姓名搜索" style="width:250px" v-model="filebookuuid"></el-input>
<el-button type="primary" style="margin-left:22px;" @click="querySearchAsync">搜索</el-button>
</el-form-item>
</el-form>
<div class="filelist">
<div class="file-item" v-for="(item, index) in filebook" :key="index">
<span class="name">{{ item.name }}</span>
<span class="uuid">{{ item.uuid }}</span>
<span style="margin-left: 10px;">余额{{ item.yinmoney }}</span>
<span class="info" @click="handleSelect(item)">选择</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="filebookShow = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
filebookShow: false,
filebookuuid: '',
filebook: [],
user: {},
info: {
uid: '',
reason: '管理员汇款',
money: '',
relationship: '系统'
},
}
},
methods: {
querySearchAsync() {
if (this.filebookuuid == '') return this.$message.error('请输入完整')
let search = ''
let reg = /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/
if (reg.test(this.filebookuuid)) {
search = 'name=' + this.filebookuuid
} else {
let filebookuuid = this.filebookuuid.toLocaleUpperCase()
search = 'uuid=' + filebookuuid
}
this.$http.get('admin/lifeBookSearch?' + search).then(res => {
if (res.data.data.length > 0) {
this.filebook = res.data.data
} else {
this.$message.error('暂无数据')
}
})
},
handleSelect(item) {
this.user = item
this.filebookShow = false
this.info.uid = this.user.uuid
},
clear() {
this.filebookShow = false
this.filebookuuid = ''
this.filebook = []
this.user = {}
this.info = {
uid: '',
reason: '管理员汇款',
money: '',
relationship: '系统'
}
},
post() {
if (this.info.uid == '') return this.$message.error('请选择生死簿记录');
if (this.info.money == '') return this.$message.error('请输入汇款金额');
if (this.reason == '') return this.$message.error('请输入汇款备注');
if (this.money < 100) return this.$message.error('汇款金额至少100')
this.$confirm('是否确认完成汇款?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('api/remittance', this.info).then(res => {
if (res.data.code == 200) {
this.$alert('当前该账户余额:' + res.data.data.yinmoney, res.data.msg, {
confirmButtonText: '确定',
callback: action => {
this.clear()
}
});
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
box-sizing: border-box;
padding: 20px;
text-align: left;
.filelist {
width: 100%;
padding: 10px;
box-sizing: border-box;
.file-item {
border-bottom: 1px solid #e6e6e6;
display: flex;
align-items: center;
height: 56px;
width: calc(100% - 100px);
margin-left: 50px;
box-sizing: border-box;
justify-content: space-between;
.info {
color: #185ed1;
display: block;
margin-left: 62px;
cursor: pointer;
}
.uuid {
display: block;
}
.name {
display: block;
width: 70px;
text-align: left;
}
}
}
}
</style>

View File

@ -0,0 +1,105 @@
<template>
<div class="main">
<div v-for="(item, index) in list" :key="index">
<div class="tree-box" v-if="show">
<span class="name">{{ item.name }}</span>
<el-tree :data="item.list" :default-expand-all="true" node-key="id" :props="defaultProps">
</el-tree>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
show: false,
defaultProps: {
children: 'children',
label: 'name'
},
}
},
methods: {
getInfo() {
let loading = this.$loading({
lock: true,
text: '加载中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.get(`admin/role/list?page=1&limit=100`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data;
this.list.forEach((item, index) => {
this.$http.get('admin/role/module?role=' + item.id).then(res => {
if (res.data.code == 200) {
item.list = res.data.data
if (index == this.list.length - 1) {
loading.close()
this.show = true
}
} else {
loading.close()
this.$message.error(res.data.msg)
}
})
})
} else {
loading.close()
this.$message.error(res.data.msg)
}
})
}
},
mounted() {
this.getInfo()
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background-color: #fff;
padding: 20px;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
.tree-box {
width: 180px;
margin-bottom: 20px;
border: 1px solid #ebeef5;
margin: 0 20px 20px 0;
border-top: 40px solid #f5f7fa;
padding: 10px;
position: relative;
.name {
position: absolute;
top: -40px;
left: 0;
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
color: #458bff;
}
.el-tree-node__content {
display: flex;
align-items: center;
.el-tree-node__label {
flex: 1;
}
}
}
}
</style>

View File

@ -0,0 +1,736 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-button class="addButton" size="primary" plain @click="addBind">添加</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="name" label="名称" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="description" label="描述" min-width="140" align="left" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.description)">{{
scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column prop="module" label="权限列表" min-width="280" align="left" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.module)">{{
scope.row.module }}</span>
</template>
</el-table-column>
<el-table-column fixed prop="update_time" label="更新时间" width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="180" align="center">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-s-order" circle size="mini"
@click="look(scope.$index)"></el-button>
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="edit(scope.$index)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="del(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
<el-dialog :visible.sync="editShow" width="590px" title="修改角色信息" :before-close="handleCloseTree">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="名称">
<el-input v-model="item.name"></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="请输入描述内容.."
:show-word-limit="true" maxlength="100" v-model="item.description">
</el-input>
</el-form-item>
<el-form-item label="权限列表">
<el-tree ref="edittree" :data="roleList" :default-checked-keys="moduleList.idList"
:default-expand-all="true" :check-strictly="true" show-checkbox node-key="id" :props="defaultProps"
@check-change="editchange">
</el-tree>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editShow = false"> </el-button>
<el-button type="primary" @click="update()"> </el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="cardShow" width="590px" title="添加角色">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="名称">
<el-input v-model="item.name" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="请输入描述内容.."
:show-word-limit="true" maxlength="100" v-model="item.description">
</el-input>
</el-form-item>
<el-form-item label="权限列表">
<el-tree ref="tree" :data="roleList" :default-checked-keys="[1, 2, 3, 8, 13, 16, 29, 11, 27, 7, 15]"
:default-expand-all="true" :check-strictly="true" show-checkbox node-key="id" :props="defaultProps"
@check-change="change">
</el-tree>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="editShow = false"> </el-button>
<el-button type="primary" @click="add()"> </el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="lookShow" width="500px" title="查看权限列表">
<el-tree :data="moduleList.data" :default-expand-all="true" node-key="id" :props="defaultProps">
</el-tree>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
cardShow: false,
editShow: false,
status: 0,
defaultProps: {
children: 'children',
label: 'name'
},
lookShow: false,
roleList: [
{
"id": 1,
"name": "遗嘱管理",
disabled: true,
"children": [
{
"id": 2,
"name": "数据管理",
disabled: true
},
{
"id": 3,
"name": "添加遗嘱",
disabled: true
}
]
},
{
"id": 4,
"name": "律师管理",
"children": [
{
"id": 5,
"name": "律师管理",
},
{
"id": 6,
"name": "添加律师",
}
]
},
{
"id": 7,
"name": "紧急联系人管理",
disabled: true,
"children": [
{
"id": 9,
"name": "紧急联系人记录",
},
{
"id": 10,
"name": "添加紧急联系人",
}
]
},
{
"id": 21,
"name": "角色权限",
"children": [
{
"id": 22,
"name": "角色管理",
},
{
"id": 23,
"name": "权限设置",
}
]
},
{
"id": 24,
"name": "管理员",
"children": [
{
"id": 25,
"name": "管理员管理",
},
{
"id": 26,
"name": "管理员添加",
}
]
},
{
"id": 27,
"name": "系统设置",
disabled: true,
"children": [
{
"id": 28,
"name": "系统设置",
},
{
"id": 29,
"name": "信息修改",
disabled: true
}
]
}
],
moduleList: {
data: [],
idList: []
}
}
},
activated() {
this.$http.get(`admin/role/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
lookDescription(info) {
this.$alert(info, '详细信息', {
confirmButtonText: '确定',
callback: action => {
}
});
},
card(index) {
this.item = this.list[index]
this.cardShow = true
this.status = this.item.status
},
look(index) {
let a = JSON.stringify(this.list[index])
this.item = JSON.parse(a)
// this.editShow = true
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.get('admin/role/module?role=' + this.item.id).then(res => {
loading.close()
if (res.data.code == 200) {
let obj = {
data: res.data.data,
idList: res.data.idList.split(',')
}
obj.data.unshift({
"id": 0,
"name": "首页",
disabled: true,
})
this.moduleList = obj
this.lookShow = true
} else {
this.$message.error(res.data.msg)
}
})
},
edit(index) {
let a = JSON.stringify(this.list[index])
this.item = JSON.parse(a)
// this.editShow = true
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.get('admin/role/module?role=' + this.item.id).then(res => {
loading.close()
if (res.data.code == 200) {
let obj = {
data: res.data.data,
idList: res.data.idList.split(',')
}
this.moduleList = obj
this.editShow = true
} else {
this.$message.error(res.data.msg)
}
})
},
handleCloseTree() {
this.$refs.edittree.setCheckedKeys([], false)
this.editShow = false
},
addBind() {
this.item = {
name: '',
description: '',
module: '1,2,3,8,13,16,29,11,27,7,15'
}
this.cardShow = true
},
add() {
function removeParentIds(arr, data) {
// const ids = data.map(item => item.id);
let ids = arr
data.forEach(item => {
if (arr.includes(item.id)) {
const childrenIds = item.children.map(child => child.id);
if (!childrenIds.some(id => arr.includes(id))) {
ids = ids.filter(id => id !== item.id);
}
}
});
return ids;
}
//idlist
let arr = this.item.module.split(',').map(Number);
let arrnode = removeParentIds(arr, this.roleList)
this.item.module = arrnode.join(',')
if (this.item.name == '' || this.item.description == '') return this.$message.error('请填写完整信息')
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
let data = {
name: this.item.name,
description: this.item.description,
module: this.item.module
}
this.$http.post('admin/role/add', data).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('添加成功')
this.cardShow = false
this.getInfo()
this.item = {}
} else {
this.$message.error(res.data.msg)
}
})
},
editchange() {
const checkedKeys = this.$refs.edittree.getCheckedKeys();
let arr = checkedKeys
function findParentIds(node, arr) {
if (node.children) {
for (const child of node.children) {
if (arr.includes(child.id)) {
arr.push(node.id);
}
findParentIds(child, arr);
}
}
}
let yourArray = this.roleList;
//
for (const node of yourArray) {
findParentIds(node, arr);
}
let arr1 = [...new Set(arr)]
this.item.module = arr1.join(',')
},
change() {
const checkedKeys = this.$refs.tree.getCheckedKeys();
let arr = checkedKeys
function findParentIds(node, arr) {
if (node.children) {
for (const child of node.children) {
if (arr.includes(child.id)) {
arr.push(node.id);
}
findParentIds(child, arr);
}
}
}
let yourArray = this.roleList;
//
for (const node of yourArray) {
findParentIds(node, arr);
}
let arr1 = [...new Set(arr)]
this.item.module = arr1.join(',')
},
update() {
if (this.item.name == '' || this.item.description == '') return this.$message.error('请填写完整信息')
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
function removeParentIds(arr, data) {
// const ids = data.map(item => item.id);
let ids = arr
data.forEach(item => {
if (arr.includes(item.id)) {
const childrenIds = item.children.map(child => child.id);
if (!childrenIds.some(id => arr.includes(id))) {
ids = ids.filter(id => id !== item.id);
}
}
});
return ids;
}
let arr = this.item.module.split(',').map(Number);
let arrnode = removeParentIds(arr, this.roleList)
this.item.module = arrnode.join(',')
console.log(this.item.module);
let data = {
id: this.item.id,
name: this.item.name,
description: this.item.description,
modules: this.item.module
}
this.$http.put('admin/role/edit', data).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('修改成功')
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
updateSet() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
let data = {
set: 1,
id: this.item.id,
status: this.item.status
}
console.log(data);
this.$http.put('admin/updateEnchanter', data).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('修改成功')
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,<span style="color:#a93a3a">拥有该角色的用户会修改为普通管理员</span>,如确认删除,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('admin/role/del?id=' + this.list[index].id).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/role/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/role/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/role/list?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.total;
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
},
//
det(id) {
localStorage.setItem('menu', '/lifebook/data')
this.$router.push({
path: '/lifebook/info',
query: {
uuid: id
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
position: relative;
top: -10px;
.addButton {
position: absolute;
right: 56px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,184 @@
<template>
<div class="main">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="轮回者" style="width:500px">
<el-input placeholder="请选择需要轮回的人" v-model="user.name" @click="filebookShow = true"
@focus="filebookShow = true"></el-input>
</el-form-item>
<el-form :inline="true" label-width="80px">
<el-form-item label="轮回类型">
<el-select v-model="type" placeholder="请选择轮回类型" value-key="value">
<el-option :label="item.lable" :value="item.value" v-for="(item, index) in [{ value: '人间道', lable: '人间道' }, { value: '阿修罗道', lable: '阿修罗道' }
, { value: '畜生道', lable: '畜生道' }, { value: '饿鬼道', lable: '饿鬼道' }, { value: '地狱道', lable: '地狱道' }
, { value: '天神道', lable: '天神道' }]" :key="index"></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form-item label="理由" style="width:800px">
<el-input placeholder="请输入轮回理由" v-model="reason" type="textarea" :autosize="{ minRows: 4, maxRows: 8 }"
:show-word-limit="true" maxlength="1000"></el-input>
</el-form-item>
<el-form-item style="margin-top: 45px;">
<el-button type="primary" @click="clear" plain> </el-button>
<el-button type="primary" style="margin-left: 20px;" @click="post">添加记录</el-button>
</el-form-item>
</el-form>
<el-dialog title="请选择生死簿记录" :visible.sync="filebookShow" width="580px" style="text-align: left;">
<el-form label-width="70px">
<el-form-item label="轮回者">
<el-input placeholder="请输入uuid或姓名搜索" style="width:250px" v-model="filebookuuid"></el-input>
<el-button type="primary" style="margin-left:22px;" @click="querySearchAsync">搜索</el-button>
</el-form-item>
</el-form>
<div class="filelist">
<div class="file-item" v-for="(item, index) in filebook" :key="index">
<span class="name">{{ item.name }}</span>
<span class="uuid">{{ item.uuid }}</span>
<span class="info" @click="handleSelect(item)">选择</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="filebookShow = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
filebookShow: false,
filebookuuid: '',
filebook: [],
user: {},
info: {
lifebook_id: '',
record: '',
title: ''
},
reason: '',
type: ''
}
},
methods: {
querySearchAsync() {
if (this.filebookuuid == '') return this.$message.error('请输入完整')
let search = ''
let reg = /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/
if (reg.test(this.filebookuuid)) {
search = 'name=' + this.filebookuuid
} else {
let filebookuuid = this.filebookuuid.toLocaleUpperCase()
search = 'uuid=' + filebookuuid
}
this.$http.get('admin/lifeBookSearch?' + search).then(res => {
if (res.data.data.length > 0) {
this.filebook = res.data.data
} else {
this.$message.error('暂无数据')
}
})
},
handleSelect(item) {
this.user = item
this.filebookShow = false
this.info.lifebook_id = this.user.id
},
clear() {
this.info = {
lifebook_id: '',
record: '',
title: ''
}
this.stance = ''
this.type = 2
this.filebookuuid = ''
this.filebook = []
this.user = {}
this.lun_type = ''
this.time = ''
this.yu_type = ''
},
post() {
if (this.info.lifebook_id == '') return this.$message.error('请选择生死簿记录');
//
if (this.yu_type == '') return this.$message.error('请选择轮回类型');
if (this.reason == '') return this.$message.error('请输入轮回理由');
this.$confirm('是否确认添加此数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = {
uid: this.info.lifebook_id,
type: this.type,
reason: this.reason,
}
this.$http.post('admin/reincarnationadd', data).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg);
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
box-sizing: border-box;
padding: 20px;
text-align: left;
.filelist {
width: 100%;
padding: 10px;
box-sizing: border-box;
.file-item {
border-bottom: 1px solid #e6e6e6;
display: flex;
align-items: center;
height: 56px;
width: calc(100% - 180px);
margin-left: 100px;
box-sizing: border-box;
.info {
color: #185ed1;
display: block;
margin-left: 62px;
cursor: pointer;
}
.uuid {
display: clock;
}
.name {
display: block;
width: 80px;
text-align: left;
}
}
}
}
</style>

View File

@ -0,0 +1,459 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-select v-model="search" placeholder="请选择轮回类型" style="width: 300px;" @change="change">
<el-option v-for="item in dyList" :key="item.value" :label="item.lable" :value="item.lable">
</el-option>
</el-select>
<el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button>
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
<el-button class="addButton" size="primary" plain @click="addBind">添加</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="uname" label="姓名" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="user_uuid" label="身份号" width="160" align="center" show-overflow-tooltip>
<template slot-scope="scope">
<span class="uuid" style="color:#3799e9;" @click="copy(scope.row.user_uuid)">{{ scope.row.user_uuid
}}</span>
</template>
</el-table-column>
<el-table-column prop="type" label="轮回类型" min-width="100" align="center" :sortable="true">
</el-table-column>
<el-table-column prop="description" label="轮回理由" min-width="240" align="left" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer;" @click="lookDescription(scope.row.reason)">{{
scope.row.reason }}</span>
</template>
</el-table-column>
<el-table-column prop="aname" label="操作者" min-width="100" align="center">
</el-table-column>
<el-table-column prop="create_time" label="判处时间" min-width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="180" align="center">
<template slot-scope="scope">
<el-button type="primary" icon="el-icon-edit" circle size="mini"
@click="edits(scope.row)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle size="mini"
@click="del(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
<!-- 修改理由 -->
<el-dialog title="修改理由" :visible.sync="editShow" width="30%" :close-on-click-modal="false">
<el-form :model="item" label-width="80px" class="demo-ruleForm" style="text-align: left;">
<el-form-item label="轮回理由" prop="reason">
<el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="edit.reason"></el-input>
</el-form-item>
<el-form-item label="轮回类型">
<el-select v-model="edit.type" placeholder="请选择轮回类型" style="width: 300px;">
<el-option v-for="item in dyList" :key="item.value" :label="item.lable" :value="item.lable">
</el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="editShow = false"> </el-button>
<el-button type="primary" @click="editSubmit()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
searchValue: 0,
editShow: false,
edit: {},
and: '',
dyList: [{ value: '1', lable: '人间道' }, { value: '2', lable: '阿修罗道' }
, { value: '3', lable: '畜生道' }, { value: '4', lable: '饿鬼道' }, { value: '5', lable: '地狱道' }
, { value: '6', lable: '天神道' }],
}
},
activated() {
this.$http.get(`admin/reincarnationlist?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
addBind() {
this.$router.push('/samsara/addSamsaraLog')
},
edits(item) {
this.editShow = true
this.edit = item
},
editSubmit() {
if (this.edit.reason == '') {
this.$message.error('请输入轮回理由')
return
}
if (this.edit.time == '') {
this.$message.error('请输入轮回类型')
return
}
console.log(this.edit);
this.$http.put('admin/reincarnationedit', {
id: this.edit.id,
reason: this.edit.reason,
type: this.edit.type,
}).then(res => {
if (res.data.code == 200) {
this.$message.success(res.data.msg)
this.editShow = false
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
},
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
lookDescription(info) {
this.$alert(info, '详情', {
confirmButtonText: '确定',
callback: action => {
}
});
},
del(index) {
this.item = this.list[index]
// / admin / deleteEnchanter
this.$prompt('此操作会删除重要数据,请在下方输入 “ 确认删除 ”', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /确认删除/,
inputErrorMessage: '请确认删除',
dangerouslyUseHTMLString: true,
inputPlaceholder: '请输入确认删除'
}).then(({ value }) => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('admin/reincarnationdel?id=' + this.list[index].id).then(res => {
loading.close()
if (res.data.code == '200') {
this.$message.success('删除成功')
this.getInfo()
} else {
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消删除'
});
});
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/reincarnationlist?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/reincarnationlist?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/reincarnationlist?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
change(e) {
this.searchValue = this.dyList[e - 1].lable
},
//
searchBind() {
this.and = ''
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/reincarnationlist?type=${this.search}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
this.and = ''
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/reincarnationlist?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,85 @@
<template>
<div class="main">
<img src="../../../images/u1144.png" class="top" alt="">
<img src="../../../images/lunhui.png" alt="" class="lun">
<el-button type="primary" @click="rotate">随机轮回</el-button>
</div>
</template>
<script>
export default {
data() {
return {
kss: "选择中"
}
},
methods: {
// you
rotate() {
var lun = document.getElementsByClassName("lun")[0];
lun.style.transform = "rotate(44.5deg)";
var i = 44.5;
var de = parseInt(Math.random() * (720 - 405 + 1) + 720, 10) + 44.5;
let hs = setInterval(() => {
if (i < de) {
i++;
lun.style.transform = "rotate(" + (i) + "deg)";
} else {
clearInterval(hs);
var sy = (i) % 360 - 44.5;
if (sy <= 60) {
this.kss = "人间道";
} else if (sy > 60 && sy <= 120) {
this.kss = "阿修罗道";
} else if (sy > 120 && sy <= 180) {
this.kss = "畜生道";
} else if (sy > 180 && sy <= 240) {
this.kss = "饿鬼道";
} else if (sy > 240 && sy <= 300) {
this.kss = "地狱道";
} else {
this.kss = "天神道";
}
}
}, 1)
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
height: 100%;
background: #fff;
position: relative;
.top {
position: absolute;
top: 22px;
left: calc(50% - 53px);
width: 106px;
z-index: 10;
}
.lun {
width: 481px;
position: absolute;
top: 55px;
left: calc(50% - 240.5px);
z-index: 8;
// transform: rotate(44.5deg);
animation-duration: 1s;
}
.el-button {
width: 180px;
position: absolute;
top: 595px;
left: calc(50% - 90px);
z-index: 11;
}
}
</style>

View File

@ -0,0 +1,156 @@
<template>
<div class="main">
<span class="title">修改账号信息</span>
<el-alert title="以下操作都需要重新登录,请确认记得当前登录密码或新修改的密码" type="info" show-icon
style="width: 600px; line-height: 40px; margin-bottom: 30px;"></el-alert>
<el-form label-width="90px">
<el-form-item label="修改昵称">
<el-input v-model="form.nickname" placeholder="请输入新的昵称" style="width: 300px;"></el-input>
<el-button type="primary" @click="updateAccount" style="margin-left: 22px;">立即修改</el-button>
</el-form-item>
<div class="setPass">
<span class="ptit">修改密码</span>
<el-form-item label="当前密码">
<el-input v-model="form.oldpassword" type="password" placeholder="请输入当前密码"
style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="新的密码">
<el-input v-model="form.password" type="password" placeholder="请输入新的密码"
style="width: 300px;"></el-input>
</el-form-item>
<el-form-item label="重复新密码">
<el-input v-model="form.password_confirmation" type="password" placeholder="请再次输入新的密码"
style="width: 300px;"></el-input>
</el-form-item>
<el-form-item style="text-align: right; padding-right: 8px;">
<el-button type="primary" @click="updateAccountPassword">立即修改</el-button>
</el-form-item>
</div>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
form: {
nickname: '',
password: '',
oldpassword: '',
password_confirmation: ''
}
}
},
methods: {
updateAccount() {
if (this.form.nickname == '') {
this.$message.error('请输入新的昵称');
return;
}
this.$confirm('修改账号之后需要重新登录,是否确认修改并且记得当前登录密码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.put('admin/admin/nickname', this.form).then(res => {
if (res.data.code == 200) {
this.$message.success('修改成功');
localStorage.setItem('adminName', '')
localStorage.setItem('tokenStartTime', '')
localStorage.setItem('menu', '')
this.$router.push('/login')
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消修改'
});
});
},
updateAccountPassword() {
if (this.form.oldpassword == '' || this.form.password == '' || this.form.password_confirmation == '') {
this.$message.error('请输入完整的密码信息');
return;
}
if (this.form.password != this.form.password_confirmation) {
this.$message.error('两次输入的密码不一致');
return;
}
this.$confirm('修改密码之后需要重新登录,是否确认修改并且记得新密码?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let data = {
oldpass: this.form.oldpassword,
newpass: this.form.password,
}
this.$http.put('admin/admin/password', data).then(res => {
if (res.data.code == 200) {
this.$message.success('修改成功');
localStorage.setItem('adminName', '')
localStorage.setItem('tokenStartTime', '')
localStorage.setItem('menu', '')
this.$router.push('/login')
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消修改'
});
});
}
},
mounted() {
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
height: 100%;
background-color: #fff;
box-sizing: border-box;
text-align: left;
padding: 20px;
.ptit {
font-size: 16px;
font-weight: 600;
margin-bottom: 20px;
display: inline-block;
}
.title {
font-size: 20px;
font-weight: 600;
margin-bottom: 28px;
display: inline-block;
}
.time {
margin-left: 20px;
color: #999;
}
.setPass {
margin-top: 40px;
border: 1px solid #eee;
width: 440px;
padding: 20px;
box-sizing: border-box;
}
}
</style>

View File

@ -0,0 +1,126 @@
<template>
<div class="main">
<span class="title">修改系统信息</span>
<el-form label-width="130px">
<el-form-item label="律师管理开关">
<el-switch :value="findValue('remittance')" @change="updateValue('remittance', $event)"
active-color="#13ce66" inactive-color="#aaa"></el-switch>
<span class="time">修改于{{ findTime('remittance') }}</span>
</el-form-item>
<el-form-item label="紧急联系人添加开关">
<el-switch :value="findValue('woodenfish')" @change="updateValue('woodenfish', $event)"
active-color="#13ce66" inactive-color="#aaa"></el-switch>
<span class="time">修改于{{ findTime('woodenfish') }}</span>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
list: []
}
},
methods: {
getInfo() {
this.$http.get('admin/systemset').then(res => {
this.list = res.data.data;
console.log(this.list);
})
},
findValue(key) {
let value = '';
this.list.forEach(item => {
if (item.key == key) {
value = item.value;
}
});
if (value == '1' || value == '0') return value == '1' ? true : false;
return value;
},
findTime(key) {
let value = '';
this.list.forEach(item => {
if (item.key == key) {
value = item.create_time;
}
});
return value;
},
addZero(num) {
return num < 10 ? '0' + num : num;
},
updateValue(key, value) {
let setValue = ''
//value
if (typeof value == 'boolean') {
setValue = value ? '1' : '0';
} else {
setValue = value;
}
this.$http.put('admin/systemset', {
key: key,
value: setValue
}).then(res => {
if (res.data.code == 200) {
this.$message({
message: res.data.msg,
type: 'success'
});
//0
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
let time = year + '-' + this.addZero(month) + '-' + this.addZero(day) + ' ' + this.addZero(hour) + ':' + this.addZero(minute) + ':' + this.addZero(second);
//
this.list.forEach(item => {
if (item.key == key) {
item.value = setValue;
item.create_time = time;
}
});
} else {
this.$message({
message: res.data.msg,
type: 'error'
});
}
})
}
},
mounted() {
this.getInfo()
},
}
</script>
<style lang="less" scoped>
.main {
background: #fff;
width: 100%;
height: 100%;
padding: 20px;
text-align: left;
box-sizing: border-box;
.title {
display: block;
font-size: 20px;
font-weight: 600;
margin-bottom: 20px;
}
.time {
margin-left: 20px;
color: #aaa;
font-size: 14px;
}
}
</style>

View File

@ -0,0 +1,299 @@
<template>
<div class="main">
<span class="edit-title">遗嘱修改</span>
<el-form ref="form" label-width="80px" style="padding-top:80px;">
<el-form-item label="姓名">
<el-input v-model="info.name" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="性别">
<el-select v-model="info.gender" placeholder="请选择性别" value-key="value">
<el-option :label="item.lable" :value="item.value"
v-for="(item, index) in [{ value: 0, lable: '男' }, { value: 1, lable: '女' }]"
:key="index"></el-option>
</el-select>
</el-form-item>
<el-form-item label="出生时间">
<el-date-picker @change="changeDateBirthday" v-model="info.birthday" type="datetime" placeholder="选择出生时间">
</el-date-picker>
</el-form-item>
<el-form-item label="出生地址">
<el-input v-model="info.birthplace" placeholder="详细出生地址" :show-word-limit="true" maxlength="200"></el-input>
</el-form-item>
<el-form-item label="婚配情况">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="23岁取得一妻子.."
:show-word-limit="true" maxlength="500" v-model="info.marriage">
</el-input>
</el-form-item>
<el-form-item label="子女数量">
<el-input v-model="info.child" type="number" placeholder="单位个"></el-input>
</el-form-item>
<el-form-item label="人生大事">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="如高考,中彩票"
:show-word-limit="true" maxlength="1200" v-model="info.event">
</el-input>
</el-form-item>
<el-form-item label="人物描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="性格,爱好" :show-word-limit="true"
maxlength="1200" v-model="info.characterinfo">
</el-input>
</el-form-item>
<el-form-item label="人物属性">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="技术宅,靓仔"
:show-word-limit="true" maxlength="500" v-model="info.attribute">
</el-input>
</el-form-item>
<el-form-item label="人生描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="这一辈子过得怎么样"
:show-word-limit="true" maxlength="1800" v-model="info.description">
</el-input>
</el-form-item>
<el-form-item label="遗嘱">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="我要留下什么···"
:show-word-limit="true" maxlength="1800" v-model="info.testament">
</el-input>
</el-form-item>
<el-form-item style="width:100%;display: flex;justify-content: flex-end;margin-top: 52px; margin-bottom: 60px;">
<el-button type="primary" @click="clear" plain style="margin-right:15px;">清空</el-button>
<el-button type="primary" @click="onSubmit" :disabled="disabled">提交修改</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
info: {
name: '',
birthday: '',
gender: '',
birthplace: '',
child: '',
marriage: '',
event: '',
description: '',
characterinfo: '',
attribute: '',
testament: ''
},
disabled: false,
imageUrl: '',
fileList: []
}
},
methods: {
changeDateDeathday(val) {
this.info.deathday = this.formatDate(val)
if (this.info.birthday) {
//寿
var birthday = new Date(this.info.birthday);
var deathday = new Date(this.info.deathday);
var longevity = deathday.getFullYear() - birthday.getFullYear();
this.info.longevity = longevity;
}
},
changeDateBirthday(val) {
this.info.birthday = this.formatDate(val)
if (this.info.deathday) {
//寿
var birthday = new Date(this.info.birthday);
var deathday = new Date(this.info.deathday);
var longevity = deathday.getFullYear() - birthday.getFullYear();
this.info.longevity = longevity;
}
},
onSubmit() {
//this.info
console.log(this.info);
for (var key in this.info) {
if (key != 'photo' && key != 'status' && key != 'reincarnation' && this.info[key] === '') {
return this.$message.error('请填写完整信息');
} else if (!isNaN(this.info[key]) && this.info[key] < 0) {
return this.$message.error('请填写正确信息');
}
}
const loading = this.$loading({
lock: true,
text: '正在修改...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.put('admin/lifeBookUpdate', this.info).then(res => {
loading.close();
if (res.data.code == 200) {
this.$message.success('修改成功');
} else {
this.$message.error(res.data.msg);
}
})
},
clear() {
this.info = {
name: '',
birthday: '',
gender: '',
birthplace: '',
child: '',
marriage: '',
event: '',
description: '',
characterinfo: '',
attribute: '',
testament: ''
}
},
//
formatDate(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
var minute = date.getMinutes();
minute = minute < 10 ? ('0' + minute) : minute;
var second = date.getSeconds();
second = minute < 10 ? ('0' + second) : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
},
complete(file, fileList) {
const isJPG = file.raw.type === 'image/jpeg'
const isPNG = file.raw.type === 'image/png'
const isLt2M = file.raw.size / 1024 / 1024 < 5
this.hideUploadIcon = fileList.length >= 1;
if (!isPNG && !isJPG) {
this.$message.error('上传图片只能是 JPG/PNG 格式!')
return false
} else if (!isLt2M) {
this.$message.error('上传图片大小不能超过 5MB!')
return false
} else if (isLt2M && (isPNG || isJPG)) {
this.imageUrl = file.raw;//url
}
},
onSubmitPhoto() {
if (this.imageUrl === '') return this.$message.error('请上传图片');
const loading = this.$loading({
lock: true,
text: '正在上传...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
let data = new FormData();
data.append('photo', this.imageUrl);
data.append('id', this.info.id);
this.$http.post('admin/lifeBookUpdateImg', data, {
"Content-Type": "multipart/form-data"
}).then(res => {
loading.close();
if (res.data.code == 200) {
this.$message.success('修改成功');
} else {
console.log(res.data);
this.$message.error(res.data.msg);
}
})
},
removeSpaces(str) {
return str.replace(/\s+/g, '');
},
back() {
this.$router.go(-1)
}
},
mounted() {
this.$http.get('admin/lifeBookSearch?uuid=' + this.$route.query.uuid).then(res => {
if (res.data.code == 200) {
this.info = res.data.data[0];
//this.info.year
this.info.year = this.removeSpaces(this.info.year)
this.fileList.push({
name: '照片',
url: this.apiUrl + this.info.photo
})
} else {
this.$message.error(res.data.msg);
}
})
},
computed: {
genderText() {
return this.info.gender === '1' ? '女' : '男';
},
},
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
display: flex;
justify-content: flex-start;
position: relative;
.edit-title {
display: block;
font-size: 19px;
color: #185ed1;
position: absolute;
top: 20px;
left: 18px;
width: calc(50% - 60px);
text-align: left;
border-bottom: 1px solid #185ed1;
padding-bottom: 15px;
}
.el-form {
width: 50%;
padding: 20px;
box-sizing: border-box;
text-align: left;
padding-top: 30px;
}
.photo {
width: 149px;
height: 148px;
border-radius: 6px;
}
.searchButton {
position: absolute;
top: 20px;
right: 20px;
}
.tall {
width: calc(50% - 50px);
box-sizing: border-box;
padding: 10px;
margin-left: 50px;
background: #fbfbfb;
text-align: left;
.title {
display: block;
font-size: 18px;
font-weight: bold;
text-align: left;
}
.info {
display: block;
font-size: 16px;
line-height: 30px;
margin-top: 20px;
width: 100%;
text-align: left;
}
}
}
</style>

View File

@ -0,0 +1,324 @@
<template>
<div class="human-details">
<el-form ref="form" label-width="80px" style="width: 100%;">
<div class="head">
<div class="human-info" style="border:none;margin-top:0;">
<p class="name">{{ human.name }}</p>
<p class="card" style="cursor: pointer;" @click="copy(human.uuid)"><strong
style="width:120px;">唯一遗嘱身份号:</strong>
<span style="border-bottom: 1px solid #3799e9; padding-bottom:2px;color: #3799e9;">{{ human.uuid
}}</span>
</p>
</div>
<el-button class="searchButton" size="primary" plain @click="back()">返回上一页</el-button>
<el-button class="editButton" size="primary" plain @click="editShow()">修改</el-button>
<el-button class="delButton" size="danger" plain @click="delButton()">删除数据</el-button>
</div>
<div class="human-info-wrapper">
<div class="human-info column">
<p><strong>数据ID:</strong> {{ human.id }}</p>
<p><strong>性别:</strong> {{ human.gender == 0 ? '男' : '女' }}</p>
<p><strong>出生日期:</strong> {{ human.birthday }}</p>
<p><strong>出生地址:</strong> {{ human.birthplace }}</p>
<p><strong>创建时间:</strong> {{ human.create_time }}</p>
<p><strong>婚姻情况:</strong> {{ human.marriage }}</p>
<p><strong>子女数量:</strong> {{ human.child }}</p>
</div>
<div class="human-info column">
<p><strong>人生大事:</strong> {{ human.event || '暂无' }}</p>
<p><strong>属性描述:</strong> {{ human.attribute || '暂无' }}</p>
<p><strong>人生描述:</strong> {{ human.description || '暂无' }}</p>
<p><strong>人物描述:</strong> {{ human.characterinfo || '暂无' }}</p>
<p><strong> 遗嘱:</strong> {{ human.testament || '暂无' }}</p>
</div>
</div>
</el-form>
<el-dialog :visible.sync="dialogVisible" width="1379.2px" title="生死簿">
<img :src="imgurl" alt="" class="canvas">
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="drow()">下载</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
human: {},
dis: true,
dialogVisible: false,
inner: '',
imgurl: '',
}
},
methods: {
back() {
//
this.$router.go(-1);
},
editShow() {
//
this.$router.push({
path: '/testament/edit',
query: {
uuid: this.human.uuid
}
})
},
exprotButton() {
if (this.imgurl != '') {
this.dialogVisible = true
return
}
//
let a = this.human
let inner = `${a.name},身份号${a.uuid},于${a.birthday}出生于${a.birthplace},生辰八字为${a.year},于${a.deathday}${a.deathplace}${a.reason}${a.type == 0 ? '自然死亡' : '意外死亡'}离世入府,计寿元${a.longevity}年。
命中带财${a.money}阴财${a.yinmoney}所积阳德${a.yang}阴德${a.yin}${a.marriage}有${a.child}个子女${a.event}${a.description}${a.name}${a.characterinfo}死后${a.afterlife}判得赏罚${a.reward}
现在${a.status == 0 ? '还未出世。' : a.status == 1 ? '在世生活。' : a.status == 2 ? '魂归地府' : a.status == 3 ? '已进入轮回。' : '已打入地狱受刑。'}`
this.inner = inner
const loading = this.$loading({
lock: true,
text: '正在生成图片一般10秒内完成...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.post('/api/lifebook/export', {
inner: this.inner
}, { responseType: 'blob' }).then((response) => {
this.dialogVisible = true
loading.close();
const myBlob = new window.Blob([response.data], { type: 'image/png' })
console.log(myBlob)
const qrUrl = window.URL.createObjectURL(myBlob)
this.imgurl = qrUrl
}).catch((err) => {
console.log(err);
loading.close();
this.$message({
type: 'error',
message: '生成失败'
})
})
},
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
drow() {
const loading = this.$loading({
lock: true,
text: '正在生成图片...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const imgElement = document.querySelector('.canvas');
const link = document.createElement('a');
link.download = this.human.name + '.png';
fetch(imgElement.src)
.then((response) => response.blob())
.then((blob) => {
const imageURL = URL.createObjectURL(blob);
link.href = imageURL;
link.click();
loading.close();
URL.revokeObjectURL(imageURL);
})
.catch((error) => {
console.error('Error:', error);
});
},
delButton() {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.delete('admin/lifeBookDelete?id=' + this.human.id).then(res => {
loading.close()
if (res.data.code == 200) {
this.$message.success('删除成功')
this.$router.go(-1);
} else {
loading.close()
this.$message.error(res.data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}
},
mounted() {
this.uuid = this.$route.query.uuid;
this.$http.get('admin/lifeBookSearch?uuid=' + this.uuid)
.then((response) => {
this.human = response.data.data[0];
})
.catch((err) => {
this.$message({
type: 'error',
message: '出现错误'
})
})
}
}
</script>
<style scoped>
* {
box-sizing: border-box;
}
.imgbox {
/* width: 223.2px;
height: 142.5px; */
width: 1339.2px;
height: 855px;
background-image: url(../../../images/lifebook_bg.png);
background-size: 100% 100%;
padding: 30px 60px;
box-sizing: border-box;
padding-bottom: 63px;
}
.canvas {
width: 1339.2px;
height: 855px;
}
.inner {
font-family: '华文隶书 Bold', '华文隶书';
font-weight: 700;
font-style: normal;
font-size: 28px;
color: rgba(0, 0, 0, 0.627450980392157);
line-height: 45px;
writing-mode: vertical-rl;
display: block;
width: 100%;
height: 100%;
text-align: right;
line-height: 53px;
text-orientation: mixed;
}
.human-details {
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
width: 100%;
min-height: 100%;
overflow: auto;
padding: 20px;
}
strong {
display: inline-block;
width: 83px;
}
.human-photo {
width: 60px;
height: 60px;
border: 1px solid #ccc;
border-radius: 50%;
overflow: hidden;
}
.head {
display: flex;
justify-content: flex-start;
width: 100%;
padding-bottom: 20px;
position: relative;
align-items: center;
align-content: center;
height: 75px;
border-bottom: 1px solid #d8d8d8;
}
.searchButton {
position: absolute;
right: 20px;
}
.editButton {
position: absolute;
right: 160px;
}
.delButton {
position: absolute;
right: 260px;
}
.human-info {
margin-left: 10px;
margin-top: 30px;
border: 1px solid #e1e1e1;
border-top: 40px solid #e2e2e2;
padding-left: 10px;
box-sizing: border-box;
padding-bottom: 20px;
line-height: 27px;
}
.name {
display: block;
font-size: 15px;
font-weight: bold;
margin: 0;
}
.card {
display: block;
font-size: 15px;
font-weight: bold;
margin: 0;
color: #999;
margin-top: 5px;
}
.human-photo img {
width: 100%;
height: 100%;
object-fit: cover;
}
.human-info-wrapper {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
}
.column {
flex: 0 0 calc(50% - 20px);
margin-bottom: 20px;
}
.human-info {
text-align: left;
}
</style>

View File

@ -0,0 +1,217 @@
<template>
<div class="main">
<el-form ref="form" label-width="80px">
<el-form-item label="姓名">
<el-input v-model="info.name" placeholder="请输入姓名"></el-input>
</el-form-item>
<el-form-item label="性别">
<el-select v-model="info.gender" placeholder="请选择性别">
<el-option label="男" value="0"></el-option>
<el-option label="女" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="出生时间">
<el-date-picker @change="changeDateBirthday" v-model="info.birthday" type="datetime" placeholder="选择出生时间">
</el-date-picker>
</el-form-item>
<el-form-item label="出生地址">
<el-input v-model="info.birthplace" placeholder="详细出生地址" :show-word-limit="true" maxlength="200"></el-input>
</el-form-item>
<el-form-item label="婚配情况">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" placeholder="23岁取得一妻子.."
:show-word-limit="true" maxlength="500" v-model="info.marriage">
</el-input>
</el-form-item>
<el-form-item label="子女数量">
<el-input v-model="info.child" type="number" placeholder="单位个"></el-input>
</el-form-item>
<el-form-item label="人生大事">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="如高考,中彩票"
:show-word-limit="true" maxlength="1200" v-model="info.event">
</el-input>
</el-form-item>
<el-form-item label="人物描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="性格,爱好" :show-word-limit="true"
maxlength="1200" v-model="info.characterinfo">
</el-input>
</el-form-item>
<el-form-item label="人物属性">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="技术宅,靓仔"
:show-word-limit="true" maxlength="500" v-model="info.attribute">
</el-input>
</el-form-item>
<el-form-item label="人生描述">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="这一辈子过得怎么样"
:show-word-limit="true" maxlength="1800" v-model="info.description">
</el-input>
</el-form-item>
<el-form-item label="遗嘱">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 8 }" placeholder="我要留下什么···"
:show-word-limit="true" maxlength="1800" v-model="info.testament">
</el-input>
</el-form-item>
<el-form-item style="width:100%;display: flex;justify-content: flex-end;margin-top: 52px; margin-bottom: 60px;">
<el-button type="primary" @click="clear" plain style="margin-right:15px;">清空</el-button>
<el-button type="primary" @click="onSubmit" :disabled="disabled">立即创建</el-button>
</el-form-item>
</el-form>
<el-backtop target=".el-main" :visibility-height="50"></el-backtop>
</div>
</template>
<script>
export default {
data() {
return {
info: {
name: '',
birthday: '',
gender: '',
birthplace: '',
child: '',
marriage: '',
event: '',
description: '',
characterinfo: '',
attribute: '',
testament: ''
},
disabled: false,
imageUrl: ''
}
},
methods: {
changeDateDeathday(val) {
this.info.deathday = this.formatDate(val)
if (this.info.birthday) {
//寿
var birthday = new Date(this.info.birthday);
var deathday = new Date(this.info.deathday);
var longevity = deathday.getFullYear() - birthday.getFullYear();
this.info.longevity = longevity;
}
},
changeDateBirthday(val) {
this.info.birthday = this.formatDate(val)
if (this.info.deathday) {
//寿
var birthday = new Date(this.info.birthday);
var deathday = new Date(this.info.deathday);
var longevity = deathday.getFullYear() - birthday.getFullYear();
this.info.longevity = longevity;
}
},
onSubmit() {
//this.info
// for (var key in this.info) {
// if (key != 'photo' && key != 'status' && key != 'reincarnation' && this.info[key] === '') {
// return this.$message.error('');
// } else if (!isNaN(this.info[key]) && this.info[key] < 0) {
// return this.$message.error('');
// }
// }
const loading = this.$loading({
lock: true,
text: '正在添加...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.post('admin/lifeBookAdd', this.info).then(res => {
loading.close();
if (res.data.code == 200) {
this.$message.success('添加成功');
this.clear();
} else {
this.$message.error(res.data.msg);
}
})
},
clear() {
this.info = {
name: '',
birthday: '',
gender: '',
birthplace: '',
child: '',
marriage: '',
event: '',
description: '',
characterinfo: '',
attribute: '',
testament: ''
}
},
//
formatDate(date) {
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
var minute = date.getMinutes();
minute = minute < 10 ? ('0' + minute) : minute;
var second = date.getSeconds();
second = minute < 10 ? ('0' + second) : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
},
},
mounted() {
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
display: flex;
justify-content: flex-start;
.el-form {
width: 50%;
padding: 20px;
box-sizing: border-box;
text-align: left;
}
.photo {
width: 149px;
height: 148px;
border-radius: 6px;
}
.tall {
width: calc(50% - 50px);
box-sizing: border-box;
padding: 10px;
margin-left: 50px;
background: #fbfbfb;
text-align: left;
.title {
display: block;
font-size: 18px;
font-weight: bold;
text-align: left;
}
.info {
display: block;
font-size: 16px;
line-height: 30px;
margin-top: 20px;
width: 100%;
text-align: left;
}
}
}
</style>

View File

@ -0,0 +1,297 @@
<template>
<div class="main">
<el-card class="box-card">
<div class="tableHead">
<el-input style="width: 300px" :maxlength="25" show-word-limit clear="searchInput" clearable
placeholder="姓名搜索" prefix-icon="el-icon-search" v-model="search">
</el-input>
<el-button class="searchButton" size="primary" plain @click="searchBind">搜索</el-button>
<el-button v-if="isyuan" class="yuan" size="primary" plain @click="yuan">原数据
</el-button>
</div>
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="name" label="姓名" min-width="100" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="birthday" label="出生日期" min-width="140" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="gender" label="性别" min-width="90" align="center" :sortable="true">
<template slot-scope="scope">
<el-tag style="height:25px; line-height:25px;"
:type="scope.row.gender == '0' ? 'primary' : 'danger'" disable-transitions>{{
scope.row.gender == '0' ? "男" : "女"
}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="child" label="后代数" min-width="90" align="center" :sortable="true"
show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.child }}
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" min-width="100" align="center">
<template slot-scope="scope">
<i class="el-icon-s-order" style="color:#1a7cff; font-size:20px; cursor:pointer;"
@click="det(scope.row.uuid)"></i>
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
}
},
activated() {
console.log('我这个页面显示就会执行');
this.$http.get(`admin/lifeBookList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
//
filterHandler(value, row, column) {
const property = column['property'];
return row[property] == value;
},
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/lifeBookList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/lifeBookList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get('admin/lifeBookList?page=1&limit=12').then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.total;
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
},
//
searchBind() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/lifeBookSearch?name=${this.search}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/lifeBookList?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
//
det(id) {
localStorage.setItem('menu', '/testament/data')
this.$router.push({
path: '/testament/info',
query: {
uuid: id
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
}
</style>

View File

@ -0,0 +1,163 @@
<template>
<div class="main">
<el-form label-width="80px" style="text-align: left;">
<el-form-item label="遗嘱人" style="width:500px">
<el-input placeholder="请选择遗嘱人" v-model="user.name" @click="filebookShow = true"
@focus="filebookShow = true"></el-input>
</el-form-item>
<el-form-item label="姓名" style="width:500px">
<el-input placeholder="请输入联系人姓名" v-model="info.contact" :show-word-limit="true" maxlength="200"></el-input>
</el-form-item>
<el-form-item label="电话" style="width:500px">
<el-input placeholder="请输入联系人电话" v-model="info.phonenumber" :show-word-limit="true" maxlength="200"></el-input>
</el-form-item>
<el-form-item style="margin-top: 105px;">
<el-button type="primary" @click="clear" plain> </el-button>
<el-button type="primary" style="margin-left: 20px;" @click="post">提交</el-button>
</el-form-item>
</el-form>
<el-dialog title="请选择记录" :visible.sync="filebookShow" width="580px" style="text-align: left;">
<el-form label-width="70px">
<el-form-item label="遗嘱人">
<el-input placeholder="请输入uuid搜索" style="width:250px" v-model="filebookuuid"></el-input>
<el-button type="primary" style="margin-left:22px;" @click="querySearchAsync">搜索</el-button>
</el-form-item>
</el-form>
<div class="filelist">
<div class="file-item" v-for="(item, index) in filebook" :key="index">
<span class="name">{{ item.name }}</span>
<span class="uuid">{{ item.uuid }}</span>
<span class="info" @click="handleSelect(item)">选择</span>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="filebookShow = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
filebookShow: false,
filebookuuid: '',
filebook: [],
user: {},
info: {
contact: '',
phonenumber: '',
},
}
},
mounted() {
//namelunsamsara/selection
this.$router.push('/trial/add', () => { }, () => { })
},
methods: {
querySearchAsync() {
if (this.filebookuuid == '') return this.$message.error('请输入完整')
let search = ''
let reg = /^(?:[\u3400-\u4DB5\u4E00-\u9FEA\uFA0E\uFA0F\uFA11\uFA13\uFA14\uFA1F\uFA21\uFA23\uFA24\uFA27-\uFA29]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0])+$/
if (reg.test(this.filebookuuid)) {
search = 'name=' + this.filebookuuid
} else {
let filebookuuid = this.filebookuuid.toLocaleUpperCase()
search = 'uuid=' + filebookuuid
}
this.$http.get('admin/lifeBookSearch?' + search).then(res => {
if (res.data.data.length > 0) {
this.filebook = res.data.data
} else {
this.$message.error('暂无数据')
}
})
},
handleSelect(item) {
this.user = item
this.filebookShow = false
this.info.lifebook_id = this.user.id
},
onSubmit_lun_show() {
this.lun_show = true
},
clear() {
this.info = {
lifebook_id: '',
contact: '',
phonenumber: ''
}
this.user = {}
}, post() {
this.$confirm('是否确认以审批完成开始提交?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.post('admin/trial', this.info).then(res => {
if (res.data.code == 200) {
this.$message.success('添加成功')
} else {
this.$message.error(res.data.msg);
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
min-height: 100%;
background: #fff;
box-sizing: border-box;
padding: 20px;
text-align: left;
.filelist {
width: 100%;
padding: 10px;
box-sizing: border-box;
.file-item {
border-bottom: 1px solid #e6e6e6;
display: flex;
align-items: center;
height: 56px;
width: calc(100% - 180px);
margin-left: 100px;
box-sizing: border-box;
.info {
color: #185ed1;
display: block;
margin-left: 62px;
cursor: pointer;
}
.uuid {
display: clock;
}
.name {
display: block;
width: 80px;
text-align: left;
}
}
}
}
</style>

View File

@ -0,0 +1,345 @@
<template>
<div class="main">
<el-card class="box-card">
<!-- 表格 -->
<el-table :row-style="{ height: '55px' }" id="out-table" :data="list" style="width: 100%;height: 700px;"
height="height" size="mini" :fit="true">
<el-table-column fixed prop="uuid" label="纪录ID" width="200" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed prop="lifebook_id" label="遗嘱人 ID" width="150" align="center" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed prop="create_time" label="添加时间" width="150" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column fixed prop="contact" label="联系人姓名" width="180" align="left" show-overflow-tooltip>
</el-table-column>
<el-table-column prop="phonenumber" label="联系人电话" min-width="280" align="left" show-overflow-tooltip>
</el-table-column>
</el-table>
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
:page-sizes="[10, 12, 20, 30, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
:total="count">
</el-pagination>
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
list: [],
currentPage: 1,
count: 0,
pageSize: 12,
height: 670,
search: '',
isyuan: false,
item: {},
cardShow: false,
editShow: false,
status: 0
}
},
activated() {
this.$http.get(`/admin/getEnchanterList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
methods: {
copy(uuid) {
//
navigator.clipboard.writeText(uuid);
this.$message({
type: 'success',
message: '复制成功'
})
},
//
handleCurrentChange(val) {
this.currentPage = val
this.$http.get(`admin/getJudgementList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count;
} else {
this.$message.error(res.data.msg)
}
})
},
//
handleSizeChange(val) {
this.pageSize = val
this.$http.get(`admin/getJudgementList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
if (res.data.code == 200) {
this.list = res.data.data
} else {
this.$message.error(res.data.msg)
}
})
},
//
getInfo() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/getJudgementList?page=${this.currentPage}&limit=${this.pageSize}`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data;
this.count = res.data.count;
loading.close()
} else {
this.$message.error(res.data.msg)
}
})
},
//
searchBind() {
if (this.search === '') return this.$message.error('请输入搜索内容')
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/getJudgementList?contact=${this.search}`).then(res => {
console.log(res.data);
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.total
this.isyuan = true
this.$message.success('搜索完成')
} else {
this.$message.error(res.data.msg)
}
})
},
//
yuan() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.$http.get(`admin/getJudgementList?page=1&limit=15`).then(res => {
loading.close()
if (res.data.code == 200) {
this.list = res.data.data
this.count = res.data.count
this.isyuan = false
} else {
this.$message.error(res.data.msg)
}
})
},
//
info(id) {
localStorage.setItem('menu', '/lifebook/data')
this.$router.push({
path: '/trial/info',
query: {
uuid: id
}
})
},
},
created() {
this.getInfo();
}
}
</script>
<style lang="less" scoped>
.el-table /deep/ .el-icon-arrow-down:before {
color: #000 !important;
font-size: 20px !important;
position: relative;
top: 5px;
}
.uuid {
cursor: pointer;
}
.uuid:hover {
//线
color: #0d4fbb;
}
.tableHead {
width: 100%;
.addButton {
position: absolute;
right: 126px
}
}
.main {
width: 100%;
height: 100%;
line-height: auto;
.head {
width: 100%;
height: 40px;
display: flex;
align-items: center;
position: relative;
background: #fff;
.el-button /deep/ .el-icon-arrow-down:before {
color: #1a7cff !important;
}
.el-dropdown {
position: absolute;
right: 20px;
}
.dy {
position: absolute;
right: 130px;
}
.tag {
height: 8px;
width: 25px;
border-radius: 4px;
background-color: #1a7cff;
}
.tagTitle {
font-size: 14px;
color: #000;
margin-left: 20px;
}
.daoBack {
position: absolute;
right: 10px
}
}
.el-card {
// height: calc(100% - 60px);
height: 100%;
position: relative;
// margin-top: 10px;
box-shadow: 0px 0px 20px rgba(215, 215, 215, 1);
overflow: auto;
.tableHead {
height: 60px;
display: flex;
align-items: center;
/deep/ .searchInput {
width: 300px !important;
position: absolute;
left: 30px;
}
.searchButton {
position: absolute;
left: 348px;
}
.yuan {
position: absolute;
left: 428px;
}
}
.el-table {
height: 100%;
}
.el-pagination {
margin-top: 10px;
display: flex;
justify-content: flex-end;
margin-right: 15px;
}
}
.card {
width: 450px;
padding: 20px;
background: #fff;
text-align: left;
position: relative;
min-height: 257px;
overflow: hidden;
border-radius: 5px;
overflow: hidden;
box-sizing: border-box;
background-image: url('../../../images/450.jpg');
background-repeat: no-repeat;
background-position: center;
.card-status {
position: absolute;
top: 20px;
right: 20px;
font-family: '华文隶书 Bold', '华文隶书';
}
.card-head {
width: 100%;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
.el-image {
border-radius: 3px;
}
.card-info {
margin-left: 10px;
.card-name {
color: #185ed1;
font-weight: bold;
font-size: 18px;
}
.card-uuid {
display: block;
margin-top: 5px;
color: #aaa;
}
}
}
.card-dosc {
display: block;
line-height: 24px;
font-size: 14px;
margin-top: 16px;
// margin-left: 65px;
color: #979797;
}
}
}
</style>

View File

@ -0,0 +1,305 @@
<template>
<div class="main">
<div class="tools">
<span class="title">{{ info.title }}</span>
<el-button type="primary" @click="$router.go(-1)" style="right: 200px;" plain>返回上一页</el-button>
<el-button type="primary" style="right:100px" plain @click="editShowBind">编辑</el-button>
<!-- 删除 -->
<el-button type="danger" style="right:0px;" plain @click="del()">删除</el-button>
</div>
<div class="body-top">
<div class="frialinfo">
<span class="item" style="color: #185ed1;"><span class="tabel">审判记录ID</span>{{ info.uuid }}</span>
<span class="item"><span class="tabel">审判时间</span>{{ info.create_time }}</span>
<span class="item"><span class="tabel">审判长</span>{{ info.judge_name }}</span>
<span class="item"><span class="tabel">勾魂使者</span>{{ info.reaper_name }}</span>
</div>
<div class="body-bottom">
<img :src="apiUrl + info.photo" alt="">
<div class="body-bottom-2">
<span class="item"><span class="tabel">被审判人</span>{{ info.name }}</span>
<span class="item"><span class="tabel">被审判人性别</span>{{ info.gender == '0' ? '男' : '女' }}</span> <br />
<span class="item"><span class="tabel">被审判人身份号</span>{{ info.user_uuid }}</span>
<span class="item"><span class="tabel">被审判人生辰八字</span>{{ info.year }}</span><br />
<span class="item"><span class="tabel">被审判人离世时间</span>{{ info.deathday }}</span>
<span class="item"><span class="tabel">被审判人出生时间</span>{{ info.birthday }}</span><br />
<span class="item"><span class="tabel">被审判人出生地址</span>{{ info.birthplace }}</span>
<span class="item"><span class="tabel">被审判人离世地址</span>{{ info.deathplace }}</span><br />
<span class="item"><span class="tabel">被审判人死后情况</span>{{ info.afterlife }}</span>
<span class="item"><span class="tabel">被审判人死亡方式</span>{{ info.type == 0 ? '自然死亡' : '意外死亡' }}</span>
</div>
</div>
</div>
<div class="content">
<span class="label">审判记录</span>
<span class="content-info" v-html="info.record"></span>
</div>
<el-dialog title="编辑审判记录" :visible.sync="editShow" width="70%" :before-close="handleClose">
<el-form label-width="80px">
<el-form-item label="审判标题" style="width:800px">
<el-input placeholder="请输入审判标题" v-model="editinfo.title" :show-word-limit="true"
maxlength="200"></el-input>
</el-form-item>
<el-form-item>
<quill-editor ref="myGQuillEditor" v-model="editinfo.record" :options="editorOption" class="editor"
style="height:300px;">
</quill-editor>
</el-form-item>
<el-form-item style="margin-top: 105px;">
<el-button type="primary" @click="clear" plain> </el-button>
<el-button type="primary" style="margin-left: 20px;" @click="post">提交修改</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ header: 1 }, { header: 2 }],
[{ list: 'ordered' }, { list: 'bullet' }],
[{ script: 'sub' }, { script: 'super' }],
[{ indent: '-1' }, { indent: '+1' }],
[{ direction: 'rtl' }],
[{ size: ['small', false, 'large', 'huge'] }],
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }],
[{ font: [] }],
[{ align: [] }],
['clean'],
]
export default {
data() {
return {
id: this.$route.query.uuid,
info: {},
editShow: false,
editorOption: {
modules: {
toolbar: toolbarOptions
},
theme: 'snow',
placeholder: '请输入审判内容'
},
editinfo: {
title: '',
record: ''
}
}
},
mounted() {
this.getInfo()
},
methods: {
getInfo() {
this.$http.get('admin/getJudgementDetail?uuid=' + this.id).then(res => {
this.info = res.data.data
this.editinfo.title = this.info.title
this.editinfo.record = this.info.record
})
},
del() {
this.$confirm('此操作将永久删除该审判记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: '正在删除中',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$http.delete('admin/deleteJudgement?uuid=' + this.id).then(res => {
loading.close();
if (res.data.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.$router.go(-1)
} else {
this.$message({
type: 'error',
message: res.data.msg
});
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
clear() {
this.editinfo = {
title: '',
record: ''
}
},
editShowBind() {
this.editShow = true
this.editinfo.title = this.info.title
this.editinfo.record = this.info.record
},
post() {
if (this.editinfo.title === '' || this.editinfo.record === '') {
this.$message({
type: 'error',
message: '请填写完整信息'
});
return
}
let data = {
id: this.info.id,
title: this.editinfo.title,
record: this.editinfo.record
}
this.$http.put('admin/updateJudgement', data).then(res => {
if (res.data.code == 200) {
this.$message({
type: 'success',
message: '修改成功!'
});
this.editShow = false
this.info.title = this.editinfo.title
this.info.record = this.editinfo.record
} else {
this.$message({
type: 'error',
message: res.data.msg
});
}
})
}
}
}
</script>
<style lang="less" scoped>
.main {
width: 100%;
height: 100%;
background: #fff;
text-align: left;
padding: 20px;
box-sizing: border-box;
.tools {
width: 100%;
position: relative;
.title {
font-size: 20px;
}
.el-button {
position: absolute;
right: 0;
top: 0;
}
}
.content {
margin-top: 12px;
height: calc(100% - 252px);
min-height: 220px;
span {
display: block;
}
.label {
display: block;
width: 100%;
color: #333;
font-size: 16px;
line-height: 26px;
}
.content-info {
margin-top: 5px;
border: 1px solid #c5c5c5;
padding: 15px;
box-sizing: border-box;
line-height: 26px;
height: calc(100% - 90px);
border-radius: 3px;
overflow: auto;
}
}
.frialinfo {
width: 100%;
border-bottom: 1px solid #ebebeb;
height: 65px;
display: flex;
align-items: center;
justify-content: flex-start;
.item {
display: block;
margin-right: 35px;
font-size: 16px;
color: #000;
}
.tabel {
color: #838383;
}
}
.body-bottom {
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
width: 100%;
margin-top: 10px;
box-sizing: border-box;
border-bottom: 1px solid #ebebeb;
padding-bottom: 10px;
background: #edf1f5;
.body-bottom-2 {
width: calc(100% - 145px);
}
img {
width: 115px;
height: 135px;
display: block;
margin: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.item {
display: inline-block;
margin-right: 35px;
font-size: 16px;
color: #333;
max-width: calc(50% - 40px);
min-width: 30%;
line-height: 26px;
}
.tabel {
color: #409EFF;
display: inline-block;
width: 145px;
font-size: 15px;
}
}
}
</style>

View File

@ -0,0 +1,47 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import less from 'less'
import axios from 'axios'
import '../element.js'
Vue.use(less)
Vue.prototype.andfunctionUrl = 'http://localhost:8080' //敲木鱼加功德等功能地址
Vue.prototype.apiUrl = 'http://localhost:3000'
axios.defaults.baseURL = 'http://localhost:3000/';
//请求拦截器
axios.interceptors.request.use(function (config) {
config.headers.Authorization = localStorage.getItem('adminToken');
return config
}, function (err) {
Vue.prototype.$router.push('/login');
})
//响应拦截器
axios.interceptors.response.use(function (res) {
return res
}, function (err) {
Vue.prototype.$message.error("访问被拒绝");
console.log(err);
})
Vue.prototype.$http = axios;
Vue.config.productionTip = false
// 引入富文本组件
import QuillEditor from 'vue-quill-editor'
// 引入富文本组件样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(QuillEditor)
new Vue({
router,
render: h => h(App)
}).$mount('#app')

View File

@ -0,0 +1,66 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/login.vue'
import home from '../components/home.vue'
Vue.use(VueRouter)
const routes = [
{ path: '/', redirect: '/login' },
{ path: '/login', component: Login, meta: { title: '登录-后事管理系统' } },
{
path: '/home', component: home, meta: { title: '后事管理系统' }, redirect: '/index', children: [
{
path: '/index', component: () => import('../components/homeIndex.vue'), meta: { title: '后事管理系统' }, children: [
]
},
{ path: '/testament/data', component: () => import('../components/testament/testamentData.vue'), meta: { title: '遗嘱管理-后事管理系统' } },
{ path: '/testament/dataAdd', component: () => import('../components/testament/testamentAdd.vue'), meta: { title: '遗嘱添加-后事管理系统' } },
{ path: '/testament/info', component: () => import('../components/testament/info.vue'), meta: { title: '遗嘱详情-后事管理系统' } },
{ path: '/testament/edit', component: () => import('../components/testament/edit.vue'), meta: { title: '遗嘱编辑-后事管理系统' } },
{ path: '/lawyer/lawyer', component: () => import('../components/lawyer/lawyer.vue'), meta: { title: '律师-后事管理系统' } },
{ path: '/lawyer/addlawyer', component: () => import('../components/lawyer/add.vue'), meta: { title: '新增律师-后事管理系统' } },
{ path: '/trial/data', component: () => import('../components/trial/data.vue'), meta: { title: '联系人记录-后事管理系统' } },
{ path: '/trial/info', component: () => import('../components/trial/info.vue'), meta: { title: '联系人详情-后事管理系统' } },
{ path: '/trial/add', component: () => import('../components/trial/add.vue'), meta: { title: '添加联系人-后事管理系统' } },
{ path: '/system/system', component: () => import('../components/system/system.vue'), meta: { title: '系统设置-后事管理系统' } },
{ path: '/system/setInfo', component: () => import('../components/system/setInfo.vue'), meta: { title: '信息修改-后事管理系统' } },
{ path: '/admin/admin', component: () => import('../components/admin/admin.vue'), meta: { title: '管理员管理-后事管理系统' } },
{ path: '/admin/add', component: () => import('../components/admin/add.vue'), meta: { title: '添加管理员-后事管理系统' } },
{ path: '/role/role', component: () => import('../components/role/role.vue'), meta: { title: '角色管理-后事管理系统' } },
{ path: '/role/authority', component: () => import('../components/role/authority.vue'), meta: { title: '权限设置-后事管理系统' } },
]
},
{ path: '/404', component: () => import('../components/404.vue'), meta: { title: '404-页面走丢了-后事管理系统' } },
{ path: '*', redirect: '/404' },
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
//挂载路由导航守卫
router.beforeEach((to, from, next) => {
if (to.meta.title) {//判断是否有标题
document.title = to.meta.title
}
// if (to.path == '/home' && from.path == '/login') return next();
if (to.path === '/login') {
const token = localStorage.getItem('adminToken');
const time = Number(localStorage.getItem('tokenStartTime'))
if (token && time + (7 * 24 * 60 * 60) - (60 * 60) > Math.round(new Date().getTime() / 1000)) return next('/home')
return next()
}
if (to.path === '/index') {
const token = localStorage.getItem('adminToken');
const time = Number(localStorage.getItem('tokenStartTime'));
if (token && time + (7 * 24 * 60 * 60) - (60 * 60) > Math.round(new Date().getTime() / 1000)) return next()
return next('/login')
}
next()
})
export default router

View File

@ -0,0 +1,9 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
productionSourceMap: true,
devServer: {
historyApiFallback: true,
allowedHosts: 'all'
}
})

BIN
后事管理系统/api/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,332 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const fs = require('fs');
const path = require('path');
const multer = require('multer');
// 封装固定格式的返回体
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
//生死簿新增
router.post('/lifeBookAdd', (req, res) => {
let { name, birthday, gender, birthplace,
child, marriage,
event, attribute, description, characterinfo, testament } = req.body;
// 初始化默认数据
console.log(req.body)
characterinfo = isEmptyStr(characterinfo) ? characterinfo : '暂无';
description = isEmptyStr(description) ? description : '暂无';
attribute = isEmptyStr(attribute) ? attribute : '暂无';
event = isEmptyStr(event) ? event : '暂无';
marriage = isEmptyStr(marriage) ? marriage : '暂无';
child = isEmptyStr(child) ? child : 0;
testament = isEmptyStr(testament) ? testament : '暂无';
//参数是否合法
if (!isEmptyStr(name) || !isEmptyStr(birthday) || !isEmptyStr(gender) || !isEmptyStr(birthplace)) return tw(res, 400, '请输入完整')
// 校验birthday和deathday是否是可格式化的时间
if (Date.parse(birthday) == NaN) return tw(res, 400, '出生日期或死亡日期格式不正确')
let uuid = getUuid(16, 16) // 生成uuid
const query = `INSERT INTO lifebook (name, uuid, birthday, gender, birthplace, child, marriage, event, attribute, description, characterinfo,
testament, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())`;
const values = [name, uuid, birthday, gender, birthplace, child, marriage, event, attribute, description, characterinfo,
testament];
// 指定长度和基数
function getUuid(len, radix) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
let uuid = []
let i
radix = radix || chars.length
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
} else {
let r
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
uuid[14] = '4'
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]
}
}
}
return uuid.join('')
}
db.query(query, values, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '新增失败')
} else {
tw(res, 200, '新增成功')
}
})
})
// 获取生死簿数据
router.get('/lifeBookList', (req, res) => {
let { page, limit, uuid } = req.query;
page = page || 1;
limit = limit || 10;
let start = (page - 1) * limit;
let query
if (isEmptyStr(uuid)) {
query = `SELECT * FROM lifebook where uuid = '${uuid}'`;
} else {
query = `SELECT * FROM lifebook ORDER BY create_time DESC LIMIT ${start},${limit}`;
}
db.query(query, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '获取失败')
} else {
if (!isEmptyStr(uuid)) {
// 获取数据总数
db.query(`SELECT COUNT(*) FROM lifebook`, (err, count) => {
if (err) {
console.log(err)
tw(res, 500, '获取失败')
} else {
res.send({
'code': 200,
'msg': '获取成功',
'total': count[0]['COUNT(*)'],
'data': result,
})
}
})
} else {
res.send({
'code': 200,
'msg': '获取成功',
'data': result[0]
})
}
}
})
})
// 生死簿数据搜索
router.get('/lifeBookSearch', (req, res) => {
// 支持对iduuidname精确到天的出生日期和死亡日期以及生辰八字的搜索
let { page, limit, id, uuid, name, birthday, deathday, year } = req.query;
if (!isEmptyStr(id) && !isEmptyStr(uuid) && !isEmptyStr(name) && !isEmptyStr(birthday) && !isEmptyStr(deathday) && !isEmptyStr(year)) return tw(res, 400, '请提交搜索参数')
page = page || 1;
limit = limit || 10;
let start = (page - 1) * limit;
let pages = `LIMIT ${start},${limit}`;
let sql = `SELECT * FROM lifebook WHERE 1=1`;
let countSql = `SELECT COUNT(*) FROM lifebook WHERE 1=1`;
if (isEmptyStr(id)) {
sql += ` AND id = ${id}`;
countSql += ` AND id = ${id}`;
}
if (isEmptyStr(uuid)) {
sql += ` AND uuid = '${uuid}'`;
countSql += ` AND uuid = '${uuid}'`;
}
if (isEmptyStr(name)) {
sql += ` AND name like '%${name}%'`;
countSql += ` AND name like '%${name}%'`;
}
if (isEmptyStr(birthday)) {
sql += ` AND DATE(birthday) = '${birthday}'`;
countSql += ` AND DATE(birthday) = '${birthday}'`;
}
sql += ` ORDER BY create_time DESC ${pages}`;
db.query(sql, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '获取失败')
} else {
// 获取数据总数
db.query(countSql, (err, count) => {
if (err) {
console.log(err)
tw(res, 500, '获取失败')
} else {
res.send({
'code': 200,
'msg': '获取成功',
'total': count[0]['COUNT(*)'],
'data': result,
})
}
})
}
})
})
// 修改生死簿数据
router.put('/lifeBookUpdate', (req, res) => {
let { id, name, year, status, birthday, deathday, gender, birthplace,
deathplace, money, yinmoney, child, longevity, type, reason, marriage,
event, attribute, description, character, yin, yang, testament } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请提交id')
// 遍历对象,如果值为空,判断为删除该项
delete req.body.id
for (let key in req.body) {
if (!isEmptyStr(req.body[key])) {
delete req.body[key]
}
}
function isEmptyObj(obj) {
for (let key in obj) {
return false
}
return true
}
if (isEmptyObj(req.body)) return tw(res, 400, '提交修改项')
// 修改数据
let query = `UPDATE lifebook SET `;
for (let key in req.body) {
query += `${key} = '${req.body[key]}',`
}
query = query.slice(0, -1);
query += ` WHERE id = ${id}`;
db.query(query, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '修改失败')
} else {
res.send({
'code': 200,
'msg': '修改成功',
})
}
})
})
// 上传文件中间件
const uploadFun = (req, res, next) => {
let storage = multer.diskStorage({
//指定保存位置
destination: (req, file, cb) => {
cb(null, path.join(__dirname, '../public/photo'))
},
//指定保存文件名
filename: (req, file, cb) => {
//处理保存文件名
let extname = path.extname(file.originalname);
filename = file.fieldname + "-" + Date.now() + extname;
cb(null, filename);
}
})
let limits = {
//设置上传数量,大小
files: 1,
fileSize: 1024 * 1024 * 3 // 3MB
}
const upload = multer({
storage: storage,
//限制文件大小
limits: limits,
fileFilter: function (req, file, cb) {
// 限制文件上传类型仅可上传png格式图片
if (file.mimetype == 'image/png' || file.mimetype == 'image/jpeg') {
cb(null, true)
} else {
cb(null, false)
let err = new Error();
err.code = 'LIMIT_FILE_TYPES';
cb(err)
}
}
}).single('photo');
upload(req, res, (err) => {
if (err) {
if (err.code == 'LIMIT_FILE_SIZE') {
res.send({
code: '500',
msg: '上传失败,文件过大',
})
} else if (err.code == 'LIMIT_FILE_TYPES') {
res.send({
code: '500',
msg: '文件类型不合法',
})
} else if (err.code == 'ENOENT') {
res.send({
code: '500',
msg: '权限不足',
})
} else {
res.send({
code: '500',
msg: '其他错误',
Error: err
})
}
} else {
//将文件名单独拿出来
req.filename = req.file.filename
next()
}
})
}
// 修改照片
router.post('/lifeBookUpdateImg', uploadFun, (req, res) => {
let { id } = req.body;
let img = '/public/photo/' + req.filename
if (!isEmptyStr(id)) return tw(res, 400, '请提交id')
// 修改数据
let query = `UPDATE lifebook SET photo = '${img}' WHERE id = ${id}`;
db.query(query, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '修改失败')
} else {
res.send({
'code': 200,
'msg': '修改成功',
data: '/public/photo/' + req.filename,
})
}
})
})
// 删除生死簿数据,支持多选
router.delete('/lifeBookDelete', (req, res) => {
let { id } = req.query;
if (!isEmptyStr(id)) return tw(res, 400, '请提交id')
// 删除数据
let query = `DELETE FROM lifebook WHERE id IN (${id})`;
db.query(query, (err, result) => {
if (err) {
console.log(err)
tw(res, 500, '删除失败')
} else {
res.send({
'code': 200,
'msg': '删除成功',
})
}
})
})
module.exports = router;

View File

@ -0,0 +1,320 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const path = require('path');
const multer = require('multer');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
//获取需要勾魂的数据
router.get('/getEnchantData', (req, res) => {
let { page, limit, name } = req.query;
page = page || 1;
limit = limit || 10;
let and = ''
if (isEmptyStr(name)) and = `and name like '%${name}%'`
// 获取deathday在今天到今天加30天之内的数据
let sql = `select * from lifebook where deathday between curdate() and date_add(curdate(),interval 30 day) and isnull(reaperid) ${and} limit ${(page - 1) * limit},${limit}`;
let sql2 = `select count(*) as count from lifebook where deathday between curdate() and date_add(curdate(),interval 30 day) and isnull(reaperid) ${and}`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '获取数据失败');
return;
}
db.query(sql2, (err, data2) => {
if (err) {
console.log(err);
tw(res, 400, '获取数据失败');
return;
}
res.send({
'code': 200,
'msg': '获取数据成功',
'count': data2[0].count,
'data': data,
})
})
})
})
// uuid生成函数
function getUuid(len, radix) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
let uuid = []
let i
radix = radix || chars.length
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
} else {
let r
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
uuid[14] = '4'
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]
}
}
}
return uuid.join('')
}
const uploadFun = (req, res, next) => {
let storage = multer.diskStorage({
//指定保存位置
destination: (req, file, cb) => {
cb(null, path.join(__dirname, '../public/enchant'))
},
//指定保存文件名
filename: (req, file, cb) => {
//处理保存文件名
let extname = path.extname(file.originalname);
filename = file.fieldname + "-" + Date.now() + extname;
cb(null, filename);
}
})
let limits = {
//设置上传数量,大小
files: 1,
fileSize: 1024 * 1024 * 3 // 3MB
}
const upload = multer({
storage: storage,
//限制文件大小
limits: limits,
fileFilter: function (req, file, cb) {
// 限制文件上传类型仅可上传png格式图片
if (file.mimetype == 'image/png' || file.mimetype == 'image/jpeg') {
cb(null, true)
} else {
cb(null, false)
let err = new Error();
err.code = 'LIMIT_FILE_TYPES';
cb(err)
}
}
}).single('enchant');
upload(req, res, (err) => {
if (err) {
console.log(err);
if (err.code == 'LIMIT_FILE_SIZE') {
res.send({
code: '500',
msg: '上传失败,文件过大',
})
} else if (err.code == 'LIMIT_FILE_TYPES') {
res.send({
code: '500',
msg: '文件类型不合法',
})
} else if (err.code == 'ENOENT') {
res.send({
code: '500',
msg: '权限不足',
})
} else {
res.send({
code: '500',
msg: '其他错误',
Error: err
})
}
} else {
//将文件名单独拿出来
req.filename = req.file.filename
next()
}
})
}
// 添加勾魂使者
router.post('/addEnchanter', uploadFun, (req, res) => {
let photo = '/public/enchant/' + req.filename;
let uuid = getUuid(16, 16)
let { name, gender, description } = req.body;
if (!isEmptyStr(name)) return tw(res, 400, '姓名不能为空');
let status = 0;
description = description || '暂无介绍';
gender = gender || 0;
let role = 2
let sql = `insert into lawyer (name,uuid,gender,photo,description,create_time,role,status) values ('${name}','${uuid}',${gender},'${photo}',
'${description}',now(),2,${status})`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '添加失败');
return;
}
tw(res, 200, '添加成功');
})
})
//律师列表
router.get('/getEnchanterList', (req, res) => {
let { page, limit, id, name } = req.query;
page = page || 1;
limit = limit || 10;
let sql = `select * from lawyer where 1=1`;
let sql2 = `select count(*) as count from lawyer where 1=1`;
if (isEmptyStr(id)) {
sql += ` and id=${id}`;
sql2 += ` and id=${id}`;
} else {
if (isEmptyStr(name)) {
sql += ` and name like '%${name}%'`;
sql2 += ` and name like '%${name}%'`;
}
}
sql += ` limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '获取数据失败');
return;
}
db.query(sql2, (err, data2) => {
if (err) {
console.log(err);
tw(res, 400, '获取数据失败');
return;
}
res.send({
'code': 200,
'msg': '获取数据成功',
'count': data2[0].count,
'data': data,
})
})
})
})
// 勾魂使者信息修改
router.put('/updateEnchanter', (req, res) => {
let { set, name, gender, description, status, id } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, 'id不能为空');
if (set == '1') {
if (!isEmptyStr(status)) return tw(res, 400, '状态不能为空');
//判断status是否为0或1或2
if (status != 0 && status != 1 && status != 2) return tw(res, 400, '状态不合法');
let sql = `update lawyer set status=${status} where id=${req.body.id}`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '修改失败');
return;
}
tw(res, 200, '修改成功');
})
} else {
if (!isEmptyStr(name) && !isEmptyStr(gender) && !isEmptyStr(description)) return tw(res, 400, '参数不能为空');
let sql = `select * from lawyer where id=${id}`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '信息异常');
return;
}
name = isEmptyStr(name) ? name : data[0].name;
gender = isEmptyStr(gender) ? gender : data[0].gender
description = isEmptyStr(description) ? description : data[0].description
// 判断gender是否为0或1
if (gender != '0' && gender != '1') return tw(res, 400, '性别不合法');
//修改数据库中的数据
let sql = `update lawyer set name='${name}',gender=${gender},description='${description}' where id=${req.body.id}`
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '修改失败');
return;
}
tw(res, 200, '修改成功');
})
})
}
})
//勾魂使者删除
router.delete('/deleteEnchanter', (req, res) => {
let uuid = req.query.uuid;
if (!isEmptyStr(uuid)) return tw(res, 400, 'uuid不能为空');
let querySql = `select * from lawyer where uuid='${uuid}'`;
db.query(querySql, (err, data) => {
if (err) return tw(res, 400, '读取失败');
if (data[0].role == 4) {
//此勾魂使者是管理员的情况修改管理员为4的普通管理员
let sql = `update user set role=4 where username = '${uuid}'`;
db.query(sql, (err, data) => {
if (err) return tw(res, 400, '初始化失败');
})
}
})
let sql = `delete from lawyer where uuid='${uuid}'`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '删除失败');
return;
}
tw(res, 200, '删除成功');
})
})
//勾魂处理
router.put('/handleEnchanter', (req, res) => {
let { id, set } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, 'id不能为空');
let repid = req.auth.id
//检查是否有该勾魂使者
// let sql = `select * from lawyer where id=${req.username}`;
// db.query(sql, (err, data) => {
// if (err) {
// console.log(err);
// tw(res, 400, '无权操作');
// return;
// }
//将lifebook表中的status改为2
let time = formatDate(new Date());
let sql;
sql = `update lifebook set status=2,reaperid=${repid} where id=${id}`;
if (set == '1') sql = `update lifebook set status=2,deathday='${time}',reaperid=${repid} where id=${id}`;
db.query(sql, (err, data) => {
if (err) {
console.log(err);
tw(res, 400, '操作失败');
return;
}
tw(res, 200, '操作成功');
})
// })
//格式化时间将时间戳转换为yyyy-mm-dd hh:mm:ss格式
function formatDate(time) {
let date = new Date(time);
let year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate(),
hour = date.getHours(),
minute = date.getMinutes(),
second = date.getSeconds();
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
}
})
module.exports = router;

View File

@ -0,0 +1,218 @@
//十八层地狱相关接口
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const getUuid = require('../tools/uuid.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//添加设备
router.post('/helladd', (req, res) => {
let { name, floor } = req.body;
if (!isEmptyStr(name) || !isEmptyStr(floor)) return tw(res, 400, '请填写完整');
//校验floor是数字并且是否为1-18
if (isNaN(floor) || floor < 1 || floor > 18) return tw(res, 400, '位置必须为1-18的数字');
//校验name长度是否大于20
if (name.length > 20) return tw(res, 400, '名称长度不能超过20');
let sql = `insert into helldevice (name,floor,create_time,status) values ('${name}','${floor}',now(),0)`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '添加成功');
})
})
//获取设备列表
router.get('/helllist', (req, res) => {
let { page, limit, floor } = req.query;
page = page || 1;
limit = limit || 10;
let sql = `select * from helldevice where 1=1`;
if (isEmptyStr(floor)) sql += ` and floor=${floor}`;
sql += ` order by create_time desc limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
let sql2 = `select count(*) as count from helldevice where 1=1`;
if (floor) sql2 += ` and floor=${floor}`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'count': result2[0].count,
'data': result,
})
})
})
})
// 修改设备
router.put('/hellupdate', (req, res) => {
let { id, name, floor } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要修改的设备');
if (!isEmptyStr(name) && !isEmptyStr(floor)) return tw(res, 400, '请填写修改内容');
let sql = `update helldevice set `;
let arr = []
if (isEmptyStr(name)) {
if (name.length > 20) return tw(res, 400, '名称长度不能超过20');
arr.push(`name='${name}'`);
}
if (isEmptyStr(floor)) {
if (isNaN(floor) || floor < 1 || floor > 18) return tw(res, 400, '位置必须为1-18的数字');
arr.push(`floor='${floor}'`);
}
sql += arr.join(',') + ` where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '修改成功');
})
})
//修改设备状态
router.put('/hellstatus', (req, res) => {
let { id, status } = req.body;
if (!isEmptyStr(id) || !isEmptyStr(status)) return tw(res, 400, '请选择要修改的设备');
if (status != 0 && status != 1) return tw(res, 400, '状态错误');
let sql = `update helldevice set status=${status} where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '修改成功');
})
})
//删除设备
router.delete('/helldel', (req, res) => {
let { id } = req.query;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要删除的设备');
let sql = `delete from helldevice where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '删除成功');
})
})
//添加设备使用记录
router.post('/hellrecordadd', (req, res) => {
let { uid, floor, device, time, reason } = req.body;
if (!isEmptyStr(uid) || !isEmptyStr(floor) || !isEmptyStr(device) || !isEmptyStr(time) || !isEmptyStr(reason)) return tw(res, 400, '请填写完整');
//校验floor是数字并且是否为1-18
if (isNaN(floor) || floor < 1 || floor > 18) return tw(res, 400, '位置必须为1-18的数字');
//查询设备名称
let sql1 = `select name from helldevice where id=${device}`;
db.query(sql1, (err, result) => {
if (err) return sqlerr(res, err);
let sql = `update lifebook set status=4,afterlife='判处${floor}地狱受刑${time}',punishment='在${floor}层地狱受${result[0].name}处刑,共${time}' where id=${uid}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
// 添加使用记录
let sql2 = `insert into helllog (uid,floor,device,time,reason,create_time) values (${uid},${floor},'${device}','${time}','${reason}',now())`;
db.query(sql2, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '添加成功');
})
})
})
})
// 获取设备使用记录
router.get('/hellrecordlist', (req, res) => {
let { page, limit, floor, device, id } = req.query;
page = page || 1;
limit = limit || 10;
if (isEmptyStr(id)) {
let sql = `select h.id as id,h.uid as uid,h.floor as floor,h.device as device,h.time as time,h.reason as reason,h.create_time as create_time,l.name as name,l.uuid as user_uuid from helllog as h,lifebook as l where h.id = ${id} and l.id = h.uid`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'data': result[0],
})
})
} else {
let sql = `select h.id as id,h.uid as uid,h.floor as floor,h.device as device,h.time as time,h.reason as reason,h.create_time as create_time,l.name as name,l.uuid as user_uuid from helllog as h,lifebook as l where l.id = h.uid `
if (isEmptyStr(floor)) sql += ` and h.floor=${floor}`;
if (isEmptyStr(device)) sql += ` and h.device=${device}`;
sql += ` order by create_time desc limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, result) => {
if (err) sqlerr(res, err);
let sql2 = `select count(*) as count from helllog where 1=1`;
if (isEmptyStr(floor)) sql2 += ` and floor=${floor}`;
if (isEmptyStr(device)) sql2 += ` and device=${device}`;
db.query(sql2, (err, result2) => {
if (err) sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'count': result2[0].count,
'data': result,
})
})
})
}
})
//删除使用记录
router.delete('/hellrecorddel', (req, res) => {
let { id } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要删除的记录');
let sql = `delete from helllog where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '删除成功');
})
})
//修改使用记录
router.put('/hellrecordedit', (req, res) => {
let { id, floor, device, time, reason } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '选择修改的记录');
if (isEmptyStr(floor) && isEmptyStr(device) && isEmptyStr(time) && isEmptyStr(reason)) return tw(res, 400, '请选择要修改的内容');
let sql = `update helllog set `;
let arr = [];
if (isEmptyStr(floor)) arr.push(`floor=${floor}`);
if (isEmptyStr(device)) arr.push(`device=${device}`);
if (isEmptyStr(time)) arr.push(`time='${time}'`);
if (isEmptyStr(reason)) arr.push(`reason='${reason}'`);
sql += arr.join(',') + ` where id=${id}`;
//修改生死簿内受刑内容
let sql1 = `select uid,floor,time,device from helllog where id=${id}`;
db.query(sql1, (err, result) => {
if (err) return sqlerr(res, err);
let sql2 = `select name from helldevice where id=${result[0].device}`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
floor = !isEmptyStr(floor) ? result[0].floor : floor;
time = !isEmptyStr(time) ? result[0].time : time;
let sql3 = `update lifebook set punishment='在${floor}层地狱受${result2[0].name}处刑,共${time}' where id=${result[0].uid}`;
db.query(sql3, (err, result3) => {
if (err) return sqlerr(res, err);
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '修改成功');
})
})
})
})
})
module.exports = router;

View File

@ -0,0 +1,104 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//添加轮回盘使用记录
router.post('/reincarnationadd', (req, res) => {
//添加记录修改lifebook的status修改reincarnationidreincarnation
let { uid, type, reason } = req.body;
if (!isEmptyStr(uid) || !isEmptyStr(type) || !isEmptyStr(reason)) return tw(res, 400, '请填写完整');
let aid = req.auth.id
//添加数据
let sql = `insert into reincarnationlog (aid,uid,type,reason,create_time) values ('${aid}','${uid}','${type}','${reason}',now())`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
//修改lifebook的status=3,reincarnationidreincarnation=进入type轮回,其中reincarnationid是上面添加的id
console.log(result.insertId);
let sql2 = `update lifebook set status=3,reincarnationid=${result.insertId},reincarnation='进入${type}轮回',afterlife='进入${type}轮回' where id=${uid}`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
tw(res, 200, '添加成功');
})
})
})
//获取轮回盘使用记录
router.get('/reincarnationlist', (req, res) => {
let { page, limit, aid, uid, type } = req.query;
page = page || 1;
limit = limit || 10;
// 输出包括reincarnationlog中数据还有根据aid和uid查询出来的user中的nickname和lifebook中的name
let sql = `select reincarnationlog.*,user.nickname as aname,lifebook.name as uname,lifebook.uuid as user_uuid from reincarnationlog,user,lifebook where reincarnationlog.aid=user.id and reincarnationlog.uid=lifebook.id`;
if (isEmptyStr(aid)) sql += ` and reincarnationlog.aid=${aid}`;
if (isEmptyStr(uid)) sql += ` and reincarnationlog.uid=${uid}`;
if (isEmptyStr(type)) sql += ` and reincarnationlog.type='${type}'`;
sql += ` order by reincarnationlog.create_time desc limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
let sql2 = `select count(*) as count from reincarnationlog,user,lifebook where reincarnationlog.aid=user.id and reincarnationlog.uid=lifebook.id`;
if (aid) sql2 += ` and reincarnationlog.aid=${aid}`;
if (uid) sql2 += ` and reincarnationlog.uid=${uid}`;
if (type) sql2 += ` and reincarnationlog.type='${type}'`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'count': result2[0].count,
'data': result,
})
})
})
})
// 修改轮回盘使用记录
router.put('/reincarnationedit', (req, res) => {
let { id, type, reason } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择需要修改的记录');
if (!isEmptyStr(type) && !isEmptyStr(reason)) return tw(res, 400, '请填写完整');
let sql = `update reincarnationlog set `;
let arr = []
if (isEmptyStr(type)) arr.push(`type='${type}'`);
if (isEmptyStr(reason)) arr.push(`reason='${reason}'`);
sql += arr.join(',');
sql += `where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '修改成功');
})
})
// 删除轮回盘使用记录
router.delete('/reincarnationdel', (req, res) => {
let { id } = req.query;
if (!isEmptyStr(id)) return tw(res, 400, '请选择需要删除的记录');
let sql = `delete from reincarnationlog where id=${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
tw(res, 200, '删除成功');
})
})
module.exports = router;

View File

@ -0,0 +1,72 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//获取汇款列表
router.get('/remittance', (req, res) => {
let { page, limit, relationship, uid, name } = req.query;
page = page ? page : 1;
limit = limit ? limit : 10;
//返回汇款记录以及lifebook中的name和yinmoney
let sql = `select remittance.*,lifebook.name,lifebook.yinmoney from remittance left join lifebook on remittance.uid=lifebook.uuid where 1=1`;
if (relationship) sql += ` and remittance.relationship='${relationship}'`;
if (uid) sql += ` and remittance.uid='${uid}'`;
if (name) sql += ` and lifebook.name like '%${name}%'`;
sql += ` order by remittance.create_time desc limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
let sql2 = `select count(*) as count from remittance where 1=1`;
if (relationship) sql2 += ` and relationship='${relationship}'`;
if (uid) sql2 += ` and uid='${uid}'`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'count': result2[0].count,
'data': result,
})
})
})
})
//删除汇款记录
router.delete('/remittance', (req, res) => {
let id = req.query.id;
if (!isEmptyStr(id)) return tw(res, 400, '参数错误')
//删除记录并且将lifebook中的yinmoney减去相应的值
let sql = `update lifebook set yinmoney=yinmoney-(select money from remittance where id='${id}') where uuid=(select uid from remittance where id='${id}')`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
let sql2 = `delete from remittance where id='${id}'`;
db.query(sql2, (err, result2) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '删除成功'
})
})
})
})
module.exports = router;

View File

@ -0,0 +1,231 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//格式化目录树
function formatDirectoryData(data) {
const parentDirectories = data.filter((d) => d.isparent === 1);
parentDirectories.forEach((parent) => {
const children = data.filter((d) => d.parentid === parent.id);
parent.children = children;
});
return parentDirectories;
}
//手动获取权限列表
router.get('/role/module', (req, res) => {
if (req.auth.id != 1) return tw(res, 400, '您没有权限')
if (!req.query.role) return tw(res, 400, '请选择角色')
let id = req.query.role
let querySql = `select module,name from role where id = ${id}`
db.query(querySql, (err, result) => {
if (err) return sqlerr(res, err)
let module = result[0].module
if (module == 'all') {
let sql = `select * from module`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
let sql = `select id from module`
let arr = []
result.forEach((item) => {
arr.push(item.id)
})
res.send({
'code': 200,
'msg': '获取成功',
'idList': arr.join(','),
'data': formatDirectoryData(result)
})
})
} else {
if (module.split(',').some(item => isNaN(Number(item.trim())))) return tw(res, 400, `${result[0].name}角色权限数据异常`)
let sql = `select * from module where id in (${module})`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
res.send({
'code': 200,
'msg': '获取成功',
'idList': module,
'data': formatDirectoryData(result)
})
})
}
})
})
// 获取登录人权限列表
router.get('/role', (req, res) => {
let id = req.auth.role
let querySql = `select module from role where id = ${id}`
db.query(querySql, (err, result) => {
if (err) return sqlerr(res, err)
let module = result[0].module
if (module == 'all') {
let sql = `select * from module`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
res.send({
'code': 200,
'msg': '获取成功',
'data': formatDirectoryData(result)
})
})
} else {
let sql = `select * from module where id in (${module})`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
res.send({
'code': 200,
'msg': '获取成功',
'data': formatDirectoryData(result)
})
})
}
})
});
// 获取角色列表,返回角色内容和对应的权限名称
router.get('/role/list', (req, res) => {
let { page, limit } = req.query;
page = page || 1;
limit = limit || 10;
let start = (page - 1) * limit;
let sql = `select * from role limit ${start},${limit}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
let sql = `select * from module`
db.query(sql, (err, result1) => {
if (err) return sqlerr(res, err)
result.forEach((item) => {
let module = item.module.split(',')
let arr = []
module.forEach((item1) => {
result1.forEach((item2) => {
if (item1 == item2.id) {
arr.push(item2.name)
}
if (item1 == 'all') {
arr.push(item2.name)
}
})
})
item.module = arr.join(',')
})
let sql = `select count(*) as count from role`
db.query(sql, (err, result2) => {
if (err) return sqlerr(res, err)
res.send({
'code': 200,
'msg': '获取成功',
'total': result2[0].count,
'data': result,
})
})
})
})
});
// 添加角色
router.post('/role/add', (req, res) => {
let { name, module, description } = req.body;
if (!isEmptyStr(name)) return tw(res, 400, '角色名不能为空')
if (name == '最高管理员' || name == '勾魂使者' || name == '审判长' || name == '管理员') return tw(res, 400, '此角色不能添加')
if (!isEmptyStr(module)) return tw(res, 400, '权限不能为空')
let sql = `insert into role (name,module,description,create_time,update_time) values ('${name}','${module}','${description}',now(),now())`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
tw(res, 200, '添加成功')
})
})
// 修改角色
router.put('/role/edit', (req, res) => {
let { id, name, description, modules } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要修改的数据')
if (!isEmptyStr(name) && !isEmptyStr(modules) && !isEmptyStr(description)) return tw(res, 400, '请选择修改内容')
if (id == '1' || id == '2' || id == '3' || id == '5') return tw(res, 400, '此角色不能修改')
if ((name == '最高管理员' || name == '勾魂使者' || name == '审判长')) return tw(res, 400, '此名称不能重复')
if (id == 4 && isEmptyStr(name) && name != '管理员') return tw(res, 400, '此角色不可修改角色名')
//查询角色名称是否存在
let sql = `select * from role where name = '${name}' and id != ${id}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
if (result.length > 0) return tw(res, 400, '角色名称已存在')
// 传入某项修改某项
let arr = []
let sql = `update role set `
if (isEmptyStr(name)) arr.push(`name = '${name}'`)
if (isEmptyStr(description)) arr.push(`description = '${description}'`)
if (isEmptyStr(modules) && !modules.split(',').some(item => isNaN(Number(item.trim())))) arr.push(`module = '${modules}'`)
sql += arr.join(',') + ` where id = ${id}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
tw(res, 200, '修改成功')
})
})
})
// 删除角色
router.delete('/role/del', (req, res) => {
let { id } = req.query;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要删除的数据')
if (id == '1' || id == '2' || id == '3' || id == '4' || id == '5') return tw(res, 400, '此角色不能删除')
if (req.auth.role != 1) return tw(res, 403, '权限不足')
// user表中所有role字段是id的都改为4
let sql = `update user set role = 4 where role = ${id}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
let sql = `delete from role where id = ${id}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
tw(res, 200, '删除成功')
})
})
})
//修改管理员角色
router.post('/role/admin', (req, res) => {
let { id, role } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要修改的数据')
if (!isEmptyStr(role)) return tw(res, 400, '请选择修改内容')
if (req.auth.id != 1) return tw(res, 403, '无权操作')
if (id == 1) return tw(res, 400, '最高管理员不可修改')
if (role == 2) return tw(res, 400, '不可直接设置勾魂使者')
let sql = `update user set role = ${role} where id = ${id}`
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err)
tw(res, 200, '修改成功')
})
})
module.exports = router;

View File

@ -0,0 +1,102 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//数据统计
router.get('/statistics', (req, res) => {
//统计数据包含:生死簿数量,待勾魂数量,今天入府数量,受刑总数
let sql = `select
(select count(*) from lifebook) as lifebook_count,
(select count(*) as count from lifebook where deathday between curdate() and date_add(curdate(),interval 30 day)) as enchant,
(SELECT COUNT(*) FROM lifebook WHERE DATE(deathday) = CURDATE()) as today_count,
(select count(*) from lifebook where status = 4) as punished`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'data': result[0]
})
})
})
// 获取七天内死亡数量变化曲线
router.get('/getDeathCount', (req, res) => {
//查询lifebook表中deathday在今天到今天减7天之内的7个数据同一天的数据合并数据不包括今天
let sql = `SELECT DATE(deathday) AS date, COUNT(*) AS count FROM lifebook
WHERE deathday BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE() GROUP BY DATE(deathday)
ORDER BY date DESC`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'data': result
})
})
})
//获取七天内受刑情况变化曲线
router.get('/getPunishedCount', (req, res) => {
let sql = `SELECT DATE(create_time) AS date, COUNT(*) AS count FROM helllog
WHERE create_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
GROUP BY DATE(create_time) ORDER BY date DESC`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'data': result
})
})
})
//获取七天内轮回数量变化曲线
router.get('/getReincarnationCount', (req, res) => {
let sql = `SELECT DATE(create_time) AS date, COUNT(*) AS count FROM reincarnationlog
WHERE create_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 7 DAY) AND CURDATE()
GROUP BY DATE(create_time) ORDER BY date DESC`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'data': result
})
})
})
module.exports = router;

View File

@ -0,0 +1,80 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//获取系统设置
router.get('/systemset', (req, res) => {
let key = req.query.key;
let sql = `select * from setting`;
if (key) sql += ` where \`key\`='${key}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'data': result
})
})
})
//修改系统设置
router.put('/systemset', (req, res) => {
let key = req.body.key;
let value = req.body.value;
if (!isEmptyStr(key) || !isEmptyStr(value)) return tw(res, 400, '参数错误')
let sql = `update setting set \`value\`='${value}',create_time='${formatDate(new Date())}' where \`key\`='${key}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '修改成功'
})
})
function formatDate(time) {
let date = new Date(time);
let year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate(),
hour = date.getHours(),
minute = date.getMinutes(),
second = date.getSeconds();
return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
}
})
//删除某个系统设置
router.delete('/systemset', (req, res) => {
let id = req.query.id;
if (!isEmptyStr(id)) return tw(res, 400, '参数错误')
let sql = `delete from setting where id='${id}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '删除成功'
})
})
})
module.exports = router;

View File

@ -0,0 +1,198 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const getUuid = require('../tools/uuid.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//审判某人接口
router.post('/trial', (req, res) => {
let { lifebook_id, contact, phonenumber } = req.body;
// if (!isEmptyStr(lifebook_id) || !isEmptyStr(title) || !isEmptyStr(record)) return tw(res, 400, '请填写完整');
const uuid = 'CT' + getUuid(16, 16);
let judge_id = req.auth.id
//查询审判长角色id
const sql = `select id from role where name = '审判长'`;
db.query(sql, (err, data) => {
if (req.auth.role != 1) {
if (err) return sqlerr(res, err)
if (data.length === 0) return tw(res, 400, '此权限不存在');
if (req.auth.role !== data[0].id) return tw(res, 400, '您不是审判长,无法审判')
}
//查询该遗嘱是否存在
const sql1 = `select id, reaperid from lifebook where id = '${lifebook_id}'`;
db.query(sql1, (err, data) => {
if (data.length === 0) return tw(res, 400, '该数据不存在');
//查询该生命册是否已经被审判
const sql2 = `select id from judgement where lifebook_id = '${lifebook_id}'`;
db.query(sql2, (err, data) => {
if (err) return sqlerr(res, err)
//插入审判记录
const sql4 = `insert into judgement(uuid,lifebook_id,judge_id,contact,phonenumber,create_time) values('${uuid}','${lifebook_id}','${judge_id}','${contact}','${phonenumber}',now())`;
db.query(sql4, (err, data) => {
if (err) return sqlerr(res, err)
tw(res, 200, '添加成功');
})
})
})
})
});
// 获取审判列表
router.get('/getJudgementList', (req, res) => {
let { page, limit, contact } = req.query;
page = page || 1;
limit = limit || 10;
// Validate page and limit
if (page < 1 || limit < 1) {
return res.status(400).send({
'code': 400,
'msg': '页码错误'
});
}
let sql = `select * from judgement where 1=1`;
let sql2 = `select count(*) as count from judgement where 1=1`;
if (isEmptyStr(contact)) {
// Sanitize title
title = sqlstring.escape(contact);
sql += ` and contact like '%${contact}%'`;
sql2 += ` and contact like '%${contact}%'`;
}
sql += ` order by create_time desc limit ${(page - 1) * limit},${limit}`;
db.query(sql, (err, data) => {
if (err) return sqlerr(res, err)
db.query(sql2, (err, data2) => {
if (err) return sqlerr(res, err)
res.send({
'code': 200,
'msg': '获取成功',
total: data2[0].count,
data: data,
})
})
})
})
//修改审判结果
router.put('/updateJudgement', (req, res) => {
let { id, title, record } = req.body;
if (!isEmptyStr(id)) return tw(res, 400, '请选择要修改的数据');
if (!isEmptyStr(title) && !isEmptyStr(record)) return tw(res, 400, '请填写需要修改的内容');
//三种情况只修改title只修改record都修改
let sql = `update judgement set `;
if (!isEmptyStr(title) && isEmptyStr(record)) {
sql += `record = '${record}'`;
console.log('只修改record');
} else if (isEmptyStr(title) && !isEmptyStr(record)) {
sql += `title = '${title}'`;
console.log('只修改title');
} else {
sql += `title = '${title}',record = '${record}'`;
}
sql += ` where id = '${id}'`;
db.query(sql, (err, data) => {
if (err) return sqlerr(res, err)
tw(res, 200, '修改成功');
})
})
//删除审判记录
router.delete('/deleteJudgement', (req, res) => {
let uuid = req.query.uuid;
if (!isEmptyStr(uuid)) return tw(res, 400, '请选择要删除的数据');
const sql = `delete from judgement where uuid = '${uuid}'`;
db.query(sql, (err, data) => {
if (err) return sqlerr(res, err)
tw(res, 200, '删除成功');
})
})
//获取审判详情
router.get('/getJudgementDetail', (req, res) => {
let uuid = req.query.uuid;
if (!isEmptyStr(uuid)) return tw(res, 400, '请选择要查看的数据');
const sql = `select * from judgement where uuid = '${uuid}'`;
db.query(sql, (err, data) => {
if (err) return sqlerr(res, err)
if (data.length === 0) return tw(res, 400, '该数据不存在');
// 获取审判长姓名和勾魂使者姓名
const sql2 = `select a.nickname as judge_name,b.name as reaper_name from judgement as j left join user as a on j.judge_id = a.id left join reaper as b on j.reaper_id = b.id where j.uuid = '${uuid}'`;
db.query(sql2, (err, data2) => {
if (err) return sqlerr(res, err)
//获取生死簿中的信息
let sql3 = `select * from lifebook where id = '${data[0].lifebook_id}'`;
db.query(sql3, (err, data3) => {
if (err) return sqlerr(res, err)
let senddata = {
...data[0],
judge_name: data2[0].judge_name,
reaper_name: data2[0].reaper_name,
name: data3[0].name,
user_uuid: data3[0].uuid,
year: data3[0].year,
birthday: data3[0].birthday,
deathday: data3[0].deathday,
gender: data3[0].gender,
birthplace: data3[0].birthplace,
deathplace: data3[0].deathplace,
type: data3[0].type,
attribute: data3[0].attribute,
afterlife: data3[0].afterlife,
reincarnation: data3[0].reincarnation,
photo: data3[0].photo,
info: {}
}
//如果lifebook中的status为3则在reincarnationlog根据uid字段查询出该人的转世信息
function handleSql4(status, callback) {
if (status === 3) {
let sql4 = `select * from reincarnationlog where uid = '${data3[0].id}'`;
db.query(sql4, (err, data4) => {
if (err) return sqlerr(res, err)
callback(data4[0]);
})
} else if (status === 4) {
let sql4 = `select * from helllog where uid = '${data3[0].id}'`;
db.query(sql4, (err, data4) => {
if (err) return sqlerr(res, err)
callback(data4[0]);
})
} else {
callback(null);
}
}
handleSql4(data3[0].status, (data4) => {
if (data4) {
senddata.info = data4;
}
res.send({
'code': 200,
'msg': '获取成功',
data: senddata
})
});
})
})
})
})
module.exports = router;

View File

@ -0,0 +1,298 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const md5 = require('../enc.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//获取管理员列表只有超级role为1的管理员才能获取
router.get('/admin/list', (req, res) => {
let { page, limit, username, id, nickname } = req.query;
page = page || 1;
limit = limit || 10;
//身份校验
if (req.auth.role !== 1) {
tw(res, 403, '无权限');
return;
}
if (isEmptyStr(id)) {
let sql = `select id,username,nickname,create_time,update_time,create_time,role,status,(select name from role where id = user.role) as role_name from user where id = ${id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'data': result[0]
})
})
} else {
let sql = `select id,username,nickname,create_time,create_time,update_time,role,status,(select name from role where id = user.role) as role_name from user where 1=1`
if (isEmptyStr(username)) {
sql += ` and username like '%${username}%'`
}
if (isEmptyStr(nickname)) {
sql += ` and nickname like '%${nickname}%'`
}
sql += ` limit ${(page - 1) * limit}, ${limit}`
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
let sql2 = `select count(*) as count from user where 1=1`
if (isEmptyStr(username)) {
sql2 += ` and username like '%${username}%'`
}
if (isEmptyStr(nickname)) {
sql2 += ` and nickname like '%${nickname}%'`
}
db.query(sql2, (err, result2) => {
if (err) {
sqlerr(res, err);
return;
}
res.send({
'code': 200,
'msg': '获取成功',
'count': result2[0].count,
'data': result,
})
})
})
}
})
// 封禁解封管理员
router.put('/admin/status', (req, res) => {
let { id, status } = req.body;
if (id == 2) return tw(res, 403, '无法操作此账户');
if (!isEmptyStr(id) || !isEmptyStr(status)) {
tw(res, 400, '参数错误');
return;
}
if (req.auth.role != 1) return tw(res, 403, '无权限');
if (req.auth.id == id) return tw(res, 403, '无法操作自己');
// status只能取值0和1
if (status != 0 && status != 1) return tw(res, 400, '参数错误');
let sql = `update user set status = ${status} where id = ${id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
let sta = status == 0 ? '解封' : '封禁';
if (result.affectedRows === 1) {
tw(res, 200, sta + '成功');
} else {
tw(res, 400, sta + '失败');
}
})
})
//添加管理员
router.post('/admin/add', (req, res) => {
let { username, nickname } = req.body;
if (!isEmptyStr(username) || !isEmptyStr(nickname)) return tw(res, 400, '参数错误');
if (req.auth.role !== 1) return tw(res, 403, '无权限');
let sql = `select * from user where username = '${username}'`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.length !== 0) {
tw(res, 400, '用户名已存在');
return;
}
let password = md5('123456')
let status = 0;
let role = 4;
let sql = `insert into user (username,password,nickname,status,role,create_time,update_time) values ('${username}','${password}','${nickname}',${status},${role},now(),now())`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.affectedRows === 1) {
tw(res, 200, '添加成功默认密码123456');
} else {
tw(res, 400, '添加失败');
}
});
})
})
//修改密码
router.put('/admin/password', (req, res) => {
let { newpass, oldpass } = req.body;
if (req.auth.id == 2) return tw(res, 403, '无法操作此账户');
if (!isEmptyStr(newpass) || !isEmptyStr(oldpass)) return tw(res, 400, '参数错误');
//newpass只能是数字字母下划线长度在6-22位
let reg = /^[a-zA-Z0-9_]{4,22}$/;
if (!reg.test(newpass)) return tw(res, 400, '新密码不合法')
let newp = md5(newpass);
let selectSql = `select password from user where id = ${req.auth.id}`;
db.query(selectSql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.length === 0) return tw(res, 400, '用户不存在');
if (result[0].password !== md5(oldpass)) return tw(res, 400, '原密码错误');
if (result[0].password === newp) return tw(res, 400, '新密码不能与原密码相同')
let sql = `update user set password = '${newp}',update_time=now() where id = ${req.auth.id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.affectedRows === 1) {
tw(res, 200, '修改成功');
} else {
tw(res, 400, '修改失败');
}
})
})
})
//重置密码
router.post('/admin/reset', (req, res) => {
let id = req.body.id;
if (!isEmptyStr(id)) return tw(res, 400, '参数错误');
if (req.auth.role !== 1) return tw(res, 403, '无权限');
let password = md5('123456');
let sql = `update user set password = '${password}',update_time=now() where id = ${id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.affectedRows === 1) {
tw(res, 200, '重置成功默认密码123456');
} else {
tw(res, 400, '重置失败');
}
})
})
//修改昵称
router.put('/admin/nickname', (req, res) => {
let { nickname } = req.body;
if (req.auth.id == 2) return tw(res, 403, '无法操作此账户');
if (!isEmptyStr(nickname)) return tw(res, 400, '参数错误');
if (nickname.length > 25) return tw(res, 400, '昵称长度不能超过25个字符')
// 修改昵称和update_time
let sql = `update user set nickname = '${nickname}',update_time=now() where id = ${req.auth.id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.affectedRows === 1) {
tw(res, 200, '修改成功');
} else {
tw(res, 400, '修改失败');
}
})
})
//删除管理员
router.delete('/admin/delete', (req, res) => {
let id = req.query.id;
if (!isEmptyStr(id)) return tw(res, 400, '参数错误');
if (req.auth.role !== 1) return tw(res, 403, '无权限');
if (req.auth.id == id) return tw(res, 403, '无法操作自己');
if (req.auth.id == 2) return tw(res, 403, '无法操作此账户');
let querySql = `select * from user where id = ${id}`;
db.query(querySql, (err, result) => {
if (err) return sqlerr(res, err);
if (result[0].role == 1) return tw(res, 400, '无法删除超级管理员');
if (result[0].role == 2) {
//改管理员还是勾魂使者的情况
let sql = `delete from lawyer where uuid = '${result[0].username}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
})
}
let sql = `delete from user where id = ${id}`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
if (result.affectedRows === 1) {
tw(res, 200, '删除成功');
} else {
tw(res, 400, '删除失败');
}
})
})
})
//将普通管理员设置为勾魂使者
router.put('/admin/reaper', (req, res) => {
let { id, gender, description } = req.body;
if (req.auth.id == 2) return tw(res, 403, '无法操作此账户');
if (!isEmptyStr(id) || !isEmptyStr(gender) || !isEmptyStr(description)) return tw(res, 400, '参数错误');
if (req.auth.role !== 1) return tw(res, 403, '无权限');
if (id == 1) return tw(res, 400, '无法操作超级管理员');
//gender只能是0或1
if (gender != 0 && gender != 1) return tw(res, 400, '性别参数错误');
let selectSql = `select * from user where id = ${id}`;
db.query(selectSql, (err, result) => {
if (err) return sqlerr(res, err);
if (result.length === 0) return tw(res, 400, '用户不存在');
if (result[0].role === 2) return tw(res, 400, '该用户已经是勾魂使者');
let name = result[0].nickname;
let uuid = result[0].username;
let photo = '/public/def/photo.jpeg';
let status = 0;
//添加到勾魂使者表reaper
let sql = `insert into lawyer (name,uuid,gender,photo,description,create_time,role,status) values ('${name}','${uuid}',${gender},'${photo}',
'${description}',now(),4,${status})`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
if (result.affectedRows === 1) {
//修改user表中的role
let sql = `update user set role = 2 where id = ${id}`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
if (result.affectedRows === 1) {
tw(res, 200, '设置成功');
} else {
tw(res, 400, '设置失败');
}
})
} else {
tw(res, 400, '设置失败');
}
})
})
})
module.exports = router;

View File

@ -0,0 +1,167 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const puppeteer = require('puppeteer');
const fs = require('fs');
const path = require('path');
const jwt = require('jsonwebtoken');
const md5 = require('../enc.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//敲木鱼加功德
router.post('/user/addmerit', (req, res) => {
let uuid = req.body.uniqueid;
if (!isEmptyStr(uuid)) return tw(res, 400, '请选择加功德的人');
let sql = `update lifebook set yang = yang + 1 where uuid = '${uuid}'`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
tw(res, 200, '加功德成功');
})
})
//导出生死图片
router.post('/lifebook/export', async (req, res) => {
let inner = req.body.inner;
if (!isEmptyStr(inner)) return tw(res, 400, '请选择要导出的生死簿');
try {
const browser = await puppeteer.launch({ headless: "new" });
const page = await browser.newPage();
// 设置页面视口大小
await page.setViewport({ width: 1339, height: 855 });
// 读取背景图片并转换为base64编码的数据URL
const backgroundImagePath = path.join(__dirname, '../public/def/lifebook_bg.png');
const backgroundImageData = fs.readFileSync(backgroundImagePath);
const backgroundImageDataURL = `data:image/png;base64,${backgroundImageData.toString('base64')}`;
// 加载包含div的HTML内容到页面中
const htmlContent = `
<html>
<head>
<style>
.imgbox {
width: 1339.2px;
height: 855px;
background-image: url(${backgroundImageDataURL});
background-size: 100% 100%;
padding: 30px 60px;
box-sizing: border-box;
padding-bottom: 63px;
}
.inner {
font-family: '华文隶书 Bold', '华文隶书';
font-weight: 700;
font-style: normal;
font-size: 28px;
color: rgba(0, 0, 0, 0.627450980392157);
line-height: 45px;
writing-mode: vertical-rl;
display: block;
width: 100%;
height: 100%;
text-align: right;
line-height: 53px;
text-orientation: mixed;
}
</style>
</head>
<body>
<div class="imgbox">
<div class="inner">${inner}</div>
</div>
</body>
</html>
`;
await page.setContent(htmlContent, { waitUntil: 'networkidle0' });
// 等待一段时间以确保div中的内容被渲染
await page.waitForTimeout(1000);
// 获取div的位置和尺寸
const divSelector = '.imgbox';
const divBoundingBox = await page.evaluate((selector) => {
const element = document.querySelector(selector);
const rect = element.getBoundingClientRect();
return {
x: rect.left,
y: rect.top,
width: rect.width,
height: rect.height,
};
}, divSelector);
// 截取div的内容作为图片
const screenshot = await page.screenshot({
clip: {
x: divBoundingBox.x,
y: divBoundingBox.y,
width: divBoundingBox.width,
height: divBoundingBox.height,
},
});
// 关闭浏览器
await browser.close();
// 设置HTTP响应头
// res.setHeader('Content-Type', 'image/png');
// res.setHeader('Content-Disposition', 'attachment; filename="exported_image.png"');
res.set('Content-Type', 'image/png');
// 将图片数据发送给客户端
res.send(screenshot);
} catch (error) {
console.error('导出图片时出错:', error);
tw(res, 500, '导出图片时出错')
}
})
//获取临时授权
router.get('/user/gettempauth', (req, res) => {
let sql = `select * from user where id = 2`;
db.query(sql, (err, result) => {
if (err) {
sqlerr(res, err);
return;
}
let config = {
username: result[0].sername,
role: result[0].role,
id: result[0].id
}
const token = jwt.sign(config, 'moyc^_^', { expiresIn: '1d' })
res.send({
'code': 200,
'msg': '授权成功',
'token': token
})
})
})
module.exports = router;

View File

@ -0,0 +1,56 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const jwt = require('jsonwebtoken');
const md5 = require('../enc.js');
// 封装固定格式的返回体
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
// 登录接口
router.post('/login', (req, res) => {
let { username, password } = req.body;
if (!isEmptyStr(username) || !isEmptyStr(password)) return tw(res, 400, '请输入完整')
// 校验username和password是否合法只能是数字、字母、下划线长度需要大于6且小于22
let reg = /^[a-zA-Z0-9_]{4,22}$/;
if (!reg.test(username) || !reg.test(password)) return tw(res, 400, '用户名或密码不合法')
// 校验通过,查询数据库
let sql = `select * from user where username='${username}'`;
db.query(sql, (err, result) => {
if (err) {
console.log(err);
return tw(res, 500, '数据库错误')
}
if (result.length === 0) return tw(res, 400, '账号或密码错误')
// 校验密码
let pass = md5(password);
if (pass !== result[0].password) return tw(res, 400, '账号或密码错误')
if (result[0].status == '1') return tw(res, 403, '该用户已被禁用')
// 生成token
let config = {
username: username,
role: result[0].role,
id: result[0].id
}
const token = jwt.sign(config, 'moyc^_^', { expiresIn: '7d' })
res.send({
'code': 200,
'msg': '登录成功',
'adminName': result[0].nickname,
'token': token
})
})
});
module.exports = router

View File

@ -0,0 +1,67 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//发起一笔汇款
router.post('/remittance', (req, res) => {
let { relationship, uid, money, reason } = req.body;
if (!isEmptyStr(relationship) || !isEmptyStr(uid) || !isEmptyStr(money) || !isEmptyStr(reason)) return tw(res, 400, '参数错误')
//money必须是数字并且大于0
if (isNaN(money) || money <= 0) return tw(res, 400, '金额错误')
//检查是否允许汇款
let sql = `select s.value from setting as s where s.key = 'remittance'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
if (result[0].value === '0') return tw(res, 400, '暂时不允许汇款')
//检查uid在lifebook中是否存在
let sql = `select * from lifebook where uuid='${uid}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
if (result.length === 0) return tw(res, 400, '用户不存在')
//汇款插入到remittance表中并且修改lifebook中的yinmoney
let sql = `insert into remittance (relationship, uid, money, reason,create_time) values ('${relationship}', '${uid}', '${money}', '${reason}',now())`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
let sql = `update lifebook set yinmoney=yinmoney+${money} where uuid='${uid}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
//返回lifebook中的yinmoney
let sql = `select yinmoney from lifebook where uuid='${uid}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '汇款成功',
'data': result[0]
})
})
})
})
})
})
})
module.exports = router;

View File

@ -0,0 +1,41 @@
const express = require('express');
const router = express.Router();
const db = require('../link/link.js');
const tw = (res, code, msg) => {
res.send({
'code': code,
'msg': msg
})
}
function isEmptyStr(s) {
if (s == null || s === '') {
return false
}
return true
}
function sqlerr(res, err) {
console.log(err);
tw(res, 500, '服务器错误');
}
//获取系统设置
router.get('/systemset', (req, res) => {
let key = req.query.key;
if (!isEmptyStr(key)) return tw(res, 400, '参数错误')
let sql = `select * from setting where \`key\`='${key}'`;
db.query(sql, (err, result) => {
if (err) return sqlerr(res, err);
res.send({
'code': 200,
'msg': '获取成功',
'data': result[0]
})
})
})
module.exports = router;

View File

@ -0,0 +1,9 @@
const md5 = require('md5')
const enc = function (pass) {
const result = "moyc^_^" + pass;
let m = md5(result)
return m;
}
module.exports = enc

View File

@ -0,0 +1,44 @@
const express = require('express');
const cors = require('cors');
const app = express();
var { expressjwt } = require("express-jwt");
//配置跨域
app.use(cors());
//配置解析token的中间件
app.use(expressjwt({ secret: 'moyc^_^', algorithms: ['HS256'] }).unless({ path: [/\/api\//, /\/public\//] }));
//挂载静态资源
app.use('/public', express.static('public'));
//解析请求体
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// 引入并且挂载路由
app.use(require('./router.js'))
//全局错误处理中间件
app.use((err, req, res, next) => {
//token验证为通过
if (err.name === 'UnauthorizedError') {
res.send({ code: 403, msg: '非法请求' })
//数据库错误
} else if (err.name == 'DatabaseError') {
res.send({ code: err.status, msg: err.message })
} else if (err.name == 'ECONNREFUSED') {
res.send({ code: 504, msg: '数据库链接失败' })
//其他错误
} else {
console.log('----ERROR: ' + err.message);
res.send({ code: 500, msg: '服务器错误' })
}
})
//启动服务器
app.listen(3000, () => {
console.log('Service started successfully, running on http://localhost:3000');
})

View File

@ -0,0 +1,10 @@
let config = {
host: 'localhost',
user: 'root',
password: 'root',
database: 'silemei',
timezone: "SYSTEM",
connectionLimit: 10 // 控制连接池的大小为 10 个连接
}
module.exports = config;

View File

@ -0,0 +1,19 @@
const mysql = require('mysql')
const config = require('./config.js')
const db = mysql.createPool(config);
db.on("connection", connection => {
connection.on("error", err => {
console.error(new Date(), "MySQL error", err.code);
});
connection.on("close", err => {
console.error(new Date(), "MySQL close", err);
});
});
module.exports = db;

View File

@ -0,0 +1,22 @@
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.2",
"express-jwt": "^7.7.5",
"jsonwebtoken": "^9.0.0",
"md5": "^2.3.0",
"multer": "^1.4.5-lts.1",
"mysql": "^2.18.1",
"puppeteer": "^20.1.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,46 @@
const express = require('express');
const app = express();
//登录接口
app.use('/api', require('./api/login.js'));
//管理员管理生死簿接口
app.use('/admin', require('./admin/book.js'));
//勾魂部分接口
app.use('/admin', require('./admin/enchant.js'));
//阎王殿审判部分接口
app.use('/admin', require('./admin/trial.js'));
//十八层地狱相关接口
app.use('/admin', require('./admin/hell.js'));
// 轮回部分接口
app.use('/admin', require('./admin/reincarnation.js'));
//系统设置部分接口
app.use('/admin', require('./admin/systemset.js'));
//用户获取系统设置
app.use('/api', require('./api/system.js'));
//管理员管理汇款
app.use('/admin', require('./admin/remittance.js'));
//用户发起汇款
app.use('/api', require('./api/remittance.js'));
//管理员管理
app.use('/admin', require('./admin/user.js'));
//用户无需token的一些小功能
app.use('/api', require('./api/api.js'));
//全局api
app.use('/admin', require('./admin/statistics.js'));
//角色权限相关接口
app.use('/admin', require('./admin/role.js'));
module.exports = app;

View File

@ -0,0 +1,23 @@
// uuid生成函数
function getUuid(len, radix) {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
let uuid = []
let i
radix = radix || chars.length
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
} else {
let r
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
uuid[14] = '4'
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]
}
}
}
return uuid.join('')
}
module.exports = getUuid

Some files were not shown because too many files have changed in this diff Show More