function.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="function-btn" :style="functionBtnStyle">
  3. <div class="function-title">{{ item.name }}</div>
  4. <div class="function-icon">
  5. <a-avatar
  6. v-if="item.icon === '单点登录.png'"
  7. class="function-avatar-small"
  8. shape="square"
  9. size="small"
  10. :src="requireImg('functionColor/' + item.icon)"
  11. ></a-avatar>
  12. <a-avatar
  13. v-else
  14. class="function-avatar"
  15. shape="square"
  16. size="large"
  17. :src="requireImg('functionColor/' + item.icon)"
  18. ></a-avatar>
  19. </div>
  20. <div class="function-btn-opr" v-if="type == -1" @click="minusFunction(item)">
  21. <span class="anticon">
  22. <svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
  23. <path
  24. d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z"
  25. fill="#cd2a2a"
  26. stroke="#cd2a2a"
  27. stroke-width="4"
  28. stroke-linejoin="round"
  29. />
  30. <path d="M16 24L32 24" stroke="#FFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
  31. </svg>
  32. </span>
  33. </div>
  34. <div class="function-btn-opr" v-if="type === 1" @click="plusFunction(item)">
  35. <span class="anticon">
  36. <svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
  37. <path
  38. d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z"
  39. fill="#2ea8e6"
  40. stroke="#2ea8e6"
  41. stroke-width="4"
  42. stroke-linejoin="round"
  43. />
  44. <path d="M24 16V32" stroke="#FFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
  45. <path d="M16 24L32 24" stroke="#FFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" />
  46. </svg>
  47. </span>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { requireImg } from "@/utils/requireImg";
  53. export default {
  54. methods: { requireImg },
  55. data() {
  56. return {
  57. functionBtnStyle: {
  58. backgroundColor: ""
  59. }
  60. };
  61. },
  62. props: {
  63. item: Object,
  64. type: Number,
  65. title: String,
  66. icon: String,
  67. plusFunction: Function,
  68. minusFunction: Function
  69. },
  70. mounted() {
  71. if (this.type == -1) {
  72. this.functionBtnStyle.backgroundColor = "#f2f2f2";
  73. this.functionBtnStyle.cursor = "default";
  74. } else if (this.type == 1) {
  75. this.functionBtnStyle.backgroundColor = "#f7fcff";
  76. this.functionBtnStyle.cursor = "default";
  77. }
  78. }
  79. };
  80. </script>
  81. <style lang="less" scoped>
  82. .function-btn {
  83. width: 95%;
  84. height: 40px;
  85. margin: 10px 10px;
  86. position: relative;
  87. cursor: pointer;
  88. border: 1px solid #e5f2ff;
  89. box-shadow: 0px 1px 5px 0px rgba(223, 229, 235, 0.5);
  90. border-radius: 4px;
  91. display: flex;
  92. align-items: center;
  93. justify-content: space-evenly;
  94. flex-wrap: nowrap;
  95. .function-icon {
  96. margin-left: 10%;
  97. display: inline-block;
  98. .function-avatar {
  99. width: 30px;
  100. height: 30px;
  101. }
  102. .function-avatar-small {
  103. width: 20px;
  104. height: 20px;
  105. }
  106. }
  107. .function-title {
  108. width: 55%;
  109. line-height: 20px;
  110. vertical-align: middle;
  111. display: inline-block;
  112. //margin-top: 20px;
  113. margin-left: 5%;
  114. font-size: 16px;
  115. letter-spacing: 1px;
  116. white-space: pre-wrap;
  117. word-break: break-word;
  118. }
  119. .function-btn-opr {
  120. position: absolute;
  121. top: -8px;
  122. right: -5px;
  123. cursor: pointer;
  124. }
  125. }
  126. .function-btn:hover {
  127. background-color: #f2f9ff;
  128. }
  129. </style>