├── src ├── static │ ├── logo.png │ ├── icons │ │ ├── close.png │ │ ├── more.png │ │ ├── share.png │ │ ├── user.png │ │ ├── write.png │ │ ├── finish.png │ │ ├── upload.png │ │ ├── enclosure.png │ │ ├── leftTime.png │ │ └── arrow-right.png │ └── img │ │ ├── setup.png │ │ └── background.jpg ├── sfc.d.ts ├── api │ ├── feedback.ts │ ├── wechat.ts │ ├── user.ts │ ├── lists.ts │ ├── tasks.ts │ ├── auth.ts │ └── common.ts ├── main.ts ├── App.vue ├── store │ └── index.ts ├── components │ ├── editor │ │ ├── editor.css │ │ ├── assets │ │ │ └── iconfont.css │ │ └── editor.vue │ ├── user │ │ └── edit-row.vue │ └── uploader.vue ├── pages │ ├── setup │ │ └── setup.vue │ ├── feedback │ │ └── feedback.vue │ ├── task │ │ ├── joinTask.vue │ │ ├── visitorTask.vue │ │ ├── addTask.vue │ │ └── task.vue │ ├── list │ │ ├── addList.vue │ │ └── updateList.vue │ ├── login │ │ └── login.vue │ ├── register │ │ └── register.vue │ ├── user │ │ └── user-edit.vue │ └── index │ │ └── index.vue ├── uitls │ └── request.ts ├── typings │ └── index.d.ts ├── pages.json ├── uni.scss └── manifest.json ├── unpackage └── res │ └── icons │ ├── 120x120.png │ ├── 144x144.png │ ├── 152x152.png │ ├── 167x167.png │ ├── 180x180.png │ ├── 192x192.png │ ├── 20x20.png │ ├── 29x29.png │ ├── 40x40.png │ ├── 58x58.png │ ├── 60x60.png │ ├── 72x72.png │ ├── 76x76.png │ ├── 80x80.png │ ├── 87x87.png │ ├── 96x96.png │ └── 1024x1024.png ├── .env.production ├── .env.development ├── .gitignore ├── jest.config.js ├── vue.config.js ├── README.md ├── postcss.config.js ├── tsconfig.json ├── public └── index.html ├── simple-plant.puml ├── babel.config.js └── package.json /src/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/logo.png -------------------------------------------------------------------------------- /src/sfc.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import Vue from 'vue' 3 | export default Vue 4 | } -------------------------------------------------------------------------------- /src/static/icons/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/close.png -------------------------------------------------------------------------------- /src/static/icons/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/more.png -------------------------------------------------------------------------------- /src/static/icons/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/share.png -------------------------------------------------------------------------------- /src/static/icons/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/user.png -------------------------------------------------------------------------------- /src/static/icons/write.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/write.png -------------------------------------------------------------------------------- /src/static/img/setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/img/setup.png -------------------------------------------------------------------------------- /src/static/icons/finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/finish.png -------------------------------------------------------------------------------- /src/static/icons/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/upload.png -------------------------------------------------------------------------------- /src/static/icons/enclosure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/enclosure.png -------------------------------------------------------------------------------- /src/static/icons/leftTime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/leftTime.png -------------------------------------------------------------------------------- /src/static/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/img/background.jpg -------------------------------------------------------------------------------- /unpackage/res/icons/120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/120x120.png -------------------------------------------------------------------------------- /unpackage/res/icons/144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/144x144.png -------------------------------------------------------------------------------- /unpackage/res/icons/152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/152x152.png -------------------------------------------------------------------------------- /unpackage/res/icons/167x167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/167x167.png -------------------------------------------------------------------------------- /unpackage/res/icons/180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/180x180.png -------------------------------------------------------------------------------- /unpackage/res/icons/192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/192x192.png -------------------------------------------------------------------------------- /unpackage/res/icons/20x20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/20x20.png -------------------------------------------------------------------------------- /unpackage/res/icons/29x29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/29x29.png -------------------------------------------------------------------------------- /unpackage/res/icons/40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/40x40.png -------------------------------------------------------------------------------- /unpackage/res/icons/58x58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/58x58.png -------------------------------------------------------------------------------- /unpackage/res/icons/60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/60x60.png -------------------------------------------------------------------------------- /unpackage/res/icons/72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/72x72.png -------------------------------------------------------------------------------- /unpackage/res/icons/76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/76x76.png -------------------------------------------------------------------------------- /unpackage/res/icons/80x80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/80x80.png -------------------------------------------------------------------------------- /unpackage/res/icons/87x87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/87x87.png -------------------------------------------------------------------------------- /unpackage/res/icons/96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/96x96.png -------------------------------------------------------------------------------- /src/static/icons/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/src/static/icons/arrow-right.png -------------------------------------------------------------------------------- /unpackage/res/icons/1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qifan777/simple-plan/HEAD/unpackage/res/icons/1024x1024.png -------------------------------------------------------------------------------- /.env.production: -------------------------------------------------------------------------------- 1 | VUE_APP_BASE_URL=https://www.jarcheng.top/cloud-api/plan 2 | VUE_APP_UPLOAD_URL=https://www.jarcheng.top/cloud-api/system 3 | -------------------------------------------------------------------------------- /src/api/feedback.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from "@/uitls/request" 2 | 3 | export const saveFeedback=function(data:any){ 4 | return requestWithToken('/feedback/save','POST',data) 5 | } -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | import store from './store' 6 | const app=new App({store}) 7 | app.$mount() 8 | -------------------------------------------------------------------------------- /src/api/wechat.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from "@/uitls/request"; 2 | 3 | export const getWechatPhone = function (data: any) { 4 | return requestWithToken("/wechat/phone", "GET", data); 5 | }; 6 | -------------------------------------------------------------------------------- /src/api/user.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from "@/uitls/request" 2 | 3 | export const updateUser=(data:any)=>{ 4 | return requestWithToken('/user/update','POST',data) 5 | } 6 | export const getUserInfo=()=>{ 7 | return requestWithToken("/user/info", "GET", null) 8 | } -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | ##VUE_APP_BASE_URL=/api/plan 2 | ##VUE_APP_UPLOAD_URL=/api/system 3 | VUE_APP_BASE_URL=https://www.jarcheng.top/cloud-api/plan 4 | VUE_APP_UPLOAD_URL=https://www.jarcheng.top/cloud-api/system 5 | #VUE_APP_BASE_URL=http://192.168.0.104/plan 6 | #VUE_APP_UPLOAD_URL=http://192.168.0.104/system -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | # unpackage/ 4 | dist/ 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .project 17 | .hbuilderx 18 | .idea 19 | .vscode 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw* 25 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | -------------------------------------------------------------------------------- /src/api/lists.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from '@/uitls/request' 2 | 3 | export const listLists = (data: any) => { 4 | return requestWithToken('/list/findAll', 'GET', data) 5 | } 6 | export const createList = (data: any) => { 7 | return requestWithToken('/list/save', 'POST', data) 8 | } 9 | export const deleteLists=(data:any)=>{ 10 | return requestWithToken('/list/delete?ids='+data,'GET',null) 11 | } 12 | export const updateList=(data:any)=>{ 13 | return requestWithToken('/list/update','POST',data) 14 | } 15 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | globalTeardown: '@dcloudio/uni-automator/dist/teardown.js', 3 | testEnvironment: '@dcloudio/uni-automator/dist/environment.js', 4 | testEnvironmentOptions: {}, 5 | testTimeout: 15000, 6 | reporters: [ 7 | 'default' 8 | ], 9 | watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'], 10 | moduleFileExtensions: ['js', 'json'], 11 | rootDir: __dirname, 12 | testMatch: ['/src/**/*test.[jt]s?(x)'], 13 | testPathIgnorePatterns: ['/node_modules/'] 14 | } 15 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transpileDependencies: ['@dcloudio/uni-ui'], 3 | devServer: { 4 | disableHostCheck: true, 5 | open: true, 6 | port: 3000, 7 | proxy: { 8 | '/api': { 9 | // target: 'http://localhost', 10 | target:"https://www.jarcheng.top/cloud-api", 11 | changeOrigin: true, 12 | pathRewrite: { 13 | '^/api': '' 14 | } 15 | } 16 | } 17 | }, 18 | publicPath: './', 19 | }; -------------------------------------------------------------------------------- /src/store/index.ts: -------------------------------------------------------------------------------- 1 | import { User } from "@/typings"; 2 | import Vuex from "vuex"; 3 | import Vue from "vue"; 4 | import { getUserInfo as getUserInfo2 } from "@/api/user"; 5 | Vue.use(Vuex) 6 | const store = new Vuex.Store({ 7 | state: { 8 | userInfo: {} as User, 9 | }, 10 | mutations: { 11 | updateUserInfo(state, value) { 12 | state.userInfo = { ...state.userInfo, ...value }; 13 | }, 14 | }, 15 | actions: { 16 | getUserInfo({ commit }) { 17 | getUserInfo2().then((res) => { 18 | commit("updateUserInfo",res.data); 19 | }); 20 | }, 21 | }, 22 | }); 23 | export default store; 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 简计划 2 | 本项目是基于uni-app(vue2语法) 以及typescript。实现了如下功能 3 | 4 | ![](https://photo-invite.oss-cn-qingdao.aliyuncs.com/simple-plan/code.jpg) 5 | 6 | - 创建任务清单(包含许多任务) 7 | - 创建任务(添加附件,截至时间,划分子任务,分配任务给其他人) 8 | - 富文本编辑 9 | - 基础登录/注册 10 | ### clone代码 11 | 12 | ``` 13 | #需要安装git命令 14 | git clone https://github.com/jarcheng/simple-plan.git 15 | ``` 16 | 17 | ### 安装yarn 18 | 19 | ``` 20 | #需要安装node.js 21 | npm install yarn -g 22 | ``` 23 | 24 | ### 导入vscode 25 | 26 | 将刚刚clone下的代码导入到vscode,然后点击上面菜单栏中的`terminal`->`new terminal` 在下面弹出的框框中依次输入下面的两条命令 27 | 28 | ### 安装依赖包 29 | 30 | ``` 31 | yarn install 32 | ``` 33 | 34 | ### 启动 35 | ``` 36 | yarn serve 37 | ``` 38 | 39 | ### 具体配置参考uni-app的manifest 40 | See [Configuration Reference](https://uniapp.dcloud.io/collocation/manifest?id=app-plus). 41 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | module.exports = { 3 | parser: require('postcss-comment'), 4 | plugins: [ 5 | require('postcss-import')({ 6 | resolve (id, basedir, importOptions) { 7 | if (id.startsWith('~@/')) { 8 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3)) 9 | } else if (id.startsWith('@/')) { 10 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2)) 11 | } else if (id.startsWith('/') && !id.startsWith('//')) { 12 | return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1)) 13 | } 14 | return id 15 | } 16 | }), 17 | require('autoprefixer')({ 18 | remove: process.env.UNI_PLATFORM !== 'h5' 19 | }), 20 | require('@dcloudio/vue-cli-plugin-uni/packages/postcss') 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/components/editor/editor.css: -------------------------------------------------------------------------------- 1 | @import "./assets/iconfont.css"; 2 | 3 | .container { 4 | /* position: absolute; */ 5 | /* top: 120px; */ 6 | /* left: 0; */ 7 | width: 100%; 8 | } 9 | 10 | .ql-container { 11 | box-sizing: border-box; 12 | width: 100%; 13 | height: 100%; 14 | font-size: 16px; 15 | line-height: 1.5; 16 | overflow: auto; 17 | padding: 20px 10px 20px 10px; 18 | } 19 | 20 | .ql-active { 21 | color: #22C704; 22 | } 23 | 24 | .iconfont { 25 | display: inline-block; 26 | width: 32px; 27 | height: 30px; 28 | cursor: pointer; 29 | font-size: 20px; 30 | } 31 | 32 | .toolbar { 33 | box-sizing: border-box; 34 | padding: 10px; 35 | /* height: 130px; */ 36 | width: 100%; 37 | /* position: fixed; */ 38 | left: 0; 39 | top: 0; 40 | background: #fff; 41 | right: 100%; 42 | display: flex; 43 | flex-wrap: wrap; 44 | text-align: center; 45 | border-bottom: 1rpx solid #eee; 46 | } 47 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": false, 4 | "target": "esnext", 5 | "module": "esnext", 6 | "strict": true, 7 | "jsx": "preserve", 8 | "importHelpers": true, 9 | "moduleResolution": "node", 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "experimentalDecorators":true, 13 | "sourceMap": true, 14 | "skipLibCheck": true, 15 | "baseUrl": ".", 16 | "types": [ 17 | "webpack-env", 18 | "@dcloudio/types", 19 | "miniprogram-api-typings", 20 | "mini-types", 21 | "@types/three" 22 | ], 23 | "paths": { 24 | "@/*": [ 25 | "./src/*" 26 | ] 27 | }, 28 | "lib": [ 29 | "esnext", 30 | "dom", 31 | "dom.iterable", 32 | "scripthost" 33 | ] 34 | }, 35 | "exclude": [ 36 | "node_modules", 37 | "unpackage", 38 | "src/**/*.nvue" 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /src/api/tasks.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from "@/uitls/request"; 2 | 3 | export const taskList = (data: any) => { 4 | return requestWithToken("/task/findAll", "GET", data); 5 | }; 6 | export const createTask = (data: any) => { 7 | return requestWithToken("/task/save", "POST", data); 8 | }; 9 | export const updateTask = (data: any) => { 10 | return requestWithToken("/task/update", "POST", data); 11 | }; 12 | export const showTask = (data: any) => { 13 | return requestWithToken("/task/fineOne", "GET", data); 14 | }; 15 | export const shareTask = (data: any) => { 16 | return requestWithToken("/task/share", "GET", data); 17 | }; 18 | export const joinTask = (data: any) => { 19 | return requestWithToken("/task/join", "GET", data); 20 | }; 21 | export const sharedTasks = () => { 22 | return requestWithToken("/task/sharedTasks", "GET", null); 23 | }; 24 | export const deleteRelation=(data:any)=>{ 25 | return requestWithToken("/task/deleteRelation","GET",data) 26 | } -------------------------------------------------------------------------------- /src/api/auth.ts: -------------------------------------------------------------------------------- 1 | import requestWithToken from "@/uitls/request"; 2 | 3 | export const login = (data: any) => { 4 | return requestWithToken("/auth/login", "POST", data); 5 | }; 6 | export const register = (data: any) => { 7 | return requestWithToken("/auth/signUp", "POST", data); 8 | }; 9 | export const wechatLogin = function () { 10 | console.log("微信登陆"); 11 | 12 | uni.login({ 13 | provider: "weixin", 14 | success: (res) => { 15 | let params = { 16 | code: res.code, 17 | }; 18 | requestWithToken("/auth/wechat/login", "GET", params).then((res2) => { 19 | if (res2.data.tokenValue) { 20 | uni.setStorage({ 21 | key: "token", 22 | data: res2.data.tokenValue, 23 | success: () => { 24 | setTimeout(() => { 25 | uni.reLaunch({ 26 | url: "/pages/index/index", 27 | }); 28 | }, 1500); 29 | }, 30 | }); 31 | } 32 | }); 33 | }, 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 14 | 15 | 16 | 17 | 18 | 21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/components/user/edit-row.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 26 | 27 | 49 | -------------------------------------------------------------------------------- /simple-plant.puml: -------------------------------------------------------------------------------- 1 | @startuml 2 | 用户 --> 小程序首页:搜索简计划 3 | 小程序首页 --> 列表添加页面:点击右下角“+”,\n选择添加清单 4 | 小程序首页-->任务添加页面:在首页找到需要\n添加任务的清单,\n点击它右上方的“···”,\n选择添加任务 5 | 小程序首页-->任务修改页面:在首页左滑需要\n修改的任务,点击修改 6 | @enduml 7 | @startuml 8 | :user: --> (任务清单) 9 | (任务清单)..>(清单删除):include 10 | (任务清单)..>(清单修改):include 11 | (任务清单)..>(清单创建):include 12 | (清单创建)-->(任务) 13 | (任务)..>(任务修改) 14 | (任务)..>(任务提醒) 15 | (任务)..>(任务创建) 16 | (任务)..>(任务分配) 17 | :user2:<--(任务分配) 18 | @enduml 19 | @startuml 20 | class 用户 21 | 用户 ”1“ --o ”many“ 任务清单 22 | 任务清单 ”1“ --o ”many“ 任务 23 | 任务 ”1“ --* ”many“ 任务步骤 24 | 用户 ”many“ --o "many" 任务 25 | @enduml 26 | @startuml 27 | database "Mysql" as mysql 28 | [权限模块]-登录 29 | [权限模块]-left--注册 30 | [权限模块]..>用户查询:调用 31 | [系统模块]-用户查询 32 | [系统模块]-->mysql:查询数据库 33 | [任务管理模块]-登录2 34 | [任务管理模块]-left-注册2 35 | [任务管理模块]..>登录:调用 36 | [任务管理模块]..>注册:调用 37 | @enduml 38 | @startuml 39 | state choice1 <> 40 | [*]-down-> 输入用户名 41 | 输入用户名 -down-> choice1 :判断用户名是否存在 42 | choice1-left->输入用户名: 已经存在 43 | choice1-down->密码加密 44 | 密码加密->注册 45 | @enduml 46 | @startuml 47 | object 任务清单 48 | object 任务步骤 49 | map 任务{ 50 | 清单 *->任务清单 51 | 步骤 *->任务步骤 52 | } 53 | @enduml 54 | @startuml 55 | 56 | @enduml -------------------------------------------------------------------------------- /src/api/common.ts: -------------------------------------------------------------------------------- 1 | export const uploadFile = (filePath: any) => { 2 | let promise = new Promise((resolve, reject) => { 3 | console.log(filePath) 4 | uni.uploadFile({ 5 | url: process.env.VUE_APP_UPLOAD_URL + '/upload/upload', 6 | header: { 7 | jctoken: uni.getStorageSync('token') 8 | }, 9 | name:'name', 10 | filePath: filePath, 11 | success: res => { 12 | console.log(res); 13 | resolve(JSON.parse(res.data)) 14 | }, 15 | fail: result => { 16 | console.log(result); 17 | reject(result) 18 | } 19 | }) 20 | }) 21 | return promise 22 | } 23 | export const dateFormat = function(date:Date) { 24 | var Y = date.getFullYear() + '-'; 25 | var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; 26 | var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '; 27 | var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'; 28 | var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'; 29 | var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()); 30 | return Y + M + D + h + m + s; 31 | } -------------------------------------------------------------------------------- /src/pages/setup/setup.vue: -------------------------------------------------------------------------------- 1 | 8 | 46 | 63 | -------------------------------------------------------------------------------- /src/uitls/request.ts: -------------------------------------------------------------------------------- 1 | const baseUrl =process.env.VUE_APP_BASE_URL 2 | // const baseUrl = "http://localhost/plan"; 3 | console.log(baseUrl); 4 | import store from "@/store"; 5 | import { wechatLogin } from "@/api/auth"; 6 | const requestWithToken = ( 7 | url: string, 8 | method: 9 | | "OPTIONS" 10 | | "GET" 11 | | "HEAD" 12 | | "POST" 13 | | "PUT" 14 | | "DELETE" 15 | | "TRACE" 16 | | "CONNECT", 17 | data: any 18 | ): Promise => { 19 | let promise = new Promise((resolve, reject) => { 20 | let toekn = uni.getStorageSync("token"); 21 | let requestOptions = { 22 | url: baseUrl + url, 23 | method: method, 24 | data: data, 25 | header: { 26 | jctoken: "", 27 | }, 28 | dataType: "json", 29 | success: (res: any) => { 30 | if (res.data.code == 500) { 31 | uni.showToast({ 32 | title: res.data.msg, 33 | icon: "none", 34 | }); 35 | } 36 | if (res.data.code === 401 || res.data.code === 403) { 37 | // #ifdef H5 || APP-PLUS 38 | uni.navigateTo({ url: "/pages/login/login" }); 39 | // #endif 40 | // #ifdef MP-WEIXIN 41 | wechatLogin(); 42 | // #endif 43 | // store.commit('setLoginShow', true) 44 | } else { 45 | resolve(res.data); 46 | } 47 | }, 48 | fail: (res: any) => { 49 | reject(res); 50 | }, 51 | }; 52 | if (toekn) { 53 | requestOptions.header.jctoken = toekn; 54 | } 55 | uni.request(requestOptions); 56 | }); 57 | return promise; 58 | }; 59 | export default requestWithToken; 60 | -------------------------------------------------------------------------------- /src/pages/feedback/feedback.vue: -------------------------------------------------------------------------------- 1 |