添加日志记录

This commit is contained in:
wanyongkang
2020-10-09 10:28:30 +08:00
parent b7fc0f2961
commit 86eb9a41fe
8 changed files with 201 additions and 132 deletions

View File

@@ -1,51 +1,68 @@
<template> <template>
<el-table :data="tableData" style="width: 100%"> <div style="height:95%">
<el-table-column prop="date" label="用户" width="180"> </el-table-column> <el-table :show-overflow-tooltip="true" :data="tableData" height="calc(100% - 100px)" style="width: 100%">
<el-table-column prop="name" label="操作" width="180"> </el-table-column> <el-table-column prop="user" label="用户" width="180"
<el-table-column prop="address" label="操作内容"> </el-table-column> :filters="[{ text: 'xuzongyang', value: 'xuzongyang' }, { text: 'wanyongkang', value: 'wanyongkang' }]"
<el-table-column prop="address" label="相关信息"> </el-table-column> :filter-method="filterTag"
> </el-table-column>
<el-table-column prop="operation" label="操作" width="180"> </el-table-column>
<el-table-column prop="record" label="操作内容"> </el-table-column>
<el-table-column show-overflow-tooltip prop="create_time" label="操作时间"> </el-table-column>
</el-table> </el-table>
<el-pagination
background
:current-page="pageNum"
style="top:88%"
layout="prev, pager, next"
:page-size = "50"
@prev-click="prev_page"
@next-click="next_page"
@current-change="handleCurrentChange"
:total="count">
</el-pagination>
</div>
</template> </template>
<script> <script>
export default { export default {
data() { data () {
return { return {
tableData: [ tableData: [],
{ count: 0,
date: "2016-05-02", pageNum: 1
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄",
},
{
date: "2016-05-04",
name: "王小虎",
address: "上海市普陀区金沙江路 1517 弄",
},
{
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄",
},
{
date: "2016-05-03",
name: "王小虎",
address: "上海市普陀区金沙江路 1516 弄",
},
],
};
},
created() {
this.$store.commit("setCurrentNav", "日志记录");
this.getData();
},
methods: {
getData(){
this.$api.get("baseinfo/v1/user/page", this.searchModel).then(res => {
console.log(res);
});
} }
}, },
};
created () {
this.$store.commit('setCurrentNav', '日志记录')
this.getData()
},
methods: {
getData () {
this.$api.get('http://autophp.wyk/api/index/index').then(res => {
this.tableData = res.data
this.count = parseInt(res.count)
})
},
prev_page () {
this.$api.get('http://autophp.wyk/api/index/pageList', {page: this.pageNum}).then(res => {
this.tableData = res.data
})
},
next_page () {
this.$api.get('http://autophp.wyk/api/index/pageList', {page: this.pageNum}).then(res => {
this.tableData = res.data
})
},
handleCurrentChange: function (currentPage) {
this.pageNum = currentPage
this.$api.get('http://autophp.wyk/api/index/pageList', {page: this.pageNum}).then(res => {
this.tableData = res.data
})
},
filterTag (value, row) {
return row.user === value
}
}
}
</script> </script>

View File

@@ -190,15 +190,26 @@ export default {
} }
}; };
}, },
created() { created () {
this.$store.commit("setCurrentNav", "会员管理>>账号管理"); this.$store.commit('setCurrentNav', '会员管理>>账号管理')
var userId = this.$route.query.userId; var userId = this.$route.query.userId
if (userId) this.searchModel.UserId = userId; if (userId) this.searchModel.UserId = userId
this.get(); this.get()
this.getProductWithPackage(); this.getProductWithPackage()
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
// eslint-disable-next-line camelcase
if (userId) {
this.$api.post('http://autophp.wyk/logs/index/clickInfo', {
user: user_info,
operation: '点击客户信息产品账号',
record: '查看该客户的产品信息',
userid: userId
}).then(res => {})
}
}, },
methods: { methods: {
search(){ search () {
this.searchModel.PageIndex=1; this.searchModel.PageIndex=1;
this.get(); this.get();
}, },

View File

@@ -43,7 +43,7 @@
</router-link> </router-link>
<span class="handel cursor edit" @click="edit(scope.row)">编辑</span> <span class="handel cursor edit" @click="edit(scope.row)">编辑</span>
<span class="handel cursor edit" @click="showAmountDetail(scope.row)">明细</span> <span class="handel cursor edit" @click="showAmountDetail(scope.row)">明细</span>
<el-popover placement="bottom" trigger="hover" width="180"> <el-popover @show="showHandle(scope.row)" placement="bottom" trigger="hover" width="180">
<div class="popover_box"> <div class="popover_box">
<span>QQ号{{scope.row.QQ||'--'}}</span> <span>QQ号{{scope.row.QQ||'--'}}</span>
<span>微信{{scope.row.Wx||'--'}}</span> <span>微信{{scope.row.Wx||'--'}}</span>
@@ -207,11 +207,19 @@ export default {
} }
}; };
}, },
created() { created () {
this.$store.commit("setCurrentNav", "用户管理>>会员管理"); this.$store.commit('setCurrentNav', '用户管理>>会员管理')
var currentUser=this.$local.getUserByCache(); var currentUser = this.$local.getUserByCache()
this.IsRoot=currentUser.Manager.IsRootUser; this.IsRoot = currentUser.Manager.IsRootUser
this.get(); this.get()
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post('http://autophp.wyk/logs/index/clickVipInfo', {
user: user_info,
operation: '点击客户管理',
record: '查询客户信息列表'
}).then(res => {})
}, },
methods: { methods: {
search(){ search(){
@@ -301,14 +309,32 @@ export default {
this.$api this.$api
.get("baseinfo/v1/user/AmountDetail?userId=" + item.Id) .get("baseinfo/v1/user/AmountDetail?userId=" + item.Id)
.then(res => { .then(res => {
this.detailAmountData = res.Data; this.detailAmountData = res.Data
}); });
}, },
dataExport(){ showHandle (r) {
this.$api.getDownloadFile("/baseinfo/v1/user/Export"); // eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post('http://autophp.wyk/logs/index/hoveInfo', {
user: user_info,
operation: '点击客户信息会员价',
record: '查看会员的产品价格',
info: r.LoginCode
}).then(res => {})
},
dataExport () {
this.$api.getDownloadFile('/baseinfo/v1/user/Export')
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post('http://autophp.wyk/logs/index/export', {
user: user_info,
operation: '点击导出所有客户信息',
record: '导出所有客户信息列表',
info: '本次点击时间之前所有客户数据'
}).then(res => {})
} }
} }
}; }
</script> </script>
<style scoped> <style scoped>
</style> </style>

