匿名提问箱
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
4.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  6. <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
  7. <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
  8. <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
  9. <script src="https://cdn.bootcdn.net/ajax/libs/jquery-timeago/1.6.7/jquery.timeago.min.js"></script>
  10. <script src="https://cdn.bootcdn.net/ajax/libs/jquery-timeago/1.6.7/locales/jquery.timeago.zh-CN.js"></script>
  11. <title>欢迎向我提问!- {{disp}}的提问箱</title>
  12. <style>
  13. .qbox {
  14. background:#e8e8e8;
  15. padding:5px;
  16. color:black;
  17. box-shadow: 2px 2px 10px 2px rgb(219 219 220);
  18. border-radius: .5rem;
  19. margin: 25px 0;
  20. }
  21. pre {
  22. margin: 15px 0 0 15px;
  23. }
  24. .timeago {
  25. font-size: 0.5em;
  26. text-align: right;
  27. }
  28. .display_name {
  29. margin: 0;
  30. }
  31. .card-body {
  32. padding: 0.75em;
  33. }
  34. </style>
  35. </head>
  36. <body style="background-color: #001a37;color:#e8e8e8">
  37. <div style="max-width:700px;" class="container">
  38. <div style="background-color:rgba(230,230,250,0.5);margin-bottom:80px">
  39. <div align='center' style='background-color:rgba(180,180,250,0.5);padding:10px;color:#ffffff;'>
  40. <div style="margin:20px">
  41. <span style='color:#555555;margin:0 10px;'> 闭社匿名提问箱</span>
  42. <a type="button" class="btn btn-dark btn-sm" href="/askMe">我也要创建</a>
  43. </div>
  44. <h1 align='center'><a href={{url}}>{{disp}}</a>的提问箱</h1>
  45. <div style="text-align:left; margin-bottom:10px;height:30px" id="acct-info">
  46. <a href="{{url}}"><img src="{{avat}}" width="96"><span></span></a>
  47. <span>{{acct}}</span>
  48. </div>
  49. </div>
  50. </div>
  51. <form action="new" method="post">
  52. <div class="form-group qbox">
  53. <label>向 {{disp}} 匿名提问</label>
  54. <textarea class="form-control" id="question" name="question" rows="5" maxlength="400" placeholder="在此处写下你想问的" required="required"></textarea>
  55. <button type="submit" class="btn btn-primary">发送提问</button>
  56. </div>
  57. </form>
  58. <hr/>
  59. <h3>对 {{disp}} 的提问({{qs|length}})</h3>
  60. {% for q in qs|reverse %}
  61. <div class="qbox">
  62. <pre>{{q.content}}</pre>
  63. <div style="text-align:right">
  64. <time class="timeago" datetime="{{q.time}}"></time>
  65. <a class="btn btn-link request-answer" data-toggle="collapse" href="#collapse-{{q.toot}}" role="button" aria-expanded="false" aria-controls="collapse-{{q.toot}}">
  66. 查看回复
  67. <span><svg fill="#007bff" viewBox="0 0 24 24" width="24" height="24" ><path d="M12 13L8.285 9.218a.758.758 0 0 0-1.064 0 .738.738 0 0 0 0 1.052l4.249 4.512a.758.758 0 0 0 1.064 0l4.246-4.512a.738.738 0 0 0 0-1.052.757.757 0 0 0-1.063 0L12.002 13z" style="animation: downn 1.5s infinite;" "=""></path></svg></span>
  68. </a>
  69. </div>
  70. <div class="collapse" id="collapse-{{q.toot}}">
  71. <div class="card card-body">
  72. (暂无回复)
  73. </div>
  74. </div>
  75. </div>
  76. {% endfor %}
  77. <script>
  78. $('.timeago').timeago();
  79. $('.collapse').on('show.bs.collapse', (e) => {
  80. let self = e.target;
  81. let toot = self.id.split('-')[1];
  82. $.ajax({
  83. type:'GET',
  84. url:toot,
  85. success:(result,status,xhr) => {
  86. console.log(result+' : '+status);
  87. if(result.replies.length) {
  88. $(self).empty();
  89. result.replies.forEach((rp) => {
  90. $(self).append(`<div class="card card-body"><p class="display_name"><a href="${rp.url}">${rp.disp}</a>:</p><pre>${rp.content}</pre><time class="timeago" datetime="${rp.time}"></time></div>`)
  91. });
  92. console.log($(self).find('.timeago'));
  93. $(self).find('.timeago').timeago();
  94. }
  95. },
  96. error:(xhr,status,error) => {
  97. console.log(error+' : '+status);
  98. }
  99. });
  100. });
  101. </script>
  102. </div>
  103. </body>
  104. </html>