Commit 967c8a30 authored by zhengke's avatar zhengke

增加小程序信息

parent 2833a131
......@@ -663,6 +663,45 @@ export function DelContributeMediumBatch(data) {
}
/**
* 获取小程序分页列表
*/
export function GetContributeAppletPageList(data) {
return request({
url: '/QYContribute/GetContributeAppletPageList',
method: 'post',
data
})
}
/**
* 新增修改小程序信息
*/
export function SetContributeApplet(data) {
return request({
url: '/QYContribute/SetContributeApplet',
method: 'post',
data
})
}
/**
* 删除小程序
*/
export function DelContributeApplet(data) {
return request({
url: '/QYContribute/DelContributeApplet',
method: 'post',
data
})
}
......
<template>
<div>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-card style="width: 450px; max-width: 450px">
<q-card-section>
<div class="text-h6">
{{ objOption.Id == 0 ? "新增小程序信息" : "修改小程序信息" }}
</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<q-input filled stack-label :dense="false" v-model="objOption.Name" ref="Name"
class="col-12 q-pb-lg" label="小程序名称" :rules="[(val) => !!val || '请填写小程序名称']" />
<q-input filled stack-label :dense="false" v-model="objOption.AppID" ref="AppID"
class="col-12 q-pb-lg" label="AppID" :rules="[(val) => !!val || '请填写小程序AppID']" />
</div>
<div style="width:100px;height:100px;border:1px solid #d1d1d1;text-align:center;line-height:100px;cursor:pointer;" @click="getImgChoice=true">
<i class="el-icon-plus avatar-uploader-icon" style="font-size: 30px;"
v-if="objOption.Image==''"></i>
<q-img v-else :src="objOption.Image" style="width: 100%;height: 100%;">
</q-img>
</div>
<q-input filled stack-label :dense="false" v-model="objOption.Page" ref="Page"
class="col-12 q-pt-lg" label="路径"/>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight: 400 !important" @click="closeCourseForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight: 400 !important" :loading="saveCourseLoading"
@click="saveCourse" />
</q-card-actions>
</q-card>
</q-dialog>
<!-- 选择文件 -->
<q-dialog title="选择文件" v-model="getImgChoice" width="1200px">
<ChooseImg @SelectId="SelectId" :type="1" @closeDia="getImgChoice=false"></ChooseImg>
</q-dialog>
</div>
</template>
<script>
import {
SetContributeApplet
} from "../../api/system/wechat";
import ChooseImg from '../../pages/teacher/components/ChooseImg'
export default {
components: {
ChooseImg
},
props: {
saveObj: {
type: Object,
default: null,
},
},
data() {
return {
persistent: true,
saveCourseLoading:false,
getImgChoice:false,
objOption: {
Id: 0,
Name: "", //小程序名称
AppID: "", // appid
Image: "", //图标
Page: '' //路径
}
};
},
created() {
},
mounted() {
if(this.saveObj){
this.objOption.Id = this.saveObj.Id;
this.objOption.Name = this.saveObj.Name;
this.objOption.AppID = this.saveObj.AppID;
this.objOption.Image = this.saveObj.Image;
this.objOption.Page = this.saveObj.Page;
}
},
methods: {
SelectId(obj) {
this.objOption.Image = obj.url;
this.getImgChoice = false;
},
//关闭弹窗
closeCourseForm() {
this.$emit("close");
this.persistent = false;
},
//保存菜单
saveCourse() {
this.$refs.Name.validate();
this.$refs.AppID.validate();
if (
!this.$refs.Name.hasError &&
!this.$refs.AppID.hasError
) {
this.saveCourseLoading = true;
SetContributeApplet(this.objOption)
.then((res) => {
this.saveCourseLoading = false;
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: "数据保存成功!",
position: "top",
});
this.$emit("success");
this.$emit("close");
})
.catch(() => {
this.saveCourseLoading = false;
});
}
}
},
};
</script>
......@@ -111,18 +111,20 @@
border: 1px dashed #d9d9d9;
line-height: 120px;
}
</style>
<template>
<div class="page-body">
<div class="platformdeploy">
<q-tabs style="margin-bottom:20px;" v-model="tabCheck" @input="tabChange()" narrow-indicator dense
align="left" class="text-primary">
<q-tabs style="margin-bottom:20px;" v-model="tabCheck" @input="tabChange()" narrow-indicator dense align="left"
class="text-primary">
<q-tab v-for="(x,y) in TypeEnumList" :key='y' :ripple="false" :name="x.Id" :label="x.Name" />
</q-tabs>
<!-- 公众号 -->
<template>
<div style="text-align:right;">
<q-btn color="accent" size="sm" class="q-mr-md" @click="geteject" label="修改平台配置" />
<q-btn color="accent" size="sm" class="q-mr-md" @click="goLittleProgram" label="小程序信息" />
</div>
<div v-if="data && data.Id && data.Id>0">
......@@ -188,12 +190,12 @@
<div class="baseSetForm_Dialog">
<div class="cycle_Title">平台配置</div>
<div style="margin-top: 10px;">
<q-input filled stack-label :dense="false" v-model="addMsg.Name" ref="Name"
class="col-12 q-pb-lg" label="平台名称" :rules="[val => !!val || '请填写平台名称']" />
<q-input filled stack-label :dense="false" v-model="addMsg.Name" ref="Name" class="col-12 q-pb-lg"
label="平台名称" :rules="[val => !!val || '请填写平台名称']" />
</div>
<div>
<q-input filled stack-label :dense="false" v-model="addMsg.AppId" ref="AppId"
class="col-12 q-pb-lg" label="AppId" :rules="[val => !!val || '请填写AppId']" />
<q-input filled stack-label :dense="false" v-model="addMsg.AppId" ref="AppId" class="col-12 q-pb-lg"
label="AppId" :rules="[val => !!val || '请填写AppId']" />
</div>
<div>
<q-input filled stack-label :dense="false" v-model="addMsg.AppSecret" ref="AppSecret"
......@@ -223,7 +225,6 @@
</template>
<script>
import {
getContributeConfigTypeEnumList,
getContributeConfigInfo,
......@@ -242,7 +243,7 @@
return {
isShowBaseSet: false,
tabCheck: '1',
TypeEnumList: [],//各平台枚举列表
TypeEnumList: [], //各平台枚举列表
data: null,
addMsg: {}
}
......@@ -251,7 +252,7 @@
this.getEnumList()
},
methods: {
tabChange(){
tabChange() {
this.getConfigInfo()
},
getEnumList() {
......@@ -263,8 +264,10 @@
}
})
},
getConfigInfo() {//获取平台配置
getContributeConfigInfo({ Type: this.tabCheck }).then(res => {
getConfigInfo() { //获取平台配置
getContributeConfigInfo({
Type: this.tabCheck
}).then(res => {
if (res.Code == 1) {
this.data = res.Data;
}
......@@ -294,7 +297,7 @@
this.$refs.Name.validate();
this.$refs.AppId.validate();
this.$refs.AppSecret.validate();
if (!this.$refs.Name.hasError && !this.$refs.AppId.hasError && !this.$refs.AppSecret.hasError ) {
if (!this.$refs.Name.hasError && !this.$refs.AppId.hasError && !this.$refs.AppSecret.hasError) {
let msg = {
Id: this.addMsg.Id,
Name: this.addMsg.Name,
......@@ -318,12 +321,15 @@
}
})
}
},
//跳转到微信小程序页面
goLittleProgram(){
var tempStr = '../system/smallProgramInfo';
this.$router.push({
path: tempStr,
query: {}
});
}
}
}
......
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @input="resetSearch" clearable filled v-model="msg.Name" label="小程序名称"
@clear="resetSearch" maxlength="20" />
</div>
<div class="col-3">
<q-input @input="resetSearch" clearable filled v-model="msg.AppID" label="AppID"
@clear="resetSearch" maxlength="20" />
</div>
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="dataList" :columns="columns">
<template v-slot:top="props">
<div class="col-2 q-table__title">小程序信息</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" label="新增小程序" @click="EditProgram(null)" />
</div>
</template>
<template v-slot:body-cell-Image="props">
<q-td :props="props">
<q-img :src="props.row.Image" />
</q-td>
</template>
<template v-slot:body-cell-Id="props">
<q-td :props="props">
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" label="编辑"
@click="EditProgram(props.row)" />
<q-btn flat size="xs" icon="delete" color="negative" style="font-weight:400;" label="删除"
@click="deleteProgram(props.row)" />
</q-td>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
</q-table>
<program-form v-if="isShowProgram" :save-obj="programObj" @close="closeProgramForm" @success="refreshPage">
</program-form>
</div>
</div>
</template>
<script>
import {
GetContributeAppletPageList,
DelContributeApplet
} from '../../api/system/wechat'
import programForm from '../../components/system/program-form'
export default {
meta: {
title: "小程序信息"
},
components: {
programForm
},
data() {
return {
msg: {
pageIndex: 1,
pageSize: 10,
rowsPerPage: 10,
Name: '', //小程序名称
AppID:'' //AppID
},
pageCount:0,
dataList: [],
loading: true,
columns: [{
name: 'Name',
label: '小程序名称',
field: 'Name',
align: 'left'
},{
name: 'AppID',
label: 'AppID',
field: 'AppID',
align: 'left'
},
{
name: 'Image',
label: '图标',
field: 'Image',
align: 'left'
},
{
name: 'Page',
label: '路径',
field: 'Page',
align: 'left'
},
{
name: 'UpdateByName',
label: '修改人',
align: 'left',
field: row => row.UpdateByName
},
{
name: 'UpdateTime',
label: '修改时间',
align: 'left',
field: row => row.UpdateTime
},
{
name: 'Id',
label: '操作',
field: 'Id'
}
],
isShowProgram:false,
programObj:{}
}
},
mounted() {
this.getList();
},
methods: {
//重新查询
resetSearch() {
this.msg.pageIndex = 1;
this.getList();
},
changePage(val) {
this.msg.pageIndex = val;
this.getList()
},
//删除系列
deleteProgram(item) {
let delMsg = {
AppletId: item.AppID
};
this.$q.dialog({
title: '提示信息',
message: '是否确定删除该小程序?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
DelContributeApplet(delMsg).then(res => {
if (res.Code == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '删除成功!',
position: 'top'
})
this.refreshPage();
}
})
}).onCancel(() => {
});
},
//刷新页面
refreshPage() {
this.getList();
},
//获取课程系列分页列表
getList() {
this.loading = true;
GetContributeAppletPageList(this.msg).then(res => {
this.loading = false;
this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
})
},
//新增修改课程系列
EditProgram(obj) {
if (obj) {
this.programObj = obj
} else {
this.programObj = null
}
this.isShowProgram = true;
},
//关闭弹窗
closeProgramForm() {
this.isShowProgram = false
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -193,6 +193,11 @@ const routes = [{
component: () =>
import("pages/system/platformdeploy.vue")
},
{
path: "/system/smallProgramInfo", //小程序信息
component: () =>
import("pages/system/smallProgramInfo.vue")
},
{
path: "/course/catagory", //课程分类
component: () =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment