index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="tab4">
  3. <!-- 顶部 -->
  4. <div class="left">
  5. <ul>
  6. <li
  7. :class="{ active: formData.type === item.type }"
  8. v-for="item in listData"
  9. :key="item.id"
  10. @click="cutTab(item)"
  11. >
  12. <p v-if="formData.type === item.type">
  13. ◆&emsp;{{ item.name }}&emsp;◆
  14. </p>
  15. <p v-else>{{ item.name }}</p>
  16. <span> {{ item.biaoshi }} </span>
  17. </li>
  18. </ul>
  19. <div class="search" @keyup.enter="mySearch">
  20. <el-input
  21. placeholder="请输入关键词..."
  22. suffix-icon="el-icon-search"
  23. v-model="formData.searchKey"
  24. >
  25. </el-input>
  26. <span class="btn" @click="mySearch"></span>
  27. </div>
  28. </div>
  29. <!-- 下部内容 -->
  30. <div class="conten">
  31. <!-- 文章列表 -->
  32. <div class="conBox" v-show="cutShow">
  33. <div class="row" v-for="i in 7" :key="i" @click="cutPage(i)">
  34. <div class="row_left">
  35. <div>04</div>
  36. <span>2021-01</span>
  37. </div>
  38. <div class="row_right">
  39. <h1>社会主义革命和建设时期</h1>
  40. <p>
  41. 队官兵积极投身社会主义革命和建设,全面履行保卫祖国、保卫人民和平劳动的职能。这一时期,涌现出了打出国威军威的抗美援朝“大功连”,守卫北京天安门展示中国军人良好形象的“天安门前好五连”等多个先进集体,为新生人民政权提供了坚强后盾新生人民政权提供了坚强后盾新生人民政权提供了坚强后盾新生人民政权提供了坚强后盾新生人民政权提供了坚强后盾。
  42. </p>
  43. </div>
  44. </div>
  45. </div>
  46. <!-- 文章详情 -->
  47. <div class="conBox conBox2" v-show="!cutShow">
  48. <span class="el-icon-arrow-left" @click="cutShow = true"
  49. >返回教育<span>基地</span></span
  50. >
  51. <h1 class="title">国宾护卫中队</h1>
  52. <!-- 中间简介 -->
  53. <div class="box2_jc">
  54. <div>
  55. <img src="../../assets/img/tab4box1.png" alt="" />
  56. <span>北京武警执勤第七支队</span>
  57. </div>
  58. <div>
  59. <img src="../../assets/img/tab4box2.png" alt="" />
  60. <span>刘芳/武翀</span>
  61. </div>
  62. <div>
  63. <img src="../../assets/img/tab4box3.png" alt="" />
  64. <span>2021-11-05</span>
  65. </div>
  66. </div>
  67. <!-- 详情 -->
  68. <div class="box2_conten">
  69. <p v-for="i in 30" :key="i">
  70. 2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。2014年10月21日,重组后的国宾护卫队开始执行第一次护卫任务。
  71. </p>
  72. </div>
  73. </div>
  74. </div>
  75. <!-- 加载更多 -->
  76. <div class="moreDin" v-show="cutShow">
  77. <i class="el-icon-d-arrow-right"></i>
  78. <span>加载更多</span>
  79. </div>
  80. </div>
  81. </template>
  82. <script>
  83. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  84. //例如:import 《组件名称》 from '《组件路径》';
  85. export default {
  86. //import引入的组件需要注入到对象中才能使用
  87. components: {},
  88. data() {
  89. //这里存放数据
  90. return {
  91. cutShow: true,
  92. listData: [
  93. { biaoshi: "/", id: 1, name: "知识阅览", type: "model" },
  94. { biaoshi: "", id: 2, name: "知识共享", type: "video" },
  95. ],
  96. formData: {
  97. pageNum: 1,
  98. pageSize: 8,
  99. searchKey: "",
  100. type: "model",
  101. },
  102. };
  103. },
  104. //监听属性 类似于data概念
  105. computed: {},
  106. //监控data中的数据变化
  107. watch: {},
  108. //方法集合
  109. methods: {
  110. // 点击文章查看详情
  111. cutPage() {
  112. this.cutShow = false;
  113. },
  114. mySearch() {},
  115. cutTab(val) {
  116. if (this.formData.type === val.type) return;
  117. this.formData.pageNum = 1;
  118. this.formData.type = val.type;
  119. // this.goodList(this.formData);
  120. },
  121. },
  122. //生命周期 - 创建完成(可以访问当前this实例)
  123. created() {},
  124. //生命周期 - 挂载完成(可以访问DOM元素)
  125. mounted() {},
  126. beforeCreate() {}, //生命周期 - 创建之前
  127. beforeMount() {}, //生命周期 - 挂载之前
  128. beforeUpdate() {}, //生命周期 - 更新之前
  129. updated() {}, //生命周期 - 更新之后
  130. beforeDestroy() {}, //生命周期 - 销毁之前
  131. destroyed() {}, //生命周期 - 销毁完成
  132. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  133. };
  134. </script>
  135. <style lang='less' scoped>
  136. .tab4 {
  137. position: relative;
  138. width: 100%;
  139. height: 100%;
  140. display: flex;
  141. flex-direction: column;
  142. color: #3e3e3e;
  143. .left {
  144. position: relative;
  145. width: 100%;
  146. height: 200px;
  147. background: url("../../assets/img/tab4Tab.png");
  148. background-size: 100% 100%;
  149. ul {
  150. padding-left: 35px;
  151. display: flex;
  152. height: 100%;
  153. align-items: center;
  154. justify-content: center;
  155. li {
  156. display: flex;
  157. justify-content: center;
  158. font-size: 20px;
  159. color: #fff;
  160. width: 240px;
  161. cursor: pointer;
  162. &:hover {
  163. color: #f2cd83;
  164. }
  165. & > span {
  166. margin-left: 50px;
  167. color: #fff !important;
  168. }
  169. & > p {
  170. text-align: center;
  171. width: 145px;
  172. }
  173. }
  174. .active {
  175. color: #f2cd83;
  176. }
  177. }
  178. .search {
  179. z-index: 10;
  180. /*修改提示文字的颜色*/
  181. /deep/input::-webkit-input-placeholder {
  182. /* WebKit browsers */
  183. color: #be1220;
  184. }
  185. /deep/input:-moz-placeholder {
  186. /* Mozilla Firefox 4 to 18 */
  187. color: #be1220;
  188. }
  189. /deep/input::-moz-placeholder {
  190. /* Mozilla Firefox 19+ */
  191. color: #be1220;
  192. }
  193. /deep/input:-ms-input-placeholder {
  194. /* Internet Explorer 10+ */
  195. color: #be1220;
  196. }
  197. width: 700px;
  198. height: 50px;
  199. position: absolute;
  200. bottom: -25px;
  201. left: 50%;
  202. transform: translateX(-50%);
  203. /deep/.el-input__suffix {
  204. width: 50px;
  205. height: 50px;
  206. font-size: 20px;
  207. right: 0;
  208. }
  209. /deep/.el-input__inner {
  210. border-radius: 50px;
  211. height: 50px;
  212. border: 1px solid #be1220;
  213. }
  214. .btn {
  215. cursor: pointer;
  216. position: absolute;
  217. right: 0;
  218. top: 0;
  219. height: 50px;
  220. width: 50px;
  221. border-radius: 50%;
  222. background-color: transparent;
  223. }
  224. }
  225. }
  226. .conten {
  227. padding: 50px 220px 0px 250px;
  228. flex: 1;
  229. background: url("../../assets/img/tabBg.png");
  230. background-size: 100% 100%;
  231. .conBox {
  232. max-height: 510px;
  233. overflow-y: auto;
  234. padding-right: 30px;
  235. width: 100%;
  236. .row {
  237. cursor: pointer;
  238. color: #fff;
  239. display: flex;
  240. height: 170px;
  241. background-color: rgba(158, 102, 107, 0.5);
  242. &:nth-of-type(3n + 2) {
  243. background-color: rgba(227, 200, 187, 0.3);
  244. color: #9e666b;
  245. }
  246. &:nth-of-type(3n + 3) {
  247. background-color: rgba(158, 102, 107, 0.2);
  248. color: #9e666b;
  249. }
  250. .row_left {
  251. padding-top: 20px;
  252. width: 210px;
  253. height: 100%;
  254. display: flex;
  255. flex-direction: column;
  256. align-items: center;
  257. & > div {
  258. font-weight: 700;
  259. font-size: 70px;
  260. }
  261. & > span {
  262. font-size: 26px;
  263. }
  264. }
  265. .row_right {
  266. flex: 1;
  267. padding: 30px;
  268. & > h1 {
  269. font-size: 30px;
  270. margin-bottom: 20px;
  271. }
  272. & > p {
  273. font-size: 20px;
  274. display: -webkit-box;
  275. overflow: hidden;
  276. white-space: normal !important;
  277. text-overflow: ellipsis;
  278. word-wrap: break-word;
  279. -webkit-line-clamp: 2;
  280. -webkit-box-orient: vertical;
  281. }
  282. }
  283. }
  284. }
  285. .conBox2 {
  286. position: relative;
  287. overflow-y: visible;
  288. /deep/.el-icon-arrow-left {
  289. font-size: 20px;
  290. line-height: 40px;
  291. cursor: pointer;
  292. color: #be1220;
  293. position: absolute;
  294. left: 0;
  295. top: 0;
  296. & > span {
  297. font-size: 21px;
  298. }
  299. }
  300. .title {
  301. font-size: 30px;
  302. font-weight: 700;
  303. text-align: center;
  304. }
  305. .box2_jc {
  306. margin: 24px 0;
  307. display: flex;
  308. justify-content: center;
  309. & > div {
  310. display: flex;
  311. align-items: center;
  312. color: #9c9c9c;
  313. margin-right: 120px;
  314. & > img {
  315. width: 20px;
  316. height: 20px;
  317. }
  318. & > span {
  319. margin-left: 5px;
  320. font-size: 16px;
  321. }
  322. }
  323. }
  324. .box2_conten {
  325. font-size: 18px;
  326. line-height: 30px;
  327. color: #626260;
  328. padding-right: 40px;
  329. height: 430px;
  330. overflow-y: auto;
  331. }
  332. }
  333. }
  334. .moreDin {
  335. cursor: pointer;
  336. color: #bb111f;
  337. font-size: 20px;
  338. position: absolute;
  339. left: 50%;
  340. transform: translateX(-50%);
  341. bottom: 30px;
  342. & > i {
  343. margin-right: 10px;
  344. transform: rotate(90deg);
  345. }
  346. }
  347. }
  348. </style>