From 51c7896fd8e45085dd5cdfff11e79a00ee0a7379 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期五, 05 九月 2025 15:16:54 +0800 Subject: [PATCH] 上料/下料、报工/打印机配置/产线选择 、排产工单 --- pages/spare/spare.vue | 436 ++++- pages/home/home.vue | 112 common/service/config.service.js | 26 package-lock.json | 503 ++++++ pages/login/login.vue | 848 ++++++---- pages.json | 465 ++++- store/index.js | 411 +++-- common/router/index.js | 61 /dev/null | 279 --- pages/user/location.vue | 749 ++++++++- pages/user/people.vue | 12 common/router/modules/routes.js | 269 +++ manifest.json | 32 api/api.js | 4 package.json | 9 common/util/work.js | 219 + pages/index/index.vue | 7 pages/reportRepair/reportRepair.vue | 6 18 files changed, 3,088 insertions(+), 1,360 deletions(-) diff --git a/api/api.js b/api/api.js index e1f72f0..653ce30 100644 --- a/api/api.js +++ b/api/api.js @@ -8,6 +8,10 @@ login(params) { return http.post('/sys/login',params) }, + + getLineList(){ + return http.get('base/factory/queryUserProductionLineList') + }, /** * 鎵嬫満鍙风爜鐧诲綍 */ diff --git a/common/router/index.js b/common/router/index.js index 9b23857..f15dabf 100644 --- a/common/router/index.js +++ b/common/router/index.js @@ -1,64 +1,31 @@ import modules from './modules' import Vue from 'vue' import Router from '@/plugin/uni-simple-router/index.js' -import { - ACCESS_TOKEN -} from '@/common/util/constants.js' -import { - isOAuth2AppEnv -} from '@/common/util/util.js' +import {ACCESS_TOKEN} from '@/common/util/constants.js' Vue.use(Router) //鍒濆鍖� const router = new Router({ - - encodeURI: true, - routes: [...modules] //璺敱琛� + encodeURI:true, + routes: [...modules]//璺敱琛� }); -const whiteList = ['/pages/login/login', '/pages/login/loginOauth2'] +const whiteList = ['/pages/login/login'] //鍏ㄥ眬璺敱鍓嶇疆瀹堝崼 router.beforeEach((to, from, next) => { - if (to.path == '/oauth2-app/login') { - let temp = location.href; - location.href = temp.replace('/oauth2-app/login', '/pages/login/loginOauth2') - return; - } - let token = uni.getStorageSync(ACCESS_TOKEN); - if (token) { - if (to.path === '/pages/login/login' || to.path === '/pages/login/loginOauth2') { - // if (from.path === '/pages/index/index') { - // return; - // } else { - // next() - // } - next({ - path: '/pages/index/index' - }) - } - next() - } else { + let token=uni.getStorageSync(ACCESS_TOKEN); + if(token){ + next() + }else{ if (whiteList.indexOf(to.path) !== -1) { - // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝濡傛灉杩涘叆鐨勯〉闈㈡槸login椤甸潰骞朵笖褰撳墠鏄疧Auth2app鐜锛屽氨杩涘叆OAuth2鐧诲綍椤甸潰 - if (to.path === '/pages/login/login' && isOAuth2AppEnv()) { - next({ - path: '/pages/login/loginOauth2' - }) - } else { - // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆 - next() - } - } else { - // 濡傛灉褰撳墠鏄湪OAuth2APP鐜锛屽氨璺宠浆鍒癘Auth2鐧诲綍椤甸潰 - let path = isOAuth2AppEnv() ? '/pages/login/loginOauth2' : '/pages/login/login'; - next({ - path: path - }) + next() + }else{ + next({ path: '/pages/login/login'}) } - } + } }) // 鍏ㄥ眬璺敱鍚庣疆瀹堝崼 router.afterEach((to, from) => { console.log("afterEach") -}); -export default router; +}) +export default router; \ No newline at end of file diff --git a/common/router/modules/routes.js b/common/router/modules/routes.js index 0ce99a8..aa98c2c 100644 --- a/common/router/modules/routes.js +++ b/common/router/modules/routes.js @@ -188,7 +188,7 @@ title: '鍘嗗彶鐐规', }, }, - + { path: '/pages/checkList/checkListDetils/checkListDetils', name: 'checkListDetils', @@ -259,7 +259,7 @@ title: '鐐规-鎵ц', }, }, - + { path: '/pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure', name: 'ToDoListCheckSure', @@ -295,8 +295,8 @@ title: '閫夋嫨璁惧', }, }, - - + + { path: '/pages/reportRepair/reportRepairList/reportRepairList', name: 'reportRepairList', @@ -304,7 +304,7 @@ title: '鎶ヤ慨鍒楄〃', }, }, - + { path: '/pages/annotation/annotationDetail', name: 'annotationDetail', @@ -318,7 +318,266 @@ meta: { title: 'helloWorld', }, + }, + { + path: '/pages/eam/production/ProductionManager/ProductionManager', + name: 'ProductionManager', + meta: { + title: '鐢熶骇绠$悊', + }, + }, { + path: '/pages/eam/production/check/check', + name: 'check', + meta: { + title: '榻愬妫�鏌�', + }, + }, { + path: '/pages/eam/production/process/process', + name: 'process', + meta: { + title: '宸ヨ壓鐐规', + }, + }, { + path: '/pages/eam/production/sample/sample', + name: 'process', + meta: { + title: '鏍蜂欢鏍¢獙', + }, + }, { + path: '/pages/eam/production/feed/feed', + name: 'process', + meta: { + title: '涓婃枡', + }, + }, { + path: '/pages/eam/production/record/record', + name: 'record', + meta: { + title: '鎿嶄綔璁板綍', + }, + }, + { + path: '/pages/eam/quality/qualityInspection/qualityInspection', + name: 'qualityInspection', + meta: { + title: '璐ㄩ噺妫�楠�', + }, + }, + { + path: '/pages/eam/quality/defectiveProductReview/defectiveProductReview', + name: 'defectiveProductReview', + meta: { + title: '涓嶅悎鏍煎搧瀹$悊', + } + }, + { + path: '/pages/eam/quality/checkItem/checkItem', + name: 'checkItem', + meta: { + title: '妫�楠岄」', + } + }, + { + path: '/pages/eam/quality/productionInspection/productionInspection', + name: 'productionInspection', + meta: { + title: '鐢熶骇妫�楠�', + } + + }, { + path: '/pages/eam/quality/qualityInspection/addInspection/addInspection', + name: 'addInspection', + meta: { + title: '鏂板-鐢熶骇妫�楠�', + } + + }, + { + path: '/pages/eam/quality/checkItemDetail/checkItemDetail', + name: 'checkItemDetail', + meta: { + title: '妫�楠屾槑缁�', + } + + }, + { + path: '/pages/eam/quality/qualityInspectionDetail/qualityInspectionDetail', + name: 'qualityInspectionDetail', + meta: { + title: '璇︽儏', + } + + }, { + path: '/pages/eam/quality/inspectionDetail/inspectionDetail', + name: 'inspectionDetail', + meta: { + title: '妫�楠�-鏄庣粏', + } + + }, { + path: '/pages/eam/quality/reviewDocument/reviewDocument', + name: 'reviewDocument', + meta: { + title: '瀹$悊鍗�', + } + + }, + { + path: '/pages/eam/production/ToDoList/ToDoList', + name: 'ToDoList', + meta: { + title: '璁惧鐐规', + } + + }, { + path: '/pages/eam/andon/andonCall/andonCall', + name: 'andonCall', + meta: { + title: '瀹夌伅鍛煎彨', + } + + }, + { + path: '/pages/eam/andon/myInitiated/myInitiated', + name: 'myInitiated', + meta: { + title: '鎴戠殑鍙戣捣', + } + + }, { + path: '/pages/eam/andon/andonHandler/andonHandler', + name: 'andonHandler', + meta: { + title: '瀹夌伅澶勭疆', + } + + }, { + path: '/pages/eam/andon/andonAction/andonAction', + name: 'andonAction', + meta: { + title: '瀹夌伅濉姤', + } + + }, + { + path: '/pages/eam/andon/andonDetail/andonDetail', + name: 'andonAction', + meta: { + title: '瀹夌伅璇︽儏', + } + + }, + { + path: '/pages/eam/production/report/report', + name: 'report', + meta: { + title: '鎶ュ伐', + } + + }, { + path: '/pages/eam/andon/andonAdd/andonAdd', + name: 'andonAdd', + meta: { + title: '鏂板-瀹夌伅宸ュ崟', + } + + }, { + path: '/pages/lineSelect/lineSelect', + name: 'lineSelect', + meta: { + title: '閫夋嫨浜х嚎', + } + + }, + { + path: '/pages/selectUsers/selectUsers', + name: 'selectUsers', + meta: { + title: '閫夋嫨鐢ㄦ埛', + } + + }, { + path: '/pages/eam/andon/andonRespond/andonRespond', + name: 'andonRespond', + meta: { + title: '瀹夌伅鍝嶅簲', + } + + }, + { + path: '/pages/print-preview/print-preview', + name: 'print-preview', + meta: { + title: '绉诲簱鍗曢瑙�', + } + + }, + { + path: '/pages/finished-product-preview/finished-product-preview', + name: 'finished-product-preview', + meta: { + title: '鎴愬搧鏍囩棰勮', + } + + + }, + { + path: '/pages/inspection-tag-preview/inspection-tag-preview', + name: 'inspection-tag-preview', + meta: { + title: '妫�楠屾爣绛鹃瑙�', + } + + + }, + + { + path: '/pages/eam/production/materialLoading/materialLoading', + name: 'materialLoading', + meta: { + title: '涓婃枡', + } + + + }, + { + path: '/pages/eam/production/partBlanking/partBlanking', + name: 'partBlanking', + meta: { + title: '涓嬫枡', + } + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ] diff --git a/common/service/config.service.js b/common/service/config.service.js index f6f5691..ceb45f2 100644 --- a/common/service/config.service.js +++ b/common/service/config.service.js @@ -1,18 +1,20 @@ -let BASE_URL = '' -if (process.env.NODE_ENV == 'development') { +// let BASE_URL = 'http://192.168.1.14/jeecg-boot' +// if (process.env.NODE_ENV == 'development') { - BASE_URL = '/jeecg-boot' // 寮�鍙戠幆澧� -} else { - BASE_URL = '/jeecg-boot' // 鐢熶骇鐜 -} -let staticDomainURL ='/sys/common/static'; -// let staticURL ='http://125.76.225.53:8086/jeecg-boot/sys/common/static/'; -let staticURL ='https://fastwoke.cn:8087/jeecg-boot/sys/common/static/'; +let BASE_URL = 'http://192.168.43.223:9989/' +if (process.env.NODE_ENV == 'development') { + console.log(BASE_URL) + BASE_URL = uni.getStorageSync('base_url') ? uni.getStorageSync('base_url') : 'http://192.168.43.223:9989/' + +} else { + BASE_URL = uni.getStorageSync('base_url') ? uni.getStorageSync('base_url') : 'http://192.168.43.223:9989/' +} +let staticDomainURL = BASE_URL + '/sys/common/static'; + const configService = { apiUrl: BASE_URL, - staticDomainURL: staticDomainURL, - staticURL:staticURL + staticDomainURL: staticDomainURL }; -export default configService +export default configService \ No newline at end of file diff --git a/common/util/work.js b/common/util/work.js index a3ff9af..afc643a 100644 --- a/common/util/work.js +++ b/common/util/work.js @@ -2,32 +2,66 @@ * 甯哥敤鏈嶅姟 * useful server */ -const icon_prefix="/static/home/128/" +const icon_prefix = "/static/home/128/" -export const us = { - data:[ - { - title:"寰呭姙", - icon:icon_prefix+"todo.png", - description:"寰呭姙浜嬮」", - useCount:1000, - page:'ToDoList' - }, - { - title:"宸插姙", - icon:icon_prefix+"todoManger.png", - description:"宸插姙浜嬮」", - useCount:1000, - page:'TaskManagerList' +export const ps = { + data: [{ + title: "鎺掍骇宸ュ崟", + icon: icon_prefix + "todo.png", + description: "鎺掍骇宸ュ崟", + useCount: 1000, + page: 'ProductionManager' }, { - title:"鎵竴鎵�", - icon:icon_prefix+"icon_sacan.png", - description:"鎵爜", - useCount:10000, - page:'spare' - } - ] + title: "鎶ュ伐", + icon: icon_prefix + "icon_report.png", + description: "鎶ュ伐", + useCount: 1000, + page: 'report' + }, + { + title: "涓婃枡", + icon: icon_prefix + "icon_into.png", + description: "涓婃枡", + useCount: 1000, + page: 'materialLoading' + }, + { + title: "涓嬫枡", + icon: icon_prefix + "icon_out.png", + description: "涓嬫枡", + useCount: 1000, + page: 'ProductionManager' + }] +} + + + +export const us = { + data: [ + + { + title: "寰呭姙", + icon: icon_prefix + "todo.png", + description: "寰呭姙浜嬮」", + useCount: 1000, + page: 'ToDoList' + }, + { + title: "宸插姙", + icon: icon_prefix + "todoManger.png", + description: "宸插姙浜嬮」", + useCount: 1000, + page: 'TaskManagerList' + }, + { + title: "鎵竴鎵�", + icon: icon_prefix + "icon_sacan.png", + description: "鎵爜", + useCount: 10000, + page: 'spare' + } + ] } @@ -35,34 +69,60 @@ * other server 鍏朵粬鏈嶅姟 */ export const os = { - data:[ - { - title:"寰呯偣妫�", - icon:icon_prefix+"xinwen.png", - description:"璁惧鐐规", - useCount:10000, - page:'checkList' - },{ - title:"寰呭懆淇�", - icon:icon_prefix+"toupiao.png", - description:"璁惧鍛ㄤ繚", - useCount:10000, - page:'baoZhou' - }, - { - title:"鍘嗗彶鐐规", - icon:icon_prefix+"icon_historicalInspection.png", - description:"鍘嗗彶鐐规", - useCount:10000, - page:'historicalInspection' - },{ - title:"鍘嗗彶淇濆吇", - icon:icon_prefix+"icon_historicalMaintenance.png", - description:"鍘嗗彶淇濆吇", - useCount:10000, - page:'historicalMaintenance' - } - ] + data: [{ + title: "寰呯偣妫�", + icon: icon_prefix + "xinwen.png", + description: "璁惧鐐规", + useCount: 10000, + page: 'checkList' + }, { + title: "寰呭懆淇�", + icon: icon_prefix + "toupiao.png", + description: "璁惧鍛ㄤ繚", + useCount: 10000, + page: 'baoZhou' + }, + { + title: "鍘嗗彶鐐规", + icon: icon_prefix + "icon_historicalInspection.png", + description: "鍘嗗彶鐐规", + useCount: 10000, + page: 'historicalInspection' + }, { + title: "鍘嗗彶淇濆吇", + icon: icon_prefix + "icon_historicalMaintenance.png", + description: "鍘嗗彶淇濆吇", + useCount: 10000, + page: 'historicalMaintenance' + }, + { + title: "鍘嗗彶缁翠慨", + icon: icon_prefix + "historicalRepair.png", + description: "鍘嗗彶缁翠慨", + useCount: 10000, + page: 'historicalRepair' + }, + { + title: "鏁呴殰鎶ヤ慨", + icon: icon_prefix + "baoxiu.png", + description: "璁惧鎶ヤ慨", + useCount: 10000, + page: 'reportRepair' + }, { + title: "寰呯淮淇�", + icon: icon_prefix + "repair.png", + description: "璁惧缁翠慨", + useCount: 10000, + page: 'maintenanceReport' + }, + // { + // title: "璁惧鍙拌处", + // icon: icon_prefix + "repair.png", + // description: "璁惧鍙拌处", + // useCount: 10000, + // page: 'device' + // } + ] } @@ -71,25 +131,40 @@ * other server 鍏朵粬鏈嶅姟 */ export const ws = { - data:[ - { - title:"鎶ヤ慨", - icon:icon_prefix+"baoxiu.png", - description:"璁惧鎶ヤ慨", - useCount:10000, - page:'reportRepair' - },{ - title:"寰呯淮淇�", - icon:icon_prefix+"repair.png", - description:"璁惧缁翠慨", - useCount:10000, - page:'maintenanceReport' - },{ - title:"鍘嗗彶缁翠慨", - icon:icon_prefix+"historicalRepair.png", - description:"鍘嗗彶缁翠慨", - useCount:10000, - page:'historicalRepair' - } - ] + data: [{ + title: "璐ㄩ噺妫�楠�", + icon: icon_prefix + "icon_quality.png", + description: "璐ㄩ噺妫�楠�", + useCount: 10000, + page: 'qualityInspection' + }, + { + title: "涓嶅悎鏍煎搧瀹℃壒", + icon: icon_prefix + "icon_wait.png", + description: "涓嶅悎鏍煎搧瀹℃壒", + useCount: 10000, + page: 'defectiveProductReview' + } + ] +} + +/** + * other server 瀹夌伅鏈嶅姟 + */ +export const as = { + data: [{ + title: "瀹夌伅鍛煎彨", + icon: icon_prefix + "historicalRepair.png", + description: "瀹夌伅鍛煎彨", + useCount: 10000, + page: 'andonCall' + }, + { + title: "瀹夌伅澶勭悊", + icon: icon_prefix + "historicalRepair.png", + description: "瀹夌伅澶勭悊", + useCount: 10000, + page: 'andonHandler' + } + ] } \ No newline at end of file diff --git a/components/uni-calendar/calendar.js b/components/uni-calendar/calendar.js deleted file mode 100644 index b8d7d6f..0000000 --- a/components/uni-calendar/calendar.js +++ /dev/null @@ -1,546 +0,0 @@ -/** -* @1900-2100鍖洪棿鍐呯殑鍏巻銆佸啘鍘嗕簰杞� -* @charset UTF-8 -* @github https://github.com/jjonline/calendar.js -* @Author Jea鏉�(JJonline@JJonline.Cn) -* @Time 2014-7-21 -* @Time 2016-8-13 Fixed 2033hex銆丄ttribution Annals -* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug -* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year -* @Version 1.0.3 -* @鍏巻杞啘鍘嗭細calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] -* @鍐滃巻杞叕鍘嗭細calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] -*/ -/* eslint-disable */ -var calendar = { - - /** - * 鍐滃巻1900-2100鐨勬鼎澶у皬淇℃伅琛� - * @Array Of Property - * @return Hex - */ - lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909 - 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919 - 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929 - 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939 - 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949 - 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959 - 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969 - 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979 - 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989 - 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999 - 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009 - 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019 - 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029 - 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039 - 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049 - /** Add By JJonline@JJonline.Cn**/ - 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059 - 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069 - 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079 - 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089 - 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099 - 0x0d520], // 2100 - - /** - * 鍏巻姣忎釜鏈堜唤鐨勫ぉ鏁版櫘閫氳〃 - * @Array Of Property - * @return Number - */ - solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], - - /** - * 澶╁共鍦版敮涔嬪ぉ骞查�熸煡琛� - * @Array Of Property trans["鐢�","涔�","涓�","涓�","鎴�","宸�","搴�","杈�","澹�","鐧�"] - * @return Cn string - */ - Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'], - - /** - * 澶╁共鍦版敮涔嬪湴鏀�熸煡琛� - * @Array Of Property - * @trans["瀛�","涓�","瀵�","鍗�","杈�","宸�","鍗�","鏈�","鐢�","閰�","鎴�","浜�"] - * @return Cn string - */ - Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'], - - /** - * 澶╁共鍦版敮涔嬪湴鏀�熸煡琛�<=>鐢熻倴 - * @Array Of Property - * @trans["榧�","鐗�","铏�","鍏�","榫�","铔�","椹�","缇�","鐚�","楦�","鐙�","鐚�"] - * @return Cn string - */ - Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'], - - /** - * 24鑺傛皵閫熸煡琛� - * @Array Of Property - * @trans["灏忓瘨","澶у瘨","绔嬫槬","闆ㄦ按","鎯婅洶","鏄ュ垎","娓呮槑","璋烽洦","绔嬪","灏忔弧","鑺掔","澶忚嚦","灏忔殤","澶ф殤","绔嬬","澶勬殤","鐧介湶","绉嬪垎","瀵掗湶","闇滈檷","绔嬪啲","灏忛洩","澶ч洩","鍐嚦"] - * @return Cn string - */ - solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'], - - /** - * 1900-2100鍚勫勾鐨�24鑺傛皵鏃ユ湡閫熸煡琛� - * @Array Of Property - * @return 0x string For splice - */ - sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', - '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', - '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', - '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', - 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', - '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', - '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', - '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', - '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', - '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', - '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', - '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', - '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', - '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', - '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', - '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', - '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', - '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', - '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', - '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', - '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', - '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', - '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', - '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', - '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', - '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', - '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', - '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', - '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', - '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', - '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', - '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', - '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', - '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', - '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', - '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', - '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', - '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', - '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', - '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', - '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', - '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', - '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', - '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', - '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', - '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', - '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', - '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', - '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', - '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', - '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', - '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', - '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', - '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', - '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', - '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', - '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', - '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', - '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', - '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', - '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', - '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'], - - /** - * 鏁板瓧杞腑鏂囬�熸煡琛� - * @Array Of Property - * @trans ['鏃�','涓�','浜�','涓�','鍥�','浜�','鍏�','涓�','鍏�','涔�','鍗�'] - * @return Cn string - */ - nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'], - - /** - * 鏃ユ湡杞啘鍘嗙О鍛奸�熸煡琛� - * @Array Of Property - * @trans ['鍒�','鍗�','寤�','鍗�'] - * @return Cn string - */ - nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'], - - /** - * 鏈堜唤杞啘鍘嗙О鍛奸�熸煡琛� - * @Array Of Property - * @trans ['姝�','涓�','浜�','涓�','鍥�','浜�','鍏�','涓�','鍏�','涔�','鍗�','鍐�','鑵�'] - * @return Cn string - */ - nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'], - - /** - * 杩斿洖鍐滃巻y骞翠竴鏁村勾鐨勬�诲ぉ鏁� - * @param lunar Year - * @return Number - * @eg:var count = calendar.lYearDays(1987) ;//count=387 - */ - lYearDays: function (y) { - var i; var sum = 348 - for (i = 0x8000; i > 0x8; i >>= 1) { sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0 } - return (sum + this.leapDays(y)) - }, - - /** - * 杩斿洖鍐滃巻y骞撮棸鏈堟槸鍝釜鏈堬紱鑻骞存病鏈夐棸鏈� 鍒欒繑鍥�0 - * @param lunar Year - * @return Number (0-12) - * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 - */ - leapMonth: function (y) { // 闂板瓧缂栫爜 \u95f0 - return (this.lunarInfo[y - 1900] & 0xf) - }, - - /** - * 杩斿洖鍐滃巻y骞撮棸鏈堢殑澶╂暟 鑻ヨ骞存病鏈夐棸鏈堝垯杩斿洖0 - * @param lunar Year - * @return Number (0銆�29銆�30) - * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 - */ - leapDays: function (y) { - if (this.leapMonth(y)) { - return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29) - } - return (0) - }, - - /** - * 杩斿洖鍐滃巻y骞磎鏈堬紙闈為棸鏈堬級鐨勬�诲ぉ鏁帮紝璁$畻m涓洪棸鏈堟椂鐨勫ぉ鏁拌浣跨敤leapDays鏂规硶 - * @param lunar Year - * @return Number (-1銆�29銆�30) - * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 - */ - monthDays: function (y, m) { - if (m > 12 || m < 1) { return -1 }// 鏈堜唤鍙傛暟浠�1鑷�12锛屽弬鏁伴敊璇繑鍥�-1 - return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29) - }, - - /** - * 杩斿洖鍏巻(!)y骞磎鏈堢殑澶╂暟 - * @param solar Year - * @return Number (-1銆�28銆�29銆�30銆�31) - * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 - */ - solarDays: function (y, m) { - if (m > 12 || m < 1) { return -1 } // 鑻ュ弬鏁伴敊璇� 杩斿洖-1 - var ms = m - 1 - if (ms == 1) { // 2鏈堜唤鐨勯棸骞宠寰嬫祴绠楀悗纭杩斿洖28鎴�29 - return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28) - } else { - return (this.solarMonth[ms]) - } - }, - - /** - * 鍐滃巻骞翠唤杞崲涓哄共鏀邯骞� - * @param lYear 鍐滃巻骞寸殑骞翠唤鏁� - * @return Cn string - */ - toGanZhiYear: function (lYear) { - var ganKey = (lYear - 3) % 10 - var zhiKey = (lYear - 3) % 12 - if (ganKey == 0) ganKey = 10// 濡傛灉浣欐暟涓�0鍒欎负鏈�鍚庝竴涓ぉ骞� - if (zhiKey == 0) zhiKey = 12// 濡傛灉浣欐暟涓�0鍒欎负鏈�鍚庝竴涓湴鏀� - return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1] - }, - - /** - * 鍏巻鏈堛�佹棩鍒ゆ柇鎵�灞炴槦搴� - * @param cMonth [description] - * @param cDay [description] - * @return Cn string - */ - toAstro: function (cMonth, cDay) { - var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf' - var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22] - return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7'// 搴� - }, - - /** - * 浼犲叆offset鍋忕Щ閲忚繑鍥炲共鏀� - * @param offset 鐩稿鐢插瓙鐨勫亸绉婚噺 - * @return Cn string - */ - toGanZhi: function (offset) { - return this.Gan[offset % 10] + this.Zhi[offset % 12] - }, - - /** - * 浼犲叆鍏巻(!)y骞磋幏寰楄骞寸n涓妭姘旂殑鍏巻鏃ユ湡 - * @param y鍏巻骞�(1900-2100)锛沶浜屽崄鍥涜妭姘斾腑鐨勭鍑犱釜鑺傛皵(1~24)锛涗粠n=1(灏忓瘨)绠楄捣 - * @return day Number - * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;鎰忓嵆1987骞�2鏈�4鏃ョ珛鏄� - */ - getTerm: function (y, n) { - if (y < 1900 || y > 2100) { return -1 } - if (n < 1 || n > 24) { return -1 } - var _table = this.sTermInfo[y - 1900] - var _info = [ - parseInt('0x' + _table.substr(0, 5)).toString(), - parseInt('0x' + _table.substr(5, 5)).toString(), - parseInt('0x' + _table.substr(10, 5)).toString(), - parseInt('0x' + _table.substr(15, 5)).toString(), - parseInt('0x' + _table.substr(20, 5)).toString(), - parseInt('0x' + _table.substr(25, 5)).toString() - ] - var _calday = [ - _info[0].substr(0, 1), - _info[0].substr(1, 2), - _info[0].substr(3, 1), - _info[0].substr(4, 2), - - _info[1].substr(0, 1), - _info[1].substr(1, 2), - _info[1].substr(3, 1), - _info[1].substr(4, 2), - - _info[2].substr(0, 1), - _info[2].substr(1, 2), - _info[2].substr(3, 1), - _info[2].substr(4, 2), - - _info[3].substr(0, 1), - _info[3].substr(1, 2), - _info[3].substr(3, 1), - _info[3].substr(4, 2), - - _info[4].substr(0, 1), - _info[4].substr(1, 2), - _info[4].substr(3, 1), - _info[4].substr(4, 2), - - _info[5].substr(0, 1), - _info[5].substr(1, 2), - _info[5].substr(3, 1), - _info[5].substr(4, 2) - ] - return parseInt(_calday[n - 1]) - }, - - /** - * 浼犲叆鍐滃巻鏁板瓧鏈堜唤杩斿洖姹夎閫氫織琛ㄧず娉� - * @param lunar month - * @return Cn string - * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='鑵婃湀' - */ - toChinaMonth: function (m) { // 鏈� => \u6708 - if (m > 12 || m < 1) { return -1 } // 鑻ュ弬鏁伴敊璇� 杩斿洖-1 - var s = this.nStr3[m - 1] - s += '\u6708'// 鍔犱笂鏈堝瓧 - return s - }, - - /** - * 浼犲叆鍐滃巻鏃ユ湡鏁板瓧杩斿洖姹夊瓧琛ㄧず娉� - * @param lunar day - * @return Cn string - * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='寤夸竴' - */ - toChinaDay: function (d) { // 鏃� => \u65e5 - var s - switch (d) { - case 10: - s = '\u521d\u5341'; break - case 20: - s = '\u4e8c\u5341'; break - break - case 30: - s = '\u4e09\u5341'; break - break - default : - s = this.nStr2[Math.floor(d / 10)] - s += this.nStr1[d % 10] - } - return (s) - }, - - /** - * 骞翠唤杞敓鑲朳!浠呰兘澶ц嚧杞崲] => 绮剧‘鍒掑垎鐢熻倴鍒嗙晫绾挎槸鈥滅珛鏄モ�� - * @param y year - * @return Cn string - * @eg:var animal = calendar.getAnimal(1987) ;//animal='鍏�' - */ - getAnimal: function (y) { - return this.Animals[(y - 4) % 12] - }, - - /** - * 浼犲叆闃冲巻骞存湀鏃ヨ幏寰楄缁嗙殑鍏巻銆佸啘鍘唎bject淇℃伅 <=>JSON - * @param y solar year - * @param m solar month - * @param d solar day - * @return JSON object - * @eg:console.log(calendar.solar2lunar(1987,11,01)); - */ - solar2lunar: function (y, m, d) { // 鍙傛暟鍖洪棿1900.1.31~2100.12.31 - // 骞翠唤闄愬畾銆佷笂闄� - if (y < 1900 || y > 2100) { - return -1// undefined杞崲涓烘暟瀛楀彉涓篘aN - } - // 鍏巻浼犲弬鏈�涓嬮檺 - if (y == 1900 && m == 1 && d < 31) { - return -1 - } - // 鏈紶鍙� 鑾峰緱褰撳ぉ - if (!y) { - var objDate = new Date() - } else { - var objDate = new Date(y, parseInt(m) - 1, d) - } - var i; var leap = 0; var temp = 0 - // 淇ymd鍙傛暟 - var y = objDate.getFullYear() - var m = objDate.getMonth() + 1 - var d = objDate.getDate() - var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 86400000 - for (i = 1900; i < 2101 && offset > 0; i++) { - temp = this.lYearDays(i) - offset -= temp - } - if (offset < 0) { - offset += temp; i-- - } - - // 鏄惁浠婂ぉ - var isTodayObj = new Date() - var isToday = false - if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { - isToday = true - } - // 鏄熸湡鍑� - var nWeek = objDate.getDay() - var cWeek = this.nStr1[nWeek] - // 鏁板瓧琛ㄧず鍛ㄥ嚑椤哄簲澶╂湞鍛ㄤ竴寮�濮嬬殑鎯緥 - if (nWeek == 0) { - nWeek = 7 - } - // 鍐滃巻骞� - var year = i - var leap = this.leapMonth(i) // 闂板摢涓湀 - var isLeap = false - - // 鏁堥獙闂版湀 - for (i = 1; i < 13 && offset > 0; i++) { - // 闂版湀 - if (leap > 0 && i == (leap + 1) && isLeap == false) { - --i - isLeap = true; temp = this.leapDays(year) // 璁$畻鍐滃巻闂版湀澶╂暟 - } else { - temp = this.monthDays(year, i)// 璁$畻鍐滃巻鏅�氭湀澶╂暟 - } - // 瑙i櫎闂版湀 - if (isLeap == true && i == (leap + 1)) { isLeap = false } - offset -= temp - } - // 闂版湀瀵艰嚧鏁扮粍涓嬫爣閲嶅彔鍙栧弽 - if (offset == 0 && leap > 0 && i == leap + 1) { - if (isLeap) { - isLeap = false - } else { - isLeap = true; --i - } - } - if (offset < 0) { - offset += temp; --i - } - // 鍐滃巻鏈� - var month = i - // 鍐滃巻鏃� - var day = offset + 1 - // 澶╁共鍦版敮澶勭悊 - var sm = m - 1 - var gzY = this.toGanZhiYear(year) - - // 褰撴湀鐨勪袱涓妭姘� - // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` - var firstNode = this.getTerm(y, (m * 2 - 1))// 杩斿洖褰撴湀銆岃妭銆嶄负鍑犳棩寮�濮� - var secondNode = this.getTerm(y, (m * 2))// 杩斿洖褰撴湀銆岃妭銆嶄负鍑犳棩寮�濮� - - // 渚濇嵁12鑺傛皵淇骞叉敮鏈� - var gzM = this.toGanZhi((y - 1900) * 12 + m + 11) - if (d >= firstNode) { - gzM = this.toGanZhi((y - 1900) * 12 + m + 12) - } - - // 浼犲叆鐨勬棩鏈熺殑鑺傛皵涓庡惁 - var isTerm = false - var Term = null - if (firstNode == d) { - isTerm = true - Term = this.solarTerm[m * 2 - 2] - } - if (secondNode == d) { - isTerm = true - Term = this.solarTerm[m * 2 - 1] - } - // 鏃ユ煴 褰撴湀涓�鏃ヤ笌 1900/1/1 鐩稿樊澶╂暟 - var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10 - var gzD = this.toGanZhi(dayCyclical + d - 1) - // 璇ユ棩鏈熸墍灞炵殑鏄熷骇 - var astro = this.toAstro(m, d) - - return { 'lYear': year, 'lMonth': month, 'lDay': day, 'Animal': this.getAnimal(year), 'IMonthCn': (isLeap ? '\u95f0' : '') + this.toChinaMonth(month), 'IDayCn': this.toChinaDay(day), 'cYear': y, 'cMonth': m, 'cDay': d, 'gzYear': gzY, 'gzMonth': gzM, 'gzDay': gzD, 'isToday': isToday, 'isLeap': isLeap, 'nWeek': nWeek, 'ncWeek': '\u661f\u671f' + cWeek, 'isTerm': isTerm, 'Term': Term, 'astro': astro } - }, - - /** - * 浼犲叆鍐滃巻骞存湀鏃ヤ互鍙婁紶鍏ョ殑鏈堜唤鏄惁闂版湀鑾峰緱璇︾粏鐨勫叕鍘嗐�佸啘鍘唎bject淇℃伅 <=>JSON - * @param y lunar year - * @param m lunar month - * @param d lunar day - * @param isLeapMonth lunar month is leap or not.[濡傛灉鏄啘鍘嗛棸鏈堢鍥涗釜鍙傛暟璧嬪�紅rue鍗冲彲] - * @return JSON object - * @eg:console.log(calendar.lunar2solar(1987,9,10)); - */ - lunar2solar: function (y, m, d, isLeapMonth) { // 鍙傛暟鍖洪棿1900.1.31~2100.12.1 - var isLeapMonth = !!isLeapMonth - var leapOffset = 0 - var leapMonth = this.leapMonth(y) - var leapDay = this.leapDays(y) - if (isLeapMonth && (leapMonth != m)) { return -1 }// 浼犲弬瑕佹眰璁$畻璇ラ棸鏈堝叕鍘� 浣嗚骞村緱鍑虹殑闂版湀涓庝紶鍙傜殑鏈堜唤骞朵笉鍚� - if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { return -1 }// 瓒呭嚭浜嗘渶澶ф瀬闄愬�� - var day = this.monthDays(y, m) - var _day = day - // bugFix 2016-9-25 - // if month is leap, _day use leapDays method - if (isLeapMonth) { - _day = this.leapDays(y, m) - } - if (y < 1900 || y > 2100 || d > _day) { return -1 }// 鍙傛暟鍚堟硶鎬ф晥楠� - - // 璁$畻鍐滃巻鐨勬椂闂村樊 - var offset = 0 - for (var i = 1900; i < y; i++) { - offset += this.lYearDays(i) - } - var leap = 0; var isAdd = false - for (var i = 1; i < m; i++) { - leap = this.leapMonth(y) - if (!isAdd) { // 澶勭悊闂版湀 - if (leap <= i && leap > 0) { - offset += this.leapDays(y); isAdd = true - } - } - offset += this.monthDays(y, i) - } - // 杞崲闂版湀鍐滃巻 闇�琛ュ厖璇ュ勾闂版湀鐨勫墠涓�涓湀鐨勬椂宸� - if (isLeapMonth) { offset += day } - // 1900骞村啘鍘嗘鏈堜竴鏃ョ殑鍏巻鏃堕棿涓�1900骞�1鏈�30鏃�0鏃�0鍒�0绉�(璇ユ椂闂翠篃鏄湰鍐滃巻鐨勬渶寮�濮嬭捣濮嬬偣) - var stmap = Date.UTC(1900, 1, 30, 0, 0, 0) - var calObj = new Date((offset + d - 31) * 86400000 + stmap) - var cY = calObj.getUTCFullYear() - var cM = calObj.getUTCMonth() + 1 - var cD = calObj.getUTCDate() - - return this.solar2lunar(cY, cM, cD) - } -} - -export default calendar diff --git a/components/uni-calendar/uni-calendar-item.vue b/components/uni-calendar/uni-calendar-item.vue deleted file mode 100644 index 7fc6366..0000000 --- a/components/uni-calendar/uni-calendar-item.vue +++ /dev/null @@ -1,179 +0,0 @@ -<template> - <view class="uni-calendar-item__weeks-box" :class="{ - 'uni-calendar-item--disable':weeks.disable, - 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, - 'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) , - 'uni-calendar-item--before-checked':weeks.beforeMultiple, - 'uni-calendar-item--multiple': weeks.multiple, - 'uni-calendar-item--after-checked':weeks.afterMultiple, - }" - @click="choiceDate(weeks)"> - <view class="uni-calendar-item__weeks-box-item"> - <text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text> - <text class="uni-calendar-item__weeks-box-text" :class="{ - 'uni-calendar-item--isDay-text': weeks.isDay, - 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, - 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, - 'uni-calendar-item--before-checked':weeks.beforeMultiple, - 'uni-calendar-item--multiple': weeks.multiple, - 'uni-calendar-item--after-checked':weeks.afterMultiple, - 'uni-calendar-item--disable':weeks.disable, - }">{{weeks.date}}</text> - <text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{ - 'uni-calendar-item--isDay-text':weeks.isDay, - 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, - 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, - 'uni-calendar-item--before-checked':weeks.beforeMultiple, - 'uni-calendar-item--multiple': weeks.multiple, - 'uni-calendar-item--after-checked':weeks.afterMultiple, - }">浠婂ぉ</text> - <text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{ - 'uni-calendar-item--isDay-text':weeks.isDay, - 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, - 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, - 'uni-calendar-item--before-checked':weeks.beforeMultiple, - 'uni-calendar-item--multiple': weeks.multiple, - 'uni-calendar-item--after-checked':weeks.afterMultiple, - 'uni-calendar-item--disable':weeks.disable, - }">{{weeks.isDay?'浠婂ぉ': (weeks.lunar.IDayCn === '鍒濅竴'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text> - <text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{ - 'uni-calendar-item--extra':weeks.extraInfo.info, - 'uni-calendar-item--isDay-text':weeks.isDay, - 'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay, - 'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay, - 'uni-calendar-item--before-checked':weeks.beforeMultiple, - 'uni-calendar-item--multiple': weeks.multiple, - 'uni-calendar-item--after-checked':weeks.afterMultiple, - 'uni-calendar-item--disable':weeks.disable, - }">{{weeks.extraInfo.info}}</text> - </view> - </view> -</template> - -<script> - export default { - props: { - weeks: { - type: Object, - default () { - return {} - } - }, - calendar: { - type: Object, - default: () => { - return {} - } - }, - selected: { - type: Array, - default: () => { - return [] - } - }, - lunar: { - type: Boolean, - default: false - } - }, - methods: { - choiceDate(weeks) { - this.$emit('change', weeks) - } - } - } -</script> - -<style lang="scss" scoped> - .uni-calendar-item__weeks-box { - flex: 1; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: column; - justify-content: center; - align-items: center; - } - - .uni-calendar-item__weeks-box-text { - font-size: $uni-font-size-base; - color: $uni-text-color; - } - - .uni-calendar-item__weeks-lunar-text { - font-size: $uni-font-size-sm; - color: $uni-text-color; - } - - .uni-calendar-item__weeks-box-item { - position: relative; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: column; - justify-content: center; - align-items: center; - width: 100rpx; - height: 100rpx; - } - - /* .uni-calendar-item__weeks-box-circle { - position: absolute; - top: 5px; - right: 5px; - width: 8px; - height: 8px; - border-radius: 8px; - background-color: $uni-color-error; - } */ - .uni-calendar-item__weeks-box-circle{ - position: absolute; - top: 37px; - right: 23px; - width: 3px; - height: 3px; - border-radius: 3px; - //background-color: $uni-color-primary; - background-color: $uni-color-error; - } - - .uni-calendar-item--disable { - background-color: rgba(249, 249, 249, $uni-opacity-disabled); - color: $uni-text-color-disable; - } - - .uni-calendar-item--isDay-text { - color: $uni-color-primary; - } - - .uni-calendar-item--isDay { - background-color: $uni-color-primary; - opacity: 0.8; - color: #fff; - } - - .uni-calendar-item--extra { - color: $uni-color-error; - opacity: 0.8; - } - - .uni-calendar-item--checked { - background-color: $uni-color-primary; - color: #fff; - opacity: 0.8; - } - - .uni-calendar-item--multiple { - background-color: $uni-color-primary; - color: #fff; - opacity: 0.8; - } - .uni-calendar-item--before-checked { - background-color: #ff5a5f; - color: #fff; - } - .uni-calendar-item--after-checked { - background-color: #ff5a5f; - color: #fff; - } -</style> diff --git a/components/uni-calendar/uni-calendar.vue b/components/uni-calendar/uni-calendar.vue deleted file mode 100644 index f9f521e..0000000 --- a/components/uni-calendar/uni-calendar.vue +++ /dev/null @@ -1,512 +0,0 @@ -<template> - <view class="uni-calendar"> - <view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view> - <view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}"> - <view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top"> - <view class="uni-calendar__header-btn-box" @click="close"> - <text class="uni-calendar__header-text uni-calendar--fixed-width">鍙栨秷</text> - </view> - <view class="uni-calendar__header-btn-box" @click="confirm"> - <text class="uni-calendar__header-text uni-calendar--fixed-width">纭畾</text> - </view> - </view> - <view class="uni-calendar__header"> - <view class="uni-calendar__header-btn-box" @click.stop="pre"> - <view class="uni-calendar__header-btn uni-calendar--left"></view> - </view> - <picker mode="date" :value="date" fields="month" @change="bindDateChange"> - <text class="uni-calendar__header-text">{{ (nowDate.year||'') +'骞�'+( nowDate.month||'') +'鏈�'}}</text> - </picker> - <view class="uni-calendar__header-btn-box" @click.stop="next"> - <view class="uni-calendar__header-btn uni-calendar--right"></view> - </view> - <text class="uni-calendar__backtoday" @click="backtoday">鍥炲埌浠婂ぉ</text> - - </view> - <view class="uni-calendar__box"> - <view v-if="showMonth" class="uni-calendar__box-bg"> - <text class="uni-calendar__box-bg-text">{{nowDate.month}}</text> - </view> - <view class="uni-calendar__weeks"> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">鏃�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">涓�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">浜�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">涓�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">鍥�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">浜�</text> - </view> - <view class="uni-calendar__weeks-day"> - <text class="uni-calendar__weeks-day-text">鍏�</text> - </view> - </view> - <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> - <view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex"> - <calendar-item :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item> - </view> - </view> - </view> - </view> - </view> -</template> - -<script> - import Calendar from './util.js'; - import calendarItem from './uni-calendar-item.vue' - /** - * Calendar 鏃ュ巻 - * @description 鏃ュ巻缁勪欢鍙互鏌ョ湅鏃ユ湡锛岄�夋嫨浠绘剰鑼冨洿鍐呯殑鏃ユ湡锛屾墦鐐规搷浣溿�傚父鐢ㄥ満鏅锛氶厭搴楁棩鏈熼璁€�佺伀杞︽満绁ㄩ�夋嫨璐拱鏃ユ湡銆佷笂涓嬬彮鎵撳崱绛� - * @tutorial https://ext.dcloud.net.cn/plugin?id=56 - * @property {String} date 鑷畾涔夊綋鍓嶆椂闂达紝榛樿涓轰粖澶� - * @property {Boolean} lunar 鏄剧ず鍐滃巻 - * @property {String} startDate 鏃ユ湡閫夋嫨鑼冨洿-寮�濮嬫棩鏈� - * @property {String} endDate 鏃ユ湡閫夋嫨鑼冨洿-缁撴潫鏃ユ湡 - * @property {Boolean} range 鑼冨洿閫夋嫨 - * @property {Boolean} insert = [true|false] 鎻掑叆妯″紡,榛樿涓篺alse - * @value true 寮圭獥妯″紡 - * @value false 鎻掑叆妯″紡 - * @property {Boolean} clearDate = [true|false] 寮圭獥妯″紡鏄惁娓呯┖涓婃閫夋嫨鍐呭 - * @property {Array} selected 鎵撶偣锛屾湡寰呮牸寮廩{date: '2019-06-27', info: '绛惧埌', data: { custom: '鑷畾涔変俊鎭�', name: '鑷畾涔夋秷鎭ご',xxx:xxx... }}] - * @property {Boolean} showMonth 鏄惁閫夋嫨鏈堜唤涓鸿儗鏅� - * @event {Function} change 鏃ユ湡鏀瑰彉锛宍insert :ture` 鏃剁敓鏁� - * @event {Function} confirm 纭閫夋嫨`insert :false` 鏃剁敓鏁� - * @event {Function} monthSwitch 鍒囨崲鏈堜唤鏃惰Е鍙� - * @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" /> - */ - export default { - components: { - calendarItem - }, - props: { - date: { - type: String, - default: '' - }, - selected: { - type: Array, - default () { - return [] - } - }, - lunar: { - type: Boolean, - default: false - }, - startDate: { - type: String, - default: '' - }, - endDate: { - type: String, - default: '' - }, - range: { - type: Boolean, - default: false - }, - insert: { - type: Boolean, - default: true - }, - showMonth: { - type: Boolean, - default: true - }, - clearDate: { - type: Boolean, - default: true - } - }, - data() { - return { - show: false, - weeks: [], - calendar: {}, - nowDate: '', - aniMaskShow: false - } - }, - watch: { - date(newVal) { - this.cale.setDate(newVal) - this.init(this.cale.selectDate.fullDate) - }, - startDate(val){ - this.cale.resetSatrtDate(val) - }, - endDate(val){ - this.cale.resetEndDate(val) - }, - selected(newVal) { - this.cale.setSelectInfo(this.nowDate.fullDate, newVal) - this.weeks = this.cale.weeks - } - }, - created() { - // 鑾峰彇鏃ュ巻鏂规硶瀹炰緥 - this.cale = new Calendar({ - // date: new Date(), - selected: this.selected, - startDate: this.startDate, - endDate: this.endDate, - range: this.range, - }) - // 閫変腑鏌愪竴澶� - this.cale.setDate(this.date) - this.init(this.cale.selectDate.fullDate) - // this.setDay - }, - methods: { - // 鍙栨秷绌块�� - clean() {}, - bindDateChange(e) { - const value = e.detail.value + '-1' - console.log(this.cale.getDate(value)); - this.cale.setDate(value) - this.init(value) - }, - /** - * 鍒濆鍖栨棩鏈熸樉绀� - * @param {Object} date - */ - init(date) { - this.weeks = this.cale.weeks - this.nowDate = this.calendar = this.cale.getInfo(date) - console.log("this.weeks",this.weeks) - }, - /** - * 鎵撳紑鏃ュ巻寮圭獥 - */ - open() { - // 寮圭獥妯″紡骞朵笖娓呯悊鏁版嵁 - if (this.clearDate && !this.insert) { - this.cale.cleanMultipleStatus() - this.cale.setDate(this.date) - this.init(this.cale.selectDate.fullDate) - } - this.show = true - this.$nextTick(() => { - setTimeout(() => { - this.aniMaskShow = true - }, 50) - }) - }, - /** - * 鍏抽棴鏃ュ巻寮圭獥 - */ - close() { - this.aniMaskShow = false - this.$nextTick(() => { - setTimeout(() => { - this.show = false - this.$emit('close') - }, 300) - }) - }, - /** - * 纭鎸夐挳 - */ - confirm() { - this.setEmit('confirm') - this.close() - }, - /** - * 鍙樺寲瑙﹀彂 - */ - change() { - if (!this.insert) return - this.setEmit('change') - }, - /** - * 閫夋嫨鏈堜唤瑙﹀彂 - */ - monthSwitch() { - let { - year, - month - } = this.nowDate - this.$emit('monthSwitch', { - year, - month: Number(month) - }) - }, - /** - * 娲惧彂浜嬩欢 - * @param {Object} name - */ - setEmit(name) { - let { - year, - month, - date, - fullDate, - lunar, - extraInfo - } = this.calendar - this.$emit(name, { - range: this.cale.multipleStatus, - year, - month, - date, - fulldate: fullDate, - lunar, - extraInfo: extraInfo || {} - }) - }, - /** - * 閫夋嫨澶╄Е鍙� - * @param {Object} weeks - */ - choiceDate(weeks) { - console.log(weeks) - if (weeks.disable){ - //this.next() - return - } - this.calendar = weeks - // 璁剧疆澶氶�� - this.cale.setMultiple(this.calendar.fullDate) - this.weeks = this.cale.weeks - this.change() - }, - /** - * 鍥炲埌浠婂ぉ - */ - backtoday() { - console.log(this.cale.getDate(new Date()).fullDate); - let date = this.cale.getDate(new Date()).fullDate - this.cale.setDate(date) - this.init(date) - this.change() - }, - /** - * 涓婁釜鏈� - */ - pre() { - const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate - this.setDate(preDate) - this.monthSwitch() - this.$emit("monthChange",preDate) - }, - /** - * 涓嬩釜鏈� - */ - next() { - const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate - this.setDate(nextDate) - this.monthSwitch() - this.$emit("monthChange",nextDate) - }, - /** - * 璁剧疆鏃ユ湡 - * @param {Object} date - */ - setDate(date) { - this.cale.setDate(date) - this.weeks = this.cale.weeks - this.nowDate = this.cale.getInfo(date) - } - } - } -</script> - -<style lang="scss" scoped> - .uni-calendar { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: column; - } - - .uni-calendar__mask { - position: fixed; - bottom: 0; - top: 0; - left: 0; - right: 0; - background-color: $uni-bg-color-mask; - transition-property: opacity; - transition-duration: 0.3s; - opacity: 0; - /* #ifndef APP-NVUE */ - z-index: 99; - /* #endif */ - } - - .uni-calendar--mask-show { - opacity: 1 - } - - .uni-calendar--fixed { - position: fixed; - bottom: 0; - left: 0; - right: 0; - transition-property: transform; - transition-duration: 0.3s; - transform: translateY(460px); - /* #ifndef APP-NVUE */ - z-index: 99; - /* #endif */ - } - - .uni-calendar--ani-show { - transform: translateY(0); - } - - .uni-calendar__content { - background-color: #fff; - } - - .uni-calendar__header { - position: relative; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - justify-content: center; - align-items: center; - height: 50px; - border-bottom-color: $uni-border-color-gray; - border-bottom-style: solid; - border-bottom-width: 1px; - } - - .uni-calendar--fixed-top { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - justify-content: space-between; - border-top-color: $uni-border-color; - border-top-style: solid; - border-top-width: 1px; - } - - .uni-calendar--fixed-width { - width: 50px; - // padding: 0 15px; - } - - .uni-calendar__backtoday { - position: absolute; - right: 0; - top: 25rpx; - padding: 0 5px; - padding-left: 10px; - height: 25px; - line-height: 25px; - font-size: 12px; - border-top-left-radius: 25px; - border-bottom-left-radius: 25px; - color: $uni-text-color; - background-color: $uni-bg-color-hover; - } - - .uni-calendar__header-text { - text-align: center; - width: 100px; - font-size: $uni-font-size-xl; - color: $uni-text-color; - } - - .uni-calendar__header-btn-box { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - align-items: center; - justify-content: center; - width: 50px; - height: 50px; - } - - .uni-calendar__header-btn { - width: 10px; - height: 10px; - border-left-color: $uni-text-color-placeholder; - border-left-style: solid; - border-left-width: 2px; - border-top-color: $uni-color-subtitle; - border-top-style: solid; - border-top-width: 2px; - } - - .uni-calendar--left { - transform: rotate(-45deg); - } - - .uni-calendar--right { - transform: rotate(135deg); - } - - - .uni-calendar__weeks { - position: relative; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - } - - .uni-calendar__weeks-item { - flex: 1; - } - - .uni-calendar__weeks-day { - flex: 1; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: column; - justify-content: center; - align-items: center; - height: 45px; - border-bottom-color: #F5F5F5; - border-bottom-style: solid; - border-bottom-width: 1px; - } - - .uni-calendar__weeks-day-text { - font-size: 14px; - } - - .uni-calendar__box { - position: relative; - } - - .uni-calendar__box-bg { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - justify-content: center; - align-items: center; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - } - - .uni-calendar__box-bg-text { - font-size: 200px; - font-weight: bold; - color: $uni-text-color-grey; - opacity: 0.1; - text-align: center; - /* #ifndef APP-NVUE */ - line-height: 1; - /* #endif */ - } - -</style> diff --git a/components/uni-calendar/util.js b/components/uni-calendar/util.js deleted file mode 100644 index 37f4432..0000000 --- a/components/uni-calendar/util.js +++ /dev/null @@ -1,352 +0,0 @@ -import CALENDAR from './calendar.js' - -class Calendar { - constructor({ - date, - selected, - startDate, - endDate, - range - } = {}) { - // 褰撳墠鏃ユ湡 - this.date = this.getDate(new Date()) // 褰撳墠鍒濆叆鏃ユ湡 - // 鎵撶偣淇℃伅 - this.selected = selected || []; - // 鑼冨洿寮�濮� - this.startDate = startDate - // 鑼冨洿缁撴潫 - this.endDate = endDate - this.range = range - // 澶氶�夌姸鎬� - this.cleanMultipleStatus() - // 姣忓懆鏃ユ湡 - this.weeks = {} - // this._getWeek(this.date.fullDate) - } - /** - * 璁剧疆鏃ユ湡 - * @param {Object} date - */ - setDate(date) { - this.selectDate = this.getDate(date) - this._getWeek(this.selectDate.fullDate) - } - - /** - * 娓呯悊澶氶�夌姸鎬� - */ - cleanMultipleStatus() { - this.multipleStatus = { - before: '', - after: '', - data: [] - } - } - - /** - * 閲嶇疆寮�濮嬫棩鏈� - */ - resetSatrtDate(startDate) { - // 鑼冨洿寮�濮� - this.startDate = startDate - - } - - /** - * 閲嶇疆缁撴潫鏃ユ湡 - */ - resetEndDate(endDate) { - // 鑼冨洿缁撴潫 - this.endDate = endDate - } - - /** - * 鑾峰彇浠绘剰鏃堕棿 - */ - getDate(date, AddDayCount = 0, str = 'day') { - if (!date) { - date = new Date() - } - if (typeof date !== 'object') { - date = date.replace(/-/g, '/') - } - const dd = new Date(date) - switch (str) { - case 'day': - dd.setDate(dd.getDate() + AddDayCount) // 鑾峰彇AddDayCount澶╁悗鐨勬棩鏈� - break - case 'month': - if (dd.getDate() === 31) { - dd.setDate(dd.getDate() + AddDayCount) - } else { - dd.setMonth(dd.getMonth() + AddDayCount) // 鑾峰彇AddDayCount澶╁悗鐨勬棩鏈� - } - break - case 'year': - dd.setFullYear(dd.getFullYear() + AddDayCount) // 鑾峰彇AddDayCount澶╁悗鐨勬棩鏈� - break - } - const y = dd.getFullYear() - const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 鑾峰彇褰撳墠鏈堜唤鐨勬棩鏈燂紝涓嶈冻10琛�0 - const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 鑾峰彇褰撳墠鍑犲彿锛屼笉瓒�10琛�0 - return { - fullDate: y + '-' + m + '-' + d, - year: y, - month: m, - date: d, - day: dd.getDay() - } - } - - - /** - * 鑾峰彇涓婃湀鍓╀綑澶╂暟 - */ - _getLastMonthDays(firstDay, full) { - let dateArr = [] - for (let i = firstDay; i > 0; i--) { - const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() - dateArr.push({ - date: beforeDate, - month: full.month - 1, - lunar: this.getlunar(full.year, full.month - 1, beforeDate), - disable: true - }) - } - return dateArr - } - /** - * 鑾峰彇鏈湀澶╂暟 - */ - _currentMonthDys(dateData, full) { - let dateArr = [] - let fullDate = this.date.fullDate - for (let i = 1; i <= dateData; i++) { - let isinfo = false - let nowDate = full.year + '-' + (full.month < 10 ? - full.month : full.month) + '-' + (i < 10 ? - '0' + i : i) - // 鏄惁浠婂ぉ - let isDay = fullDate === nowDate - // 鑾峰彇鎵撶偣淇℃伅 - let info = this.selected && this.selected.find((item) => { - if (this.dateEqual(nowDate, item.date)) { - return item - } - }) - - // 鏃ユ湡绂佺敤 - let disableBefore = true - let disableAfter = true - if (this.startDate) { - let dateCompBefore = this.dateCompare(this.startDate, fullDate) - disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) - } - - if (this.endDate) { - let dateCompAfter = this.dateCompare(fullDate, this.endDate) - disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) - } - let multiples = this.multipleStatus.data - let checked = false - let multiplesStatus = -1 - if (this.range) { - if (multiples) { - multiplesStatus = multiples.findIndex((item) => { - return this.dateEqual(item, nowDate) - }) - } - if (multiplesStatus !== -1) { - checked = true - } - } - let data = { - fullDate: nowDate, - year: full.year, - date: i, - multiple: this.range ? checked : false, - beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate), - afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate), - month: full.month, - lunar: this.getlunar(full.year, full.month, i), - disable: !disableBefore || !disableAfter, - isDay - } - if (info) { - data.extraInfo = info - } - - dateArr.push(data) - } - return dateArr - } - /** - * 鑾峰彇涓嬫湀澶╂暟 - */ - _getNextMonthDays(surplus, full) { - let dateArr = [] - for (let i = 1; i < surplus + 1; i++) { - dateArr.push({ - date: i, - month: Number(full.month) + 1, - lunar: this.getlunar(full.year, Number(full.month) + 1, i), - disable: true - }) - } - return dateArr - } - - /** - * 鑾峰彇褰撳墠鏃ユ湡璇︽儏 - * @param {Object} date - */ - getInfo(date) { - if (!date) { - date = new Date() - } - const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) - return dateInfo - } - - /** - * 姣旇緝鏃堕棿澶у皬 - */ - dateCompare(startDate, endDate) { - // 璁$畻鎴鏃堕棿 - startDate = new Date(startDate.replace('-', '/').replace('-', '/')) - // 璁$畻璇︾粏椤圭殑鎴鏃堕棿 - endDate = new Date(endDate.replace('-', '/').replace('-', '/')) - if (startDate <= endDate) { - return true - } else { - return false - } - } - - /** - * 姣旇緝鏃堕棿鏄惁鐩哥瓑 - */ - dateEqual(before, after) { - // 璁$畻鎴鏃堕棿 - before = new Date(before.replace('-', '/').replace('-', '/')) - // 璁$畻璇︾粏椤圭殑鎴鏃堕棿 - after = new Date(after.replace('-', '/').replace('-', '/')) - if (before.getTime() - after.getTime() === 0) { - return true - } else { - return false - } - } - - - /** - * 鑾峰彇鏃ユ湡鑼冨洿鍐呮墍鏈夋棩鏈� - * @param {Object} begin - * @param {Object} end - */ - geDateAll(begin, end) { - var arr = [] - var ab = begin.split('-') - var ae = end.split('-') - var db = new Date() - db.setFullYear(ab[0], ab[1] - 1, ab[2]) - var de = new Date() - de.setFullYear(ae[0], ae[1] - 1, ae[2]) - var unixDb = db.getTime() - 24 * 60 * 60 * 1000 - var unixDe = de.getTime() - 24 * 60 * 60 * 1000 - for (var k = unixDb; k <= unixDe;) { - k = k + 24 * 60 * 60 * 1000 - arr.push(this.getDate(new Date(parseInt(k))).fullDate) - } - return arr - } - /** - * 璁$畻闃村巻鏃ユ湡鏄剧ず - */ - getlunar(year, month, date) { - return CALENDAR.solar2lunar(year, month, date) - } - /** - * 璁剧疆鎵撶偣 - */ - setSelectInfo(data, value) { - this.selected = value - this._getWeek(data) - } - - /** - * 鑾峰彇澶氶�夌姸鎬� - */ - setMultiple(fullDate) { - let { - before, - after - } = this.multipleStatus - - if (!this.range) return - if (before && after) { - this.multipleStatus.before = '' - this.multipleStatus.after = '' - this.multipleStatus.data = [] - } else { - if (!before) { - this.multipleStatus.before = fullDate - } else { - this.multipleStatus.after = fullDate - if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); - } else { - this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); - } - } - } - this._getWeek(fullDate) - } - - /** - * 鑾峰彇姣忓懆鏁版嵁 - * @param {Object} dateData - */ - _getWeek(dateData) { - const { - fullDate, - year, - month, - date, - day - } = this.getDate(dateData) - let firstDay = new Date(year, month - 1, 1).getDay() - let currentDay = new Date(year, month, 0).getDate() - let dates = { - lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 涓婁釜鏈堟湯灏惧嚑澶� - currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 鏈湀澶╂暟 - nextMonthDays: [], // 涓嬩釜鏈堝紑濮嬪嚑澶� - weeks: [] - } - let canlender = [] - const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) - dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) - canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) - let weeks = {} - // 鎷兼帴鏁扮粍 涓婁釜鏈堝紑濮嬪嚑澶� + 鏈湀澶╂暟+ 涓嬩釜鏈堝紑濮嬪嚑澶� - for (let i = 0; i < canlender.length; i++) { - if (i % 7 === 0) { - weeks[parseInt(i / 7)] = new Array(7) - } - weeks[parseInt(i / 7)][i % 7] = canlender[i] - } - this.canlender = canlender - this.weeks = weeks - } - - //闈欐�佹柟娉� - // static init(date) { - // if (!this.instance) { - // this.instance = new Calendar(date); - // } - // return this.instance; - // } -} - - -export default Calendar diff --git a/components/uni-collapse/uni-collapse.vue b/components/uni-collapse/uni-collapse.vue deleted file mode 100644 index cf2f4be..0000000 --- a/components/uni-collapse/uni-collapse.vue +++ /dev/null @@ -1,54 +0,0 @@ -<template> - <view class="uni-collapse"> - <slot /> - </view> -</template> -<script> - export default { - name: 'UniCollapse', - props: { - accordion: { - // 鏄惁寮�鍚墜椋庣惔鏁堟灉 - type: [Boolean, String], - default: false - } - }, - data() { - return {} - }, - provide() { - return { - collapse: this - } - }, - created() { - this.childrens = [] - }, - methods: { - onChange() { - let activeItem = [] - this.childrens.forEach((vm, index) => { - if (vm.isOpen) { - activeItem.push(vm.nameSync) - } - }) - this.$emit('change', activeItem) - } - } - } -</script> -<style lang="scss" scoped> - @import '@/uni.scss'; - - .uni-collapse { - /* #ifndef APP-NVUE */ - width: 100%; - display: flex; - /* #endif */ - /* #ifdef APP-NVUE */ - flex: 1; - /* #endif */ - flex-direction: column; - background-color: $uni-bg-color; - } -</style> diff --git a/components/uni-popup/message.js b/components/uni-popup/message.js deleted file mode 100644 index 6688e84..0000000 --- a/components/uni-popup/message.js +++ /dev/null @@ -1,29 +0,0 @@ -export default { - created() { - if (this.type === 'message') { - // 鑾峰彇鑷粍浠跺璞� - this.maskShow = false - this.children = null - } - }, - created() { - if (this.type === 'message') { - // 涓嶆樉绀洪伄缃� - this.maskShow = false - // 鑾峰彇瀛愮粍浠跺璞� - this.childrenMsg = null - } - }, - methods: { - customOpen() { - if (this.childrenMsg) { - this.childrenMsg.open() - } - }, - customClose() { - if (this.childrenMsg) { - this.childrenMsg.close() - } - } - } -} diff --git a/components/uni-popup/popup.js b/components/uni-popup/popup.js deleted file mode 100644 index 2a7f22f..0000000 --- a/components/uni-popup/popup.js +++ /dev/null @@ -1,25 +0,0 @@ -import message from './message.js'; -// 瀹氫箟 type 绫诲瀷:寮瑰嚭绫诲瀷锛歵op/bottom/center -const config = { - // 椤堕儴寮瑰嚭 - top:'top', - // 搴曢儴寮瑰嚭 - bottom:'bottom', - // 灞呬腑寮瑰嚭 - center:'center', - // 娑堟伅鎻愮ず - message:'top', - // 瀵硅瘽妗� - dialog:'center', - // 鍒嗕韩 - share:'bottom', -} - -export default { - data(){ - return { - config:config - } - }, - mixins: [message], -} diff --git a/components/uni-popup/uni-popup-dialog.vue b/components/uni-popup/uni-popup-dialog.vue deleted file mode 100644 index c91123c..0000000 --- a/components/uni-popup/uni-popup-dialog.vue +++ /dev/null @@ -1,243 +0,0 @@ -<template> - <view class="uni-popup-dialog"> - <view class="uni-dialog-title"> - <text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{title}}</text> - </view> - <view class="uni-dialog-content"> - <text class="uni-dialog-content-text" v-if="mode === 'base'">{{content}}</text> - <input v-else class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholder" :focus="focus" > - </view> - <view class="uni-dialog-button-group"> - <view class="uni-dialog-button" @click="close"> - <text class="uni-dialog-button-text">鍙栨秷</text> - </view> - <view class="uni-dialog-button uni-border-left" @click="onOk"> - <text class="uni-dialog-button-text uni-button-color">纭畾</text> - </view> - </view> - - </view> -</template> - -<script> - /** - * PopUp 寮瑰嚭灞�-瀵硅瘽妗嗘牱寮� - * @description 寮瑰嚭灞�-瀵硅瘽妗嗘牱寮� - * @tutorial https://ext.dcloud.net.cn/plugin?id=329 - * @property {String} value input 妯″紡涓嬬殑榛樿鍊� - * @property {String} placeholder input 妯″紡涓嬭緭鍏ユ彁绀� - * @property {String} type = [success|warning|info|error] 涓婚鏍峰紡 - * @value success 鎴愬姛 - * @value warning 鎻愮ず - * @value info 娑堟伅 - * @value error 閿欒 - * @property {String} mode = [base|input] 妯″紡銆� - * @value base 鍩虹瀵硅瘽妗� - * @value input 鍙緭鍏ュ璇濇 - * @property {String} content 瀵硅瘽妗嗗唴瀹� - * @property {Boolean} beforeClose 鏄惁鎷︽埅鍙栨秷浜嬩欢 - * @event {Function} confirm 鐐瑰嚮纭鎸夐挳瑙﹀彂 - * @event {Function} close 鐐瑰嚮鍙栨秷鎸夐挳瑙﹀彂 - */ - - export default { - name: "uniPopupDialog", - props: { - value: { - type: [String, Number], - default: '' - }, - placeholder: { - type: [String, Number], - default: '璇疯緭鍏ュ唴瀹�' - }, - /** - * 瀵硅瘽妗嗕富棰� success/warning/info/error 榛樿 success - */ - type: { - type: String, - default: 'error' - }, - /** - * 瀵硅瘽妗嗘ā寮� base/input - */ - mode: { - type: String, - default: 'base' - }, - /** - * 瀵硅瘽妗嗘爣棰� - */ - title: { - type: String, - default: '鎻愮ず' - }, - /** - * 瀵硅瘽妗嗗唴瀹� - */ - content: { - type: String, - default: '' - }, - /** - * 鎷︽埅鍙栨秷浜嬩欢 锛屽鏋滄嫤鎴彇娑堜簨浠讹紝蹇呴』鐩戝惉close浜嬩欢锛屾墽琛� done() - */ - beforeClose: { - type: Boolean, - default: false - } - }, - data() { - return { - dialogType: 'error', - focus: false, - val: "" - } - }, - inject: ['popup'], - watch: { - type(val) { - this.dialogType = val - }, - mode(val) { - if (val === 'input') { - this.dialogType = 'info' - } - }, - value(val) { - this.val = val - } - }, - created() { - // 瀵硅瘽妗嗛伄缃╀笉鍙偣鍑� - this.popup.mkclick = false - if (this.mode === 'input') { - this.dialogType = 'info' - this.val = this.value - } else { - this.dialogType = this.type - } - }, - mounted() { - this.focus = true - }, - methods: { - /** - * 鐐瑰嚮纭鎸夐挳 - */ - onOk() { - this.$emit('confirm', () => { - this.popup.close() - if (this.mode === 'input') this.val = this.value - }, this.mode === 'input' ? this.val : '') - }, - /** - * 鐐瑰嚮鍙栨秷鎸夐挳 - */ - close() { - if (this.beforeClose) { - this.$emit('close', () => { - this.popup.close() - }) - return - } - this.popup.close() - } - } - } -</script> - -<style lang="scss" scoped> - .uni-popup-dialog { - width: 300px; - border-radius: 15px; - background-color: #fff; - } - - .uni-dialog-title { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - justify-content: center; - padding-top: 15px; - padding-bottom: 5px; - } - - .uni-dialog-title-text { - font-size: 16px; - font-weight: 500; - } - - .uni-dialog-content { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - justify-content: center; - align-items: center; - padding: 5px 15px 15px 15px; - } - - .uni-dialog-content-text { - font-size: 14px; - color: #6e6e6e; - } - - .uni-dialog-button-group { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - border-top-color: #f5f5f5; - border-top-style: solid; - border-top-width: 1px; - } - - .uni-dialog-button { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - - flex: 1; - flex-direction: row; - justify-content: center; - align-items: center; - height: 45px; - } - - .uni-border-left { - border-left-color: #f0f0f0; - border-left-style: solid; - border-left-width: 1px; - } - - .uni-dialog-button-text { - font-size: 14px; - } - - .uni-button-color { - color: $uni-color-primary; - } - - .uni-dialog-input { - flex: 1; - font-size: 14px; - } - - .uni-popup__success { - color: $uni-color-success; - } - - .uni-popup__warn { - color: $uni-color-warning; - } - - .uni-popup__error { - color: $uni-color-error; - } - - .uni-popup__info { - color: #909399; - } -</style> diff --git a/components/uni-popup/uni-popup-message.vue b/components/uni-popup/uni-popup-message.vue deleted file mode 100644 index a32bd00..0000000 --- a/components/uni-popup/uni-popup-message.vue +++ /dev/null @@ -1,116 +0,0 @@ -<template> - <view class="uni-popup-message" :class="'uni-popup__'+[type]"> - <text class="uni-popup-message-text" :class="'uni-popup__'+[type]+'-text'">{{message}}</text> - </view> -</template> - -<script> - - /** - * PopUp 寮瑰嚭灞�-娑堟伅鎻愮ず - * @description 寮瑰嚭灞�-娑堟伅鎻愮ず - * @tutorial https://ext.dcloud.net.cn/plugin?id=329 - * @property {String} type = [success|warning|info|error] 涓婚鏍峰紡 - * @value success 鎴愬姛 - * @value warning 鎻愮ず - * @value info 娑堟伅 - * @value error 閿欒 - * @property {String} message 娑堟伅鎻愮ず鏂囧瓧 - * @property {String} duration 鏄剧ず鏃堕棿锛岃缃负 0 鍒欎笉浼氳嚜鍔ㄥ叧闂� - */ - - export default { - name: 'UniPopupMessage', - props: { - /** - * 涓婚 success/warning/info/error 榛樿 success - */ - type: { - type: String, - default: 'success' - }, - /** - * 娑堟伅鏂囧瓧 - */ - message: { - type: String, - default: '' - }, - /** - * 鏄剧ず鏃堕棿锛岃缃负 0 鍒欎笉浼氳嚜鍔ㄥ叧闂� - */ - duration: { - type: Number, - default: 3000 - } - }, - inject: ['popup'], - data() { - return {} - }, - created() { - this.popup.childrenMsg = this - }, - methods: { - open() { - if (this.duration === 0) return - clearTimeout(this.popuptimer) - this.popuptimer = setTimeout(() => { - this.popup.close() - }, this.duration) - }, - close() { - clearTimeout(this.popuptimer) - } - } - } -</script> -<style lang="scss" scoped> - .uni-popup-message { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - background-color: #e1f3d8; - padding: 10px 15px; - border-color: #eee; - border-style: solid; - border-width: 1px; - } - .uni-popup-message-text { - font-size: 14px; - padding: 0; - } - - .uni-popup__success { - background-color: #e1f3d8; - } - - .uni-popup__success-text { - color: #67C23A; - } - - .uni-popup__warn { - background-color: #faecd8; - } - - .uni-popup__warn-text { - color: #E6A23C; - } - - .uni-popup__error { - background-color: #fde2e2; - } - - .uni-popup__error-text { - color: #F56C6C; - } - - .uni-popup__info { - background-color: #F2F6FC; - } - - .uni-popup__info-text { - color: #909399; - } -</style> diff --git a/components/uni-popup/uni-popup-share.vue b/components/uni-popup/uni-popup-share.vue deleted file mode 100644 index 4c11a13..0000000 --- a/components/uni-popup/uni-popup-share.vue +++ /dev/null @@ -1,165 +0,0 @@ -<template> - <view class="uni-popup-share"> - <view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view> - <view class="uni-share-content"> - <view class="uni-share-content-box"> - <view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)"> - <image class="uni-share-image" :src="item.icon" mode="aspectFill"></image> - <text class="uni-share-text">{{item.text}}</text> - </view> - - </view> - </view> - <view class="uni-share-button-box"> - <button class="uni-share-button" @click="close">鍙栨秷</button> - </view> - </view> -</template> - -<script> - export default { - name: 'UniPopupShare', - props: { - title: { - type: String, - default: '鍒嗕韩鍒�' - } - }, - inject: ['popup'], - data() { - return { - bottomData: [{ - text: '寰俊', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-2.png', - name: 'wx' - }, - { - text: '鏀粯瀹�', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-8.png', - name: 'wx' - }, - { - text: 'QQ', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/gird-3.png', - name: 'qq' - }, - { - text: '鏂版氮', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-1.png', - name: 'sina' - }, - { - text: '鐧惧害', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-7.png', - name: 'copy' - }, - { - text: '鍏朵粬', - icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-5.png', - name: 'more' - } - ] - } - }, - created() {}, - methods: { - /** - * 閫夋嫨鍐呭 - */ - select(item, index) { - this.$emit('select', { - item, - index - }, () => { - this.popup.close() - }) - }, - /** - * 鍏抽棴绐楀彛 - */ - close() { - this.popup.close() - } - } - } -</script> -<style lang="scss" scoped> - .uni-popup-share { - background-color: #fff; - } - .uni-share-title { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - align-items: center; - justify-content: center; - height: 40px; - } - .uni-share-title-text { - font-size: 14px; - color: #666; - } - .uni-share-content { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - justify-content: center; - padding-top: 10px; - } - - .uni-share-content-box { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - flex-wrap: wrap; - width: 360px; - } - - .uni-share-content-item { - width: 90px; - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: column; - justify-content: center; - padding: 10px 0; - align-items: center; - } - - .uni-share-content-item:active { - background-color: #f5f5f5; - } - - .uni-share-image { - width: 30px; - height: 30px; - } - - .uni-share-text { - margin-top: 10px; - font-size: 14px; - color: #3B4144; - } - - .uni-share-button-box { - /* #ifndef APP-NVUE */ - display: flex; - /* #endif */ - flex-direction: row; - padding: 10px 15px; - } - - .uni-share-button { - flex: 1; - border-radius: 50px; - color: #666; - font-size: 16px; - } - - .uni-share-button::after { - border-radius: 50px; - } -</style> diff --git a/components/uni-popup/uni-popup.vue b/components/uni-popup/uni-popup.vue deleted file mode 100644 index 2d15d5f..0000000 --- a/components/uni-popup/uni-popup.vue +++ /dev/null @@ -1,294 +0,0 @@ -<template> - <view v-if="showPopup" class="uni-popup" :class="[popupstyle]" @touchmove.stop.prevent="clear"> - <uni-transition v-if="maskShow" :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" - @click="onTap" /> - <uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap"> - <view class="uni-popup__wrapper-box" @click.stop="clear"> - <slot /> - </view> - </uni-transition> - </view> -</template> - -<script> - import uniTransition from '../uni-transition/uni-transition.vue' - import popup from './popup.js' - /** - * PopUp 寮瑰嚭灞� - * @description 寮瑰嚭灞傜粍浠讹紝涓轰簡瑙e喅閬僵寮瑰眰鐨勯棶棰� - * @tutorial https://ext.dcloud.net.cn/plugin?id=329 - * @property {String} type = [top|center|bottom] 寮瑰嚭鏂瑰紡 - * @value top 椤堕儴寮瑰嚭 - * @value center 涓棿寮瑰嚭 - * @value bottom 搴曢儴寮瑰嚭 - * @value message 娑堟伅鎻愮ず - * @value dialog 瀵硅瘽妗� - * @value share 搴曢儴鍒嗕韩绀轰緥 - * @property {Boolean} animation = [ture|false] 鏄惁寮�鍚姩鐢� - * @property {Boolean} maskClick = [ture|false] 钂欑増鐐瑰嚮鏄惁鍏抽棴寮圭獥 - * @event {Function} change 鎵撳紑鍏抽棴寮圭獥瑙﹀彂锛宔={show: false} - */ - - export default { - name: 'UniPopup', - components: { - uniTransition - }, - props: { - // 寮�鍚姩鐢� - animation: { - type: Boolean, - default: true - }, - // 寮瑰嚭灞傜被鍨嬶紝鍙�夊�硷紝top: 椤堕儴寮瑰嚭灞傦紱bottom锛氬簳閮ㄥ脊鍑哄眰锛沜enter锛氬叏灞忓脊鍑哄眰 - // message: 娑堟伅鎻愮ず ; dialog : 瀵硅瘽妗� - type: { - type: String, - default: 'center' - }, - // maskClick - maskClick: { - type: Boolean, - default: true - } - }, - provide() { - return { - popup: this - } - }, - mixins: [popup], - watch: { - /** - * 鐩戝惉type绫诲瀷 - */ - type: { - handler: function(newVal) { - this[this.config[newVal]]() - }, - immediate: true - }, - /** - * 鐩戝惉閬僵鏄惁鍙偣鍑� - * @param {Object} val - */ - maskClick(val) { - this.mkclick = val - } - }, - data() { - return { - duration: 300, - ani: [], - showPopup: false, - showTrans: false, - maskClass: { - 'position': 'fixed', - 'bottom': 0, - 'top': 0, - 'left': 0, - 'right': 0, - 'backgroundColor': 'rgba(0, 0, 0, 0.4)' - }, - transClass: { - 'position': 'fixed', - 'left': 0, - 'right': 0, - }, - maskShow: true, - mkclick: true, - popupstyle: 'top' - } - }, - created() { - this.mkclick = this.maskClick - if (this.animation) { - this.duration = 300 - } else { - this.duration = 0 - } - }, - methods: { - clear(e) { - // TODO nvue 鍙栨秷鍐掓场 - e.stopPropagation() - }, - open() { - this.showPopup = true - this.$nextTick(() => { - new Promise(resolve => { - clearTimeout(this.timer) - this.timer = setTimeout(() => { - this.showTrans = true - // fixed by mehaotian 鍏煎 app 绔� - this.$nextTick(() => { - resolve(); - }) - }, 50); - }).then(res => { - // 鑷畾涔夋墦寮�浜嬩欢 - clearTimeout(this.msgtimer) - this.msgtimer = setTimeout(() => { - this.customOpen && this.customOpen() - }, 100) - this.$emit('change', { - show: true, - type: this.type - }) - }) - }) - }, - close(type) { - this.showTrans = false - this.$nextTick(() => { - this.$emit('change', { - show: false, - type: this.type - }) - clearTimeout(this.timer) - // 鑷畾涔夊叧闂簨浠� - this.customOpen && this.customClose() - this.timer = setTimeout(() => { - this.showPopup = false - }, 300) - }) - }, - onTap() { - if (!this.mkclick) return - this.close() - }, - /** - * 椤堕儴寮瑰嚭鏍峰紡澶勭悊 - */ - top() { - this.popupstyle = 'top' - this.ani = ['slide-top'] - this.transClass = { - 'position': 'fixed', - 'left': 0, - 'right': 0, - } - }, - /** - * 搴曢儴寮瑰嚭鏍峰紡澶勭悊 - */ - bottom() { - this.popupstyle = 'bottom' - this.ani = ['slide-bottom'] - this.transClass = { - 'position': 'fixed', - 'left': 0, - 'right': 0, - 'bottom': 0 - } - }, - /** - * 涓棿寮瑰嚭鏍峰紡澶勭悊 - */ - center() { - this.popupstyle = 'center' - this.ani = ['zoom-out', 'fade'] - this.transClass = { - 'position': 'fixed', - /* #ifndef APP-NVUE */ - 'display': 'flex', - 'flexDirection': 'column', - /* #endif */ - 'bottom': 0, - 'left': 0, - 'right': 0, - 'top': 0, - 'justifyContent': 'center', - 'alignItems': 'center' - } - } - } - } -</script> -<style lang="scss" scoped> - .uni-popup { - position: fixed; - /* #ifndef APP-NVUE */ - z-index: 99; - /* #endif */ - } - - .uni-popup__mask { - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - background-color: $uni-bg-color-mask; - opacity: 0; - } - - .mask-ani { - transition-property: opacity; - transition-duration: 0.2s; - } - - .uni-top-mask { - opacity: 1; - } - - .uni-bottom-mask { - opacity: 1; - } - - .uni-center-mask { - opacity: 1; - } - - .uni-popup__wrapper { - /* #ifndef APP-NVUE */ - display: block; - /* #endif */ - position: absolute; - } - - .top { - /* #ifdef H5 */ - top: var(--window-top); - /* #endif */ - /* #ifndef H5 */ - top: 0; - /* #endif */ - } - - .bottom { - bottom: 0; - } - - .uni-popup__wrapper-box { - /* #ifndef APP-NVUE */ - display: block; - /* #endif */ - position: relative; - /* iphonex 绛夊畨鍏ㄥ尯璁剧疆锛屽簳閮ㄥ畨鍏ㄥ尯閫傞厤 */ - /* #ifndef APP-NVUE */ - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); - /* #endif */ - } - - .content-ani { - // transition: transform 0.3s; - transition-property: transform, opacity; - transition-duration: 0.2s; - } - - - .uni-top-content { - transform: translateY(0); - } - - .uni-bottom-content { - transform: translateY(0); - } - - .uni-center-content { - transform: scale(1); - opacity: 1; - } -</style> diff --git a/components/uni-transition/uni-transition.vue b/components/uni-transition/uni-transition.vue deleted file mode 100644 index 908a939..0000000 --- a/components/uni-transition/uni-transition.vue +++ /dev/null @@ -1,279 +0,0 @@ -<template> - <view v-if="isShow" ref="ani" class="uni-transition" :class="[ani.in]" :style="'transform:' +transform+';'+stylesObject" - @click="change"> - <slot></slot> - </view> -</template> - -<script> - // #ifdef APP-NVUE - const animation = uni.requireNativePlugin('animation'); - // #endif - /** - * Transition 杩囨浮鍔ㄧ敾 - * @description 绠�鍗曡繃娓″姩鐢荤粍浠� - * @tutorial https://ext.dcloud.net.cn/plugin?id=985 - * @property {Boolean} show = [false|true] 鎺у埗缁勪欢鏄剧ず鎴栭殣钘� - * @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 杩囨浮鍔ㄧ敾绫诲瀷 - * @value fade 娓愰殣娓愬嚭杩囨浮 - * @value slide-top 鐢变笂鑷充笅杩囨浮 - * @value slide-right 鐢卞彸鑷冲乏杩囨浮 - * @value slide-bottom 鐢变笅鑷充笂杩囨浮 - * @value slide-left 鐢卞乏鑷冲彸杩囨浮 - * @value zoom-in 鐢卞皬鍒板ぇ杩囨浮 - * @value zoom-out 鐢卞ぇ鍒板皬杩囨浮 - * @property {Number} duration 杩囨浮鍔ㄧ敾鎸佺画鏃堕棿 - * @property {Object} styles 缁勪欢鏍峰紡锛屽悓 css 鏍峰紡锛屾敞鎰忓甫鈥�-鈥樿繛鎺ョ鐨勫睘鎬ч渶瑕佷娇鐢ㄥ皬椹煎嘲鍐欐硶濡傦細`backgroundColor:red` - */ - export default { - name: 'uniTransition', - props: { - show: { - type: Boolean, - default: false - }, - modeClass: { - type: Array, - default () { - return [] - } - }, - duration: { - type: Number, - default: 300 - }, - styles: { - type: Object, - default () { - return {} - } - } - }, - data() { - return { - isShow: false, - transform: '', - ani: { in: '', - active: '' - } - }; - }, - watch: { - show: { - handler(newVal) { - if (newVal) { - this.open() - } else { - this.close() - } - }, - immediate: true - } - }, - computed: { - stylesObject() { - let styles = { - ...this.styles, - 'transition-duration': this.duration / 1000 + 's' - } - let transfrom = '' - for (let i in styles) { - let line = this.toLine(i) - transfrom += line + ':' + styles[i] + ';' - } - return transfrom - } - }, - created() { - // this.timer = null - // this.nextTick = (time = 50) => new Promise(resolve => { - // clearTimeout(this.timer) - // this.timer = setTimeout(resolve, time) - // return this.timer - // }); - }, - methods: { - change() { - this.$emit('click', { - detail: this.isShow - }) - }, - open() { - clearTimeout(this.timer) - this.isShow = true - this.transform = '' - this.ani.in = '' - for (let i in this.getTranfrom(false)) { - if (i === 'opacity') { - this.ani.in = 'fade-in' - } else { - this.transform += `${this.getTranfrom(false)[i]} ` - } - } - this.$nextTick(() => { - setTimeout(() => { - this._animation(true) - }, 50) - }) - - }, - close(type) { - clearTimeout(this.timer) - this._animation(false) - }, - _animation(type) { - let styles = this.getTranfrom(type) - // #ifdef APP-NVUE - if(!this.$refs['ani']) return - animation.transition(this.$refs['ani'].ref, { - styles, - duration: this.duration, //ms - timingFunction: 'ease', - needLayout: false, - delay: 0 //ms - }, () => { - if (!type) { - this.isShow = false - } - this.$emit('change', { - detail: this.isShow - }) - }) - // #endif - // #ifndef APP-NVUE - this.transform = '' - for (let i in styles) { - if (i === 'opacity') { - this.ani.in = `fade-${type?'out':'in'}` - } else { - this.transform += `${styles[i]} ` - } - } - this.timer = setTimeout(() => { - if (!type) { - this.isShow = false - } - this.$emit('change', { - detail: this.isShow - }) - - }, this.duration) - // #endif - - }, - getTranfrom(type) { - let styles = { - transform: '' - } - this.modeClass.forEach((mode) => { - switch (mode) { - case 'fade': - styles.opacity = type ? 1 : 0 - break; - case 'slide-top': - styles.transform += `translateY(${type?'0':'-100%'}) ` - break; - case 'slide-right': - styles.transform += `translateX(${type?'0':'100%'}) ` - break; - case 'slide-bottom': - styles.transform += `translateY(${type?'0':'100%'}) ` - break; - case 'slide-left': - styles.transform += `translateX(${type?'0':'-100%'}) ` - break; - case 'zoom-in': - styles.transform += `scale(${type?1:0.8}) ` - break; - case 'zoom-out': - styles.transform += `scale(${type?1:1.2}) ` - break; - } - }) - return styles - }, - _modeClassArr(type) { - let mode = this.modeClass - if (typeof(mode) !== "string") { - let modestr = '' - mode.forEach((item) => { - modestr += (item + '-' + type + ',') - }) - return modestr.substr(0, modestr.length - 1) - } else { - return mode + '-' + type - } - }, - // getEl(el) { - // console.log(el || el.ref || null); - // return el || el.ref || null - // }, - toLine(name) { - return name.replace(/([A-Z])/g, "-$1").toLowerCase(); - } - } - } -</script> - -<style> - .uni-transition { - transition-timing-function: ease; - transition-duration: 0.3s; - transition-property: transform, opacity; - } - - .fade-in { - opacity: 0; - } - - .fade-active { - opacity: 1; - } - - .slide-top-in { - /* transition-property: transform, opacity; */ - transform: translateY(-100%); - } - - .slide-top-active { - transform: translateY(0); - /* opacity: 1; */ - } - - .slide-right-in { - transform: translateX(100%); - } - - .slide-right-active { - transform: translateX(0); - } - - .slide-bottom-in { - transform: translateY(100%); - } - - .slide-bottom-active { - transform: translateY(0); - } - - .slide-left-in { - transform: translateX(-100%); - } - - .slide-left-active { - transform: translateX(0); - opacity: 1; - } - - .zoom-in-in { - transform: scale(0.8); - } - - .zoom-out-active { - transform: scale(1); - } - - .zoom-out-in { - transform: scale(1.2); - } -</style> diff --git a/manifest.json b/manifest.json index 1e6af9a..b74c8ec 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,8 @@ // }, "modules" : { "Maps" : {}, - "Push" : {} + "Push" : {}, + "Bluetooth" : {} }, /* 妯″潡閰嶇疆 */ "distribute" : { @@ -44,7 +45,9 @@ "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>", "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>", - "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>", + "<uses-permission android:name=\"android.permission.BLUETOOTH\" />", + "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\" />" ] }, "ios" : {}, @@ -79,29 +82,8 @@ } }, "h5" : { - "title" : "璁惧绠$悊", - "domain" : "fastwoke.cn", - "router" : { - "mode" : "hash", - "base" : "/h5/" - }, - "devServer" : { - "port" : 8086, - "https" : false, - "proxy" : { - /**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/ - "/jeecg-boot" : { - "target" : "https://192.168.4.20:8086", - "changeOrigin" : true, - "secure" : false - } - } - }, - "optimization" : { - "treeShaking" : { - "enable" : false - } - } + "title" : "Do it today", + "domain" : "myhjdc.cn" } } /**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/// 鐩爣鏈嶅姟鍣� diff --git a/package-lock.json b/package-lock.json index 287d37e..8675d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,10 +4,44 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/runtime": { + "version": "7.28.3", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.28.3.tgz", + "integrity": "sha512-9uIQ10o0WGdpP6GDhXcdOJPJuDgFtIDtN/9+ArJQ2NAfAmiuhTQdzkaTGR33v43GYS2UrSA0eX2pPPHoFVvpxA==" + }, + "@claviska/jquery-minicolors": { + "version": "2.3.6", + "resolved": "https://registry.npmmirror.com/@claviska/jquery-minicolors/-/jquery-minicolors-2.3.6.tgz", + "integrity": "sha512-8Ro6D4GCrmOl41+6w4NFhEOpx8vjxwVRI69bulXsFDt49uVRKhLU5TnzEV7AmOJrylkVq+ugnYNMiGHBieeKUQ==" + }, "@dcloudio/uni-ui": { "version": "1.5.7", "resolved": "https://registry.npmmirror.com/@dcloudio/uni-ui/-/uni-ui-1.5.7.tgz", "integrity": "sha512-DugxSIrQrze1FLdUOj9a+JEQ0bHGjnJTcGUK1mN/MivKg7nuKJBRWk5Ipa9sUdoBznX6ndz5h2e7Uao6x1CdCw==" + }, + "@hyoga/uni-socket.io": { + "version": "3.0.4", + "resolved": "https://registry.npmmirror.com/@hyoga/uni-socket.io/-/uni-socket.io-3.0.4.tgz", + "integrity": "sha512-m04M/ALXpTWcKoJGPDMzJosmzuopyAXF51DFN/qxLyXnbCFeQwsWOXT/XNLl4aWoBVGwQ7IptECFFRCA6z5C8A==" + }, + "@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmmirror.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" + }, + "@types/raf": { + "version": "3.4.3", + "resolved": "https://registry.npmmirror.com/@types/raf/-/raf-3.4.3.tgz", + "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==" + }, + "@wtto00/html2canvas": { + "version": "1.4.3", + "resolved": "https://registry.npmmirror.com/@wtto00/html2canvas/-/html2canvas-1.4.3.tgz", + "integrity": "sha512-jwsb+xL8N+gjrSNABSaFdxmWtE4c7RNFjP20lo1G7gs63Qqo1phhxVBTzxc/apDVh6LgXsU2l5bwKtXd9uz65w==", + "requires": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + } }, "@zxing/library": { "version": "0.21.3", @@ -23,25 +57,486 @@ "resolved": "https://registry.npmmirror.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==" }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "requires": { + "color-convert": "^2.0.1" + } + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" + }, + "base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==" + }, + "btoa": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/btoa/-/btoa-1.2.1.tgz", + "integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==" + }, + "bwip-js": { + "version": "4.7.0", + "resolved": "https://registry.npmmirror.com/bwip-js/-/bwip-js-4.7.0.tgz", + "integrity": "sha512-b7oQcgbWUl8rpcZayQ32SQrBCNteiZFuLkimKKBRlPwIHCeUN2VNeUE3HCMYShe04Evxd+ucS9uUAOsvNKjQbA==" + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmmirror.com/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + }, + "canvg": { + "version": "3.0.11", + "resolved": "https://registry.npmmirror.com/canvg/-/canvg-3.0.11.tgz", + "integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==", + "requires": { + "@babel/runtime": "^7.12.5", + "@types/raf": "^3.4.0", + "core-js": "^3.8.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.7", + "rgbcolor": "^1.0.1", + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^6.0.3" + } + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmmirror.com/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "core-js": { + "version": "3.45.1", + "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.45.1.tgz", + "integrity": "sha512-L4NPsJlCfZsPeXukyzHFlg/i7IIVwHSItR0wg0FLNqYClJ4MQYTYLbC7EkjKYRLZF2iof2MUgN0EGy7MdQFChg==" + }, + "css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "requires": { + "utrie": "^1.0.2" + } + }, + "debug": { + "version": "4.3.7", + "resolved": "https://registry.npmmirror.com/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "requires": { + "ms": "^2.1.3" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmmirror.com/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==" + }, + "dijkstrajs": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/dijkstrajs/-/dijkstrajs-1.0.3.tgz", + "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" + }, + "dompurify": { + "version": "2.5.8", + "resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-2.5.8.tgz", + "integrity": "sha512-o1vSNgrmYMQObbSSvF/1brBYEQPHhV1+gsmrusO7/GXtp1T9rCS8cXFqVxK/9crT1jA6Ccv+5MTSjBNqr7Sovw==", + "optional": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "engine.io-client": { + "version": "6.6.3", + "resolved": "https://registry.npmmirror.com/engine.io-client/-/engine.io-client-6.6.3.tgz", + "integrity": "sha512-T0iLjnyNWahNyv/lcjS2y4oE358tVS/SYQNxYXGAJ9/GLgH4VCvOQ/mhTjqU88mLZCQgiG8RIegFHYCdVC+j5w==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1", + "xmlhttprequest-ssl": "~2.1.1" + } + }, + "engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmmirror.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==" + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmmirror.com/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmmirror.com/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==" + }, "file-saver": { "version": "2.0.5", "resolved": "https://registry.npmmirror.com/file-saver/-/file-saver-2.0.5.tgz", "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "hiprint": { + "version": "0.3.0", + "resolved": "https://registry.npmmirror.com/hiprint/-/hiprint-0.3.0.tgz", + "integrity": "sha512-Yuyw1qioGgO93Hkg13TCoIuglGB2C376Y/gPmGxjOTTbtosZrQxnjpTzy3vX+vzyF5a0/FnBXrkIBwOtDAqBZw==", + "requires": { + "@claviska/jquery-minicolors": "^2.3.6", + "canvg": "^3.0.10", + "html2canvas": "^1.4.1", + "jquery": "^3.6.0", + "jsbarcode": "^3.11.5", + "jspdf": "^2.5.1", + "nzh": "^1.0.8", + "socket.io-client": "^4.5.1" + } + }, + "html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmmirror.com/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "requires": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + } }, "html5-qrcode": { "version": "2.3.8", "resolved": "https://registry.npmmirror.com/html5-qrcode/-/html5-qrcode-2.3.8.tgz", "integrity": "sha512-jsr4vafJhwoLVEDW3n1KvPnCCXWaQfRng0/EEYk1vNcQGcG/htAdhJX0be8YyqMoSz7+hZvOZSTAepsabiuhiQ==" }, - "openai": { - "version": "5.8.3", - "resolved": "https://registry.npmmirror.com/openai/-/openai-5.8.3.tgz", - "integrity": "sha512-IdotKmquCnpouTRvF9xRXVhMx6K5Sc8zkD6Usf+so+NTQ+qiJ8bLSCd7LBb8b/Rof7uYltlSxJhNp+spphKI4Q==" + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "jquery": { + "version": "3.7.1", + "resolved": "https://registry.npmmirror.com/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" + }, + "jsbarcode": { + "version": "3.12.1", + "resolved": "https://registry.npmmirror.com/jsbarcode/-/jsbarcode-3.12.1.tgz", + "integrity": "sha512-QZQSqIknC2Rr/YOUyOkCBqsoiBAOTYK+7yNN3JsqfoUtJtkazxNw1dmPpxuv7VVvqW13kA3/mKiLq+s/e3o9hQ==" + }, + "jspdf": { + "version": "2.5.2", + "resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.2.tgz", + "integrity": "sha512-myeX9c+p7znDWPk0eTrujCzNjT+CXdXyk7YmJq5nD5V7uLLKmSXnlQ/Jn/kuo3X09Op70Apm0rQSnFWyGK8uEQ==", + "requires": { + "@babel/runtime": "^7.23.2", + "atob": "^2.1.2", + "btoa": "^1.2.1", + "canvg": "^3.0.6", + "core-js": "^3.6.0", + "dompurify": "^2.5.4", + "fflate": "^0.8.1", + "html2canvas": "^1.0.0-rc.5" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "nzh": { + "version": "1.0.14", + "resolved": "https://registry.npmmirror.com/nzh/-/nzh-1.0.14.tgz", + "integrity": "sha512-wKgaqCSZdrySvB4RWop5g+v6IDv2IErsT6rjq06Bg0yiT9hiHYZO12GMGx/xweGVLcO2lDjX5RqWD0S/Jy9z5Q==" + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmmirror.com/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmmirror.com/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" + }, + "pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmmirror.com/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==" + }, + "qrcode": { + "version": "1.5.4", + "resolved": "https://registry.npmmirror.com/qrcode/-/qrcode-1.5.4.tgz", + "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==", + "requires": { + "dijkstrajs": "^1.0.1", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + } + }, + "raf": { + "version": "3.4.1", + "resolved": "https://registry.npmmirror.com/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "requires": { + "performance-now": "^2.1.0" + } + }, + "regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, + "rgbcolor": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/rgbcolor/-/rgbcolor-1.0.1.tgz", + "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, + "socket.io-client": { + "version": "4.8.1", + "resolved": "https://registry.npmmirror.com/socket.io-client/-/socket.io-client-4.8.1.tgz", + "integrity": "sha512-hJVXfu3E28NmzGk8o1sHhN3om52tRvwYeidbj7xKy2eIIse5IoKX3USlS6Tqt3BHAtflLIkCQBkzVrEEfWUyYQ==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.2", + "engine.io-client": "~6.6.1", + "socket.io-parser": "~4.2.4" + } + }, + "socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmmirror.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "requires": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + } + }, + "stackblur-canvas": { + "version": "2.7.0", + "resolved": "https://registry.npmmirror.com/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", + "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==" + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "svg-pathdata": { + "version": "6.0.3", + "resolved": "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz", + "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==" + }, + "text-encoding": { + "version": "0.7.0", + "resolved": "https://registry.npmmirror.com/text-encoding/-/text-encoding-0.7.0.tgz", + "integrity": "sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==" + }, + "text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmmirror.com/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "requires": { + "utrie": "^1.0.2" + } }, "ts-custom-error": { "version": "3.3.1", "resolved": "https://registry.npmmirror.com/ts-custom-error/-/ts-custom-error-3.3.1.tgz", "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==" + }, + "utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "requires": { + "base64-arraybuffer": "^1.0.2" + } + }, + "vue-plugin-hiprint": { + "version": "0.0.60", + "resolved": "https://registry.npmmirror.com/vue-plugin-hiprint/-/vue-plugin-hiprint-0.0.60.tgz", + "integrity": "sha512-a5uOMn6Nr4qlYYaVNbQKwRZJa8UcNMTflfi6J430/NDtySJB+5ArE8I8+NLjgVV56x3/qdUBs/GWuZCX5Umv1w==", + "requires": { + "@claviska/jquery-minicolors": "^2.3.6", + "@wtto00/html2canvas": "^1.4.3", + "bwip-js": "^4.0.0", + "canvg": "^3.0.10", + "jquery": "^3.6.0", + "jsbarcode": "^3.11.5", + "jspdf": "^2.5.1", + "lodash": "^4.17.21", + "nzh": "^1.0.8", + "socket.io-client": "^4.5.1" + } + }, + "weapp-qrcode": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/weapp-qrcode/-/weapp-qrcode-1.0.0.tgz", + "integrity": "sha512-4sa3W0rGDVJ9QaeZpAKlAuUxVyjhDwiUqHyGK/jJMsRMXnhb4yO8qWU/pZruMo+iT5J6CraS67lDMFb1VY+RaA==", + "requires": { + "extend": "^3.0.2" + } + }, + "which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmmirror.com/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "ws": { + "version": "8.17.1", + "resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==" + }, + "xmlhttprequest-ssl": { + "version": "2.1.2", + "resolved": "https://registry.npmmirror.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz", + "integrity": "sha512-TEU+nJVUUnA4CYJFLvK5X9AOeH4KvDvhIfm0vV1GaQRtchnG0hgK5p8hw/xjv8cunWYCsiPCSDzObPyhEwq3KQ==" + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmmirror.com/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmmirror.com/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } diff --git a/package.json b/package.json index 20c1219..bd930ed 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,13 @@ ] }, "dependencies": { - "openai": "^5.8.3" + "@hyoga/uni-socket.io": "^3.0.4", + "hiprint": "^0.3.0", + "jsbarcode": "^3.12.1", + "openai": "^5.8.3", + "qrcode": "^1.5.4", + "text-encoding": "^0.7.0", + "vue-plugin-hiprint": "0.0.60", + "weapp-qrcode": "^1.0.0" } } diff --git a/pages.json b/pages.json index dcdf52e..63b5daf 100644 --- a/pages.json +++ b/pages.json @@ -181,174 +181,349 @@ } }, { - "path" : "pages/device/deviceDeils/deviceDeils", + "path": "pages/device/deviceDeils/deviceDeils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/device/deviceWebDeils/deviceWebDeils", + "style": { + "navigationBarTitleText": "璁惧璇︽儏" + } + }, + { + "path": "pages/ToDoList/ToDoList", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/TaskManager/TaskManagerDeils/TaskManagerDeils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoListDeils/ToDoListDeils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/checkList/checkList", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/checkList/checkListDetils/checkListDetils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/baoZhou/baoZhou", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/baoZhou/baoZhouDetils/baoZhouDetils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/reportRepair/reportRepair", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/maintenanceReport/maintenanceReport", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/searEquipment/searEquipment", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/reportRepair/reportRepairList/reportRepairList", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/reportRepair/reportRepairDeils/reportRepairDeils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoSpareParts/ToDoSpareParts", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/selectEquipment/selectEquipment", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/historicalInspection/historicalInspection", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/historicalMaintenance/historicalMaintenance", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/historicalRepair/historicalRepair", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/ProductionManager/ProductionManager", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/text/text", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/check/check", + "style": { + + "navigationBarTitleText": "榻愬妫�鏌�" + + } + }, + { + "path": "pages/eam/production/process/process", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/sample/sample", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/feed/feed", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/record/record", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/qualityInspection/qualityInspection", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/defectiveProductReview/defectiveProductReview", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/checkItem/checkItem", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/productionInspection/productionInspection", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/qualityInspection/addInspection/addInspection", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/checkItemDetail/checkItemDetail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/qualityInspectionDetail/qualityInspectionDetail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/inspectionDetail/inspectionDetail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/quality/reviewDocument/reviewDocument", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/ToDoList/ToDoList", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonCall/andonCall", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/myInitiated/myInitiated", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonHandler/andonHandler", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonAction/andonAction", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonDetail/andonDetail", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/production/report/report", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonAdd/andonAdd", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/lineSelect/lineSelect", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/selectUsers/selectUsers", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/eam/andon/andonRespond/andonRespond", + "style": { + "navigationBarTitleText": "" + } + }, + { + "path": "pages/print-preview/print-preview", + "style": { + "navigationBarTitleText": "", + "pageOrientation": "landscape" // 鏂板妯睆閰嶇疆锛宭andscape 琛ㄧず妯睆 + } + }, + { + "path" : "pages/finished-product-preview/finished-product-preview", "style" : { "navigationBarTitleText" : "" } }, { - "path" : "pages/device/deviceWebDeils/deviceWebDeils", - "style" : - { - "navigationBarTitleText" : "璁惧璇︽儏" - } - }, - { - "path" : "pages/ToDoList/ToDoList", + "path" : "pages/inspection-tag-preview/inspection-tag-preview", "style" : { "navigationBarTitleText" : "" } }, { - "path" : "pages/TaskManager/TaskManagerDeils/TaskManagerDeils", + "path" : "pages/eam/production/materialLoading/materialLoading", "style" : { "navigationBarTitleText" : "" } }, { - "path" : "pages/ToDoList/ToDoListDeils/ToDoListDeils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/checkList/checkList", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/checkList/checkListDetils/checkListDetils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/baoZhou/baoZhou", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/baoZhou/baoZhouDetils/baoZhouDetils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/reportRepair/reportRepair", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/maintenanceReport/maintenanceReport", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/searEquipment/searEquipment", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/reportRepair/reportRepairList/reportRepairList", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/reportRepair/reportRepairDeils/reportRepairDeils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/maintenanceReport/maintenanceReportDetils/maintenanceReportDetils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/ToDoList/ToDoListDeils/ToDoCheckDetils/ToDoCheckDetils", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/ToDoList/ToDoListCheckSure/ToDoListCheckSure", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/ToDoList/ToDoSpareParts/ToDoSpareParts", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/ToDoList/ToDoBaoZhou/ToDoBaoZhou", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/ToDoList/ToDoBaoZhouSure/ToDoBaoZhouSure", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/selectEquipment/selectEquipment", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/historicalInspection/historicalInspection", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/historicalMaintenance/historicalMaintenance", - "style" : - { - "navigationBarTitleText" : "" - } - }, - { - "path" : "pages/historicalRepair/historicalRepair", + "path" : "pages/eam/production/partBlanking/partBlanking", "style" : { "navigationBarTitleText" : "" } } - + ], diff --git a/pages/home/home.vue b/pages/home/home.vue index b159b0a..648183e 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -11,25 +11,14 @@ </swiper-item> </swiper> - <!-- 璁惧缁翠慨 --> + + + <!-- 宸ヤ綔鍙� --> <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]"> <view class="action"> <text class='cuIcon-title text-blue'></text>宸ヤ綔鍙� </view> </view> - - <!-- <view class="cu-list grid col-4 text-sm"> - <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in usList" :key="index" @tap="goPage(item.page)"> - <view class="padding text-center"> - <image :src="item.icon" style="width:28px;height:28px;"> - <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" v-if="getTtemDotInfo(item)"> - <block v-if="getTtemDotInfo(item)">{{getTtemDotInfo(item)}}</block> - </view> - </image> - <view class="margin-top-xs">{{item.title}}</view> - </view> - </view> - </view> --> <view class="cu-list grid col-4 text-sm"> <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item, index) in usList" :key="index" @tap="goPage(item.page)"> @@ -43,10 +32,10 @@ </view> </view> - <!-- 璁惧淇濆吇 --> + <!-- 璁惧绠$悊 --> <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> <view class="action"> - <text class='cuIcon-title text-yellow'></text>淇濆吇 + <text class='cuIcon-title text-yellow'></text>璁惧绠$悊 </view> </view> <view class="cu-list grid col-4 text-sm"> @@ -62,11 +51,32 @@ </view> </view> + <!-- 鐢熶骇绠$悊 --> + <view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]"> + <view class="action"> + <text class='cuIcon-title text-blue'></text>鐢熶骇绠$悊 + </view> + </view> + <view class="cu-list grid col-4 text-sm"> + <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" + v-for="(item, index) in psList" :key="index" @tap="goPage(item.page)"> + <view class="padding text-center"> + <image :src="item.icon" style="width:28px;height:28px;"> + <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" + v-if="getTtemDotInfo(item)"></view> + </image> + <view class="margin-top-xs">{{ item.title }}</view> + </view> + </view> + </view> - <!-- 璁惧缁翠慨 --> + + + + <!-- 璐ㄩ噺绠$悊 --> <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> <view class="action"> - <text class='cuIcon-title text-blue'></text>缁翠慨 + <text class='cuIcon-title text-orange'></text>璐ㄩ噺绠$悊 </view> </view> <view class="cu-list grid col-4 text-sm"> @@ -82,6 +92,30 @@ </view> </view> + + + + <!-- 瀹夌伅绠$悊 --> + <view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.6s 1'}]"> + <view class="action"> + <text class='cuIcon-title text-green'></text>瀹夌伅绠$悊 + </view> + </view> + <view class="cu-list grid col-4 text-sm"> + <view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.1 + 's'}]" + v-for="(item,index) in asList" :key="index" @tap="goPage(item.page)"> + <view class="padding text-center"> + <image :src="item.icon" style="width:28px;height:28px;"> + <view class="cu-tag badge margin-top-sm" style="margin-left:1.2em" + v-if="getTtemDotInfo(item)"></view> + </image> + <view class="margin-top-xs">{{item.title}}</view> + </view> + </view> + </view> + + + </scroll-view> <view class="cu-tabbar-height margin-top"></view> </view> @@ -94,7 +128,9 @@ import { us, os, - ws + ws, + ps, + as } from '@/common/util/work.js' import socket from '@/common/js-sdk/socket/socket.js' export default { @@ -102,24 +138,15 @@ props: { cur: String, }, - // watch: { - // cur: { - // immediate: true, - // handler: function(val, oldVal) { - // console.log('cur', val, oldVal) - // this.initMenu() - // }, - // }, - // }, watch: { - cur: { - immediate: true, - handler: function(val, oldVal) { - console.log('cur', val, oldVal) - // 鍗充娇鍊兼病鏈夊彉鍖栵紝涔熶富鍔ㄨ皟鐢� initMenu - this.initMenu() - }, - }, + cur: { + immediate: true, + handler: function(val, oldVal) { + console.log('cur', val, oldVal) + // 鍗充娇鍊兼病鏈夊彉鍖栵紝涔熶富鍔ㄨ皟鐢� initMenu + this.initMenu() + }, + }, }, data() { return { @@ -147,20 +174,11 @@ link: '' } ], - middleApps: [{ - icon: 'line2_icon1.png', - title: '瀹℃壒', - 'text': '涓汉瀹℃壒' - }, - { - icon: 'line2_icon2.png', - title: '瀹℃壒绋�', - 'text': '瀹℃壒鑽夌绠�' - }, - ], usList: us.data, osList: os.data, wsList: ws.data, + psList: ps.data, + asList: as.data, msgCount: 0, toDomsgCount: 0, unExecRepairOrderCount: 0, diff --git a/pages/index/index.vue b/pages/index/index.vue index 1acf9f2..5f06286 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -6,14 +6,11 @@ <!-- <spare v-if="PageCur=='spare'" :key="commponent4Key"></spare> --> <view class="cu-bar tabbar bg-white shadow foot"> <view :class="PageCur=='home'?'action text-green':'action text-gray'" @click="NavChange" data-cur="home"> - <view class='cuIcon-homefill'></view>棣栭〉 + <view class='cuIcon-homefill'></view>宸ヤ綔鍙� </view> <view :class="PageCur=='device'?'action text-green':'action text-gray'" @click="NavChange" data-cur="device"> <view class='cuIcon-apps'></view>璁惧 </view> - <!-- <view :class="PageCur=='spare'?'action text-green':'action text-gray'" @click="NavChange" data-cur="spare"> - <view class='cuIcon-scan'></view>鎵竴鎵� - </view> --> <view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" data-cur="people"> <view class='cuIcon-people'></view>鎴戠殑 @@ -31,8 +28,6 @@ commponent1Key: 0, commponent2Key: 0, commponent3Key: 0 - - } }, onLoad: function() { diff --git a/pages/login/login.vue b/pages/login/login.vue index 5980f18..37cdb4b 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,343 +1,543 @@ - <template> - <view class="zai-box"> - <scroll-view scroll-y class="page"> - <view class="text-center" :style="[{animation: 'show ' + 0.4+ 's 1'}]"> - <image src="/static/logo-lx.png" mode='aspectFit' class="zai-logo "></image> - <view class="zai-title text-shadow ">璁惧绠$悊 </view> - </view> - <view class="box padding-lr-xl login-paddingtop" :style="[{animation: 'show ' + 0.6+ 's 1'}]"> - <block v-if="loginWay==1"> - <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> - <view class="title"><text class="cuIcon-people margin-right-xs"></text>璐﹀彿:</view> - <input placeholder="璇疯緭鍏ヨ处鍙�" name="input" v-model="userName"></input> - </view> - <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> - <view class="title"><text class="cuIcon-lock margin-right-xs"></text>瀵嗙爜:</view> - <input class="uni-input" placeholder="璇疯緭鍏ュ瘑鐮�" :password="!showPassword" v-model="password" /> - <view class="action text-lg"> - <text :class="[showPassword ? 'cuIcon-attention' : 'cuIcon-attentionforbid']" - @click="changePassword"></text> - </view> - </view> - <view class="padding text-center margin-top"> - <button class="cu-btn bg-blue lg margin-right shadow" :loading="loading" - :class="[shape=='round'?'round':'']" @tap="onLogin"><text - space="emsp">{{loading ? "鐧诲綍涓�...":" 鐧诲綍 "}}</text> - </button> - <!-- <button class="cu-btn line-blue lg margin-left shadow" :loading="loading" :class="[shape=='round'?'round':'']" - @tap="loginWay=3-loginWay">鐭俊鐧诲綍 - </button> --> - </view> - </block> - <block v-else> - <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> - <view class="title"><text class="cuIcon-mobile margin-right-xs"></text>鎵嬫満鍙�:</view> - <input placeholder="璇疯緭鍏ユ墜鏈哄彿" type="number" maxlength="11" v-model="phoneNo"></input> - </view> - <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> - <view class="title"><text class="cuIcon-lock margin-right-xs"></text>楠岃瘉鐮�:</view> - <input class="uni-input" placeholder="璇疯緭鍏ラ獙璇佺爜" v-model="smsCode" /> - <view class="action"> - <button class="cu-btn line-blue sm" :disabled="!isSendSMSEnable" @click="onSMSSend"> - {{ getSendBtnText }}</button> - </view> - </view> - <view class="padding text-center margin-top"> - <button class="cu-btn bg-blue lg margin-right shadow" :loading="loading" - :class="[shape=='round'?'round':'']" @tap="onSMSLogin"><text - space="emsp">{{loading ? "鐧诲綍涓�...":" 鐧诲綍 "}}</text> - </button> - <button class="cu-btn line-blue lg margin-left shadow" :loading="loading" - :class="[shape=='round'?'round':'']" @tap="loginWay=1">璐︽埛鐧诲綍 - </button> - </view> - </block> +<template> + <view class="zai-box"> + <scroll-view scroll-y class="page"> + <view class="text-center" :style="[{animation: 'show ' + 0.4+ 's 1'}]"> + <image src="/static/logo-lx.png" mode='aspectFit' class="zai-logo "></image> + <view class="zai-title text-shadow ">璁惧绠$悊 </view> + </view> + <view class="box padding-lr-xl login-paddingtop" :style="[{animation: 'show ' + 0.6+ 's 1'}]"> + <block v-if="loginWay==1"> + <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> + <view class="title"><text class="cuIcon-people margin-right-xs"></text>璐﹀彿:</view> + <input placeholder="璇疯緭鍏ヨ处鍙�" name="input" v-model="userName"></input> + </view> + <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> + <view class="title"><text class="cuIcon-lock margin-right-xs"></text>瀵嗙爜:</view> + <input class="uni-input" placeholder="璇疯緭鍏ュ瘑鐮�" :password="!showPassword" v-model="password" /> + <view class="action text-lg"> + <text :class="[showPassword ? 'cuIcon-attention' : 'cuIcon-attentionforbid']" + @click="changePassword"></text> + </view> + </view> + <view class="padding text-center margin-top"> + <button class="cu-btn bg-blue lg margin-right shadow" :loading="loading" + :class="[shape=='round'?'round':'']" @tap="onLogin"><text + space="emsp">{{loading ? "鐧诲綍涓�...":" 鐧诲綍 "}}</text> + </button> + </view> + </block> + <block v-else> + <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> + <view class="title"><text class="cuIcon-mobile margin-right-xs"></text>鎵嬫満鍙�:</view> + <input placeholder="璇疯緭鍏ユ墜鏈哄彿" type="number" maxlength="11" v-model="phoneNo"></input> + </view> + <view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']"> + <view class="title"><text class="cuIcon-lock margin-right-xs"></text>楠岃瘉鐮�:</view> + <input class="uni-input" placeholder="璇疯緭鍏ラ獙璇佺爜" v-model="smsCode" /> + <view class="action"> + <button class="cu-btn line-blue sm" :disabled="!isSendSMSEnable" @click="onSMSSend"> + {{ getSendBtnText }}</button> + </view> + </view> + <view class="padding text-center margin-top"> + <button class="cu-btn bg-blue lg margin-right shadow" :loading="loading" + :class="[shape=='round'?'round':'']" @tap="onSMSLogin"><text + space="emsp">{{loading ? "鐧诲綍涓�...":" 鐧诲綍 "}}</text> + </button> + <button class="cu-btn line-blue lg margin-left shadow" :loading="loading" + :class="[shape=='round'?'round':'']" @tap="loginWay=1">璐︽埛鐧诲綍 + </button> + </view> + </block> - <!-- #ifdef APP-PLUS --> - <view class="padding flex flex-direction text-center"> - 褰撳墠鐗堟湰:{{version}} - </view> - <!-- #endif --> + <!-- #ifdef APP-PLUS --> + <view class="padding flex flex-direction text-center"> + 褰撳墠鐗堟湰:{{version}} + </view> + <!-- #endif --> - </view> - </scroll-view> - <!-- 鐧诲綍鍔犺浇寮圭獥 --> - <view class="cu-load load-modal" v-if="loading"> - <!-- <view class="cuIcon-emojifill text-orange"></view> --> - <image src="/static/logo-lx.png" mode="aspectFit" class="round"></image> - <view class="gray-text">鐧诲綍涓�...</view> - </view> - </view> + </view> + </scroll-view> + <!-- 鐧诲綍鍔犺浇寮圭獥 --> + <view class="cu-load load-modal" v-if="loading"> + <image src="/static/logo-lx.png" mode="aspectFit" class="round"></image> + <view class="gray-text">鐧诲綍涓�...</view> + </view> - </template> + <!-- 浜х嚎閫夋嫨寮圭獥 - 浠庡簳閮ㄥ脊鍑� --> + <view class="line-modal-mask" v-if="showLineModal" @click="closeLineModal"></view> + <view class="line-modal" v-if="showLineModal" :class="{ 'line-modal-active': showLineModal }"> + <view class="line-modal-header"> + <view class="line-modal-title">閫夋嫨浜х嚎</view> + <text class="cuIcon-close" @click="closeLineModal"></text> + </view> + <view class="line-modal-content"> + <view v-if="lineLoading" class="loading-view"> + <view class="cu-load"></view> + <view class="text-gray">鍔犺浇浜х嚎涓�...</view> + </view> + <view v-else-if="lineList.length === 0" class="empty-view"> + <text class="cuIcon-meh text-gray text-xl"></text> + <view class="text-gray">鏆傛棤鍙敤浜х嚎</view> + </view> + <view class="line-item" v-for="(line, index) in lineList" :key="line.id" @click="selectLine(line)" + :class="{ 'line-item-selected': selectedLineId === line.id }"> + <view class="line-name">{{ line.name }}</view> + <text class="cuIcon-check text-blue" v-if="selectedLineId === line.id"></text> + </view> + </view> + <view class="line-modal-footer"> + <button class="cu-btn bg-blue lg" @click="confirmLineSelection" :disabled="!selectedLineId"> + 纭閫夋嫨 + </button> + </view> + </view> + </view> +</template> - <script> - import { - ACCESS_TOKEN, - USER_NAME, - USER_INFO - } from "@/common/util/constants" - import { - mapActions - } from "vuex" - import configService from '@/common/service/config.service.js'; +<script> + import { + ACCESS_TOKEN, + USER_NAME, + USER_INFO + } from "@/common/util/constants" + import { + mapActions, + mapState, + mapGetters + } from "vuex" // 鏂板mapGetters + import configService from '@/common/service/config.service.js'; - export default { - data() { - return { - shape: '', //round 鍦嗗舰 - loading: false, - userName: '', - password: '', - phoneNo: '', - smsCode: '', - showPassword: false, //鏄惁鏄剧ず鏄庢枃 - loginWay: 1, //1: 璐﹀瘑锛�2锛氶獙璇佺爜 - smsCountDown: 0, - smsCountInterval: null, - toggleDelay: false, - version: '', - //绗笁鏂圭櫥褰曠浉鍏充俊鎭� - thirdType: "", - thirdLoginInfo: "", - thirdLoginState: false, - bindingPhoneModal: false, - thirdUserUuid: '', - id: '', - url: { - bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone' - } - }; - }, - onLoad: function(options) { - this.id = options.id; - // #ifdef APP-PLUS - var that = this - plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) { - that.version = wgtinfo.version - }); - // #endif - }, - computed: { - isSendSMSEnable() { - return this.smsCountDown <= 0 && this.phoneNo.length > 4; - }, - getSendBtnText() { - if (this.smsCountDown > 0) { - return this.smsCountDown + '绉掑悗鍙戦��'; - } else { - return '鍙戦�侀獙璇佺爜'; - } - }, - canSMSLogin() { - return this.userName.length > 4 && this.smsCode.length > 4; - }, - canPwdLogin() { - return this.userName.length > 4 && this.password.length > 4; - }, - }, - methods: { - ...mapActions(["mLogin", "PhoneLogin", "ThirdLogin"]), - onLogin: function() { - if (!this.userName || this.userName.length == 0) { - this.$tip.toast('璇峰~鍐欑敤鎴峰悕'); - return; - } - if (!this.password || this.password.length == 0) { - this.$tip.toast('璇峰~鍐欏瘑鐮�'); - return; - } - let loginParams = { - username: this.userName, - password: this.password - } - this.loading = true; - this.mLogin(loginParams).then((res) => { - this.loading = false; - if (res.data.success) { - // #ifdef APP-PLUS - this.saveClientId() - // #endif - // #ifndef APP-PLUS - this.$tip.success('鐧诲綍鎴愬姛!') - this.$Router.replaceAll({ - name: 'index' - }) - // if (this.id) { - // uni.navigateTo({ - // url: `/pages/device/deviceWebDeils/deviceWebDeils?equipmentId=${this.id}` - // }); + export default { + data() { + return { + shape: '', //round 鍦嗗舰 + loading: false, + userName: '', + password: '', + phoneNo: '', + smsCode: '', + showPassword: false, //鏄惁鏄剧ず鏄庢枃 + loginWay: 1, //1: 璐﹀瘑锛�2锛氶獙璇佺爜 + smsCountDown: 0, + smsCountInterval: null, + toggleDelay: false, + version: '', + //绗笁鏂圭櫥褰曠浉鍏充俊鎭� + thirdType: "", + thirdLoginInfo: "", + thirdLoginState: false, + bindingPhoneModal: false, + thirdUserUuid: '', + id: '', + url: { + bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone' + }, + // 浜х嚎閫夋嫨鐩稿叧 + showLineModal: false, // 浜х嚎寮圭獥鏄惁鏄剧ず + lineList: [], // 浜х嚎鍒楄〃 + selectedLineId: null, // 褰撳墠閫変腑鐨勪骇绾縄D + lineLoading: false // 浜х嚎鍔犺浇鐘舵�� + }; + }, + computed: { + ...mapState(['currentLineId']), + ...mapGetters(['currentLineName']), // 鏂板锛氳幏鍙栧綋鍓嶄骇绾垮悕绉帮紙鐢ㄤ簬楠岃瘉锛� + isSendSMSEnable() { + return this.smsCountDown <= 0 && this.phoneNo.length > 4; + }, + getSendBtnText() { + if (this.smsCountDown > 0) { + return this.smsCountDown + '绉掑悗鍙戦��'; + } else { + return '鍙戦�侀獙璇佺爜'; + } + }, + canSMSLogin() { + return this.userName.length > 4 && this.smsCode.length > 4; + }, + canPwdLogin() { + return this.userName.length > 4 && this.password.length > 4; + }, + }, + onLoad: function(options) { + this.id = options.id; + // #ifdef APP-PLUS + var that = this + plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) { + that.version = wgtinfo.version + }); + // #endif + }, + methods: { + ...mapActions(["mLogin", "PhoneLogin", "ThirdLogin", "fetchLineList", "setCurrentLine"]), - // } else { - // this.$tip.success('鐧诲綍鎴愬姛!') - // this.$Router.replaceAll({ - // name: 'index' - // }) - // } + onLogin: function() { + if (!this.userName || this.userName.length == 0) { + this.$tip.toast('璇峰~鍐欑敤鎴峰悕'); + return; + } + if (!this.password || this.password.length == 0) { + this.$tip.toast('璇峰~鍐欏瘑鐮�'); + return; + } + let loginParams = { + username: this.userName, + password: this.password + } + this.loading = true; + this.mLogin(loginParams).then((res) => { + this.loading = false; + if (res.data.success) { + console.log('璐﹀彿鐧诲綍鎴愬姛锛屽噯澶囧鐞嗕骇绾块�夋嫨'); + // #ifdef APP-PLUS + this.saveClientId() + // #endif + // #ifndef APP-PLUS + this.handleLoginSuccess() + // #endif + } else { + this.$tip.alert(res.data.message); + } + }).catch((err) => { + let msg = err.data.message || "璇锋眰鍑虹幇閿欒锛岃绋嶅悗鍐嶈瘯" + this.loading = false; + this.$tip.alert(msg); + }).finally(() => { + this.loading = false; + }) + }, + saveClientId() { + var info = plus.push.getClientInfo(); + var cid = info.clientid; + this.$http.get("/sys/user/saveClientId", { + params: { + clientId: cid + } + }).then(res => { + console.log("res::saveClientId>", res) + this.handleLoginSuccess(); + }).catch(err => { + console.error('淇濆瓨clientId澶辫触:', err); + this.handleLoginSuccess(); + }) + }, - // #endif - } else { - this.$tip.alert(res.data.message); - } - }).catch((err) => { - let msg = err.data.message || "璇锋眰鍑虹幇閿欒锛岃绋嶅悗鍐嶈瘯" - this.loading = false; - this.$tip.alert(msg); - }).finally(() => { - this.loading = false; - }) - }, - saveClientId() { - var info = plus.push.getClientInfo(); - var cid = info.clientid; - this.$http.get("/sys/user/saveClientId", { - params: { - clientId: cid - } - }).then(res => { - console.log("res::saveClientId>", res) - this.$tip.success('鐧诲綍鎴愬姛!') - this.$Router.replaceAll({ - name: 'index' - }) - }) - }, - changePassword() { - this.showPassword = !this.showPassword; - }, - onSMSSend() { - let smsParams = {}; - smsParams.mobile = this.phoneNo; - smsParams.smsmode = "0"; - let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/); - if (!smsParams.mobile || smsParams.mobile.length == 0) { - this.$tip.toast('璇疯緭鍏ユ墜鏈哄彿'); - return false - } - if (!checkPhone.test(smsParams.mobile)) { - this.$tip.toast('璇疯緭鍏ユ纭殑鎵嬫満鍙�'); - return false - } - this.$http.post("/sys/sms", smsParams).then(res => { - if (res.data.success) { - this.smsCountDown = 60; - this.startSMSTimer(); - } else { - this.smsCountDown = 0; - this.$tip.toast(res.data.message); - } - }); - }, - startSMSTimer() { - this.smsCountInterval = setInterval(() => { - this.smsCountDown--; - if (this.smsCountDown <= 0) { - clearInterval(this.smsCountInterval); - } - }, 1000); - }, - onSMSLogin() { - let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/); + changePassword() { + this.showPassword = !this.showPassword; + }, - if (!this.phoneNo || this.phoneNo.length == 0) { - this.$tip.toast('璇峰~鍐欐墜鏈哄彿'); - return; - } - if (!checkPhone.test(this.phoneNo)) { - this.$tip.toast('璇疯緭鍏ユ纭殑鎵嬫満鍙�'); - return false - } - if (!this.smsCode || this.smsCode.length == 0) { - this.$tip.toast('璇峰~鐭俊楠岃瘉鐮�'); - return; - } - let loginParams = { - mobile: this.phoneNo, - captcha: this.smsCode - }; - this.PhoneLogin(loginParams).then((res) => { - console.log("res====銆�", res) - if (res.data.success) { - this.$tip.success('鐧诲綍鎴愬姛!') - this.$Router.replaceAll({ - name: 'index' - }) - } else { - this.$tip.error(res.data.message); - } - }).catch((err) => { - let msg = ((err.response || {}).data || {}).message || err.data.message || "璇锋眰鍑虹幇閿欒锛岃绋嶅悗鍐嶈瘯" - this.$tip.error(msg); - }); - }, - loginSuccess() { - // 鐧婚檰鎴愬姛锛岄噸瀹氬悜鍒颁富椤� - this.$Router.replace({ - name: 'index' - }) - }, - requestFailed(err) { - this.$message.warning("鐧诲綍澶辫触") - }, - }, - beforeDestroy() { - if (this.smsCountInterval) { - clearInterval(this.smsCountInterval); - } - }, - } - </script> + onSMSSend() { + let smsParams = {}; + smsParams.mobile = this.phoneNo; + smsParams.smsmode = "0"; + let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/); + if (!smsParams.mobile || smsParams.mobile.length == 0) { + this.$tip.toast('璇疯緭鍏ユ墜鏈哄彿'); + return false + } + if (!checkPhone.test(smsParams.mobile)) { + this.$tip.toast('璇疯緭鍏ユ纭殑鎵嬫満鍙�'); + return false + } + this.$http.post("/sys/sms", smsParams).then(res => { + if (res.data.success) { + this.smsCountDown = 60; + this.startSMSTimer(); + } else { + this.smsCountDown = 0; + this.$tip.toast(res.data.message); + } + }); + }, - <style> - .login-paddingtop { - padding-top: 100upx; - } + startSMSTimer() { + this.smsCountInterval = setInterval(() => { + this.smsCountDown--; + if (this.smsCountDown <= 0) { + clearInterval(this.smsCountInterval); + } + }, 1000); + }, - .zai-box { - padding: 0 20upx; - padding-top: 100upx; - position: relative; - } + onSMSLogin() { + let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/); - .zai-logo { - width: 200upx; - height: 150px; - } + if (!this.phoneNo || this.phoneNo.length == 0) { + this.$tip.toast('璇峰~鍐欐墜鏈哄彿'); + return; + } + if (!checkPhone.test(this.phoneNo)) { + this.$tip.toast('璇疯緭鍏ユ纭殑鎵嬫満鍙�'); + return false + } + if (!this.smsCode || this.smsCode.length == 0) { + this.$tip.toast('璇峰~鐭俊楠岃瘉鐮�'); + return; + } + let loginParams = { + mobile: this.phoneNo, + captcha: this.smsCode + }; + this.PhoneLogin(loginParams).then((res) => { + console.log("鐭俊鐧诲綍鎴愬姛锛屽噯澶囧鐞嗕骇绾块�夋嫨"); + if (res.data.success) { + this.handleLoginSuccess(); + } else { + this.$tip.error(res.data.message); + } + }).catch((err) => { + let msg = ((err.response || {}).data || {}).message || err.data.message || "璇锋眰鍑虹幇閿欒锛岃绋嶅悗鍐嶈瘯" + this.$tip.error(msg); + }); + }, - .zai-title { - font-size: 58upx; - color: #000000; - text-align: center; - } + // 鐧诲綍鎴愬姛鍚庣殑澶勭悊 + handleLoginSuccess() { + console.log('杩涘叆handleLoginSuccess鏂规硶'); + this.$tip.success('鐧诲綍鎴愬姛!'); - .input-placeholder, - .zai-input { - color: #94afce; - } + // 妫�鏌ユ槸鍚﹀凡鏈変繚瀛樼殑浜х嚎锛堝寘鍚獻D鍜屽悕绉帮級 + const savedLineId = uni.getStorageSync('currentLineId'); + const savedLineName = uni.getStorageSync('currentLineName'); + console.log('鏈湴瀛樺偍鐨勪骇绾縄D:', savedLineId, '鍚嶇О:', savedLineName); - .zai-label { - padding: 60upx 0; - text-align: center; - font-size: 30upx; - color: #a7b6d0; - } + if (savedLineId && savedLineName) { + // 宸叉湁瀹屾暣鐨勪骇绾夸俊鎭紝鐩存帴杩涘叆棣栭〉 + console.log('宸叉湁淇濆瓨鐨勪骇绾匡紝鐩存帴杩涘叆棣栭〉'); + this.navigateToHome(); + } else { + // 鏃犱繚瀛樼殑浜х嚎锛岃幏鍙栦骇绾垮垪琛ㄥ苟鏄剧ず寮圭獥 + console.log('鏃犱繚瀛樼殑浜х嚎锛屽噯澶囪幏鍙栦骇绾垮垪琛�'); + this.getLineListAndShowModal(); + } + }, - .zai-btn { - background: #ff65a3; - color: #fff; - border: 0; - border-radius: 100upx; - font-size: 36upx; - } + // 鑾峰彇浜х嚎鍒楄〃骞舵樉绀哄脊绐� + getLineListAndShowModal() { + console.log('杩涘叆getLineListAndShowModal鏂规硶'); + this.lineLoading = true; + this.lineList = []; + this.selectedLineId = null; - .zai-btn:after { - border: 0; - } + // 璋冪敤Vuex action鑾峰彇浜х嚎鍒楄〃 + this.fetchLineList().then(lineList => { + console.log('鑾峰彇浜х嚎鍒楄〃鎴愬姛:', lineList); + this.lineList = lineList || []; + this.lineLoading = false; - /*鎸夐挳鐐瑰嚮鏁堟灉*/ - .zai-btn.button-hover { - transform: translate(1upx, 1upx); - } - </style> \ No newline at end of file + // 濡傛灉鏈変骇绾匡紝榛樿閫変腑绗竴鏉″苟鏄剧ず寮圭獥 + if (this.lineList.length > 0) { + this.selectedLineId = this.lineList[0].id; + this.showLineModal = true; + console.log('浜х嚎鍒楄〃涓嶄负绌猴紝鏄剧ず寮圭獥'); + } else { + console.log('浜х嚎鍒楄〃涓虹┖锛屼笉鏄剧ず寮圭獥'); + this.$tip.toast('鏈幏鍙栧埌浜х嚎鏁版嵁锛岃鑱旂郴绠$悊鍛�'); + this.navigateToHome(); + } + }).catch(err => { + console.error('鑾峰彇浜х嚎鍒楄〃澶辫触:', err); + this.lineLoading = false; + this.$tip.toast('鑾峰彇浜х嚎鍒楄〃澶辫触锛岃閲嶈瘯'); + + // 3绉掑悗閲嶈瘯 + setTimeout(() => { + this.getLineListAndShowModal(); + }, 3000); + }); + }, + + // 閫夋嫨浜х嚎 + selectLine(line) { + console.log('閫変腑鐨勪骇绾�:', line.id, line.name); // 鎵撳嵃閫変腑鐨勪骇绾垮悕绉� + this.selectedLineId = line.id; + }, + + // 纭閫夋嫨浜х嚎锛堣Е鍙慥uex淇濆瓨ID鍜屽悕绉帮級 + confirmLineSelection() { + if (!this.selectedLineId) return; + + // 璋冪敤setCurrentLine锛孷uex浼氳嚜鍔ㄥ悓姝ュ悕绉� + this.setCurrentLine(this.selectedLineId).then(() => { + console.log('浜х嚎閫夋嫨鎴愬姛锛孖D:', this.selectedLineId, '鍚嶇О:', this.currentLineName); + this.showLineModal = false; + this.navigateToHome(); + }); + }, + + // 鍏抽棴浜х嚎閫夋嫨寮圭獥 + closeLineModal() { + this.showLineModal = false; + }, + + // 璺宠浆鍒伴椤� + navigateToHome() { + this.$Router.replaceAll({ + name: 'index' + }); + + }, + + loginSuccess() { + this.$Router.replace({ + name: 'index' + }) + }, + + requestFailed(err) { + this.$message.warning("鐧诲綍澶辫触") + }, + }, + beforeDestroy() { + if (this.smsCountInterval) { + clearInterval(this.smsCountInterval); + } + } + } +</script> + +<style> + /* 鍘熸湁鏍峰紡淇濇寔涓嶅彉 */ + .login-paddingtop { + padding-top: 100upx; + } + + .zai-box { + padding: 0 20upx; + padding-top: 100upx; + position: relative; + } + + .zai-logo { + width: 200upx; + height: 150px; + } + + .zai-title { + font-size: 58upx; + color: #000000; + text-align: center; + } + + .input-placeholder, + .zai-input { + color: #94afce; + } + + .zai-label { + padding: 60upx 0; + text-align: center; + font-size: 30upx; + color: #a7b6d0; + } + + .zai-btn { + background: #ff65a3; + color: #fff; + border: 0; + border-radius: 100upx; + font-size: 36upx; + } + + .zai-btn:after { + border: 0; + } + + .zai-btn.button-hover { + transform: translate(1upx, 1upx); + } + + /* 浜х嚎閫夋嫨寮圭獥鏍峰紡 */ + .line-modal-mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.5); + z-index: 998; + opacity: 0; + transition: opacity 0.3s ease; + } + + .line-modal { + position: fixed; + left: 0; + right: 0; + bottom: -100%; + background-color: #fff; + border-top-left-radius: 20upx; + border-top-right-radius: 20upx; + z-index: 999; + transition: bottom 0.3s ease; + max-height: 80vh; + } + + .line-modal-active { + bottom: 0; + } + + .line-modal-active+.line-modal-mask { + opacity: 1; + } + + .line-modal-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 20upx 30upx; + border-bottom: 1px solid #eee; + } + + .line-modal-title { + font-size: 34upx; + font-weight: bold; + } + + .line-modal-content { + padding: 20upx; + overflow-y: auto; + max-height: calc(80vh - 180upx); + } + + .line-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 25upx 20upx; + border-bottom: 1px solid #f5f5f5; + font-size: 30upx; + } + + .line-item-selected { + background-color: #f0f7ff; + } + + .line-item:last-child { + border-bottom: none; + } + + .line-modal-footer { + padding: 20upx 30upx; + border-top: 1px solid #eee; + } + + .loading-view { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60upx 0; + } + + .empty-view { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60upx 0; + } +</style> \ No newline at end of file diff --git a/pages/reportRepair/reportRepair.vue b/pages/reportRepair/reportRepair.vue index f86e6a8..8eb519c 100644 --- a/pages/reportRepair/reportRepair.vue +++ b/pages/reportRepair/reportRepair.vue @@ -1,5 +1,5 @@ <template> - <view v-if="authIncludes('eam:reportRepair:add')" class="container"> + <view class="container"> <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">鏂板-鎶ヤ慨</block> @@ -48,7 +48,7 @@ </view> - <view v-else class="container"> +<!-- <view v-else class="container"> <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> <block slot="content">鏂板-鎶ヤ慨</block> @@ -57,7 +57,7 @@ <view class="padding flex flex-direction"> 褰撳墠鐢ㄦ埛娌℃湁鎿嶄綔鏉冮檺 </view> - </view> + </view> --> </template> <script> diff --git a/pages/spare/spare.vue b/pages/spare/spare.vue index 6b2ca81..eda59a5 100644 --- a/pages/spare/spare.vue +++ b/pages/spare/spare.vue @@ -1,134 +1,324 @@ <template> - <view> - <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="index"> - <block slot="backText">杩斿洖</block> - <block slot="content">鎵竴鎵�</block> - </cu-custom> - <view class="scanCode"> - <mumu-get-qrcode :continue="true" @success='qrcodeSucess' @error="qrcodeError" - :definition="true"></mumu-get-qrcode> - </view> - </view> + <view class="container"> + <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="index"> + <block slot="backText">杩斿洖</block> + <block slot="content">绉诲簱鍗曟墦鍗�</block> + </cu-custom> + + <view class="print-area"> + <button @click="previewTransferOrder" class="btn test" :loading="isLoading"> + {{ isLoading ? '鐢熸垚涓�...' : '棰勮绉诲簱鍗�' }} + </button> + </view> + + <view class="status"> + 棰勮鐘舵��: {{ isPreview ? '宸茬敓鎴愰瑙�' : '鏈敓鎴�' }} + </view> + <view class="log" v-if="logList.length > 0"> + <text class="log-title">鎿嶄綔鏃ュ織:</text> + <view v-for="(log, index) in logList" :key="index" class="log-item"> + {{ log }} + </view> + </view> + </view> </template> <script> - import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'; +export default { + name: 'TransferOrderPrinter', + data() { + return { + NavBarColor: '#007AFF', + isPreview: false, + logList: [], + isLoading: false, + // 绉诲簱鍗曟暟鎹紙瀹為檯椤圭洰涓彲浠庢帴鍙h幏鍙栵級 + orderData: { + productionOrderNo: '112379', + productModel: 'G-639', + customerName: '涓滄柟鏃ヤ骇', + materialNo: '120047854', + customerModel: '4200-51354', + productionBatch: '25159847', + factory: '鍙屾灄鏂扮伀鐐伐鍘�', + quantity: '73', + docCode: 'XHJ.QM.QMS009E', + qrCodeText: 'C2506080024' + } + }; + }, + methods: { + // 娣诲姞鎿嶄綔鏃ュ織 + addLog(message) { + const time = new Date().toLocaleTimeString(); + this.logList.unshift(`[${time}] ${message}`); + if (this.logList.length > 20) this.logList.pop(); + }, - export default { - components: { - mumuGetQrcode // 娉ㄥ唽 - }, - name: 'spare', - data() { - return { - NavBarColor: this.NavBarColor, - hasNavigated: false // 鏍囪鏄惁宸茬粡璺宠浆 - }; - }, + // 浣跨敤鍦ㄧ嚎API鐢熸垚浜岀淮鐮侊紙鏃燙anvas渚濊禆锛� + async generateQrCode(content) { + try { + this.addLog('寮�濮嬬敓鎴愪簩缁寸爜...'); + + // 鏂规1: 浣跨敤Base64缂栫爜鍐呭鐩存帴鐢熸垚浜岀淮鐮侊紙鎺ㄨ崘锛� + const base64Content = encodeURIComponent(content); + // 璇ラ摼鎺ヤ細鏍规嵁鍐呭鐢熸垚浜岀淮鐮侊紝鏃犻渶鍚庣鏀寔 + return `https://api.qrserver.com/v1/create-qr-code/?data=${base64Content}&size=120x120`; + // 鏂规2: 澶囩敤API锛堣嫢鏂规1涓嶅彲鐢級 + // return `https://chart.googleapis.com/chart?chs=120x120&cht=qr&chl=${base64Content}`; + } catch (error) { + this.addLog(`浜岀淮鐮佺敓鎴愬け璐�: ${error.message}`); + throw error; + } + }, - methods: { - navigateToDeviceDetails(equipmentId) { - this.hasNavigated = true; // 鏍囪宸茬粡璺宠浆 - uni.redirectTo({ - url: `/pages/device/deviceWebDeils/deviceWebDeils?equipmentId=${encodeURIComponent(equipmentId)}`, - success: () => { - console.log('Navigated to device details'); - }, - fail: (err) => { - console.error('Navigation failed:', err); - } - }); - }, - qrcodeSucess(data) { // 鎵爜鎴愬姛 - setTimeout(() => { - let equipmentId; - try { - // 鍏煎鎬у鐞嗭細浼樺厛浣跨敤URL鍜孶RLSearchParams锛屽鏋滀笉鍙敤鍒欎娇鐢ㄥ瓧绗︿覆瑙f瀽 - if ('URL' in window && 'URLSearchParams' in window) { - const url = new URL(data); - const params = new URLSearchParams(url.hash.slice(1).split('?')[1]); - equipmentId = params.get('equipmentId'); - } else { - // 瀛楃涓茶В鏋愭柟寮� - const hashIndex = data.indexOf('#'); - if (hashIndex !== -1) { - const hashPart = data.substring(hashIndex + 1); - const paramIndex = hashPart.indexOf('?'); - if (paramIndex !== -1) { - const paramStr = hashPart.substring(paramIndex + 1); - const pairs = paramStr.split('&'); - for (let pair of pairs) { - const [key, value] = pair.split('='); - if (key === 'equipmentId') { - equipmentId = value; - break; - } - } - } - } - } + // 鐢熸垚绉诲簱鍗旽TML骞堕瑙� + async generateTransferHTML() { + try { + this.isLoading = true; + this.addLog('寮�濮嬬敓鎴愮Щ搴撳崟...'); - if (equipmentId) { - // 鐧诲綍鎴愬姛涓旇幏鍙栧埌equipmentId锛岃烦杞埌璁惧璇︽儏椤甸潰 - this.navigateToDeviceDetails(equipmentId); - } else { - uni.showModal({ - title: '鎻愮ず', - content: "浜岀淮鐮佷腑鏈壘鍒版湁鏁堢殑equipmentId", - showCancel: false - }); - } - } catch (error) { - uni.showModal({ - title: '閿欒', - content: "瑙f瀽URL鍑洪敊锛岃妫�鏌ヤ簩缁寸爜鍐呭", - showCancel: false - }); - } - }, 200); // 澧炲姞100姣鐨勫欢杩� - }, - qrcodeError(err) { // 鎵爜澶辫触 - uni.showModal({ - title: '鎽勫儚澶存巿鏉冨け璐�', - content: '鎽勫儚澶存巿鏉冨け璐ワ紝璇锋娴嬪綋鍓嶆祻瑙堝櫒鏄惁鏈夋憚鍍忓ご鏉冮檺銆�', - success: () => { - uni.navigateBack({}); // 杩斿洖鍒颁笂涓�椤� - } - }); - } - } - }; + // 鐢熸垚浜岀淮鐮佸唴瀹� + const qrContent = `鐢熶骇璁㈠崟鍙�:${this.orderData.productionOrderNo},浜у搧鍨嬪彿:${this.orderData.productModel},瀹㈡埛鍚嶇О:${this.orderData.customerName},鐗╂枡鍙�:${this.orderData.materialNo},瀹㈡埛鍨嬪彿:${this.orderData.customerModel},鐢熶骇鎵瑰彿:${this.orderData.productionBatch},鐢熶骇鍒嗗巶:${this.orderData.factory},鏁伴噺:${this.orderData.quantity}`; + + // 璋冪敤鍦ㄧ嚎API鐢熸垚浜岀淮鐮� + const qrDataUrl = await this.generateQrCode(qrContent); + this.addLog('浜岀淮鐮佺敓鎴愭垚鍔�'); + + // 澶勭悊logo鍥剧墖锛堜娇鐢ㄦ湰鍦拌祫婧愶級 + const logoUrl = '/static/index_logo.png'; + + // 鐢熸垚绉诲簱鍗旽TML鍐呭 + const htmlContent = ` + <!DOCTYPE html> + <html lang="zh-CN"> + <head> + <meta charset="UTF-8"> + <title>绉诲簱鍗�</title> + <style> + @media print { + @page { + size: A4 landscape; + margin: 15mm; + } + body { + -webkit-print-color-adjust: exact; + } + } + body { + margin: 0; + padding: 0; + font-family: "Microsoft YaHei", "SimHei", sans-serif; + } + .transfer-order { + width: 800px; + height: 550px; + border: 2px solid #000; + box-sizing: border-box; + margin: 20px auto; + padding: 15px; + } + .header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 0; + border-bottom: 2px solid #000; + margin-bottom: 15px; + } + .logo img { + width: 180px; + height: auto; + } + .doc-info { + text-align: right; + } + .doc-code { + font-size: 18px; + font-weight: bold; + margin-bottom: 5px; + } + .doc-name { + font-size: 28px; + font-weight: bold; + text-align: center; + margin: 15px 0; + } + .divider { + border-top: 2px solid #000; + width: 200px; + margin: 0 auto 15px; + } + table { + width: 100%; + border-collapse: collapse; + table-layout: fixed; + } + table, th, td { + border: 1px solid #000; + padding: 10px; + font-size: 15px; + word-wrap: break-word; + } + .label-container { + display: flex; + gap: 15px; + flex-wrap: wrap; + padding: 5px 0; + } + .status-label { + display: inline-block; + padding: 8px 15px; + background-color: #f0f0f0; + border: 1px solid #ccc; + border-radius: 4px; + font-size: 14px; + } + table tr td:first-child { + width: 120px; + } + table tr td[colspan="4"] { + width: calc(100% - 120px); + } + .qrcode-area { + text-align: center; + vertical-align: middle; + } + .qrcode-area img { + width: 150px; + height: 150px; + display: block; + margin: 0 auto; + } + .qrcode-text { + margin-top: 10px; + text-align: center; + font-size: 14px; + } + </style> + </head> + <body> + <div class="transfer-order"> + <div class="header"> + <div class="logo"> + <img src="${logoUrl}" alt="浼佷笟logo"> + </div> + <div class="doc-info"> + <div class="doc-code">${this.orderData.docCode}</div> + </div> + </div> + <div class="doc-name">绉诲簱鍗�</div> + <div class="divider"></div> + <table> + <tr> + <td>鐢熶骇璁㈠崟鍙�</td> + <td>${this.orderData.productionOrderNo}</td> + <td>浜у搧鍨嬪彿</td> + <td>${this.orderData.productModel}</td> + <td rowspan="4" class="qrcode-area"> + <img src="${qrDataUrl}" alt="浜岀淮鐮�"> + <div class="qrcode-text">${this.orderData.qrCodeText}</div> + </td> + </tr> + <tr> + <td>瀹㈡埛鍚嶇О</td> + <td>${this.orderData.customerName}</td> + <td>鐗╂枡鍙�</td> + <td>${this.orderData.materialNo}</td> + </tr> + <tr> + <td>瀹㈡埛鍨嬪彿</td> + <td>${this.orderData.customerModel}</td> + <td>鐢熶骇鎵瑰彿</td> + <td>${this.orderData.productionBatch}</td> + </tr> + <tr> + <td>鐢熶骇鍒嗗巶</td> + <td>${this.orderData.factory}</td> + <td>鏁伴噺</td> + <td>${this.orderData.quantity}</td> + </tr> + <tr> + <td>妫�楠岀姸鎬�</td> + <td colspan="4"> + <div class="label-container"> + <span class="status-label">鍚堟牸</span> + <span class="status-label">宸叉楠�</span> + </div> + </td> + </tr> + </table> + </div> + </body> + </html> + `; + + // 鐢熸垚Blob閾炬帴骞惰烦杞瑙� + const blob = new Blob([htmlContent], { type: 'text/html' }); + const previewUrl = URL.createObjectURL(blob); + + uni.navigateTo({ + url: `/pages/print-preview/print-preview?previewUrl=${encodeURIComponent(previewUrl)}`, + success: () => { + this.isPreview = true; + this.addLog('绉诲簱鍗曢瑙堢敓鎴愭垚鍔�'); + }, + fail: (err) => { + this.addLog(`璺宠浆棰勮澶辫触: ${err.errMsg}`); + } + }); + } catch (error) { + this.addLog(`鐢熸垚澶辫触: ${error.message}`); + uni.showToast({ title: '鐢熸垚澶辫触', icon: 'none' }); + } finally { + this.isLoading = false; + } + }, + + // 瑙﹀彂棰勮 + previewTransferOrder() { + if (this.isLoading) return; + this.generateTransferHTML(); + } + } +}; </script> -<style> - .scanCode { - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 99; - height: 100%; - width: 100%; - background-color: rgba(0, 0, 0, 0.7); - } - - .reader-box { - position: fixed; - top: 0; - bottom: 0; - left: 0; - right: 0; - background-color: rgba(0, 0, 0, 0.5); - } - - .reader { - width: 540rpx; - height: 540rpx; - position: absolute; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - } +<style scoped> +.print-area { + padding: 20rpx; +} +.btn { + width: 100%; + padding: 20rpx; + margin-bottom: 15rpx; + border-radius: 8rpx; + color: #fff; + font-size: 28rpx; + background-color: #FF9500; +} +.status { + padding: 20rpx; + font-size: 28rpx; + color: #666; +} +.log { + margin: 10rpx; + padding: 20rpx; + background-color: #f5f5f5; + border-radius: 10rpx; +} +.log-title { + font-weight: bold; + display: block; + margin-bottom: 10rpx; + color: #333; +} +.log-item { + font-size: 26rpx; + color: #666; + margin-bottom: 5rpx; + word-break: break-all; +} </style> diff --git a/pages/user/location.vue b/pages/user/location.vue index 9128fff..ddb0f93 100644 --- a/pages/user/location.vue +++ b/pages/user/location.vue @@ -1,117 +1,656 @@ <template> - <view> - <cu-custom :bgColor="NavBarColor" :isBack="true"> + <view class="container"> + <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="index"> <block slot="backText">杩斿洖</block> - <block slot="content">瀹氫綅</block> + <block slot="content">缃戠粶鎵撳嵃鏈洪厤缃�</block> </cu-custom> - <map - style="width: 100%; height:500px;" - :latitude="latitude" - :longitude="longitude" - :markers="marker" - :scale="scale" - > - </map> - </view> + + <!-- 鎵撳嵃鏈鸿缃尯鍩� --> + <view class="setting-area"> + <view class="input-item"> + <text>鎵撳嵃鏈篒P:</text> + <uni-data-select v-model="printerIP" :localdata="printerList" @change="changePrinterList" + placeholder="璇烽�夋嫨" /> + <!-- <uni-easyinput v-model="printerIP" placeholder="渚嬪: 192.168.1.100" /> --> + </view> + <view class="input-item"> + <text>绔彛鍙�:</text> + <uni-easyinput v-model="printerPort" type="number" placeholder="榛樿: 9100" value="9100" /> + </view> + <view class="input-item"> + <text>鎵撳嵃鏈哄瀷鍙�:</text> + <uni-data-select v-model="printerModel" :localdata="printerModels" placeholder="閫夋嫨鎵撳嵃鏈哄瀷鍙�" /> + </view> + <!-- 骞冲彴闄愬埗鎻愮ず --> + <view class="platform-tip" v-if="isMini || isH5"> + 鈿狅笍 灏忕▼搴�/H5 涓嶆敮鎸佺洿鎺CP杩炴帴锛岄渶閫氳繃鍚庣涓浆 + </view> + <button @click="connectPrinter" :disabled="isConnected || (isMini || isH5)" class="btn primary"> + 杩炴帴鎵撳嵃鏈猴紙浠匒PP鏀寔锛� + </button> + <button @click="connectViaBackend" :disabled="isConnected" class="btn primary-outline" + v-if="isMini || isH5"> + 閫氳繃鍚庣杩炴帴鎵撳嵃鏈� + </button> + <button @click="disconnectPrinter" :disabled="!isConnected" class="btn danger"> + 鏂紑杩炴帴 + </button> + <button @click="testPrint" :disabled="!isConnected" class="btn test"> + 娴嬭瘯鎵撳嵃锛圸PL鎸囦护锛� + </button> + </view> + + <!-- 鎵撳嵃鍐呭鍖哄煙 --> + <view class="print-area" v-if="isConnected"> + <text class="print-title">閫夋嫨鎵撳嵃妯℃澘:</text> + <button @click="printStockLabel" class="btn print">鎵撳嵃鎴愬搧鍏ュ簱鏍囩</button> + <button @click="printTransferOrder" class="btn print">鎵撳嵃绉诲簱鍗�</button> + <button @click="printInspectionForm(1)" class="btn print">鎵撳嵃妫�楠屽崟A</button> + <button @click="printInspectionForm(2)" class="btn print">鎵撳嵃妫�楠屽崟B</button> + </view> + + <!-- 鐘舵�佹樉绀� --> + <view class="status"> + 杩炴帴鐘舵��: {{ isConnected ? '宸茶繛鎺ワ紙TCP锛�' : '鏈繛鎺�' }} + </view> + <view class="log" v-if="logList.length > 0"> + <text class="log-title">鎿嶄綔鏃ュ織:</text> + <view v-for="(log, index) in logList" :key="index" class="log-item"> + {{ log }} + </view> + </view> + </view> </template> <script> + // 寮曞叆璁惧淇℃伅鍒ゆ柇骞冲彴锛圓PP/灏忕▼搴�/H5锛� + import { + getSystemInfo, + isApp, + isMini, + isH5 + } from 'common/util/system.js'; + import PrinterCommands from 'common/util/printer-commands.js'; + export default { - data() { - return { - NavBarColor:this.NavBarColor, - id:0, // 浣跨敤 marker鐐瑰嚮浜嬩欢 闇�瑕佸~鍐檌d - title: 'map', - 銆�latitude: 40.009704, //绾害 - 銆�銆� longitude: 116.374999, //缁忓害 - 銆�銆�銆�marker: [{ - 銆�銆�id:0, - 銆�銆�latitude: 40.009704,//绾害 - 銆�銆�longitude: 116.374999,//缁忓害 - 銆�銆�iconPath: '/static/location.png', //鏄剧ず鐨勫浘鏍� - 銆�銆�rotate:0, // 鏃嬭浆搴︽暟 - 銆�銆�width:20, //瀹� - 銆�銆�height:20, //楂� - 銆�銆� title:'浣犲湪鍝簡',//鏍囨敞鐐瑰悕 - 銆�銆� alpha:0.5, //閫忔槑搴� - 銆�銆� /* label:{//涓烘爣璁扮偣鏃佽竟澧炲姞鏍囩 //鍥犺儗鏅鑹睭5涓嶆敮鎸� - 銆�銆� content:'鍖椾含鍥界偓鍏徃',//鏂囨湰 - 銆�銆�銆� color:'red',//鏂囨湰棰滆壊 - 銆� fontSize:24,//鏂囧瓧澶у皬 - x:5,//label鐨勫潗鏍囷紝鍘熺偣鏄� marker 瀵瑰簲鐨勭粡绾害 - y:1,//label鐨勫潗鏍囷紝鍘熺偣鏄� marker 瀵瑰簲鐨勭粡绾害 - borderWidth:12,//杈规瀹藉害 - borderColor:'pink',//杈规棰滆壊 - 銆� borderRadius:20,//杈规鍦嗚 - 銆� bgColor:'black',//鑳屾櫙鑹� - 銆� padding:5,//鏂囨湰杈圭紭鐣欑櫧 - textAlign:'right'//鏂囨湰瀵归綈鏂瑰紡銆� - }, */ - callout:{//鑷畾涔夋爣璁扮偣涓婃柟鐨勬皵娉$獥鍙� 鐐瑰嚮鏈夋晥 - 銆�銆�content:'鍖椾含鍥界偓鍏徃',//鏂囨湰 - 銆�銆�color:'#ffffff',//鏂囧瓧棰滆壊 - 銆�銆�fontSize:14,//鏂囨湰澶у皬 - 銆�銆�borderRadius:2,//杈规鍦嗚 - 銆�銆� bgColor:'#00c16f',//鑳屾櫙棰滆壊 - 銆�銆�display:'ALWAYS'//甯告樉 - } - // anchor:{//缁忕含搴﹀湪鏍囨敞鍥炬爣鐨勯敋鐐癸紝榛樿搴曡竟涓偣 - // x:0, 鍘熺偣涓虹粰鍑虹殑缁忕含搴� - // y:0, - // } - - }], - scale:16,//鍦板浘缂╂斁绋嬪害 - 銆� 銆�controls:[{//鍦ㄥ湴鍥句笂鏄剧ず鎺т欢锛屾帶浠朵笉闅忕潃鍦板浘绉诲姩 - 銆�銆�id:1,//鎺т欢id - 銆�銆�iconPath:'/static/login3.png',//鏄剧ず鐨勫浘鏍� - clickable:true, - 銆�銆�position:{//鎺т欢鍦ㄥ湴鍥剧殑浣嶇疆 - 銆�銆�left:15, - 銆�銆�top:15, - 銆�銆�width:50, - 銆�銆�height:50 - 銆�銆� }, - 銆�銆�}], - 銆� 銆�circles:[{//鍦ㄥ湴鍥句笂鏄剧ず鍦� - 銆�銆�latitude: 40.009704, - 銆�銆�longitude: 116.374999, - 銆�銆�radius:50,//鍗婂緞 - fillColor:"#ffffffAA",//濉厖棰滆壊 - 銆�銆�color:"#55aaffAA",//鎻忚竟鐨勯鑹� - 銆�銆� strokeWidth:1//鎻忚竟鐨勫搴� - }], - 銆�/* 銆�polyline:[{//鎸囧畾涓�绯诲垪鍧愭爣鐐癸紝浠庢暟缁勭涓�椤硅繛绾胯嚦鏈�鍚庝竴椤� - 銆�銆�銆�銆�points:[ - 銆�銆�{latitude: 40.009153,longitude: 116.374935}, - 銆�銆� {latitude: 40.009704,longitude: 116.374999}, - 銆�銆�銆�銆�], - 銆�銆�銆�銆�color:"#0000AA",//绾跨殑棰滆壊 - 銆�銆�銆�銆�width:2,//绾跨殑瀹藉害 - 銆�銆�銆�銆�dottedLine:true,//鏄惁铏氱嚎 - 銆�銆�銆�銆�arrowLine:true, //甯︾澶寸殑绾� 寮�鍙戣�呭伐鍏锋殏涓嶆敮鎸佽灞炴�� - 銆�銆�}], */ - } - }, - onLoad() { - this.getLocation() + name: 'NetworkPrinter', + data() { + return { + printerList: [], + NavBarColor: this.NavBarColor, + printerIP: '', // 鏂戦┈鎵撳嵃鏈篒P锛堥渶鏇挎崲涓哄疄闄呭�硷級 + printerPort: '9100', // 鏂戦┈榛樿TCP绔彛 + printerModel: 'zebra', // 榛樿涓烘枒椹郴鍒� + printerModels: [{ + value: 'epson', + text: '鐖辨櫘鐢�(EPSON)绯诲垪' + }, + { + value: 'zebra', + text: '鏂戦┈(ZEBRA)绯诲垪' // 閫変腑鏂戦┈ + }, + { + value: 'citizen', + text: '瑗块搧鍩�(CITIZEN)绯诲垪' + }, + { + value: 'generic', + text: '閫氱敤ESC/POS鍏煎' + } + ], + isConnected: false, + socketTask: null, // 鍘熺敓TCP Socket瀹炰緥锛堟浛鎹ocket.io锛� + logList: [], + isMini: false, // 鏄惁涓哄皬绋嬪簭 + isH5: false, // 鏄惁涓篐5 + // 鍚庣涓浆鎺ュ彛鍦板潃锛堝皬绋嬪簭/H5浣跨敤锛� + url: { + list: 'base/printerConfig/queryUserPrinterConfigList' + }, + backendPrintUrl: '/api/printer/print' + }; }, - methods: { - getLocation(){ - uni.getLocation({ - type: 'gcj02', - success: function (res) { - console.log('褰撳墠浣嶇疆鐨勭粡搴︼細' + res.longitude); - console.log('褰撳墠浣嶇疆鐨勭含搴︼細' + res.latitude); - }, - fail: function (res) { - console.log('褰撳墠浣嶇疆鐨勭粡搴�'); - } + onLoad() { + // 鍒濆鍖栵細鍒ゆ柇褰撳墠骞冲彴 + this.initPlatform(); + // 鍔犺浇缂撳瓨閰嶇疆 + this.loadPrinterConfig(); + }, + onUnload() { + // 椤甸潰閿�姣佹椂鏂紑杩炴帴 + this.disconnectPrinter(); + // 淇濆瓨閰嶇疆 + this.savePrinterConfig(); + }, + created() { + this.getPrinterList() + }, + methods: { + changePrinterList(e) { + this.printerIP = e; + console.log(this.printerIP) + }, + getPrinterList() { + this.$http.get(this.url.list, { + params: {}, + + }).then(res => { + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + this.printerList = res.data.result + } else { + uni.showToast({ + icon: "error", + title: res.data.message, + duration: 2000 + }); + + } + }).catch(() => { + this.$tip.error("鑱旂綉澶辫触") + }) + }, + + // 鍒濆鍖栧钩鍙帮紙鍒ゆ柇APP/灏忕▼搴�/H5锛� + initPlatform() { + // 鐩存帴璋冪敤瀵煎叆鐨勫懡鍚嶆柟娉曪紝涓嶄細鎶ラ敊 + const systemInfo = getSystemInfo(); // 姝g‘锛氳皟鐢ㄥ懡鍚嶅鍑虹殑 getSystemInfo 鍑芥暟 + this.isApp = isApp(); // 姝g‘锛氳皟鐢ㄥ懡鍚嶅鍑虹殑 isApp 鍑芥暟 + this.isMini = isMini(); // 姝g‘锛氳皟鐢ㄥ懡鍚嶅鍑虹殑 isMini 鍑芥暟 + this.isH5 = isH5(); // 姝g‘锛氳皟鐢ㄥ懡鍚嶅鍑虹殑 isH5 鍑芥暟 + this.isMini = systemInfo.platform === 'mp-weixin' || systemInfo.platform === 'mp-alipay'; + this.isH5 = systemInfo.platform === 'h5'; + if (this.isMini || this.isH5) { + this.addLog(`褰撳墠骞冲彴锛�${this.isMini ? '灏忕▼搴�' : 'H5'}锛岄渶閫氳繃鍚庣涓浆`); + } + }, + + // 鍔犺浇淇濆瓨鐨勬墦鍗版満閰嶇疆 + loadPrinterConfig() { + const config = uni.getStorageSync('printerConfig'); + if (config) { + this.printerIP = config.ip || this.printerIP; + this.printerPort = config.port || this.printerPort; + this.printerModel = config.model || this.printerModel; + } + }, + + // 淇濆瓨鎵撳嵃鏈洪厤缃� + savePrinterConfig() { + uni.setStorageSync('printerConfig', { + ip: this.printerIP, + port: this.printerPort, + model: this.printerModel }); + }, + + // 娣诲姞鏃ュ織 + addLog(message) { + const time = new Date().toLocaleTimeString(); + this.logList.unshift(`[${time}] ${message}`); + if (this.logList.length > 20) this.logList.pop(); + }, + + // 1. APP绔細鐩存帴TCP杩炴帴鏂戦┈鎵撳嵃鏈猴紙鏍稿績淇敼锛� + connectPrinter() { + if (!this.printerIP || !this.printerPort) { + uni.showToast({ + title: '璇疯緭鍏P鍜岀鍙�', + icon: 'none' + }); + return; + } + + // 鍏堝叧闂凡鏈夎繛鎺� + if (this.socketTask) this.disconnectPrinter(); + + this.addLog(`姝e湪TCP杩炴帴锛�${this.printerIP}:${this.printerPort}`); + // 鍘熺敓TCP Socket杩炴帴锛坱ype: 'tcp' 蹇呴』鎸囧畾锛� + this.socketTask = uni.createSocket({ + url: `tcp://${this.printerIP}:${this.printerPort}`, + type: 'tcp', // 鏄庣‘鎸囧畾涓篢CP杩炴帴锛堟枒椹墦鍗版満浠呮敮鎸乀CP锛� + success: () => { + this.addLog('Socket鍒涘缓鎴愬姛锛岀瓑寰呰繛鎺�...'); + // 鐩戝惉杩炴帴鎴愬姛 + this.socketTask.onOpen(() => { + this.isConnected = true; + this.addLog('鏂戦┈鎵撳嵃鏈鸿繛鎺ユ垚鍔燂紙TCP锛�'); + this.savePrinterConfig(); + uni.showToast({ + title: '杩炴帴鎴愬姛', + icon: 'success' + }); + }); + // 鐩戝惉杩炴帴閿欒 + this.socketTask.onError((err) => { + this.isConnected = false; + this.addLog(`杩炴帴澶辫触锛�${err.errMsg || '绔彛琚崰鐢ㄦ垨鎵撳嵃鏈虹绾�'}`); + uni.showToast({ + title: '杩炴帴澶辫触锛屾鏌P/绔彛', + icon: 'none' + }); + }); + // 鐩戝惉杩炴帴鏂紑 + this.socketTask.onClose((res) => { + this.isConnected = false; + this.addLog(`杩炴帴鏂紑锛�${res.reason || '鏈煡鍘熷洜'}`); + // 琚姩鏂紑鏃跺皾璇曢噸杩烇紙鍙�夛級 + if (res.code !== 1000) { + setTimeout(() => this.connectPrinter(), 3000); + } + }); + }, + fail: (err) => { + this.addLog(`鍒涘缓Socket澶辫触锛�${err.errMsg}`); + uni.showToast({ + title: '鍒涘缓杩炴帴澶辫触', + icon: 'none' + }); + } + }); + }, + + // 2. 灏忕▼搴�/H5锛氶�氳繃鍚庣涓浆杩炴帴锛堟柊澧烇級 + connectViaBackend() { + // 鍚庣涓浆鏃犻渶鍓嶇寤虹珛TCP锛屼粎闇�淇濆瓨閰嶇疆骞堕獙璇佸悗绔繛閫氭�� + if (!this.printerIP || !this.printerPort) { + uni.showToast({ + title: '璇疯緭鍏P鍜岀鍙�', + icon: 'none' + }); + return; + } + this.addLog(`閫氳繃鍚庣楠岃瘉鎵撳嵃鏈猴細${this.printerIP}:${this.printerPort}`); + // 璋冪敤鍚庣鎺ュ彛楠岃瘉鎵撳嵃鏈虹姸鎬� + uni.request({ + url: '/api/printer/checkStatus', + method: 'POST', + data: { + ip: this.printerIP, + port: this.printerPort + }, + success: (res) => { + if (res.data.success) { + this.isConnected = true; // 鏍囪涓衡�滃悗绔凡杩炴帴鈥� + this.addLog('鍚庣杩炴帴鎵撳嵃鏈烘垚鍔�'); + this.savePrinterConfig(); + uni.showToast({ + title: '鍚庣杩炴帴鎴愬姛', + icon: 'success' + }); + } else { + this.addLog(`鍚庣杩炴帴澶辫触锛�${res.data.message}`); + uni.showToast({ + title: res.data.message, + icon: 'none' + }); + } + }, + fail: (err) => { + this.addLog(`鍚庣鎺ュ彛寮傚父锛�${err.errMsg}`); + uni.showToast({ + title: '鍚庣鎺ュ彛涓嶅彲鐢�', + icon: 'none' + }); + } + }); + }, + + // 鏂紑杩炴帴 + disconnectPrinter() { + if (this.socketTask) { + this.socketTask.close({ + success: () => { + this.isConnected = false; + this.socketTask = null; + this.addLog('宸叉柇寮�TCP杩炴帴'); + uni.showToast({ + title: '宸叉柇寮�杩炴帴', + icon: 'none' + }); + } + }); + } else if (this.isConnected && (this.isMini || this.isH5)) { + // 鍚庣涓浆鍦烘櫙锛氶�氱煡鍚庣鏂紑 + uni.request({ + url: '/api/printer/disconnect' + }); + this.isConnected = false; + this.addLog('宸查�氱煡鍚庣鏂紑杩炴帴'); + uni.showToast({ + title: '宸叉柇寮�杩炴帴', + icon: 'none' + }); + } + }, + + // 3. 鍙戦�乑PL鎸囦护锛堟牳蹇冧慨鏀癸細鐩存帴鍙戦�佷簩杩涘埗鎸囦护锛屾浛鎹ocket.io emit锛� + sendZplCommand(zplCode, retry = 2) { + return new Promise((resolve, reject) => { + // 鍖哄垎APP鐩磋繛鍜屽悗绔腑杞� + if (this.isMini || this.isH5) { + // 灏忕▼搴�/H5锛氶�氳繃鍚庣鍙戦�乑PL + uni.request({ + url: this.backendPrintUrl, + method: 'POST', + data: { + ip: this.printerIP, + port: this.printerPort, + zplCode: zplCode + }, + success: (res) => { + if (res.data.success) resolve(res.data); + else if (retry > 0) { + this.addLog(`鍚庣鎵撳嵃澶辫触锛岄噸璇�(${retry}娆�)...`); + setTimeout(() => this.sendZplCommand(zplCode, retry - 1).then( + resolve).catch(reject), 1000); + } else reject(new Error(res.data.message || '鍚庣鎵撳嵃澶辫触')); + }, + fail: (err) => reject(new Error(`鍚庣璇锋眰澶辫触锛�${err.errMsg}`)) + }); + } else { + // APP绔細鐩存帴TCP鍙戦�乑PL锛堜簩杩涘埗鏍煎紡锛� + if (!this.socketTask || !this.isConnected) { + reject(new Error('鏈缓绔婽CP杩炴帴')); + return; + } + // ZPL鎸囦护杞负Uint8Array锛堥伩鍏嶇紪鐮侀棶棰橈級 + const buffer = new Uint8Array(Buffer.from(zplCode)); + this.socketTask.send({ + data: buffer, + success: () => { + this.addLog('ZPL鎸囦护鍙戦�佹垚鍔�'); + resolve({ + success: true + }); + }, + fail: (err) => { + if (retry > 0) { + this.addLog(`鎸囦护鍙戦�佸け璐ワ紝閲嶈瘯(${retry}娆�)...`); + setTimeout(() => this.sendZplCommand(zplCode, retry - 1).then( + resolve).catch(reject), 1000); + } else reject(new Error(`鍙戦�佸け璐ワ細${err.errMsg}`)); + } + }); + } + }); + }, + + // 4. 鏋勫缓鏂戦┈ZPL鎸囦护锛堟牳蹇冧慨鏀癸細閫傞厤涓枃銆佷簩缁寸爜锛� + buildZpl(data, templateType) { + const commands = new PrinterCommands(this.printerModel); + // 鏂戦┈涓撶敤ZPL鎸囦护鏋勫缓锛堣鐩朠rinterCommands涓搴旀柟娉曪級 + switch (templateType) { + case 'test': + // 娴嬭瘯椤碉細鍚腑鏂囧拰绠�鍗曟枃鏈紙瑙e喅涔辩爜锛� + return `^XA^CI28^CFSIMSUN,30^FO50,50^FD鏂戦┈鎵撳嵃鏈烘祴璇曢〉锛堜腑鏂囷級^FS^FO50,100^FD褰撳墠鏃堕棿锛�${new Date().toLocaleString()}^FS^XZ`; + case 'stockLabel': + // 鎴愬搧鍏ュ簱鏍囩锛氬惈浜岀淮鐮侊紙ZPL鍘熺敓^BQ鎸囦护锛� + return `^XA + ^CI28^CFSIMSUN,24 // UTF-8缂栫爜 + 涓枃瀛椾綋锛圫IMSUN闇�鎻愬墠涓婁紶鍒版墦鍗版満锛� + ^FO30,30^FD璁㈠崟鍙凤細${data.orderNo}^FS + ^FO30,70^FD瀹㈡埛锛�${data.customer}^FS + ^FO30,110^FD鐗╂枡鍙凤細${data.materialNo}^FS + ^FO30,150^FD鎵规鍙凤細${data.batchNo}^FS + ^FO30,190^FD瑙勬牸锛�${data.spec}^FS + ^FO30,230^FD鏁伴噺锛�${data.quantity}浠禴FS + ^FO220,30^BQN,2,10 // 浜岀淮鐮侊細QR Code锛岀籂閿欑瓑绾�2锛屽ぇ灏�10 + ^FDQA,鐗╂枡:${data.materialNo},鎵规:${data.batchNo}^FS // QA鍓嶇紑=QR Code锛屽唴瀹逛负鐗╂枡+鎵规 + ^XZ`.replace(/\s+/g, ''); // 鍘婚櫎澶氫綑绌烘牸锛岄伩鍏嶈В鏋愰敊璇� + case 'transferOrder': + // 绉诲簱鍗曪細绫讳技鍏ュ簱鏍囩锛岃皟鏁村瓧娈� + return `^XA + ^CI28^CFSIMSUN,24 + ^FO30,30^FD绉诲簱鍗曞彿锛�${data.orderNo}^FS + ^FO30,70^FD瀹㈡埛锛�${data.customer}^FS + ^FO30,110^FD鐗╂枡鍙凤細${data.materialNo}^FS + ^FO30,150^FD鎵规鍙凤細${data.batchNo}^FS + ^FO30,190^FD宸ュ巶锛�${data.factory}^FS + ^FO220,30^BQN,2,10 + ^FDQA,绉诲簱鍗�:${data.orderNo},鏁伴噺:${data.quantity}^FS + ^XZ`.replace(/\s+/g, ''); + case 'inspectionA': + case 'inspectionB': + // 妫�楠屽崟锛氬琛屾楠岄」 + let inspectionItems = ''; + data.items.forEach((item, idx) => { + inspectionItems += `^FO30,${110 + idx * 40}^FD${item.name}锛�${item.result}^FS`; + }); + return `^XA + ^CI28^CFSIMSUN,24 + ^FO30,30^FD妫�楠屽崟鍙凤細${data.formNo}^FS + ^FO30,70^FD妫�楠屽憳锛�${data.inspector}^FS + ${inspectionItems} + ^FO220,30^BQN,2,10 + ^FDQA,妫�楠屽崟:${data.formNo},鐗╂枡:${data.materialNo}^FS + ^XZ`.replace(/\s+/g, ''); + default: + throw new Error('鏈煡妯℃澘绫诲瀷'); + } + }, + + // 娴嬭瘯鎵撳嵃锛圸PL鎸囦护锛� + async testPrint() { + try { + const zplCode = this.buildZpl({}, 'test'); + await this.sendZplCommand(zplCode); + this.addLog('娴嬭瘯椤垫墦鍗版垚鍔燂紙ZPL鎸囦护锛�'); + uni.showToast({ + title: '娴嬭瘯鎵撳嵃鎴愬姛', + icon: 'success' + }); + } catch (error) { + this.addLog(`娴嬭瘯鎵撳嵃澶辫触锛�${error.message}`); + uni.showToast({ + title: '鎵撳嵃澶辫触', + icon: 'none' + }); + } + }, + + // 鎵撳嵃鎴愬搧鍏ュ簱鏍囩锛堜娇鐢╖PL锛� + async printStockLabel() { + try { + const data = { + orderNo: '11263797', + customer: '鍚夊埄', + model: '6608268440', + materialNo: '120026829', + batchNo: '25219773', + spec: 'G3-700A', + quantity: 100, + date: '2023/06/07' + }; + const zplCode = this.buildZpl(data, 'stockLabel'); + await this.sendZplCommand(zplCode); + this.addLog('鎴愬搧鍏ュ簱鏍囩鎵撳嵃鎴愬姛'); + uni.showToast({ + title: '鎵撳嵃鎴愬姛', + icon: 'success' + }); + } catch (error) { + this.addLog(`鎵撳嵃澶辫触锛�${error.message}`); + uni.showToast({ + title: '鎵撳嵃澶辫触', + icon: 'none' + }); + } + }, + + // 鎵撳嵃绉诲簱鍗曪紙浣跨敤ZPL锛� + async printTransferOrder() { + try { + const data = { + orderNo: '112379', + productModel: 'G-639', + customer: '涓滄柟鏃ヤ骇', + materialNo: '120047854', + customerModel: '4200-51354', + batchNo: '25159847', + factory: '鍙屾灄鏂扮伀鐐伐鍘�', + quantity: 73 + }; + const zplCode = this.buildZpl(data, 'transferOrder'); + await this.sendZplCommand(zplCode); + this.addLog('绉诲簱鍗曟墦鍗版垚鍔�'); + uni.showToast({ + title: '鎵撳嵃鎴愬姛', + icon: 'success' + }); + } catch (error) { + this.addLog(`鎵撳嵃澶辫触锛�${error.message}`); + uni.showToast({ + title: '鎵撳嵃澶辫触', + icon: 'none' + }); + } + }, + + // 鎵撳嵃妫�楠屽崟锛堜娇鐢╖PL锛� + async printInspectionForm(type) { + try { + const data = { + formNo: type === 1 ? 'JYD-20250801' : 'JYD-20250802', + materialNo: '120026829', + batchNo: '25219773', + inspector: '寮犱笁', + date: new Date().toLocaleDateString(), + items: [{ + name: '澶栬', + result: '鍚堟牸' + }, + { + name: '灏哄', + result: '鍚堟牸' + }, + { + name: '鎬ц兘', + result: type === 1 ? '鍚堟牸' : '寰呮' + } + ] + }; + const zplCode = this.buildZpl(data, `inspection${type === 1 ? 'A' : 'B'}`); + await this.sendZplCommand(zplCode); + this.addLog(`妫�楠屽崟${type}鎵撳嵃鎴愬姛`); + uni.showToast({ + title: '鎵撳嵃鎴愬姛', + icon: 'success' + }); + } catch (error) { + this.addLog(`鎵撳嵃澶辫触锛�${error.message}`); + uni.showToast({ + title: '鎵撳嵃澶辫触', + icon: 'none' + }); + } } - } - } + } + }; </script> -<style> -</style> + +<style scoped> + .platform-tip { + color: #FF3B30; + font-size: 24rpx; + margin-bottom: 15rpx; + padding: 10rpx; + background-color: #FFF8F8; + border-radius: 8rpx; + } + + .btn.primary-outline { + background-color: #fff; + color: #007AFF; + border: 1rpx solid #007AFF; + } + + .container { + padding-bottom: 20rpx; + } + + .setting-area, + .print-area { + padding: 20rpx; + background-color: #fff; + margin: 10rpx; + border-radius: 10rpx; + } + + .input-item { + display: flex; + align-items: center; + margin-bottom: 20rpx; + border-bottom: 1rpx solid #eee; + padding-bottom: 10rpx; + } + + .input-item text { + width: 140rpx; + font-size: 28rpx; + color: #333; + } + + .uni-easyinput { + flex: 1; + } + + .btn { + width: 100%; + padding: 20rpx; + margin-bottom: 15rpx; + border-radius: 8rpx; + color: #fff; + font-size: 28rpx; + } + + .primary { + background-color: #007AFF; + } + + .danger { + background-color: #FF3B30; + } + + .print { + background-color: #00C853; + } + + .test { + background-color: #FF9500; + } + + .print-title { + display: block; + font-size: 28rpx; + color: #666; + margin-bottom: 15rpx; + } + + .status { + padding: 20rpx; + font-size: 28rpx; + color: #666; + } + + .log { + margin: 10rpx; + padding: 20rpx; + background-color: #f5f5f5; + border-radius: 10rpx; + } + + .log-title { + font-weight: bold; + display: block; + margin-bottom: 10rpx; + color: #333; + } + + .log-item { + font-size: 26rpx; + color: #666; + margin-bottom: 5rpx; + word-break: break-all; + } +</style> \ No newline at end of file diff --git a/pages/user/people.vue b/pages/user/people.vue index 17c1530..22fbd9c 100644 --- a/pages/user/people.vue +++ b/pages/user/people.vue @@ -48,6 +48,18 @@ <text class="text-grey">瀹氫綅</text> </view> </navigator> --> + <navigator class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.4s'}]" url="/pages/user/location" hover-class="none"> + <view class="content" > + <text class="cuIcon-news text-cyan"></text> + <text class="text-grey">鎵撳嵃鏈�</text> + </view> + </navigator> + <navigator class="cu-item arrow animation-slide-bottom" :style="[{animationDelay: '0.4s'}]" url="/pages/lineSelect/lineSelect" hover-class="none"> + <view class="content" > + <text class="cuIcon-location text-cyan"></text> + <text class="text-grey">浜х嚎</text> + </view> + </navigator> <navigator class="cu-item arrow animation-slide-bottom" url="/pages/user/userdetail" :style="[{animationDelay: '0.6s'}]"> <view class="content"> <text class="cuIcon-settingsfill text-cyan"></text> diff --git a/store/index.js b/store/index.js index 22ff7ca..662a799 100644 --- a/store/index.js +++ b/store/index.js @@ -3,172 +3,259 @@ import api from "@/api/api" import MinCache from '@/common/util/MinCache.js' import { - ACCESS_TOKEN, - USER_NAME, - USER_INFO, - X_TENANT_ID + ACCESS_TOKEN, + USER_NAME, + USER_INFO, + X_TENANT_ID } from "@/common/util/constants" Vue.use(Vuex) export default new Vuex.Store({ - state: { - auth: [], - token: '', - userid: '', - username: '', - realname: '', - welcome: '', - avatar: '' - }, - mutations: { - SET_AUTH(state, auth) { - state.auth = auth - }, - SET_TOKEN: (state, token) => { - state.token = token - }, - SET_NAME: (state, { - username, - realname, - welcome - }) => { - state.username = username - state.realname = realname - state.welcome = welcome - }, - SET_AVATAR: (state, avatar) => { - state.avatar = avatar - } - }, - actions: { - // 鐧诲綍 - mLogin({ - commit - }, userInfo) { - return new Promise((resolve, reject) => { - api.login(userInfo).then(response => { - if (response.data.code == 200) { - const result = response.data.result - const userInfo = result.userInfo - uni.setStorageSync(ACCESS_TOKEN, result.token); - uni.setStorageSync("isLogin", true); - uni.setStorageSync("userId", userInfo.id); - uni.setStorageSync(USER_INFO, userInfo); - commit('SET_TOKEN', result.token) - commit('SET_AVATAR', userInfo.avatar) - commit('SET_NAME', { - username: userInfo.username, - realname: userInfo.realname - }) - resolve(response) - } else { - resolve(response) - } - }).catch(error => { - console.log("catch===>response", response) - reject(error) - }) - }) - }, - //鎵嬫満鍙风櫥褰� - PhoneLogin({ - commit - }, userInfo) { - return new Promise((resolve, reject) => { - api.phoneNoLogin(userInfo).then(response => { - if (response.data.code == 200) { - const result = response.data.result - const userInfo = result.userInfo - uni.setStorageSync(ACCESS_TOKEN, result.token); - uni.setStorageSync(USER_INFO, userInfo); - commit('SET_TOKEN', result.token) - commit('SET_NAME', { - username: userInfo.username, - realname: userInfo.realname - }) - commit('SET_AVATAR', userInfo.avatar) - resolve(response) - } else { - reject(response) - } - }).catch(error => { - reject(error) - }) - }) - }, - // 绗笁鏂圭櫥褰� - ThirdLogin({ - commit - }, param) { - return new Promise((resolve, reject) => { - api.thirdLogin(param.token, param.thirdType).then(response => { - if (response.data.code == '200') { - const result = response.data.result - const userInfo = result.userInfo - uni.setStorageSync(ACCESS_TOKEN, result.token); - uni.setStorageSync(USER_INFO, userInfo); - uni.setStorageSync("userId", userInfo.id); - uni.setStorageSync(X_TENANT_ID, userInfo.loginTenantId); + state: { + auth: [], + token: '', + userid: '', + username: '', + realname: '', + welcome: '', + avatar: '', + user: {}, // 琛ュ厖鐢ㄦ埛淇℃伅瀵硅薄 + tenantId: '', // 琛ュ厖绉熸埛ID + // 浜х嚎绠$悊鐩稿叧鐘舵�� + lineList: [], // 浜х嚎鍒楄〃 + currentLineId: uni.getStorageSync('currentLineId') || null, // 褰撳墠閫変腑鐨勪骇绾縄D + currentLineName: uni.getStorageSync('currentLineName') || '', // 褰撳墠閫変腑鐨勪骇绾垮悕绉� + currentLineInfo: null, // 褰撳墠閫変腑鐨勪骇绾胯缁嗕俊鎭� + currentLineType: uni.getStorageSync('currentLineType') || '' // 鏂板锛氬綋鍓嶉�変腑鐨勪骇绾跨被鍨� + }, + mutations: { + SET_AUTH(state, auth) { + state.auth = auth + }, + SET_TOKEN: (state, token) => { + state.token = token + }, + SET_NAME: (state, { + username, + realname, + welcome + }) => { + state.username = username + state.realname = realname + state.welcome = welcome + }, + SET_AVATAR: (state, avatar) => { + state.avatar = avatar + }, + SET_ID: (state, id) => { + state.userid = id + }, + SET_INFO: (state, userInfo) => { + state.user = userInfo + }, + SET_TENANTID: (state, tenantId) => { + state.tenantId = tenantId + }, + // 浜х嚎鐩稿叧mutations + SET_LINE_LIST(state, list) { + state.lineList = list + console.log('Vuex SET_LINE_LIST: 浜х嚎鍒楄〃宸叉洿鏂�', list); + }, + SET_CURRENT_LINE_ID(state, lineId) { + state.currentLineId = lineId + uni.setStorageSync('currentLineId', lineId) - commit('SET_TOKEN', result.token) - commit('SET_AVATAR', userInfo.avatar) - commit('SET_NAME', { - username: userInfo.username, - realname: userInfo.realname - }) - commit('SET_ID', userInfo.id) - commit('SET_INFO', userInfo) - commit('SET_TENANTID', userInfo.loginTenantId) - resolve(response) - } else { - reject(response) - } - }).catch(error => { - reject(error) - }) - }) - }, - // 鐧诲嚭 - Logout({ - commit, - state - }) { - return new Promise((resolve) => { - let logoutToken = state.token; - commit('SET_TOKEN', '') - uni.removeStorageSync(ACCESS_TOKEN) - api.logout(logoutToken).then(() => { - resolve() - }).catch(() => { - resolve() - }) - }) - }, - saveAuth({ - commit - }, auth) { - commit('SET_AUTH', auth) - } - }, - getters: { - getAuth: state => state.auth, - token: state => state.token, - username: state => { - state.userid = uni.getStorageSync(USER_INFO).username; - return state.username - }, - nickname: state => { - state.userid = uni.getStorageSync(USER_INFO).realname; - return state.user.realname - }, - avatar: state => { - state.userid = uni.getStorageSync(USER_INFO).avatar; - return state.user.avatar - }, - userid: state => { - state.userid = uni.getStorageSync(USER_INFO).id; - return state.userid - }, - } + // 鍚屾鏇存柊褰撳墠浜х嚎淇℃伅銆佸悕绉板拰绫诲瀷 + if (lineId && state.lineList.length > 0) { + state.currentLineInfo = state.lineList.find(line => line.id === lineId) || null + // 浠庝骇绾夸俊鎭腑鎻愬彇鍚嶇О骞朵繚瀛� + state.currentLineName = state.currentLineInfo ? state.currentLineInfo.name : '' + // 鏂板锛氫粠浜х嚎淇℃伅涓彁鍙栫被鍨嬪苟淇濆瓨 + state.currentLineType = state.currentLineInfo ? state.currentLineInfo.type : '' + + uni.setStorageSync('currentLineName', state.currentLineName) + // 鏂板锛氬皢绫诲瀷鍚屾淇濆瓨鍒版湰鍦板瓨鍌� + uni.setStorageSync('currentLineType', state.currentLineType) + } else { + state.currentLineInfo = null + state.currentLineName = '' + state.currentLineType = '' // 鏂板锛氭竻绌虹被鍨� + + uni.removeStorageSync('currentLineName') + uni.removeStorageSync('currentLineType') // 鏂板锛氭竻闄ゆ湰鍦板瓨鍌ㄧ殑绫诲瀷 + } + console.log('Vuex SET_CURRENT_LINE_ID: 褰撳墠浜х嚎ID宸叉洿鏂�', lineId); + console.log('Vuex SET_CURRENT_LINE_NAME: 褰撳墠浜х嚎鍚嶇О宸叉洿鏂�', state.currentLineName); + console.log('Vuex SET_CURRENT_LINE_TYPE: 褰撳墠浜х嚎绫诲瀷宸叉洿鏂�', state.currentLineType); // 鏂板锛氭墦鍗扮被鍨嬩俊鎭� + } + }, + actions: { + // 璐﹀彿鐧诲綍 + mLogin({ + commit + }, userInfo) { + return new Promise((resolve, reject) => { + api.login(userInfo).then(response => { + if (response.data.code == 200) { + const result = response.data.result + const userInfo = result.userInfo + uni.setStorageSync(ACCESS_TOKEN, result.token); + uni.setStorageSync("isLogin", true); + uni.setStorageSync("userId", userInfo.id); + uni.setStorageSync(USER_INFO, userInfo); + commit('SET_TOKEN', result.token) + commit('SET_AVATAR', userInfo.avatar) + commit('SET_NAME', { + username: userInfo.username, + realname: userInfo.realname + }) + commit('SET_ID', userInfo.id) + commit('SET_INFO', userInfo) + resolve(response) + } else { + resolve(response) + } + }).catch(error => { + console.log("鐧诲綍澶辫触:", error) + reject(error) + }) + }) + }, + // 鎵嬫満鍙风櫥褰� + PhoneLogin({ + commit + }, userInfo) { + return new Promise((resolve, reject) => { + api.phoneNoLogin(userInfo).then(response => { + if (response.data.code == 200) { + const result = response.data.result + const userInfo = result.userInfo + uni.setStorageSync(ACCESS_TOKEN, result.token); + uni.setStorageSync(USER_INFO, userInfo); + commit('SET_TOKEN', result.token) + commit('SET_NAME', { + username: userInfo.username, + realname: userInfo.realname + }) + commit('SET_AVATAR', userInfo.avatar) + commit('SET_ID', userInfo.id) + commit('SET_INFO', userInfo) + resolve(response) + } else { + reject(response) + } + }).catch(error => { + reject(error) + }) + }) + }, + // 绗笁鏂圭櫥褰� + ThirdLogin({ + commit + }, param) { + return new Promise((resolve, reject) => { + api.thirdLogin(param.token, param.thirdType).then(response => { + if (response.data.code == '200') { + const result = response.data.result + const userInfo = result.userInfo + uni.setStorageSync(ACCESS_TOKEN, result.token); + uni.setStorageSync(USER_INFO, userInfo); + uni.setStorageSync("userId", userInfo.id); + uni.setStorageSync(X_TENANT_ID, userInfo.loginTenantId); + + commit('SET_TOKEN', result.token) + commit('SET_AVATAR', userInfo.avatar) + commit('SET_NAME', { + username: userInfo.username, + realname: userInfo.realname + }) + commit('SET_ID', userInfo.id) + commit('SET_INFO', userInfo) + commit('SET_TENANTID', userInfo.loginTenantId) + resolve(response) + } else { + reject(response) + } + }).catch(error => { + reject(error) + }) + }) + }, + // 鐧诲嚭 + Logout({ + commit, + state + }) { + return new Promise((resolve) => { + let logoutToken = state.token; + commit('SET_TOKEN', '') + uni.removeStorageSync(ACCESS_TOKEN) + uni.removeStorageSync("isLogin") + uni.removeStorageSync("userId") + // 娓呴櫎浜х嚎閫夋嫨鐘舵�� + commit('SET_CURRENT_LINE_ID', null) + api.logout(logoutToken).then(() => { + resolve() + }).catch(() => { + resolve() + }) + }) + }, + saveAuth({ + commit + }, auth) { + commit('SET_AUTH', auth) + }, + + // 鑾峰彇浜х嚎鍒楄〃锛堝凡鍖呭惈type瀛楁锛� + fetchLineList({ commit, state }) { + return new Promise((resolve, reject) => { + api.getLineList({ + headers: { + 'Authorization': `Bearer ${state.token}` + } + }).then(response => { + console.log('fetchLineList鎺ュ彛杩斿洖鍘熷鏁版嵁:', response); + if (response.data.code === 200) { + const lineList = (response.data.result || []).map(line => ({ + id: line.value, + name: line.text, + type: line.type // 纭繚鏄犲皠type瀛楁 + })); + commit('SET_LINE_LIST', lineList); + resolve(lineList); + } else { + reject(new Error(`鑾峰彇浜х嚎鍒楄〃澶辫触: ${response.data.message || '鏈煡閿欒'}`)); + } + }).catch(error => { + console.error('鑾峰彇浜х嚎鍒楄〃鍑洪敊:', error); + reject(error); + }); + }); + }, + + // 璁剧疆褰撳墠浜х嚎锛堜繚鎸佷笉鍙橈紝绫诲瀷閫氳繃mutation鑷姩鍚屾锛� + setCurrentLine({ commit }, lineId) { + return new Promise((resolve) => { + commit('SET_CURRENT_LINE_ID', lineId) + resolve() + }) + } + }, + getters: { + getAuth: state => state.auth, + token: state => state.token, + username: state => state.username || uni.getStorageSync(USER_INFO)?.username || '', + nickname: state => state.realname || uni.getStorageSync(USER_INFO)?.realname || '', + avatar: state => state.avatar || uni.getStorageSync(USER_INFO)?.avatar || '', + userid: state => state.userid || uni.getStorageSync(USER_INFO)?.id || '', + // 浜х嚎鐩稿叧getters + lineList: state => state.lineList, + currentLineId: state => state.currentLineId, + currentLineName: state => state.currentLineName, + currentLineInfo: state => state.currentLineInfo, + currentLineType: state => state.currentLineType, // 鏂板锛氳幏鍙栧綋鍓嶄骇绾跨被鍨嬬殑getter + hasSelectedLine: state => !!state.currentLineId + } }) -- Gitblit v1.9.3