Article.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <section class="video-alias section">
  3. <div class="video-alias__wrapper section-wrapper" v-if="videoItem">
  4. <div class="admin-button-in-news" v-if="userPermissionGroup == 3 || userPermissionGroup == 5">
  5. <a class="copy" :href="'/admin/publications/' + videoItem.id" target="_blank">Редактирование новости</a>
  6. <a class="inject" @click="inject(videoItem)">Инжект</a>
  7. </div>
  8. <div class="video-alias-header" v-if="videoItem.video">
  9. <div class="header-video">
  10. <iframe frameborder="0" :src="videoLink"></iframe>
  11. </div>
  12. <div class="header-bg">
  13. <img :src="require('~/assets/img/slider-video/bg.png')" />
  14. </div>
  15. </div>
  16. <div class="video-alias-body">
  17. <div class="video-alias-main">
  18. <div class="main-title">
  19. <h1 v-html="videoItem.title"></h1>
  20. </div>
  21. <div class="main-description" v-html="videoItem.description"></div>
  22. <aside class="detail-top__header-side">
  23. <div class="detail-top__actions">
  24. <div class="detail-top__share">
  25. <div class="socials-share">
  26. <ul class="socials-share__list">
  27. <li class="socials-share__item">
  28. <ShareNetwork
  29. network="Odnoklassniki"
  30. :url="'https://www.amic.ru' + $route.fullPath"
  31. :title="videoItem.title"
  32. class="socials-share__link"
  33. :hashtags="
  34. videoItem.hash_tags.length
  35. ? videoItem.hash_tags.join(' ')
  36. : ''
  37. "
  38. >
  39. <BaseIcon :name="'ok'" clear
  40. /></ShareNetwork>
  41. </li>
  42. <li class="socials-share__item">
  43. <ShareNetwork
  44. network="twitter"
  45. :url="'https://www.amic.ru' + $route.fullPath"
  46. :title="videoItem.title"
  47. class="socials-share__link"
  48. :hashtags="
  49. videoItem.hash_tags.length
  50. ? videoItem.hash_tags.join(' ')
  51. : ''
  52. "
  53. >
  54. <BaseIcon :name="'tw'" clear
  55. /></ShareNetwork>
  56. </li>
  57. <li class="socials-share__item">
  58. <ShareNetwork
  59. network="vk"
  60. :url="'https://www.amic.ru' + $route.fullPath"
  61. :title="videoItem.title"
  62. :description="videoItem.description"
  63. class="socials-share__link"
  64. :hashtags="
  65. videoItem.hash_tags.length
  66. ? videoItem.hash_tags.join(' ')
  67. : ''
  68. "
  69. >
  70. <BaseIcon :name="'vk'" clear
  71. /></ShareNetwork>
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. <a
  78. class="
  79. detail-top__action detail-top__comments-button
  80. button button_grey-dark
  81. "
  82. href="#comment_form"
  83. >
  84. <span class="button__text">Комментировать</span>
  85. </a>
  86. </aside>
  87. <div class="main-content">
  88. <VideoContent :html="videoItem.content"></VideoContent>
  89. <div class="detail-main__properties mt-5">
  90. <span
  91. v-for="property in properties"
  92. :key="property.id"
  93. :class="property.code"
  94. :ref="property.code"
  95. >
  96. {{ property.title }}
  97. </span>
  98. </div>
  99. </div>
  100. <div class="main-banner">
  101. <BannersW960H90 />
  102. </div>
  103. <div v-if="videoItem.show_pull" class="main-comments">
  104. <ArticleCommentsList
  105. :pull_id="videoItem.comment_pull_id"
  106. @commentResponse="commentResponseData"
  107. :newCommentsList="commentsList"
  108. />
  109. <ArticleCommentsForm
  110. :pull_id="videoItem.comment_pull_id"
  111. :response_user_name="comment.response_user_name"
  112. :response_user_id="comment.response_user_id"
  113. @clearCommentResponse="clearCommentResponse"
  114. @commentsResponseData="commentsResponseData"
  115. />
  116. </div>
  117. </div>
  118. <div class="video-alias-aside">
  119. <div class="aside-list" v-if="filteredVideos.length">
  120. <VideoItem
  121. class="aside-item"
  122. v-for="item in filteredVideos"
  123. :key="item.id"
  124. :item="item"
  125. ></VideoItem>
  126. </div>
  127. <div class="aside-banner">
  128. <BannersW240H400 />
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. </section>
  134. </template>
  135. <script>
  136. export default {
  137. props: {
  138. videoItem: {
  139. type: Object,
  140. required: true
  141. },
  142. filteredVideos: {
  143. type: Array,
  144. default: () => []
  145. }
  146. },
  147. data() {
  148. return {
  149. userPermissionGroup: null,
  150. comment: {
  151. response_user_id: "",
  152. response_user_name: ""
  153. },
  154. commentsList: {}
  155. };
  156. },
  157. mounted() {
  158. if(this.$store.state.auth.user){
  159. this.userPermissionGroup = this.$store.state.auth.user.user_permission_group;
  160. }
  161. },
  162. methods: {
  163. commentResponseData(data) {
  164. this.comment.response_user_id = data.user_id;
  165. this.comment.response_user_name = data.user_name;
  166. },
  167. clearCommentResponse() {
  168. this.comment.response_user_id = "";
  169. this.comment.response_user_name = "";
  170. },
  171. inject(item) {
  172. let res = "##news_" + item.id + "##";
  173. this.$clipboard(res);
  174. alert('Инжект скопирован в буфер обмена');
  175. },
  176. commentsResponseData(data){
  177. this.commentsList = data;
  178. },
  179. },
  180. computed: {
  181. properties () {
  182. return Object.values(this.videoItem.properties).filter(property =>
  183. Number(property.value)
  184. )
  185. },
  186. videoLink() {
  187. if (this.videoItem.video.match("(www.)?youtube|youtu.be")) {
  188. const youtubeId = this.videoItem.video
  189. .split(/v\/|v=|youtu\.be\//)[1]
  190. .split(/[?&]/)[0];
  191. return `https://www.youtube.com/embed/${youtubeId}`;
  192. }
  193. return this.videoItem.video;
  194. }
  195. }
  196. };
  197. </script>
  198. <style lang="less" scoped>
  199. .section {
  200. padding-top: 20px;
  201. }
  202. .video-alias {
  203. padding-bottom: 50px;
  204. &-header {
  205. position: relative;
  206. box-shadow: 0px 26px 38px -11px rgba(255, 0, 214, 0.25);
  207. }
  208. &-body {
  209. margin-top: 80px;
  210. display: flex;
  211. justify-content: space-between;
  212. background: #8d9697;
  213. padding: 0 0 0 15px;
  214. }
  215. &-main {
  216. color: white;
  217. flex: 0 1 815px;
  218. }
  219. &-aside {
  220. margin-left: 10px;
  221. flex: 0 1 420px;
  222. max-width: 420px;
  223. }
  224. @media screen and(max-width: 1000px) {
  225. &-body {
  226. flex-direction: column;
  227. margin-top: 30px;
  228. }
  229. &-main {
  230. flex: auto;
  231. }
  232. &-aside {
  233. flex: auto;
  234. max-width: 100%;
  235. margin: 40px auto 0;
  236. }
  237. }
  238. }
  239. .header {
  240. &-video {
  241. position: relative;
  242. z-index: 1;
  243. width: 100%;
  244. aspect-ratio: 16 / 9;
  245. iframe {
  246. width: 100%;
  247. height: 100%;
  248. }
  249. }
  250. &-bg {
  251. z-index: 0;
  252. position: absolute;
  253. bottom: 0;
  254. transform: translateY(50%);
  255. img {
  256. width: 100%;
  257. height: auto;
  258. }
  259. }
  260. }
  261. .main {
  262. &-title {
  263. h1 {
  264. font-size: 48px;
  265. line-height: 120%;
  266. }
  267. }
  268. &-description {
  269. margin-top: 20px;
  270. font-size: 24px;
  271. }
  272. @media screen and(max-width: 768px) {
  273. &-title {
  274. h1 {
  275. font-size: 22px;
  276. }
  277. }
  278. &-description {
  279. font-size: 18px;
  280. }
  281. }
  282. }
  283. .aside {
  284. &-list {
  285. display: flex;
  286. flex-direction: column;
  287. }
  288. &-item {
  289. margin-bottom: 28px;
  290. }
  291. }
  292. .socials-share__link .icon {
  293. html.dark-mode & {
  294. color: #fff;
  295. fill: #fff;
  296. }
  297. }
  298. .socials-share__link {
  299. html.dark-mode & {
  300. background-color: rgba(90, 116, 139, 0.5);
  301. }
  302. }
  303. .detail-top__header-side {
  304. html.dark-mode & {
  305. margin-top: 30px;
  306. }
  307. }
  308. .admin-button-in-news{
  309. margin-bottom: 30px;
  310. a{
  311. background-color: #000;
  312. color: #fff;
  313. font-size: 14px;
  314. padding: 8px 19px;
  315. cursor: pointer;
  316. }
  317. .inject{
  318. background-color: #1976d2;
  319. }
  320. .copy{
  321. background-color: #4caf50;
  322. }
  323. }
  324. </style>