Browse Source

【feat】【v3】

1.修改项目配置、项目结构
2.修改登录页
3.移除复杂逻辑pinia
ChenYL 11 tháng trước cách đây
mục cha
commit
b66dd5a616
53 tập tin đã thay đổi với 1341 bổ sung2853 xóa
  1. 669 37
      package-lock.json
  2. 2 3
      package.json
  3. 28 0
      project.config.json
  4. 7 0
      project.private.config.json
  5. 12 23
      src/App.vue
  6. 0 0
      src/apis/apis.js
  7. 0 0
      src/apis/dictApi.js
  8. 1 1
      src/apis/loginApi.js
  9. 0 0
      src/apis/punchInApi.js
  10. 0 0
      src/apis/rewardApi.js
  11. 0 0
      src/apis/scratchApi.js
  12. 0 0
      src/apis/settleApi.js
  13. 0 0
      src/apis/tokenApi.js
  14. 0 0
      src/apis/userApi.js
  15. 22 0
      src/common/cache.js
  16. 0 46
      src/common/constants/router.js
  17. 0 0
      src/common/dict.js
  18. 52 0
      src/common/router.js
  19. 0 0
      src/common/scratch.js
  20. 1 14
      src/components/dict-item/dict-item.vue
  21. 0 105
      src/components/main-layout/main-layout.vue
  22. 0 25
      src/interceptors/naviInterceptor.js
  23. 1 7
      src/main.js
  24. 56 43
      src/pages.json
  25. 0 949
      src/pages/index/index.vue
  26. 179 0
      src/pages/login.vue
  27. 0 182
      src/pages/login/login.vue
  28. 0 424
      src/pages/punchin-detail/punchin-detail.vue
  29. 0 245
      src/pages/punchin-edit/punchin-edit.vue
  30. 0 91
      src/pages/reward-record-list/reward-record-list.vue
  31. 8 0
      src/pages/rewardMarket.vue
  32. 0 187
      src/pages/scratch-record-list/scratch-record-list.vue
  33. 0 89
      src/pages/settle-list/settle-list.vue
  34. 8 0
      src/pages/statData.vue
  35. 8 0
      src/pages/taskList.vue
  36. 8 0
      src/pages/taskTodo.vue
  37. 0 226
      src/pages/user-info/user-info.vue
  38. 270 0
      src/pages/userCenter.vue
  39. BIN
      src/static/data.png
  40. BIN
      src/static/data_active.png
  41. BIN
      src/static/logo.png
  42. BIN
      src/static/market.png
  43. BIN
      src/static/market_active.png
  44. BIN
      src/static/task.png
  45. BIN
      src/static/task_active.png
  46. BIN
      src/static/todo.png
  47. BIN
      src/static/todo_active.png
  48. BIN
      src/static/user.png
  49. BIN
      src/static/user_active.png
  50. 0 60
      src/stores/dict.js
  51. 0 62
      src/stores/safeArea.js
  52. 0 27
      src/stores/userInfo.js
  53. 9 7
      src/utils/request.js

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 669 - 37
package-lock.json


+ 2 - 3
package.json

@@ -67,9 +67,9 @@
     "@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
     "@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
     "@dcloudio/uni-ui": "^1.5.7",
-    "pinia": "^2.3.0",
     "vue": "3.4.21",
-    "vue-i18n": "9.14.2"
+    "vue-i18n": "9.14.2",
+    "vue-avatar": "^2.3.3"
   },
   "devDependencies": {
     "@dcloudio/types": "3.4.14",
@@ -78,7 +78,6 @@
     "@dcloudio/uni-stacktracey": "3.0.0-4030620241128001",
     "@dcloudio/vite-plugin-uni": "3.0.0-4030620241128001",
     "@vue/runtime-core": "3.5.13",
-    "pinia-plugin-unistorage": "^0.1.2",
     "sass": "^1.83.0",
     "sass-loader": "^16.0.4",
     "vite": "5.2.8"

+ 28 - 0
project.config.json

@@ -0,0 +1,28 @@
+{
+  "appid": "wx6468ace33a6de441",
+  "compileType": "miniprogram",
+  "libVersion": "3.8.0",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "setting": {
+    "coverView": true,
+    "es6": true,
+    "postcss": true,
+    "minified": true,
+    "enhance": true,
+    "showShadowRootInWxmlPanel": true,
+    "packNpmRelationList": [],
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    }
+  },
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "insertSpaces",
+    "tabSize": 2
+  }
+}

+ 7 - 0
project.private.config.json

@@ -0,0 +1,7 @@
+{
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "projectname": "PunchSettle-MiniProgram",
+  "setting": {
+    "compileHotReLoad": true
+  }
+}

+ 12 - 23
src/App.vue

@@ -1,26 +1,15 @@
-<script setup>
-import naviInterceptor from '@/interceptors/naviInterceptor.js';
-import { useSafeAreaStore } from '@/stores/safeArea.js';
-import { useUserInfoStore } from '@/stores/userInfo';
-import { onLaunch, onShow } from '@dcloudio/uni-app';
-import { getSafeArea } from '@/utils/system.js';
-import { tokenApi } from '@/service/apis';
-
-onLaunch(() => {
-	// 导航拦截器初始化
-	naviInterceptor();
-	// 程序启动前检测登录状态
-	tokenApi.refreshToken().then(token => {
-		const userInfoStore = useUserInfoStore();
-		userInfoStore.token = token;
-	});
-});
-
-onShow(() => {
-	// 安全区初始化
-	const safeAreaStore = useSafeAreaStore();
-	safeAreaStore.$patch(getSafeArea());
-});
+<script>
+export default {
+	onLaunch: function () {
+		console.log('App Launch');
+	},
+	onShow: function () {
+		console.log('App Show')
+	},
+	onHide: function () {
+		console.log('App Hide')
+	}
+}
 </script>
 
 <style>

+ 0 - 0
src/service/apis.js → src/apis/apis.js


+ 0 - 0
src/service/dictApi.js → src/apis/dictApi.js


+ 1 - 1
src/service/loginApi.js → src/apis/loginApi.js

