diff --git a/components/uni-agreements/uni-agreements.vue b/components/uni-agreements/uni-agreements.vue index d94a5b76d88a0422f894cd84871e0b4c2ad60752..8d82aa0b18837e465c5ea72d8792b5bb09fb4ab2 100644 --- a/components/uni-agreements/uni-agreements.vue +++ b/components/uni-agreements/uni-agreements.vue @@ -16,7 +16,7 @@ name:"uni-agreements", computed:{ agreements(){ - return getApp().globalData.config.about.agreements||[] + return getApp({allowDefault: true}).globalData.config.about.agreements||[] } }, methods:{ diff --git a/components/uni-quick-login/uni-quick-login.vue b/components/uni-quick-login/uni-quick-login.vue index ecde9761eae3824fd995fc044c850b213ba91371..96a024f663c6188dd4d30d009f494f41db9141d8 100644 --- a/components/uni-quick-login/uni-quick-login.vue +++ b/components/uni-quick-login/uni-quick-login.vue @@ -32,10 +32,10 @@ export default { computed: { loginConfig() { - return getApp().globalData.config.router.login + return getApp({allowDefault: true}).globalData.config.router.login }, agreements() { - return getApp().globalData.config.about.agreements || [] + return getApp({allowDefault: true}).globalData.config.about.agreements || [] } }, data() { diff --git a/main.js b/main.js index ee65e43fdd8a11fae2868934148eade8295fc70c..dcd2e463ceec110000ae7e77bec3cf6dd856fa3d 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,7 @@ import App from './App' import store from './store' import i18n from './lang/i18n' -uni.showModal = ()=>{}; +// uni.showModal = ()=>{}; // #ifndef VUE3 import Vue from 'vue' diff --git a/manifest.json b/manifest.json index d79012dfc2838c14e9654dcc18982dec1ffa96c0..45850a6fd3adb8fbf3f9c3c0dec686c9926c9807 100644 --- a/manifest.json +++ b/manifest.json @@ -1,203 +1,193 @@ { - "name" : "uni-starter", - "appid" : "__UNI__D53040B", - "description" : "云端一体应用快速开发模版", - "versionName" : "1.0.0", - "versionCode" : "100", - "transformPx" : false, - "app-plus" : { - "locales" : { - "en" : { - "name" : "uni-starter", - "android" : { - "strings" : { - "CustomKey" : "CustomValue" - } - }, - "ios" : { - "privacyDescription" : { - "NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)" - }, - "infoPlist" : { - "CustomKey" : "CustomValue" - } - } - }, - "zh" : { - "name" : "统一应用基本项目" - } - }, - "privacy" : { - "prompt" : "template", - "template" : { - "title" : "服务协议和隐私政策", - "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
  你可阅读《服务协议》《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", - "buttonAccept" : "同意", - "buttonRefuse" : "暂不同意" - } - }, - "compatible" : { - "ignoreVersion" : true - }, - "usingComponents" : true, - "nvueStyleCompiler" : "uni-app", - "compilerVersion" : 3, - "splashscreen" : { - "alwaysShowBeforeRender" : false, - "waiting" : true, - "autoclose" : true, - "delay" : 0 - }, - "modules" : { - "Fingerprint" : {}, - "Share" : {}, - "OAuth" : {}, - "FaceID" : {}, - "Push" : {}, - "Bluetooth" : {} - }, - "distribute" : { - "android" : { - "permissions" : [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "" - ], - "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] - }, - "ios" : { - "capabilities" : { - "entitlements" : { - "com.apple.developer.associated-domains" : [ "applinks:static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" ] - } - } - }, - "sdkConfigs" : { - "oauth" : { - "apple" : {}, - "weixin" : { - "appid" : "", - "appsecret" : "", - "UniversalLinks" : "" - }, - "univerify" : {} - }, - "ad" : { - "gdt" : {}, - "csj" : {} - }, - "share" : { - "weixin" : { - "appid" : "", - "UniversalLinks" : "" - } - }, - "geolocation" : {}, - "push" : { - "unipush" : {} - }, - "payment" : {} - }, - "icons" : { - "android" : { - "hdpi" : "", - "xhdpi" : "", - "xxhdpi" : "", - "xxxhdpi" : "" - }, - "ios" : { - "appstore" : "", - "ipad" : { - "app" : "", - "app@2x" : "", - "notification" : "", - "notification@2x" : "", - "proapp@2x" : "", - "settings" : "", - "settings@2x" : "", - "spotlight" : "", - "spotlight@2x" : "" - }, - "iphone" : { - "app@2x" : "", - "app@3x" : "", - "notification@2x" : "", - "notification@3x" : "", - "settings@2x" : "", - "settings@3x" : "", - "spotlight@2x" : "", - "spotlight@3x" : "" - } - } - }, - "splashscreen" : { - "iosStyle" : "common", - "androidStyle" : "common", - "useOriginalMsgbox" : true - } - }, - "nvueLaunchMode" : "" - }, - "quickapp" : {}, - "mp-weixin" : { - "appid" : "wx81dbb061d2258234", - "setting" : { - "urlCheck" : false, - "es6" : false - }, - "usingComponents" : true, - "betterScopedSlots" : true, - "permission" : { - "scope.userLocation" : { - "desc" : "演示在onShow生命周期获取地理位置" - } - } - }, - "mp-alipay" : { - "usingComponents" : true - }, - "mp-baidu" : { - "usingComponents" : true - }, - "mp-toutiao" : { - "usingComponents" : true - }, - "uniStatistics" : { - "enable" : false - }, - "h5" : { - "template" : "", - "sdkConfigs" : { - "maps" : { - "qqmap" : { - "key" : "" - } - } - }, - "router" : { - "base" : "" - } - }, - "router": { - "base": "" - }, - "uniStatistics": { - "enable": true - } - }, - "_spaceID": "", - "vueVersion": "2" + "name": "uni-starter", + "appid": "", + "description": "云端一体应用快速开发模版", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + "app-plus": { + "locales": { + "en": { + "name": "uni-starter", + "android": { + "strings": { + "CustomKey": "CustomValue" + } + }, + "ios": { + "privacyDescription": { + "NSPhotoLibraryUsageDescription": "access to the user’s photo library(read)" + }, + "infoPlist": { + "CustomKey": "CustomValue" + } + } + }, + "zh": { + "name": "统一应用基本项目" + } + }, + "privacy": { + "prompt": "template", + "template": { + "title": "服务协议和隐私政策", + "message": "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
  你可阅读《服务协议》《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", + "buttonAccept": "同意", + "buttonRefuse": "暂不同意" + } + }, + "compatible": { + "ignoreVersion": true + }, + "usingComponents": true, + "nvueStyleCompiler": "uni-app", + "compilerVersion": 3, + "splashscreen": { + "alwaysShowBeforeRender": false, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": { + "Fingerprint": {}, + "FaceID": {}, + "Push": {}, + "Bluetooth": {}, + "OAuth": {} + }, + "distribute": { + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"] + }, + "ios": { + "capabilities": { + "entitlements": { + "com.apple.developer.associated-domains": [ + "" + ] + } + } + }, + "sdkConfigs": { + "oauth": { + "weixin": { + "appid": "", + "appsecret": "", + "UniversalLinks": "" + } + }, + "ad": { + "gdt": {}, + "csj": {} + }, + "share": {}, + "geolocation": {}, + "push": { + "unipush": {} + }, + "payment": {} + }, + "icons": { + "android": { + "hdpi": "", + "xhdpi": "", + "xxhdpi": "", + "xxxhdpi": "" + }, + "ios": { + "appstore": "", + "ipad": { + "app": "", + "app@2x": "", + "notification": "", + "notification@2x": "", + "proapp@2x": "", + "settings": "", + "settings@2x": "", + "spotlight": "", + "spotlight@2x": "" + }, + "iphone": { + "app@2x": "", + "app@3x": "", + "notification@2x": "", + "notification@3x": "", + "settings@2x": "", + "settings@3x": "", + "spotlight@2x": "", + "spotlight@3x": "" + } + } + }, + "splashscreen": { + "iosStyle": "common", + "androidStyle": "common", + "useOriginalMsgbox": true + } + }, + "nvueLaunchMode": "" + }, + "quickapp": {}, + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false, + "es6": false + }, + "usingComponents": true, + "betterScopedSlots": true, + "permission": { + "scope.userLocation": { + "desc": "演示在onShow生命周期获取地理位置" + } + } + }, + "mp-alipay": { + "usingComponents": true + }, + "mp-baidu": { + "usingComponents": true + }, + "mp-toutiao": { + "usingComponents": true + }, + "uniStatistics": { + "enable": false + }, + "h5": { + "template": "", + "sdkConfigs": { + "maps": { + "qqmap": { + "key": "" + } + } + }, + "router": { + "base": "" + }, + "uniStatistics": { + "enable": true + } + }, + "_spaceID": "", + "vueVersion": "2" } diff --git a/pages/ucenter/about/about.vue b/pages/ucenter/about/about.vue index 9cd345dc95b8bf1ce2ff1974a0d11aeff27eb5c3..235e3c5c81d685671182344ad5e5656fd36ba62e 100644 --- a/pages/ucenter/about/about.vue +++ b/pages/ucenter/about/about.vue @@ -41,8 +41,8 @@ }, computed: { uniStarterConfig() { - console.log(getApp()); - return getApp().globalData.config + console.log(getApp({allowDefault: true}),"getApp----------------"); + return getApp({allowDefault: true}).globalData.config } }, data() { @@ -54,6 +54,7 @@ }, created() { this.about = this.uniStarterConfig.about + console.log("this.about:------ ",this.about); uni.setNavigationBarTitle({ title: this.$t('about.about')+ " " + this.about.appName }) diff --git a/pages/ucenter/login-page/pwd-login/pwd-login.test.js b/pages/ucenter/login-page/pwd-login/pwd-login.test.js index 045bc88fc1917136009c972d0136fa5f18ce0f54..3da57f5d8323df74639ce5d41052c8f4319707a3 100644 --- a/pages/ucenter/login-page/pwd-login/pwd-login.test.js +++ b/pages/ucenter/login-page/pwd-login/pwd-login.test.js @@ -16,12 +16,13 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => { // expect((await program.currentPage()).path).toBe( // 'pages/ucenter/login-page/register/register') console.log(await program.currentPage(),"111111111"); + await program.navigateBack() // await page.waitFor(500) // 执行 navigateBack 验证是否返回navigateTo // expect((await program.navigateBack()).path).toBe( // 'pages/ucenter/login-page/pwd-login/pwd-login') - console.log(await program.currentPage(),"22222222222"); + console.log(await program.currentPage(),"22222222222"); }) it('用户名密码登录', async () => { diff --git a/pages/ucenter/login-page/pwd-login/pwd-login.vue b/pages/ucenter/login-page/pwd-login/pwd-login.vue index 3871b99cb145666b2ceb89e7fb4b633369dadace..7fc70d7985680c137389be07c1739d3664520422 100644 --- a/pages/ucenter/login-page/pwd-login/pwd-login.vue +++ b/pages/ucenter/login-page/pwd-login/pwd-login.vue @@ -158,7 +158,6 @@ }, /* 前往注册 */ toRegister(e) { - console.log(e); uni.navigateTo({ url: '/pages/ucenter/login-page/register/register' }) diff --git a/pages/ucenter/settings/settings.vue b/pages/ucenter/settings/settings.vue index 1d51dc7a8cf25e0dccda1cd4a9293fc62f5c7caf..c012f431829601fba926933821b865274b6e24bf 100644 --- a/pages/ucenter/settings/settings.vue +++ b/pages/ucenter/settings/settings.vue @@ -186,20 +186,26 @@ clickLogout() { console.log("this.hasLogin:---------------- ",this.hasLogin); if (this.hasLogin) { - uni.showModal({ - title: this.$t('settings.tips'), - content: this.$t('settings.exitLogin'), - cancelText: this.$t('settings.cancelText'), - confirmText: this.$t('settings.confirmText'), - success: res => { - if (res.confirm) { - this.logout() - uni.navigateBack(); - } - }, - fail: () => {}, - complete: () => {} - }); + this.logout() + uni.navigateBack(); + // uni.showModal({ + // title: this.$t('settings.tips'), + // content: this.$t('settings.exitLogin'), + // cancelText: this.$t('settings.cancelText'), + // confirmText: this.$t('settings.confirmText'), + // success: res => { + // if (res.confirm) { + // this.logout() + // uni.navigateBack(); + // } + // }, + // fail: (err) => { + // console.log("err: ",err); + // }, + // complete: (com) => { + // console.log("com: ",com); + // } + // }); } else { uni.navigateTo({ url: '/pages/ucenter/login-page/index/index' @@ -207,10 +213,10 @@ } }, clearTmp() { - uni.showLoading({ - title: this.$t('settings.clearing'), - mask: true - }); + // uni.showLoading({ + // title: this.$t('settings.clearing'), + // mask: true + // }); /* 任何临时存储或删除不直接影响程序运行逻辑(清除缓存必定造成业务逻辑的变化,如:打开页面的图片不从缓存中读取而从网络请求)的内容都可以视为缓存。主要有storage、和file写入。 缓存分为三部分 diff --git a/pages/ucenter/ucenter.test.js b/pages/ucenter/ucenter.test.js index 91e7cde96db690bdcbd92043850c200a9fad700c..1b2acf9da2ebec11edf78dfa5bf4fe7954b08044 100644 --- a/pages/ucenter/ucenter.test.js +++ b/pages/ucenter/ucenter.test.js @@ -17,14 +17,53 @@ describe('pages/ucenter/ucenter.vue', () => { // console.log("getUcenterList: ",getUcenterList); expect(getUcenterList.length).toBe(3) }) + + + it('普通签到', async () => { + + + if (process.env.UNI_PLATFORM === "h5" || process.env.UNI_PLATFORM === "mp-weixin") { + await page.callMethod('signIn') + await page.waitFor(300) + const image = await program.screenshot({ + path: "static/screenshot/sign-h5.png" // 默认项目根目录 process.env.UNI_PLATFORM === "h5" || + }) + console.log(image, "image--------------------") + } + + + if (process.env.UNI_PLATFORM === "app-plus") { + const signInByAdRes = await page.callMethod('signInByAd') + console.log("signInByAdRes: ",signInByAdRes); + + await page.waitFor(300) + const shareRes = await page.callMethod('share') + console.log("shareRes: ",shareRes); + await page.waitFor(300) + + const imageApp = await program.screenshot({ + path: "static/screenshot/sign-app.png" // 默认项目根目录 process.env.UNI_PLATFORM === "h5" || + }) + console.log(imageApp, "imageApp--------------------") + + } + }) it('我的积分', async () => { // expect.assertions(1); await page.waitFor(300) + const getScoreRes = await page.callMethod('getScore') console.log("getScoreRes: ", getScoreRes); + if (getScoreRes) { + console.log("今日已签到"); + expect(getScoreRes.score).not.toBeUndefined(); + expect(getScoreRes.balance).toBeGreaterThanOrEqual(getScoreRes.score); + } else { + console.log("签到失败"); + } + // await page.waitFor(500) - // expect(getScoreRes.score).not.toBeUndefined(); }) diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue index 8c39843c24e13336f70a9e1c478fde83b52c5136..23e02c73fc2eedc7a396abf4ffdc7a58381631f2 100644 --- a/pages/ucenter/ucenter.vue +++ b/pages/ucenter/ucenter.vue @@ -167,12 +167,12 @@ // #ifdef APP-PLUS , appVersion() { - return getApp().appVersion + return getApp({allowDefault: true}).appVersion } // #endif , appConfig() { - return getApp().globalData.config + return getApp({allowDefault: true}).globalData.config } }, methods: { @@ -263,12 +263,14 @@ .then((res) => { console.log(res,"res------"); const data = res.result.data[0]; + console.log("data: ",data); let msg = ''; msg = data ? (this.$t('mine.currentScore')+ data.balance) : this.$t('mine.noScore'); uni.showToast({ title: msg, icon: 'none' }); + console.log("msg:---- ",msg); return data }).catch((reason)=>{ console.log(reason,'这是失败的操作'); @@ -278,7 +280,6 @@ // uni.hideLoading() return e }) - }, async share() { let { diff --git a/static/screenshot/about-app.png b/static/screenshot/about-app.png index 74a078f991bab4fff082c023ce9789279328c991..f2bc027737ce26591fc6af20d6539ef18ff0e60c 100644 Binary files a/static/screenshot/about-app.png and b/static/screenshot/about-app.png differ diff --git a/static/screenshot/about-h5.png b/static/screenshot/about-h5.png index e346fa31a132573bca651d6c7ec2cfec2507a6e8..77b68c17bf38b2288c29fa1162edb0989c03c8b4 100644 Binary files a/static/screenshot/about-h5.png and b/static/screenshot/about-h5.png differ diff --git a/static/screenshot/about-mp.jpg b/static/screenshot/about-mp.jpg index 860da55c877762c2deba7fcdf896a316a434d8b2..92f93d7fe87a38d46e2467992d3ae65b73ee74cc 100644 Binary files a/static/screenshot/about-mp.jpg and b/static/screenshot/about-mp.jpg differ diff --git a/static/screenshot/sign-app.png b/static/screenshot/sign-app.png new file mode 100644 index 0000000000000000000000000000000000000000..76ca0e40e401ba8874361313c0a0541c321feca6 Binary files /dev/null and b/static/screenshot/sign-app.png differ diff --git a/static/screenshot/sign-h5.png b/static/screenshot/sign-h5.png new file mode 100644 index 0000000000000000000000000000000000000000..2e3ddb85dd4596f99cf4b5a85f3c90a1cb9d0828 Binary files /dev/null and b/static/screenshot/sign-h5.png differ diff --git a/uni-starter.config.js b/uni-starter.config.js index 644a851841953371409fe1ac35f80e603cc7ed9d..ce5a744081d563e30178bfa02d92e3b1995b4386 100644 --- a/uni-starter.config.js +++ b/uni-starter.config.js @@ -2,7 +2,7 @@ export default { "h5": { "url": "https://uni-starter.dcloud.net.cn", // 前端网页托管的域名 - // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改 + // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改 // "openApp": { //如不需要本功能直接移除本节点即可 // //点击悬浮下载栏后打开的网页链接 // "openUrl": '/#/pages/ucenter/invite/invite', @@ -28,20 +28,11 @@ export default { 2.visitor:白名单模式。枚举游客可访问的页面。 * 注意:黑名单与白名单模式二选一 */ - // "needLogin" : [ - // {pattern:/^\/pages\/list.*/}, //支持正则表达式 - // "/uni_modules/uni-news-favorite/pages/uni-news-favorite/list", - // "/uni_modules/uni-feedback/pages/uni-feedback/add" - // ], - "visitor" : [ - "/",//注意入口页必须直接写 "/" - {"pattern":/^\/pages\/list.*/}, //支持正则表达式 - {"pattern":/^\/pages\/ucenter\/login-page.*/}, - "/pages/common/webview/webview", - "/pages/grid/grid", - "/pages/ucenter/ucenter", - "/pages/ucenter/about/about", - "/pages/ucenter/settings/settings" + "needLogin": [{ + pattern: /^\/pages\/list.*/ + }, //支持正则表达式 + // "/uni_modules/uni-news-favorite/pages/uni-news-favorite/list", + // "/uni_modules/uni-feedback/pages/uni-feedback/add" ], // "visitor" : [ // "/",//注意入口页必须直接写 "/" @@ -50,7 +41,6 @@ export default { // "/pages/common/webview/webview", // "/pages/grid/grid", // "/pages/ucenter/ucenter", - // "/pages/ucenter/guestbook/guestbook", // "/pages/ucenter/about/about", // "/pages/ucenter/settings/settings" // ], @@ -60,7 +50,7 @@ export default { 未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可 根据数组的第0项,决定登录方式的第一优先级。 */ - "login": ["username","univerify","weixin", "smsCode", "apple"], + "login": ["username", "univerify", "weixin", "smsCode", "apple"], // "login": ["univerify"] }, //关于应用 @@ -75,30 +65,30 @@ export default { "slogan": "云端一体应用快速开发模版", //政策协议 "agreements": [{ - "title": "用户服务条款",// 为了多语言国际化请在 lang/en.js 和 lang/zh-Hans.js中配置", + "title": "用户服务条款", // 为了多语言国际化请在 lang/en.js 和 lang/zh-Hans.js中配置", "url": "https://ask.dcloud.net.cn/protocol.html" //对应的网络链接 }, { - "title": "隐私政策",//为了多语言国际化请在 lang/en.js 和 lang/zh-Hans.js中配置 + "title": "隐私政策", //为了多语言国际化请在 lang/en.js 和 lang/zh-Hans.js中配置 "url": "https://ask.dcloud.net.cn/protocol.html" } ], //应用的链接,用于分享到第三方平台和生成关于我们页的二维码 "download": "", //version - "version":"1.0.0" //用于非app端显示,app端自动获取 + "version": "1.0.0" //用于非app端显示,app端自动获取 }, - "download":{ //用于生成二合一下载页面 - "ios":"https://itunes.apple.com/cn/app/hello-uni-app/id1417078253?mt=8", - "android":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-97fca9f2-41f6-449f-a35e-3f135d4c3875/6d754387-a6c3-48ed-8ad2-e8f39b40fc01.apk" + "download": { //用于生成二合一下载页面 + "ios": "https://itunes.apple.com/cn/app/hello-uni-app/id1417078253?mt=8", + "android": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-97fca9f2-41f6-449f-a35e-3f135d4c3875/6d754387-a6c3-48ed-8ad2-e8f39b40fc01.apk" }, //用于打开应用市场评分界面 - "marketId":{ - "ios":"id1417078253", - "android":"123456" + "marketId": { + "ios": "id1417078253", + "android": "123456" }, //配置多语言国际化。i18n为英文单词 internationalization的首末字符i和n,18为中间的字符数 是“国际化”的简称 - "i18n":{ - "enable":false //默认关闭,国际化。如果你想使用国际化相关功能,请改为true + "i18n": { + "enable": false //默认关闭,国际化。如果你想使用国际化相关功能,请改为true } -} \ No newline at end of file +}