Commit ce5309c4 authored by wangqinghua's avatar wangqinghua

权限更新

parent 38816725
......@@ -26,7 +26,6 @@ import {PersonListPage} from "../pages/contact/person-list/person-list";
import {DatePipe} from "@angular/common";
import {BlockModalPage} from "../pages/home/activity-track/block-modal/block-modal";
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 {LoginService} from "../pages/login/login.service";
import {LearnManageService} from "../pages/home/learn-manage/learnManage.service";
......@@ -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 {MeetRoomPageModule} from "../pages/serve-pages/meet-room/meet-room.module";
import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
import {AppMainService} from "./app.service";
@NgModule({
......@@ -87,7 +87,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
GoodsCollectPageModule,
HairCutPageModule,
MeetRoomPageModule,
UseCarPageModule
UseCarPageModule,
],
bootstrap: [IonicApp],
entryComponents: [
......@@ -128,6 +128,7 @@ import {UseCarPageModule} from "../pages/serve-pages/use-car/use-car.module";
TabsService,
MineService,
EmitService,
AppMainService,
{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';
import { Storage } from "@ionic/storage";
import {ContactListPage} from '../contactList/contactList';
import {MyBlockPage} from "../my-block/my-block";
import {AppMainService} from "../../../app/app.service";
@IonicPage()
@Component({
......@@ -34,10 +35,8 @@ export class ContractPersoninfoPage {
role = []; //权限
nowOrgName;
constructor(public navCtrl: NavController,
public navParams: NavParams,
public appService: AppService,
public storage: Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams,
public appService: AppService, public storage: Storage,private appMainSer:AppMainService) {
}
ionViewDidEnter() {
......@@ -52,11 +51,10 @@ export class ContractPersoninfoPage {
});
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
this.appMainSer.role.subscribe(value => {
this.role = value;
}
)
);
}
//获取当前登录人部门
......
......@@ -6,6 +6,7 @@ import {Storage} from "@ionic/storage";
import {Camera, CameraOptions} from "@ionic-native/camera";
import {FileTransfer, FileTransferObject, FileUploadOptions} from "@ionic-native/file-transfer";
import {AppGlobal} from "../../../service/http.service";
import {AppMainService} from "../../../app/app.service";
@IonicPage()
@Component({
......@@ -65,7 +66,7 @@ export class PublishPage {
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage,
public camera: Camera, public actionSheetCtrl: ActionSheetController,
public loadingCtrl: LoadingController, public transfer: FileTransfer,
private tabsSer: TabsService,
private tabsSer: TabsService,private appMainSer:AppMainService,
public commonSer: CommonService, public tabSer: TabsService) {
}
......@@ -77,12 +78,10 @@ export class PublishPage {
})
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
console.log(this.role)
this.appMainSer.role.subscribe(value => {
this.role = value;
}
)
);
}
ionViewWillLeave(){
......
......@@ -6,6 +6,7 @@ import {ChangeApplyListPage} from "../manageDuty/change-apply-list/change-apply-
import {SurveryPage} from "../mySurvey/survery/survery";
import {TabsService} from "../../tabs/tabs.service";
import {Storage} from "@ionic/storage";
import {AppMainService} from "../../../app/app.service";
@IonicPage()
@Component({
......@@ -24,16 +25,15 @@ export class MoreAppPage {
};
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() {
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
this.appMainSer.role.subscribe(value => {
this.role = value;
}
)
);
}
/**
......
......@@ -12,7 +12,7 @@
<span style="color: #ffffff;font-size: 2rem" class="icon iconfont icon-order"></span>
</button>
</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">
<span style="color: #ffffff;font-size: 2.5rem" class="icon iconfont icon-shenhe"></span>
</button>
......
......@@ -9,6 +9,7 @@ import {SpcesComponent} from "../../../components/spces/spces";
import {GoodsCartPage} from "./goods-cart/goods-cart";
import {GoodsOrderPage} from "./goods-order/goods-order";
import {GoodsVerifyPage} from "./goods-verify/goods-verify";
import {Storage} from "@ionic/storage";
@IonicPage()
......@@ -35,15 +36,22 @@ export class GoodsCollectPage {
loadMore = true;
chooseObj;
role = [];
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, private modalCtrl: ModalController,
private commonSer: CommonService) {
private commonSer: CommonService,private storage:Storage) {
}
ionViewDidLoad() {
ionViewDidLoad(){
this.getList();
this.getTypeList();
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
}
)
}
search() {
......
......@@ -77,7 +77,6 @@ export class GoodsVerifyPage {
} else {
this.chooseObj.push(goods.id);
}
console.log(this.chooseObj);
}
//全选
......
......@@ -6,6 +6,7 @@ import {Storage} from '@ionic/storage';
import {TabsService} from "../tabs.service";
import {EmitService} from "../../../provide/emit.service";
import {MineService} from "../../mine-pages/mine.service";
import {AppMainService} from "../../../app/app.service";
@Component({
......@@ -31,7 +32,7 @@ export class MinePage {
constructor(public navCtrl: NavController, private mineSer: MineService,
public navParams: NavParams, public tabSer: TabsService,
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) => {
if (!isNaN(value)) {
......@@ -54,12 +55,10 @@ export class MinePage {
);
//获取权限
this.storage.get('role').then(
(res)=>{
this.role = res;
console.log(this.role)
this.appMainSer.role.subscribe(value => {
this.role = value;
}
)
);
}
getCheckList() {
......
......@@ -12,6 +12,7 @@ import {DiscoverPage} from "./discover/discover";
import {TabsService} from "./tabs.service";
import {KeyPage} from "./key/key";
import {CommonService} from "../../provide/common.service";
import {AppMainService} from "../../app/app.service";
@Component({
templateUrl: 'tabs.html'
......@@ -56,7 +57,7 @@ export class TabsPage {
public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController,
public storage: Storage, public event: Events, public render: Renderer,
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 = [{
root: HomePage,
......@@ -94,7 +95,7 @@ export class TabsPage {
this.tabSer.getRoles().subscribe(
(res) => {
if(res.errcode == 1000){
this.storage.set('role',res.data);
this.appMainSer.setRole(res.data);
}else{
this.commonSer.toast('获取权限失败');
}
......
......@@ -60,9 +60,9 @@ export class AppService {
str = '/' + str.substring(0, str.length - 1);
}
if (flag == 'post') { //post a=b&c=d
for (var key in params) {
for (let key in params) {
if (params.hasOwnProperty(key)) {
var value = params[key];
let value = params[key];
str += key + '=' + value + '&';
}
}
......@@ -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请求
ObserverHttpPost(url, params) {
return this.http.post(AppGlobal.domain + url, null, { //app
......@@ -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请求
ObserverHttpPut(url, params, data) {
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