// index.js // 获取应用实例 import { VueLikePage } from "../../utils/page"; import { CDN_URL, API_BASE_URL, VIDEO_BASE_URL } from "../../config/index"; var g_app = getApp(); VueLikePage([], { data: { cdn_url: CDN_URL, baseUrl: API_BASE_URL + "/", url_link: "", id: "", type: "", loadCompele: false, }, methods: { onLoad: function (options) { let { rdw, id, type } = options; let link = ""; if (type == "0") { link = `${VIDEO_BASE_URL}4dvedio/${rdw}.mp4`; } else { link = `${VIDEO_BASE_URL}4dpic/${rdw}.jpg`; } this.setData({ url_link: link, id, type, }); }, loadcompele() { this.setData({ loadCompele: true, }); }, cancel() { // wx.reLaunch({ // url: "/pages/work/index", // }); wx.navigateBack(); }, saveAlbum() { let type = this.data.type; wx.showLoading({ title: "保存中…", mask: true, }); if (g_app.globalData.m_file) { let api = type == "0" ? "saveVideoToPhotosAlbum" : "saveImageToPhotosAlbum"; wx[api]({ filePath: g_app.globalData.m_file, success() { wx.showModal({ title: "提示", content: "已保存到相册,快去分享吧", showCancel: false, }); }, fail: (e) => { if (!(e.errMsg.indexOf('cancel')>-1)) { wx.showModal({ title: "提示", content: "保存失败,请稍后再试", showCancel: false, }); } }, complete: () => { wx.hideLoading(); }, }); } // let link = this.data.url_link; // wx.downloadFile({ // url: link, // success: function (res) { // var tempFilePath = res.tempFilePath; // }, // fail: function (res) { // wx.showModal({ // title:'提示', // content:'下载失败,请稍后再试', // showCancel:false // }) // wx.hideLoading() // } // }); }, }, });