Commit d23e83f1 by 李伟康

更新

1 parent 6ed60ea4
import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 3
let index = 2
/**
*
......
......@@ -97,13 +97,14 @@ var privacyHandler = void 0;
var privacyResolves = new Set();
var closeOtherPagePopUpHooks = new Set();
wx.onNeedPrivacyAuthorization(function (resolve) {
console.log(resolve, '-=-=-=-=-=-');
if (typeof privacyHandler === 'function') {
privacyHandler(resolve);
}
});
if (wx.onNeedPrivacyAuthorization) {
wx.onNeedPrivacyAuthorization(function (resolve) {
console.log(resolve, '-=-=-=-=-=-');
if (typeof privacyHandler === 'function') {
privacyHandler(resolve);
}
});
}
var closeOtherPagePopUp = function closeOtherPagePopUp(closePopUp) {
closeOtherPagePopUpHooks.forEach(function (hook) {
if (closePopUp !== hook) {
......@@ -117,18 +118,17 @@ Component({
appletName: {
type: String,
value: ''
},
text: {
type: String,
value: ''
}
},
data: {
title: '用户隐私保护提示',
desc1: '感谢您使用本游戏,您使用本游戏前应当阅井同意',
urlTitle: '《用户隐私保护指引》',
desc2: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。',
showPrivacy: false,
height: 0
showPrivacy: false
},
lifetimes: {
attached: function attached() {
pageLifetimes: {
show: function show() {
var _this = this;
var closePopUp = function closePopUp() {
......@@ -144,7 +144,7 @@ Component({
this.closePopUp = closePopUp;
},
detached: function detached() {
hide: function hide() {
closeOtherPagePopUpHooks.delete(this.closePopUp);
}
},
......@@ -172,6 +172,7 @@ Component({
this.triggerEvent('disagreeClick');
},
popUp: function popUp() {
console.log('showPrivacy', this.data.showPrivacy);
if (this.data.showPrivacy === false) {
this.setData({
showPrivacy: true
......
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/GlsxPrivacy/index.js"],"names":["privacyHandler","privacyResolves","Set","closeOtherPagePopUpHooks","wx","onNeedPrivacyAuthorization","console","log","resolve","closeOtherPagePopUp","closePopUp","forEach","hook","Component","properties","appletName","type","String","value","data","title","desc1","urlTitle","desc2","showPrivacy","height","lifetimes","attached","disPopUp","add","popUp","detached","delete","methods","handleAgree","event","buttonId","clear","triggerEvent","handleDisagree","setData","openPrivacyContract","success","fail","error","res","handleOpenPrivacyContract","complete"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;AClFA,IAAIA,uBAAJ;AACA,IAAMC,kBAAkB,IAAIC,GAAJ,EAAxB;AACA,IAAMC,2BAA2B,IAAID,GAAJ,EAAjC;;AAEAE,GAAGC,0BAAH,CAA8B,mBAAW;AACvCC,UAAQC,GAAR,CAAYC,OAAZ,EAAqB,aAArB;AACA,MAAI,OAAOR,cAAP,KAA0B,UAA9B,EAA0C;AACxCA,mBAAeQ,OAAf;AACD;AACF,CALD;;AAOA,IAAMC,sBAAsB,SAAtBA,mBAAsB,CAACC,UAAD,EAAgB;AAC1CP,2BAAyBQ,OAAzB,CAAiC,gBAAQ;AACvC,QAAID,eAAeE,IAAnB,EAAyB;AACvBA;AACD;AACF,GAJD;AAKD,CAND;;AAQAC,UAAU;AACRC,cAAY;AACVC,gBAAY;AACVC,YAAMC,MADI;AAEVC,aA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,EAAoC;AAClC,aAAKgB,OAAL,CAAa;AACXhB,uBAAa;AADF,SAAb;AAGD;AACF,KApCM;AAqCPiB,uBArCO,iCAqCe;AACpBrC,SAAGqC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM;AACbpC,kBAAQC,GAAR,CAAY,6BAAZ;AACD,SAHoB;AAIrBoC,cAAM,mBAAO;AACXrC,kBAAQsC,KAAR,CAAc,0BAAd,EAA0CC,GAA1C;AACD;AANoB,OAAvB;AAQD,KA9CM;AA+CPC,6BA/CO,uCA+CqB;AAC1B;AACA1C,SAAGqC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM,CAAE,CADI,EACF;AACnBC,cAAM,gBAAM,CAAE,CAFO,EAEL;AAChBI,kBAAU,oBAAM,CAAE;AAHG,OAAvB;AAKD;AAtDM;AAlCD,CAAV,E","file":"GlsxPrivacy\\index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 23);\n","let privacyHandler\r\nconst privacyResolves = new Set()\r\nconst closeOtherPagePopUpHooks = new Set()\r\n\r\nwx.onNeedPrivacyAuthorization(resolve => {\r\n console.log(resolve, '-=-=-=-=-=-')\r\n if (typeof privacyHandler === 'function') {\r\n privacyHandler(resolve)\r\n }\r\n})\r\n\r\nconst closeOtherPagePopUp = (closePopUp) => {\r\n closeOtherPagePopUpHooks.forEach(hook => {\r\n if (closePopUp !== hook) {\r\n hook()\r\n }\r\n })\r\n}\r\n\r\nComponent({\r\n properties: {\r\n appletName: {\r\n type: String,\r\n value: ''\r\n }\r\n },\r\n data: {\r\n title: '用户隐私保护提示',\r\n desc1: '感谢您使用本游戏,您使用本游戏前应当阅井同意',\r\n urlTitle: '《用户隐私保护指引》',\r\n desc2: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。',\r\n showPrivacy: false,\r\n height: 0,\r\n },\r\n lifetimes: {\r\n attached: function () {\r\n const closePopUp = () => {\r\n this.disPopUp()\r\n }\r\n privacyHandler = resolve => {\r\n privacyResolves.add(resolve)\r\n this.popUp()\r\n // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗\r\n closeOtherPagePopUp(closePopUp)\r\n }\r\n closeOtherPagePopUpHooks.add(closePopUp)\r\n\r\n this.closePopUp = closePopUp\r\n },\r\n detached: function () {\r\n closeOtherPagePopUpHooks.delete(this.closePopUp)\r\n }\r\n },\r\n methods: {\r\n handleAgree() {\r\n this.disPopUp()\r\n // 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'agree',\r\n buttonId: 'agree-btn'\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('agreeClick')\r\n },\r\n handleDisagree() {\r\n this.disPopUp()\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'disagree',\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('disagreeClick')\r\n },\r\n popUp() {\r\n if (this.data.showPrivacy === false) {\r\n this.setData({\r\n showPrivacy: true\r\n })\r\n }\r\n },\r\n disPopUp() {\r\n if (this.data.showPrivacy === true) {\r\n this.setData({\r\n showPrivacy: false\r\n })\r\n }\r\n },\r\n openPrivacyContract() {\r\n wx.openPrivacyContract({\r\n success: () => {\r\n console.log('openPrivacyContract success')\r\n },\r\n fail: res => {\r\n console.error('openPrivacyContract fail', res)\r\n }\r\n })\r\n },\r\n handleOpenPrivacyContract() {\r\n // 打开隐私协议页面\r\n wx.openPrivacyContract({\r\n success: () => {}, // 打开成功\r\n fail: () => {}, // 打开失败\r\n complete: () => {}\r\n })\r\n }\r\n }\r\n})\r\n"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/GlsxPrivacy/index.js"],"names":["privacyHandler","privacyResolves","Set","closeOtherPagePopUpHooks","wx","onNeedPrivacyAuthorization","console","log","resolve","closeOtherPagePopUp","closePopUp","forEach","hook","Component","properties","appletName","type","String","value","text","data","showPrivacy","pageLifetimes","show","disPopUp","add","popUp","hide","delete","methods","handleAgree","event","buttonId","clear","triggerEvent","handleDisagree","setData","openPrivacyContract","success","fail","error","res","handleOpenPrivacyContract","complete"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;AClFA,IAAIA,uBAAJ;AACA,IAAMC,kBAAkB,IAAIC,GAAJ,EAAxB;AACA,IAAMC,2BAA2B,IAAID,GAAJ,EAAjC;;AAEA,IAAIE,GAAGC,0BAAP,EAAmC;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,mBAAW;AACjCH,gBAAQ;AACNuB,iBAAO;AADD,SAAR;AAGD,OAJD;AAKA9B,sBAAgBgC,KAAhB;AACA,WAAKC,YAAL,CAAkB,eAAlB;AACD,KAtBM;AAuBPR,SAvBO,mBAuBC;AACNpB,cAAQC,GAAR,CAAY,aAAZ,EAA2B,KAAKa,IAAL,CAAUC,WAArC;AACA,UAAI,KAAKD,IAAL,CAAUC,WAAV,KAA0B,KAA9B,EAAqC;AACnC,aAAKe,OAAL,CAAa;AACXf,uBAAa;AADF,SAAb;AAGD;AACF,KA9BM;AA+BPG,YA/BO,sBA+BI;AACT,UAAI,KAAKJ,IAAL,CAAUC,WAAV,KAA0B,IAA9B,EAAoC;AAClC,aAAKe,OAAL,CAAa;AACXf,uBAAa;AADF,SAAb;AAGD;AACF,KArCM;AAsCPgB,uBAtCO,iCAsCe;AACpBjC,SAAGiC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM;AACbhC,kBAAQC,GAAR,CAAY,6BAAZ;AACD,SAHoB;AAIrBgC,cAAM,mBAAO;AACXjC,kBAAQkC,KAAR,CAAc,0BAAd,EAA0CC,GAA1C;AACD;AANoB,OAAvB;AAQD,KA/CM;AAgDPC,6BAhDO,uCAgDqB;AAC1B;AACAtC,SAAGiC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM,CAAE,CADI,EACF;AACnBC,cAAM,gBAAM,CAAE,CAFO,EAEL;AAChBI,kBAAU,oBAAM,CAAE;AAHG,OAAvB;AAKD;AAvDM;AAjCD,CAAV,E","file":"GlsxPrivacy\\index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 23);\n","let privacyHandler\r\nconst privacyResolves = new Set()\r\nconst closeOtherPagePopUpHooks = new Set()\r\n\r\nif (wx.onNeedPrivacyAuthorization) {\r\n wx.onNeedPrivacyAuthorization(resolve => {\r\n console.log(resolve, '-=-=-=-=-=-')\r\n if (typeof privacyHandler === 'function') {\r\n privacyHandler(resolve)\r\n }\r\n })\r\n}\r\nconst closeOtherPagePopUp = (closePopUp) => {\r\n closeOtherPagePopUpHooks.forEach(hook => {\r\n if (closePopUp !== hook) {\r\n hook()\r\n }\r\n })\r\n}\r\n\r\nComponent({\r\n properties: {\r\n appletName: {\r\n type: String,\r\n value: ''\r\n },\r\n text: {\r\n type: String,\r\n value: ''\r\n }\r\n },\r\n data: {\r\n showPrivacy: false,\r\n },\r\n pageLifetimes: {\r\n show: function () {\r\n const closePopUp = () => {\r\n this.disPopUp()\r\n }\r\n privacyHandler = resolve => {\r\n privacyResolves.add(resolve)\r\n this.popUp()\r\n // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗\r\n closeOtherPagePopUp(closePopUp)\r\n }\r\n closeOtherPagePopUpHooks.add(closePopUp)\r\n\r\n this.closePopUp = closePopUp\r\n },\r\n hide: function () {\r\n closeOtherPagePopUpHooks.delete(this.closePopUp)\r\n }\r\n },\r\n methods: {\r\n handleAgree() {\r\n this.disPopUp()\r\n // 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'agree',\r\n buttonId: 'agree-btn'\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('agreeClick')\r\n },\r\n handleDisagree() {\r\n this.disPopUp()\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'disagree',\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('disagreeClick')\r\n },\r\n popUp() {\r\n console.log('showPrivacy', this.data.showPrivacy);\r\n if (this.data.showPrivacy === false) {\r\n this.setData({\r\n showPrivacy: true\r\n })\r\n }\r\n },\r\n disPopUp() {\r\n if (this.data.showPrivacy === true) {\r\n this.setData({\r\n showPrivacy: false\r\n })\r\n }\r\n },\r\n openPrivacyContract() {\r\n wx.openPrivacyContract({\r\n success: () => {\r\n console.log('openPrivacyContract success')\r\n },\r\n fail: res => {\r\n console.error('openPrivacyContract fail', res)\r\n }\r\n })\r\n },\r\n handleOpenPrivacyContract() {\r\n // 打开隐私协议页面\r\n wx.openPrivacyContract({\r\n success: () => {}, // 打开成功\r\n fail: () => {}, // 打开失败\r\n complete: () => {}\r\n })\r\n }\r\n }\r\n})\r\n"],"sourceRoot":""}
\ No newline at end of file
<view wx:if="{{showPrivacy}}">
<view hidden="{{!showPrivacy}}">
<view class="pop-wrapper">
<view class="pop-box">
<view class="pop-content">
<view class="pop-title">{{appletName ? appletName : '隐私协议'}}</view>
<view class="pop-text">在您使用{{appletName}}服务之前,请仔细阅读《隐私协议》和《服务使用协议》。如您同意协议内容,请点击“同意”开始使用{{appletName}}。</view>
<view class="pop-text">{{ text ? text : '在您使用' + appletName + '服务之前,请仔细阅读《用户隐私保护指引》。如您同意协议内容,请点击“同意”开始使用' + appletName + '。' }}</view>
<view class="pop-privacy" bindtap="handleOpenPrivacyContract">《用户隐私保护指引》</view>
</view>
<view class="pop-bottom">
......
......@@ -5,7 +5,7 @@
left: 0;
right: 0;
bottom: 0;
z-index: 99;
z-index: 99999999;
}
.pop-box {
position: absolute;
......@@ -63,6 +63,7 @@
border-right: 2rpx solid #ededed;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
color: #000 !important;
}
.agree-btn {
border-top-left-radius: 0;
......
......@@ -4,7 +4,7 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1693791796469, function(require, module, exports) {
__DEFINE__(1693894085372, function(require, module, exports) {
/*
* @Descripttion: api封装类
* @version: 1.0.0
......@@ -225,8 +225,8 @@ class GlMapApi {
}
if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = GlMapApi;
}, function(modId) {var map = {"./request":1693791796470}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693791796470, function(require, module, exports) {
}, function(modId) {var map = {"./request":1693894085373}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693894085373, function(require, module, exports) {
/*
* @Descripttion: 定义一个Request类,用于封装请求高德地图API的方法
* @version: 1.0.0
......@@ -340,8 +340,8 @@ class Request {
}
if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });exports.default = Request;
}, function(modId) { var map = {"./lib/md5":1693791796471,"./lib/qs":1693791796472,"./constants":1693791796473,"./helper":1693791796474}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693791796471, function(require, module, exports) {
}, function(modId) { var map = {"./lib/md5":1693894085374,"./lib/qs":1693894085375,"./constants":1693894085376,"./helper":1693894085377}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693894085374, function(require, module, exports) {
(function () {
......@@ -1017,7 +1017,7 @@ __DEFINE__(1693791796471, function(require, module, exports) {
}
})();
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693791796472, function(require, module, exports) {
__DEFINE__(1693894085375, function(require, module, exports) {
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
......@@ -1658,7 +1658,7 @@ module.exports = {
});
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693791796473, function(require, module, exports) {
__DEFINE__(1693894085376, function(require, module, exports) {
/*
* @Descripttion: 常量类
* @version: 1.0.0
......@@ -1671,7 +1671,7 @@ __DEFINE__(1693791796473, function(require, module, exports) {
if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var MAP_OPTIONS = exports.MAP_OPTIONS = { domain: 'https://restapi.amap.com', KEY: '373bd88fa36ebc0247d60281386b6cec', SECRET: 'a2a93fa04721a36819d86b71cb31fe41' };
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
__DEFINE__(1693791796474, function(require, module, exports) {
__DEFINE__(1693894085377, function(require, module, exports) {
/*
* @Descripttion:帮助类
* @version: 1.0.0
......@@ -1684,7 +1684,7 @@ __DEFINE__(1693791796474, function(require, module, exports) {
if (!exports.__esModule) Object.defineProperty(exports, "__esModule", { value: true });var isMiniprogram = exports.isMiniprogram = !window;
}, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1693791796469);
return __REQUIRE__(1693894085372);
})()
//miniprogram-npm-outsideDeps=["./stringify","./parse","./formats","./utils"]
//# sourceMappingURL=index.js.map
\ No newline at end of file
......@@ -4,7 +4,7 @@ var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexport
var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
__DEFINE__(1693791796475, function(require, module, exports) {
__DEFINE__(1693894085378, function(require, module, exports) {
Object.defineProperty(exports, '__esModule', { value: true });
......@@ -171,7 +171,7 @@ exports.enableBoundaryChecking = enableBoundaryChecking;
exports['default'] = index;
}, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
return __REQUIRE__(1693791796475);
return __REQUIRE__(1693894085378);
})()
//miniprogram-npm-outsideDeps=[]
//# sourceMappingURL=index.js.map
\ No newline at end of file
......@@ -97,13 +97,14 @@ var privacyHandler = void 0;
var privacyResolves = new Set();
var closeOtherPagePopUpHooks = new Set();
wx.onNeedPrivacyAuthorization(function (resolve) {
console.log(resolve, '-=-=-=-=-=-');
if (typeof privacyHandler === 'function') {
privacyHandler(resolve);
}
});
if (wx.onNeedPrivacyAuthorization) {
wx.onNeedPrivacyAuthorization(function (resolve) {
console.log(resolve, '-=-=-=-=-=-');
if (typeof privacyHandler === 'function') {
privacyHandler(resolve);
}
});
}
var closeOtherPagePopUp = function closeOtherPagePopUp(closePopUp) {
closeOtherPagePopUpHooks.forEach(function (hook) {
if (closePopUp !== hook) {
......@@ -117,18 +118,17 @@ Component({
appletName: {
type: String,
value: ''
},
text: {
type: String,
value: ''
}
},
data: {
title: '用户隐私保护提示',
desc1: '感谢您使用本游戏,您使用本游戏前应当阅井同意',
urlTitle: '《用户隐私保护指引》',
desc2: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。',
showPrivacy: false,
height: 0
showPrivacy: false
},
lifetimes: {
attached: function attached() {
pageLifetimes: {
show: function show() {
var _this = this;
var closePopUp = function closePopUp() {
......@@ -144,7 +144,7 @@ Component({
this.closePopUp = closePopUp;
},
detached: function detached() {
hide: function hide() {
closeOtherPagePopUpHooks.delete(this.closePopUp);
}
},
......@@ -172,6 +172,7 @@ Component({
this.triggerEvent('disagreeClick');
},
popUp: function popUp() {
console.log('showPrivacy', this.data.showPrivacy);
if (this.data.showPrivacy === false) {
this.setData({
showPrivacy: true
......
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/GlsxPrivacy/index.js"],"names":["privacyHandler","privacyResolves","Set","closeOtherPagePopUpHooks","wx","onNeedPrivacyAuthorization","console","log","resolve","closeOtherPagePopUp","closePopUp","forEach","hook","Component","properties","appletName","type","String","value","data","title","desc1","urlTitle","desc2","showPrivacy","height","lifetimes","attached","disPopUp","add","popUp","detached","delete","methods","handleAgree","event","buttonId","clear","triggerEvent","handleDisagree","setData","openPrivacyContract","success","fail","error","res","handleOpenPrivacyContract","complete"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;AClFA,IAAIA,uBAAJ;AACA,IAAMC,kBAAkB,IAAIC,GAAJ,EAAxB;AACA,IAAMC,2BAA2B,IAAID,GAAJ,EAAjC;;AAEAE,GAAGC,0BAAH,CAA8B,mBAAW;AACvCC,UAAQC,GAAR,CAAYC,OAAZ,EAAqB,aAArB;AACA,MAAI,OAAOR,cAAP,KAA0B,UAA9B,EAA0C;AACxCA,mBAAeQ,OAAf;AACD;AACF,CALD;;AAOA,IAAMC,sBAAsB,SAAtBA,mBAAsB,CAACC,UAAD,EAAgB;AAC1CP,2BAAyBQ,OAAzB,CAAiC,gBAAQ;AACvC,QAAID,eAAeE,IAAnB,EAAyB;AACvBA;AACD;AACF,GAJD;AAKD,CAND;;AAQAC,UAAU;AACRC,cAAY;AACVC,gBAAY;AACVC,YAAMC,MADI;AAEVC,aAAO;AAFG;AADF,GADJ;AAORC,QAAM;AACJC,WAAO,UADH;AAEJC,WAAO,wBAFH;AAGJC,cAAU,YAHN;AAIJC,WAAO,8DAJH;AAKJC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qC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM;AACbpC,kBAAQC,GAAR,CAAY,6BAAZ;AACD,SAHoB;AAIrBoC,cAAM,mBAAO;AACXrC,kBAAQsC,KAAR,CAAc,0BAAd,EAA0CC,GAA1C;AACD;AANoB,OAAvB;AAQD,KA9CM;AA+CPC,6BA/CO,uCA+CqB;AAC1B;AACA1C,SAAGqC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM,CAAE,CADI,EACF;AACnBC,cAAM,gBAAM,CAAE,CAFO,EAEL;AAChBI,kBAAU,oBAAM,CAAE;AAHG,OAAvB;AAKD;AAtDM;AAlCD,CAAV,E","file":"GlsxPrivacy\\index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 23);\n","let privacyHandler\r\nconst privacyResolves = new Set()\r\nconst closeOtherPagePopUpHooks = new Set()\r\n\r\nwx.onNeedPrivacyAuthorization(resolve => {\r\n console.log(resolve, '-=-=-=-=-=-')\r\n if (typeof privacyHandler === 'function') {\r\n privacyHandler(resolve)\r\n }\r\n})\r\n\r\nconst closeOtherPagePopUp = (closePopUp) => {\r\n closeOtherPagePopUpHooks.forEach(hook => {\r\n if (closePopUp !== hook) {\r\n hook()\r\n }\r\n })\r\n}\r\n\r\nComponent({\r\n properties: {\r\n appletName: {\r\n type: String,\r\n value: ''\r\n }\r\n },\r\n data: {\r\n title: '用户隐私保护提示',\r\n desc1: '感谢您使用本游戏,您使用本游戏前应当阅井同意',\r\n urlTitle: '《用户隐私保护指引》',\r\n desc2: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。',\r\n showPrivacy: false,\r\n height: 0,\r\n },\r\n lifetimes: {\r\n attached: function () {\r\n const closePopUp = () => {\r\n this.disPopUp()\r\n }\r\n privacyHandler = resolve => {\r\n privacyResolves.add(resolve)\r\n this.popUp()\r\n // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗\r\n closeOtherPagePopUp(closePopUp)\r\n }\r\n closeOtherPagePopUpHooks.add(closePopUp)\r\n\r\n this.closePopUp = closePopUp\r\n },\r\n detached: function () {\r\n closeOtherPagePopUpHooks.delete(this.closePopUp)\r\n }\r\n },\r\n methods: {\r\n handleAgree() {\r\n this.disPopUp()\r\n // 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'agree',\r\n buttonId: 'agree-btn'\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('agreeClick')\r\n },\r\n handleDisagree() {\r\n this.disPopUp()\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'disagree',\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('disagreeClick')\r\n },\r\n popUp() {\r\n if (this.data.showPrivacy === false) {\r\n this.setData({\r\n showPrivacy: true\r\n })\r\n }\r\n },\r\n disPopUp() {\r\n if (this.data.showPrivacy === true) {\r\n this.setData({\r\n showPrivacy: false\r\n })\r\n }\r\n },\r\n openPrivacyContract() {\r\n wx.openPrivacyContract({\r\n success: () => {\r\n console.log('openPrivacyContract success')\r\n },\r\n fail: res => {\r\n console.error('openPrivacyContract fail', res)\r\n }\r\n })\r\n },\r\n handleOpenPrivacyContract() {\r\n // 打开隐私协议页面\r\n wx.openPrivacyContract({\r\n success: () => {}, // 打开成功\r\n fail: () => {}, // 打开失败\r\n complete: () => {}\r\n })\r\n }\r\n }\r\n})\r\n"],"sourceRoot":""}
\ No newline at end of file
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/GlsxPrivacy/index.js"],"names":["privacyHandler","privacyResolves","Set","closeOtherPagePopUpHooks","wx","onNeedPrivacyAuthorization","console","log","resolve","closeOtherPagePopUp","closePopUp","forEach","hook","Component","properties","appletName","type","String","value","text","data","showPrivacy","pageLifetimes","show","disPopUp","add","popUp","hide","delete","methods","handleAgree","event","buttonId","clear","triggerEvent","handleDisagree","setData","openPrivacyContract","success","fail","error","res","handleOpenPrivacyContract","complete"],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;AClFA,IAAIA,uBAAJ;AACA,IAAMC,kBAAkB,IAAIC,GAAJ,EAAxB;AACA,IAAMC,2BAA2B,IAAID,GAAJ,EAAjC;;AAEA,IAAIE,GAAGC,0BAAP,EAAmC;AACjCD,KAAGC,0BAAH,CAA8B,mBAAW;AACvCC,YAAQC,GAAR,CAAYC,OAAZ,EAAqB,aAArB;AACA,QAAI,OAAOR,cAAP,KAA0B,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AlB;AACD,KAtBM;AAuBPR,SAvBO,mBAuBC;AACNpB,cAAQC,GAAR,CAAY,aAAZ,EAA2B,KAAKa,IAAL,CAAUC,WAArC;AACA,UAAI,KAAKD,IAAL,CAAUC,WAAV,KAA0B,KAA9B,EAAqC;AACnC,aAAKe,OAAL,CAAa;AACXf,uBAAa;AADF,SAAb;AAGD;AACF,KA9BM;AA+BPG,YA/BO,sBA+BI;AACT,UAAI,KAAKJ,IAAL,CAAUC,WAAV,KAA0B,IAA9B,EAAoC;AAClC,aAAKe,OAAL,CAAa;AACXf,uBAAa;AADF,SAAb;AAGD;AACF,KArCM;AAsCPgB,uBAtCO,iCAsCe;AACpBjC,SAAGiC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM;AACbhC,kBAAQC,GAAR,CAAY,6BAAZ;AACD,SAHoB;AAIrBgC,cAAM,mBAAO;AACXjC,kBAAQkC,KAAR,CAAc,0BAAd,EAA0CC,GAA1C;AACD;AANoB,OAAvB;AAQD,KA/CM;AAgDPC,6BAhDO,uCAgDqB;AAC1B;AACAtC,SAAGiC,mBAAH,CAAuB;AACrBC,iBAAS,mBAAM,CAAE,CADI,EACF;AACnBC,cAAM,gBAAM,CAAE,CAFO,EAEL;AAChBI,kBAAU,oBAAM,CAAE;AAHG,OAAvB;AAKD;AAvDM;AAjCD,CAAV,E","file":"GlsxPrivacy\\index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 23);\n","let privacyHandler\r\nconst privacyResolves = new Set()\r\nconst closeOtherPagePopUpHooks = new Set()\r\n\r\nif (wx.onNeedPrivacyAuthorization) {\r\n wx.onNeedPrivacyAuthorization(resolve => {\r\n console.log(resolve, '-=-=-=-=-=-')\r\n if (typeof privacyHandler === 'function') {\r\n privacyHandler(resolve)\r\n }\r\n })\r\n}\r\nconst closeOtherPagePopUp = (closePopUp) => {\r\n closeOtherPagePopUpHooks.forEach(hook => {\r\n if (closePopUp !== hook) {\r\n hook()\r\n }\r\n })\r\n}\r\n\r\nComponent({\r\n properties: {\r\n appletName: {\r\n type: String,\r\n value: ''\r\n },\r\n text: {\r\n type: String,\r\n value: ''\r\n }\r\n },\r\n data: {\r\n showPrivacy: false,\r\n },\r\n pageLifetimes: {\r\n show: function () {\r\n const closePopUp = () => {\r\n this.disPopUp()\r\n }\r\n privacyHandler = resolve => {\r\n privacyResolves.add(resolve)\r\n this.popUp()\r\n // 额外逻辑:当前页面的隐私弹窗弹起的时候,关掉其他页面的隐私弹窗\r\n closeOtherPagePopUp(closePopUp)\r\n }\r\n closeOtherPagePopUpHooks.add(closePopUp)\r\n\r\n this.closePopUp = closePopUp\r\n },\r\n hide: function () {\r\n closeOtherPagePopUpHooks.delete(this.closePopUp)\r\n }\r\n },\r\n methods: {\r\n handleAgree() {\r\n this.disPopUp()\r\n // 这里演示了同时调用多个wx隐私接口时要如何处理:让隐私弹窗保持单例,点击一次同意按钮即可让所有pending中的wx隐私接口继续执行 (看page/index/index中的 wx.getClipboardData 和 wx.startCompass)\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'agree',\r\n buttonId: 'agree-btn'\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('agreeClick')\r\n },\r\n handleDisagree() {\r\n this.disPopUp()\r\n privacyResolves.forEach(resolve => {\r\n resolve({\r\n event: 'disagree',\r\n })\r\n })\r\n privacyResolves.clear()\r\n this.triggerEvent('disagreeClick')\r\n },\r\n popUp() {\r\n console.log('showPrivacy', this.data.showPrivacy);\r\n if (this.data.showPrivacy === false) {\r\n this.setData({\r\n showPrivacy: true\r\n })\r\n }\r\n },\r\n disPopUp() {\r\n if (this.data.showPrivacy === true) {\r\n this.setData({\r\n showPrivacy: false\r\n })\r\n }\r\n },\r\n openPrivacyContract() {\r\n wx.openPrivacyContract({\r\n success: () => {\r\n console.log('openPrivacyContract success')\r\n },\r\n fail: res => {\r\n console.error('openPrivacyContract fail', res)\r\n }\r\n })\r\n },\r\n handleOpenPrivacyContract() {\r\n // 打开隐私协议页面\r\n wx.openPrivacyContract({\r\n success: () => {}, // 打开成功\r\n fail: () => {}, // 打开失败\r\n complete: () => {}\r\n })\r\n }\r\n }\r\n})\r\n"],"sourceRoot":""}
\ No newline at end of file
<view wx:if="{{showPrivacy}}">
<view hidden="{{!showPrivacy}}">
<view class="pop-wrapper">
<view class="pop-box">
<view class="pop-content">
<view class="pop-title">{{appletName ? appletName : '隐私协议'}}</view>
<view class="pop-text">在您使用{{appletName}}服务之前,请仔细阅读《隐私协议》和《服务使用协议》。如您同意协议内容,请点击“同意”开始使用{{appletName}}。</view>
<view class="pop-text">{{ text ? text : '在您使用' + appletName + '服务之前,请仔细阅读《用户隐私保护指引》。如您同意协议内容,请点击“同意”开始使用' + appletName + '。' }}</view>
<view class="pop-privacy" bindtap="handleOpenPrivacyContract">《用户隐私保护指引》</view>
</view>
<view class="pop-bottom">
......
......@@ -5,7 +5,7 @@
left: 0;
right: 0;
bottom: 0;
z-index: 99;
z-index: 99999999;
}
.pop-box {
position: absolute;
......@@ -63,6 +63,7 @@
border-right: 2rpx solid #ededed;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
color: #000 !important;
}
.agree-btn {
border-top-left-radius: 0;
......
{
"_from": "glsx-applet-component",
"_id": "glsx-applet-component@1.1.21",
"_from": "glsx-applet-component@latest",
"_id": "glsx-applet-component@1.1.24",
"_inBundle": false,
"_integrity": "sha512-ufv3skaj+ungg0eO6DvFNuCjK1Kwg8D/H1MBu9i8hHJToYtvXEJrblAk6LT3NYUOddtIDhVs+p3DgpXUg2WtPQ==",
"_integrity": "sha512-3XTG9J99rgKVJpcC7aKS/+N7CaS+MNYdy5qmWH8siFaRFiSo1PeBRDaprfjCazaud/c31RvpoDFUof/fxNkxjw==",
"_location": "/glsx-applet-component",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "glsx-applet-component",
"raw": "glsx-applet-component@latest",
"name": "glsx-applet-component",
"escapedName": "glsx-applet-component",
"rawSpec": "",
"rawSpec": "latest",
"saveSpec": null,
"fetchSpec": "latest"
},
......@@ -19,9 +19,9 @@
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.21.tgz",
"_shasum": "5b9529b7b4b7374d72674b0dee1949a361e98154",
"_spec": "glsx-applet-component",
"_resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
"_shasum": "636e5eb6b29bd2d63c3055de439295f81557de0c",
"_spec": "glsx-applet-component@latest",
"_where": "D:\\2023\\08\\0831-hmd",
"author": {
"name": "jack"
......@@ -98,5 +98,5 @@
"test-debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --bail",
"watch": "gulp watch --develop --watch"
},
"version": "1.1.21"
"version": "1.1.24"
}
......@@ -2,13 +2,14 @@ let privacyHandler
const privacyResolves = new Set()
const closeOtherPagePopUpHooks = new Set()
wx.onNeedPrivacyAuthorization(resolve => {
console.log(resolve, '-=-=-=-=-=-')
if (typeof privacyHandler === 'function') {
privacyHandler(resolve)
}
})
if (wx.onNeedPrivacyAuthorization) {
wx.onNeedPrivacyAuthorization(resolve => {
console.log(resolve, '-=-=-=-=-=-')
if (typeof privacyHandler === 'function') {
privacyHandler(resolve)
}
})
}
const closeOtherPagePopUp = (closePopUp) => {
closeOtherPagePopUpHooks.forEach(hook => {
if (closePopUp !== hook) {
......@@ -22,18 +23,17 @@ Component({
appletName: {
type: String,
value: ''
},
text: {
type: String,
value: ''
}
},
data: {
title: '用户隐私保护提示',
desc1: '感谢您使用本游戏,您使用本游戏前应当阅井同意',
urlTitle: '《用户隐私保护指引》',
desc2: '当您点击同意并开始时用产品服务时,即表示你已理解并同息该条款内容,该条款将对您产生法律约束力。如您拒绝,将无法进入游戏。',
showPrivacy: false,
height: 0,
},
lifetimes: {
attached: function () {
pageLifetimes: {
show: function () {
const closePopUp = () => {
this.disPopUp()
}
......@@ -47,7 +47,7 @@ Component({
this.closePopUp = closePopUp
},
detached: function () {
hide: function () {
closeOtherPagePopUpHooks.delete(this.closePopUp)
}
},
......@@ -75,6 +75,7 @@ Component({
this.triggerEvent('disagreeClick')
},
popUp() {
console.log('showPrivacy', this.data.showPrivacy);
if (this.data.showPrivacy === false) {
this.setData({
showPrivacy: true
......
<view wx:if="{{showPrivacy}}">
<view hidden="{{!showPrivacy}}">
<view class="pop-wrapper">
<view class="pop-box">
<view class="pop-content">
<view class="pop-title">{{appletName ? appletName : '隐私协议'}}</view>
<view class="pop-text">在您使用{{appletName}}服务之前,请仔细阅读《隐私协议》和《服务使用协议》。如您同意协议内容,请点击“同意”开始使用{{appletName}}。</view>
<view class="pop-text">{{ text ? text : '在您使用' + appletName + '服务之前,请仔细阅读《用户隐私保护指引》。如您同意协议内容,请点击“同意”开始使用' + appletName + '。' }}</view>
<view class="pop-privacy" bindtap="handleOpenPrivacyContract">《用户隐私保护指引》</view>
</view>
<view class="pop-bottom">
......
......@@ -5,7 +5,7 @@
left: 0;
right: 0;
bottom: 0;
z-index: 99;
z-index: 99999999;
}
.pop-box {
position: absolute;
......@@ -64,6 +64,7 @@
border-right: 2rpx solid #ededed;
border-bottom-right-radius: 0;
border-top-right-radius: 0;
color: #000 !important;
}
.agree-btn {
border-top-left-radius: 0;
......
......@@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"glsx-applet-component": {
"version": "1.1.21",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.21.tgz",
"integrity": "sha512-ufv3skaj+ungg0eO6DvFNuCjK1Kwg8D/H1MBu9i8hHJToYtvXEJrblAk6LT3NYUOddtIDhVs+p3DgpXUg2WtPQ=="
"version": "1.1.24",
"resolved": "https://registry.npmjs.org/glsx-applet-component/-/glsx-applet-component-1.1.24.tgz",
"integrity": "sha512-3XTG9J99rgKVJpcC7aKS/+N7CaS+MNYdy5qmWH8siFaRFiSo1PeBRDaprfjCazaud/c31RvpoDFUof/fxNkxjw=="
},
"glsx-map-sdk": {
"version": "0.2.0",
......
......@@ -3,7 +3,7 @@
"version": "1.0.0",
"main": "app.js",
"dependencies": {
"glsx-applet-component": "^1.1.21",
"glsx-applet-component": "^1.1.24",
"glsx-map-sdk": "^0.2.0",
"number-precision": "^1.6.0"
},
......
......@@ -140,6 +140,7 @@ Page({
} = this.data
try {
if (detail.errMsg.includes('deny')) return
if (detail.errMsg.includes('authorized')) return
if (!detail?.code) throw '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
if (!isAgree) throw '请同意以下用户协议'
wx.p.wxApi.showLoading()
......
......@@ -38,4 +38,4 @@
</view>
</block>
<authorize scopeType="writePhotosAlbum" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<authorize scopeType="writePhotosAlbum" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!