first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,58 @@
import config from "../config/index";
class Api {
async getRequest(params) {
wx.showLoading({
title: '加载中..'
});
return new Promise((resolve, reject) => {
wx.request({
method: 'GET',
url: config.checkBaseUrl() + params.url,
data: params.data,
header: Object.assign({
token: wx.getStorageSync('token')
}, params.header),
success: (res) => {
this.inter(resolve, reject, res.data)
}
});
})
}
async postRequest(params) {
return new Promise((resolve, reject) => {
wx.request({
method: 'POST',
url: config.checkBaseUrl() + params.url,
data: params.data,
header: Object.assign({
token: wx.getStorageSync('token')
}, params.header),
success: (res) => {
this.inter(resolve, reject, res.data)
}
});
})
}
inter(resolve, reject, data) {
wx.hideLoading();
switch (data.status) {
case 200:
resolve(data.result)
break;
case 404:
Toast.fail(data.msg);
throw new Error(data.msg);
break;
default:
break;
}
}
}
export default new Api()

View File

@@ -0,0 +1,6 @@
import serve from "./serve/_"
App({
globalData: {
...serve
}
})

View File

@@ -0,0 +1,27 @@
{
"pages": [
"pages/index/index",
"pages/about/about",
"pages/info/info"
],
"subpackages": [
{
"root": "integral",
"pages": [
"pages/home/home"
]
}
],
"window": {
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "",
"backgroundColor": "#eeeeee",
"backgroundTextStyle": "light"
},
"sitemapLocation": "sitemap.json",
"usingComponents": {
"header": "/components/header/header",
"van-button": "@vant/weapp/button/index"
}
}

View File

@@ -0,0 +1,40 @@
// components/header/header.js
Component({
options: {
multipleSlots: true
},
/**
* 组件的属性列表
*/
properties: {
title: {
type: String,
value: "默认数值"
}
},
/**
* 组件的初始数据
*/
data: {
test: '测试数据,哈哈哈哈'
},
observers: {
'test': function (newTest) {
console.log("newTest: ", newTest);
}
},
/**
* 组件的方法列表
*/
methods: {
test() {
this.setData({
test: "你好"
})
this.triggerEvent("change", this.data.test)
}
}
})

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,12 @@
<view class="header">
<view bind:tap="test">
头部组件 {{ title }}
<view class="left">
<slot name="left"></slot>
</view>
<view class="right">
<slot name="right"></slot>
</view>
</view>
</view>

View File

@@ -0,0 +1 @@
/* components/header/header.wxss */

View File

@@ -0,0 +1,21 @@
export default {
devBaseUrl: 'http://127.0.0.1:3000/api/json',
prodBaseUrl: 'http://127.0.0.1:3000/api/json',
apiList: {
index: '/index'
},
checkBaseUrl() {
switch (__wxConfig.envVersion) {
case "develop":
return this.devBaseUrl
break;
case "release":
return this.prodBaseUrl
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,66 @@
// integral/pages/home/home.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

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

View File

@@ -0,0 +1,2 @@
<!--integral/pages/home/home.wxml-->
<text>integral/pages/home/home.wxml</text>

View File

@@ -0,0 +1 @@
/* integral/pages/home/home.wxss */

View File

@@ -0,0 +1,21 @@
{
"name": "minstudy",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "minstudy",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"@vant/weapp": "^1.10.23"
}
},
"node_modules/@vant/weapp": {
"version": "1.10.23",
"resolved": "https://registry.npmmirror.com/@vant/weapp/-/weapp-1.10.23.tgz",
"integrity": "sha512-Lqlc0oT89AxR8e4uLmP59xkI1KkWSTWKWV9kXM17CJz55eL0fPMo5jd0d132KpcfRmiwIOVr7TwK8u8v6XIhlg=="
}
}
}

View File

@@ -0,0 +1,15 @@
{
"name": "minstudy",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@vant/weapp": "^1.10.23"
}
}

View File

@@ -0,0 +1,66 @@
// pages/about/about.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

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

View File

@@ -0,0 +1,3 @@
<view class="about">
<text>我的页面</text>
</view>

View File

@@ -0,0 +1 @@
/* pages/about/about.wxss */

View File

@@ -0,0 +1,46 @@
let { home } = getApp().globalData
Page({
data: {
text: "父组件给子组件的数据",
isVip: false,
id: 0,
keyWord: "",
news: [
{ id: 1, title: '新闻1' },
{ id: 2, title: '新闻2' },
{ id: 3, title: '新闻3' },
{ id: 4, title: '新闻4' },
]
},
testChange(e) {
console.log(e.detail);
},
onLoad() {
this.getHome()
},
async getHome() {
let res = await home.index();
console.log(res);
},
enterInfo(e) {
// console.log("=====: ",e.currentTarget.dataset.id);
// wx.navigateTo({
// url: `/pages/info/info?id=${e.currentTarget.dataset.id}`,
// })
// this.data.id = e.currentTarget.dataset.id
this.setData({
id: e.currentTarget.dataset.id
})
console.log(" this.data.id: ", this.data.id);
},
bindKeyWord(e) {
this.setData({
keyWord: e.detail.value
})
}
})

View File

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

View File

@@ -0,0 +1,26 @@
<view class="container">
首页
<van-button type="danger">危险按钮</van-button>
<view slot="right">右侧</view>
<view slot="left">左侧</view>
<header title="{{ text }}" bind:change="testChange"></header>
<view wx:if="{{isVip}}">vip</view>
<!-- <view wx:elif="{{isVip}}">vip</view> -->
<view wx:else>no vip</view>
<view class="list">
<view class="item" wx:for="{{ news }}" wx:for-item="v" wx:for-index="i" wx:key="i" bind:tap="enterInfo" data-id="{{ v.id }}">
{{ v.title }}
</view>
<text>{{ id }} {{ keyWord }}</text>
<input class="weui-input" maxlength="10" bindinput="bindKeyWord" placeholder="请输入关键字"/>
</view>
</view>

View File

@@ -0,0 +1,5 @@
/**index.wxss**/
.scrollview {
height: 100vh;
}

View File

@@ -0,0 +1,69 @@
// pages/info/info.js
Page({
/**
* 页面的初始数据
*/
data: {
id: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options.id);
this.setData({
id: options.id
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

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

View File

@@ -0,0 +1,3 @@
<view class="info">
详情 {{ id }}
</view>

View File

@@ -0,0 +1 @@
/* pages/info/info.wxss */

View File

@@ -0,0 +1,36 @@
{
"appid": "wx21366c2534acf389",
"compileType": "miniprogram",
"libVersion": "3.0.0",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [
{
"packageJsonPath": "./package.json",
"miniprogramNpmDistDir": "./"
}
],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true,
"condition": true,
"uglifyFileName": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}

View File

@@ -0,0 +1,10 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "minstudy",
"setting": {
"compileHotReLoad": true,
"autoAudits": true,
"urlCheck": false
},
"libVersion": "2.33.0"
}

View File

@@ -0,0 +1,5 @@
import HomeServe from "./home";
export default {
home: new HomeServe()
}

View File

@@ -0,0 +1,11 @@
import api from "../api/api";
import config from "../config/index";
export default class HomeServe {
async index(data = {}, header = {}) {
return await api.getRequest({
url: config.apiList.index,
data, header
})
}
}

View File

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

View File

@@ -0,0 +1,7 @@
class Utils {
test () {
console.log("test");
}
}
export default new Utils();