Browse Source

app.js

feature/v2.2
xpz2018 4 years ago
parent
commit
109249efbe
4 changed files with 60 additions and 52 deletions
  1. 40
      app.js
  2. 2
      pages/home/customer-list/index.wxml
  3. 48
      pages/login/index.js
  4. 22
      pages/process/outside-price/index.js

40
app.js

@ -12,7 +12,7 @@ App({
keyboardHeight: 0,
isIos: false
},
onShow: function(){
onShow: function() {
const updateManager = wx.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
@ -22,5 +22,43 @@ App({
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
})
if(this.globalData.Custom){
return
}
wx.getSystemInfo({
success: e => {
this.globalData.isIos = this.checkIos(e)
this.globalData.dev = e.platform == 'devtools'
let custom = wx.getMenuButtonBoundingClientRect()
this.globalData.Custom = custom
// 顶部操作栏高度
this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (this.globalData.isIos ? 4 : 0)
let windowHeight = e.windowHeight * (750 / e.windowWidth)
let safeBottom = e.windowHeight - e.safeArea.bottom
if(safeBottom > e.windowHeight){
safeBottom = 34
}
this.globalData.safeBottom = safeBottom * (750 / e.windowWidth)
// 状态栏高度
this.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth)
let statusBarHeight = this.globalData.CustomBar * (750 / e.windowWidth)
this.globalData.statusBarHeight = statusBarHeight
// fragmentHeight:指的是整个页面statusBarHeight以下的高度
this.globalData.fragmentHeight = windowHeight - statusBarHeight
this.globalData.safeFragmentHeight = windowHeight - statusBarHeight - this.globalData.safeBottom
this.globalData.windowWidth = e.windowWidth
}
})
},
checkIos: function (e) {
if ('ios' === e.platform) {
return true
}
if (e.system.startsWith('iOS')) {
return true
}
return false
}
})

2
pages/home/customer-list/index.wxml

@ -40,7 +40,7 @@
<view slot="action" bind:tap="onChange" style="padding: 0rpx 8rpx" wx:if="{{form.name}}">取消</view>
</van-search>
<scroll-view class="scrollList" scroll-y scroll-into-view="{{scrollViewId}}" style="height:{{height}}rpx">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}" bindtap="onRefreshList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}" bindtap="">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>

48
pages/login/index.js

@ -48,49 +48,13 @@ Page({
this.wxLogin()
},
onReady: function () {
wx.getSystemInfo({
success: e => {
app.globalData.isIos = this.checkIos(e)
app.globalData.dev = e.platform == 'devtools'
let custom = wx.getMenuButtonBoundingClientRect()
app.globalData.Custom = custom
// 顶部操作栏高度
app.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight + (app.globalData.isIos ? 4 : 0)
let windowHeight = e.windowHeight * (750 / e.windowWidth)
let safeBottom = e.windowHeight - e.safeArea.bottom
if(safeBottom > e.windowHeight){
safeBottom = 34
}
app.globalData.safeBottom = safeBottom * (750 / e.windowWidth)
// 状态栏高度
app.globalData.StatusBar = e.statusBarHeight * (750 / e.windowWidth)
let statusBarHeight = app.globalData.CustomBar * (750 / e.windowWidth)
app.globalData.statusBarHeight = statusBarHeight
// fragmentHeight:指的是整个页面statusBarHeight以下的高度
app.globalData.fragmentHeight = windowHeight - statusBarHeight
app.globalData.safeFragmentHeight = windowHeight - statusBarHeight - app.globalData.safeBottom
app.globalData.windowWidth = e.windowWidth
app.globalData.token = app.globalData.token || storage.get('Authorization')
if(this.data.code){
this.fetchQrCode(this.data.code)
} else if(!util.isEmpty(app.globalData.token)){
this.setData({ loging: true})
this.fetchUserInfo(app.globalData.token)
}
}
})
},
checkIos: function (e) {
if ('ios' === e.platform) {
return true
app.globalData.token = app.globalData.token || storage.get('Authorization')
if(this.data.code){
this.fetchQrCode(this.data.code)
} else if(!util.isEmpty(app.globalData.token)){
this.setData({ loging: true})
this.fetchUserInfo(app.globalData.token)
}
if (e.system.startsWith('iOS')) {
return true
}
return false
},
/************************************** 获取用户信息,进行登录 ********************************************/
checkFactoryId: function(storageFactoryId){

22
pages/process/outside-price/index.js

@ -175,14 +175,20 @@ Scene({
this.data.param.scrapPaperReceiptId = this.data.form.scrapPaperReceiptId
this.data.param.weightNoteList = weightNoteList
this.data.param.orderImageList = this.data.form.orderImageList
wx.showLoading({ title: '处理中', mask: true })
poundSideOrder(this.data.param).then(result => {
wx.hideLoading()
util.showBackToast('提交成功')
event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
var that = this
wx.requestSubscribeMessage({
tmplIds: ['DJaSy0a5TNp9v_ICQ0ZY5-hkZ91dEXZuKq_hQVBTnOA'],
complete(res) {
wx.showLoading({ title: '处理中', mask: true })
poundSideOrder(that.data.param).then(result => {
wx.hideLoading()
util.showBackToast('提交成功')
event.emit('OrderMessage', { what: 12, desc: 'pricingOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
})
},
repeatForm: function(){

Loading…
Cancel
Save