找回密码
 立即注册
搜索

技术分享 快应用隐私政策弹窗

1
回复
796
查看
[复制链接]

1

主题

1

帖子

10

积分

 楼主| 2024-4-29 01:37:02 显示全部楼层 |阅读模式

快应用隐私政策弹窗,下面的代码在华为快应用官网上可以运行,但是放入到快应用官网的开发工具怎么就运行不起来了,

如果想要在快应用官网的开发工具上进行运行应该怎么进行修改

<template>

  <!-- Only one root node is allowed in template. -->

  <div class="container">

    <stack>

  

      <block if="{{ display }}">

     <div class="label">

        <stack style="justify-content: center; align-items: center;">

            <div style="width: 100%;height:100%;background-color: rgb(27, 26, 26);opacity: 0.9;"></div>

            <div class="container1">

                <text style="font-size: 50px;font-weight: 700;margin-top: 30px">欢迎使用快应用</text>

                <text style="font-weight: 400;margin-top: 40px;text-indent:60px;margin-left: 20px;margin-right: 20px">

我们郑重承诺重视并保护用户的个人信息。我们秉承“一切以用户价值为依归”的理念,增强您对信息管理的便捷性,

保障您的信息及通信安全。我们严格遵守法律法规,遵循以下隐私保护原则,为您提供更加安全、可靠的服务。</text>

                <text style="font-weight: 400;margin-left: 20px;text-indent:60px;margin-right: 20px"><span>点击“同意”,

即表示您同意上述内容及<a style="color: #0000ff;" href="https://developer.huawei.com/consumer/cn/doc/quickApp-Guides/quickapp-case-0000001082020374">《用户协议》</a> <span>、<a style="color: #0000ff;" href="https://developer.huawei.com/consumer/cn/doc/quickApp-Guides/quickapp-faq-0000001129279483">《隐私政策》</a></text>

                <div style="width: 100%;margin-top: 25px">

                    <text class="cancel" onclick="cancel">取消</text>

                    <text class="agree" onclick="agree">同意上述描述内容</text>

                </div>

            </div>

        </stack>

    </div>

      </block>

    </stack>

  </div>

</template>

<style>

  .container {

    flex-direction: column;

    justify-content: center;

    align-items: center;

    background-color: #d39b75;

  }

      .label {

        justify-content: center;

        align-items: center;

        height: 1440px;

    }

    .container1 {

        width: 510px;

        height: 600px;

        border-radius: 30px;

        flex-direction: column;

        justify-content: center;

        align-items: center;

        background-color: white;

    }

    .agree {

        width: 70%;

        height: 80px;

        text-align: center;

        border-bottom-right-radius: 30px;

        background-color: orange;

        color: white;

    }

    .cancel {

        width: 30%;

        height: 80px;

        text-align: center;

        border-bottom-left-radius: 30px;

        background-color: grey;

    }

</style>

<script>

  import storage from "@system.storage";

  import router from "@system.router";

  module.exports = {

    private: {

      display: false,

      isagree: "disagree"

    },

    onInit() {

      this.$page.setTitleBar({

        text: "menu",

        textColor: "#ffffff",

        backgroundColor: "#007DFF",

        backgroundOpacity: 0.5,

        menu: true

      });

    },

    onShow(options) {

      var that = this;

      that.get();

      setTimeout(() => {

        if (that.isagree === "agree") {

          that.display = false;

        } else {

          setTimeout(() => {

            that.display = true;

          }, 100);

        }

      }, 500);

      console.log("message", that.isagree);

      this.$on("dispatchEvent", this.dispatchEvent);

    },

    dispatchEvent(evt) {

      this.display = evt.detail.display;

      this.isagree = evt.detail.isagree;

      this.save(this.isagree);

    },

    save(params) {

      storage.set({

        key: "agreeFlag",

        value: params,

        success: function (data) {

          console.log("handling success");

        },

        fail: function (data, code) {

          console.log("handling fail, code = " + code);

        }

      });

    },

    get() {

      var that = this;

      storage.get({

        key: "agreeFlag",

        success: function (data) {

          that.isagree = data;

          console.log("handling success", data);

        },

        fail: function (data, code) {

          console.log("handling fail, code = " + code);

        }

      });

    },

            agree() {

            this.$dispatch("dispatchEvent", {

                display: false,

                isagree: "agree"

            });

        },

        cancel() {

            this.$app.exit();

        }

  };

</script>

回复

使用道具 举报

5

主题

45

帖子

250

积分

2024-5-23 10:59:54 来自手机 显示全部楼层
快应用官方IDE里直接新建一个项目建一个页面,代码放进去运行就行
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册