add: 两个接口getSession、getConfig;新增非压缩build版本

This commit is contained in:
ivinwu
2018-09-24 10:36:20 +08:00
parent a8d3ea7078
commit 529654e932
4 changed files with 761 additions and 12 deletions

View File

@@ -74,7 +74,6 @@ weRequest.request({
当本地没有登录态时,按照流程图,`weRequest`将会自动执行`wx.login()`后的一系列流程,得到`code`并调用后台接口换取`session`储存在localStorage之后重新发起业务请求。
对应的流程为下图中**红色**的指向:
![没有登录态时,自动登录](https://raw.githubusercontent.com/IvinWu/weRequest/master/image/flow2.png)
### 登录态过期时,自动重新登录
@@ -254,6 +253,16 @@ weRequest.request({
|showLoading|Boolean|否|false|请求过程页面是否展示全屏的loading|是|
|report|String|否||接口请求成功后将自动执行init()中配置的reportCGI函数其中的name字段值为这里配置的值|是|
### .getSession()
[return String]
获取本地缓存中用户票据的值
### .getConfig()
[return Object]
获取weRequest的配置。目前Object仅包含urlPerfix字段
### .login()
<font color=red>[不建议使用]</font> 在不发起业务请求的情况下,单独执行登录逻辑

File diff suppressed because one or more lines are too long

1
build/weRequest.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,22 @@
var path = require('path');
module.exports = {
//mode: 'development',
mode: 'production',
entry: './src/weRequest.js',
module.exports = [{
mode: 'production',
entry: './src/weRequest.js',
output: {
path: path.join(__dirname, 'build'),
filename: 'weRequest.js',
library: "weRequest",
path: path.join(__dirname, 'build'),
filename: 'weRequest.min.js',
library: "weRequest",
libraryTarget: "commonjs-module"
},
//devtool: 'inline-source-map'
}
},
}, {
mode: 'development',
entry: './src/weRequest.js',
output: {
path: path.join(__dirname, 'build'),
filename: 'weRequest.js',
library: "weRequest",
libraryTarget: "commonjs-module"
},
devtool: 'inline-source-map'
}]