0%

Axios 异步框架简介

Axios 对原生的 AJAX 进行封装,简化书写

Axios 快速入门

  1. 引入 axios 的 js 文件
  2. 使用 axios 发送请求,并获取相应结果

详细步骤如下

一、在 webapp 下新建 js 文件夹,拷贝 axios 的 js 文件
二、新建 html 文件,引入 js 文件

1
<script src="js/axios-0.18.0.js"></script>

三、创建 AxiosServlet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class AxiosServlet extends HttpServlet {  
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("get...");
//1.接收请求参数
String username = request.getParameter("username");
System.out.println(username);
//2.响应数据
response.getWriter().write("hello Axios");
}

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("post...");
this.doGet(request, response);
}
}

四、在 html 中编写 js 代码

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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>

<script src="js/axios-0.18.0.js"></script>

<script>
//1.get
/* axios({
method:"get",
url:"http://localhost:8080/ajax-dmeo/axiosServlet?username=zhangsan"
}).then(function (resp){
alert(resp.data);
})*/

//2.post
axios({
method: "get",
url: "http://localhost:8080/ajax-dmeo/axiosServlet",
//data是请求参数
data: "username=zhangsan"
}).then(function (resp) {
alert(resp.data);
})


</script>

</body>
</html>

代码说明及注意事项

  1. axios 大括号中的为 Java 中的对象
  2. .then() 方法是一个回调函数,如果响应接收到了的话就自动执行
  3. data: "username=zhangsan",data 是请求参数。这里可以传 JSON 格式的数据。除此之外,还可以传 JS 对象类型的数据(JSON 数据格式可以和 Java 中的对象数据格式通过某些方式进行转换),因为 Axios 框架会自动将这个 JS 对象转为 JSON 的数据格式
  4. Get 和 Post 两种方式传递参数的方式不一样,所以在 axios 方法中传入的对象(大括号包裹的内容)的方式不一样,一个写在 URL 中,一个写在 Data 属性中
  5. .then() 回调函数中,function 函数中的参数名可以不为 resp,随便一个都行,保持下面对象(resp.data)和这个参数名(resp)一致即可
  6. resp.data 即服务器端的 Servlet 响应过来的数据
1
2
3
4
5
6
7
8
9
10
11
flowchart RL
b1-->|"username = &quot;zhangsan&quot;"|servlet1
servlet1-->|data|b1
    subgraph Browsers
    b1
    b2
    end
    subgraph servers
    servlet1
    servlet2
    end

简单来说,Axios 实现的功能就是:通过 get 或 post 给 Servlet 传递一个参数(username=“zhangsan”),然后 Servlet 接收到这个参数,就可以进行判断的操作,根据判断的结果在给浏览器发送一个响应。浏览器收到响应数据(date)之后,就可以做出一些操作,比如弹出窗口操作。

Axios 请求方式别名

为了方便起见,Axios 已经为所有支持的请求方法提供了别名

发送 Get 请求

1
2
3
4
//1. Get方式  
axios.get("http://localhost:8080/ajax-dmeo/axiosServlet?username=zhangsan").then(function (resp){
alert(resp.data);
})

发送 Post 请求

1
2
3
axios.post("http://localhost:8080/ajax-dmeo/axiosServlet?username=zhangsan","username=zhangsan").then(function (resp){  
alert(resp.data);
})

原生的 Axios 书写方式 VS 别名的简化书写方式

  • 原生的书写格式:阅读性较好
  • 别名的方式:代码量少,基本上只需要填写必要的参数信息

bib 参考文献

1、使用 % 可添加注释

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
% 旧文献
@article{latunussa2016analysis,
title={Analysis of material recovery from silicon photovoltaic panels},
author={LATUNUSSA, Cynthia and MANCINI, Lucia and BLENGINI, Giovanni and ARDENTE, Fulvio and PENNINGTON, David and others},
year={2016}
}

