detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 公司信息详情页 -->
  7. <section class="index_main">
  8. <!-- 列表页广告一 -->
  9. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  10. <!-- 面包屑导航 -->
  11. <div class="breadcrumb">
  12. <div class="inner">
  13. <span class="location">当前位置:</span>
  14. <el-breadcrumb :separator-icon="ArrowRight">
  15. <el-breadcrumb-item>
  16. <NuxtLink to="/">首页</NuxtLink>
  17. </el-breadcrumb-item>
  18. <el-breadcrumb-item v-if="parent_name != ''">
  19. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  20. </el-breadcrumb-item>
  21. <el-breadcrumb-item v-if="routeName">
  22. <NuxtLink :to="`list-1.html`"> {{ routeName }}</NuxtLink>
  23. </el-breadcrumb-item>
  24. <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
  25. </el-breadcrumb>
  26. </div>
  27. </div>
  28. <!-- 面包屑 end-->
  29. <div class="info_head_box clearfix">
  30. <div class="info_head_left">
  31. <a class="info_head_a info_head_only" :title="公司信息">公司信息</a>
  32. </div>
  33. </div>
  34. <section class="index_2 clearfix">
  35. <img class="index_2_img" :src="detailImg[0]" :title="routeNewsTtitle" alt="">
  36. <div class="index_2_right">
  37. <h4 class="index_2_h4"> {{ routeNewsTtitle }}</h4>
  38. <div class="index_2_title_box clearfix">
  39. <time class="index_2_title">
  40. 成立日期:
  41. <span v-if="time"> {{ time }}</span>
  42. </time>
  43. <span class="index_2_title">
  44. 所在城市:
  45. <span v-if="newsDetail.city_name">{{ newsDetail.city_name }}</span>
  46. </span>
  47. </div>
  48. <div class="index_2_ul clearfix">
  49. <div class="index_2_ul_left">
  50. <div class="index_2_li clearfix">
  51. <label class="index_2_li_label">机构性质</label>
  52. <span class="index_2_li_text " v-if="newsDetail.jobnature_name">
  53. {{ newsDetail.jobnature_name }}</span>
  54. </div>
  55. <div class="index_2_li clearfix">
  56. <label class="index_2_li_label">负 责 人</label>
  57. <span class="index_2_li_text" v-if="newsDetail.manager">
  58. {{ newsDetail.manager }}
  59. </span>
  60. </div>
  61. <div class="index_2_li clearfix">
  62. <label class="index_2_li_label">联 系 人</label>
  63. <span class="index_2_li_text " v-if="newsDetail.content_person">
  64. {{ newsDetail.content_person }}
  65. </span>
  66. </div>
  67. <div class="index_2_li clearfix">
  68. <label class="index_2_li_label">联系电话</label>
  69. <span class="index_2_li_text ">{{ newsDetail.telephone }}</span>
  70. </div>
  71. <div class="index_2_li clearfix">
  72. <label class="index_2_li_label">手 &nbsp;&nbsp;&nbsp;&nbsp; 机</label>
  73. <span class="index_2_li_text ">{{ newsDetail.mobile }}</span>
  74. </div>
  75. <div class="index_2_li clearfix">
  76. <label class="index_2_li_label">地 &nbsp;&nbsp;&nbsp;&nbsp; 址</label>
  77. <span class="index_2_li_text ">{{ newsDetail.adress }}</span>
  78. </div>
  79. </div>
  80. <div class="index_2_ul_left">
  81. <div class="index_2_li clearfix">
  82. <label class="index_2_li_label">所属行业</label>
  83. <span class="index_2_li_text ">{{ newsDetail.hy_name }}</span>
  84. </div>
  85. <div class="index_2_li clearfix">
  86. <label class="index_2_li_label">联系QQ</label>
  87. <span class="index_2_li_text ">{{ newsDetail.QQ }}</span>
  88. </div>
  89. <div class="index_2_li clearfix">
  90. <label class="index_2_li_label">网 &nbsp;&nbsp;&nbsp;&nbsp; 址</label>
  91. <span class="index_2_li_text ">{{ newsDetail.company_url }}</span>
  92. </div>
  93. <div class="index_2_li clearfix">
  94. <label class="index_2_li_label">邮政编码</label>
  95. <span class="index_2_li_text ">{{ newsDetail.post_code }}</span>
  96. </div>
  97. <div class="index_2_li clearfix">
  98. <label class="index_2_li_label">传 &nbsp;&nbsp;&nbsp;&nbsp; 真</label>
  99. <span class="index_2_li_text ">{{ newsDetail.fax }}</span>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </section>
  105. <section class="index_3 clearfix">
  106. <div class="info_2_head_box clearfix">
  107. <div class="info_2_head_left">
  108. <a class="info_2_head_a info_2_head_only" title="">详情信息</a>
  109. </div>
  110. </div>
  111. <div class="info_article" v-html="newsDetail.content"></div>
  112. </section>
  113. </section>
  114. <!-- 列表页广告二 -->
  115. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  116. <!-- 页面底部 -->
  117. <HomeFoot1></HomeFoot1>
  118. </template>
  119. <script setup>
  120. import { ref } from 'vue'
  121. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  122. import { ArrowRight } from '@element-plus/icons-vue'
  123. //2.页面路径 start ---------------------------------------->
  124. const route = useRoute();
  125. const articleId = parseInt(route.params.id);
  126. const targetSegment = getRoutePath(1);
  127. const targetSegment1 = getRoutePath(2);
  128. // 2.1 查询一级栏目的id
  129. //通过导航路径反向查询导航id
  130. let routeId;
  131. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  132. method: 'GET',
  133. query: {
  134. 'pinyin': targetSegment,
  135. },
  136. });
  137. if (getRouteId.code == 200) {
  138. routeId = getRouteId.data.category_id
  139. } else {
  140. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  141. console.log("错误位置:通过url路径查询导航池id")
  142. console.log("后端错误反馈:", getRouteId.message)
  143. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  144. }
  145. // 2.2查询二级栏目的id及名称
  146. let routeName = ref('');
  147. let routeId1 = ref('');
  148. const getRoutePName = await requestDataPromise('/web/getWebsiteRoute', {
  149. method: 'GET',
  150. query: {
  151. 'pinyin': targetSegment1,
  152. },
  153. });
  154. if (getRoutePName.code == 200) {
  155. routeId1.value = getRoutePName.data.category_id;
  156. routeName.value = getRoutePName.data.alias;
  157. } else {
  158. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  159. console.log("错误位置:通过url路径查询导航池id")
  160. console.log("后端错误反馈:", getRouteId.message)
  161. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  162. }
  163. //2.页面路径 end ---------------------------------------->
  164. //3.面包屑 start ---------------------------------------->
  165. const parent_name = ref("");
  166. const parent_id = ref("");
  167. const parent_pinyin = ref("");
  168. let getParentNav = async () => {
  169. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  170. method: 'GET',
  171. query: {
  172. 'catid': routeId
  173. },
  174. });
  175. if (listData.code == 200) {
  176. parent_name.value = listData.data.alias;
  177. parent_id.value = listData.data.parent_id;
  178. parent_pinyin.value = listData.data.aLIas_pinyin;
  179. } else {
  180. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  181. console.log("错误位置:获取面包屑导航")
  182. console.log("后端错误反馈:", listData.message)
  183. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  184. }
  185. }
  186. //获得父级栏目详情
  187. getParentNav();
  188. //3.面包屑 end ------------------------------------------->
  189. //4.新闻详情 start ---------------------------------------->
  190. //4.1 资讯详情
  191. const newsDetail = ref({})
  192. const routeNewsTtitle = ref("");
  193. //4.2 发布日期
  194. const time = ref("");
  195. //4.3 路径
  196. const routLevelTitle = ref("");
  197. const routLevelId = ref("");
  198. //4.4 是否展示投票
  199. const articleChoice = ref(false);
  200. let detailImg = ref('');
  201. let seoTitle;
  202. let seoDescription;
  203. let seoKeywords;
  204. //4.5 获取详情
  205. const mkdata = await requestDataPromise('/web/getWebsiteCompanyInfo', {
  206. method: 'GET',
  207. query: {
  208. 'id': articleId
  209. },
  210. });
  211. if (mkdata.code == 200) {
  212. //获取内容
  213. newsDetail.value = mkdata.data;
  214. detailImg.value = JSON.parse(mkdata.data.imgurl);
  215. //修正标题长度
  216. if (newsDetail.value.title.length >= 20) {
  217. routeNewsTtitle.value = newsDetail.value.title.substr(0, 20) + "...";
  218. } else {
  219. routeNewsTtitle.value = newsDetail.value.title
  220. }
  221. //获取发布时间
  222. if (newsDetail.value.data) {
  223. time.value = newsDetail.value.data.split(' ')[0];
  224. }
  225. seoTitle = newsDetail.value.title;
  226. seoDescription = newsDetail.value.description;
  227. seoKeywords = newsDetail.value.keyword;
  228. } else {
  229. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  230. console.log("错误位置:获取详情内容")
  231. console.log("后端错误反馈:", mkdata.message)
  232. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  233. }
  234. //4.新闻详情 end ---------------------------------------->
  235. //5.设置seo信息 start---------------------------------------->
  236. const setData = await requestDataPromise('/web/getWebsiteCategoryHead', {
  237. method: 'GET',
  238. query: {
  239. 'catid': routeId1.value
  240. },
  241. });
  242. if (setData.code == 200) {
  243. let seoSuffix = setData.data.suffix;
  244. let seoName = setData.data.website_name;
  245. useSeoMeta({
  246. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  247. meta: [
  248. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  249. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  250. ]
  251. });
  252. } else {
  253. console.log("设置频道页SEO出错!", setData.message)
  254. }
  255. //5.设置seo信息 end---------------------------------------->
  256. //6.广告 start ---------------------------------------->
  257. let adImg1 = ref([]);
  258. let adImg2 = ref([]);
  259. onMounted(async () => {
  260. const { $webUrl, $CwebUrl } = useNuxtApp();
  261. //广告1
  262. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_detail_0001`
  263. const responseAd1 = await fetch(url, {
  264. headers: {
  265. 'Content-Type': 'application/json',
  266. 'Userurl': $CwebUrl,
  267. 'Origin': $CwebUrl
  268. }
  269. });
  270. const resultAd1 = await responseAd1.json();
  271. adImg1.value = resultAd1.data[0];
  272. //广告2
  273. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_detail_0002`
  274. const responseAd2 = await fetch(url2, {
  275. headers: {
  276. 'Content-Type': 'application/json',
  277. 'Userurl': $CwebUrl,
  278. 'Origin': $CwebUrl
  279. }
  280. });
  281. const resultAd2 = await responseAd2.json();
  282. adImg2.value = resultAd2.data[0];
  283. })
  284. //6.广告 end ---------------------------------------->
  285. </script>
  286. <style lang="less" scoped>
  287. @import url(@/assets/css/company/detail.less);
  288. </style>