Forráskód Böngészése

编辑资料页面参数完善

宋飞杨 1 éve
szülő
commit
ae6b51c6b4
1 módosított fájl, 95 hozzáadás és 7 törlés
  1. 95 7
      src/pages/client/clientUser/mine/setting/personInfo.vue

+ 95 - 7
src/pages/client/clientUser/mine/setting/personInfo.vue

@@ -10,11 +10,26 @@
         isLink
         url=""
       />
-      <u-cell size="large" title="昵称" value="易只烊" isLink url="" />
-      <u-cell size="large" title="性别" value="女" isLink url="" />
-      <u-cell size="large" title="生日" value="2000-03-01" isLink url="" />
-      <u-cell size="large" title="常用地" value="贵阳" isLink url="" />
-      <u-cell size="large" title="个人介绍" value="内容" isLink url="" />
+      <u-cell
+        size="large"
+        @click="onClickNickName(NickName, '昵称')"
+        title="昵称"
+        :value="NickName"
+        isLink
+        url=""
+      />
+
+      <u-cell size="large" @click="onClickGender" title="性别" :value="gender" isLink url="" />
+      <u-cell size="large" title="生日" :value="birthday" isLink @click="openDatePicker" />
+      <u-cell
+        size="large"
+        @click="onClickLocation"
+        title="常用地"
+        :value="location"
+        isLink
+        url=""
+      />
+      <u-cell size="large" title="个人介绍" :value="introduction" isLink @click="openInputBox" />
     </u-cell-group>
 
     <!-- 用户协议弹框 -->
@@ -46,7 +61,12 @@ export default {
     return {
       show: '',
       value: '',
-      userName: 'yizhiyang',
+      userName: 'yizhiyang', //默认用户名
+      NickName: '易只烊', //默认昵称
+      gender: '女', // 默认性别为女
+      birthday: '2000-03-01', //默认生日
+      location: '贵阳', //默认常用的
+      introduction: '内容', // 默认个人介绍内容
     };
   },
 
@@ -111,7 +131,7 @@ export default {
 
     //点击用户名哪一行
     onClickUserName(userName, value) {
-      this.value = userName; //把行最后的值给value
+      this.uservalue = userName; //把行最后的值给value
       this.title = `编辑${value}`; //弹框标题
       this.show = true; //打开弹框
     },
@@ -121,7 +141,75 @@ export default {
       this.userName = this.value;
       this.show = false;
     },
+    //点击昵称
+    onClickNickName(NickName, value) {
+      this.nickvalue = NickName; //把行最后的值给value
+      this.title = `编辑${value}`; //弹框标题
+      this.show = true; //打开弹框
+    },
+    //点击弹框确认
+    confirm() {
+      this.NickName = this.value;
+      this.show = false;
+    },
+    // 点击性别
+    onClickGender() {
+      uni.showActionSheet({
+        itemList: ['男', '女'],
+        success: res => {
+          if (res.tapIndex === 0) {
+            this.gender = '男';
+          } else if (res.tapIndex === 1) {
+            this.gender = '女';
+          }
+        },
+        fail: error => {
+          console.error(error);
+        },
+      });
+    },
+    // 点击生日
+    openDatePicker() {
+      uni.showDatePicker({
+        start: '1900-01-01',
+        end: '2200-12-31',
+        currentDate: this.birthday,
+        success: res => {
+          if (res.errMsg === 'showDatePicker:ok') {
+            const selectedDate = res.dateString;
+            this.birthday = selectedDate; // 将选择的日期赋值给 birthday
+          }
+        },
+        fail: error => {
+          console.error(error);
+        },
+      });
+    },
+    // 点击常用地
+    onClickLocation() {
+      uni.showActionSheet({
+        itemList: ['北京', '上海', '广州', '深圳'],
+        success: res => {
+          const selectedLocation = ['北京', '上海', '广州', '深圳'][res.tapIndex];
+          this.location = selectedLocation; // 将选择的地点赋值给 location
+        },
+        fail: error => {
+          console.error(error);
+        },
+      });
+    },
+    // 点击个人介绍
+    openInputBox() {
+      this.title = '编辑个人介绍'; // 设置弹框标题
+      this.value = this.introduction; // 将当前介绍内容赋值给输入框的值
+      this.show = true; // 打开弹框
+    },
 
+    // 点击弹框确认
+    confirm() {
+      this.introduction = this.value; // 将输入框中的内容赋值给个人介绍
+      this.show = false; // 关闭弹框
+    },
     //点击弹框取消
     cancel() {
       this.show = false;