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 34 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
4 years ago
3 years ago
3 years ago
3 years ago
4 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
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 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
4 years ago
3 years ago
3 years ago
3 years ago
4 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
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 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
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
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
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
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <template>
  2. <div>
  3. <div class="header-wrapper">
  4. <div class="ui container">
  5. <el-row class="image_text">
  6. <h1>云脑镜像</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="公开镜像" name="first" v-loading="loadingPublic">
  13. <template v-if="tableDataPublic.length!==0">
  14. <!-- <div class="ui two column stackable grid">
  15. <div class="column">
  16. </div>
  17. <div class="column">
  18. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  19. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  20. </el-input>
  21. </div>
  22. </div> -->
  23. <el-row style="align-items: center;display: flex;">
  24. <el-col :span="12">
  25. <div>
  26. <el-checkbox v-model="checked">仅显示平台推荐</el-checkbox>
  27. </div>
  28. </el-col>
  29. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  30. <el-col :span="8">
  31. <div>
  32. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  33. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  34. </el-input>
  35. </div>
  36. </el-col>
  37. </el-row>
  38. <el-row style="margin-top:15px;">
  39. <el-table
  40. :data="tableDataPublic"
  41. style="width: 100%"
  42. :header-cell-style="tableHeaderStyle"
  43. >
  44. <el-table-column
  45. label="镜像名称"
  46. min-width="19%"
  47. align="left"
  48. prop="tag"
  49. >
  50. <template slot-scope="scope">
  51. <div style="display: flex;align-items: center;">
  52. <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
  53. <i class="ri-lock-2-line" style="color: #fa8c16;" v-if="scope.row.isPrivate"></i>
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. label="镜像描述"
  59. min-width="28%"
  60. align="left"
  61. prop="description"
  62. >
  63. <template slot-scope="scope">
  64. <div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
  65. <div v-if="!!scope.row.topics">
  66. <span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. prop="cloudbrainType"
  72. label="可用集群"
  73. min-width="10%"
  74. align="center"
  75. >
  76. <template slot-scope="scope">
  77. {{scope.row.cloudbrainType | transformType}}
  78. </template>
  79. </el-table-column>
  80. <el-table-column
  81. prop="creator"
  82. label="创建者"
  83. min-width="8%"
  84. align="center"
  85. >
  86. <template slot-scope="scope">
  87. <a :href="'/' + scope.row.userName" :title="scope.row.userName">
  88. <img :src="scope.row.relAvatarLink" class="ui avatar image">
  89. </a>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. prop="createdUnix"
  94. label="创建时间"
  95. align="center"
  96. min-width="14%"
  97. >
  98. <template slot-scope="scope">
  99. {{scope.row.createdUnix | transformTimestamp}}
  100. </template>
  101. </el-table-column>
  102. <el-table-column
  103. align="center"
  104. min-width="21%"
  105. label="操作"
  106. >
  107. <template slot-scope="scope">
  108. <div style="display: flex;justify-content: flex-end;align-items: center;">
  109. <div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageStar(scope.$index,scope.row.id,scope.row.isStar)">
  110. <svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:scope.row.isStar}'><path 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"></path></svg>
  111. <span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
  112. </div>
  113. <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
  114. </div>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. </el-row>
  119. <div class="ui container" style="margin-top:50px;text-align:center">
  120. <el-pagination
  121. background
  122. @size-change="handleSizeChangePublic"
  123. @current-change="handleCurrentChangePublic"
  124. :current-page="currentPagePublic"
  125. :page-size="pageSizePublic"
  126. :page-sizes="[10,15,20]"
  127. layout="total, sizes, prev, pager, next, jumper"
  128. :total="totalNumPublic">
  129. </el-pagination>
  130. </div>
  131. </template>
  132. <template v-else>
  133. <el-row style="align-items: center;display: flex;">
  134. <el-col :span="12">
  135. <div>
  136. <el-checkbox v-model="checked">备选项</el-checkbox>
  137. </div>
  138. </el-col>
  139. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  140. <el-col :span="8">
  141. <div>
  142. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  143. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  144. </el-input>
  145. </div>
  146. </el-col>
  147. </el-row>
  148. <el-empty :image-size="200"></el-empty>
  149. </template>
  150. </el-tab-pane>
  151. <el-tab-pane label="我的镜像" name="second" v-loading="loadingCustom">
  152. <template v-if="tableDataCustom.length!==0">
  153. <el-row style="align-items: center;display: flex;">
  154. <el-col :span="12">
  155. <div style="visibility: hidden;">
  156. TODO
  157. </div>
  158. </el-col>
  159. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  160. <el-col :span="8">
  161. <div>
  162. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  163. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  164. </el-input>
  165. </div>
  166. </el-col>
  167. </el-row>
  168. <el-row style="margin-top:15px;">
  169. <el-table
  170. :data="tableDataCustom"
  171. style="width: 100%"
  172. :header-cell-style="tableHeaderStyle"
  173. >
  174. <el-table-column
  175. label="镜像名称"
  176. min-width="19%"
  177. align="left"
  178. prop="tag"
  179. >
  180. <template slot-scope="scope">
  181. <div style="display: flex;align-items: center;">
  182. <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
  183. <i class="ri-lock-2-line" style="color: #fa8c16;" v-if="scope.row.isPrivate"></i>
  184. </div>
  185. </template>
  186. </el-table-column>
  187. <el-table-column
  188. label="镜像描述"
  189. min-width="28%"
  190. align="left"
  191. prop="description"
  192. >
  193. <template slot-scope="scope">
  194. <div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
  195. <div v-if="!!scope.row.topics">
  196. <span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
  197. </div>
  198. </template>
  199. </el-table-column>
  200. <el-table-column
  201. prop="cloudbrainType"
  202. label="可用集群"
  203. min-width="10%"
  204. align="center"
  205. >
  206. <template slot-scope="scope">
  207. {{scope.row.cloudbrainType | transformType}}
  208. </template>
  209. </el-table-column>
  210. <el-table-column
  211. prop="isPrivate"
  212. label="状态"
  213. min-width="8%"
  214. align="center"
  215. >
  216. <template slot-scope="scope">
  217. {{scope.row.isPrivate | transformPravite}}
  218. </template>
  219. </el-table-column>
  220. <el-table-column
  221. prop="createdUnix"
  222. label="创建时间"
  223. align="center"
  224. min-width="14%"
  225. >
  226. <template slot-scope="scope">
  227. {{scope.row.createdUnix | transformTimestamp}}
  228. </template>
  229. </el-table-column>
  230. <el-table-column
  231. align="center"
  232. min-width="21%"
  233. label="操作"
  234. >
  235. <template slot-scope="scope">
  236. <div style="display: flex;justify-content: flex-end;align-items: center;">
  237. <div style="display: flex;align-items: center;cursor: default;;padding: 0 1rem;">
  238. <svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"><path 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"></path></svg>
  239. <span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
  240. </div>
  241. <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
  242. <div style="padding-left:1rem;cursor:pointer;">
  243. <el-dropdown size="medium">
  244. <span class="el-dropdown-link">
  245. 更多<i class="el-icon-arrow-down el-icon--right"></i>
  246. </span>
  247. <el-dropdown-menu slot="dropdown">
  248. <el-dropdown-item @click.native="eidtImage(scope.row.id)">编辑</el-dropdown-item>
  249. <el-dropdown-item style="color: red;" @click.native="deleteImage(scope.row.id)">删除</el-dropdown-item>
  250. </el-dropdown-menu>
  251. </el-dropdown>
  252. </div>
  253. </div>
  254. </template>
  255. </el-table-column>
  256. </el-table>
  257. </el-row>
  258. <div class="ui container" style="margin-top:50px;text-align:center">
  259. <el-pagination
  260. background
  261. @size-change="handleSizeChangeCustom"
  262. @current-change="handleCurrentChangeCustom"
  263. :current-page="currentPageCustom"
  264. :page-size="pageSizeCustom"
  265. :page-sizes="[5,15,20]"
  266. layout="total, sizes, prev, pager, next, jumper"
  267. :total="totalNumCustom">
  268. </el-pagination>
  269. </div>
  270. </template>
  271. <template v-else>
  272. <el-row style="align-items: center;display: flex;">
  273. <el-col :span="12">
  274. <div style="visibility: hidden;">
  275. TODO
  276. </div>
  277. </el-col>
  278. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  279. <el-col :span="8">
  280. <div>
  281. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  282. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  283. </el-input>
  284. </div>
  285. </el-col>
  286. </el-row>
  287. <el-empty :image-size="200"></el-empty>
  288. </template>
  289. </el-tab-pane>
  290. <el-tab-pane label="我收藏的镜像" name="third">
  291. <template v-if="tableDataStar.length!==0">
  292. <el-row style="align-items: center;display: flex;">
  293. <el-col :span="12">
  294. <div style="visibility: hidden;">
  295. TODO
  296. </div>
  297. </el-col>
  298. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  299. <el-col :span="8">
  300. <div>
  301. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  302. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  303. </el-input>
  304. </div>
  305. </el-col>
  306. </el-row>
  307. <el-row style="margin-top:15px;">
  308. <el-table
  309. :data="tableDataPublic"
  310. style="width: 100%"
  311. :header-cell-style="tableHeaderStyle"
  312. >
  313. <el-table-column
  314. label="镜像名称"
  315. min-width="19%"
  316. align="left"
  317. prop="tag"
  318. >
  319. <template slot-scope="scope">
  320. <div style="display: flex;align-items: center;">
  321. <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
  322. <i class="ri-lock-2-line" style="color: #fa8c16;" v-if="scope.row.isPrivate"></i>
  323. </div>
  324. </template>
  325. </el-table-column>
  326. <el-table-column
  327. label="镜像描述"
  328. min-width="28%"
  329. align="left"
  330. prop="description"
  331. >
  332. <template slot-scope="scope">
  333. <div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
  334. <div v-if="!!scope.row.topics">
  335. <span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
  336. </div>
  337. </template>
  338. </el-table-column>
  339. <el-table-column
  340. prop="cloudbrainType"
  341. label="可用集群"
  342. min-width="10%"
  343. align="center"
  344. >
  345. <template slot-scope="scope">
  346. {{scope.row.cloudbrainType | transformType}}
  347. </template>
  348. </el-table-column>
  349. <el-table-column
  350. prop="creator"
  351. label="创建者"
  352. min-width="8%"
  353. align="center"
  354. >
  355. <template slot-scope="scope">
  356. <a :href="'/' + scope.row.userName" :title="scope.row.userName">
  357. <img :src="scope.row.relAvatarLink" class="ui avatar image">
  358. </a>
  359. </template>
  360. </el-table-column>
  361. <el-table-column
  362. prop="createdUnix"
  363. label="创建时间"
  364. align="center"
  365. min-width="14%"
  366. >
  367. <template slot-scope="scope">
  368. {{scope.row.createdUnix | transformTimestamp}}
  369. </template>
  370. </el-table-column>
  371. <el-table-column
  372. align="center"
  373. min-width="21%"
  374. label="操作"
  375. >
  376. <template slot-scope="scope">
  377. <div style="display: flex;justify-content: flex-end;align-items: center;">
  378. <div style="display: flex;align-items: center;cursor:default;padding: 0 1rem;">
  379. <svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke stars_active"><path 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"></path></svg>
  380. <span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
  381. </div>
  382. <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
  383. </div>
  384. </template>
  385. </el-table-column>
  386. </el-table>
  387. </el-row>
  388. <div class="ui container" style="margin-top:50px;text-align:center">
  389. <el-pagination
  390. background
  391. @size-change="handleSizeChangeStar"
  392. @current-change="handleCurrentChangeStar"
  393. :current-page="currentPageStar"
  394. :page-size="pageSizeStar"
  395. :page-sizes="[5,15,20]"
  396. layout="total, sizes, prev, pager, next, jumper"
  397. :total="totalNumStar">
  398. </el-pagination>
  399. </div>
  400. </template>
  401. <template v-else>
  402. <el-row style="align-items: center;display: flex;">
  403. <el-col :span="12">
  404. <div style="visibility: hidden;">
  405. TODO
  406. </div>
  407. </el-col>
  408. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  409. <el-col :span="8">
  410. <div>
  411. <el-input placeholder="搜镜像名称/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  412. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  413. </el-input>
  414. </div>
  415. </el-col>
  416. </el-row>
  417. <el-empty :image-size="200"></el-empty>
  418. </template>
  419. </el-tab-pane>
  420. </el-tabs>
  421. </div>
  422. </div>
  423. </template>
  424. <script>
  425. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  426. export default {
  427. components: {
  428. },
  429. data() {
  430. return {
  431. activeName: 'first',
  432. search:'',
  433. checked:false,
  434. currentPagePublic:1,
  435. pageSizePublic:15,
  436. totalNumPublic:0,
  437. paramsPublic:{page:1,pageSize:15,q:'',recommend:false},
  438. tableDataPublic: [],
  439. loadingPublic:false,
  440. currentPageCustom:1,
  441. pageSizeCustom:15,
  442. totalNumCustom:0,
  443. paramsCustom:{page:1,pageSize:15,q:''},
  444. tableDataCustom: [],
  445. starCustom:[],
  446. loadingCustom:false,
  447. currentPageStar:1,
  448. pageSizeStar:15,
  449. totalNumStar:0,
  450. paramsStar:{page:1,pageSize:15,q:''},
  451. tableDataStar: [],
  452. loadingStar:false
  453. };
  454. },
  455. methods: {
  456. handleClick(tab, event) {
  457. this.search = ''
  458. if(tab.name=="first"){
  459. this.paramsPublic.q = ''
  460. this.getImageListPublic()
  461. }
  462. if(tab.name=="second"){
  463. this.getImageListCustom()
  464. }
  465. if(tab.name=="third"){
  466. this.getImageListStar()
  467. }
  468. },
  469. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  470. if(rowIndex===0){
  471. return 'background:#f5f5f6;color:#606266'
  472. }
  473. },
  474. handleSizeChangePublic(val){
  475. this.paramsPublic.pageSize = val
  476. this.getImageListPublic()
  477. },
  478. handleCurrentChangePublic(val){
  479. this.paramsPublic.page = val
  480. this.getImageListPublic()
  481. },
  482. handleSizeChangeCustom(val){
  483. this.paramsCustom.pageSize = val
  484. this.getImageListCustom()
  485. },
  486. handleCurrentChangeCustom(val){
  487. this.paramsCustom.page = val
  488. this.getImageListCustom()
  489. },
  490. handleSizeChangeStar(val){
  491. this.paramsStar.pageSize = val
  492. this.getImageListStar()
  493. },
  494. handleCurrentChangeStar(val){
  495. this.paramsStar.page = val
  496. this.getImageListStar()
  497. },
  498. getImageListPublic(){
  499. this.loadingPublic = true
  500. this.$axios.get('/explore/images/public',{
  501. params:this.paramsPublic
  502. }).then((res)=>{
  503. console.log("res",res.data)
  504. this.totalNumPublic = res.data.count
  505. this.tableDataPublic = res.data.images
  506. this.loadingPublic = false
  507. })
  508. },
  509. getImageListCustom(){
  510. this.loadingCustom = true
  511. this.$axios.get('/explore/images/custom',{
  512. params:this.paramsCustom
  513. }).then((res)=>{
  514. console.log("res",res)
  515. this.totalNumCustom = res.data.count
  516. this.tableDataCustom = res.data.images
  517. this.tableDataCustom.forEach(element => {
  518. this.starCustom.push({id:element.id,})
  519. });
  520. this.loadingCustom = false
  521. })
  522. },
  523. getImageListStar(){
  524. this.loadingStar = true
  525. this.$axios.get('/explore/images/star',{
  526. params:this.paramsStar
  527. }).then((res)=>{
  528. console.log("res",res)
  529. this.totalNumStar = res.data.count
  530. this.tableDataStar = res.data.images
  531. this.loadingStar = false
  532. })
  533. },
  534. deleteImage(id){
  535. this.$axios.delete('/image/'+id).then((res)=>{
  536. console.log(res)
  537. this.getImageListCustom()
  538. })
  539. },
  540. eidtImage(id){
  541. location.href = `/image/${id}/imageSquare`
  542. },
  543. imageStar(index,id,isStar){
  544. if(isStar){
  545. this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{
  546. console.log(res)
  547. this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars - 1
  548. this.tableDataPublic[index].isStar = false
  549. })
  550. }else{
  551. this.$axios.put(`/image/${id}/action/star`).then((res)=>{
  552. console.log(res)
  553. this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars + 1
  554. this.tableDataPublic[index].isStar = true
  555. })
  556. }
  557. },
  558. copyUrl(url){
  559. const cInput = document.createElement('input')
  560. cInput.value = url
  561. document.body.appendChild(cInput)
  562. cInput.select()
  563. document.execCommand('Copy')
  564. cInput.remove()
  565. },
  566. searchName(){
  567. if(this.activeName=='first'){
  568. this.paramsPublic.q = this.search
  569. this.paramsPublic.page = 1
  570. this.getImageListPublic()
  571. }
  572. if(this.activeName=='second'){
  573. this.paramsCustom.q = this.search
  574. this.paramsCustom.page = 1
  575. this.getImageListCustom()
  576. }
  577. if(this.activeName=='third'){
  578. this.paramsStar.q = this.search
  579. this.paramsStar.page = 1
  580. this.getImageListStar()
  581. }
  582. }
  583. },
  584. filters:{
  585. clearP(value){
  586. if(!value) return ''
  587. const reg = /\<\/?p\>/g;
  588. value = value.replace(reg,'')
  589. return value
  590. },
  591. transformType(val){
  592. if(val==0){
  593. return "GPU"
  594. }
  595. },
  596. transformPravite(val){
  597. if(val){
  598. return "私有"
  599. }else{
  600. return "公开"
  601. }
  602. },
  603. transformTimestamp(timestamp){
  604. // let a = new Date(timestamp).getTime();
  605. const date = new Date(parseInt(timestamp) * 1000);
  606. const Y = date.getFullYear() + '-';
  607. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  608. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  609. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  610. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) + ':' ;
  611. const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒
  612. const dateString = Y + M + D + h + m + s;
  613. // console.log('dateString', dateString); // > dateString 2021-07-06 14:23
  614. return dateString;
  615. },
  616. },
  617. watch:{
  618. search(val){
  619. if(this.activeName=='first'){
  620. this.paramsPublic.q = val
  621. this.getImageListPublic()
  622. }
  623. if(this.activeName=='second'){
  624. this.paramsCustom.q = val
  625. this.getImageListCustom()
  626. }
  627. if(this.activeName=='third'){
  628. this.paramsStar.q = val
  629. this.getImageListStar()
  630. }
  631. }
  632. },
  633. mounted() {
  634. this.getImageListPublic()
  635. },
  636. created() {
  637. }
  638. };
  639. </script>
  640. <style scoped>
  641. .header-wrapper {
  642. background-color: #f5f5f6;
  643. padding-top: 15px;
  644. }
  645. .image_text{
  646. padding:25px 0 55px 0 ;
  647. }
  648. #header{
  649. position: relative;
  650. top:-40px;
  651. }
  652. .el-dropdown-menu__item--divided{
  653. border-top: 1px solid blue;
  654. }
  655. .el-table thead{
  656. background-color: #f5f5f6;
  657. }
  658. /deep/ .el-tabs__item:hover{
  659. color: #000;
  660. font-weight: 500;
  661. }
  662. /deep/ .el-tabs__item.is-active {
  663. color: #000;
  664. font-weight: 500;
  665. }
  666. /deep/ .el-tabs__active-bar{
  667. background-color:#000
  668. }
  669. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  670. background-color: #5bb973;
  671. color: #FFF;
  672. }
  673. /deep/ .el-pagination.is-background .el-pager li.active {
  674. color: #fff;
  675. cursor: default;
  676. }
  677. /deep/ .el-pagination.is-background .el-pager li:hover {
  678. color: #5bb973;
  679. }
  680. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  681. color: #5bb973;
  682. }
  683. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  684. background-color: #5bb973;
  685. color: #FFF;
  686. }
  687. /deep/ .el-pager li.active {
  688. color: #08C0B9;
  689. cursor: default;
  690. }
  691. /deep/ .el-pagination .el-pager li:hover {
  692. color: #08C0B9;
  693. }
  694. /deep/ .el-pagination .el-pager li:not(.disabled):hover {
  695. color: #08C0B9;
  696. }
  697. /* /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active{
  698. background-color: #5bb973;
  699. color: #000;
  700. } */
  701. /* /deep/ .el-pager li:hover{
  702. color: #000;
  703. } */
  704. #success{
  705. background-color: #5bb973;
  706. color: white;
  707. }
  708. .text-over{
  709. overflow: hidden;
  710. text-overflow: ellipsis;
  711. vertical-align: middle;
  712. white-space: nowrap;
  713. }
  714. .image_title{
  715. display: inline-block;
  716. width: 80%;
  717. cursor: default;
  718. color: rgb(66, 98, 144);
  719. }
  720. .image_desc{
  721. -webkit-line-clamp: 2;
  722. -webkit-box-orient: vertical;
  723. display: -webkit-box;
  724. text-overflow: ellipsis;
  725. overflow: hidden;
  726. }
  727. .heart-stroke{
  728. stroke: #666;
  729. stroke-width: 2;
  730. fill: #fff
  731. }
  732. .stars_active{
  733. fill: #FA8C16 !important;
  734. stroke:#FA8C16 !important
  735. }
  736. </style>