当前位置:网站首页>Brief steps to build a website / application using flash and H5
Brief steps to build a website / application using flash and H5
2022-04-23 08:50:00 【7frog7】
stay Portal On the basis of , Make some changes 、 Added some functions .
I wanted to try my whole stack to build a website long ago It can be regarded as complementing some knowledge .
Briefly describe the process of developing pages .
Used mdui
1. Plan the page first
At first, I wanted to find accept Related icons But found accessible It's more interesting to use
The topic list can be realized by adding code to a specific module Very interesting
like this
document.getElementById('plists').innerHTML += "<a href='/group?id="+String(i+(pro_id-1)*15)+"' class='mdui-list-item mdui-ripple mdui-col-offset-md-2'><i class='mdui-icon mdui-list-item-icon material-icons'>accessible</i><div class='mdui-list-item-content'>"+String(i+(pro_id-1)*15)+' '+ptitle+"</div></li>";
2. Write routing
Pictured above is an example Need to write at least 2 Routes
a. The routing of the web page itself
@app.route("/contestlist")
def contestlist():
return send_from_directory(root,'grouplist.htm')
b. The route of the method of obtaining information from the page
@app.route("/contests",methods=['POST'])
def contests():
data=json.loads(request.get_data(as_text=True))
page=int(data['page'])
return contest_file('html/problem/groups',page)
def contest_file(file_dir,page):
problems={
"id":"href"}
start_id=(page-1)*15+1000
end_id=page*15+1000-1
for i in range(start_id,end_id):
try:
f=read_file_as_str('html/problem/groups/'+str(i)+'.json')
f = f.replace('\'','\"')
data=json.loads(f)
problems[str(i)]=data['name']
except:
problems[str(i)]='NotFound'
return json.dumps(problems)
3. Connect the function function of the front and rear end methods
such as post A request Then write the received information to the web page
<script> if (pro_id === undefined){
pro_id = [1]; } var httpRequest = new XMLHttpRequest();// First step : Create the objects you need httpRequest.open('POST', '/contests', true); // The second step : Open the connection httpRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");// Set request header notes :post Method must set request header ( Set the request header after the connection is established ) var data={
'page':pro_id[0]}; httpRequest.send(JSON.stringify(data)); httpRequest.onreadystatechange = function () {
// Callback interface after request , Write the program to be executed after the request is successful if (httpRequest.readyState == 4 && httpRequest.status == 200) {
// Verify that the request was sent successfully var json = httpRequest.responseText;// Get the data returned by the server var info = JSON.parse(json); var page=pro_id; var start_id=(page-1)*15+1000; var end_id=page*15+1000-1; console.log(info); for(var i=start_id;i<end_id;i++){
var ptitle=info[(i)]; if(ptitle=='NotFound'){
continue; } document.getElementById('plists').innerHTML += "<a href='/group?id="+String(i+(pro_id-1)*15)+"' class='mdui-list-item mdui-ripple mdui-col-offset-md-2'><i class='mdui-icon mdui-list-item-icon material-icons'>accessible</i><div class='mdui-list-item-content'>"+String(i+(pro_id-1)*15)+' '+ptitle+"</div></li>"; } } }; </script>
4. Adjust the layout debug
版权声明
本文为[7frog7]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230825344214.html
边栏推荐
- 关于堆的判断 (25 分) 两种插入方式
- BK3633 规格书
- 1099 建立二叉搜索树 (30 分)
- Learn SQL injection in sqli liabs (Level 11 ~ level 20)
- Share the office and improve the settled experience
- cadence的工艺角仿真、蒙特卡洛仿真、PSRR
- Consensus Token:web3. 0 super entrance of ecological flow
- 共享办公室,提升入驻体验
- Single chip microcomputer nixie tube stopwatch
- Study notes of deep learning (8)
猜你喜欢
MATLAB入门资料
Consensus Token:web3.0生态流量的超级入口
2022-04-22 openebs cloud native storage
After a circle, I sorted out this set of interview questions..
【58】最后一个单词的长度【LeetCode】
Notes on 30 steps of introduction to Internet of things of yangtao electronics STM32 III. Explanation of new cubeide project and setting
Introduction to GUI programming swing
Star Trek强势来袭 开启元宇宙虚拟与现实的梦幻联动
Virtual online exhibition - Online VR exhibition hall realizes 24h immersive exhibition viewing
GUI编程简介 swing
随机推荐
2021 Li Hongyi's adaptive learning rate of machine learning
根据字节码获取类的绝对路径
Cadence process angle simulation, Monte Carlo simulation, PSRR
Learn SQL injection in sqli liabs (Level 11 ~ level 20)
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
L2-022 rearrange linked list (25 points) (map + structure simulation)
Stm32f103zet6 [development of standard library functions] - Introduction to library functions
LeetCode_DFS_中等_1254. 统计封闭岛屿的数目
匿名類型(C# 指南 基礎知識)
汇编语言与逆向工程 栈溢出漏洞逆向分析实验报告
企业微信应用授权/静默登录
Go语言自学系列 | golang结构体指针
Valgrind and kcache grind use run analysis
STM32 uses Hal library. The overall structure and function principle are introduced
请问中衍期货安全靠谱吗?
cadence的工艺角仿真、蒙特卡洛仿真、PSRR
PCTP考试经验分享
Technological innovation in government affairs in the construction of Digital Government
idea打包 jar文件
Notes on 30 steps of introduction to the Internet of things of yangtao electronics STM32 III. cubemx graphical programming and setting the IO port on the development board