From 20b11236b4364034f52df294b9240776f539ede1 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 16 七月 2024 14:49:01 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/zbomyoujia
---
wechat_staff/utils/request.js | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/wechat_staff/utils/request.js b/wechat_staff/utils/request.js
new file mode 100644
index 0000000..374f9cc
--- /dev/null
+++ b/wechat_staff/utils/request.js
@@ -0,0 +1,28 @@
+import { baseUrl } from "./config"
+
+export function request(options){
+ return new Promise(resolve => {
+ wx.request({
+ url: baseUrl + options.url,
+ data: options.options || {},
+ method: options.method || "GET",
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ },
+ timeout: 12000,
+ success: (res) => {
+ if (res.code === 0) {
+ // res.msg && toast(res.msg)
+ resolve(res.data || true)
+ } else {
+ res.msg && toast(res.msg || '鍙戠敓閿欒', 'none')
+ resolve(res.data || false)
+ }
+ },
+ fail() {
+ wxToast('缃戠粶閿欒', 'none')
+ }
+ })
+ } )
+}
+
--
Gitblit v1.9.3