timeLine.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <view class="time-line">
  3. <view class="line-item" v-for="(item, index) in dataList" :key="index" @click="goDetailFromTimeLine(item, index)">
  4. <view class="time">{{ item.date }}</view>
  5. <view class="content" v-if="item.Content.length">
  6. <text class="content-reg" v-if="item.IsRed"></text>
  7. <rich-text
  8. :style="{ height: item.isExpand ? 'auto' : richTextHeight + 'px' }"
  9. :data-index="index"
  10. :class="['rich-text', item.isExpand && 'expand', (item.ArticleId || item.ChartId) && 'texe-color']"
  11. :nodes="item.Content"
  12. >
  13. </rich-text>
  14. <view class="expan-btn" :class="[{ pos: !item.isExpand }, (item.ArticleId || item.ChartId) && 'expan-btn-padding']" @click.stop="handleExpand(item, index)" v-if="item.isShowBtn">{{
  15. item.isExpand ? "收起" : "展开"
  16. }}</view>
  17. </view>
  18. <view class="title" v-else>
  19. <text class="content-reg" v-if="item.IsRed"></text>
  20. {{ item.Title }}</view
  21. >
  22. </view>
  23. <view v-show="loadTimeLine" class="loadTimeLine"></view>
  24. <!-- 视频模块 -->
  25. <videoModule :showVideoPop.sync="showVideoPop" :videoPopList="videoPopList" />
  26. <audioModule ref="timeLineAudio" :showAudioPop.sync="showAudioPop" />
  27. </view>
  28. </template>
  29. <script>
  30. import { Reports } from "@/config/api.js";
  31. import videoModule from "@/components/videoModule/index";
  32. import audioModule from "@/components/audioModule/index";
  33. export default {
  34. name: "",
  35. components: { videoModule, audioModule },
  36. props: {
  37. dataList: {
  38. type: Array,
  39. default: [],
  40. },
  41. },
  42. data() {
  43. return {
  44. richTextHeight: 10000,
  45. loadTimeLine: false, //时间线的遮罩
  46. showVideoPop: false,
  47. videoPopList: {},
  48. showAudioPop: false,
  49. };
  50. },
  51. computed: {},
  52. watch: {},
  53. created() {},
  54. mounted() {},
  55. methods: {
  56. async goDetailFromTimeLine(item, index) {
  57. // console.log(item);
  58. item.TimeLineId &&
  59. (await Reports.postTacticsHistory({
  60. TimeLineId: item.TimeLineId,
  61. }));
  62. if (item.Content.length !== 0 && !item.ArticleId && !item.ChartId) return;
  63. if (item.SubCategoryName === "路演精华") {
  64. //跳转路演精华
  65. uni.navigateTo({
  66. url: "/reportPages/roadEssence/roadEssence?id=" + item.Id,
  67. });
  68. } else if (item.Resource == 4) {
  69. if (!item.VideoUrl) return;
  70. this.showVideoPop = true;
  71. this.videoPopList = {
  72. Id: item.Id,
  73. ResourceUrl: item.VideoUrl,
  74. Title: item.Title,
  75. ActivityId: item.Id,
  76. };
  77. } else if (item.Resource == 5) {
  78. if (!item.VoiceUrl) return;
  79. this.$store.commit("audioBg/parseIntAudio", true);
  80. // 判断是否为同一个音频
  81. if (this.$store.state.audioBg.indexId == item.Id) {
  82. if (this.globalBgAudioManager.paused) {
  83. this.globalBgAudioManager.play();
  84. }
  85. } else {
  86. let VoiceList = {
  87. Url: item.VoiceUrl,
  88. Name: item.Title,
  89. PlaySeconds: item.VoicePlaySeconds,
  90. };
  91. this.$store.commit("audioBg/addAudio", { list: VoiceList, indexId: item.Id, activityTitle: item.Title, recordList: item });
  92. }
  93. this.showAudioPop = true;
  94. } else {
  95. !item.ArticleId && !item.ChartId && this.$emit("setRouter");
  96. if (item.Resource === 2) {
  97. // 跳转产品内测详情
  98. uni.navigateTo({
  99. url: "/reportPages/internalDetials/internalDetials?id=" + item.Id,
  100. });
  101. } else if (item.Resource === 1) {
  102. if (item.Id || item.ArticleId) {
  103. uni.navigateTo({
  104. url: "/pageMy/reportDetail/reportDetail?id=" + (item.Id || item.ArticleId),
  105. });
  106. } else if (item.ChartId) {
  107. uni.navigateTo({
  108. url: "/pageMy/chartPage/chartPage?id=" + item.ChartId,
  109. });
  110. }
  111. }
  112. }
  113. }, //展开收起晨会内容
  114. // 去往文章详情的
  115. async handleExpand(item, index) {
  116. if (item.TimeLineId) {
  117. await Reports.postTacticsHistory({
  118. TimeLineId: item.TimeLineId,
  119. });
  120. } else {
  121. await Reports.morning_meeting_history({ Id: item.Id, SourcePage: "展开" });
  122. this.getRecordTracking("展开收起", { Id: item.Id });
  123. }
  124. item.isExpand = !item.isExpand;
  125. this.$parent.timeLine.splice(index, 1, item);
  126. },
  127. getConentsHeight() {
  128. const query = wx.createSelectorQuery().in(this);
  129. query.selectAll(".rich-text").boundingClientRect();
  130. query.exec((res) => {
  131. //根据timeLine的第一项确定当前手机三行文字的高度
  132. const standardHeight = res[0][0].height;
  133. this.richTextHeight = standardHeight;
  134. res[0].forEach((item) => {
  135. let temp = this.$parent.timeLine[item.dataset.index];
  136. //超过这个高度的,需要显示展开/收起按钮
  137. if (item.height > standardHeight) {
  138. temp.isExpand = false;
  139. temp.isShowBtn = true;
  140. } else {
  141. temp.isExpand = true;
  142. temp.isShowBtn = false;
  143. }
  144. });
  145. //然后把timeLine的第一项扔掉
  146. this.$parent.timeLine.shift();
  147. this.loadTimeLine = false;
  148. });
  149. },
  150. },
  151. };
  152. </script>
  153. <style scoped lang="scss">
  154. .time-line {
  155. padding: 30rpx 40rpx 20rpx 40rpx;
  156. min-height: calc(100vh - 390rpx);
  157. background-color: #ffffff;
  158. position: relative;
  159. .texe-color {
  160. color: #376cbb;
  161. }
  162. .loadTimeLine {
  163. top: 0;
  164. bottom: 0;
  165. left: 0;
  166. right: 0;
  167. position: absolute;
  168. background-color: #fff;
  169. z-index: 6;
  170. }
  171. .line-item {
  172. position: relative;
  173. padding: 0 0 50rpx 40rpx;
  174. /* border-left:1rpx solid #DAE9FD; */
  175. &:last-child {
  176. padding-bottom: 0;
  177. &::after {
  178. height: calc(100% - 25rpx);
  179. }
  180. }
  181. &:first-child {
  182. .time {
  183. &::after {
  184. background-color: #376cbb;
  185. }
  186. }
  187. }
  188. &::before,
  189. &::after {
  190. position: absolute;
  191. content: "";
  192. }
  193. &::before {
  194. width: 24rpx;
  195. height: 24rpx;
  196. background-color: #dae9fd;
  197. z-index: 1;
  198. left: 0;
  199. top: 27rpx;
  200. transform: translate(-50%, -50%);
  201. border-radius: 50%;
  202. }
  203. &::after {
  204. top: 17rpx;
  205. left: 0;
  206. width: 1rpx;
  207. height: calc(100%);
  208. background-color: #dae9fd;
  209. z-index: 2;
  210. }
  211. .time {
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. width: 185rpx;
  216. height: 50rpx;
  217. background-color: #e5efff;
  218. border-radius: 64rpx;
  219. color: $uni-color-new;
  220. font-size: 28rpx;
  221. font-weight: 600;
  222. margin-bottom: 20rpx;
  223. position: relative;
  224. &::before,
  225. &::after {
  226. position: absolute;
  227. content: "";
  228. left: -36rpx;
  229. top: 27rpx;
  230. width: 24rpx;
  231. height: 1rpx;
  232. background-color: #e5efff;
  233. z-index: 1;
  234. }
  235. &::after {
  236. left: -40rpx;
  237. top: 27rpx;
  238. width: 12rpx;
  239. height: 12rpx;
  240. border-radius: 50%;
  241. transform: translate(-50%, -50%);
  242. background-color: $uni-color-new;
  243. z-index: 3;
  244. }
  245. }
  246. .content {
  247. color: #666666;
  248. position: relative;
  249. .rich-text {
  250. overflow: hidden;
  251. text-overflow: ellipsis;
  252. text-align: justify;
  253. display: -webkit-box;
  254. -webkit-line-clamp: 3;
  255. -webkit-box-orient: vertical;
  256. position: relative;
  257. &.expand {
  258. -webkit-line-clamp: 999;
  259. height: auto;
  260. }
  261. }
  262. .expan-btn {
  263. color: $uni-color-new;
  264. text-align: right;
  265. &.pos {
  266. padding: 0 0 0 40rpx;
  267. background-color: rgba(255, 255, 255, 0.882);
  268. position: absolute;
  269. right: 0;
  270. bottom: 0;
  271. }
  272. }
  273. .expan-btn-padding {
  274. &.pos {
  275. padding: 0 0 0 80rpx;
  276. }
  277. }
  278. .content-reg {
  279. position: absolute;
  280. top: 10rpx;
  281. left: -20rpx;
  282. width: 14rpx;
  283. height: 14rpx;
  284. background-color: #ff0000;
  285. border-radius: 50%;
  286. }
  287. }
  288. .title {
  289. position: relative;
  290. color: $uni-color-new;
  291. .content-reg {
  292. position: absolute;
  293. top: 10rpx;
  294. left: -20rpx;
  295. width: 14rpx;
  296. height: 14rpx;
  297. background-color: #ff0000;
  298. border-radius: 50%;
  299. }
  300. }
  301. }
  302. }
  303. </style>