Browse Source

添加工作台每日一签更新数量方法

xiaohaizhao 1 năm trước cách đây
mục cha
commit
a561b7548e
2 tập tin đã thay đổi với 59 bổ sung32 xóa
  1. 6 0
      packageA/dailyYttendance/index.vue
  2. 53 32
      pages/index/cloud/workbench.vue

+ 6 - 0
packageA/dailyYttendance/index.vue

@@ -74,6 +74,12 @@ export default {
     onShow() {
         if (this.content.pageNumber && this.content.pageNumber >= 2) this.getList(true)
     },
+    onUnload() {
+        if (this.$Http.updateUserInfo) {
+            this.$Http.updateUserInfo()
+            delete this.$Http.updateUserInfo
+        }
+    },
     methods: {
         getList(init = false) {
             if (this.paging(this.content, init)) return;

+ 53 - 32
pages/index/cloud/workbench.vue

@@ -10,33 +10,35 @@
         <UserInfo :userInfoValue="userInfoValue"></UserInfo>
 
         <view class="work-panel_signin">
-            <text class="title">你已累计打卡{{userInfoValue.signdays}}天</text>
-            <navigator class="but" url="/packageA/dailyYttendance/index" hover-class="navigator-hover">
+            <text class="title">你已累计打卡{{ userInfoValue.signdays }}天</text>
+            <navigator class="but" @click="toDailyYttendance" url="/packageA/dailyYttendance/index"
+                hover-class="navigator-hover">
                 每日一签
             </navigator>
         </view>
-        <view class="work-panel_applist"> 
-            <template v-for="(item,index) in list">
+        <view class="work-panel_applist">
+            <template v-for="(item, index) in list">
                 <navigator @click="switchPage(item)" class="app" url="#" :key="item.name">
                     <view class="bg" :style="item.color">
                         <image class="image" :src="`/static/workbench/${item.name}.svg`" mode="widthFix"></image>
                     </view>
-                    <text class="name">{{item.remark}}</text>
-                    
+                    <text class="name">{{ item.remark }}</text>
+
                 </navigator>
             </template>
-            
+
         </view>
         <view class="work-panel_options">
-            <template v-for="(item,index) in list2">
-                <navigator @click="switchPage(item)" class="option" :key="index" url="#" hover-class="navigator-hover" open-type="navigate">
+            <template v-for="(item, index) in list2">
+                <navigator @click="switchPage(item)" class="option" :key="index" url="#" hover-class="navigator-hover"
+                    open-type="navigate">
                     <view class="box">
                         <text class="left">{{ item.remark }}</text>
                         <view class="right">
                             <u-icon name="arrow-right" color="#999999"></u-icon>
                         </view>
                     </view>
-                    
+
                 </navigator>
             </template>
         </view>
@@ -46,7 +48,7 @@
 <script>
 import UserInfo from './userInfo.vue'
 export default {
-	components: { UserInfo },
+    components: { UserInfo },
     data() {
         return {
             updatePage: true,
@@ -64,20 +66,20 @@ export default {
                 "background: linear-gradient( 225deg, #F1AA68 0%, #EA895B 100%)"
             ],
             content: {
-            "pageNumber": 1,
-            "pageSize": 20,
+                "pageNumber": 1,
+                "pageSize": 20,
                 "where": {
                     "condition": "",
                     "isnew": '',
                     "class": ""
                 }
             },
-            userInfoValue:{},
-            roles:[]
+            userInfoValue: {},
+            roles: []
         }
     },
     methods: {
-        
+
         init(callBack) {
             callBack()
             this.list = Object.values(uni.getStorageSync('authList').工作台)
@@ -86,16 +88,18 @@ export default {
             this.getUserInfo()
             this.updatePage = false;
         },
-        async getUserInfo () {
+        async getUserInfo() {
             let res = await this.$Http.basic({
                 "id": "20240510104102",
                 "content": {}
             })
             this.userInfoValue = res.data
-            console.log(this.userInfoValue,'用户信息')
+            console.log(this.userInfoValue, '用户信息')
         },
-   
-        onSearch () {
+        toDailyYttendance() {
+            this.$Http.updateUserInfo = this.getUserInfo.bind(this)
+        },
+        onSearch() {
             uni.navigateTo({
                 url: '/cloud/globalSearch/index',
             })
@@ -107,16 +111,18 @@ export default {
 <style lang="scss">
 .work-panel {
     padding: 10px 10px 80px 10px;
+
     .work-panel_header {
         display: flex;
         align-items: center;
-        .image{
+
+        .image {
             width: 40px;
             height: 20px;
             margin-right: 10px;
         }
     }
-    
+
     .work-panel_signin {
         display: flex;
         align-items: center;
@@ -125,20 +131,23 @@ export default {
         font-family: Source Han Sans SC, Source Han Sans SC;
         background: #FFFFFF;
         border-radius: 8px 8px 8px 8px;
-        .title{
+
+        .title {
             font-weight: 400;
             font-size: 14px;
             color: #333333;
         }
+
         .but {
             font-weight: 500;
             font-size: 14px;
             color: #FFFFFF;
-            background: linear-gradient( 90deg, #C30D23 0%, #E3041F 100%);
+            background: linear-gradient(90deg, #C30D23 0%, #E3041F 100%);
             border-radius: 50px 50px 50px 50px;
             padding: 6px 15px;
         }
     }
+
     .work-panel_applist {
         display: flex;
         flex-wrap: wrap;
@@ -146,6 +155,7 @@ export default {
         background: #ffffff;
         border-radius: 8px 8px 8px 8px;
         box-sizing: border-box;
+
         .app {
             display: flex;
             flex-direction: column;
@@ -154,6 +164,7 @@ export default {
             padding: 15px;
             width: 25%;
             box-sizing: border-box;
+
             .bg {
                 width: 44px;
                 height: 44px;
@@ -162,15 +173,16 @@ export default {
                 align-items: center;
                 justify-content: space-evenly;
                 align-content: center;
-                background: linear-gradient( 225deg, #81AEF3 0%, #6787E7 100%);
-                .image{
+                background: linear-gradient(225deg, #81AEF3 0%, #6787E7 100%);
+
+                .image {
                     align-self: center;
                     width: 24px;
                     height: 24px;
                 }
             }
-            
-            .name{
+
+            .name {
                 font-family: Source Han Sans SC, Source Han Sans SC;
                 font-weight: 400;
                 font-size: 14px;
@@ -180,40 +192,49 @@ export default {
             }
         }
     }
+
     .work-panel_options {
         background: #ffffff;
         border-radius: 8px;
         font-family: Source Han Sans SC, Source Han Sans SC;
+
         .option {
             padding: 15px 0 0 10px;
+
             &:first-child {
                 border-top-left-radius: 8px;
                 border-top-right-radius: 8px;
             }
+
             &:last-child {
                 border-bottom-left-radius: 8px;
                 border-bottom-right-radius: 8px;
+
                 .box {
                     border: none;
                 }
             }
+
             .box {
-                padding-bottom:15px;
-                padding-right:15px;
+                padding-bottom: 15px;
+                padding-right: 15px;
                 border-bottom: 1px solid #DDDDDD;
                 display: flex;
                 justify-content: space-between;
                 align-items: center;
                 align-content: center;
+
                 .left {
                     font-weight: 400;
                     font-size: 14px;
                     color: #333333;
                 }
-                .right{
+
+                .right {
                     display: flex;
                     align-items: center;
                     align-content: center;
+
                     .tag {
                         background: #BBBBBB;
                         border-radius: 50px 50px 50px 50px;
@@ -227,7 +248,7 @@ export default {
                 }
             }
         }
-        
+
     }
 }
 </style>