detail.vue 39 KB

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