修改打包配置、登录、打包模式页面
This commit is contained in:
parent
c1d9277c86
commit
9330c71e75
3
env.js
3
env.js
@ -1,3 +1,4 @@
|
||||
export const BASE_URL = 'http://192.168.11.56:6060' //后台根域名 https://demo.shopro.top
|
||||
// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const API_URL = `${BASE_URL}/system` //后台接口域名
|
||||
export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss
|
||||
|
||||
70
src/App.vue
70
src/App.vue
@ -1,10 +1,74 @@
|
||||
<script>
|
||||
// rem 基准:以 1920×1280 设计稿为准,100px = 1rem,按宽高取小(contain)缩放
|
||||
const DESIGN_WIDTH = 1920
|
||||
const DESIGN_HEIGHT = 1280
|
||||
const BASE_FONT_SIZE = 100
|
||||
// 整体缩放系数:<1 整体缩小,>1 整体放大(布局偏大就调小这个值)
|
||||
const REM_SCALE = 0.45
|
||||
|
||||
function logScreenInfo () {
|
||||
try {
|
||||
const info = uni.getSystemInfoSync()
|
||||
console.log('[screen] uni =', JSON.stringify({
|
||||
screenWidth: info.screenWidth,
|
||||
screenHeight: info.screenHeight,
|
||||
windowWidth: info.windowWidth,
|
||||
windowHeight: info.windowHeight,
|
||||
pixelRatio: info.pixelRatio,
|
||||
platform: info.platform,
|
||||
statusBarHeight: info.statusBarHeight,
|
||||
safeArea: info.safeArea
|
||||
}))
|
||||
} catch (e) {
|
||||
console.log('[screen] uni 失败 =', JSON.stringify(e))
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
try {
|
||||
console.log('[screen] plus.screen =', JSON.stringify({
|
||||
resolutionWidth: plus.screen.resolutionWidth,
|
||||
resolutionHeight: plus.screen.resolutionHeight,
|
||||
scale: plus.screen.scale,
|
||||
dpiX: plus.screen.dpiX,
|
||||
dpiY: plus.screen.dpiY
|
||||
}))
|
||||
} catch (e) {
|
||||
console.log('[screen] plus.screen 失败 =', JSON.stringify(e))
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
function setRemBase () {
|
||||
// #ifdef H5
|
||||
if (typeof document !== 'undefined' && document.documentElement) {
|
||||
const docEl = document.documentElement
|
||||
const width = docEl.clientWidth || window.innerWidth || DESIGN_WIDTH
|
||||
const height = docEl.clientHeight || window.innerHeight || DESIGN_HEIGHT
|
||||
const scale = Math.min(width / DESIGN_WIDTH, height / DESIGN_HEIGHT)
|
||||
docEl.style.fontSize = (scale * BASE_FONT_SIZE * REM_SCALE) + 'px'
|
||||
console.log('[rem] html fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale)
|
||||
console.log('[screen-h5] screenWidth =', window.screen.width, 'screenHeight =', window.screen.height,
|
||||
'availWidth =', window.screen.availWidth, 'availHeight =', window.screen.availHeight,
|
||||
'devicePixelRatio =', window.devicePixelRatio)
|
||||
console.log('[viewport-h5] clientWidth =', width, 'clientHeight =', height,
|
||||
'innerWidth =', window.innerWidth, 'innerHeight =', window.innerHeight)
|
||||
}
|
||||
// #endif
|
||||
|
||||
logScreenInfo()
|
||||
}
|
||||
|
||||
export default {
|
||||
onLaunch: function () {
|
||||
console.log('App Launch')
|
||||
setRemBase()
|
||||
// #ifdef H5
|
||||
window.addEventListener('resize', setRemBase)
|
||||
// #endif
|
||||
},
|
||||
onShow: function () {
|
||||
console.log('App Show')
|
||||
setRemBase()
|
||||
},
|
||||
onHide: function () {
|
||||
console.log('App Hide')
|
||||
@ -18,8 +82,8 @@ export default {
|
||||
/* H5/Electron 下 picker 下拉弹窗宽度与触发下拉框一致(高特异性覆盖库默认 300px),阴影调淡 */
|
||||
uni-picker .uni-picker-container .uni-picker-custom,
|
||||
.uni-picker-container .uni-picker-custom.uni-picker-custom {
|
||||
width: 260rpx !important;
|
||||
box-shadow: 0 0 20px 5px rgba(0, 0, 0, 0.1) !important;
|
||||
width: 6.656rem !important;
|
||||
box-shadow: 0 0 0.4rem 0.1rem rgba(0, 0, 0, 0.1) !important;
|
||||
}
|
||||
|
||||
/* H5/Electron 下 picker 下拉选项居左显示(覆盖库默认居中 text-align:center) */
|
||||
@ -28,6 +92,6 @@ uni-picker .uni-picker-container.uni-selector-select .uni-picker-select .uni-pic
|
||||
uni-picker .uni-picker-container .uni-picker-view-content .uni-picker-item,
|
||||
.uni-picker-container .uni-picker-view-content .uni-picker-item {
|
||||
text-align: left;
|
||||
padding-left: 20rpx;
|
||||
padding-left: 0.512rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -60,15 +60,22 @@ function buildRequestUrl(method: string): string {
|
||||
/**
|
||||
* 统一走 `/system?method=xxx` 的 POST 请求
|
||||
*/
|
||||
export type AbortablePromise<T> = Promise<T> & {
|
||||
/** 中断当前请求(若底层支持),中断后会触发 reject */
|
||||
abort?: () => void
|
||||
}
|
||||
|
||||
export function request<T = ApiBody>(
|
||||
method: string,
|
||||
data?: Record<string, unknown>,
|
||||
options?: RequestOptions
|
||||
): Promise<T> {
|
||||
): AbortablePromise<T> {
|
||||
const url = buildRequestUrl(method)
|
||||
const authHeader = options?.skipAuth ? {} : getAuthHeader()
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let requestTask: ReturnType<typeof uni.request> | null = null
|
||||
|
||||
const promise: AbortablePromise<T> = new Promise<T>((resolve, reject) => {
|
||||
const requestOptions: UniApp.RequestOptions = {
|
||||
url,
|
||||
method: 'POST',
|
||||
@ -90,6 +97,18 @@ export function request<T = ApiBody>(
|
||||
requestOptions.timeout = options.timeout
|
||||
}
|
||||
|
||||
uni.request(requestOptions)
|
||||
requestTask = uni.request(requestOptions)
|
||||
})
|
||||
|
||||
promise.abort = () => {
|
||||
if (requestTask && typeof requestTask.abort === 'function') {
|
||||
try {
|
||||
requestTask.abort()
|
||||
} catch (err) {
|
||||
// 忽略中断异常
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -391,8 +391,8 @@ export default {
|
||||
<style scoped>
|
||||
.top-nav {
|
||||
width: 100%;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 18rpx 28rpx;
|
||||
margin-bottom: 0.614rem;
|
||||
padding: 0.461rem 0.717rem;
|
||||
box-sizing: border-box;
|
||||
background-color: #2f7dff;
|
||||
display: flex;
|
||||
@ -401,8 +401,8 @@ export default {
|
||||
}
|
||||
|
||||
.top-nav-logo {
|
||||
width: 240rpx;
|
||||
height: 90rpx;
|
||||
width: 6.144rem;
|
||||
height: 2.304rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@ -414,14 +414,14 @@ export default {
|
||||
.top-nav-menu-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 36rpx;
|
||||
gap: 14rpx;
|
||||
margin-left: 0.922rem;
|
||||
gap: 0.358rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.top-nav-menu-item {
|
||||
padding: 10rpx 18rpx;
|
||||
border-radius: 8rpx;
|
||||
padding: 0.256rem 0.461rem;
|
||||
border-radius: 0.205rem;
|
||||
}
|
||||
|
||||
.top-nav-menu-item--active {
|
||||
@ -429,7 +429,7 @@ export default {
|
||||
}
|
||||
|
||||
.top-nav-menu-text {
|
||||
font-size: 32rpx;
|
||||
font-size: 0.819rem;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
@ -437,67 +437,67 @@ export default {
|
||||
.top-nav-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
gap: 0.256rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.top-nav-user-name {
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-size: 0.819rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.top-nav-mine-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
width: 1.126rem;
|
||||
height: 1.126rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 999rpx;
|
||||
border-radius: 25.574rem;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.top-nav-mine-icon-head {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border: 2rpx solid #fff;
|
||||
width: 0.307rem;
|
||||
height: 0.307rem;
|
||||
border: 0.051rem solid #fff;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.top-nav-mine-icon-body {
|
||||
width: 20rpx;
|
||||
height: 10rpx;
|
||||
margin-top: 4rpx;
|
||||
border: 2rpx solid #fff;
|
||||
width: 0.512rem;
|
||||
height: 0.256rem;
|
||||
margin-top: 0.102rem;
|
||||
border: 0.051rem solid #fff;
|
||||
border-top: none;
|
||||
border-radius: 0 0 12rpx 12rpx;
|
||||
border-radius: 0 0 0.307rem 0.307rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.popup-card {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 70rpx;
|
||||
min-width: 330rpx;
|
||||
top: 1.792rem;
|
||||
min-width: 8.448rem;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0 12rpx 32rpx rgba(0, 0, 0, 0.16);
|
||||
padding: 16rpx;
|
||||
border-radius: 0.307rem;
|
||||
box-shadow: 0 0.307rem 0.819rem rgba(0, 0, 0, 0.16);
|
||||
padding: 0.41rem;
|
||||
box-sizing: border-box;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.popup-user-info {
|
||||
max-height: 320rpx;
|
||||
max-height: 8.192rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.popup-user-item {
|
||||
padding: 12rpx;
|
||||
border-radius: 8rpx;
|
||||
padding: 0.307rem;
|
||||
border-radius: 0.205rem;
|
||||
}
|
||||
|
||||
.popup-user-item--current {
|
||||
@ -505,7 +505,7 @@ export default {
|
||||
}
|
||||
|
||||
.popup-user-text {
|
||||
font-size: 28rpx;
|
||||
font-size: 0.717rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@ -514,17 +514,17 @@ export default {
|
||||
}
|
||||
|
||||
.logout-btn {
|
||||
margin-top: 16rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 28rpx;
|
||||
margin-top: 0.41rem;
|
||||
height: 1.536rem;
|
||||
line-height: 1.536rem;
|
||||
font-size: 0.717rem;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
margin-top: 10rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
font-size: 28rpx;
|
||||
margin-top: 0.256rem;
|
||||
height: 1.536rem;
|
||||
line-height: 1.536rem;
|
||||
font-size: 0.717rem;
|
||||
background-color: #f5f7fb;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
2
src/core/scanKey.js
Normal file
2
src/core/scanKey.js
Normal file
@ -0,0 +1,2 @@
|
||||
// 已弃用:此前用共享注册表统一管理 plus.key 监听,真机打包页出现白屏,已回退为各页面直接管理。
|
||||
// 保留此文件仅为说明,不再被任何页面引用。
|
||||
@ -187,10 +187,35 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<script module="remInject" lang="renderjs">
|
||||
export default {
|
||||
mounted() {
|
||||
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
|
||||
const setFontSize = () => {
|
||||
const docEl = document.documentElement
|
||||
const width = docEl.clientWidth || window.innerWidth || 1920
|
||||
const height = docEl.clientHeight || window.innerHeight || 1280
|
||||
const scale = Math.min(width / 1920, height / 1280)
|
||||
docEl.style.fontSize = (scale * 100 * REM_SCALE) + 'px'
|
||||
console.log('[rem-renderjs] fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale, 'REM_SCALE =', REM_SCALE, 'dpr =', window.devicePixelRatio)
|
||||
}
|
||||
this._remResizeHandler = setFontSize
|
||||
setFontSize()
|
||||
window.addEventListener('resize', setFontSize)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this._remResizeHandler) {
|
||||
window.removeEventListener('resize', this._remResizeHandler)
|
||||
this._remResizeHandler = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.layout-page {
|
||||
min-height: 100vh;
|
||||
min-width: 960px;
|
||||
min-width: 19.2rem;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
@ -211,30 +236,30 @@ export default {
|
||||
|
||||
.module-placeholder {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 28rpx;
|
||||
border-radius: 0.41rem;
|
||||
padding: 0.717rem;
|
||||
}
|
||||
|
||||
.module-placeholder-title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-size: 0.768rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.module-placeholder-desc {
|
||||
display: block;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
margin-top: 0.256rem;
|
||||
font-size: 0.614rem;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
@media screen and (max-width: 20.48rem) {
|
||||
.layout-page {
|
||||
min-width: 760px;
|
||||
min-width: 15.2rem;
|
||||
}
|
||||
|
||||
.layout-main {
|
||||
padding: 0 20rpx 18rpx;
|
||||
padding: 0 0.512rem 0.461rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,31 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<script module="remInject" lang="renderjs">
|
||||
export default {
|
||||
mounted() {
|
||||
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
|
||||
const setFontSize = () => {
|
||||
const docEl = document.documentElement
|
||||
const width = docEl.clientWidth || window.innerWidth || 1920
|
||||
const height = docEl.clientHeight || window.innerHeight || 1280
|
||||
const scale = Math.min(width / 1920, height / 1280)
|
||||
docEl.style.fontSize = (scale * 100 * REM_SCALE) + 'px'
|
||||
console.log('[rem-renderjs] fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale, 'REM_SCALE =', REM_SCALE, 'dpr =', window.devicePixelRatio)
|
||||
}
|
||||
this._remResizeHandler = setFontSize
|
||||
setFontSize()
|
||||
window.addEventListener('resize', setFontSize)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this._remResizeHandler) {
|
||||
window.removeEventListener('resize', this._remResizeHandler)
|
||||
this._remResizeHandler = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 100%;
|
||||
@ -45,7 +70,7 @@ export default {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8rpx 32rpx 32rpx;
|
||||
padding: 0.205rem 0.819rem 0.819rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@ -55,22 +80,22 @@ export default {
|
||||
|
||||
.module-card {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
border-radius: 0.41rem;
|
||||
padding: 0.819rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.module-card-title {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-size: 0.819rem;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
margin-bottom: 12rpx;
|
||||
margin-bottom: 0.307rem;
|
||||
}
|
||||
|
||||
.module-card-desc {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
font-size: 0.666rem;
|
||||
color: #888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@ -30,6 +30,31 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<script module="remInject" lang="renderjs">
|
||||
export default {
|
||||
mounted() {
|
||||
const REM_SCALE = 0.45 // 整体缩放系数:<1 缩小,>1 放大(布局偏大就调小)
|
||||
const setFontSize = () => {
|
||||
const docEl = document.documentElement
|
||||
const width = docEl.clientWidth || window.innerWidth || 1920
|
||||
const height = docEl.clientHeight || window.innerHeight || 1280
|
||||
const scale = Math.min(width / 1920, height / 1280)
|
||||
docEl.style.fontSize = (scale * 100 * REM_SCALE) + 'px'
|
||||
console.log('[rem-renderjs] fontSize =', docEl.style.fontSize, 'width =', width, 'height =', height, 'scale =', scale, 'REM_SCALE =', REM_SCALE, 'dpr =', window.devicePixelRatio)
|
||||
}
|
||||
this._remResizeHandler = setFontSize
|
||||
setFontSize()
|
||||
window.addEventListener('resize', setFontSize)
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this._remResizeHandler) {
|
||||
window.removeEventListener('resize', this._remResizeHandler)
|
||||
this._remResizeHandler = null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 100%;
|
||||
@ -45,7 +70,7 @@ export default {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: 8rpx 32rpx 32rpx;
|
||||
padding: 0.205rem 0.819rem 0.819rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@ -55,22 +80,22 @@ export default {
|
||||
|
||||
.module-card {
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
border-radius: 0.41rem;
|
||||
padding: 0.819rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.module-card-title {
|
||||
display: block;
|
||||
font-size: 32rpx;
|
||||
font-size: 0.819rem;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
margin-bottom: 12rpx;
|
||||
margin-bottom: 0.307rem;
|
||||
}
|
||||
|
||||
.module-card-desc {
|
||||
display: block;
|
||||
font-size: 26rpx;
|
||||
font-size: 0.666rem;
|
||||
color: #888;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user