wangguoyu 12 hours ago
parent
commit
d555c06624
4 changed files with 154 additions and 50 deletions
  1. 11 0
      api/kehu.js
  2. 11 0
      api/my.js
  3. 42 9
      pages/client/my/index.vue
  4. 90 41
      pages/kehu/my/my.vue

+ 11 - 0
api/kehu.js

@@ -34,4 +34,15 @@ export function getKehuLogout(data = {}) {
     data,
     timeout: 20000
   })
+}
+export function yonghuzhuxiao(data = {}) {
+  return request({
+    url: '/applet/jiazheng/user/disable',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 11 - 0
api/my.js

@@ -144,4 +144,15 @@ export function getZhuangtaiInfo(data = {}) {
     data,
     timeout: 20000
   })
+}
+export function yonghuzhuxiao(data = {}) {
+  return request({
+    url: '/applet/jiazheng/user/disable',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 42 - 9
pages/client/my/index.vue

@@ -47,7 +47,8 @@
 				<text>修改状态</text>
 				<picker :range="myInfoData.StatusList" mode='selector' range-key="name" :value="myInfoData.status"
 					@change="onSelectStatusChange" class="select-picker-box">
-					<view v-if="myInfoData.StatusList[myInfoData.status]" class="list-status-item">{{myInfoData.StatusList[myInfoData.status].name}}</view>
+					<view v-if="myInfoData.StatusList[myInfoData.status]" class="list-status-item">
+						{{myInfoData.StatusList[myInfoData.status].name}}</view>
 				</picker>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 
@@ -90,18 +91,28 @@
 				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.sxtsmListIcon + ')' }"></icon>
 				<text>摄像头说明</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
-			</view> -->
+			</view> -->
+			<view class="list-row" @click="zhuxiaoLogin">
+				<icon class="list-icon"
+					:style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
+				<text>用户注销</text>
+				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
+			</view>
 			<view class="list-row" @click="exitLogin">
 				<icon class="list-icon"
 					:style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
 				<text>退出登录</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view>
+		
 		</view>
 		<!-- 底部区域 -->
 		<customTabbarClient :currentTab="1"></customTabbarClient>
 		<common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"
 			@confirm-btn="exitBtn"></common-dialog>
+
+		<common-dialog ref="zhuxiaoDialogRef" :title="zhuxiaoTitle" :content="zhuxiaoContent"
+			@confirm-btn="zhuxiaoBtn"></common-dialog>
 		<shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
 
 		<!-- 摄像头确认 -->
@@ -126,7 +137,8 @@
 		getMineLogout,
 		getZhuangtaiInfo,
 		updateZhuangtai,
-		getMyOpsZhuangtai
+		getMyOpsZhuangtai,
+		yonghuzhuxiao
 	} from '@/api/my.js'
 	import {
 		reactive,
@@ -167,30 +179,35 @@
 		StatusList: []
 	});
 	const commonDialogRef = ref(null);
+	const zhuxiaoDialogRef = ref(null);
 	const shexiangRef = ref(null);
 	const zpRef = ref(null);
-	const exitContent = '你确定要执行这个操作吗?';
+	const exitContent = '你确定要执行这个操作吗?';
+	const zhuxiaoContent = '你确定要执行这个操作吗?';
 	const exitTitle = '退出登录';
+	const zhuxiaoTitle = '用户注销';
 
 
 
 	function onSelectStatusChange(dd) {
 		myInfoData.status = dd.detail.value;
 		const targetId = myInfoData.StatusList[myInfoData.status].id;
-		updateZhuangtai({zhuangtai:targetId}).then(res => {
+		updateZhuangtai({
+			zhuangtai: targetId
+		}).then(res => {
 			if (res.data) {
 				toast('更新成功')
 			}
 		})
 	}
-	
+
 	function getMyOpsZhuangtaidata() {
-		Promise.all([getMyOpsZhuangtai(),getZhuangtaiInfo()]).then(([res,res2]) => {
+		Promise.all([getMyOpsZhuangtai(), getZhuangtaiInfo()]).then(([res, res2]) => {
 			myInfoData.StatusList = res.data;
-			myInfoData.status = myInfoData.StatusList.findIndex(item => item.id == (res2.data||1))
+			myInfoData.status = myInfoData.StatusList.findIndex(item => item.id == (res2.data || 1))
 		})
 	}
-	
+
 
 	function getMyInit() {
 		getUserInfo();
@@ -276,6 +293,22 @@
 		})
 	}
 
+	function zhuxiaoLogin() {
+		zhuxiaoDialogRef.value.handleShow();
+
+	}
+	function zhuxiaoBtn() {
+		yonghuzhuxiao().then(res => {
+			toast('用户注销成功')
+			cacheManager.clearAll();
+			uni.reLaunch({
+				url: '/pages/Login/clientIndex'
+			});
+		}).catch(err => {
+			toast('用户注销失败,请稍后重试')
+		})
+	}
+
 	function showMessageDl() {
 		console.log(shexiangRef.value)
 		shexiangRef.value.handleShow()

+ 90 - 41
pages/kehu/my/my.vue

@@ -2,29 +2,32 @@
 	<view class="client-my-page">
 		<view class="my-head-box" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.myHeadBj + ')' }">
 			<view class="head-img-box">
-				<icon class="phone-default-userImg" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.defaultUserImg + ')' }"></icon>
+				<icon class="phone-default-userImg"
+					:style="{ backgroundImage: 'url(' + myInfoData.imgsArr.defaultUserImg + ')' }"></icon>
 			</view>
 			<view class="head-content-box">
 				<text>{{myInfoData.realName}}</text>
 				<view class="head-content-row-box" v-if="myInfoData.userName">
 					<icon :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.telIcon + ')' }"></icon>
-					<text class="content-text" >{{myInfoData.userName}}</text>
+					<text class="content-text">{{myInfoData.userName}}</text>
 				</view>
 				<view class="head-content-row-box" v-if="myInfoData.idcard">
 					<icon :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.idcardIcon + ')' }"></icon>
