甘雨绑十字架_五月天婷亚洲天综合网手机_国产成人年无码av片在线观看_亚洲艳妇自拍视频_51国产日韩欧美_樱桃视频app带你看世界_欧美成人综合网播九公社_精品人妻无码一区二区色欲AⅤ_啪啪免费无码高清_最新熟女倶楽部4566

微信小程序開發(fā)工具模塊化開發(fā)(微信小程序開發(fā)工具軟件)

小程序開發(fā) 3190
本篇文章給大家談?wù)勎⑿判〕绦蜷_發(fā)工具模塊化開發(fā),以及微信小程序開發(fā)工具軟件對應(yīng)的知識點,希望對各位有所幫助,不要忘了收藏本站喔。 本文目錄一覽: 1、微信小程序藍(lán)牙模塊開發(fā)

本篇文章給大家談?wù)勎⑿判〕绦蜷_發(fā)工具模塊化開發(fā),以及微信小程序開發(fā)工具軟件對應(yīng)的知識點,希望對各位有所幫助,不要忘了收藏本站喔。

本文目錄一覽:

微信小程序藍(lán)牙模塊開發(fā)

//index.js

//獲取應(yīng)用實例

const app = getApp()

const util = require('../../utils/util.js')

const bletool = require('../../utils/bletool.js')

