├── static ├── .gitkeep ├── images │ ├── boy.png │ ├── girl.png │ ├── hot.png │ ├── like.png │ ├── mark.png │ ├── user.png │ ├── close.png │ ├── search.png │ ├── video.png │ ├── address.png │ ├── arrow_l.png │ ├── arrow_r.png │ ├── file_icon.png │ ├── like_gray.png │ ├── message.png │ ├── no_data.png │ ├── arrow_down.png │ ├── likeActive.png │ ├── markActive.png │ ├── address_white.png │ ├── setting_icon.png │ └── arrow_down_white.png └── tabs │ ├── home.png │ ├── user.png │ ├── release.png │ ├── home-active.png │ ├── user-active.png │ └── release-active.png ├── .eslintignore ├── src ├── pages │ ├── fans │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── follow │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── search │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── user │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── detail │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── grant │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── index │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── logs │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ ├── personal │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue │ └── release │ │ ├── main.json │ │ ├── main.js │ │ └── index.vue ├── utils │ ├── index.js │ └── wx-request.js ├── components │ ├── noData.vue │ └── loginModal.vue ├── App.vue ├── main.js ├── store │ └── index.js └── app.json ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── .postcssrc.js ├── .editorconfig ├── package.swan.json ├── .gitignore ├── project.swan.json ├── index.html ├── .babelrc ├── README.md ├── .eslintrc.js ├── project.config.json ├── package.json └── assets └── css └── main.less /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /src/pages/fans/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "TA的粉丝" 3 | } -------------------------------------------------------------------------------- /src/pages/follow/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "TA的关注" 3 | } -------------------------------------------------------------------------------- /src/pages/search/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "搜索" 3 | } -------------------------------------------------------------------------------- /src/pages/user/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "我的" 3 | } 4 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/detail/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "详情" 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/grant/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "登录" 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/index/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "首页" 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/logs/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志" 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/personal/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "用户" 3 | } 4 | -------------------------------------------------------------------------------- /src/pages/release/main.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "发布" 3 | } 4 | -------------------------------------------------------------------------------- /static/images/boy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/boy.png -------------------------------------------------------------------------------- /static/images/girl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/girl.png -------------------------------------------------------------------------------- /static/images/hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/hot.png -------------------------------------------------------------------------------- /static/images/like.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/like.png -------------------------------------------------------------------------------- /static/images/mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/mark.png -------------------------------------------------------------------------------- /static/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/user.png -------------------------------------------------------------------------------- /static/tabs/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/home.png -------------------------------------------------------------------------------- /static/tabs/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/user.png -------------------------------------------------------------------------------- /static/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/close.png -------------------------------------------------------------------------------- /static/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/search.png -------------------------------------------------------------------------------- /static/images/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/video.png -------------------------------------------------------------------------------- /static/tabs/release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/release.png -------------------------------------------------------------------------------- /static/images/address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/address.png -------------------------------------------------------------------------------- /static/images/arrow_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/arrow_l.png -------------------------------------------------------------------------------- /static/images/arrow_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/arrow_r.png -------------------------------------------------------------------------------- /static/images/file_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/file_icon.png -------------------------------------------------------------------------------- /static/images/like_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/like_gray.png -------------------------------------------------------------------------------- /static/images/message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/message.png -------------------------------------------------------------------------------- /static/images/no_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/no_data.png -------------------------------------------------------------------------------- /static/tabs/home-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/home-active.png -------------------------------------------------------------------------------- /static/tabs/user-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/user-active.png -------------------------------------------------------------------------------- /static/images/arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/arrow_down.png -------------------------------------------------------------------------------- /static/images/likeActive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/likeActive.png -------------------------------------------------------------------------------- /static/images/markActive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/markActive.png -------------------------------------------------------------------------------- /static/images/address_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/address_white.png -------------------------------------------------------------------------------- /static/images/setting_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/setting_icon.png -------------------------------------------------------------------------------- /static/tabs/release-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/tabs/release-active.png -------------------------------------------------------------------------------- /static/images/arrow_down_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/showVinc/live_code/HEAD/static/images/arrow_down_white.png -------------------------------------------------------------------------------- /src/pages/logs/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 | -------------------------------------------------------------------------------- /package.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /project.swan.json: -------------------------------------------------------------------------------- 1 | { 2 | "appid": "testappid", 3 | "setting": { 4 | "urlCheck": false 5 | }, 6 | "condition": { 7 | "swan": { 8 | "current": -1, 9 | "list": [] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/pages/detail/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/fans/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/follow/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/grant/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/index/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/personal/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/release/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/search/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /src/pages/user/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './index' 3 | 4 | // add this to handle exception 5 | Vue.config.errorHandler = function (err) { 6 | if (console && console.error) { 7 | console.error(err) 8 | } 9 | } 10 | 11 | const app = new Vue(App) 12 | app.$mount() 13 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | live 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["istanbul"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 5 | # live_code 6 | 仿小红书小程序,首页推荐,热门,最新导航栏,数据分页,图片懒加载,发布作品,查看用户,关注,查看粉丝,查看作品,评论作品等。 7 | 8 | ## 作者 9 | showVinc 10 | 11 | ``` bash 12 | 13 | # 介绍 14 | 项目框架 mpvue 15 | 状态管理 vuex 16 | 17 | # 初始化项目 18 | npm i / cnpm i 19 | 备注:使用cnpm 需要先引用淘宝源, 本项目使用基于 ES7 的语法,所以请在开发工具中开启 “增强编译” 20 | 21 | # 依赖 22 | npm/cnpm 23 | 24 | # 开发时构建 25 | npm run dev 26 | 27 | # 打包构建 28 | npm run build 29 | -------------------------------------------------------------------------------- /src/utils/index.js: -------------------------------------------------------------------------------- 1 | function formatNumber (n) { 2 | const str = n.toString() 3 | return str[1] ? str : `0${str}` 4 | } 5 | 6 | export function formatTime (date) { 7 | const year = date.getFullYear() 8 | const month = date.getMonth() + 1 9 | const day = date.getDate() 10 | 11 | const hour = date.getHours() 12 | const minute = date.getMinutes() 13 | const second = date.getSeconds() 14 | 15 | const t1 = [year, month, day].map(formatNumber).join('/') 16 | const t2 = [hour, minute, second].map(formatNumber).join(':') 17 | 18 | return `${t1} ${t2}` 19 | } 20 | 21 | export default { 22 | formatNumber, 23 | formatTime 24 | } 25 | -------------------------------------------------------------------------------- /src/components/noData.vue: -------------------------------------------------------------------------------- 1 | 5 | 11 | 12 | 34 | 35 | 51 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: false, 11 | node: true, 12 | es6: true 13 | }, 14 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md 15 | extends: 'standard', 16 | // required to lint *.vue files 17 | plugins: [ 18 | 'html' 19 | ], 20 | // add your custom rules here 21 | 'rules': { 22 | // allow paren-less arrow functions 23 | 'arrow-parens': 0, 24 | // allow async-await 25 | 'generator-star-spacing': 0, 26 | // allow debugger during development 27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 28 | }, 29 | globals: { 30 | App: true, 31 | Page: true, 32 | wx: true, 33 | swan: true, 34 | tt: true, 35 | my: true, 36 | getApp: true, 37 | getPage: true, 38 | requirePlugin: true, 39 | mpvue: true, 40 | mpvuePlatform: true 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/components/loginModal.vue: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | 37 | 38 | 52 | -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "setting": { 4 | "urlCheck": false, 5 | "es6": true, 6 | "enhance": false, 7 | "postcss": true, 8 | "minified": true, 9 | "newFeature": true, 10 | "coverView": true, 11 | "nodeModules": false, 12 | "autoAudits": false, 13 | "showShadowRootInWxmlPanel": true, 14 | "scopeDataCheck": false, 15 | "checkInvalidKey": true, 16 | "checkSiteMap": true, 17 | "uploadWithSourceMap": true, 18 | "babelSetting": { 19 | "ignore": [], 20 | "disablePlugins": [], 21 | "outputPath": "" 22 | } 23 | }, 24 | "miniprogramRoot": "dist/wx/", 25 | "compileType": "miniprogram", 26 | "appid": "wxe6044a10e2ea32a1", 27 | "projectname": "live", 28 | "simulatorType": "wechat", 29 | "simulatorPluginLibVersion": {}, 30 | "libVersion": "2.10.4", 31 | "condition": { 32 | "search": { 33 | "current": -1, 34 | "list": [] 35 | }, 36 | "conversation": { 37 | "current": -1, 38 | "list": [] 39 | }, 40 | "game": { 41 | "currentL": -1, 42 | "list": [] 43 | }, 44 | "miniprogram": { 45 | "current": -1, 46 | "list": [] 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 5 | 36 | 37 | 55 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: vinc 3 | * @LastEditTime: 2020-04-26 16:10:43 4 | */ 5 | import Vue from 'vue' 6 | import App from './App' 7 | // import MintUI from 'mint-ui' 8 | // import 'mint-ui/lib/style.css' 9 | // Vue.use(MintUI) 10 | 11 | import '../assets/css/main.less'; 12 | import Store from './store' 13 | import WXrequest from './utils/wx-request' 14 | Vue.prototype.$request = WXrequest 15 | Vue.prototype.$store = Store 16 | 17 | //判断是否本地 打包后的api 地址 根据场景设置 18 | process.env.NODE_ENV == "development" ? Store.commit("SET_URL", "https://server.showvinc.com") : Store.commit("SET_URL", "https://server.showvinc.com"); 19 | 20 | let userInfo = mpvue.getStorageSync('userInfo'); 21 | if (userInfo) { 22 | Store.commit("SET_USERINFO", userInfo) 23 | } 24 | 25 | let token = mpvue.getStorageSync('token'); 26 | if (token) { 27 | Store.commit("SET_TOKEN", token) 28 | } 29 | 30 | //获取用户地址 按需求开关 31 | // mpvue.getLocation({ 32 | // success: async function (locationRes) { 33 | // var value = wx.getStorageSync("addressInfo"); 34 | // if (value) { 35 | // value = JSON.parse(value); 36 | // Store.commit("SET_LOCATION", value); 37 | // // _this.getData(value.city_code); 38 | // } else { 39 | // let { latitude, longitude } = locationRes; 40 | // let bdMap = await _this.$request.get("/api/location", { 41 | // latitude, 42 | // longitude 43 | // }); 44 | // if (!bdMap.errno) { 45 | // Store.commit("SET_LOCATION", bdMap.data); 46 | // // _this.getData(bdMap.data.cityCode); 47 | // } 48 | // } 49 | // } 50 | // }); 51 | 52 | Vue.config.productionTip = false 53 | App.mpType = 'app' 54 | 55 | const app = new Vue(App) 56 | app.$mount() 57 | -------------------------------------------------------------------------------- /src/pages/logs/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 22 | 23 | 52 | 53 | 64 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: vinc 3 | * @LastEditTime: 2020-04-26 15:55:48 4 | */ 5 | 6 | import Vue from 'vue' 7 | import Vuex from 'vuex' 8 | // import MintUI from 'mint-ui' 9 | // import 'mint-ui/lib/style.css' 10 | // Vue.use(MintUI) 11 | 12 | Vue.use(Vuex) 13 | const store = new Vuex.Store({ 14 | state: { 15 | httpUrl: 'http://127.0.0.1:8351', 16 | userInfo: null, 17 | token: null, 18 | locationInfo: null 19 | }, 20 | mutations: { 21 | //设置token 22 | SET_TOKEN(state, payload) { 23 | state.token = payload; 24 | }, 25 | //设置个人信息 26 | SET_USERINFO(state, payload) { 27 | state.userInfo = payload 28 | }, 29 | //用户地址 30 | SET_LOCATION(state, payload) { 31 | state.locationInfo = payload 32 | }, 33 | //退出登录 34 | LOGOUT(state, payload) { 35 | state.token = ''; 36 | state.userInfo = ''; 37 | }, 38 | //设置url 39 | SET_URL(state, payload) { 40 | state.httpUrl = payload 41 | } 42 | }, 43 | actions: { 44 | async changeUser({ commit }, params) { 45 | if (params.uid || params.id) { 46 | mpvue.navigateTo({ url: `../personal/main?id=${params.uid || params.id}` }); 47 | } 48 | }, 49 | async changeUserFollow({ commit }, params) { 50 | mpvue.navigateTo({ url: `../follow/main?id=${params.uid || params.id || ''}` }); 51 | }, 52 | async changeUserFans({ commit }, params) { 53 | mpvue.navigateTo({ url: `../fans/main?id=${params.uid || params.id || ''}` }); 54 | }, 55 | async changeWorks({ commit }, params) { 56 | mpvue.navigateTo({ url: `../detail/main?id=${params.id}` }); 57 | } 58 | }, 59 | getters: { 60 | isLogin(state) { 61 | return Boolean(state.userInfo); 62 | } 63 | } 64 | 65 | }) 66 | 67 | export default store; 68 | -------------------------------------------------------------------------------- /src/utils/wx-request.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: vinc 3 | * @LastEditTime: 2020-04-24 16:13:48 4 | */ 5 | 6 | import Store from '../store' 7 | 8 | function request(url, method, data, header = {}) { 9 | wx.showLoading({ 10 | title: '加载中' // 数据请求前loading 11 | }) 12 | return new Promise((resolve, reject) => { 13 | wx.request({ 14 | url: Store.state.httpUrl + url, 15 | method: method, 16 | data: data, 17 | header: { 18 | 'content-type': 'application/json', // 默认值 19 | 'authorization': Store.state.token || '' 20 | }, 21 | success: function (res) { 22 | if (res.data.errno == '40202') { 23 | wx.clearStorage() 24 | Store.commit("LOGOUT") 25 | if (res.data.errno == '40202') { 26 | wx.clearStorage() 27 | Store.commit("LOGOUT") 28 | 29 | var pages = getCurrentPages(); //获取加载的页面 30 | var currentPage = pages[pages.length - 1]; //获取当前页面的对象 31 | var routeUrl = currentPage.route; //当前页面url 32 | 33 | if (routeUrl != "pages/grant/main") { 34 | wx.navigateTo({ url: "../grant/main" }); 35 | } 36 | } 37 | } 38 | wx.hideLoading() 39 | resolve(res.data) 40 | }, 41 | fail: function (res) { 42 | wx.hideLoading() 43 | // reject(false) 44 | }, 45 | complete: function (res) { 46 | wx.hideLoading() 47 | } 48 | }) 49 | }) 50 | } 51 | 52 | function get(url, params) { 53 | return request(url, 'GET', params) 54 | } 55 | 56 | function put(url, params) { 57 | return request(url, 'PUT', params) 58 | } 59 | 60 | function post(url, params) { 61 | return request(url, 'POST', params) 62 | } 63 | 64 | function del(url, params) { 65 | return request(url, 'DELETE', params) 66 | } 67 | 68 | export default { 69 | request, 70 | get, 71 | post, 72 | del, 73 | put 74 | } 75 | -------------------------------------------------------------------------------- /src/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/index/main", 4 | "pages/user/main", 5 | "pages/follow/main", 6 | "pages/fans/main", 7 | "pages/personal/main", 8 | "pages/grant/main", 9 | "pages/release/main", 10 | "pages/detail/main", 11 | "pages/search/main", 12 | "pages/logs/main" 13 | ], 14 | "permission": { 15 | "scope.userLocation": { 16 | "desc": "你的位置信息将用于小程序位置接口的效果展示" 17 | } 18 | }, 19 | "window": { 20 | "backgroundTextStyle": "light", 21 | "navigationBarBackgroundColor": "#ff2f2f", 22 | "navigationBarTitleText": "live", 23 | "navigationBarTextStyle": "white" 24 | }, 25 | "tabBar": { 26 | "color": "#999", 27 | "backgroundColor": "#fafafa", 28 | "selectedColor": "#333", 29 | "borderStyle": "white", 30 | "list": [ 31 | { 32 | "text": "首页", 33 | "pagePath": "pages/index/main", 34 | "iconPath": "static/tabs/home.png", 35 | "selectedIconPath": "static/tabs/home-active.png" 36 | }, 37 | { 38 | "text": "发布", 39 | "pagePath": "pages/release/main", 40 | "iconPath": "static/tabs/release.png", 41 | "selectedIconPath": "static/tabs/release-active.png" 42 | }, 43 | { 44 | "text": "我的", 45 | "pagePath": "pages/user/main", 46 | "iconPath": "static/tabs/user.png", 47 | "selectedIconPath": "static/tabs/user-active.png" 48 | } 49 | ], 50 | "items": [ 51 | { 52 | "name": "首页", 53 | "pagePath": "pages/index/main", 54 | "icon": "static/tabs/home.png", 55 | "activeIcon": "static/tabs/home-active.png" 56 | }, 57 | { 58 | "name": "发布", 59 | "pagePath": "pages/release/main", 60 | "icon": "static/tabs/release.png", 61 | "activeIcon": "static/tabs/release-active.png" 62 | }, 63 | { 64 | "name": "我的", 65 | "pagePath": "pages/user/main", 66 | "icon": "static/tabs/user.png", 67 | "activeIcon": "static/tabs/user-active.png" 68 | } 69 | ], 70 | "position": "bottom" 71 | } 72 | } -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | var fileExtConfig = { 4 | swan: { 5 | template: 'swan', 6 | script: 'js', 7 | style: 'css', 8 | platform: 'swan' 9 | }, 10 | tt: { 11 | template: 'ttml', 12 | script: 'js', 13 | style: 'ttss', 14 | platform: 'tt' 15 | }, 16 | wx: { 17 | template: 'wxml', 18 | script: 'js', 19 | style: 'wxss', 20 | platform: 'wx' 21 | }, 22 | my: { 23 | template: 'axml', 24 | script: 'js', 25 | style: 'acss', 26 | platform: 'my' 27 | } 28 | } 29 | var fileExt = fileExtConfig[process.env.PLATFORM] 30 | 31 | module.exports = { 32 | build: { 33 | env: require('./prod.env'), 34 | index: path.resolve(__dirname, `../dist/${fileExt.platform}/index.html`), 35 | assetsRoot: path.resolve(__dirname, `../dist/${fileExt.platform}`), 36 | assetsSubDirectory: '', 37 | assetsPublicPath: '/', 38 | productionSourceMap: false, 39 | // Gzip off by default as many popular static hosts such as 40 | // Surge or Netlify already gzip all static assets for you. 41 | // Before setting to `true`, make sure to: 42 | // npm install --save-dev compression-webpack-plugin 43 | productionGzip: false, 44 | productionGzipExtensions: ['js', 'css'], 45 | // Run the build command with an extra argument to 46 | // View the bundle analyzer report after build finishes: 47 | // `npm run build --report` 48 | // Set to `true` or `false` to always turn it on or off 49 | bundleAnalyzerReport: process.env.npm_config_report, 50 | fileExt: fileExt 51 | }, 52 | dev: { 53 | env: require('./dev.env'), 54 | port: 8080, 55 | // 在小程序开发者工具中不需要自动打开浏览器 56 | autoOpenBrowser: false, 57 | assetsSubDirectory: '', 58 | assetsPublicPath: '/', 59 | proxyTable: {}, 60 | // CSS Sourcemaps off by default because relative paths are "buggy" 61 | // with this option, according to the CSS-Loader README 62 | // (https://github.com/webpack/css-loader#sourcemaps) 63 | // In our experience, they generally work as expected, 64 | // just be aware of this issue when enabling this option. 65 | cssSourceMap: false, 66 | fileExt: fileExt 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "live", 3 | "version": "1.0.0", 4 | "mpvueTemplateProjectVersion": "0.1.0", 5 | "description": "A Mpvue project", 6 | "author": "vinc ", 7 | "private": true, 8 | "scripts": { 9 | "dev:wx": "node build/dev-server.js wx", 10 | "start:wx": "npm run dev:wx", 11 | "build:wx": "node build/build.js wx", 12 | "dev:swan": "node build/dev-server.js swan", 13 | "start:swan": "npm run dev:swan", 14 | "build:swan": "node build/build.js swan", 15 | "dev:tt": "node build/dev-server.js tt", 16 | "start:tt": "npm run dev:tt", 17 | "build:tt": "node build/build.js tt", 18 | "dev:my": "node build/dev-server.js my", 19 | "start:my": "npm run dev:my", 20 | "build:my": "node build/build.js my", 21 | "dev": "node build/dev-server.js wx", 22 | "start": "npm run dev", 23 | "build": "node build/build.js wx", 24 | "lint": "eslint --ext .js,.vue src" 25 | }, 26 | "dependencies": { 27 | "mpvue": "^2.0.0", 28 | "vuex": "^3.0.1" 29 | }, 30 | "devDependencies": { 31 | "babel-core": "^6.22.1", 32 | "babel-eslint": "^8.2.3", 33 | "babel-loader": "^7.1.1", 34 | "babel-plugin-transform-runtime": "^6.22.0", 35 | "babel-preset-env": "^1.3.2", 36 | "babel-preset-stage-2": "^6.22.0", 37 | "babel-register": "^6.22.0", 38 | "chalk": "^2.4.0", 39 | "connect-history-api-fallback": "^1.3.0", 40 | "copy-webpack-plugin": "^4.5.1", 41 | "css-loader": "^0.28.11", 42 | "cssnano": "^3.10.0", 43 | "eslint": "^4.19.1", 44 | "eslint-config-standard": "^11.0.0", 45 | "eslint-friendly-formatter": "^4.0.1", 46 | "eslint-loader": "^2.0.0", 47 | "eslint-plugin-html": "^4.0.3", 48 | "eslint-plugin-import": "^2.11.0", 49 | "eslint-plugin-node": "^6.0.1", 50 | "eslint-plugin-promise": "^3.4.0", 51 | "eslint-plugin-standard": "^3.0.1", 52 | "eventsource-polyfill": "^0.9.6", 53 | "express": "^4.16.3", 54 | "extract-text-webpack-plugin": "^3.0.2", 55 | "file-loader": "^1.1.11", 56 | "friendly-errors-webpack-plugin": "^1.7.0", 57 | "glob": "^7.1.2", 58 | "html-webpack-plugin": "^3.2.0", 59 | "http-proxy-middleware": "^0.18.0", 60 | "less": "^3.9.0", 61 | "less-loader": "^4.1.0", 62 | "mkdirp": "^0.5.1", 63 | "mpvue-loader": "^2.0.0", 64 | "mpvue-template-compiler": "^2.0.0", 65 | "mpvue-webpack-target": "^1.0.3", 66 | "optimize-css-assets-webpack-plugin": "^3.2.0", 67 | "ora": "^2.0.0", 68 | "portfinder": "^1.0.13", 69 | "postcss-loader": "^2.1.4", 70 | "postcss-mpvue-wxss": "^1.0.0", 71 | "prettier": "~1.12.1", 72 | "px2rpx-loader": "^0.1.10", 73 | "relative": "^3.0.2", 74 | "rimraf": "^2.6.0", 75 | "semver": "^5.3.0", 76 | "shelljs": "^0.8.1", 77 | "uglifyjs-webpack-plugin": "^1.2.5", 78 | "url-loader": "^1.0.1", 79 | "vue-style-loader": "^4.1.0", 80 | "webpack": "^3.11.0", 81 | "webpack-bundle-analyzer": "^2.2.1", 82 | "webpack-dev-middleware-hard-disk": "^1.12.0", 83 | "webpack-merge": "^4.1.0", 84 | "webpack-mpvue-asset-plugin": "^2.0.0", 85 | "webpack-mpvue-vendor-plugin": "^2.0.0" 86 | }, 87 | "engines": { 88 | "node": ">= 4.0.0", 89 | "npm": ">= 3.0.0" 90 | }, 91 | "browserslist": [ 92 | "> 1%", 93 | "last 2 versions", 94 | "not ie <= 8" 95 | ] 96 | } 97 | -------------------------------------------------------------------------------- /src/pages/grant/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 26 | 27 | 79 | 80 | 148 | -------------------------------------------------------------------------------- /src/pages/fans/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 29 | 30 | 106 | 107 | 148 | -------------------------------------------------------------------------------- /src/pages/follow/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 29 | 30 | 106 | 107 | 148 | -------------------------------------------------------------------------------- /src/pages/search/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 52 | 53 | 100 | 101 | 160 | -------------------------------------------------------------------------------- /assets/css/main.less: -------------------------------------------------------------------------------- 1 | @color: rgba(255, 47, 47, 1); 2 | @colorA: rgba(255, 47, 47, .5); 3 | @commonColor: rgba(0, 160, 232, 1); 4 | @commonColorA: rgba(0, 160, 232, .5); 5 | @payColor: #ff2f2f; 6 | @coinColor: #f5af18; 7 | 8 | .public-loading-more{ 9 | font-size: 12px!important; 10 | color: #999!important; 11 | background: none!important; 12 | width: 100%!important; 13 | margin: 10px 0!important; 14 | display: flex!important; 15 | align-items: center!important; 16 | justify-content: center!important; 17 | border: none!important; 18 | img{ 19 | height: 12px!important; 20 | margin-right: 10px!important; 21 | } 22 | } 23 | 24 | .public-list { 25 | min-height: 100vh; 26 | background: #f5f5f6; 27 | &.pd-b{ 28 | padding-bottom: 100px; 29 | } 30 | &.auto{ 31 | min-height: auto; 32 | } 33 | .public-list-ul { 34 | display: flex; 35 | flex-wrap: wrap; 36 | padding: 5px; 37 | li { 38 | width: calc(~"50% - 3px"); 39 | margin: 0px 6px 6px 0; 40 | background: #fff; 41 | border-radius: 5px; 42 | overflow: hidden; 43 | position: relative; 44 | &:nth-child(2n) { 45 | margin-right: 0; 46 | } 47 | .cover-wrap{ 48 | width: 100%; 49 | height: calc(~'50vw - 8px'); 50 | .cover { 51 | width: 100%; 52 | height: 100%; 53 | object-fit: cover; 54 | } 55 | } 56 | 57 | .information { 58 | padding: 8px 10px; 59 | .title { 60 | font-size: 14px; 61 | font-weight: bold; 62 | margin-bottom: 12px; 63 | text-overflow: ellipsis; 64 | display: -webkit-box; 65 | -webkit-line-clamp: 2; 66 | -webkit-box-orient: vertical; 67 | overflow: hidden; 68 | line-height: 20px!important; 69 | min-height: 40px!important; 70 | } 71 | .user { 72 | display: flex; 73 | align-items: center; 74 | justify-content: space-between; 75 | font-size: 12px; 76 | .user-l { 77 | display: flex; 78 | align-items: center; 79 | img { 80 | width: 26px; 81 | height: 26px; 82 | border-radius: 50%; 83 | margin-right: 5px; 84 | } 85 | } 86 | .user-r{ 87 | display: flex; 88 | align-items: center; 89 | color: #666; 90 | font-size: 12px; 91 | img{ 92 | width: 20px; 93 | height: 20px; 94 | } 95 | } 96 | } 97 | } 98 | } 99 | } 100 | } 101 | 102 | //公共按钮 103 | .public-btn-class { 104 | display: flex; 105 | align-items: center; 106 | justify-content: center; 107 | &.fixed{ 108 | position: fixed; 109 | width: 100%; 110 | left: 0; 111 | bottom: 0px; 112 | } 113 | &.mg-t-b{ 114 | margin-top: 80px; 115 | } 116 | &.fixed-bd{ 117 | position: fixed; 118 | width: 100%; 119 | height: 48px; 120 | left: 0; 121 | bottom: 0px; 122 | padding: 0 15px; 123 | background: #fff; 124 | box-shadow: 0px -5px 10px 0px 125 | rgba(158, 158, 158, 0.15); 126 | z-index: 100; 127 | .methods-btn,.common-btn{ 128 | height: 38px; 129 | } 130 | } 131 | .methods-btn{ 132 | background: @commonColorA; 133 | height: 44px; 134 | width: 100%; 135 | transition: all .2s; 136 | border-radius: 30px; 137 | display: flex; 138 | align-items: center; 139 | justify-content: center; 140 | color: #fff; 141 | cursor: pointer; 142 | font-weight: bold; 143 | &.active { 144 | background: @commonColor; 145 | } 146 | } 147 | .common-btn { 148 | background: @colorA; 149 | height: 44px; 150 | width: 100%; 151 | transition: all .2s; 152 | border-radius: 30px; 153 | display: flex; 154 | align-items: center; 155 | justify-content: center; 156 | color: #fff; 157 | cursor: pointer; 158 | font-weight: bold; 159 | &.active { 160 | background: @color; 161 | } 162 | &.transition{ 163 | background-image: linear-gradient(90deg, 164 | #ff2f2f 0%, 165 | #ff4165 100%) 166 | } 167 | } 168 | .methods-btn,.common-btn{ 169 | img{ 170 | height: 12px; 171 | margin-right: 5px; 172 | } 173 | &.mg-t { 174 | margin-top: 40px; 175 | } 176 | &.mg-d { 177 | margin-bottom: 40px; 178 | } 179 | 180 | &.mg-d-s { 181 | margin-bottom: 20px; 182 | } 183 | 184 | &.mg-t-s { 185 | margin-top: 20px; 186 | } 187 | 188 | &.pd { 189 | width: calc(~'100% - 20px'); 190 | } 191 | } 192 | } 193 | 194 | .text-over { 195 | text-overflow: ellipsis; 196 | display: -webkit-box; 197 | -webkit-line-clamp: 2; 198 | -webkit-box-orient: vertical; 199 | overflow: hidden; 200 | font-size: 14px; 201 | line-height: 22px!important; 202 | min-height: 44px!important; 203 | &.f-s{ 204 | font-size: 12px!important; 205 | line-height: 20px!important; 206 | min-height: 40px!important; 207 | } 208 | &.f-l{ 209 | font-size: 16px!important; 210 | line-height: 24px!important; 211 | min-height: 48px!important; 212 | } 213 | } 214 | 215 | 216 | .public-swiper { 217 | height: 100vw; 218 | img, 219 | video { 220 | width: 100%; 221 | height: 100%; 222 | object-fit: cover; 223 | } 224 | swiper { 225 | height: 100%; 226 | } 227 | } 228 | 229 | .public_video_icon { 230 | position: absolute; 231 | right: 10px; 232 | top: 10px; 233 | width: 24px; 234 | height: 24px; 235 | } 236 | -------------------------------------------------------------------------------- /src/pages/index/index.vue: -------------------------------------------------------------------------------- 1 | 5 | 61 | 62 | 158 | 159 | 218 | -------------------------------------------------------------------------------- /src/pages/release/index.vue: -------------------------------------------------------------------------------- 1 | 5 |