career_story1.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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 :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: 5,
  115. type: '5'
  116. })
  117. function query() {
  118. careerinformation(queryParams.value).then(resp => {
  119. list.value = resp.data_list.rows
  120. total.value = resp.data_list.total
  121. console.log("@@@@@@",total.value)
  122. })
  123. }
  124. function toDetail(item) {
  125. router.push({
  126. path: '/xjc-integratedmachine/environment/career_story2',
  127. query: {
  128. id: item.id
  129. }
  130. })
  131. }
  132. onMounted(() => {
  133. query()
  134. })
  135. </script>
  136. <style scoped lang="scss">
  137. p, div {
  138. margin: 0;
  139. padding: 0;
  140. }
  141. .university_details_video {
  142. background: url('@/assets/images/environment/university-detail.png') no-repeat;
  143. background-size: 1920px 1080px;
  144. z-index: 10;
  145. width: 100%;
  146. height: 1080px;
  147. .page-content {
  148. width: 100%;
  149. position: absolute;
  150. top: 100px;
  151. bottom: 0;
  152. display: flex;
  153. justify-content: center;
  154. }
  155. .page-img-box {
  156. width: 1832px;
  157. height: 922px;
  158. margin-top: 13px;
  159. background: rgba(255, 255, 255, 0.4);
  160. border-radius: 35px 35px 35px 35px;
  161. display: flex;
  162. flex-direction: column;
  163. overflow: auto;
  164. .item-box {
  165. width: 1750px;
  166. height: 204px;
  167. border-left: 10px solid #1EC590;
  168. background: #FFFFFF;
  169. box-shadow: 0px 2px 4px 2px rgba(0, 0, 0, 0.09);
  170. border-radius: 5px 5px 5px 5px;
  171. margin-left: 40px;
  172. margin-top: 46px;
  173. padding-left: 40px;
  174. padding-right: 40px;
  175. .top {
  176. display: flex;
  177. justify-content: space-between;
  178. padding-top: 40px;
  179. .title {
  180. font-weight: bold;
  181. font-size: 32px;
  182. color: #000000;
  183. line-height: 52px;
  184. //margin-left: 25px;
  185. }
  186. .details {
  187. font-weight: 400;
  188. font-size: 20px;
  189. color: #515F6A;
  190. //margin-right: 40px;
  191. //margin-top: 40px;
  192. }
  193. }
  194. .content {
  195. border-top: #E6E6E6 1px solid;
  196. height: 100px;
  197. overflow: auto;
  198. padding-top: 30px;
  199. font-weight: 400;
  200. font-size: 30px;
  201. color: #333333;
  202. }
  203. }
  204. }
  205. }
  206. </style>