Browse Source

引入 vant UI 组件

master
巴林闲侠 2 years ago
parent
commit
46fe8133ef
  1. 2
      weapp/package.json
  2. 142
      weapp/package/troubleshooting/index.js
  3. 6
      weapp/package/troubleshooting/index.json
  4. 33
      weapp/package/troubleshooting/index.wxml
  5. 52
      weapp/package/troubleshooting/index.wxss
  6. 9
      weapp/project.config.json
  7. 15
      weapp/project.private.config.json

2
weapp/package.json

@ -4,9 +4,9 @@
"description": "", "description": "",
"main": ".eslintrc.js", "main": ".eslintrc.js",
"dependencies": { "dependencies": {
"@vant/weapp": "^1.10.14",
"tdesign-miniprogram": "^1.0.0-rc.2" "tdesign-miniprogram": "^1.0.0-rc.2"
}, },
"devDependencies": {},
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },

142
weapp/package/troubleshooting/index.js

@ -1,66 +1,84 @@
// package/bindTroubleshooting/index.js // package/bindTroubleshooting/index.js
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
// hidden: true,
}, currentTab: '0',
},
/**
* 生命周期函数--监听页面加载 // 顶部tab切换
*/ clickTab (e) {
onLoad(options) { this.setData({
currentTab: e.currentTarget.dataset.current
}, })
if (e.currentTarget.dataset.current == '0') {
/** this.setData({
* 生命周期函数--监听页面初次渲染完成 page: 0,
*/ dataList: []
onReady() { }, () => {
// this.getPatrolPlan();
}, })
} else if (e.currentTarget.dataset.current == '1') {
/** // this.getPatrolRecord();
* 生命周期函数--监听页面显示 }
*/ },
onShow() {
/**
}, * 生命周期函数--监听页面加载
*/
/** onLoad (options) {
* 生命周期函数--监听页面隐藏
*/ },
onHide() {
/**
}, * 生命周期函数--监听页面初次渲染完成
*/
/** onReady () {
* 生命周期函数--监听页面卸载
*/ },
onUnload() {
/**
}, * 生命周期函数--监听页面显示
*/
/** onShow () {
* 页面相关事件处理函数--监听用户下拉动作
*/ },
onPullDownRefresh() {
/**
}, * 生命周期函数--监听页面隐藏
*/
/** onHide () {
* 页面上拉触底事件的处理函数
*/ },
onReachBottom() {
/**
}, * 生命周期函数--监听页面卸载
*/
/** onUnload () {
* 用户点击右上角分享
*/ },
onShareAppMessage() {
/**
} * 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage () {
}
}) })

6
weapp/package/troubleshooting/index.json

@ -1,3 +1,7 @@
{ {
"usingComponents": {} "usingComponents": {
"van-button": "@vant/weapp/button/index",
"van-field": "@vant/weapp/field/index",
"van-cell-group": "@vant/weapp/cell-group/index"
}
} }

33
weapp/package/troubleshooting/index.wxml

@ -1,2 +1,31 @@
<!--package/bindTroubleshooting/index.wxml--> <!-- package/bindTroubleshooting/index.wxml -->
<text>package/bindTroubleshooting/index.wxml</text> <view class="page">
<!-- 顶部tab切换 -->
<view class='swiper-tab'>
<view class="swiper-tab-item" data-current="0" bindtap="clickTab" style="{{currentTab=='0' ? 'color:#1979ff' : 'color:black'}}">
待办事项
</view>
<view class="swiper-tab-item" data-current="1" bindtap="clickTab" style="{{currentTab=='1' ? 'color:#1979ff' : 'color:black'}}">
已办事项
</view>
</view>
<view>
s
</view>
<view style="height:100vh - 98rpx; padding-top:24rpx; overflow:auto">
<van-cell-group inset class="mission-card">
<view class="mission-card-title">
<span>asd</span>
<van-button type="primary">按钮</van-button>
</view>
<van-field value="输入框已禁用" label="点位名称" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="异常等级" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="任务下发时间" readonly border="{{ false }}" />
</van-cell-group>
<!-- 暂无数据 -->
<view hidden="{{hidden}}">
<image class="noData" src="../../images/noData.png"></image>
<view class="noTxt">暂无数据~</view>
</view>
</view>
</view>

52
weapp/package/troubleshooting/index.wxss

@ -1 +1,53 @@
/* package/bindTroubleshooting/index.wxss */ /* package/bindTroubleshooting/index.wxss */
.page {
min-height: 100vh;
background: #F7F7FA;
position: relative;
}
/* 顶部tab */
.swiper-tab {
display: flex;
height: 98rpx;
line-height: 98rpx;
width: 100%;
/* position: fixed; */
top: 0;
z-index: 100;
background: #fff;
border-bottom: 2rpx solid #e8e8e8;
}
.swiper-tab-item {
flex: 1;
font-size: 28rpx;
text-align: center;
color: #333333;
position: relative;
}
.noData {
width: 254rpx;
height: 298rpx;
display: block;
margin: 0rpx auto 16rpx;
}
.noTxt {
font-size: 30rpx;
color: #999;
font-weight: bold;
text-align: center;
}
/* 任务卡片 */
.mission-card {}
.mission-card-title {
background-color: #fff;
overflow: auto;
padding: 24rpx 12rpx;
display: flex;
justify-content: space-between;
align-items: center
}

9
weapp/project.config.json

@ -27,9 +27,14 @@
"useApiHook": true, "useApiHook": true,
"useApiHostProcess": true, "useApiHostProcess": true,
"showShadowRootInWxmlPanel": true, "showShadowRootInWxmlPanel": true,
"packNpmManually": false, "packNpmManually": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
],
"enableEngineNative": false, "enableEngineNative": false,
"packNpmRelationList": [],
"minifyWXSS": true, "minifyWXSS": true,
"showES6CompileOption": false, "showES6CompileOption": false,
"minifyWXML": true, "minifyWXML": true,

15
weapp/project.private.config.json

@ -4,5 +4,18 @@
"urlCheck": false, "urlCheck": false,
"compileHotReLoad": true "compileHotReLoad": true
}, },
"projectname": "%E8%BF%90%E7%BB%B4%E5%B7%A1%E6%A3%80" "projectname": "%E8%BF%90%E7%BB%B4%E5%B7%A1%E6%A3%80",
"condition": {
"miniprogram": {
"list": [
{
"name": "运维巡检",
"pathName": "package/troubleshooting/index",
"query": "",
"launchMode": "default",
"scene": null
}
]
}
}
} }
Loading…
Cancel
Save