list.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. #list li{
  13. width: 95% !important;
  14. line-height: 55px;
  15. font-size: 14px;
  16. border-bottom: 1px solid #BBBBBB20;
  17. }
  18. #list li a{
  19. color: #0065D7;
  20. display: flex;
  21. }
  22. </style>
  23. <body>
  24. <section id="app">
  25. <header>
  26. <div class="left_nav">
  27. <img @click="show=!show" class="phone" width="30" src="img/menu.png" alt="">
  28. <img class="logo" src="img/logo.png" alt="logo">
  29. </div>
  30. <div class="nav">
  31. <a class="act" href="/index.html">主页</a>
  32. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  33. <a href="https://match.yuanrenxue.cn/" target="_blank">采集进阶课程</a>
  34. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  35. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  36. <a href="https://www.yuanrenxue.cn/" target="_blank">关于猿人学</a>
  37. </div>
  38. <div class="login">
  39. <div class="pc">
  40. <!-- <img width="30px" src="img/logo.jpg" alt="logo"> -->
  41. <div v-if="userInfo" class="menu">
  42. {{userInfo.name}}
  43. <ul>
  44. <li><a href="/record.html">我的刷题记录</a></li>
  45. <li @click="logout"><a>退出登录</a></li>
  46. </ul>
  47. </div>
  48. <a v-else href="/login.html">请先登录</a>
  49. </div>
  50. <div class="phone">
  51. <span v-if="userInfo">{{userInfo.name}}</span>
  52. <a v-else href="/login.html">请先登录</a>
  53. </div>
  54. </div>
  55. </header>
  56. <transition name="slide">
  57. <div class="slide" v-if="show">
  58. <a class="act" href="/index.html">主页</a>
  59. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  60. <a href="https://match.yuanrenxue.cn/" target="_blank">采集进阶课程</a>
  61. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  62. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  63. <a href="https://www.yuanrenxue.cn/" target="_blank">关于猿人学</a>
  64. <a v-if="userInfo" href="/record.html">我的刷题记录</a>
  65. <a v-if="userInfo" @click="logout">退出登录</a>
  66. </div>
  67. </transition>
  68. <div class="content" style="margin-top: 16px;">
  69. <div class="left">
  70. <div class="banner" style="align-items: anchor-center;display: flex;padding: 0 10px;">
  71. <!-- <img align="left" width='100' height="100" :src="img[0]" alt=""> -->
  72. <div style="width: 100px;height: 100px;text-align: center;line-height: 100px;background: black;">{{categoryInfo.categoryName}}</div>
  73. <p style="color: #333;text-align: left;padding: 10px;">
  74. {{categoryInfo.content}}
  75. </p>
  76. </div>
  77. </div>
  78. <div class="right">
  79. <div class="banner">
  80. <img width="100%" height="100%" :src="img[1]" alt="">
  81. </div>
  82. </div>
  83. <p class="navtation"><a href="/index.html">回到首页</a> -
  84. <span v-if="parm.category=='crawler'">爬虫</span>
  85. <span v-else-if="parm.category=='js'">JS</span>
  86. <span v-else>安卓</span>
  87. 面试题</p>
  88. <div class="left">
  89. <div class="part">
  90. <ul class="list" id="list">
  91. <li v-for="(item,i) in list">
  92. <a :href="'/detail.html?cat='+parm.category+'&id='+item.interviewId">
  93. <span>{{i+1}}、</span>{{item.name}}</a>
  94. </li>
  95. </ul>
  96. <p class="page">
  97. <button :disabled="parm.page==1?'disabled':false" @click="parm.page--,getData()">上一页</button>
  98. <span><b>{{parm.page}}</b>/{{pages}}</span>
  99. <button :disabled="parm.page==pages?'disabled':false" @click="parm.page++,getData()">下一页</button>
  100. </p>
  101. </div>
  102. </div>
  103. <div class="right">
  104. <div class="part">
  105. <h2 class="sec_title"><span>面试排行榜</span> <a href="">更多</a></h2>
  106. <ul class="list list_100">
  107. <li v-for="item in top"><a href="">{{item.cname}}</a><span>{{item.count}}</span></li>
  108. </ul>
  109. </div>
  110. <div class="part">
  111. <h2 class="sec_title"><span>贡献面试题</span></h2>
  112. <form class="form" action="">
  113. <input v-model="name" type="text" placeholder="面试题目">
  114. <textarea v-model="content"></textarea>
  115. <button type="button" @click="post">提交</button>
  116. </form>
  117. </div>
  118. </div>
  119. </div>
  120. <footer>
  121. <ul>
  122. <li>
  123. <b>爬虫比赛</b> <br>
  124. <a href="https://appmatch.yuanrenxue.cn/" target="_blank">APP题目</a>
  125. <a href="https://match.yuanrenxue.cn/" target="_blank">爬虫逆向比赛</a>
  126. <a href="https://tool.yuanrenxue.cn/" target="_blank">采集分析工具</a>
  127. </li>
  128. <li>
  129. <b>爬虫课程</b> <br>
  130. <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>
  131. <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>
  132. <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>
  133. </li>
  134. <li>
  135. <b>关于猿人学</b> <br>
  136. <a href="https://www.yuanrenxue.cn/tricks" target="_blank">Python技术杂谈</a>
  137. <a href="https://www.yuanrenxue.cn/earn-money" target="_blank">Python爬虫挣钱</a>
  138. </li>
  139. <li class="contact" style="display: flex;line-height: 30px;">
  140. <img style="margin-right: 10px;" width="100" height="100" src="img/wx.jpg" alt="">
  141. 扫一扫加我微信 <br>
  142. 备注面试题 <br>
  143. 拉你进面试交流群
  144. </li>
  145. </ul>
  146. <p>成都老猿智能科技有限公司Copyright @ 2025 猿人学面试 蜀ICP备2022000052号-2</p>
  147. </footer>
  148. </section>
  149. <script src="js/public.js"></script>
  150. <script>
  151. const { createApp } = Vue;
  152. createApp({
  153. data() {
  154. return {
  155. list:[],
  156. parm:{
  157. category:'js',
  158. page:1,
  159. page_size:20
  160. },
  161. total:0,
  162. img:[],
  163. top:[],
  164. name: '',
  165. content: '',
  166. show: 0, // 添加 show 变量
  167. userInfo: {}, // 添加 userInfo 变量
  168. categoryInfo:{}
  169. }
  170. },
  171. computed:{
  172. pages(){
  173. return Math.ceil(this.total/20);
  174. }
  175. },
  176. created(){
  177. this.parm.category = new URLSearchParams(window.location.search).get('cat') || 'js'; // 获取URL中的cat参数并赋值给category
  178. this.getData();
  179. const userInfo = JSON.parse(localStorage.getItem('userInfo')); // 获取本地存储的用户信息
  180. this.userInfo = userInfo;
  181. },
  182. methods:{
  183. getData(){
  184. // 首页
  185. axios.get(url+'/api/yrx/banner/list?position=index_left').then(res=>{
  186. this.img[0] = res.data.data[0].img;
  187. })
  188. axios.get(url+'/api/yrx/banner/list?position=index_right').then(res=>{
  189. this.img[1] = res.data.data[0].img;
  190. })
  191. axios.get(url+'/api/yrx/que/user/top').then(res=>{
  192. this.top = res.data.data;
  193. })
  194. // 列表
  195. axios.get(url+'/api/yrx/que/list', { params: this.parm }).then(res=>{
  196. this.list = res.data.data.list;
  197. this.total = res.data.data.total;
  198. this.categoryInfo = res.data.data.category;
  199. })
  200. },
  201. post(){ // 添加post方法
  202. if (!this.name || !this.content) {
  203. alert('面试题目和内容不能为空');
  204. return;
  205. }
  206. const token = localStorage.getItem('token'); // 获取token
  207. axios.post(url+'/api/yrx/que/user/post', { name: this.name, content: this.content }, {
  208. headers: {
  209. 'Authorization': `${token}` // 添加token到header
  210. }
  211. })
  212. .then(res => {
  213. if(res.data.code === 0){
  214. alert('提交成功');
  215. this.name = '';
  216. this.content = '';
  217. }
  218. })
  219. .catch(err => {
  220. alert('提交失败,请重试');
  221. console.error(err);
  222. });
  223. },
  224. logout() { // 添加 logout 方法
  225. localStorage.removeItem('userInfo');
  226. localStorage.removeItem('token');
  227. this.userInfo = null;
  228. }
  229. }
  230. }).mount('#app');
  231. </script>
  232. </body>
  233. </html>