activity_deatil.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <template>
  2. <view class="content">
  3. <view class="header">
  4. <view class="title-read">
  5. <view class="title">
  6. {{ model.title }}
  7. </view>
  8. <view class="read">阅读量 {{ model.read }}</view>
  9. </view>
  10. <view class="header-image">
  11. <image :src="model.url" alt="" />
  12. </view>
  13. </view>
  14. <view class="active-deatil">
  15. <ul>
  16. <li>
  17. <p class="name">活动时间</p>
  18. <p class="deatil-content">{{ model.date }}</p>
  19. </li>
  20. <li>
  21. <p class="name">活动类型</p>
  22. <p class="deatil-content">{{ model.type == 1 ? "线上" : "线下" }}</p>
  23. </li>
  24. <li>
  25. <p class="name">主办方</p>
  26. <p class="deatil-content">{{ model.way }}</p>
  27. </li>
  28. </ul>
  29. </view>
  30. <view class="rich">
  31. <activityRichCard :model="textModel" :isFold="true" />
  32. </view>
  33. <view class="share-box">
  34. <view class="share">
  35. <view class="shareCount">{{ model.share }}</view>
  36. <image src="../../static/share_icon.png"></image>
  37. </view>
  38. <view class="button"
  39. ><button
  40. @click="signUpActivity"
  41. :disabled="!(model.status == 0 && model.type == 2)"
  42. :class="{
  43. start: model.status == 0 && model.type == 2,
  44. begun: model.status == 1,
  45. ended: model.status == 2,
  46. falseStart: model.status == 0 && model.type == 1,
  47. }"
  48. >
  49. {{ model.activiteState }}
  50. </button></view
  51. >
  52. <!-- "status":"活动状态 0:待开始;1:已开始; 2:已结束
  53. "type":"活动类型 1:线上;2 线下"} -->
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import md5 from "@/common/md5.js";
  59. import activity_rich_card from "../policy/policy_rich_card";
  60. export default {
  61. filters: {
  62. formDateTime(value) {
  63. if (value) {
  64. const time = new Date(value * 1000);
  65. const y = time.getFullYear();
  66. const m =
  67. time.getMonth() + 1 < 10
  68. ? "0" + (time.getMonth() + 1)
  69. : time.getMonth() + 1;
  70. const d = time.getDate() < 10 ? "0" + time.getDate() : time.getDate();
  71. // const h = time.getHours()
  72. // const mm = time.getMinutes();
  73. // const s = time.getSeconds();
  74. return y + "." + m + "." + d;
  75. } else {
  76. return "";
  77. }
  78. },
  79. formDateTimeSecond(value) {
  80. if (value) {
  81. const time = new Date(value * 1000);
  82. // const y = time.getFullYear();
  83. // const m = (time.getMonth() + 1) < 10 ? '0' + (time.getMonth() + 1) : (time.getMonth() + 1);
  84. // const d = time.getDate() < 10 ? '0' + time.getDate(): time.getDate();
  85. const h =
  86. time.getHours() < 10 ? "0" + time.getHours() : time.getHours();
  87. const mm =
  88. time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes();
  89. return h + ":" + mm;
  90. } else {
  91. return "";
  92. }
  93. },
  94. },
  95. components: {
  96. activityRichCard: activity_rich_card,
  97. },
  98. data() {
  99. return {
  100. id: "",
  101. model: {
  102. title: "",
  103. read: 123,
  104. url: "",
  105. date: "",
  106. type: 1,
  107. status: 0,
  108. way: "",
  109. share: 0,
  110. activiteState: "",
  111. },
  112. textModel: {
  113. title: "活动内容",
  114. text:
  115. "<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;</strong>2021QQ名人赛第二季全明星王牌赛从开战至今便火爆出圈、收获超高关注度,明星嘉宾与主播联袂征战,激烈对抗燃爆整个电竞赛场;豪华的阵容加上新奇玩法,缔造全场高能的视觉盛宴!生而为战,精彩不断,如今第五期比赛余热未散,9月25日下午13:00的第六期比赛即将高能来袭!</p><p><br></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp;此外,在直播期间,还有Airpods pro、西伯利亚耳机、QQ年费黄钻、会员、绿钻以及白鹤梁神女,乞巧织情,战令币等多款礼品在直播间在线放送,一定不要错过咯~</strong></p><p>&nbsp;</p><p><strong>&nbsp;&nbsp;&nbsp;“奶味甜豆”张星特遇上“水系男孩”俞更寅!</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;本次全明星王牌赛王者专场第六期到场的明星嘉宾是张星特与俞更寅,两位实力vocal男神将在峡谷相遇,开启实力峡谷对决!</p><p>&nbsp;&nbsp;&nbsp;&nbsp;本期红方阵营出战的是被称为“奶味甜豆”的张星特,舞台上的他用自己迷人的声音和灿烂的微笑收获了不少观众的青睐,这个像星星一样闪闪发光的男孩,在生活中也是一个爱撒娇的“小甜豆”哦,期待他这次可以在展示自己电竞实力的同时也能“萌翻峡谷”~</p><p>&nbsp;&nbsp;&nbsp;&nbsp;本期蓝方阵营出战的是被称为“水系男孩”的俞更寅,他凭着自己对音乐的热爱,坚定地踏上了追梦之旅,用自己天籁般的嗓音治愈着观众,创造着一个又一个奇迹,当这个无畏逐梦的男孩来到峡谷,势必会给我们创造无限惊喜!</p><p>&nbsp;&nbsp;&nbsp;&nbsp;两位实力vocal男神降临峡谷,不仅能欣赏他们精彩的游戏技术还能看到他们“彪歌”“彪高音”,一起期待吧!</p><p><br></p><p><br></p><p><strong>&nbsp;&nbsp;&nbsp;&nbsp;打野天花板清清vs 8国服主播菜咪,实力与人气之争!</strong></p><p>&nbsp;&nbsp;&nbsp;&nbsp;本期我们还邀请到了两位技术流主播清清和菜咪。其中清清搭档张星特作为红方阵营,而菜咪搭档俞更寅作为蓝方阵营。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;作为拥有着国服最高战力曜的清清,一直是打野天花板的存在,这位教学殿堂级主播,素有“虎牙清清曜无敌”的美誉,其操作绝对值得一看;而拥有着双系统8国服的菜咪,一直凭借着自己超高的颜值和高超的辅助技术深受玩家喜爱,是人气爆火的实力派,其粉丝美称“菜咪不菜,峡谷打怪”!</p><p><br></p><p><br></p><p>&nbsp;&nbsp;&nbsp;&nbsp;除此之外,我们还邀请到了仙染、名辞、 汤汤、耀宇、乔妹等6位虎牙人气主播作为线上嘉宾,精兵强将在峡谷一决高下!</p><p>&nbsp;&nbsp;&nbsp;&nbsp;强强对决,到底红蓝双方谁能脱颖而出?记得关注9月25日下午13:00的2021QQ名人赛第二季全明星王牌赛第六期,届时将会为大家揭晓答案。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;2021QQ名人赛-虎牙直播全明星联赛,作为一档王牌明星电竞对抗赛事,由腾讯QQ主办,QQ游戏中心、QQ空间、QQicon联合主办,由虎牙直播独家直播呈现,携手战略合作伙伴先知电竞打造的全明星电竞赛事。赛事以王者荣耀、和平精英等热门游戏为比赛项目,聚合众多人气明星及游戏KOL进行游戏竞技。青春热血,生而为战,王牌聚集,开战无敌!</p><p>&nbsp;&nbsp;&nbsp;&nbsp;明星嘉宾携手知名主播在峡谷相约对战,精彩刺激的红蓝对决,现场互动玩法升级,请持续关注2021QQ名人赛第二季全明星王牌赛!</p><p>&nbsp;</p>",
  116. },
  117. };
  118. },
  119. onLoad(op) {
  120. this.id = op.id;
  121. this.getActivityDeatil();
  122. },
  123. methods: {
  124. getActivityDeatil() {
  125. let md5Sign = md5(
  126. "method=" +
  127. "common" +
  128. "&timestamp=" +
  129. getApp().globalData.globalTimestamp +
  130. "&secret=" +
  131. getApp().globalData.secret
  132. );
  133. let url =
  134. getApp().globalData.shareUrl +
  135. "api/api.php" +
  136. "?method=common&source=activity&action=info_by_id&timestamp=" +
  137. getApp().globalData.globalTimestamp +
  138. "&sign=" +
  139. md5Sign;
  140. let postData = {
  141. id: this.id,
  142. };
  143. //获取文章
  144. uni.request({
  145. url: url,
  146. method: "POST",
  147. header: {
  148. "content-type": "application/x-www-form-urlencoded",
  149. },
  150. data: postData,
  151. success: (res) => {
  152. if (res.data.code == 200) {
  153. console.log(res);
  154. let data = res.data.data;
  155. this.model.title = data.name;
  156. this.model.read =
  157. parseInt(data.base_read_count) + parseInt(data.real_read_count);
  158. this.model.url = getApp().globalData.shareUrl + data.pic_url;
  159. let arr = ["start_time", "end_time"];
  160. let ans = [];
  161. for (const item of arr) {
  162. let time = this.$options.filters["formDateTime"](data[item]);
  163. let timeSecond = this.$options.filters["formDateTimeSecond"](
  164. data[item]
  165. );
  166. ans.push(time + " " + timeSecond);
  167. }
  168. this.model.date = ans.join(" - ");
  169. this.model.type = data.type;
  170. this.model.status = data.status;
  171. this.model.way = data.sponsor;
  172. this.model.share =
  173. parseInt(data.real_repost_count) +
  174. parseInt(data.base_repost_count);
  175. if (data.status == 0) {
  176. if (data.type == 2) {
  177. this.model.activiteState = "我要参加";
  178. } else {
  179. this.model.activiteState = "活动待开始";
  180. }
  181. } else if (data.status == 1) {
  182. this.model.activiteState = "活动进行中";
  183. } else {
  184. this.model.activiteState = "活动已结束";
  185. }
  186. }
  187. this.getRich();
  188. },
  189. fail: () => {
  190. console.log("连接失败");
  191. },
  192. });
  193. },
  194. getRich() {
  195. uni.request({
  196. url:
  197. getApp().globalData.shareUrl +
  198. `content/activity/${Math.floor(this.id / 1000)}/${this.id}.html`,
  199. method: "GET",
  200. header: {
  201. "content-type": "application/x-www-form-urlencoded",
  202. },
  203. success: (res) => {
  204. console.log(res);
  205. if (res.statusCode === 200) {
  206. this.model.artical = res.data;
  207. }
  208. },
  209. fail: () => {
  210. console.log("连接失败");
  211. },
  212. });
  213. },
  214. signUpActivity() {
  215. let md5Sign = md5(
  216. "method=" +
  217. "common" +
  218. "&timestamp=" +
  219. getApp().globalData.globalTimestamp +
  220. "&secret=" +
  221. getApp().globalData.secret
  222. );
  223. let url =
  224. getApp().globalData.shareUrl +
  225. "api/api.php" +
  226. "?method=common&source=activity&action=active&timestamp=" +
  227. getApp().globalData.globalTimestamp +
  228. "&sign=" +
  229. md5Sign;
  230. let postData = {
  231. openId: getApp().globalData.open_id,
  232. id: this.id,
  233. };
  234. uni.request({
  235. url: url,
  236. method: "POST",
  237. header: {
  238. "content-type": "application/x-www-form-urlencoded",
  239. },
  240. data: postData,
  241. success: (res) => {
  242. if(res.data.code==200){
  243. console.log("报名成功");
  244. }
  245. },
  246. fail: () => {
  247. console.log("连接失败");
  248. },
  249. });
  250. },
  251. },
  252. };
  253. </script>
  254. <style lang="scss" scoped>
  255. .content {
  256. display: flex;
  257. flex-direction: column;
  258. .header {
  259. display: flex;
  260. height: 150rpx;
  261. padding: 20rpx;
  262. .title-read {
  263. height: 100%;
  264. display: flex;
  265. flex-direction: column;
  266. justify-content: space-evenly;
  267. .title {
  268. font-weight: 600;
  269. letter-spacing: 2rpx;
  270. font-size: 32rpx;
  271. }
  272. .read {
  273. margin-top: 20rpx;
  274. font-size: 22rpx;
  275. color: $uni-text-color-grey;
  276. }
  277. }
  278. .header-image {
  279. height: 100%;
  280. width: 50%;
  281. image {
  282. width: 100%;
  283. height: 100%;
  284. border-radius: 10%;
  285. }
  286. }
  287. }
  288. .active-deatil {
  289. padding: 20rpx;
  290. ul {
  291. padding: 30rpx;
  292. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  293. border-radius: 32rpx;
  294. li {
  295. margin-bottom: 30rpx;
  296. list-style: none;
  297. .name {
  298. margin-bottom: 10rpx;
  299. font-size: 30rpx;
  300. color: $uni-text-color-grey;
  301. }
  302. .deatil-content {
  303. font-size: 27rpx;
  304. }
  305. }
  306. }
  307. }
  308. .rich {
  309. margin-bottom: 150rpx;
  310. padding: 20rpx;
  311. }
  312. .share-box {
  313. box-sizing: border-box;
  314. height: 150rpx;
  315. width: 100%;
  316. align-items: center;
  317. justify-content: space-evenly;
  318. position: fixed;
  319. bottom: 0;
  320. display: flex;
  321. background: #ffffff;
  322. .share {
  323. display: flex;
  324. justify-content: center;
  325. align-items: center;
  326. width: 50rpx;
  327. height: 50rpx;
  328. position: relative;
  329. image {
  330. width: 100%;
  331. height: 100%;
  332. }
  333. .shareCount {
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. position: absolute;
  338. top: -30%;
  339. right: -30%;
  340. color: #ffffff;
  341. height: 30rpx;
  342. width: 30rpx;
  343. padding: 3rpx;
  344. font-size: 16rpx;
  345. border-radius: 50%;
  346. background: #fe3637;
  347. }
  348. }
  349. .button {
  350. height: 100rpx;
  351. width: 70%;
  352. display: flex;
  353. justify-content: center;
  354. button {
  355. width: 80%;
  356. height: 90%;
  357. border: 1px solid;
  358. outline: none;
  359. background: none;
  360. }
  361. .start {
  362. //待开始
  363. background-color: #00a8ea;
  364. color: #ffffff;
  365. border-color: none;
  366. }
  367. .begun {
  368. //已开始
  369. border-color: #00a8ea;
  370. color: #00a8ea;
  371. }
  372. .ended {
  373. //已结束
  374. color: #aaaaaa;
  375. border-color: #aaaaaa;
  376. }
  377. .falseStart {
  378. color: #70b603;
  379. border-color: #70b603;
  380. }
  381. }
  382. }
  383. }
  384. </style>