jwyu 3 years ago
parent
commit
301ca4577d

+ 1 - 0
App.vue

@@ -3,6 +3,7 @@
 		onLaunch: function() {
 			console.log('App Launch')
 			this.$store.dispatch('getUserInfo')
+			this.$store.dispatch('getTabBar')
 		},
 		onShow: function() {
 			console.log('App Show')

+ 1 - 0
README.md

@@ -5,5 +5,6 @@
   3. 该项目大图请放在oss中,在utils/config中配置,已使用全局mixin将图片挂在data中
   4. 分包请按照‘pages-分包模块名’命名
   5. 所有接口请用 api 开头
+  6. 不可将会动态显示的tabbar项放在pages.json配置为启动页,如需改变tabbar 请调用this.$store.dispatch('getTabBar')
 
 	

+ 48 - 8
api/activity.js

@@ -1,6 +1,6 @@
 // 活动模块
 
-import {httpGet,httpPost} from "@/utils/request.js"
+import { httpGet, httpPost } from "@/utils/request.js";
 
 /**
  * 活动列表
@@ -10,14 +10,54 @@ import {httpGet,httpPost} from "@/utils/request.js"
  * @param page
  * @param limit
  */
-export const apiActivityList=params=>{
-    return httpGet('/activity/getPageList',params)
-}
+export const apiActivityList = (params) => {
+    return httpGet("/activity/getPageList", params);
+};
 
 /**
  * 活动详情
- * @param activity_id 
+ * @param activity_id
  */
-export const apiActivityDetail=params=>{
-    return httpGet('/activity/getActivityDetail',params)
-}
+export const apiActivityDetail = (params) => {
+    return httpGet("/activity/getActivityDetail", params);
+};
+
+/**
+ * 活动设置提醒
+ * @param activity_id
+ */
+export const apiActivityAddRemind = (params) => {
+    return httpPost("/activity/addRemind", params);
+};
+
+/**
+ * 活动取消提醒
+ * @param activity_id
+ */
+export const apiActivityCancelRemind = (params) => {
+    return httpPost("/activity/cancelRemind", params);
+};
+
+/**
+ * 活动线下报名
+ * @param activity_id
+ */
+export const apiActivityRegister = (params) => {
+    return httpPost("/activity/registerActivity", params);
+};
+
+/**
+ * 活动取消线下报名
+ * @param activity_id
+ */
+export const apiActivityCancelRegister = (params) => {
+    return httpPost("/activity/cancelRegister", params);
+};
+
+/**
+ * 获取活动音频
+ * @param activity_id
+ */
+export const apiActivityAudios=params=>{
+    return httpGet('/activity/getActivityVoices',params)
+}

+ 7 - 0
api/user.js

@@ -9,6 +9,13 @@ export const apiWechatLogin=params=>{
 	return httpGet('/wechat/login',params)
 }
 
+/**
+ * 获取用户tabbar权限
+ */
+export const apiUserTabBar=()=>{
+	return httpGet('/user/get_tab_bar',{})
+}
+
 /**
  * 获取个人信息
  */

+ 15 - 42
custom-tab-bar/index.js

@@ -1,55 +1,28 @@
+
 Component({
   data: {
-    selected: 'pages/buy/buy',
+    selected: '',
     color: "#1F243A",
     selectedColor: "#E3B377",
-    list: [
-      {
-        pagePath: "pages/buy/buy",
-        text: "已购",
-        iconPath: "../static/tabbar/buy.png",
-        selectedIconPath: "../static/tabbar/buy-s.png",
-        hidden: false,
-      },
-      {
-        pagePath: "pages/report/report",
-        text: "报告",
-        iconPath: "../static/tabbar/report.png",
-        selectedIconPath: "../static/tabbar/report-s.png",
-        hidden: false,
-      },
-      {
-        pagePath: "pages/chart/chart",
-        text: "图库",
-        iconPath: "../static/tabbar/chart.png",
-        selectedIconPath: "../static/tabbar/chart-s.png",
-        hidden: false,
-      },
-      {
-        pagePath: "pages/activity/activity",
-        text: "活动",
-        iconPath: "../static/tabbar/activity.png",
-        selectedIconPath: "../static/tabbar/activity-s.png",
-        hidden: false,
-      },
-      {
-        pagePath: "pages/user/user",
-        text: "我的",
-        iconPath: "../static/tabbar/user.png",
-        selectedIconPath: "../static/tabbar/user-s.png",
-        hidden: false,
-      },
-    ],
+    list: [],
+  },
+  lifetimes: {
+    // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+    attached: function () {},
+    moved: function () { },
+    detached: function () { },
+  },
+  pageLifetimes: {
+    // 组件所在页面的生命周期函数
+    show: function () { },
+    hide: function () { },
+    resize: function () { },
   },
-  attached() {},
   methods: {
     switchTab(e) {
       const data = e.currentTarget.dataset;
       const url = "/" + data.path;
       wx.switchTab({ url });
-      // this.setData({
-      //   selected: data.text,
-      // });
     },
   },
 });

+ 46 - 14
mixin/index.js

@@ -3,9 +3,32 @@ moment.locale('zh-cn');
 
 // 引入全局配置的图片资源地址 
 import {globalImgUrls} from "../utils/config"
-
+import store from '@/store'
 
 module.exports = {
+  watch: {
+    tabbar(){
+      const page = this.$mp.page;
+      if( page&&(page.route==='pages/buy/buy'||
+          page.route=='pages/report/report'||
+          page.route=='pages/chart/chart'||
+          page.route=='pages/activity/activity'||
+          page.route=='pages/user/user')
+      ){
+        if (page&&typeof page.getTabBar === "function" && page.getTabBar()){;
+          page.getTabBar().setData({
+            list: this.tabbar,
+            selected:this.tabbar[0].pagePath
+          });
+        }
+      }
+    }
+  },
+  computed: {
+    tabbar(){
+      return store.state.user.tabbarList
+    }
+  },
   filters: {
     /**
      * 活动时间格式化
@@ -28,21 +51,30 @@ module.exports = {
     };
   },
   onLoad() {
-    const page = this.$mp.page;
-    if( page.route==='pages/buy/buy'||
-        page.route=='pages/report/report'||
-        page.route=='pages/chart/chart'||
-        page.route=='pages/activity/activity'||
-        page.route=='pages/user/user'
-    )
-    if (typeof page.getTabBar === "function" && page.getTabBar()) {
-      page.getTabBar().setData({
-        selected: page.route,
-      });
-    }
+    this.handleSetTabBarItem()
   },
   onShow(){
     this.userInfo=this.$store.state.user.userInfo
   },
-  methods: {},
+  methods: {
+    // 设置tabbar的选中态
+    handleSetTabBarItem(){
+      const page = this.$mp.page;
+      const tabbarList=this.$store.state.user.tabbarList
+      if( page.route==='pages/buy/buy'||
+          page.route=='pages/report/report'||
+          page.route=='pages/chart/chart'||
+          page.route=='pages/activity/activity'||
+          page.route=='pages/user/user'
+      ){
+        if (page&&typeof page.getTabBar === "function" && page.getTabBar()) {
+          page.getTabBar().setData({
+            selected: page.route,
+            list:tabbarList
+          });
+        }
+      }
+      
+    }
+  },
 };

+ 128 - 37
pages-activity/detail.vue

@@ -1,29 +1,44 @@
 <template>
-  <view class="activity-detail">
-        <view class="top-wrap">
-            <view class="status status-before">进行中</view>
-            <view class="title">织造终端双周报</view>
-            <view class="name">主讲人:某某</view>
-            <view class="time">活动时间:2020-06-04 15:30-16:30 星期一</view>
+  <view class="activity-detail" v-if="info">
+        <view class="top-wrap" :style="'background-image:url('+info.speakerBackgroundPic+')'">
+            <view class="status status-before" v-if="info.activityState===1">未开始</view>
+            <view class="status status-before" v-if="info.activityState===2">进行中</view>
+            <view class="status status-before" v-if="info.activityState===3">已结束</view>
+            <view class="title">{{info.activityTypeName}}</view>
+            <view class="name">主讲人:{{info.speaker}}</view>
+            <view class="time">活动时间:{{info.startTime| formatActivityTime(info.endTime)}}</view>
+            <view class="flex city" v-if="info.activityTypeId===3">
+              <image src="./static/position.png" model="aspectFill"></image>
+              <text>{{info.city}}</text>
+            </view>
         </view>
-        <view class="intro-wrap">能源紧缺拉涨成本,坯布局部供应紧张</view>
-        <view class="info-wrap">
-            <view class="flex item" v-for="item in infoList" :key="item.label">
+        <view class="intro-wrap">{{info.activityName}}</view>
+
+        <view class="info-wrap" v-if="info.activityState!==3">
+            <view class="flex item" v-for="item in infoList" :key="item.label" @click="handleClickInfoItem(item)">
                 <view class="label">{{item.label}}:</view>
                 <view :class="['content',item.color&&'yellow-color']">{{item.text}}</view>
             </view>
         </view>
-        <view class="audio-wrap">
-            <view class="audio-item" v-for="item in 4" :key="item">
+
+        <!-- 音频 -->
+        <view class="audio-wrap" v-if="info.activityState===3">
+            <view class="audio-item" v-for="item in audioList" :key="item.voiceUrl">
                 <image class="icon" src="./static/audio-play.png" model="aspectFill"></image>
-                <view class="name">音频123.MP3</view>
-                <view class="time">
-                    <text>05分30秒</text>
-                    <text>| 已听完</text>
-                </view>
+                <view class="name">{{item.voiceName}}</view>
+                <view class="time">{{item.voicePlaySeconds}}</view>
             </view>
         </view>
-        <view class="btn-wrap">
+
+        <!-- 报告链接 -->
+        <view class="info-wrap" v-if="info.reportLink">
+          <view class="flex item" @click="handleOpenReport">
+              <view class="label">相关报告:</view>
+              <view class="yellow-color">查看报告链接</view>
+          </view>
+        </view>
+
+        <view class="btn-wrap" v-if="info.activityState===1">
             <view class="global-btn-yellow-change btn">报名线下参会(15/20)</view>
             <view class="global-btn-yellow-change btn">会议提醒</view>
             <p class="tips">(会前15分钟推送微信消息提醒)</p>
@@ -33,27 +48,15 @@
 
 <script>
 // 活动详情
-import {apiActivityDetail} from '@/api/activity'
+import {apiActivityDetail,apiActivityAudios} from '@/api/activity'
 export default {
   name: "ActivityDetail",
   data() {
     return {
       id: 0, //活动id
-      infoList:[
-          {
-              label:'活动时间',
-              text:'2021-10-18 16:30-17:00 星期一2021-10-18 16:30-17:00 星期一',
-          },
-          {
-              label:'主讲人',
-              text:'某某',
-          },
-          {
-              label:'大陆拨号',
-              text:'021-34994556',
-              color:'yellow'
-          },
-      ]
+      infoList:[],
+      info:null,
+      audioList:[],//音频数据
     };
   },
   onLoad(options) {
@@ -68,9 +71,82 @@ export default {
   methods: {
     async getDetail(){
       const res=await apiActivityDetail({activity_id:Number(this.id)})
+      // 无权限
+      if(res.code===403){
+
+        return
+      }
+      if(res.code===200){
+        this.info=res.data
+
+        // 线上会议
+        if(res.data.activityTypeId===1){
+          this.infoList=[
+            {
+              label:'大陆拨号',
+              text:res.data.mainlandTel,
+              color:'yellow',
+              type:'tel'
+            },
+            {
+              label:'新加坡拨入',
+              text:res.data.singaporeTel,
+              color:'yellow',
+              type:'tel'
+            },
+            {
+              label:'香港拨入',
+              text:res.data.hongKongTel,
+              color:'yellow',
+              type:'tel'
+            },
+            {
+              label:'台湾拨入',
+              text:res.data.taiwanTel,
+              color:'yellow',
+              type:'tel'
+            },
+            {
+              label:'美国拨入',
+              text:res.data.americaTel,
+              color:'yellow',
+              type:'tel'
+            },
+            {
+              label:'拨入密码',
+              text:res.data.participationCode
+            },
+          ]
+        }
+
+        if(res.data.activityState===3){
+          this.getAudios()
+        }
+      }
+    },
+
+    // 获取活动音频
+    async getAudios(){
+      const res=await apiActivityAudios({activity_id:Number(this.id)})
       if(res.code===200){
-        
+        this.audioList=res.data
+      }
+    },
+
+    // 点击信息项
+    handleClickInfoItem(e){
+      if(e.type==='tel'&&e.text){
+        uni.makePhoneCall({
+            phoneNumber: e.text 
+        });
       }
+    },
+
+    // 跳转webview 打开报告
+    handleOpenReport(){
+      uni.navigateTo({
+        url:'/pages/webView?url='+this.info.reportLink
+      })
     }
   }
 };
@@ -81,10 +157,13 @@ export default {
   width: 100%;
   height: 370rpx;
   background: linear-gradient(312deg, rgba(0, 0, 0, 0.8) 0%, rgba(43, 43, 43, 0.8) 100%);
-  color: $global-text-color-main;
+  color: $global-text-color-white;
   padding-top: 144rpx;
   padding-left: 40rpx;
   padding-right: 40rpx;
+  background-size: cover;
+  background-repeat: no-repeat;
+  position: relative;
   .status {
     position: absolute;
     top: 0;
@@ -117,12 +196,24 @@ export default {
     opacity: 0.8;
     font-size: $global-font-size-sm;
   }
+  .city{
+    font-size: $global-font-size-sm;
+    align-items: center;
+    position: absolute;
+    right: 40rpx;
+    bottom: 59rpx;
+    image{
+      width: 32rpx;
+      height: 32rpx;
+    }
+  }
 }
 .intro-wrap{
-    background-color: $global-bg-color-grey;
+    background-color: #fff;
+    box-shadow: 0px 3px 12px rgba(196, 196, 196, 0.16);
     font-size: $global-font-size-lg;
     font-weight: bold;
-    padding: 14rpx 34rpx;
+    padding: 28rpx 34rpx;
 }
 .info-wrap{
     padding: 30rpx 34rpx;

+ 1 - 1
pages-activity/noAuthority.vue

@@ -16,7 +16,7 @@ export default {
             
         }
     },
-    onLoad(){
+    onLoad(options){
     },
     methods: {
         handleGoApply(){

BIN
pages-activity/static/audio-doing.png


BIN
pages-activity/static/audio-play.png


BIN
pages-activity/static/position.png


+ 7 - 4
pages.json

@@ -1,15 +1,15 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/buy/buy",
+			"path": "pages/report/report",
 			"style": {
-				"navigationBarTitleText": "已购"
+				"navigationBarTitleText": "报告"
 			}
 		},
 		{
-			"path": "pages/report/report",
+			"path": "pages/buy/buy",
 			"style": {
-				"navigationBarTitleText": "报告"
+				"navigationBarTitleText": "已购"
 			}
 		},
 		{
@@ -36,6 +36,9 @@
 			"style":{
 				"navigationBarTitleText":"绑定联系方式"
 			}
+		},
+		{
+			"path":"pages/webView"
 		}
 	],
 	"subPackages":[

+ 131 - 12
pages/activity/activity.vue

@@ -1,7 +1,7 @@
 <template>
     <view class="activity-page">
         <van-sticky style="background: #fff">
-            <view class="search-wrap">
+            <!-- <view class="search-wrap">
                 <van-search 
                     shape="round" 
                     :value="searchVal" 
@@ -10,7 +10,7 @@
                     @search="onSearch" 
                     @clear="onClearSearch" 
                 />
-            </view>
+            </view> -->
             <view class="flex tabs-wrap" @click="tabChange">
                 <view
                     :class="['tab-item', tabActive === '1' && 'tab-active']"
@@ -49,20 +49,22 @@
         <view class="list" v-if="list.length > 0">
             <view
                 class="global-list-card item"
-                v-for="item in list"
+                v-for="(item,index) in list"
                 :key="item.activityId"
                 @click="handleGoDetail(item.activityId)"
             >
-                <view class="status-box status-before">未开始</view>
+                <view class="status-box status-before" v-if="item.activityState===1">未开始</view>
+                <view class="status-box status-progress" v-if="item.activityState===2">进行中</view>
+                <view class="status-box status-end" v-if="item.activityState===3">已结束</view>
                 <view class="flex top">
-                    <image class="avatar" :src="item.img" mode="aspectFill"></image>
+                    <image class="avatar" :src="item.speakerHeadPic" mode="aspectFill"></image>
                     <view class="content">
                         <view class="flex icon-box">
-                            <template v-if="item.city">
+                            <template v-if="item.activityTypeId===3&&item.city">
                                 <image src='../../static/position.png'></image>
                                 <text>{{item.city}}</text>
                             </template>
-                            <template v-if="item.hasPlayBack">
+                            <template v-if="item.activityTypeId===1&&item.hasPlayBack">
                                 <image src='../../static/hf.png'></image>
                                 <text>回放</text>
                             </template>
@@ -72,18 +74,47 @@
                         <view class="time">时间:{{ item.startTime | formatActivityTime(item.endTime) }}</view>
                     </view>
                 </view>
-                <view class="flex bot">
-                    <view>会议提醒</view>
-                    <view>报名线下参会</view>
+                <view class="flex bot" v-if="item.activityState===1">
+                    <view 
+                        :class="!item.hasRemind&&'active'"
+                        @click.stop="handleRemind(item,index)"
+                    >
+                        {{item.hasRemind?'取消提醒':'会议提醒'}}
+                    </view>
+                    <view 
+                        :class="!item.registerState&&'active'" 
+                        v-if="item.activityTypeId===3"
+                        @click.stop="handleRegister(item,index)"
+                    >
+                        {{item.registerState?'取消线下报名':'报名线下参会'}}
+                    </view>
                 </view>
             </view>
         </view>
         <van-empty description="暂无数据" v-else />
+
+        <!-- 弹窗 -->
+        <van-popup :show="show" @close="show=false">
+            <view class="global-pup">
+                <view class="content">
+                    <rich-text :nodes="pupContent"></rich-text>
+                </view>
+                <view class="flex bot">
+                    <view @click="show=false">知道了</view>
+                </view>
+            </view>
+        </van-popup>
     </view>
 </template>
 
 <script>
-import { apiActivityList } from '@/api/activity'
+import { 
+    apiActivityList,
+    apiActivityAddRemind,
+    apiActivityCancelRemind, 
+    apiActivityRegister,
+    apiActivityCancelRegister
+} from '@/api/activity'
 export default {
     data() {
         return {
@@ -95,6 +126,9 @@ export default {
             pageSize: 20,
             list: [],
             finished: false,
+
+            show:false,
+            pupContent:'',//弹窗html字符串
         }
     },
     onLoad() {
@@ -180,7 +214,88 @@ export default {
                   this.finished=true
                 }
             }
+        },
+
+        handleRemind(e,index){    
+            if(e.hasRemind===0){
+                this.handleAddRemind(e,index)
+            }else{
+                this.handleCancelRemind(e,index)
+            }
+        },
+
+        // 添加提醒
+        async handleAddRemind(e,index){
+            const res=await apiActivityAddRemind({activity_id:Number(e.activityId)})
+            if(res.code===200){
+                this.pupContent=`<p style="margin-bottom:10px">设置成功,会前15分钟会为您推送微信消息提醒</p>
+                                 <p>请关注【弘则研究】公众号,以获取微信消息提醒</p>`
+                this.show=true
+                this.handleUpateRemindStatus(index)
+            }
+        },
+
+        //取消提醒
+        async handleCancelRemind(e,index){
+            const res=await apiActivityCancelRemind({activity_id:Number(e.activityId)})
+            if(res.code===200){
+                uni.showToast({
+                    title:"取消提醒成功",
+                    icon:"none"
+                })
+                this.handleUpateRemindStatus(index)
+            }
+        },
+
+        //更新列表中某项的设置提醒状态
+        handleUpateRemindStatus(index){
+            if(this.list[index].hasRemind===0){
+                this.list[index].hasRemind=1
+            }else{
+                this.list[index].hasRemind=0
+            }
+        },
+
+        handleRegister(e,index){
+            if(e.registerState===0){
+                this.handleAddRegister(e,index)
+            }else{
+                this.handleCancelRegister(e,index)
+            }
+        },
+
+        // 线下报名
+        async handleAddRegister(e,index){
+            const res=await apiActivityRegister({activity_id:Number(e.activityId)})
+            if(res.code===200){
+                this.pupContent=`<p style="margin-bottom:10px">报名成功,已加入您的活动日程</p>
+                                 <p>想要及时获取活动时间变更通知,请关注【弘则研究】公众号</p>`
+                this.show=true
+                this.handleUpdateRegister(index)
+            }
+        },
+
+        //取消线下报名
+        async handleCancelRegister(e,index){
+            const res=await apiActivityCancelRegister({activity_id:Number(e.activityId)})
+            if(res.code===200){
+                uni.showToast({
+                    title:"取消报名成功",
+                    icon:"none"
+                })
+                this.handleUpdateRegister(index)
+            }
+        },
+
+        // 更新报名状态
+        handleUpdateRegister(index){
+            if(this.list[index].registerState===0){
+                this.list[index].registerState=1
+            }else{
+                this.list[index].registerState=0
+            }
         }
+
     }
 }
 </script>
@@ -269,7 +384,7 @@ export default {
                 font-size: $global-font-size-lg;
                 font-weight: bold;
                 width: 420rpx;
-                padding-right: 130rpx;
+                padding-right: 80rpx;
                 padding-bottom: 10rpx;
                 border-bottom: 1px solid $global-border-color;
             }
@@ -284,6 +399,7 @@ export default {
         }
         .bot {
             border-top: 1px solid $global-border-color;
+            color: $global-text-color-999;
             view {
                 line-height: 72rpx;
                 flex: 1;
@@ -293,6 +409,9 @@ export default {
             view:last-child {
                 border: none;
             }
+            .active{
+                color: #E3B377;
+            }
         }
         .content{
             width: 420rpx;

+ 31 - 3
pages/user/user.vue

@@ -6,7 +6,7 @@
 			</view>
 			<view>
 				<view style="margin-top:6px;margin-bottom:18px">手机号:{{userInfo.mobile}}</view>
-				<view>姓名:{{userInfo.real_name}}</view>
+				<view>姓名:{{userInfo.real_name||'--'}}</view>
 			</view>
 		</view>
 		<view class="main-info-wrap">
@@ -14,7 +14,7 @@
 			<view class="info-list">
 				<view class="flex item">
 					<text class="label">公司名称:</text>
-					<text>{{userInfo.company_name}}</text>
+					<text>{{userInfo.company_name||'--'}}</text>
 				</view>
 				<view class="flex item">
 					<text class="label">品种权限:</text>
@@ -22,16 +22,40 @@
 						<text>暂无权限</text>
 						<van-button custom-class="apply-btn" plain round color="#DDAA6A" size="small" @click="handleGoApplyPermission">立即申请</van-button>
 					</template>
+					<view>{{permissionList}}</view>
 				</view>
 			</view>
-			<view class="tips" v-if="userInfo.permission_list.length!=0">服务截止日期:2022.11.11</view>
+			<view class="tips" v-if="userInfo.permission_list.length!=0">服务截止日期:{{lastTime}}</view>
 		</view>
 	</view>
 </template>
 
 <script>
+	const moment=require('@/utils/moment-with-locales.min')
 	import {apiLastApplyRecord} from '@/api/user'
 	export default {
+		computed: {
+			permissionList(){
+				let arr=[]
+				let timeArr=[]
+				this.userInfo.permission_list&&this.userInfo.permission_list.forEach(item=>{
+					item.permission_list.forEach(item2=>{
+						arr.push(item2.name)
+						timeArr.push(new Date(item2.end_date))
+					})
+				})
+
+				let maxTime=Math.max(...timeArr)
+				this.lastTime=moment(maxTime).format('YYYY.MM.DD')
+
+				return arr.join('、')
+			}	
+		},
+		data () {
+			return {
+				lastTime:""		
+			}
+		},
 		methods: {
 			async handleGoApplyPermission(){
 				const res=await apiLastApplyRecord()
@@ -88,12 +112,16 @@
 		.tips{
 			font-size: $global-font-size-sm;
 			color: $global-text-color-999;
+			margin-top: 20rpx;
 		}
 	}
 	.info-list{
 		min-height: 300rpx;
 		.item{
 			margin-top: 40rpx;
+			.label{
+				flex-shrink: 0;
+			}
 			.apply-btn{
 				font-size: $global-font-size-sm;
 				height: 48rpx;

+ 20 - 0
pages/webView.vue

@@ -0,0 +1,20 @@
+<template>
+  <web-view :src="url"></web-view>
+</template>
+
+<script>
+export default {
+    data () {
+        return {
+            url:""
+        }
+    },
+    onLoad(options){
+        this.url=options.url
+    }
+}
+</script>
+
+<style>
+
+</style>

+ 76 - 20
store/modules/user.js

@@ -1,32 +1,88 @@
-import {apiUserInfo} from '@/api/user'
+import { apiUserInfo, apiUserTabBar } from "@/api/user";
 
+const token = uni.getStorageSync("token") || "";
+const userModules = {
+	state: {
+		token: token,
+		userInfo: {},
 
-const token=uni.getStorageSync('token')||''
-const userModules={
-	state:{
-		token:token,
-		userInfo:{}
+		tabbarList: [], //用户的tabbar
 	},
 	mutations: {
 		// 设置token
-		setToken(state,data){
-			state.token=data
-			uni.setStorageSync('token', data);
+		setToken(state, data) {
+			state.token = data;
+			uni.setStorageSync("token", data);
 		},
 
 		// 设置个人信息
-		setUserInfo(state,data){
-			state.userInfo=data
-		}
+		setUserInfo(state, data) {
+			state.userInfo = data;
+		},
+
+		// 设置tabbar权限
+		setTabBar(state, data) {
+			// 默认的tabbar数据
+			let defaultTabBarList = [
+				{
+					key: "report",
+					pagePath: "pages/report/report",
+					text: "报告",
+					iconPath: "../static/tabbar/report.png",
+					selectedIconPath: "../static/tabbar/report-s.png",
+				},
+				{
+					key: "buy",
+					pagePath: "pages/buy/buy",
+					text: "已购",
+					iconPath: "../static/tabbar/buy.png",
+					selectedIconPath: "../static/tabbar/buy-s.png",
+				},
+				{
+					key: "chart",
+					pagePath: "pages/chart/chart",
+					text: "图库",
+					iconPath: "../static/tabbar/chart.png",
+					selectedIconPath: "../static/tabbar/chart-s.png",
+				},
+				{
+					key: "activity",
+					pagePath: "pages/activity/activity",
+					text: "活动",
+					iconPath: "../static/tabbar/activity.png",
+					selectedIconPath: "../static/tabbar/activity-s.png",
+				},
+				{
+					key: "user",
+					pagePath: "pages/user/user",
+					text: "我的",
+					iconPath: "../static/tabbar/user.png",
+					selectedIconPath: "../static/tabbar/user-s.png",
+				},
+			];
+			let arr=defaultTabBarList.filter(item=>{
+				if(data.some(e=>e===item.key)){
+					return item
+				}
+			})
+			state.tabbarList=arr
+		},
 	},
 	actions: {
 		// 获取个人信息
-		async getUserInfo(context){
-			const res=await apiUserInfo()
-			if(res.code===200){
-				context.commit('setUserInfo',res.data)
+		async getUserInfo(context) {
+			const res = await apiUserInfo();
+			if (res.code === 200) {
+				context.commit("setUserInfo", res.data);
+			}
+		},
+
+		async getTabBar(context) {
+			const res = await apiUserTabBar();
+			if (res.code === 200) {
+				context.commit("setTabBar", res.data);
 			}
-		}
-	}
-}
-export default userModules
+		},
+	},
+};
+export default userModules;

+ 25 - 0
style/common.scss

@@ -44,4 +44,29 @@ view{
     background-color: #E6E6E6;
     border-radius: 35rpx;
     line-height: 70rpx;
+}
+
+/* 公共弹窗 */
+.global-pup{
+    background-color: #fff;
+    width: 90vw;
+    min-height: 100rpx;
+    font-size: $global-font-size-lg;
+    .content{
+        padding: 34rpx;
+        text-align: center;
+    }
+    .bot{
+        border-top: 1px solid $global-border-color;
+        view{
+            line-height: 96rpx;
+            flex: 1;
+            text-align: center;
+            border-right: 1px solid $global-border-color;
+            color:$global-text-color-main;
+        }
+        view:last-child {
+            border: none;
+        }
+    }
 }

+ 3 - 6
utils/request.js

@@ -5,12 +5,12 @@ import store from '@/store/index'
 // 请求错误消息提示
 const showError=error=>{
 	let errMsg=''
-	switch(error.Ret){
+	switch(error.code){
 		case 400:
-			errMsg='请求参数错误';
+			errMsg=error.msg;
 			break;
 		default:
-			errMsg=error.ErrMsg;
+			errMsg=error.msg;
 			break;
 	}
 	uni.showToast({
@@ -96,9 +96,6 @@ const http=(url,params,method)=>{
 					refreshToken(url,params,method,resolve)
 					return 
 				}
-
-				// 无权限
-				
 				
 				resolve(res.data)
 			},