Browse Source

完成找活动页面开发

adminthw 4 years ago
parent
commit
d0f6660f8b

BIN
__MACOSX/._components


File diff suppressed because it is too large
+ 1 - 0
common/city.data.js


File diff suppressed because it is too large
+ 12542 - 0
components/mpvue-citypicker/city-data/area.js


File diff suppressed because it is too large
+ 1503 - 0
components/mpvue-citypicker/city-data/city.js


+ 139 - 0
components/mpvue-citypicker/city-data/province.js

@@ -0,0 +1,139 @@
+/* eslint-disable */
+var provinceData = [{
+    "label": "北京市",
+    "value": "11"
+  },
+  {
+    "label": "天津市",
+    "value": "12"
+  },
+  {
+    "label": "河北省",
+    "value": "13"
+  },
+  {
+    "label": "山西省",
+    "value": "14"
+  },
+  {
+    "label": "内蒙古自治区",
+    "value": "15"
+  },
+  {
+    "label": "辽宁省",
+    "value": "21"
+  },
+  {
+    "label": "吉林省",
+    "value": "22"
+  },
+  {
+    "label": "黑龙江省",
+    "value": "23"
+  },
+  {
+    "label": "上海市",
+    "value": "31"
+  },
+  {
+    "label": "江苏省",
+    "value": "32"
+  },
+  {
+    "label": "浙江省",
+    "value": "33"
+  },
+  {
+    "label": "安徽省",
+    "value": "34"
+  },
+  {
+    "label": "福建省",
+    "value": "35"
+  },
+  {
+    "label": "江西省",
+    "value": "36"
+  },
+  {
+    "label": "山东省",
+    "value": "37"
+  },
+  {
+    "label": "河南省",
+    "value": "41"
+  },
+  {
+    "label": "湖北省",
+    "value": "42"
+  },
+  {
+    "label": "湖南省",
+    "value": "43"
+  },
+  {
+    "label": "广东省",
+    "value": "44"
+  },
+  {
+    "label": "广西壮族自治区",
+    "value": "45"
+  },
+  {
+    "label": "海南省",
+    "value": "46"
+  },
+  {
+    "label": "重庆市",
+    "value": "50"
+  },
+  {
+    "label": "四川省",
+    "value": "51"
+  },
+  {
+    "label": "贵州省",
+    "value": "52"
+  },
+  {
+    "label": "云南省",
+    "value": "53"
+  },
+  {
+    "label": "西藏自治区",
+    "value": "54"
+  },
+  {
+    "label": "陕西省",
+    "value": "61"
+  },
+  {
+    "label": "甘肃省",
+    "value": "62"
+  },
+  {
+    "label": "青海省",
+    "value": "63"
+  },
+  {
+    "label": "宁夏回族自治区",
+    "value": "64"
+  },
+  {
+    "label": "新疆维吾尔自治区",
+    "value": "65"
+  },
+  {
+    "label": "台湾",
+    "value": "66"
+  },
+  {
+    "label": "香港",
+    "value": "67"
+  },
+  {
+    "label": "澳门",
+    "value": "68"
+  }
+]
+export default provinceData;

+ 210 - 0
components/mpvue-citypicker/mpvueCityPicker.vue

