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.

Images.vue 39 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. <template>
  2. <div>
  3. <div class="header-wrapper">
  4. <div class="ui container">
  5. <el-row class="image_text">
  6. <h1>{{$i18n['cloudeBrainMirror']['cloud_brain_mirror']}}</h1>
  7. </el-row>
  8. </div>
  9. </div>
  10. <div class="ui container" id="header">
  11. <el-tabs v-model="activeName" @tab-click="handleClick">
  12. <el-tab-pane :label="$i18n['cloudeBrainMirror']['public_mirror']" name="first" v-loading="loadingPublic">
  13. <template v-if="tableDataPublic.length !== 0">
  14. <el-row style="align-items: center; display: flex">
  15. <el-col :span="12">
  16. <div>
  17. <el-checkbox v-model="checked">{{$i18n['cloudeBrainMirror']['platform_recommendations']}}</el-checkbox>
  18. </div>
  19. </el-col>
  20. <el-col :span="4"
  21. ><div style="visibility: hidden"></div></el-col
  22. >
  23. <el-col :span="8">
  24. <div>
  25. <el-input
  26. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  27. v-model="search"
  28. class="input-with-select"
  29. @keyup.enter.native="searchName()"
  30. >
  31. <el-button
  32. id="success"
  33. slot="append"
  34. icon="el-icon-search"
  35. @click="searchName()"
  36. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  37. >
  38. </el-input>
  39. </div>
  40. </el-col>
  41. </el-row>
  42. <el-row style="margin-top: 15px">
  43. <el-table
  44. :data="tableDataPublic"
  45. style="width: 100%"
  46. :header-cell-style="tableHeaderStyle"
  47. >
  48. <el-table-column
  49. :label="$i18n['cloudeBrainMirror']['mirror_tag']"
  50. min-width="19%"
  51. align="left"
  52. prop="tag"
  53. >
  54. <template slot-scope="scope">
  55. <div style="display: flex; align-items: center">
  56. <a class="text-over image_title" :title="scope.row.tag">{{
  57. scope.row.tag
  58. }}</a>
  59. <img
  60. v-if="scope.row.type == 5"
  61. src="/img/jian.svg"
  62. style="margin-left: 0.5rem"
  63. />
  64. </div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column
  68. :label="$i18n['cloudeBrainMirror']['mirror_description']"
  69. min-width="28%"
  70. align="left"
  71. prop="description"
  72. >
  73. <template slot-scope="scope">
  74. <div class="image_desc" :title="scope.row.description">
  75. {{ scope.row.description }}
  76. </div>
  77. <div v-if="!!scope.row.topics">
  78. <span
  79. v-for="(topic, index) in scope.row.topics"
  80. class="ui repo-topic label topic"
  81. style="cursor: default"
  82. >{{ topic }}</span
  83. >
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column
  88. prop="cloudbrainType"
  89. :label="$i18n['cloudeBrainMirror']['available_clusters']"
  90. min-width="10%"
  91. align="center"
  92. >
  93. <template slot-scope="scope">
  94. {{ scope.row.cloudbrainType | transformType }}
  95. </template>
  96. </el-table-column>
  97. <el-table-column
  98. prop="creator"
  99. :label="$i18n['cloudeBrainMirror']['creator']"
  100. min-width="8%"
  101. align="center"
  102. >
  103. <template slot-scope="scope">
  104. <a
  105. v-if="scope.row.userName || scope.row.relAvatarLink"
  106. :href="'/' + scope.row.userName"
  107. :title="scope.row.userName"
  108. >
  109. <img
  110. :src="scope.row.relAvatarLink"
  111. class="ui avatar image"
  112. />
  113. </a>
  114. <a v-else
  115. ><img
  116. class="ui avatar image"
  117. title="Ghost"
  118. src="/user/avatar/ghost/-1"
  119. /></a>
  120. </template>
  121. </el-table-column>
  122. <el-table-column
  123. prop="updatedUnix"
  124. :label="$i18n['cloudeBrainMirror']['creation_time']"
  125. align="center"
  126. min-width="14%"
  127. >
  128. <template slot-scope="scope">
  129. {{ scope.row.updatedUnix | transformTimestamp }}
  130. </template>
  131. </el-table-column>
  132. <el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
  133. <template slot-scope="scope">
  134. <div
  135. style="
  136. display: flex;
  137. justify-content: flex-end;
  138. align-items: center;
  139. "
  140. >
  141. <div
  142. style="
  143. display: flex;
  144. align-items: center;
  145. cursor: pointer;
  146. padding: 0 1rem;
  147. "
  148. @click="
  149. imageStar(
  150. scope.$index,
  151. scope.row.id,
  152. scope.row.isStar
  153. )
  154. "
  155. >
  156. <svg
  157. width="1.4em"
  158. height="1.4em"
  159. viewBox="0 0 32 32"
  160. class="heart-stroke"
  161. :class="{ stars_active: scope.row.isStar }"
  162. >
  163. <path
  164. d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"
  165. ></path>
  166. </svg>
  167. <span style="line-height: 2; margin-left: 0.3rem">{{
  168. scope.row.numStars
  169. }}</span>
  170. </div>
  171. <span
  172. style="padding: 0 1rem; color: #0366d6; cursor: pointer"
  173. @click="copyUrl(scope.row.place)"
  174. >{{$i18n['cloudeBrainMirror']['copy_address']}}</span
  175. >
  176. </div>
  177. </template>
  178. </el-table-column>
  179. </el-table>
  180. </el-row>
  181. <div
  182. class="ui container"
  183. style="margin-top: 50px; text-align: center"
  184. >
  185. <el-pagination
  186. background
  187. @size-change="handleSizeChangePublic"
  188. @current-change="handleCurrentChangePublic"
  189. :current-page="currentPagePublic"
  190. :page-size="pageSizePublic"
  191. :page-sizes="[5, 10, 15]"
  192. layout="total, sizes, prev, pager, next, jumper"
  193. :total="totalNumPublic"
  194. >
  195. </el-pagination>
  196. </div>
  197. </template>
  198. <template v-else>
  199. <el-row style="align-items: center; display: flex">
  200. <el-col :span="12">
  201. <div>
  202. <el-checkbox v-model="checked">{{$i18n['cloudeBrainMirror']['platform_recommendations']}}</el-checkbox>
  203. </div>
  204. </el-col>
  205. <el-col :span="4"
  206. ><div style="visibility: hidden"></div></el-col
  207. >
  208. <el-col :span="8">
  209. <div>
  210. <el-input
  211. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  212. v-model="search"
  213. class="input-with-select"
  214. @keyup.enter.native="searchName()"
  215. >
  216. <el-button
  217. id="success"
  218. slot="append"
  219. icon="el-icon-search"
  220. @click="searchName()"
  221. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  222. >
  223. </el-input>
  224. </div>
  225. </el-col>
  226. </el-row>
  227. <el-empty :image-size="200"></el-empty>
  228. </template>
  229. </el-tab-pane>
  230. <el-tab-pane :label="$i18n['cloudeBrainMirror']['my_mirror']" name="second" v-loading="loadingCustom">
  231. <template v-if="tableDataCustom.length !== 0">
  232. <el-row style="align-items: center; display: flex">
  233. <el-col :span="12">
  234. <div style="visibility: hidden">TODO</div>
  235. </el-col>
  236. <el-col :span="4"
  237. ><div style="visibility: hidden">TODO</div></el-col
  238. >
  239. <el-col :span="8">
  240. <div>
  241. <el-input
  242. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  243. v-model="search"
  244. class="input-with-select"
  245. @keyup.enter.native="searchName()"
  246. >
  247. <el-button
  248. id="success"
  249. slot="append"
  250. icon="el-icon-search"
  251. @click="searchName()"
  252. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  253. >
  254. </el-input>
  255. </div>
  256. </el-col>
  257. </el-row>
  258. <el-row style="margin-top: 15px">
  259. <el-table
  260. :data="tableDataCustom"
  261. style="width: 100%"
  262. :header-cell-style="tableHeaderStyle"
  263. >
  264. <el-table-column
  265. :label="$i18n['cloudeBrainMirror']['mirror_tag']"
  266. min-width="19%"
  267. align="left"
  268. prop="tag"
  269. >
  270. <template slot-scope="scope">
  271. <div style="display: flex; align-items: center">
  272. <a class="text-over image_title" :title="scope.row.tag">{{
  273. scope.row.tag
  274. }}</a
  275. >&nbsp;&nbsp;&nbsp;
  276. <i
  277. class="ri-lock-2-line"
  278. style="color: #fa8c16"
  279. v-if="scope.row.isPrivate"
  280. ></i>
  281. <img
  282. v-if="scope.row.type == 5"
  283. src="/img/jian.svg"
  284. style="margin-left: 0.5rem"
  285. />
  286. </div>
  287. </template>
  288. </el-table-column>
  289. <el-table-column
  290. :label="$i18n['cloudeBrainMirror']['mirror_description']"
  291. min-width="27%"
  292. align="left"
  293. prop="description"
  294. >
  295. <template slot-scope="scope">
  296. <div class="image_desc" :title="scope.row.description">
  297. {{ scope.row.description }}
  298. </div>
  299. <div v-if="!!scope.row.topics">
  300. <span
  301. v-for="(topic, index) in scope.row.topics"
  302. class="ui repo-topic label topic"
  303. style="cursor: default"
  304. >{{ topic }}</span
  305. >
  306. </div>
  307. </template>
  308. </el-table-column>
  309. <el-table-column
  310. prop="cloudbrainType"
  311. :label="$i18n['cloudeBrainMirror']['available_clusters']"
  312. min-width="9%"
  313. align="center"
  314. >
  315. <template slot-scope="scope">
  316. {{ scope.row.cloudbrainType | transformType }}
  317. </template>
  318. </el-table-column>
  319. <el-table-column
  320. prop="isPrivate"
  321. :label="$i18n['cloudeBrainMirror']['state']"
  322. min-width="10%"
  323. align="center"
  324. >
  325. <template slot-scope="scope">
  326. <div
  327. style="
  328. display: flex;
  329. align-items: center;
  330. justify-content: center;
  331. "
  332. >
  333. <span
  334. v-if="scope.row.isPrivate"
  335. style="color: rgb(250, 140, 22)"
  336. >{{$i18n['cloudeBrainMirror']['private']}}</span
  337. >
  338. <span v-else style="color: rgb(19, 194, 141)">{{$i18n['cloudeBrainMirror']['public']}}</span>
  339. <el-tooltip
  340. v-if="scope.row.status === 0"
  341. class="item"
  342. effect="dark"
  343. :content="$i18n['cloudeBrainMirror']['mirror_committed']"
  344. placement="top"
  345. >
  346. <i class="CREATING" style="margin-left: 0.3rem"></i>
  347. </el-tooltip>
  348. <el-tooltip
  349. v-if="scope.row.status === 2"
  350. class="item"
  351. effect="dark"
  352. :content="$i18n['cloudeBrainMirror']['check_exceeds_20g']"
  353. placement="top"
  354. >
  355. <i class="FAILED" style="margin-left: 0.3rem"></i>
  356. </el-tooltip>
  357. <el-tooltip
  358. v-if="scope.row.status === 1"
  359. class="item"
  360. effect="dark"
  361. :content="$i18n['cloudeBrainMirror']['mirror_submitted']"
  362. placement="top"
  363. >
  364. <i class="SUCCEEDED" style="margin-left: 0.3rem"></i>
  365. </el-tooltip>
  366. </div>
  367. </template>
  368. </el-table-column>
  369. <el-table-column
  370. prop="updatedUnix"
  371. :label="$i18n['cloudeBrainMirror']['creation_time']"
  372. align="center"
  373. min-width="14%"
  374. >
  375. <template slot-scope="scope">
  376. {{ scope.row.updatedUnix | transformTimestamp }}
  377. </template>
  378. </el-table-column>
  379. <el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
  380. <template slot-scope="scope">
  381. <div
  382. style="
  383. display: flex;
  384. justify-content: flex-end;
  385. align-items: center;
  386. "
  387. >
  388. <div
  389. style="
  390. display: flex;
  391. align-items: center;
  392. cursor: default;
  393. padding: 0 1rem;
  394. "
  395. >
  396. <svg
  397. width="1.4em"
  398. height="1.4em"
  399. viewBox="0 0 32 32"
  400. class="heart-stroke"
  401. >
  402. <path
  403. d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"
  404. ></path>
  405. </svg>
  406. <span style="line-height: 2; margin-left: 0.3rem">{{
  407. scope.row.numStars
  408. }}</span>
  409. </div>
  410. <span
  411. style="padding: 0 1rem; color: #0366d6; cursor: pointer"
  412. @click="copyUrl(scope.row.place)"
  413. >{{$i18n['cloudeBrainMirror']['copy_address']}}</span
  414. >
  415. <div style="padding-left: 1rem; cursor: pointer">
  416. <el-dropdown size="medium">
  417. <span class="el-dropdown-link">
  418. {{$i18n['cloudeBrainMirror']['more']}}<i
  419. class="el-icon-arrow-down el-icon--right"
  420. ></i>
  421. </span>
  422. <el-dropdown-menu slot="dropdown">
  423. <el-dropdown-item
  424. @click.native="eidtImage(scope.row.id)"
  425. >{{$i18n['cloudeBrainMirror']['edit']}}</el-dropdown-item
  426. >
  427. <el-dropdown-item
  428. style="color: red"
  429. @click.native="deleteImage(scope.row.id)"
  430. >{{$i18n['cloudeBrainMirror']['delete']}}</el-dropdown-item
  431. >
  432. </el-dropdown-menu>
  433. </el-dropdown>
  434. </div>
  435. </div>
  436. </template>
  437. </el-table-column>
  438. </el-table>
  439. </el-row>
  440. <div
  441. class="ui container"
  442. style="margin-top: 50px; text-align: center"
  443. >
  444. <el-pagination
  445. background
  446. @size-change="handleSizeChangeCustom"
  447. @current-change="handleCurrentChangeCustom"
  448. :current-page="currentPageCustom"
  449. :page-size="pageSizeCustom"
  450. :page-sizes="[5, 10, 15]"
  451. layout="total, sizes, prev, pager, next, jumper"
  452. :total="totalNumCustom"
  453. >
  454. </el-pagination>
  455. </div>
  456. </template>
  457. <template v-else>
  458. <el-row style="align-items: center; display: flex">
  459. <el-col :span="12">
  460. <div style="visibility: hidden"></div>
  461. </el-col>
  462. <el-col :span="4"
  463. ><div style="visibility: hidden"></div></el-col
  464. >
  465. <el-col :span="8">
  466. <div>
  467. <el-input
  468. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  469. v-model="search"
  470. class="input-with-select"
  471. @keyup.enter.native="searchName()"
  472. >
  473. <el-button
  474. id="success"
  475. slot="append"
  476. icon="el-icon-search"
  477. @click="searchName()"
  478. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  479. >
  480. </el-input>
  481. </div>
  482. </el-col>
  483. </el-row>
  484. <el-empty :image-size="200"></el-empty>
  485. </template>
  486. </el-tab-pane>
  487. <el-tab-pane :label="$i18n['cloudeBrainMirror']['my_favorite_mirror']" name="third">
  488. <template v-if="tableDataStar.length !== 0">
  489. <el-row style="align-items: center; display: flex">
  490. <el-col :span="12">
  491. <div style="visibility: hidden"></div>
  492. </el-col>
  493. <el-col :span="4"
  494. ><div style="visibility: hidden"></div></el-col
  495. >
  496. <el-col :span="8">
  497. <div>
  498. <el-input
  499. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  500. v-model="search"
  501. class="input-with-select"
  502. @keyup.enter.native="searchName()"
  503. >
  504. <el-button
  505. id="success"
  506. slot="append"
  507. icon="el-icon-search"
  508. @click="searchName()"
  509. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  510. >
  511. </el-input>
  512. </div>
  513. </el-col>
  514. </el-row>
  515. <el-row style="margin-top: 15px">
  516. <el-table
  517. :data="tableDataStar"
  518. style="width: 100%"
  519. :header-cell-style="tableHeaderStyle"
  520. >
  521. <el-table-column
  522. :label="$i18n['cloudeBrainMirror']['mirror_tag']"
  523. min-width="19%"
  524. align="left"
  525. prop="tag"
  526. >
  527. <template slot-scope="scope">
  528. <div style="display: flex; align-items: center">
  529. <a class="text-over image_title" :title="scope.row.tag">{{
  530. scope.row.tag
  531. }}</a>
  532. <img
  533. v-if="scope.row.type == 5"
  534. src="/img/jian.svg"
  535. style="margin-left: 0.5rem"
  536. />
  537. </div>
  538. </template>
  539. </el-table-column>
  540. <el-table-column
  541. :label="$i18n['cloudeBrainMirror']['mirror_description']"
  542. min-width="28%"
  543. align="left"
  544. prop="description"
  545. >
  546. <template slot-scope="scope">
  547. <div class="image_desc" :title="scope.row.description">
  548. {{ scope.row.description }}
  549. </div>
  550. <div v-if="!!scope.row.topics">
  551. <span
  552. v-for="(topic, index) in scope.row.topics"
  553. class="ui repo-topic label topic"
  554. style="cursor: default"
  555. >{{ topic }}</span
  556. >
  557. </div>
  558. </template>
  559. </el-table-column>
  560. <el-table-column
  561. prop="cloudbrainType"
  562. :label="$i18n['cloudeBrainMirror']['available_clusters']"
  563. min-width="10%"
  564. align="center"
  565. >
  566. <template slot-scope="scope">
  567. {{ scope.row.cloudbrainType | transformType }}
  568. </template>
  569. </el-table-column>
  570. <el-table-column
  571. prop="creator"
  572. :label="$i18n['cloudeBrainMirror']['creator']"
  573. min-width="8%"
  574. align="center"
  575. >
  576. <template slot-scope="scope">
  577. <a
  578. v-if="scope.row.userName || scope.row.relAvatarLink"
  579. :href="'/' + scope.row.userName"
  580. :title="scope.row.userName"
  581. >
  582. <img
  583. :src="scope.row.relAvatarLink"
  584. class="ui avatar image"
  585. />
  586. </a>
  587. <a v-else
  588. ><img
  589. class="ui avatar image"
  590. title="Ghost"
  591. src="/user/avatar/ghost/-1"
  592. /></a>
  593. </template>
  594. </el-table-column>
  595. <el-table-column
  596. prop="updatedUnix"
  597. :label="$i18n['cloudeBrainMirror']['creation_time']"
  598. align="center"
  599. min-width="14%"
  600. >
  601. <template slot-scope="scope">
  602. {{ scope.row.updatedUnix | transformTimestamp }}
  603. </template>
  604. </el-table-column>
  605. <el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
  606. <template slot-scope="scope">
  607. <div
  608. style="
  609. display: flex;
  610. justify-content: flex-end;
  611. align-items: center;
  612. "
  613. >
  614. <div
  615. style="
  616. display: flex;
  617. align-items: center;
  618. cursor: pointer;
  619. padding: 0 1rem;
  620. "
  621. @click="imageUnstar(scope.row.id)"
  622. >
  623. <svg
  624. width="1.4em"
  625. height="1.4em"
  626. viewBox="0 0 32 32"
  627. class="heart-stroke stars_active"
  628. >
  629. <path
  630. d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"
  631. ></path>
  632. </svg>
  633. <span style="line-height: 2; margin-left: 0.3rem">{{
  634. scope.row.numStars
  635. }}</span>
  636. </div>
  637. <span
  638. style="padding: 0 1rem; color: #0366d6; cursor: pointer"
  639. @click="copyUrl(scope.row.place)"
  640. >{{$i18n['cloudeBrainMirror']['copy_address']}}</span
  641. >
  642. </div>
  643. </template>
  644. </el-table-column>
  645. </el-table>
  646. </el-row>
  647. <div
  648. class="ui container"
  649. style="margin-top: 50px; text-align: center"
  650. >
  651. <el-pagination
  652. background
  653. @size-change="handleSizeChangeStar"
  654. @current-change="handleCurrentChangeStar"
  655. :current-page="currentPageStar"
  656. :page-size="pageSizeStar"
  657. :page-sizes="[5, 10, 15]"
  658. layout="total, sizes, prev, pager, next, jumper"
  659. :total="totalNumStar"
  660. >
  661. </el-pagination>
  662. </div>
  663. </template>
  664. <template v-else>
  665. <el-row style="align-items: center; display: flex">
  666. <el-col :span="12">
  667. <div style="visibility: hidden"></div>
  668. </el-col>
  669. <el-col :span="4"
  670. ><div style="visibility: hidden"></div></el-col
  671. >
  672. <el-col :span="8">
  673. <div>
  674. <el-input
  675. :placeholder="$i18n['cloudeBrainMirror']['placeholder']"
  676. v-model="search"
  677. class="input-with-select"
  678. @keyup.enter.native="searchName()"
  679. >
  680. <el-button
  681. id="success"
  682. slot="append"
  683. icon="el-icon-search"
  684. @click="searchName()"
  685. >{{$i18n['cloudeBrainMirror']['search']}}</el-button
  686. >
  687. </el-input>
  688. </div>
  689. </el-col>
  690. </el-row>
  691. <el-empty :image-size="200"></el-empty>
  692. </template>
  693. </el-tab-pane>
  694. </el-tabs>
  695. </div>
  696. </div>
  697. </template>
  698. <script>
  699. const { _AppSubUrl, _StaticUrlPrefix, csrf } = window.config;
  700. export default {
  701. components: {},
  702. data() {
  703. return {
  704. activeName: "first",
  705. search: "",
  706. checked: false,
  707. currentPagePublic: 1,
  708. pageSizePublic: 10,
  709. totalNumPublic: 0,
  710. paramsPublic: { page: 1, pageSize: 10, q: "", recommend: false },
  711. tableDataPublic: [],
  712. loadingPublic: false,
  713. currentPageCustom: 1,
  714. pageSizeCustom: 10,
  715. totalNumCustom: 0,
  716. paramsCustom: { page: 1, pageSize: 10, q: "" },
  717. tableDataCustom: [],
  718. starCustom: [],
  719. loadingCustom: false,
  720. refreshCustomTimer: null,
  721. currentPageStar: 1,
  722. pageSizeStar: 10,
  723. totalNumStar: 0,
  724. paramsStar: { page: 1, pageSize: 10, q: "" },
  725. tableDataStar: [],
  726. loadingStar: false,
  727. };
  728. },
  729. methods: {
  730. handleClick(tab, event) {
  731. this.search = "";
  732. this.stopImageListCustomRefresh();
  733. if (tab.name == "first") {
  734. this.paramsPublic.q = "";
  735. this.getImageListPublic();
  736. }
  737. if (tab.name == "second") {
  738. this.getImageListCustom();
  739. }
  740. if (tab.name == "third") {
  741. this.getImageListStar();
  742. }
  743. },
  744. tableHeaderStyle({ row, column, rowIndex, columnIndex }) {
  745. if (rowIndex === 0) {
  746. return "background:#f5f5f6;color:#606266";
  747. }
  748. },
  749. handleSizeChangePublic(val) {
  750. this.paramsPublic.pageSize = val;
  751. this.getImageListPublic();
  752. },
  753. handleCurrentChangePublic(val) {
  754. this.currentPagePublic = val;
  755. this.paramsPublic.page = val;
  756. this.getImageListPublic();
  757. },
  758. handleSizeChangeCustom(val) {
  759. this.paramsCustom.pageSize = val;
  760. this.getImageListCustom();
  761. },
  762. handleCurrentChangeCustom(val) {
  763. this.paramsCustom.page = val;
  764. this.getImageListCustom();
  765. },
  766. handleSizeChangeStar(val) {
  767. this.paramsStar.pageSize = val;
  768. this.getImageListStar();
  769. },
  770. handleCurrentChangeStar(val) {
  771. this.paramsStar.page = val;
  772. this.getImageListStar();
  773. },
  774. getImageListPublic() {
  775. this.loadingPublic = true;
  776. this.$axios
  777. .get("/explore/images/public", {
  778. params: this.paramsPublic,
  779. })
  780. .then((res) => {
  781. this.totalNumPublic = res.data.count;
  782. this.tableDataPublic = res.data.images;
  783. this.loadingPublic = false;
  784. });
  785. },
  786. getImageListCustom() {
  787. this.loadingCustom = true;
  788. this.$axios
  789. .get("/explore/images/custom", {
  790. params: this.paramsCustom,
  791. })
  792. .then((res) => {
  793. this.totalNumCustom = res.data.count;
  794. this.tableDataCustom = res.data.images;
  795. this.tableDataCustom.forEach((element) => {
  796. this.starCustom.push({ id: element.id });
  797. });
  798. this.loadingCustom = false;
  799. this.getImageListCustomRefresh();
  800. });
  801. },
  802. getImageListCustomRefresh() {
  803. this.stopImageListCustomRefresh();
  804. this.refreshCustomTimer = setInterval(() => {
  805. this.tableDataCustom.forEach((item) => {
  806. if (item.status === 0) {
  807. this.$axios.get(`/image/${item.id}`, {}).then((res) => {
  808. const newData = res.data;
  809. this.tableDataCustom.forEach((it) => {
  810. if (it.id === newData.id) {
  811. it.status = newData.status;
  812. }
  813. });
  814. });
  815. }
  816. });
  817. }, 5000);
  818. },
  819. stopImageListCustomRefresh() {
  820. this.refreshCustomTimer && clearInterval(this.refreshCustomTimer);
  821. },
  822. getImageListStar() {
  823. this.loadingStar = true;
  824. this.$axios
  825. .get("/explore/images/star", {
  826. params: this.paramsStar,
  827. })
  828. .then((res) => {
  829. this.totalNumStar = res.data.count;
  830. this.tableDataStar = res.data.images;
  831. this.loadingStar = false;
  832. });
  833. },
  834. deleteImage(id) {
  835. let flag = 1;
  836. let _this = this;
  837. $(".ui.basic.modal.images")
  838. .modal({
  839. onDeny: function () {
  840. flag = false;
  841. },
  842. onApprove: function () {
  843. _this.$axios.delete("/image/" + id).then((res) => {
  844. _this.getImageListCustom();
  845. });
  846. flag = true;
  847. },
  848. onHidden: function () {
  849. if (flag == false) {
  850. $(".alert")
  851. .html(_this.$i18n['canceled_operation'])
  852. .removeClass("alert-success")
  853. .addClass("alert-danger")
  854. .show()
  855. .delay(1500)
  856. .fadeOut();
  857. } else {
  858. $(".alert")
  859. .html(_this.$i18n['successfully_deleted'])
  860. .removeClass("alert-danger")
  861. .addClass("alert-success")
  862. .show()
  863. .delay(1500)
  864. .fadeOut();
  865. }
  866. },
  867. })
  868. .modal("show");
  869. },
  870. eidtImage(id) {
  871. location.href = `/image/${id}/imageSquare`;
  872. },
  873. imageStar(index, id, isStar) {
  874. if (isStar) {
  875. this.$axios.put(`/image/${id}/action/unstar`).then((res) => {
  876. if (res.data.Code == 0) {
  877. this.tableDataPublic[index].numStars =
  878. this.tableDataPublic[index].numStars - 1;
  879. this.tableDataPublic[index].isStar = false;
  880. } else {
  881. console.log(res.data.Message);
  882. }
  883. });
  884. } else {
  885. this.$axios.put(`/image/${id}/action/star`).then((res) => {
  886. if (res.data.Code == 0) {
  887. this.tableDataPublic[index].numStars =
  888. this.tableDataPublic[index].numStars + 1;
  889. this.tableDataPublic[index].isStar = true;
  890. } else {
  891. console.log(res.data.Message);
  892. }
  893. });
  894. }
  895. },
  896. imageUnstar(id) {
  897. this.$axios.put(`/image/${id}/action/unstar`).then((res) => {
  898. if (res.data.Code == 0) {
  899. this.getImageListStar();
  900. } else {
  901. console.log(res.data.Message);
  902. }
  903. });
  904. },
  905. copyUrl(url) {
  906. const cInput = document.createElement("input");
  907. cInput.value = url;
  908. document.body.appendChild(cInput);
  909. cInput.select();
  910. document.execCommand("Copy");
  911. cInput.remove();
  912. $("body").toast({
  913. message: this.$i18n['cloudeBrainMirror']['copy_succeeded'],
  914. showProgress: "bottom",
  915. showIcon: "check circle",
  916. class: "info",
  917. position: "top right",
  918. });
  919. },
  920. searchName() {
  921. if (this.activeName == "first") {
  922. this.paramsPublic.q = this.search;
  923. this.paramsPublic.page = 1;
  924. this.getImageListPublic();
  925. }
  926. if (this.activeName == "second") {
  927. this.paramsCustom.q = this.search;
  928. this.paramsCustom.page = 1;
  929. this.getImageListCustom();
  930. }
  931. if (this.activeName == "third") {
  932. this.paramsStar.q = this.search;
  933. this.paramsStar.page = 1;
  934. this.getImageListStar();
  935. }
  936. },
  937. },
  938. filters: {
  939. transformType(val) {
  940. if (val == 0 || val == 2) {
  941. return "GPU";
  942. }
  943. },
  944. transformPravite(val) {
  945. if (val) {
  946. return this.$i18n['cloudeBrainMirror']['private'];
  947. } else {
  948. return this.$i18n['cloudeBrainMirror']['public'];
  949. }
  950. },
  951. transformTimestamp(timestamp) {
  952. const date = new Date(parseInt(timestamp) * 1000);
  953. const Y = date.getFullYear() + "-";
  954. const M =
  955. (date.getMonth() + 1 < 10
  956. ? "0" + (date.getMonth() + 1)
  957. : date.getMonth() + 1) + "-";
  958. const D =
  959. (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
  960. const h =
  961. (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
  962. const m =
  963. (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
  964. ":";
  965. const s =
  966. date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); // 秒
  967. const dateString = Y + M + D + h + m + s;
  968. return dateString;
  969. },
  970. },
  971. watch: {
  972. checked(val) {
  973. this.paramsPublic.page = 1;
  974. this.paramsPublic.recommend = val;
  975. this.currentPagePublic = 1;
  976. this.getImageListPublic();
  977. },
  978. },
  979. mounted() {},
  980. created() {
  981. this.$i18n = window.i18n;
  982. const params = new URLSearchParams(location.search);
  983. if (params.has("type") && params.get("type") == "myimage") {
  984. this.activeName = "second";
  985. this.getImageListCustom();
  986. } else {
  987. this.getImageListPublic();
  988. }
  989. },
  990. beforeDestroy() {
  991. this.stopImageListCustomRefresh();
  992. },
  993. };
  994. </script>
  995. <style scoped>
  996. .header-wrapper {
  997. background-color: #f5f5f6;
  998. padding-top: 15px;
  999. }
  1000. .image_text {
  1001. padding: 25px 0 55px 0;
  1002. }
  1003. #header {
  1004. position: relative;
  1005. top: -40px;
  1006. }
  1007. .el-dropdown-menu__item--divided {
  1008. border-top: 1px solid blue;
  1009. }
  1010. .el-table thead {
  1011. background-color: #f5f5f6;
  1012. }
  1013. /deep/ .el-tabs__item:hover {
  1014. color: #000;
  1015. font-weight: 500;
  1016. }
  1017. /deep/ .el-tabs__item.is-active {
  1018. color: #000;
  1019. font-weight: 500;
  1020. }
  1021. /deep/ .el-tabs__active-bar {
  1022. background-color: #000;
  1023. }
  1024. #success {
  1025. background-color: #5bb973;
  1026. color: white;
  1027. }
  1028. .text-over {
  1029. overflow: hidden;
  1030. text-overflow: ellipsis;
  1031. vertical-align: middle;
  1032. white-space: nowrap;
  1033. }
  1034. .image_title {
  1035. display: inline-block;
  1036. cursor: default;
  1037. color: rgb(66, 98, 144);
  1038. }
  1039. .image_desc {
  1040. -webkit-line-clamp: 2;
  1041. -webkit-box-orient: vertical;
  1042. display: -webkit-box;
  1043. text-overflow: ellipsis;
  1044. overflow: hidden;
  1045. }
  1046. .heart-stroke {
  1047. stroke: #fa8c16;
  1048. stroke-width: 2;
  1049. fill: #fff;
  1050. }
  1051. .stars_active {
  1052. fill: #fa8c16 !important;
  1053. stroke: #fa8c16 !important;
  1054. }
  1055. </style>