Commit 17cfcddc by 李伟康

退出账号清空文件缓存

1 parent 5129117a
// pages/tab/mine/mine.js
import { IMG_URL } from '~/utils/constantData'
import {
IMG_URL
} from '~/utils/constantData'
import USERAPI from '~/api/usersApi/index'
import mineApi from '~/api/mineApi/index'
const IMAGES = Object.freeze({
......@@ -17,7 +19,9 @@ Page({
isRead: false
},
navGO(e) {
let { path } = e.currentTarget.dataset
let {
path
} = e.currentTarget.dataset
wx.$router.go(path)
},
logout() {
......@@ -31,6 +35,20 @@ Page({
// _this.showLoading()
wx.$api.showLoading()
USERAPI.logout().then(_res_ => {
const fn = wx.getFileSystemManager()
fn.readdir({
dirPath: wx.env.USER_DATA_PATH,
success({
files
}) {
files.length && files.map(e => {
fn.unlink({
filePath: `${wx.env.USER_DATA_PATH}/${e}`
})
})
}
})
wx.$storage.rm('fileList')
wx.$storage.rm('sessionId')
wx.$storage.rm('auto_login_object')
wx.$storage.rm('userInfo')
......@@ -41,7 +59,10 @@ Page({
})
},
navbarReady(e) {
let { height, statusBarHeight } = e.detail
let {
height,
statusBarHeight
} = e.detail
this.setData({
tabBarStyle: height / 2 + statusBarHeight
})
......@@ -49,9 +70,13 @@ Page({
},
messageBoxPageIsRead() {
console.log(111)
let { serviceMerchantId } = this.data
let {
serviceMerchantId
} = this.data
mineApi
.messageBoxPageIsRead({ serviceMerchantId })
.messageBoxPageIsRead({
serviceMerchantId
})
.then(result => {
console.log(result)
this.setData({
......@@ -66,7 +91,9 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let { userInfo } = wx.$storage.get()
let {
userInfo
} = wx.$storage.get()
let serviceMerchantId = userInfo.subLoginUser.merchantId
this.setData({
serviceMerchantId,
......@@ -110,4 +137,4 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function () {}
})
})
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!