index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="project-box">
  3. <el-row style="padding-bottom: 16px">
  4. <el-input placeholder="请输入关键字" style="width: 240px" clearable @keyup.enter.native="ChangeKeyWord(keyWord)" v-model="keyWord">
  5. <i slot="prefix" class="el-input__icon el-icon-search" style="cursor: pointer" @click="ChangeKeyWord(keyWord)"></i>
  6. </el-input>
  7. <el-button style="float: right" @click="addProject">添加项目</el-button>
  8. </el-row>
  9. <div class="saga-brand-group">
  10. <el-row :gutter="16">
  11. <el-col :span="6" v-for="item in projectList" :key="item.id">
  12. <el-card shadow="always" class="project-card" :body-style="{ padding: '0px' }">
  13. <el-image style="width: 100%; height: 187px" :src="item.url">
  14. <div slot="error" class="image-slot">
  15. <i class="iconfont icon-wandajituan"></i>
  16. </div>
  17. </el-image>
  18. <div style="padding: 16px">
  19. <span class="project-name" :title="item.name">{{ item.name }}</span>
  20. <span class="iconfont icon-shanchu" @click="deleteProject(item)"></span>
  21. <span class="iconfont icon-bianji" @click="updateProject(item)"></span>
  22. </div>
  23. </el-card>
  24. </el-col>
  25. </el-row>
  26. </div>
  27. <!-- 新增项目 -->
  28. <add-project-dialog
  29. :addProjectVisible.sync="addProjectVisible"
  30. :dialogType="dialogType"
  31. :formData="form"
  32. ></add-project-dialog>
  33. </div>
  34. </template>
  35. <script lang="ts">
  36. import { Component, Vue } from "vue-property-decorator";
  37. import { UserModule } from "../../store/modules/user";
  38. import AddProjectDialog from "./components/AddProjectDialog/index.vue"; //新增项目弹窗
  39. @Component({
  40. name: "index",
  41. components: {
  42. AddProjectDialog
  43. }
  44. })
  45. export default class extends Vue {
  46. private keyWord = "";
  47. private projectList: any = [
  48. {
  49. id: "1",
  50. name: "龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达龙岗万达",
  51. url: "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
  52. },
  53. {
  54. id: "2",
  55. name: "龙岗万达",
  56. url: "",
  57. },
  58. {
  59. id: "3",
  60. name: "龙岗万达",
  61. url: "",
  62. },
  63. {
  64. id: "4",
  65. name: "龙岗万达",
  66. url: "",
  67. },
  68. {
  69. id: "5",
  70. name: "龙岗万达",
  71. url: "",
  72. },
  73. {
  74. id: "6",
  75. name: "龙岗万达",
  76. url: "https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg",
  77. },
  78. ];
  79. private addProjectVisible = false;
  80. private dialogType = "create";
  81. private form: any = {
  82. name: "",
  83. url: "",
  84. };
  85. get projectId() {
  86. return UserModule.projectId;
  87. }
  88. /**
  89. * 检索项目
  90. * @param 检索关键字
  91. */
  92. private ChangeKeyWord(keyWord: string) {
  93. console.log(keyWord);
  94. }
  95. /**
  96. * 添加项目
  97. */
  98. private addProject() {
  99. this.dialogType = "create";
  100. this.form = {
  101. name: "",
  102. url: "",
  103. }
  104. this.addProjectVisible = true;
  105. console.log("添加项目");
  106. }
  107. /**
  108. * 修改项目
  109. */
  110. private updateProject(item: any) {
  111. this.dialogType = "update";
  112. this.form = item;
  113. this.addProjectVisible = true;
  114. console.log("修改项目");
  115. }
  116. /**
  117. * 删除项目
  118. */
  119. private deleteProject(item: any) {
  120. console.log("删除项目", item.id);
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .project-box {
  126. height: 100%;
  127. padding: 0 16px;
  128. .saga-brand-group {
  129. height: calc(100% - 48px);
  130. overflow-y: auto;
  131. overflow-x: hidden;
  132. ::v-deep .el-col {
  133. margin-bottom: 16px;
  134. }
  135. .project-card {
  136. ::v-deep .image-slot {
  137. display: flex;
  138. width: 100%;
  139. height: 100%;
  140. background-color: #075fa9;
  141. }
  142. .project-name {
  143. display: inline-block;
  144. width: calc(100% - 50px);
  145. cursor: text;
  146. overflow: hidden;
  147. text-overflow: ellipsis;
  148. white-space: nowrap;
  149. }
  150. .icon-bianji {
  151. display: none;
  152. float: right;
  153. cursor: pointer;
  154. margin-right: 12px;
  155. }
  156. .icon-shanchu {
  157. display: none;
  158. float: right;
  159. cursor: pointer;
  160. }
  161. }
  162. .project-card:hover {
  163. .icon-bianji {
  164. display: block;
  165. }
  166. .icon-shanchu {
  167. display: block;
  168. }
  169. }
  170. .saga-brand-list {
  171. display: flex;
  172. flex-direction: row;
  173. flex-wrap: wrap;
  174. justify-content: space-between;
  175. .saga-brand-item {
  176. width: 380px;
  177. height: 247px;
  178. // margin-right: 17px;
  179. margin-bottom: 16px;
  180. cursor: pointer;
  181. box-sizing: border-box;
  182. background-color: #fff;
  183. border-radius: 4px;
  184. border: 1px solid #e4e5e7;
  185. transition: all 0.1s linear 0.01s;
  186. .saga-brand-name {
  187. display: inline-block;
  188. width: 133px;
  189. height: 100%;
  190. margin-right: 5px;
  191. font-size: 14px;
  192. line-height: 22px;
  193. .saga-brand-zhName {
  194. height: 44px;
  195. display: -webkit-box;
  196. -webkit-box-orient: vertical;
  197. -webkit-line-clamp: 2;
  198. overflow: hidden;
  199. }
  200. .saga-brand-enName {
  201. color: #8d9399;
  202. margin-top: 4px;
  203. height: 22px;
  204. overflow: hidden;
  205. white-space: nowrap;
  206. text-overflow: ellipsis;
  207. }
  208. }
  209. .saga-brand-logo {
  210. width: 52px;
  211. height: 52px;
  212. display: inline-block;
  213. vertical-align: top;
  214. ::v-deep .image-slot {
  215. font-size: 30px;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. width: 100%;
  220. height: 100%;
  221. background: #f5f7fa;
  222. color: #909399;
  223. }
  224. }
  225. }
  226. .pick {
  227. width: 380px;
  228. height: 1px;
  229. }
  230. .saga-brand-item.brand-new {
  231. border: 1px solid rgba(58, 141, 222, 0.6);
  232. }
  233. .saga-brand-item:hover {
  234. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  235. transform: translate(0, -5px);
  236. }
  237. .saga-brand-item:nth-child(4n) {
  238. margin-right: 0;
  239. }
  240. }
  241. }
  242. }
  243. ::v-deep .icon-wandajituan {
  244. font-size: 60px;
  245. margin: auto;
  246. color: #ffffff;
  247. }
  248. @media screen and (max-width: 1000px) {
  249. ::v-deep .icon-wandajituan {
  250. font-size: 30px;
  251. }
  252. }
  253. </style>