section.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div
  3. class="section"
  4. :style="{ background: $linear[`${isTheme ? 'w' : 'r'}`] }"
  5. >
  6. <!-- <img class="s-bg" v-if="bgImg" :src="bgImg"/> -->
  7. <div class="s-header">
  8. <img
  9. :src="`${$cdn}/images/title_icon_${isTheme ? 'r' : 'w'}.png`"
  10. alt=""
  11. />
  12. <span :style="{ color: isTheme ? '#444' : '#fff' }">{{ title }}</span>
  13. </div>
  14. <div class="section-con">
  15. <div class="preface" :slot="'container'">
  16. <div class="txt">
  17. <p
  18. :style="{ color: isTheme ? '#444' : '#fff' }"
  19. v-for="(item, i) in txtArr"
  20. :key="i"
  21. v-html="item"
  22. ></p>
  23. </div>
  24. </div>
  25. <jieshuo v-if="!hideJiesuo" :isTheme="isTheme" />
  26. <bm-slide
  27. :full="full"
  28. :isTheme="isTheme"
  29. v-if="data.length > 0"
  30. :idx="activeIdx"
  31. @activeItem="handleItem"
  32. :list="data"
  33. class="sld-con"
  34. />
  35. <div class="readmore">
  36. <span @click="goto">查看更多藏品</span>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import { mapState } from "vuex";
  43. import jieshuo from "./jieshuo";
  44. import bmSlide from "./bmSlide/";
  45. export default {
  46. computed: {
  47. ...mapState({
  48. theme: (state) => state.common.theme,
  49. }),
  50. },
  51. components: {
  52. jieshuo,
  53. bmSlide,
  54. },
  55. props: {
  56. full: {
  57. type: Boolean,
  58. default() {
  59. return false;
  60. },
  61. },
  62. txtArr: {
  63. type: Array,
  64. default() {
  65. return [];
  66. },
  67. },
  68. data: {
  69. type: Array,
  70. default() {
  71. return [];
  72. },
  73. },
  74. activeIdx: {
  75. type: Number,
  76. default: 0,
  77. },
  78. title: {
  79. type: String,
  80. default: "",
  81. },
  82. hideJiesuo: {
  83. type: Boolean,
  84. default: false,
  85. },
  86. titlecolor: {
  87. type: String,
  88. default: "#444",
  89. },
  90. bgImg: {
  91. type: String,
  92. default: "",
  93. },
  94. isTheme: {
  95. type: Boolean,
  96. default: false,
  97. },
  98. },
  99. methods: {
  100. handleItem(item) {
  101. this.$emit("activeItem", item);
  102. },
  103. goto() {
  104. this.$router.push({
  105. name: "collection",
  106. params: { type: this.data[0].type },
  107. });
  108. },
  109. },
  110. mounted() {},
  111. };
  112. </script>
  113. <style lang="less" scoped>
  114. @import "../assets/style/globalVars.less";
  115. @cdn: "https://houseoss.4dkankan.com/chuanshan";
  116. .section {
  117. margin: 0 auto;
  118. padding: 7.5rem 0 4.17rem;
  119. position: relative;
  120. overflow: hidden;
  121. .s-header {
  122. display: flex;
  123. justify-content: center;
  124. align-items: center;
  125. position: relative;
  126. height: 1.75rem;
  127. margin: 0 auto 1.25rem;
  128. img {
  129. width: 2.5rem;
  130. margin-right: 1.25rem;
  131. }
  132. span {
  133. font-size: 1.5rem;
  134. font-weight: bolder;
  135. line-height: 1;
  136. display: inline-block;
  137. margin: 0 0.83rem;
  138. vertical-align: middle;
  139. color: #444444;
  140. }
  141. }
  142. .section-con {
  143. width: @containerW;
  144. margin: 0 auto;
  145. .txt {
  146. width: 80%;
  147. min-width: 41.67rem;
  148. margin: 3.83rem auto;
  149. > p {
  150. font-size: @fontSizeNormal;
  151. line-height: @fontSizeNormalLightHeight;
  152. text-indent: 2rem;
  153. text-align: justify;
  154. font-size: 1rem;
  155. color: #444;
  156. &:last-of-type {
  157. margin-bottom: 3.83rem;
  158. }
  159. }
  160. }
  161. .sld-con {
  162. width: 80%;
  163. margin: 3.83rem auto;
  164. }
  165. .readmore {
  166. span {
  167. cursor: pointer;
  168. display: inline-block;
  169. color: @theme;
  170. width: 9.58rem;
  171. text-align: center;
  172. line-height: 2.67rem;
  173. height: 2.67rem;
  174. background: url("@{cdn}/images/readmore.png") no-repeat;
  175. background-size: 100% 100%;
  176. }
  177. }
  178. }
  179. .s-bg {
  180. width: 100%;
  181. height: 100%;
  182. position: absolute;
  183. left: 0;
  184. top: 0;
  185. font-size: 0;
  186. z-index: -1;
  187. }
  188. }
  189. </style>