index.vue 10 KB

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