% 添加的新文献
@article{latunussa2016analysis,
number = {LB-NA-27797-EN-N},
address = {Luxembourg (Luxembourg)},
issn = {1831-9424},
year = {2016},
author = {LATUNUSSA, Cynthia and MANCINI, Lucia and BLENGINI, Giovanni and ARDENTE, Fulvio and PENNINGTON, David and others},
isbn = {978-92-79-57277-7},
publisher = {Publications Office of the European Union},
title = {Analysis of material recovery from silicon photovoltaic panels}
}

2、若使用本地 TeX Studio 进行编译,若参考文献信息不完整,编译时会有提示,可根据这些提示对参考文献信息进行手动补全

1
2
3
4
5
6
7
8
9
10
11
12
13
14
You're missing a field part---line 77 of file cas-refs.bib
: number =
: ,
I'm skipping whatever remains of this entry
Repeated entry---line 153 of file cas-refs.bib
: @techreport{weckend2016end
: ,
I'm skipping whatever remains of this entry
Repeated entry---line 275 of file cas-refs.bib
: @article{li2022green
: ,
I'm skipping whatever remains of this entry
Warning--empty journal in latunussa2016analysis
(There were 3 error messages)

引用图片

  • 同一期刊,对这种格式还是比较宽松的,例如 Fig.4 a) and b) 以及 Fig.4 (b) 都是可以的
  • 大部分包含子图的图片在插入图片前已经提前组好(子图 a、b、c 这种序号也是手动添加的),而不是利用 LaTeX 命令将多张子图组成一张大图(虽然方便引用子图,但是实现子图的整齐排列过于困难)

image.png

image.png

特殊符号

参考:latex 排版服务,如何输入商标 R 符号,TM 符号,版权 c 符号

专有名词对照表

如果借助 GPT 这样的工具进行翻译,将这些专有名词塞给 GPT,GPT 会根据上下文进行翻译,可以很大程度上减少专有名词的翻译错误

1
2
3
4
5
6
7
8
9
10
11
下层EVA 请翻译为 back EVA;上层EVA 请翻译为 front EVA;背面金属化 请翻译为 back metallization;电池请翻译为 cell
背板 请翻译为:backsheet;有价部分请翻译为:Valuable components;有机物部分请翻译为:Organic components
上层封装材料 请翻译为:front encapsulation;下层封装材料请翻译为:back encapsulation
铝背电极:Aluminum Back Electrode
铝硅共晶层:Eutectic layer、Al-Si eutectic
铝掺杂p+层: Al-p+-layer、BSF
剩余的铝颗粒层:alumina paste layer

统一将 rear metallization layer —> back metallization
统一将 silicon cells —> solar cell;solar cell silicon wafer —> solar cell
统一将 upper —> front

Word2LaTeX

例如 Word 中的 符号,换成 LaTeX 之后,可以批量替换为 $\tccentigrade$,最好是对这些批量替换操作做一个记录

1
2
3
4
5
6
7
8
9
10
11
12
℃ —> $\tccentigrade$ 
× —> $\times$
± —> $\pm$
-145 —> $-$
µ —> \textmu
KAl(OH)4 —> $KAl(OH)_4$
(Tedlar®/PET/Tedlar®) —> $^\circledR$ 或者 $^{\textregistered}$ 或者 Tedlar/PET/Tedlar
90° —> 90^\circ
Figure —> 引用
Fig —> 引用
Fig.\ref —> Cref
\Cref{fig:1}(a)

参考资料

快捷键

插件

优秀教程

输出结果

可以使用 Overleaf 在线编译(XeLaTeX),也可以本地编译

Revision_Letter_页面_1.jpg

Revision_Letter_页面_2.jpg

目录结构

1
2
3
4
5
│  Revision Letter.tex
│ setting.tex
└──figs
Fig1.png
Fig2.png

image.png

setting.tex

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
\usepackage{amsfonts}%
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{latexsym,amsmath,amsfonts}
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{ifmtarg}% http://ctan.org/pkg/ifmtarg
\usepackage{xifthen}% http://ctan.org/pkg/xifthen
\usepackage{environ}% http://ctan.org/pkg/environ
\usepackage{multido}% http://ctan.org/pkg/multido
\usepackage{lipsum,ctex}% http://ctan.org/pkg/lipsum


