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