From 1ce3f218ceaa28bf4b9bf57027246ec036459d4b Mon Sep 17 00:00:00 2001
From: liutong <836164388@qq.com>
Date: Thu, 10 Apr 2025 11:19:02 +0800
Subject: [PATCH] =?UTF-8?q?refactor(coach):=20=E9=87=8D=E6=9E=84=E6=95=99?=
=?UTF-8?q?=E7=BB=83=E7=AB=AF=E9=A6=96=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 移除了不必要的数据和方法
- 优化了页面结构
- 添加了发布作业按钮的点击事件
- 删除了未使用的用户信息获取和活动列表获取逻辑
---
pages/coach/home/index.vue | 106 +------------------------------------
1 file changed, 2 insertions(+), 104 deletions(-)
diff --git a/pages/coach/home/index.vue b/pages/coach/home/index.vue
index adf4071..2d9fc2e 100644
--- a/pages/coach/home/index.vue
+++ b/pages/coach/home/index.vue
@@ -4,7 +4,7 @@
待办
- 发布作业
+ 发布作业
@@ -170,26 +170,9 @@ export default {
course_list:[],//课程列表
task_list:[],//作业批改
},
-
- list: [],
- likes: 0,
- type: 1,
- type1: 1,
- activity_id: 0,
- um_id: 0,
- urls: 'http://medication.zeyan.wang/'
- }
- },
- onLoad() {
- const um_id = uni.getStorageSync('um_id');
- this.um_id = um_id
- if (um_id == '') {
- uni.navigateTo({
- url: '/pages/login/login'
- })
}
- this.fetchData(this.um_id)
},
+ onLoad() {},
onShow() {
this.init()//初始化
},
@@ -227,91 +210,6 @@ export default {
url: '/pages/coach/job/list'
})
},
-
- fetchData(um_id) {
- user.activity_index({
- um_id: um_id
- }).then(res => {
- console.log(res)
- if (res.status == 200) {
- if (res.data == null) {
- this.list = []
- } else {
- this.list = res.data
- }
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- });
- },
- onPullDownRefresh() {
- this.fetchData(this.um_id)
- },
- publishing() {
- uni.navigateTo({
- url: '/pages/index/publishing'
- })
- },
- like(id, um_id) {
- user.activity_like({um_id: um_id, activity_id: id, type: 1}).then(res => {
- if (res.status == 200) {
- user.activity_index({
- um_id: um_id
- }).then(res => {
- console.log(res)
- if (res.status == 200) {
- this.list = res.data
- }
- });
- this.type = res.data.type
- this.activity_id = res.data.activity_id
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- });
- },
- collection(id, um_id) {
- user.activity_like({um_id: um_id, activity_id: id, type: 2}).then(res => {
- if (res.status == 200) {
- console.log(res)
- this.fetchData(this.um_id)
- this.type1 = res.data.type
- this.activity_id = res.data.activity_id
- } else {
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- }
- });
- },
- coninfo(item) {
- // user.coninfo({id:id}).then(res => {
- // if(res.status == 200){
- uni.setStorageSync('coninfo', item);
- uni.navigateTo({
- url: '/pages/index/coninfo'
- })
- // }else{
- // uni.showToast({
- // title: res.msg,
- // icon: 'none'
- // })
- // }
- // });
- },
- Comment(id) {
- uni.setStorageSync('actid', id);
- uni.navigateTo({
- url: '/pages/index/Comment'
- })
- }
}
}