Commit dc8e1702 by 陈羽

update: 小程序配置

parent 3795454a
...@@ -11,36 +11,39 @@ ...@@ -11,36 +11,39 @@
import appSet from '@/components/set/app-set.vue'; import appSet from '@/components/set/app-set.vue';
--> -->
<template> <template>
<el-dialog :title="!!editRow.materialId ? '编辑' : '新建'" :visible.sync="dialogVisible" width="600px" :before-close="handleClose"> <el-dialog :title="editRow.type === 'edit' ? '编辑' : '新建'" :visible.sync="dialogVisible" width="600px" :before-close="handleClose">
<div class=""> <div class="">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm"> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item label="小程序名称" prop="appName"> <el-form-item label="授权商户" prop="enterpriseId">
<el-input show-word-limit placeholder="请输入小程序名称" type="text" v-model="ruleForm.appName" maxlength="20"></el-input> <el-select v-model="ruleForm.enterpriseId" placeholder="请选择授权商户">
<el-option v-for="item in options" :key="item.value" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="小程序名称" prop="miniprogramName">
<el-input show-word-limit placeholder="请输入小程序名称" type="text" v-model="ruleForm.miniprogramName" maxlength="20"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="AppID:" prop="appId"> <el-form-item label="AppID:" prop="appId">
<el-input show-word-limit placeholder="请输入AppID" type="text" v-model="ruleForm.appId" maxlength="80"></el-input> <el-input show-word-limit placeholder="请输入AppID" type="text" v-model="ruleForm.appId" maxlength="80"></el-input>
</el-form-item> </el-form-item>
<template v-if="type === 1"> <el-form-item label="标题:" prop="title">
<el-form-item label="标题:" prop="title"> <el-input show-word-limit placeholder="请输入标题" type="text" v-model="ruleForm.title" maxlength="80"></el-input>
<el-input show-word-limit placeholder="请输入标题" type="text" v-model="ruleForm.title" maxlength="80"></el-input> </el-form-item>
</el-form-item> <el-form-item label=" 封面:" prop="pic">
<el-form-item label=" 封面:" prop="pic"> <single-upload uploadType="1" :imgSrc.sync="ruleForm.imageUrl" :field="''" class="app-set" :uploadLimit="20"> </single-upload>
<single-upload uploadType="1" :imgSrc.sync="ruleForm.pic" :field="''" class="app-set" :uploadLimit="20"> </single-upload> <p style="margin-top: 9px;font-size: 12px;color: #909399;line-height: 17px;">建议尺寸520*416,支持png、jpg、jpeg格式</p>
<p style="margin-top: 9px;font-size: 12px;color: #909399;line-height: 17px;">建议尺寸520*416,支持png、jpg、jpeg格式</p> </el-form-item>
</el-form-item>
</template>
</el-form> </el-form>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="toCancel">取消</el-button> <el-button @click="toCancel">取消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">{{ !!editRow.materialId ? '保存' : '新建' }}</el-button> <el-button type="primary" @click="submitForm('ruleForm')">{{ editRow.type === 'edit' ? '保存' : '新建' }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import singleUpload from '@/components/single-upload.vue'; import singleUpload from '@/components/single-upload.vue';
import { _debounce } from '@/common/js/public'; import { _debounce } from '@/common/js/public';
import { postRequest } from '@/api/api'; import { postRequest, getRequest } from '@/api/api';
import showMsg from '@/common/js/showmsg'; import showMsg from '@/common/js/showmsg';
import errMsg from '@/common/js/error'; import errMsg from '@/common/js/error';
export default { export default {
...@@ -50,12 +53,6 @@ export default { ...@@ -50,12 +53,6 @@ export default {
default() { default() {
return {}; return {};
} }
},
type: {
type: Number,
default() {
return 0;
}
} }
}, },
components: { components: {
...@@ -65,15 +62,18 @@ export default { ...@@ -65,15 +62,18 @@ export default {
return { return {
dialogVisible: true, dialogVisible: true,
ruleForm: { ruleForm: {
appName: '', miniprogramName: '',
appId: '', appId: '',
title: '' title: '',
imageUrl: ''
}, },
rules: { rules: {
appName: [{ required: true, message: '请输入小程序名称', trigger: 'blur' }], enterpriseId: [{ required: true, message: '请选择授权商户', trigger: 'blur' }],
miniprogramName: [{ required: true, message: '请输入小程序名称', trigger: 'blur' }],
appId: [{ required: true, message: '请输入AppID', trigger: 'blur' }], appId: [{ required: true, message: '请输入AppID', trigger: 'blur' }],
title: [{ required: true, message: '请输入标题', trigger: 'blur' }] title: [{ required: true, message: '请输入标题', trigger: 'blur' }]
} },
options: []
}; };
}, },
methods: { methods: {
...@@ -91,14 +91,22 @@ export default { ...@@ -91,14 +91,22 @@ export default {
const that = this; const that = this;
that.$refs[formName].validate(valid => { that.$refs[formName].validate(valid => {
if (valid) { if (valid) {
that.postSave(); this.$confirm('是否确认提交?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.postSave();
})
.catch(() => {});
} }
}); });
}, 300), }, 300),
postSave() { postSave() {
const that = this; const that = this;
const data = { ...that.ruleForm }; const data = { ...that.ruleForm };
postRequest('/haoban-manage3-web/', data) postRequest('/haoban-manage3-web/save-miniprogram-setting', data)
.then(res => { .then(res => {
let resData = res.data; let resData = res.data;
if (resData.errorCode == 1) { if (resData.errorCode == 1) {
...@@ -117,6 +125,25 @@ export default { ...@@ -117,6 +125,25 @@ export default {
message: error.message message: error.message
}); });
}); });
},
getTableList(val) {
const that = this;
let para = {};
getRequest('/haoban-manage3-web/wx-enterprise-list', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
that.options = resData.result || [];
return false;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
} }
}, },
watch: { watch: {
...@@ -131,6 +158,7 @@ export default { ...@@ -131,6 +158,7 @@ export default {
}, },
mounted() { mounted() {
const that = this; const that = this;
that.getTableList();
if (Object.keys(that.editRow).length) { if (Object.keys(that.editRow).length) {
that.$nextTick(() => { that.$nextTick(() => {
that.ruleForm = JSON.parse(JSON.stringify(that.editRow)); that.ruleForm = JSON.parse(JSON.stringify(that.editRow));
......
...@@ -127,18 +127,15 @@ ...@@ -127,18 +127,15 @@
<div class="company-title m-b-20 m-t-30"><span class="color-303133 font-14 font-w-600">小程序添加</span></div> <div class="company-title m-b-20 m-t-30"><span class="color-303133 font-14 font-w-600">小程序添加</span></div>
<div class="company-info-body"> <div class="company-info-body">
<div class="table-cell m-t-10"> <div class="table-cell m-t-10">
<el-table class="no-empty-icon-table" ref="multipleTable" :data="tableData" tooltip-effect="dark" :style="{ width: '100%', minHeight: tableH }"> <el-table class="no-empty-icon-table" ref="multipleTable" :data="appTableData" tooltip-effect="dark" :style="{ width: '100%', minHeight: tableH }">
<el-table-column label="小程序名称" show-overflow-tooltip> <el-table-column label="小程序名称" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.secretName || '--' }}</template> <template slot-scope="scope">{{ scope.row.miniprogramName || '--' }}</template>
</el-table-column> </el-table-column>
<el-table-column prop="" label="AppID" width="239"> <el-table-column prop="" label="AppID" width="239">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.enterpriseName || '--' }}</span> <span>{{ scope.row.appId || '--' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="" label="类型" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.enterpriseName || '--' }}</template>
</el-table-column>
<el-table-column prop="" label="最近编辑时间" show-overflow-tooltip> <el-table-column prop="" label="最近编辑时间" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<div class="line-18">{{ scope.row.updateTime | timeStampToYmd }}</div> <div class="line-18">{{ scope.row.updateTime | timeStampToYmd }}</div>
...@@ -146,15 +143,18 @@ ...@@ -146,15 +143,18 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="" label="操作"> <el-table-column prop="" label="操作">
<template slot-scope="scope"> <el-button type="text" @click="toEdit(scope.$index, scope.row)">编辑</el-button><el-button type="text" @click="toDel(scope.$index, scope.row)">删除</el-button> </template> <template slot-scope="scope">
<el-button type="text" @click="toAppEdit(scope.$index, scope.row)">编辑</el-button>
<!-- <el-button type="text" @click="toAppDel(scope.$index, scope.row)">删除</el-button> -->
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="text-center add-cell cursor-pointer" @click="addApp"><span class="el-icon-plus font-14 color-2f54eb add-cell-txt"></span><span class="font-14 color-2f54eb p-l-5 add-cell-txt">新建</span><span class="font-12 color-c0c4cc p-l-20">最多添加10个</span></div> <!-- <div class="text-center add-cell cursor-pointer" @click="addApp"><span class="el-icon-plus font-14 color-2f54eb add-cell-txt"></span><span class="font-14 color-2f54eb p-l-5 add-cell-txt">新建</span></div> -->
</div> </div>
</div> </div>
</div> </div>
<secret-set v-if="addShow" :editRow="editRow" @closeText="closeText" @submitText="submitText"></secret-set> <secret-set v-if="addShow" :editRow="editRow" @closeText="closeText" @submitText="submitText"></secret-set>
<app-set v-if="addAppShow" :type="appSetType" @closeText="closeAppText" @submitText="submitAppText"></app-set> <app-set v-if="addAppShow" :editRow="appEditRow" :type="appSetType" @closeText="closeAppText" @submitText="submitAppText"></app-set>
</div> </div>
</template> </template>
<script> <script>
...@@ -209,10 +209,12 @@ export default { ...@@ -209,10 +209,12 @@ export default {
showContactError: false, showContactError: false,
showHaobanError: false, showHaobanError: false,
tableData: [], tableData: [],
appTableData: [],
addShow: false, addShow: false,
addAppShow: false, addAppShow: false,
appSetType: 0, appSetType: 0,
editRow: {}, editRow: {},
appEditRow: {},
// 企微好友 // 企微好友
wxShow: false, wxShow: false,
wxDate: '' wxDate: ''
...@@ -295,7 +297,7 @@ export default { ...@@ -295,7 +297,7 @@ export default {
addApp() { addApp() {
const that = this; const that = this;
that.addAppShow = true; that.addAppShow = true;
that.editRow = {}; that.editRow = { type: 'add' };
}, },
/** /**
* 编辑 * 编辑
...@@ -305,6 +307,11 @@ export default { ...@@ -305,6 +307,11 @@ export default {
that.addShow = true; that.addShow = true;
that.editRow = row; that.editRow = row;
}, },
toAppEdit(index, row) {
const that = this;
that.addAppShow = true;
that.appEditRow = Object.assign({}, row, { type: 'edit' });
},
closeText() { closeText() {
const that = this; const that = this;
that.addShow = false; that.addShow = false;
...@@ -313,7 +320,7 @@ export default { ...@@ -313,7 +320,7 @@ export default {
closeAppText() { closeAppText() {
const that = this; const that = this;
that.addAppShow = false; that.addAppShow = false;
that.editRow = {}; that.appEditRow = {};
}, },
submitText() { submitText() {
const that = this; const that = this;
...@@ -324,8 +331,8 @@ export default { ...@@ -324,8 +331,8 @@ export default {
submitAppText() { submitAppText() {
const that = this; const that = this;
that.addAppShow = false; that.addAppShow = false;
that.editRow = {}; that.appEditRow = {};
// that.getSecretData(); that.getAppData();
}, },
/** /**
* 删除 * 删除
...@@ -343,6 +350,19 @@ export default { ...@@ -343,6 +350,19 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
toAppDel(index, row) {
const that = this;
that
.$confirm('确定删除当前小程序?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.postAppDel(index, row);
})
.catch(() => {});
},
postDel(index, row) { postDel(index, row) {
const that = this; const that = this;
let para = { let para = {
...@@ -366,6 +386,29 @@ export default { ...@@ -366,6 +386,29 @@ export default {
}); });
}); });
}, },
postAppDel(index, row) {
const that = this;
let para = {
id: row.miniprogramSettingId
};
postRequest('/haoban-manage3-web/del-miniprogram-setting', para)
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
showMsg.showmsg('删除成功', 'success');
that.getAppData();
return;
}
that.getAppData();
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
},
/** /**
* 保存secret * 保存secret
*/ */
...@@ -530,6 +573,24 @@ export default { ...@@ -530,6 +573,24 @@ export default {
message: error.message message: error.message
}); });
}); });
},
getAppData() {
const that = this;
getRequest('/haoban-manage3-web/list-miniprogram-setting', {})
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
that.appTableData = resData.result;
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
} }
}, },
watch: {}, watch: {},
...@@ -537,6 +598,7 @@ export default { ...@@ -537,6 +598,7 @@ export default {
const that = this; const that = this;
that.$emit('showTab', 1); that.$emit('showTab', 1);
document.documentElement.style.backgroundColor = '#f0f2f5'; document.documentElement.style.backgroundColor = '#f0f2f5';
that.getAppData();
that.getData(); that.getData();
that.getSecretData(); that.getSecretData();
that.getTipData(); that.getTipData();
......
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