Browse Source

禅易课堂

zys
杨豪 3 years ago
commit
2b1cf9cf3d
  1. 31
      .eslintrc.js
  2. 59
      app.js
  3. 19
      app.json
  4. 83
      app.wxss
  5. BIN
      images/address.png
  6. BIN
      images/btn-bg.png
  7. BIN
      images/header.png
  8. BIN
      images/lh-icon.png
  9. BIN
      images/search.png
  10. BIN
      images/time.png
  11. BIN
      images/title-bg.png
  12. BIN
      images/title.png
  13. BIN
      images/top-bg.png
  14. BIN
      images/ts.png
  15. 70
      pages/companyInfo/index.js
  16. 4
      pages/companyInfo/index.json
  17. 22
      pages/companyInfo/index.wxml
  18. 48
      pages/companyInfo/index.wxss
  19. 75
      pages/goodsDetail/index.js
  20. 4
      pages/goodsDetail/index.json
  21. 55
      pages/goodsDetail/index.wxml
  22. 121
      pages/goodsDetail/index.wxss
  23. 70
      pages/goodsList/index.js
  24. 4
      pages/goodsList/index.json
  25. 29
      pages/goodsList/index.wxml
  26. 91
      pages/goodsList/index.wxss
  27. 89
      pages/home/index.js
  28. 4
      pages/home/index.json
  29. 64
      pages/home/index.wxml
  30. 144
      pages/home/index.wxss
  31. 50
      pages/index/index.js
  32. 3
      pages/index/index.json
  33. 23
      pages/index/index.wxml
  34. 19
      pages/index/index.wxss
  35. 167
      pages/login/index.js
  36. 4
      pages/login/index.json
  37. 17
      pages/login/index.wxml
  38. 46
      pages/login/index.wxss
  39. 18
      pages/logs/logs.js
  40. 4
      pages/logs/logs.json
  41. 6
      pages/logs/logs.wxml
  42. 8
      pages/logs/logs.wxss
  43. 74
      project.config.json
  44. 7
      sitemap.json
  45. 19
      utils/util.js

31
.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: {},
}

59
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/',
}
})

19
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"
}

83
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;
}

BIN
images/address.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/btn-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
images/header.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
images/lh-icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/search.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/time.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

BIN
images/title-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
images/title.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
images/top-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

BIN
images/ts.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

70
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 () {
}
})

4
pages/companyInfo/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "公司信息"
}

22
pages/companyInfo/index.wxml

@ -0,0 +1,22 @@
<!--pages/companyInfo/index.wxml-->
<view class="companyInfo-page">
<view class="top-bg"><image src="../../images/company-info.png"></image></view>
<view class="content-box">
<view class="title-box">
<image src="../../images/title1.png"></image>
</view>
<view class="introduse-box">
<text>深圳市瑞梦思时代科技有限公司,瑞蓢国际集团旗下全资子公司,以能量家居系统、智慧健康睡眠生态系统为主打的核心品牌。当前旗下产品包括“重塑本元”、“吉祥卧”床垫,“少年强”青少年床垫,旅行垫,魔术减负能量背包等。\n</text>
<text>瑞梦思以“专注每一天,健康每一夜”为目标,为人们研发贯穿生活各方面的能量家居产品,让每个家庭,每个人都能从源头开始防患于未然,远离亚健康,享受真正健康轻松的幸福生活。</text>
</view>
<view class="title-box">
<image src="../../images/title2.png"></image>
</view>
<view class="list-box acea-row row-between">
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view>
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view>
<view class="item"><image src="../../images/jixiang.png" mode="aspectFill"></image></view>
</view>
</view>
<view class="submit-btn" bindtap="toList">更多商品</view>
</view>

48
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;
}

75
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 () {
}
})

4
pages/goodsDetail/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "商品详情"
}

55
pages/goodsDetail/index.wxml