%\usepackage[displaymath]{lineno}
\usepackage[backref]{hyperref}
\linespread{1}
%\usepackage{showkeys}

%\usepackage{times}
\allowdisplaybreaks
%\date{\today}
\date{\today}
\newcommand{\red}{\color{red} } %红色字体
\def\ft{\frac d{dt}}
\def\pt{\partial_{t}}
\def\r{\mathbb{R}^2}
\def\no{\nonumber}
\def\eps{\epsilon}
\textwidth 150mm
\textheight 220mm
\voffset -25mm \hoffset -15mm\topmargin1.4 cm
\renewcommand{\baselinestretch}{1.235}

\makeatletter%
\newcommand{\commenthang}{% top comment decoration
\begingroup%
\setlength{\unitlength}{.005\linewidth}% \linewidth/200
\begin{picture}(0,0)(1.5,0)%
\linethickness{0.45pt} \color{blue!50}%
\put(-3,2){\line(1,0){206}}% Top line
\multido{\iA=2+-1,\iB=50+-10}{5}{% Top hangs
\color{blue!\iB}%
\put(-3,\iA){\line(0,-1){1}}% Top left hang
\put(203,\iA){\line(0,-1){1}}% Top right hang
}%
\end{picture}%
\endgroup%
}%
\newcommand{\commenthung}{% bottom comment decoration
\nobreak
\begingroup%
\setlength{\unitlength}{.005\linewidth}% \linewidth/200
\begin{picture}(0.0,0)(1.5,0)%
\linethickness{0.45pt} \color{blue!50}%
\put(-3,0){\line(1,0){206}}% Bottom line
\multido{\iA=0+1,\iB=50+-10}{5}{% Bottom hangs
\color{blue!\iB}%
\put(-3,\iA){\line(0,1){1}}% Bottom left hang
\put(203,\iA){\line(0,1){1}}% Bottom right hang
}%
\end{picture}%
\endgroup%
}%

