Commit 4735acca authored by caimeng's avatar caimeng

修改提交

parent cde25617
......@@ -10,6 +10,9 @@ dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
unpackage/
.history
.hbuilderx
# Editor directories and files
.project
......@@ -22,4 +25,3 @@ yarn-error.log*
*.sw*
.history
.DS_Store
/unpackage
<script>
import { convertPromise ,initHeaderInfo} from './utils/header.js'
import Permission from '@/js_sdk/wa-permission/permission'
import { SelectLocation } from "./utils/authPerission";
import { SelectLocation } from "./utils/authPerission";
import silentlyAppUpdate from '@/pages/app-update/js-sdk/silentlyAppUpdate'
export default {
onLaunch: function() {
const common = uni.getStorageSync("m-headers")
if (!common && plus.os.name=='iOS') {
console.log(plus.os.name,'9')
this.loadDevice();
this.loadNetwork();
this.loadLocation();
this.loadUuid()
}
let versionNumber
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo){
if(wgtinfo.version){
versionNumber = wgtinfo.version;
}else{
versionNumber = plus.runtime.version;
}
console.log(versionNumber,'versionNumber')
uni.setStorageSync('version',versionNumber)
})
onLaunch: function() {
const common = uni.getStorageSync("m-headers")
if (!common && plus.os.name=='iOS') {
this.loadDevice();
this.loadNetwork();
this.loadLocation();
this.loadUuid()
}
let versionNumber
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo){
if(wgtinfo.version){
versionNumber = wgtinfo.version;
}else{
versionNumber = plus.runtime.version;
}
uni.setStorageSync('version',versionNumber)
})
// 强制竖屏
plus.screen.lockOrientation("portrait-primary")
/*** tabbar*/
this.switchShowTabbar()
//app更新版本
silentlyAppUpdate()
const isAgree = uni.getStorageSync('m-agreement')
if (isAgree && plus.os.name=='iOS') {
silentlyAppUpdate()
}
// this.getAppVersion()
console.log('App Launch')
/*** tabbar*/
this.switchShowTabbar()
//app更新版本
// silentlyAppUpdate()
const isAgree = uni.getStorageSync('m-agreement')
if (isAgree && plus.os.name ==='iOS') {
silentlyAppUpdate()
}
},
methods:{
getAppVersion(){
const self=this
uni.getSystemInfo({
success: (res) => {
let platform = res.platform;
// 获取本机版本号
let type;
platform === "android" ? (type = "ANDROID") : (type = "IOS");
self.$request(`/pawn/setting/other/appVersion/${type}`,'GET').then(res => {
if (res.success==true) {
let response = res.result.data;
let result = {};
result.versionCode = response.version;
result.versionName = response.versionName;
result.versionInfo = response.content || "暂无";
result.forceUpdate = response.forceUpdate;
result.downloadUrl = response.downloadUrl;
result.is_silently = response.is_silently || false;
result.platform = platform;
result.storeList = response.storeList || '';
result.title = response.title || '';
result.type = response.type || '';
uni.setStorageSync('appVersion-info',result)
// resolve(result);
}
})
}
});
},
//tab的信息
switchShowTabbar(){
const token=uni.getStorageSync('token')
if (!token) {
console.log(token,'tokentab')
uni.setTabBarItem({
index: 1,
visible: false
})
} else {
const self=this
self.$request('/pawn/setting/other/switch/loan','GET').then(res => {
const {data}=res.result
if (res.code == 200 && data == true) {
try {
console.log(data,'显示')
uni.setTabBarItem({
index: 1,
text: '贷款',
visible: true,
})
} catch (error) {
console.log(error);
}
} else {
console.log(data,'隐藏')
uni.setTabBarItem({
index: 1,
visible: false
})
}
})
}
methods:{
getAppVersion(){
const self=this
uni.getSystemInfo({
success: (res) => {
let platform = res.platform;
// 获取本机版本号
let type;
platform === "android" ? (type = "ANDROID") : (type = "IOS");
self.$request(`/pawn/setting/other/appVersion/${type}`,'GET').then(res => {
if (res.success==true) {
let response = res.result.data;
let result = {};
result.versionCode = response.version;
result.versionName = response.versionName;
result.versionInfo = response.content || "暂无";
result.forceUpdate = response.forceUpdate;
result.downloadUrl = response.downloadUrl;
result.is_silently = response.is_silently || false;
result.platform = platform;
result.storeList = response.storeList || '';
result.title = response.title || '';
result.type = response.type || '';
uni.setStorageSync('appVersion-info',result)
// resolve(result);
}
})
}
});
},
//tab的信息
switchShowTabbar(){
const token=uni.getStorageSync('token')
if (!token) {
uni.setTabBarItem({
index: 1,
visible: false
})
} else {
const self=this
self.$request('/pawn/setting/other/switch/loan','GET').then(res => {
const {data}=res.result
if (res.code == 200 && data == true) {
try {
uni.setTabBarItem({
index: 1,
text: '贷款',
visible: true,
})
} catch (error) {
console.log(error);
}
} else {
console.log(data,'隐藏')
uni.setTabBarItem({
index: 1,
visible: false
})
}
})
}
},
// 获取common当中的设备信息
loadDevice: function() {
......@@ -130,7 +125,7 @@
key: 'm-device-info',
data: JSON.stringify(deviceInfo),
success: function() {
console.log('m-device-info存储成功');
// console.log('m-device-info存储成功');
}
});
}).catch(err => {
......@@ -160,7 +155,7 @@
key: 'm-network-info',
data: JSON.stringify(networkInfo),
success: function() {
console.log('m-network-info存储成功');
// console.log('m-network-info存储成功');
}
});
}).catch(err => {
......@@ -179,7 +174,7 @@
key: 'm-load-udid',
data: JSON.stringify(deviceInfo),
success: function() {
console.log('uuid存储成功');
// console.log('uuid存储成功');
}
})
},
......@@ -206,7 +201,7 @@
key: 'm-location-info',
data: JSON.stringify(locationInfo),
success: function() {
console.log('m-location-info存储成功');
// console.log('m-location-info存储成功');
}
});
}).catch(err => {
......@@ -215,19 +210,11 @@
})
})
}
},
onShow: function() {
console.log(2,'App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style >
<style >
/*每个页面公共css */
</style>
......@@ -47,8 +47,6 @@ let env = process.env.VUE_APP_BASE_NODE_ENV
env = "development";
// #endif
console.log("env", env);
const api = {
common: BASE[env].common,
buyer: BASE[env].buyer,
......
......@@ -45,7 +45,7 @@ function judgeIosPermissionLocation() {
var cllocationManger = plus.ios.import("CLLocationManager");
var status = cllocationManger.authorizationStatus();
result = (status != 2)
console.log("定位权限开启:" + result);
// console.log("定位权限开启:" + result);
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
/* var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
......
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"enablePullDownRefresh": false,
"navigationStyle": "custom",
"app-plus": {
"bounce": "none"
}
}
}
}
},
{
"path": "pages/sort/index",
......@@ -182,8 +182,8 @@
}
}
}
],
],
"tabBar": {
"borderStyle": "white",
"color": "#BBBBBB",
......@@ -233,5 +233,5 @@
"pages/my/index"
],
"resToLogin":true
}
}
}
page{
background: transparent;
}
.page-agreement{
position: relative;
width: 100vw;
......
......@@ -82,8 +82,7 @@ export default {
const { protocol,phone }=res.result
if(protocol){
const protocolList=JSON.parse(protocol)
protocolList.map((item)=>{
console.log(item,'item9')
protocolList.map((item)=>{
if(item.protocolName=='隐私协议'){
self.protocols=item
}else if(item.protocolName=='用户服务协议'){
......
This diff is collapsed.
......@@ -33,21 +33,19 @@ export const compare = (v1 = '0', v2 = '0') => {
return result;
}
export default function silentlyAppUpdate() {
// const checkVersion=uni.getStorageSync('appVersion-info')
// console.log(checkVersion,'checkVersion')
// plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
// if (compare(checkVersion.versionName, wgtinfo.version) === 1) {
// uni.redirectTo({
// url: "/pages/app-update/index",
// })
// }
export default function silentlyAppUpdate() {
// const checkVersion=uni.getStorageSync('appVersion-info')
// console.log(checkVersion,'checkVersion')
// plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
// if (compare(checkVersion.versionName, wgtinfo.version) === 1) {
// uni.redirectTo({
// url: "/pages/app-update/index",
// })
// }
// });
checkVersion().then(res => {
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
checkVersion().then(res => {
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
if (compare(res.versionName, wgtinfo.version) === 1) {
uni.redirectTo({
url: "/pages/app-update/index",
......@@ -77,7 +75,7 @@ export default function silentlyAppUpdate() {
// })
// }
// });
// dtask.start();
// }
......
......@@ -111,8 +111,7 @@
onReady() {
const systemInfo = uni.getSystemInfoSync();
if(systemInfo.platform === 'ios'){
const isAgree = uni.getStorageSync('m-agreement')
console.log(isAgree,'isAgree1')
const isAgree = uni.getStorageSync('m-agreement')
if (!isAgree) {
console.log(isAgree,'isAgree')
this.Go('uni:/pages/agreement/index')
......@@ -246,31 +245,32 @@
searchGood(){
const self=this
const { sort,pageSize,pageNum}=self
const params={
const params={
"current":pageNum,
"size":pageSize,
"sort":sort
}
console.log(params,'查询商品')
self.$request('/pawn/category/getGoodsPage','POST',params).then(res => {
try{
self.$request('/pawn/category/getGoodsPage','POST',params).then(res => {
const {current,total,size,records }=res.result
const hasNextPage=total-self.pageSize*self.pageNum>0?true:false //是否有下一页
if(self.loadFlag){
self.IndexList=self.IndexList.concat(records)
}else{
self.IndexList=records
}
self.hasNextPage=hasNextPage
self.loadFlag=false
}).catch(err=>{
console.log(err,'请求出错')
})
const {current,total,size,records }=res.result
const hasNextPage=total-self.pageSize*self.pageNum>0?true:false //是否有下一页
if(self.loadFlag){
self.IndexList=self.IndexList.concat(records)
}else{
self.IndexList=records
}
self.hasNextPage=hasNextPage
self.loadFlag=false
}catch{
console.log(err,'错误信息')
}
}).catch(err=>{
console.log(err,'请求出错')
})
},
toupperTop:function(e){
console.log(e,'到顶了');
......
var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/index/index","pages/sort/index","pages/my/index","pages/recruit/index","pages/recruitResult/index","pages/category/category","pages/application/application","pages/myneed/myneed","pages/Ineed/Ineed","pages/productDetails/productDetails","pages/detailResult/detailResult","pages/useFeed/useFeed","pages/lookGoods/lookGoods","pages/login/login","pages/prolist/prolist","pages/setting/setting","pages/contact/contact","pages/webview/webview","pages/web/web","pages/bill/indexs","pages/finance/index","pages/app-update/index","pages/agreement/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#FFFFFF","backgroundColor":"#F8F8F8","bounce":"none"},"tabBar":{"borderStyle":"white","color":"#BBBBBB","selectedColor":"#2263E6","iconWidth":"24px","height":"52px","fontSize":"12px","list":[{"pagePath":"pages/index/index","iconPath":"/static/tab/indexfh.png","selectedIconPath":"/static/tab/indexf.png","text":"首页"},{"pagePath":"pages/finance/index","iconPath":"/static/tab/index-h.png","selectedIconPath":"/static/tab/index.png","text":"贷款"},{"pagePath":"pages/bill/indexs","iconPath":"/static/tab/billh.png","selectedIconPath":"/static/tab/bill.png","text":"账单"},{"pagePath":"pages/my/index","iconPath":"/static/tab/my-h.png","selectedIconPath":"/static/tab/my.png","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"多典花","compilerVersion":"4.24","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniConfig = {"pages":["pages/index/index","pages/sort/index","pages/my/index","pages/recruit/index","pages/recruitResult/index","pages/category/category","pages/application/application","pages/myneed/myneed","pages/Ineed/Ineed","pages/productDetails/productDetails","pages/detailResult/detailResult","pages/useFeed/useFeed","pages/lookGoods/lookGoods","pages/login/login","pages/prolist/prolist","pages/setting/setting","pages/contact/contact","pages/webview/webview","pages/web/web","pages/bill/indexs","pages/finance/index","pages/app-update/index","pages/agreement/index"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"uni-app","navigationBarBackgroundColor":"#FFFFFF","backgroundColor":"#F8F8F8","bounce":"none"},"tabBar":{"borderStyle":"white","color":"#BBBBBB","selectedColor":"#2263E6","iconWidth":"24px","height":"52px","fontSize":"12px","list":[{"pagePath":"pages/index/index","iconPath":"/static/tab/indexfh.png","selectedIconPath":"/static/tab/indexf.png","text":"首页"},{"pagePath":"pages/finance/index","iconPath":"/static/tab/index-h.png","selectedIconPath":"/static/tab/index.png","text":"贷款"},{"pagePath":"pages/bill/indexs","iconPath":"/static/tab/billh.png","selectedIconPath":"/static/tab/bill.png","text":"账单"},{"pagePath":"pages/my/index","iconPath":"/static/tab/my-h.png","selectedIconPath":"/static/tab/my.png","text":"我的"}]},"darkmode":false,"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"多典花","compilerVersion":"4.28","entryPagePath":"pages/index/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/index/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom","bounce":"none"}},{"path":"/pages/sort/index","meta":{},"window":{"navigationBarTitleText":"款式"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/recruit/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"鉴定师招聘"}},{"path":"/pages/recruitResult/index","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/category/category","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"选择鉴定品类"}},{"path":"/pages/application/application","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我的鉴定申请"}},{"path":"/pages/myneed/myneed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要的"}},{"path":"/pages/Ineed/Ineed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"我需要"}},{"path":"/pages/productDetails/productDetails","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"商品详情"}},{"path":"/pages/detailResult/detailResult","meta":{},"window":{"enablePullDownRefresh":false,"navigationStyle":"custom"}},{"path":"/pages/useFeed/useFeed","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"用户反馈"}},{"path":"/pages/lookGoods/lookGoods","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/login/login","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"登录"}},{"path":"/pages/prolist/prolist","meta":{},"window":{"navigationBarTitleText":"相关协议"}},{"path":"/pages/setting/setting","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":"设置"}},{"path":"/pages/contact/contact","meta":{},"window":{"navigationBarTitleText":"通讯录","enablePullDownRefresh":false}},{"path":"/pages/webview/webview","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/web/web","meta":{},"window":{"enablePullDownRefresh":false,"navigationBarTitleText":""}},{"path":"/pages/bill/indexs","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"账单"}},{"path":"/pages/finance/index","meta":{"isQuit":true,"isTabBar":true},"window":{"enablePullDownRefresh":true,"navigationStyle":"custom"}},{"path":"/pages/app-update/index","meta":{},"window":{"disableScroll":true,"backgroundColorTop":"transparent","background":"transparent","titleNView":false,"scrollIndicator":false,"animationType":"fade-in","animationDuration":200,"disableSwipeBack":true}},{"path":"/pages/agreement/index","meta":{},"window":{"navigationStyle":"custom","navigationBarTitleText":"","enablePullDownRefresh":false,"bounce":"none","animationType":"fade-in","background":"transparent","backgroundColor":"rgba(0,0,0,0)","webviewBGTransparent":true,"mask":"none"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -107,7 +107,7 @@ export const SelectLocation = async function (callback) {
const platform = uni.getSystemInfoSync();
if (platform.osName === 'ios') {
if (Permission.judgeIosPermission('location')) {
console.log('进入这里了')
// console.log('进入这里了')
callback && callback()
} else {
CheckLocationPermission(callback)
......
import storage from './storage'
import store from '@/store'
import { device } from '@/api/other'
/**
* 设置请求头信息
*/
export function setDevice() {
const info = uni.getSystemInfoSync()
const { appVersion, deviceId, brand, platform, system } = info
let data = {
appKey: 'hhym',
appVersion, // app版本号
deviceId, // 设备号
deviceBrand: brand, // 品牌名称
sourceChannel: store.state.channel,
deviceType: platform, // 设备类型
systemVersion: system, // 系统版本
deviceToken: '', // APP推送标识
iosDeviceToken: '', // iOS推送标识
idfa: '', // 广告标识,iOS必填
mac: '', // mac地址
appPackage: 'com.huahuayoumi.hhym', // APP包名
}
if (platform == 'ios') {
plus.device.getInfo({
//需要勾选IDFA
success: e => {
console.log('getInfo:' + JSON.stringify(e))
return data.idfa = e.idfa
},
fail: err => {
console.log('getDeviceInfo failed: ' + JSON.stringify(err))
},
})
}
// 上传 device系统信息
setTimeout(() => {
try {
device(data).then((res) => {
console.log('res', JSON.stringify(res.data))
})
storage.setDeviceData(data)
} catch (error) {
console.error(error);
}
}, 300)
}
// Android mac地址
function getDeviceMac() {
//获取本机Mac地址
let deviceMac = ''
let net = plus.android.importClass('java.net.NetworkInterface')
let wl0 = net.getByName('wlan0')
let macByte = wl0.getHardwareAddress()
deviceMac = ''
for (let i = 0; i < macByte.length; i++) {
let tmp = ''
let num = macByte[i]
if (num < 0) {
tmp = (255 + num + 1).toString(16)
} else {
tmp = num.toString(16)
}
if (tmp.length == 1) {
tmp = '0' + tmp
}
deviceMac += tmp
}
return deviceMac
}
......@@ -16,27 +16,25 @@ export const convertPromise = function (FnName, params = {}) {
})
});
}
export const initHeaderInfo = function (){
const versionNew=uni.getStorageSync('m-header-version')
let deviceName
if(plus.os.name=='Android'){
deviceName='android'
}else{
deviceName='ios'
}
console.log(plus.os.name,'plus.os.name')
// 根据当前时间戳生成一个随机整数
var randomNum = new Date().getTime();
const commons={
"appName":"DDH",
"appSourceId":"1",
"token":randomNum,
"device":deviceName,
"appVersion":versionNew,
}
console.log(commons,'commons')
return commons
export const initHeaderInfo = function () {
const versionNew = uni.getStorageSync('m-header-version')
let deviceName
if (plus.os.name == 'Android') {
deviceName = 'android'
} else {
deviceName = 'ios'
}
// 根据当前时间戳生成一个随机整数
var randomNum = new Date().getTime();
const commons = {
"appName": "DDH",
"appSourceId": "1",
"token": randomNum,
"device": deviceName,
"appVersion": versionNew,
}
return commons
}
// 初始化请求头的device参数信息
export const initHeaderDevice = function () {
......@@ -59,7 +57,7 @@ export const initHeaderDevice = function () {
const deviceInfo = uni.getStorageSync('m-device-info')
const networkInfo = uni.getStorageSync('m-network-info')
const locationInfo = uni.getStorageSync('m-location-info')
const loadUuid = uni.getStorageSync('m-load-udid')
const loadUuid = uni.getStorageSync('m-load-udid')
let device = {};
if (deviceInfo) {
device = Object.assign(device, common, JSON.parse(deviceInfo))
......@@ -72,15 +70,15 @@ export const initHeaderDevice = function () {
if (locationInfo) {
device = Object.assign(device, common, JSON.parse(locationInfo))
}
if(loadUuid){
device = Object.assign(device, common, JSON.parse(loadUuid))
}
if (deviceInfo && networkInfo && loadUuid) {
if (loadUuid) {
device = Object.assign(device, common, JSON.parse(loadUuid))
}
if (deviceInfo && networkInfo && loadUuid && locationInfo) {
const headerDeviceInfo = {
...JSON.parse(deviceInfo),
...JSON.parse(networkInfo),
...JSON.parse(locationInfo),
...JSON.parse(loadUuid),
...JSON.parse(locationInfo),
...JSON.parse(loadUuid),
...common
}
......@@ -89,7 +87,7 @@ export const initHeaderDevice = function () {
key: 'm-header-device',
data: JSON.stringify(headerDeviceInfo),
success: function () {
console.log('m-header-device存储成功4');
// console.log('m-header-device存储成功4');
}
});
......
import {initHeaderDevice,initHeaderInfo} from './header.js'
import { initHeaderDevice, initHeaderInfo} from './header.js'
import api from '@/config/api.js'
const request=async(url,type,data)=>{
const baseUrl=api.common
const request = async (url, type, data) => {
const baseUrl = api.common
// 这里确保一定是可以获取得到的
const headerDevice = uni.getStorageSync('m-header-device')
const deviceInfo = uni.getStorageSync('m-device-info')
let rd=null
const tokenF=uni.getStorageSync('tokenFinance')
if(!deviceInfo || tokenF=='' && plus.os.name!='iOS'){
rd=initHeaderInfo()
}else{
const tokenF = uni.getStorageSync('tokenFinance')
let rd = null
if (!deviceInfo || tokenF == '' && plus.os.name != 'iOS') {
rd = initHeaderInfo()
} else {
if (headerDevice) {
rd = headerDevice
console.log(rd,'rd1')
} else {
const common = initHeaderDevice()
rd = JSON.stringify(common)
console.log(rd,'rd2')
console.log(common,'日===')
if (common) {
rd = JSON.stringify(common)
}
}
}
console.log(rd,'rd3')
return new Promise((resolve,reject)=>{
const token=uni.getStorageSync('token')
const tokenFinance=uni.getStorageSync('tokenFinance')
return new Promise((resolve, reject) => {
const token = uni.getStorageSync('token')
const tokenFinance = uni.getStorageSync('tokenFinance')
uni.request({
url: baseUrl+url,
method:type,
data: {
...data
},
url: baseUrl + url,
method: type,
data: {
...data
},
header: {
Accept: "application/json;charset=UTF-8",
"Content-Type": "application/json;charset=UTF-8",
device:rd,
Authorization:tokenFinance,//贷超
Author:token,//多典花
device: rd,
Authorization: tokenFinance, //贷超
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')
}else{
uni.showToast({
title: data.message,
icon: "none",
duration: 2000
})
return false
}
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')
} 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)
console.log(res.errMsg, '!200');
return reject({
data,
message: res.errMsg
})
}
},
fail: (err) => {
console.log(err, 954)
// return uni.showToast({
// icon:'loading',
// title:'请求失败'
......@@ -82,7 +86,7 @@ const request=async(url,type,data)=>{
reject(err)
}
});
})
}
......
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