فهرست منبع

+ 报名信息更新之后更新会话信息

chen.cheng 11 ماه پیش
والد
کامیت
249a5edc13
9فایلهای تغییر یافته به همراه114 افزوده شده و 87 حذف شده
  1. 1 0
      common/EnumConst.js
  2. 7 0
      common/api.js
  3. 29 0
      common/common.scss
  4. 0 28
      pages/tabbar/index/index.scss
  5. 1 1
      pages/tabbar/my/index.scss
  6. 57 9
      pages/tabbar/my/index.vue
  7. 1 0
      pasb/pages/login/index.vue
  8. 15 7
      pasb/pages/regist/index.vue
  9. 3 42
      util/index.js

+ 1 - 0
common/EnumConst.js

@@ -1,6 +1,7 @@
 export const COMP_CODE = {
   index_ctl: 'index_ctl',
   index_swip: 'index_swip',
+  my: 'my',
 };
 export const ICON_CFG = {
   file_icon: '/profile/upload/2024/08/17/file_icon_20240817121536A002.svg',

+ 7 - 0
common/api.js

@@ -53,3 +53,10 @@ export const fetchEnterpriseTripList = (params = {}) => http.get(
       Authorization: `Bearer ${getToken()}`,
     },
   });
+
+export const fetchUsrInfo = (usrId) => http.get(
+  `/cp/usr/${usrId}`, {
+    header: {
+      Authorization: `Bearer ${getToken()}`,
+    },
+  });

+ 29 - 0
common/common.scss

@@ -67,3 +67,32 @@
     background-color: #fefefe!important;
   }
 }
+
+.u-grid {
+  /deep/ .u-grid-item {
+    width: 33.3333%;
+    margin-top: 30rpx !important;
+  }
+  /deep/ .u-grid-item .grid-item-icon {
+    width: 100rpx;
+    height: 100rpx;
+    background-color: red;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    border-radius: 10rpx;
+  }
+  /deep/ .u-grid-item .grid-item-icon image{
+    width: 60rpx;
+    height: 60rpx;
+  }
+  /deep/ .u-grid-item .grid-text{
+    font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
+    color: #333333;
+    margin-top: 10rpx;
+    font-size: 28rpx;
+  }
+  /deep/ .u-swiper__wrapper__item__wrapper__image {
+    border-radius: 0 !important;
+  }
+}

+ 0 - 28
pages/tabbar/index/index.scss

@@ -1,33 +1,5 @@
 @import "../../../common/common.scss";
 .fui-wrap {
-  .u-grid {
-    /deep/ .u-grid-item {
-      width: 33.3333%;
-      margin-top: 30rpx !important;
-    }
-    /deep/ .u-grid-item .grid-item-icon {
-      width: 100rpx;
-      height: 100rpx;
-      background-color: red;
-      display: flex;
-      align-items: center;
-      justify-content: center;
-      border-radius: 10rpx;
-    }
-    /deep/ .u-grid-item .grid-item-icon image{
-      width: 60rpx;
-      height: 60rpx;
-    }
-    /deep/ .u-grid-item .grid-text{
-      font-family: "PingFangSC-Regular", "PingFang SC", sans-serif;
-      color: #333333;
-      margin-top: 10rpx;
-      font-size: 28rpx;
-    }
-    /deep/ .u-swiper__wrapper__item__wrapper__image {
-      border-radius: 0 !important;
-    }
-  }
   .u-gap{
     margin-top: 20rpx !important;
   }

+ 1 - 1
pages/tabbar/my/index.scss

@@ -46,7 +46,7 @@
       }
     }
     .ctl-panel{
-      height: 250rpx;
+      height: auto;
     }
   }
 }

+ 57 - 9
pages/tabbar/my/index.vue

@@ -1,6 +1,5 @@
 <template>
-  <auth-wrap class="fui-wrap" ref="authWrap">
-    <view slot="content">
+  <view class="fui-wrap">
       <view class="user-info-bg">
       </view>
       <view class="ctl-container">
@@ -8,9 +7,9 @@
           <view class="user-info-img">
             <u-avatar :src=" userInfo && userInfo.avatarUrl || ''" shape="circle" :size="60"></u-avatar>
           </view>
-          <view class="user-info">
+          <view class="user-info" @click="$u.throttle(onHeadClick,500)">
             <view>
-              {{ userInfo.usrName || '' }}
+              {{ userInfo.usrName || '点击登录' }}
             </view>
             <view>
               {{ userInfo.tel || '' }}
@@ -19,33 +18,82 @@
         </view>
 
         <view class="ctl-panel">
-
+          <u-grid
+              :border="false"
+              :col="3"
+          >
+            <u-grid-item
+                v-for="(baseListItem,baseListIndex) in baseList"
+                :key="baseListIndex"
+                @click="$u.throttle(()=>onItemClick(baseListItem), 500)"
+            >
+              <view class="grid-item-icon" :style="[baseListItem.style]">
+                <image :src="baseListItem.icon"></image>
+              </view>
+              <text class="grid-text">{{ baseListItem.title }}</text>
+            </u-grid-item>
+          </u-grid>
         </view>
       </view>
     </view>
