detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <view class="container main">
  3. <view class="one">
  4. <image class="image" :src="getUrl(info.file)"></image>
  5. </view>
  6. <view class="two">
  7. <view class="two_1 name">{{info.name||'暂无活动名称'}}</view>
  8. <view class="two_1 text_color">
  9. <text class="t-icon t-icon-shizhong"></text>
  10. <span>{{getTime(info.start_time,info.end_time)||'暂无'}}</span>
  11. </view>
  12. <view class="two_1 text_color">
  13. <text class="t-icon t-icon-gonglve"></text>
  14. <span>{{getDict(info.match_type,'type')||'自办'}}</span>
  15. </view>
  16. <view class="two_1 text_color">
  17. <text class="t-icon t-icon-gongsi"></text>
  18. <span>{{info.work||'暂无组织单位'}}</span>
  19. </view>
  20. </view>
  21. <tabs :tabs="tabs" @tabsChange="tabsChange">
  22. <view class="tabsList">
  23. <view v-if="tabs.active=='0'">
  24. <view class="thr">
  25. <view class="thr_cont" v-if="info.rules&&info.rules.rules1">
  26. <view class="thr_1">大赛背景</view>
  27. <view class="thr_2">
  28. <rich-text :nodes="formatRichText(info.rules.rules1)"></rich-text>
  29. </view>
  30. </view>
  31. <view class="thr_cont" v-if="info.rules&&info.rules.rules2">
  32. <view class="thr_1">大赛主题和目标</view>
  33. <view class="thr_2">
  34. <rich-text :nodes="formatRichText(info.rules.rules2)"></rich-text>
  35. </view>
  36. </view>
  37. <view class="thr_cont" v-if="info.rules&&info.rules.rules3">
  38. <view class="thr_1">大赛基本情况介绍</view>
  39. <view class="thr_2">
  40. <rich-text :nodes="formatRichText(info.rules.rules3)"></rich-text>
  41. </view>
  42. </view>
  43. <view class="thr_cont" v-if="info.rules&&info.rules.rules4">
  44. <view class="thr_1">赛题任务</view>
  45. <view class="thr_2">
  46. <rich-text :nodes="formatRichText(info.rules.rules4)"></rich-text>
  47. </view>
  48. </view>
  49. <view class="thr_cont" v-if="info.rules&&info.rules.rules5">
  50. <view class="thr_1">赛程安排</view>
  51. <view class="thr_2">
  52. <rich-text :nodes="formatRichText(info.rules.rules5)"></rich-text>
  53. </view>
  54. </view>
  55. <view class="thr_cont" v-if="info.rules&&info.rules.rules6">
  56. <view class="thr_1">赛制阶段</view>
  57. <view class="thr_2">
  58. <rich-text :nodes="formatRichText(info.rules.rules6)"></rich-text>
  59. </view>
  60. </view>
  61. <view class="thr_cont" v-if="info.rules&&info.rules.rules7">
  62. <view class="thr_1">参赛资格</view>
  63. <view class="thr_2">
  64. <rich-text :nodes="formatRichText(info.rules.rules7)"></rich-text>
  65. </view>
  66. </view>
  67. <view class="thr_cont" v-if="info.rules&&info.rules.rules8">
  68. <view class="thr_1">参赛报名</view>
  69. <view class="thr_2">
  70. <rich-text :nodes="formatRichText(info.rules.rules8)"></rich-text>
  71. </view>
  72. </view>
  73. <view class="thr_cont" v-if="info.rules&&info.rules.rules9">
  74. <view class="thr_1">奖项设置与奖励办法</view>
  75. <view class="thr_2">
  76. <rich-text :nodes="formatRichText(info.rules.rules9)"></rich-text>
  77. </view>
  78. </view>
  79. <view class="thr_cont" v-if="info.rules&&info.rules.rules10">
  80. <view class="thr_1">组织单位</view>
  81. <view class="thr_2">
  82. <rich-text :nodes="formatRichText(info.rules.rules10)"></rich-text>
  83. </view>
  84. </view>
  85. <view class="thr_cont" v-if="info.rules&&info.rules.rules11">
  86. <view class="thr_1">赛事联络</view>
  87. <view class="thr_2">
  88. <rich-text :nodes="formatRichText(info.rules.rules11)"></rich-text>
  89. </view>
  90. </view>
  91. <view class="thr_cont" v-if="info.rules&&info.rules.rules12">
  92. <view class="thr_1">赛事交流</view>
  93. <view class="thr_2">
  94. <rich-text :nodes="formatRichText(info.rules.rules12)"></rich-text>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="thr">
  99. <view class="thr_cont" v-if="info.brief">
  100. <view class="thr_1">常见问题</view>
  101. <view class="thr_2">
  102. <rich-text :nodes="formatRichText(info.brief)"></rich-text>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view v-if="tabs.active=='1'">
  108. <view class="thr">
  109. <view class="thr_cont">
  110. <view class="thr_1">报名信息</view>
  111. <view class="thr_2" v-if="info.form!='3'">
  112. <view class="thr_label">
  113. <view class="left">姓名</view>
  114. <view class="right textOne">
  115. <text>{{sign.name||'暂无姓名'}}</text>
  116. </view>
  117. </view>
  118. <view class="thr_label">
  119. <view class="left">证件类型</view>
  120. <view class="right textOne">
  121. <text>{{getDict(sign.cardType,'cardType')||'暂无证件类型'}}</text>
  122. </view>
  123. </view>
  124. <view class="thr_label">
  125. <view class="left">证件号码</view>
  126. <view class="right textOne">
  127. <text>{{sign.card||'暂无证件号码'}}</text>
  128. </view>
  129. </view>
  130. <view class="thr_label">
  131. <view class="left">手机号</view>
  132. <view class="right textOne">
  133. <text>{{sign.phone||'暂无手机号'}}</text>
  134. </view>
  135. </view>
  136. <view class="thr_label">
  137. <view class="left">电子邮箱</view>
  138. <view class="right textOne">
  139. <text>{{sign.email||'暂无电子邮箱'}}</text>
  140. </view>
  141. </view>
  142. <view class="thr_label">
  143. <view class="left">微信/QQ</view>
  144. <view class="right textOne">
  145. <text>{{sign.communication||'暂无微信/QQ'}}</text>
  146. </view>
  147. </view>
  148. <view class="thr_label">
  149. <view class="left">报名时间</view>
  150. <view class="right textOne">
  151. <text>{{sign.time||'暂无报名时间'}}</text>
  152. </view>
  153. </view>
  154. </view>
  155. <view class="thr_2" v-else>
  156. <view class="thr_label">
  157. <view class="left">姓名</view>
  158. <view class="right textOne">
  159. <text>{{sign.name||'暂无姓名'}}</text>
  160. </view>
  161. </view>
  162. <view class="thr_label">
  163. <view class="left">联系电话</view>
  164. <view class="right textOne">
  165. <text>{{sign.phone||'暂无联系电话'}}</text>
  166. </view>
  167. </view>
  168. <view class="thr_label">
  169. <view class="left">报名类型</view>
  170. <view class="right textOne">
  171. <text>{{getDict(sign.type,'sign')||'暂无报名类型'}}</text>
  172. </view>
  173. </view>
  174. <view class="thr_label">
  175. <view class="left">公司名称</view>
  176. <view class="right textOne">
  177. <text>{{sign.company||'暂无公司名称'}}</text>
  178. </view>
  179. </view>
  180. <view class="thr_label" v-if="sign.type=='1'">
  181. <view class="left">路演名称</view>
  182. <view class="right textOne">
  183. <text>{{sign.project_name||'暂无路演名称'}}</text>
  184. </view>
  185. </view>
  186. <view class="thr_label" v-if="sign.type=='1'">
  187. <view class="left">路演简介</view>
  188. <view class="right textOne">
  189. <text>{{sign.project_brief||'暂无路演简介'}}</text>
  190. </view>
  191. </view>
  192. <view class="thr_label" v-if="sign.type=='1'">
  193. <view class="left">路演附件</view>
  194. <view class="right textOne">
  195. <text v-if="sign.project_file&&sign.project_file.length>0"
  196. @click="viewFile(sign.project_file[0].url)">
  197. {{sign.project_file[0].name||'暂无路演附件'}}
  198. </text>
  199. <text v-else>暂无路演附件</text>
  200. </view>
  201. </view>
  202. <view class="thr_label">
  203. <view class="left">报名时间</view>
  204. <view class="right textOne">
  205. <text>{{sign.time||'暂无报名时间'}}</text>
  206. </view>
  207. </view>
  208. </view>
  209. </view>
  210. <view class="button">
  211. <button class="danger" size="mini" type="warn" @tap.stop="toEdit(sign)"
  212. v-if="sign.status!=='1'">修改报名信息</button>
  213. </view>
  214. </view>
  215. </view>
  216. <view v-else>
  217. <view class="list" v-for="(item, index) in score" :key="index">
  218. <view class="value">
  219. <view class="title">流程名称:</view>
  220. <view class="label">{{item.matchPath_name||'暂无'}}</view>
  221. </view>
  222. <view class="value">
  223. <view class="title">分数:</view>
  224. <view class="label">{{item.score||'暂无'}}</view>
  225. </view>
  226. <view class="value">
  227. <view class="title">时间:</view>
  228. <view class="label">{{item.time||'暂无'}}</view>
  229. </view>
  230. </view>
  231. </view>
  232. </view>
  233. </tabs>
  234. </view>
  235. </template>
  236. <script>
  237. import tabs from '../../components/tabs/index.vue';
  238. export default {
  239. components: {
  240. tabs
  241. },
  242. data() {
  243. return {
  244. id: '',
  245. tabs: {
  246. active: '0',
  247. bgColor: '#ffffff',
  248. menu: [{
  249. title: '活动内容',
  250. active: '0'
  251. }, {
  252. title: '报名信息',
  253. active: '1'
  254. }]
  255. },
  256. user: {},
  257. config: {},
  258. info: {},
  259. // 报名信息
  260. sign: {},
  261. // 分数信息
  262. score: {},
  263. // 字典表
  264. statusList: [],
  265. cTypeList: [],
  266. typeList: [],
  267. signTypeList: []
  268. }
  269. },
  270. onLoad: async function(e) {
  271. const that = this;
  272. that.$set(that, `id`, e && e.id || '');
  273. that.searchConfig();
  274. that.searchToken();
  275. },
  276. onShow: async function() {
  277. const that = this;
  278. await that.searchOther();
  279. await that.search();
  280. },
  281. methods: {
  282. // 用户信息
  283. searchToken() {
  284. const that = this;
  285. try {
  286. const res = uni.getStorageSync('token');
  287. if (res) {
  288. const user = that.$jwt(res);
  289. that.$set(that, `user`, user);
  290. }
  291. } catch (e) {}
  292. },
  293. searchConfig() {
  294. const that = this;
  295. try {
  296. const res = uni.getStorageSync('config');
  297. if (res) that.$set(that, `config`, res);
  298. } catch (e) {}
  299. },
  300. // 查询其他信息
  301. async searchOther() {
  302. const that = this;
  303. let res;
  304. // 查询状态
  305. res = await that.$api(`/dictData`, 'GET', {
  306. code: 'matchStatus',
  307. is_use: '0',
  308. })
  309. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  310. // 查询证件类型
  311. res = await that.$api(`/dictData`, 'GET', {
  312. code: 'cardType',
  313. is_use: '0',
  314. })
  315. if (res.errcode == '0') that.$set(that, `cTypeList`, res.data);
  316. // 赛事类型
  317. res = await that.$api(`/dictData`, 'GET', {
  318. code: 'activeType',
  319. is_use: '0',
  320. })
  321. if (res.errcode == '0') that.$set(that, `typeList`, res.data)
  322. // 报名类型
  323. res = await that.$api(`/dictData`, 'GET', {
  324. code: 'signType',
  325. is_use: '0',
  326. })
  327. if (res.errcode == '0') that.$set(that, `signTypeList`, res.data);
  328. },
  329. // 查询
  330. async search() {
  331. const that = this;
  332. if (that.id) {
  333. let res;
  334. res = await that.$api(`/sign/${that.id}`, 'GET', {})
  335. if (res.errcode == '0') {
  336. that.$set(that, `sign`, res.data)
  337. if (res.data.match) {
  338. const arr = await that.$api(`/match/${res.data.match}`, 'GET', {})
  339. if (res.errcode == '0') {
  340. that.$set(that, `info`, arr.data)
  341. if (arr.data.match_status == '2' || arr.data.match_status == '3') {
  342. await that.searchPath()
  343. }
  344. }
  345. }
  346. } else {
  347. uni.showToast({
  348. title: res.errmsg,
  349. });
  350. }
  351. }
  352. },
  353. async searchPath() {
  354. const that = this;
  355. that.$set(that.tabs, `menu`, [...that.tabs.menu, {
  356. title: '分数信息',
  357. active: '2'
  358. }])
  359. const arr = await that.$api(`/score/list`, 'GET', {
  360. match: that.info.id,
  361. sign: that.sign.id
  362. })
  363. if (arr.errcode == '0') that.$set(that, `score`, arr.data)
  364. },
  365. // 选择选项卡
  366. tabsChange(e) {
  367. const that = this;
  368. that.$set(that.tabs, `active`, e.active)
  369. },
  370. // 处理时间
  371. getTime(start_time, end_time) {
  372. if (start_time && end_time) {
  373. const start = new Date(start_time);
  374. const end = new Date(end_time);
  375. const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  376. const day = start.getDate();
  377. const weekday = weekdays[start.getDay()];
  378. const month = start.getMonth();
  379. const start_hours = start.getHours();
  380. const start_minutes = start.getMinutes();
  381. const end_hours = end.getHours();
  382. const end_minutes = end.getMinutes();
  383. return `${month}/${day < 10 ? '0' + day : day} ${weekday} ${start_hours.toString().padStart(2, '0')}:${start_minutes.toString().padStart(2, '0')} - ${end_hours.toString().padStart(2, '0')}:${end_minutes.toString().padStart(2, '0')} `;
  384. }
  385. },
  386. // 修改报名信息
  387. toEdit(item) {
  388. const that = this;
  389. if (that.info.form == '3') {
  390. uni.navigateTo({
  391. url: `/pagesMy/activity/active?id=${item.id}`
  392. })
  393. } else {
  394. uni.navigateTo({
  395. url: `/pagesMy/activity/add?id=${item.id}`
  396. })
  397. }
  398. },
  399. // 查看文件
  400. viewFile(e) {
  401. const that = this;
  402. uni.downloadFile({
  403. url: that.$config.serverFile + e,
  404. success: function(res) {
  405. var filePath = res.tempFilePath;
  406. uni.openDocument({
  407. filePath: filePath,
  408. showMenu: true,
  409. success: function(res) {
  410. console.log('打开文档成功');
  411. }
  412. });
  413. }
  414. });
  415. },
  416. // 图片处理
  417. getUrl(e) {
  418. const that = this;
  419. if (e && e.length > 0) return that.$config.serverFile + e[0].url
  420. else return '/static/match.png'
  421. },
  422. // 处理字典表
  423. getDict(item, model) {
  424. const that = this;
  425. let res
  426. if (model == 'status') res = that.statusList.find(i => i.value == item)
  427. else if (model == 'cardType') res = that.cTypeList.find(i => i.value == item)
  428. else if (model == 'type') res = that.typeList.find(i => i.value == item)
  429. else if (model == 'sign') res = that.signTypeList.find(i => i.value == item)
  430. if (res) return res.label
  431. else return '暂无'
  432. },
  433. // 处理富文本
  434. formatRichText(html) {
  435. if (html) {
  436. html = html.replace(/<table[^>]*>/gi, match => {
  437. // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
  438. return match.replace(/style="[^"]+"/gi,
  439. `style="border-collapse: collapse; width: 100%;text-align: center;"`)
  440. .replace(/<table/gi,
  441. `<table style="border-collapse: collapse; width: 100%;text-align: center;"`);
  442. });
  443. html = html.replace(/<th[^>]*>/gi, match => {
  444. // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
  445. return match.replace(/style="[^"]+"/gi,
  446. `style="border: 1px solid #ddd; padding: 8px; background-color: #f2f2f2;text-align: center;"`
  447. )
  448. .replace(/<table/gi,
  449. `<table style="border: 1px solid #ddd; padding: 8px; background-color: #f2f2f2;text-align: center;"`
  450. );
  451. });
  452. html = html.replace(/<td[^>]*>/gi, match => {
  453. // 如果已有 style 属性,替换为新的样式;如果没有,添加新的 style 属性
  454. return match.replace(/style="[^"]+"/gi,
  455. `style="border: 1px solid #ddd; padding: 8px;text-align: center;"`)
  456. .replace(/<table/gi,
  457. `<table style="border: 1px solid #ddd; padding: 8px;text-align: center;"`);
  458. });
  459. // 富文本内容格式化
  460. return html && html.replace(/<img[^>]*>/gi, function(match, capture) {
  461. // 查找所有的 img 元素
  462. return match.replace(/style=".*"/gi, '').replace(/style='.*'/gi,
  463. '')
  464. // 删除找到的所有 img 元素中的 style 属性
  465. }).replace(/\<img/gi, '<img style="width:100%;"') // 对 img 元素增加 style 属性,并设置宽度为 100%
  466. }
  467. },
  468. }
  469. }
  470. </script>
  471. <style lang="scss" scoped>
  472. .main {
  473. background-color: var(--f9Color);
  474. .one {
  475. .image {
  476. width: 100%;
  477. height: 50vw;
  478. }
  479. }
  480. .two {
  481. padding: 0 2vw;
  482. margin: 0 0 3vw 0;
  483. background-color: var(--mainColor);
  484. .two_1 {
  485. display: flex;
  486. align-items: center;
  487. padding: 3vw 0;
  488. border-bottom: 1px solid var(--f5Color);
  489. font-size: var(--font14Size);
  490. span {
  491. margin: 0 0 0 1vw;
  492. }
  493. .t-icon {
  494. width: var(--font15Size) !important;
  495. height: var(--font15Size) !important;
  496. }
  497. }
  498. .name {
  499. font-weight: bold;
  500. font-size: var(--font16Size);
  501. }
  502. .text_color {
  503. color: var(--f69Color);
  504. }
  505. }
  506. .tabsList {
  507. .list {
  508. background-color: var(--mainColor);
  509. border-bottom: 1px solid var(--f5Color);
  510. margin: 2vw 2vw 0 2vw;
  511. border-radius: 4px;
  512. padding: 3vw;
  513. .value {
  514. display: flex;
  515. align-items: center;
  516. .title {
  517. font-size: var(--font14Size);
  518. font-weight: bold;
  519. }
  520. .label {
  521. font-size: var(--font12Size);
  522. color: var(--f85Color);
  523. }
  524. }
  525. }
  526. .thr {
  527. background-color: var(--mainColor);
  528. .thr_cont {
  529. padding: 2vw 0 0 0;
  530. .thr_1 {
  531. text-indent: 10px;
  532. border-left: 3px solid var(--f3CColor);
  533. font-weight: bold;
  534. font-size: var(--font16Size);
  535. }
  536. .thr_2 {
  537. padding: 2vw;
  538. .thr_label {
  539. display: flex;
  540. justify-content: space-between;
  541. padding: 4vw;
  542. border-bottom: 1px solid var(--f9Color);
  543. font-size: var(--font14Size);
  544. color: var(--f69Color);
  545. .right {
  546. text-align: right;
  547. width: 60vw;
  548. }
  549. }
  550. }
  551. }
  552. .button {
  553. text-align: center;
  554. }
  555. }
  556. }
  557. }
  558. </style>