提交移动端代码
This commit is contained in:
1 parent
441b47da1a
commit
4b9dbe40fb
113 files changed
+1093
-22121
No files matched your search
@@ -83,9 +83,32 @@ export const request = (options) => {
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
|
||||
// 处理GET请求的params参数
|
||||
let url = REQUEST_CONFIG.baseURL + options.url;
|
||||
if (options.params && Object.keys(options.params).length > 0) {
|
||||
// 将params对象转换为查询字符串
|
||||
const queryString = Object.keys(options.params)
|
||||
.filter((key) => options.params[key] !== undefined && options.params[key] !== null)
|
||||
.map(
|
||||
(key) =>
|
||||
`${encodeURIComponent(key)}=${encodeURIComponent(options.params[key])}`,
|
||||
)
|
||||
.join('&');
|
||||
|
||||
if (queryString) {
|
||||
url += (url.indexOf('?') > -1 ? '&' : '?') + queryString;
|
||||
}
|
||||
|
||||
console.log('🔍 处理GET请求params:', {
|
||||
原始params: options.params,
|
||||
查询字符串: queryString,
|
||||
最终URL: url,
|
||||
});
|
||||
}
|
||||
|
||||
// 处理请求配置
|
||||
const config = {
|
||||
url: REQUEST_CONFIG.baseURL + options.url,
|
||||
url: url,
|
||||
method: options.method || 'GET',
|
||||
data: options.data || {},
|
||||
timeout: options.timeout || REQUEST_CONFIG.timeout,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -553,6 +553,37 @@ class WeChatSDK {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信JS-SDK版本信息
|
||||
* @returns {String} 版本号
|
||||
*/
|
||||
getVersion() {
|
||||
if (typeof wx !== 'undefined' && wx.getWxVersion && typeof wx.getWxVersion === 'function') {
|
||||
try {
|
||||
return wx.getWxVersion();
|
||||
} catch (error) {
|
||||
console.warn('获取微信版本失败:', error);
|
||||
return '无法获取版本';
|
||||
}
|
||||
}
|
||||
return typeof wx !== 'undefined' ? '1.6.0 (推测)' : '未加载';
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用的API列表
|
||||
* @returns {String} 可用API的描述
|
||||
*/
|
||||
getAvailableApis() {
|
||||
if (!this.isInitialized) {
|
||||
return '未初始化';
|
||||
}
|
||||
|
||||
// 返回当前配置的API列表
|
||||
const availableCount = this.jsApiList.length;
|
||||
const mainApis = ['分享', '扫码', '图片选择', '地理位置', '网络状态'];
|
||||
return `${availableCount}个API (${mainApis.join('、')}等)`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一的SDK加载器 - 供其他页面直接使用(简化版)
|
||||
* @returns {Promise<boolean>} 加载结果
|
||||
|
||||
Reference in new issue
Block a user