-  </auth-wrap>
 </template>
 
 <script>
 
+import { fetchViewCfgList } from '@/common/api';
+import { COMP_CODE } from '@/common/EnumConst';
 import AuthWrap from '@/components/AuthComp/index.vue';
-import { getUserInfo } from '@/util';
+import { authLogin, getImageUrl, getUserInfo } from '@/util';
 
 export default {
   components: { AuthWrap },
   data() {
     return {
       userInfo: {},
+      baseList: [],
       src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
     };
   },
   onLoad() {
   },
   onShow() {
-    this.$refs.authWrap.reloadPage();
     this.userInfo = getUserInfo();
+    this.viewCfg();
+  },
+  methods: {
+    onHeadClick() {
+      if (this.userInfo) {
+        return;
+      }
+      authLogin(() => {
+        this.userInfo = getUserInfo();
+      });
+    },
+    onItemClick(item) {
+      if (item.url) {
+        uni.navigateTo({
+          url: item.url,
+        });
+      }
+    },
+    async viewCfg() {
+      const res = await fetchViewCfgList({
+        pageNum: 1,
+        pageSize: 99,
+        compCode: COMP_CODE.my,
+      });
+      if (res.rows.length > 0) {
+        this.baseList = res.rows.map(item => {
+          return {
+            icon: getImageUrl(item.iconUri),
+            style: JSON.parse(item.style),
+            title: item.labelTxt,
+            url: item.url,
+          };
+        });
+      }
+    },
   },
-  methods: {},
   onShareAppMessage() {
     return {
       title: 'First UI组件库',

+ 1 - 0
pasb/pages/login/index.vue

@@ -62,6 +62,7 @@ export default {
           data,
         } = await syncWxlogin({
           tel: this.tel,
+          ...this.userInfo,
         });
         if (success) {
           // 将用户信息和session存储到本地

+ 15 - 7
pasb/pages/regist/index.vue

@@ -110,11 +110,11 @@
 
 <script>
 
-import { fetchEnterpriseList, fetchEnterpriseTripList, putUsrRegist } from '@/common/api';
+import { fetchEnterpriseList, fetchEnterpriseTripList, fetchUsrInfo, putUsrRegist } from '@/common/api';
 import { ICON_CFG } from '@/common/EnumConst';
 import AuthWrap from '@/components/AuthComp/index.vue';
 import SingleDropList from '@/components/SingleDropList/index.vue';
-import { getImageUrl, getUserInfo } from '@/util';
+import { getImageUrl, getUserInfo, setUserInfo } from '@/util';
 
 export default {
   name: 'login',
@@ -223,15 +223,23 @@ export default {
     },
     onSubmit() {
       this.loading = true;
-      this.$refs.uForm.validate().then(res => {
-        putUsrRegist(this.model1.userInfo);
+      this.$refs.uForm.validate().then(async (res) => {
+        await putUsrRegist(this.model1.userInfo);
         this.loading = false;
         uni.showToast({
+          mask: true,
           title: '报名完成',
           icon: 'success',
-        });
-        uni.navigateBack({
-          delta: 1,
+          success: async () => {
+            const user = getUserInfo();
+            const newUsr = await fetchUsrInfo(user.id);
+            if (newUsr.code === 200) {
+              setUserInfo(newUsr.data);
+            }
+            uni.navigateBack({
+              delta: 1,
+            });
+          },
         });
       }).catch(errors => {
         this.loading = false;

+ 3 - 42
util/index.js

@@ -65,6 +65,9 @@ export const getUserInfo = () => {
   return userInfo;
 };
 
+export const setUserInfo = (userInfo) => {
+  setStorageObj('userInfo', userInfo);
+};
 export const getToken = () => {
   const token = getStorageObj('token');
   if (!token) {
@@ -134,48 +137,6 @@ export const syncWxlogin = (userInfo = {}) => {
     });
   });
 };
-export const wxlogin = (callback) => {
-  uni.login({
-    provider: 'weixin',
-    success: (loginRes) => {
-      // 登录成功,获取用户code
-      const { code } = loginRes;
-      // 发送code到后台换取openId, sessionKey, unionId
-      uni.request({
-        url: `${process.env.UNI_API_PREFIX}/cp/usr/wx/login`, // 你的登录API地址
-        method: 'POST',
-        data: {
-          code,
-          ...this.userInfo,
-        },
-        success: (res) => {
-          if (res.data && res.data.code === 200) {
-            const { data } = res.data;
-            callback(data);
-          } else {
-            uni.showToast({
-              title: '登录失败',
-              icon: 'none',
-            });
-          }
-        },
-        fail: () => {
-          uni.showToast({
-            title: '请求失败',
-            icon: 'none',
-          });
-        },
-      });
-    },
-    fail: (err) => {
-      console.log('uni.login 接口调用失败,将无法正常使用开放接口等服务', err);
-      uni.showToast({
-        title: '登录失败',
-        icon: 'none',
-      });
-    },
-  });
-};
 
 export const fileIcon = (fileSuffix) => {
   let icon = '';