commit 2b1cf9cf3d2cb112beaafe5dcd181b1496781956 Author: 杨豪 <781521347@qq.com> Date: Thu Nov 25 16:24:13 2021 +0800 禅易课堂 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..115cc02 --- /dev/null +++ b/.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/app.js b/app.js new file mode 100644 index 0000000..5a55b4c --- /dev/null +++ b/app.js @@ -0,0 +1,59 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + + }, + login(loginInfo){ + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + + } + }) + }, + http(methods,url,params){ + var header = { + 'content-type': 'application/json', + 'Authorization' : wx.getStorageSync('token') || '' + }; + return new Promise((resolve,reject)=>{ + wx.showLoading({ + title: '正在加载中...', + }) + wx.request({ + url: this.globalData.baseUrl + url, + method: methods, + header: header, + data: params || {}, + success: res=> { + wx.hideLoading(); + if(!res.data.success && res.data.status == 401){ + // console.log('登陆失效') + wx.navigateTo({ + url: '/pages/login/index', + }) + } + resolve(res); + }, + fail: err=> { + wx.hideLoading(); + wx.showToast({ + title: '服务器错误,请稍后再试!', + icon : 'none' + }) + reject(err) + } + }) + }) + }, + globalData: { + baseURL : 'http://192.168.0.114:8092/api/', + // baseURL : 'https://cloud.api.cyjyyjy.com/api/', + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..3680440 --- /dev/null +++ b/app.json @@ -0,0 +1,19 @@ +{ + "pages":[ + "pages/goodsList/index", + "pages/home/index", + + "pages/login/index", + "pages/goodsDetail/index", + "pages/companyInfo/index", + "pages/index/index" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Weixin", + "navigationBarTextStyle":"black" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} diff --git a/app.wxss b/app.wxss new file mode 100644 index 0000000..1ee78cf --- /dev/null +++ b/app.wxss @@ -0,0 +1,83 @@ +view, +scroll-view, +swiper, +button, +input, +textarea, +label, +navigator, +image { + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +image{ + /* border-radius: 8rpx; */ +} +/* layout */ +.acea-row-nowrap { + display: flex; + /* 辅助类 */ +} +.acea-row { + display: flex; + flex-wrap: wrap; + /* 辅助类 */ +} +.acea-row.row-middle,.acea-row-nowrap.row-middle{ + align-items: center; +} +.acea-row.row-top,.acea-row-nowrap.row-top { + align-items: flex-start; +} +.acea-row.row-bottom { + align-items: flex-end; +} +.acea-row.row-center,.acea-row-nowrap.row-center { + justify-content: center; +} +.acea-row.row-right,.acea-row-nowrap.row-right { + justify-content: flex-end; +} +.acea-row.row-left,.acea-row-nowrap.row-left { + justify-content: flex-start; +} +.acea-row.row-between,.acea-row-nowrap.row-between { + justify-content: space-between; +} +.acea-row.row-around, .acea-row-nowrap.row-around{ + justify-content: space-around; +} +.acea-row.row-column-around,.acea-row-nowrap.row-column-around { + flex-direction: column; + justify-content: space-around; +} +.acea-row.row-column { + flex-direction: column; +} +.acea-row.row-column-between,.acea-row-nowrap.row-column-between { + flex-direction: column; + justify-content: space-between; +} +/* 上下左右垂直居中 */ +.acea-row.row-center-wrapper,.acea-row-nowrap.row-center-wrapper { + align-items: center; + justify-content: center; +} +/* 上下两边居中对齐 */ +.acea-row.row-between-wrapper,.acea-row-nowrap.row-between-wrapper { + align-items: center; + justify-content: space-between; +} +.line1{ + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + width: 100%; +} +.line2{ + word-break:break-all; + display:-webkit-box; + -webkit-line-clamp:2; + -webkit-box-orient:vertical; + overflow:hidden; +} \ No newline at end of file diff --git a/images/address.png b/images/address.png new file mode 100644 index 0000000..49171d8 Binary files /dev/null and b/images/address.png differ diff --git a/images/btn-bg.png b/images/btn-bg.png new file mode 100644 index 0000000..db4eb8a Binary files /dev/null and b/images/btn-bg.png differ diff --git a/images/header.png b/images/header.png new file mode 100644 index 0000000..23eae37 Binary files /dev/null and b/images/header.png differ diff --git a/images/lh-icon.png b/images/lh-icon.png new file mode 100644 index 0000000..5d77ce7 Binary files /dev/null and b/images/lh-icon.png differ diff --git a/images/search.png b/images/search.png new file mode 100644 index 0000000..05c79e7 Binary files /dev/null and b/images/search.png differ diff --git a/images/time.png b/images/time.png new file mode 100644 index 0000000..cf5335d Binary files /dev/null and b/images/time.png differ diff --git a/images/title-bg.png b/images/title-bg.png new file mode 100644 index 0000000..c25330c Binary files /dev/null and b/images/title-bg.png differ diff --git a/images/title.png b/images/title.png new file mode 100644 index 0000000..7d4b725 Binary files /dev/null and b/images/title.png differ diff --git a/images/top-bg.png b/images/top-bg.png new file mode 100644 index 0000000..a6fc485 Binary files /dev/null and b/images/top-bg.png differ diff --git a/images/ts.png b/images/ts.png new file mode 100644 index 0000000..9d5f503 Binary files /dev/null and b/images/ts.png differ diff --git a/pages/companyInfo/index.js b/pages/companyInfo/index.js new file mode 100644 index 0000000..e4ab356 --- /dev/null +++ b/pages/companyInfo/index.js @@ -0,0 +1,70 @@ +// pages/companyInfo/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + toList(){ + wx.navigateTo({ + url: '/pages/goodsList/index', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/companyInfo/index.json b/pages/companyInfo/index.json new file mode 100644 index 0000000..e4d5978 --- /dev/null +++ b/pages/companyInfo/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "公司信息" +} \ No newline at end of file diff --git a/pages/companyInfo/index.wxml b/pages/companyInfo/index.wxml new file mode 100644 index 0000000..3917c3a --- /dev/null +++ b/pages/companyInfo/index.wxml @@ -0,0 +1,22 @@ + + + + + + + + + 深圳市瑞梦思时代科技有限公司,瑞蓢国际集团旗下全资子公司,以能量家居系统、智慧健康睡眠生态系统为主打的核心品牌。当前旗下产品包括“重塑本元”、“吉祥卧”床垫,“少年强”青少年床垫,旅行垫,魔术减负能量背包等。\n + 瑞梦思以“专注每一天,健康每一夜”为目标,为人们研发贯穿生活各方面的能量家居产品,让每个家庭,每个人都能从源头开始防患于未然,远离亚健康,享受真正健康轻松的幸福生活。 + + + + + + + + + + + 更多商品 + diff --git a/pages/companyInfo/index.wxss b/pages/companyInfo/index.wxss new file mode 100644 index 0000000..75f525e --- /dev/null +++ b/pages/companyInfo/index.wxss @@ -0,0 +1,48 @@ +/* pages/companyInfo/index.wxss */ +.companyInfo-page{ + width: 100%; +} +.top-bg{ + width: 100%; + height: 578rpx; +} +.top-bg image{ + width: 100%; + height: 100%; +} +.content-box{ + width: 100%; + padding: 0 40rpx; +} +.title-box{ + width: 100%; + height: 92rpx; +} +.title-box image{ + width: 100%; + height: 100%; +} +.introduse-box{ + padding: 12rpx 0; + color: #0B204C; + font-size: 24rpx; + line-height: 34rpx; + font-weight: 500; + text-indent: 1em; +} +.list-box{ + width: 100%; + margin-top: 32rpx; +} +.item{ + width: 200rpx; + height: 152rpx; +} +.item image{ + width: 100%; + height: 100%; + border-radius: 8rpx; +} +.submit-btn{ + margin: 60rpx auto; +} \ No newline at end of file diff --git a/pages/goodsDetail/index.js b/pages/goodsDetail/index.js new file mode 100644 index 0000000..650f442 --- /dev/null +++ b/pages/goodsDetail/index.js @@ -0,0 +1,75 @@ +// pages/goodsDetail/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + toHome(){ + wx.navigateTo({ + url: '/pages/home/index', + }) + }, + toList(){ + wx.navigateTo({ + url: '/pages/goodsList/index', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/goodsDetail/index.json b/pages/goodsDetail/index.json new file mode 100644 index 0000000..ae4a221 --- /dev/null +++ b/pages/goodsDetail/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "商品详情" +} \ No newline at end of file diff --git a/pages/goodsDetail/index.wxml b/pages/goodsDetail/index.wxml new file mode 100644 index 0000000..9d6fbe1 --- /dev/null +++ b/pages/goodsDetail/index.wxml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + 瑞梦思·布胡斯智能床垫 + 129000-289000 + 原价:¥99999 + + + 销量:999+ + + + + + + 产商品情 + + + + + + + + + + + + + 首页 + + + + 商品列表 + + + 立即咨询 + + + + + diff --git a/pages/goodsDetail/index.wxss b/pages/goodsDetail/index.wxss new file mode 100644 index 0000000..a9ced31 --- /dev/null +++ b/pages/goodsDetail/index.wxss @@ -0,0 +1,121 @@ +/* pages/goodsDetail/index.wxss */ +.detail-page{ + min-height: 100vh; + padding-bottom: 180rpx; + background: #F7F7F7; +} +.swiper-box{ + width: 100%; + height: 500rpx; +} +.swiper-box swiper{ + width: 100%; + height: 100%; +} +.swiper-item image{ + width: 100%; + height: 100%; +} + +.goods-info-box{ + width: 670rpx; + height: 216rpx; + background: #fff; + border-radius: 12rpx; + margin: 32rpx auto; + padding: 24rpx 0 24rpx 24rpx; +} +.info-l-box{ + width: 420rpx; +} +.info-l-box .name{ + color: #202020; + font-size: 32rpx; + font-weight: 500; +} +.price{ + font-size: 52rpx; + color: #EB554D; + font-weight: 500; + line-height: 74rpx; + margin: 8rpx 0; +} +.fz20{ + font-size: 24rpx; +} +.old-price{ + font-size: 24rpx; + color: #B9B9B9; +} +.old-price .row-line{ + text-decoration: line-through; +} + +.info-r-box{ + font-size: 24rpx; + color: #B9B9B9; +} +.share-btn{ + width: 102rpx !important; + height: 48rpx !important; + padding: 0; + margin: 0 !important; + background: #EB554D; + border-radius: 28rpx 0px 0px 28rpx; + font-size: 22rpx; + color: #fff; + margin-top: 20rpx !important; + margin-left: 28rpx !important; +} +.share-btn image{ + width: 23rpx; + height: 27rpx; + margin-right: 6rpx; +} + +.title-box{ + margin: 40rpx auto 44rpx; +} +.title-box .row-line{ + width: 58rpx; + height: 2rpx; + background: #000; +} +.title-box .title{ + font-size: 28rpx; + color: #000; + margin: 0 18rpx; + font-weight: 500; +} +.produce-detail{ + width: 100%; +} +.produce-detail image{ + width: 100%; +} + +.footer-box{ + width: 100%; + height: 160rpx; + background: #fff; + position: fixed; + bottom: 0; + left: 0; + padding: 38rpx 40rpx 38rpx 92rpx; +} +.home{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: 22rpx; + color: #202020; + margin-right: 76rpx; +} +.home image{ + width: 48rpx; + height: 48rpx; +} +.submit-btn{ + margin: 0; +} \ No newline at end of file diff --git a/pages/goodsList/index.js b/pages/goodsList/index.js new file mode 100644 index 0000000..620dff3 --- /dev/null +++ b/pages/goodsList/index.js @@ -0,0 +1,70 @@ +// pages/goodsList/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + toDetail(e){ + wx.navigateTo({ + url: '/pages/goodsDetail/index', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/goodsList/index.json b/pages/goodsList/index.json new file mode 100644 index 0000000..86d3bd5 --- /dev/null +++ b/pages/goodsList/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "课程列表" +} \ No newline at end of file diff --git a/pages/goodsList/index.wxml b/pages/goodsList/index.wxml new file mode 100644 index 0000000..1f9724b --- /dev/null +++ b/pages/goodsList/index.wxml @@ -0,0 +1,29 @@ + + + + + + + 搜一下 + + + + + + 无极先天密码 + 商道智慧 + 商道商道智慧商道智慧商道智慧商道智慧智慧 + + + + 武汉 + + + + 2021年11月25日 + + + + + + diff --git a/pages/goodsList/index.wxss b/pages/goodsList/index.wxss new file mode 100644 index 0000000..f6320f5 --- /dev/null +++ b/pages/goodsList/index.wxss @@ -0,0 +1,91 @@ +/* pages/goodsList/index.wxss */ +.goodsList-page{ + width: 100%; + min-height: 100vh; + background: #fff; +} +.search-box{ + width: 670rpx; + height: 68rpx; + border-radius: 8rpx; + border: 2rpx solid #986F43; + margin: 24rpx auto; + padding: 0rpx 0 0rpx 52rpx; +} +.inp-box image{ + width: 35rpx; + height: 35rpx; +} +.search-btn{ + width: 128rpx; + height: 64rpx; + background: #986F43; + border-radius: 4rpx; + text-align: center; + line-height: 64rpx; + font-size: 28rpx; + color: #fff; +} +.goods-list{ + width: 100%; + padding: 40rpx; +} +.goods-item{ + width: 100%; + height: 240rpx; + background: #fff; + border-radius: 12rpx; + padding: 24rpx 32rpx; + margin-bottom: 32rpx; + box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.16); +} +.goods-item .img{ + width: 192rpx; + height: 176rpx; + border-radius: 8rpx; + margin-right: 32rpx; + border: 1px solid #F7F7F7; +} +.goods-info{ + width: calc(100% - 224rpx); + display: flex; + flex-direction: column; + justify-content: space-between; +} +.name{ + color: #202020; + font-size: 28rpx; + line-height: 40rpx; + font-weight: 500; +} +.tips{ + width: 120rpx; + height: 32rpx; + line-height: 28rpx; + padding: 0 10rpx; + border: 2rpx solid #986F43; + border-radius: 18rpx; + font-size: 24rpx; + color: #986F43; +} +.desc{ + color: #A5A5A5; + font-size: 24rpx; + line-height: 34rpx; +} + +.location-box{ + font-size: 24rpx; + color: #474747; +} +.address{ + display: flex; + align-items: center; + margin-right: 10rpx; +} +.address image{ + width: 25rpx; + height: 25rpx; + margin-right: 8rpx; + margin-top: -2rpx; +} \ No newline at end of file diff --git a/pages/home/index.js b/pages/home/index.js new file mode 100644 index 0000000..bdfd9a3 --- /dev/null +++ b/pages/home/index.js @@ -0,0 +1,89 @@ +// pages/home/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + authorize: false, + canIUseGetUserProfile: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + getUserInfoProfile(){ + wx.getUserProfile({ + lang: 'zh_CN', + desc: '需要获取您的信息用来展示', + success: res => { + console.log(res) + uni.showLoading({ + title: '登录中', + }) + + }, + }) + }, + toDetial(){ + wx.navigateTo({ + url: '/pages/goodsDetail/index', + }) + }, + toCompany(){ + wx.navigateTo({ + url: '/pages/companyInfo/index', + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/home/index.json b/pages/home/index.json new file mode 100644 index 0000000..965b8e8 --- /dev/null +++ b/pages/home/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationStyle": "custom" +} \ No newline at end of file diff --git a/pages/home/index.wxml b/pages/home/index.wxml new file mode 100644 index 0000000..13f4511 --- /dev/null +++ b/pages/home/index.wxml @@ -0,0 +1,64 @@ + + + + + + + + 点击查看 + + + + + + + 名师介绍 + + + + + + 刘朗菘,字瑞蓢 + + + 国学文化传播导师 当代民间隐士 武术练养家 + 湖北省文化产业商会常务副会长、传统文化专业委员会主任、国际易学研究院“中国易理策划名师”、“中国名师讲师” +“东方智慧国学风云人物终身推广者”。 + + + + + + 刘朗菘,字瑞蓢 + + + 国学文化传播导师 当代民间隐士 武术练养家 + 湖北省文化产业商会常务副会长、传统文化专业委员会主任、国际易学研究院“中国易理策划名师”、“中国名师讲师” +“东方智慧国学风云人物终身推广者”。 + + + + + + 课程介绍 + + + + + + 传统武术 + + 中国武术不仅是一种中国传统的体育运动形式,而且是一个完整的文化意识形态,它涵容了中国古典哲学、伦理学、美学,医学、兵学等中国传统文化的各种成分和要素,渗透着中国传统文化的精髓。武术具有极其广泛的群众基础,是中国人民在长期的社会实践中不断积累和丰富起来的一项宝贵的文化遗产 + + + + + 传统武术 + + 中国武术不仅是一种中国传统的体育运动形式,而且是一个完整的文化意识形态,它涵容了中国古典哲学、伦理学、美学,医学、兵学等中国传统文化的各种成分和要素,渗透着中国传统文化的精髓。武术具有极其广泛的群众基础,是中国人民在长期的社会实践中不断积累和丰富起来的一项宝贵的文化遗产 + + + + + + diff --git a/pages/home/index.wxss b/pages/home/index.wxss new file mode 100644 index 0000000..77481c0 --- /dev/null +++ b/pages/home/index.wxss @@ -0,0 +1,144 @@ +/* pages/home/index.wxss */ +page{ + width: 100%; + background: #343434; +} +.home-page{ + background: #343434; +} +.top-box{ + width: 100%; + height: 1160rpx; + position: relative; +} +.top-box image{ + width: 100%; + height: 100%; + position: absolute; +} +.top-content{ + width: 100%; + height: 100%; + position: absolute; + z-index: 3; + padding-top: 180rpx; + padding-left: 40rpx; +} +.top-content .tisheng{ + width: 316rpx; + height: 760rpx; +} +.title-box{ + width: 100%; + height: 80rpx; + position: relative; +} +.title-box image{ + width: 434rpx; + height: 74rpx; + margin-right: 16rpx; +} + +.tosee-btn{ + width: 134rpx; + height: 54rpx; + border: 2rpx solid #986F43; + border-radius: 28rpx; + text-align: center; + line-height: 54rpx; + color: #986F43; + font-size: 24rpx; + position: absolute; + left: 456rpx; + top: 20rpx; +} +.teacher-introduce-box,.course-introduce-box{ + width: 100%; + padding: 20rpx 40rpx; + background: #343434; +} +.teacher-item{ + margin-bottom: 76rpx; +} +.item-l image{ + width: 240rpx; + height: 240rpx; +} +.item-l .name{ + font-size: 36rpx; + color: #987A59; + font-weight: 500; + margin-top: 24rpx; +} +.teacher-introduce-box .introduce{ + width: 400rpx; + margin-left: 20rpx; + font-size: 24rpx; + color: #E5E5E5; +} +.introduce .tips{ + font-size: 36rpx; + color: #fff; + margin-bottom: 24rpx; +} +.flexR{ + flex-direction: row-reverse; +} +.course-item{ + width: 100%; + background: #171414; + border-radius: 32rpx; + padding: 32rpx 24rpx; + position: relative; + margin-bottom: 80rpx; +} +.course-name{ + width: 400rpx; + height: 76rpx; + position: absolute; + font-size: 32rpx; + color: #363636; + text-align: center; + line-height: 76rpx; + left: 50%; + top: -38rpx; + transform: translateX(-50%); +} +.course-name image{ + width: 100%; + height: 100%; + position: absolute; + left: 0; +} +.course-name text{ + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); + z-index: 3; +} +.course-item .introduce{ + font-size: 24rpx; + color: #707070; + line-height: 34rpx; + margin-top: 12rpx; + text-indent: 1em; +} +.t-box{ + color: #987A59; + font-size: 40rpx; + margin-bottom: 40rpx; +} +.t-box image{ + width: 64rpx; + height: 64rpx; + margin-left: 8rpx; +} +.submit-btn { + width: 100%; + height: 156rpx; +} +.submit-btn image{ + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..543a3f9 --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,50 @@ +// index.js +// 获取应用实例 +const app = getApp() + +Page({ + data: { + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + // canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName' // 如需尝试获取用户信息可改为false + canIUseOpenData: false + }, + // 事件处理函数 + bindViewTap() { + wx.navigateTo({ + url: '../logs/logs' + }) + }, + onLoad() { + console.log(wx.getUserProfile) + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + getUserInfo(e) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + console.log(e) + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + } +}) diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100644 index 0000000..f00d294 --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + 请使用1.4.4及以上版本基础库 + + + + {{userInfo.nickName}} + + + + {{motto}} + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100644 index 0000000..eb64203 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,19 @@ +/**index.wxss**/ +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + color: #aaa; +} + +.userinfo-avatar { + overflow: hidden; + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..4ff5d7a --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,167 @@ +// pages/login/index.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + login: false, + canIUseGetUserProfilefalse: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let userInfo = wx.getStorageSync('userInfo') + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + this.setData({ + code: res.code + }) + } + }) + }, + setUserInfo(){ + + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (response) => { + wx.showLoading({ + title: '登陆中...', + }) + let data = { + code: this.data.code, + iv: response.iv, + encryptedData:response.encryptedData, + spread: 0, + login_type: 0 + } + app.http('POST','wxapp/auth',data).then( + result =>{ + if(result.data.success){ + wx.hideLoading() + wx.setStorageSync('token', 'Bearer '+ result.data.data.token) + wx.setStorageSync('userInfo', result.data.data.user) + wx.showToast({ + title: '授权成功!', + duration: 1500 + }) + if(!result.data.data.user.phone){ + this.setData({ + login: true + }) + } else{ + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },1500) + } + + } else{ + wx.showToast({ + title: result.data.msg, + icon : 'none' + }) + } + } + ) + } + }) + }, + getPhoneNumber(e) { + if(e.detail.errMsg == 'getPhoneNumber:ok'){ + app.http('post','wxapp/binding', + {encryptedData: e.detail.encryptedData, + iv: e.detail.iv + }).then((res)=>{ + if(res.data.success){ + app.getInfo(); + wx.showToast({ + title: res.data.msg, + duration: 1500 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },1500) + } else{ + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + } + }, + back(){ + wx.navigateBack({ + delta: 1, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..986c90e --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "授权登录" +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..38fe82a --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,17 @@ + + + + + 为了提供更优质的服务,需要您授权基本信息 + + + 请升级微信版本后再授权 + + + diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..ef2d291 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,46 @@ +/* pages/login/index.wxss */ +.authorization { + height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; + padding-top: 190rpx; +} + +.user-avatar { + width: 192rpx; + height: 192rpx; + border-radius: 50%; + overflow: hidden; +} +.user-name{ + margin: 40rpx 0; +} +.login-notice{ + font-size: 28rpx; + font-weight: 500; + line-height: 40rpx; + color: #000; + padding-bottom: 90rpx; +} + +.authorization .wx-btn { + width: 640rpx !important; + height: 86rpx!important; + background: linear-gradient(274deg, #EE7F7B 0%, #EB5750 100%); + border-radius: 60rpx!important; + text-align: center!important; + line-height: 86rpx!important; + margin-bottom: 36rpx!important; + display: flex!important; + align-items: center!important; + justify-content: center!important; + color: #fff; + font-weight: 500 !important; +} +.authorization .btn{ + background: #fff !important; + border: 4rpx solid #EE7F7B; + color: #EE7F7B !important; +} \ No newline at end of file diff --git a/pages/logs/logs.js b/pages/logs/logs.js new file mode 100644 index 0000000..85f6aac --- /dev/null +++ b/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/pages/logs/logs.json b/pages/logs/logs.json new file mode 100644 index 0000000..3ee76c1 --- /dev/null +++ b/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "查看启动日志", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/logs/logs.wxml b/pages/logs/logs.wxml new file mode 100644 index 0000000..0b6b645 --- /dev/null +++ b/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log.date}} + + diff --git a/pages/logs/logs.wxss b/pages/logs/logs.wxss new file mode 100644 index 0000000..94d4b88 --- /dev/null +++ b/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..d61a347 --- /dev/null +++ b/project.config.json @@ -0,0 +1,74 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [ + { + "type": "file", + "value": ".eslintrc.js" + } + ] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true + }, + "compileType": "miniprogram", + "libVersion": "2.19.4", + "appid": "wxdb1f3c2997df014a", + "projectname": "%E7%A6%85%E6%98%93%E8%AF%BE%E5%A0%82", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/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/utils/util.js b/utils/util.js new file mode 100644 index 0000000..764bc2c --- /dev/null +++ b/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 +}