新增专区,调整分页bug

This commit is contained in:
2024-09-05 14:05:14 +08:00
parent b990456593
commit 9a6c4d30f4
24 changed files with 448 additions and 9 deletions

96
pages/special/index.js Normal file
View File

@@ -0,0 +1,96 @@
// pages/special/index.js
import { getServicesList } from '../../service/system'
import request from '../../utils/request'
import { alertInfo } from '../../utils/index'
const { OK } = request;
Page({
/**
* 页面的初始数据
*/
data: {
servicesList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
async init() {
const { code, message, data } = await getServicesList()
if (code !== OK) {
alertInfo(message);
return;
}
this.setData({ servicesList: data })
},
clickService(e) {
console.log('e', e)
const { type, value } = e.currentTarget.dataset.data;
switch(type) {
case 0:
const [appId, path] = value.split(",")
wx.navigateToMiniProgram({
appId: appId,
path: path
})
break;
case 1:
wx.navigateTo({
url: value,
})
break;
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.init()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

9
pages/special/index.json Normal file
View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"navigator": "/components/navigator/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index",
"van-image": "@vant/weapp/image/index"
},
"navigationStyle": "custom"
}

11
pages/special/index.wxml Normal file
View File

@@ -0,0 +1,11 @@
<!--pages/special/index.wxml-->
<navigator title="专区" />
<view class="servicesWrapper">
<van-row>
<van-col span="8" wx:for="{{ servicesList }}" wx:key="id">
<view class="image" bind:tap="clickService" data-data="{{item}}">
<van-image width="200rpx" height="200rpx" src="{{item.url}}" />
</view>
</van-col>
</van-row>
</view>

6
pages/special/index.wxss Normal file
View File

@@ -0,0 +1,6 @@
/* pages/special/index.wxss */
.image {
width: 100%;
height: auto;
padding: 40rpx;
}