Browse Source

客户页面

wangxy 1 tuần trước cách đây
mục cha
commit
708dc9d8d2

+ 22 - 0
pages/kehu/hetong/hetong.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 222 - 0
pages/kehu/my/my.vue

@@ -0,0 +1,222 @@
+<template>
+	<view class="client-my-page">
+		<view class="my-head-box" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.myHeadBj + ')' }">
+			<view class="head-img-box">
+				<image class="head-img" :src="myInfoData.userImg" v-if="myInfoData.userImg"></image>
+				<icon class="phone-default-userImg" v-else :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>
+				</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>
+				</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>
+				<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>
+				<text>我的合同</text>
+				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
+			</view>
+			<view class="list-row" @click="goToPage('zc')">
+				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.zhengce + ')' }"></icon>
+				<text>隐私政策</text>
+				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
+			</view>
+			<view class="list-row" @click="goToPage('xy')">
+				<icon class="list-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.xieyi + ')' }"></icon>
+				<text>用户服务协议</text>
+				<icon class="jt-icon" :style="{ backgroundImage: 'url(' + myInfoData.imgsArr.jtIcon + ')' }"></icon>
+			</view>
+			<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="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>
+		<shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
+	</view>
+</template>
+
+<script setup>
+	import {toast} from "@/utils/common";
+	import {onLoad,onShow} from '@dcloudio/uni-app';
+	import cacheManager from '@/utils/cacheManager.js';
+	import {getMineUser,getMineInfo,getMineLogout} from '@/api/my.js'
+	import {reactive,ref} from "vue";
+	import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-client.vue"
+	import commonDialog from '@/components/dialog/commonDialog.vue';
+	import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
+	// import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
+	
+	let myInfoData = reactive({
+		userImg: '',
+		realName: '',
+		idcard: '',
+		userName: '',
+		kaoshiCount: '',
+		kechengCount: '',
+		lianxiCount: '',
+		from:'',
+		imgsArr: {
+			myHeadBj: '',
+			defaultUserImg: '',
+			telIcon: '',
+			idcardIcon: '',
+			ksIcon: '',
+			lxIcon: '',
+			kcIcon: '',
+			userListIcon: '',
+			scoreListIcon: '',
+			sxtcsListIcon: '',
+			sxtsmListIcon: '',
+			loginOutListIcon: '',
+      zhengce: '',
+      xieyi: ''
+		},
+	});
+	const commonDialogRef = ref(null);
+	const shexiangRef = ref(null);
+	const zpRef = ref(null);
+	const exitContent = '你确定要执行这个操作吗?';
+	const exitTitle = '退出登录';
+	function getMyInit() {
+		getUserInfo();
+		getNumInfo();
+	}
+	// 获取用户头像
+	function goToPage(data){
+		switch (data) {
+		    case 'ks':
+		        uni.navigateTo({
+		        	url:'/pages/client/Kaoshi/list?from=my'
+		        })
+		        break;
+		    case 'lx':
+		        uni.navigateTo({
+		        	url:'/pages/client/Lianxi/list?from=my'
+		        })
+		        break;
+		    case 'kc':
+		        uni.navigateTo({
+		        	url:'/pages/client/Kecheng/list?from=my'
+		        })
+		        break;
+			case 'cj':
+			    uni.navigateTo({
+			    	url:'/pages/client/Chengji/list?from=my'
+			    })
+			    break;
+			case 'grcj':
+			    uni.navigateTo({
+			    	url:'/pages/client/my/myInfo?from=my'
+			    })
+				break;
+			case 'zc':
+				uni.navigateTo({
+					url:'/pages/client/my/zhengce?from=my'
+				})
+				break;
+			case 'xy':
+				uni.navigateTo({
+					url:'/pages/client/my/xieyi?from=my'
+				})
+			    break;
+		}
+	}
+	function getUserInfo(){
+		getMineUser({}).then(res => {
+			myInfoData.userImg= res.data.icon;
+			myInfoData.realName = res.data.realName;
+			myInfoData.idcard = res.data.idcard;
+			myInfoData.userName = res.data.userName;
+		})
+	}
+	function getNumInfo(){
+		getMineInfo({}).then(res => {
+			myInfoData.kaoshiCount = res.data.kaoshiCount;
+			myInfoData.kechengCount = res.data.kechengCount;
+			myInfoData.lianxiCount = res.data.lianxiCount;
+		})
+	}
+	function exitLogin(){
+		commonDialogRef.value.handleShow();
+		
+	}
+	function exitBtn(){
+		getMineLogout().then(res => {
+			toast('退出登录成功')
+			cacheManager.clearAll();
+			uni.reLaunch({
+				url: '/pages/Login/clientIndex'
+			});
+		}).catch(err => {
+			toast('退出登录失败,请稍后重试')
+		})
+	}
+	
+	function showMessageDl() {
+		console.log(shexiangRef.value)
+		shexiangRef.value.handleShow()
+	}
+	
+	function showZhuaPaiConfirm() {
+		uni.navigateTo({
+			url: "/pages/client/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;
+		myInfoData.imgsArr.telIcon = cacheManager.get('projectImg').my_tel_icon;
+		myInfoData.imgsArr.idcardIcon = cacheManager.get('projectImg').my_idcard_icon;
+		myInfoData.imgsArr.ksIcon = cacheManager.get('projectImg').my_ks_icon;
+		myInfoData.imgsArr.lxIcon = cacheManager.get('projectImg').my_lx_icon;
+		myInfoData.imgsArr.kcIcon = cacheManager.get('projectImg').my_kc_icon;
+		myInfoData.imgsArr.userListIcon = cacheManager.get('projectImg').my_editor_icon;
+		myInfoData.imgsArr.scoreListIcon = cacheManager.get('projectImg').my_score_icon;
+		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;
+	})
+
+  onShow(() => {
+	getMyInit()
+  })
+</script>
+
+<style>
+</style>

+ 222 - 0
pages/kehu/my/myInfo.vue

@@ -0,0 +1,222 @@
+<template>
+	<view class="my-info-page">
+		<!-- 导航区域 -->
+		<customNavbarVue title="个人信息" :show-back-btn="true" @back="handleBack"></customNavbarVue>
+		<!-- 头像 -->
+		<view class="user-img-box">
+			<view class="user-title">头像</view>
+			<uni-file-picker return-type="object" v-model="data.images" :del-icon="false" mode="grid" disable-preview :auto-upload="false"
+				@select="handleSelect" file-mediatype="image" class="phone-file-picker user-file-picker">
+			</uni-file-picker>
+			<icon class="user-jt-icon" :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
+		</view>
+		<!-- 姓名 -->
+		<view class="form-label-input">
+			<view class="phone-form-label"><text class="form-label-require">*</text>姓名</view>
+			<input v-model="data.realName"  placeholder="请输入姓名" />
+			<icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
+		</view>
+		<!-- 手机号 -->
+		<view class="form-label-input">
+			<view class="phone-form-label"><text class="form-label-require">*</text>手机号</view>
+			<input v-model="data.userName"  placeholder="请输入手机号" />
+			<icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
+		</view>
+		<!-- 证件号 -->
+		<view class="form-label-input">
+			<view class="phone-form-label"><text class="form-label-require">*</text>证件号</view>
+			<input v-model="data.idcard"  placeholder="请输入证件号" />
+			<icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
+		</view>
+		<view class="form-label-input">
+			<view class="phone-form-label"><text class="form-label-require">*</text>具体地址</view>
+			<input v-model="data.dizhi"  placeholder="请输入具体地址" />
+			<icon :style="{ backgroundImage: 'url(' + data.jtIcon + ')' }"></icon>
+		</view>
+
+		<button type="default" class="phone-green-btn info-btn" @click="handleUpdate">修改资料</button>
+	</view>
+</template>
+
+<script setup>
+	import customNavbarVue from "@/components/custom-navbar/custom-navbar.vue";
+	import * as myApi from "@/api/my.js";
+	import {getAliyunPolicy} from "@/api/jiazheng.js"
+	import {ref,reactive} from "vue"
+	import {onLoad} from "@dcloudio/uni-app"
+	import cacheManager from '@/utils/cacheManager.js';
+	const defaultImage1 = ref({
+		url:'', extname: 'png', name: 'moren.png'
+	})
+
+	const imageStyles = ref({
+		width: '50rpx',
+		height: '50rpx',
+		background: 'red'
+	});
+
+	const data = reactive({
+		from: 'shouye', // my | kaoshi | shouye
+		icon: '',
+		realName: '',
+		idcard: '',
+		userName: '',
+		userId: null,
+		images: null,
+		jtIcon: '',
+		dizhi: ''
+	})
+
+	onLoad((options) => {
+		data.from = options.from || 'shouye';
+		data.jtIcon= cacheManager.get('projectImg').nav_bar_jt_bottom;
+		defaultImage1.url= cacheManager.get('projectImg').user_default_img;
+		initPage();
+	})
+
+	function handleSelect(e) {
+		doUploadImage(e)
+	}
+
+	function genderSelect(genderValue){
+		data.gender = genderValue;
+	}
+
+	function doUploadImage(params) {
+		const filePath = params.tempFiles[0];
+		const fileUrl = params.tempFilePaths;
+
+		
+		try {
+			const suffix = filePath.file.name.split('.').pop();
+			let req = {
+				prefix: 'resource/',
+				suffix: suffix,
+			}
+			uni.showLoading({
+				title: '上传中...',
+				mask: true
+			});
+			getAliyunPolicy(req).then(res => {
+				if (res.code == 0) {
+					const policyData = res.data;
+					
+					const formData = {
+						key:  policyData.key,
+						policy:  policyData.policy,
+						signature:  policyData.signature,
+						OSSAccessKeyId:  policyData.accessid,
+						success_action_status:  '200',
+					}
+					
+					uni.uploadFile({
+						url: policyData.uploadUrl,
+						filePath: fileUrl[0],
+						name: 'file',
+						formData: formData,
+						success(uploadRes) {
+							if (uploadRes.statusCode === 200) {
+								console.log('uploadRes',uploadRes)
+								data.icon = `${policyData.downloadUrl}/${policyData.key}`;
+								console.log( `${policyData.downloadUrl}/${policyData.key}`)
+								uni.showToast({
+									title: '上传成功',
+									icon: 'success'
+								});
+								data.images = { url: data.icon, extname: 'png', name: 'touxiang.png' }
+							} else {
+								uni.showToast({
+									icon: 'none',
+									title: '上传失败',
+								});
+								uni.hideLoading();
+							}
+			
+						},
+						fail(err) {
+							uni.showToast({
+								icon: 'none',
+								title: '上传失败',
+							});
+							uni.hideLoading();
+						}
+					});
+
+				} else {
+					uni.showToast({
+						title: '获取凭证失败',
+					});
+					uni.hideLoading();
+				}
+			})
+		} catch (error) {
+			uni.showToast({
+				title: '上传失败',
+				icon: 'none'
+			});
+			uni.hideLoading();
+		}
+	}
+
+	function handleUpdate() {
+		let arr = [];
+		if (!data.realName) {
+			arr.push('姓名');
+		}
+		if (!data.userName) {
+			arr.push('电话');
+		}
+		if (!data.icon) {
+			arr.push('头像');
+		}
+		if (!data.idcard) {
+			arr.push('证件号');
+		}
+		if (!data.realName || !data.userName||!data.icon||!data.idcard) {
+			uni.showToast({
+				icon: 'none',
+				title: `请完善${arr.join('、')}信息!`
+			})
+			return;
+		}
+		
+		const opt = {
+			dizhi: data.dizhi,
+			icon: data.icon, 
+			idcard: data.idcard,
+			realName: data.realName,
+			userId: data.userId,
+			userName: data.userName,
+		}
+		myApi.getMineUpdate(opt).then(res => {
+			if (res.data) {
+				uni.showToast({
+					title: '更新成功'
+				})
+				handleBack();
+			}
+		})
+
+	}
+
+	function handleBack() {
+		uni.navigateBack()
+	}
+
+	function initPage() {
+		myApi.getMineUser().then(res => {
+			const {gender,icon,idcard,realName,userName,userId} = res.data;
+			data.gender = res.data.gender;
+			data.icon = res.data.icon;
+			data.idcard = res.data.idcard;
+			data.realName = res.data.realName; 
+			data.userName = res.data.userName;
+			data.userId = res.data.userId;
+			data.images = data.icon?{ url: data.icon, extname: 'png', name: 'touxiang.png' }:defaultImage1.value
+		})
+	}
+</script>
+
+<style>
+
+</style>

+ 22 - 0
pages/kehu/pingfen/pingfen.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 22 - 0
pages/kehu/shouye/shouye.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>