12345678910111213141516171819202122232425262728293031 |
- class GetTickImg {
- constructor(imgPath, len) {
- this.imgPath = imgPath
- this.len = len
- this.imgList = []
- this.loadState = false
- this.initDraw = false
- this.getDrawImgUrl()
- }
- async getDrawImgUrl() {
- for (let i = 1; i < this.len + 1; i++) {
- let imgHostUrl = await this.getImgInfo(i)
- this.imgList.push(imgHostUrl)
- }
- this.loadState = true
- }
- getImgInfo(index) {
- return new Promise((resolev, reject) => {
- uni.downloadFile({
- url: `${this.imgPath} (${index}).png`,
- success: (res) => {
- resolev(res.tempFilePath)
- },
- fail(err) {
- reject(err)
- }
- })
- })
- }
- }
- export default GetTickImg
|