From c68077f701809bc05a3890bb8df29b3b40aa589b Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Mon, 14 Apr 2025 20:56:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E3=80=81=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E3=80=81=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=8A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增任务中心页面,支持任务列表展示、任务接受、任务提交等功能 - 新增订单详情页面,展示订单详细信息及服务记录 - 新增个人信息页面,支持用户头像、昵称等信息修改 - 新增配置信息初始化功能,优化全局配置管理 - 新增新用户优惠券弹窗,提升用户体验 --- App.vue | 1 + api/system/configList.js | 12 + api/system/task.js | 39 ++ main.js | 5 + mixins/configList.js | 61 +++ mixins/list.js | 78 +++ pages.json | 36 ++ pages/components/NewUserCoupon.vue | 120 +++++ pages/index.vue | 33 +- pages/newOrder/petList.vue | 913 ++++++++++++++++++----------------- pages/personalCenter/index.vue | 44 +- pages/personalCenter/orderDetail.vue | 332 +++++++++++++ pages/personalCenter/taskDetail.vue | 367 ++++++++++++++ pages/personalCenter/taskList.vue | 298 ++++++++++++ pages/personalCenter/userInfo.vue | 261 ++++++++++ store/index.js | 33 +- store/modules/user.js | 188 ++++---- utils/getUrl.js | 5 +- 18 files changed, 2282 insertions(+), 544 deletions(-) create mode 100644 api/system/configList.js create mode 100644 api/system/task.js create mode 100644 mixins/configList.js create mode 100644 mixins/list.js create mode 100644 pages/components/NewUserCoupon.vue create mode 100644 pages/personalCenter/orderDetail.vue create mode 100644 pages/personalCenter/taskDetail.vue create mode 100644 pages/personalCenter/taskList.vue create mode 100644 pages/personalCenter/userInfo.vue diff --git a/App.vue b/App.vue index 6860b39..96061fa 100644 --- a/App.vue +++ b/App.vue @@ -8,6 +8,7 @@ export default { onLaunch: function() { this.initApp() + // this.$store.commit('initConfig') }, methods: { // 初始化应用 diff --git a/api/system/configList.js b/api/system/configList.js new file mode 100644 index 0000000..1784e0a --- /dev/null +++ b/api/system/configList.js @@ -0,0 +1,12 @@ +// 小程序-配置信息 +import request from '@/utils/request' + +// 小程序-配置信息列表数据查询 +export function getConfigList() { + return request({ + 'url': '/applet/config/configList', + 'method': 'get' + }).then(res => { + return res.data + }) +} \ No newline at end of file diff --git a/api/system/task.js b/api/system/task.js new file mode 100644 index 0000000..d181dbe --- /dev/null +++ b/api/system/task.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' + +// 获取任务列表 +export function getTaskList(data={}){ + return request({ + url: `/h5/task/list`, + headers:{ "isToken":true}, + method: 'get', + params: data + }) +} + +// 接受任务 +export function acceptTask(taskId){ + return request({ + url: `/h5/task/accept/${taskId}`, + headers:{ "isToken":true}, + method: 'post' + }) +} + +// 提交任务 +export function submitTask(data){ + return request({ + url: `/h5/task/submit`, + headers:{ "isToken":true}, + method: 'post', + data + }) +} + +// 获取任务详情 +export function getTaskDetail(taskId){ + return request({ + url: `/h5/task/detail/${taskId}`, + headers:{ "isToken":true}, + method: 'get' + }) +} \ No newline at end of file diff --git a/main.js b/main.js index ce67b75..0cb51bc 100644 --- a/main.js +++ b/main.js @@ -5,10 +5,15 @@ import plugins from './plugins' // plugins import './permission' // permission import share from 'utils/share.js'//share.js import uView from '@/uni_modules/uview-ui' + +import configListMinxin from '@/mixins/configList.js' + Vue.use(uView) Vue.use(plugins) +Vue.mixin(configListMinxin) + Vue.config.productionTip = false Vue.prototype.$store = store diff --git a/mixins/configList.js b/mixins/configList.js new file mode 100644 index 0000000..6b5fcc1 --- /dev/null +++ b/mixins/configList.js @@ -0,0 +1,61 @@ + + +import { mapState } from 'vuex' +export default { + data() { + return { + // 默认的全局分享内容 + Gshare: { + // title: '三只青蛙', + path: '/pages_order/auth/wxLogin', // 全局分享的路径,比如 首页 + // imageUrl: '/static/image/login/logo.png', // 全局分享的图片(可本地可网络) + } + } + }, + computed: { + ...mapState(['configList', 'userInfo', 'riceInfo']), + currentPagePath() { + const pages = getCurrentPages(); + const currentPage = pages[pages.length - 1]; + let path = `/${currentPage.route}`; + + // 获取当前页面的参数 + const options = currentPage.options; + if (options && Object.keys(options).length > 0) { + const params = this.$utils.objectToUrlParams(options); + path += `?${params}`; + } + + return path; + }, + }, + // 定义全局分享 + // 1.发送给朋友 + onShareAppMessage(res) { + let o = { + title : this.configList.logo_name, + ...this.Gshare, + } + if(this.userInfo.id){ + if(this.Gshare.path.includes('?')){ + o.path += '&shareId=' + this.userInfo.id + }else{ + o.path += '?shareId=' + this.userInfo.id + } + } + return o + }, + //2.分享到朋友圈 + onShareTimeline(res) { + let o = { + ...this.Gshare, + title : this.configList.logo_name, + } + if(this.userInfo.id){ + o.path = this.Gshare.path + '?shareId=' + this.userInfo.id + } + return o + }, + methods: { + } +} \ No newline at end of file diff --git a/mixins/list.js b/mixins/list.js new file mode 100644 index 0000000..23bb70e --- /dev/null +++ b/mixins/list.js @@ -0,0 +1,78 @@ +/** + * 处理查询参数 + * @param {Object} self - 组件实例 + * @param {Object} queryParams - 额外的查询参数 + * @returns {Object} 合并后的查询参数 + */ +function query(self, queryParams){ + // 深度合并对象 + return self.$utils.deepMergeObject( + self.$utils.deepMergeObject(self.queryParams, + (self.beforeGetData && self.beforeGetData()) || {}), + queryParams) +} + +/** + * 列表数据加载混入 + * 提供列表数据的加载、分页、下拉刷新、上拉加载更多等功能 + */ +export default { + data() { + return { + queryParams: { + pageNo: 1, + pageSize: 10, + }, + total : 0, + list : [], + } + }, + // 下拉刷新 + onPullDownRefresh() { + this.getData() + }, + // 上拉加载更多 + onReachBottom() { + this.loadMoreData() + }, + // 页面显示时加载数据 + onShow() { + this.getData() + }, + methods: { + /** + * 获取列表数据 + * @param {Object} queryParams - 查询参数 + * @returns {Promise} 返回Promise对象 + */ + getData(queryParams){ + return new Promise((success, error) => { + if(!this.mixinsListApi){ + return console.error('mixinsListApi 缺失'); + } + this.$api(this.mixinsListApi, + query(this, queryParams), res => { + uni.stopPullDownRefresh() + if(res.code == 200){ + success(res.result) + // 更新列表数据 + this[this.mixinsListKey || 'list'] = res.result.records || res.result + // 更新总数 + this.total = res.result.total || res.result.length + // 调用数据加载完成的回调 + this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result) + } + }) + }) + }, + /** + * 加载更多数据 + */ + loadMoreData(){ + if(this.queryParams.pageSize < this.total){ + this.queryParams.pageSize += 10 + this.getData() + } + }, + } +} \ No newline at end of file diff --git a/pages.json b/pages.json index 2cb8885..baec9dd 100644 --- a/pages.json +++ b/pages.json @@ -149,6 +149,15 @@ "navigationBarTextStyle": "white" } }, + { + "path": "pages/personalCenter/orderDetail", + "style": { + "navigationBarTitleText": "当前订单", + "navigationBarBackgroundColor": "#FFBF60", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white" + } + }, { "path": "pages/personalCenter/pet", "style": { @@ -292,6 +301,33 @@ "enablePullDownRefresh": false, "navigationBarTextStyle": "white" } + }, + { + "path": "pages/personalCenter/taskList", + "style": { + "navigationBarTitleText": "任务中心", + "navigationBarBackgroundColor": "#FFBF60", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/personalCenter/taskDetail", + "style": { + "navigationBarTitleText": "任务详情", + "navigationBarBackgroundColor": "#FFBF60", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white" + } + }, + { + "path": "pages/personalCenter/userInfo", + "style": { + "navigationBarTitleText": "个人信息", + "navigationBarBackgroundColor": "#FFBF60", + "enablePullDownRefresh": false, + "navigationBarTextStyle": "white" + } } ], "tabBar": { diff --git a/pages/components/NewUserCoupon.vue b/pages/components/NewUserCoupon.vue new file mode 100644 index 0000000..0174c3a --- /dev/null +++ b/pages/components/NewUserCoupon.vue @@ -0,0 +1,120 @@ + + + + + \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index cfaadae..cd5ba52 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,6 +1,9 @@