theme.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. height: 100%;
  52. .content {
  53. display: flex;
  54. flex-direction: column;
  55. align-items: center;
  56. .item {
  57. position: relative;
  58. display: flex;
  59. flex-direction: row;
  60. margin: 62.5rpx 0;
  61. border-radius: 15rpx;
  62. padding: 37.5rpx 50rpx;
  63. width: 625rpx;
  64. height: 187.5rpx;
  65. background: linear-gradient(270deg, #6697FE 0%, #4980F2 100%);
  66. box-shadow: 0 12.5rpx 12.5rpx 0 rgba(73, 128, 242, 0.2);
  67. >image {
  68. position: absolute;
  69. top: 10rpx;
  70. right: 10rpx;
  71. width: 46.87rpx;
  72. height: 46.87rpx;
  73. }
  74. .left {
  75. margin-right: 25rpx;
  76. image {
  77. width: 112.5rpx;
  78. height: 112.5rpx;
  79. }
  80. }
  81. .right {
  82. display: flex;
  83. flex-direction: column;
  84. text {
  85. font-size: 17.5rpx;
  86. line-height: 25rpx;
  87. color: #fff;
  88. &:first-child {
  89. margin-bottom: 5rpx;
  90. font-size: 30rpx;
  91. font-weight: bold;
  92. line-height: 45rpx;
  93. }
  94. }
  95. }
  96. &:first-child {
  97. margin-top: 125rpx;
  98. background: linear-gradient(270deg, #00CCBB 0%, #00CCAA 100%);
  99. box-shadow: 0 12.5rpx 12.5rpx 0 rgba(0, 204, 170, 0.2);
  100. }
  101. }
  102. }
  103. }
  104. </style>