Commit ce5309c4 authored by wangqinghua's avatar wangqinghua

权限更新

parent 38816725
...@@ -26,7 +26,6 @@ import {PersonListPage} from "../pages/contact/person-list/person-list"; ...@@ -26,7 +26,6 @@ import {PersonListPage} from "../pages/contact/person-list/person-list";
import {DatePipe} from "@angular/common"; import {DatePipe} from "@angular/common";
import {BlockModalPage} from "../pages/home/activity-track/block-modal/block-modal"; import {BlockModalPage} from "../pages/home/activity-track/block-modal/block-modal";
import {QuestionDetailPage} from "../pages/home/mySurvey/question-detail/question-detail"; import {QuestionDetailPage} from "../pages/home/mySurvey/question-detail/question-detail";
import {DirectivesModule} from "../directives/directives.module";
import {LearnService} from "../pages/home/learning/learn.service"; import {LearnService} from "../pages/home/learning/learn.service";
import {LoginService} from "../pages/login/login.service"; import {LoginService} from "../pages/login/login.service";
import {LearnManageService} from "../pages/home/learn-manage/learnManage.service"; import {LearnManageService} from "../pages/home/learn-manage/learnManage.service";
...@@ -51,6 +50,7 @@ import {GoodsCollectPageModule} from "../pages/serve-pages/goods-collect/goods-c ...@@ -51,6 +50,7 @@ import {GoodsCollectPageModule} from "../pages/serve-pages/goods-collect/goods-c
import {HairCutPageModule} from "../pages/serve-pages/hair-cut/hair-cut.module"; import {HairCutPageModule} from "../pages/serve-pages/hair-cut/hair-cut.module";
import {MeetRoomPageModule} from "../pages/serve-pages/meet-room/meet-room.module"; import {MeetRoomPageModule} from "../pages/serve-pages/meet-room/meet-room.module";
import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module"; import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
import {AppMainService} from "./app.service";
@NgModule({ @NgModule({
...@@ -87,7 +87,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module"; ...@@ -87,7 +87,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
GoodsCollectPageModule, GoodsCollectPageModule,
HairCutPageModule, HairCutPageModule,
MeetRoomPageModule, MeetRoomPageModule,
UseCarPageModule UseCarPageModule,
], ],
bootstrap: [IonicApp], bootstrap: [IonicApp],
entryComponents: [ entryComponents: [
...@@ -128,6 +128,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module"; ...@@ -128,6 +128,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
TabsService, TabsService,
MineService, MineService,
EmitService, EmitService,
AppMainService,
{provide: ErrorHandler, useClass: IonicErrorHandler} {provide: ErrorHandler, useClass: IonicErrorHandler}
] ]
}) })
......
import {Injectable} from '@angular/core';import {BehaviorSubject, Subscription} from 'rxjs'; @Injectable()export class AppMainService { private roleSource:BehaviorSubject<any> = new BehaviorSubject([]); public role = this.roleSource.asObservable(); //权限赋值 public setRole(value: string){ this.roleSource.next(value); console.log(value); } }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import {AppGlobal, AppService} from '../../../service/http.service'; ...@@ -5,6 +5,7 @@ import {AppGlobal, AppService} from '../../../service/http.service';
import { Storage } from "@ionic/storage"; import { Storage } from "@ionic/storage";
import {ContactListPage} from '../contactList/contactList'; import {ContactListPage} from '../contactList/contactList';
import {MyBlockPage} from "../my-block/my-block"; import {MyBlockPage} from "../my-block/my-block";
import {AppMainService} from "../../../app/app.service";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -34,10 +35,8 @@ export class ContractPersoninfoPage { ...@@ -34,10 +35,8 @@ export class ContractPersoninfoPage {
role = []; //权限 role = []; //权限
nowOrgName; nowOrgName;
constructor(public navCtrl: NavController, constructor(public navCtrl: NavController, public navParams: NavParams,
public navParams: NavParams, public appService: AppService, public storage: Storage,private appMainSer:AppMainService) {
public appService: AppService,
public storage: Storage) {
} }
ionViewDidEnter() { ionViewDidEnter() {
...@@ -52,11 +51,10 @@ export class ContractPersoninfoPage { ...@@ -52,11 +51,10 @@ export class ContractPersoninfoPage {
}); });
//获取权限 //获取权限
this.storage.get('role').then( this.appMainSer.role.subscribe(value => {
(res)=>{ this.role = value;
this.role = res;
} }
) );
} }
//获取当前登录人部门 //获取当前登录人部门
......
...@@ -6,6 +6,7 @@ import {Storage} from "@ionic/storage"; ...@@ -6,6 +6,7 @@ import {Storage} from "@ionic/storage";
import {Camera, CameraOptions} from "@ionic-native/camera"; import {Camera, CameraOptions} from "@ionic-native/camera";
import {FileTransfer, FileTransferObject, FileUploadOptions} from "@ionic-native/file-transfer"; import {FileTransfer, FileTransferObject, FileUploadOptions} from "@ionic-native/file-transfer";
import {AppGlobal} from "../../../service/http.service"; import {AppGlobal} from "../../../service/http.service";
import {AppMainService} from "../../../app/app.service";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -65,7 +66,7 @@ export class PublishPage { ...@@ -65,7 +66,7 @@ export class PublishPage {
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage,
public camera: Camera, public actionSheetCtrl: ActionSheetController, public camera: Camera, public actionSheetCtrl: ActionSheetController,
public loadingCtrl: LoadingController, public transfer: FileTransfer, public loadingCtrl: LoadingController, public transfer: FileTransfer,
private tabsSer: TabsService, private tabsSer: TabsService,private appMainSer:AppMainService,
public commonSer: CommonService, public tabSer: TabsService) { public commonSer: CommonService, public tabSer: TabsService) {
} }
...@@ -77,12 +78,10 @@ export class PublishPage { ...@@ -77,12 +78,10 @@ export class PublishPage {
}) })
//获取权限 //获取权限
this.storage.get('role').then( this.appMainSer.role.subscribe(value => {
(res)=>{ this.role = value;
this.role = res;
console.log(this.role)
} }
) );
} }
ionViewWillLeave(){ ionViewWillLeave(){
......
...@@ -6,6 +6,7 @@ import {ChangeApplyListPage} from "../manageDuty/change-apply-list/change-apply- ...@@ -6,6 +6,7 @@ import {ChangeApplyListPage} from "../manageDuty/change-apply-list/change-apply-
import {SurveryPage} from "../mySurvey/survery/survery"; import {SurveryPage} from "../mySurvey/survery/survery";
import {TabsService} from "../../tabs/tabs.service"; import {TabsService} from "../../tabs/tabs.service";
import {Storage} from "@ionic/storage"; import {Storage} from "@ionic/storage";
import {AppMainService} from "../../../app/app.service";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -24,16 +25,15 @@ export class MoreAppPage { ...@@ -24,16 +25,15 @@ export class MoreAppPage {
}; };
constructor(public navCtrl: NavController, public navParams: NavParams,private storage:Storage, constructor(public navCtrl: NavController, public navParams: NavParams,private storage:Storage,
public appService: AppService,public tabsSer:TabsService) { public appService: AppService,public tabsSer:TabsService,private appMainSer:AppMainService) {
} }
ionViewDidLoad() { ionViewDidLoad() {
//获取权限 //获取权限
this.storage.get('role').then( this.appMainSer.role.subscribe(value => {
(res)=>{ this.role = value;
this.role = res;
} }
) );
} }
/** /**
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<span style="color: #ffffff;font-size: 2rem" class="icon iconfont icon-order"></span> <span style="color: #ffffff;font-size: 2rem" class="icon iconfont icon-order"></span>
</button> </button>
</ion-buttons> </ion-buttons>
<ion-buttons end> <ion-buttons end *ngIf="role.includes(1) || role.includes(6)">
<button ion-button icon-only (click)="goVerify()" class="toolbar-icon"> <button ion-button icon-only (click)="goVerify()" class="toolbar-icon">
<span style="color: #ffffff;font-size: 2.5rem" class="icon iconfont icon-shenhe"></span> <span style="color: #ffffff;font-size: 2.5rem" class="icon iconfont icon-shenhe"></span>
</button> </button>
......
...@@ -9,6 +9,7 @@ import {SpcesComponent} from "../../../components/spces/spces"; ...@@ -9,6 +9,7 @@ import {SpcesComponent} from "../../../components/spces/spces";
import {GoodsCartPage} from "./goods-cart/goods-cart"; import {GoodsCartPage} from "./goods-cart/goods-cart";
import {GoodsOrderPage} from "./goods-order/goods-order"; import {GoodsOrderPage} from "./goods-order/goods-order";
import {GoodsVerifyPage} from "./goods-verify/goods-verify"; import {GoodsVerifyPage} from "./goods-verify/goods-verify";
import {Storage} from "@ionic/storage";
@IonicPage() @IonicPage()
...@@ -35,15 +36,22 @@ export class GoodsCollectPage { ...@@ -35,15 +36,22 @@ export class GoodsCollectPage {
loadMore = true; loadMore = true;
chooseObj; chooseObj;
role = [];
constructor(public navCtrl: NavController, public navParams: NavParams, constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, private modalCtrl: ModalController, private serveSer: ServeService, private modalCtrl: ModalController,
private commonSer: CommonService) { private commonSer: CommonService,private storage:Storage) {
} }
ionViewDidLoad() { ionViewDidLoad(){
this.getList(); this.getList();
this.getTypeList(); this.getTypeList();
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
}
)
} }
search() { search() {
......
...@@ -77,7 +77,6 @@ export class GoodsVerifyPage { ...@@ -77,7 +77,6 @@ export class GoodsVerifyPage {
} else { } else {
this.chooseObj.push(goods.id); this.chooseObj.push(goods.id);
} }
console.log(this.chooseObj);
} }
//全选 //全选
......
...@@ -6,6 +6,7 @@ import {Storage} from '@ionic/storage'; ...@@ -6,6 +6,7 @@ import {Storage} from '@ionic/storage';
import {TabsService} from "../tabs.service"; import {TabsService} from "../tabs.service";
import {EmitService} from "../../../provide/emit.service"; import {EmitService} from "../../../provide/emit.service";
import {MineService} from "../../mine-pages/mine.service"; import {MineService} from "../../mine-pages/mine.service";
import {AppMainService} from "../../../app/app.service";
@Component({ @Component({
...@@ -31,7 +32,7 @@ export class MinePage { ...@@ -31,7 +32,7 @@ export class MinePage {
constructor(public navCtrl: NavController, private mineSer: MineService, constructor(public navCtrl: NavController, private mineSer: MineService,
public navParams: NavParams, public tabSer: TabsService, public navParams: NavParams, public tabSer: TabsService,
public appService: AppService, public emitSer: EmitService, public appService: AppService, public emitSer: EmitService,
public storage: Storage, public app: App,) { public storage: Storage, public app: App,private appMainSer:AppMainService) {
// 接收发射过来的数据 // 接收发射过来的数据
this.emitSer.eventEmit.subscribe((value: any) => { this.emitSer.eventEmit.subscribe((value: any) => {
if (!isNaN(value)) { if (!isNaN(value)) {
...@@ -54,12 +55,10 @@ export class MinePage { ...@@ -54,12 +55,10 @@ export class MinePage {
); );
//获取权限 //获取权限
this.storage.get('role').then( this.appMainSer.role.subscribe(value => {
(res)=>{ this.role = value;
this.role = res;
console.log(this.role)
} }
) );
} }
getCheckList() { getCheckList() {
......
...@@ -12,6 +12,7 @@ import {DiscoverPage} from "./discover/discover"; ...@@ -12,6 +12,7 @@ import {DiscoverPage} from "./discover/discover";
import {TabsService} from "./tabs.service"; import {TabsService} from "./tabs.service";
import {KeyPage} from "./key/key"; import {KeyPage} from "./key/key";
import {CommonService} from "../../provide/common.service"; import {CommonService} from "../../provide/common.service";
import {AppMainService} from "../../app/app.service";
@Component({ @Component({
templateUrl: 'tabs.html' templateUrl: 'tabs.html'
...@@ -56,7 +57,7 @@ export class TabsPage { ...@@ -56,7 +57,7 @@ export class TabsPage {
public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController, public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController,
public storage: Storage, public event: Events, public render: Renderer, public storage: Storage, public event: Events, public render: Renderer,
public tabSer: TabsService, public appService: AppService, private backButtonService: BackButtonService, public tabSer: TabsService, public appService: AppService, private backButtonService: BackButtonService,
public platform: Platform,private commonSer:CommonService public platform: Platform,private commonSer:CommonService,private appMainSer:AppMainService,
) { ) {
this.tabRoots = [{ this.tabRoots = [{
root: HomePage, root: HomePage,
...@@ -94,7 +95,7 @@ export class TabsPage { ...@@ -94,7 +95,7 @@ export class TabsPage {
this.tabSer.getRoles().subscribe( this.tabSer.getRoles().subscribe(
(res) => { (res) => {
if(res.errcode == 1000){ if(res.errcode == 1000){
this.storage.set('role',res.data); this.appMainSer.setRole(res.data);
}else{ }else{
this.commonSer.toast('获取权限失败'); this.commonSer.toast('获取权限失败');
} }
......
...@@ -60,9 +60,9 @@ export class AppService { ...@@ -60,9 +60,9 @@ export class AppService {
str = '/' + str.substring(0, str.length - 1); str = '/' + str.substring(0, str.length - 1);
} }
if (flag == 'post') { //post a=b&c=d if (flag == 'post') { //post a=b&c=d
for (var key in params) { for (let key in params) {
if (params.hasOwnProperty(key)) { if (params.hasOwnProperty(key)) {
var value = params[key]; let value = params[key];
str += key + '=' + value + '&'; str += key + '=' + value + '&';
} }
} }
...@@ -166,15 +166,6 @@ export class AppService { ...@@ -166,15 +166,6 @@ export class AppService {
} }
ObserverHttpPostForm(url, params) {
return this.http.post(AppGlobal.domain + url, null, { //app
params: params,
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded,charset=UTF-8'
})
})
}
//post请求 //post请求
ObserverHttpPost(url, params) { ObserverHttpPost(url, params) {
return this.http.post(AppGlobal.domain + url, null, { //app return this.http.post(AppGlobal.domain + url, null, { //app
...@@ -196,15 +187,6 @@ export class AppService { ...@@ -196,15 +187,6 @@ export class AppService {
} }
//post请求 params+body
ObserverHttpPostParamsBody(url, params, data) {
return this.http.post(AppGlobal.domain + url + params, data, { //app
headers: new Headers({
"Content-Type": "application/json"
})
})
}
//put请求 //put请求
ObserverHttpPut(url, params, data) { ObserverHttpPut(url, params, data) {
return this.http.put(AppGlobal.domain + url + params, data, { //app return this.http.put(AppGlobal.domain + url + params, data, { //app
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment