Commit 8b22fa56 by iambtr

删除不用的资源

parent 42bf916b
{ {
"pages": [ "pages": [
"pages/welcome2/welcome2", "pages/welcome2/welcome2",
"pages/my/my", "pages/my/my",
"pages/user_message/user_message", "pages/user_message/user_message",
"pages/return_car_pedding/return_car_pedding", "pages/return_car_pedding/return_car_pedding",
"pages/pay/pay", "pages/pay/pay",
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
"pages/settting/setting", "pages/settting/setting",
"pages/path_detail/path_detail", "pages/path_detail/path_detail",
"pages/forgetpassword/forgetpassword", "pages/forgetpassword/forgetpassword",
"pages/agreement_use/agreement_use",
"pages/user_car_loc/user_car_loc", "pages/user_car_loc/user_car_loc",
"pages/qr_code/qr_code", "pages/qr_code/qr_code",
"pages/register2/register2", "pages/register2/register2",
"pages/point_detail/point_detail", "pages/point_detail/point_detail",
"pages/rent_point/rent_point",
"pages/upload/upload", "pages/upload/upload",
"pages/choose_rent_type/choose_rent_type", "pages/choose_rent_type/choose_rent_type",
"pages/search/search" "pages/search/search"
......
const StateMachine=require('./state-machine.min.js')
const jsbuffer=require('./jsbuffer.min.js')
const deepcopy = require('./deepcopy.min.js')
/**
* 蓝牙接收类解决多数据包 组包和校验的返回完整数据hex
* iambtr
* option{
* timer:超时时长
* protocolHead:头部
* protocolType:协议编号
* }
*/
class BlueReadBuffer {
constructor(option) {
this.checkTimer = null
this.fsm=null
this.msgType=null
this.hexData=''
this.useData=[]
this.dataLength=null
this.checkSum = new Uint8Array(new ArrayBuffer(2))
this.opt={
timer:5000,
protocolHead: 'ffaa',
protocolType:'fa',
byteLength:47
}
this.init(option)
return this
}
init(option) {
deepcopy(this.opt,option)
this.fsm = new StateMachine({
init: 'HEAD',
transitions: [
{ name: 'head', from: 'HEAD', to: 'TYPE' },
{ name: 'type', from: 'TYPE', to: 'DATA' },
{ name: 'data', from: 'DATA', to: 'CHECK' },
{ name: 'ckeck', from: ['HEAD', 'TYPE', 'DATA', 'CHECK', 'DATA', 'END'], to: 'HEAD' }
]
});
}
reduceProcess(buff, successCallBack, failCallBack) {
//检查超时
this.check_timer(failCallBack);
let jsbuff=new jsbuffer().read(buff)
this.hexData+=jsbuff.hex
for (var i = 0; i < jsbuff.uint8array.length; i++) {
var chr = jsbuff.get[i];
switch (this.fsm.state) {
case 'HEAD':
if (chr == Number(`${this.opt.protocolHead}.slice(0,2)`)) {
this.useData.push(chr)
break
}
if ((chr == Number(`${this.opt.protocolHead}.slice(2)`))&&this.useData.length!=0) {
this.useData.push(chr)
this.fsm.head();
break
}
this.clear()
break
case 'TYPE':
if (this.useData.length==2) {
this.useData.push(chr)
break
}
else if(this.useData.length==3) {
this.useData.push(chr)
this.dataLength=chr
this.fsm.type()
break
}
this.clear()
break
case 'DATA':
if (this.useData.length < this.dataLength+4){
this.useData.push(chr)
if (this.useData.length == this.dataLngth + 4) {
this.fsm.data()
}
break
}
this.clear()
break
case 'CHECK':
if (this.useData.length < this.opt.byteLength) {
this.useData.push(chr)
if (this.useData.length == this.opt.byteLength) {
this.checkSum[0] = this.useData.pop()
this.checkSum[1] = this.useData.pop()
let cSum = new Uint16Array(this.checkSum.buffer)
let sum=this.useData.reduce((pre,cur)=>{
return pre + cur
})
if (cSum == sum) {
successCallBack && successCallBack(this.useData, this.hexData);
} else {
failCallBack && failCallBack('校验位不对')
}
this.clear()
}
}
break
case 'END':
if (this.use_data_cnt < this.use_data_len) {
this.use_data[this.use_data_cnt + 4] = chr;
this.use_data_cnt++;
}
if (this.use_data_cnt == this.use_data_len) {
this.fsm.sum1();
}
break;
}
}
}
clear() {
this.fsm.check()
clearTimeout(this.checkTimer)
this.useData = []
this.msgType = null
this.hexData = ''
this.dataLength = null
this.checkSum = new ArrayBuffer(2)
}
check_timer(failCallBack) {
clearTimeout(this.checkTimer)
this.checkTimer = setTimeout(() => {
this.clear();
failCallBack && failCallBack('帧解析数据超时')
}, this.opt.timer)
}
}
module.exports = BlueReadBuffer
\ No newline at end of file
/**
*create by iambtr
**/
"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function extend(t,o){if(0==Object.getOwnPropertyNames(o))return t;var r=JSON.parse(JSON.stringify(o));return function t(o,r){for(var n in r)o.hasOwnProperty(n)&&("object"===_typeof(o[n])?o[n].constructor===Array?o[n]=r[n]:t(o[n],r[n]):o[n]=r[n]);return o}(t,r),r=null,t}
\ No newline at end of file
/**
*create by wr
**/
"use strict";var _createClass=function(){function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,r,e){return r&&n(t.prototype,r),e&&n(t,e),t}}();function _classCallCheck(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}var jsbuffer=function(){function t(){return _classCallCheck(this,t),this.buffer=null,this.hex=null,this.uint8array=null,this}return _createClass(t,[{key:"from",value:function(t,r){var n=this;if(r&&"hex"==r)this.hex=t,this.buffer=new ArrayBuffer(t.length/2),this.uint8array=new Uint8Array(this.buffer),t.match(/.{2}/g).forEach(function(t,r){n.uint8array[r]=Number("0x"+t)});else{var e=t.split("");this.buffer=new ArrayBuffer(e.length),this.uint8array=new Uint8Array(this.buffer),this.hex="",e.forEach(function(t,r){var e=t.charCodeAt(0);e=1==e.toString(16).length?"0"+e.toString(16):e.toString(16),n.hex+=e,n.uint8array[r]=Number("0x"+e)})}return this}},{key:"read",value:function(t){return this.buffer=t,this.uint8array=new Uint8Array(this.buffer),this.setHex(),this}},{key:"set",value:function(t,r){return this.uint8array[t]=r,this.setHex(),this}},{key:"get",value:function(t,r){var e=this.uint8array[t];return r&&/hex/i.test(r)?1==e.toString(16).length?"0"+e.toString(16):e.toString(16):e}},{key:"setHex",value:function(){var r=this;this.hex="",this.uint8array.forEach(function(t){r.hex+=1==t.toString(16).length?"0"+t.toString(16):t.toString(16)})}}]),t}();module.exports=jsbuffer;
\ No newline at end of file
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("StateMachine",[],n):"object"==typeof exports?exports.StateMachine=n():t.StateMachine=n()}(this,function(){return function(t){function n(e){if(i[e])return i[e].exports;var s=i[e]={i:e,l:!1,exports:{}};return t[e].call(s.exports,s,s.exports,n),s.l=!0,s.exports}var i={};return n.m=t,n.c=i,n.i=function(t){return t},n.d=function(t,i,e){n.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:e})},n.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(i,"a",i),i},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=5)}([function(t,n,i){"use strict";t.exports=function(t,n){var i,e,s;for(i=1;i<arguments.length;i++){e=arguments[i];for(s in e)e.hasOwnProperty(s)&&(t[s]=e[s])}return t}},function(t,n,i){"use strict";var e=i(0);t.exports={build:function(t,n){var i,s,r,o=n.plugins;for(i=0,s=o.length;i<s;i++)r=o[i],r.methods&&e(t,r.methods),r.properties&&Object.defineProperties(t,r.properties)},hook:function(t,n,i){var e,s,r,o,a=t.config.plugins,f=[t.context];for(i&&(f=f.concat(i)),e=0,s=a.length;e<s;e++)o=a[e],(r=a[e][n])&&r.apply(o,f)}}},function(t,n,i){"use strict";function e(t){if(0===t.length)return t;var n,i,e=t.split(/[_-]/);if(1===e.length&&e[0][0].toLowerCase()===e[0][0])return t;for(i=e[0].toLowerCase(),n=1;n<e.length;n++)i=i+e[n].charAt(0).toUpperCase()+e[n].substring(1).toLowerCase();return i}e.prepended=function(t,n){return n=e(n),t+n[0].toUpperCase()+n.substring(1)},t.exports=e},function(t,n,i){"use strict";function e(t,n){t=t||{},this.options=t,this.defaults=n.defaults,this.states=[],this.transitions=[],this.map={},this.lifecycle=this.configureLifecycle(),this.init=this.configureInitTransition(t.init),this.data=this.configureData(t.data),this.methods=this.configureMethods(t.methods),this.map[this.defaults.wildcard]={},this.configureTransitions(t.transitions||[]),this.plugins=this.configurePlugins(t.plugins,n.plugin)}var s=i(0),r=i(2);s(e.prototype,{addState:function(t){this.map[t]||(this.states.push(t),this.addStateLifecycleNames(t),this.map[t]={})},addStateLifecycleNames:function(t){this.lifecycle.onEnter[t]=r.prepended("onEnter",t),this.lifecycle.onLeave[t]=r.prepended("onLeave",t),this.lifecycle.on[t]=r.prepended("on",t)},addTransition:function(t){this.transitions.indexOf(t)<0&&(this.transitions.push(t),this.addTransitionLifecycleNames(t))},addTransitionLifecycleNames:function(t){this.lifecycle.onBefore[t]=r.prepended("onBefore",t),this.lifecycle.onAfter[t]=r.prepended("onAfter",t),this.lifecycle.on[t]=r.prepended("on",t)},mapTransition:function(t){var n=t.name,i=t.from,e=t.to;return this.addState(i),"function"!=typeof e&&this.addState(e),this.addTransition(n),this.map[i][n]=t,t},configureLifecycle:function(){return{onBefore:{transition:"onBeforeTransition"},onAfter:{transition:"onAfterTransition"},onEnter:{state:"onEnterState"},onLeave:{state:"onLeaveState"},on:{transition:"onTransition"}}},configureInitTransition:function(t){return"string"==typeof t?this.mapTransition(s({},this.defaults.init,{to:t,active:!0})):"object"==typeof t?this.mapTransition(s({},this.defaults.init,t,{active:!0})):(this.addState(this.defaults.init.from),this.defaults.init)},configureData:function(t){return"function"==typeof t?t:"object"==typeof t?function(){return t}:function(){return{}}},configureMethods:function(t){return t||{}},configurePlugins:function(t,n){t=t||[];var i,e,s;for(i=0,e=t.length;i<e;i++)s=t[i],"function"==typeof s&&(t[i]=s=s()),s.configure&&s.configure(this);return t},configureTransitions:function(t){var n,i,e,s,r,o=this.defaults.wildcard;for(i=0;i<t.length;i++)for(e=t[i],s=Array.isArray(e.from)?e.from:[e.from||o],r=e.to||o,n=0;n<s.length;n++)this.mapTransition({name:e.name,from:s[n],to:r})},transitionFor:function(t,n){var i=this.defaults.wildcard;return this.map[t][n]||this.map[i][n]},transitionsFor:function(t){var n=this.defaults.wildcard;return Object.keys(this.map[t]).concat(Object.keys(this.map[n]))},allStates:function(){return this.states},allTransitions:function(){return this.transitions}}),t.exports=e},function(t,n,i){function e(t,n){this.context=t,this.config=n,this.state=n.init.from,this.observers=[t]}var s=i(0),r=i(6),o=i(1),a=[null,[]];s(e.prototype,{init:function(t){if(s(this.context,this.config.data.apply(this.context,t)),o.hook(this,"init"),this.config.init.active)return this.fire(this.config.init.name,[])},is:function(t){return Array.isArray(t)?t.indexOf(this.state)>=0:this.state===t},isPending:function(){return this.pending},can:function(t){return!this.isPending()&&!!this.seek(t)},cannot:function(t){return!this.can(t)},allStates:function(){return this.config.allStates()},allTransitions:function(){return this.config.allTransitions()},transitions:function(){return this.config.transitionsFor(this.state)},seek:function(t,n){var i=this.config.defaults.wildcard,e=this.config.transitionFor(this.state,t),s=e&&e.to;return"function"==typeof s?s.apply(this.context,n):s===i?this.state:s},fire:function(t,n){return this.transit(t,this.state,this.seek(t,n),n)},transit:function(t,n,i,e){var s=this.config.lifecycle,r=this.config.options.observeUnchangedState||n!==i;return i?this.isPending()?this.context.onPendingTransition(t,n,i):(this.config.addState(i),this.beginTransit(),e.unshift({transition:t,from:n,to:i,fsm:this.context}),this.observeEvents([this.observersForEvent(s.onBefore.transition),this.observersForEvent(s.onBefore[t]),r?this.observersForEvent(s.onLeave.state):a,r?this.observersForEvent(s.onLeave[n]):a,this.observersForEvent(s.on.transition),r?["doTransit",[this]]:a,r?this.observersForEvent(s.onEnter.state):a,r?this.observersForEvent(s.onEnter[i]):a,r?this.observersForEvent(s.on[i]):a,this.observersForEvent(s.onAfter.transition),this.observersForEvent(s.onAfter[t]),this.observersForEvent(s.on[t])],e)):this.context.onInvalidTransition(t,n,i)},beginTransit:function(){this.pending=!0},endTransit:function(t){return this.pending=!1,t},failTransit:function(t){throw this.pending=!1,t},doTransit:function(t){this.state=t.to},observe:function(t){if(2===t.length){var n={};n[t[0]]=t[1],this.observers.push(n)}else this.observers.push(t[0])},observersForEvent:function(t){for(var n,i=0,e=this.observers.length,s=[];i<e;i++)n=this.observers[i],n[t]&&s.push(n);return[t,s,!0]},observeEvents:function(t,n,i,e){if(0===t.length)return this.endTransit(void 0===e||e);var s=t[0][0],r=t[0][1],a=t[0][2];if(n[0].event=s,s&&a&&s!==i&&o.hook(this,"lifecycle",n),0===r.length)return t.shift(),this.observeEvents(t,n,s,e);var f=r.shift(),c=f[s].apply(f,n);return c&&"function"==typeof c.then?c.then(this.observeEvents.bind(this,t,n,s)).catch(this.failTransit.bind(this)):!1===c?this.endTransit(!1):this.observeEvents(t,n,s,c)},onInvalidTransition:function(t,n,i){throw new r("transition is invalid in current state",t,n,i,this.state)},onPendingTransition:function(t,n,i){throw new r("transition is invalid while previous transition is still in progress",t,n,i,this.state)}}),t.exports=e},function(t,n,i){"use strict";function e(t){return r(this||{},t)}function s(){var t,n;"function"==typeof arguments[0]?(t=arguments[0],n=arguments[1]||{}):(t=function(){this._fsm.apply(this,arguments)},n=arguments[0]||{});var i=new u(n,e);return o(t.prototype,i),t.prototype._fsm.config=i,t}function r(t,n){return o(t,new u(n,e)),t._fsm(),t}function o(t,n){if("object"!=typeof t||Array.isArray(t))throw Error("StateMachine can only be applied to objects");c.build(t,n),Object.defineProperties(t,d),a(t,l),a(t,n.methods),n.allTransitions().forEach(function(n){t[f(n)]=function(){return this._fsm.fire(n,[].slice.call(arguments))}}),t._fsm=function(){this._fsm=new h(this,n),this._fsm.init(arguments)}}var a=i(0),f=i(2),c=i(1),u=i(3),h=i(4),l={is:function(t){return this._fsm.is(t)},can:function(t){return this._fsm.can(t)},cannot:function(t){return this._fsm.cannot(t)},observe:function(){return this._fsm.observe(arguments)},transitions:function(){return this._fsm.transitions()},allTransitions:function(){return this._fsm.allTransitions()},allStates:function(){return this._fsm.allStates()},onInvalidTransition:function(t,n,i){return this._fsm.onInvalidTransition(t,n,i)},onPendingTransition:function(t,n,i){return this._fsm.onPendingTransition(t,n,i)}},d={state:{configurable:!1,enumerable:!0,get:function(){return this._fsm.state},set:function(t){throw Error("use transitions to change state")}}};e.version="3.0.1",e.factory=s,e.apply=r,e.defaults={wildcard:"*",init:{name:"init",from:"none"}},t.exports=e},function(t,n,i){"use strict";t.exports=function(t,n,i,e,s){this.message=t,this.transition=n,this.from=i,this.to=e,this.current=s}}])});
\ No newline at end of file
...@@ -514,6 +514,19 @@ const alertTip = (msg,cb) => { ...@@ -514,6 +514,19 @@ const alertTip = (msg,cb) => {
} }
}) })
} }
//确认提示
const confirmTip = (msg, cb) => {
msg = msg ? msg.toString() : 'timeout'
wx.showModal({
title: '提示',
content: msgTip[msg] ? msgTip[msg] : msg,
success(res) {
if (res.confirm) {
cb && cb()
}
}
})
}
const wxscan = function () { const wxscan = function () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.scanCode({ wx.scanCode({
...@@ -525,7 +538,7 @@ const wxscan = function () { ...@@ -525,7 +538,7 @@ const wxscan = function () {
} }
const getProtocol = (id) => { const getProtocol = (id) => {
function download(url) { function download(url) {
console.log(url) url=encodeURI(url)
let file = wx.getStorageSync('file') let file = wx.getStorageSync('file')
if (!file) { if (!file) {
file = [] file = []
...@@ -537,6 +550,7 @@ const getProtocol = (id) => { ...@@ -537,6 +550,7 @@ const getProtocol = (id) => {
wx.downloadFile({ wx.downloadFile({
url, url,
success: function (res) { success: function (res) {
console.log(res)
let filePath = res.tempFilePath; let filePath = res.tempFilePath;
file[+id] = filePath file[+id] = filePath
wx.setStorageSync('file', file) wx.setStorageSync('file', file)
...@@ -607,6 +621,67 @@ const getProtocol = (id) => { ...@@ -607,6 +621,67 @@ const getProtocol = (id) => {
} }
}) })
} }
//预览图片 param:t
const previewPic = (current, urls) => {
//图片预览
wx.previewImage({
current, // 当前显示图片的http链接
urls: urls || [current] // 需要预览的图片http链接列表
})
}
// 类型判断
const getType = function(o) {
let s = Object.prototype.toString.call(o)
return s.replace(/^\[object\s(.*)\]$/gi, ($0, $1) => {
return $1.toLowerCase();
})
}
//上传图片
const uploadResource = function(r,t) {
wx.showLoading({
title: `上传${t||'图片'}中`,
mask: true,
})
// 数组型 资源
if (getType(r) === 'array') {
return Promise.all(r.map(item => {
return new Promise((resolve, reject) => {
wx.uploadFile({
url: 'https://zhizuxia.zhizukj.com/ydb/app/manage/file/upload.json',
filePath: item,
name: 'file',
success(res) {
resolve(JSON.parse(res.data).picUrl)
},
fail(err) {
reject('图片上传失败')
},
complete(res) {
wx.hideLoading()
}
})
})
}))
}else{
// 单个资源
return new Promise((resolve, reject) => {
wx.uploadFile({
url: 'https://zhizuxia.zhizukj.com/ydb/app/manage/file/upload.json',
filePath: r,
name: 'file',
success(res) {
resolve(JSON.parse(res.data).picUrl)
},
fail(err) {
reject('图片上传失败')
},
complete(res) {
wx.hideLoading()
}
})
})
}
}
const changeTime = (mss)=>{ const changeTime = (mss)=>{
var days = parseInt(mss / (1000 * 60 * 60 * 24)); var days = parseInt(mss / (1000 * 60 * 60 * 24));
var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
...@@ -629,5 +704,8 @@ module.exports = { ...@@ -629,5 +704,8 @@ module.exports = {
payApi, payApi,
rapi, rapi,
mockApi, mockApi,
confirmTip,
previewPic,
uploadResource,
changeTime changeTime
} }
const { api, imgName, getUserInfo } = require('../../lib/util.js')
Page({
data: {
msg: 'agreement_use'
},
onLoad: function () {
console.log('agreement_use')
},
onShow: function () {
console.log('agreement_use show')
}
})
\ No newline at end of file
<view>
{{msg}}
</view>
\ No newline at end of file
/**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
const { api,alertTip} = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
deviceId:null,
userList:[],
master:false
},
onLoad: function (query) {
this.setData({
deviceId:Number(query.id),
master:Number(query.master)==wx.getStorageSync('user').userId
})
this.getUsers(this.data.deviceId)
},
onPullDownRefresh: function () {
this.getUsers(this.data.deviceId)
},
getUsers(id){
let that=this
api.get('api/vehicle/vehicleBindingUser.json', { userVehicleId:id})
.then(res=>{
console.log(res.items)
that.setData({
userList: res.items.map(item => {
item.mobile = item.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
return item
})
})
})
.catch(err=>{
console.error(err)
alertTip(err)
})
},
unbindUser(e) {
let that = this
let userId = Number(e.currentTarget.id)
wx.showModal({
title: '警告',
content: '确定解除该用户的绑定?',
success: function (res) {
if (res.confirm) {
api.post('api/vehicle/removeBinding.json', { userVehicleId: that.data.deviceId, removeUserId: userId })
.then(res => {
console.log(res)
that.getUsers(that.data.deviceId)
})
.catch(err => {
alertTip(err)
})
}
}
})
}
})
\ No newline at end of file
{
"enablePullDownRefresh": true,
"navigationBarTitleText": "用户列表"
}
\ No newline at end of file
<view class='con'>
<view wx:for='{{userList}}' class='user-item'>
<view>用户手机号:<text>{{item.mobile}}</text></view>
<view id='{{item.userId}}' catchtap='unbindUser' class='unbind' hidden='{{!master}}'>解绑</view>
</view>
</view>
page {
height: 100%;
background-color: #f7f7f7;
}
.user-item{
background-color: #ffffff;
margin: 20rpx 0;
height: 104rpx;
padding:0 30rpx;
display: flex;
align-items: center;
font-size: 32rpx;
justify-content: space-between;
}
.user-item text{
color: #a5a5a5;
}
.unbind{
width: 162rpx;
height: 56rpx;
color: #000000;
border-radius: 28rpx;
letter-spacing: 8rpx;
line-height: 56rpx;
text-align: center;
background-color: #d7193c;
}
\ No newline at end of file
// pages/device_bind/device_bind.js // pages/device_bind/device_bind.js
const { api, wxscan, rapi, userLocation, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, getProtocol } = require('../../lib/util.js') const { api, confirmTip,wxscan, rapi, userLocation, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, getProtocol } = require('../../lib/util.js')
let timer=null let timer=null
let pointTimer = null//网点解绑 let pointTimer = null//网点解绑
Page({ Page({
...@@ -162,34 +162,37 @@ Page({ ...@@ -162,34 +162,37 @@ Page({
}, },
//解绑站点 //解绑站点
relizePoint(){ relizePoint(){
api.get('message/getMessageInfo', { confirmTip('确认提交解绑站点',()=>{
userId: this.data.userId, api.get('message/getMessageInfo', {
messageType: 7//用户申请加入站点 userId: this.data.userId,
}, {}, true) messageType: 7//用户申请加入站点
.then(res => { }, {}, true)
let { state } = res.data .then(res => {
if (state == 3) { let { state } = res.data
alertTip('站点已同意你的解绑申请', () => { if (state == 3) {
wx.redirectTo({ alertTip('站点已同意你的解绑申请', () => {
url: '/pages/choose_rent_type/choose_rent_type?status=normal', wx.redirectTo({
url: '/pages/choose_rent_type/choose_rent_type?status=normal',
})
}) })
return
}
api.post('message/applyReturnSiteTB', {
userId: this.data.userId
}) })
return .then(res => {
} alertTip('申请解绑站点成功,请耐心等待站点同意!')
api.post('message/applyReturnSiteTB', { })
userId: this.data.userId .catch(err => {
alertTip(err)
console.error(err)
})
}) })
.then(res => { .catch(err => {
alertTip('申请解绑站点成功,请耐心等待站点同意!') console.error(err)
}) })
.catch(err => { })
alertTip(err)
console.error(err)
})
})
.catch(err => {
console.error(err)
})
}, },
getStatus(userType){ getStatus(userType){
...@@ -348,19 +351,19 @@ relizePoint(){ ...@@ -348,19 +351,19 @@ relizePoint(){
let { longitude: lng, latitude: lat } = res let { longitude: lng, latitude: lat } = res
that.setData({ that.setData({
longitude: lng, longitude: lng,
latitude: lat, latitude: lat
}) })
rapi.get('userOrder/getNodeList', { api.get('site/getNodeList', {
lng, lng,
lat, lat,
curPage curPage: 1
}) })
.then(({ items}) => { .then(({ items}) => {
let markers=[] let markers=[]
items.map(item => { items.map(item => {
let oMarker = { iconPath: '/static/image/pointloc.png', width:25, height:25} let oMarker = { iconPath: '/static/image/pointloc.png', width:25, height:25}
oMarker.latitude = item.nodeLat oMarker.latitude = item.latitude
oMarker.longitude = item.nodeLng oMarker.longitude = item.longitude
markers.push(oMarker) markers.push(oMarker)
return item return item
}) })
...@@ -383,7 +386,7 @@ relizePoint(){ ...@@ -383,7 +386,7 @@ relizePoint(){
}, },
toServerPoint(){ toServerPoint(){
wx.navigateTo({ wx.navigateTo({
url: '/pages/server_point/server_point', url: '/pages/rent_point/rent_point',
}) })
}, },
//判断是否未支付定单或者押金 //判断是否未支付定单或者押金
......
...@@ -58,7 +58,6 @@ Page({ ...@@ -58,7 +58,6 @@ Page({
newPass: This.data.inputPassword newPass: This.data.inputPassword
}) })
.then(res => { .then(res => {
console.log('成功', res)
wx.showLoading({ wx.showLoading({
title: '修改密码成功', title: '修改密码成功',
}) })
......
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
navList: {
type: Array,
value: [{
id: '1',
title: '标题',
icon: ''
}, {
id: '2',
title: '标题',
icon: ''
}],
}
},
data: {
// 这里是一些组件内部数据
activeId:null
},
attached(){
this.setData({
activeId:this.data.navList[0].id
})
},
methods: {
// 这里是一个自定义方法
_selectItem: function (e) {
if (this.data.activeId === e.target.dataset.act){
return
}
this.setData({
activeId:e.target.dataset.act
})
this.triggerEvent('change', { id: e.target.dataset.act})
}
}
})
\ No newline at end of file
{
"component": true
}
\ No newline at end of file
<!--pages/nav_bar/nav_bar.wxml-->
<view class='nav-box'>
<block wx:for="{{navList}}" wx:key="*this">
<view class='nav-item' bindtap='_selectItem' id='{{item.id}}' data-act='{{item.id}}'>
<image class='img-icon' src='{{item.icon}}' data-act='{{item.id}}'></image>
<text class='nav-title {{item.id==activeId?"active":""}}' data-act='{{item.id}}'>{{item.title}}</text>
</view>
</block>
</view>
/* pages/nav_bar/nav_bar.wxss */
.nav-box{
height: 10%;
display: flex;
justify-content: space-around;
text-align: center;
align-items: stretch;
border-top:2rpx solid #7A7A7A;
position:fixed;
bottom: 0;
left:0;
width: 100%;
background-color: #FAFAFA;
}
.img-icon{
width: 40rpx;
height: 40rpx;
padding: 10rpx 0;
}
.nav-item{
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.nav-title{
font-size: 16px;
color: #353535;
}
.nav-title.active{
color: #1fb922;
}
\ No newline at end of file
...@@ -17,7 +17,7 @@ Page({ ...@@ -17,7 +17,7 @@ Page({
point:{},//站点 point:{},//站点
imgToloc: imgName('toloc.png'), imgToloc: imgName('toloc.png'),
imgLoc: imgName('pointloc.png'), imgLoc: imgName('pointloc.png'),
imgToPoint: imgName('timeline_location.png'), imgNav: imgName('navigate.png'),
imgPhone: imgName('security_settings_telephone_active.png'), imgPhone: imgName('security_settings_telephone_active.png'),
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class='con'> <view class='con'>
<map id='carMap' scale='13' markers='{{locMap.markers}}' show-location bindmarkertap='markersTap' longitude='{{locMap.longitude}}' latitude='{{locMap.latitude}}'> <map id='carMap' scale='13' markers='{{locMap.markers}}' show-location bindmarkertap='markersTap' longitude='{{locMap.longitude}}' latitude='{{locMap.latitude}}'>
<cover-view class='map-controltap'> <cover-view class='map-controltap'>
<cover-image src='{{imgToPoint}}' catchtap='toPoint'></cover-image> <cover-image src='{{imgNav}}' catchtap='toPoint'></cover-image>
<cover-image src='{{imgToloc}}' catchtap='showMyLoc'></cover-image> <cover-image src='{{imgToloc}}' catchtap='showMyLoc'></cover-image>
</cover-view> </cover-view>
</map> </map>
......
// pages/server_point/server_point.js
const { api, rapi, formatTime, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
first: true,
imgLoc: imgName('pointloc.png'),
imgNav: imgName('navigate.png'),
imgPhone: imgName('security_settings_telephone_active.png'),
imgLogo: imgName('logo.png'),
activeIndex: 0,
page: 1,//当前页面
totalPage:1,
hasMorePage:false,
pointLists: [],//站点列表
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getPointLists()
},
//站点
toPoint(e) {
let that = this
let { point } = e.currentTarget.dataset
wx.openLocation({
latitude: Number(point.latitude),
longitude: Number(point.longitude),
scale: 28
})
},
//获取站点列表
getPointLists() {
let curPage =1
let that = this
userLocation()
.then(res => {
let { longitude: lng, latitude: lat } = res
api.get('site/getNodeList', {
lng,
lat,
curPage
})
.then(res => {
let listArrays = res.items.map(item => { item.distance = item.distance.toFixed(1); return item })
//首页)
if (curPage == 1) {
this.setData({
pointLists: listArrays,
page: res.page+1,
totalPage: res.totalPage,
hasMorePage: res.page<res.totalPage
})
} else {
let newPoints = that.data.pointLists.concat(listArrays)
this.setData({
pointLists: newPoints,
page: res.page + 1,
totalPage: res.totalPage,
hasMorePage: res.page < res.totalPage
})
}
})
.catch(err => {
alertTip(err, () => {
wx.navigateBack()
})
})
})
.catch(err => {
alertTip('你拒绝了地理定位,请打开后重试', () => {
wx.navigateBack()
})
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
//拨打电话
callPointPhone(e) {
wx.makePhoneCall({
phoneNumber: e.currentTarget.id
})
}
})
\ No newline at end of file
<view class='con'>
<scroll-view class='item-body' scroll-y>
<view class='point-item' wx:for='{{pointLists}}' wx:key="{{item.id}}">
<view class='tip' wx:if='{{index==0}}'>距你最近的服务商:</view>
<view class='point-box'>
<view class='point-left' id='{{item.id}}' data-index='{{index}}'>
<!-- <star-score score='2.6'></star-score> -->
<view catchtap='toPoint' data-point='{{item}}'>
<text>{{item.companyName}}</text>
<image src='{{imgNav}}'></image>
<text>导航</text>
</view>
<view>
<image src='{{imgLoc}}'></image>
<text>{{item.address}}</text>
</view>
</view>
<view class='point-right'>
<text class='tip' id='{{item.id}}' data-index='{{index}}'>{{item.distance}} km</text>
<view id='{{item.contactPhone}}' catchtap='callPointPhone' wx:if='{{item.contactPhone}}'>
<image src='{{imgPhone}}'></image>
<text>拨打电话</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
\ No newline at end of file
/* pages/rent_point/rent_point.wxss */
@import '../server_point/server_point.wxss';
image{
flex: 0 0 auto;
}
\ No newline at end of file
...@@ -22,6 +22,9 @@ page,.con{ ...@@ -22,6 +22,9 @@ page,.con{
align-items: center; align-items: center;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
} }
.search-item text{
flex: 0 0 480rpx;
}
.search-item button{ .search-item button{
margin: 0; margin: 0;
font-size: 32rpx; font-size: 32rpx;
......
...@@ -119,11 +119,7 @@ Page({ ...@@ -119,11 +119,7 @@ Page({
orderTime orderTime
}).then(res => { }).then(res => {
alertTip('提交成功', () => { alertTip('提交成功', () => {
this.tabCarMenu({ wx.navigateBack(2)
target: {
id: 'tab'
}
})
}) })
}).catch(err => { }).catch(err => {
alertTip(err) alertTip(err)
......
// pages/server_detail/server_detail.js. // pages/server_detail/server_detail.js.
const { api, formatTime, rapi, mapApi, mockApi, imgName, alertTip } = require('../../lib/util.js') const { api, formatTime, previewPic, rapi, mapApi, mockApi, imgName, alertTip, confirmTip } = require('../../lib/util.js')
Page({ Page({
...@@ -49,25 +49,23 @@ Page({ ...@@ -49,25 +49,23 @@ Page({
}, },
// 预览问题图片 // 预览问题图片
lookPic(e) { lookPic(e) {
let src = e.currentTarget.dataset.src;//获取data-src let { src, list} = e.currentTarget.dataset;
let imgList = e.currentTarget.dataset.list;//获取data-list
//图片预览 //图片预览
wx.previewImage({ previewPic(src,list)
current: src, // 当前显示图片的http链接
urls: imgList // 需要预览的图片http链接列表
})
}, },
//取消订单 //取消订单
cancleOrder(){ cancleOrder(){
rapi.get('userOrder/cancleOrder', { confirmTip('您确认取消工单?',()=>{
userId: wx.getStorageSync('user').userMapp.id, rapi.get('userOrder/cancleOrder', {
id:this.data.order.id userId: wx.getStorageSync('user').userMapp.id,
}).then(res => { id: this.data.order.id
alertTip('取消成功',()=>{ }).then(res => {
this.getMyOrderDetail(this.data.order.id) alertTip('取消成功', () => {
this.getMyOrderDetail(this.data.order.id)
})
}).catch(err => {
alertTip(err)
}) })
}).catch(err => {
alertTip(err)
}) })
}, },
//评价订单 //评价订单
......
...@@ -8,6 +8,7 @@ Page({ ...@@ -8,6 +8,7 @@ Page({
data: { data: {
first:true, first:true,
imgLoc: imgName('pointloc.png'), imgLoc: imgName('pointloc.png'),
imgNav: imgName('navigate.png'),
imgPhone: imgName('security_settings_telephone_active.png'), imgPhone: imgName('security_settings_telephone_active.png'),
imgLogo: imgName('logo.png'), imgLogo: imgName('logo.png'),
activeIndex:0, activeIndex:0,
...@@ -32,6 +33,16 @@ Page({ ...@@ -32,6 +33,16 @@ Page({
onLoad: function (options) { onLoad: function (options) {
}, },
//站点
toPoint(e) {
let that = this
let {point} = e.currentTarget.dataset
wx.openLocation({
latitude: point.nodeLat,
longitude:point.nodeLng,
scale: 28
})
},
onShow(){ onShow(){
this.getMyOrderList(1) this.getMyOrderList(1)
}, },
...@@ -49,6 +60,7 @@ Page({ ...@@ -49,6 +60,7 @@ Page({
}) })
.then(res => { .then(res => {
let listArrays = res.items.map(item => { item.distance=item.distance.toFixed(1); return item}) let listArrays = res.items.map(item => { item.distance=item.distance.toFixed(1); return item})
.filter(item => parseInt(item.distance)<=20)
//首页) //首页)
if (curPage==1){ if (curPage==1){
this.setData({ this.setData({
......
<navbar titleList='{{titleList}}' ontabChange='tabChange'></navbar> <navbar titleList='{{titleList}}' ontabChange='tabChange'></navbar>
<view class='con' hidden='{{activeIndex==1}}'> <view class='con' hidden='{{activeIndex==1}}'>
<scroll-view class='item-body' scroll-y> <scroll-view class='item-body' scroll-y>
<view wx:if='{{showList.length!=0}}'> <view wx:if='{{showList.length!=0}}'>
<view class='list-item' wx:for='{{showList}}' wx:key='{{item.id}}' id='{{item.id}}' catchtap='toServerDetail'> <view class='list-item' wx:for='{{showList}}' wx:key='{{item.id}}' id='{{item.id}}' catchtap='toServerDetail'>
<image src='{{item.pics||imgLogo}}'></image> <image src='{{item.pics||imgLogo}}'></image>
<view class='item-des item-text'> <view class='item-des item-text'>
<text>{{item.frameNo}}</text> <text>{{item.frameNo}}</text>
<text class='low-text'>{{item.vehicleModel}}</text> <text class='low-text'>{{item.vehicleModel}}</text>
</view>
<view class='item-state item-text'>
<text class='tip2'>{{item.state}}</text>
<text class='low-text'>{{item.orderTime}}</text>
</view>
</view>
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getMyOrderList'>加载更多</button>
</view>
</view> </view>
<view wx:else class='no-list'> <view class='item-state item-text'>
<text class='tip2'>不存在任何工单</text> <text class='tip2'>{{item.state}}</text>
<text class='low-text'>{{item.orderTime}}</text>
</view> </view>
</view>
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getMyOrderList'>加载更多</button>
</view>
</view>
<view wx:else class='no-list'>
<text class='tip2'>不存在任何工单</text>
</view>
</scroll-view> </scroll-view>
</view> </view>
<view class='con' hidden='{{activeIndex==0}}'> <view class='con' hidden='{{activeIndex==0}}'>
<scroll-view class='item-body' scroll-y> <scroll-view class='item-body' scroll-y wx:if='{{pointLists.length!=0}}'>
<view class='point-item' wx:for='{{pointLists}}' wx:key="{{item.id}}"> <view class='point-item' wx:for='{{pointLists}}' wx:key="{{item.id}}">
<view class='tip' wx:if='{{index==0}}'>距你最近的服务商:</view> <view class='tip' wx:if='{{index==0}}'>距你最近的服务商:</view>
<view class='point-box'> <view class='point-box'>
<view class='point-left' id='{{item.id}}' data-index='{{index}}' catchtap='toPointDetail'> <view class='point-left' id='{{item.id}}' data-index='{{index}}' catchtap='toPointDetail'>
<text>{{item.nodeName}}</text> <!-- <star-score score='2.6'></star-score> -->
<!-- <star-score score='2.6'></star-score> --> <view catchtap='toPoint' data-point='{{item}}'>
<text>{{item.nodeName}}</text>
<image src='{{imgNav}}'></image>
<text>导航</text>
</view>
<view> <view>
<image src='{{imgLoc}}'></image> <image src='{{imgLoc}}'></image>
<text>{{item.city}}市{{item.area}}区{{item.nodeAddress}}</text> <text>{{item.city}}市{{item.area}}区{{item.nodeAddress}}</text>
...@@ -44,8 +48,8 @@ ...@@ -44,8 +48,8 @@
</view> </view>
</view> </view>
</view> </view>
<view class='btn' wx:if='{{hasMorePage}}'>
<button catchtap='getPointLists'>加载更多</button>
</view>
</scroll-view> </scroll-view>
<view wx:else class='no-list'>
<text class='tip2'>该服务正在开通中</text>
</view>
</view> </view>
\ No newline at end of file
...@@ -5,11 +5,14 @@ page{ ...@@ -5,11 +5,14 @@ page{
color: #000; color: #000;
height: 100%; height: 100%;
} }
navbar{
height: 10%;
}
.con{ .con{
height: 90%; height: 90%;
} }
.item-body{ .item-body{
height: 100%; height: 90%;
overflow: hidden; overflow: hidden;
} }
.tip{ .tip{
......
...@@ -15,7 +15,12 @@ Page({ ...@@ -15,7 +15,12 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
let urlPath=wx.getStorageSync('user').userMapp.idImg
if(urlPath){
this.setData({
imgScan:urlPath
})
}
}, },
upimg(){ upimg(){
let that = this let that = this
...@@ -40,6 +45,7 @@ Page({ ...@@ -40,6 +45,7 @@ Page({
}, },
sureChange(){ sureChange(){
let imgUrl = this.data.imgUrl let imgUrl = this.data.imgUrl
let that=this
if (imgUrl){ if (imgUrl){
wx.showLoading({ wx.showLoading({
title: '上传中。。', title: '上传中。。',
...@@ -54,6 +60,9 @@ Page({ ...@@ -54,6 +60,9 @@ Page({
id:wx.getStorageSync('user').userMapp.id, id:wx.getStorageSync('user').userMapp.id,
idImg:upUrl idImg:upUrl
}).then(res=>{ }).then(res=>{
let newPath = wx.getStorageSync('user')
newPath.userMapp.idImg = upUrl
wx.setStorageSync('user', newPath)
alertTip('修改成功',()=>{ alertTip('修改成功',()=>{
wx.navigateBack() wx.navigateBack()
}) })
......
<view class="big-logos"> <view class="big-logos">
<image catchtap="upimg" src='{{imgScan}}' wx:if='{{!imgUrl}}'></image> <image catchtap="upimg" src='{{imgScan}}' wx:if='{{!imgUrl}}'></image>
<view class='logoinfo' wx:else> <view class='logoinfo' wx:else>
<image class='close' id='{{index}}' src='{{imgClose}}' catchtap='deleteImg'></image> <image class='close' id='{{index}}' src='{{imgClose}}' catchtap='deleteImg'></image>
<image catchtap="upimg" src='{{imgUrl}}'></image> <image catchtap="upimg" src='{{imgUrl}}'></image>
</view> </view>
</view> </view>
<button catchtap='sureChange'>确认修改</button> <view class='tip' catchtap="upimg">(点击图片修改)</view>
<button catchtap='sureChange'>确认修改</button>
...@@ -23,6 +23,10 @@ page{ ...@@ -23,6 +23,10 @@ page{
width:80rpx; width:80rpx;
height: 80rpx; height: 80rpx;
} }
.tip{
padding: 30rpx;
text-align: center;
}
button{ button{
background-color: #d7193c; background-color: #d7193c;
} }
\ No newline at end of file
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
data: {
imgCheckOff: imgName('security_settings_unchecked.png'),
imgCheckOn: imgName('security_settings_unchecked_active.png'),
ignorealarmtimelen:0,
remindtimelength:0,
alarmSettings: [
{
id:0,
name: '无'
}, {
id:1,
name: '1分钟'
}, {
id:2,
name: '2分钟'
}, {
id:3,
name: '3分钟'
}, {
id: 4,
name: '4分钟'
}, {
id: 5,
name: '5分钟'
}],
/** alarmTimeSettings: [
{
id: 1,
name: '1分钟'
},
{
id: 3,
name: '3分钟'
},
{
id: 5,
name: '5分钟'
},
{
id: 10,
name: '10分钟'
},
{
id: 0,
name: '持续直到我处理报警提醒'
}
]*/
},
onLoad: function () {
},
onShow: function () {
this.getAlarmSetting()
},
getAlarmSetting() {
let that = this
api.post('api/user/userConfigInfo.json')
.then(res => {
let datamodel = res.data
that.setData({
ignorealarmtimelen: datamodel.ignorealarmtimelen,
remindtimelength: datamodel.remindtimelength
})
})
.catch(err => {
alertTip(err)
})
},
setSecure(e){
let that = this
let t = e.currentTarget
let data={}
data[t.dataset.type] = t.id
api.post('api/user/updateUserConfig.json', Object.assign({},data, { userid: wx.getStorageSync('user').userId }))
.then(res => {
that.getAlarmSetting()
})
.catch(err => {
alertTip(err)
})
}
})
\ No newline at end of file
<view class='con'>
<view class='set-box'>
<view class='setting-title'>
<view class='mode-title'>
<text>忽略相同类型提醒</text>
<view class='bar'></view>
</view>
<view class='mode-des'>收到车辆报警并选择忽略,一定时间内相同类型提醒不再提示。</view>
</view>
<view class='box-memu'>
<block wx:for='{{alarmSettings}}'>
<view class='box-item' id='{{item.id}}' data-type='ignorealarmtimelen' catchtap='setSecure'>
<text>{{item.name}}</text>
<view>
<image src='{{item.id==ignorealarmtimelen?imgCheckOn:imgCheckOff}}'></image>
</view>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file
page{
background-color: #f7f7f7;
}
.con{
border-top: 1px solid #ebebeb;
}
.set-box{
background-color: #ffffff;
}
.setting-title{
padding-left:50rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
height: 124rpx;
border-bottom: 1px solid #ebebeb;
}
.mode-title{
font-size: 34rpx;
line-height: 34rpx;
margin-bottom: 14rpx;
position: relative;
}
.bar{
position: absolute;
border-left: 3px solid #d7193c;
height: 34rpx;
top:0;
left: -23rpx;
}
.mode-des{
font-size: 22rpx;
line-height: 22rpx;
color: #afafaf;
}
.box-memu{
padding-left:50rpx;
}
.box-item{
border-bottom: 1px solid #ebebeb;
padding-right: 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
height: 82rpx;
font-size: 32rpx;
}
.box-item image{
width: 44rpx;
height: 44rpx;
}
.box-item:last-child{
border-bottom: none;
}
const { api, mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
imgPerson: imgName('logo.png')
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
<view>
<view class='set-box'>
<view class='logo'>
<image src='{{imgPerson}}'></image>
<view>
<text>188****8888{{userPhone}}</text>
<text class='low-des'>有效期:2019-05-30</text>
</view>
</view>
</view>
<view class='set-box'>
<view class='setting-title'>
<text class='bar'></text>
<text class='title'>服务费续期</text>
</view>
<view class='setting-item'>
<view class='box-item' data-remindermode='1'>
<view class='text-mode'>
1年
<text class='mode-main'>25</text> 元
</view>
<text class='buy-server'>续费</text>
</view>
<view class='box-item' data-remindermode='3'>
<view class='text-mode'>
2年
<text class='mode-main'>96</text> 元
</view>
<text class='buy-server'>续费</text>
</view>
</view>
</view>
<view class='set-box'>
<view class='setting-title'>
<text class='bar'></text>
<text class='title'>超级VIP</text>
<text class='title-des'>服务费-保险</text>
</view>
<view class='setting-item'>
<view class='box-item' data-remindermode='1'>
<view class='text-mode'>
1年
<text class='mode-main'>25</text> 元
</view>
<text class='buy-server'>续费</text>
</view>
<view class='box-item' data-remindermode='3'>
<view class='text-mode'>
2年
<text class='mode-main'>96</text> 元
</view>
<text class='buy-server'>续费</text>
</view>
</view>
</view>
</view>
\ No newline at end of file
page{
background-color: #f7f7f7;
border-top: 1px solid #ebebeb;
}
.set-box{
background-color: #ffffff;
margin-bottom: 14px;
}
.setting-title{
display: flex;
align-items: center;
height: 90rpx;
box-sizing: border-box;
font-size: 34rpx;
border-bottom: 1px solid #ebebeb;
}
.setting-title .bar{
display: inline-block;
height:34rpx;
border-left: 3px solid #d7193c;
margin: 0 26rpx 0 30rpx;
flex: 0 0 auto;
}
.setting-title .title{
flex: 0 0 auto;
}
.setting-item{
padding-left: 50rpx;
}
.box-item{
display: flex;
box-sizing: border-box;
align-items: center;
font-size: 28rpx;
padding: 20rpx 40rpx 20rpx 0;
border-bottom: 1px solid #ebebeb;
justify-content: space-between;
}
.setting-item .box-item:last-child{
border-bottom: none;
}
.more image:nth-of-type(1){
margin-right: 0;
}
.box-item image:nth-of-type(1).more-img{
width: 16rpx;
height: 30rpx;
}
.text-mode{
width: 468rpx;
font-size: 28rpx;
}
.mode-main{
font-size: 28rpx;
color: #f43333;
padding-bottom: 12rpx;
}
.buy-server{
padding: 14rpx 44rpx;
background-color: #d7193c;
color: #ffffff;
border-radius: 28rpx;
letter-spacing: 4px;
}
.title-des{
font-size: 28rpx;
color: #999999;
margin: 4rpx 0 0 7px;
}
.logo{
padding: 34rpx 28rpx;
display: flex;
align-items: center;
}
.logo image{
width: 112rpx;
height: 112rpx;
border-radius: 50%;
margin-right: 28rpx;
}
.logo text{
font-size: 36rpx;
}
text.low-des{
font-size: 26rpx;
color: #adadad;
margin-top: 18rpx;
}
.logo view{
display: flex;
flex-direction: column;
}
\ No newline at end of file
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
const qrcode = require('../../lib/qrcode.js')
Page({
data: {
deviceList: [{
detailList:[{
name:'请尝试下拉刷新'
}]
}],
imgUserIcon: imgName('userdevice.png'),
imgUserBg: imgName('devicebg.png'),
imgCheck: imgName('security_settings_unchecked_active.png'),
imgPencil: imgName('pencil.png'),
imgAdd: imgName('add.png'),
imgFind: imgName('search.png'),
inputValue:'',
modify:false,
modifyValue:'',
deviceId:null,
carCode: '',//二维码
canvasHide: true,//二维码隐藏
},
onLoad: function () {
this.getCarList()
},
onShow: function () {
console.log('welcome show')
},
getCarList(data){
let that = this
api.get('api/vehicle/myVehicle.json', data ? data:{})
.then(res => {
console.log(res.items)
that.setData({
deviceList: res.items.map(item=>{
item.networkingStopTime=item.networkingStopTime.slice(0, 10)
return item
})
})
wx.stopPullDownRefresh()
})
.catch(err => {
wx.stopPullDownRefresh()
alertTip(err)
})
},
addCar(){
wx.navigateTo({
url: '/pages/device_bind/device_bind',
})
},
onPullDownRefresh(){
this.getCarList()
},
changeCar(e) {
let that=this
let id=e.currentTarget.id
api.get('api/vehicle/switchingVehicle.json', { id: Number(id)})
.then(res => {
that.getCarList()
})
.catch(err => {
alertTip(err)
})
},
formSubmit: function (e) {
this.getCarList({ search: e.detail.value})
this.setData({
inputValue:''
})
},
unbindCar(e){
let that = this
let id = e.currentTarget.id
wx.showModal({
title: '警告',
content: '确定解除该设备的绑定?',
success: function (res) {
if (res.confirm) {
api.post('api/vehicle/removeBinding.json', { userVehicleId: Number(id), removeUserId: Number(wx.getStorageSync('user').userId) })
.then(res => {
that.getCarList()
})
.catch(err => {
alertTip(err)
})
}
}
})
},
carBindUser(e){
console.log(e)
wx.navigateTo({
url: `/pages/carusers/carusers?id=${e.currentTarget.id}&master=${e.currentTarget.dataset.master}`,
})
},
modify(e){
let that=this
if (Number(e.currentTarget.dataset.master)==wx.getStorageSync('user').userId){
that.setData({
modify: true,
deviceId: Number(e.currentTarget.id)
})
}else{
alertTip('您不是主车主,无法修改')
}
},
apiModify(e){
let that=this
api.post('api/vehicle/modifyVehicleInfo.json', { name: e.detail.value, otherFeatures: '', id: that.data.deviceId })
.then(res => {
that.setData({
modify: false,
modifyValue:''
})
that.getCarList()
})
.catch(err => {
alertTip(err)
})
},
giveUp(){
let that=this
wx.showModal({
title: '提示',
content: '确定放弃修改车辆昵称?',
success(res){
if(res.confirm){
that.setData({
modify: false,
modifyValue: ''
})
}
}
})
},
showCode(e) {
wx.navigateTo({
url: `/pages/qr_code/qr_code?vcu=${e.currentTarget.id}`,
})
},
//适配不同屏幕大小的canvas
setCanvasSize: function () {
var size = {};
try {
var res = wx.getSystemInfoSync();
var scale = 750 / 460;//不同屏幕下canvas的适配比例;设计稿是750宽
var width = res.windowWidth / scale;
var height = width;//canvas画布为正方形
size.w = width;
size.h = height;
} catch (e) {
// Do something when catch error
console.log("获取设备信息失败" + e);
}
return size;
},
})
\ No newline at end of file
{
"navigationBarTitleText": "我的设备",
"enablePullDownRefresh": true
}
\ No newline at end of file
<scroll-view class='con' wx:if='{{!modify}}' scroll-y>
<view class='search'>
<image class='search-icon' src='{{imgFind}}'></image>
<input name="search" class='search-car' confirm-type='search' placeholder="请输入车辆昵称" bindconfirm='formSubmit' value='{{inputValue}}' />
</view>
<block wx:for='{{deviceList}}'>
<view class='car-item'>
<view class='car-msg'>
<view class='msg-item'>
<view class='text-item' id='{{item.id}}' data-master='{{item.masterUser}}' catchtap='modify'>
<text>昵称:</text>
<text>{{item.name}} </text>
<image src='{{imgPencil}}' class='pencil'></image>
</view>
<view class='text-item'>
<text>设备号:</text>
<text>{{item.vcuNo}}</text>
</view>
<view class='text-item'>
<text>服务到期:</text>
<text class='high-light'>截止到{{item.networkingStopTime}}</text>
</view>
</view>
<view class='use-car'>
<image src='{{imgCheck}}' wx:if='{{item.use}}'></image>
</view>
</view>
<view class='car-change' wx:if='{{item.state}}'>
<text hidden='{{item.use}}' bindtap='changeCar' id='{{item.id}}'>使用</text>
<text catchtap='unbindCar' id='{{item.id}}'>解绑</text>
<text catchtap='carBindUser' id='{{item.id}}' data-master='{{item.masterUser}}'>用户列表</text>
<text catchtap='showCode' id='{{item.vcuNo}}'>二维码</text>
</view>
<view wx:else class='car-change'>
<text>等待授权</text>
</view>
</view>
</block>
</scroll-view>
<view wx:else class='con'>
<view class='search'>
<input name="search" class='search-car' placeholder="请输入要修改后的车辆昵称" bindconfirm='apiModify' value='{{modifyValue}}' />
</view>
<view class='addcar'>
<button type='primary' class='give-up' catchtap='giveUp'>放弃修改</button>
</view>
</view>
<view class='addcar' wx:if='{{!modify}}'>
<button bindtap='addCar'>
<image src='{{imgAdd}}'></image>
新增车辆</button>
</view>
\ No newline at end of file
page {
height: 100%;
overflow: hidden;
background-color: #f7f7f7;
position: relative;
}
.con {
box-sizing: border-box;
height: 100%;
padding-bottom: 84rpx;
}
.addcar{
position: absolute;
bottom:0;
left: 0;
width: 100%;
height: 140rpx;
background-color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
.addcar button{
background-color: #d7193c;
height: 84rpx;
width: 694rpx;
font-size: 34rpx;
line-height: 34rpx;
display: flex;
justify-content: center;
align-items: center;
}
.addcar image{
width: 36rpx;
height: 36rpx;
margin-right: 20rpx;
}
.search{
background-color: #ffffff;
padding-left: 30rpx;
height: 70rpx;
width: 694rpx;
display: flex;
align-items: center;
border-radius: 35rpx;
margin: 14rpx auto;
}
.search-icon{
margin-right: 20rpx;
width: 30rpx;
height: 30rpx;
}
.search-car{
font-size: 26rpx;
flex: 1 0 auto;
}
.car-item{
height: 294rpx;
background-color: #ffffff;
margin-bottom: 14rpx;
padding: 0 28rpx;
}
.car-msg{
height: 196rpx;
border-bottom: 2px dotted #cfcfcf;
display: flex;
justify-content: space-between;
}
.msg-item{
display: flex;
flex-direction: column;
justify-content: space-between;
height: 196rpx;
padding: 28rpx 0;
flex: 0 0 450rpx;
}
.use-car{
width: 57rpx;
padding: 28rpx 0;
}
.use-car image{
width: 57rpx;
height: 57rpx;
}
.pencil{
width: 28rpx;
height: 28rpx;
}
.text-item{
display: flex
}
.text-item text:nth-of-type(1){
flex: 0 0 170rpx;
font-size: 32rpx;
line-height: 32rpx;
}
.text-item text:nth-of-type(2){
flex: 1 0 auto;
font-size: 32rpx;
line-height: 32rpx;
color: #cfcfcf;
}
.text-item text:nth-of-type(2).high-light{
color: #ff3333;
}
.car-change{
display: flex;
height: 98rpx;
align-items: center;
justify-content: flex-end;
}
.car-change text{
border:1px solid #cccccc;
border-radius: 28rpx;
width: 160rpx;
height: 56rpx;
font-size: 26rpx;
line-height: 56rpx;
letter-spacing: 4rpx;
color: #cccccc;
text-align: center;
margin-right: 18rpx;
}
.car-change text:last-child{
margin-right: 0;
}
\ No newline at end of file
const jsbuffer=require('../../lib/jsbuffer.min.js')
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
data: {
msg: 'welcome',
imgDotBig: imgName('mesgDot1.png'),
imgDotSmall: imgName('mesgDot2.png'),
imgAlarmBattery: imgName('alarm_battery.png'),
imgAlarmMove: imgName('alarm_move.png'),
imgArrowUp:imgName('arrowup.png'),
imgArrowDown:imgName('arrowdown.png'),
alarmClass:'alarm-warn',
alarmMsg:[{
id:'1',
open:false,
date:{
month:'二月',
day:'27'
},
mileage:'0km',
alarmNum:'35次',
travelTimes:'10次',
detail:[{
time:'09:43',
type:'battery',
msg:'电池移除',
warn:true
}, {
time: '12:43',
type: 'battery',
msg:'电池接入',
warn: false
}, {
time: '13:53',
type: 'move',
msg:'车辆轻微震动',
warn: false
}, {
time: '14:53',
type: 'move',
msg: '车辆严重震动',
warn: true
}]
}]
},
onLoad: function () {
},
getImgSrc(type){
console.log(type)
},
openDetail(e){
let a =this.data.alarmMsg.map(item=>{
if(item.id==e.target.dataset.num){
item.open=!item.open
}
return item
})
this.setData({
alarmMsg:a
})
a=null;
},
onShow: function () {
// console.log('welcome show')
// let ab=new jsbuffer().from('2152e2ac','hex')
// ab.set(0,36)
// console.log(ab)
// let ba=new jsbuffer().read(ab.buffer)
// console.log(ba)
// console.log(ab.get(2))
// console.log(ab.get(1, 'HEX'))
}
})
\ No newline at end of file
<scroll-view class='con'>
<block wx:for='{{alarmMsg}}'>
<view class='date'>
<view class='date-total'>
<view class='total-side'>
<image src='{{imgDotBig}}'></image>
</view>
<view class='total-main'>
<view>
<text>{{item.date.day}}</text>
<text>{{item.date.month}}</text>
</view>
<view class='total-item'>
<view>
<text>{{item.mileage}}</text>
<text>里程</text>
</view>
<view>
<text>{{item.alarmNum}}</text>
<text>警告</text>
</view>
<view>
<text>{{item.travelTimes}}</text>
<text>行驶次数</text>
</view>
</view>
<view class='total-arrow'>
<image src='{{item.open?imgArrowUp:imgArrowDown}}' bindtap='openDetail' data-num='{{item.id}}'></image>
</view>
</view>
</view>
<view wx:if='{{item.open}}'>
<block wx:for='{{item.detail}}'>
<view class='date-detail'>
<view class='detail-side'>
<text>{{item.time}}</text>
<image src='{{imgDotSmall}}' data-type='item.type'></image>
</view>
<view class='detail-main'>
<view class='alarm {{ item.warn?alarmClass:""}}'>
<image src='{{item.type=="battery"?imgAlarmBattery:imgAlarmMove}}'></image>
<text>{{ item.msg}}</text>
</view>
<!-- <view class='detail-arrow'>
<image src='{{imgArrowUp}}'></image>
</view> -->
</view>
</view>
</block>
</view>
</view>
</block>
</scroll-view>
\ No newline at end of file
/**index.wxss**/
page{
height: 100%;
}
.con{
height: 100%;
background-color: #efeff0;
}
.date-total{
box-sizing: border-box;
height:112rpx;
display: flex;
}
.total-side {
flex-basis: 120rpx;
flex-grow: 0;
display: flex;
align-items: flex-end;
justify-content: flex-end;
padding-right: 10rpx;
}
.total-main{
background-color: #fff;
margin-bottom: 6rpx;
display: flex;
flex-grow: 1;
padding: 10rpx 20rpx;
justify-content: space-between;
}
.total-main>view:first-child{
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
border-right: 4rpx solid #000;
}
.total-main>view:first-child text:first-child{
font-size: 42rpx;
padding-right: 14rpx;
}
.total-main>view:first-child text:nth-of-type(2){
padding-right: 22rpx;
}
.total-item{
display: flex;
align-items: center;
justify-content: space-around;
flex-grow: 1;
}
.total-item>view{
display: flex;
flex-direction: column;
align-items: center;
}
.total-arrow,.detail-arrow{
display: flex;
align-items: center;
justify-content: center;
}
.total-arrow image,.detail-arrow image{
width: 36rpx;
height: 18rpx;
}
.total-side image{
width: 24rpx;
height: 72rpx;
}
.date-detail{
box-sizing: border-box;
height: 92rpx;
display: flex;
}
.detail-side{
flex-basis: 120rpx;
flex-grow: 0;
display: flex;
align-items: center;
justify-content: flex-end;
padding-right: 14.7rpx;
}
.detail-side image{
width: 13rpx;
height: 92rpx;
}
.detail-main{
background-color: #fff;
margin: 14rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.alarm image{
width: 38rpx;
height: 38rpx;
}
.detail-main{
padding: 0 20rpx 0 10rpx ;
flex-grow:1;
}
.alarm{
display: flex;
align-items: center;
font-size: 32rpx;
}
.alarm image{
padding-right: 24rpx;
}
.alarm-warn{
color: #e76955;
}
...@@ -28,7 +28,7 @@ Page({ ...@@ -28,7 +28,7 @@ Page({
timerDevice: null, timerDevice: null,
baseMsg: true,//基础数据获取是否正常 baseMsg: true,//基础数据获取是否正常
ui: { ui: {
message: null,//消息量 message: '',//消息内容
froNo: '--',//车架号 froNo: '--',//车架号
vcuNo: '--',//中控号 vcuNo: '--',//中控号
licensePlate: '--',//号牌 licensePlate: '--',//号牌
...@@ -171,6 +171,9 @@ Page({ ...@@ -171,6 +171,9 @@ Page({
}) })
return return
} }
if (data.message) {
ui.message = data.message//消息
}
if (data.address) { if (data.address) {
ui.deviceAdress = data.address//位置 ui.deviceAdress = data.address//位置
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<view class='body-box {{tab}}'> <view class='body-box {{tab}}'>
<view class='tab-map'> <view class='tab-map'>
<map id='carMap' scale='13' markers='{{ui.locMap.markers}}' show-location bindmarkertap='markersTap' longitude='{{ui.locMap.longitude}}' latitude='{{ui.locMap.latitude}}'> <map id='carMap' scale='13' markers='{{ui.locMap.markers}}' show-location bindmarkertap='markersTap' longitude='{{ui.locMap.longitude}}' latitude='{{ui.locMap.latitude}}'>
<cover-view class='map-alarm' catchtap='toMsgPage' hidden='{{ui.message}}'> <cover-view class='map-alarm' catchtap='toMsgPage' wx:if='{{message}}'>
<cover-view>您有消息需要关注</cover-view> <cover-view>您有消息需要关注</cover-view>
<cover-image src='{{imgMore}}'></cover-image> <cover-image src='{{imgMore}}'></cover-image>
</cover-view> </cover-view>
......
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser } = require('../../lib/util.js')
Page({
data: {
imgInbefore: imgName('insurancebefore.png'),
imgIn: imgName('insurancing.png'),
imgInafter: imgName('insuranced.png'),
imgInbg: imgName('inbg.png'),
insurances: [{
id: 'baoxian1hao',
company: '众安保险',
name: '齐世宝(送到抢险)',
minDes: '用车,防盗,理赔全程指导',
des: '用车,防盗,理赔全程指导',
tip: '丢车理赔',
imgSrc: 'aaa.png',
money: '68.0'.match(/(\d+)\.(\d*)?/)
}, {
id: 'baoxian2hao',
company: '中国平安',
name: '综合意外(送到抢险)',
minDes: '用车,防盗,理赔全程指导',
des: '用车,防盗,理赔全程指导,用车,防盗,理赔全程指导,用车',
tip: '',
imgSrc: 'bba.png',
money: '35.9'.match(/(\d+)\.(\d*)?/)
}]
},
onLoad: function () {
console.log('welcome')
},
onShow: function () {
console.log('welcome show')
let a='20.8'
console.log()
}
})
\ No newline at end of file
<!--我的保险 -->
<view class='con'>
<view class='menu'>
<view class='in-title'>我的保单<view></view></view>
<view class='in-menu'>
<view class='in-item'>
<image src='{{imgInbefore}}'></image>
<text>待领取/审核</text>
</view>
<view class='in-item'>
<image src='{{imgIn}}'></image>
<text>保障中的</text>
</view>
<view class='in-item'>
<image src='{{imgInafter}}'></image>
<text>已过期</text>
</view>
</view>
</view>
<block wx:for='{{insurances}}'>
<view class='insu-item'>
<view class='insu-bg'>
<image src='{{imgInbg}}'></image>
<view class='insu-tip'>
<text>{{item.company}}</text>
<text>{{item.name}}</text>
</view>
<view class='s-label' wx:if="{{item.tip}}">{{item.tip}}</view>
</view>
<view class='insu-des'>
<text class='des'>{{item.des}}</text>
<text class='insu-mon'>
<text>{{item.money[1]}}</text><text>.{{item.money[2]}}</text><text>元</text>
</text>
</view>
</view>
</block>
</view>
\ No newline at end of file
.con{
background-color: #efeff0;
}
.menu{
margin-bottom:20rpx;
}
.in-title{
padding: 0 22rpx;
height: 62rpx;
border-bottom: 2rpx solid #bababa;
font-weight: bold;
line-height: 62rpx;
background-color: #ffffff;
}
.in-menu{
background-color:#fff;
display: flex;
justify-content: center;
}
.in-menu image{
width: 126rpx;
height: 126rpx;
}
.in-item{
height: 210rpx;
flex-basis: 204rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
line-height: 40rpx;
}
.insu-item{
height: 326rpx;
padding: 20rpx 40rpx;
background-color:#fff;
border-bottom: 2rpx solid #bababa;
}
.insu-bg{
position: relative;
}
.insu-tip{
position: absolute;
width: 420rpx;
height: 144rpx;
display: flex;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.7);
top: 50%;
margin-top:-72rpx;
padding: 0 20rpx;
justify-content: space-around;
}
.insu-tip text:nth-of-type(1){
font-size: 16px;
color: #ff7500;
padding-top: 30rpx;
}
.insu-tip text:nth-of-type(2){
font-size: 20px;
color: #ffffff;
padding-bottom: 20rpx;
}
.s-label{
position: absolute;
top: 0;
right: -38rpx;
width: 136rpx;
height: 62rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
background-color: #f87120;
}
.insu-bg image{
width: 100%;
height: 208rpx;
}
.insu-des{
/* padding-top: 30rpx; */
display: flex;
color: #888888;
justify-content: space-between;
}
.des{
flex-basis: 400rpx;
flex-grow: 0;
flex-shrink: 0;
}
.insu-mon text:nth-of-type(1){
color: #ff6d00;
font-size: 60rpx;
}
.insu-mon text:nth-of-type(2){
color: #ff6d00;
}
\ No newline at end of file
<view class='msg-body' wx:if='{{alarmMsg.length!=0}}'> <view class='msg-body' wx:if='{{alarmMsg.length!=0}}'>
<view wx:for='{{alarmMsg}}' class='msg-item' data-value='{{item}}' wx:key='{{item.timestamp}}' catchtap='showAlarm'> <view wx:for='{{alarmMsg}}' class='msg-item' data-value='{{item}}' wx:key='{{item.timestamp}}' catchtap='showAlarm'>
<image class='alarm' src='{{imgNoalarm}}'></image> <image wx:if='{{item.messageType==20}}' class='alarm' src='{{imgNomes}}'></image>
<view class='msg-content'> <image wx:if='{{item.messageType==1}}' class='alarm' src='{{imgNoalarm}}'></image>
<view>{{item.showTime}}</view> <view class='msg-content'>
<view> <view>{{item.showTime}}</view>
<text>您的车辆:</text><text class='tip'>{{item.alarmMsg}}</text> </view> <view wx:if='{{item.messageType==20}}'>
</view> <text class='tip'>{{item.alarmMsg}}</text> </view>
<image src='{{imgMore}}' class='more'></image> <view wx:if='{{item.messageType==1}}'>
<text>您的车辆:</text>
<text class='tip'>{{item.alarmMsg}}</text> </view>
</view> </view>
<!-- <view class='btn' wx:if='{{hasMorePage}}'> <image src='{{imgMore}}' class='more' wx:if='{{item.messageType==1}}'></image>
<button catchtap='getMsgList'>加载更多</button> </view>
</view> -->
</view> </view>
<view wx:else class='des'>当前没有报警记录</view> <view wx:else class='des'>当前没有报警记录</view>
\ No newline at end of file
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
data: {
imgHardOn: imgName('security_settings_on_active.png'),
imgHardOff: imgName('security_settings_on_black.png'),
imgStandardOn: imgName('security_settings_standard_active.png'),
imgStandardOff: imgName('security_settings_standard_black.png'),
imgOn: imgName('security_settings_off_active.png'),
imgOff: imgName('security_settings_off_black.png'),
imgWxOn: imgName('security_settings_wx_active.png'),
imgWxOff: imgName('security_settings_wx_black.png'),
imgPhoneOn: imgName('security_settings_telephone_active.png'),
imgPhoneOff: imgName('security_settings_telephone_black.png'),
checkOn: imgName('security_settings_unchecked_active.png'),
checkOff: imgName('security_settings_unchecked.png'),
imgMore: imgName('security_settings_more_white.png'),
imgMoreAction: imgName('chevrons_white.png'),
imgVoiceLow: imgName('voice.png'),
imgVoiceHign: imgName('voice2.png'),
settings:{
remindermode:1,
weixin:true,
phone:false
},
voiceNum: 50,
},
onLoad: function () {
console.log('welcome')
},
onShow: function () {
this.setData({
voiceNum: wx.getStorageSync('voiceNum')
})
this.getAlarmSetting()
},
getAlarmSetting(){
let that = this
api.post('api/user/userConfigInfo.json')
.then(res=>{
console.log(res)
let datamodel = res.data
if (!datamodel.telephonealarmnoti){
api.post('api/user/updateUserConfig.json', { userid: wx.getStorageSync('user').userId, telephonealarmnoti: true })
.then(res => {
that.getAlarmSetting()
})
.catch(err => {
alertTip(err)
})
}
that.setData({
settings: {
remindermode: datamodel.remindermode,
weixin: datamodel.wechatnotice,
phone: datamodel.telephonealarmnoti
}
})
})
.catch(err=>{
alertTip(err)
})
},
getWxAlarm(){
api.post('api/user/isFirstOpenWeChat.json')
.then(res=>{
console.log(res.data)
if(!res.data){
alertTip('未关注公众号')
}
})
.catch(err=>{
alertTip(err)
})
},
setSecure(e){
let This=this
api.post('api/user/updateUserConfig.json', {userid: wx.getStorageSync('user').userId,...e.currentTarget.dataset})
.then(res => {
This.getAlarmSetting()
})
.catch(err => {
alertTip(err)
})
},
//声音变化
voiceChange(e){
let that=this
api.post('api/vehicle/volume.json', { para: String(e.detail.value)})
.then(res => {
wx.setStorageSync('voiceNum', e.detail.value)
})
.catch(err => {
wx.setStorageSync('voiceNum', e.detail.value)
})
},
settingDetail(){
wx.navigateTo({
url: '/pages/user_alarm_detail_setting/user_alarm_detail_setting',
})
}
})
\ No newline at end of file
<view>
<view class='set-box'>
<view class='setting-title'>
<text class='bar'></text>
<text class='title'>车辆状态提醒模式</text>
</view>
<view class='setting-item'>
<view class='box-item' catchtap='setSecure' data-remindermode='1'>
<image src='{{settings.remindermode==1||settings.remindermode==2?imgHardOn:imgHardOff}}'></image>
<view class='text-mode'>
<text class='mode-main'>警戒模式</text>
<text class='mode-des'>所有检测到的状态都会及时通知。</text>
</view>
<image src='{{settings.remindermode==1||settings.remindermode==2?checkOn:checkOff}}'></image>
</view>
<!-- <view class='box-item' catchtap='setSecure' data-remindermode='2'>
<image src='{{settings.remindermode==2?imgStandardOn:imgStandardOff}}'></image>
<view class='text-mode'>
<text class='mode-main'>标准模式</text>
<text class='mode-des'>仅检测到风险状态时提醒。</text>
</view>
<image src='{{settings.remindermode==2?checkOn:checkOff}}'></image>
</view> -->
<view class='box-item' catchtap='setSecure' data-remindermode='3'>
<image src='{{settings.remindermode==3?imgOn:imgOff}}'></image>
<view class='text-mode'>
<text class='mode-main'>关闭通知</text>
<text class='mode-des'>关闭通知后您将无法收到车辆报警信息,请慎重操作。</text>
</view>
<image src='{{settings.remindermode==3?checkOn:checkOff}}'></image>
</view>
<view class='box-item clear-bottom' catchtap='settingDetail'>
<image src='{{imgMore}}'></image>
<view class='text-mode'>
<text class='mode-main'>更多设置</text>
<text class='mode-des'>忽略相同的设置、提醒时长设置</text>
</view>
<view class='more'>
<image src='{{imgMoreAction}}' class='more-img'></image>
</view>
</view>
</view>
</view>
<view class='set-box'>
<view class='setting-title'>
<text class='bar'></text>
<text class='title'>报警通知设置</text>
<view class='test-alarm'>测试报警</view>
</view>
<view class='setting-item'>
<view class='box-item' catchtap='getWxAlarm'>
<image src='{{settings.weixin?imgWxOn:imgWxOff}}'></image>
<view class='text-mode'>
<text class='mode-main'>微信报警通知</text>
<text class='mode-des'>通过微信公众号(请关注微信公众号)</text>
</view>
<image src='{{settings.weixin?checkOn:checkOff}}'></image>
</view>
<view class='box-item'>
<image src='{{settings.phone?imgPhoneOn:imgPhoneOff}}'></image>
<view class='text-mode'>
<text class='mode-main'>电话报警通知</text>
<text class='mode-des'>通过来电发送报警通知,每月6次免费</text>
</view>
<image src='{{settings.phone?checkOn:checkOff}}'></image>
</view>
<view class='tip'>
<text>提示:车辆网服务到期的车辆不会推送报警信息</text>
</view>
</view>
</view>
<view class='set-box'>
<view class='setting-title'>
<text class='bar'></text>
<text class='title'>车辆音量设置</text>
</view>
<view class='setting-item'>
<view class='voice-item'>
<image src='{{imgVoiceLow}}'></image>
<slider class='voice' bindchange="voiceChange" activeColor='#ffd200' step="5" value='{{voiceNum}}'/>
<image src='{{imgVoiceHign}}'></image>
</view>
</view>
</view>
</view>
\ No newline at end of file
page{
background-color: #f7f7f7;
border-top: 1px solid #ebebeb;
}
.set-box{
background-color: #ffffff;
}
.setting-title{
display: flex;
align-items: center;
height: 90rpx;
box-sizing: border-box;
font-size: 34rpx;
border-bottom: 1px solid #ebebeb;
}
.setting-title .bar{
display: inline-block;
height:34rpx;
border-left: 3px solid #d7193c;
margin: 0 26rpx 0 30rpx;
flex: 0 0 auto;
}
.setting-title .title{
flex: 1 0 auto;
}
.setting-title .test-alarm{
padding: 13rpx 30rpx;
border: 2px solid #cccccc;
border-radius: 28rpx;
font-size: 24rpx;
line-height: 24rpx;
color: #cccccc;
margin-right: 28rpx;
flex: 0 0 auto;
}
.setting-item{
padding-left: 50rpx;
margin-bottom: 14px;
}
.box-item{
display: flex;
box-sizing: border-box;
align-items: center;
padding: 20rpx 40rpx 20rpx 0;
border-bottom: 1px solid #ebebeb;
}
.box-item image:nth-of-type(1){
width: 50rpx;
height: 50rpx;
flex:0 0 auto;
margin-right: 26rpx;
}
.box-item image:nth-of-type(2),.more{
width: 50rpx;
height: 50rpx;
flex:0 0 auto;
}
.more{
display: flex;
justify-content: center;
align-items: center;
}
.more image:nth-of-type(1){
margin-right: 0;
}
.box-item image:nth-of-type(1).more-img{
width: 16rpx;
height: 30rpx;
}
.text-mode{
flex: 1 0 auto;
display: flex;
width: 468rpx;
flex-direction: column;
justify-content: space-between;
}
.mode-main{
color: #000000;
font-size: 32rpx;
padding-bottom: 12rpx;
}
.mode-des{
font-size: 22rpx;
color:#999999;
}
.tip{
height: 62rpx;
color: #d7193c;
font-size: 22rpx;
line-height: 62rpx;
}
.clear-bottom{
border-bottom: none;
}
.voice-item{
display:flex;
box-sizing:border-box;
align-items:center;
padding:20rpx 40rpx 20rpx 0;
}
.voice-item image:nth-of-type(1){
width: 24rpx;
height: 40rpx;
flex: 0 0 auto;
}
.voice-item image:nth-of-type(2){
width: 50rpx;
height: 40rpx;
flex: 0 0 auto;
}
.voice{
flex: 1 0 auto;
}
\ No newline at end of file
{ {
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"newFeature": true "newFeature": true
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "1.6.4", "libVersion": "1.6.6",
"appid": "wx2adf345dae23b51b", "appid": "wx2adf345dae23b51b",
"projectname": "%E6%99%BA%E7%A7%9F%E4%BE%A0", "projectname": "%E6%99%BA%E7%A7%9F%E4%BE%A0",
"condition": { "condition": {
......
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