| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- // index.js
- // 获取应用实例
- const app = getApp()
- import {
- VueLikePage
- } from '../../utils/page'
- import {
- CDN_URL
- } from '../../config/index'
- import {
- isPhoneX
- } from './../../utils/tools'
- import Router from '../../utils/routes'
- VueLikePage([], {
- data: {
- cdn_url: CDN_URL,
- },
- methods: {
- onLoad: function (options) {
- let {
- vr_link
- } = options
- this.setData({
- vr_link
- })
- isPhoneX().then(res => {
- this.setData({
- isIphoneX: res
- })
- })
- },
- saveAlbum(e) {
- const { type } = e.currentTarget.dataset
- console.log(type);
- let img = this.data.vr_link
- wx.showLoading({
- title: '保存中…',
- mask: true
- });
- wx.downloadFile({
- url: img,
- type: 'image',
- success: function (res) {
- var tempFilePath = res.tempFilePath;
- wx.saveImageToPhotosAlbum({
- filePath: tempFilePath,
- success(res) {
- wx.showModal({
- title: '保存成功',
- showCancel: false,
- complete:()=>{
- Router.redirectTo({
- url:'select'
- })
- }
-
- });
- },
- fail: (err) => {
- wx.showModal({
- title: '保存失败,请稍后再试',
- });
- },
- complete: () => {
- wx.hideLoading();
- }
- })
- },
- fail: function (res) {
- wx.showModal({
- title: '下载失败,请稍后再试',
- });
- wx.hideLoading();
- }
- });
- },
- back(){
- Router.back()
- }
- }
- })
|