Răsfoiți Sursa

【feat】【第二版开发】

1.增加字典组件
2.数据改为从字典读取
3.移除无效代码
ChenYL 1 an în urmă
părinte
comite
b889a14c00

+ 4 - 1
src/App.vue

@@ -3,11 +3,14 @@ import naviInterceptor from '@/interceptors/naviInterceptor.js';
 import { useSafeAreaStore } from '@/stores/safeArea.js';
 import { onLaunch, onShow } from '@dcloudio/uni-app';
 import { getSafeArea } from '@/utils/system.js';
+import { useDictStore } from '@/stores/dict';
 
 onLaunch(() => {
 	// 导航拦截器初始化
 	naviInterceptor();
-
+	// 数据字典初始化
+	const dictStore = useDictStore();
+	dictStore.refresh();
 });
 
 onShow(() => {

+ 41 - 0
src/common/constants/dict.js

@@ -0,0 +1,41 @@
+/**
+ * 字典常量
+ */
+const dictConst = {
+    /**
+     * 刮刮乐来源
+     */
+    LOTTERY_SCRATCH_SOURCE: "LOTTERY_SCRATCH_SOURCE",
+
+    /**
+     * 福利彩票刮刮乐种类
+     */
+    WELFARE_SCRATCH: "WELFARE_SCRATCH",
+
+    /**
+     * 体育彩票刮刮乐种类
+     */
+	SPORTS_SCRATCH: "SPORTS_SCRATCH",
+
+    /**
+     * 刮刮乐动作类型
+     */
+    SCRATCH_ACTION_TYPE: "SCRATCH_ACTION_TYPE",
+
+    /**
+     * 启用状态标志
+     */
+	ENABLE_STATUS: "ENABLE_STATUS",
+
+    /**
+     * 打卡类型
+     */
+    PUNCH_IN_CATEGORY: "PUNCH_IN_CATEGORY",
+
+    /**
+     * 打卡比较规则
+     */
+    PUNCH_IN_RULE: "PUNCH_IN_RULE"	
+};
+
+export default dictConst;

+ 0 - 34
src/common/constants/punchin.js

@@ -1,34 +0,0 @@
-// 打卡任务常量
-
-/**
- * 选项
- */
-export const statusRange = [
-	{
-		"value": 1,
-		"text": "启用"
-	},
-	{
-		"value": 0,
-		"text": "关闭"
-	}
-];
-
-/**
- * 打卡类型
- */
-export const categoryRange = [
-    { value: 0, text: "单次打卡" },
-    { value: 1, text: "计数" },
-    { value: 2, text: "计时" },
-  ];
-  
-/**
- * 比较规则
- */
-export const ruleRange = [
-	{ value: 0, text: "大于等于" },
-	{ value: 1, text: "小于等于" },
-	{ value: 2, text: "大于" },
-	{ value: 3, text: "小于" },
-];

+ 1 - 17
src/common/constants/scratch.js

@@ -8,20 +8,4 @@ export const SCRATCH_ACTION_TYPE_INVEST = 0;
 /**
  * 动作类型:中奖
  */
-export const SCRATCH_ACTION_TYPE_WIN = 1;
-
-/**
- * 来源范围
- */
-export const scratchSourceRange = [
-	{ value: 'WELFARE_LOTTERY', text: "福利彩票" },
-	{ value: 'SPORTS_LOTTERY', text: "体育彩票" }
-];
-  
-  /**
-   * 种类范围
-   */
-export const scratchCategoryRange = [
-	{ value: 'XINYUN88', text: "幸运88" },
-	{ value: 'CHAOGEILI', text: "超给力" }
-];
+export const SCRATCH_ACTION_TYPE_WIN = 1;

+ 43 - 0
src/components/dict-item/dict-item.vue

@@ -0,0 +1,43 @@
+<template>
+  <span>{{ itemName }}</span>
+</template>
+
+<script setup>
+import { computed } from 'vue';
+import { useDictStore } from '@/stores/dict';
+
+// 组件入参
+const props = defineProps({
+  dictCode: {
+    type: String,
+    default: ''
+  },
+  itemCode: {
+    type: [String, Number],
+    default: ''
+  }
+});
+
+// 属性
+/**
+ * 字典信息
+ */
+const dictStore = useDictStore();
+
+/**
+ * 字典显示计算属性
+ */
+const itemName = computed(() => {
+  if (!dictStore[props.dictCode]) {
+    return '';
+  }
+  for (let item of dictStore[props.dictCode]) {
+    if (item.value == props.itemCode) {
+      return item.text;
+    }
+  }
+  return '';
+});
+</script>
+
+<style lang="scss" scoped></style>

+ 71 - 72
src/components/main-layout/main-layout.vue

@@ -2,24 +2,24 @@
 	<view class="layout-container">
 		<!-- 顶部填充区 -->
 		<view :style="safeAreaStore.statusBarStyle"></view>
-		
+
 		<!-- 顶部胶囊区 -->
 		<view class="capsule-box" :style="safeAreaStore.capsuleBarStyle">
 			<view class="icon-wrap" v-if="showBack || showHome">
 				<view v-if="showBack" class="icon-box" :style="safeAreaStore.iconBoxStyle" @click="goBackPage">
-					<uni-icons type="back" color="#FFFFFF" :size="safeAreaStore.iconSize"></uni-icons>		
+					<uni-icons type="back" color="#FFFFFF" :size="safeAreaStore.iconSize"></uni-icons>
 				</view>
 				<view v-if="showHome" class="icon-box" :style="safeAreaStore.iconBoxStyle" @click="goIndexPage">
-					<uni-icons type="home" color="#FFFFFF" :size="safeAreaStore.iconSize"></uni-icons>	
+					<uni-icons type="home" color="#FFFFFF" :size="safeAreaStore.iconSize"></uni-icons>
 				</view>
 			</view>
 		</view>
-		
+
 		<!-- 内容区 -->
 		<view class="content-box">
 			<slot></slot>
 		</view>
-		
+
 		<!-- 底部填充区 -->
 		<view :style="safeAreaStore.bottomBoxStyle"></view>
 
@@ -27,80 +27,79 @@
 </template>
 
 <script setup>
-	import { computed, ref } from 'vue';
-	import { useSafeAreaStore } from '@/stores/safeArea.js';
-	import router from '@/common/constants/router';
-	
-	defineProps({
-		showHome: {
-			type: Boolean,
-			default: false
-		},
-		showBack: {
-			type: Boolean,
-			default: false
-		}
+import { useSafeAreaStore } from '@/stores/safeArea.js';
+import router from '@/common/constants/router';
+
+defineProps({
+	showHome: {
+		type: Boolean,
+		default: false
+	},
+	showBack: {
+		type: Boolean,
+		default: false
+	}
+});
+
+/**
+ * 安全区
+ */
+const safeAreaStore = useSafeAreaStore();
+
+/**
+ * 返回主页
+ */
+const goIndexPage = () => {
+	uni.reLaunch({
+		url: router.INDEX_URL
 	});
-	
-	/**
-	 * 安全区
-	 */
-	const safeAreaStore = useSafeAreaStore();
-	
-	/**
-	 * 返回主页
-	 */
-	const goIndexPage = () => {
-		uni.reLaunch({
-			url: router.INDEX_URL
-		});
-	};
-	
-	/**
-	 * 返回上一页
-	 */
-	const goBackPage = () => {
-		uni.navigateBack();
-	};
+};
+
+/**
+ * 返回上一页
+ */
+const goBackPage = () => {
+	uni.navigateBack();
+};
 </script>
 
 <style lang="scss" scoped>
-	.layout-container {
-		display: flex;
-		flex-direction: column;
-		min-height: 100vh;
-		background: linear-gradient(180deg, #B9D3FF 0%, #F2F7FF 22.23%);
-		
-		.capsule-box {
-			padding-left: 24rpx;
-			padding-right: 24rpx;
-			
-			.icon-wrap {
+.layout-container {
+	display: flex;
+	flex-direction: column;
+	min-height: 100vh;
+	background: linear-gradient(180deg, #B9D3FF 0%, #F2F7FF 22.23%);
+
+	.capsule-box {
+		padding-left: 24rpx;
+		padding-right: 24rpx;
+
+		.icon-wrap {
+			display: flex;
+			justify-content: left;
+			height: 100%;
+			align-items: center;
+
+			.icon-box {
+				margin-left: 16rpx;
 				display: flex;
-				justify-content: left;
-				height: 100%;
 				align-items: center;
-				
-				.icon-box {
-					margin-left: 16rpx;
-					display: flex;
-					align-items: center;
-					justify-content: center;
-					border-radius: 50%;
-					opacity: 0.2;
-					background: rgba(0, 0, 0, 1);
-				}
-						
-				.icon-box:first-child {
-					margin-left: 0rpx;
-				}
+				justify-content: center;
+				border-radius: 50%;
+				opacity: 0.2;
+				background: rgba(0, 0, 0, 1);
+			}
+
+			.icon-box:first-child {
+				margin-left: 0rpx;
 			}
 		}
-		
-		.content-box {
-			/* 内容区域占满剩余空间 */
-			flex-grow: 1;
-			padding: 0 24rpx 16rpx 24rpx;
-		}
 	}
+
+	.content-box {
+		/* 内容区域占满剩余空间 */
+		flex-grow: 1;
+		padding: 0 24rpx 16rpx 24rpx;
+	}
+}
 </style>

+ 1 - 1
src/main.js

@@ -23,7 +23,7 @@ export function createApp() {
   app.use(pinia);
   return {
     app,
-	Pinia
+	  Pinia
   }
 }
 // #endif

+ 18 - 16
src/pages/index/index.vue

@@ -75,17 +75,12 @@
 						<view class="item-tag" v-if="punchIn.fullAttendanceFlag">全勤奖励</view>
 						<view class="item-tag" v-if="punchIn.weekendDoubleFlag">周末双倍</view>
 					</view>
-					<view class="item-desc" v-if="punchIn.category == 1">
-						规则:打卡次数
-						<span v-if="punchIn.rule == 0">大于等于</span>
-						<span v-if="punchIn.rule == 1">小于等于</span>
-						{{ punchIn.countTrack }}次
-					</view>
-					<view class="item-desc" v-if="punchIn.category == 2">
-						规则:计时时间
-						<span v-if="punchIn.rule == 0">大于等于</span>
-						<span v-if="punchIn.rule == 1">小于等于</span>
-						{{ punchIn.timeTrack.slice(0, 5) }}
+					<view class="item-desc" v-if="punchIn.category == 1 || punchIn.category == 2">
+						<span v-if="punchIn.category == 1">规则:打卡次数</span>
+						<span v-if="punchIn.category == 2">规则:计时时间</span>
+						<dict-item :dictCode="dictConst.PUNCH_IN_RULE" :itemCode="punchIn.rule"></dict-item>
+						<span v-if="punchIn.category == 1">{{ punchIn.countTrack }}次</span>
+						<span v-if="punchIn.category == 2">{{ punchIn.timeTrack.slice(0, 5) }}</span>
 					</view>
 					<view class="item-desc">
 						描述:{{ punchIn.description }}
@@ -143,11 +138,11 @@
 					<uni-forms ref="scratchForm" :modelValue="scratchFormData" :rules="scratchFormRules"
 						label-position="top" :label-width="150">
 						<uni-forms-item label="刮刮乐来源" name="source" required>
-							<uni-data-select :localdata="scratchSourceRange"
+							<uni-data-select :localdata="dictStore.LOTTERY_SCRATCH_SOURCE"
 								v-model="scratchFormData.source"></uni-data-select>
 						</uni-forms-item>
 						<uni-forms-item label="刮刮乐种类" name="category" required>
-							<uni-data-select :localdata="scratchCategoryRange"
+							<uni-data-select :localdata="dictStore[scratchFormData.source]"
 								v-model="scratchFormData.category"></uni-data-select>
 						</uni-forms-item>
 						<uni-forms-item
@@ -199,12 +194,14 @@
 </template>
 
 <script setup>
-import { onMounted, ref } from 'vue';
-import { onLoad, onPullDownRefresh, onShow } from "@dcloudio/uni-app";
+import { ref } from 'vue';
+import { onPullDownRefresh, onShow } from "@dcloudio/uni-app";
 import { rewardApi, punchInApi, userApi, scratchApi } from '@/service/apis.js';
 import router from '@/common/constants/router.js';
-import { scratchSourceRange, scratchCategoryRange, SCRATCH_ACTION_TYPE_INVEST, SCRATCH_ACTION_TYPE_WIN } from '@/common/constants/scratch';
+import { SCRATCH_ACTION_TYPE_INVEST, SCRATCH_ACTION_TYPE_WIN } from '@/common/constants/scratch';
 import { useUserInfoStore } from '@/stores/userInfo.js';
+import { useDictStore } from '@/stores/dict';
+import dictConst from '@/common/constants/dict.js';
 
 // 组件
 /**
@@ -239,6 +236,11 @@ const timeTrackForm = ref(null);
 
 
 // 属性
+/**
+ * 字典信息
+ */
+const dictStore = useDictStore();
+
 /**
  * 用户信息
  */

+ 192 - 178
src/pages/punchin-edit/punchin-edit.vue

@@ -10,13 +10,16 @@
 						<uni-easyinput v-model="punchInFormData.rewardNum" placeholder="请输入奖励数" type="number" />
 					</uni-forms-item>
 					<uni-forms-item label="周末双倍" required name="weekendDoubleFlag">
-						<uni-data-checkbox v-model="punchInFormData.weekendDoubleFlag" :localdata="statusRange"></uni-data-checkbox>
+						<uni-data-checkbox v-model="punchInFormData.weekendDoubleFlag"
+							:localdata="dictStore.ENABLE_STATUS"></uni-data-checkbox>
 					</uni-forms-item>
 					<uni-forms-item label="全勤双倍" required name="fullAttendanceFlag">
-						<uni-data-checkbox v-model="punchInFormData.fullAttendanceFlag" :localdata="statusRange"></uni-data-checkbox>
+						<uni-data-checkbox v-model="punchInFormData.fullAttendanceFlag"
+							:localdata="dictStore.ENABLE_STATUS"></uni-data-checkbox>
 					</uni-forms-item>
 					<uni-forms-item label="打卡类型" required name="category">
-						<uni-data-select :localdata="categoryRange" v-model="punchInFormData.category"></uni-data-select>
+						<uni-data-select :localdata="dictStore.PUNCH_IN_CATEGORY"
+							v-model="punchInFormData.category"></uni-data-select>
 					</uni-forms-item>
 					<uni-forms-item label="规则描述" name="description">
 						<uni-easyinput type="textarea" v-model="punchInFormData.description" placeholder="请输入任务描述" />
@@ -24,7 +27,8 @@
 				</uni-section>
 				<uni-section title="计数配置" padding="16px" type="line" v-if="punchInFormData.category == 1">
 					<uni-forms-item label="判断规则" required name="rule">
-						<uni-data-select :localdata="ruleRange" v-model="punchInFormData.rule"></uni-data-select>
+						<uni-data-select :localdata="dictStore.PUNCH_IN_RULE"
+							v-model="punchInFormData.rule"></uni-data-select>
 					</uni-forms-item>
 					<uni-forms-item label="数值" required name="countTrack">
 						<uni-easyinput v-model="punchInFormData.countTrack" placeholder="请输入目标数值" type="digit" />
@@ -32,17 +36,19 @@
 				</uni-section>
 				<uni-section title="计时配置" padding="16px" type="line" v-if="punchInFormData.category == 2">
 					<uni-forms-item label="判断规则" required name="rule">
-						<uni-data-select :localdata="ruleRange" v-model="punchInFormData.rule"></uni-data-select>
+						<uni-data-select :localdata="dictStore.PUNCH_IN_RULE"
+							v-model="punchInFormData.rule"></uni-data-select>
 					</uni-forms-item>
 					<uni-forms-item label="时间" required name="timeTrack">
 						<picker mode="time" :value="punchInFormData.timeTrack" @change="timeChange">
-							<view class="pick-box">{{punchInFormData.timeTrack}}</view>
+							<view class="pick-box">{{ punchInFormData.timeTrack }}</view>
 						</picker>
 					</uni-forms-item>
 				</uni-section>
 				<view class="button-container">
 					<button type="default" style="width:300rpx;" @click="cancel">取消</button>
-					<button type="primary" style="color:#ffffff;backgroundColor:#2A82E4;width:300rpx;" @click="savePunchIn">保存</button>
+					<button type="primary" style="color:#ffffff;backgroundColor:#2A82E4;width:300rpx;"
+						@click="savePunchIn">保存</button>
 				</view>
 			</uni-forms>
 		</template>
@@ -50,182 +56,190 @@
 </template>
 
 <script setup>
-	import { ref } from 'vue';
-	import { onLoad } from '@dcloudio/uni-app';
-	import { punchInApi } from '@/service/apis';
-	import { ruleRange, categoryRange, statusRange } from '@/common/constants/punchin.js';
-	
-	// 组件
-	/**
-	 * 打卡任务表单
-	 */
-	const punchInForm = ref(null);
-	
-	// 属性
-	/**
-	 * 打卡任务表单数据
-	 */
-	const punchInFormData = ref({
-		"rewardNum": 1,
-		"weekendDoubleFlag": 1,
-		"fullAttendanceFlag": 1,
-		"category": 0,
-		"rule": 0,
-		"countTrack": 10,
-		"timeTrack": "00:00"
-	});
-	
-	/**
-	 * 打卡任务表单规则
-	 */
-	const punchInFormRules = ref({
-		taskName: {
-			rules: [{
-				required: true,
-				errorMessage: '任务名称不能为空'
-			}]
-		},
-		rewardNum: {
-			rules: [{
-				required: true,
-				errorMessage: '奖励数值不能为空'
-			}, {
-				format: 'number',
-				errorMessage: "请输入有效数字"
-			}, {
-				minimum:1,
-				errorMessage: "最小值{minimum}"
-			}]
-		},
-		weekendDoubleFlag: {
-			rules: [{
-				required: true,
-				errorMessage: '周末双倍奖励不能为空'
-			}]
-		},
-		fullAttendanceFlag: {
-			rules: [{
-				required: true,
-				errorMessage: '全勤奖励不能为空'
-			}]
-		},
-		category: {
-			rules: [{
-				required: true,
-				errorMessage: '任务类型不能为空'
-			}]
-		},
-		description: {
-			rules: [{
-				maxLength: 100,
-				errorMessage: '描述不能超过{maxLength}个字符'
-			}]
-		},
-		rule: {
-			rules: [{
-				required: true,
-				errorMessage: '判断规则不能为空'
-			}]
-		},
-		countTrack: {
-			rules: [{
-				required: true,
-				errorMessage: '数值不能为空'
-			}, {
-				format: 'number',
-				errorMessage: "请输入有效数字"
-			}, {
-				minimum:1,
-				errorMessage: "最小值{minimum}"
-			}]
-		},
-		timeTrack: {
-			rules: [{
-				required: true,
-				errorMessage: '数值不能为空'
-			}]
-		}
-	});
+import { ref } from 'vue';
+import { onLoad } from '@dcloudio/uni-app';
+import { punchInApi } from '@/service/apis';
+import { useDictStore } from '@/stores/dict';
 
-	/**
-	 * 周末双倍奖励开关改变监听
-	 */
-	const weekendDoubleSwitchChange = (e) => {
-		punchInFormData.value.weekendDoubleFlag = e.detail.value;
-	}
-	
-	/**
-	 * 全勤奖励开关改变监听
-	 */
-	const fullAttendanceSwitchChange = (e) => {
-		punchInFormData.value.fullAttendanceFlag = e.detail.value;
-	}
-	
-	/**
-	 * 时间选择监听
-	 */
-	const timeChange = (e) => {
-		punchInFormData.value.timeTrack = e.detail.value;
+// 组件
+/**
+ * 打卡任务表单
+ */
+const punchInForm = ref(null);
+
+// 属性
+/**
+ * 字典状态管理
+ */
+const dictStore = useDictStore();
+
+/**
+ * 打卡任务表单数据
+ */
+const punchInFormData = ref({
+	"rewardNum": 1,
+	"weekendDoubleFlag": 1,
+	"fullAttendanceFlag": 1,
+	"category": 0,
+	"rule": 0,
+	"countTrack": 10,
+	"timeTrack": "00:00"
+});
+
+/**
+ * 打卡任务表单规则
+ */
+const punchInFormRules = ref({
+	taskName: {
+		rules: [{
+			required: true,
+			errorMessage: '任务名称不能为空'
+		}]
+	},
+	rewardNum: {
+		rules: [{
+			required: true,
+			errorMessage: '奖励数值不能为空'
+		}, {
+			format: 'number',
+			errorMessage: "请输入有效数字"
+		}, {
+			minimum: 1,
+			errorMessage: "最小值{minimum}"
+		}]
+	},
+	weekendDoubleFlag: {
+		rules: [{
+			required: true,
+			errorMessage: '周末双倍奖励不能为空'
+		}]
+	},
+	fullAttendanceFlag: {
+		rules: [{
+			required: true,
+			errorMessage: '全勤奖励不能为空'
+		}]
+	},
+	category: {
+		rules: [{
+			required: true,
+			errorMessage: '任务类型不能为空'
+		}]
+	},
+	description: {
+		rules: [{
+			maxLength: 100,
+			errorMessage: '描述不能超过{maxLength}个字符'
+		}]
+	},
+	rule: {
+		rules: [{
+			required: true,
+			errorMessage: '判断规则不能为空'
+		}]
+	},
+	countTrack: {
+		rules: [{
+			required: true,
+			errorMessage: '数值不能为空'
+		}, {
+			format: 'number',
+			errorMessage: "请输入有效数字"
+		}, {
+			minimum: 1,
+			errorMessage: "最小值{minimum}"
+		}]
+	},
+	timeTrack: {
+		rules: [{
+			required: true,
+			errorMessage: '数值不能为空'
+		}]
 	}
-	
-	/**
-	 * 保存打卡任务
-	 */
-	const savePunchIn = () => {
-		punchInForm.value.validate(['id']).then(() => {
-			return punchInApi.addPunchIn(punchInFormData.value)
-		}).then(datt => {
-			uni.showToast({
-				title: '保存成功',
-				icon: 'success',
-				duration: 2000
-			});
-			setTimeout(() => {
-				uni.navigateBack();
-			}, 2000);
+});
+
+/**
+ * 周末双倍奖励开关改变监听
+ */
+const weekendDoubleSwitchChange = (e) => {
+	punchInFormData.value.weekendDoubleFlag = e.detail.value;
+}
+
+/**
+ * 全勤奖励开关改变监听
+ */
+const fullAttendanceSwitchChange = (e) => {
+	punchInFormData.value.fullAttendanceFlag = e.detail.value;
+}
+
+/**
+ * 时间选择监听
+ */
+const timeChange = (e) => {
+	punchInFormData.value.timeTrack = e.detail.value;
+}
+
+/**
+ * 保存打卡任务
+ */
+const savePunchIn = () => {
+	punchInForm.value.validate(['id']).then(() => {
+		return punchInApi.addPunchIn(punchInFormData.value)
+	}).then(datt => {
+		uni.showToast({
+			title: '保存成功',
+			icon: 'success',
+			duration: 2000
 		});
-	}
-	
-	/**
-	 * 后退
-	 */
-	const cancel = () => {
-		uni.navigateBack();
-	}
-	
-	onLoad(async (e) => {
-		if (e.id) {
-			const res = await punchInApi.queryPunchInById({"id": e.id});
-			res.fullAttendanceFlag = res.fullAttendanceFlag ? 1 : 0;
-			res.weekendDoubleFlag = res.weekendDoubleFlag ? 1 : 0;
-			punchInFormData.value = res;
-		}
+		setTimeout(() => {
+			uni.navigateBack();
+		}, 2000);
 	});
+}
+
+/**
+ * 后退
+ */
+const cancel = () => {
+	uni.navigateBack();
+}
+
+onLoad(async (e) => {
+	if (e.id) {
+		const res = await punchInApi.queryPunchInById({ "id": e.id });
+		res.fullAttendanceFlag = res.fullAttendanceFlag ? 1 : 0;
+		res.weekendDoubleFlag = res.weekendDoubleFlag ? 1 : 0;
+		punchInFormData.value = res;
+	}
+});
 </script>
 
 <style lang="scss" scoped>
-	.pick-box {
-		display: flex;
-		box-sizing: border-box;
-		flex-direction: row;
-		align-items: center;
-		border: 1px solid #dcdfe6;
-		border-radius: 4px;
-		
-		width: auto;
-		position: relative;
-		overflow: hidden;
-		flex: 1;
-		line-height: 1;
-		font-size: 14px;
-		height: 35px;
-		padding-left: 10px;
-	}
-	
-	.button-container {
-		background-color: #FFFFFF;
-		display: flex; /* 使用Flexbox布局 */
-		justify-content: space-between; /* 按钮之间的空间分布 */
-		padding: 20rpx; /* 容器两侧的空白填充 */
-	}
+.pick-box {
+	display: flex;
+	box-sizing: border-box;
+	flex-direction: row;
+	align-items: center;
+	border: 1px solid #dcdfe6;
+	border-radius: 4px;
+
+	width: auto;
+	position: relative;
+	overflow: hidden;
+	flex: 1;
+	line-height: 1;
+	font-size: 14px;
+	height: 35px;
+	padding-left: 10px;
+}
+
+.button-container {
+	background-color: #FFFFFF;
+	display: flex;
+	/* 使用Flexbox布局 */
+	justify-content: space-between;
+	/* 按钮之间的空间分布 */
+	padding: 20rpx;
+	/* 容器两侧的空白填充 */
+}
 </style>

+ 20 - 7
src/pages/scratch-record-list/scratch-record-list.vue

@@ -10,13 +10,19 @@
 						<view class="content">
 							<p>{{ item.creationTime }}</p>
 							<p>
-								<span v-if="item.actionType == 0">购买</span>
-								<span v-if="item.source == 'WELFARE_LOTTERY'">福彩</span>
-								<span v-if="item.source == 'SPORTS_LOTTERY'">体彩</span>
-								<span v-if="item.category == 'XINYUN88'">幸运88</span>
-								<span v-if="item.category == 'CHAOGEILI'">超给力</span>
-								<span v-if="item.actionType == 0">花费</span>
-								<span v-if="item.actionType == 1">中奖</span>
+
+								<!-- <span v-if="item.actionType == 0">购买</span> -->
+								<dict-item :dictCode="dictConst.LOTTERY_SCRATCH_SOURCE"
+									:itemCode="item.source"></dict-item>
+								<!-- <span v-if="item.source == 'WELFARE_LOTTERY'">福彩</span>
+								<span v-if="item.source == 'SPORTS_LOTTERY'">体彩</span> -->
+								<dict-item :dictCode="item.source" :itemCode="item.category"></dict-item>
+								<dict-item :dictCode="dictConst.SCRATCH_ACTION_TYPE"
+									:itemCode="item.actionType"></dict-item>
+								<!-- <span v-if="item.category == 'XINYUN88'">幸运88</span>
+								<span v-if="item.category == 'CHAOGEILI'">超给力</span> -->
+								<!-- <span v-if="item.actionType == 0">花费</span>
+								<span v-if="item.actionType == 1">中奖</span> -->
 								{{ item.amount }}元
 							</p>
 						</view>
@@ -42,11 +48,18 @@ import { ref } from 'vue';
 import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
 import dateUtils from '@/utils/date';
 import { scratchApi } from '@/service/apis';
+import { useDictStore } from '@/stores/dict';
+import dictConst from '@/common/constants/dict.js';
+
 
 // 组件
 const revokeDialog = ref(null);
 
 //属性
+/**
+ * 字典信息
+ */
+const dictStore = useDictStore();
 /**
  * 日期选择器值/
  */

+ 1 - 25
src/pages/user-info/user-info.vue

@@ -119,32 +119,8 @@ const logout = () => {
 };
 
 /**
- * 跳转结算列表页
+ * 修改昵称 
  */
-const goSettleListPage = () => {
-	uni.navigateTo({
-		url: router.SETTLE_LIST_URL,
-	});
-};
-
-/**
- * 跳转奖励领取记录列表页
- */
-const goClaimRewardListPage = () => {
-	uni.navigateTo({
-		url: router.CLAIM_REWARD_LIST_URL,
-	});
-};
-
-/**
- * 跳转刮刮乐记录列表页
- */
-const goScratchListPage = () => {
-	uni.navigateTo({
-		url: router.SCRATCH_LIST_URL,
-	});
-};
-
 const modifyNickname = (e) => {
 	nicknameInputDialog.value.open();
 };

+ 3 - 1
src/service/apis.js

@@ -4,6 +4,7 @@ import * as rewardApi from './rewardApi.js';
 import * as userApi from './userApi.js';
 import * as scratchApi from './scratchApi.js';
 import * as settleApi from './settleApi.js';
+import * as dictApi from './dictApi.js';
 
 export {
 	loginApi,
@@ -11,5 +12,6 @@ export {
 	rewardApi,
 	userApi,
 	scratchApi,
-	settleApi
+	settleApi,
+	dictApi
 }

+ 18 - 0
src/service/dictApi.js

@@ -0,0 +1,18 @@
+// 字典API
+
+import request from "@/utils/request";
+
+/**
+ * 根据字典编码查询字典项(批量)
+ * @param {String} dictCodes 字典编码数组
+ * @returns 
+ */
+export function queryDictItems(dictCodes) {
+  return request({
+    url: "/dict/queryDictItems",
+    method: "post",
+    data: {
+        "dictCodes": dictCodes
+    }
+  });
+}

+ 60 - 0
src/stores/dict.js

@@ -0,0 +1,60 @@
+import { defineStore } from 'pinia';
+import dictConst from '@/common/constants/dict';
+import { dictApi } from '@/service/apis';
+
+
+/**
+ * 字典
+ */
+export const useDictStore = defineStore('dict', {
+	state: () => ({
+        /**
+         * 刮刮乐来源
+         */
+		LOTTERY_SCRATCH_SOURCE: [],
+        /**
+         * 福彩刮刮乐种类
+         */
+        WELFARE_SCRATCH: [],
+        /**
+         * 体彩刮刮乐种类
+         */
+        SPORTS_SCRATCH: [],
+        /**
+         * 刮刮乐动作类型
+         */
+        SCRATCH_ACTION_TYPE: [],
+        /**
+         * 启用状态
+         */
+        ENABLE_STATUS: [],
+        /**
+         * 打卡类型
+         */
+        PUNCH_IN_CATEGORY: [],
+        /**
+         * 打卡比较规则
+         */
+        PUNCH_IN_RULE: []
+	}),
+	unistorage: true,
+	actions: {
+        // 刷新获取数据字典
+        async refresh() {
+            const dictCodes = [
+                dictConst.LOTTERY_SCRATCH_SOURCE,
+                dictConst.WELFARE_SCRATCH,
+                dictConst.SPORTS_SCRATCH,
+                dictConst.SCRATCH_ACTION_TYPE,
+                dictConst.ENABLE_STATUS,
+                dictConst.PUNCH_IN_CATEGORY,
+                dictConst.PUNCH_IN_RULE
+            ];
+            dictApi.queryDictItems(dictCodes).then(data => {
+                for (let item of data) {
+                    this[item.dictCode] = item.dictItems ? item.dictItems : [];
+                }
+            });
+        }
+    }
+});

+ 1 - 1
src/uni.scss

@@ -75,4 +75,4 @@ $uni-font-size-subtitle:26px;
 $uni-color-paragraph: #3F536E; // 文章段落颜色
 $uni-font-size-paragraph:15px;
 
-@import "@/common/style/common-style.scss";
+@use "@/common/style/common-style.scss";

+ 3 - 2
src/utils/request.js

@@ -1,9 +1,10 @@
 import { useUserInfoStore } from '@/stores/userInfo.js';
 import router from '@/common/constants/router.js';
 
-const userInfoStore = useUserInfoStore();
-
 export default function request(config = {}) {
+	
+	const userInfoStore = useUserInfoStore();
+
 	let {
 		url,
 		data = {},