QRcode1.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  9. <link rel="stylesheet" href="../../css/apiToast.css">
  10. <link rel="stylesheet" href="../../css/projeck.css">
  11. <style>
  12. html,body{
  13. background: #fff;
  14. }
  15. .api_layout{
  16. width: 100%;
  17. position: relative;
  18. }
  19. .record_list li{
  20. padding: 12px 15px;
  21. position: relative;
  22. }
  23. .record_list li:after{
  24. content: '';
  25. width: 100%;
  26. display: block;
  27. position: absolute;
  28. bottom: 0;
  29. left: 0;
  30. height: 1px;
  31. background: #e6e7e8;
  32. }
  33. .record_header{
  34. width: 52px;
  35. height: 52px;
  36. -webkit-border-radius: 50%;
  37. -moz-border-radius: 50%;
  38. border-radius: 50%;
  39. margin-right: 7px;
  40. border: 1px solid #ECF0F1;
  41. }
  42. .personal_info{
  43. display: flex;
  44. justify-content: flex-start;
  45. flex-wrap: nowrap;
  46. display: -webkit-flex;
  47. -webkit-justify-content: flex-start;
  48. -webkit-flex-wrap: nowrap;
  49. align-items: center;
  50. position: relative;
  51. }
  52. .personal_info span{
  53. display: block;
  54. font-size: 15px;
  55. color: #000;
  56. }
  57. .personal_info span:first-child{
  58. font-weight: bold;
  59. }
  60. .personal_info span:last-child{
  61. color: #69707f;
  62. }
  63. .more_recode{
  64. width: 32px;
  65. height: 23px;
  66. -webkit-box-sizing: border-box;
  67. -moz-box-sizing: border-box;
  68. box-sizing: border-box;
  69. display: block;
  70. background: url("../../image/moreRecord.png") no-repeat;
  71. background-size: cover;
  72. position: absolute;
  73. top: 0;
  74. right: 8px;
  75. }
  76. .text_content{
  77. margin-top: 15px;
  78. color: #000;
  79. font-size: 15px;
  80. }
  81. .rows{
  82. display: flex;
  83. /*justify-content: space-around;*/
  84. flex-wrap: wrap;
  85. align-items: flex-start;
  86. margin-top: 10px;
  87. }
  88. .column{
  89. /*width: 100%;*/
  90. margin-bottom: 10px;
  91. }
  92. .column img{
  93. width: 100%;
  94. height: 100%;
  95. object-fit: cover;
  96. -webkit-border-radius: 10px;
  97. -moz-border-radius: 10px;
  98. border-radius: 10px;
  99. margin: auto;
  100. border: 1px solid #f2f2f2;
  101. }
  102. .date_record{
  103. color: #999;
  104. font-size: 15px;
  105. }
  106. .Unread{
  107. width: 40px;
  108. height: 32px;
  109. display: block;
  110. position: absolute;
  111. top: 0;
  112. right: 0;
  113. background: url("../../image/unread.png") no-repeat;
  114. background-size: cover;
  115. }
  116. .nread{
  117. width: 40px;
  118. height: 32px;
  119. display: block;
  120. position: absolute;
  121. top: 0;
  122. right: 0;
  123. background: url("../../image/nread.png") no-repeat;
  124. background-size: cover;
  125. }
  126. .footers{
  127. display: flex;
  128. display: -webkit-flex;
  129. justify-content: space-between;
  130. -webkit-justify-content: space-between;
  131. white-space: nowrap;
  132. align-items: center;
  133. -webkit-align-items: center;
  134. padding: 10px 0;
  135. }
  136. .thumbs{
  137. width: 15px;
  138. height: 15px;
  139. background: url("../../icon/momentHeart.png") no-repeat;
  140. -webkit-background-size: contain;
  141. background-size: contain;
  142. background-position: center;
  143. }
  144. .comment{
  145. width: 15px;
  146. height: 15px;
  147. background: url("../../icon/momentComment.png") no-repeat;
  148. -webkit-background-size: contain;
  149. background-size: contain;
  150. background-position: center;
  151. }
  152. .thumbsAndcomment{
  153. display: flex;
  154. display: -webkit-flex;
  155. justify-content:flex-start;
  156. -webkit-justify-content: flex-start;
  157. white-space: nowrap;
  158. align-items: center;
  159. -webkit-align-items: center;
  160. }
  161. .thumbsAndcomment span{
  162. position: relative;
  163. top: 0;
  164. margin-left: 5px;
  165. color: #3a4553;
  166. font-size: 12px;
  167. }
  168. /*.thumbs_num img{*/
  169. /*width: 30px;*/
  170. /*height: 30px;*/
  171. /*-webkit-border-radius: 50%;*/
  172. /*-moz-border-radius: 50%;*/
  173. /*border-radius: 50%;*/
  174. /*border: 1px solid #ccc;*/
  175. /*}*/
  176. .thumbs_num{
  177. background: #f3f3f3;
  178. padding: 5px 0;
  179. display: none;
  180. padding-right: 5px;
  181. position: relative;
  182. }
  183. .thumbs_num:after{
  184. content: '';
  185. display: block;
  186. position: absolute;
  187. bottom: 0;
  188. left: 0;
  189. height: 1px;
  190. width: 100%;
  191. background: rgba(226,226,228,.4);
  192. }
  193. .thumbs_num p{
  194. color: #6d6f96;
  195. font-size: 13px;
  196. }
  197. .thumbs-s{
  198. margin-right: 50px;
  199. }
  200. .taox{
  201. width: 15px;
  202. height: 15px;
  203. background: url("../../icon/taox.png") no-repeat;
  204. -webkit-background-size: contain;
  205. background-size: contain;
  206. background-position: center;
  207. margin: 0 5px;
  208. }
  209. .comment_content p{
  210. background: #f3f3f3;
  211. }
  212. .comment_c{
  213. font-size: 13px;
  214. padding: 5px;
  215. }
  216. .title{
  217. color: #6d6f96;
  218. }
  219. </style>
  220. </head>
  221. <body>
  222. <div class="api_layout">
  223. <div class="recode_warp">
  224. <ul class="record_list" id="record_lists">
  225. <!-- <li>
  226. <div>
  227. <div class="personal_info">
  228. <img src="" onerror=javascript:this.src="http://jiewei-icon.oss-cn-beijing.aliyuncs.com/icon/default-avatar.png" class="record_header">
  229. <p>
  230. <span>张三</span>
  231. <span>信息监测中心</span>
  232. </p>
  233. </div>
  234. <p class="text_content">今天天气很好,我很开心。。。</p>
  235. <i class=" {{=it[i].readFlag == true?'nread' : 'Unread'}}"></i>
  236. </div>
  237. <div class="footers">
  238. <span class="date_record">2019-10-29</span>
  239. <div class="thumbsAndcomment">
  240. <div class="flex-start thumbs-s" onclick="dianzan(this)" flat="false">
  241. <i class="thumbs"></i>
  242. <span class="zan">赞</span>
  243. </div>
  244. <div class="flex-start" onclick="comment(this)">
  245. <i class="comment"></i>
  246. <span>评论</span>
  247. </div>
  248. </div>
  249. </div>
  250. <div class="thumbs_num">
  251. <div class="flex-start">
  252. <i class="taox"></i>
  253. <p class="names"></p>
  254. </div>
  255. </div>
  256. <div class="comment_content">
  257. <p class="comment_c">
  258. <span class="title">王五:</span>
  259. 送骄傲手机哦怕就送手机哦怕手机哦送骄傲手机哦怕就送手机哦怕手机哦
  260. </p>
  261. </div>
  262. </li> -->
  263. </ul>
  264. </div>
  265. </div>
  266. <div class="Nonews" id="nocode"></div>
  267. </body>
  268. </html>
  269. <script type="text/template" id="templateRecord">
  270. {{ for (var i = 0;i<it.length;i++) { }}
  271. <li>
  272. <div onclick="RecordDetaile('{{=it[i].recordId}},{{=it[i].departmentId}},{{=it[i].id}}')">
  273. <div class="personal_info">
  274. <img src="{{=urlphp}}storage/avatar/avatar_{{=it[i].createId}}.png" onerror=javascript:this.src="http://jiewei-icon.oss-cn-beijing.aliyuncs.com/icon/default-avatar.png" class="record_header">
  275. <p>
  276. <span>{{=it[i].createName}}</span>
  277. <span>{{=it[i].uesrOrganizationName}}</span>
  278. </p>
  279. </div>
  280. <p class="text_content">{{=it[i].dataContent}}</p>
  281. <div class="row{{=it[i].id}} rows">
  282. {{if (it[i].dataImages != "") { }}
  283. {{ for (var j=0;j<it[i].dataImages.length;j++) { }}
  284. {{if(j<=8) { }}
  285. <div class="column">
  286. <img src="{{=it[i].dataImages[j]}}" alt="">
  287. </div>
  288. {{ } }}
  289. {{ } }}
  290. {{ } }}
  291. </div>
  292. <i class=" {{=it[i].readFlag == true?'nread' : 'Unread'}}"></i>
  293. </div>
  294. <div class="footers">
  295. <span class="date_record">{{=it[i].createDate}}</span>
  296. <div class="thumbsAndcomment">
  297. <div class="flex-start thumbs-s" id="thumbsid{{=it[i].id}}" onclick="dianzan(this,'{{=it[i].id}}')" flat="{{=it[i].staffflag}}">
  298. <i class="thumbs" style="background:url({{=it[i].staffflag==true?'../../icon/momentHeart_like.png':'../../icon/momentHeart.png'}}) no-repeat;background-size: contain;background-position: center;"></i>
  299. <span class="zan">赞</span>
  300. </div>
  301. <div class="flex-start" onclick="comment(this,'{{=it[i].id}}')">
  302. <i class="comment"></i>
  303. <span>评论</span>
  304. </div>
  305. </div>
  306. </div>
  307. <div class="thumbs_num" style="display:{{=it[i].staffLIkes.length == 0?'none':'block'}}">
  308. <div class="flex-start">
  309. <i class="taox"></i>
  310. <p class="names">
  311. {{? it[i].staffLIkes.length > 0}}
  312. {{ for(var d = 0;d<it[i].staffLIkes.length;d++) { }}
  313. {{? d === 0}}
  314. <span class="{{=it[i].staffLIkes[d].staffNum == uuid?'true':''}}">{{=it[i].staffLIkes[d].name}}</span>
  315. {{??}}
  316. <span class="{{=it[i].staffLIkes[d].staffNum == uuid?'true':''}}">,{{=it[i].staffLIkes[d].name}}</span>
  317. {{?}}
  318. {{ } }}
  319. {{?}}
  320. </p>
  321. </div>
  322. </div>
  323. <div class="comment_content">
  324. {{? it[i].staffCommentVos.length > 0}}
  325. {{ for(var s = 0;s<it[i].staffCommentVos.length;s++) { }}
  326. <p class="comment_c" onclick=deleteComment(this,'{{=it[i].staffCommentVos[s].id}}','{{=it[i].staffCommentVos[s].staffNum}}')>
  327. <span class="title">{{=it[i].staffCommentVos[s].name}}:</span>
  328. {{=it[i].staffCommentVos[s].content}}
  329. </p>
  330. {{ } }}
  331. {{?}}
  332. </div>
  333. </li>
  334. {{ } }}
  335. </script>
  336. <script type="text/javascript" src="../../script/api.js"></script>
  337. <script type="text/javascript" src="../../script/doT.min.js"></script>
  338. <script src="../../script/zepto.js" charset="utf-8"></script>
  339. <script src="../../script/config.js" charset="utf-8"></script>
  340. <script type="text/javascript">
  341. // kkk();
  342. var isLoadding = false,uuid="";
  343. var apiToast = new apiToast();
  344. var skip = 1;
  345. var depIDs = '';
  346. var headers = "",name = "";
  347. apiready = function () {
  348. $api.fixStatusBar($api.dom('header'));
  349. depIDs = api.pageParam.depIDs;
  350. var info = $api.getStorage('data'),
  351. token = JSON.parse(info).data.access_token,
  352. user = JSON.parse(info).data.user;
  353. uuid = JSON.parse(info).data.user.staff_num;
  354. name = JSON.parse(info).data.user.name;
  355. recordItmes(uuid,depIDs,false);
  356. // 上拉加载
  357. api.addEventListener({
  358. name : 'scrolltobottom',
  359. extra : {
  360. threshold : 0 //设置距离底部多少距离时触发,默认值为0,数字类型
  361. }
  362. }, function(ret, err) {
  363. if (!isLoadding ) {
  364. isLoadding = true;
  365. recordItmes(uuid,depIDs,true);
  366. }
  367. });
  368. // header
  369. headers = {
  370. "Authorization": "Bearer " + token
  371. }
  372. };
  373. // 数据
  374. function recordItmes(useruuid,depID,isLoadMore){
  375. var filter = {
  376. "departmentId" : depID,
  377. 'userId':useruuid,
  378. "pageNumber" : skip,
  379. "pageSize" :10
  380. };
  381. $http.fnReuestDataNoW(UrlRouter.getRecordDynamicApi,'','get',filter,function (ret,err) {
  382. isLoadding = false;
  383. apiToast.hide();
  384. if (ret.data.length == 0 && skip == 1) {
  385. document.getElementById("nocode").style.display = 'block';
  386. return false;
  387. }else {
  388. document.getElementById("nocode").style.display = 'none';
  389. }
  390. if (ret) {
  391. if (ret.data.length > 0) {
  392. skip += 1;
  393. $apis.append(record_lists,'#templateRecord',ret.data);
  394. for (var i = 0; i < ret.data.length; i++) {
  395. flexImage(ret.data[i].id)
  396. }
  397. } else {
  398. isLoadding =true;
  399. api.toast({
  400. msg: '没有更多数据',
  401. duration: 2000,
  402. location: 'bottom'
  403. });
  404. }
  405. } else {
  406. apiToast.hide();
  407. api.toast({
  408. msg: '加载超时,请检查网络',
  409. duration: 2000,
  410. location: 'bottom'
  411. });
  412. }
  413. });
  414. };
  415. // function photoTailoringFun(value,i) {
  416. // var imageBrowser = api.require('imageBrowser');
  417. // imageBrowser.openImages({
  418. // imageUrls: value.split(','),
  419. // activeIndex:i,
  420. // showList:false
  421. // });
  422. // }
  423. function RecordDetaile(recordId) {
  424. var idArray = recordId.split(',');
  425. $event.openWin('recordDetaile','recordDetaile',{recordParentId:idArray[0],departmentIds:idArray[1],id:idArray[2]},'');
  426. }
  427. function flexImage(j) {
  428. var length = document.querySelectorAll('.row'+j+' .column').length,
  429. column = document.querySelectorAll('.row'+j+' .column');
  430. imgs = document.querySelectorAll('.row'+j+' .column img');
  431. if (length == 1) {
  432. column[0].style.width = api.winWidth-30 + 'px';
  433. column[0].style.height = (api.winWidth-30) +'px'
  434. }else if (length == 2) {
  435. for (var i = 0; i < column.length; i++) {
  436. column[i].style.width = (api.winWidth-30) / 2 +'px'
  437. column[i].style.height = (api.winWidth-30-20) / 2 +'px'
  438. column[i].getElementsByTagName('img')[0].style.width= (api.winWidth-50) / 2 +'px'
  439. }
  440. }else {
  441. for (var i = 0; i < column.length; i++) {
  442. column[i].style.width = (api.winWidth-30) / 3 +'px'
  443. column[i].style.height = (api.winWidth-30-20) / 3 +'px'
  444. column[i].getElementsByTagName('img')[0].style.width=(api.winWidth-50) / 3 +'px'
  445. }
  446. }
  447. };
  448. // 点赞
  449. function dianzan(el,id,type) {
  450. var gray ='../../icon/momentHeart.png',red = '../../icon/momentHeart_like.png';
  451. var thumbs_num = $(el).parent().parent().parent().find('.thumbs_num');
  452. var str = "";
  453. if ($(el).attr('flat') === "false"){
  454. $(el).attr('flat','true');
  455. $(el).find('.thumbs').css("backgroundImage",'url('+red+')');
  456. if (thumbs_num.find('p').html().replace(/\s+/g,"") === ""){
  457. thumbsPost(id,type)
  458. str =`<span class="true">${name}</span>`;
  459. $(thumbs_num).css('display','block');
  460. $(thumbs_num.find('p')).append(str)
  461. }else {
  462. thumbsPost(id,type)
  463. $(thumbs_num).css('display','block');
  464. str =`<span class="true">,${name}</span>`;
  465. $(thumbs_num.find('p')).append(str);
  466. }
  467. } else {
  468. thumbsPost(id,type)
  469. var thumbs_numTrue = $(el).parent().parent().parent().find('.thumbs_num').find('p').find('.true');
  470. var index = $(el).parent().parent().parent().find('.thumbs_num p>span').length;
  471. index === 1?$(thumbs_num).css('display','none'):"";
  472. $(el).attr('flat','false');
  473. $(el).find('.thumbs').css("backgroundImage",'url('+gray+')');
  474. $(thumbs_numTrue).remove();
  475. }
  476. }
  477. // 评论
  478. function comment(el,id,type) {
  479. var inputField = api.require('inputField');
  480. inputField.open({
  481. bgColor: '#f5f5f5',
  482. lineColor: '#ccc',
  483. fileBgColor: '#fff',
  484. borderColor: '#ccc',
  485. autoFocus:true,
  486. placeholder:'评论',
  487. sendBtn:{
  488. bg: '#86c3f7', //字符串类型;发送按钮常态背景色
  489. inputBg:'#009fe8', //(可选项)字符串类型;当输入文字发时送按钮的背景色;默认:bg的色值
  490. bgHighlight: '#009fe8', //字符串类型;发送按钮点击时的高亮背景色
  491. title: '发送', //字符串类型;发送按钮的标题
  492. titleSize: 14, //数字类型;发送按钮的标题字体大小
  493. titleColor: '#fff', //字符串类型;发送按钮标题文字颜色
  494. corner: 5, //数字类型;发送按钮圆角大小
  495. sendW:60, //数字类型;发送按钮的宽
  496. sendH:30, //数字类型;发送按钮的高
  497. marginRight:10,
  498. },
  499. placeholderStyles:{
  500. color: '#ccc', //字符串类型;占位文字颜色,支持rgb、rgba、#;默认:#696969
  501. size: 14, //数字类型;占位文字大小;默认:13
  502. marginL: 10
  503. },
  504. fixedOn: api.frameName
  505. }, function(ret, err) {
  506. if (ret) {
  507. commentFun(el,id,type,ret.msg)
  508. inputField.close();
  509. }
  510. });
  511. addEventWindow();// 监听关闭input
  512. }
  513. // 监听点击空白处关闭input
  514. function addEventWindow() {
  515. var inputField = api.require('inputField');
  516. inputField.setInputFieldListener(function(ret, err) {
  517. if (ret) {
  518. if (ret.chatViewH === 0) {
  519. var inputField = api.require('inputField');
  520. inputField.close();
  521. }
  522. }
  523. });
  524. }
  525. // 删除评论
  526. function deleteComment(el,ids,jobNum) {
  527. if (jobNum != uuid) return false;
  528. api.actionSheet({
  529. cancelTitle: '取消',
  530. destructiveTitle: '删除',
  531. }, function(ret, err) {
  532. if (ret.buttonIndex === 1) {
  533. $http.fnReuestDataNologing(UrlRouter.delComment,headers,'post',{id:ids},function (ret,err) {
  534. if (ret.code === 0) {
  535. $(el).remove();
  536. }
  537. })
  538. }
  539. });
  540. }
  541. // 点赞接口
  542. function thumbsPost(ids,types) {
  543. var data ={
  544. id:ids,
  545. type:'record'
  546. }
  547. $http.fnReuestDataNologing(UrlRouter.thumbs,headers,'post',data,function (ret,err) {
  548. // console.log(JSON.stringify(ret));
  549. });
  550. }
  551. // 评论接口
  552. function commentFun(el,ids,type,msg) {
  553. var data = {
  554. id:ids,
  555. type:'record',
  556. content:msg
  557. }
  558. $http.fnReuestDataNologing(UrlRouter.comment,headers,'post',data,function (ret,err) {
  559. if (ret.code === 0) {
  560. var comment = $(el).parent().parent().parent().find('.comment_content')
  561. var html = `<p class="comment_c" onclick=deleteComment(this,${ret.data.id},${ret.data.staff_num})>
  562. <span class="title">${name}:</span>
  563. ${ret.data.content}
  564. </p>`;
  565. $(comment).append(html);
  566. }
  567. });
  568. }
  569. </script>