
{
"pages": [
"project/project"
],
"window": {
"navigationBarBackgroundColor": "#4b0963",
"navigationBarTitleText": "wasdylb",
"navigationBarTextStyle": "white"
},
"sitemapLocation": "sitemap.json"
}import bleComm from '../utils/bleComm.js';
import common from '../utils/common.js';
Page({
onUnload: function () {
bleComm.disConnect();
},
onHide: function () {
bleComm.disConnect();
},
onLoad: function () {
// wx.showLoading({
// title: '靠近连接',
// mask: true
// })
// bleComm.connectDevice().then(res => {
// wx.showToast({
// title: '蓝牙连接成功',
// icon: 'success',
// duration: 300
// })
// });
},
})

<template name="projectItem">
<view class="item" bindtap="listClick" id="{{index}}" >
<image class="poster" src="{{logo}}" />
<view class="meta">
<text class="title">{{title}}</text>
<text class="sub-title">{{description}}</text>
<text class="artists">{{device}}</text>
</view>
</view>
</template>data: {
LED: {
index: 0,
title: 'ON/OFF',
description: '点亮/关闭一盏灯',
device: 'Core mBattery BLE ColorLED',
logo: '../images/led.png'
},
},<template is="projectItem" data="{{...LED}}"/>
<view class='image-H'>
<image class='userinfo-avatar' src='../images/ylb.jpg'></image>
</view>{
"pages": [
"project/project",
"bleLED/bleled",
"finger/finger",
"shock/shock",
"angle/angle",
"slider/slider",
"light/light",
"penetrate/penetrate",
"matrix/matrix"
],
"window": {
"navigationBarBackgroundColor": "#4b0963",
"navigationBarTitleText": "wasdylb",
"navigationBarTextStyle": "white"
},
"sitemapLocation": "sitemap.json"
}listClick: function (event) {
var p = event.currentTarget.id
console.log(p);
wx.navigateTo({ url: nextpage[parseInt(p)] })
}import bleComm from '../utils/bleComm.js';
import common from '../utils/common.js';
var nextpage = [
'../bleLED/bleled',
"../finger/finger",
"../shock/shock",
"../angle/angle",
"../slider/slider",
"../light/light",
"../penetrate/penetrate",
"../matrix/matrix"
];
Page({
data: {
LED: {
index: 0,
title: 'ON/OFF',
description: '点亮/关闭一盏灯',
device: 'Core mBattery BLE ColorLED',
logo: '../images/led.png'
},
finger:
{
index: 1,
title: 'Finger',
description: '蓝牙与手机通讯-指纹开灯',
device: 'Core mBattery BLE ColorLED',
logo: '../images/finger.png'
},
shock:
{
index: 2,
title: 'Shock',
description: '蓝牙与手机通讯-摇一摇开灯',
device: 'Core mBattery BLE ColorLED',
logo: '../images/shake.png'
},
angle:
{
index: 3,
title: 'Motion',
description: '蓝牙与手机通讯-抬起开灯',
device: 'Core mBattery BLE ColorLED',
logo: '../images/angle.png'
},
slider:
{
index: 4,
title: 'Slider',
description: '蓝牙与手机通讯-亮度、角度',
device: 'Core mBattery BLE ColorLED Servo',
logo: '../images/servo.png'
},
light:
{
index: 5,
title: 'Light',
description: 'Sensor-Light控制手机屏幕亮度',
device: 'Core mBattery BLE Sensor-Light',
logo: '../images/light.png'
},
penetrate:
{
index: 6,
title: 'Penetrate',
description: '蓝牙与手机通讯-发送接收字符串',
device: 'Core mBattery BLE',
logo: '../images/String.png'
},
matrix:
{
index: 7,
title: 'Matrix',
description: '蓝牙与手机通讯控制8*8彩色点阵画图',
device: 'Core mBattery BLE Matrix',
logo: '../images/matrix.png'
},
},
onUnload: function () {
bleComm.disConnect();
},
onHide: function () {
bleComm.disConnect();
},
onLoad: function () {
},
listClick: function (event) {
var p = event.currentTarget.id
console.log(p);
wx.navigateTo({ url: nextpage[parseInt(p)] })
}
})<!--logs.wxml-->
<template name="projectItem">
<view class="item" bindtap="listClick" id="{{index}}" >
<image class="poster" src="{{logo}}" />
<view class="meta">
<text class="title">{{title}}</text>
<text class="sub-title">{{description}}</text>
<text class="artists">{{device}}</text>
</view>
</view>
</template>
<template is="projectItem" data="{{...LED}}"/>
<template is="projectItem" data="{{...finger}}"/>
<template is="projectItem" data="{{...shock}}"/>
<template is="projectItem" data="{{...angle}}"/>
<template is="projectItem" data="{{...slider}}"/>
<template is="projectItem" data="{{...light}}"/>
<template is="projectItem" data="{{...penetrate}}"/>
<template is="projectItem" data="{{...matrix}}"/>/**index.wxss**/
.item {
display: flex;
padding: 20rpx 40rpx;
border-bottom: 1rpx solid #eee;
cursor: pointer;
}
.poster {
width: 126rpx;
height: 126rpx;
margin-right: 55rpx;
margin-top: 5px;
}
.meta {
flex: 1;
}
.sub-title {
display: block;
margin-bottom: 15rpx;
}
.title {
font-size: 32rpx;
color: #4b0963;
}
.sub-title {
font-size: 22rpx;
color: #c0c0c0;
margin-top: 5rpx;
}
.artists {
font-size: 24rpx;
color: #999;
}
.rating text{
display: inline-block;
width: 40rpx;
font-size: 28rpx;
font-weight: bold;
text-align: center;
background-color: rgba(75, 9, 99, 0.8);
color: #fff;
padding: 10rpx;
border-radius: 20rpx;
}
END
杨立斌
美科
解惑
创建时间:2017/12/22
32小程序大主题