Commit d3c20db2 by zhangxw

修改

1 parent abd60335
...@@ -12,6 +12,7 @@ const $Storage = new Storage() ...@@ -12,6 +12,7 @@ const $Storage = new Storage()
import { setSystem_info } from '~/utils/cache/storageApi' import { setSystem_info } from '~/utils/cache/storageApi'
// const accountInfo = wx.getAccountInfoSync() // const accountInfo = wx.getAccountInfoSync()
import { checkYqdSuper, setConfigInfo, checkScene } from '~/store/index' import { checkYqdSuper, setConfigInfo, checkScene } from '~/store/index'
import eventbus from "./utils/eventbus";
App({ App({
onLaunch() { onLaunch() {
/**挂载到wx对象 */ /**挂载到wx对象 */
...@@ -21,6 +22,7 @@ App({ ...@@ -21,6 +22,7 @@ App({
wx.$router = router wx.$router = router
wx.$modal = this.showModal wx.$modal = this.showModal
wx.$util = util wx.$util = util
wx.$eventbus = eventbus
// setConfigInfo(this.globalData) // setConfigInfo(this.globalData)
let userInfo = util.getStorageSync('dj_boutique_user_info') let userInfo = util.getStorageSync('dj_boutique_user_info')
userInfo && checkYqdSuper(this.globalData, userInfo) userInfo && checkYqdSuper(this.globalData, userInfo)
......
{ {
"pages": [ "pages": [
"pages/sceneIndex/sceneIndex",
"tabIndex/pages/index/index", "tabIndex/pages/index/index",
"pages/accountItems/accountItems", "pages/accountItems/accountItems",
"pages/nothing/nothing", "pages/nothing/nothing",
...@@ -17,7 +18,8 @@ ...@@ -17,7 +18,8 @@
"tabDate/pages/index/index", "tabDate/pages/index/index",
"tabDate/pages/detail/detail", "tabDate/pages/detail/detail",
"tabMine/pages/index/index", "tabMine/pages/index/index",
"test/pages/test" "test/pages/test",
"pages/equityPage/equityPage"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
......
// components/TabBar/TabBar.js // components/TabBar/TabBar.js
Component({ Component({
options: {
styleIsolation: 'shared'
},
/** /**
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
tabList: Array list: {
type: Array,
value: [],
observer(n) {
n && n.length && this.setData({
tabList: JSON.parse(JSON.stringify(n))
})
}
},
color: {
type: String,
observer(_color) {
this.setData({
_color
})
}
},
selectedColor: {
type: String,
observer(_selectedColor) {
this.setData({
_selectedColor
})
}
},
tabIndex: Number
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
tabIndex: 0 tabList: []
},
lifetimes: {
ready() {
this.setTab()
}
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
init() {
change(e) { wx.$util.getViewInfo(
let { '#tab-bar',
index res => {
} = e.currentTarget.dataset const thisPage = wx.$router.getPageInstance()
this.setTab(index) thisPage.setData({
tabBarHeight: res.height
})
wx.setStorageSync('tabBarHeight', res.height)
}, },
setTab(index = 0) { this
)
console.log(wx.$eventbus)
wx.$eventbus.on('changeTabBar', res => {
let { let {
tabIndex, tabList
} = this.data } = this.data, {
wx.$util.getViewInfo(`#tab-${tabIndex}`, old => { _color,
let oldLeft = old.left tabStyle,
let oldWidth = old.width changeKeyList
wx.$util.getViewInfo(`#tab-${index}`, res => {
let {
left,
width
} = res } = res
if (tabIndex != index) { tabList.map((e,index) => {
let readyLeft = oldLeft > left ? left : oldLeft changeKeyList.map((key) => {
let readyWidth = oldLeft > left ? oldLeft - left : left - oldLeft e[key] = res[key][index]
})
})
this.setData({ this.setData({
activeStyle: `width:${readyWidth - oldWidth / 2 + width / 2}px;background-color:#3582EE;border-radius:3rpx;left:${readyLeft + oldWidth / 2}px;transition: all .1s;` _color,
tabStyle,
tabList
}) })
} })
setTimeout(() => { wx.$eventbus.on('restoreTabBar', _ => {
this.restoreTabBar()
})
},
restoreTabBar() {
const {
list,
color
} = this.data
this.setData({ this.setData({
activeStyle: `width:${width}px;left:${left}px;background-color:#3582EE;`, tabList: JSON.parse(JSON.stringify(list)),
tabIndex: index tabStyle: '',
_color: color
}) })
this.triggerEvent('click', index) },
}, 100) change(e) {
}, this) let {
}, this) index
} = e.currentTarget.dataset,
{tabIndex} = this.data
if(tabIndex == index) return
this.triggerEvent('change', index)
this.restoreTabBar()
}
},
lifetimes: {
attached() {
this.init()
} }
} }
}) })
\ No newline at end of file \ No newline at end of file
<view class="tab" style="grid-template-columns: repeat({{tabList.length}}, 1fr)"> <view class="tab-bar isFullSucreen" id="tab-bar" style="{{tabStyle}}">
<block wx:for="{{tabList}}" wx:key="index"> <block wx:for="{{tabList}}" wx:key="index">
<view class="tab-item" style="color:{{tabIndex==index?'#3582EE':''}};" bindtap="change" data-index="{{index}}"> <view class="item" style="color: {{tabIndex == index ? _selectedColor :_color}};" bindtap="change" data-index="{{index}}">
<text class="tab-item-text" id="tab-{{index}}">{{item}}</text> <view class="icon-box">
<block wx:if="{{tabIndex == index}}">
<image src="{{item.selectedIconPath}}" class="active-icon" />
</block>
<block wx:else>
<image src="{{item.iconPath}}" class="icon" />
</block>
</view>
{{item.name}}
</view> </view>
</block> </block>
<view class="active-doc" style="{{activeStyle}}"></view>
</view> </view>
\ No newline at end of file \ No newline at end of file
/* components/TabBar/TabBar.wxss */ /* components/TabBar/TabBar.wxss */
.tab { .tab-bar{
position: fixed;
left: 0;
background-color: #fff; background-color: #fff;
height: 104rpx; z-index: 99;
box-sizing: border-box; width: 100%;
display: grid; height: 100rpx;
display: flex;
align-items: center; align-items: center;
font-size: 28rpx; justify-content: space-between;
color: #999999; font-size: 24rpx;
animation: show-tab-bar .5s forwards;
border-top: 1rpx solid #F4F4F5;
} }
.tab-bar .item{
.active-doc { flex: 1;
position: absolute; flex-shrink: 0;
bottom: 8rpx; display: flex;
height: 6rpx; flex-direction: column;
transition: all .25s; align-items: center;
justify-content: center;
transition: all .5s;
}
.tab-bar .item .icon-box{
width: 44rpx;
height: 44rpx;
margin-bottom: 8rpx;
}
.tab-bar .item .icon-box .active-icon{
animation: showicon .5s forwards;
} }
.tab .tab-item { @keyframes show-tab-bar {
text-align: center; 0%{
bottom: -100%;
}
100%{
bottom: 0;
}
} }
\ No newline at end of file \ No newline at end of file
...@@ -170,7 +170,12 @@ Page({ ...@@ -170,7 +170,12 @@ Page({
wx.$router.reLaunch(`${target}.${name}`, query) wx.$router.reLaunch(`${target}.${name}`, query)
wx.$SCENE = null wx.$SCENE = null
} else { } else {
wx.$router.reLaunch('tabIndex.index') // 判断开通的业务场景
if (data.isSuper) {
wx.$router.reLaunch('pages.sceneIndex')
} else {
wx.$router.go('tabIndex.index')
}
} }
// app. // app.
getYQorderInfo() getYQorderInfo()
......
// pages/equity/index.js
Page({
/**
* 页面的初始数据
*/
data: {
tabBarList: [{
name: '数字报价',
iconPath: '/images/tab-quited.png',
selectedIconPath: '/images/tab-quited-active.png',
}, {
name: '权益提单',
iconPath: '/images/tab-equity.png',
selectedIconPath: '/images/tab-equity-active.png',
}],
tabIndex: 0,
pageShow: [true, false]
},
changeTabBar(e) {
let {
pageShow
} = this.data,
tabIndex = e.detail, {
loginData,
options
} = this
this.setData({
tabIndex
})
if (!pageShow[tabIndex]) {
if (!loginData) this.onLoad()
else this.getComponentPage().onLoad && this.getComponentPage().onLoad(loginData, options)
}
this.setData({
[`pageShow[${tabIndex}]`]: true
})
this.onShow()
},
changePicker(e) {
let { value } = e.detail
let { merchantId } = this.data.merchantRange[value]
// 修改对应下标显示
app.globalData.yqdInfo.subIndex = value
let obj = {}
if (merchantId) obj.merchantId = merchantId
wx.$util.showLoading('加载中...')
api.swtichSubLoginInfo(obj).then(res => {
let { code, data, message } = res
if (code == 0) {
wx.$util.setUserInfo(data)
this.init(data)
} else {
this.showToast(message)
}
})
this.tapPicker()
},
tapPicker() {
this.setData({
moveArrow: !this.data.moveArrow
})
},
back() {
wx.$router.reLaunch('pages.sceneIndex')
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"usingComponents": {},
"navigationStyle":"custom"
}
\ No newline at end of file \ No newline at end of file
/* pages/equity/index.wxss */
\ No newline at end of file \ No newline at end of file
<!--pages/equity/index.wxml-->
<navigation-bar bindnavbarReady="navbarReady" showBack="{{true}}" bindback="back">
<picker range="{{merchantRange}}" value="{{subIndex}}" range-key="merchantName" bindchange="changePicker" bindtap="tapPicker" bindcancel="tapPicker" disabled="{{merchantRange.length < 2}}">
<view class="navigation-title">
<view class="navigation-title-text text-hide">
{{merchantRange[subIndex].merchantName}}
</view>
<view class="arrow {{moveArrow?'move':''}}" wx:if="{{merchantRange.length > 1}}">
<image src="/images/arrow-bottom.png" />
</view>
</view>
</picker>
</navigation-bar>
<view class="page">
<page-quited id="page-0" class="{{pageShow[0] && tabIndex == 0?'show':'hide'}}"></page-quited>
<page-equity id="page-1" class="{{pageShow[1] && tabIndex == 1?'show':'hide'}}"></page-equity>
</view>
<tab-bar list="{{tabBarList}}" color="#6C6C70" selectedColor="#3582EE" tabIndex="{{tabIndex}}" bindchange="changeTabBar"></tab-bar>
// pages/sceneIndex/sceneIndex.js
Page({
/**
* 页面的初始数据
*/
data: {
timeState: '',
sceneList: [{
sceneIcon: '../../images/tab-grass.png',
sceneName: '1.0 精品升级',
sceneDesc: '众筹活动',
sceneType: 1,
actived: true
}, {
sceneIcon: '../../images/tab-grass.png',
sceneName: '2.0 车损升级',
sceneDesc: '车损升级',
scencType: 0,
actived: false
}]
},
// 选择场景
selectScene(e) {
let {index} = e.target.dataset
let {sceneList} = this.data
// wx.$router.reLaunch('pages.equityPage')
wx.$router.reLaunch('tabIndex.index')
sceneList.map(i => i.actived = false)
console.log(sceneList[index])
sceneList[index].actived = true
this.setData({
sceneList
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
timeState: wx.$util.getTimeState()
})
console.log(this.data.userInfo)
wx.hideHomeButton({
success: (res) => {},
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "场景切换",
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<!--pages/sceneIndex/sceneIndex.wxml-->
<view class="layout">
<view class="user-box">
<view class="user-info">
<view class="user-avatar">
<block wx:if="{{userInfo.userAvatarUrl}}">
<image src="{{userInfo.userAvatarUrl}}"/>
</block>
<block wx:else>
<open-data type="userAvatarUrl" />
</block>
</view>
<view class="user-text">
<view class="item">{{timeState + ',' + userInfo.accountName}}</view>
<view class="merchant-name">{{userInfo.merchantName}}</view>
</view>
</view>
</view>
<view class="scene-box">
<view class="scene-item {{item.actived ? 'active' : ''}}" wx:for="{{sceneList}}" wx:key="index" bindtap="selectScene" data-index="{{index}}">
<view class="left">
<image class="scene-icon" src="{{item.sceneIcon}}"></image>
<view class="item-text">
<view class="name">{{item.sceneName}}</view>
<view class="desc">{{item.sceneDesc}}</view>
</view>
</view>
<view class="right">
<image wx:if='{{!item.actived}}' src="../../images/arrow-right.png" />
<view class="selected-class" wx:else>当前场景</view>
</view>
</view>
</view>
</view>
/* pages/sceneIndex/sceneIndex.wxss */
page {
background-color: #F3F5F7;
}
.user-box {
margin: 16px;
font-size: 28rpx;
color: #333333;
}
.user-info {
display: flex;
align-items: center;
}
.user-avatar {
width: 96rpx;
height: 96rpx;
overflow: hidden;
border-radius: 100%;
margin-right: 24rpx;
}
.user-text {
width: calc(100% - 110rpx);
}
.user-text .item {
font-size: 36rpx;
font-weight: 600;
color: #333333;
}
.user-text .merchant-name{
font-size: 26rpx;
font-weight: 400;
color: #6E6E7A;
}
.scene-box{
margin: 0 32rpx;
overflow: hidden;
}
.scene-box .scene-item{
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
height: 192rpx;
background: #FFFFFF;
box-shadow: 0 48rpx 20rpx -40rpx #D8D9E6;
border-radius: 24rpx;
padding: 32rpx;
margin: 24rpx 0;
position: relative;
}
.scene-item.active{
border: 3px solid #5877F5;
}
.scene-item .left{
display: flex;
}
.scene-item .left .scene-icon{
width: 128rpx;
height: 128rpx;
border-radius: 20rpx;
margin-right: 24rpx;
}
.scene-item .left .item-text{
padding: 16rpx 0;
}
.scene-item .left .item-text .name{
color: #333333;
font-size: 32rpx;
font-weight: 600;
}
.scene-item .left .item-text .desc{
color: #9B9B9E;
font-size: 24rpx;
font-weight: 400;
margin-top: 10rpx;
}
.scene-item .right image{
width: 14rpx;
height: 24rpx;
}
.scene-item .right .selected-class{
position: absolute;
top: -12rpx;
right: 0;
width: 128rpx;
height: 48rpx;
background: #5877F5;
border-radius: 0 24rpx 0 24rpx;
color: #FFFFFF;
font-size: 24rpx;
font-weight: 600;
display: flex;
justify-content: center;
align-items: center;
}
...@@ -9,16 +9,18 @@ Page({ ...@@ -9,16 +9,18 @@ Page({
userName: '', userName: '',
count: 60, count: 60,
verificationCount: '', verificationCount: '',
loginType: true loginType: 3,
agree: false
}, },
onRoute(loginToken) { onRoute(loginToken) {
this.setData({ this.setData({
loginToken loginToken
}) })
}, },
changeLoginType() { changeLoginType(e) {
let { type } = e.target.dataset
this.setData({ this.setData({
loginType: !this.data.loginType loginType: type
}) })
}, },
input(e) { input(e) {
...@@ -31,11 +33,18 @@ Page({ ...@@ -31,11 +33,18 @@ Page({
this.check() this.check()
}, },
check() { check() {
let arr = [this.data.mobile, this.data.code] let { mobile, code, accountNumber, password, loginType } = this.data
let arr = loginType == 1 ? [mobile, code] : [accountNumber, password]
this.setData({ this.setData({
flag: arr.findIndex(e => !e) == -1 flag: arr.findIndex(e => !e) == -1
}) })
}, },
agree() {
let {agree} = this.data
this.setData({
agree: !agree
})
},
clear(e) { clear(e) {
let target = e.currentTarget.dataset.name let target = e.currentTarget.dataset.name
this.setData({ this.setData({
...@@ -73,11 +82,12 @@ Page({ ...@@ -73,11 +82,12 @@ Page({
}) })
}, },
smsLogin() { smsLogin() {
let { flag, code, mobile } = this.data let { flag, code, mobile, loginType, accountNumber, password } = this.data
console.log(flag)
if (!flag) return if (!flag) return
wx.$util.showLoading() wx.$util.showLoading()
api if (loginType == 1) { // 手机号登录
.smsLogin({ api.smsLogin({
code, code,
mobile mobile
}) })
...@@ -102,6 +112,34 @@ Page({ ...@@ -102,6 +112,34 @@ Page({
}) })
} }
}) })
} else if (loginType == 2) { // 账号密码登录
console.log('账号密码登录成功')
api.smsLogin({
mobile: accountNumber,
code: password
})
.then(result => {
wx.$util.showLoading()
if (result.code == 0) {
let { loginUserInfoList, sessionId } = result.data
if (loginUserInfoList.length > 0) {
wx.$util.setSessionId(sessionId)
wx.$router.reLaunch('pages.accountItems')
} else {
wx.$router.reLaunch('pages.nothing')
}
} else {
wx.hideLoading()
wx.showModal({
title: '温馨提示',
content: result.message,
showCancel: false,
confirmText: '知道了',
confirmColor: '#3582EE'
})
}
})
}
}, },
playCountDown() { playCountDown() {
let { count, verificationCount } = this.data let { count, verificationCount } = this.data
......
<view class='layout'> <view class='layout'>
<block wx:if="{{!loginType}}"> <block wx:if="{{loginType == 1}}">
<view class='login-form'> <view class='login-form'>
<view class='input'> <view class='input'>
<input placeholder="请输入手机号" type="number" placeholder-style="color:#999;" style="width:calc(100% - 50rpx);" bindinput="input" data-name='mobile' value="{{mobile}}" maxlength="11"></input> <input placeholder="请输入手机号" type="number" placeholder-style="color:#999;" style="width:calc(100% - 50rpx);" bindinput="input" data-name='mobile' value="{{mobile}}" maxlength="11"></input>
...@@ -25,13 +25,37 @@ ...@@ -25,13 +25,37 @@
</view> </view>
</view> </view>
</block> </block>
<view class='box' > <block wx:if="{{loginType == 2}}">
<view class='login-form'>
<view class='input'>
<input placeholder="请输入账号" type="number" placeholder-style="color:#999;" style="width:calc(100% - 50rpx);" bindinput="input" data-name='accountNumber' value="{{accountNumber}}"></input>
<view class='clear y-center' hidden="{{!accountNumber}}" bindtap="clear" data-name='accountNumber'>
<image src="/images/clear.png"></image>
</view>
</view>
<view class='input'>
<input placeholder="请输入密码" type="password" placeholder-style="color:#999;" style="width:calc(100% - 50rpx);" bindinput="input" data-name='password' value='{{password}}'></input>
<view class='clear y-center' hidden="{{!password}}" bindtap="clear" data-name='password'>
<image src="/images/clear.png"></image>
</view>
</view>
</view>
</block>
<view class='box'>
<!-- <view class='box' style="top:{{loginType?'-264rpx':'0'}}"> --> <!-- <view class='box' style="top:{{loginType?'-264rpx':'0'}}"> -->
<view class="login-btn {{loginType?'mini':''}}"> <view class="agree" bindtap="agree" wx:if="{{loginType == 2}}">
<button size="default" hidden="{{!loginType}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button> <view class="icon {{agree}}">
<view hidden="{{!loginType}}">微信登录</view> <image src="../../components/images/radio.png" />
<view hidden="{{loginType}}" bindtap="smsLogin">登录</view> </view>
<block>30天免登录</block>
</view>
<view class="login-btn {{loginType == 3?'mini':''}}">
<button size="default" hidden="{{loginType != 3}}" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber"></button>
<view hidden="{{loginType !=3 }}">微信登录</view>
<view hidden="{{loginType == 3}}" bindtap="smsLogin">登录</view>
</view> </view>
<view class='tips' bindtap="changeLoginType">{{loginType?"手机号登录":"切换为微信登录"}}</view> <view class='tips' bindtap="changeLoginType" data-type="1" wx:if="{{loginType != 1}}">{{"手机号登录"}}</view>
<view class='tips' bindtap="changeLoginType" data-type="2" wx:if="{{loginType != 2}}">{{"账号密码登录"}}</view>
<view class='tips' bindtap="changeLoginType" data-type="3" wx:if="{{loginType != 3}}">{{"微信登录"}}</view>
</view> </view>
</view> </view>
\ No newline at end of file \ No newline at end of file
...@@ -61,6 +61,10 @@ page{ ...@@ -61,6 +61,10 @@ page{
left: 0; left: 0;
} }
.login-form .password-box{
position: relative;
}
.clear { .clear {
position: absolute; position: absolute;
right: 0; right: 0;
...@@ -131,3 +135,30 @@ page{ ...@@ -131,3 +135,30 @@ page{
.code-disabled { .code-disabled {
color: #999 !important; color: #999 !important;
} }
.agree {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
margin: 20rpx 0;
font-size: 24rpx;
color: #9B9B9E;
}
.agree .icon {
border: 2rpx solid #8A8C90;
border-radius: 100%;
width: 24rpx;
height: 24rpx;
box-sizing: border-box;
margin-right: 8rpx;
}
.agree .icon image {
display: none;
}
.agree .icon.true {
border: none;
}
.agree .icon.true image {
display: block;
}
\ No newline at end of file \ No newline at end of file
...@@ -157,7 +157,7 @@ export const checkScene = options => { ...@@ -157,7 +157,7 @@ export const checkScene = options => {
if (query && (query.scene || query.merchantId || query.type)) { if (query && (query.scene || query.merchantId || query.type)) {
if (query.merchantId) { if (query.merchantId) {
// &&options.patch == 'tabIndex/pages/index/index' // &&options.patch == 'tabIndex/pages/index/index'
let userInfo = util.getStorageSync('dj_boutique_user_info') let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
// 需要当前门店的 不是就重新登录 // 需要当前门店的 不是就重新登录
if (userInfo?.subLoginUser?.merchantId != query.merchantId) { if (userInfo?.subLoginUser?.merchantId != query.merchantId) {
wx.$SCENE = null wx.$SCENE = null
......
...@@ -129,6 +129,9 @@ Page({ ...@@ -129,6 +129,9 @@ Page({
navBarHeight navBarHeight
}) })
}, },
back() {
wx.$router.reLaunch('pages.sceneIndex')
},
tapPicker() { tapPicker() {
this.setData({ this.setData({
moveArrow: !this.data.moveArrow moveArrow: !this.data.moveArrow
...@@ -339,7 +342,7 @@ Page({ ...@@ -339,7 +342,7 @@ Page({
init(userInfo) { init(userInfo) {
getYQInfo(userInfo) getYQInfo(userInfo)
.then(result => { .then(result => {
// console.log(result) console.log(result)
// console.log(app.globalData.isYqdSuper) // console.log(app.globalData.isYqdSuper)
this.setData({ this.setData({
...result ...result
......
<view class="layout {{flag?'opacity':''}}"> <view class="layout {{flag?'opacity':''}}">
<navigation-bar bindnavbarReady="navbarReady"> <navigation-bar bindnavbarReady="navbarReady" showBack="{{true}}" bindback="back">
<picker range="{{merchantRange}}" value="{{subIndex}}" range-key="merchantName" bindchange="changePicker" bindtap="tapPicker" bindcancel="tapPicker" disabled="{{merchantRange.length < 2}}"> <picker range="{{merchantRange}}" value="{{subIndex}}" range-key="merchantName" bindchange="changePicker" bindtap="tapPicker" bindcancel="tapPicker" disabled="{{merchantRange.length < 2}}">
<view class="navigation-title"> <view class="navigation-title">
<view class="navigation-title-text text-hide"> <view class="navigation-title-text text-hide">
......
...@@ -153,6 +153,26 @@ const deepClone = obj => { ...@@ -153,6 +153,26 @@ const deepClone = obj => {
const clone = require('rfdc')({ proto: false, circles: false }) const clone = require('rfdc')({ proto: false, circles: false })
return clone(obj) return clone(obj)
} }
const getTimeState = () => {
let timeNow = new Date();
let hours = timeNow.getHours();
let text = ``
if (hours >= 0 && hours <= 6) {
text = `深夜了,不要熬夜太久哟`;
} else if (hours > 6 && hours <= 8) {
text = `早上好`;
} else if (hours > 8 && hours <= 10) {
text = `上午好`;
} else if (hours > 10 && hours <= 13) {
text = `中午好`;
} else if (hours > 13 && hours <= 17) {
text = `下午好`;
} else if (hours > 17 && hours <= 23) {
text = `晚上好`;
}
return text
}
const util = { const util = {
onReachBottom, onReachBottom,
haveEmoji, haveEmoji,
...@@ -169,7 +189,8 @@ const util = { ...@@ -169,7 +189,8 @@ const util = {
getStorageSync, getStorageSync,
getSceneId, getSceneId,
type, type,
deepClone deepClone,
getTimeState
} }
const Util = Object.assign(util, wxApi, format) const Util = Object.assign(util, wxApi, format)
// console.log('Util', Util) // console.log('Util', Util)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!