| | |
| | | * 登录 |
| | | */ |
| | | login(params) { |
| | | return http.post('/sys/mLogin',params) |
| | | return http.post('/sys/login',params) |
| | | }, |
| | | /** |
| | | * 手机号码登录 |
| | |
| | | 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]//路由表 |
| | | }); |
| | |
| | | if (whiteList.indexOf(to.path) !== -1) { |
| | | // 在免登录白名单,如果进入的页面是login页面并且当前是OAuth2app环境,就进入OAuth2登录页面 |
| | | if (to.path === '/pages/login/login' && isOAuth2AppEnv()) { |
| | | next({path: '/pages/login/loginOauth2'}) |
| | | next({ |
| | | path: '/pages/login/loginOauth2' |
| | | }) |
| | | } else { |
| | | // 在免登录白名单,直接进入 |
| | | next() |
| | |
| | | }else{ |
| | | // 如果当前是在OAuth2APP环境,就跳转到OAuth2登录页面 |
| | | let path = isOAuth2AppEnv() ? '/pages/login/loginOauth2' : '/pages/login/login'; |
| | | next({ path: path }) |
| | | next({ |
| | | path: path |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | |
| | | title: '设备', |
| | | }, |
| | | }, |
| | | |
| | | |
| | | { |
| | | //注意:path必须跟pages.json中的地址对应,最前面别忘了加'/'哦 |
| | | path: '/pages/spare/spare', |
| | |
| | | }, |
| | | }, |
| | | { |
| | | 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: { |
| | |
| | | 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'; |
| | | |
| | |
| | | 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:"已办", |
| | |
| | | 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", |
| | |
| | | export const ws = { |
| | | data:[ |
| | | { |
| | | title:"保养", |
| | | title:"报修", |
| | | icon:icon_prefix+"xinwen.png", |
| | | description:"设备保养", |
| | | description:"设备报修", |
| | | useCount:10000, |
| | | page:'helloWorld' |
| | | },{ |
| | |
| | | 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) |
| | |
| | | "versionCode" : 1, |
| | | "transformPx" : false, |
| | | "app-plus" : { |
| | | /* 5+App特有相关 */// "ssl": { |
| | | /* 5+App特有相关 */// |
| | | // "ssl": { |
| | | // "cert": "./cert.crt", |
| | | // "key": "./cert.key" |
| | | // }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | |
| | | "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" : { |
| | |
| | | } |
| | | } |
| | | } |
| | | /**配置服务器路径**/// 目标服务器 |
| | | |
| | |
| | | "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" : "" |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | <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%;"> |
| | |
| | | |
| | | <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">责任人:</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: { |
| | |
| | | partNumNameModel: '' |
| | | }, |
| | | NavBarColor: this.NavBarColor, |
| | | tabs, |
| | | current: 0, |
| | | colorIndex: 0, |
| | | activeColor: '#5277A6', |
| | | url: { |
| | | |
| | | stallList: "/mom/partTakeRollingDetail/list" |
| | | stallList: "/assign/flow/finishedList" |
| | | }, |
| | | |
| | | upOption: { |
| | |
| | | // }) |
| | | |
| | | // }, |
| | | 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(); |
| | |
| | | <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> |
| | | <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"> |
| | | |
| | | <view class="padding flex flex-direction"> |
| | | <app-select label=" 类 型:" v-model="type" placeholder="请选择类型" :dict="plan_type" space ></app-select> |
| | | |
| | | <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 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> |
| | | |
| | | </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,即callback(page)会从1开始 |
| | | size: 10 // 每页数据的数量 |
| | | }, |
| | | noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5 |
| | | empty: { |
| | | tip: '~ 暂无数据 ~', // 提示 |
| | | }, |
| | | loading: '', |
| | | text: '全部', |
| | | isShowNoMore: false, |
| | | textNoMore: '我是有底线的 >_<' |
| | | }, |
| | | styles: { |
| | | color: '#2979FF', |
| | | borderColor: '#2979FF' |
| | | }, |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | | msg1Title: "" |
| | | } |
| | | }, |
| | | methods: { |
| | | 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) |
| | | // 先尝试用正常方式获取 |
| | | let equipmentId = options.equipmentId; |
| | | if (!equipmentId) { |
| | | // 手动解析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> |
| | | .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> |
| | |
| | | <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> |
| | | |
| | |
| | | NavBarColor: this.NavBarColor, |
| | | url: { |
| | | |
| | | stallList: "/mom/partTakeRollingDetail/list" |
| | | stallList: "/eam/equipment/list" |
| | | }, |
| | | |
| | | upOption: { |
| | |
| | | color: '#2979FF', |
| | | borderColor: '#2979FF' |
| | | }, |
| | | msgList: [{ |
| | | partName: "设备A", |
| | | partType: "服务器", |
| | | location: "机房", |
| | | manufacturer: "灵秀", |
| | | model: "ModelX", |
| | | assignee: "张三", |
| | | remark: "演示", |
| | | status: 1 |
| | | }], //列表数据 |
| | | msgList: [], //列表数据 |
| | | announcement1: [], |
| | | msg1Count: 0, |
| | | msg2Count: 0, |
| | |
| | | * @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: { |
| | |
| | | pageSize: 999, |
| | | order: "desc", |
| | | column: "createTime", |
| | | num: '*' + this.formData.num + '*', |
| | | partNumNameModel: '*' + this.formData.partNumNameModel + '*', |
| | | status: 'published' |
| | | equipmentCode: res |
| | | } |
| | | }).then(res => { |
| | | //联网成功的回调,隐藏下拉刷新和上拉加载的状态; |
| | |
| | | //联网失败, 结束加载 |
| | | 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') |
| | |
| | | <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>首页 |
| | |
| | | <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>我的 |
| | |
| | | PageCur: 'home', |
| | | commponent1Key: 0, |
| | | commponent2Key: 0, |
| | | commponent3Key: 0, |
| | | commponent4Key: 0 |
| | | commponent3Key: 0 |
| | | |
| | | |
| | | } |
| | | }, |
| | |
| | | ++this.commponent1Key |
| | | ++this.commponent2Key |
| | | ++this.commponent3Key |
| | | ++this.commponent4Key |
| | | }, |
| | | methods: { |
| | | NavChange: function(e) { |
| | |
| | | <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> |
| | | <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 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">短信登录 |
| | |
| | | <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> |
| | | <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 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 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 { |
| | | ACCESS_TOKEN, |
| | | USER_NAME, |
| | | USER_INFO |
| | | } from "@/common/util/constants" |
| | | import { |
| | | mapActions |
| | | } from "vuex" |
| | | import configService from '@/common/service/config.service.js'; |
| | | |
| | | export default { |
| | |
| | | thirdLoginState:false, |
| | | bindingPhoneModal:false, |
| | | thirdUserUuid:'', |
| | | id: '', |
| | | url: { |
| | | bindingThirdPhone: '/sys/thirdLogin/bindingThirdPhone' |
| | | } |
| | | }; |
| | | }, |
| | | onLoad:function(){ |
| | | onLoad: function(options) { |
| | | this.id = options.id; |
| | | // #ifdef APP-PLUS |
| | | var that=this |
| | | plus.runtime.getProperty( plus.runtime.appid, function ( wgtinfo ) { |
| | |
| | | // #endif |
| | | // #ifndef APP-PLUS |
| | | this.$tip.success('登录成功!') |
| | | this.$Router.replaceAll({name:'index'}) |
| | | this.$Router.replaceAll({ |
| | | name: 'index' |
| | | }) |
| | | // if (this.id) { |
| | | // uni.navigateTo({ |
| | | // url: `/pages/device/deviceWebDeils/deviceWebDeils?equipmentId=${this.id}` |
| | | // }); |
| | | |
| | | // } else { |
| | | // this.$tip.success('登录成功!') |
| | | // this.$Router.replaceAll({ |
| | | // name: 'index' |
| | | // }) |
| | | // } |
| | | |
| | | |
| | | // #endif |
| | | }else{ |
| | | this.$tip.alert(res.data.message); |
| | |
| | | saveClientId(){ |
| | | var info = plus.push.getClientInfo(); |
| | | var cid = info.clientid; |
| | | this.$http.get("/sys/user/saveClientId",{params:{clientId:cid}}).then(res=>{ |
| | | this.$http.get("/sys/user/saveClientId", { |
| | | params: { |
| | | clientId: cid |
| | | } |
| | | }).then(res => { |
| | | console.log("res::saveClientId>",res) |
| | | this.$tip.success('登录成功!') |
| | | this.$Router.replaceAll({name:'index'}) |
| | | this.$Router.replaceAll({ |
| | | name: 'index' |
| | | }) |
| | | }) |
| | | }, |
| | | changePassword() { |
| | |
| | | console.log("res====》",res) |
| | | if(res.data.success){ |
| | | this.$tip.success('登录成功!') |
| | | this.$Router.replaceAll({name:'index'}) |
| | | this.$Router.replaceAll({ |
| | | name: 'index' |
| | | }) |
| | | }else{ |
| | | this.$tip.error(res.data.message); |
| | | } |
| | |
| | | }, |
| | | loginSuccess() { |
| | | // 登陆成功,重定向到主页 |
| | | this.$Router.replace({name:'index'}) |
| | | this.$Router.replace({ |
| | | name: 'index' |
| | | }) |
| | | }, |
| | | requestFailed(err) { |
| | | this.$message.warning("登录失败") |
| | |
| | | text-align: center; |
| | | } |
| | | |
| | | .input-placeholder, .zai-input { |
| | | .input-placeholder, |
| | | .zai-input { |
| | | color: #94afce; |
| | | } |
| | | |
| | |
| | | .zai-btn.button-hover { |
| | | transform: translate(1upx, 1upx); |
| | | } |
| | | |
| | | </style> |
| | |
| | | <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 { |
| | | components: { |
| | | mumuGetQrcode // 注册 |
| | | }, |
| | | name: 'spare', |
| | | watch: { |
| | | cur: { |
| | | immediate: true, |
| | | handler() { |
| | | console.log('watch', this.cur) |
| | | }, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | html5QrCode: null, |
| | | isScaning: false, |
| | | cameraId: null, |
| | | scanVal: '' |
| | | } |
| | | NavBarColor: this.NavBarColor, |
| | | hasNavigated: false // 标记是否已经跳转 |
| | | }; |
| | | }, |
| | | methods: { |
| | | |
| | | 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前置摄像头 |
| | | // mounted() { |
| | | // window.addEventListener('hashchange', this.handleHashChange); |
| | | // // 初始解析 hash |
| | | // this.handleHashChange(); |
| | | // }, |
| | | { |
| | | fps: 10, // sets the framerate to 10 frame per second |
| | | qrbox: 250 // sets only 250 X 250 region of viewfinder to |
| | | // beforeDestroy() { |
| | | // window.removeEventListener('hashchange', this.handleHashChange); |
| | | // }, |
| | | |
| | | 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和URLSearchParams,如果不可用则使用字符串解析 |
| | | 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: 'success', |
| | | content: JSON.stringify(qrCodeMessage), |
| | | title: '提示', |
| | | content: "二维码中未找到有效的equipmentId", |
| | | showCancel: false |
| | | }); |
| | | // do something when code is read. For example: |
| | | if (qrCodeMessage) { |
| | | //成功扫出码qrCodeMessage为扫码内容 |
| | | //扫码成功记得关掉摄像 |
| | | that.action(qrCodeMessage) //对二维码逻辑处理 |
| | | that.stopScan(); //关闭扫码功能 |
| | | } |
| | | |
| | | } catch (error) { |
| | | uni.showModal({ |
| | | title: '错误', |
| | | content: "解析URL出错,请检查二维码内容", |
| | | showCancel: false |
| | | }); |
| | | } |
| | | }, 200); // 增加100毫秒的延迟 |
| | | }, |
| | | errorMessage => { |
| | | console.log('errorMessage', errorMessage); |
| | | if (errorMessage.includes('NotFoundException')) { |
| | | uni.showToast({ |
| | | title: '未找到二维码,请重新对准', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | } else { |
| | | uni.showToast({ |
| | | title: '扫码失败,请重试', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | qrcodeError(err) { // 扫码失败 |
| | | uni.showModal({ |
| | | title: '摄像头授权失败', |
| | | content: '摄像头授权失败,请检测当前浏览器是否有摄像头权限。', |
| | | success: () => { |
| | | uni.navigateBack({}); // 返回到上一页 |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | ) |
| | | .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或localhost!"; |
| | | } |
| | | if (err.name == "NotReadableError") { |
| | | message = "相机被占用!"; |
| | | } |
| | | if (err.name == "OverconstrainedError") { |
| | | message = "安装摄像头不合适!"; |
| | | } |
| | | if (err.name == "StreamApiNotSupportedError") { |
| | | message = "此浏览器不支持流API!"; |
| | | } |
| | | } |
| | | 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 { |
| | |
| | | import { Global } from './config'; |
| | | import { warn, err } from './warn'; |
| | | import { |
| | | Global |
| | | } from './config'; |
| | | import { |
| | | warn, |
| | | err |
| | | } from './warn'; |
| | | |
| | | const nodeURL = require('query-string'); |
| | | |
| | |
| | | let decode = {}; |
| | | // query 长这个样 query=encodeURIComponent(value) |
| | | const decodeStr = decodeURIComponent(jsonQuery); |
| | | const { query } = this.parse(decodeStr); // 转成 json 获取到正真的json字符串 |
| | | const { |
| | | query |
| | | } = this.parse(decodeStr); // 转成 json 获取到正真的json字符串 |
| | | if (query == null) { |
| | | warn('当前解密参数不满足编码规则'); |
| | | } else { |
| | |
| | | } |
| | | return decode; |
| | | } |
| | | |
| | | queryGet(query) { |
| | | const { encodeURI } = Global.Router.CONFIG; // 获取到路由配置 |
| | | const { |
| | | encodeURI |
| | | } = Global.Router.CONFIG; // 获取到路由配置 |
| | | let [decode, historyObj, strQuery] = [query, query, '']; |
| | | switch (encodeURI) { |
| | | case true: { // 加密模式 |
| | | decode = this.decode(query); |
| | | strQuery = this.encode(decode); |
| | | strQuery = this.encode(decode); { //-> 代码 这是修改的内容 添加我们自定义处理 |
| | | 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)), |
| | | }; |
| | |
| | | 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 }; |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | * @param {String} get 是取值 还是通过api传值 |
| | | */ |
| | | transfer(query = {}) { |
| | | const { encodeURI } = Global.Router.CONFIG; // 获取到路由配置 |
| | | const { |
| | | encodeURI |
| | | } = Global.Router.CONFIG; // 获取到路由配置 |
| | | switch (encodeURI) { |
| | | case true: { |
| | | // 加密模式 |
| | |
| | | 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) |