express解析object/json数据的方法
//处理post请求,解析json数据
const bodyParser = require('body-parser')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
https://wenku.baidu.com/view/161436511411cc7931b765ce050876323112747b.html
饿了么UI
<link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
<template>
<el-row class="mb-4">
<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button type="success">Success</el-button>
<el-button type="info">Info</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
<el-button>中文</el-button>
</el-row>
<el-row class="mb-4">
<el-button plain>Plain</el-button>
<el-button type="primary" plain>Primary</el-button>
<el-button type="success" plain>Success</el-button>
<el-button type="info" plain>Info</el-button>
<el-button type="warning" plain>Warning</el-button>
<el-button type="danger" plain>Danger</el-button>
</el-row>
<el-row class="mb-4">
<el-button round>Round</el-button>
<el-button type="primary" round>Primary</el-button>
<el-button type="success" round>Success</el-button>
<el-button type="info" round>Info</el-button>
<el-button type="warning" round>Warning</el-button>
<el-button type="danger" round>Danger</el-button>
</el-row>
<el-row>
<el-button :icon="Search" circle></el-button>
<el-button type="primary" :icon="Edit" circle></el-button>
<el-button type="success" :icon="Check" circle></el-button>
<el-button type="info" :icon="Message" circle></el-button>
<el-button type="warning" :icon="Star" circle></el-button>
<el-button type="danger" :icon="Delete" circle></el-button>
</el-row>
</template>
<script lang="ts" setup>
import {
Search,
Edit,
Check,
Message,
Star,
Delete,
} from '@element-plus/icons-vue'
</script>
常用js库 教程
-
Bootstrap
- <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
- https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css
- <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
- https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js
-
- 官方:jQuery
- http://code.jquery.com/jquery-1.9.1.min.js
-
https://code.jquery.com/jquery-3.5.1.min.js
- https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js
- 百度:
- http://libs.baidu.com/jquery/1.9.1/jquery.min.js
- http://libs.baidu.com/jquery/1.9.1/jquery.js
- element ui
- <!-- 导入样式 -->
- <link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
- <!-- 导入 Vue 3 -->
- <script src="//unpkg.com/vue@next"></script>
- <!-- 导入组件库 -->
-
<script src="//unpkg.com/element-plus"></script>
Java文件读写
// 文件读取
// 方法一
String path = "d:\a.txt";
BufferedReader b= new BufferedReader(new FileReader(path));
String s;
while ((s = b.readLine()) != null) {
System.out.println(s);
}
b.close();
//方法二
// String path = "d:\a.txt";
// BufferedInputStream i = new BufferedInputStream(new FileInputStream(path));
// int s1 = 0;
// byte[] b1= new byte[1024];
// while ((s1=i.read(b1)) != -1) {
// System.out.print(new String(b1,0,s1));;
//
// }
// i.close();
Java教学GUI实例 教程
Frame f = new Frame("test");
Panel p = new Panel();
f.add(p);
Button b1 = new Button("按钮");
p.add(b1);
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
System.out.println("success");
}
});
f.setSize(300,400);
f.setVisible(true);
}
private class MyActionListener implements ActionListener{
public void actionPerformed(ActionEvent e) {
System.out.println("success");
}
}
Java p271 三题 1小题 教程
// Questionnaire.java
import java.awt.;
import java.awt.event.;
import javax.swing.JOptionPane;
public class Questionnaire extends Frame implements ActionListener {
TextField name = new TextField(30); // 企业名称,宽度为30
TextField funds = new TextField(30);// 注册资金
// 员工数量,初始值为50,文本域宽度为4
TextField employeeCount = new TextField("50", 4);
Choice industry = new Choice(); // 从事行业
TextField turnover = new TextField(30);// 年营业额
TextField margin = new TextField(30);// 利润率
Button btn1 = new Button("确认"); // 确认、取消和退出按钮
Button btn2 = new Button("取消");
Button btn3 = new Button("退出");
Label l = new Label("企业信息调查表");
Label l1 = new Label("企业名称"), l2 = new Label("注册资金");
Label l3 = new Label("员工数量"), l4 = new Label("从事行业");
Label l5 = new Label("年营业额"), l6 = new Label("利润率");
// 构造方法,用于设置窗体标题、大小,并取消窗体的布局管理器
public Questionnaire(String title) {
super(title); // 调用父类构造方法
this.setSize(400, 400); // 设置窗体的尺寸
this.setLayout(null); // 取消窗体的布局管理器
l.setBounds(150, 50, 100, 20);// 企业信息调查表
l1.setBounds(50, 100, 60, 20);// 企业名称标签
name.setBounds(110, 100, 150, 20);// 企业名称文本域
l2.setBounds(230, 200, 60, 20);// 注册资金标签
funds.setBounds(290, 200, 80, 20);// 注册资金
l3.setBounds(50, 150, 60, 20);// 员工数量标签
employeeCount.setBounds(110, 150, 80, 20);// 员工数量文本域
l4.setBounds(230, 150, 60, 20);// 从事行业标签
industry.add("机构组织");// 设置选项框内容
industry.add("信息产业");
industry.add("医药卫生");
industry.add("机械机电");
industry.setBounds(290, 150, 80, 20);// 从事行业
l5.setBounds(50, 200, 60, 20);// 年营业额标签
turnover.setBounds(110, 200, 80, 20);// 年营业额
l6.setBounds(50, 250, 60, 20);// 利润率标签
margin.setBounds(110, 250, 80, 20);// 利润率
btn1.setBounds(110, 300, 50, 20);// 确认
btn2.setBounds(180, 300, 50, 20);// 取消
btn3.setBounds(250, 300, 50, 20);// 退出
this.add(l);// 将各组件添加到窗体中
this.add(l1); this.add(name); this.add(l2); this.add(funds);
this.add(l3); this.add(employeeCount); this.add(l4); this.add(industry);
this.add(l5); this.add(turnover); this.add(l6); this.add(margin);
this.add(btn1); this.add(btn2); this.add(btn3);
setLocationRelativeTo(null); // 使窗体在屏幕上居中放置
btn1.addActionListener(this); // 为三个按钮注册事件侦听器
btn2.addActionListener(this); btn3.addActionListener(this);
employeeCount.addActionListener(this); // 为员工数量文本域注册焦点事件侦听器
funds.addActionListener(this);// 为注册基金文本域注册焦点事件侦听器
turnover.addActionListener(this);// 为年企业额文本域注册事件侦听器
margin.addActionListener(this);// 为利润率文本域注册焦点事件侦听器
}
// 窗体的ActionEvent事件处理方法
public void actionPerformed(ActionEvent e) {
try {
Integer.parseInt(employeeCount.getText());
Integer.parseInt(funds.getText());
Float.parseFloat(turnover.getText());
Float.parseFloat(margin.getText());
} catch (Exception e2) {
JOptionPane.showMessageDialog(null, "员工数量和注册基金为整数,年营业额和利润率为浮点数","错误提示", JOptionPane.ERROR_MESSAGE);
employeeCount.setText("50");
funds.setText(""); turnover.setText(""); margin.setText("");
}
Object ob = e.getSource(); // 获取事件对象
if (ob == btn3) { // 单击退出按钮
System.exit(0); // 退出系统
} else if (ob == btn1) {// 单击确认按钮
System.out.println("企业名称:" + name.getText());
System.out.println("员工数量:" + employeeCount.getText());
System.out.println("从事行业:" + industry.getSelectedItem());
System.out.println("年营业额:" + turnover.getText());
System.out.println("注册资金:" + funds.getText());
System.out.println("利润率:" + margin.getText());
} else if (ob == btn2) { // 单击取消按钮
name.setText(""); // 清空姓名文本域
employeeCount.setText("50");
turnover.setText(""); funds.setText(""); margin.setText("");
}
}
}
多选按钮实例 教程
package ss;
import java.awt.*;
public class Frame2 {
static Frame f=new Frame("QQ");
static Label l1=new Label("爱好:");
static Label l2=new Label("性别:");
static Checkbox like1=new Checkbox("读书",true);
static Checkbox like2=new Checkbox("上网",true);
static Checkbox like3=new Checkbox("打游戏");
static CheckboxGroup sex=new CheckboxGroup();
static Checkbox man=new Checkbox("男");
static Checkbox woman=new Checkbox("女");
public static void main(String[] args) {
// TODO Auto-generated method stub
f.setVisible(true);
f.setBounds(100, 100, 500, 400);
f.setBackground(new Color(220,220,220));
f.setLayout(null);
f.setResizable(false);
man.setCheckboxGroup(sex);
woman.setCheckboxGroup(sex);
sex.setSelectedCheckbox(man);
l1.setBounds(60, 60, 60, 20);
like1.setBounds(60,90,60,20);
like2.setBounds(130,90,60,20);
like3.setBounds(200,90,60,20);
l2.setBounds(60, 160, 60, 20);
man.setBounds(60,190,60,20);
woman.setBounds(130,190,60,20);
f.add(l1);
f.add(l2);
f.add(like1);
f.add(like2);
f.add(like3);
f.add(man);
f.add(woman);
}
}
图片更名实例 教程
# -- coding: utf-8 --
# @Time : 2021/11/18 1:02
# @Author : suxin
# @Email : 208082474@qq.com
# @File : os_test.py
# @Software: PyCharm
import os
import time
st = time.time()
path1 = r"C:\Users\suxin\Pictures"
ps = ['bmp', 'jpeg', 'gif', 'psd', 'png', 'jpg']
for root, dirs, files in os.walk(path1):
# print(root, dirs, files)
for p in ps:
for x in files:
if x.endswith(p):
a = os.path.splitext(x)
print(x)
os.chdir(root)
os.rename(root+"\"+x, a[0]+"_jycj"+a[-1])
et = time.time()
print(et-st)
QQ登陆案列 教程
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Frame2 {
static Frame f=new Frame("QQ");
static Label l1=new Label("请输入你的 账号:");
static Label l2=new Label("请输入你的密码:");
static Button b1=new Button("登陆");
static Button b2=new Button(" 取消");
static TextField t1=new TextField(100);
static TextField t2=new TextField(100);
static ImageIcon i=new ImageIcon("ime\\g.jpg");
static JLabel l3=new JLabel(i);
public static void main(String[] args) {
// TODO Auto-generated method stub
f.setVisible(true);
f.setBounds(100, 100, 500, 200);
f.setBackground(new Color(220,220,220));
f.setLayout(null);
f.setResizable(false);
l3.setBounds(50,60, 100, 80);
l1.setBounds(160, 60, 120, 20);
l2.setBounds(160, 120, 120, 20);
t1.setBounds(280, 60, 150, 20);
t2.setBounds(280, 120, 150, 20);
t2.setEchoChar('*');
b1.setBounds(290, 150, 50, 30);
b2.setBounds(350, 150, 50, 30);
t1.addFocusListener(new FocusHandler());
t2.addFocusListener(new FocusHandler());
t1.addKeyListener(new KeyHandler());
t2.addKeyListener(new KeyHandler());
b1.addActionListener(new ActionHandler());
b2.addActionListener(new ActionHandler());
b1.addKeyListener(new KeyHandler2());
b2.addKeyListener(new KeyHandler2());
f.add(l1);
f.add(b1);
f.add(l2);
f.add(b2);
f.add(t1);
f.add(t2);
f.add(l3);
f.addWindowListener(new WindowHandler());
f.addKeyListener(new KeyHandler2());
}
}
class KeyHandler implements KeyListener{
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==Frame2.t1 && e.getKeyCode()==10)
System.out.println(Frame2.t1.getText());
else if(e.getSource()==Frame2.t2 && e.getKeyCode()==10)
System.out.println(Frame2.t2.getText());
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
}
class FocusHandler implements FocusListener{
@Override
public void focusGained(FocusEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==Frame2.t1)
System.out.println(Frame2.t1.getText());
else if(e.getSource()==Frame2.t2)
System.out.println(Frame2.t2.getText());
}
}
class WindowHandler implements WindowListener{
@Override
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent arg0) {
// TODO Auto-generated method stub
System.exit(0);
}
@Override
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
}
class ActionHandler implements ActionListener{
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==Frame2.b1){
if(Frame2.t1.getText().equals("13579246500") && Frame2.t2.getText().equals("myPass12345")){
System.out.println("欢迎用户13579246500成功登陆!");
System.exit(0);
}
else{
System.out.println("错误的用户名或密码,请重新输入!");
}
}
else if(e.getSource()==Frame2.b2){
System.exit(0);
}
}
}
class KeyHandler2 implements KeyListener{
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==Frame2.b1 && e.getKeyCode()==10){
if(Frame2.t1.getText().equals("13579246500") && Frame2.t2.getText().equals("myPass12345")){
System.out.println("欢迎用户13579246500成功登陆!");
System.exit(0);
}
else{
System.out.println("错误的用户名或密码,请重新输入!");
}
}
else if(e.getSource()==Frame2.b2 && e.getKeyCode()==10){
System.exit(0);
}
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
if(e.getKeyCode()==27)
System.exit(0);
}
@Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
}