app管理

This commit is contained in:
jia 2023-09-27 18:27:14 +08:00
commit 346fe5ab91

View File

@ -0,0 +1,369 @@
<template>
<div class="divBox">
<div slot="header" class="clearfix">
<el-button size="small" type="primary" class="mb20" @click="onAdd">添加app版本</el-button>
</div>
<el-card class="box-card">
<el-table v-loading="listLoading" :data="tableData.data" style="width: 100%" size="small">
<el-table-column label="ID" prop="id" min-width="100" />
<el-table-column label="标题" min-width="100">
<template slot-scope="scope">
<span>{{scope.row.title.length>10?scope.row.title.slice(0,9) :scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column label="版本号" prop="version" min-width="100" />
<el-table-column label="下载地址" prop="dow_url" min-width="200" />
<el-table-column label="分类" min-width="100">
<template slot-scope="scope">
<span>{{scope.row.type==1?'Android':"IOS" }}</span>
</template>
</el-table-column>
<el-table-column prop="create_time" label="创建时间" min-width="100" />
<el-table-column label="操作" min-width="100" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="onSet(scope.row)">编辑</el-button>
<el-button type="text" size="small" @click="onDetail(scope.row.id)">详情</el-button>
<el-button type="text" size="small" @click="onDelete(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination :page-sizes="[20, 40, 60, 80]" :page-size="tableFrom.limit" :current-page="tableFrom.page" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" @size-change="handleSizeChange" @current-change="pageChange" />
</div>
</el-card>
<!--审核-->
<el-dialog v-if="dialogVisible" :before-close="handleClose" :title="isExamine ? '新增' : '编辑'" :visible.sync="dialogVisible" width="700px">
<div v-loading="loading">
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm">
<el-form-item label="版本标题:" prop="title">
<el-input v-model="ruleForm.title" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="版本内容:" prop="content">
<el-input v-model="ruleForm.content" placeholder="请输入内容" />
</el-form-item>
<!-- <el-form-item label="上传版本:">
<el-upload ref="upload" :action="fileUrl" :on-success="handleSuccess" :headers="myHeaders" :show-file-list="false" multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">
只能上传apk文件.
</div>
</el-upload>
</el-form-item> -->
<el-form-item label="类型:" prop="type">
<el-radio-group v-model="ruleForm.type">
<el-radio :label="2">IOS</el-radio>
<el-radio :label="1">Android</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机品牌" >
<el-input v-model="ruleForm.phone_brand" @input="change($event)" placeholder="请输入手机品牌" />
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="ruleForm.version" placeholder="版本号" />
</el-form-item>
<el-form-item label="下载地址">
<el-input v-model="ruleForm.dow_url" placeholder="下载地址" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit(formData)">提交</el-button>
</el-form-item>
</el-form>
</div>
</el-dialog>
<el-dialog v-if="dialogVisible1" :before-close="handleClose1" title="详情" :visible.sync="dialogVisible1" width="700px">
<el-form ref="ruleForm1" :model="ruleForm1" label-width="120px" class="demo-ruleForm">
<el-form-item label="标题:">
{{ruleForm1.title}}
</el-form-item>
<el-form-item label="上传内容:">
{{ruleForm1.content}}
</el-form-item>
<el-form-item label="类型:">
<el-radio-group v-model="ruleForm1.type">
<!-- <el-radio :label="3">WGT</el-radio> -->
<el-radio :label="2">IOS</el-radio>
<el-radio :label="1">Android</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="手机平台">
{{ruleForm1.phone_brand}}
</el-form-item>
<el-form-item label="下载地址">
{{ruleForm1.dow_url}}
</el-form-item>
<el-form-item>
<el-button type="primary" @click="dialogVisible1=false">确定</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEBCRMEB
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { appEdit, appDetail, appDelete, appLst, appCreate } from '@/api/app'
import log from '@/libs/util.log';
import SettingMer from "@/libs/settingMer";
import { getToken } from "@/utils/auth";
export default {
name: 'communityTopic',
data() {
return {
moren: require("@/assets/images/f.png"),
colors: ['#99A9BF', '#F7BA2A', '#FF9900'],
listLoading: true,
tableData: {
data: [],
total: 0
},
tableFrom: {
page: 1,
limit: 20,
},
fileList: [],
headers: {},
dialogVisible1: false,
dialogVisible: false,
loading: false,
formData: {},
rules: {
type: [
{ required: true, message: '请选择审核状态', trigger: 'change' }
],
title: [
{ required: true, message: '请填写标题', trigger: 'blur' }
],
content: [
{ required: true, message: '请填写版本内容', trigger: 'blur' }
],
phone_brand: [
{ required: true, message: '请填写手机平台', trigger: 'blur' }
],
version: [
{ required: true, message: '请填写版本号', trigger: 'blur' }
]
},
myHeaders: {
"X-Token": getToken(),
},
ruleForm: {
title: '',
type: 1,
title: '',
phone_brand: '',
version: '',
dow_url: ''
},
ruleForm1: {
},
id:0
}
},
computed: {
fileUrl() {
return (
SettingMer.https +
`/upload/app`
);
}
},
mounted() {
this.getList()
},
methods: {
//
handleSuccess(response) {
if (response.status === 200) {
this.$message.success("上传成功");
console.log(response)
this.ruleForm.dow_url = response.data.src
} else {
this.$message.error(response.message);
}
},
change(e) {
this.$forceUpdate(); //
},
//
getList(num) {
this.listLoading = true
this.tableFrom.page = num ? num : this.tableFrom.page
appLst(this.tableFrom).then(res => {
this.tableData.data = res.data.list
this.tableData.total = res.data.count
this.listLoading = false
}).catch(res => {
this.listLoading = false
this.$message.error(res.message)
})
},
pageChange(page) {
this.tableFrom.page = page
this.getList('')
},
handleSizeChange(val) {
this.tableFrom.limit = val
this.getList('')
},
onAdd() {
this.isExamine = true
this.ruleForm = {}
this.dialogVisible = true
},
onSet(row) {
this.isExamine = false
this.dialogVisible = true
this.ruleForm = row
this.id=row.id
},
onSubmit(item) {
if (this.isExamine) {
appCreate(this.ruleForm).then((res) => {
this.$message.success(res.message)
this.dialogVisible = false
this.formData = res.data
this.getList()
this.$forceUpdate()
}).catch(({ message }) => {
this.dialogVisible = false
this.$message.error(message)
})
} else {
appEdit(this.id, this.ruleForm).then((res) => {
this.$message.success(res.message)
this.dialogVisible = false
this.getList()
this.ruleForm.refusal = ''
this.formData = res.data
}).catch(({ message }) => {
this.dialogVisible = false
this.$message.error(message)
})
}
},
//
handleClose() {
this.dialogVisible = false
this.ruleForm = {
title: '',
type: 1,
title: '',
phone_brand: '',
version: '',
dow_url: ''
}
},
handleClose1() {
this.dialogVisible1 = false
this.ruleForm1 = {}
},
//
onDelete(id) {
appDelete(id).then((res) => {
this.$message.success(res.message)
this.getList()
}).catch(({ message }) => {
this.$message.error(message)
})
},
//
onDetail(id) {
this.dialogVisible1 = true;
appDetail(id).then((res) => {
this.ruleForm1 = res.data
}).catch(({ message }) => {
this.$message.error(message)
})
},
}
}
</script>
<style scoped lang="scss">
.box-container {
overflow: hidden;
}
.box-container .list {
float: left;
line-height: 40px;
}
.box-container .sp {
width: 50%;
}
.box-container .sp3 {
width: 33.3333%;
}
.box-container .sp100 {
width: 100%;
}
.box-container .list .name {
display: inline-block;
width: 150px;
text-align: right;
color: #606266;
}
.box-container .list.image {
margin-bottom: 40px;
}
.box-container .list.image img {
position: relative;
top: 40px;
}
/deep/.el-form-item__content .el-rate {
position: relative;
top: 8px;
}
</style>