Add 支付宝小程序设置
This commit is contained in:
parent
46ef4de89b
commit
916aaa94e8
|
@ -0,0 +1,24 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
export function info() {
|
||||
return request({
|
||||
url: '/user/centerUserAliappKey/info',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delData(id) {
|
||||
return request({
|
||||
url: '/user/centerUserAliappKey/del',
|
||||
method: 'post',
|
||||
data: { id }
|
||||
})
|
||||
}
|
||||
|
||||
export function saveData(data) {
|
||||
return request({
|
||||
url: '/user/centerUserAliappKey/save',
|
||||
method: 'post',
|
||||
data: { ...data }
|
||||
})
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1527120676182" class="icon" style="" viewBox="0 0 1756 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1829" xmlns:xlink="http://www.w3.org/1999/xlink" width="342.96875" height="200"><defs><style type="text/css"></style></defs><path d="M1002.928571 659.892857c-85.285714 102.392857-173.5 165-307.214286 165s-221.892857-82.5-210.5-182c5.714286-65.392857 51.214286-173.5 247.5-156.392857 102.392857 8.5 150.785714 28.392857 236.107143 56.892857 22.785714-39.785714 39.785714-85.285714 54-130.785714L647.321429 412.607143l0-37 184.892857 0L832.214286 310 607.5 310 607.5 267.285714l224.714286 0L832.214286 170.607143c0 0 2.785714-14.214286 19.892857-14.214286l93.892857 0 0 110.892857 238.892857 0 0 39.785714-241.785714 0L943.107143 372.5l196.285714 0c-17.107143 74-45.5 142.214286-79.607143 199.107143 48.392857 17.107143 244.607143 76.785714 301.5 93.892857L1361.285714 167.785714c0-79.607143-65.392857-142.214286-142.214286-142.214286L533.607143 25.571429c-79.714286 0-142.285714 65.392857-142.285714 142.214286l0 688.392857c0 79.607143 65.392857 142.214286 142.214286 142.214286l688.392857 0c79.607143 0 142.214286-65.392857 142.214286-142.214286l0-34.214286C1315.714286 799.285714 1099.607143 705.392857 1002.928571 659.892857zM525 634.285714c-8.5 37 14.214286 125.214286 156.392857 125.214286 85.285714 0 170.714286-54 238.892857-142.214286-96.714286-48.392857-176.392857-71.107143-267.392857-71.107143C573.321429 549 533.5 597.285714 525 634.285714z" p-id="1830"></path></svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -170,6 +170,26 @@ export const constantRouterMap = [
|
|||
meta: { title: '拼团记录', icon: 'pingtuan' }
|
||||
}]
|
||||
},
|
||||
{
|
||||
name: '支付宝小程序',
|
||||
path: '/user',
|
||||
component: Layout,
|
||||
redirect: '/user/centerUserAliappKey/info',
|
||||
meta: { title: '支付宝小程序', icon: 'alipaySR' },
|
||||
children: [{
|
||||
name: 'Appid配置',
|
||||
path: 'centerUserAliappKey/info',
|
||||
component: () => import('@/views/centerUserAliappKey/info'),
|
||||
meta: { title: 'Appid配置', icon: 'alipaySR' }
|
||||
},
|
||||
{
|
||||
name: '我的资源包2',
|
||||
path: 'dashboard3',
|
||||
component: () => import('@/views/dashboard/index'),
|
||||
meta: { title: '我的资源包2', icon: 'setting' }
|
||||
}]
|
||||
},
|
||||
|
||||
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<template>
|
||||
|
||||
<div class="app-container">
|
||||
|
||||
<div class="filter-container">
|
||||
<h4>设置信息</h4>
|
||||
<el-button class="filter-item" style="margin-left: 10px;margin-bottom: 10px;" @click="handleCreate" type="success" icon="el-icon-edit">设置</el-button>
|
||||
</div>
|
||||
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" :show-header="false" border fit highlight-current-row empty-text="暂无数据">
|
||||
<el-table-column prop="name" label="name"></el-table-column>
|
||||
<el-table-column prop="val" label="val"></el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog :title="pushData.dialogTitle" :visible.sync="pushData.dialogFormVisible" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||
<el-form :rules="rules" ref="addEditPopForm" :model="pushData" label-position="left" label-width="100px">
|
||||
<el-form-item label="appid" prop="appid" >
|
||||
<el-input v-model.text="pushData.appid" type="text" clearable @keyup.enter.native="handleCreateSave"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="privateKey" prop="privateKey" >
|
||||
<el-input v-model.textarea="pushData.privateKey" type="textarea " clearable @keyup.enter.native="handleCreateSave"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="pushData.dialogFormVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleCreateSave">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { info, saveData } from '@/api/centerUserAliappKey'
|
||||
import { Message, MessageBox } from 'element-ui'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'centerUserBase'
|
||||
])
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
rules: {
|
||||
appid: [
|
||||
{ required: true, message: '不能为空'}
|
||||
],
|
||||
privateKey: [
|
||||
{ required: true, message: '不能为空'}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
multipleSelection: [],
|
||||
appid:null,
|
||||
privateKey:null,
|
||||
list: null,
|
||||
listLoading: true,
|
||||
statisticsData:{},
|
||||
pushData: {
|
||||
dialogTitle : undefined,
|
||||
dialogFormVisible:false,
|
||||
|
||||
id:undefined,
|
||||
appid:undefined,
|
||||
privateKey:undefined
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pushDataTmp = Object.assign({}, this.pushData)
|
||||
this.fetchData()
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val;
|
||||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.page = val
|
||||
this.fetchData()
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val
|
||||
},
|
||||
fetchData() {
|
||||
this.list = null
|
||||
this.listLoading = true
|
||||
info().then(response => {
|
||||
if (response.code == 0) {
|
||||
this.appid = response.data.appid,
|
||||
this.privateKey = response.data.privateKey,
|
||||
this.list = [{name: 'appid',val: response.data.appid}, {name: 'privateKey',val: response.data.privateKey}]
|
||||
}else if(response.code == 700){
|
||||
this.list = [{name: 'appid',val: '未设置'}, {name: 'privateKey',val: '未设置'}]
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleCreate(){
|
||||
this.pushData = Object.assign({}, this.pushDataTmp,{appid:this.appid, privateKey:this.privateKey})
|
||||
this.pushData.dialogTitle = '支付宝小程序设置'
|
||||
this.pushData.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['addEditPopForm'].clearValidate()
|
||||
})
|
||||
}
|
||||
handleCreateSave(){
|
||||
this.$refs['addEditPopForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
saveData(this.pushData).then((res) => {
|
||||
this.pushData.dialogFormVisible = false
|
||||
if (res.code == 0) {
|
||||
Message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1 * 1000,
|
||||
onClose: () => {
|
||||
this.fetchData()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Message({
|
||||
message: res.msg,
|
||||
type: 'error',
|
||||
duration: 3 * 1000
|
||||
})
|
||||
}
|
||||
}).catch(e=>{
|
||||
console.error(e);
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue