配置
This commit is contained in:
@@ -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: {},
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
// app.js
|
||||
const MyApi = require('./Api/api.js');
|
||||
|
||||
App({
|
||||
onLaunch() {
|
||||
|
||||
MyApi.ApiGetUserOpenID()
|
||||
.then(result => {
|
||||
// 获取code成功后执行的代码
|
||||
this.globalData.user_openid = result;
|
||||
|
||||
// 使用code查询数据库,查到则获取信息,没查到则建立新用户后,再次查询数据库输出结果
|
||||
MyApi.ApiGetUserDataFromDB(result)
|
||||
.then(result1 => {
|
||||
// 成功后执行的代码
|
||||
this.globalData.YelayMaths_ID= result1.data.YelayMaths_ID;
|
||||
this.globalData.IsLogin= result1.data.是否登录;
|
||||
this.globalData.IsAdministor= result1.data.是否管理员;
|
||||
this.globalData.LastLoginDate= result1.data.最后登录日期;
|
||||
this.globalData.UserName= result1.data.用户名;
|
||||
this.globalData.NewUser= result1.result;
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||
|
||||
//查询用户课程数据
|
||||
MyApi.ApiGetUserCourseDataFromDB(result)
|
||||
.then(result => {
|
||||
this.globalData.OwnedCourse = result.data;
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log("错误!");
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
.catch(err1 => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err1);
|
||||
});
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
// 失败后执行的代码
|
||||
console.error("请求失败:"+err);
|
||||
});
|
||||
|
||||
|
||||
// 将信息存储到本地缓存中
|
||||
wx.setStorageSync('UserInfoCache', this.globalData);
|
||||
},
|
||||
globalData: {
|
||||
BaseURL:'https://api.yeomai.site',
|
||||
user_openid: null,
|
||||
YelayMaths_ID: null,
|
||||
IsLogin: null,
|
||||
IsAdministor: null,
|
||||
LastLoginDate: null,
|
||||
UserName: null,
|
||||
NewUser: null,
|
||||
OwnedCourse: null
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"pages": [
|
||||
"pages/index/index",
|
||||
"pages/wode/wode",
|
||||
"pages/kecheng/kecheng",
|
||||
"pages/LoginOrOutDetails/LoginOrOutDetails",
|
||||
"pages/WebPageDetails/WebPageDetails",
|
||||
"pages/VideoDetails/VideoDetails",
|
||||
"pages/VideoDetailsPage/VideoDetailsPage",
|
||||
"pages/IndexNewCourseDetails/IndexNewCourseDetails",
|
||||
"pages/IndexFreeCourseDetails/IndexFreeCourseDetails",
|
||||
"pages/SetPasswordCode/SetPasswordCode"
|
||||
],
|
||||
"window": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "叶雷讲数学",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"backgroundColor": "#fff"
|
||||
},
|
||||
"tabBar": {
|
||||
"color":"#000",
|
||||
"selectedColor":"#00aa00",
|
||||
"borderStyle": "black",
|
||||
"list": [{
|
||||
"text": "首页",
|
||||
"pagePath": "pages/index/index",
|
||||
"iconPath": "static/image/shouye.png",
|
||||
"selectedIconPath": "static/image/shouye-selected.png"
|
||||
},
|
||||
{
|
||||
"text": "课程",
|
||||
"pagePath": "pages/kecheng/kecheng",
|
||||
"iconPath": "static/image/kecheng.png",
|
||||
"selectedIconPath": "static/image/kecheng-selected.png"
|
||||
},{
|
||||
"text": "我的",
|
||||
"pagePath": "pages/wode/wode",
|
||||
"iconPath": "static/image/wode.png",
|
||||
"selectedIconPath": "static/image/wode-selected.png"
|
||||
}]
|
||||
},
|
||||
"componentFramework": "glass-easel",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"lazyCodeLoading": "requiredComponents"
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Generated
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "yelaymaths",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"@vant/weapp": "^1.11.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@vant/weapp": {
|
||||
"version": "1.11.4",
|
||||
"resolved": "https://registry.npmjs.org/@vant/weapp/-/weapp-1.11.4.tgz",
|
||||
"integrity": "sha512-egOsWO4hVMP1SQSqQ46jy8UD3WysvlnUecRzPM21Y3ovkOFZ6wlaO7oHQmTXRpwr+V41Qri1qEbtNjhVxFqdyw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@vant/weapp": "^1.11.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "trial",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"enhance": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmManually": true,
|
||||
"packNpmRelationList": [
|
||||
{
|
||||
"packageJsonPath": "./package.json",
|
||||
"miniprogramNpmDistDir": "./"
|
||||
}
|
||||
],
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "auto",
|
||||
"tabSize": 2
|
||||
},
|
||||
"appid": "wx3fbaf897825bf04f"
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||
"projectname": "yelaymaths",
|
||||
"setting": {
|
||||
"compileHotReLoad": true,
|
||||
"urlCheck": true
|
||||
},
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "pages/LoginOrOutDetails/LoginOrOutDetails",
|
||||
"pathName": "pages/LoginOrOutDetails/LoginOrOutDetails",
|
||||
"query": "IsLogin=undefined",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/wode/wode",
|
||||
"pathName": "pages/wode/wode",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "pages/SetPasswordCode/SetPasswordCode",
|
||||
"pathName": "pages/SetPasswordCode/SetPasswordCode",
|
||||
"query": "",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"libVersion": "3.7.12"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
const formatTime = timestamp => {
|
||||
const date = new Date(timestamp);
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user