| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // const BASE_URL='http://8.136.98.49:8002'
- let BASE_URL = 'http://192.168.1.112:8002'
- export const myRequest=(options)=>{
- BASE_URL=uni.getStorageSync('http')
- if(BASE_URL==''){
- BASE_URL = 'http://192.168.1.17:12345'
- }
- // BASE_URL = 'http://192.168.1.77:8002'
- console.log(BASE_URL)
- var session_key=""
- session_key=uni.getStorageSync('session_key')
- let url=options.url
- let data=options.data||{}
- if (url != 'sysmenage.usermanager.user_login' && url != 'pest.pests.insect_discern') {
- data.token=session_key
- }
-
- return new Promise((resolve,reject)=>{
- uni.request({
- url:BASE_URL+options.url,
- method:options.method||'POST',
- header:{
- "Content-Type": "application/x-www-form-urlencoded",
- },
- data:data,
- success:(res)=>{
- if(res.data.message!=""){
- return uni.showToast({
- title:res.data.message,
- icon:"none"
- })
- }
- resolve(res.data.data)
- },
- fail:(err)=>{
- uni.showToast({
- title:'请求接口失败'
- })
- reject(err)
- }
- })
- })
- }
|