From ae3855638dba0c927236c1a1b1a85d5b048c40e2 Mon Sep 17 00:00:00 2001 From: Houjie <714924425@qq.com> Date: 星期五, 18 四月 2025 10:31:08 +0800 Subject: [PATCH] 提交 --- pages/spare/spare.vue | 275 +++---- plugin/uni-simple-router/helpers/urlQuery.js | 332 +++++--- common/service/config.service.js | 6 pages/login/login.vue | 619 +++++++++-------- pages.json | 21 pages/device/device.vue | 278 +------ pages/TaskManager/TaskManagerList.vue | 98 -- store/index.js | 1 common/router/index.js | 61 common/router/modules/routes.js | 28 manifest.json | 29 api/api.js | 2 main.js | 2 pages/common/helloWorld.vue | 304 ++++++- common/util/work.js | 53 pages/index/index.vue | 11 16 files changed, 1,101 insertions(+), 1,019 deletions(-) diff --git a/api/api.js b/api/api.js index 6c976d1..58e5981 100644 --- a/api/api.js +++ b/api/api.js @@ -6,7 +6,7 @@ * 鐧诲綍 */ login(params) { - return http.post('/sys/mLogin',params) + return http.post('/sys/login',params) }, /** * 鎵嬫満鍙风爜鐧诲綍 diff --git a/common/router/index.js b/common/router/index.js index 4508f1b..25e74d8 100644 --- a/common/router/index.js +++ b/common/router/index.js @@ -1,49 +1,58 @@ 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' +import { + isOAuth2AppEnv +} from '@/common/util/util.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', '/pages/login/loginOauth2'] //鍏ㄥ眬璺敱鍓嶇疆瀹堝崼 router.beforeEach((to, from, next) => { - if(to.path == '/oauth2-app/login'){ + if (to.path == '/oauth2-app/login') { let temp = location.href; - location.href = temp.replace('/oauth2-app/login','/pages/login/loginOauth2') + 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() - } + 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() - }else{ + } 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{ + // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝濡傛灉杩涘叆鐨勯〉闈㈡槸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({ + path: path + }) } - } + } }) // 鍏ㄥ眬璺敱鍚庣疆瀹堝崼 router.afterEach((to, from) => { diff --git a/common/router/modules/routes.js b/common/router/modules/routes.js index c3778be..e3666dd 100644 --- a/common/router/modules/routes.js +++ b/common/router/modules/routes.js @@ -39,6 +39,8 @@ title: '璁惧', }, }, + + { //娉ㄦ剰锛歱ath蹇呴』璺焢ages.json涓殑鍦板潃瀵瑰簲锛屾渶鍓嶉潰鍒繕浜嗗姞'/'鍝� path: '/pages/spare/spare', @@ -132,13 +134,37 @@ }, }, { + path: '/pages/device/deviceDeils/deviceDeils', + name: 'deviceDeils', + meta: { + title: '璁惧璇︽儏', + }, + }, + { + path: '/pages/device/deviceWebDeils/deviceWebDeils', + name: 'deviceWebDeils', + meta: { + title: '璁惧璇︽儏', + }, + }, + + + { path: '/pages/TaskManager/TaskManagerList', name: 'TaskManagerList', meta: { - title: '浠诲姟绠$悊', + title: '宸插姙', }, }, { + path: '/pages/ToDoList/ToDoList', + name: 'ToDoList', + meta: { + title: '寰呭姙', + }, + }, + + { path: '/pages/annotation/annotationDetail', name: 'annotationDetail', meta: { diff --git a/common/service/config.service.js b/common/service/config.service.js index b190b3b..7a24a16 100644 --- a/common/service/config.service.js +++ b/common/service/config.service.js @@ -1,11 +1,11 @@ -let BASE_URL = 'https://192.168.1.118:9988/jeecg-boot' +let BASE_URL = '/jeecg-boot' if (process.env.NODE_ENV == 'development') { - BASE_URL = 'https://192.168.1.118:9988/jeecg-boot' // 寮�鍙戠幆澧� + BASE_URL = '/jeecg-boot' // 寮�鍙戠幆澧� } else { - BASE_URL = 'https://192.168.1.118:9988/jeecg-boot' // 鐢熶骇鐜 + BASE_URL = '/jeecg-boot' // 鐢熶骇鐜 } let staticDomainURL = BASE_URL+ '/sys/common/static'; diff --git a/common/util/work.js b/common/util/work.js index 2e81bfc..1489ed1 100644 --- a/common/util/work.js +++ b/common/util/work.js @@ -7,12 +7,26 @@ export const us = { data:[ { - title:"浠诲姟绠$悊", + title:"寰呭姙", icon:icon_prefix+"wait_work.png", - description:"寰呭姙宸插姙浜嬮」", + description:"寰呭姙浜嬮」", useCount:1000, + page:'ToDoList' + }, + { + title:"宸插姙", + icon:icon_prefix+"wait_work.png", + description:"宸插姙浜嬮」", + useCount:1000, page:'TaskManagerList' - } + }, + { + title:"鎵竴鎵�", + icon:icon_prefix+"icon_sacan.png", + description:"鎵爜", + useCount:10000, + page:'spare' + } // ,{ // title:"宸插姙", // icon:icon_prefix+"yiban.png", @@ -86,24 +100,25 @@ useCount:10000, page:'helloWorld' },{ - title:"鍛ㄦ", + title:"鍛ㄤ繚", icon:icon_prefix+"toupiao.png", - description:"璁惧鍛ㄦ", - useCount:10000, - page:'helloWorld' - },{ - title:"浜屼繚", - icon:icon_prefix+"renwu.png", - description:"璁惧浜屼繚", - useCount:10000, - page:'helloWorld' - },{ - title:"涓変繚", - icon:icon_prefix+"wendang.png", - description:"璁惧涓変繚", + description:"璁惧鍛ㄤ繚", useCount:10000, page:'helloWorld' } + // ,{ + // title:"浜屼繚", + // icon:icon_prefix+"renwu.png", + // description:"璁惧浜屼繚", + // useCount:10000, + // page:'helloWorld' + // },{ + // title:"涓変繚", + // icon:icon_prefix+"wendang.png", + // description:"璁惧涓変繚", + // useCount:10000, + // page:'helloWorld' + // } // ,{ // title:"鍚堝悓", // icon:icon_prefix+"hetong.png", @@ -134,9 +149,9 @@ export const ws = { data:[ { - title:"淇濆吇", + title:"鎶ヤ慨", icon:icon_prefix+"xinwen.png", - description:"璁惧淇濆吇", + description:"璁惧鎶ヤ慨", useCount:10000, page:'helloWorld' },{ diff --git a/main.js b/main.js index b5c800b..597d0c9 100644 --- a/main.js +++ b/main.js @@ -31,8 +31,6 @@ import home from './pages/home/home.vue' Vue.component('home',home) -import spare from './pages/spare/spare.vue' -Vue.component('spare',spare) import device from './pages/device/device.vue' Vue.component('device',device) diff --git a/manifest.json b/manifest.json index 141ecc9..3f8c2a5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,10 +6,11 @@ "versionCode" : 1, "transformPx" : false, "app-plus" : { - /* 5+App鐗规湁鐩稿叧 */// "ssl": { - // "cert": "./cert.crt", - // "key": "./cert.key" - // }, + /* 5+App鐗规湁鐩稿叧 */// + // "ssl": { + // "cert": "./cert.crt", + // "key": "./cert.key" + // }, "modules" : { "Maps" : {}, "Push" : {} @@ -77,18 +78,24 @@ } } }, - "h5" : { "title" : "璁惧绠$悊", "domain" : "myhjdc.cn", "router" : { - "mode" : "history", - "base" : "" + "mode" : "hash", + "base" : "/h5" }, "devServer" : { - "port" : "", - "https" : false - }, + "port" : "3000", + "https" : true, + "proxy": { + /**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/ + "/jeecg-boot": { + "target": "https://192.168.1.94:9999",// 鐩爣鏈嶅姟鍣� + "changeOrigin": true + } + } + }, "optimization" : { "treeShaking" : { "enable" : false @@ -96,3 +103,5 @@ } } } +/**閰嶇疆鏈嶅姟鍣ㄨ矾寰�**/// 鐩爣鏈嶅姟鍣� + diff --git a/pages.json b/pages.json index f0e4689..5e6b0f2 100644 --- a/pages.json +++ b/pages.json @@ -179,6 +179,27 @@ "bounce": "none" //鍒犻櫎姝ら」: mescroll-body鏀寔iOS鍥炲脊 } } + }, + { + "path" : "pages/device/deviceDeils/deviceDeils", + "style" : + { + "navigationBarTitleText" : "" + } + }, + { + "path" : "pages/device/deviceWebDeils/deviceWebDeils", + "style" : + { + "navigationBarTitleText" : "璁惧璇︽儏" + } + }, + { + "path" : "pages/ToDoList/ToDoList", + "style" : + { + "navigationBarTitleText" : "" + } } diff --git a/pages/TaskManager/TaskManagerList.vue b/pages/TaskManager/TaskManagerList.vue index 33d6b69..db36e09 100644 --- a/pages/TaskManager/TaskManagerList.vue +++ b/pages/TaskManager/TaskManagerList.vue @@ -2,7 +2,7 @@ <view class="container"> <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> <block slot="backText">杩斿洖</block> - <block slot="content">浠诲姟绠$悊</block> + <block slot="content">宸插姙</block> </cu-custom> <view style="width: 100%;"> @@ -35,101 +35,51 @@ </view> <view class="container"> - - <uni-badge absolute="rightTop" :offset="[-30, 15]" :text="msg1Count" type="error" /> - - <uni-badge absolute="rightTop" :offset="[-270, 15]" :text="msg2Count" type="error" /> - - <view class="solid-bottom"> - <scroll-view scroll-x class="nav text-center "> - <view class="flex text-center justify-around"> - <view class="cu-item" :class="item.value==TabCur?'text-blue cur':''" - v-for="(item,index) in tabs" :key="index" @tap="tabSelect" :data-id="item.value"> - {{item.title}} - </view> - </view> - </scroll-view> - - </view> - - + <mescroll-uni ref="mescrollRef" @init="mescrollInit" :top="top" @down="downCallback" @up="upCallback"> <!-- 鍒楄〃淇℃伅寮�濮� --> <view class="content"> <uni-card margin="10px" spacing="1px" v-for="(item,index) in msgList" :key="index" @click="onClickProductionTask(item)"> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浠诲姟鍚嶇О:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">娴佺▼鍚嶇О:</view> <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> {{item.partName}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浠诲姟绫诲瀷:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">娴佺▼鎻忚堪:</view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.taskType}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浼樺厛绾�:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">娴佺▼鍙戣捣浜�:</view> <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> {{item.priority}} </view> </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璐d换浜�:</view> - <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> - {{item.ssignee}} - </view> - </view> + <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浠诲姟鎻忚堪:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浠诲姟鍚嶇О:</view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> {{item.taskDesc}} </view> </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">瀹屾垚鏃堕棿:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> - {{item.dueaDate}} - </view> - </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐘舵��:</view> - <view - class="flex-sub bg-white padding-xs margin-xs text-bold text-green radius text-right" - v-if="item.status == '1'"> - 寰呭鐞� - </view> - <view - class="flex-sub bg-white padding-xs margin-xs text-bold text-green radius text-right" - v-if="item.status == '3'"> - 宸插畬鎴� - </view> - </view> </uni-card> </view> - </mescroll-uni> </view> </view> </template> <script> - const tabs = [{ - title: '寰呭姙', - value: 0 - }, { - title: '宸插姙', - value: 1 - }]; import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; export default { mixins: [MescrollMixin], // 浣跨敤mixin data() { return { - TabCur: 0, type: 'top', scrollLeft:0, formData: { @@ -137,13 +87,11 @@ partNumNameModel: '' }, NavBarColor: this.NavBarColor, - tabs, - current: 0, colorIndex: 0, activeColor: '#5277A6', url: { - stallList: "/mom/partTakeRollingDetail/list" + stallList: "/assign/flow/finishedList" }, upOption: { @@ -212,35 +160,7 @@ // }) // }, - tabSelect(e) { - this.TabCur = e.currentTarget.dataset.id; - this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60; - this.msgList = [] // 鍏堢疆绌哄垪琛�,鏄剧ず鍔犺浇杩涘害 - this.mescroll.resetUpScroll() // 鍐嶅埛鏂板垪琛ㄦ暟鎹� - }, - - - - ListTouchStart(e) { - this.listTouchStart = e.touches[0].pageX - }, - - // ListTouch璁$畻鏂瑰悜 - ListTouchMove(e) { - this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > 0 ? 'right' : 'left' - }, - - // ListTouch璁$畻婊氬姩 - ListTouchEnd(e) { - if (this.listTouchDirection == 'left') { - this.modalName = e.currentTarget.dataset.target - } else { - this.modalName = null - } - this.listTouchDirection = null - }, - - + search() { this.$refs.popup.open(); }, diff --git a/pages/common/helloWorld.vue b/pages/common/helloWorld.vue index 49e8136..fb5d979 100644 --- a/pages/common/helloWorld.vue +++ b/pages/common/helloWorld.vue @@ -1,72 +1,262 @@ <template> - <view> - <scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''"> - <cu-custom bgColor="bg-black" :isBack="true"> - <block slot="content">helloWorld</block> - </cu-custom> - - <view class="padding flex flex-direction"> - <app-select label=" 绫� 鍨嬶細" v-model="type" placeholder="璇烽�夋嫨绫诲瀷" :dict="plan_type" space ></app-select> - </view> - - <view class="padding flex flex-direction"> - <my-date label="寮�濮嬫椂闂达細" v-model="beginTime" placeholder="璇烽�夋嫨寮�濮嬫椂闂�" required fields="minute"></my-date> - </view> - - - <view class="padding flex flex-direction"> - <uni-calendar :showMonth="true" :selected="selected" /> - </view> - - - <view class="padding flex flex-direction"> - <my-image-upload /> - </view> - - </scroll-view> - </view> + <view class="container"> + <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask"> + <block slot="backText">杩斿洖</block> + <!-- <cu-custom :bgColor="NavBarColor" backRouterName="index"> + <block slot="right"> + <view @tap="$debounce(BackPage)"> + <view class="cuIcon-back back">杩斿洖</view> + </view> + </block> --> + <block slot="content">璁惧璇︽儏</block> + </cu-custom> + <view class="container"> + + <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext"> + <uni-group top="1"> + + <uni-forms-item name="num" label="璁惧鍥剧墖:"> + <image style="height: 100px; width: 300px;" + :src="formData.equipmentImagel?formData.equipmentImage:'/static/zhanwei.png'"></image> + </uni-forms-item> + <uni-forms-item required name="num" label="璁惧缂栧彿:"> + <uni-easyinput v-model="formData.equipmentCode" :disabled="true" /> + </uni-forms-item> + + <uni-forms-item name="remark" label="璁惧鍚嶇О:"> + <uni-easyinput v-model="formData.equipmentName" :disabled="true" /> + </uni-forms-item> + <uni-forms-item name="remark" label="璁惧鍨嬪彿:"> + <uni-easyinput v-model="formData.equipmentModel" :disabled="true" /> + </uni-forms-item> + <uni-forms-item name="outNum" label="璁惧瑙勬牸:"> + <uni-easyinput v-model="formData.equipmentSpecification" :disabled="true" /> + </uni-forms-item> + <view class="text-gray margin-bottom-lg">鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�� 鍩烘湰淇℃伅 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺��</view> + <uni-forms-item name="taskCode" label="璁惧鍒嗙被:"> + <uni-easyinput :disabled="true" v-model="formData.equipmentCategory" /> + </uni-forms-item> + <uni-forms-item name="endLocation" label="鍑哄巶鏃ユ湡:"> + <uni-easyinput :disabled="true" v-model="formData.leaveFactoryDate" /> + + </uni-forms-item> + <uni-forms-item name="endLocation" label="楠屾敹鏃ユ湡:"> + <uni-easyinput :disabled="true" v-model="formData.acceptanceCheckDate" /> + + </uni-forms-item> + + <uni-forms-item name="endLocation" label="瀹夎浣嶇疆:"> + <uni-easyinput :disabled="true" v-model="formData.installationPosition" /> + </uni-forms-item> + <uni-forms-item name="endLocation" label="璧勪骇鐘舵��:"> + <uni-easyinput :disabled="true" v-model="formData.assetStatus" /> + </uni-forms-item> + <uni-forms-item name="endLocation" label="璁惧绠$悊鍛�:"> + <uni-easyinput :disabled="true" v-model="formData.equipmentManager" /> + </uni-forms-item> + + </uni-group> + </uni-forms> + </view> + </view> </template> <script> - const plan_type = [{text:'鏃ュ父璁板綍',value:'1'},{text:'鏈懆宸ヤ綔',value:'2'},{text:'涓嬪懆璁″垝',value:'3'}]; - import appSelect from '@/components/my-componets/appSelect.vue' - import myImageUpload from '@/components/my-componets/my-image-upload.vue' - import myDate from '@/components/my-componets/my-date.vue' - - + import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; export default { - name: 'helloWorld', - props:{ - cur:String, - }, - watch: { - cur: { - immediate: true, - handler:function(val,oldVal){ - console.log('cur',val,oldVal) - - }, - }, - }, - components:{ - appSelect,myImageUpload,myDate - }, + mixins: [MescrollMixin], // 浣跨敤mixin data() { return { - modalName: null, - item:{msg:'閫�鍑烘垚鍔�'}, - plan_type, - type:"1", - selected:[], - beginTime:'' + + formData: {}, + NavBarColor: this.NavBarColor, + url: { + stallList: "/eam/equipment/queryById" + }, + id: '', + upOption: { + page: { + num: 0, // 褰撳墠椤电爜,榛樿0,鍥炶皟涔嬪墠浼氬姞1,鍗砪allback(page)浼氫粠1寮�濮� + size: 10 // 姣忛〉鏁版嵁鐨勬暟閲� + }, + noMoreSize: 4, //濡傛灉鍒楄〃宸叉棤鏁版嵁,鍙缃垪琛ㄧ殑鎬绘暟閲忚澶т簬鍗婇〉鎵嶆樉绀烘棤鏇村鏁版嵁;閬垮厤鍒楄〃鏁版嵁杩囧皯(姣斿鍙湁涓�鏉℃暟鎹�),鏄剧ず鏃犳洿澶氭暟鎹細涓嶅ソ鐪�; 榛樿5 + empty: { + tip: '~ 鏆傛棤鏁版嵁 ~', // 鎻愮ず + }, + loading: '', + text: '鍏ㄩ儴', + isShowNoMore: false, + textNoMore: '鎴戞槸鏈夊簳绾跨殑 >_<' + }, + styles: { + color: '#2979FF', + borderColor: '#2979FF' + }, + msg1Count: 0, + msg2Count: 0, + msg1Title: "" } }, + computed: { + top() { + return this.CustomBar * 2 + 160 + }, + style() { + var StatusBar = this.StatusBar; + var CustomBar = this.CustomBar; + var CustomBar = this.CustomBar; + var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`; + return style + }, + }, + + onLoad(options) { + console.log(options) + // 鍏堝皾璇曠敤姝e父鏂瑰紡鑾峰彇 + let equipmentId = options.equipmentId; + if (!equipmentId) { + // 鎵嬪姩瑙f瀽URL鍙傛暟 + const url = window.location.href; + console.log(url); + const index = url.indexOf('?'); + if (index > -1) { + const query = url.substring(index + 1); + const pairs = query.split('&'); + pairs.forEach(pair => { + const [key, value] = pair.split('='); + if (key === 'equipmentId') { + equipmentId = decodeURIComponent(value); + } + }); + } + } + }, + // if (equipmentId) { + // this.upCallback(); + // } else { + // console.log('鏃犳硶鑾峰彇璁惧ID'); + // } + // }, + // onLoad(options) { + + + // this.id = options.equipmentId || ''; + // if (!this.id) { + // uni.showModal({ + // title: '鎻愮ず', + // content: "閿欒涓嶅瓨鍦�", + // showCancel: false + // }); + // } else { + // this.upCallback(); + // } + // }, + created() { + // this.upCallback(); + }, methods: { - - } + BackPage() { + // 閲嶅啓杩斿洖鎸夐挳閫昏緫锛岃繑鍥炲埌棣栭〉 + uni.switchTab({ + url: '/pages/index/index' // 杩欓噷鏄椤电殑璺緞锛屾牴鎹疄闄呮儏鍐典慨鏀� + }); + + + }, + upCallback() { + console.log("id", this.id) + this.$http.get(this.url.stallList, { + params: { + pageNo: 999, + pageSize: 1, + order: 'asc', + column: 'createTime', + id: this.id + }, + + }).then(res => { + this.announcement1 = res.data.result + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data.result.equipmentCode) + this.formData = this.announcement1 + } + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + }) + }, + + + + /* 妫�绱� */ + getSera(res) { + this.msgList = []; + if (keyword == 0) { + this.$http.get(this.url.stallList, { + params: { + pageNo: 1, + pageSize: 999, + order: "desc", + column: "createTime", + equipmentCode: res + } + }).then(res => { + //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; + + this.announcement1 = res.data.result.records + this.mescroll.endSuccess(this.announcement1.length); + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data) + this.msg1Count = res.data.result.total + this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; + for (let annItem of this.announcement1) { + this.msgList.push(annItem) + } + } + if (page.num == 1) { + this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 + this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� + } + + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + this.mescroll.endErr(); + }) + } + }, + + mescrollInit(mescroll) { + console.log('mescrollInit') + this.mescroll = mescroll; + }, + }, + } </script> <style> -</style> + .is-hover { + color: rgba(255, 255, 255, 0.6); + background-color: #55aaff; + border-color: #55aaff; + } + + + + .content { + margin-top: 5px; + } + + .content scroll-view { + scrollIndicator: "none" + } + + .popupView { + margin-top: 85px; + height: auto; + } +</style> \ No newline at end of file diff --git a/pages/device/device.vue b/pages/device/device.vue index 0aebad7..e76021f 100644 --- a/pages/device/device.vue +++ b/pages/device/device.vue @@ -15,61 +15,49 @@ <uni-card margin="10px" spacing="1px" v-for="(item,index) in msgList" :key="index" @click="onClickProductionTask(item)"> <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧缂栧彿:</view> + <view + class="flex-sub bg-white padding-xs margin-xs text-bold text-blue radius text-right"> + {{item.equipmentCode}} + </view> + </view> + <view class="flex"> <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧鍚嶇О:</view> - <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> - {{item.partName}} - </view> - </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧绫诲瀷:</view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> - {{item.partType}} + {{item.equipmentName}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浣嶇疆::</view> - <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> - {{item.location}} + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">缁翠慨鐘舵��::</view> + <view class="flex-sub bg-white padding-xs margin-xs text-orange radius text-right"> + {{item.assetStatus_dictText}} </view> </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鍒堕�犲晢::</view> - <view class="flex-sub bg-white padding-xs margin-xs text-blue radius text-right"> - {{item.manufacturer}} + <!-- <view class="flex"> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">淇濆吇鐘舵��::</view> + <view class="flex-sub bg-white padding-xs margin-xs text-orange radius text-right"> + {{item.maintenanceStatus_dictText}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鍨嬪彿:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">浣跨敤杞﹂棿:</view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> - {{item.model}} + {{item.orgId_dictText}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璐熻矗浜�:</view> + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧绠$悊鍛�:</view> <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> - {{item.assignee}} + {{item.equipmentManager_dictText}} </view> </view> <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">澶囨敞:</view> - <view class="flex-sub bg-white padding-xs margin-xs radius text-right"> - {{item.remark}} + <view class="flex-sub text-light bg-white padding-xs margin-xs radius">璁惧鍒嗙被:</view> + <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right"> + {{item.equipmentCategory_dictText}} </view> - </view> - <view class="flex"> - <view class="flex-sub text-light bg-white padding-xs margin-xs radius">鐘舵��:</view> - <view - class="flex-sub bg-white padding-xs margin-xs text-bold text-green radius text-right" - v-if="item.status == '1'"> - 寰呭鐞� - </view> - <view - class="flex-sub bg-white padding-xs margin-xs text-bold text-green radius text-right" - v-if="item.status == '3'"> - 宸插畬鎴� - </view> - </view> + </view> --> </uni-card> </view> @@ -93,7 +81,7 @@ NavBarColor: this.NavBarColor, url: { - stallList: "/mom/partTakeRollingDetail/list" + stallList: "/eam/equipment/list" }, upOption: { @@ -114,16 +102,7 @@ color: '#2979FF', borderColor: '#2979FF' }, - msgList: [{ - partName: "璁惧A", - partType: "鏈嶅姟鍣�", - location: "鏈烘埧", - manufacturer: "鐏电", - model: "ModelX", - assignee: "寮犱笁", - remark: "婕旂ず", - status: 1 - }], //鍒楄〃鏁版嵁 + msgList: [], //鍒楄〃鏁版嵁 announcement1: [], msg1Count: 0, msg2Count: 0, @@ -163,101 +142,51 @@ * @param {Object} item * 璇︽儏椤甸潰 */ - // onClickProductionTask(item) { - // let keyword = this.TabCur - // uni.navigateTo({ - // url: '/pages/mes/om/workSheetOpToolingBorrowDeils/workSheetOpToolingBorrowDeils?keyword=' + keyword - // }) + + onClickProductionTask(item) { + uni.navigateTo({ + url: '/pages/device/deviceDeils/deviceDeils?item=' + encodeURIComponent(JSON.stringify(item)) + }) + }, + upCallback(page) { + this.$http.get(this.url.stallList, { + params: { + pageNo: page.num, + pageSize: page.size, + order: 'asc', + column: 'createTime', - // }, + }, + }).then(res => { + this.announcement1 = res.data.result.records + this.mescroll.endSuccess(this.announcement1.length); + console.log("url", res) + //璁剧疆鍒楄〃鏁版嵁 + if (res.data.success) { + console.log("res", res.data) + this.msg1Count = res.data.result.total + this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; + for (let annItem of this.announcement1) { + this.msgList.push(annItem) + } + } + if (page.num == 1) { + this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 + this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� + } - - - - - // upCallback(page) { - // let keyword = this.TabCur - // if (keyword == 0) { - - // this.$http.get(this.url.stallList, { - // params: { - // pageNo: page.num, - // pageSize: page.size, - // order: 'asc', - // column: 'createTime', - // status: 1 - // }, - - // }).then(res => { - // this.announcement1 = res.data.result.records - // this.mescroll.endSuccess(this.announcement1.length); - // console.log("url", res) - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // console.log("res", res.data) - // this.msg1Count = res.data.result.total - // this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - // for (let annItem of this.announcement1) { - // this.msgList.push(annItem) - // } - // } - // if (page.num == 1) { - // this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - // this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - // } - - // }).catch(() => { - // //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - // this.mescroll.endErr(); - // }) - // } else if (keyword == 1) { - - // this.$http.get(this.url.stallList, { - // params: { - // pageNo: page.num, - // pageSize: page.size, - // order: 'desc', - // status: 3, - // column: 'createTime' - // }, - - // }).then(res => { - // this.announcement1 = res.data.result.records - // this.mescroll.endSuccess(this.announcement1.length); - // console.log("url", res) - // //璁剧疆鍒楄〃鏁版嵁 - // if (res.data.success) { - // console.log("res", res.data) - // this.msg2Count = res.data.result.total - // this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - // for (let annItem of this.announcement1) { - // this.msgList.push(annItem) - // } - // } - // if (page.num == 1) { - // this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - // this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - // } - - // }).catch(() => { - // //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - // this.mescroll.endErr(); - // }) - - // } - - - // }, + }).catch(() => { + //鑱旂綉澶辫触, 缁撴潫鍔犺浇 + this.mescroll.endErr(); + }) + }, /* 妫�绱� */ getSera(res) { - this.$refs.popup.close(); - let keyword = this.TabCur this.msgList = []; - if (keyword == 0) { this.$http.get(this.url.stallList, { params: { @@ -265,9 +194,7 @@ pageSize: 999, order: "desc", column: "createTime", - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*', - status: 'published' + equipmentCode: res } }).then(res => { //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; @@ -293,89 +220,8 @@ //鑱旂綉澶辫触, 缁撴潫鍔犺浇 this.mescroll.endErr(); }) - - } else if (keyword == 1) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'training', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg1Count = res.data.result.total - this.msg2Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - - } else if (keyword == 2) { - this.$http.get(this.url.stallList, { - params: { - pageNo: 1, - pageSize: 999, - order: "desc", - column: "createTime", - status: 'completed', - num: '*' + this.formData.num + '*', - partNumNameModel: '*' + this.formData.partNumNameModel + '*' - - } - }).then(res => { - //鑱旂綉鎴愬姛鐨勫洖璋�,闅愯棌涓嬫媺鍒锋柊鍜屼笂鎷夊姞杞界殑鐘舵��; - - this.announcement1 = res.data.result.records - this.mescroll.endSuccess(this.announcement1.length); - console.log("url", res) - //璁剧疆鍒楄〃鏁版嵁 - if (res.data.success) { - console.log("res", res.data) - this.msg3Count = res.data.result.total - this.msg1Title = "閫氱煡(" + res.data.result.total + ")"; - for (let annItem of this.announcement1) { - this.msgList.push(annItem) - } - } - if (page.num == 1) { - this.msgList = []; //濡傛灉鏄涓�椤甸渶鎵嬪姩鍒剁┖鍒楄〃 - this.msgList = this.msgList.concat(this.announcement1); //杩藉姞鏂版暟鎹� - } - - }).catch(() => { - //鑱旂綉澶辫触, 缁撴潫鍔犺浇 - this.mescroll.endErr(); - }) - } - - - - - }, - mescrollInit(mescroll) { console.log('mescrollInit') diff --git a/pages/index/index.vue b/pages/index/index.vue index a3003a7..0ac998d 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -3,7 +3,7 @@ <home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home> <people v-if="PageCur=='people'" :key="commponent2Key"></people> <device v-if="PageCur=='device'" :key="commponent3Key"></device> - <spare v-if="PageCur=='spare'" :key="commponent4Key"></spare> + <!-- <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>棣栭〉 @@ -11,9 +11,9 @@ <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="PageCur=='spare'?'action text-green':'action text-gray'" @click="NavChange" data-cur="spare"> <view class='cuIcon-scan'></view>鎵竴鎵� - </view> + </view> --> <view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" data-cur="people"> <view class='cuIcon-people'></view>鎴戠殑 @@ -30,8 +30,8 @@ PageCur: 'home', commponent1Key: 0, commponent2Key: 0, - commponent3Key: 0, - commponent4Key: 0 + commponent3Key: 0 + } }, @@ -40,7 +40,6 @@ ++this.commponent1Key ++this.commponent2Key ++this.commponent3Key - ++this.commponent4Key }, methods: { NavChange: function(e) { diff --git a/pages/login/login.vue b/pages/login/login.vue index 0a44541..4679f37 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,306 +1,343 @@ <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':'']" + <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> - - - <!-- #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> + </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> -<script> - import { ACCESS_TOKEN,USER_NAME,USER_INFO } from "@/common/util/constants" - import { mapActions } from "vuex" - import configService from '@/common/service/config.service.js'; - - export default { - data() { - return { - shape:'',//round 鍦嗗舰 - loading: false, - userName: 'admin', - password: '123456', - phoneNo: '', - smsCode: '', - showPassword: false, //鏄惁鏄剧ず鏄庢枃 - loginWay: 1, //1: 璐﹀瘑锛�2锛氶獙璇佺爜 - smsCountDown: 0, - smsCountInterval: null, - toggleDelay: false, - version:'', - //绗笁鏂圭櫥褰曠浉鍏充俊鎭� - thirdType:"", - thirdLoginInfo:"", - thirdLoginState:false, - bindingPhoneModal:false, - thirdUserUuid:'', - url: { - bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone' - } - }; - }, - onLoad:function(){ - // #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'}) - // #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}$/); - - 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> + <!-- #ifdef APP-PLUS --> + <view class="padding flex flex-direction text-center"> + 褰撳墠鐗堟湰:{{version}} + </view> + <!-- #endif --> -<style> - .login-paddingtop { - padding-top: 100upx; - } + </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> - .zai-box { - padding: 0 20upx; - padding-top: 100upx; - position: relative; - } + </template> - .zai-logo { - width: 200upx; - height: 150px; - } + <script> + import { + ACCESS_TOKEN, + USER_NAME, + USER_INFO + } from "@/common/util/constants" + import { + mapActions + } from "vuex" + import configService from '@/common/service/config.service.js'; - .zai-title { - font-size: 58upx; - color: #000000; - text-align: center; - } + export default { + data() { + return { + shape: '', //round 鍦嗗舰 + loading: false, + userName: 'admin', + password: '123456', + 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}` + // }); - .input-placeholder, .zai-input { - color: #94afce; - } + // } else { + // this.$tip.success('鐧诲綍鎴愬姛!') + // this.$Router.replaceAll({ + // name: 'index' + // }) + // } - .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; - } + // #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}$/); - .zai-btn:after { - border: 0; - } + 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> - /*鎸夐挳鐐瑰嚮鏁堟灉*/ - .zai-btn.button-hover { - transform: translate(1upx, 1upx); - } + <style> + .login-paddingtop { + padding-top: 100upx; + } -</style> + .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); + } + </style> \ No newline at end of file diff --git a/pages/spare/spare.vue b/pages/spare/spare.vue index 22818b5..fb3ea79 100644 --- a/pages/spare/spare.vue +++ b/pages/spare/spare.vue @@ -1,182 +1,145 @@ <template> - <view class="container"> - <button class="scan" @click="openQrcode">鐐瑰嚮鎵爜</button> - <view class="reader-box" v-if="isScaning"> - <view class="reader" id="reader"></view> + <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>鎵爜鍐呭锛歿{scanVal}}</view> </view> </template> + <script> - import { - Html5Qrcode - } from "html5-qrcode"; + import mumuGetQrcode from '@/uni_modules/mumu-getQrcode/components/mumu-getQrcode/mumu-getQrcode.vue'; + export default { - name: 'spare', - watch: { - cur: { - immediate: true, - handler() { - console.log('watch', this.cur) - }, - }, + components: { + mumuGetQrcode // 娉ㄥ唽 }, + name: 'spare', data() { return { - html5QrCode: null, - isScaning: false, - cameraId: null, - scanVal: '' - } + NavBarColor: this.NavBarColor, + hasNavigated: false // 鏍囪鏄惁宸茬粡璺宠浆 + }; }, - methods: { + // mounted() { + // window.addEventListener('hashchange', this.handleHashChange); + // // 鍒濆瑙f瀽 hash + // this.handleHashChange(); + // }, + // beforeDestroy() { + // window.removeEventListener('hashchange', this.handleHashChange); + // }, - isValidURL(url) { - const pattern = new RegExp('^(https?:\\/\\/)?' + // protocol - '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name - '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address - '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path - '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string - '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator - return !!pattern.test(url); - }, - checkURL() { - const url = this.scanVal; - if (this.isValidURL(url)) { - uni.openURL({ - url: url - }) - } else { - uni.showToast({ - title: 'url鍦板潃閿欒锛岃閲嶈瘯', - icon: 'none', - duration: 2000 - }); - } - }, - - openQrcode() { - this.isScaning = true; - Html5Qrcode.getCameras().then((devices) => { - if (devices && devices.length) { - if (devices.length > 1) { - this.cameraId = devices[1].id; - } else { - this.cameraId = devices[0].id; - } - this.html5QrCode = new Html5Qrcode('reader'); - this.startInit(); - } - }); - }, - startInit() { - const that = this; - this.html5QrCode.start( - this.cameraId, // retreived in the previous step. - // { - // facingMode: "environment" // environment鍚庣疆鎽勫儚澶� user鍓嶇疆鎽勫儚澶� - // }, - { - fps: 10, // sets the framerate to 10 frame per second - qrbox: 250 // sets only 250 X 250 region of viewfinder to + methods: { + // handleHashChange() { + // if (this.hasNavigated) { + // console.log('Already navigated, skipping hash change handling'); + // return; + // } + + // const hash = window.location.hash; + // console.log('Hash changed:', hash); // 娣诲姞鏃ュ織 + // if (!hash || hash.length === 0) { + // console.warn('Hash is empty or undefined'); + // return; + // } + // const params = new URLSearchParams(hash.split('?')[1]); + // const equipmentId = params.get('equipmentId'); + // console.log('Parsed equipmentId:', equipmentId); // 娣诲姞鏃ュ織 + // if (equipmentId) { + // this.navigateToDeviceDetails(equipmentId); + // } else { + // console.warn('No equipmentId found in hash'); + // } + // }, + navigateToDeviceDetails(equipmentId) { + this.hasNavigated = true; // 鏍囪宸茬粡璺宠浆 + uni.navigateTo({ + url: `/pages/device/deviceWebDeils/deviceWebDeils?equipmentId=${encodeURIComponent(equipmentId)}`, + success: () => { + console.log('Navigated to device details'); }, - qrCodeMessage => { + 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; + } + } + } + } + } + + if (equipmentId) { + // 鐧诲綍鎴愬姛涓旇幏鍙栧埌equipmentId锛岃烦杞埌璁惧璇︽儏椤甸潰 + this.navigateToDeviceDetails(equipmentId); + } else { + uni.showModal({ + title: '鎻愮ず', + content: "浜岀淮鐮佷腑鏈壘鍒版湁鏁堢殑equipmentId", + showCancel: false + }); + } + } catch (error) { uni.showModal({ - title: 'success', - content: JSON.stringify(qrCodeMessage), + title: '閿欒', + content: "瑙f瀽URL鍑洪敊锛岃妫�鏌ヤ簩缁寸爜鍐呭", showCancel: false }); - // do something when code is read. For example: - if (qrCodeMessage) { - //鎴愬姛鎵嚭鐮乹rCodeMessage涓烘壂鐮佸唴瀹� - //鎵爜鎴愬姛璁板緱鍏虫帀鎽勫儚 - that.action(qrCodeMessage) //瀵逛簩缁寸爜閫昏緫澶勭悊 - that.stopScan(); //鍏抽棴鎵爜鍔熻兘 - } - - }, - errorMessage => { - console.log('errorMessage', errorMessage); - if (errorMessage.includes('NotFoundException')) { - uni.showToast({ - title: '鏈壘鍒颁簩缁寸爜锛岃閲嶆柊瀵瑰噯', - icon: 'none', - duration: 2000 - }); - } else { - uni.showToast({ - title: '鎵爜澶辫触锛岃閲嶈瘯', - icon: 'none', - duration: 2000 - }); - } - } - ) - .catch((err) => { - // 鎵爜閿欒淇℃伅 - let message = ""; - if (typeof err == "string") { - message = "璇嗗埆澶辫触"; - } else { - if (err.name == "NotAllowedError") { - message = "鎮ㄩ渶瑕佹巿浜堢浉鏈鸿闂潈闄愶紒"; - } - if (err.name == "NotFoundError") { - message = "杩欎釜璁惧涓婃病鏈夋憚鍍忓ご锛�"; - } - if (err.name == "NotSupportedError") { - message = - "鎽勫儚澶磋闂彧鏀寔鍦ㄥ畨鍏ㄧ殑涓婁笅鏂囦腑锛屽https鎴杔ocalhost锛�"; - } - if (err.name == "NotReadableError") { - message = "鐩告満琚崰鐢紒"; - } - if (err.name == "OverconstrainedError") { - message = "瀹夎鎽勫儚澶翠笉鍚堥�傦紒"; - } - if (err.name == "StreamApiNotSupportedError") { - message = "姝ゆ祻瑙堝櫒涓嶆敮鎸佹祦API锛�"; - } + }, 200); // 澧炲姞100姣鐨勫欢杩� + }, + qrcodeError(err) { // 鎵爜澶辫触 + uni.showModal({ + title: '鎽勫儚澶存巿鏉冨け璐�', + content: '鎽勫儚澶存巿鏉冨け璐ワ紝璇锋娴嬪綋鍓嶆祻瑙堝櫒鏄惁鏈夋憚鍍忓ご鏉冮檺銆�', + success: () => { + uni.navigateBack({}); // 杩斿洖鍒颁笂涓�椤� } - uni.showToast({ - title: message, - icon: 'none', - duration: 2000 - }); }); - }, - action(val) { - this.scanVal = val; - const url = this.scanVal; - this.checkURL(url) - - // plus.runtime.openURL(this.scanVal, function(res) { - // console.log(res); - // }); - }, - stopScan() { - console.log('鍋滄鎵爜') - this.isScaning = false; - if (this.html5QrCode) { - this.html5QrCode.stop() - .then((ignore) => { - console.log("鍋滄鎵爜", ignore); - }) - .catch((err) => { - console.log(err); - showToast("鍋滄鎵爜澶辫触"); - }); } - }, - - } - } + } + }; </script> <style> - .container { + .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 { diff --git a/plugin/uni-simple-router/helpers/urlQuery.js b/plugin/uni-simple-router/helpers/urlQuery.js index a2b1c69..0644f2f 100644 --- a/plugin/uni-simple-router/helpers/urlQuery.js +++ b/plugin/uni-simple-router/helpers/urlQuery.js @@ -1,157 +1,205 @@ -import { Global } from './config'; -import { warn, err } from './warn'; +import { + Global +} from './config'; +import { + warn, + err +} from './warn'; const nodeURL = require('query-string'); class ParseQuery { - get queryName() { - return nodeURL; - } + get queryName() { + return nodeURL; + } - /** - * 鍒ゆ柇褰撳墠杩欎釜瀵硅薄鏄惁涓烘繁搴﹀璞� - * @param {Object} obj - */ - isDepthObject(obj) { - const str = JSON.stringify(obj); - return str.match(/}/g).length > 1; - } + /** + * 鍒ゆ柇褰撳墠杩欎釜瀵硅薄鏄惁涓烘繁搴﹀璞� + * @param {Object} obj + */ + isDepthObject(obj) { + const str = JSON.stringify(obj); + return str.match(/}/g).length > 1; + } - /** - * 浠嶶RL涓彁鍙栨煡璇㈠瓧绗︿覆 - * @param {String} url - */ - extract(url) { - return nodeURL.extract(url); - } + /** + * 浠嶶RL涓彁鍙栨煡璇㈠瓧绗︿覆 + * @param {String} url + */ + extract(url) { + return nodeURL.extract(url); + } - /** - * 鎶婁竴涓� key=value&key1=value 鐨勫瓧绗︿覆杞垚瀵硅薄 - * @param {string} strQuery key=value&key1=value 绫诲瀷鐨勫瓧绗︿覆 - */ - parse(strQuery) { - return nodeURL.parse(strQuery); - } + /** + * 鎶婁竴涓� key=value&key1=value 鐨勫瓧绗︿覆杞垚瀵硅薄 + * @param {string} strQuery key=value&key1=value 绫诲瀷鐨勫瓧绗︿覆 + */ + parse(strQuery) { + return nodeURL.parse(strQuery); + } - /** - * 鎶婁竴涓璞¤浆鎴� key=value&key1=value 绫诲瀷鐨勫瓧绗︿覆 - * @param {Object} ObjQuery 绗﹀悎js鏍囨敞鐨勫璞� - * @param {Boolean} intact 鏄惁鍦ㄨ浆鎴愮殑瀛楃涓插墠娣诲姞锛熷彿 - */ - stringify(ObjQuery, intact = true) { - const strQuery = nodeURL.stringify(ObjQuery); - if (intact) { - return `?${strQuery}`; - } - return strQuery; - } + /** + * 鎶婁竴涓璞¤浆鎴� key=value&key1=value 绫诲瀷鐨勫瓧绗︿覆 + * @param {Object} ObjQuery 绗﹀悎js鏍囨敞鐨勫璞� + * @param {Boolean} intact 鏄惁鍦ㄨ浆鎴愮殑瀛楃涓插墠娣诲姞锛熷彿 + */ + stringify(ObjQuery, intact = true) { + const strQuery = nodeURL.stringify(ObjQuery); + if (intact) { + return `?${strQuery}`; + } + return strQuery; + } - /** - * 鎶婁竴涓璞℃垨鑰� key=value&key1=value 绫诲瀷鐨勬暟鎹姞瀵嗘垚 query=encodeURIComponent(value) - * @param {Object|String} query 绗﹀悎js鏍囨敞鐨勫璞� 鎴栬�� key=value&key1=value 瀛楃涓� - * @param {Boolean} intact 鏄惁鍦ㄨ浆鎴愮殑瀛楃涓插墠娣诲姞锛熷彿 - */ - encode(query, intact = true) { - let [strQuery, formatQuery] = ['', '']; - if (query == null) { - warn('鍔犲瘑鍙傛暟娌℃湁浼犻�掞紝浣犵煡閬擄紵', true); - return ''; - } - if (query.constructor === String) { // 瀛楃涓� 灏濊瘯 杞垚 瀵硅薄 - strQuery = JSON.stringify(this.parse(query)); - } else if (query.constructor === Object) { // 鐩存帴杞垚瀛楃涓插璞″嵆鍙� - if (Object.keys(query).length === 0) { - warn('褰撳墠鍙傛暟涓嶆弧瓒冲姞瀵嗚鑼冿紒'); - return ''; - } - strQuery = JSON.stringify(query); - } - if (intact) { - formatQuery = '?'; - } - formatQuery += `query=${encodeURIComponent(strQuery)}`; - return formatQuery; - } + /** + * 鎶婁竴涓璞℃垨鑰� key=value&key1=value 绫诲瀷鐨勬暟鎹姞瀵嗘垚 query=encodeURIComponent(value) + * @param {Object|String} query 绗﹀悎js鏍囨敞鐨勫璞� 鎴栬�� key=value&key1=value 瀛楃涓� + * @param {Boolean} intact 鏄惁鍦ㄨ浆鎴愮殑瀛楃涓插墠娣诲姞锛熷彿 + */ + encode(query, intact = true) { + let [strQuery, formatQuery] = ['', '']; + if (query == null) { + warn('鍔犲瘑鍙傛暟娌℃湁浼犻�掞紝浣犵煡閬擄紵', true); + return ''; + } + if (query.constructor === String) { // 瀛楃涓� 灏濊瘯 杞垚 瀵硅薄 + strQuery = JSON.stringify(this.parse(query)); + } else if (query.constructor === Object) { // 鐩存帴杞垚瀛楃涓插璞″嵆鍙� + if (Object.keys(query).length === 0) { + warn('褰撳墠鍙傛暟涓嶆弧瓒冲姞瀵嗚鑼冿紒'); + return ''; + } + strQuery = JSON.stringify(query); + } + if (intact) { + formatQuery = '?'; + } + formatQuery += `query=${encodeURIComponent(strQuery)}`; + return formatQuery; + } - /** - * 鎶婁竴涓凡缁忓姞瀵嗗ソ鐨勫瓧绗︿覆 query=encodeURIComponent(value) 瑙e瘑鎴� 瀵硅薄 - * @param {string} strQuery 宸茬粡鍔犲瘑濂界殑瀛楃涓� query=encodeURIComponent(value) - */ - decode(strQuery) { - if (strQuery == null) { - warn('瑙e瘑鍙傛暟娌℃湁浼犻�掞紝浣犵煡閬擄紵', true); - return {}; - } - let jsonQuery = strQuery; - if (strQuery.constructor === Object) { // 濡傛灉鏄璞� 鐪嬭兘涓嶈兘婊¤冻瑕佹眰 - jsonQuery = strQuery.query; - if (jsonQuery == null) { - warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); - return {}; - } - jsonQuery = `query=${jsonQuery}`; - } - let decode = {}; - // query 闀胯繖涓牱 query=encodeURIComponent(value) - const decodeStr = decodeURIComponent(jsonQuery); - const { query } = this.parse(decodeStr); // 杞垚 json 鑾峰彇鍒版鐪熺殑json瀛楃涓� - if (query == null) { - warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); - } else { - try { - decode = JSON.parse(query); - } catch (error) { - warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); - } - } - return decode; - } + /** + * 鎶婁竴涓凡缁忓姞瀵嗗ソ鐨勫瓧绗︿覆 query=encodeURIComponent(value) 瑙e瘑鎴� 瀵硅薄 + * @param {string} strQuery 宸茬粡鍔犲瘑濂界殑瀛楃涓� query=encodeURIComponent(value) + */ + decode(strQuery) { + if (strQuery == null) { + warn('瑙e瘑鍙傛暟娌℃湁浼犻�掞紝浣犵煡閬擄紵', true); + return {}; + } + let jsonQuery = strQuery; + if (strQuery.constructor === Object) { // 濡傛灉鏄璞� 鐪嬭兘涓嶈兘婊¤冻瑕佹眰 + jsonQuery = strQuery.query; + if (jsonQuery == null) { + warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); + return {}; + } + jsonQuery = `query=${jsonQuery}`; + } + let decode = {}; + // query 闀胯繖涓牱 query=encodeURIComponent(value) + const decodeStr = decodeURIComponent(jsonQuery); + const { + query + } = this.parse(decodeStr); // 杞垚 json 鑾峰彇鍒版鐪熺殑json瀛楃涓� + if (query == null) { + warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); + } else { + try { + decode = JSON.parse(query); + } catch (error) { + warn('褰撳墠瑙e瘑鍙傛暟涓嶆弧瓒崇紪鐮佽鍒�'); + } + } + return decode; + } + queryGet(query) { + const { + encodeURI + } = Global.Router.CONFIG; // 鑾峰彇鍒拌矾鐢遍厤缃� + let [decode, historyObj, strQuery] = [query, query, '']; + switch (encodeURI) { + case true: { // 鍔犲瘑妯″紡 + decode = this.decode(query); + strQuery = this.encode(decode); { //-> 浠g爜 杩欐槸淇敼鐨勫唴瀹� 娣诲姞鎴戜滑鑷畾涔夊鐞� + if (strQuery === '' && query) { + //-> junjie + //-| 闇�瑕佹敞鎰� ,鎴戜滑鐨勬槸鑷畾涔夊璞� , 鏄笉鍖呭惈 query 鐨�, + //-| 鎸夌収鎴戜滑鑷繁鐨勮鍒欒В鏋� + let newstrQuery = Object.keys(query).map(key => key.concat("=").concat(query[key])).join( + "&") + if (newstrQuery) { + strQuery = "?" + newstrQuery; + } + } + } + historyObj = { + query: encodeURIComponent(JSON.stringify(decode)), + }; + break; + } + case false: { // 涓嶅姞瀵嗘ā寮� + strQuery = this.stringify(query); + break; + } + default: { + err('鏈煡鍙傛暟妯″紡锛岃妫�鏌� \'encodeURI\'', true); + } + } - queryGet(query) { - const { encodeURI } = Global.Router.CONFIG; // 鑾峰彇鍒拌矾鐢遍厤缃� - let [decode, historyObj, strQuery] = [query, query, '']; - switch (encodeURI) { - case true: { // 鍔犲瘑妯″紡 - decode = this.decode(query); - strQuery = this.encode(decode); - historyObj = { - query: encodeURIComponent(JSON.stringify(decode)), - }; - break; - } - case false: { // 涓嶅姞瀵嗘ā寮� - strQuery = this.stringify(query); - break; - } - default: { - err('鏈煡鍙傛暟妯″紡锛岃妫�鏌� \'encodeURI\'', true); - } - } - return { strQuery, historyObj, decode }; - } + return { + strQuery, + historyObj, + decode + }; + } + // queryGet(query) { + // const { encodeURI } = Global.Router.CONFIG; // 鑾峰彇鍒拌矾鐢遍厤缃� + // let [decode, historyObj, strQuery] = [query, query, '']; + // switch (encodeURI) { + // case true: { // 鍔犲瘑妯″紡 + // decode = this.decode(query); + // strQuery = this.encode(decode); + // historyObj = { + // query: encodeURIComponent(JSON.stringify(decode)), + // }; + // break; + // } + // case false: { // 涓嶅姞瀵嗘ā寮� + // strQuery = this.stringify(query); + // break; + // } + // default: { + // err('鏈煡鍙傛暟妯″紡锛岃妫�鏌� \'encodeURI\'', true); + // } + // } + // return { strQuery, historyObj, decode }; + // } - /** - * 瀵归渶瑕佷紶閫掔殑鍙傛暟杩涜鍔犲瘑瑙e瘑 - * @param {Object|String} query get涓篺alse 蹇呴』涓� Object 绫诲瀷 - * @param {String} get 鏄彇鍊� 杩樻槸閫氳繃api浼犲�� - */ - transfer(query = {}) { - const { encodeURI } = Global.Router.CONFIG; // 鑾峰彇鍒拌矾鐢遍厤缃� - switch (encodeURI) { - case true: { - // 鍔犲瘑妯″紡 - return this.encode(query, false); - } - case false: { - // 涓嶅姞瀵嗘ā寮� - return this.stringify(query); - } - default: { - err('鏈煡鍙傛暟妯″紡锛岃妫�鏌� \'encodeURI\' ', true); - } - } - } + /** + * 瀵归渶瑕佷紶閫掔殑鍙傛暟杩涜鍔犲瘑瑙e瘑 + * @param {Object|String} query get涓篺alse 蹇呴』涓� Object 绫诲瀷 + * @param {String} get 鏄彇鍊� 杩樻槸閫氳繃api浼犲�� + */ + transfer(query = {}) { + const { + encodeURI + } = Global.Router.CONFIG; // 鑾峰彇鍒拌矾鐢遍厤缃� + switch (encodeURI) { + case true: { + // 鍔犲瘑妯″紡 + return this.encode(query, false); + } + case false: { + // 涓嶅姞瀵嗘ā寮� + return this.stringify(query); + } + default: { + err('鏈煡鍙傛暟妯″紡锛岃妫�鏌� \'encodeURI\' ', true); + } + } + } } -export default ParseQuery; +export default ParseQuery; \ No newline at end of file diff --git a/store/index.js b/store/index.js index 2cad7f9..0a8a527 100644 --- a/store/index.js +++ b/store/index.js @@ -37,6 +37,7 @@ const result = response.data.result const userInfo = result.userInfo uni.setStorageSync(ACCESS_TOKEN,result.token); + uni.setStorageSync("isLogin",true); uni.setStorageSync(USER_INFO,userInfo); commit('SET_TOKEN', result.token) commit('SET_AVATAR', userInfo.avatar) -- Gitblit v1.9.3