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