3 changed files with 149 additions and 0 deletions
@ -0,0 +1,40 @@ |
|||||
|
"use strict"; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
exports.config = exports.apiUrl = exports.getApiUrl = void 0; |
||||
|
function getApiUrl(forceEnv) { |
||||
|
if (forceEnv === void 0) { forceEnv = ""; } |
||||
|
var mpConfig = wx.getAccountInfoSync()["miniProgram"]; |
||||
|
var envVersion = typeof mpConfig.envVersion !== "undefined" |
||||
|
? mpConfig.envVersion |
||||
|
: "release"; |
||||
|
if (forceEnv === "develop" || (!forceEnv && envVersion === "develop")) { |
||||
|
return "http://58.59.63.11:8888/api/"; |
||||
|
//老产品开发环境
|
||||
|
// return "http://192.168.1.140/api/";
|
||||
|
} |
||||
|
else if (forceEnv === "trial" || (!forceEnv && envVersion === "trial")) { |
||||
|
return "http://58.59.63.11:8888/api/"; |
||||
|
} |
||||
|
else { |
||||
|
var extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}; |
||||
|
if (extConfig.extAppid) { |
||||
|
if (extConfig.extAppid == "wx2f89f36484439d54") { |
||||
|
return "https://epmet-cloud-py.elinkservice.cn/api/"; |
||||
|
} |
||||
|
else if (extConfig.extAppid == "wxb50debf05ff2461e") { |
||||
|
return "https://epmet-panshi.elinkservice.cn/api/"; |
||||
|
} if (extConfig.extAppid == "wx281af2aaef82f411") { |
||||
|
return "https://zhsq.shuzirizhao.cn/api/"; |
||||
|
} |
||||
|
} |
||||
|
return "https://epmet-cloud.elinkservice.cn/api/"; |
||||
|
} |
||||
|
} |
||||
|
exports.getApiUrl = getApiUrl; |
||||
|
exports.apiUrl = getApiUrl(""); |
||||
|
exports.config = { |
||||
|
apiUrl: exports.apiUrl, |
||||
|
qqMapKey: "FEEBZ-ZQALK-QH2JI-A3VIV-M4IAH-UBBNG", |
||||
|
qqMapSKey: "i6GBTClsHhl2VKAGMy4UNquNTLkrXrTg", |
||||
|
}; |
||||
|
exports.default = exports.config; |
@ -0,0 +1,74 @@ |
|||||
|
"use strict"; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
var config_1 = require("./config"); |
||||
|
var words_1 = require("./words"); |
||||
|
function request(_a) { |
||||
|
var method = _a.method, url = _a.url, _b = _a.options, options = _b === void 0 ? {} : _b, _c = _a.ifToken, ifToken = _c === void 0 ? true : _c; |
||||
|
return new Promise(function (resolve, reject) { |
||||
|
var header = {}; |
||||
|
if (ifToken) { |
||||
|
header = { |
||||
|
'Content-Type': 'application/json; charset=UTF-8', |
||||
|
'Authorization': wx.getStorageSync('token') |
||||
|
}; |
||||
|
} |
||||
|
else { |
||||
|
header = { |
||||
|
'Content-Type': 'application/json; charset=UTF-8' |
||||
|
}; |
||||
|
} |
||||
|
wx.request({ |
||||
|
url: "" + config_1.config.apiUrl + url, |
||||
|
method: method, |
||||
|
data: method === 'GET' ? options : JSON.stringify(options), |
||||
|
header: header, |
||||
|
success: function (response) { |
||||
|
if (response.statusCode === 200) { |
||||
|
if (response.data.code === 0) { |
||||
|
resolve(response.data); |
||||
|
} |
||||
|
else { |
||||
|
var _a = response.data, code = _a.code, msg = _a.msg; |
||||
|
if (code == 10005 || code == 10006 || code == 10007) { |
||||
|
console.log("登录失效"); |
||||
|
getApp().toGuidePageAfterHint(); |
||||
|
} |
||||
|
else if (code < 10000 && code >= 8000) { |
||||
|
wx.showToast({ |
||||
|
title: msg, |
||||
|
icon: "none", |
||||
|
duration: 3000, |
||||
|
}); |
||||
|
} |
||||
|
else if (code != 0) { |
||||
|
wx.showToast({ |
||||
|
title: words_1.default.common.requestFail, |
||||
|
icon: "none", |
||||
|
duration: 1500, |
||||
|
}); |
||||
|
} |
||||
|
console.log('response.data', response.data); |
||||
|
reject(response.data); |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
wx.showToast({ |
||||
|
title: '无法完成请求,请重新尝试。', |
||||
|
icon: 'none', |
||||
|
duration: 3000 |
||||
|
}); |
||||
|
reject(false); |
||||
|
} |
||||
|
}, |
||||
|
fail: function (err) { |
||||
|
wx.showToast({ |
||||
|
title: '网络不给力,请稍后重试', |
||||
|
icon: 'none', |
||||
|
duration: 3000 |
||||
|
}); |
||||
|
reject(err); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
exports.default = request; |
@ -0,0 +1,35 @@ |
|||||
|
"use strict"; |
||||
|
Object.defineProperty(exports, "__esModule", { value: true }); |
||||
|
exports.default = { |
||||
|
common: { |
||||
|
requestFail: "无法完成请求,请重新尝试", |
||||
|
networkError: "网络不给力,请稍后再试", |
||||
|
saveSuccess: "保存成功", |
||||
|
submitting: "正在提交", |
||||
|
submitSuccess: "提交成功" |
||||
|
}, |
||||
|
communistRegister: { |
||||
|
submitSuccess: "注册成功", |
||||
|
step1Fail: "注册失败", |
||||
|
step1FailBtn: "去修改", |
||||
|
step1FailMsg: "您好,您目前的党组织关系可能不在当前街道,请补充您的党组织关系,我们将进行人工审核,谢谢", |
||||
|
submit2Success: "党员信息已提交成功,请等待后台审核" |
||||
|
}, |
||||
|
residentRegister: { |
||||
|
appliedHint: "" |
||||
|
}, |
||||
|
activistRegister: { |
||||
|
noResiHintTitle: "请先完善居民信息", |
||||
|
noResiHintMsg: "", |
||||
|
noResiHintBtn: "去完善", |
||||
|
submitSuccess: "您的信息已提交成功,请等待后台审核" |
||||
|
}, |
||||
|
message: { |
||||
|
readDel: '删除已读', |
||||
|
readAll: "清除未读", |
||||
|
readAllSuccess: "清除成功" |
||||
|
}, |
||||
|
topic: { |
||||
|
vote: "您至少需要加入一个小组,才可以投票" |
||||
|
} |
||||
|
}; |
Loading…
Reference in new issue