Эх сурвалжийг харах

feat(protocol): 添加用户协议
fix(application): 对接护理申请列表
- 添加status默认值映射
- 修改请求拦截,请求验证

lzm 3 сар өмнө
parent
commit
006cda9e18

+ 24 - 0
common/config/application-api.js

@@ -0,0 +1,24 @@
+const {
+	http
+} = uni.$u
+
+//获取用户协议列表
+export const getProtocolList = (data) => http.get('/dev-api/care/protocol/list', data);
+//获取用户协议详情
+export const getProtocolInfo = (data) => http.get(`/dev-api/care/protocol/${data.id??0}`, data);
+//护理人员列表
+export const getNursesList = (data) => http.get(`/dev-api/care/nurses/list`,data);
+//护理人员列表
+export const getNursesInfo = (data) => http.get(`/dev-api/care/nurses/${data.id??0}`,data);
+//编辑护理人员
+export const editNurses = (data) => http.get(`/dev-api/care/nurses/${data.id??0}`,data);
+
+//护理申请列表
+export const getCareList = (data) => http.get(`/dev-api/care/applications/list`, data);
+//护理详情
+export const getCareInfo = (data) => http.get(`/dev-api/care/applications/${data.id??0}`, data);
+
+
+//护理送审
+export const putCareSend = (params, config = {}) => http.put('/dev-api/care/applications', params, config);
+

+ 129 - 0
common/status/index.js

@@ -0,0 +1,129 @@
+const STATUS_CONFIGE = {
+	care_apply_status: [{
+			dictCode: 119,
+			dictLabel: "待指派人员",
+			dictSort: 0,
+			dictType: "care_apply_status",
+			dictValue: "wait_assign_nurse"
+		},
+		{
+			dictCode: 110,
+			dictLabel: "待审核",
+			dictSort: 1,
+			dictType: "care_apply_status",
+			dictValue: "wait_check"
+		},
+		{
+			dictCode: 111,
+			dictLabel: "已同意",
+			dictSort: 2,
+			dictType: "care_apply_status",
+			dictValue: "agree"
+		},
+		{
+			dictCode: 112,
+			dictLabel: "不同意",
+			dictSort: 3,
+			dictType: "care_apply_status",
+			dictValue: "disagree"
+		},
+		{
+			dictCode: 113,
+			dictLabel: "待指派公司",
+			dictSort: 4,
+			dictType: "care_apply_status",
+			dictValue: "wait_assign_company"
+		},
+		{
+			dictCode: 114,
+			dictLabel: "已指派",
+			dictSort: 5,
+			dictType: "care_apply_status",
+			dictValue: "assigned"
+		},
+		{
+			dictCode: 121,
+			dictLabel: "未送审",
+			dictSort: 6,
+			dictType: "care_apply_status",
+			dictValue: "no_check"
+		}
+	],
+	sys_user_sex: [{
+		dictCode: 1,
+		dictLabel: "男",
+		dictSort: 1,
+		dictType: "sys_user_sex",
+		dictValue: "0"
+	}, {
+		dictCode: 2,
+		dictLabel: "女",
+		dictSort: 2,
+		dictType: "sys_user_sex",
+		dictValue: "1"
+	}, {
+		dictCode: 3,
+		dictLabel: "未知",
+		dictSort: 3,
+		dictType: "sys_user_sex",
+		dictValue: "2"
+	}],
+
+	pay_status: [{
+		dictCode: 117,
+		dictLabel: "未结算",
+		dictSort: 1,
+		dictType: "pay_status",
+		dictValue: "dis_pay"
+	}, {
+		dictCode: 118,
+		dictLabel: "已结算",
+		dictSort: 2,
+		dictType: "pay_status",
+		dictValue: "is_pay"
+	}],
+	deal_status: [{
+		dictCode: 120,
+		dictLabel: "未开始",
+		dictSort: 0,
+		dictType: "deal_status",
+		dictValue: "no_start"
+	}, {
+		dictCode: 115,
+		dictLabel: "进行中",
+		dictSort: 1,
+		dictType: "deal_status",
+		dictValue: "in_progress"
+	}, {
+		dictCode: 116,
+		dictLabel: "已完成",
+		dictSort: 2,
+		dictType: "deal_status",
+		dictValue: "complete"
+	}]
+}
+
+export function getDict(dbName = 'deal_status', query = {}) {
+	if (typeof dbName !== 'string' && typeof query !== 'object') return {};
+	if (Object.keys(query).length === 0) return {};
+	let dbData = STATUS_CONFIGE[dbName];
+	let distRes = {};
+	// console.log('dbData=>', dbData);
+	dbData.some((dict) => {
+		let bool = true;
+		for (var key in query) {
+			if (dict.hasOwnProperty(key)) {
+				if (query[key] != dict[key]) {
+					bool = false;
+				}
+			} else {
+				bool = false;
+			}
+		}
+		if (bool) {
+			distRes = dict;
+			return bool;
+		}
+	})
+	return distRes;
+}

