up修复数量问题
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 打包前自动递增版本号
|
||||
* 用法: node bump-version.js
|
||||
*
|
||||
* - versionCode: 每次 +1(必须递增,否则 Android 无法覆盖安装)
|
||||
* - versionName: 语义化版本自动递增 patch 位(1.0.0 → 1.0.1)
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const manifestPath = path.join(__dirname, 'manifest.json')
|
||||
|
||||
if (!fs.existsSync(manifestPath)) {
|
||||
console.error('未找到 manifest.json,请在 ops2_uniapp 目录下运行此脚本')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// manifest.json 可能包含 JS 风格注释,先去掉再解析
|
||||
const raw = fs.readFileSync(manifestPath, 'utf8')
|
||||
const cleaned = raw.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '')
|
||||
const manifest = JSON.parse(cleaned)
|
||||
|
||||
// 递增 versionCode
|
||||
const oldCode = parseInt(manifest.versionCode) || 0
|
||||
const newCode = oldCode + 1
|
||||
manifest.versionCode = newCode.toString()
|
||||
|
||||
// 递增 versionName 的 patch 位
|
||||
const parts = (manifest.versionName || '1.0.0').split('.')
|
||||
if (parts.length >= 3) {
|
||||
parts[2] = (parseInt(parts[2]) + 1).toString()
|
||||
} else {
|
||||
parts.push('1')
|
||||
}
|
||||
manifest.versionName = parts.join('.')
|
||||
|
||||
// 写回
|
||||
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n')
|
||||
console.log(`版本已更新: ${manifest.versionName} (${manifest.versionCode})`)
|
||||
+2
-10
@@ -2,10 +2,9 @@
|
||||
"name" : "Operations",
|
||||
"appid" : "__UNI__8A0DE5E",
|
||||
"description" : "Operations(运营)的缩写,一个前后端分离的工作流/运营管理系统。",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"versionName" : "1.0.1",
|
||||
"versionCode" : "101",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
@@ -16,15 +15,12 @@
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"Barcode" : {},
|
||||
"Bluetooth" : {},
|
||||
"Camera" : {}
|
||||
},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
@@ -44,11 +40,9 @@
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
@@ -87,9 +81,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
|
||||
@@ -27,16 +27,30 @@
|
||||
|
||||
|
||||
|
||||
<!-- ===== 分组:关于 ===== -->
|
||||
<view class="group">
|
||||
<text class="group-title">关于</text>
|
||||
<view class="group-body">
|
||||
<view class="cell">
|
||||
<text class="cell-label">版本号</text>
|
||||
<text class="cell-value">{{ version }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { isUrl } from '@/utils/index.js'
|
||||
import { useConfigStore } from '../../stores/config'
|
||||
|
||||
const useConfig=useConfigStore()
|
||||
|
||||
// ---- 版本号 ----
|
||||
const version = ref('')
|
||||
|
||||
// ---- 响应式状态 ----
|
||||
const isTested=ref(false)//是否点了测试
|
||||
const isTesting=ref(false)//是否正在测试
|
||||
@@ -100,8 +114,26 @@ function onEditApiUrl() {
|
||||
}
|
||||
|
||||
|
||||
onMounted(()=>{
|
||||
onMounted(() => {
|
||||
// 真机/打包环境:通过 plus.runtime 获取
|
||||
// #ifndef H5
|
||||
version.value = plus.runtime.version || ''
|
||||
// #endif
|
||||
|
||||
// H5 端:从 manifest.json 读取
|
||||
// #ifdef H5
|
||||
fetch('/manifest.json')
|
||||
.then(r => r.text())
|
||||
.then(text => {
|
||||
// manifest.json 可能含 JS 注释,需先去除再解析
|
||||
const cleaned = text.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '')
|
||||
const m = JSON.parse(cleaned)
|
||||
version.value = (m.versionName || '') + ' (' + (m.versionCode || '') + ')'
|
||||
})
|
||||
.catch(() => {
|
||||
version.value = ''
|
||||
})
|
||||
// #endif
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -145,6 +177,12 @@ onMounted(()=>{
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
/* 左侧标签 */
|
||||
.cell-label {
|
||||
font-size: 30rpx;
|
||||
color: #1c1c1e;
|
||||
}
|
||||
|
||||
/* 点击高亮(uni-app 用 hover-class 实现,这里仅演示结构) */
|
||||
.cell:active {
|
||||
background-color: #f2f2f7;
|
||||
|
||||
@@ -17,6 +17,19 @@
|
||||
<input class="form-input" v-model="form.serialNumber" placeholder="请输入物品编号(选填)" />
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">数量</text>
|
||||
<view class="quantity-row">
|
||||
<view class="qty-btn" @click="form.quantity > 1 && form.quantity--">
|
||||
<text class="qty-btn-text">−</text>
|
||||
</view>
|
||||
<input class="qty-input" type="number" v-model.number="form.quantity" />
|
||||
<view class="qty-btn" @click="form.quantity++">
|
||||
<text class="qty-btn-text">+</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">备注</text>
|
||||
<textarea class="form-textarea" v-model="form.remark" placeholder="请输入备注(选填)" />
|
||||
@@ -68,6 +81,7 @@ const form = ref({
|
||||
name: '',
|
||||
serialNumber: '',
|
||||
remark: '',
|
||||
quantity: 1,
|
||||
photos: []
|
||||
})
|
||||
|
||||
@@ -129,6 +143,7 @@ async function submitForm() {
|
||||
name: form.value.name,
|
||||
serial_number: form.value.serialNumber,
|
||||
remark: form.value.remark,
|
||||
quantity: form.value.quantity > 0 ? form.value.quantity : 1,
|
||||
container_id: containerId.value || null,
|
||||
photos: form.value.photos
|
||||
}
|
||||
@@ -154,7 +169,6 @@ async function submitForm() {
|
||||
// 获取页面参数
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
onLoad((options) => {
|
||||
console.log('add-item onLoad options:', options)
|
||||
if (options && options.container_id) {
|
||||
containerId.value = parseInt(options.container_id)
|
||||
}
|
||||
@@ -311,4 +325,38 @@ onLoad((options) => {
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* 数量选择器 */
|
||||
.quantity-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.qty-btn-text {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.qty-input {
|
||||
width: 100rpx;
|
||||
height: 72rpx;
|
||||
text-align: center;
|
||||
background-color: #f5f5f5;
|
||||
font-size: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -21,7 +21,20 @@
|
||||
<text class="form-label">编号</text>
|
||||
<input class="form-input" v-model="form.serialNumber" placeholder="请输入物品编号(选填)" />
|
||||
</view>
|
||||
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">数量</text>
|
||||
<view class="quantity-row">
|
||||
<view class="qty-btn" @click="form.quantity > 1 && form.quantity--">
|
||||
<text class="qty-btn-text">−</text>
|
||||
</view>
|
||||
<input class="qty-input" type="number" v-model.number="form.quantity" />
|
||||
<view class="qty-btn" @click="form.quantity++">
|
||||
<text class="qty-btn-text">+</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">备注</text>
|
||||
<textarea class="form-textarea" v-model="form.remark" placeholder="请输入备注(选填)" />
|
||||
@@ -75,6 +88,7 @@ const form = ref({
|
||||
name: '',
|
||||
serialNumber: '',
|
||||
remark: '',
|
||||
quantity: 1,
|
||||
photos: []
|
||||
})
|
||||
|
||||
@@ -134,6 +148,7 @@ async function fetchDetail() {
|
||||
name: item.Name || '',
|
||||
serialNumber: item.SerialNumber || '',
|
||||
remark: item.Remark || '',
|
||||
quantity: item.Quantity ?? 1,
|
||||
photos: res.data.photos ? res.data.photos.map(p => p.Sha256) : []
|
||||
}
|
||||
} else {
|
||||
@@ -160,6 +175,7 @@ async function submitForm() {
|
||||
name: form.value.name,
|
||||
serial_number: form.value.serialNumber,
|
||||
remark: form.value.remark,
|
||||
quantity: form.value.quantity > 0 ? form.value.quantity : 1,
|
||||
photos: form.value.photos
|
||||
}
|
||||
|
||||
@@ -184,7 +200,6 @@ async function submitForm() {
|
||||
// 获取页面参数
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
onLoad((options) => {
|
||||
console.log('item-edit onLoad options:', options)
|
||||
if (options && options.id) {
|
||||
itemId.value = parseInt(options.id)
|
||||
fetchDetail()
|
||||
@@ -348,4 +363,38 @@ onLoad((options) => {
|
||||
border-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
/* 数量选择器 */
|
||||
.quantity-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.qty-btn {
|
||||
width: 72rpx;
|
||||
height: 72rpx;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.qty-btn-text {
|
||||
font-size: 36rpx;
|
||||
color: #333;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.qty-input {
|
||||
width: 100rpx;
|
||||
height: 72rpx;
|
||||
text-align: center;
|
||||
background-color: #f5f5f5;
|
||||
font-size: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
margin: 0 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -82,6 +82,7 @@
|
||||
<view class="item-info">
|
||||
<text class="item-name">{{ item.Name }}</text>
|
||||
<text class="item-meta" v-if="item.SerialNumber">编号: {{ item.SerialNumber }}</text>
|
||||
<text class="item-meta">数量: {{ item.Quantity ?? 1 }}</text>
|
||||
</view>
|
||||
<view class="item-arrow">›</view>
|
||||
</view>
|
||||
@@ -110,6 +111,7 @@
|
||||
<view class="item-info">
|
||||
<text class="item-name">{{ item.Name }}</text>
|
||||
<text class="item-meta" v-if="item.SerialNumber">编号: {{ item.SerialNumber }}</text>
|
||||
<text class="item-meta">数量: {{ item.Quantity ?? 1 }}</text>
|
||||
<text class="item-location" v-if="item.ContainerBreadcrumb">
|
||||
位置: {{ item.ContainerBreadcrumb }}
|
||||
</text>
|
||||
|
||||
Reference in New Issue
Block a user