@@ -0,0 +1,210 @@
+<template>
+  <div class="mpvue-picker">
+    <div :class="{'pickerMask':showPicker}" @click="maskClick" catchtouchmove="true"></div>
+    <div class="mpvue-picker-content " :class="{'mpvue-picker-view-show':showPicker}">
+      <div class="mpvue-picker__hd" catchtouchmove="true">
+        <div class="mpvue-picker__action" @click="pickerCancel">取消</div>
+        <div class="mpvue-picker__action" :style="{color:themeColor}" @click="pickerConfirm">确定</div>
+      </div>
+      <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChange">
+        <block>
+          <picker-view-column>
+            <div class="picker-item" v-for="(item,index) in provinceDataList" :key="index">{{item.label}}</div>
+          </picker-view-column>
+          <picker-view-column>
+            <div class="picker-item" v-for="(item,index) in cityDataList" :key="index">{{item.label}}</div>
+          </picker-view-column>
+          <picker-view-column>
+            <div class="picker-item" v-for="(item,index) in areaDataList" :key="index">{{item.label}}</div>
+          </picker-view-column>
+        </block>
+      </picker-view>
+    </div>
+  </div>
+</template>
+
+<script>
+import provinceData from './city-data/province.js';
+import cityData from './city-data/city.js';
+import areaData from './city-data/area.js';
+export default {
+  data() {
+    return {
+      pickerValue: [0, 0, 0],
+      provinceDataList: [],
+      cityDataList: [],
+      areaDataList: [],
+			/* 是否显示控件 */
+			showPicker: false,
+    };
+  },
+  created() {
+    this.init()
+  },
+  props: {
+    /* 默认值 */
+    pickerValueDefault: {
+      type: Array,
+      default(){
+				return [0, 0, 0]
+			}
+    },
+    /* 主题色 */
+    themeColor: String
+  },
+	watch:{
+		pickerValueDefault(){
+			this.init();
+		}
+	},
+  methods: {
+		init() {
+			this.handPickValueDefault(); // 对 pickerValueDefault 做兼容处理
+			this.provinceDataList = provinceData;
+			this.cityDataList = cityData[this.pickerValueDefault[0]];
+			this.areaDataList = areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]];
+			this.pickerValue = this.pickerValueDefault;
+		},
+    show() {
+      setTimeout(() => {
+        this.showPicker = true;
+      }, 0);
+    },
+    maskClick() {
+      this.pickerCancel();
+    },
+    pickerCancel() {
+      this.showPicker = false;
+      this._$emit('onCancel');
+    },
+    pickerConfirm(e) {
+      this.showPicker = false;
+      this._$emit('onConfirm');
+    },
+    showPickerView() {
+      this.showPicker = true;
+    },
+    handPickValueDefault() {
+      if (this.pickerValueDefault !== [0, 0, 0]) {
+        if (this.pickerValueDefault[0] > provinceData.length - 1) {
+          this.pickerValueDefault[0] = provinceData.length - 1;
+        }
+        if (this.pickerValueDefault[1] > cityData[this.pickerValueDefault[0]].length - 1) {
+          this.pickerValueDefault[1] = cityData[this.pickerValueDefault[0]].length - 1;
+        }
+        if (this.pickerValueDefault[2] > areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]].length - 1) {
+          this.pickerValueDefault[2] = areaData[this.pickerValueDefault[0]][this.pickerValueDefault[1]].length - 1;
+        }
+      }
+    },
+    pickerChange(e) {
+      let changePickerValue = e.mp.detail.value;
+      if (this.pickerValue[0] !== changePickerValue[0]) {
+        // 第一级发生滚动
+        this.cityDataList = cityData[changePickerValue[0]];
+        this.areaDataList = areaData[changePickerValue[0]][0];
+        changePickerValue[1] = 0;
+        changePickerValue[2] = 0;
+      } else if (this.pickerValue[1] !== changePickerValue[1]) {
+        // 第二级滚动
+        this.areaDataList =
+          areaData[changePickerValue[0]][changePickerValue[1]];
+        changePickerValue[2] = 0;
+      }
+      this.pickerValue = changePickerValue;
+      this._$emit('onChange');
+    },
+    _$emit(emitName) {
+      let pickObj = {
+        label: this._getLabel(),
+        value: this.pickerValue,
+        cityCode: this._getCityCode()
+      };
+      this.$emit(emitName, pickObj);
+    },
+    _getLabel() {
+      let pcikerLabel =
+        this.provinceDataList[this.pickerValue[0]].label +
+        '-' +
+        this.cityDataList[this.pickerValue[1]].label +
+        '-' +
+        this.areaDataList[this.pickerValue[2]].label;
+      return pcikerLabel;
+    },
+    _getCityCode() {
+      return this.areaDataList[this.pickerValue[2]].value;
+    }
+  }
+};
+</script>
+
+<style>
+.pickerMask {
+  position: fixed;
+  z-index: 1000;
+  top: 0;
+  right: 0;
+  left: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, 0.6);
+}
+.mpvue-picker-content {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  transition: all 0.3s ease;
+  transform: translateY(100%);
+  z-index: 3000;
+}
+.mpvue-picker-view-show {
+  transform: translateY(0);
+}
+.mpvue-picker__hd {
+  display: flex;
+  padding: 9px 15px;
+  background-color: #fff;
+  position: relative;
+  text-align: center;
+  font-size: 17px;
+}
+.mpvue-picker__hd:after {
+  content: ' ';
+  position: absolute;
+  left: 0;
+  bottom: 0;
+  right: 0;
+  height: 1px;
+  border-bottom: 1px solid #e5e5e5;
+  color: #e5e5e5;
+  transform-origin: 0 100%;
+  transform: scaleY(0.5);
+}
+.mpvue-picker__action {
+  display: block;
+  flex: 1;
+  color: #1aad19;
+}
+.mpvue-picker__action:first-child {
+  text-align: left;
+  color: #888;
+}
+.mpvue-picker__action:last-child {
+  text-align: right;
+}
+.picker-item {
+  text-align: center;
+  line-height: 40px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  font-size: 16px;
+}
+.mpvue-picker-view {
+  position: relative;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  height: 238px;
+  background-color: rgba(255, 255, 255, 1);
+}
+</style>

