record.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>面试题</title>
  7. <link rel="stylesheet" href="css/index.css">
  8. <script src="js/axios.min.js"></script>
  9. <script src="js/vue.js"></script>
  10. </head>
  11. <style>
  12. .record li{
  13. width: 95%;
  14. line-height: 30px;
  15. border-bottom: 1px solid #d9d9d9;
  16. padding-bottom: 20px;
  17. margin-top: 20px;
  18. }
  19. .record li span{
  20. color: #999;
  21. font-size: 12px;
  22. }
  23. </style>
  24. <body>
  25. <section id="app">
  26. <header>
  27. <div class="left_nav">
  28. <img @click="show=!show" class="phone" width="30" src="img/menu.png" alt="">
  29. <img class="logo" src="img/logo.png" alt="logo">
  30. </div>
  31. <div class="nav">
  32. <a class="act" href="/index.html">主页</a>
  33. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  34. <a href="https://match.yuanrenxue.cn/" target="_blank">采集进阶课程</a>
  35. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  36. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  37. <a href="https://www.yuanrenxue.cn/" target="_blank">关于猿人学</a>
  38. </div>
  39. <div class="login">
  40. <div class="pc">
  41. <!-- <img width="30px" src="img/logo.jpg" alt="logo"> -->
  42. <div v-if="userInfo" class="menu">
  43. {{userInfo.name}}
  44. <ul>
  45. <li><a href="/record.html">我的刷题记录</a></li>
  46. <li @click="logout"><a>退出登录</a></li>
  47. </ul>
  48. </div>
  49. <a v-else href="/login.html">请先登录</a>
  50. </div>
  51. <div class="phone">
  52. <span v-if="userInfo">{{userInfo.name}}</span>
  53. <a v-else href="/login.html">请先登录</a>
  54. </div>
  55. </div>
  56. </header>
  57. <transition name="slide">
  58. <div class="slide" v-if="show">
  59. <a class="act" href="/index.html">主页</a>
  60. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  61. <a href="https://match.yuanrenxue.cn/" target="_blank">采集进阶课程</a>
  62. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  63. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  64. <a href="https://www.yuanrenxue.cn/" target="_blank">关于猿人学</a>
  65. <a v-if="userInfo" href="/record.html">我的刷题记录</a>
  66. <a v-if="userInfo" @click="logout">退出登录</a>
  67. </div>
  68. </transition>
  69. <div class="content">
  70. <p class="navtation"><a href="/index.html">首页</a> - 刷题记录</p>
  71. <div class="left" style="min-height: 68vh;">
  72. <div class="part">
  73. <p><b style="font-size: 15px;">{{userInfo.name}}</b>的面试刷题</p>
  74. <ul class="list record">
  75. <li v-for="(item,i) in list"><a :href="'/detail.html?cat='+item.category+'&id='+item.interviewId">
  76. {{i+1}}.{{item.name}} <br>
  77. <span>{{item.ctime}}</span>
  78. </a></li>
  79. </ul>
  80. <p class="page" v-show="pages>0">
  81. <button :disabled="parm.page==1?'disabled':false" @click="parm.page--,getData()">上一页</button>
  82. <span><b>{{parm.page}}</b>/{{pages}}</span>
  83. <button :disabled="parm.page==pages?'disabled':false" @click="parm.page++,getData()">下一页</button>
  84. </p>
  85. </div>
  86. </div>
  87. <div class="right">
  88. <div class="part">
  89. <h2 class="sec_title"><span>贡献面试题</span></h2>
  90. <form class="form">
  91. <input v-model="name" type="text" placeholder="面试题目">
  92. <textarea v-model="content"></textarea>
  93. <button type="button" @click="post">提交</button>
  94. </form>
  95. </div>
  96. </div>
  97. </div>
  98. <footer>
  99. <ul>
  100. <li>
  101. <b>爬虫比赛</b> <br>
  102. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  103. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  104. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  105. </li>
  106. <li>
  107. <b>爬虫课程</b> <br>
  108. <a href="https://shop45147253.m.youzan.com/wscgoods/detail/2okabph85ypv1?banner_id=f.86209928~goods.2~1~rVebiaQ5&alg_id=0&slg=0&components_style_layout=0&reft=1744878857227&spm=f.86209928&sf=wx_sm" target="_blank">爬虫逆向进阶课</a>
  109. <a href="https://shop45147253.m.youzan.com/wscgoods/detail/2xli2kj7ku3a5zk?banner_id=f.86209928~goods.2~2~lWrtebiJ&alg_id=0&slg=0&components_style_layout=0&reft=1744878880491&spm=f.86209928&sf=wx_sm" target="_blank">反爬&风控对抗课</a>
  110. <a href="https://shop45147253.m.youzan.com/wscgoods/detail/361rmliyhfwr184?banner_id=f.86209928~goods.2~3~25r4gDL2&alg_id=0&slg=0&components_style_layout=0&reft=1744878921640&spm=f.86209928&sf=wx_sm" target="_blank">0基础+爬虫逆向课</a>
  111. </li>
  112. <li>
  113. <b>关于猿人学</b> <br>
  114. <a href="https://www.yuanrenxue.cn/tricks" target="_blank">Python技术杂谈</a>
  115. <a href="https://www.yuanrenxue.cn/earn-money" target="_blank">Python爬虫挣钱</a>
  116. </li>
  117. <li class="contact" style="display: flex;line-height: 30px;">
  118. <img style="margin-right: 10px;" width="100" height="100" src="img/wx.jpg" alt="">
  119. 扫一扫加我微信 <br>
  120. 备注面试题 <br>
  121. 拉你进面试交流群
  122. </li>
  123. </ul>
  124. <p>成都老猿智能科技有限公司Copyright @ 2025 猿人学面试 蜀ICP备2022000052号-2</p>
  125. </footer>
  126. </section>
  127. <script src="js/public.js"></script>
  128. <script>
  129. const { createApp } = Vue;
  130. createApp({
  131. data() {
  132. return {
  133. list:[],
  134. parm:{
  135. cid:'',
  136. page:1,
  137. page_size:20
  138. },
  139. total:0,
  140. name: '',
  141. content: '',
  142. userInfo:{},
  143. show: 0 // 添加 show 变量
  144. }
  145. },
  146. computed:{
  147. pages(){
  148. return Math.ceil(this.total/20);
  149. }
  150. },
  151. created(){
  152. // 获取本地存储的用户ID并赋值给cid
  153. const userInfo = JSON.parse(localStorage.getItem('userInfo'));
  154. if (!userInfo) {
  155. window.location.href = 'login.html';
  156. }
  157. this.userInfo = userInfo;
  158. this.parm.cid = userInfo ? userInfo.id : '';
  159. const curCid = new URLSearchParams(window.location.search).get('cid');
  160. if(curCid){
  161. this.parm.cid = curCid;
  162. }
  163. this.getData();
  164. },
  165. methods:{
  166. getData(){
  167. // 列表
  168. axios.get(url+'/api/yrx/que/user/records', { params: this.parm }).then(res=>{
  169. this.list = res.data.data.list;
  170. this.total = res.data.data.total;
  171. })
  172. },
  173. post(){ // 添加post方法
  174. if (!this.name || !this.content) {
  175. alert('面试题目和内容不能为空');
  176. return;
  177. }
  178. const token = localStorage.getItem('token'); // 获取token
  179. axios.post(url+'/api/yrx/que/user/post', { name: this.name, content: this.content }, {
  180. headers: {
  181. 'Authorization': `${token}` // 添加token到header
  182. }
  183. })
  184. .then(res => {
  185. if(res.data.code === 0){
  186. alert('提交成功');
  187. this.name = '';
  188. this.content = '';
  189. }
  190. })
  191. .catch(err => {
  192. alert('提交失败,请重试');
  193. console.error(err);
  194. });
  195. },
  196. logout() { // 添加 logout 方法
  197. localStorage.removeItem('userInfo');
  198. localStorage.removeItem('token');
  199. this.userInfo = null;
  200. }
  201. }
  202. }).mount('#app');
  203. </script>
  204. </body>
  205. </html>