Commit a05a354b by 前端

日志恢复

1 parent ee822917
......@@ -76,7 +76,7 @@ export default {
this.$emit("changeTab", index)
},
async haveCustomerAccess(val) {
const {shopMerchantId,merchantId, sceneType:scene} = val
const {shopMerchantId, sceneType:scene} = val
const res = await uni.$api.customerApi.haveCustomerAccess({
merchantId:shopMerchantId
})
......@@ -87,7 +87,7 @@ export default {
})
this.$store.state.user.haveCustomerAccess = res
uni.$api.customerApi.saleOpen({
merchantId,
merchantId:shopMerchantId,
scene
}).then(result=>{
if(result) {
......
import { getTime } from './util'
import { serializeIfObject } from '../utils'
class LogCat {
// main = plus.android.runtimeMainActivity()
// File = plus.android.importClass('java.io.File')
// Environment = plus.android.importClass('android.os.Environment')
// BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
// FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
// OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
// // BufferedReader = plus.android.importClass('java.io.BufferedReader')
// // FileInputStream = plus.android.importClass('java.io.FileInputStream')
// // InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
// LogPath = ''
main = plus.android.runtimeMainActivity()
File = plus.android.importClass('java.io.File')
Environment = plus.android.importClass('android.os.Environment')
BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
// BufferedReader = plus.android.importClass('java.io.BufferedReader')
// FileInputStream = plus.android.importClass('java.io.FileInputStream')
// InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
LogPath = ''
constructor(folderName = '_zyzs_log') {
// if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
// this.LogPath = this.main.getExternalFilesDir(null).getPath() + folderName
// } else {
// this.LogPath = this.main.getFilesDir().getPath() + folderName
// }
// console.log('日志文件存放路径->', this.LogPath)
if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
this.LogPath = this.main.getExternalFilesDir(null).getPath() + folderName
} else {
this.LogPath = this.main.getFilesDir().getPath() + folderName
}
console.log('日志文件存放路径->', this.LogPath)
}
writeLog(tag, messages) {
// let msg = serializeIfObject(messages)
// let date = getTime('YYYY-MM-DD')
// let datetime = getTime()
// //文件名
// let fileName = this.LogPath + '/' + date + '.txt'
// //写入的内容
// let content = `${datetime} [${tag}] : ${msg}\n`
// console.log(content.replace(/\n/g, ''))
// let path = new this.File(this.LogPath)
// if (!path.exists()) {
// path.mkdirs() //创建父路径
// }
// let fos = null
// let bw = null
// try {
// fos = new this.FileOutputStream(fileName, true)
// bw = new this.BufferedWriter(new this.OutputStreamWriter(fos))
// //bw.write(log);
// bw.append(content)
// } catch (e) {
// console.log('e->', e)
// } finally {
// try {
// if (bw != null) {
// bw.close() //关闭缓冲流
// fos.close() //关闭文件输出流
// }
// } catch (closeEx) {
// console.log('closeEx->', closeEx)
// }
// }
let msg = serializeIfObject(messages)
let date = getTime('YYYY-MM-DD')
let datetime = getTime()
//文件名
let fileName = this.LogPath + '/' + date + '.txt'
//写入的内容
let content = `${datetime} [${tag}] : ${msg}\n`
console.log(content.replace(/\n/g, ''))
let path = new this.File(this.LogPath)
if (!path.exists()) {
path.mkdirs() //创建父路径
}
let fos = null
let bw = null
try {
fos = new this.FileOutputStream(fileName, true)
bw = new this.BufferedWriter(new this.OutputStreamWriter(fos))
//bw.write(log);
bw.append(content)
} catch (e) {
console.log('e->', e)
} finally {
try {
if (bw != null) {
bw.close() //关闭缓冲流
fos.close() //关闭文件输出流
}
} catch (closeEx) {
console.log('closeEx->', closeEx)
}
}
}
// 删除日志
removeLogFile(fileName) {
......@@ -84,11 +84,9 @@ export default LogCat
// // BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
// // FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
// // OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
// // BufferedReader = plus.android.importClass('java.io.BufferedReader')
// // FileInputStream = plus.android.importClass('java.io.FileInputStream')
// // InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
// LogPath = ''
// constructor(folderName = '_zyzs_log') {
// // if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!