@@ -6,7 +6,7 @@ import request from "@/utils/request";
  */
 export function login(data) {
   return request({
-    url: "/wechat/miniprogram/login",
+    url: "/user/login",
     method: "post",
     data,
 	loading: true,

+ 0 - 0
src/service/punchInApi.js → src/apis/punchInApi.js


+ 0 - 0
src/service/rewardApi.js → src/apis/rewardApi.js


+ 0 - 0
src/service/scratchApi.js → src/apis/scratchApi.js


+ 0 - 0
src/service/settleApi.js → src/apis/settleApi.js


+ 0 - 0
src/service/tokenApi.js → src/apis/tokenApi.js


+ 0 - 0
src/service/userApi.js → src/apis/userApi.js


+ 22 - 0
src/common/cache.js

@@ -0,0 +1,22 @@
+/**
+ * 缓存
+ */
+const cacheKey = {
+
+    /**
+     * 登录凭据
+     */
+    TOKEN: "token",
+
+    /**
+     * 昵称
+     */
+    NICKNAME: "nickname",
+
+    /**
+     * 跳转登录前页面
+     */
+    REDIRECT_URL: "redirectUrl"
+}
+
+export default cacheKey;

+ 0 - 46
src/common/constants/router.js

@@ -1,46 +0,0 @@
-/**
- * 页面路由
- */
-const router = {
-	/**
-	 * 主页
-	 */
-	INDEX_URL: '/pages/index/index',
-	
-	/**
-	 * 登录页
-	 */
-	LOGIN_URL: '/pages/login/login',
-	
-	/**
-	 * 用户中心
-	 */
-	USER_INFO_URL: '/pages/user-info/user-info',
-	
-	/**
-	 * 打卡任务编辑页
-	 */
-	PUNCHIN_EDIT_URL: '/pages/punchin-edit/punchin-edit',
-	
-	/**
-	 * 打卡任务详情页
-	 */
-	PUNCHIN_DETAIL_URL: '/pages/punchin-detail/punchin-detail',
-	
-	/**
-	 * 结算页
-	 */
-	SETTLE_LIST_URL: '/pages/settle-list/settle-list',
-	
-	/**
-	 * 奖励领取记录页
-	 */
-	REWARD_RECORD_LIST_URL: '/pages/reward-record-list/reward-record-list',
-	
-	/**
-	 * 刮刮乐投入与中奖记录页
-	 */
-	SCRATCH_RECORD_LIST_URL: '/pages/scratch-record-list/scratch-record-list'
-};
-
-export default router;

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


+ 52 - 0
src/common/router.js

@@ -0,0 +1,52 @@
+/**
+ * 页面路由
+ */
+const router = {
+
+	/**
+	 * 登录页
+	 */
+	LOGIN_PAGE: '/pages/login',
+
+	/**
+	 * 待办页面
+	 */
+	TASK_TODO_PAGE: '/pages/taskTodo',
+
+	/**
+	 * 主页
+	 */
+	INDEX_URL: '/pages/index',
+	
+	/**
+	 * 用户中心
+	 */
+	USER_INFO_URL: '/pages/user-info',
+	
+	/**
+	 * 打卡任务编辑页
+	 */
+	PUNCHIN_EDIT_URL: '/pages/punchin-edit',
+	
+	/**
+	 * 打卡任务详情页
+	 */
+	PUNCHIN_DETAIL_URL: '/pages/punchin-detail',
+	
+	/**
+	 * 结算页
+	 */
+	SETTLE_LIST_URL: '/pages/settle-list',
+	
+	/**
+	 * 奖励领取记录页
+	 */
+	REWARD_RECORD_LIST_URL: '/pages/reward-record-list',
+	
+	/**
+	 * 刮刮乐投入与中奖记录页
+	 */
+	SCRATCH_RECORD_LIST_URL: '/pages/scratch-record-list'
+};
+
+export default router;

+ 0 - 0
src/common/constants/scratch.js → src/common/scratch.js


+ 1 - 14
src/components/dict-item/dict-item.vue

@@ -4,7 +4,6 @@
 
 <script setup>
 import { computed } from 'vue';
-import { useDictStore } from '@/stores/dict';
 
 // 组件入参
 const props = defineProps({
@@ -19,23 +18,11 @@ const props = defineProps({
 });
 
 // 属性
-/**
- * 字典信息
- */
-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>

+ 0 - 105
src/components/main-layout/main-layout.vue

@@ -1,105 +0,0 @@
-<template>
-	<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>
-				</view>
-				<view v-if="showHome" class="icon-box" :style="safeAreaStore.iconBoxStyle" @click="goIndexPage">
-					<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>
-
-	</view>
-</template>
-
-<script setup>
-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 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 {
-			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;
-			}
-		}
-	}
-
-	.content-box {
-		/* 内容区域占满剩余空间 */
-		flex-grow: 1;
-		padding: 0 24rpx 16rpx 24rpx;
-	}
-}
-</style>

+ 0 - 25
src/interceptors/naviInterceptor.js

@@ -1,25 +0,0 @@
-import router from "@/common/constants/router";
-import { useUserInfoStore } from '@/stores/userInfo.js';
-
-/**
- * 导航拦截器
- */
-const naviInterceptor = () => {
-	/**
-	 * 用户信息
-	 */
-	let userInfoStore = useUserInfoStore();
-	
-	uni.addInterceptor('navigateTo', {
-	    invoke(data) {
-	        if (!userInfoStore.isLogin) {
-	            uni.reLaunch({
-	                url: router.LOGIN_URL
-	            });
-	            return false; // 阻止跳转
-	        }
-	    }
-	});
-};
-
-export default naviInterceptor;

+ 1 - 7
src/main.js

@@ -13,17 +13,11 @@ app.$mount()
 
 // #ifdef VUE3
 import { createSSRApp } from 'vue';
-import * as Pinia from 'pinia';
-import { createUnistorage } from "pinia-plugin-unistorage";
 
 export function createApp() {
   const app = createSSRApp(App);
-  const pinia = Pinia.createPinia();
-  pinia.use(createUnistorage());
-  app.use(pinia);
   return {
-    app,
-	  Pinia
+    app
   }
 }
 // #endif

+ 56 - 43
src/pages.json

@@ -7,72 +7,85 @@
     },
 	"pages": [
 		{
-			"path": "pages/index/index",
+			"path": "pages/taskTodo",
 			"style": {
-				"navigationBarTitleText": "打卡结算",
-				"enablePullDownRefresh": true
+				"navigationBarTitleText": "待办"
 			}
 		},
 		{
-			"path" : "pages/login/login",
-			"style" : 
-			{
-				"navigationBarTitleText" : "登录"
+			"path": "pages/login",
+			"style": {
+				"navigationBarTitleText": "登录"
 			}
 		},
 		{
-			"path" : "pages/user-info/user-info",
-			"style" : 
-			{
-				"navigationBarTitleText" : "用户中心"
+			"path": "pages/rewardMarket",
+			"style": {
+				"navigationBarTitleText": "商城"
 			}
 		},
 		{
-			"path" : "pages/punchin-edit/punchin-edit",
-			"style" : 
-			{
-				"navigationBarTitleText" : "编辑"
+			"path": "pages/statData",
+			"style": {
+				"navigationBarTitleText": "data"
 			}
 		},
 		{
-			"path" : "pages/punchin-detail/punchin-detail",
-			"style" : 
-			{
-				"navigationBarTitleText" : "",
-				"enablePullDownRefresh": true
+			"path": "pages/userCenter",
+			"style": {
+				"navigationBarTitleText": "用户中心"
 			}
 		},
 		{
-			"path" : "pages/settle-list/settle-list",
-			"style" : 
-			{
-				"navigationBarTitleText" : "奖励结算记录",
-				"enablePullDownRefresh": true
+			"path": "pages/taskList",
+			"style": {
+				"navigationBarTitleText": "任务"
 			}
-		},
-		{
-			"path" : "pages/scratch-record-list/scratch-record-list",
-			"style" : 
+		}
+	],
+	"tabBar": {
+		"color": "#000000",
+		"selectedColor": "#BDE0FF",
+		"borderStyle": "black",
+		"backgroundColor": "#ffffff",
+		"list": [
 			{
-				"navigationBarTitleText" : "刮刮乐投入与中奖记录",
-				"enablePullDownRefresh": true
-			}
-		},
-		{
-			"path" : "pages/reward-record-list/reward-record-list",
-			"style" : 
+				"pagePath": "pages/taskTodo",
+				"iconPath": "static/todo.png",
+				"selectedIconPath": "static/todo_active.png",
+				"text": "待办"
+			},
+			{
+				"pagePath": "pages/rewardMarket",
+				"iconPath": "static/market.png",
+				"selectedIconPath": "static/market_active.png",
+				"text": "商城"
+			},
 			{
-				"navigationBarTitleText" : "奖励领取记录",
-				"enablePullDownRefresh": true
+				"pagePath": "pages/statData",
+				"iconPath": "static/data.png",
+				"selectedIconPath": "static/data_active.png",
+				"text": "数据"
+			},
+			{
+				"pagePath": "pages/taskList",
+				"iconPath": "static/task.png",
+				"selectedIconPath": "static/task_active.png",
+				"text": "任务"
+			},
+			{
+				"pagePath": "pages/userCenter",
+				"iconPath": "static/user.png",
+				"selectedIconPath": "static/user_active.png",
+				"text": "我的"
 			}
-		}
-	],
+		]
+	},
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uni-app",
-		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8",
-		"navigationStyle": "custom"
+		"navigationBarBackgroundColor": "#BDE0FF",
+		"backgroundColor": "#F8F8F8"
 	},
 	"uniIdRouter": {}
 }

+ 0 - 949
src/pages/index/index.vue

@@ -1,949 +0,0 @@
-<template>
-	<main-layout>
-		<!-- 用户信息区 -->
-		<view class="user-info">
-			<span class="nickname" v-if="!userInfoStore.isLogin" @click="goUserInfoPage">登录</span>
-			<view class="user-icon" v-if="userInfoStore.isLogin">
-				<uni-icons type="person" size="30"></uni-icons>
-			</view>
-			<span class="nickname" v-if="userInfoStore.isLogin" @click="goUserInfoPage">{{ userInfoStore.nickname
-				}}</span>
-			<span class="user-btn" v-if="userInfoStore.isLogin" @click="goUserInfoPage">用户中心</span>
-		</view>
-
-		<!-- 结算 -->
-		<view class="settle-container">
-			<!-- 刮刮乐、奖励数相关区域 -->
-			<view class="left-box">
-				<view class="split-box">
-					<view class="line-box">
-						<span>投入</span>
-						<span class="number-box" @click="addScratchRecord(SCRATCH_ACTION_TYPE_INVEST)">
-							¥{{ userInfo.lotteryInvestAmount }}
-							<uni-icons type="compose" color="#FFFFFF"></uni-icons>
-						</span>
-					</view>
-					<view class="under-line-box">
-						<span>产出</span>
-						<span class="number-box" @click="addScratchRecord(SCRATCH_ACTION_TYPE_WIN)">
-							¥{{ userInfo.lotteryWinAmount }}
-							<uni-icons type="compose" color="#FFFFFF"></uni-icons>
-						</span>
-					</view>
-				</view>
-				<view class="split-box">
-					<view class="line-box">
-						<span>已领取</span>
-						<span class="number-box">{{ userInfo.claimedRewardNum }}</span>
-					</view>
-					<view class="under-line-box">
-						<span>总奖励</span>
-						<span class="number-box">{{ userInfo.totalRewardNum }}</span>
-					</view>
-				</view>
-			</view>
-			<!-- 待领取奖励区 -->
-			<view class="right-box">
-				<view class="reward-title">待领取奖励数</view>
-				<view class="reward-num">{{ userInfo.unclaimedRewardNum }}</view>
-				<view class="reward-btn-group">
-					<view class="reward-btn reward-btn-left" @click="claimReward('all')">全部领取</view>
-					<view class="reward-btn reward-btn-right" @click="claimReward('part')">部分领取</view>
-				</view>
-			</view>
-			<!-- 刷新按钮 -->
-			<view class="refresh-btn" @click="getUserInfo">
-				<uni-icons type="refreshempty" color="#406CE7"></uni-icons>
-			</view>
-		</view>
-
-		<!-- 打卡任务 -->
-		<view class="task-container">
-			<view class="task-header">
-				<view class="task-title" v-if="punchIns.length && punchIns.length > 0">任务({{ punchIns.length }}个)
-				</view>
-				<view class="task-title" v-else>任务</view>
-				<view class="task-add-btn" @click="goPunchInEditPage">
-					<uni-icons type="plusempty" size="30" color="#406CE7"></uni-icons>
-				</view>
-			</view>
-			<view class="task-item" v-for="punchIn in punchIns" :key="punchIn.punchInId">
-				<view class="main-box" @click="goPunchInDetailPage(punchIn.punchInId)">
-					<view class="item-header">
-						<span class="item-title">{{ punchIn.taskName }}</span>
-						<span class="item-reward">x{{ punchIn.rewardNum }}</span>
-						<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 || 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 }}
-					</view>
-					<view class="item-detail-list">
-						<view class="item-detail" v-for="punchInRecord in punchIn.punchInRecords"
-							:key="punchInRecord.punchInDate">
-							<view class="detail-text">
-								<uni-dateformat :date="punchInRecord.punchInDate" format="M/d"></uni-dateformat>
-							</view>
-							<view class="detail-box" style="background-color: #E5E5E5;"
-								v-if="punchInRecord.punchInStatus == 'uncreated'"></view>
-							<view class="detail-box" style="background-color: #A5D63F;"
-								v-if="punchInRecord.punchInStatus == 'punchIn'"></view>
-							<view class="detail-box" style="background-color: #D43030;"
-								v-if="punchInRecord.punchInStatus == 'unPunchIn'"></view>
-							<view class="detail-box"
-								v-if="punchInRecord.punchInStatus == 'futureTime' || punchInRecord.punchInStatus == 'todayUnknown'">
-							</view>
-						</view>
-					</view>
-				</view>
-				<view
-					:class="punchIn.punchInStatus == 'punchIn' ? 'func-box func-box-finish' : 'func-box func-box-unfinish'"
-					v-if="punchIn.category == 0" @click="doPunchIn(punchIn.punchInId)">
-					<span
-						v-if="punchIn.punchInStatus == 'unPunchIn' || punchIn.punchInStatus == 'todayUnknown'">打卡</span>
-					<span v-else>已完成</span>
-				</view>
-				<view
-					:class="punchIn.punchInStatus == 'punchIn' ? 'func-box func-box-finish' : 'func-box func-box-unfinish'"
-					v-if="punchIn.category == 1" @click="doPunchIn(punchIn.punchInId)">
-					<span>{{ punchIn.recordCountTrack }}</span>
-					<span>计数</span>
-				</view>
-				<view
-					:class="punchIn.punchInStatus == 'punchIn' ? 'func-box func-box-finish' : 'func-box func-box-unfinish'"
-					v-if="punchIn.category == 2" @click="doPunchInForTimeTrack(punchIn.punchInId, punchIn.timeTrack)">
-					<span>
-						{{ punchIn.recordTimeTrack.slice(0, 5) }}
-					</span>
-					<span>计时</span>
-				</view>
-			</view>
-
-			<uni-load-more status="no-more" v-if="!punchIns || punchIns.length == 0" />
-		</view>
-
-		<!-- 刮刮乐弹出框 -->
-		<uni-popup ref="scratchInputDialog" type="dialog" :is-mask-click="false">
-			<uni-popup-dialog mode="input" :before-close="true"
-				:title="scratchFormData.actionType == SCRATCH_ACTION_TYPE_INVEST ? '投入金额' : '中奖金额'" confirmText="保存"
-				@confirm="scratchFormConfirm" @close="scratchFormClose">
-				<view style="width: 100%;">
-					<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="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="dictStore[scratchFormData.source]"
-								v-model="scratchFormData.category"></uni-data-select>
-						</uni-forms-item>
-						<uni-forms-item
-							:label="scratchFormData.actionType == SCRATCH_ACTION_TYPE_INVEST ? '投入金额' : '中奖金额'"
-							name="amount" required>
-							<uni-easyinput type="digit" placeholder="请输入金额"
-								v-model="scratchFormData.amount"></uni-easyinput>
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-			</uni-popup-dialog>
-		</uni-popup>
-
-		<!-- 领取奖励弹出框 -->
-		<uni-popup ref="claimRewardInputDialog" type="dialog" :is-mask-click="false">
-			<uni-popup-dialog mode="input" :before-close="true" title="领取奖励" confirmText="领取"
-				@confirm="claimRewardFormConfirm" @close="claimRewardFormClose">
-				<view style="width: 100%;">
-					<uni-forms ref="claimRewardForm" :modelValue="claimRewardFormData" :rules="claimRewardFormRules"
-						label-position="top" :label-width="150">
-						<uni-forms-item name="claimRewardNum">
-							<uni-easyinput type="digit" placeholder="请输入领取的奖励数"
-								v-model="claimRewardFormData.claimRewardNum"></uni-easyinput>
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-			</uni-popup-dialog>
-		</uni-popup>
-
-		<!-- 计时弹出框 -->
-		<uni-popup ref="timeTrackInputDialog" type="dialog" :is-mask-click="false">
-			<uni-popup-dialog mode="input" :before-close="true" title="计时记录" confirmText="保存"
-				@confirm="timeTrackFormConfirm" @close="timeTrackFormClose">
-				<view class="pick-box" @click="timeTrackClick">
-					<picker mode="time" :value="timeTrackFormData.timeTrack" @change="timeTrackChange">
-						<view class="pick-box-time">{{ timeTrackFormData.timeTrack }}</view>
-					</picker>
-				</view>
-				<view style="display: none;">
-					<uni-forms ref="timeTrackForm" :modelValue="timeTrackFormData" :rules="timeTrackFormRules">
-						<uni-forms-item name="timeTrack">
-							<uni-easyinput v-model="timeTrackFormData.timeTrack" />
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-			</uni-popup-dialog>
-		</uni-popup>
-	</main-layout>
-</template>
-
-<script setup>
-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 { 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';
-
-// 组件
-/**
- * 刮刮乐弹出框
- */
-const scratchInputDialog = ref(null);
-
-/**
- * 刮刮乐表单
- */
-const scratchForm = ref(null);
-
-/**
- * 领取奖励弹出框
- */
-const claimRewardInputDialog = ref(null);
-
-/**
- * 领取奖励表单
- */
-const claimRewardForm = ref(null);
-
-/**
- * 计时弹出框
- */
-const timeTrackInputDialog = ref(null);
-
-/**
- * 计时表单
- */
-const timeTrackForm = ref(null);
-
-
-// 属性
-/**
- * 字典信息
- */
-const dictStore = useDictStore();
-
-/**
- * 用户信息
- */
-const userInfoStore = useUserInfoStore();
-
-/**
- * 用户信息
- */
-const userInfo = ref({
-	totalRewardNum: 0,
-	unclaimedRewardNum: 0,
-	claimedRewardNum: 0,
-	lotteryInvestAmount: 0.00,
-	lotteryWinAmount: 0.00
-});
-
-/**
- * 打卡任务
- */
-const punchIns = ref([]);
-
-/**
- * 刮刮乐表单数
- */
-const scratchFormData = ref({});
-
-/**
- * 刮刮乐表单校验规则
- */
-const scratchFormRules = ref({
-	"source": {
-		rules: [{
-			required: true,
-			errorMessage: "请选择来源"
-		}]
-	},
-	"category": {
-		rules: [{
-			required: true,
-			errorMessage: "请选择种类"
-		}]
-	},
-	"amount": {
-		rules: [{
-			required: true,
-			errorMessage: "请输入金额"
-		}, {
-			format: 'number',
-			errorMessage: "请输入有效数字"
-		}, {
-			minimum: 0.01,
-			errorMessage: "最小{minimum}元"
-		}]
-	}
-
-});
-
-/**
- * 领取奖励表单数据
- */
-const claimRewardFormData = ref({
-	claimRewardNum: 1
-});
-
-/**
- * 领取奖励表单规则
- */
-const claimRewardFormRules = ref({
-	claimRewardNum: {
-		rules: [{
-			required: true,
-			errorMessage: "请输入领取的奖励数"
-		}, {
-			format: 'number',
-			errorMessage: "请输入有效数字"
-		}, {
-			minimum: 1,
-			errorMessage: "最少领取{minimum}个"
-		}]
-	}
-});
-
-/**
- * 计时表单数据
- */
-const timeTrackFormData = ref({
-	timeTrack: '00:00'
-});
-
-/**
- * 计时表单规则
- */
-const timeTrackFormRules = ref({
-	timeTrack: {
-		rules: [{
-			required: true,
-			errorMessage: "请输入时间"
-		}]
-	}
-});
-
-
-// 方法
-/**
- * 获取用户信息
- */
-const getUserInfo = async () => {
-	let res = await userApi.queryUserInfo();
-	userInfo.value = res;
-}
-
-/**
- * 获取打卡
- */
-const getPunchIns = async () => {
-	let res = await punchInApi.queryPunchIns();
-	punchIns.value = res;
-}
-
-/**
- * 增加刮刮乐记录
- */
-const addScratchRecord = async (e) => {
-	// 重置上一轮的表单数据
-	scratchFormData.value = {
-		actionType: e
-	};
-	scratchInputDialog.value.open();
-}
-
-/**
- * 刮刮乐表单提交
- */
-const scratchFormConfirm = async () => {
-	scratchForm.value.validate(['actionType']).then(data => {
-		return scratchApi.addScratchRecord(data);
-	}).then(e => {
-		scratchInputDialog.value.close();
-		getUserInfo();
-	});
-}
-
-/**
- * 刮刮乐表单取消
- */
-const scratchFormClose = async () => {
-	scratchInputDialog.value.close();
-}
-
-/**
- * 领取奖励(部分)
- * @param {String} claimType 部分领取或全部领取(part-部分/all-全部)
- */
-const claimReward = (claimType) => {
-	if (userInfo.value.unclaimedRewardNum == 0) {
-		uni.showToast({
-			title: "没有可领取的奖励",
-			icon: "none"
-		});
-		return;
-	}
-	// 重置上一轮的表单数据
-	claimRewardFormData.value = {
-		claimRewardNum: claimType == 'part' ? 1 : userInfo.value.unclaimedRewardNum
-	};
-	claimRewardInputDialog.value.open();
-}
-
-
-/**
- * 领取奖励表单提交
- */
-const claimRewardFormConfirm = async () => {
-	claimRewardForm.value.validate().then(data => {
-		return rewardApi.claimReward(data);
-	}).then(e => {
-		claimRewardInputDialog.value.close();
-		getUserInfo();
-	});
-}
-
-/**
- * 领取奖励表单取消
- */
-const claimRewardFormClose = async () => {
-	claimRewardInputDialog.value.close();
-}
-
-/**
- * 确认领取奖励
- */
-const claimRewardConfirm = async (val) => {
-	await rewardApi.claimReward({
-		"claimRewardNum": val
-	});
-	// getReward();
-	claimRewardDialog.value.close();
-}
-
-/**
- * 计时时间选择监听
- */
-const timeTrackChange = (e) => {
-	timeTrackFormData.value.timeTrack = e.detail.value;
-}
-
-/**
- * 打卡(计时)
- */
-const doPunchInForTimeTrack = (id, timeTrack) => {
-	// 重置上一轮的表单数据
-	timeTrackFormData.value = {
-		id,
-		timeTrack: timeTrack ? timeTrack.slice(0, 5) : '00:00'
-	};
-	timeTrackInputDialog.value.open();
-}
-
-/**
- * 计时表单提交
- */
-const timeTrackFormConfirm = async () => {
-	timeTrackForm.value.validate(['id']).then(data => {
-		return punchInApi.doPunchIn(data);
-	}).then(e => {
-		timeTrackInputDialog.value.close();
-		getPunchIns();
-	});
-}
-
-/**
- * 刮刮乐表单取消
- */
-const timeTrackFormClose = async () => {
-	timeTrackInputDialog.value.close();
-}
-
-
-/**
- * 打卡
- */
-const doPunchIn = async (id) => {
-	await punchInApi.doPunchIn({
-		id
-	});
-	getPunchIns();
-}
-
-/**
- * 跳转用户用心
- */
-const goUserInfoPage = () => {
-	uni.navigateTo({
-		url: router.USER_INFO_URL
-	});
-}
-
-/**
- * 跳转打卡编辑页面
- */
-const goPunchInEditPage = () => {
-	uni.navigateTo({
-		url: router.PUNCHIN_EDIT_URL
-	});
-};
-
-/**
- * 跳转打卡详情页面
- */
-const goPunchInDetailPage = (id) => {
-	uni.navigateTo({
-		url: router.PUNCHIN_DETAIL_URL + "?id=" + id
-	});
-};
-
-/**
- * 加载数据
- */
-const loadData = async () => {
-	// 如果还没登录就结束获取数据
-	if (!userInfoStore.isLogin) {
-		userInfo.value = {
-			totalRewardNum: 0,
-			unclaimedRewardNum: 0,
-			claimedRewardNum: 0,
-			lotteryInvestAmount: 0.00,
-			lotteryWinAmount: 0.00
-		};
-		punchIns.value = [];
-		return;
-	}
-
-	// 已登录
-	try {
-		uni.showLoading({
-			title: '加载中',
-			mask: true
-		});
-		// 获取用户信息
-		getUserInfo();
-		// 获取打卡
-		getPunchIns();
-		// 刷新字典
-		dictStore.refresh();
-	} finally {
-		uni.hideLoading();
-	}
-};
-
-onShow(() => {
-	loadData();
-});
-
-onPullDownRefresh(() => {
-	loadData();
-	uni.stopPullDownRefresh();
-});
-</script>
-
-<style lang="scss" scoped>
-.user-info {
-	display: flex;
-	align-items: center;
-	position: relative;
-
-	.user-icon {
-		display: inline-flex !important;
-
-		width: 72rpx;
-		height: 72rpx;
-		background: #FFFFFF;
-		border-radius: 50%;
-
-		justify-content: center;
-		align-items: center;
-	}
-
-	.nickname {
-		margin-left: 16rpx;
-		font-size: 24rpx;
-		font-weight: 400;
-		letter-spacing: 0rpx;
-		line-height: 34.75rpx;
-		color: #000000;
-	}
-
-	.user-btn {
-		position: absolute;
-		right: 0px;
-
-		width: 122rpx;
-		height: 40rpx;
-		opacity: 1;
-		border-radius: 24rpx;
-		background: #FFFFFF;
-		border: 1px solid #406CE7;
-
-		/** 文本1 */
-		font-size: 18rpx;
-		font-weight: 400;
-		letter-spacing: 0rpx;
-		line-height: 26.06rpx;
-		color: #406CE7;
-
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-}
-
-.settle-container {
-	margin-top: 16rpx;
-	display: flex;
-
-	padding: 16rpx 24rpx;
-	height: 266rpx;
-
-	opacity: 1;
-	background: #406CE7;
-	border-radius: 21.35rpx;
-	border: 0.5px solid #E4E4E4;
-	box-shadow: 0px 1px 6px #D8D8D8;
-
-	position: relative;
-
-	.left-box {
-		flex: 1;
-		display: flex;
-		flex-direction: column;
-
-		border-right: 1px solid #FFFFFF;
-		padding-right: 24rpx;
-		font-size: 22rpx;
-		font-weight: 400;
-		letter-spacing: 0rpx;
-		line-height: 31.86rpx;
-		color: #FFFFFF;
-
-		.line-box {
-			padding-bottom: 16rpx;
-			border-bottom: 1px solid #FFFFFF;
-			position: relative;
-		}
-
-		.under-line-box {
-			padding-top: 16rpx;
-			position: relative;
-		}
-
-		.number-box {
-			position: absolute;
-			right: 0px;
-			text-align: right;
-		}
-
-		.split-box {
-			flex: 1;
-			display: flex;
-			justify-content: center;
-			align-content: center;
-			flex-direction: column;
-		}
-	}
-
-	.right-box {
-		flex: 2;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-
-		.reward-title {
-			font-size: 26rpx;
-			font-weight: 400;
-			letter-spacing: 0rpx;
-			line-height: 37.65rpx;
-			color: #FFFFFF;
-		}
-
-		.reward-num {
-			flex-grow: 1;
-			font-size: 110rpx;
-			font-weight: 700;
-			letter-spacing: 0rpx;
-			color: #FFFFFF;
-
-			display: flex;
-			align-items: center;
-			justify-content: center;
-		}
-
-		.reward-btn-group {
-			width: 100%;
-			height: 36rpx;
-
-			display: flex;
-			align-items: center;
-			justify-content: center;
-
-			.reward-btn {
-				display: flex;
-				justify-content: center;
-				align-items: center;
-				width: 108rpx;
-				height: 36rpx;
-				opacity: 1;
-				background: #FFFFFF;
-				font-size: 20rpx;
-				font-weight: 700;
-				letter-spacing: 0rpx;
-				line-height: 28.96rpx;
-				color: #406CE7;
-			}
-
-			.reward-btn-left {
-				border-radius: 24rpx 0rpx 0rpx 24rpx;
-			}
-
-			.reward-btn-right {
-				border-radius: 0rpx 24rpx 24rpx 0rpx;
-			}
-		}
-	}
-
-	.refresh-btn {
-		position: absolute;
-		top: 16rpx;
-		right: 24rpx;
-		border-radius: 50%;
-
-		width: 36rpx;
-		height: 36rpx;
-		opacity: 1;
-		background: #F7F7F7;
-
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-}
-
-.task-container {
-	margin-top: 16rpx;
-
-	.task-header {
-		position: relative;
-		height: 80rpx;
-		display: flex;
-		justify-content: center;
-		/* 水平居中 */
-		align-items: center;
-		/* 垂直居中 */
-
-		.task-title {
-			position: absolute;
-			left: 0rpx;
-			font-size: 30rpx;
-			font-weight: 400;
-			line-height: 43.44rpx;
-			color: rgba(0, 0, 0, 1);
-		}
-
-		.task-add-btn {
-			display: inline-flex;
-			justify-content: center;
-			align-items: center;
-			position: absolute;
-			right: 0rpx;
-			width: 60rpx;
-			height: 60rpx;
-			border-radius: 10rpx;
-			border: 3px solid rgba(64, 108, 231, 1);
-		}
-	}
-
-	.task-item {
-		margin-top: 16rpx;
-		width: 100%;
-		// height: 239rpx;
-		border-radius: 24rpx;
-		background: #FFFFFF;
-		border: 0.5px solid #E4E4E4;
-		box-shadow: 0px 1px 6px #D8D8D8;
-
-		display: flex;
-
-		.main-box {
-			flex-grow: 1;
-			padding: 16rpx 16rpx 16rpx 24rpx;
-
-			.item-header {
-				// position: relative;
-				display: flex;
-				align-items: center;
-
-				.item-title {
-					font-size: 30rpx;
-					font-weight: 400;
-					letter-spacing: 0rpx;
-					line-height: 43.44rpx;
-					color: #000000;
-				}
-
-				.item-reward {
-					margin-left: 8rpx;
-					font-size: 24rpx;
-					font-weight: 400;
-					letter-spacing: 0rpx;
-					line-height: 34.75rpx;
-					color: #000000;
-				}
-
-				.item-tag:first-child {
-					margin-left: 24rpx;
-				}
-
-				.item-tag {
-					margin-left: 16rpx;
-					width: 94rpx;
-					height: 38rpx;
-					opacity: 1;
-					border-radius: 24rpx;
-					background: #FFFFFF;
-					border: 1px solid #406CE7;
-
-					display: inline-flex;
-					justify-content: center;
-					align-items: center;
-
-					font-size: 18rpx;
-					font-weight: 400;
-					letter-spacing: 0rpx;
-					// line-height: 26.06rpx;
-					color: #406CE7;
-
-				}
-
-				.item-btn {
-					display: inline-flex;
-					position: absolute;
-					right: 0rpx;
-					width: 123rpx;
-					height: 42rpx;
-					border-radius: 30rpx;
-					border: 1rpx solid #2A82E4;
-					justify-content: center;
-					align-items: center;
-
-					font-size: 20rpx;
-					font-weight: 400;
-					line-height: 28.96px;
-					color: rgba(64, 108, 231, 1);
-				}
-			}
-
-			.item-desc {
-				margin-top: 16rpx;
-				font-size: 24rpx;
-				font-weight: 400;
-				letter-spacing: 0rpx;
-				line-height: 34.75rpx;
-				color: #000000;
-			}
-
-			.item-detail-list {
-				margin-top: 16rpx;
-				display: grid;
-				grid-template-columns: repeat(7, 1fr);
-
-				.item-detail {
-					display: flex;
-					flex-direction: column;
-					justify-content: center;
-					align-items: center;
-
-					.detail-text {
-						font-size: 20rpx;
-						font-weight: 400;
-						letter-spacing: 0rpx;
-						line-height: 28.96rpx;
-						color: rgba(0, 0, 0, 1);
-					}
-
-					.detail-box {
-						// display: block;
-						width: 42rpx;
-						height: 42rpx;
-						margin-top: 5rpx;
-						border: 5rpx solid #000000;
-					}
-				}
-			}
-		}
-
-		.func-box {
-			flex-shrink: 0;
-			width: 160rpx;
-			border-radius: 0rpx 24rpx 24rpx 0rpx;
-
-
-			font-size: 36rpx;
-			font-weight: 400;
-			letter-spacing: 0rpx;
-			line-height: 52.13rpx;
-			color: #FFFFFF;
-
-			display: flex;
-			justify-content: center;
-			align-items: center;
-			flex-direction: column;
-		}
-
-		.func-box-finish {
-			background: #F2607A;
-		}
-
-		.func-box-unfinish {
-			background: #406CE7;
-		}
-	}
-}
-
-.pick-box {
-	width: 100%;
-	height: 100rpx;
-	border-radius: 8px;
-	background: #ffffff;
-	// 阴影
-	border: 0.5px solid #e4e4e4;
-
-	picker {
-		width: 100%;
-		height: 100%;
-
-		.pick-box-time {
-			width: 100%;
-			height: 100rpx;
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			color: #000000;
-			border-radius: 24rpx;
-			text-align: center;
-		}
-	}
-}
-</style>

+ 179 - 0
src/pages/login.vue

@@ -0,0 +1,179 @@
+<template>
+	<view class="login-container">
+		<view class="login-avator"></view>
+		<view class="login-nickname">
+			<input v-model="loginFormData.nickname" placeholder="请输入昵称" />
+		</view>
+
+		<view style="display: none">
+			<uni-forms ref="loginForm" :modelValue="loginFormData" :rules="loginFormRules" err-show-type="modal">
+				<uni-forms-item name="nickname">
+					<uni-easyinput type="text" v-model="loginFormData.nickname" placeholder="请输入昵称" :clearable="false"
+						:inputBorder="false" />
+				</uni-forms-item>
+			</uni-forms>
+		</view>
+
+		<view class="login-btn" @click="login">登录</view>
+	</view>
+</template>
+
+<script setup>
+import { ref } from "vue";
+import { onShow } from '@dcloudio/uni-app';
+import { loginApi } from "@/apis/apis.js";
+import router from "@/common/router.js";
+import cacheKey from "@/common/cache.js";
+
+// 组件
+/**
+ * 登录表单
+ */
+const loginForm = ref(null);
+
+// 属性
+/**
+ * 登录表单数据
+ */
+const loginFormData = ref({
+	nickname: "蜗牛",
+});
+
+/**
+ * 登录表单校验规则
+ */
+const loginFormRules = ref({
+	nickname: {
+		rules: [
+			{
+				required: true,
+				errorMessage: "昵称不能为空",
+			},
+			{
+				maxLength: 30,
+				errorMessage: "昵称不能超过{maxLength}个字符",
+			},
+		],
+	},
+});
+
+// 方法
+const login = async () => {
+	let formData = await loginForm.value.validate();
+	// 获取供应商
+	let providerResult = await uni.getProvider({ service: "oauth" });
+	// 获取登录code
+	let loginResult = await uni.login({ provider: providerResult.provider[0] });
+	// 登录
+	let token = await loginApi.login({
+		code: loginResult.code,
+		nickname: formData.nickname,
+	});
+
+	// 保存用户信息(token)
+	uni.setStorageSync(cacheKey.TOKEN, token);
+	uni.setStorageSync(cacheKey.NICKNAME, formData.nickname);
+
+	uni.showToast({
+		title: "登录成功",
+		icon: "success",
+		duration: 1000,
+		success: () => {
+			// 登录结束返回主页
+			let redirectUrl = uni.getStorageSync(cacheKey.REDIRECT_URL);
+			// 如果没有记录的url,则默认跳转
+			if (!redirectUrl) {
+				redirectUrl = router.TASK_TODO_PAGE;
+			}
+			// 清除记录的url
+			uni.removeStorageSync(cacheKey.REDIRECT_URL);
+			uni.switchTab({
+				url: redirectUrl,
+			});
+		},
+	});
+};
+
+// 生命周期
+onShow(() => {
+	let nickname = uni.getStorageSync(cacheKey.NICKNAME);
+	if (nickname) {
+		loginFormData.value.nickname = nickname;
+	}
+});
+</script>
+
+<style lang="scss" scoped>
+.login-container {
+	margin-top: 150rpx;
+
+	width: 100%;
+	height: 100%;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	flex-direction: column;
+
+	.login-avator {
+		border-radius: 50%;
+		width: 300rpx;
+		height: 300rpx;
+		background-image: url("/static/logo.png");
+		background-size: cover;
+		/* 覆盖整个容器 */
+		background-position: center;
+
+		// 阴影
+		border: 0.5px solid #e4e4e4;
+		box-shadow: 0px 1px 6px #d8d8d8;
+
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.login-nickname {
+		margin-top: 50rpx;
+
+		width: 599rpx;
+		height: 100rpx;
+		border-radius: 8px;
+		background: #ffffff;
+
+		// 阴影
+		border: 0.5px solid #e4e4e4;
+		box-shadow: 0px 1px 6px #d8d8d8;
+
+		input {
+			width: 100%;
+			height: 100%;
+			font-size: 36rpx;
+			font-weight: 700;
+			letter-spacing: 0rpx;
+			line-height: 52.13rpx;
+			color: #000000;
+			border-radius: 24rpx;
+			text-align: center;
+		}
+	}
+
+	.login-btn {
+		margin-top: 150rpx;
+
+		width: 599rpx;
+		height: 100rpx;
+		border-radius: 24rpx;
+		background: #406ce7;
+
+		font-size: 36rpx;
+		font-weight: 400;
+		letter-spacing: 0rpx;
+		line-height: 52.13rpx;
+		color: #ffffff;
+
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+}
+</style>

+ 0 - 182
src/pages/login/login.vue

@@ -1,182 +0,0 @@
-<template>
-	<main-layout :showHome="true">
-		<template>
-			<view class="login-container">
-				<view class="login-avator">
-					<uni-icons type="person" size="60"></uni-icons>
-				</view>
-				<view class="login-nickname">
-					<input v-model="loginFormData.nickname" placeholder="请输入昵称" />
-				</view>
-
-				<view style="display: none">
-					<uni-forms ref="loginForm" :modelValue="loginFormData" :rules="loginFormRules"
-						err-show-type="modal">
-						<uni-forms-item name="nickname">
-							<uni-easyinput type="text" v-model="loginFormData.nickname" placeholder="请输入昵称"
-								:clearable="false" :inputBorder="false" />
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-
-				<view class="login-btn" @click="login">登录</view>
-			</view>
-		</template>
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from "vue";
-import { loginApi } from "@/service/apis.js";
-import router from "@/common/constants/router.js";
-import { useUserInfoStore } from "@/stores/userInfo.js";
-
-// 组件
-/**
- * 登录表单
- */
-const loginForm = ref(null);
-
-// 属性
-/**
- * 用户信息
- */
-const userInfoStore = useUserInfoStore();
-
-/**
- * 登录表单数据
- */
-const loginFormData = ref({
-	nickname: "蜗牛",
-});
-
-/**
- * 登录表单校验规则
- */
-const loginFormRules = ref({
-	nickname: {
-		rules: [
-			{
-				required: true,
-				errorMessage: "昵称不能为空",
-			},
-			{
-				maxLength: 30,
-				errorMessage: "昵称不能超过{maxLength}个字符",
-			},
-		],
-	},
-});
-
-// 方法
-const login = async () => {
-	try {
-		let formData = await loginForm.value.validate();
-		uni.showLoading({
-			title: "登录中...",
-		});
-		// 获取供应商
-		let providerResult = await uni.getProvider({ service: "oauth" });
-		// 获取登录code
-		let loginResult = await uni.login({ provider: providerResult.provider[0] });
-		// 登录
-		let token = await loginApi.login({
-			code: loginResult.code,
-			nickname: formData.nickname,
-		});
-
-		// 保存用户信息(token)
-		userInfoStore.$patch({
-			token,
-			nickname: formData.nickname,
-		});
-
-		uni.showToast({
-			title: "登录成功",
-			icon: "success",
-			duration: 1000,
-		});
-
-		// 登录结束返回主页
-		setTimeout(() => {
-			uni.navigateTo({
-				url: router.INDEX_URL,
-			});
-		}, 1000);
-	} finally {
-		uni.hideLoading();
-	}
-};
-</script>
-
-<style lang="scss" scoped>
-.login-container {
-	margin-top: 150rpx;
-
-	width: 100%;
-	height: 100%;
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	flex-direction: column;
-
-	.login-avator {
-		width: 200rpx;
-		height: 200rpx;
-		background: #ffffff;
-		border-radius: 50%;
-
-		// 阴影
-		border: 0.5px solid #e4e4e4;
-		box-shadow: 0px 1px 6px #d8d8d8;
-
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-
-	.login-nickname {
-		margin-top: 50rpx;
-
-		width: 599rpx;
-		height: 100rpx;
-		border-radius: 8px;
-		background: #ffffff;
-
-		// 阴影
-		border: 0.5px solid #e4e4e4;
-		box-shadow: 0px 1px 6px #d8d8d8;
-
-		input {
-			width: 100%;
-			height: 100%;
-			font-size: 36rpx;
-			font-weight: 700;
-			letter-spacing: 0rpx;
-			line-height: 52.13rpx;
-			color: #000000;
-			border-radius: 24rpx;
-			text-align: center;
-		}
-	}
-
-	.login-btn {
-		margin-top: 150rpx;
-
-		width: 599rpx;
-		height: 100rpx;
-		border-radius: 24rpx;
-		background: #406ce7;
-
-		font-size: 36rpx;
-		font-weight: 400;
-		letter-spacing: 0rpx;
-		line-height: 52.13rpx;
-		color: #ffffff;
-
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-}
-</style>

+ 0 - 424
src/pages/punchin-detail/punchin-detail.vue

@@ -1,424 +0,0 @@
-<template>
-	<main-layout :showHome="true" :showBack="true">
-		<uni-calendar :start-date="punchInData.startDate" :end-date="punchInData.endDate"
-			:selected="punchInData.calendarSelected" @monthSwitch="calendarMonthSwitchChange" />
-		<viwe class="info-box">
-			<view class="left">打卡:{{ punchInData.punchInNum }}次</view>
-			<view class="right">全勤率:{{ punchInData.punchInRate }}%</view>
-		</viwe>
-		<view class="log-box">
-			<uni-section title="打卡记录" type="line">
-				<uni-list>
-					<uni-list-item v-for="record in punchInData.punchInRecords" :key="record.punchInDate">
-						<template v-slot:body>
-							{{ record.punchInDate }}
-							<span v-if="record.punchInStatus == 1 || record.punchInStatus == 3"> 完成打卡</span>
-							<span v-else> 未完成打卡</span>
-							<span v-if="record.settleCategory == 1">,打卡{{ record.countTrack }}次</span>
-							<span v-if="record.settleCategory == 2">,打卡时长{{ record.timeTrack }}</span>
-						</template>
-					</uni-list-item>
-				</uni-list>
-				<uni-load-more status="no-more" v-if="punchInData.punchInRecords.length == 0" />
-			</uni-section>
-		</view>
-		<uni-fab ref="fabBtn" :content="fabContent" :pattern="fabPattern" horizontal="right" vertical="bottom"
-			direction="vertical" @trigger="trigger" />
-
-		<!-- 删除确认框 -->
-		<uni-popup ref="deleteDialog" type="dialog">
-			<uni-popup-dialog mode="base" :before-close="true" title="删除提示" content="确认删除当前任务?"
-				@confirm="deleteDialogConfirm" @close="deleteDialogClose"></uni-popup-dialog>
-		</uni-popup>
-
-		<!-- 归档确认框 -->
-		<uni-popup ref="archiveDialog" type="dialog">
-			<uni-popup-dialog mode="base" :before-close="true" title="归档提示" content="确认归档当前任务?"
-				@confirm="archiveDialogConfirm" @close="archiveDialogClose"></uni-popup-dialog>
-		</uni-popup>
-
-		<!-- 撤销确认框 -->
-		<uni-popup ref="revokeDialog" type="dialog">
-			<uni-popup-dialog mode="base" :before-close="true" title="撤销提示" content="确认撤销打卡?"
-				@confirm="revokeDialogConfirm" @close="revokeDialogClose"></uni-popup-dialog>
-		</uni-popup>
-
-		<!-- 补卡弹出框 -->
-		<uni-popup ref="remakeInputDialog" type="dialog" :is-mask-click="false">
-			<uni-popup-dialog mode="input" :before-close="true" title="补卡" @confirm="remakeFormConfirm"
-				@close="remakeFormClose">
-				<view style="width: 100%;">
-					<uni-forms ref="remakeForm" :modelValue="remakeFormData" :rules="remakeFormRules"
-						label-position="top" :label-width="150">
-						<uni-forms-item name="punchInDate">
-							<picker mode="date" :value="remakeFormData.punchInDate" @change="remakePunchInDateChange">
-								<view class="pick-box">{{ remakeFormData.punchInDate }}</view>
-							</picker>
-						</uni-forms-item>
-					</uni-forms>
-				</view>
-			</uni-popup-dialog>
-		</uni-popup>
-
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from 'vue';
-import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app';
-import router from '@/common/constants/router';
-import { punchInApi } from '@/service/apis.js';
-import dateUtils from '@/utils/date';
-
-// 组件
-const fabBtn = ref(null);
-/**
- * 删除弹出框
- */
-const deleteDialog = ref(null);
-
-/**
- * 归档弹出框
- */
-const archiveDialog = ref(null);
-
-/**
- * 补卡弹出框
- */
-const remakeInputDialog = ref(null);
-
-/**
- * 补卡表单
- */
-const remakeForm = ref(null);
-
-/**
- * 撤销弹出框
- */
-const revokeDialog = ref(null);
-
-// 属性
-/**
- * 任务ID
- */
-const punchInId = ref(null);
-
-/**
- * 悬浮菜单样式
- */
-const fabPattern = ref({
-	icon: 'compose'
-});
-
-/**
- * 悬浮按钮菜单
- */
-const fabContent = [{
-	text: '删除',
-	active: false,
-	iconPath: '/static/delete.svg',
-	selectedIconPath: '/static/delete-active.svg',
-	func: "delete"
-},
-{
-	text: '归档',
-	active: false,
-	iconPath: '/static/archive.svg',
-	selectedIconPath: '/static/archive-active.svg',
-	func: "archive"
-},
-{
-	text: '撤销',
-	active: false,
-	iconPath: '/static/revoke.svg',
-	selectedIconPath: '/static/revoke_active.svg',
-	func: "revoke"
-},
-{
-	text: '补卡',
-	active: false,
-	iconPath: '/static/append.svg',
-	selectedIconPath: '/static/append-active.svg',
-	func: "remake"
-},
-{
-	text: '编辑',
-	active: false,
-	iconPath: '/static/edit.svg',
-	selectedIconPath: '/static/edit-active.svg',
-	func: "edit"
-}
-];
-
-/**
- * 补卡表单数据
- */
-const remakeFormData = ref({
-	punchIndate: '2024-12-16'
-});
-
-/**
- * 补卡表单校验规则
- */
-const remakeFormRules = ref({
-	punchInDate: {
-		rules: [{
-			required: true,
-			errorMessage: '补卡日期不能为空'
-		}]
-	}
-});
-
-/**
- * 查询条件
- */
-const queryData = ref(null);
-
-/**
- * 打卡日历数据
- */
-const punchInData = ref({
-	startDate: '2024-12-01',
-	endDate: '2024-12-31',
-	punchInNum: 0,
-	punchInRate: 0,
-	calendarSelected: [],
-	punchInRecords: []
-});
-
-// 方法
-/**
- * 悬浮按钮点击事件
- */
-const trigger = (e) => {
-	if (e.item.func == 'delete') {
-		deleteDialog.value.open();
-	}
-	if (e.item.func == 'archive') {
-		archiveDialog.value.open();
-	}
-	if (e.item.func == 'revoke') {
-		revokeDialog.value.open();
-	}
-	if (e.item.func == 'remake') {
-		// 初始化上一轮的数据
-		remakeFormData.value = {
-			punchInId: punchInId.value,
-			punchInDate: dateUtils.getYesterday()
-		};
-
-		remakeInputDialog.value.open();
-	}
-	if (e.item.func == 'edit') {
-		uni.navigateTo({
-			url: router.PUNCHIN_EDIT_URL + "?id=" + punchInId.value
-		});
-	}
-
-	fabBtn.value.close();
-}
-
-/**
- * 删除确认
- */
-const deleteDialogConfirm = async () => {
-	punchInApi.deletePunchIn({ id: punchInId.value })
-		.then(ret => {
-			deleteDialog.value.close();
-			uni.showToast({
-				title: '删除成功',
-				icon: 'success'
-			});
-			setTimeout(() => {
-				uni.navigateBack();
-			}, 1000);
-		})
-		.catch(err => {
-			uni.showToast({
-				title: '删除失败',
-				icon: 'error'
-			});
-		});
-}
-
-/**
- * 删除取消
- */
-const deleteDialogClose = () => {
-	deleteDialog.value.close();
-}
-
-/**
- * 归档确认
- */
-const archiveDialogConfirm = async () => {
-	punchInApi.archivePunchIn({ id: punchInId.value })
-		.then(ret => {
-			archiveDialog.value.close();
-			uni.showToast({
-				title: '归档成功',
-				icon: 'success'
-			});
-			setTimeout(() => {
-				uni.navigateBack();
-			}, 1000);
-		})
-		.catch(err => {
-			uni.showToast({
-				title: '归档失败',
-				icon: 'error'
-			});
-		});
-}
-
-/**
- * 归档取消
- */
-const archiveDialogClose = () => {
-	archiveDialog.value.close();
-}
-
-/**
- * 补卡时间选择监听
- */
-const remakePunchInDateChange = (e) => {
-	remakeFormData.value.punchInDate = e.detail.value;
-}
-
-/**
- * 补卡表单提交
- */
-const remakeFormConfirm = async () => {
-	remakeForm.value.validate(['punchInId']).then(data => {
-		return punchInApi.remakePunchIn(data);
-	}).then(e => {
-		remakeInputDialog.value.close();
-		uni.showToast({
-			title: '补卡成功',
-			icon: 'success'
-		});
-		loadData();
-	}).catch(err => {
-		uni.showToast({
-			title: '补卡失败',
-			icon: 'error'
-		});
-	})
-}
-
-/**
- * 补卡表单取消
- */
-const remakeFormClose = async () => {
-	remakeInputDialog.value.close();
-}
-
-/**
- * 撤销确认
- */
-const revokeDialogConfirm = async () => {
-	punchInApi.revokePunchIn({ punchInId: punchInId.value })
-		.then(ret => {
-			revokeDialog.value.close();
-			uni.showToast({
-				title: '撤销成功',
-				icon: 'success'
-			});
-			loadData();
-		})
-		.catch(err => {
-			uni.showToast({
-				title: '撤销失败',
-				icon: 'error'
-			});
-		});
-}
-
-/**
- * 撤销取消
- */
-const revokeDialogClose = () => {
-	revokeDialog.value.close();
-}
-
-/**
- * 日历月份切换
- */
-const calendarMonthSwitchChange = (e) => {
-	queryData.value = e;
-	loadData();
-}
-
-/**
- * 加载数据
- */
-const loadData = () => {
-	punchInApi.queryPunchInData({
-		id: punchInId.value,
-		year: queryData.value.year,
-		month: queryData.value.month,
-	}).then(data => {
-		punchInData.value = data;
-	}).catch(err => {
-		uni.showToast({
-			title: '加载失败',
-			icon: 'error'
-		});
-	});
-}
-
-onLoad(async (e) => {
-	if (e.id) {
-		punchInId.value = e.id;
-		// 初始化查询条件
-		queryData.value = dateUtils.getTodayYearMonthObj();
-
-		// 加载数据
-		loadData();
-	}
-});
-
-onPullDownRefresh(() => {
-	loadData();
-	uni.stopPullDownRefresh();
-});
-</script>
-
-<style lang="scss" scoped>
-.info-box,
-.log-box {
-	margin-top: 24rpx;
-}
-
-.info-box {
-	display: flex;
-	background-color: #FFFFFF;
-	padding: 20rpx 10rpx;
-
-	.left,
-	.right {
-		flex: 1;
-		display: flex;
-		align-items: center;
-		justify-content: center;
-	}
-}
-
-.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;
-}
-</style>

+ 0 - 245
src/pages/punchin-edit/punchin-edit.vue

@@ -1,245 +0,0 @@
-<template>
-	<main-layout :showHome="true" :showBack="true">
-		<template>
-			<uni-forms ref="punchInForm" :modelValue="punchInFormData" :label-width="80" :rules="punchInFormRules">
-				<uni-section title="基本信息" padding="16px" type="line">
-					<uni-forms-item label="任务名称" required name="taskName">
-						<uni-easyinput v-model="punchInFormData.taskName" placeholder="请输入任务名称" />
-					</uni-forms-item>
-					<uni-forms-item label="奖励数" required name="rewardNum">
-						<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="dictStore.ENABLE_STATUS"></uni-data-checkbox>
-					</uni-forms-item>
-					<uni-forms-item label="全勤双倍" required name="fullAttendanceFlag">
-						<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="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="请输入任务描述" />
-					</uni-forms-item>
-				</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="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" />
-					</uni-forms-item>
-				</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="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>
-						</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>
-				</view>
-			</uni-forms>
-		</template>
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from 'vue';
-import { onLoad } from '@dcloudio/uni-app';
-import { punchInApi } from '@/service/apis';
-import { useDictStore } from '@/stores/dict';
-
-// 组件
-/**
- * 打卡任务表单
- */
-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 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
-		});
-		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;
-	/* 容器两侧的空白填充 */
-}
-</style>

+ 0 - 91
src/pages/reward-record-list/reward-record-list.vue

@@ -1,91 +0,0 @@
-<template>
-	<main-layout :showHome="true" :showBack="true">
-		<view class="selector">
-			<uni-datetime-picker type="daterange" v-model="datePickerValue" @change="dateChange" />
-		</view>
-		<uni-list :border="true">
-			<uni-list-item v-for="item in listData" :key="item.id">
-				<template v-slot:body>
-					<p>{{ item.claimRewardTime }}</p>
-					<p>
-						领取奖励:{{ item.claimRewardNum }},领取前奖励:{{ item.beforeClaimRewardNum }},领取后奖励:{{
-							item.afterClaimRewardNum }}
-					</p>
-				</template>
-			</uni-list-item>
-		</uni-list>
-		<uni-load-more status="no-more" v-if="!listData || listData.length == 0" />
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from 'vue';
-import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
-import dateUtils from '@/utils/date';
-import { rewardApi } from '@/service/apis';
-
-//属性
-/**
- * 日期选择器值/
- */
-const datePickerValue = ref([]);
-
-/**
- * 查询条件
- */
-const queryData = ref(null);
-
-/**
- * 列表数据
- */
-const listData = ref(null);
-
-// 方法
-/**
- * 日期选择监听
- */
-const dateChange = (e) => {
-	if (e.length == 0) {
-		queryData.value = {};
-		return;
-	}
-
-	queryData.value = {
-		startDate: e[0],
-		endDate: e[1]
-	};
-	loadData();
-}
-
-/**
- * 加载数据
- */
-const loadData = () => {
-	rewardApi.queryClaimRewardRecords(queryData.value).then(res => {
-		listData.value = res;
-	});
-}
-
-// 生命周期
-onLoad(() => {
-	const startDate = dateUtils.getFirstDayOfMonth();
-	const endDate = dateUtils.getLastDayOfMonth();
-	datePickerValue.value = [startDate, endDate];
-	queryData.value = {
-		startDate,
-		endDate
-	}
-	loadData();
-});
-
-onPullDownRefresh(() => {
-	loadData();
-	uni.stopPullDownRefresh();
-});
-</script>
-
-<style lang="scss" scoped>
-.selector {
-	background-color: #FFFFFF;
-}
-</style>

+ 8 - 0
src/pages/rewardMarket.vue

@@ -0,0 +1,8 @@
+<template>
+  <div class="market">market</div>
+</template>
+
+<script setup>
+</script>
+
+<style lang="scss" scoped></style>

+ 0 - 187
src/pages/scratch-record-list/scratch-record-list.vue

@@ -1,187 +0,0 @@
-<template>
-	<main-layout :showHome="true" :showBack="true">
-		<view class="selector">
-			<uni-datetime-picker type="daterange" v-model="datePickerValue" @change="dateChange" />
-		</view>
-		<uni-list :border="true">
-			<uni-list-item v-for="item in listData" :key="item.id">
-				<template v-slot:body>
-					<view class="box">
-						<view class="content">
-							<p>{{ item.creationTime }}</p>
-							<p>
-
-								<!-- <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>
-						<view class="icon" @click="oepnRevokeDialog(item.id)">
-							<uni-icons type="closeempty" size="30" />
-						</view>
-					</view>
-				</template>
-			</uni-list-item>
-			<uni-load-more status="no-more" v-if="!listData || listData.length == 0" />
-		</uni-list>
-
-		<!-- 撤销确认框 -->
-		<uni-popup ref="revokeDialog" type="dialog">
-			<uni-popup-dialog mode="base" :before-close="true" title="撤销提示" content="确认撤销记录?"
-				@confirm="revokeDialogConfirm" @close="revokeDialogClose"></uni-popup-dialog>
-		</uni-popup>
-	</main-layout>
-</template>
-
-<script setup>
-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();
-/**
- * 日期选择器值/
- */
-const datePickerValue = ref([]);
-
-/**
- * 查询条件
- */
-const queryData = ref(null);
-
-/**
- * 列表数据
- */
-const listData = ref(null);
-
-/**
- * 待撤销的记录ID
- */
-const scratchRecordId = ref(null);
-
-// 方法
-/**
- * 日期选择监听
- */
-const dateChange = (e) => {
-	if (e.length == 0) {
-		queryData.value = {};
-		return;
-	}
-
-	queryData.value = {
-		startDate: e[0],
-		endDate: e[1]
-	};
-	loadData();
-}
-
-/**
- * 加载数据
- */
-const loadData = async () => {
-	scratchApi.queryScratchRecord(queryData.value).then(res => {
-		listData.value = res;
-	});
-}
-
-/**
- * 打卡撤销dialog
- * @param id 
- */
-const oepnRevokeDialog = (id) => {
-	scratchRecordId.value = id;
-	revokeDialog.value.open();
-}
-
-/**
-	 * 撤销确认
-	 */
-const revokeDialogConfirm = async () => {
-	try {
-		let res = await scratchApi.revokeScratchRecord({
-			id: scratchRecordId.value
-		});
-		uni.showToast({
-			title: '撤销成功',
-			icon: 'success'
-		});
-		setTimeout(() => {
-			loadData();
-		}, 2000);
-	} catch (e) {
-		uni.showToast({
-			title: '撤销失败',
-			icon: 'error',
-			duration: 5000
-		});
-	} finally {
-		revokeDialogClose();
-	}
-}
-
-/**
- * 撤销取消
- */
-const revokeDialogClose = () => {
-	// 重置数据
-	scratchRecordId.value = null;
-	revokeDialog.value.close();
-}
-
-// 生命周期
-onLoad(() => {
-	const startDate = dateUtils.getFirstDayOfMonth();
-	const endDate = dateUtils.getLastDayOfMonth();
-	datePickerValue.value = [startDate, endDate];
-	queryData.value = {
-		startDate,
-		endDate
-	}
-	loadData();
-});
-
-onPullDownRefresh(() => {
-	loadData();
-	uni.stopPullDownRefresh();
-});
-</script>
-
-<style lang="scss" scoped>
-.selector {
-	background-color: #FFFFFF;
-}
-
-.box {
-	width: 100%;
-	height: 100%;
-
-	display: flex;
-	align-items: center;
-
-	.content {
-		flex-grow: 1;
-	}
-}
-</style>

+ 0 - 89
src/pages/settle-list/settle-list.vue

@@ -1,89 +0,0 @@
-<template>
-	<main-layout :showHome="true" :showBack="true">
-		<view class="selector">
-			<uni-datetime-picker type="daterange" v-model="datePickerValue" @change="dateChange" />
-		</view>
-		<uni-list :border="true">
-			<uni-list-item v-for="settle in settleData" :key="settle.id">
-				<template v-slot:body>
-					结算时间:{{ settle.settlementTime }}
-					结算前奖励:{{ settle.beforeSettleRewardNum }},结算奖励:{{ settle.settleRewardNum }},结算后奖励:{{
-						settle.afterSettleRewardNum }}
-				</template>
-			</uni-list-item>
-		</uni-list>
-		<uni-load-more status="no-more" v-if="!settleData || settleData.length == 0" />
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from 'vue';
-import { onLoad, onPullDownRefresh } from "@dcloudio/uni-app";
-import dateUtils from '@/utils/date';
-import { settleApi } from '@/service/apis';
-
-//属性
-/**
- * 日期选择器值/
- */
-const datePickerValue = ref([]);
-
-/**
- * 查询条件
- */
-const queryData = ref(null);
-
-/**
- * 结算数据
- */
-const settleData = ref(null);
-
-// 方法
-/**
- * 日期选择监听
- */
-const dateChange = (e) => {
-	if (e.length == 0) {
-		queryData.value = {};
-		return;
-	}
-
-	queryData.value = {
-		startDate: e[0],
-		endDate: e[1]
-	};
-	loadData();
-}
-
-/**
- * 加载数据
- */
-const loadData = () => {
-	settleApi.querySettle(queryData.value).then(res => {
-		settleData.value = res;
-	});
-}
-
-// 生命周期
-onLoad(() => {
-	const startDate = dateUtils.getFirstDayOfMonth();
-	const endDate = dateUtils.getLastDayOfMonth();
-	datePickerValue.value = [startDate, endDate];
-	queryData.value = {
-		startDate,
-		endDate
-	}
-	loadData();
-});
-
-onPullDownRefresh(() => {
-	loadData();
-	uni.stopPullDownRefresh();
-});
-</script>
-
-<style lang="scss" scoped>
-.selector {
-	background-color: #FFFFFF;
-}
-</style>

+ 8 - 0
src/pages/statData.vue

@@ -0,0 +1,8 @@
+<template>
+  <div class="data">data</div>
+</template>
+
+<script setup>
+</script>
+
+<style lang="scss" scoped></style>

+ 8 - 0
src/pages/taskList.vue

@@ -0,0 +1,8 @@
+<template>
+  <div class="task">task</div>
+</template>
+
+<script setup>
+</script>
+
+<style lang="scss" scoped></style>

+ 8 - 0
src/pages/taskTodo.vue

@@ -0,0 +1,8 @@
+<template>
+  <div class="todo">todo</div>
+</template>
+
+<script setup>
+</script>
+
+<style lang="scss" scoped></style>

+ 0 - 226
src/pages/user-info/user-info.vue

@@ -1,226 +0,0 @@
-<template>
-	<main-layout :showBack="true">
-		<template>
-			<view class="header">
-				<view class="avatar">
-					<uni-icons type="person" size="70"></uni-icons>
-				</view>
-				<span class="nickname">{{ userInfoStore.nickname }}</span>
-			</view>
-
-			<view class="func-wrap">
-				<uni-list :border="true">
-					<uni-list-item title="修改昵称" :showArrow="true" :showExtraIcon="true"
-						:extraIcon="{ color: '#000000', size: 22, type: 'compose' }" :clickable="true"
-						@click="modifyNickname">
-					</uni-list-item>
-				</uni-list>
-			</view>
-
-			<view class="func-wrap">
-				<uni-list :border="true">
-					<uni-list-item title="奖励结算记录" :showArrow="true" :showExtraIcon="true"
-						:extraIcon="{ color: '#000000', size: 22, type: 'list' }" link="navigateTo"
-						:to="router.SETTLE_LIST_URL">
-					</uni-list-item>
-					<uni-list-item title="奖励领取记录" :showArrow="true" :showExtraIcon="true"
-						:extraIcon="{ color: '#000000', size: 22, type: 'list' }" link="navigateTo"
-						:to="router.REWARD_RECORD_LIST_URL">
-					</uni-list-item>
-					<uni-list-item title="投入与产出记录" :showArrow="true" :showExtraIcon="true"
-						:extraIcon="{ color: '#000000', size: 22, type: 'list' }" link="navigateTo"
-						:to="router.SCRATCH_RECORD_LIST_URL">
-					</uni-list-item>
-				</uni-list>
-			</view>
-
-			<view class="cancel-btn" @click="logout">注销</view>
-
-			<!-- 修改昵称弹出框 -->
-			<uni-popup ref="nicknameInputDialog" type="dialog" :is-mask-click="false">
-				<uni-popup-dialog mode="input" :before-close="true" title="修改昵称" confirmText="保存"
-					@confirm="nicknameFormConfirm" @close="nicknameFormClose">
-					<view class=".nickname-dialog">
-						<input class=".nickname" v-model="nicknameFormData.nickname" placeholder="请输入昵称" />
-					</view>
-
-					<view style="display: none">
-						<uni-forms ref="nicknameForm" :modelValue="nicknameFormData" :rules="nicknameFormRules"
-							label-position="top" :label-width="150" err-show-type="modal">
-							<uni-forms-item name="nickname">
-								<uni-easyinput type="text" placeholder="请输入昵称"
-									v-model="nicknameFormData.nickname"></uni-easyinput>
-							</uni-forms-item>
-						</uni-forms>
-					</view>
-				</uni-popup-dialog>
-			</uni-popup>
-		</template>
-	</main-layout>
-</template>
-
-<script setup>
-import { ref } from "vue";
-import router from "@/common/constants/router.js";
-import { useUserInfoStore } from "@/stores/userInfo";
-import { userApi } from "@/service/apis.js";
-
-// 组件
-/**
- * 昵称弹出框
- */
-const nicknameInputDialog = ref(null);
-
-/**
- * 昵称表单
- */
-const nicknameForm = ref(null);
-
-// 属性
-/**
- * 用户信息
- */
-const userInfoStore = useUserInfoStore();
-
-/**
- * 昵称表单数据
- */
-const nicknameFormData = ref({
-	nickname: userInfoStore.nickname,
-});
-
-/**
- * 昵称表单验证规则
- */
-const nicknameFormRules = ref({
-	nickname: {
-		rules: [
-			{
-				required: true,
-				errorMessage: "昵称不能为空",
-			},
-			{
-				maxLength: 30,
-				errorMessage: "昵称不能超过{maxLength}个字符",
-			},
-		],
-	},
-});
-
-// 方法
-/**
- * 注销登录
- */
-const logout = () => {
-	userInfoStore.$reset();
-	uni.reLaunch({
-		url: router.INDEX_URL,
-	});
-};
-
-/**
- * 修改昵称 
- */
-const modifyNickname = (e) => {
-	nicknameInputDialog.value.open();
-};
-
-/**
- * 领取奖励表单提交
- */
-const nicknameFormConfirm = async () => {
-	let data = await nicknameForm.value.validate();
-	await userApi.modifyNickname(data);
-	userInfoStore.nickname = data.nickname;
-	nicknameInputDialog.value.close();
-	uni.showToast({
-		title: "修改成功",
-		icon: "success",
-	});
-};
-
-/**
- * 领取奖励表单取消
- */
-const nicknameFormClose = async () => {
-	nicknameInputDialog.value.close();
-};
-</script>
-
-<style lang="scss" scoped>
-.header {
-	display: flex;
-	justify-content: center;
-	align-items: center;
-	flex-direction: column;
-
-	margin-top: 100rpx;
-
-	.avatar {
-		width: 180rpx;
-		height: 180rpx;
-		opacity: 1;
-		background: #ffffff;
-		border-radius: 50%;
-
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-
-	.nickname {
-		margin-top: 16rpx;
-		font-size: 36rpx;
-		font-weight: 400;
-		letter-spacing: 0px;
-		line-height: 52.13rpx;
-		color: #000000;
-	}
-}
-
-.func-wrap {
-	background: #ffffff;
-	margin-top: 24rpx;
-}
-
-.cancel-btn {
-	margin-top: 24rpx;
-	height: 54rpx;
-	opacity: 1;
-	border-radius: 24rpx;
-	background: #f2607a;
-
-	/** 文本1 */
-	font-size: 26rpx;
-	font-weight: 400;
-	letter-spacing: 0rpx;
-	// line-height: 37.65rpx;
-	color: #ffffff;
-
-	display: flex;
-	justify-content: center;
-	align-content: center;
-	align-items: center;
-}
-
-.nickname-dialog {
-	width: 100%;
-	height: 100rpx;
-	border-radius: 8px;
-	background: #ffffff;
-	// 阴影
-	border: 0.5px solid #e4e4e4;
-
-	input {
-		width: 100%;
-		height: 100%;
-		font-size: 36rpx;
-		font-weight: 700;
-		letter-spacing: 0rpx;
-		line-height: 52.13rpx;
-		color: #000000;
-		border-radius: 24rpx;
-		text-align: center;
-	}
-}
-</style>

+ 270 - 0
src/pages/userCenter.vue

@@ -0,0 +1,270 @@
+<template>
+  <view class="bg-box">
+
+    <view class="placehold"></view>
+
+    <view>
+      <uni-list>
+        <uni-list-item :showArrow="true">
+          <template v-slot:body>
+            <view class="avatar-box">
+              <view class="avatar">
+                <view>
+                  <Avatar :username="userInfo.nickname" color="#FFFFFF" backgroundColor="#BDE0FF"></Avatar>
+                </view>
+                <span class="nickname">{{ userInfo.nickname }}</span>
+              </view>
+              <view class="avatar-func" v-if="loginStatus" @click="modifyNickname">修改</view>
+              <view class="avatar-func" v-else @click="login()">登录</view>
+            </view>
+          </template>
+        </uni-list-item>
+      </uni-list>
+    </view>
+
+    <view class="mt24" v-if="loginStatus">
+      <uni-list :border="true">
+        <uni-list-item title="订单记录" :showArrow="true" :showExtraIcon="true"
+          :extraIcon="{ color: '#000000', size: 22, type: 'list' }" link="navigateTo" :to="router.ORDER_LIST_PAGE">
+        </uni-list-item>
+      </uni-list>
+    </view>
+
+    <view class="mt24">
+      <uni-list :border="true">
+        <uni-list-item title="关于我们" :showArrow="true" :showExtraIcon="true"
+          :extraIcon="{ color: '#000000', size: 22, type: 'info' }" link="navigateTo" :to="router.ABOUT_US_PAGE">
+        </uni-list-item>
+        <uni-list-item title="免责声明" :showArrow="true" :showExtraIcon="true" clickable
+          :extraIcon="{ color: '#000000', size: 22, type: 'minus' }" link="navigateTo" :to="router.DISCLAIMER_PAGE">
+        </uni-list-item>
+      </uni-list>
+    </view>
+
+    <view class="mt24" v-if="loginStatus">
+      <uni-list :border="true">
+        <uni-list-item title="退出登录" :showArrow="true" :showExtraIcon="true"
+          :extraIcon="{ color: 'red', size: 22, type: 'closeempty' }" :clickable="true" @click="logout()">
+        </uni-list-item>
+      </uni-list>
+    </view>
+
+    <!-- 修改昵称弹出框 -->
+    <uni-popup ref="nicknameInputDialog" type="dialog" :is-mask-click="false">
+      <uni-popup-dialog mode="input" :before-close="true" title="修改昵称" confirmText="保存" @confirm="nicknameFormConfirm"
+        @close="nicknameFormClose">
+        <view class=".nickname-dialog">
+          <input class=".nickname" v-model="nicknameFormData.nickname" placeholder="请输入昵称" />
+        </view>
+
+        <view style="display: none">
+          <uni-forms ref="nicknameForm" :modelValue="nicknameFormData" :rules="nicknameFormRules" label-position="top"
+            :label-width="150" err-show-type="modal">
+            <uni-forms-item name="nickname">
+              <uni-easyinput type="text" placeholder="请输入昵称" v-model="nicknameFormData.nickname"></uni-easyinput>
+            </uni-forms-item>
+          </uni-forms>
+        </view>
+      </uni-popup-dialog>
+    </uni-popup>
+  </view>
+</template>
+
+<script setup>
+import { ref } from 'vue';
+import { onShow } from '@dcloudio/uni-app';
+import cacheKey from "@/common/cache.js";
+import router from "@/common/router.js";
+import { userApi } from "@/apis/apis.js";
+import Avatar from 'vue-avatar/src/Avatar.vue';
+
+// 组件
+/**
+ * 昵称弹出框
+ */
+const nicknameInputDialog = ref(null);
+
+/**
+ * 昵称表单
+ */
+const nicknameForm = ref(null);
+
+// 属性
+/**
+ * 登录状态:false-未登录,true-已登录
+ */
+const loginStatus = ref(false);
+
+/**
+ * 用户信息
+ */
+const userInfo = ref({
+  nickname: ''
+});
+
+/**
+ * 昵称表单数据
+ */
+const nicknameFormData = ref({
+  nickname: null,
+});
+
+/**
+ * 昵称表单验证规则
+ */
+const nicknameFormRules = ref({
+  nickname: {
+    rules: [
+      {
+        required: true,
+        errorMessage: "昵称不能为空",
+      },
+      {
+        maxLength: 30,
+        errorMessage: "昵称不能超过{maxLength}个字符",
+      },
+    ],
+  },
+});
+
+// 方法
+/**
+ * 登录
+ */
+const login = () => {
+  uni.navigateTo({
+    url: router.LOGIN_PAGE,
+  });
+};
+
+/**
+ * 注销登录
+ */
+const logout = () => {
+  uni.showModal({
+    title: "注销提示",
+    content: "确认退出登录?",
+    success: function (res) {
+      // 如果取消,则不执行后续代码
+      if (res.cancel) {
+        return;
+      }
+      // 移除用户信息
+      uni.removeStorageSync(cacheKey.TOKEN);
+      uni.removeStorageSync(cacheKey.NICKNAME);
+      // 跳转到主页
+      uni.reLaunch({
+        url: router.SUBSCRIPTION_SOURCE_MARKET_PAGE,
+      });
+    }
+  });
+};
+
+/**
+ * 获取用户信息
+ */
+const fetchUserInfo = async () => {
+  userInfo.value = await userApi.queryUserInfo();
+};
+
+/**
+ * 修改昵称 
+ */
+const modifyNickname = (e) => {
+  nicknameFormData.value.nickname = userInfo.value.nickname;
+  nicknameInputDialog.value.open();
+};
+
+/**
+ * 昵称修改表单 提交
+ */
+const nicknameFormConfirm = async () => {
+  let data = await nicknameForm.value.validate();
+  await userApi.modifyNickname(data);
+  userInfo.value.nickname = nicknameFormData.value.nickname;
+  nicknameInputDialog.value.close();
+  uni.showToast({
+    title: "修改成功",
+    icon: "success",
+  });
+};
+
+/**
+ * 昵称修改表单 关闭
+ */
+const nicknameFormClose = async () => {
+  nicknameInputDialog.value.close();
+};
+
+// 生命周期
+onShow(() => {
+  // 根据登录凭据判断登录状态
+  loginStatus.value = uni.getStorageSync(cacheKey.TOKEN) ? true : false;
+  if (loginStatus.value) {
+    fetchUserInfo();
+  } else {
+    userInfo.value.nickname = '游客';
+  }
+});
+</script>
+
+<style lang="scss" scoped>
+.bg-box {
+  background-color: #f5f5f5;
+  height: 100vh;
+}
+
+.mt24 {
+  margin-top: 24rpx;
+}
+
+.placehold {
+  width: 100%;
+  height: 24rpx;
+}
+
+.avatar-box {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  width: 100%;
+
+  .avatar {
+    display: flex;
+    align-items: center;
+  }
+
+  .nickname {
+    margin-left: 16rpx;
+  }
+
+  .avatar-func {
+    font-size: 24rpx;
+    font-weight: 400;
+    letter-spacing: 0rpx;
+    line-height: 34.75rpx;
+    color: #000000;
+  }
+}
+
+.nickname-dialog {
+  width: 100%;
+  height: 100rpx;
+  border-radius: 8px;
+  background: #ffffff;
+  // 阴影
+  border: 0.5px solid #e4e4e4;
+
+  input {
+    width: 100%;
+    height: 100%;
+    font-size: 36rpx;
+    font-weight: 700;
+    letter-spacing: 0rpx;
+    line-height: 52.13rpx;
+    color: #000000;
+    border-radius: 24rpx;
+    text-align: center;
+  }
+}
+</style>

BIN
src/static/data.png


BIN
src/static/data_active.png


BIN
src/static/logo.png


BIN
src/static/market.png


BIN
src/static/market_active.png


BIN
src/static/task.png


BIN
src/static/task_active.png


BIN
src/static/todo.png


BIN
src/static/todo_active.png


BIN
src/static/user.png


BIN
src/static/user_active.png


+ 0 - 60
src/stores/dict.js

@@ -1,60 +0,0 @@
-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 : [];
-                }
-            });
-        }
-    }
-});