@ -0,0 +1,55 @@
<!--pages/goodsDetail/index.wxml-->
<view class="detail-page">
<view class="swiper-box">
<swiper>
<block>
<swiper-item>
<view class="swiper-item">
<image src="../../images/jixiang.png" mode="widthFix"></image>
</view>
</swiper-item>
</block>
</swiper>
</view>
<view class="goods-info-box acea-row row-between">
<view class="info-l-box">
<view class="name line1">瑞梦思·布胡斯智能床垫</view>
<view class="price"><text class="fz20">¥</text>129000-289000</view>
<view class="old-price">原价:¥<text class="row-line">99999</text></view>
</view>
<view class="info-r-box">
<view>销量:999+</view>
<button open-type="share" class="share-btn acea-row row-center-wrapper">
<image src="../../images/share.png"></image>
<text>分享</text>
</button>
</view>
</view>
<view class="title-box acea-row row-center row-middle">
<view class="row-line"></view>
<view class="title">产商品情</view>
<view class="row-line"></view>
</view>
<view class="produce-detail">
<image src="../../images/jixiang.png" mode="widthFix"></image>
<image src="../../images/jixiang.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
<image src="../../images/chongsu.png" mode="widthFix"></image>
</view>
<view class="footer-box acea-row row-between-wrapper">
<view class="icons-box acea-row">
<view class="home" bindtap="toHome">
<image src="../../images/home.png"></image>
<text>首页</text>
</view>
<view class="home" bindtap="toList">
<image src="../../images/list.png"></image>
<text>商品列表</text>
</view>
</view>
<view class="submit-btn">立即咨询</view>
</view>
<view class="mask-box">
</view>
</view>

121
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;
}

70
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 () {
}
})

4
pages/goodsList/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "课程列表"
}

29
pages/goodsList/index.wxml

@ -0,0 +1,29 @@
<!--pages/goodsList/index.wxml-->
<view class="goodsList-page">
<view class="search-box acea-row row-middle row-between">
<view class="inp-box">
<image src="../../images/search.png"></image>
</view>
<view class="search-btn">搜一下</view>
</view>
<view class="goods-list">
<view class="goods-item acea-row" wx:for="{{3}}" :key="index" bindtap="toDetail" data-id="id">
<image src="../../images/jixiang.png" class="img" mode="aspectFill"></image>
<view class="goods-info">
<view class="name line1">无极先天密码</view>
<view class="tips">商道智慧</view>
<view class="desc line1">商道商道智慧商道智慧商道智慧商道智慧智慧</view>
<view class="location-box acea-row row-middle">
<view class="address">
<image src="../../images/address.png"></image>
<text>武汉</text>
</view>
<view class="address">
<image src="../../images/time.png"></image>
<text>2021年11月25日</text>
</view>
</view>
</view>
</view>
</view>
</view>

91
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;
}

89
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 () {
}
})

4
pages/home/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

64
pages/home/index.wxml

