作者 lihongjuan

123

正在显示 72 个修改的文件 包含 1215 行增加0 行删除
//app.js
App({
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null
}
})
\ No newline at end of file
... ...
{
"pages": [
"pages/login/login",
"pages/changqu/changqu",
"pages/shebei/shebeilist/shebeilist",
"pages/mine/mine",
"pages/index/index",
"pages/logs/logs",
"pages/qiye/qiye",
"pages/yujing/yujing",
"pages/shebei/shebeidetail/shebeidetail"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "",
"navigationBarTextStyle": "black"
},
"tabBar": {
"selectedColor": "#FF8839",
"list": [
{
"pagePath": "pages/changqu/changqu",
"text": "厂区",
"selectedColor": "#FF9400",
"iconPath": "img/demo (10).png",
"selectedIconPath": "img/demo (17).png"
},
{
"pagePath": "pages/qiye/qiye",
"text": "企业",
"selectedColor": "#FF9400",
"iconPath": "img/demo (11).png",
"selectedIconPath": "img/demo (16).png"
},
{
"pagePath": "pages/yujing/yujing",
"text": "预警",
"selectedColor": "#FF9400",
"iconPath": "img/demo (12).png",
"selectedIconPath": "img/demo (15).png"
},
{
"pagePath": "pages/mine/mine",
"text": "我的",
"selectedColor": "#FF9400",
"iconPath": "img/demo (13).png",
"selectedIconPath": "img/demo (14).png"
}
]
},
"sitemapLocation": "sitemap.json"
}
\ No newline at end of file
... ...
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
image{
width:100%;
height:100%;
}
.rowimg{
width:23rpx;
height:23rpx;
font-size: 0
}
\ No newline at end of file
... ...
// pages/changqu/changqu.js
Page({
/**
* 页面的初始数据
*/
data: {
markers: [{
iconPath: "",
id: 0,
latitude: 23.099994,
longitude: 113.324520,
width: 50,
height: 50
}],
polyline: [{
points: [{
longitude: 113.3245211,
latitude: 23.10229
}, {
longitude: 113.324520,
latitude: 23.21229
}],
color: "#FF0000DD",
width: 2,
dottedLine: true
}],
controls: [{
id: 1,
iconPath: '',
position: {
left: 0,
top: 300 - 50,
width: 50,
height: 50
},
clickable: true
}]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
regionchange(e) {
console.log(e.type)
},
markertap(e) {
console.log(e.markerId)
},
controltap(e) {
console.log(e.controlId)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="mapbox">
<view class="search">
<view class="searchimg">
<image src="img/demo (10).png"></image>
</view>
<view class="searchinput">
<input placeholder='湖南' placeholder-class='searchword'/>
</view>
</view>
<map id="map" longitude="113.324520" latitude="23.099994" scale="14" controls="{{controls}}" bindcontroltap="controltap" markers="{{markers}}" bindmarkertap="markertap" polyline="{{polyline}}" bindregionchange="regionchange" show-location style="width: 100%;height:100% "></map>
</view>
\ No newline at end of file
... ...
page {
height: 100%;
}
.mapbox {
height: 100%;
position: relative;
}
#map {
height: 100%;
}
.search {
width: 690rpx;
height: 90rpx;
background: rgba(255, 255, 255, 1);
opacity: 1;
border-radius: 10rpx;
display: flex;
align-items: center;
position: fixed;
top: 29rpx;
left: 37rpx;
z-index: 999;
padding: 24rpx 30rpx;
box-sizing: border-box;
}
.searchimg {
width: 41rpx;
height: 41rpx;
font-size: 0;
}
.searchinput {
margin-left: 66rpx;
height: 40rpx;
width: 550rpx;
color: #666666ff;
font-size: 28rpx;
}
.searchword {
color: #666666ff;
font-size: 28rpx;
}
... ...
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
hasUserInfo: true
})
} else if (this.data.canIUse){
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
app.userInfoReadyCallback = res => {
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
} else {
// 在没有 open-type=getUserInfo 版本的兼容处理
wx.getUserInfo({
success: res => {
app.globalData.userInfo = res.userInfo
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
}
},
getUserInfo: function(e) {
console.log(e)
app.globalData.userInfo = e.detail.userInfo
this.setData({
userInfo: e.detail.userInfo,
hasUserInfo: true
})
}
})
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>
... ...
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}
.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}
.userinfo-nickname {
color: #aaa;
}
.usermotto {
margin-top: 200px;
}
\ No newline at end of file
... ...
// pages/login/login.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<view class="page">
<view class="ganzhi">
<image src="/img/logo3.png"></image>
<view class="zhineng">
<text>感</text>
<text>知</text>
<text>制</text>
<text>能</text>
</view>
</view>
<view class="nameuser">
<view class="username ">
<view class="userleft">
<image src="/img/ico_username.png"></image>
</view>
<view class="entername">
<input placeholder='请输入用户姓名' placeholder-class='name' />
</view>
</view>
<view class="username pass">
<view class="userleft">
<image src="/img/ico_password.png"></image>
</view>
<view class="entername">
<input placeholder='请输入密码' type="password" placeholder-class='name' />
</view>
</view>
</view>
<view class="loginimg">
<image src="/img/login.png"></image>
<view class="denglu">登录</view>
</view>
</view>
\ No newline at end of file
... ...
page{
background: #ED9527
}
.page{
overflow: hidden;
}
.ganzhi{
width:605rpx;
height:605rpx;
font-size: 0;
margin: 0 auto ;
position: relative
}
.zhineng{
font-size: 44rpx;
position: absolute;
bottom:50rpx;
color:#fff;
text-align: center;
left:210rpx;
z-index: 99
}
.zhineng text{
margin-right:6rpx;
}
.username{
display:flex;
align-items: center;
width:600rpx;
height:80rpx;
margin:0 auto;
}
.userleft{
width:40rpx;
height:40rpx;
font-size: 0
}
.userleft image{
width:100%;
height:100%;
}
.entername{
width:530rpx;
height:72rpx;
background: #fff;
border-radius: 15rpx;
margin-left:30rpx;
color:#C5C5C5;
font-size: 35rpx;
}
.entername input{
width:530rpx;
height:72rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.name{
color:#C5C5C5;
font-size: 35rpx;
}
.pass{
margin-top:30rpx;
}
.nameuser{
margin-top:80rpx;
}
.loginimg{
width:320rpx;
height:90rpx;
margin:85rpx auto 0;
position: relative
}
.denglu{
position: absolute;
color:#fff;
font-size: 42rpx;
left:120rpx;
top:15rpx
}
\ No newline at end of file
... ...
//logs.js
const util = require('../../utils/util.js')
Page({
data: {
logs: []
},
onLoad: function () {
this.setData({
logs: (wx.getStorageSync('logs') || []).map(log => {
return util.formatTime(new Date(log))
})
})
}
})
... ...
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log}}</text>
</block>
</view>
... ...
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}
... ...
// pages/mine/mine.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/mine/mine.wxml-->
<text>pages/mine/mine.wxml</text>
... ...
/* pages/mine/mine.wxss */
\ No newline at end of file
... ...
// pages/qiye/qiye.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/qiye/qiye.wxml-->
<text>pages/qiye/qiye.wxml</text>
... ...
/* pages/qiye/qiye.wxss */
\ No newline at end of file
... ...
// pages/shebei/shebeidetail/shebeidetail.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "设备详情"
}
\ No newline at end of file
... ...
<!--pages/shebei/shebeidetail/shebeidetail.wxml-->
<text>pages/shebei/shebeidetail/shebeidetail.wxml</text>
... ...
/* pages/shebei/shebeidetail/shebeidetail.wxss */
\ No newline at end of file
... ...
// pages/shebei/shebeilist/shebeilist.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"navigationBarTitleText": "设备运行"
}
\ No newline at end of file
... ...
<view class="shebeinum"><text class="she">设备数量:</text>
<text class="num"> 3</text> </view>
<view class="shebelist">
<view class="shebielistitem">
<view class="car">
<view class="cartop">1车间:胶合机胶合机胶合机胶合机</view>
<view class="carbottom">运行中</view>
</view>
<view class="day">
<view class="daytop">27.5</view>
<view class="daybottom">昨日(小时)</view>
</view>
<view class="month">
<view class="monthtop">27.5</view>
<view class="monthbottom">上月(小时)</view>
</view>
<view class="rowimg">
<image src="img/demo (24).png"></image>
</view>
</view>
<view class="shebielistitem">
<view class="car">
<view class="cartop">1车间:胶合机胶合机胶合机胶合机</view>
<view class="carbottom yun">运行中</view>
</view>
<view class="day">
<view class="daytop">27.5</view>
<view class="daybottom">昨日(小时)</view>
</view>
<view class="month">
<view class="monthtop">27.5</view>
<view class="monthbottom">上月(小时)</view>
</view>
<view class="rowimg">
<image src="img/demo (24).png"></image>
</view>
</view>
<view class="shebielistitem">
<view class="car">
<view class="cartop">1车间:胶合机胶合机胶合机胶合机</view>
<view class="carbottom yun">运行中</view>
</view>
<view class="day">
<view class="daytop">27.5</view>
<view class="daybottom">昨日(小时)</view>
</view>
<view class="month">
<view class="monthtop">27.5</view>
<view class="monthbottom">上月(小时)</view>
</view>
<view class="rowimg">
<image src="img/demo (24).png"></image>
</view>
</view>
<view class="shebielistitem">
<view class="car">
<view class="cartop">1车间:胶合机胶合机胶合机胶合机</view>
<view class="carbottom yun">运行中</view>
</view>
<view class="day">
<view class="daytop">27.5</view>
<view class="daybottom">昨日(小时)</view>
</view>
<view class="month">
<view class="monthtop">27.5</view>
<view class="monthbottom">上月(小时)</view>
</view>
<view class="rowimg">
<image src="img/demo (24).png"></image>
</view>
</view>
<view class="shebielistitem">
<view class="car">
<view class="cartop">1车间:胶合机胶合机胶合机胶合机</view>
<view class="carbottom noyun">未运行</view>
</view>
<view class="day">
<view class="daytop">27.5</view>
<view class="daybottom">昨日(小时)</view>
</view>
<view class="month">
<view class="monthtop">27.5</view>
<view class="monthbottom">上月(小时)</view>
</view>
<view class="rowimg">
<image src="img/demo (24).png"></image>
</view>
</view>
</view>
\ No newline at end of file
... ...
page {
background: #fff;
}
.shebeinum {
color: #333;
font-size: 32rpx;
font-weight: bold;
padding: 30rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #f5f5f5;
border-top: 1rpx solid #f5f5f5;
position: relative;
}
.she{
margin-left:18rpx;
}
.shebeinum::before{
content:'';
display:block;
width:8rpx;
height:33rpx;
background: #FF9400FF;
position: absolute;
top:33rpx;
left:30rpx;
}
.num {
margin-left: 10rpx;
}
.shebelist {
padding: 30rpx;
box-sizing: border-box;
}
.shebielistitem {
width: 690rpx;
height: 138rpx;
border: 1rpx solid #f5f5f5;
border-radius: 10rpx;
display: flex;
align-items: center;
justify-content: space-around;
}
.cartop {
width: 236rpx;
font-size: 28rpx;
color: #333;
font-weight: bold;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.carbottom {
font-size: 20rpx;
margin-top: 10rpx;
}
.yun {
color: #eb483aff;
}
.noyun {
color: #538aeeff;
}
.daytop {
color: #333333ff;
font-size: 28rpx;
}
.daybottom {
color: #666666ff;
font-size: 20rpx;
margin-top: 10rpx;
}
.monthtop {
color: #333333ff;
font-size: 28rpx;
}
.monthbottom {
color: #666666ff;
font-size: 20rpx;
margin-top: 10rpx;
}
... ...
// pages/yujing/yujing.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
... ...
{
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--pages/yujing/yujing.wxml-->
<text>pages/yujing/yujing.wxml</text>
... ...
/* pages/yujing/yujing.wxss */
\ No newline at end of file
... ...
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"autoAudits": false
},
"compileType": "miniprogram",
"libVersion": "2.8.0",
"appid": "wx1f51f42105b63343",
"projectname": "APPUI",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
\ No newline at end of file
... ...
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
\ No newline at end of file
... ...
const formatTime = date => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : '0' + n
}
module.exports = {
formatTime: formatTime
}
... ...