Commit 56a81c58 authored by 李翠鸿's avatar 李翠鸿

first

parents
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"type": "uniCloud",
"default": {
"launchtype": "local"
}
}
]
}
<script>
export default {
onLaunch: function() {
console.log('App Launch')
// plus.screen.lockOrientation('landscape-primary'); //锁定
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
globalData: {
}
}
</script>
<style lang="scss">
@import url("./common/uni.scss");
/*每个页面公共css */
page {
background-color: #f2f2f2;
font-family: PingFang TC;
/* padding:0 24rpx; */
}
// .uni-tabbar{
// box-shadow: 0px -8px 8px 0px rgba(220, 220, 220, 0.24);
// }
</style>
.page-view{
padding: 24rpx 24rpx;
}
.uni-input{
background: #FFFFFF;
border: 2rpx solid #CECECE;
border-radius: 10rpx;
height: 93rpx;
}
\ No newline at end of file
const interceptor = () => {
const switchTebInterceptor = () => {
uni.addInterceptor('switchTab', {
invoke(args) {
console.log(JSON.stringify(args))
// request 触发前拼接 url
// args.url = 'https://www.example.com/'+args.url
},
success(args) {
// 请求成功后,修改code值为1
// args.data.code = 1
},
fail(err) {
console.log('interceptor-fail', err)
},
complete(res) {
console.log('interceptor-complete', res)
}
})
}
const navigateToInterceptor = () => {
uni.addInterceptor('navigateTo', {
invoke(args) {
console.log(JSON.stringify(args))
// request 触发前拼接 url
// args.url = 'https://www.example.com/'+args.url
},
success(args) {
// 请求成功后,修改code值为1
// args.data.code = 1
},
fail(err) {
console.log('interceptor-fail', err)
},
complete(res) {
console.log('interceptor-complete', res)
}
})
}
}
export default interceptor
// 全局封装提示框
// 不含icon提示框-基础提示框
const toast = (str) => {
return new Promise((resolve, reject) => {
uni.showToast({
title: str,
icon: "none",
// duration: 2000,
success: () => {
resolve
}
})
})
};
export default {
toast: toast,
// successToast: successToast,
// showLoading: showLoading,
// tipLoading: tipLoading,
// hideLoading: hideLoading,
}
import Vue from 'vue'
import App from './App'
import $ from './js/toast.js'
import store from './store'
import interceptor from './js/interceptor.js'
Vue.prototype.$store = store
Vue.config.productionTip = false
Vue.prototype.$toast = $
App.mpType = 'app'
const app = new Vue({
...App,
})
app.$mount()
//switchTab路由拦截
interceptor.switchTebInterceptor
{
"name": "demo2",
"appid": "__UNI__630CE47",
"description": "",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
/* 5+App特有相关 */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
/* 模块配置 */
"modules": {},
/* 应用发布信息 */
"distribute": {
/* android打包配置 */
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios": {},
/* SDK配置 */
"sdkConfigs": {}
}
},
/* 快应用特有相关 */
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
},
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"orientation": [
//竖屏正方向
"portrait-primary",
//竖屏反方向
"portrait-secondary",
//横屏正方向
"landscape-primary",
//横屏反方向
"landscape-secondary",
//自然方向
"default"
]
}
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/scan-code/index",
"style": {
"navigationBarTitleText": "扫码",
"app-plus":{
"titleNView":false
}
}
},
{
"path": "pages/login/index",
"style": {
// "navigationBarTitleText": "登录",
"app-plus":{
"titleNView":false
}
}
},
{
"path": "pages/monitoring/index",
"style": {
"navigationBarTitleText": "监控"
}
},
{
"path": "pages/data/index",
"style": {
"navigationBarTitleText": "数据"
}
},
{
"path": "pages/working/index",
"style": {
"navigationBarTitleText": "工作"
}
},
{
"path": "pages/message/index",
"style": {
"navigationBarTitleText": "消息"
}
},
{
"path": "pages/my/index",
"style": {
"navigationBarTitleText": "我的"
}
},
{
"path": "pages/monitoring/monitoring-view/index",
"style": {
// "navigationBarTitleText": "登录",
"app-plus":{
"titleNView":false,
"bounce":false
}
}
},
{
"path": "pages/scan-code/app-scan/index",
"style": {
"navigationBarTitleText": "扫码"
// "app-plus":{
// "titleNView":false
// }
}
}
],
"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": "我的"
}
]
// "midButton": {
// "width": "80px",
// "height": "50px",
// "text": "文字",
// "iconPath": "static/image/midButton_iconPath.png",
// "iconWidth": "24px",
// "backgroundImage": "static/image/midButton_backgroundImage.png"
// }
},
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "cms",
"navigationBarBackgroundColor": "#00B2A5",
"backgroundColor": "#f2f2f2",
// "pageOrientation": "portrait",//横屏配置,全局屏幕旋转设置(仅 APP/微信/QQ小程序)
"pageOrientation": "auto"
}
}
<!-- 折叠面板 -->
<template>
<view class="collapse-content">
<uni-collapse @change="change">
<uni-collapse-item :show-animation="true" :title="data.title" :open="true">
<view v-for="(item,index) in data.textList" :key="index" class="collapse-item-view">
<image class="collapse-item-img" :src="item.img"></image>
<view class="collapse-item-text" @click="collaspeItemFun(data,item,index)">
<view class="text-title"><text>{{item.textTitle}}</text></view>
<view class="text-content">
<text style="padding-right: 20rpx;">最近预览时间</text>
<text >{{item.textTime}}</text>
</view>
</view>
</view>
</uni-collapse-item>
</uni-collapse>
</view>
</template>
<script>
export default {
props:{
//折叠面板数据
data:{
type:Object,
default:()=>{
return {}
}
}
},
data() {
return {
}
},
methods: {
//点击列表事件
collaspeItemFun(data,item,index){
this.$emit('collaspe-item-fun',data,item,index)
},
change() {
}
}
}
</script>
<style lang="scss" scoped>
.collapse-content {
color: #333333;
font-family: PingFang SC;
.collapse-item-view {
overflow: hidden;
padding: 28rpx 0;
margin:0 28rpx;
border-bottom-width: 2rpx;
border-bottom-color: #EBEBEB;
border-bottom-style: solid;
.collapse-item-text{
padding: 0 24rpx;
float: left;
height: 122rpx;
}
.text-title{
height: 28rpx;
font-size: 30rpx;
font-weight: 500;
line-height: 34rpx;
}
.text-content{
padding-top:64rpx;
font-size: 24rpx;
font-weight: 500;
color: #838383;
}
.collapse-item-img {
vertical-align: middle;
float: left;
width: 177rpx;
height: 122rpx;
border-radius: 4rpx;
background: #eeeeee;
}
}
/deep/ .uni-collapse-cell__title {
font-size: 32rpx;
font-family: PingFang SC;
font-weight: bold;
color: #333333;
// line-height: 13px;
}
/deep/ .uni-collapse-cell__title:active {
background-color: #FFFFFF;
}
.uni-collapse {
// height: 500px;
// background:rgba(0, 0, 0, 0);
border-radius: 12rpx;
}
.uni-collapse-cell {
border-radius: 12rpx;
border: 0;
// uni-collapse-cell
}
.uni-collapse-cell--hover,
.uni-collapse-cell--open {
background-color: #FFFFFF;
}
}
</style>
<template>
</template>
<script>
</script>
<style>
</style>
<template>
<view :style="{height:echartView.height+'px',width:echartView.width+'px'}">
<qiun-data-charts :echartsApp="echartsApp" :echartsH5="echartsH5" :type="type" :chartData="chartData"
:localdata="localdata" :eopts="option" :reload="true"/>
</view>
</template>
<script>
export default {
props: {
//图表长宽
echartView: {
type: Object,
default: () => {
return {
height: 300,
width: 350
}
}
},
//是否在APP显示
echartsApp: {
type: Boolean,
default: true
},
//是否在h5显示
echartsH5: {
type: Boolean,
default: true
},
//图表的类型
type: {
type: String,
default: 'column'
},
//图表数据
chartData: {
type: Object,
default: () => {
return {}
}
},
localdata:{
type:Array,
default:()=>[]
},
//图表样式
option:{
type:Object,
default:()=>{
return{}
}
}
},
data() {
return {
}
},
mounted() {
console.log(JSON.stringify(this.echartView))
// this.type = 'pie'
// this.option = {
// tooltip: {
// trigger: 'item'
// },
// legend: {
// top: '5%',
// left: 'center'
// },
// }
// this.chartData = {
// series: [{
// name: '访问来源',
// type: 'pie',
// radius: ['40%', '70%'],
// avoidLabelOverlap: false,
// itemStyle: {
// borderRadius: 1,
// borderColor: '#fff',
// borderWidth: 0
// },
// label: {
// show: false,
// position: 'center'
// },
// emphasis: {
// label: {
// show: true,
// fontSize: 16,
// }
// },
// labelLine: {
// show: false
// },
// data: [{
// value: 1048,
// name: '搜索引擎'
// },
// {
// value: 735,
// name: '直接访问'
// },
// {
// value: 580,
// name: '邮件营销'
// },
// {
// value: 484,
// name: '联盟广告'
// },
// {
// value: 300,
// name: '视频广告'
// }
// ]
// }]
// }
}
}
</script>
<style>
</style>
<template>
</template>
<script>
</script>
<style>
</style>
<template>
<view class="title-bar">
<image @click="returnBackFun" class="view-icon" src="../../../static/img1/fanhui2.1.png"></image>
<text class="title-bar-text">{{title}}</text>
</view>
</template>
<script>
export default{
props:{
title:{
type:String,
default:''
}
},
data(){
return{
}
},
methods:{
returnBackFun(){
this.$emit('return-back-fun')
}
}
}
</script>
<style lang="scss" scoped>
.title-bar{
padding: 0 40rpx;
line-height: 100rpx;
height: 100rpx;
.view-icon {
margin-top:-4rpx;
width: 44rpx;
height:44rpx;
vertical-align: middle;
}
.title-bar-text{
// line-height: 13rpx;
padding-left: 10rpx;
font-size:36rpx;;
color: #ffffff;
}
}
</style>
<!-- 数据页面 -->
<template>
<view>这是数据页面</view>
</template>
<script>
export default{
data(){
return{
}
},
onShow(){
// #ifdef APP-PLUS
plus.screen.lockOrientation('default'); //锁定
// #endif
},
}
</script>
<style>
</style>
<!-- 登录页面 -->
<template>
<view class="page-content" :style="{height:height}">
<!-- 这是登录页面 -->
<!-- <button type="primary" class="loginBtn" @click="loginFun">登录</button> -->
<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>
<view class="login-from">
<view class="login-user">
<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>
</view>
<view class="login-password">
<input class="uni-input login-input" v-model="password" type="text" password placeholder="请输入密码" />
<image mode="aspectFit" class="login-input-img" src="../../static/img1/mimaIcon.png"></image>
</view>
<!-- <uni-easyinput type="text" placeholder="请输入内容"></uni-easyinput>
<uni-easyinput type="password" v-model="password" placeholder="请输入密码"></uni-easyinput> -->
<button type="primary" class="login-btn" @click="loginFun">登录</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
height: '100vh',
userName: 'admin',
password: '123'
}
},
methods: {
// 登录
loginFun() {
console.log(this.$store.systemInfo)
if (!this.userName.trim()) {
this.$toast.toast('用户名不能为空')
return
}
if (!this.password.trim()) {
this.$toast.toast('密码不能为空')
return
}
uni.switchTab({
url: "/pages/monitoring/index"
})
},
//调用扫码方法
scanCodeFun() {
this.$store.dispatch('getCodeInfoFun').then(res => {
console.log(JSON.stringify(res))
uni.switchTab({
url: "/pages/monitoring/index"
})
})
}
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
}
</script>
<style lang="scss">
.page-content {
background-image: url(../../static/img1/loginbg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: center;
height: 100vh;
position: relative;
.login-sao-img {
width: 1.25rem;
height: 1.25rem;
position: absolute;
top: 3.375rem;
right: 1.4375rem;
}
.login-top-img {
position: absolute;
width: 11rem;
height: 4.7rem;
top: 10vh;
left: 50%;
margin-left: -5.5rem;
}
}
.login-input {
padding: 0 2.5rem;
}
.login-from {
position: absolute;
left: 50%;
margin-left: -9rem;
top: 45vh;
.login-user {
position: relative;
}
.login-password {
margin-top: 2.3vh;
// margin-bottom: 75rpx;
margin-bottom: 4.6vh;
position: relative;
}
.login-input-img {
width: 1.25rem;
height: 1.25rem;
position: absolute;
top: 50%; // background-color: #eeeeee;
margin-top: -0.625rem;
left: 0.85rem
}
// width: 100vh;
}
.login-btn {
width: 17.875rem;
height: 2.75rem;
background: #00B2A5 !important;
border-radius: 1.375rem;
font-size: 1rem;
font-family: PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 2.75rem;
// margin-top: 50%;
}
</style>
<!-- 消息页面 -->
<template>
<view></view>
</template>
<script>
export default{
data(){
return{
}
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
}
</script>
<style>
</style>
<!-- 监控列表页面 -->
<template>
<view class="page-view">
<view v-for="(item,index) in dataList" :key="index" style="margin-bottom: 10px;">
<collapse :data="item" @collaspe-item-fun="getMonitoringViewInfo"></collapse>
</view>
</view>
</template>
<script>
import collapse from '../components/collapse/index.vue'
export default {
components: {
collapse
},
data() {
return {
dataList:[{
title:'一楼加工厂线监控',
textList:[{
img:'../../static/img1/codelogo.png',
textTitle:'厂区布局',
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:{
onChangeFun(e){
},
//获取列表信息,data-当前折叠卡数据/item-当前点击数据/index-当前点击下标
getMonitoringViewInfo(data,item,index){
// console.log('eee')
uni.navigateTo({
url: '/pages/monitoring/monitoring-view/index?data='+JSON.stringify(item)
});
// console.log(JSON.stringify(data))
// console.log(JSON.stringify(item))
// this.$toast.toast(index.toString())
}
},
mounted() {
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
}
</script>
<style>
</style>
This diff is collapsed.
<!-- 我的用户信息页面 -->
<template>
<view>
<uni-list>
<uni-list-item title="退出" link="reLaunch" to="/pages/login/index"></uni-list-item>
<!-- <uni-list-item :disabled="true" title="列表文字" note="列表禁用状态"></uni-list-item> -->
</uni-list>
</view>
</template>
<script>
export default{
data(){
return{
}
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
}
</script>
<style>
</style>
<!-- app特有的自定义扫码页面 -->
<template>
<view style="flex: 1;">
<barcode id='1' style="flex: 1;" class="barcode" autostart="true" ref="barcode" background="rgb(0,0,0)" frameColor="#1C86EE" scanbarColor="#1C86EE" :filters="fil" @marked="success" @error="fail1"></barcode>
</view>
</template>
<script>
export default {
onLoad() {
},
data() {
return {
fil: [0, 1,2,3]
}
},
methods: {
success(e) {
this.$refs.barcode.cancel();
console.log("success1:" + JSON.stringify(e));
uni.redirectTo({
url: "/pages/login/index"
})
},
fail1(e) {
this.$refs.barcode.cancel();
console.log("fail1:" + JSON.stringify(e));
},
toStart: function() {
this.$refs.barcode.start({
conserve: true,
filename: '_doc/barcode/'
});
},
tocancel:function(){
this.$refs.barcode.cancel();
},
toFlash: function() {
this.$refs.barcode.setFlash(true);
},
toscan: function() {
console.log("scan:");
const barcodeModule = uni.requireNativePlugin('barcodeScan');
barcodeModule.scan("/static/barcode1.png"
,(e)=>{
console.log("scan_error:"+JSON.stringify(e));
});
}
},
mounted() {
this.$refs.barcode.start({
vibrate:true,
});
}
}
</script>
<style>
.barcode {
/* width: 750rpx;
height: 1024rpx; */
background-color: #808080;
}
</style>
<!-- 启动页 -->
<template>
<view class="code-content">
<!-- <image class="code-img1" mode="aspectFit" @click="scanCodeFun1" src="/static/img1/codebg.png"></image> -->
<view class="content">
<view class="content-title">
<image class="title-img" mode="aspectFill" src="/static/img1/codelogo.png"></image>
</view>
<view class="content-title2">
<view>
<text class="text1">欢迎使用盛云圈</text>
</view>
<view class="title2-text">
<text class="text2">请点击扫描工程码,绑定工程信息,进入 移动工厂吧</text>
</view>
</view>
<view class="code-img">
<!-- #ifdef APP-PLUS -->
<image class="logo" mode="aspectFill" @click="scanCodeFun" src="/static/img1/saoma.png"></image>
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<image class="logo" mode="aspectFill" @click="scanCodeFun" src="/static/img1/saoma.png"></image>
<!-- #endif -->
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
<!-- <button type="primary" @click="scanCodeFun">扫码</button> -->
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
// #ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定
// #endif
},
methods: {
scanCodeFun1() {
uni.navigateTo({
url: "/pages/scan-code/app-scan/index"
})
},
//调用扫码方法
scanCodeFun() {
this.$store.dispatch('getCodeInfoFun').then(res=>{
console.log(JSON.stringify(res))
uni.redirectTo({
url: "/pages/login/index"
})
})
// 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
},
},
onReady() {
let _this = this
uni.getSystemInfo({
success: function(res) {
_this.$store.systemInfo = JSON.stringify(res)
}
})
},
}
</script>
<style lang="scss">
page {
background-color: #ffffff;
}
.code-content{
// sposition: relative;
background-image: url(../../static/img1/codebg.png);
background-repeat: no-repeat;
background-size:100% 100%;
// width: 750rpx;
background-position:center;
height: 100vh;
}
.title-img{
height: 152rpx;
width: 349rpx;
margin-top: 14vh;
}
.content {
// position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.content-title2{
width: 574rpx;
text-align: left;
margin-top: 9.3vh;
.title2-text{
margin-top: 33rpx;
}
.text1{
font-size: 40rpx;
font-family: PingFang SC;
font-weight: bold;
}
.text2{
font-size: 32rpx;
font-family: PingFang-SC-Medium;
font-weight: Medium;
}
}
.code-img {
margin-top: 22vh;
margin-left: auto;
margin-right: auto;
}
.logo {
height: 147rpx;
width: 147rpx;
}
.text-area {
padding-top: 35rpx;
display: flex;
justify-content: center;
}
.title {
font-size: 30rpx;
font-family: PingFang SC;
font-weight: 500;
color: #3F81FF;
}
</style>
<!-- 工作页面 -->
<template>
<view></view>
</template>
<script>
export default{
data(){
return{
}
},
onLoad() {
// console.log('App Launch'),
// #ifdef APP-PLUS
plus.screen.lockOrientation('landscape-primary'); //锁定
// #endif
},
}
</script>
<style>
</style>
// api接口
import api from "./request.js"
export default {
// 密码登录
passwordLogin(params) {
return api.baseRequest("/platform/metadata/logon", "GET", params)
},
}
// 全局请求封装
const token = '自己的token令牌,最好读取缓存中的'
// const token = uni.getStorage('token')
const apiUrl = 'https://v1.shopapi.tpfeps.com'
// url-api路径/method-请求类型/data-请求参数
const baseRequest = (url, method, data) => {
//请求拦截
uni.showLoading({
title: "加载中"
});
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({
url: apiUrl + url,
data: data,
method: method,
header: {
'token': token
}
success(res) {
//响应成功拦截
resolve(res)
},
fail(err) {
//响应失败拦截
reject(err)
},
complete(res) {
//请求完成拦截
uni.hideLoading()
}
})
});
}
export default {
baseRequest
}
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex); //vue的插件机制
//Vuex.Store 构造器选项
const store = new Vuex.Store({
state: { //存放状态
systemInfo: '', //系统信息
userInfo: '', //用户信息
},
actions: {
//扫码获取信息
getCodeInfoFun({
commit
}) {
return new Promise((resolve, reject) => {
// #ifdef APP-PLUS
uni.scanCode({
// onlyFromCamera: true,
scanType: ['qrCode', 'barCode'],
success: function(res) {
resolve(res)
},
complete: function(res) {
uni.hideLoading();
},
fail: function(res) {
reject(res)
console.log('失败条码类型:' + res.scanType);
}
});
// uni.redirectTo({
// url: "/pages/login/index"
// })
// #endif
// #ifndef APP-PLUS || APP-NVUE
uni.redirectTo({
url: "/pages/login/index"
})
// #endif
})
}
}
})
export default store
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
$uni-color-primary: #007aff;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 文字基本颜色 */
$uni-text-color:#333;//基本色
$uni-text-color-inverse:#fff;//反色
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0;
/* 背景颜色 */
$uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
/* 边框颜色 */
$uni-border-color:#c8c7cc;
/* 尺寸变量 */
/* 文字尺寸 */
$uni-font-size-sm:24rpx;
$uni-font-size-base:28rpx;
$uni-font-size-lg:32rpx;
/* 图片尺寸 */
$uni-img-size-sm:40rpx;
$uni-img-size-base:52rpx;
$uni-img-size-lg:80rpx;
/* Border Radius */
$uni-border-radius-sm: 4rpx;
$uni-border-radius-base: 6rpx;
$uni-border-radius-lg: 12rpx;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 20rpx;
$uni-spacing-row-lg: 30rpx;
/* 垂直间距 */
$uni-spacing-col-sm: 8rpx;
$uni-spacing-col-base: 16rpx;
$uni-spacing-col-lg: 24rpx;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:40rpx;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:36rpx;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:30rpx;
\ No newline at end of file
## 0.3.0(2021-06-14)
- fix: 修复 头条系小程序 2d 报 JSON.stringify 的问题
- 目前 头条系小程序 2d 无法在开发工具上预览,划动图表页面无法滚动,axisLabel 字体颜色无法更改,建议使用非2d。
## 0.2.9(2021-06-06)
- fix: 修复 头条系小程序 2d 放大的BUG
- 头条系小程序 2d 无法在开发工具上预览,也存在划动图表页面无法滚动的问题。
## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
## 0.2.8(2021-05-19)
- fix: 修复 微信小程序 PC 显示过大的问题
## 0.2.7(2021-05-19)
- fix: 修复 微信小程序 PC 不显示问题
## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
## 0.2.6(2021-05-14)
- feat: 支持 `image`
- feat: props 增加 `ec.clear`,更新时是否先删除图表样式
- feat: props 增加 `isDisableScroll` ,触摸图表时是否禁止页面滚动
- feat: props 增加 `webviewStyles` ,webview 的样式, 仅nvue有效
## 0.2.5(2021-05-13)
- docs: 插件用到了css 预编译器 [stylus](https://ext.dcloud.net.cn/plugin?name=compile-stylus) 请安装它
## 0.2.4(2021-05-12)
- fix: 修复 百度平台 多个图表ctx 和 渐变色 bug
- ## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
## 0.2.3(2021-05-10)
- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片
```js
this.$refs.chart.canvasToTempFilePath({success: (res) => {
console.log('tempFilePath:', res.tempFilePath)
}})
```
## 0.2.2(2021-05-10)
- feat: 增加 `dispose` 方法,用于销毁实例
- feat: 增加 `isClickable` 是否派发点击
- feat: 实验性的支持 `nvue` 使用要慎重考虑
- ## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
## 0.2.1(2021-05-06)
- fix:修复 微信小程序 json 报错
- chore: `reset` 更改为 `setChart`
- feat: 增加 `isEnable` 开启初始化 启用这个后 无须再使用`init`方法
```html
<l-echart ref="chart" is-enable />
```
```js
// 显示加载
this.$refs.chart.showLoading()
// 使用实例回调
this.$refs.chart.setChart(chart => ...code)
// 直接设置图表配置
this.$refs.chart.setOption(data)
```
## 0.2.0(2021-05-05)
- fix:修复 头条 百度 偏移的问题
- docs: 更新文档
## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
## 0.1.0(2021-05-02)
- chore: 第一次上传,基本全端兼容,使用方法与官网一致。
- 已知BUG:非2d 无法使用背景色,已反馈官方
- 已知BUG:头条 百度 有许些偏移
- 后期计划:兼容nvue
const cacheChart = {}
class Image {
constructor() {
// __zr.dom
this.currentSrc = null
this.naturalHeight = 0
this.naturalWidth = 0
this.width = 0
this.height = 0
this.tagName = 'IMG'
}
set src(src) {
this.currentSrc = src
uni.getImageInfo({
src,
success: (res) => {
this.naturalWidth = this.width = res.width
this.naturalHeight = this.height = res.height
this.onload()
},
fail: () => {
this.onerror()
}
})
}
get src() {
return this.currentSrc
}
}
export default class Canvas {
constructor(ctx, canvasId, isNew, canvasNode) {
cacheChart[canvasId] = {ctx}
this.canvasId = canvasId;
this.chart = null;
this.isNew = isNew
if (isNew) {
this.canvasNode = canvasNode;
} else {
this.canvasNode = {
createImage: () => {
return new Image()
}
};
this._initStyle(ctx);
}
this._initEvent();
}
getContext(contextType) {
if (contextType === '2d') {
return this.ctx;
}
}
setChart(chart) {
this.chart = chart;
}
attachEvent(e) {}
detachEvent() {}
addEventListener() {}
removeEventListener() {}
_initCanvas(zrender, ctx) {
zrender.util.getContext = function() {
return ctx;
};
zrender.util.$override('measureText', function(text, font) {
ctx.font = font || '12px sans-serif';
return ctx.measureText(text, font);
});
}
strLen(str) {
let len = 0;
for (let i = 0; i < str.length; i++) {
if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
len++;
} else {
len += 2;
}
}
return len;
}
_initStyle(ctx) {
var styles = [
'fillStyle',
'strokeStyle',
'fontSize',
'globalAlpha',
'opacity',
'textAlign',
'textBaseline',
'shadow',
'lineWidth',
'lineCap',
'lineJoin',
'lineDash',
'miterLimit',
// #ifdef MP-TOUTIAO
'font'
// #endif
];
const fontSizeReg = /([\d\.]+)px/;
const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g;
styles.forEach(style => {
Object.defineProperty(ctx, style, {
set: value => {
if (style === 'font' && fontSizeReg.test(value)) {
const match = fontSizeReg.exec(value);
ctx.setFontSize(match[1]);
return;
}
if (style === 'opacity') {
ctx.setGlobalAlpha(value)
return;
}
if (style !== 'fillStyle' && style !== 'strokeStyle' || value !== 'none' && value !== null) {
// #ifdef H5 || APP-PLUS || MP-BAIDU
if(typeof value == 'object') {
if (value.hasOwnProperty('colorStop') || value.hasOwnProperty('colors')) {
ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
}
return
}
// #endif
// #ifdef MP-TOUTIAO
if(colorReg.test(value)) {
value = value.replace(colorReg, '#$1$1$2$2$3$3')
}
// #endif
ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
}
}
});
});
if(!this.isNew) {
ctx.uniDrawImage = ctx.drawImage
ctx.drawImage = (...a) => {
a[0] = a[0].src
ctx.uniDrawImage(...a)
}
}
ctx.createRadialGradient = () => {
return ctx.createCircularGradient(arguments);
};
// 字节不支持
if (!ctx.strokeText) {
ctx.strokeText = (...a) => {
ctx.fillText(...a)
}
}
// 钉钉不支持
if (!ctx.measureText) {
ctx.measureText = (text, font) => {
let fontSize = 12;
if (font) {
fontSize = parseInt(font.match(/([\d\.]+)px/)[1])
}
fontSize /= 2;
return {
width: this.strLen(text) * fontSize
};
}
}
}
_initEvent() {
this.event = {};
const eventNames = [{
wxName: 'touchStart',
ecName: 'mousedown'
}, {
wxName: 'touchMove',
ecName: 'mousemove'
}, {
wxName: 'touchEnd',
ecName: 'mouseup'
}, {
wxName: 'touchEnd',
ecName: 'click'
}];
eventNames.forEach(name => {
this.event[name.wxName] = e => {
const touch = e.touches[0];
this.chart.getZr().handler.dispatch(name.ecName, {
zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
zrY: name.wxName === 'tap' ? touch.clientY : touch.y
});
};
});
}
set width(w) {
if (this.canvasNode) this.canvasNode.width = w
}
set height(h) {
if (this.canvasNode) this.canvasNode.height = h
}
get width() {
if (this.canvasNode)
return this.canvasNode.width
return 0
}
get height() {
if (this.canvasNode)
return this.canvasNode.height
return 0
}
get ctx() {
return cacheChart[this.canvasId]['ctx'] || null
}
set chart(chart) {
cacheChart[this.canvasId]['chart'] = chart
}
get chart() {
return cacheChart[this.canvasId]['chart'] || null
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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