eason 1 vuosi sitten
vanhempi
sitoutus
f7434e3870

+ 31 - 0
fore-end/.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: {},
+}

+ 0 - 0
fore-end/.keep


+ 43 - 0
fore-end/API/appraise.js

@@ -0,0 +1,43 @@
+const { http } = require('../utils/util')
+
+const API = {
+    createCommentURL: '/appraise/create',
+    //放接口URL
+}
+
+//查询列表时传参---注意参数数据类型
+function createCommont(data) {
+    //Promise
+    return http(
+        API.createCommentURL,
+        {
+            method: 'POST',
+            data: data
+        }
+    );
+}
+
+/**
+ * @param: {pageNum, pageSize}
+ */
+//传对象给params
+function getCommentList(params) {
+    return http(
+        API.createCommentURL,
+        {
+            method: 'GET',
+            params: params,//是传入的形参
+        }
+    );
+}
+
+// //超时设置:timeout: 1000 * 60 * 30
+// function deleteComment() {
+
+// }
+
+
+module.exports = {
+    createCommont,
+    getCommentList
+}

+ 0 - 0
fore-end/CSS/.keep


+ 0 - 0
fore-end/HTML/.keep


+ 0 - 0
fore-end/JS/.keep


+ 19 - 0
fore-end/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
+  }
+})

+ 36 - 0
fore-end/app.json

@@ -0,0 +1,36 @@
+{
+    "pages": [
+        "pages/home/home",
+        "pages/classify/classify",
+        "pages/message/message",
+        "pages/user/user"
+    ],
+    "window": {
+        "backgroundTextStyle": "light",
+        "navigationBarBackgroundColor": "#fff",
+        "navigationBarTitleText": "Weixin",
+        "navigationBarTextStyle": "black"
+    },
+    "tabBar": {
+       "list": [
+           {
+               "pagePath": "pages/home/home",
+               "text": "首页"
+           },
+           {
+               "pagePath": "pages/classify/classify",
+               "text": "分类"
+           },
+           {
+               "pagePath": "pages/message/message",
+               "text": "信息"
+           },
+           {
+               "pagePath": "pages/user/user",
+               "text": "个人"
+           }
+       ]
+    },
+    "style": "v2",
+    "sitemapLocation": "sitemap.json"
+}

+ 10 - 0
fore-end/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;
+} 

+ 24 - 0
fore-end/components/commodity_show/commodity_show.js

@@ -0,0 +1,24 @@
+// components/commodity_show/commodity_show.js
+Component({
+
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+
+    }
+})

+ 6 - 0
fore-end/components/commodity_show/commodity_show.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "commodity_show": "/components/commodity_show/commodity_show"
+    }
+}

+ 2 - 0
fore-end/components/commodity_show/commodity_show.wxml

@@ -0,0 +1,2 @@
+<!--components/commodity_show/commodity_show.wxml-->
+<text>components/commodity_show/commodity_show.wxml</text>

+ 1 - 0
fore-end/components/commodity_show/commodity_show.wxss

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

+ 66 - 0
fore-end/pages/classify/classify.js

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

+ 3 - 0
fore-end/pages/classify/classify.json

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

+ 2 - 0
fore-end/pages/classify/classify.wxml

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

+ 1 - 0
fore-end/pages/classify/classify.wxss

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

+ 93 - 0
fore-end/pages/home/home.js

@@ -0,0 +1,93 @@
+const {getCommentList} = require('/API/appraise.js')
+
+// pages/home/home.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        commentPage: {
+            pageNum: 1,
+            //一个页面一次请求获取多少,展示多少
+            pageSize: 10
+        },
+        commentList: [],
+    },
+
+    init() {
+        getCommentList(this.commentPage).then(
+            (res) => {
+                // code message data
+                const {data} = res
+                this.setData({
+                    commentList = data
+                })
+            }
+        ).catch(
+            (err) => {
+                console.log(err);
+                //处理错误状态
+            }
+        ).finally(
+            () => {
+
+            }
+        )
+    },
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad(options) {
+        this.init()
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide() {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload() {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh() {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom() {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage() {
+
+    }
+})

+ 3 - 0
fore-end/pages/home/home.json

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

+ 2 - 0
fore-end/pages/home/home.wxml

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

+ 1 - 0
fore-end/pages/home/home.wxss

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

+ 66 - 0
fore-end/pages/message/message.js

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

+ 3 - 0
fore-end/pages/message/message.json

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

+ 2 - 0
fore-end/pages/message/message.wxml

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

+ 1 - 0
fore-end/pages/message/message.wxss

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

+ 66 - 0
fore-end/pages/user/user.js

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

+ 3 - 0
fore-end/pages/user/user.json

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

+ 2 - 0
fore-end/pages/user/user.wxml

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

+ 1 - 0
fore-end/pages/user/user.wxss

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

+ 52 - 0
fore-end/project.config.json

@@ -0,0 +1,52 @@
+{
+    "description": "项目配置文件",
+    "packOptions": {
+        "ignore": [],
+        "include": []
+    },
+    "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,
+        "babelSetting": {
+            "ignore": [],
+            "disablePlugins": [],
+            "outputPath": ""
+        },
+        "ignoreUploadUnusedFiles": true
+    },
+    "compileType": "miniprogram",
+    "libVersion": "2.19.4",
+    "appid": "wxc25f00d0fc026ae7",
+    "projectname": "miniprogram-92",
+    "condition": {},
+    "editorSetting": {
+        "tabIndent": "insertSpaces",
+        "tabSize": 4
+    }
+}

+ 7 - 0
fore-end/project.private.config.json

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

+ 7 - 0
fore-end/sitemap.json

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

+ 38 - 0
fore-end/utils/util.js

@@ -0,0 +1,38 @@
+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}`
+}
+
+function http(url, option) {
+    const baseURL = "http://192.168.31.28:8084";//后台服务提供的地址
+    return new Promise ((resolve, reject) => {
+        wx.request({
+          url: baseURL + url,
+          ...option,
+          success(res) {
+              console.log(res);
+              resolve(res.data);
+          },
+          fail(err) {
+            console.log(err);
+            reject(err);
+          }
+        })
+    })
+}
+
+module.exports = {
+    formatTime,
+    http
+  }