detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <div class="detail">
  3. <div class="detail-body">
  4. <div class="img-text">
  5. <img :src="activityDetail.annexArray[0]" alt="" />
  6. </div>
  7. <div class="collect-part">
  8. <div
  9. class="normal-tip by y-bg"
  10. v-if="activityDetail.registrationStatus === '1'"
  11. >
  12. 报名中
  13. </div>
  14. <div class="normal-tip by h-bg" v-else>报名已结束</div>
  15. <div class="right">
  16. <span class="num">{{ activityDetail.partakeNumber }}人参与</span>
  17. <div class="icon-collect" @click="changeCollectorsStatus()">
  18. <i
  19. :class="[
  20. 'iconfont icon-wujiaoxingxingxingshoucangdianji',
  21. active && 'blue',
  22. ]"
  23. ></i>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="tel-part">
  28. <div class="tel-name">联系电话</div>
  29. <TelNum :num="activityDetail.contactPhone" />
  30. </div>
  31. <div class="info-part">
  32. <div class="info-item">
  33. <div class="custom-item-tit">
  34. <span class="tit">活动举办</span>
  35. </div>
  36. <div class="text">{{ activityDetail.activityHold }}</div>
  37. </div>
  38. <div class="info-item">
  39. <div class="custom-item-tit"><span class="tit">活动详情</span></div>
  40. <div class="text" v-html="activityDetail.activityContent"></div>
  41. </div>
  42. <div class="info-item">
  43. <div class="custom-item-tit"><span class="tit">活动时间</span></div>
  44. <div class="text">
  45. {{ activityDetail.activityStartTime }} —
  46. {{ activityDetail.activityEndTime }}
  47. </div>
  48. </div>
  49. <div class="info-item">
  50. <div class="custom-item-tit"><span class="tit">活动地址</span></div>
  51. <div class="text">
  52. <span class="add">{{ activityDetail.activityAddress }}</span>
  53. <!-- <span class="dh" @click="goAddress(activityDetail.activityAddress)">导航</span>-->
  54. </div>
  55. </div>
  56. <!-- <div class="info-item">-->
  57. <!-- <div class="custom-item-tit"><span class="tit">报名条件</span></div>-->
  58. <!-- <div class="text">{{ activityDetail.registrationConditions }}</div>-->
  59. <!-- </div>-->
  60. <div class="info-item">
  61. <div class="custom-item-tit"><span class="tit">报名时间</span></div>
  62. <div class="text">
  63. {{ activityDetail.registrationStartTime }} —
  64. {{ activityDetail.registrationEndTime }}
  65. </div>
  66. </div>
  67. <div class="info-item">
  68. <div class="custom-item-tit"><span class="tit">活动参与</span></div>
  69. <div class="text">还有 {{ number }} 个名额</div>
  70. </div>
  71. <div class="info-item uploadBox">
  72. <div class="custom-item-tit"><span class="tit">附件查看</span></div>
  73. <div class="text" style="16rpx 0px">
  74. <div
  75. v-for="item in activityDetail.activityFile"
  76. :key="item.uid"
  77. @click="openFile(item.url)"
  78. >
  79. {{ item.name }}
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <div
  86. class="but-bottom"
  87. @click="getApply()"
  88. :signInfo="signInfo"
  89. v-if="signInfo.signInStatus == 1"
  90. >
  91. 到场签到
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import TelNum from "../../subPackages/components/tel-number";
  97. import {
  98. getActivityById1,
  99. clickCollect,
  100. getUserLocalStorageInfo,
  101. } from "@/js_sdk/http";
  102. export default {
  103. components: {
  104. TelNum,
  105. },
  106. data() {
  107. return {
  108. signInfo: {},
  109. signInCode: "",
  110. active: false,
  111. id: "",
  112. activityDetail: {
  113. referenceId: "",
  114. },
  115. number: 0,
  116. };
  117. },
  118. onLoad(option) {
  119. // this.getScanCode();
  120. console.log("option", option.id);
  121. this.id = option.id;
  122. this.getActivityById1();
  123. },
  124. methods: {
  125. openFile(url) {
  126. uni.downloadFile({
  127. url: url, // 网络文档地址
  128. success: (data) => {
  129. if (data.statusCode === 200) {
  130. uni.saveFile({
  131. tempFilePath: data.tempFilePath, //临时路径
  132. success: function (res) {
  133. // 保存路径
  134. console.log(res);
  135. setTimeout(() => {
  136. //打开文档查看
  137. uni.openDocument({
  138. filePath: res.savedFilePath,
  139. success: function (res) {
  140. console.log("res", res);
  141. },
  142. fail: function (error) {
  143. console.log(error);
  144. wx.previewImage({
  145. current: "", // 当前显示图片的http链接
  146. urls: [url], // 需要预览的图片http链接列表
  147. });
  148. },
  149. });
  150. }, 3000);
  151. },
  152. });
  153. }
  154. },
  155. fail: (err) => {
  156. uni.showToast({
  157. title: "失败请重新下载",
  158. });
  159. },
  160. });
  161. },
  162. getActivityById1() {
  163. const _this = this;
  164. getActivityById1(this.id, "SCNjNSP7LJ9aarv1cNw").then((res) => {
  165. if (res.data) {
  166. if (res.data.activityFile) {
  167. const files = JSON.parse(res.data.activityFile);
  168. if (files && files.length) {
  169. _this.fileList2 = _this.fileList2 ? _this.fileList2 : [];
  170. files.forEach((item) => {
  171. console.log("_this.fileList2", _this.fileList2);
  172. console.log(item);
  173. _this.fileList2.push({
  174. url: item.url,
  175. id: item.id,
  176. });
  177. });
  178. }
  179. }
  180. _this.activityDetail = res.data;
  181. _this.activityDetail.activityFile = JSON.parse(res.data.activityFile);
  182. console.log(
  183. "_this.activityDetail.activityFile",
  184. _this.activityDetail.activityFile
  185. );
  186. _this.activityDetail.activityContent =
  187. res.data.activityContent.replaceAll(
  188. "<img",
  189. `<img style="max-width:100%;"`
  190. );
  191. console.log("registrationStatus", res.data.registrationStatus);
  192. if (
  193. _this.activityDetail.annexArray &&
  194. _this.activityDetail.annexArray.length
  195. ) {
  196. console.log(
  197. "_this.activityDetail.annexArray[0]",
  198. _this.activityDetail.annexArray[0]
  199. );
  200. _this.firstImg = _this.activityDetail.annexArray[0];
  201. }
  202. _this.activityDetail.registrationStartTime =
  203. this.$common.transBaseDateTime(
  204. _this.activityDetail.registrationStartTime
  205. );
  206. _this.activityDetail.registrationEndTime =
  207. this.$common.transBaseToDateTime(
  208. _this.activityDetail.registrationEndTime
  209. );
  210. _this.activityDetail.activityStartTime =
  211. this.$common.transBaseDateTime(
  212. _this.activityDetail.activityStartTime
  213. );
  214. _this.activityDetail.activityEndTime =
  215. this.$common.transBaseToDateTime(
  216. _this.activityDetail.activityEndTime
  217. );
  218. if (_this.activityDetail.collectorsStatus === "2") {
  219. _this.active = true;
  220. } else {
  221. _this.active = false;
  222. }
  223. _this.number =
  224. _this.activityDetail.limitPersonNumber -
  225. _this.activityDetail.partakeNumber;
  226. }
  227. });
  228. },
  229. getApply() {
  230. this.$refs.apply.init(this.signInfo);
  231. },
  232. goAddress(address) {
  233. if (address === null || undefined === address || address === "") {
  234. this.$showToast("地址不能为空");
  235. return false;
  236. } else {
  237. this.navigation(address);
  238. }
  239. },
  240. changeCollectorsStatus() {
  241. if (this.active) {
  242. const _this = this;
  243. clickCollect({
  244. id: this.id,
  245. userId: getUserLocalStorageInfo().user.id,
  246. collectorsStatus: "1",
  247. }).then((res) => {
  248. _this.getActivityById1();
  249. });
  250. } else {
  251. const _this = this;
  252. clickCollect({
  253. id: this.id,
  254. userId: getUserLocalStorageInfo().user.id,
  255. collectorsStatus: "2",
  256. }).then((res) => {
  257. _this.getActivityById1();
  258. });
  259. }
  260. },
  261. },
  262. };
  263. </script>
  264. <style lang="scss" type="text/scss" >
  265. .h-bg {
  266. background: #f87a7a;
  267. color: #fff;
  268. }
  269. // 底部按钮
  270. .but-bottom {
  271. position: fixed;
  272. bottom: 0;
  273. left: 0;
  274. // width: 100%;
  275. line-height: 120rpx;
  276. background: $main;
  277. color: #fff;
  278. font-size: 36rpx;
  279. text-align: center;
  280. }
  281. .text {
  282. font-size: 24rpx;
  283. color: $text5;
  284. margin-top: 32rpx;
  285. }
  286. .detail {
  287. box-sizing: border-box;
  288. background-color: #f2f2f2;
  289. padding: 0 0 140rpx;
  290. overflow-y: auto;
  291. .detail-body {
  292. .img-text {
  293. img {
  294. height: 420rpx;
  295. width: 100%;
  296. }
  297. }
  298. .collect-part {
  299. background-color: #fff;
  300. height: 120rpx;
  301. padding: 0 30rpx;
  302. margin-bottom: 10rpx;
  303. @include flex;
  304. .normal-tip {
  305. }
  306. .right {
  307. @include flex;
  308. .num {
  309. margin-right: 20rpx;
  310. font-size: 24rpx;
  311. color: #333333;
  312. }
  313. }
  314. }
  315. .tel-part {
  316. display: flex;
  317. width: 100%;
  318. background-color: #fff;
  319. margin-bottom: 10rpx;
  320. padding: 0 30rpx;
  321. align-items: center;
  322. box-sizing: border-box;
  323. justify-content: space-between;
  324. .tel-name {
  325. color: #333;
  326. font-size: 32rpx;
  327. font-weight: 700;
  328. }
  329. .custom-tel-component {
  330. width: 400rpx;
  331. .left {
  332. font-size: 26rpx;
  333. }
  334. }
  335. }
  336. }
  337. .info-part {
  338. background-color: #fff;
  339. overflow-y: auto;
  340. height: calc(100vh - 700rpx);
  341. box-sizing: border-box;
  342. padding: 40rpx 30rpx;
  343. .tit {
  344. padding-left: 2.667vw;
  345. position: relative;
  346. font-size: 4.267vw;
  347. &::after {
  348. content: "";
  349. width: 0.8vw;
  350. height: 90%;
  351. background-color: #976dec;
  352. border-radius: 0.4vw;
  353. position: absolute;
  354. left: 0;
  355. top: 50%;
  356. -webkit-transform: translateY(-50%);
  357. transform: translateY(-50%);
  358. }
  359. }
  360. .info-item {
  361. padding: 10rpx 0rpx;
  362. margin-bottom: 20rpx;
  363. .custom-item-tit {
  364. font-size: 32rpx;
  365. font-weight: 700;
  366. }
  367. .text {
  368. font-size: 24rpx;
  369. color: $text5;
  370. margin-top: 32rpx;
  371. .add {
  372. margin-right: 40rpx;
  373. }
  374. .dh {
  375. width: 100rpx;
  376. text-align: center;
  377. display: inline-block;
  378. color: $main;
  379. border-left: 1rpx solid #666666;
  380. }
  381. }
  382. &:last-child {
  383. margin-bottom: 0rpx;
  384. }
  385. }
  386. }
  387. }
  388. </style>
  389. <style lang="scss">
  390. </style>