index.vue 10 KB

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