@ -0,0 +1,64 @@
<!--pages/home/index.wxml-->
<view class="home-page">
<view class="top-box">
<image src="../../images/top-bg.png"></image>
<view class="top-content">
<view class="title-box">
<image src="../../images/title.png"></image>
<view class="tosee-btn">点击查看</view>
</view>
<image src="../../images/ts.png" class="tisheng"></image>
</view>
</view>
<view class="teacher-introduce-box">
<view class="t-box acea-row row-middle">
<view>名师介绍</view>
<image src="../../images/lh-icon.png"></image>
</view>
<view class="teacher-item acea-row">
<view class="item-l">
<image src="../../images/header.png"></image>
<view class="name">刘朗菘,字瑞蓢</view>
</view>
<view class="introduce">
<view class="tips">国学文化传播导师 当代民间隐士 武术练养家</view>
<view class="desc">湖北省文化产业商会常务副会长、传统文化专业委员会主任、国际易学研究院“中国易理策划名师”、“中国名师讲师”
“东方智慧国学风云人物终身推广者”。</view>
</view>
</view>
<view class="teacher-item acea-row flexR">
<view class="item-l">
<image src="../../images/header.png"></image>
<view class="name">刘朗菘,字瑞蓢</view>
</view>
<view class="introduce">
<view class="tips">国学文化传播导师 当代民间隐士 武术练养家</view>
<view class="desc">湖北省文化产业商会常务副会长、传统文化专业委员会主任、国际易学研究院“中国易理策划名师”、“中国名师讲师”
“东方智慧国学风云人物终身推广者”。</view>
</view>
</view>
</view>
<view class="course-introduce-box">
<view class="t-box acea-row row-middle">
<view>课程介绍</view>
<image src="../../images/lh-icon.png"></image>
</view>
<view class="course-item">
<view class="course-name">
<image src="../../images/title-bg.png"></image>
<text>传统武术</text>
</view>
<view class="introduce"> 中国武术不仅是一种中国传统的体育运动形式,而且是一个完整的文化意识形态,它涵容了中国古典哲学、伦理学、美学,医学、兵学等中国传统文化的各种成分和要素,渗透着中国传统文化的精髓。武术具有极其广泛的群众基础,是中国人民在长期的社会实践中不断积累和丰富起来的一项宝贵的文化遗产 </view>
</view>
<view class="course-item">
<view class="course-name">
<image src="../../images/title-bg.png"></image>
<text>传统武术</text>
</view>
<view class="introduce"> 中国武术不仅是一种中国传统的体育运动形式,而且是一个完整的文化意识形态,它涵容了中国古典哲学、伦理学、美学,医学、兵学等中国传统文化的各种成分和要素,渗透着中国传统文化的精髓。武术具有极其广泛的群众基础,是中国人民在长期的社会实践中不断积累和丰富起来的一项宝贵的文化遗产 </view>
</view>
</view>
<view class="submit-btn">
<image src="../../images/btn-bg.png"></image>
</view>
</view>

144
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%;
}

50
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
})
}
})

3
pages/index/index.json

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

23
pages/index/index.wxml

@ -0,0 +1,23 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data type="userNickName"></open-data>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:elif="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>

19
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;
}

167
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 () {
}
})

4
pages/login/index.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "授权登录"
}

17
pages/login/index.wxml

@ -0,0 +1,17 @@
<!--pages/login/index.wxml-->
<view class="authorization">
<open-data class="user-avatar" type="userAvatarUrl"></open-data>
<open-data class="user-name" type="userNickName"></open-data>
<view class="login-notice">为了提供更优质的服务,需要您授权基本信息</view>
<button class="wx-btn" bindtap='getUserProfile' wx:if="{{!login && canIUseGetUserProfile}}">
<text>微信授权登录</text>
</button>
<button open-type="getPhoneNumber" class="wx-btn" bindgetphonenumber="getPhoneNumber" wx:if="{{login}}">
<text>绑定手机号</text>
</button>
<view class="login-notice" wx:if="{{!login && !canIUseGetUserProfile}}">请升级微信版本后再授权</view>
<button class="wx-btn btn" bindtap="back">
<text>暂不授权</text>
</button>
</view>

46
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;
}

18
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
}
})
})
}
})

4
pages/logs/logs.json

@ -0,0 +1,4 @@
{
"navigationBarTitleText": "查看启动日志",
"usingComponents": {}
}

6
pages/logs/logs.wxml

@ -0,0 +1,6 @@
<!--logs.wxml-->
<view class="container log-list">
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
<text class="log-item">{{index + 1}}. {{log.date}}</text>
</block>
</view>

8
pages/logs/logs.wxss

@ -0,0 +1,8 @@
.log-list {
display: flex;
flex-direction: column;
padding: 40rpx;
}
.log-item {
margin: 10rpx;
}

74
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": []
}
}
}

7
sitemap.json

@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}

19
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
}
Loading…
Cancel
Save