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

328 lines
13 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>
.imgbox {
width: 100px;
height: 100px;
}
.checkbox .el-checkbox {
border: 1px solid #F3F6FB;
position: relative;
width: 100px;
height: 100px;
}
.checklabel-zjtd {
left: 0px;
}
.checkbox .el-checkbox .el-checkbox__input {
position: absolute;
bottom: 5px;
left: 42px;
}
.channel-icon img {
width: 32px;
height: 32px;
}
.namelogo {
width: 54px;
height: 54px;
border-radius: 50%;
}
.hed-right .el-button {
height: 38px;
}
.hed-right .btn-jrpt {
width: 130px;
}
.hed-right .btn-ty {
width: 104px;
}
.mar_t3 {
margin-top: 3px;
}
</style>
<body>
<div class="head">
<div class="publicHeader"><?php echo $this->render('@app/views/admin/public/publicHeader.html');?></div>
</div>
<div class="left">
<div class="publicAside"><?php echo $this->render('@app/views/admin/public/publicAside.html');?></div>
</div>
<div class="upimg">
<div class="attachment hei"><?php echo $this->render('@app/views/admin/public/attachment-img.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="ba_f bor_rad5 pad_20 mar_b30">
<div class="flex-bet">
<div class="flex pad_tb_10 mar_l20">
<div class=""><img class="namelogo" :src="formInline.app_image"/></div>
<div class="flex-col mar_l20 t_l">
<div class="overflowlnr">{{formInline.app_name}}</div>
<div class="color_9 fon_12 mar_t10">版本:{{formInline.app_version}}</div>
</div>
</div>
<div class="mar_r20 hed-right">
<el-button class="btn-ty" @click="deactivation(id,2)">卸载</el-button>
</div>
</div>
</div> -->
<div class="ba_f">
<div class="main-tab ba_f bor_rad5 pad_tb_30">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="基本信息" name="base">基本信息</el-tab-pane>
<el-tab-pane label="升级日志" name="upgrade">升级日志</el-tab-pane>
</el-tabs>
</div>
<div class="main-con pad_tb_30">
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">应用名称</div>
<div class="flex-grow-1 t_l right-width">
<el-input v-model="formInline.app_name" placeholder="请输入应用名称"
class="elinput"></el-input>
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">应用版本</div>
<div class="flex-grow-1 t_l right-width">
<el-input v-model="formInline.app_version" disabled
class="elinput"></el-input>
</div>
</div>
<div class="flex-bet wid pad_tb_20">
<div class="flex-grow-0 t_r pad_r_25 right-left">应用封面</div>
<div class="flex-grow-1 t_l right-width">
<!-- <div class="imgbox bor_rad5 ba_f5">
<el-upload
class="avatar-uploader"
:action="upload_url"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</div> -->
<div class="uploadSource bor_de rel flex curs" v-if="imageUrl">
<label class="statusLabel curs" @mouseenter="enter(1)" @mouseleave="leave(1)">
<i class="el-icon-check" ref="imgicon1"></i>
<i class="el-icon-close" @click="deleteMultiImage(imageUrl,1)"></i>
</label>
<img :src="imageUrl" @click='test(1)' class="wid"/>
</div>
<div class="uploadSource flex-center curs" v-else @click='test(1)'>
<i class="el-icon-plus fon_40 color_d9"></i>
</div>
<attachment-img ref="img1" type="img" @attachment='imgadd1'></attachment-img>
</div>
</div>
</div>
</div>
<div class="ba_f mar_t20 pad_30 main-button">
<el-button type="primary" class="tijiao" @click="onSubmit()">保存</el-button>
</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() {
const id = utils.GetQueryString("id")
if (id) {
console.log(id)
this.id=id
this.getbyid(id)
}
},
data: function () {
return {
cardLoading: true,
activeName: 'base',
formInline: {
app_name: '',
app_image: '',
app_version: '',
},
id:'',
imageUrl: '',
upload_url: "",
}
},
methods: {
//编辑显示数据
async getbyid(id) {
let params = {
id: id
}
res = await utils.requestGet({data: params, url: "admin/app/getbyid"},this)
if (res.code == 1) {
this.cardLoading= false
// console.log(res.msg)
this.formInline = res.data
this.imageUrl = res.data.app_image
}
},
handleClick(tab, event) {
if (tab.name == 'base') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/app/administration_set');?>"+"?id="+this.id;
}
if (tab.name == 'upgrade') {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/app/administration_upgrade');?>"+"?id="+this.id;
}
},
enter(i=0){
this.$refs['imgicon' + i].style.display = 'none'
},
leave(i=0){
this.$refs['imgicon' + i].style.display = 'inline-block'
},
test(i = 0) {
// console.log(this.$refs, i)
this.$refs['img' + i].dialogVisible = true
},
imgadd1(url) {
this.imageUrl = url.str
},
imgadd2(url) {
this.imageUrl2 = url.str
},
deleteMultiImage(item, index, type) {
//typem没传是单图multigraph多图index上传图片组件排序
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
if (type == 'multigraph') {
} else {
switch (index) {
case 1:
this.imageUrl = '';
break
case 2:
this.imageUrl2 = '';
break
}
}
},
// handleAvatarSuccess(res, file) {
// this.imageUrl = URL.createObjectURL(file.raw);
// this.formInline.app_image = file.raw
// },
// beforeAvatarUpload(file) {
// const isJPG = file.type ===
// file.type === 'image/jpg' ||
// file.type === 'image/jpeg' ||
// file.type === 'image/png' ||
// file.type === 'image/gif'
// const isLt2M = file.size / 1024 / 1024 < 2;
// if (!isJPG) {
// this.$message.error('请上传图片文件!');
// }
// if (!isLt2M) {
// this.$message.error('上传头像图片大小不能超过 2MB!');
// }
// return isJPG && isLt2M;
// },
//点击停用
async deactivation(id, status) {
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: () => {
location.href = "<?= Yii::$app->urlManager->createUrl('admin/app/administration_app');?>";
},
});
}
},
//提交数据
async onSubmit() {
const formdata = new FormData()
formdata.append('app_name', this.formInline.app_name)
formdata.append('app_image', this.imageUrl)
formdata.append('app_version', this.formInline.app_version)
formdata.append('id', this.id)
res = await utils.requestPost({
data: formdata,
url: "admin/app/usave"
},this)
if (res.code == 1) {
this.$message({
type: 'success',
message: '操作成功!',
duration: 1000,
onClose: () => {
location.href ="<?= Yii::$app->urlManager->createUrl('admin/app/administration_app');?>";
},
});
}
},
}
})
</script>
</body>
</html>