+ 0 - 62
src/stores/safeArea.js

@@ -1,62 +0,0 @@
-import { defineStore } from 'pinia';
-
-/**
- * 安全区
- * statusBarHeight: 状态栏高度
- * capsuleBarHeight: 胶囊按钮高度
- * topHeight: 状态栏+胶囊按钮高度
- * bottomHeight: 底部安全区高度
- * capsuleBarHeight 胶囊按钮栏高度
- * capsuleBarLeft 胶囊按钮栏左边距离
- * capsuleBarMargin 胶囊按钮栏边距
- * capsuleBarMarginTop 胶囊按钮栏上边距
- * capsuleBarMarginBottom 胶囊按钮栏下边距
- * capsuleBarContentHeight 胶囊按钮内容高度
- */
-export const useSafeAreaStore = defineStore('safeArea', {
-	state: () => ({
-		statusBarHeight: 0,
-		capsuleBarHeight: 0,
-		topHeight: 0,
-		bottomHeight: 0,
-		capsuleBarLeft: 0,
-		capsuleBarMargin: 0,
-		capsuleBarMarginTop: 0,
-		capsuleBarMarginBottom: 0,
-		capsuleBarContentHeight: 0
-	}),
-	getters: {
-		/**
-		 * 状态栏样式
-		 */
-		statusBarStyle: (state) => ({
-			height: state.statusBarHeight+'px'
-		}),
-		/**
-		 * 胶囊区样式
-		 */
-		capsuleBarStyle: (state) => ({
-			height: state.capsuleBarHeight+'px',
-			width: state.capsuleBarLeft+'px',
-			'padding-top': state.capsuleBarMarginTop+'px', 
-			'padding-bottom': state.capsuleBarMarginBottom+'px'
-		}),
-		/**
-		 * 图标容器样式
-		 */
-		iconBoxStyle: (state) => ({
-			width: state.capsuleBarContentHeight-5+'px',
-			height: state.capsuleBarContentHeight-5+'px'
-		}),
-		/**
-		 * 图标大小
-		 */
-		iconSize: (state) => state.capsuleBarContentHeight-10,
-		/**
-		 * 底部填充区样式
-		 */
-		bottomBoxStyle: (state) => ({
-			height: state.bottomHeight+'px'
-		})
-	}
-});

