日志记录功能
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
|
||||
<script>
|
||||
import api from "@/packageCa/apiCa/user.js"
|
||||
import apiuser from "@/packageCa/apiCa/user.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -103,7 +104,7 @@
|
||||
url: "/packageCa/userCenter/smartTarget"
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -116,10 +117,32 @@
|
||||
user: res.Data.userInfo
|
||||
};
|
||||
uni.setStorageSync('CAuserInfo',params);
|
||||
this.postLog(101,`【用户登入】【小程序】${res.Data.userInfo}登录成功`,"",JSON.stringify(params))
|
||||
}else {
|
||||
return null
|
||||
}
|
||||
},
|
||||
// 添加日志
|
||||
postLog(operationType, remarks, beforeData = "", afterData = ""){
|
||||
try {
|
||||
const data = {
|
||||
OperationType: operationType,
|
||||
Remarks: remarks,
|
||||
BeforeOperationJson: beforeData,
|
||||
AfterOperationJson: afterData
|
||||
};
|
||||
console.log(data);
|
||||
// return;
|
||||
// 异步记录日志,不阻塞主流程
|
||||
apiuser.saveUserOperationLog(data).then((res) => {
|
||||
console.log('[Operation Log] 记录成功', res);
|
||||
}).catch((err) => {
|
||||
console.error('[Operation Log] 记录失败', err);
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('[Operation Log] 记录异常', e);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -482,6 +505,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 55rpx;
|
||||
margin-bottom: 30rpx;
|
||||
&:nth-child(4){
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user