¶Ô±ÈÐÂÎļþ |
| | |
| | | { // launch.json é
ç½®äºå¯å¨è°è¯æ¶ç¸å
³è®¾ç½®ï¼configurationsä¸èç¹åç§°å¯ä¸º app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ |
| | | // launchtype项å¯é
ç½®å¼ä¸ºlocalæremote, local代表åç«¯è¿æ¬å°äºå½æ°ï¼remote代表å端è¿äºç«¯äºå½æ° |
| | | "version": "0.0", |
| | | "configurations": [{ |
| | | "app-plus" : |
| | | { |
| | | "launchtype" : "local" |
| | | }, |
| | | "default" : |
| | | { |
| | | "launchtype" : "local" |
| | | }, |
| | | "h5" : |
| | | { |
| | | "launchtype" : "local" |
| | | }, |
| | | "mp-weixin" : |
| | | { |
| | | "launchtype" : "local" |
| | | }, |
| | | "type" : "uniCloud" |
| | | } |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <script> |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | /* å¼å
¥uview-ui */ |
| | | @import "uview-ui/index.scss"; |
| | | /*å¼å
¥é¿éå·´å·´ç¢éåº*/ |
| | | @import "./static/css/iconfont.css"; |
| | | /*æ¯ä¸ªé¡µé¢å
Œ
±css */ |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <u-popup v-model="show" :round="true" mode="bottom" borderRadius="12" @close="$emit('update:flag', show)"> |
| | | <scroll-view scroll-y="true" style="height:350px" @scrolltolower="lower"> |
| | | <slot name="con"> </slot> |
| | | </scroll-view> |
| | | </u-popup> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | |
| | | props: { |
| | | flag: { |
| | | default: false, |
| | | type: Boolean |
| | | }, |
| | | part: { |
| | | default: false, |
| | | type: Boolean |
| | | } |
| | | |
| | | }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | page: 2 |
| | | } |
| | | }, |
| | | methods: { |
| | | lower() { |
| | | this.$emit('lower', this.page++) |
| | | } |
| | | }, |
| | | watch: { |
| | | flag() { |
| | | this.show = this.flag |
| | | }, |
| | | show(newVal, oldVal) { |
| | | if (newVal == false) { |
| | | this.page = 2 |
| | | } |
| | | }, |
| | | part(newVal, oldVal) { |
| | | if (newVal == true) { |
| | | this.page = 2 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | class Bluetooth { |
| | | |
| | | constructor() { |
| | | this.isOpenBle = false; |
| | | this.deviceId = ""; |
| | | this.serviceId = ""; |
| | | this.writeId = ""; |
| | | this.notifyId = ""; |
| | | this.openBluetoothAdapter(); |
| | | } |
| | | |
| | | showToast(title) { |
| | | uni.showToast({ |
| | | title: title, |
| | | icon: 'none', |
| | | 'duration': 2000 |
| | | }); |
| | | } |
| | | |
| | | openBluetoothAdapter() { |
| | | return new Promise((resolve, reject) => { |
| | | uni.openBluetoothAdapter({ |
| | | success: res => { |
| | | this.isOpenBle = true; |
| | | this.showToast("åå§åèçæ¨¡åæå"); |
| | | resolve(res); |
| | | }, |
| | | fail: err => { |
| | | this.showToast(`åå§åèçæ¨¡å失败` + JSON.stringify(err)); |
| | | reject(err); |
| | | }, |
| | | }); |
| | | }); |
| | | |
| | | } |
| | | |
| | | startBluetoothDevicesDiscovery() { |
| | | if (!this.isOpenBle) { |
| | | this.showToast(`åå§åèçæ¨¡å失败`) |
| | | return; |
| | | } |
| | | |
| | | let self = this; |
| | | uni.showLoading({ |
| | | title: 'èçæç´¢ä¸' |
| | | }) |
| | | return new Promise((resolve, reject) => { |
| | | setTimeout(() => { |
| | | uni.startBluetoothDevicesDiscovery({ |
| | | success: res => { |
| | | resolve(res) |
| | | }, |
| | | fail: res => { |
| | | self.showToast(`æç´¢è®¾å¤å¤±è´¥` + JSON.stringify(err)); |
| | | reject(err); |
| | | } |
| | | }) |
| | | }, 300); |
| | | }); |
| | | } |
| | | |
| | | stopBluetoothDevicesDiscovery() { |
| | | let self = this; |
| | | return new Promise((resolve, reject) => { |
| | | uni.stopBluetoothDevicesDiscovery({ |
| | | success: e => { |
| | | uni.hideLoading(); |
| | | }, |
| | | fail: e => { |
| | | uni.hideLoading(); |
| | | self.showToast(`忢æç´¢èç设å¤å¤±è´¥` + JSON.stringify(err)); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | createBLEConnection() { |
| | | //设å¤deviceId |
| | | let deviceId = this.deviceId; |
| | | let self = this; |
| | | |
| | | uni.showLoading({ |
| | | mask: true, |
| | | title: '设å«è¿æ¥ä¸,请ç¨å...' |
| | | }) |
| | | return new Promise((resolve, reject) => { |
| | | uni.createBLEConnection({ |
| | | deviceId, |
| | | success: (res) => { |
| | | console.log("res:createBLEConnection " + JSON.stringify(res)); |
| | | resolve(res) |
| | | }, |
| | | fail: err => { |
| | | uni.hideLoading(); |
| | | self.showToast(`忢æç´¢èç设å¤å¤±è´¥` + JSON.stringify(err)); |
| | | reject(err); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | //è·åèçè®¾å¤æææå¡(service) |
| | | getBLEDeviceServices() { |
| | | let _serviceList = []; |
| | | let deviceId = this.deviceId; |
| | | let self = this; |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | setTimeout(() => { |
| | | uni.getBLEDeviceServices({ |
| | | deviceId, |
| | | success: res => { |
| | | for (let service of res.services) { |
| | | if (service.isPrimary) { |
| | | this.getBLEDeviceCharacteristics(deviceIdï¼res.services[i].uuid) |
| | | |
| | | _serviceList.push(service); |
| | | return |
| | | } |
| | | } |
| | | uni.hideLoading(); |
| | | console.log("_serviceList: " + JSON.stringify(_serviceList)); |
| | | resolve(_serviceList) |
| | | }, |
| | | fail: err => { |
| | | uni.hideLoading(); |
| | | self.showToast(`è·å设å¤Services` + JSON.stringify(err)); |
| | | reject(err); |
| | | }, |
| | | }) |
| | | }, 500); |
| | | }); |
| | | } |
| | | |
| | | //è·åèçè®¾å¤æä¸ªæå¡ä¸ææç¹å¾å¼(characteristic) |
| | | getBLEDeviceCharacteristics(deviceIdï¼serviceId) { |
| | | let deviceId = deviceId; |
| | | let serviceId = serviceId; |
| | | |
| | | let self = this; |
| | | return new Promise((resolve, reject) => { |
| | | uni.getBLEDeviceCharacteristics({ |
| | | deviceId, |
| | | serviceId, |
| | | success: res => { |
| | | for (let _obj of res.characteristics) { |
| | | //è·ånotify |
| | | if (_obj.properties.notify) { |
| | | self.notifyId = _obj.uuid; |
| | | uni.setStorageSync('notifyId', self.notifyId); |
| | | } |
| | | //è·åwriteId |
| | | if (_obj.properties.write) { |
| | | self.writeId = _obj.uuid; |
| | | uni.setStorageSync('writeId', self.writeId); |
| | | } |
| | | } |
| | | |
| | | //console.log("res:getBLEDeviceCharacteristics " + JSON.stringify(res)); |
| | | let result = { |
| | | 'notifyId': self.notifyId, |
| | | 'writeId': self.writeId |
| | | }; |
| | | self.showToast(`è·åæå¡ä¸ææç¹å¾å¼OK,${JSON.stringify(result)}`); |
| | | resolve(result) |
| | | }, |
| | | fail: err => { |
| | | self.showToast(`getBLEDeviceCharacteristics` + JSON.stringify(err)); |
| | | reject(err); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | //æå¼è龿¥ |
| | | closeBLEConnection() { |
| | | let deviceId = this.deviceId; |
| | | uni.closeBLEConnection({ |
| | | deviceId, |
| | | success(res) { |
| | | console.log(res) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | notifyBLECharacteristicValue() { |
| | | let deviceId = this.deviceId; |
| | | let serviceId = this.serviceId; |
| | | let characteristicId = this.notifyId; |
| | | |
| | | uni.notifyBLECharacteristicValueChange({ |
| | | state: true, // å¯ç¨ notify åè½ |
| | | deviceId, |
| | | serviceId, |
| | | characteristicId, |
| | | success(res) { |
| | | uni.onBLECharacteristicValueChange(function(res) { |
| | | |
| | | }); |
| | | }, |
| | | fail(res) { |
| | | console.log('notifyBLECharacteristicValueChange failed:' + res.errMsg); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | writeBLECharacteristicValue(buffer) { |
| | | let deviceId = this.deviceId; |
| | | let serviceId = this.serviceId; |
| | | let characteristicId = this.writeId; |
| | | |
| | | console.log("this: " + JSON.stringify(this)); |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | uni.writeBLECharacteristicValue({ |
| | | deviceId, |
| | | serviceId, |
| | | characteristicId, |
| | | value: buffer, |
| | | success(res) { |
| | | console.log('messageåéæå', JSON.stringify(res)); |
| | | resolve(res); |
| | | }, |
| | | fail(err) { |
| | | console.log('messageåé失败', JSON.stringify(err)); |
| | | reject(err); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | closeBluetoothAdapter() { |
| | | uni.closeBluetoothAdapter({ |
| | | success: res => { |
| | | console.log(res) |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //è¥APPå¨ä¹åå·²ææç´¢è¿æä¸ªèç设å¤ï¼å¹¶æå建ç«è¿æ¥ï¼å¯ç´æ¥ä¼ å
¥ä¹åæç´¢è·åç deviceId ç´æ¥å°è¯è¿æ¥è¯¥è®¾å¤ï¼æ éè¿è¡æç´¢æä½ã |
| | | reconnect() { |
| | | (async () => { |
| | | try { |
| | | this.deviceId = this.deviceId || uni.getStorageSync("deviceId"); |
| | | this.serviceId = this.serviceId || uni.getStorageSync("serviceId"); |
| | | |
| | | let result1 = await this.createBLEConnection(); |
| | | console.log("createBLEConnection: " + JSON.stringify(result1)); |
| | | |
| | | let result2 = await this.getBLEDeviceServices(); |
| | | console.log("getBLEDeviceServices: " + JSON.stringify(result2)); |
| | | |
| | | let result3 = await this.getBLEDeviceCharacteristics(); |
| | | console.log("getBLEDeviceCharacteristics: " + JSON.stringify(result3)); |
| | | |
| | | // this.writeId = uni.getStorageSync("writeId"); |
| | | // this.notifyId = uni.getStorageSync("notifyId"); |
| | | } catch (err) { |
| | | console.log("err: " + JSON.stringify(err)); |
| | | } |
| | | |
| | | })(); |
| | | } |
| | | } |
| | | |
| | | export default Bluetooth; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * ä¿®æ¹èªhttps://github.com/song940/node-escpos/blob/master/commands.js |
| | | * ESC/POS _ (Constants) |
| | | */ |
| | | var _ = { |
| | | LF: [0x0a], |
| | | FS: [0x1c], |
| | | FF: [0x0c], |
| | | GS: [0x1d], |
| | | DLE: [0x10], |
| | | EOT: [0x04], |
| | | NUL: [0x00], |
| | | ESC: [0x1b], |
| | | EOL: '\n', |
| | | }; |
| | | |
| | | /** |
| | | * [FEED_CONTROL_SEQUENCES Feed control sequences] |
| | | * @type {Object} |
| | | */ |
| | | _.FEED_CONTROL_SEQUENCES = { |
| | | CTL_LF: [0x0a], // Print and line feed |
| | | CTL_GLF: [0x4a, 0x00], // Print and feed paper (without spaces between lines) |
| | | CTL_FF: [0x0c], // Form feed |
| | | CTL_CR: [0x0d], // Carriage return |
| | | CTL_HT: [0x09], // Horizontal tab |
| | | CTL_VT: [0x0b], // Vertical tab |
| | | }; |
| | | |
| | | _.CHARACTER_SPACING = { |
| | | CS_DEFAULT: [0x1b, 0x20, 0x00], |
| | | CS_SET: [0x1b, 0x20] |
| | | }; |
| | | |
| | | _.LINE_SPACING = { |
| | | LS_DEFAULT: [0x1b, 0x32], |
| | | LS_SET: [0x1b, 0x33] |
| | | }; |
| | | |
| | | /** |
| | | * [HARDWARE Printer hardware] |
| | | * @type {Object} |
| | | */ |
| | | _.HARDWARE = { |
| | | HW_INIT: [0x1b, 0x40], // Clear data in buffer and reset modes |
| | | HW_SELECT: [0x1b, 0x3d, 0x01], // Printer select |
| | | HW_RESET: [0x1b, 0x3f, 0x0a, 0x00], // Reset printer hardware |
| | | }; |
| | | |
| | | /** |
| | | * [CASH_DRAWER Cash Drawer] |
| | | * @type {Object} |
| | | */ |
| | | _.CASH_DRAWER = { |
| | | CD_KICK_2: [0x1b, 0x70, 0x00], // Sends a pulse to pin 2 [] |
| | | CD_KICK_5: [0x1b, 0x70, 0x01], // Sends a pulse to pin 5 [] |
| | | }; |
| | | |
| | | /** |
| | | * [MARGINS Margins sizes] |
| | | * @type {Object} |
| | | */ |
| | | _.MARGINS = { |
| | | BOTTOM: [0x1b, 0x4f], // Fix bottom size |
| | | LEFT: [0x1b, 0x6c], // Fix left size |
| | | RIGHT: [0x1b, 0x51], // Fix right size |
| | | }; |
| | | |
| | | /** |
| | | * [PAPER Paper] |
| | | * @type {Object} |
| | | */ |
| | | _.PAPER = { |
| | | PAPER_FULL_CUT: [0x1d, 0x56, 0x00], // Full cut paper |
| | | PAPER_PART_CUT: [0x1d, 0x56, 0x01], // Partial cut paper |
| | | PAPER_CUT_A: [0x1d, 0x56, 0x41], // Partial cut paper |
| | | PAPER_CUT_B: [0x1d, 0x56, 0x42], // Partial cut paper |
| | | }; |
| | | |
| | | /** |
| | | * [TEXT_FORMAT Text format] |
| | | * @type {Object} |
| | | */ |
| | | _.TEXT_FORMAT = { |
| | | TXT_NORMAL: [0x1b, 0x21, 0x00], // Normal text |
| | | TXT_2HEIGHT: [0x1b, 0x21, 0x10], // Double height text |
| | | TXT_2WIDTH: [0x1b, 0x21, 0x20], // Double width text |
| | | TXT_4SQUARE: [0x1b, 0x21, 0x30], // Double width & height text |
| | | |
| | | TXT_UNDERL_OFF: [0x1b, 0x2d, 0x00], // Underline font OFF |
| | | TXT_UNDERL_ON: [0x1b, 0x2d, 0x01], // Underline font 1-dot ON |
| | | TXT_UNDERL2_ON: [0x1b, 0x2d, 0x02], // Underline font 2-dot ON |
| | | TXT_BOLD_OFF: [0x1b, 0x45, 0x00], // Bold font OFF |
| | | TXT_BOLD_ON: [0x1b, 0x45, 0x01], // Bold font ON |
| | | TXT_ITALIC_OFF: [0x1b, 0x35], // Italic font ON |
| | | TXT_ITALIC_ON: [0x1b, 0x34], // Italic font ON |
| | | |
| | | TXT_FONT_A: [0x1b, 0x4d, 0x00], // Font type A |
| | | TXT_FONT_B: [0x1b, 0x4d, 0x01], // Font type B |
| | | TXT_FONT_C: [0x1b, 0x4d, 0x02], // Font type C |
| | | |
| | | TXT_ALIGN_LT: [0x1b, 0x61, 0x00], // Left justification |
| | | TXT_ALIGN_CT: [0x1b, 0x61, 0x01], // Centering |
| | | TXT_ALIGN_RT: [0x1b, 0x61, 0x02], // Right justification |
| | | }; |
| | | |
| | | /** |
| | | * [BARCODE_FORMAT Barcode format] |
| | | * @type {Object} |
| | | */ |
| | | _.BARCODE_FORMAT = { |
| | | BARCODE_TXT_OFF: [0x1d, 0x48, 0x00], // HRI barcode chars OFF |
| | | BARCODE_TXT_ABV: [0x1d, 0x48, 0x01], // HRI barcode chars above |
| | | BARCODE_TXT_BLW: [0x1d, 0x48, 0x02], // HRI barcode chars below |
| | | BARCODE_TXT_BTH: [0x1d, 0x48, 0x03], // HRI barcode chars both above and below |
| | | |
| | | BARCODE_FONT_A: [0x1d, 0x66, 0x00], // Font type A for HRI barcode chars |
| | | BARCODE_FONT_B: [0x1d, 0x66, 0x01], // Font type B for HRI barcode chars |
| | | |
| | | BARCODE_HEIGHT: function (height) { // Barcode Height [1-255] |
| | | return [0x1d, 0x68, height]; |
| | | }, |
| | | BARCODE_WIDTH: function (width) { // Barcode Width [2-6] |
| | | return [0x1d, 0x77, width]; |
| | | }, |
| | | BARCODE_HEIGHT_DEFAULT: [0x1d, 0x68, 0x64], // Barcode height default:100 |
| | | BARCODE_WIDTH_DEFAULT: [0x1d, 0x77, 0x01], // Barcode width default:1 |
| | | |
| | | BARCODE_UPC_A: [0x1d, 0x6b, 0x00], // Barcode type UPC-A |
| | | BARCODE_UPC_E: [0x1d, 0x6b, 0x01], // Barcode type UPC-E |
| | | BARCODE_EAN13: [0x1d, 0x6b, 0x02], // Barcode type EAN13 |
| | | BARCODE_EAN8: [0x1d, 0x6b, 0x03], // Barcode type EAN8 |
| | | BARCODE_CODE39: [0x1d, 0x6b, 0x04], // Barcode type CODE39 |
| | | BARCODE_ITF: [0x1d, 0x6b, 0x05], // Barcode type ITF |
| | | BARCODE_NW7: [0x1d, 0x6b, 0x06], // Barcode type NW7 |
| | | BARCODE_CODE93: [0x1d, 0x6b, 0x48], // Barcode type CODE93 |
| | | BARCODE_CODE128: [0x1d, 0x6b, 0x49], // Barcode type CODE128 |
| | | }; |
| | | |
| | | /** |
| | | * [IMAGE_FORMAT Image format] |
| | | * @type {Object} |
| | | */ |
| | | _.IMAGE_FORMAT = { |
| | | S_RASTER_N: [0x1d, 0x76, 0x30, 0x00], // Set raster image normal size |
| | | S_RASTER_2W: [0x1d, 0x76, 0x30, 0x01], // Set raster image double width |
| | | S_RASTER_2H: [0x1d, 0x76, 0x30, 0x02], // Set raster image double height |
| | | S_RASTER_Q: [0x1d, 0x76, 0x30, 0x03], // Set raster image quadruple |
| | | }; |
| | | |
| | | /** |
| | | * [BITMAP_FORMAT description] |
| | | * @type {Object} |
| | | */ |
| | | _.BITMAP_FORMAT = { |
| | | BITMAP_S8: [0x1b, 0x2a, 0x00], |
| | | BITMAP_D8: [0x1b, 0x2a, 0x01], |
| | | BITMAP_S24: [0x1b, 0x2a, 0x20], |
| | | BITMAP_D24: [0x1b, 0x2a, 0x21] |
| | | }; |
| | | |
| | | /** |
| | | * [GSV0_FORMAT description] |
| | | * @type {Object} |
| | | */ |
| | | _.GSV0_FORMAT = { |
| | | GSV0_NORMAL: [0x1d, 0x76, 0x30, 0x00], |
| | | GSV0_DW: [0x1d, 0x76, 0x30, 0x01], |
| | | GSV0_DH: [0x1d, 0x76, 0x30, 0x02], |
| | | GSV0_DWDH: [0x1d, 0x76, 0x30, 0x03] |
| | | }; |
| | | |
| | | /** |
| | | * [BEEP description] |
| | | * @type {string} |
| | | */ |
| | | _.BEEP = [0x1b, 0x42]; // Printer Buzzer pre hex |
| | | |
| | | /** |
| | | * [COLOR description] |
| | | * @type {Object} |
| | | */ |
| | | |
| | | _.COLOR = { |
| | | 0: [0x1b, 0x72, 0x00], // black |
| | | 1: [0x1b, 0x72, 0x01] // red |
| | | }; |
| | | |
| | | /** |
| | | * [exports description] |
| | | * @type {[type]} |
| | | */ |
| | | module.exports = _; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /*! |
| | | * gbk.js v0.3.0 |
| | | * Homepage https://github.com/cnwhy/GBK.js |
| | | * License MIT |
| | | */ |
| | | |
| | | (function (global, factory) { |
| | | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : |
| | | typeof define === 'function' && define.amd ? define(factory) : |
| | | (global.GBK = factory()); |
| | | }(this, (function () { 'use strict'; |
| | | |
| | | var GBK = function (gbk_us) { |
| | | var arr_index = 0x8140; //33088; |
| | | var gbk = { |
| | | decode: function (arr) { |
| | | var str = ""; |
| | | for (var n = 0, max = arr.length; n < max; n++) { |
| | | var code = arr[n] & 0xff; |
| | | if (code > 0x80 && n + 1 < max) { |
| | | var code1 = arr[n + 1] & 0xff; |
| | | if(code1 >= 0x40){ |
| | | code = gbk_us[(code << 8 | code1) - arr_index]; |
| | | n++; |
| | | } |
| | | } |
| | | str += String.fromCharCode(code); |
| | | } |
| | | return str; |
| | | }, |
| | | encode: function (str) { |
| | | str += ''; |
| | | var gbk = []; |
| | | var wh = '?'.charCodeAt(0); //gbk䏿²¡æçåç¬¦çæ¿æ¢ç¬¦ |
| | | for (var i = 0; i < str.length; i++) { |
| | | var charcode = str.charCodeAt(i); |
| | | if (charcode < 0x80) gbk.push(charcode); |
| | | else { |
| | | var gcode = gbk_us.indexOf(charcode); |
| | | if (~gcode) { |
| | | gcode += arr_index; |
| | | gbk.push(0xFF & (gcode >> 8), 0xFF & gcode); |
| | | } else { |
| | | gbk.push(wh); |
| | | } |
| | | } |
| | | } |
| | | return gbk; |
| | | } |
| | | }; |
| | | return gbk; |
| | | }; |
| | | var gbk = GBK; |
| | | |
| | | var URI = function(GBK){ |
| | | var passChars = '!\'()*-._~'; |
| | | var otherPassChars = '#$&+,/:;=?@'; |
| | | function getModue(passChars){ |
| | | var passBits = passChars.split('').sort(); |
| | | var isPass = function (s){ |
| | | return ~passChars.indexOf(s) || /[0-9a-zA-Z]/.test(s) |
| | | }; |
| | | return { |
| | | encode:function(str){ |
| | | return (str+'').replace(/./g,function(v){ |
| | | if(isPass(v)) return v; |
| | | var bitArr = GBK.encode(v); |
| | | for(var i=0; i<bitArr.length; i++){ |
| | | bitArr[i] = '%' + ('0'+bitArr[i].toString(16)).substr(-2).toUpperCase(); |
| | | } |
| | | return bitArr.join(''); |
| | | }) |
| | | }, |
| | | decode:function(enstr){ |
| | | enstr = String(enstr); |
| | | var outStr = ''; |
| | | for(var i=0; i<enstr.length; i++){ |
| | | var char = enstr.charAt(i); |
| | | if(char === '%' && i + 2 < enstr.length){ |
| | | var code1 = parseInt(enstr.substr(i+1,2),16); |
| | | if(!isNaN(code1)){ |
| | | var _i = i + 2; |
| | | if(code1 > 0x80){ |
| | | var code2; |
| | | if(enstr.charAt(_i+1) === '%'){ |
| | | code2 = parseInt(enstr.substr(_i+2,2),16); |
| | | _i += 3; |
| | | }else{ |
| | | code2 = enstr.charCodeAt(_i+1); |
| | | _i += 1; |
| | | } |
| | | if(code2 >= 0x40){ |
| | | i = _i; |
| | | outStr += GBK.decode([code1,code2]); |
| | | continue; |
| | | } |
| | | }else{ |
| | | i += 2; |
| | | outStr += String.fromCharCode(code1); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | outStr += char; |
| | | } |
| | | return outStr; |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | var URIComponent = getModue(passChars); |
| | | var URI = getModue(passChars + otherPassChars); |
| | | |
| | | return { |
| | | encodeURI:URI.encode, |
| | | decodeURI:URI.decode, |
| | | encodeURIComponent:URIComponent.encode, |
| | | decodeURIComponent:URIComponent.decode |
| | | } |
| | | }; |
| | | |
| | | var src = function (gbk_us){ |
| | | var gbk$$1 = gbk(gbk_us); |
| | | gbk$$1.URI = URI(gbk$$1); |
| | | return gbk$$1; |
| | | }; |
| | | |
| | | // å¤è¿å¶è½¬æ¢åçæ°åè¿å彿° æå»ºæ¶ä¼æ¿æ¢å ä½ç¬¦ |
| | | var Fn_Hex_decode = function decode(){ |
| | | var n = 0, str = arguments[0]; |
| | | for (var i = 0,w = str.length; i < w; i++) { |
| | | var code = str.charCodeAt(i); |
| | | if(code < 38 || code > 126) return NaN; |
| | | n += (code - 38) * Math.pow(89, w - i - 1); |
| | | } |
| | | return n; |
| | | }; |
| | | |
| | | // è§£åUnicodeç¼ç åç¬¦ä¸²å½æ° æå»ºæ¶ä¼æ¿æ¢å ä½ç¬¦ |
| | | var Fn_unzip = function unZip() { |
| | | return arguments[0].replace(/\x23(\d+)\x24/g, function (a, b) { |
| | | return Array(+b + 4).join("#"); |
| | | }) |
| | | .replace(/[\x26-\x7e]\x25[\x26-\x7e]/g,function(a){ |
| | | var b = a.substr(0,1).charCodeAt(0) |
| | | ,e = a.substr(2).charCodeAt(0) |
| | | ,str = String.fromCharCode(b); |
| | | while(b++<e){ |
| | | str += String.fromCharCode(b); |
| | | } |
| | | return str; |
| | | }) |
| | | .replace(/\x23/g, "###") |
| | | .replace(/([\x26-\x7e]{2})\x21([\x26-\x7e\x23]+)(?:\x20|$)/g, function (all, hd, dt) { |
| | | return dt.replace(/./g, function (a) { |
| | | if (a != "#") { |
| | | return hd + a; |
| | | } else { |
| | | return a; |
| | | } |
| | | }); |
| | | }) |
| | | .match(/.../g); |
| | | }; |
| | | |
| | | function gbkArray(gbkArr) { |
| | | var data = []; |
| | | for (var i = 0x81, k = 0; i <= 0xfe; i++) { |
| | | if (data.length > 0) { |
| | | data.length += 0x40 + 1; |
| | | } |
| | | for (var j = 0x40; j <= 0xfe; j++) { |
| | | if ( |
| | | (j == 0x7f) || |
| | | ((0xa1 <= i && i <= 0xa7) && j <= 0xa0) || |
| | | ((0xaa <= i && i <= 0xaf) && j >= 0xa1) || |
| | | (0xf8 <= i && j >= 0xa1) |
| | | ) { |
| | | data.push(undefined); |
| | | continue; |
| | | } |
| | | var hex = gbkArr[k++]; |
| | | var key = Fn_Hex_decode(hex); |
| | | data.push(key ? key : undefined); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | var GBK$1 = function () { |
| | | // çææGBkç¼ç é¡ºæ°æåçç¼ç æ å°æ°ç» æå»ºæ¶ä¼æ¿æ¢ zipData çå ä½ç¬¦ |
| | | var gbk_us = gbkArray(Fn_unzip("(T!HJ%LUX]e%gilotuwy{} (U!)-%/137>BDGHO%RTUW%\\_a%jl%rtw} (V!*+-0%27>C%EHJ%MP%R\\`cdfn%ptvz{} (W!()*,/3%579;=%CFGM%QWX\\^cdg%ilnprtvy%} (X!&')%.468CDHJLMOPSTWY%\\_b%dg%ilnprtuwxz%|~ (Y!'(*+-469%=?%GI%KO%RT%V[%_bdikmnptuy{}~ (Z!&')+%-/%;>@ACE%GKMNPR%TW[_%ikmo%rt%vy%{} ([!'(%+-%024%;=%BD%LO%QSTX%[]^`%ce%y{} (\\!()+%/1%7:%LN%SU%WY%cf%im%prt%xz%~ (]!&'%*-%/1%68%EG%cgloqs%uwx|%~ (^!')%-/02356;>FJKOPRSVWZ%]_`dfi%kmor%vyz (_!'+%-124%68;=@ACE%MOQRUVX%]_adegjqwx|~ (`!&)*-%/689;%=?%ADFIKLNOVX^%cehilmoq%uwyz|%~ (a!'),%/124%=?AD%HJ%PRSU%[]e%ho%qu%~ (b!()*,%.024%79;%=?A%FH%KM%WY%`c%ei%loq%tvy%| (c!'*+-.1346%8:%<>%GKLOQSUZ%\\_cghjltwy{| (d!(,/1%4679=>@D%JLMOQRTVWZ]`%ce%km%pr%tvy%} (e!+,-/0279%;>?DQW[%]_bdhqu%wy (f!&().47:;>ACEFHIKMP%SU^a%egikm%tx}~ (g!)*,.02%58<>BCGI%MPY[]`%bdeginpuv (h!(*-2%6=>A%CF%KMPRT%WZ\\%`deg%ln%qswxz{} (i!&+-%/1%469;>@AD%HJ%MP%TV%Y[\\abdh%mrsvx~ (j!&,%.0235%7:;>@%FH%PRTVXZ\\_%cf%hjkn%puw%{~ (k!').04578;=?%CFI%NQRTW%^`acdg%ilmo%ru%wz|~ (l!&(*%,.%9=%ACDHIK%OQS%U[%^`%ce%hk%ru%{~ (m!&')%79%CE%KM%PR%^`%hjkmnqxz%~ (n!&(*+./2%478<%>ACG%WYZ\\%^`%cgmnp%txy{} (o!&'%)+,.5%9;<EFHJOQS%UWX[%]`%dj%mp%tw%} (p!&'%)/2469%;=?%AC%KN%TVWZ[]`aefhk%mo%vxz%} (q!&'(,-/024%69%;=?%AC%EG%IK%NPSTV%Z\\%`b%eg%tv%| (r!&'(*+-%/1%57%<>%BE%UWZ\\^%`b%il%ps%ux%~ (s!&)%:<%?A%CE%OQ%SU%bd%ilnpqstvwy%~ (t!&')+,.%246%9=>ACDF%ILNRVXY[\\ac%fiklprsvxy (u!&(%,.013%?BDG%IK%MRVXY[%^abeg%jl%ostyz}~ (v!'(%,.013%9;%=@%CIJMOR%VXZ[]%_a%lnp%rtv~ (w!&(%+-/%24%689<=?A%CE%KNPR%VX%Z\\%`bcf%oq%tv%|~ (x!&'(*+-%5:;=%@B%SU%[^%km%svxy{%~ (y!&(),%1346%:<>@B%DF%HKMNPQSU%Y[%qs%~ (z!()%ACEFH%OQ%_bfnpqwx{}~ ({!&)+-%023569=ADEG%IKMV^%`c%fhinq%swxz (|!&'%)+%-/2%:>@ADEG%KMO%U[\\^`acefi%lnpquwy|%~ (}!&(+-%02%578:%<HIKLQRW%Y[%]_%bdgil%ruw%} (~!'(%*,/%35%7:;>?AI%MP%TVZ%\\^`be%hjlnoq%vx%} )&!&'%+-%356:<>?ABD%MO%TWX[%`b%fhj%mopr%vx{}~ )'!&)%-/%69%@BCG%QSTVX%bdghj%mo%{}~ )(!&'%9;%=?%WY%eg%mo%{} ))!'(+,2458=>@%DGHLOQ%SUVZ[_f%mp%twxz%~ )*!()-%025%:<%BE%IKLNOR%`dfhmp%rtwx{%} )+!(.137%:>%BD%HJP%SU%^a%fjkm%pr%} ),!&(%02568%:B%DFI%KMOQSVWY%[^%aehikmo%uxz%|~ )-!&'%358=%@B%DGIKLORSVX%Z\\^a%cgjq%suwxz~ ).!&(%+-%2467:%?AC%FI%MRSUVY^%`e%gijmnpqstwz{}~ )/!&()+,.9%;=>BCEIJLPQT%V^%`b%fh%loprv%|~ )0!'(*,-/%1457%:>?GJKMNPWY%[^%acdg%jlnp%ruwz{}~ )1!')*.035%79:=%DG%IL%PR%TVWY[^a%ejqruwx{%~ )2!&)%,.1%37%;=%@B%EHILO%QS%eg%nprtvwy%{}~ )3!&'%*,%/1%47%=?%BDF%XZ[]%ac%jl%txy{%~ )4!&'%+-%24%68%<>A%EHJ%Z\\%ik%su%z|~ )5!/058%:<?B%EGIK%NQRT%X^`%bfklq%suvx%~ )6!'(+4578:;=>@D%FH%KN%SW\\_%afijlmp%su%wy%{} )7!(*+-59;?GHJKNTUZ\\_b%ejm%pt%wyz|%~ )8!&(%*-78:=%?ABD%ILMO%RUXY[b%eg%nqu%wy{%} )9!'(*%-014%79;%>CEIK%MOQ%WY\\^cgijmnqsuw%{} ):!&')%+02%46%<>AC%GJKM%PRTVX%[]bce%ilmpqt%y|~ );!()%+-%/14%9;%?ABDFHIOQ%WY[%]_%ce%lnp%rt%} )<!()%.035%=@ADEG%JL%PR%UWX\\^%acfhj%lnpqs%y|~ )=!'(%*-%13%579;%SU%\\^%eg%km%xz%~ )>!'(+%.2578;%?ABEFHIKM%ORSUWZ%\\_`b%eh%jlnpqs%~ )?!&'(*%,/%146%8:<?@BDEHJLNPS%Z\\]`%bdi%lorsu%wz%~ )@!&'(*,-34;%>ABD%HJMNP%RTVY%[_%ac%egj%mor%uwy{| )A!'(%+-/024%:=>@AHIK%NPRSUWY%]a%cehik%mo%qsuvx%{}~ )B!&')%,/%35%=@%DF%JL%OQ%TV%oqu%|~ )C!&(%-/34689;?%EJLMO%QTV%XZ\\^%ceglnpqt%wyz|} )D!&)*,/0279:<%@BG%IKLPQSVY[]%`beghjkmoq%tv%y{~ )E!'+%-0258:=>@E%LNQ%Za%cgkmopr%tvwyz~ )F!()%/14%79@CEGHK%OQ%SU%[^%dg%imnrz~ )G!'),0%9DF%MOR%Z\\^a%hj%ln%pr%{}~ )H!&*%-/2357%@BD%IKMO%RTUWXZ\\%`bce%nps%uw%y|~ )I!&'(*%,.%2479;%FI%KM%TVWY%[]%`b%dfhik%{}~ )J!'(*+.01346%9;<>?A%EIJL%NPRTY%[]%befhil%uxy{}~ )K!&()+,.%02%68%?ACEG%IK%PR%TW%bd%gi%rtv%~ )L!&(%36%;=?%DFH%KMO%QS%Y\\%`bce%ln%twy%} )M!&'(*%46%<>?A%CE%GI%QSV%Z\\%ce%lnq%~ )N!&'%~ )O!&'%178:%CE%HJM%OQ%TVWZ\\]_%jl%sz{}~ )P!&'%136%9>AEG%JMNP%RU%Y[%bd%koq%wy|} )Q!&'%*,.018:<%@B%IL%NP%RTV%XZ%\\^%dh%lnrw|%~ )R!'*,2%48:=>@%CEFJ%LOR%VX%Z]_%aijl%nr%vxz|~ )S!&(%*-.2589;<?@C%FHJ%LNPVZ]^b%ehn%qt%vy{%} )T!&'-%/1249;<>ABGINTUWXZ[]%_bd%fh%kmqrt%y{}~ )U!()+,02%46;<>@EHLQ%TWY[]^`acdg%il%oqru%wy%} )V!&')*-.02359%=?EHOPSTVWYZ\\%ad%fk%mp%su%xz}~ )W!&),-/1%479:<>%@BDG%NP%SUY\\]_bcefhilp%rtvxz{} )X!&'(*,%36%=@%CFHJKM%OQ%[]^`%nq%suxy{%~ )Y!&)%/1%35689;<>@AC%FHKMPQTV%X[%^`%bd%fhjnpqs%u{ )Z!&)%24%79%@B%DFGI%MO%QU%^`%bd%gkmoqstv%|~ )[!&'%+.%024%=?%ACE%GI%KM%RU%WY[%]_ac%ik%mpqu%~ )\\!&'(*%-/%35%?ABDEG%LNP%UW%]`%jlo%z}~ )]!&'%DF%MP%VX%hj%ln%~ )^!&()+%8:%EIL%ORT%VX\\%_a%cf%hj%lnrsuvy%~ )_!&'%,246%8<@AF%IKM%Y\\^%`b%eglpr%xz|%~ )`!'(%14%8:;=@D%NP%W[%^`%mo%rtvx%~ )a!&'%+-/%359%=?%AD%GIKLN%SU%Y[%^`%ce%gj%nq%wy%{}~ )b!&'%)+-%/1%9;%DF%JM%VX%[]_%df%oq%|~ )c!&'%:<%EGIK%MP%RXZ\\^%dg%il%oq%suvxz|~ )d!()*-/%25689;%=@%BGHJ%NQSUVX%ce%psv%xz )e!&'%,1%35%8;=?%BDFG 'W!,-. &(+&.'&-~&'u'W!/1 ')>.<V')!@PBCFG 'W!@A4%;BC<= &'~&(!Kk '/!J;< '.!~| '/!>= '.u'/!K. '0`'/!94 '1t'0T'/!?Bu`\\Q1t '0!)* '/!xy2IH ';!*( &'}')!\\] '+{.;U&'q.>!&' ')Z&'t',5':!GF '9!eiha`;:ML ')e'-!XVWY 'W?'-!67%?#3$ '6!-.%@ '5!rs%~ '6!&'%, '5!^_%g## ']!67%?## '-!&'%1## .;!RST .>+.;!VW%~ .<!&'%U .>)'W!mn%~ 'X!&'%f#8$t%~ 'Y!&'%p#5$ &0!=>%MO%U#5$]%mo%u#4$ .9!89<=BC@AD%G##>?:;4#67#6$ &1!cd%hTi%~ &2!&'%)#12$*%/K0%I#10$ &.!()7 ')!=?O_ '+}',('-!\\]%_ '/!)37fz{ '0z'8!CD%ft%~ '9!&'%)-%/VW|%~ ':!&J '0P'W!>IJ#8$ &(!uU &+7&(T&).&(]&)6&(\\&)F&(a&+9&(`&)h&(g&+;&(f&*-&(n&+=&(m&+!?ACE &(!p^ &,a-Qc&)!_c -Qd&,q#1$'Z!&'%J#18$ 'W!MN%U '^`'a!@AN%PSv 'b!'*+. .93.>!(*# ',@']G#'):#0$'Yv'X!no 'Y!wx 'W2'X!pq .9!LM%UW%Z\\%ik%n -R!*+%6 'W3#10$'7!LM%~ '8!&'%>#12$ )e!HIKN%SVWabei%lnp%uw%y{%~ )f!'+%-23679%;@BCEFHIM%PS%_abdf%ik%rt%~ )g!(*%79%=?@BDFGIJL%OQ%TV%XZ[]%bdfgkn%prsv%y{}~ )h!&'(,-/3%9;%>@B%EGIK%MO%RT%cehil%or%z}~ )i!&'%)+,/13579:?%CE%HJ%\\^`eh%tvwy%} )j!'(%,.13%57%9;<>@%JLN%UY%hj%~ )k!&')%1357;=%CF%IKN%TV%Y[%bdfhj%mqstv%z|} )l!'+1369:<>%ACDFGJM%PR%UZ%ad%fh%npr%tw%{}~ )m!&()+%.0%2479<?@BFJ%NQZ[^_c%ejopr%uw{}~ )n!'(*%,047%:=>@%CEFHIMOQ%TVX%Z\\%_aeg%ilnrswyz|} )o!()+%-/346%=@%EGI%MOQ%TV%\\^%`b%iklnq%suw{|~ )p!&()+-.013%<>%FHILN%WYZ\\ (iC*r5(pM)89(gy(h[(gk)p*)o>*A;)s|*9E)ui)cO*s5*ux)R/({@(Z*)7s)B.(~d*4~)F{*42)@K)pg(_l)>Q)a|*2'*Jb(\\0(u2)4?)\\@*9t)8])5n(eJ(f+)|s(^7)mH))<)7>*Yr*ua)6M*2O(o@*t|*0J)cV)oo)E[)op);L(XR*W~)7F)z6)?3)hN);2)66*8L*xa)Dd)cf)61)76(Wo)k9(cY(a_*.d*b,))v)G`)Jk*6R*.k)HS)vH*E'*oR([d*U/*:L*4b(bm*L>(a&)p!]`bdelnrsu%wy%} )q!&'%-035%7:;=?@BCEFJLN%X[%^ac%egj%lnp%ty{}~ )r!&)+%-/%69%@C *B**t=(Yf(qR*{F({T)6!th )BK*V+++A)b})DT)um)12(c!`& *^r*4P*Wv*mT(Z=)e4(t-)1k)`B*K0(tz*:])Cj)}<)&|*/8)l*)TJ*[[*`!0t +3')Q4*cF)}()-`)v**@.*A<)Q!596 ))I)*v)nD*q<)>X),G).P*_0(s@*7;*a^*rQ*v?*_J*/W*X,)5](YH(e5(cm*_!9:< *a,)F:)-N*6j*JF+,1)3Y(`E)nu)-P)?.)\\_)Z'({u);N(^!A| )EP(T_)yA*{Q)_5)r!DE%GKNPQT%_a%ch%jm%rvwz%~ )s!&'%,/12469;%=?@BD%HJLN%Z\\%df%hk%or )mi)*e)gu*=C)<Z)7R*mh)T7(ci(b+):n*mu)~O(Wj))c*8V*5A*6\\)Wn)Sx*~=)8f(ck(hL*JC(pj(TS))K)Ow*'H*bn)/H)=:)f/*KF)D5)5i*W{)rS*Zw*eB)-M*=?*@y*z>(dx*E0)PD)1!mh )^Z*:;*8Q(Vg)SU*Bu)<z*)0)Ks)C7*;^(dK)}j(Y0(^X)UG(}G*[b):1(e&*;!AK )Eq)v7);C(|=(~@))6*TK)70)F'*V,):_)9r*G2*{`*T{*/a*nL(V;*q_*y+)@U)f))s!tvx}~ )t!&')*,.%18%=?@C%EHJNPSU%WY]_`cdf%hjkrtv%y{}~ )u!&')+-/04%8:%EK%RT%WY%_ (nv(|{)*'*p'([V*3}(d8)>Y)lB(i*(ZQ*Y,)6G*mQ)C[(ky)[T))*(f9)^m*^P)62)<Q)9[)-_)[n*bz*7\\*_A(|v)AX).|)S7*r>*Y(*JJ)<>)yh(pX)Lv)5,(fL(UE)z*)1i)[j*T>)6B*`V*~U)y\\(e`)n?)7k(c()Rg*_p),X*~:*2q+3k(Xj(}?*Xd*1T)?G)_?(]j(^~*D_)&Z({W)7'*d@)lq*ZZ)z?)2()~4(V[*/9)rl(TW*7f(`7(_m)M5(d^*[|*n^*sl)YY*rZ)J))u!`abdfgklnp%ruyz|~ )v!')+%28%;=%@BCE%GI%KO%RT%VY%[]%jl%np%tvxy{|~ )w!&'%*,%.0%6 )tu(\\&)se):o*N`(t*):B)(~){E)Ie(W[*8Y(j8(Tx)mR){])*!Qy *q>(`5(f=)^e)9.*n~(oe)@n)Ig*d[(hY)W=*.I*IY)5O*/1)mY*;=)vD*si*_/)2o)kM*T1)Ov(`T*XP)O3*3G*>{(n-(bn(Vb(Ta(_D*(G*d_*&i(YL*[t*&C){b);m)&g(\\**51)nL*(i)W6*1o)D6(zh(|V)vN)<[):r)9b)8<*ns);3*_O)}h)nt)5o(tM(fJ)P2([z)5P))n)P?(Vw*X7*Ji)-i*`f)w!78%<>%GI%MO%]_%cgil%oqt%|~ )x!&)*2457:%=?A%GJL%PSTW%Z\\%_a%c )/R*2s)7/(U&(cd*b~)9p*4J)@/)R5(X()1n)W+*TB),v*Ef)-7)82(^&*;v)G=(_s)8t*[=(ZB(~G)xH(|Z(`J)zZ)1<*a2)pp).B)-{)ov*[a)^J)om)}])s8(_f*ar(qU(X0)Z3*_{)>G)}/)e0)VG*1n(yJ)6x)++(nl*?3)}@))e),\\*`J*/U*y')9:)Y_)ut)_;(^D*uF(p5)l2(W~)l5)+-)1f(u-)Vc)Px)ue(eY*sr(_!>t )9A(eg*mF*Tg*Ys)cW)u{*G_*_~*Tq(e=)x!de%jl%wy%~ )y!&'%*,%047:<=?@BDF%HKLNOQ%VX%Z]`bdfi%oqrtvwy|} )z!&'%)+.%24578:; (TG)q/(eK*m<*xV+2S*o.({Q*S_(T!hb (^x*>m)47(ai)F>(Xy)0D(_.)Ts(^()6Y)?9*rW*UQ*`O)m|*c*)rJ)Q2)dO)eX*T_(qf)r`*XL)DA*oA*3w)+<)Wk(u_)|\\)s{*o<)Pn)?O*/O(q7(]v*qn(|W(s((f,*[g)>a*x_(my*mP)q>*`y)9?(gq(t!@` (o~*\\N)Cs*ZH*8U(`[)1p(qF*F@)&;+0<(YM*x}*Sv(w@)0O(d:)6?*a.*c/*{T)0B*2B(]d*2i(|r*{J)U-(Uy)z!<>@AC%QS%UWY]_%df%oq%uw%~ ){!&'%57%9;A%DHKMO%RT%VYZ_%adgh *X0(e.*0B)}c(WK(U<*qO)T*)h1*C6))N)lg*21)L')t3*mE*-4(_T)_h(e**_e*:q*X))dt*{B)T0(o-*9z)?[*4.)5[*r((uu(W:*S|*.T)>9*=U*uI(iZ*ye*4)(c9*Ta(e}*4>)+5)Sf*X9*9s*d.(f-)Q{(_y*.Q(oB)`C)S,*(9(tq(W8)/1)2K*(Z(Tv(|_)E7*FD)&C*ne*yU)mS)`&*`Z(^{*/^*Sz(to(_W(X=(f*(tQ)>r*4(({,)69)7,*^z)*4)R&)}:(WJ(Ya)CK){!ijmo%qt%xz%~ )|!&'%+-%79%BDEG%JNOQT%Y[]%ehikm%ortvy%{} )}!&'*%,.0135%7;=A )Uj)VM)x`*K6),T)l()6]*^o(Yx*eW)?I*5!Z| )+2*5{*Xt(a0*MY*XK(t3([\\(Vl*qk)cT*6K*Wx(|**S`*r:(uT*/[(g;(ld(kU*TI)>4)JQ*mL)po)Xz)*a)kn)D+)E])|l*3z*Xv)2F)y>)>]*Xc(^T(`4*mU*/y*3x*.L(~C)Wy)DE*&;)o}+&I*6a*0|*),):}*oQ)z^(fN(h7)O^):`)4}+04*4w)m=(a3*uT*>e)Fo*F&*qP*s1*nF(Tp(ea*.s)Fl*Z-*2K)C2)+0*1H)}!CDFH%KMOQS%XZ\\^abgikmprsuw%~ )~!&'(*+./13578:<%?A%GIJL%NQS%VY%[^%`i%kmnp%rt%{}~ *&&(pL*2u)Gq))-)>6(a`)0F+4-(X}*\\H(^8({b),P))1)Re)7[*Wz(^=*m\\(bf)SM*:M)eC(p,)Di*X-(tE*_-*=*(g@)~H(Wk)Sk(zt(vE+2X(eA*Ee*~r*UB*3~)>@*x^(n6*sd(`H)k2(`j(|?)7l*L.(UC)7:)/\\)H{(^?({O(^l*N<)~\\*{[*08)1o)^'*X/(]n)*n*`S)ix*N>(ni)tz)-6+42*qI*^R+'T*TE)oj)Fu)Eh*Z8*X5(`W*^t)Yr)HN*n_*bs(n9)E(*K~*_X(gs*&!'*%-/%246%:=>@%BD%FI%KM%OQRT%XZ%]_a%hj%lopr%wy%~ *'!&')%.124%@B%GK +&)(zy)Us)R-(V9({j*~Q*d7)3v*b5*v{(f/)VX(|0(_p(j**0=*2&)<i)8^)@:)43)0f)`3)R!^P (tU)DR*8J(sT(l|*Uu)QK*bc(uJ*2M(eT)Ue(fy(j=*<3*=2)Fk)y6(g7(X7(ee)pk*V;*qQ)Sa)V[*Xk*L<+0[*X:(l-+1o)my)-l)eL)0A(hN(V<)LG*J?)0+*^Z(go)_Z*Dm+06)U&({F),U*.<(j)(Y8)fG(f@(dP(ZI(ek(g'(U;)//)ib(su*>u*4e*G])e<*(z)XG*'!LM%UW%{~ *(!&'%*.%8:%@CDFI%KPQSV%Y[%]_`d%hjk ),d*DB(h~)6g(V&)SX)5S*9x(h)(c])fQ)Yi)l8(`,(b~*TA)KF)-n)/2)W8(o2)O4)gi)G-*_i*/T)8s)0|(hv)n5*Um)`>)VF({])*j*;g)2s+1b)v}*G@*'0)oy(_c)1v)`u)A3)*;)0&*Tr)^K)86*^s).H)0;*Eo(ms)Pz)0m)35(cX)1`)AV*X?)yu(WU)_k)RN*Sp*TV*.r*;y)@X(wu+'Z)UM)WA*UL)U7(WT)^F*<s)52)1Q*tQ*X')xI(_n(nz(q+)Cx)lu)z\\)yg)~P*(!opr%tvy{~ *)!&'%+/12458%>@%EG%NPQS%`b%vxz%} **!&'(*%,.%4 *3i*{:*`1)\\M*Sb+/q(v`*/!*J (ef)Df)HY*^{*'V*sc(e')/W)mb)Ry(d)(y2*.A)85(_S*55))9*@7)6C(^L(zs(WI)x>(`\\)18)UJ({!{y *S!^m )@+).W*r;(u`*/(*.D(kP)EC(t_(XU({m(aa*;o*xj*X>)l/*mq(Zw)z[(W2)EB*~H(y*)P5)pj(o=(|t)}N*qC)`w(^H*4-*97(uE*/E*;<)HA)Ex)v4)uS)7M)8r)~;(Yv(a+(_B*;e)KQ*g=*ZC*X1*N;*o/)~h(W1**!56%km%tv%~ *+!&'%= ([<*8P(`k*{D)WZ)Xv)VJ),7(\\s(vP(|d)UB)Rf)m**?<)GB(t|*So(c/*dE*rC*AH)I:)w+)`O*4z(V8*bP)UC*~N(v{(mQ):d*nJ)sy(Y.*5E)eM*NL*{O*/u*.x(a@)>T*dI*^!im (eH){\\):L)9])ox)yp*J5*r,)5F(al*9I)G.)DU)9/)rR)|Z)TV*.m*N](vD)5.*Bo*9l)lI(ZO(V_)mI*TO(}O))F)}_)?F*eL(V^)Tz*M2*)~*o'(VY*U3*_l*u^)A;)xR*_b)_n)Ut*+!>?%JL%RT%~ *,!&'%F (}B(as*;[(^.*:|)rB)Af++l(V@)1J*(!nc *.i(V)*R|)A_*xh*uD(r[)>g*o])-h)mm*uA)|!LK (_3)_1){^):I){<*.:)gP*w&(U2)^S(UJ*d&(d_)>L)@0*7!u~ (g9(}6)m>*v2)7B)eE)ma(}J*~C*=-(}E(g+)sw(U+)S\\*37)7<)9&))0(^C*Z!+l *o0(Yz(eB)1g)_.(a()8a+0:(w:(ZV)qw(d-*.|)<2)>&)6L)9P(ZD)cS*NC(_&*S}*.w(o**=/*mZ(^g(ex)&N*,!GH%~ *-!&'%-/%35%9;%P (YS)|P)UV*bg*~Y(iy(gA(cp(gZ),=):H)JF(_b)36(_}(q[(b@(o1)tB)qK)+M)3E*)7)5w)6Z(V6)^p*29)7a)_f*uK(oZ*:I)E{)Hv)vX*xw)yI(sr(g^(eL)W~(]p(`U({Y*Tb*43(i<(p0)0L(o4(f1){@)0)(zd)9_)6c(e@)6&({~)E;(h?){e*:T*dK)+)*Ki(t^(p8)7x*Z6*4s(o:)~2(Y2).v({t)OP(c0)}d)e.)Fy)t4)qv)@@(_((U|)pm(~k){k*?&(tt+'Y([W*-!QR%tv%~ *.!&'%46%8HNUVp~ */!-:KQ_xz|%~ *0!&'%)+.%7:; *{])2N)Xt(oG)@O)8W(n,)7V)6,)+i*qc(of)73(j'*Fc*5u*_4(i_*<m)DJ*XV*@5(x,)FB)7P*&P*q`(^<)\\)*U;):\\*NB)4G*/G)_D)Y})hf)Jc)eh)+`*bT)CU)Uf)8o(at)d'*27(XN(vY*d>)_[)V@(b:(U=*t;*on*A})vM**-(]F(ou)<o*3h*(+)T?)Hr)J-(_*(dN)H))dF+1l*&S)ed)y3)ZR)hg)D3*eG++X)wf*<E*;i(el)FJ(U*(d?(ar)ts(d<(`C([_(Xm(YY*0!>AC%FHK%OS%UWX[]%`b%eghj%qsuw%{}~ *1!&'(*+/12457%=@B%FIJMOQ%SU%XZ\\^%befh%mqr )n-)|8*(B)SS*sS(a\\)j2(h;(Yr*31*<n*_o*oq)+_)/N)VB))`)>V*5c*nX)/})_>*.]*(^(_<)G[*(a*96(Tj*^p*eJ)An(VB*Ti)<V*3'(\\X)m;)bE(|C*_N)[L(Us)</*od)+l)?;(`1*KG)_J(ad)ez)i;)D|)vz*tZ(Tz*bA+,9)Vn(_N*XA(ez)78)gl*=T*t:+3p*mv(Wq*1)(_?)^P*rk(~Y*xf(eC(Vx)Y4)hj)K*)uG*{d)lV(`2)no)U=)F&(^9+4,*3((gD)}P)|,*1!svwy%|~ *2!(*%03%58=%@DEGIPQS%UWYZa%fhjoprtvwz{}~ *3!&+%.02%468%EH%MO%Z *r|(og)7L*r=)JK(vx):a*&5)ZN*rA*9m(cq*xe)+&)^d)9k(cs*DC++5+11)uh*tv*Z=*XB+0v)[D)xU)-9*r<)5J*~>(er*n7(Y,)?g(}!jf */V*DE)R6)-o)gA)Y|*/@)&9)8,(zz)Y~(d+(U^)9X)lb)6d*^X(Wa(Ve)ST*.P*Sw*>'*HJ*0?*`s*n})~d*~k*K}*>G)Tp*~P*.v(uU+1Y)gU)t6*Dv*~!6L (kb(et(pU(U]+1D(ce*_Y*54)ry*{g*F0)Yy*@k)C:)30)Zj*3![^_begj%oqrtv{ *4!'*%,0479:<=?IK%OS%Y\\cdfgjry{} *5!&)%,.%02367@BDF%HJ%VXY[^%`bd%hj *U4*9Y*;@)q2)Qs).d*<y)f>*:s*nt)Q;)si*my(c~*:p(^^)*,*V>*X8(U5)ge)E&)G_*dJ*tM)a4)SO)qI(xT*oB)Q/*0v)@p(|.(v-(x\\*q!7F (W'*=o*?J)Mp)px*o1)f.)H'(zo)qo*dn*uL*)3*`/*U'),b*'|)yP*N?)Sz*F^({})*1)HJ)q`*/6(^a(]r(b1(wD*/F*uM*:E):.)rk*Bv)yJ)X+)+/(uf*@i)^H)Qq)7))pX)>J)1/*qL)@W*H/+/s*nG(ej(g(*U7);~*5!kl%prtx%z} *6!()*-%13%68:<%>ADEG%JSU%Y[]%`bd%iklp%tvwy{}~ *7!&'%+-%25%8=>@%BDF%L )<&*C^)L>*6n)vk);o+'l)6|)Ci*<g(s'+1v)SY)Z_(|<*rB*To)c})E\\)71)d&(V=(v:)Q-(rk)BE)*D(bG)2|)Cf)q.)rM)d,)ze)7i(h<(fT*mS*b)(w7*.M)Qv(U0(uC*2F(tn(cf)l4*s[(m_)81*5<)0U*qH)Vy(ff*{V(^Q(yR*5((u{*tW(ZZ)T:(}A)7I(XB(cN*6M*`>)YR*A*)72)*c)vA)<b)93)/'(w3*dS+/o(}D)8`*2x({4(ig*o!KN )V()1()El)eJ(_P({8*7!MN%[]%_abdg%kn%svx| *8!'(%+./135%:=@D%GINRZ\\]_%cefhjl%np%wy{%~ *9!'(%.0 )7Q)T3)cy)60*ma*.W*5>)UO(^h),A(uA(ak)/D(u@)B-*DD)mC)8;)4[*)F*T^(h8)O9+/u)Pm*B{(fY([M)SR(ic*Y[)cJ))])/G)i>)77)9J)cj)-|)X4)U:)=T)[>)pq)vS)q<)lQ(`>(e8(U@)+4)?c*2`*4Z)6^(g1(`B)_0*Jk*Yx)T6(f|*4^(q**Ky*XT*r`*cz(XK)SI(jW)p_)te)6k)_{)[t)-Q*@D)H[)uX*&Y*6z)CI+0F)8x)v3(oR)tG*t})6!<n (aI)i=)Q7*9!12%48<%?BCGHJL%NPSWZ%]abegijny|} *:!()*-.01347>DGHKPU%XZ%\\^`acdfhj%nxy{~ *;!'(+-.2%;>?CEGLPR (i]*5i)mV)pG(cH)n)(\\y(}F*S)*&)([&)ce*~a*y_)ZA)k8)x9)<4)s3)7f*xq*X+(gl*35(U?(oM*:g*=p)*b(_`)kL*T((}T(oD)TQ*xg(wa)ti+'\\*_|*(E(`p)5m*nT(VZ*<B*>k*=L*?c(p^)Cr(n?)A^)Ub*U<)Bt)]E)C])OL)FI)56(v/(TI(_7)ZE)E^)S=(^B)HL(tm)Oy)lc)&a*5;+3<)?y)w!rk *~[*Xw(~.(UK(W<(f3(tw)tA(lV)Qt*_U),@)S+)T8*Sh)9H*;!STVWYZ]_%chj%nrw *<!,-%256:%@CDF%IK%MP%SUVY[]%ch%kqwz{~ *=!&')+,.013%68:<%>AE%GI%KN%P )0I)U9)d:)6)*m!Ax (cR*_R)~9(Vs*U1(Uk+1r*m!df (`g)[B*aB)UA*U?(qB)'F)O!2[ )E6(f_*6&*0t(rq*A6),w)6e)Ld*o:)>m)0])G?)s5(UA(Y1))/*v*)<Y*1g)&@(YX){S(_z*:r(TZ)/a){I*mY(Y>(VF)y^)i<(bL*:')=&)y5(|;)S/*u=*^e)R)(Zn(d5)WO)<{)Ad)R7)1E*xW*T[)*u)iD){=)yC(T^*b7)hd)RI(mo*cx)Ss*Y2(cI*Ea)C0*\\K(}M*~;)Wj*=!QRV%Z]%_a%cehj%msu%z|%~ *>!()%-3%:<%AC%EH%OQ%Z\\%`bg%jln%rtx%z|~ *?!(*,- (e3(wQ+3w*YJ(dq(nD*y.)D(*do)Sw(^4)mn)7])dq(`R(a^*/{)^o)o*(d*+0A)K-)uJ*s]*K^*13)`_)b:(^U)E_)k:(sc)=l(mL*Sf*{K)63*.o)1y)_o(sk(V!UN ).X*vy(W6*Sa(_v(uW*.E)5p(Va)@.)5**;M*?z*;x*Gv)ad)YN({p*.l(^c):()E`*3f*;N*IL(]7({1(uO*_B(U`)Rd(^1*LQ*^Y*q}*AI)if*nj*q?)VI*:S),n)<?)Tg*>2*6@++w(r6*X[(TO(dw*?!./%24%7;>@%GIKLN%QS%_abdf%hlmoqstv%y|} *@!&'*,-/%469:<?%CE%GI%SUVX%Z (WY)>^)G+(js(Tm):s*~d)6.(y+)ig*99)VL)Ho(\\e*<J)t7)C~(`S)SG*.K(\\9(i^)a.)}o)AB)h+*:Y)D.(}v(`:)aM*JI*q9*rK)<r*Xa*7,(i})R\\)5c*/o(rj(W_(i?*XO)A<(TP(|x*Kx)G|)8_)z,)_i*9T(bb*w/(|o(h:*b;*.g(u/*XJ*Eb*8!,- *Xf);J(|b)2x)V,)wh*S{)tl)l0(g&(Ws*\\G)W;(w;*._)x/)S6({X(x8)kp*4B)2u)Wa(so)k!u{ )d7(cV*/4*@![\\%ce%hjl%npqs%vxz%~ *A!&'%),%5=%AC%FJ%TVWY%\\^%bd%fh%prt%w{|~ *B!&' )qA)pt(a**4`(n_))P(tW)eZ)?_)Xp*T;(}=*De(cP)t()7h)@?(VT*yf*Dt({U*T*(eO)sp(Xa(}S*~@(v?),L)wd(sj(T\\)F2(Ux)7W*P[*`U(b')@x(j|(lZ*`:(Vi(Xo*eE*{E)Qo))J)/u({[*N@*T9)>1)5g*{k({?(|])9@(i'(e4)nq(^I*A+)E.)H4)PC)6U*^}(e1*82)Vt)m3(US*XN({')ao*BU)B!(p *0Z*FB+1k+2e(}c)Cm*`()FD)DD)5))|C(r])+L)>k)Zp*B!(),.%46%@C%IK%MOQ%SW%\\^`%fh%np%twxz|%~ *C!&'(*%02%57%E )0.(`Q*2C);Z*JN)l&))M)FF)7^*t`(e))c[*Te)R;)rH)z-(f2)s:*xZ*8<*TX)u1)CR)_C)?Q)<B(k})/O)y9(eU(Tc)P4*3c(|X(k*(mp(W!uw *{G));)Dc*2n)/4*xb*`9({B*Sy*TY):{*8x)=2(kD*:=*d9(Y`*)w*`W*(O(\\q(r))YG({v*T-*3`*dL*?M)~R*Dq*s!(, */&+&D)uj(~-)zv*`z*sD)x0(zi)8p)|x*@))H.(hX*/j)hq*)y*n[)5\\(q}(Vj({:(uF(r,*C!FGI%KM%QS%]_%bd%suw%~ *D!&'%+-%/1%@FGI%MO%QS%UW%^ )g')8/*[@*Z]*4R*:B)6o(eM)TE*d2(tP)/3)Rw(o0);P*X*)nv)Z((o>)MD)n;)[S*U8*Tl(oI)QO*Jp)v6)9Z(eV)_/)Rk(r0);0(q3)Ha*6m(hb*)-(ZH*\\V)Vo*YF)_m)9G)V>)Yl*/'*=g)Fv*`;)V{*rl*Se(t})d>*C1*6P)m`*PR)H0(`n*Zp*nk):/*xx*[9(iu(X5)C=(l})1U)V8(`](}N(tO)WE(rC)l-)kr)0E*84*5q)7{)DF*_s)qz*ZA*X4*mt))^(d;(f0)_E*D!acdf%lw%} *E!)*%-/1%69%=@AFHIMNR%TV%Z\\%^`cghmnp%ruwx{%~ *F!'(%*,%.17%9<%?ACF%HMNP%SVX )RG),4([3(VA)+C)8K*8g*`R)G**dB)sA(ei*n6)-H)|R)GP)8V)}f*.y)n&([N)6X(tZ*`G(_k)y;){G(n:)-v*`L)U~(}e(n[(em(]y)X>(mw)9`*xs*6Q*FW*LV*`8(e{(}t*79)7@)5t*5\\+0,*r6*~!8F )IU(ur)7=(i7)8'(gr*Et)U8(vw)k<*Jz)O|(t<*UW),l)Xo)gc*x](T~)_y({C)us)8N)AJ)p/)1K({R(wd(TM*6')Rq)gE(V5)Dn*09)-d)@C)CY).c(uQ(vu*F![]_abfh%jl%oqrtuwxz%|~ *G!&)%/3468%;=%?AC%HJKO%VXZ%\\^`%ch%jmoprsuw%{}~ *H!&(%.0%4 )(n).9(d'*vx*_n)Fx(n0(i()1_(U')[3*/5*:5*=q(vH(W!Ze (}C*.F)Ch*@r(fw)lL*4G(i{+'g(X/)Ww*Tw(|g)3>(cz)nj)Ws*D~)?)*qJ*.S(f?)zR*)a*q=(k(*1P)kD)8.*FY)VD){c)5-)?C(cv):@)S1))3(f`*m[(U9)Rh*TP(}P)@)*9c)H((f!B8 )Q+)Ox(V()8S(cW*8>(WH(Y7(oA)5&*tB)AT)d.(bg(ab)0x*TS)@])ai)Du*MR)u.)t2)A`(l)(f<*n{)d?*H!5679:>@%BDF%IKLNOQ%UW%Y\\%`d%jl%oq%tv%y{%} *I!&'%/1%46%9;%@B%IKN%QS%WZ )yx)0H))T)0b*6o(t;)1\\)aT)_q)YB)RW)dE)MH*K2))u(UM(xu(j<*n=)Tl*)R*s6)5+*.`)ru*Dr(c2*tb*_')Aw)&4(Y))eY(TQ(d\\(t5(ep)98*o)(]m(Vm++P*.>(gc*W}*J2*8W*qA)V1),c(y5)A.*r_)gj)fA(du*6L*{Z*10({a*r!mF *.Y)q8(dX*ow*{n)~l*Lp)XI(UN*1c)x6*TJ)1s(gx(V?*xY))?)L~(\\M(en*Ul*>1)u9*tH(`d(h@(m8*nZ)V+({l)Vi)AC*I![\\%hj%oqrt%vx%z}~ *J!&'%),%13468%>DEHKMOQ%TV%Z^adeghjl%oq%su%y{%~ *K!&(*%/ (|m(zm)FT*3s(iq)|~)>C)I|(V/)OY*G7*uv(c^)80);@*b0)?>*4E*Tt(^e)H1(d.*I0)4=)Sr)TP*U-(}V*BP*9v*nf)O5*_,)?R)/-).N(Yj*I|)@h*67)f<)1z(^@(`+(on)-F*b(*J**df)*g)D4)/Y(vG(]i(_i*4|(bp)S'*sa)aZ(WL(Yw*1-)C{(je*nb)y8*Jt*.}(rw)5(*tD*DN(k_*x[)-t*Su*?u*d+(e6)@6)*~)lY)0=**l(xA*/!+. *^S(jG({Z)1,)?m)g>*K!13%57%;=%@B%EHILMO%RT%VX[\\_%cefkln%twz%| *L!&')+%-/%57%;=@%DH%LN%PR%UX%[]%_ac *`A)oU)qi*.t*u_*BA(zv){:*t.*Iw(b3)a_).5)@5*TF(|Y*~9))))PB)Rb*S!jl *`B*_V(dA)7&+/!v} (fD(Tq*:+)cw*E7)&i*J7)VR*sb(g|(V.*Ss)`2(gh*qX)_a)WC)pi(Tk)tI*FT(~U),3*Nz*x|*q])^i)Sm(tj)9a)q|*J+)ZS*9:(qa)bL(dB)tO*s^(hS)-J)`Y({k*T~*~V)P<(tT+0&)y_)DM)6/(XQ)mE*0r)T`*r))R.(W+)mv(^G)Fj)Z}*a_*6B(uc)i~*L!de%lnoq%~ *M!&'%03%8:%MO%QSUWXZ%t );M(},*aD){W*U.(vN(gW*7y*<+*MT*26)IX(l<*2l)cU*eI(_)(UL*xU)9N(T`(eS)C1*5v(tB)VU(TF(sx(cJ):5*nK(Y&(WE*JA*xp(t]*a6)ys(V~*4t)m5)S0({S(v\\)-A)I-*Du(ZJ)):(UF)sq(Vy*9A)6T)@\\*ap(}~(VS)-]*7?*`p*3a)mO(V:*KY)26)P~).Q(U6)pc)Y:*TG*Sk*T!n5 ),?*22*1[*.h*;J*<'(mu)Pp*w,*r*(vo(e|*nP)W5({|*{C(}>),R*s-*M!uv%~ *N!&'%:=GM%OQ%SUWY%\\^a%df%hj%ln%y{%~ *O!&')%> (d&*:_)LN(x6+0g)+**/i*<u*>!./ *;|*G0*__*Xb)pa)-U*xv)uH)@i(h1)7O(XE*7<)ml)+N*sj*ZX*F;(g:)TH)V/)R?)0X(b/)k~)*l(WS)0y).r(}))l.*b4*ms)d~)Sg)X)*cv)CG(e!(P (X3*eD*TU(d~)*k*_S)W.(U{)p[)JU*DR)2A*8&(X;(Yg*`v++0)20)W!g^ *r{(Uu(wL*t,(TT(~+)y1({>*TQ*1L)gC(pi*9R*bG(e^*a&(j[)&=).,)2/)OD)e]*46*PQ*O!?@%^`%hj%~ *P!&'%@B%H )Up(|1*KZ*xd*Uv*~7+0*)WT(^p(]h(p-*J_(dU):S*_&(n)(f\\(nB)fR)Y(*/Y*_m*:?)2f)/Z*rX)C.*.@*Y!1j *mX(~_*(T)CF)1&*qT*2N(U~*bm(bh*r^(]f*_a*As*d1)AE*w.(ze(c,)tm)D')Fp(gt)^Y({g*^g(^Y(nd(g\\)=f)Ar*X!^C *5:*>v*aL*)6(_r*CH)E/)@2)\\.*E?*[v(lX*`X)ot)^Q)b\\*W|)7S(`3)TR*X<)/@(rv)3\\)C<*X`)5j(jS)Wm)Ck*^Q*P!IJ%PS%Z\\%~ *Q!&'%R *n;*qG)qh)F8)Jw(g6(U:)_:*T,);^)?-({<){J(Zj(|F)sI)QA*PA*(H)Sl)ph)?K*_()''(}Z*D,)F;(co)54)|F)XL*/>)L<)|M)-T)Zr),])9D)VK)D;(TN))X*X&(Vk*4D)o&*s9)7E)@v)6A)Sj*Xu)a7*0Q(]k*3d(eI*aM)6[(hD*F2*_**2;*nq*@o*_j)UU)h.)?A)q_)kZ)t\\*7t*Ww*m;(Y/)Dz)m]*T.*tK)8@*oH*r+*?i)84)r()-e)e\\(Uv)/F)>o)7Y)Ou)>:*Q!ST%uw%~ *R!&'%;=%[ ))o)mk*bW*S~*9d)E))>*(f5*FZ)ss*4&*5-)RH(U8*.a*3))q4)I5)PO)6*(Zl(Xf(n|)7q)Ot*Ye(eG)@1*.R).b)8+)9o*7!lm *0V))d)&,(`P)Aj)ya)z9*X()^t)mx)Yv)Si){X(Ts)p^).k*mR*JU*.b)yE*4C*eH(W!-R *8?(fl))&)U.*T0*(U*^^*3u))b(g=)pJ({P)A,*~n)hA)F]*Ev)Co)f=*T!\\? *`H)|f)_])a>)7.)s7(kx(U(*>a)E}(aj*E[*X.*nR)}e*R!\\]%{}~ *S!&'(*%\\inx *T!+4Nm *U)(X1)T=)x.*~E)6V)cH)7g(TY)tK*^V)<]*XZ*&()GC)*s*KJ(uS)<K(sm)d{)I6*o&*`5*XX(oC*/A*Tj(_9)8Z)7C(cb)G&)i**:o*cy(i=)r')^W)UF(^E(gS*XD(vs)Yc)Vg(zl**)(Vh*(-)Yk(z`*7c)WW(zg+&t)HV*Zx({N*/=)/m*.O*b?*Xp(tu):,)yW*YZ(ca)?q)x'*T)*r1*.^*mn*-u(k{*d])C>*0R(|h*aT)@q)).(X2)Ej([1(X>(o3)+=#2$*U!CD%KM%PSUVX%_a%df%kn%tw%} *V!&'%)-%3568%:=?%EG%IK%_ (Uz(TR(]e(TV),<(cT(T[(V,(Td+'J(z|(lW(Tn)y2(U,(b}(U4(tS)cY(c})Qp(mt*4h*{l)Q3)re+2\\(T|(V3+2U(U!IV (V'*9O(zk(ie(kV(VX(d!CSY[d *uP*X](c)(eR(c!5=M *X\\(c!ur (_!u{ (`!(GMYZfx{v *?`(a!>CBQT (^N*0<(V!OW]V|u (W&(Vr(W!V.] (XF(W!0`bDf (X!@I )>3(X!<? *V!`a%~ *W!&'%f (X!A9 (W!mx (X!XVskeq`] (Y3(X^(Y5(Xv(Y!oqsNcleZh (Z!(Y| (Y|(Z!\\?^].L<UX ([U(Zs([,(Z!x~ ([!CR|~ (\\!'8T (]+(\\!kjdl (]!,0 (Vq)RD(X!:G (YW+43)RM*'}(^:))E+1g*{m(^M(t:(b!au *O((bx(_^(t?(]z(V4(]{(VG*JL*K)(VI*5?*KW)xQ(zD*I:*1G(^!w} (_!0/ *W!gh%uy *X!QRW_eh%jlnoqrx%~ *Y!&')*-%03%79:<%EG%IK%WY]^`bdg%iln%qtwy%{ (_:(^!bnq *S!]cdgqrt *T!&'/326%8:<=@CDHLMRTWZ]`cdfhkpsuvx%z} *U&*T|*U!(*%,02569:=>@A (cx(d0*q!lqp *r'*qy*r!328?JU]bhj~ *s!*4M *a!vz|x *b!2':9<@ *Y|*Z!&'*.%03%57;<>%@BDJL%RT%VY[\\^%ac%jnor%vy{~ *[!'()+%-01348:;A%EH%MO%Z\\]_`cf *b!>6UKDVJMYlhb]aqu *c!+1OKP^\\fps (`'(th(a!cmn (b&(hQ(b!8>X (e<)be)s[),1(_!ho +'G(dl),>)lW))7(o/(p!3+ (rV(s!;DP (n!ehfoujk (o?(n!w~ (o!LhNi_^KPYV (p!7. (oo(p!<Y1> (ov(p!*_bdc\\B~y (q)(p!ng *[!hjl%prsuw%y{}~ *\\!&'%*-%/1%79;%FIJLMO%UW%ik%~ *]!&' (q!<>. (pw(q!1OJuQ (r!=DYarX *{}+2^)4t*9!@DFVQoKUX^`r *:!&, *9w*:!68Q *9!_~u *:!9:/ *9!p{hqf *:!2< *9k*:!OweR}uJb@FziA *;!&/ *:t*;!)* *:!NC *;!1fpq *:v*<N*;!QIF *<W*;!sDd\\XtU,uBOH{z *]!()%~ *^!&'%. *;!}0~ *<!(&)*l4op\\fOXA8re9t7TZdvx} *=!dH; (q8*=!{n@`9 *>!&B *=!ti7Brf[\\M( *<|*>0*=!SD *>!f[dc} *?!89+:) *>!FPs *?!'=? *>!;w *?!r~ *@!(> *?n*@+*?!{pk *@8*?!RjeH *@!=;d )kc*A7*@H*A8*@w*A9*^!/0%OTjv| *_!.1%35%8;=%@C%FHIK%MPQTWZ%^`cghkqrtx} *`!')*,%.2%467?@DFKMP *A!U: *@!WT *A!XGgc]y )s0*A!Bqz *B!JN-5 *Ax*B!TB+_]Vyg *C!)LtRvc *D0),!;E (t!bg *2m(t{(u'(t~(bw(}!'*19 )5h)6!-b~ )7!4DAX )83)7`)8!J\\T )9e):U)9!)2Fl )8~)9!dB )8z)9!ft ):!QW?^ )9|):!=- );X)9!~v );!KG ):!jz );&):k);!,'d )<1);s)<C*`!QT[%]_%dh%loqruwx{}~ *a!'(%+-3%589;%@CEFH%KN%RU%[]`c%fhik%oqsuwy{}~ *b!&*+-%/138=BCEF )<!'deFgm} )=!+86]y )>)),H).])ko),N(cn(e!NZFEXosc (f!OV%XZG (e~(f![]'6 (g!-? (f!{uh (g!EF/ (f!zj (g!H{Xm_}RQ~ (h&(fv(gN(h'(g!fjw (h!+,. (g!TUO (h/(gz(h!0m9rOfEtuacy| (i`(j!/U (i!Bf:N8I5 *b!HILNOQ%SXZ%\\^%`d%fi%koprtv%y{%} *c!&'%),%.02%EG%JL%NQ%[]_%eg%oq (i!0On%p,)U (j!+r (i|(j!QY( (iz(j?(iw(j!v1 (it(k&(j!]^49 (k!1> (ji(kf(jq(k!23 (jt(k-(j!}d (k!6,9: (j!lm (k!/<+ *^~(k!eOSHkjEGnt (l!F'E (ks(l!;PGJ:BtR_Yijs (m!(Dilrv (n!1'5;@FEX ))!Wa\\Yy )*!*+ *c!rtu~ *d!'(%*,-/034:%<?AGN%PT%XZ\\^bcg%mp%ux%} *e!&'+%.1%46%ACFKM%VX%` )*!&3CJMP (~!8&9<B4DE=FHaNiXW]Omcp~ )&7(~w)&!8UVzy )'()&!wqYn )'!R8.7fUiWeEDcn| )(!:> *U~)(!Xf )-!W[fkmpy} ).!'38@G *J@)-E)d!ruy|} )e!/-:9>T[U^`cm_of *e!ab%~ *f!&'%g )eg)f!*&4 )ev)f!10(5L8?KDc`js )g!&)8 *8;(tK*yn(t!J( *{!8<%AILRUY\\_befh%j )*o)+')*z)+!,;6OKTI *XS)+!hgq~ ),'*73).!OTaZ )/5).y)/6).!lo )/!078 ).!ux )/!*KgXMA?[]<qS )0!QRTS )/t*f!hi%~ *g!&'%<>%VX%p )0!CVos )1-)0!v\\ket )1!l;1]XFZ4 )2!GM<J )1t)2!'5Rq )3!Czbu )4!,Ij ).h*sP*q!8:@BDEKMRSUWY%\\^ad%fhi (Tr)c])51)R!<[cQ )S!Q3>B: )R!op{} )S!4W~ )T))S[)T!LMF, )S`)T!5+O@C )S_)T!(DS *g!qr%vx%~ *h!&'%79%y )U5)T!|a )U!?D )T!\\Ync )U!'I*1 )To)U!KNP/ )V4)Uk)V!AC )UZ)V!67 )U!X\\x_ )Wd)V!jh )W!(X )Vb)W!*[0' )V|)W`)VN)WV)VQ)Wu)X!_?\\ )YJ)X!PwDE )W!|o )X5)Y!wI0x )Zl)Y!z=?USOoLg'Z7 )[!H,- )Z!cT8nu )[!1Z )Z!iHh )[!osr^Xb` )\\^*h!z{%~ *i!&'%TV%~ *j!&') )\\!V4FCOn{km| )]!NWOmi )^!*9 ({!7;LJ\\o )l,*~h);:(|!BL *L\\(|N*[<*Qv*_!Gdfv *`&*_!uzw *`+*_y*`!=<C^IENYmneg| *a!01/G7A: )BP*a!S\\agbj )-!4;:< (}@(gV(}!U^ ({((}!hk *1K),!gfj *9;),y+'S(}s(u!NPZvwp *j!*+%LN%~ *k!&'%.0%2 (ud(v>(u!xkq (v!F& (u|(v!K2yzQ|WLm (w'(v}(w!MO,>.[ (x)(w!epW} (x7*4p(x!l]9< (y!'T (xt(y!;= (xz(y!ILZ?OAEr (z!'&BGP (|!sz (z!ju ({*(z!acr *~!?ABDIGJKORTZ\\]`be%gijlmoq *.!9;=?BC *k!34%:<%~ *l!&'%: *.!GJXZ%\\cefjnquz{ */!),/023N7;<?B%DHILMPRSXZ]\\`b%hk%np%tv )*i)l|)(|)l;*at)g!HKh\\Y )h0)g|)h2)g!qmz )h!*)F: *x\\)h!kJH? )gt)h!Sp )i!2c.-0864 *l!;<%IK%vx%~ *m!&'%7DIKz *n!)-.4@Uvz )h!|{ )i!Id_]a )j&)iu)j!-K=/06:MWX?V )k()ji*v!|}~ )D!18C-N )E1)D!lOX} )E3)DZ)E!4*9 )D!p\\a )E|)F<)Ed)F=)E!u< )F?)E!eAf?i )F3)E!ODn )FA)EM)F!0ef )G!:;(< )Fw)G!>] )FP)G!/@ )Ft)GA)F!sq}|\\ )H6)G!iNQmE )HC)J=)H})I!GH )Hz*o!(4>DILV[aouvx%~ *p!&(%s )IL)Hq)I!3) )J&)Hd)I8)J@)Ia)J/)Ij)J!,S:OgG )I\\)KB)J!VW )KD)J!X52Hjv )K1)J!z| )K!J'7@U )Jd)KV)J\\)Ku)LL)Kc)L!45 )M))Kh)L!a[ )Md)L!mxR )M!R= )L!ZEu )M!@UTm[o )f!Je )P!:;@=KLFSTZc *^!UW[%]_`bacdfhklnqu *p!tu%~ *q!&'%6;NVbgjmor%xz%|~ *r!&-%0479@DEG%IL%PR%TVY[\\ac%gin%z} *s!&' *^!wxy *_!)+ *\\j)5!'37;>=A@H *7`)k!EJUegi )>/)@!789Sb )DW)@!L^I )^`)C5)@!f}z )A&)@~*2<)A!OD1?FQGgt| )B!>4Urs} )C'*X!236;=@EFHIGMUY *N!AD%FH%K )d!3d )c{)d!+4CDIPRTW )7r)8C)9h*s!)+.%02378:%CE%LNOQRTUWX\\_`eghmnpqs%|~ *t!&'%+/%24%689<>%ACFGIN%PT%VXY[%_acd );E)=,*2:)Q!JS]UYegfmux%z )R!(0+19 )>!0Pf )c!kptN *DV(`0*3!|yp *4@)CH*4!A5/18;k%n_FH]Q[ )CN*4!aouxq *5!89 *4v*5')CS*5=*Ue*5!aIWC]sw~ *6!F+,C2;NO?9 (q~(xw*6!ZTc )Ym*6!u| *7E)Cd*7!C4 *t!ef%moprsuw%{~ *u!&'(*%<?@BCEGHJNOQ%SU%]`b%fh%oq%uwy%{~ *v!'()+%/ *7:*6x)O!6IKUXk *y!XYZ\\`a )Pl),})P{*Nm)?2+3=)?!5^hfenptx )^![wqx )_!=B9-3jL )`!9<?XZ )a!C,8 )`n)aB)`s)a!HJh )b!*, )a!xp )b!WK^p )c!;F )^G)`A)a6)b0)5!ZY_de )w!ejps )x!,- )w})x!+3(1@8KV[kx )y+).!\\[ *v!01346%<>@BCEG%wz *w!'(%+-0%G )/n)0!63@ )/s)0!2< )1+)2!-4 )3!+wk )4!@F{ *3!]\\ )SA)TK)WF)t!+-5>LMF )?M)t!bQRn%pTqZaX^ )u!*I23 )t[)u,)t|)u!(Fwovcx} )v!&5<(W\\Lou )w/)vw)w!=NH^ +4.+2!>@A )q!1DM9GHZbYmfux )r!78.*AO *w!HI%~ *x!&'%N )r!ILftdgsx )s!-.>CK )l!7=KHEXov )m'*0!@IG *Oi*0!P\\Yaif )p!f~ *Ii*m!89:>=?@BCGJHM%OVW^]`_bcegi%moprw{%~ *n!&'(*%,/%13258%:<>?ABD *x!OP%Tknruy *y!*/%TVW[]^b%dg%mp%~ *z!&'%5 *n!CEHIM%OQSVWY]\\`acdg%il%pruw%y| *o!+,*-2357%9=?@C6E%GJMOPS%UW%Z\\_`^bce%mpr%t; )s!uz *sf)y!Me[c~ )'A)y!{z )z!=3 *z!67%:<=?%[]%~ *{!&'(+%79;HMNPSWX^ )z!XVp +1m*{z){6)oz)p!',2= )k!46 )l)+/!prx%| +0!)(-/.01589;=%@BCEHLNQ%SUZ]%chdj )m!68:DAPGWX\\hUTgfzq )n!.31/62N<GJ[KPWbUpc`d *{!aco%y{|~ *|!&'%u )nf)o.)n!mk )o2)n!x{ )o!1'50 )n~)o!?PFNH]a *1Y)|S){!>?FLN[lfrnsy *J!BGP[]` *K!'K<ANgShjv *L!F( *Km*L**Ku*L!ME?G6`Wbm *M!9N )m/*4i)p!KM )sj*2!HJLRVX[%]_^gAky| *3!*/FN *MV*x!X`c *|!vw%~ *}!&'%| *x!ilmotz{~ *y!&(),- *D!AH`bsnpo *E!C(&G8B>E.DQ_PiKULJdjO *F!+34/5 *Ek*FU*Ey*F6*E!zsl *F!EI:JLOKe}`gp\\ *G!'1 *F!vsky *G!(k *Fd*G!fgdIY5Wt<LeMBN| *H!?8b *}!}~ *~!&'%5<MSWX^_cps%y|%~ +&!&*,.%0457%;>%ACE%HJ%OQS%VX%[]_a%ikm%su%w *HV*G!qn *H!=' *Gl*H!;u<EC[cMaPZkzp~ *I!MJ5ARXps */w*0!*,- *80)|!gjupq )}))|w)}?)||)}![L>-BE498GR2lnY )~0)}!`qt )~!)6 )}v)~!-,KabsgXc@eW]fo *&3)~|*&!.?<GHLn`^qxm +&!xz%~ +'!&(%*,%68%:<%FHIK%RU%X^b%dfhjkm%~ +(!&'%: *'!(3/AJI *7!wz{}e *I{*8!ABCMOHKX[ST^dikoz *9!&/ *J!\\cf *K!]d *M1*1!,.6>?A *(,)>D*(!AMLNRblmqw|}xu *)!.? *95)B?*1!N]dtpux} *2)*)O**u*+!KS *-:*.5+1!VR *Xs*Y!+;8X *X!gm *U!RT *c!w}{| *d8+(!;<%~ +)!&'%A *d!65D=CQRFHM`Ydaevw~ *e!()*0/5 *U`+0u*Y_*Z!9S *[!N^ *Y!\\fcak}~ *Z!(, *Y!uv *Z)*Ym*Z!:EF1GI2WKbkmz|q} *[!/5.*2&>67FG?ekqdiz *\\!+0,8: *V!*4<7JF )?=*N!PXTV +)!BC%~ +*!&'%H *N!_ei *O_*R<*u>*t!-73JELSRnqt *u)+3!loq%vx +2!CPR *s!VYZko )sM*s}*g!Ww *h8*iU*j(*k/*jM*l!Jw ++!369%< )zB++!?BD%FHINOR%WY%]_abd%kn%qx%{~ +,&+*!IJ%~ ++!&'%/12478=>@CGJ%MQ^`cmr%v|} +,!,-56;<'%+.%02%478:= *u!gp|} *v!&A=5DF *~!{z +&(+0O+&!'+-2163<=B +'!][_a`ei *yo*z!;\\ *{!*) +&!PRW`\\l^jy +'!'+7; +1![\\ *-.+0!y~ +1!&)0 *k;+1!;=y%{~} +2!'.,*/4gqt~| +3!)*0 +,!>?%~ +-!&'%~ +.!&'%~ +/!&'%ntw~ +0!'+237DGI%KMPTV%Y\\efik%twxz%} +1!'(*%/2%:<>%CE%QS%UWXZ]%ac%fh%jnpqs%uwx| +2!&()+-0%35%=?BD%OQTVWY%[]_%dfh%prsu%{} +3!&(+%/1%;>%jmny%~ +4!&'%+/%14%8 .*f.+!Zv .,!oy .-!;<%>@BCGN%PRSV%X -R!XY%~ -S!&'%N")); |
| | | var gbk = src(gbk_us); |
| | | return gbk; |
| | | }(); |
| | | |
| | | var gbk_build = GBK$1; |
| | | |
| | | return gbk_build; |
| | | |
| | | }))); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | const commands = require('./commands'); |
| | | const gbk = require('./gbk'); |
| | | |
| | | const printerJobs = function() { |
| | | this._queue = Array.from(commands.HARDWARE.HW_INIT); |
| | | this._enqueue = function(cmd) { |
| | | this._queue.push.apply(this._queue, cmd); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * å¢å æå°å
容 |
| | | * @param {string} content æåå
容 |
| | | */ |
| | | printerJobs.prototype.text = function(content) { |
| | | if (content) { |
| | | let uint8Array = gbk.encode(content); |
| | | let encoded = Array.from(uint8Array); |
| | | this._enqueue(encoded); |
| | | } |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°æå |
| | | * @param {string} content æåå
容 |
| | | */ |
| | | printerJobs.prototype.print = function(content) { |
| | | this.text(content); |
| | | this._enqueue(commands.LF); |
| | | return this; |
| | | }; |
| | | |
| | | |
| | | printerJobs.prototype.printQrcode = function(content) { |
| | | |
| | | if (content) { |
| | | const cmds = [].concat([27, 97, 1], [29, 118, 48, 0, 30, 0, 240, 0], content, [27, 74, 3], [27, 64]); |
| | | this._enqueue(cmds); |
| | | this._enqueue(commands.LF); |
| | | } |
| | | |
| | | return this; |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * æå°æåå¹¶æ¢è¡ |
| | | * @param {string} content æåå
容 |
| | | */ |
| | | printerJobs.prototype.println = function(content = '') { |
| | | return this.print(content + commands.EOL); |
| | | }; |
| | | |
| | | /** |
| | | * è®¾ç½®å¯¹é½æ¹å¼ |
| | | * @param {string} align 坹齿¹å¼ LT/CT/RT |
| | | */ |
| | | printerJobs.prototype.setAlign = function(align) { |
| | | this._enqueue(commands.TEXT_FORMAT['TXT_ALIGN_' + align.toUpperCase()]); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * 设置åä½ |
| | | * @param {string} family A/B/C |
| | | */ |
| | | printerJobs.prototype.setFont = function(family) { |
| | | this._enqueue(commands.TEXT_FORMAT['TXT_FONT_' + family.toUpperCase()]); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * 设å®åä½å°ºå¯¸ |
| | | * @param {number} width åä½å®½åº¦ 1~2 |
| | | * @param {number} height åä½é«åº¦ 1~2 |
| | | */ |
| | | printerJobs.prototype.setSize = function(width, height) { |
| | | if (2 >= width && 2 >= height) { |
| | | this._enqueue(commands.TEXT_FORMAT.TXT_NORMAL); |
| | | if (2 === width && 2 === height) { |
| | | this._enqueue(commands.TEXT_FORMAT.TXT_4SQUARE); |
| | | } else if (1 === width && 2 === height) { |
| | | this._enqueue(commands.TEXT_FORMAT.TXT_2HEIGHT); |
| | | } else if (2 === width && 1 === height) { |
| | | this._enqueue(commands.TEXT_FORMAT.TXT_2WIDTH); |
| | | } |
| | | } |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * 设å®å使¯å¦å ç² |
| | | * @param {boolean} bold |
| | | */ |
| | | printerJobs.prototype.setBold = function(bold) { |
| | | if (typeof bold !== 'boolean') { |
| | | bold = true; |
| | | } |
| | | this._enqueue(bold ? commands.TEXT_FORMAT.TXT_BOLD_ON : commands.TEXT_FORMAT.TXT_BOLD_OFF); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * è®¾å®æ¯å¦å¼å¯ä¸å线 |
| | | * @param {boolean} underline |
| | | */ |
| | | printerJobs.prototype.setUnderline = function(underline) { |
| | | if (typeof underline !== 'boolean') { |
| | | underline = true; |
| | | } |
| | | this._enqueue(underline ? commands.TEXT_FORMAT.TXT_UNDERL_ON : commands.TEXT_FORMAT.TXT_UNDERL_OFF); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * 设置è¡é´è·ä¸º n ç¹è¡,é»è®¤å¼è¡é´è·æ¯ 30 ç¹ |
| | | * @param {number} n 0â¤nâ¤255 |
| | | */ |
| | | printerJobs.prototype.setLineSpacing = function(n) { |
| | | if (n === undefined || n === null) { |
| | | this._enqueue(commands.LINE_SPACING.LS_DEFAULT); |
| | | } else { |
| | | this._enqueue(commands.LINE_SPACING.LS_SET); |
| | | this._enqueue([n]); |
| | | } |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°ç©ºè¡ |
| | | * @param {number} n |
| | | */ |
| | | printerJobs.prototype.lineFeed = function(n = 1) { |
| | | return this.print(new Array(n).fill(commands.EOL).join('')); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 设置æ¾å¤§åæ° |
| | | * @param x 0-7 å符宽æ¾å¤§åæ° |
| | | * @param y 0-7 åç¬¦é«æ¾å¤§åæ° |
| | | */ |
| | | printerJobs.prototype.setCharacterMultiple = function ( x, y) { |
| | | this._enqueue([0x1d, 0x21]); |
| | | if (0 <= x && x <= 7 && 0 <= y && y <= 7) { |
| | | var cmd = x * 16 + y; |
| | | this._enqueue([cmd]); |
| | | } |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * * æå°äºç»´ç |
| | | * @param content æ¡ç æ°æ® |
| | | * @param barcodeType æ¡ç ç±»åï¼ |
| | | * 0ï¼PDF417ï¼ 1ï¼DATAMATRIX ï¼ 2ï¼QRCODEã |
| | | * @param param1ï¼param2ï¼param3 æ¡ç åæ°ï¼ |
| | | * ä¸ä¸ªåæ°è¡¨ç¤ºä¸åçææï¼ |
| | | * 1. PDF417 |
| | | * param1ï¼è¡¨ç¤ºæ¯è¡å符æ°ï¼1<=n<=30ã |
| | | * param2ï¼è¡¨ç¤ºçº éç级ï¼0<=n<=8ã |
| | | * param3ï¼è¡¨ç¤ºçºµåæ¾å¤§åæ°ã |
| | | * 2. DATAMATRIX |
| | | * param1ï¼è¡¨ç¤ºå¾å½¢é«ï¼0<=n<=144(0:èªå¨éæ©)ã |
| | | * param2ï¼è¡¨ç¤ºå¾å½¢å®½ï¼8<=n<=144(param1 为 0æ¶,æ æ)ã |
| | | * param3ï¼è¡¨ç¤ºçºµåæ¾å¤§åæ°ã |
| | | * 3. QRCODE |
| | | * param1ï¼è¡¨ç¤ºå¾å½¢çæ¬å·ï¼1<=n<=30(0:èªå¨éæ©)ã |
| | | * param2ï¼è¡¨ç¤ºçº éç级ï¼n = 76,77,81,72(L:7%,M:15%,Q:25%,H:30%)ã |
| | | * param3ï¼è¡¨ç¤ºçºµåæ¾å¤§åæ°ã |
| | | * |
| | | */ |
| | | printerJobs.prototype.printQrcode = function (content, barcodeType, param1, param2, param3) { |
| | | var str = content; |
| | | var length = str.replace(/[^\u0000-\u00ff]/g, "aa").length; |
| | | this._enqueue([0x1d,0x5a]); |
| | | this._enqueue([barcodeType]); |
| | | this._enqueue([0x1b, 0x5a]); |
| | | this._enqueue([param1]); |
| | | this._enqueue([param2]); |
| | | this._enqueue([param3]); |
| | | this._enqueue([length%256]); |
| | | this._enqueue([length/256]); |
| | | this.print(content); |
| | | return this; |
| | | }; |
| | | |
| | | printerJobs.prototype.queryStatus = function () { |
| | | this._enqueue([0x10, 0x04,0x02]); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æ¸
ç©ºä»»å¡ |
| | | */ |
| | | printerJobs.prototype.clear = function () { |
| | | this._queue = Array.from(commands.HARDWARE.HW_INIT); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * è¿åArrayBuffer |
| | | */ |
| | | printerJobs.prototype.buffer = function () { |
| | | return new Uint8Array(this._queue).buffer; |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * CPCLæå° |
| | | */ |
| | | |
| | | /** |
| | | * 设置æ ç¾å®½é« å¿
é¡»å¨å¼å¤´è®¾ç½® |
| | | * width:80mm 为576ï¼58mm为384 |
| | | */ |
| | | printerJobs.prototype.label_set_page = function (width,height) { |
| | | var content= "! 0 200 200 " + height + " 1\r\nPAGE-WIDTH " + width + "\r\n"; |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°è¡¨æ ¼ |
| | | * lineWidth:è¾¹æ¡çº¿æ¡å®½åº¦0-1 |
| | | * top_left_x:å·¦ä¸è§Xåæ |
| | | * top_left_y:å·¦ä¸è§Yåæ |
| | | * bottom_right_x:å³ä¸è§Xåæ |
| | | * bottom_right_y:å³ä¸è§Xåæ |
| | | */ |
| | | printerJobs.prototype.drawbox = function (lineWidth, top_left_x, top_left_y, bottom_right_x, bottom_right_y) { |
| | | var content = "BOX " + top_left_x + " " + top_left_y + " " + bottom_right_x + " " + bottom_right_y + " " + lineWidth + "\r\n"; |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æ ç¾æå° å¿
é¡»å¨ç»å°¾è°ç¨ |
| | | * @param horizontal 0:æ£å¸¸æå°ï¼ä¸æè½¬ï¼1ï¼æ´ä¸ªé¡µé¢é¡ºæ¶éæè½¬180°åï¼æå° |
| | | * @param skip 0ï¼æå°ç»æåä¸å®ä½ï¼ç´æ¥åæ¢ï¼1ï¼æå°ç»æåå®ä½å°æ ç¾åå²çº¿ï¼å¦ææ ç¼éï¼æå¤§è¿çº¸260mmå忢 |
| | | */ |
| | | printerJobs.prototype.label_print = function (horizontal, skip) { |
| | | var horizontal1; |
| | | var str; |
| | | switch (horizontal) { |
| | | case 0: |
| | | horizontal1 = 0; |
| | | break; |
| | | case 1: |
| | | horizontal1 = 1; |
| | | break; |
| | | case 2: |
| | | horizontal1 = 2; |
| | | break; |
| | | default: |
| | | horizontal1 = 0; |
| | | } |
| | | |
| | | if (skip == 1) { |
| | | str = "PR " + horizontal1 + "\r\nFORM\r\nPRINT\r\n"; |
| | | } else { |
| | | str = "PR " + horizontal1 + "\r\nPRINT\r\n"; |
| | | } |
| | | this.text(str); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°ä¸ç»´ç |
| | | * @param start_x æå°çèµ·å§æ¨ªåæ |
| | | * @param start_y æå°çèµ·å§çºµåæ |
| | | * @param text å符串 |
| | | * @param type æ¡ç ç±»å |
| | | * 0ï¼CODE39ï¼1ï¼CODE128ï¼2ï¼CODE93ï¼3ï¼CODEBARï¼4ï¼EAN8ï¼5ï¼EAN13ï¼6ï¼UPCA |
| | | * ;7:UPC-E;8:ITF |
| | | * @param rotate æè½¬è§åº¦ 0ï¼ä¸æè½¬ï¼1 æè½¬ |
| | | * @param linewidth æ¡ç 宽度 |
| | | * @param height æ¡ç é«åº¦ |
| | | */ |
| | | printerJobs.prototype.drawBarCode = function (start_x, start_y, text, barcodeType, rotate, linewidth, height) { |
| | | var str1 = "B"; |
| | | if (rotate) { |
| | | str1 = "VB"; |
| | | } |
| | | |
| | | var st1 = "128"; |
| | | if (barcodeType == 0) { |
| | | st1 = "39"; |
| | | } else if (barcodeType == 1) { |
| | | st1 = "128"; |
| | | } else if (barcodeType == 2) { |
| | | st1 = "93"; |
| | | } else if (barcodeType == 3) { |
| | | st1 = "CODABAR"; |
| | | } else if (barcodeType == 4) { |
| | | st1 = "EAN8"; |
| | | } else if (barcodeType == 5) { |
| | | st1 = "EAN13"; |
| | | } else if (barcodeType == 6) { |
| | | st1 = "UPCA"; |
| | | } else if (barcodeType == 7) { |
| | | st1 = "UPCE"; |
| | | } |
| | | |
| | | var content = str1 + " " + st1 + " " + linewidth + " 0 " + height + " " + start_x + " " + start_y + " " + text + "\r\n"; |
| | | |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°äºç»´ç |
| | | * @param start_x äºç»´ç èµ·å§ä½ç½® |
| | | * @param start_y äºç»´ç ç»æä½ç½® |
| | | * @param text äºç»´ç å
容 |
| | | * @param rotate æè½¬è§åº¦ |
| | | * @param ver : QrCode宽度(2-15) |
| | | * @param lel : QrCodeçº éç级(0-20) |
| | | */ |
| | | printerJobs.prototype.drawQrCode = function ( start_x, start_y, text, rotate, ver, lel) { |
| | | var str1 = "B"; |
| | | if (rotate != 0) { |
| | | str1 = "VB"; |
| | | } |
| | | var content = str1 + " QR " + start_x + " " + start_y + " " + " M " + " " + 2 + " " + "U" + " " + ver + " " + "\r\n" + "MA," + text + "\r\n" + "ENDQR" + "\r\n"; |
| | | |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°æå |
| | | * |
| | | * @param text_x èµ·å§æ¨ªåæ |
| | | * @param text_y èµ·å§çºµåæ |
| | | * @param text å符串 |
| | | * @param fontSize åä½å¤§å° 20:20ç¹éµ 1ï¼16ç¹éµï¼2ï¼24ç¹éµï¼3ï¼32ç¹éµï¼4ï¼24ç¹éµæ¾å¤§ä¸åï¼5ï¼32ç¹éµæ¾å¤§ä¸å |
| | | * 6ï¼24ç¹éµæ¾å¤§ä¸¤åï¼7ï¼32ç¹éµæ¾å¤§ä¸¤åï¼å
¶ä»ï¼24ç¹éµ |
| | | * @param rotate æè½¬è§åº¦ 0ï¼ä¸æè½¬ï¼1ï¼90度ï¼2ï¼180°ï¼3:270° |
| | | * @param bold æ¯å¦ç²ä½ 0ï¼åæ¶ï¼1ï¼è®¾ç½® |
| | | * @param underline æ¯ææä¸å线 false:没æï¼trueï¼æ |
| | | * @param reverse æ¯å¦åç½ falseï¼ä¸åç½ï¼trueï¼åç½ |
| | | */ |
| | | printerJobs.prototype.drawText = function ( text_x, text_y, text, fontSize, rotate, bold, reverse, underline) { |
| | | var st1 = ""; |
| | | if (rotate == 0) { |
| | | st1 = "T"; |
| | | } else if (rotate == 1) { |
| | | st1 = "T90"; |
| | | } else if (rotate == 2) { |
| | | st1 = "T180"; |
| | | } else if (rotate == 3) { |
| | | st1 = "T270"; |
| | | } |
| | | var rev = 0; |
| | | var und = 0; |
| | | if (reverse) { |
| | | rev = 1; |
| | | } |
| | | if (underline) { |
| | | und = 1; |
| | | } |
| | | var st2 = 24; |
| | | var st3 = 0; |
| | | if (fontSize == 20) { |
| | | st2 = 20; |
| | | st3 = 0; |
| | | } else if (fontSize == 1) { |
| | | st2 = 55; |
| | | st3 = 0; |
| | | } else if (fontSize == 2) { |
| | | st2 = 24; |
| | | st3 = 0; |
| | | } else if (fontSize == 3) { |
| | | st2 = 55; |
| | | st3 = 11; |
| | | } else if (fontSize == 4) { |
| | | st2 = 24; |
| | | st3 = 11; |
| | | } else if (fontSize == 5) { |
| | | st2 = 55; |
| | | st3 = 33; |
| | | } else if (fontSize == 6) { |
| | | st2 = 24; |
| | | st3 = 22; |
| | | } else if (fontSize == 7) { |
| | | st2 = 55; |
| | | st3 = 77; |
| | | } |
| | | var content = "SETBOLD " + bold + "\r\n" + "IT " + rev + "\r\n" + "UT " + und + "\r\n" + st1 + " " + st2 + " " + st3 + " " + text_x + " " + text_y + " " + text + "\r\n"; |
| | | |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * æå°åæ¾ |
| | | */ |
| | | printerJobs.prototype.inverse = function ( var1, var2, var3, var4, width) { |
| | | var str1 = "IL"; |
| | | var x0 = var1; |
| | | var y0 = var2; |
| | | var x1 = var3; |
| | | var y1 = var4; |
| | | var w = width; |
| | | if (var1 == var3) { |
| | | x0 = var1; y0 = var2; |
| | | x1 = var1 + width; |
| | | y1 = var2; |
| | | w = var4 - var2; |
| | | } |
| | | var content = str1 + " " + x0 + " " + y0 + " " + x1 + " " + y1 + " " + w + "\r\n"; |
| | | |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * çº¿æ¡ |
| | | * |
| | | * @param lineWidth 线æ¡å®½åº¦ |
| | | * @param start_x 线æ¡èµ·å§ç¹xåæ |
| | | * @param start_y 线æ¡èµ·å§ç¹yåæ |
| | | * @param end_x 线æ¡ç»æç¹xåæ |
| | | * @param end_y 线æ¡ç»æç¹yåæ |
| | | * @param fullline true:å®çº¿ false:?è线 |
| | | */ |
| | | printerJobs.prototype.drawLine = function ( width, x0, y0, x1, y1) { |
| | | var content = "LINE " + x0 + " " + y0 + " " + x1 + " " + y1 + " " + width + "\r\n"; |
| | | |
| | | |
| | | this.text(content); |
| | | return this; |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * æ¸
ç©ºä»»å¡ |
| | | */ |
| | | printerJobs.prototype.clear = function() { |
| | | this._queue = Array.from(commands.HARDWARE.HW_INIT); |
| | | return this; |
| | | }; |
| | | |
| | | /** |
| | | * è¿åArrayBuffer |
| | | */ |
| | | printerJobs.prototype.buffer = function() { |
| | | return new Uint8Array(this._queue).buffer; |
| | | }; |
| | | |
| | | module.exports = printerJobs; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // æå°æºçº¸å®½58mmï¼é¡µç宽度384ï¼å符宽度为1ï¼æ¯è¡æå¤çæ¾32个å符 |
| | | const PAGE_WIDTH = 384; |
| | | const MAX_CHAR_COUNT_EACH_LINE = 32; |
| | | |
| | | /** |
| | | * @param str |
| | | * @returns {boolean} stræ¯å¦å
¨æ¯ä¸æ |
| | | */ |
| | | function isChinese(str) { |
| | | return /^[\u4e00-\u9fa5]$/.test(str); |
| | | } |
| | | |
| | | /** |
| | | * è¿åå符串宽度(1ä¸ªä¸æ=2ä¸ªè±æå符) |
| | | * @param str |
| | | * @returns {number} |
| | | */ |
| | | function getStringWidth(str) { |
| | | let width = 0; |
| | | for (let i = 0, len = str.length; i < len; i++) { |
| | | width += isChinese(str.charAt(i)) ? 2 : 1; |
| | | } |
| | | return width; |
| | | } |
| | | |
| | | /** |
| | | * åä¸è¡è¾åºstr1, str2ï¼str1å±
å·¦, str2å±
å³ |
| | | * @param {string} str1 å
容1 |
| | | * @param {string} str2 å
容2 |
| | | * @param {number} fontWidth å符宽度 1/2 |
| | | * @param {string} fillWith str1 str2ä¹é´çå¡«å
å符 |
| | | * |
| | | */ |
| | | function inline(str1, str2, fillWith = ' ', fontWidth = 1) { |
| | | const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth; |
| | | // éè¦å¡«å
çå符æ°é |
| | | let fillCount = lineWidth - (getStringWidth(str1) + getStringWidth(str2)) % lineWidth; |
| | | let fillStr = new Array(fillCount).fill(fillWith.charAt(0)).join(''); |
| | | return str1 + fillStr + str2; |
| | | } |
| | | |
| | | /** |
| | | * ç¨å符填å
䏿´è¡ |
| | | * @param {string} fillWith å¡«å
å符 |
| | | * @param {number} fontWidth å符宽度 1/2 |
| | | */ |
| | | function fillLine(fillWith = '-', fontWidth = 1) { |
| | | const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth; |
| | | return new Array(lineWidth).fill(fillWith.charAt(0)).join(''); |
| | | } |
| | | |
| | | /** |
| | | * æåå
容å±
ä¸ï¼å·¦å³ç¨å符填å
|
| | | * @param {string} str æåå
容 |
| | | * @param {number} fontWidth å符宽度 1/2 |
| | | * @param {string} fillWith str1 str2ä¹é´çå¡«å
å符 |
| | | */ |
| | | function fillAround(str, fillWith = '-', fontWidth = 1) { |
| | | const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth; |
| | | let strWidth = getStringWidth(str); |
| | | // å
容已ç»è¶
è¿ä¸è¡äºï¼æ²¡å¿
è¦å¡«å
|
| | | if (strWidth >= lineWidth) { |
| | | return str; |
| | | } |
| | | // éè¦å¡«å
çå符æ°é |
| | | let fillCount = lineWidth - strWidth; |
| | | // 左侧填å
çå符æ°é |
| | | let leftCount = Math.round(fillCount / 2); |
| | | // 两侧çå¡«å
å符ï¼éè¦èè左边éè¦å¡«å
ï¼å³è¾¹ä¸éè¦å¡«å
çæ
åµ |
| | | let fillStr = new Array(leftCount).fill(fillWith.charAt(0)).join(''); |
| | | return fillStr + str + fillStr.substr(0, fillCount - leftCount); |
| | | } |
| | | |
| | | // ArrayBuffer转16è¿åº¦åç¬¦ä¸²ç¤ºä¾ |
| | | function ab2hex(buffer) { |
| | | const hexArr = Array.prototype.map.call( |
| | | new Uint8Array(buffer), |
| | | function(bit) { |
| | | return ('00' + bit.toString(16)).slice(-2) |
| | | } |
| | | ) |
| | | return hexArr.join(',') |
| | | } |
| | | |
| | | |
| | | module.exports = { |
| | | inline: inline, |
| | | fillLine: fillLine, |
| | | fillAround: fillAround, |
| | | ab2hex:ab2hex, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | const formatTime = date => { |
| | | const year = date.getFullYear() |
| | | const month = date.getMonth() + 1 |
| | | const day = date.getDate() |
| | | const hour = date.getHours() |
| | | const minute = date.getMinutes() |
| | | const second = date.getSeconds() |
| | | |
| | | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') |
| | | } |
| | | |
| | | const formatNumber = n => { |
| | | n = n.toString() |
| | | return n[1] ? n : '0' + n |
| | | } |
| | | |
| | | |
| | | //4å1 |
| | | function convert4to1(res) { |
| | | let arr = []; |
| | | for (let i = 0; i < res.length; i++) { |
| | | if (i % 4 == 0) { |
| | | let rule = 0.29900 * res[i] + 0.58700 * res[i + 1] + 0.11400 * res[i + 2]; |
| | | if (rule > 200) { |
| | | res[i] = 0; |
| | | } else { |
| | | res[i] = 1; |
| | | } |
| | | arr.push(res[i]); |
| | | } |
| | | } |
| | | return arr; |
| | | } |
| | | |
| | | //8å1 |
| | | function convert8to1(arr) { |
| | | let data = []; |
| | | for (let k = 0; k < arr.length; k += 8) { |
| | | let temp = arr[k] * 128 + arr[k + 1] * 64 + arr[k + 2] * 32 + arr[k + 3] * 16 + arr[k + 4] * 8 + arr[k + 5] * 4 + |
| | | arr[k + 6] * 2 + arr[k + 7] * 1 |
| | | data.push(temp); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | //æçå¾ç宽度æ¯240ï¼é£ä¹æ¼æ¥çæä»¤å°±æ¯[29, 118, 48, 0, 30, 0, 240, 0] |
| | | //æçå¾ç宽度æ¯160ï¼é£ä¹æ¼æ¥çæä»¤å°±æ¯[29, 118, 48, 0, 20, 0, 160, 0] |
| | | //è¡¥å
ä¸ç¹ï¼æå°éäºç»´ç çå¾çï¼å®½åº¦ä¸å®è¦æ¯24çåæ°ï¼ä¸ç¶æå°ä¹ä¼åºç°ä¹±ç |
| | | function toArrayBuffer(res) { |
| | | let arr = convert4to1(res.data); |
| | | let data = convert8to1(arr); |
| | | let cmds = [].concat([27, 97, 1], [29, 118, 48, 0, 30, 0, 240, 0], data, [27, 74, 3], [27, 64]); |
| | | return new Uint8Array(cmds).buffer; |
| | | } |
| | | |
| | | function zip_image(res) { |
| | | let arr = convert4to1(res.data); |
| | | let data = convert8to1(arr); |
| | | return data; |
| | | } |
| | | |
| | | module.exports = { |
| | | formatTime: formatTime, |
| | | toArrayBuffer: toArrayBuffer, |
| | | zip_image: zip_image, |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * weapp.qrcode.js v1.0.0 (https://github.com/yingye/weapp-qrcode#readme) |
| | | */ |
| | | |
| | | var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===toStr.call(t)},isPlainObject=function(t){if(!t||"[object Object]"!==toStr.call(t))return!1;var e,r=hasOwn.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&hasOwn.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!r&&!o)return!1;for(e in t);return void 0===e||hasOwn.call(t,e)},setProperty=function(t,e){defineProperty&&"__proto__"===e.name?defineProperty(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},getProperty=function(t,e){if("__proto__"===e){if(!hasOwn.call(t,e))return;if(gOPD)return gOPD(t,e).value}return t[e]},extend=function t(){var e,r,o,n,i,a,s=arguments[0],u=1,l=arguments.length,h=!1;for("boolean"==typeof s&&(h=s,s=arguments[1]||{},u=2),(null==s||"object"!=typeof s&&"function"!=typeof s)&&(s={});u<l;++u)if(null!=(e=arguments[u]))for(r in e)o=getProperty(s,r),s!==(n=getProperty(e,r))&&(h&&n&&(isPlainObject(n)||(i=isArray(n)))?(i?(i=!1,a=o&&isArray(o)?o:[]):a=o&&isPlainObject(o)?o:{},setProperty(s,{name:r,newValue:t(h,a,n)})):void 0!==n&&setProperty(s,{name:r,newValue:n}));return s};function QR8bitByte(t){this.mode=QRMode.MODE_8BIT_BYTE,this.data=t}function QRCode(t,e){this.typeNumber=t,this.errorCorrectLevel=e,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=new Array}QR8bitByte.prototype={getLength:function(t){return this.data.length},write:function(t){for(var e=0;e<this.data.length;e++)t.put(this.data.charCodeAt(e),8)}},QRCode.prototype={addData:function(t){var e=new QR8bitByte(t);this.dataList.push(e),this.dataCache=null},isDark:function(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]},getModuleCount:function(){return this.moduleCount},make:function(){if(this.typeNumber<1){var t=1;for(t=1;t<40;t++){for(var e=QRRSBlock.getRSBlocks(t,this.errorCorrectLevel),r=new QRBitBuffer,o=0,n=0;n<e.length;n++)o+=e[n].dataCount;for(n=0;n<this.dataList.length;n++){var i=this.dataList[n];r.put(i.mode,4),r.put(i.getLength(),QRUtil.getLengthInBits(i.mode,t)),i.write(r)}if(r.getLengthInBits()<=8*o)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(t,e){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++){this.modules[r]=new Array(this.moduleCount);for(var o=0;o<this.moduleCount;o++)this.modules[r][o]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),null==this.dataCache&&(this.dataCache=QRCode.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var o=-1;o<=7;o++)e+o<=-1||this.moduleCount<=e+o||(this.modules[t+r][e+o]=0<=r&&r<=6&&(0==o||6==o)||0<=o&&o<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=o&&o<=4)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var o=QRUtil.getLostPoint(this);(0==r||t>o)&&(t=o,e=r)}return e},createMovieClip:function(t,e,r){var o=t.createEmptyMovieClip(e,r);this.make();for(var n=0;n<this.modules.length;n++)for(var i=1*n,a=0;a<this.modules[n].length;a++){var s=1*a;this.modules[n][a]&&(o.beginFill(0,100),o.moveTo(s,i),o.lineTo(s+1,i),o.lineTo(s+1,i+1),o.lineTo(s,i+1),o.endFill())}return o},setupTimingPattern:function(){for(var t=8;t<this.moduleCount-8;t++)null==this.modules[t][6]&&(this.modules[t][6]=t%2==0);for(var e=8;e<this.moduleCount-8;e++)null==this.modules[6][e]&&(this.modules[6][e]=e%2==0)},setupPositionAdjustPattern:function(){for(var t=QRUtil.getPatternPosition(this.typeNumber),e=0;e<t.length;e++)for(var r=0;r<t.length;r++){var o=t[e],n=t[r];if(null==this.modules[o][n])for(var i=-2;i<=2;i++)for(var a=-2;a<=2;a++)this.modules[o+i][n+a]=-2==i||2==i||-2==a||2==a||0==i&&0==a}},setupTypeNumber:function(t){for(var e=QRUtil.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var o=!t&&1==(e>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=o}for(r=0;r<18;r++){o=!t&&1==(e>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=o}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,o=QRUtil.getBCHTypeInfo(r),n=0;n<15;n++){var i=!t&&1==(o>>n&1);n<6?this.modules[n][8]=i:n<8?this.modules[n+1][8]=i:this.modules[this.moduleCount-15+n][8]=i}for(n=0;n<15;n++){i=!t&&1==(o>>n&1);n<8?this.modules[8][this.moduleCount-n-1]=i:n<9?this.modules[8][15-n-1+1]=i:this.modules[8][15-n-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,o=this.moduleCount-1,n=7,i=0,a=this.moduleCount-1;a>0;a-=2)for(6==a&&a--;;){for(var s=0;s<2;s++)if(null==this.modules[o][a-s]){var u=!1;i<t.length&&(u=1==(t[i]>>>n&1)),QRUtil.getMask(e,o,a-s)&&(u=!u),this.modules[o][a-s]=u,-1==--n&&(i++,n=7)}if((o+=r)<0||this.moduleCount<=o){o-=r,r=-r;break}}}},QRCode.PAD0=236,QRCode.PAD1=17,QRCode.createData=function(t,e,r){for(var o=QRRSBlock.getRSBlocks(t,e),n=new QRBitBuffer,i=0;i<r.length;i++){var a=r[i];n.put(a.mode,4),n.put(a.getLength(),QRUtil.getLengthInBits(a.mode,t)),a.write(n)}var s=0;for(i=0;i<o.length;i++)s+=o[i].dataCount;if(n.getLengthInBits()>8*s)throw new Error("code length overflow. ("+n.getLengthInBits()+">"+8*s+")");for(n.getLengthInBits()+4<=8*s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(!1);for(;!(n.getLengthInBits()>=8*s||(n.put(QRCode.PAD0,8),n.getLengthInBits()>=8*s));)n.put(QRCode.PAD1,8);return QRCode.createBytes(n,o)},QRCode.createBytes=function(t,e){for(var r=0,o=0,n=0,i=new Array(e.length),a=new Array(e.length),s=0;s<e.length;s++){var u=e[s].dataCount,l=e[s].totalCount-u;o=Math.max(o,u),n=Math.max(n,l),i[s]=new Array(u);for(var h=0;h<i[s].length;h++)i[s][h]=255&t.buffer[h+r];r+=u;var f=QRUtil.getErrorCorrectPolynomial(l),g=new QRPolynomial(i[s],f.getLength()-1).mod(f);a[s]=new Array(f.getLength()-1);for(h=0;h<a[s].length;h++){var c=h+g.getLength()-a[s].length;a[s][h]=c>=0?g.get(c):0}}var d=0;for(h=0;h<e.length;h++)d+=e[h].totalCount;var R=new Array(d),m=0;for(h=0;h<o;h++)for(s=0;s<e.length;s++)h<i[s].length&&(R[m++]=i[s][h]);for(h=0;h<n;h++)for(s=0;s<e.length;s++)h<a[s].length&&(R[m++]=a[s][h]);return R};for(var QRMode={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},QRErrorCorrectLevel={L:1,M:0,Q:3,H:2},QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},QRUtil={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(t){for(var e=t<<10;QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G15)>=0;)e^=QRUtil.G15<<QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G15);return(t<<10|e)^QRUtil.G15_MASK},getBCHTypeNumber:function(t){for(var e=t<<12;QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G18)>=0;)e^=QRUtil.G18<<QRUtil.getBCHDigit(e)-QRUtil.getBCHDigit(QRUtil.G18);return t<<12|e},getBCHDigit:function(t){for(var e=0;0!=t;)e++,t>>>=1;return e},getPatternPosition:function(t){return QRUtil.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case QRMaskPattern.PATTERN000:return(e+r)%2==0;case QRMaskPattern.PATTERN001:return e%2==0;case QRMaskPattern.PATTERN010:return r%3==0;case QRMaskPattern.PATTERN011:return(e+r)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case QRMaskPattern.PATTERN101:return e*r%2+e*r%3==0;case QRMaskPattern.PATTERN110:return(e*r%2+e*r%3)%2==0;case QRMaskPattern.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new QRPolynomial([1],0),r=0;r<t;r++)e=e.multiply(new QRPolynomial([1,QRMath.gexp(r)],0));return e},getLengthInBits:function(t,e){if(1<=e&&e<10)switch(t){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+t)}else if(e<27)switch(t){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+t)}else{if(!(e<41))throw new Error("type:"+e);switch(t){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+t)}}},getLostPoint:function(t){for(var e=t.getModuleCount(),r=0,o=0;o<e;o++)for(var n=0;n<e;n++){for(var i=0,a=t.isDark(o,n),s=-1;s<=1;s++)if(!(o+s<0||e<=o+s))for(var u=-1;u<=1;u++)n+u<0||e<=n+u||0==s&&0==u||a==t.isDark(o+s,n+u)&&i++;i>5&&(r+=3+i-5)}for(o=0;o<e-1;o++)for(n=0;n<e-1;n++){var l=0;t.isDark(o,n)&&l++,t.isDark(o+1,n)&&l++,t.isDark(o,n+1)&&l++,t.isDark(o+1,n+1)&&l++,0!=l&&4!=l||(r+=3)}for(o=0;o<e;o++)for(n=0;n<e-6;n++)t.isDark(o,n)&&!t.isDark(o,n+1)&&t.isDark(o,n+2)&&t.isDark(o,n+3)&&t.isDark(o,n+4)&&!t.isDark(o,n+5)&&t.isDark(o,n+6)&&(r+=40);for(n=0;n<e;n++)for(o=0;o<e-6;o++)t.isDark(o,n)&&!t.isDark(o+1,n)&&t.isDark(o+2,n)&&t.isDark(o+3,n)&&t.isDark(o+4,n)&&!t.isDark(o+5,n)&&t.isDark(o+6,n)&&(r+=40);var h=0;for(n=0;n<e;n++)for(o=0;o<e;o++)t.isDark(o,n)&&h++;return r+=10*(Math.abs(100*h/e/e-50)/5)}},QRMath={glog:function(t){if(t<1)throw new Error("glog("+t+")");return QRMath.LOG_TABLE[t]},gexp:function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return QRMath.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},i=0;i<8;i++)QRMath.EXP_TABLE[i]=1<<i;for(i=8;i<256;i++)QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];for(i=0;i<255;i++)QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;function QRPolynomial(t,e){if(void 0==t.length)throw new Error(t.length+"/"+e);for(var r=0;r<t.length&&0==t[r];)r++;this.num=new Array(t.length-r+e);for(var o=0;o<t.length-r;o++)this.num[o]=t[o+r]}function QRRSBlock(t,e){this.totalCount=t,this.dataCount=e}function QRBitBuffer(){this.buffer=new Array,this.length=0}function utf16to8(t){var e,r,o,n;for(e="",o=t.length,r=0;r<o;r++)(n=t.charCodeAt(r))>=1&&n<=127?e+=t.charAt(r):n>2047?(e+=String.fromCharCode(224|n>>12&15),e+=String.fromCharCode(128|n>>6&63),e+=String.fromCharCode(128|n>>0&63)):(e+=String.fromCharCode(192|n>>6&31),e+=String.fromCharCode(128|n>>0&63));return e}function drawQrcode(t){t=t||{},(t=extend(!0,{width:256,height:256,x:0,y:0,typeNumber:-1,correctLevel:QRErrorCorrectLevel.H,background:"#ffffff",foreground:"#000000",image:{imageResource:"",dx:0,dy:0,dWidth:100,dHeight:100}},t)).canvasId||t.ctx?function(){var e,r=new QRCode(t.typeNumber,t.correctLevel);r.addData(utf16to8(t.text)),r.make(),e=t.ctx?t.ctx:t._this?wx.createCanvasContext&&wx.createCanvasContext(t.canvasId,t._this):wx.createCanvasContext&&wx.createCanvasContext(t.canvasId);for(var o=t.width/r.getModuleCount(),n=t.height/r.getModuleCount(),i=0;i<r.getModuleCount();i++)for(var a=0;a<r.getModuleCount();a++){var s=r.isDark(i,a)?t.foreground:t.background;e.setFillStyle(s);var u=Math.ceil((a+1)*o)-Math.floor(a*o),l=Math.ceil((i+1)*o)-Math.floor(i*o);e.fillRect(Math.round(a*o)+t.x,Math.round(i*n)+t.y,u,l)}t.image.imageResource&&e.drawImage(t.image.imageResource,t.image.dx,t.image.dy,t.image.dWidth,t.image.dHeight);e.draw(!1,function(e){t.callback&&t.callback(e)})}():console.warn("please set canvasId or ctx!")}QRPolynomial.prototype={get:function(t){return this.num[t]},getLength:function(){return this.num.length},multiply:function(t){for(var e=new Array(this.getLength()+t.getLength()-1),r=0;r<this.getLength();r++)for(var o=0;o<t.getLength();o++)e[r+o]^=QRMath.gexp(QRMath.glog(this.get(r))+QRMath.glog(t.get(o)));return new QRPolynomial(e,0)},mod:function(t){if(this.getLength()-t.getLength()<0)return this;for(var e=QRMath.glog(this.get(0))-QRMath.glog(t.get(0)),r=new Array(this.getLength()),o=0;o<this.getLength();o++)r[o]=this.get(o);for(o=0;o<t.getLength();o++)r[o]^=QRMath.gexp(QRMath.glog(t.get(o))+e);return new QRPolynomial(r,0).mod(t)}},QRRSBlock.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],QRRSBlock.getRSBlocks=function(t,e){var r=QRRSBlock.getRsBlockTable(t,e);if(void 0==r)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);for(var o=r.length/3,n=new Array,i=0;i<o;i++)for(var a=r[3*i+0],s=r[3*i+1],u=r[3*i+2],l=0;l<a;l++)n.push(new QRRSBlock(s,u));return n},QRRSBlock.getRsBlockTable=function(t,e){switch(e){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[4*(t-1)+3];default:return}},QRBitBuffer.prototype={get:function(t){var e=Math.floor(t/8);return 1==(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r<e;r++)this.putBit(1==(t>>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};export default drawQrcode; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="content"></view> |
| | | </template> |
| | | |
| | | <script> |
| | | var main, receiver, filter; |
| | | var _codeQueryTag = false; |
| | | export default { |
| | | data() { |
| | | return { |
| | | scanCode: '' |
| | | } |
| | | }, |
| | | created: function(option) { |
| | | this.initScan() |
| | | this.startScan(); |
| | | }, |
| | | onHide: function() { |
| | | this.stopScan(); |
| | | }, |
| | | destroyed: function() { |
| | | this.stopScan(); |
| | | }, |
| | | methods: { |
| | | initScan() { |
| | | let _this = this; |
| | | main = plus.android.runtimeMainActivity(); |
| | | var IntentFilter = plus.android.importClass('android.content.IntentFilter'); |
| | | filter = new IntentFilter(); |
| | | //ä¸é¢çaddActionå
æ¹ä¸ºèªå·±ç广æå¨ä½ |
| | | filter.addAction("com.android.serial.BARCODEPORT_RECEIVEDDATA_ACTION"); |
| | | receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', { |
| | | onReceive: function(context, intent) { |
| | | plus.android.importClass(intent); |
| | | //ä¸é¢çgetStringExtraå
æ¹ä¸ºèªå·±çå¹¿ææ ç¾ |
| | | let code = intent.getStringExtra("DATA"); |
| | | _this.queryCode(code); |
| | | } |
| | | }); |
| | | }, |
| | | startScan() { |
| | | main.registerReceiver(receiver, filter); |
| | | }, |
| | | stopScan() { |
| | | main.unregisterReceiver(receiver); |
| | | }, |
| | | queryCode: function(code) { |
| | | if (_codeQueryTag) return false; |
| | | _codeQueryTag = true; |
| | | setTimeout(function() { |
| | | _codeQueryTag = false; |
| | | }, 150); |
| | | var id = code |
| | | console.log('id:', id) |
| | | uni.$emit('scan', { |
| | | code: id |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { button } from '../mixins/button'; |
| | | import { openType } from '../mixins/open-type'; |
| | | VantComponent({ |
| | | mixins: [button, openType], |
| | | props: { |
| | | show: Boolean, |
| | | title: String, |
| | | cancelText: String, |
| | | description: String, |
| | | round: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 100, |
| | | }, |
| | | actions: { |
| | | type: Array, |
| | | value: [], |
| | | }, |
| | | overlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | closeOnClickOverlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | closeOnClickAction: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | methods: { |
| | | onSelect(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const item = this.data.actions[index]; |
| | | if (item && !item.disabled && !item.loading) { |
| | | this.$emit('select', item); |
| | | if (this.data.closeOnClickAction) { |
| | | this.onClose(); |
| | | } |
| | | } |
| | | }, |
| | | onCancel() { |
| | | this.$emit('cancel'); |
| | | }, |
| | | onClose() { |
| | | this.$emit('close'); |
| | | }, |
| | | onClickOverlay() { |
| | | this.$emit('click-overlay'); |
| | | this.onClose(); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-popup": "../popup/index", |
| | | "van-loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <van-popup |
| | | show="{{ show }}" |
| | | position="bottom" |
| | | round="{{ round }}" |
| | | z-index="{{ zIndex }}" |
| | | overlay="{{ overlay }}" |
| | | custom-class="van-action-sheet" |
| | | safe-area-inset-bottom="{{ safeAreaInsetBottom }}" |
| | | close-on-click-overlay="{{ closeOnClickOverlay }}" |
| | | bind:close="onClickOverlay" |
| | | > |
| | | <view wx:if="{{ title }}" class="van-action-sheet__header"> |
| | | {{ title }} |
| | | <van-icon |
| | | name="cross" |
| | | custom-class="van-action-sheet__close" |
| | | bind:click="onClose" |
| | | /> |
| | | </view> |
| | | <view wx:if="{{ description }}" class="van-action-sheet__description van-hairline--bottom"> |
| | | {{ description }} |
| | | </view> |
| | | <view wx:if="{{ actions && actions.length }}"> |
| | | <!-- buttonå¤å
ä¸å±viewï¼é²æ¢actions卿ååï¼å¯¼è´æ¸²ææ¶buttonè¢«ææ£ --> |
| | | <button |
| | | wx:for="{{ actions }}" |
| | | wx:key="index" |
| | | open-type="{{ item.openType }}" |
| | | style="{{ item.color ? 'color: ' + item.color : '' }}" |
| | | class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} {{ item.className || '' }}" |
| | | hover-class="van-action-sheet__item--hover" |
| | | data-index="{{ index }}" |
| | | bind:tap="onSelect" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindcontact="bindContact" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | binderror="bindError" |
| | | bindlaunchapp="bindLaunchApp" |
| | | bindopensetting="bindOpenSetting" |
| | | lang="{{ lang }}" |
| | | session-from="{{ sessionFrom }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | app-parameter="{{ appParameter }}" |
| | | > |
| | | <block wx:if="{{ !item.loading }}"> |
| | | {{ item.name }} |
| | | <view wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</view> |
| | | </block> |
| | | <van-loading wx:else custom-class="van-action-sheet__loading" size="22px" /> |
| | | </button> |
| | | </view> |
| | | <slot /> |
| | | <block wx:if="{{ cancelText }}"> |
| | | <view class="van-action-sheet__gap" /> |
| | | <view |
| | | class="van-action-sheet__cancel" |
| | | hover-class="van-action-sheet__cancel--hover" |
| | | hover-stay-time="70" |
| | | bind:tap="onCancel" |
| | | > |
| | | {{ cancelText }} |
| | | </view> |
| | | </block> |
| | | </van-popup> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{padding:14px 16px;text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:22px;line-height:var(--action-sheet-item-line-height,22px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:after,.van-action-sheet__item:after{border-width:0}.van-action-sheet__cancel{color:#646566;color:var(--action-sheet-cancel-text-color,#646566)}.van-action-sheet__gap{display:block;height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-top:8px;margin-top:var(--padding-xs,8px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#969799;color:var(--action-sheet-subname-color,#969799);line-height:20px;line-height:var(--action-sheet-subname-line-height,20px)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:48px;line-height:var(--action-sheet-header-height,48px)}.van-action-sheet__description{text-align:center;padding:20px 16px;padding:20px var(--padding-md,16px);color:#969799;color:var(--action-sheet-description-color,#969799);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 16px;padding:var(--action-sheet-close-icon-padding,0 16px);font-size:22px!important;font-size:var(--action-sheet-close-icon-size,22px)!important;color:#c8c9cc;color:var(--action-sheet-close-icon-color,#c8c9cc)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { pickerProps } from '../picker/shared'; |
| | | import { requestAnimationFrame } from '../common/utils'; |
| | | const EMPTY_CODE = '000000'; |
| | | VantComponent({ |
| | | classes: ['active-class', 'toolbar-class', 'column-class'], |
| | | props: Object.assign(Object.assign({}, pickerProps), { |
| | | value: { |
| | | type: String, |
| | | observer(value) { |
| | | this.code = value; |
| | | this.setValues(); |
| | | }, |
| | | }, |
| | | areaList: { |
| | | type: Object, |
| | | value: {}, |
| | | observer: 'setValues', |
| | | }, |
| | | columnsNum: { |
| | | type: null, |
| | | value: 3, |
| | | }, |
| | | columnsPlaceholder: { |
| | | type: Array, |
| | | observer(val) { |
| | | this.setData({ |
| | | typeToColumnsPlaceholder: { |
| | | province: val[0] || '', |
| | | city: val[1] || '', |
| | | county: val[2] || '', |
| | | }, |
| | | }); |
| | | }, |
| | | }, |
| | | }), |
| | | data: { |
| | | columns: [{ values: [] }, { values: [] }, { values: [] }], |
| | | typeToColumnsPlaceholder: {}, |
| | | }, |
| | | mounted() { |
| | | requestAnimationFrame(() => { |
| | | this.setValues(); |
| | | }); |
| | | }, |
| | | methods: { |
| | | getPicker() { |
| | | if (this.picker == null) { |
| | | this.picker = this.selectComponent('.van-area__picker'); |
| | | } |
| | | return this.picker; |
| | | }, |
| | | onCancel(event) { |
| | | this.emit('cancel', event.detail); |
| | | }, |
| | | onConfirm(event) { |
| | | const { index } = event.detail; |
| | | let { value } = event.detail; |
| | | value = this.parseValues(value); |
| | | this.emit('confirm', { value, index }); |
| | | }, |
| | | emit(type, detail) { |
| | | detail.values = detail.value; |
| | | delete detail.value; |
| | | this.$emit(type, detail); |
| | | }, |
| | | parseValues(values) { |
| | | const { columnsPlaceholder } = this.data; |
| | | return values.map((value, index) => { |
| | | if ( |
| | | value && |
| | | (!value.code || value.name === columnsPlaceholder[index]) |
| | | ) { |
| | | return Object.assign(Object.assign({}, value), { |
| | | code: '', |
| | | name: '', |
| | | }); |
| | | } |
| | | return value; |
| | | }); |
| | | }, |
| | | onChange(event) { |
| | | const { index, picker, value } = event.detail; |
| | | this.code = value[index].code; |
| | | this.setValues().then(() => { |
| | | this.$emit('change', { |
| | | picker, |
| | | values: this.parseValues(picker.getValues()), |
| | | index, |
| | | }); |
| | | }); |
| | | }, |
| | | getConfig(type) { |
| | | const { areaList } = this.data; |
| | | return (areaList && areaList[`${type}_list`]) || {}; |
| | | }, |
| | | getList(type, code) { |
| | | if (type !== 'province' && !code) { |
| | | return []; |
| | | } |
| | | const { typeToColumnsPlaceholder } = this.data; |
| | | const list = this.getConfig(type); |
| | | let result = Object.keys(list).map((code) => ({ |
| | | code, |
| | | name: list[code], |
| | | })); |
| | | if (code != null) { |
| | | // oversea code |
| | | if (code[0] === '9' && type === 'city') { |
| | | code = '9'; |
| | | } |
| | | result = result.filter((item) => item.code.indexOf(code) === 0); |
| | | } |
| | | if (typeToColumnsPlaceholder[type] && result.length) { |
| | | // set columns placeholder |
| | | const codeFill = |
| | | type === 'province' |
| | | ? '' |
| | | : type === 'city' |
| | | ? EMPTY_CODE.slice(2, 4) |
| | | : EMPTY_CODE.slice(4, 6); |
| | | result.unshift({ |
| | | code: `${code}${codeFill}`, |
| | | name: typeToColumnsPlaceholder[type], |
| | | }); |
| | | } |
| | | return result; |
| | | }, |
| | | getIndex(type, code) { |
| | | let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; |
| | | const list = this.getList(type, code.slice(0, compareNum - 2)); |
| | | // oversea code |
| | | if (code[0] === '9' && type === 'province') { |
| | | compareNum = 1; |
| | | } |
| | | code = code.slice(0, compareNum); |
| | | for (let i = 0; i < list.length; i++) { |
| | | if (list[i].code.slice(0, compareNum) === code) { |
| | | return i; |
| | | } |
| | | } |
| | | return 0; |
| | | }, |
| | | setValues() { |
| | | const picker = this.getPicker(); |
| | | if (!picker) { |
| | | return; |
| | | } |
| | | let code = this.code || this.getDefaultCode(); |
| | | const provinceList = this.getList('province'); |
| | | const cityList = this.getList('city', code.slice(0, 2)); |
| | | const stack = []; |
| | | const indexes = []; |
| | | const { columnsNum } = this.data; |
| | | if (columnsNum >= 1) { |
| | | stack.push(picker.setColumnValues(0, provinceList, false)); |
| | | indexes.push(this.getIndex('province', code)); |
| | | } |
| | | if (columnsNum >= 2) { |
| | | stack.push(picker.setColumnValues(1, cityList, false)); |
| | | indexes.push(this.getIndex('city', code)); |
| | | if (cityList.length && code.slice(2, 4) === '00') { |
| | | [{ code }] = cityList; |
| | | } |
| | | } |
| | | if (columnsNum === 3) { |
| | | stack.push( |
| | | picker.setColumnValues( |
| | | 2, |
| | | this.getList('county', code.slice(0, 4)), |
| | | false |
| | | ) |
| | | ); |
| | | indexes.push(this.getIndex('county', code)); |
| | | } |
| | | return Promise.all(stack) |
| | | .catch(() => {}) |
| | | .then(() => picker.setIndexes(indexes)) |
| | | .catch(() => {}); |
| | | }, |
| | | getDefaultCode() { |
| | | const { columnsPlaceholder } = this.data; |
| | | if (columnsPlaceholder.length) { |
| | | return EMPTY_CODE; |
| | | } |
| | | const countyCodes = Object.keys(this.getConfig('county')); |
| | | if (countyCodes[0]) { |
| | | return countyCodes[0]; |
| | | } |
| | | const cityCodes = Object.keys(this.getConfig('city')); |
| | | if (cityCodes[0]) { |
| | | return cityCodes[0]; |
| | | } |
| | | return ''; |
| | | }, |
| | | getValues() { |
| | | const picker = this.getPicker(); |
| | | if (!picker) { |
| | | return []; |
| | | } |
| | | return this.parseValues(picker.getValues().filter((value) => !!value)); |
| | | }, |
| | | getDetail() { |
| | | const values = this.getValues(); |
| | | const area = { |
| | | code: '', |
| | | country: '', |
| | | province: '', |
| | | city: '', |
| | | county: '', |
| | | }; |
| | | if (!values.length) { |
| | | return area; |
| | | } |
| | | const names = values.map((item) => item.name); |
| | | area.code = values[values.length - 1].code; |
| | | if (area.code[0] === '9') { |
| | | area.country = names[1] || ''; |
| | | area.province = names[2] || ''; |
| | | } else { |
| | | area.province = names[0] || ''; |
| | | area.city = names[1] || ''; |
| | | area.county = names[2] || ''; |
| | | } |
| | | return area; |
| | | }, |
| | | reset(code) { |
| | | this.code = code || ''; |
| | | return this.setValues(); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-picker": "../picker/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <van-picker |
| | | class="van-area__picker" |
| | | active-class="active-class" |
| | | toolbar-class="toolbar-class" |
| | | column-class="column-class" |
| | | show-toolbar |
| | | value-key="name" |
| | | title="{{ title }}" |
| | | loading="{{ loading }}" |
| | | columns="{{ computed.displayColumns(columns, columnsNum) }}" |
| | | item-height="{{ itemHeight }}" |
| | | visible-item-count="{{ visibleItemCount }}" |
| | | cancel-button-text="{{ cancelButtonText }}" |
| | | confirm-button-text="{{ confirmButtonText }}" |
| | | bind:change="onChange" |
| | | bind:confirm="onConfirm" |
| | | bind:cancel="onCancel" |
| | | /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | function displayColumns(columns, columnsNum) { |
| | | return columns.slice(0, +columnsNum); |
| | | } |
| | | |
| | | module.exports = { |
| | | displayColumns: displayColumns, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { button } from '../mixins/button'; |
| | | import { openType } from '../mixins/open-type'; |
| | | import { canIUseFormFieldButton } from '../common/version'; |
| | | const mixins = [button, openType]; |
| | | if (canIUseFormFieldButton()) { |
| | | mixins.push('wx://form-field-button'); |
| | | } |
| | | VantComponent({ |
| | | mixins, |
| | | classes: ['hover-class', 'loading-class'], |
| | | data: { |
| | | baseStyle: '', |
| | | }, |
| | | props: { |
| | | formType: String, |
| | | icon: String, |
| | | classPrefix: { |
| | | type: String, |
| | | value: 'van-icon', |
| | | }, |
| | | plain: Boolean, |
| | | block: Boolean, |
| | | round: Boolean, |
| | | square: Boolean, |
| | | loading: Boolean, |
| | | hairline: Boolean, |
| | | disabled: Boolean, |
| | | loadingText: String, |
| | | customStyle: String, |
| | | loadingType: { |
| | | type: String, |
| | | value: 'circular', |
| | | }, |
| | | type: { |
| | | type: String, |
| | | value: 'default', |
| | | }, |
| | | dataset: null, |
| | | size: { |
| | | type: String, |
| | | value: 'normal', |
| | | }, |
| | | loadingSize: { |
| | | type: String, |
| | | value: '20px', |
| | | }, |
| | | color: String, |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | if (!this.data.loading) { |
| | | this.$emit('click'); |
| | | } |
| | | }, |
| | | noop() {}, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <button |
| | | id="{{ id }}" |
| | | data-detail="{{ dataset }}" |
| | | class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}" |
| | | hover-class="van-button--active hover-class" |
| | | lang="{{ lang }}" |
| | | form-type="{{ formType }}" |
| | | style="{{ computed.rootStyle({ plain, color, customStyle }) }}" |
| | | open-type="{{ disabled ? '' : openType }}" |
| | | business-id="{{ businessId }}" |
| | | session-from="{{ sessionFrom }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | app-parameter="{{ appParameter }}" |
| | | aria-label="{{ ariaLabel }}" |
| | | bindtap="{{ !disabled ? 'onClick' : 'noop' }}" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindcontact="bindContact" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | binderror="bindError" |
| | | bindlaunchapp="bindLaunchApp" |
| | | bindopensetting="bindOpenSetting" |
| | | > |
| | | <block wx:if="{{ loading }}"> |
| | | <van-loading |
| | | custom-class="loading-class" |
| | | size="{{ loadingSize }}" |
| | | type="{{ loadingType }}" |
| | | color="{{ computed.loadingColor({ type, color, plain }) }}" |
| | | /> |
| | | <view wx:if="{{ loadingText }}" class="van-button__loading-text"> |
| | | {{ loadingText }} |
| | | </view> |
| | | </block> |
| | | <block wx:else> |
| | | <van-icon |
| | | wx:if="{{ icon }}" |
| | | size="1.2em" |
| | | name="{{ icon }}" |
| | | class-prefix="{{ classPrefix }}" |
| | | class="van-button__icon" |
| | | custom-style="line-height: inherit;" |
| | | /> |
| | | <view class="van-button__text"> |
| | | <slot /> |
| | | </view> |
| | | </block> |
| | | </button> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | if (!data.color) { |
| | | return data.customStyle; |
| | | } |
| | | |
| | | var properties = { |
| | | color: data.plain ? data.color : '#fff', |
| | | background: data.plain ? null : data.color, |
| | | }; |
| | | |
| | | // hide border when color is linear-gradient |
| | | if (data.color.indexOf('gradient') !== -1) { |
| | | properties.border = 0; |
| | | } else { |
| | | properties['border-color'] = data.color; |
| | | } |
| | | |
| | | return style([properties, data.customStyle]); |
| | | } |
| | | |
| | | function loadingColor(data) { |
| | | if (data.plain) { |
| | | return data.color ? data.color : '#c9c9c9'; |
| | | } |
| | | |
| | | if (data.type === 'default') { |
| | | return '#c9c9c9'; |
| | | } |
| | | |
| | | return '#fff'; |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | loadingColor: loadingColor, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-calendar"> |
| | | <header |
| | | title="{{ title }}" |
| | | showTitle="{{ showTitle }}" |
| | | subtitle="{{ subtitle }}" |
| | | showSubtitle="{{ showSubtitle }}" |
| | | > |
| | | <slot name="title" slot="title"></slot> |
| | | </header> |
| | | |
| | | <scroll-view |
| | | class="van-calendar__body" |
| | | scroll-y |
| | | scroll-into-view="{{ scrollIntoView }}" |
| | | > |
| | | <month |
| | | wx:for="{{ computed.getMonths(minDate, maxDate) }}" |
| | | wx:key="index" |
| | | id="month{{ index }}" |
| | | class="month" |
| | | data-date="{{ item }}" |
| | | date="{{ item }}" |
| | | type="{{ type }}" |
| | | color="{{ color }}" |
| | | minDate="{{ minDate }}" |
| | | maxDate="{{ maxDate }}" |
| | | showMark="{{ showMark }}" |
| | | formatter="{{ formatter }}" |
| | | rowHeight="{{ rowHeight }}" |
| | | currentDate="{{ currentDate }}" |
| | | showSubtitle="{{ showSubtitle }}" |
| | | allowSameDay="{{ allowSameDay }}" |
| | | showMonthTitle="{{ index !== 0 || !showSubtitle }}" |
| | | bind:click="onClickDay" |
| | | /> |
| | | </scroll-view> |
| | | |
| | | <view |
| | | class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" |
| | | > |
| | | <slot name="footer"></slot> |
| | | </view> |
| | | |
| | | <view |
| | | class="{{ utils.bem('calendar__footer', { safeAreaInsetBottom }) }}" |
| | | > |
| | | <van-button |
| | | wx:if="{{ showConfirm }}" |
| | | round |
| | | block |
| | | type="danger" |
| | | color="{{ color }}" |
| | | custom-class="van-calendar__confirm" |
| | | disabled="{{ computed.getButtonDisabled(type, currentDate) }}" |
| | | nativeType="text" |
| | | bind:click="onConfirm" |
| | | > |
| | | {{ |
| | | computed.getButtonDisabled(type, currentDate) |
| | | ? confirmDisabledText |
| | | : confirmText |
| | | }} |
| | | </van-button> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../../../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | title: { |
| | | type: String, |
| | | value: 'æ¥æéæ©', |
| | | }, |
| | | subtitle: String, |
| | | showTitle: Boolean, |
| | | showSubtitle: Boolean, |
| | | }, |
| | | data: { |
| | | weekdays: ['æ¥', 'ä¸', 'äº', 'ä¸', 'å', 'äº', 'å
'], |
| | | }, |
| | | methods: {}, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-calendar__header"> |
| | | <block wx:if="{{ showTitle }}"> |
| | | <view class="van-calendar__header-title"><slot name="title"></slot></view> |
| | | <view class="van-calendar__header-title">{{ title }}</view> |
| | | </block> |
| | | |
| | | <view wx:if="{{ showSubtitle }}" class="van-calendar__header-subtitle"> |
| | | {{ subtitle }} |
| | | </view> |
| | | |
| | | <view class="van-calendar__weekdays"> |
| | | <view wx:for="{{ weekdays }}" wx:key="index" class="van-calendar__weekday"> |
| | | {{ item }} |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../../../common/index.wxss';.van-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 2px 10px rgba(125,126,128,.16);box-shadow:var(--calendar-header-box-shadow,0 2px 10px rgba(125,126,128,.16))}.van-calendar__header-subtitle,.van-calendar__header-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:-webkit-flex;display:flex}.van-calendar__weekday{-webkit-flex:1;flex:1;text-align:center;font-size:12px;font-size:var(--calendar-weekdays-font-size,12px);line-height:30px;line-height:var(--calendar-weekdays-height,30px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../../../common/component'; |
| | | import { |
| | | getMonthEndDay, |
| | | compareDay, |
| | | getPrevDay, |
| | | getNextDay, |
| | | } from '../../utils'; |
| | | VantComponent({ |
| | | props: { |
| | | date: { |
| | | type: null, |
| | | observer: 'setDays', |
| | | }, |
| | | type: { |
| | | type: String, |
| | | observer: 'setDays', |
| | | }, |
| | | color: String, |
| | | minDate: { |
| | | type: null, |
| | | observer: 'setDays', |
| | | }, |
| | | maxDate: { |
| | | type: null, |
| | | observer: 'setDays', |
| | | }, |
| | | showMark: Boolean, |
| | | rowHeight: null, |
| | | formatter: { |
| | | type: null, |
| | | observer: 'setDays', |
| | | }, |
| | | currentDate: { |
| | | type: null, |
| | | observer: 'setDays', |
| | | }, |
| | | allowSameDay: Boolean, |
| | | showSubtitle: Boolean, |
| | | showMonthTitle: Boolean, |
| | | }, |
| | | data: { |
| | | visible: true, |
| | | days: [], |
| | | }, |
| | | methods: { |
| | | onClick(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const item = this.data.days[index]; |
| | | if (item.type !== 'disabled') { |
| | | this.$emit('click', item); |
| | | } |
| | | }, |
| | | setDays() { |
| | | const days = []; |
| | | const startDate = new Date(this.data.date); |
| | | const year = startDate.getFullYear(); |
| | | const month = startDate.getMonth(); |
| | | const totalDay = getMonthEndDay( |
| | | startDate.getFullYear(), |
| | | startDate.getMonth() + 1 |
| | | ); |
| | | for (let day = 1; day <= totalDay; day++) { |
| | | const date = new Date(year, month, day); |
| | | const type = this.getDayType(date); |
| | | let config = { |
| | | date, |
| | | type, |
| | | text: day, |
| | | bottomInfo: this.getBottomInfo(type), |
| | | }; |
| | | if (this.data.formatter) { |
| | | config = this.data.formatter(config); |
| | | } |
| | | days.push(config); |
| | | } |
| | | this.setData({ days }); |
| | | }, |
| | | getMultipleDayType(day) { |
| | | const { currentDate } = this.data; |
| | | if (!Array.isArray(currentDate)) { |
| | | return ''; |
| | | } |
| | | const isSelected = (date) => |
| | | currentDate.some((item) => compareDay(item, date) === 0); |
| | | if (isSelected(day)) { |
| | | const prevDay = getPrevDay(day); |
| | | const nextDay = getNextDay(day); |
| | | const prevSelected = isSelected(prevDay); |
| | | const nextSelected = isSelected(nextDay); |
| | | if (prevSelected && nextSelected) { |
| | | return 'multiple-middle'; |
| | | } |
| | | if (prevSelected) { |
| | | return 'end'; |
| | | } |
| | | return nextSelected ? 'start' : 'multiple-selected'; |
| | | } |
| | | return ''; |
| | | }, |
| | | getRangeDayType(day) { |
| | | const { currentDate, allowSameDay } = this.data; |
| | | if (!Array.isArray(currentDate)) { |
| | | return; |
| | | } |
| | | const [startDay, endDay] = currentDate; |
| | | if (!startDay) { |
| | | return; |
| | | } |
| | | const compareToStart = compareDay(day, startDay); |
| | | if (!endDay) { |
| | | return compareToStart === 0 ? 'start' : ''; |
| | | } |
| | | const compareToEnd = compareDay(day, endDay); |
| | | if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { |
| | | return 'start-end'; |
| | | } |
| | | if (compareToStart === 0) { |
| | | return 'start'; |
| | | } |
| | | if (compareToEnd === 0) { |
| | | return 'end'; |
| | | } |
| | | if (compareToStart > 0 && compareToEnd < 0) { |
| | | return 'middle'; |
| | | } |
| | | }, |
| | | getDayType(day) { |
| | | const { type, minDate, maxDate, currentDate } = this.data; |
| | | if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) { |
| | | return 'disabled'; |
| | | } |
| | | if (type === 'single') { |
| | | return compareDay(day, currentDate) === 0 ? 'selected' : ''; |
| | | } |
| | | if (type === 'multiple') { |
| | | return this.getMultipleDayType(day); |
| | | } |
| | | /* istanbul ignore else */ |
| | | if (type === 'range') { |
| | | return this.getRangeDayType(day); |
| | | } |
| | | }, |
| | | getBottomInfo(type) { |
| | | if (this.data.type === 'range') { |
| | | if (type === 'start') { |
| | | return 'å¼å§'; |
| | | } |
| | | if (type === 'end') { |
| | | return 'ç»æ'; |
| | | } |
| | | if (type === 'start-end') { |
| | | return 'å¼å§/ç»æ'; |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed"></wxs> |
| | | <wxs src="../../../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="van-calendar__month" style="{{ computed.getMonthStyle(visible, date, rowHeight) }}"> |
| | | <view wx:if="{{ showMonthTitle }}" class="van-calendar__month-title"> |
| | | {{ computed.formatMonthTitle(date) }} |
| | | </view> |
| | | |
| | | <view wx:if="{{ visible }}" class="van-calendar__days"> |
| | | <view wx:if="{{ showMark }}" class="van-calendar__month-mark"> |
| | | {{ computed.getMark(date) }} |
| | | </view> |
| | | |
| | | <view |
| | | wx:for="{{ days }}" |
| | | wx:key="index" |
| | | style="{{ computed.getDayStyle(item.type, index, date, rowHeight, color) }}" |
| | | class="{{ utils.bem('calendar__day', [item.type]) }} {{ item.className }}" |
| | | data-index="{{ index }}" |
| | | bindtap="onClick" |
| | | > |
| | | <view wx:if="{{ item.type === 'selected' }}" class="van-calendar__selected-day" style="background: {{ color }}"> |
| | | <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> |
| | | {{ item.text }} |
| | | <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> |
| | | {{ item.bottomInfo }} |
| | | </view> |
| | | </view> |
| | | |
| | | <view wx:else> |
| | | <view wx:if="{{ item.topInfo }}" class="van-calendar__top-info">{{ item.topInfo }}</view> |
| | | {{ item.text }} |
| | | <view wx:if="{{ item.bottomInfo }}" class="van-calendar__bottom-info"> |
| | | {{ item.bottomInfo }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var utils = require('../../utils.wxs'); |
| | | |
| | | function getMark(date) { |
| | | return getDate(date).getMonth() + 1; |
| | | } |
| | | |
| | | var ROW_HEIGHT = 64; |
| | | |
| | | function getDayStyle(type, index, date, rowHeight, color) { |
| | | var style = []; |
| | | var offset = getDate(date).getDay(); |
| | | |
| | | if (index === 0) { |
| | | style.push(['margin-left', (100 * offset) / 7 + '%']); |
| | | } |
| | | |
| | | if (rowHeight !== ROW_HEIGHT) { |
| | | style.push(['height', rowHeight + 'px']); |
| | | } |
| | | |
| | | if (color) { |
| | | if ( |
| | | type === 'start' || |
| | | type === 'end' || |
| | | type === 'multiple-selected' || |
| | | type === 'multiple-middle' |
| | | ) { |
| | | style.push(['background', color]); |
| | | } else if (type === 'middle') { |
| | | style.push(['color', color]); |
| | | } |
| | | } |
| | | |
| | | return style |
| | | .map(function(item) { |
| | | return item.join(':'); |
| | | }) |
| | | .join(';'); |
| | | } |
| | | |
| | | function formatMonthTitle(date) { |
| | | date = getDate(date); |
| | | return date.getFullYear() + 'å¹´' + (date.getMonth() + 1) + 'æ'; |
| | | } |
| | | |
| | | function getMonthStyle(visible, date, rowHeight) { |
| | | if (!visible) { |
| | | date = getDate(date); |
| | | |
| | | var totalDay = utils.getMonthEndDay( |
| | | date.getFullYear(), |
| | | date.getMonth() + 1 |
| | | ); |
| | | var offset = getDate(date).getDay(); |
| | | var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; |
| | | |
| | | return 'padding-bottom:' + padding + 'px'; |
| | | } |
| | | } |
| | | |
| | | module.exports = { |
| | | getMark: getMark, |
| | | getDayStyle: getDayStyle, |
| | | formatMonthTitle: formatMonthTitle, |
| | | getMonthStyle: getMonthStyle |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../../../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__month-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:14px;font-size:var(--calendar-month-title-font-size,14px);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__days{position:relative;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;color:rgba(242,243,245,.8);color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:160px;font-size:var(--calendar-month-mark-font-size,160px)}.van-calendar__day,.van-calendar__selected-day{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:64px;height:var(--calendar-day-height,64px);font-size:16px;font-size:var(--calendar-day-font-size,16px)}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{color:#fff;color:var(--calendar-range-edge-color,#fff);background-color:#ee0a24;background-color:var(--calendar-range-edge-background-color,#ee0a24)}.van-calendar__day--start{border-radius:4px 0 0 4px;border-radius:var(--border-radius-md,4px) 0 0 var(--border-radius-md,4px)}.van-calendar__day--end{border-radius:0 4px 4px 0;border-radius:0 var(--border-radius-md,4px) var(--border-radius-md,4px) 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px;border-radius:var(--border-radius-md,4px)}.van-calendar__day--middle{color:#ee0a24;color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;content:"";opacity:.1;opacity:var(--calendar-range-middle-background-opacity,.1)}.van-calendar__day--disabled{cursor:default;color:#c8c9cc;color:var(--calendar-day-disabled-color,#c8c9cc)}.van-calendar__bottom-info,.van-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;font-size:var(--calendar-info-font-size,10px);line-height:14px;line-height:var(--calendar-info-line-height,14px)}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{width:54px;width:var(--calendar-selected-day-size,54px);height:54px;height:var(--calendar-selected-day-size,54px);color:#fff;color:var(--calendar-selected-day-color,#fff);background-color:#ee0a24;background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;border-radius:var(--border-radius-md,4px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { |
| | | ROW_HEIGHT, |
| | | getNextDay, |
| | | compareDay, |
| | | copyDates, |
| | | calcDateNum, |
| | | formatMonthTitle, |
| | | compareMonth, |
| | | getMonths, |
| | | getDayByOffset, |
| | | } from './utils'; |
| | | import Toast from '../toast/toast'; |
| | | import { requestAnimationFrame } from '../common/utils'; |
| | | VantComponent({ |
| | | props: { |
| | | title: { |
| | | type: String, |
| | | value: 'æ¥æéæ©', |
| | | }, |
| | | color: String, |
| | | show: { |
| | | type: Boolean, |
| | | observer(val) { |
| | | if (val) { |
| | | this.initRect(); |
| | | this.scrollIntoView(); |
| | | } |
| | | }, |
| | | }, |
| | | formatter: null, |
| | | confirmText: { |
| | | type: String, |
| | | value: 'ç¡®å®', |
| | | }, |
| | | rangePrompt: String, |
| | | defaultDate: { |
| | | type: null, |
| | | observer(val) { |
| | | this.setData({ currentDate: val }); |
| | | this.scrollIntoView(); |
| | | }, |
| | | }, |
| | | allowSameDay: Boolean, |
| | | confirmDisabledText: String, |
| | | type: { |
| | | type: String, |
| | | value: 'single', |
| | | observer: 'reset', |
| | | }, |
| | | minDate: { |
| | | type: null, |
| | | value: Date.now(), |
| | | }, |
| | | maxDate: { |
| | | type: null, |
| | | value: new Date( |
| | | new Date().getFullYear(), |
| | | new Date().getMonth() + 6, |
| | | new Date().getDate() |
| | | ).getTime(), |
| | | }, |
| | | position: { |
| | | type: String, |
| | | value: 'bottom', |
| | | }, |
| | | rowHeight: { |
| | | type: null, |
| | | value: ROW_HEIGHT, |
| | | }, |
| | | round: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | poppable: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showMark: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showTitle: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showConfirm: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showSubtitle: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | closeOnClickOverlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | maxRange: { |
| | | type: null, |
| | | value: null, |
| | | }, |
| | | }, |
| | | data: { |
| | | subtitle: '', |
| | | currentDate: null, |
| | | scrollIntoView: '', |
| | | }, |
| | | created() { |
| | | this.setData({ |
| | | currentDate: this.getInitialDate(), |
| | | }); |
| | | }, |
| | | mounted() { |
| | | if (this.data.show || !this.data.poppable) { |
| | | this.initRect(); |
| | | this.scrollIntoView(); |
| | | } |
| | | }, |
| | | methods: { |
| | | reset() { |
| | | this.setData({ currentDate: this.getInitialDate() }); |
| | | this.scrollIntoView(); |
| | | }, |
| | | initRect() { |
| | | if (this.contentObserver != null) { |
| | | this.contentObserver.disconnect(); |
| | | } |
| | | const contentObserver = this.createIntersectionObserver({ |
| | | thresholds: [0, 0.1, 0.9, 1], |
| | | observeAll: true, |
| | | }); |
| | | this.contentObserver = contentObserver; |
| | | contentObserver.relativeTo('.van-calendar__body'); |
| | | contentObserver.observe('.month', (res) => { |
| | | if (res.boundingClientRect.top <= res.relativeRect.top) { |
| | | // @ts-ignore |
| | | this.setData({ subtitle: formatMonthTitle(res.dataset.date) }); |
| | | } |
| | | }); |
| | | }, |
| | | getInitialDate() { |
| | | const { type, defaultDate, minDate } = this.data; |
| | | if (type === 'range') { |
| | | const [startDay, endDay] = defaultDate || []; |
| | | return [ |
| | | startDay || minDate, |
| | | endDay || getNextDay(new Date(minDate)).getTime(), |
| | | ]; |
| | | } |
| | | if (type === 'multiple') { |
| | | return defaultDate || [minDate]; |
| | | } |
| | | return defaultDate || minDate; |
| | | }, |
| | | scrollIntoView() { |
| | | requestAnimationFrame(() => { |
| | | const { |
| | | currentDate, |
| | | type, |
| | | show, |
| | | poppable, |
| | | minDate, |
| | | maxDate, |
| | | } = this.data; |
| | | // @ts-ignore |
| | | const targetDate = type === 'single' ? currentDate : currentDate[0]; |
| | | const displayed = show || !poppable; |
| | | if (!targetDate || !displayed) { |
| | | return; |
| | | } |
| | | const months = getMonths(minDate, maxDate); |
| | | months.some((month, index) => { |
| | | if (compareMonth(month, targetDate) === 0) { |
| | | this.setData({ scrollIntoView: `month${index}` }); |
| | | return true; |
| | | } |
| | | return false; |
| | | }); |
| | | }); |
| | | }, |
| | | onOpen() { |
| | | this.$emit('open'); |
| | | }, |
| | | onOpened() { |
| | | this.$emit('opened'); |
| | | }, |
| | | onClose() { |
| | | this.$emit('close'); |
| | | }, |
| | | onClosed() { |
| | | this.$emit('closed'); |
| | | }, |
| | | onClickDay(event) { |
| | | const { date } = event.detail; |
| | | const { type, currentDate, allowSameDay } = this.data; |
| | | if (type === 'range') { |
| | | // @ts-ignore |
| | | const [startDay, endDay] = currentDate; |
| | | if (startDay && !endDay) { |
| | | const compareToStart = compareDay(date, startDay); |
| | | if (compareToStart === 1) { |
| | | this.select([startDay, date], true); |
| | | } else if (compareToStart === -1) { |
| | | this.select([date, null]); |
| | | } else if (allowSameDay) { |
| | | this.select([date, date]); |
| | | } |
| | | } else { |
| | | this.select([date, null]); |
| | | } |
| | | } else if (type === 'multiple') { |
| | | let selectedIndex; |
| | | // @ts-ignore |
| | | const selected = currentDate.some((dateItem, index) => { |
| | | const equal = compareDay(dateItem, date) === 0; |
| | | if (equal) { |
| | | selectedIndex = index; |
| | | } |
| | | return equal; |
| | | }); |
| | | if (selected) { |
| | | // @ts-ignore |
| | | const cancelDate = currentDate.splice(selectedIndex, 1); |
| | | this.setData({ currentDate }); |
| | | this.unselect(cancelDate); |
| | | } else { |
| | | // @ts-ignore |
| | | this.select([...currentDate, date]); |
| | | } |
| | | } else { |
| | | this.select(date, true); |
| | | } |
| | | }, |
| | | unselect(dateArray) { |
| | | const date = dateArray[0]; |
| | | if (date) { |
| | | this.$emit('unselect', copyDates(date)); |
| | | } |
| | | }, |
| | | select(date, complete) { |
| | | if (complete && this.data.type === 'range') { |
| | | const valid = this.checkRange(date); |
| | | if (!valid) { |
| | | // auto selected to max range if showConfirm |
| | | if (this.data.showConfirm) { |
| | | this.emit([ |
| | | date[0], |
| | | getDayByOffset(date[0], this.data.maxRange - 1), |
| | | ]); |
| | | } else { |
| | | this.emit(date); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | this.emit(date); |
| | | if (complete && !this.data.showConfirm) { |
| | | this.onConfirm(); |
| | | } |
| | | }, |
| | | emit(date) { |
| | | const getTime = (date) => (date instanceof Date ? date.getTime() : date); |
| | | this.setData({ |
| | | currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), |
| | | }); |
| | | this.$emit('select', copyDates(date)); |
| | | }, |
| | | checkRange(date) { |
| | | const { maxRange, rangePrompt } = this.data; |
| | | if (maxRange && calcDateNum(date) > maxRange) { |
| | | Toast({ |
| | | context: this, |
| | | message: rangePrompt || `鿩天æ°ä¸è½è¶
è¿ ${maxRange} 天`, |
| | | }); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | onConfirm() { |
| | | if ( |
| | | this.data.type === 'range' && |
| | | !this.checkRange(this.data.currentDate) |
| | | ) { |
| | | return; |
| | | } |
| | | wx.nextTick(() => { |
| | | // @ts-ignore |
| | | this.$emit('confirm', copyDates(this.data.currentDate)); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "header": "./components/header/index", |
| | | "month": "./components/month/index", |
| | | "van-button": "../button/index", |
| | | "van-popup": "../popup/index", |
| | | "van-toast": "../toast/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <import src="./calendar.wxml" /> |
| | | |
| | | <van-popup |
| | | wx:if="{{ poppable }}" |
| | | custom-class="van-calendar__popup--{{ position }}" |
| | | close-icon-class="van-calendar__close-icon" |
| | | show="{{ show }}" |
| | | round="{{ round }}" |
| | | position="{{ position }}" |
| | | closeable="{{ showTitle || showSubtitle }}" |
| | | close-on-click-overlay="{{ closeOnClickOverlay }}" |
| | | bind:enter="onOpen" |
| | | bind:close="onClose" |
| | | bind:after-enter="onOpened" |
| | | bind:after-leave="onClosed" |
| | | > |
| | | <include src="calendar.wxml" /> |
| | | </van-popup> |
| | | |
| | | <include wx:else src="calendar.wxml" /> |
| | | |
| | | <van-toast id="van-toast" /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var utils = require('./utils.wxs'); |
| | | |
| | | function getMonths(minDate, maxDate) { |
| | | var months = []; |
| | | var cursor = getDate(minDate); |
| | | |
| | | cursor.setDate(1); |
| | | |
| | | do { |
| | | months.push(cursor.getTime()); |
| | | cursor.setMonth(cursor.getMonth() + 1); |
| | | } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1); |
| | | |
| | | return months; |
| | | } |
| | | |
| | | function getButtonDisabled(type, currentDate) { |
| | | if (currentDate == null) { |
| | | return true; |
| | | } |
| | | |
| | | if (type === 'range') { |
| | | return !currentDate[0] || !currentDate[1]; |
| | | } |
| | | |
| | | if (type === 'multiple') { |
| | | return !currentDate.length; |
| | | } |
| | | |
| | | return !currentDate; |
| | | } |
| | | |
| | | module.exports = { |
| | | getMonths: getMonths, |
| | | getButtonDisabled: getButtonDisabled |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;height:var(--calendar-height,100%);background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:80%;height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-flex:1;flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.van-calendar__footer{-webkit-flex-shrink:0;flex-shrink:0;padding:0 16px;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:36px!important;height:var(--calendar-confirm-button-height,36px)!important;margin:7px 0!important;margin:var(--calendar-confirm-button-margin,7px 0)!important;line-height:34px!important;line-height:var(--calendar-confirm-button-line-height,34px)!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const ROW_HEIGHT = 64; |
| | | export declare function formatMonthTitle(date: Date): string; |
| | | export declare function compareMonth( |
| | | date1: Date | number, |
| | | date2: Date | number |
| | | ): 0 | 1 | -1; |
| | | export declare function compareDay( |
| | | day1: Date | number, |
| | | day2: Date | number |
| | | ): 0 | 1 | -1; |
| | | export declare function getDayByOffset(date: Date, offset: number): Date; |
| | | export declare function getPrevDay(date: Date): Date; |
| | | export declare function getNextDay(date: Date): Date; |
| | | export declare function calcDateNum(date: [Date, Date]): number; |
| | | export declare function copyDates(dates: Date | Date[]): Date | Date[]; |
| | | export declare function getMonthEndDay(year: number, month: number): number; |
| | | export declare function getMonths(minDate: number, maxDate: number): number[]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const ROW_HEIGHT = 64; |
| | | export function formatMonthTitle(date) { |
| | | if (!(date instanceof Date)) { |
| | | date = new Date(date); |
| | | } |
| | | return `${date.getFullYear()}å¹´${date.getMonth() + 1}æ`; |
| | | } |
| | | export function compareMonth(date1, date2) { |
| | | if (!(date1 instanceof Date)) { |
| | | date1 = new Date(date1); |
| | | } |
| | | if (!(date2 instanceof Date)) { |
| | | date2 = new Date(date2); |
| | | } |
| | | const year1 = date1.getFullYear(); |
| | | const year2 = date2.getFullYear(); |
| | | const month1 = date1.getMonth(); |
| | | const month2 = date2.getMonth(); |
| | | if (year1 === year2) { |
| | | return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; |
| | | } |
| | | return year1 > year2 ? 1 : -1; |
| | | } |
| | | export function compareDay(day1, day2) { |
| | | if (!(day1 instanceof Date)) { |
| | | day1 = new Date(day1); |
| | | } |
| | | if (!(day2 instanceof Date)) { |
| | | day2 = new Date(day2); |
| | | } |
| | | const compareMonthResult = compareMonth(day1, day2); |
| | | if (compareMonthResult === 0) { |
| | | const date1 = day1.getDate(); |
| | | const date2 = day2.getDate(); |
| | | return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; |
| | | } |
| | | return compareMonthResult; |
| | | } |
| | | export function getDayByOffset(date, offset) { |
| | | date = new Date(date); |
| | | date.setDate(date.getDate() + offset); |
| | | return date; |
| | | } |
| | | export function getPrevDay(date) { |
| | | return getDayByOffset(date, -1); |
| | | } |
| | | export function getNextDay(date) { |
| | | return getDayByOffset(date, 1); |
| | | } |
| | | export function calcDateNum(date) { |
| | | const day1 = new Date(date[0]).getTime(); |
| | | const day2 = new Date(date[1]).getTime(); |
| | | return (day2 - day1) / (1000 * 60 * 60 * 24) + 1; |
| | | } |
| | | export function copyDates(dates) { |
| | | if (Array.isArray(dates)) { |
| | | return dates.map((date) => { |
| | | if (date === null) { |
| | | return date; |
| | | } |
| | | return new Date(date); |
| | | }); |
| | | } |
| | | return new Date(dates); |
| | | } |
| | | export function getMonthEndDay(year, month) { |
| | | return 32 - new Date(year, month - 1, 32).getDate(); |
| | | } |
| | | export function getMonths(minDate, maxDate) { |
| | | const months = []; |
| | | const cursor = new Date(minDate); |
| | | cursor.setDate(1); |
| | | do { |
| | | months.push(cursor.getTime()); |
| | | cursor.setMonth(cursor.getMonth() + 1); |
| | | } while (compareMonth(cursor, maxDate) !== 1); |
| | | return months; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | function getMonthEndDay(year, month) { |
| | | return 32 - getDate(year, month - 1, 32).getDate(); |
| | | } |
| | | |
| | | function compareMonth(date1, date2) { |
| | | date1 = getDate(date1); |
| | | date2 = getDate(date2); |
| | | |
| | | var year1 = date1.getFullYear(); |
| | | var year2 = date2.getFullYear(); |
| | | var month1 = date1.getMonth(); |
| | | var month2 = date2.getMonth(); |
| | | |
| | | if (year1 === year2) { |
| | | return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; |
| | | } |
| | | |
| | | return year1 > year2 ? 1 : -1; |
| | | } |
| | | |
| | | module.exports = { |
| | | getMonthEndDay: getMonthEndDay, |
| | | compareMonth: compareMonth |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { link } from '../mixins/link'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: [ |
| | | 'num-class', |
| | | 'desc-class', |
| | | 'thumb-class', |
| | | 'title-class', |
| | | 'price-class', |
| | | 'origin-price-class', |
| | | ], |
| | | mixins: [link], |
| | | props: { |
| | | tag: String, |
| | | num: String, |
| | | desc: String, |
| | | thumb: String, |
| | | title: String, |
| | | price: { |
| | | type: String, |
| | | observer: 'updatePrice', |
| | | }, |
| | | centered: Boolean, |
| | | lazyLoad: Boolean, |
| | | thumbLink: String, |
| | | originPrice: String, |
| | | thumbMode: { |
| | | type: String, |
| | | value: 'aspectFit', |
| | | }, |
| | | currency: { |
| | | type: String, |
| | | value: 'Â¥', |
| | | }, |
| | | }, |
| | | methods: { |
| | | updatePrice() { |
| | | const { price } = this.data; |
| | | const priceArr = price.toString().split('.'); |
| | | this.setData({ |
| | | integerStr: priceArr[0], |
| | | decimalStr: priceArr[1] ? `.${priceArr[1]}` : '', |
| | | }); |
| | | }, |
| | | onClickThumb() { |
| | | this.jumpLink('thumbLink'); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-tag": "../tag/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="custom-class van-card"> |
| | | <view class="{{ utils.bem('card__header', { center: centered }) }}"> |
| | | <view class="van-card__thumb" bind:tap="onClickThumb"> |
| | | <image |
| | | wx:if="{{ thumb }}" |
| | | src="{{ thumb }}" |
| | | mode="{{ thumbMode }}" |
| | | lazy-load="{{ lazyLoad }}" |
| | | class="van-card__img thumb-class" |
| | | /> |
| | | <slot wx:else name="thumb" /> |
| | | <van-tag |
| | | wx:if="{{ tag }}" |
| | | mark |
| | | type="danger" |
| | | custom-class="van-card__tag" |
| | | > |
| | | {{ tag }} |
| | | </van-tag> |
| | | <slot wx:else name="tag" /> |
| | | </view> |
| | | |
| | | <view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}"> |
| | | <view> |
| | | <view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view> |
| | | <slot wx:else name="title" /> |
| | | |
| | | <view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view> |
| | | <slot wx:else name="desc" /> |
| | | |
| | | <slot name="tags" /> |
| | | </view> |
| | | |
| | | <view class="van-card__bottom"> |
| | | <slot name="price-top" /> |
| | | <view wx:if="{{ price || price === 0 }}" class="van-card__price price-class"> |
| | | <text>{{ currency }}</text> |
| | | <text class="van-card__price-integer">{{ integerStr }}</text> |
| | | <text class="van-card__price-decimal">{{ decimalStr }}</text> |
| | | </view> |
| | | <slot wx:else name="price" /> |
| | | <view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view> |
| | | <slot wx:else name="origin-price" /> |
| | | <view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view> |
| | | <slot wx:else name="num" /> |
| | | <slot name="bottom" /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="van-card__footer"> |
| | | <slot name="footer" /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:space-between;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{-webkit-justify-content:center;justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute!important;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | title: String, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view |
| | | wx:if="{{ title }}" |
| | | class="van-cell-group__title" |
| | | > |
| | | {{ title }} |
| | | </view> |
| | | <view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { link } from '../mixins/link'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: [ |
| | | 'title-class', |
| | | 'label-class', |
| | | 'value-class', |
| | | 'right-icon-class', |
| | | 'hover-class', |
| | | ], |
| | | mixins: [link], |
| | | props: { |
| | | title: null, |
| | | value: null, |
| | | icon: String, |
| | | size: String, |
| | | label: String, |
| | | center: Boolean, |
| | | isLink: Boolean, |
| | | required: Boolean, |
| | | clickable: Boolean, |
| | | titleWidth: String, |
| | | customStyle: String, |
| | | arrowDirection: String, |
| | | useLabelSlot: Boolean, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | titleStyle: String, |
| | | }, |
| | | methods: { |
| | | onClick(event) { |
| | | this.$emit('click', event.detail); |
| | | this.jumpLink(); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}" |
| | | hover-class="van-cell--hover hover-class" |
| | | hover-stay-time="70" |
| | | style="{{ customStyle }}" |
| | | bind:tap="onClick" |
| | | > |
| | | <van-icon |
| | | wx:if="{{ icon }}" |
| | | name="{{ icon }}" |
| | | class="van-cell__left-icon-wrap" |
| | | custom-class="van-cell__left-icon" |
| | | /> |
| | | <slot wx:else name="icon" /> |
| | | |
| | | <view |
| | | style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}" |
| | | class="van-cell__title title-class" |
| | | > |
| | | <block wx:if="{{ title }}">{{ title }}</block> |
| | | <slot wx:else name="title" /> |
| | | |
| | | <view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class"> |
| | | <slot wx:if="{{ useLabelSlot }}" name="label" /> |
| | | <block wx:elif="{{ label }}">{{ label }}</block> |
| | | </view> |
| | | </view> |
| | | |
| | | <view class="van-cell__value value-class"> |
| | | <block wx:if="{{ value || value === 0 }}">{{ value }}</block> |
| | | <slot wx:else /> |
| | | </view> |
| | | |
| | | <van-icon |
| | | wx:if="{{ isLink }}" |
| | | name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}" |
| | | class="van-cell__right-icon-wrap right-icon-class" |
| | | custom-class="van-cell__right-icon" |
| | | /> |
| | | <slot wx:else name="right-icon" /> |
| | | |
| | | <slot name="extra" /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function titleStyle(data) { |
| | | return style([ |
| | | { |
| | | 'max-width': addUnit(data.titleWidth), |
| | | 'min-width': addUnit(data.titleWidth), |
| | | }, |
| | | data.titleStyle, |
| | | ]); |
| | | } |
| | | |
| | | module.exports = { |
| | | titleStyle: titleStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { useChildren } from '../common/relation'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useChildren('checkbox', function (target) { |
| | | this.updateChild(target); |
| | | }), |
| | | props: { |
| | | max: Number, |
| | | value: { |
| | | type: Array, |
| | | observer: 'updateChildren', |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | observer: 'updateChildren', |
| | | }, |
| | | }, |
| | | methods: { |
| | | updateChildren() { |
| | | this.children.forEach((child) => this.updateChild(child)); |
| | | }, |
| | | updateChild(child) { |
| | | const { value, disabled } = this.data; |
| | | child.setData({ |
| | | value: value.indexOf(child.data.name) !== -1, |
| | | parentDisabled: disabled, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { useParent } from '../common/relation'; |
| | | import { VantComponent } from '../common/component'; |
| | | function emit(target, value) { |
| | | target.$emit('input', value); |
| | | target.$emit('change', value); |
| | | } |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useParent('checkbox-group'), |
| | | classes: ['icon-class', 'label-class'], |
| | | props: { |
| | | value: Boolean, |
| | | disabled: Boolean, |
| | | useIconSlot: Boolean, |
| | | checkedColor: String, |
| | | labelPosition: { |
| | | type: String, |
| | | value: 'right', |
| | | }, |
| | | labelDisabled: Boolean, |
| | | shape: { |
| | | type: String, |
| | | value: 'round', |
| | | }, |
| | | iconSize: { |
| | | type: null, |
| | | value: 20, |
| | | }, |
| | | }, |
| | | data: { |
| | | parentDisabled: false, |
| | | }, |
| | | methods: { |
| | | emitChange(value) { |
| | | if (this.parent) { |
| | | this.setParentValue(this.parent, value); |
| | | } else { |
| | | emit(this, value); |
| | | } |
| | | }, |
| | | toggle() { |
| | | const { parentDisabled, disabled, value } = this.data; |
| | | if (!disabled && !parentDisabled) { |
| | | this.emitChange(!value); |
| | | } |
| | | }, |
| | | onClickLabel() { |
| | | const { labelDisabled, parentDisabled, disabled, value } = this.data; |
| | | if (!disabled && !labelDisabled && !parentDisabled) { |
| | | this.emitChange(!value); |
| | | } |
| | | }, |
| | | setParentValue(parent, value) { |
| | | const parentValue = parent.data.value.slice(); |
| | | const { name } = this.data; |
| | | const { max } = parent.data; |
| | | if (value) { |
| | | if (max && parentValue.length >= max) { |
| | | return; |
| | | } |
| | | if (parentValue.indexOf(name) === -1) { |
| | | parentValue.push(name); |
| | | emit(parent, parentValue); |
| | | } |
| | | } else { |
| | | const index = parentValue.indexOf(name); |
| | | if (index !== -1) { |
| | | parentValue.splice(index, 1); |
| | | emit(parent, parentValue); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="van-checkbox custom-class"> |
| | | <view |
| | | wx:if="{{ labelPosition === 'left' }}" |
| | | class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" |
| | | bindtap="onClickLabel" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | <view class="van-checkbox__icon-wrap" bindtap="toggle"> |
| | | <slot wx:if="{{ useIconSlot }}" name="icon" /> |
| | | <van-icon |
| | | wx:else |
| | | name="success" |
| | | size="0.8em" |
| | | class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}" |
| | | style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}" |
| | | custom-class="icon-class" |
| | | custom-style="line-height: 1.25em;" |
| | | /> |
| | | </view> |
| | | <view |
| | | wx:if="{{ labelPosition === 'right' }}" |
| | | class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" |
| | | bindtap="onClickLabel" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) { |
| | | var styles = { |
| | | 'font-size': addUnit(iconSize), |
| | | }; |
| | | |
| | | if (checkedColor && value && !disabled && !parentDisabled) { |
| | | styles['border-color'] = checkedColor; |
| | | styles['background-color'] = checkedColor; |
| | | } |
| | | |
| | | return style(styles); |
| | | } |
| | | |
| | | module.exports = { |
| | | iconStyle: iconStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | declare type CanvasContext = WechatMiniprogram.CanvasContext; |
| | | export declare function adaptor( |
| | | ctx: CanvasContext & Record<string, unknown> |
| | | ): CanvasContext; |
| | | export {}; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export function adaptor(ctx) { |
| | | // @ts-ignore |
| | | return Object.assign(ctx, { |
| | | setStrokeStyle(val) { |
| | | ctx.strokeStyle = val; |
| | | }, |
| | | setLineWidth(val) { |
| | | ctx.lineWidth = val; |
| | | }, |
| | | setLineCap(val) { |
| | | ctx.lineCap = val; |
| | | }, |
| | | setFillStyle(val) { |
| | | ctx.fillStyle = val; |
| | | }, |
| | | setFontSize(val) { |
| | | ctx.font = String(val); |
| | | }, |
| | | setGlobalAlpha(val) { |
| | | ctx.globalAlpha = val; |
| | | }, |
| | | setLineJoin(val) { |
| | | ctx.lineJoin = val; |
| | | }, |
| | | setTextAlign(val) { |
| | | ctx.textAlign = val; |
| | | }, |
| | | setMiterLimit(val) { |
| | | ctx.miterLimit = val; |
| | | }, |
| | | setShadow(offsetX, offsetY, blur, color) { |
| | | ctx.shadowOffsetX = offsetX; |
| | | ctx.shadowOffsetY = offsetY; |
| | | ctx.shadowBlur = blur; |
| | | ctx.shadowColor = color; |
| | | }, |
| | | setTextBaseline(val) { |
| | | ctx.textBaseline = val; |
| | | }, |
| | | createCircularGradient() {}, |
| | | draw() {}, |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { BLUE, WHITE } from '../common/color'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { getSystemInfoSync } from '../common/utils'; |
| | | import { isObj } from '../common/validator'; |
| | | import { canIUseCanvas2d } from '../common/version'; |
| | | import { adaptor } from './canvas'; |
| | | function format(rate) { |
| | | return Math.min(Math.max(rate, 0), 100); |
| | | } |
| | | const PERIMETER = 2 * Math.PI; |
| | | const BEGIN_ANGLE = -Math.PI / 2; |
| | | const STEP = 1; |
| | | VantComponent({ |
| | | props: { |
| | | text: String, |
| | | lineCap: { |
| | | type: String, |
| | | value: 'round', |
| | | }, |
| | | value: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'reRender', |
| | | }, |
| | | speed: { |
| | | type: Number, |
| | | value: 50, |
| | | }, |
| | | size: { |
| | | type: Number, |
| | | value: 100, |
| | | observer() { |
| | | this.drawCircle(this.currentValue); |
| | | }, |
| | | }, |
| | | fill: String, |
| | | layerColor: { |
| | | type: String, |
| | | value: WHITE, |
| | | }, |
| | | color: { |
| | | type: null, |
| | | value: BLUE, |
| | | observer() { |
| | | this.setHoverColor().then(() => { |
| | | this.drawCircle(this.currentValue); |
| | | }); |
| | | }, |
| | | }, |
| | | type: { |
| | | type: String, |
| | | value: '', |
| | | }, |
| | | strokeWidth: { |
| | | type: Number, |
| | | value: 4, |
| | | }, |
| | | clockwise: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | hoverColor: BLUE, |
| | | }, |
| | | methods: { |
| | | getContext() { |
| | | const { type, size } = this.data; |
| | | if (type === '' || !canIUseCanvas2d()) { |
| | | const ctx = wx.createCanvasContext('van-circle', this); |
| | | return Promise.resolve(ctx); |
| | | } |
| | | const dpr = getSystemInfoSync().pixelRatio; |
| | | return new Promise((resolve) => { |
| | | wx.createSelectorQuery() |
| | | .in(this) |
| | | .select('#van-circle') |
| | | .node() |
| | | .exec((res) => { |
| | | const canvas = res[0].node; |
| | | const ctx = canvas.getContext(type); |
| | | if (!this.inited) { |
| | | this.inited = true; |
| | | canvas.width = size * dpr; |
| | | canvas.height = size * dpr; |
| | | ctx.scale(dpr, dpr); |
| | | } |
| | | resolve(adaptor(ctx)); |
| | | }); |
| | | }); |
| | | }, |
| | | setHoverColor() { |
| | | const { color, size } = this.data; |
| | | if (isObj(color)) { |
| | | return this.getContext().then((context) => { |
| | | const LinearColor = context.createLinearGradient(size, 0, 0, 0); |
| | | Object.keys(color) |
| | | .sort((a, b) => parseFloat(a) - parseFloat(b)) |
| | | .map((key) => |
| | | LinearColor.addColorStop(parseFloat(key) / 100, color[key]) |
| | | ); |
| | | this.hoverColor = LinearColor; |
| | | }); |
| | | } |
| | | this.hoverColor = color; |
| | | return Promise.resolve(); |
| | | }, |
| | | presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { |
| | | const { strokeWidth, lineCap, clockwise, size } = this.data; |
| | | const position = size / 2; |
| | | const radius = position - strokeWidth / 2; |
| | | context.setStrokeStyle(strokeStyle); |
| | | context.setLineWidth(strokeWidth); |
| | | context.setLineCap(lineCap); |
| | | context.beginPath(); |
| | | context.arc(position, position, radius, beginAngle, endAngle, !clockwise); |
| | | context.stroke(); |
| | | if (fill) { |
| | | context.setFillStyle(fill); |
| | | context.fill(); |
| | | } |
| | | }, |
| | | renderLayerCircle(context) { |
| | | const { layerColor, fill } = this.data; |
| | | this.presetCanvas(context, layerColor, 0, PERIMETER, fill); |
| | | }, |
| | | renderHoverCircle(context, formatValue) { |
| | | const { clockwise } = this.data; |
| | | // ç»æè§åº¦ |
| | | const progress = PERIMETER * (formatValue / 100); |
| | | const endAngle = clockwise |
| | | ? BEGIN_ANGLE + progress |
| | | : 3 * Math.PI - (BEGIN_ANGLE + progress); |
| | | this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); |
| | | }, |
| | | drawCircle(currentValue) { |
| | | const { size } = this.data; |
| | | this.getContext().then((context) => { |
| | | context.clearRect(0, 0, size, size); |
| | | this.renderLayerCircle(context); |
| | | const formatValue = format(currentValue); |
| | | if (formatValue !== 0) { |
| | | this.renderHoverCircle(context, formatValue); |
| | | } |
| | | context.draw(); |
| | | }); |
| | | }, |
| | | reRender() { |
| | | // tofector å¨ç»ææ¶æ²¡ææ³å°å¥½çè§£å³æ¹æ¡ |
| | | const { value, speed } = this.data; |
| | | if (speed <= 0 || speed > 1000) { |
| | | this.drawCircle(value); |
| | | return; |
| | | } |
| | | this.clearInterval(); |
| | | this.currentValue = this.currentValue || 0; |
| | | this.interval = setInterval(() => { |
| | | if (this.currentValue !== value) { |
| | | if (this.currentValue < value) { |
| | | this.currentValue += STEP; |
| | | } else { |
| | | this.currentValue -= STEP; |
| | | } |
| | | this.drawCircle(this.currentValue); |
| | | } else { |
| | | this.clearInterval(); |
| | | } |
| | | }, 1000 / speed); |
| | | }, |
| | | clearInterval() { |
| | | if (this.interval) { |
| | | clearInterval(this.interval); |
| | | this.interval = null; |
| | | } |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.currentValue = this.data.value; |
| | | this.setHoverColor().then(() => { |
| | | this.drawCircle(this.currentValue); |
| | | }); |
| | | }, |
| | | destroyed() { |
| | | this.clearInterval(); |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="van-circle"> |
| | | <canvas class="van-circle__canvas" type="{{ type }}" style="width: {{ utils.addUnit(size) }};height:{{ utils.addUnit(size) }}" id="van-circle" canvas-id="van-circle"></canvas> |
| | | <view wx:if="{{ !text }}" class="van-circle__text"> |
| | | <slot></slot> |
| | | </view> |
| | | <cover-view wx:else class="van-circle__text">{{ text }}</cover-view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-circle{position:relative;display:inline-block;text-align:center}.van-circle__text{position:absolute;top:50%;left:0;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#323233;color:var(--circle-text-color,#323233)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { useParent } from '../common/relation'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | relation: useParent('row'), |
| | | props: { |
| | | span: Number, |
| | | offset: Number, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}" |
| | | style="{{ computed.rootStyle({ gutter }) }}" |
| | | > |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | if (!data.gutter) { |
| | | return ''; |
| | | } |
| | | |
| | | return style({ |
| | | 'padding-right': addUnit(data.gutter / 2), |
| | | 'padding-left': addUnit(data.gutter / 2), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | export declare function setContentAnimate( |
| | | context: WechatMiniprogram.Component.TrivialInstance, |
| | | expanded: boolean, |
| | | mounted: boolean |
| | | ): void; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { canIUseAnimate } from '../common/version'; |
| | | import { getRect } from '../common/utils'; |
| | | function useAnimate(context, expanded, mounted, height) { |
| | | const selector = '.van-collapse-item__wrapper'; |
| | | if (expanded) { |
| | | context.animate( |
| | | selector, |
| | | [ |
| | | { height: 0, ease: 'ease-in-out', offset: 0 }, |
| | | { height: `${height}px`, ease: 'ease-in-out', offset: 1 }, |
| | | { height: `auto`, ease: 'ease-in-out', offset: 1 }, |
| | | ], |
| | | mounted ? 300 : 0, |
| | | () => { |
| | | context.clearAnimation(selector); |
| | | } |
| | | ); |
| | | return; |
| | | } |
| | | context.animate( |
| | | selector, |
| | | [ |
| | | { height: `${height}px`, ease: 'ease-in-out', offset: 0 }, |
| | | { height: 0, ease: 'ease-in-out', offset: 1 }, |
| | | ], |
| | | 300, |
| | | () => { |
| | | context.clearAnimation(selector); |
| | | } |
| | | ); |
| | | } |
| | | function useAnimation(context, expanded, mounted, height) { |
| | | const animation = wx.createAnimation({ |
| | | duration: 0, |
| | | timingFunction: 'ease-in-out', |
| | | }); |
| | | if (expanded) { |
| | | if (height === 0) { |
| | | animation.height('auto').top(1).step(); |
| | | } else { |
| | | animation |
| | | .height(height) |
| | | .top(1) |
| | | .step({ |
| | | duration: mounted ? 300 : 1, |
| | | }) |
| | | .height('auto') |
| | | .step(); |
| | | } |
| | | context.setData({ |
| | | animation: animation.export(), |
| | | }); |
| | | return; |
| | | } |
| | | animation.height(height).top(0).step({ duration: 1 }).height(0).step({ |
| | | duration: 300, |
| | | }); |
| | | context.setData({ |
| | | animation: animation.export(), |
| | | }); |
| | | } |
| | | export function setContentAnimate(context, expanded, mounted) { |
| | | getRect(context, '.van-collapse-item__content') |
| | | .then((rect) => rect.height) |
| | | .then((height) => { |
| | | canIUseAnimate() |
| | | ? useAnimate(context, expanded, mounted, height) |
| | | : useAnimation(context, expanded, mounted, height); |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | import { setContentAnimate } from './animate'; |
| | | VantComponent({ |
| | | classes: ['title-class', 'content-class'], |
| | | relation: useParent('collapse'), |
| | | props: { |
| | | name: null, |
| | | title: null, |
| | | value: null, |
| | | icon: String, |
| | | label: String, |
| | | disabled: Boolean, |
| | | clickable: Boolean, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | isLink: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | expanded: false, |
| | | }, |
| | | mounted() { |
| | | this.updateExpanded(); |
| | | this.mounted = true; |
| | | }, |
| | | methods: { |
| | | updateExpanded() { |
| | | if (!this.parent) { |
| | | return; |
| | | } |
| | | const { value, accordion } = this.parent.data; |
| | | const { children = [] } = this.parent; |
| | | const { name } = this.data; |
| | | const index = children.indexOf(this); |
| | | const currentName = name == null ? index : name; |
| | | const expanded = accordion |
| | | ? value === currentName |
| | | : (value || []).some((name) => name === currentName); |
| | | if (expanded !== this.data.expanded) { |
| | | setContentAnimate(this, expanded, this.mounted); |
| | | } |
| | | this.setData({ index, expanded }); |
| | | }, |
| | | onClick() { |
| | | if (this.data.disabled) { |
| | | return; |
| | | } |
| | | const { name, expanded } = this.data; |
| | | const index = this.parent.children.indexOf(this); |
| | | const currentName = name == null ? index : name; |
| | | this.parent.switch(currentName, !expanded); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-cell": "../cell/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}"> |
| | | <van-cell |
| | | title="{{ title }}" |
| | | title-class="title-class" |
| | | icon="{{ icon }}" |
| | | value="{{ value }}" |
| | | label="{{ label }}" |
| | | is-link="{{ isLink }}" |
| | | clickable="{{ clickable }}" |
| | | border="{{ border && expanded }}" |
| | | class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}" |
| | | right-icon-class="van-cell__right-icon" |
| | | custom-class="van-cell" |
| | | hover-class="van-cell--hover" |
| | | bind:click="onClick" |
| | | > |
| | | <slot |
| | | name="title" |
| | | slot="title" |
| | | /> |
| | | <slot |
| | | name="icon" |
| | | slot="icon" |
| | | /> |
| | | <slot name="value" /> |
| | | <slot |
| | | name="right-icon" |
| | | slot="right-icon" |
| | | /> |
| | | </van-cell> |
| | | <view |
| | | class="{{ utils.bem('collapse-item__wrapper') }}" |
| | | style="height: 0;" |
| | | animation="{{ animation }}" |
| | | > |
| | | <view |
| | | class="van-collapse-item__content content-class" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;transition:-webkit-transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s),-webkit-transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c8c9cc!important;color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important;background-color:var(--white,#fff)!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{padding:15px;padding:var(--collapse-item-content-padding,15px);color:#969799;color:var(--collapse-item-content-text-color,#969799);font-size:13px;font-size:var(--collapse-item-content-font-size,13px);line-height:1.5;line-height:var(--collapse-item-content-line-height,1.5);background-color:#fff;background-color:var(--collapse-item-content-background-color,#fff)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useChildren('collapse-item'), |
| | | props: { |
| | | value: { |
| | | type: null, |
| | | observer: 'updateExpanded', |
| | | }, |
| | | accordion: { |
| | | type: Boolean, |
| | | observer: 'updateExpanded', |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | methods: { |
| | | updateExpanded() { |
| | | this.children.forEach((child) => { |
| | | child.updateExpanded(); |
| | | }); |
| | | }, |
| | | switch(name, expanded) { |
| | | const { accordion, value } = this.data; |
| | | const changeItem = name; |
| | | if (!accordion) { |
| | | name = expanded |
| | | ? (value || []).concat(name) |
| | | : (value || []).filter((activeName) => activeName !== name); |
| | | } else { |
| | | name = expanded ? name : ''; |
| | | } |
| | | if (expanded) { |
| | | this.$emit('open', changeItem); |
| | | } else { |
| | | this.$emit('close', changeItem); |
| | | } |
| | | this.$emit('change', name); |
| | | this.$emit('input', name); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const RED = "#ee0a24"; |
| | | export declare const BLUE = "#1989fa"; |
| | | export declare const WHITE = "#fff"; |
| | | export declare const GREEN = "#07c160"; |
| | | export declare const ORANGE = "#ff976a"; |
| | | export declare const GRAY = "#323233"; |
| | | export declare const GRAY_DARK = "#969799"; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const RED = '#ee0a24'; |
| | | export const BLUE = '#1989fa'; |
| | | export const WHITE = '#fff'; |
| | | export const GREEN = '#07c160'; |
| | | export const ORANGE = '#ff976a'; |
| | | export const GRAY = '#323233'; |
| | | export const GRAY_DARK = '#969799'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | import { VantComponentOptions } from '../definitions/index'; |
| | | declare function VantComponent< |
| | | Data extends WechatMiniprogram.Component.DataOption, |
| | | Props extends WechatMiniprogram.Component.PropertyOption, |
| | | Methods extends WechatMiniprogram.Component.MethodOption |
| | | >(vantOptions: VantComponentOptions<Data, Props, Methods>): void; |
| | | export { VantComponent }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { basic } from '../mixins/basic'; |
| | | function mapKeys(source, target, map) { |
| | | Object.keys(map).forEach((key) => { |
| | | if (source[key]) { |
| | | target[map[key]] = source[key]; |
| | | } |
| | | }); |
| | | } |
| | | function VantComponent(vantOptions) { |
| | | const options = {}; |
| | | mapKeys(vantOptions, options, { |
| | | data: 'data', |
| | | props: 'properties', |
| | | mixins: 'behaviors', |
| | | methods: 'methods', |
| | | beforeCreate: 'created', |
| | | created: 'attached', |
| | | mounted: 'ready', |
| | | destroyed: 'detached', |
| | | classes: 'externalClasses', |
| | | }); |
| | | // add default externalClasses |
| | | options.externalClasses = options.externalClasses || []; |
| | | options.externalClasses.push('custom-class'); |
| | | // add default behaviors |
| | | options.behaviors = options.behaviors || []; |
| | | options.behaviors.push(basic); |
| | | // add relations |
| | | const { relation } = vantOptions; |
| | | if (relation) { |
| | | options.relations = relation.relations; |
| | | options.behaviors.push(relation.mixin); |
| | | } |
| | | // map field to form-field behavior |
| | | if (vantOptions.field) { |
| | | options.behaviors.push('wx://form-field'); |
| | | } |
| | | // add default options |
| | | options.options = { |
| | | multipleSlots: true, |
| | | addGlobalClass: true, |
| | | }; |
| | | Component(options); |
| | | } |
| | | export { VantComponent }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance; |
| | | export declare function useParent( |
| | | name: string, |
| | | onEffect?: (this: TrivialInstance) => void |
| | | ): { |
| | | relations: { |
| | | [x: string]: WechatMiniprogram.Component.RelationOption; |
| | | }; |
| | | mixin: string; |
| | | }; |
| | | export declare function useChildren( |
| | | name: string, |
| | | onEffect?: (this: TrivialInstance, target: TrivialInstance) => void |
| | | ): { |
| | | relations: { |
| | | [x: string]: WechatMiniprogram.Component.RelationOption; |
| | | }; |
| | | mixin: string; |
| | | }; |
| | | export {}; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export function useParent(name, onEffect) { |
| | | const path = `../${name}/index`; |
| | | return { |
| | | relations: { |
| | | [path]: { |
| | | type: 'ancestor', |
| | | linked() { |
| | | onEffect && onEffect.call(this); |
| | | }, |
| | | linkChanged() { |
| | | onEffect && onEffect.call(this); |
| | | }, |
| | | unlinked() { |
| | | onEffect && onEffect.call(this); |
| | | }, |
| | | }, |
| | | }, |
| | | mixin: Behavior({ |
| | | created() { |
| | | Object.defineProperty(this, 'parent', { |
| | | get: () => this.getRelationNodes(path)[0], |
| | | }); |
| | | Object.defineProperty(this, 'index', { |
| | | // @ts-ignore |
| | | get: () => { |
| | | var _a, _b; |
| | | return (_b = |
| | | (_a = this.parent) === null || _a === void 0 |
| | | ? void 0 |
| | | : _a.children) === null || _b === void 0 |
| | | ? void 0 |
| | | : _b.indexOf(this); |
| | | }, |
| | | }); |
| | | }, |
| | | }), |
| | | }; |
| | | } |
| | | export function useChildren(name, onEffect) { |
| | | const path = `../${name}/index`; |
| | | return { |
| | | relations: { |
| | | [path]: { |
| | | type: 'descendant', |
| | | linked(target) { |
| | | onEffect && onEffect.call(this, target); |
| | | }, |
| | | linkChanged(target) { |
| | | onEffect && onEffect.call(this, target); |
| | | }, |
| | | unlinked(target) { |
| | | onEffect && onEffect.call(this, target); |
| | | }, |
| | | }, |
| | | }, |
| | | mixin: Behavior({ |
| | | created() { |
| | | Object.defineProperty(this, 'children', { |
| | | get: () => this.getRelationNodes(path) || [], |
| | | }); |
| | | }, |
| | | }), |
| | | }; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .van-clearfix:after{display:table;clear:both;content:""} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | .van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | export declare function range(num: number, min: number, max: number): number; |
| | | export declare function nextTick(cb: (...args: any[]) => void): void; |
| | | export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSyncResult; |
| | | export declare function addUnit(value?: string | number): string | undefined; |
| | | export declare function requestAnimationFrame( |
| | | cb: () => void |
| | | ): number | WechatMiniprogram.NodesRef; |
| | | export declare function pickExclude(obj: unknown, keys: string[]): {}; |
| | | export declare function getRect( |
| | | context: WechatMiniprogram.Component.TrivialInstance, |
| | | selector: string |
| | | ): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>; |
| | | export declare function getAllRect( |
| | | context: WechatMiniprogram.Component.TrivialInstance, |
| | | selector: string |
| | | ): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; |
| | | export declare function groupSetData( |
| | | context: WechatMiniprogram.Component.TrivialInstance, |
| | | cb: () => void |
| | | ): void; |
| | | export declare function toPromise( |
| | | promiseLike: Promise<unknown> | unknown |
| | | ): Promise<unknown>; |
| | | export declare function getCurrentPage<T>(): T & |
| | | WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & |
| | | WechatMiniprogram.Page.InstanceProperties & |
| | | WechatMiniprogram.Page.InstanceMethods<Record<string, any>> & |
| | | WechatMiniprogram.Page.Data<Record<string, any>> & |
| | | Record<string, any>; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { isDef, isNumber, isPlainObject, isPromise } from './validator'; |
| | | import { canIUseGroupSetData, canIUseNextTick } from './version'; |
| | | export function range(num, min, max) { |
| | | return Math.min(Math.max(num, min), max); |
| | | } |
| | | export function nextTick(cb) { |
| | | if (canIUseNextTick()) { |
| | | wx.nextTick(cb); |
| | | } else { |
| | | setTimeout(() => { |
| | | cb(); |
| | | }, 1000 / 30); |
| | | } |
| | | } |
| | | let systemInfo; |
| | | export function getSystemInfoSync() { |
| | | if (systemInfo == null) { |
| | | systemInfo = wx.getSystemInfoSync(); |
| | | } |
| | | return systemInfo; |
| | | } |
| | | export function addUnit(value) { |
| | | if (!isDef(value)) { |
| | | return undefined; |
| | | } |
| | | value = String(value); |
| | | return isNumber(value) ? `${value}px` : value; |
| | | } |
| | | export function requestAnimationFrame(cb) { |
| | | const systemInfo = getSystemInfoSync(); |
| | | if (systemInfo.platform === 'devtools') { |
| | | return setTimeout(() => { |
| | | cb(); |
| | | }, 1000 / 30); |
| | | } |
| | | return wx |
| | | .createSelectorQuery() |
| | | .selectViewport() |
| | | .boundingClientRect() |
| | | .exec(() => { |
| | | cb(); |
| | | }); |
| | | } |
| | | export function pickExclude(obj, keys) { |
| | | if (!isPlainObject(obj)) { |
| | | return {}; |
| | | } |
| | | return Object.keys(obj).reduce((prev, key) => { |
| | | if (!keys.includes(key)) { |
| | | prev[key] = obj[key]; |
| | | } |
| | | return prev; |
| | | }, {}); |
| | | } |
| | | export function getRect(context, selector) { |
| | | return new Promise((resolve) => { |
| | | wx.createSelectorQuery() |
| | | .in(context) |
| | | .select(selector) |
| | | .boundingClientRect() |
| | | .exec((rect = []) => resolve(rect[0])); |
| | | }); |
| | | } |
| | | export function getAllRect(context, selector) { |
| | | return new Promise((resolve) => { |
| | | wx.createSelectorQuery() |
| | | .in(context) |
| | | .selectAll(selector) |
| | | .boundingClientRect() |
| | | .exec((rect = []) => resolve(rect[0])); |
| | | }); |
| | | } |
| | | export function groupSetData(context, cb) { |
| | | if (canIUseGroupSetData()) { |
| | | context.groupSetData(cb); |
| | | } else { |
| | | cb(); |
| | | } |
| | | } |
| | | export function toPromise(promiseLike) { |
| | | if (isPromise(promiseLike)) { |
| | | return promiseLike; |
| | | } |
| | | return Promise.resolve(promiseLike); |
| | | } |
| | | export function getCurrentPage() { |
| | | const pages = getCurrentPages(); |
| | | return pages[pages.length - 1]; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare function isFunction(val: unknown): val is Function; |
| | | export declare function isPlainObject( |
| | | val: unknown |
| | | ): val is Record<string, unknown>; |
| | | export declare function isPromise<T = unknown>(val: unknown): val is Promise<T>; |
| | | export declare function isDef(value: unknown): boolean; |
| | | export declare function isObj(x: unknown): x is Record<string, unknown>; |
| | | export declare function isNumber(value: string): boolean; |
| | | export declare function isBoolean(value: unknown): value is boolean; |
| | | export declare function isImageUrl(url: string): boolean; |
| | | export declare function isVideoUrl(url: string): boolean; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export function isFunction(val) { |
| | | return typeof val === 'function'; |
| | | } |
| | | export function isPlainObject(val) { |
| | | return val !== null && typeof val === 'object' && !Array.isArray(val); |
| | | } |
| | | export function isPromise(val) { |
| | | return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch); |
| | | } |
| | | export function isDef(value) { |
| | | return value !== undefined && value !== null; |
| | | } |
| | | export function isObj(x) { |
| | | const type = typeof x; |
| | | return x !== null && (type === 'object' || type === 'function'); |
| | | } |
| | | export function isNumber(value) { |
| | | return /^\d+(\.\d+)?$/.test(value); |
| | | } |
| | | export function isBoolean(value) { |
| | | return typeof value === 'boolean'; |
| | | } |
| | | const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i; |
| | | const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i; |
| | | export function isImageUrl(url) { |
| | | return IMAGE_REGEXP.test(url); |
| | | } |
| | | export function isVideoUrl(url) { |
| | | return VIDEO_REGEXP.test(url); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare function canIUseModel(): boolean; |
| | | export declare function canIUseFormFieldButton(): boolean; |
| | | export declare function canIUseAnimate(): boolean; |
| | | export declare function canIUseGroupSetData(): boolean; |
| | | export declare function canIUseNextTick(): boolean; |
| | | export declare function canIUseCanvas2d(): boolean; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { getSystemInfoSync } from './utils'; |
| | | function compareVersion(v1, v2) { |
| | | v1 = v1.split('.'); |
| | | v2 = v2.split('.'); |
| | | const len = Math.max(v1.length, v2.length); |
| | | while (v1.length < len) { |
| | | v1.push('0'); |
| | | } |
| | | while (v2.length < len) { |
| | | v2.push('0'); |
| | | } |
| | | for (let i = 0; i < len; i++) { |
| | | const num1 = parseInt(v1[i], 10); |
| | | const num2 = parseInt(v2[i], 10); |
| | | if (num1 > num2) { |
| | | return 1; |
| | | } |
| | | if (num1 < num2) { |
| | | return -1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | function gte(version) { |
| | | const system = getSystemInfoSync(); |
| | | return compareVersion(system.SDKVersion, version) >= 0; |
| | | } |
| | | export function canIUseModel() { |
| | | return gte('2.9.3'); |
| | | } |
| | | export function canIUseFormFieldButton() { |
| | | return gte('2.10.3'); |
| | | } |
| | | export function canIUseAnimate() { |
| | | return gte('2.9.0'); |
| | | } |
| | | export function canIUseGroupSetData() { |
| | | return gte('2.4.0'); |
| | | } |
| | | export function canIUseNextTick() { |
| | | return wx.canIUse('nextTick'); |
| | | } |
| | | export function canIUseCanvas2d() { |
| | | return gte('2.9.0'); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { isSameSecond, parseFormat, parseTimeData } from './utils'; |
| | | function simpleTick(fn) { |
| | | return setTimeout(fn, 30); |
| | | } |
| | | VantComponent({ |
| | | props: { |
| | | useSlot: Boolean, |
| | | millisecond: Boolean, |
| | | time: { |
| | | type: Number, |
| | | observer: 'reset', |
| | | }, |
| | | format: { |
| | | type: String, |
| | | value: 'HH:mm:ss', |
| | | }, |
| | | autoStart: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | timeData: parseTimeData(0), |
| | | formattedTime: '0', |
| | | }, |
| | | destroyed() { |
| | | clearTimeout(this.tid); |
| | | this.tid = null; |
| | | }, |
| | | methods: { |
| | | // å¼å§ |
| | | start() { |
| | | if (this.counting) { |
| | | return; |
| | | } |
| | | this.counting = true; |
| | | this.endTime = Date.now() + this.remain; |
| | | this.tick(); |
| | | }, |
| | | // æå |
| | | pause() { |
| | | this.counting = false; |
| | | clearTimeout(this.tid); |
| | | }, |
| | | // éç½® |
| | | reset() { |
| | | this.pause(); |
| | | this.remain = this.data.time; |
| | | this.setRemain(this.remain); |
| | | if (this.data.autoStart) { |
| | | this.start(); |
| | | } |
| | | }, |
| | | tick() { |
| | | if (this.data.millisecond) { |
| | | this.microTick(); |
| | | } else { |
| | | this.macroTick(); |
| | | } |
| | | }, |
| | | microTick() { |
| | | this.tid = simpleTick(() => { |
| | | this.setRemain(this.getRemain()); |
| | | if (this.remain !== 0) { |
| | | this.microTick(); |
| | | } |
| | | }); |
| | | }, |
| | | macroTick() { |
| | | this.tid = simpleTick(() => { |
| | | const remain = this.getRemain(); |
| | | if (!isSameSecond(remain, this.remain) || remain === 0) { |
| | | this.setRemain(remain); |
| | | } |
| | | if (this.remain !== 0) { |
| | | this.macroTick(); |
| | | } |
| | | }); |
| | | }, |
| | | getRemain() { |
| | | return Math.max(this.endTime - Date.now(), 0); |
| | | }, |
| | | setRemain(remain) { |
| | | this.remain = remain; |
| | | const timeData = parseTimeData(remain); |
| | | if (this.data.useSlot) { |
| | | this.$emit('change', timeData); |
| | | } |
| | | this.setData({ |
| | | formattedTime: parseFormat(this.data.format, timeData), |
| | | }); |
| | | if (remain === 0) { |
| | | this.pause(); |
| | | this.$emit('finish'); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-count-down"> |
| | | <slot wx:if="{{ useSlot }}"/> |
| | | <block wx:else>{{ formattedTime }}</block> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-count-down{color:#323233;color:var(--count-down-text-color,#323233);font-size:14px;font-size:var(--count-down-font-size,14px);line-height:20px;line-height:var(--count-down-line-height,20px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare type TimeData = { |
| | | days: number; |
| | | hours: number; |
| | | minutes: number; |
| | | seconds: number; |
| | | milliseconds: number; |
| | | }; |
| | | export declare function parseTimeData(time: number): TimeData; |
| | | export declare function parseFormat(format: string, timeData: TimeData): string; |
| | | export declare function isSameSecond(time1: number, time2: number): boolean; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | function padZero(num, targetLength = 2) { |
| | | let str = num + ''; |
| | | while (str.length < targetLength) { |
| | | str = '0' + str; |
| | | } |
| | | return str; |
| | | } |
| | | const SECOND = 1000; |
| | | const MINUTE = 60 * SECOND; |
| | | const HOUR = 60 * MINUTE; |
| | | const DAY = 24 * HOUR; |
| | | export function parseTimeData(time) { |
| | | const days = Math.floor(time / DAY); |
| | | const hours = Math.floor((time % DAY) / HOUR); |
| | | const minutes = Math.floor((time % HOUR) / MINUTE); |
| | | const seconds = Math.floor((time % MINUTE) / SECOND); |
| | | const milliseconds = Math.floor(time % SECOND); |
| | | return { |
| | | days, |
| | | hours, |
| | | minutes, |
| | | seconds, |
| | | milliseconds, |
| | | }; |
| | | } |
| | | export function parseFormat(format, timeData) { |
| | | const { days } = timeData; |
| | | let { hours, minutes, seconds, milliseconds } = timeData; |
| | | if (format.indexOf('DD') === -1) { |
| | | hours += days * 24; |
| | | } else { |
| | | format = format.replace('DD', padZero(days)); |
| | | } |
| | | if (format.indexOf('HH') === -1) { |
| | | minutes += hours * 60; |
| | | } else { |
| | | format = format.replace('HH', padZero(hours)); |
| | | } |
| | | if (format.indexOf('mm') === -1) { |
| | | seconds += minutes * 60; |
| | | } else { |
| | | format = format.replace('mm', padZero(minutes)); |
| | | } |
| | | if (format.indexOf('ss') === -1) { |
| | | milliseconds += seconds * 1000; |
| | | } else { |
| | | format = format.replace('ss', padZero(seconds)); |
| | | } |
| | | return format.replace('SSS', padZero(milliseconds, 3)); |
| | | } |
| | | export function isSameSecond(time1, time2) { |
| | | return Math.floor(time1 / 1000) === Math.floor(time2 / 1000); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { isDef } from '../common/validator'; |
| | | import { pickerProps } from '../picker/shared'; |
| | | const currentYear = new Date().getFullYear(); |
| | | function isValidDate(date) { |
| | | return isDef(date) && !isNaN(new Date(date).getTime()); |
| | | } |
| | | function range(num, min, max) { |
| | | return Math.min(Math.max(num, min), max); |
| | | } |
| | | function padZero(val) { |
| | | return `00${val}`.slice(-2); |
| | | } |
| | | function times(n, iteratee) { |
| | | let index = -1; |
| | | const result = Array(n < 0 ? 0 : n); |
| | | while (++index < n) { |
| | | result[index] = iteratee(index); |
| | | } |
| | | return result; |
| | | } |
| | | function getTrueValue(formattedValue) { |
| | | if (formattedValue === undefined) { |
| | | formattedValue = '1'; |
| | | } |
| | | while (isNaN(parseInt(formattedValue, 10))) { |
| | | formattedValue = formattedValue.slice(1); |
| | | } |
| | | return parseInt(formattedValue, 10); |
| | | } |
| | | function getMonthEndDay(year, month) { |
| | | return 32 - new Date(year, month - 1, 32).getDate(); |
| | | } |
| | | const defaultFormatter = (type, value) => value; |
| | | VantComponent({ |
| | | classes: ['active-class', 'toolbar-class', 'column-class'], |
| | | props: Object.assign(Object.assign({}, pickerProps), { |
| | | value: { |
| | | type: null, |
| | | observer: 'updateValue', |
| | | }, |
| | | filter: null, |
| | | type: { |
| | | type: String, |
| | | value: 'datetime', |
| | | observer: 'updateValue', |
| | | }, |
| | | showToolbar: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | formatter: { |
| | | type: null, |
| | | value: defaultFormatter, |
| | | }, |
| | | minDate: { |
| | | type: Number, |
| | | value: new Date(currentYear - 10, 0, 1).getTime(), |
| | | observer: 'updateValue', |
| | | }, |
| | | maxDate: { |
| | | type: Number, |
| | | value: new Date(currentYear + 10, 11, 31).getTime(), |
| | | observer: 'updateValue', |
| | | }, |
| | | minHour: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'updateValue', |
| | | }, |
| | | maxHour: { |
| | | type: Number, |
| | | value: 23, |
| | | observer: 'updateValue', |
| | | }, |
| | | minMinute: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'updateValue', |
| | | }, |
| | | maxMinute: { |
| | | type: Number, |
| | | value: 59, |
| | | observer: 'updateValue', |
| | | }, |
| | | }), |
| | | data: { |
| | | innerValue: Date.now(), |
| | | columns: [], |
| | | }, |
| | | methods: { |
| | | updateValue() { |
| | | const { data } = this; |
| | | const val = this.correctValue(data.value); |
| | | const isEqual = val === data.innerValue; |
| | | if (!isEqual) { |
| | | this.updateColumnValue(val).then(() => { |
| | | this.$emit('input', val); |
| | | }); |
| | | } else { |
| | | this.updateColumns(); |
| | | } |
| | | }, |
| | | getPicker() { |
| | | if (this.picker == null) { |
| | | this.picker = this.selectComponent('.van-datetime-picker'); |
| | | const { picker } = this; |
| | | const { setColumnValues } = picker; |
| | | picker.setColumnValues = (...args) => |
| | | setColumnValues.apply(picker, [...args, false]); |
| | | } |
| | | return this.picker; |
| | | }, |
| | | updateColumns() { |
| | | const { formatter = defaultFormatter } = this.data; |
| | | const results = this.getOriginColumns().map((column) => ({ |
| | | values: column.values.map((value) => formatter(column.type, value)), |
| | | })); |
| | | return this.set({ columns: results }); |
| | | }, |
| | | getOriginColumns() { |
| | | const { filter } = this.data; |
| | | const results = this.getRanges().map(({ type, range }) => { |
| | | let values = times(range[1] - range[0] + 1, (index) => { |
| | | let value = range[0] + index; |
| | | value = type === 'year' ? `${value}` : padZero(value); |
| | | return value; |
| | | }); |
| | | if (filter) { |
| | | values = filter(type, values); |
| | | } |
| | | return { type, values }; |
| | | }); |
| | | return results; |
| | | }, |
| | | getRanges() { |
| | | const { data } = this; |
| | | if (data.type === 'time') { |
| | | return [ |
| | | { |
| | | type: 'hour', |
| | | range: [data.minHour, data.maxHour], |
| | | }, |
| | | { |
| | | type: 'minute', |
| | | range: [data.minMinute, data.maxMinute], |
| | | }, |
| | | ]; |
| | | } |
| | | const { |
| | | maxYear, |
| | | maxDate, |
| | | maxMonth, |
| | | maxHour, |
| | | maxMinute, |
| | | } = this.getBoundary('max', data.innerValue); |
| | | const { |
| | | minYear, |
| | | minDate, |
| | | minMonth, |
| | | minHour, |
| | | minMinute, |
| | | } = this.getBoundary('min', data.innerValue); |
| | | const result = [ |
| | | { |
| | | type: 'year', |
| | | range: [minYear, maxYear], |
| | | }, |
| | | { |
| | | type: 'month', |
| | | range: [minMonth, maxMonth], |
| | | }, |
| | | { |
| | | type: 'day', |
| | | range: [minDate, maxDate], |
| | | }, |
| | | { |
| | | type: 'hour', |
| | | range: [minHour, maxHour], |
| | | }, |
| | | { |
| | | type: 'minute', |
| | | range: [minMinute, maxMinute], |
| | | }, |
| | | ]; |
| | | if (data.type === 'date') result.splice(3, 2); |
| | | if (data.type === 'year-month') result.splice(2, 3); |
| | | return result; |
| | | }, |
| | | correctValue(value) { |
| | | const { data } = this; |
| | | // validate value |
| | | const isDateType = data.type !== 'time'; |
| | | if (isDateType && !isValidDate(value)) { |
| | | value = data.minDate; |
| | | } else if (!isDateType && !value) { |
| | | const { minHour } = data; |
| | | value = `${padZero(minHour)}:00`; |
| | | } |
| | | // time type |
| | | if (!isDateType) { |
| | | let [hour, minute] = value.split(':'); |
| | | hour = padZero(range(hour, data.minHour, data.maxHour)); |
| | | minute = padZero(range(minute, data.minMinute, data.maxMinute)); |
| | | return `${hour}:${minute}`; |
| | | } |
| | | // date type |
| | | value = Math.max(value, data.minDate); |
| | | value = Math.min(value, data.maxDate); |
| | | return value; |
| | | }, |
| | | getBoundary(type, innerValue) { |
| | | const value = new Date(innerValue); |
| | | const boundary = new Date(this.data[`${type}Date`]); |
| | | const year = boundary.getFullYear(); |
| | | let month = 1; |
| | | let date = 1; |
| | | let hour = 0; |
| | | let minute = 0; |
| | | if (type === 'max') { |
| | | month = 12; |
| | | date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1); |
| | | hour = 23; |
| | | minute = 59; |
| | | } |
| | | if (value.getFullYear() === year) { |
| | | month = boundary.getMonth() + 1; |
| | | if (value.getMonth() + 1 === month) { |
| | | date = boundary.getDate(); |
| | | if (value.getDate() === date) { |
| | | hour = boundary.getHours(); |
| | | if (value.getHours() === hour) { |
| | | minute = boundary.getMinutes(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return { |
| | | [`${type}Year`]: year, |
| | | [`${type}Month`]: month, |
| | | [`${type}Date`]: date, |
| | | [`${type}Hour`]: hour, |
| | | [`${type}Minute`]: minute, |
| | | }; |
| | | }, |
| | | onCancel() { |
| | | this.$emit('cancel'); |
| | | }, |
| | | onConfirm() { |
| | | this.$emit('confirm', this.data.innerValue); |
| | | }, |
| | | onChange() { |
| | | const { data } = this; |
| | | let value; |
| | | const picker = this.getPicker(); |
| | | const originColumns = this.getOriginColumns(); |
| | | if (data.type === 'time') { |
| | | const indexes = picker.getIndexes(); |
| | | value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1] |
| | | .values[indexes[1]]}`; |
| | | } else { |
| | | const indexes = picker.getIndexes(); |
| | | const values = indexes.map( |
| | | (value, index) => originColumns[index].values[value] |
| | | ); |
| | | const year = getTrueValue(values[0]); |
| | | const month = getTrueValue(values[1]); |
| | | const maxDate = getMonthEndDay(year, month); |
| | | let date = getTrueValue(values[2]); |
| | | if (data.type === 'year-month') { |
| | | date = 1; |
| | | } |
| | | date = date > maxDate ? maxDate : date; |
| | | let hour = 0; |
| | | let minute = 0; |
| | | if (data.type === 'datetime') { |
| | | hour = getTrueValue(values[3]); |
| | | minute = getTrueValue(values[4]); |
| | | } |
| | | value = new Date(year, month - 1, date, hour, minute); |
| | | } |
| | | value = this.correctValue(value); |
| | | this.updateColumnValue(value).then(() => { |
| | | this.$emit('input', value); |
| | | this.$emit('change', picker); |
| | | }); |
| | | }, |
| | | updateColumnValue(value) { |
| | | let values = []; |
| | | const { type } = this.data; |
| | | const formatter = this.data.formatter || defaultFormatter; |
| | | const picker = this.getPicker(); |
| | | if (type === 'time') { |
| | | const pair = value.split(':'); |
| | | values = [formatter('hour', pair[0]), formatter('minute', pair[1])]; |
| | | } else { |
| | | const date = new Date(value); |
| | | values = [ |
| | | formatter('year', `${date.getFullYear()}`), |
| | | formatter('month', padZero(date.getMonth() + 1)), |
| | | ]; |
| | | if (type === 'date') { |
| | | values.push(formatter('day', padZero(date.getDate()))); |
| | | } |
| | | if (type === 'datetime') { |
| | | values.push( |
| | | formatter('day', padZero(date.getDate())), |
| | | formatter('hour', padZero(date.getHours())), |
| | | formatter('minute', padZero(date.getMinutes())) |
| | | ); |
| | | } |
| | | } |
| | | return this.set({ innerValue: value }) |
| | | .then(() => this.updateColumns()) |
| | | .then(() => picker.setValues(values)); |
| | | }, |
| | | }, |
| | | created() { |
| | | const innerValue = this.correctValue(this.data.value); |
| | | this.updateColumnValue(innerValue).then(() => { |
| | | this.$emit('input', innerValue); |
| | | }); |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-picker": "../picker/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <van-picker |
| | | class="van-datetime-picker" |
| | | active-class="active-class" |
| | | toolbar-class="toolbar-class" |
| | | column-class="column-class" |
| | | title="{{ title }}" |
| | | columns="{{ columns }}" |
| | | item-height="{{ itemHeight }}" |
| | | show-toolbar="{{ showToolbar }}" |
| | | visible-item-count="{{ visibleItemCount }}" |
| | | confirm-button-text="{{ confirmButtonText }}" |
| | | cancel-button-text="{{ cancelButtonText }}" |
| | | bind:change="onChange" |
| | | bind:confirm="onConfirm" |
| | | bind:cancel="onCancel" |
| | | /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss'; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | interface VantComponentInstance { |
| | | parent: WechatMiniprogram.Component.TrivialInstance; |
| | | children: WechatMiniprogram.Component.TrivialInstance[]; |
| | | index: number; |
| | | $emit: ( |
| | | name: string, |
| | | detail?: unknown, |
| | | options?: WechatMiniprogram.Component.TriggerEventOption |
| | | ) => void; |
| | | } |
| | | export declare type VantComponentOptions< |
| | | Data extends WechatMiniprogram.Component.DataOption, |
| | | Props extends WechatMiniprogram.Component.PropertyOption, |
| | | Methods extends WechatMiniprogram.Component.MethodOption |
| | | > = { |
| | | data?: Data; |
| | | field?: boolean; |
| | | classes?: string[]; |
| | | mixins?: string[]; |
| | | props?: Props; |
| | | relation?: { |
| | | relations: Record<string, WechatMiniprogram.Component.RelationOption>; |
| | | mixin: string; |
| | | }; |
| | | methods?: Methods; |
| | | beforeCreate?: () => void; |
| | | created?: () => void; |
| | | mounted?: () => void; |
| | | destroyed?: () => void; |
| | | } & ThisType< |
| | | VantComponentInstance & |
| | | WechatMiniprogram.Component.Instance< |
| | | Data & { |
| | | name: string; |
| | | value: any; |
| | | }, |
| | | Props, |
| | | Methods |
| | | > & |
| | | Record<string, any> |
| | | >; |
| | | export {}; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | export declare type Action = 'confirm' | 'cancel' | 'overlay'; |
| | | interface DialogOptions { |
| | | lang?: string; |
| | | show?: boolean; |
| | | title?: string; |
| | | width?: string | number | null; |
| | | zIndex?: number; |
| | | theme?: string; |
| | | context?: |
| | | | WechatMiniprogram.Page.TrivialInstance |
| | | | WechatMiniprogram.Component.TrivialInstance; |
| | | message?: string; |
| | | overlay?: boolean; |
| | | selector?: string; |
| | | ariaLabel?: string; |
| | | className?: string; |
| | | customStyle?: string; |
| | | transition?: string; |
| | | /** |
| | | * @deprecated use beforeClose instead |
| | | */ |
| | | asyncClose?: boolean; |
| | | beforeClose?: null | ((action: Action) => Promise<void> | void); |
| | | businessId?: number; |
| | | sessionFrom?: string; |
| | | overlayStyle?: string; |
| | | appParameter?: string; |
| | | messageAlign?: string; |
| | | sendMessageImg?: string; |
| | | showMessageCard?: boolean; |
| | | sendMessagePath?: string; |
| | | sendMessageTitle?: string; |
| | | confirmButtonText?: string; |
| | | cancelButtonText?: string; |
| | | showConfirmButton?: boolean; |
| | | showCancelButton?: boolean; |
| | | closeOnClickOverlay?: boolean; |
| | | confirmButtonOpenType?: string; |
| | | } |
| | | declare const Dialog: { |
| | | (options: DialogOptions): Promise< |
| | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | >; |
| | | alert( |
| | | options: DialogOptions |
| | | ): Promise< |
| | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | >; |
| | | confirm( |
| | | options: DialogOptions |
| | | ): Promise< |
| | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | >; |
| | | close(): void; |
| | | stopLoading(): void; |
| | | currentOptions: DialogOptions; |
| | | defaultOptions: DialogOptions; |
| | | setDefaultOptions(options: DialogOptions): void; |
| | | resetDefaultOptions(): void; |
| | | }; |
| | | export default Dialog; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | let queue = []; |
| | | const defaultOptions = { |
| | | show: false, |
| | | title: '', |
| | | width: null, |
| | | theme: 'default', |
| | | message: '', |
| | | zIndex: 100, |
| | | overlay: true, |
| | | selector: '#van-dialog', |
| | | className: '', |
| | | asyncClose: false, |
| | | beforeClose: null, |
| | | transition: 'scale', |
| | | customStyle: '', |
| | | messageAlign: '', |
| | | overlayStyle: '', |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: 'åæ¶', |
| | | showConfirmButton: true, |
| | | showCancelButton: false, |
| | | closeOnClickOverlay: false, |
| | | confirmButtonOpenType: '', |
| | | }; |
| | | let currentOptions = Object.assign({}, defaultOptions); |
| | | function getContext() { |
| | | const pages = getCurrentPages(); |
| | | return pages[pages.length - 1]; |
| | | } |
| | | const Dialog = (options) => { |
| | | options = Object.assign(Object.assign({}, currentOptions), options); |
| | | return new Promise((resolve, reject) => { |
| | | const context = options.context || getContext(); |
| | | const dialog = context.selectComponent(options.selector); |
| | | delete options.context; |
| | | delete options.selector; |
| | | if (dialog) { |
| | | dialog.setData( |
| | | Object.assign( |
| | | { |
| | | callback: (action, instance) => { |
| | | action === 'confirm' ? resolve(instance) : reject(instance); |
| | | }, |
| | | }, |
| | | options |
| | | ) |
| | | ); |
| | | wx.nextTick(() => { |
| | | dialog.setData({ show: true }); |
| | | }); |
| | | queue.push(dialog); |
| | | } else { |
| | | console.warn( |
| | | 'æªæ¾å° van-dialog èç¹ï¼è¯·ç¡®è®¤ selector å context æ¯å¦æ£ç¡®' |
| | | ); |
| | | } |
| | | }); |
| | | }; |
| | | Dialog.alert = (options) => Dialog(options); |
| | | Dialog.confirm = (options) => |
| | | Dialog(Object.assign({ showCancelButton: true }, options)); |
| | | Dialog.close = () => { |
| | | queue.forEach((dialog) => { |
| | | dialog.close(); |
| | | }); |
| | | queue = []; |
| | | }; |
| | | Dialog.stopLoading = () => { |
| | | queue.forEach((dialog) => { |
| | | dialog.stopLoading(); |
| | | }); |
| | | }; |
| | | Dialog.currentOptions = currentOptions; |
| | | Dialog.defaultOptions = defaultOptions; |
| | | Dialog.setDefaultOptions = (options) => { |
| | | currentOptions = Object.assign(Object.assign({}, currentOptions), options); |
| | | Dialog.currentOptions = currentOptions; |
| | | }; |
| | | Dialog.resetDefaultOptions = () => { |
| | | currentOptions = Object.assign({}, defaultOptions); |
| | | Dialog.currentOptions = currentOptions; |
| | | }; |
| | | Dialog.resetDefaultOptions(); |
| | | export default Dialog; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { button } from '../mixins/button'; |
| | | import { openType } from '../mixins/open-type'; |
| | | import { GRAY, RED } from '../common/color'; |
| | | import { toPromise } from '../common/utils'; |
| | | VantComponent({ |
| | | mixins: [button, openType], |
| | | props: { |
| | | show: { |
| | | type: Boolean, |
| | | observer(show) { |
| | | !show && this.stopLoading(); |
| | | }, |
| | | }, |
| | | title: String, |
| | | message: String, |
| | | theme: { |
| | | type: String, |
| | | value: 'default', |
| | | }, |
| | | useSlot: Boolean, |
| | | className: String, |
| | | customStyle: String, |
| | | asyncClose: Boolean, |
| | | messageAlign: String, |
| | | beforeClose: null, |
| | | overlayStyle: String, |
| | | useTitleSlot: Boolean, |
| | | showCancelButton: Boolean, |
| | | closeOnClickOverlay: Boolean, |
| | | confirmButtonOpenType: String, |
| | | width: null, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 2000, |
| | | }, |
| | | confirmButtonText: { |
| | | type: String, |
| | | value: '确认', |
| | | }, |
| | | cancelButtonText: { |
| | | type: String, |
| | | value: 'åæ¶', |
| | | }, |
| | | confirmButtonColor: { |
| | | type: String, |
| | | value: RED, |
| | | }, |
| | | cancelButtonColor: { |
| | | type: String, |
| | | value: GRAY, |
| | | }, |
| | | showConfirmButton: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | overlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | transition: { |
| | | type: String, |
| | | value: 'scale', |
| | | }, |
| | | }, |
| | | data: { |
| | | loading: { |
| | | confirm: false, |
| | | cancel: false, |
| | | }, |
| | | callback: () => {}, |
| | | }, |
| | | methods: { |
| | | onConfirm() { |
| | | this.handleAction('confirm'); |
| | | }, |
| | | onCancel() { |
| | | this.handleAction('cancel'); |
| | | }, |
| | | onClickOverlay() { |
| | | this.close('overlay'); |
| | | }, |
| | | close(action) { |
| | | this.setData({ show: false }); |
| | | wx.nextTick(() => { |
| | | this.$emit('close', action); |
| | | const { callback } = this.data; |
| | | if (callback) { |
| | | callback(action, this); |
| | | } |
| | | }); |
| | | }, |
| | | stopLoading() { |
| | | this.setData({ |
| | | loading: { |
| | | confirm: false, |
| | | cancel: false, |
| | | }, |
| | | }); |
| | | }, |
| | | handleAction(action) { |
| | | this.$emit(action, { dialog: this }); |
| | | const { asyncClose, beforeClose } = this.data; |
| | | if (!asyncClose && !beforeClose) { |
| | | this.close(action); |
| | | return; |
| | | } |
| | | this.setData({ |
| | | [`loading.${action}`]: true, |
| | | }); |
| | | if (beforeClose) { |
| | | toPromise(beforeClose(action)).then((value) => { |
| | | if (value) { |
| | | this.close(action); |
| | | } else { |
| | | this.stopLoading(); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-popup": "../popup/index", |
| | | "van-button": "../button/index", |
| | | "van-goods-action": "../goods-action/index", |
| | | "van-goods-action-button": "../goods-action-button/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <van-popup |
| | | show="{{ show }}" |
| | | z-index="{{ zIndex }}" |
| | | overlay="{{ overlay }}" |
| | | transition="{{ transition }}" |
| | | custom-class="van-dialog van-dialog--{{ theme }} {{ className }}" |
| | | custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}" |
| | | overlay-style="{{ overlayStyle }}" |
| | | close-on-click-overlay="{{ closeOnClickOverlay }}" |
| | | bind:close="onClickOverlay" |
| | | > |
| | | <view |
| | | wx:if="{{ title || useTitleSlot }}" |
| | | class="{{ utils.bem('dialog__header', { isolated: !(message || useSlot) }) }}" |
| | | > |
| | | <slot wx:if="{{ useTitleSlot }}" name="title" /> |
| | | <block wx:elif="{{ title }}">{{ title }}</block> |
| | | </view> |
| | | |
| | | <slot wx:if="{{ useSlot }}" /> |
| | | <view |
| | | wx:elif="{{ message }}" |
| | | class="{{ utils.bem('dialog__message', [theme, messageAlign, { hasTitle: title }]) }}" |
| | | > |
| | | <text class="van-dialog__message-text">{{ message }}</text> |
| | | </view> |
| | | |
| | | <van-goods-action wx:if="{{ theme === 'round-button' }}" custom-class="van-dialog__footer--round-button"> |
| | | <van-goods-action-button |
| | | wx:if="{{ showCancelButton }}" |
| | | size="large" |
| | | loading="{{ loading.cancel }}" |
| | | class="van-dialog__button van-hairline--right" |
| | | custom-class="van-dialog__cancel" |
| | | custom-style="color: {{ cancelButtonColor }}" |
| | | bind:click="onCancel" |
| | | > |
| | | {{ cancelButtonText }} |
| | | </van-goods-action-button> |
| | | <van-goods-action-button |
| | | wx:if="{{ showConfirmButton }}" |
| | | size="large" |
| | | class="van-dialog__button" |
| | | loading="{{ loading.confirm }}" |
| | | custom-class="van-dialog__confirm" |
| | | custom-style="color: {{ confirmButtonColor }}" |
| | | |
| | | open-type="{{ confirmButtonOpenType }}" |
| | | lang="{{ lang }}" |
| | | business-id="{{ businessId }}" |
| | | session-from="{{ sessionFrom }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | app-parameter="{{ appParameter }}" |
| | | |
| | | bind:click="onConfirm" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindcontact="bindContact" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | binderror="bindError" |
| | | bindlaunchapp="bindLaunchApp" |
| | | bindopensetting="bindOpenSetting" |
| | | > |
| | | {{ confirmButtonText }} |
| | | </van-goods-action-button> |
| | | </van-goods-action> |
| | | |
| | | <view wx:else class="van-hairline--top van-dialog__footer"> |
| | | <van-button |
| | | wx:if="{{ showCancelButton }}" |
| | | size="large" |
| | | loading="{{ loading.cancel }}" |
| | | class="van-dialog__button van-hairline--right" |
| | | custom-class="van-dialog__cancel" |
| | | custom-style="color: {{ cancelButtonColor }}" |
| | | bind:click="onCancel" |
| | | > |
| | | {{ cancelButtonText }} |
| | | </van-button> |
| | | <van-button |
| | | wx:if="{{ showConfirmButton }}" |
| | | size="large" |
| | | class="van-dialog__button" |
| | | loading="{{ loading.confirm }}" |
| | | custom-class="van-dialog__confirm" |
| | | custom-style="color: {{ confirmButtonColor }}" |
| | | |
| | | open-type="{{ confirmButtonOpenType }}" |
| | | lang="{{ lang }}" |
| | | business-id="{{ businessId }}" |
| | | session-from="{{ sessionFrom }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | app-parameter="{{ appParameter }}" |
| | | |
| | | bind:click="onConfirm" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindcontact="bindContact" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | binderror="bindError" |
| | | bindlaunchapp="bindLaunchApp" |
| | | bindopensetting="bindOpenSetting" |
| | | > |
| | | {{ confirmButtonText }} |
| | | </van-button> |
| | | </view> |
| | | </van-popup> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-dialog{top:45%!important;overflow:hidden;width:320px;width:var(--dialog-width,320px);font-size:16px;font-size:var(--dialog-font-size,16px);border-radius:16px;border-radius:var(--dialog-border-radius,16px);background-color:#fff;background-color:var(--dialog-background-color,#fff)}@media (max-width:321px){.van-dialog{width:90%;width:var(--dialog-small-screen-width,90%)}}.van-dialog__header{text-align:center;padding-top:24px;padding-top:var(--dialog-header-padding-top,24px);font-weight:500;font-weight:var(--dialog-header-font-weight,500);line-height:24px;line-height:var(--dialog-header-line-height,24px)}.van-dialog__header--isolated{padding:24px 0;padding:var(--dialog-header-isolated-padding,24px 0)}.van-dialog__message{overflow-y:auto;text-align:center;-webkit-overflow-scrolling:touch;font-size:14px;font-size:var(--dialog-message-font-size,14px);line-height:20px;line-height:var(--dialog-message-line-height,20px);max-height:60vh;max-height:var(--dialog-message-max-height,60vh);padding:24px;padding:var(--dialog-message-padding,24px)}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--hasTitle{padding-top:8px;padding-top:var(--dialog-has-title-message-padding-top,8px);color:#646566;color:var(--dialog-has-title-message-text-color,#646566)}.van-dialog__message--round-button{padding-bottom:16px;color:#323233}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__footer--round-button{position:relative!important;padding:8px 24px 16px!important}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | dashed: Boolean, |
| | | hairline: Boolean, |
| | | contentPosition: String, |
| | | fontSize: String, |
| | | borderColor: String, |
| | | textColor: String, |
| | | customStyle: String, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": {} |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('divider', [{ dashed, hairline }, contentPosition]) }}" |
| | | style="{{ computed.rootStyle({ borderColor, textColor, fontSize, customStyle }) }}" |
| | | > |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style([ |
| | | { |
| | | 'border-color': data.borderColor, |
| | | color: data.textColor, |
| | | 'font-size': addUnit(data.fontSize), |
| | | }, |
| | | data.customStyle, |
| | | ]); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-divider{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;margin:16px 0;margin:var(--divider-margin,16px 0);color:#969799;color:var(--divider-text-color,#969799);font-size:14px;font-size:var(--divider-font-size,14px);line-height:24px;line-height:var(--divider-line-height,24px);border:0 solid #ebedf0;border-color:var(--divider-border-color,#ebedf0)}.van-divider:after,.van-divider:before{display:block;-webkit-flex:1;flex:1;box-sizing:border-box;height:1px;border-color:inherit;border-style:inherit;border-width:1px 0 0}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:16px;margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:16px;margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:10%;max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:10%;max-width:var(--divider-content-right-width,10%)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { useParent } from '../common/relation'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useParent('dropdown-menu', function () { |
| | | this.updateDataFromParent(); |
| | | }), |
| | | props: { |
| | | value: { |
| | | type: null, |
| | | observer: 'rerender', |
| | | }, |
| | | title: { |
| | | type: String, |
| | | observer: 'rerender', |
| | | }, |
| | | disabled: Boolean, |
| | | titleClass: { |
| | | type: String, |
| | | observer: 'rerender', |
| | | }, |
| | | options: { |
| | | type: Array, |
| | | value: [], |
| | | observer: 'rerender', |
| | | }, |
| | | popupStyle: String, |
| | | }, |
| | | data: { |
| | | transition: true, |
| | | showPopup: false, |
| | | showWrapper: false, |
| | | displayTitle: '', |
| | | }, |
| | | methods: { |
| | | rerender() { |
| | | wx.nextTick(() => { |
| | | var _a; |
| | | (_a = this.parent) === null || _a === void 0 |
| | | ? void 0 |
| | | : _a.updateItemListData(); |
| | | }); |
| | | }, |
| | | updateDataFromParent() { |
| | | if (this.parent) { |
| | | const { |
| | | overlay, |
| | | duration, |
| | | activeColor, |
| | | closeOnClickOverlay, |
| | | direction, |
| | | } = this.parent.data; |
| | | this.setData({ |
| | | overlay, |
| | | duration, |
| | | activeColor, |
| | | closeOnClickOverlay, |
| | | direction, |
| | | }); |
| | | } |
| | | }, |
| | | onOpen() { |
| | | this.$emit('open'); |
| | | }, |
| | | onOpened() { |
| | | this.$emit('opened'); |
| | | }, |
| | | onClose() { |
| | | this.$emit('close'); |
| | | }, |
| | | onClosed() { |
| | | this.$emit('closed'); |
| | | this.setData({ showWrapper: false }); |
| | | }, |
| | | onOptionTap(event) { |
| | | const { option } = event.currentTarget.dataset; |
| | | const { value } = option; |
| | | const shouldEmitChange = this.data.value !== value; |
| | | this.setData({ showPopup: false, value }); |
| | | this.$emit('close'); |
| | | this.rerender(); |
| | | if (shouldEmitChange) { |
| | | this.$emit('change', value); |
| | | } |
| | | }, |
| | | toggle(show, options = {}) { |
| | | var _a; |
| | | const { showPopup } = this.data; |
| | | if (typeof show !== 'boolean') { |
| | | show = !showPopup; |
| | | } |
| | | if (show === showPopup) { |
| | | return; |
| | | } |
| | | this.setData({ |
| | | transition: !options.immediate, |
| | | showPopup: show, |
| | | }); |
| | | if (show) { |
| | | (_a = this.parent) === null || _a === void 0 |
| | | ? void 0 |
| | | : _a.getChildWrapperStyle().then((wrapperStyle) => { |
| | | this.setData({ wrapperStyle, showWrapper: true }); |
| | | this.rerender(); |
| | | }); |
| | | } else { |
| | | this.rerender(); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-popup": "../popup/index", |
| | | "van-cell": "../cell/index", |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | wx:if="{{ showWrapper }}" |
| | | class="{{ utils.bem('dropdown-item', direction) }}" |
| | | style="{{ wrapperStyle }}" |
| | | > |
| | | <van-popup |
| | | show="{{ showPopup }}" |
| | | custom-style="position: absolute;{{ popupStyle }}" |
| | | overlay-style="position: absolute;" |
| | | overlay="{{ overlay }}" |
| | | position="{{ direction === 'down' ? 'top' : 'bottom' }}" |
| | | duration="{{ transition ? duration : 0 }}" |
| | | close-on-click-overlay="{{ closeOnClickOverlay }}" |
| | | bind:enter="onOpen" |
| | | bind:leave="onClose" |
| | | bind:close="toggle" |
| | | bind:after-enter="onOpened" |
| | | bind:after-leave="onClosed" |
| | | > |
| | | <van-cell |
| | | wx:for="{{ options }}" |
| | | wx:key="value" |
| | | data-option="{{ item }}" |
| | | class="{{ utils.bem('dropdown-item__option', { active: item.value === value } ) }}" |
| | | clickable |
| | | icon="{{ item.icon }}" |
| | | bind:tap="onOptionTap" |
| | | > |
| | | <view |
| | | slot="title" |
| | | class="van-dropdown-item__title" |
| | | style="{{ item.value === value ? 'color:' + activeColor : '' }}" |
| | | > |
| | | {{ item.text }} |
| | | </view> |
| | | <van-icon |
| | | wx:if="{{ item.value === value }}" |
| | | name="success" |
| | | class="van-dropdown-item__icon" |
| | | color="{{ activeColor }}" |
| | | /> |
| | | </van-cell> |
| | | |
| | | <slot /> |
| | | </van-popup> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-dropdown-item{position:fixed;right:0;left:0;overflow:hidden}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active .van-dropdown-item__icon,.van-dropdown-item__option--active .van-dropdown-item__title{color:#ee0a24;color:var(--dropdown-menu-option-active-color,#ee0a24)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__icon{display:block;line-height:inherit} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface Option { |
| | | text: string; |
| | | value: string | number; |
| | | icon: string; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | import { addUnit, getRect, getSystemInfoSync } from '../common/utils'; |
| | | let ARRAY = []; |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useChildren('dropdown-item', function () { |
| | | this.updateItemListData(); |
| | | }), |
| | | props: { |
| | | activeColor: { |
| | | type: String, |
| | | observer: 'updateChildrenData', |
| | | }, |
| | | overlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | observer: 'updateChildrenData', |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 10, |
| | | }, |
| | | duration: { |
| | | type: Number, |
| | | value: 200, |
| | | observer: 'updateChildrenData', |
| | | }, |
| | | direction: { |
| | | type: String, |
| | | value: 'down', |
| | | observer: 'updateChildrenData', |
| | | }, |
| | | closeOnClickOverlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | observer: 'updateChildrenData', |
| | | }, |
| | | closeOnClickOutside: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | itemListData: [], |
| | | }, |
| | | beforeCreate() { |
| | | const { windowHeight } = getSystemInfoSync(); |
| | | this.windowHeight = windowHeight; |
| | | ARRAY.push(this); |
| | | }, |
| | | destroyed() { |
| | | ARRAY = ARRAY.filter((item) => item !== this); |
| | | }, |
| | | methods: { |
| | | updateItemListData() { |
| | | this.setData({ |
| | | itemListData: this.children.map((child) => child.data), |
| | | }); |
| | | }, |
| | | updateChildrenData() { |
| | | this.children.forEach((child) => { |
| | | child.updateDataFromParent(); |
| | | }); |
| | | }, |
| | | toggleItem(active) { |
| | | this.children.forEach((item, index) => { |
| | | const { showPopup } = item.data; |
| | | if (index === active) { |
| | | item.toggle(); |
| | | } else if (showPopup) { |
| | | item.toggle(false, { immediate: true }); |
| | | } |
| | | }); |
| | | }, |
| | | close() { |
| | | this.children.forEach((child) => { |
| | | child.toggle(false, { immediate: true }); |
| | | }); |
| | | }, |
| | | getChildWrapperStyle() { |
| | | const { zIndex, direction } = this.data; |
| | | return getRect(this, '.van-dropdown-menu').then((rect) => { |
| | | const { top = 0, bottom = 0 } = rect; |
| | | const offset = direction === 'down' ? bottom : this.windowHeight - top; |
| | | let wrapperStyle = `z-index: ${zIndex};`; |
| | | if (direction === 'down') { |
| | | wrapperStyle += `top: ${addUnit(offset)};`; |
| | | } else { |
| | | wrapperStyle += `bottom: ${addUnit(offset)};`; |
| | | } |
| | | return wrapperStyle; |
| | | }); |
| | | }, |
| | | onTitleTap(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const child = this.children[index]; |
| | | if (!child.data.disabled) { |
| | | ARRAY.forEach((menuItem) => { |
| | | if ( |
| | | menuItem && |
| | | menuItem.data.closeOnClickOutside && |
| | | menuItem !== this |
| | | ) { |
| | | menuItem.close(); |
| | | } |
| | | }); |
| | | this.toggleItem(index); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="van-dropdown-menu van-dropdown-menu--top-bottom"> |
| | | <view |
| | | wx:for="{{ itemListData }}" |
| | | wx:key="index" |
| | | data-index="{{ index }}" |
| | | class="{{ utils.bem('dropdown-menu__item', { disabled: item.disabled }) }}" |
| | | bind:tap="onTitleTap" |
| | | > |
| | | <view |
| | | class="{{ item.titleClass }} {{ utils.bem('dropdown-menu__title', { active: item.showPopup, down: item.showPopup === (direction === 'down') }) }}" |
| | | style="{{ item.showPopup ? 'color:' + activeColor : '' }}" |
| | | > |
| | | <view class="van-ellipsis"> |
| | | {{ computed.displayTitle(item) }} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | function displayTitle(item) { |
| | | if (item.title) { |
| | | return item.title; |
| | | } |
| | | |
| | | var match = item.options.filter(function(option) { |
| | | return option.value === item.value; |
| | | }); |
| | | var displayTitle = match.length ? match[0].text : ''; |
| | | return displayTitle; |
| | | } |
| | | |
| | | module.exports = { |
| | | displayTitle: displayTitle |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-dropdown-menu{display:-webkit-flex;display:flex;box-shadow:0 2px 12px rgba(100,101,102,.12);-webkit-user-select:none;user-select:none;height:50px;height:var(--dropdown-menu-height,50px);background-color:#fff;background-color:var(--dropdown-menu-background-color,#fff)}.van-dropdown-menu__item{display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;min-width:0}.van-dropdown-menu__item:active{opacity:.7}.van-dropdown-menu__item--disabled:active{opacity:1}.van-dropdown-menu__item--disabled .van-dropdown-menu__title{color:#969799;color:var(--dropdown-menu-title-disabled-text-color,#969799)}.van-dropdown-menu__title{position:relative;box-sizing:border-box;max-width:100%;padding:0 8px;padding:var(--dropdown-menu-title-padding,0 8px);color:#323233;color:var(--dropdown-menu-title-text-color,#323233);font-size:15px;font-size:var(--dropdown-menu-title-font-size,15px);line-height:18px;line-height:var(--dropdown-menu-title-line-height,18px)}.van-dropdown-menu__title:after{position:absolute;top:50%;right:-4px;margin-top:-5px;border-color:transparent transparent currentcolor currentcolor;border-style:solid;border-width:3px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);opacity:.8;content:""}.van-dropdown-menu__title--active{color:#ee0a24;color:var(--dropdown-menu-title-active-text-color,#ee0a24)}.van-dropdown-menu__title--down:after{margin-top:-1px;-webkit-transform:rotate(135deg);transform:rotate(135deg)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | description: String, |
| | | image: { |
| | | type: String, |
| | | value: 'default', |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": {} |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="custom-class van-empty"> |
| | | <view class="van-empty__image"> |
| | | <slot name="image"></slot> |
| | | </view> |
| | | <view class="van-empty__image"> |
| | | <image wx:if="{{ image }}" class="van-empty__image__img" src="{{ computed.imageUrl(image) }}" /> |
| | | </view> |
| | | |
| | | <view class="van-empty__description"> |
| | | <slot name="description"></slot> |
| | | </view> |
| | | <view class="van-empty__description"> |
| | | {{ description }} |
| | | </view> |
| | | |
| | | <view class="van-empty__bottom"> |
| | | <slot></slot> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var PRESETS = ['error', 'search', 'default', 'network']; |
| | | |
| | | function imageUrl(image) { |
| | | if (PRESETS.indexOf(image) !== -1) { |
| | | return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png'; |
| | | } |
| | | |
| | | return image; |
| | | } |
| | | |
| | | module.exports = { |
| | | imageUrl: imageUrl, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-empty{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:32px 0}.van-empty__image{width:160px;height:160px}.van-empty__image:empty{display:none}.van-empty__image__img{width:100%;height:100%}.van-empty__image:not(:empty)+.van-empty__image{display:none}.van-empty__description{margin-top:16px;padding:0 60px;color:#969799;font-size:14px;line-height:20px}.van-empty__description:empty,.van-empty__description:not(:empty)+.van-empty__description{display:none}.van-empty__bottom{margin-top:24px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { nextTick } from '../common/utils'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { commonProps, inputProps, textareaProps } from './props'; |
| | | VantComponent({ |
| | | field: true, |
| | | classes: ['input-class', 'right-icon-class', 'label-class'], |
| | | props: Object.assign( |
| | | Object.assign( |
| | | Object.assign(Object.assign({}, commonProps), inputProps), |
| | | textareaProps |
| | | ), |
| | | { |
| | | size: String, |
| | | icon: String, |
| | | label: String, |
| | | error: Boolean, |
| | | center: Boolean, |
| | | isLink: Boolean, |
| | | leftIcon: String, |
| | | rightIcon: String, |
| | | autosize: null, |
| | | required: Boolean, |
| | | iconClass: String, |
| | | clickable: Boolean, |
| | | inputAlign: String, |
| | | customStyle: String, |
| | | errorMessage: String, |
| | | arrowDirection: String, |
| | | showWordLimit: Boolean, |
| | | errorMessageAlign: String, |
| | | readonly: { |
| | | type: Boolean, |
| | | observer: 'setShowClear', |
| | | }, |
| | | clearable: { |
| | | type: Boolean, |
| | | observer: 'setShowClear', |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | titleWidth: { |
| | | type: String, |
| | | value: '6.2em', |
| | | }, |
| | | } |
| | | ), |
| | | data: { |
| | | focused: false, |
| | | innerValue: '', |
| | | showClear: false, |
| | | }, |
| | | created() { |
| | | this.value = this.data.value; |
| | | this.setData({ innerValue: this.value }); |
| | | }, |
| | | methods: { |
| | | onInput(event) { |
| | | const { value = '' } = event.detail || {}; |
| | | this.value = value; |
| | | this.setShowClear(); |
| | | this.emitChange(); |
| | | }, |
| | | onFocus(event) { |
| | | this.focused = true; |
| | | this.setShowClear(); |
| | | this.$emit('focus', event.detail); |
| | | }, |
| | | onBlur(event) { |
| | | this.focused = false; |
| | | this.setShowClear(); |
| | | this.$emit('blur', event.detail); |
| | | }, |
| | | onClickIcon() { |
| | | this.$emit('click-icon'); |
| | | }, |
| | | onClickInput(event) { |
| | | this.$emit('click-input', event.detail); |
| | | }, |
| | | onClear() { |
| | | this.setData({ innerValue: '' }); |
| | | this.value = ''; |
| | | this.setShowClear(); |
| | | nextTick(() => { |
| | | this.emitChange(); |
| | | this.$emit('clear', ''); |
| | | }); |
| | | }, |
| | | onConfirm(event) { |
| | | const { value = '' } = event.detail || {}; |
| | | this.value = value; |
| | | this.setShowClear(); |
| | | this.$emit('confirm', value); |
| | | }, |
| | | setValue(value) { |
| | | this.value = value; |
| | | this.setShowClear(); |
| | | if (value === '') { |
| | | this.setData({ innerValue: '' }); |
| | | } |
| | | this.emitChange(); |
| | | }, |
| | | onLineChange(event) { |
| | | this.$emit('linechange', event.detail); |
| | | }, |
| | | onKeyboardHeightChange(event) { |
| | | this.$emit('keyboardheightchange', event.detail); |
| | | }, |
| | | emitChange() { |
| | | this.setData({ value: this.value }); |
| | | nextTick(() => { |
| | | this.$emit('input', this.value); |
| | | this.$emit('change', this.value); |
| | | }); |
| | | }, |
| | | setShowClear() { |
| | | const { clearable, readonly } = this.data; |
| | | const { focused, value } = this; |
| | | this.setData({ |
| | | showClear: !!clearable && !!focused && !!value && !readonly, |
| | | }); |
| | | }, |
| | | noop() {}, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-cell": "../cell/index", |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <van-cell |
| | | size="{{ size }}" |
| | | icon="{{ leftIcon }}" |
| | | center="{{ center }}" |
| | | border="{{ border }}" |
| | | is-link="{{ isLink }}" |
| | | required="{{ required }}" |
| | | clickable="{{ clickable }}" |
| | | title-width="{{ titleWidth }}" |
| | | title-style="margin-right: 12px;" |
| | | custom-style="{{ customStyle }}" |
| | | arrow-direction="{{ arrowDirection }}" |
| | | custom-class="van-field" |
| | | > |
| | | <slot name="left-icon" slot="icon" /> |
| | | <view wx:if="{{ label }}" class="label-class {{ utils.bem('field__label', { disabled }) }}" slot="title"> |
| | | {{ label }} |
| | | </view> |
| | | <slot wx:else name="label" slot="title" /> |
| | | <view class="{{ utils.bem('field__body', [type]) }}"> |
| | | <view class="{{ utils.bem('field__control', [inputAlign, 'custom']) }}" bindtap="onClickInput"> |
| | | <slot name="input" /> |
| | | </view> |
| | | <include wx:if="{{ type === 'textarea' }}" src="textarea.wxml" /> |
| | | <include wx:else src="input.wxml" /> |
| | | |
| | | <van-icon |
| | | wx:if="{{ showClear }}" |
| | | name="clear" |
| | | class="van-field__clear-root van-field__icon-root" |
| | | catch:touchstart="onClear" |
| | | /> |
| | | <view class="van-field__icon-container" bind:tap="onClickIcon"> |
| | | <van-icon |
| | | wx:if="{{ rightIcon || icon }}" |
| | | name="{{ rightIcon || icon }}" |
| | | class="van-field__icon-root {{ iconClass }}" |
| | | custom-class="right-icon-class" |
| | | /> |
| | | <slot name="right-icon" /> |
| | | <slot name="icon" /> |
| | | </view> |
| | | <view class="van-field__button"> |
| | | <slot name="button" /> |
| | | </view> |
| | | </view> |
| | | <view wx:if="{{ showWordLimit && maxlength }}" class="van-field__word-limit"> |
| | | <view class="{{ utils.bem('field__word-num', { full: value.length >= maxlength }) }}">{{ value.length >= maxlength ? maxlength : value.length }}</view>/{{ maxlength }} |
| | | </view> |
| | | <view wx:if="{{ errorMessage }}" class="{{ utils.bem('field__error-message', [errorMessageAlign, { disabled, error }]) }}"> |
| | | {{ errorMessage }} |
| | | </view> |
| | | </van-cell> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function inputStyle(autosize) { |
| | | if (autosize && autosize.constructor === 'Object') { |
| | | return style({ |
| | | 'min-height': addUnit(autosize.minHeight), |
| | | 'max-height': addUnit(autosize.maxHeight), |
| | | }); |
| | | } |
| | | |
| | | return ''; |
| | | } |
| | | |
| | | module.exports = { |
| | | inputStyle: inputStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-field{--cell-icon-size:16px;--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:#646566;color:var(--field-label-color,#646566)}.van-field__label--disabled{color:#c8c9cc;color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{box-sizing:border-box;padding:3.6px 0;line-height:1.2em;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty+.van-field__control{display:block}.van-field__control{position:relative;display:none;box-sizing:border-box;width:100%;margin:0;padding:0;line-height:inherit;text-align:left;background-color:initial;border:0;resize:none;color:#323233;color:var(--field-input-text-color,#323233);height:24px;height:var(--cell-line-height,24px);min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty{display:none}.van-field__control--textarea{height:18px;height:var(--field-text-area-min-height,18px);min-height:18px;min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:#ee0a24;color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;opacity:1;color:#c8c9cc;color:var(--field-input-disabled-text-color,#c8c9cc)}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__placeholder{position:absolute;top:0;right:0;left:0;pointer-events:none;color:#c8c9cc;color:var(--field-placeholder-text-color,#c8c9cc)}.van-field__placeholder--error{color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;vertical-align:middle;padding:0 8px;padding:0 var(--padding-xs,8px);margin-right:-8px;margin-right:-var(--padding-xs,8px)}.van-field__button,.van-field__clear-root,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear-root{font-size:16px;font-size:var(--field-clear-icon-size,16px);color:#c8c9cc;color:var(--field-clear-icon-color,#c8c9cc)}.van-field__icon-container{font-size:16px;font-size:var(--field-icon-size,16px);color:#969799;color:var(--field-icon-container-color,#969799)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:8px;padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{text-align:left;font-size:12px;font-size:var(--field-error-message-text-font-size,12px);color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{text-align:right;margin-top:4px;margin-top:var(--padding-base,4px);color:#646566;color:var(--field-word-limit-color,#646566);font-size:12px;font-size:var(--field-word-limit-font-size,12px);line-height:16px;line-height:var(--field-word-limit-line-height,16px)}.van-field__word-num{display:inline}.van-field__word-num--full{color:#ee0a24;color:var(--field-word-num-full-color,#ee0a24)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <input |
| | | class="{{ utils.bem('field__control', [inputAlign, { disabled, error }]) }} input-class" |
| | | type="{{ type }}" |
| | | focus="{{ focus }}" |
| | | cursor="{{ cursor }}" |
| | | value="{{ innerValue }}" |
| | | auto-focus="{{ autoFocus }}" |
| | | disabled="{{ disabled || readonly }}" |
| | | maxlength="{{ maxlength }}" |
| | | placeholder="{{ placeholder }}" |
| | | placeholder-style="{{ placeholderStyle }}" |
| | | placeholder-class="{{ utils.bem('field__placeholder', { error }) }}" |
| | | confirm-type="{{ confirmType }}" |
| | | confirm-hold="{{ confirmHold }}" |
| | | hold-keyboard="{{ holdKeyboard }}" |
| | | cursor-spacing="{{ cursorSpacing }}" |
| | | adjust-position="{{ adjustPosition }}" |
| | | selection-end="{{ selectionEnd }}" |
| | | selection-start="{{ selectionStart }}" |
| | | password="{{ password || type === 'password' }}" |
| | | bindinput="onInput" |
| | | bindtap="onClickInput" |
| | | bindblur="onBlur" |
| | | bindfocus="onFocus" |
| | | bindconfirm="onConfirm" |
| | | bindkeyboardheightchange="onKeyboardHeightChange" |
| | | /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | export declare const commonProps: WechatMiniprogram.Component.PropertyOption; |
| | | export declare const inputProps: WechatMiniprogram.Component.PropertyOption; |
| | | export declare const textareaProps: WechatMiniprogram.Component.PropertyOption; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const commonProps = { |
| | | value: { |
| | | type: String, |
| | | observer(value) { |
| | | if (value !== this.value) { |
| | | this.setData({ innerValue: value }); |
| | | this.value = value; |
| | | } |
| | | }, |
| | | }, |
| | | placeholder: String, |
| | | placeholderStyle: String, |
| | | placeholderClass: String, |
| | | disabled: Boolean, |
| | | maxlength: { |
| | | type: Number, |
| | | value: -1, |
| | | }, |
| | | cursorSpacing: { |
| | | type: Number, |
| | | value: 50, |
| | | }, |
| | | autoFocus: Boolean, |
| | | focus: Boolean, |
| | | cursor: { |
| | | type: Number, |
| | | value: -1, |
| | | }, |
| | | selectionStart: { |
| | | type: Number, |
| | | value: -1, |
| | | }, |
| | | selectionEnd: { |
| | | type: Number, |
| | | value: -1, |
| | | }, |
| | | adjustPosition: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | holdKeyboard: Boolean, |
| | | }; |
| | | export const inputProps = { |
| | | type: { |
| | | type: String, |
| | | value: 'text', |
| | | }, |
| | | password: Boolean, |
| | | confirmType: String, |
| | | confirmHold: Boolean, |
| | | }; |
| | | export const textareaProps = { |
| | | autoHeight: Boolean, |
| | | fixed: Boolean, |
| | | showConfirmBar: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | disableDefaultPadding: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <textarea |
| | | class="{{ utils.bem('field__control', [inputAlign, type, { disabled, error }]) }} input-class" |
| | | fixed="{{ fixed }}" |
| | | focus="{{ focus }}" |
| | | cursor="{{ cursor }}" |
| | | value="{{ innerValue }}" |
| | | auto-focus="{{ autoFocus }}" |
| | | disabled="{{ disabled || readonly }}" |
| | | maxlength="{{ maxlength }}" |
| | | placeholder="{{ placeholder }}" |
| | | placeholder-style="{{ placeholderStyle }}" |
| | | placeholder-class="{{ utils.bem('field__placeholder', { error, disabled }) }}" |
| | | auto-height="{{ !!autosize }}" |
| | | style="{{ computed.inputStyle(autosize) }}" |
| | | cursor-spacing="{{ cursorSpacing }}" |
| | | adjust-position="{{ adjustPosition }}" |
| | | show-confirm-bar="{{ showConfirmBar }}" |
| | | hold-keyboard="{{ holdKeyboard }}" |
| | | selection-end="{{ selectionEnd }}" |
| | | selection-start="{{ selectionStart }}" |
| | | disable-default-padding="{{ disableDefaultPadding }}" |
| | | bindinput="onInput" |
| | | bindtap="onClickInput" |
| | | bindblur="onBlur" |
| | | bindfocus="onFocus" |
| | | bindconfirm="onConfirm" |
| | | bindlinechange="onLineChange" |
| | | bindkeyboardheightchange="onKeyboardHeightChange" |
| | | /> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | import { button } from '../mixins/button'; |
| | | import { link } from '../mixins/link'; |
| | | import { openType } from '../mixins/open-type'; |
| | | VantComponent({ |
| | | mixins: [link, button, openType], |
| | | relation: useParent('goods-action'), |
| | | props: { |
| | | text: String, |
| | | color: String, |
| | | loading: Boolean, |
| | | disabled: Boolean, |
| | | plain: Boolean, |
| | | type: { |
| | | type: String, |
| | | value: 'danger', |
| | | }, |
| | | }, |
| | | methods: { |
| | | onClick(event) { |
| | | this.$emit('click', event.detail); |
| | | this.jumpLink(); |
| | | }, |
| | | updateStyle() { |
| | | if (this.parent == null) { |
| | | return; |
| | | } |
| | | const { index } = this; |
| | | const { children = [] } = this.parent; |
| | | this.setData({ |
| | | isFirst: index === 0, |
| | | isLast: index === children.length - 1, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-button": "../button/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <van-button |
| | | id="{{ id }}" |
| | | lang="{{ lang }}" |
| | | type="{{ type }}" |
| | | color="{{ color }}" |
| | | plain="{{ plain }}" |
| | | loading="{{ loading }}" |
| | | disabled="{{ disabled }}" |
| | | open-type="{{ openType }}" |
| | | class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}" |
| | | custom-class="van-goods-action-button__inner" |
| | | business-id="{{ businessId }}" |
| | | session-from="{{ sessionFrom }}" |
| | | app-parameter="{{ appParameter }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | bind:click="onClick" |
| | | binderror="bindError" |
| | | bindcontact="bindContact" |
| | | bindopensetting="bindOpenSetting" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | bindlaunchapp="bindLaunchApp" |
| | | > |
| | | {{ text }} |
| | | <slot></slot> |
| | | </van-button> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:20px;--button-line-height:var(--goods-action-button-line-height,20px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--first.van-goods-action-button--last{--button-border-radius:20px;--button-border-radius:var(--goods-action-button-border-radius,20px)}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { button } from '../mixins/button'; |
| | | import { link } from '../mixins/link'; |
| | | import { openType } from '../mixins/open-type'; |
| | | VantComponent({ |
| | | classes: ['icon-class', 'text-class'], |
| | | mixins: [link, button, openType], |
| | | props: { |
| | | text: String, |
| | | dot: Boolean, |
| | | info: String, |
| | | icon: String, |
| | | disabled: Boolean, |
| | | loading: Boolean, |
| | | }, |
| | | methods: { |
| | | onClick(event) { |
| | | this.$emit('click', event.detail); |
| | | this.jumpLink(); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-button": "../button/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <van-button |
| | | square |
| | | id="{{ id }}" |
| | | size="large" |
| | | lang="{{ lang }}" |
| | | loading="{{ loading }}" |
| | | disabled="{{ disabled }}" |
| | | open-type="{{ openType }}" |
| | | business-id="{{ businessId }}" |
| | | custom-class="van-goods-action-icon" |
| | | session-from="{{ sessionFrom }}" |
| | | app-parameter="{{ appParameter }}" |
| | | send-message-img="{{ sendMessageImg }}" |
| | | send-message-path="{{ sendMessagePath }}" |
| | | show-message-card="{{ showMessageCard }}" |
| | | send-message-title="{{ sendMessageTitle }}" |
| | | bind:click="onClick" |
| | | binderror="bindError" |
| | | bindcontact="bindContact" |
| | | bindopensetting="bindOpenSetting" |
| | | bindgetuserinfo="bindGetUserInfo" |
| | | bindgetphonenumber="bindGetPhoneNumber" |
| | | bindlaunchapp="bindLaunchApp" |
| | | > |
| | | <van-icon |
| | | wx:if="{{ icon }}" |
| | | name="{{ icon }}" |
| | | dot="{{ dot }}" |
| | | info="{{ info }}" |
| | | class="van-goods-action-icon__icon" |
| | | custom-class="icon-class" |
| | | /> |
| | | <slot wx:else name="icon" /> |
| | | <text class="text-class">{{ text }}</text> |
| | | </van-button> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-goods-action-icon{display:-webkit-flex!important;display:flex!important;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center!important;justify-content:center!important;line-height:1!important;border:none!important;font-size:10px!important;font-size:var(--goods-action-icon-font-size,10px)!important;color:#646566!important;color:var(--goods-action-icon-text-color,#646566)!important;min-width:48px;min-width:var(--goods-action-icon-width,48px);height:50px!important;height:var(--goods-action-icon-height,50px)!important}.van-goods-action-icon__icon{display:-webkit-flex;display:flex;margin:0 auto 5px;color:#323233;color:var(--goods-action-icon-color,#323233);font-size:18px;font-size:var(--goods-action-icon-size,18px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useChildren('goods-action-button', function () { |
| | | this.children.forEach((item) => { |
| | | item.updateStyle(); |
| | | }); |
| | | }), |
| | | props: { |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="custom-class {{ utils.bem('goods-action', { safe: safeAreaInsetBottom }) }}"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;box-sizing:initial;height:50px;height:var(--goods-action-height,50px);background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | import { link } from '../mixins/link'; |
| | | VantComponent({ |
| | | relation: useParent('grid'), |
| | | classes: ['content-class', 'icon-class', 'text-class'], |
| | | mixins: [link], |
| | | props: { |
| | | icon: String, |
| | | iconColor: String, |
| | | dot: Boolean, |
| | | info: null, |
| | | badge: null, |
| | | text: String, |
| | | useSlot: Boolean, |
| | | }, |
| | | data: { |
| | | viewStyle: '', |
| | | }, |
| | | mounted() { |
| | | this.updateStyle(); |
| | | }, |
| | | methods: { |
| | | updateStyle() { |
| | | if (!this.parent) { |
| | | return; |
| | | } |
| | | const { data, children } = this.parent; |
| | | const { |
| | | columnNum, |
| | | border, |
| | | square, |
| | | gutter, |
| | | clickable, |
| | | center, |
| | | direction, |
| | | iconSize, |
| | | } = data; |
| | | this.setData({ |
| | | center, |
| | | border, |
| | | square, |
| | | gutter, |
| | | clickable, |
| | | direction, |
| | | iconSize, |
| | | index: children.indexOf(this), |
| | | columnNum, |
| | | }); |
| | | }, |
| | | onClick() { |
| | | this.$emit('click'); |
| | | this.jumpLink(); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('grid-item', { square }) }}" |
| | | style="{{ computed.wrapperStyle({ square, gutter, columnNum, index }) }}" |
| | | bindtap="onClick" |
| | | > |
| | | <view |
| | | class="content-class {{ utils.bem('grid-item__content', [direction, { center, square, clickable, surround: border && gutter }]) }} {{ border ? 'van-hairline--surround' : '' }}" |
| | | style="{{ computed.contentStyle({ square, gutter }) }}" |
| | | > |
| | | <block wx:if="{{ useSlot }}"> |
| | | <slot /> |
| | | </block> |
| | | <block wx:else> |
| | | <view class="van-grid-item__icon icon-class"> |
| | | <van-icon wx:if="{{ icon }}" name="{{ icon }}" color="{{ iconColor }}" dot="{{ dot }}" info="{{ badge || info }}" size="{{ iconSize }}" /> |
| | | <slot wx:else name="icon"></slot> |
| | | </view> |
| | | <view class="van-grid-item__text text-class"> |
| | | <text wx:if="{{ text }}">{{ text }}</text> |
| | | <slot wx:else name="text"></slot> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function wrapperStyle(data) { |
| | | var width = 100 / data.columnNum + '%'; |
| | | |
| | | return style({ |
| | | width: width, |
| | | 'padding-top': data.square ? width : null, |
| | | 'padding-right': addUnit(data.gutter), |
| | | 'margin-top': |
| | | data.index >= data.columnNum && !data.square |
| | | ? addUnit(data.gutter) |
| | | : null, |
| | | }); |
| | | } |
| | | |
| | | function contentStyle(data) { |
| | | return data.square |
| | | ? style({ |
| | | right: addUnit(data.gutter), |
| | | bottom: addUnit(data.gutter), |
| | | height: 'auto', |
| | | }) |
| | | : ''; |
| | | } |
| | | |
| | | module.exports = { |
| | | wrapperStyle: wrapperStyle, |
| | | contentStyle: contentStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-grid-item{position:relative;float:left;box-sizing:border-box}.van-grid-item--square{height:0}.van-grid-item__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;height:100%;padding:16px 8px;padding:var(--grid-item-content-padding,16px 8px);background-color:#fff;background-color:var(--grid-item-content-background-color,#fff)}.van-grid-item__content:after{z-index:1;border-width:0 1px 1px 0;border-bottom-width:var(--border-width-base,1px);border-right-width:var(--border-width-base,1px);border-top-width:0}.van-grid-item__content--surround:after{border-width:1px;border-width:var(--border-width-base,1px)}.van-grid-item__content--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-grid-item__content--square{position:absolute;top:0;right:0;left:0}.van-grid-item__content--horizontal{-webkit-flex-direction:row;flex-direction:row}.van-grid-item__content--horizontal .van-grid-item__icon+.van-grid-item__text{margin-top:0;margin-left:8px}.van-grid-item__content--clickable:active{background-color:#f2f3f5;background-color:var(--grid-item-content-active-color,#f2f3f5)}.van-grid-item__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:26px;font-size:var(--grid-item-icon-size,26px);height:26px;height:var(--grid-item-icon-size,26px)}.van-grid-item__text{word-wrap:break-word;color:#646566;color:var(--grid-item-text-color,#646566);font-size:12px;font-size:var(--grid-item-text-font-size,12px)}.van-grid-item__icon+.van-grid-item__text{margin-top:8px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useChildren('grid-item'), |
| | | props: { |
| | | square: { |
| | | type: Boolean, |
| | | observer: 'updateChildren', |
| | | }, |
| | | gutter: { |
| | | type: null, |
| | | value: 0, |
| | | observer: 'updateChildren', |
| | | }, |
| | | clickable: { |
| | | type: Boolean, |
| | | observer: 'updateChildren', |
| | | }, |
| | | columnNum: { |
| | | type: Number, |
| | | value: 4, |
| | | observer: 'updateChildren', |
| | | }, |
| | | center: { |
| | | type: Boolean, |
| | | value: true, |
| | | observer: 'updateChildren', |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | observer: 'updateChildren', |
| | | }, |
| | | direction: { |
| | | type: String, |
| | | observer: 'updateChildren', |
| | | }, |
| | | iconSize: { |
| | | type: String, |
| | | observer: 'updateChildren', |
| | | }, |
| | | }, |
| | | methods: { |
| | | updateChildren() { |
| | | this.children.forEach((child) => { |
| | | child.updateStyle(); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="van-grid custom-class {{ border && !gutter ? 'van-hairline--top' : '' }}" |
| | | style="{{ computed.rootStyle({ gutter }) }}" |
| | | > |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | 'padding-left': addUnit(data.gutter), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-grid{position:relative;box-sizing:border-box;overflow:hidden} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | dot: Boolean, |
| | | info: null, |
| | | size: null, |
| | | color: String, |
| | | customStyle: String, |
| | | classPrefix: { |
| | | type: String, |
| | | value: 'van-icon', |
| | | }, |
| | | name: String, |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | this.$emit('click'); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-info": "../info/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="{{ computed.rootClass({ classPrefix, name }) }}" |
| | | style="{{ computed.rootStyle({ customStyle, color, size }) }}" |
| | | bindtap="onClick" |
| | | > |
| | | <van-info |
| | | wx:if="{{ info !== null || dot }}" |
| | | dot="{{ dot }}" |
| | | info="{{ info }}" |
| | | custom-class="van-icon__info" |
| | | /> |
| | | <image |
| | | wx:if="{{ computed.isImage(name) }}" |
| | | src="{{ name }}" |
| | | mode="aspectFit" |
| | | class="van-icon__image" |
| | | /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function isImage(name) { |
| | | return name.indexOf('/') !== -1; |
| | | } |
| | | |
| | | function rootClass(data) { |
| | | var classes = ['custom-class']; |
| | | |
| | | if (data.classPrefix != null) { |
| | | classes.push(data.classPrefix); |
| | | } |
| | | |
| | | if (isImage(data.name)) { |
| | | classes.push('van-icon--image'); |
| | | } else if (data.classPrefix != null) { |
| | | classes.push(data.classPrefix + '-' + data.name); |
| | | } |
| | | |
| | | return classes.join(' '); |
| | | } |
| | | |
| | | function rootStyle(data) { |
| | | return style([ |
| | | { |
| | | color: data.color, |
| | | 'font-size': addUnit(data.size), |
| | | }, |
| | | data.customStyle, |
| | | ]); |
| | | } |
| | | |
| | | module.exports = { |
| | | isImage: isImage, |
| | | rootClass: rootClass, |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';@font-face{font-weight:400;font-family:vant-icon;font-style:normal;font-display:auto;src:url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff2) format("woff2"),url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.woff) format("woff"),url(https://img01.yzcdn.cn/vant/vant-icon-f463a9.ttf) format("truetype")}.van-icon{position:relative;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased}.van-icon,.van-icon:before{display:inline-block}.van-icon-add-o:before{content:"\F000"}.van-icon-add-square:before{content:"\F001"}.van-icon-add:before{content:"\F002"}.van-icon-after-sale:before{content:"\F003"}.van-icon-aim:before{content:"\F004"}.van-icon-alipay:before{content:"\F005"}.van-icon-apps-o:before{content:"\F006"}.van-icon-arrow-down:before{content:"\F007"}.van-icon-arrow-left:before{content:"\F008"}.van-icon-arrow-up:before{content:"\F009"}.van-icon-arrow:before{content:"\F00A"}.van-icon-ascending:before{content:"\F00B"}.van-icon-audio:before{content:"\F00C"}.van-icon-award-o:before{content:"\F00D"}.van-icon-award:before{content:"\F00E"}.van-icon-back-top:before{content:"\F0E6"}.van-icon-bag-o:before{content:"\F00F"}.van-icon-bag:before{content:"\F010"}.van-icon-balance-list-o:before{content:"\F011"}.van-icon-balance-list:before{content:"\F012"}.van-icon-balance-o:before{content:"\F013"}.van-icon-balance-pay:before{content:"\F014"}.van-icon-bar-chart-o:before{content:"\F015"}.van-icon-bars:before{content:"\F016"}.van-icon-bell:before{content:"\F017"}.van-icon-bill-o:before{content:"\F018"}.van-icon-bill:before{content:"\F019"}.van-icon-birthday-cake-o:before{content:"\F01A"}.van-icon-bookmark-o:before{content:"\F01B"}.van-icon-bookmark:before{content:"\F01C"}.van-icon-browsing-history-o:before{content:"\F01D"}.van-icon-browsing-history:before{content:"\F01E"}.van-icon-brush-o:before{content:"\F01F"}.van-icon-bulb-o:before{content:"\F020"}.van-icon-bullhorn-o:before{content:"\F021"}.van-icon-calendar-o:before{content:"\F022"}.van-icon-card:before{content:"\F023"}.van-icon-cart-circle-o:before{content:"\F024"}.van-icon-cart-circle:before{content:"\F025"}.van-icon-cart-o:before{content:"\F026"}.van-icon-cart:before{content:"\F027"}.van-icon-cash-back-record:before{content:"\F028"}.van-icon-cash-on-deliver:before{content:"\F029"}.van-icon-cashier-o:before{content:"\F02A"}.van-icon-certificate:before{content:"\F02B"}.van-icon-chart-trending-o:before{content:"\F02C"}.van-icon-chat-o:before{content:"\F02D"}.van-icon-chat:before{content:"\F02E"}.van-icon-checked:before{content:"\F02F"}.van-icon-circle:before{content:"\F030"}.van-icon-clear:before{content:"\F031"}.van-icon-clock-o:before{content:"\F032"}.van-icon-clock:before{content:"\F033"}.van-icon-close:before{content:"\F034"}.van-icon-closed-eye:before{content:"\F035"}.van-icon-cluster-o:before{content:"\F036"}.van-icon-cluster:before{content:"\F037"}.van-icon-column:before{content:"\F038"}.van-icon-comment-circle-o:before{content:"\F039"}.van-icon-comment-circle:before{content:"\F03A"}.van-icon-comment-o:before{content:"\F03B"}.van-icon-comment:before{content:"\F03C"}.van-icon-completed:before{content:"\F03D"}.van-icon-contact:before{content:"\F03E"}.van-icon-coupon-o:before{content:"\F03F"}.van-icon-coupon:before{content:"\F040"}.van-icon-credit-pay:before{content:"\F041"}.van-icon-cross:before{content:"\F042"}.van-icon-debit-pay:before{content:"\F043"}.van-icon-delete-o:before{content:"\F0E9"}.van-icon-delete:before{content:"\F044"}.van-icon-descending:before{content:"\F045"}.van-icon-description:before{content:"\F046"}.van-icon-desktop-o:before{content:"\F047"}.van-icon-diamond-o:before{content:"\F048"}.van-icon-diamond:before{content:"\F049"}.van-icon-discount:before{content:"\F04A"}.van-icon-down:before{content:"\F04B"}.van-icon-ecard-pay:before{content:"\F04C"}.van-icon-edit:before{content:"\F04D"}.van-icon-ellipsis:before{content:"\F04E"}.van-icon-empty:before{content:"\F04F"}.van-icon-enlarge:before{content:"\F0E4"}.van-icon-envelop-o:before{content:"\F050"}.van-icon-exchange:before{content:"\F051"}.van-icon-expand-o:before{content:"\F052"}.van-icon-expand:before{content:"\F053"}.van-icon-eye-o:before{content:"\F054"}.van-icon-eye:before{content:"\F055"}.van-icon-fail:before{content:"\F056"}.van-icon-failure:before{content:"\F057"}.van-icon-filter-o:before{content:"\F058"}.van-icon-fire-o:before{content:"\F059"}.van-icon-fire:before{content:"\F05A"}.van-icon-flag-o:before{content:"\F05B"}.van-icon-flower-o:before{content:"\F05C"}.van-icon-font-o:before{content:"\F0EC"}.van-icon-font:before{content:"\F0EB"}.van-icon-free-postage:before{content:"\F05D"}.van-icon-friends-o:before{content:"\F05E"}.van-icon-friends:before{content:"\F05F"}.van-icon-gem-o:before{content:"\F060"}.van-icon-gem:before{content:"\F061"}.van-icon-gift-card-o:before{content:"\F062"}.van-icon-gift-card:before{content:"\F063"}.van-icon-gift-o:before{content:"\F064"}.van-icon-gift:before{content:"\F065"}.van-icon-gold-coin-o:before{content:"\F066"}.van-icon-gold-coin:before{content:"\F067"}.van-icon-good-job-o:before{content:"\F068"}.van-icon-good-job:before{content:"\F069"}.van-icon-goods-collect-o:before{content:"\F06A"}.van-icon-goods-collect:before{content:"\F06B"}.van-icon-graphic:before{content:"\F06C"}.van-icon-home-o:before{content:"\F06D"}.van-icon-hot-o:before{content:"\F06E"}.van-icon-hot-sale-o:before{content:"\F06F"}.van-icon-hot-sale:before{content:"\F070"}.van-icon-hot:before{content:"\F071"}.van-icon-hotel-o:before{content:"\F072"}.van-icon-idcard:before{content:"\F073"}.van-icon-info-o:before{content:"\F074"}.van-icon-info:before{content:"\F075"}.van-icon-invition:before{content:"\F076"}.van-icon-label-o:before{content:"\F077"}.van-icon-label:before{content:"\F078"}.van-icon-like-o:before{content:"\F079"}.van-icon-like:before{content:"\F07A"}.van-icon-live:before{content:"\F07B"}.van-icon-location-o:before{content:"\F07C"}.van-icon-location:before{content:"\F07D"}.van-icon-lock:before{content:"\F07E"}.van-icon-logistics:before{content:"\F07F"}.van-icon-manager-o:before{content:"\F080"}.van-icon-manager:before{content:"\F081"}.van-icon-map-marked:before{content:"\F082"}.van-icon-medal-o:before{content:"\F083"}.van-icon-medal:before{content:"\F084"}.van-icon-minus:before{content:"\F0E8"}.van-icon-more-o:before{content:"\F085"}.van-icon-more:before{content:"\F086"}.van-icon-music-o:before{content:"\F087"}.van-icon-music:before{content:"\F088"}.van-icon-new-arrival-o:before{content:"\F089"}.van-icon-new-arrival:before{content:"\F08A"}.van-icon-new-o:before{content:"\F08B"}.van-icon-new:before{content:"\F08C"}.van-icon-newspaper-o:before{content:"\F08D"}.van-icon-notes-o:before{content:"\F08E"}.van-icon-orders-o:before{content:"\F08F"}.van-icon-other-pay:before{content:"\F090"}.van-icon-paid:before{content:"\F091"}.van-icon-passed:before{content:"\F092"}.van-icon-pause-circle-o:before{content:"\F093"}.van-icon-pause-circle:before{content:"\F094"}.van-icon-pause:before{content:"\F095"}.van-icon-peer-pay:before{content:"\F096"}.van-icon-pending-payment:before{content:"\F097"}.van-icon-phone-circle-o:before{content:"\F098"}.van-icon-phone-circle:before{content:"\F099"}.van-icon-phone-o:before{content:"\F09A"}.van-icon-phone:before{content:"\F09B"}.van-icon-photo-fail:before{content:"\F0E5"}.van-icon-photo-o:before{content:"\F09C"}.van-icon-photo:before{content:"\F09D"}.van-icon-photograph:before{content:"\F09E"}.van-icon-play-circle-o:before{content:"\F09F"}.van-icon-play-circle:before{content:"\F0A0"}.van-icon-play:before{content:"\F0A1"}.van-icon-plus:before{content:"\F0A2"}.van-icon-point-gift-o:before{content:"\F0A3"}.van-icon-point-gift:before{content:"\F0A4"}.van-icon-points:before{content:"\F0A5"}.van-icon-printer:before{content:"\F0A6"}.van-icon-qr-invalid:before{content:"\F0A7"}.van-icon-qr:before{content:"\F0A8"}.van-icon-question-o:before{content:"\F0A9"}.van-icon-question:before{content:"\F0AA"}.van-icon-records:before{content:"\F0AB"}.van-icon-refund-o:before{content:"\F0AC"}.van-icon-replay:before{content:"\F0AD"}.van-icon-revoke:before{content:"\F0ED"}.van-icon-scan:before{content:"\F0AE"}.van-icon-search:before{content:"\F0AF"}.van-icon-send-gift-o:before{content:"\F0B0"}.van-icon-send-gift:before{content:"\F0B1"}.van-icon-service-o:before{content:"\F0B2"}.van-icon-service:before{content:"\F0B3"}.van-icon-setting-o:before{content:"\F0B4"}.van-icon-setting:before{content:"\F0B5"}.van-icon-share-o:before{content:"\F0E7"}.van-icon-share:before{content:"\F0B6"}.van-icon-shop-collect-o:before{content:"\F0B7"}.van-icon-shop-collect:before{content:"\F0B8"}.van-icon-shop-o:before{content:"\F0B9"}.van-icon-shop:before{content:"\F0BA"}.van-icon-shopping-cart-o:before{content:"\F0BB"}.van-icon-shopping-cart:before{content:"\F0BC"}.van-icon-shrink:before{content:"\F0BD"}.van-icon-sign:before{content:"\F0BE"}.van-icon-smile-comment-o:before{content:"\F0BF"}.van-icon-smile-comment:before{content:"\F0C0"}.van-icon-smile-o:before{content:"\F0C1"}.van-icon-smile:before{content:"\F0C2"}.van-icon-sort:before{content:"\F0EA"}.van-icon-star-o:before{content:"\F0C3"}.van-icon-star:before{content:"\F0C4"}.van-icon-stop-circle-o:before{content:"\F0C5"}.van-icon-stop-circle:before{content:"\F0C6"}.van-icon-stop:before{content:"\F0C7"}.van-icon-success:before{content:"\F0C8"}.van-icon-thumb-circle-o:before{content:"\F0C9"}.van-icon-thumb-circle:before{content:"\F0CA"}.van-icon-todo-list-o:before{content:"\F0CB"}.van-icon-todo-list:before{content:"\F0CC"}.van-icon-tosend:before{content:"\F0CD"}.van-icon-tv-o:before{content:"\F0CE"}.van-icon-umbrella-circle:before{content:"\F0CF"}.van-icon-underway-o:before{content:"\F0D0"}.van-icon-underway:before{content:"\F0D1"}.van-icon-upgrade:before{content:"\F0D2"}.van-icon-user-circle-o:before{content:"\F0D3"}.van-icon-user-o:before{content:"\F0D4"}.van-icon-video-o:before{content:"\F0D5"}.van-icon-video:before{content:"\F0D6"}.van-icon-vip-card-o:before{content:"\F0D7"}.van-icon-vip-card:before{content:"\F0D8"}.van-icon-volume-o:before{content:"\F0D9"}.van-icon-volume:before{content:"\F0DA"}.van-icon-wap-home-o:before{content:"\F0DB"}.van-icon-wap-home:before{content:"\F0DC"}.van-icon-wap-nav:before{content:"\F0DD"}.van-icon-warn-o:before{content:"\F0DE"}.van-icon-warning-o:before{content:"\F0DF"}.van-icon-warning:before{content:"\F0E0"}.van-icon-weapp-nav:before{content:"\F0E1"}.van-icon-wechat-pay:before{content:"\F0E2"}.van-icon-wechat:before{content:"\F0EE"}.van-icon-youzan-shield:before{content:"\F0E3"}:host{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-icon--image{width:1em;height:1em}.van-icon__image{width:100%;height:100%}.van-icon__info{z-index:1} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { button } from '../mixins/button'; |
| | | import { openType } from '../mixins/open-type'; |
| | | VantComponent({ |
| | | mixins: [button, openType], |
| | | classes: ['custom-class', 'loading-class', 'error-class', 'image-class'], |
| | | props: { |
| | | src: { |
| | | type: String, |
| | | observer() { |
| | | this.setData({ |
| | | error: false, |
| | | loading: true, |
| | | }); |
| | | }, |
| | | }, |
| | | round: Boolean, |
| | | width: null, |
| | | height: null, |
| | | radius: null, |
| | | lazyLoad: Boolean, |
| | | useErrorSlot: Boolean, |
| | | useLoadingSlot: Boolean, |
| | | showMenuByLongpress: Boolean, |
| | | fit: { |
| | | type: String, |
| | | value: 'fill', |
| | | }, |
| | | showError: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showLoading: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | error: false, |
| | | loading: true, |
| | | viewStyle: '', |
| | | }, |
| | | methods: { |
| | | onLoad(event) { |
| | | this.setData({ |
| | | loading: false, |
| | | }); |
| | | this.$emit('load', event.detail); |
| | | }, |
| | | onError(event) { |
| | | this.setData({ |
| | | loading: false, |
| | | error: true, |
| | | }); |
| | | this.$emit('error', event.detail); |
| | | }, |
| | | onClick(event) { |
| | | this.$emit('click', event.detail); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | style="{{ computed.rootStyle({ width, height, radius }) }}" |
| | | class="custom-class {{ utils.bem('image', { round })}}" |
| | | bind:tap="onClick" |
| | | > |
| | | <image |
| | | wx:if="{{ !error }}" |
| | | src="{{ src }}" |
| | | mode="{{ computed.mode(fit) }}" |
| | | lazy-load="{{ lazyLoad }}" |
| | | class="image-class van-image__img" |
| | | show-menu-by-longpress="{{ showMenuByLongpress }}" |
| | | bind:load="onLoad" |
| | | bind:error="onError" |
| | | /> |
| | | |
| | | <view |
| | | wx:if="{{ loading && showLoading }}" |
| | | class="loading-class van-image__loading" |
| | | > |
| | | <slot wx:if="{{ useLoadingSlot }}" name="loading" /> |
| | | <van-icon wx:else name="photo" custom-class="van-image__loading-icon" /> |
| | | </view> |
| | | <view |
| | | wx:if="{{ error && showError }}" |
| | | class="error-class van-image__error" |
| | | > |
| | | <slot wx:if="{{ useErrorSlot }}" name="error" /> |
| | | <van-icon wx:else name="photo-fail" custom-class="van-image__error-icon" /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style([ |
| | | { |
| | | width: addUnit(data.width), |
| | | height: addUnit(data.height), |
| | | 'border-radius': addUnit(data.radius), |
| | | }, |
| | | data.radius ? 'overflow: hidden' : null, |
| | | ]); |
| | | } |
| | | |
| | | var FIT_MODE_MAP = { |
| | | none: 'center', |
| | | fill: 'scaleToFill', |
| | | cover: 'aspectFill', |
| | | contain: 'aspectFit', |
| | | widthFix: 'widthFix', |
| | | heightFix: 'heightFix', |
| | | }; |
| | | |
| | | function mode(fit) { |
| | | return FIT_MODE_MAP[fit]; |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | mode: mode, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-image{position:relative;display:inline-block}.van-image--round{overflow:hidden;border-radius:50%}.van-image--round .van-image__img{border-radius:inherit}.van-image__error,.van-image__img,.van-image__loading{display:block;width:100%;height:100%}.van-image__error,.van-image__loading{position:absolute;top:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#969799;color:var(--image-placeholder-text-color,#969799);font-size:14px;font-size:var(--image-placeholder-font-size,14px);background-color:#f7f8fa;background-color:var(--image-placeholder-background-color,#f7f8fa)}.van-image__loading-icon{color:#dcdee0;color:var(--image-loading-icon-color,#dcdee0);font-size:32px!important;font-size:var(--image-loading-icon-size,32px)!important}.van-image__error-icon{color:#dcdee0;color:var(--image-error-icon-color,#dcdee0);font-size:32px!important;font-size:var(--image-error-icon-size,32px)!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { getRect } from '../common/utils'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useParent('index-bar'), |
| | | props: { |
| | | useSlot: Boolean, |
| | | index: null, |
| | | }, |
| | | data: { |
| | | active: false, |
| | | wrapperStyle: '', |
| | | anchorStyle: '', |
| | | }, |
| | | methods: { |
| | | scrollIntoView(scrollTop) { |
| | | getRect(this, '.van-index-anchor-wrapper').then((rect) => { |
| | | wx.pageScrollTo({ |
| | | duration: 0, |
| | | scrollTop: scrollTop + rect.top - this.parent.data.stickyOffsetTop, |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view |
| | | class="van-index-anchor-wrapper" |
| | | style="{{ wrapperStyle }}" |
| | | > |
| | | <view |
| | | class="van-index-anchor {{ active ? 'van-index-anchor--active van-hairline--bottom' : '' }}" |
| | | style="{{ anchorStyle }}" |
| | | > |
| | | <slot wx:if="{{ useSlot }}"/> |
| | | <block wx:else> |
| | | <text>{{ index }}</text> |
| | | </block> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-index-anchor{padding:0 16px;padding:var(--index-anchor-padding,0 16px);color:#323233;color:var(--index-anchor-text-color,#323233);font-weight:500;font-weight:var(--index-anchor-font-weight,500);font-size:14px;font-size:var(--index-anchor-font-size,14px);line-height:32px;line-height:var(--index-anchor-line-height,32px);background-color:initial;background-color:var(--index-anchor-background-color,transparent)}.van-index-anchor--active{right:0;left:0;color:#07c160;color:var(--index-anchor-active-text-color,#07c160);background-color:#fff;background-color:var(--index-anchor-active-background-color,#fff)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { GREEN } from '../common/color'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | import { getRect } from '../common/utils'; |
| | | import { pageScrollMixin } from '../mixins/page-scroll'; |
| | | const indexList = () => { |
| | | const indexList = []; |
| | | const charCodeOfA = 'A'.charCodeAt(0); |
| | | for (let i = 0; i < 26; i++) { |
| | | indexList.push(String.fromCharCode(charCodeOfA + i)); |
| | | } |
| | | return indexList; |
| | | }; |
| | | VantComponent({ |
| | | relation: useChildren('index-anchor', function () { |
| | | this.updateData(); |
| | | }), |
| | | props: { |
| | | sticky: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | highlightColor: { |
| | | type: String, |
| | | value: GREEN, |
| | | }, |
| | | stickyOffsetTop: { |
| | | type: Number, |
| | | value: 0, |
| | | }, |
| | | indexList: { |
| | | type: Array, |
| | | value: indexList(), |
| | | }, |
| | | }, |
| | | mixins: [ |
| | | pageScrollMixin(function (event) { |
| | | this.scrollTop = |
| | | (event === null || event === void 0 ? void 0 : event.scrollTop) || 0; |
| | | this.onScroll(); |
| | | }), |
| | | ], |
| | | data: { |
| | | activeAnchorIndex: null, |
| | | showSidebar: false, |
| | | }, |
| | | created() { |
| | | this.scrollTop = 0; |
| | | }, |
| | | methods: { |
| | | updateData() { |
| | | wx.nextTick(() => { |
| | | if (this.timer != null) { |
| | | clearTimeout(this.timer); |
| | | } |
| | | this.timer = setTimeout(() => { |
| | | this.setData({ |
| | | showSidebar: !!this.children.length, |
| | | }); |
| | | this.setRect().then(() => { |
| | | this.onScroll(); |
| | | }); |
| | | }, 0); |
| | | }); |
| | | }, |
| | | setRect() { |
| | | return Promise.all([ |
| | | this.setAnchorsRect(), |
| | | this.setListRect(), |
| | | this.setSiderbarRect(), |
| | | ]); |
| | | }, |
| | | setAnchorsRect() { |
| | | return Promise.all( |
| | | this.children.map((anchor) => |
| | | getRect(anchor, '.van-index-anchor-wrapper').then((rect) => { |
| | | Object.assign(anchor, { |
| | | height: rect.height, |
| | | top: rect.top + this.scrollTop, |
| | | }); |
| | | }) |
| | | ) |
| | | ); |
| | | }, |
| | | setListRect() { |
| | | return getRect(this, '.van-index-bar').then((rect) => { |
| | | Object.assign(this, { |
| | | height: rect.height, |
| | | top: rect.top + this.scrollTop, |
| | | }); |
| | | }); |
| | | }, |
| | | setSiderbarRect() { |
| | | return getRect(this, '.van-index-bar__sidebar').then((res) => { |
| | | this.sidebar = { |
| | | height: res.height, |
| | | top: res.top, |
| | | }; |
| | | }); |
| | | }, |
| | | setDiffData({ target, data }) { |
| | | const diffData = {}; |
| | | Object.keys(data).forEach((key) => { |
| | | if (target.data[key] !== data[key]) { |
| | | diffData[key] = data[key]; |
| | | } |
| | | }); |
| | | if (Object.keys(diffData).length) { |
| | | target.setData(diffData); |
| | | } |
| | | }, |
| | | getAnchorRect(anchor) { |
| | | return getRect(anchor, '.van-index-anchor-wrapper').then((rect) => ({ |
| | | height: rect.height, |
| | | top: rect.top, |
| | | })); |
| | | }, |
| | | getActiveAnchorIndex() { |
| | | const { children, scrollTop } = this; |
| | | const { sticky, stickyOffsetTop } = this.data; |
| | | for (let i = this.children.length - 1; i >= 0; i--) { |
| | | const preAnchorHeight = i > 0 ? children[i - 1].height : 0; |
| | | const reachTop = sticky ? preAnchorHeight + stickyOffsetTop : 0; |
| | | if (reachTop + scrollTop >= children[i].top) { |
| | | return i; |
| | | } |
| | | } |
| | | return -1; |
| | | }, |
| | | onScroll() { |
| | | const { children = [], scrollTop } = this; |
| | | if (!children.length) { |
| | | return; |
| | | } |
| | | const { sticky, stickyOffsetTop, zIndex, highlightColor } = this.data; |
| | | const active = this.getActiveAnchorIndex(); |
| | | this.setDiffData({ |
| | | target: this, |
| | | data: { |
| | | activeAnchorIndex: active, |
| | | }, |
| | | }); |
| | | if (sticky) { |
| | | let isActiveAnchorSticky = false; |
| | | if (active !== -1) { |
| | | isActiveAnchorSticky = |
| | | children[active].top <= stickyOffsetTop + scrollTop; |
| | | } |
| | | children.forEach((item, index) => { |
| | | if (index === active) { |
| | | let wrapperStyle = ''; |
| | | let anchorStyle = ` |
| | | color: ${highlightColor}; |
| | | `; |
| | | if (isActiveAnchorSticky) { |
| | | wrapperStyle = ` |
| | | height: ${children[index].height}px; |
| | | `; |
| | | anchorStyle = ` |
| | | position: fixed; |
| | | top: ${stickyOffsetTop}px; |
| | | z-index: ${zIndex}; |
| | | color: ${highlightColor}; |
| | | `; |
| | | } |
| | | this.setDiffData({ |
| | | target: item, |
| | | data: { |
| | | active: true, |
| | | anchorStyle, |
| | | wrapperStyle, |
| | | }, |
| | | }); |
| | | } else if (index === active - 1) { |
| | | const currentAnchor = children[index]; |
| | | const currentOffsetTop = currentAnchor.top; |
| | | const targetOffsetTop = |
| | | index === children.length - 1 |
| | | ? this.top |
| | | : children[index + 1].top; |
| | | const parentOffsetHeight = targetOffsetTop - currentOffsetTop; |
| | | const translateY = parentOffsetHeight - currentAnchor.height; |
| | | const anchorStyle = ` |
| | | position: relative; |
| | | transform: translate3d(0, ${translateY}px, 0); |
| | | z-index: ${zIndex}; |
| | | color: ${highlightColor}; |
| | | `; |
| | | this.setDiffData({ |
| | | target: item, |
| | | data: { |
| | | active: true, |
| | | anchorStyle, |
| | | }, |
| | | }); |
| | | } else { |
| | | this.setDiffData({ |
| | | target: item, |
| | | data: { |
| | | active: false, |
| | | anchorStyle: '', |
| | | wrapperStyle: '', |
| | | }, |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | onClick(event) { |
| | | this.scrollToAnchor(event.target.dataset.index); |
| | | }, |
| | | onTouchMove(event) { |
| | | const sidebarLength = this.children.length; |
| | | const touch = event.touches[0]; |
| | | const itemHeight = this.sidebar.height / sidebarLength; |
| | | let index = Math.floor((touch.clientY - this.sidebar.top) / itemHeight); |
| | | if (index < 0) { |
| | | index = 0; |
| | | } else if (index > sidebarLength - 1) { |
| | | index = sidebarLength - 1; |
| | | } |
| | | this.scrollToAnchor(index); |
| | | }, |
| | | onTouchStop() { |
| | | this.scrollToAnchorIndex = null; |
| | | }, |
| | | scrollToAnchor(index) { |
| | | if (typeof index !== 'number' || this.scrollToAnchorIndex === index) { |
| | | return; |
| | | } |
| | | this.scrollToAnchorIndex = index; |
| | | const anchor = this.children.find( |
| | | (item) => item.data.index === this.data.indexList[index] |
| | | ); |
| | | if (anchor) { |
| | | anchor.scrollIntoView(this.scrollTop); |
| | | this.$emit('select', anchor.data.index); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-index-bar"> |
| | | <slot /> |
| | | |
| | | <view |
| | | wx:if="{{ showSidebar }}" |
| | | class="van-index-bar__sidebar" |
| | | catch:tap="onClick" |
| | | catch:touchmove="onTouchMove" |
| | | catch:touchend="onTouchStop" |
| | | catch:touchcancel="onTouchStop" |
| | | > |
| | | <view |
| | | wx:for="{{ indexList }}" |
| | | wx:key="index" |
| | | class="van-index-bar__index" |
| | | style="z-index: {{ zIndex + 1 }}; color: {{ activeAnchorIndex === index ? highlightColor : '' }}" |
| | | data-index="{{ index }}" |
| | | > |
| | | {{ item }} |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-index-bar{position:relative}.van-index-bar__sidebar{position:fixed;top:50%;right:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;text-align:center;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-user-select:none;user-select:none}.van-index-bar__index{font-weight:500;padding:0 4px 0 16px;padding:0 var(--padding-base,4px) 0 var(--padding-md,16px);font-size:10px;font-size:var(--index-bar-index-font-size,10px);line-height:14px;line-height:var(--index-bar-index-line-height,14px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | dot: Boolean, |
| | | info: null, |
| | | customStyle: String, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | wx:if="{{ info !== null && info !== '' || dot }}" |
| | | class="van-info {{ utils.bem('info', { dot }) }} custom-class" |
| | | style="{{ customStyle }}" |
| | | >{{ dot ? '' : info }}</view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-info{position:absolute;top:0;right:0;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;white-space:nowrap;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%);-webkit-transform-origin:100%;transform-origin:100%;height:16px;height:var(--info-size,16px);min-width:16px;min-width:var(--info-size,16px);padding:0 3px;padding:var(--info-padding,0 3px);color:#fff;color:var(--info-color,#fff);font-weight:500;font-weight:var(--info-font-weight,500);font-size:12px;font-size:var(--info-font-size,12px);font-family:-apple-system-font,Helvetica Neue,Arial,sans-serif;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);background-color:#ee0a24;background-color:var(--info-background-color,#ee0a24);border:1px solid #fff;border:var(--info-border-width,1px) solid var(--white,#fff);border-radius:16px;border-radius:var(--info-size,16px)}.van-info--dot{min-width:0;border-radius:100%;width:8px;width:var(--info-dot-size,8px);height:8px;height:var(--info-dot-size,8px);background-color:#ee0a24;background-color:var(--info-dot-color,#ee0a24)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | color: String, |
| | | vertical: Boolean, |
| | | type: { |
| | | type: String, |
| | | value: 'circular', |
| | | }, |
| | | size: String, |
| | | textSize: String, |
| | | }, |
| | | data: { |
| | | array12: Array.from({ length: 12 }), |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="custom-class {{ utils.bem('loading', { vertical }) }}"> |
| | | <view |
| | | class="van-loading__spinner van-loading__spinner--{{ type }}" |
| | | style="{{ computed.spinnerStyle({ color, size }) }}" |
| | | > |
| | | <view |
| | | wx:if="{{ type === 'spinner' }}" |
| | | wx:for="{{ array12 }}" |
| | | wx:key="index" |
| | | class="van-loading__dot" |
| | | /> |
| | | </view> |
| | | <view class="van-loading__text" style="{{ computed.textStyle({ textSize }) }}"> |
| | | <slot /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function spinnerStyle(data) { |
| | | return style({ |
| | | color: data.color, |
| | | width: addUnit(data.size), |
| | | height: addUnit(data.size), |
| | | }); |
| | | } |
| | | |
| | | function textStyle(data) { |
| | | return style({ |
| | | 'font-size': addUnit(data.textSize), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | spinnerStyle: spinnerStyle, |
| | | textStyle: textStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#c8c9cc;color:var(--loading-spinner-color,#c8c9cc)}.van-loading__spinner{position:relative;box-sizing:border-box;width:30px;width:var(--loading-spinner-size,30px);max-width:100%;max-height:100%;height:30px;height:var(--loading-spinner-size,30px);-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite;-webkit-animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__text{margin-left:8px;margin-left:var(--padding-xs,8px);color:#969799;color:var(--loading-text-color,#969799);font-size:14px;font-size:var(--loading-text-font-size,14px);line-height:20px;line-height:var(--loading-text-line-height,20px)}.van-loading__text:empty{display:none}.van-loading--vertical{-webkit-flex-direction:column;flex-direction:column}.van-loading--vertical .van-loading__text{margin:8px 0 0;margin:var(--padding-xs,8px) 0 0}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const basic: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const basic = Behavior({ |
| | | methods: { |
| | | $emit(name, detail, options) { |
| | | this.triggerEvent(name, detail, options); |
| | | }, |
| | | set(data) { |
| | | this.setData(data); |
| | | return new Promise((resolve) => wx.nextTick(resolve)); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const button: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const button = Behavior({ |
| | | externalClasses: ['hover-class'], |
| | | properties: { |
| | | id: String, |
| | | lang: String, |
| | | businessId: Number, |
| | | sessionFrom: String, |
| | | sendMessageTitle: String, |
| | | sendMessagePath: String, |
| | | sendMessageImg: String, |
| | | showMessageCard: Boolean, |
| | | appParameter: String, |
| | | ariaLabel: String, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const link: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const link = Behavior({ |
| | | properties: { |
| | | url: String, |
| | | linkType: { |
| | | type: String, |
| | | value: 'navigateTo', |
| | | }, |
| | | }, |
| | | methods: { |
| | | jumpLink(urlKey = 'url') { |
| | | const url = this.data[urlKey]; |
| | | if (url) { |
| | | if ( |
| | | this.data.linkType === 'navigateTo' && |
| | | getCurrentPages().length > 9 |
| | | ) { |
| | | wx.redirectTo({ url }); |
| | | } else { |
| | | wx[this.data.linkType]({ url }); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const openType: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // @ts-nocheck |
| | | export const openType = Behavior({ |
| | | properties: { |
| | | openType: String, |
| | | }, |
| | | methods: { |
| | | bindGetUserInfo(event) { |
| | | this.$emit('getuserinfo', event.detail); |
| | | }, |
| | | bindContact(event) { |
| | | this.$emit('contact', event.detail); |
| | | }, |
| | | bindGetPhoneNumber(event) { |
| | | this.$emit('getphonenumber', event.detail); |
| | | }, |
| | | bindError(event) { |
| | | this.$emit('error', event.detail); |
| | | }, |
| | | bindLaunchApp(event) { |
| | | this.$emit('launchapp', event.detail); |
| | | }, |
| | | bindOpenSetting(event) { |
| | | this.$emit('opensetting', event.detail); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption; |
| | | declare type Scroller = ( |
| | | this: WechatMiniprogram.Component.TrivialInstance, |
| | | event?: IPageScrollOption |
| | | ) => void; |
| | | export declare const pageScrollMixin: (scroller: Scroller) => string; |
| | | export {}; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { getCurrentPage } from '../common/utils'; |
| | | function onPageScroll(event) { |
| | | const { vanPageScroller = [] } = getCurrentPage(); |
| | | vanPageScroller.forEach((scroller) => { |
| | | if (typeof scroller === 'function') { |
| | | // @ts-ignore |
| | | scroller(event); |
| | | } |
| | | }); |
| | | } |
| | | export const pageScrollMixin = (scroller) => |
| | | Behavior({ |
| | | attached() { |
| | | const page = getCurrentPage(); |
| | | if (Array.isArray(page.vanPageScroller)) { |
| | | page.vanPageScroller.push(scroller.bind(this)); |
| | | } else { |
| | | page.vanPageScroller = |
| | | typeof page.onPageScroll === 'function' |
| | | ? [page.onPageScroll.bind(page), scroller.bind(this)] |
| | | : [scroller.bind(this)]; |
| | | } |
| | | page.onPageScroll = onPageScroll; |
| | | }, |
| | | detached() { |
| | | var _a; |
| | | const page = getCurrentPage(); |
| | | page.vanPageScroller = |
| | | ((_a = page.vanPageScroller) === null || _a === void 0 |
| | | ? void 0 |
| | | : _a.filter((item) => item !== scroller)) || []; |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const touch: string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // @ts-nocheck |
| | | const MIN_DISTANCE = 10; |
| | | function getDirection(x, y) { |
| | | if (x > y && x > MIN_DISTANCE) { |
| | | return 'horizontal'; |
| | | } |
| | | if (y > x && y > MIN_DISTANCE) { |
| | | return 'vertical'; |
| | | } |
| | | return ''; |
| | | } |
| | | export const touch = Behavior({ |
| | | methods: { |
| | | resetTouchStatus() { |
| | | this.direction = ''; |
| | | this.deltaX = 0; |
| | | this.deltaY = 0; |
| | | this.offsetX = 0; |
| | | this.offsetY = 0; |
| | | }, |
| | | touchStart(event) { |
| | | this.resetTouchStatus(); |
| | | const touch = event.touches[0]; |
| | | this.startX = touch.clientX; |
| | | this.startY = touch.clientY; |
| | | }, |
| | | touchMove(event) { |
| | | const touch = event.touches[0]; |
| | | this.deltaX = touch.clientX - this.startX; |
| | | this.deltaY = touch.clientY - this.startY; |
| | | this.offsetX = Math.abs(this.deltaX); |
| | | this.offsetY = Math.abs(this.deltaY); |
| | | this.direction = |
| | | this.direction || getDirection(this.offsetX, this.offsetY); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare function transition(showDefaultValue: boolean): string; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // @ts-nocheck |
| | | import { requestAnimationFrame } from '../common/utils'; |
| | | import { isObj } from '../common/validator'; |
| | | const getClassNames = (name) => ({ |
| | | enter: `van-${name}-enter van-${name}-enter-active enter-class enter-active-class`, |
| | | 'enter-to': `van-${name}-enter-to van-${name}-enter-active enter-to-class enter-active-class`, |
| | | leave: `van-${name}-leave van-${name}-leave-active leave-class leave-active-class`, |
| | | 'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class`, |
| | | }); |
| | | export function transition(showDefaultValue) { |
| | | return Behavior({ |
| | | properties: { |
| | | customStyle: String, |
| | | // @ts-ignore |
| | | show: { |
| | | type: Boolean, |
| | | value: showDefaultValue, |
| | | observer: 'observeShow', |
| | | }, |
| | | // @ts-ignore |
| | | duration: { |
| | | type: null, |
| | | value: 300, |
| | | observer: 'observeDuration', |
| | | }, |
| | | name: { |
| | | type: String, |
| | | value: 'fade', |
| | | }, |
| | | }, |
| | | data: { |
| | | type: '', |
| | | inited: false, |
| | | display: false, |
| | | }, |
| | | ready() { |
| | | if (this.data.show === true) { |
| | | this.observeShow(true, false); |
| | | } |
| | | }, |
| | | methods: { |
| | | observeShow(value, old) { |
| | | if (value === old) { |
| | | return; |
| | | } |
| | | value ? this.enter() : this.leave(); |
| | | }, |
| | | enter() { |
| | | const { duration, name } = this.data; |
| | | const classNames = getClassNames(name); |
| | | const currentDuration = isObj(duration) ? duration.enter : duration; |
| | | this.status = 'enter'; |
| | | this.$emit('before-enter'); |
| | | requestAnimationFrame(() => { |
| | | if (this.status !== 'enter') { |
| | | return; |
| | | } |
| | | this.$emit('enter'); |
| | | this.setData({ |
| | | inited: true, |
| | | display: true, |
| | | classes: classNames.enter, |
| | | currentDuration, |
| | | }); |
| | | requestAnimationFrame(() => { |
| | | if (this.status !== 'enter') { |
| | | return; |
| | | } |
| | | this.transitionEnded = false; |
| | | this.setData({ classes: classNames['enter-to'] }); |
| | | }); |
| | | }); |
| | | }, |
| | | leave() { |
| | | if (!this.data.display) { |
| | | return; |
| | | } |
| | | const { duration, name } = this.data; |
| | | const classNames = getClassNames(name); |
| | | const currentDuration = isObj(duration) ? duration.leave : duration; |
| | | this.status = 'leave'; |
| | | this.$emit('before-leave'); |
| | | requestAnimationFrame(() => { |
| | | if (this.status !== 'leave') { |
| | | return; |
| | | } |
| | | this.$emit('leave'); |
| | | this.setData({ |
| | | classes: classNames.leave, |
| | | currentDuration, |
| | | }); |
| | | requestAnimationFrame(() => { |
| | | if (this.status !== 'leave') { |
| | | return; |
| | | } |
| | | this.transitionEnded = false; |
| | | setTimeout(() => this.onTransitionEnd(), currentDuration); |
| | | this.setData({ classes: classNames['leave-to'] }); |
| | | }); |
| | | }); |
| | | }, |
| | | onTransitionEnd() { |
| | | if (this.transitionEnded) { |
| | | return; |
| | | } |
| | | this.transitionEnded = true; |
| | | this.$emit(`after-${this.status}`); |
| | | const { show, display } = this.data; |
| | | if (!show && display) { |
| | | this.setData({ display: false }); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { getRect, getSystemInfoSync } from '../common/utils'; |
| | | VantComponent({ |
| | | classes: ['title-class'], |
| | | props: { |
| | | title: String, |
| | | fixed: { |
| | | type: Boolean, |
| | | observer: 'setHeight', |
| | | }, |
| | | placeholder: { |
| | | type: Boolean, |
| | | observer: 'setHeight', |
| | | }, |
| | | leftText: String, |
| | | rightText: String, |
| | | customStyle: String, |
| | | leftArrow: Boolean, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | safeAreaInsetTop: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | height: 46, |
| | | }, |
| | | created() { |
| | | const { statusBarHeight } = getSystemInfoSync(); |
| | | this.setData({ |
| | | statusBarHeight, |
| | | height: 46 + statusBarHeight, |
| | | }); |
| | | }, |
| | | mounted() { |
| | | this.setHeight(); |
| | | }, |
| | | methods: { |
| | | onClickLeft() { |
| | | this.$emit('click-left'); |
| | | }, |
| | | onClickRight() { |
| | | this.$emit('click-right'); |
| | | }, |
| | | setHeight() { |
| | | if (!this.data.fixed || !this.data.placeholder) { |
| | | return; |
| | | } |
| | | wx.nextTick(() => { |
| | | getRect(this, '.van-nav-bar').then((res) => { |
| | | if (res && 'height' in res) { |
| | | this.setData({ height: res.height }); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view wx:if="{{ fixed && placeholder }}" style="height: {{ height }}px;" /> |
| | | |
| | | <view |
| | | class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}" |
| | | style="{{ computed.barStyle({ zIndex, statusBarHeight, safeAreaInsetTop }) }}; {{ customStyle }}" |
| | | > |
| | | <view class="van-nav-bar__content"> |
| | | <view class="van-nav-bar__left" bind:tap="onClickLeft"> |
| | | <block wx:if="{{ leftArrow || leftText }}"> |
| | | <van-icon |
| | | wx:if="{{ leftArrow }}" |
| | | size="16px" |
| | | name="arrow-left" |
| | | custom-class="van-nav-bar__arrow" |
| | | /> |
| | | <view |
| | | wx:if="{{ leftText }}" |
| | | class="van-nav-bar__text" |
| | | hover-class="van-nav-bar__text--hover" |
| | | hover-stay-time="70" |
| | | >{{ leftText }}</view> |
| | | </block> |
| | | <slot wx:else name="left" /> |
| | | </view> |
| | | <view class="van-nav-bar__title title-class van-ellipsis"> |
| | | <block wx:if="{{ title }}">{{ title }}</block> |
| | | <slot wx:else name="title" /> |
| | | </view> |
| | | <view class="van-nav-bar__right" bind:tap="onClickRight"> |
| | | <view |
| | | wx:if="{{ rightText }}" |
| | | class="van-nav-bar__text" |
| | | hover-class="van-nav-bar__text--hover" |
| | | hover-stay-time="70" |
| | | >{{ rightText }}</view> |
| | | <slot wx:else name="right" /> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function barStyle(data) { |
| | | return style({ |
| | | 'z-index': data.zIndex, |
| | | 'padding-top': data.safeAreaInsetTop ? data.statusBarHeight + 'px' : 0, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | barStyle: barStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:46px;height:var(--nav-bar-height,46px);line-height:46px;line-height:var(--nav-bar-height,46px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar__content{position:relative;height:100%}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px!important;font-size:var(--nav-bar-arrow-size,16px)!important;color:#1989fa!important;color:var(--nav-bar-icon-color,#1989fa)!important}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;top:0;bottom:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { getRect, requestAnimationFrame } from '../common/utils'; |
| | | VantComponent({ |
| | | props: { |
| | | text: { |
| | | type: String, |
| | | value: '', |
| | | observer: 'init', |
| | | }, |
| | | mode: { |
| | | type: String, |
| | | value: '', |
| | | }, |
| | | url: { |
| | | type: String, |
| | | value: '', |
| | | }, |
| | | openType: { |
| | | type: String, |
| | | value: 'navigate', |
| | | }, |
| | | delay: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | speed: { |
| | | type: Number, |
| | | value: 50, |
| | | observer: 'init', |
| | | }, |
| | | scrollable: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | leftIcon: { |
| | | type: String, |
| | | value: '', |
| | | }, |
| | | color: String, |
| | | backgroundColor: String, |
| | | background: String, |
| | | wrapable: Boolean, |
| | | }, |
| | | data: { |
| | | show: true, |
| | | }, |
| | | created() { |
| | | this.resetAnimation = wx.createAnimation({ |
| | | duration: 0, |
| | | timingFunction: 'linear', |
| | | }); |
| | | }, |
| | | destroyed() { |
| | | this.timer && clearTimeout(this.timer); |
| | | }, |
| | | mounted() { |
| | | this.init(); |
| | | }, |
| | | methods: { |
| | | init() { |
| | | requestAnimationFrame(() => { |
| | | Promise.all([ |
| | | getRect(this, '.van-notice-bar__content'), |
| | | getRect(this, '.van-notice-bar__wrap'), |
| | | ]).then((rects) => { |
| | | const [contentRect, wrapRect] = rects; |
| | | if ( |
| | | contentRect == null || |
| | | wrapRect == null || |
| | | !contentRect.width || |
| | | !wrapRect.width |
| | | ) { |
| | | return; |
| | | } |
| | | const { speed, scrollable, delay } = this.data; |
| | | if (scrollable || wrapRect.width < contentRect.width) { |
| | | const duration = (contentRect.width / speed) * 1000; |
| | | this.wrapWidth = wrapRect.width; |
| | | this.contentWidth = contentRect.width; |
| | | this.duration = duration; |
| | | this.animation = wx.createAnimation({ |
| | | duration, |
| | | timingFunction: 'linear', |
| | | delay, |
| | | }); |
| | | this.scroll(); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | scroll() { |
| | | this.timer && clearTimeout(this.timer); |
| | | this.timer = null; |
| | | this.setData({ |
| | | animationData: this.resetAnimation |
| | | .translateX(this.wrapWidth) |
| | | .step() |
| | | .export(), |
| | | }); |
| | | requestAnimationFrame(() => { |
| | | this.setData({ |
| | | animationData: this.animation |
| | | .translateX(-this.contentWidth) |
| | | .step() |
| | | .export(), |
| | | }); |
| | | }); |
| | | this.timer = setTimeout(() => { |
| | | this.scroll(); |
| | | }, this.duration); |
| | | }, |
| | | onClickIcon(event) { |
| | | if (this.data.mode === 'closeable') { |
| | | this.timer && clearTimeout(this.timer); |
| | | this.timer = null; |
| | | this.setData({ show: false }); |
| | | this.$emit('close', event.detail); |
| | | } |
| | | }, |
| | | onClick(event) { |
| | | this.$emit('click', event); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | wx:if="{{ show }}" |
| | | class="custom-class {{ utils.bem('notice-bar', { withicon: mode, wrapable }) }}" |
| | | style="{{ computed.rootStyle({ color, backgroundColor, background }) }}" |
| | | bind:tap="onClick" |
| | | > |
| | | <van-icon |
| | | wx:if="{{ leftIcon }}" |
| | | size="16px" |
| | | name="{{ leftIcon }}" |
| | | class="van-notice-bar__left-icon" |
| | | /> |
| | | <slot wx:else name="left-icon" /> |
| | | |
| | | <view class="van-notice-bar__wrap"> |
| | | <view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}"> |
| | | {{ text }} |
| | | <slot wx:if="{{ !text }}"></slot> |
| | | </view> |
| | | </view> |
| | | |
| | | <van-icon |
| | | wx:if="{{ mode === 'closeable' }}" |
| | | class="van-notice-bar__right-icon" |
| | | name="cross" |
| | | catch:tap="onClickIcon" |
| | | /> |
| | | <navigator |
| | | wx:elif="{{ mode === 'link' }}" |
| | | url="{{ url }}" |
| | | open-type="{{ openType }}" |
| | | > |
| | | <van-icon class="van-notice-bar__right-icon" name="arrow" /> |
| | | </navigator> |
| | | <slot wx:else name="right-icon" /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | color: data.color, |
| | | 'background-color': data.backgroundColor, |
| | | background: data.background, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-notice-bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:40px;height:var(--notice-bar-height,40px);padding:0 16px;padding:var(--notice-bar-padding,0 16px);font-size:14px;font-size:var(--notice-bar-font-size,14px);color:#ed6a0c;color:var(--notice-bar-text-color,#ed6a0c);line-height:24px;line-height:var(--notice-bar-line-height,24px);background-color:#fffbe8;background-color:var(--notice-bar-background-color,#fffbe8)}.van-notice-bar--withicon{position:relative;padding-right:40px}.van-notice-bar--wrapable{height:auto;padding:8px 16px;padding:var(--notice-bar-wrapable-padding,8px 16px)}.van-notice-bar--wrapable .van-notice-bar__wrap{height:auto}.van-notice-bar--wrapable .van-notice-bar__content{position:relative;white-space:normal}.van-notice-bar__left-icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;margin-right:4px;vertical-align:middle}.van-notice-bar__left-icon,.van-notice-bar__right-icon{font-size:16px;font-size:var(--notice-bar-icon-size,16px);min-width:22px;min-width:var(--notice-bar-icon-min-width,22px)}.van-notice-bar__right-icon{position:absolute;top:10px;right:15px}.van-notice-bar__wrap{position:relative;-webkit-flex:1;flex:1;overflow:hidden;height:24px;height:var(--notice-bar-line-height,24px)}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { WHITE } from '../common/color'; |
| | | import { getSystemInfoSync } from '../common/utils'; |
| | | VantComponent({ |
| | | props: { |
| | | message: String, |
| | | background: String, |
| | | type: { |
| | | type: String, |
| | | value: 'danger', |
| | | }, |
| | | color: { |
| | | type: String, |
| | | value: WHITE, |
| | | }, |
| | | duration: { |
| | | type: Number, |
| | | value: 3000, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 110, |
| | | }, |
| | | safeAreaInsetTop: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | top: null, |
| | | }, |
| | | data: { |
| | | show: false, |
| | | onOpened: null, |
| | | onClose: null, |
| | | onClick: null, |
| | | }, |
| | | created() { |
| | | const { statusBarHeight } = getSystemInfoSync(); |
| | | this.setData({ statusBarHeight }); |
| | | }, |
| | | methods: { |
| | | show() { |
| | | const { duration, onOpened } = this.data; |
| | | clearTimeout(this.timer); |
| | | this.setData({ show: true }); |
| | | wx.nextTick(onOpened); |
| | | if (duration > 0 && duration !== Infinity) { |
| | | this.timer = setTimeout(() => { |
| | | this.hide(); |
| | | }, duration); |
| | | } |
| | | }, |
| | | hide() { |
| | | const { onClose } = this.data; |
| | | clearTimeout(this.timer); |
| | | this.setData({ show: false }); |
| | | wx.nextTick(onClose); |
| | | }, |
| | | onTap(event) { |
| | | const { onClick } = this.data; |
| | | if (onClick) { |
| | | onClick(event.detail); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-transition": "../transition/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <van-transition |
| | | name="slide-down" |
| | | show="{{ show }}" |
| | | custom-class="van-notify__container" |
| | | custom-style="{{ computed.rootStyle({ zIndex, top }) }}" |
| | | bind:tap="onTap" |
| | | > |
| | | <view |
| | | class="van-notify van-notify--{{ type }}" |
| | | style="{{ computed.notifyStyle({ background, color }) }}" |
| | | > |
| | | <view |
| | | wx:if="{{ safeAreaInsetTop }}" |
| | | style="height: {{ statusBarHeight }}px" |
| | | /> |
| | | <text>{{ message }}</text> |
| | | </view> |
| | | </van-transition> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | 'z-index': data.zIndex, |
| | | top: addUnit(data.top), |
| | | }); |
| | | } |
| | | |
| | | function notifyStyle(data) { |
| | | return style({ |
| | | background: data.background, |
| | | color: data.color, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | notifyStyle: notifyStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;left:0;box-sizing:border-box;width:100%}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | interface NotifyOptions { |
| | | type?: 'primary' | 'success' | 'danger' | 'warning'; |
| | | color?: string; |
| | | zIndex?: number; |
| | | top?: number; |
| | | message: string; |
| | | context?: any; |
| | | duration?: number; |
| | | selector?: string; |
| | | background?: string; |
| | | safeAreaInsetTop?: boolean; |
| | | onClick?: () => void; |
| | | onOpened?: () => void; |
| | | onClose?: () => void; |
| | | } |
| | | declare function Notify(options: NotifyOptions | string): any; |
| | | declare namespace Notify { |
| | | var clear: (options?: NotifyOptions | undefined) => void; |
| | | } |
| | | export default Notify; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { WHITE } from '../common/color'; |
| | | const defaultOptions = { |
| | | selector: '#van-notify', |
| | | type: 'danger', |
| | | message: '', |
| | | background: '', |
| | | duration: 3000, |
| | | zIndex: 110, |
| | | top: 0, |
| | | color: WHITE, |
| | | safeAreaInsetTop: false, |
| | | onClick: () => {}, |
| | | onOpened: () => {}, |
| | | onClose: () => {}, |
| | | }; |
| | | function parseOptions(message) { |
| | | if (message == null) { |
| | | return {}; |
| | | } |
| | | return typeof message === 'string' ? { message } : message; |
| | | } |
| | | function getContext() { |
| | | const pages = getCurrentPages(); |
| | | return pages[pages.length - 1]; |
| | | } |
| | | export default function Notify(options) { |
| | | options = Object.assign( |
| | | Object.assign({}, defaultOptions), |
| | | parseOptions(options) |
| | | ); |
| | | const context = options.context || getContext(); |
| | | const notify = context.selectComponent(options.selector); |
| | | delete options.context; |
| | | delete options.selector; |
| | | if (notify) { |
| | | notify.setData(options); |
| | | notify.show(); |
| | | return notify; |
| | | } |
| | | console.warn('æªæ¾å° van-notify èç¹ï¼è¯·ç¡®è®¤ selector å context æ¯å¦æ£ç¡®'); |
| | | } |
| | | Notify.clear = function (options) { |
| | | options = Object.assign( |
| | | Object.assign({}, defaultOptions), |
| | | parseOptions(options) |
| | | ); |
| | | const context = options.context || getContext(); |
| | | const notify = context.selectComponent(options.selector); |
| | | if (notify) { |
| | | notify.hide(); |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | show: Boolean, |
| | | customStyle: String, |
| | | duration: { |
| | | type: null, |
| | | value: 300, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | this.$emit('click'); |
| | | }, |
| | | // for prevent touchmove |
| | | noop() {}, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-transition": "../transition/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <van-transition |
| | | show="{{ show }}" |
| | | custom-class="van-overlay" |
| | | custom-style="z-index: {{ zIndex }}; {{ customStyle }}" |
| | | duration="{{ duration }}" |
| | | bind:tap="onClick" |
| | | catch:touchmove="noop" |
| | | > |
| | | <slot></slot> |
| | | </van-transition> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7);background-color:var(--overlay-background-color,rgba(0,0,0,.7))} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: ['header-class', 'footer-class'], |
| | | props: { |
| | | desc: String, |
| | | title: String, |
| | | status: String, |
| | | useFooterSlot: Boolean, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-cell": "../cell/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-panel van-hairline--top-bottom custom-class"> |
| | | <van-cell |
| | | wx:if="{{ title || desc || status }}" |
| | | title="{{ title }}" |
| | | label="{{ desc }}" |
| | | value="{{ status }}" |
| | | custom-class="header-class" |
| | | value-class="van-panel__header-value" |
| | | /> |
| | | <slot wx:else name="header" /> |
| | | |
| | | <view class="van-panel__content"> |
| | | <slot /> |
| | | </view> |
| | | |
| | | <view wx:if="{{ useFooterSlot }}" class="van-panel__footer van-hairline--top footer-class"> |
| | | <slot name="footer" /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-panel{background:#fff;background:var(--panel-background-color,#fff)}.van-panel__header-value{color:#ee0a24;color:var(--panel-header-value-color,#ee0a24)}.van-panel__footer{padding:8px 16px;padding:var(--panel-footer-padding,8px 16px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { range } from '../common/utils'; |
| | | import { isObj } from '../common/validator'; |
| | | const DEFAULT_DURATION = 200; |
| | | VantComponent({ |
| | | classes: ['active-class'], |
| | | props: { |
| | | valueKey: String, |
| | | className: String, |
| | | itemHeight: Number, |
| | | visibleItemCount: Number, |
| | | initialOptions: { |
| | | type: Array, |
| | | value: [], |
| | | }, |
| | | defaultIndex: { |
| | | type: Number, |
| | | value: 0, |
| | | observer(value) { |
| | | this.setIndex(value); |
| | | }, |
| | | }, |
| | | }, |
| | | data: { |
| | | startY: 0, |
| | | offset: 0, |
| | | duration: 0, |
| | | startOffset: 0, |
| | | options: [], |
| | | currentIndex: 0, |
| | | }, |
| | | created() { |
| | | const { defaultIndex, initialOptions } = this.data; |
| | | this.set({ |
| | | currentIndex: defaultIndex, |
| | | options: initialOptions, |
| | | }).then(() => { |
| | | this.setIndex(defaultIndex); |
| | | }); |
| | | }, |
| | | methods: { |
| | | getCount() { |
| | | return this.data.options.length; |
| | | }, |
| | | onTouchStart(event) { |
| | | this.setData({ |
| | | startY: event.touches[0].clientY, |
| | | startOffset: this.data.offset, |
| | | duration: 0, |
| | | }); |
| | | }, |
| | | onTouchMove(event) { |
| | | const { data } = this; |
| | | const deltaY = event.touches[0].clientY - data.startY; |
| | | this.setData({ |
| | | offset: range( |
| | | data.startOffset + deltaY, |
| | | -(this.getCount() * data.itemHeight), |
| | | data.itemHeight |
| | | ), |
| | | }); |
| | | }, |
| | | onTouchEnd() { |
| | | const { data } = this; |
| | | if (data.offset !== data.startOffset) { |
| | | this.setData({ duration: DEFAULT_DURATION }); |
| | | const index = range( |
| | | Math.round(-data.offset / data.itemHeight), |
| | | 0, |
| | | this.getCount() - 1 |
| | | ); |
| | | this.setIndex(index, true); |
| | | } |
| | | }, |
| | | onClickItem(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | this.setIndex(index, true); |
| | | }, |
| | | adjustIndex(index) { |
| | | const { data } = this; |
| | | const count = this.getCount(); |
| | | index = range(index, 0, count); |
| | | for (let i = index; i < count; i++) { |
| | | if (!this.isDisabled(data.options[i])) return i; |
| | | } |
| | | for (let i = index - 1; i >= 0; i--) { |
| | | if (!this.isDisabled(data.options[i])) return i; |
| | | } |
| | | }, |
| | | isDisabled(option) { |
| | | return isObj(option) && option.disabled; |
| | | }, |
| | | getOptionText(option) { |
| | | const { data } = this; |
| | | return isObj(option) && data.valueKey in option |
| | | ? option[data.valueKey] |
| | | : option; |
| | | }, |
| | | setIndex(index, userAction) { |
| | | const { data } = this; |
| | | index = this.adjustIndex(index) || 0; |
| | | const offset = -index * data.itemHeight; |
| | | if (index !== data.currentIndex) { |
| | | return this.set({ offset, currentIndex: index }).then(() => { |
| | | userAction && this.$emit('change', index); |
| | | }); |
| | | } |
| | | return this.set({ offset }); |
| | | }, |
| | | setValue(value) { |
| | | const { options } = this.data; |
| | | for (let i = 0; i < options.length; i++) { |
| | | if (this.getOptionText(options[i]) === value) { |
| | | return this.setIndex(i); |
| | | } |
| | | } |
| | | return Promise.resolve(); |
| | | }, |
| | | getValue() { |
| | | const { data } = this; |
| | | return data.options[data.currentIndex]; |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="van-picker-column custom-class" |
| | | style="{{ computed.rootStyle({ itemHeight, visibleItemCount }) }}" |
| | | bind:touchstart="onTouchStart" |
| | | catch:touchmove="onTouchMove" |
| | | bind:touchend="onTouchEnd" |
| | | bind:touchcancel="onTouchEnd" |
| | | > |
| | | <view style="{{ computed.wrapperStyle({ offset, itemHeight, visibleItemCount }) }}"> |
| | | <view |
| | | wx:for="{{ options }}" |
| | | wx:for-item="option" |
| | | wx:key="index" |
| | | data-index="{{ index }}" |
| | | style="height: {{ itemHeight }}px" |
| | | class="van-ellipsis {{ utils.bem('picker-column__item', { disabled: option && option.disabled, selected: index === currentIndex }) }} {{ index === currentIndex ? 'active-class' : '' }}" |
| | | bindtap="onClickItem" |
| | | >{{ computed.optionText(option, valueKey) }}</view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function isObj(x) { |
| | | var type = typeof x; |
| | | return x !== null && (type === 'object' || type === 'function'); |
| | | } |
| | | |
| | | function optionText(option, valueKey) { |
| | | return isObj(option) && option[valueKey] != null ? option[valueKey] : option; |
| | | } |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | height: addUnit(data.itemHeight * data.visibleItemCount), |
| | | }); |
| | | } |
| | | |
| | | function wrapperStyle(data) { |
| | | var offset = addUnit( |
| | | data.offset + (data.itemHeight * (data.visibleItemCount - 1)) / 2 |
| | | ); |
| | | |
| | | return style({ |
| | | transition: 'transform ' + data.duration + 'ms', |
| | | 'line-height': addUnit(data.itemHeight), |
| | | transform: 'translate3d(0, ' + offset + ', 0)', |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | optionText: optionText, |
| | | rootStyle: rootStyle, |
| | | wrapperStyle: wrapperStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-picker-column{overflow:hidden;text-align:center;color:#000;color:var(--picker-option-text-color,#000);font-size:16px;font-size:var(--picker-option-font-size,16px)}.van-picker-column__item{padding:0 5px}.van-picker-column__item--selected{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--picker-option-selected-text-color,#323233)}.van-picker-column__item--disabled{opacity:.3;opacity:var(--picker-option-disabled-opacity,.3)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { pickerProps } from './shared'; |
| | | VantComponent({ |
| | | classes: ['active-class', 'toolbar-class', 'column-class'], |
| | | props: Object.assign(Object.assign({}, pickerProps), { |
| | | valueKey: { |
| | | type: String, |
| | | value: 'text', |
| | | }, |
| | | toolbarPosition: { |
| | | type: String, |
| | | value: 'top', |
| | | }, |
| | | defaultIndex: { |
| | | type: Number, |
| | | value: 0, |
| | | }, |
| | | columns: { |
| | | type: Array, |
| | | value: [], |
| | | observer(columns = []) { |
| | | this.simple = columns.length && !columns[0].values; |
| | | if (Array.isArray(this.children) && this.children.length) { |
| | | this.setColumns().catch(() => {}); |
| | | } |
| | | }, |
| | | }, |
| | | }), |
| | | beforeCreate() { |
| | | Object.defineProperty(this, 'children', { |
| | | get: () => this.selectAllComponents('.van-picker__column') || [], |
| | | }); |
| | | }, |
| | | methods: { |
| | | noop() {}, |
| | | setColumns() { |
| | | const { data } = this; |
| | | const columns = this.simple ? [{ values: data.columns }] : data.columns; |
| | | const stack = columns.map((column, index) => |
| | | this.setColumnValues(index, column.values) |
| | | ); |
| | | return Promise.all(stack); |
| | | }, |
| | | emit(event) { |
| | | const { type } = event.currentTarget.dataset; |
| | | if (this.simple) { |
| | | this.$emit(type, { |
| | | value: this.getColumnValue(0), |
| | | index: this.getColumnIndex(0), |
| | | }); |
| | | } else { |
| | | this.$emit(type, { |
| | | value: this.getValues(), |
| | | index: this.getIndexes(), |
| | | }); |
| | | } |
| | | }, |
| | | onChange(event) { |
| | | if (this.simple) { |
| | | this.$emit('change', { |
| | | picker: this, |
| | | value: this.getColumnValue(0), |
| | | index: this.getColumnIndex(0), |
| | | }); |
| | | } else { |
| | | this.$emit('change', { |
| | | picker: this, |
| | | value: this.getValues(), |
| | | index: event.currentTarget.dataset.index, |
| | | }); |
| | | } |
| | | }, |
| | | // get column instance by index |
| | | getColumn(index) { |
| | | return this.children[index]; |
| | | }, |
| | | // get column value by index |
| | | getColumnValue(index) { |
| | | const column = this.getColumn(index); |
| | | return column && column.getValue(); |
| | | }, |
| | | // set column value by index |
| | | setColumnValue(index, value) { |
| | | const column = this.getColumn(index); |
| | | if (column == null) { |
| | | return Promise.reject(new Error('setColumnValue: 对åºåä¸åå¨')); |
| | | } |
| | | return column.setValue(value); |
| | | }, |
| | | // get column option index by column index |
| | | getColumnIndex(columnIndex) { |
| | | return (this.getColumn(columnIndex) || {}).data.currentIndex; |
| | | }, |
| | | // set column option index by column index |
| | | setColumnIndex(columnIndex, optionIndex) { |
| | | const column = this.getColumn(columnIndex); |
| | | if (column == null) { |
| | | return Promise.reject(new Error('setColumnIndex: 对åºåä¸åå¨')); |
| | | } |
| | | return column.setIndex(optionIndex); |
| | | }, |
| | | // get options of column by index |
| | | getColumnValues(index) { |
| | | return (this.children[index] || {}).data.options; |
| | | }, |
| | | // set options of column by index |
| | | setColumnValues(index, options, needReset = true) { |
| | | const column = this.children[index]; |
| | | if (column == null) { |
| | | return Promise.reject(new Error('setColumnValues: 对åºåä¸åå¨')); |
| | | } |
| | | const isSame = |
| | | JSON.stringify(column.data.options) === JSON.stringify(options); |
| | | if (isSame) { |
| | | return Promise.resolve(); |
| | | } |
| | | return column.set({ options }).then(() => { |
| | | if (needReset) { |
| | | column.setIndex(0); |
| | | } |
| | | }); |
| | | }, |
| | | // get values of all columns |
| | | getValues() { |
| | | return this.children.map((child) => child.getValue()); |
| | | }, |
| | | // set values of all columns |
| | | setValues(values) { |
| | | const stack = values.map((value, index) => |
| | | this.setColumnValue(index, value) |
| | | ); |
| | | return Promise.all(stack); |
| | | }, |
| | | // get indexes of all columns |
| | | getIndexes() { |
| | | return this.children.map((child) => child.data.currentIndex); |
| | | }, |
| | | // set indexes of all columns |
| | | setIndexes(indexes) { |
| | | const stack = indexes.map((optionIndex, columnIndex) => |
| | | this.setColumnIndex(columnIndex, optionIndex) |
| | | ); |
| | | return Promise.all(stack); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "picker-column": "../picker-column/index", |
| | | "loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="van-picker custom-class"> |
| | | <include wx:if="{{ toolbarPosition === 'top' }}" src="toolbar.wxml" /> |
| | | |
| | | <view wx:if="{{ loading }}" class="van-picker__loading"> |
| | | <loading color="#1989fa"/> |
| | | </view> |
| | | |
| | | <view |
| | | class="van-picker__columns" |
| | | style="{{ computed.columnsStyle({ itemHeight, visibleItemCount }) }}" |
| | | catch:touchmove="noop" |
| | | > |
| | | <picker-column |
| | | class="van-picker__column" |
| | | wx:for="{{ computed.columns(columns) }}" |
| | | wx:key="index" |
| | | data-index="{{ index }}" |
| | | custom-class="column-class" |
| | | value-key="{{ valueKey }}" |
| | | initial-options="{{ item.values }}" |
| | | default-index="{{ item.defaultIndex || defaultIndex }}" |
| | | item-height="{{ itemHeight }}" |
| | | visible-item-count="{{ visibleItemCount }}" |
| | | active-class="active-class" |
| | | bind:change="onChange" |
| | | /> |
| | | <view class="van-picker__mask" style="{{ computed.maskStyle({ itemHeight, visibleItemCount }) }}" /> |
| | | <view |
| | | class="van-picker__frame van-hairline--top-bottom" |
| | | style="{{ computed.frameStyle({ itemHeight }) }}" |
| | | /> |
| | | </view> |
| | | |
| | | <include wx:if="{{ toolbarPosition === 'bottom' }}" src="toolbar.wxml" /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | var array = require('../wxs/array.wxs'); |
| | | |
| | | function columnsStyle(data) { |
| | | return style({ |
| | | height: addUnit(data.itemHeight * data.visibleItemCount), |
| | | }); |
| | | } |
| | | |
| | | function maskStyle(data) { |
| | | return style({ |
| | | 'background-size': |
| | | '100% ' + addUnit((data.itemHeight * (data.visibleItemCount - 1)) / 2), |
| | | }); |
| | | } |
| | | |
| | | function frameStyle(data) { |
| | | return style({ |
| | | height: addUnit(data.itemHeight), |
| | | }); |
| | | } |
| | | |
| | | function columns(columns) { |
| | | if (!array.isArray(columns)) { |
| | | return []; |
| | | } |
| | | |
| | | if (columns.length && !columns[0].values) { |
| | | return [{ values: columns }]; |
| | | } |
| | | |
| | | return columns; |
| | | } |
| | | |
| | | module.exports = { |
| | | columnsStyle: columnsStyle, |
| | | frameStyle: frameStyle, |
| | | maskStyle: maskStyle, |
| | | columns: columns, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-picker{position:relative;overflow:hidden;-webkit-text-size-adjust:100%;-webkit-user-select:none;user-select:none;background-color:#fff;background-color:var(--picker-background-color,#fff)}.van-picker__toolbar{display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;height:44px;height:var(--picker-toolbar-height,44px);line-height:44px;line-height:var(--picker-toolbar-height,44px)}.van-picker__cancel,.van-picker__confirm{padding:0 16px;padding:var(--picker-action-padding,0 16px);font-size:14px;font-size:var(--picker-action-font-size,14px)}.van-picker__cancel--hover,.van-picker__confirm--hover{opacity:.7}.van-picker__confirm{color:#576b95;color:var(--picker-confirm-action-color,#576b95)}.van-picker__cancel{color:#969799;color:var(--picker-cancel-action-color,#969799)}.van-picker__title{max-width:50%;text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--picker-option-font-size,16px)}.van-picker__columns{position:relative;display:-webkit-flex;display:flex}.van-picker__column{-webkit-flex:1 1;flex:1 1;width:0}.van-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:4;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;background-color:hsla(0,0%,100%,.9);background-color:var(--picker-loading-mask-color,hsla(0,0%,100%,.9))}.van-picker__mask{top:0;left:0;z-index:2;width:100%;height:100%;background-image:linear-gradient(180deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4)),linear-gradient(0deg,hsla(0,0%,100%,.9),hsla(0,0%,100%,.4));background-repeat:no-repeat;background-position:top,bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden}.van-picker__frame,.van-picker__mask{position:absolute;pointer-events:none}.van-picker__frame{top:50%;right:16px;left:16px;z-index:1;-webkit-transform:translateY(-50%);transform:translateY(-50%)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const pickerProps: { |
| | | title: StringConstructor; |
| | | loading: BooleanConstructor; |
| | | showToolbar: BooleanConstructor; |
| | | cancelButtonText: { |
| | | type: StringConstructor; |
| | | value: string; |
| | | }; |
| | | confirmButtonText: { |
| | | type: StringConstructor; |
| | | value: string; |
| | | }; |
| | | visibleItemCount: { |
| | | type: NumberConstructor; |
| | | value: number; |
| | | }; |
| | | itemHeight: { |
| | | type: NumberConstructor; |
| | | value: number; |
| | | }; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export const pickerProps = { |
| | | title: String, |
| | | loading: Boolean, |
| | | showToolbar: Boolean, |
| | | cancelButtonText: { |
| | | type: String, |
| | | value: 'åæ¶', |
| | | }, |
| | | confirmButtonText: { |
| | | type: String, |
| | | value: '确认', |
| | | }, |
| | | visibleItemCount: { |
| | | type: Number, |
| | | value: 6, |
| | | }, |
| | | itemHeight: { |
| | | type: Number, |
| | | value: 44, |
| | | }, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view wx:if="{{ showToolbar }}" class="van-picker__toolbar toolbar-class"> |
| | | <view |
| | | class="van-picker__cancel" |
| | | hover-class="van-picker__cancel--hover" |
| | | hover-stay-time="70" |
| | | data-type="cancel" |
| | | bindtap="emit" |
| | | > |
| | | {{ cancelButtonText }} |
| | | </view> |
| | | <view wx:if="{{ title }}" class="van-picker__title van-ellipsis">{{ |
| | | title |
| | | }}</view> |
| | | <view |
| | | class="van-picker__confirm" |
| | | hover-class="van-picker__confirm--hover" |
| | | hover-stay-time="70" |
| | | data-type="confirm" |
| | | bindtap="emit" |
| | | > |
| | | {{ confirmButtonText }} |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { transition } from '../mixins/transition'; |
| | | VantComponent({ |
| | | classes: [ |
| | | 'enter-class', |
| | | 'enter-active-class', |
| | | 'enter-to-class', |
| | | 'leave-class', |
| | | 'leave-active-class', |
| | | 'leave-to-class', |
| | | 'close-icon-class', |
| | | ], |
| | | mixins: [transition(false)], |
| | | props: { |
| | | round: Boolean, |
| | | closeable: Boolean, |
| | | customStyle: String, |
| | | overlayStyle: String, |
| | | transition: { |
| | | type: String, |
| | | observer: 'observeClass', |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 100, |
| | | }, |
| | | overlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | closeIcon: { |
| | | type: String, |
| | | value: 'cross', |
| | | }, |
| | | closeIconPosition: { |
| | | type: String, |
| | | value: 'top-right', |
| | | }, |
| | | closeOnClickOverlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | position: { |
| | | type: String, |
| | | value: 'center', |
| | | observer: 'observeClass', |
| | | }, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | safeAreaInsetTop: { |
| | | type: Boolean, |
| | | value: false, |
| | | }, |
| | | }, |
| | | created() { |
| | | this.observeClass(); |
| | | }, |
| | | methods: { |
| | | onClickCloseIcon() { |
| | | this.$emit('close'); |
| | | }, |
| | | onClickOverlay() { |
| | | this.$emit('click-overlay'); |
| | | if (this.data.closeOnClickOverlay) { |
| | | this.$emit('close'); |
| | | } |
| | | }, |
| | | observeClass() { |
| | | const { transition, position, duration } = this.data; |
| | | const updateData = { |
| | | name: transition || position, |
| | | }; |
| | | if (transition === 'none') { |
| | | updateData.duration = 0; |
| | | this.originDuration = duration; |
| | | } else if (this.originDuration != null) { |
| | | updateData.duration = this.originDuration; |
| | | } |
| | | this.setData(updateData); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-overlay": "../overlay/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <van-overlay |
| | | wx:if="{{ overlay }}" |
| | | show="{{ show }}" |
| | | z-index="{{ zIndex }}" |
| | | custom-style="{{ overlayStyle }}" |
| | | duration="{{ duration }}" |
| | | bind:click="onClickOverlay" |
| | | /> |
| | | <view |
| | | wx:if="{{ inited }}" |
| | | class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}" |
| | | style="{{ computed.popupStyle({ zIndex, currentDuration, display, customStyle }) }}" |
| | | bind:transitionend="onTransitionEnd" |
| | | > |
| | | <slot /> |
| | | <van-icon |
| | | wx:if="{{ closeable }}" |
| | | name="{{ closeIcon }}" |
| | | class="close-icon-class van-popup__close-icon van-popup__close-icon--{{ closeIconPosition }}" |
| | | bind:tap="onClickCloseIcon" |
| | | /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function popupStyle(data) { |
| | | return style([ |
| | | { |
| | | 'z-index': data.zIndex, |
| | | '-webkit-transition-duration': data.currentDuration + 'ms', |
| | | 'transition-duration': data.currentDuration + 'ms', |
| | | }, |
| | | data.display ? null : 'display: none', |
| | | data.customStyle, |
| | | ]); |
| | | } |
| | | |
| | | module.exports = { |
| | | popupStyle: popupStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-popup{position:fixed;box-sizing:border-box;max-height:100%;overflow-y:auto;transition-timing-function:ease;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;background-color:#fff;background-color:var(--popup-background-color,#fff)}.van-popup--center{top:50%;left:50%;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:16px;border-radius:var(--popup-round-border-radius,16px)}.van-popup--top{top:0;left:0;width:100%}.van-popup--top.van-popup--round{border-radius:0 0 16px 16px;border-radius:0 0 var(--popup-round-border-radius,16px) var(--popup-round-border-radius,16px)}.van-popup--right{top:50%;right:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:16px 0 0 16px;border-radius:var(--popup-round-border-radius,16px) 0 0 var(--popup-round-border-radius,16px)}.van-popup--bottom{bottom:0;left:0;width:100%}.van-popup--bottom.van-popup--round{border-radius:16px 16px 0 0;border-radius:var(--popup-round-border-radius,16px) var(--popup-round-border-radius,16px) 0 0}.van-popup--left{top:50%;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 16px 16px 0;border-radius:0 var(--popup-round-border-radius,16px) var(--popup-round-border-radius,16px) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{position:absolute;z-index:1;z-index:var(--popup-close-icon-z-index,1);color:#969799;color:var(--popup-close-icon-color,#969799);font-size:18px;font-size:var(--popup-close-icon-size,18px)}.van-popup__close-icon--top-left{top:16px;top:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{top:16px;top:var(--popup-close-icon-margin,16px);right:16px;right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:16px;bottom:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{right:16px;right:var(--popup-close-icon-margin,16px);bottom:16px;bottom:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { BLUE } from '../common/color'; |
| | | import { getRect } from '../common/utils'; |
| | | VantComponent({ |
| | | props: { |
| | | inactive: Boolean, |
| | | percentage: { |
| | | type: Number, |
| | | observer: 'setLeft', |
| | | }, |
| | | pivotText: String, |
| | | pivotColor: String, |
| | | trackColor: String, |
| | | showPivot: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | color: { |
| | | type: String, |
| | | value: BLUE, |
| | | }, |
| | | textColor: { |
| | | type: String, |
| | | value: '#fff', |
| | | }, |
| | | strokeWidth: { |
| | | type: null, |
| | | value: 4, |
| | | }, |
| | | }, |
| | | data: { |
| | | right: 0, |
| | | }, |
| | | mounted() { |
| | | this.setLeft(); |
| | | }, |
| | | methods: { |
| | | setLeft() { |
| | | Promise.all([ |
| | | getRect(this, '.van-progress'), |
| | | getRect(this, '.van-progress__pivot'), |
| | | ]).then(([portion, pivot]) => { |
| | | if (portion && pivot) { |
| | | this.setData({ |
| | | right: (pivot.width * (this.data.percentage - 100)) / 100, |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="van-progress custom-class" |
| | | style="{{ computed.rootStyle({ strokeWidth, trackColor }) }}" |
| | | > |
| | | <view |
| | | class="van-progress__portion" |
| | | style="{{ computed.portionStyle({ percentage, inactive, color }) }}" |
| | | > |
| | | <view |
| | | wx:if="{{ showPivot && computed.pivotText(pivotText, percentage) }}" |
| | | style="{{ computed.pivotStyle({ textColor, pivotColor, inactive, color, right }) }}" |
| | | class="van-progress__pivot" |
| | | > |
| | | {{ computed.pivotText(pivotText, percentage) }} |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var utils = require('../wxs/utils.wxs'); |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function pivotText(pivotText, percentage) { |
| | | return pivotText || percentage + '%'; |
| | | } |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | 'height': data.strokeWidth ? utils.addUnit(data.strokeWidth) : '', |
| | | 'background': data.trackColor, |
| | | }); |
| | | } |
| | | |
| | | function portionStyle(data) { |
| | | return style({ |
| | | background: data.inactive ? '#cacaca' : data.color, |
| | | width: data.percentage ? data.percentage + '%' : '', |
| | | }); |
| | | } |
| | | |
| | | function pivotStyle(data) { |
| | | return style({ |
| | | color: data.textColor, |
| | | right: data.right + 'px', |
| | | background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | pivotText: pivotText, |
| | | rootStyle: rootStyle, |
| | | portionStyle: portionStyle, |
| | | pivotStyle: pivotStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-progress{position:relative;height:4px;height:var(--progress-height,4px);border-radius:4px;border-radius:var(--progress-height,4px);background:#ebedf0;background:var(--progress-background-color,#ebedf0)}.van-progress__portion{position:absolute;left:0;height:100%;border-radius:inherit;background:#1989fa;background:var(--progress-color,#1989fa)}.van-progress__pivot{position:absolute;top:50%;box-sizing:border-box;min-width:3.6em;text-align:center;word-break:keep-all;border-radius:1em;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#fff;color:var(--progress-pivot-text-color,#fff);padding:0 5px;padding:var(--progress-pivot-padding,0 5px);font-size:10px;font-size:var(--progress-pivot-font-size,10px);line-height:1.6;line-height:var(--progress-pivot-line-height,1.6);background-color:#1989fa;background-color:var(--progress-pivot-background-color,#1989fa)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useChildren('radio', function (target) { |
| | | this.updateChild(target); |
| | | }), |
| | | props: { |
| | | value: { |
| | | type: null, |
| | | observer: 'updateChildren', |
| | | }, |
| | | direction: String, |
| | | disabled: { |
| | | type: Boolean, |
| | | observer: 'updateChildren', |
| | | }, |
| | | }, |
| | | methods: { |
| | | updateChildren() { |
| | | this.children.forEach((child) => this.updateChild(child)); |
| | | }, |
| | | updateChild(child) { |
| | | const { value, disabled, direction } = this.data; |
| | | child.setData({ |
| | | value, |
| | | direction, |
| | | disabled: disabled || child.data.disabled, |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="{{ utils.bem('radio-group', [direction]) }}"> |
| | | <slot></slot> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-radio-group--horizontal{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | VantComponent({ |
| | | field: true, |
| | | relation: useParent('radio-group'), |
| | | classes: ['icon-class', 'label-class'], |
| | | props: { |
| | | name: null, |
| | | value: null, |
| | | disabled: Boolean, |
| | | useIconSlot: Boolean, |
| | | checkedColor: String, |
| | | labelPosition: { |
| | | type: String, |
| | | value: 'right', |
| | | }, |
| | | labelDisabled: Boolean, |
| | | shape: { |
| | | type: String, |
| | | value: 'round', |
| | | }, |
| | | iconSize: { |
| | | type: null, |
| | | value: 20, |
| | | }, |
| | | }, |
| | | methods: { |
| | | emitChange(value) { |
| | | const instance = this.parent || this; |
| | | instance.$emit('input', value); |
| | | instance.$emit('change', value); |
| | | }, |
| | | onChange() { |
| | | if (!this.data.disabled) { |
| | | this.emitChange(this.data.name); |
| | | } |
| | | }, |
| | | onClickLabel() { |
| | | const { disabled, labelDisabled, name } = this.data; |
| | | if (!disabled && !labelDisabled) { |
| | | this.emitChange(name); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="{{ utils.bem('radio', [direction]) }} custom-class"> |
| | | <view |
| | | wx:if="{{ labelPosition === 'left' }}" |
| | | class="label-class {{ utils.bem('radio__label', [labelPosition, { disabled }]) }}" |
| | | bindtap="onClickLabel" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | <view class="van-radio__icon-wrap" style="font-size: {{ utils.addUnit(iconSize) }};" bindtap="onChange"> |
| | | <slot wx:if="{{ useIconSlot }}" name="icon" /> |
| | | <van-icon |
| | | wx:else |
| | | name="success" |
| | | class="{{ utils.bem('radio__icon', [shape, { disabled, checked: value === name }]) }}" |
| | | style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && !disabled && value === name ? 'border-color:' + checkedColor + '; background-color:' + checkedColor + ';' : '' }}" |
| | | custom-class="icon-class" |
| | | custom-style="line-height: {{ utils.addUnit(iconSize) }};font-size: .8em;display: block;" |
| | | /> |
| | | </view> |
| | | <view |
| | | wx:if="{{ labelPosition === 'right' }}" |
| | | class="label-class {{ utils.bem('radio__label', [labelPosition, { disabled }]) }}" |
| | | bindtap="onClickLabel" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-radio{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-radio__icon-wrap{-webkit-flex:none;flex:none}.van-radio--horizontal{margin-right:12px;margin-right:var(--padding-sm,12px)}.van-radio__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;border:1px solid #c8c9cc;border:1px solid var(--radio-border-color,#c8c9cc);font-size:20px;font-size:var(--radio-size,20px);transition-duration:.2s;transition-duration:var(--radio-transition-duration,.2s)}.van-radio__icon--round{border-radius:100%}.van-radio__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--radio-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--radio-checked-icon-color,#1989fa)}.van-radio__icon--disabled{background-color:#ebedf0;background-color:var(--radio-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__icon--disabled.van-radio__icon--checked{color:#c8c9cc;color:var(--radio-disabled-icon-color,#c8c9cc)}.van-radio__label{word-wrap:break-word;margin-left:10px;margin-left:var(--radio-label-margin,10px);color:#323233;color:var(--radio-label-color,#323233);line-height:20px;line-height:var(--radio-size,20px)}.van-radio__label--left{float:left;margin:0 10px 0 0;margin:0 var(--radio-label-margin,10px) 0 0}.van-radio__label--disabled{color:#c8c9cc;color:var(--radio-disabled-label-color,#c8c9cc)}.van-radio__label:empty{margin:0} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { getAllRect } from '../common/utils'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { canIUseModel } from '../common/version'; |
| | | VantComponent({ |
| | | field: true, |
| | | classes: ['icon-class'], |
| | | props: { |
| | | value: { |
| | | type: Number, |
| | | observer(value) { |
| | | if (value !== this.data.innerValue) { |
| | | this.setData({ innerValue: value }); |
| | | } |
| | | }, |
| | | }, |
| | | readonly: Boolean, |
| | | disabled: Boolean, |
| | | allowHalf: Boolean, |
| | | size: null, |
| | | icon: { |
| | | type: String, |
| | | value: 'star', |
| | | }, |
| | | voidIcon: { |
| | | type: String, |
| | | value: 'star-o', |
| | | }, |
| | | color: { |
| | | type: String, |
| | | value: '#ffd21e', |
| | | }, |
| | | voidColor: { |
| | | type: String, |
| | | value: '#c7c7c7', |
| | | }, |
| | | disabledColor: { |
| | | type: String, |
| | | value: '#bdbdbd', |
| | | }, |
| | | count: { |
| | | type: Number, |
| | | value: 5, |
| | | observer(value) { |
| | | this.setData({ innerCountArray: Array.from({ length: value }) }); |
| | | }, |
| | | }, |
| | | gutter: null, |
| | | touchable: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | innerValue: 0, |
| | | innerCountArray: Array.from({ length: 5 }), |
| | | }, |
| | | methods: { |
| | | onSelect(event) { |
| | | const { data } = this; |
| | | const { score } = event.currentTarget.dataset; |
| | | if (!data.disabled && !data.readonly) { |
| | | this.setData({ innerValue: score + 1 }); |
| | | if (canIUseModel()) { |
| | | this.setData({ value: score + 1 }); |
| | | } |
| | | wx.nextTick(() => { |
| | | this.$emit('input', score + 1); |
| | | this.$emit('change', score + 1); |
| | | }); |
| | | } |
| | | }, |
| | | onTouchMove(event) { |
| | | const { touchable } = this.data; |
| | | if (!touchable) return; |
| | | const { clientX } = event.touches[0]; |
| | | getAllRect(this, '.van-rate__icon').then((list) => { |
| | | const target = list |
| | | .sort((item) => item.right - item.left) |
| | | .find((item) => clientX >= item.left && clientX <= item.right); |
| | | if (target != null) { |
| | | this.onSelect( |
| | | Object.assign(Object.assign({}, event), { currentTarget: target }) |
| | | ); |
| | | } |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="van-rate custom-class" |
| | | bind:touchmove="onTouchMove" |
| | | > |
| | | <view |
| | | class="van-rate__item" |
| | | wx:for="{{ innerCountArray }}" |
| | | wx:key="index" |
| | | style="padding-right: {{ index !== count - 1 ? utils.addUnit(gutter) : '' }}" |
| | | > |
| | | <van-icon |
| | | name="{{ index + 1 <= innerValue ? icon : voidIcon }}" |
| | | class="van-rate__icon" |
| | | style="font-size: {{ utils.addUnit(size) }}" |
| | | custom-class="icon-class" |
| | | data-score="{{ index }}" |
| | | color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}" |
| | | bind:click="onSelect" |
| | | /> |
| | | |
| | | <van-icon |
| | | wx:if="{{ allowHalf }}" |
| | | name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}" |
| | | class="{{ utils.bem('rate__icon', ['half']) }}" |
| | | style="font-size: {{ utils.addUnit(size) }}" |
| | | custom-class="icon-class" |
| | | data-score="{{ index - 0.5 }}" |
| | | color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}" |
| | | bind:click="onSelect" |
| | | /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-rate{display:-webkit-inline-flex;display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{position:relative;padding:0 2px;padding:0 var(--rate-horizontal-padding,2px)}.van-rate__icon{display:block;height:1em;font-size:20px;font-size:var(--rate-icon-size,20px)}.van-rate__icon--half{position:absolute;top:0;width:.5em;overflow:hidden;left:2px;left:var(--rate-horizontal-padding,2px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useChildren('col', function (target) { |
| | | const { gutter } = this.data; |
| | | if (gutter) { |
| | | target.setData({ gutter }); |
| | | } |
| | | }), |
| | | props: { |
| | | gutter: { |
| | | type: Number, |
| | | observer: 'setGutter', |
| | | }, |
| | | }, |
| | | methods: { |
| | | setGutter() { |
| | | this.children.forEach((col) => { |
| | | col.setData(this.data); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="van-row custom-class" style="{{ computed.rootStyle({ gutter }) }}"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | if (!data.gutter) { |
| | | return ''; |
| | | } |
| | | |
| | | return style({ |
| | | 'margin-right': addUnit(-data.gutter / 2), |
| | | 'margin-left': addUnit(-data.gutter / 2), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-row:after{display:table;clear:both;content:""} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { canIUseModel } from '../common/version'; |
| | | VantComponent({ |
| | | field: true, |
| | | classes: ['field-class', 'input-class', 'cancel-class'], |
| | | props: { |
| | | label: String, |
| | | focus: Boolean, |
| | | error: Boolean, |
| | | disabled: Boolean, |
| | | readonly: Boolean, |
| | | inputAlign: String, |
| | | showAction: Boolean, |
| | | useActionSlot: Boolean, |
| | | useLeftIconSlot: Boolean, |
| | | useRightIconSlot: Boolean, |
| | | leftIcon: { |
| | | type: String, |
| | | value: 'search', |
| | | }, |
| | | rightIcon: String, |
| | | placeholder: String, |
| | | placeholderStyle: String, |
| | | actionText: { |
| | | type: String, |
| | | value: 'åæ¶', |
| | | }, |
| | | background: { |
| | | type: String, |
| | | value: '#ffffff', |
| | | }, |
| | | maxlength: { |
| | | type: Number, |
| | | value: -1, |
| | | }, |
| | | shape: { |
| | | type: String, |
| | | value: 'square', |
| | | }, |
| | | clearable: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | methods: { |
| | | onChange(event) { |
| | | if (canIUseModel()) { |
| | | this.setData({ value: event.detail }); |
| | | } |
| | | this.$emit('change', event.detail); |
| | | }, |
| | | onCancel() { |
| | | /** |
| | | * ä¿®å¤ä¿®æ¹è¾å
¥æ¡å¼æ¶ï¼è¾å
¥æ¡å¤±ç¦åèµå¼åæ¶è§¦åï¼èµå¼å¤±æ |
| | | * https://github.com/youzan/@vant/weapp/issues/1768 |
| | | */ |
| | | setTimeout(() => { |
| | | if (canIUseModel()) { |
| | | this.setData({ value: '' }); |
| | | } |
| | | this.$emit('cancel'); |
| | | this.$emit('change', ''); |
| | | }, 200); |
| | | }, |
| | | onSearch(event) { |
| | | this.$emit('search', event.detail); |
| | | }, |
| | | onFocus(event) { |
| | | this.$emit('focus', event.detail); |
| | | }, |
| | | onBlur(event) { |
| | | this.$emit('blur', event.detail); |
| | | }, |
| | | onClear(event) { |
| | | this.$emit('clear', event.detail); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-field": "../field/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="{{ utils.bem('search', { withaction: showAction || useActionSlot }) }} custom-class" |
| | | style="background: {{ background }}" |
| | | > |
| | | <view class="{{ utils.bem('search__content', [shape]) }}"> |
| | | <view class="van-search__label" wx:if="{{ label }}">{{ label }}</view> |
| | | <slot wx:else name="label" /> |
| | | |
| | | <van-field |
| | | type="search" |
| | | left-icon="{{ !useLeftIconSlot ? leftIcon : '' }}" |
| | | right-icon="{{ !useRightIconSlot ? rightIcon : '' }}" |
| | | focus="{{ focus }}" |
| | | error="{{ error }}" |
| | | border="{{ false }}" |
| | | confirm-type="search" |
| | | class="van-search__field field-class" |
| | | value="{{ value }}" |
| | | disabled="{{ disabled }}" |
| | | readonly="{{ readonly }}" |
| | | clearable="{{ clearable }}" |
| | | maxlength="{{ maxlength }}" |
| | | input-align="{{ inputAlign }}" |
| | | input-class="input-class" |
| | | placeholder="{{ placeholder }}" |
| | | placeholder-style="{{ placeholderStyle }}" |
| | | custom-style="padding: 5px 10px 5px 0; background-color: transparent;" |
| | | bind:blur="onBlur" |
| | | bind:focus="onFocus" |
| | | bind:change="onChange" |
| | | bind:confirm="onSearch" |
| | | bind:clear="onClear" |
| | | > |
| | | <slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" /> |
| | | <slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" /> |
| | | </van-field> |
| | | </view> |
| | | |
| | | <view |
| | | wx:if="{{ showAction || useActionSlot }}" |
| | | class="van-search__action" |
| | | hover-class="van-search__action--hover" |
| | | hover-stay-time="70" |
| | | > |
| | | <slot wx:if="{{ useActionSlot }}" name="action" /> |
| | | <view wx:else bind:tap="onCancel" class="cancel-class">{{ actionText }}</view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-search{-webkit-align-items:center;align-items:center;box-sizing:border-box;padding:10px 12px;padding:var(--search-padding,10px 12px)}.van-search,.van-search__content{display:-webkit-flex;display:flex}.van-search__content{-webkit-flex:1;flex:1;padding-left:12px;padding-left:var(--padding-sm,12px);border-radius:2px;border-radius:var(--border-radius-sm,2px);background-color:#f7f8fa;background-color:var(--search-background-color,#f7f8fa)}.van-search__content--round{border-radius:17px;border-radius:calc(var(--search-input-height, 34px)/2)}.van-search__label{padding:0 5px;padding:var(--search-label-padding,0 5px);font-size:14px;font-size:var(--search-label-font-size,14px);line-height:34px;line-height:var(--search-input-height,34px);color:#323233;color:var(--search-label-color,#323233)}.van-search__field{-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#969799;color:var(--search-left-icon-color,#969799)}.van-search--withaction{padding-right:0}.van-search__action{padding:0 8px;padding:var(--search-action-padding,0 8px);font-size:14px;font-size:var(--search-action-font-size,14px);line-height:34px;line-height:var(--search-input-height,34px);color:#323233;color:var(--search-action-text-color,#323233)}.van-search__action--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | // whether to show popup |
| | | show: Boolean, |
| | | // overlay custom style |
| | | overlayStyle: Object, |
| | | // z-index |
| | | zIndex: { |
| | | type: Number, |
| | | value: 100, |
| | | }, |
| | | title: String, |
| | | cancelText: { |
| | | type: String, |
| | | value: 'åæ¶', |
| | | }, |
| | | description: String, |
| | | options: { |
| | | type: Array, |
| | | value: [], |
| | | }, |
| | | overlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | closeOnClickOverlay: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | duration: { |
| | | type: null, |
| | | value: 300, |
| | | }, |
| | | }, |
| | | methods: { |
| | | onClickOverlay() { |
| | | this.$emit('click-overlay'); |
| | | }, |
| | | onCancel() { |
| | | this.onClose(); |
| | | this.$emit('cancel'); |
| | | }, |
| | | onSelect(event) { |
| | | this.$emit('select', event.detail); |
| | | }, |
| | | onClose() { |
| | | this.$emit('close'); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-popup": "../popup/index", |
| | | "options": "./options" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <van-popup |
| | | round |
| | | class="van-share-sheet" |
| | | show="{{ show }}" |
| | | position="bottom" |
| | | overlay="{{ overlay }}" |
| | | duration="{{ duration }}" |
| | | z-index="{{ zIndex }}" |
| | | overlay-style="{{ overlayStyle }}" |
| | | close-on-click-overlay="{{ closeOnClickOverlay }}" |
| | | safe-area-inset-bottom="{{ safeAreaInsetBottom }}" |
| | | bind:close="onClose" |
| | | bind:click-overlay="onClickOverlay" |
| | | > |
| | | <view class="van-share-sheet__header"> |
| | | <view class="van-share-sheet__title"> |
| | | <slot name="title" /> |
| | | </view> |
| | | <view wx:if="{{ title }}" class="van-share-sheet__title">{{ title }}</view> |
| | | |
| | | <view class="van-share-sheet__description"> |
| | | <slot name="description" /> |
| | | </view> |
| | | <view wx:if="{{ description }}" class="van-share-sheet__description"> |
| | | {{ description }} |
| | | </view> |
| | | </view> |
| | | |
| | | <block wx:if="{{ computed.isMulti(options) }}"> |
| | | <options |
| | | wx:for="{{ options }}" |
| | | show-border="{{ index !== 0 }}" |
| | | wx:key="index" |
| | | options="{{ item }}" |
| | | bind:select="onSelect" |
| | | /> |
| | | </block> |
| | | |
| | | <options wx:else options="{{ options }}" bind:select="onSelect" /> |
| | | |
| | | <button type="button" class="van-share-sheet__cancel" bindtap="onCancel"> |
| | | {{ cancelText }} |
| | | </button> |
| | | </van-popup> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | function isMulti(options) { |
| | | if (options == null || options[0] == null) { |
| | | return false; |
| | | } |
| | | |
| | | return "Array" === options.constructor && "Array" === options[0].constructor; |
| | | } |
| | | |
| | | module.exports = { |
| | | isMulti: isMulti |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-share-sheet__header{padding:12px 16px 4px;text-align:center}.van-share-sheet__title{margin-top:8px;color:#323233;font-weight:400;font-size:14px;line-height:20px}.van-share-sheet__title:empty,.van-share-sheet__title:not(:empty)+.van-share-sheet__title{display:none}.van-share-sheet__description{display:block;margin-top:8px;color:#969799;font-size:12px;line-height:16px}.van-share-sheet__description:empty,.van-share-sheet__description:not(:empty)+.van-share-sheet__description{display:none}.van-share-sheet__cancel{display:block;box-sizing:initial;width:100%;height:auto;padding:0;font-size:16px;line-height:48px;text-align:center;background:#fff;border:none}.van-share-sheet__cancel:before{display:block;height:8px;background-color:#f7f8fa;content:" "}.van-share-sheet__cancel:after{display:none}.van-share-sheet__cancel:active{background-color:#f2f3f5} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | options: Array, |
| | | showBorder: Boolean, |
| | | }, |
| | | methods: { |
| | | onSelect(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const option = this.data.options[index]; |
| | | this.$emit('select', Object.assign(Object.assign({}, option), { index })); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./options.wxs" module="computed" /> |
| | | |
| | | <view class="{{ utils.bem('share-sheet__options', { border: showBorder }) }}"> |
| | | <view |
| | | wx:for="{{ options }}" |
| | | wx:key="index" |
| | | class="van-share-sheet__option" |
| | | data-index="{{ index }}" |
| | | bindtap="onSelect" |
| | | > |
| | | <button class="van-share-sheet__button" open-type="{{ item.openType }}"> |
| | | <image src="{{ computed.getIconURL(item.icon) }}" class="van-share-sheet__icon" /> |
| | | </button> |
| | | <view wx:if="{{ item.name }}" class="van-share-sheet__name">{{ item.name }}</view> |
| | | <view wx:if="{{ item.description }}" class="van-share-sheet__option-description"> |
| | | {{ item.description }} |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var PRESET_ICONS = ['qq', 'weibo', 'wechat', 'link', 'qrcode', 'poster']; |
| | | |
| | | function getIconURL(icon) { |
| | | if (PRESET_ICONS.indexOf(icon) !== -1) { |
| | | return 'https://img.yzcdn.cn/vant/share-icon-' + icon + '.png'; |
| | | } |
| | | |
| | | return icon; |
| | | } |
| | | |
| | | module.exports = { |
| | | getIconURL: getIconURL, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-share-sheet__options{position:relative;display:-webkit-flex;display:flex;padding:16px 0 16px 8px;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch}.van-share-sheet__options--border:before{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:0;right:0;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{height:auto;padding:0;line-height:inherit;background-color:initial;border:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{width:48px;height:48px;margin:0 16px}.van-share-sheet__name{margin-top:8px;padding:0 4px;color:#646566;font-size:12px}.van-share-sheet__option-description{padding:0 4px;color:#c8c9cc;font-size:12px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | VantComponent({ |
| | | classes: ['active-class', 'disabled-class'], |
| | | relation: useParent('sidebar'), |
| | | props: { |
| | | dot: Boolean, |
| | | badge: null, |
| | | info: null, |
| | | title: String, |
| | | disabled: Boolean, |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | const { parent } = this; |
| | | if (!parent || this.data.disabled) { |
| | | return; |
| | | } |
| | | const index = parent.children.indexOf(this); |
| | | parent.setActive(index).then(() => { |
| | | this.$emit('click', index); |
| | | parent.$emit('change', index); |
| | | }); |
| | | }, |
| | | setActive(selected) { |
| | | return this.setData({ selected }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-info": "../info/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="{{ utils.bem('sidebar-item', { selected, disabled }) }} {{ selected ? 'active-class' : '' }} {{ disabled ? 'disabled-class' : '' }} custom-class" |
| | | hover-class="van-sidebar-item--hover" |
| | | hover-stay-time="70" |
| | | bind:tap="onClick" |
| | | > |
| | | <view class="van-sidebar-item__text"> |
| | | <van-info |
| | | wx:if="{{ badge != null || info !== null || dot }}" |
| | | dot="{{ dot }}" |
| | | info="{{ badge != null ? badge : info }}" |
| | | /> |
| | | <view wx:if="{{ title }}">{{ title }}</view> |
| | | <slot wx:else name="title" /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-sidebar-item{display:block;box-sizing:border-box;overflow:hidden;border-left:3px solid transparent;-webkit-user-select:none;user-select:none;padding:20px 12px 20px 8px;padding:var(--sidebar-padding,20px 12px 20px 8px);font-size:14px;font-size:var(--sidebar-font-size,14px);line-height:20px;line-height:var(--sidebar-line-height,20px);color:#323233;color:var(--sidebar-text-color,#323233);background-color:#f7f8fa;background-color:var(--sidebar-background-color,#f7f8fa)}.van-sidebar-item__text{position:relative;display:inline-block;word-break:break-all}.van-sidebar-item--hover:not(.van-sidebar-item--disabled){background-color:#f2f3f5;background-color:var(--sidebar-active-color,#f2f3f5)}.van-sidebar-item:after{border-bottom-width:1px}.van-sidebar-item--selected{color:#323233;color:var(--sidebar-selected-text-color,#323233);font-weight:500;font-weight:var(--sidebar-selected-font-weight,500);border-color:#ee0a24;border-color:var(--sidebar-selected-border-color,#ee0a24)}.van-sidebar-item--selected:after{border-right-width:1px}.van-sidebar-item--selected,.van-sidebar-item--selected.van-sidebar-item--hover{background-color:#fff;background-color:var(--sidebar-selected-background-color,#fff)}.van-sidebar-item--disabled{color:#c8c9cc;color:var(--sidebar-disabled-text-color,#c8c9cc)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | relation: useChildren('sidebar-item', function () { |
| | | this.setActive(this.data.activeKey); |
| | | }), |
| | | props: { |
| | | activeKey: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'setActive', |
| | | }, |
| | | }, |
| | | beforeCreate() { |
| | | this.currentActive = -1; |
| | | }, |
| | | methods: { |
| | | setActive(activeKey) { |
| | | const { children, currentActive } = this; |
| | | if (!children.length) { |
| | | return Promise.resolve(); |
| | | } |
| | | this.currentActive = activeKey; |
| | | const stack = []; |
| | | if (currentActive !== activeKey && children[currentActive]) { |
| | | stack.push(children[currentActive].setActive(false)); |
| | | } |
| | | if (children[activeKey]) { |
| | | stack.push(children[activeKey].setActive(true)); |
| | | } |
| | | return Promise.all(stack); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view class="van-sidebar custom-class"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-sidebar{width:80px;width:var(--sidebar-width,80px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: ['avatar-class', 'title-class', 'row-class'], |
| | | props: { |
| | | row: { |
| | | type: Number, |
| | | value: 0, |
| | | observer(value) { |
| | | this.setData({ rowArray: Array.from({ length: value }) }); |
| | | }, |
| | | }, |
| | | title: Boolean, |
| | | avatar: Boolean, |
| | | loading: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | animate: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | avatarSize: { |
| | | type: String, |
| | | value: '32px', |
| | | }, |
| | | avatarShape: { |
| | | type: String, |
| | | value: 'round', |
| | | }, |
| | | titleWidth: { |
| | | type: String, |
| | | value: '40%', |
| | | }, |
| | | rowWidth: { |
| | | type: null, |
| | | value: '100%', |
| | | observer(val) { |
| | | this.setData({ isArray: val instanceof Array }); |
| | | }, |
| | | }, |
| | | }, |
| | | data: { |
| | | isArray: false, |
| | | rowArray: [], |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": {} |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | wx:if="{{ loading }}" |
| | | class="custom-class {{ utils.bem('skeleton', [{animate}]) }}" |
| | | > |
| | | <view |
| | | wx:if="{{ avatar }}" |
| | | class="avatar-class {{ utils.bem('skeleton__avatar', [avatarShape])}}" |
| | | style="{{ 'width:' + avatarSize + ';height:' + avatarSize }}" |
| | | /> |
| | | <view class="{{ utils.bem('skeleton__content')}}"> |
| | | <view |
| | | wx:if="{{ title }}" |
| | | class="title-class {{ utils.bem('skeleton__title') }}" |
| | | style="{{ 'width:' + titleWidth }}" |
| | | /> |
| | | <view |
| | | wx:for="{{ rowArray }}" |
| | | wx:key="index" |
| | | wx:for-index="index" |
| | | class="row-class {{ utils.bem('skeleton__row') }}" |
| | | style="{{ 'width:' + (isArray ? rowWidth[index] : rowWidth) }}" |
| | | /> |
| | | </view> |
| | | </view> |
| | | <view wx:else class="{{ utils.bem('skeleton__content')}}"> |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-skeleton{display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:0 16px;padding:var(--skeleton-padding,0 16px)}.van-skeleton__avatar{-webkit-flex-shrink:0;flex-shrink:0;margin-right:16px;margin-right:var(--padding-md,16px);background-color:#f2f3f5;background-color:var(--skeleton-avatar-background-color,#f2f3f5)}.van-skeleton__avatar--round{border-radius:100%}.van-skeleton__content{-webkit-flex:1;flex:1}.van-skeleton__avatar+.van-skeleton__content{padding-top:8px;padding-top:var(--padding-xs,8px)}.van-skeleton__row,.van-skeleton__title{height:16px;height:var(--skeleton-row-height,16px);background-color:#f2f3f5;background-color:var(--skeleton-row-background-color,#f2f3f5)}.van-skeleton__title{margin:0}.van-skeleton__row:not(:first-child){margin-top:12px;margin-top:var(--skeleton-row-margin-top,12px)}.van-skeleton__title+.van-skeleton__row{margin-top:20px}.van-skeleton--animate{-webkit-animation:van-skeleton-blink 1.2s ease-in-out infinite;animation:van-skeleton-blink 1.2s ease-in-out infinite}@-webkit-keyframes van-skeleton-blink{50%{opacity:.6}}@keyframes van-skeleton-blink{50%{opacity:.6}} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { touch } from '../mixins/touch'; |
| | | import { canIUseModel } from '../common/version'; |
| | | import { getRect } from '../common/utils'; |
| | | VantComponent({ |
| | | mixins: [touch], |
| | | props: { |
| | | disabled: Boolean, |
| | | useButtonSlot: Boolean, |
| | | activeColor: String, |
| | | inactiveColor: String, |
| | | max: { |
| | | type: Number, |
| | | value: 100, |
| | | }, |
| | | min: { |
| | | type: Number, |
| | | value: 0, |
| | | }, |
| | | step: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | value: { |
| | | type: Number, |
| | | value: 0, |
| | | observer(val) { |
| | | if (val !== this.value) { |
| | | this.updateValue(val); |
| | | } |
| | | }, |
| | | }, |
| | | barHeight: { |
| | | type: null, |
| | | value: 2, |
| | | }, |
| | | }, |
| | | created() { |
| | | this.updateValue(this.data.value); |
| | | }, |
| | | methods: { |
| | | onTouchStart(event) { |
| | | if (this.data.disabled) return; |
| | | this.touchStart(event); |
| | | this.startValue = this.format(this.value); |
| | | this.dragStatus = 'start'; |
| | | }, |
| | | onTouchMove(event) { |
| | | if (this.data.disabled) return; |
| | | if (this.dragStatus === 'start') { |
| | | this.$emit('drag-start'); |
| | | } |
| | | this.touchMove(event); |
| | | this.dragStatus = 'draging'; |
| | | getRect(this, '.van-slider').then((rect) => { |
| | | const diff = (this.deltaX / rect.width) * this.getRange(); |
| | | this.newValue = this.startValue + diff; |
| | | this.updateValue(this.newValue, false, true); |
| | | }); |
| | | }, |
| | | onTouchEnd() { |
| | | if (this.data.disabled) return; |
| | | if (this.dragStatus === 'draging') { |
| | | this.updateValue(this.newValue, true); |
| | | this.$emit('drag-end'); |
| | | } |
| | | }, |
| | | onClick(event) { |
| | | if (this.data.disabled) return; |
| | | const { min } = this.data; |
| | | getRect(this, '.van-slider').then((rect) => { |
| | | const value = |
| | | ((event.detail.x - rect.left) / rect.width) * this.getRange() + min; |
| | | this.updateValue(value, true); |
| | | }); |
| | | }, |
| | | updateValue(value, end, drag) { |
| | | value = this.format(value); |
| | | const { min } = this.data; |
| | | const width = `${((value - min) * 100) / this.getRange()}%`; |
| | | this.value = value; |
| | | this.setData({ |
| | | barStyle: ` |
| | | width: ${width}; |
| | | ${drag ? 'transition: none;' : ''} |
| | | `, |
| | | }); |
| | | if (drag) { |
| | | this.$emit('drag', { value }); |
| | | } |
| | | if (end) { |
| | | this.$emit('change', value); |
| | | } |
| | | if ((drag || end) && canIUseModel()) { |
| | | this.setData({ value }); |
| | | } |
| | | }, |
| | | getRange() { |
| | | const { max, min } = this.data; |
| | | return max - min; |
| | | }, |
| | | format(value) { |
| | | const { max, min, step } = this.data; |
| | | return Math.round(Math.max(min, Math.min(value, max)) / step) * step; |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('slider', { disabled }) }}" |
| | | style="{{ inactiveColor ? 'background:' + inactiveColor : '' }}" |
| | | bind:tap="onClick" |
| | | > |
| | | <view |
| | | class="van-slider__bar" |
| | | style="{{ barStyle }};{{ computed.barStyle(barHeight, activeColor) }}" |
| | | > |
| | | <view |
| | | class="van-slider__button-wrapper" |
| | | bind:touchstart="onTouchStart" |
| | | catch:touchmove="onTouchMove" |
| | | bind:touchend="onTouchEnd" |
| | | bind:touchcancel="onTouchEnd" |
| | | > |
| | | <slot |
| | | wx:if="{{ useButtonSlot }}" |
| | | name="button" |
| | | /> |
| | | <view |
| | | wx:else |
| | | class="van-slider__button" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function barStyle(barHeight, activeColor) { |
| | | return style({ |
| | | height: addUnit(barHeight), |
| | | background: activeColor, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | barStyle: barStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;border-radius:var(--border-radius-max,999px);background-color:#ebedf0;background-color:var(--slider-inactive-background-color,#ebedf0)}.van-slider:before{position:absolute;right:0;left:0;content:"";top:-8px;top:-var(--padding-xs,8px);bottom:-8px;bottom:-var(--padding-xs,8px)}.van-slider__bar{position:relative;border-radius:inherit;transition:width .2s;transition:width var(--animation-duration-fast,.2s);background-color:#1989fa;background-color:var(--slider-active-background-color,#1989fa)}.van-slider__button{width:24px;height:24px;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.5);background-color:#fff;background-color:var(--slider-button-background-color,#fff)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider--disabled{opacity:.5} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { isDef } from '../common/validator'; |
| | | const LONG_PRESS_START_TIME = 600; |
| | | const LONG_PRESS_INTERVAL = 200; |
| | | // add num and avoid float number |
| | | function add(num1, num2) { |
| | | const cardinal = Math.pow(10, 10); |
| | | return Math.round((num1 + num2) * cardinal) / cardinal; |
| | | } |
| | | function equal(value1, value2) { |
| | | return String(value1) === String(value2); |
| | | } |
| | | VantComponent({ |
| | | field: true, |
| | | classes: ['input-class', 'plus-class', 'minus-class'], |
| | | props: { |
| | | value: { |
| | | type: null, |
| | | observer: 'observeValue', |
| | | }, |
| | | integer: { |
| | | type: Boolean, |
| | | observer: 'check', |
| | | }, |
| | | disabled: Boolean, |
| | | inputWidth: String, |
| | | buttonSize: String, |
| | | asyncChange: Boolean, |
| | | disableInput: Boolean, |
| | | decimalLength: { |
| | | type: Number, |
| | | value: null, |
| | | observer: 'check', |
| | | }, |
| | | min: { |
| | | type: null, |
| | | value: 1, |
| | | observer: 'check', |
| | | }, |
| | | max: { |
| | | type: null, |
| | | value: Number.MAX_SAFE_INTEGER, |
| | | observer: 'check', |
| | | }, |
| | | step: { |
| | | type: null, |
| | | value: 1, |
| | | }, |
| | | showPlus: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showMinus: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | disablePlus: Boolean, |
| | | disableMinus: Boolean, |
| | | longPress: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | theme: String, |
| | | }, |
| | | data: { |
| | | currentValue: '', |
| | | }, |
| | | created() { |
| | | this.setData({ |
| | | currentValue: this.format(this.data.value), |
| | | }); |
| | | }, |
| | | methods: { |
| | | observeValue() { |
| | | const { value, currentValue } = this.data; |
| | | if (!equal(value, currentValue)) { |
| | | this.setData({ currentValue: this.format(value) }); |
| | | } |
| | | }, |
| | | check() { |
| | | const val = this.format(this.data.currentValue); |
| | | if (!equal(val, this.data.currentValue)) { |
| | | this.setData({ currentValue: val }); |
| | | } |
| | | }, |
| | | isDisabled(type) { |
| | | const { |
| | | disabled, |
| | | disablePlus, |
| | | disableMinus, |
| | | currentValue, |
| | | max, |
| | | min, |
| | | } = this.data; |
| | | if (type === 'plus') { |
| | | return disabled || disablePlus || currentValue >= max; |
| | | } |
| | | return disabled || disableMinus || currentValue <= min; |
| | | }, |
| | | onFocus(event) { |
| | | this.$emit('focus', event.detail); |
| | | }, |
| | | onBlur(event) { |
| | | const value = this.format(event.detail.value); |
| | | this.emitChange(value); |
| | | this.$emit( |
| | | 'blur', |
| | | Object.assign(Object.assign({}, event.detail), { value }) |
| | | ); |
| | | }, |
| | | // filter illegal characters |
| | | filter(value) { |
| | | value = String(value).replace(/[^0-9.-]/g, ''); |
| | | if (this.data.integer && value.indexOf('.') !== -1) { |
| | | value = value.split('.')[0]; |
| | | } |
| | | return value; |
| | | }, |
| | | // limit value range |
| | | format(value) { |
| | | value = this.filter(value); |
| | | // format range |
| | | value = value === '' ? 0 : +value; |
| | | value = Math.max(Math.min(this.data.max, value), this.data.min); |
| | | // format decimal |
| | | if (isDef(this.data.decimalLength)) { |
| | | value = value.toFixed(this.data.decimalLength); |
| | | } |
| | | return value; |
| | | }, |
| | | onInput(event) { |
| | | const { value = '' } = event.detail || {}; |
| | | // allow input to be empty |
| | | if (value === '') { |
| | | return; |
| | | } |
| | | let formatted = this.filter(value); |
| | | // limit max decimal length |
| | | if (isDef(this.data.decimalLength) && formatted.indexOf('.') !== -1) { |
| | | const pair = formatted.split('.'); |
| | | formatted = `${pair[0]}.${pair[1].slice(0, this.data.decimalLength)}`; |
| | | } |
| | | this.emitChange(formatted); |
| | | }, |
| | | emitChange(value) { |
| | | if (!this.data.asyncChange) { |
| | | this.setData({ currentValue: value }); |
| | | } |
| | | this.$emit('change', value); |
| | | }, |
| | | onChange() { |
| | | const { type } = this; |
| | | if (this.isDisabled(type)) { |
| | | this.$emit('overlimit', type); |
| | | return; |
| | | } |
| | | const diff = type === 'minus' ? -this.data.step : +this.data.step; |
| | | const value = this.format(add(+this.data.currentValue, diff)); |
| | | this.emitChange(value); |
| | | this.$emit(type); |
| | | }, |
| | | longPressStep() { |
| | | this.longPressTimer = setTimeout(() => { |
| | | this.onChange(); |
| | | this.longPressStep(); |
| | | }, LONG_PRESS_INTERVAL); |
| | | }, |
| | | onTap(event) { |
| | | const { type } = event.currentTarget.dataset; |
| | | this.type = type; |
| | | this.onChange(); |
| | | }, |
| | | onTouchStart(event) { |
| | | if (!this.data.longPress) { |
| | | return; |
| | | } |
| | | clearTimeout(this.longPressTimer); |
| | | const { type } = event.currentTarget.dataset; |
| | | this.type = type; |
| | | this.isLongPress = false; |
| | | this.longPressTimer = setTimeout(() => { |
| | | this.isLongPress = true; |
| | | this.onChange(); |
| | | this.longPressStep(); |
| | | }, LONG_PRESS_START_TIME); |
| | | }, |
| | | onTouchEnd() { |
| | | if (!this.data.longPress) { |
| | | return; |
| | | } |
| | | clearTimeout(this.longPressTimer); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="{{ utils.bem('stepper', [theme]) }} custom-class"> |
| | | <view |
| | | wx:if="{{ showMinus }}" |
| | | data-type="minus" |
| | | style="{{ computed.buttonStyle({ buttonSize }) }}" |
| | | class="minus-class {{ utils.bem('stepper__minus', { disabled: disabled || disableMinus || currentValue <= min }) }}" |
| | | hover-class="van-stepper__minus--hover" |
| | | hover-stay-time="70" |
| | | bind:tap="onTap" |
| | | bind:touchstart="onTouchStart" |
| | | bind:touchend="onTouchEnd" |
| | | > |
| | | <slot name="plus" /> |
| | | </view> |
| | | <input |
| | | type="{{ integer ? 'number' : 'digit' }}" |
| | | class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}" |
| | | style="{{ computed.inputStyle({ buttonSize, inputWidth }) }}" |
| | | value="{{ currentValue }}" |
| | | focus="{{ focus }}" |
| | | disabled="{{ disabled || disableInput }}" |
| | | bindinput="onInput" |
| | | bind:focus="onFocus" |
| | | bind:blur="onBlur" |
| | | /> |
| | | <view |
| | | wx:if="{{ showPlus }}" |
| | | data-type="plus" |
| | | style="{{ computed.buttonStyle({ buttonSize }) }}" |
| | | class="plus-class {{ utils.bem('stepper__plus', { disabled: disabled || disablePlus || currentValue >= max }) }}" |
| | | hover-class="van-stepper__plus--hover" |
| | | hover-stay-time="70" |
| | | bind:tap="onTap" |
| | | bind:touchstart="onTouchStart" |
| | | bind:touchend="onTouchEnd" |
| | | > |
| | | <slot name="minus" /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function buttonStyle(data) { |
| | | return style({ |
| | | width: addUnit(data.buttonSize), |
| | | height: addUnit(data.buttonSize), |
| | | }); |
| | | } |
| | | |
| | | function inputStyle(data) { |
| | | return style({ |
| | | width: addUnit(data.inputWidth), |
| | | height: addUnit(data.buttonSize), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | buttonStyle: buttonStyle, |
| | | inputStyle: inputStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;box-sizing:border-box;margin:1px;vertical-align:middle;border:0;background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);color:#323233;color:var(--stepper-button-icon-color,#323233);width:28px;width:var(--stepper-input-height,28px);height:28px;height:var(--stepper-input-height,28px);padding:4px;padding:var(--padding-base,4px)}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:empty.van-stepper__minus:after,.van-stepper__minus:empty.van-stepper__minus:before,.van-stepper__minus:empty.van-stepper__plus:after,.van-stepper__minus:empty.van-stepper__plus:before,.van-stepper__plus:empty.van-stepper__minus:after,.van-stepper__plus:empty.van-stepper__minus:before,.van-stepper__plus:empty.van-stepper__plus:after,.van-stepper__plus:empty.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:currentColor;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8;background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa;background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:4px 0 0 4px;border-radius:var(--stepper-border-radius,4px) 0 0 var(--stepper-border-radius,4px)}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0;border-radius:0 var(--stepper-border-radius,4px) var(--stepper-border-radius,4px) 0}.van-stepper--round .van-stepper__input{background-color:initial!important}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{color:#fff;background-color:#ee0a24}.van-stepper--round .van-stepper__minus{color:#ee0a24;background-color:#fff;border:1px solid #ee0a24}.van-stepper__input{display:inline-block;box-sizing:border-box;min-height:0;margin:1px;padding:1px;text-align:center;vertical-align:middle;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none;font-size:14px;font-size:var(--stepper-input-font-size,14px);color:#323233;color:var(--stepper-input-text-color,#323233);background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);width:32px;width:var(--stepper-input-width,32px);height:28px;height:var(--stepper-input-height,28px)}.van-stepper__input--disabled{color:#c8c9cc;color:var(--stepper-input-disabled-text-color,#c8c9cc);background-color:#f2f3f5;background-color:var(--stepper-input-disabled-background-color,#f2f3f5)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { GREEN, GRAY_DARK } from '../common/color'; |
| | | VantComponent({ |
| | | classes: ['desc-class'], |
| | | props: { |
| | | icon: String, |
| | | steps: Array, |
| | | active: Number, |
| | | direction: { |
| | | type: String, |
| | | value: 'horizontal', |
| | | }, |
| | | activeColor: { |
| | | type: String, |
| | | value: GREEN, |
| | | }, |
| | | inactiveColor: { |
| | | type: String, |
| | | value: GRAY_DARK, |
| | | }, |
| | | activeIcon: { |
| | | type: String, |
| | | value: 'checked', |
| | | }, |
| | | inactiveIcon: String, |
| | | }, |
| | | methods: { |
| | | onClick(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | this.$emit('click-step', index); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="custom-class {{ utils.bem('steps', [direction]) }}"> |
| | | <view class="van-step__wrapper"> |
| | | <view |
| | | wx:for="{{ steps }}" |
| | | wx:key="index" |
| | | bindtap="onClick" |
| | | data-index="{{ index }}" |
| | | class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline" |
| | | style="{{ status(index, active) === 'inactive' ? 'color: ' + inactiveColor: '' }}" |
| | | > |
| | | <view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}"> |
| | | <view>{{ item.text }}</view> |
| | | <view class="desc-class">{{ item.desc }}</view> |
| | | </view> |
| | | <view class="van-step__circle-container"> |
| | | <block wx:if="{{ index !== active }}"> |
| | | <van-icon |
| | | wx:if="{{ item.inactiveIcon || inactiveIcon }}" |
| | | color="{{ status(index, active) === 'inactive' ? inactiveColor: activeColor }}" |
| | | name="{{ item.inactiveIcon || inactiveIcon }}" |
| | | custom-class="van-step__icon" |
| | | /> |
| | | <view |
| | | wx:else |
| | | class="van-step__circle" |
| | | style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}" |
| | | /> |
| | | </block> |
| | | |
| | | <van-icon wx:else name="{{ item.activeIcon || activeIcon }}" color="{{ activeColor }}" custom-class="van-step__icon" /> |
| | | </view> |
| | | <view |
| | | wx:if="{{ index !== steps.length - 1 }}" |
| | | class="van-step__line" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <wxs module="status"> |
| | | function get(index, active) { |
| | | if (index < active) { |
| | | return 'finish'; |
| | | } else if (index === active) { |
| | | return 'process'; |
| | | } |
| | | |
| | | return 'inactive'; |
| | | } |
| | | |
| | | module.exports = get; |
| | | </wxs> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-steps{overflow:hidden;background-color:#fff;background-color:var(--steps-background-color,#fff)}.van-steps--horizontal{padding:10px}.van-steps--horizontal .van-step__wrapper{position:relative;display:-webkit-flex;display:flex;overflow:hidden}.van-steps--vertical{padding-left:10px}.van-steps--vertical .van-step__wrapper{padding:0 0 0 20px}.van-step{position:relative;-webkit-flex:1;flex:1;font-size:14px;font-size:var(--step-font-size,14px);color:#969799;color:var(--step-text-color,#969799)}.van-step--finish{color:#323233;color:var(--step-finish-text-color,#323233)}.van-step__circle{border-radius:50%;width:5px;width:var(--step-circle-size,5px);height:5px;height:var(--step-circle-size,5px);background-color:#969799;background-color:var(--step-circle-color,#969799)}.van-step--horizontal{padding-bottom:14px}.van-step--horizontal:first-child .van-step__title{-webkit-transform:none;transform:none}.van-step--horizontal:first-child .van-step__circle-container{padding:0 8px 0 0;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal:last-child{position:absolute;right:0;width:auto}.van-step--horizontal:last-child .van-step__title{text-align:right;-webkit-transform:none;transform:none}.van-step--horizontal:last-child .van-step__circle-container{right:0;padding:0 0 0 8px;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0)}.van-step--horizontal .van-step__circle-container{position:absolute;bottom:6px;z-index:1;-webkit-transform:translate3d(-50%,50%,0);transform:translate3d(-50%,50%,0);background-color:#fff;background-color:var(--white,#fff);padding:0 8px;padding:0 var(--padding-xs,8px)}.van-step--horizontal .van-step__title{display:inline-block;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);font-size:12px;font-size:var(--step-horizontal-title-font-size,12px)}.van-step--horizontal .van-step__line{position:absolute;right:0;bottom:6px;left:0;height:1px;-webkit-transform:translate3d(0,50%,0);transform:translate3d(0,50%,0);background-color:#ebedf0;background-color:var(--step-line-color,#ebedf0)}.van-step--horizontal.van-step--process{color:#323233;color:var(--step-process-text-color,#323233)}.van-step--horizontal.van-step--process .van-step__icon{display:block;line-height:1;font-size:12px;font-size:var(--step-icon-size,12px)}.van-step--vertical{padding:10px 10px 10px 0;line-height:18px}.van-step--vertical:after{border-bottom-width:1px}.van-step--vertical:last-child:after{border-bottom-width:none}.van-step--vertical:first-child:before{position:absolute;top:0;left:-15px;z-index:1;width:1px;height:20px;content:"";background-color:#fff;background-color:var(--white,#fff)}.van-step--vertical .van-step__circle,.van-step--vertical .van-step__icon,.van-step--vertical .van-step__line{position:absolute;top:19px;left:-14px;z-index:2;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-step--vertical .van-step__icon{line-height:1;font-size:12px;font-size:var(--step-icon-size,12px)}.van-step--vertical .van-step__line{z-index:1;width:1px;height:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0);background-color:#ebedf0;background-color:var(--step-line-color,#ebedf0)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { getRect } from '../common/utils'; |
| | | import { VantComponent } from '../common/component'; |
| | | import { pageScrollMixin } from '../mixins/page-scroll'; |
| | | const ROOT_ELEMENT = '.van-sticky'; |
| | | VantComponent({ |
| | | props: { |
| | | zIndex: { |
| | | type: Number, |
| | | value: 99, |
| | | }, |
| | | offsetTop: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'onScroll', |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | observer: 'onScroll', |
| | | }, |
| | | container: { |
| | | type: null, |
| | | observer: 'onScroll', |
| | | }, |
| | | scrollTop: { |
| | | type: null, |
| | | observer(val) { |
| | | this.onScroll({ scrollTop: val }); |
| | | }, |
| | | }, |
| | | }, |
| | | mixins: [ |
| | | pageScrollMixin(function (event) { |
| | | if (this.data.scrollTop != null) { |
| | | return; |
| | | } |
| | | this.onScroll(event); |
| | | }), |
| | | ], |
| | | data: { |
| | | height: 0, |
| | | fixed: false, |
| | | transform: 0, |
| | | }, |
| | | mounted() { |
| | | this.onScroll(); |
| | | }, |
| | | methods: { |
| | | onScroll({ scrollTop } = {}) { |
| | | const { container, offsetTop, disabled } = this.data; |
| | | if (disabled) { |
| | | this.setDataAfterDiff({ |
| | | fixed: false, |
| | | transform: 0, |
| | | }); |
| | | return; |
| | | } |
| | | this.scrollTop = scrollTop || this.scrollTop; |
| | | if (typeof container === 'function') { |
| | | Promise.all([ |
| | | getRect(this, ROOT_ELEMENT), |
| | | this.getContainerRect(), |
| | | ]).then(([root, container]) => { |
| | | if (offsetTop + root.height > container.height + container.top) { |
| | | this.setDataAfterDiff({ |
| | | fixed: false, |
| | | transform: container.height - root.height, |
| | | }); |
| | | } else if (offsetTop >= root.top) { |
| | | this.setDataAfterDiff({ |
| | | fixed: true, |
| | | height: root.height, |
| | | transform: 0, |
| | | }); |
| | | } else { |
| | | this.setDataAfterDiff({ fixed: false, transform: 0 }); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | getRect(this, ROOT_ELEMENT).then((root) => { |
| | | if (offsetTop >= root.top) { |
| | | this.setDataAfterDiff({ fixed: true, height: root.height }); |
| | | this.transform = 0; |
| | | } else { |
| | | this.setDataAfterDiff({ fixed: false }); |
| | | } |
| | | }); |
| | | }, |
| | | setDataAfterDiff(data) { |
| | | wx.nextTick(() => { |
| | | const diff = Object.keys(data).reduce((prev, key) => { |
| | | if (data[key] !== this.data[key]) { |
| | | prev[key] = data[key]; |
| | | } |
| | | return prev; |
| | | }, {}); |
| | | if (Object.keys(diff).length > 0) { |
| | | this.setData(diff); |
| | | } |
| | | this.$emit('scroll', { |
| | | scrollTop: this.scrollTop, |
| | | isFixed: data.fixed || this.data.fixed, |
| | | }); |
| | | }); |
| | | }, |
| | | getContainerRect() { |
| | | const nodesRef = this.data.container(); |
| | | return new Promise((resolve) => |
| | | nodesRef.boundingClientRect(resolve).exec() |
| | | ); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}"> |
| | | <view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}"> |
| | | <slot /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function wrapStyle(data) { |
| | | return style({ |
| | | transform: data.transform |
| | | ? 'translate3d(0, ' + data.transform + 'px, 0)' |
| | | : '', |
| | | top: data.fixed ? addUnit(data.offsetTop) : '', |
| | | 'z-index': data.zIndex, |
| | | }); |
| | | } |
| | | |
| | | function containerStyle(data) { |
| | | return style({ |
| | | height: data.fixed ? addUnit(data.height) : '', |
| | | 'z-index': data.zIndex, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | wrapStyle: wrapStyle, |
| | | containerStyle: containerStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{position:fixed;right:0;left:0} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: ['bar-class', 'price-class', 'button-class'], |
| | | props: { |
| | | tip: { |
| | | type: null, |
| | | observer: 'updateTip', |
| | | }, |
| | | tipIcon: String, |
| | | type: Number, |
| | | price: { |
| | | type: null, |
| | | observer: 'updatePrice', |
| | | }, |
| | | label: String, |
| | | loading: Boolean, |
| | | disabled: Boolean, |
| | | buttonText: String, |
| | | currency: { |
| | | type: String, |
| | | value: 'Â¥', |
| | | }, |
| | | buttonType: { |
| | | type: String, |
| | | value: 'danger', |
| | | }, |
| | | decimalLength: { |
| | | type: Number, |
| | | value: 2, |
| | | observer: 'updatePrice', |
| | | }, |
| | | suffixLabel: String, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | methods: { |
| | | updatePrice() { |
| | | const { price, decimalLength } = this.data; |
| | | const priceStrArr = |
| | | typeof price === 'number' && |
| | | (price / 100).toFixed(decimalLength).split('.'); |
| | | this.setData({ |
| | | hasPrice: typeof price === 'number', |
| | | integerStr: priceStrArr && priceStrArr[0], |
| | | decimalStr: decimalLength && priceStrArr ? `.${priceStrArr[1]}` : '', |
| | | }); |
| | | }, |
| | | updateTip() { |
| | | this.setData({ hasTip: typeof this.data.tip === 'string' }); |
| | | }, |
| | | onSubmit(event) { |
| | | this.$emit('submit', event.detail); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-button": "../button/index", |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view class="van-submit-bar custom-class"> |
| | | <slot name="top" /> |
| | | |
| | | <view class="van-submit-bar__tip"> |
| | | <van-icon |
| | | wx:if="{{ tipIcon }}" |
| | | size="12px" |
| | | name="{{ tipIcon }}" |
| | | custom-class="van-submit-bar__tip-icon" |
| | | /> |
| | | <view wx:if="{{ hasTip }}" class="van-submit-bar__tip-text"> |
| | | {{ tip }} |
| | | </view> |
| | | <slot name="tip" /> |
| | | </view> |
| | | |
| | | <view class="bar-class van-submit-bar__bar"> |
| | | <slot /> |
| | | <view wx:if="{{ hasPrice }}" class="van-submit-bar__text"> |
| | | <text>{{ label || 'å计ï¼' }}</text> |
| | | <text class="van-submit-bar__price price-class"> |
| | | <text class="van-submit-bar__currency">{{ currency }} </text> |
| | | <text class="van-submit-bar__price-integer">{{ integerStr }}</text><text>{{decimalStr}}</text> |
| | | </text> |
| | | <text class="van-submit-bar__suffix-label">{{ suffixLabel }}</text> |
| | | </view> |
| | | <van-button |
| | | round |
| | | type="{{ buttonType }}" |
| | | loading="{{ loading }}" |
| | | disabled="{{ disabled }}" |
| | | class="van-submit-bar__button" |
| | | custom-class="button-class" |
| | | custom-style="width: 100%;" |
| | | bind:click="onSubmit" |
| | | > |
| | | {{ loading ? '' : buttonText }} |
| | | </van-button> |
| | | </view> |
| | | |
| | | <view wx:if="{{ safeAreaInsetBottom }}" class="van-submit-bar__safe" /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-submit-bar{position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none;z-index:100;z-index:var(--submit-bar-z-index,100);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__tip{padding:10px;padding:var(--submit-bar-tip-padding,10px);color:#f56723;color:var(--submit-bar-tip-color,#f56723);font-size:12px;font-size:var(--submit-bar-tip-font-size,12px);line-height:1.5;line-height:var(--submit-bar-tip-line-height,1.5);background-color:#fff7cc;background-color:var(--submit-bar-tip-background-color,#fff7cc)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{width:12px;height:12px;margin-right:4px;vertical-align:middle;font-size:12px;font-size:var(--submit-bar-tip-icon-size,12px);min-width:18px;min-width:calc(var(--submit-bar-tip-icon-size, 12px)*1.5)}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:flex-end;justify-content:flex-end;padding:0 16px;padding:var(--submit-bar-padding,0 16px);height:50px;height:var(--submit-bar-height,50px);font-size:14px;font-size:var(--submit-bar-text-font-size,14px);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__safe{height:constant(safe-area-inset-bottom);height:env(safe-area-inset-bottom)}.van-submit-bar__text{-webkit-flex:1;flex:1;text-align:right;color:#323233;color:var(--submit-bar-text-color,#323233);padding-right:12px;padding-right:var(--padding-sm,12px)}.van-submit-bar__price,.van-submit-bar__text{font-weight:500;font-weight:var(--font-weight-bold,500)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:12px;font-size:var(--submit-bar-price-font-size,12px)}.van-submit-bar__price-integer{font-size:20px;font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif}.van-submit-bar__currency{font-size:12px;font-size:var(--submit-bar-currency-font-size,12px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px);font-weight:500;font-weight:var(--font-weight-bold,500);--button-default-height:40px!important;--button-default-height:var(--submit-bar-button-height,40px)!important;--button-line-height:40px!important;--button-line-height:var(--submit-bar-button-height,40px)!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { touch } from '../mixins/touch'; |
| | | import { range } from '../common/utils'; |
| | | const THRESHOLD = 0.3; |
| | | let ARRAY = []; |
| | | VantComponent({ |
| | | props: { |
| | | disabled: Boolean, |
| | | leftWidth: { |
| | | type: Number, |
| | | value: 0, |
| | | observer(leftWidth = 0) { |
| | | if (this.offset > 0) { |
| | | this.swipeMove(leftWidth); |
| | | } |
| | | }, |
| | | }, |
| | | rightWidth: { |
| | | type: Number, |
| | | value: 0, |
| | | observer(rightWidth = 0) { |
| | | if (this.offset < 0) { |
| | | this.swipeMove(-rightWidth); |
| | | } |
| | | }, |
| | | }, |
| | | asyncClose: Boolean, |
| | | name: { |
| | | type: null, |
| | | value: '', |
| | | }, |
| | | }, |
| | | mixins: [touch], |
| | | data: { |
| | | catchMove: false, |
| | | wrapperStyle: '', |
| | | }, |
| | | created() { |
| | | this.offset = 0; |
| | | ARRAY.push(this); |
| | | }, |
| | | destroyed() { |
| | | ARRAY = ARRAY.filter((item) => item !== this); |
| | | }, |
| | | methods: { |
| | | open(position) { |
| | | const { leftWidth, rightWidth } = this.data; |
| | | const offset = position === 'left' ? leftWidth : -rightWidth; |
| | | this.swipeMove(offset); |
| | | this.$emit('open', { |
| | | position, |
| | | name: this.data.name, |
| | | }); |
| | | }, |
| | | close() { |
| | | this.swipeMove(0); |
| | | }, |
| | | swipeMove(offset = 0) { |
| | | this.offset = range(offset, -this.data.rightWidth, this.data.leftWidth); |
| | | const transform = `translate3d(${this.offset}px, 0, 0)`; |
| | | const transition = this.dragging |
| | | ? 'none' |
| | | : 'transform .6s cubic-bezier(0.18, 0.89, 0.32, 1)'; |
| | | this.setData({ |
| | | wrapperStyle: ` |
| | | -webkit-transform: ${transform}; |
| | | -webkit-transition: ${transition}; |
| | | transform: ${transform}; |
| | | transition: ${transition}; |
| | | `, |
| | | }); |
| | | }, |
| | | swipeLeaveTransition() { |
| | | const { leftWidth, rightWidth } = this.data; |
| | | const { offset } = this; |
| | | if (rightWidth > 0 && -offset > rightWidth * THRESHOLD) { |
| | | this.open('right'); |
| | | } else if (leftWidth > 0 && offset > leftWidth * THRESHOLD) { |
| | | this.open('left'); |
| | | } else { |
| | | this.swipeMove(0); |
| | | } |
| | | this.setData({ catchMove: false }); |
| | | }, |
| | | startDrag(event) { |
| | | if (this.data.disabled) { |
| | | return; |
| | | } |
| | | this.startOffset = this.offset; |
| | | this.touchStart(event); |
| | | }, |
| | | noop() {}, |
| | | onDrag(event) { |
| | | if (this.data.disabled) { |
| | | return; |
| | | } |
| | | this.touchMove(event); |
| | | if (this.direction !== 'horizontal') { |
| | | return; |
| | | } |
| | | this.dragging = true; |
| | | ARRAY.filter( |
| | | (item) => item !== this && item.offset !== 0 |
| | | ).forEach((item) => item.close()); |
| | | this.setData({ catchMove: true }); |
| | | this.swipeMove(this.startOffset + this.deltaX); |
| | | }, |
| | | endDrag() { |
| | | if (this.data.disabled) { |
| | | return; |
| | | } |
| | | this.dragging = false; |
| | | this.swipeLeaveTransition(); |
| | | }, |
| | | onClick(event) { |
| | | const { key: position = 'outside' } = event.currentTarget.dataset; |
| | | this.$emit('click', position); |
| | | if (!this.offset) { |
| | | return; |
| | | } |
| | | if (this.data.asyncClose) { |
| | | this.$emit('close', { |
| | | position, |
| | | instance: this, |
| | | name: this.data.name, |
| | | }); |
| | | } else { |
| | | this.swipeMove(0); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <view |
| | | class="van-swipe-cell custom-class" |
| | | data-key="cell" |
| | | catchtap="onClick" |
| | | bindtouchstart="startDrag" |
| | | catchtouchmove="{{ catchMove ? 'noop' : '' }}" |
| | | capture-bind:touchmove="onDrag" |
| | | bindtouchend="endDrag" |
| | | bindtouchcancel="endDrag" |
| | | > |
| | | <view style="{{ wrapperStyle }}"> |
| | | <view wx:if="{{ leftWidth }}" class="van-swipe-cell__left" data-key="left" catch:tap="onClick"> |
| | | <slot name="left" /> |
| | | </view> |
| | | <slot /> |
| | | <view wx:if="{{ rightWidth }}" class="van-swipe-cell__right" data-key="right" catch:tap="onClick"> |
| | | <slot name="right" /> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-swipe-cell{position:relative;overflow:hidden}.van-swipe-cell__left,.van-swipe-cell__right{position:absolute;top:0;height:100%}.van-swipe-cell__left{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-swipe-cell__right{right:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | field: true, |
| | | classes: ['node-class'], |
| | | props: { |
| | | checked: null, |
| | | loading: Boolean, |
| | | disabled: Boolean, |
| | | activeColor: String, |
| | | inactiveColor: String, |
| | | size: { |
| | | type: String, |
| | | value: '30', |
| | | }, |
| | | activeValue: { |
| | | type: null, |
| | | value: true, |
| | | }, |
| | | inactiveValue: { |
| | | type: null, |
| | | value: false, |
| | | }, |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | const { activeValue, inactiveValue, disabled, loading } = this.data; |
| | | if (disabled || loading) { |
| | | return; |
| | | } |
| | | const checked = this.data.checked === activeValue; |
| | | const value = checked ? inactiveValue : activeValue; |
| | | this.$emit('input', value); |
| | | this.$emit('change', value); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="{{ utils.bem('switch', { on: checked === activeValue, disabled }) }} custom-class" |
| | | style="{{ computed.rootStyle({ size, checked, activeColor, inactiveColor }) }}" |
| | | bind:tap="onClick" |
| | | > |
| | | <view class="van-switch__node node-class"> |
| | | <van-loading |
| | | wx:if="{{ loading }}" |
| | | color="{{ computed.loadingColor({ checked, activeColor, inactiveColor }) }}" |
| | | custom-class="van-switch__loading" |
| | | /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | var currentColor = data.checked ? data.activeColor : data.inactiveColor; |
| | | |
| | | return style({ |
| | | 'font-size': addUnit(data.size), |
| | | 'background-color': currentColor, |
| | | }); |
| | | } |
| | | |
| | | var BLUE = '#1989fa'; |
| | | var GRAY_DARK = '#969799'; |
| | | |
| | | function loadingColor(data) { |
| | | return data.checked |
| | | ? data.activeColor || BLUE |
| | | : data.inactiveColor || GRAY_DARK; |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | loadingColor: loadingColor, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-switch{position:relative;display:inline-block;box-sizing:initial;width:2em;width:var(--switch-width,2em);height:1em;height:var(--switch-height,1em);background-color:#fff;background-color:var(--switch-background-color,#fff);border:1px solid rgba(0,0,0,.1);border:var(--switch-border,1px solid rgba(0,0,0,.1));border-radius:1em;border-radius:var(--switch-node-size,1em);transition:background-color .3s;transition:background-color var(--switch-transition-duration,.3s)}.van-switch__node{position:absolute;top:0;left:0;border-radius:100%;z-index:1;z-index:var(--switch-node-z-index,1);width:1em;width:var(--switch-node-size,1em);height:1em;height:var(--switch-node-size,1em);background-color:#fff;background-color:var(--switch-node-background-color,#fff);box-shadow:0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05);box-shadow:var(--switch-node-box-shadow,0 3px 1px 0 rgba(0,0,0,.05),0 2px 2px 0 rgba(0,0,0,.1),0 3px 3px 0 rgba(0,0,0,.05));transition:-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:transform .3s cubic-bezier(.3,1.05,.4,1.05),-webkit-transform .3s cubic-bezier(.3,1.05,.4,1.05);transition:-webkit-transform var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);transition:transform var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05);transition:transform var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05),-webkit-transform var(--switch-transition-duration,.3s) cubic-bezier(.3,1.05,.4,1.05)}.van-switch__loading{position:absolute!important;top:25%;left:25%;width:50%;height:50%}.van-switch--on{background-color:#1989fa;background-color:var(--switch-on-background-color,#1989fa)}.van-switch--on .van-switch__node{-webkit-transform:translateX(1em);transform:translateX(1em);-webkit-transform:translateX(calc(var(--switch-width, 2em) - var(--switch-node-size, 1em)));transform:translateX(calc(var(--switch-width, 2em) - var(--switch-node-size, 1em)))}.van-switch--disabled{opacity:.4;opacity:var(--switch-disabled-opacity,.4)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { useParent } from '../common/relation'; |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | relation: useParent('tabs'), |
| | | props: { |
| | | dot: { |
| | | type: Boolean, |
| | | observer: 'update', |
| | | }, |
| | | info: { |
| | | type: null, |
| | | observer: 'update', |
| | | }, |
| | | title: { |
| | | type: String, |
| | | observer: 'update', |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | observer: 'update', |
| | | }, |
| | | titleStyle: { |
| | | type: String, |
| | | observer: 'update', |
| | | }, |
| | | name: { |
| | | type: null, |
| | | value: '', |
| | | }, |
| | | }, |
| | | data: { |
| | | active: false, |
| | | }, |
| | | methods: { |
| | | getComputedName() { |
| | | if (this.data.name !== '') { |
| | | return this.data.name; |
| | | } |
| | | return this.index; |
| | | }, |
| | | updateRender(active, parent) { |
| | | const { data: parentData } = parent; |
| | | this.inited = this.inited || active; |
| | | this.setData({ |
| | | active, |
| | | shouldRender: this.inited || !parentData.lazyRender, |
| | | shouldShow: active || parentData.animated, |
| | | }); |
| | | }, |
| | | update() { |
| | | if (this.parent) { |
| | | this.parent.updateTabs(); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('tab__pane', { active, inactive: !active }) }}" |
| | | style="{{ shouldShow ? '' : 'display: none;' }}" |
| | | > |
| | | <slot wx:if="{{ shouldRender }}" /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';:host{-webkit-flex-shrink:0;flex-shrink:0;width:100%}.van-tab__pane,:host{box-sizing:border-box}.van-tab__pane{overflow-y:auto;-webkit-overflow-scrolling:touch}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useParent } from '../common/relation'; |
| | | VantComponent({ |
| | | props: { |
| | | info: null, |
| | | name: null, |
| | | icon: String, |
| | | dot: Boolean, |
| | | iconPrefix: { |
| | | type: String, |
| | | value: 'van-icon', |
| | | }, |
| | | }, |
| | | relation: useParent('tabbar'), |
| | | data: { |
| | | active: false, |
| | | activeColor: '', |
| | | inactiveColor: '', |
| | | }, |
| | | methods: { |
| | | onClick() { |
| | | const { parent } = this; |
| | | if (parent) { |
| | | const index = parent.children.indexOf(this); |
| | | const active = this.data.name || index; |
| | | if (active !== this.data.active) { |
| | | parent.$emit('change', active); |
| | | } |
| | | } |
| | | this.$emit('click'); |
| | | }, |
| | | updateFromParent() { |
| | | const { parent } = this; |
| | | if (!parent) { |
| | | return; |
| | | } |
| | | const index = parent.children.indexOf(this); |
| | | const parentData = parent.data; |
| | | const { data } = this; |
| | | const active = (data.name || index) === parentData.active; |
| | | const patch = {}; |
| | | if (active !== data.active) { |
| | | patch.active = active; |
| | | } |
| | | if (parentData.activeColor !== data.activeColor) { |
| | | patch.activeColor = parentData.activeColor; |
| | | } |
| | | if (parentData.inactiveColor !== data.inactiveColor) { |
| | | patch.inactiveColor = parentData.inactiveColor; |
| | | } |
| | | if (Object.keys(patch).length > 0) { |
| | | this.setData(patch); |
| | | } |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-info": "../info/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="{{ utils.bem('tabbar-item', { active }) }} custom-class" |
| | | style="color: {{ active ? activeColor : inactiveColor }}" |
| | | bindtap="onClick" |
| | | > |
| | | <view class="van-tabbar-item__icon"> |
| | | <van-icon |
| | | wx:if="{{ icon }}" |
| | | name="{{ icon }}" |
| | | class-prefix="{{ iconPrefix }}" |
| | | custom-class="van-tabbar-item__icon__inner" |
| | | /> |
| | | <block wx:else> |
| | | <slot wx:if="{{ active }}" name="icon-active" /> |
| | | <slot wx:else name="icon" /> |
| | | </block> |
| | | <van-info |
| | | dot="{{ dot }}" |
| | | info="{{ info }}" |
| | | custom-class="van-tabbar-item__info" |
| | | /> |
| | | </view> |
| | | <view class="van-tabbar-item__text"> |
| | | <slot /> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;height:100%;color:#646566;color:var(--tabbar-item-text-color,#646566);font-size:12px;font-size:var(--tabbar-item-font-size,12px);line-height:1;line-height:var(--tabbar-item-line-height,1)}.van-tabbar-item__icon{position:relative;margin-bottom:4px;margin-bottom:var(--tabbar-item-margin-bottom,4px);font-size:22px;font-size:var(--tabbar-item-icon-size,22px)}.van-tabbar-item__icon__inner{display:block;min-width:1em}.van-tabbar-item--active{color:#1989fa;color:var(--tabbar-item-active-color,#1989fa)}.van-tabbar-item__info{margin-top:2px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { useChildren } from '../common/relation'; |
| | | import { getRect } from '../common/utils'; |
| | | VantComponent({ |
| | | relation: useChildren('tabbar-item', function () { |
| | | this.updateChildren(); |
| | | }), |
| | | props: { |
| | | active: { |
| | | type: null, |
| | | observer: 'updateChildren', |
| | | }, |
| | | activeColor: { |
| | | type: String, |
| | | observer: 'updateChildren', |
| | | }, |
| | | inactiveColor: { |
| | | type: String, |
| | | observer: 'updateChildren', |
| | | }, |
| | | fixed: { |
| | | type: Boolean, |
| | | value: true, |
| | | observer: 'setHeight', |
| | | }, |
| | | placeholder: { |
| | | type: Boolean, |
| | | observer: 'setHeight', |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | safeAreaInsetBottom: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | height: 50, |
| | | }, |
| | | methods: { |
| | | updateChildren() { |
| | | const { children } = this; |
| | | if (!Array.isArray(children) || !children.length) { |
| | | return; |
| | | } |
| | | children.forEach((child) => child.updateFromParent()); |
| | | }, |
| | | setHeight() { |
| | | if (!this.data.fixed || !this.data.placeholder) { |
| | | return; |
| | | } |
| | | wx.nextTick(() => { |
| | | getRect(this, '.van-tabbar').then((res) => { |
| | | this.setData({ height: res.height }); |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | |
| | | <view |
| | | class="{{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }} custom-class" |
| | | style="{{ zIndex ? 'z-index: ' + zIndex : '' }}" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | |
| | | <view wx:if="{{ fixed && placeholder }}" style="height: {{ height }}px;"></view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;box-sizing:initial;width:100%;height:50px;height:var(--tabbar-height,50px);background-color:#fff;background-color:var(--tabbar-background-color,#fff)}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:env(safe-area-inset-bottom)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { touch } from '../mixins/touch'; |
| | | import { |
| | | getAllRect, |
| | | getRect, |
| | | groupSetData, |
| | | nextTick, |
| | | requestAnimationFrame, |
| | | } from '../common/utils'; |
| | | import { isDef } from '../common/validator'; |
| | | import { useChildren } from '../common/relation'; |
| | | VantComponent({ |
| | | mixins: [touch], |
| | | classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'], |
| | | relation: useChildren('tab', function () { |
| | | this.updateTabs(); |
| | | }), |
| | | props: { |
| | | sticky: Boolean, |
| | | border: Boolean, |
| | | swipeable: Boolean, |
| | | titleActiveColor: String, |
| | | titleInactiveColor: String, |
| | | color: String, |
| | | animated: { |
| | | type: Boolean, |
| | | observer() { |
| | | this.children.forEach((child, index) => |
| | | child.updateRender(index === this.data.currentIndex, this) |
| | | ); |
| | | }, |
| | | }, |
| | | lineWidth: { |
| | | type: null, |
| | | value: 40, |
| | | observer: 'resize', |
| | | }, |
| | | lineHeight: { |
| | | type: null, |
| | | value: -1, |
| | | }, |
| | | active: { |
| | | type: null, |
| | | value: 0, |
| | | observer(name) { |
| | | if (name !== this.getCurrentName()) { |
| | | this.setCurrentIndexByName(name); |
| | | } |
| | | }, |
| | | }, |
| | | type: { |
| | | type: String, |
| | | value: 'line', |
| | | }, |
| | | ellipsis: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | duration: { |
| | | type: Number, |
| | | value: 0.3, |
| | | }, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1, |
| | | }, |
| | | swipeThreshold: { |
| | | type: Number, |
| | | value: 5, |
| | | observer(value) { |
| | | this.setData({ |
| | | scrollable: this.children.length > value || !this.data.ellipsis, |
| | | }); |
| | | }, |
| | | }, |
| | | offsetTop: { |
| | | type: Number, |
| | | value: 0, |
| | | }, |
| | | lazyRender: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | }, |
| | | data: { |
| | | tabs: [], |
| | | scrollLeft: 0, |
| | | scrollable: false, |
| | | currentIndex: 0, |
| | | container: null, |
| | | skipTransition: true, |
| | | lineOffsetLeft: 0, |
| | | }, |
| | | mounted() { |
| | | requestAnimationFrame(() => { |
| | | this.setData({ |
| | | container: () => this.createSelectorQuery().select('.van-tabs'), |
| | | }); |
| | | this.resize(true); |
| | | this.scrollIntoView(); |
| | | }); |
| | | }, |
| | | methods: { |
| | | updateTabs() { |
| | | const { children = [], data } = this; |
| | | this.setData({ |
| | | tabs: children.map((child) => child.data), |
| | | scrollable: |
| | | this.children.length > data.swipeThreshold || !data.ellipsis, |
| | | }); |
| | | this.setCurrentIndexByName(data.active || this.getCurrentName()); |
| | | }, |
| | | trigger(eventName, child) { |
| | | const { currentIndex } = this.data; |
| | | const currentChild = child || this.children[currentIndex]; |
| | | if (!isDef(currentChild)) { |
| | | return; |
| | | } |
| | | this.$emit(eventName, { |
| | | index: currentChild.index, |
| | | name: currentChild.getComputedName(), |
| | | title: currentChild.data.title, |
| | | }); |
| | | }, |
| | | onTap(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const child = this.children[index]; |
| | | if (child.data.disabled) { |
| | | this.trigger('disabled', child); |
| | | } else { |
| | | this.setCurrentIndex(index); |
| | | nextTick(() => { |
| | | this.trigger('click'); |
| | | }); |
| | | } |
| | | }, |
| | | // correct the index of active tab |
| | | setCurrentIndexByName(name) { |
| | | const { children = [] } = this; |
| | | const matched = children.filter( |
| | | (child) => child.getComputedName() === name |
| | | ); |
| | | if (matched.length) { |
| | | this.setCurrentIndex(matched[0].index); |
| | | } |
| | | }, |
| | | setCurrentIndex(currentIndex) { |
| | | const { data, children = [] } = this; |
| | | if ( |
| | | !isDef(currentIndex) || |
| | | currentIndex >= children.length || |
| | | currentIndex < 0 |
| | | ) { |
| | | return; |
| | | } |
| | | groupSetData(this, () => { |
| | | children.forEach((item, index) => { |
| | | const active = index === currentIndex; |
| | | if (active !== item.data.active || !item.inited) { |
| | | item.updateRender(active, this); |
| | | } |
| | | }); |
| | | }); |
| | | if (currentIndex === data.currentIndex) { |
| | | return; |
| | | } |
| | | const shouldEmitChange = data.currentIndex !== null; |
| | | this.setData({ currentIndex }); |
| | | nextTick(() => { |
| | | this.resize(); |
| | | this.scrollIntoView(); |
| | | this.trigger('input'); |
| | | if (shouldEmitChange) { |
| | | this.trigger('change'); |
| | | } |
| | | }); |
| | | }, |
| | | getCurrentName() { |
| | | const activeTab = this.children[this.data.currentIndex]; |
| | | if (activeTab) { |
| | | return activeTab.getComputedName(); |
| | | } |
| | | }, |
| | | resize(skipTransition = false) { |
| | | if (this.data.type !== 'line') { |
| | | return; |
| | | } |
| | | const { currentIndex, ellipsis } = this.data; |
| | | Promise.all([ |
| | | getAllRect(this, '.van-tab'), |
| | | getRect(this, '.van-tabs__line'), |
| | | ]).then(([rects = [], lineRect]) => { |
| | | const rect = rects[currentIndex]; |
| | | if (rect == null) { |
| | | return; |
| | | } |
| | | let lineOffsetLeft = rects |
| | | .slice(0, currentIndex) |
| | | .reduce((prev, curr) => prev + curr.width, 0); |
| | | lineOffsetLeft += |
| | | (rect.width - lineRect.width) / 2 + (ellipsis ? 0 : 8); |
| | | this.setData({ |
| | | lineOffsetLeft, |
| | | skipTransition, |
| | | }); |
| | | }); |
| | | }, |
| | | // scroll active tab into view |
| | | scrollIntoView() { |
| | | const { currentIndex, scrollable } = this.data; |
| | | if (!scrollable) { |
| | | return; |
| | | } |
| | | Promise.all([ |
| | | getAllRect(this, '.van-tab'), |
| | | getRect(this, '.van-tabs__nav'), |
| | | ]).then(([tabRects, navRect]) => { |
| | | const tabRect = tabRects[currentIndex]; |
| | | const offsetLeft = tabRects |
| | | .slice(0, currentIndex) |
| | | .reduce((prev, curr) => prev + curr.width, 0); |
| | | this.setData({ |
| | | scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2, |
| | | }); |
| | | }); |
| | | }, |
| | | onTouchScroll(event) { |
| | | this.$emit('scroll', event.detail); |
| | | }, |
| | | onTouchStart(event) { |
| | | if (!this.data.swipeable) return; |
| | | this.touchStart(event); |
| | | }, |
| | | onTouchMove(event) { |
| | | if (!this.data.swipeable) return; |
| | | this.touchMove(event); |
| | | }, |
| | | // watch swipe touch end |
| | | onTouchEnd() { |
| | | if (!this.data.swipeable) return; |
| | | const { direction, deltaX, offsetX } = this; |
| | | const minSwipeDistance = 50; |
| | | if (direction === 'horizontal' && offsetX >= minSwipeDistance) { |
| | | const index = this.getAvaiableTab(deltaX); |
| | | if (index !== -1) { |
| | | this.setCurrentIndex(index); |
| | | } |
| | | } |
| | | }, |
| | | getAvaiableTab(direction) { |
| | | const { tabs, currentIndex } = this.data; |
| | | const step = direction > 0 ? -1 : 1; |
| | | for ( |
| | | let i = step; |
| | | currentIndex + i < tabs.length && currentIndex + i >= 0; |
| | | i += step |
| | | ) { |
| | | const index = currentIndex + i; |
| | | if ( |
| | | index >= 0 && |
| | | index < tabs.length && |
| | | tabs[index] && |
| | | !tabs[index].disabled |
| | | ) { |
| | | return index; |
| | | } |
| | | } |
| | | return -1; |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-info": "../info/index", |
| | | "van-sticky": "../sticky/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="custom-class {{ utils.bem('tabs', [type]) }}"> |
| | | <van-sticky |
| | | disabled="{{ !sticky }}" |
| | | z-index="{{ zIndex }}" |
| | | offset-top="{{ offsetTop }}" |
| | | container="{{ container }}" |
| | | bind:scroll="onTouchScroll" |
| | | > |
| | | <view class="{{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }}"> |
| | | <slot name="nav-left" /> |
| | | |
| | | <scroll-view |
| | | scroll-x="{{ scrollable }}" |
| | | scroll-with-animation |
| | | scroll-left="{{ scrollLeft }}" |
| | | class="{{ utils.bem('tabs__scroll', [type]) }}" |
| | | style="{{ color ? 'border-color: ' + color : '' }}" |
| | | > |
| | | <view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}"> |
| | | <view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth }) }}" /> |
| | | <view |
| | | wx:for="{{ tabs }}" |
| | | wx:key="index" |
| | | data-index="{{ index }}" |
| | | class="{{ computed.tabClass(index === currentIndex, ellipsis) }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled, complete: !ellipsis }) }}" |
| | | style="{{ computed.tabStyle({ active: index === currentIndex, ellipsis, color, type, disabled: item.disabled, titleActiveColor, titleInactiveColor, swipeThreshold, scrollable }) }}" |
| | | bind:tap="onTap" |
| | | > |
| | | <view class="{{ ellipsis ? 'van-ellipsis' : '' }}" style="{{ item.titleStyle }}"> |
| | | {{ item.title }} |
| | | <van-info |
| | | wx:if="{{ item.info !== null || item.dot }}" |
| | | info="{{ item.info }}" |
| | | dot="{{ item.dot }}" |
| | | custom-class="van-tab__title__info" |
| | | /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | |
| | | <slot name="nav-right" /> |
| | | </view> |
| | | </van-sticky> |
| | | |
| | | <view |
| | | class="van-tabs__content" |
| | | bind:touchstart="onTouchStart" |
| | | bind:touchmove="onTouchMove" |
| | | bind:touchend="onTouchEnd" |
| | | bind:touchcancel="onTouchEnd" |
| | | > |
| | | <view |
| | | class="{{ utils.bem('tabs__track', [{ animated }]) }} van-tabs__track" |
| | | style="{{ computed.trackStyle({ duration, currentIndex, animated }) }}" |
| | | > |
| | | <slot /> |
| | | </view> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var utils = require('../wxs/utils.wxs'); |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function tabClass(active, ellipsis) { |
| | | var classes = ['tab-class']; |
| | | |
| | | if (active) { |
| | | classes.push('tab-active-class'); |
| | | } |
| | | |
| | | if (ellipsis) { |
| | | classes.push('van-ellipsis'); |
| | | } |
| | | |
| | | return classes.join(' '); |
| | | } |
| | | |
| | | function tabStyle(data) { |
| | | var titleColor = data.active |
| | | ? data.titleActiveColor |
| | | : data.titleInactiveColor; |
| | | |
| | | var ellipsis = data.scrollable && data.ellipsis; |
| | | |
| | | // card theme color |
| | | if (data.type === 'card') { |
| | | return style({ |
| | | 'border-color': data.color, |
| | | 'background-color': !data.disabled && data.active ? data.color : null, |
| | | color: titleColor || (!data.disabled && !data.active ? data.color : null), |
| | | 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, |
| | | }); |
| | | } |
| | | |
| | | return style({ |
| | | color: titleColor, |
| | | 'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null, |
| | | }); |
| | | } |
| | | |
| | | function navStyle(color, type) { |
| | | return style({ |
| | | 'border-color': type === 'card' && color ? color : null, |
| | | }); |
| | | } |
| | | |
| | | function trackStyle(data) { |
| | | if (!data.animated) { |
| | | return ''; |
| | | } |
| | | |
| | | return style({ |
| | | left: -100 * data.currentIndex + '%', |
| | | 'transition-duration': data.duration + 's', |
| | | '-webkit-transition-duration': data.duration + 's', |
| | | }); |
| | | } |
| | | |
| | | function lineStyle(data) { |
| | | return style({ |
| | | width: utils.addUnit(data.lineWidth), |
| | | transform: 'translateX(' + data.lineOffsetLeft + 'px)', |
| | | '-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)', |
| | | 'background-color': data.color, |
| | | height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, |
| | | 'border-radius': |
| | | data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null, |
| | | 'transition-duration': !data.skipTransition ? data.duration + 's' : null, |
| | | '-webkit-transition-duration': !data.skipTransition |
| | | ? data.duration + 's' |
| | | : null, |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | tabClass: tabClass, |
| | | tabStyle: tabStyle, |
| | | trackStyle: trackStyle, |
| | | lineStyle: lineStyle, |
| | | navStyle: navStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - var(--border-width-base, 1px)*2);border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | size: String, |
| | | mark: Boolean, |
| | | color: String, |
| | | plain: Boolean, |
| | | round: Boolean, |
| | | textColor: String, |
| | | type: { |
| | | type: String, |
| | | value: 'default', |
| | | }, |
| | | closeable: Boolean, |
| | | }, |
| | | methods: { |
| | | onClose() { |
| | | this.$emit('close'); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | class="custom-class {{ utils.bem('tag', [type, size, { mark, plain, round }]) }}" |
| | | style="{{ computed.rootStyle({ plain, color, textColor }) }}" |
| | | > |
| | | <slot /> |
| | | <van-icon |
| | | wx:if="{{ closeable }}" |
| | | name="cross" |
| | | custom-class="van-tag__close" |
| | | bind:click="onClose" |
| | | /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style({ |
| | | 'background-color': data.plain ? '' : data.color, |
| | | color: data.textColor || data.plain ? data.textColor || data.color : '', |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-tag{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;padding:0 4px;padding:var(--tag-padding,0 4px);color:#fff;color:var(--tag-text-color,#fff);font-size:12px;font-size:var(--tag-font-size,12px);line-height:16px;line-height:var(--tag-line-height,16px);border-radius:2px;border-radius:var(--tag-border-radius,2px)}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:inherit;content:"";pointer-events:none}.van-tag--medium{padding:2px 6px;padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{padding:4px 8px;padding:var(--tag-large-padding,4px 8px);font-size:14px;font-size:var(--tag-large-font-size,14px);border-radius:4px;border-radius:var(--tag-large-border-radius,4px)}.van-tag--mark{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--mark:after{display:block;width:2px;content:""}.van-tag--round{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{min-width:1em;margin-left:2px} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | props: { |
| | | show: Boolean, |
| | | mask: Boolean, |
| | | message: String, |
| | | forbidClick: Boolean, |
| | | zIndex: { |
| | | type: Number, |
| | | value: 1000, |
| | | }, |
| | | type: { |
| | | type: String, |
| | | value: 'text', |
| | | }, |
| | | loadingType: { |
| | | type: String, |
| | | value: 'circular', |
| | | }, |
| | | position: { |
| | | type: String, |
| | | value: 'middle', |
| | | }, |
| | | }, |
| | | methods: { |
| | | // for prevent touchmove |
| | | noop() {}, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-loading": "../loading/index", |
| | | "van-overlay": "../overlay/index", |
| | | "van-transition": "../transition/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <van-overlay |
| | | wx:if="{{ mask || forbidClick }}" |
| | | show="{{ show }}" |
| | | z-index="{{ zIndex }}" |
| | | custom-style="{{ mask ? '' : 'background-color: transparent;' }}" |
| | | /> |
| | | <van-transition |
| | | show="{{ show }}" |
| | | custom-style="z-index: {{ zIndex }}" |
| | | custom-class="van-toast__container" |
| | | > |
| | | <view |
| | | class="van-toast van-toast--{{ type === 'text' ? 'text' : 'icon' }} van-toast--{{ position }}" |
| | | catch:touchmove="noop" |
| | | > |
| | | <!-- text only --> |
| | | <text wx:if="{{ type === 'text' }}">{{ message }}</text> |
| | | |
| | | <!-- with icon --> |
| | | <block wx:else> |
| | | <van-loading |
| | | wx:if="{{ type === 'loading' }}" |
| | | color="white" |
| | | type="{{ loadingType }}" |
| | | custom-class="van-toast__loading" |
| | | /> |
| | | <van-icon wx:else class="van-toast__icon" name="{{ type }}" /> |
| | | <text wx:if="{{ message }}" class="van-toast__text">{{ message }}</text> |
| | | </block> |
| | | |
| | | <slot /> |
| | | </view> |
| | | </van-transition> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /// <reference types="miniprogram-api-typings" /> |
| | | declare type ToastMessage = string | number; |
| | | interface ToastOptions { |
| | | show?: boolean; |
| | | type?: string; |
| | | mask?: boolean; |
| | | zIndex?: number; |
| | | context?: |
| | | | WechatMiniprogram.Component.TrivialInstance |
| | | | WechatMiniprogram.Page.TrivialInstance; |
| | | position?: string; |
| | | duration?: number; |
| | | selector?: string; |
| | | forbidClick?: boolean; |
| | | loadingType?: string; |
| | | message?: ToastMessage; |
| | | onClose?: () => void; |
| | | } |
| | | declare function Toast( |
| | | toastOptions: ToastOptions | ToastMessage |
| | | ): |
| | | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | | undefined; |
| | | declare namespace Toast { |
| | | var loading: ( |
| | | options: string | number | ToastOptions |
| | | ) => |
| | | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | | undefined; |
| | | var success: ( |
| | | options: string | number | ToastOptions |
| | | ) => |
| | | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | | undefined; |
| | | var fail: ( |
| | | options: string | number | ToastOptions |
| | | ) => |
| | | | WechatMiniprogram.Component.Instance< |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | Record<string, any>, |
| | | false |
| | | > |
| | | | undefined; |
| | | var clear: () => void; |
| | | var setDefaultOptions: (options: ToastOptions) => void; |
| | | var resetDefaultOptions: () => void; |
| | | } |
| | | export default Toast; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { isObj } from '../common/validator'; |
| | | const defaultOptions = { |
| | | type: 'text', |
| | | mask: false, |
| | | message: '', |
| | | show: true, |
| | | zIndex: 1000, |
| | | duration: 2000, |
| | | position: 'middle', |
| | | forbidClick: false, |
| | | loadingType: 'circular', |
| | | selector: '#van-toast', |
| | | }; |
| | | let queue = []; |
| | | let currentOptions = Object.assign({}, defaultOptions); |
| | | function parseOptions(message) { |
| | | return isObj(message) ? message : { message }; |
| | | } |
| | | function getContext() { |
| | | const pages = getCurrentPages(); |
| | | return pages[pages.length - 1]; |
| | | } |
| | | function Toast(toastOptions) { |
| | | const options = Object.assign( |
| | | Object.assign({}, currentOptions), |
| | | parseOptions(toastOptions) |
| | | ); |
| | | const context = options.context || getContext(); |
| | | const toast = context.selectComponent(options.selector); |
| | | if (!toast) { |
| | | console.warn('æªæ¾å° van-toast èç¹ï¼è¯·ç¡®è®¤ selector å context æ¯å¦æ£ç¡®'); |
| | | return; |
| | | } |
| | | delete options.context; |
| | | delete options.selector; |
| | | toast.clear = () => { |
| | | toast.setData({ show: false }); |
| | | if (options.onClose) { |
| | | options.onClose(); |
| | | } |
| | | }; |
| | | queue.push(toast); |
| | | toast.setData(options); |
| | | clearTimeout(toast.timer); |
| | | if (options.duration != null && options.duration > 0) { |
| | | toast.timer = setTimeout(() => { |
| | | toast.clear(); |
| | | queue = queue.filter((item) => item !== toast); |
| | | }, options.duration); |
| | | } |
| | | return toast; |
| | | } |
| | | const createMethod = (type) => (options) => |
| | | Toast(Object.assign({ type }, parseOptions(options))); |
| | | Toast.loading = createMethod('loading'); |
| | | Toast.success = createMethod('success'); |
| | | Toast.fail = createMethod('fail'); |
| | | Toast.clear = () => { |
| | | queue.forEach((toast) => { |
| | | toast.clear(); |
| | | }); |
| | | queue = []; |
| | | }; |
| | | Toast.setDefaultOptions = (options) => { |
| | | Object.assign(currentOptions, options); |
| | | }; |
| | | Toast.resetDefaultOptions = () => { |
| | | currentOptions = Object.assign({}, defaultOptions); |
| | | }; |
| | | export default Toast; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { transition } from '../mixins/transition'; |
| | | VantComponent({ |
| | | classes: [ |
| | | 'enter-class', |
| | | 'enter-active-class', |
| | | 'enter-to-class', |
| | | 'leave-class', |
| | | 'leave-active-class', |
| | | 'leave-to-class', |
| | | ], |
| | | mixins: [transition(true)], |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view |
| | | wx:if="{{ inited }}" |
| | | class="van-transition custom-class {{ classes }}" |
| | | style="{{ computed.rootStyle({ currentDuration, display, customStyle }) }}" |
| | | bind:transitionend="onTransitionEnd" |
| | | > |
| | | <slot /> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | |
| | | function rootStyle(data) { |
| | | return style([ |
| | | { |
| | | '-webkit-transition-duration': data.currentDuration + 'ms', |
| | | 'transition-duration': data.currentDuration + 'ms', |
| | | }, |
| | | data.display ? null : 'display: none', |
| | | data.customStyle, |
| | | ]); |
| | | } |
| | | |
| | | module.exports = { |
| | | rootStyle: rootStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-transition{transition-timing-function:ease}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-fade-down-enter-active,.van-fade-down-leave-active,.van-fade-left-enter-active,.van-fade-left-leave-active,.van-fade-right-enter-active,.van-fade-right-leave-active,.van-fade-up-enter-active,.van-fade-up-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-fade-up-enter,.van-fade-up-leave-to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0);opacity:0}.van-fade-down-enter,.van-fade-down-leave-to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0);opacity:0}.van-fade-left-enter,.van-fade-left-leave-to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0);opacity:0}.van-fade-right-enter,.van-fade-right-leave-to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:0}.van-slide-down-enter-active,.van-slide-down-leave-active,.van-slide-left-enter-active,.van-slide-left-leave-active,.van-slide-right-enter-active,.van-slide-right-leave-active,.van-slide-up-enter-active,.van-slide-up-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-slide-up-enter,.van-slide-up-leave-to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}.van-slide-down-enter,.van-slide-down-leave-to{-webkit-transform:translate3d(0,-100%,0);transform:translate3d(0,-100%,0)}.van-slide-left-enter,.van-slide-left-leave-to{-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.van-slide-right-enter,.van-slide-right-leave-to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | VantComponent({ |
| | | classes: [ |
| | | 'main-item-class', |
| | | 'content-item-class', |
| | | 'main-active-class', |
| | | 'content-active-class', |
| | | 'main-disabled-class', |
| | | 'content-disabled-class', |
| | | ], |
| | | props: { |
| | | items: { |
| | | type: Array, |
| | | observer: 'updateSubItems', |
| | | }, |
| | | activeId: null, |
| | | mainActiveIndex: { |
| | | type: Number, |
| | | value: 0, |
| | | observer: 'updateSubItems', |
| | | }, |
| | | height: { |
| | | type: null, |
| | | value: 300, |
| | | }, |
| | | max: { |
| | | type: Number, |
| | | value: Infinity, |
| | | }, |
| | | selectedIcon: { |
| | | type: String, |
| | | value: 'success', |
| | | }, |
| | | }, |
| | | data: { |
| | | subItems: [], |
| | | }, |
| | | methods: { |
| | | // å½ä¸ä¸ªåé¡¹è¢«éæ©æ¶ |
| | | onSelectItem(event) { |
| | | const { item } = event.currentTarget.dataset; |
| | | const isArray = Array.isArray(this.data.activeId); |
| | | // å¤æææ²¡æè¶
åºå³ä¾§éæ©çæå¤§æ° |
| | | const isOverMax = isArray && this.data.activeId.length >= this.data.max; |
| | | // å¤æè¯¥é¡¹ææ²¡æè¢«éä¸, 妿æè¢«éä¸ï¼åå¿½è§æ¯å¦è¶
åºçæ¡ä»¶ |
| | | const isSelected = isArray |
| | | ? this.data.activeId.indexOf(item.id) > -1 |
| | | : this.data.activeId === item.id; |
| | | if (!item.disabled && (!isOverMax || isSelected)) { |
| | | this.$emit('click-item', item); |
| | | } |
| | | }, |
| | | // å½ä¸ä¸ªå¯¼èªè¢«ç¹å»æ¶ |
| | | onClickNav(event) { |
| | | const index = event.detail; |
| | | const item = this.data.items[index]; |
| | | if (!item.disabled) { |
| | | this.$emit('click-nav', { index }); |
| | | } |
| | | }, |
| | | // æ´æ°å项å表 |
| | | updateSubItems() { |
| | | const { items, mainActiveIndex } = this.data; |
| | | const { children = [] } = items[mainActiveIndex] || {}; |
| | | this.setData({ subItems: children }); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-sidebar": "../sidebar/index", |
| | | "van-sidebar-item": "../sidebar-item/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="wxs" /> |
| | | |
| | | <view |
| | | class="van-tree-select" |
| | | style="height: {{ utils.addUnit(height) }}" |
| | | > |
| | | <scroll-view scroll-y class="van-tree-select__nav"> |
| | | <van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner"> |
| | | <van-sidebar-item |
| | | wx:for="{{ items }}" |
| | | wx:key="index" |
| | | custom-class="main-item-class" |
| | | active-class="main-active-class" |
| | | disabled-class="main-disabled-class" |
| | | badge="{{ item.badge }}" |
| | | dot="{{ item.dot }}" |
| | | title="{{ item.text }}" |
| | | disabled="{{ item.disabled }}" |
| | | /> |
| | | </van-sidebar> |
| | | </scroll-view> |
| | | <scroll-view scroll-y class="van-tree-select__content"> |
| | | <slot name="content" /> |
| | | <view |
| | | wx:for="{{ subItems }}" |
| | | wx:key="id" |
| | | class="van-ellipsis content-item-class {{ utils.bem('tree-select__item', { active: wxs.isActive(activeId, item.id), disabled: item.disabled }) }} {{ wxs.isActive(activeId, item.id) ? 'content-active-class' : '' }} {{ item.disabled ? 'content-disabled-class' : '' }}" |
| | | data-item="{{ item }}" |
| | | bind:tap="onSelectItem" |
| | | > |
| | | {{ item.text }} |
| | | <van-icon |
| | | wx:if="{{ wxs.isActive(activeId, item.id) }}" |
| | | name="{{ selectedIcon }}" |
| | | size="16px" |
| | | class="van-tree-select__selected" |
| | | /> |
| | | </view> |
| | | </scroll-view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var array = require('../wxs/array.wxs'); |
| | | |
| | | function isActive (activeList, itemId) { |
| | | if (array.isArray(activeList)) { |
| | | return activeList.indexOf(itemId) > -1; |
| | | } |
| | | |
| | | return activeList === itemId; |
| | | } |
| | | |
| | | module.exports.isActive = isActive; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-tree-select{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none;font-size:14px;font-size:var(--tree-select-font-size,14px)}.van-tree-select__nav{-webkit-flex:1;flex:1;background-color:#f7f8fa;background-color:var(--tree-select-nav-background-color,#f7f8fa);--sidebar-padding:12px 8px 12px 12px}.van-tree-select__nav__inner{width:100%!important;height:100%}.van-tree-select__content{-webkit-flex:2;flex:2;background-color:#fff;background-color:var(--tree-select-content-background-color,#fff)}.van-tree-select__item{position:relative;font-weight:700;padding:0 32px 0 16px;padding:0 32px 0 var(--padding-md,16px);line-height:44px;line-height:var(--tree-select-item-height,44px)}.van-tree-select__item--active{color:#ee0a24;color:var(--tree-select-item-active-color,#ee0a24)}.van-tree-select__item--disabled{color:#c8c9cc;color:var(--tree-select-item-disabled-color,#c8c9cc)}.van-tree-select__selected{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);right:16px;right:var(--padding-md,16px)} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { VantComponent } from '../common/component'; |
| | | import { isImageFile, chooseFile, isVideoFile } from './utils'; |
| | | import { chooseImageProps, chooseVideoProps } from './shared'; |
| | | import { isBoolean, isPromise } from '../common/validator'; |
| | | VantComponent({ |
| | | props: Object.assign( |
| | | Object.assign( |
| | | { |
| | | disabled: Boolean, |
| | | multiple: Boolean, |
| | | uploadText: String, |
| | | useBeforeRead: Boolean, |
| | | afterRead: null, |
| | | beforeRead: null, |
| | | previewSize: { |
| | | type: null, |
| | | value: 80, |
| | | }, |
| | | name: { |
| | | type: null, |
| | | value: '', |
| | | }, |
| | | accept: { |
| | | type: String, |
| | | value: 'image', |
| | | }, |
| | | fileList: { |
| | | type: Array, |
| | | value: [], |
| | | observer: 'formatFileList', |
| | | }, |
| | | maxSize: { |
| | | type: Number, |
| | | value: Number.MAX_VALUE, |
| | | }, |
| | | maxCount: { |
| | | type: Number, |
| | | value: 100, |
| | | }, |
| | | deletable: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | showUpload: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | previewImage: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | previewFullImage: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | imageFit: { |
| | | type: String, |
| | | value: 'scaleToFill', |
| | | }, |
| | | uploadIcon: { |
| | | type: String, |
| | | value: 'photograph', |
| | | }, |
| | | }, |
| | | chooseImageProps |
| | | ), |
| | | chooseVideoProps |
| | | ), |
| | | data: { |
| | | lists: [], |
| | | isInCount: true, |
| | | }, |
| | | methods: { |
| | | formatFileList() { |
| | | const { fileList = [], maxCount } = this.data; |
| | | const lists = fileList.map((item) => |
| | | Object.assign(Object.assign({}, item), { |
| | | isImage: isImageFile(item), |
| | | isVideo: isVideoFile(item), |
| | | deletable: isBoolean(item.deletable) ? item.deletable : true, |
| | | }) |
| | | ); |
| | | this.setData({ lists, isInCount: lists.length < maxCount }); |
| | | }, |
| | | getDetail(index) { |
| | | return { |
| | | name: this.data.name, |
| | | index: index == null ? this.data.fileList.length : index, |
| | | }; |
| | | }, |
| | | startUpload() { |
| | | const { maxCount, multiple, lists, disabled } = this.data; |
| | | if (disabled) return; |
| | | chooseFile( |
| | | Object.assign(Object.assign({}, this.data), { |
| | | maxCount: maxCount - lists.length, |
| | | }) |
| | | ) |
| | | .then((res) => { |
| | | this.onBeforeRead(multiple ? res : res[0]); |
| | | }) |
| | | .catch((error) => { |
| | | this.$emit('error', error); |
| | | }); |
| | | }, |
| | | onBeforeRead(file) { |
| | | const { beforeRead, useBeforeRead } = this.data; |
| | | let res = true; |
| | | if (typeof beforeRead === 'function') { |
| | | res = beforeRead(file, this.getDetail()); |
| | | } |
| | | if (useBeforeRead) { |
| | | res = new Promise((resolve, reject) => { |
| | | this.$emit( |
| | | 'before-read', |
| | | Object.assign(Object.assign({ file }, this.getDetail()), { |
| | | callback: (ok) => { |
| | | ok ? resolve() : reject(); |
| | | }, |
| | | }) |
| | | ); |
| | | }); |
| | | } |
| | | if (!res) { |
| | | return; |
| | | } |
| | | if (isPromise(res)) { |
| | | res.then((data) => this.onAfterRead(data || file)); |
| | | } else { |
| | | this.onAfterRead(file); |
| | | } |
| | | }, |
| | | onAfterRead(file) { |
| | | const { maxSize, afterRead } = this.data; |
| | | const oversize = Array.isArray(file) |
| | | ? file.some((item) => item.size > maxSize) |
| | | : file.size > maxSize; |
| | | if (oversize) { |
| | | this.$emit('oversize', Object.assign({ file }, this.getDetail())); |
| | | return; |
| | | } |
| | | if (typeof afterRead === 'function') { |
| | | afterRead(file, this.getDetail()); |
| | | } |
| | | this.$emit('after-read', Object.assign({ file }, this.getDetail())); |
| | | }, |
| | | deleteItem(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | this.$emit( |
| | | 'delete', |
| | | Object.assign(Object.assign({}, this.getDetail(index)), { |
| | | file: this.data.fileList[index], |
| | | }) |
| | | ); |
| | | }, |
| | | onPreviewImage(event) { |
| | | if (!this.data.previewFullImage) return; |
| | | const { index } = event.currentTarget.dataset; |
| | | const { lists } = this.data; |
| | | const item = lists[index]; |
| | | wx.previewImage({ |
| | | urls: lists.filter((item) => isImageFile(item)).map((item) => item.url), |
| | | current: item.url, |
| | | fail() { |
| | | wx.showToast({ title: 'é¢è§å¾ç失败', icon: 'none' }); |
| | | }, |
| | | }); |
| | | }, |
| | | onPreviewVideo(event) { |
| | | if (!this.data.previewFullImage) return; |
| | | const { index } = event.currentTarget.dataset; |
| | | const { lists } = this.data; |
| | | wx.previewMedia({ |
| | | sources: lists |
| | | .filter((item) => isVideoFile(item)) |
| | | .map((item) => |
| | | Object.assign(Object.assign({}, item), { type: 'video' }) |
| | | ), |
| | | current: index, |
| | | fail() { |
| | | wx.showToast({ title: 'é¢è§è§é¢å¤±è´¥', icon: 'none' }); |
| | | }, |
| | | }); |
| | | }, |
| | | onPreviewFile(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | wx.openDocument({ |
| | | filePath: this.data.lists[index].url, |
| | | showMenu: true, |
| | | }); |
| | | }, |
| | | onClickPreview(event) { |
| | | const { index } = event.currentTarget.dataset; |
| | | const item = this.data.lists[index]; |
| | | this.$emit( |
| | | 'click-preview', |
| | | Object.assign(Object.assign({}, item), this.getDetail(index)) |
| | | ); |
| | | }, |
| | | }, |
| | | }); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "component": true, |
| | | "usingComponents": { |
| | | "van-icon": "../icon/index", |
| | | "van-loading": "../loading/index" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <wxs src="../wxs/utils.wxs" module="utils" /> |
| | | <wxs src="./index.wxs" module="computed" /> |
| | | |
| | | <view class="van-uploader"> |
| | | <view class="van-uploader__wrapper"> |
| | | <!-- é¢è§æ ·å¼ --> |
| | | <view |
| | | wx:if="{{ previewImage }}" |
| | | wx:for="{{ lists }}" |
| | | wx:key="index" |
| | | class="van-uploader__preview" |
| | | data-index="{{ index }}" |
| | | bindtap="onClickPreview" |
| | | > |
| | | <image |
| | | wx:if="{{ item.isImage }}" |
| | | mode="{{ imageFit }}" |
| | | src="{{ item.thumb || item.url }}" |
| | | alt="{{ item.name || ('å¾ç' + index) }}" |
| | | class="van-uploader__preview-image" |
| | | style="{{ computed.sizeStyle({ previewSize }) }}" |
| | | data-index="{{ index }}" |
| | | bindtap="onPreviewImage" |
| | | /> |
| | | <video |
| | | wx:elif="{{ item.isVideo }}" |
| | | src="{{ item.url }}" |
| | | title="{{ item.name || ('è§é¢' + index) }}" |
| | | poster="{{ item.thumb }}" |
| | | autoplay="{{ item.autoplay }}" |
| | | class="van-uploader__preview-image" |
| | | style="{{ computed.sizeStyle({ previewSize }) }}" |
| | | data-index="{{ index }}" |
| | | bindtap="onPreviewVideo" |
| | | > |
| | | </video> |
| | | <view |
| | | wx:else |
| | | class="van-uploader__file" |
| | | style="{{ computed.sizeStyle({ previewSize }) }}" |
| | | data-index="{{ index }}" |
| | | bindtap="onPreviewFile" |
| | | > |
| | | <van-icon name="description" class="van-uploader__file-icon" /> |
| | | <view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url }}</view> |
| | | </view> |
| | | <view |
| | | wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}" |
| | | class="van-uploader__mask" |
| | | > |
| | | <van-icon wx:if="{{ item.status === 'failed' }}" name="close" class="van-uploader__mask-icon" /> |
| | | <van-loading wx:else custom-class="van-uploader__loading" /> |
| | | <text wx:if="{{ item.message }}" class="van-uploader__mask-message">{{ item.message }}</text> |
| | | </view> |
| | | <view |
| | | wx:if="{{ deletable && item.deletable }}" |
| | | data-index="{{ index }}" |
| | | class="van-uploader__preview-delete" |
| | | catch:tap="deleteItem" |
| | | > |
| | | <van-icon name="cross" class="van-uploader__preview-delete-icon" /> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- ä¸ä¼ æ ·å¼ --> |
| | | <block wx:if="{{ isInCount }}"> |
| | | <view class="van-uploader__slot" bindtap="startUpload"> |
| | | <slot /> |
| | | </view> |
| | | |
| | | <!-- é»è®¤ä¸ä¼ æ ·å¼ --> |
| | | <view |
| | | wx:if="{{ showUpload }}" |
| | | class="van-uploader__upload {{ disabled ? 'van-uploader__upload--disabled': ''}}" |
| | | style="{{ computed.sizeStyle({ previewSize }) }}" |
| | | bindtap="startUpload" |
| | | > |
| | | <van-icon name="{{ uploadIcon }}" class="van-uploader__upload-icon" /> |
| | | <text wx:if="{{ uploadText }}" class="van-uploader__upload-text">{{ uploadText }}</text> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var style = require('../wxs/style.wxs'); |
| | | var addUnit = require('../wxs/add-unit.wxs'); |
| | | |
| | | function sizeStyle(data) { |
| | | return style({ |
| | | width: addUnit(data.previewSize), |
| | | height: addUnit(data.previewSize), |
| | | }); |
| | | } |
| | | |
| | | module.exports = { |
| | | sizeStyle: sizeStyle, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;width:var(--uploader-size,80px);height:80px;height:var(--uploader-size,80px);margin:0 8px 8px 0;margin:0 var(--padding-xs,8px) var(--padding-xs,8px) 0;background-color:#f7f8fa;background-color:var(--uploader-upload-background-color,#f7f8fa)}.van-uploader__upload:active{background-color:#f2f3f5;background-color:var(--uploader-upload-active-color,#f2f3f5)}.van-uploader__upload-icon{color:#dcdee0;color:var(--uploader-icon-color,#dcdee0);font-size:24px;font-size:var(--uploader-icon-size,24px)}.van-uploader__upload-text{margin-top:8px;margin-top:var(--padding-xs,8px);color:#969799;color:var(--uploader-text-color,#969799);font-size:12px;font-size:var(--uploader-text-font-size,12px)}.van-uploader__upload--disabled{opacity:.5;opacity:var(--uploader-disabled-opacity,.5)}.van-uploader__preview{position:relative;cursor:pointer;margin:0 8px 8px 0;margin:0 var(--padding-xs,8px) var(--padding-xs,8px) 0}.van-uploader__preview-image{display:block;overflow:hidden;width:80px;width:var(--uploader-size,80px);height:80px;height:var(--uploader-size,80px)}.van-uploader__preview-delete{padding:0 0 8px 8px;padding:0 0 var(--padding-xs,8px) var(--padding-xs,8px)}.van-uploader__preview-delete,.van-uploader__preview-delete:after{position:absolute;top:0;right:0;width:14px;width:var(--uploader-delete-icon-size,14px);height:14px;height:var(--uploader-delete-icon-size,14px)}.van-uploader__preview-delete:after{content:"";background-color:rgba(0,0,0,.7);background-color:var(--uploader-delete-background-color,rgba(0,0,0,.7));border-radius:0 0 0 12px;border-radius:0 0 0 calc(var(--uploader-delete-icon-size, 14px) - 2px)}.van-uploader__preview-delete-icon{position:absolute;top:-2px;right:-2px;z-index:1;-webkit-transform:scale(.5);transform:scale(.5);font-size:16px;font-size:calc(var(--uploader-delete-icon-size, 14px) + 2px);color:#fff;color:var(--uploader-delete-color,#fff)}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;width:var(--uploader-size,80px);height:80px;height:var(--uploader-size,80px);background-color:#f7f8fa;background-color:var(--uploader-file-background-color,#f7f8fa)}.van-uploader__file-icon{color:#646566;color:var(--uploader-file-icon-color,#646566);font-size:20px;font-size:var(--uploader-file-icon-size,20px)}.van-uploader__file-name{box-sizing:border-box;width:100%;text-align:center;margin-top:8px;margin-top:var(--uploader-file-name-margin-top,8px);padding:0 4px;padding:var(--uploader-file-name-padding,0 4px);color:#646566;color:var(--uploader-file-name-text-color,#646566);font-size:12px;font-size:var(--uploader-file-name-font-size,12px)}.van-uploader__mask{position:absolute;top:0;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#fff;color:var(--white,#fff);background-color:rgba(50,50,51,.88);background-color:var(--uploader-mask-background-color,rgba(50,50,51,.88))}.van-uploader__mask-icon{font-size:22px;font-size:var(--uploader-mask-icon-size,22px)}.van-uploader__mask-message{margin-top:6px;padding:0 4px;padding:0 var(--padding-base,4px);font-size:12px;font-size:var(--uploader-mask-message-font-size,12px);line-height:14px;line-height:var(--uploader-mask-message-line-height,14px)}.van-uploader__loading{width:22px;width:var(--uploader-loading-icon-size,22px);height:22px;height:var(--uploader-loading-icon-size,22px);color:#fff!important;color:var(--uploader-loading-icon-color,#fff)!important} |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export declare const chooseImageProps: { |
| | | sizeType: { |
| | | type: ArrayConstructor; |
| | | value: string[]; |
| | | }; |
| | | capture: { |
| | | type: ArrayConstructor; |
| | | value: string[]; |
| | | }; |
| | | }; |
| | | export declare const chooseVideoProps: { |
| | | capture: { |
| | | type: ArrayConstructor; |
| | | value: string[]; |
| | | }; |
| | | compressed: { |
| | | type: BooleanConstructor; |
| | | value: boolean; |
| | | }; |
| | | maxDuration: { |
| | | type: NumberConstructor; |
| | | value: number; |
| | | }; |
| | | camera: { |
| | | type: StringConstructor; |
| | | value: string; |
| | | }; |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // props for choose image |
| | | export const chooseImageProps = { |
| | | sizeType: { |
| | | type: Array, |
| | | value: ['original', 'compressed'], |
| | | }, |
| | | capture: { |
| | | type: Array, |
| | | value: ['album', 'camera'], |
| | | }, |
| | | }; |
| | | // props for choose video |
| | | export const chooseVideoProps = { |
| | | capture: { |
| | | type: Array, |
| | | value: ['album', 'camera'], |
| | | }, |
| | | compressed: { |
| | | type: Boolean, |
| | | value: true, |
| | | }, |
| | | maxDuration: { |
| | | type: Number, |
| | | value: 60, |
| | | }, |
| | | camera: { |
| | | type: String, |
| | | value: 'back', |
| | | }, |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | export interface File { |
| | | url: string; |
| | | size?: number; |
| | | name?: string; |
| | | type: string; |
| | | duration?: number; |
| | | time?: number; |
| | | isImage?: boolean; |
| | | isVideo?: boolean; |
| | | } |
| | | export declare function isImageFile(item: File): boolean; |
| | | export declare function isVideoFile(item: File): boolean; |
| | | export declare function chooseFile({ |
| | | accept, |
| | | multiple, |
| | | capture, |
| | | compressed, |
| | | maxDuration, |
| | | sizeType, |
| | | camera, |
| | | maxCount, |
| | | }: { |
| | | accept: any; |
| | | multiple: any; |
| | | capture: any; |
| | | compressed: any; |
| | | maxDuration: any; |
| | | sizeType: any; |
| | | camera: any; |
| | | maxCount: any; |
| | | }): Promise<File | File[]>; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { pickExclude } from '../common/utils'; |
| | | import { isImageUrl, isVideoUrl } from '../common/validator'; |
| | | export function isImageFile(item) { |
| | | if (item.isImage != null) { |
| | | return item.isImage; |
| | | } |
| | | if (item.type) { |
| | | return item.type === 'image'; |
| | | } |
| | | if (item.url) { |
| | | return isImageUrl(item.url); |
| | | } |
| | | return false; |
| | | } |
| | | export function isVideoFile(item) { |
| | | if (item.isVideo != null) { |
| | | return item.isVideo; |
| | | } |
| | | if (item.type) { |
| | | return item.type === 'video'; |
| | | } |
| | | if (item.url) { |
| | | return isVideoUrl(item.url); |
| | | } |
| | | return false; |
| | | } |
| | | function formatImage(res) { |
| | | return res.tempFiles.map((item) => |
| | | Object.assign(Object.assign({}, pickExclude(item, ['path'])), { |
| | | type: 'image', |
| | | url: item.path, |
| | | thumb: item.path, |
| | | }) |
| | | ); |
| | | } |
| | | function formatVideo(res) { |
| | | return [ |
| | | Object.assign( |
| | | Object.assign( |
| | | {}, |
| | | pickExclude(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg']) |
| | | ), |
| | | { type: 'video', url: res.tempFilePath, thumb: res.thumbTempFilePath } |
| | | ), |
| | | ]; |
| | | } |
| | | function formatMedia(res) { |
| | | return res.tempFiles.map((item) => |
| | | Object.assign( |
| | | Object.assign( |
| | | {}, |
| | | pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath']) |
| | | ), |
| | | { |
| | | type: res.type, |
| | | url: item.tempFilePath, |
| | | thumb: |
| | | res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath, |
| | | } |
| | | ) |
| | | ); |
| | | } |
| | | function formatFile(res) { |
| | | return res.tempFiles.map((item) => |
| | | Object.assign(Object.assign({}, pickExclude(item, ['path'])), { |
| | | url: item.path, |
| | | }) |
| | | ); |
| | | } |
| | | export function chooseFile({ |
| | | accept, |
| | | multiple, |
| | | capture, |
| | | compressed, |
| | | maxDuration, |
| | | sizeType, |
| | | camera, |
| | | maxCount, |
| | | }) { |
| | | return new Promise((resolve, reject) => { |
| | | switch (accept) { |
| | | case 'image': |
| | | wx.chooseImage({ |
| | | count: multiple ? Math.min(maxCount, 9) : 1, |
| | | sourceType: capture, |
| | | sizeType, |
| | | success: (res) => resolve(formatImage(res)), |
| | | fail: reject, |
| | | }); |
| | | break; |
| | | case 'media': |
| | | wx.chooseMedia({ |
| | | count: multiple ? Math.min(maxCount, 9) : 1, |
| | | sourceType: capture, |
| | | maxDuration, |
| | | sizeType, |
| | | camera, |
| | | success: (res) => resolve(formatMedia(res)), |
| | | fail: reject, |
| | | }); |
| | | break; |
| | | case 'video': |
| | | wx.chooseVideo({ |
| | | sourceType: capture, |
| | | compressed, |
| | | maxDuration, |
| | | camera, |
| | | success: (res) => resolve(formatVideo(res)), |
| | | fail: reject, |
| | | }); |
| | | break; |
| | | default: |
| | | wx.chooseMessageFile({ |
| | | count: multiple ? maxCount : 1, |
| | | type: accept, |
| | | success: (res) => resolve(formatFile(res)), |
| | | fail: reject, |
| | | }); |
| | | break; |
| | | } |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var REGEXP = getRegExp('^-?\d+(\.\d+)?$'); |
| | | |
| | | function addUnit(value) { |
| | | if (value == null) { |
| | | return undefined; |
| | | } |
| | | |
| | | return REGEXP.test('' + value) ? value + 'px' : value; |
| | | } |
| | | |
| | | module.exports = addUnit; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | function isArray(array) { |
| | | return array && array.constructor === 'Array'; |
| | | } |
| | | |
| | | module.exports.isArray = isArray; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var array = require('./array.wxs'); |
| | | var object = require('./object.wxs'); |
| | | var PREFIX = 'van-'; |
| | | |
| | | function join(name, mods) { |
| | | name = PREFIX + name; |
| | | mods = mods.map(function(mod) { |
| | | return name + '--' + mod; |
| | | }); |
| | | mods.unshift(name); |
| | | return mods.join(' '); |
| | | } |
| | | |
| | | function traversing(mods, conf) { |
| | | if (!conf) { |
| | | return; |
| | | } |
| | | |
| | | if (typeof conf === 'string' || typeof conf === 'number') { |
| | | mods.push(conf); |
| | | } else if (array.isArray(conf)) { |
| | | conf.forEach(function(item) { |
| | | traversing(mods, item); |
| | | }); |
| | | } else if (typeof conf === 'object') { |
| | | object.keys(conf).forEach(function(key) { |
| | | conf[key] && mods.push(key); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | function bem(name, conf) { |
| | | var mods = []; |
| | | traversing(mods, conf); |
| | | return join(name, mods); |
| | | } |
| | | |
| | | module.exports = bem; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * Simple memoize |
| | | * wxs doesn't support fn.apply, so this memoize only support up to 2 args |
| | | */ |
| | | /* eslint-disable */ |
| | | |
| | | function isPrimitive(value) { |
| | | var type = typeof value; |
| | | return ( |
| | | type === 'boolean' || |
| | | type === 'number' || |
| | | type === 'string' || |
| | | type === 'undefined' || |
| | | value === null |
| | | ); |
| | | } |
| | | |
| | | // mock simple fn.call in wxs |
| | | function call(fn, args) { |
| | | if (args.length === 2) { |
| | | return fn(args[0], args[1]); |
| | | } |
| | | |
| | | if (args.length === 1) { |
| | | return fn(args[0]); |
| | | } |
| | | |
| | | return fn(); |
| | | } |
| | | |
| | | function serializer(args) { |
| | | if (args.length === 1 && isPrimitive(args[0])) { |
| | | return args[0]; |
| | | } |
| | | var obj = {}; |
| | | for (var i = 0; i < args.length; i++) { |
| | | obj['key' + i] = args[i]; |
| | | } |
| | | return JSON.stringify(obj); |
| | | } |
| | | |
| | | function memoize(fn) { |
| | | var cache = {}; |
| | | |
| | | return function() { |
| | | var key = serializer(arguments); |
| | | if (cache[key] === undefined) { |
| | | cache[key] = call(fn, arguments); |
| | | } |
| | | |
| | | return cache[key]; |
| | | }; |
| | | } |
| | | |
| | | module.exports = memoize; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var REGEXP = getRegExp('{|}|"', 'g'); |
| | | |
| | | function keys(obj) { |
| | | return JSON.stringify(obj) |
| | | .replace(REGEXP, '') |
| | | .split(',') |
| | | .map(function(item) { |
| | | return item.split(':')[0]; |
| | | }); |
| | | } |
| | | |
| | | module.exports.keys = keys; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var object = require('./object.wxs'); |
| | | var array = require('./array.wxs'); |
| | | |
| | | function style(styles) { |
| | | if (array.isArray(styles)) { |
| | | return styles |
| | | .filter(function (item) { |
| | | return item != null && item !== ''; |
| | | }) |
| | | .map(function (item) { |
| | | return style(item); |
| | | }) |
| | | .join(';'); |
| | | } |
| | | |
| | | if ('Object' === styles.constructor) { |
| | | return object |
| | | .keys(styles) |
| | | .filter(function (key) { |
| | | return styles[key] != null && styles[key] !== ''; |
| | | }) |
| | | .map(function (key) { |
| | | return [key, [styles[key]]].join(':'); |
| | | }) |
| | | .join(';'); |
| | | } |
| | | |
| | | return styles; |
| | | } |
| | | |
| | | module.exports = style; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* eslint-disable */ |
| | | var bem = require('./bem.wxs'); |
| | | var memoize = require('./memoize.wxs'); |
| | | var addUnit = require('./add-unit.wxs'); |
| | | |
| | | module.exports = { |
| | | bem: memoize(bem), |
| | | memoize: memoize, |
| | | addUnit: addUnit |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import Vue from 'vue' |
| | | import App from './App' |
| | | //å¤çæ¶é´ |
| | | import moment from 'moment' |
| | | import {baseUrl} from './src/untils/request.js' |
| | | // æè½½å°å
¨å±ä½¿ç¨ |
| | | Vue.prototype.$myHOST = baseUrl |
| | | Vue.prototype.$moment = moment |
| | | Vue.prototype.ScanAudio = function() { |
| | | var musice = null; |
| | | music = uni.createInnerAudioContext(); //åå»ºææ¾å¨å¯¹è±¡ |
| | | music.src = "./static/musice/13716.wav" //éæ©ææ¾çé³é¢ |
| | | music.play() //æ§è¡ææ¾ |
| | | } |
| | | /*å¼å
¥uview-ui*/ |
| | | import uView from "uview-ui"; |
| | | Vue.use(uView) |
| | | |
| | | Vue.config.productionTip = false |
| | | |
| | | App.mpType = 'app' |
| | | |
| | | const app = new Vue({ |
| | | ...App |
| | | }) |
| | | app.$mount() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name" : "伿¬éæ±½PDA", |
| | | "appid" : "__UNI__EB80143", |
| | | "description" : "", |
| | | "versionName" : "1.1.70", |
| | | "versionCode" : 1, |
| | | "transformPx" : false, |
| | | "app-plus" : { |
| | | "compatible" : { |
| | | "ignoreVersion" : true |
| | | }, |
| | | "usingComponents" : true, |
| | | "nvueCompiler" : "uni-app", |
| | | "compilerVersion" : 3, |
| | | "splashscreen" : { |
| | | "alwaysShowBeforeRender" : true, |
| | | "waiting" : true, |
| | | "autoclose" : true, |
| | | "delay" : 0 |
| | | }, |
| | | "modules" : { |
| | | "Bluetooth" : {}, |
| | | "Geolocation" : {} |
| | | }, |
| | | "distribute" : { |
| | | "android" : { |
| | | "permissions" : [ |
| | | "<uses-feature android:name=\"android.hardware.camera\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_CHECKIN_PROPERTIES\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.BROADCAST_WAP_PUSH\"/>", |
| | | "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>", |
| | | "<uses-permission android:name=\"android.permission.CAMERA\"/>", |
| | | "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", |
| | | "<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/>", |
| | | "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>", |
| | | "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", |
| | | "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", |
| | | "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>", |
| | | "<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/>", |
| | | "<uses-permission android:name=\"android.permission.VIBRATE\"/>", |
| | | "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", |
| | | "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", |
| | | "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />", |
| | | "<uses-permission android:name=\"android.permission.BLUETOOTH\" />" |
| | | ], |
| | | "autoSdkPermissions" : true, |
| | | "targetSdkVersion" : "apkçç®æ çæ¬,é»è®¤å¼ä¸º28" |
| | | }, |
| | | "ios" : { |
| | | "dSYMs" : false |
| | | }, |
| | | "sdkConfigs" : { |
| | | "ad" : {}, |
| | | "geolocation" : {} |
| | | }, |
| | | "icons" : { |
| | | "android" : { |
| | | "hdpi" : "unpackage/res/icons/72x72.png", |
| | | "xhdpi" : "unpackage/res/icons/96x96.png", |
| | | "xxhdpi" : "unpackage/res/icons/144x144.png", |
| | | "xxxhdpi" : "unpackage/res/icons/192x192.png" |
| | | }, |
| | | "ios" : { |
| | | "appstore" : "unpackage/res/icons/1024x1024.png", |
| | | "ipad" : { |
| | | "app" : "unpackage/res/icons/76x76.png", |
| | | "app@2x" : "unpackage/res/icons/152x152.png", |
| | | "notification" : "unpackage/res/icons/20x20.png", |
| | | "notification@2x" : "unpackage/res/icons/40x40.png", |
| | | "proapp@2x" : "unpackage/res/icons/167x167.png", |
| | | "settings" : "unpackage/res/icons/29x29.png", |
| | | "settings@2x" : "unpackage/res/icons/58x58.png", |
| | | "spotlight" : "unpackage/res/icons/40x40.png", |
| | | "spotlight@2x" : "unpackage/res/icons/80x80.png" |
| | | }, |
| | | "iphone" : { |
| | | "app@2x" : "unpackage/res/icons/120x120.png", |
| | | "app@3x" : "unpackage/res/icons/180x180.png", |
| | | "notification@2x" : "unpackage/res/icons/40x40.png", |
| | | "notification@3x" : "unpackage/res/icons/60x60.png", |
| | | "settings@2x" : "unpackage/res/icons/58x58.png", |
| | | "settings@3x" : "unpackage/res/icons/87x87.png", |
| | | "spotlight@2x" : "unpackage/res/icons/80x80.png", |
| | | "spotlight@3x" : "unpackage/res/icons/120x120.png" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "quickapp" : {}, |
| | | "mp-weixin" : { |
| | | "appid" : "", |
| | | "setting" : { |
| | | "urlCheck" : false |
| | | }, |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-alipay" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-baidu" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "mp-toutiao" : { |
| | | "usingComponents" : true |
| | | }, |
| | | "uniStatistics" : { |
| | | "enable" : false |
| | | }, |
| | | "h5" : { |
| | | "title" : "__UNI__2C28086" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import printerUtil from '@/components/print/printerutil.js' |
| | | const PrinterJobs = require('@/components/print/printerjobs.js') |
| | | // import { |
| | | // getDate |
| | | // } from '@/utils/dateTime.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | |
| | | list: [], |
| | | deviceId: '', |
| | | serviceId: '', |
| | | characteristics: [], |
| | | characteristicId: '', |
| | | deviceslist: [] |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.list = [] |
| | | this.deviceslist = [] |
| | | |
| | | }, |
| | | methods: { |
| | | //åå§åèçè®¾å¤ |
| | | openBluetoothAdapter() { |
| | | let _this = this |
| | | uni.openBluetoothAdapter({ |
| | | success: (res) => { //å·²æå¼ |
| | | uni.getBluetoothAdapterState({ //èççå¹é
ç¶æ |
| | | success: (res1) => { |
| | | console.log(res1, 'æ¬æºè®¾å¤çèçå·²æå¼') |
| | | // å¼å§æç´¢èçè®¾å¤ |
| | | |
| | | _this.startBluetoothDeviceDiscovery() |
| | | uni.setStorageSync('blueShow', true) |
| | | }, |
| | | fail(error) { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: 'æ¥çææºèçæ¯å¦æå¼err' |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | fail: err => { //æªæå¼ |
| | | uni.setStorageSync('blueShow', false) |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: 'æ¥çææºèçæ¯å¦æå¼' |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | // å¼å§æç´¢èçè®¾å¤ |
| | | startBluetoothDeviceDiscovery() { |
| | | uni.startBluetoothDevicesDiscovery({ |
| | | success: (res) => { |
| | | // åç°å¤å´è®¾å¤ |
| | | uni.showLoading({ |
| | | title: 'å è½½ä¸', |
| | | mask: true |
| | | }); |
| | | this.onBluetoothDeviceFound() |
| | | }, |
| | | fail: err => { |
| | | console.log(err, 'é误信æ¯') |
| | | } |
| | | }) |
| | | }, |
| | | // åç°å¤å´è®¾å¤ |
| | | onBluetoothDeviceFound() { |
| | | uni.onBluetoothDeviceFound((res) => { |
| | | this.deviceslist.length > 0 ? uni.hideLoading() : '' |
| | | if (this.deviceslist.indexOf(res.devices[0].deviceId) == -1) { |
| | | this.deviceslist.push(res.devices[0].deviceId) |
| | | if (res.devices[0].name != "") { |
| | | uni.hideLoading(); |
| | | this.list.push({ |
| | | name: res.devices[0].name, |
| | | deviceId: res.devices[0].deviceId |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | //è·åå¨èçæ¨¡åçææé´ææå·²åç°çèç设å¤ãå
æ¬å·²ç»åæ¬æºå¤äºè¿æ¥ç¶æç设å¤ã |
| | | getBluetoothDevices() { |
| | | console.log("è·åèç设å¤"); |
| | | uni.getBluetoothDevices({ |
| | | success: res => { |
| | | console.log('è·åèçè®¾å¤æå:'); |
| | | console.log(res.devices); |
| | | } |
| | | }); |
| | | }, |
| | | //éæ©è®¾å¤è¿æ¥å§deviceIdä¼ è¿æ¥ |
| | | createBLEConnection(deviceId) { |
| | | //dataéé¢å»ºç«ä¸ä¸ªdeviceIdï¼åå¨èµ·æ¥ |
| | | let _this = this |
| | | uni.showLoading({ |
| | | title: 'è¿æ¥èçä¸...', |
| | | mask: true |
| | | }); |
| | | this.stopBluetoothDevicesDiscovery() |
| | | |
| | | this.deviceId = deviceId, |
| | | //è¿æ¥èç |
| | | uni.createBLEConnection({ |
| | | // è¿éç deviceId éè¦å·²ç»éè¿ createBLEConnection ä¸å¯¹åºè®¾å¤å»ºç«é¾æ¥ |
| | | deviceId: deviceId, |
| | | success(res) { |
| | | uni.hideLoading(); |
| | | // uni.showToast({ |
| | | // icon: 'none', |
| | | // title: 'èçè¿æ¥æå' |
| | | // }); |
| | | uni.setStorageSync("deviceId", deviceId) //æå·²ç»è¿æ¥çèç设å¤ä¿¡æ¯æ¾å
¥ç¼å |
| | | |
| | | setTimeout(() => { |
| | | _this.getBLEDeviceServices(deviceId) |
| | | }, 1000) |
| | | |
| | | }, |
| | | fail(res) { |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | title: 'èçè¿æ¥å¤±è´¥' |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | // 忢æå¯»èçè®¾å¤ |
| | | stopBluetoothDevicesDiscovery() { |
| | | uni.stopBluetoothDevicesDiscovery({ |
| | | success: e => { |
| | | this.loading = false |
| | | console.log('忢æç´¢èç设å¤:' + e.errMsg); |
| | | }, |
| | | fail: e => { |
| | | console.log('忢æç´¢èç设å¤å¤±è´¥ï¼é误ç ï¼' + e.errCode); |
| | | } |
| | | }); |
| | | }, |
| | | //è·åèçç¹å¾ |
| | | getBLEDeviceCharacteristics(deviceId, serviceId,callback) { |
| | | console.log("è¿å
¥ç¹å¾"); |
| | | setTimeout(() => { |
| | | uni.getBLEDeviceCharacteristics({ |
| | | // è¿éç deviceId éè¦å·²ç»éè¿ createBLEConnection ä¸å¯¹åºè®¾å¤å»ºç«é¾æ¥ |
| | | deviceId: deviceId, |
| | | // è¿éç serviceId éè¦å¨ getBLEDeviceServices æ¥å£ä¸è·å |
| | | serviceId: serviceId, |
| | | success: (res) => { |
| | | console.log(res, 'ç¹å¾getBLEDeviceCharacteristics') |
| | | this.characteristics = res.characteristics |
| | | |
| | | let _noCharacteristics = true; |
| | | console.log('characteristicsé¿åº¦ï¼'+res.characteristics.length) |
| | | for (let i=0;i<res.characteristics.length;i++) { |
| | | console.log(`characteristics${i}çuuidï¼${res.characteristics[i].uuid}`) |
| | | if (res.characteristics[i].uuid.indexOf("FF02") != -1) { |
| | | this.characteristicId = res.characteristics[i].uuid |
| | | uni.setStorageSync("characteristicId", res.characteristics[i].uuid) //æå·²ç»è¿æ¥çèçè®¾å¤æ è¯æ¾å
¥ç¼å |
| | | uni.setStorageSync("serviceId",serviceId) //æå·²ç»è¿æ¥çèç设å¤IDæ¾å
¥ç¼å |
| | | setTimeout(() => { |
| | | uni.hideLoading(); |
| | | this.BottomShow = false |
| | | this.DrawerModalL = false |
| | | }, 1000) |
| | | _noCharacteristics=false; |
| | | callback && callback(true) |
| | | break; |
| | | } |
| | | } |
| | | if (_noCharacteristics) { |
| | | callback && callback(false) |
| | | } |
| | | }, |
| | | fail: (res) => { |
| | | console.log(res) |
| | | callback && callback(false) |
| | | } |
| | | }) |
| | | }, 1000) |
| | | }, |
| | | // å¯ç¨ notify åè½ |
| | | notifyBLECharacteristicValueChange(characteristicId) { |
| | | let _this = this |
| | | console.log('deviceId' + _this.deviceId) |
| | | console.log('serviceId' + _this.serviceId) |
| | | console.log('characteristicId' + characteristicId) |
| | | // _this.fanhui() |
| | | uni.notifyBLECharacteristicValueChange({ |
| | | state: true, // å¯ç¨ notify åè½ |
| | | // è¿éç deviceId éè¦å·²ç»éè¿ createBLEConnection ä¸å¯¹åºè®¾å¤å»ºç«é¾æ¥ |
| | | deviceId: this.deviceId, |
| | | // è¿éç serviceId éè¦å¨ getBLEDeviceServices æ¥å£ä¸è·å |
| | | serviceId: this.serviceId, |
| | | // è¿éç characteristicId éè¦å¨ getBLEDeviceCharacteristics æ¥å£ä¸è·å |
| | | characteristicId: characteristicId, |
| | | success: (res) => { |
| | | if (this.blueFlag == true) { |
| | | this.writeBLECharacteristicValue() |
| | | } else { |
| | | uni.showLoading({ |
| | | title: 'èçæå¡è·åæåï¼è¯·æå°', |
| | | mask: true, |
| | | }); |
| | | } |
| | | |
| | | setTimeout(() => { |
| | | uni.hideLoading(); |
| | | }, 1000) |
| | | // _this.fanhui() |
| | | this.print = "æå°" |
| | | this.BottomShow = false |
| | | |
| | | console.log('notifyBLECharacteristicValueChange success', res.errMsg) |
| | | }, |
| | | fail: (res) => { |
| | | uni.showLoading({ |
| | | title: 'èçæå¡è·åæåï¼è¯·æå°', |
| | | mask: true, |
| | | }); |
| | | setTimeout(() => { |
| | | uni.hideLoading(); |
| | | }, 1000) |
| | | _this.print = "æå°" |
| | | _this.BottomShow = false |
| | | |
| | | // _this.fanhui() |
| | | console.log('notifyBLECharacteristicValueChange fail', res.errMsg) |
| | | } |
| | | }) |
| | | }, |
| | | //è·åèççæææå¡ |
| | | getBLEDeviceServices(deviceId) { |
| | | uni.showLoading({ |
| | | title: 'æ£å¨è·åèçæå¡...', |
| | | mask: true, |
| | | }); |
| | | setTimeout(() => { |
| | | uni.getBLEDeviceServices({ |
| | | // è¿éç deviceId éè¦å·²ç»éè¿ createBLEConnection ä¸å¯¹åºè®¾å¤å»ºç«é¾æ¥ |
| | | deviceId: deviceId, |
| | | success: (res) => { |
| | | uni.showLoading({ |
| | | title: 'è·åä¸ï¼è¯·ç¨å...', |
| | | mask: true, |
| | | }); |
| | | let _noSer = true; |
| | | console.log('servicesé¿åº¦ï¼'+res.services.length) |
| | | for (let i=0;i<res.services.length;i++) { |
| | | console.log(`services${i}çuuidï¼${res.services[i].uuid}`) |
| | | if (res.services[i].uuid.indexOf("FF00") != -1) { |
| | | _noSer = false; |
| | | this.serviceId = res.services[i].uuid; |
| | | //è·åç¹å¾ |
| | | this.getBLEDeviceCharacteristics(deviceId, res.services[i].uuid,(fxx)=>{ |
| | | if (fxx) { |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: 'èçè¿æ¥æåï¼', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }) |
| | | } else { |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: 'åç¹å¾ç 失败', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | } |
| | | }) |
| | | break; |
| | | } |
| | | } |
| | | if (_noSer) { |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: 'åèçæå¡å¤±è´¥', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | } |
| | | }, |
| | | fail:()=>{ |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: 'è·åèçæå¡å¤±è´¥', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | } |
| | | }) |
| | | }, 1000) |
| | | }, |
| | | //åå
¥èç |
| | | writeBLECharacteristicValue() { |
| | | // this.printflag = false |
| | | uni.showLoading({ |
| | | title: 'æå°ä¸...', |
| | | mask:true |
| | | }); |
| | | |
| | | |
| | | let deviceId = uni.getStorageSync('deviceId') |
| | | let serviceId = uni.getStorageSync('serviceId') |
| | | let characteristicId = uni.getStorageSync('characteristicId') |
| | | const printerJobs = new PrinterJobs(); |
| | | printerJobs |
| | | .label_set_page(576, 400) |
| | | //è¾¹æ¡ |
| | | .drawLine(1, 0, 0, 570, 0) |
| | | .drawLine(1, 0, 0, 0, 360) |
| | | .drawLine(1, 570, 0, 570, 360) |
| | | .drawLine(1, 0, 360, 570, 360) |
| | | // å
鍿¨ªçº¿ |
| | | .drawLine(1, 0, 52, 400, 52) //第ä¸è¡ |
| | | .drawLine(1, 0, 104, 400, 104) //第äºè¡ |
| | | .drawLine(1, 0, 156, 570, 156) //第ä¸è¡ |
| | | .drawLine(1, 0, 208, 570, 208) //第åè¡ |
| | | .drawLine(1, 0, 260, 570, 260) //第äºè¡ |
| | | .drawLine(1, 0, 312, 570, 312) //第å
è¡ |
| | | .drawLine(1, 120, 0, 120, 360) // ç¬¬ä¸æ ¹ç«çº¿ |
| | | // .drawLine(1, 220, 208, 220, 312) // ç¬¬äºæ ¹ç«çº¿ |
| | | // .drawLine(1, 300, 208, 300, 312) // ç¬¬ä¸æ ¹ç«çº¿ |
| | | .drawLine(1, 400, 0, 400, 156) // ç¬¬åæ ¹ç«çº¿ |
| | | // 1 åå§ æ¯å¦ç²ä½\åä½å¤§å°\æ¯å¦æè½¬è§åº¦\èµ·å§æ¨ªåæ \èµ·å§çºµåæ \å符串 |
| | | .drawText(10, 20, "å¶ä»¶ç¶æ", 24, 0, 0, false, false) |
| | | .drawText(130, 20, this.stateText, 24, 0, 0, false, false) |
| | | // 2 |
| | | .drawText(10, 72, "ç»çåå·", 24, 0, 0, false, false) |
| | | .drawText(130, 72, this.cvi, 24, 0, 0, false, false) |
| | | // 3 |
| | | .drawText(10, 124, "ç产ç线", 24, 0, 0, false, false) |
| | | .drawText(130, 124, this.singlist.createLine, 24, 0, 0, false, false) |
| | | // 4 |
| | | .drawText(10, 176, "é¶ä»¶1", 24, 0, 0, false, false) |
| | | .drawText(130, 176, this.singlist.itemDes, 24, 0, 0, false, false) |
| | | // 5 |
| | | .drawText(10, 225, "é¶ä»¶2", 24, 0, 0, false, false) |
| | | .drawText(130, 225, this.singlist.itemName, 24, 0, 0, false, false) |
| | | // 6 |
| | | .drawText(10, 280, "é¶ä»¶3", 24, 0, 0, false, false) |
| | | .drawText(130, 280, this.singlist.itemNum, 24, 0, 0, false, false) |
| | | // 7 |
| | | .drawText(10, 332, "çäº§æ¥æ", 24, 0, 0, false, false) |
| | | .drawText(130, 332, this.singlist.updateTime, 24, 0, 0, |
| | | false, false) |
| | | // .drawText(440, 332, item.user, 24, 0, 0, false, false) |
| | | // äºç»´ç |
| | | //.drawQrCode(426, 14, this.containerCode, 0, 5, 1) |
| | | .drawQrCode(426, 14, this.materialCode, 0, 5, 1) |
| | | // .drawText(434, 310, this.containerCode, 1, 0, 0, false, false) |
| | | .label_print(0, 1); |
| | | let buffer = printerJobs.buffer(); |
| | | |
| | | const maxChunk = 20; |
| | | const delay = 15; |
| | | let _writing = false; |
| | | let length = buffer.byteLength; |
| | | let pakageLen = Math.trunc(length/maxChunk); |
| | | if (length%maxChunk!==0) pakageLen=pakageLen+1; |
| | | console.log(`å
±${length}åèï¼å${pakageLen}å
`) |
| | | |
| | | let successArr = []; |
| | | for (let i = 0, j = 0; i < length; i += maxChunk, j++) { |
| | | let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length); |
| | | //_count = j; |
| | | setTimeout(() => { |
| | | console.log(`第${j+1}åå
åéï¼å¼å§åè${i}`) |
| | | this._writeBLECharacteristicValue(deviceId, serviceId, characteristicId, subPackage,(f)=>{ |
| | | console.log(`${j+1}è¿å${f}`) |
| | | if (f) { |
| | | successArr.push(j+1) |
| | | } |
| | | if (j===pakageLen-1) { |
| | | uni.hideLoading(); |
| | | uni.showModal({ |
| | | title:'æå°æç¤º', |
| | | content:`èçä¼ è¾å${pakageLen}å
ï¼æåä¼ è¾${successArr.length}个å
ï¼ä¾æ¬¡ä¸ºï¼${successArr.join(",")}ã`, |
| | | showCancel:false |
| | | }) |
| | | } |
| | | }) |
| | | }, j * delay); |
| | | } |
| | | }, |
| | | //åå
¥èç |
| | | _writeBLECharacteristicValue(deviceId, serviceId, characteristicId, buffer,callback) { |
| | | //console.log('start writeBLECharacteristicValue') |
| | | uni.writeBLECharacteristicValue({ |
| | | deviceId: deviceId, |
| | | serviceId: serviceId, |
| | | characteristicId: characteristicId, |
| | | value: buffer, |
| | | success(res) { |
| | | |
| | | //console.log('writeBLECharacteristicValue success', res.errMsg) |
| | | callback && callback(true) |
| | | }, |
| | | fail(res) { |
| | | //console.log('writeBLECharacteristicValue fail') |
| | | //console.log(JSON.stringify(res)) |
| | | //console.log(JSON.stringify(buffer)) |
| | | callback && callback(false) |
| | | } |
| | | }) |
| | | }, |
| | | //é¿æäºä»¶ |
| | | longpress(item, index) { |
| | | let _this = this |
| | | if (uni.getStorageSync('deviceId')) { |
| | | uni.showToast({ |
| | | title: 'èçå·²è¿æ¥ï¼', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _this.stopBluetoothDevicesDiscovery() |
| | | uni.setStorageSync('itemblue', item.name) |
| | | this.itemblue = item.name |
| | | _this.createBLEConnection(item.deviceId) |
| | | }, |
| | | // ç¹å»æå¼èçè¿æ¥ |
| | | tomy() { |
| | | var _this = this |
| | | |
| | | uni.closeBluetoothAdapter({ |
| | | success(res) { |
| | | uni.removeStorageSync('deviceId') |
| | | uni.removeStorageSync("serviceId"); |
| | | uni.removeStorageSync("characteristicId"); |
| | | _this.openBluetoothAdapter() |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | //è¿å |
| | | // fanhui() { |
| | | // uni.navigateTo({ |
| | | // url: './printing' |
| | | // }) |
| | | // }, |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "qqjf-pda", |
| | | "version": "1.0.0", |
| | | "lockfileVersion": 1, |
| | | "requires": true, |
| | | "dependencies": { |
| | | "moment": { |
| | | "version": "2.29.4", |
| | | "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", |
| | | "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" |
| | | }, |
| | | "uview-ui": { |
| | | "version": "1.8.7", |
| | | "resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.7.tgz", |
| | | "integrity": "sha512-5oOGf6NHiSTCj6/dklKjm8LCSJ7kov3azWEcloEYTTf2Mv+cbov/aARc/8QR0ce6y1hqEtwK/YkBkP+OVKuaWw==" |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "name": "qqjf-pda", |
| | | "version": "1.0.0", |
| | | "description": "<p align=\"center\"> <img alt=\"logo\" src=\"https://uviewui.com/common/logo.png\" width=\"120\" height=\"120\" style=\"margin-bottom: 10px;\"> </p> <h3 align=\"center\" style=\"margin: 30px 0 30px;font-weight: bold;font-size:40px;\">uView</h3> <h3 align=\"center\">å¤å¹³å°å¿«éå¼åçUIæ¡æ¶</h3>", |
| | | "main": "index.js", |
| | | "scripts": { |
| | | "test": "echo \"Error: no test specified\" && exit 1" |
| | | }, |
| | | "repository": { |
| | | "type": "git", |
| | | "url": "https://gitee.com/shanghai-shuying-information/wb_cnooc.git" |
| | | }, |
| | | "author": "", |
| | | "license": "ISC", |
| | | "dependencies": { |
| | | "moment": "^2.29.4", |
| | | "uview-ui": "^1.8.7" |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "easycom": { |
| | | //uview-ui |
| | | "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" |
| | | }, |
| | | "pages": [ //pagesæ°ç»ä¸ç¬¬ä¸é¡¹è¡¨ç¤ºåºç¨å¯å¨é¡µ |
| | | { |
| | | "path": "src/pages/Login/index", |
| | | "style": { |
| | | "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | "navigationBarTitleText": "", |
| | | "navigationBarBackgroundColor": "#fff" |
| | | } |
| | | }, |
| | | // { |
| | | // "path": "src/pages/Login/Home", |
| | | // "style": { |
| | | // "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | // "navigationBarTitleText": "", |
| | | // "navigationBarBackgroundColor": "#fff" |
| | | // } |
| | | // }, |
| | | { |
| | | "path": "src/pages/Home/index", |
| | | "style": { |
| | | // "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | "navigationBarTitleText": "é¦é¡µ", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "src/pages/Home/searchBlue", |
| | | "style": { |
| | | // "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | "navigationBarTitleText": "èç", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, |
| | | { |
| | | "path": "src/pages/PutIn/jimo/jimo", |
| | | "style": { |
| | | // "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | "navigationBarTitleText": "å
¥åºæ¥è¯¢", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | }, |
| | | { |
| | | "path": "src/pages/my/index", |
| | | "style": { |
| | | // "navigationStyle": "custom", // éèç³»ç»å¯¼èªæ |
| | | "navigationBarTitleText": "æç", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | }, { |
| | | "path": "src/pages/PutIn/jimo/print", |
| | | "style": { |
| | | "navigationBarTitleText": "ç»ç", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/appliance/appliance", |
| | | "style": { |
| | | "navigationBarTitleText": "", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/task/task", |
| | | "style": { |
| | | "navigationBarTitleText": "æçä»»å¡-æ¬è¿", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/task/details", |
| | | "style": { |
| | | "navigationBarTitleText": "æçä»»å¡-æ¬è¿", |
| | | "enablePullDownRefresh": false, |
| | | "app-plus": { |
| | | "scrollIndicator": "none" //å½å页é¢ä¸æ¾ç¤ºæ»å¨æ¡ |
| | | } |
| | | |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/manual/manual", |
| | | "style": { |
| | | "navigationBarTitleText": "é计ååºåº", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/manual/add_manual", |
| | | "style": { |
| | | "navigationBarTitleText": "é计ååºåº-æ°å»º", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/manual/details", |
| | | "style": { |
| | | "navigationBarTitleText": "é计ååºåº-详æ
", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/plan/plan", |
| | | "style": { |
| | | "navigationBarTitleText": "计ååºåº", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/plan/details", |
| | | "style": { |
| | | "navigationBarTitleText": "详æ
", |
| | | "enablePullDownRefresh": false |
| | | } |
| | | |
| | | }, { |
| | | "path": "src/pages/PutOut/plan/delivery", |
| | | "style": { |
| | | "navigationBarTitleText": "åºåº", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | |
| | | } |
| | | ,{ |
| | | "path" : "src/pages/PutOut/operation/operation", |
| | | "style" : |
| | | { |
| | | "navigationBarTitleText": "人工åºåº", |
| | | "enablePullDownRefresh": true |
| | | } |
| | | |
| | | } |
| | | ], |
| | | "tabBar": { |
| | | "color": "#595656", |
| | | "selectedColor": "#02af74", |
| | | "borderStyle": "#eaeaea", |
| | | "backgroundColor": "#fff", |
| | | "list": [{ |
| | | "pagePath": "src/pages/Home/index", |
| | | // "iconPath": "xx.png", |
| | | // "selectedIconPath": "yy.png", |
| | | "text": "é¦é¡µ" |
| | | }, |
| | | { |
| | | "pagePath": "src/pages/my/index", |
| | | // "iconPath": "aa.png", |
| | | // "selectedIconPath": "bb.png", |
| | | "text": "æç" |
| | | } |
| | | ] |
| | | |
| | | }, |
| | | "globalStyle": { |
| | | "navigationBarTextStyle": "black", |
| | | "navigationBarTitleText": "uni-app", |
| | | "navigationBarBackgroundColor": "#fff", |
| | | "backgroundColor": "#fff" |
| | | }, |
| | | // "globalStyle": { |
| | | // "navigationBarTextStyle": "black", |
| | | // "navigationBarTitleText": "", |
| | | // "navigationBarBackgroundColor": "#F8F8F8", |
| | | // "enablePullDownRefresh": true, |
| | | // "backgroundColor": "#F8F8F8", |
| | | // "app-plus": { |
| | | // "titleNView": false |
| | | // } |
| | | // }, |
| | | "condition" : { //模å¼é
ç½®ï¼ä»
å¼åæé´çæ |
| | | "current": 0, //å½åæ¿æ´»ç模å¼(list çç´¢å¼é¡¹) |
| | | "list": [ |
| | | { |
| | | "name": "", //模å¼åç§° |
| | | "path": "", //å¯å¨é¡µé¢ï¼å¿
é |
| | | "query": "" //å¯å¨åæ°ï¼å¨é¡µé¢çonLoad彿°éé¢å¾å° |
| | | } |
| | | ] |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function Permission(data){ //æé |
| | | return request({ |
| | | url: `/Permission/GetPdaUserRolePermission`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function login(data){ //ç»å½ |
| | | return request({ |
| | | url: `/user/login`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function PlaceVsContainer(data){ //åºåæ¥è¯¢ |
| | | return request({ |
| | | url: `/PlaceVsContainer/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function Task(data){ //人工åºåº |
| | | return request({ |
| | | url: `/Task/AddOrUpdate`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function tray(data) { //æçæç´¢ |
| | | return request({ |
| | | url: `/Container/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function add(data) { //æ°å¢å
¥åº |
| | | return request({ |
| | | url: `/ContainerVsItem/AddOrUpdate`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function addAll(data) { //æ°å¢å¤éå
¥åº |
| | | return request({ |
| | | url: `/ContainerVsItem/AddOrUpdateAll`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function set(data) { //ç»çæç´¢ |
| | | return request({ |
| | | url: `/ContainerVsItem/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function printSet(data) { //ç»çæç´¢ |
| | | return request({ |
| | | url: `/ContainerVsItem/SearchPrint?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function part(data) { //é¶ä»¶æç´¢ |
| | | return request({ |
| | | url: `/Item/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function getCode(data) { //ç»çç¼å· |
| | | return request({ |
| | | url: `/ContainerVsItem/GetCode`, |
| | | method: 'post', |
| | | // contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function appliance(data) { //å¨å
·æç´¢ |
| | | return request({ |
| | | url: `/Container/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | // contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function ItemStorage(data) { |
| | | return request({ |
| | | url: `/ItemStorage/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function itemSearch(data) { |
| | | return request({ |
| | | url: `/item/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function delPart(data) { //å é¤é¶ä»¶ |
| | | return request({ |
| | | url: `/Item/Delete`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function delPartAll(data) { //æ¹éå é¤é¶ä»¶ |
| | | return request({ |
| | | url: `/ContainerVsItem/DeleteAll`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function InOrder(data) { //ç产计ååå· |
| | | return request({ |
| | | url: `/InOrder/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function print(data) { //æå° |
| | | return request({ |
| | | url: `/ContainerVsItem/PrintContainerVsItem`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function InType(data) { //å
¥åºç±»å |
| | | return request({ |
| | | url: `/InType/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function AddOrUpdate(data) { //æ°å¢é¶ä»¶ |
| | | return request({ |
| | | url: `/Item/AddOrUpdate`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function out(data) { //åºåºå表 |
| | | return request({ |
| | | url: `/OutOrder/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function code(data) { //è·ååºåºä»»å¡åå· |
| | | return request({ |
| | | url: `/OutOrder/GetCode`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function add(data) { //æ°å¢ |
| | | return request({ |
| | | url: `/OutOrder/AddOrUpdate`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function UserSearch(data) { //æå®å车工 |
| | | return request({ |
| | | url: `/User/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function ProductionLine(data) { //ç线 |
| | | return request({ |
| | | url: `/ProductionLine/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function SearchItemCanUseNum(data) { //è·åæå®é¶ä»¶å¯ç¨åºå |
| | | return request({ |
| | | url: `/PlaceVsContainer/SearchItemCanUseNum`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function SearchItemAllNum(data) { //è·åæå®é¶ä»¶åºå |
| | | return request({ |
| | | url: `/PlaceVsContainer/SearchItemAllNum`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function CheckOutOrder(data) { //确认ä¸å |
| | | return request({ |
| | | url: `/OutOrder/CheckOutOrder `, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function EmptyContainerPlace(data) { //空å¨å
·æ°é |
| | | return request({ |
| | | url: `/PlaceVsContainer/SearchEmptyContainerPlace`, |
| | | method: 'post', |
| | | contentType: 'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function task(data){ //åè½¦ä»»å¡ |
| | | return request({ |
| | | url: `/CarTask/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function get(data){ //é¢åä»»å¡ |
| | | return request({ |
| | | url: `/CarTask/CarGetTask`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | export function CarTask(data){ //å车æç´¢ |
| | | return request({ |
| | | url: `/Car/Search?page=${data.page}&onePageNum=${data.onePageNum}`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | export function SearchNum(data){ //åè½¦ä»»å¡æ° |
| | | return request({ |
| | | url: `/CarTask/SearchNum`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import {request} from '../untils/request' |
| | | |
| | | |
| | | export function SearchOne(data){ //æ´æ° |
| | | return request({ |
| | | url: `/PDA/SearchOne`, |
| | | method: 'post', |
| | | contentType:'application/x-www-form-urlencoded', |
| | | data: data |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <u-popup v-model="show" :round="true" mode="bottom" borderRadius="12" @close="$emit('update:flag', show)"> |
| | | <scroll-view scroll-y="true" style="height:350px" @scrolltolower="lower"> |
| | | <slot name="con"> </slot> |
| | | </scroll-view> |
| | | </u-popup> |
| | | </template> |
| | | <script> |
| | | export default { |
| | | |
| | | props: { |
| | | flag: { |
| | | default: false, |
| | | type: Boolean |
| | | }, |
| | | part: { |
| | | default: false, |
| | | type: Boolean |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | show: false, |
| | | page: 2 |
| | | } |
| | | }, |
| | | methods: { |
| | | lower() { |
| | | this.$emit('lower', this.page++) |
| | | } |
| | | }, |
| | | watch: { |
| | | flag() { |
| | | this.show = this.flag |
| | | |
| | | }, |
| | | show(newVal, oldVal) { |
| | | if (newVal == false) { |
| | | this.page = 2 |
| | | } |
| | | }, |
| | | part(){ |
| | | if (newVal == false) { |
| | | this.page = 2 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- <u-navbar back-text=""xi title="é¦é¡µ" :custom-back="back"></u-navbar> --> |
| | | <view margin="0rpx"> |
| | | <view class="" v-for="(item,index) in title" :key="index"> |
| | | <view class="title"> |
| | | {{item}} |
| | | </view> |
| | | <view class="con"> |
| | | <view v-for="(i,value) in perList" :key="value"> |
| | | <view v-if="item == i.name" class="name" @click="go(i.color)"> |
| | | <view class="iconBg" :class="i.color"> |
| | | <u-badge v-if="i.count" :count="count" :offset="[-15, -15]"></u-badge> |
| | | <text class="txt txt1">{{i.title.substr(0,1)}}</text> |
| | | </view> |
| | | <view class="grid-text">{{i.title}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <u-card margin="0rpx" title=""> |
| | | <view class="loginBtnP" style="padding: 2rem 0 1rem 0;" slot="body"> |
| | | <view class="loginBtn" @click="blue"> |
| | | æå°æºè®¾ç½® |
| | | </view> |
| | | <view class="loginBtn" @click="onPrint"> |
| | | æµè¯æå° |
| | | </view> |
| | | </view> |
| | | </u-card> |
| | | |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | SearchNum |
| | | } from '../../api/task.js' |
| | | import { |
| | | Permission |
| | | } from '../../api/home.js' |
| | | import mixBule from '@/mixins/Blue.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | stateText: 'åæ ¼', |
| | | cvi: 'CI202206061612040685', |
| | | containerCode: 'P71-1769-001', |
| | | type: 'EUç®±å
¥ç«ä½åº', |
| | | palletType: 'Håºï¼2200x1400x1000', |
| | | count: '4', |
| | | perList: [], |
| | | title: [], |
| | | titleList: [{ |
| | | color: 'green1', |
| | | pages: '../PutIn/jimo/jimo' |
| | | }, |
| | | { |
| | | color: 'brown1', |
| | | pages: '../PutOut/plan/plan' |
| | | }, |
| | | { |
| | | color: 'blue1', |
| | | pages: '../PutOut/manual/manual' |
| | | }, |
| | | { |
| | | color: 'red1', |
| | | pages: '../PutOut/task/task' |
| | | }, |
| | | { |
| | | color: 'violet1', |
| | | pages: '../PutOut/operation/operation' |
| | | } |
| | | ], |
| | | singlist: [ |
| | | { |
| | | createLine: "ææ²§A线ä¹ç", |
| | | itemDes: "åé£çªä¸å¤æ¿,5301211-H55,200", |
| | | itemName: "æ ,æ ,æ ", |
| | | itemNum: "æ ,æ ,æ ", |
| | | updateTime: "2022-06-06 16:13:57" |
| | | }, |
| | | ], |
| | | }; |
| | | }, |
| | | mixins: [mixBule], |
| | | onShow() { |
| | | this.SearchNum() |
| | | this.Permission() |
| | | }, |
| | | mounted() {}, |
| | | onBackPress(e) { |
| | | // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | uni.switchTab({ |
| | | url: '../Login/index' |
| | | }); |
| | | // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | return true |
| | | }, |
| | | watch: { |
| | | count(newVal, oldVal) { |
| | | if (newVal > oldVal) { |
| | | this.Permission() |
| | | } |
| | | } |
| | | |
| | | }, |
| | | methods: { |
| | | //è¯é³ææ¥ |
| | | playSound() { |
| | | this.wakeLock() |
| | | let _this = this |
| | | // _this.playing = true |
| | | const innerAudioContext = uni.createInnerAudioContext(); |
| | | innerAudioContext.autoplay = true; |
| | | innerAudioContext.src = '../../../static/musice/13716.wav'; |
| | | innerAudioContext.onError((res) => { |
| | | //妿é³é¢æ²¡ææ£å¸¸ææ¾ |
| | | console.log(res.errCode); |
| | | }) |
| | | innerAudioContext.onStop((res) => { |
| | | _this.playing = false |
| | | |
| | | _this.$forceUpdate() |
| | | }) |
| | | }, |
| | | //æé |
| | | Permission() { |
| | | let soundflag = false |
| | | let params = { |
| | | roleName: uni.getStorageSync('roleName') |
| | | } |
| | | Permission(params).then((res) => { |
| | | this.title = [] |
| | | this.perList = res |
| | | this.perList.forEach((item) => { |
| | | //1.å®ä¹ä¸ä¸ªæ°ç»åæ¾æ é¢ï¼è¯¥æ°ç»ä¼æé夿以éè¦å»é |
| | | this.title.push(item.name); |
| | | if (item.title == 'æ¬è¿ä»»å¡') { |
| | | this.$set(item, 'count', this.count) |
| | | if (item.count && item.count !== '0') { |
| | | soundflag = true |
| | | } |
| | | } |
| | | }); |
| | | //2.å»é |
| | | this.title = this.title.filter((currentValue, index) => { |
| | | return this.title.indexOf(currentValue) == index; |
| | | }); |
| | | }) |
| | | if (soundflag) { |
| | | this.playSound() |
| | | } |
| | | }, |
| | | //è·³è½¬é¡µé¢ |
| | | go(i) { |
| | | this.titleList.forEach(item => { |
| | | if (i == item.color) { |
| | | uni.navigateTo({ |
| | | url: item.pages |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | // è§æ æ°é |
| | | SearchNum() { |
| | | let params = { |
| | | userName: uni.getStorageSync("admin"), |
| | | taskStatusNot: '宿' |
| | | } |
| | | SearchNum(params).then((res) => { |
| | | this.count = res |
| | | }) |
| | | }, |
| | | //è¡¥ææ ç¾é¡µé¢ |
| | | blue() { |
| | | uni.navigateTo({ |
| | | url: './searchBlue' |
| | | }); |
| | | }, |
| | | //æµè¯æå° |
| | | onPrint() { |
| | | if (!uni.getStorageSync("deviceId")) { |
| | | uni.showToast({ |
| | | title: 'è¯·è¿æ¥æå°æº', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | return |
| | | } |
| | | this.writeBLECharacteristicValue() |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="scss"> |
| | | page { |
| | | // background-color: #c3c3c3; |
| | | } |
| | | |
| | | .title { |
| | | border: 1px solid #eaeaea; |
| | | padding: 10px; |
| | | font-size: 1rem; |
| | | } |
| | | |
| | | .con { |
| | | display: flex; |
| | | flex-wrap: wrap; |
| | | |
| | | .name { |
| | | margin: 0 auto; |
| | | width: 7.5rem; |
| | | text-align: center; |
| | | height: 5.2rem; |
| | | border-right: 1px solid #eaeaea; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding: 10px 0 0; |
| | | } |
| | | } |
| | | |
| | | //ä»»å¡ç®¡çæé® |
| | | .loginBtnP { |
| | | width: 100%; |
| | | padding: 15px 0 55px 0 !important; |
| | | } |
| | | |
| | | .loginBtn { |
| | | width: 90%; |
| | | padding: 0.73rem; |
| | | background-color: #26a53f; |
| | | border-radius: 0.5rem; |
| | | color: white; |
| | | margin: 0 auto 15px; |
| | | text-align: center; |
| | | font-size: 1.1rem; |
| | | } |
| | | |
| | | .iconBg { |
| | | margin-bottom: 5px; |
| | | font-size: 1.2rem; |
| | | color: white; |
| | | display: inline-block; |
| | | border-radius: 25px; |
| | | line-height: 20px; |
| | | width: 40px; |
| | | height: 40px; |
| | | padding: 5px; |
| | | position: relative; |
| | | cursor: pointer; |
| | | font-weight: 500; |
| | | text-decoration: none; |
| | | white-space: nowrap; |
| | | background-image: -webkit-gradient(linear, left top, left bottom, color-stop(5%, #f5a3a0), color-stop(5%, #ff0066), color-stop(100%, #ff6600)); |
| | | transition: background-color 0.2s ease-out; |
| | | border-radius: 8px; |
| | | |
| | | .txt { |
| | | position: absolute; |
| | | top: 10px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 100; |
| | | display: block; |
| | | |
| | | &.color { |
| | | text-transform: uppercase; |
| | | background-image: linear-gradient(to right, orangered, orange, gold, lightgreen, cyan, dodgerblue, mediumpurple, hotpink, orangered); |
| | | -webkit-background-clip: text; |
| | | -webkit-text-fill-color: transparent; |
| | | color: white; |
| | | background-size: 30px; |
| | | } |
| | | |
| | | &.txt1 { |
| | | background-size: 40px; |
| | | animation: sliding1 30s linear infinite; |
| | | } |
| | | |
| | | &.txt2 { |
| | | background-size: 40px; |
| | | animation: sliding 20s linear infinite; |
| | | } |
| | | } |
| | | |
| | | &.green1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #68ea68), |
| | | color-stop(5%, #127e12), |
| | | color-stop(100%, #1aad19)); |
| | | border: 1px solid #0f680f; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 20px; |
| | | height: 20px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #127812; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.red1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #f5a3a0), |
| | | color-stop(5%, #ff0066), |
| | | color-stop(100%, #ff6600)); |
| | | border: 1px solid #da0d0d; |
| | | color: white !important; |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 20px; |
| | | height: 20px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #da0d0d; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.blue1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #d7d7ff), |
| | | color-stop(5%, #0000b9), |
| | | color-stop(100%, #3333ff)); |
| | | border: 1px solid #3333ff; |
| | | color: white !important; |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 20px; |
| | | height: 20px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #3333ff; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.brown1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #ff5757), |
| | | color-stop(5%, #f90000), |
| | | color-stop(100%, #990000)); |
| | | border: 1px solid #990000; |
| | | color: white !important; |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 20px; |
| | | height: 20px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #990000; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.violet1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #cc99cc), |
| | | color-stop(5%, #663366), |
| | | color-stop(100%, #5e00bb)); |
| | | border: 1px solid #330066; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 20px; |
| | | height: 20px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #7d00fb; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.black1 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #bfbfbf), |
| | | color-stop(5%, #484848), |
| | | color-stop(100%, #999999)); |
| | | border: 1px solid #999999; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #484848; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.blue2 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #00c4c4), |
| | | color-stop(5%, #009797), |
| | | color-stop(100%, #00dddd)); |
| | | border: 1px solid #009797; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #00cccc; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.brown2 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #00c4c4), |
| | | color-stop(5%, #009797), |
| | | color-stop(100%, #9933ff)); |
| | | border: 1px solid #009797; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #00cccc; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.violet2 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #cfc003), |
| | | color-stop(5%, #7e730e), |
| | | color-stop(100%, #b8aa03)); |
| | | border: 1px solid #83770e; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #b7a713; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.green2 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #1dcb1d), |
| | | color-stop(5%, #127e12), |
| | | color-stop(100%, #a5bb0b)); |
| | | border: 1px solid #17a217; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #18a518; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | |
| | | &.red2 { |
| | | background-image: -webkit-gradient(linear, |
| | | left top, |
| | | left bottom, |
| | | color-stop(5%, #f5a3a0), |
| | | color-stop(5%, #ff0066), |
| | | color-stop(100%, #ff6600)); |
| | | border: 1px solid #da0d0d; |
| | | color: white !important; |
| | | |
| | | &::after { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 5px; |
| | | width: 30px; |
| | | height: 30px; |
| | | z-index: 0; |
| | | border-radius: 4em; |
| | | background-color: #da0d0d; |
| | | content: " "; |
| | | display: block; |
| | | padding: 5px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .green { |
| | | background-image: linear-gradient(to bottom, #0d660d, #128210); |
| | | } |
| | | |
| | | .ji { |
| | | // background-image: linear-gradient(to right, #04967e,#206169, #c64407); |
| | | // -webkit-background-clip: text; |
| | | // -webkit-text-fill-color: transparent; |
| | | animation: sliding1 30s linear infinite; |
| | | } |
| | | |
| | | .grid-text { |
| | | font-size: 28rpx; |
| | | margin-top: 4rpx; |
| | | color: $u-type-info; |
| | | } |
| | | |
| | | /deep/.u-card__body { |
| | | padding: 0 !important; |
| | | } |
| | | |
| | | @keyframes sliding { |
| | | to { |
| | | background-position: -100px; |
| | | } |
| | | } |
| | | |
| | | @keyframes sliding1 { |
| | | to { |
| | | background-position: -150px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <button @click="openBluetoothAdapter">æç´¢èç</button> |
| | | <view style="margin-top: 30upx;" :key="index" v-for="(item,index) in list"> |
| | | <button style="width: 400upx; color: #0081FF;" @click="longpress(item,index)">{{item.name}}</button> |
| | | </view> |
| | | <button style="margin-top: 300upx;" @click="tomy">éåºèç</button> |
| | | <button style="margin-top: 100upx;" @click="fanhui">è¿å</button> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import mixBule from '@/mixins/Blue.js' |
| | | export default { |
| | | mixins: [mixBule], |
| | | data() { |
| | | return { |
| | | list:[] |
| | | } |
| | | }, |
| | | methods: { |
| | | fanhui(){ |
| | | uni.switchTab({ |
| | | url:'./index' |
| | | }) |
| | | }, |
| | | }, |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="loginP"> |
| | | <view class="logo"> |
| | | <image src="@/static/image/login/logo-qq.jpg" mode=""></image> |
| | | </view> |
| | | <view class="mainTitle"> |
| | | <h3>æºè½åç«ä½åºç³»ç»</h3> |
| | | <h2>ç³»ç»ç»å½</h2> |
| | | </view> |
| | | <view class="user-pwd"> |
| | | <view class="userP"> |
| | | <i class="iconfont icon-yonghutouxiang"></i> |
| | | <view class="inputC"> |
| | | <u-input v-model="phone" type="text" placeholder="ç¨æ·å/ææºå·" /> |
| | | </view> |
| | | </view> |
| | | <view class="pwdP"> |
| | | <i class="iconfont icon-mima"></i> |
| | | <view class="inputC"> |
| | | <u-input v-model="pwd" type="password" placeholder="å¯ç " /> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="loginBtnP" style="padding: 2rem 0 1rem 0;"> |
| | | <view class="loginBtn" @click="goHome"> |
| | | ç³»ç»ç»å½ |
| | | </view> |
| | | </view> |
| | | <view class="forgot-register"> |
| | | <view class="forgot"> |
| | | <!-- 设置æ¥å£å°å --> |
| | | </view> |
| | | <view class="register" @click="update"> |
| | | æ´æ°APP |
| | | </view> |
| | | </view> |
| | | <view class="" style="position: fixed;left:12px;bottom: 5px;width: 100%;text-align: center;"> |
| | | åºç¨çæ¬å· {{wgtVer}} |
| | | </view> |
| | | <u-toast ref="uToast" /> |
| | | </view> |
| | | </template> |
| | | <script lang='js'> |
| | | import { |
| | | login |
| | | } from '../../api/login.js' |
| | | import { |
| | | SearchOne |
| | | } from '../../api/upDate.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | phone: "", |
| | | pwd: "", |
| | | wgtVer: '', |
| | | version: '', |
| | | data: null, |
| | | isandroid: '' |
| | | } |
| | | }, |
| | | created() { |
| | | this.plusReady() |
| | | }, |
| | | methods: { |
| | | //èªå¨æ´æ° |
| | | update() { |
| | | this.plusReady(); |
| | | this.AndroidCheckUpdate(); |
| | | }, |
| | | // è·åå½åçæ¬å· |
| | | plusReady() { |
| | | var that = this; |
| | | // è·åæ¬å°åºç¨èµæºçæ¬å·  |
| | | try{ |
| | | plus.runtime.getProperty(plus.runtime.appid, function(inf) { |
| | | that.data = inf |
| | | that.wgtVer = inf.version; //è·åå½åçæ¬å· |
| | | that.version = plus.runtime.version; |
| | | }); |
| | | }catch(e){ |
| | | //TODO handle the exception |
| | | } |
| | | }, |
| | | // èªå¨æ´æ° |
| | | AndroidCheckUpdate() { |
| | | var that2 = this; |
| | | let params = { |
| | | Url: '', |
| | | Version: '' |
| | | } |
| | | SearchOne(params).then((res) => { |
| | | if (res.Version != that2.version) { |
| | | // if (plus.networkinfo.getCurrentType() != 3) { |
| | | // uni.showToast({ |
| | | // title: 'ææ°ççæ¬åå¸ï¼æ£æµå°æ¨ç®åéWifiè¿æ¥ï¼ä¸ºè约æ¨çæµéï¼ç¨åºå·²åæ¢èªå¨æ´æ°ï¼å°å¨æ¨è¿æ¥WIFIä¹åéæ°æ£æµæ´æ°ã', |
| | | // mask: false, |
| | | // duration: 5000, |
| | | // icon: "none" |
| | | // }); |
| | | // return; |
| | | // } |
| | | // uni.showToast({ |
| | | // title: 'ææ°ççæ¬åå¸ï¼æ£æµå°æ¨ç®å为Wifiè¿æ¥ï¼ç¨åºå·²å¯å¨èªå¨æ´æ°ãæ°çæ¬ä¸è½½å®æåå°èªå¨å¼¹åºå®è£
ç¨åºã', |
| | | // mask: false, |
| | | // duration: 5000, |
| | | // icon: "none" |
| | | // }); |
| | | //res.data.androidurl  æ¯apkçä¸è½½é¾æ¥ |
| | | var url = this.$myHOST + '/Home/GetDownLoad?name=' + res |
| | | .Url; //æä»¶åç§°å¯ä»¥å¨ä¸ä¼ æ¶è¿è¡ä¿åï¼ä¸è½½æ¶ååºï¼å½æä»¶åç§°ä¸åå¨ååå¼å·æ¶ï¼è¦å好å¤çï¼å¦å伿¥é |
| | | var name = 'qingqi.apk'; |
| | | // plus.runtime.openURL(this.$myHOST + '/Home/GetDownLoad?name=' + res.Url, function(res) {console.log(res);}); |
| | | var dtask = plus.downloader.createDownload(url, {}, function(d, status) { |
| | | //d为ä¸è½½çæä»¶å¯¹è±¡ |
| | | // if (res.statusCode == 200) { |
| | | //éæ©è½¯ä»¶æå¼æä»¶ |
| | | plus.runtime.install(d.filename, {}, {}, function(e) { |
| | | console.log(e) |
| | | }) |
| | | // } else { |
| | | // //ä¸è½½å¤±è´¥ |
| | | // plus.downloader.clear(); //æ¸
é¤ä¸è½½ä»»å¡ |
| | | // } |
| | | }) |
| | | // dtask.start(); //æ§è¡ä¸è½½ |
| | | try { |
| | | dtask.start(); // å¼å¯ä¸è½½çä»»å¡ |
| | | var prg = 0; |
| | | var showLoading = plus.nativeUI.showWaiting("æ£å¨ä¸è½½"); //å建ä¸ä¸ªshowWaiting对象 |
| | | |
| | | dtask.addEventListener('statechanged', function(task, status) { |
| | | |
| | | // ç»ä¸è½½ä»»å¡è®¾ç½®ä¸ä¸ªçå¬ å¹¶æ ¹æ®ç¶æ åæä½ |
| | | switch (task.state) { |
| | | case 1: |
| | | showLoading.setTitle("æ£å¨ä¸è½½"); |
| | | break; |
| | | case 2: |
| | | showLoading.setTitle("å·²è¿æ¥å°æå¡å¨"); |
| | | break; |
| | | case 3: |
| | | prg = parseInt((parseFloat(task.downloadedSize) / parseFloat(task |
| | | .totalSize)) * |
| | | 100); |
| | | showLoading.setTitle(" æ£å¨ä¸è½½" + JSON.stringify(task.downloadedSize)); |
| | | break; |
| | | case 4: |
| | | plus.nativeUI.closeWaiting(); |
| | | //ä¸è½½å®æ |
| | | break; |
| | | } |
| | | }); |
| | | } catch (err) { |
| | | console.log('é误信æ¯', err) |
| | | plus.nativeUI.closeWaiting(); |
| | | } |
| | | } else { |
| | | uni.showToast({ |
| | | title: 'å·²ç»æ¯ææ°ç', |
| | | mask: false, |
| | | duration: 1500, |
| | | icon: "none" |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | // ç¹å»ç»å½æé® |
| | | goHome() { |
| | | uni.clearStorageSync() |
| | | let params = { |
| | | userName: this.phone, |
| | | password: this.pwd |
| | | } |
| | | login(params).then((res) => { |
| | | if (res.code == 0) { |
| | | uni.setStorageSync('admin', this.phone); |
| | | uni.setStorageSync('pwd', this.pwd); |
| | | uni.setStorageSync('roleName', res.data[0].roleName); |
| | | uni.switchTab({ |
| | | //åå¨å¥½åè·³è½¬é¡µé¢ |
| | | url: "../Home/index", |
| | | }); |
| | | } else { |
| | | // this.$u.toast(res.data.msg) |
| | | this.$u.toast('请è¾å
¥æ£ç¡®çè´¦å·å¯ç ') |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .logo { |
| | | text-align: center; |
| | | |
| | | image { |
| | | width: 75px; |
| | | height: 70px; |
| | | margin: 0 auto -25px; |
| | | } |
| | | } |
| | | |
| | | .btn { |
| | | border: 1px solid #717171; |
| | | padding: 5px 7px; |
| | | border-radius: 5px; |
| | | color: #717171; |
| | | } |
| | | |
| | | .iconfont { |
| | | color: #ccc; |
| | | } |
| | | |
| | | .loginP { |
| | | padding: 2rem; |
| | | margin-top: 20px; |
| | | } |
| | | |
| | | .mainTitle { |
| | | color: #717171; |
| | | text-align: center; |
| | | font-size: 1.1rem; |
| | | padding: 2rem 2rem 0 2rem; |
| | | } |
| | | |
| | | .classesifyP { |
| | | text-align: center; |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .classesify { |
| | | width: 11rem; |
| | | height: 2.1875rem; |
| | | border: 1px solid #02af74; |
| | | display: flex; |
| | | align-items: center; |
| | | border-radius: 100px; |
| | | } |
| | | |
| | | .classesify-puc { |
| | | width: 50%; |
| | | font-size: 0.6rem; |
| | | border-bottom-left-radius: 100px; |
| | | border-top-left-radius: 100px; |
| | | height: 100%; |
| | | line-height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background-color: #02af74; |
| | | } |
| | | |
| | | .classesify-pucs { |
| | | width: 50%; |
| | | font-size: 0.6rem; |
| | | border-bottom-left-radius: 100px; |
| | | border-top-left-radius: 100px; |
| | | height: 100%; |
| | | line-height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background-color: white; |
| | | } |
| | | |
| | | .classesify-bus { |
| | | width: 50%; |
| | | } |
| | | |
| | | .classesify-buss { |
| | | width: 50%; |
| | | font-size: 0.6rem; |
| | | border-bottom-right-radius: 100px; |
| | | border-top-right-radius: 100px; |
| | | height: 100%; |
| | | line-height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | background-color: #02af74; |
| | | } |
| | | |
| | | .userP { |
| | | display: flex; |
| | | align-items: center; |
| | | margin: 4rem 0rem 1rem 0rem; |
| | | padding: 0.3125rem 0rem; |
| | | border-bottom: 1px solid #dfdfdf; |
| | | } |
| | | |
| | | .pwdP { |
| | | display: flex; |
| | | align-items: center; |
| | | margin: 2rem 0rem 1rem 0rem; |
| | | padding: 0.3125rem 0rem; |
| | | border-bottom: 1px solid #dfdfdf; |
| | | } |
| | | |
| | | .inputC { |
| | | width: 100%; |
| | | padding-left: 1rem; |
| | | } |
| | | |
| | | .rightIcon { |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | .loginBtnP { |
| | | width: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .loginBtn { |
| | | width: 14rem; |
| | | padding: 0.5rem; |
| | | background-color: #7abbff; |
| | | border-radius: 0.5rem; |
| | | color: white; |
| | | text-align: center; |
| | | font-size: 1.1rem; |
| | | } |
| | | |
| | | .forgot-register { |
| | | padding: 1rem 0rem; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | color: #747474; |
| | | margin-top: 15px; |
| | | } |
| | | |
| | | .user-pwd { |
| | | margin-bottom: 2rem; |
| | | margin-top: -20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <u-navbar title="æ·»å ç©æ"> |
| | | <view v-if="flag" @click="flag=!flag" class="slot-right" |
| | | style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33"> |
| | | æ¾ç¤ºå
¨é¨ |
| | | </view> |
| | | <view v-else @click="flag=!flag" class="slot-right" |
| | | style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33"> |
| | | åªæ¾ç¤ºè®¡å |
| | | </view> |
| | | </u-navbar> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢" v-model="keyword" input-align="center" bg-color="#fff" shape="square" |
| | | :show-action="false"></u-search> |
| | | </view> |
| | | <view class="line" v-for="item in 25"> |
| | | <text>5101050-A95</text> |
| | | <text>æ²¹é¨è¸æ¿åºå®æ¿æ»æ</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | flag: true, |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 6px 8px; |
| | | } |
| | | .line{ |
| | | height: 40px; |
| | | line-height: 40px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- <u-navbar back-text="" title="å
¥åºæ¥è¯¢"></u-navbar> --> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢ç»çç¼å·" v-model="keyword" @search="list" @clear="list" input-align="center" |
| | | bg-color="#fff" shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class="con"> |
| | | <u-card v-for="item in set" :key="item.id" class="card" @click="goAdd(item,10)"> |
| | | <view slot="head" class="title"> |
| | | <text class="col777">ç»çç¼å·:</text> |
| | | <text class="ml5">{{item.cviCode}}</text> |
| | | <view class="add ml5"> |
| | | æ°å¢ |
| | | </view> |
| | | </view> |
| | | <view slot="body" class="body" style="display: flex;justify-content: space-between;"> |
| | | <view class="" style="width: 50%;padding-left: 18px;"> |
| | | <view> |
| | | <text class="col777">ä»åºåç§°:</text> |
| | | <text class="ml5">{{item.storeName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">ååºæ°é:</text> |
| | | <text class="ml5">{{item.itemNum}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">è£
ç®±æ°é:</text> |
| | | <text class="ml5">{{item.maxNum}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">å
¥åºç±»å:</text> |
| | | <text class="ml5">{{item.inType}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" style="width: 50%;"> |
| | | <view> |
| | | <text class="col777">é¶ä»¶ç¼å·:</text> |
| | | <text class="ml5">{{item.itemName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">å¨å
·åç§°:</text> |
| | | <text class="ml5">{{item.containerName}}</text> |
| | | </view> |
| | | |
| | | </view> |
| | | |
| | | </u-row> |
| | | </view> |
| | | </u-card> |
| | | <u-loadmore :status="status" /> |
| | | </view> |
| | | <view class="fix"> |
| | | <button class="btn" @click="add">æ°å»ºç»ç</button> |
| | | </view> |
| | | <u-back-top :scroll-top="scrollTop"></u-back-top> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | set |
| | | } from '../../../api/putIn.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | status: 'loadmore', |
| | | scrollTop: 0, |
| | | page: 1, |
| | | onePageNum: 10, |
| | | keyword: '', // ç»çç¼å· |
| | | set: [], //ç»çå表 |
| | | code: '', |
| | | putType: '' //å
¥åºç±»å |
| | | } |
| | | }, |
| | | //䏿å è½½ |
| | | onReachBottom() { |
| | | let _self = this |
| | | this.status = 'loading' |
| | | setTimeout(function() { |
| | | _self.page++; |
| | | _self.list(); |
| | | }, 2000); |
| | | |
| | | }, |
| | | //䏿巿° |
| | | onPullDownRefresh() { |
| | | this.page = 1 |
| | | this.keyword = '' |
| | | this.list() |
| | | setTimeout(function() { |
| | | uni.stopPullDownRefresh() |
| | | }, 1000) |
| | | }, |
| | | //é»è®¤è¿å |
| | | onBackPress(options) { |
| | | // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | if (options.from == 'navigateBack') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | |
| | | // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | return true |
| | | }, |
| | | // è¿åé¡¶é¨ |
| | | onPageScroll(e) { |
| | | this.scrollTop = e.scrollTop; |
| | | }, |
| | | mounted() { |
| | | this.list() |
| | | }, |
| | | methods: { |
| | | // ä»»å¡å表 |
| | | list() { |
| | | let _self = this; |
| | | let params = { |
| | | cviCode: _self.keyword, |
| | | page: _self.page, |
| | | onePageNum: _self.onePageNum |
| | | } |
| | | set(params).then((res) => { |
| | | if (res.code == 0) { |
| | | const result = res.data |
| | | if (_self.page != 1) { |
| | | if (res.data.length == 0) { |
| | | _self.status = 'nomore' |
| | | return |
| | | } |
| | | _self.set = _self.set.concat(result) |
| | | } else { |
| | | _self.set = result |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | goAdd(val, event) { |
| | | uni.navigateTo({ |
| | | url: './print?event=10&list=' + JSON.stringify(val) |
| | | }) |
| | | }, |
| | | //æ°å»ºç»ç |
| | | add() { |
| | | uni.navigateTo({ |
| | | url: './print' |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 6px 8px; |
| | | } |
| | | |
| | | .col777 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml5 { |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .fix { |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 45px; |
| | | |
| | | .btn { |
| | | background-color: #1aac19; |
| | | color: #fff; |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | |
| | | .con { |
| | | margin-bottom: 45px; |
| | | } |
| | | |
| | | .card { |
| | | .title { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 0.89rem; |
| | | |
| | | .add { |
| | | background-color: #cbfe8f; |
| | | width: 2.8rem; |
| | | border-radius: 5px; |
| | | font-size: 1rem; |
| | | padding: 0.3rem 0.4rem; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .body { |
| | | font-size: 1rem; |
| | | color: #000; |
| | | line-height: 2rem; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <view class="line2 flex"> |
| | | <view class="col7"> |
| | | å¨å
·ç¼å·ï¼ |
| | | </view> |
| | | <u-input focus placeholder='æ«ç è·åå¨å
·ç¼å·' maxlength='999' v-model="containerCode" @confirm="split"></u-input> |
| | | </view> |
| | | <view class="line2 flex"> |
| | | <view class="col7"> |
| | | å¨å
·ç±»åï¼ |
| | | </view> |
| | | <u-input placeholder='æ«ç è·åå¨å
·ç¼å·' v-model="palletType"></u-input> |
| | | </view> |
| | | <view class="line2 flex"> |
| | | <view class="col7"> |
| | | ä»åºåç§°ï¼ï¼ |
| | | </view> |
| | | <text>ç«ä½åº</text> |
| | | </view> |
| | | <view class="line2 flex"> |
| | | <view class="col7"> |
| | | ç»çåå·ï¼ |
| | | </view> |
| | | <text>{{cvi}}</text> |
| | | </view> |
| | | <view class="line space-between" @click="dialogstate=true"> |
| | | <text class="col7">å¶ä»¶ç¶æ:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{stateText}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="stateList" mode="single-column" v-model="dialogstate" @confirm="stateLable"> |
| | | </u-select> |
| | | </view> |
| | | <view class="line pl2 col7 space-between" @click="show=true"> |
| | | <text class="col7">å
¥åºç±»å:</text> |
| | | <view class=""> |
| | | <text class="ml10">{{type}}</text> |
| | | <u-icon name="arrow-down"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="selector" mode="single-column" v-model="show" @confirm="confirm"></u-select> |
| | | </view> |
| | | <view class="line pl2 space-between"> |
| | | <text>è£
ç®±æç»å表:</text> |
| | | <button type="default" class="btn" @click="addMaterial">æ·»å ç©æ</button> |
| | | </view> |
| | | <!-- <view v-if="flag"> --> |
| | | <view class="line pl2 space-between" v-if="arr.length!==0"> |
| | | <text class="col7">é¶ä»¶</text> |
| | | <u-button type="error" class="btn" @click="delPart">å é¤</u-button> |
| | | </view> |
| | | <view class="line2 pl2" v-for="(item,index) in arr" :key="index"> |
| | | |
| | | <view class="" style="display: flex;"> |
| | | <view class="" style="width: 100%;"> |
| | | <view> |
| | | <text class="col7">é¶ä»¶åç§°:</text> |
| | | <text class="ml10">{{item.partDes}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col7">é¶ä»¶ç¼å·:</text> |
| | | <text class="ml10">{{item.partName}}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <u-col span="6"> |
| | | |
| | | <view> |
| | | <text class="col7">çäº§æ¥æ:</text> |
| | | <!-- <text |
| | | class="ml10">{{item.nowDate?$moment(item.nowDate).format('YYYY-MM-DD HH:mm:ss'):'---'}}</text> --> |
| | | <uni-datetime-picker type="datetime" :clear-icon="false" v-model="item.nowDate" @maskClick="maskClick" /> |
| | | </view> |
| | | <view style="display: flex;"> |
| | | <text class="col7">ä¸çº¿æ°é:</text> |
| | | <u-input placeholder="è¾å
¥ä¸çº¿æ°é" class="ml10" v-model="item.number" |
| | | @blur="item.number<item.maxnumber?item.number:item.number=item.maxnumber"> |
| | | </u-input> |
| | | </view> |
| | | </u-col> |
| | | </u-row> |
| | | </view> |
| | | <view class="space-between"> |
| | | <text> |
| | | ç产计åå: |
| | | </text> |
| | | <u-input type="select" :value="item.inOrderCode" @click="planclick(item,index) " placeholder="è¯·éæ©è®¡ååå·" |
| | | style="margin-left: 10px;" /> |
| | | <u-popup height="350px" mode="bottom" v-model="showPlan"> |
| | | <view class="" style="text-align: center;border-bottom:1px solid #eaeaea"> |
| | | <text>ç产计ååå·</text> |
| | | </view> |
| | | <view class=""> |
| | | <view class="line3" v-for="(item,index) in actionSheetList" :key="index" |
| | | @click="pickerPop(item, $event)"> |
| | | <text style="color:#000">{{item}}</text> |
| | | </view> |
| | | </view> |
| | | <u-empty text="ææ æ°æ®" mode="list" v-if='actionSheetList.length==0'></u-empty> |
| | | </u-popup> |
| | | </view> |
| | | <view> |
| | | æ¥çç
§ç |
| | | </view> |
| | | <u-upload style="margin-bottom:45px;" max-count="1" :action="action" :file-list="item.list"> |
| | | </u-upload> |
| | | </view> |
| | | <!-- </view> --> |
| | | <view class="fix" style="background-color: #fff;z-index: 99;padding-top: 2px;"> |
| | | <u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="onPrint">æå°</u-button> |
| | | <u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="save">æå</u-button> |
| | | <u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="last">ä¸ä¸æ¡</u-button> |
| | | <u-button type="success" style="width: 24%;margin: 0 5rpx;" @click="add">ä¿åå¹¶è¿å</u-button> |
| | | </view> |
| | | <Dialogdata :flag.sync="dialogShow" @lower="lower"> |
| | | <view slot="con"> |
| | | <view class="title"> |
| | | <text style="width: 35%;">éæ©ç©æ</text> |
| | | <view class=""> |
| | | <view v-if="plan" @click="allPart" class="slot-right" |
| | | style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33"> |
| | | æ¾ç¤ºå
¨é¨ |
| | | </view> |
| | | <view v-if='!plan' @click="addMaterial" class="slot-right" |
| | | style="width: 100%; display: flex; justify-content: flex-end;margin-right: 15px;color:#00cc33"> |
| | | åªæ¾ç¤ºè®¡å |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢é¶ä»¶ç¼å·" @clear="clearcode" @blur="searchPart" v-model="keyword" |
| | | input-align="center" bg-color="#fff" shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class=""> |
| | | <view class="line3" v-for="(item,index) in list" :key="index" @click="picker(item, $event)"> |
| | | <text style="color:#000">{{item.itemName}}</text> |
| | | <text class="col7 ml10">{{item.itemDes}}</text> |
| | | </view> |
| | | </view> |
| | | <u-empty text="ææ æ°æ®" mode="list" v-if='list.length==0'></u-empty> |
| | | <u-loadmore :status="status" v-if='list.length>=6' /> |
| | | </view> |
| | | </Dialogdata> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import { |
| | | tray, |
| | | part, |
| | | add, |
| | | getCode, |
| | | delPart, |
| | | addAll, |
| | | delPartAll, |
| | | InOrder, |
| | | print, |
| | | InType, |
| | | set, |
| | | AddOrUpdate, |
| | | printSet, |
| | | ItemStorage, |
| | | itemSearch |
| | | } from '../../../api/putIn.js' |
| | | import mixBule from '@/mixins/Blue.js' |
| | | import Dialogdata from '@/components/dialog.vue' |
| | | export default { |
| | | components: { |
| | | Dialogdata |
| | | }, |
| | | mixins: [mixBule], |
| | | data() { |
| | | return { |
| | | containerCode: '', //å¨å
·ç¼å· |
| | | materialCode:'', |
| | | palletType: '', //å¨å
፱Ȍ |
| | | dialogstate: false, //å¶ä»¶ç¶æå¼¹çª |
| | | show: false, //å
¥åºç±»åå¼¹çª |
| | | dialogShow: false, //æ·»å ç©æå¼¹çª |
| | | status: 'loading', |
| | | stateList: [{ |
| | | value: '1', |
| | | label: 'åæ ¼' |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: 'çè£
å¾
è¿ä¿®' |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: 'å²åå¾
è¿ä¿®' |
| | | } |
| | | ], //å¶ä»¶ç¶æå表 |
| | | arr: [], //æ·»å é¶ä»¶å表 |
| | | action: this.$myHOST + '/ContainerVsItem/UpLoadImageFiles', |
| | | plan: true, //计åå
¨é¨åæ¢ |
| | | selector: [], //å
¥åºç±»å |
| | | actionSheetList: [], //计ååå·å表 |
| | | cvi: '', //ç»çåå· |
| | | stateText: '', //å¶ä»¶ç¶æåæ¾ |
| | | type: '', //å
¥åºç±»ååæ¾ |
| | | keyword: '', //æç´¢é¶ä»¶ |
| | | showPlan: false, //计ååå·å¼¹çª |
| | | event: '', //跳转æ è¯ |
| | | containerType: '', //å¨å
፱Ȍ |
| | | value:'', |
| | | } |
| | | }, |
| | | |
| | | //é»è®¤è¿å |
| | | onBackPress(options) { |
| | | // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | if (options.from == 'navigateBack') { |
| | | uni.navigateTo({ |
| | | url: './jimo' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.navigateTo({ |
| | | url: './jimo' |
| | | }); |
| | | } |
| | | // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | return true |
| | | }, |
| | | onLoad(options) { |
| | | if (options.event) { |
| | | this.event = options.event |
| | | let list = JSON.parse(options.list) |
| | | this.containerCode = list.containerName |
| | | this.tray() |
| | | this.cvi = list.cviCode |
| | | this.type = list.inType |
| | | this.stateText = list.isBad == 0 ? 'åæ ¼' : isBad == 1 ? 'çè£
å¾
è¿ä¿®' : 'å²åå¾
è¿ä¿®' |
| | | this.setDetail() |
| | | } |
| | | |
| | | }, |
| | | created() { |
| | | if (this.event !== 10) { |
| | | this.getCode() |
| | | this.putType() |
| | | this.value = new Date().getFullYear() + "-" + (new Date().getMonth() + 1) + "-" + new Date().getDate() + " " + new Date().getHours()+":"+new Date().getMinutes() + ":" + new Date().getSeconds() |
| | | //æåçæ°æ® |
| | | let savelist = uni.getStorageSync('savelist') |
| | | if (savelist) { |
| | | savelist.forEach(item => { |
| | | this.containerCode = item.containerCode |
| | | this.palletType = item.palletType |
| | | this.cvi = item.cvi |
| | | this.stateText = item.stateText |
| | | this.type = item.InType |
| | | this.arr = item.arrlist |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | // å¤çæ«ç è¿åçæ°æ® |
| | | split(event) { |
| | | if (event.includes('å¨å
·ç¼å·')) { |
| | | // æ«ç æªæ«ç |
| | | var that = this |
| | | let str = JSON.stringify(decodeURI(event)) |
| | | let arr = str.split('å¨å
·ç¼å·ï¼')[1] |
| | | let index = arr.indexOf('æäº§æ¶é´') |
| | | that.containerCode = arr.slice(0, index).trim() |
| | | that.tray() |
| | | } else if (event.includes('anceType')) { |
| | | //æ«äºç»´ç å¸¦åºæææ°æ® |
| | | let json = eval("(" + event + ")") |
| | | this.containerCode = json[0].value |
| | | this.palletType = json[0].anceType |
| | | this.cvi = json[0].code |
| | | this.stateText = json[0].stateText |
| | | this.type = json[0].type |
| | | this.arr = json[0].arr |
| | | } else { |
| | | //è¾å
¥å¨å
· |
| | | this.tray() |
| | | } |
| | | }, |
| | | // æç´¢æç |
| | | tray() { |
| | | let params = { |
| | | page: '1', |
| | | containerName: this.containerCode, |
| | | onePageNum: 20 |
| | | } |
| | | tray(params).then((res) => { |
| | | if (res.code == 0) { |
| | | res.data.forEach((item) => { |
| | | if (this.containerCode == item.containerName) { |
| | | this.containerCode = item.containerName |
| | | this.palletType = item.palletType |
| | | this.containerType = item.containerType |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //è·åç»çç¼å· |
| | | getCode() { |
| | | getCode().then((res) => { |
| | | if (!this.event) { |
| | | this.cvi = res |
| | | } |
| | | }) |
| | | }, |
| | | //ç¹å»å¡ççç©ææç» |
| | | setDetail() { |
| | | let params = { |
| | | page: 1, |
| | | containerName: this.containerCode, |
| | | onePageNum: 10 |
| | | } |
| | | set(params).then((res) => { |
| | | this.set = res.data |
| | | res.data.forEach((item, index) => { |
| | | this.arr.push({ |
| | | partDes: item.itemDes, |
| | | createLine: item.createLine, |
| | | partName: item.itemName, |
| | | nowDate: item.updateTime, |
| | | number: item.itemNum, |
| | | maxnumber: item.itemNum, |
| | | inOrderCode: item.inOrderCode, |
| | | image: item.image, |
| | | list: [{ |
| | | url: this.$myHOST + '/' + item.image |
| | | }] |
| | | }) |
| | | if (item.image == null) { |
| | | this.arr.forEach(item => { |
| | | item.image = null |
| | | delete item.list |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | //å¶ä»¶ç¶æåæ¾ |
| | | stateLable(e) { |
| | | this.stateText = e[0].label |
| | | }, |
| | | //å
¥åºç±»å |
| | | putType() { |
| | | // this.show = true |
| | | let params = { |
| | | page: 1, |
| | | onePageNum: 20 |
| | | } |
| | | this.selector = [] |
| | | InType(params).then((res) => { |
| | | if (res.code == 0) { |
| | | res.data.forEach(item => { |
| | | this.selector.push({ |
| | | value: item.id, |
| | | label: item.inType |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //å
¥åºç±»ååæ¾ |
| | | confirm(e) { |
| | | this.type = e[0].label |
| | | }, |
| | | //计åç©æå表ï¼plan为trueï¼ |
| | | InOrder(e) { |
| | | let pages = 1 |
| | | if (e) { |
| | | pages = e |
| | | } |
| | | let params = { |
| | | page: pages, |
| | | isFinish: 0, |
| | | enable: 1, |
| | | itemName: this.keyword, |
| | | onePageNum: 10 |
| | | } |
| | | InOrder(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (pages != 1) { |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } |
| | | this.list = this.list.concat(res.data) |
| | | } else { |
| | | this.list = res.data |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }, |
| | | //å
¨é¨ç©æå表ï¼plan为falseï¼ |
| | | part(e) { |
| | | let pages = 1 |
| | | if (e) { |
| | | pages = e |
| | | } |
| | | let params = { |
| | | page: pages, |
| | | itemName: this.keyword, |
| | | onePageNum: 10, |
| | | useContainerType: this.containerType |
| | | } |
| | | part(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (pages != 1) { |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } |
| | | this.list = this.list.concat(res.data) |
| | | } else { |
| | | this.list = res.data |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // æ·»å ç©æ |
| | | addMaterial() { |
| | | this.dialogShow = true |
| | | this.keyword = '' |
| | | this.plan = true |
| | | this.InOrder() |
| | | }, |
| | | //æ¾ç¤ºå
¨é¨ç©æ |
| | | allPart() { |
| | | this.keyword = '' |
| | | this.status = 'loading' |
| | | this.list = [] |
| | | this.plan = !this.plan |
| | | this.part() |
| | | }, |
| | | //触åºäºä»¶ |
| | | lower(e) { |
| | | if (!this.plan) { |
| | | this.part(e) |
| | | } else { |
| | | this.InOrder(e) |
| | | } |
| | | }, |
| | | //æç´¢é¶ä»¶ |
| | | searchPart() { |
| | | if (this.keyword) { |
| | | if (!this.plan) { |
| | | this.part() |
| | | } else { |
| | | this.InOrder() |
| | | } |
| | | } |
| | | }, |
| | | //æ¸
é¤æç´¢æ¡ä»¶ |
| | | clearcode() { |
| | | if (!this.plan) { |
| | | this.part() |
| | | } else { |
| | | this.InOrder() |
| | | } |
| | | }, |
| | | //ç©æåæ¾ |
| | | picker(val, event) { |
| | | let params = { |
| | | page: 1, |
| | | itemName: val.itemName, |
| | | onePageNum: 10 |
| | | } |
| | | part(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (this.arr.length !== 0) { |
| | | let l = this.arr.map((a) => { |
| | | return a.partName |
| | | }) |
| | | if (l.includes(val.itemName)) { |
| | | uni.showToast({ |
| | | title: 'ä¸è½é夿·»å ', |
| | | duration: 2000, |
| | | icon: 'none', |
| | | }) |
| | | return |
| | | } |
| | | } |
| | | this.arr.push({ |
| | | partDes: val.itemDes, |
| | | partName: val.itemName, |
| | | number: this.plan ? val.totalNum : val.maxNum, |
| | | maxnumber: this.plan ? val.totalNum : val.maxNum, |
| | | //nowDate: val.updateTime?val.updateTime:new Date(), |
| | | nowDate: val.updateTime?val.updateTime:this.value, |
| | | cviCode: this.cvi, |
| | | inOrderCode: val.inOrderCode, |
| | | image: res.data[0].image, |
| | | createLine: val.createLine, |
| | | itemName: val.itemName, |
| | | list: [{ |
| | | url: `${this.$myHOST}/${res.data[0].image}` |
| | | }] |
| | | }) |
| | | if (res.data[0].image == null) { |
| | | this.arr.forEach(item => { |
| | | delete item.list |
| | | }) |
| | | } |
| | | this.materialCode = val.itemName |
| | | this.dialogShow = false |
| | | } |
| | | }) |
| | | }, |
| | | //ç产ç¹å»äºä»¶ |
| | | planclick(item, index) { |
| | | this.planCode(item.itemName) |
| | | this.showPlan = true |
| | | this.$forceUpdate() |
| | | }, |
| | | //计ååå·åæ¾ |
| | | pickerPop(val, event) { |
| | | this.arr.forEach(item => { |
| | | item.inOrderCode = val |
| | | }) |
| | | this.showPlan = false |
| | | }, |
| | | //ç产计ååå· |
| | | planCode(e) { |
| | | this.actionSheetList = [] |
| | | let params = { |
| | | page: 1, |
| | | itemName: e, |
| | | onePageNum: 20 |
| | | } |
| | | InOrder(params).then((res) => { |
| | | if (res.code == 0) { |
| | | res.data.forEach(item => { |
| | | this.actionSheetList.push(item.inOrderCode) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //å é¤é¶ä»¶ |
| | | delPart() { |
| | | // this.arr = [] |
| | | if (this.arr.length != 0) { |
| | | this.arr = [] |
| | | this.$u.toast('å 餿å') |
| | | } |
| | | }, |
| | | //éç½® |
| | | reset() { |
| | | this.lastsave() |
| | | uni.removeStorageSync('savelist') |
| | | this.keyword = '' |
| | | this.arr = [] |
| | | this.plan = true |
| | | this.actionSheetList = [] |
| | | this.containerCode = '' |
| | | this.palletType = '' |
| | | this.stateText = '' |
| | | this.type = '' |
| | | }, |
| | | // ç»çæ°å¢ |
| | | add() { |
| | | let eindex = 0 |
| | | // try { |
| | | this.arr.forEach(item => { |
| | | let params = { |
| | | page: 1, |
| | | itemName: item.partName, |
| | | onePageNum: 10, |
| | | isMoreDay: 'æ¯' |
| | | } |
| | | ItemStorage(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (res.data.length !== 0) { |
| | | uni.showModal({ |
| | | title: ` ${params.itemName}é¶ä»¶è¶
åºå
¥åºä¸é`, |
| | | content: res.msg, |
| | | showCancel: false, |
| | | }); |
| | | return |
| | | } else { |
| | | eindex++ |
| | | this.arrList = [] |
| | | this.arr.forEach(item => { |
| | | this.arrList.push({ |
| | | itemName: item.partName, |
| | | itemNum: item.number, |
| | | inOrderCode: item.inOrderCode, |
| | | image: item.image |
| | | }) |
| | | }) |
| | | let params = { |
| | | cviCode: this.cvi, |
| | | inType: this.type, |
| | | enable: '1', |
| | | createUser: uni.getStorageSync('admin'), |
| | | // inOrderCode: this.productionCode, |
| | | isBad: this.stateText == "åæ ¼" ? 0 : 1, |
| | | containerName: this.containerCode, |
| | | itemList: JSON.stringify(this.arrList) |
| | | } |
| | | if (eindex == this.arr.length) { |
| | | addAll(params).then((res) => { |
| | | if (res.code == 1) { |
| | | uni.showModal({ |
| | | title: res.msg, |
| | | content: res.msg, |
| | | showCancel: false, |
| | | }); |
| | | } else { |
| | | this.reset() |
| | | uni.navigateTo({ |
| | | url: './jimo' |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: 'æç¤º', |
| | | content: res.msg, |
| | | showCancel: false, |
| | | }); |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | //æå |
| | | save() { |
| | | let savelist = [{ |
| | | containerCode: this.containerCode, |
| | | palletType: this.palletType, |
| | | cvi: this.cvi, |
| | | stateText: this.stateText, |
| | | InType: this.type, |
| | | arrlist: this.arr |
| | | }] |
| | | uni.setStorageSync('savelist', savelist) |
| | | }, |
| | | //å卿¬æ¬¡ç»çæ°æ® |
| | | lastsave() { |
| | | let lastlist = [{ |
| | | containerCode: this.containerCode, |
| | | palletType: this.palletType, |
| | | cvi: this.cvi, |
| | | stateText: this.stateText, |
| | | InType: this.type, |
| | | arrlist: this.arr |
| | | }] |
| | | uni.setStorageSync('lastlist', lastlist) |
| | | }, |
| | | //ä¸ä¸æ¡ |
| | | last() { |
| | | //æåçæ°æ® |
| | | if (uni.getStorageSync('lastlist')) { |
| | | uni.getStorageSync('lastlist').forEach(item => { |
| | | this.containerCode = item.containerCode |
| | | this.palletType = item.palletType |
| | | this.cvi = item.cvi |
| | | this.stateText = item.stateText |
| | | this.type = item.InType |
| | | this.arr = item.arrlist |
| | | }) |
| | | } else { |
| | | this.$u.toast('ææ ä¸ä¸æ¡') |
| | | } |
| | | }, |
| | | //æå° |
| | | onPrint() { |
| | | this.singlist = ({ |
| | | createLine: this.arr[0].createLine, |
| | | itemDes: `${this.arr.length>=1?this.arr[0].partDes:'æ '},${this.arr.length>=1?this.arr[0].partName:'æ '},${this.arr.length>=1?this.arr[0].number:'æ '}`, |
| | | itemName: `${this.arr.length>=2?this.arr[1].partDes:'æ '},${this.arr.length>=2?this.arr[1].partName:'æ '},${this.arr.length>=2?this.arr[1].number:'æ '}`, |
| | | itemNum: `${this.arr.length>=3?this.arr[2].partDes:'æ '},${this.arr.length>=3?this.arr[2].partName:'æ '},${this.arr.length>=3?this.arr[2].number:'æ '}`, |
| | | //updateTime: this.arr[0].nowDate?this.$moment(this.arr[0].nowDate).format('YYYY-MM-DD HH:mm:ss'):new Date().toLocaleDateString() |
| | | updateTime:this.arr[0].nowDate, |
| | | }) |
| | | if (!uni.getStorageSync("deviceId")) { |
| | | uni.showToast({ |
| | | title: 'è¯·è¿æ¥æå°æº', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | return |
| | | } |
| | | setTimeout(() => { |
| | | this.writeBLECharacteristicValue() |
| | | }, 500) |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 5px; |
| | | height: 2.7rem; |
| | | position: relative; |
| | | top: 1rpx; |
| | | width: 100%; |
| | | } |
| | | |
| | | .title { |
| | | display: flex; |
| | | height: 2.2rem; |
| | | font-size: 1rem; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | padding-right: 9px; |
| | | position: a; |
| | | top: 0; |
| | | width: 100%; |
| | | } |
| | | |
| | | .fix { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 45px; |
| | | .btn { |
| | | width: 30%; |
| | | |
| | | } |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .line2 { |
| | | line-height: 2.3rem; |
| | | padding: 8px 10px 8px 3rem; |
| | | font-size: 0.93rem; |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | |
| | | .line3 { |
| | | line-height: 1.8rem; |
| | | padding: 8px 3px; |
| | | font-size: 0.93rem; |
| | | border-bottom: 1px solid #eaeaea; |
| | | text-align: center; |
| | | } |
| | | |
| | | .pl2 { |
| | | padding-left: 2rem !important; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .tr { |
| | | text-align: right; |
| | | } |
| | | |
| | | .btn { |
| | | font-size: 0.8rem; |
| | | position: absolute !important; |
| | | right: 10px; |
| | | height: 30px !important; |
| | | } |
| | | |
| | | .center { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .space-between { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | ::v-deep .u-drawer-content { |
| | | /* padding-top: 5rem; */ |
| | | } |
| | | |
| | | .flex { |
| | | display: flex; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <!-- <u-navbar back-text="" title="é计ååºåº-æ°å»º"></u-navbar> --> |
| | | <view class="line"> |
| | | <text class="col7">åºåºä»»å¡åå·:</text> |
| | | <u-input class="ml10" border input-align="center" v-model="taskCode" placeholder="" disabled></u-input> |
| | | </view> |
| | | <view class="line space-between" @click="dialogVisible=true"> |
| | | <text class="col7">åºåºå£:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{stateText}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="state" mode="single-column" v-model="dialogVisible" @confirm="stateLable"> |
| | | </u-select> |
| | | </view> |
| | | <view class="line space-between" @click="pncode"> |
| | | <text class="col7">é¶ä»¶å·:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{pn}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="line space-between" @click="bourn"> |
| | | <text class="col7">ç®çå°:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{destination.productionLineName}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="line space-between" @click="dialogType=true"> |
| | | <text class="col7">åºåºç±»å:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{type}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="line space-between" @click="ftWorker"> |
| | | <text class="col7">æå®å车工:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{ftText}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="ftlist" mode="single-column" v-model="dialogFt" @confirm="ftLable"> |
| | | </u-select> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">è£
ç®±æ°é:</text> |
| | | <u-input class="ml10" border input-align="center" v-model="maxNum" placeholder="" disabled></u-input> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7" v-if="totalNum">æ»åºåæ°é:</text> |
| | | <text class="col7" v-else>æ»ç©ºå¨å
·æ°é:</text> |
| | | <u-input class="ml10" border v-model="total" input-align="center" placeholder="" disabled></u-input> |
| | | </view> |
| | | |
| | | <view class="line"> |
| | | <text class="col7">åºåºæ°é:</text> |
| | | <u-input class="ml10" v-model="outNum" @blur="doInput(outNum)" placeholder="æå¨è¾å
¥æ°é"></u-input> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7" v-if="totalNum">ææåºåæ°é:</text> |
| | | <text class="col7" v-else>ææç©ºå¨å
·æ°é:</text> |
| | | <u-input class="ml10" border v-model="valid" input-align="center" placeholder="" disabled></u-input> |
| | | </view> |
| | | <view> |
| | | <u-select :list="stateType" mode="single-column" v-model="dialogType" @confirm="stateLable"> |
| | | </u-select> |
| | | </view> |
| | | <view class="fix"> |
| | | <u-button type="success" @click="add">ä¿å</u-button> |
| | | </view> |
| | | <Dialogdata ref="diapop" :flag.sync="dialogShow" @lower="lower"> |
| | | <view slot="con"> |
| | | <view class="title"> |
| | | <text>é¶ä»¶å·</text> |
| | | </view> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢é¶ä»¶ç¼å·" @blur="searchcode" v-model="keyword" input-align="center" |
| | | @clear="clear" bg-color="#fff" shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class="line3" v-for="(item,index) in list" :key='index' @click="picker(item, $event)"> |
| | | <text style="color:#000">{{item.itemName}}</text> |
| | | <text class="col7 ml10">{{item.itemDes}}</text> |
| | | </view> |
| | | <u-loadmore :status="status" /> |
| | | </view> |
| | | </Dialogdata> |
| | | <Dialogdata :flag.sync="dialogShowGoal" @lower="lowerbourn"> |
| | | <view slot="con"> |
| | | <view class="title"> |
| | | <text>ç®çå°</text> |
| | | </view> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢ç®çå°" @clear="clearbourn" @search="searchbourn" v-model="keyword2" |
| | | input-align="center" bg-color="#fff" shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class="line3" v-for="(item,index) in destination" :key='index' @click="pickerB(item, $event)"> |
| | | <text style="color:#000">{{item.productionName}}</text> |
| | | </view> |
| | | <u-loadmore :status="status" /> |
| | | </view> |
| | | </Dialogdata> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import { |
| | | code, |
| | | add, |
| | | ProductionLine, |
| | | SearchItemAllNum, |
| | | SearchItemCanUseNum, |
| | | EmptyContainerPlace, |
| | | UserSearch |
| | | } from '../../../api/putOut.js' |
| | | import { |
| | | part |
| | | } from '../../../api/putIn.js' |
| | | import Dialogdata from '@/components/dialog.vue' |
| | | export default { |
| | | components: { |
| | | Dialogdata |
| | | }, |
| | | data() { |
| | | return { |
| | | dialogVisible: false, //åºåºå£å¼¹çª |
| | | dialogType: false, //åºåºç±»åå¼¹çª |
| | | dialogShow: false, //é¶ä»¶å·å¼¹çª |
| | | dialogShowGoal: false, //ç®çå°å¼¹çª |
| | | dialogFt: false, //åè½¦å·¥å¼¹çª |
| | | taskCode: '', //åºåºä»»å¡å· |
| | | pn: '', //é¶ä»¶å· |
| | | totalNum: true, //空å¨å
·åæ¢ |
| | | // timeout: null, |
| | | keyword: '', |
| | | keyword2: '', |
| | | userCarId: 0, //å车工id |
| | | destination: [], //ç®çå°å表 |
| | | outNum: '', //åºåºæ°é |
| | | maxNum: '', //è£
ç®±æ°é |
| | | number: '', //ä¸çº¿æ°é |
| | | partName: '', //é¶ä»¶ç¼å· |
| | | stateText: '', //åºåºå£ |
| | | //ftText: '', //å车工 |
| | | ftText: uni.getStorageSync('admin'), //å车工 |
| | | type: '', //åºåºç±»å |
| | | value: '', |
| | | shipping: '', |
| | | valid: '', //ææåºåæ°é |
| | | total: '', //æ»åºåæ°é |
| | | list: [], |
| | | ftlist: [{ |
| | | value: 17, |
| | | label: '' |
| | | }], //å车工å表 |
| | | status: 'loading', |
| | | state: [{ |
| | | num: 68, |
| | | label: '1å·å£' |
| | | },{ |
| | | num: 51, |
| | | label: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | label: '3å·å£' |
| | | }, { |
| | | num: 67, |
| | | label: '4å·å£' |
| | | }, { |
| | | num: 34, |
| | | label: '5å·å£' |
| | | }, { |
| | | num: 30, |
| | | label: '6å·å£' |
| | | }, { |
| | | num: 19, |
| | | label: '7å·å£' |
| | | }, { |
| | | num: 12, |
| | | label: '8å·å£' |
| | | }, { |
| | | num: 997, |
| | | label: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | label: 'çè£
åºå£' |
| | | }], |
| | | stateType: [{ |
| | | value: '1', |
| | | label: 'çè£
åºåº' |
| | | }, |
| | | { |
| | | value: '2', |
| | | label: 'è°ä»¶åºåº' |
| | | }, |
| | | { |
| | | value: '3', |
| | | label: '忣åºåº' |
| | | }, |
| | | { |
| | | value: '4', |
| | | label: 'è¿ä¿®åºåº' |
| | | }, |
| | | { |
| | | value: '5', |
| | | label: '空å¨å
·åºåº' |
| | | } |
| | | ], |
| | | }; |
| | | }, |
| | | created() { |
| | | this.code() |
| | | this.stateLable() |
| | | this.totalNum = true |
| | | this.pn = uni.getStorageSync("pn") |
| | | this.destination.productionName = uni.getStorageSync("productionLineName").productionName |
| | | this.destination.productionLineCode = uni.getStorageSync("productionLineCode").productionLineCode |
| | | this.type = uni.getStorageSync("type") |
| | | }, |
| | | |
| | | methods: { |
| | | //æ£å |
| | | doInput(val) { |
| | | if (val > this.valid) { |
| | | uni.showToast({ |
| | | title: 'åºåºæ°éä¸è½å¤§äºææåºå', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | }, |
| | | lower(e) { |
| | | let params = { |
| | | page: e, |
| | | itemName: this.keyword, |
| | | onePageNum: 10 |
| | | } |
| | | part(params).then((res) => { |
| | | let arr = [] |
| | | if (this.page != 1) { |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } else { |
| | | this.list = this.list.concat(res.data) |
| | | } |
| | | } else { |
| | | this.list = res.data |
| | | } |
| | | }) |
| | | }, |
| | | lowerbourn(e) { |
| | | this.keyword2 = '' |
| | | let params = { |
| | | page: e, |
| | | productionName: this.keyword2, |
| | | onePageNum: 10 |
| | | } |
| | | ProductionLine(params).then((res) => { |
| | | if (this.page != 1) { |
| | | |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } |
| | | this.destination = this.destination.concat(res.data) |
| | | } else { |
| | | this.destination = res.data |
| | | } |
| | | }) |
| | | }, |
| | | //æå®å车工 |
| | | ftWorker() { |
| | | let params = { |
| | | page: 1, |
| | | roleName: 'å车', |
| | | onePageNum: 10 |
| | | } |
| | | UserSearch(params).then((res) => { |
| | | this.ftlist = [] |
| | | res.data.forEach(item => { |
| | | this.ftlist.push({ |
| | | value: item.id, |
| | | label: item.userName |
| | | }) |
| | | }) |
| | | }) |
| | | setTimeout(() => { |
| | | this.dialogFt = true |
| | | }, 100) |
| | | }, |
| | | //åè½¦å·¥åæ¾ |
| | | ftLable(e) { |
| | | this.ftText = e[0].label |
| | | this.userCarId = e[0].value |
| | | }, |
| | | //åºåºå£åæ¾ |
| | | stateLable(e) { |
| | | this.totalNum = true |
| | | if (e) { |
| | | this.state.forEach(item => { |
| | | if (item.label == e[0].label) { |
| | | this.stateText = e[0].label |
| | | } |
| | | }) |
| | | this.stateType.forEach(item => { |
| | | if (item.label == e[0].label) { |
| | | this.type = e[0].label |
| | | } |
| | | }) |
| | | uni.setStorageSync('type', this.type); |
| | | if (this.type == "空å¨å
·åºåº") { |
| | | let params = { |
| | | itemName: this.pn |
| | | } |
| | | EmptyContainerPlace(params).then((res) => { |
| | | this.totalNum = false |
| | | res.forEach(item => { |
| | | if (item.titel == "æ»ç©ºå¨å
·æ°") { |
| | | this.total = item.value |
| | | } |
| | | if (item.titel == "ææç©ºå¨å
·æ°") { |
| | | this.valid = item.value |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | this.totalNum = true |
| | | this.SearchItemAllNum() |
| | | this.SearchItemCanUseNum() |
| | | } |
| | | } |
| | | |
| | | }, |
| | | //æ¸
空é¶ä»¶å· |
| | | clear() { |
| | | this.keyword = '' |
| | | this.pncode() |
| | | }, |
| | | //åºåº |
| | | add() { |
| | | this.state.forEach(item => { |
| | | if (this.stateText == item.label) { |
| | | this.shipping = item.num |
| | | } |
| | | }) |
| | | if (this.outNum > this.valid) { |
| | | uni.showToast({ |
| | | title: 'åºåºæ°éä¸è½å¤§äºææåºå', |
| | | icon: 'none' |
| | | }); |
| | | |
| | | } else { |
| | | this.date = |
| | | `${new Date().getFullYear()}-${new Date().getMonth()+1}-${new Date().getDate()} ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()} ` |
| | | let params = { |
| | | outOrderCode: this.taskCode, |
| | | orderStatus: 'æ°å»º', |
| | | doTime: this.date, |
| | | itemName: this.pn, |
| | | tranLine: this.shipping, |
| | | itemDes: this.partName, |
| | | orderType: this.type, |
| | | userCarId: this.userCarId, |
| | | // checkOutNum: this.outNum, |
| | | totalOutNum: this.outNum, |
| | | //userName: uni.getStorageSync('admin'), |
| | | userName: this.ftText, |
| | | productionLineCode: this.destination.productionLineCode, |
| | | isErp: 0 |
| | | } |
| | | add(params).then((res) => { |
| | | if (res.code == 1) { |
| | | this.$u.toast(res.msg) |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: './manual' |
| | | }); |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | //é¶ä»¶å表 |
| | | pncode() { |
| | | this.keyword = '' |
| | | let params = { |
| | | page: 1, |
| | | itemName: this.keyword, |
| | | onePageNum: 10 |
| | | } |
| | | part(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } else { |
| | | this.list = res.data |
| | | } |
| | | } |
| | | }) |
| | | this.dialogShow = true |
| | | }, |
| | | searchcode() { |
| | | let params = { |
| | | page: 1, |
| | | itemName: this.keyword, |
| | | onePageNum: 20 |
| | | } |
| | | // clearTimeout(this.timeout) |
| | | // this.timeout = setTimeout(() => { |
| | | part(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.status = 'nomore' |
| | | this.list = res.data |
| | | } |
| | | }) |
| | | // },200) |
| | | |
| | | }, |
| | | //é¶ä»¶å·åæ¾ |
| | | picker(val, event) { |
| | | this.pn = val.itemName |
| | | uni.setStorageSync('pn', this.pn); |
| | | if(this.type == "空å¨å
·åºåº"){ |
| | | let params = { |
| | | itemName: this.pn |
| | | } |
| | | EmptyContainerPlace(params).then((res) => { |
| | | this.totalNum = false |
| | | res.forEach(item => { |
| | | if (item.titel == "æ»ç©ºå¨å
·æ°") { |
| | | this.total = item.value |
| | | } |
| | | if (item.titel == "ææç©ºå¨å
·æ°") { |
| | | this.valid = item.value |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | else{ |
| | | this.SearchItemCanUseNum() |
| | | this.SearchItemAllNum() |
| | | } |
| | | this.maxNumber() |
| | | this.dialogShow = false |
| | | }, |
| | | //è·åè£
ç®±æ°é |
| | | maxNumber() { |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.pn, |
| | | onePageNum: 10 |
| | | } |
| | | part(params).then((res) => { |
| | | this.maxNum = res.data[0].maxNum |
| | | }) |
| | | }, |
| | | // è·åæææ°é |
| | | SearchItemCanUseNum() { |
| | | let params = { |
| | | itemName: this.pn |
| | | } |
| | | SearchItemCanUseNum(params).then((res) => { |
| | | this.valid = res |
| | | }) |
| | | }, |
| | | // è·åæ»åºåæ°é |
| | | SearchItemAllNum() { |
| | | let params = { |
| | | itemName: this.pn |
| | | } |
| | | SearchItemAllNum(params).then((res) => { |
| | | this.total = res |
| | | }) |
| | | }, |
| | | //ç®çå°å表 |
| | | bourn() { |
| | | let params = { |
| | | page: 1, |
| | | productionName: this.keyword2, |
| | | onePageNum: 10 |
| | | } |
| | | ProductionLine(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (res.data.length == 0) { |
| | | this.status = 'nomore' |
| | | return |
| | | } else { |
| | | this.destination = res.data |
| | | } |
| | | |
| | | } |
| | | }) |
| | | this.dialogShowGoal = true |
| | | }, |
| | | searchbourn() { |
| | | let params = { |
| | | page: 1, |
| | | productionName: this.keyword2, |
| | | onePageNum: 20 |
| | | } |
| | | ProductionLine(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.status = 'nomore' |
| | | this.destination = res.data |
| | | } |
| | | }) |
| | | this.dialogShowGoal = true |
| | | }, |
| | | clearbourn() { |
| | | this.keyword2 = '' |
| | | this.bourn() |
| | | }, |
| | | //ç®çå°åæ¾ |
| | | pickerB(val, event) { |
| | | let params = { |
| | | page: 1, |
| | | // productionName: this.keyword2 |
| | | onePageNum: 20 |
| | | } |
| | | ProductionLine(params).then((res) => { |
| | | if (res.code == 0) { |
| | | res.data.forEach(item => { |
| | | this.destination.productionLineName = val.productionName |
| | | this.destination.productionLineCode = val.productionCode |
| | | uni.setStorageSync('productionLineName', this.destination |
| | | .productionLineName) |
| | | uni.setStorageSync('productionLineCode', this.destination |
| | | .productionLineCode) |
| | | this.dialogShowGoal = false |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | // åºåºä»»å¡åå· |
| | | code() { |
| | | let params = {} |
| | | code(params).then((res) => { |
| | | this.taskCode = res |
| | | }) |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .title { |
| | | display: flex; |
| | | height: 2.2rem; |
| | | font-size: 1rem; |
| | | align-items: center; |
| | | justify-content: center; |
| | | /* padding-right: 9px; */ |
| | | } |
| | | |
| | | .fix { |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 45px; |
| | | padding: 0 3px; |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .line2 { |
| | | line-height: 2.3rem; |
| | | padding: 8px 10px 8px 3rem; |
| | | font-size: 0.93rem; |
| | | } |
| | | |
| | | .line3 { |
| | | line-height: 1.8rem; |
| | | padding: 8px 3px; |
| | | font-size: 0.93rem; |
| | | border-bottom: 1px solid #eaeaea; |
| | | text-align: center; |
| | | } |
| | | |
| | | .pl2 { |
| | | padding-left: 2rem !important; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .tr { |
| | | text-align: right; |
| | | } |
| | | |
| | | .btn { |
| | | font-size: 0.8rem; |
| | | position: absolute !important; |
| | | right: 10px; |
| | | height: 30px !important; |
| | | } |
| | | |
| | | .center { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .space-between { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <!-- <u-navbar back-text="" title="é计ååºåº-详æ
"></u-navbar> --> |
| | | <view class="line"> |
| | | <text class="col7">åºåºä»»å¡åå·:</text> |
| | | <text class="ml10">{{code}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºå£:</text> |
| | | <text class="ml10">{{shipping}}</text> |
| | | </view> |
| | | <view class="line2"> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶å·:</text> |
| | | <text class="ml10">{{pn}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="line2"> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶åç§°:</text> |
| | | <text class="ml10">{{partName}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">ç®çå°:</text> |
| | | <text class="ml10">{{bourn}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºç±»å:</text> |
| | | <text class="ml10">{{orderType}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">è£
ç®±æ°é:</text> |
| | | <text class="ml10">{{maxNum}}</text> |
| | | </view> |
| | | <!-- <view class="line"> |
| | | <text class="col7">æ»åºåæ°é:</text> |
| | | <text class="ml10">{{total}}</text> |
| | | </view> --> |
| | | <view class="line"> |
| | | <text class="col7">åºåºæ°é:</text> |
| | | <text class="ml10">{{checkOutNum}}</text> |
| | | </view> |
| | | <!-- <view class="line"> |
| | | <text class="col7">ææåºåæ°é:</text> |
| | | <text class="ml10">{{total}}</text> |
| | | </view> --> |
| | | <view class="line"> |
| | | <text class="col7">ä»»å¡ç¶æ:</text> |
| | | <text class="ml10">{{orderStatus}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">宿æ¶é´:</text> |
| | | <text class="ml10">{{$moment(updateTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | <!-- <view class="line"> |
| | | <text class="col7">å车工人:</text> |
| | | <text class="ml10">{{applianceType}}</text> |
| | | </view> --> |
| | | <u-button type="success" class="btn" @click="CheckOutOrder">åºåº</u-button> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | out, |
| | | CheckOutOrder |
| | | } from '../../../api/putOut.js' |
| | | import { |
| | | part |
| | | } from '../../../api/putIn.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | code: '', //ä»»å¡åå· |
| | | shipping: '', //åºè´§å£ |
| | | pn: '', //é¶ä»¶ç¼å· |
| | | partName: '', //é¶ä»¶åç§° |
| | | bourn: '', //ç®çå° |
| | | checkOutNum: '', //åºåºæ°é |
| | | orderType: '', //åºåºç±»å |
| | | orderStatus: '', //ä»»å¡ç¶æ |
| | | updateTime: '', //宿æ¶é´ |
| | | maxNum: '', //è£
ç®±æ°é |
| | | total: '', //æ»åºåæ°é |
| | | id: '', |
| | | date: '', |
| | | list:[{ |
| | | num: 51, |
| | | ship: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | ship: '3å·å£' |
| | | }, { |
| | | num: 67, |
| | | ship: '4å·å£' |
| | | }, { |
| | | num: 34, |
| | | ship: '5å·å£' |
| | | }, { |
| | | num: 30, |
| | | ship: '6å·å£' |
| | | }, { |
| | | num: 19, |
| | | ship: '7å·å£' |
| | | }, { |
| | | num: 12, |
| | | ship: '8å·å£' |
| | | }, { |
| | | num: 997, |
| | | ship: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | ship: 'çè£
åºå£' |
| | | }] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.out() |
| | | }, |
| | | onLoad(options) { |
| | | this.code = options.code |
| | | }, |
| | | onBackPress(options) { |
| | | if (options.from == 'navigateBack') { |
| | | uni.navigateTo({ |
| | | url: './manual' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.navigateTo({ |
| | | url: './manual' |
| | | }); |
| | | } |
| | | return true |
| | | }, |
| | | methods: { |
| | | out() { |
| | | let params = { |
| | | page: '1', |
| | | onePageNum:40 |
| | | } |
| | | out(params).then((res) => { |
| | | res.data.forEach(item => { |
| | | if (this.code == item.outOrderCode) { |
| | | this.list.forEach(i=>{ |
| | | if(item.tranLine==i.num){ |
| | | this.shipping=i.ship |
| | | } |
| | | }) |
| | | this.pn = item.itemName |
| | | this.total = item.totalOutNum |
| | | this.partName = item.itemDes |
| | | this.bourn = item.productionLineName |
| | | this.orderType = item.orderType |
| | | this.checkOutNum = item.checkOutNum |
| | | this.orderStatus = item.orderStatus |
| | | this.updateTime = item.updateTime |
| | | this.id = item.id |
| | | this.num() |
| | | } |
| | | |
| | | }) |
| | | }) |
| | | }, |
| | | num() { |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.pn, |
| | | onePageNum:40 |
| | | } |
| | | part(params).then((res) => { |
| | | this.maxNum = res.data[0].maxNum |
| | | }) |
| | | }, |
| | | //åºåº |
| | | CheckOutOrder() { |
| | | let params = { |
| | | id: this.id |
| | | } |
| | | CheckOutOrder(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.$u.toast('ä¸åæå') |
| | | } else { |
| | | this.$u.toast(res.msg) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | page { |
| | | padding-bottom: 50px; |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .line2 { |
| | | border-bottom: 1px solid #eaeaea; |
| | | font-size: 1rem; |
| | | line-height: 1.9rem; |
| | | padding: 10px 10px 10px 3rem; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .btn { |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- <u-navbar back-text="" title="é计ååºåº"></u-navbar> --> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢ä»»å¡åå·" v-model="keyword" @search="list" @clear='list' input-align="center" |
| | | bg-color="#fff" shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <u-dropdown> |
| | | <u-dropdown-item v-model="value1" title="åºåºç±»å" :options="options1" @change="changeType"></u-dropdown-item> |
| | | <u-dropdown-item v-model="value2" title="ä»»å¡ç¶æ" :options="options2" @change="changeState"></u-dropdown-item> |
| | | </u-dropdown> |
| | | <view class="con"> |
| | | <u-card v-for="(item,index) in out" :key="index" class="card" @click="details(item,$event)"> |
| | | <view slot="head" class="title"> |
| | | <text class="col777">åºåºä»»å¡åå·:</text> |
| | | <text class="ml5">{{item.outOrderCode}}</text> |
| | | <view class="add ml5"> |
| | | <text>{{item.orderStatus}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" slot="body" style="display: flex;justify-content: space-around;" class="body"> |
| | | <view class="" style="width: 50%;"> |
| | | <view> |
| | | <text class="col777">é¶ä»¶åç§°:</text> |
| | | <text class="ml5">{{item.itemDes}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">ç®çå°:</text> |
| | | <text class="ml5">{{item.productionLineName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">åºåºæ°é:</text> |
| | | <text class="ml5">{{item.checkOutNum}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">å建æ¶é´:</text> |
| | | <text class="ml5">{{$moment(item.updateTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" style="width: 50%;"> |
| | | <view> |
| | | <text class="col777">é¶ä»¶ç¼å·:</text> |
| | | <text class="ml5">{{item.itemName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">åºåºç±»å:</text> |
| | | <text class="ml5">{{item.orderType}}</text> |
| | | </view> |
| | | <!-- <view> |
| | | <text class="col777">åè½¦å¸æº:</text> |
| | | <text class="ml5">{{item.inType}}</text> |
| | | </view> --> |
| | | <view> |
| | | <text class="col777">åºåºå£:</text> |
| | | <text class="ml5">{{item.tranLine}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </u-card> |
| | | <u-loadmore :status="status" /> |
| | | </view> |
| | | <view class="fix"> |
| | | <button class="btn" @click="add">æ°å»ºåºåº</button> |
| | | </view> |
| | | <u-back-top :scroll-top="scrollTop"></u-back-top> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | out |
| | | } from '../../../api/putOut.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | status: 'loadmore', |
| | | page: 1, |
| | | onePageNum: 10, |
| | | keyword: '', // ä»»å¡åå· |
| | | out: [], //åºåºå表 |
| | | value1: 1, |
| | | value2: 2, |
| | | orderType: '', |
| | | orderStatus: '', |
| | | scrollTop: 0, |
| | | options1: [{ |
| | | label: 'å
¨é¨', |
| | | value: 1 |
| | | }, { |
| | | label: 'çè£
åºåº', |
| | | value: 2 |
| | | }, |
| | | { |
| | | label: '空å¨å
·åºåº', |
| | | value: 3 |
| | | }, |
| | | { |
| | | label: 'è°ä»¶åºåº', |
| | | value: 4 |
| | | }, |
| | | { |
| | | label: 'è¿ä¿®åºåº', |
| | | value: 5 |
| | | }, |
| | | { |
| | | label: '忣åº', |
| | | value: 6 |
| | | } |
| | | ], |
| | | options2: [{ |
| | | label: 'å
¨é¨', |
| | | value: 1, |
| | | }, { |
| | | label: 'æ§è¡ä¸', |
| | | value: 2, |
| | | }, |
| | | { |
| | | label: '宿', |
| | | value: 3, |
| | | }, |
| | | { |
| | | label: 'æ°å»º', |
| | | value: 4, |
| | | } |
| | | ], |
| | | listnum: [{ |
| | | num: 67, |
| | | ship: '4å·å£' |
| | | }, { |
| | | num: 51, |
| | | ship: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | ship: '3å·å£' |
| | | }, { |
| | | num: 34, |
| | | ship: '5å·å£' |
| | | }, { |
| | | num: 12, |
| | | ship: '8å·å£' |
| | | }, { |
| | | num: 19, |
| | | ship: '7å·å£' |
| | | }, { |
| | | num: 30, |
| | | ship: '6å·å£' |
| | | }, { |
| | | num: 997, |
| | | ship: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | ship: 'çè£
åºå£' |
| | | }] |
| | | } |
| | | }, |
| | | //䏿å è½½ |
| | | onReachBottom() { |
| | | let _self = this |
| | | this.status = 'loading' |
| | | // uni.showNavigationBarLoading() |
| | | setTimeout(function() { |
| | | _self.page++; |
| | | // _self.status = 'more' |
| | | _self.list(); |
| | | // uni.hideNavigationBarLoading() |
| | | }, 2000); |
| | | |
| | | }, |
| | | |
| | | mounted() { |
| | | this.list() |
| | | }, |
| | | onBackPress(options) { |
| | | // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | if (options.from == 'navigateBack') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | return true |
| | | }, |
| | | //䏿巿° |
| | | onPullDownRefresh() { |
| | | this.orderType = '' |
| | | this.orderStatus = '' |
| | | this.keyword = '' |
| | | this.value1 = 1 |
| | | this.value2 = 1 |
| | | this.list() |
| | | setTimeout(function() { |
| | | uni.stopPullDownRefresh() |
| | | }, 1000) |
| | | }, |
| | | onPageScroll(e) { |
| | | this.scrollTop = e.scrollTop; |
| | | }, |
| | | methods: { |
| | | // åºåºè®¡å |
| | | list() { |
| | | let _self = this |
| | | let params = { |
| | | orderType: _self.orderType, |
| | | page: _self.page, |
| | | onePageNum: _self.onePageNum, |
| | | orderStatus: _self.orderStatus, |
| | | outOrderCode: _self.keyword, |
| | | isErp: 0, |
| | | } |
| | | out(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (_self.page != 1) { |
| | | if (res.data.result == '') { |
| | | _self.status = 'more' |
| | | return |
| | | } |
| | | _self.out = _self.out.concat(res.data) |
| | | } else { |
| | | _self.out = res.data |
| | | |
| | | } |
| | | this.$forceUpdate() |
| | | _self.out.forEach(item => { |
| | | this.listnum.forEach(i => { |
| | | if (item.tranLine == i.num) { |
| | | item.tranLine = i.ship |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | //åºè´§è®¡å详æ
|
| | | details(val, event) { |
| | | uni.navigateTo({ |
| | | url: `./details?code=${val.outOrderCode}` |
| | | }); |
| | | }, |
| | | //æ°å»ºé计ååºåº |
| | | add() { |
| | | uni.navigateTo({ |
| | | url: './add_manual' |
| | | }); |
| | | }, |
| | | changeType(val) { |
| | | this.options1.forEach(i => { |
| | | if (val == 1) { |
| | | this.orderType = '' |
| | | } else if (val == i.value) { |
| | | this.orderType = i.label |
| | | } |
| | | }) |
| | | this.list() |
| | | }, |
| | | changeState(val) { |
| | | if (val == 1) { |
| | | this.orderStatus = "" |
| | | } else if (val == 2) { |
| | | this.orderStatus = "æ§è¡ä¸" |
| | | } else if (val == 3) { |
| | | this.orderStatus = "宿" |
| | | } else if (val == 4) { |
| | | this.orderStatus = "æ°å»º" |
| | | } |
| | | this.list() |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 6px 8px; |
| | | } |
| | | |
| | | .col777 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml5 { |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .fix { |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 45px; |
| | | |
| | | .btn { |
| | | background-color: #1aac19; |
| | | color: #fff; |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | |
| | | .con { |
| | | margin-bottom: 45px; |
| | | } |
| | | |
| | | .card { |
| | | .title { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 1rem; |
| | | |
| | | .add { |
| | | background-color: #cbfe8f; |
| | | width: 3.8rem; |
| | | border-radius: 5px; |
| | | font-size: 0.8rem; |
| | | padding: 0.3rem 0.4rem; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .body { |
| | | font-size: 0.9rem; |
| | | color: #000; |
| | | line-height: 2rem; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <view class="line space-between" @click="pncode"> |
| | | <text class="col7">é¶ä»¶å·:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{pn}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | |
| | | </view> |
| | | <u-collapse :arrow="false"> |
| | | <u-collapse-item title="" :open="open" v-for="(item,index) in pnOpen" :key="index" |
| | | style="border-bottom: 1px solid #eaeaea;padding-bottom: 20px;background-color: #fff;margin-top: -11px;"> |
| | | <view class="collapse-item" style="padding: 0 48px;"> |
| | | é¶ä»¶å·ï¼{{item.itemName}} |
| | | é¶ä»¶æ°éï¼{{item.itemNum}} |
| | | </view> |
| | | </u-collapse-item> |
| | | </u-collapse> |
| | | <view class="line space-between" @click="bourn"> |
| | | <text class="col7">å¨å
·å·:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{destination.containerName}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="state" mode="single-column" v-model="dialogVisible" @confirm="target"> |
| | | </u-select> |
| | | </view> |
| | | |
| | | <view class="line space-between" @click="place"> |
| | | <text class="col7">èµ·å§ä½ç½®:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{type}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="line space-between" @click="dialogVisible=true"> |
| | | <text class="col7">ç®æ ä½ç½®:</text> |
| | | <view class=""> |
| | | <text class="ml10 col7">{{stateText}}</text> |
| | | <u-icon name="arrow-right"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view> |
| | | <u-select :list="stateType" mode="single-column" v-model="dialogType" @confirm="stateLable"> |
| | | </u-select> |
| | | </view> |
| | | <view class="fix"> |
| | | <u-button type="success" @click="add">åºåº</u-button> |
| | | <u-button type="success" plain @click="clear">åæ¶</u-button> |
| | | </view> |
| | | <u-popup v-model="dialogShow" mode="bottom" height="350px"> |
| | | <view class="title"> |
| | | <text>é¶ä»¶å·</text> |
| | | </view> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢é¶ä»¶ç¼å·" @search="pncode" v-model="keyword" input-align="center" bg-color="#fff" |
| | | shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class="line3" v-for="(item,index) in pnList" :key="index" @click="picker(item, $event)"> |
| | | <text style="color:#000">{{item.itemName}}</text> |
| | | <text class="col7 ml10">{{item.itemDes}}</text> |
| | | </view> |
| | | </u-popup> |
| | | <u-popup v-model="dialogShowGoal" mode="bottom" height="350px"> |
| | | <view class="title"> |
| | | <text>å¨å
·å·</text> |
| | | </view> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢å¨å
·å·" @search="bourn" v-model="keyword2" input-align="center" bg-color="#fff" |
| | | shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <view class="line3" v-for="(item,index) in destination" :key="index" @click="pickerB(item, $event)"> |
| | | <text style="color:#000">{{item.containerName}}</text> |
| | | </view> |
| | | |
| | | </u-popup> |
| | | </view> |
| | | </template> |
| | | <script> |
| | | import { |
| | | PlaceVsContainer, |
| | | Task |
| | | } from '../../../api/operation.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | dialogVisible: false, //ç®æ ä½ç½®å¼¹çª |
| | | dialogType: false, //èµ·å§ä½ç½®å¼¹çª |
| | | dialogShow: false, //é¶ä»¶å·å¼¹çª |
| | | dialogShowGoal: false, //å¨å
·å·å¼¹çª |
| | | open: false, //é¶ä»¶å·æå |
| | | pn: '', //é¶ä»¶å· |
| | | keyword: '', //é¶ä»¶å·æç´¢ |
| | | keyword2: '', //å¨å
·å·æç´¢ |
| | | type: '', //èµ·å§ä½ç½®åæ¾ |
| | | stateText: '', //ç®æ ä½ç½®åæ¾ |
| | | destination: [], //ç®çå°å表 |
| | | shipping: '', //ç®æ ä½ç½®ä¼ å |
| | | list: [], //åºä½å表 |
| | | pnList: [], //é¶ä»¶å表 |
| | | pnOpen: [], //éæ©é¶ä»¶å·ååæ¾ |
| | | itemList: [{ |
| | | head: "é¶ä»¶å·", |
| | | open: true, |
| | | disabled: true |
| | | }], |
| | | state: [{ |
| | | num: 51, |
| | | label: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | label: '3å·å£' |
| | | }, { |
| | | num: 67, |
| | | label: '4å·å£' |
| | | }, { |
| | | num: 34, |
| | | label: '5å·å£' |
| | | }, { |
| | | num: 30, |
| | | label: '6å·å£' |
| | | }, { |
| | | num: 19, |
| | | label: '7å·å£' |
| | | }, { |
| | | num: 12, |
| | | label: '8å·å£' |
| | | }, { |
| | | num: 997, |
| | | label: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | label: 'çè£
åºå£' |
| | | }], |
| | | stateType: [], |
| | | }; |
| | | }, |
| | | created() { |
| | | this.PlaceVsContainer() |
| | | }, |
| | | onBackPress(options) { |
| | | if (options.from == 'navigateBack') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | return true |
| | | }, |
| | | methods: { |
| | | //åºåå表 |
| | | PlaceVsContainer() { |
| | | let params = { |
| | | page: 1, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | //åºåº |
| | | add() { |
| | | this.state.forEach(i => { |
| | | if (this.stateText == i.label) { |
| | | this.shipping = i.num |
| | | } |
| | | }) |
| | | let params = { |
| | | sourcePlace: this.type, //èµ·å§ä½ç½® |
| | | toPlace: this.shipping, //ç®æ ä½ç½® |
| | | containerName: this.destination.containerName, |
| | | taskType: 2, |
| | | taskStatus: 'æ°å»º', |
| | | taskLevel: 0, |
| | | hasReaded: 0 |
| | | } |
| | | Task(params).then((res) => { |
| | | if (res.code == 1) { |
| | | this.$u.toast(res.msg) |
| | | } else { |
| | | this.$u.toast('åºåºæå') |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | clear() { |
| | | this.pn = '' |
| | | this.destination.containerName = '' |
| | | this.type = '' |
| | | this.pnOpen = [] |
| | | this.stateText = '' |
| | | }, |
| | | //é¶ä»¶å表 |
| | | pncode() { |
| | | this.pnList = [] |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.keyword, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | this.pnList = this.list.filter(function(s) { |
| | | return s.itemName && s.itemName.trim(); |
| | | }) |
| | | }) |
| | | this.dialogShow = true |
| | | }, |
| | | //é¶ä»¶å·åæ¾ |
| | | picker(val, event) { |
| | | this.pn = val.itemName |
| | | this.dialogShow = false |
| | | this.pnOpen = [] |
| | | }, |
| | | //å¨å
·å·å表 |
| | | bourn() { |
| | | this.destination = [] |
| | | if (this.pn === '') { |
| | | let params = { |
| | | page: '1', |
| | | containerName: this.keyword2, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | this.destination = this.list.filter(function(s) { |
| | | return s.containerName && s.containerName.trim(); |
| | | }) |
| | | }) |
| | | } else { |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.pn, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | this.destination = this.list.filter(function(s) { |
| | | return s.containerName && s.containerName.trim(); |
| | | }) |
| | | }) |
| | | } |
| | | this.dialogShowGoal = true |
| | | }, |
| | | //å¨å
·å·åæ¾ |
| | | pickerB(val, event) { |
| | | this.destination.containerName = val.containerName |
| | | let params = { |
| | | page: '1', |
| | | onePageNum: 20, |
| | | containerName: this.destination.containerName |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | this.pnOpen = this.list.filter(function(s) { |
| | | return s.itemName && s.itemName.trim(); |
| | | }) |
| | | this.type = this.list[0].place |
| | | this.open = true |
| | | this.pn = '' |
| | | }) |
| | | |
| | | this.dialogShowGoal = false |
| | | }, |
| | | //èµ·å§ä½ç½®å表 |
| | | place() { |
| | | this.stateType = [{}] |
| | | this.dialogType = true |
| | | |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.pn, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | } |
| | | let data = this.list.filter(function(s) { |
| | | return s.place && s.place.trim(); |
| | | }) |
| | | data.forEach((item, index) => { |
| | | this.stateType.push({ |
| | | value: JSON.stringify(index + 1), |
| | | label: item.place |
| | | }) |
| | | }) |
| | | }) |
| | | |
| | | }, |
| | | //èµ·å§ä½ç½®åæ¾ |
| | | stateLable(e) { |
| | | this.type = e[0].label |
| | | |
| | | let params = { |
| | | page: '1', |
| | | place: this.type, |
| | | onePageNum: 20 |
| | | } |
| | | PlaceVsContainer(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.list = res.data |
| | | this.pnOpen = this.list.filter(function(s) { |
| | | return s.itemName && s.itemName.trim(); |
| | | }) |
| | | this.destination.containerName = this.list[0].containerName |
| | | this.pn = '' |
| | | this.open = true |
| | | } |
| | | }) |
| | | |
| | | }, |
| | | //ç®æ ä½ç½®åæ¾ |
| | | target(e) { |
| | | this.stateText = e[0].label |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | page { |
| | | background-color: #f5f5f9; |
| | | } |
| | | |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 5px; |
| | | } |
| | | |
| | | .title { |
| | | display: flex; |
| | | height: 2.2rem; |
| | | font-size: 1rem; |
| | | align-items: center; |
| | | justify-content: center; |
| | | /* padding-right: 9px; */ |
| | | } |
| | | |
| | | .fix { |
| | | position: fixed; |
| | | bottom: 0; |
| | | width: 100%; |
| | | height: 100px; |
| | | padding: 0 3px; |
| | | |
| | | >.u-btn { |
| | | margin: 5px 0; |
| | | } |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | background-color: #fff; |
| | | margin: 10px 0; |
| | | } |
| | | |
| | | .line2 { |
| | | line-height: 2.3rem; |
| | | padding: 8px 10px 8px 3rem; |
| | | font-size: 0.93rem; |
| | | } |
| | | |
| | | .line3 { |
| | | line-height: 1.8rem; |
| | | padding: 8px 3px; |
| | | font-size: 0.93rem; |
| | | border-bottom: 1px solid #eaeaea; |
| | | text-align: center; |
| | | } |
| | | |
| | | .pl2 { |
| | | padding-left: 2rem !important; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 10px; |
| | | } |
| | | |
| | | .tr { |
| | | text-align: right; |
| | | } |
| | | |
| | | .btn { |
| | | font-size: 0.8rem; |
| | | position: absolute !important; |
| | | right: 10px; |
| | | height: 30px !important; |
| | | } |
| | | |
| | | .center { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | } |
| | | |
| | | .space-between { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <!-- <u-navbar back-text="" title="åºåº"></u-navbar> --> |
| | | <view style="background-color: #f5f5f9;padding: 5px 0 10px;position: fixed;width: 100%;"> |
| | | <view class="card"> |
| | | <view class="time"> |
| | | {{$moment(dotime).format('YYYY-MM-DD hh:mm:ss')}} |
| | | </view> |
| | | <u-steps :list="numList" :current="current"></u-steps> |
| | | </view> |
| | | </view> |
| | | <view class="details"> |
| | | <view class="line"> |
| | | <text class="col7">åºåºè®¡ååå·:</text> |
| | | <text class="ml10">{{code}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">å建æ¶é´:</text> |
| | | <text class="ml10">{{$moment(updateTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºå£:</text> |
| | | <text class="ml10">{{shipping}}</text> |
| | | </view> |
| | | <view class="line2"> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶å·:</text> |
| | | <text class="ml10">{{pn}}</text> |
| | | </view> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶åç§°:</text> |
| | | <text class="ml10">{{partName}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">ç®çå°:</text> |
| | | <text class="ml10">{{bourn}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºç±»å:</text> |
| | | <text class="ml10">{{orderType}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºæ°é:</text> |
| | | <text class="ml10">{{checkOutNum}}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | code: '', //ä»»å¡åå· |
| | | shipping: '', //åºè´§å£ |
| | | pn: '', //é¶ä»¶ç¼å· |
| | | partName: '', //é¶ä»¶åç§° |
| | | bourn: '', //ç®çå° |
| | | checkOutNum: '', //åºåºæ°é |
| | | orderType: '', //åºåºç±»å |
| | | orderStatus: '', //ä»»å¡ç¶æ |
| | | updateTime: '', //宿æ¶é´ |
| | | maxNum: '', //è£
ç®±æ°é |
| | | type: '', |
| | | dotime: '', |
| | | current: '', //æ¥éª¤æ¡è¿åº¦ |
| | | numList: [{ //æ¥éª¤æ¡ |
| | | name: 'å¼å§åºåº' |
| | | }, { |
| | | name: 'åºåºä¸' |
| | | }, { |
| | | name: '宿' |
| | | }] |
| | | } |
| | | }, |
| | | onBackPress(options) { |
| | | if (options.from == 'navigateBack') { |
| | | uni.navigateTo({ |
| | | url: './plan' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.navigateTo({ |
| | | url: './plan' |
| | | }); |
| | | } |
| | | return true |
| | | }, |
| | | onLoad(options) { |
| | | let val = JSON.parse(decodeURIComponent(options.val)) |
| | | this.code = val.outOrderCode |
| | | this.type = val.orderStatus |
| | | this.dotime = val.doTime |
| | | this.pn = val.itemName |
| | | this.shipping = val.tranLine |
| | | this.orderStatus = val.orderStatus |
| | | this.partName = val.itemDes |
| | | this.orderType = val.orderType |
| | | this.checkOutNum = val.checkOutNum |
| | | this.updateTime = val.updateTime |
| | | this.bourn=val.productionLineName |
| | | if (this.type == "æ°å»º") { |
| | | this.current = 1 |
| | | } else { |
| | | this.current = 2 |
| | | } |
| | | }, |
| | | //䏿巿° |
| | | onPullDownRefresh() { |
| | | setTimeout(function() { |
| | | uni.stopPullDownRefresh() |
| | | }, 1000) |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .card { |
| | | width: 95%; |
| | | height: 140px; |
| | | border-radius: 10px; |
| | | margin: auto; |
| | | border: 1px solid #cececf; |
| | | background-color: #fff; |
| | | |
| | | .time { |
| | | margin: 10px 35px; |
| | | color: #aeacb7; |
| | | } |
| | | |
| | | /deep/.u-steps { |
| | | margin: 37px 0; |
| | | } |
| | | } |
| | | |
| | | .details { |
| | | background-color: #fff; |
| | | border: 1px solid #cececf; |
| | | border-bottom: none; |
| | | border-radius: 15px; |
| | | margin-top: 155px; |
| | | height: calc(100% - 140px); |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .line2 { |
| | | border-bottom: 1px solid #eaeaea; |
| | | font-size: 1rem; |
| | | line-height: 1.9rem; |
| | | padding: 10px 10px 10px 3rem; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <!-- <u-navbar back-text="" title="详æ
" :custom-back="back"></u-navbar> --> |
| | | <view class="line"> |
| | | <text class="col7">åºåºä»»å¡åå·:</text> |
| | | <text class="ml10">{{code}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">å建æ¶é´:</text> |
| | | <text class="ml10">{{$moment(doTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºå£:</text> |
| | | <text class="ml10">{{shipping}}</text> |
| | | </view> |
| | | <view class="line2"> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶å·:</text> |
| | | <text class="ml10">{{pn}}</text> |
| | | </view> |
| | | <view class=""> |
| | | <text class="col7">é¶ä»¶åç§°:</text> |
| | | <text class="ml10">{{partName}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">ç®çå°:</text> |
| | | <text class="ml10">{{bourn}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºç±»å:</text> |
| | | <text class="ml10">{{orderType}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">åºåºæ°é:</text> |
| | | <text class="ml10">{{checkOutNum}}</text> |
| | | </view> |
| | | <!-- <view class="line"> |
| | | <text class="col7">æ»éæ±æ°é:</text> |
| | | <text class="ml10">{{totalOutNum}}</text> |
| | | </view> --> |
| | | <view class="line"> |
| | | <text class="col7">ä»»å¡ç¶æ:</text> |
| | | <text class="ml10">{{orderStatus}}</text> |
| | | </view> |
| | | <view class="line"> |
| | | <text class="col7">宿æ¶é´:</text> |
| | | <text class="ml10">{{$moment(updateTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | <!-- <view class="line"> |
| | | <text class="col7">å车工人:</text> |
| | | <text class="ml10">{{applianceType}}</text> |
| | | </view> --> |
| | | <view class="fix"> |
| | | <button class="btn" @click="putOut">åºåº</button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | out, |
| | | add, |
| | | CheckOutOrder |
| | | } from '../../../api/putOut.js' |
| | | import { |
| | | part |
| | | } from '../../../api/putIn.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | code: '', //ä»»å¡åå· |
| | | shipping: '', //åºè´§å£ |
| | | pn: '', //é¶ä»¶ç¼å· |
| | | partName: '', //é¶ä»¶åç§° |
| | | bourn: '', //ç®çå° |
| | | checkOutNum: '', //åºåºæ°é |
| | | orderType: '', //åºåºç±»å |
| | | orderStatus: '', //ä»»å¡ç¶æ |
| | | updateTime: '', //宿æ¶é´ |
| | | maxNum: '', //è£
ç®±æ°é |
| | | erpOrderId: '', //ERPå· |
| | | doTime: '', //å建æ¶é´ |
| | | totalOutNum: '', |
| | | id: '', |
| | | list: [{ |
| | | num: 51, |
| | | ship: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | ship: '3å·å£' |
| | | }, { |
| | | num: 67, |
| | | ship: '4å·å£' |
| | | }, { |
| | | num: 34, |
| | | ship: '5å·å£' |
| | | }, { |
| | | num: 30, |
| | | ship: '6å·å£' |
| | | }, { |
| | | num: 19, |
| | | ship: '7å·å£' |
| | | }, { |
| | | num: 12, |
| | | ship: '8å·å£' |
| | | }, { |
| | | num: 997, |
| | | ship: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | ship: 'çè£
åºå£' |
| | | }] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.out() |
| | | }, |
| | | // onBackPress(e) { |
| | | // // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | // uni.navigateTo({ |
| | | // url: './plan' |
| | | // }); |
| | | // // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | // return true |
| | | // }, |
| | | onLoad(options) { |
| | | let val = JSON.parse(decodeURIComponent(options.val)) |
| | | this.code = val.outOrderCode |
| | | this.dotime = val.doTime |
| | | this.pn = val.ItemName |
| | | this.shipping = val.tranLine |
| | | this.bourn = val.productionLineName |
| | | this.orderStatus = val.orderStatus |
| | | this.partName = val.itemDes |
| | | this.orderType = val.orderType |
| | | this.checkOutNum = val.checkOutNum |
| | | this.updateTime = val.updateTime |
| | | this.totalOutNum = val.totalOutNum |
| | | this.id = val.id |
| | | }, |
| | | methods: { |
| | | //fanhu |
| | | back() { |
| | | uni.navigateTo({ |
| | | url: './plan' |
| | | }) |
| | | }, |
| | | out() { |
| | | let params = { |
| | | page: '1', |
| | | onePageNum: 40 |
| | | } |
| | | out(params).then((res) => { |
| | | res.data.forEach(item => { |
| | | if (this.code === item.outOrderCode) { |
| | | this.list.forEach(i => { |
| | | if (item.tranLine == i.num) { |
| | | this.shipping = i.ship |
| | | } |
| | | }) |
| | | this.pn = item.itemName |
| | | this.partName = item.itemDes |
| | | this.bourn = item.productionLineName |
| | | this.orderType = item.orderType |
| | | this.checkOutNum = item.checkOutNum |
| | | this.orderStatus = item.orderStatus |
| | | this.updateTime = item.updateTime |
| | | this.erpOrderId = item.erpOrderId |
| | | this.doTime = item.doTime |
| | | this.num() |
| | | } |
| | | |
| | | }) |
| | | }) |
| | | }, |
| | | num() { |
| | | let params = { |
| | | page: '1', |
| | | itemName: this.pn, |
| | | onePageNum: 999 |
| | | } |
| | | part(params).then((res) => { |
| | | this.maxNum = res.data[0].maxNum |
| | | }) |
| | | }, |
| | | //åºåºé¡µé¢ |
| | | putOut() { |
| | | let params = { |
| | | page: '1', |
| | | id: this.id, |
| | | } |
| | | CheckOutOrder(params).then((res) => { |
| | | uni.navigateTo({ |
| | | url: `./plan` |
| | | }); |
| | | }) |
| | | |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .line2 { |
| | | border-bottom: 1px solid #eaeaea; |
| | | font-size: 1rem; |
| | | line-height: 1.9rem; |
| | | padding: 10px 10px 10px 3rem; |
| | | } |
| | | |
| | | .fix { |
| | | position: fixed; |
| | | bottom: 10px; |
| | | width: 100%; |
| | | heigh: 45px; |
| | | |
| | | .btn { |
| | | background-color: #1aac19; |
| | | color: #fff; |
| | | margin: 0 8px; |
| | | } |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 20px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- <u-navbar back-text="" title="计ååºåº" :custom-back="back"></u-navbar> --> |
| | | <view class="search"> |
| | | <u-search placeholder="æç´¢ä»»å¡åå·" v-model="keyword" @search="list" input-align="center" bg-color="#fff" |
| | | shape="square" :show-action="false"></u-search> |
| | | </view> |
| | | <u-dropdown> |
| | | <u-dropdown-item v-model="value1" title="åºåºç±»å" :options="options1" @change="changeType"></u-dropdown-item> |
| | | <u-dropdown-item v-model="value2" title="ä»»å¡ç¶æ" :options="options2" @change="changeState"></u-dropdown-item> |
| | | </u-dropdown> |
| | | <view class="con"> |
| | | <u-card v-for="item in out" :key="item.id" class="card" @click="details(item,$event)" v-show="none"> |
| | | <view slot="head" class="title"> |
| | | <text class="col777">åºåºä»»å¡åå·:</text> |
| | | <text class="ml5">{{item.outOrderCode}}</text> |
| | | <view class="add ml5"> |
| | | <text>{{item.orderStatus}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" slot="body" style="display: flex;justify-content: space-between;" class="body"> |
| | | |
| | | <view class="" style="width: 50%;padding-left: 25px;"> |
| | | <view> |
| | | <text class="col777">é¶ä»¶åç§°:</text> |
| | | <text class="ml5">{{item.itemDes}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">ç®çå°:</text> |
| | | <text class="ml5">{{item.productionLineName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">åºåºæ°é:</text> |
| | | <text class="ml5">{{item.checkOutNum}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" style="width: 50%;"> |
| | | <view> |
| | | <text class="col777">é¶ä»¶ç¼å·:</text> |
| | | <text class="ml5">{{item.ItemName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">åºåºç±»å:</text> |
| | | <text class="ml5">{{item.orderType}}</text> |
| | | </view> |
| | | <!-- <view> |
| | | <text class="col777">åè½¦å¸æº:</text> |
| | | <text class="ml5">{{item.inType}}</text> |
| | | </view> --> |
| | | <view> |
| | | <text class="col777">åºåºå£:</text> |
| | | <text class="ml5">{{item.tranLine}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">å建æ¶é´:</text> |
| | | <text class="ml5">{{$moment(item.updateTime).format('YYYY-MM-DD hh:mm:ss')}}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | </view> |
| | | </u-card> |
| | | <u-loadmore :status="status" /> |
| | | </view> |
| | | <u-back-top :scroll-top="scrollTop"></u-back-top> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | out |
| | | } from '../../../api/putOut.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | status: 'loadmore', |
| | | scrollTop: 0, |
| | | page: 1, |
| | | onePageNum: 10, |
| | | keyword: '', // ä»»å¡åå· |
| | | out: [], //åºåºå表 |
| | | none: true, |
| | | value1: 1, |
| | | value2: 2, |
| | | orderType: '', |
| | | orderStatus: '', |
| | | options1: [{ |
| | | label: 'å
¨é¨', |
| | | value: '1' |
| | | }, { |
| | | label: 'çè£
åºåº', |
| | | value: '2' |
| | | }, |
| | | { |
| | | label: '空å¨å
·åºåº', |
| | | value: '3' |
| | | }, |
| | | { |
| | | label: 'è°ä»¶åºåº', |
| | | value: '4' |
| | | }, |
| | | { |
| | | label: 'è¿ä¿®åºåº', |
| | | value: '5' |
| | | }, |
| | | { |
| | | label: '忣åºåº', |
| | | value: '6' |
| | | } |
| | | ], |
| | | options2: [{ |
| | | label: 'å
¨é¨', |
| | | value: 1, |
| | | }, { |
| | | label: 'æ°å»º', |
| | | value: 2, |
| | | }, |
| | | { |
| | | label: 'æ§è¡ä¸', |
| | | value: 3, |
| | | }, |
| | | { |
| | | label: '宿', |
| | | value: 4, |
| | | } |
| | | ], |
| | | listnum: [{ |
| | | num: 51, |
| | | ship: '2å·å£' |
| | | }, { |
| | | num: 64, |
| | | ship: '3å·å£' |
| | | }, { |
| | | num: 67, |
| | | ship: '4å·å£' |
| | | }, { |
| | | num: 34, |
| | | ship: '5å·å£' |
| | | }, { |
| | | num: 30, |
| | | ship: '6å·å£' |
| | | }, { |
| | | num: 19, |
| | | ship: '7å·å£' |
| | | }, { |
| | | num: 12, |
| | | ship: '8å·å£' |
| | | }, { |
| | | num: 997, |
| | | ship: 'å²ååºå£' |
| | | }, { |
| | | num: 999, |
| | | ship: 'çè£
åºå£' |
| | | }] |
| | | } |
| | | }, |
| | | //䏿å è½½ |
| | | onReachBottom() { |
| | | let _self = this |
| | | this.status = 'loading' |
| | | // uni.showNavigationBarLoading() |
| | | setTimeout(function() { |
| | | _self.page++; |
| | | // _self.status = 'more' |
| | | _self.list(); |
| | | // uni.hideNavigationBarLoading() |
| | | }, 2000); |
| | | |
| | | }, |
| | | onPageScroll(e) { |
| | | this.scrollTop = e.scrollTop; |
| | | }, |
| | | mounted() { |
| | | this.list() |
| | | }, |
| | | onBackPress(options) { |
| | | // è¿éå¯ä»¥èªå®ä¹è¿åé»è¾ï¼æ¯å¦ä¸é¢è·³è½¬å
¶ä»é¡µé¢ |
| | | if (options.from == 'navigateBack') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | // return true è¡¨ç¤ºç¦æ¢é»è®¤è¿å |
| | | return true |
| | | }, |
| | | //䏿巿° |
| | | onPullDownRefresh() { |
| | | this.orderType = '' |
| | | this.orderStatus = '' |
| | | this.keyword = '' |
| | | this.value1 = 1 |
| | | this.value2 = 1 |
| | | this.list() |
| | | setTimeout(function() { |
| | | uni.stopPullDownRefresh() |
| | | }, 1000) |
| | | }, |
| | | methods: { |
| | | // åºåºè®¡å |
| | | list() { |
| | | let _self = this |
| | | let params = { |
| | | orderType: _self.orderType, |
| | | page: _self.page, |
| | | onePageNum: _self.onePageNum, |
| | | orderStatus: _self.orderStatus, |
| | | outOrderCode: _self.keyword, |
| | | isErp: 1 |
| | | } |
| | | _self.out = [] |
| | | out(params).then((res) => { |
| | | if (_self.page != 1) { |
| | | if (res.result == '') { |
| | | _self.status = 'more' |
| | | return |
| | | } |
| | | _self.out = _self.out.concat(res.data) |
| | | } else { |
| | | _self.out = res.data |
| | | } |
| | | res.data.forEach(item => { |
| | | if (item.orderStatus == "æ§è¡ä¸") { |
| | | _self.none = false |
| | | } |
| | | if (!item.erpOrderId) { |
| | | _self.out = res.data || [] |
| | | this.listnum.forEach(i => { |
| | | if (item.tranLine == i.num) { |
| | | item.tranLine = i.ship |
| | | } |
| | | }) |
| | | } |
| | | |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | //åºè´§è®¡å详æ
|
| | | details(val, event) { |
| | | if (val.orderStatus === "æ°å»º") { |
| | | uni.navigateTo({ |
| | | url: './details?val=' + encodeURIComponent(JSON.stringify(val)) |
| | | }); |
| | | } else if (val.orderStatus === "åæ¶") { |
| | | |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: './delivery?val=' + encodeURIComponent(JSON.stringify(val)) |
| | | }); |
| | | } |
| | | |
| | | }, |
| | | back() { |
| | | uni.navigateTo({ |
| | | url: './jimo' |
| | | }); |
| | | }, |
| | | changeType(val) { |
| | | this.options1.forEach(i => { |
| | | if (val == '1') { |
| | | this.orderType = "" |
| | | } else if (val == i.value) { |
| | | this.orderType = i.label |
| | | } |
| | | }) |
| | | this.list() |
| | | }, |
| | | changeState(val) { |
| | | this.options2.forEach(i => { |
| | | if (val == '1') { |
| | | this.orderStatus = "" |
| | | } else if (val == i.value) { |
| | | this.orderStatus = i.label |
| | | } |
| | | }) |
| | | this.list() |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .search { |
| | | background-color: #f2f2f2; |
| | | padding: 6px 8px; |
| | | } |
| | | |
| | | .col777 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml5 { |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .con { |
| | | margin-bottom: 45px; |
| | | } |
| | | |
| | | .card { |
| | | .title { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 1rem; |
| | | |
| | | .add { |
| | | background-color: #cbfe8f; |
| | | width: 3.8rem; |
| | | border-radius: 5px; |
| | | font-size: 0.8rem; |
| | | padding: 0.3rem 0.4rem; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .body { |
| | | font-size: 0.9rem; |
| | | color: #000; |
| | | line-height: 2rem; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class=""> |
| | | <!-- <u-navbar back-text="" title="æçä»»å¡-æ¬è¿"></u-navbar> --> |
| | | <view> |
| | | <view class="card" style="margin-top: 10px;"> |
| | | <view class="time" style="padding-top: 20rpx;"> |
| | | |
| | | </view> |
| | | <u-steps :list="numList" :current="current"></u-steps> |
| | | </view> |
| | | </view> |
| | | <view class="details"> |
| | | <scroll-view scroll-y="true" style="height: 100%;max-height: 760rpx;"> |
| | | <view class="" style="padding-left: 25px;"> |
| | | <text class="col7">å车任å¡åå·:</text> |
| | | <text class="ml10 blod">{{code}}</text> |
| | | </view> |
| | | <view class="" style="padding-left: 25px;"> |
| | | <text class="col7">åºåºè®¡ååå·:</text> |
| | | <text class="ml10 blod">{{planCode}}</text> |
| | | </view> |
| | | <view class="" style="padding-left: 25px;"> |
| | | <view class=""> |
| | | <view class=""> |
| | | <text class="col7">å建æ¶é´:</text> |
| | | <text class="ml10">{{$moment(updateTime).format('YYYY-MM-DD HH:mm:ss')}}</text> |
| | | </view> |
| | | |
| | | <!-- <view class=""> |
| | | <text class="col7">åºåºæ°é:</text> |
| | | <text class="ml10">{{checkOutNum}}</text> |
| | | </view> --> |
| | | <view class=""> |
| | | <text class="col7">å¨å
·ç¼å·:</text> |
| | | <text class="ml10">{{pn}}</text> |
| | | </view> |
| | | </view> |
| | | <view class=""> |
| | | <view class=""> |
| | | <text class="col7">åè´§å°:</text> |
| | | <text class="ml10">{{bourn}}</text> |
| | | </view> |
| | | <view class=""> |
| | | <text class="col7">åºåºå£:</text> |
| | | <text class="ml10">{{shipping}}</text> |
| | | </view> |
| | | <!-- <view class=""> |
| | | <text class="col7">é¶ä»¶æ°é:</text> |
| | | <text class="ml10">{{pn}}</text> |
| | | </view> --> |
| | | <!-- <view class=""> |
| | | <text class="col7">åºåºç±»å:</text> |
| | | <text class="ml10">{{orderType}}</text> |
| | | </view> |
| | | --> |
| | | </view> |
| | | </view> |
| | | <!-- <u-divider color="#108ee9" half-width="200" border-color="#d4d4d4">ç©æè¯¦æ
</u-divider> |
| | | <u-table border-color="#fff" bg-color="#fff"> |
| | | <u-tr> |
| | | <u-th>åºå·</u-th> |
| | | <u-th>é¶ä»¶åç§°</u-th> |
| | | <u-th>é¶ä»¶ç¼å·</u-th> |
| | | <u-th>æ°é</u-th> |
| | | <u-th>éé</u-th> |
| | | </u-tr> |
| | | <u-tr v-for="(item,index) in partList" :key="index"> |
| | | <u-td>{{index+1}}</u-td> |
| | | <u-td>{{item.itemDes}}</u-td> |
| | | <u-td>{{item.itemName}}</u-td> |
| | | <u-td>{{item.itemNum}}</u-td> |
| | | <u-td>{{item.itemWeight}}</u-td> |
| | | </u-tr> |
| | | </u-table> --> |
| | | </scroll-view> |
| | | </view> |
| | | <view class="btn"> |
| | | <u-button type="success" @click="status(1)">å¼å§</u-button> |
| | | <u-button type="primary" @click="status(2)">宿</u-button> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | set |
| | | } from '../../../api/putIn.js' |
| | | import { |
| | | get, |
| | | CarTask, |
| | | task |
| | | } from '../../../api/task.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | code: '', //ä»»å¡åå· |
| | | shipping: '', //åºè´§å£ |
| | | pn: '', //é¶ä»¶ç¼å· |
| | | partName: '', //é¶ä»¶åç§° |
| | | bourn: '', //ç®çå° |
| | | carName: '', //å车å |
| | | containerName: '', //å¨å
·ç¼å· |
| | | checkOutNum: '', //åºåºæ°é |
| | | orderType: '', //åºåºç±»å |
| | | orderStatus: '', //ä»»å¡ç¶æ |
| | | updateTime: '', //宿æ¶é´ |
| | | maxNum: '', //è£
ç®±æ°é |
| | | planCode: '', //计ååå· |
| | | current: 0, //æ¬è¿è¿åº¦æ¡ |
| | | numList: [{ //æ¥éª¤æ¡æ°æ® |
| | | name: 'å¼å§æ¬è¿' |
| | | }, { |
| | | name: 'æ¬è¿ä¸' |
| | | }, { |
| | | name: '宿' |
| | | }], |
| | | partList: [] |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | let val = JSON.parse(decodeURIComponent(options.val)) |
| | | this.code = val.carTaskName |
| | | if (val.taskStatus == "宿") { |
| | | this.current = 2 |
| | | } else if (val.taskStatus == "æ¬è¿ä¸") { |
| | | this.current = 1 |
| | | } else { |
| | | this.current = 0 |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.CarTask() |
| | | this.task() |
| | | }, |
| | | onBackPress(options) { |
| | | if (options.from == 'navigateBack') { |
| | | uni.navigateTo({ |
| | | url: './task' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.navigateTo({ |
| | | url: './task' |
| | | }); |
| | | } |
| | | return true |
| | | }, |
| | | methods: { |
| | | //计ååå· |
| | | task() { |
| | | let params = { |
| | | page: '1', |
| | | carTaskName: this.code, |
| | | onePageNum: 40 |
| | | } |
| | | task(params).then((res) => { |
| | | res.data.forEach(item => { |
| | | this.code = item.carTaskName |
| | | this.planCode = item.outOrderCode |
| | | this.updateTime = item.updateTime |
| | | this.pn = item.containerName |
| | | this.bourn = item.fromDestination |
| | | this.shipping = item.toDestination |
| | | }) |
| | | this.num() |
| | | }) |
| | | }, |
| | | //ç©æè¯¦æ
|
| | | num() { |
| | | let params = { |
| | | page: '1', |
| | | containerName: this.pn, |
| | | onePageNum: 40 |
| | | } |
| | | set(params).then((res) => { |
| | | this.partList = res.data |
| | | }) |
| | | }, |
| | | //å车å |
| | | CarTask() { |
| | | let params = { |
| | | page: '1', |
| | | userName: uni.getStorageSync("admin"), |
| | | onePageNum: 40 |
| | | } |
| | | CarTask(params).then((res) => { |
| | | this.carName = res.data[0].carName |
| | | }) |
| | | }, |
| | | //å¼å§ç»æé¢ä»»å¡ |
| | | status(val) { |
| | | if (val === 1) { |
| | | let params = { |
| | | taskStatus: 'æ¬è¿ä¸', |
| | | carTaskName: this.code, |
| | | getUserName: uni.getStorageSync('admin') |
| | | } |
| | | get(params).then((res) => { |
| | | this.current = 1 |
| | | }) |
| | | } else if (val === 2) { |
| | | let params = { |
| | | taskStatus: '宿', |
| | | carTaskName: this.code, |
| | | getUserName: uni.getStorageSync('admin') |
| | | } |
| | | get(params).then((res) => { |
| | | this.current = 2 |
| | | setTimeout(function() { |
| | | uni.navigateTo({ |
| | | url: './task' |
| | | }); |
| | | }, 1000) |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | page { |
| | | background-color: #f5f5f9; |
| | | } |
| | | |
| | | .space-between { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | padding: 0 5px; |
| | | } |
| | | |
| | | .card { |
| | | width: 95%; |
| | | height: 140px; |
| | | border-radius: 10px; |
| | | margin: auto; |
| | | border: 1px solid #cececf; |
| | | background-color: #fff; |
| | | |
| | | .time { |
| | | margin: 10px 35px; |
| | | color: #aeacb7; |
| | | } |
| | | |
| | | /deep/.u-steps { |
| | | margin: 37px 0; |
| | | } |
| | | } |
| | | |
| | | .details { |
| | | background-color: #fff; |
| | | border: 1px solid #cececf; |
| | | border-radius: 15px; |
| | | line-height: 1.8rem; |
| | | font-size: 1rem; |
| | | margin: 10px 10px 55px; |
| | | padding: 15px 10px; |
| | | } |
| | | |
| | | .col7 { |
| | | color: #777; |
| | | } |
| | | |
| | | .ml10 { |
| | | margin-left: 20px; |
| | | } |
| | | |
| | | .blod { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | /deep/.u-th { |
| | | background-color: #fff; |
| | | font-weight: normal; |
| | | color: #777; |
| | | } |
| | | |
| | | /deep/.u-td { |
| | | width: 20%; |
| | | text-align: center; |
| | | overflow: hidden; |
| | | word-break: normal; |
| | | word-break: break-all; |
| | | } |
| | | |
| | | .btn { |
| | | display: flex; |
| | | position: fixed; |
| | | bottom: 5px; |
| | | width: 100%; |
| | | height: 40px; |
| | | |
| | | /deep/.u-btn { |
| | | width: 50%; |
| | | margin: 0 5px; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- <u-navbar back-text="" title="æçä»»å¡-æ¬è¿"></u-navbar> --> |
| | | <view class="con"> |
| | | <u-card v-for="(item,index) in tasklist" :key="index" class="card" @click="details(item,$event)"> |
| | | <view slot="head" class="title"> |
| | | <view class=""> |
| | | <text class="col777">å车工任å¡å·:</text> |
| | | <text class="ml5">{{item.carTaskName}}</text> |
| | | <text style="position: absolute;right: 15px;color: #50aaea;">详æ
</text> |
| | | </view> |
| | | </view> |
| | | <view slot="body" class="body"> |
| | | <view style="display: flex;justify-content: space-between;"> |
| | | <view class="" style="width: 50%;padding-left: 15px;"> |
| | | <view> |
| | | <text class="col777">å建人:</text> |
| | | <text class="ml5">{{item.userName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">å建æ¶é´:</text> |
| | | <text class="ml5">{{$moment(item.updateTime).format('YYYY-MM-DD HH:mm:ss')}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">åºåºå£:</text> |
| | | <text class="ml5">{{item.fromDestination}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="" style="width: 50%;"> |
| | | <view> |
| | | <text class="col777">å¨å
·ç¼å·:</text> |
| | | <text class="ml5">{{item.containerName}}</text> |
| | | </view> |
| | | <view> |
| | | <text class="col777">ç®çå°:</text> |
| | | <text class="ml5">{{item.toDestination}}</text> |
| | | </view> |
| | | <view style="display: flex;align-items: center;"> |
| | | <text class="col777">订åç¶æ:</text> |
| | | <view class="ml5 add">{{item.taskStatus}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view style="padding-left: 15px;width: 100%;word-wrap: break-word;"> |
| | | <view class="col777">é¶ä»¶ä¿¡æ¯:</view> |
| | | <text class="" style="">{{item.itemDetail}}</text> |
| | | </view> |
| | | </view> |
| | | </u-card> |
| | | <u-loadmore :status="status" v-if="tasklist.length>0" /> |
| | | <u-empty text="ææ æ°æ®" mode="list" v-if='tasklist.length==0' style='margin-top: 150rpx;'></u-empty> |
| | | </view> |
| | | <u-back-top :scroll-top="scrollTop"></u-back-top> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | task, |
| | | SearchNum |
| | | } from '../../../api/task.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | status: 'loadmore', |
| | | scrollTop: 0, |
| | | page: 1, |
| | | onePageNum: 10, |
| | | tasklist: [], //ä»»å¡å表 |
| | | value1: 1, |
| | | value2: 2, |
| | | taskStatus: '', |
| | | result: [], |
| | | count: '' |
| | | } |
| | | }, |
| | | //䏿å è½½ |
| | | onReachBottom() { |
| | | let _self = this |
| | | _self.status = 'loading' |
| | | _self.page++; |
| | | _self.list(); |
| | | }, |
| | | onBackPress(options) { |
| | | if (options.from == 'navigateBack') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | if (options.from == 'backbutton') { |
| | | uni.switchTab({ |
| | | url: '../../Home/index' |
| | | }); |
| | | } |
| | | return true |
| | | }, |
| | | onPageScroll(e) { |
| | | this.scrollTop = e.scrollTop; |
| | | }, |
| | | mounted() { |
| | | this.result = [] |
| | | this.SearchNum() |
| | | this.list() |
| | | }, |
| | | //䏿巿° |
| | | onPullDownRefresh() { |
| | | this.list() |
| | | setTimeout(function() { |
| | | uni.stopPullDownRefresh() |
| | | }, 1000) |
| | | }, |
| | | methods: { |
| | | // åºåºè®¡å |
| | | list() { |
| | | let pageflag = false |
| | | let params = { |
| | | page: this.page, |
| | | onePageNum: this.onePageNum, |
| | | userName: uni.getStorageSync('admin'), |
| | | taskStatusNot: '宿', |
| | | // taskStatus:'æ°å»º' |
| | | } |
| | | task(params).then((res) => { |
| | | if (res.code == 0) { |
| | | if (this.page !== 1) { |
| | | if (this.count == this.tasklist.length) { |
| | | this.status = 'more' |
| | | return |
| | | } |
| | | this.tasklist = this.tasklist.concat(res.data) |
| | | } else { |
| | | this.tasklist = res.data |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // è§æ æ°é |
| | | SearchNum() { |
| | | let params = { |
| | | userName: uni.getStorageSync("admin"), |
| | | taskStatusNot: '宿' |
| | | } |
| | | SearchNum(params).then((res) => { |
| | | if (res.code == 0) { |
| | | this.count = res |
| | | } |
| | | }) |
| | | }, |
| | | //åºè´§è®¡å详æ
|
| | | details(val, event) { |
| | | uni.navigateTo({ |
| | | url: './details?val=' + encodeURIComponent(JSON.stringify(val)) |
| | | }); |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | page { |
| | | background-color: #f5f5f9; |
| | | } |
| | | |
| | | .col777 { |
| | | color: #777; |
| | | } |
| | | |
| | | .add { |
| | | background-color: #00ff33; |
| | | width: 3.5rem; |
| | | height: 1.6rem; |
| | | line-height: 1.6rem; |
| | | text-align: center; |
| | | border-radius: 15px; |
| | | } |
| | | |
| | | .ml5 { |
| | | margin-left: 5px; |
| | | } |
| | | |
| | | .con { |
| | | margin-bottom: 45px; |
| | | } |
| | | |
| | | .card { |
| | | .title { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 1rem; |
| | | |
| | | .add { |
| | | background-color: #cbfe8f; |
| | | width: 3.8rem; |
| | | border-radius: 5px; |
| | | font-size: 0.8rem; |
| | | padding: 0.3rem 0.4rem; |
| | | text-align: center; |
| | | } |
| | | } |
| | | |
| | | .body { |
| | | font-size: 0.9rem; |
| | | color: #000; |
| | | line-height: 2rem; |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <!-- è¡¥ææ ç¾ --> |
| | | <u-navbar title="è¡¥ææ ç¾"></u-navbar> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | <view class="line"> |
| | | <text>ç¨æ·åï¼</text> |
| | | <text>{{admin}}</text> |
| | | </view> |
| | | <u-button type="success" @click="quit">éåºç»å½</u-button> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | admin: '' |
| | | }; |
| | | }, |
| | | onShow() { |
| | | this.admin = uni.getStorageSync('admin'); |
| | | }, |
| | | methods: { |
| | | back() { |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }) |
| | | }, |
| | | quit() { |
| | | uni.clearStorageSync() |
| | | uni.navigateTo({ |
| | | url: '../Login/index' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | page { |
| | | padding-bottom: 50px; |
| | | height: 100%; |
| | | } |
| | | |
| | | .line { |
| | | height: 50px; |
| | | border-bottom: 1px solid #eaeaea; |
| | | padding-left: 3rem; |
| | | font-size: 1rem; |
| | | padding-right: 10px; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .btn { |
| | | position: fixed; |
| | | bottom: 0px; |
| | | width: 100%; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view> |
| | | {{data}} |
| | | <div> |
| | | {{wgtVer}} |
| | | </div> |
| | | <div> |
| | | {{version}} |
| | | </div> |
| | | <div>{{isandroid}}</div> |
| | | <div>{{success}}</div> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | wgtVer:'', |
| | | version:'', |
| | | data:null, |
| | | isandroid:'', |
| | | success:'' |
| | | } |
| | | }, |
| | | onLoad() { |
| | | this.plusReady(); |
| | | this.isandroid1(); |
| | | }, |
| | | methods: { |
| | | // è·åå½åçæ¬å· |
| | | plusReady() { |
| | | var that = this; |
| | | // è·åæ¬å°åºç¨èµæºçæ¬å·  |
| | | plus.runtime.getProperty(plus.runtime.appid, function(inf) { |
| | | that.data = inf |
| | | console.log(inf,'inf') |
| | | that.wgtVer = inf.version; //è·åå½åçæ¬å· |
| | | that.version = plus.runtime.version; |
| | | |
| | | }); |
| | | |
| | | }, |
| | | // æ£æ¥æ¯å¦å®å |
| | | isandroid1() { |
| | | var that1 = this; |
| | | uni.getSystemInfo({ |
| | | success: res => { |
| | | console.log(res) |
| | | that1.isandroid=res |
| | | if (res.platform == "android") { |
| | | that1.AndroidCheckUpdate(); |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // èªå¨æ´æ° |
| | | AndroidCheckUpdate() { |
| | | var that2 = this; |
| | | that2.success=22 |
| | | uni.request({ |
| | | url: helper.webUrl + 'index.php/App/getAndroidVersion', //è·åææ°çæ¬å· |
| | | method: 'GET', |
| | | data: {}, |
| | | success: res => { |
| | | if (res.data.version != that2.version) { |
| | | if (plus.networkinfo.getCurrentType() != 3) { |
| | | uni.showToast({ |
| | | title: 'ææ°ççæ¬åå¸ï¼æ£æµå°æ¨ç®åéWifiè¿æ¥ï¼ä¸ºè约æ¨çæµéï¼ç¨åºå·²åæ¢èªå¨æ´æ°ï¼å°å¨æ¨è¿æ¥WIFIä¹åéæ°æ£æµæ´æ°ã', |
| | | mask: false, |
| | | duration: 5000, |
| | | icon: "none" |
| | | }); |
| | | return; |
| | | } |
| | | uni.showToast({ |
| | | title: 'ææ°ççæ¬åå¸ï¼æ£æµå°æ¨ç®å为Wifiè¿æ¥ï¼ç¨åºå·²å¯å¨èªå¨æ´æ°ãæ°çæ¬ä¸è½½å®æåå°èªå¨å¼¹åºå®è£
ç¨åºã', |
| | | mask: false, |
| | | duration: 5000, |
| | | icon: "none" |
| | | }); |
| | | //res.data.androidurl  æ¯apkçä¸è½½é¾æ¥ |
| | | var dtask = plus.downloader.createDownload(res.data.androidurl, {}, function(d, |
| | | status) { |
| | | // ä¸è½½å®æ  |
| | | if (status == 200) { |
| | | plus.runtime.install(plus.io.convertLocalFileSystemURL(d |
| | | .filename), {}, {}, function(error) { |
| | | uni.showToast({ |
| | | title: 'å®è£
失败', |
| | | mask: false, |
| | | duration: 1500 |
| | | }); |
| | | }) |
| | | } else { |
| | | uni.showToast({ |
| | | title: 'æ´æ°å¤±è´¥', |
| | | mask: false, |
| | | duration: 1500 |
| | | }); |
| | | } |
| | | }); |
| | | dtask.start(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | // åæ¶åé弿¥è¯·æ±ç次æ°ï¼é²æ¢ä¸æ¬¡ç¹å»æå¤æ¬¡è¯·æ± |
| | | let ajaxTime = 0; |
| | | export const baseUrl = 'http://localhost:8085' |
| | | //export const baseUrl = 'http://10.103.9.200:8085' |
| | | // æ¬å°å°å |
| | | // å
Œ
±çrequestæ¹æ³ |
| | | export function request(option) { |
| | | //请æ±å¤´. |
| | | const header = {}; |
| | | |
| | | // è¿åæ¹å¼ |
| | | header['Content-Type'] = option.contentType || 'application/json'; |
| | | // 夿æ¯å¦æ¯ç»å½è¯·æ±ï¼ä¸æ¯å¨headerä¸å ä¸token |
| | | if (option.url != '/login') { |
| | | header['token'] = uni.getStorageSync('token') ? 'Bearer ' + uni |
| | | .getStorageSync('token') : ''; |
| | | header.Authorization = uni.getStorageSync('token') ? 'Bearer ' + uni |
| | | .getStorageSync('token') : '' |
| | | } |
| | | ajaxTime++; |
| | | // æ¾ç¤ºå è½½ä¸ææ |
| | | uni.showLoading({ |
| | | title: 'å è½½ä¸...', |
| | | mask: true |
| | | }); |
| | | |
| | | return new Promise((resolve, reject) => { |
| | | uni.request({ |
| | | url: baseUrl + option.url, |
| | | method: option.method || 'POST', |
| | | data: option.data || {}, |
| | | header, |
| | | success: (res) => { |
| | | if (res.statusCode == 200) { |
| | | // 请æ±ç¶ææ£å¸¸ï¼è¿åæ°æ® |
| | | resolve(res.data) |
| | | } else if (res.data.code == 401) { //token失æï¼æ¸
é¤tokenå
³éå½å页é¢ï¼è·³è½¬å°ç»å½ |
| | | uni.showModal({ |
| | | title: 'æç¤º', |
| | | content: 'token失æï¼è¯·éæ°ç»é', |
| | | showCancel: false |
| | | }) |
| | | // æ¸
æ¥token |
| | | uni.removeStorageSync('token') |
| | | // 跳转å°ç»å½ |
| | | uni.redirectTo({ |
| | | url: '/pages/login/login.vue' |
| | | }) |
| | | } else { |
| | | // å¼å¸¸ï¼è¿åå¼å¸¸codeåmessage |
| | | reject(`${res.data.code}:${res.data.Message}`) |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | // 请æ±å¤±è´¥ |
| | | reject(err); |
| | | }, |
| | | complete: () => { |
| | | // 请æ±å®æåå¤æç¶æ |
| | | ajaxTime--; |
| | | // åªæå¼çäº0ï¼ææ¸
é¤è½¬åææ |
| | | if (ajaxTime == 0) { |
| | | uni.hideLoading() |
| | | } |
| | | } |
| | | }) |
| | | }).catch(e => {}) |
| | | } |
| | | |
| | | // export default request |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @font-face {font-family: "iconfont"; |
| | | src: url('https://at.alicdn.com/t/font_2425735_vv80o9jults.eot?t=1615968675766'); /* IE9 */ |
| | | src: url('https://at.alicdn.com/t/font_2425735_vv80o9jults.eot?t=1615968675766#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
| | | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAASsAAsAAAAACSAAAAReAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDHAqFXIRYATYCJAMQCwoABCAFhG0HRxvJB1FUTkJkX2DbsCeQaDJQbADFDkPwLHT8aFhLlYJmFkMAAGAoOQ9f+72eu7sf0SUKUGZieXx4PIFLQeioRrpOje1Us65+P++mPSDSRqtCVYWmH0rREnJqspmNNon4dNP5xDofg9QUkhSakXdLUv4KpbkzpGW4hCXK6G4CAgf//DHTRdMA861tLhV/HRbVNsDRgAeUfdd6R2cHGsJ4D90GxtWJs7MCh6cJtC2Khx1V1reDk8LYFIgXlqHAKWVXOJWhKdSJk6Uf77Sa6S3dBr74fx//pIYTSS0zdh7fVYxC8U+fWvKcin4XQ9mfF/I5MraAQjyQ/itEmNxCaCv5GjtA0/xJ4ufaR/3vk6pC1VpQE//lEbJE1Bmoi8Rta7ZjSltM8KshJvP7xC4BvqxvYgT8BbHAiNP8mqRdWsaclXkmUwIRQRAkwe7E3KHXhJkPHgVI4GIgth+PEoOJg/O2x/xgo6sRn3MknJc/9cGDztvDLlfgfa/9c7+hZgbYweXHvX/Eis/9Duzo8sPe805CVvLW7wMJnnvswAGAZkcPH6cIbFssfjYYsN1B+2/tOd186+Ve/BkbqRccOOeDkgBRMdjGaF1+0Z8Be5d5tbb7uVqtSksQ3rbFvkM6ErHJVas1agzzhGN6agGieftcj9xGo2DxMmiwdw4iNHqavUGOBnm8zz4XjmMeNi+vZnaOO/mm09Mp//dJZa/2pPT/5RRalRPVp3JWu1M+t0I++JqXHrwz21VaKEIZzq9ezeMC7ubiPJQVSC2UlN5tftPoAqx+biLr5ns3txFbCZSGO024vzVAN7sfa+G5FqwZAynI65o9KcyCwKkaE7bGataY3W8Mg4J9PGvlXX/3gEn8M7S+LvTKfc3i+HjxrLV6HC9vDts7rLVcsnYd/+u6Qh07e9On5BnGfyJ7UXtXF4QxzycRP3WskhITUVjdT6QMPWcGu+RFLb7rzC+vANT+QqEhkuWy9givq1dEqnTC2VDbfGu4TJV2RHjevCKSZXIMhv25QBEhJQhCJANU5W95z9e9GmPJ/7JK++zHFWn+/6bwgk38+Pw9oaVScvIc8NKVtZV/R17JAbhqVQ2OUigEvqp+m+KdgduM2rG5wvDYiz6MM6Wc0DQTIGlYgKxpCVuIW1DTsQ11TbvQtqnqfMeEghClhQ0LGYSh05D0fYVs6A62EJ9Dzdx3qBsGAW2X4X5jx0qwhjIFUSoaJUemkqxNEmnLpRqCylbEOHhKSap9RidS7GyETElMzmaqkIiUPvbYJzGpqkqTtCIJZCV7HuJ5iZQVaRzZ1MQxVZVzk5Jo6pMSbZIABocUCEWFjCKNmIrEspGIaHe8ypD7/VYIw4FHUTgDFclOiMKOnZ6UIlFyDWwVEmsNnMt8u0kYqVQqWlhHU0gEpErwIryZlJBketk4xEaVaKxFXJYrCUfRdVHi+EbhChtdxCHGB5VIkaNETe2VkgTKMlUSmTGHKjmmsJTIaARWoAAAAAA=') format('woff2'), |
| | | url('https://at.alicdn.com/t/font_2425735_vv80o9jults.woff?t=1615968675766') format('woff'), |
| | | url('https://at.alicdn.com/t/font_2425735_vv80o9jults.ttf?t=1615968675766') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ |
| | | url('https://at.alicdn.com/t/font_2425735_vv80o9jults.svg?t=1615968675766#iconfont') format('svg'); /* iOS 4.1- */ |
| | | } |
| | | |
| | | .iconfont { |
| | | font-family: "iconfont" !important; |
| | | font-size: 16px; |
| | | font-style: normal; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | } |
| | | |
| | | .icon-saoma:before { |
| | | content: "\e628"; |
| | | } |
| | | |
| | | .icon-yonghutouxiang:before { |
| | | content: "\e851"; |
| | | } |
| | | |
| | | .icon-mima:before { |
| | | content: "\e707"; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* Logo åä½ */ |
| | | @font-face { |
| | | font-family: "iconfont logo"; |
| | | src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); |
| | | src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'), |
| | | url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), |
| | | url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), |
| | | url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg'); |
| | | } |
| | | |
| | | .logo { |
| | | font-family: "iconfont logo"; |
| | | font-size: 160px; |
| | | font-style: normal; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | } |
| | | |
| | | /* tabs */ |
| | | .nav-tabs { |
| | | position: relative; |
| | | } |
| | | |
| | | .nav-tabs .nav-more { |
| | | position: absolute; |
| | | right: 0; |
| | | bottom: 0; |
| | | height: 42px; |
| | | line-height: 42px; |
| | | color: #666; |
| | | } |
| | | |
| | | #tabs { |
| | | border-bottom: 1px solid #eee; |
| | | } |
| | | |
| | | #tabs li { |
| | | cursor: pointer; |
| | | width: 100px; |
| | | height: 40px; |
| | | line-height: 40px; |
| | | text-align: center; |
| | | font-size: 16px; |
| | | border-bottom: 2px solid transparent; |
| | | position: relative; |
| | | z-index: 1; |
| | | margin-bottom: -1px; |
| | | color: #666; |
| | | } |
| | | |
| | | |
| | | #tabs .active { |
| | | border-bottom-color: #f00; |
| | | color: #222; |
| | | } |
| | | |
| | | .tab-container .content { |
| | | display: none; |
| | | } |
| | | |
| | | /* 页é¢å¸å± */ |
| | | .main { |
| | | padding: 30px 100px; |
| | | width: 960px; |
| | | margin: 0 auto; |
| | | } |
| | | |
| | | .main .logo { |
| | | color: #333; |
| | | text-align: left; |
| | | margin-bottom: 30px; |
| | | line-height: 1; |
| | | height: 110px; |
| | | margin-top: -50px; |
| | | overflow: hidden; |
| | | *zoom: 1; |
| | | } |
| | | |
| | | .main .logo a { |
| | | font-size: 160px; |
| | | color: #333; |
| | | } |
| | | |
| | | .helps { |
| | | margin-top: 40px; |
| | | } |
| | | |
| | | .helps pre { |
| | | padding: 20px; |
| | | margin: 10px 0; |
| | | border: solid 1px #e7e1cd; |
| | | background-color: #fffdef; |
| | | overflow: auto; |
| | | } |
| | | |
| | | .icon_lists { |
| | | width: 100% !important; |
| | | overflow: hidden; |
| | | *zoom: 1; |
| | | } |
| | | |
| | | .icon_lists li { |
| | | width: 100px; |
| | | margin-bottom: 10px; |
| | | margin-right: 20px; |
| | | text-align: center; |
| | | list-style: none !important; |
| | | cursor: default; |
| | | } |
| | | |
| | | .icon_lists li .code-name { |
| | | line-height: 1.2; |
| | | } |
| | | |
| | | .icon_lists .icon { |
| | | display: block; |
| | | height: 100px; |
| | | line-height: 100px; |
| | | font-size: 42px; |
| | | margin: 10px auto; |
| | | color: #333; |
| | | -webkit-transition: font-size 0.25s linear, width 0.25s linear; |
| | | -moz-transition: font-size 0.25s linear, width 0.25s linear; |
| | | transition: font-size 0.25s linear, width 0.25s linear; |
| | | } |
| | | |
| | | .icon_lists .icon:hover { |
| | | font-size: 100px; |
| | | } |
| | | |
| | | .icon_lists .svg-icon { |
| | | /* éè¿è®¾ç½® font-size æ¥æ¹å徿 å¤§å° */ |
| | | width: 1em; |
| | | /* 徿 åæåç¸é»æ¶ï¼åç´å¯¹é½ */ |
| | | vertical-align: -0.15em; |
| | | /* éè¿è®¾ç½® color æ¥æ¹å SVG çé¢è²/fill */ |
| | | fill: currentColor; |
| | | /* path å stroke æº¢åº viewBox é¨åå¨ IE ä¸ä¼æ¾ç¤º |
| | | normalize.css ä¸ä¹å
å«è¿è¡ */ |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .icon_lists li .name, |
| | | .icon_lists li .code-name { |
| | | color: #666; |
| | | } |
| | | |
| | | /* markdown æ ·å¼ */ |
| | | .markdown { |
| | | color: #666; |
| | | font-size: 14px; |
| | | line-height: 1.8; |
| | | } |
| | | |
| | | .highlight { |
| | | line-height: 1.5; |
| | | } |
| | | |
| | | .markdown img { |
| | | vertical-align: middle; |
| | | max-width: 100%; |
| | | } |
| | | |
| | | .markdown h1 { |
| | | color: #404040; |
| | | font-weight: 500; |
| | | line-height: 40px; |
| | | margin-bottom: 24px; |
| | | } |
| | | |
| | | .markdown h2, |
| | | .markdown h3, |
| | | .markdown h4, |
| | | .markdown h5, |
| | | .markdown h6 { |
| | | color: #404040; |
| | | margin: 1.6em 0 0.6em 0; |
| | | font-weight: 500; |
| | | clear: both; |
| | | } |
| | | |
| | | .markdown h1 { |
| | | font-size: 28px; |
| | | } |
| | | |
| | | .markdown h2 { |
| | | font-size: 22px; |
| | | } |
| | | |
| | | .markdown h3 { |
| | | font-size: 16px; |
| | | } |
| | | |
| | | .markdown h4 { |
| | | font-size: 14px; |
| | | } |
| | | |
| | | .markdown h5 { |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .markdown h6 { |
| | | font-size: 12px; |
| | | } |
| | | |
| | | .markdown hr { |
| | | height: 1px; |
| | | border: 0; |
| | | background: #e9e9e9; |
| | | margin: 16px 0; |
| | | clear: both; |
| | | } |
| | | |
| | | .markdown p { |
| | | margin: 1em 0; |
| | | } |
| | | |
| | | .markdown>p, |
| | | .markdown>blockquote, |
| | | .markdown>.highlight, |
| | | .markdown>ol, |
| | | .markdown>ul { |
| | | width: 80%; |
| | | } |
| | | |
| | | .markdown ul>li { |
| | | list-style: circle; |
| | | } |
| | | |
| | | .markdown>ul li, |
| | | .markdown blockquote ul>li { |
| | | margin-left: 20px; |
| | | padding-left: 4px; |
| | | } |
| | | |
| | | .markdown>ul li p, |
| | | .markdown>ol li p { |
| | | margin: 0.6em 0; |
| | | } |
| | | |
| | | .markdown ol>li { |
| | | list-style: decimal; |
| | | } |
| | | |
| | | .markdown>ol li, |
| | | .markdown blockquote ol>li { |
| | | margin-left: 20px; |
| | | padding-left: 4px; |
| | | } |
| | | |
| | | .markdown code { |
| | | margin: 0 3px; |
| | | padding: 0 5px; |
| | | background: #eee; |
| | | border-radius: 3px; |
| | | } |
| | | |
| | | .markdown strong, |
| | | .markdown b { |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .markdown>table { |
| | | border-collapse: collapse; |
| | | border-spacing: 0px; |
| | | empty-cells: show; |
| | | border: 1px solid #e9e9e9; |
| | | width: 95%; |
| | | margin-bottom: 24px; |
| | | } |
| | | |
| | | .markdown>table th { |
| | | white-space: nowrap; |
| | | color: #333; |
| | | font-weight: 600; |
| | | } |
| | | |
| | | .markdown>table th, |
| | | .markdown>table td { |
| | | border: 1px solid #e9e9e9; |
| | | padding: 8px 16px; |
| | | text-align: left; |
| | | } |
| | | |
| | | .markdown>table th { |
| | | background: #F7F7F7; |
| | | } |
| | | |
| | | .markdown blockquote { |
| | | font-size: 90%; |
| | | color: #999; |
| | | border-left: 4px solid #e9e9e9; |
| | | padding-left: 0.8em; |
| | | margin: 1em 0; |
| | | } |
| | | |
| | | .markdown blockquote p { |
| | | margin: 0; |
| | | } |
| | | |
| | | .markdown .anchor { |
| | | opacity: 0; |
| | | transition: opacity 0.3s ease; |
| | | margin-left: 8px; |
| | | } |
| | | |
| | | .markdown .waiting { |
| | | color: #ccc; |
| | | } |
| | | |
| | | .markdown h1:hover .anchor, |
| | | .markdown h2:hover .anchor, |
| | | .markdown h3:hover .anchor, |
| | | .markdown h4:hover .anchor, |
| | | .markdown h5:hover .anchor, |
| | | .markdown h6:hover .anchor { |
| | | opacity: 1; |
| | | display: inline-block; |
| | | } |
| | | |
| | | .markdown>br, |
| | | .markdown>p>br { |
| | | clear: both; |
| | | } |
| | | |
| | | |
| | | .hljs { |
| | | display: block; |
| | | background: white; |
| | | padding: 0.5em; |
| | | color: #333333; |
| | | overflow-x: auto; |
| | | } |
| | | |
| | | .hljs-comment, |
| | | .hljs-meta { |
| | | color: #969896; |
| | | } |
| | | |
| | | .hljs-string, |
| | | .hljs-variable, |
| | | .hljs-template-variable, |
| | | .hljs-strong, |
| | | .hljs-emphasis, |
| | | .hljs-quote { |
| | | color: #df5000; |
| | | } |
| | | |
| | | .hljs-keyword, |
| | | .hljs-selector-tag, |
| | | .hljs-type { |
| | | color: #a71d5d; |
| | | } |
| | | |
| | | .hljs-literal, |
| | | .hljs-symbol, |
| | | .hljs-bullet, |
| | | .hljs-attribute { |
| | | color: #0086b3; |
| | | } |
| | | |
| | | .hljs-section, |
| | | .hljs-name { |
| | | color: #63a35c; |
| | | } |
| | | |
| | | .hljs-tag { |
| | | color: #333333; |
| | | } |
| | | |
| | | .hljs-title, |
| | | .hljs-attr, |
| | | .hljs-selector-id, |
| | | .hljs-selector-class, |
| | | .hljs-selector-attr, |
| | | .hljs-selector-pseudo { |
| | | color: #795da3; |
| | | } |
| | | |
| | | .hljs-addition { |
| | | color: #55a532; |
| | | background-color: #eaffea; |
| | | } |
| | | |
| | | .hljs-deletion { |
| | | color: #bd2c00; |
| | | background-color: #ffecec; |
| | | } |
| | | |
| | | .hljs-link { |
| | | text-decoration: underline; |
| | | } |
| | | |
| | | /* 代ç é«äº® */ |
| | | /* PrismJS 1.15.0 |
| | | https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */ |
| | | /** |
| | | * prism.js default theme for JavaScript, CSS and HTML |
| | | * Based on dabblet (http://dabblet.com) |
| | | * @author Lea Verou |
| | | */ |
| | | code[class*="language-"], |
| | | pre[class*="language-"] { |
| | | color: black; |
| | | background: none; |
| | | text-shadow: 0 1px white; |
| | | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; |
| | | text-align: left; |
| | | white-space: pre; |
| | | word-spacing: normal; |
| | | word-break: normal; |
| | | word-wrap: normal; |
| | | line-height: 1.5; |
| | | |
| | | -moz-tab-size: 4; |
| | | -o-tab-size: 4; |
| | | tab-size: 4; |
| | | |
| | | -webkit-hyphens: none; |
| | | -moz-hyphens: none; |
| | | -ms-hyphens: none; |
| | | hyphens: none; |
| | | } |
| | | |
| | | pre[class*="language-"]::-moz-selection, |
| | | pre[class*="language-"] ::-moz-selection, |
| | | code[class*="language-"]::-moz-selection, |
| | | code[class*="language-"] ::-moz-selection { |
| | | text-shadow: none; |
| | | background: #b3d4fc; |
| | | } |
| | | |
| | | pre[class*="language-"]::selection, |
| | | pre[class*="language-"] ::selection, |
| | | code[class*="language-"]::selection, |
| | | code[class*="language-"] ::selection { |
| | | text-shadow: none; |
| | | background: #b3d4fc; |
| | | } |
| | | |
| | | @media print { |
| | | |
| | | code[class*="language-"], |
| | | pre[class*="language-"] { |
| | | text-shadow: none; |
| | | } |
| | | } |
| | | |
| | | /* Code blocks */ |
| | | pre[class*="language-"] { |
| | | padding: 1em; |
| | | margin: .5em 0; |
| | | overflow: auto; |
| | | } |
| | | |
| | | :not(pre)>code[class*="language-"], |
| | | pre[class*="language-"] { |
| | | background: #f5f2f0; |
| | | } |
| | | |
| | | /* Inline code */ |
| | | :not(pre)>code[class*="language-"] { |
| | | padding: .1em; |
| | | border-radius: .3em; |
| | | white-space: normal; |
| | | } |
| | | |
| | | .token.comment, |
| | | .token.prolog, |
| | | .token.doctype, |
| | | .token.cdata { |
| | | color: slategray; |
| | | } |
| | | |
| | | .token.punctuation { |
| | | color: #999; |
| | | } |
| | | |
| | | .namespace { |
| | | opacity: .7; |
| | | } |
| | | |
| | | .token.property, |
| | | .token.tag, |
| | | .token.boolean, |
| | | .token.number, |
| | | .token.constant, |
| | | .token.symbol, |
| | | .token.deleted { |
| | | color: #905; |
| | | } |
| | | |
| | | .token.selector, |
| | | .token.attr-name, |
| | | .token.string, |
| | | .token.char, |
| | | .token.builtin, |
| | | .token.inserted { |
| | | color: #690; |
| | | } |
| | | |
| | | .token.operator, |
| | | .token.entity, |
| | | .token.url, |
| | | .language-css .token.string, |
| | | .style .token.string { |
| | | color: #9a6e3a; |
| | | background: hsla(0, 0%, 100%, .5); |
| | | } |
| | | |
| | | .token.atrule, |
| | | .token.attr-value, |
| | | .token.keyword { |
| | | color: #07a; |
| | | } |
| | | |
| | | .token.function, |
| | | .token.class-name { |
| | | color: #DD4A68; |
| | | } |
| | | |
| | | .token.regex, |
| | | .token.important, |
| | | .token.variable { |
| | | color: #e90; |
| | | } |
| | | |
| | | .token.important, |
| | | .token.bold { |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .token.italic { |
| | | font-style: italic; |
| | | } |
| | | |
| | | .token.entity { |
| | | cursor: help; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"/> |
| | | <title>IconFont Demo</title> |
| | | <link rel="shortcut icon" href="//img.alicdn.com/imgextra/i2/O1CN01ZyAlrn1MwaMhqz36G_!!6000000001499-73-tps-64-64.ico" type="image/x-icon"/> |
| | | <link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01EYTRnJ297D6vehehJ_!!6000000008020-55-tps-64-64.svg"/> |
| | | <link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css"> |
| | | <link rel="stylesheet" href="demo.css"> |
| | | <link rel="stylesheet" href="iconfont.css"> |
| | | <script src="iconfont.js"></script> |
| | | <!-- jQuery --> |
| | | <script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script> |
| | | <!-- 代ç é«äº® --> |
| | | <script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script> |
| | | </head> |
| | | <body> |
| | | <div class="main"> |
| | | <h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont é¦é¡µ" target="_blank"></a></h1> |
| | | <div class="nav-tabs"> |
| | | <ul id="tabs" class="dib-box"> |
| | | <li class="dib active"><span>Unicode</span></li> |
| | | <li class="dib"><span>Font class</span></li> |
| | | <li class="dib"><span>Symbol</span></li> |
| | | </ul> |
| | | |
| | | <a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2425735" target="_blank" class="nav-more">æ¥ç项ç®</a> |
| | | |
| | | </div> |
| | | <div class="tab-container"> |
| | | <div class="content unicode" style="display: block;"> |
| | | <ul class="icon_lists dib-box"> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont"></span> |
| | | <div class="name">æ«ç </div> |
| | | <div class="code-name">&#xe628;</div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont"></span> |
| | | <div class="name">ç¨æ· 头å</div> |
| | | <div class="code-name">&#xe851;</div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont"></span> |
| | | <div class="name">å¯ç </div> |
| | | <div class="code-name">&#xe707;</div> |
| | | </li> |
| | | |
| | | </ul> |
| | | <div class="article markdown"> |
| | | <h2 id="unicode-">Unicode å¼ç¨</h2> |
| | | <hr> |
| | | |
| | | <p>Unicode æ¯åä½å¨ç½é¡µç«¯æåå§çåºç¨æ¹å¼ï¼ç¹ç¹æ¯ï¼</p> |
| | | <ul> |
| | | <li>å
¼å®¹æ§æå¥½ï¼æ¯æ IE6+ï¼åææç°ä»£æµè§å¨ã</li> |
| | | <li>æ¯ææåä½çæ¹å¼å»å¨æè°æ´å¾æ 大å°ï¼é¢è²ççã</li> |
| | | <li>使¯å 为æ¯åä½ï¼æä»¥ä¸æ¯æå¤è²ãåªè½ä½¿ç¨å¹³å°éåè²ç徿 ï¼å°±ç®é¡¹ç®éæå¤è²å¾æ ä¹ä¼èªå¨å»è²ã</li> |
| | | </ul> |
| | | <blockquote> |
| | | <p>注æï¼æ°ç iconfont æ¯æå¤è²å¾æ ï¼è¿äºå¤è²å¾æ å¨ Unicode 模å¼ä¸å°ä¸è½ä½¿ç¨ï¼å¦ææéæ±å»ºè®®ä½¿ç¨symbol çå¼ç¨æ¹å¼</p> |
| | | </blockquote> |
| | | <p>Unicode ä½¿ç¨æ¥éª¤å¦ä¸ï¼</p> |
| | | <h3 id="-font-face">ç¬¬ä¸æ¥ï¼æ·è´é¡¹ç®ä¸é¢çæç <code>@font-face</code></h3> |
| | | <pre><code class="language-css" |
| | | >@font-face { |
| | | font-family: 'iconfont'; |
| | | src: url('iconfont.eot'); |
| | | src: url('iconfont.eot?#iefix') format('embedded-opentype'), |
| | | url('iconfont.woff2') format('woff2'), |
| | | url('iconfont.woff') format('woff'), |
| | | url('iconfont.ttf') format('truetype'), |
| | | url('iconfont.svg#iconfont') format('svg'); |
| | | } |
| | | </code></pre> |
| | | <h3 id="-iconfont-">ç¬¬äºæ¥ï¼å®ä¹ä½¿ç¨ iconfont çæ ·å¼</h3> |
| | | <pre><code class="language-css" |
| | | >.iconfont { |
| | | font-family: "iconfont" !important; |
| | | font-size: 16px; |
| | | font-style: normal; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | } |
| | | </code></pre> |
| | | <h3 id="-">ç¬¬ä¸æ¥ï¼æéç¸åºå¾æ å¹¶è·ååä½ç¼ç ï¼åºç¨äºé¡µé¢</h3> |
| | | <pre> |
| | | <code class="language-html" |
| | | ><span class="iconfont">&#x33;</span> |
| | | </code></pre> |
| | | <blockquote> |
| | | <p>"iconfont" æ¯ä½ 项ç®ä¸ç font-familyãå¯ä»¥éè¿ç¼è¾é¡¹ç®æ¥çï¼é»è®¤æ¯ "iconfont"ã</p> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | <div class="content font-class"> |
| | | <ul class="icon_lists dib-box"> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont icon-saoma"></span> |
| | | <div class="name"> |
| | | æ«ç |
| | | </div> |
| | | <div class="code-name">.icon-saoma |
| | | </div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont icon-yonghutouxiang"></span> |
| | | <div class="name"> |
| | | ç¨æ· 头å |
| | | </div> |
| | | <div class="code-name">.icon-yonghutouxiang |
| | | </div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <span class="icon iconfont icon-mima"></span> |
| | | <div class="name"> |
| | | å¯ç |
| | | </div> |
| | | <div class="code-name">.icon-mima |
| | | </div> |
| | | </li> |
| | | |
| | | </ul> |
| | | <div class="article markdown"> |
| | | <h2 id="font-class-">font-class å¼ç¨</h2> |
| | | <hr> |
| | | |
| | | <p>font-class æ¯ Unicode ä½¿ç¨æ¹å¼çä¸ç§åç§ï¼ä¸»è¦æ¯è§£å³ Unicode 书åä¸ç´è§ï¼è¯æä¸æç¡®çé®é¢ã</p> |
| | | <p>ä¸ Unicode ä½¿ç¨æ¹å¼ç¸æ¯ï¼å
·æå¦ä¸ç¹ç¹ï¼</p> |
| | | <ul> |
| | | <li>å
¼å®¹æ§è¯å¥½ï¼æ¯æ IE8+ï¼åææç°ä»£æµè§å¨ã</li> |
| | | <li>ç¸æ¯äº Unicode è¯ææç¡®ï¼ä¹¦åæ´ç´è§ãå¯ä»¥å¾å®¹æå辨è¿ä¸ª icon æ¯ä»ä¹ã</li> |
| | | <li>å ä¸ºä½¿ç¨ class æ¥å®ä¹å¾æ ï¼æä»¥å½è¦æ¿æ¢å¾æ æ¶ï¼åªéè¦ä¿®æ¹ class éé¢ç Unicode å¼ç¨ã</li> |
| | | <li>ä¸è¿å 为æ¬è´¨ä¸è¿æ¯ä½¿ç¨çåä½ï¼æä»¥å¤è²å¾æ è¿æ¯ä¸æ¯æçã</li> |
| | | </ul> |
| | | <p>ä½¿ç¨æ¥éª¤å¦ä¸ï¼</p> |
| | | <h3 id="-fontclass-">ç¬¬ä¸æ¥ï¼å¼å
¥é¡¹ç®ä¸é¢çæç fontclass 代ç ï¼</h3> |
| | | <pre><code class="language-html"><link rel="stylesheet" href="./iconfont.css"> |
| | | </code></pre> |
| | | <h3 id="-">ç¬¬äºæ¥ï¼æéç¸åºå¾æ å¹¶è·åç±»åï¼åºç¨äºé¡µé¢ï¼</h3> |
| | | <pre><code class="language-html"><span class="iconfont icon-xxx"></span> |
| | | </code></pre> |
| | | <blockquote> |
| | | <p>" |
| | | iconfont" æ¯ä½ 项ç®ä¸ç font-familyãå¯ä»¥éè¿ç¼è¾é¡¹ç®æ¥çï¼é»è®¤æ¯ "iconfont"ã</p> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | <div class="content symbol"> |
| | | <ul class="icon_lists dib-box"> |
| | | |
| | | <li class="dib"> |
| | | <svg class="icon svg-icon" aria-hidden="true"> |
| | | <use xlink:href="#icon-saoma"></use> |
| | | </svg> |
| | | <div class="name">æ«ç </div> |
| | | <div class="code-name">#icon-saoma</div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <svg class="icon svg-icon" aria-hidden="true"> |
| | | <use xlink:href="#icon-yonghutouxiang"></use> |
| | | </svg> |
| | | <div class="name">ç¨æ· 头å</div> |
| | | <div class="code-name">#icon-yonghutouxiang</div> |
| | | </li> |
| | | |
| | | <li class="dib"> |
| | | <svg class="icon svg-icon" aria-hidden="true"> |
| | | <use xlink:href="#icon-mima"></use> |
| | | </svg> |
| | | <div class="name">å¯ç </div> |
| | | <div class="code-name">#icon-mima</div> |
| | | </li> |
| | | |
| | | </ul> |
| | | <div class="article markdown"> |
| | | <h2 id="symbol-">Symbol å¼ç¨</h2> |
| | | <hr> |
| | | |
| | | <p>è¿æ¯ä¸ç§å
¨æ°çä½¿ç¨æ¹å¼ï¼åºè¯¥è¯´è¿ææ¯æªæ¥ç主æµï¼ä¹æ¯å¹³å°ç®åæ¨èçç¨æ³ãç¸å
³ä»ç»å¯ä»¥åèè¿ç¯<a href="">æç« </a> |
| | | è¿ç§ç¨æ³å
¶å®æ¯åäºä¸ä¸ª SVG çéåï¼ä¸å¦å¤ä¸¤ç§ç¸æ¯å
·æå¦ä¸ç¹ç¹ï¼</p> |
| | | <ul> |
| | | <li>æ¯æå¤è²å¾æ äºï¼ä¸åååè²éå¶ã</li> |
| | | <li>éè¿ä¸äºæå·§ï¼æ¯æååä½é£æ ·ï¼éè¿ <code>font-size</code>, <code>color</code> æ¥è°æ´æ ·å¼ã</li> |
| | | <li>å
¼å®¹æ§è¾å·®ï¼æ¯æ IE9+ï¼åç°ä»£æµè§å¨ã</li> |
| | | <li>æµè§å¨æ¸²æ SVG çæ§è½ä¸è¬ï¼è¿ä¸å¦ pngã</li> |
| | | </ul> |
| | | <p>ä½¿ç¨æ¥éª¤å¦ä¸ï¼</p> |
| | | <h3 id="-symbol-">ç¬¬ä¸æ¥ï¼å¼å
¥é¡¹ç®ä¸é¢çæç symbol 代ç ï¼</h3> |
| | | <pre><code class="language-html"><script src="./iconfont.js"></script> |
| | | </code></pre> |
| | | <h3 id="-css-">ç¬¬äºæ¥ï¼å å
¥éç¨ CSS 代ç ï¼å¼å
¥ä¸æ¬¡å°±è¡ï¼ï¼</h3> |
| | | <pre><code class="language-html"><style> |
| | | .icon { |
| | | width: 1em; |
| | | height: 1em; |
| | | vertical-align: -0.15em; |
| | | fill: currentColor; |
| | | overflow: hidden; |
| | | } |
| | | </style> |
| | | </code></pre> |
| | | <h3 id="-">ç¬¬ä¸æ¥ï¼æéç¸åºå¾æ å¹¶è·åç±»åï¼åºç¨äºé¡µé¢ï¼</h3> |
| | | <pre><code class="language-html"><svg class="icon" aria-hidden="true"> |
| | | <use xlink:href="#icon-xxx"></use> |
| | | </svg> |
| | | </code></pre> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script> |
| | | $(document).ready(function () { |
| | | $('.tab-container .content:first').show() |
| | | |
| | | $('#tabs li').click(function (e) { |
| | | var tabContent = $('.tab-container .content') |
| | | var index = $(this).index() |
| | | |
| | | if ($(this).hasClass('active')) { |
| | | return |
| | | } else { |
| | | $('#tabs li').removeClass('active') |
| | | $(this).addClass('active') |
| | | |
| | | tabContent.hide().eq(index).fadeIn() |
| | | } |
| | | }) |
| | | }) |
| | | </script> |
| | | </body> |
| | | </html> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | @font-face {font-family: "iconfont"; |
| | | src: url('iconfont.eot?t=1615968305777'); /* IE9 */ |
| | | src: url('iconfont.eot?t=1615968305777#iefix') format('embedded-opentype'), /* IE6-IE8 */ |
| | | url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAASsAAsAAAAACSAAAARdAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDHAqFXIRYATYCJAMQCwoABCAFhG0HRxvJB1FUTkJkPwfcdngkz+0KdYpPU1ZWrnG6zFP/e2pMg5h5KDkPX/u9nru7H9ElClBmYlkSjE8K5GoEsDE1ukaTZiPej236j9KJOFMV1gXGKmFp+t30KC5Hk6FxeXhJ0YhQ4iKTFGE0hrSqtJWwkNQTJUGwfv6Y6aJpgPnWNpeKvw6LahvgaMADyr5rvaOzAw1hvIduA+PqxNlZgcPTBNoWRWCOiioawFRhbArEC0nkwTRlVziVoSnUiZOlH58ZaaY36TLwyf/7+C8uTElqmbHz/FFhH+T8Cnlfm8dV43S4GMr+vJDPkbEFFOIJ6b/DhsktrLaSr7QDNM2fJH6FvDN5f1FVqFoLauK/PEKWiDoDdZG4bc12TGmLCX6biMn8qbVLgC/rmxgB/wBigRGn+TVJu7SMOSvzLBlO1shiDcvuhHxos2SYF9sBonHM8d5OMxNYknDe5Q4ZpnMt0NQ2Ay9/+O7dpmv3ml2B27cb7typrBkHG1/m7sRfxIo7dxoXb5+7Ek8PJGQlb717F7Pjd5yfAzS1/equxTK7YZvPNHN45H3/WXYkwXzry+2INdtS2vkxyfo2QDuhGxd0m7mT8j3YNsO5d6WfKxYLxFtbYttivkL6nPEiVygUCTc2hHBMunMCGNMN4x3riy201s4GDYtz5ugWQisxyNGQ4H3mafoA46hydu5KSfWWXjalNsn/Xcspc31lk/9yCs3JiZqUU+d6y663Qga4Wc1sfh0blpelg3yFZu7cboVW4eYiDeRn4lpKSu+2eqM0VtjI7BnsrdsXV+TlLErDnZYKuY3CeLKDqdWoa5kaBqQgr6vxpDALvIYrLeGyjRWB6X5jGMncQLFJX/UgpGD++B2X+535mPfKUcgZM99EgZI1/utHy6xP2TTv/Gv3XpjYf9G1xwyPwZQp/WuawV98MmTpT2OJxIbGiGT8E8lHT8QRa+QptW4LzC9vABh9C54Se+T8hkDnN2fLeYNm5vmaSz1dfF5joNO7s6V8OZSB/yfwAqV4g68YgOocez7n+LrzqzHm/i+rtK9+TmywM7426Rds4ufQb7FCSzWupLLjwEtX1lb+HXklFQBXrarBUQqFwFfVb1N8Zs5tRu3YXGF47GkfxplSTmiaCZA0LEDWtIQtxC2o6diGuqZdaNtUfL5jgmBFaWHDZAZhaC8kfV8hG7qCLcQnUDP3BeqGwULbbTjc2LESknk+QTxFfVzvcE5SYZ1guah5UFmHRIOGJ0m1z2hCRC9FuNiomGymGOkQ6WOPfogYR6nACQRruSL2PKTRYE4meACpaFQ/pXJadLRAfVKUCmvB3CEC4VFIH06v4TgSFUxHcMdT5rnfr4OIDDR4hDNQkWyCEHrS9JxYUWJqYIuRrtbAuczXG0IUh6IEYZ2AwLQ4ReBFNGYS48j0sgGIChWlv0VcliYaRwl1UdT4Ru0VNrqIQ4wPKpEiR4ma2ksea3nr4Vgn9hsoNgyTeJ2o1EpaHgAAAAA=') format('woff2'), |
| | | url('iconfont.woff?t=1615968305777') format('woff'), |
| | | url('iconfont.ttf?t=1615968305777') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ |
| | | url('iconfont.svg?t=1615968305777#iconfont') format('svg'); /* iOS 4.1- */ |
| | | } |
| | | |
| | | .iconfont { |
| | | font-family: "iconfont" !important; |
| | | font-size: 16px; |
| | | font-style: normal; |
| | | -webkit-font-smoothing: antialiased; |
| | | -moz-osx-font-smoothing: grayscale; |
| | | } |
| | | |
| | | .icon-saoma:before { |
| | | content: "\e628"; |
| | | } |
| | | |
| | | .icon-yonghutouxiang:before { |
| | | content: "\e851"; |
| | | } |
| | | |
| | | .icon-mima:before { |
| | | content: "\e707"; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | !function(t){var e,c,n,a,o,i,l='<svg><symbol id="icon-saoma" viewBox="0 0 1081 1024"><path d="M0 540.430507 0 483.571769 1080.856463 483.571769 1080.856463 540.430507 0 540.430507ZM995.52569 56.889457 654.202596 56.889457 654.202596 0.002276 995.52569 0.002276C1026.927414 0.002276 1052.412872 25.487733 1052.412872 56.889457L1052.412872 398.212552 995.52569 398.212552 995.52569 56.889457ZM85.330773 398.212552 28.443591 398.212552 28.443591 56.889457C28.443591 25.487733 53.900605 0.002276 85.330773 0.002276L426.653867 0.002276 426.653867 56.889457 85.330773 56.889457 85.330773 398.212552ZM85.330773 967.112818 426.653867 967.112818 426.653867 1023.971557 85.330773 1023.971557C53.900605 1023.971557 28.443591 998.514543 28.443591 967.112818L28.443591 625.76128 85.330773 625.76128 85.330773 967.112818ZM995.52569 625.76128 1052.412872 625.76128 1052.412872 967.112818C1052.412872 998.514543 1026.927414 1023.971557 995.52569 1023.971557L654.202596 1023.971557 654.202596 967.112818 995.52569 967.112818 995.52569 625.76128Z" ></path></symbol><symbol id="icon-yonghutouxiang" viewBox="0 0 1024 1024"><path d="M959.68 921.024c-15.232-181.696-139.648-331.968-307.84-386.624 70.464-45.632 117.248-124.48 117.248-214.464C769.152 178.624 654.208 64 512.512 64 370.752 64 255.808 178.624 255.808 319.936c0 89.984 46.784 168.832 117.248 214.528-168.192 54.592-292.544 204.864-307.84 386.56-0.192 3.456-0.64 5.44 0 10.176C66.496 947.2 80.64 960 96.704 960c17.92 0 32.064-14.656 32.064-32 16.704-197.76 182.272-351.936 383.744-351.936 201.408 0 366.976 154.176 383.68 351.936 0 17.344 14.144 32 32.064 32 16.064 0 30.208-12.8 31.424-28.8C960.32 926.464 959.936 924.416 959.68 921.024zM320 319.936C320 213.952 406.208 128 512.512 128s192.448 85.952 192.448 191.936c0 106.048-86.144 192-192.448 192S320 425.984 320 319.936z" ></path></symbol><symbol id="icon-mima" viewBox="0 0 1024 1024"><path d="M542 774.49V514c0-15.69-13.8-30.72-30-30s-30 13.18-30 30v260.49c0 15.69 13.8 30.72 30 30s30-13.18 30-30z" fill="#FD9A16" ></path><path d="M920.64 848.51V430.64v-8c-0.16-20.66-7.8-39.42-21.41-55-16.65-19.06-41.47-26.88-66.27-26.88h-60.62v-28c0-29.78-4.41-59.87-15.05-87.78-12.84-33.7-32-64.47-57.87-89.81-25.5-25-56-43.75-89.53-56C581.1 68.55 550.58 65 520.07 65c-27.94 0-55.43 0.45-82.82 7.09-67.31 16.31-127 63.27-158.37 125a248.89 248.89 0 0 0-27.14 106.4c-0.33 12.39-0.25 24.8-0.16 37.2h-61.85c-2 0-4.08 0-6.11 0.06-27.93 1.25-53.25 15.57-68.11 38.94-10.41 16.39-12.13 34.57-12.13 53.18v419.3c0 8.31-0.07 16.62 0 24.94a83.12 83.12 0 0 0 22.2 55.81c15.23 16.69 38.11 25.79 60.68 26 20.15 0.18 40.3 0 60.44 0h591.14a84.78 84.78 0 0 0 70-38c8.68-13 12.73-28.95 12.78-44.4 0.05-9.35 0.02-18.68 0.02-28.01z m-66-448.06a9.41 9.41 0 0 1-1.29-1c0.11-0.06 0.65 0.4 1.32 1z m-541.5-115.53a217.72 217.72 0 0 1 13.07-47.82 216.64 216.64 0 0 1 17.93-32.34c1.75-2.59 3.57-5.15 5.43-7.66l-0.85 1c0.37-0.44 0.72-0.88 1.07-1.33 0.15-0.19 0.29-0.4 0.44-0.59 0.66-0.89 1.87-2.3 2.12-2.55q6.33-7.63 13.33-14.63 7.19-7.19 15-13.67c0.24-0.2 0.6-0.55 1-0.95 0.29-0.2 0.66-0.47 1.15-0.84q4.22-3.13 8.57-6.08a215.71 215.71 0 0 1 32.34-17.94 217.8 217.8 0 0 1 47.31-13c13.61-1.47 27.22-1.46 40.92-1.46s27.31 0 40.92 1.46a217.8 217.8 0 0 1 47.31 13 215.71 215.71 0 0 1 32.34 17.94c2.6 1.75 5.15 3.57 7.67 5.43l-1-0.85 1.32 1.07 0.6 0.43c0.89 0.67 2.3 1.87 2.55 2.12q7.63 6.34 14.64 13.34 7.18 7.18 13.66 15c0.2 0.25 0.56 0.61 1 1l0.83 1.15q3.15 4.2 6.09 8.56a216.64 216.64 0 0 1 17.93 32.34 217.72 217.72 0 0 1 13.07 47.82c1.84 16.67 1.91 33.63 1.71 50.54H338.23c-8.92 0-17.86-0.11-26.8-0.18-0.2-16.8-0.12-33.7 1.71-50.31zM164.06 405.65a9.64 9.64 0 0 1-1 1.27c-0.06-0.08 0.39-0.62 1-1.27z m5.28 493.56a9.6 9.6 0 0 1 1.3 1c-0.08 0.05-0.64-0.4-1.3-1z m532.27 5.39H186.83c-1.45 0-2.89-0.05-4.33-0.14a60.67 60.67 0 0 1-7.14-1.93 53.9 53.9 0 0 1-5.49-3.09l-1-0.68c-1-0.94-2.08-2-2.18-2.11-0.92-0.91-1.74-1.92-2.63-2.85a53.83 53.83 0 0 1-3.36-5.72 56.59 56.59 0 0 1-1.93-6.91c-0.32-4.8-0.17-9.64-0.17-14.43V476.09c0-17.83-0.14-35.67 0-53.51 0-1.33 0.06-2.65 0.14-4a58.86 58.86 0 0 1 2-7.05 54 54 0 0 1 3.14-5.41l0.69-1c1-1 2.05-2.06 2.16-2.16 0.91-0.9 1.94-1.71 2.89-2.59a56.38 56.38 0 0 1 5.81-3.3 62.15 62.15 0 0 1 7.11-1.92c6.5-0.45 13.14-0.15 19.6-0.15h74.28a28.73 28.73 0 0 0 5.36 0.52h404c18.26 0 36.55 0.34 54.81 0h1.7a28 28 0 0 0 5.24-0.52H837.2q2.17 0 4.32 0.15a62.08 62.08 0 0 1 7.14 1.92 56.94 56.94 0 0 1 5.5 3.09c0.34 0.22 0.68 0.46 1 0.69 1 0.94 2.09 2 2.19 2.11 0.92 0.9 1.74 1.92 2.63 2.85a55.58 55.58 0 0 1 3.36 5.72 56.94 56.94 0 0 1 1.93 6.9c0.32 4.8 0.17 9.65 0.17 14.44v390.69c0 17.84 0.14 35.68 0 53.52q0 2-0.15 4a55.82 55.82 0 0 1-2 7.05 51.23 51.23 0 0 1-3.14 5.4c-0.22 0.34-0.45 0.67-0.69 1-1 1-2 2.06-2.15 2.16-0.92 0.9-2 1.71-2.89 2.58a53.85 53.85 0 0 1-5.81 3.3 57.32 57.32 0 0 1-7.16 1.93c-1.21 0.08-2.43 0.13-3.65 0.14H701.61zM860 894a10.13 10.13 0 0 1 1-1.27c0 0.09-0.43 0.63-1 1.27z" fill="#0071C3" ></path><path d="M352.35 193.65l-0.35 0.35c-0.75 0.91-1.49 1.84-2.23 2.76-0.07 0.1-0.14 0.21-0.22 0.31a40.58 40.58 0 0 0 2.8-3.42zM643.69 165.68l-0.39-0.33c-0.91-0.75-1.83-1.48-2.76-2.22l-0.3-0.22a34 34 0 0 0 3.45 2.77z" fill="#0071C3" ></path></symbol></svg>',d=(d=document.getElementsByTagName("script"))[d.length-1].getAttribute("data-injectcss");if(d&&!t.__iconfont__svg__cssinject__){t.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(t){console&&console.log(t)}}function s(){o||(o=!0,n())}e=function(){var t,e,c,n;(n=document.createElement("div")).innerHTML=l,l=null,(c=n.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",t=c,(e=document.body).firstChild?(n=t,(c=e.firstChild).parentNode.insertBefore(n,c)):e.appendChild(t))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(e,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),e()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(n=e,a=t.document,o=!1,(i=function(){try{a.documentElement.doScroll("left")}catch(t){return void setTimeout(i,50)}s()})(),a.onreadystatechange=function(){"complete"==a.readyState&&(a.onreadystatechange=null,s())})}(window); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | { |
| | | "id": "2425735", |
| | | "name": "䏿µ·æ²¹", |
| | | "font_family": "iconfont", |
| | | "css_prefix_text": "icon-", |
| | | "description": "", |
| | | "glyphs": [ |
| | | { |
| | | "icon_id": "1130638", |
| | | "name": "æ«ç ", |
| | | "font_class": "saoma", |
| | | "unicode": "e628", |
| | | "unicode_decimal": 58920 |
| | | }, |
| | | { |
| | | "icon_id": "741063", |
| | | "name": "ç¨æ· 头å", |
| | | "font_class": "yonghutouxiang", |
| | | "unicode": "e851", |
| | | "unicode_decimal": 59473 |
| | | }, |
| | | { |
| | | "icon_id": "14444711", |
| | | "name": "å¯ç ", |
| | | "font_class": "mima", |
| | | "unicode": "e707", |
| | | "unicode_decimal": 59143 |
| | | } |
| | | ] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" standalone="no"?> |
| | | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > |
| | | <!-- |
| | | 2013-9-30: Created. |
| | | --> |
| | | <svg> |
| | | <metadata> |
| | | Created by iconfont |
| | | </metadata> |
| | | <defs> |
| | | |
| | | <font id="iconfont" horiz-adv-x="1024" > |
| | | <font-face |
| | | font-family="iconfont" |
| | | font-weight="500" |
| | | font-stretch="normal" |
| | | units-per-em="1024" |
| | | ascent="896" |
| | | descent="-128" |
| | | /> |
| | | <missing-glyph /> |
| | | |
| | | <glyph glyph-name="saoma" unicode="" d="M0 355.569493 0 412.428231 1080.856463 412.428231 1080.856463 355.569493 0 355.569493ZM995.52569 839.110543 654.202596 839.110543 654.202596 895.997724 995.52569 895.997724C1026.927414 895.997724 1052.412872 870.512267 1052.412872 839.110543L1052.412872 497.787448 995.52569 497.787448 995.52569 839.110543ZM85.330773 497.787448 28.443591 497.787448 28.443591 839.110543C28.443591 870.512267 53.900605 895.997724 85.330773 895.997724L426.653867 895.997724 426.653867 839.110543 85.330773 839.110543 85.330773 497.787448ZM85.330773-71.112818 426.653867-71.112818 426.653867-127.971557 85.330773-127.971557C53.900605-127.971557 28.443591-102.514543 28.443591-71.112818L28.443591 270.23872 85.330773 270.23872 85.330773-71.112818ZM995.52569 270.23872 1052.412872 270.23872 1052.412872-71.112818C1052.412872-102.514543 1026.927414-127.971557 995.52569-127.971557L654.202596-127.971557 654.202596-71.112818 995.52569-71.112818 995.52569 270.23872Z" horiz-adv-x="1081" /> |
| | | |
| | | |
| | | <glyph glyph-name="yonghutouxiang" unicode="" d="M959.68-25.024c-15.232 181.696-139.648 331.968-307.84 386.624 70.464 45.632 117.248 124.48 117.248 214.464C769.152 717.376 654.208 832 512.512 832 370.752 832 255.808 717.376 255.808 576.064c0-89.984 46.784-168.832 117.248-214.528-168.192-54.592-292.544-204.864-307.84-386.56-0.192-3.456-0.64-5.44 0-10.176C66.496-51.2 80.64-64 96.704-64c17.92 0 32.064 14.656 32.064 32 16.704 197.76 182.272 351.936 383.744 351.936 201.408 0 366.976-154.176 383.68-351.936 0-17.344 14.144-32 32.064-32 16.064 0 30.208 12.8 31.424 28.8C960.32-30.464 959.936-28.416 959.68-25.024zM320 576.064C320 682.048 406.208 768 512.512 768s192.448-85.952 192.448-191.936c0-106.048-86.144-192-192.448-192S320 470.016 320 576.064z" horiz-adv-x="1024" /> |
| | | |
| | | |
| | | <glyph glyph-name="mima" unicode="" d="M542 121.51V382c0 15.69-13.8 30.72-30 30s-30-13.18-30-30v-260.49c0-15.69 13.8-30.72 30-30s30 13.18 30 30zM920.64 47.49V465.36v8c-0.16 20.66-7.8 39.42-21.41 55-16.65 19.06-41.47 26.88-66.27 26.88h-60.62v28c0 29.78-4.41 59.87-15.05 87.78-12.84 33.7-32 64.47-57.87 89.81-25.5 25-56 43.75-89.53 56C581.1 827.45 550.58 831 520.07 831c-27.94 0-55.43-0.45-82.82-7.09-67.31-16.31-127-63.27-158.37-125a248.89 248.89 0 0 1-27.14-106.4c-0.33-12.39-0.25-24.8-0.16-37.2h-61.85c-2 0-4.08 0-6.11-0.06-27.93-1.25-53.25-15.57-68.11-38.94-10.41-16.39-12.13-34.57-12.13-53.18v-419.3c0-8.31-0.07-16.62 0-24.94a83.12 83.12 0 0 1 22.2-55.81c15.23-16.69 38.11-25.79 60.68-26 20.15-0.18 40.3 0 60.44 0h591.14a84.78 84.78 0 0 1 70 38c8.68 13 12.73 28.95 12.78 44.4 0.05 9.35 0.02 18.68 0.02 28.01z m-66 448.06a9.41 9.41 0 0 0-1.29 1c0.11 0.06 0.65-0.4 1.32-1z m-541.5 115.53a217.72 217.72 0 0 0 13.07 47.82 216.64 216.64 0 0 0 17.93 32.34c1.75 2.59 3.57 5.15 5.43 7.66l-0.85-1c0.37 0.44 0.72 0.88 1.07 1.33 0.15 0.19 0.29 0.4 0.44 0.59 0.66 0.89 1.87 2.3 2.12 2.55q6.33 7.63 13.33 14.63 7.19 7.19 15 13.67c0.24 0.2 0.6 0.55 1 0.95 0.29 0.2 0.66 0.47 1.15 0.84q4.22 3.13 8.57 6.08a215.71 215.71 0 0 0 32.34 17.94 217.8 217.8 0 0 0 47.31 13c13.61 1.47 27.22 1.46 40.92 1.46s27.31 0 40.92-1.46a217.8 217.8 0 0 0 47.31-13 215.71 215.71 0 0 0 32.34-17.94c2.6-1.75 5.15-3.57 7.67-5.43l-1 0.85 1.32-1.07 0.6-0.43c0.89-0.67 2.3-1.87 2.55-2.12q7.63-6.34 14.64-13.34 7.18-7.18 13.66-15c0.2-0.25 0.56-0.61 1-1l0.83-1.15q3.15-4.2 6.09-8.56a216.64 216.64 0 0 0 17.93-32.34 217.72 217.72 0 0 0 13.07-47.82c1.84-16.67 1.91-33.63 1.71-50.54H338.23c-8.92 0-17.86 0.11-26.8 0.18-0.2 16.8-0.12 33.7 1.71 50.31zM164.06 490.35a9.64 9.64 0 0 0-1-1.27c-0.06 0.08 0.39 0.62 1 1.27z m5.28-493.56a9.6 9.6 0 0 0 1.3-1c-0.08-0.05-0.64 0.4-1.3 1z m532.27-5.39H186.83c-1.45 0-2.89 0.05-4.33 0.14a60.67 60.67 0 0 0-7.14 1.93 53.9 53.9 0 0 0-5.49 3.09l-1 0.68c-1 0.94-2.08 2-2.18 2.11-0.92 0.91-1.74 1.92-2.63 2.85a53.83 53.83 0 0 0-3.36 5.72 56.59 56.59 0 0 0-1.93 6.91c-0.32 4.8-0.17 9.64-0.17 14.43V419.91c0 17.83-0.14 35.67 0 53.51 0 1.33 0.06 2.65 0.14 4a58.86 58.86 0 0 0 2 7.05 54 54 0 0 0 3.14 5.41l0.69 1c1 1 2.05 2.06 2.16 2.16 0.91 0.9 1.94 1.71 2.89 2.59a56.38 56.38 0 0 0 5.81 3.3 62.15 62.15 0 0 0 7.11 1.92c6.5 0.45 13.14 0.15 19.6 0.15h74.28a28.73 28.73 0 0 1 5.36-0.52h404c18.26 0 36.55-0.34 54.81 0h1.7a28 28 0 0 1 5.24 0.52H837.2q2.17 0 4.32-0.15a62.08 62.08 0 0 0 7.14-1.92 56.94 56.94 0 0 0 5.5-3.09c0.34-0.22 0.68-0.46 1-0.69 1-0.94 2.09-2 2.19-2.11 0.92-0.9 1.74-1.92 2.63-2.85a55.58 55.58 0 0 0 3.36-5.72 56.94 56.94 0 0 0 1.93-6.9c0.32-4.8 0.17-9.65 0.17-14.44v-390.69c0-17.84 0.14-35.68 0-53.52q0-2-0.15-4a55.82 55.82 0 0 0-2-7.05 51.23 51.23 0 0 0-3.14-5.4c-0.22-0.34-0.45-0.67-0.69-1-1-1-2-2.06-2.15-2.16-0.92-0.9-2-1.71-2.89-2.58a53.85 53.85 0 0 0-5.81-3.3 57.32 57.32 0 0 0-7.16-1.93c-1.21-0.08-2.43-0.13-3.65-0.14H701.61zM860 2a10.13 10.13 0 0 0 1 1.27c0-0.09-0.43-0.63-1-1.27zM352.35 702.35l-0.35-0.35c-0.75-0.91-1.49-1.84-2.23-2.76-0.07-0.1-0.14-0.21-0.22-0.31a40.58 40.58 0 0 1 2.8 3.42zM643.69 730.32l-0.39 0.33c-0.91 0.75-1.83 1.48-2.76 2.22l-0.3 0.22a34 34 0 0 1 3.45-2.77z" horiz-adv-x="1024" /> |
| | | |
| | | |
| | | |
| | | |
| | | </font> |
| | | </defs></svg> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /** |
| | | * è¿éæ¯uni-appå
ç½®çå¸¸ç¨æ ·å¼åé |
| | | * |
| | | * uni-app 宿¹æ©å±æä»¶åæä»¶å¸åºï¼https://ext.dcloud.net.cnï¼ä¸å¾å¤ä¸æ¹æä»¶å使ç¨äºè¿äºæ ·å¼åé |
| | | * å¦æä½ æ¯æä»¶å¼åè
ï¼å»ºè®®ä½ 使ç¨scssé¢å¤çï¼å¹¶å¨æä»¶ä»£ç ä¸ç´æ¥ä½¿ç¨è¿äºåéï¼æ é import è¿ä¸ªæä»¶ï¼ï¼æ¹ä¾¿ç¨æ·éè¿æç§¯æ¨çæ¹å¼å¼åæ´ä½é£æ ¼ä¸è´çApp |
| | | * |
| | | */ |
| | | |
| | | /** |
| | | * å¦æä½ æ¯Appå¼åè
ï¼æä»¶ä½¿ç¨è
ï¼ï¼ä½ å¯ä»¥éè¿ä¿®æ¹è¿äºå鿥å®å¶èªå·±çæä»¶ä¸»é¢ï¼å®ç°èªå®ä¹ä¸»é¢åè½ |
| | | * |
| | | * å¦æä½ ç项ç®åæ ·ä½¿ç¨äºscssé¢å¤çï¼ä½ ä¹å¯ä»¥ç´æ¥å¨ä½ ç scss 代ç ä¸ä½¿ç¨å¦ä¸åéï¼åæ¶æ é import è¿ä¸ªæä»¶ |
| | | */ |
| | | /* uni.scss æä»¶ å¼å
¥uViewçå
¨å±SCSS䏻颿件 */ |
| | | @import 'uview-ui/theme.scss'; |
| | | /* é¢è²åé */ |
| | | |
| | | /* è¡ä¸ºç¸å
³é¢è² */ |
| | | $uni-color-primary: #007aff; |
| | | $uni-color-success: #4cd964; |
| | | $uni-color-warning: #f0ad4e; |
| | | $uni-color-error: #dd524d; |
| | | |
| | | /* æååºæ¬é¢è² */ |
| | | $uni-text-color:#333;//åºæ¬è² |
| | | $uni-text-color-inverse:#fff;//åè² |
| | | $uni-text-color-grey:#999;//è¾
å©ç°è²ï¼å¦å è½½æ´å¤çæç¤ºä¿¡æ¯ |
| | | $uni-text-color-placeholder: #808080; |
| | | $uni-text-color-disable:#c0c0c0; |
| | | |
| | | /* èæ¯é¢è² */ |
| | | $uni-bg-color:#ffffff; |
| | | $uni-bg-color-grey:#f8f8f8; |
| | | $uni-bg-color-hover:#f1f1f1;//ç¹å»ç¶æé¢è² |
| | | $uni-bg-color-mask:rgba(0, 0, 0, 0.4);//é®ç½©é¢è² |
| | | |
| | | /* è¾¹æ¡é¢è² */ |
| | | $uni-border-color:#c8c7cc; |
| | | |
| | | /* 尺寸åé */ |
| | | |
| | | /* æå尺寸 */ |
| | | $uni-font-size-sm:24rpx; |
| | | $uni-font-size-base:28rpx; |
| | | $uni-font-size-lg:32rpx; |
| | | |
| | | /* å¾ç尺寸 */ |
| | | $uni-img-size-sm:40rpx; |
| | | $uni-img-size-base:52rpx; |
| | | $uni-img-size-lg:80rpx; |
| | | |
| | | /* Border Radius */ |
| | | $uni-border-radius-sm: 4rpx; |
| | | $uni-border-radius-base: 6rpx; |
| | | $uni-border-radius-lg: 12rpx; |
| | | $uni-border-radius-circle: 50%; |
| | | |
| | | /* æ°´å¹³é´è· */ |
| | | $uni-spacing-row-sm: 10px; |
| | | $uni-spacing-row-base: 20rpx; |
| | | $uni-spacing-row-lg: 30rpx; |
| | | |
| | | /* åç´é´è· */ |
| | | $uni-spacing-col-sm: 8rpx; |
| | | $uni-spacing-col-base: 16rpx; |
| | | $uni-spacing-col-lg: 24rpx; |
| | | |
| | | /* éæåº¦ */ |
| | | $uni-opacity-disabled: 0.3; // ç»ä»¶ç¦ç¨æçéæåº¦ |
| | | |
| | | /* æç« åºæ¯ç¸å
³ */ |
| | | $uni-color-title: #2C405A; // æç« æ é¢é¢è² |
| | | $uni-font-size-title:40rpx; |
| | | $uni-color-subtitle: #555555; // äºçº§æ é¢é¢è² |
| | | $uni-font-size-subtitle:36rpx; |
| | | $uni-color-paragraph: #3F536E; // æç« 段è½é¢è² |
| | | $uni-font-size-paragraph:30rpx; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | ## 1.3.1ï¼2021-12-20ï¼ |
| | | - ä¿®å¤ å¨vue页é¢ä¸ç¥ç¼©å¾æ¾ç¤ºä¸æ£å¸¸çbug |
| | | ## 1.3.0ï¼2021-11-19ï¼ |
| | | - éæææ§½çç¨æ³ ï¼header æ¿æ¢ä¸º title |
| | | - æ°å¢ actions ææ§½ |
| | | - æ°å¢ cover å°é¢å¾å±æ§åææ§½ |
| | | - æ°å¢ padding å
容é»è®¤å
è¾¹è·ç¦» |
| | | - æ°å¢ margin å¡çé»è®¤å¤è¾¹è·ç¦» |
| | | - æ°å¢ spacing å¡çé»è®¤å
è¾¹è· |
| | | - æ°å¢ shadow å¡çé´å½±å±æ§ |
| | | - åæ¶ mode 屿§ï¼å¯ä½¿ç¨ç»åææ§½ä»£æ¿ |
| | | - åæ¶ note 屿§ ï¼ä½¿ç¨actionsææ§½ä»£æ¿ |
| | | - ä¼å ç»ä»¶UIï¼å¹¶æä¾è®¾è®¡èµæºï¼è¯¦è§:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
| | | - ææ¡£è¿ç§»ï¼è¯¦è§:[https://uniapp.dcloud.io/component/uniui/uni-card](https://uniapp.dcloud.io/component/uniui/uni-card) |
| | | ## 1.2.1ï¼2021-07-30ï¼ |
| | | - ä¼å vue3ä¸äºä»¶è¦åçé®é¢ |
| | | ## 1.2.0ï¼2021-07-13ï¼ |
| | | - ç»ä»¶å
¼å®¹ vue3ï¼å¦ä½å建vue3项ç®è¯¦è§ [uni-app é¡¹ç®æ¯æ vue3 ä»ç»](https://ask.dcloud.net.cn/article/37834) |
| | | ## 1.1.8ï¼2021-07-01ï¼ |
| | | - ä¼å 徿å¡çæ å¾çå è½½æ¶ï¼æä¾å ä½å¾æ |
| | | - æ°å¢ header ææ§½ï¼èªå®ä¹å¡ç头é¨ï¼ 徿å¡ç mode="style" æ¶ï¼ä¸æ¯æï¼ |
| | | - ä¿®å¤ thumbnail ä¸åå¨ä»ç¶å ä½ç bug |
| | | ## 1.1.7ï¼2021-05-12ï¼ |
| | | - æ°å¢ ç»ä»¶ç¤ºä¾å°å |
| | | ## 1.1.6ï¼2021-02-04ï¼ |
| | | - è°æ´ä¸ºuni_modulesç®å½è§è |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="uni-card" :class="{ 'uni-card--full': isFull, 'uni-card--shadow': isShadow,'uni-card--border':border}" |
| | | :style="{'margin':isFull?0:margin,'padding':spacing,'box-shadow':isShadow?shadow:''}"> |
| | | <!-- å°é¢ --> |
| | | <slot name="cover"> |
| | | <view v-if="cover" class="uni-card__cover"> |
| | | <image class="uni-card__cover-image" mode="widthFix" @click="onClick('cover')" :src="cover"></image> |
| | | </view> |
| | | </slot> |
| | | <slot name="title"> |
| | | <view v-if="title || extra" class="uni-card__header"> |
| | | <!-- å¡çæ é¢ --> |
| | | <view class="uni-card__header-box" @click="onClick('title')"> |
| | | <view v-if="thumbnail" class="uni-card__header-avatar"> |
| | | <image class="uni-card__header-avatar-image" :src="thumbnail" mode="aspectFit" /> |
| | | </view> |
| | | <view class="uni-card__header-content"> |
| | | <text class="uni-card__header-content-title uni-ellipsis">{{ title }}</text> |
| | | <text v-if="title&&subTitle" |
| | | class="uni-card__header-content-subtitle uni-ellipsis">{{ subTitle }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="uni-card__header-extra" @click="onClick('extra')"> |
| | | <slot name="extra"> |
| | | <text class="uni-card__header-extra-text">{{ extra }}</text> |
| | | </slot> |
| | | </view> |
| | | </view> |
| | | </slot> |
| | | <!-- å¡çå
容 --> |
| | | <view class="uni-card__content" :style="{padding:padding}" @click="onClick('content')"> |
| | | <slot></slot> |
| | | </view> |
| | | <view class="uni-card__actions" @click="onClick('actions')"> |
| | | <slot name="actions"></slot> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | /** |
| | | * Card å¡ç |
| | | * @description å¡çè§å¾ç»ä»¶ |
| | | * @tutorial https://ext.dcloud.net.cn/plugin?id=22 |
| | | * @property {String} title æ 颿å |
| | | * @property {String} subTitle 坿 é¢ |
| | | * @property {Number} padding å
容å
è¾¹è· |
| | | * @property {Number} margin å¡çå¤è¾¹è· |
| | | * @property {Number} spacing å¡çå
è¾¹è· |
| | | * @property {String} extra æ é¢é¢å¤ä¿¡æ¯ |
| | | * @property {String} cover å°é¢å¾ï¼æ¬å°è·¯å¾éè¦å¼å
¥ï¼ |
| | | * @property {String} thumbnail æ é¢å·¦ä¾§ç¼©ç¥å¾ |
| | | * @property {Boolean} is-full = [true | false] å¡çå
容æ¯å¦éæ ï¼ä¸º true æ¶å°å»é¤paddingå¼ |
| | | * @property {Boolean} is-shadow = [true | false] å¡çå
容æ¯å¦å¼å¯é´å½± |
| | | * @property {String} shadow å¡çé´å½± |
| | | * @property {Boolean} border å¡çè¾¹æ¡ |
| | | * @event {Function} click ç¹å» Card 触åäºä»¶ |
| | | */ |
| | | export default { |
| | | name: 'UniCard', |
| | | emits: ['click'], |
| | | props: { |
| | | title: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | subTitle: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | padding: { |
| | | type: String, |
| | | default: '10px' |
| | | }, |
| | | margin: { |
| | | type: String, |
| | | default: '15px' |
| | | }, |
| | | spacing: { |
| | | type: String, |
| | | default: '0 10px' |
| | | }, |
| | | extra: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | cover: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | thumbnail: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | isFull: { |
| | | // å
容åºåæ¯å¦éæ |
| | | type: Boolean, |
| | | default: false |
| | | }, |
| | | isShadow: { |
| | | // æ¯å¦å¼å¯é´å½± |
| | | type: Boolean, |
| | | default: true |
| | | }, |
| | | shadow: { |
| | | type: String, |
| | | default: '0px 0px 3px 1px rgba(0, 0, 0, 0.08)' |
| | | }, |
| | | border: { |
| | | type: Boolean, |
| | | default: true |
| | | } |
| | | }, |
| | | methods: { |
| | | onClick(type) { |
| | | this.$emit('click', type) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss"> |
| | | $uni-border-3: #EBEEF5 !default; |
| | | $uni-shadow-base:0 0px 6px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; |
| | | $uni-main-color: #3a3a3a !default; |
| | | $uni-base-color: #6a6a6a !default; |
| | | $uni-secondary-color: #909399 !default; |
| | | $uni-spacing-sm: 8px !default; |
| | | $uni-border-color:$uni-border-3; |
| | | $uni-shadow: $uni-shadow-base; |
| | | $uni-card-title: 15px; |
| | | $uni-cart-title-color:$uni-main-color; |
| | | $uni-card-subtitle: 12px; |
| | | $uni-cart-subtitle-color:$uni-secondary-color; |
| | | $uni-card-spacing: 10px; |
| | | $uni-card-content-color: $uni-base-color; |
| | | |
| | | .uni-card { |
| | | margin: $uni-card-spacing; |
| | | padding: 0 $uni-spacing-sm; |
| | | border-radius: 4px; |
| | | overflow: hidden; |
| | | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif; |
| | | background-color: #fff; |
| | | flex: 1; |
| | | |
| | | .uni-card__cover { |
| | | position: relative; |
| | | margin-top: $uni-card-spacing; |
| | | flex-direction: row; |
| | | overflow: hidden; |
| | | border-radius: 4px; |
| | | .uni-card__cover-image { |
| | | flex: 1; |
| | | // width: 100%; |
| | | /* #ifndef APP-PLUS */ |
| | | vertical-align: middle; |
| | | /* #endif */ |
| | | } |
| | | } |
| | | |
| | | .uni-card__header { |
| | | display: flex; |
| | | border-bottom: 1px $uni-border-color solid; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | padding: $uni-card-spacing; |
| | | overflow: hidden; |
| | | |
| | | .uni-card__header-box { |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | /* #endif */ |
| | | flex: 1; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | overflow: hidden; |
| | | } |
| | | |
| | | .uni-card__header-avatar { |
| | | width: 40px; |
| | | height: 40px; |
| | | overflow: hidden; |
| | | border-radius: 5px; |
| | | margin-right: $uni-card-spacing; |
| | | .uni-card__header-avatar-image { |
| | | flex: 1; |
| | | width: 40px; |
| | | height: 40px; |
| | | } |
| | | } |
| | | |
| | | .uni-card__header-content { |
| | | /* #ifndef APP-NVUE */ |
| | | display: flex; |
| | | /* #endif */ |
| | | flex-direction: column; |
| | | justify-content: center; |
| | | flex: 1; |
| | | // height: 40px; |
| | | overflow: hidden; |
| | | |
| | | .uni-card__header-content-title { |
| | | font-size: $uni-card-title; |
| | | color: $uni-cart-title-color; |
| | | // line-height: 22px; |
| | | } |
| | | |
| | | .uni-card__header-content-subtitle { |
| | | font-size: $uni-card-subtitle; |
| | | margin-top: 5px; |
| | | color: $uni-cart-subtitle-color; |
| | | } |
| | | } |
| | | |
| | | .uni-card__header-extra { |
| | | line-height: 12px; |
| | | |
| | | .uni-card__header-extra-text { |
| | | font-size: 12px; |
| | | color: $uni-cart-subtitle-color; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .uni-card__content { |
| | | padding: $uni-card-spacing; |
| | | font-size: 14px; |
| | | color: $uni-card-content-color; |
| | | line-height: 22px; |
| | | } |
| | | |
| | | .uni-card__actions { |
| | | font-size: 12px; |
| | | } |
| | | } |
| | | |
| | | .uni-card--border { |
| | | border: 1px solid $uni-border-color; |
| | | } |
| | | |
| | | .uni-card--shadow { |
| | | position: relative; |
| | | /* #ifndef APP-NVUE */ |
| | | box-shadow: $uni-shadow; |
| | | /* #endif */ |
| | | } |
| | | |
| | | .uni-card--full { |
| | | margin: 0; |
| | | border-left-width: 0; |
| | | border-left-width: 0; |
| | | border-radius: 0; |
| | | } |
| | | |
| | | /* #ifndef APP-NVUE */ |
| | | .uni-card--full:after { |
| | | border-radius: 0; |
| | | } |
| | | |
| | | /* #endif */ |
| | | .uni-ellipsis { |
| | | /* #ifndef APP-NVUE */ |
| | | overflow: hidden; |
| | | white-space: nowrap; |
| | | text-overflow: ellipsis; |
| | | /* #endif */ |
| | | /* #ifdef APP-NVUE */ |
| | | lines: 1; |
| | | /* #endif */ |
| | | } |
| | | </style> |
qqjf-PDA/uni_modules/uni-card/package.json
qqjf-PDA/uni_modules/uni-card/readme.md
qqjf-PDA/uni_modules/uni-datetime-picker/changelog.md
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue
qqjf-PDA/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js
qqjf-PDA/uni_modules/uni-datetime-picker/package.json
qqjf-PDA/uni_modules/uni-datetime-picker/readme.md
qqjf-PDA/uni_modules/uni-icons/changelog.md
qqjf-PDA/uni_modules/uni-icons/components/uni-icons/icons.js
qqjf-PDA/uni_modules/uni-icons/components/uni-icons/uni-icons.vue
qqjf-PDA/uni_modules/uni-icons/components/uni-icons/uniicons.css
qqjf-PDA/uni_modules/uni-icons/components/uni-icons/uniicons.ttf
qqjf-PDA/uni_modules/uni-icons/package.json
qqjf-PDA/uni_modules/uni-icons/readme.md
qqjf-PDA/uni_modules/uni-scss/changelog.md
qqjf-PDA/uni_modules/uni-scss/index.scss
qqjf-PDA/uni_modules/uni-scss/package.json
qqjf-PDA/uni_modules/uni-scss/readme.md
qqjf-PDA/uni_modules/uni-scss/styles/index.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_border.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_color.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_radius.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_space.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_styles.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_text.scss
qqjf-PDA/uni_modules/uni-scss/styles/setting/_variables.scss
qqjf-PDA/uni_modules/uni-scss/styles/tools/functions.scss
qqjf-PDA/uni_modules/uni-scss/theme.scss
qqjf-PDA/uni_modules/uni-scss/variables.scss
qqjf-PDA/uni_modules/uni-section/changelog.md
qqjf-PDA/uni_modules/uni-section/components/uni-section/uni-section.vue
qqjf-PDA/uni_modules/uni-section/package.json
qqjf-PDA/uni_modules/uni-section/readme.md
qqjf-PDA/unpackage/cache/apk/__UNI__EB80143_cm.apk
qqjf-PDA/unpackage/cache/apk/apkurl
qqjf-PDA/unpackage/cache/apk/cmManifestCache.json
qqjf-PDA/unpackage/cache/certdata
qqjf-PDA/unpackage/cache/cloudcertificate/certini
qqjf-PDA/unpackage/cache/cloudcertificate/package.keystore
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/.manifest/icon-android-hdpi.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/.manifest/icon-android-xhdpi.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/.manifest/icon-android-xxhdpi.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/.manifest/icon-android-xxxhdpi.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappchooselocation.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniapperror.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappes6.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappopenlocation.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniapppicker.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappquill.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappquillimageresize.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappscan.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappsuccess.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/__uniappview.html
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/app-config-service.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/app-config.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/app-service.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/app-view.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/manifest.json
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/css/iconfont.css
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/demo.css
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/demo_index.html
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.css
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.eot
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.js
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.json
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.svg
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.ttf
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.woff
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/iconfont/iconfont.woff2
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/1.jpg
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/1.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/2.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/headerImg/header01.jpg
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/headerImg/header02.jpg
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/login/logo-qq.jpg
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/logo-zhongke.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/image/logo.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/logo.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/ming-pop/close.png
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/static/musice/13716.wav
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/uni_modules/uni-icons/components/uni-icons/uniicons.ttf
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/view.css
qqjf-PDA/unpackage/cache/wgt/__UNI__EB80143/view.umd.min.js
qqjf-PDA/unpackage/dist/build/.automator/app-plus/.automator.json
qqjf-PDA/unpackage/dist/build/app-plus/__uniappchooselocation.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniapperror.png
qqjf-PDA/unpackage/dist/build/app-plus/__uniappes6.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniappopenlocation.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniapppicker.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniappquill.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniappquillimageresize.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniappscan.js
qqjf-PDA/unpackage/dist/build/app-plus/__uniappsuccess.png
qqjf-PDA/unpackage/dist/build/app-plus/__uniappview.html
qqjf-PDA/unpackage/dist/build/app-plus/app-config-service.js
qqjf-PDA/unpackage/dist/build/app-plus/app-config.js
qqjf-PDA/unpackage/dist/build/app-plus/app-service.js
qqjf-PDA/unpackage/dist/build/app-plus/app-view.js
qqjf-PDA/unpackage/dist/build/app-plus/manifest.json
qqjf-PDA/unpackage/dist/build/app-plus/static/css/iconfont.css
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/demo.css
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/demo_index.html
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.css
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.eot
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.js
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.json
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.svg
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.ttf
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.woff
qqjf-PDA/unpackage/dist/build/app-plus/static/iconfont/iconfont.woff2
qqjf-PDA/unpackage/dist/build/app-plus/static/image/1.jpg
qqjf-PDA/unpackage/dist/build/app-plus/static/image/1.png
qqjf-PDA/unpackage/dist/build/app-plus/static/image/2.png
qqjf-PDA/unpackage/dist/build/app-plus/static/image/headerImg/header01.jpg
qqjf-PDA/unpackage/dist/build/app-plus/static/image/headerImg/header02.jpg
qqjf-PDA/unpackage/dist/build/app-plus/static/image/login/logo-qq.jpg
qqjf-PDA/unpackage/dist/build/app-plus/static/image/logo-zhongke.png
qqjf-PDA/unpackage/dist/build/app-plus/static/image/logo.png
qqjf-PDA/unpackage/dist/build/app-plus/static/logo.png
qqjf-PDA/unpackage/dist/build/app-plus/static/ming-pop/close.png
qqjf-PDA/unpackage/dist/build/app-plus/static/musice/13716.wav
qqjf-PDA/unpackage/dist/build/app-plus/uni_modules/uni-icons/components/uni-icons/uniicons.ttf
qqjf-PDA/unpackage/dist/build/app-plus/view.css
qqjf-PDA/unpackage/dist/build/app-plus/view.umd.min.js
qqjf-PDA/unpackage/dist/dev/.automator/app-plus/.automator.json
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappchooselocation.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniapperror.png
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappes6.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappopenlocation.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniapppicker.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappquill.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappquillimageresize.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappscan.js
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappsuccess.png
qqjf-PDA/unpackage/dist/dev/app-plus/__uniappview.html
qqjf-PDA/unpackage/dist/dev/app-plus/app-config-service.js
qqjf-PDA/unpackage/dist/dev/app-plus/app-config.js
qqjf-PDA/unpackage/dist/dev/app-plus/app-service.js
qqjf-PDA/unpackage/dist/dev/app-plus/app-view.js
qqjf-PDA/unpackage/dist/dev/app-plus/manifest.json
qqjf-PDA/unpackage/dist/dev/app-plus/static/css/iconfont.css
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/demo.css
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/demo_index.html
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.css
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.eot
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.js
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.json
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.svg
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.ttf
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.woff
qqjf-PDA/unpackage/dist/dev/app-plus/static/iconfont/iconfont.woff2
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/1.jpg
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/1.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/2.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/headerImg/header01.jpg
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/headerImg/header02.jpg
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/login/logo-qq.jpg
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/logo-zhongke.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/image/logo.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/logo.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/ming-pop/close.png
qqjf-PDA/unpackage/dist/dev/app-plus/static/musice/13716.wav
qqjf-PDA/unpackage/dist/dev/app-plus/uni_modules/uni-icons/components/uni-icons/uniicons.ttf
qqjf-PDA/unpackage/dist/dev/app-plus/view.css
qqjf-PDA/unpackage/dist/dev/app-plus/view.umd.min.js
qqjf-PDA/unpackage/res/icons/1024x1024.png
qqjf-PDA/unpackage/res/icons/120x120.png
qqjf-PDA/unpackage/res/icons/144x144.png
qqjf-PDA/unpackage/res/icons/152x152.png
qqjf-PDA/unpackage/res/icons/167x167.png
qqjf-PDA/unpackage/res/icons/180x180.png
qqjf-PDA/unpackage/res/icons/192x192.png
qqjf-PDA/unpackage/res/icons/20x20.png
qqjf-PDA/unpackage/res/icons/29x29.png
qqjf-PDA/unpackage/res/icons/40x40.png
qqjf-PDA/unpackage/res/icons/58x58.png
qqjf-PDA/unpackage/res/icons/60x60.png
qqjf-PDA/unpackage/res/icons/72x72.png
qqjf-PDA/unpackage/res/icons/76x76.png
qqjf-PDA/unpackage/res/icons/80x80.png
qqjf-PDA/unpackage/res/icons/87x87.png
qqjf-PDA/unpackage/res/icons/96x96.png
qqjf-PDA/证书/346d807d61b542ed8f5a25f42c3ee847.keystore |