+ 463 - 0
components/mpvue-picker/mpvuePicker.vue

@@ -0,0 +1,463 @@
+<template>
+    <view class="mpvue-picker">
+        <view :class="{'pickerMask':showPicker}" @click="maskClick" catchtouchmove="true"></view>
+        <view class="mpvue-picker-content " :class="{'mpvue-picker-view-show':showPicker}">
+            <view class="mpvue-picker__hd" catchtouchmove="true">
+                <view class="mpvue-picker__action" @click="pickerCancel">取消</view>
+                <view class="mpvue-picker__action" :style="{color:themeColor}" @click="pickerConfirm">确定</view>
+            </view>
+            <!-- 单列 -->
+            <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChange" v-if="mode==='selector' && pickerValueSingleArray.length > 0">
+                <block>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueSingleArray" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                </block>
+            </picker-view>
+            <!-- 时间选择器 -->
+            <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChange" v-if="mode==='timeSelector'">
+                <block>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueHour" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMinute" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                </block>
+            </picker-view>
+            <!-- 多列选择 -->
+            <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChange" v-if="mode==='multiSelector'">
+                <block v-for="(n,index) in pickerValueMulArray.length" :key="index">
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index1) in pickerValueMulArray[n]" :key="index1">{{item.label}}</view>
+                    </picker-view-column>
+                </block>
+            </picker-view>
+            <!-- 二级联动 -->
+            <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChangeMul" v-if="mode==='multiLinkageSelector' && deepLength===2">
+                <block>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMulTwoOne" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMulTwoTwo" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                </block>
+            </picker-view>
+            <!-- 三级联动 -->
+            <picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChangeMul" v-if="mode==='multiLinkageSelector' && deepLength===3">
+                <block>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMulThreeOne" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMulThreeTwo" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                    <picker-view-column>
+                        <view class="picker-item" v-for="(item,index) in pickerValueMulThreeThree" :key="index">{{item.label}}</view>
+                    </picker-view-column>
+                </block>
+            </picker-view>
+        </view>
+    </view>
+</template>
+
+<script>
+    export default {
+        data() {
+            return {
+                pickerChangeValue: [],
+                pickerValue: [],
+                pickerValueArrayChange: true,
+                modeChange: false,
+                pickerValueSingleArray: [],
+                pickerValueHour: [],
+                pickerValueMinute: [],
+                pickerValueMulArray: [],
+                pickerValueMulTwoOne: [],
+                pickerValueMulTwoTwo: [],
+                pickerValueMulThreeOne: [],
+                pickerValueMulThreeTwo: [],
+                pickerValueMulThreeThree: [],
+				/* 是否显示控件 */
+				showPicker: false,
+            };
+        },
+        props: {
+            /* mode */
+            mode: {
+                type: String,
+                default: 'selector'
+            },
+            /* picker 数值 */
+            pickerValueArray: {
+                type: Array,
+                default(){
+					return []
+				}
+            },
+            /* 默认值 */
+            pickerValueDefault: {
+                type: Array,
+                default(){
+                	return []
+                }
+            },
+            /* 几级联动 */
+            deepLength: {
+                type: Number,
+                default: 2
+            },
+            /* 主题色 */
+            themeColor: String
+        },
+        watch: {
+            pickerValueArray(oldVal, newVal) {
+                this.pickerValueArrayChange = true;
+            },
+            mode(oldVal, newVal) {
+                this.modeChange = true;
+            },
+			pickerValueArray(val){
+				this.initPicker(val);
+			}
+        },
+        methods: {
+            initPicker(valueArray) {
+                let pickerValueArray = valueArray;
+                this.pickerValue = this.pickerValueDefault;
+                // 初始化多级联动
+                if (this.mode === 'selector') {
+                    this.pickerValueSingleArray = valueArray;
+                } else if (this.mode === 'timeSelector') {
+                    this.modeChange = false;
+                    let hourArray = [];
+                    let minuteArray = [];
+                    for (let i = 0; i < 24; i++) {
+                        hourArray.push({
+                            value: i,
+                            label: i > 9 ? `${i} 时` : `0${i} 时`
+                        });
+                    }
+                    for (let i = 0; i < 60; i++) {
+                        minuteArray.push({
+                            value: i,
+                            label: i > 9 ? `${i} 分` : `0${i} 分`
+                        });
+                    }
+                    this.pickerValueHour = hourArray;
+                    this.pickerValueMinute = minuteArray;
+                } else if (this.mode === 'multiSelector') {
+                    this.pickerValueMulArray = valueArray;
+                } else if (this.mode === 'multiLinkageSelector' && this.deepLength === 2) {
+                    // 两级联动
+                    let pickerValueMulTwoOne = [];
+                    let pickerValueMulTwoTwo = [];
+                    // 第一列
+                    for (let i = 0, length = pickerValueArray.length; i < length; i++) {
+                        pickerValueMulTwoOne.push(pickerValueArray[i]);
+                    }
+                    // 渲染第二列
+                    // 如果有设定的默认值
+                    if (this.pickerValueDefault.length === 2) {
+                        let num = this.pickerValueDefault[0];
+                        for (
+                            let i = 0, length = pickerValueArray[num].children.length; i < length; i++
+                        ) {
+                            pickerValueMulTwoTwo.push(pickerValueArray[num].children[i]);
+                        }
+                    } else {
+                        for (
+                            let i = 0, length = pickerValueArray[0].children.length; i < length; i++
+                        ) {
+                            pickerValueMulTwoTwo.push(pickerValueArray[0].children[i]);
+                        }
+                    }
+                    this.pickerValueMulTwoOne = pickerValueMulTwoOne;
+                    this.pickerValueMulTwoTwo = pickerValueMulTwoTwo;
+                } else if (
+                    this.mode === 'multiLinkageSelector' &&
+                    this.deepLength === 3
+                ) {
+                    let pickerValueMulThreeOne = [];
+                    let pickerValueMulThreeTwo = [];
+                    let pickerValueMulThreeThree = [];
+                    // 第一列
+                    for (let i = 0, length = pickerValueArray.length; i < length; i++) {
+                        pickerValueMulThreeOne.push(pickerValueArray[i]);
+                    }
+                    // 渲染第二列
+                    this.pickerValueDefault =
+                        this.pickerValueDefault.length === 3 ?
+                        this.pickerValueDefault :
+                        [0, 0, 0];
+                    if (this.pickerValueDefault.length === 3) {
+                        let num = this.pickerValueDefault[0];
+                        for (
+                            let i = 0, length = pickerValueArray[num].children.length; i < length; i++
+                        ) {
+                            pickerValueMulThreeTwo.push(pickerValueArray[num].children[i]);
+                        }
+                        // 第三列
+                        let numSecond = this.pickerValueDefault[1];
+                        for (let i = 0, length = pickerValueArray[num].children[numSecond].children.length; i < length; i++) {
+                            pickerValueMulThreeThree.push(
+                                pickerValueArray[num].children[numSecond].children[i]
+                            );
+                        }
+                    }
+                    this.pickerValueMulThreeOne = pickerValueMulThreeOne;
+                    this.pickerValueMulThreeTwo = pickerValueMulThreeTwo;
+                    this.pickerValueMulThreeThree = pickerValueMulThreeThree;
+                }
+            },
+            show() {
+                setTimeout(() => {
+                    if (this.pickerValueArrayChange || this.modeChange) {
+                        this.initPicker(this.pickerValueArray);
+                        this.showPicker = true;
+                        this.pickerValueArrayChange = false;
+                        this.modeChange = false;
+                    } else {
+                        this.showPicker = true;
+                    }
+                }, 0);
+            },
+            maskClick() {
+                this.pickerCancel();
+            },
+            pickerCancel() {
+                this.showPicker = false;
+                this._initPickerVale();
+                let pickObj = {
+                    index: this.pickerValue,
+                    value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
+                    label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
+                };
+                this.$emit('onCancel', pickObj);
+            },
+            pickerConfirm(e) {
+                this.showPicker = false;
+                this._initPickerVale();
+                let pickObj = {
+                    index: this.pickerValue,
+                    value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
+                    label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
+                };
+                this.$emit('onConfirm', pickObj);
+            },
+            showPickerView() {
+                this.showPicker = true;
+            },
+            pickerChange(e) {
+                this.pickerValue = e.mp.detail.value;
+                let pickObj = {
+                    index: this.pickerValue,
+                    value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
+                    label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
+                };
+                this.$emit('onChange', pickObj);
+            },
+            pickerChangeMul(e) {
+                if (this.deepLength === 2) {
+                    let pickerValueArray = this.pickerValueArray;
+                    let changeValue = e.mp.detail.value;
+                    // 处理第一列滚动
+                    if (changeValue[0] !== this.pickerValue[0]) {
+                        let pickerValueMulTwoTwo = [];
+                        // 第一列滚动第二列数据更新
+                        for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) {
+                            pickerValueMulTwoTwo.push(pickerValueArray[changeValue[0]].children[i]);
+                        }
+                        this.pickerValueMulTwoTwo = pickerValueMulTwoTwo;
+                        // 第二列初始化为 0
+                        changeValue[1] = 0;
+                    }
+                    this.pickerValue = changeValue;
+                } else if (this.deepLength === 3) {
+                    let pickerValueArray = this.pickerValueArray;
+                    let changeValue = e.mp.detail.value;
+                    let pickerValueMulThreeTwo = [];
+                    let pickerValueMulThreeThree = [];
+                    // 重新渲染第二列
+                    // 如果是第一列滚动
+                    if (changeValue[0] !== this.pickerValue[0]) {
+                        this.pickerValueMulThreeTwo = [];
+                        for (let i = 0, length = pickerValueArray[changeValue[0]].children.length; i < length; i++) {
+                            pickerValueMulThreeTwo.push(pickerValueArray[changeValue[0]].children[i]);
+                        }
+                        // 重新渲染第三列
+                        for (let i = 0, length = pickerValueArray[changeValue[0]].children[0].children.length; i <
+                            length; i++) {
+                            pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[0].children[i]);
+                        }
+                        changeValue[1] = 0;
+                        changeValue[2] = 0;
+                        this.pickerValueMulThreeTwo = pickerValueMulThreeTwo;
+                        this.pickerValueMulThreeThree = pickerValueMulThreeThree;
+                    } else if (changeValue[1] !== this.pickerValue[1]) {
+                        // 第二列滚动
+                        // 重新渲染第三列
+                        this.pickerValueMulThreeThree = [];
+                        pickerValueMulThreeTwo = this.pickerValueMulThreeTwo;
+                        for (let i = 0, length = pickerValueArray[changeValue[0]].children[changeValue[1]].children.length; i <
+                            length; i++) {
+                            pickerValueMulThreeThree.push(pickerValueArray[changeValue[0]].children[changeValue[1]].children[
+                                i]);
+                        }
+                        changeValue[2] = 0;
+                        this.pickerValueMulThreeThree = pickerValueMulThreeThree;
+                    }
+                    this.pickerValue = changeValue;
+                }
+                let pickObj = {
+                    index: this.pickerValue,
+                    value: this._getPickerLabelAndValue(this.pickerValue, this.mode).value,
+                    label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
+                };
+                this.$emit('onChange', pickObj);
+            },
+            // 获取 pxikerLabel
+            _getPickerLabelAndValue(value, mode) {
+                let pickerLable;
+                let pickerGetValue = [];
+                // selector
+                if (mode === 'selector') {
+                    pickerLable = this.pickerValueSingleArray[value].label;
+                    pickerGetValue.push(this.pickerValueSingleArray[value].value);
+                } else if (mode === 'timeSelector') {
+                    pickerLable = `${this.pickerValueHour[value[0]].label}-${this.pickerValueMinute[value[1]].label}`;
+                    pickerGetValue.push(this.pickerValueHour[value[0]].value);
+                    pickerGetValue.push(this.pickerValueHour[value[1]].value);
+                } else if (mode === 'multiSelector') {
+                    for (let i = 0; i < value.length; i++) {
+                        if (i > 0) {
+                            pickerLable += this.pickerValueMulArray[i][value[i]].label + (i === value.length - 1 ? '' :
+                                '-');
+                        } else {
+                            pickerLable = this.pickerValueMulArray[i][value[i]].label + '-';
+                        }
+                        pickerGetValue.push(this.pickerValueMulArray[i][value[i]].value);
+                    }
+                } else if (mode === 'multiLinkageSelector') {
+                    /* eslint-disable indent */
+                    pickerLable =
+                        this.deepLength === 2 ?
+                        `${this.pickerValueMulTwoOne[value[0]].label}-${this.pickerValueMulTwoTwo[value[1]].label}` :
+                        `${this.pickerValueMulThreeOne[value[0]].label}-${this.pickerValueMulThreeTwo[value[1]].label}-${this.pickerValueMulThreeThree[value[2]].label}`;
+                    if (this.deepLength === 2) {
+                        pickerGetValue.push(this.pickerValueMulTwoOne[value[0]].value);
+                        pickerGetValue.push(this.pickerValueMulTwoTwo[value[1]].value);
+                    } else {
+                        pickerGetValue.push(this.pickerValueMulThreeOne[value[0]].value);
+                        pickerGetValue.push(this.pickerValueMulThreeTwo[value[1]].value);
+                        pickerGetValue.push(this.pickerValueMulThreeThree[value[2]].value);
+                    }
+                    /* eslint-enable indent */
+                }
+                return {
+                    label: pickerLable,
+                    value: pickerGetValue
+                };
+            },
+            // 初始化 pickerValue 默认值
+            _initPickerVale() {
+                if (this.pickerValue.length === 0) {
+                    if (this.mode === 'selector') {
+                        this.pickerValue = [0];
+                    } else if (this.mode === 'multiSelector') {
+                        this.pickerValue = new Int8Array(this.pickerValueArray.length);
+                    } else if (
+                        this.mode === 'multiLinkageSelector' &&
+                        this.deepLength === 2
+                    ) {
+                        this.pickerValue = [0, 0];
+                    } else if (
+                        this.mode === 'multiLinkageSelector' &&
+                        this.deepLength === 3
+                    ) {
+                        this.pickerValue = [0, 0, 0];
+                    }
+                }
+            }
+        }
+    };
+</script>
+
+<style>
+    .pickerMask {
+        position: fixed;
+        z-index: 1000;
+        top: 0;
+        right: 0;
+        left: 0;
+        bottom: 0;
+        background: rgba(0, 0, 0, 0.6);
+    }
+
+    .mpvue-picker-content {
+        position: fixed;
+        bottom: 0;
+        left: 0;
+        width: 100%;
+        transition: all 0.3s ease;
+        transform: translateY(100%);
+        z-index: 3000;
+    }
+
+    .mpvue-picker-view-show {
+        transform: translateY(0);
+    }
+
+    .mpvue-picker__hd {
+        display: flex;
+        padding: 9px 15px;
+        background-color: #fff;
+        position: relative;
+        text-align: center;
+        font-size: 17px;
+    }
+
+    .mpvue-picker__hd:after {
+        content: ' ';
+        position: absolute;
+        left: 0;
+        bottom: 0;
+        right: 0;
+        height: 1px;
+        border-bottom: 1px solid #e5e5e5;
+        color: #e5e5e5;
+        transform-origin: 0 100%;
+        transform: scaleY(0.5);
+    }
+
+    .mpvue-picker__action {
+        display: block;
+        flex: 1;
+        color: #1aad19;
+    }
+
+    .mpvue-picker__action:first-child {
+        text-align: left;
+        color: #888;
+    }
+
+    .mpvue-picker__action:last-child {
+        text-align: right;
+    }
+
+    .picker-item {
+        text-align: center;
+        line-height: 40px;
+        font-size: 16px;
+    }
+
+    .mpvue-picker-view {
+        position: relative;
+        bottom: 0;
+        left: 0;
+        width: 100%;
+        height: 238px;
+        background-color: rgba(255, 255, 255, 1);
+    }
+</style>

