parent
c8f3126a85
commit
23a215d980
@ -0,0 +1,17 @@ |
||||
import request from '@/utils/request' |
||||
|
||||
export function getAppInfos(query) { |
||||
return request({ |
||||
url: '/appinfo', |
||||
method: 'get', |
||||
params: query |
||||
}) |
||||
} |
||||
|
||||
export function updateAppInfo(data) { |
||||
return request({ |
||||
url: '/appinfo', |
||||
method: 'put', |
||||
data |
||||
}) |
||||
} |
@ -0,0 +1,305 @@ |
||||
<template> |
||||
<div class="app-container"> |
||||
<el-form ref="postForm" :model="postForm" label-width="100px" :disabled="!is_edit"> |
||||
<el-row> |
||||
<el-col :span="12"> |
||||
<el-form-item label="APP_ID"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input :value="postForm.app_id" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="Bundle_Id"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.bundle_id" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="应用名称"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.name" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="短连接" label-width="100px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.short" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="应用状态" label-width="100px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-select v-model="postForm.status" class="filter-item" placeholder="Please select"> |
||||
<el-option v-for="item in postForm.status_choices" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="应用类型"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-select v-model="postForm.type" class="filter-item" placeholder="Please select" disabled> |
||||
<el-option v-for="item in postForm.type_choices" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="创建时间" prop="timestamp"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="8"> |
||||
<el-date-picker :value="postForm.created_time" type="datetime" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="更新时间" prop="timestamp"> |
||||
<el-row :gutter="20"> |
||||
<el-col :span="8"> |
||||
<el-date-picker :value="postForm.updated_time" type="datetime" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="下载次数" prop="download_times"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="8"> |
||||
<el-input :value="postForm.count_hits" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="应用描述"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.description" :autosize="{ minRows: 4, maxRows: 6}" type="textarea" placeholder="Please input" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
|
||||
</el-col> |
||||
<el-col :span="12"> |
||||
<el-form-item label="应用图标" label-width="200px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-image v-if="postForm.master_release" :src="postForm.master_release.icon_url" :preview-src-list="[postForm.master_release.icon_url]" fit="contain" style="width: 100px; height: 100px" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="访问密码" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.password" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="应用所属用户ID" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.user_id" disabled /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
|
||||
<div v-if="postForm.type===1"> |
||||
<el-form-item label="是否开启超级签" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-tooltip :content="postForm.issupersign|statusFilter" placement="top"> |
||||
<el-switch |
||||
v-model="postForm.issupersign" |
||||
active-color="#13ce66" |
||||
inactive-color="#ff4949" |
||||
:active-value="true" |
||||
:inactive-value="false" |
||||
/> |
||||
</el-tooltip> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<div v-if="postForm.issupersign===true"> |
||||
<el-form-item label="超级签名签名类型" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-select v-model="postForm.supersign_type" class="filter-item" placeholder="Please select"> |
||||
<el-option v-for="item in postForm.supersign_type_choices" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="超级签名使用限额" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.supersign_limit_number" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="超级签名新Bundle_Id" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.new_bundle_id" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
</div> |
||||
</div> |
||||
<el-form-item label="应用专属访问域名" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-input v-model="postForm.domain_name" /> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="下载页对所有人可见" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-tooltip :content="postForm.isshow|statusFilter" placement="top"> |
||||
<el-switch |
||||
v-model="postForm.isshow" |
||||
active-color="#13ce66" |
||||
inactive-color="#ff4949" |
||||
:active-value="true" |
||||
:inactive-value="false" |
||||
/> |
||||
</el-tooltip> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="微信内简易访问模式" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-tooltip :content="postForm.wxeasytype|statusFilter" placement="top"> |
||||
<el-switch |
||||
v-model="postForm.wxeasytype" |
||||
active-color="#13ce66" |
||||
inactive-color="#ff4949" |
||||
:active-value="true" |
||||
:inactive-value="false" |
||||
/> |
||||
</el-tooltip> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
<el-form-item label="微信内第三方自动跳转" label-width="160px"> |
||||
<el-row :gutter="12"> |
||||
<el-col :span="16"> |
||||
<el-tooltip :content="postForm.wxredirect|userStatusFilter" placement="top"> |
||||
<el-switch |
||||
v-model="postForm.wxredirect" |
||||
active-color="#13ce66" |
||||
inactive-color="#ff4949" |
||||
:active-value="true" |
||||
:inactive-value="false" |
||||
/> |
||||
</el-tooltip> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form-item> |
||||
</el-col> |
||||
</el-row> |
||||
</el-form> |
||||
<el-col :span="9" style="float: right"> |
||||
<el-button v-if="!is_edit" type="primary" @click="is_edit=true">修改</el-button> |
||||
<div v-else> |
||||
<el-button type="primary" @click="is_edit=false">取消</el-button> |
||||
<el-button type="primary" @click="updateData">保存修改</el-button> |
||||
</div> |
||||
</el-col> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getAppInfos, updateAppInfo } from '@/api/app' |
||||
|
||||
const defaultForm = { |
||||
email: undefined, |
||||
job: undefined, |
||||
qq: undefined, |
||||
id: undefined, |
||||
company: undefined, |
||||
gender: undefined, |
||||
username: undefined, |
||||
first_name: undefined, |
||||
role: undefined, |
||||
history_release_limit: undefined, |
||||
domain_name: undefined, |
||||
download_times: undefined, |
||||
is_active: undefined, |
||||
head_img: '', |
||||
memo: undefined, |
||||
date_joined: undefined, |
||||
storage_active: undefined, |
||||
supersign_active: undefined, |
||||
role_choices: [], |
||||
gender_choices: [], |
||||
storage_choices: [] |
||||
} |
||||
|
||||
export default { |
||||
name: 'AppDetail', |
||||
components: { }, filters: { |
||||
userStatusFilter(status) { |
||||
const statusMap = { |
||||
true: '激活,允许登录', |
||||
false: '禁用,禁止登录' |
||||
} |
||||
return statusMap[status] |
||||
}, |
||||
statusFilter(status) { |
||||
const statusMap = { |
||||
true: '启用,允许配置', |
||||
false: '禁用,禁止配置' |
||||
} |
||||
return statusMap[status] |
||||
} |
||||
}, |
||||
props: { |
||||
isEdit: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
postForm: Object.assign({}, defaultForm), |
||||
loading: false, |
||||
is_edit: false |
||||
} |
||||
}, |
||||
computed: { |
||||
}, |
||||
created() { |
||||
if (this.isEdit) { |
||||
const id = this.$route.params && this.$route.params.id |
||||
this.fetchData(id) |
||||
} |
||||
}, |
||||
methods: { |
||||
fetchData(id) { |
||||
getAppInfos({ id: id }).then(response => { |
||||
if (response.data.length === 1) { |
||||
this.postForm = response.data[0] |
||||
} |
||||
}).catch(err => { |
||||
console.log(err) |
||||
}) |
||||
}, |
||||
updateData() { |
||||
updateAppInfo(this.postForm).then(response => { |
||||
this.$message.success('更新成功') |
||||
this.postForm = response.data |
||||
}).catch(err => { |
||||
console.log(err) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.el-form-item__label { |
||||
width: 200px; |
||||
} |
||||
</style> |
||||
|
@ -0,0 +1,41 @@ |
||||
<template> |
||||
<el-dropdown :show-timeout="100" trigger="click"> |
||||
<el-button plain> |
||||
{{ !comment_disabled?'Comment: opened':'Comment: closed' }} |
||||
<i class="el-icon-caret-bottom el-icon--right" /> |
||||
</el-button> |
||||
<el-dropdown-menu slot="dropdown" class="no-padding"> |
||||
<el-dropdown-item> |
||||
<el-radio-group v-model="comment_disabled" style="padding: 10px;"> |
||||
<el-radio :label="true"> |
||||
Close comment |
||||
</el-radio> |
||||
<el-radio :label="false"> |
||||
Open comment |
||||
</el-radio> |
||||
</el-radio-group> |
||||
</el-dropdown-item> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: { |
||||
value: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
computed: { |
||||
comment_disabled: { |
||||
get() { |
||||
return this.value |
||||
}, |
||||
set(val) { |
||||
this.$emit('input', val) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,46 @@ |
||||
<template> |
||||
<el-dropdown :hide-on-click="false" :show-timeout="100" trigger="click"> |
||||
<el-button plain> |
||||
Platfroms({{ platforms.length }}) |
||||
<i class="el-icon-caret-bottom el-icon--right" /> |
||||
</el-button> |
||||
<el-dropdown-menu slot="dropdown" class="no-border"> |
||||
<el-checkbox-group v-model="platforms" style="padding: 5px 15px;"> |
||||
<el-checkbox v-for="item in platformsOptions" :key="item.key" :label="item.key"> |
||||
{{ item.name }} |
||||
</el-checkbox> |
||||
</el-checkbox-group> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: { |
||||
value: { |
||||
required: true, |
||||
default: () => [], |
||||
type: Array |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
platformsOptions: [ |
||||
{ key: 'a-platform', name: 'a-platform' }, |
||||
{ key: 'b-platform', name: 'b-platform' }, |
||||
{ key: 'c-platform', name: 'c-platform' } |
||||
] |
||||
} |
||||
}, |
||||
computed: { |
||||
platforms: { |
||||
get() { |
||||
return this.value |
||||
}, |
||||
set(val) { |
||||
this.$emit('input', val) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,38 @@ |
||||
v<template> |
||||
<el-dropdown :show-timeout="100" trigger="click"> |
||||
<el-button plain> |
||||
Link |
||||
<i class="el-icon-caret-bottom el-icon--right" /> |
||||
</el-button> |
||||
<el-dropdown-menu slot="dropdown" class="no-padding no-border" style="width:400px"> |
||||
<el-form-item label-width="0px" style="margin-bottom: 0px" prop="source_uri"> |
||||
<el-input v-model="source_uri" placeholder="Please enter the content"> |
||||
<template slot="prepend"> |
||||
URL |
||||
</template> |
||||
</el-input> |
||||
</el-form-item> |
||||
</el-dropdown-menu> |
||||
</el-dropdown> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: { |
||||
value: { |
||||
type: String, |
||||
default: '' |
||||
} |
||||
}, |
||||
computed: { |
||||
source_uri: { |
||||
get() { |
||||
return this.value |
||||
}, |
||||
set(val) { |
||||
this.$emit('input', val) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,3 @@ |
||||
export { default as CommentDropdown } from './Comment' |
||||
export { default as PlatformDropdown } from './Platform' |
||||
export { default as SourceUrlDropdown } from './SourceUrl' |
@ -0,0 +1,12 @@ |
||||
<template> |
||||
<app-detail :is-edit="true" /> |
||||
</template> |
||||
|
||||
<script> |
||||
import AppDetail from './AppDetail' |
||||
|
||||
export default { |
||||
name: 'EditForm', |
||||
components: { AppDetail } |
||||
} |
||||
</script> |
@ -0,0 +1,201 @@ |
||||
<template> |
||||
<div class="app-container"> |
||||
<div class="filter-container"> |
||||
<el-input v-model="listQuery.bundle_id" placeholder="Bundle_Id" style="width: 250px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> |
||||
<el-input v-model="listQuery.name" placeholder="应用名称" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> |
||||
<el-input v-model="listQuery.short" placeholder="短连接" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> |
||||
<el-input v-model="listQuery.domain_name" placeholder="应用专属访问域名" style="width: 200px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> |
||||
<el-select v-if="type_choices" v-model="listQuery.type" placeholder="应用类型" clearable class="filter-item" style="width: 120px" @change="handleFilter"> |
||||
<el-option v-for="item in type_choices" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
||||
<el-select v-if="status_choices" v-model="listQuery.status" placeholder="应用状态" clearable class="filter-item" style="width: 120px" @change="handleFilter"> |
||||
<el-option v-for="item in status_choices" :key="item.id" :label="item.name" :value="item.id" /> |
||||
</el-select> |
||||
<el-input v-model="listQuery.user_id" placeholder="用户ID" style="width: 140px;" class="filter-item" clearable @keyup.enter.native="handleFilter" /> |
||||
<el-select v-model="listQuery.sort" style="width: 140px" class="filter-item" @change="handleFilter"> |
||||
<el-option v-for="item in sortOptions" :key="item.key" :label="item.label" :value="item.key" /> |
||||
</el-select> |
||||
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter"> |
||||
Search |
||||
</el-button> |
||||
</div> |
||||
<el-table |
||||
v-loading="listLoading" |
||||
:data="list" |
||||
element-loading-text="Loading" |
||||
border |
||||
fit |
||||
highlight-current-row |
||||
stripe |
||||
> |
||||
<el-table-column align="center" label="ID" width="90"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.id }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="图标" align="center" width="130"> |
||||
<template slot-scope="scope"> |
||||
<el-image :src="scope.row.master_release.icon_url" :preview-src-list="[scope.row.master_release.icon_url]" fit="contain" style="width: 80px; height: 80px" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="应用名称"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.name }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="Bundle_Id" align="center"> |
||||
<template slot-scope="scope"> |
||||
<span>{{ scope.row.bundle_id }}</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="关联应用" align="center" width="130"> |
||||
<template slot-scope="scope"> |
||||
<el-image v-if="scope.row.has_combo" :src="scope.row.has_combo.master_release.icon_url" :preview-src-list="[scope.row.has_combo.master_release.icon_url]" fit="contain" style="width: 80px; height: 80px" /> |
||||
<el-link v-else>无关联应用</el-link> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="应用专属访问域名" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.domain_name }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="用户ID" width="100" align="center"> |
||||
<template slot-scope="scope"> |
||||
<router-link :to="{name: 'user_info_edit',params:{id:scope.row.user_id}}"> |
||||
<el-link type="primary"> {{ scope.row.user_id }}</el-link> |
||||
</router-link> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="短连接" width="80" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.short }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="下载次数" width="100" align="center"> |
||||
<template slot-scope="scope"> |
||||
{{ scope.row.count_hits }} |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column class-name="status-col" label="应用状态" width="80" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-tag :type="scope.row.status | appStatusFilter">{{ scope.row |appStatusNameFilter }}</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column class-name="status-col" label="下载页显示" width="100" align="center"> |
||||
<template slot-scope="scope"> |
||||
<el-tag :type="scope.row.isshow | statusFilter">{{ scope.row.isshow }}</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
|
||||
<el-table-column align="center" prop="created_at" label="更新时间" width="120"> |
||||
<template slot-scope="scope"> |
||||
<i class="el-icon-time" /> |
||||
<el-tooltip :content="scope.row.updated_time"> |
||||
<span>{{ scope.row.updated_time|formatTime }}</span> |
||||
</el-tooltip> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width"> |
||||
<template slot-scope="scope"> |
||||
<router-link :to="{name: 'app_info_edit',params:{id:scope.row.id}}"> |
||||
<el-button type="primary" size="mini" icon="el-icon-edit"> |
||||
编辑 |
||||
</el-button> |
||||
</router-link> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="fetchData" /> |
||||
|
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
import { getAppInfos } from '@/api/app' |
||||
import Pagination from '@/components/Pagination' // secondary package based on el-pagination |
||||
import waves from '@/directive/waves' // waves directive |
||||
|
||||
const sortOptions = [ |
||||
{ label: '更新时间 Ascending', key: 'updated_time' }, |
||||
{ label: '更新时间 Descending', key: '-updated_time' }, |
||||
{ label: '创建时间 Ascending', key: 'created_time' }, |
||||
{ label: '创建时间 Descending', key: '-created_time' }, |
||||
{ label: '下载次数 Ascending', key: 'count_hits' }, |
||||
{ label: '下载次数 Descending', key: '-count_hits' } |
||||
] |
||||
|
||||
export default { |
||||
name: 'AppInfo', |
||||
components: { Pagination }, |
||||
directives: { waves }, |
||||
filters: { |
||||
formatTime(time) { |
||||
return time.split('T')[0] |
||||
}, |
||||
statusFilter(status) { |
||||
const statusMap = { |
||||
true: 'success', |
||||
false: 'danger' |
||||
} |
||||
return statusMap[status] |
||||
}, |
||||
appStatusNameFilter(row) { |
||||
for (const r of row.status_choices) { |
||||
if (r.id === row.status) { |
||||
return r.name |
||||
} |
||||
} |
||||
}, |
||||
appStatusFilter(status) { |
||||
const statusMap = { |
||||
'0': 'danger', |
||||
'1': 'success', |
||||
'2': 'gray' |
||||
} |
||||
return statusMap[status] |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
list: null, |
||||
listLoading: true, |
||||
total: 0, |
||||
listQuery: { |
||||
page: 1, |
||||
limit: 10, |
||||
name: undefined, |
||||
bundle_id: undefined, |
||||
sort: '-count_hits', |
||||
type: undefined, |
||||
domain_name: undefined, |
||||
user_id: undefined |
||||
}, |
||||
sortOptions, |
||||
type_choices: [], |
||||
status_choices: [] |
||||
} |
||||
}, |
||||
created() { |
||||
this.fetchData() |
||||
}, |
||||
methods: { |
||||
handleFilter() { |
||||
this.listQuery.page = 1 |
||||
this.fetchData() |
||||
}, |
||||
fetchData() { |
||||
this.listLoading = true |
||||
getAppInfos(this.listQuery).then(response => { |
||||
this.list = response.data |
||||
if (this.list && this.list.length > 0) { |
||||
this.type_choices = this.list[0].type_choices |
||||
this.status_choices = this.list[0].status_choices |
||||
} |
||||
this.total = response.total |
||||
this.listLoading = false |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,117 @@ |
||||
#!/usr/bin/env python |
||||
# -*- coding:utf-8 -*- |
||||
# project: 4月 |
||||
# author: liuyu |
||||
# date: 2021/4/11 |
||||
|
||||
from django.contrib import auth |
||||
from api.models import Token, AppReleaseInfo, Apps |
||||
from rest_framework.response import Response |
||||
from api.utils.auth import AdminTokenAuthentication |
||||
from api.utils.serializer import AdminAppsSerializer, AdminAppReleaseSerializer |
||||
from django.core.cache import cache |
||||
from rest_framework.views import APIView |
||||
import binascii |
||||
import os, datetime |
||||
from api.utils.utils import get_captcha, valid_captcha, get_choices_dict |
||||
from api.utils.response import BaseResponse |
||||
from fir_ser.settings import CACHE_KEY_TEMPLATE, LOGIN |
||||
from api.utils.storage.caches import login_auth_failed, del_cache_response_by_short |
||||
import logging |
||||
from api.utils.throttle import VisitRegister1Throttle, VisitRegister2Throttle |
||||
from rest_framework.pagination import PageNumberPagination |
||||
|
||||
logger = logging.getLogger(__name__) |
||||
|
||||
|
||||
class AppsPageNumber(PageNumberPagination): |
||||
page_size = 20 # 每页显示多少条 |
||||
page_size_query_param = 'limit' # URL中每页显示条数的参数 |
||||
page_query_param = 'page' # URL中页码的参数 |
||||
max_page_size = None # 最大页码数限制 |
||||
|
||||
|
||||
class AppInfoView(APIView): |
||||
authentication_classes = [AdminTokenAuthentication, ] |
||||
|
||||
def get(self, request): |
||||
res = BaseResponse() |
||||
filter_data = {} |
||||
filter_fields = ["id", "type", "name", "short", "bundle_id", "domain_name", "user_id", "status"] |
||||
for filed in filter_fields: |
||||
f_value = request.query_params.get(filed, None) |
||||
if f_value: |
||||
filter_data[filed] = f_value |
||||
sort = request.query_params.get("sort", "-updated_time") |
||||
page_obj = AppsPageNumber() |
||||
obj_list = Apps.objects.filter(**filter_data).order_by(sort) |
||||
page_serializer = page_obj.paginate_queryset(queryset=obj_list, request=request, |
||||
view=self) |
||||
serializer_obj = AdminAppsSerializer(page_serializer, many=True) |
||||
res.data = serializer_obj.data |
||||
res.total = obj_list.count() |
||||
return Response(res.dict) |
||||
|
||||
def put(self, request): |
||||
res = BaseResponse() |
||||
data = request.data |
||||
id = data.get("id", None) |
||||
if not id: |
||||
res.code = 1003 |
||||
res.msg = "参数错误" |
||||
return Response(res.dict) |
||||
app_obj = Apps.objects.filter(id=id).first() |
||||
if app_obj: |
||||
data['pk'] = id |
||||
serializer_obj = AdminAppsSerializer(app_obj, data=data, partial=True) |
||||
if serializer_obj.is_valid(): |
||||
serializer_obj.save() |
||||
res.data = serializer_obj.data |
||||
del_cache_response_by_short(app_obj.app_id) |
||||
return Response(res.dict) |
||||
res.code = 1004 |
||||
res.msg = "数据校验失败" |
||||
return Response(res.dict) |
||||
|
||||
|
||||
class AppReleaseInfoView(APIView): |
||||
authentication_classes = [AdminTokenAuthentication, ] |
||||
|
||||
def get(self, request): |
||||
res = BaseResponse() |
||||
filter_data = {} |
||||
filter_fields = ["id", "release_id"] |
||||
for filed in filter_fields: |
||||
f_value = request.query_params.get(filed, None) |
||||
if f_value: |
||||
filter_data[filed] = f_value |
||||
sort = request.query_params.get("sort", "-created_time") |
||||
page_obj = AppsPageNumber() |
||||
obj_list = AppReleaseInfo.objects.filter(**filter_data).order_by(sort) |
||||
page_serializer = page_obj.paginate_queryset(queryset=obj_list, request=request, |
||||
view=self) |
||||
serializer_obj = AdminAppReleaseSerializer(page_serializer, many=True) |
||||
res.data = serializer_obj.data |
||||
res.total = obj_list.count() |
||||
return Response(res.dict) |
||||
|
||||
def put(self, request): |
||||
res = BaseResponse() |
||||
data = request.data |
||||
id = data.get("id", None) |
||||
if not id: |
||||
res.code = 1003 |
||||
res.msg = "参数错误" |
||||
return Response(res.dict) |
||||
app_obj = Apps.objects.filter(id=id).first() |
||||
if app_obj: |
||||
data['pk'] = id |
||||
serializer_obj = AdminAppReleaseSerializer(app_obj, data=data, partial=True) |
||||
if serializer_obj.is_valid(): |
||||
serializer_obj.save() |
||||
res.data = serializer_obj.data |
||||
del_cache_response_by_short(app_obj.app_id) |
||||
return Response(res.dict) |
||||
res.code = 1004 |
||||
res.msg = "数据校验失败" |
||||
return Response(res.dict) |
@ -0,0 +1,38 @@ |
||||
# Generated by Django 3.0.3 on 2021-04-12 15:59 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('api', '0036_auto_20210409_1512'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AddField( |
||||
model_name='apps', |
||||
name='status', |
||||
field=models.SmallIntegerField(choices=[(0, '正常'), (1, '封禁'), (2, '违规')], default=0, verbose_name='应用状态'), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='isshow', |
||||
field=models.BooleanField(default=True, verbose_name='下载页可见'), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='issupersign', |
||||
field=models.BooleanField(default=False, verbose_name='是否超级签名包'), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='wxeasytype', |
||||
field=models.BooleanField(default=True, verbose_name='微信内简易模式,避免微信封停'), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='wxredirect', |
||||
field=models.BooleanField(default=True, verbose_name='微信内第三方链接自动跳转'), |
||||
), |
||||
] |
@ -0,0 +1,18 @@ |
||||
# Generated by Django 3.0.3 on 2021-04-12 16:01 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('api', '0037_auto_20210412_1559'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='status', |
||||
field=models.SmallIntegerField(choices=[(0, '封禁'), (1, '正常'), (2, '违规')], default=1, verbose_name='应用状态'), |
||||
), |
||||
] |
@ -0,0 +1,18 @@ |
||||
# Generated by Django 3.0.3 on 2021-04-12 17:59 |
||||
|
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('api', '0038_auto_20210412_1601'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.AlterField( |
||||
model_name='apps', |
||||
name='password', |
||||
field=models.CharField(blank=True, help_text='默认 没有密码', max_length=32, verbose_name='访问密码'), |
||||
), |
||||
] |
Loading…
Reference in new issue