纸板小程序:订单/送货单:列表与详情功能
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"navigation-bar": "/components/navigation-bar/navigation-bar"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
.page-container {
|
||||
background-image: url('../../assets/images/start_bg.png');
|
||||
background-repeat: no-repeat; /* 禁止重复 */
|
||||
background-size: 100% 106%; /* 宽高铺满容器 */
|
||||
background-position: center; /* 居中显示 */
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import { getAppInstance } from '../../utils/app'
|
||||
import { getCustomerData, getSupplierData } from '../../utils/index'
|
||||
const app = getAppInstance()
|
||||
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
async onLoad() {
|
||||
this.calcInputWidth();
|
||||
const deviceCode = wx.getStorageSync('deviceCode');
|
||||
if (!deviceCode) {
|
||||
const newCode = this.generateRandomString(32); //32位设备码
|
||||
wx.setStorageSync('deviceCode',newCode);
|
||||
}
|
||||
// setTimeout(() => {
|
||||
const userInfo = wx.getStorageSync('userInfo')
|
||||
if (userInfo && userInfo.id) {
|
||||
await getCustomerData();
|
||||
await getSupplierData();
|
||||
|
||||
wx.switchTab({url: '/pages/cardBoardOrder/cardBoardOrder'})
|
||||
// wx.switchTab({url: '/pages/cardBoardDeliveryOrder/cardBoardDeliveryOrder'})
|
||||
}else {
|
||||
wx.navigateTo({url: '/pages/login/login'})
|
||||
}
|
||||
// }, 1000);
|
||||
},
|
||||
// 生成随机码 :设备码
|
||||
generateRandomString(length:Number) {
|
||||
let result = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const charactersLength = characters.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
// 获取input宽度
|
||||
calcInputWidth() {
|
||||
try {
|
||||
// 1. 获取系统信息(屏幕宽度)
|
||||
const systemInfo = wx.getSystemInfoSync()
|
||||
const screenWidth = systemInfo.screenWidth // 屏幕宽度(px)
|
||||
|
||||
// 2. 计算屏幕85%的宽度(保留1位小数,避免像素偏差)
|
||||
const targetWidth = (screenWidth * 0.85).toFixed(1);
|
||||
const targetWidthW = (screenWidth * 0.95).toFixed(1);
|
||||
|
||||
app.globalData.inputWidth = Number(targetWidth);
|
||||
app.globalData.inputWidthW = Number(targetWidthW);
|
||||
|
||||
// const rect = wx.getMenuButtonBoundingClientRect()
|
||||
// wx.getSystemInfo({
|
||||
// success: res => {
|
||||
// app.globalData.safeAreaTop = res.safeArea.top + 56
|
||||
// }
|
||||
// })
|
||||
} catch (err) {
|
||||
// 异常默认值(300px)
|
||||
app.globalData.inputWidth = 300;
|
||||
app.globalData.inputWidthW = 330;
|
||||
console.error('获取屏幕宽度失败:', err);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
<!--index.wxml-->
|
||||
<!-- <navigation-bar title="Weixin" back="{{false}}" color="black" background="#FFF"></navigation-bar> -->
|
||||
<view class="page-container">
|
||||
<image src="../../assets/images/start_bg.png" mode="widthFix" style="width: 100%;height: 100%;"/>
|
||||
</view>
|
||||
Reference in New Issue
Block a user