diff --git a/src/assets/images/Alipay.png b/src/assets/images/Alipay.png new file mode 100644 index 0000000..a0d5fe6 Binary files /dev/null and b/src/assets/images/Alipay.png differ diff --git a/src/assets/images/wechat.png b/src/assets/images/wechat.png new file mode 100644 index 0000000..6a759fb Binary files /dev/null and b/src/assets/images/wechat.png differ diff --git a/src/components/ApiFormModal.vue b/src/components/ApiFormModal.vue new file mode 100644 index 0000000..6288604 --- /dev/null +++ b/src/components/ApiFormModal.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/src/components/DataTable.vue b/src/components/DataTable.vue index c71c594..dca714b 100644 --- a/src/components/DataTable.vue +++ b/src/components/DataTable.vue @@ -2,49 +2,104 @@
-
{{ title }}
-

DataTables has most features enabled by default, so all you need to do to use it with your own tables is to - call the construction function: $().DataTable();.

+
{{ title }}
-
-
-
+ + 条数据 + +
+
+ +
-
-
+
+ +
- +
- + - + - +
{{ item.text }} + {{ item.text }} +
{{ item[header.value] }}
- {{ item[header.value] ? '禁用' : '正常'}} + {{ item[header.value] ? "禁用" : "正常" }}
- + {{ objItem[header.child] }}
@@ -54,17 +109,47 @@
{{ formatDateTime(item[header.value]) }}
+
+ {{ callMethod[item[header.value]] }} +
+
+ + {{ header.findValue.find(x => x.id == item[header.value]).name }} + +
- - - + +
{{ header.value }} + {{ header.value }} +
@@ -72,22 +157,79 @@
-
正在展示 {{ (currentPageIndex * pageSize) - (pageSize - 1) }} 到 {{ currentPageIndex * pageSize }} 条数据 总计 {{dataCount}} 条
+
+ 正在展示 {{ currentPageIndex * pageSize - (pageSize - 1) }} 到 + {{ currentPageIndex * pageSize }} 条数据 总计 {{ dataCount }} 条 +
-
+
@@ -118,8 +260,8 @@ export default { }, dataCount: { type: Number, - required: true - } + required: true, + }, }, data() { return { @@ -130,12 +272,12 @@ export default { //总页数 pageCount: 0, //分页按钮数据,[{text:'1',index:1},.....] - pageBtn: [] - } - }, - mounted() { - + pageBtn: [], + //调用方法 + callMethod:['GET','POST'] + }; }, + mounted() {}, methods: { //下一页 nextPage() { @@ -144,11 +286,11 @@ export default { //上一页 previousPage() { if (this.currentPageIndex > 1) { - this.currentPageIndex-- + this.currentPageIndex--; } }, changePage(pageIndex) { - this.currentPageIndex == pageIndex + this.currentPageIndex == pageIndex; }, //更新总页数 updatePageCount(newPageSize) { @@ -156,82 +298,91 @@ export default { this.pageCount += this.dataCount % newPageSize == 0 ? 0 : 1; }, //更新分页按钮数据 - updatePageBtn(newPageIndex){ - this.pageBtn = [] + updatePageBtn(newPageIndex) { + this.pageBtn = []; //初始化首页 - this.pageBtn.push({text: '1', index: 1}) + this.pageBtn.push({ text: "1", index: 1 }); //总页数小于8时显示全部页码 - if(this.pageCount <= 8){ - for(let i = 2; i < this.pageCount; i++){ - this.pageBtn.push({text: `${i}`, index: i}) + if (this.pageCount <= 8) { + for (let i = 2; i < this.pageCount; i++) { + this.pageBtn.push({ text: `${i}`, index: i }); } - }else{ + } else { //当前页左侧显示2格页码,当显示最小页码距离首页中间间隔大于1时隐藏间隔页面 - if(newPageIndex - 2 > 3){ - this.pageBtn.push({text: '...', index: newPageIndex}) + if (newPageIndex - 2 > 3) { + this.pageBtn.push({ text: "...", index: newPageIndex }); } //渲染当前页码左右各两格页码 - const numleft = (newPageIndex - 2) < 2 ? newPageIndex - 2 : 2; - const numright = (newPageIndex + 2) < this.pageCount ? 2 : (this.pageCount - newPageIndex - 1); - for(let i = newPageIndex - numleft; i <= newPageIndex + numright; i++){ - this.pageBtn.push({text: `${i}`, index: i}) + const numleft = newPageIndex - 2 < 2 ? newPageIndex - 2 : 2; + const numright = + newPageIndex + 2 < this.pageCount ? 2 : this.pageCount - newPageIndex - 1; + for (let i = newPageIndex - numleft; i <= newPageIndex + numright; i++) { + this.pageBtn.push({ text: `${i}`, index: i }); } //当前页右侧显示2格页码,当显示最大页码距离尾页中间间隔大于1时隐藏间隔页面 - if(newPageIndex + 2 < this.pageCount - 2){ - this.pageBtn.push({text: '...', index: newPageIndex}) + if (newPageIndex + 2 < this.pageCount - 2) { + this.pageBtn.push({ text: "...", index: newPageIndex }); } } //渲染尾页 - this.pageBtn.push({text: `${this.pageCount}`, index: this.pageCount}) - }, - formatDateTime(str){ - if (!str) return '-'; + this.pageBtn.push({ text: `${this.pageCount}`, index: this.pageCount }); + }, + formatDateTime(str) { + if (!str) return "-"; - const date = new Date(str); - if (isNaN(date)) return '-'; // 防止 Safari 报 Invalid Date + const date = new Date(str); + if (isNaN(date)) return "-"; // 防止 Safari 报 Invalid Date - const pad = n => n.toString().padStart(2, '0'); + const pad = (n) => n.toString().padStart(2, "0"); - const Y = date.getFullYear(); - const M = pad(date.getMonth() + 1); - const D = pad(date.getDate()); - const h = pad(date.getHours()); - const m = pad(date.getMinutes()); - const s = pad(date.getSeconds()); + const Y = date.getFullYear(); + const M = pad(date.getMonth() + 1); + const D = pad(date.getDate()); + const h = pad(date.getHours()); + const m = pad(date.getMinutes()); + const s = pad(date.getSeconds()); - return `${Y}-${M}-${D} ${h}:${m}:${s}`; - }, - modify(id){ - this.$emit('dataModify',id) - }, - deleteData(id){ - this.$emit('dataDelete',id) - } + return `${Y}-${M}-${D} ${h}:${m}:${s}`; + }, + modify(id) { + this.$emit("dataModify", id); + }, + deleteData(id) { + this.$emit("dataDelete", id); + }, + handleSearch() {}, + handleAddUser() {}, + handleBatchDelete() {}, }, watch: { //监听分页大小变化 - 'pageSize': { + pageSize: { handler(newVal) { - this.updatePageCount(newVal) + this.updatePageCount(newVal); //单页显示数据量改变时重置当前索引,防止数据以及控件异常 - this.currentPageIndex = 1 - this.$emit('pageChanged',{pageIndex:this.currentPageIndex,pageSize:newVal}) - this.updatePageBtn(this.currentPageIndex) + this.currentPageIndex = 1; + this.$emit("pageChanged", { pageIndex: this.currentPageIndex, pageSize: newVal }); + this.updatePageBtn(this.currentPageIndex); }, - immediate: true + immediate: true, }, //监听页索引,用于切换数据 - 'currentPageIndex': { + currentPageIndex: { handler(newVal) { - this.$emit('pageChanged',{pageIndex:newVal,pageSize:this.pageSize}) - this.updatePageBtn(newVal) + this.$emit("pageChanged", { pageIndex: newVal, pageSize: this.pageSize }); + this.updatePageBtn(newVal); }, - immediate: true - } - } -} + immediate: true, + }, + }, +}; diff --git a/src/request/api.js b/src/request/api.js index 8cd9c44..7eb9c43 100644 --- a/src/request/api.js +++ b/src/request/api.js @@ -28,6 +28,25 @@ const getUserInfoById = async (id) => await request.get(`/api/Admin/UserInfo?use //更新用户信息 const updateUserInfo = async (id,param) => await request.post(`/api/Admin/UpdateUser?userId=${id}`,param) + +//获取api列表 +const getApiList = async (pageIndex,pageSize,desc) => await request.get(`/api/apis/ApiList?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) + +//删除API +const deleteApi = async (id) => await request.delete(`/api/Apis/DeleteApi?apiId=${id}`) + +//获取指定API信息 +const getApiInfoById = async (id) => await request.get(`/api/Apis/ApiInfo?apiId=${id}`) + +//更新API信息 +const updateApiInfo = async (id,param) => await request.post(`/api/Apis/UpdateApi?apiId=${id}`,param) + +//获取套餐列表 +const getPackageList = async (pageIndex,pageSize,desc) => await request.get(`/api/Package/GetPackageList?pageIndex=${pageIndex}&pageSize=${pageSize}&desc=${desc}`) + +//更新系统配置 +const updateSystemConfig = async (configName,configBody) => await request.post('/api/SystemConfig/UpdateSystemConfig',{configName:configName,configBody:configBody}) + export default { login, register, @@ -38,5 +57,11 @@ export default { getUserCount, deleteUser, getUserInfoById, - updateUserInfo + updateUserInfo, + getApiList, + deleteApi, + getApiInfoById, + updateApiInfo, + getPackageList, + updateSystemConfig } \ No newline at end of file diff --git a/src/views/Notfound.vue b/src/views/Notfound.vue index 38c76ce..b94f511 100644 --- a/src/views/Notfound.vue +++ b/src/views/Notfound.vue @@ -1,20 +1,23 @@ diff --git a/src/views/layout/APIs.vue b/src/views/layout/APIs.vue index 1a7e48e..05ad3cf 100644 --- a/src/views/layout/APIs.vue +++ b/src/views/layout/APIs.vue @@ -6,7 +6,11 @@ + :data-count="dataCount" + @pageChanged="pageChangedHandle" + @dataDelete="deleteHandle" + @dataModify="modifyHandle" /> +
@@ -14,27 +18,104 @@ + + diff --git a/src/views/layout/BuyPackage.vue b/src/views/layout/BuyPackage.vue index e69de29..2d717da 100644 --- a/src/views/layout/BuyPackage.vue +++ b/src/views/layout/BuyPackage.vue @@ -0,0 +1,64 @@ + + + \ No newline at end of file diff --git a/src/views/layout/PersonalCenter.vue b/src/views/layout/PersonalCenter.vue index e69de29..252a78b 100644 --- a/src/views/layout/PersonalCenter.vue +++ b/src/views/layout/PersonalCenter.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/src/views/layout/SystemConfig.vue b/src/views/layout/SystemConfig.vue index e69de29..c3bb5cc 100644 --- a/src/views/layout/SystemConfig.vue +++ b/src/views/layout/SystemConfig.vue @@ -0,0 +1,182 @@ + + + \ No newline at end of file