index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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. console.log(url);
  151. uni.downloadFile({
  152. url: url, // 网络文档地址
  153. success: (data) => {
  154. if (data.statusCode === 200) {
  155. uni.saveFile({
  156. tempFilePath: data.tempFilePath, //临时路径
  157. success: function (res) {
  158. // 保存路径
  159. uni.openDocument({
  160. filePath: res.savedFilePath,
  161. success: function (res) {},
  162. });
  163. },
  164. });
  165. }
  166. },
  167. fail: (err) => {
  168. uni.showToast({
  169. title: "失败请重新下载",
  170. });
  171. },
  172. });
  173. },
  174. getActivityById(a, b, c) {
  175. const _this = this;
  176. getActivityById(
  177. "1126547436026724352",
  178. _this.signInCode,
  179. getUserLocalStorageInfo().user.id
  180. ).then((res) => {
  181. if (res.data.info) {
  182. _this.annexArray = res.data.info.annexArray;
  183. _this.activityDetail = res.data.info;
  184. _this.activityDetail.activityContent =
  185. res.data.info.activityContent.replace(
  186. "<img",
  187. `<img style="max-width:100%;"`
  188. );
  189. _this.activityDetail.registrationStartTime =
  190. this.$common.transBaseDateTime(
  191. _this.activityDetail.registrationStartTime
  192. );
  193. _this.activityDetail.registrationEndTime =
  194. this.$common.transBaseToDateTime(
  195. _this.activityDetail.registrationEndTime
  196. );
  197. _this.activityDetail.activityStartTime =
  198. this.$common.transBaseDateTime(
  199. _this.activityDetail.activityStartTime
  200. );
  201. _this.activityDetail.activityEndTime =
  202. this.$common.transBaseToDateTime(
  203. _this.activityDetail.activityEndTime
  204. );
  205. if (_this.activityDetail.collectorsStatus === "2") {
  206. _this.active = true;
  207. } else {
  208. _this.active = false;
  209. }
  210. _this.number =
  211. _this.activityDetail.limitPersonNumber -
  212. _this.activityDetail.partakeNumber;
  213. _this.activityDetail.activityFile = JSON.parse(
  214. res.data.info.activityFile
  215. );
  216. }
  217. if (res.data.signInfo) {
  218. this.signInfo = res.data.signInfo;
  219. if (res.data.signInfo == 2) {
  220. this.$showToast("该企业已签到");
  221. }
  222. this.signInfo.signInCode = _this.signInCode;
  223. }
  224. });
  225. },
  226. getApply() {
  227. this.$refs.apply.init(this.signInfo);
  228. },
  229. goAddress(address) {
  230. if (address === null || undefined === address || address === "") {
  231. this.$showToast("地址不能为空");
  232. return false;
  233. } else {
  234. this.navigation(address);
  235. }
  236. },
  237. changeCollectorsStatus() {
  238. if (this.active) {
  239. const _this = this;
  240. clickCollect({
  241. id: this.id,
  242. userId: getUserLocalStorageInfo().user.id,
  243. collectorsStatus: "1",
  244. }).then((res) => {
  245. _this.getActivityById();
  246. });
  247. } else {
  248. const _this = this;
  249. clickCollect({
  250. id: this.id,
  251. userId: getUserLocalStorageInfo().user.id,
  252. collectorsStatus: "2",
  253. }).then((res) => {
  254. _this.getActivityById();
  255. });
  256. }
  257. },
  258. },
  259. };
  260. </script>
  261. <style lang="scss" type="text/scss" >
  262. // 底部按钮
  263. .but-bottom {
  264. position: fixed;
  265. bottom: 0;
  266. left: 0;
  267. width: 100%;
  268. line-height: 120rpx;
  269. background: $main;
  270. color: #fff;
  271. font-size: 36rpx;
  272. text-align: center;
  273. }
  274. .text {
  275. font-size: 24rpx;
  276. color: $text5;
  277. margin-top: 32rpx;
  278. }
  279. .detail {
  280. box-sizing: border-box;
  281. background-color: #f2f2f2;
  282. padding: 0 0 140rpx;
  283. overflow-y: auto;
  284. .detail-body {
  285. .img-text {
  286. img {
  287. height: 420rpx;
  288. width: 100%;
  289. }
  290. }
  291. .collect-part {
  292. background-color: #fff;
  293. height: 120rpx;
  294. padding: 0 30rpx;
  295. margin-bottom: 10rpx;
  296. @include flex;
  297. .normal-tip {
  298. }
  299. .right {
  300. @include flex;
  301. .num {
  302. margin-right: 20rpx;
  303. font-size: 24rpx;
  304. color: #333333;
  305. }
  306. }
  307. }
  308. .tel-part {
  309. display: flex;
  310. width: 100%;
  311. background-color: #fff;
  312. margin-bottom: 10rpx;
  313. padding: 0 30rpx;
  314. .tel-name {
  315. color: #333;
  316. font-size: 32rpx;
  317. font-weight: 700;
  318. }
  319. .custom-tel-component {
  320. width: 400rpx;
  321. .left {
  322. font-size: 26rpx;
  323. }
  324. }
  325. }
  326. }
  327. .info-part {
  328. background-color: #fff;
  329. overflow-y: auto;
  330. height: calc(100vh - 700rpx);
  331. box-sizing: border-box;
  332. padding: 40rpx 30rpx;
  333. .tit {
  334. padding-left: 2.667vw;
  335. position: relative;
  336. font-size: 4.267vw;
  337. &::after {
  338. content: "";
  339. width: 0.8vw;
  340. height: 90%;
  341. background-color: #976dec;
  342. border-radius: 0.4vw;
  343. position: absolute;
  344. left: 0;
  345. top: 50%;
  346. -webkit-transform: translateY(-50%);
  347. transform: translateY(-50%);
  348. }
  349. }
  350. .info-item {
  351. padding: 10rpx 0rpx;
  352. margin-bottom: 20rpx;
  353. .custom-item-tit {
  354. font-size: 32rpx;
  355. font-weight: 700;
  356. }
  357. .text {
  358. font-size: 24rpx;
  359. color: $text5;
  360. margin-top: 32rpx;
  361. .add {
  362. margin-right: 40rpx;
  363. }
  364. .dh {
  365. width: 100rpx;
  366. text-align: center;
  367. display: inline-block;
  368. color: $main;
  369. border-left: 1rpx solid #666666;
  370. }
  371. }
  372. &:last-child {
  373. margin-bottom: 0rpx;
  374. }
  375. }
  376. }
  377. }
  378. </style>
  379. <style lang="scss">
  380. </style>