当前位置:网站首页>InfoQ 极客传媒 15 周年庆征文|移动端开发之动态排行【MUI+Flask+MongoDB】
InfoQ 极客传媒 15 周年庆征文|移动端开发之动态排行【MUI+Flask+MongoDB】
2022-06-11 13:05:00 【InfoQ】
一,前言

二,数据库的积分排序
find=db.mongo.find({}).sort([("jifeng", -1)])

2,1,bug发现
Object of type ObjectId is not JSON serializable
2.2,bug解决

return json.dumps(append,cls=JSONEncoder)
三,前端处理

function(data) {
console.log("从服务端返回数据,准备判断");
pass=data;
for (var i in pass){
}
3,1 特殊地方

四,附代码
<script type="text/javascript">
mui.init();
var pass;
mui.post('http://xxxxxx:xxxxx/paiming', {
}, function(data) {
console.log("从服务端返回数据,准备判断");
//console.log(JSON.stringify(data));
pass=data;
}, 'json');
setTimeout(function() {
var div = document.createElement("div");
div.className = "tab-panel-item tab-active";
document.querySelector(".tab-panel").appendChild(div);
// console.log(pass[1]['name']);
for (var i in pass){
console.log(i);
var div1 = document.createElement("div");
div1.className = "aui-flex b-line"+ i;
document.querySelector(".tab-active").appendChild(div1);
if(i==0)
{
var div2 = document.createElement("div");
div2.className = "aui-ranking-text one";
document.querySelector(".b-line"+i).appendChild(div2);
//<em>1</em>
var em = document.createElement("em");
em.innerHTML="1";
document.querySelector(".one").appendChild(em);
}
if(i==1)
{
var div21 = document.createElement("div");
div21.className = "aui-ranking-text two";
document.querySelector(".b-line"+i).appendChild(div21);
//<em>1</em>
var em = document.createElement("em");
em.innerHTML="2";
document.querySelector(".two").appendChild(em);
}
if(i==2)
{
var div22 = document.createElement("div");
div22.className = "aui-ranking-text three";
document.querySelector(".b-line"+i).appendChild(div22);
//<em>1</em>
var em = document.createElement("em");
em.innerHTML="3";
document.querySelector(".three").appendChild(em);
}
if(i>2)
{
var j=Number(i)+1;
// <div class="aui-ranking-text">
// <em>4</em>
// </div>
var div224 = document.createElement("div");
div224.className = "aui-ranking-text";
div224.innerHTML="<em>"+j+"</em>"
document.querySelector(".b-line"+i).appendChild(div224);
//<em>1</em>
// var em = document.createElement("em");
// em.innerHTML=i+1;
//document.querySelector("px"+i).appendChild(em);
}
//img占位
var divimg = document.createElement("div");
divimg.className = "aui-ranking-img";
document.querySelector(".b-line"+i).appendChild(divimg);
var name1 = document.createElement("div");
name1.className = "aui-ranking-name aui-flex-box";
name1.innerHTML="<h2>"+pass[i]['name']+"<h2>"+"<p>"+pass[i]['username']+"<p>"
document.querySelector(".b-line"+i).appendChild(name1);
// <div class="aui-ranking-num">50000</div>
var jifneg = document.createElement("div");
jifneg.className = "aui-ranking-num";
jifneg.innerHTML=pass[i]['jifeng']
document.querySelector(".b-line"+i).appendChild(jifneg);
var name2 = document.createElement("div");
name2.className = "aui-ranking-icon";
document.querySelector(".b-line"+i).appendChild(name2);
}
//前123特殊
}, 500);
边栏推荐
- Which brand of bone conduction Bluetooth headset is good? Five most popular bone conduction Bluetooth headsets
- 【backtrader源码解析46】cerebro.py代码注释(枯燥,backtrader核心代码之一,推荐阅读,注释仅供参考)
- 不谈赛道,不聊风口,开源数据库巨头Cassandra如何在国内讲好“新故事” | C位面对面
- @How to resolve controller and requestmapping
- Quel projecteur 4K est le meilleur rapport qualité - prix, quand bex3 pro met en évidence 128g Storage 618 vaut la peine de voir
- [filter] design of time-varying Wiener filter based on MATLAB [including Matlab source code 1870]
- Imx6ul development board porting EMMC startup process of mainline u-boot
- 看不懂Kotlin源码?从Contracts 函数说起~
- How about Lenovo Xiaoxin 520? Which is more worth buying than dangbei D3x?
- qq内拉起支付宝h5支付功能
猜你喜欢

Tawang food industry insight | China's dairy market analysis, competition pattern, development trend and thinking

微软再曝“丑闻”:在办公室看 VR 黄片,“HoloLens 之父”即将离职!

NFT市场怎么样 为什么NFT能如此火爆 怎么搭建NFT平台

历史上的今天:Apple II 问世;微软收购 GECAD;发明“软件工程”一词的科技先驱出生...

Mctalk's entrepreneurial voice - erudition and discernment: be interested in socializing, and provide a "small and beautiful" space for old friends before and after retirement

Does it affect children to wear Bluetooth headsets? How to protect children's ear health

Gb28181 protocol has become the mainstream in the market. How to choose the appropriate security monitoring video solution?

苹果将造搜索引擎?

详解C语言实参与形参的区别

【滤波器】基于matlab时变维纳滤波器设计【含Matlab源码 1870期】
随机推荐
【backtrader源码解析46】cerebro.py代码注释(枯燥,backtrader核心代码之一,推荐阅读,注释仅供参考)
【增加功能】select下拉多选 显示选中的人员
What problems should be paid attention to in running health preserving physiotherapy center?
Deep learning and CV tutorial (14) | image segmentation (FCN, segnet, u-net, pspnet, deeplab, refinenet)
QQ pulls up Alipay H5 payment function
关于uni-app 配置 APP 不显示顶部标题栏设置
五年官司终败诉,万亿爬虫大军蠢蠢欲动
微软再曝“丑闻”:在办公室看 VR 黄片,“HoloLens 之父”即将离职!
[clearos] install the clearos system
What are the advantages of comprehensive venues?
从QUIC到TCP
如何学会花钱
Go 如何减少供应链攻击?
On the continuing Life of Distributed Locks - - Distributed Locks Based on redis
Adobe Premiere foundation - batch material import sequence - variable speed and rewind (recall) - continuous action shot switching - subtitle requirements (13)
深度学习与CV教程(14) | 图像分割 (FCN,SegNet,U-Net,PSPNet,DeepLab,RefineNet)
live share使用体验
. 4 literal and variable
[acwing 11. solution number of knapsack problem] 01 knapsack + 01 knapsack + understand the specific meaning of 01 knapsack
Condition debug of pycharm