View File

@@ -135,6 +135,16 @@ export default {
this.currentDiscount.userId=this.$route.query.id; this.currentDiscount.userId=this.$route.query.id;
this.get(); this.get();
this.getProductDiscounts(); this.getProductDiscounts();
if (this.current.UserId) {
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post('http://autophp.wyk/logs/index/clickInfo', {
user: user_info,
operation: '点击客户信息会员价',
record: '查看会员的产品价格',
userid: this.current.UserId
}).then(res => {})
}
}, },
methods: { methods: {
get() { get() {

View File

@@ -16,7 +16,7 @@ function getUserToken(){
var bmsAxios = axios.create({ var bmsAxios = axios.create({
// timeout: 120000, // timeout: 120000,
withCredentials: true, // withCredentials: true,
baseURL: http.baseURL, baseURL: http.baseURL,
headers: { headers: {
post: { post: {
@@ -117,6 +117,9 @@ export function post(url, params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
bmsAxios.post(url, params).then( bmsAxios.post(url, params).then(
response => { response => {
if (response.data.Code == 20000) {
return;
}
if (response.data.Code == 10000) { if (response.data.Code == 10000) {
Message.success("操作成功") Message.success("操作成功")
return resolve(response.data); return resolve(response.data);
@@ -313,7 +316,7 @@ export function upload(url, uconfig) {
onStart && onStart(uuid, file); onStart && onStart(uuid, file);
var uploadAxios = axios.create({ var uploadAxios = axios.create({
withCredentials: true, // withCredentials: true,
baseURL: http.baseURL baseURL: http.baseURL
}); });
uploadAxios.post(url, formData, config).then( uploadAxios.post(url, formData, config).then(

View File

@@ -1,23 +1,24 @@
//npm run build -- dev // npm run build -- dev
//npm run build -- test // npm run build -- test
//npm run build -- prod // npm run build -- prod
const devUrlNew ='http://localhost:5000/api/' const devUrlNew = 'http://localhost:5000/api/'
const testUrlNew = "http://localhost:5000/api/" const testUrlNew = 'http://localhost:5000/api/'
const prodUrlNew ="http://www.juip.com/api/";// "http://api.yk.hncore.net/api/"/"http://hapi.hncore.net/api" const prodUrlNew = 'http://www.juip.com/api/'// "http://api.yk.hncore.net/api/"/"http://hapi.hncore.net/api"
var baseURL = devUrlNew
var baseURL= devUrlNew
switch (process.env.NODE_ENV) { switch (process.env.NODE_ENV) {
case "development": case 'development':
baseURL =devUrlNew baseURL = devUrlNew
break; break
case "test": case 'test':
baseURL =testUrlNew baseURL = testUrlNew
break; break
case "production": case 'production':
baseURL = prodUrlNew baseURL = prodUrlNew
break; break
} }
export { export {
baseURL baseURL
}; }

View File

@@ -4,8 +4,8 @@ import login from '@/components/login'
import local from '../extend/js/localStorage'; import local from '../extend/js/localStorage';
Vue.use(Router) Vue.use(Router)
let router= new Router({ let router = new Router({
mode: "history", mode: 'history',
routes: [ routes: [
{ {
path: '/login', path: '/login',
@@ -211,22 +211,23 @@ let router= new Router({
component: resolve => require(["@/components/order/sellerstatistics"], resolve) component: resolve => require(["@/components/order/sellerstatistics"], resolve)
}, },
{ {
path: "logs/list", path: "logs",
name: "logs", name: "logs",
component: resolve => require(["@/components/logs/logList"], resolve) component: resolve => require(["@/components/logs/logList"], resolve)
}, },
]} ]
}
] ]
}) })
// 使用 router.beforeEach 注册一个全局前置守卫,判断用户是否登陆 // 使用 router.beforeEach 注册一个全局前置守卫,判断用户是否登陆
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
var host=window.location.hostname; var host = window.location.hostname;
if (to.path === '/login'||to.path === '/'||to.path === '/r') { if (to.path === '/login' || to.path === '/' || to.path === '/r') {
next(); next();
} else { } else {
let userInfo =local.getUserByCache()// localStorage.getItem('etorcurrentuser'); let userInfo = local.getUserByCache()// localStorage.getItem('etorcurrentuser');
if (!userInfo || userInfo === '') { if (!userInfo || userInfo === '') {
router.replace({ router.replace({
path: "/login", path: "/login",
@@ -238,6 +239,6 @@ router.beforeEach((to, from, next) => {
next(); next();
} }
} }
}); });
export default router export default router