+ 16 - 0
pages.json

@@ -94,6 +94,22 @@
 					"navigationStyle": "custom",
 					"navigationBarTextStyle": "black"
 				}
+			},
+			{
+				"path" : "pages/protocol/list",
+				"style" : 
+				{
+					"navigationStyle": "custom",
+					"navigationBarTitleText" : "协议列表"
+				}
+			},
+			{
+				"path" : "pages/protocol/info",
+				"style" : 
+				{
+					"navigationStyle": "custom",
+					"navigationBarTitleText" : "协议详情"
+				}
 			}
 		]
 	}],

+ 23 - 9
pages/subpack/components/apply/apply-item.vue

@@ -1,27 +1,27 @@
 <template>
 	<view class="apply-item" @tap="tapItemHandle">
 		<view class="apply-item-tag"
-		:class="[`apply-item-tag${item.status}`]">待签到</view>
+		:class="[`apply-item-tag${item.dealStatus??1}`]">{{statusText}}</view>
 		<view class="flex-row">
 			<u-image class="apply-item-image1" width="51.2rpx" height="51.2rpx" bgColor="transparent"
 				src="@/pages/subpack/static/images/app/avatar-mini.png" />
-			<view class="apply-item-name">张三🤩</view>
+			<view class="apply-item-name">{{item.personName}}</view>
 		</view>
 		<view class="apply-item-content">
 			<view class="flex-row align-center">
 				<u-image class="apply-item-image2" width="36rpx" height="36rpx" bgColor="transparent"
-					src="@/pages/subpack/static/images/app/time-icon.png" />
+					src="@/pages/subpack/static/images/app/cat-icon.png" />
 				<view class="apply-item-tips">
-					<text>事项:</text>
-					<text>企业设立、变更、注销登记</text>
+					<text>需求:</text>
+					<text>{{item.careNeeds}}</text>
 				</view>
 			</view>
 			<view class="flex-row align-center mt-08">
 				<u-image class="apply-item-image2" width="36rpx" height="36rpx" bgColor="transparent"
-					src="@/pages/subpack/static/images/app/cat-icon.png" />
+					src="@/pages/subpack/static/images/app/time-icon.png" />
 				<view class="apply-item-tips1">
-					<text>预约时间:</text>
-					<text>2024.09.09 11:00-12:00</text>
+					<text>申请日期:</text>
+					<text>{{item.applyDate}}</text>
 				</view>
 			</view>
 		</view>
@@ -29,6 +29,10 @@
 </template>
 
 <script setup>
