From 23c4c9e95706b0c1818797f95b72b97acc6cf1d3 Mon Sep 17 00:00:00 2001
From: zyh <zyh@123>
Date: 星期四, 18 十二月 2025 16:11:24 +0800
Subject: [PATCH] #添加了一个页面,在home中添加了进入这个页面的按钮,pages.json中的pages数组中注册了该页面
---
pages/home/home.vue | 14
pages/sockroom/sockroom.vue | 568 ++++++++++++++++++++++++++++----------------------------
2 files changed, 291 insertions(+), 291 deletions(-)
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 8d42ed2..83100e6 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -80,13 +80,13 @@
cuIcon: 'pullup',
url: '/out/orderGift2'
},
- // {
- // title: '缁勬墭鍏ュ簱',
- // name: 'pakin',
- // color: 'cyan',
- // cuIcon: 'pullup',
- // url: '/pakin/pakin'
- // },
+ {
+ title: '缁勬墭鍏ュ簱',
+ name: 'pakin',
+ color: 'cyan',
+ cuIcon: 'pullup',
+ url: '/pakin/pakin'
+ },
// {
// title: '鍐嶆鎷f枡',
// name: 'changePallet',
diff --git a/pages/sockroom/sockroom.vue b/pages/sockroom/sockroom.vue
index 8751742..9f2117f 100644
--- a/pages/sockroom/sockroom.vue
+++ b/pages/sockroom/sockroom.vue
@@ -11,12 +11,8 @@
<input
id="pdacode"
type="text"
- ref="barcodeInput"
v-model="barcode"
- placeholder="璇锋壂鐮�(12浣嶄互涓嬩负鎵樼洏鐮�)"
- :focus="focusState"
- @focus="focusFn"
- @blur="focusState = false"
+ placeholder="璇锋壂鐮�"
/>
</view>
</view>
@@ -40,6 +36,25 @@
</view>
</view>
+ <view class="form-card">
+ <view class="form-row">
+ <view class="label">
+ <text class="required">*</text>鐗╂枡鐮侊細
+ </view>
+ <view class="picker-wrap" hover-class="picker-hover">
+ <view class="textareainput">
+ <textarea
+ style="max-height: 15px;overflow: hidden;"
+ id="pdacode"
+ type="text"
+ v-model="thingCode"
+ placeholder="璇锋壂鐮�"
+ @input="handleBarcodeInput"
+ />
+ </view>
+ </view>
+ </view>
+ </view>
<!-- 鐗╂枡淇℃伅杈撳叆鏍忥紙瀵瑰簲鍚庣MatList锛� -->
<view class="form-card material-card">
<view class="card-title">鐗╂枡淇℃伅</view>
@@ -118,334 +133,287 @@
</view>
</view>
</view>
-
<!-- 鎿嶄綔鎸夐挳缁� -->
<view class="btn-group">
- <button class="operate-btn scan-btn" @click="startScan">寮�濮嬫壂鐮�</button>
<button class="operate-btn submit-btn" @click="submit">鎴愬搧鍏ュ簱</button>
</view>
</view>
</view>
</template>
-
<script>
-import { onLoad } from '../../uni_modules/uview-ui/libs/mixin/mixin'
-
export default {
- onLoad(){
- // 鍏堣鍙栫紦瀛橈紝鍐嶆墽琛岃姹�
- this.baseUrl = uni.getStorageSync('baseUrl');
- this.token = uni.getStorageSync('token');
- // 椤甸潰鍔犺浇鏃� mode 涓虹┖锛岃皟鐢ㄦ帴鍙e悗鎵嶅~鍏呮暟鎹�
+ onLoad(options){
+ this.checkLoginStatus();
this.POSTinfo();
},
- mounted() {
- this.setupScanListener();
+ onShow() {
+ this.checkLoginStatus();
},
- beforeDestroy() {
- this.removeScanListener();
+ onHide() {
+ if (this.scanTimeout) {
+ clearTimeout(this.scanTimeout);
+ this.scanTimeout = null;
+ }
},
data() {
return {
+ thingCode:'',
focusState: false,
baseUrl: '',
- barcodeNum:'',
- barcode: '', // 鎵樼洏鐮�
- palletizingNo: '1', // 鐮佸灈浣嶇紪鍙�
- boxType: '', // 鏈ㄧ绫诲瀷
+ token: '',
+ barcode: '',
+ palletizingNo: '1',
+ boxType: '',
matList: {
- matnr: '', // 瑙勬牸
- maktx: '', // 鐗╂枡鍚嶇О
- batch: '', // 鏈ㄧ缂栧彿
- model: '', // 鍗风紪鍙�
- position: '1', // 鏈ㄧ鐮佸灈浣嶇疆
- weight: '', // 鍑�閲�
- roughWeight: '', // 姣涢噸
- anfme: 1.0, // 榛樿鍊�1.0
- rollExtent: '', // 鍗烽暱搴�
- joint: 0, // 鎺ュご
+ matnr: '',
+ maktx: '',
+ batch: '',
+ model: '',
+ position: '1',
+ weight: '',
+ roughWeight: '',
+ anfme: 1.0,
+ rollExtent: '',
+ joint: 0,
cutting: 2,
qualified: 0,
- modelFront: '', // 鍒嗗垏鍓嶇缂栧彿
- batchFront: '' ,// 鍒嗗垏鍓嶅嵎鍙�
+ modelFront: '',
+ batchFront: ''
},
- // 鍒濆鍖� mode 涓虹┖鏁扮粍 鈫� 椤甸潰鍔犺浇鏃剁鍨嬫棤鏁版嵁
mode: [],
index_mode: 0,
- index_num: 0,
- submitData: {} ,// 鏈�缁堟彁浜ょ粰鍚庣鐨勬暟鎹�
- scanBuffer: '', // 娣诲姞鎵爜缂撳啿鍖�
- scanTimeout: null, // 鎵爜瓒呮椂瀹氭椂鍣�
- isScanning: false, // 鎵爜鐘舵�佹爣蹇�
- scanMode: 'tray', // 鎵爜妯″紡: tray-鎵樼洏鐮�, material-鐗╂枡鐮�
- lastFillTarget: null // 璁板綍涓婃濉厖鐨勭洰鏍�
+ submitData: {},
+ scanBuffer: '',
+ scanTimeout: null,
+ lastScanTime: 0,
+ isProcessingScan: false
}
},
methods: {
- POSTinfo(){
- uni.request({
- url: this.baseUrl + '/mobile/box/type/complete/auth/v2',
- method:'POST',
- header: {
- 'Content-Type': 'application/json'
- },
- success:(res)=>{
- // 鎺ュ彛杩斿洖鍚庢墠濉厖绠卞瀷鏁版嵁
- this.mode = res.data.data.map(item => item.boxSpecs || '').filter(item => item);
- console.log('鎻愬彇鐨勭鍨嬫暟鎹�:', this.mode);
- },
- fail:(err)=>{
- console.error('鑾峰彇绠卞瀷澶辫触:', err)
- }
- })
- },
-
- // 璁剧疆鎵爜鐩戝惉
- setupScanListener() {
- // 绉婚櫎涔嬪墠鐨勭洃鍚�
- this.removeScanListener();
+ // 妫�鏌ョ櫥褰曠姸鎬�
+ checkLoginStatus() {
+ this.token = uni.getStorageSync('token');
+ this.baseUrl = uni.getStorageSync('baseUrl');
- // 鐩戝惉閿洏杈撳叆浜嬩欢
- document.addEventListener('keydown', this.handleKeyDown);
- },
-
- // 绉婚櫎鐩戝惉
- removeScanListener() {
- document.removeEventListener('keydown', this.handleKeyDown);
- if (this.scanTimeout) {
- clearTimeout(this.scanTimeout);
- }
- },
-
- // 閿洏浜嬩欢澶勭悊
- handleKeyDown(e) {
- // 鎺掗櫎鍔熻兘閿紙F1-F12绛夛級
- if (e.key.length > 1 && !['Enter', 'Tab'].includes(e.key)) {
- return;
- }
-
- // PDA鎵爜閫氬父浠ュ洖杞︾粨鏉�
- if (e.key === 'Enter') {
- e.preventDefault(); // 闃绘榛樿琛屼负
- this.processScanCode();
- } else {
- // 绱Н鎵爜瀛楃锛堟帓闄hift绛変慨楗伴敭锛�
- if (!e.ctrlKey && !e.altKey && !e.metaKey && e.key.length === 1) {
- this.scanBuffer += e.key;
-
- // 閲嶇疆瓒呮椂瀹氭椂鍣�
- if (this.scanTimeout) {
- clearTimeout(this.scanTimeout);
- }
-
- // 璁剧疆瓒呮椂锛堝亣璁炬壂鐮侀棿闅旇秴杩�200ms琛ㄧず涓�娆℃壂鐮佸畬鎴愶級
- this.scanTimeout = setTimeout(() => {
- this.processScanCode();
- }, 200);
- }
- }
- },
-
- // 澶勭悊鎵爜缁撴灉
- processScanCode() {
- if (!this.scanBuffer) return;
-
- const scanResult = this.scanBuffer.trim();
- this.scanBuffer = '';
-
- // 鍒ゆ柇鎵爜闀垮害鍐冲畾濉厖浣嶇疆
- if (scanResult.length <= 12) {
- // 12浣嶄互涓嬪~鍏呭埌鎵樼洏缂栫爜
- this.barcode = scanResult;
- this.lastFillTarget = 'tray';
- uni.showToast({
- title: '鎵樼洏鐮佸凡濉厖',
- icon: 'success',
- duration: 1000
- });
- } else {
- // 12浣嶄互涓婂~鍏呭埌鐗╂枡淇℃伅
- this.autoFillMaterialInfo(scanResult);
- this.lastFillTarget = 'material';
- uni.showToast({
- title: '鐗╂枡鐮佸凡濉厖',
- icon: 'success',
- duration: 1000
- });
- }
-
- // 娓呴櫎瀹氭椂鍣�
- if (this.scanTimeout) {
- clearTimeout(this.scanTimeout);
- this.scanTimeout = null;
- }
-
- // 鑷姩澶辩劍
- setTimeout(() => {
- this.focusState = false;
- }, 100);
- },
-
- // 鑷姩濉厖鐗╂枡淇℃伅
- autoFillMaterialInfo(code) {
- // 灏濊瘯瑙f瀽浜岀淮鐮佸唴瀹�
- if (code.includes('鍗峰彿锛�') && code.includes('绠卞彿锛�')) {
- // 濡傛灉鏄甫鏍煎紡鐨勪簩缁寸爜
- const parseResult = this.parseQrCodeText(code);
- this.matList = { ...this.matList, ...parseResult };
- console.log('瑙f瀽鍚庣殑鐗╂枡淇℃伅:', parseResult);
- } else {
- // 濡傛灉鏄函鏁板瓧/鏉$爜锛屾櫤鑳藉~鍏�
- this.smartFillMaterialFields(code);
- }
- },
-
- // 鏅鸿兘濉厖鐗╂枡瀛楁
- smartFillMaterialFields(code) {
- // 鏍规嵁涓氬姟閫昏緫鍒ゆ柇锛岃繖閲屽亣璁鹃暱鏉$爜鍙兘鏄嵎鍙锋垨绠卞彿
- // 濡傛灉鍗峰彿涓虹┖锛屼紭鍏堝~鍏呭嵎鍙�
- if (!this.matList.model) {
- this.matList.model = code;
- }
- // 濡傛灉鍗峰彿宸叉湁鍊间絾绠卞彿涓虹┖锛屽~鍏呯鍙�
- else if (!this.matList.batch) {
- this.matList.batch = code;
- }
- // 濡傛灉涓よ�呴兘鏈夊�硷紝鎻愮ず鐢ㄦ埛
- else {
+ if (!this.token || !this.baseUrl) {
uni.showModal({
title: '鎻愮ず',
- content: `鎵弿鍒伴暱鏉$爜: ${code}\n璇烽�夋嫨濉厖浣嶇疆锛歚,
- showCancel: true,
- cancelText: '鍗峰彿',
- confirmText: '绠卞彿',
+ content: '璇峰厛鐧诲綍',
+ showCancel: false,
success: (res) => {
if (res.confirm) {
- this.matList.batch = code;
- } else if (res.cancel) {
- this.matList.model = code;
+ uni.navigateTo({
+ url: '/pages/login/login'
+ });
}
}
});
+ return false;
}
+ return true;
},
- // 瑙f瀽浜岀淮鐮佹枃鏈紙鐢ㄤ簬鎵揣鐗╃爜鍔熻兘锛�
- parseQrCodeText(qrText) {
- const result = {};
- const lines = qrText.split('\n');
+ // 鑾峰彇绠卞瀷鏁版嵁
+ POSTinfo(){
+ if (!this.checkLoginStatus()) return;
- lines.forEach(line => {
- if (line.includes('鍗峰彿锛�')) {
- result.model = line.split('鍗峰彿锛�')[1]?.trim() || '';
- }
- if (line.includes('绠卞彿锛�')) {
- result.batch = line.split('绠卞彿锛�')[1]?.trim() || '';
- }
- if (line.includes('瑙勬牸锛�')) {
- result.matnr = line.split('瑙勬牸锛�')[1]?.trim() || '';
- }
- // 鍙互鏍规嵁闇�瑕佹坊鍔犳洿澶氬瓧娈电殑瑙f瀽
+ uni.showLoading({
+ title: '鍔犺浇涓�...'
});
- return result;
- },
-
- // 鎵嬪姩寮�濮嬫壂鐮�
- startScan() {
- // 娓呯┖褰撳墠鍊煎苟鑱氱劍
- this.scanBuffer = '';
-
- this.$nextTick(() => {
- this.focusState = true;
-
- // 寤惰繜纭繚input宸茶仛鐒�
- setTimeout(() => {
- const input = document.getElementById('pdacode');
- if (input) {
- input.focus();
- input.select();
- }
- }, 100);
- });
- },
-
- // 淇敼focusFn
- focusFn() {
- this.focusState = true;
- this.scanBuffer = ''; // 鑱氱劍鏃舵竻绌虹紦鍐插尯
- },
-
- // 淇濈暀鍘熸湁鐨勬壂璐х墿鐮佸姛鑳�
- scantwo() {
- uni.scanCode({
- autoDecodeCharSet: true,
- scanType: ['qrCode', 'barCode'],
+ uni.request({
+ url: this.baseUrl + '/mobile/box/type/complete/auth/v2',
+ method: 'POST',
+ header: {
+ 'Content-Type': 'application/json',
+ 'Authorization': 'Bearer ' + this.token
+ },
success: (res) => {
- const qrResult = res.result.trim();
- this.autoFillMaterialInfo(qrResult);
+ uni.hideLoading();
+ console.log('绠卞瀷鎺ュ彛杩斿洖:', res.data);
- uni.showToast({
- title: '鐗╂枡淇℃伅鎵爜鎴愬姛',
- icon: 'success',
- duration: 2000
- });
+ if (res.data && res.data.code === 200) {
+ if (Array.isArray(res.data.data)) {
+ // 灏濊瘯澶氱鍙兘鐨勫瓧娈靛悕
+ this.mode = res.data.data
+ .map(item => item.boxSpecs || item.boxType || item.typeName || item.name || '')
+ .filter(item => item && item.trim() !== '');
+
+ console.log('鎻愬彇鐨勭鍨嬪垪琛�:', this.mode);
+
+ if (this.mode.length === 0) {
+ uni.showToast({
+ title: '鏃犲彲鐢ㄧ鍨�',
+ icon: 'none'
+ });
+ }
+ } else {
+ console.warn('杩斿洖鏁版嵁鏍煎紡涓嶇锛屼笉鏄暟缁�:', res.data.data);
+ uni.showToast({
+ title: '鏁版嵁鏍煎紡閿欒',
+ icon: 'none'
+ });
+ }
+ } else {
+ uni.showToast({
+ title: res.data?.message || '鑾峰彇绠卞瀷澶辫触',
+ icon: 'none'
+ });
+ }
},
fail: (err) => {
- console.log('鎵爜澶辫触:', err);
+ uni.hideLoading();
+ console.error('鑾峰彇绠卞瀷澶辫触:', err);
uni.showToast({
- title: '鎵爜澶辫触鎴栧彇娑�',
+ title: '缃戠粶閿欒',
icon: 'none'
});
}
});
},
-
modePickerChange(e) {
this.index_mode = e.detail.value;
- this.boxType = this.mode[this.index_mode]; // 鍚屾鍒癰oxType
+ this.boxType = this.mode[this.index_mode];
+ console.log('閫夋嫨鐨勭鍨�:', this.boxType);
},
- numPickerChange(e) {
- this.index_num = e.detail.value;
- },
-
- // 淇敼閲嶇疆鏂规硶
- resetForm() {
- this.barcodeNum = '';
- this.barcode = '';
- this.boxType = '';
- this.index_mode = 0;
- this.index_num = 0;
- this.submitData = {};
- this.mode = [];
- this.lastFillTarget = null;
- this.scanBuffer = '';
+ handleBarcodeInput(e) {
+ // 鍦╱ni-app涓紝textarea鐨刬nput浜嬩欢鍙兘鏄痚.detail.value
+ const value = e.detail ? e.detail.value : e.target.value;
+ this.thingCode = value;
+ this.parseBarcodeContent(value);
+ },
- // 閲嶇疆鐗╂枡淇℃伅
+ parseBarcodeContent(content) {
+ if (!content) return;
+
+ // 鎸夎鍒嗗壊鍐呭
+ const lines = content.split('\n').filter(line => line.trim() !== '');
+
+ console.log('瑙f瀽鐨勮鏁版嵁:', lines);
+
+ // 鏍规嵁浣犳彁渚涚殑鏍蜂緥鏍煎紡瑙f瀽
+ // 鏍煎紡涓�:
+ // 2511080305A22B6 (鍗峰彿)
+ // Y251113764 (绠卞彿)
+ // 5渭m脳1050mm (瑙勬牸)
+ // 8700 m (闀垮害)
+ // 418.0 kg (鍑�閲�)
+ // 441.0 kg (姣涢噸)
+ // 0 涓� (鎺ュご)
+
+ if (lines.length >= 7) {
+ // 鍗峰彿 (绗竴琛�)
+ this.matList.model = lines[0].trim();
+
+ // 绠卞彿 (绗簩琛�)
+ this.matList.batch = lines[1].trim();
+
+ // 瑙勬牸 (绗笁琛�)
+ this.matList.matnr = lines[2].trim();
+
+ // 闀垮害 (绗洓琛�) - 鎻愬彇鏁板瓧閮ㄥ垎
+ const lengthMatch = lines[3].match(/([\d.]+)/);
+ if (lengthMatch) {
+ this.matList.rollExtent = lengthMatch[1];
+ }
+
+ // 鍑�閲� (绗簲琛�) - 鎻愬彇鏁板瓧閮ㄥ垎
+ const weightMatch = lines[4].match(/([\d.]+)/);
+ if (weightMatch) {
+ this.matList.weight = weightMatch[1];
+ }
+
+ // 姣涢噸 (绗叚琛�) - 鎻愬彇鏁板瓧閮ㄥ垎
+ const roughWeightMatch = lines[5].match(/([\d.]+)/);
+ if (roughWeightMatch) {
+ this.matList.roughWeight = roughWeightMatch[1];
+ }
+
+ // 鎺ュご (绗竷琛�) - 鎻愬彇鏁板瓧閮ㄥ垎
+ const jointMatch = lines[6].match(/([\d.]+)/);
+ if (jointMatch) {
+ this.matList.joint = jointMatch[1];
+ }
+
+ console.log('瑙f瀽鍚庣殑鏁版嵁:', this.matList);
+ } else if (lines.length > 0) {
+ // 濡傛灉琛屾暟涓嶅锛屼篃鍙互灏濊瘯鏅鸿兘鍖归厤
+ this.autoMatchFields(lines);
+ }
+ },
+
+ // 鏅鸿兘鍖归厤鏂规硶锛岀敤浜庡鐞嗗彲鑳界殑涓嶈鍒欐暟鎹�
+ autoMatchFields(lines) {
+ lines.forEach((line, index) => {
+ line = line.trim();
+
+ // 鏍规嵁鍐呭鐗瑰緛鍖归厤
+ if (index === 0 && !this.matList.model) {
+ // 鍋囪绗竴琛屾�绘槸鍗峰彿
+ this.matList.model = line;
+ } else if (index === 1 && !this.matList.batch) {
+ // 鍋囪绗簩琛屾�绘槸绠卞彿
+ this.matList.batch = line;
+ } else if (line.includes('渭m') || line.includes('mm') || line.includes('脳')) {
+ // 鍖呭惈瑙勬牸鐗瑰緛鐨�
+ this.matList.matnr = line;
+ } else if (line.includes('m') && line.match(/[\d.]+ m/)) {
+ // 闀垮害鐗瑰緛
+ const match = line.match(/([\d.]+)/);
+ if (match) this.matList.rollExtent = match[1];
+ } else if (line.includes('kg') && line.match(/[\d.]+ kg/)) {
+ // 閲嶉噺鐗瑰緛锛岄渶瑕佸尯鍒嗗噣閲嶅拰姣涢噸
+ const match = line.match(/([\d.]+)/);
+ if (match) {
+ const weightValue = match[1];
+ if (!this.matList.weight) {
+ this.matList.weight = weightValue;
+ } else if (!this.matList.roughWeight) {
+ this.matList.roughWeight = weightValue;
+ }
+ }
+ } else if (line.includes('涓�') && line.match(/[\d.]+ 涓�/)) {
+ // 鎺ュご鐗瑰緛
+ const match = line.match(/([\d.]+)/);
+ if (match) this.matList.joint = match[1];
+ }
+ });
+ },
+ // 閲嶇疆琛ㄥ崟
+ resetForm() {
+ this.barcode = '';
+ this.boxType = '';
+ this.index_mode = 0;
this.matList = {
matnr: '',
maktx: '',
batch: '',
model: '',
- position: '1',
+ position: '1',
weight: '',
roughWeight: '',
- anfme: 1.0,
+ anfme: 1.0,
rollExtent: '',
- joint: 0,
- cutting: 2,
- qualified: 0,
+ joint: 0,
+ cutting: 2,
+ qualified: 0,
modelFront: '',
batchFront: ''
};
+ this.scanBuffer = '';
+ this.focusState = false;
},
+ // 鎻愪氦鏁版嵁
submit() {
- // 鏍¢獙蹇呭~椤�
+ // 1. 楠岃瘉鐧诲綍
+ if (!this.checkLoginStatus()) return;
+
+ // 2. 楠岃瘉蹇呭~椤�
if (!this.barcode) {
uni.showToast({title: '璇锋壂鎻忔墭鐩樼紪鐮�', icon: 'none'});
return;
@@ -456,55 +424,79 @@
return;
}
- if (!this.matList.model || !this.matList.batch) {
- uni.showToast({title: '璇峰~鍐欏嵎鍙峰拰绠卞彿', icon: 'none'});
+ if (!this.matList.model) {
+ uni.showToast({title: '璇峰~鍐欏嵎鍙�', icon: 'none'});
return;
}
- // 鏁版嵁绫诲瀷杞崲
+ if (!this.matList.batch) {
+ uni.showToast({title: '璇峰~鍐欑鍙�', icon: 'none'});
+ return;
+ }
+
+ // 3. 鍑嗗鏁版嵁
const matItem = {
...this.matList,
weight: this.matList.weight ? Number(this.matList.weight) : null,
roughWeight: this.matList.roughWeight ? Number(this.matList.roughWeight) : null,
rollExtent: this.matList.rollExtent ? Number(this.matList.rollExtent) : null,
- joint: this.matList.joint ? Number(this.matList.joint) : 0,
- anfme: 1.0,
- cutting: 2,
- qualified: 0
+ joint: this.matList.joint ? Number(this.matList.joint) : 0
};
- // 缁勮鎻愪氦鏁版嵁
- this.submitData = {
+ const submitData = {
barcode: this.barcode,
palletizingNo: this.palletizingNo,
boxType: this.boxType,
matList: [matItem]
};
- console.log('鎻愪氦鏁版嵁锛�', this.submitData);
+ console.log('鎻愪氦鏁版嵁:', submitData);
- // 鎻愪氦璇锋眰
+ // 4. 鍙戦�佽姹�
+ uni.showLoading({
+ title: '鎻愪氦涓�...',
+ mask: true
+ });
+
uni.request({
url: this.baseUrl + '/mobile/truss/comd/auth/v2',
method: 'POST',
- header: {'Content-Type': 'application/json'},
- data: this.submitData,
+ header: {
+ 'Content-Type': 'application/json',
+ 'Authorization': 'Bearer ' + this.token
+ },
+ data: submitData,
success: (res) => {
- console.log('鍚庣杩斿洖锛�', res);
+ uni.hideLoading();
+ console.log('鎻愪氦杩斿洖:', res.data);
- if (res.data && res.data.code === 200) {
- uni.showToast({title: '鎻愪氦鎴愬姛', icon: 'success'});
- this.resetForm();
+ if (res.data.code === 200) {
+ uni.showToast({
+ title: '鎻愪氦鎴愬姛',
+ icon: 'success',
+ duration: 2000
+ });
+
+ setTimeout(() => {
+ this.resetForm();
+ }, 1500);
} else {
- uni.showToast({title: res.data.message || '鎻愪氦澶辫触', icon: 'none'});
+ uni.showToast({
+ title: res.data.message || '鎻愪氦澶辫触',
+ icon: 'none'
+ });
}
},
fail: (err) => {
- console.error('璇锋眰澶辫触璇︽儏锛�', err);
- uni.showToast({title: '缃戠粶璇锋眰澶辫触', icon: 'none'});
+ uni.hideLoading();
+ console.error('鎻愪氦澶辫触:', err);
+ uni.showToast({
+ title: '缃戠粶閿欒',
+ icon: 'none'
+ });
}
});
- }
+ },
}
}
</script>
@@ -532,12 +524,19 @@
padding: 24rpx;
transition: all 0.2s ease;
}
-
+.textareainput{
+ width: 60%;
+ height: 15px;
+ font-size: 28rpx;
+ padding: 16rpx 12rpx;
+ border: 1rpx solid #e5e7eb;
+ border-radius: 8rpx;
+ transition: border-color 0.2s ease;
+}
/* 鐗╂枡淇℃伅鍗$墖鐗规畩鏍峰紡 */
.material-card {
padding: 0;
}
-
.card-title {
font-size: 30rpx;
font-weight: 500;
@@ -631,6 +630,7 @@
/* 鐗╂枡杈撳叆妗� */
.material-input {
+ width: 45%;
font-size: 28rpx;
color: #1f2937;
padding: 16rpx 12rpx;
--
Gitblit v1.9.1