123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = {
- data() {
- return {
- title: "jxst",
- // url: 'http://139.9.102.170:10012/#/',
- url: "http://121.37.194.75:20011/#/",
- src: "",
- canBack: false
- };
- },
- onBackPress() {
- return false;
- },
- onReady() {
- },
- onLoad() {
- var height = 0;
- common_vendor.index.getSystemInfo({
- //成功获取的回调函数,返回值为系统信息
- success: (sysinfo) => {
- console.log(sysinfo);
- height = sysinfo.windowHeight;
- },
- complete: () => {
- }
- });
- let info = common_vendor.index.getSystemInfoSync();
- let top = info.statusBarHeight;
- console.log(info, 12312312312);
- var currentWebview = this.$scope.$getAppWebview();
- setTimeout(function() {
- var wv = currentWebview.children()[0];
- wv.setStyle({
- //设置web-view距离顶部的距离以及自己的高度,单位为px
- top,
- //此处是距离顶部的高度,应该是你页面的头部
- // bottom:0,//防止输入框被软键盘遮挡
- height: height - top,
- //webview的高度
- scalable: false
- //webview的页面是否可以缩放,双指放大缩小
- });
- }, 1e3);
- common_vendor.index.$on("connectStatusChange", (connectStatus) => {
- if (connectStatus) {
- var currentWebview2 = this.$scope.$getAppWebview();
- var wv = currentWebview2.children()[0];
- jpushModule.getRegistrationID((result) => {
- console.log(result, "注册ID.....");
- wv.evalJS(`getVueMessage(${JSON.stringify(result.registerID)})`);
- });
- }
- });
- },
- onUnload() {
- common_vendor.index.$off("connectStatusChange");
- },
- methods: {
- messageData(e) {
- const data = e.detail.data;
- var currentWebview = this.$scope.$getAppWebview();
- var wv = currentWebview.children()[0];
- if (data[0].type == "file") {
- let url = data[0].url;
- common_vendor.index.downloadFile({
- url,
- // 文件的下载链接
- success: function(res) {
- if (res.statusCode === 200) {
- common_vendor.index.openDocument({
- filePath: res.tempFilePath,
- success: function(res2) {
- },
- fail: function(error) {
- }
- });
- }
- },
- fail: function(error) {
- }
- });
- } else if (data[0].type == "scanCode") {
- common_vendor.index.scanCode({
- success: (res) => {
- wv.evalJS(`getVueMessage(${JSON.stringify(res.result)})`);
- }
- });
- }
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: $data.url,
- b: common_vendor.o((...args) => $options.messageData && $options.messageData(...args))
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "D:/uni-fans-mobile/pages/index/index.vue"]]);
- wx.createPage(MiniProgramPage);
|