Commit 678ba089 authored by 李翠鸿's avatar 李翠鸿

v2

parent 56a81c58
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<style lang="scss"> <style lang="scss">
@import url("./common/uni.scss"); @import url("./common/uni.scss");
/*每个页面公共css */ /*每个页面公共css */
page { page {
background-color: #f2f2f2; background-color: #f2f2f2;
......
.page-view{ .page-view{
padding: 24rpx 24rpx; padding: 12px 12px;
} }
.uni-input{ .uni-input{
background: #FFFFFF; background: #FFFFFF;
border: 2rpx solid #CECECE; border: 1px solid #CECECE;
border-radius: 10rpx; border-radius: 5px;
height: 93rpx; height: 47px;
}
.base-style{
position: absolute;
} }
\ No newline at end of file
...@@ -12,8 +12,15 @@ const toast = (str) => { ...@@ -12,8 +12,15 @@ const toast = (str) => {
}) })
}) })
}; };
const showModal = (title, success) => {
return uni.showModal({
title: title,
success: success
})
}
export default { export default {
toast: toast, toast: toast,
showModal: showModal,
// successToast: successToast, // successToast: successToast,
// showLoading: showLoading, // showLoading: showLoading,
// tipLoading: tipLoading, // tipLoading: tipLoading,
......
...@@ -3,13 +3,22 @@ import App from './App' ...@@ -3,13 +3,22 @@ import App from './App'
import $ from './js/toast.js' import $ from './js/toast.js'
import store from './store' import store from './store'
import interceptor from './js/interceptor.js' import interceptor from './js/interceptor.js'
import api from './request/api.js'
import uView from "uview-ui"
// import VConsole from 'vconsole'
// const vConsole = new VConsole()
Vue.use(uView)
Vue.prototype.$api = api
Vue.prototype.$store = store Vue.prototype.$store = store
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$toast = $ Vue.prototype.$toast = $
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({
...App, ...App,
}) })
app.$mount() app.$mount()
//switchTab路由拦截 //switchTab路由拦截
......
...@@ -79,5 +79,28 @@ ...@@ -79,5 +79,28 @@
"landscape-secondary", "landscape-secondary",
//自然方向 //自然方向
"default" "default"
] ],
"h5": {
// "devServer": {
// "https": false,
// "proxy": {
// // "/web": {
// // "target": "http://192.168.1.151:8804",
// // "changeOrigin": true,
// // "secure": false,
// // "pathRewrite": {
// // "^/web": "/"
// // }
// // }
// "/api": {
// "target": "http://192.168.1.151:8804",
// "changeOrigin": true,
// "pathRewrite":{
// "^/api": "/api"
// }
// }
// }
// }
}
} }
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
} }
} }
}, },
{ {
"path": "pages/scan-code/app-scan/index", "path": "pages/scan-code/app-scan/index",
"style": { "style": {
...@@ -125,6 +126,9 @@ ...@@ -125,6 +126,9 @@
"navigationBarBackgroundColor": "#00B2A5", "navigationBarBackgroundColor": "#00B2A5",
"backgroundColor": "#f2f2f2", "backgroundColor": "#f2f2f2",
// "pageOrientation": "portrait",//横屏配置,全局屏幕旋转设置(仅 APP/微信/QQ小程序) // "pageOrientation": "portrait",//横屏配置,全局屏幕旋转设置(仅 APP/微信/QQ小程序)
"pageOrientation": "auto" "pageOrientation": "portrait-primary"
} },
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
}
} }
...@@ -28,19 +28,19 @@ ...@@ -28,19 +28,19 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.title-bar{ .title-bar{
padding: 0 40rpx; padding: 0 1.25rem;
line-height: 100rpx; line-height: 3.125rem;
height: 100rpx; height:3.125rem;;
.view-icon { .view-icon {
margin-top:-4rpx; margin-top:-2px;
width: 44rpx; width: 22px;
height:44rpx; height:22px;
vertical-align: middle; vertical-align: middle;
} }
.title-bar-text{ .title-bar-text{
// line-height: 13rpx; // line-height: 13rpx;
padding-left: 10rpx; padding-left: 5px;
font-size:36rpx;; font-size:18px;;
color: #ffffff; color: #ffffff;
} }
......
<!-- 数据页面 --> <!-- 数据页面 -->
<template> <template>
<view>这是数据页面</view> <view>
<view class="data-style" v-if="isShowCompons" :style="mainStyleConfig">
<rectangular ref="rectangular" :componentsData="componentsData"></rectangular>
<kpi ref="kpi" :componentsData="componentsData"></kpi>
<text-item ref="textItem" :componentsData="componentsData"></text-item>
<list-item ref="listItem" :componentsData="componentsData"></list-item>
<!-- <div data-v-3873ec1c="" class="pressButton_box">
<button @click="test">fhsjsh</button>
</div> -->
</view>
</view>
</template> </template>
<script> <script>
export default{ import {
data(){ arrayToString
return{ } from '../../js/tool.js'
import jsonData from '../../js/test.json'
import Rectangular from '../data-conponent/rectangular.vue'
import Kpi from '../data-conponent/kpi.vue'
import TextItem from '../data-conponent/text.vue'
import ListItem from '../data-conponent/list.vue'
export default {
components: {
Rectangular,//矩形组件
Kpi,//kpi组件
TextItem,//文字组件
ListItem,//列表组件
},
data() {
return {
isShowCompons: false,
componentsData: null, //组件数据
mainStyleConfig: null, //页面样式
// children:null
}
},
created() {
this.componentsData = jsonData
let _this = this
// console.log(JSON.stringify(this.componentsData))
if (this.componentsData) {
//设置标题
uni.setNavigationBarTitle({
title: _this.componentsData.pageTitle
});
this.setMainStyle()
}
},
methods: {
setMainStyle() {
this.isShowCompons = true
let styleConfig = this.componentsData.styleConfig
styleConfig.margin = arrayToString(styleConfig.margin)
styleConfig.padding = arrayToString(styleConfig.padding)
styleConfig.borderRadius = arrayToString(styleConfig.borderRadius)
this.mainStyleConfig = styleConfig
} }
// test(){
// uni.request({
// url: 'http://www.baidu.com',
// method:'GET',
// header: {
// // 'token': token
// },
// success(res) {
// console.log(666+JSON.stringify(res))
// //响应成功拦截
// // resolve(res)
// },
// fail(err) {
// //响应失败拦截
// // reject(err)
// },
// complete(res) {
// console.log(666+res)
// //请求完成拦截
// // uni.hideLoading()
// }
// })
// }
},
onReady() {
// console.log(jsonData.pageTitle)
}, },
onShow(){ onShow() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.lockOrientation('default'); //锁定 plus.screen.lockOrientation('default'); //锁定
// #endif // #endif
}, },
} }
</script> </script>
<style> <style lang="scss" scoped>
.page-view {
padding:0;
}
.data-style {
position: relative;
width: 100%;
height: 100%;
// background: red;
}
</style> </style>
...@@ -5,7 +5,14 @@ ...@@ -5,7 +5,14 @@
<!-- <button type="primary" class="loginBtn" @click="loginFun">登录</button> --> <!-- <button type="primary" class="loginBtn" @click="loginFun">登录</button> -->
<image @click="scanCodeFun" mode="aspectFit" class="login-sao-img" src="../../static/img1/saoyisao.png"></image> <image @click="scanCodeFun" mode="aspectFit" class="login-sao-img" src="../../static/img1/saoyisao.png"></image>
<image mode="aspectFit" class="login-top-img" src="../../static/img1/loginlogo.png"></image> <image mode="aspectFit" class="login-top-img" src="../../static/img1/loginlogo.png"></image>
<view class="login-logo-img">
<view style="display: flex;align-items:center;justify-content: center;height: 100%;">
<img style="height:100%;" :src="logoImg"></img>
</view>
</view>
<view class="login-from"> <view class="login-from">
<view class="login-user"> <view class="login-user">
<input class="uni-input login-input" v-model="userName" focus type="text" placeholder="请输入用户名" /> <input class="uni-input login-input" v-model="userName" focus type="text" placeholder="请输入用户名" />
<image mode="aspectFit" class="login-input-img" src="../../static/img1/yonghuIcon.png"></image> <image mode="aspectFit" class="login-input-img" src="../../static/img1/yonghuIcon.png"></image>
...@@ -26,14 +33,28 @@ ...@@ -26,14 +33,28 @@
data() { data() {
return { return {
height: '100vh', height: '100vh',
userName: 'admin', userName: 'SuperAdmin',
password: '123' password: 'SYC888888',
logoImg: '../../static/img/hello.png'
} }
}, },
methods: { methods: {
getLogoImgFun() {
let projectInfo = uni.getStorageSync('projectInfo')
let _this = this
_this.logoImg = ''
let projectName =projectInfo.projectName? projectInfo.projectName:'test'
let logoFile = projectInfo.logoFile? projectInfo.logoFile:'hello.png'
let baseUrl = 'http://' + projectInfo.serviceAddress+_this.$store.state.GetProjectResourceBaseUrl
_this.logoImg =baseUrl+'?projectName=' + projectName +'&resourcePath=' + logoFile
},
// 登录 // 登录
loginFun() { loginFun() {
console.log(this.$store.systemInfo) // console.log(this.$store.systemInfo)
if (!this.userName.trim()) { if (!this.userName.trim()) {
this.$toast.toast('用户名不能为空') this.$toast.toast('用户名不能为空')
return return
...@@ -42,28 +63,72 @@ ...@@ -42,28 +63,72 @@
this.$toast.toast('密码不能为空') this.$toast.toast('密码不能为空')
return return
} }
// #ifdef APP-PLUS
this.$api.login(this.userName, this.password).then(res => {
console.log(JSON.stringify(data))
let data = res.data.data
if (data) {
// console.log(data.LoginIsSuccess)
if (data.LoginIsSuccess) {
console.log(JSON.stringify(data))
uni.setStorageSync('userInfo1', data);
this.$toast.toast('登录成功')
this.$api.loginInOutRecord(data.SCMSUserName, '网页登录').then(res => {
console.log('登录成功')
uni.switchTab({
url: "/pages/monitoring/index"
})
})
} else {
this.$toast.toast('登录失败')
}
}
}).catch(error => {
this.$toast.toast(error)
})
// #endif
// #ifdef H5
uni.switchTab({ uni.switchTab({
url: "/pages/monitoring/index" url: "/pages/monitoring/index"
}) })
// #endif
}, },
//调用扫码方法 //调用扫码方法
scanCodeFun() { scanCodeFun() {
this.$store.dispatch('getCodeInfoFun').then(res => { this.$store.dispatch('getCodeInfoFun').then(res => {
console.log(JSON.stringify(res)) const data = res.data
uni.switchTab({ if (data.code == 0) {
url: "/pages/monitoring/index" console.log(JSON.stringify(uni.getStorageSync('projectInfo')))
}) this.$toast.toast('更新工程信息成功')
this.getLogoImgFun()
}
// console.log(JSON.stringify(res))
// uni.switchTab({
// url: "/pages/monitoring/index"
// })
}) })
} }
}, },
created() {
// this.getRouter()
},
onLoad() { onLoad() {
// console.log('App Launch'), // console.log('App Launch'),
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定 plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif // #endif
}, },
mounted() {
this.getLogoImgFun()
}
} }
</script> </script>
...@@ -93,6 +158,16 @@ ...@@ -93,6 +158,16 @@
left: 50%; left: 50%;
margin-left: -5.5rem; margin-left: -5.5rem;
} }
.login-logo-img {
width: 17rem;
height: 106px;
position: absolute;
top: 28vh; // background-color: #eeeeee;
// margin: 0 ;
margin-left: -8.5rem;
left: 50%
}
} }
.login-input { .login-input {
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
<template> <template>
<view class="page-view"> <view class="page-view">
<view v-for="(item,index) in dataList" :key="index" style="margin-bottom: 10px;"> <view v-for="(item,index) in dataList" :key="index" style="margin-bottom: 10px;">
<collapse :data="item" @collaspe-item-fun="getMonitoringViewInfo"></collapse> <collapse :data="item" @collaspe-item-fun="getMonitoringViewInfo"></collapse>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// import '../../js/jquery.signalR-2.4.1.js'
import collapse from '../components/collapse/index.vue' import collapse from '../components/collapse/index.vue'
export default { export default {
components: { components: {
...@@ -15,55 +16,161 @@ ...@@ -15,55 +16,161 @@
}, },
data() { data() {
return { return {
dataList:[{ projectName:'',
title:'一楼加工厂线监控', dataList: [{
textList:[{ title: '一楼加工厂线监控',
img:'../../static/img1/codelogo.png', textList: [{
textTitle:'厂区布局', img: '../../static/img1/codelogo.png',
textTime:'2021/04/12 20:12:24' textTitle: '厂区布局',
textTime: '2021/04/12 20:12:24'
},
{
img: '../../static/img1/codelogo.png',
textTitle: '一号供房印码车间',
textTime: '2021/04/12 20:12:24'
}
]
}, },
{ {
img:'../../static/img1/codelogo.png', title: '二楼加工厂线监控',
textTitle:'一号供房印码车间', textList: [{
textTime:'2021/04/12 20:12:24' img: '../../static/img1/codelogo.png',
textTitle: '厂区布局',
textTime: '2021/04/12 20:12:24'
}]
} }
]
},
{
title:'二楼加工厂线监控',
textList:[{
img:'../../static/img1/codelogo.png',
textTitle:'厂区布局',
textTime:'2021/04/12 20:12:24'
}]
}
] ]
} }
}, },
methods:{ methods: {
onChangeFun(e){ onChangeFun(e) {
}, },
//获取列表信息,data-当前折叠卡数据/item-当前点击数据/index-当前点击下标 //获取列表信息,data-当前折叠卡数据/item-当前点击数据/index-当前点击下标
getMonitoringViewInfo(data,item,index){ getMonitoringViewInfo(data, item, index) {
// console.log('eee') // console.log(JSON.stringify(this.projectName))
uni.navigateTo({ if (item) {
url: '/pages/monitoring/monitoring-view/index?data='+JSON.stringify(item) if (item.SCMSMenuType == 'view') {
// console.log(JSON.stringify(item))
let title = item.SCMSChildMenuName
let id = item.SCMSChildMenuID
uni.navigateTo({
url: '/pages/monitoring/monitoring-view/index?id=' + id + '&title=' + title+'&projectName='+this.projectName
})
}else{
this.$toast.toast('此菜单不是监控画面,不可查看')
}
} else {
this.$toast.toast('获取画面数据失败')
}
// let title = this.$store.state.routerInfo[0].children[0].title
// let id = this.$store.state.routerInfo[0].children[0].id
// uni.navigateTo({
// url: '/pages/monitoring/monitoring-view/index?id='+id+'&title='+title
// })
},
//获取变量类型
getSCMSTagsFun() {
this.$api.getSCMSTags().then(res => {
uni.setStorageSync('variable', JSON.stringify(res.data.data));
// console.log(JSON.stringify(res.data))
})
},
//请求路由权限的方法
getRouter() {
var userid = ''
this.$api.mainGetMenuKey(userid).then(res => {
const data = res.data
if (data.code == 0) {
if (data.data) {
uni.setStorageSync('routerInfo', JSON.stringify(data.data));
this.$store.state.routerInfo = data.data
// console.log(JSON.stringify(this.$store.state.routerInfo))
}
}
}).catch(error => {
console.log(error)
})
},
//获取监控列表
getMenuFun() {
let projectInfo = uni.getStorageSync('projectInfo')
// console.log('6566'+JSON.stringify(projectInfo))
this.projectName = projectInfo.projectName
this.$api.getMenu(this.projectName).then(res => {
// console.log('menu'+JSON.stringify(res))
const data = res.data
if (data.code == 0) {
if (data.data) {
const data1 = data.data
let mainMenus = JSON.parse(data1.mainMenus)
let childMenus = JSON.parse(data1.childMenus)
mainMenus.forEach(item => {
item.title = item.SCMSMainMenuName
item.textList = []
for (let i = 0; i < childMenus.length; i++) {
let childMenusItem = childMenus[i]
if (childMenusItem.SCMSMainMenuID == item.SCMSMainMenuID) {
childMenusItem.img = '../../static/img1/codelogo.png'
childMenusItem.textTitle = childMenusItem.SCMSChildMenuName
childMenusItem.textTime = '2021/04/12 20:12:24'
item.textList.push(childMenusItem)
}
}
})
this.dataList = mainMenus
}
} else {
this.$toast.toast(data.msg)
}
}).catch(err => {
console.log(err)
})
},
//建立WebSocket连接
getWebSocket() {
uni.connectSocket({
url: 'ws://api/hubs/chart', //仅为示例,并非真实接口地址
success: (res => {
// console.log('res==>' + JSON.stringify(res))
}),
complete: (res) => {
// console.log('res==>'+JSON.stringify(res))
}
});
uni.onSocketMessage(function(res) {
console.log('收到服务器内容:' + res.data);
}); });
// console.log(JSON.stringify(data))
// console.log(JSON.stringify(item))
// this.$toast.toast(index.toString())
} }
}, },
mounted() { mounted() {
},
created() {
this.getSCMSTagsFun()
// this.getWebSocket()
this.getRouter()
},
onShow() {
this.getMenuFun()
}, },
onLoad() { onLoad() {
// console.log('App Launch'), // console.log('App Launch'),
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定 plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif // #endif
}, },
} }
......
This diff is collapsed.
...@@ -52,51 +52,23 @@ ...@@ -52,51 +52,23 @@
}, },
//调用扫码方法 //调用扫码方法
scanCodeFun() { scanCodeFun() {
// uni.redirectTo({
// url: "/pages/login/index"
// })
this.$store.dispatch('getCodeInfoFun').then(res=>{ this.$store.dispatch('getCodeInfoFun').then(res=>{
console.log(JSON.stringify(res)) // console.log(JSON.stringify(res))
uni.redirectTo({ const data = res.data
url: "/pages/login/index" if(data.code == 0){
}) console.log(res.data)
this.$toast.toast('获取工程信息成功')
uni.redirectTo({
url: "/pages/login/index"
})
}
}).catch(res=>{
console.log(res)
}) })
// let _this = this
// // #ifdef APP-PLUS
// uni.scanCode({
// // onlyFromCamera: true,
// scanType: ['qrCode', 'barCode'],
// success: function(res) {
// console.log('条码类型:' + res.scanType);
// console.log('条码内容:' + res.result);
// //扫码成功跳转登录页面
// uni.redirectTo({
// url: "/pages/login/index"
// })
// },
// complete: function(res) {
// // uni.redirectTo({
// // url: "/pages/login/index"
// // })
// // setTimeout(function() {
// uni.hideLoading();
// // }, 2000);
// },
// fail: function(res) {
// console.log('失败条码类型:' + res.scanType);
// setTimeout(function() {
// uni.hideLoading();
// }, 2000);
// }
// });
// // uni.redirectTo({
// // url: "/pages/login/index"
// // })
// // #endif
// // #ifndef APP-PLUS || APP-NVUE
// uni.redirectTo({
// url: "/pages/login/index"
// })
// // #endif
}, },
...@@ -128,8 +100,8 @@ ...@@ -128,8 +100,8 @@
height: 100vh; height: 100vh;
} }
.title-img{ .title-img{
height: 152rpx; height: 4.75rem;
width: 349rpx; width: 11rem;
margin-top: 14vh; margin-top: 14vh;
} }
...@@ -143,19 +115,19 @@ ...@@ -143,19 +115,19 @@
} }
.content-title2{ .content-title2{
width: 574rpx; width: 18rem;
text-align: left; text-align: left;
margin-top: 9.3vh; margin-top: 9.3vh;
.title2-text{ .title2-text{
margin-top: 33rpx; margin-top: 1rem;
} }
.text1{ .text1{
font-size: 40rpx; font-size: 1.25rem;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: bold; font-weight: bold;
} }
.text2{ .text2{
font-size: 32rpx; font-size: 1rem;
font-family: PingFang-SC-Medium; font-family: PingFang-SC-Medium;
font-weight: Medium; font-weight: Medium;
} }
...@@ -169,18 +141,18 @@ ...@@ -169,18 +141,18 @@
} }
.logo { .logo {
height: 147rpx; height: 4.6rem;
width: 147rpx; width: 4.6rem;
} }
.text-area { .text-area {
padding-top: 35rpx; padding-top: 1.1rem;
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.title { .title {
font-size: 30rpx; font-size: 1rem;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #3F81FF; color: #3F81FF;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
onLoad() { onLoad() {
// console.log('App Launch'), // console.log('App Launch'),
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary'); //锁定 plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif // #endif
}, },
......
// api接口 // api接口
import api from "./request.js" import api from "./request.js"
// 获取项目信息
// function getAppInfo(projectName) {
// // console.log('projectName=>'+projectName)
// return api.baseRequest('/api/view/GetAppInfo?projectName='+projectName, "GET",2)
// }
function getAppInfo(projectName) {
// console.log('projectName=>'+projectName)
return api.baseRequest(`${projectName}`, "GET",2)
}
//获取图片资源
function getProjectResource(projectName,pathName) {
return api.baseRequest('/api/view/GetProjectResource?projectName='+projectName+'&resourcePath='+pathName,'GET',1)
}
//获取监控列表
function getMenu(projectName) {
return api.baseRequest('/api/view/GetMenu?projectName='+projectName, "GET",0)
}
// 用户密码登录
function login(userName, password) {
return api.baseRequest('/api/Login/Login_GstLoginIsSuccess?argUserAccount=' +userName +'&argPassword='+password, "POST",1)
}
//记录用户登录、注销、退出系统日志
function loginInOutRecord(userName,type){
return api.baseRequest('/api/Login/Login_UserLogInOutRecord?UserName='+userName+'&Type='+type,"POST",1)
}
//获取控件JSON数据
// function getControlsJson(viewName){
// return api.baseRequest1('/ViewJson/'+viewName+'.json',"GET")
// }
function getControlsJson(projectName,viewName){
return api.baseRequest('/api/view/GetProjectResource?projectName='+projectName+'&resourcePath=ViewJson/'+viewName+'.json',"GET",0)
}
//请求权限接口
function mainGetMenuKey(userid){
return api.baseRequest('/api/Main/Main_GetMenuKey?argUserID='+userid,"POST",1)
}
//请求变量类型
function getSCMSTags(){
return api.baseRequest('/api/Base/GetSCMSTags',"POST",1)
}
//数值输入框、控制按钮、点动按钮、开关、读写框下发接口
function postIOServiceTest(data){
return api.baseRequest('/api/Base/PostIOServiceTest',"POST",1,data)
}
//数值显示请求、读写框、罐体、管道流动数值请求
function postRediusTest(data){
return api.baseRequest('/api/Base/PostRediusTest',"POST",1,data)
}
//权限请求接口
function canExcuteAuthorityControl(userinfoID,argChildMenuID,elementName){
return api.baseRequest(`/api/UserManage/UserManage_CanExcuteAuthorityControl?argUserID=${userinfoID}&argChildMenuID=${argChildMenuID}&argElementName=${elementName}`,"POST",1)
}
//获取跳转界面ID
function getViewId(arr,arrId){
return api.baseRequest('/api/HMI/HMI_GstViewId?argChildMenuID=' + arr +'&argChildMenuKey=' + arrId,"POST",1)
}
//下拉文本值
function getDataColumn(ComId,ComNmame){
return api.baseRequest(`/api/control/GetDataColumn?setId=${ComId}&columnName=${ComNmame}`,"GET",1)
}
//报警信息
function gstAlarms(data){
return api.baseRequest(`/api/HMI/HMI_GstAlarms`,"POST",1,data)
}
//获取报表信息
function searchExtensionData(data){
return api.baseRequest(`/api/ParameterReport/SearchExtensionData`,"POST",1,data)
}
//获取报表信息2
function searchItemData(data){
return api.baseRequest(`/api/ParameterReport/SearchItemData`,"POST",1,data)
}
//获取报表信息3
function executeScript(data){
return api.baseRequest(`/api/HMI/HMI_ExecuteScript`,"POST",1,data)
}
//获取图表实时刷新数据
function getRelayEchart(viewName){
return api.baseRequest(`/api/chart/GetRelay?viewName=${viewName}`,"GET",1)
}
//获取查询按钮时间控件跟图表绑定信息
function getChartControlNames(viewName){
return api.baseRequest(`/api/control/GetChartControlNames?viewName=${viewName}`,"GET",1)
}
//点击查询按钮获取图表信息
function getChartQuery(data){
return api.baseRequest(`/api/chart/query`,"POST",1,data)
}
export default { export default {
// 密码登录 getAppInfo,
passwordLogin(params) { getProjectResource,
return api.baseRequest("/platform/metadata/logon", "GET", params) getMenu,
}, login,
loginInOutRecord,
mainGetMenuKey,
getControlsJson,
getSCMSTags,
postIOServiceTest,
postRediusTest,
canExcuteAuthorityControl,
getViewId,
getDataColumn,
gstAlarms,
searchExtensionData,
searchItemData,
executeScript,
getRelayEchart,
getChartControlNames,
getChartQuery
} }
// 全局请求封装 // 全局请求封装
const token = '自己的token令牌,最好读取缓存中的' const token = '自己的token令牌,最好读取缓存中的'
// const token = uni.getStorage('token') // const token = uni.getStorage('token')
const apiUrl = 'https://v1.shopapi.tpfeps.com' //#ifdef APP-PLUS
const apiUrl = 'http://192.168.1.68:8804' //app ip
const apiUrl1 = 'http://192.168.1.68:8806' //web ip
//#endif
//#ifndef APP-PLUS
const apiUrl = 'http://192.168.1.68:8806'
//#endif
// const apiUrl = 'http://localhost:5000'
// url-api路径/method-请求类型/data-请求参数 // url-api路径/method-请求类型/data-请求参数
const baseRequest = (url, method, data) => { const baseRequest = (url,method,type,data) => {
//请求拦截 //请求拦截
uni.showLoading({ // uni.showLoading({
title: "加载中" // title: "加载中"
}); // });
let projectInfo = uni.getStorageSync('projectInfo')
let apiAddress = ''
let serviceAddress = ''
if(projectInfo){
apiAddress ='http://' + projectInfo.apiAddress
serviceAddress = 'http://' + projectInfo.serviceAddress
}
let newApiUrl = ''
if(type == 0){
newApiUrl = serviceAddress + url //app ip
}else if(type == 1){
newApiUrl = apiAddress + url //web ip
}else{
newApiUrl = url //完整路径
}
console.log('url1=>'+newApiUrl)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// uni.request({
// url: apiUrl + url,
// data:params,
// method:method,
// header: {
// 'token':token
// }
// }).then((response)=>{
// let [error, res] = response;
// resolve(res.data);
// console.log(response[1].header.token) //获取请求头token
// }).catch(error => {
// let [err, res] = error;
// reject(err)
// })
uni.request({ uni.request({
url: apiUrl + url, url: newApiUrl,
data: data, data: data,
method: method, method: method,
header: { header: {
'token': token // 'token': token
},
success(res) {
// console.log(JSON.stringify(res))
//响应成功拦截
resolve(res)
},
fail(err) {
//响应失败拦截
reject(err)
},
complete(res) {
// console.log(JSON.stringify(res))
//请求完成拦截
// uni.hideLoading()
} }
})
});
}
const baseRequest1 = (url, method, data) => {
//请求拦截
// uni.showLoading({
// title: "加载中"
// });
return new Promise((resolve, reject) => {
console.log(apiUrl1 + url)
uni.request({
url: apiUrl1 + url,
data: data,
method: method,
header: {
// 'token': token
},
success(res) { success(res) {
// console.log(JSON.stringify(res))
//响应成功拦截 //响应成功拦截
resolve(res) resolve(res)
}, },
...@@ -42,13 +85,15 @@ const baseRequest = (url, method, data) => { ...@@ -42,13 +85,15 @@ const baseRequest = (url, method, data) => {
reject(err) reject(err)
}, },
complete(res) { complete(res) {
// console.log(JSON.stringify(res))
//请求完成拦截 //请求完成拦截
uni.hideLoading() // uni.hideLoading()
} }
}) })
}); });
} }
export default { export default {
baseRequest baseRequest,
baseRequest1
} }
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
Vue.use(Vuex); //vue的插件机制 Vue.use(Vuex); //vue的插件机制
import $api from '../request/api.js'
import $toast from '../js/toast.js'
//Vuex.Store 构造器选项 //Vuex.Store 构造器选项
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { //存放状态 state: { //存放状态
routerInfo: '',
systemInfo: '', //系统信息 systemInfo: '', //系统信息
userInfo: '', //用户信息 GetProjectResourceBaseUrl:'/api/view/GetProjectResource',
baseUrl:'http://192.168.1.68:8806'
}, },
actions: { actions: {
//扫码获取信息 //扫码获取信息
getCodeInfoFun({ getCodeInfoFun({
commit commit
}) { }) {
uni.removeStorageSync('projectInfo');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// #ifdef APP-PLUS // #ifdef APP-PLUS
uni.scanCode({ uni.scanCode({
// onlyFromCamera: true, // onlyFromCamera: true,
scanType: ['qrCode', 'barCode'], scanType: ['qrCode', 'barCode'],
success: function(res) { success: function(res) {
resolve(res) // console.log(333)
let projectName = res.result
// console.log(22+JSON.stringify(res))
if(projectName){
// console.log(88+JSON.stringify(projectName))
$api.getAppInfo(projectName).then(res=>{
console.log(88+JSON.stringify( res.data.data))
const code = res.data.code
// console.log(JSON.stringify( res.data.data))
if(code == 1){
$toast.toast(res.data.msg)
}else{
uni.setStorageSync('projectInfo', res.data.data);
resolve(res)
}
if(res.statusCode == 500){
$toast.toast('扫码失败')
}
}).catch(err=>{
console.log('err'+JSON.stringify(res))
$toast.toast('扫码失败')
})
}else{
// console.log(444)
$toast.toast('扫码失败')
}
}, },
complete: function(res) { complete: function(res) {
uni.hideLoading(); uni.hideLoading();
}, },
fail: function(res) { fail: function(res) {
reject(res) reject(res)
console.log('失败条码类型:' + res.scanType); console.log('失败条码类型:' + res.scanType);
} }
...@@ -37,15 +69,57 @@ const store = new Vuex.Store({ ...@@ -37,15 +69,57 @@ const store = new Vuex.Store({
// }) // })
// #endif // #endif
// #ifndef APP-PLUS || APP-NVUE // #ifndef APP-PLUS || APP-NVUE
uni.redirectTo({ $api.getAppInfo('test').then(res=>{
url: "/pages/login/index" const code = res.data.code
if(code == 1){
$toast.toast(res.data.msg)
}else{
uni.setStorageSync('projectInfo', res.data.data);
uni.redirectTo({
url: "/pages/login/index"
})
resolve(res)
}
if(res.statusCode == 500){
$toast.toast('扫码失败')
}
}).catch(res=>{
$toast.toast('扫码失败')
}) })
// #endif // #endif
}) })
} },
//权限请求
jurisdictionShow(context,payload) {
const {item,dataId } = payload
return new Promise((resolve, reject) => {
let userinfoID = ''
// console.log(uni.getStorageSync('userInfo1'))
if (uni.getStorageSync('userInfo1') == null) {
// userinfoID = JSON.parse(sessionStorage.getItem('sightseerInfo1')).SCMSUserID;
} else {
userinfoID = uni.getStorageSync('userInfo1').SCMSUserID;
}
let argChildMenuID = dataId
let elementName = item.class
$api.canExcuteAuthorityControl(userinfoID, argChildMenuID, elementName).then(res => {
console.log(JSON.stringify(dataId))
if (res.data.code == 0) {
resolve(res.data)
} else {
reject(res.data)
}
})
})
},
} }
}) })
export default store export default store
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
/* 颜色变量 */ /* 颜色变量 */
/* 行为相关颜色 */ /* 行为相关颜色 */
@import 'uview-ui/theme.scss';
$uni-color-primary: #007aff; $uni-color-primary: #007aff;
$uni-color-success: #4cd964; $uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e; $uni-color-warning: #f0ad4e;
......
var isReady=false;var onReadyCallbacks=[]; var isReady=false;var onReadyCallbacks=[];
var isServiceReady=false;var onServiceReadyCallbacks=[]; var isServiceReady=false;var onServiceReadyCallbacks=[];
var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"auto"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"demo2","compilerVersion":"3.1.18","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}}; var __uniConfig = {"pages":["pages/scan-code/index","pages/login/index","pages/monitoring/index","pages/data/index","pages/working/index","pages/message/index","pages/my/index","pages/monitoring/monitoring-view/index","pages/scan-code/app-scan/index"],"window":{"navigationBarTextStyle":"white","navigationBarTitleText":"cms","navigationBarBackgroundColor":"#00B2A5","backgroundColor":"#f2f2f2","pageOrientation":"portrait-primary"},"tabBar":{"color":"#2D2D2D","selectedColor":"#2D2D2D","borderStyle":"rgba(220, 220, 220, 0.24)","backgroundColor":"#ffffff","height":"50px","fontSize":"10px","iconWidth":"22px","spacing":"2px","list":[{"pagePath":"pages/monitoring/index","iconPath":"static/img1/jiankong.png","selectedIconPath":"static/img1/jiankong1.png","text":"监控"},{"pagePath":"pages/data/index","iconPath":"static/img1/shuju.png","selectedIconPath":"static/img1/shuju1.png","text":"数据"},{"pagePath":"pages/working/index","iconPath":"static/img1/gongzuo.png","selectedIconPath":"static/img1/gongzuo1.png","text":"工作"},{"pagePath":"pages/message/index","iconPath":"static/img1/xiaoxi.png","selectedIconPath":"static/img1/xiaoxi1.png","text":"消息","backgroundColor":"#000"},{"pagePath":"pages/my/index","iconPath":"static/img1/wo.png","selectedIconPath":"static/img1/wo1.png","text":"我的"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":true,"autoclose":false},"appname":"demo2","compilerVersion":"3.1.18","entryPagePath":"pages/scan-code/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
var __uniRoutes = [{"path":"/pages/scan-code/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扫码","titleNView":false}},{"path":"/pages/login/index","meta":{},"window":{"titleNView":false}},{"path":"/pages/monitoring/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"监控"}},{"path":"/pages/data/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"数据"}},{"path":"/pages/working/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"工作"}},{"path":"/pages/message/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"消息"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/monitoring/monitoring-view/index","meta":{},"window":{"titleNView":false,"bounce":false}},{"path":"/pages/scan-code/app-scan/index","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扫码"}}]; var __uniRoutes = [{"path":"/pages/scan-code/index","meta":{"isQuit":true},"window":{"navigationBarTitleText":"扫码","titleNView":false}},{"path":"/pages/login/index","meta":{},"window":{"titleNView":false}},{"path":"/pages/monitoring/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"监控"}},{"path":"/pages/data/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"数据"}},{"path":"/pages/working/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"工作"}},{"path":"/pages/message/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"消息"}},{"path":"/pages/my/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"我的"}},{"path":"/pages/monitoring/monitoring-view/index","meta":{},"window":{"titleNView":false,"bounce":false}},{"path":"/pages/scan-code/app-scan/index","meta":{"isNVue":true},"window":{"navigationBarTitleText":"扫码"}}];
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}}); __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment