├── static ├── .gitkeep ├── up.png ├── chat.png ├── edit.png ├── good1.png ├── good2.png ├── home.png ├── star1.png ├── star2.png ├── user-o.png └── notice-o.png ├── .vscode └── settings.json ├── src ├── const.js ├── style │ └── common.scss ├── App.vue ├── pages │ ├── list │ │ ├── main.js │ │ └── index.vue │ ├── me │ │ ├── main.js │ │ └── index.vue │ ├── notice │ │ ├── main.js │ │ └── index.vue │ ├── publish │ │ ├── main.js │ │ └── index.vue │ ├── user │ │ ├── main.js │ │ └── index.vue │ ├── detail │ │ ├── main.js │ │ └── index.vue │ └── index │ │ ├── main.js │ │ └── index.vue ├── components │ ├── authorHead.vue │ ├── sendReply.vue │ ├── login.vue │ └── card.vue ├── main.js └── utils │ └── index.js ├── img ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png └── show.jpg ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── .postcssrc.js ├── .editorconfig ├── .gitignore ├── index.html ├── .babelrc ├── project.config.json ├── README.md └── package.json /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.linting.enabled": false 3 | } -------------------------------------------------------------------------------- /src/const.js: -------------------------------------------------------------------------------- 1 | export const api = 'https://cnodejs.org/api/v1' 2 | -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/1.png -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/2.png -------------------------------------------------------------------------------- /img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/3.png -------------------------------------------------------------------------------- /img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/4.png -------------------------------------------------------------------------------- /img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/5.png -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /img/show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/img/show.jpg -------------------------------------------------------------------------------- /src/style/common.scss: -------------------------------------------------------------------------------- 1 | $color: rgb(65, 184, 131); // 主色调 2 | 3 | $borderColor: #888; -------------------------------------------------------------------------------- /static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/up.png -------------------------------------------------------------------------------- /static/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/chat.png -------------------------------------------------------------------------------- /static/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/edit.png -------------------------------------------------------------------------------- /static/good1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/good1.png -------------------------------------------------------------------------------- /static/good2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/good2.png -------------------------------------------------------------------------------- /static/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/home.png -------------------------------------------------------------------------------- /static/star1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/star1.png -------------------------------------------------------------------------------- /static/star2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/star2.png -------------------------------------------------------------------------------- /static/user-o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/user-o.png -------------------------------------------------------------------------------- /static/notice-o.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytam/mpvue-cnode/HEAD/static/notice-o.png -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/pages/list/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-mpvue-wxss": {} 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /src/pages/me/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | export default { 7 | config: { 8 | navigationBarTitleText: '我' 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/pages/notice/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | export default { 7 | config: { 8 | navigationBarTitleText: '通知' 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/pages/publish/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | export default { 7 | config: { 8 | navigationBarTitleText: '发布主题' 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/pages/user/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | export default { 7 | config: { 8 | navigationBarTitleText: '个人主页' 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/pages/detail/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | 7 | export default { 8 | config: { 9 | navigationBarTitleText: '主题详情' 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | const app = new Vue(App) 5 | app.$mount() 6 | export default { 7 | config: { 8 | window: { enablePullDownRefresh: true } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | *.suo 11 | *.ntvs* 12 | *.njsproj 13 | *.sln 14 | 15 | temp_wemark/ 16 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
47 |
48 |
49 |
50 |
51 |
52 | - License
53 |
54 | MIT
55 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import flyio from 'flyio/dist/npm/wx'
4 | Vue.prototype.$http = new flyio
5 | Vue.config.productionTip = false
6 | App.mpType = 'app'
7 | const app = new Vue(App)
8 | app.$mount()
9 |
10 | export default {
11 | // 这个字段走 app.json
12 | config: {
13 | // 页面前带有 ^ 符号的,会被编译成首页,其他页面可以选填,我们会自动把 webpack entry 里面的入口页面加进去
14 | pages: ['pages/detail/main', '^pages/index/main','pages/publish/main','pages/me/main','pages/notice/main','pages/user/main','pages/list/main'],
15 | window: {
16 | backgroundTextStyle: 'light',
17 | navigationBarBackgroundColor: '#fff',
18 | navigationBarTitleText: 'cNode',
19 | navigationBarTextStyle: 'black'
20 | },
21 | tabBar: {
22 | selectedColor: '#41b883',
23 | list: [{
24 | pagePath: 'pages/index/main',
25 | text: '首页',
26 | iconPath:'static/home.png',
27 | selectedIconPath:'static/home.png'
28 | }, {
29 | pagePath: 'pages/notice/main',
30 | text: '通知',
31 | iconPath:'static/notice-o.png',
32 | selectedIconPath:'static/notice-o.png'
33 | }, {
34 | pagePath: 'pages/publish/main',
35 | text: '发帖',
36 | iconPath:'static/edit.png',
37 | selectedIconPath:'static/edit.png'
38 | }, {
39 | pagePath: 'pages/me/main',
40 | text: '我',
41 | iconPath:'static/user-o.png',
42 | selectedIconPath:'static/user-o.png'
43 | }]
44 | },
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | // see http://vuejs-templates.github.io/webpack for documentation.
2 | var path = require('path')
3 |
4 | module.exports = {
5 | build: {
6 | env: require('./prod.env'),
7 | index: path.resolve(__dirname, '../dist/index.html'),
8 | assetsRoot: path.resolve(__dirname, '../dist'),
9 | assetsSubDirectory: 'static',
10 | assetsPublicPath: '/',
11 | productionSourceMap: false,
12 | // Gzip off by default as many popular static hosts such as
13 | // Surge or Netlify already gzip all static assets for you.
14 | // Before setting to `true`, make sure to:
15 | // npm install --save-dev compression-webpack-plugin
16 | productionGzip: false,
17 | productionGzipExtensions: ['js', 'css'],
18 | // Run the build command with an extra argument to
19 | // View the bundle analyzer report after build finishes:
20 | // `npm run build --report`
21 | // Set to `true` or `false` to always turn it on or off
22 | bundleAnalyzerReport: process.env.npm_config_report
23 | },
24 | dev: {
25 | env: require('./dev.env'),
26 | port: 8080,
27 | // 在小程序开发者工具中不需要自动打开浏览器
28 | autoOpenBrowser: false,
29 | assetsSubDirectory: 'static',
30 | assetsPublicPath: '/',
31 | proxyTable: {},
32 | // CSS Sourcemaps off by default because relative paths are "buggy"
33 | // with this option, according to the CSS-Loader README
34 | // (https://github.com/webpack/css-loader#sourcemaps)
35 | // In our experience, they generally work as expected,
36 | // just be aware of this issue when enabling this option.
37 | cssSourceMap: false
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/utils/index.js:
--------------------------------------------------------------------------------
1 | import { POINT_CONVERSION_COMPRESSED } from "constants";
2 |
3 | function formatNumber(n) {
4 | const str = n.toString()
5 | return str[1] ? str : `0${str}`
6 | }
7 |
8 | export function formatTime(date) {
9 | const year = date.getFullYear()
10 | const month = date.getMonth() + 1
11 | const day = date.getDate()
12 |
13 | const hour = date.getHours()
14 | const minute = date.getMinutes()
15 | const second = date.getSeconds()
16 |
17 | const t1 = [year, month, day].map(formatNumber).join('/')
18 | const t2 = [hour, minute, second].map(formatNumber).join(':')
19 |
20 | return `${t1} ${t2}`
21 | }
22 | // 计算离当前多久
23 | export function passTime(time) {
24 | const now = Date.now(), passDateTime = new Date(time).getTime();
25 | const t = (now - passDateTime) / 1000 / 60;// 分钟
26 | let result;
27 | if (t / 60 / 24 /30 / 12 >1 ){
28 | return result = `${Math.floor(t / 60 / 24 / 30 / 12)}年前`;
29 | }else if (t / 60 / 24 / 30 > 1) {
30 | return result = `${Math.floor(t / 60 / 24 / 30)}月前`;
31 | } else if (t / 60 / 24 >1) {
32 | return result = `${Math.floor(t / 60 / 24)}天前`;
33 | } else if (t / 60 > 1) {
34 | // 小时
35 | return result = `${Math.floor(t / 60)}小时前`;
36 | } else {
37 | // 分钟
38 | return result = `${Math.floor(t)}分钟前`;
39 | }
40 | }
41 |
42 | // 获取当前的路由
43 | export function getURL() {
44 | return getCurrentPages().slice(-1)[0].route
45 | }
46 |
47 |
48 | export function debounce(fn, interval = 300) {
49 | let timeout = null;
50 | return function () {
51 | clearTimeout(timeout);
52 | timeout = setTimeout(() => {
53 | fn.apply(this, arguments);
54 | }, interval);
55 | };
56 | }
--------------------------------------------------------------------------------
/src/pages/list/index.vue:
--------------------------------------------------------------------------------
1 |
2 | {{item.title}}
13 |{{detailData.title}}
15 |
22 |
23 |