+ 240 - 42
pages/activity/index.vue

@@ -1,49 +1,247 @@
 <template>
-	<view class="content">
-		{{message}}
-	</view>
+  <view class="content">
+    <div class="choose-box">
+      <div
+        class="type"
+        :class="{ active: typeActive }"
+        @click="openPicker('type')"
+      >
+        类型
+      </div>
+      <div
+        class="state"
+        :class="{ active: !typeActive }"
+        @click="openPicker('state')"
+      >
+        状态
+      </div>
+    </div>
+    <div class="actives">
+      <div v-for="(active, idx) in activeList" :key="idx" class="actives-item">
+        <div class="active-content">
+          <div class="img-box"><img :src="active.url" alt="" /></div>
+          <div class="right">
+            <div class="right-title">{{ active.title }}</div>
+            <div class="right-inf">
+              <div class="inf-type">
+                <div
+                  :class="{ color: active.type == 1 }"
+                  class="originColor"
+                ></div>
+                <div>{{ active.type === 1 ? "线下" : "线上" }}</div>
+              </div>
+              <div class="inf-way">
+                {{ active.way }}
+              </div>
+              <div class="inf-date">
+                {{ active.date }}
+              </div>
+            </div>
+          </div>
+        </div>
+        <div class="readShare">
+          <div class="read">浏览 {{ active.read }}</div>
+          <div class="share">分享 {{ active.share }}</div>
+        </div>
+      </div>
+    </div>
+    <mpvue-picker
+      :themeColor="themeColor"
+      ref="mpvuePicker"
+      :mode="mode"
+      :deepLength="deepLength"
+      :pickerValueDefault="pickerValueDefault"
+      @onConfirm="onConfirm"
+      @onCancel="onCancel"
+      :pickerValueArray="pickerValueArray"
+    ></mpvue-picker>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				message:'找活动'
-			}
-		},
-		onLoad() {
-
-		},
-		methods: {
-			
-       }
-	}
+import mpvuePicker from "@/components/mpvue-picker/mpvuePicker.vue";
+export default {
+  components: {
+    mpvuePicker,
+  },
+  data() {
+    return {
+      message: "找活动",
+      themeColor: "#007AFF",
+      mode: "selector",
+      typeActive: true,
+      deepLength: 1,
+      pickerValueDefault: [0],
+      pickerValueArray: [],
+      pickerTypeArray: [
+        {
+          label: "全部",
+          value: 1,
+        },
+        {
+          label: "线上",
+          value: 2,
+        },
+        {
+          label: "线下",
+          value: 3,
+        },
+      ],
+      pickerStateArray: [
+        {
+          label: "全部",
+          value: 4,
+        },
+        {
+          label: "待开始",
+          value: 5,
+        },
+        {
+          label: "已开始",
+          value: 6,
+        },
+        {
+          label: "已结束",
+          value: 7,
+        },
+      ],
+      activeList: [
+        {
+          url: "/static/activity/1.png",
+          title: "400场讲座,200门课程,免费送上门!就等你申请",
+          way: "区人力资源局",
+          date: "2021-08-08",
+          read: 322,
+          share: 1,
+          type: 1, //1线上
+        },
+        {
+          url: "/static/activity/2.png",
+          title: "智能制造商标品牌培育系列培训活动",
+          way: "市场监督管理局",
+          date: "2021-08-07",
+          read: 322,
+          share: 1,
+          type: 0, //0线下
+        },
+      ],
+    };
+  },
+  onLoad() {},
+  methods: {
+    onConfirm() {},
+    onCancel() {},
+    openPicker(op) {
+      switch (op) {
+        case "type":
+          this.pickerValueArray = this.pickerTypeArray;
+          this.typeActive = true;
+          break;
+        case "state":
+          this.pickerValueArray = this.pickerStateArray;
+          this.typeActive = false;
+      }
+      this.$refs.mpvuePicker.show();
+    },
+  },
+};
 </script>
 
