-
nigger说:
jQuery监听选项
框的点击事件
$("#username_div").click(function () {
$("#username_div").css("border","1px solid #ff6700");
$("#password_div").css("border","1px solid #ccc");
});
$("#password_div").click(function () {
$("#password_div").css("border","1px solid #ff6700");
$("#username_div").css("border","1px solid #ccc");
});
// 2.给登录按钮添加点击事件
$("#login_btn").click(function () {
// 3.获取用户输入的用户名和密码
var username = $("#username").val();
var password = $("#password").val();
// 4.判断用户名和密码是否为空
if(username.trim() == "" || password.trim() == ""){
mui.toast("用户名和密码不能为空");
return;
}
// 5.调用登录接口
$.ajax({
url:"/user/login",
type:"post",
data:{
username:username,
password:password
},
success:function (res) {
console.log(res);
// 6.判断是否登录成功
if(res.error == 403){
mui.toast(res.message);
}
if(res.success){
// 7.登录成功跳转到个人中心页
location.href="user.html";
}
}
})
});
})3. 后台登录接口 ```js //1.引入模块 const express = require("express"); const router = express.Router(); const bcrypt = require("bcrypt"); const User = require("../../models/User"); //2.创建登录路由 router.post("/login",(req,res)=>{ //3.获取用户输入的用户名和密码 const username = req.body.username; const password = req.body.password; //4.查询数据库 User.findOne({username:username}) .then(user=>{ if(user){ //5.比较密码 bcrypt.compare(password,user.password,(err,isMatch)=>{ if(isMatch){ res.json({ success:true }) }else{ res.json({ error:403, message:"密码不正确" }) } }) }else{ res.json({ error:403, message:"用户名不存在" }) } }) }); //6.导出路由 module.exports = router;
5.2 个人中心
- 前端页面
用户中心 用户中心 昵称 欢迎您! 我的订单 收货地址 联系客服 退出登录
- 订单页面
我的订单 我的订单 全部订单 待付款 已完成 删除 待支付 春装新款毛呢外套女 购买数量:1 总价:¥199 支付宝支付
- 收货地址页面
收货地址
-
-
peng111说:
python怎么做三列十四行表格
# -*- coding: UTF-8 -*- # 导入模块 import pandas as pd # 使用DataFrame构建三列十四行表格 data = {'A': list(range(1, 15)), 'B': list(range(1, 15)), 'C': list(range(1, 15))} df = pd.DataFrame(data) # 输出结果 print(df)
输出结果:
A B C
0 1 1 1
1 2 2 2
2 3 3 3
3 4 4 4
4 5 5 5
5 6 6 6
6 7 7 7
7 8 8 8
8 9 9 9
9 10 10 10
10 11 11 11
11 12 12 12
12 13 13 13
13 14 14 14 -
peng111说:
python怎么做三50列50行表格
§ Code
#使用Python的模块printtable
from printtable import PrintTable#定义列标题
col_titles=['col1','col2','col3','col4','col5','col6','col7','col8','col9','col10',
'col11','col12','col13','col14','col15','col16','col17','col18','col19','col20',
'col21','col22','col23','col24','col25','col26','col27','col28','col29','col30',
'col31','col32','col33','col34','col35','col36','col37','col38','col39','col40',
'col41','col42','col43','col44','col45','col46','col47','col48','col49','col50']#定义表格内容
table_data = [
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50'],
['1','2','3','4','5','6','7','8','9','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30',
'31','32','33','34','35','36','37','38','39','40',
'41','42','43','44','45','46','47','48','49','50']
]#创建表格
table = PrintTable(col_titles)#添加表格内容
table.add_rows(table_data)#打印表格
table.print_table()§ Output
stdout : ['+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+----...----+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+\n', 'Total rows: 10\n']
§ END OF DOC
-
marlkiller说:
java 支持携程吗? 请提供一份示例
是的,Java 支持使用携程来实现多线程编程。下面是一个简单的 Java 携程示例:
public class MyThread implements Runnable{
public void run(){
System.out.println("MyThread running");
}
public static void main(String args[]){
Thread thread = new Thread(new MyThread());
thread.start();
}
} -
marlkiller说:
new Thread 是线程还是携程?
new Thread 是线程
-
marlkiller说:
如果 new Thread 是线程, 那么如何使用 Java 实现携程呢?
Java 并没有提供原生的携程支持,但是可以使用第三方库来实现,比如Quasar框架。Quasar通过使用Java语言支持携程,使用@Co-routine注解可以实现携程。以下是一个简单的例子:
import co.paralleluniverse.fibers.Suspendable;
public class MyCoRoutine {
@Suspendable
public void run() {
System.out.println("Co-routine Started!");
// Do something here
System.out.println("Co-routine Ended!");
}
}