detail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  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>
  17. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  18. </el-breadcrumb-item>
  19. <el-breadcrumb-item>
  20. <NuxtLink :to="`list-1.html`"> {{ routLevelTitle }}</NuxtLink>
  21. </el-breadcrumb-item>
  22. <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
  23. </el-breadcrumb>
  24. </div>
  25. </div>
  26. <!-- 资讯列表 -->
  27. <div class="newsDetail">
  28. <div class="inner">
  29. <div class="innerLeft">
  30. <div class="LeftTop">
  31. <h1>{{ newsDetail.title }}</h1>
  32. <p>
  33. 来源: <span>{{ newsDetail.copyfrom }}</span>
  34. 作者: <span>{{ newsDetail.author }}</span>
  35. 发布时间: <span>{{ time }}</span>
  36. </p>
  37. <!-- <img :src="newsDetail.imgurl" v-if="newsDetail.imgurl&&newsDetail.level==2||newsDetail.level==3"> -->
  38. </div>
  39. <!-- <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content"></div> -->
  40. <div
  41. class="leftBottom"
  42. v-html="newsDetail.content"
  43. v-if="newsDetail.content"
  44. @click="openPreview">
  45. </div>
  46. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  47. <img :src="selectedImage" alt="Preview">
  48. </div>
  49. <!-- 免责声明: -->
  50. <div class="disclaimer" v-if="newsDetail.copyfrom!='本网'">
  51. <p>原文链接:{{ newsDetail.fromurl }}</p>
  52. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  53. </div>
  54. <div v-if="articleChoice">
  55. <!-- 投票 start ---------------------------------------->
  56. <div class="index_3_box_vote" v-if="articleChoice">
  57. <div class="voteTitle">投票区</div>
  58. <div class="inquire">
  59. <p v-if="voteList.length>0">{{voteList[0].survey_name}}</p>
  60. <div class="radioBox">
  61. <!--投票选项-->
  62. <div v-if="!isDisabled">
  63. <div class="radio" v-if="isRadio">
  64. <el-radio-group v-model="radio1" @change="handleRadioChange">
  65. <el-radio v-for="item in voteList" :key="item.id" :value="item.id" size="large">
  66. <span v-if="item.is_other == 0">{{item.choice_name}}</span>
  67. <span v-else>其他</span>
  68. </el-radio>
  69. </el-radio-group>
  70. <el-input
  71. v-if="showUserChoice"
  72. v-model="userChoice"
  73. :rows="2"
  74. type="textarea"
  75. resize="none"
  76. placeholder="请输入.."
  77. />
  78. </div>
  79. <div class="checkInputBox" v-else>
  80. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  81. <span v-for="item in voteList" :key="item.id">
  82. <span v-if="item.is_other == 0">
  83. <el-checkbox size="large" :label="item.choice_name" :value="item.id"/>
  84. </span>
  85. <span v-else>
  86. <el-checkbox size="large" label="其他" :value="item.id"/>
  87. </span>
  88. </span>
  89. </el-checkbox-group>
  90. <el-input
  91. v-if="showUserChoice"
  92. v-model="userChoice"
  93. :rows="2"
  94. type="textarea"
  95. resize="none"
  96. placeholder="请输入.."
  97. />
  98. </div>
  99. </div>
  100. <!--投票结果-->
  101. <div class="inquireData" v-else>
  102. <div v-for="item in websiteSurveyData.data" :key="item.id">
  103. <div class="inquireDataItem active" v-if="item.status == 1">
  104. <div class="inquireDataItemTitle">
  105. <span v-if="item.choice_name == ''">其他</span>
  106. <span v-else>{{item.choice_name}}</span>
  107. </div>
  108. <div class="inquireDataItemNum">{{item.results}}票</div>
  109. </div>
  110. <div class="inquireDataItem" v-else>
  111. <div class="inquireDataItemTitle">
  112. <span v-if="item.choice_name == ''">其他</span>
  113. <span v-else>{{item.choice_name}}</span>
  114. </div>
  115. <div class="inquireDataItemNum">{{item.results}}票</div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div class="btn">
  121. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled" v-if="!isDisabled">投票</button>
  122. </div>
  123. </div>
  124. </div>
  125. <!-- 投票 end ---------------------------------------->
  126. </div>
  127. </div>
  128. <div class="innerRight">
  129. <!-- 热点资讯1 -->
  130. <div class="hotList1">
  131. <DetailHotNews></DetailHotNews>
  132. </div>
  133. <!-- 热点资讯2 -->
  134. <div class="hotList2">
  135. <DetailHotNews2></DetailHotNews2>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <!-- 页面底部 -->
  141. <HomeFoot1></HomeFoot1>
  142. </template>
  143. <script setup>
  144. //1.页面依赖 start ---------------------------------------->
  145. import { onMounted } from 'vue'
  146. import { ElBreadcrumb, ElBreadcrumbItem,ElRadio, ElRadioGroup,ElCheckbox,ElCheckboxGroup,ElMessage,ElInput } from 'element-plus'
  147. import { ArrowRight } from '@element-plus/icons-vue'
  148. const nuxtApp = useNuxtApp();
  149. const axios = nuxtApp.$axios;
  150. //1.1 获得跳转过来的id
  151. const route = useRoute();
  152. const articleId = parseInt(route.params.id); //获得该页面的id
  153. //1.2 获得父级栏目的名称、id
  154. //获得当前的完整路径
  155. const fullPath = route.path;
  156. //拆分,取出来中间这一段,然后提取数字部分
  157. const segments = fullPath.split('/');
  158. const targetSegment = segments[1];
  159. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  160. // const routeId = numberPart;
  161. let routeId;
  162. //通过导航路径反向查询导航id
  163. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  164. method: 'GET',
  165. query: {
  166. 'pinyin': targetSegment,
  167. },
  168. });
  169. if(getRouteId.code == 200){
  170. routeId = getRouteId.data.category_id
  171. }else{
  172. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  173. console.log("错误位置:通过url路径查询导航池id")
  174. console.log("后端错误反馈:",getRouteId.message)
  175. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  176. }
  177. //面包屑导航
  178. const parent_name = ref("");
  179. const parent_id = ref("");
  180. const parent_pinyin = ref("");
  181. let getParentNav = async () => {
  182. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  183. method: 'GET',
  184. query: {
  185. 'catid': routeId
  186. },
  187. });
  188. if (listData.code == 200) {
  189. parent_name.value = listData.data.alias;
  190. parent_id.value = listData.data.parent_id;
  191. parent_pinyin.value = listData.data.aLIas_pinyin;
  192. } else {
  193. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  194. console.log("错误位置:获取面包屑导航")
  195. console.log("后端错误反馈:", listData.message)
  196. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  197. }
  198. }
  199. //获得父级栏目详情
  200. getParentNav();
  201. //1.页面依赖 end ---------------------------------------->
  202. //2.页面数据 start ---------------------------------------->
  203. //2.1 资讯详情
  204. const newsDetail = ref({})
  205. const routeNewsTtitle = ref("");
  206. //2.2 发布日期
  207. const time = ref("");
  208. //2.3 路径
  209. const routLevelTitle = ref("");
  210. const routLevelId = ref("");
  211. //是否展示投票
  212. const articleChoice = ref(false);
  213. //2.4获取详情
  214. async function getPageData() {
  215. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  216. method: 'GET',
  217. query: {
  218. 'articleid': articleId
  219. },
  220. });
  221. if(mkdata.code==200){
  222. //判断是否显示投票
  223. if(mkdata.data.is_survey==1){
  224. console.log("本篇文章含有投票!")
  225. articleChoice.value = true;
  226. getVoteList();
  227. }
  228. //获取内容
  229. newsDetail.value = mkdata.data;
  230. //获取路径
  231. routLevelTitle.value = newsDetail.value.cat_name;
  232. routLevelId.value = newsDetail.value.category_id;
  233. //获取发布时间
  234. time.value = newsDetail.value.updated_at.split(' ')[0];
  235. //修正标题长度
  236. if (newsDetail.value.title.length >= 30) {
  237. routeNewsTtitle.value = newsDetail.value.title.substr(0, 30) + "...";
  238. } else {
  239. routeNewsTtitle.value = newsDetail.value.title
  240. }
  241. }else{
  242. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  243. console.log("错误位置:获取详情内容")
  244. console.log("后端错误反馈:",mkdata.message)
  245. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  246. }
  247. }
  248. getPageData();
  249. //2.5 获得广告
  250. //广告列表
  251. let adImg1 = ref([]);
  252. // async function getAdData(){
  253. // const adData = await requestDataPromise('/web/getWebsiteAdvertisement',{method:'GET',query:{'ad_tag':'DETAIL'}});
  254. // if(adData.code==200){
  255. // for(let item of adData.data){
  256. // if(item.ad_tag == 'DETAIL_0001'){
  257. // adImg1.value = item;
  258. // }
  259. // }
  260. // }else{
  261. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  262. // console.log("错误位置:获取详情页广告列表")
  263. // console.log("后端错误反馈:",adData.message)
  264. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  265. // }
  266. // }
  267. // getAdData();
  268. onMounted(async () => {
  269. const { $webUrl, $CwebUrl } = useNuxtApp();
  270. //广告1
  271. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  272. const responseAd1 = await fetch(url, {
  273. headers: {
  274. 'Content-Type': 'application/json',
  275. 'Userurl': $CwebUrl,
  276. 'Origin': $CwebUrl
  277. }
  278. });
  279. const resultAd1 = await responseAd1.json();
  280. adImg1.value = resultAd1.data[0];
  281. })
  282. //2.页面数据 end ---------------------------------------->
  283. //3.设置seo信息 start---------------------------------------->
  284. //3.1 设置seo信息
  285. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  286. method: 'GET',
  287. query: {
  288. 'articleid': articleId
  289. },
  290. });
  291. if(setData.code==200){
  292. let seoTitle = setData.data.title;
  293. let seoDescription = setData.data.introduce;
  294. let seoKeywords = setData.data.keyword;
  295. let seoSuffix = setData.data.suffix;
  296. let seoName = setData.data.website_name;
  297. useSeoMeta({
  298. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  299. meta: [
  300. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  301. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 }
  302. ]
  303. });
  304. }else{
  305. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  306. console.log("错误位置:设置详情页面SEO数据")
  307. console.log("后端错误反馈:",setData.message)
  308. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  309. }
  310. //3.设置seo信息 end---------------------------------------->
  311. //4.投票 start---------------------------------------->
  312. const radio1 = ref(''); //单选
  313. const check1 = ref([]); //多选
  314. const isDisabled = ref(false);//是否禁用提交按钮
  315. const isRadio = ref(true);//是否渲染单选
  316. const userSurId = ref('');//投票属于哪一篇文章
  317. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  318. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  319. const showUserChoice = ref(false);//是否显示其他输入框
  320. const websiteSurveyData = ref([]);//投票结果
  321. //3.2获得投票列表
  322. let voteList = ref([]);
  323. async function getVoteList(){
  324. const voteData = await requestHome('/web/getWebsiteSurvey',{method:'GET',query:{'art_id':articleId}});
  325. console.log(778899)
  326. console.log(voteData)
  327. if(voteData.code == 200){
  328. voteList.value = voteData.data;
  329. console.log(voteList.value)
  330. //判断显示单选还是多选
  331. //survey_type 0是单选 1是多选
  332. if(voteData.data[0].survey_type == 0){
  333. isRadio.value = true;
  334. console.log("1111")
  335. }else{
  336. isRadio.value = false;
  337. }
  338. //把最后一个的值拿出来 用于判断用户是否选择了其他
  339. for(let item of voteData.data){
  340. //如果含有其他
  341. if(item.is_other==1){
  342. userIsChoice.value = item.id;
  343. }
  344. }
  345. //用户投票属于哪一篇文章
  346. userSurId.value = voteData.data[0].sur_id;
  347. }else{
  348. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  349. console.log("错误位置:首页投票")
  350. console.log("后端错误反馈:",voteData.message)
  351. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  352. }
  353. }
  354. //3.2当用户选择了选项,判断是否展示其他输入框
  355. const handleRadioChange = (value) => {
  356. if(value == userIsChoice.value){
  357. showUserChoice.value = true;
  358. }else{
  359. showUserChoice.value = false;
  360. }
  361. }
  362. const handleCheckboxChange = (value) => {
  363. if (value.includes(userIsChoice.value)) {
  364. showUserChoice.value = true;
  365. } else {
  366. showUserChoice.value = false;
  367. }
  368. }
  369. //3.2发起投票
  370. async function addWebsiteSurvey(){
  371. //判断当前是单选还是多选
  372. console.log(isRadio.value)
  373. if(isRadio.value){
  374. console.log("用户单选!")
  375. if(radio1.value!=''){
  376. //先判断一下是否使用了其他选项
  377. if(showUserChoice.value){
  378. if(userChoice.value!=''){
  379. //文章id
  380. // console.log(userSurId.value)
  381. // 用户输入的值
  382. // console.log(userChoice.value)
  383. //如果使用了其他,其他的选项需要增加进去
  384. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption',{
  385. method:'GET',
  386. query:{
  387. 'sur_id':userSurId.value,//投票的新闻id
  388. 'choice_name':userChoice.value,//投票的选项id
  389. }
  390. });
  391. if(ChoiceData.code == 200){
  392. //提交完其他选项以后,再正式发起投票
  393. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  394. method:'GET',
  395. query:{
  396. 'sur_id':userSurId.value,
  397. 'choice_id':ChoiceData.data
  398. }
  399. });
  400. if(mkData.code == 200){
  401. ElMessage.success('投票成功!')
  402. //把投票结果显示到页面上 禁用投票按钮
  403. isDisabled.value = true;
  404. websiteSurveyData.value = mkData.data;
  405. //遍历一下,把用户选中的那个设置status为1
  406. let data = mkData.data;
  407. //遍历一下,把用户选中的那个设置status为1
  408. for(let item of data.data){
  409. for(let i of data.choice){
  410. if(item.id == i){
  411. console.log(item.id)
  412. item.status = 1;
  413. }
  414. }
  415. }
  416. websiteSurveyData.value = data;
  417. }else{
  418. ElMessage.error(mkData.message)
  419. }
  420. }else{
  421. ElMessage.error('其他投票失败!')
  422. }
  423. }else{
  424. ElMessage.error('请输入选项内容!')
  425. }
  426. }else{
  427. //如果没选择其他,直接提交选择的内容
  428. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  429. method:'GET',
  430. query:{
  431. 'sur_id':userSurId.value,
  432. 'choice_id':radio1.value
  433. }
  434. });
  435. if(mkData.code == 200){
  436. ElMessage.success('投票成功!')
  437. //把投票结果显示到页面上 禁用投票按钮
  438. isDisabled.value = true;
  439. let data = mkData.data;
  440. //遍历一下,把用户选中的那个设置status为1
  441. for(let item of data.data){
  442. for(let i of data.choice){
  443. if(item.id == i){
  444. item.status = 1;
  445. }
  446. }
  447. }
  448. websiteSurveyData.value = data;
  449. }else{
  450. ElMessage.error('投票失败!')
  451. }
  452. }
  453. }else{
  454. ElMessage.error('请选择一个选项')
  455. }
  456. }else{
  457. console.log("多选!")
  458. //多选
  459. if(check1.value!=[]){
  460. //先判断一下是否使用了其他选项
  461. if(showUserChoice.value){
  462. if(userChoice.value!=''){
  463. //判断用户是否只选择了一个其他
  464. if(check1.value.length == 1){
  465. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  466. method:'GET',
  467. query:{
  468. 'sur_id':userSurId.value,//投票的新闻id
  469. 'choice_name':userChoice.value,//用户输入的其他选项文字
  470. }
  471. });
  472. if(ChoiceData.code == 200){
  473. //提交完其他选项以后,再正式发起投票
  474. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  475. method:'GET',
  476. query:{
  477. 'sur_id':userSurId.value,
  478. 'choice_id':ChoiceData.data
  479. }
  480. });
  481. if(mkData.code == 200){
  482. ElMessage.success('投票成功!')
  483. //把投票结果显示到页面上 禁用投票按钮
  484. isDisabled.value = true;
  485. websiteSurveyData.value = mkData.data;
  486. //遍历一下,把用户选中的那个设置status为1
  487. let data = mkData.data;
  488. //遍历一下,把用户选中的那个设置status为1
  489. for(let item of data.data){
  490. for(let i of data.choice){
  491. if(item.id == i){
  492. console.log(item.id)
  493. item.status = 1;
  494. }
  495. }
  496. }
  497. websiteSurveyData.value = data;
  498. }else{
  499. ElMessage.error(mkData.message)
  500. }
  501. }else{
  502. ElMessage.error('其他投票失败!')
  503. }
  504. }else{
  505. //用户选择了除了其他以外,还包括别的选项
  506. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  507. method:'GET',
  508. query:{
  509. 'sur_id':userSurId.value,//投票的新闻id
  510. 'choice_name':userChoice.value,//用户输入的其他选项文字
  511. }
  512. });
  513. if(ChoiceData.code == 200){
  514. let data = check1.value;
  515. //找到多选的数组,把其他默认值给替换掉
  516. for (let i = 0; i < data.length; i++) {
  517. if (data[i] == userIsChoice.value) {
  518. data[i] = ChoiceData.data;
  519. }
  520. }
  521. let jsonArray = JSON.stringify(data);
  522. //提交完其他选项以后,再正式发起投票
  523. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  524. method:'GET',
  525. query:{
  526. 'sur_id':userSurId.value,
  527. 'choice_id':jsonArray
  528. }
  529. });
  530. if(mkData.code == 200){
  531. ElMessage.success('投票成功!')
  532. //把投票结果显示到页面上 禁用投票按钮
  533. isDisabled.value = true;
  534. websiteSurveyData.value = mkData.data;
  535. //遍历一下,把用户选中的那个设置status为1
  536. let data = mkData.data;
  537. //遍历一下,把用户选中的那个设置status为1
  538. for(let item of data.data){
  539. for(let i of data.choice){
  540. if(item.id == i){
  541. //console.log(item.id)
  542. item.status = 1;
  543. }
  544. }
  545. }
  546. websiteSurveyData.value = data;
  547. }else{
  548. ElMessage.error(mkData.message)
  549. }
  550. }else{
  551. ElMessage.error('其他投票失败!')
  552. }
  553. }
  554. }else{
  555. ElMessage.error('请输入选项内容!')
  556. }
  557. }else{
  558. let jsonArray = JSON.stringify(check1.value);
  559. //如果没选择其他,直接提交选择的内容
  560. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  561. method:'GET',
  562. query:{
  563. 'sur_id':userSurId.value,
  564. 'choice_id':jsonArray
  565. }
  566. });
  567. if(mkData.code == 200){
  568. ElMessage.success('投票成功!')
  569. //把投票结果显示到页面上 禁用投票按钮
  570. isDisabled.value = true;
  571. websiteSurveyData.value = mkData.data;
  572. //遍历一下,把用户选中的那个设置status为1
  573. let data = mkData.data;
  574. //遍历一下,把用户选中的那个设置status为1
  575. for(let item of data.data){
  576. for(let i of data.choice){
  577. if(item.id == i){
  578. console.log(item.id)
  579. item.status = 1;
  580. }
  581. }
  582. }
  583. websiteSurveyData.value = data;
  584. }else{
  585. ElMessage.error('投票失败!')
  586. }
  587. }
  588. }else{
  589. ElMessage.error('请选择一个选项')
  590. }
  591. }
  592. }
  593. //4.投票 end---------------------------------------->
  594. //5.页面图片放大 start---------------------------------------->
  595. const previewVisible = ref(false)
  596. const selectedImage = ref(' ')
  597. const openPreview = (event) => {
  598. if (event.target.tagName === 'IMG') {
  599. selectedImage.value = event.target.src;
  600. previewVisible.value = true;
  601. }
  602. }
  603. const closePreview = () => {
  604. previewVisible.value = false;
  605. }
  606. //5.页面图片放大 end---------------------------------------->
  607. </script>
  608. <style lang="less" scoped>
  609. @import url('@/assets/css/detail.less');
  610. </style>