Browse Source

完善示例

old
wangqing 6 years ago
parent
commit
20e843cb99
  1. 3
      src/util/signMd5Utils.js
  2. 12
      src/views/example/user.vue
  3. 2
      vue.config.js

3
src/util/signMd5Utils.js

@ -1,4 +1,5 @@
import md5 from 'js-md5' import md5 from 'js-md5'
import signSecret from './constants'
export default class signMd5Utils { export default class signMd5Utils {
/** /**
@ -31,7 +32,7 @@ export default class signMd5Utils {
let urlParams = this.parseQueryString(url) let urlParams = this.parseQueryString(url)
let jsonObj = this.mergeObject(urlParams, requestParams) let jsonObj = this.mergeObject(urlParams, requestParams)
let requestBody = this.sortAsc(jsonObj) let requestBody = this.sortAsc(jsonObj)
return md5('916lWh2WMcbSWiHv' + JSON.stringify(requestBody)).toLowerCase() return md5(signSecret + JSON.stringify(requestBody)).toLowerCase()
} }
/** /**

12
src/views/example/user.vue

@ -1,5 +1,11 @@
<template> <template>
<div> <div>
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="审批人">
<el-input v-model="username" placeholder="审批人"></el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="getData">查询</el-button>
<el-table <el-table
:data="tableData"> :data="tableData">
<el-table-column <el-table-column
@ -51,12 +57,12 @@
tableData: [], tableData: [],
current: 1, current: 1,
size: 10, size: 10,
total: 0 total: 0,
username: ''
} }
}, },
methods: { methods: {
handleSizeChange(size) { handleSizeChange(size) {
debugger
this.size = size this.size = size
this.getData() this.getData()
}, },
@ -73,7 +79,7 @@
}) })
}, },
getData() { getData() {
let params = {current: this.current, size: this.size} let params = {current: this.current, size: this.size, name: this.username}
this.$api.get('/api/v1/user/page', { this.$api.get('/api/v1/user/page', {
params: params params: params
}).then(res => { }).then(res => {

2
vue.config.js

@ -46,7 +46,7 @@ module.exports = {
port: '8081', port: '8081',
proxy: { proxy: {
'/api': { '/api': {
target: 'http://localhost:8888', // 要请求的地址 target: 'http://localhost:8999', // 要请求的地址
ws: true, ws: true,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {

Loading…
Cancel
Save