健康同学微信公众号h5项目
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

422 行
10KB

  1. <!-- -->
  2. <template>
  3. <div class="pageContent devlopment">
  4. <router-link to="/planDescription">
  5. <div class="bannar radius">
  6. <div class="image">
  7. <img src="@/assets/development/images/banner1.png" alt="" />
  8. </div>
  9. <div class="button min-text">了解详情</div>
  10. </div>
  11. </router-link>
  12. <div v-if="task">
  13. <div class="gap">当前任务</div>
  14. <div class="task">
  15. <div class="image">
  16. <img src="@/assets/development/images/task.png" alt="" />
  17. </div>
  18. <div class="task-detail">
  19. <div class="task-title">
  20. <div>
  21. <span>{{ task.planName }}</span>
  22. <span>{{ task.levelLv }}</span>
  23. </div>
  24. <div class="mid-text bold">{{ task.target }}</div>
  25. </div>
  26. <div class="task-times">
  27. <div class="task-time" v-for="(item, index) in task.taskDatas" :key="index" @click="toTask(item)">
  28. <div class="task-time-info">
  29. <div class="task-time-text">{{ item.name }}</div>
  30. <div class="task-time-button min-text" v-if="item.status !== 2">
  31. {{ item.submitType === 2 ? '完成问卷' : item.submitType === 0 ? '查看进度' : '上传打卡' }}
  32. </div>
  33. </div>
  34. <div class="task-time-icon">
  35. <div class="task-time-icon-active" v-if="item.status === 2">
  36. <div class="image">
  37. <img src="@/assets/development/images/active.png" alt="" />
  38. </div>
  39. </div>
  40. <div class="task-time-icon-unactive" v-else>
  41. <div class="image">
  42. <img src="@/assets/development/images/unactive.png" alt="" />
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="levels">
  52. <div
  53. class="level radius"
  54. v-for="(item, index) in levels"
  55. :key="index"
  56. :class="{
  57. unlock: item.status === 3,
  58. now: item.status === 1,
  59. active: item.status === 2
  60. }"
  61. @click="toDetail(item)"
  62. >
  63. <div class="bg">
  64. <div class="image">
  65. <img :src="item.image" alt="" />
  66. </div>
  67. </div>
  68. <div class="level-info">
  69. <div class="level-info-level">
  70. <div class="level-info-text">{{ item.levelName }}</div>
  71. <div class="level-info-status">
  72. {{
  73. item.status === 0
  74. ? '未解锁'
  75. : item.status === 3
  76. ? '可查看'
  77. : item.status === 1
  78. ? '进行中'
  79. : item.status === 2
  80. ? '已完成'
  81. : '未知'
  82. }}
  83. </div>
  84. </div>
  85. <div class="level-info-title">
  86. <div class="level-info-title-text">{{ item.title }}</div>
  87. <div class="level-info-title-desc">{{ item.desc }}</div>
  88. </div>
  89. </div>
  90. <div class="tip">
  91. <div class="image">
  92. <img :src="active" alt="" v-if="item.status === 1 || item.status === 2 || item.status === 3" />
  93. <img :src="unactive" alt="" v-else />
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. import development from '@/api/development';
  102. const active = require('@/assets/development/images/leveTip.png');
  103. const unactive = require('@/assets/development/images/leveTipGray.png');
  104. export default {
  105. data() {
  106. return {
  107. active,
  108. unactive,
  109. task: null,
  110. levels: []
  111. };
  112. },
  113. created() {
  114. // 写死一个用户Id
  115. this.$store.commit(
  116. 'authToken',
  117. 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJVc2VySW5mbyI6eyJJZCI6NCwiU291cmNlVHlwZSI6MSwiVXNlcklkIjoiNWE2OThlOTQtOGM0MS00ZWM1LWJiM2MtNGFiYWIyZjM3Y2QxIiwiTG9naW5OYW1lIjoiMTg2NjQyNzI3NDMiLCJMb2dpblR5cGUiOjF9LCJFeHAiOjE3MTQ0NjAxNDY5NTkuMH0.KV1AQ1fDcbds9QvqxyMe3gRzEN83eMJKd9YF_jPnY8w'
  118. );
  119. this.$store.commit('userId', '5a698e94-8c41-4ec5-bb3c-4abab2f37cd1');
  120. this.$store.commit('personId', 26);
  121. },
  122. mounted() {
  123. this.initData();
  124. },
  125. methods: {
  126. async initData() {
  127. this.getTasks();
  128. this.getLevels();
  129. },
  130. async getLevels() {
  131. let re = await development.LevelList();
  132. if (re) {
  133. if (re.succeed) {
  134. if (re.data && Array.isArray(re.data) && re.data.length > 0) {
  135. let list = re.data.map(item => {
  136. return {
  137. id: item.id,
  138. level: item.level,
  139. levelName: item.levelLv,
  140. title: item.target,
  141. desc: `赢取${item.reward}`,
  142. status: item.status,
  143. image: require(`@/assets/development/images/leve_${item.level}.png`)
  144. };
  145. });
  146. this.levels = list;
  147. }
  148. } else {
  149. this.$message.error(re.message);
  150. }
  151. }
  152. },
  153. async getTasks() {
  154. let re = await development.CurrentTask();
  155. if (re) {
  156. if (re.succeed) {
  157. if (re.data && Array.isArray(re.data) && re.data.length > 0) {
  158. this.task = re.data[0];
  159. }
  160. //测试
  161. // this.task = {
  162. // planName: '健康同学成长计划-测试',
  163. // levelId: 1,
  164. // name: '启蒙熊',
  165. // level: 1,
  166. // levelLv: 'Lv01',
  167. // serialNumber: '阶段1',
  168. // target: '美好开始',
  169. // coverH5: '',
  170. // unlockType: 0,
  171. // status: 1,
  172. // taskDatas: [
  173. // {
  174. // id: 5,
  175. // rankId: 1,
  176. // name: '幸运熊计划玩法攻略阅读1次',
  177. // roleType: 1,
  178. // submitType: 0,
  179. // status: 0
  180. // },
  181. // {
  182. // id: 6,
  183. // rankId: 2,
  184. // name: '完成填写育儿问卷1次',
  185. // roleType: 2,
  186. // submitType: 2,
  187. // status: 0
  188. // },
  189. // {
  190. // id: 7,
  191. // rankId: 3,
  192. // name: '陪伴孩子读赠送的书籍1次',
  193. // roleType: 2,
  194. // submitType: 1,
  195. // status: 0
  196. // }
  197. // ]
  198. // };
  199. } else {
  200. this.$message.error(re.message);
  201. }
  202. }
  203. },
  204. toTask(item) {
  205. if (item.status === 2) {
  206. return;
  207. }
  208. if (item.submitType === 2) {
  209. this.$toast('问卷调查');
  210. } else if (item.submitType === 0) {
  211. this.$router.push({
  212. name: 'taskWearing',
  213. params: {
  214. id: item.id,
  215. rankId: item.rankId
  216. }
  217. });
  218. } else {
  219. this.$router.push({
  220. name: 'taskSubmission',
  221. params: {
  222. id: item.id,
  223. rankId: item.rankId
  224. }
  225. });
  226. }
  227. },
  228. toDetail(item) {
  229. this.$router.push({
  230. name: 'taskDetail',
  231. params: {
  232. id: item.id
  233. }
  234. });
  235. }
  236. }
  237. };
  238. </script>
  239. <style scoped lang="scss">
  240. @import './include.scss';
  241. .min-text {
  242. font-size: 25px;
  243. font-weight: 400;
  244. }
  245. .mid-text {
  246. font-size: 28px;
  247. font-weight: 400;
  248. }
  249. .radius {
  250. border-radius: 60px;
  251. }
  252. .bold {
  253. font-weight: bold;
  254. }
  255. .gap {
  256. padding-left: 35px;
  257. }
  258. .devlopment {
  259. padding-top: 30px;
  260. font-weight: bold;
  261. .bannar {
  262. overflow: hidden;
  263. position: relative;
  264. width: 100%;
  265. min-height: 200px;
  266. .button {
  267. position: absolute;
  268. right: 5%;
  269. bottom: 9%;
  270. padding: 10px 20px;
  271. color: white;
  272. background-color: #000;
  273. border-radius: 40px;
  274. }
  275. }
  276. .task {
  277. overflow: hidden;
  278. position: relative;
  279. width: 100%;
  280. height: 750px;
  281. border-radius: 40px;
  282. background: #ff5f8b;
  283. .image {
  284. position: absolute;
  285. left: 0;
  286. top: 0;
  287. z-index: 1;
  288. }
  289. .task-detail {
  290. position: absolute;
  291. left: 0;
  292. top: 0;
  293. width: 100%;
  294. height: 100%;
  295. z-index: 2;
  296. .task-title {
  297. display: flex;
  298. justify-content: space-between;
  299. align-items: flex-end;
  300. padding: 20px 40px;
  301. .mid-text {
  302. font-size: 30px;
  303. }
  304. }
  305. .task-times {
  306. display: flex;
  307. flex-direction: column;
  308. align-items: flex-end;
  309. padding: 0px 60px;
  310. padding-top: 20px;
  311. .task-time {
  312. display: flex;
  313. align-items: flex-end;
  314. margin-bottom: 20px;
  315. .task-time-info {
  316. display: flex;
  317. flex-direction: column;
  318. align-items: center;
  319. .task-time-text {
  320. letter-spacing: 5px;
  321. }
  322. .task-time-button {
  323. align-self: flex-end;
  324. padding: 0px 30px;
  325. color: white;
  326. background-color: #000;
  327. border-radius: 40px;
  328. }
  329. }
  330. .task-time-icon {
  331. width: 50px;
  332. height: 50px;
  333. margin-left: 20px;
  334. div {
  335. width: 100%;
  336. height: 100%;
  337. }
  338. .image {
  339. position: relative;
  340. }
  341. }
  342. }
  343. }
  344. }
  345. }
  346. .levels {
  347. position: relative;
  348. padding-top: 20px;
  349. .level {
  350. overflow: hidden;
  351. position: relative;
  352. width: 100%;
  353. height: 270px;
  354. color: white;
  355. margin-top: 20px;
  356. background: #b3b3b3;
  357. .bg {
  358. position: absolute;
  359. width: 100%;
  360. height: 100%;
  361. z-index: 1;
  362. }
  363. .level-info {
  364. position: absolute;
  365. display: flex;
  366. flex-direction: column;
  367. justify-content: space-around;
  368. height: 100%;
  369. padding-left: 260px;
  370. z-index: 3;
  371. .level-info-level {
  372. .level-info-text {
  373. font-size: 50px;
  374. letter-spacing: 2px;
  375. }
  376. .level-info-status {
  377. font-size: 25px;
  378. font-weight: 400;
  379. }
  380. }
  381. .level-info-title {
  382. font-size: 34px;
  383. letter-spacing: 2px;
  384. }
  385. }
  386. .tip {
  387. position: absolute;
  388. right: 20px;
  389. top: 20px;
  390. width: 120px;
  391. height: 173px;
  392. z-index: 3;
  393. }
  394. }
  395. .unlock {
  396. background: #ff5f8b;
  397. }
  398. .now {
  399. background: #8dc21f;
  400. }
  401. .active {
  402. background: #179b3b;
  403. }
  404. }
  405. }
  406. </style>