You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

selectImages.vue 14 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <div class="inline required field" :class="{ 'unite': benchmarkNew, 'min_title': benchmarkNew}">
  3. <label v-if="benchmarkNew" style="font-weight: normal;">镜像</label>
  4. <label v-else>镜像</label>
  5. <span v-if="benchmarkNew">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  6. <input type="text" name="image" :value="imageAddress" placeholder="选择镜像或输入镜像地址">
  7. <el-button type="text" @click="dialogVisible = true" icon="el-icon-plus">选择镜像</el-button>
  8. <el-dialog
  9. title="选择镜像"
  10. :visible.sync="dialogVisible"
  11. width="50%"
  12. >
  13. <div class="ui icon input" style="z-index: 9999;position: absolute;right: 50px;height:30px;">
  14. <i class="search icon" style="cursor: pointer;pointer-events:auto" @click="searchName()"></i>
  15. <input type="text" placeholder="" v-model="search" @keyup.enter="searchName()">
  16. </div>
  17. <el-tabs v-model="activeName" @tab-click="handleClick">
  18. <el-tab-pane label="公开镜像" name="first" v-loading="loadingPublic">
  19. <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(publicData,index) in tableDataPublic" :key="index">
  20. <div style="width: 90%;">
  21. <div style="display: flex;align-items: center;justify-content: space-between;">
  22. <span class="panel_dataset_name text-over" style="margin-left: 0;">{{publicData.tag}} </span>
  23. <div v-if="!!publicData.topics" class="text-over">
  24. <span v-for="(topic,index) in publicData.topics" class="ui repo-topic label topic">{{topic}}</span>
  25. </div>
  26. </div>
  27. <div style="margin-top: 8px;display: flex;">
  28. <a :title="publicData.userName" style="cursor: default;">
  29. <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="publicData.relAvatarLink">
  30. </a>
  31. <span class="panel_datset_desc">{{publicData.description}}</span>
  32. </div>
  33. </div>
  34. <div>
  35. <button class="ui primary basic button mini" @click.stop.prevent="selectImages(publicData.place,publicData.tag)">使用</button>
  36. </div>
  37. </div>
  38. <div class="ui container" style="margin-top:50px;text-align:center">
  39. <el-pagination
  40. background
  41. @current-change="handleCurrentChangePublic"
  42. :current-page="currentPagePublic"
  43. :page-size="pageSizePublic"
  44. layout="total, prev, pager, next"
  45. :total="totalNumPublic">
  46. </el-pagination>
  47. </div>
  48. </el-tab-pane>
  49. <el-tab-pane label="我的镜像" name="second" v-loading="loadingCustom">
  50. <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(customData,index) in tableDataCustom" :key="index">
  51. <div style="width: 90%;">
  52. <div style="display: flex;align-items: center;justify-content: space-between;">
  53. <span class="panel_dataset_name text-over" style="margin-left: 0;">{{customData.tag}} </span>
  54. <div v-if="!!customData.topics" class="text-over">
  55. <span v-for="(topic,index) in customData.topics" class="ui repo-topic label topic">{{topic}}</span>
  56. </div>
  57. </div>
  58. <div style="margin-top: 8px;display: flex;">
  59. <a :title="customData.userName" style="cursor: default;">
  60. <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="customData.relAvatarLink">
  61. </a>
  62. <span class="panel_datset_desc">{{customData.description}}</span>
  63. </div>
  64. </div>
  65. <div>
  66. <button class="ui primary basic button mini" @click.stop.prevent="selectImages(customData.place,customData.tag)">使用</button>
  67. </div>
  68. </div>
  69. <div class="ui container" style="margin-top:50px;text-align:center">
  70. <el-pagination
  71. background
  72. @current-change="handleCurrentChangeCustom"
  73. :current-page="currentPageCustom"
  74. :page-size="pageSizeCustom"
  75. layout="total, prev, pager, next"
  76. :total="totalNumCustom">
  77. </el-pagination>
  78. </div>
  79. </el-tab-pane>
  80. <el-tab-pane label="我收藏的镜像" name="third">
  81. <div style="display: flex;align-items: center;justify-content: space-between;padding: 1rem 0;border-bottom:1px solid #F5F5F5" v-for="(starData,index) in tableDataStar" :key="index">
  82. <div style="width: 90%;">
  83. <div style="display: flex;align-items: center;justify-content: space-between;">
  84. <span class="panel_dataset_name text-over" style="margin-left: 0;">{{starData.tag}} </span>
  85. <div v-if="!!starData.topics" class="text-over">
  86. <span v-for="(topic,index) in starData.topics" class="ui repo-topic label topic">{{topic}}</span>
  87. </div>
  88. </div>
  89. <div style="margin-top: 8px;display: flex;">
  90. <a :title="starData.userName" style="cursor: default;">
  91. <img class="ui avatar mini image" style="width: 20px;height: 20px;" :src="starData.relAvatarLink">
  92. </a>
  93. <span class="panel_datset_desc">{{starData.description}}</span>
  94. </div>
  95. </div>
  96. <div>
  97. <button class="ui primary basic button mini" @click.stop.prevent="selectImages(starData.place,starData.tag)">使用</button>
  98. </div>
  99. </div>
  100. <div class="ui container" style="margin-top:50px;text-align:center">
  101. <el-pagination
  102. background
  103. @current-change="handleCurrentChangeStar"
  104. :current-page="currentPageStar"
  105. :page-size="pageSizeStar"
  106. layout="total, prev, pager, next"
  107. :total="totalNumStar">
  108. </el-pagination>
  109. </div>
  110. </el-tab-pane>
  111. </el-tabs>
  112. </el-dialog>
  113. </div>
  114. </template>
  115. <script>
  116. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  117. export default {
  118. components: {
  119. },
  120. data() {
  121. return {
  122. dialogVisible:false,
  123. benchmarkNew:false,
  124. imageAddress:'',
  125. activeName: 'first',
  126. search:'',
  127. checked:false,
  128. currentPagePublic:1,
  129. pageSizePublic:5,
  130. totalNumPublic:0,
  131. paramsPublic:{page:1,pageSize:5,q:'',recommend:false},
  132. tableDataPublic: [],
  133. loadingPublic:false,
  134. currentPageCustom:1,
  135. pageSizeCustom:5,
  136. totalNumCustom:0,
  137. paramsCustom:{page:1,pageSize:5,q:''},
  138. tableDataCustom: [],
  139. starCustom:[],
  140. loadingCustom:false,
  141. currentPageStar:1,
  142. pageSizeStar:5,
  143. totalNumStar:0,
  144. paramsStar:{page:1,pageSize:5,q:''},
  145. tableDataStar: [],
  146. loadingStar:false
  147. };
  148. },
  149. methods: {
  150. handleClick(tab, event) {
  151. this.search = ''
  152. if(tab.name=="first"){
  153. this.paramsPublic.q = ''
  154. this.getImageListPublic()
  155. }
  156. if(tab.name=="second"){
  157. this.getImageListCustom()
  158. }
  159. if(tab.name=="third"){
  160. this.getImageListStar()
  161. }
  162. },
  163. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  164. if(rowIndex===0){
  165. return 'background:#f5f5f6;color:#606266'
  166. }
  167. },
  168. handleCurrentChangePublic(val){
  169. this.paramsPublic.page = val
  170. this.getImageListPublic()
  171. },
  172. handleCurrentChangeCustom(val){
  173. this.paramsCustom.page = val
  174. this.getImageListCustom()
  175. },
  176. handleCurrentChangeStar(val){
  177. this.paramsStar.page = val
  178. this.getImageListStar()
  179. },
  180. getImageListPublic(){
  181. this.loadingPublic = true
  182. this.$axios.get('/explore/images/public',{
  183. params:this.paramsPublic
  184. }).then((res)=>{
  185. console.log("res",res.data)
  186. this.totalNumPublic = res.data.count
  187. this.tableDataPublic = res.data.images
  188. this.loadingPublic = false
  189. })
  190. },
  191. getImageListCustom(){
  192. this.loadingCustom = true
  193. this.$axios.get('/explore/images/custom',{
  194. params:this.paramsCustom
  195. }).then((res)=>{
  196. console.log("res",res)
  197. this.totalNumCustom = res.data.count
  198. this.tableDataCustom = res.data.images
  199. this.tableDataCustom.forEach(element => {
  200. this.starCustom.push({id:element.id,})
  201. });
  202. this.loadingCustom = false
  203. })
  204. },
  205. getImageListStar(){
  206. this.loadingStar = true
  207. this.$axios.get('/explore/images/star',{
  208. params:this.paramsStar
  209. }).then((res)=>{
  210. console.log("res",res)
  211. this.totalNumStar = res.data.count
  212. this.tableDataStar = res.data.images
  213. this.loadingStar = false
  214. })
  215. },
  216. searchName(){
  217. if(this.activeName=='first'){
  218. this.paramsPublic.q = this.search
  219. this.paramsPublic.page = 1
  220. this.getImageListPublic()
  221. }
  222. if(this.activeName=='second'){
  223. this.paramsCustom.q = this.search
  224. this.paramsCustom.page = 1
  225. this.getImageListCustom()
  226. }
  227. if(this.activeName=='third'){
  228. this.paramsStar.q = this.search
  229. this.paramsStar.page = 1
  230. this.getImageListStar()
  231. }
  232. },
  233. selectImages(place){
  234. this.imageAddress = place
  235. this.dialogVisible = false
  236. },
  237. },
  238. watch:{
  239. search(val){
  240. if(this.activeName=='first'){
  241. this.paramsPublic.q = val
  242. this.getImageListPublic()
  243. }
  244. if(this.activeName=='second'){
  245. this.paramsCustom.q = val
  246. this.getImageListCustom()
  247. }
  248. if(this.activeName=='third'){
  249. this.paramsStar.q = val
  250. this.getImageListStar()
  251. }
  252. }
  253. },
  254. mounted() {
  255. this.getImageListPublic()
  256. if(location.href.indexOf('benchmark')!==-1){
  257. this.benchmarkNew = true
  258. }
  259. },
  260. created() {
  261. }
  262. };
  263. </script>
  264. <style scoped>
  265. .header-wrapper {
  266. background-color: #f5f5f6;
  267. padding-top: 15px;
  268. }
  269. .image_text{
  270. padding:25px 0 55px 0 ;
  271. }
  272. #header{
  273. position: relative;
  274. top:-40px;
  275. }
  276. .el-dropdown-menu__item--divided{
  277. border-top: 1px solid blue;
  278. }
  279. .el-table thead{
  280. background-color: #f5f5f6;
  281. }
  282. /deep/ .el-tabs__item:hover{
  283. color: #000;
  284. font-weight: 500;
  285. }
  286. /deep/ .el-tabs__item.is-active {
  287. color: #000;
  288. font-weight: 500;
  289. }
  290. /deep/ .el-tabs__active-bar{
  291. background-color:#000
  292. }
  293. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  294. background-color: #5bb973;
  295. color: #FFF;
  296. }
  297. /deep/ .el-pagination.is-background .el-pager li.active {
  298. color: #fff;
  299. cursor: default;
  300. }
  301. /deep/ .el-pagination.is-background .el-pager li:hover {
  302. color: #5bb973;
  303. }
  304. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  305. color: #5bb973;
  306. }
  307. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  308. background-color: #5bb973;
  309. color: #FFF;
  310. }
  311. /deep/ .el-pager li.active {
  312. color: #08C0B9;
  313. cursor: default;
  314. }
  315. /deep/ .el-pagination .el-pager li:hover {
  316. color: #08C0B9;
  317. }
  318. /deep/ .el-pagination .el-pager li:not(.disabled):hover {
  319. color: #08C0B9;
  320. }
  321. #success{
  322. background-color: #5bb973;
  323. color: white;
  324. }
  325. .text-over{
  326. overflow: hidden;
  327. text-overflow: ellipsis;
  328. vertical-align: middle;
  329. white-space: nowrap;
  330. }
  331. .image_title{
  332. display: inline-block;
  333. width: 80%;
  334. cursor: default;
  335. color: rgb(66, 98, 144);
  336. }
  337. .image_desc{
  338. -webkit-line-clamp: 2;
  339. -webkit-box-orient: vertical;
  340. display: -webkit-box;
  341. text-overflow: ellipsis;
  342. overflow: hidden;
  343. }
  344. .heart-stroke{
  345. stroke: #666;
  346. stroke-width: 2;
  347. fill: #fff
  348. }
  349. .stars_active{
  350. fill: #FA8C16 !important;
  351. stroke:#FA8C16 !important
  352. }
  353. </style>