career_story1.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="university_details_video">
  3. <head-component :headinfo=headinfo></head-component>
  4. <div class="page-content">
  5. <div class="page-img-box">
  6. <!-- 生涯故事1-->
  7. <div>
  8. <div class="item-box" v-for="(item,index) in list" @click="toDetail(item)">
  9. <div class="top">
  10. <p class="title" v-html="item.title"></p>
  11. <p class="details">详情 ></p>
  12. </div>
  13. <div class="content">{{ safeTruncate(item.content, 50) }}...</div>
  14. </div>
  15. </div>
  16. <!--<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"-->
  17. <!--v-model:limit="queryParams.pageSize" @pagination="query"/>-->
  18. <xjc-pagination v-if="!loading" :total="total" :pageNum="queryParams.pageNum" :pageSize="queryParams.pageSize"
  19. @changePage="changePage"></xjc-pagination>
  20. </div>
  21. <drag_component v-if="false"></drag_component>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup>
  26. import headComponent from '@/views/xjc-integratedmachine/components/head_component.vue'
  27. import Drag_component from "@/views/xjc-integratedmachine/components/drag_component.vue";
  28. import xjcPagination from "@/views/xjc-integratedmachine/components/xjc_pagination.vue"
  29. import {
  30. universityDetail,
  31. getPlanYearList,
  32. getScoreList,
  33. getPlanList,
  34. getCollection
  35. } from '@/api/xjc-integratedmachine/environment/university.js'
  36. import videojs from 'video.js';
  37. import 'video.js/dist/video-js.css';
  38. import collectionComponent from '@/views/xjc-integratedmachine/components/collection_component.vue'
  39. import {ref} from "vue";
  40. import {getConfigKey} from "@/api/system/config.js";
  41. import {careerinformation} from '@/api/xjc-integratedmachine/environment/tscareer.js'
  42. const router = useRouter()
  43. const route = useRoute()
  44. const list = ref([])
  45. const total = ref(0)
  46. const showAreaChoose = ref(false)
  47. const showCategoryChoose = ref(false)
  48. const showGradeChoose = ref(false)
  49. const param = route.query
  50. const showIndex = ref(1)
  51. const baseUrl = ref()
  52. const grade = ref([])
  53. const {proxy} = getCurrentInstance()
  54. function changePage(params) {
  55. queryParams.value.pageSize = params.value.pageSize
  56. queryParams.value.pageNum = params.value.pageNum
  57. query()
  58. }
  59. const {
  60. gk_province,
  61. category,
  62. educationlevel,
  63. property,
  64. school_category
  65. } = proxy.useDict('gk_province', 'category', 'educationlevel', 'property', 'school_category')
  66. const form = ref({
  67. area: null,
  68. areaname: null,
  69. university: param.name,
  70. })
  71. const entity = ref({})
  72. const collectionList = ref([])
  73. const headinfo = ref({})
  74. const onePage = ref(true)
  75. const twoPage = ref(false)
  76. const threePage = ref(false)
  77. const fourPage = ref(false)
  78. const fivePage = ref(false)
  79. const fivePageDialog = ref(false)
  80. const sixPageDialog = ref(false)
  81. const eightPageDialog = ref(false)
  82. const sixPage = ref(false)
  83. const senvenPage = ref(false)
  84. const eightPage = ref(false)
  85. function setHeadinfo() {
  86. headinfo.value = {
  87. title: '生涯故事',
  88. user: {
  89. avatar: '头像路径',
  90. nickName: '张三'
  91. },
  92. backUrl: '/xjc-integratedmachine/environment/query_universitydb_conditions',
  93. homeUrl: '/xjc-integratedmachine/environment/index',
  94. }
  95. }
  96. function safeTruncate(text, length) {
  97. // 使用 substring 方法截取字符串
  98. // 这里可以添加额外的消毒步骤来确保文本安全
  99. // 例如:使用正则表达式移除所有脚本标签等
  100. // let reg = /[\u4e00-\u9fa5]|[\(\)\《\》\——\;\,\。\“\”\<\>\!]/g;
  101. // const sanitizedText = text.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
  102. const sanitizedText = text.replace(/[^\u4e00-\u9fa5;,。“”《》?!]+/g, '');
  103. // const truncatedText = sanitizedText.substring(0, length);
  104. const truncatedText = sanitizedText.substring(0, length);
  105. console.log("truncatedText", truncatedText)
  106. // 但为了简化示例,这里仅返回截取的文本
  107. return truncatedText;
  108. }
  109. onMounted(() => {
  110. setHeadinfo()
  111. })
  112. const queryParams = ref({
  113. pageNum: 1,
  114. pageSize: 3,
  115. type: '5'
  116. })
  117. const loading = ref(false)
  118. function query() {
  119. loading.value = true
  120. careerinformation(queryParams.value).then(resp => {
  121. list.value = resp.data_list.rows
  122. total.value = resp.data_list.total
  123. loading.value = false
  124. })
  125. }
  126. function toDetail(item) {
  127. router.push({
  128. path: '/xjc-integratedmachine/environment/career_story2',
  129. query: {
  130. id: item.id
  131. }
  132. })
  133. }
  134. onMounted(() => {
  135. query()
  136. })
  137. </script>
  138. <style scoped lang="scss">
  139. p, div {
  140. margin: 0;
  141. padding: 0;
  142. }
  143. .university_details_video {
  144. background: url('@/assets/images/environment/university-detail.png') no-repeat;
  145. background-size: 1920px 1080px;
  146. z-index: 10;
  147. width: 100%;
  148. height: 1080px;
  149. .page-content {
  150. width: 100%;
  151. position: absolute;
  152. top: 100px;
  153. bottom: 0;
  154. display: flex;
  155. justify-content: center;
  156. }
  157. .page-img-box {
  158. width: 1832px;
  159. height: 860px;
  160. margin-top: 13px;
  161. background: rgba(255, 255, 255, 0.4);
  162. border-radius: 35px 35px 35px 35px;
  163. display: flex;
  164. flex-direction: column;
  165. //overflow: auto;
  166. .item-box {
  167. width: 1750px;
  168. height: 204px;
  169. border-left: 10px solid #1EC590;
  170. background: #FFFFFF;
  171. box-shadow: 0px 2px 4px 2px rgba(0, 0, 0, 0.09);
  172. border-radius: 5px 5px 5px 5px;
  173. margin-left: 40px;
  174. margin-top: 46px;
  175. padding-left: 40px;
  176. padding-right: 40px;
  177. .top {
  178. display: flex;
  179. justify-content: space-between;
  180. padding-top: 40px;
  181. .title {
  182. font-weight: bold;
  183. font-size: 32px;
  184. color: #000000;
  185. line-height: 52px;
  186. //margin-left: 25px;
  187. }
  188. .details {
  189. font-weight: 400;
  190. font-size: 20px;
  191. color: #515F6A;
  192. //margin-right: 40px;
  193. //margin-top: 40px;
  194. }
  195. }
  196. .content {
  197. border-top: #E6E6E6 1px solid;
  198. height: 100px;
  199. overflow: auto;
  200. padding-top: 30px;
  201. font-weight: 400;
  202. font-size: 30px;
  203. color: #333333;
  204. }
  205. }
  206. }
  207. }
  208. </style>