|
@@ -231,6 +231,15 @@
|
|
|
/>
|
|
/>
|
|
|
<div class="panel-toolbar">
|
|
<div class="panel-toolbar">
|
|
|
<span class="panel-count">共 {{ filteredList.length }} 个小程序</span>
|
|
<span class="panel-count">共 {{ filteredList.length }} 个小程序</span>
|
|
|
|
|
+ <div class="panel-actions">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ plain
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ @click="handleAdd"
|
|
|
|
|
+ >添加小程序</el-button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="filteredList.length" class="table-wrap">
|
|
<div v-if="filteredList.length" class="table-wrap">
|
|
|
<el-table
|
|
<el-table
|
|
@@ -242,6 +251,11 @@
|
|
|
>
|
|
>
|
|
|
<el-table-column label="名称" prop="name" min-width="72" show-overflow-tooltip />
|
|
<el-table-column label="名称" prop="name" min-width="72" show-overflow-tooltip />
|
|
|
<el-table-column label="AppID" prop="appid" min-width="100" show-overflow-tooltip />
|
|
<el-table-column label="AppID" prop="appid" min-width="100" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="校验文件" prop="verifyFileName" min-width="88" show-overflow-tooltip>
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ scope.row.verifyFileName || '-' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="状态" align="center" width="72">
|
|
<el-table-column label="状态" align="center" width="72">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-tag
|
|
<el-tag
|
|
@@ -253,16 +267,25 @@
|
|
|
</el-tag>
|
|
</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="修改状态" align="center" width="72">
|
|
|
|
|
|
|
+ <el-table-column label="操作" align="center" width="96" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="canModify"
|
|
v-if="canModify"
|
|
|
type="text"
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
icon="el-icon-edit"
|
|
|
class="row-action-btn"
|
|
class="row-action-btn"
|
|
|
|
|
+ title="修改状态"
|
|
|
@click="handleUpdate(scope.row)"
|
|
@click="handleUpdate(scope.row)"
|
|
|
/>
|
|
/>
|
|
|
- <span v-else class="no-permission-text">-</span>
|
|
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="canModify"
|
|
|
|
|
+ type="text"
|
|
|
|
|
+ icon="el-icon-upload2"
|
|
|
|
|
+ class="row-action-btn"
|
|
|
|
|
+ title="上传校验文件"
|
|
|
|
|
+ @click="handleUploadVerify(scope.row)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <span v-if="!canModify" class="no-permission-text">-</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -314,6 +337,65 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
+ <!-- 添加小程序(仅写 fs_course_play_source_config,company_id/company_user_id 由后端自动填充) -->
|
|
|
|
|
+ <el-dialog title="添加小程序" :visible.sync="addOpen" width="560px" append-to-body @close="cancelAdd">
|
|
|
|
|
+ <el-form ref="addForm" :model="addForm" :rules="addRules" label-width="110px" size="small">
|
|
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
|
|
+ <el-input v-model="addForm.name" placeholder="请输入小程序名称" maxlength="64" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="类型">
|
|
|
|
|
+ <el-input value="小程序" disabled />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="原始ID" prop="originalId">
|
|
|
|
|
+ <el-input v-model="addForm.originalId" placeholder="请输入原始ID(gh_xxx)" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="AppID" prop="appid">
|
|
|
|
|
+ <el-input v-model="addForm.appid" placeholder="请输入 AppID" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="Secret" prop="secret">
|
|
|
|
|
+ <el-input v-model="addForm.secret" placeholder="请输入 Secret" show-password />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="图标" prop="img">
|
|
|
|
|
+ <image-upload v-model="addForm.img" :file-type='["png", "jpg", "jpeg"]' :limit="1" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" :loading="addSaving" @click="submitAdd">确 定</el-button>
|
|
|
|
|
+ <el-button @click="cancelAdd">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 上传小程序域名校验文件 -->
|
|
|
|
|
+ <el-dialog title="上传校验文件" :visible.sync="verifyOpen" width="480px" append-to-body @close="cancelVerifyUpload">
|
|
|
|
|
+ <el-form label-width="90px" size="small">
|
|
|
|
|
+ <el-form-item label="小程序">
|
|
|
|
|
+ <span>{{ verifyRow && verifyRow.name ? verifyRow.name : '-' }}</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="当前文件">
|
|
|
|
|
+ <span>{{ verifyRow && verifyRow.verifyFileName ? verifyRow.verifyFileName : '未上传' }}</span>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="校验文件" required>
|
|
|
|
|
+ <el-upload
|
|
|
|
|
+ ref="verifyUpload"
|
|
|
|
|
+ action=""
|
|
|
|
|
+ :auto-upload="false"
|
|
|
|
|
+ :limit="1"
|
|
|
|
|
+ :file-list="verifyFileList"
|
|
|
|
|
+ :on-change="onVerifyFileChange"
|
|
|
|
|
+ :on-remove="onVerifyFileRemove"
|
|
|
|
|
+ :on-exceed="() => msgWarning('仅支持上传 1 个文件')"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-button size="mini" type="primary" plain>选择文件</el-button>
|
|
|
|
|
+ <div slot="tip" class="el-upload__tip">将按原文件名保存到校验服务器,请使用微信下发的校验文件名</div>
|
|
|
|
|
+ </el-upload>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" :loading="verifySaving" @click="submitVerifyUpload">确 定</el-button>
|
|
|
|
|
+ <el-button @click="cancelVerifyUpload">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
<!-- 修改企微小程序 -->
|
|
<!-- 修改企微小程序 -->
|
|
|
<el-dialog title="修改企微小程序" :visible.sync="qwOpen" width="600px" append-to-body>
|
|
<el-dialog title="修改企微小程序" :visible.sync="qwOpen" width="600px" append-to-body>
|
|
|
<el-form ref="qwForm" :model="qwForm" label-width="120px">
|
|
<el-form ref="qwForm" :model="qwForm" label-width="120px">
|
|
@@ -401,7 +483,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { list, get, update, listAll } from '@/api/course/coursePlaySourceConfig'
|
|
|
|
|
|
|
+import { list, get, update, listAll, add, uploadVerifyFile } from '@/api/course/coursePlaySourceConfig'
|
|
|
import { getCompanyMiniAppList, updateMiniAppMasterServer } from '@/api/company/companyConfig'
|
|
import { getCompanyMiniAppList, updateMiniAppMasterServer } from '@/api/company/companyConfig'
|
|
|
import { listQwCompany, getQwCompany, updateQwCompany, batchUpdateMiniAppId } from '@/api/qw/qwCompany'
|
|
import { listQwCompany, getQwCompany, updateQwCompany, batchUpdateMiniAppId } from '@/api/qw/qwCompany'
|
|
|
import { getCompanyList } from '@/api/company/company'
|
|
import { getCompanyList } from '@/api/company/company'
|
|
@@ -465,7 +547,26 @@ export default {
|
|
|
status: [
|
|
status: [
|
|
|
{ required: true, message: '状态不能为空', trigger: 'change' }
|
|
{ required: true, message: '状态不能为空', trigger: 'change' }
|
|
|
]
|
|
]
|
|
|
- }
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ addOpen: false,
|
|
|
|
|
+ addSaving: false,
|
|
|
|
|
+ addForm: {},
|
|
|
|
|
+ // 销售公司添加小程序时固定默认值(前端不展示填写)
|
|
|
|
|
+ addDefaultToken: 'cbnd7lJvkripVOpyTFAna6NAWCxCrvC',
|
|
|
|
|
+ addDefaultAesKey: 'HlEiBB55eaWUaeBVAQO3cWKWPYv1vOVQSq7nFNICw4E',
|
|
|
|
|
+ addDefaultMsgDataFormat: 'JSON',
|
|
|
|
|
+ addRules: {
|
|
|
|
|
+ name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
|
|
|
|
+ originalId: [{ required: true, message: '原始ID不能为空', trigger: 'blur' }],
|
|
|
|
|
+ appid: [{ required: true, message: 'AppID不能为空', trigger: 'blur' }],
|
|
|
|
|
+ secret: [{ required: true, message: 'Secret不能为空', trigger: 'blur' }],
|
|
|
|
|
+ img: [{ required: true, message: '图标不能为空', trigger: 'change' }]
|
|
|
|
|
+ },
|
|
|
|
|
+ verifyOpen: false,
|
|
|
|
|
+ verifySaving: false,
|
|
|
|
|
+ verifyRow: null,
|
|
|
|
|
+ verifyFileList: [],
|
|
|
|
|
+ verifyRawFile: null
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -536,6 +637,134 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
resetForm,
|
|
resetForm,
|
|
|
|
|
+ /** 是否封禁状态(status=2) */
|
|
|
|
|
+ isBannedStatus(status) {
|
|
|
|
|
+ return status === 2 || status === '2'
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 过滤掉封禁小程序 */
|
|
|
|
|
+ excludeBannedMiniApps(list) {
|
|
|
|
|
+ if (!list || !list.length) {
|
|
|
|
|
+ return []
|
|
|
|
|
+ }
|
|
|
|
|
+ return list.filter(item => !this.isBannedStatus(item.status))
|
|
|
|
|
+ },
|
|
|
|
|
+ resetAddForm() {
|
|
|
|
|
+ this.addForm = {
|
|
|
|
|
+ name: null,
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ originalId: null,
|
|
|
|
|
+ appid: null,
|
|
|
|
|
+ secret: null,
|
|
|
|
|
+ img: null,
|
|
|
|
|
+ status: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ handleAdd() {
|
|
|
|
|
+ this.resetAddForm()
|
|
|
|
|
+ this.addOpen = true
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs.addForm) {
|
|
|
|
|
+ this.$refs.addForm.clearValidate()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ cancelAdd() {
|
|
|
|
|
+ this.addOpen = false
|
|
|
|
|
+ this.addSaving = false
|
|
|
|
|
+ this.resetAddForm()
|
|
|
|
|
+ if (this.$refs.addForm) {
|
|
|
|
|
+ this.$refs.addForm.resetFields()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ submitAdd() {
|
|
|
|
|
+ this.$refs.addForm.validate(valid => {
|
|
|
|
|
+ if (!valid) return
|
|
|
|
|
+ this.addSaving = true
|
|
|
|
|
+ // company_id / company_user_id / company_ids / set_company_ids 由后端按登录态自动填充
|
|
|
|
|
+ // token / aesKey / msgDataFormat 使用固定默认值;类型固定为小程序
|
|
|
|
|
+ const payload = {
|
|
|
|
|
+ name: this.addForm.name,
|
|
|
|
|
+ type: 1,
|
|
|
|
|
+ originalId: this.addForm.originalId,
|
|
|
|
|
+ appid: this.addForm.appid,
|
|
|
|
|
+ secret: this.addForm.secret,
|
|
|
|
|
+ token: this.addDefaultToken,
|
|
|
|
|
+ aesKey: this.addDefaultAesKey,
|
|
|
|
|
+ msgDataFormat: this.addDefaultMsgDataFormat,
|
|
|
|
|
+ img: this.addForm.img,
|
|
|
|
|
+ status: 0
|
|
|
|
|
+ }
|
|
|
|
|
+ add(payload).then(response => {
|
|
|
|
|
+ if (response.code !== 200) {
|
|
|
|
|
+ this.msgError(response.msg || '添加失败')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.msgSuccess('添加成功')
|
|
|
|
|
+ this.addOpen = false
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ this.loadMiniAppMasterServer()
|
|
|
|
|
+ this.getAppList()
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.msgError('添加失败')
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.addSaving = false
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleUploadVerify(row) {
|
|
|
|
|
+ if (!row || !row.id) return
|
|
|
|
|
+ this.verifyRow = { ...row }
|
|
|
|
|
+ this.verifyFileList = []
|
|
|
|
|
+ this.verifyRawFile = null
|
|
|
|
|
+ this.verifyOpen = true
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ if (this.$refs.verifyUpload) {
|
|
|
|
|
+ this.$refs.verifyUpload.clearFiles()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ onVerifyFileChange(file, fileList) {
|
|
|
|
|
+ this.verifyFileList = fileList.slice(-1)
|
|
|
|
|
+ this.verifyRawFile = file && file.raw ? file.raw : null
|
|
|
|
|
+ },
|
|
|
|
|
+ onVerifyFileRemove() {
|
|
|
|
|
+ this.verifyFileList = []
|
|
|
|
|
+ this.verifyRawFile = null
|
|
|
|
|
+ },
|
|
|
|
|
+ cancelVerifyUpload() {
|
|
|
|
|
+ this.verifyOpen = false
|
|
|
|
|
+ this.verifySaving = false
|
|
|
|
|
+ this.verifyRow = null
|
|
|
|
|
+ this.verifyFileList = []
|
|
|
|
|
+ this.verifyRawFile = null
|
|
|
|
|
+ if (this.$refs.verifyUpload) {
|
|
|
|
|
+ this.$refs.verifyUpload.clearFiles()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ submitVerifyUpload() {
|
|
|
|
|
+ if (!this.verifyRow || !this.verifyRow.id) {
|
|
|
|
|
+ this.msgError('未选择小程序')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.verifyRawFile) {
|
|
|
|
|
+ this.msgWarning('请先选择校验文件')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.verifySaving = true
|
|
|
|
|
+ uploadVerifyFile(this.verifyRow.id, this.verifyRawFile).then(response => {
|
|
|
|
|
+ if (response.code !== 200) {
|
|
|
|
|
+ this.msgError(response.msg || '上传失败')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.msgSuccess(response.msg || '上传成功')
|
|
|
|
|
+ this.verifyOpen = false
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.msgError('上传失败')
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.verifySaving = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
findMiniAppByAppId(appId) {
|
|
findMiniAppByAppId(appId) {
|
|
|
return this.companyMiniAppList.find(
|
|
return this.companyMiniAppList.find(
|
|
|
item => (item.appid || item.appId) === appId
|
|
item => (item.appid || item.appId) === appId
|
|
@@ -628,7 +857,8 @@ export default {
|
|
|
loadMiniAppMasterServer() {
|
|
loadMiniAppMasterServer() {
|
|
|
this.miniAppLoading = true
|
|
this.miniAppLoading = true
|
|
|
getCompanyMiniAppList().then(res => {
|
|
getCompanyMiniAppList().then(res => {
|
|
|
- this.companyMiniAppList = res.data || []
|
|
|
|
|
|
|
+ // 主备下拉排除封禁(后端通常已过滤,前端再兜底)
|
|
|
|
|
+ this.companyMiniAppList = this.excludeBannedMiniApps(res.data || [])
|
|
|
const current = res.current
|
|
const current = res.current
|
|
|
if (current) {
|
|
if (current) {
|
|
|
this.miniAppConfigForm.mainMiniAppId = current.mainMiniAppId ?? null
|
|
this.miniAppConfigForm.mainMiniAppId = current.mainMiniAppId ?? null
|
|
@@ -674,7 +904,7 @@ export default {
|
|
|
const code = response.code
|
|
const code = response.code
|
|
|
const dataList = response.rows || response.data || []
|
|
const dataList = response.rows || response.data || []
|
|
|
if (code === 200 && dataList.length) {
|
|
if (code === 200 && dataList.length) {
|
|
|
- this.miniAppSelectList = dataList
|
|
|
|
|
|
|
+ this.miniAppSelectList = this.excludeBannedMiniApps(dataList)
|
|
|
.filter(v => v.type == 1)
|
|
.filter(v => v.type == 1)
|
|
|
.map(v => ({ appId: v.appid, appName: v.name }))
|
|
.map(v => ({ appId: v.appid, appName: v.name }))
|
|
|
}
|
|
}
|
|
@@ -729,7 +959,8 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
list(params).then(response => {
|
|
list(params).then(response => {
|
|
|
- this.list = response.rows || []
|
|
|
|
|
|
|
+ // 右侧小程序列表不展示封禁(status=2)
|
|
|
|
|
+ this.list = this.excludeBannedMiniApps(response.rows || [])
|
|
|
this.applyListFilter()
|
|
this.applyListFilter()
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
@@ -740,11 +971,12 @@ export default {
|
|
|
},
|
|
},
|
|
|
applyListFilter() {
|
|
applyListFilter() {
|
|
|
const keyword = (this.listSearchName || '').trim().toLowerCase()
|
|
const keyword = (this.listSearchName || '').trim().toLowerCase()
|
|
|
|
|
+ const source = this.excludeBannedMiniApps(this.list)
|
|
|
if (!keyword) {
|
|
if (!keyword) {
|
|
|
- this.filteredList = this.list
|
|
|
|
|
|
|
+ this.filteredList = source
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- this.filteredList = this.list.filter(item =>
|
|
|
|
|
|
|
+ this.filteredList = source.filter(item =>
|
|
|
(item.name || '').toLowerCase().includes(keyword)
|
|
(item.name || '').toLowerCase().includes(keyword)
|
|
|
)
|
|
)
|
|
|
},
|
|
},
|