图片更新需重新下载
This commit is contained in:
parent
6dc9e69fa1
commit
f7d4bcc5d9
@ -40,6 +40,24 @@ export default class Dowloader {
|
|||||||
resolve(url);
|
resolve(url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!lru) {
|
||||||
|
// 无 lru 情况下直接判断 临时文件是否存在,不存在重新下载
|
||||||
|
wx.getFileInfo({
|
||||||
|
filePath: url,
|
||||||
|
success: () => {
|
||||||
|
resolve(url);
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
downloadFile(url, lru).then((path) => {
|
||||||
|
resolve(path);
|
||||||
|
}, () => {
|
||||||
|
reject();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const file = getFile(url);
|
const file = getFile(url);
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
@ -79,7 +97,9 @@ function downloadFile(url, lru) {
|
|||||||
reject();
|
reject();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { tempFilePath } = res;
|
const {
|
||||||
|
tempFilePath
|
||||||
|
} = res;
|
||||||
wx.getFileInfo({
|
wx.getFileInfo({
|
||||||
filePath: tempFilePath,
|
filePath: tempFilePath,
|
||||||
success: (tmpRes) => {
|
success: (tmpRes) => {
|
||||||
|
|||||||
@ -234,11 +234,16 @@ Component({
|
|||||||
downloader.download(newVal.url, this.properties.LRU).then((path) => {
|
downloader.download(newVal.url, this.properties.LRU).then((path) => {
|
||||||
doView.originUrl = doView.url
|
doView.originUrl = doView.url
|
||||||
doView.url = path
|
doView.url = path
|
||||||
|
this.reDraw(doView, callback, isMoving)
|
||||||
})
|
})
|
||||||
};
|
} else {
|
||||||
(newVal && newVal.text && doView.text && newVal.text !== doView.text) && (doView.text = newVal.text);
|
(newVal && newVal.text && doView.text && newVal.text !== doView.text) && (doView.text = newVal.text);
|
||||||
(newVal && newVal.content && doView.content && newVal.content !== doView.content) && (doView.content = newVal.content);
|
(newVal && newVal.content && doView.content && newVal.content !== doView.content) && (doView.content = newVal.content);
|
||||||
|
this.reDraw(doView, callback, isMoving)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
reDraw(doView, callback, isMoving) {
|
||||||
const draw = {
|
const draw = {
|
||||||
width: this.currentPalette.width,
|
width: this.currentPalette.width,
|
||||||
height: this.currentPalette.height,
|
height: this.currentPalette.height,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user