소스 검색

no message

sys 2 년 전
부모
커밋
db559cfee7
2개의 변경된 파일150개의 추가작업 그리고 6개의 파일을 삭제
  1. 123 0
      components/en-utils/en-popup/en-picker.vue
  2. 27 6
      pages/my/editInformation.vue

+ 123 - 0
components/en-utils/en-popup/en-picker.vue

@@ -0,0 +1,123 @@
+<template>
+  <view v-show="showPicker">
+    <uni-data-picker :popup-title="'选择'+label" :localdata="localData" ref="pickerObj"
+                     @change="pickerChange" :border="false" :clear-icon="false" @popupclosed="setPopupClosed">
+    </uni-data-picker>
+  </view>
+</template>
+
+<script>
+import EnPopup from "@/components/en-utils/en-popup/en-popup";
+export default {
+  name: "en-picker",
+  components: {EnPopup},
+  props: {
+    localData: {
+      type: Array,
+      default: []
+    },
+    label: {
+      type: String,
+      default: '标题'
+    },
+    placeholder: {
+      type: String,
+      default: '请选择'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    name: {
+      type: String,
+      default: 'text'
+    },
+    valueType: {
+      type: String,
+      default: '1'
+    },
+    value: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      inputValue: [],
+      optionName: '',
+      labelWidth: 0,
+      showPicker:false
+    }
+  },
+  watch: {
+    'value': function () {
+      this.setValue()
+    },
+    'inputValue': function () {
+      console.log(this.inputValue)
+      if(this.valueType==='1'){
+        this.$emit('change', this.inputValue.join(','))
+      }else {
+        this.$emit('change', this.inputValue)
+      }
+    }
+  },
+  mounted() {
+
+  },
+  methods: {
+    setValue(){
+      let value=this.value
+      if(!value){
+        value=[]
+      }else if(typeof value==='string'){
+        value=value.split(',')
+      }
+      if(this.inputValue!==value){
+        this.inputValue=value
+        this.optionName = "";
+        this.localData.forEach((one)=>{
+          if(one.value+''===this.inputValue[0]+''){
+            this.optionName += one.text + " ";
+            if(one.children){
+              one.children.forEach((two)=>{
+                if(two.value+''===this.inputValue[1]+''){
+                  this.optionName += two.text + " ";
+                  if(two.children){
+                    two.children.forEach((three)=>{
+                      if(three.value+''===this.inputValue[2]+''){
+                        this.optionName += three.text + " ";
+                      }
+                    })
+                  }
+                }
+              })
+            }
+          }
+        })
+      }
+
+    },
+    setPopupClosed() {
+      this.showPicker = false;
+    },
+    showPickerObj() {
+      this.showPicker = true;
+      this.$refs.pickerObj.show();
+    },
+    pickerChange(data) {
+      this.optionName = "";
+      this.inputValue = [];
+      data.detail.value.forEach((item) => {
+        this.optionName += item.text + " ";
+        this.inputValue.push(item.value)
+      });
+      this.showPicker = false;
+    },
+
+  }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 27 - 6
pages/my/editInformation.vue

@@ -144,7 +144,7 @@
                 </view>
               </view>
             </view>
-            <view class="from-item">
+            <view class="from-item" @click="showSelect(1)">
               <view class="from-item-title sys-height-44 sys-weight-400">家乡</view>
               <view class="from-item-data">
                 <view class="item-data-text  sys-height-44 sys-color-gray-9 sys-weight-400">江湖救急</view>
@@ -153,7 +153,7 @@
                 </view>
               </view>
             </view>
-            <view class="from-item">
+            <view class="from-item" @click="showSelect(2)">
               <view class="from-item-title sys-height-44 sys-weight-400">职业</view>
               <view class="from-item-data">
                 <view class="item-data-text  sys-height-44 sys-color-gray-9 sys-weight-400">江湖救急</view>
@@ -166,26 +166,46 @@
         </view>
         <view class="edit-but sys-background-black sys-weight-600 sys-color-white">保存</view>
       </view>
-
+      <en-picker v-show="selectShow" ref="selectPicker" :local-data="selectData" :label="selectTitle" @change="setSelectData"></en-picker>
     </scroll-view>
+
   </view>
 </template>
 
 <script>
 import EnNav from "@/components/en-utils/en-nav/en-nav";
+import EnSelect from "@/components/en-from/en-select/en-select";
+import EnPicker from "@/components/en-utils/en-popup/en-picker";
 export default {
-  components: {EnNav},
+  components: {EnPicker, EnSelect, EnNav},
   data() {
     return {
       title:'编辑资料',
       headPortrait:'/static/img/temporary/3.png',
-      navHeight:0
+      navHeight:0,
+      selectData:[{'text':'媒体/公关','value':'1'},{'text':'健康/美容','value':'2'},{'text':'IT/互联网','value':'3'}],
+      selectTitle:'职业',
+      selectShow:false,
+      selectType:1,
     }
   },
   methods: {
     setNavHeight(navHeight){
       this.navHeight=navHeight
     },
+    setSelectData(value){
+      console.log('value',value)
+      this.$refs.selectPicker.setPopupClosed()
+    },
+    showSelect(type){
+      this.selectType=type
+      if(type===1){
+        this.selectTitle='家乡'
+      }else if(type===2){
+        this.selectTitle='职业'
+      }
+      this.$refs.selectPicker.showPickerObj()
+    },
     goToUrl(type){
       if(type===1){
         uni.navigateTo({
@@ -282,11 +302,12 @@ export default {
         }
       }
       .photograph-list{
+        height: 336rpx;
         margin-top: 26rpx;
         overflow-x: auto;
+        overflow-y: hidden;
         display: flex;
         justify-content: flex-start;
-        overflow-y: scroll;
         .photograph-item{
           margin-right: 16rpx;
           .photograph-img{