\newcounter{comment}
\renewcommand{\thecomment}{\arabic{comment}}
\NewEnviron{comment}[1][]{%
\par\noindent\commenthang\par\nobreak\noindent%\addvspace{-.5ex}
\refstepcounter{comment}\postdisplaypenalty=10000 %
{\sffamily\bfseries\upshape Comment \thecomment\@ifnotmtarg{#1}{\ (#1)}}\ \ \ignorespaces%
\BODY % Typeset comment body/content
\par\addvspace{-1ex}\nobreak\noindent\commenthung\par\addvspace{.4ex}%
}
\makeatother

Revision Letter.tex

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
51
52
53
54
55
56
57
58
59
\documentclass[reqno,12pt]{amsart}
\input{setting}
\usepackage{graphicx}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{pifont}
\usepackage{zhlipsum}

\begin{document}

\begin{center}
\textbf{\Large Response to Reviewers}
\end{center}
\vspace{2ex}

\begin{flushleft}
尊敬的审稿专家和编辑老师:
\end{flushleft}

您们好!非常感谢您们提出的评审意见,您们的所有建议都非常的重要,它们对我的论文写作和科研工作都具有重要的指导意义,这些中肯的意见是对我莫大的鼓励与支持。在下文中,我们将解释如何在修订中充分考虑到您们的意见。

\begin{comment}
此类综述较多(尤其以外文为主),如何明确该文的特色、创新,仍需作者在引言部分明确论述;

\vspace{1ex}
\noindent{\bf Response \thecomment} 非常感谢专家提出的建议。我们已在引言部分重新修正和完善了这一部分内容, \textcolor{red}{修正后的内容如下}:

\zhlipsum[1]

再次感谢专家老师的宝贵意见。
\end{comment}

\begin{comment}
此类综述较多(尤其以外文为主),如何明确该文的特色、创新,仍需作者在引言部分明确论述;

\vspace{1ex}
\noindent{\bf Response \thecomment} 非常感谢专家提出的建议。我们已在引言部分重新修正和完善了这一部分内容, \textcolor{red}{修正后的内容如下}:

\zhlipsum[1]

再次感谢专家老师的宝贵意见。
\end{comment}

最后感谢审稿专家在百忙之中对论文提出的中肯建议,使论文质量得到提高。同时也感谢编辑老师辛苦的工作。

愿各位工作顺利,身体健康!

此致!

\noindent{敬礼!}

\vspace{2ex}
\begin{flushright}
全体作者

2022年9月23日
\end{flushright}

\end{document}

Anki 插件

简要说明

在该插件开发出来之前,需要通过 CSV/TXT 文件进行导入,过程比较繁琐,并且 CSV 文件在保存时通常不能保存所有数据 —> 该插件极大简化了流程

实现了通过电子表格来维护牌组数据,因为电子表格中的数据是原始数据,Anki 牌组中的数据只是副本 —> 在表格中添加新数据再导入到 Anki 时,可以选择原来表格中的旧数据是否覆盖(更新旧数据),并顺利将新添加的数据导入 Anki

示例

第一行:字段名
第二行:设置格式,包括 text, html, markdown 三种格式

image.png

处理程序

Windows - PDF Software: Open, Read & Edit PDFs | FineReader PDF

操作步骤

1、使用 Abbyy 打开 PDF 文件

20231021211516.png

2、按压左键拉动一个方框包含要复制的表格

3、点击第三个按钮,复制表格

4、识别成功后的变化

image.png

5、可以直接复制到 Excel 当中

image.png

对于中文字体和字号什么可能会有问题,可以全选,然后统一字体和字号

参考资料

催稿信

Dear Editor,

I write concerning the progress of our paper. It was initially submitted on May 13, 2023 and was assigned the manuscript number: xxxx. Now I am worrying about whether it still works normally because the submission has been kept “Under Review” for about two months, as showed on editorial manager. Would you mind checking on the progress of it for me? Your reply would be highly appreciated.

Thanks very much for your attention to our paper.

Best Regards.

Yours sincerely,
xxxx

修订稿催稿信

Dear Editor,

I apologize for the inconvenience. I am a graduating master’s student with the intention of pursuing a Ph.D. However, I am concerned about this, as I require another accepted or published paper to strengthen my Ph.D. application. Regarding my revised manuscript with the manuscript number xx-xxxx, which was submitted on xxxx-xx-xx, it is still under review. Could you kindly expedite the review process for my manuscript? I sincerely appreciate your assistance in this matter.

I look forward to hearing from you soon.

Best Regards,
xxxx

在线编译

使用 Overleaf, Online LaTeX Editor 平台

  • 假设原版本是 Manuscript.tex
  • 新建一个文件 Manuscript-Revised-Cleancopy.tex,并拷贝 Manuscript.tex 中的所有内容,在这个新建的文件上进行修改,编写修订后的终稿
  • 新建一个文件叫做 Manuscript-Diff-Withtrack.tex, 内容如下:
1
2
3
4
\RequirePackage{shellesc}
\ShellEscape{latexdiff Manuscript.tex Manuscript-Revised-Cleancopy.tex > Manuscript-Diff-Withtrack.tex}
\input{Manuscript-Diff-Withtrack}
\documentclass{dummy}
  • 如需生成旧版本,打开 Manuscript.tex 后点击 Recompile
  • 如需生成新版本,打开 Manuscript-Revised-Cleancopy.tex 后点击 Recompile
  • 如需生成变化追踪的版本,打开 Manuscript-Diff-Withtrack.tex 后点击 Recompile

参考资料:投了一篇 sci,返回意见是大修,没有经验,请问如何操作? - 知乎

本地编译

初稿 LaTeX,并且已经写好 LaTeX 的终稿 —> 导入 Online LaTeX diff tool 中生成带有修订的 LaTeX 稿件 —> 使用本地 LaTeX 编译器进行编译生成 PDF

Online LaTeX diff tool

在线工具: Online LaTeX diff tool

  • 输入:两个版本的 LaTeX 原稿文件
  • 输出:带有修订标记的单个 LaTeX 源文件
  • 参考示例:

image.png