new_market.blade.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. @extends('layouts.base')
  2. @section('title', '安装应用')
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/plugins-market/assets/css/index.css')}}">
  5. <style>
  6. .all{
  7. padding-top: 10px !important;
  8. }
  9. .vue-page{
  10. width: calc(100% - 124px);
  11. }
  12. .base_set{
  13. background: #fff;
  14. margin: 20px 10px 0 20px;
  15. }
  16. .base_sets{
  17. height: 100vh;
  18. background: #fff;
  19. margin: 10px 10px 0 10px;
  20. }
  21. .vue-main-title{
  22. margin-left: 20px;
  23. padding-top: 10px;
  24. }
  25. .el-row{
  26. padding: 5px 0 0px 0;
  27. }
  28. .topSearch{
  29. display: flex;
  30. }
  31. .topSearch .el-input{
  32. margin-right: 5px;
  33. width: 700px;
  34. }
  35. .topSearch .el-button{
  36. background-color: #29ba9c;
  37. border-radius: 2px;
  38. color: #fff;
  39. border-radius: 4px;
  40. width: 98px;
  41. border-color: #29ba9c;
  42. }
  43. .applicationClassification{
  44. color: #333333;
  45. font-size: 16px;
  46. font-weight: normal;
  47. }
  48. .applicationClassification span{
  49. display: inline-block;
  50. margin-top: 22px;
  51. margin-right: 50px;
  52. cursor: pointer;
  53. }
  54. .activeColor{
  55. padding: 5px 16px;
  56. background-color: #29ba9c;
  57. border-radius: 15px;
  58. color: #fff;
  59. }
  60. .applicationStatus{
  61. color: #333333;
  62. font-weight: normal;
  63. }
  64. .applicationStatus span{
  65. display: inline-block;
  66. margin-top: 22px;
  67. margin-right: 50px;
  68. cursor: pointer;
  69. font-size: 16px;
  70. }
  71. .plugManagement{
  72. margin-top: 38px;
  73. height: 30px;
  74. display: flex;
  75. align-items: center;
  76. }
  77. .plugManagementContext{
  78. padding: 7px 16px;
  79. background: #ec544a;
  80. border-radius: 4px;
  81. color: #fff;
  82. cursor: pointer;
  83. margin-right: 37px;
  84. font-size: 16px;
  85. width: 130px;
  86. height: 30px;
  87. display: flex;
  88. justify-content: center;
  89. align-items: center;
  90. }
  91. .plugManagement .noticeDetail{
  92. font-size: 16px;
  93. color: #333333;
  94. font-weight: normal;
  95. }
  96. .cardBox{
  97. display: flex;
  98. flex-wrap: wrap;
  99. margin: 20px 10px 20px 20px;
  100. justify-content: space-between;
  101. }
  102. .box{
  103. width: 32.8%;
  104. background: #fff;
  105. margin:0 0 20px 0;
  106. display: flex;
  107. padding: 15px;
  108. border-radius: 10px;
  109. height: 180px;
  110. }
  111. /* .boxLast{
  112. margin-bottom: 40px;
  113. } */
  114. .boxDetail{
  115. width: 100%;
  116. background: #fff;
  117. margin: 20px 10px;
  118. display: flex;
  119. padding: 20px;
  120. border-radius: 10px;
  121. }
  122. .box .cardDetail{
  123. display: flex;
  124. flex-direction: column;
  125. justify-content: space-between;
  126. width: 100%;
  127. height: 150px;
  128. }
  129. .box .cardDetail .verification{
  130. color: #202020;
  131. }
  132. .verification-version {
  133. font-size: 14px;
  134. color: #a3a3a3;
  135. margin-left: 14px;
  136. }
  137. .buttonLeft{
  138. display: flex;
  139. justify-content: space-between;
  140. height: 30px;
  141. }
  142. .box .grant{
  143. background: #c6eee2 !important;
  144. color: #29ba9c !important;
  145. border-radius: 4px;
  146. border-color: #c6eee2 !important;
  147. }
  148. .box .grant:hover{
  149. background: #ec544a;
  150. color: #fff;
  151. border-color: #ec544a;
  152. }
  153. .activeGrant{
  154. color: #ec544a;
  155. background: #fcd7d3;
  156. border-radius: 4px;
  157. border-color: #fcd7d3;
  158. }
  159. .el-button--whiteBackground {
  160. background: #ec544a !important;
  161. color: #fff !important;
  162. border-color: #ec544a !important;
  163. }
  164. .box .install{
  165. background: #29ba9c;
  166. color: #fff;
  167. border-radius: 4px;
  168. border-color: #29ba9c;
  169. }
  170. .activeInstall{
  171. background-color: #c6eee2 !important;
  172. color: #29ba9c !important;
  173. border-radius: 4px;
  174. border-color: #c6eee2 !important;
  175. }
  176. .box .details {
  177. color: #29ba9c;
  178. cursor: pointer;
  179. font-size: 14px;
  180. }
  181. .cardDetail .tip{
  182. color: #ec544a;
  183. margin-left: 10px;
  184. }
  185. .categoryDes{
  186. color: #595959;
  187. font-size: 16px;
  188. overflow: hidden;
  189. text-overflow: ellipsis;
  190. display: -webkit-box;
  191. -webkit-line-clamp: 2;
  192. -webkit-box-orient: vertical;
  193. }
  194. .batchInstallation{
  195. margin-top: 30px;
  196. margin-right: 23px;
  197. margin-left: 20px;
  198. padding: 0 15px;
  199. display: flex;
  200. color: rgb(255, 255, 255);
  201. border-radius: 2px;
  202. justify-content: center;
  203. align-items: center;
  204. width: 120px;
  205. height: 42px;
  206. background-color: #29ba9c;
  207. border-radius: 4px;
  208. cursor:pointer
  209. }
  210. .el-loading-spinner {
  211. top: 30% !important;
  212. }
  213. .buttonLeft .el-button{
  214. height: 30px;
  215. width: 80px;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. padding-top: 14px;
  220. }
  221. .cardStatus {
  222. display: flex;
  223. }
  224. </style>
  225. <div class="all">
  226. <div id="app" v-cloak >
  227. <el-form ref="form" label-width="15%" v-loading="isShow" @submit.native.prevent>
  228. <div :class="[isShow ? 'base_sets' : 'base_set']">
  229. <div class="vue-main-title">
  230. <div class="vue-main-title-left" style="height: 24px;margin-top: 1px;"></div>
  231. <div class="vue-main-title-content" v-if="!isShow" style="font-size: 20px;font-weight: normal;">应用市场</div>
  232. </div>
  233. <el-row v-if="!isShow">
  234. <el-col :span="4">&nbsp;</el-col>
  235. <el-col :span="13">
  236. <div class="topSearch">
  237. <el-input placeholder="请输入应用名称" v-model="keyword" @keyup.enter.native="searchEnterFun"></el-input>
  238. <el-button @click="search(1)" >搜索</el-button>
  239. </div>
  240. <div class="applicationClassification" >
  241. <span >应用分类:</span>
  242. <span v-for="(item,index) in applicationClassificationData" :class="[currentShowClassifyPage == item.id ? 'activeColor':'']" @click="applicationClassify(item.id,item.name)">[[item.name]]</span>
  243. </div>
  244. <div class="applicationStatus" >
  245. <span>应用状态:</span>
  246. <span v-for="(item,index) in applicationStatusData" :class="[currentShowStatusPage == item.id ? 'activeColor':'']" @click="applicationStatus(item.id)">[[item.name]]</span>
  247. </div>
  248. </el-col>
  249. <el-col :span="7">&nbsp;</el-col>
  250. </el-row>
  251. <el-row v-if="!isShow">
  252. <el-col :span="4"> &nbsp;</el-col>
  253. <el-col :span="20" style="display: flex;justify-content: space-between;align-items: center;margin-bottom:20px">
  254. <div class="plugManagement">
  255. <span class="plugManagementContext" @click="gobackPlugins">返回插件管理</span>
  256. <span class="noticeDetail">安装应用之后,需要返回插件管理启用已安装应用!!</span>
  257. </div>
  258. <div style="display: flex;align-items: end;">
  259. <el-checkbox @change="allChange" v-model="allStatus" style="margin-bottom: 0;">全选</el-checkbox>
  260. <span class="batchInstallation" @click="batchInstallation" >批量安装</span>
  261. </div>
  262. </el-col>
  263. </el-row>
  264. </div>
  265. <!-- boxLast -->
  266. <div class="cardBox" v-loading="loading">
  267. <div class="box" v-for="(item,index) in boxData" :key="index">
  268. <div style="width: 150px;height: 150px;margin-right: 22px;"><img :src="item.imageUrl" alt="" style="width: 150px;height: 150px;"></div>
  269. <div class="cardDetail">
  270. <div style="font-weight: normal;">
  271. <div style="display: flex;justify-content: space-between;height: 19px;">
  272. <div style="display: flex;">
  273. <div class="verification"><span style="font-size: 20px;">[[item.title]]</span><span class="verification-version">版本号:[[item.version]]</span></div>
  274. <span class="tip" style="display: flex;" v-if="item.empower == 'un_auth' && item.version_status == 'installed'">涉嫌盗版使用,请卸载或联系客服!!</span>
  275. </div>
  276. <el-checkbox v-model="item.checked" v-if="item.empower == 'auth' && item.version_status == 'un_install'" @change="oneChange"></el-checkbox>
  277. </div>
  278. <div style="display: flex;justify-content: space-between;margin:13px 0px 10px 0px;color: #595959;font-size: 16px;">
  279. <span class="categoryDes" >分类: [[item.category_name]]</span>
  280. <span class="details" @click="btnDetail(item)">详情介绍 ></span>
  281. <!-- <el-button class="details" @click="btnDetail(item)">详情介绍</el-button> -->
  282. </div>
  283. <span class="categoryDes" >描述: [[item.description]]</span>
  284. </div>
  285. <div class="buttonLeft">
  286. <div class="cardStatus">
  287. <!-- empower == 验证授权 -->
  288. <el-button type="whiteBackground" class="grant" v-if="item.empower == 'auth'">已授权</el-button>
  289. <el-button type="whiteBackground" class="activeGrant" v-if="item.empower == 'un_auth'">未授权</el-button>
  290. <!-- version_status == 安装、升级、未安装 -->
  291. <el-button class="install" v-if="item.version_status == 'un_install'" @click="installOne(item,'1')">安装</el-button>
  292. <el-button class="install" v-if="item.version_status == 'new'" @click="installOne(item,'2')">可升级</el-button>
  293. <!-- <el-button class="install" v-if="item.version_status == 'un_auth'" @click="installOne(item,'3')">安装</el-button> -->
  294. <el-button class="activeInstall" v-if="item.version_status == 'installed'" :disabled="item.version_status == 'installed'" @click="installOne(item,'2')">已安装</el-button>
  295. </div>
  296. <!-- <el-button class="details" @click="btnDetail(item)">详情介绍</el-button> -->
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. <div style="padding: 10px;"></div>
  302. </el-form>
  303. <!-- 分页 -->
  304. <div class="vue-page" >
  305. <el-row>
  306. <el-col align="right">
  307. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total" :page-size="per_size" :current-page="current_page" background></el-pagination>
  308. </el-col>
  309. </el-row>
  310. </div>
  311. <el-dialog title="授权" :visible.sync="dialog1">
  312. <el-form ref="form" :model="impower" label-width="15%">
  313. <el-form-item label="密钥key" prop="key">
  314. <el-input v-model="impower.key" placeholder="请输入密钥key" style="width:70%;"></el-input>
  315. </el-form-item>
  316. <el-form-item label="密钥secret" prop="secret">
  317. <el-input v-model="impower.secret" placeholder="请输入密钥secret" style="width:70%;"></el-input>
  318. </el-form-item>
  319. </el-form>
  320. <span slot="footer" class="dialog-footer">
  321. <el-button @click="confirmImpower">授 权</el-button>
  322. <el-button @click="dialog1=false">关 闭</el-button>
  323. </span>
  324. </el-dialog>
  325. </div>
  326. </div>
  327. <script>
  328. var app = new Vue({
  329. el: "#app",
  330. delimiters: ['[[', ']]'],
  331. name: 'market',
  332. data() {
  333. return {
  334. applicationClassificationData:[],
  335. applicationStatusData:[{
  336. id:0,
  337. name:"全部"
  338. },{
  339. id:1,
  340. name:"未授权"
  341. },{
  342. id:2,
  343. name:"未安装"
  344. },{
  345. id:3,
  346. name:"已安装"
  347. }],
  348. currentShowClassifyPage:"",
  349. currentShowClassifyName:"",
  350. currentShowStatusPage:0,
  351. boxData:[],
  352. total: 0,
  353. per_size: 0,
  354. current_page: 0,
  355. loading:false,
  356. isShow:true,
  357. keyword:"",
  358. dialog1:false,
  359. impower: {
  360. key:'',
  361. secret:'',
  362. },
  363. // 全选
  364. allStatus:false
  365. }
  366. },
  367. mounted() {
  368. this.getData({status:0,category_name:""})
  369. },
  370. methods: {
  371. getData(json){
  372. this.loading = true
  373. this.$http.post("{!! yzWebFullUrl('plugin.plugins-market.Controllers.new-market.getList') !!}",json).then(response => {
  374. if (response.data.result == 1) {
  375. this.boxData = response.data.data.data;
  376. this.total = response.data.data.total;
  377. this.per_size = response.data.data.per_page;
  378. this.current_page = response.data.data.current_page;
  379. this.applicationClassificationData = response.data.data.category_list
  380. this.allStatus = false
  381. if(response.data.data.category_list){
  382. this.applicationClassificationData.unshift({
  383. id:"",
  384. name:"全部"
  385. })
  386. }
  387. this.isShow = false
  388. this.loading = false
  389. } else {
  390. this.$message.error(response.data.msg);
  391. }
  392. }), function (res) {
  393. console.log(res);
  394. };
  395. },
  396. searchEnterFun(e){
  397. let keyCode = window.event? e.keyCode:e.which;
  398. if(keyCode == 13){
  399. this.search(1)
  400. }
  401. },
  402. search(val){
  403. this.getData({
  404. page:val,
  405. status:this.currentShowStatusPage,
  406. keyword:this.keyword,
  407. // category_id:this.currentShowClassifyPage
  408. category_name:this.currentShowClassifyName
  409. })
  410. },
  411. applicationStatus(index){
  412. this.currentShowStatusPage=index
  413. this.getData({
  414. page:1,
  415. status:this.currentShowStatusPage,
  416. keyword:this.keyword,
  417. // category_id:this.currentShowClassifyPage
  418. category_name:this.currentShowClassifyName
  419. })
  420. },
  421. applicationClassify(id,name){
  422. // console.log(id,555);
  423. this.currentShowClassifyPage=id
  424. this.currentShowClassifyName = name
  425. if(this.currentShowClassifyName == "全部"){
  426. this.currentShowClassifyName = ""
  427. }
  428. this.getData({
  429. page:1,
  430. status:this.currentShowStatusPage,
  431. keyword:this.keyword,
  432. // category_id:this.currentShowClassifyPage
  433. category_name:this.currentShowClassifyName
  434. })
  435. },
  436. allChange(status){
  437. for(let item of this.boxData){
  438. if(item.empower == 'auth' && item.version_status == 'un_install'){
  439. if(status){
  440. this.$set(item,'checked',true)
  441. }else{
  442. this.$set(item,'checked',false)
  443. }
  444. }
  445. }
  446. },
  447. oneChange(status){
  448. for(let item of this.boxData){
  449. if(item.empower == 'auth' && item.version_status == 'un_install'){
  450. if(!item['checked']){
  451. this.allStatus = false
  452. return
  453. }else{
  454. this.allStatus = true
  455. }
  456. }
  457. }
  458. },
  459. batchInstallation(){
  460. let plugin = []
  461. for(let item of this.boxData){
  462. if(item['checked']){
  463. plugin.push({
  464. name:item.name,
  465. version:item.version
  466. })
  467. }
  468. }
  469. // console.log(plugin,'plugin');
  470. this.batch(plugin);
  471. },
  472. // batchUpdate() {
  473. // let that = this;
  474. // let plugin = []
  475. // that.selected_list.forEach((item,index) => {
  476. // plugin.push({
  477. // name:item.name,
  478. // version:item.latestVersion
  479. // })
  480. // });
  481. // let json = {
  482. // plugin:plugin,
  483. // }
  484. // that.batch(json);
  485. //
  486. // },
  487. batch(json) {
  488. let that = this;
  489. that.loading = true;
  490. that.$http.post("{!! yzWebFullUrl('plugin.plugins-market.Controllers.new-plugin.batchInstall') !!}",{plugin:{...json}}).then(response => {
  491. // console.log(response);
  492. if (response.data.result == 1) {
  493. that.$message.success(response.data.msg);
  494. // let json = {status:0}
  495. // that.getData(json);
  496. // window.location.reload();
  497. this.applicationStatus(this.currentShowStatusPage)
  498. } else {
  499. that.$message.error(response.data.msg);
  500. }
  501. that.loading = false;
  502. }), function (res) {
  503. that.loading = false;
  504. //console.log(res);
  505. };
  506. },
  507. // 安装、授权单个
  508. installOne(row,type) {
  509. let that = this;
  510. that.impower = {
  511. key:'',
  512. secret:'',
  513. };
  514. that.row = row;
  515. if(type == 1 || type == 2) {
  516. let json = {};
  517. if(type == 1) {
  518. json = {
  519. plugin:{
  520. name:row.name,
  521. version:row.version,
  522. }
  523. }
  524. }
  525. else if(type == 2) {
  526. json = {
  527. plugin:{
  528. name:row.name,
  529. version:row.latestVersion,
  530. }
  531. }
  532. }
  533. that.loading = true;
  534. that.$http.post("{!! yzWebFullUrl('plugin.plugins-market.Controllers.new-plugin.install') !!}",json).then(response => {
  535. // console.log(response);
  536. if (response.data.result == 1) {
  537. that.$message.success(response.data.msg);
  538. // let json = {status:0}
  539. // that.getData(json);
  540. // window.location.reload();
  541. this.applicationStatus(this.currentShowStatusPage)
  542. } else {
  543. that.$message.error(response.data.msg);
  544. }
  545. that.loading = false;
  546. }), function (res) {
  547. //console.log(res);
  548. that.loading = false;
  549. };
  550. }
  551. else if(type == 3) {
  552. that.openDialog(row);
  553. }
  554. console.log(row)
  555. },
  556. openDialog(row) {
  557. let that = this;
  558. that.dialog1 = true;
  559. },
  560. // 确认授权
  561. confirmImpower() {
  562. let that = this;
  563. // console.log(that.impower);
  564. if(that.impower.key == '') {
  565. that.$message.error("密钥key不能为空");
  566. return;
  567. }
  568. if(that.impower.secret == '') {
  569. that.$message.error("密钥secret不能为空");
  570. return;
  571. }
  572. let json = {
  573. plugin:{
  574. name:that.row.name,
  575. version:that.row.version,
  576. },
  577. keyData:{
  578. key:that.impower.key,
  579. secret:that.impower.secret,
  580. }
  581. };
  582. that.dialog_loading = true;
  583. that.$http.post("{!! yzWebFullUrl('plugin.plugins-market.Controllers.new-plugin.authorize') !!}",json).then(response => {
  584. // console.log(response);
  585. if (response.data.result == 1) {
  586. that.$message.success(response.data.msg);
  587. // let json = {status:0}
  588. // that.getData(json);
  589. // that.dialog1 = false;
  590. window.location.reload();
  591. } else {
  592. that.$message.error(response.data.msg);
  593. }
  594. that.dialog_loading = false;
  595. }), function (res) {
  596. //console.log(res);
  597. that.dialog_loading = false;
  598. };
  599. },
  600. btnDetail(data){
  601. let link =`{!! yzWebFullUrl('plugin.plugins-market.Controllers.new-market.details-index') !!}`+`&id=`+data.id
  602. window.location.href = link;
  603. console.log(data,55);
  604. },
  605. gobackPlugins(){
  606. let link =`{!! yzWebFullUrl('plugins.get-plugin-data') !!}`
  607. window.location.href = link;
  608. }
  609. },
  610. })
  611. </script>
  612. @endsection