Commit 26b95d10 authored by ly's avatar ly

线上环境

parent 471a1ff8
import {initHeaderDevice} from './header.js'
const request=async(url,type,data)=>{
const baseUrl='http://112.124.25.186:8089' //测试
// const baseUrl='https://api.taimedias.com'//线上
// 这里确保一定是可以获取得到的
const headerDevice = uni.getStorageSync('m-header-device')
let rd = null;
if (headerDevice) {
rd = headerDevice
} else {
const common = initHeaderDevice()
rd = JSON.stringify(common)
}
// console.log(rd,'rd')
return new Promise((resolve,reject)=>{
const token=uni.getStorageSync('token')
uni.request({
url: baseUrl+url,
method:type,
data: {
...data
},
header: {
Accept: "application/json;charset=UTF-8",
"Content-Type": "application/json;charset=UTF-8",
device:rd,
Authorization:token,
Author:token,
},
success: (res) => {
const {data, statusCode} = res;
if (statusCode === 200) {
if (data.success==true) {
return resolve(data)
} else {
if(data.code=='403'){
console.log(res,'402');
uni.showToast({
title: data.message,
icon: "none",
duration: 2000
})
uni.removeStorageSync('token')
// this.Go('uni:/pages/login/login')
}else{
uni.showToast({
title: data.message,
icon: "none",
duration: 2000
})
return false
}
}
} else {
console.log(res.errMsg,'!200');
return reject({
data,
message: res.errMsg
})
}
},
fail:(err)=> {
console.log(err,954)
return uni.showToast({
icon:'loading',
title:'请求失败'
})
reject(err)
}
});
})
}
export default request;
\ No newline at end of file
import {initHeaderDevice} from './header.js'
const request=async(url,type,data)=>{
// const baseUrl='http://112.124.25.186:8089' //测试
const baseUrl='http://api.yyhock.com'//线上
// 这里确保一定是可以获取得到的
const headerDevice = uni.getStorageSync('m-header-device')
let rd = null;
if (headerDevice) {
rd = headerDevice
} else {
const common = initHeaderDevice()
rd = JSON.stringify(common)
}
// console.log(rd,'rd')
return new Promise((resolve,reject)=>{
const token=uni.getStorageSync('token')
uni.request({
url: baseUrl+url,
method:type,
data: {
...data
},
header: {
Accept: "application/json;charset=UTF-8",
"Content-Type": "application/json;charset=UTF-8",
device:rd,
Authorization:token,
Author:token,
},
success: (res) => {
const {data, statusCode} = res;
if (statusCode === 200) {
if (data.success==true) {
return resolve(data)
} else {
if(data.code=='403'){
console.log(res,'402');
uni.showToast({
title: data.message,
icon: "none",
duration: 2000
})
uni.removeStorageSync('token')
// this.Go('uni:/pages/login/login')
}else{
uni.showToast({
title: data.message,
icon: "none",
duration: 2000
})
return false
}
}
} else {
console.log(res.errMsg,'!200');
return reject({
data,
message: res.errMsg
})
}
},
fail:(err)=> {
console.log(err,954)
return uni.showToast({
icon:'loading',
title:'请求失败'
})
reject(err)
}
});
})
}
export default request;
\ No newline at end of file
......@@ -99,9 +99,9 @@
},
onPageScroll(e) {
// 页面滚动时设置isFixed和scrollTop
// console.log(e,'876')
console.log(e.scrollTop,'876')
this.scrollTop = e.scrollTop;
if( e.scrollTop > this.headerHeight){
if( e.scrollTop > 220){
this.isFixed = true;
}else{
this.isFixed = false;
......@@ -117,11 +117,11 @@
const token=uni.getStorageSync('token')
this.token=token
// 获取头部的高度
const query = uni.createSelectorQuery().in(this);
query.select('.i-header').boundingClientRect(data => {
console.log(data.height,'98767')
this.headerHeight = data.height;
}).exec();
// const query = uni.createSelectorQuery().in(this);
// query.select('.i-header').boundingClientRect(data => {
// console.log(data.height,'98767')
// this.headerHeight = data.height;
// }).exec();
this.init()
this.searchGood()
},
......
This diff is collapsed.
import {initHeaderDevice} from './header.js'
const request=async(url,type,data)=>{
const baseUrl='http://112.124.25.186:8089' //测试
// const baseUrl='https://api.taimedias.com'//线上
// const baseUrl='http://112.124.25.186:8089' //测试
const baseUrl='https://api.yyhock.com'//线上
// 这里确保一定是可以获取得到的
const headerDevice = uni.getStorageSync('m-header-device')
let rd = null;
......@@ -12,7 +12,7 @@ const request=async(url,type,data)=>{
rd = JSON.stringify(common)
}
// console.log(rd,'rd')
console.log(baseUrl,'rd')
return new Promise((resolve,reject)=>{
const token=uni.getStorageSync('token')
uni.request({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment