xvying 2 år sedan
förälder
incheckning
0fd1a7251c

+ 0 - 2
common/http.interceptor.js

@@ -5,11 +5,9 @@
 
 const install = (Vue, vm) => {
 	Vue.prototype.$u.http.setConfig({
-
 		// baseUrl: 'http://mt.mentor.site.ximengnaikang.com/api',
 		baseUrl: '/api',
 		// baseUrl:'https://bcsyds.hactcm.edu.cn/api',
-
 		originalData: true,
 		dataType: 'json',
 		showLoading: true, // 是否显示请求中的loading

+ 38 - 0
common/public.js

@@ -0,0 +1,38 @@
+export default {
+	//匹配权限
+	// transformAuth(code) {
+	// 	let codeList = this.vuex_permissions
+	// 	let index = codeList.indexOf(code)
+	// 	if (index == -1) return false
+	// 	else return true
+	// },
+	//匹配权限
+	  transformAuth(code) {
+	    let codeList = this.vuex_permissions;
+	    let index = codeList.indexOf(code)
+	    let index1 = codeList.indexOf('*')
+	    if (index1 !== -1) return true
+	
+	    if (index == -1) return false
+	    else return true
+	  },
+	//转换日期
+	transformWeek(week) {
+		switch (week) {
+			case 0:
+				return '一'
+			case 1:
+				return '二'
+			case 2:
+				return '三'
+			case 3:
+				return '四'
+			case 4:
+				return '五'
+			case 5:
+				return '六'
+			case 6:
+				return '日'
+		}
+	},
+}

+ 167 - 0
components/tabbar.vue

@@ -0,0 +1,167 @@
+<template>
+	<view class="tabbar">
+		<view :class="['item',current == 0?'active':'']" @click="currentTab(0)">
+			<image v-if="current==0" src="../static/images/home-fill.png" mode=""></image>
+			<image v-else src="../static/images/home.png" mode=""></image>
+			<view class="name">
+				首页
+			</view>
+		</view>
+		<view v-if="$transformAuth('100202')" :class="['item',current == 1?'active':'']" @click="currentTab(1)">
+			<image v-if="current==1" src="../static/images/scheduling-fill.png" mode=""></image>
+			<image v-else src="../static/images/scheduling.png" mode=""></image>
+			<view class="name">
+				工作
+			</view>
+		</view>
+		<view v-if="$transformAuth('101100')"  :class="['item',current == 2?'active':'']" @click="currentTab(2)">
+			<image v-if="current==2" src="../static/images/student-fill.png" mode=""></image>
+			<image v-else src="../static/images/student.png" mode=""></image>
+			<view class="name">
+				学生
+			</view>
+		</view>
+		<view  :class="['item',current == 3?'active':'']" @click="currentTab(3)">
+			<image v-if="current==3" src="../static/images/active-fill.png" mode=""></image>
+			<image v-else src="../static/images/active.png" mode=""></image>
+			<view class="name">
+				活动
+			</view>
+		</view>
+		<view :class="['item',current == 4?'active':'']" @click="currentTab(4)">
+			<image v-if="current==4" src="../static/images/mine-fill.png" mode=""></image>
+			<image v-else src="../static/images/mine.png" mode=""></image>
+			<view class="name">
+				我的
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: "tabbar",
+		props: {
+			current: {
+				type: Number,
+				default: 5
+			}
+		},
+
+		data() {
+			return {
+				// current: ''
+				roles: [],
+				is_monitor: false,
+				is_polling: false,
+				is_admin: false,
+
+			};
+		},
+		watch: {
+			current() {
+				console.log('opopopopop')
+			},
+		},
+		onShow() {
+
+		},
+		created() {
+			let status = false
+			let roles = this.$store.state.vuex_user.roles
+			let arr = []
+			roles.map(item => {
+				arr.push(item.name)
+			})
+			let index = arr.indexOf('polling')
+			if (index >= 0) this.is_polling = true
+			let index2 = arr.indexOf('monitor')
+			if (index2 >= 0) this.is_monitor = true
+			let index3 = arr.indexOf('admin')
+			if (index3 >= 0) this.is_admin = true
+			console.log(index, index2, index3, 'opopop')
+		},
+		methods: {
+
+			currentTab(index) {
+				console.log(index, 'opopopo')
+				// this.current = index
+				if (index == 0) {
+					uni.reLaunch({
+						url: '/pages/index/index'
+					})
+				} else if (index == 1) {
+					console.log(index, 'opopop')
+					uni.reLaunch({
+						url: '/pages/scheduling/index'
+					})
+				} else if (index == 2) {
+					uni.reLaunch({
+						url: '/pages/student/index_new'
+					})
+				}
+				else if (index == 3) {
+					uni.reLaunch({
+						url: '/pages/activity/index'
+					})
+				}
+				else if (index == 4) {
+					uni.reLaunch({
+						url: '/pages/mine/index'
+					})
+				}
+				
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.tabbar {
+		height: 60px;
+		padding: 5px 0;
+		width: 100%;
+		background-color: #fff;
+		display: flex;
+		align-items: center;
+		justify-content: space-around;
+		position: fixed;
+		left: 0;
+		bottom: 0;
+		z-index: 2;
+
+		button::after {
+			border: none;
+		}
+
+		.item {
+			text-align: center;
+
+			image {
+				width: 25px;
+				height: 25px;
+			}
+
+			.name {
+				// margin-top: -5px;
+				// line-height: 25px;
+				font-size: 12px;
+				color: #909399;
+				font-weight: 400;
+			}
+		}
+
+		.active {
+			image {
+				width: 25px;
+				height: 25px;
+			}
+
+			.name {
+				font-size: 12px;
+				color: #303133 !important;
+				font-weight: 400;
+			}
+		}
+	}
+</style>

+ 5 - 2
main.js

@@ -30,7 +30,8 @@ import English from '@/common/locales/en.js';
 
 // VueI18n
 import VueI18n from '@/common/vue-i18n.min.js';
-
+import tabBar from 'components/tabbar.vue'
+Vue.component('tab-bar', tabBar) //挂载
 // VueI18n
 Vue.use(VueI18n);
 
@@ -56,7 +57,9 @@ const app = new Vue({
 // http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
 import httpInterceptor from '@/common/http.interceptor.js';
 Vue.use(httpInterceptor, app);
-
+//全局方法判断权限
+import $p from './common/public.js'
+Vue.prototype.$transformAuth = $p.transformAuth
 // http接口API抽离,免于写url或者一些固定的参数
 import httpApi from '@/common/http.api.js';
 Vue.use(httpApi, app);

+ 2 - 2
manifest.json

@@ -127,7 +127,7 @@
         "template" : "template.h5.html",
         "router" : {
             "mode" : "hash",
-            "base" : "/h5-mentor-teacher/"
+            "base" : ""
         },
         "optimization" : {
             "treeShaking" : {
@@ -137,7 +137,7 @@
         "title" : "智慧导师预约-教师端",
         "devServer" : {
             "port" : 8080,
-            "https" : true
+            "https" : false
         },
         "domain" : "bcsyds.hactcm.edu.cn",
         "sdkConfigs" : {

+ 51 - 52
pages.json

@@ -7,6 +7,7 @@
 			"path": "pages/index/index",
 			"style": {
 				"navigationBarTitleText": "首页"
+				// "navigationStyle": "custom"
 			}
 		},
 		{
@@ -106,79 +107,77 @@
 			"style": {
 				"navigationBarTitleText": "通知公告"
 			}
-		},{
+		}, {
 			"path": "pages/mine/change_pwd",
 			"style": {
 				"navigationBarTitleText": "修改密码"
 			}
-		},{
+		}, {
 			"path": "pages/mine/liuyan",
 			"style": {
 				"navigationBarTitleText": "留言列表"
 			}
-		},{
+		}, {
 			"path": "pages/mine/shuangchuang",
 			"style": {
 				"navigationBarTitleText": "我的双创"
 			}
-		},{
+		}, {
 			"path": "pages/mine/shuangchuang_detail",
 			"style": {
 				"navigationBarTitleText": "双创详情"
 			}
+		}, {
+			"path": "pages/wenjuan/wenjuan",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
 		}
-	    ,{
-            "path" : "pages/wenjuan/wenjuan",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-    ],
+	],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "智慧导师预约系统",
 		"navigationBarBackgroundColor": "#FFFFFF",
 		"backgroundColor": "#FFFFFF"
-	},
-	"tabBar": {
-		"color": "#909399",
-		"selectedColor": "#303133", 
-		"backgroundColor": "#FFFFFF",
-		"borderStyle": "black",
-		"navigationStyle": "custom",
-		"list": [{
-				"pagePath": "pages/index/index",
-				"iconPath": "static/images/home.png",
-				"selectedIconPath": "static/images/home-fill.png",
-				"text": "首页" 
-			},
-			{
-				"pagePath": "pages/scheduling/index",
-				"iconPath": "static/images/scheduling.png",
-				"selectedIconPath": "static/images/scheduling-fill.png",
-				"text": "工作"
-			},
-			{
-				"pagePath": "pages/student/index_new",
-				"iconPath": "static/images/student.png",
-				"selectedIconPath": "static/images/student-fill.png",
-				"text": "学生"
-			},
-			{
-				"pagePath": "pages/activity/index",
-				"iconPath": "static/images/active.png",
-				"selectedIconPath": "static/images/active-fill.png",
-				"text": "活动"
-			},
-			{
-				"pagePath": "pages/mine/index",
-				"iconPath": "static/images/mine.png",
-				"selectedIconPath": "static/images/mine-fill.png",
-				"text": "我的"
-			}
-		]
 	}
+	// "tabBar": {
+	// 	"color": "#909399",
+	// 	"selectedColor": "#303133",
+	// 	"backgroundColor": "#FFFFFF",
+	// 	"borderStyle": "black",
+	// 	"navigationStyle": "custom",
+	// 	"list": [{
+	// 			"pagePath": "pages/index/index",
+	// 			"iconPath": "static/images/home.png",
+	// 			"selectedIconPath": "static/images/home-fill.png",
+	// 			"text": "首页"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/scheduling/index",
+	// 			"iconPath": "static/images/scheduling.png",
+	// 			"selectedIconPath": "static/images/scheduling-fill.png",
+	// 			"text": "工作"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/student/index_new",
+	// 			"iconPath": "static/images/student.png",
+	// 			"selectedIconPath": "static/images/student-fill.png",
+	// 			"text": "学生"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/activity/index",
+	// 			"iconPath": "static/images/active.png",
+	// 			"selectedIconPath": "static/images/active-fill.png",
+	// 			"text": "活动"
+	// 		},
+	// 		{
+	// 			"pagePath": "pages/mine/index",
+	// 			"iconPath": "static/images/mine.png",
+	// 			"selectedIconPath": "static/images/mine-fill.png",
+	// 			"text": "我的"
+	// 		}
+	// 	]
+	// }
 }

+ 6 - 5
pages/activity/index.vue

@@ -12,7 +12,6 @@
 				<text class="line" v-if="current_tab==item.id">
 				</text>
 			</view>
-
 		</view>
 		<view class="search">
 			<view class="u-demo-block__content">
@@ -27,7 +26,7 @@
 		<view class="list" v-if="list.length>0">
 			<view class="list-item" @click="detail(item.id)" v-for="(item,index) in list" :key='index'>
 				<view class="tips" v-if="item.category_id==2">
-					<text>已报名人数:</text> <text class="sign-num">{{item.sign_up_count}}/{{item.max_sign_up_count}}</text>
+					<text>已报名人数:</text><text class="sign-num">{{item.sign_up_count}}/{{item.max_sign_up_count}}</text>
 				</view>
 				<!-- <view class="image" :style="{backgroundImage:'url('+ (item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png') +')'}">
 					
@@ -64,7 +63,8 @@
 			<view class="empty-text">
 				暂无内容
 			</view>
-		</view>
+		</view>
+		<tab-bar :current="3"></tab-bar>
 	</view>
 </template>
 
@@ -202,10 +202,11 @@
 	}
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
 	page {
 		position: relative;
-		background-color: #F7F7F7;
+		background-color: #F7F7F7;
+		padding-bottom: 70px;
 	}
 
 	.add {

+ 8 - 7
pages/index/index.vue

@@ -132,7 +132,7 @@
 			</view>
 		</view>
 
-		<view class="content">
+		<view class="content" v-if="$transformAuth('100202')">
 			<view class="content-top">
 				<view class="title">
 					我的值班
@@ -206,9 +206,8 @@
 					</view>
 				</view>
 			</view>
-
-
-		</view>
+		</view>
+		<tab-bar :current="0"></tab-bar>
 	</view>
 </template>
 
@@ -399,13 +398,15 @@
 	}
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
 	page {
-		background-color: #F9F9FB;
+		background-color: #F9F9FB;
+		padding-bottom: 70px;
 	}
 
 	.news {
-		padding: 10px 0 0;
+		padding: 10px 0 0;
+		
 		
 		.list-item {
 			background: #FFFFFF;

+ 6 - 6
pages/login/index.vue

@@ -3,7 +3,8 @@
 		<view class="top">
 			<image class="logo" src="../../static/images/logo.jpg" mode=""></image>
 		</view>
-		<view class="form">
+		<view class="form">
+		
 			<view class="title">
 				智慧导师系统(导师端)
 			</view>
@@ -82,13 +83,11 @@
 				}
 				let data = {
 					username: this.username,
-					password: this.password,
+					password: btoa(this.password),
 					role_id: 2
 				}
 
-				this.$u.post('/base/auth/login', {
-					username: btoa(JSON.stringify(data))
-				}).then(res => {
+				this.$u.post('/base/auth/login', data).then(res => {
 					if (res.code == 200) {
 						console.log(res, '登陆成功')
 						this.$u.vuex('vuex_login', {
@@ -98,7 +97,8 @@
 						this.$u.vuex('vuex_token', 'bearer ' + res.data.token);
 						this.$u.vuex('vuex_user', res.data.user);
 						this.$u.vuex('vuex_islogin', true);
-						this.$u.vuex('vuex_token_time', new Date().getTime())
+						this.$u.vuex('vuex_token_time', new Date().getTime())
+						this.$u.vuex('vuex_permissions', res.data.permissions);
 						uni.showToast({
 							title: '登陆成功~',
 							icon: 'none'

+ 8 - 6
pages/mine/index.vue

@@ -85,7 +85,7 @@
 			</view>
 			<view class="list">
 				
-				<view class="item" @click="record">
+				<view class="item" @click="record" v-if="$transformAuth('100202')">
 					<view class="left">
 						<image src="../../static/images/list_1.png" mode=""></image>
 						<text>我的值班</text>
@@ -121,7 +121,7 @@
 						<image src="../../static/images/list_arrow.png" mode=""></image>
 					</view>
 				</view>
-				<view class="item" @click="to_liuyan">
+				<view class="item" @click="to_liuyan" v-if="$transformAuth('101100')">
 					<view class="left">
 						<image class="item_3" src="../../static/images/liuyan.png" mode=""></image>
 						<text>留言列表</text>
@@ -130,7 +130,7 @@
 						<image src="../../static/images/list_arrow.png" mode=""></image>
 					</view>
 				</view>
-				<view class="item" @click="to_shuangchuang">
+				<view class="item" @click="to_shuangchuang" v-if="$transformAuth('101702')">
 					<view class="left">
 						<image class="item_3" src="../../static/images/chuang.png" mode=""></image>
 						<text>双创列表</text>
@@ -153,7 +153,8 @@
 		<view class="exit" @click="exit">
 			退出登录
 		</view>
-		<view class="banben">v1.0.1</view>
+		<view class="banben">v1.0.1</view>
+		<tab-bar :current="4"></tab-bar>
 	</view>
 </template>
 
@@ -267,9 +268,10 @@
 	}
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss">
 	page {
-		background-color: #eee;
+		background-color: #eee;
+		padding-bottom: 70px;
 	}
 
 	.mine {

+ 3 - 2
pages/scheduling/index.vue

@@ -280,7 +280,8 @@
 				</view>
 
 			</view>
-		</view>
+		</view>
+		<tab-bar :current="1"></tab-bar>
 	</view>
 
 </template>
@@ -567,7 +568,7 @@
 
 <style lang="scss" scoped>
 	.sheduling {
-
+    padding-bottom: 70px;
 		//添加排班弹框
 		.pop_wrap {
 			width: 290px;

+ 1 - 1
pages/student/index.vue

@@ -69,7 +69,7 @@
 				暂无学生
 			</view>
 		</view>
-
+		
 	</view>
 </template>
 

+ 4 - 3
pages/student/index_new.vue

@@ -67,7 +67,7 @@
 				暂无学生
 			</view>
 		</view>
-
+		<tab-bar :current="2"></tab-bar>
 	</view>
 </template>
 
@@ -195,10 +195,11 @@
 	}
 </script>
 
-<style lang="scss" scoped>
+<style lang="scss" >
 	page{
 		background-color: #F7F7F7;
-		border-top: 0.5px solid rgba(0, 0, 0, 0.1);
+		border-top: 0.5px solid rgba(0, 0, 0, 0.1);
+		padding-bottom: 70px;
 	}
 	.list {
 		.enptyStatus{

+ 3 - 2
store/index.js

@@ -12,7 +12,7 @@ try {
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['vuex_user', 'vuex_token'];
+let saveStateKeys = ['vuex_user', 'vuex_token','vuex_permissions'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value) {
@@ -32,7 +32,8 @@ const store = new Vuex.Store({
 		// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
 		// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
 		vuex_user: lifeData.vuex_user ? lifeData.vuex_user : '',
-		vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
+		vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
+		vuex_permissions:lifeData.vuex_permissions?lifeData.vuex_permissions:'',
 		// 如果vuex_version无需保存到本地永久存储,无需lifeData.vuex_version方式
 		vuex_version: '1.0.1',
 		vuex_demo: '绛紫',

+ 1 - 1
vue.config.js

@@ -7,7 +7,7 @@ module.exports = {
 			disableHostCheck: true,
 			"proxy": {
 				"/api": {
-					"target": "http://mentor.site.ximengnaikang.com", // 需要跨域的域名
+					"target": "http://bencao.site.xmnk.cn/api", // 需要跨域的域名
 					"changeOrigin": true,
 					"secure": false,
 					"pathRewrite": {