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
4 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
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
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
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
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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
4 years ago
4 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  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" 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 :href="'/' + scope.row.userName" :title="scope.row.userName">
  362. <img :src="scope.row.relAvatarLink" class="ui avatar image">
  363. </a>
  364. </template>
  365. </el-table-column>
  366. <el-table-column
  367. prop="createdUnix"
  368. label="创建时间"
  369. align="center"
  370. min-width="14%"
  371. >
  372. <template slot-scope="scope">
  373. {{scope.row.createdUnix | transformTimestamp}}
  374. </template>
  375. </el-table-column>
  376. <el-table-column
  377. align="center"
  378. min-width="21%"
  379. label="操作"
  380. >
  381. <template slot-scope="scope">
  382. <div style="display: flex;justify-content: flex-end;align-items: center;">
  383. <div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageUnstar(scope.row.id)">
  384. <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>
  385. <span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
  386. </div>
  387. <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
  388. </div>
  389. </template>
  390. </el-table-column>
  391. </el-table>
  392. </el-row>
  393. <div class="ui container" style="margin-top:50px;text-align:center">
  394. <el-pagination
  395. background
  396. @size-change="handleSizeChangeStar"
  397. @current-change="handleCurrentChangeStar"
  398. :current-page="currentPageStar"
  399. :page-size="pageSizeStar"
  400. :page-sizes="[5,10,15]"
  401. layout="total, sizes, prev, pager, next, jumper"
  402. :total="totalNumStar">
  403. </el-pagination>
  404. </div>
  405. </template>
  406. <template v-else>
  407. <el-row style="align-items: center;display: flex;">
  408. <el-col :span="12">
  409. <div style="visibility: hidden;">
  410. TODO
  411. </div>
  412. </el-col>
  413. <el-col :span="4"><div style="visibility: hidden;">TODO</div></el-col>
  414. <el-col :span="8">
  415. <div>
  416. <el-input placeholder="搜镜像Tag/描述/标签..." v-model="search" class="input-with-select" @keyup.enter.native="searchName()">
  417. <el-button id="success" slot="append" icon="el-icon-search" @click="searchName()">搜索</el-button>
  418. </el-input>
  419. </div>
  420. </el-col>
  421. </el-row>
  422. <el-empty :image-size="200"></el-empty>
  423. </template>
  424. </el-tab-pane>
  425. </el-tabs>
  426. </div>
  427. </div>
  428. </template>
  429. <script>
  430. const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
  431. export default {
  432. components: {
  433. },
  434. data() {
  435. return {
  436. activeName: 'first',
  437. search:'',
  438. checked:false,
  439. currentPagePublic:1,
  440. pageSizePublic:10,
  441. totalNumPublic:0,
  442. paramsPublic:{page:1,pageSize:10,q:'',recommend:false},
  443. tableDataPublic: [],
  444. loadingPublic:false,
  445. currentPageCustom:1,
  446. pageSizeCustom:10,
  447. totalNumCustom:0,
  448. paramsCustom:{page:1,pageSize:10,q:''},
  449. tableDataCustom: [],
  450. starCustom:[],
  451. loadingCustom:false,
  452. currentPageStar:1,
  453. pageSizeStar:10,
  454. totalNumStar:0,
  455. paramsStar:{page:1,pageSize:10,q:''},
  456. tableDataStar: [],
  457. loadingStar:false
  458. };
  459. },
  460. methods: {
  461. handleClick(tab, event) {
  462. this.search = ''
  463. if(tab.name=="first"){
  464. this.paramsPublic.q = ''
  465. this.getImageListPublic()
  466. }
  467. if(tab.name=="second"){
  468. this.getImageListCustom()
  469. }
  470. if(tab.name=="third"){
  471. this.getImageListStar()
  472. }
  473. },
  474. tableHeaderStyle({row,column,rowIndex,columnIndex}){
  475. if(rowIndex===0){
  476. return 'background:#f5f5f6;color:#606266'
  477. }
  478. },
  479. handleSizeChangePublic(val){
  480. this.paramsPublic.pageSize = val
  481. this.getImageListPublic()
  482. },
  483. handleCurrentChangePublic(val){
  484. this.paramsPublic.page = val
  485. this.getImageListPublic()
  486. },
  487. handleSizeChangeCustom(val){
  488. this.paramsCustom.pageSize = val
  489. this.getImageListCustom()
  490. },
  491. handleCurrentChangeCustom(val){
  492. this.paramsCustom.page = val
  493. this.getImageListCustom()
  494. },
  495. handleSizeChangeStar(val){
  496. this.paramsStar.pageSize = val
  497. this.getImageListStar()
  498. },
  499. handleCurrentChangeStar(val){
  500. this.paramsStar.page = val
  501. this.getImageListStar()
  502. },
  503. getImageListPublic(){
  504. this.loadingPublic = true
  505. this.$axios.get('/explore/images/public',{
  506. params:this.paramsPublic
  507. }).then((res)=>{
  508. this.totalNumPublic = res.data.count
  509. this.tableDataPublic = res.data.images
  510. this.loadingPublic = false
  511. })
  512. },
  513. getImageListCustom(){
  514. this.loadingCustom = true
  515. this.$axios.get('/explore/images/custom',{
  516. params:this.paramsCustom
  517. }).then((res)=>{
  518. this.totalNumCustom = res.data.count
  519. this.tableDataCustom = res.data.images
  520. this.tableDataCustom.forEach(element => {
  521. this.starCustom.push({id:element.id,})
  522. });
  523. this.loadingCustom = false
  524. })
  525. },
  526. getImageListStar(){
  527. this.loadingStar = true
  528. this.$axios.get('/explore/images/star',{
  529. params:this.paramsStar
  530. }).then((res)=>{
  531. this.totalNumStar = res.data.count
  532. this.tableDataStar = res.data.images
  533. this.loadingStar = false
  534. })
  535. },
  536. deleteImage(id){
  537. let flag=1
  538. let _this = this
  539. $('.ui.basic.modal.images')
  540. .modal({
  541. onDeny: function() {
  542. flag = false
  543. },
  544. onApprove: function() {
  545. _this.$axios.delete('/image/'+id).then((res)=>{
  546. _this.getImageListCustom()
  547. })
  548. flag = true
  549. },
  550. onHidden: function() {
  551. if (flag == false) {
  552. $('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
  553. }else{
  554. $('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
  555. }
  556. }
  557. })
  558. .modal('show')
  559. },
  560. eidtImage(id){
  561. location.href = `/image/${id}/imageSquare`
  562. },
  563. imageStar(index,id,isStar){
  564. if(isStar){
  565. this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{
  566. if(res.data.Code==0){
  567. this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars - 1
  568. this.tableDataPublic[index].isStar = false
  569. }else{
  570. console.log(res.data.Message)
  571. }
  572. })
  573. }else{
  574. this.$axios.put(`/image/${id}/action/star`).then((res)=>{
  575. if(res.data.Code==0){
  576. this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars + 1
  577. this.tableDataPublic[index].isStar = true
  578. }else{
  579. console.log(res.data.Message)
  580. }
  581. })
  582. }
  583. },
  584. imageUnstar(id){
  585. this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{
  586. if(res.data.Code==0){
  587. this.getImageListStar()
  588. }else{
  589. console.log(res.data.Message)
  590. }
  591. })
  592. },
  593. copyUrl(url){
  594. const cInput = document.createElement('input')
  595. cInput.value = url
  596. document.body.appendChild(cInput)
  597. cInput.select()
  598. document.execCommand('Copy')
  599. cInput.remove()
  600. },
  601. searchName(){
  602. if(this.activeName=='first'){
  603. this.paramsPublic.q = this.search
  604. this.paramsPublic.page = 1
  605. this.getImageListPublic()
  606. }
  607. if(this.activeName=='second'){
  608. this.paramsCustom.q = this.search
  609. this.paramsCustom.page = 1
  610. this.getImageListCustom()
  611. }
  612. if(this.activeName=='third'){
  613. this.paramsStar.q = this.search
  614. this.paramsStar.page = 1
  615. this.getImageListStar()
  616. }
  617. },
  618. },
  619. filters:{
  620. transformType(val){
  621. if(val==0){
  622. return "GPU"
  623. }
  624. },
  625. transformPravite(val){
  626. if(val){
  627. return "私有"
  628. }else{
  629. return "公开"
  630. }
  631. },
  632. transformTimestamp(timestamp){
  633. const date = new Date(parseInt(timestamp) * 1000);
  634. const Y = date.getFullYear() + '-';
  635. const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
  636. const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  637. const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  638. const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) + ':' ;
  639. const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒
  640. const dateString = Y + M + D + h + m + s;
  641. return dateString;
  642. },
  643. },
  644. watch:{
  645. checked(val){
  646. this.paramsPublic.page = 1
  647. this.paramsPublic.recommend = val
  648. this.getImageListPublic()
  649. }
  650. },
  651. mounted() {
  652. },
  653. created() {
  654. const params = new URLSearchParams(location.search)
  655. if(params.has('type')&&params.get('type')=='myimage'){
  656. this.activeName = 'second'
  657. this.getImageListCustom()
  658. }
  659. else{
  660. this.getImageListPublic()
  661. }
  662. }
  663. };
  664. </script>
  665. <style scoped>
  666. .header-wrapper {
  667. background-color: #f5f5f6;
  668. padding-top: 15px;
  669. }
  670. .image_text{
  671. padding:25px 0 55px 0 ;
  672. }
  673. #header{
  674. position: relative;
  675. top:-40px;
  676. }
  677. .el-dropdown-menu__item--divided{
  678. border-top: 1px solid blue;
  679. }
  680. .el-table thead{
  681. background-color: #f5f5f6;
  682. }
  683. /deep/ .el-tabs__item:hover{
  684. color: #000;
  685. font-weight: 500;
  686. }
  687. /deep/ .el-tabs__item.is-active {
  688. color: #000;
  689. font-weight: 500;
  690. }
  691. /deep/ .el-tabs__active-bar{
  692. background-color:#000
  693. }
  694. #success{
  695. background-color: #5bb973;
  696. color: white;
  697. }
  698. .text-over{
  699. overflow: hidden;
  700. text-overflow: ellipsis;
  701. vertical-align: middle;
  702. white-space: nowrap;
  703. }
  704. .image_title{
  705. display: inline-block;
  706. cursor: default;
  707. color: rgb(66, 98, 144);
  708. }
  709. .image_desc{
  710. -webkit-line-clamp: 2;
  711. -webkit-box-orient: vertical;
  712. display: -webkit-box;
  713. text-overflow: ellipsis;
  714. overflow: hidden;
  715. }
  716. .heart-stroke{
  717. stroke: #FA8C16;
  718. stroke-width: 2;
  719. fill: #fff
  720. }
  721. .stars_active{
  722. fill: #FA8C16 !important;
  723. stroke:#FA8C16 !important
  724. }
  725. </style>