Browse Source

分权限

master
unknown 1 year ago
parent
commit
3af207e064
  1. 14
      common/js/mixins.js
  2. 137
      components/UserTab/UserTab.vue
  3. 3
      main.js
  4. 17
      pages/tabbar/appointmenRecord/index.vue
  5. 4
      pages/tabbar/examSimulation/index.vue
  6. 18
      pages/tabbar/mine/index.vue
  7. 4
      pages/tabbar/operateTrain/index.vue
  8. 47
      pages/tabbar/statistics/index.vue
  9. 14
      pages/tabbar/student/index.vue
  10. 144
      pages/userCenter/login/login.vue
  11. 11
      pages/userCenter/login/loginByPhone.vue
  12. 0
      static/images/userCenter/loginTitle.png
  13. 9
      store/modules/user.js

14
common/js/mixins.js

@ -0,0 +1,14 @@
import { mapState } from 'vuex'
export default {
computed: {
...mapState({
identity: state=> state.user.identity,
}),
},
data() {
return {
}
}
}

137
components/UserTab/UserTab.vue

@ -1,8 +1,8 @@
<template> <template>
<view class="tab-bar"> <view class="tab-bar">
<view v-for="(item,index) in list" :key="index" class="tab-bar-item" @click="switchTab(item, index)"> <view v-for="(item,index) in list" :key="index" class="tab-bar-item" @click="switchTab(item, index)">
<image class="tab_img" :src="currentIndex == index ? item.selectedIconPath : item.iconPath"></image>
<view class="tab_text" :style="{color: currentIndex == index ? selectedColor : color}">{{item.text}}</view>
<image class="tab_img" :src="name == item.text ? item.selectedIconPath : item.iconPath"></image>
<view class="tab_text" :style="{color: name == item.text ? selectedColor : color}">{{item.text}}</view>
</view> </view>
</view> </view>
</template> </template>
@ -10,75 +10,110 @@
<script> <script>
export default { export default {
props: { props: {
selectedIndex: { // tab index
name: { // tab index
default: 0 default: 0
}, },
}, },
data() { data() {
return { return {
color: "#666666",
selectedColor: "#00BAB2",
color: "#999",
selectedColor: "#218DFF",
list: [], list: [],
currentIndex:0, currentIndex:0,
} }
}, },
created() { created() {
this.currentIndex = this.selectedIndex;
this.currentName = this.name;
var _this = this var _this = this
if (uni.getStorageSync('identify') == 'nurse') {
//
_this.list = [
{
"pagePath": "/pages/tabbar/index/index",
"text": "首页",
"iconPath": "/static/images/tabbar/sy.png",
"selectedIconPath": "/static/images/tabbar/syActive.png"
},
{
"pagePath": "/pages/tabbar/question/index",
"text": "题库",
"iconPath": "/static/images/tabbar/tk.png",
"selectedIconPath": "/static/images/tabbar/tkActive.png"
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": "/static/images/tabbar/wd.png",
"selectedIconPath": "/static/images/tabbar/wdActive.png"
}
]
} else {
//
if (uni.getStorageSync('identity') == '1') {
//
_this.list = [{ _this.list = [{
"pagePath": "/pages/tabbar/index/index",
"text": "首1页",
"iconPath": "/static/images/tabbar/sy.png",
"selectedIconPath": "/static/images/tabbar/syActive.png"
},
{
"pagePath": "/pages/tabbar/question/index",
"text": "题2库",
"iconPath": "/static/images/tabbar/tk.png",
"selectedIconPath": "/static/images/tabbar/tkActive.png"
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我3的",
"iconPath": "/static/images/tabbar/wd.png",
"selectedIconPath": "/static/images/tabbar/wdActive.png"
}
]
}
"pagePath": "/pages/tabbar/statistics/index",
"text": "首页",
"iconPath": "../../static/images/tabbar/tj.png",
"selectedIconPath": "../../static/images/tabbar/tjActive.png"
},
{
"pagePath": "/pages/tabbar/examSimulation/index",
"text": "考场模拟",
"iconPath": "../../static/images/tabbar/kc.png",
"selectedIconPath": "../../static/images/tabbar/kcActive.png"
},
{
"pagePath": "/pages/tabbar/operateTrain/index",
"text": "实操训练",
"iconPath": "../../static/images/tabbar/sc.png",
"selectedIconPath": "../../static/images/tabbar/scActive.png"
},
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": "../../static/images/tabbar/xy.png",
"selectedIconPath": "../../static/images/tabbar/xyActive.png"
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": "../../static/images/tabbar/wd.png",
"selectedIconPath": "../../static/images/tabbar/wdActive.png"
}
]
} else if(uni.getStorageSync('identity') == '2') {
//
_this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": "../../static/images/tabbar/tj.png",
"selectedIconPath": "../../static/images/tabbar/tjActive.png"
},
{
"pagePath": "/pages/tabbar/student/index",
"text": "学员",
"iconPath": "../../static/images/tabbar/xy.png",
"selectedIconPath": "../../static/images/tabbar/xyActive.png"
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": "../../static/images/tabbar/wd.png",
"selectedIconPath": "../../static/images/tabbar/wdActive.png"
}
]
}else {
_this.list = [{
"pagePath": "/pages/tabbar/statistics/index",
"text": "统计",
"iconPath": "../../static/images/tabbar/tj.png",
"selectedIconPath": "../../static/images/tabbar/tjActive.png"
},
{
"pagePath": "/pages/tabbar/examSimulation/index",
"text": "预约记录",
"iconPath": "../../static/images/tabbar/xy.png",
"selectedIconPath": "../../static/images/tabbar/xyActive.png"
},
{
"pagePath": "/pages/tabbar/mine/index",
"text": "我的",
"iconPath": "../../static/images/tabbar/wd.png",
"selectedIconPath": "../../static/images/tabbar/wdActive.png"
}]
}
}, },
methods: { methods: {
switchTab(item, index) { switchTab(item, index) {
this.currentIndex = index;
this.currentName = item.text;
let url = item.pagePath; let url = item.pagePath;
console.log(url) console.log(url)
uni.reLaunch({url:url})
uni.switchTab({
url
})
// uni.reLaunch({url:url})
} }
} }
} }

