提交 69989ccd 编写于 作者: study夏羽's avatar study夏羽

update jest

上级 7bd7da40
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
name:"uni-agreements", name:"uni-agreements",
computed:{ computed:{
agreements(){ agreements(){
return getApp().globalData.config.about.agreements||[] return getApp({allowDefault: true}).globalData.config.about.agreements||[]
} }
}, },
methods:{ methods:{
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
export default { export default {
computed: { computed: {
loginConfig() { loginConfig() {
return getApp().globalData.config.router.login return getApp({allowDefault: true}).globalData.config.router.login
}, },
agreements() { agreements() {
return getApp().globalData.config.about.agreements || [] return getApp({allowDefault: true}).globalData.config.about.agreements || []
} }
}, },
data() { data() {
......
...@@ -2,7 +2,7 @@ import App from './App' ...@@ -2,7 +2,7 @@ import App from './App'
import store from './store' import store from './store'
import i18n from './lang/i18n' import i18n from './lang/i18n'
uni.showModal = ()=>{}; // uni.showModal = ()=>{};
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'
......
{ {
"name" : "uni-starter", "name": "uni-starter",
"appid" : "__UNI__D53040B", "appid": "",
"description" : "云端一体应用快速开发模版", "description": "云端一体应用快速开发模版",
"versionName" : "1.0.0", "versionName": "1.0.0",
"versionCode" : "100", "versionCode": "100",
"transformPx" : false, "transformPx": false,
"app-plus" : { "app-plus": {
"locales" : { "locales": {
"en" : { "en": {
"name" : "uni-starter", "name": "uni-starter",
"android" : { "android": {
"strings" : { "strings": {
"CustomKey" : "CustomValue" "CustomKey": "CustomValue"
} }
}, },
"ios" : { "ios": {
"privacyDescription" : { "privacyDescription": {
"NSPhotoLibraryUsageDescription" : "access to the user’s photo library(read)" "NSPhotoLibraryUsageDescription": "access to the user’s photo library(read)"
}, },
"infoPlist" : { "infoPlist": {
"CustomKey" : "CustomValue" "CustomKey": "CustomValue"
} }
} }
}, },
"zh" : { "zh": {
"name" : "统一应用基本项目" "name": "统一应用基本项目"
} }
}, },
"privacy" : { "privacy": {
"prompt" : "template", "prompt": "template",
"template" : { "template": {
"title" : "服务协议和隐私政策", "title": "服务协议和隐私政策",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://ask.dcloud.net.cn/protocol.html\">《服务协议》</a>和<a href=\"https://ask.dcloud.net.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", "message": "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://ask.dcloud.net.cn/protocol.html\">《服务协议》</a>和<a href=\"https://ask.dcloud.net.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意", "buttonAccept": "同意",
"buttonRefuse" : "暂不同意" "buttonRefuse": "暂不同意"
} }
}, },
"compatible" : { "compatible": {
"ignoreVersion" : true "ignoreVersion": true
}, },
"usingComponents" : true, "usingComponents": true,
"nvueStyleCompiler" : "uni-app", "nvueStyleCompiler": "uni-app",
"compilerVersion" : 3, "compilerVersion": 3,
"splashscreen" : { "splashscreen": {
"alwaysShowBeforeRender" : false, "alwaysShowBeforeRender": false,
"waiting" : true, "waiting": true,
"autoclose" : true, "autoclose": true,
"delay" : 0 "delay": 0
}, },
"modules" : { "modules": {
"Fingerprint" : {}, "Fingerprint": {},
"Share" : {}, "FaceID": {},
"OAuth" : {}, "Push": {},
"FaceID" : {}, "Bluetooth": {},
"Push" : {}, "OAuth": {}
"Bluetooth" : {} },
}, "distribute": {
"distribute" : { "android": {
"android" : { "permissions": [
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
...@@ -76,119 +75,110 @@ ...@@ -76,119 +75,110 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ] "abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"]
}, },
"ios" : { "ios": {
"capabilities" : { "capabilities": {
"entitlements" : { "entitlements": {
"com.apple.developer.associated-domains" : [ "applinks:static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" ] "com.apple.developer.associated-domains": [
""
]
} }
} }
}, },
"sdkConfigs" : { "sdkConfigs": {
"oauth" : { "oauth": {
"apple" : {}, "weixin": {
"weixin" : { "appid": "",
"appid" : "", "appsecret": "",
"appsecret" : "", "UniversalLinks": ""
"UniversalLinks" : ""
},
"univerify" : {}
},
"ad" : {
"gdt" : {},
"csj" : {}
},
"share" : {
"weixin" : {
"appid" : "",
"UniversalLinks" : ""
} }
}, },
"geolocation" : {}, "ad": {
"push" : { "gdt": {},
"unipush" : {} "csj": {}
},
"share": {},
"geolocation": {},
"push": {
"unipush": {}
}, },
"payment" : {} "payment": {}
}, },
"icons" : { "icons": {
"android" : { "android": {
"hdpi" : "", "hdpi": "",
"xhdpi" : "", "xhdpi": "",
"xxhdpi" : "", "xxhdpi": "",
"xxxhdpi" : "" "xxxhdpi": ""
}, },
"ios" : { "ios": {
"appstore" : "", "appstore": "",
"ipad" : { "ipad": {
"app" : "", "app": "",
"app@2x" : "", "app@2x": "",
"notification" : "", "notification": "",
"notification@2x" : "", "notification@2x": "",
"proapp@2x" : "", "proapp@2x": "",
"settings" : "", "settings": "",
"settings@2x" : "", "settings@2x": "",
"spotlight" : "", "spotlight": "",
"spotlight@2x" : "" "spotlight@2x": ""
}, },
"iphone" : { "iphone": {
"app@2x" : "", "app@2x": "",
"app@3x" : "", "app@3x": "",
"notification@2x" : "", "notification@2x": "",
"notification@3x" : "", "notification@3x": "",
"settings@2x" : "", "settings@2x": "",
"settings@3x" : "", "settings@3x": "",
"spotlight@2x" : "", "spotlight@2x": "",
"spotlight@3x" : "" "spotlight@3x": ""
} }
} }
}, },
"splashscreen" : { "splashscreen": {
"iosStyle" : "common", "iosStyle": "common",
"androidStyle" : "common", "androidStyle": "common",
"useOriginalMsgbox" : true "useOriginalMsgbox": true
} }
}, },
"nvueLaunchMode" : "" "nvueLaunchMode": ""
}, },
"quickapp" : {}, "quickapp": {},
"mp-weixin" : { "mp-weixin": {
"appid" : "wx81dbb061d2258234", "appid": "",
"setting" : { "setting": {
"urlCheck" : false, "urlCheck": false,
"es6" : false "es6": false
}, },
"usingComponents" : true, "usingComponents": true,
"betterScopedSlots" : true, "betterScopedSlots": true,
"permission" : { "permission": {
"scope.userLocation" : { "scope.userLocation": {
"desc" : "演示在onShow生命周期获取地理位置" "desc": "演示在onShow生命周期获取地理位置"
} }
} }
}, },
"mp-alipay" : { "mp-alipay": {
"usingComponents" : true "usingComponents": true
}, },
"mp-baidu" : { "mp-baidu": {
"usingComponents" : true "usingComponents": true
}, },
"mp-toutiao" : { "mp-toutiao": {
"usingComponents" : true "usingComponents": true
}, },
"uniStatistics" : { "uniStatistics": {
"enable" : false "enable": false
}, },
"h5" : { "h5": {
"template" : "", "template": "",
"sdkConfigs" : { "sdkConfigs": {
"maps" : { "maps": {
"qqmap" : { "qqmap": {
"key" : "" "key": ""
}
} }
},
"router" : {
"base" : ""
} }
}, },
"router": { "router": {
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
}, },
computed: { computed: {
uniStarterConfig() { uniStarterConfig() {
console.log(getApp()); console.log(getApp({allowDefault: true}),"getApp----------------");
return getApp().globalData.config return getApp({allowDefault: true}).globalData.config
} }
}, },
data() { data() {
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
}, },
created() { created() {
this.about = this.uniStarterConfig.about this.about = this.uniStarterConfig.about
console.log("this.about:------ ",this.about);
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: this.$t('about.about')+ " " + this.about.appName title: this.$t('about.about')+ " " + this.about.appName
}) })
......
...@@ -16,6 +16,7 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => { ...@@ -16,6 +16,7 @@ describe('pages/ucenter/login-page/pwd-login/pwd-login.vue', () => {
// expect((await program.currentPage()).path).toBe( // expect((await program.currentPage()).path).toBe(
// 'pages/ucenter/login-page/register/register') // 'pages/ucenter/login-page/register/register')
console.log(await program.currentPage(),"111111111"); console.log(await program.currentPage(),"111111111");
await program.navigateBack()
// await page.waitFor(500) // await page.waitFor(500)
// 执行 navigateBack 验证是否返回navigateTo // 执行 navigateBack 验证是否返回navigateTo
// expect((await program.navigateBack()).path).toBe( // expect((await program.navigateBack()).path).toBe(
......
...@@ -158,7 +158,6 @@ ...@@ -158,7 +158,6 @@
}, },
/* 前往注册 */ /* 前往注册 */
toRegister(e) { toRegister(e) {
console.log(e);
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/login-page/register/register' url: '/pages/ucenter/login-page/register/register'
}) })
......
...@@ -186,20 +186,26 @@ ...@@ -186,20 +186,26 @@
clickLogout() { clickLogout() {
console.log("this.hasLogin:---------------- ",this.hasLogin); console.log("this.hasLogin:---------------- ",this.hasLogin);
if (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() this.logout()
uni.navigateBack(); uni.navigateBack();
} // uni.showModal({
}, // title: this.$t('settings.tips'),
fail: () => {}, // content: this.$t('settings.exitLogin'),
complete: () => {} // 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 { } else {
uni.navigateTo({ uni.navigateTo({
url: '/pages/ucenter/login-page/index/index' url: '/pages/ucenter/login-page/index/index'
...@@ -207,10 +213,10 @@ ...@@ -207,10 +213,10 @@
} }
}, },
clearTmp() { clearTmp() {
uni.showLoading({ // uni.showLoading({
title: this.$t('settings.clearing'), // title: this.$t('settings.clearing'),
mask: true // mask: true
}); // });
/* /*
任何临时存储或删除不直接影响程序运行逻辑(清除缓存必定造成业务逻辑的变化,如:打开页面的图片不从缓存中读取而从网络请求)的内容都可以视为缓存。主要有storage、和file写入。 任何临时存储或删除不直接影响程序运行逻辑(清除缓存必定造成业务逻辑的变化,如:打开页面的图片不从缓存中读取而从网络请求)的内容都可以视为缓存。主要有storage、和file写入。
缓存分为三部分 缓存分为三部分
......
...@@ -18,13 +18,52 @@ describe('pages/ucenter/ucenter.vue', () => { ...@@ -18,13 +18,52 @@ describe('pages/ucenter/ucenter.vue', () => {
expect(getUcenterList.length).toBe(3) 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 () => { it('我的积分', async () => {
// expect.assertions(1); // expect.assertions(1);
await page.waitFor(300) await page.waitFor(300)
const getScoreRes = await page.callMethod('getScore') const getScoreRes = await page.callMethod('getScore')
console.log("getScoreRes: ", getScoreRes); 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) // await page.waitFor(500)
// expect(getScoreRes.score).not.toBeUndefined();
}) })
......
...@@ -167,12 +167,12 @@ ...@@ -167,12 +167,12 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
, ,
appVersion() { appVersion() {
return getApp().appVersion return getApp({allowDefault: true}).appVersion
} }
// #endif // #endif
, ,
appConfig() { appConfig() {
return getApp().globalData.config return getApp({allowDefault: true}).globalData.config
} }
}, },
methods: { methods: {
...@@ -263,12 +263,14 @@ ...@@ -263,12 +263,14 @@
.then((res) => { .then((res) => {
console.log(res,"res------"); console.log(res,"res------");
const data = res.result.data[0]; const data = res.result.data[0];
console.log("data: ",data);
let msg = ''; let msg = '';
msg = data ? (this.$t('mine.currentScore')+ data.balance) : this.$t('mine.noScore'); msg = data ? (this.$t('mine.currentScore')+ data.balance) : this.$t('mine.noScore');
uni.showToast({ uni.showToast({
title: msg, title: msg,
icon: 'none' icon: 'none'
}); });
console.log("msg:---- ",msg);
return data return data
}).catch((reason)=>{ }).catch((reason)=>{
console.log(reason,'这是失败的操作'); console.log(reason,'这是失败的操作');
...@@ -278,7 +280,6 @@ ...@@ -278,7 +280,6 @@
// uni.hideLoading() // uni.hideLoading()
return e return e
}) })
}, },
async share() { async share() {
let { let {
......
static/screenshot/about-app.png

106.7 KB | W: | H:

static/screenshot/about-app.png

110.6 KB | W: | H:

static/screenshot/about-app.png
static/screenshot/about-app.png
static/screenshot/about-app.png
static/screenshot/about-app.png
  • 2-up
  • Swipe
  • Onion skin
static/screenshot/about-h5.png

55.9 KB | W: | H:

static/screenshot/about-h5.png

61.9 KB | W: | H:

static/screenshot/about-h5.png
static/screenshot/about-h5.png
static/screenshot/about-h5.png
static/screenshot/about-h5.png
  • 2-up
  • Swipe
  • Onion skin
static/screenshot/about-mp.jpg

23.9 KB | W: | H:

static/screenshot/about-mp.jpg

23.9 KB | W: | H:

static/screenshot/about-mp.jpg
static/screenshot/about-mp.jpg
static/screenshot/about-mp.jpg
static/screenshot/about-mp.jpg
  • 2-up
  • Swipe
  • Onion skin
...@@ -28,20 +28,11 @@ export default { ...@@ -28,20 +28,11 @@ export default {
2.visitor:白名单模式。枚举游客可访问的页面。 2.visitor:白名单模式。枚举游客可访问的页面。
* 注意:黑名单与白名单模式二选一 * 注意:黑名单与白名单模式二选一
*/ */
// "needLogin" : [ "needLogin": [{
// {pattern:/^\/pages\/list.*/}, //支持正则表达式 pattern: /^\/pages\/list.*/
}, //支持正则表达式
// "/uni_modules/uni-news-favorite/pages/uni-news-favorite/list", // "/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
// "/uni_modules/uni-feedback/pages/uni-feedback/add" // "/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"
], ],
// "visitor" : [ // "visitor" : [
// "/",//注意入口页必须直接写 "/" // "/",//注意入口页必须直接写 "/"
...@@ -50,7 +41,6 @@ export default { ...@@ -50,7 +41,6 @@ export default {
// "/pages/common/webview/webview", // "/pages/common/webview/webview",
// "/pages/grid/grid", // "/pages/grid/grid",
// "/pages/ucenter/ucenter", // "/pages/ucenter/ucenter",
// "/pages/ucenter/guestbook/guestbook",
// "/pages/ucenter/about/about", // "/pages/ucenter/about/about",
// "/pages/ucenter/settings/settings" // "/pages/ucenter/settings/settings"
// ], // ],
...@@ -60,7 +50,7 @@ export default { ...@@ -60,7 +50,7 @@ export default {
未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可 未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可
根据数组的第0项,决定登录方式的第一优先级。 根据数组的第0项,决定登录方式的第一优先级。
*/ */
"login": ["username","univerify","weixin", "smsCode", "apple"], "login": ["username", "univerify", "weixin", "smsCode", "apple"],
// "login": ["univerify"] // "login": ["univerify"]
}, },
//关于应用 //关于应用
...@@ -75,30 +65,30 @@ export default { ...@@ -75,30 +65,30 @@ export default {
"slogan": "云端一体应用快速开发模版", "slogan": "云端一体应用快速开发模版",
//政策协议 //政策协议
"agreements": [{ "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" //对应的网络链接 "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" "url": "https://ask.dcloud.net.cn/protocol.html"
} }
], ],
//应用的链接,用于分享到第三方平台和生成关于我们页的二维码 //应用的链接,用于分享到第三方平台和生成关于我们页的二维码
"download": "", "download": "",
//version //version
"version":"1.0.0" //用于非app端显示,app端自动获取 "version": "1.0.0" //用于非app端显示,app端自动获取
}, },
"download":{ //用于生成二合一下载页面 "download": { //用于生成二合一下载页面
"ios":"https://itunes.apple.com/cn/app/hello-uni-app/id1417078253?mt=8", "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" "android": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-97fca9f2-41f6-449f-a35e-3f135d4c3875/6d754387-a6c3-48ed-8ad2-e8f39b40fc01.apk"
}, },
//用于打开应用市场评分界面 //用于打开应用市场评分界面
"marketId":{ "marketId": {
"ios":"id1417078253", "ios": "id1417078253",
"android":"123456" "android": "123456"
}, },
//配置多语言国际化。i18n为英文单词 internationalization的首末字符i和n,18为中间的字符数 是“国际化”的简称 //配置多语言国际化。i18n为英文单词 internationalization的首末字符i和n,18为中间的字符数 是“国际化”的简称
"i18n":{ "i18n": {
"enable":false //默认关闭,国际化。如果你想使用国际化相关功能,请改为true "enable": false //默认关闭,国际化。如果你想使用国际化相关功能,请改为true
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册