Bladeren bron

设置页面开发

tanxue 1 maand geleden
bovenliggende
commit
2960ce5ecf
3 gewijzigde bestanden met toevoegingen van 180 en 0 verwijderingen
  1. 24 0
      api/my.js
  2. 78 0
      pages/my/components/realNameDialog.vue
  3. 78 0
      pages/my/components/telDialog.vue

+ 24 - 0
api/my.js

@@ -35,6 +35,30 @@ export function getUserUpPassword(data = {}) {
   })
 }
 
+export function getUserUpRealName(data = {}) {
+  return request({
+    'url': '/app/user/update/realName',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
+export function getUserUpTel(data = {}) {
+  return request({
+    'url': '/app/user/update/tel',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
 export function getUserUpBirthday(data = {}) {
   return request({
     'url': '/app/user/update/birthday',

+ 78 - 0
pages/my/components/realNameDialog.vue

@@ -0,0 +1,78 @@
+<template>
+	<uni-popup ref="realNamePopup" :animation="false" :is-mask-click="false"
+	 mask-background-color="rgba(0, 0, 0, 0.4)">
+	 <view class="phone-common-dialog">
+		<view class="common-body-box">
+			<view class="common-title">修改姓名</view>
+			<view class="common-input-box">
+				<view class="common-input-row">
+					<text class="common-input-label"><text class="common-label-require">*</text>真实姓名:</text>
+					<input class="common-input" v-model="data.realName"  placeholder="请输入真实姓名" />
+				</view>
+			</view>
+			<view class="common-btn-box">
+				<view class="not-confirm-btn" @click="handleClose">{{notBtn}}</view>
+				<view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
+			</view>
+		</view>
+	 </view>
+	</uni-popup>
+</template>
+
+<script setup>
+	import {ref,reactive} from "vue"
+	const props = defineProps({
+	  notBtn: {
+	    type: String,
+	  	require: true,
+	    default: '取消'
+	  },
+	  okBtn: {
+	    type: String,
+	  	require: true,
+	    default: '确认'
+	  },
+	});
+	const data = reactive({
+		realName: '',
+	})
+	const realNamePopup = ref(null); // 索引
+	const $emit = defineEmits(['confirm-btn'])
+	
+	function passClear(){
+		data.realName = '';
+	}
+	// 打开弹窗
+	function handleShow() {
+		realNamePopup.value.open();
+	}
+	// 取消
+	function handleClose() {
+		passClear();
+		realNamePopup.value.close();
+	}
+	// 确认
+	function confirmBtn(){
+		let arr = [];
+		if (!data.realName) {
+			arr.push('真实姓名');
+		}
+		if (!data.realName) {
+			uni.showToast({
+				icon: 'none',
+				title: `请输入${arr.join('、')}信息!`
+			})
+			return;
+		}
+		$emit('confirm-btn',data.realName);
+		passClear();
+		realNamePopup.value.close();
+	}
+	defineExpose({
+			handleShow,
+			handleClose
+		})
+</script>
+
+<style>
+</style>

+ 78 - 0
pages/my/components/telDialog.vue

@@ -0,0 +1,78 @@
+<template>
+	<uni-popup ref="telPopup" :animation="false" :is-mask-click="false"
+	 mask-background-color="rgba(0, 0, 0, 0.4)">
+	 <view class="phone-common-dialog">
+		<view class="common-body-box">
+			<view class="common-title">修改电话</view>
+			<view class="common-input-box">
+				<view class="common-input-row">
+					<text class="common-input-label"><text class="common-label-require">*</text>新号码:</text>
+					<input class="common-input" v-model="data.tel"  placeholder="请输入新号码" />
+				</view>
+			</view>
+			<view class="common-btn-box">
+				<view class="not-confirm-btn" @click="handleClose">{{notBtn}}</view>
+				<view class="confirm-btn" @click="confirmBtn">{{okBtn}}</view>
+			</view>
+		</view>
+	 </view>
+	</uni-popup>
+</template>
+
+<script setup>
+	import {ref,reactive} from "vue"
+	const props = defineProps({
+	  notBtn: {
+	    type: String,
+	  	require: true,
+	    default: '取消'
+	  },
+	  okBtn: {
+	    type: String,
+	  	require: true,
+	    default: '确认'
+	  },
+	});
+	const data = reactive({
+		tel: '',
+	})
+	const telPopup = ref(null); // 索引
+	const $emit = defineEmits(['confirm-btn'])
+	
+	function passClear(){
+		data.tel = '';
+	}
+	// 打开弹窗
+	function handleShow() {
+		telPopup.value.open();
+	}
+	// 取消
+	function handleClose() {
+		passClear();
+		telPopup.value.close();
+	}
+	// 确认
+	function confirmBtn(){
+		let arr = [];
+		if (!data.tel) {
+			arr.push('新号码');
+		}
+		if (!data.tel) {
+			uni.showToast({
+				icon: 'none',
+				title: `请输入${arr.join('、')}!`
+			})
+			return;
+		}
+		$emit('confirm-btn',data.tel);
+		passClear();
+		telPopup.value.close();
+	}
+	defineExpose({
+			handleShow,
+			handleClose
+		})
+</script>
+
+<style>
+</style>