github.com/jincm/wesharechain@v0.0.0-20210122032815-1537409ce26a/app/html/youni/youni_jiaoyu.html (about) 1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="copyright" content="www.apicloud.com" /> 6 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/> 7 <title>附近动态</title> 8 <link rel="stylesheet" type="text/css" href="../../css/api.css" /> 9 <link rel="stylesheet" type="text/css" href="../../css/idangerous.swiper.css"> 10 <style> 11 html,body {min-height: 100%;} 12 .fr {float: right;} 13 .fl {float: left;} 14 .mt5 {margin-top: 5px;} 15 .mt10 {margin-top: 10px;} 16 .mt15 {margin-top: 15px;} 17 .mt20 {margin-top: 20px;} 18 .ml5 {margin-left: 0.5em;} 19 .mr5 {margin-right: 0.5em;} 20 .hdivider {width: 100%; height: 1px;background-color: #e0e0e0;} 21 22 .row {display: -webkit-box;display: -webkit-flex;} 23 .col {-webkit-box-flex:1; -webkit-flex:1; flex:1;margin: 0 5px; position: relative;} 24 25 .swiper-container img {width: 100%;} 26 27 /* 标题 */ 28 .sectionTitle {height: 2em; line-height: 2em; font-size: 1.12em;} 29 .sectionTitle .titleDivider {display: inline-block; height: 1.12em; width: 3px; vertical-align: top; background-color: #D43C33; margin-top: 0.44em; margin-left: 0.7em; margin-right: 0.3em;} 30 /* */ 31 .col .listcoverbar {position: absolute; top: 0; background-color: rgba(0,0,0,0.4); width: 100%;height: 1.2em;} 32 .col .listcoverbar span {color: #fff;} 33 .col .listcoverbar .earphone {width: 1em; margin-top: 0.2em; margin-right: 0.3em;} 34 .col .listcover {width: 100%;} 35 .col .listtitle {height: 2.4em; font-size: 1em; line-height: 1.2em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;} 36 37 /* item样式 */ 38 .egret-item {height: 4em;} 39 .egret-item .egret-item-box-cover-center {display: table; height: inherit;} 40 .egret-item .egret-item-box-cover-center .egret-item-box-abtc {display: table-cell; vertical-align: middle;} 41 .egret-item .egret-item-box-cover-center .egret-item-box-abtc img {width: 3em; vertical-align: top;} 42 /* 右侧箭头样式 */ 43 .egret-item .egret-item-arrow {display: table; height: inherit;} 44 .egret-item .egret-item-arrow .egret-item-box-abtc {display: table-cell; vertical-align: middle;} 45 .egret-item .egret-item-arrow .egret-item-box-abtc img {width: 0.8em; vertical-align: top;} 46 /* 中间shelf 两个条目*/ 47 .egret-item .egret-item-shelf {height: inherit; } 48 .egret-item .egret-item-shelf .egret-item-shelf-title {font-size: 1.1em; margin-top: 0.6em;} 49 .egret-item .egret-item-shelf .egret-item-shelf-subtitle {font-size: 0.6em; color: #666; margin-top: 0.6em;} 50 /* 中间shelf 一个条目 */ 51 .egret-item .egret-item-shelf-single {height: inherit; line-height: 4em;font-size: 1.1em;} 52 .egret-item .egret-item-shelf-redclassify {color: #E03F40; border:1px solid #E03F40; font-size: inherit;padding: 0.1em;border-radius: 1px;margin-right: 5px;} 53 54 55 /* 用flex重写框架 */ 56 .egret-flex-item {display: -webkit-box;-webkit-box-align:center;height: 4em;} 57 /* 左部logo */ 58 .egret-flex-item-logo {max-width: 50px; min-width: 50px; margin-left: 0.5em; margin-right: 0.2em;-webkit-box-flex: 1; -webkit-box-align: center;} 59 .egret-flex-item-logo img {height: 3em; width: 3em; -webkit-box-align: center;vertical-align: top;/*否则图片不会居中,底部仍然是会有空白*/} 60 /* 中间文本信息 */ 61 .egret-flex-item-shelf {overflow: hidden; -webkit-box-flex:2; -webkit-box-align: center;} 62 .egret-flex-item-shelf div {text-overflow: ellipsis; white-space: nowrap; overflow: hidden;} 63 .egret-flex-item-shelf .egret-flex-item-shelf01 {font-size: 1.1em;} 64 .egret-flex-item-shelf .egret-flex-item-shelf02 {font-size: 0.6em; color: #666; margin-top: 0.6em;} 65 .egret-flex-item-shelf .egret-flex-item-redclassify {color: #E03F40; border: 1px solid #E03F40; font-size: inherit; padding: 0 0.1em; border-radius: 1px; margin-right: 5px;box-sizing: border-box;} 66 67 /* 右部箭头 */ 68 .egret-flex-item-arrow {-webkit-box-flex: 1;max-width: 10px; min-width: 10px; margin-right: 5px;} 69 .egret-flex-item-arrow img {width: 100%; max-width: 10px;} 70 71 72 /* 关注card */ 73 .sharecard {display: -webkit-box;margin-left: 10px;margin-right: 10px;margin-top: 10px;padding: 10px 10px 15px 10px;border: 1px solid #e0e0e0;background-color: #fff;} 74 .sharecard .userlogo {margin-right: 10px;} 75 .sharecard .userlogo img {width: 40px;vertical-align: top;border-radius: 20px;} 76 .sharecard .rightcol {-webkit-box-flex: 1;} 77 .sharecard .rightcol .usertitle {font-size: 0.9em; color: #666;} 78 .sharecard .rightcol .usertitle .username{font-size: 1em; color: #507DAF; margin-right: 5px;} 79 .sharecard .rightcol .usertitle .sharetime{float: right; font-size: 0.6em; color: #999;} 80 .sharecard .rightcol .sharecontent {font-size: 1em; line-height: 1.3em;padding-top: 5px;} 81 .sharecard .rightcol .sharemusic{display: -webkit-box;margin-top: 15px;border: 1px solid #e0e0e0;-webkit-box-align: center;} 82 .sharecard .rightcol .sharemusic .musiclogo {padding: 5px;} 83 .sharecard .rightcol .sharemusic .musiclogo img {vertical-align: top;width: 60px;} 84 .sharecard .rightcol .sharemusic .musictitle {} 85 .sharecard .rightcol .sharemusic .musictitle .title02 {font-size: 0.8em;color: #666;margin-top: 10px;} 86 .sharetool {display: -webkit-box; height: 30px; line-height: 30px; margin: 0 10px 10px 10px;border: 1px solid #e0e0e0; border-top: 0;background-color: #fff;} 87 .sharetool .tool {-webkit-box-flex:1;text-align: center;} 88 .sharetool .tool span {font-size: 0.8em; color: #666;} 89 .sharetool .tool img {width: 16px;vertical-align: top;padding: 7px;} 90 91 /* 悬浮 */ 92 .fmbtnhover {background: #D8D9DA ;} 93 .fmbtnhoverinside {background: #D8D9DA ;} 94 95 </style> 96 </head> 97 98 <body> 99 100 101 <!--D:\srccode\zuohaoshi\client\demo\wangyimusic20141207\html\third_frame\frame0301.html--> 102 103 <div class="sectionTitle mt20" id="data_div"></div> 104 105 <script id="mytmpl" type="text/x-dot-template"> 106 {{ if(it && it.length > 0){ }} 107 {{ for(var i=0;i<it.length;i++){ }} 108 {{ if(it[i].postid){ }} 109 <div class="sharecard" tapmode="fmbtnhover" onclick="openDetail('near','update',{{=it[i].postid}})"> 110 {{ }else{ }} 111 <div class="sharecard" tapmode="fmbtnhover" onclick="openDetail('near','update','1111111111')"> 112 {{ } }} 113 <div class="userlogo"><img src="../../image/test/frame0103cover02.jpg" alt=""></div> 114 <div class="rightcol"> 115 <div class="usertitle"> 116 {{ if(it[i].name){ }} 117 <span class="username">{{=it[i].name}}</span>24 学生<span class="sharetime">昨天17:23</span> 118 {{ }else{ }} 119 <span class="username">路人甲</span>24 学生<span class="sharetime">昨天17:23</span> 120 {{ } }} 121 </div> 122 {{ if(it[i].content){ }} 123 <p class="sharecontent">{{=it[i].content}}</p> 124 {{ }else{ }} 125 <p class="sharecontent">三十年来寻剑客,几回落叶又抽枝。 自从一见桃花后,直至如今更不疑。沩山览偈,诘其所悟,与之符契。嘱曰:从缘悟达,永无退失,善自护持。</p> 126 {{ } }} 127 128 {{ if(it[i].postid){ }} 129 <div class="sharemusic" tapmode="fmbtnhoverinside" onclick="openDetailImg('near','update',{{=it[i].postid}})"> 130 {{ }else{ }} 131 <div class="sharemusic" tapmode="fmbtnhoverinside" onclick="openDetailImg('near','update','1111111')"> 132 {{ } }} 133 <div class="musiclogo"><img src="../../image/test/frame0103cover02.jpg" alt=""></div> 134 <div class="musiclogo"><img src="../../image/test/frame0103cover03.jpg" alt=""></div> 135 <div class="musiclogo"><img src="../../image/test/frame0103cover04.jpg" alt=""></div> 136 <div class="musiclogo"><img src="../../image/test/frame0103cover05.jpg" alt=""></div> 137 138 <!--<div class="musictitle"> 139 <div class="title01">「December」</div> 140 <div class="title02"> 有你有我</div> 141 </div> --> 142 </div> 143 </div> 144 </div> 145 146 {{ if(it[i].postid){ }} 147 <div class="sharetool" tapmode="fmbtnhoverinside" onclick="doComment('near','update',{{=it[i].postid}})"> 148 {{ }else{ }} 149 <div class="sharetool" tapmode="fmbtnhoverinside" onclick="doComment('near','update','1111111')"> 150 {{ } }} 151 152 <div class="tool01 tool"><img src="../../image/near/read.png" alt=""><span class="tool01num">175</span></div> 153 <div class="tool02 tool"><img src="../../image/near/zan.jpg" alt=""><span class="tool02num">199</span></div> 154 <div class="tool03 tool"><img src="../../image/near/faq.png" alt=""><span class="tool03num">198</span></div> 155 </div> 156 {{ } }} 157 158 {{ }else{ }} 159 <li>没有数据</li> 160 {{ } }} 161 </script> 162 163 164 165 166 <script type="text/javascript" src="../../script/api.js"></script> 167 <script type="text/javascript" src="../../script/idangerous.swiper.js"></script> 168 <script type="text/javascript" src="../../script/doT.min.js" charset="utf-8"></script> 169 <script type="text/javascript" src="../../script/app.js"></script> 170 171 <script type="text/javascript" charset="utf-8"> 172 173 function openDetail(grouptype,type,did) { 174 winName = grouptype + "_" + type + "_detail" 175 winUrl = winName + "_win.html" 176 api.openWin({ 177 name: winName, 178 url: winUrl, 179 pageParam: {dataId: did} 180 }); 181 } 182 183 function openDetailImg(grouptype,type,did) { 184 alert("应该弹出来个图片"); 185 } 186 187 function doComment(grouptype,type,did) { 188 alert("应该评论或赞++"); 189 } 190 191 192 var headerPos; 193 194 window.onload = function() { 195 } 196 197 apiready = function () { 198 console.log("come setFrameGroupIndex:win name:" + api.winName + " framename:" + api.frameName); 199 200 var pageSize=10; // 页容量 201 var totalData=0; // 定义一个变量存储第一次加载返回来的总记录数 202 var totalPages=0; // 定义一个变量存储第一次加载返回来的总页数 203 var tmp_html = ""; 204 $api.setStorage("currentPage", 1); // 默认设置为第一页 205 206 // 加载数据 207 // @currentPage:当前页码 208 // @isReload:是否为刷新操作 209 function loadData(currentPage,isReload){ 210 currentPage=isReload?1:currentPage; 211 212 user_id = $api.getStorage("user_id"); 213 //token = $api.getStorage("token"); 214 url = "/u/" + "/users/search?loc_x=116&loc_y=40" + "&limit=" + pageSize + "&offset=" + currentPage; 215 myajax(url,'GET','', function(ret,err){ 216 if (ret) { 217 //totalData=ret.totalCount; 218 //totalPages=ret.totalPages; 219 //var data=ret.data; 220 /* 221 { 222 pageSize:10, // 页码 223 currentPage:1, // 当前页 224 totalCount:100, // 总记录数 225 totalPages:10, // 总页数 226 data:[ // 当前页查询的记录 227 {id:1,name:'新生帝',age:22}, 228 {id:2,name:'流浪男',age:28} 229 ] 230 } 231 */ 232 totalData = 10; 233 totalPages = 8; 234 if(isReload){ 235 $api.setStorage("currentPage", 1); // 重新设置为1 236 tmp_html = ""; 237 } 238 239 // 渲染HTML 240 //get data from server 241 var obj = [ {"name":"test" + currentPage + "_1","content":"this is test1 education"}, 242 {"name":"test" + currentPage + "_2","content":"this is test2 education"}, 243 {"name":"test" + currentPage + "_3","content":"this is test3 education"}, 244 {"name":"test" + currentPage + "_4","content":"this is test4 education"} ]; 245 246 var data_div = $api.byId('data_div'); 247 var tpl = $api.byId('mytmpl').text; 248 var tempFn = doT.template(tpl); 249 data_div.innerHTML = tmp_html + tempFn(obj); //current html + cache html 250 tmp_html += tempFn(obj); 251 }else { 252 api.alert({ 253 msg:('错误码:'+err.code+';错误信息:'+err.msg+';网络状态码:'+err.statusCode) 254 }); 255 } 256 }); 257 } 258 259 // 结合下拉刷新 260 api.setRefreshHeaderInfo({ 261 visible: true, 262 loadingImg: 'widget://image/near/refresh.png', 263 bgColor: '#ccc', 264 textColor: '#fff', 265 textDown: '下拉刷新...', 266 textUp: '松开刷新...', 267 showTime: true 268 }, function(ret, err){ 269 270 loadData(1,true); // 第一次加载 271 api.refreshHeaderLoadDone(); 272 }); 273 274 // 默认第一次打开页面就下拉加载数据 275 api.refreshHeaderLoading(); 276 277 278 // 结合上拉刷新: 279 api.addEventListener({ 280 name:'scrolltobottom', 281 extra:{ 282 threshold:0 //设置距离底部多少距离时触发,默认值为0,数字类型 283 } 284 },function(ret,err){ 285 var _page=parseInt($api.getStorage("currentPage")); 286 if(_page+1<=totalPages){ 287 loadData(_page+1,false); 288 $api.setStorage("currentPage", _page+1); // 页码+1 289 } 290 else{ 291 alert("没有更多数据了!"); 292 } 293 }); 294 295 } 296 </script> 297 </html>