山东大学项目实训之安卓mainActivity及权限菜单树

安卓端mainActivity及权限菜单树
不良事件管理系统有五种角色,分别是普通职工、质控办、职能科室主任、非职能科室主任、医院领导。
普通职工权限
在这里插入图片描述
质控办权限
在这里插入图片描述
领导:相似
职能科室主任
在这里插入图片描述
非职能:相似
Okhttp实现代码

 OkHttpClient mOkHttpClient = new OkHttpClient();

        Request request = new Request.Builder()
                .header("token", name2)
                .url("http://43.138.24.19/user/getMenuTree")
                .method("GET",null).build();
//3,创建call对象并将请求对象添加到调度中
        Log.i("request",request.toString());
        mOkHttpClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                Log.e("测试", e+"");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                Log.e("测试", response.code()+"");

                Gson gson = new Gson();
                String msg = response.body().string();
                Log.v("body", "body=" + msg);

                Type listType = new TypeToken<ResponseTypes<List<eventtype>>>() {
                }.getType();
                final ResponseTypes data2 = gson.fromJson(msg, listType);
                //ResponseData data2 = gson.fromJson(msg,ResponseData.class);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            typeslist = data2.getData2();
                            ;

                            for (int i = 0; i < typeslist.size(); i++) {
                                int temp = typeslist.get(i).getId();
                                Log.v("body", "body=" + temp);
                                if (temp == 3) {
                                    receive_btn.setVisibility(View.VISIBLE);
                                }
                                if (temp == 4) {
                                    analysis2_btn.setVisibility(View.VISIBLE);
                                }
                                if (temp == 5) {
                                    analysis_btn.setVisibility(View.VISIBLE);
                                }
                                if (temp == 6) {
                                    statistic.setVisibility(View.VISIBLE);
                                }
                                if (temp == 7) {
                                    statistic2.setVisibility(View.VISIBLE);
                                }
                            }
                        }catch (Exception e){
                            Toast.makeText(getApplicationContext(), "请求未成功", Toast.LENGTH_SHORT).show();
                        }
                    }
                });
            }

        });

按钮点击事件

 report_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, ReportActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "上报事件", Toast.LENGTH_SHORT).show();
            }
        });
        search_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(SlideActivity.this, ReportListActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "查询事件", Toast.LENGTH_SHORT).show();
            }
        });
        receive_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, ExamineListActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "我的受理", Toast.LENGTH_SHORT).show();
            }
        });
        analysis_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, RectifyListActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "我的受理", Toast.LENGTH_SHORT).show();
            }
        });
        analysis2_btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, InvolvedRectifyListActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "我的受理", Toast.LENGTH_SHORT).show();
            }
        });
        statistic1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, EchatsActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "统计分析", Toast.LENGTH_SHORT).show();
            }
        });
        statistic21.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SlideActivity.this, DepartmentEchartsActivity.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "统计分析(科室主任)", Toast.LENGTH_SHORT).show();
            }
        });

按钮用cardview做圆角

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="410dp"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp"
    android:background="@color/colorWhiteblue"
    tools:context=".MainActivity">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">


    <ImageView
        android:id="@+id/image_head"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:src="@mipmap/ic_launcher_round" />


    <androidx.cardview.widget.CardView
        android:id="@+id/cardview1"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginTop="10dp"
        app:cardCornerRadius="15dp"
        app:cardBackgroundColor="@color/colorLightblue"

        >

        <Button
            android:id="@+id/main_button1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:text="不良事件上报"
            android:textSize="25sp"
            android:background="@color/colorWhiteblue"/>
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/cardview2"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginTop="10dp"
        app:cardBackgroundColor="@color/colorLightblue"
        app:cardCornerRadius="15dp"

        >
        <Button
            android:id="@+id/main_button2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:text="不良事件查询"
            android:textSize="25sp"
            android:background="@color/colorWhiteblue"/>


    </androidx.cardview.widget.CardView>
        <androidx.cardview.widget.CardView
            android:id="@+id/cardview3"
            android:visibility="gone"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginTop="10dp"
            app:cardBackgroundColor="@color/colorLightblue"
            app:cardCornerRadius="15dp"

            >
            <Button
                android:id="@+id/main_button3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="待处理不良事件(质控办)"
                android:textSize="25sp"
                android:background="@color/colorWhiteblue"/>

        </androidx.cardview.widget.CardView>

        <androidx.cardview.widget.CardView
            android:id="@+id/cardview4"

            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginTop="10dp"
            android:visibility="gone"
            app:cardBackgroundColor="@color/colorLightblue"
            app:cardElevation="5dp"
            app:cardCornerRadius="15dp">
            <Button
                android:id="@+id/main_button4"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="待处理不良事件(职能科室)"
                android:textSize="25sp"
                android:background="@color/colorWhiteblue"/>

        </androidx.cardview.widget.CardView>
    <androidx.cardview.widget.CardView
        android:id="@+id/cardview5"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginTop="10dp"
        android:visibility="gone"
        app:cardBackgroundColor="@color/colorLightblue"
        app:cardElevation="5dp"
        app:cardCornerRadius="15dp">
        <Button
            android:id="@+id/main_button5"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="待处理不良事件(非职能科室)"
            android:textSize="25sp"
            android:background="@color/colorWhiteblue"/>

    </androidx.cardview.widget.CardView>
    <androidx.cardview.widget.CardView
    android:id="@+id/cardview6"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_marginTop="10dp"
    android:visibility="gone"
    app:cardBackgroundColor="@color/colorLightblue"

    app:cardCornerRadius="15dp">
    <Button
        android:id="@+id/main_button6"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="查询统计"
        android:textSize="25sp"
        android:background="@color/colorWhiteblue"/>

</androidx.cardview.widget.CardView>
    <androidx.cardview.widget.CardView
        android:id="@+id/cardview7"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_marginTop="10dp"
        android:visibility="gone"
        app:cardBackgroundColor="@color/colorLightblue"

        app:cardCornerRadius="15dp">
        <Button
            android:id="@+id/main_button7"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="查询统计(科室主任)"
            android:textSize="25sp"
            android:background="@color/colorWhiteblue"/>

    </androidx.cardview.widget.CardView>
</LinearLayout>
    </ScrollView>
</LinearLayout>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值