detail.vue 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation></HomePageNavigation>
  6. <!-- 面包屑导航 -->
  7. <div class="breadcrumb-box">
  8. <div class="inner">
  9. <span class="location">当前位置:</span>
  10. <el-breadcrumb :separator-icon="ArrowRight">
  11. <el-breadcrumb-item>
  12. <NuxtLink to="/">首页</NuxtLink>
  13. </el-breadcrumb-item>
  14. <el-breadcrumb-item>
  15. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  16. </el-breadcrumb-item>
  17. <el-breadcrumb-item>
  18. <NuxtLink :to="`list-1.html`"> {{ routLevelTitle }}</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item class="phone_breadcrumb_text">
  21. {{ routeNewsTtitle }}
  22. </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 class="pc_none">
  33. <span>时间:{{ time }}</span>
  34. <span>来源:{{ newsDetail.copyfrom }}</span>
  35. <span>作者:{{ newsDetail.author }}</span>
  36. </p>
  37. </div>
  38. <div
  39. class="leftBottom"
  40. v-html="newsDetail.content"
  41. v-if="newsDetail.content"
  42. @click="openPreview">
  43. </div>
  44. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  45. <img :src="selectedImage" alt="Preview">
  46. </div>
  47. <!-- 免责声明: -->
  48. <div class="disclaimer" v-if="newsDetail.copyfrom!='本网'">
  49. <p>原文链接:{{ newsDetail.fromurl }}</p>
  50. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  51. </div>
  52. <div v-if="articleChoice">
  53. <!--投票-->
  54. <div class="index_3_box_vote" v-if="articleChoice">
  55. <div class="voteTitle">投票区</div>
  56. <div class="inquire">
  57. <p v-if="voteList.length>0">{{voteList[0].survey_name}}</p>
  58. <div class="radioBox">
  59. <!--投票选项-->
  60. <div v-if="!isDisabled">
  61. <div class="radio" v-if="isRadio">
  62. <el-radio-group v-model="radio1" @change="handleRadioChange">
  63. <el-radio v-for="item in voteList" :key="item.id" :value="item.id" size="large">
  64. <span v-if="item.is_other == 0">{{item.choice_name}}</span>
  65. <span v-else>其他</span>
  66. </el-radio>
  67. </el-radio-group>
  68. <el-input
  69. v-if="showUserChoice"
  70. v-model="userChoice"
  71. :rows="2"
  72. type="textarea"
  73. resize="none"
  74. placeholder="请输入.."
  75. />
  76. </div>
  77. <div class="checkInputBox" v-else>
  78. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  79. <span v-for="item in voteList" :key="item.id">
  80. <span v-if="item.is_other == 0">
  81. <el-checkbox size="large" :label="item.choice_name" :value="item.id"/>
  82. </span>
  83. <span v-else>
  84. <el-checkbox size="large" label="其他" :value="item.id"/>
  85. </span>
  86. </span>
  87. </el-checkbox-group>
  88. <el-input
  89. v-if="showUserChoice"
  90. v-model="userChoice"
  91. :rows="2"
  92. type="textarea"
  93. resize="none"
  94. placeholder="请输入.."
  95. />
  96. </div>
  97. </div>
  98. <!--投票结果-->
  99. <div class="inquireData" v-else>
  100. <div v-for="item in websiteSurveyData.data" :key="item.id">
  101. <div class="inquireDataItem active" v-if="item.status == 1">
  102. <div class="inquireDataItemTitle">
  103. <span v-if="item.choice_name == ''">其他</span>
  104. <span v-else>{{item.choice_name}}</span>
  105. </div>
  106. <div class="inquireDataItemNum">{{item.results}}票</div>
  107. </div>
  108. <div class="inquireDataItem" v-else>
  109. <div class="inquireDataItemTitle">
  110. <span v-if="item.choice_name == ''">其他</span>
  111. <span v-else>{{item.choice_name}}</span>
  112. </div>
  113. <div class="inquireDataItemNum">{{item.results}}票</div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="btn">
  119. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled" v-if="!isDisabled">投票</button>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <!--推荐阅读-->
  125. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  126. <div class="recommendReadTitle">
  127. <span class="read_title">
  128. 推荐阅读
  129. </span>
  130. </div>
  131. <div class="recommendReadList">
  132. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  133. :key="item.id">
  134. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  135. {{ item.title }}
  136. </a>
  137. </div>
  138. </div>
  139. </div>
  140. <!--上一篇 下一篇-->
  141. <div class="prevNext">
  142. <NuxtLink to="/">上一篇:李强签署国务院令 公布《行政执法监督条例》</NuxtLink>
  143. <NuxtLink to="/">下一篇:没有了</NuxtLink>
  144. </div>
  145. </div>
  146. <div class="innerRight">
  147. <!-- 热点资讯1 -->
  148. <!-- <div class="hotList1">
  149. <DetailHotNews></DetailHotNews>
  150. </div> -->
  151. <!-- 热点资讯2 -->
  152. <div class="hotList2">
  153. <DetailHotNews2></DetailHotNews2>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. <!-- 页面底部 -->
  159. <HomeFoot></HomeFoot>
  160. </template>
  161. <script setup>
  162. //1.页面依赖 start ---------------------------------------->
  163. import { onMounted } from 'vue'
  164. import { ElBreadcrumb, ElBreadcrumbItem,ElRadio, ElRadioGroup,ElCheckbox,ElCheckboxGroup,ElMessage,ElInput } from 'element-plus'
  165. import { ArrowRight } from '@element-plus/icons-vue'
  166. const nuxtApp = useNuxtApp();
  167. const axios = nuxtApp.$axios;
  168. //1.1 获得跳转过来的id
  169. const route = useRoute();
  170. const articleId = parseInt(route.params.id); //获得该页面的id
  171. //1.2 获得父级栏目的名称、id
  172. //获得当前的完整路径
  173. const fullPath = route.path;
  174. // //拆分,取出来中间这一段,然后提取数字部分
  175. // const segments = fullPath.split('/');
  176. // const targetSegment = segments[1];
  177. const targetSegment = getRoutePath(1);
  178. const targetSegment1 = getRoutePath(2);
  179. const targetSegment2 = getRoutePath(3);
  180. // const numberPart = targetSegment.match(/\d+$/)?.[0];
  181. // const routeId = numberPart;
  182. let routeId;
  183. //通过导航路径反向查询导航id
  184. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  185. method: 'GET',
  186. query: {
  187. 'pinyin': targetSegment+'/'+targetSegment1,
  188. },
  189. });
  190. if(getRouteId.code == 200){
  191. routeId = getRouteId.data.category_id
  192. }else{
  193. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  194. console.log("错误位置:通过url路径查询导航池id")
  195. console.log("后端错误反馈:",getRouteId.message)
  196. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  197. }
  198. //面包屑导航
  199. const parent_name = ref("");
  200. const parent_id = ref("");
  201. const parent_pinyin = ref("");
  202. let getParentNav = async () => {
  203. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  204. method: 'GET',
  205. query: {
  206. 'catid': routeId
  207. },
  208. });
  209. console.log("获取面包屑导航",listData);
  210. if (listData.code == 200) {
  211. parent_name.value = listData.data.parent_name;
  212. parent_id.value = listData.data.parent_id;
  213. parent_pinyin.value = listData.data.parent_pinyin;
  214. } else {
  215. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  216. console.log("错误位置:获取面包屑导航")
  217. console.log("后端错误反馈:", listData.message)
  218. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  219. }
  220. }
  221. //获得父级栏目详情
  222. getParentNav();
  223. //1.页面依赖 end ---------------------------------------->
  224. //2.页面数据 start ---------------------------------------->
  225. //2.1 资讯详情
  226. const newsDetail = ref({})
  227. const routeNewsTtitle = ref("");
  228. //2.2 发布日期
  229. const time = ref("");
  230. //2.3 路径
  231. const routLevelTitle = ref("");
  232. const routLevelId = ref("");
  233. //是否展示投票
  234. const articleChoice = ref(false);
  235. //2.4获取详情
  236. async function getPageData() {
  237. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  238. method: 'GET',
  239. query: {
  240. 'articleid': articleId
  241. },
  242. });
  243. if(mkdata.code==200){
  244. //判断是否显示投票
  245. if(mkdata.data.is_survey==1){
  246. console.log("本篇文章含有投票!")
  247. articleChoice.value = true;
  248. getVoteList();
  249. }
  250. //获取内容
  251. newsDetail.value = mkdata.data;
  252. //获取路径
  253. routLevelTitle.value = newsDetail.value.cat_name;
  254. routLevelId.value = newsDetail.value.category_id;
  255. //获取发布时间
  256. time.value = newsDetail.value.updated_at.split(' ')[0];
  257. //修正标题长度
  258. if (newsDetail.value.title.length >= 30) {
  259. routeNewsTtitle.value = newsDetail.value.title.substr(0, 5) + "...";
  260. } else {
  261. routeNewsTtitle.value = newsDetail.value.title
  262. }
  263. }else{
  264. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  265. // console.log("错误位置:获取详情内容")
  266. // console.log("后端错误反馈:",mkdata.message)
  267. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  268. }
  269. }
  270. getPageData();
  271. //2.5 获得广告
  272. //广告列表
  273. let adImg1 = ref([]);
  274. onMounted(async () => {
  275. const { $webUrl, $CwebUrl } = useNuxtApp();
  276. //广告1
  277. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_detail_0001`
  278. const responseAd1 = await fetch(url, {
  279. headers: {
  280. 'Content-Type': 'application/json',
  281. 'Userurl': $CwebUrl,
  282. 'Origin': $CwebUrl
  283. }
  284. });
  285. const resultAd1 = await responseAd1.json();
  286. adImg1.value = resultAd1.data[0];
  287. })
  288. //2.页面数据 end ---------------------------------------->
  289. //3.设置seo信息 start---------------------------------------->
  290. //3.1 设置seo信息
  291. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  292. method: 'GET',
  293. query: {
  294. 'articleid': articleId
  295. },
  296. });
  297. if(setData.code==200){
  298. let seoTitle = setData.data.title;
  299. let seoDescription = setData.data.introduce;
  300. let seoKeywords = setData.data.keyword;
  301. let seoSuffix = setData.data.suffix;
  302. let seoName = setData.data.website_name;
  303. useSeoMeta({
  304. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  305. meta: [
  306. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  307. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix , tagPriority: 10 },
  308. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  309. ]
  310. });
  311. }else{
  312. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  313. // console.log("错误位置:设置详情页面SEO数据")
  314. // console.log("后端错误反馈:",setData.message)
  315. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  316. }
  317. //3.设置seo信息 end---------------------------------------->
  318. //4.投票 start---------------------------------------->
  319. const radio1 = ref(''); //单选
  320. const check1 = ref([]); //多选
  321. const isDisabled = ref(false);//是否禁用提交按钮
  322. const isRadio = ref(true);//是否渲染单选
  323. const userSurId = ref('');//投票属于哪一篇文章
  324. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  325. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  326. const showUserChoice = ref(false);//是否显示其他输入框
  327. const websiteSurveyData = ref([]);//投票结果
  328. //3.2获得投票列表
  329. let voteList = ref([]);
  330. async function getVoteList(){
  331. const voteData = await requestHome('/web/getWebsiteSurvey',{method:'GET',query:{'art_id':articleId}});
  332. console.log(778899)
  333. console.log(voteData)
  334. if(voteData.code == 200){
  335. voteList.value = voteData.data;
  336. console.log(voteList.value)
  337. //判断显示单选还是多选
  338. //survey_type 0是单选 1是多选
  339. if(voteData.data[0].survey_type == 0){
  340. isRadio.value = true;
  341. console.log("1111")
  342. }else{
  343. isRadio.value = false;
  344. }
  345. //把最后一个的值拿出来 用于判断用户是否选择了其他
  346. for(let item of voteData.data){
  347. //如果含有其他
  348. if(item.is_other==1){
  349. userIsChoice.value = item.id;
  350. }
  351. }
  352. //用户投票属于哪一篇文章
  353. userSurId.value = voteData.data[0].sur_id;
  354. }else{
  355. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  356. console.log("错误位置:首页投票")
  357. console.log("后端错误反馈:",voteData.message)
  358. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  359. }
  360. }
  361. //3.2当用户选择了选项,判断是否展示其他输入框
  362. const handleRadioChange = (value) => {
  363. if(value == userIsChoice.value){
  364. showUserChoice.value = true;
  365. }else{
  366. showUserChoice.value = false;
  367. }
  368. }
  369. const handleCheckboxChange = (value) => {
  370. if (value.includes(userIsChoice.value)) {
  371. showUserChoice.value = true;
  372. } else {
  373. showUserChoice.value = false;
  374. }
  375. }
  376. //3.2发起投票
  377. async function addWebsiteSurvey(){
  378. //判断当前是单选还是多选
  379. console.log(isRadio.value)
  380. if(isRadio.value){
  381. console.log("用户单选!")
  382. if(radio1.value!=''){
  383. //先判断一下是否使用了其他选项
  384. if(showUserChoice.value){
  385. if(userChoice.value!=''){
  386. //文章id
  387. // console.log(userSurId.value)
  388. // 用户输入的值
  389. // console.log(userChoice.value)
  390. //如果使用了其他,其他的选项需要增加进去
  391. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption',{
  392. method:'GET',
  393. query:{
  394. 'sur_id':userSurId.value,//投票的新闻id
  395. 'choice_name':userChoice.value,//投票的选项id
  396. }
  397. });
  398. if(ChoiceData.code == 200){
  399. //提交完其他选项以后,再正式发起投票
  400. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  401. method:'GET',
  402. query:{
  403. 'sur_id':userSurId.value,
  404. 'choice_id':ChoiceData.data
  405. }
  406. });
  407. if(mkData.code == 200){
  408. ElMessage.success('投票成功!')
  409. //把投票结果显示到页面上 禁用投票按钮
  410. isDisabled.value = true;
  411. websiteSurveyData.value = mkData.data;
  412. //遍历一下,把用户选中的那个设置status为1
  413. let data = mkData.data;
  414. //遍历一下,把用户选中的那个设置status为1
  415. for(let item of data.data){
  416. for(let i of data.choice){
  417. if(item.id == i){
  418. console.log(item.id)
  419. item.status = 1;
  420. }
  421. }
  422. }
  423. websiteSurveyData.value = data;
  424. }else{
  425. ElMessage.error(mkData.message)
  426. }
  427. }else{
  428. ElMessage.error('其他投票失败!')
  429. }
  430. }else{
  431. ElMessage.error('请输入选项内容!')
  432. }
  433. }else{
  434. //如果没选择其他,直接提交选择的内容
  435. const mkData = await requestHome('/web/addWebsiteSurveyVote',{
  436. method:'GET',
  437. query:{
  438. 'sur_id':userSurId.value,
  439. 'choice_id':radio1.value
  440. }
  441. });
  442. if(mkData.code == 200){
  443. ElMessage.success('投票成功!')
  444. //把投票结果显示到页面上 禁用投票按钮
  445. isDisabled.value = true;
  446. let data = mkData.data;
  447. //遍历一下,把用户选中的那个设置status为1
  448. for(let item of data.data){
  449. for(let i of data.choice){
  450. if(item.id == i){
  451. item.status = 1;
  452. }
  453. }
  454. }
  455. websiteSurveyData.value = data;
  456. }else{
  457. ElMessage.error('投票失败!')
  458. }
  459. }
  460. }else{
  461. ElMessage.error('请选择一个选项')
  462. }
  463. }else{
  464. console.log("多选!")
  465. //多选
  466. if(check1.value!=[]){
  467. //先判断一下是否使用了其他选项
  468. if(showUserChoice.value){
  469. if(userChoice.value!=''){
  470. //判断用户是否只选择了一个其他
  471. if(check1.value.length == 1){
  472. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  473. method:'GET',
  474. query:{
  475. 'sur_id':userSurId.value,//投票的新闻id
  476. 'choice_name':userChoice.value,//用户输入的其他选项文字
  477. }
  478. });
  479. if(ChoiceData.code == 200){
  480. //提交完其他选项以后,再正式发起投票
  481. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  482. method:'GET',
  483. query:{
  484. 'sur_id':userSurId.value,
  485. 'choice_id':ChoiceData.data
  486. }
  487. });
  488. if(mkData.code == 200){
  489. ElMessage.success('投票成功!')
  490. //把投票结果显示到页面上 禁用投票按钮
  491. isDisabled.value = true;
  492. websiteSurveyData.value = mkData.data;
  493. //遍历一下,把用户选中的那个设置status为1
  494. let data = mkData.data;
  495. //遍历一下,把用户选中的那个设置status为1
  496. for(let item of data.data){
  497. for(let i of data.choice){
  498. if(item.id == i){
  499. console.log(item.id)
  500. item.status = 1;
  501. }
  502. }
  503. }
  504. websiteSurveyData.value = data;
  505. }else{
  506. ElMessage.error(mkData.message)
  507. }
  508. }else{
  509. ElMessage.error('其他投票失败!')
  510. }
  511. }else{
  512. //用户选择了除了其他以外,还包括别的选项
  513. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption',{
  514. method:'GET',
  515. query:{
  516. 'sur_id':userSurId.value,//投票的新闻id
  517. 'choice_name':userChoice.value,//用户输入的其他选项文字
  518. }
  519. });
  520. if(ChoiceData.code == 200){
  521. let data = check1.value;
  522. //找到多选的数组,把其他默认值给替换掉
  523. for (let i = 0; i < data.length; i++) {
  524. if (data[i] == userIsChoice.value) {
  525. data[i] = ChoiceData.data;
  526. }
  527. }
  528. let jsonArray = JSON.stringify(data);
  529. //提交完其他选项以后,再正式发起投票
  530. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  531. method:'GET',
  532. query:{
  533. 'sur_id':userSurId.value,
  534. 'choice_id':jsonArray
  535. }
  536. });
  537. if(mkData.code == 200){
  538. ElMessage.success('投票成功!')
  539. //把投票结果显示到页面上 禁用投票按钮
  540. isDisabled.value = true;
  541. websiteSurveyData.value = mkData.data;
  542. //遍历一下,把用户选中的那个设置status为1
  543. let data = mkData.data;
  544. //遍历一下,把用户选中的那个设置status为1
  545. for(let item of data.data){
  546. for(let i of data.choice){
  547. if(item.id == i){
  548. //console.log(item.id)
  549. item.status = 1;
  550. }
  551. }
  552. }
  553. websiteSurveyData.value = data;
  554. }else{
  555. ElMessage.error(mkData.message)
  556. }
  557. }else{
  558. ElMessage.error('其他投票失败!')
  559. }
  560. }
  561. }else{
  562. ElMessage.error('请输入选项内容!')
  563. }
  564. }else{
  565. let jsonArray = JSON.stringify(check1.value);
  566. //如果没选择其他,直接提交选择的内容
  567. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote',{
  568. method:'GET',
  569. query:{
  570. 'sur_id':userSurId.value,
  571. 'choice_id':jsonArray
  572. }
  573. });
  574. if(mkData.code == 200){
  575. ElMessage.success('投票成功!')
  576. //把投票结果显示到页面上 禁用投票按钮
  577. isDisabled.value = true;
  578. websiteSurveyData.value = mkData.data;
  579. //遍历一下,把用户选中的那个设置status为1
  580. let data = mkData.data;
  581. //遍历一下,把用户选中的那个设置status为1
  582. for(let item of data.data){
  583. for(let i of data.choice){
  584. if(item.id == i){
  585. console.log(item.id)
  586. item.status = 1;
  587. }
  588. }
  589. }
  590. websiteSurveyData.value = data;
  591. }else{
  592. ElMessage.error('投票失败!')
  593. }
  594. }
  595. }else{
  596. ElMessage.error('请选择一个选项')
  597. }
  598. }
  599. }
  600. //4.投票 end---------------------------------------->
  601. //5.页面图片放大 start---------------------------------------->
  602. const previewVisible = ref(false)
  603. const selectedImage = ref(' ')
  604. const openPreview = (event) => {
  605. if (event.target.tagName === 'IMG') {
  606. selectedImage.value = event.target.src;
  607. previewVisible.value = true;
  608. }
  609. }
  610. const closePreview = () => {
  611. previewVisible.value = false;
  612. }
  613. //5.页面图片放大 end---------------------------------------->
  614. </script>
  615. <style lang="less" scoped>
  616. //@import url('@/assets/css/article/pc.less');
  617. //@import url('@/assets/css/article/yd.less');
  618. //面包屑
  619. .breadcrumb-box {
  620. width: 1400px;
  621. margin: 0 auto;
  622. .inner {
  623. width: 100%;
  624. height: 22px;
  625. margin-top: 20px;
  626. margin-bottom: 20px;
  627. font-family: Microsoft YaHei, Microsoft YaHei;
  628. font-weight: 400;
  629. font-size: 20px;
  630. color: #666666;
  631. line-height: 23px;
  632. text-align: left;
  633. font-style: normal;
  634. text-transform: none;
  635. display: flex;
  636. align-items: center;
  637. border-bottom: 1px dashed #ccc;
  638. margin-bottom: 10px;
  639. padding: 20px 20px 20px 0;
  640. box-sizing: border-box;
  641. a {
  642. font-size: 16px;
  643. color: #000;
  644. line-height: 20px;
  645. }
  646. span {
  647. font-size: 16px;
  648. color: #000;
  649. line-height: 20px;
  650. &.location {
  651. line-height: 20px;
  652. }
  653. }
  654. }
  655. }
  656. //资讯详情
  657. .newsDetail {
  658. width: 100%;
  659. margin-bottom: 10px;
  660. .inner {
  661. width: 1400px;
  662. overflow: hidden;
  663. font-size: 16px;
  664. .innerLeft {
  665. width: 1030px;
  666. .LeftTop {
  667. margin-top: 20px;
  668. border-bottom: 1px dashed #ccc;
  669. padding-bottom: 20px;
  670. >h1 {
  671. line-height: 40px;
  672. margin-bottom: 20px;
  673. font-family: Microsoft YaHei, Microsoft YaHei;
  674. font-weight: bold;
  675. font-size: 24px;
  676. color: #333333;
  677. text-align: center;
  678. }
  679. >p {
  680. height: 18px;
  681. line-height: 18px;
  682. font-family: Microsoft YaHei, Microsoft YaHei;
  683. font-weight: 400;
  684. font-size: 14px;
  685. color: #999999;
  686. text-align: center;
  687. span {
  688. margin-right: 40px;
  689. }
  690. }
  691. >img {
  692. width: 680px;
  693. height: 382px;
  694. padding: 50px 0px 60px 55px;
  695. }
  696. }
  697. .leftBottom {
  698. margin-top: 20px;
  699. font-size: 20px;
  700. line-height: 38px;
  701. margin-bottom: 30px;
  702. word-break:break-all;
  703. ul>li img {
  704. width: 790px;
  705. height: 382px;
  706. }
  707. img {
  708. width: 790px;
  709. height: 382px;
  710. }
  711. p.tinymce-material {
  712. img {
  713. width: 790px;
  714. }
  715. }
  716. >h3,
  717. >p {
  718. text-indent: 2em;
  719. width: 790px;
  720. font-family: Microsoft YaHei, Microsoft YaHei;
  721. font-size: 20px;
  722. color: #333333;
  723. line-height: 38px;
  724. padding-bottom: 30px;
  725. img {
  726. width: 790px;
  727. }
  728. }
  729. >h3 {
  730. font-weight: 600px;
  731. }
  732. >p {
  733. font-weight: 400;
  734. }
  735. }
  736. .disclaimer {
  737. width: 790px;
  738. overflow: hidden;
  739. border-top: 1px solid #e6e6e6;
  740. padding: 30px 0px;
  741. color: #999999;
  742. font-size: 17px;
  743. p {
  744. width: 790px;
  745. line-height: 30px;
  746. }
  747. }
  748. .recommendRead {
  749. width: 100%;
  750. margin: 30px 0px 20px 0;
  751. .recommendReadTitle {
  752. font-size: 18px;
  753. color: #001996;
  754. height: 42px;
  755. line-height: 35px;
  756. letter-spacing: 1px;
  757. text-align: left;
  758. font-style: normal;
  759. text-transform: none;
  760. border-bottom: 1px solid #D9D9D9;
  761. .read_title {
  762. display: inline-block;
  763. text-align: center;
  764. width: 94px;
  765. height: 40px;
  766. border-bottom: 2px solid #158d91;
  767. }
  768. }
  769. .recommendReadList {
  770. min-height: 155px;
  771. margin-top: 20px;
  772. padding-bottom: 10px;
  773. font-size: 16px;
  774. border-bottom: 1px solid #D9D9D9;
  775. .recommendReadListTitle {
  776. margin-top: 18px;
  777. a {
  778. &:hover {
  779. color: #158d91;
  780. }
  781. color: #333333;
  782. }
  783. }
  784. .recommendReadListTitle:nth-child(1)::after {
  785. content: "热";
  786. margin-left: 13px;
  787. background: #FF8A37;
  788. color: #fff;
  789. font-size: 14px;
  790. padding: 0px 2px;
  791. }
  792. .recommendReadListTitle:hover a {
  793. color: #158d91;
  794. }
  795. }
  796. }
  797. }
  798. .innerRight {
  799. width: 315px;
  800. overflow: hidden;
  801. border-top: 1px solid #139602;
  802. .hotList1 {
  803. margin-bottom: 50px;
  804. }
  805. }
  806. }
  807. }
  808. .leftBottom::v-deep p img,
  809. .leftBottom::v-deep img,
  810. .leftBottom::v-deep video {
  811. max-width: 700px;
  812. }
  813. .leftBottom::v-deep h1,
  814. .leftBottom::v-deep h2,
  815. .leftBottom::v-deep h3,
  816. .leftBottom::v-deep h4,
  817. .leftBottom::v-deep h5,
  818. .leftBottom::v-deep h6 {
  819. font-size: 20px;
  820. font-weight: 500;
  821. }
  822. //投票
  823. .index_3_box_vote {
  824. .voteTitle {
  825. font-size: 20px;
  826. height: 40px;
  827. line-height: 40px;
  828. color: #333333;
  829. padding-left: 20px;
  830. width: 100%;
  831. border-bottom: 1px solid #E7E7E7;
  832. border-top: 1px solid #139602;
  833. box-sizing: border-box;
  834. }
  835. width:100%;
  836. box-sizing:border-box;
  837. border:solid 1px #FBFBFB;
  838. background: #FBFBFB;
  839. .inquire {
  840. height: 394px;
  841. margin-top: 20px;
  842. border-radius: 6px 6px 6px 6px;
  843. padding: 4px 40px 4px 6px;
  844. box-sizing: border-box;
  845. p {
  846. font-weight: bold;
  847. height: 69px;
  848. font-family: PingFang SC, PingFang SC;
  849. font-size: 20px;
  850. color: #333333;
  851. line-height: 21px;
  852. text-align: left;
  853. font-style: normal;
  854. text-transform: none;
  855. padding: 12px 20px 0 32px;
  856. }
  857. .radioBox {
  858. height: 250px;
  859. padding-left: 30px;
  860. overflow-y: auto;
  861. box-sizing: border-box;
  862. padding-bottom: 20px;
  863. }
  864. .radio {
  865. /deep/.el-radio {
  866. --el-radio-input-border-color-hover: #27881a;
  867. }
  868. /deep/.el-radio-group {
  869. align-items: center;
  870. display: inline-flex;
  871. flex-wrap: wrap;
  872. font-size: 0;
  873. //padding-left: 35px;
  874. }
  875. /deep/.el-radio.el-radio--large {
  876. width: 100%;
  877. height: 29px;
  878. margin-bottom: 15px;
  879. }
  880. /deep/.el-radio.el-radio--large .el-radio__label {
  881. font-family: PingFang SC, PingFang SC;
  882. font-weight: 400;
  883. font-size: 16px;
  884. color: #333333;
  885. white-space: nowrap;
  886. overflow: hidden;
  887. text-overflow: ellipsis;
  888. width: 300px;
  889. }
  890. /deep/.el-radio.el-radio--large .el-radio__inner {
  891. height: 16px;
  892. width: 16px;
  893. }
  894. /deep/.el-radio__input.is-checked+.el-radio__label {
  895. color: #27881a;
  896. }
  897. /deep/.el-radio__input.is-checked .el-radio__inner {
  898. background: #33b023;
  899. border-color: #27881a;
  900. }
  901. }
  902. .checkInputBox {
  903. /deep/.el-checkbox {
  904. --el-radio-input-border-color-hover: #27881a;
  905. }
  906. /deep/.el-checkbox-group {
  907. align-items: center;
  908. display: inline-flex;
  909. flex-wrap: wrap;
  910. font-size: 0;
  911. //padding-left: 35px;
  912. }
  913. /deep/.el-checkbox.el-checkbox--large {
  914. width: 330px;
  915. height: 29px;
  916. margin-bottom: 15px;
  917. }
  918. /deep/.el-checkbox.el-checkbox--large .el-checkbox__label {
  919. font-family: PingFang SC, PingFang SC;
  920. font-weight: 400;
  921. font-size: 16px;
  922. color: #333333;
  923. white-space: nowrap;
  924. overflow: hidden;
  925. text-overflow: ellipsis;
  926. width: 300px;
  927. }
  928. /deep/.el-checkbox.el-checkbox--large .el-checkbox__inner {
  929. height: 16px;
  930. width: 16px;
  931. }
  932. /deep/.el-checkbox__input.is-checked+.el-checkbox__label {
  933. color: #27881a;
  934. }
  935. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  936. background: #33b023;
  937. border-color: #27881a;
  938. }
  939. }
  940. .btn {
  941. padding-left: 30px;
  942. button {
  943. width: 78px;
  944. height: 37px;
  945. line-height: 37px;
  946. border-radius: 6px;
  947. border: none;
  948. font-family: PingFang SC, PingFang SC;
  949. font-weight: 400;
  950. font-size: 16px;
  951. color: #999999;
  952. }
  953. .voting {
  954. background-color: #49A769;
  955. color: #fff;
  956. margin-right: 44px;
  957. cursor: pointer;
  958. }
  959. .look {
  960. cursor: pointer;
  961. }
  962. }
  963. }
  964. .inquireData {
  965. .inquireDataItem {
  966. width: 100%;
  967. height: 38px;
  968. display: flex;
  969. align-items: center;
  970. justify-content: space-between;
  971. background: #F3F3F3;
  972. border: 1px solid #D2D2D2;
  973. margin-bottom: 10px;
  974. border-radius: 6px;
  975. padding: 0 15px;
  976. box-sizing: border-box;
  977. color: #999999;
  978. .inquireDataItemTitle {
  979. width: 290px;
  980. height: 38px;
  981. font-size: 16px;
  982. line-height: 38px;
  983. white-space: nowrap;
  984. overflow: hidden;
  985. text-overflow: ellipsis;
  986. }
  987. .inquireDataItemNum {
  988. font-size: 16px;
  989. }
  990. }
  991. .active {
  992. color: #49A769;
  993. background: #dff7e8;
  994. border: 1px solid #49A769;
  995. }
  996. }
  997. }
  998. //放大图片
  999. .preview-modal {
  1000. position: fixed;
  1001. top: 0;
  1002. left: 0;
  1003. width: 100%;
  1004. height: 100%;
  1005. background: rgba(0, 0, 0, 0.8);
  1006. display: flex;
  1007. justify-content: center;
  1008. align-items: center;
  1009. z-index: 1000;
  1010. }
  1011. .preview-modal img {
  1012. max-width: 100%;
  1013. max-height: 100%;
  1014. cursor: pointer;
  1015. }
  1016. //上一篇 下一篇
  1017. .prevNext {
  1018. border-bottom: 1px solid #ccc;
  1019. padding-bottom: 10px;
  1020. a {
  1021. display: block;
  1022. color: #333;
  1023. font-size: 15px;
  1024. display: block;
  1025. height: 40px;
  1026. line-height: 40px;
  1027. &:hover {
  1028. color: #0071B7;
  1029. }
  1030. }
  1031. }
  1032. </style>