npm package: @mohun/uni-weixin
Description: Method library generated by Uniapp combined with WeChat mini program.
Author: LiuMouLiang
Latest version: 1.0.3

# uni-weixin

文档请参考：[微信官方文档](https://developers.weixin.qq.com/miniprogram/dev/api/) [uni-app官方文档](https://uniapp.dcloud.net.cn/uhttps://uniapp.dcloud.net.cn/api/)
 
## API
**Date**: 2017-11-23  
**Author**: liumouliang  
### new API(getRequeData, getSuccessData)
<p>请求函数</p>


| Param | Type | Description |
| --- | --- | --- |
| getRequeData | <code>function</code> | <p>请求处理函数</p> |
| getSuccessData | <code>function</code> | <p>成功处理函数</p> |

**Example**  
```javascript
//封装
export const getApiUrl = function(route){
    return APIURL[route] || route;
};
const apis = new API({
    getApiUrl,
    isLoading, //加载动画
    getRequeData:function(requedata,hasSessionId){
        if(hasSessionId){
            requedata['appId'] = APP_ID;
            requedata['token'] = getCookie('mpToken');
        };
        return requedata;
    },
    getSuccessData:function(res,resolve, reject){
        if(res.data){
            let data = res.data;
            if(data.code===200 && data.success) resolve(data.data);
            else reject(data);
        }else reject(res);
    }
});

export const $request = apis.$request
export const $get = apis.$get;
export const $post = apis.$post;

//使用
this.$post('family/save',params).then(data => {
    wxToast('保存成功');
    if(data.familyId) this.familyId = data.familyId;
    this.wxNavito(data.id);
}).catch((err)=>{
    this.saveLoading = false;
    wxToast(err.info || '保存失败');
});
```
## \_request(url, requedata, method, apiObj) ⇒ <code>Promise</code>
<p>内置小程序请求</p>

**Date**: 2017-11-23  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| url | <code>String</code> | <p>请求地址</p> |
| requedata | <code>Object</code> | <p>请求数据</p> |
| method | <code>String</code> | <p>默认get</p> |
| apiObj | <code>Object</code> | <p>微信API</p> |

**Example**  
```javascript
// 文档参考： https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html
_request(url, requedata = {}, method = 'GET', apiObj = {})
```
## \_downloadFile(url, apis) ⇒ <code>Promise</code>
<p>下载文件</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| url | <code>String</code> | 
| apis | <code>Object</code> | 

**Example**  
```javascript
_downloadFile(url)
```

## setRemoteImgInfo(data, callback)
<p>批量替换远程图片为本地</p>

**Date**: 2021-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> \| <code>Array</code> \| <code>String</code> | <p>处理数据</p> |
| callback | <code>function</code> | <p>成功回调</p> |

**Example**  
```javascript
export const setRemoteImgInfo = function (...arg) {
    // 添加缓存记录
    // if(!window.$$global.RemoteImgInfo) window.$$global.RemoteImgInfo = {}
    // let RemoteImgInfo = window.$$global.RemoteImgInfo;
    return _for(arg, (_) => _setRemoteImgInfo(_));
};
setRemoteImgInfo({'err':'https://'})
setRemoteImgInfo(["https://"])
setRemoteImgInfo("https://")
```
## uploadImage(tempFilePaths, _uploadFile) ⇒ <code>Promise</code>
<p>上传图片</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| tempFilePaths | <code>Array</code> | <p>本地路径</p> |
| _uploadFile | <code>function</code> | <p>上传方法</p> |

**Example**  
```javascript
// 只适用于服务器一张张上传的情况，
// 多文件参数的可以直接chooseImage后赋值就行
export const _uploadFile = function uploadFile(filePath) {
    return new Promise((resolve, reject) => {
        return uni.uploadFile({
            url: `${API_PATH}/storage/upload`,
            filePath: filePath,
            name: "file",
            header: {
                // "Content-Type": "multipart/form-data",
            },
            success: (res) => {
                const _res = _toJson(res.data);
                if (_res.errno == 0) {
                    const url = _res.data.url;
                    if (url) {
                        resolve(url);
                    } else {
                        warning('接口上传错误-解析图片url失败，',_res.data);
                        reject(_res);
                    }
                }
            },
            fail: (err) => {
                warning('上传文件接口错误');
                reject(err);
            },
        });
    });
};
```

## Locals : <code>Object</code>
<p>本地缓存</p>

## get(key) ⇒ <code>\*</code>
<p>获取</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| key | <code>String</code> | 

**Example**  
```javascript
Locals.get()
```
## set(key, value)
<p>设置</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| key | <code>String</code> | 
| value | <code>\*</code> | 

**Example**  
```javascript
Locals.set
```
## remove(key) ⇒ <code>\*</code>
<p>移除</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| key | <code>String</code> | 

**Example**  
```javascript
Locals.remove
```
## clear(key) ⇒ <code>\*</code>
<p>清空或移除</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| key | <code>String</code> | 

**Example**  
```javascript
Locals.clear
```
## keys() ⇒ <code>Object</code>
<p>缓存信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  
**Example**  
```javascript
Locals.info()
```
## local(key, value) ⇒ <code>\*</code>
<p>简化缓存</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| key | <code>String</code> |  |
| value | <code>\*</code> | <p>值</p> |

**Example**  
```javascript
local(key, null)
```

## stopLocationInfo() ⇒ <code>any</code>
<p>停止LocationUpdate定位监听</p>

**Date**: 2017-11-23  
**Author**: liumouliang  
**Example**  
```javascript
stopLocationInfo()
```
## startLocationInfo(callBack, type) ⇒ <code>any</code>
<p>开始LocationUpdate定位监听</p>

**Date**: 2017-11-23  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| callBack | <code>function</code> | <p>回调</p> |
| type | <code>String</code> | <p>定位类型</p> |

**Example**  
```javascript
startLocationInfo(()=>{})
```
## getLocationInfo(callBack, type) ⇒ <code>any</code>
<p>getLocation封装</p>

**Date**: 2017-11-23  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| callBack | <code>function</code> | <p>回调</p> |
| type | <code>String</code> | <p>定位类型</p> |

**Example**  
```javascript
startLocationInfo() {
    const authInfo = setGlobalAuthInfo(authKey);
    if(authInfo && authInfo.longitude && authInfo.latitude) return this._startLocationInfo(authInfo)
    return getLocationInfo((res, flag) => {
        if (flag) {
            setGlobalAuthInfo((authInfo)=>{
                authInfo[authKey] = res;
                return authInfo;
            })
            return this._startLocationInfo(res);
        } else {
            this._reset();
            return tipMassage("请设置微信获取定位权限");
        }
    });
},
```

## logManager : <code>Object</code>
<p>日志管理</p>

**Example**  
```javascript
this.info()
this.warn()
this.error()
this.setMsg() // 从基础库2.7.3开始支持
this.addMsg() // 从基础库2.8.1开始支持
```
## setLog(tag, arg)
<p>自定义日志</p>

**Date**: 2017-11-23  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| tag | <code>String</code> | <p>自定义使用日志的类型</p> |
| arg | <code>Array</code> | <p>多个自定义参数</p> |

**Example**  
```javascript
setLog('warn', '发布发生异常=== ' + code, statusCode[code]);
```
## trace() ⇒ <code>null</code>
<p>正常日志</p>

**Date**: 2017-11-23  
**Author**: liumouliang  
**Example**  
```javascript
//调试+正常日志
trace(arguments)
```
## warning() ⇒ <code>null</code>
<p>错误日志</p>

**Date**: 2017-11-23  
**Author**: liumouliang  
**Example**  
```javascript
//调试+错误日志
warning(arguments)
```

## SceneType : <code>Object</code>
<p>微信小程序完整场景值枚举</p>

## getSceneKey(scene) ⇒ <code>String</code>
<p>获取场景类型Key</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
getSceneKey(1007)
```
## getSceneDesc(scene) ⇒ <code>String</code>
<p>获取场景类型中文描述</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
getSceneDesc(1007)
```
## isFromShare(scene) ⇒ <code>Boolean</code>
<p>判断是否从分享进入</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
isFromShare(1007)
```
## isFromCode(scene) ⇒ <code>Boolean</code>
<p>判断是否从二维码/码类进入</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
isFromCode(1007)
```
## isFromOfficial(scene) ⇒ <code>Boolean</code>
<p>判断是否从官方入口进入</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
isFromOfficial(1007)
```
## isFromChannel(scene) ⇒ <code>Boolean</code>
<p>判断是否从视频号相关场景进入</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
isFromChannel(1007)
```
## isFromMiniProgram(scene) ⇒ <code>Boolean</code>
<p>判断是否从小程序间跳转进入</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| scene | <code>String</code> \| <code>Number</code> | 

**Example**  
```javascript
isFromMiniProgram(1007)
```

## wxClipData(data) ⇒ <code>Promise</code>
<p>复制内容</p>

**Date**: 2017-11-23  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>String</code> | <p>复制内容</p> |

**Example**  
```javascript
// 隐私 = 读取你的剪切板
// https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html
wxClipData(data)
```

## \_saveImageToPhotosAlbum(files) ⇒ <code>Promise</code>
<p>保存图片到相册</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| files | <code>File</code> | <p>临时文件对象</p> |

**Example**  
```javascript
_saveImageToPhotosAlbum(data).then()
```
## wxSaveImage(files) ⇒ <code>Promise</code>
<p>下载图片并保存到相册</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| files | <code>Object</code> \| <code>String</code> | <p>远程链接 || 本地文件{tempFilePath}</p> |

**Example**  
```javascript
wxSaveImage()
```

## \_showShareImageMenu(files) ⇒ <code>Promise</code>
<p>分享图片-本地路径</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| files | <code>Object</code> | 

**Example**  
```javascript
_showShareImageMenu(files)
```
## wxShareImag(files) ⇒ <code>Promise</code>
<p>分享图片到好友菜单</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| files | <code>Object</code> \| <code>String</code> | 

**Example**  
```javascript
wxShareImag(url)
```

## \_uploadFile(filePath) ⇒ <code>Promise</code>
<p>上传文件-请求服务端</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| filePath | <code>File</code> | 

**Example**  
```javascript
_uploadFile(filePath)
```
## \_uploadPhoto(tempFilePaths) ⇒ <code>Promise</code>
<p>本地文件上传到服务器</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| tempFilePaths | <code>\*</code> | <p>临时文件路径</p> |

**Example**  
```javascript
_uploadPhoto(tempFilePaths)
```
## uploadPhoto(count, apis, chooseFN) ⇒ <code>Promise</code>
<p>选择图片并上传</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| count | <code>Number</code> |  |
| apis | <code>Object</code> |  |
| chooseFN | <code>function</code> | <p>选择后处理函数</p> |

**Example**  
```javascript
uploadPhoto(3)
```

## setInitEnvExternal(apis, [externalKey])
<p>设置初始信息 - 额外配置信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| apis | <code>Object</code> | 
| [externalKey] | <code>String</code> | 

**Example**  
```javascript
setInitEnvExternal({}, '')
```
## setStorage(key, [value])
<p>设置配置的缓存</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| key | <code>String</code> | 
| [value] | <code>\*</code> | 

**Example**  
```javascript
setStorage()
```
## getTempStorage(tempKey, idKey, targetValue) ⇒ <code>\*</code>
<p>页面中获取临时缓存数据</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| tempKey | <code>String</code> | 
| idKey | <code>String</code> | 
| targetValue | <code>\*</code> | 

**Example**  
```javascript
[1,2,3,{"id":"77"}]
console.log('getTempStorage',getTempStorage('lml','3.id', 77));
```
## getOneObjData(obj, resInfo) ⇒ <code>Object</code>
<p>新对象赋值</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| obj | <code>Object</code> | 
| resInfo | <code>Object</code> | 

**Example**  
```javascript
getOneObjData()
```
## numToChinese(num) ⇒ <code>String</code>
<p>通过传入数字转换为中文的数字</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| num | <code>Number</code> | 

**Example**  
```javascript
numToChinese(123)
```
## getSettledValue(data, key) ⇒ <code>\*</code>
<p>获取 promiseAllSettled 的对应值</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| data | <code>\*</code> | 
| key | <code>String</code> | 

**Example**  
```javascript
this.setData_userInfo(this.$comApi.getSettledValue(data, 'userInfo'));
```
## setConfigSystemInfo(systemInfo)
<p>设置配置信息-系统信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| systemInfo | <code>Object</code> | 

**Example**  
```javascript
setConfigSystemInfo(systemInfo)
```
## setConfigPlatform(platform)
<p>设置配置信息-平台环境</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| platform | <code>String</code> | 

**Example**  
```javascript
setConfigPlatform('web')
```
## setConfigLogId(logId)
<p>设置配置信息-日志id</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| logId | <code>String</code> | 

**Example**  
```javascript
setConfigLogId();
```
## setConfigConfirmColor(confirmColor)
<p>设置配置信息-通用对话框确认颜色</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| confirmColor | <code>String</code> | 

**Example**  
```javascript
setConfigConfirmColor(COLORS.red);
```
## getRequestData(res, key) ⇒ <code>Object</code>
<p>获取请求成功后的数据</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| res | <code>Object</code> | 
| key | <code>String</code> | 

**Example**  
```javascript
getRequestData(res)
```
## parseSceneParams(sceneStr, keyName) ⇒ <code>\*</code>
<p>根据二维码传递的参数获取对应的值</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| sceneStr | <code>String</code> | <p>二维码参数</p> |
| keyName | <code>String</code> | <p>读取的参数</p> |

**Example**  
```javascript
shareUserId = parseSceneParams(scene, 'shareUserId')
```
## getPageUrl(urlKey) ⇒ <code>String</code>
<p>设置配置的页面地址</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| urlKey | <code>String</code> | 

**Example**  
```javascript
getPageUrl('home')
```
## imgSrc(url, defaultKey) ⇒ <code>String</code>
<p>设置远程图片地址</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| url | <code>String</code> |  |
| defaultKey | <code>String</code> | <p>默认图片</p> |

**Example**  
```javascript
imgSrc('', 'avatarUrl')
```
## setObjImgSrc(objData)
<p>批量设置图片远程域名</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| objData | <code>Object</code> | 

**Example**  
```javascript
const icons = {
    gender: [,'88u6b4ulrecz1w6y7dw8.png','hn8a6b7t0b5fidgmfhft.png'],
    id: [,'bl2le16tftus1mxwgk29.png','i5r4ugsjd8hka9eqcaxx.png'],
    refresh: '1wle1rkmcuj78l2xxifg.png',
};
setObjImgSrc(icons);
```
## getErrMsg(err, defaultInfo) ⇒ <code>String</code>
<p>获取错误信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| err | <code>Object</code> |  |
| defaultInfo | <code>String</code> | <p>默认错误信息</p> |

**Example**  
```javascript
let errMsg =  this.$comApi.getErrMsg(err, '验证码发送失败');
```
## setInitEnv(newConfig, external)
<p>设置初始化环境</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| newConfig | <code>Object</code> | <p>新config信息</p> |
| external | <code>Object</code> | <p>额外配置信息</p> |

**Example**  
```javascript
setInitEnv()
```

## judge(outModel) ⇒ <code>Promise</code>
<p>获取运行环境</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| outModel | <code>String</code> | <p>额外参数</p> |

**Example**  
```javascript
wxapp-微信小程序
aliapp-支付宝小程序
web-纯浏览器
webview

增加参数outModel，默认不传为最细化，传入情况下isInapp为需要检测是否为app内的webview，isWeb为最宽松判断只判断是否打包时就是H5
参数payEnv，调用支付渠道时需要时传入，判断是否为浏览器的环境，如在ios和android的webview环境中返回相应的字段，在手机或者pc端的浏览器真机模拟中返回为h5，不传返回为web
```
## checkToPath(url, isExit) ⇒ <code>String</code>
<p>检查跳转的页面地址</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| url | <code>String</code> |  |
| isExit | <code>Boolean</code> | <p>是否退出当前页面</p> |

**Example**  
```javascript
checkToPath(url);
```
## getToPath(url, isPage, params) ⇒ <code>String</code>
<p>获取正确的跳转地址</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| url | <code>String</code> |  |
| isPage | <code>Boolean</code> | <p>是否优先查询配置页面</p> |
| params | <code>Object</code> | <p>页面参数</p> |

**Example**  
```javascript
url = getToPath(url, isPage, params);
```
## to(url, isPage, params) ⇒ <code>\*</code>
<p>跳转页面</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| url | <code>String</code> | 
| isPage | <code>Boolean</code> | 
| params | <code>Object</code> | 

**Example**  
```javascript
to()
```
## rdt(url, isPage, params) ⇒ <code>\*</code>
<p>关闭当前页面并跳转</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| url | <code>String</code> | 
| isPage | <code>\*</code> | 
| params | <code>Object</code> | 

**Example**  
```javascript
rdt()
```
## closeNavPages(url, params, delta) ⇒ <code>\*</code>
<p>小程序关闭上一个和当前页面并跳转</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| url | <code>String</code> |  |
| params | <code>Object</code> |  |
| delta | <code>Number</code> | <p>[description]</p> |

**Example**  
```javascript
closeNavPages('inviteDetail',{
    id: data,
});
```
## \_setUserInfo(data)
<p>对接口返回的用户信息进行解析赋值</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| data | <code>Object</code> | 

**Example**  
```javascript
_setUserInfo();
```
## setUserInfo() ⇒ <code>Promise</code>
<p>设置用户信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  
**Example**  
```javascript
setUserInfo();
```
## getUserInfo() ⇒ <code>Promise</code>
<p>获取用户信息</p>

**Date**: 2022-12-22  
**Author**: liumouliang  
**Example**  
```javascript
getUserInfo();
```
## getSceneParamKey(options, nameKey) ⇒ <code>String</code>
<p>从页面参数中获取scene二维码中的参数</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | <p>页面参数</p> |
| nameKey | <code>String</code> |  |

**Example**  
```javascript
# 缓存页面传参，如果没有就置空
# 销毁场景：
经测试，从不同的分享进入不会触发onLaunch事件
getSceneParamKey(options, 'shareUserId')
```
## longpress\_saveImage(imgSrc, title) ⇒ <code>Promise</code>
<p>长按保存图片到相册</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| imgSrc | <code>String</code> | <p>远程图片地址</p> |
| title | <code>String</code> | <p>文件名</p> |

**Example**  
```javascript
longpress_saveImage()
```

## \_default
<p>额外的配置信息</p>


## toLogin(params, isExit, loginPage) ⇒ <code>\*</code>
<p>跳转到登录页面</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| params | <code>Object</code> |  |
| isExit | <code>Boolean</code> |  |
| loginPage | <code>String</code> | <p>登录地址</p> |

**Example**  
```javascript
toLogin();
```
## exitLogin(backData, isExit) ⇒ <code>Promise</code>
<p>退出登录</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| backData | <code>\*</code> | <p>退出地址</p> |
| isExit | <code>Boolean</code> |  |

**Example**  
```javascript
exitLogin(1);
```
## $request(args) ⇒ <code>\*</code>
<p>请求方法</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type | Description |
| --- | --- | --- |
| args | <code>\*</code> | <p>请求参数</p> |

**Example**  
```javascript
$request();
```

## isPageInstance(vm) ⇒ <code>Boolean</code>
<p>判断是否为页面实例</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| vm | <code>\*</code> | 

**Example**  
```javascript
const testCases = [
    { $options: { mpType: 'page', __file: 'src/pages/home.vue' }, $route: {} }, // true
    { $options: { mpType: 'component', __file: 'src/components/header.vue' }, $route: {} }, // false
    { $options: { __file: 'src/pages/user/index.vue' }, $route: {} }, // true
    { $options: { __file: 'src\\pages\\login.vue' }, $route: {} }, // true
    { $options: { __file: 'pages/settings.vue' }, $route: {} }, // true
    { $options: { __file: 'components/button.vue' }, $route: {} }, // false
    { $options: { mpType: 'page' } }, // true
    { $options: { mpType: 'component' } }, // false
    { $options: { __file: 'src/views/home.vue' }, $route: {} }, // false
    { $route: {} }, // false
    {}, // false
];

testCases.forEach((testCase, index) => {
    console.log(`Test case ${index + 1}:`, isPageInstance(testCase));
});
```
## navigateBack(data, errKey) ⇒ <code>Promise</code>
<p>多环境下的返回上一页</p>

**Date**: 2022-12-22  
**Author**: liumouliang  

| Param | Type |
| --- | --- |
| data | <code>Number</code> | 
| errKey | <code>String</code> | 

**Example**  
```javascript
navigateBack()
```