detail.vue 38 KB

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