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