Page({

data: {

// lists: [{ 'order_no': '1111', 'car_no': '321', 'car_type': '尚好捷', 'order_date': '2018-01-02 08:00', 'order_money': '16.00', 'order_time': '4' }],

car_no: '',

order_no: '',

lists: [],

bleList: [], //藍(lán)牙設(shè)備數(shù)組

serviceId: '',//592B3370-3900-9A71-4535-35D4212D2837

serviceMac: '',//C9:9B:4C:E7:DE:10

service_psd: '',//855525B837253705595800000329

service_uuid: '',

deviceId:'',

characteristics:[] //特征值

},

onLoad: function (options) {

this.initBle();

},

onReady: function () {

// 頁面渲染完成

},

onShow: function () {

if (app.globalData.car_no.length0){

this.getDeviceInfo();

}

},

onHide: function () {

// 頁面隱藏

},

onUnload: function () {

// 頁面關(guān)閉

app.globalData.car_no=''

},

//藍(lán)牙相關(guān)

//初始化藍(lán)牙

initBle: function () {

var that = this;

wx.onBluetoothAdapterStateChange(function (res) {

console.log('adapterState changed, now is', res)

app.globalData.ble_state = res.available;

if (res.available) {

that.initBle();

} else {

util.showToast('手機(jī)藍(lán)牙已關(guān)閉');

app.globalData.ble_isonnectting = false;

}

})

//打開藍(lán)牙適配器

wx.openBluetoothAdapter({

success: function (res) {

console.log('打開藍(lán)牙適配器成功');

that.getBluetoothAdapterState();

app.globalData.ble_state = true;

that.onBluetoothDeviceFound();

},

fail: function (res) {

// fail

console.log(res)

util.showToast('請打開手機(jī)藍(lán)牙');

},

complete: function (res) {

// complete

}

})

},

onBluetoothDeviceFound:function(){

var that = this;

//監(jiān)聽掃描

wx.onBluetoothDeviceFound(function (res) {

// res電腦模擬器返回的為數(shù)組;手機(jī)返回的為藍(lán)牙設(shè)備對象

console.log('監(jiān)聽搜索新設(shè)備:', res);

that.updateBleList([res])

})

},

getBluetoothAdapterState: function () {

var that = this;

wx.getBluetoothAdapterState({

success: function (res) {

var available = res.available;

var discovering = res.discovering;

if (!available) {

util.showToast('藍(lán)牙不可用');

} else {

if (!discovering) {

// that.startBluetoothDevicesDiscovery();

}

}

}

})

},

startBluetoothDevicesDiscovery: function () {

var that = this;

var services = [];

services.push(this.data.serviceId);

wx.showLoading({

title: '設(shè)備搜索中'

});

setTimeout(function () {

wx.hideLoading();

if (app.globalData.deviceId.length==0){

util.showModal('設(shè)備搜索失敗,請重試');

}

}, 10000)

if(bletool.isIOS()){

wx.startBluetoothDevicesDiscovery({

services: services,

allowDuplicatesKey: true,

success: function (res) {

console.log('ios搜索成功');

console.log(res);

},

fail: function (err) {

console.log(err);

}

});

}else{

wx.startBluetoothDevicesDiscovery({

// services: services,

allowDuplicatesKey: true,

success: function (res) {

console.log('Android搜索成功');

console.log(res);

},

fail: function (err) {

console.log(err);

wx.hideLoading();

that.startBluetoothDevicesDiscovery();

// that.getBluetoothAdapterState();

util.showToast('搜索失敗');

}

});

}

},

startConnectDevices: function (ltype, array) {

var that = this;

clearTimeout(that.getConnectedTimer);

that.getConnectedTimer = null;

wx.stopBluetoothDevicesDiscovery({

success: function (res) {

// success

}

})

app.globalData.ble_isonnectting = true;

console.log('連接前:'+that.deviceId);

wx.createBLEConnection({

deviceId: that.deviceId,

success: function (res) {

if (res.errCode == 0) {

console.log('連接成功:');

that.getService(that.deviceId);

}

},

fail: function (err) {

console.log('連接失?。?, err);

wx.hideLoading();

util.showModal('設(shè)備連接失敗,請重試');

// if (ltype == 'loop') {

// that.connectDeviceIndex += 1;

// that.loopConnect(array);

// } else {

// that.startBluetoothDevicesDiscovery();

// that.getConnectedBluetoothDevices();

// }

app.globalData.ble_isonnectting = false;

},

complete: function () {

}

});

},

getService: function (deviceId) {

var that = this;

// 監(jiān)聽藍(lán)牙連接

wx.onBLEConnectionStateChange(function (res) {

console.log(res);

app.globalData.ble_isonnectting = res.connected

if (!res.connected) {

util.showToast('連接斷開');

}

});

// 獲取藍(lán)牙設(shè)備service值

wx.getBLEDeviceServices({

deviceId: deviceId,

success: function (res) {

console.log('獲取藍(lán)牙設(shè)備service值');

console.log(res);

that.getCharacter(deviceId, res.services);

}

})

},

getCharacter: function (deviceId, services) {

var that = this;

services.forEach(function (value, index, array) {

if (value.isPrimary) {

that.setData({

service_uuid: value.uuid,

deviceId: deviceId

})

app.globalData.service_uuid= value.uuid;

app.globalData.deviceId=deviceId;

}

});

//監(jiān)聽通知

wx.onBLECharacteristicValueChange(function (res) {

// callback

console.log('value change', res)

const hex = bletool.buf2char(res.value)

console.log('返回的數(shù)據(jù):', hex)

//配對密碼

if (hex.indexOf('855800000106') != -1) {

wx.hideLoading();

var charact_write = that.data.characteristics[1]

bletool.writeDataToDevice(that.data.deviceId, that.data.service_uuid, charact_write, that.data.service_psd);

wx.showToast({

title: '設(shè)備已連接',

icon: 'success',

duration: 3000

})

setTimeout(function () {

bletool.writeDataToDevice(that.data.deviceId, that.data.service_uuid, charact_write, '235525B837253705590400000273');

}, 2000)

} else if (hex.indexOf('23040000') != -1) {

//啟動成功

that.starRenting();

}

})

wx.getBLEDeviceCharacteristics({

deviceId: deviceId,

serviceId: that.getServiceUUID(),

success: function (res) {

wx.getBLEDeviceCharacteristics({

deviceId: deviceId,

serviceId: that.getServiceUUID(),

success: function (res) {

console.log('特征', res)

that.setData({

characteristics:res.characteristics

})

app.globalData.characteristics = res.characteristics;

var charact_read = res.characteristics[0]

},

loopConnect: function (devicesId) {

var that = this;

var listLen = devicesId.length;

if (devicesId[this.connectDeviceIndex]) {

this.deviceId = devicesId[this.connectDeviceIndex];

this.startConnectDevices('loop', devicesId);

} else {

console.log('已配對的設(shè)備小程序藍(lán)牙連接失敗');

that.startBluetoothDevicesDiscovery();

that.getConnectedBluetoothDevices();

}

},

//更新數(shù)據(jù) devices為數(shù)組類型

updateBleList: function (devices) {

console.log('設(shè)備數(shù)據(jù):',devices);

var newData = this.data.bleList

var that = this

var tempDevice = null;

for (var i = 0; i devices.length; i++) {

//ios設(shè)備

if (devices[i].devices != null) {

if (devices[i].devices.length 0) {

tempDevice = devices[i].devices[0];

}

else {

continue

}

}

//安卓

else {

tempDevice = devices[i];

}

if (!this.isExist(tempDevice)) {

newData.push(tempDevice)

}

}

console.log('數(shù)據(jù):');

console.log(newData)

this.setData({

bleList: newData

})

if (!app.globalData.ble_isonnectting) {

var that = this;

this.data.bleList.forEach(function (value, index, array) {

//找到對應(yīng)id的設(shè)備,ios判斷服務(wù)id安卓判斷mac地址

var deviceId = value['deviceId'];

if(bletool.isIOS()){

let advertisServiceUUID = value['advertisServiceUUIDs'][0];

if (advertisServiceUUID == that.data.serviceId.toUpperCase()){

that.deviceId = deviceId;

console.log(that.deviceId);

that.startConnectDevices();

}

}else{

if (deviceId == that.data.serviceMac) {

that.deviceId = deviceId;

console.log(that.deviceId);

that.startConnectDevices();

}

}

});

}

},

//是否已存在 存在返回true 否則false

isExist: function (device) {

var tempData = this.data.bleList

for (var i = 0; i tempData.length; i++) {

if (tempData[i].deviceId == device.deviceId) {

return true

}

}

return false

},

//服務(wù)uuid

getServiceUUID: function () {

return bletool.stringTransition(this.data.service_uuid);

},

getDeviceInfo: function () {

let car_no = app.globalData.car_no;

var that = this;

wx.request({

url: app.globalData.serverURL + '?c=cara=getDeviceInfoopen_id=' + app.globalData.open_id + 'car_no=' + car_no,

method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT

header: { 'content-type': 'application/json' }, // 設(shè)置請求的 header

success: function (res) {

// success

var data = res.data;

console.log(data);

if (data.result == 1) {

app.globalData.serviceId = data.data.service_id;

app.globalData.serviceMac = data.data.service_mac,

app.globalData.service_psd = '85' + data.data.service_psd + '5800000329';

that.setData({

serviceId: data.data.service_id,

serviceMac: data.data.service_mac,

service_psd: '85' + data.data.service_psd+'5800000329',

})

app.startBluetoothDevicesDiscovery();

// that.onBLECharacteristicValueChange();

} else {

util.showModal(data.msg);

}

},

fail: function () {

},

complete: function () {

// complete

}

});

},

})

麥口科技如何定制開發(fā)或快速模板模塊化微信小程序?

小程序的定制開發(fā)可以選擇一些一鍵生成的小程序。

微塵小程序就是如此的,拖拽就可以生成。

微信小程序模塊化開發(fā)哪家好

小程序開發(fā)已經(jīng)活躍了很長一段時間,然而還是有很多人并不熟知,所以才會讓有心人有機(jī)可乘。需要記住的是微信小程序沒有官方的第三方開發(fā)平臺!小程序開發(fā)行業(yè)非常繁雜,很多公司都能做,但選擇專業(yè)的小程序開發(fā)公司,這一點非常重要就要擦亮眼睛來選擇了。

選擇平臺除了合同細(xì)節(jié),還一定要了解清楚這家公司的背景口碑,多看看公司開發(fā)的成功案例,看做的成功案例與自己心目中的網(wǎng)站效果是否一致。有豐富的開發(fā)微信小程序的經(jīng)驗,能根據(jù)客戶的要求設(shè)計出一套別具風(fēng)格的網(wǎng)站,還可根據(jù)用戶的體驗上做出合理的頁面布局調(diào)整和功能結(jié)構(gòu)調(diào)整,讓平臺增加在同行業(yè)的核心競爭力。

另外建議:購買時不光要產(chǎn)品好、公司好、售后服務(wù)也要好。在微信小程序網(wǎng)站在運行中總會有各種各樣的問題,如平臺的前后臺操作、網(wǎng)站運營中出現(xiàn)的系統(tǒng)問題及漏洞等各種問題,開發(fā)公司能否及時有效的解決,這些都是我們在購買系統(tǒng)選擇服務(wù)公司的一個重要考核點。

總之,天上不會掉餡餅,不要總想著占便宜,鉆空子。跟一次付款終身免費維護(hù)相比,那些后期收一定維護(hù)費的小程序開發(fā)商能提供更好的產(chǎn)品和服務(wù)更有信服力。具體哪家好,需要自己親自體驗。

微信小程序開發(fā)工具模塊化開發(fā)的介紹就聊到這里吧,感謝你花時間閱讀本站內(nèi)容,更多關(guān)于微信小程序開發(fā)工具軟件、微信小程序開發(fā)工具模塊化開發(fā)的信息別忘了在本站進(jìn)行查找喔。

掃碼二維碼