diff --git a/apis/modules/client.js b/apis/modules/client.js new file mode 100644 index 0000000..90d2a4e --- /dev/null +++ b/apis/modules/client.js @@ -0,0 +1,6 @@ +import request from '@/apis/request.js' +const { get, post } = request + +export const queryCustomer = (data) => { + return post('nakadai/nakadai/customer/queryCustomer', data) +} \ No newline at end of file diff --git a/apis/request.js b/apis/request.js new file mode 100644 index 0000000..019b072 --- /dev/null +++ b/apis/request.js @@ -0,0 +1,70 @@ +import config from '@/config/request' +let HTTP_COUNT = 0 // loading次数 + +const request = options => { + HTTP_COUNT++ + if (config.showLoading) { + // 请求数据时的loading + uni.showToast({ + title: '加载中', + duration: 200, + icon: 'loading' + }) + } + const header = Object.assign({}, config.headers, { + token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyIiwiaWF0IjoxNjUyMTQ5MDU1LCJleHAiOjE2NTIxOTIyNTUsImFjY291bnRJZCI6IjEifQ.VVjW9tgd0b7_My91VRGJncv62qkILLQGl9PqMkwU0v4' + }) + return new Promise((resolve, reject)=>{ + uni.request({ + header, + url: config.baseURL + options.url, + method: options.method || 'GET', // 请求类型,默认为GET + data: options.data || {}, // 请求参数,默认空对象 + success: ({ data }) => { + // 状态判断,根据后台定义并提示 + if (data.status === 200) { + resolve(data) + } else { + uni.showToast({ + title: data.message, + icon: 'none' + }) + reject(data) + } + }, + fail: err => { + uni.showToast({ + title: '请求失败!', + icon: 'fail' + }) + reject(err) + }, + complete: () => { + if (config.showLoading) { + HTTP_COUNT-- + HTTP_COUNT || uni.hideLoading() + } + } + }) + }) +} + +const get = (url, data, options = {}) => { + options.method = 'GET' + options.data = data + options.url = url + return request(options) +} + +const post = (url, data, options = {}) => { + options.method = 'POST' + options.data = data + options.url = url + return request(options) +} + +export default { + request, + get, + post +} \ No newline at end of file diff --git a/config/request.js b/config/request.js new file mode 100644 index 0000000..9c9819e --- /dev/null +++ b/config/request.js @@ -0,0 +1,19 @@ +/** +/** + * axios 配置文件 + * @author yujialong + */ + +export default { + baseURL: 'http://39.108.250.202:9000/', + headers: { + 'Content-Type': 'application/json;charset=UTF-8' + }, + data: {}, + method: 'POST', + responseType: 'json', // 响应数据类型 + withCredentials: false, // 携带cookie + // ======================== 以下为注入axios的配置项 ============================= + showLoading: true, // 是否显示加载动画 + isFormData: false // 是否序列化表单数据 +} diff --git a/pages.json b/pages.json index eefda79..0a0b121 100644 --- a/pages.json +++ b/pages.json @@ -1,11 +1,43 @@ { "pages": [ + { + "path" : "pages/orders/orders", + "style" : + { + "navigationBarTitleText": "订单列表", + "enablePullDownRefresh": false + } + }, { "path": "pages/index/index", "style": { "navigationBarTitleText": "首页" } }, + { + "path" : "pages/clients/clients", + "style" : + { + "navigationBarTitleText": "客户列表", + "enablePullDownRefresh": true + } + }, + { + "path" : "pages/password/password", + "style" : + { + "navigationBarTitleText": "修改密码", + "enablePullDownRefresh": false + } + }, + { + "path" : "pages/setting/setting", + "style" : + { + "navigationBarTitleText": "设置", + "enablePullDownRefresh": false + } + }, { "path" : "pages/send/send", "style" : @@ -13,7 +45,6 @@ "navigationBarTitleText": "下载发送", "enablePullDownRefresh": false } - }, { "path" : "pages/plans/plans", @@ -38,16 +69,7 @@ "navigationBarTitleText": "新建订单", "enablePullDownRefresh": false } - }, - { - "path" : "pages/clients/clients", - "style" : - { - "navigationBarTitleText": "客户列表", - "enablePullDownRefresh": false - } - - },{ + },{ "path" : "pages/clientDetail/clientDetail", "style" : { @@ -64,17 +86,8 @@ "enablePullDownRefresh": false } - } - ,{ - "path" : "pages/orders/orders", - "style" : - { - "navigationBarTitleText": "订单列表", - "enablePullDownRefresh": false - } - - } - ,{ + }, + { "path" : "pages/ordered/ordered", "style" : { @@ -147,7 +160,7 @@ // "selectedIconPath": "static/image/icon_component_HL.png", "text": "首页" }, { - "pagePath": "pages/clients/clients", + "pagePath": "pages/teams/teams", // "iconPath": "static/image/icon_API.png", // "selectedIconPath": "static/image/icon_API_HL.png", "text": "团队" diff --git a/pages/addClient/addClient.vue b/pages/addClient/addClient.vue index 42c4bce..ec40e90 100644 --- a/pages/addClient/addClient.vue +++ b/pages/addClient/addClient.vue @@ -107,7 +107,7 @@ } }, onLoad() { - console.log(getApp()) + }, methods: { onchange(e) { diff --git a/pages/clients/clients.vue b/pages/clients/clients.vue index d845060..ac1d9bd 100644 --- a/pages/clients/clients.vue +++ b/pages/clients/clients.vue @@ -1,39 +1,95 @@ + + diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue new file mode 100644 index 0000000..c8d0aa3 --- /dev/null +++ b/pages/setting/setting.vue @@ -0,0 +1,42 @@ + + + + +