zhaoxiaohai 3 лет назад
Родитель
Сommit
d28c1fc1ff

+ 22 - 0
components/Yl_Headline/index.js

@@ -0,0 +1,22 @@
+Component({
+  properties: {
+    title: String,
+    type: {
+      type: String,
+      value: "default", //默认类型 switch-开关
+    },
+    switchLabel: String, //开关标签,type==switch生效
+    switch: Boolean, //开关属性值,type==switch生效
+    callBack: Function
+  },
+  methods: {
+    /* 改变开关状态 */
+    changeSwitch() {
+      let showAll = !this.data.switch;
+      this.setData({
+        switch: showAll
+      })
+      this.triggerEvent("callBack", showAll)
+    }
+  }
+})

+ 6 - 0
components/Yl_Headline/index.json

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

+ 10 - 0
components/Yl_Headline/index.wxml

@@ -0,0 +1,10 @@
+<view class="box">
+  <view class="title">{{title}}</view>
+  <view class="rep">
+    <view class="switch" wx:if="{{type=='switch'}}">
+      <text catchtap='changeSwitch'>{{switchLabel}}</text>
+      <van-switch checked="{{ switch }}" size='44rpx' catchtap='changeSwitch' />
+    </view>
+    <slot wx:else />
+  </view>
+</view>

+ 38 - 0
components/Yl_Headline/index.wxss

@@ -0,0 +1,38 @@
+.box {
+  display: flex;
+  align-items: center;
+  width: 100vw;
+  height: 90rpx;
+  padding: 0 30rpx;
+  box-sizing: border-box;
+}
+
+.box .title {
+  font-size: 30rpx;
+  font-family: PingFang SC-Bold, PingFang SC;
+  font-weight: bold;
+  color: #333333;
+  flex-shrink: 0;
+}
+
+.box .rep {
+  flex: 1;
+  height: 100%;
+  margin-left: 20rpx;
+}
+
+.box .rep .switch {
+  height: 100%;
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+}
+
+.box .rep .switch text {
+  font-size: 28rpx;
+  font-family: PingFang SC-Regular, PingFang SC;
+  color: #999999;
+  margin-right: 10rpx;
+  height: 100%;
+  line-height: 84rpx;
+}

+ 25 - 0
components/Yl_ReportForms/index.js

@@ -0,0 +1,25 @@
+Component({
+    properties: {
+        list: Array,
+        showAll: { //是否显示全部(包含值为空项)
+            type: Boolean,
+            value: true
+        },
+        clickItem: Function
+    },
+    methods: {
+        /* 单击项目 */
+        clickItem(e) {
+            const {
+                item
+            } = e.currentTarget.dataset;
+            this.triggerEvent("clickItem", item)
+        },
+        /* 单击补充区域 */
+        clickRep(e) {
+            const {
+                item
+            } = e.currentTarget.dataset;
+        }
+    }
+})

+ 6 - 0
components/Yl_ReportForms/index.json

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

+ 11 - 0
components/Yl_ReportForms/index.wxml

@@ -0,0 +1,11 @@
+<block wx:for="{{list}}" wx:key="index">
+  <van-transition show="{{ showAll || item.value }}" name="fade" custom-class="block">
+    <navigator url="#" class="box" bindtap="clickItem" data-item="{{item}}">
+      <view class="label">{{item.label}}</view>
+      <view class="value">{{item.value||'--'}}</view>
+      <view class="replenish" catchtap="clickRep" data-item="{{item}}" wx:if="{{item.slot}}">
+        <slot name='{{item.slot}}' />
+      </view>
+    </navigator>
+  </van-transition>
+</block>

+ 34 - 0
components/Yl_ReportForms/index.wxss

@@ -0,0 +1,34 @@
+.box {
+  display: flex;
+  width: 100vw;
+  word-break: break-all;
+  white-space: pre-wrap;
+  border-bottom: 2rpx solid #DDDDDD;
+  font-size: 28rpx;
+  font-family: PingFang SC-Regular, PingFang SC;
+  background-color: #fff;
+}
+
+.box .label {
+  color: #666666;
+  width: 310rpx;
+  padding: 0 20rpx;
+  padding-top: 26rpx;
+  box-sizing: border-box;
+  padding-bottom: 22rpx;
+}
+
+.box .value {
+  flex: 1;
+  width: 0;
+  color: #333333;
+  padding-top: 26rpx;
+  padding-bottom: 22rpx;
+}
+
+.box .replenish {
+  width: 90rpx;
+  height: 90rpx;
+  margin: 0 15rpx 0;
+  flex-shrink: 0;
+}