|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- // pages/transaction/receipt/receipt.js
- import * as UTIL from '../../../utils/util.js';
- import * as API from '../../../utils/API.js';
- let EVN_CONFIG = require('../../../env/env');
-
- const app = getApp();
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- isIPX: app.globalData.isIPX,
- url:''
- },
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let url = options.url;
-
- var that = this ;
-
- console.log(wx.getStorageSync('dressCode') + url);
-
- wx.downloadFile({
- url: wx.getStorageSync('dressCode') + url,//pdf地址 例如:http://**.*****.***/ceshi/demo.pdf
- success(res) {
- if (res.statusCode === 200) {
- const tempFilePath = res.tempFilePath//返回的文件临时地址,用于后面打开本地预览所用
- console.log(res);
- if (tempFilePath.indexOf("pdf") < 0) {
- that.setData({
- url:wx.getStorageSync('dressCode') + url
- })
- }else{
- wx.openDocument({
- filePath: tempFilePath,
- showMenu: true,
- fileType: "pdf",
- success: function (res) {}
- })
- }
-
- }
- }
- })
-
- },
- back:function(){
- wx.navigateBack({
- delta: 1
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
-
- }
- })
|