|
@@ -6,13 +6,13 @@ import Qs from 'qs';
|
|
|
import request from '../utils/request'
|
|
|
export function addSysLog(message) {
|
|
|
|
|
|
- return request({
|
|
|
- url: '/mobile/sysLogApi/submit',
|
|
|
- data: Qs.stringify({
|
|
|
- message:JSON.stringify(message)
|
|
|
- }),
|
|
|
- method: 'post',
|
|
|
- })
|
|
|
+ return request({
|
|
|
+ url: '/mobile/sysLogApi/submit',
|
|
|
+ data: Qs.stringify({
|
|
|
+ message: JSON.stringify(message)
|
|
|
+ }),
|
|
|
+ method: 'post',
|
|
|
+ })
|
|
|
}
|
|
|
//获取微信配置
|
|
|
export function getWxConfig(jsApiList) {
|
|
@@ -48,27 +48,42 @@ export function getWxConfig(jsApiList) {
|
|
|
}
|
|
|
|
|
|
//选择图片
|
|
|
-export function chooseImage() {
|
|
|
+export function chooseImage(count) {
|
|
|
+ var count = count || 1;
|
|
|
let promise = new Promise((resolve, reject) => {
|
|
|
wx.chooseImage({
|
|
|
- count: 1,
|
|
|
+ count: count,
|
|
|
sizeType: ['compressed'],
|
|
|
sourceType: ['album', 'camera'],
|
|
|
success: function(res) {
|
|
|
var localIds = res.localIds;
|
|
|
console.log(localIds);
|
|
|
- wx.getLocalImgData({
|
|
|
- localId: localIds[0],
|
|
|
- success: function(res) {
|
|
|
- resolve(res);
|
|
|
- }
|
|
|
- });
|
|
|
+ if (count == 1) {
|
|
|
+ wx.getLocalImgData({
|
|
|
+ localId: localIds[0],
|
|
|
+ success: function(res) {
|
|
|
+ resolve(res);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ resolve(localIds);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
return promise;
|
|
|
}
|
|
|
|
|
|
+//获取图片
|
|
|
+export function getLocalImgData(localId, fun) {
|
|
|
+ wx.getLocalImgData({
|
|
|
+ localId: localId,
|
|
|
+ success: function(res) {
|
|
|
+ fun(res);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
//上传图片
|
|
|
export function uploadPic(imgBase64) {
|
|
|
let promise = new Promise((resolve, reject) => {
|
|
@@ -98,25 +113,25 @@ export function getLocation() {
|
|
|
success: function(res) {
|
|
|
resolve(res);
|
|
|
},
|
|
|
- faile: function(res) {
|
|
|
- reject(res);
|
|
|
- },
|
|
|
+ faile: function(res) {
|
|
|
+ reject(res);
|
|
|
+ },
|
|
|
fail: function(res) {
|
|
|
- if(res.errMsg=='getLocation:timeout'){
|
|
|
- mui.alert("定位超时,请检查是否开启'定位'");
|
|
|
- }else if(res.errMsg=='getLocation:ERROR_NETWORK'){
|
|
|
- mui.alert("网络异常");
|
|
|
- }else if(res.errMsg=='getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF'){
|
|
|
- mui.alert("没开启系统定位");
|
|
|
- }else if(res.errMsg=='getLocation:system permission denied'){
|
|
|
- mui.alert("未给微信位置授权");
|
|
|
- }else if(res.errMsg=='getLocation:location permission'){
|
|
|
- mui.alert("未给微信位置授权");
|
|
|
- }else if(res.errMsg=='getLocation:auth denied'){
|
|
|
- mui.alert("用户在小程序中未授权");
|
|
|
- }else if(res.errMsg=='getLocation:fail authorize no response'){
|
|
|
- mui.alert("用户在小程序中未授权");
|
|
|
- }
|
|
|
+ if (res.errMsg == 'getLocation:timeout') {
|
|
|
+ mui.alert("定位超时,请检查是否开启'定位'");
|
|
|
+ } else if (res.errMsg == 'getLocation:ERROR_NETWORK') {
|
|
|
+ mui.alert("网络异常");
|
|
|
+ } else if (res.errMsg == 'getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
|
|
|
+ mui.alert("没开启系统定位");
|
|
|
+ } else if (res.errMsg == 'getLocation:system permission denied') {
|
|
|
+ mui.alert("未给微信位置授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:location permission') {
|
|
|
+ mui.alert("未给微信位置授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:auth denied') {
|
|
|
+ mui.alert("用户在小程序中未授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:fail authorize no response') {
|
|
|
+ mui.alert("用户在小程序中未授权");
|
|
|
+ }
|
|
|
reject(res);
|
|
|
},
|
|
|
complete() {}
|
|
@@ -140,26 +155,26 @@ export function scanQRCode(needResult) {
|
|
|
faile: function(res) {
|
|
|
reject(res);
|
|
|
},
|
|
|
- fail: function(res) {
|
|
|
+ fail: function(res) {
|
|
|
|
|
|
|
|
|
- if(res.errMsg=='getLocation:timeout'){
|
|
|
- mui.alert("定位超时,请检查是否开启'定位'");
|
|
|
- }else if(res.errMsg=='getLocation:ERROR_NETWORK'){
|
|
|
- mui.alert("网络异常");
|
|
|
- }else if(res.errMsg=='getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF'){
|
|
|
- mui.alert("没开启系统定位");
|
|
|
- }else if(res.errMsg=='getLocation:system permission denied'){
|
|
|
- mui.alert("未给微信位置授权");
|
|
|
- }else if(res.errMsg=='getLocation:location permission'){
|
|
|
- mui.alert("未给微信位置授权");
|
|
|
- }else if(res.errMsg=='getLocation:auth denied'){
|
|
|
- mui.alert("用户在小程序中未授权");
|
|
|
- }else if(res.errMsg=='getLocation:fail authorize no response'){
|
|
|
- mui.alert("用户在小程序中未授权");
|
|
|
- }
|
|
|
- reject(res);
|
|
|
- },
|
|
|
+ if (res.errMsg == 'getLocation:timeout') {
|
|
|
+ mui.alert("定位超时,请检查是否开启'定位'");
|
|
|
+ } else if (res.errMsg == 'getLocation:ERROR_NETWORK') {
|
|
|
+ mui.alert("网络异常");
|
|
|
+ } else if (res.errMsg == 'getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
|
|
|
+ mui.alert("没开启系统定位");
|
|
|
+ } else if (res.errMsg == 'getLocation:system permission denied') {
|
|
|
+ mui.alert("未给微信位置授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:location permission') {
|
|
|
+ mui.alert("未给微信位置授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:auth denied') {
|
|
|
+ mui.alert("用户在小程序中未授权");
|
|
|
+ } else if (res.errMsg == 'getLocation:fail authorize no response') {
|
|
|
+ mui.alert("用户在小程序中未授权");
|
|
|
+ }
|
|
|
+ reject(res);
|
|
|
+ },
|
|
|
complete() {}
|
|
|
})
|
|
|
});
|