market.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <style>
  2. .list-title {
  3. font-weight: 400;
  4. font-size: 18px;
  5. }
  6. .plugin-list {
  7. margin: 0 0 0 -20px;
  8. }
  9. .plugin-item {
  10. border: 1px solid #ebebeb;
  11. background: #fff;
  12. padding: 20px;
  13. margin: 0 0 20px 20px;
  14. transition: 250ms;
  15. position: relative;
  16. height: 97px;
  17. }
  18. .plugin-item .display-name {
  19. margin-bottom: 10px;
  20. transition: 250ms;
  21. font-weight: bold;
  22. }
  23. .plugin-item .el-tooltip {
  24. color: #909399;
  25. }
  26. .plugin-item:hover {
  27. cursor: pointer;
  28. border-color: #bfddff;
  29. }
  30. .plugin-item:hover .display-name {
  31. color: #409EFF;
  32. }
  33. .plugin-item .plugin-option-btn {
  34. height: 25px;
  35. width: 25px;
  36. font-size: 12px;
  37. padding: 0;
  38. }
  39. .plugin-item .detail-option.detail-option {
  40. color: #909399;
  41. background: #F2F6FC;
  42. }
  43. .plugin-item .detail-option:hover {
  44. color: #fff;
  45. background: #909399;
  46. }
  47. .plugin-item .name{
  48. white-space:nowrap;
  49. overflow:hidden;
  50. text-overflow:ellipsis;
  51. font-size: 12px;
  52. }
  53. .display-name{
  54. display: flex;
  55. justify-content: space-between;
  56. }
  57. .display-border{
  58. min-width: 120px;
  59. }
  60. .install_img{
  61. position: absolute;
  62. right: 0px;
  63. top: 0px;
  64. }
  65. </style>
  66. <div id="app" v-cloak>
  67. <template>
  68. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  69. <div slot="header">
  70. <div class="input-item" style="width: 300px;">
  71. <el-input @keyup.enter.native="getList" size="small" placeholder="请输入搜索应用名称" v-model="search.keyword"
  72. clearable @clear="toSearch">
  73. <el-button slot="append" icon="el-icon-search" @click="toSearch"></el-button>
  74. </el-input>
  75. </div>
  76. </div>
  77. </el-card>
  78. <div v-for="(item,its) in addons" :key="its">
  79. <h3 class="list-title">
  80. {{item.title}}
  81. </h3>
  82. <el-row class="plugin-list">
  83. <template v-if="item.list || item.list.length > 0">
  84. <template v-for="plugin in item.list">
  85. <el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4">
  86. <div flex="dir:left" class="plugin-item" @click="entryDetail(plugin.name)">
  87. <img v-if="plugin.is_install" class="install_img" src="resources/img/install_use.png" alt="">
  88. <img v-else class="install_img" src="resources/img/install_buy.png" alt="">
  89. <div style="padding-right: 12px;">
  90. <!--<img style="width: 50px;height: 50px;display: block;" :src="plugin.cover">-->
  91. <el-image style="width: 50px;height: 50px;border-radius: 5px;" :src="plugin.cover">
  92. <div slot="error" class="image-slot">
  93. <com-image :src="plugin.default_cover"></com-image>
  94. </div>
  95. </el-image>
  96. </div>
  97. <div class="display-border">
  98. <div class="display-name">{{plugin.title}}</div>
  99. <com-ellipsis :line="1" :text="plugin.brief_introduction"></com-ellipsis>
  100. </div>
  101. </div>
  102. </el-col>
  103. </template>
  104. </template>
  105. </el-row>
  106. </div>
  107. </template>
  108. </div>
  109. <script>
  110. new Vue({
  111. el: '#app',
  112. data() {
  113. return {
  114. loading: false,
  115. list: [],
  116. addons: [],
  117. search: {
  118. keyword: ''
  119. }
  120. };
  121. },
  122. created() {
  123. this.loadData();
  124. },
  125. methods: {
  126. toSearch() {
  127. this.loadData();
  128. },
  129. loadData() {
  130. this.loading = true;
  131. request({
  132. params: {
  133. r: 'mall/addons/market',
  134. },
  135. data: this.search,
  136. method:'post'
  137. }).then(e => {
  138. this.loading = false;
  139. if (e.data.code === 0) {
  140. this.handleData(e.data.data)
  141. this.addons = e.data.data;
  142. } else {
  143. this.$message.error(e.data.msg);
  144. }
  145. }).catch(e => {
  146. });
  147. },
  148. handleData(data){
  149. if(data){
  150. for(let cate in data){
  151. if(data[cate].list){
  152. for(let item in data[cate].list){
  153. data[cate].list[item].default_cover = _diy_img_prefix+'/static/addons/icon/'+data[cate].list[item].name+'.png'
  154. }
  155. }
  156. }
  157. }
  158. },
  159. entryDetail(addonsName) {
  160. navigateTo({r: 'mall/addons/detail', name: addonsName});
  161. },
  162. }
  163. });
  164. </script>