-					<text class="content-text" >{{myInfoData.idcard}}</text>
+					<text class="content-text">{{myInfoData.idcard}}</text>
 				</view>
 			</view>
 		</view>
-		
+
 		<view class="my-list-box">
 			<view class="list-row" @click="goToPage('grcj')">
-				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.userListIcon + ')' }"></icon>
+				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.userListIcon + ')' }">
+				</icon>
 				<text>修改个人信息</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view>
 			<view class="list-row" @click="goToPage('cj')">
-				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.scoreListIcon + ')' }"></icon>
+				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.scoreListIcon + ')' }">
+				</icon>
 				<text>我的合同</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view>
@@ -38,34 +41,57 @@
 				<text>用户服务协议</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view>
-	<!-- 		<view class="list-row" @click="showZhuaPaiConfirm">
+			<!-- 		<view class="list-row" @click="showZhuaPaiConfirm">
 				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.sxtcsListIcon + ')' }"></icon>
 				<text>摄像头测试</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view> -->
+			<view class="list-row" @click="zhuxiaoLogin">
+				<icon class="list-icon"
+					:style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
+				<text>用户注销</text>
+				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
+			</view>
 			<view class="list-row" @click="exitLogin">
-				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
+				<icon class="list-icon"
+					:style="{ backgroundImage: 'url(' + myInfoData.imgsArr.loginOutListIcon + ')' }"></icon>
 				<text>退出登录</text>
 				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
 			</view>
+		
 		</view>
 		<!-- 底部区域 -->
 		<customTabbarKehu :currentTab="1"></customTabbarKehu>
-		<common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"@confirm-btn="exitBtn"></common-dialog>
+		<common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"
+			@confirm-btn="exitBtn"></common-dialog>
+		<common-dialog ref="zhuxiaoDialogRef" :title="zhuxiaoTitle" :content="zhuxiaoContent"
+			@confirm-btn="zhuxiaoBtn"></common-dialog>
 		<shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
 	</view>
 </template>
 
 <script setup>
-	import {toast} from "@/utils/common";
-	import {onLoad,onShow} from '@dcloudio/uni-app';
+	import {
+		toast
+	} from "@/utils/common";
+	import {
+		onLoad,
+		onShow
+	} from '@dcloudio/uni-app';
 	import cacheManager from '@/utils/cacheManager.js';
-	import {getKehuUser,getKehuLogout} from '@/api/kehu.js'
-	import {reactive,ref} from "vue";
+	import {
+		getKehuUser,
+		getKehuLogout,
+		yonghuzhuxiao
+	} from '@/api/kehu.js'
+	import {
+		reactive,
+		ref
+	} from "vue";
 	import customTabbarKehu from "@/components/custom-tabbar/custom-tabbar-kehu.vue"
 	import commonDialog from '@/components/dialog/commonDialog.vue';
 	import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
-	
+
 	let myInfoData = reactive({
 		userImg: '',
 		realName: '',
@@ -74,7 +100,7 @@
 		kaoshiCount: '',
 		kechengCount: '',
 		lianxiCount: '',
-		from:'',
+		from: '',
 		imgsArr: {
 			myHeadBj: '',
 			defaultUserImg: '',
@@ -88,57 +114,63 @@
 			sxtcsListIcon: '',
 			sxtsmListIcon: '',
 			loginOutListIcon: '',
-      zhengce: '',
-      xieyi: ''
+			zhengce: '',
+			xieyi: ''
 		},
 	});
 	const commonDialogRef = ref(null);
