123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- // index.js
- // 获取应用实例
- const app = getApp()
- import {
- VueLikePage
- } from '../../utils/page'
- import {
- CDN_URL,API_BASE_URL,IMGSTR
- } from '../../config/index'
- import {
- isPhoneX
- } from './../../utils/tools'
- import Router from '../../utils/routes'
- VueLikePage([], {
- data: {
- cdn_url: CDN_URL,
- baseUrl: API_BASE_URL+'/'
- },
- methods: {
- onLoad: function (options) {
- let {
- vr_link,
- id
- } = options
-
- this.setData({
- vr_link,
- id,
- show_img: this.data.baseUrl + vr_link + IMGSTR.normal
- })
- isPhoneX().then(res => {
- this.setData({
- isIphoneX: res
- })
- })
- },
- loadcompele(){
- this.setData({
- loadCompele: true
- })
- },
- saveAlbum(e) {
- const { type } = e.currentTarget.dataset
- let img = this.data.baseUrl + this.data.vr_link + (!type?IMGSTR.normal:IMGSTR.qrcode)
- 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: type?'已保存,快去分享吧':'已保存到相册',
- showCancel: false,
- complete:()=>{
- }
- });
- },
- fail: (err) => {
- wx.showModal({
- title: '保存失败,请稍后再试',
- });
- },
- complete: () => {
- wx.hideLoading();
- }
- })
- },
- fail: function (res) {
- wx.showModal({
- title: '下载失败,请稍后再试',
- });
- wx.hideLoading();
- }
- });
- },
- back(){
- wx.navigateBack({
- delta: 1
- })
- // Router.redirectTo({
- // url:'camera',
- // query:{
- // id:this.data.id
- // }
- // })
- },
- backtoexample(){
- wx.navigateBack({
- delta: 2
- })
- // Router.redirectTo({
- // url:'example',
- // query:{
- // id:this.data.id
- // }
- // })
- }
- }
- })
|