zoukankan      html  css  js  c++  java
  • Ionic+AngularJS 开发的页面在微信公众号下显示不出来原因查究

    ionic 页面 微信浏览器遇到的坑

    公司的微信公众号一部分页面是用AngularJS+Ioinc开发,发现在本地浏览器测试的时候都没问题,传到服务器在微信公众号下跑就出问题来,经查是:

    index-tab页面  406 not accessable http请求头问题

     1 $httpProvider.interceptors.push(function() {
     2         return {
     3             "request": function(config) {
     4                 //console.log(config.url);
     5                 if (config.url && config.url.lastIndexOf(".html") > 1) {
     6                     config.headers["Content-Type"] = "text/html; charset=utf=8";
     7                     config.headers["Accept"] = "*/*";
     8                 }
     9                 if (window.sessionStorage.getItem("sessionId")) {
    10                     config.headers['sessionId'] = window.sessionStorage.getItem("sessionId");
    11                 }
    12                 return config;
    13             },
    14             "response": function(res) {
    15                 if (res.config.url && !res.config.url.lastIndexOf(".html")) {
    16                     // console.log(res.data);
    17                     /*if (res.data.errorCode == '550') {
    18                        window.location.href = "#/weblogin";
    19                     }*/
    20                 }
    21                 return res;
    22             }
    23         }
    24     });

    上面的sessionStorage不是必须配置。

  • 相关阅读:
    防抖函数
    锁屏功能
    配置编译环境和线上环境之间的切换
    vue-router中的滚动行为
    axios的再次封装
    Anaconda 镜像配置
    Python 包管理工具 pip 与 conda
    Anaconda 安装与卸载
    VS Code 配置和使用
    解决 VS Code 无法使用Ctrl+C等快捷键
  • 原文地址:https://www.cnblogs.com/thomaspha/p/6535006.html
Copyright © 2011-2022 走看看