diff --git a/test/.eslintrc.js b/test/.eslintrc.js new file mode 100644 index 0000000000000000000000000000000000000000..115cc02b049fd21c82bc61a7200f51fcec66e528 --- /dev/null +++ b/test/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/test/app.js b/test/app.js new file mode 100644 index 0000000000000000000000000000000000000000..1ed57c47fc86716c337dee0e196bdbbac27abfe5 --- /dev/null +++ b/test/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + }, + globalData: { + userInfo: null + } +}) diff --git a/test/app.json b/test/app.json new file mode 100644 index 0000000000000000000000000000000000000000..18ba29df56a2e5fa3fa4e9982308bf255c33830d --- /dev/null +++ b/test/app.json @@ -0,0 +1,20 @@ +{ + "pages": [ + "pages/test4/test4", + "pages/test3/test3", + "pages/test2/test2", + "pages/test1/test1", + "pages/test/test", + "pages/index/index", + "pages/logs/logs" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "林涛测试用", + "navigationBarBackgroundColor": "#ffffff" + }, + "style": "v2", + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents" +} diff --git a/test/app.wxss b/test/app.wxss new file mode 100644 index 0000000000000000000000000000000000000000..06c6fc9ce35b7d02e031b1e8f4636147321dedc1 --- /dev/null +++ b/test/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/test/images/banner1.jpg b/test/images/banner1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c10f8a61ff8582550d52e44e3ea628e7404e4680 Binary files /dev/null and b/test/images/banner1.jpg differ diff --git a/test/images/icon_API.png b/test/images/icon_API.png new file mode 100644 index 0000000000000000000000000000000000000000..76e6cb99ee98d5981a32a093a36753def0e01c87 Binary files /dev/null and b/test/images/icon_API.png differ diff --git a/test/images/icon_API_HL.png b/test/images/icon_API_HL.png new file mode 100644 index 0000000000000000000000000000000000000000..5b7ae94befdf7d87e589e15547c697bd6470ec06 Binary files /dev/null and b/test/images/icon_API_HL.png differ diff --git a/test/images/icon_component.png b/test/images/icon_component.png new file mode 100644 index 0000000000000000000000000000000000000000..301f579aefe5d6cb304da54b211b41dc87c7f386 Binary files /dev/null and b/test/images/icon_component.png differ diff --git a/test/images/icon_component_HL.png b/test/images/icon_component_HL.png new file mode 100644 index 0000000000000000000000000000000000000000..65c3fcb7d3db5cf3d5229676511deb9b0fe31821 Binary files /dev/null and b/test/images/icon_component_HL.png differ diff --git a/test/pages/index/index.js b/test/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a8d6aa5979e951d357651a912171c2cdd10e583f --- /dev/null +++ b/test/pages/index/index.js @@ -0,0 +1,49 @@ +// index.js +const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0' + +Page({ + data: { + motto: 'Hello World', + userInfo: { + avatarUrl: defaultAvatarUrl, + nickName: '', + }, + hasUserInfo: false, + canIUseGetUserProfile: wx.canIUse('getUserProfile'), + canIUseNicknameComp: wx.canIUse('input.type.nickname'), + }, + bindViewTap() { + wx.navigateTo({ + url: '../logs/logs' + }) + }, + onChooseAvatar(e) { + const { avatarUrl } = e.detail + const { nickName } = this.data.userInfo + this.setData({ + "userInfo.avatarUrl": avatarUrl, + hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, + }) + }, + onInputChange(e) { + const nickName = e.detail.value + const { avatarUrl } = this.data.userInfo + this.setData({ + "userInfo.nickName": nickName, + hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl, + }) + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, +}) diff --git a/test/pages/index/index.json b/test/pages/index/index.json new file mode 100644 index 0000000000000000000000000000000000000000..b55b5a25411975f285b21a489b8ef5b6f6c325a6 --- /dev/null +++ b/test/pages/index/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/test/pages/index/index.wxml b/test/pages/index/index.wxml new file mode 100644 index 0000000000000000000000000000000000000000..0721ba067d5d6fcb4049b693879426347f589d42 --- /dev/null +++ b/test/pages/index/index.wxml @@ -0,0 +1,27 @@ + + + + + + + + 昵称 + + + + + + 请使用2.10.4及以上版本基础库 + + + + {{userInfo.nickName}} + + + + {{motto}} + + + diff --git a/test/pages/index/index.wxss b/test/pages/index/index.wxss new file mode 100644 index 0000000000000000000000000000000000000000..1ebed4b432138b341bb0f60fa28acc80c590652c --- /dev/null +++ b/test/pages/index/index.wxss @@ -0,0 +1,62 @@ +/**index.wxss**/ +page { + height: 100vh; + display: flex; + flex-direction: column; +} +.scrollarea { + flex: 1; + overflow-y: hidden; +} + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + color: #aaa; + width: 80%; +} + +.userinfo-avatar { + overflow: hidden; + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} + +.avatar-wrapper { + padding: 0; + width: 56px !important; + border-radius: 8px; + margin-top: 40px; + margin-bottom: 40px; +} + +.avatar { + display: block; + width: 56px; + height: 56px; +} + +.nickname-wrapper { + display: flex; + width: 100%; + padding: 16px; + box-sizing: border-box; + border-top: .5px solid rgba(0, 0, 0, 0.1); + border-bottom: .5px solid rgba(0, 0, 0, 0.1); + color: black; +} + +.nickname-label { + width: 105px; +} + +.nickname-input { + flex: 1; +} diff --git a/test/pages/logs/logs.js b/test/pages/logs/logs.js new file mode 100644 index 0000000000000000000000000000000000000000..85f6aac5ab16db728fa27cdf75c4ab2126b1105b --- /dev/null +++ b/test/pages/logs/logs.js @@ -0,0 +1,18 @@ +// logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad() { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return { + date: util.formatTime(new Date(log)), + timeStamp: log + } + }) + }) + } +}) diff --git a/test/pages/logs/logs.json b/test/pages/logs/logs.json new file mode 100644 index 0000000000000000000000000000000000000000..b55b5a25411975f285b21a489b8ef5b6f6c325a6 --- /dev/null +++ b/test/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/test/pages/logs/logs.wxml b/test/pages/logs/logs.wxml new file mode 100644 index 0000000000000000000000000000000000000000..85cf1bfe79c718c4222c94fc090af60dcf29575d --- /dev/null +++ b/test/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log.date}} + + diff --git a/test/pages/logs/logs.wxss b/test/pages/logs/logs.wxss new file mode 100644 index 0000000000000000000000000000000000000000..33f9d9e1dca09f6aeb68b3e39c243876ce5d240f --- /dev/null +++ b/test/pages/logs/logs.wxss @@ -0,0 +1,16 @@ +page { + height: 100vh; + display: flex; + flex-direction: column; +} +.scrollarea { + flex: 1; + overflow-y: hidden; +} +.log-item { + margin-top: 20rpx; + text-align: center; +} +.log-item:last-child { + padding-bottom: env(safe-area-inset-bottom); +} diff --git a/test/pages/test/test.js b/test/pages/test/test.js new file mode 100644 index 0000000000000000000000000000000000000000..a26758d21dadb26227d769887ec64ea87282698e --- /dev/null +++ b/test/pages/test/test.js @@ -0,0 +1,66 @@ +// pages/test/test.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/test/pages/test/test.json b/test/pages/test/test.json new file mode 100644 index 0000000000000000000000000000000000000000..6f5247b050d616d1d9ab35b9dec4da0b673757b8 --- /dev/null +++ b/test/pages/test/test.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test/pages/test/test.less b/test/pages/test/test.less new file mode 100644 index 0000000000000000000000000000000000000000..aec9ced14bb0a838f1789b173cac939150a56049 --- /dev/null +++ b/test/pages/test/test.less @@ -0,0 +1,33 @@ +.outer { + /* 设置元素宽度为 300rpx */ + width: 300rpx; + /* 设置元素高度为 200rpx */ + height: 200rpx; + /* 设置元素背景色为淡灰色(#eee)*/ + background-color: #eee; + /* 设置元素为 flex 布局 */ + display: flex; + /* 在水平方向上居中元素 */ + justify-content: center; + /* 在垂直方向上居中元素 */ + align-items: center; +} + +.middle { + width: 200rpx; + height: 150rpx; + background-color: #999; + display: flex; + justify-content: center; + align-items: center; +} + +.inner { + width: 100rpx; + height: 100rpx; + background-color: #333; + display: flex; + justify-content: center; + align-items: center; + color: white; +} diff --git a/test/pages/test/test.ts b/test/pages/test/test.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd204f5c5af47cee4805312c39d8571fc1062847 --- /dev/null +++ b/test/pages/test/test.ts @@ -0,0 +1,40 @@ +Page({ + data: { + output: "", + scanResult:'请扫码' + }, + + scanCode: function() { + var that = this; // 保存 this 的引用 + wx.scanCode({ + success: function(res) { + console.log(res.result); + that.setData({ // 使用 that 而不是 this + scanResult: res.result + }); + }, + fail: function(err) { + console.error(err); + } + }); + }, + + handleConfirm: function (event) { + console.log('handleConfirm'); + this.setData({ output: event.detail.value }); + }, + + handleBlur: function (event) { + this.setData({ output: event.detail.value }); + }, + + handleOuterTap: function () { + console.log('外圈'); + }, + handleMiddleTap: function () { + console.log('中圈'); + }, + handleInnerTap: function () { + console.log('内圈'); + }, +}) diff --git a/test/pages/test/test.wxml b/test/pages/test/test.wxml new file mode 100644 index 0000000000000000000000000000000000000000..ddbf7eec5b610eb2b6b73f4a165c070b9bd28581 --- /dev/null +++ b/test/pages/test/test.wxml @@ -0,0 +1,22 @@ + + 外圈 + + 中圈 + + 内圈 + + + + + + + 输出:{{output}} + + + + + 二维码:{{scanResult}} + + + + diff --git a/test/pages/test/test.wxss b/test/pages/test/test.wxss new file mode 100644 index 0000000000000000000000000000000000000000..ccbefc2276faeca73c639d4d3e37938239cb60bf --- /dev/null +++ b/test/pages/test/test.wxss @@ -0,0 +1 @@ +/* pages/test/test.wxss */ diff --git a/test/pages/test1/test1.js b/test/pages/test1/test1.js new file mode 100644 index 0000000000000000000000000000000000000000..fcef747ae719a7dccfb761a6febfa2ec79d02e91 --- /dev/null +++ b/test/pages/test1/test1.js @@ -0,0 +1,96 @@ +// pages/test1/test1.js +Page({ + /** + * 页面的初始数据 + */ + data: { + numList:[1,2,3] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + console.log('监听用户下拉刷新') + this.setData({ + numList: [1,2,3] + }) + // 下拉刷新以后,loading效果有可能不会回弹回去 + if (this.data.numList.length === 3){ + wx.stopPullDownRefresh() + } + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('监听用户上拉加载') + // 增加一个提示框 + wx.showLoading({ + title: '数据加载中...', + }) + // 设定一个定时器。在定时到期以后执行注册的回调函数 + setTimeout(() => { + // 获取数组的最后一项 + const lastNum = this.data.numList[this.data.numList.length-1] + // 需要追加的元素 + const newArr = [lastNum + 1,lastNum + 2,lastNum +3] + + // 合并初始数组以及追加后的数组 + // 例如初始数组[1,2,3] + // 追加后[1,2,3,4,5,6] + this.setData({ + numList: [...this.data.numList,...newArr] + }) + + // 隐藏 loading 提示框 + wx.hideLoading() + // 通过更改数字进行更改延时 + },100 + ) + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/test/pages/test1/test1.json b/test/pages/test1/test1.json new file mode 100644 index 0000000000000000000000000000000000000000..ca6d63c627491e5477baa344d6ddf13f02356e46 --- /dev/null +++ b/test/pages/test1/test1.json @@ -0,0 +1,7 @@ +{ + "usingComponents": {}, + "onReachBottomDistance":220, + "enablePullDownRefresh": true, + "backgroundColor": "#efefef", + "backgroundTextStyle":"dark" +} \ No newline at end of file diff --git a/test/pages/test1/test1.wxml b/test/pages/test1/test1.wxml new file mode 100644 index 0000000000000000000000000000000000000000..11490eaaff16f0b8c2fd63fdf80d19850b9b13bf --- /dev/null +++ b/test/pages/test1/test1.wxml @@ -0,0 +1,3 @@ + +pages/test1/test1.wxml +{{ item }} \ No newline at end of file diff --git a/test/pages/test1/test1.wxss b/test/pages/test1/test1.wxss new file mode 100644 index 0000000000000000000000000000000000000000..b656927e470785c97f9fdd99d339b0b338eb9b5f --- /dev/null +++ b/test/pages/test1/test1.wxss @@ -0,0 +1,27 @@ +/* pages/test1/test1.wxss */ +page{ + height: 1000px; +} + +view{ + height: 200rpx; + display: flex; + align-items: center; + justify-content: center; +} + +view:nth-child(odd){ + background-color: lightskyblue; +} + +view:nth-child(even){ + background-color: rgb(201, 210, 216); +} + +view:last-child { + background-color: rgb(240, 226, 181); +} + +view:first-child { + background-color: rgb(240, 226, 181); +} diff --git a/test/pages/test2/test2.js b/test/pages/test2/test2.js new file mode 100644 index 0000000000000000000000000000000000000000..22409a6f76188b18348b74c3997f5fd2b6b729cb --- /dev/null +++ b/test/pages/test2/test2.js @@ -0,0 +1,70 @@ +// pages/test2/test2.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + imageUrls: [ + '/images/icon_API.png', + '/images/icon_API.png', + '/images/icon_API.png' + ] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/test/pages/test2/test2.json b/test/pages/test2/test2.json new file mode 100644 index 0000000000000000000000000000000000000000..6f5247b050d616d1d9ab35b9dec4da0b673757b8 --- /dev/null +++ b/test/pages/test2/test2.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test/pages/test2/test2.wxml b/test/pages/test2/test2.wxml new file mode 100644 index 0000000000000000000000000000000000000000..5c13c913d32da212c8f10cbb460485bcf3a7ffa8 --- /dev/null +++ b/test/pages/test2/test2.wxml @@ -0,0 +1,25 @@ + + + + 1 + + + 2 + + + 3 + + + + + 1 + 2 + 3 + + + + + + + + \ No newline at end of file diff --git a/test/pages/test2/test2.wxss b/test/pages/test2/test2.wxss new file mode 100644 index 0000000000000000000000000000000000000000..66369b035bd4f095861da1317432fff4f6866940 --- /dev/null +++ b/test/pages/test2/test2.wxss @@ -0,0 +1,82 @@ +.scroll-x { + width: 100%; + white-space: nowrap; + background-color: skyblue; +} + +.scroll-x view { + display: inline-block; + width: 300rpx; + height: 300rpx; +} + +.scroll-x view:last-child { + background-color: lightcoral; +} + +.scroll-x view:first-child { + background-color: lightseagreen; +} + +.scroll-y { + height: 300rpx; + background-color: skyblue; + margin-top: 10rpx; +} + +.scroll-y view { + height: 100rpx; +} + +.scroll-y view:last-child { + background-color: lightcoral; +} + +.scroll-y view:first-child { + background-color: lightseagreen; +} + +/* WXSS 文件 */ +.good-item { + width: 100%; /* 或者使用具体宽度,如 300rpx */ + height: 200rpx; /* 根据需要设定 */ + display: inline-block; + justify-content: center; + align-items: center; + overflow: hidden; + border: 1rpx solid #ccc; /* 可选,为了更清楚地看到边界 */ +} + +/* 你可以在这里设置image的样式,但mode已在HTML中指定 */ + +.scroll-z { + width: 100%; + white-space: nowrap; + background-color: skyblue; +} + +/* WXSS 文件 */ +.scroll-view-horizontal { + white-space: nowrap; /* 保持子元素在一行显示 */ + display: flex; /* 使用flex布局 */ + overflow-x: auto; /* 允许横向滚动 */ + /* 可选:设置固定高度 */ + height: 150px; /* 根据你的需求调整 */ +} + +.image-container { + display: inline-block; /* 使图片容器横向排列 */ + /* 可选:设置图片之间的间距 */ + margin-right: 10px; +} + +.scroll-image { + /* 根据需要设置图片的样式,如宽度、高度等 */ + /* mode="widthFix" 时,只需要设置宽度或高度其中一个即可 */ + width: 100%; /* 宽度占满容器,但高度会根据图片宽高比自动调整 */ + /* 如果你希望图片有固定的高度,可以取消 width: 100%; 并设置固定的高度,但注意这样会改变图片的宽高比 */ + /* height: 100px; */ +} + +/* 注意:由于使用了 mode="widthFix",图片的高度会根据宽度自动调整以保持宽高比, + 因此你通常只需要设置图片的宽度或者容器的宽度,高度会自动计算。 */ diff --git a/test/pages/test3/test3.js b/test/pages/test3/test3.js new file mode 100644 index 0000000000000000000000000000000000000000..85b9114c38c9846eb8a29a5c1086cfb99f8cb33a --- /dev/null +++ b/test/pages/test3/test3.js @@ -0,0 +1,73 @@ +// pages/test3/test3.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + imageUrls: [ + '/images/banner1.jpg', + '/images/icon_API.png', + '/images/banner1.jpg', + '/images/icon_API.png', + '/images/banner1.jpg', + '/images/icon_component_HL.png' + ] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/test/pages/test3/test3.json b/test/pages/test3/test3.json new file mode 100644 index 0000000000000000000000000000000000000000..6f5247b050d616d1d9ab35b9dec4da0b673757b8 --- /dev/null +++ b/test/pages/test3/test3.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test/pages/test3/test3.wxml b/test/pages/test3/test3.wxml new file mode 100644 index 0000000000000000000000000000000000000000..85e42e983e620dac6c648bf07230c2d4d07d20a7 --- /dev/null +++ b/test/pages/test3/test3.wxml @@ -0,0 +1,8 @@ + +pages/test3/test3.wxml + + + + + + \ No newline at end of file diff --git a/test/pages/test3/test3.wxss b/test/pages/test3/test3.wxss new file mode 100644 index 0000000000000000000000000000000000000000..6f91f988047f3857834856a8eeaf53f2f3166e55 --- /dev/null +++ b/test/pages/test3/test3.wxss @@ -0,0 +1,29 @@ +/* pages/test3/test3.wxss */ + +/* WXSS 文件 */ +.scroll-view-horizontal { + white-space: nowrap; /* 保持子元素在一行显示 */ + display: flex; /* 使用flex布局 */ + overflow-x: auto; /* 允许横向滚动 */ + /* 可选:设置固定高度 */ + height: 250px; /* 根据你的需求调整 */ +} + +.image-container { + display: inline-block; /* 使图片容器横向排列 */ + /* 可选:设置图片之间的间距 */ + margin-right: 10px; + height: 150; /* 根据你的需求调整 */ +} + +.scroll-image { + /* 根据需要设置图片的样式,如宽度、高度等 */ + /* mode="widthFix" 时,只需要设置宽度或高度其中一个即可 */ + width: 100px; /* 宽度占满容器,但高度会根据图片宽高比自动调整 */ + height: 100px; + /* 如果你希望图片有固定的高度,可以取消 width: 100%; 并设置固定的高度,但注意这样会改变图片的宽高比 */ + /* height: 100px; */ +} + +/* 注意:由于使用了 mode="widthFix",图片的高度会根据宽度自动调整以保持宽高比, + 因此你通常只需要设置图片的宽度或者容器的宽度,高度会自动计算。 */ diff --git a/test/pages/test4/test4.js b/test/pages/test4/test4.js new file mode 100644 index 0000000000000000000000000000000000000000..bd4dee199bb879a503d16ae45a393f5eae435c79 --- /dev/null +++ b/test/pages/test4/test4.js @@ -0,0 +1,63 @@ +// pages/test/test.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + navId: 0, //导航栏id + windowHeight: '', //屏幕的高度 + currentId: 0 //swiper下标 + }, + topSwiper(event) { + let navId = event.detail.current; //获取swiper下标 + console.log('topSwiper navId:'+event.detail.current) + this.setData({ + navId + }) + }, + //导航栏 + changNav(event) { + let navId = event.currentTarget.dataset.id; //获取导航栏下标 + let windowHeight = this.data.windowHeight; // + console.log('changNav windowHeight:'+windowHeight) + if (this.data.currentId == navId) { + return false; + } else { + this.setData({ + currentId: navId + }) + } + this.setData({ + navId, + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + //获取屏幕高度 + let that = this; + wx.getSystemInfo({ + success: function (res) { + let clientHeight = res.windowHeight, + clientWidth = res.windowWidth, + rpxR = 750 / clientWidth; + let calc = clientHeight * rpxR; + console.log('calc:'+calc); + console.log('rpxR:'+rpxR); + that.setData({ + windowHeight: calc, + }); + } + }); + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) diff --git a/test/pages/test4/test4.json b/test/pages/test4/test4.json new file mode 100644 index 0000000000000000000000000000000000000000..6f5247b050d616d1d9ab35b9dec4da0b673757b8 --- /dev/null +++ b/test/pages/test4/test4.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/test/pages/test4/test4.wxml b/test/pages/test4/test4.wxml new file mode 100644 index 0000000000000000000000000000000000000000..7d0aa2b3392c80aaca799bb4caf3a525a0978059 --- /dev/null +++ b/test/pages/test4/test4.wxml @@ -0,0 +1,40 @@ + +pages/test4/test4.wxml + + + + + 品牌介绍 + + + + + 专利认证 + + + + + 售后保险 + + + + + 加入我们 + + + + + + + AAAA + + + BBBB + + + CCCC + + + DDDD + + diff --git a/test/pages/test4/test4.wxss b/test/pages/test4/test4.wxss new file mode 100644 index 0000000000000000000000000000000000000000..bcaceb36be2013b7fce747af52397940b3a9051b --- /dev/null +++ b/test/pages/test4/test4.wxss @@ -0,0 +1,46 @@ +/* pages/test4/test4.wxss */ +.navScroll { + display: flex; + white-space: nowrap; + height: 80rpx; + background-color: rgba(83, 83, 83, 100); + position: fixed; + top: 0; + z-index: 100; +} + +.navScroll .navItem { + width: calc(100%/4); + font-size: 20rpx; + border: 0rpx solid red; + display: flex; + justify-content: center; + align-items: center; +} + +.navScroll .navItem .active { + background-color: rgba(238, 205, 141, 100); + color: rgba(255, 255, 255, 100); +} + +.navScroll .navContent { + width: 60%; + height: 48rpx; + line-height: 48rpx; + border-radius: 24rpx; + border: 0rpx solid red; + text-align: center; + color: rgba(238, 205, 141, 100); +} + +.top_swiper{ + width: 100%; + text-align: center; + color:#FFF; + +} + +.swiperItem{ + width: 100%; + height: 100%; +} diff --git a/test/project.config.json b/test/project.config.json new file mode 100644 index 0000000000000000000000000000000000000000..719463b50e038734cd9b7337ed33d3c562106e00 --- /dev/null +++ b/test/project.config.json @@ -0,0 +1,28 @@ +{ + "compileType": "miniprogram", + "libVersion": "trial", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "coverView": true, + "es6": true, + "postcss": true, + "minified": true, + "enhance": true, + "showShadowRootInWxmlPanel": true, + "packNpmRelationList": [], + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } + }, + "condition": {}, + "editorSetting": { + "tabIndent": "auto", + "tabSize": 2 + }, + "appid": "wxf74b9d8d1f5a59dc" +} \ No newline at end of file diff --git a/test/project.private.config.json b/test/project.private.config.json new file mode 100644 index 0000000000000000000000000000000000000000..0e62b7c9d2ff28ebfbe58c94ff2a99b2c19690a6 --- /dev/null +++ b/test/project.private.config.json @@ -0,0 +1,7 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "test", + "setting": { + "compileHotReLoad": true + } +} \ No newline at end of file diff --git a/test/sitemap.json b/test/sitemap.json new file mode 100644 index 0000000000000000000000000000000000000000..ca02add20b581be471b8d17f887b8e8337070546 --- /dev/null +++ b/test/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/test/utils/util.js b/test/utils/util.js new file mode 100644 index 0000000000000000000000000000000000000000..764bc2ce26ab9b55a21cbb069dcf084a8418dffd --- /dev/null +++ b/test/utils/util.js @@ -0,0 +1,19 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +module.exports = { + formatTime +}