diff --git a/app.js b/app.js index 35786b8..9105118 100644 --- a/app.js +++ b/app.js @@ -22,12 +22,21 @@ App({ const that = this; // 获取系统信息 - const systemInfo = wx.getSystemInfoSync(); + // const systemInfo = wx.getSystemInfoSync(); + + const windowInfo = wx.getWindowInfo() + + // 胶囊按钮位置信息 const menuButtonInfo = wx.getMenuButtonBoundingClientRect(); // 导航栏高度 = 状态栏高度 + 44 - that.globalData.navBarHeight = systemInfo.statusBarHeight + 44; - that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right; + // that.globalData.navBarHeight = systemInfo.statusBarHeight + 44; + that.globalData.navBarHeight = windowInfo.statusBarHeight + 44; + // that.globalData.menuRight = systemInfo.screenWidth - menuButtonInfo.right; + that.globalData.menuRight = windowInfo.screenWidth - menuButtonInfo.right; + + + that.globalData.menuTop = menuButtonInfo.top; that.globalData.menuHeight = menuButtonInfo.height; diff --git a/pages/details/details.js b/pages/details/details.js index c5939d7..228b74d 100644 --- a/pages/details/details.js +++ b/pages/details/details.js @@ -1,4 +1,10 @@ // pages/details/details.js + + +const request = require('../../utils/request') +const ui = require('../../utils/ui') +const wxParse = require("../../wxParse/wxParse.js"); + Page({ /** @@ -6,15 +12,127 @@ Page({ */ data: { + navTitle: "详情", + date: "", + title: "", + content: "", + aid: 0, + isDow: false, + ext_download_link: "" }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + let that = this; + if (!options.aid) { + wx.navigateBack() + this.triggerEvent('onBack') + } + that.setData({ + aid: options.aid + }) + that.GetDetailsInfo() + console.log(options); + // }, + initContent() { + let that = this; + console.log(that.data.content); + if (that.data.content.length > 0) { + wxParse.wxParse('content', 'html', that.data.content, that, 0); + } + }, + + + GetDetailsInfo() { + let that = this; + request.request({ + method: "GET", + // https://app.19year.cn/api.php/doc/details?id=51 + url: "/api.php/doc/details?id=" + that.data.aid + }).then(res => { + if (res.data.code === 1) { + + that.setData({ + title: res.data.data.title, + date: res.data.data.date, + content: res.data.data.content, + ext_download_link: res.data.data.ext_download_link, + }) + if (res.data.data.ext_download_link.length > 0) { + that.setData({ + isDow: true + }) + } + that.initContent() + } + }).catch(err => { + console.log('ERROR') + }); + }, + + + downloadFileOpen() { + let that = this; + let link = that.data.ext_download_link + wx.setClipboardData({ + data: link, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + wx.showToast({ + title: '复制成功' + }) + } + }) + } + }) + + + + + //复制到剪切板 + // wx.setClipboardData({ + // data: link, + // success(res) { + // console.log('copy success'); + // //获取剪切板的纸 + // // wx.getClipboardData({ + // // success(res) { + // // console.log(res) // data + // // that.copyContent = res.data + // // } + // // }) + // } + // }) + + + + // wx.showLoading({ + // title: '下载中', + // }) + //下载文件 + // wx.downloadFile({ + // url: link, + // success (res) { + // if (res.statusCode === 200) { + // const filePath = res.tempFilePath + // wx.openDocument({ + // filePath: filePath, + // showMenu:true, //关键点 + // success: function (res) { + // console.log('打开文档成功') + // } + // }) + // } + // } + // }) + }, + + /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/details/details.wxml b/pages/details/details.wxml index a166b47..0aafd73 100644 --- a/pages/details/details.wxml +++ b/pages/details/details.wxml @@ -1,19 +1,24 @@ - + + + + - 快速操作手册试用版 - 2024.08.14 15:26 + {{title}} + {{date}} - 北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。北京欧华莱菌科技有限公司自1993年创建以来在中国市场推广超声波封口焊接设备,致力于传播先进技术,为众多的国内大型知名企业提供高品质焊接技术,成为中国企业走向世界舞台不可或缺的坚实后盾。先后为中国的制冷业,汽车制造业,电子元器件,塑料件,手机电池及汽车气囊业提供各类先进的焊接设备提供及时优质的条件保障和售后服务,为客户在生产效率及成本控制上作出巨大贡献,得到广大用户的认可,取得客户的信任并得到广泛的应用,伴随中国驰名品牌的发展而发展,成长而成长。经过我们不懈的努力,30多年来国内使用我公司提供的设备和技术的公司达到80多家,目前有超过500台各类设备在国内的制冷及其他领域广泛使用。 + + +