detail3.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. <template>
  2. <!-- goods -->
  3. <div class="goods">
  4. <HomePageHead></HomePageHead>
  5. <HomePageNavigation></HomePageNavigation>
  6. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  7. <main class="index_main" v-if="shopType == 1">
  8. <section class="index_1 clearfix">
  9. <div class="breadcrumb phone_none">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item v-if="p_parent_name != ''">
  17. <!-- <NuxtLink :to="`/${targetSegment}/index.html`"> {{ p_parent_name }}</NuxtLink> -->
  18. {{ p_parent_name }}
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item v-if="parent_name != ''">
  21. <NuxtLink :to="`/${targetSegment}/${targetSegment1}/index.html`"> {{ parent_name }}
  22. </NuxtLink>
  23. </el-breadcrumb-item>
  24. <el-breadcrumb-item v-if="parent_name != ''">
  25. <NuxtLink :to="`/${targetSegment}/${targetSegment1}/${targetSegment2}/list-1.html`">
  26. {{ navTitle }}
  27. </NuxtLink>
  28. </el-breadcrumb-item>
  29. <el-breadcrumb-item>
  30. {{ routeNewsTtitle }}
  31. </el-breadcrumb-item>
  32. </el-breadcrumb>
  33. </div>
  34. </div>
  35. <div class="breadcrumb_box pc_none">
  36. <span class=" ">当前位置:</span>
  37. <NuxtLink to="/">首页</NuxtLink>
  38. <span class=" ">&gt;</span>
  39. <NuxtLink v-if="p_parent_name != ''">{{ p_parent_name }}</NuxtLink>
  40. <span class=" " v-if="p_parent_name != ''">&gt;</span>
  41. <NuxtLink v-if="parent_name != ''" :to="`/${targetSegment}/${targetSegment1}/index.html`"> {{ parent_name }}
  42. </NuxtLink>
  43. <span class=" " v-if="parent_name != ''">&gt;</span>
  44. <NuxtLink :to="`/${targetSegment}/${targetSegment1}/${targetSegment2}/list-1.html`">
  45. {{ navTitle }}
  46. </NuxtLink>
  47. <span class=" " v-if="parent_name != ''">&gt;</span>
  48. <span class="">{{ routeNewsTtitle }}</span>
  49. </div>
  50. </section>
  51. <section class="index_2 clearfix">
  52. <img class="index_2_img" :src="shopImg" :title="newsDetail.name" alt="">
  53. <div class="index_2_left">
  54. <h4 class="index_2_h4 dot1">{{ newsDetail.name }}</h4>
  55. <div class="index_2_title_box clearfix">
  56. <time class="index_2_title"> 更新日期:{{ newsDetail.updated_at }}</time>
  57. <span class="index_2_title">浏览次数:{{ newsDetail.hits }}</span>
  58. </div>
  59. <div class="index_2_ul clearfix">
  60. <div class="index_2_li clearfix">
  61. <label class="index_2_li_label">公 司 名</label>
  62. <span class="index_2_li_text"> {{ newsDetail.com }}</span>
  63. </div>
  64. <div class="index_2_li clearfix">
  65. <label class="index_2_li_label">所 在 地</label>
  66. <span class="index_2_li_text ">{{ newsDetail.address }}</span>
  67. </div>
  68. <div class="index_2_li clearfix">
  69. <label class="index_2_li_label">联 系 人</label>
  70. <span class="index_2_li_text ">{{ newsDetail.contact }}</span>
  71. </div>
  72. <div class="index_2_li clearfix">
  73. <label class="index_2_li_label">产品单价</label>
  74. <span class="index_2_li_text">
  75. {{ newsDetail.price }}
  76. 元/
  77. {{ newsDetail.unit }}
  78. </span>
  79. </div>
  80. <div class="index_2_li clearfix">
  81. <label class="index_2_li_label">最小定量</label>
  82. <span class="index_2_li_text ">{{ newsDetail.min }}</span>
  83. </div>
  84. <div class="index_2_li clearfix">
  85. <label class="index_2_li_label">供货总量</label>
  86. <span class="index_2_li_text ">{{ newsDetail.max }}</span>
  87. </div>
  88. <div class="index_2_li clearfix">
  89. <label class="index_2_li_label">有 效 期</label>
  90. <span class="index_2_li_text ">{{ getValidityTime(newsDetail) }}</span>
  91. </div>
  92. </div>
  93. </div>
  94. </section>
  95. <!-- 选项卡1 -->
  96. <section class="index_3 clearfix phone_none">
  97. <div class="shop_head_1 clearfix">
  98. <div class="shop_head_1_name" :class="{ shop_head_1_name_only: supply_num == 1 }"
  99. @mouseover="supply_num = 1">详情信息</div>
  100. <div class="shop_head_1_name" :class="{ shop_head_1_name_only: supply_num == 2 }"
  101. @mouseover="supply_num = 2">联系方式</div>
  102. <div class="shop_head_1_name" :class="{ shop_head_1_name_only: supply_num == 3 }"
  103. @mouseover="supply_num = 3">图片展示</div>
  104. </div>
  105. <div class="card_out clearfix">
  106. <div class="card_1_box clearfix card_1_box_only" v-if="supply_num == 1" v-html="newsDetail.detail">
  107. </div>
  108. <div class="card_1_box clearfix card_1_box_only" v-if="supply_num == 2">
  109. <p class="supply_art_box_p">公司名称:{{ newsDetail.com }}</p>
  110. <p class="supply_art_box_p">电子邮箱:{{ newsDetail.email }}</p>
  111. <p class="supply_art_box_p">邮政编码:{{ newsDetail.postal }}</p>
  112. <p class="supply_art_box_p">联系地址:{{ newsDetail.address }}</p>
  113. </div>
  114. <div class="card_1_box clearfix card_1_box_only" v-if="supply_num == 3">
  115. <div class="supply_art_box_img">
  116. <img :src="item" v-for="item in newsDetail.imgurl">
  117. </div>
  118. </div>
  119. </div>
  120. </section>
  121. <section class="index_3 clearfix pc_none">
  122. <div class="phone_box_1_head">
  123. <a :class="{ a_choice_only: 1 == supply_num }"
  124. @mouseover="supply_num = 1">详情信息</a>
  125. <a :class="{ a_choice_only: 2 == supply_num }"
  126. @mouseover="supply_num = 2">联系方式</a>
  127. <a :class="{ a_choice_only: 3 == supply_num }"
  128. @mouseover="supply_num = 3">图片展示</a>
  129. </div>
  130. <div class="">
  131. <!-- 详情信息 phone -->
  132. <div class="phone_box_1 pc_none" v-show="supply_num == 1">
  133. <div class="phone_box_1_text" v-html="newsDetail.detail"></div>
  134. </div>
  135. <!-- 联系方式 phone -->
  136. <div class="phone_box_2 pc_none" v-show="supply_num == 2">
  137. <div class="phone_box_2_text">
  138. <div class="phone_box_2_li"><label class="phone_box_2_li_label">公司名称:</label> <span class="phone_box_2_li_text">{{ newsDetail.com }}</span></div>
  139. <div class="phone_box_2_li"><label class="phone_box_2_li_label">电子邮箱:</label> <span class="phone_box_2_li_text">{{ newsDetail.email }}</span></div>
  140. <div class="phone_box_2_li"><label class="phone_box_2_li_label">邮政编码:</label> <span class="phone_box_2_li_text">{{ newsDetail.postal }}</span></div>
  141. <div class="phone_box_2_li"><label class="phone_box_2_li_label">联系地址:</label> <span class="phone_box_2_li_text">{{ newsDetail.address }}</span></div>
  142. </div>
  143. </div>
  144. <!-- 图片展示 phone -->
  145. <div class="phone_box_3 pc_none" v-show="supply_num == 3">
  146. <div class="phone_box_3_img_ul">
  147. <img :src="item" v-for="item in newsDetail.imgurl">
  148. </div>
  149. </div>
  150. </div>
  151. </section>
  152. <!-- 选项卡2 -->
  153. <section class="index_4 clearfix phone_none">
  154. <div class="box_1 clearfix">
  155. <div class="box_1_head">
  156. <div class="box_1_head_name">点击排行</div>
  157. </div>
  158. <div class="img_ul_1 clearfix">
  159. <div class="img_li_1 clearfix" v-for="(item, index) in pageData1" :key="index">
  160. <NuxtLink class="img_li_1_a" :href="getLinkPathDetail(item)" :title="item.title">
  161. <div class="img_li_1_img_box clearfix">
  162. <img class="img_li_1_img" :src="item.imgurl" :title="item.title" alt="">
  163. </div>
  164. <div class="img_li_1_dot2">{{ item.name }}
  165. </div>
  166. </NuxtLink>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="box_1 clearfix">
  171. <div class="box_1_head">
  172. <div class="box_1_head_name">最新商机</div>
  173. </div>
  174. <div class="img_ul_1 clearfix">
  175. <div class="img_li_1 clearfix" v-for="(item, index) in pageData2" :key="index">
  176. <NuxtLink class="img_li_1_a" :href="getLinkPathDetail(item)" :title="item.title">
  177. <div class="img_li_1_img_box clearfix">
  178. <img class="img_li_1_img" :src="item.imgurl" :title="item.title" alt="">
  179. </div>
  180. <div class="img_li_1_dot2">{{ item.name }}
  181. </div>
  182. </NuxtLink>
  183. </div>
  184. </div>
  185. </div>
  186. </section>
  187. <div class="phone_4_box pc_none" >
  188. <div class="phone_head">
  189. <NuxtLink class="phone_head_a">
  190. 点击排行
  191. </NuxtLink>
  192. </div>
  193. <div class="phone_img_ul clearfix">
  194. <div class="phone_img_li clearfix" v-for="(item, index) in pageData1.slice(0,4)" :key="index">
  195. <NuxtLink class="phone_img_li_a" :href="getLinkPathDetail(item)" >
  196. <div class="phone_img_li_img_box clearfix">
  197. <img class="phone_img_li_img" :src="item.imgurl" :alt="item.name" >
  198. </div>
  199. <div class="phone_img_li_dot2 dot2">{{ item.name }}</div>
  200. </NuxtLink>
  201. </div>
  202. <div class="phone_img_li clearfix" v-for="(item, index) in pageData1.slice(0,4)" :key="index">
  203. <NuxtLink class="phone_img_li_a" :href="getLinkPathDetail(item)" >
  204. <div class="phone_img_li_img_box clearfix">
  205. <img class="phone_img_li_img" :src="item.imgurl" :alt="item.name" >
  206. </div>
  207. <div class="phone_img_li_dot2 dot2">{{ item.name }}</div>
  208. </NuxtLink>
  209. </div>
  210. </div>
  211. </div>
  212. <div class="phone_5_box pc_none" >
  213. <div class="phone_head">
  214. <NuxtLink class="phone_head_a">
  215. 最新商机
  216. </NuxtLink>
  217. </div>
  218. <div class="phone_img_ul clearfix">
  219. <div class="phone_img_li clearfix" v-for="(item, index) in pageData2.slice(0,6)" :key="index">
  220. <NuxtLink class="phone_img_li_a" :href="getLinkPathDetail(item)" >
  221. <div class="phone_img_li_img_box clearfix">
  222. <img class="phone_img_li_img" :src="item.imgurl" :alt="item.name" >
  223. </div>
  224. <div class="phone_img_li_dot2 dot2">{{ item.name }}</div>
  225. </NuxtLink>
  226. </div>
  227. </div>
  228. </div>
  229. </main>
  230. <main class="index_main" v-if="shopType == 2">
  231. <section class=" clearfix">
  232. <div class="index_out_1_left clearfix">
  233. <section class="index_1 clearfix">
  234. <div class="breadcrumb">
  235. <div class="inner">
  236. <span class="location">当前位置:</span>
  237. <el-breadcrumb :separator-icon="ArrowRight">
  238. <el-breadcrumb-item>
  239. <NuxtLink to="/">首页</NuxtLink>
  240. </el-breadcrumb-item>
  241. <el-breadcrumb-item v-if="p_parent_name != ''">
  242. <NuxtLink :to="`/${targetSegment}/index.html`"> {{ p_parent_name }}</NuxtLink>
  243. </el-breadcrumb-item>
  244. <el-breadcrumb-item v-if="parent_name != ''">
  245. <NuxtLink :to="`/${targetSegment}/${targetSegment1}/list-1.html`">
  246. {{ parent_name }}
  247. </NuxtLink>
  248. </el-breadcrumb-item>
  249. <el-breadcrumb-item>
  250. {{ routeNewsTtitle }}
  251. </el-breadcrumb-item>
  252. </el-breadcrumb>
  253. </div>
  254. </div>
  255. </section>
  256. <section class="index_2 clearfix">
  257. <img class="index_2_img" :src="shopImg" :title="newsDetail.name" alt="">
  258. <div class="index_2_right">
  259. <h4 class="index_2_h4 dot1">求购:{{ newsDetail.name }}</h4>
  260. <div class="index_2_ul clearfix">
  261. <div class="index_2_li clearfix">
  262. <label class="index_2_li_label">发布日期</label>
  263. <span class="index_2_li_text">{{ getTime(newsDetail.updated_at, 'year', 1) }}</span>
  264. </div>
  265. <div class="index_2_li clearfix">
  266. <label class="index_2_li_label">截止日期</label>
  267. <span class="index_2_li_text">{{ getValidityTime(newsDetail) }}</span>
  268. </div>
  269. <div class="index_2_li clearfix">
  270. <label class="index_2_li_label">浏览次数</label>
  271. <span class="index_2_li_text">{{ newsDetail.hits }}</span>
  272. </div>
  273. <div class="index_2_li clearfix">
  274. <label class="index_2_li_label">联 系 人</label>
  275. <span class="index_2_li_text">{{ newsDetail.contact }}</span>
  276. </div>
  277. <div class="index_2_li clearfix">
  278. <label class="index_2_li_label">发布地区</label>
  279. <span class="index_2_li_text">{{ newsDetail.address }}</span>
  280. </div>
  281. <div class="index_2_li clearfix">
  282. <label class="index_2_li_label">座 机</label>
  283. <span class="index_2_li_text">{{ newsDetail.landline }}</span>
  284. </div>
  285. <div class="index_2_li clearfix">
  286. <label class="index_2_li_label">联系电话</label>
  287. <span class="index_2_li_text">{{ newsDetail.phone }}</span>
  288. </div>
  289. </div>
  290. </div>
  291. </section>
  292. </div>
  293. <div class="shop_3_right clearfix">
  294. <div class="choice_1_box clearfix">
  295. <div class="choice_1_btn_box clearfix">
  296. <div class="choice_1_btn" :class="{ choice_1_btn_only: supply_buy == 1 }"
  297. @mouseover="supply_buy = 1">
  298. <span class="choice_1_btn_a" title="供应商品">供应商品</span>
  299. </div>
  300. <div class="choice_1_btn " :class="{ choice_1_btn_only: supply_buy == 2 }"
  301. @mouseover="supply_buy = 2">
  302. <a class="choice_1_btn_a" title="求购商品">求购商品</a>
  303. </div>
  304. </div>
  305. <div class="choice_1_card_box">
  306. <!-- 供应商品 -->
  307. <div class="shop_ul_img_2 choice_1_card clearfix" v-show="supply_buy == 1">
  308. <div class="shop_li_img_2" v-for="(item, index) in pageData3" :key="index">
  309. <NuxtLink class="shop_li_img_2_a" :href="getLinkPathDetail(item)"
  310. :title="item.name">
  311. <div class="shop_li_img_2_num"> {{ index + 1 }} </div>
  312. <div class="shop_li_img_2_right clearfix">
  313. <img class="shop_li_img_2_img" :src="item.imgurl" :title="item.name" alt="">
  314. <div class="shop_li_img_2_text">
  315. {{ item.name }}
  316. </div>
  317. </div>
  318. </NuxtLink>
  319. </div>
  320. </div>
  321. <!-- 供应商品 -->
  322. <!-- 求购商品 -->
  323. <div class="shop_ul_img_2 choice_1_card clearfix" v-show="supply_buy == 2">
  324. <div class="shop_li_img_2" v-for="(item, index) in pageData4" :key="index">
  325. <NuxtLink class="shop_li_img_2_a" :href="getLinkPathDetail(item)"
  326. :title="item.name">
  327. <div class="shop_li_img_2_num"> {{ index + 1 }} </div>
  328. <div class="shop_li_img_2_right clearfix">
  329. <img class="shop_li_img_2_img" :src="item.imgurl" :title="item.name" alt="">
  330. <div class="shop_li_img_2_text">
  331. {{ item.name }}
  332. </div>
  333. </div>
  334. </NuxtLink>
  335. </div>
  336. </div>
  337. <!-- 求购商品 -->
  338. </div>
  339. </div>
  340. </div>
  341. </section>
  342. <!-- 选项卡1 -->
  343. <section class="index_3 clearfix">
  344. <div class="shop_head_1 clearfix">
  345. <div class="shop_head_1_name" :class="{ shop_head_1_name_only: buy_num == 1 }"
  346. @mouseover="buy_num = 1">详情信息</div>
  347. <div class="shop_head_1_name" :class="{ shop_head_1_name_only: buy_num == 2 }"
  348. @mouseover="buy_num = 2">发布人信息</div>
  349. </div>
  350. <div class="card_out clearfix">
  351. <div class="card_1_box clearfix card_1_box_only" v-show="buy_num == 1" v-html="newsDetail.detail">
  352. </div>
  353. <div class="card_1_box clearfix card_1_box_only" v-show="buy_num == 2">
  354. <P>公司名称:{{ newsDetail.com }}</P>
  355. <P>电子邮箱:{{ newsDetail.email }}</P>
  356. <P>邮政编码:{{ newsDetail.postal }}</P>
  357. <P>联系地址:{{ newsDetail.address }}</P>
  358. </div>
  359. </div>
  360. </section>
  361. <!-- 选项卡2 -->
  362. <section class="index_4 clearfix">
  363. <div class="box_1 clearfix">
  364. <div class="box_1_head">
  365. <div class="box_1_head_name">点击排行</div>
  366. </div>
  367. <div class="img_ul_1 clearfix">
  368. <div class="img_li_1 clearfix" v-for="(item, index) in pageData1" :key="index">
  369. <NuxtLink class="img_li_1_a" :href="getLinkPathDetail(item)" :title="item.title">
  370. <div class="img_li_1_img_box clearfix">
  371. <img class="img_li_1_img" :src="item.imgurl" :title="item.title" alt="">
  372. </div>
  373. <div class="img_li_1_dot2">{{ item.name }}
  374. </div>
  375. </NuxtLink>
  376. </div>
  377. </div>
  378. </div>
  379. <div class="box_1 clearfix">
  380. <div class="box_1_head">
  381. <div class="box_1_head_name">最新商机</div>
  382. </div>
  383. <div class="img_ul_1 clearfix">
  384. <div class="img_li_1 clearfix" v-for="(item, index) in pageData2" :key="index">
  385. <NuxtLink class="img_li_1_a" :href="getLinkPathDetail(item)" :title="item.title">
  386. <div class="img_li_1_img_box clearfix">
  387. <img class="img_li_1_img" :src="item.imgurl" :title="item.title" alt="">
  388. </div>
  389. <div class="img_li_1_dot2">{{ item.name }}
  390. </div>
  391. </NuxtLink>
  392. </div>
  393. </div>
  394. </div>
  395. </section>
  396. </main>
  397. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  398. <HomeFoot1></HomeFoot1>
  399. </div>
  400. </template>
  401. <script setup>
  402. //0.页面依赖 start ---------------------------------------->
  403. import { onMounted, ref } from 'vue'
  404. import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
  405. import { ArrowRight } from '@element-plus/icons-vue'
  406. //0.页面依赖 end ---------------------------------------->
  407. //1.获得路由id start ---------------------------------------->
  408. const route = useRoute();
  409. const articleId = parseInt(route.params.id);
  410. const targetSegment = getRoutePath(1);
  411. const targetSegment1 = getRoutePath(2);
  412. const targetSegment2 = getRoutePath(3);
  413. const parentSegment = targetSegment + '/' + targetSegment1;
  414. const allSegment = targetSegment + '/' + targetSegment1 + '/' + targetSegment2;
  415. const supply_num = ref(1)
  416. const buy_num = ref(1)
  417. const supply_buy = ref(1)
  418. //1.1 获得当前的路由id
  419. let routeId;
  420. let routeType;
  421. let navTitle = ref('')//二级导航标题
  422. let navCid = ref('')//二级导航id
  423. //通过导航路径反向查询导航id
  424. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  425. method: 'GET',
  426. query: {
  427. 'pinyin': allSegment,
  428. },
  429. });
  430. console.log("getRouteId", getRouteId);
  431. if (getRouteId.code == 200) {
  432. navTitle.value = getRouteId.data.alias
  433. navCid.value = getRouteId.data.category_id
  434. } else {
  435. console.log("获得路由id出错!", getRouteId.message)
  436. }
  437. //1.2 获取二级栏目
  438. let parent_name = ref('');//父级名称
  439. let parent_id = ref('');//父级id
  440. let parent_pinyin = ref('');//父级拼音
  441. const getRoutePName = await requestDataPromise('/web/getWebsiteRoute', {
  442. method: 'GET',
  443. query: {
  444. 'pinyin': parentSegment,
  445. },
  446. });
  447. console.log("getRoutePName", getRoutePName);
  448. if (getRoutePName.code == 200) {
  449. routeId = getRoutePName.data.category_id
  450. parent_id.value = getRoutePName.data.category_id
  451. parent_name.value = getRoutePName.data.alias
  452. routeType = getRoutePName.data.type
  453. } else {
  454. console.log("获得路由id出错!", getRoutePName.message)
  455. }
  456. //1.3 获取一级栏目
  457. let p_parent_name = ref('');//父级名称
  458. let p_parent_id = ref('');//父级id
  459. let p_parent_pinyin = ref('');//父级拼音
  460. const getRoutePName_parent = await requestDataPromise('/web/getWebsiteRoute', {
  461. method: 'GET',
  462. query: {
  463. 'pinyin': targetSegment,
  464. },
  465. });
  466. console.log("getRoutePName_parent", getRoutePName_parent);
  467. if (getRoutePName_parent.code == 200) {
  468. p_parent_id.value = getRoutePName_parent.data.category_id
  469. p_parent_name.value = getRoutePName_parent.data.alias
  470. // p_parent_pinyin.value = getRoutePName_parent.data.aLIas_pinyin
  471. } else {
  472. console.log("获得路由id出错!", getRoutePName_parent.message)
  473. }
  474. //1.4 获取某个栏目
  475. const getParentId = await requestDataPromise('/web/getOneWebsiteCategory', {
  476. method: 'GET',
  477. query: {
  478. 'catid': parent_id.value,
  479. },
  480. });
  481. console.log("getParentId", getParentId);
  482. if (getParentId.code == 200) {
  483. parent_pinyin.value = getParentId.data.aLIas_pinyin
  484. } else {
  485. console.log("获得路由id出错!", getParentId.message)
  486. }
  487. //1.5是否展示有效期
  488. const getValidityTime = (shopData) => {
  489. if (shopData.islong == 1) {
  490. return "无期限"
  491. } else {
  492. if (shopData.validity) {
  493. return shopData.validity.split(' ')[0];
  494. }
  495. }
  496. }
  497. //1.获得路由id end ---------------------------------------->
  498. //2.获得模块数据 start ---------------------------------------->
  499. const pageData1 = ref([])//点击排行
  500. const pageData2 = ref([])//最新商机
  501. const pageData3 = ref([])//供应商品
  502. const pageData4 = ref([])//求购商品
  503. //创建请求数据json
  504. let getJson = [
  505. { "level": "3,0,8" },//点击排行
  506. { "level": "4,0,8" },//最新商机
  507. { "level": "5,0,6" },//供应商品
  508. { "level": "6,0,6" },//求购商品
  509. ]
  510. let jsonString = JSON.stringify(getJson)
  511. //获取所有数据
  512. async function getPageAllData() {
  513. const mkdata = await requestDataPromise('/web/getWebsiteshop', {
  514. method: 'GET',
  515. query: {
  516. 'id': jsonString,
  517. 'catid': 713,
  518. },
  519. });
  520. if (mkdata.code == 200) {
  521. //点击排行
  522. pageData1.value = mkdata.data.goods[0];
  523. //最新商机
  524. pageData2.value = mkdata.data.goods[1];
  525. //供应商品
  526. pageData3.value = mkdata.data.goods[2];
  527. //求购商品
  528. pageData4.value = mkdata.data.goods[3];
  529. } else {
  530. ElMessage.error(mkdata.message)
  531. }
  532. }
  533. getPageAllData();
  534. //2.获得模块数据 end ---------------------------------------->
  535. //4.新闻详情 start ---------------------------------------->
  536. //4.1 资讯详情
  537. const newsDetail = ref({})
  538. const routeNewsTtitle = ref("");
  539. //4.2 发布日期
  540. const time = ref("");
  541. //4.3 路径
  542. const routLevelTitle = ref("");
  543. const routLevelId = ref("");
  544. //4.4 是否展示投票
  545. const articleChoice = ref(false);
  546. //4.5 获取详情
  547. let shopImg = ref('')
  548. let shopType = ref(1)
  549. async function getPageData() {
  550. const mkdata = await requestDataPromise('/web/getWebsiteshopInfo', {
  551. method: 'GET',
  552. query: {
  553. 'id': articleId
  554. },
  555. });
  556. if (mkdata.code == 200) {
  557. //判断是否显示投票
  558. if (mkdata.data.is_survey == 1) {
  559. console.log("本篇文章含有投票!")
  560. articleChoice.value = true;
  561. }
  562. //获取内容
  563. newsDetail.value = mkdata.data;
  564. shopType.value = mkdata.data.type_id
  565. //获取路径
  566. routLevelTitle.value = newsDetail.value.cat_name;
  567. routLevelId.value = newsDetail.value.category_id;
  568. shopImg.value = mkdata.data.imgurl[0]
  569. //获取发布时间
  570. time.value = newsDetail.value.updated_at.split(' ')[0];
  571. //修正标题长度
  572. if (newsDetail.value.name.length >= 20) {
  573. routeNewsTtitle.value = newsDetail.value.name.substr(0, 20) + "...";
  574. } else {
  575. routeNewsTtitle.value = newsDetail.value.name
  576. }
  577. } else {
  578. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  579. // console.log("错误位置:获取详情内容")
  580. // console.log("后端错误反馈:", mkdata.message)
  581. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  582. }
  583. }
  584. getPageData();
  585. //4.新闻详情 end ---------------------------------------->
  586. //5.广告 start ---------------------------------------->
  587. let adImg1 = ref([]);
  588. let adImg2 = ref([]);
  589. onMounted(async () => {
  590. const { $webUrl, $CwebUrl } = useNuxtApp();
  591. //广告1
  592. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_detail_0001`
  593. const responseAd1 = await fetch(url, {
  594. headers: {
  595. 'Content-Type': 'application/json',
  596. 'Userurl': $CwebUrl,
  597. 'Origin': $CwebUrl
  598. }
  599. });
  600. const resultAd1 = await responseAd1.json();
  601. adImg1.value = resultAd1.data[0];
  602. //广告2
  603. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_detail_0002`
  604. const responseAd2 = await fetch(url2, {
  605. headers: {
  606. 'Content-Type': 'application/json',
  607. 'Userurl': $CwebUrl,
  608. 'Origin': $CwebUrl
  609. }
  610. });
  611. const resultAd2 = await responseAd2.json();
  612. adImg2.value = resultAd2.data[0];
  613. })
  614. //5.广告 end ---------------------------------------->
  615. //6.设置seo信息 start---------------------------------------->
  616. const setData = await requestDataPromise('/web/getWebsiteCategoryHead', {
  617. method: 'GET',
  618. query: {
  619. 'catid': routeId
  620. },
  621. });
  622. if (setData.code == 200) {
  623. let seoTitle = newsDetail.value.name;
  624. let seoDescription = setData.data.seo_description;
  625. let seoKeywords = setData.data.seo_keywords;
  626. let seoSuffix = setData.data.suffix;
  627. let seoName = setData.data.website_name;
  628. useSeoMeta({
  629. title: seoTitle + "_" + seoSuffix,
  630. meta: [
  631. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  632. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  633. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  634. ]
  635. });
  636. } else {
  637. console.log("设置频道页SEO出错!", setData.message)
  638. }
  639. //6.设置seo信息 end---------------------------------------->
  640. //8.页面图片放大 start---------------------------------------->
  641. const previewVisible = ref(false)
  642. const selectedImage = ref(' ')
  643. const openPreview = (event) => {
  644. if (event.target.tagName === 'IMG') {
  645. selectedImage.value = event.target.src;
  646. previewVisible.value = true;
  647. }
  648. }
  649. const closePreview = () => {
  650. previewVisible.value = false;
  651. }
  652. //8.页面图片放大 end---------------------------------------->
  653. </script>
  654. <style lang="less" scoped>
  655. @import url('@/assets/css/shop/goodsDetail.less');
  656. @import url('@/assets/css/shop/goodsDetail1.less');
  657. </style>
  658. <style lang="less" scoped>
  659. @media screen and (min-width:801px){/*pc*/
  660. .pc_none{display:none;}
  661. }
  662. @media screen and (max-width:800px){/*ipad_phone*/
  663. .index_main{width:100%;margin-bottom:0px;}
  664. .breadcrumb_box{
  665. height:22px;width:100%;margin:10px auto;
  666. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  667. width:92%;
  668. font-size:14px;
  669. color:#666;
  670. *{
  671. font-size:14px;
  672. display:inline ;
  673. color:#666;
  674. line-height:22px;height:22px;
  675. margin-right:5px;
  676. }
  677. }
  678. .index_2{width:92%;margin:0px auto 0px;}
  679. .index_2_img{width:auto;max-width:100%;height:302px;margin:0px auto 0px;float:none;display:block;border-radius:8px;}
  680. .index_2_left{width:100%;margin:0px auto 0px;float:none;}
  681. .index_2_h4{font-size:16px;line-height:26px;margin-top:11px;border:0px;padding-bottom:0px;}
  682. .index_2_title{font-size:14px;margin-right:10px;}
  683. .index_2_li{margin-bottom:20px;width:49%;}
  684. .index_2_li:nth-of-type(odd){float:left;}
  685. .index_2_li:nth-of-type(even){float:right;}
  686. .index_2_li:nth-of-type(-n+2){width:100%;}
  687. .index_2_li .index_2_li_label{line-height:18px;height:18px;font-size:14px;
  688. min-width:auto;margin-right:8px;}
  689. .index_2_li .index_2_li_text{line-height:18px;font-size:14px;flex:1;
  690. word-wrap: break-word;
  691. overflow-wrap: break-word;
  692. white-space: pre-wrap;
  693. word-break: break-all;
  694. }
  695. .index_2_li:nth-of-type(n+3) .index_2_li_text{ height:18px;
  696. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  697. }
  698. .index_3{width:92%;margin:0px auto 0px;}
  699. .phone_box_1_head{
  700. width:100%;margin:0px auto 0px;
  701. height:50px;line-height:50px;
  702. background:#fff;border-bottom:1px solid #E6E6E6;
  703. a{
  704. float:left;height:50px;line-height:50px;margin:0;position:relative;
  705. color:#333;font-size:15px; font-weight:bold;box-sizing:border-box;
  706. position:relative;padding-left:30px;
  707. }
  708. a.a_choice_only{
  709. color:#a91b33;
  710. }
  711. a:nth-child(1){
  712. background: url(@/public/shop/01.png) no-repeat left center;
  713. background-size: 8px 12px;
  714. padding-left:15px;
  715. }
  716. }
  717. .phone_box_1{
  718. margin:0px auto 0px;
  719. .phone_box_1_text *,.phone_box_1_text{
  720. font-size:16px!important;line-height:26px!important;margin-top:15px!important;
  721. }
  722. }
  723. .phone_box_2{
  724. margin:0px auto 0px;
  725. .phone_box_2_text{
  726. margin-top:15px;
  727. p{
  728. display:block;font-size:16px;line-height:26px;margin-top:5px;
  729. }
  730. }
  731. .phone_box_2_li{
  732. display:flex;margin-bottom:10px;
  733. }
  734. .phone_box_2_li_label{
  735. line-height:24px;height:24px;font-size:16px;
  736. margin-right:8px;
  737. }
  738. .phone_box_2_li_text{
  739. line-height:24px;font-size:16px;flex:1;
  740. word-wrap: break-word;
  741. overflow-wrap: break-word;
  742. white-space: pre-wrap;
  743. word-break: break-all;
  744. }
  745. }
  746. .phone_box_3{
  747. margin:0px auto 0px;
  748. .phone_box_3_img_ul{
  749. img{
  750. display:block;
  751. margin-top:15px;
  752. width:100%;
  753. }
  754. }
  755. }
  756. .phone_4_box{
  757. width:94%;margin:30px auto 30px;border:solid 1px #ddd; min-height:498px;
  758. .phone_head{height:33px;background:#f8f8f8;border-bottom:solid 1px #ddd;}
  759. .phone_head_a{float:left;height:100%;line-height:33px;font-size:14px;font-weight:bold;
  760. color:#a91b33;margin-left:10px;}
  761. .phone_img_ul{margin:15px auto 0px;width:96%;}
  762. .phone_img_li{width:49%;margin-bottom:15px;}
  763. .phone_img_li:nth-of-type(odd){float:left;}
  764. .phone_img_li:nth-of-type(even){float:right;}
  765. .phone_img_li_a{display:block;width:100%;}
  766. .phone_img_li_img_box{width:100%;}
  767. .phone_img_li_img{display:block;width:100%;height:44vw;}
  768. .phone_img_li_dot2{text-align:center;height:10vw;line-height:5vw;
  769. color:#333;font-size:4vw;width:100%;
  770. margin-top:6px;
  771. }
  772. }
  773. .phone_5_box{
  774. width:94%;margin:30px auto 30px;border:solid 1px #ddd; min-height:670px;
  775. .phone_head{height:33px;background:#f8f8f8;border-bottom:solid 1px #ddd;}
  776. .phone_head_a{float:left;height:100%;line-height:33px;font-size:14px;font-weight:bold;
  777. color:#a91b33;margin-left:10px;}
  778. .phone_img_ul{margin:15px auto 0px;width:96%;}
  779. .phone_img_li{width:49%;margin-bottom:15px;}
  780. .phone_img_li:nth-of-type(odd){float:left;}
  781. .phone_img_li:nth-of-type(even){float:right;}
  782. .phone_img_li_a{display:block;width:100%;}
  783. .phone_img_li_img_box{width:100%;}
  784. .phone_img_li_img{display:block;width:100%;height:44vw;}
  785. .phone_img_li_dot2{text-align:center;height:10vw;line-height:5vw;
  786. color:#333;font-size:4vw;width:100%;
  787. margin-top:6px;
  788. }
  789. }
  790. .phone_none{display:none;}
  791. }
  792. </style>