17 changed files with 891 additions and 853 deletions
@ -1,46 +1,45 @@ |
|||
const apiUrl = 'https://test.tall.wiki/gateway'; // 测试
|
|||
// const apiUrl = 'https://www.tall.wiki/gateway'; // 生产
|
|||
import Config from '@/common/js/config.js' |
|||
|
|||
const apiUrl = Config.apiUrl; |
|||
const tall = `${apiUrl}/tall3/v3.0`; |
|||
|
|||
// 登录
|
|||
// export const login = {
|
|||
// async index(params) {
|
|||
// try {
|
|||
// const data = await uni.$u.http.post(`${tall}/users/signin`, params);
|
|||
// return data;
|
|||
// } catch (error) {
|
|||
// throw new Error(error);
|
|||
// }
|
|||
// },
|
|||
// };
|
|||
export const login = { |
|||
async index(params) { |
|||
try { |
|||
const data = await uni.$u.http.post(`${tall}/users/signin`, params); |
|||
return data; |
|||
} catch (error) { |
|||
throw new Error(error); |
|||
} |
|||
}, |
|||
}; |
|||
|
|||
|
|||
export function setupTall(app) { |
|||
uni.$u.api = { ...uni.$u.api } || {}; |
|||
// 登录
|
|||
// app.config.globalProperties.$u.api.signin = params => login.index(params);
|
|||
uni.$u.api.signin = params => login.index(params); |
|||
// 获取图片验证码
|
|||
// app.config.globalProperties.$u.api.getImageCode = () => app.config.globalProperties.$u.get(`${tall}/users/code`);
|
|||
uni.$u.api.getImageCode = () => uni.$u.get(`${tall}/users/code`); |
|||
// 获取短信验证码
|
|||
// app.config.globalProperties.$u.api.getSmsCode = params => app.config.globalProperties.$u.get(`${tall}/users/smscode`, params);
|
|||
uni.$u.api.getSmsCode = params => uni.$u.get(`${tall}/users/smscode`, params); |
|||
// 根据userId获取token
|
|||
uni.$u.api.getToken = userId => uni.$u.get(`${tall}/users/userId`, { userId }); |
|||
// 绑定手机号
|
|||
// app.config.globalProperties.$u.api.phoneBind = (phone, smsCode) => app.config.globalProperties.$u.http.post(`${tall}/users/binding`, { phone, smsCode });
|
|||
uni.$u.api.phoneBind = (phone, smsCode) => uni.$u.http.post(`${tall}/users/binding`, { phone, smsCode }); |
|||
// 是否合并账号
|
|||
// app.config.globalProperties.$u.api.phoneMerge = (phone, isMerge) => app.config.globalProperties.$u.http.post(`${tall}/users/merge`, { phone, isMerge });
|
|||
|
|||
uni.$u.api.phoneMerge = (phone, isMerge) => uni.$u.http.post(`${tall}/users/merge`, { phone, isMerge }); |
|||
// 修改用户信息
|
|||
// app.config.globalProperties.$u.api.updateUserInfo = params => app.config.globalProperties.$u.http.post(`${tall}/users/userInfo`, params);
|
|||
|
|||
uni.$u.api.updateUserInfo = params => uni.$u.http.post(`${tall}/users/userInfo`, params); |
|||
// 获取项目列表
|
|||
// app.config.globalProperties.$u.api.getProjects = (startTime, endTime) => app.config.globalProperties.$u.post(`${tall}/project/query`, { startTime, endTime });
|
|||
uni.$u.api.getProjects = (startTime, endTime) => uni.$u.post(`${tall}/project/query`, { startTime, endTime }); |
|||
// 查询日历是否有小红点
|
|||
// app.config.globalProperties.$u.api.findRedPoint = (startTime, endTime) => app.config.globalProperties.$u.post(`${tall}/project/day`, { startTime, endTime });
|
|||
uni.$u.api.findRedPoint = (startTime, endTime) => uni.$u.post(`${tall}/project/day`, { startTime, endTime }); |
|||
// 设置项目顺序
|
|||
// app.config.globalProperties.$u.api.setProjectSort = params => app.config.globalProperties.$u.post(`${tall}/project/setProjectSort`, params);
|
|||
uni.$u.api.setProjectSort = params => uni.$u.post(`${tall}/project/setProjectSort`, params); |
|||
// 设置项目父子结构
|
|||
// app.config.globalProperties.$u.api.setProjectRelation = params => app.config.globalProperties.$u.post(`${tall}/project/setProjectRelation`, params);
|
|||
uni.$u.api.setProjectRelation = params => uni.$u.post(`${tall}/project/setProjectRelation`, params); |
|||
// 删除某个项目
|
|||
// app.config.globalProperties.$u.api.delProject = projectId => app.config.globalProperties.$u.post(`${tall}/project/deleteProject`, { projectId });
|
|||
uni.$u.api.delProject = projectId => uni.$u.post(`${tall}/project/deleteProject`, { projectId }); |
|||
} |
|||
@ -1,7 +1,7 @@ |
|||
const install = (Vue, vm) => { |
|||
vm.$u.api = { ...vm.$u.api } || {}; |
|||
// 导入wbs
|
|||
vm.$u.api.import = formData => vm.$t.chooseAndUpload(`${uni.$t.domain}/wbs`, formData); |
|||
}; |
|||
import Config from "@/common/js/config.js" |
|||
|
|||
export default { install }; |
|||
export function setupWbs(app) { |
|||
uni.$u.api = { ...uni.$u.api } || {}; |
|||
// 导入wbs
|
|||
uni.$u.api.import = formData => this.$upload.chooseAndUpload(`${Config.apiUrl}/wbs`, formData); |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<template> |
|||
</template> |
|||
|
|||
<script> |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
|||
@ -1,35 +1,36 @@ |
|||
import app from '@/config/app.js'; |
|||
import cache from '@/utils/cache.js'; |
|||
import cacheAndRequest from '@/utils/cacheAndRequest.js'; |
|||
import storage from '@/utils/storage.js'; |
|||
import time from '@/utils/time.js'; |
|||
import ui from '@/utils/ui.js'; |
|||
import upload from '@/utils/upload.js'; |
|||
import user from '@/config/user.js'; |
|||
import zIndex from '@/config/zIndex.js'; |
|||
// import app from '@/config/app.js';
|
|||
// import cache from '@/utils/cache.js';
|
|||
// import cacheAndRequest from '@/utils/cacheAndRequest.js';
|
|||
// import storage from '@/utils/storage.js';
|
|||
// import time from '@/utils/time.js';
|
|||
// import ui from '@/utils/ui.js';
|
|||
// import upload from '@/utils/upload.js';
|
|||
// import user from '@/config/user.js';
|
|||
// import zIndex from '@/config/zIndex.js';
|
|||
|
|||
const gateway = process.env.VUE_APP_API_URL; |
|||
// const gateway = process.env.VUE_APP_API_URL;
|
|||
|
|||
const $t = { |
|||
zIndex, // 定位元素层级
|
|||
app, // app级别的相关配置
|
|||
storage, // 本地存储storage封装
|
|||
time, // 时间处理
|
|||
ui, // ui界面提示相关
|
|||
chooseAndUpload: upload.chooseAndUpload, // 选择并上传单个文件相关的封装
|
|||
domain: `${gateway}/defaultwbs`, |
|||
cache, // 本地存储相关
|
|||
$q: cacheAndRequest, |
|||
user, // 用户相关配置
|
|||
}; |
|||
// const $t = {
|
|||
// zIndex, // 定位元素层级
|
|||
// app, // app级别的相关配置
|
|||
// storage, // 本地存储storage封装
|
|||
// time, // 时间处理
|
|||
// ui, // ui界面提示相关
|
|||
// chooseAndUpload: upload.chooseAndUpload, // 选择并上传单个文件相关的封装
|
|||
// domain: `${gateway}/defaultwbs`,
|
|||
// cache, // 本地存储相关
|
|||
// $q: cacheAndRequest,
|
|||
// user, // 用户相关配置
|
|||
// };
|
|||
|
|||
uni.$t = $t; |
|||
// uni.$t = $t;
|
|||
|
|||
const install = Vue => { |
|||
// Vue.prototype.$t = $t;
|
|||
Vue.config.globalProperties.$t = $t; |
|||
}; |
|||
// const install = Vue => {
|
|||
// // Vue.prototype.$t = $t;
|
|||
|
|||
export default { |
|||
install |
|||
}; |
|||
// Vue.config.globalProperties.$t = $t;
|
|||
// };
|
|||
|
|||
// export default {
|
|||
// install
|
|||
// };
|
|||
|
|||
Loading…
Reference in new issue