Commit bb19c791 by iambtr

维养小程序

parents
const { api, imgName, getUserInfo, wxLogin} =require('./lib/util.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 => {
console.log(res)
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
console.log(res)
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
*/
},
globalData: {
authSetting:null,
userInfo: null,
}
})
\ No newline at end of file
{
"pages": [
"pages/welcome2/welcome2",
"pages/user_index/user_index",
"pages/server_items/server_items",
"pages/user_message/user_message",
"pages/device_bind/device_bind",
"pages/my/my",
"pages/qr_code/qr_code",
"pages/server_detail/server_detail",
"pages/server_sure/server_sure",
"pages/register2/register2",
"pages/user_list/user_list"
],
"window": {
"backgroundTextStyle": "dark",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTitleText": "智租保",
"navigationBarTextStyle": "black"
},
"tabBar": {
"selectedColor": "#d7193c",
"list": [
{
"pagePath": "pages/user_index/user_index",
"text": "首页",
"iconPath": "static/image/home.png",
"selectedIconPath": "static/image/homeactive.png"
},
{
"pagePath": "pages/user_message/user_message",
"text": "所有服务",
"iconPath": "static/image/server.png",
"selectedIconPath": "static/image/serveractive.png"
},
{
"pagePath": "pages/my/my",
"text": "我的网点",
"iconPath": "static/image/person.png",
"selectedIconPath": "static/image/personactive.png"
}
]
},
"networkTimeout": {
"request": 5000
}
}
\ No newline at end of file
page{
min-height: 100%;
box-sizing: border-box;
}
view{
box-sizing: border-box;
font-size: 32rpx
}
button{
color: #ffffff;
}
\ No newline at end of file
// pages/star/star.js
const { imgName } = require('../../lib/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
titleList:{
type: Array, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
observer: function (newVal, oldVal) {
} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
},
},
/**
* 组件的初始数据
*/
data: {
activeNum: 0,
},
/**
* 组件的方法列表
*/
methods: {
//点击改变分数的函数
changeScore(e) {
// var myEventDetail = {} // detail对象,提供给事件监听函数
// var myEventOption = {} // 触发事件的选项
if (!this.data.edit) return
this.setData(
{
selfScore: Number(e.target.id) + 1
}
)
this._setStar()
},
_changeTab(e) {
let oldIndex = this.data.activeNum
let newIndex=Number(e.currentTarget.id)
let res=null//tabIn 返回false的情况可以取消tab
this.data.titleList.forEach((item,ix)=>{
if(ix == oldIndex){
if (item.tabOut){
item.tabOut()
}
}
if (ix == newIndex) {
if (item.tabIn) {
res = item.tabIn() == false ? false : true
} else {
res=true
}
}
return item
})
if(res){
this.setData({
activeNum: newIndex
})
this.triggerEvent('tabChange', { activeIndex: newIndex })
}
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--components/navbar/navbar.wxml-->
<view class='wr-tab-header'>
<view class='wr-tab-item {{activeNum==index?"active":""}}' wx:for='{{titleList}}' wx:key='{{index}}' id='{{index}}' catchtap='_changeTab'>
<text>{{item.name}}</text>
</view>
</view>
\ No newline at end of file
/* components/navbar/navbar.wxss */
.wr-tab-header{
flex: 0 0 auto;
display: flex;
justify-content: space-around;
}
.wr-tab-item{
flex: 1 0 10rpx;
text-align: center;
padding: 10rpx;
border-bottom: 2px solid transparent;
}
.active{
color: #d7193c;
border-bottom: 2px solid #d7193c;
}
\ No newline at end of file
// components/search/search.js
Component({
/**
* 组件的属性列表
*/
properties: {
maxLenth: { // 属性名
type: Number, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: 5, // 属性初始值(可选),如果未指定则会根据类型选择一个
},
placeholder: { // 属性名
type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: '输入搜索项', // 属性初始值(可选),如果未指定则会根据类型选择一个
},
showHistory: { // 属性名
type: Boolean, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: false, // 属性初始值(可选),如果未指定则会根据类型选择一个
},
},
/**
* 组件的初始数据
*/
data: {
searchHistory: [],
hasFocus:false,
searchValue:''
},
/**
* 组件的方法列表
*/
methods: {
//失去焦点
_blurInput(e){
let value = e.detail.value
setTimeout(()=>{
this.setData({
hasFocus: false,
})
},200)
this.triggerSearch(value)
},
//输入
_searchInput(e) {
let value=e.detail.value
this.triggerChange(value)
},
//聚焦
_focusInput(e){
this.setData({
hasFocus: true,
})
},
//更新历史记录
_updateHistory(key){
let historyArray=this.data.searchHistory
let newHistoryArray=null
if (historyArray.length < this.data.maxLenth){
this.data.searchHistory.unshift(key)
}else{
this.data.searchHistory.unshift(key)
this.data.searchHistory.pop()
}
this.setData({
searchHistory: this.data.searchHistory
})
},
_historyItemTap(e){
let historyValue=e.currentTarget.id
this.setData({
searchValue:historyValue
})
},
//触发搜索事件
triggerSearch(value){
this.setData({
searchValue: value
})
this.triggerEvent('search', { value })
this._updateHistory(value)
},
//触发改变事件
triggerChange(value) {
this.triggerEvent('change', { value })
}
}
})
{
"component": true,
"usingComponents": {
}
}
\ No newline at end of file
<view class='wr_search'>
<image src='./search.png'></image>
<input placeholder='{{placeholder}}' value='{{searchValue}}' confirm-type='search' bindfocus='_focusInput' bindblur='_blurInput' bindinput='_searchInput'></input>
</view>
<view class='history-box' wx:if='{{showHistory&&hasFocus}}'>
<view class='wr_search_item' wx:for='{{searchHistory}}' wx:key='{{item}}' catchtap='_historyItemTap' id='{{item}}'>{{item}}</view>
</view>
\ No newline at end of file
/* components/search/search.wxss */
.wr_search{
display: flex;
background-color: #fff;
border-radius: 6rpx;
padding: 0 20rpx;
align-items: center;
height: 80rpx;
font-size: 32rpx;
position: relative;
}
.wr_search image{
width: 36rpx;
height: 36rpx;
margin-right: 30rpx;
}
.wr_search input{
flex: 1 0 auto;
}
.history-box{
position: absolute;
width: 100%;
z-index: 1000;
background-color: #eee;
color: #fff;
}
.wr_search_item{
padding: 10rpx 10rpx 10rpx 86rpx;
}
\ No newline at end of file
// pages/star/star.js
const { imgName } = require('../../lib/util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
score: { // 属性名
type: Number, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: 5, // 属性初始值(可选),如果未指定则会根据类型选择一个
observer: function (newVal, oldVal) {
this.setData({
selfScore: newVal
})
this._setStar()
} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
},
edit:{
type: Boolean, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: false, // 属性初始值(可选),如果未指定则会根据类型选择一个
}
},
/**
* 组件的初始数据
*/
data: {
selfScore:5,
starList:[
imgName('score2.png'),
imgName('score2.png'),
imgName('score2.png'),
imgName('score2.png'),
imgName('score2.png')
]
},
/**
* 组件的方法列表
*/
methods: {
//点击改变分数的函数
changeScore(e){
// var myEventDetail = {} // detail对象,提供给事件监听函数
// var myEventOption = {} // 触发事件的选项
if(!this.data.edit) return
this.setData(
{
selfScore:Number(e.target.id)+1
}
)
this._setStar()
this.triggerEvent('scoreChange', { socre: this.data.selfScore})
},
_setStar(){
let newVal=this.data.selfScore
let starList = null
if (parseInt(newVal) != newVal) {
starList = this.data.starList.map((item, index) => {
if (index + 1 <= newVal) {
return item
} else {
if (index + 1 == parseInt(newVal) + 1) {
return imgName('score1.png')
} else {
return imgName('score0.png')
}
}
})
} else {
starList = this.data.starList.map((item, index) => {
if (index + 1 <= newVal) {
return imgName('score2.png')
} else {
return imgName('score0.png')
}
})
}
this.setData({
starList,
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--pages/star/star.wxml-->
<view class='box'>
<block wx:for='{{starList}}' wx:key="unique">
<image src='{{item}}' catchtap='changeScore' id='{{index}}'></image>
</block>
<text>{{selfScore}}分</text>
</view>
\ No newline at end of file
/* pages/star/star.wxss */
.box{
display: flex;
height: 40rpx;
font-size: 34rpx;
align-items: center;
}
image{
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
}
\ No newline at end of file
const type = 'dev'
// const type = 'pro'
var config = {
dev: {
appid: 'wx75c847665ef7211e',
appSecret: '392e69597c06b19d72327aa1ac24058a',
api: 'https://weiyang.zhizukj.com/repair/app/',
version: 'v1.0.00',
imgPath: '/static/image/'
},
pro: {
appid: 'wx75c847665ef7211e',
appSecret: '392e69597c06b19d72327aa1ac24058a',
api: 'https://zhizuxia.zhizukj.com/ydb/app/',
version: 'v1.0.00',
imgPath: '/static/image/'
}
}
module.exports = config[type]
\ No newline at end of file
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
This diff is collapsed. Click to expand it.
!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
This diff is collapsed. Click to expand it.
// pages/device_bind/device_bind.js
const { api, wxscan, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, getProtocol } = require('../../lib/util.js')
let timer=null
Page({
data: {
//img
imgTip: imgName('imgtip.png'),
imgScan:imgName('imgscan.png'),
modelScan:true,
frameNo: null,
userId:null,
rentType:0,//0团租 1个租
status:'normal',//normal 和 pedding
user:null,
agreeUserCar:true,
id:null//申请id
},
onLoad() {
let user = wx.getStorageSync('user')
let { userMapp } = user
if (!user) {
wx.redirectTo({
url: '/pages/welcome2/welcome2',
})
return
}
this.setData({
user,
rentType: userMapp.userType==1 ? 1 : 0,
userId: userMapp.id
})
},
onHide(){
clearInterval(timer)
},
onUnload(){
clearInterval(timer)
},
onShow() {
//团个租
this.getStatus(this.data.rentType)
},
scanImg(){
let This =this
if (!This.data.agreeUserCar){
alertTip('请同意租车协议')
return false
}
wxscan()
.then(frameNo=>{
This.setData({
frameNo
})
This.apiUseCar()
})
.catch(err=>{
alertTip(err)
})
},
apiUseCar(){
let This = this
if (!this.data.frameNo) {
alertTip('请输入车辆编码')
return false
}
if (!this.data.agreeUserCar) {
alertTip('请同意租车协议')
return false
}
let { frameNo, userId, rentType}=This.data
api.post('message/requestJoinCar', {
frameNo, userId, rentType
})
.then(res => {
console.log(frameNo, userId, rentType,res)
//等待。。
//团租
if (rentType==0){
This.getStatus()
timer = setInterval(() => {
This.getStatus()
}, 5000)
return
}
//个租 注册逻辑
})
.catch(err => {
console.error(err)
alertTip(err)
})
},
getStatus(userType){
let This=this
let msgType=[2,3]
console.log(userType)
api.get('message/getMessageInfo',{
userId:This.data.userId,
messageType: msgType[userType]//申请用车
},{},true)
.then(res=>{
console.log('getStatus',res)
let { state ,id } = res.data
if (!This.data.id){
This.setData({
id
})
}
switch(state){
//待审核
case 0:
This.setData({
status: 'pedding',//normal 和 pedding
})
if (!timer){
timer = setInterval(() => {
This.getStatus()
}, 5000)
}
break;
//审核通过去首页
case 1:
wx.redirectTo({
url: '/pages/user_index/user_index',
})
break;
//正常页面
default:
This.setData({
status: 'normal',//normal 和 pedding
})
clearInterval(timer)
}
})
.catch(err=>{
console.error(err)
})
},
backScan(){
this.setData({
modelScan: true
})
},
bindByHand(){
this.setData({
modelScan:false
})
},
deviceInput(e) {
this.setData({
frameNo: e.detail.value
})
},
giveUp() {
//放弃申请
let that = this
wx.showModal({
title: '提示',
content: '是否放弃申请',
success: function (res) {
if (res.confirm) {
let { frameNo, userId, id } = that.data
api.post('message/cancelJoinCar',{
id
}).then(res=>{
that.setData({
status: 'normal',
modelScan: true
})
clearInterval(timer)
}).catch(err=>{
alertTip(err)
})
}
}
})
},
//同意租车协议
hascheck(e){
this.setData({
agreeUserCar: !this.data.agreeUserCar
})
},
//进入租车协议
toProtocol(){
console.log(this.data.rentType)
getProtocol(3)
.then(res => {
console.log(res)
})
.catch(err => {
console.error(err)
alertTip(err.errMsg || err)
})
},
})
\ No newline at end of file
{
"navigationBarTitleText": "设备租赁"
}
\ No newline at end of file
<view class='con' wx:if='{{status=="normal"}}'>
<!--扫描 -->
<view class='con' wx:if='{{modelScan}}'>
<image src='{{imgScan}}' class='img-scan' bindtap='scanImg'></image>
<text class='title scan-title' bindtap='scanImg'>扫码用车</text>
<view class='insurance agree'>
<radio checked='{{agreeUserCar}}' catchtap='hascheck' color='#d7193c'></radio>
我同意智租科技
<text bindtap='toProtocol'> 《租车协议》</text>
</view>
<text class='scan' bindtap='bindByHand'>如果扫描失败,试试手动输入</text>
</view>
<!--手动输入 -->
<view class='con tip' wx:else>
<input placeholder='请输入二维码下方的编码' bindinput='deviceInput'></input>
<view class='insurance agree'>
<radio checked='{{agreeUserCar}}' catchtap='hascheck' color='#d7193c'></radio>
我同意智租科技
<text bindtap='toProtocol'>《租车协议》</text>
</view>
<button bindtap='apiUseCar' class='btn-bind'>开始用车</button>
<text class='scan' bindtap='backScan'>返回扫描添加</text>
</view>
</view>
<view class='con' wx:else>
<view class='wait-auto'>等待网点同意授权中...</view>
<view class='giveup'>
<text catchtap='giveUp'>放弃申请?</text>
</view>
</view>
\ No newline at end of file
/* pages/device_bind/device_bind.wxss */
page {
height: 100%;
}
.con {
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
height: 100%;
}
.con.tip{
background-color: #f8f8f8;
width: 100%;
}
.img-scan {
margin-top: 106rpx;
width: 210rpx;
height: 210rpx;
}
.img-tip {
margin-top: 176rpx;
width: 480rpx;
height: 190rpx;
}
.title {
font-size: 21px;
line-height: 60rpx;
}
.scan-title {
margin-top: 40rpx;
}
.des {
color: #989898;
font-size: 13px;
line-height: 60rpx;
}
.tip-title{
margin-top: 60rpx;
}
.scan {
color: #d7193c;
box-sizing: border-box;
border: 2px solid #d7193c;
height: 64rpx;
margin-top: 50rpx;
padding: 0rpx 26rpx;
border-radius: 32rpx;
line-height: 60rpx;
font-size: 13px;
}
input{
box-sizing: border-box;
width: 100%;
padding: 0 30rpx;
line-height: 110rpx;
height: 110rpx;
background-color: #fff;
font-size: 14px;
margin-top: 12px;
}
.btn-bind{
background-color: #d7193c;
font-size: 17px;
width:695rpx;
height: 90rpx;
border-radius: 90rpx;
letter-spacing: 2px;
margin: 36rpx auto;
display: flex;
align-items: center;
justify-content: center;
}
.wait-auto{
color: #d7193c;
font-size: 50rpx;
margin: 60rpx 0;
}
.giveup{
color: #666666;
font-size: 30rpx;
display: flex;
justify-content: space-between;
padding: 0 80rpx;
}
.insurance {
padding: 20rpx 0;
}
.insurance text {
color: #d7193c;
}
\ No newline at end of file
const { api,alertTip ,imgName } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
imgViplogo: imgName('viplogo.png'),
imgHeadshot: imgName('logo.png'),
imgMore: imgName('more.png'),
imgTip: imgName('tip.png'),
imgLogo: imgName('pointimg.png'),
nodePoint:{},//站点信息
userItemList: [{
msg: 0,
name: '站长列表',
icon: imgName('setting.png'),
page: '/pages/user_setting/user_setting'
}, {
msg: 0,
name: '退出登录',
icon: imgName('setting2.png'),
page: '1'
}]
},
onShow: function () {
let user=wx.getStorageSync('user').user
let {main}=user
let userItemList = [{
msg: 0,
name: '退出登录',
icon: imgName('setting2.png'),
page: '1'
}]
if (main){//主站长
userItemList = [{
msg: 0,
name: '站长列表',
icon: imgName('setting.png'),
page: '/pages/user_list/user_list'
}, {
msg: 0,
name: '退出登录',
icon: imgName('setting2.png'),
page: '1'
}]
}
this.setData({
user,
userItemList
})
this.getMyNodeInfo()
},
toDetailPage(e) {
let url = e.currentTarget.id
if (url === '1') {
//退出登录
this.loginOut()
return
}
wx.navigateTo({
url: e.currentTarget.id
})
},
//登出
loginOut() {
api.get('user/logout')
.then(res => {
wx.reLaunch({ url: '/pages/welcome2/welcome2' })
})
.catch(err => {
alertTip(err)
})
},
// 获取站点信息
getMyNodeInfo(){
api.get('user/myNodeInfo')
.then(res=>{
this.setData({
nodePoint:res.data
})
})
.catch(err=>{
console.log(err)
})
},
callphone(e){
wx.makePhoneCall({
phoneNumber: e.currentTarget.id
})
}
})
\ No newline at end of file
{"navigationBarTitleText": "我的网点"}
\ No newline at end of file
<view class='con'>
<view class='logo'>
<image src='{{nodePoint.nodePhoto?nodePoint.nodePhoto:imgLogo}}'></image>
<view class='item-dh'>{{nodePoint.nodeName}}</view>
</view>
<view>
<view class='point-des'>
<view class='item-dh'>
<text>地区:</text>
<text>{{nodePoint.province+' '+nodePoint.city+' '+nodePoint.area}}</text>
</view>
<view class='item-dh'>
<text>地址:</text>
<text>{{nodePoint.nodeAddress}}</text>
</view>
<view class='item-dh'>
<text>负责人:</text>
<text>{{nodePoint.mainUser}}</text>
</view>
<view class='item-dh' catchtap='callphone' id='{{nodePoint.innerPhone}}'>
<text>内部联系电话:</text>
<text>{{nodePoint.innerPhone}}</text>
</view>
<view class='item-dh' wx:if='{{nodePoint.parentName}}'>
<text>上级站点:</text>
<text>{{nodePoint.parentName}}</text>
</view>
</view>
</view>
<view class='i nav-item'>
<view class='layout item' wx:for="{{userItemList}}" wx:key='{{item.name}}' catchtap='toDetailPage' id='{{item.page}}'>
<view class='left'>
<image src='{{item.icon}}'></image>
<view>
<view>{{item.name}}</view>
</view>
</view>
<view class='right'>
<view class='msg-length' wx:if="{{item.msg!='0'}}">{{item.msg}}</view>
<image src='{{imgMore}}'></image>
</view>
</view>
</view>
</view>
\ No newline at end of file
page {
height: 100%;
}
.con {
height: 100%;
position: relative;
background-color: #f7f7f7;
font-size: 32rpx;
overflow: hidden;
}
.con .i {
background-color: #ffffff;
margin-bottom: 14rpx;
box-sizing: border-box;
padding: 0 28rpx;
}
.logo{
width: 100%;
height: 300rpx;
position: relative;
}
.logo image{
width: 100%;
height: 100%;
}
.logo view{
height: 80rpx;
line-height: 80rpx;
background-color:rgba(153, 153, 153, 0.6);
color: #fff;
position: absolute;
width: 100%;
left: 0;
bottom: 0;
}
.con .header {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.con .header .image {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
overflow: hidden;
}
.con .header text {
padding-top: 28rpx;
}
.con .layout {
display: flex;
align-items: center;
justify-content: space-between;
}
.con .layout .left {
display: flex;
align-items: center;
}
.con .layout .left image {
width: 35rpx;
height: 35rpx;
margin-right: 36rpx;
}
.con .layout .right {
display: flex;
justify-content: flex-end;
align-items: center;
}
.con .layout .right image {
width: 22rpx;
height: 34rpx;
margin-left: 34rpx;
}
.con .vip {
height: 140rpx;
background-color: #ffffff;
}
.con .vip .layout {
height: 100%;
}
.con .vip .left .vip-title .des {
position: relative;
color: #999999;
font-size: 30rpx;
line-height: 60rpx;
}
.con .vip .left .vip-title .des .tip {
width: 70rpx;
height: 48rpx;
position: absolute;
top: -50rpx;
right: -36rpx;
}
.con .vip .right view {
width: 166rpx;
height: 64rpx;
line-height: 64rpx;
border-radius: 64rpx;
background-color: #d7193c;
text-align: center;
color: #ffffff;
letter-spacing: 12rpx;
}
.con .nav-item .item {
height: 110rpx;
margin-bottom: 2rpx;
position: relative;
}
.con .nav-item .item::after {
content: '';
width: 665rpx;
position: absolute;
right: -28rpx;
bottom: -2rpx;
border-bottom: 2rpx solid #f7f7f7;
}
.con .nav-item .msg-length {
width: 50rpx;
height: 34rpx;
background-color: #f43333;
font-size: 24rpx;
line-height: 34rpx;
border-radius: 17rpx;
text-align: center;
color: #ffffff;
}
.con .tab {
height: 110rpx;
width: 100%;
position: absolute;
bottom: 0;
left: 0;
background-color: #d7193c;
color: #fff;
line-height: 110rpx;
text-align: center;
}
.header-top{
display: flex;
height: 280rpx;
background-color: #fff;
justify-content: center;
margin-bottom: 20rpx;
align-items: stretch
}
.header{
flex: 0 0 200rpx;
}
.top-des{
display: flex;
flex-direction: column;
align-items:flex-start;
justify-content: center;
margin-bottom: 100rpx;
}
.item-dh{
padding: 0 30rpx;
line-height: 80rpx;
background-color: #fff;
border-bottom: 1px solid #eee;
display: flex;
}
.item-dh text:nth-of-type(1){
flex: 0 0 250rpx;
}
.point-des{
margin-bottom: 50rpx;
}
\ No newline at end of file
const qrcode = require('../../lib/qrcode.js')
Page({
/**
* 页面的初始数据
*/
data: {
carCode:''
},
onLoad: function (options) {
let size = this.setCanvasSize();//动态设置画布大小
qrcode.draw(options.vcu, 'qrcCanvas', size.w, size.h);
},
backList(){
wx.navigateBack()
},
//适配不同屏幕大小的canvas
setCanvasSize: function () {
var size = {};
try {
var res = wx.getSystemInfoSync();
var scale = 750 / 500;//不同屏幕下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
{}
\ No newline at end of file
<canvas class='qrcode' catchtap='backList' canvas-id="qrcCanvas"/>
\ No newline at end of file
/* pages/test/test.wxss */
page{
height: 100%;
}
.qrcode{
width: 500rpx;
height: 500rpx;
position: absolute;
top: 50%;
left: 50%;
margin-top: -250rpx;
margin-left:-250rpx;
background:#f1f1f1;
}
\ No newline at end of file
const {
api,
alertTip,
getProtocol
} = require('../../lib/util.js')
var t = {}
Page({
data: {
inputAccount: null,
inputPassword: null,
inputPasswordAgain: null,
id: '', //用户id
inType: '2' //使用类型 0修改自身改密 1修改副账户密码 2新增用户
},
onLoad: function(query) {
this.setData({
inType: query.type,
id: query.id||''
})
},
onShow: function() {
},
numInput(e) {
this.setData({
[e.target.id]: e.detail.value
})
},
canBind(willTip) {
if (this.data.inType == 2) {
if (!this.data.inputAccount) {
willTip && alertTip('请输入账号!')
return false
}
}
if (!this.data.inputPassword) {
willTip && alertTip('请输入密码!')
return false
}
if (this.data.inputPasswordAgain != this.data.inputPassword) {
willTip && alertTip('两次输入的密码不一样!')
return false
}
return true
},
sureFormat() {
if (this.canBind(true)) {
let {
id,
inputAccount,
inputPassword
} = this.data
console.log(id,
inputAccount,
inputPassword)
switch (this.data.inType) {
case '0':
api.get('user/updatePwd', {
password: inputPassword
})
.then(res => {
alertTip('修改成功', () => {
wx.navigateBack()
})
})
.catch(err => {
alertTip(err)
})
break;
case '1':
api.get('user/updateUser', {
id,
password: inputPassword
})
.then(res => {
alertTip('修改成功', () => {
wx.navigateBack()
})
})
.catch(err => {
alertTip(err)
})
break;
case '2':
api.get('user/addUser', {
account: inputAccount,
password: inputPassword
})
.then(res => {
alertTip('增加成功', () => {
wx.navigateBack()
})
})
.catch(err => {
alertTip(err)
})
break;
}
}
}
})
\ No newline at end of file
{
"navigationBarTitleText": "用户注册"
}
\ No newline at end of file
<view class='con'>
<view class='form-box'>
<view class='phone list' hidden='{{inType!=2}}'>
<text class='form-tip'>账号</text>
<input type='text' id='inputAccount' placeholder='请输入账号' bindinput='numInput'></input>
</view>
<view class='phone-sure list'>
<text class='form-tip'>密码</text>
<input type='text' id='inputPassword' password placeholder='请输入密码' bindinput='numInput'></input>
</view>
<view class='phone-sure list'>
<text class='form-tip'>确认密码</text>
<input type='text' id='inputPasswordAgain' password placeholder='请再次输入密码' bindinput='numInput'></input>
</view>
</view>
<button bindtap='sureFormat'>确定</button>
</view>
\ No newline at end of file
page{
position: relative;
min-height: 100%;
padding-bottom: 50rpx;
background-color: #f8f8f8;
}
.con {
min-height: 100%;
padding: 14px 30rpx 0;
text-align: left;
}
.con text,.con view{
font-size: 28rpx;
}
.form-box {
width:750rpx;
margin-left: -30rpx;
background-color: #fff;
}
.form-tip{
flex-basis: 220rpx;
flex-shrink: 0;
}
.phone {
width: 100%;
}
.list {
height: 110rpx;
display: flex;
align-items: center;
padding: 0 30rpx;
border-bottom: 2rpx solid #f8f8f8;
}
.list input{
flex-grow: 1;
}
.msg {
color: #ffffff;
background-color: #2f2f2f;
border-radius: 62rpx;
padding: 18rpx 26rpx;
flex: 0 0 auto;
}
.msg.des{
color:#eee;
}
.insurance {
display: flex;
color: #7d7d7d;
}
.agree{
display: flex;
justify-content: center;
align-items: center;
}
.insurance text {
color: #d7193c;
}
.radio{
margin-right:10rpx;
}
button {
background-color: #d7193c;
border-radius: 90rpx;
letter-spacing: 4px;
margin: 36rpx auto;
}
.mode{
justify-content: flex-start;
}
.point{
flex: 1;
}
\ No newline at end of file
// pages/server_detail/server_detail.js
// pages/server_items/server_items.js
const { api, previewPic,confirmTip,formatTime, mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
orderNo:'--',
id:null,//订单编号
orderTime:'--',
receiveTime: '--',
completeTime: '--',
cancleTime: '--',
state: -1,
stateName: '--',
userPerson: '--',
vehicleModel: '--',
frameNo: '--',
vcuNo: '--',
pics: [],
comment: '--',
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id:options.serverId
})
this.resetUi()
},
resetUi(){
let that=this
api.get('order/orderDetail', { id: that.data.id })
.then(res => {
let { orderNo, cancleTime, comment, completeTime, createAt, frameNo, id, manHourFee, nodeId, orderTime, pics, price, receiveTime, repairComment, repairUserId, state, userId, userName, userPhone, vcuNo, vehicleModel } = res.data
let stateName = ['已下单', '已接单', '已完成', '已评价', '已取消'][state]
let userPerson = userName + (userPhone && `(${userPhone})`)
orderTime = orderTime ? formatTime(new Date(orderTime)) : null
receiveTime = receiveTime ? formatTime(new Date(receiveTime)) : null
completeTime = completeTime ? formatTime(new Date(completeTime)) : null
cancleTime = cancleTime ? formatTime(new Date(cancleTime)) : null
pics = pics ? pics.split(',') : []
this.setData({
orderNo,
id,
orderTime,
receiveTime,
completeTime,
cancleTime,
state,
stateName,
userPerson,
vehicleModel,
frameNo,
vcuNo,
pics,
comment,
})
})
.catch(err => {
alertTip(err)
})
},
//接单
receiveOrder(){
let that = this
let id = that.data.id
if (!id) {
alertTip('数据不正常', () => {
wx.navigateBack()
})
}
confirmTip('您确认接单?',()=>{
api.get('order/receiveOrder', { id })
.then(res => {
console.log(res)
alertTip('接单成功', () => {
that.resetUi()
})
})
.catch(err => {
alertTip(err)
})
})
},
//处理订单
toItems(){
let id = this.data.id
if (!id) {
alertTip('数据不正常', () => {
wx.navigateBack()
})
}
confirmTip('您确认处理工单?', () => {
wx.navigateTo({
url: '/pages/server_items/server_items?id=' + id,
})
})
},
previewPic(e){
let { src,list} = e.currentTarget.dataset;
previewPic(src, list)
}
})
\ No newline at end of file
{
"navigationBarTitleText": "预约服务详情"
}
\ No newline at end of file
<view class='con'>
<scroll-view class='items' scroll-y>
<view class='title item'>
<text>服务单号:{{orderNo}}</text>
<text>{{stateName}}</text>
</view>
<view class='time item'>保修用户:{{userPerson}}</view>
<view class='time item' hidden='{{!orderTime}}'>预约时间:{{orderTime}}</view>
<view class='time item' hidden='{{!receiveTime}}'>接单时间:{{receiveTime}}</view>
<view class='time item' hidden='{{!completeTime}}'>完成时间:{{completeTime}}</view>
<view class='time item' hidden='{{!cancleTime}}'>取消时间:{{cancleTime}}</view>
<view class='time item'>车型:{{vehicleModel}}</view>
<view class='time item'>车架号:{{frameNo}}</view>
<view class='time item'>VCU:{{vcuNo}}</view>
<view class='car-des item' hidden='{{pics.length==0}}'>
<view>图片:</view>
<view class='des-body'>
<image src='{{item}}' catchtap='previewPic' data-src="{{item}}" data-list="{{pics}}" wx:for='{{pics}}' wx:key='{{index}}'></image>
</view>
</view>
<view class='problem item'>
<text>问题描述:</text>
<text>{{comment}}</text>
</view>
</scroll-view>
<view class='aciton' wx:if='{{state==0}}'>
<text catchtap='receiveOrder'>接单</text>
</view>
<view class='aciton' wx:if='{{state==1}}'>
<text catchtap='toItems'>处理</text>
</view>
</view>
\ No newline at end of file
/* pages/server_detail/server_detail.wxss */
page{
height: 100%;
}
.con{
height: 100%;
padding-bottom: 150rpx;
}
.item{
padding:30rpx 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 2rpx solid #eee;
}
.items{
height: 100%;
overflow: hidden;
}
.time{
background-color: #ffffff;
}
.title{
background-color: #eee;
}
.title text:nth-of-type(2){
color: #d7193c;
}
.problem{
align-items: flex-start;
justify-content: flex-start;
}
.problem text:nth-of-type(1){
flex: 0 0 170rpx;
}
.problem text:nth-of-type(2){
flex: 1 0 300rpx;
}
.car-des{
justify-content: flex-start;
}
.car-des image{
width: 150rpx;
height: 150rpx;
margin-right: 20rpx;
}
.des-body{
flex: 1 0 auto;
}
.des-item{
display: flex;
padding: 10rpx 0;
}
.des-item text:nth-of-type(1){
flex: 0 0 120rpx;
}
.aciton{
position: absolute;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
padding: 50rpx;
background-color: transparent;
display: flex;
justify-content: space-between;
align-items: center;
}
.aciton text{
padding: 20rpx 0;
text-align: center;
}
.aciton text:nth-of-type(1){
background-color: #d7193c;
color: #ffffff;
flex: 1 0 300rpx;
border-radius: 10rpx;
margin-right: 20rpx;
}
.aciton text:nth-of-type(2){
background-color: #ffffff;
color: #d7193c;
border: 1px solid #d7193c;
flex: 1 0 300rpx;
border-radius: 10rpx;
}
\ No newline at end of file
// pages/server_items/server_items.js
const { api, mapApi, formatTime, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
selectList:[],//选中类目的数组id
selectItems:[],//选中的内容数组
showList:[],//显示数组
originList: [],//原始数组
imgSearch:imgName('search.png'),
imgSelectrue: imgName('security_settings_unchecked.png'),
imgSelect: imgName('security_settings_unchecked_active.png'),
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
id: options.id
})
this.getRepairItemsList()
},
searchInput(e){
this.setShowList(e.detail.value)
},
searchComfirm(e){
this.setShowList(e.detail.value)
},
setShowList(value){
let newList = this.data.originList.map(item => {
let index = this.data.selectList.indexOf(item.id)
if (index == -1) {
item.check = false
} else {
item.check = true
}
return item
})
if (!value) {
this.setData({
showList: newList
})
return
}
let showList = newList.filter(item => {
return new RegExp(value).test(item.name)
})
this.setData({
showList
})
},
//选择单项
selectItem(e){
let id=e.currentTarget.id
let selectList = this.data.selectList
let index = selectList.indexOf(Number(id))
if (index==-1){
selectList.push(Number(id))
}else{
selectList.splice(index,1)
}
let selectItems = this.data.originList.filter(item=>{
return selectList.indexOf(Number(item.id))!=-1
})
this.setData({
selectList,
selectItems
})
this.setShowList()
},
//next 下一步
toNext(){
if (this.data.selectItems.length==0){
alertTip('未选择任何维修项目')
return
}
wx.navigateTo({
url: '/pages/server_sure/server_sure?id='+this.data.id,
})
},
//拿到维修项目
getRepairItemsList(){
api.get('order/repairItemsList')
.then(res=>{
let dataLists = res.items.map(item=>{
item.check=false
item.time = item.manHours+'工时'
item.fee ='¥'+item.materialFee
return item
})
this.setData({
showList: dataLists,
originList: dataLists
})
})
.catch(err=>{
alertTip(err)
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "选择维修项目",
"usingComponents": {
"wr-serach": "/components/search/search"
}
}
\ No newline at end of file
<view class='con'>
<view class='search'>
<wr-serach onchange='searchInput' onsearch='searchComfirm'></wr-serach>
</view>
<scroll-view scroll-y class='scroll'>
<view wx:for='{{showList}}' wx:key='{{item.id}}' class='server-item' id='{{item.id}}' catchtap='selectItem'>
<view class='hascheck'>
<image src='{{imgSelect}}' wx:if='{{item.check}}'></image>
<image src='{{imgSelectrue}}' wx:else></image>
</view>
<view class='item-title'>
<text>{{item.name}}</text>
<text class='label' wx:if='{{item.tip}}'>出保</text>
</view>
<view class='item-time'>
{{item.time}}
</view>
<view class='item-fee'>
{{item.fee}}
</view>
</view>
</scroll-view>
<view class='next'>
<text class='tip'>已选择{{selectList.length}}项</text>
<button catchtap='toNext'>下一步</button>
</view>
</view>
\ No newline at end of file
page,.con{
height: 100%;
overflow: hidden;
}
.con{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: stretch;
}
.search{
flex: 0 0 auto;
padding: 20rpx 30rpx;
background-color: #eee;
}
.scroll{
flex: 1 0 200rpx;
overflow: hidden;
}
.next{
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 30rpx;
}
.next button{
background-color: #d7193c;
font-size: 32rpx;
width: 300rpx;
margin: 0
}
.tip{
color: #d7193c;
}
.server-item{
display: flex;
padding: 20rpx 30rpx;
justify-content: space-between;
}
.hascheck{
margin-right: 40rpx;
}
.hascheck image{
width: 40rpx;
height: 40rpx;
}
.item-title{
flex: 1 0 50rpx;
}
.label{
font-size: 24rpx;
line-height: 24rpx;
color: #fff;
background-color: #d7193c;
padding: 6rpx 20rpx;
border-radius: 30rpx;
margin-left: 10rpx;
}
.item-time{
flex: 0 0 130rpx;
}
.item-fee{
flex: 0 0 130rpx;
text-align: right;
}
\ No newline at end of file
// pages/server_sure/server_sure.js
const { api, formatTime, uploadResource,mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
prevPage:null,
totalTime:null,
repairComment:'',
totalMoney: null,
videos:'',//视频
pics: [],//图片
imgScan: imgName('imgscan.png'),
imgClose: imgName('close.png'),
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2]; //上一个页面
let totalTime = prevPage.data.selectItems.reduce((total,item)=>{
return total+item.manHours
},0)
let totalMoney = prevPage.data.selectItems.reduce((total, item) => {
return total + item.materialFee
},0)
this.setData({
prevPage,
showList: prevPage.data.selectItems,
totalMoney,
items: prevPage.data.selectList.join(','),
totalTime,
id: prevPage.data.id
})
},
repairCommentInput(e){
let repairComment=e.detail.value
this.setData({
repairComment
})
},
//完成订单
completeOrder(){
let { id, items, repairComment, videos,pics}=this.data
let repairPics=pics.join(',').trim()
api.get('order/completeOrder',{
id, items, repairComment, videos, repairPics
})
.then(res=>{
alertTip('提交成功',()=>{
wx.switchTab({
url: '/pages/user_index/user_index'
});
})
})
.catch(err=>{
alertTip(err)
})
},
//选择图片
upimg: function () {
var that = this;
let hasImgLength = this.data.pics.length
if (hasImgLength < 3) {
wx.chooseImage({
count: 3 - hasImgLength, // 默认9
sizeType: ['original', 'compressed'],
success: function (res) {
uploadResource(res.tempFilePaths)
.then(picsRe=>{
let pics = that.data.pics.concat(picsRe)
that.setData({
pics
})
})
.catch(err=>{
alertTip('上传图片失败')
})
}
})
} else {
alertTip('最多上传三张图片')
}
},
//选择视频
upvideos: function () {
var that = this;
wx.chooseVideo({
sourceType: ['album', 'camera'],
maxDuration: 60,
success: function (res) {
that.setData({
videos: res.tempFilePath
})
uploadResource(res.tempFilePath,'视频')
.then(videos => {
that.setData({
videos
})
})
.catch(err => {
alertTip('上传视频失败')
})
}
})
},
//删除图片
deleteImg(e) {
let index = Number(e.currentTarget.id)
this.data.pics.splice(index, 1)
this.setData({
pics: this.data.pics
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
}
})
\ No newline at end of file
{}
\ No newline at end of file
<view class='con'>
<scroll-view scroll-y class='scroll'>
<view class='total-title'>选择项:</view>
<view class='total-item'>
<view wx:for='{{showList}}' wx:key='{{item.id}}' class='server-item' id='{{item.id}}'>
<view class='item-title'>
<text>{{item.name}}</text>
<text class='label' wx:if='{{item.tip}}'>出保</text>
</view>
<view class='item-time'>
{{item.time}}
</view>
<view class='item-fee'>
{{item.fee}}
</view>
</view>
</view>
<view class='total'>
<view class='total-title'>总计:</view>
<view class='total-other total-item'>
<view>
<text>工时:</text>
<text class='tip'>{{totalTime}}工时</text>
</view>
<view>
<text>材料费:</text>
<text class='tip'>¥{{totalMoney}}</text>
</view>
</view>
</view>
<view class='total'>
<view class='total-title'>维修评论:</view>
<view class='total-other total-item'>
<textarea placeholder='请输入维修评论' bindinput='repairCommentInput'></textarea>
</view>
</view>
<view class='total'>
<view class='total-title'>视频上传:</view>
<view class='total-other total-item upload' catchtap='upvideos'>
<image src='{{imgScan}}' hidden='{{videos}}'></image>
<text>{{videos?'视频已上传(点击替换)':''}}</text>
</view>
</view>
<view class='total'>
<view class='total-title'>图片上传:</view>
<view class='total-other total-item upload'>
<block wx:for="{{pics}}" wx:key="unique">
<view class='logoinfo'>
<image class='close' id='{{index}}' src='{{imgClose}}' catchtap='deleteImg'></image>
<image src='{{item}}'></image>
</view>
</block>
<image bindtap="upimg" src='{{imgScan}}'></image>
</view>
</view>
</scroll-view>
<view class='next'>
<button catchtap='completeOrder'>完成订单</button>
</view>
</view>
\ No newline at end of file
/* pages/server_sure/server_sure.wxss */
@import '../server_items/server_items.wxss'
.next{
text-align: center;
}
.next button{
margin: auto;
}
.total-title{
font-size: 36rpx;
font-weight: bold;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
padding:30rpx;
}
.total-item,server-item{
box-sizing: border-box;
padding-left: 170rpx;
padding-right: 30rpx;
line-height: 60rpx;
}
.total-other{
padding-left: 200rpx;
}
.tip{
color: #d7193c;
}
textarea{
border:1px solid #eee;
margin-top: 30rpx;
box-sizing: border-box;
width: 100%;
}
.upload{
padding-top: 50rpx;
padding-bottom: 50rpx;
display: flex;
}
.upload image{
width: 100rpx;
height: 100rpx;
vertical-align: middle;
margin-right:20rpx;
}
.upload image{
width: 100rpx;
height: 100rpx;
}
.logoinfo{
position: relative;
}
.upload image.close{
position: absolute;
top: 0;
right: 0;
width:50rpx;
height: 50rpx;
}
\ No newline at end of file
const config = require('../../config/index.js')
const { api, formatTime, mapApi, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
let orderState = ['已下单', '已接单', '已完成', '已完成', '已取消']
let serverTimer = null//数据轮询 订单列表
Page({
/**
* 页面的初始数据
*/
data: {
showList:[],//服务数组
messageNum:0,
imgSensitize: imgName('sensitize.png'),
imgHasalarm: imgName('hasalarm.png'),
page: 1,//当前页面
hasMorePage: false,//更多页面
},
markerTap() {
},
//消息
toMsgPage() {
wx.navigateTo({
url: '/pages/user_message/user_message',
})
},
//服务详情
toServerDetail(e){
let serverId=e.currentTarget.id
wx.navigateTo({
url: '/pages/server_detail/server_detail?serverId='+serverId,
})
},
onLoad: function () {
},
onHide: function () {
clearInterval(serverTimer)
},
onUnload() {
clearInterval(serverTimer)
},
onShow: function () {
let that=this
that.getOrderList()
serverTimer=setInterval(()=>{
that.getOrderList()
},5000)
},
getOrderList() {
//获取订单
let that=this
api.get('order/orderList',
{curPage: this.data.page,state:'0,1'}
,true)
.then(res => {
let showList = res.items.map(item => {
item.orderTime = formatTime(new Date(item.orderTime))
item.state = ['未接单', '已接单'][item.state]
item.pics = item.pics.split(',')[0] || imgName('logo.png')
return item
})
this.setData({
showList: that.data.page === 1 ? showList : that.data.showList.concat(showList),
hasMorePage: res.model.haveMore,
page: res.model.haveMore ? that.data.page + 1 : 1,
})
if (this.data.showList.length !== 0 && res.model.haveMore){
clearInterval(serverTimer)
}
})
.catch(err => {
alertTip(err)
})
}
})
\ No newline at end of file
{
"navigationBarTitleText": "智租保",
"enablePullDownRefresh": true
}
\ No newline at end of file
<!--pages/user_index/user_index.wxml-->
<view class='con'>
<view class='header' hidden='{{messageNum==0}}'>
<!-- <view class='item sensitize'>
<image src='{{imgSensitize}}'></image>
激活
</view> -->
<view class='item notify-num'>
<image src='{{imgHasalarm}}'></image>
通知
<text>{{messageNum}}</text>
</view>
</view>
<view class='notify' wx:if='{{showList.length==0}}'>
<text class='tip'>您暂无需要处理的事务</text>
</view>
<scroll-view wx:else class='server-list' scroll-y>
<view class='server-title'>
您有 <text>{{showList.length}}</text> 个待处理的预约服务
</view>
<view class='list-item' wx:for='{{showList}}' wx:key='{{item.id}}' id='{{item.id}}' catchtap='toServerDetail'>
<image src='{{item.pics}}'></image>
<view class='item-des item-text'>
<text>单号:{{item.orderNo}}</text>
<text>车型:{{item.vehicleModel}}</text>
<text>用户:{{item.userName}}</text>
<text>手机:{{item.userPhone}}</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='getOrderList'>加载更多</button>
</view>
</scroll-view>
</view>
page{
height: 100%;
}
.con{
height: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
}
.header{
height: 100rpx;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom:2rpx solid #eeeeee;
}
.item{
width: 280rpx;
padding: 10rpx 30rpx;
display: flex;
align-items: center;
justify-content: center;
border: 2rpx solid #d7193c;
border-radius: 10rpx;
}
.item image{
width: 50rpx;
height: 50rpx;
padding-right: 20rpx;
}
.notify-num text{
color: #fff;
border-radius:25rpx;
padding: 4rpx 20rpx;
background-color: #d7193c;
margin-left: 10rpx;
line-height: 26rpx;
font-size: 24rpx;
}
.notify{
flex: 1 0 auto;
display: flex;
justify-content: center;
align-items: center;
}
.tip{
color: #d7193c;
font-size: 40rpx;
}
.server-list{
flex: 1 0 200rpx;
overflow: hidden;
}
.server-title{
border-bottom:2rpx solid #eeeeee;
padding: 0 30rpx;
font-weight: 700;
}
.server-title text{
color: #d7193c;
font-size: 40rpx;
line-height: 60rpx;
}
.list-item{
padding: 30rpx;
border-bottom:2rpx solid #eeeeee;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
}
.list-item image{
flex: 0 0 auto;
width: 80rpx;
height: 80rpx;
margin-right: 30rpx;
}
.item-text{
display: flex;
flex-direction: column;
justify-content: space-around;
align-self: stretch;
flex: 1 0 200rpx;
}
.item-state{
align-items: flex-end;
flex: 0 0 30rpx;
flex-wrap: wrap;
text-align: right;
white-space: pre-wrap;
}
.low-text{
color: #cccccc;
}
.tip2{
color: #d7193c;
}
.btn{
padding: 30rpx;
}
.btn button{
background-color: #d7193c;
}
\ No newline at end of file
const { api, mapApi, formatTime, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation } = require('../../lib/util.js')
Page({
/**
* 页面的初始数据
*/
data: {
userList:[]//用户列表
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getUserList()
},
//获取所有的站长
getUserList(){
api.get('user/userList')
.then(res=>{
this.setData({
userList:res.items
})
})
.catch(err=>{
alertTip(err)
})
},
changeState(e){
let item=e.currentTarget.dataset.item
let that=this
api.get('user/changeState', { id:item.id,state:Math.abs(item.state-1)})
.then(res=>{
alertTip('修改成功',()=>{
that.getUserList()
})
})
.catch(err=>{
alertTip(err)
})
},
deleteUser(e) {
let item = e.currentTarget.dataset.item
let that = this
api.get('user/deleteUser', { id: item.id})
.then(res => {
alertTip('删除成功', () => {
that.getUserList()
})
})
.catch(err => {
alertTip(err)
})
},
updateUser(e) {
let item = e.currentTarget.dataset.item
let type1=1
//使用类型 0修改自身改密 1修改副账户密码 2新增用户
if(item.main){
type1 = 0
}
wx.navigateTo({
url: '/pages/register2/register2?type='+type1+'&id='+item.id,
})
},
addUser(){
wx.navigateTo({
url: '/pages/register2/register2?type=2',
})
}
})
\ No newline at end of file
{}
\ No newline at end of file
<view class='con'>
<view class='user-item' wx:for='{{userList}}' wx:key='{{item.id}}'>
<view class='user-name'>
{{item.account}}
</view>
<text class='label'>{{item.main?'主':'副'}}</text>
<view class='btn-group'>
<text class='btn' data-item='{{item}}' catchtap='changeState' hidden='{{item.main}}'>{{item.state?'已禁用':'已启用'}}</text>
<text class='btn' data-item='{{item}}' catchtap='deleteUser' hidden='{{item.main}}'>删除</text>
<text class='btn' data-item='{{item}}' catchtap='updateUser'>改密</text>
</view>
</view>
<button catchtap='addUser'>新增用户</button>
</view>
\ No newline at end of file
/* pages/user_list/user_list.wxss */
.con{
padding: 0 30rpx;
}
button{
margin: 50rpx;
background-color: #d7193c;
}
.user-item{
margin-bottom: 50rpx;
position: relative;
height: 200rpx;
border-radius: 10rpx;
box-shadow: 0px 4px 6px #eee;
text-align: center;
}
.label {
position: absolute;
right: 10rpx;
top:20rpx;
padding: 10rpx 20rpx;
background-color: #d7193c;
color: #fff;
border-radius:40rpx;
}
.user-name{
height: 100rpx;
font-weight: bold;
line-height: 100rpx;
}
.btn-group{
display: flex;
justify-content: space-around;
}
.btn{
padding: 20rpx 40rpx;
background-color: #eee;
border-radius: 6rpx;
}
\ No newline at end of file
const { api, mapApi, formatTime, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser, userLocation} = require('../../lib/util.js')
let serverTimer=null
let orderState = ['已下单', '已接单', '已完成', '已评价', '已取消']
Page({
data: {
//标题数据
titleList:[
{
name:'全部'
},
{
name: '已下单'
},
{
name: '已接单'
},
{
name: '已完成'
},
{
name: '已取消'
}
],
state:-1,
showList:[],
imgNomes: imgName('nomes.png'),
page: 1,//当前页面
hasMorePage: false,//更多页面
searhValue:''
},
onLoad(){
// this.getOrderList()
},
onShow: function () {
this.getOrderList()
},
//搜索
apiSearch(e){
this.setData({
page:1,
searhValue:e.detail.value
})
this.getOrderList()
},
tabChange(e){
let index=e.detail.activeIndex
let stateArray=[-1,0,1,'2,3',4]
this.setData({
page:1,
state: stateArray[index]
})
this.getOrderList()
},
getOrderList(){
let that=this
let op = {
curPage: that.data.page,
state: that.data.state
}
if (this.data.searhValue != '') { op.name = this.data.searhValue}
api.get('order/orderList', op )
.then(res=>{
let showList = res.items.map(item=>{
item.orderTime = formatTime(new Date(item.orderTime))
item.state = orderState[item.state]
item.pics=item.pics.split(',')[0]||imgName('logo.png')
return item
})
this.setData({
showList: that.data.page === 1 ? showList : that.data.showList.concat(showList),
hasMorePage: res.model.haveMore,
page: res.model.haveMore ? that.data.page+1:1,
})
})
.catch(err=>{
alertTip(err)
})
},
//服务详情
toServerDetail(e) {
let serverId = e.currentTarget.id
// console.log(e)
wx.navigateTo({
url: '/pages/server_detail/server_detail?serverId=' + serverId,
})
},
})
\ No newline at end of file
{
"usingComponents": {
"navbar": "/components/navbar/navbar",
"wr-serach": "/components/search/search"
}
}
\ No newline at end of file
<view class='msg-read'>
<view class='search'>
<wr-serach onchange='apiSearch' placeholder='搜索预约单号/用户名/预约用户手机'></wr-serach>
</view>
<navbar titleList='{{titleList}}' ontabChange='tabChange'></navbar>
<scroll-view class='list-body' scroll-y>
<view wx:if='{{showList.length!=0}}'>
<view class='list-item' wx:for='{{showList}}' wx:key='{{item.serverNum}}' id='{{item.id}}' catchtap='toServerDetail'>
<image src='{{item.pics}}'></image>
<view class='item-des item-text'>
<text>单号:{{item.orderNo}}</text>
<text>车型:{{item.vehicleModel}}</text>
<text>用户:{{item.userName}}</text>
<text>手机:{{item.userPhone}}</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='getOrderList'>加载更多</button>
</view>
</view>
<view wx:else class='no-list'>
<text class='tip2'>不存在任何订单</text>
</view>
</scroll-view>
</view>
\ No newline at end of file
page{
height: 100%;
}
.msg-read{
display: flex;
flex-direction: column;
height: 100%;
}
.list-body{
flex: 1 0 100rpx;
overflow: hidden;
}
.list-item{
padding: 30rpx;
border-bottom:2rpx solid #eeeeee;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 28rpx;
}
.list-item image{
flex: 0 0 auto;
width: 80rpx;
height: 80rpx;
margin-right: 30rpx;
}
.item-text{
display: flex;
flex-direction: column;
justify-content: space-around;
align-self: stretch;
flex: 0 0 200rpx;
}
.item-state{
align-items: flex-end;
flex-wrap: wrap;
text-align: right;
white-space: pre-wrap;
}
.low-text{
color: #cccccc;
}
.tip2{
color: #d7193c;
}
.no-list{
padding: 50rpx;
text-align: center;
}
.search{
padding: 20rpx 20rpx;
background-color: #eee;
}
.btn{
padding: 30rpx;
}
.btn button{
background-color: #d7193c;
}
\ No newline at end of file
const { api, imgName, getUserInfo, wxLogin, alertTip, authAgainByUser } = require('../../lib/util.js')
Page({
data: {
title:'智租科技',
titleDes:'这是一段描述',
//图片
imgLogo: imgName('logo.png'),
imgPerson: imgName('sign_in_phone_white.png'),
imgLock: imgName('sign_in_password_white.png'),
user:null
},
onLoad: function () {
// wx.removeStorageSync('user')
},
onUnload(){},
onHide() {},
//登录
formSubmit(e){
if (!e.detail.value.account) {
alertTip('请输入账号!')
return false
}
if (!e.detail.value.password) {
alertTip('请输入密码!')
return false
}
let that=this
api.get('user/login',e.detail.value)
.then(res => {
let user=res.data
wx.setStorageSync('user', user)
wx.switchTab({
url: '/pages/user_index/user_index'
});
})
.catch(err => {
alertTip(err)
})
},
forgetPassword() {
// wx.navigateTo({
// url: '/pages/forgetpassword/forgetpassword',
// })
}
})
\ No newline at end of file
{
}
\ No newline at end of file
<view class='con'>
<image class='logo' src='{{imgLogo}}'></image>
<form class='from-login' bindsubmit="formSubmit" report-submit>
<view class='form-item'>
<label for='account'>
<image src='{{imgPerson}}'></image>
</label>
<input id='account' name='account' placeholder='请输入账号'></input>
</view>
<view class='form-item'>
<label for='password'>
<image src='{{imgLock}}'></image>
</label>
<input type='text' name='password' id='password' password placeholder='请输入密码'></input>
</view>
<button formType="submit">登录</button>
</form>
<!-- <view class='forget'>
<text catchtap='forgetPassword'>忘记密码?</text>
</view> -->
</view>
\ No newline at end of file
page {
height: 100%;
}
.con {
height: 100%;
text-align: center;
padding-top: 78rpx;
position: relative;
}
.con .logo {
width: 236rpx;
height: 236rpx;
}
.con .from-login {
display: block;
padding: 60rpx 62rpx 30rpx 62rpx;
}
.con .from-login .form-item {
box-sizing: border-box;
border: 4rpx solid #cccccc;
border-radius: 45rpx 45rpx;
background-color: #ffffff;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 35rpx;
display: flex;
align-items: center;
justify-content: flex-start;
text-align: left;
font-size: 14px;
}
.con .from-login .form-item label {
width: 76rpx;
padding-left: 34rpx;
height: 42rpx;
line-height: 42rpx;
flex-grow: 0;
}
.con .from-login .form-item image {
width: 42rpx;
height: 42rpx;
margin-right: 34rpx;
}
.con .from-login .form-item input {
flex-grow: 1;
}
button {
margin-top: 82rpx;
background-color:#d7193c;
color:#fff;
font-size: 34rpx;
height: 90rpx;
border-radius: 45rpx;
letter-spacing: 4px;
}
.con .forget,.giveup{
color: #666666;
font-size: 30rpx;
display: flex;
justify-content: space-between;
padding: 0 80rpx;
}
.wait-auto{
color: #d7193c;
font-size: 50rpx;
margin: 60rpx 0;
}
.form-tip{
flex-basis: 220rpx;
flex-shrink: 0;
text-align: start;
}
.phone {
width: 100%;
}
.list {
height: 110rpx;
display: flex;
align-items: center;
padding: 0 30rpx;
border-bottom: 2rpx solid #f8f8f8;
}
.list input{
flex-grow: 1;
}
.radio-group{
flex: 1;
display: flex;
justify-content: space-between
}
.btn{
width: 80%;
}
.point{
flex: 1;
text-align: start;
}
.giveup2{
justify-content: flex-end;
}
\ No newline at end of file
{
"description": "项目配置文件。",
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true
},
"compileType": "miniprogram",
"libVersion": "1.6.6",
"appid": "wx75c847665ef7211e",
"projectname": "%E6%99%BA%E7%A7%9F%E4%BF%9D",
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
\ No newline at end of file
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