+	import { computed } from 'vue'
+import {
+		getDict
+	} from '@/common/status/index.js'
 	const emit = defineEmits(['tapItem'])
 	const props = defineProps({
 		item: {
@@ -48,6 +52,11 @@
 	const tapItemHandle = () => {
 		emit('tapItem', props.item)
 	}
+	const statusText = computed(()=>{
+		if(props.item.dealStatus === 'complete') return '已完成';
+		let dict = getDict('care_apply_status', {dictValue: props.item.status});
+		return dict.dictLabel??'空状态';
+	})
 </script>
 
 <style lang="scss" scoped>
@@ -79,9 +88,14 @@
 			background: linear-gradient(to right, #EFEFEF 0%, #EFEFEF 100%);
 			color: #888888;
 		}
-		&-tag2{
+		&-tag2,
+		&-tagin_progress{
 			background: linear-gradient(to right, #1677FF 0%, #5EA0FB 100%);
 		}
+		&-tag0,
+		&-tagin_disagree{
+			background: linear-gradient(to right, #fa3534 0%, #fa6355 100%);
+		}
 
 		&-name {
 			font-size: 32rpx;

+ 129 - 29
pages/subpack/pages/application/list.vue

@@ -10,7 +10,7 @@
 			</template>
 			<template #default>
 				<view class="apply-list">
-					<applyItem v-for="(item, index) in dataList" :key="index" @tapItem="tapItemHandle" />
+					<applyItem v-for="(item, index) in dataList" :item="item" :key="index" @tapItem="tapItemHandle" />
 				</view>
 			</template>
 		</z-paging>
@@ -21,9 +21,20 @@
 	import {
 		ref,
 		reactive,
-		getCurrentInstance
+		getCurrentInstance,
+		onMounted
 	} from 'vue';
+	//import { onLoad } from '@dcloudio/uni-app'
 	import applyItem from '../../components/apply/apply-item.vue';
+	
+	import {
+		useStore
+	} from 'vuex';
+	import {
+		getCareList
+	} from '@/common/config/application-api.js'
+	const store = useStore();
+	const user = store.state.vuex_user;
 
 	const {
 		proxy
@@ -51,19 +62,108 @@
 			default: false
 		}
 	})
-	const tabList = reactive([{
-			name: '进行中'
-		},
-		{
-			name: '已完成'
-		},
-		{
-			name: '未结算'
-		},
-		{
-			name: '已结算'
-		}
-	])
+
+	const tabData = {
+		common: [{
+			name: '进行中',
+			query: {
+				dealStatus: 'in_progress'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}],
+		admin: [{
+			name: '进行中',
+			query: {
+				dealStatus: 'in_progress'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}],
+		village: [{
+			name: '未送审',
+			query: {
+				status: 'no_check'
+			}
+		}, {
+			name: '进行中',
+			query: {
+				dealStatus: 'in_progress'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}],
+		area: [{
+			name: '待审核',
+			query: {
+				status: 'wait_check'
+			}
+		}, {
+			name: '进行中',
+			query: {
+				dealStatus: 'in_progress'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}, {
+			name: '已拒绝',
+			query: {
+				status: 'disagree'
+			}
+		}],
+		company: [{
+			name: '待分配',
+			query: {
+				status: 'no_check'
+			}
+		}, {
+			name: '进行中',
+			query: {
+				dealStatus: 'in_progress'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}],
+		nurse: [{
+			name: '护理任务',
+			query: {
+				status: 'no_check'
+			}
+		}, {
+			name: '已完成',
+			query: {
+				dealStatus: 'complete'
+			}
+		}],
+	}
+	const tabList = ref([])
+
+	let roles = user.roles ?? [];
+	roles.map(r => {
+		if (tabData.hasOwnProperty(r) && tabList.value.length === 0) tabList.value = tabData[r];
+	})
+	if (tabList.value.length === 0) tabList.value = tabData.common;
+
+
+	//根据tab计算有多少宽度
+	itemStyle.width = 750 / tabList.value.length < 150 ? '150rpx' : `${750 / tabList.value.length}rpx`;
+
+
 	const tabIndex = ref(0)
 
 	function handleTabs({
@@ -80,21 +180,21 @@
 	const paging = ref(null)
 
 	function queryList(pageNo, pageSize) {
-		uni.showLoading({
-			title: '加载中...',
-			mask: true
-		})
-		let list = [];
-		for (var i = 0; i < 20; i++) {
-			list.push({
-				id: i,
-				name: `test${i}`
-			})
+		let params = {
+			pageNum: pageNo,
+			pageSize
+		}
+		if(tabList.value.length>tabIndex.value){
+			let query = tabList.value[tabIndex.value].query;
+			params = {...params, ...query}
 		}
-		setTimeout(() => {
-			paging.value.complete(list);
-			uni.hideLoading();
-		}, 500)
+	
+		getCareList({
+			params: params
+		}).then(data => {
+			// console.log('getCareList=>', data);
+			paging.value.complete(data);
+		})
 	}
 
 

+ 18 - 3
pages/subpack/pages/myInfo/info.vue

@@ -4,12 +4,13 @@
 		<u-cell-group :border="false" :customStyle="{background: '#fff', margin: '30rpx',  borderRadius: '20rpx'}">
 			<u-cell title="头像" isLink>
 				<template #value>
-					<u-avatar />
+					<up-avatar size="116rpx" :src="user.avatar" defaultUrl="/static/mine/avatar-def.png"
+						bgColor="#305BFF" />
 				</template>
 			</u-cell>
 			<u-cell title="姓名" isLink :border="false">
 				<template #value>
-					<view>张大浪</view>
+					<view>{{user.nickName}}</view>
 				</template>
 			</u-cell>
 		</u-cell-group>
@@ -17,7 +18,21 @@
 </template>
 
 <script setup>
-
+	import {
+		onMounted,
+		ref
+	} from 'vue';
+	import {
+		useStore
+	} from 'vuex';
+	// 获取 Vuex store 实例
+	const store = useStore();
+	const user = ref({
+		nickName: ' '
+	})
+	onMounted(() => {
+		user.value = store.state.vuex_user;
+	})
 </script>
 <style>
 	page {

+ 60 - 0
pages/subpack/pages/protocol/info.vue

@@ -0,0 +1,60 @@
+<template>
+	<view>
+		<u-navbar class="u-navbar-box" :title="data.info.title??'用户协议'" placeholder bgColor="transparent" autoBack />
+		<view style="padding: 30rpx;">
+			<!-- <view style="text-align: center;margin-bottom: 20rpx;font-weight: bold;font-size: 35rpx;">{{data.info.title}}</view> -->
+			<up-parse :content="data.info.content"/>
+		</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		onMounted,
+		reactive
+	} from 'vue';
+	import {
+		onLoad
+	} from '@dcloudio/uni-app'
+	import {
+		getProtocolInfo
+	} from '@/common/config/application-api.js'
+
+
+	const data = reactive({
+		id: 0,
+		info: {}
+	})
+
+	function init() {
+		getProtocolInfo({
+			id: data.id
+		}).then(res => {
+			data.info = res;
+			// console.log(data);
+			// console.log('getProtocolInfo=>', data);
+		})
+	}
+
+	onLoad((params) => {
+		if (params.id) data.id = params.id;
+		init();
+	})
+</script>
+
+<style>
+	page {
+		background-color: #F6FAFF;
+	}
+</style>
+<style lang="scss" scoped>
+	:deep(.u-navbar__content__title) {
+		font-weight: bold;
+		font-size: 36rpx;
+		color: #222222;
+	}
+
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+</style>

+ 57 - 0
pages/subpack/pages/protocol/list.vue

@@ -0,0 +1,57 @@
+<template>
+	<view>
+		<u-navbar class="u-navbar-box" title="用户协议" placeholder bgColor="transparent" autoBack />
+		<u-cell-group :border="false" :customStyle="{background: '#fff',padding: '10rpx 0', borderRadius: '20rpx'}">
+			<u-cell v-for="(item, index) in dataList" :key='index' :title="item.title" isLink @click="goToInfo(item)"/>
+		</u-cell-group>
+	</view>
+</template>
+
+<script setup>
+	import {
+		onMounted,
+		ref
+	} from 'vue';
+	import {
+		getProtocolList
+	} from '@/common/config/application-api.js'
+
+	const dataList = ref([
+		{title: '用户协议'}
+	]);
+
+	function init() {
+		getProtocolList({
+			parmas: {
+				status: 'active'
+			}
+		}).then(data => {
+			dataList.value = data;
+			// console.log('getProtocolList=>', res);
+		})
+	}
+	function goToInfo(item) {
+		uni.$u.route('/pages/subpack/pages/protocol/info', {
+			id: item.id
+		})
+	}
+	onMounted(() => {
+		init();
+	})
+</script>
+<style>
+	page {
+		background-color: #F6FAFF;
+	}
+</style>
+<style lang="scss" scoped>
+	:deep(.u-navbar__content__title) {
+		font-weight: bold;
+		font-size: 36rpx;
+		color: #222222;
+	}
+
+	.u-navbar-box {
+		background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
+	}
+</style>

+ 50 - 5
pages/tabbar/mine/mine.vue

@@ -4,9 +4,15 @@
 		<view class="top-box">
 			<u-image class="bg-box" width="690rpx" height="270rpx" src="/static/mine/user-center-bg.png" />
 			<div class="avatar-name">
-				<u-image class="avatar" width="116rpx" bgColor="transparent" height="116rpx"
-					src="/static/mine/avatar-def.png" />
-				<view class="name">{{user.name}}</view>
+				<up-avatar size="116rpx" :src="user.avatar" defaultUrl="/static/mine/avatar-def.png"
+					bgColor="#305BFF" />
+				<!-- <u-image class="avatar" width="116rpx" bgColor="transparent" height="116rpx"
+					src="/static/mine/avatar-def.png" /> -->
+				<view style="margin-left: 30rpx;">
+					<view class="name">{{user.nickName}}</view>
+					<view class="roles">{{handleRolesText()}}</view>
+				</view>
+
 			</div>
 			<div class="abs-right">
 				<u-image bgColor="transparent" width="220rpx" height="258rpx" src="/static/mine/user-center-img.png" />
@@ -23,16 +29,51 @@
 					<u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
 				</template>
 			</u-cell>
+			<u-cell icon="integral-fill" title="用户协议" isLink :border="false" url="/pages/subpack/pages/protocol/list">
+				<template #icon>
+					<u-image src="/static/mine/myself.png" bgColor="transparent" width="36rpx" height="36rpx" />
+				</template>
+			</u-cell>
 		</u-cell-group>
 	</view>
 </template>
 
 <script setup>
 	import {
+		onMounted,
 		ref
 	} from 'vue';
+	import {
+		useStore
+	} from 'vuex';
+	// 获取 Vuex store 实例
+	const store = useStore();
 	const user = ref({
-		name: '李大川'
+		nickName: ' ',
+		roles: []
+	})
+
+	const roleKV = {
+		common: '普通角色',
+		admin: '超级管理员',
+		village: '乡镇民政所',
+		area: '区民政局',
+		company: '护理公司',
+		nurse: '护理员'
+	}
+	function handleRolesText() {
+		let roles = user.value.roles;
+		let roleText = [];
+		roles.map(item=>{
+			if(roleKV.hasOwnProperty(item)){
+				roleText.push(roleKV[item]);
+			}
+		})
+		return roleText.join(',');
+	}
+	onMounted(() => {
+		console.log('store=>', store.state);
+		user.value = store.state.vuex_user;
 	})
 </script>
 <style>
@@ -72,7 +113,11 @@
 				font-weight: bold;
 				font-size: 40rpx;
 				color: #000000;
-				margin-left: 30rpx;
+			}
+			.roles {
+				font-size: 28rpx;
+				margin-top: 10rpx;
+				color: #000000;
 			}
 		}
 

BIN
static/logo.png


+ 10 - 1
utils/request/index.js

@@ -10,7 +10,16 @@ import {
 //  初始化请求配置
 const initRequest = (vm) => {
 	http.setConfig((defaultConfig) => {
-		defaultConfig.baseURL = 'http://tkhtest.natapp1.cc' /* 根域名 */
+		// defaultConfig.baseURL = 'http://tkhtest.natapp1.cc' /* 根域名 */
+		defaultConfig.baseURL = 'http://127.0.0.1' /* 根域名 */
+		defaultConfig = {
+			...defaultConfig, 
+			custom: {
+				loading: true, //是否显示loading
+				isCloseLoad: true, //请求返回数据后,是否关闭loading
+				validateCode: true,//验证code
+			},
+		}
 		/* defaultConfig 为默认全局配置 */
 		// if (process.env.NODE_ENV === 'development') {
 		// 	defaultConfig.baseURL = '/api' /* 根域名 */

+ 10 - 1
utils/request/interceptors.js

@@ -15,6 +15,11 @@ const requestInterceptors = (vm) => {
 			// console.log(config)
 			// config.header.token = store.state.vuex_token
 			config.header.Authorization = 'Bearer ' + store.state.vuex_token
+			if (config?.custom?.loading) {
+				uni.showLoading({
+					title: '数据加载中...'
+				});
+			}
 			return config
 		}, (config) => // 可使用async await 做异步操作
 		Promise.reject(config))
@@ -26,9 +31,12 @@ const responseInterceptors = (vm) => {
 	 */
 	http.interceptors.response.use((response) => {
 		// console.log('response: ', response);
+		if (response?.config?.custom?.isCloseLoad) {
+			uni.hideLoading();
+		}
 		/* 对响应成功做点什么 可使用async await 做异步操作*/
 		const data = response.data
-		// console.log('http', data)
+		// console.log('http=>', data)
 		// 自定义参数
 		const custom = response.config?.custom
 		if (data.code !== 200) { // 服务端返回的状态码不等于200,则reject()
@@ -54,6 +62,7 @@ const responseInterceptors = (vm) => {
 				return new Promise(() => {})
 			}
 		}
+		if(!data.data && data.rows) data.data = data.rows;
 		return data.data || {}
 	}, (response) => {
 		/*  对响应错误做点什么 (statusCode !== 200)*/