+	const zhuxiaoDialogRef = ref(null);
 	const shexiangRef = ref(null);
 	const zpRef = ref(null);
 	const exitContent = '你确定要执行这个操作吗?';
 	const exitTitle = '退出登录';
+	const zhuxiaoContent = '你确定要执行这个操作吗?';
+	const zhuxiaoTitle = '用户注销';
+
 	function getMyInit() {
 		getUserInfo();
 	}
 	// 获取用户头像
-	function goToPage(data){
+	function goToPage(data) {
 		switch (data) {
 			case 'cj':
-			    uni.navigateTo({
-			    	url:'/pages/kehu/hetong/hetongList?from=my'
-			    })
+				uni.navigateTo({
+					url: '/pages/kehu/hetong/hetongList?from=my'
+				})
 				break;
 			case 'grcj':
-			    uni.navigateTo({
-			    	url:'/pages/kehu/my/myInfo?from=my'
-			    })
+				uni.navigateTo({
+					url: '/pages/kehu/my/myInfo?from=my'
+				})
 				break;
 			case 'zc':
 				uni.navigateTo({
-					url:'/pages/kehu/my/zhengce?from=my'
+					url: '/pages/kehu/my/zhengce?from=my'
 				})
 				break;
 			case 'xy':
 				uni.navigateTo({
-					url:'/pages/kehu/my/xieyi?from=my'
+					url: '/pages/kehu/my/xieyi?from=my'
 				})
-			    break;
+				break;
 		}
 	}
-	function getUserInfo(){
+
+	function getUserInfo() {
 		getKehuUser({}).then(res => {
-			myInfoData.userImg= res.data.icon;
+			myInfoData.userImg = res.data.icon;
 			myInfoData.realName = res.data.realName;
 			myInfoData.idcard = res.data.idcard;
 			myInfoData.userName = res.data.userName;
 		})
 	}
 
-	function exitLogin(){
+	function exitLogin() {
 		commonDialogRef.value.handleShow();
-		
+
 	}
-	function exitBtn(){
+
+	function exitBtn() {
 		getKehuLogout().then(res => {
 			toast('退出登录成功')
 			cacheManager.clearAll();
@@ -150,26 +182,43 @@
 		})
 	}
 	
+	function zhuxiaoLogin() {
+		zhuxiaoDialogRef.value.handleShow();
+	
+	}
+	function zhuxiaoBtn() {
+		yonghuzhuxiao().then(res => {
+			toast('用户注销成功')
+			cacheManager.clearAll();
+			uni.reLaunch({
+				url: '/pages/Login/clientIndex'
+			});
+		}).catch(err => {
+			toast('用户注销失败,请稍后重试')
+		})
+	}
+
 	function showMessageDl() {
 		shexiangRef.value.handleShow()
 	}
-	
+
 	function showZhuaPaiConfirm() {
 		uni.navigateTo({
 			url: "/pages/kehu/my/cameraTest"
 		})
 	}
-	
+
 	function zpConfirmSuccess() {
 		zpRef.value.showDialog()
 	}
+
 	function zpConfirmError() {
 		uni.showToast({
 			title: '摄像头唤起异常',
 			icon: 'none'
 		})
 	}
-	
+
 	onLoad(() => {
 		myInfoData.imgsArr.myHeadBj = cacheManager.get('projectImg').client_my_bj;
 		myInfoData.imgsArr.defaultUserImg = cacheManager.get('projectImg').user_default_img;
@@ -183,14 +232,14 @@
 		myInfoData.imgsArr.sxtcsListIcon = cacheManager.get('projectImg').my_sxtcs_icon;
 		myInfoData.imgsArr.sxtsmListIcon = cacheManager.get('projectImg').my_sxtsm_icon;
 		myInfoData.imgsArr.loginOutListIcon = cacheManager.get('projectImg').login_out_icon;
-		myInfoData.imgsArr.jtIcon= cacheManager.get('projectImg').nav_bar_jt_bottom;
-		myInfoData.imgsArr.zhengce= cacheManager.get('projectImg').zhengce;
-		myInfoData.imgsArr.xieyi= cacheManager.get('projectImg').xieyi;
+		myInfoData.imgsArr.jtIcon = cacheManager.get('projectImg').nav_bar_jt_bottom;
+		myInfoData.imgsArr.zhengce = cacheManager.get('projectImg').zhengce;
+		myInfoData.imgsArr.xieyi = cacheManager.get('projectImg').xieyi;
 	})
 
-  onShow(() => {
-	getMyInit()
-  })
+	onShow(() => {
+		getMyInit()
+	})
 </script>
 
 <style>