+ 0 - 27
src/stores/userInfo.js

@@ -1,27 +0,0 @@
-import { defineStore } from 'pinia';
-
-/**
- * 用户信息
- */
-export const useUserInfoStore = defineStore('userInfo', {
-	state: () => ({
-		/**
-		 * 登录凭据
-		 */
-		token: null,
-		
-		/**
-		 * 昵称
-		 */
-		nickname: null
-	}),
-	unistorage: true,
-	getters: {
-		/**
-		 * 登录状态判断
-		 * true-已登录
-		 * false-未登录
-		 */
-	    isLogin: (state) => Boolean(state.token),
-	}
-});

+ 9 - 7
src/utils/request.js

@@ -1,9 +1,7 @@
-import { useUserInfoStore } from '@/stores/userInfo.js';
-import router from '@/common/constants/router.js';
+import router from '@/common/router.js';
+import cacheKey from '@/common/cache.js';
 
 export default function request(config = {}) {
-	
-	const userInfoStore = useUserInfoStore();
 
 	let {
 		url,
@@ -16,8 +14,13 @@ export default function request(config = {}) {
 
 	// 拼接url
 	url = process.env.BASE_API_URL + url;
+
 	// 添加token
-	header['Authorization'] = userInfoStore.token;
+	let token = uni.getStorageSync(cacheKey.TOKEN);
+	if (token) {
+		header['Authorization'] = token;
+	}
+
 	// 是否显示loading
 	if (loading) {
 		uni.showLoading({
@@ -37,11 +40,10 @@ export default function request(config = {}) {
 				// 登录状态判断
 				if (res.statusCode === 401) {
 					// 清除token
-					userInfoStore.token = null;
+					uni.removeStorageSync(cacheKey.TOKEN);
 					uni.showModal({
 						title: "登录提示",
 						content: "登录凭据已失效,请重新登录",
-						showCancel: false,
 						success: function (res) {
 							if (res.confirm) {
 								uni.navigateTo({

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác