新增小程序配置

This commit is contained in:
曾成 2020-05-16 16:58:34 +08:00
parent 8037fb7848
commit 8fd54c2b75
12 changed files with 868 additions and 0 deletions

View File

@ -0,0 +1,53 @@
<div id="addSmallWeChatModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">添加小程序</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">小程序名称</label>
<div class="col-sm-10">
<input v-model="addSmallWeChatInfo.name" type="text" placeholder="必填,请填写小程序名称"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">appId</label>
<div class="col-sm-10">
<input v-model="addSmallWeChatInfo.appId" type="text" placeholder="必填请填写appId"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">应用密钥</label>
<div class="col-sm-10">
<input v-model="addSmallWeChatInfo.appSecret" type="text" placeholder="必填,请填写应用密钥"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">支付密码</label>
<div class="col-sm-10">
<input v-model="addSmallWeChatInfo.payPassword" type="text" placeholder="必填,请填写支付密码"
class="form-control">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="saveSmallWeChatInfo()"><i class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,136 @@
(function (vc) {
vc.extends({
propTypes: {
callBackListener: vc.propTypes.string, //父组件名称
callBackFunction: vc.propTypes.string //父组件监听方法
},
data: {
addSmallWeChatInfo: {
weChatId: '',
name: '',
appId: '',
appSecret: '',
payPassword: '',
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('addSmallWeChat', 'openAddSmallWeChatModal', function () {
$('#addSmallWeChatModel').modal('show');
});
},
methods: {
addSmallWeChatValidate() {
return vc.validate.validate({
addSmallWeChatInfo: vc.component.addSmallWeChatInfo
}, {
'addSmallWeChatInfo.name': [
{
limit: "required",
param: "",
errInfo: "小程序名称不能为空"
},
{
limit: "max",
param: "1,100",
errInfo: "小程序名称不能超过100位"
},
],
'addSmallWeChatInfo.appId': [
{
limit: "required",
param: "",
errInfo: "appId不能为空"
},
{
limit: "maxin",
param: "1,100",
errInfo: "appId不能超过100位"
},
],
'addSmallWeChatInfo.appSecret': [
{
limit: "required",
param: "",
errInfo: "应用密钥不能为空"
},
{
limit: "maxin",
param: "1,200",
errInfo: "应用密钥不能超过200个字符"
},
],
'addSmallWeChatInfo.payPassword': [
{
limit: "required",
param: "",
errInfo: "支付密码不能为空"
},
{
limit: "maxin",
param: "1,200",
errInfo: "支付密码不能超过200个字符"
},
],
});
},
saveSmallWeChatInfo: function () {
if (!vc.component.addSmallWeChatValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.component.addSmallWeChatInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addSmallWeChatInfo);
$('#addSmallWeChatModel').modal('hide');
return;
}
vc.http.apiPost(
'smallWeChat.saveSmallWeChat',
JSON.stringify(vc.component.addSmallWeChatInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#addSmallWeChatModel').modal('hide');
vc.component.clearAddSmallWeChatInfo();
vc.emit('smallWeChatManage', 'listSmallWeChat', {});
return;
}
vc.message(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
},
clearAddSmallWeChatInfo: function () {
vc.component.addSmallWeChatInfo = {
name: '',
appId: '',
appSecret: '',
payPassword: '',
};
}
}
});
})(window.vc);

View File

@ -0,0 +1,62 @@
<div id = "chooseSmallWeChatModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="chooseSmallWeChatModelLabel" aria-hidden="true" >
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="chooseSmallWeChatModelLabel">选择小程序管理</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class=" row">
<div class="col-lg-12">
<div class="ibox ">
<div class="row">
<div class="col-sm-7 m-b-xs">
</div>
<div class="col-sm-5">
<div class="input-group">
<input placeholder="输入小程序管理名称" type="text" v-model="chooseSmallWeChatInfo._currentSmallWeChatName" class="form-control form-control-sm">
<span class="input-group-append">
<button type="button" class="btn btn-sm btn-primary" v-on:click="querySmallWeChats()">查询</button>
</span>
</div>
</div>
</div>
<div class="table-responsive" style="margin-top:15px">
<table class="table table-striped">
<thead>
<tr>
<th class="text-center">编码</th>
<th class="text-center">小程序名称</th>
<th class="text-center">appId</th>
<th class="text-center">应用密钥</th>
<th class="text-center">支付密码</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="smallWeChat in chooseSmallWeChatInfo.smallWeChats">
<td class="text-center">{{smallWeChat.weChatId}}</td>
<td class="text-center">{{smallWeChat.name}}</td>
<td class="text-center">{{smallWeChat.appId}}</td>
<td class="text-center">{{smallWeChat.appSecret}}</td>
<td class="text-center">{{smallWeChat.payPassword}}</td>
<td>
<button class="btn btn-primary btn-xs" v-on:click="chooseSmallWeChat(smallWeChat)">选择</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,63 @@
(function(vc){
vc.extends({
propTypes: {
emitChooseSmallWeChat:vc.propTypes.string,
emitLoadData:vc.propTypes.string
},
data:{
chooseSmallWeChatInfo:{
smallWeChats:[],
_currentSmallWeChatName:'',
}
},
_initMethod:function(){
},
_initEvent:function(){
vc.on('chooseSmallWeChat','openChooseSmallWeChatModel',function(_param){
$('#chooseSmallWeChatModel').modal('show');
vc.component._refreshChooseSmallWeChatInfo();
vc.component._loadAllSmallWeChatInfo(1,10,'');
});
},
methods:{
_loadAllSmallWeChatInfo:function(_page,_row,_name){
var param = {
params:{
page:_page,
row:_row,
communityId:vc.getCurrentCommunity().communityId,
name:_name
}
};
//发送get请求
vc.http.apiGet('smallWeChat.listSmallWeChats',
param,
function(json){
var _smallWeChatInfo = JSON.parse(json);
vc.component.chooseSmallWeChatInfo.smallWeChats = _smallWeChatInfo.smallWeChats;
},function(){
console.log('请求失败处理');
}
);
},
chooseSmallWeChat:function(_smallWeChat){
if(_smallWeChat.hasOwnProperty('name')){
_smallWeChat.smallWeChatName = _smallWeChat.name;
}
vc.emit($props.emitChooseSmallWeChat,'chooseSmallWeChat',_smallWeChat);
vc.emit($props.emitLoadData,'listSmallWeChatData',{
smallWeChatId:_smallWeChat.smallWeChatId
});
$('#chooseSmallWeChatModel').modal('hide');
},
querySmallWeChats:function(){
vc.component._loadAllSmallWeChatInfo(1,10,vc.component.chooseSmallWeChatInfo._currentSmallWeChatName);
},
_refreshChooseSmallWeChatInfo:function(){
vc.component.chooseSmallWeChatInfo._currentSmallWeChatName = "";
}
}
});
})(window.vc);

View File

@ -0,0 +1,19 @@
<div class="modal fade" id="deleteSmallWeChatModel" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">请确认您的操作!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<tr align="center"><th>确定删除小程序管理</th></tr>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" v-on:click="closeDeleteSmallWeChatModel()">点错了</button>
<button type="button" class="btn btn-primary" v-on:click="deleteSmallWeChat()">确认删除</button>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,51 @@
(function(vc,vm){
vc.extends({
data:{
deleteSmallWeChatInfo:{
}
},
_initMethod:function(){
},
_initEvent:function(){
vc.on('deleteSmallWeChat','openDeleteSmallWeChatModal',function(_params){
vc.component.deleteSmallWeChatInfo = _params;
$('#deleteSmallWeChatModel').modal('show');
});
},
methods:{
deleteSmallWeChat:function(){
vc.component.deleteSmallWeChatInfo.communityId=vc.getCurrentCommunity().communityId;
vc.http.apiPost(
'smallWeChat.deleteSmallWeChat',
JSON.stringify(vc.component.deleteSmallWeChatInfo),
{
emulateJSON:true
},
function(json,res){
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if(res.status == 200){
//关闭model
$('#deleteSmallWeChatModel').modal('hide');
vc.emit('smallWeChatManage','listSmallWeChat',{});
return ;
}
vc.message(json);
},
function(errInfo,error){
console.log('请求失败处理');
vc.message(json);
});
},
closeDeleteSmallWeChatModel:function(){
$('#deleteSmallWeChatModel').modal('hide');
}
}
});
})(window.vc,window.vc.component);

View File

@ -0,0 +1,53 @@
<div id="editSmallWeChatModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">修改小程序管理</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">小程序名称</label>
<div class="col-sm-10">
<input v-model="editSmallWeChatInfo.name" type="text" placeholder="必填,请填写小程序名称"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">appId</label>
<div class="col-sm-10">
<input v-model="editSmallWeChatInfo.appId" type="text" placeholder="必填请填写appId"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">应用密钥</label>
<div class="col-sm-10">
<input v-model="editSmallWeChatInfo.appSecret" type="text" placeholder="必填,请填写应用密钥"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">支付密码</label>
<div class="col-sm-10">
<input v-model="editSmallWeChatInfo.payPassword" type="text"
placeholder="必填,请填写支付密码" class="form-control">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button"
v-on:click="editSmallWeChat()"><i class="fa fa-check"></i>&nbsp;保存
</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,130 @@
(function (vc, vm) {
vc.extends({
data: {
editSmallWeChatInfo: {
weChatId: '',
name: '',
appId: '',
appSecret: '',
payPassword: '',
createTime:''
}
},
_initMethod: function () {
},
_initEvent: function () {
vc.on('editSmallWeChat', 'openEditSmallWeChatModal', function (_params) {
console.log("收到参数",_params);
vc.component.refreshEditSmallWeChatInfo();
$('#editSmallWeChatModel').modal('show');
vc.copyObject(_params, vc.component.editSmallWeChatInfo);
});
},
methods: {
editSmallWeChatValidate: function () {
return vc.validate.validate({
editSmallWeChatInfo: vc.component.editSmallWeChatInfo
}, {
'editSmallWeChatInfo.name': [
{
limit: "required",
param: "",
errInfo: "小程序名称不能为空"
},
{
limit: "max",
param: "1,100",
errInfo: "小程序名称不能超过100位"
},
],
'editSmallWeChatInfo.appId': [
{
limit: "required",
param: "",
errInfo: "appId不能为空"
},
{
limit: "maxin",
param: "1,100",
errInfo: "appId不能超过100位"
},
],
'editSmallWeChatInfo.appSecret': [
{
limit: "required",
param: "",
errInfo: "应用密钥不能为空"
},
{
limit: "maxin",
param: "1,200",
errInfo: "应用密钥不能超过200个字符"
},
],
'editSmallWeChatInfo.payPassword': [
{
limit: "required",
param: "",
errInfo: "支付密码不能为空"
},
{
limit: "maxin",
param: "1,200",
errInfo: "支付密码不能超过200个字符"
},
],
'editSmallWeChatInfo.weChatId': [
{
limit: "required",
param: "",
errInfo: "编码不能为空"
}]
});
},
editSmallWeChat: function () {
if (!vc.component.editSmallWeChatValidate()) {
vc.toast(vc.validate.errInfo);
return;
}
vc.http.apiPost(
'smallWeChat.updateSmallWeChat',
JSON.stringify(vc.component.editSmallWeChatInfo),
{
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
if (res.status == 200) {
//关闭model
$('#editSmallWeChatModel').modal('hide');
vc.emit('smallWeChatManage', 'listSmallWeChat', {});
return;
}
vc.message(json);
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
},
refreshEditSmallWeChatInfo: function () {
vc.component.editSmallWeChatInfo = {
weChatId: '',
name: '',
appId: '',
appSecret: '',
payPassword: '',
createTime:''
}
}
}
});
})(window.vc, window.vc.component);

View File

@ -0,0 +1,58 @@
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>小程序管理信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" v-if="viewSmallWeChatInfo.index != 2" class="btn btn-primary btn-sm" style="margin-right:10px;" v-on:click="_openSelectSmallWeChatInfoModel()">
<i class="glyphicon glyphicon-search"></i> 选择小程序管理</button>
<button type="button" v-if="viewSmallWeChatInfo.index != 2" class="btn btn-primary btn-sm" v-on:click="_openAddSmallWeChatInfoModel()">
<i class="glyphicon glyphicon-plus"></i> 添加小程序管理</button>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >小程序名称:</label>
<label class="">{{viewSmallWeChatInfo.name}}</label>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >appId</label>
<label class="">{{viewSmallWeChatInfo.appId}}</label>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >应用密钥:</label>
<label class="">{{viewSmallWeChatInfo.appSecret}}</label>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="col-form-label" >支付密码:</label>
<label class="">{{viewSmallWeChatInfo.payPassword}}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<vc:create name="addSmallWeChat"
callBackListener="viewSmallWeChatInfo"
callBackFunction="chooseSmallWeChat"
></vc:create>
<vc:create name="chooseSmallWeChat"
emitChooseSmallWeChat="viewSmallWeChatInfo"
emitLoadData="viewSmallWeChatInfo"
></vc:create>
</div>

View File

@ -0,0 +1,51 @@
/**
小程序管理 组件
**/
(function(vc){
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
},
data:{
viewSmallWeChatInfo:{
index:0,
flowComponent:'viewSmallWeChatInfo',
name:'',
appId:'',
appSecret:'',
payPassword:'',
}
},
_initMethod:function(){
//根据请求参数查询 查询 业主信息
vc.component._loadSmallWeChatInfoData();
},
_initEvent:function(){
vc.on('viewSmallWeChatInfo','chooseSmallWeChat',function(_app){
vc.copyObject(_app, vc.component.viewSmallWeChatInfo);
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.viewSmallWeChatInfo);
});
vc.on('viewSmallWeChatInfo', 'onIndex', function(_index){
vc.component.viewSmallWeChatInfo.index = _index;
});
},
methods:{
_openSelectSmallWeChatInfoModel(){
vc.emit('chooseSmallWeChat','openChooseSmallWeChatModel',{});
},
_openAddSmallWeChatInfoModel(){
vc.emit('addSmallWeChat','openAddSmallWeChatModal',{});
},
_loadSmallWeChatInfoData:function(){
}
}
});
})(window.vc);

View File

@ -0,0 +1,108 @@
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入小程序名称"
v-model="smallWeChatManageInfo.conditions.name" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入appId"
v-model="smallWeChatManageInfo.conditions.appId" class=" form-control">
</div>
</div>
<div class="col-sm-4">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_querySmallWeChatMethod()">
<i class="fa fa-search"></i> 查询
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>小程序管理信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddSmallWeChatModal()">
<i class="glyphicon glyphicon-plus"></i>
配置小程序
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny"
data-page-size="15"
>
<thead>
<tr>
<th class="text-center">小程序名称</th>
<th class="text-center">appId</th>
<th class="text-center">应用密钥</th>
<th class="text-center">支付密码</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="smallWeChat in smallWeChatManageInfo.smallWeChats">
<td class="text-center">{{smallWeChat.name}}</td>
<td class="text-center">{{smallWeChat.appId}}</td>
<td class="text-center">{{smallWeChat.appSecret}}</td>
<td class="text-center">{{smallWeChat.payPassword}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditSmallWeChatModel(smallWeChat)">修改
</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteSmallWeChatModel(smallWeChat)">删除
</button>
</div>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
<vc:create path="frame/pagination"></vc:create>
</div>
</div>
</div>
</div>
<vc:create path="property/addSmallWeChat" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="property/editSmallWeChat"></vc:create>
<vc:create path="property/deleteSmallWeChat"></vc:create>
</div>

View File

@ -0,0 +1,84 @@
/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
smallWeChatManageInfo: {
smallWeChats: [],
total: 0,
records: 1,
moreCondition: false,
name: '',
conditions: {
name: '',
appId: '',
}
}
},
_initMethod: function () {
vc.component._listSmallWeChats(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent: function () {
vc.on('smallWeChatManage', 'listSmallWeChat', function (_param) {
vc.component._listSmallWeChats(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listSmallWeChats(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listSmallWeChats: function (_page, _rows) {
vc.component.smallWeChatManageInfo.conditions.page = _page;
vc.component.smallWeChatManageInfo.conditions.row = _rows;
var param = {
params: vc.component.smallWeChatManageInfo.conditions
};
//发送get请求
vc.http.apiGet('smallWeChat.listSmallWeChats',
param,
function (json, res) {
var _smallWeChatManageInfo = JSON.parse(json);
vc.component.smallWeChatManageInfo.total = _smallWeChatManageInfo.total;
vc.component.smallWeChatManageInfo.records = _smallWeChatManageInfo.records;
vc.component.smallWeChatManageInfo.smallWeChats = _smallWeChatManageInfo.smallWeChats;
vc.emit('pagination', 'init', {
total: vc.component.smallWeChatManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddSmallWeChatModal: function () {
vc.emit('addSmallWeChat', 'openAddSmallWeChatModal', {});
},
_openEditSmallWeChatModel: function (_smallWeChat) {
vc.emit('editSmallWeChat', 'openEditSmallWeChatModal', _smallWeChat);
},
_openDeleteSmallWeChatModel: function (_smallWeChat) {
vc.emit('deleteSmallWeChat', 'openDeleteSmallWeChatModal', _smallWeChat);
},
_querySmallWeChatMethod: function () {
vc.component._listSmallWeChats(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition: function () {
if (vc.component.smallWeChatManageInfo.moreCondition) {
vc.component.smallWeChatManageInfo.moreCondition = false;
} else {
vc.component.smallWeChatManageInfo.moreCondition = true;
}
}
}
});
})(window.vc);