|
@@ -2,11 +2,15 @@ import ListModule from "..";
|
|
import { ItemObject } from "../objects/item";
|
|
import { ItemObject } from "../objects/item";
|
|
import { DialogItem, ShowItem } from "../objects/item";
|
|
import { DialogItem, ShowItem } from "../objects/item";
|
|
const artifacts = "./Artifacts.json";
|
|
const artifacts = "./Artifacts.json";
|
|
-
|
|
|
|
|
|
+const defaultImage = require("@/assets/default.png");
|
|
function loadImg(url: string, id: string, name: string): Promise<ShowItem> {
|
|
function loadImg(url: string, id: string, name: string): Promise<ShowItem> {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
const m = new Image();
|
|
const m = new Image();
|
|
- m.src = url;
|
|
|
|
|
|
+ if (url) {
|
|
|
|
+ m.src = url;
|
|
|
|
+ } else {
|
|
|
|
+ m.src = defaultImage;
|
|
|
|
+ }
|
|
m.onload = () => {
|
|
m.onload = () => {
|
|
resolve({
|
|
resolve({
|
|
id: id,
|
|
id: id,
|
|
@@ -26,18 +30,17 @@ function loadImg(url: string, id: string, name: string): Promise<ShowItem> {
|
|
offsetZ: 0,
|
|
offsetZ: 0,
|
|
timer: 0,
|
|
timer: 0,
|
|
name,
|
|
name,
|
|
-
|
|
|
|
img: m,
|
|
img: m,
|
|
});
|
|
});
|
|
};
|
|
};
|
|
});
|
|
});
|
|
}
|
|
}
|
|
export default ListModule.action({
|
|
export default ListModule.action({
|
|
- async initListData(wWidth: number, wHeight: number) {
|
|
|
|
- const items = await this.actions.loadData();
|
|
|
|
|
|
+ // async initListData(wWidth: number, wHeight: number) {
|
|
|
|
+ // const items = await this.actions.loadData();
|
|
|
|
|
|
- this.actions.initLoadShowItems(items);
|
|
|
|
- },
|
|
|
|
|
|
+ // this.actions.initLoadShowItems(items);
|
|
|
|
+ // },
|
|
async shuffleSelf(arr, size) {
|
|
async shuffleSelf(arr, size) {
|
|
let index = -1;
|
|
let index = -1;
|
|
const length = arr.length;
|
|
const length = arr.length;
|
|
@@ -59,8 +62,8 @@ export default ListModule.action({
|
|
if (!dbId || !defineId) {
|
|
if (!dbId || !defineId) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const list = await this.https.loadAsset(dbId, defineId);
|
|
|
|
- this.store.list = list.data;
|
|
|
|
|
|
+ await this.actions.getAssetList(dbId, defineId);
|
|
|
|
+
|
|
const ps = this.store.list.map((item: ItemObject, index) =>
|
|
const ps = this.store.list.map((item: ItemObject, index) =>
|
|
loadImg(item.thumbnail, item._id, item.name)
|
|
loadImg(item.thumbnail, item._id, item.name)
|
|
);
|
|
);
|