-<style>
-	.content {
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.logo {
-		height: 200rpx;
-		width: 200rpx;
-		margin-top: 200rpx;
-		margin-left: auto;
-		margin-right: auto;
-		margin-bottom: 50rpx;
-	}
-
-	.text-area {
-		display: flex;
-		justify-content: center;
-	}
-
-	.title {
-		font-size: 36rpx;
-		color: #8f8f94;
-	}
+<style lang="scss" scoped>
+.content {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 100%;
+  .choose-box {
+    padding: 20rpx 0;
+    width: 100%;
+    display: flex;
+    position: fixed;
+    height: 50rpx;
+    top: 0;
+    margin-bottom: 50rpx;
+    .type,
+    .state {
+      width: 50%;
+      display: flex;
+      justify-content: center;
+    }
+  }
+  .actives {
+    margin-top: 50rpx;
+    padding: 0 40rpx;
+    display: flex;
+    flex-direction: column;
+    .actives-item {
+      height: 150rpx;
+      box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
+      border-radius: 32rpx;
+      margin-top: 20px;
+      padding: 50rpx;
+      display: flex;
+      flex-direction: column;
+      .active-content {
+        display: flex;
+        .img-box {
+          margin-right: 20rpx;
+          width: 120rpx;
+          height: 120rpx;
+          img {
+            width: 100%;
+            height: 100%;
+          }
+        }
+        .right {
+          height: 120rpx;
+          box-sizing: border-box;
+          display: flex;
+          flex-direction: column;
+          .right-title {
+            margin-bottom: 20rpx;
+            font-size: 27rpx;
+            font-weight: 600;
+            letter-spacing: 3rpx;
+          }
+          .right-inf {
+            display: flex;
+            font-size: 22rpx;
+            color: $uni-text-color-grey;
+            .inf-type {
+              margin-right: 20rpx;
+              display: flex;
+              align-items: center;
+              .originColor {
+                margin-right: 8rpx;
+                height: 25rpx;
+                width: 25rpx;
+                border-radius: 50%;
+                background-color: #ffcf86;
+              }
+            }
+            .inf-way {
+              margin-right: 20rpx;
+            }
+          }
+        }
+      }
+      .readShare {
+        display: flex;
+        justify-content: flex-end;
+        font-size: 20rpx;
+        color: rgba(0, 0, 0, 0.3);
+        margin-top: 20rpx;
+        .read {
+          margin-right: 60rpx;
+        }
+      }
+    }
+  }
+}
+.active {
+  color: $uni-color-primary;
+}
+.color {
+  background-color: #589cff !important;
+}
 </style>