暂存首页改造,banner

This commit is contained in:
qiaomu 2024-11-26 17:00:51 +08:00
parent cfad35ec52
commit 6af35a4632
16 changed files with 209 additions and 18 deletions

View File

@ -22,7 +22,8 @@
"pages/special/index",
"pages/encyclopedia/index",
"pages/encyclopediaDetail/index",
"pages/workBench/index"
"pages/workBench/index",
"pages/webPage/index"
],
"subPackages": [
{

View File

@ -1,7 +1,7 @@
/* components/avatar/index.wxss */
.wrapper {
width: 120rpx;
height: 120rpx;
width: 100rpx;
height: 100rpx;
border-radius: 50%;
background: radial-gradient(circle, var(--light-green), var(--middle-green),var(--deep-green) );
display: flex;

View 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;
}
}
}
})

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-image": "@vant/weapp/image/index"
}
}

View 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>

View File

@ -0,0 +1 @@
/* pages/home/components/home-swiper/index.wxss */

View File

@ -27,6 +27,7 @@ Page({
{ name: '微信支付', },
{ name: '对公支付' },
],
},
/**

View File

@ -9,7 +9,8 @@
"picker": "/components/picker/index",
"van-grid": "@vant/weapp/grid/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"
}

View File

@ -20,7 +20,7 @@
</view>
<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>
</view>
<view class="logined" wx:else>
@ -30,9 +30,10 @@
<view class="companyName"> {{tenement.name}} </view>
<van-icon name="arrow-down" style="margin-left: 16rpx;" />
</view>
<view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view>
<!-- <view class="welcome"> 欢迎使用华昌宝能用电管理系统! </view> -->
</view>
</view>
<home-swiper wx:if="{{park.id}}" park="{{park.id}}" />
<view class="rechargeWrapper">
<view class="card">
<view class="cardTop">
@ -40,13 +41,13 @@
<view wx:if="{{user.id}}"> {{ tenement.shortName}} - {{ meter.address }} </view>
<view wx:else> -- </view>
</view>
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}">
<van-icon name="exchange" />
切换电表
<van-button type="info" size="small" plain="{{true}}" class="loginBtn" bind:click="changeMeter" wx:if="{{user.id}}" >
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="exchange" />
切换电表</view>
</van-button>
</view>
<view class="cardContent">
<view class="cardItem">
<!-- <view class="cardItem">
<view class="cardItemLabel"> 电表编号: </view>
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.code}} </view>
<view class="cardItemValue" wx:else> -- </view>
@ -55,15 +56,15 @@
<view class="cardItemLabel"> 电表地址: </view>
<view class="cardItemValue" wx:if="{{user.id}}"> {{meter.address}} </view>
<view class="cardItemValue" wx:else> -- </view>
</view>
</view> -->
<view class="cardItem">
<view class="cardItemLabel"> 电表余额: </view>
<view class="cardItemValue" style="position: relative;">
<view class="text" wx:if="{{user.id}}"> {{meter.money}} </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-icon name="replay" />
刷新
<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}}">
<view style="width: 160rpx;display: flex;justify-content: center;"><van-icon name="replay" />
刷新</view>
</van-button>
</view>
</view>
@ -86,11 +87,14 @@
size="large"
type="digit"
/>
<van-button color="rgb(88, 165, 141)" bind:click="recharge">
<view style="width: 100rpx"> 去缴费 </view>
</van-button>
</view>
</view>
<view class="operate">
<van-button color="rgb(88, 165, 141)" block bind:click="recharge">去缴费</van-button>
</view>
<!-- <view class="operate">
</view> -->
<view class="others">
<van-grid direction="horizontal" column-num="2">
<van-grid-item icon="balance-list-o" text="电费账单" bind:click="jumpToOrder">

View File

@ -34,7 +34,7 @@
}
.notLoginWrapper, .logined {
padding: 24rpx 32rpx;
padding: 16rpx 32rpx;
padding-left: 50rpx;
background-color: var(--middle-green);
display: flex;
@ -62,6 +62,7 @@
.rechargeWrapper {
background: linear-gradient(to bottom, var(--middle-green), #fff );
overflow: hidden;
padding-top: 24rpx;
}
.card {
@ -153,6 +154,8 @@
.moneyInput {
margin-top: 24rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
}
.others {

67
pages/webPage/index.js Normal file
View 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
View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

2
pages/webPage/index.wxml Normal file
View File

@ -0,0 +1,2 @@
<!--pages/webPage/index.wxml-->
<web-view src="{{path}}"></web-view>

1
pages/webPage/index.wxss Normal file
View File

@ -0,0 +1 @@
/* pages/webPage/index.wxss */

View File

@ -10,6 +10,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/my/index",
"pathName": "pages/my/index",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "childPackage/pages/electricQuery/index",
"pathName": "childPackage/pages/electricQuery/index",

View File

@ -49,4 +49,9 @@ export const getEncyclopediaList = async function(categoryId, page) {
// 获取分类列表
export const getEncyclopediaDetail = async function(id) {
return await GET(`/wx/getEncyclopediaDetail/${id}`);
}
// 获取分类列表
export const getBannerList = async function(park = "", address = "") {
return await GET(`/wx/getBannerList?park=${park}&address=${address}`);
}