diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 6bca640..65a63c5 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -4,7 +4,7 @@ 拍摄数码写真 1.0.8i + >1.0.10i @@ -25,47 +25,51 @@ function toChooseStyle() { uni.navigateTo({ url: "/pages/chooseStyle/index" }); } -const fileReaderTest = () => { - plus.io.resolveLocalFileSystemURL( - "file:///storage/Document", - function (entry) { - /* 获取文件目录 */ - var directoryReader = entry.createReader(); //获取读取对象 - directoryReader.readEntries( - function (entries) { - //历遍子目录即可 - for (var i = 0; i < entries.length; i++) { - console.log("文件信息:" + entries[i].name); +function fileReaderTest() { + try { + plus.io.resolveLocalFileSystemURL( + "file:///storage/Documents", + function (entry) { + /* 获取文件目录 */ + var directoryReader = entry.createReader(); //获取读取对象 + directoryReader.readEntries( + function (entries) { + //历遍子目录即可 + for (var i = 0; i < entries.length; i++) { + console.log("文件信息:" + entries[i].name); + uni.showToast({ + // title: uni.getStorageSync("androidId"), + title: "文件信息:" + entries[i].name, + icon: "success", + }); + } + }, + function (err) { + console.log("访问目录失败"); uni.showToast({ - // title: uni.getStorageSync("androidId"), - title: "文件信息:" + entries[i].name, - icon: "success", + title: err, + icon: "error", }); } - }, - function (err) { - console.log("访问目录失败"); - uni.showToast({ - title: err, - icon: "error", - }); - } - ); - }, - function (err) { - console.log("访问指定目录失败:" + err.message); - uni.showToast({ - title: err, - icon: "error", - }); - } - ); -}; + ); + }, + function (err) { + console.log("访问指定目录失败:" + err.message); + uni.showToast({ + title: err, + icon: "error", + }); + } + ); + } catch (error) { + console.log(error, "error"); + } +} //#region 初始化 onLoad(() => { runGetAndroidId(); - fileReaderTest(); + // fileReaderTest(); userInfoModulesPinia.clearStorage(); }); //#endregion ----------------------------------