theme.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="theme">
  3. <view class="title">请先选定一个主题进行追踪</view>
  4. <view class="content">
  5. <view class="item"
  6. v-for="(item, index) in themeList"
  7. @click="checkedHandle(item)"
  8. :key="index">
  9. <view class="left">
  10. <image :src="`../../static/theme${item.id}.png`"></image>
  11. </view>
  12. <view class="right">
  13. <text>{{item.title}}</text>
  14. <text>{{item.des}}</text>
  15. </view>
  16. <image v-if="theme.id === item.id" src="../../../static/theme.png"></image>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { mapState } from "vuex";
  23. import {themeList} from "./utils.js";
  24. export default {
  25. data() {
  26. return {
  27. themeList
  28. }
  29. },
  30. computed: {
  31. ...mapState({
  32. theme: state => state.creatingSituations.theme
  33. })
  34. },
  35. methods: {
  36. checkedHandle: function(item) {
  37. this.myCommit('theme', item);
  38. this.myCommit('needReload', true);
  39. this.myCommit('stepActive', 1);
  40. },
  41. myCommit: function(key, data) {
  42. this.$store.commit({type: 'creatingSituations/comChangeState',key,data});
  43. }
  44. }
  45. }
  46. </script>
  47. <style lang="less">
  48. .theme {
  49. overflow: hidden;
  50. width: 100%;
  51. .content {
  52. display: flex;
  53. flex-direction: column;
  54. align-items: center;
  55. .item {
  56. position: relative;
  57. display: flex;
  58. flex-direction: row;
  59. margin: 62.5rpx 0;
  60. border-radius: 15rpx;
  61. padding: 37.5rpx 50rpx;
  62. width: 625rpx;
  63. height: 187.5rpx;
  64. background: linear-gradient(270deg, #6697FE 0%, #4980F2 100%);
  65. box-shadow: 0 12.5rpx 12.5rpx 0 rgba(73, 128, 242, 0.2);
  66. >image {
  67. position: absolute;
  68. top: 10rpx;
  69. right: 10rpx;
  70. width: 46.87rpx;
  71. height: 46.87rpx;
  72. }
  73. .left {
  74. margin-right: 25rpx;
  75. image {
  76. width: 112.5rpx;
  77. height: 112.5rpx;
  78. }
  79. }
  80. .right {
  81. display: flex;
  82. flex-direction: column;
  83. text {
  84. font-size: 17.5rpx;
  85. line-height: 25rpx;
  86. color: #fff;
  87. &:first-child {
  88. margin-bottom: 5rpx;
  89. font-size: 30rpx;
  90. font-weight: bold;
  91. line-height: 45rpx;
  92. }
  93. }
  94. }
  95. &:first-child {
  96. margin-top: 125rpx;
  97. background: linear-gradient(270deg, #00CCBB 0%, #00CCAA 100%);
  98. box-shadow: 0 12.5rpx 12.5rpx 0 rgba(0, 204, 170, 0.2);
  99. }
  100. }
  101. }
  102. }
  103. </style>