canyin-project/ybcy/views/admin/app/administration_app.php

250 lines
11 KiB
PHP
Raw Normal View History

2024-11-01 16:07:54 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<?php if($this->params['site_image']):?>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $this->params['site_image'];?>" />
<?php else:?>
<link rel="shortcut icon" type="image/x-icon" href="<?=Yii::$app->request->baseUrl?>/web/favicon.ico" />
<?php endif;?>
<title> <?php if($this->params['site_title']):?>
<?php echo $this->params['site_title']; ?>
<?php else:?>
应用管理后台
<?php endif;?></title>
<link rel="stylesheet" type="text/css" href="<?=Yii::$app->request->baseUrl?>/web/static/css/globle.css"/>
<script src="<?=Yii::$app->request->baseUrl?>/web/static/js/config.js" type="text/javascript" charset="utf-8"></script>
</head>
<style>
.tjpt .el-button {
width: 130px;
height: 38px;
}
.namelogo {
width: 40px;
height: 40px;
border-radius: 50%;
}
color_0b {
color: #0FA42B;
}
</style>
<body>
<div class="pHead">
<div class="publicHeader"><?php echo $this->render('@app/views/admin/public/publicHeader.html');?></div>
</div>
<div class="pLeft">
<div class="publicAside hei"><?php echo $this->render('@app/views/admin/public/publicAside.html');?></div>
</div>
<div class="yb_body">
<div class="layout" id="platformList" v-cloak v-loading="cardLoading">
<el-container>
<el-container>
<el-main>
<div class="main" style="min-width: 800px">
<div class="main_search pad_30 ba_f bor_rad5">
<div class="main_search_tit t_l fon_16 wei">应用列表</div>
</div>
<div class="ba_f pad_b_30">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="已安装列表" name="1">已安装列表</el-tab-pane>
<el-tab-pane label="未安装列表" name="2">未安装列表</el-tab-pane>
<el-tab-pane label="回收站" name="3">回收站</el-tab-pane>
</el-tabs>
</div>
<div class="main-table pad_30 ba_f bor_rad5">
<div class="fon_14 color_3">
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark"
style="width: 100%">
<el-table-column label="应用名 " prop="image">
<template slot-scope="scope">
<div class="flex pad_tb_10">
<!-- <div class=""><img class="namelogo" :src="scope.row.app_image"/>-->
</div>
<div class="flex-col mar_l20">{{scope.row.app_name}}</div>
</div>
</template>
</el-table-column>
<el-table-column prop="app_version" label="版本"></el-table-column>
<el-table-column prop="channel_name" label="渠道">
<template slot-scope="scope">
<div class="">
<div>微信小程序</div>
</div>
</template>
</el-table-column>
<!-- <el-table-column prop="plug_name" label="插件">-->
<!-- <template slot-scope="scope">-->
<!-- <div class="">-->
<!-- <div v-for="item in scope.row.plug_list">{{item}}</div>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="操作">
<template slot-scope="scope">
<div class="textbutton" v-if="activeName=='1'">
<!-- <el-button type="text" class="fon_14 color_rb"-->
<!-- @click="deactivation(scope.row.id,2)">停用-->
<!-- </el-button>-->
<el-button type="text" class="fon_14 auxiliarycolor"
@click="edit(scope.row.id)">管理设置
</el-button>
<!-- <el-button type="text" class="fon_14" @click="upgrade(scope.row.id)">更新</el-button>-->
</div>
<div class="textbutton" v-if="activeName=='2'">
<el-button type="text" class="fon_14 auxiliarycolor" @click="install(scope.row.id)">安装</el-button>
<el-button type="text" class="fon_14 mar_l20"
@click="deactivation(scope.row.id,3)">删除
</el-button>
</div>
<div class="textbutton" v-if="activeName=='3'">
<el-button type="text" class="fon_14 color_rb"
@click="deactivation(scope.row.id,2)">启用
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="t_l">
<el-pagination background layout="prev, pager, next" :total="total"
:page-size="pagesize"
@current-change="current_change">
</el-pagination>
</div>
</div>
</div>
</div>
</el-main>
</el-container>
</el-container>
</div>
</div>
<script>
$(document).ready(function () {
$(".slimScrollDiv ul .main-nav-li a").eq(7).addClass("menu_active");
$(".main-nav .main-nav-li .submenu").eq(3).addClass("block");
$(".main-nav .main-nav-li .submenu").children().children().eq(7).addClass("menu_active2")
});
</script>
<script>
new Vue({
el: '#platformList',
created() {
this.init();
},
data: function () {
return {
cardLoading: true,
activeName: '1',
tableData: [],
total: 0,
pagesize: 10,
currentPage: 1,
}
},
methods: {
async init() {
var params = {
page: this.currentPage,
status: this.activeName,
}
this.tableData = []
res = await utils.requestPost({
data: params,
url: "admin/app/applist"
}, this)
if (res.code == 1) {
this.cardLoading= false
this.tableData = res.data
this.total = res.count
}
},
//切换分页
current_change: function (currentPage) {
this.currentPage = currentPage;
this.init()
},
edit(id) {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/app/administration_set');?>"+"?id="+id;
},
async install(id){
res = await utils.requestPost({
data: {"id":id},
url: "admin/upgrade/app-install"
},this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href ="<?= Yii::$app->urlManager->createUrl('admin/app/administration_app');?>";
},
});
}
},
async upgrade(id){
location.href ="<?= Yii::$app->urlManager->createUrl('admin/app/administration_upgrade');?>"+"?id="+id;
// res = await utils.requestPost({
// data: {"id":id},
// url: "admin/upgrade/app-upgrade"
// },this)
// if (res.code == 1) {
// this.$message({
// type: 'success',
// message: '操作成功!',
// duration: 1000,
// onClose: () => {
// location.href ="<?= Yii::$app->urlManager->createUrl('admin/app/administration_app');?>";
// },
// });
// }
},
//点击停用
async deactivation(id, status) {
//alert(status);return ;
if (status == '1') {
await utils.showConfirm({content: '此操作将启用该应用, 是否继续?'}, this)
}
if (status == '2') {
await utils.showConfirm({content: '此操作将停用该应用, 是否继续?'}, this)
}
if (status == '3') {
await utils.showConfirm({content: '此操作将删除该应用, 是否继续?'}, this)
}
var requstData = {
id,
status,
}
res = await utils.requestPost({
data: requstData,
url: "admin/app/delapp"
},this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
this.currentPage = 1;
this.init()
},
});
}
},
handleClick(tab, event) {
this.currentPage = 1;
this.init()
},
}
})
</script>
</body>
</html>