暂存首页改造,banner
This commit is contained in:
parent
cfad35ec52
commit
6af35a4632
3
app.json
3
app.json
|
@ -22,7 +22,8 @@
|
||||||
"pages/special/index",
|
"pages/special/index",
|
||||||
"pages/encyclopedia/index",
|
"pages/encyclopedia/index",
|
||||||
"pages/encyclopediaDetail/index",
|
"pages/encyclopediaDetail/index",
|
||||||
"pages/workBench/index"
|
"pages/workBench/index",
|
||||||
|
"pages/webPage/index"
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* components/avatar/index.wxss */
|
/* components/avatar/index.wxss */
|
||||||
.wrapper {
|
.wrapper {
|
||||||
width: 120rpx;
|
width: 100rpx;
|
||||||
height: 120rpx;
|
height: 100rpx;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
|
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
68
pages/home/components/home-swiper/index.js
Normal file
68
pages/home/components/home-swiper/index.js
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
import { getBannerList } from "../../../../service/system"
|
||||||
|
import { alertInfo } from "../../../../utils/index";
|
||||||
|
import request from '../../../../utils/request'
|
||||||
|
|
||||||
|
const { OK } = request;
|
||||||
|
|
||||||
|
// pages/home/components/home-swiper/index.js
|
||||||
|
Component({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组件的属性列表
|
||||||
|
*/
|
||||||
|
properties: {
|
||||||
|
park: String,
|
||||||
|
},
|
||||||
|
observers: {
|
||||||
|
'park': function(newValue) {
|
||||||
|
this.init(newValue)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
indicatorDots: true,
|
||||||
|
vertical: false,
|
||||||
|
autoplay: false,
|
||||||
|
interval: 2000,
|
||||||
|
duration: 500,
|
||||||
|
list: [],
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 组件的方法列表
|
||||||
|
*/
|
||||||
|
methods: {
|
||||||
|
async init(park) {
|
||||||
|
const { code, message, data = [] } = await getBannerList(park, 1);
|
||||||
|
if (code !== OK) {
|
||||||
|
alertInfo(message);
|
||||||
|
this.setData({ list: [] })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ list: data })
|
||||||
|
},
|
||||||
|
handleJump(e) {
|
||||||
|
const { data = {} } = e.currentTarget.dataset;
|
||||||
|
switch(data.jumpType) {
|
||||||
|
case 1:
|
||||||
|
wx.navigateToMiniProgram({
|
||||||
|
appId: data.appId,
|
||||||
|
path: data.wxPath,
|
||||||
|
envVersion: "trial"
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
wx.navigateTo({
|
||||||
|
url: data.value,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '/pages/webPage/index?path=' + data.value,
|
||||||
|
})
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
6
pages/home/components/home-swiper/index.json
Normal file
6
pages/home/components/home-swiper/index.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-image": "@vant/weapp/image/index"
|
||||||
|
}
|
||||||
|
}
|
21
pages/home/components/home-swiper/index.wxml
Normal file
21
pages/home/components/home-swiper/index.wxml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<!--pages/home/components/home-swiper/index.wxml-->
|
||||||
|
<swiper
|
||||||
|
indicator-dots="{{indicatorDots}}"
|
||||||
|
autoplay="{{autoplay}}"
|
||||||
|
interval="{{interval}}"
|
||||||
|
duration="{{duration}}"
|
||||||
|
wx:if="{{list.length}}"
|
||||||
|
>
|
||||||
|
<block wx:for="{{list}}" wx:key="{{item.id}}" wx:item="item">
|
||||||
|
<swiper-item>
|
||||||
|
<van-image
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
lazy-load
|
||||||
|
src="{{item.url}}"
|
||||||
|
data-data="{{item}}"
|
||||||
|
bind:click="handleJump"
|
||||||
|
/>
|
||||||
|
</swiper-item>
|
||||||
|
</block>
|
||||||
|
</swiper>
|
1
pages/home/components/home-swiper/index.wxss
Normal file
1
pages/home/components/home-swiper/index.wxss
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* pages/home/components/home-swiper/index.wxss */
|
|
@ -27,6 +27,7 @@ Page({
|
||||||
{ name: '微信支付', },
|
{ name: '微信支付', },
|
||||||
{ name: '对公支付' },
|
{ name: '对公支付' },
|
||||||
],
|
],
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
"picker": "/components/picker/index",
|
"picker": "/components/picker/index",
|
||||||
"van-grid": "@vant/weapp/grid/index",
|
"van-grid": "@vant/weapp/grid/index",
|
||||||
"van-grid-item": "@vant/weapp/grid-item/index",
|
"van-grid-item": "@vant/weapp/grid-item/index",
|
||||||
"van-action-sheet": "@vant/weapp/action-sheet/index"
|
"van-action-sheet": "@vant/weapp/action-sheet/index",
|
||||||
|
"home-swiper": "./components/home-swiper/index"
|
||||||
},
|
},
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
|
<view class="login" wx:if="{{!user || !user.id}}" class="notLoginWrapper">
|
||||||
<van-image width="100rpx" height="100rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
|
<van-image width="80rpx" height="80rpx" src="/assets/images/defaultAvatar.png" class="defaultAvatar"/>
|
||||||
<van-button type="primary" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
|
<van-button type="primary" size="small" plain="{{true}}" class="loginBtn" bind:tap="jumpToLogin">请登录</van-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="logined" wx:else>
|
<view class="logined" wx:else>
|
||||||
|
@ -30,9 +30,10 @@
|
||||||
<view class="companyName"> {{tenement.name}} </view>
|
<view class="companyName"> {{tenement.name}} </view>
|
||||||
<van-icon name="arrow-down" style="margin-left: 16rpx;" />
|
<van-icon name="arrow-down" style="margin-left: 16rpx;" />
|
||||||
</view>
|
</view>
|
||||||
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
|
<!-- <view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<home-swiper wx:if="{{park.id}}" park="{{park.id}}" />
|
||||||
<view class="rechargeWrapper">
|
<view class="rechargeWrapper">
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<view class="cardTop">
|
<view class="cardTop">
|
||||||
|
@ -40,13 +41,13 @@
|
||||||
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
|
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
|
||||||
<view wx:else> -- </view>
|
<view wx:else> -- </view>
|
||||||
</view>
|
</view>
|
||||||
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}">
|
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}" >
|
||||||
<van-icon name="exchange" />
|
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="exchange" />
|
||||||
切换电表
|
切换电表</view>
|
||||||
</van-button>
|
</van-button>
|
||||||
</view>
|
</view>
|
||||||
<view class="cardContent">
|
<view class="cardContent">
|
||||||
<view class="cardItem">
|
<!-- <view class="cardItem">
|
||||||
<view class="cardItemLabel"> 电表编号: </view>
|
<view class="cardItemLabel"> 电表编号: </view>
|
||||||
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
|
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
|
||||||
<view class="cardItemValue" wx:else> -- </view>
|
<view class="cardItemValue" wx:else> -- </view>
|
||||||
|
@ -55,15 +56,15 @@
|
||||||
<view class="cardItemLabel"> 电表地址: </view>
|
<view class="cardItemLabel"> 电表地址: </view>
|
||||||
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
|
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
|
||||||
<view class="cardItemValue" wx:else> -- </view>
|
<view class="cardItemValue" wx:else> -- </view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="cardItem">
|
<view class="cardItem">
|
||||||
<view class="cardItemLabel"> 电表余额: </view>
|
<view class="cardItemLabel"> 电表余额: </view>
|
||||||
<view class="cardItemValue" style="position: relative;">
|
<view class="cardItemValue" style="position: relative;">
|
||||||
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
|
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </view>
|
||||||
<view class="text" wx:else> --- </view>
|
<view class="text" wx:else> --- </view>
|
||||||
<van-button type="info" size="small" plain="{{true}}" custom-style="position: absolute; right: 0; bottom: 0;z-index: 99;" bind:click="refreshMeter" wx:if="{{user.id}}">
|
<van-button type="info" size="small" plain="{{true}}" custom-style="position: absolute; right: -20rpx; bottom: -20rpx;z-index: 99;" bind:click="refreshMeter" wx:if="{{user.id}}">
|
||||||
<van-icon name="replay" />
|
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="replay" />
|
||||||
刷新
|
刷新</view>
|
||||||
</van-button>
|
</van-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -86,11 +87,14 @@
|
||||||
size="large"
|
size="large"
|
||||||
type="digit"
|
type="digit"
|
||||||
/>
|
/>
|
||||||
|
<van-button color="rgb(88, 165, 141)" bind:click="recharge">
|
||||||
|
<view style="width: 100rpx"> 去缴费 </view>
|
||||||
|
</van-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="operate">
|
<!-- <view class="operate">
|
||||||
<van-button color="rgb(88, 165, 141)" block bind:click="recharge">去缴费</van-button>
|
|
||||||
</view>
|
</view> -->
|
||||||
<view class="others">
|
<view class="others">
|
||||||
<van-grid direction="horizontal" column-num="2">
|
<van-grid direction="horizontal" column-num="2">
|
||||||
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">
|
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.notLoginWrapper, .logined {
|
.notLoginWrapper, .logined {
|
||||||
padding: 24rpx 32rpx;
|
padding: 16rpx 32rpx;
|
||||||
padding-left: 50rpx;
|
padding-left: 50rpx;
|
||||||
background-color: var(--middle-green);
|
background-color: var(--middle-green);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -62,6 +62,7 @@
|
||||||
.rechargeWrapper {
|
.rechargeWrapper {
|
||||||
background: linear-gradient(to bottom, var(--middle-green), #fff );
|
background: linear-gradient(to bottom, var(--middle-green), #fff );
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
padding-top: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
|
@ -153,6 +154,8 @@
|
||||||
.moneyInput {
|
.moneyInput {
|
||||||
margin-top: 24rpx;
|
margin-top: 24rpx;
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.others {
|
.others {
|
||||||
|
|
67
pages/webPage/index.js
Normal file
67
pages/webPage/index.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
// pages/webPage/index.js
|
||||||
|
Page({
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面的初始数据
|
||||||
|
*/
|
||||||
|
data: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面加载
|
||||||
|
*/
|
||||||
|
onLoad(options) {
|
||||||
|
const { path } = options
|
||||||
|
this.setData({ path })
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
|
*/
|
||||||
|
onReady() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面显示
|
||||||
|
*/
|
||||||
|
onShow() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面隐藏
|
||||||
|
*/
|
||||||
|
onHide() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生命周期函数--监听页面卸载
|
||||||
|
*/
|
||||||
|
onUnload() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||||||
|
*/
|
||||||
|
onPullDownRefresh() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 页面上拉触底事件的处理函数
|
||||||
|
*/
|
||||||
|
onReachBottom() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户点击右上角分享
|
||||||
|
*/
|
||||||
|
onShareAppMessage() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
3
pages/webPage/index.json
Normal file
3
pages/webPage/index.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
2
pages/webPage/index.wxml
Normal file
2
pages/webPage/index.wxml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!--pages/webPage/index.wxml-->
|
||||||
|
<web-view src="{{path}}"></web-view>
|
1
pages/webPage/index.wxss
Normal file
1
pages/webPage/index.wxss
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/* pages/webPage/index.wxss */
|
|
@ -10,6 +10,13 @@
|
||||||
"condition": {
|
"condition": {
|
||||||
"miniprogram": {
|
"miniprogram": {
|
||||||
"list": [
|
"list": [
|
||||||
|
{
|
||||||
|
"name": "pages/my/index",
|
||||||
|
"pathName": "pages/my/index",
|
||||||
|
"query": "",
|
||||||
|
"launchMode": "default",
|
||||||
|
"scene": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "childPackage/pages/electricQuery/index",
|
"name": "childPackage/pages/electricQuery/index",
|
||||||
"pathName": "childPackage/pages/electricQuery/index",
|
"pathName": "childPackage/pages/electricQuery/index",
|
||||||
|
|
|
@ -50,3 +50,8 @@ export const getEncyclopediaList = async function(categoryId, page) {
|
||||||
export const getEncyclopediaDetail = async function(id) {
|
export const getEncyclopediaDetail = async function(id) {
|
||||||
return await GET(`/wx/getEncyclopediaDetail/${id}`);
|
return await GET(`/wx/getEncyclopediaDetail/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取分类列表
|
||||||
|
export const getBannerList = async function(park = "", address = "") {
|
||||||
|
return await GET(`/wx/getBannerList?park=${park}&address=${address}`);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user