大二下学期团队项目(用户收藏浏览)
今日主要完成了用户收藏浏览的功能:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>个人中心</title> <link rel="stylesheet" type="text/css" href="../static/css/iconfont.css" /> <link rel="stylesheet" type="text/css" href="../static/css/style.css" /> </head> <script src="../static/js/jquery-1.7.2.min.js"></script> <body> <div class="header"> <div class="bar"> <div class="w1200"> <span class="l">树懒电影<font>个人中心</font></span> <span class="r"><a href="http://localhost:8080/MovieTop/templates/login.html?_ijt=vg63h452m3c4eakcipm91kf2jq"><i class="icon iconfont icon-dianyuan"></i>退出</a></span> </div> </div> <div class="user-info"> <div class="w1200"> <div class="user-headface"> <img src="../static/img/userpic.jpg"/> </div> <div class="user-account"> <div class="user-account"> <p class="tip">你好,{{ userdata[3]}}</p> </div> </div> <div class="user-modify"> <a href="http://localhost:63342/MovieTop/templates/revise.html?_ijt=7un76ve0cq6gedopm6vvsf6vmq">修改资料></a> </div> </div> </div> </div> <div class="main w1200"> <div class="left"> <ul> <li> <a href="#" class="active"> <i class="icon iconfont icon-lingdang"></i> 收藏 </a> </li> <li> <a href="#"> <i class="icon iconfont icon-fangzidichan"></i> 消息 </a> </li> <li> <a href="#"> <i class="icon iconfont icon-wenda"></i> 问答 </a> </li> <li> <a href="#"> <i class="icon iconfont icon-pinglun"></i> 评论 </a> </li> <li> <a href="#"> <i class="icon iconfont icon-geren"></i> 个人资料 </a> </li> </ul> </div> <div class="right"> <div class="tap"> <input id="btn1" type="button" value="在看" onclick=" btn_1()"> <input id="btn2" type="button" value="想看" onclick="btn_2()"> <input id="btn3" type="button" value="看过" onclick="btn_3()"> </div> <div class="container" style=" height:400px;overflow:scroll"> <div class="no-doc"> </div> </div> </div> </div> </body> </html> <script> function btn_1(){ var btn1 = document.getElementById("btn1") var btn2 = document.getElementById("btn2") var btn3 = document.getElementById("btn3") btn1.style.background="#1a682b" btn2.style.background="#6abb5c" btn3.style.background="#6abb5c" $.ajax({ url: "/web_like_query", data: { usertype:"在看" }, success: function (data) { if(data.data==""){ $(".no-doc").empty() appendUlBody='<img src="../static/img/no_doc.jpg"/> <p>空空如也~</p>'; $(".no-doc").append(appendUlBody); }else{ $(".no-doc").empty(); for (var i = 0; i < data.data.length; i++) { a="/movie_page?"+"title="+data.data[i][1]+"&scorenum="+data.data[i][3]; appendUlBody ='<div style="float:left; clear:right; width:220px">'+ '<img src="'+data.data[i][4]+'" height="240px" width="140px" />'+ '<p> <a href="'+a+'" style="text-decoration:none;" target="_blank"><h2>'+data.data[i][1]+'</h2></a>'+ '<h3>'+data.data[i][5]+'分</h3> </p></div>' $(".no-doc").append(appendUlBody); } } }, error: function (xhr, type, errorThrown) { } }) } function btn_2(){ var btn1 = document.getElementById("btn1") var btn2 = document.getElementById("btn2") var btn3 = document.getElementById("btn3") btn2.style.background="#1a682b" btn1.style.background="#6abb5c" btn3.style.background="#6abb5c" $.ajax({ url: "/web_like_query", data: { usertype:"想看" }, success: function (data) { if(data.data==""){ $(".no-doc").empty() appendUlBody='<img src="../static/img/no_doc.jpg"/> <p>空空如也~</p>'; $(".no-doc").append(appendUlBody); }else{ $(".no-doc").empty(); for (var i = 0; i < data.data.length; i++) { a="/movie_page?"+"title="+data.data[i][1]+"&scorenum="+data.data[i][3]; appendUlBody ='<div style="float:left; clear:right; width:220px">'+ '<img src="'+data.data[i][4]+'" height="240px" width="140px" />'+ '<p> <a href="'+a+'" style="text-decoration:none;" target="_blank"><h2>'+data.data[i][1]+'</h2></a>'+ '<h3>'+data.data[i][5]+'分</h3> </p></div>' $(".no-doc").append(appendUlBody); } } }, error: function (xhr, type, errorThrown) { } }) } function btn_3(){ var btn1 = document.getElementById("btn1") var btn2 = document.getElementById("btn2") var btn3 = document.getElementById("btn3") btn3.style.background="#1a682b" btn2.style.background="#6abb5c" btn1.style.background="#6abb5c" $.ajax({ url: "/web_like_query", data: { usertype:"看过" }, success: function (data) { if(data.data==""){ $(".no-doc").empty() appendUlBody='<img src="../static/img/no_doc.jpg"/> <p>空空如也~</p>'; $(".no-doc").append(appendUlBody); }else{ $(".no-doc").empty(); for (var i = 0; i < data.data.length; i++) { a="/movie_page?"+"title="+data.data[i][1]+"&scorenum="+data.data[i][3]; appendUlBody ='<div style="float:left; clear:right; width:220px">'+ '<img src="'+data.data[i][4]+'" height="240px" width="140px" />'+ '<p> <a href="'+a+'" style="text-decoration:none;" target="_blank"><h2>'+data.data[i][1]+'</h2></a>'+ '<h3>'+data.data[i][5]+'分</h3> </p></div>' $(".no-doc").append(appendUlBody); } } }, error: function (xhr, type, errorThrown) { } }) } </script>
#用户(web)收藏查询 @app.route('/web_like_query') def web_like_query(): # userphone=session['userphone'] usertype=request.values.get("usertype") userphone=session['userphone'] data = sql.android_like_query(userphone, usertype) return jsonify({"data": data})