3
main.js

@ -16,6 +16,9 @@ Vue.use(uView)
import tabBar from "components/UserTab/UserTab.vue" import tabBar from "components/UserTab/UserTab.vue"
Vue.component('tabBar',tabBar) Vue.component('tabBar',tabBar)
import mixin from "./common/js/mixins.js"
Vue.mixin(mixin)
const app = new Vue({ const app = new Vue({
...App, ...App,
store store

17
pages/tabbar/appointmenRecord/index.vue

@ -0,0 +1,17 @@
<template>
<view class="pageBgImg">
预约记录
<UserTab name ='预约记录'></UserTab>
</view>
</template>
<script>
export default {
onShow() {
uni.hideTabBar()
}
}
</script>
<style>
</style>

4
pages/tabbar/examSimulation/index.vue

@ -50,7 +50,7 @@
<view class="card"> <view class="card">
<appointItem /> <appointItem />
</view> </view>
<!-- <UserTab selectedIndex ='1'></UserTab> -->
<UserTab name ='考场模拟'></UserTab>
</view> </view>
</template> </template>
@ -61,7 +61,7 @@
}, },
onLoad() {}, onLoad() {},
onShow() { onShow() {
// uni.hideTabBar();
uni.hideTabBar();
}, },
methods: { methods: {
goPage() {} goPage() {}

18
pages/tabbar/mine/index.vue

@ -17,7 +17,8 @@
</view> </view>
</view> </view>
</view> </view>
<!-- <UserTab selectedIndex ='2'></UserTab> -->
<UserTab name ='我的'></UserTab>
</view> </view>
</template> </template>
@ -37,10 +38,23 @@
} }
}, },
onLoad() { onLoad() {
if(this.identity==2) {
this.tabData = [
{text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
{text: '学员退款', icon: require('../../../static/images/coach/ic_tuikuan.png'), id: 7, url: '/pages/userCenter/refund/refund'},
{text: '教学数据', icon: require('../../../static/images/coach/ic_shuju.png'), id: 6, url: '/pages/userCenter/teachingData/teachingData'},
]
}else if(this.identity==3) {
this.tabData = [
{text: '我的车辆', icon: require('../../../static/images/coach/ic_cheliang.png'), id: 3, url: '/pages/userCenter/myCar/myCar'},
{text: '学员评价', icon: require('../../../static/images/coach/ic_pingjia.png'), id: 5, url: '/pages/userCenter/studentComment/studentComment'},
]
}
console.log('我的页面') console.log('我的页面')
}, },
onShow() { onShow() {
// uni.hideTabBar();
uni.hideTabBar();
}, },
methods: { methods: {
goPage() {} goPage() {}

4
pages/tabbar/operateTrain/index.vue

@ -39,7 +39,7 @@
<appointItem-operate @click.native="$goPage('/pages/recordEntry/operate/detail/detail')"/> <appointItem-operate @click.native="$goPage('/pages/recordEntry/operate/detail/detail')"/>
</view> </view>
</view> </view>
<!-- <UserTab selectedIndex ='2'></UserTab> -->
<UserTab name ='实操训练'></UserTab>
</view> </view>
</template> </template>
@ -72,7 +72,7 @@
console.log('我的页面') console.log('我的页面')
}, },
onShow() { onShow() {
// uni.hideTabBar();
uni.hideTabBar();
}, },
methods: { methods: {
changeTab(item) { changeTab(item) {

47
pages/tabbar/statistics/index.vue

@ -13,6 +13,20 @@
<view class="card priceBox"> <view class="card priceBox">
<view class="blueLab">今日已结算金额</view> <view class="blueLab">今日已结算金额</view>
<view class="price">36333.66</view> <view class="price">36333.66</view>
<view class="toDay" v-if="identity==2">
<view class="row">
<view class="lab">今日学员退款</view>
<view class="val">900</view>
</view>
<view class="row">
<view class="lab">今日代收费</view>
<view class="val">900</view>
</view>
<view class="row">
<view class="lab">今日学员退款</view>
<view class="val">900</view>
</view>
</view>
<view class="flex-b"> <view class="flex-b">
<view class="data">截止2023/08/08 11:00:00</view> <view class="data">截止2023/08/08 11:00:00</view>
<view class="refresh"> <view class="refresh">
@ -24,7 +38,7 @@
</view> </view>
</view> </view>
<view class="h1">结算统计</view>
<view class="h1"> {{identity==1?'结算': '收入'}}统计</view>
<view class="tabs"> <view class="tabs">
<view class="tab" @click="tabClick(1)" :class="{active: currentTab==1}">按日</view> <view class="tab" @click="tabClick(1)" :class="{active: currentTab==1}">按日</view>
<view class="tab" @click="tabClick(2)" :class="{active: currentTab==2}">按月</view> <view class="tab" @click="tabClick(2)" :class="{active: currentTab==2}">按月</view>
@ -37,7 +51,7 @@
</view> </view>
</view> </view>
<view class="flex-b"> <view class="flex-b">
<view class="h1">结算明细</view>
<view class="h1">{{identity==1?'结算': '收入'}}明细</view>
<moreRight text="更多"/> <moreRight text="更多"/>
</view> </view>
<view class="record"> <view class="record">
@ -46,7 +60,7 @@
</view> </view>
</view> </view>
<view class="moreBtn" @click="$goPage('/pages/indexEntry/settlement/settlement')">查看更多</view> <view class="moreBtn" @click="$goPage('/pages/indexEntry/settlement/settlement')">查看更多</view>
<!-- <UserTab selectedIndex ='2'></UserTab> -->
<UserTab :name ='identity==1?"首页":"统计" '></UserTab>
<u-datetime-picker <u-datetime-picker
:show="showDatePicker" :show="showDatePicker"
v-model="value1" v-model="value1"
@ -64,15 +78,16 @@
components: { stage }, components: { stage },
data() { data() {
return { return {
value1: '',
currentTab: 1, currentTab: 1,
showDatePicker: false
showDatePicker: false,
} }
}, },
onLoad() { onLoad() {
console.log('我的页面')
}, },
onShow() { onShow() {
// uni.hideTabBar();
uni.hideTabBar();
}, },
methods: { methods: {
tabClick(num) { tabClick(num) {
@ -147,6 +162,26 @@
font-weight: 600; font-weight: 600;
padding: 12rpx 0 24rpx 0; padding: 12rpx 0 24rpx 0;
} }
.toDay {
padding: 14rpx 0;
border-top: 2rpx dashed #E8E9EC;
border-bottom: 2rpx dashed #E8E9EC;
margin-bottom: 20rpx;
.row {
padding: 16rpx 0;
display: flex;
align-items: center;
.lab {
color: #686B73;
font-size: 24rpx;
width: 210rpx;
}
.val {
font-size: 28rpx;
font-weight: 600;
}
}
}
.flex-b { .flex-b {

14
pages/tabbar/student/index.vue

@ -3,7 +3,7 @@
<view class="searchBox"> <view class="searchBox">
<searchRow placeholder="搜索学员姓名、学员手机号"></searchRow> <searchRow placeholder="搜索学员姓名、学员手机号"></searchRow>
</view> </view>
<view class="card">
<view class="card" v-if="identity==1">
<view class="addStudent"> <view class="addStudent">
<view class="h2">我的学员</view> <view class="h2">我的学员</view>
<view class="btnBg" @click="$goPage('/pages/recordEntry/student/addStudent/addStudent')">手动添加</view> <view class="btnBg" @click="$goPage('/pages/recordEntry/student/addStudent/addStudent')">手动添加</view>
@ -20,6 +20,10 @@
<view class="val">260</view> <view class="val">260</view>
<view class="lab">今日新增学员</view> <view class="lab">今日新增学员</view>
</view> </view>
<view class="statisticsItem" v-if="identity==2">
<view class="val">260</view>
<view class="lab">今日退学学员</view>
</view>
</view> </view>
</view> </view>
@ -49,6 +53,7 @@
<appointItem-student/> <appointItem-student/>
</view> </view>
</view> </view>
<UserTab name ='学员'></UserTab>
</view> </view>
</template> </template>
@ -62,7 +67,10 @@
className: '全部班型' className: '全部班型'
} }
} }
}
},
onShow() {
uni.hideTabBar();
},
} }
</script> </script>
@ -106,7 +114,7 @@
color: $themC; color: $themC;
position: relative; position: relative;
&::before { &::before {
content: '';
content: '';
position: absolute; position: absolute;
right: -30rpx; right: -30rpx;
bottom: 10rpx; bottom: 10rpx;

144
pages/userCenter/login/login.vue

@ -1,6 +1,27 @@
<template> <template>
<view class="main"> <view class="main">
登录方式
<view class="h1Img">
<image src="../../../static/images/userCenter/loginTitle.png" mode=""></image>
</view>
<view class="btnCon">
<view class="btn">手机号快捷登录</view>
<!-- <button type="success" size="mini" style="margin-top: 15rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" text="获取手机号">获取手机号</button> -->
<view class="btn border" @click="$goPage('/pages/userCenter/login/loginByPhone');">手机号登录/注册</view>
</view>
<view style="margin-top: 40rpx;">
<privacyRadion :isCheck="isCheck" @changeRadio="changeRadio"></privacyRadion>
</view>
<u-popup :show="show" :round="10" mode="center" >
<view class="">
<view class="popupCon">
<view class="h1"> </view>
<view class="msg">授权手机号我们才能继续为您 <br>提供服务哦~</view>
<view class="oneBtn">我知道了</view>
</view>
</view>
</u-popup>
</view> </view>
</template> </template>
@ -8,14 +29,48 @@
export default { export default {
data() { data() {
return { return {
isCheck: false,
show: false,
decodePhoneParams: {}
} }
}, },
onLoad() { onLoad() {
// this.init()
this.getCode()
// uni.getLocation({
// type: 'wgs84',
// success: function (res) {
// console.log(res)
// console.log('' + res.longitude);
// console.log('' + res.latitude);
// }
// });
}, },
methods: { methods: {
// code
getCode() {
uni.login({
provider: 'weixin',
success: loginRes => {
this.decodePhoneParams.code = loginRes.code
console.log('loginRes')
console.log(loginRes)
}
});
},
//
async getPhoneNumber(e) {
await this.getCode();
console.log('获取手机号')
console.log(e)
if(!this.decodePhoneParams.code || !e.detail.encryptedData){
return false;
}
},
//
changeRadio(val) {
this.isCheck = val
},
init() { init() {
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
@ -45,27 +100,68 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// .radioWrap {
// display: flex;
// justify-content: flex-start;
// align-items: center;
// /deep/.radio-btn {
// margin-right: -9rpx !important;
// }
.main {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
background: url('../../../static/images/userCenter/loginTopBg.png') no-repeat;
background-size: 100% 360rpx;
.h1Img {
width: 658rpx;
height: 94rpx;
margin: 288rpx 0 120rpx 0;
}
.btnCon {
.btn {
width: 396rpx;
height: 72rpx;
background: #1989FA;
border-radius: 8rpx;
color: #fff;
margin-bottom: 32rpx;
text-align: center;
line-height: 72rpx;
font-size: 28rpx;
&.border {
background: rgba(25,137,250,0.1);
border: 2rpx solid #1989FA;
color: $themC;
}
}
}
}
// radio {
// zoom: .8;
// }
.popupCon {
width: 558rpx;
height: 344rpx;
border-radius: 16rpx;
overflow: hidden;
.h1 {
line-height: 124rpx;
text-align: center;
font-size: 36rpx;
font-weight: 600;
height: 124rpx;
width: 100%;
background: linear-gradient(180deg, #C1DFFE 0%, #FFFFFF 100%);
}
// view:nth-child(2) {
// font-size: 24rpx;
// color: #bfbfbf;
// }
.msg {
font-size: 28rpx;
color: #686B73;
padding: 0 0 30rpx 0;
text-align: center;
}
// text {
// color: #218DFF;
// font-size: 24rpx;
// }
// }
.oneBtn {
line-height: 112rpx;
height: 112rpx;
border-top: 1px solid #E8E9EC;
text-align: center;
font-size: 36rpx;
color: $themC;
font-weight: 600;
}
}
</style> </style>

11
pages/userCenter/login/loginByPhone.vue

@ -93,8 +93,17 @@
}, 1000); }, 1000);
}, },
submitFn() { submitFn() {
let val = 1
if(this.FormData.phone=='18267103167') {
val = 1
}else if(this.FormData.phone=='18267103168') {
val = 2
}else {
val = 3
}
this.$store.commit('upDateIdentity', val)
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/index/index'
url: '/pages/tabbar/statistics/index'
}) })
} }
} }

0
static/images/userCenter/title_1.png → static/images/userCenter/loginTitle.png

Before

Width: 329  |  Height: 47  |  Size: 8.8 KiB

After

Width: 329  |  Height: 47  |  Size: 8.8 KiB

9
store/modules/user.js

@ -3,12 +3,13 @@ import addApi from '../../common/sdk/qqmap-wx-jssdk.min.js'; // 引入
const user = { const user = {
state: { state: {
addList: []
identity: uni.getStorageSync('identity')?uni.getStorageSync('identity'):1
}, },
mutations: { mutations: {
// 更新广告列表
upDateAddList(state, list) {
state.addList = list
// 更新用户身份
upDateIdentity(state, val) {
state.identity = val
uni.setStorageSync('identity', val);
}, },
}, },
actions: { actions: {

Loading…
Cancel
Save