From cc884926cd17fe002459556006522449f8c72fbf Mon Sep 17 00:00:00 2001 From: lxz Date: Wed, 27 Dec 2023 19:21:26 +0800 Subject: [PATCH] sfdas --- api/enroll.js | 37 + api/oaUser.js | 17 +- api/register.js | 0 .../districtSelector/districtSelectorTow.vue | 56 +- config/app.js | 10 +- pages.json | 10 + pages/oaLogin/oaEnroll.vue | 692 ++++++++++++++++++ pages/oaLogin/oaLogin.vue | 14 + utils/pubblicHttp.js | 114 +++ 9 files changed, 915 insertions(+), 35 deletions(-) create mode 100644 api/enroll.js create mode 100644 api/register.js create mode 100644 pages/oaLogin/oaEnroll.vue create mode 100644 utils/pubblicHttp.js diff --git a/api/enroll.js b/api/enroll.js new file mode 100644 index 0000000..9ce336c --- /dev/null +++ b/api/enroll.js @@ -0,0 +1,37 @@ +import oahttp from "@/utils/pubblicHttp.js"; + +/** + * 获取市 + */ +export const commonCity = (data) => oahttp.get('/common/city', data) + +/** + * 获取省 + */ +export const commonProvince = (data) => oahttp.get('/common/province', data) + +/** + * 获取区县 + */ +export const commonArea = (data) => oahttp.get('/common/area', data) + +/** + * 获取城镇 + */ +export const commonStreet = (data) => oahttp.get('/common/street', data) + +/** + * 获取村 + */ +export const commonVillage = (data) => oahttp.get('/common/village', data) + +/** + * 获取小队 + */ +export const commonBrigade = (data) => oahttp.get('/common/brigade', data) + + +/** + * 注册 + */ +export const register = (data) => oahttp.post('/new.user/register', data) \ No newline at end of file diff --git a/api/oaUser.js b/api/oaUser.js index b742186..60554b9 100644 --- a/api/oaUser.js +++ b/api/oaUser.js @@ -3,12 +3,17 @@ import oahttp from "@/utils/oahttp.js"; /** * 登录 */ -export const loginAccount = (data, onReLogin = false) => oahttp.post('/login/account', data, { noAuth: true, onReLogin: onReLogin }) +export const loginAccount = (data, onReLogin = false) => oahttp.post('/login/account', data, { + noAuth: true, + onReLogin: onReLogin +}) /** * cesi */ -export const test = (data) => oahttp.post('/index/config', data, { noAuth: true }) +export const test = (data) => oahttp.post('/index/config', data, { + noAuth: true +}) /** * 个人中心 @@ -68,9 +73,13 @@ export const destroyAccount = (data) => oahttp.post('/user/destroy_account', dat /** * 商城登录 */ -export const loginShopAccount = (data) => oahttp.post('/login/shop_account', data, { noAuth: true }) +export const loginShopAccount = (data) => oahttp.post('/login/shop_account', data, { + noAuth: true +}) /** * 中台登录 */ -export const loginParseToken = (data) => oahttp.post('/login/parseToken', data, { noAuth: true }) +export const loginParseToken = (data) => oahttp.post('/login/parseToken', data, { + noAuth: true +}) \ No newline at end of file diff --git a/api/register.js b/api/register.js new file mode 100644 index 0000000..e69de29 diff --git a/components/districtSelector/districtSelectorTow.vue b/components/districtSelector/districtSelectorTow.vue index 80c82f8..f3ad0c7 100644 --- a/components/districtSelector/districtSelectorTow.vue +++ b/components/districtSelector/districtSelectorTow.vue @@ -3,7 +3,8 @@ - + - - + + @@ -36,9 +39,9 @@ commonVillage, commonBrigade } from "@/api/oaPbulic.js" - import { - userCompanyBrigade - } from "@/api/oaUser.js" + import { + userCompanyBrigade + } from "@/api/oaUser.js" import { Toast } from "../../libs/uniApi" @@ -125,6 +128,7 @@ } else { this.rules = {}; } + this.commonProvince() }, computed: { nowAddress() { @@ -163,13 +167,13 @@ }) }, // 选择城市 - changeCity(type, toast=false) { - if(toast) return Toast('不可修改该区域') - if (this.$props.readonly) return ; + changeCity(type, toast = false) { + if (toast) return Toast('不可修改该区域') + if (this.$props.readonly) return; if (this[type + 'List'].length == 0) { - if(type=='brigade') return Toast('小队已经建立完毕'); - return Toast('请先选择上一级地区'); - } + if (type == 'brigade') return Toast('小队已经建立完毕'); + return Toast('请先选择上一级地区'); + } this.changeType = type; this.showProvince = true; }, @@ -235,20 +239,20 @@ commonBrigade({ brigade: code }).then(res => { - // 过滤掉不能选择的小队,只能选择本公司负责的小队 - let f_arr = this.$store.state.app.userInfo.company?.responsible_area?.split(',')||[]; - this.brigadeList = res.data.filter(item=>{ - return f_arr.find(t=>item.id==t); - }); - // 过滤掉公司已经创建的小队 - userCompanyBrigade().then((e)=>{ - this.brigadeList = this.brigadeList.filter(item=>{ - return !e.data.find(t=>t==item.id); - }) - this.formData.brigade = ''; - this.formDataRead.brigade = ''; - this.formDataText.brigade = ''; - }) + // 过滤掉不能选择的小队,只能选择本公司负责的小队 + let f_arr = this.$store.state.app.userInfo.company?.responsible_area?.split(',') || []; + this.brigadeList = res.data.filter(item => { + return f_arr.find(t => item.id == t); + }); + // 过滤掉公司已经创建的小队 + userCompanyBrigade().then((e) => { + this.brigadeList = this.brigadeList.filter(item => { + return !e.data.find(t => t == item.id); + }) + this.formData.brigade = ''; + this.formDataRead.brigade = ''; + this.formDataText.brigade = ''; + }) }) }, } diff --git a/config/app.js b/config/app.js index 4006505..c27be76 100644 --- a/config/app.js +++ b/config/app.js @@ -3,9 +3,9 @@ let httpApi; // 总域名 let httpApiTwo; // 物流系统域名 // const env = 'dev'; // 开发 -const env = 'prod'; // 生产 +// const env = 'prod'; // 生产 // const env = 'prew'; // 预上线 -// const env = 'local'; // 本地 +const env = 'local'; // 本地 switch (env) { case 'prod': @@ -19,9 +19,9 @@ switch (env) { httpApiTwo = 'https://preview-logistics.lihaink.cn' //预上线 break; case 'local': - httpApi = 'http://192.168.1.20:8000' //预上线 - httpApiThree = 'http://192.168.1.20:8000' //预上线 - httpApiTwo = 'http://192.168.1.20:8000' //预上线 + httpApi = 'http://192.168.1.21:8083' //预上线 + httpApiThree = 'http://192.168.1.21:8083' //预上线 + httpApiTwo = 'http://192.168.1.21:8083' //预上线 break; default: httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试 diff --git a/pages.json b/pages.json index b44a8c4..3ec183b 100644 --- a/pages.json +++ b/pages.json @@ -24,6 +24,16 @@ "navigationBarTextStyle": "white" } + }, + { + "path": "pages/oaLogin/oaEnroll", + "style": { + "navigationBarTitleText": "账号注册", + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#0122C7", + "navigationBarTextStyle": "white" + } + }, { "path": "pages/business/business", diff --git a/pages/oaLogin/oaEnroll.vue b/pages/oaLogin/oaEnroll.vue new file mode 100644 index 0000000..d7a3c55 --- /dev/null +++ b/pages/oaLogin/oaEnroll.vue @@ -0,0 +1,692 @@ + + + + + \ No newline at end of file diff --git a/pages/oaLogin/oaLogin.vue b/pages/oaLogin/oaLogin.vue index 626e3d4..34b878b 100644 --- a/pages/oaLogin/oaLogin.vue +++ b/pages/oaLogin/oaLogin.vue @@ -30,7 +30,11 @@ --> + + 还没有账号? 点击注册 + + @@ -215,6 +219,11 @@ //忘记密码 forgetPWD() { Toast('暂未开放') + }, + navgo(url) { + uni.navigateTo({ + url + }) } }, } @@ -343,4 +352,9 @@ } } } + + .enroll-text { + color: $theme-oa-color; + margin-left: 5px; + } \ No newline at end of file diff --git a/utils/pubblicHttp.js b/utils/pubblicHttp.js new file mode 100644 index 0000000..adcb060 --- /dev/null +++ b/utils/pubblicHttp.js @@ -0,0 +1,114 @@ +import { + HTTP_REQUEST_URL_THREE, + HEADER, + TOKENNAME, +} from '@/config/app'; +import { + Toast +} from '../libs/uniApi'; +// import { checkLogin } from '../libs/login'; +import store from '../store'; + +function toLogin() { + uni.showToast({ + title: '请先登录', + icon: 'none', + duration: 1000 + }); +} + +function baseRequestTwo(url, method, data, { + noAuth = false, + noVerify = false, + onReLogin = false +}) { + let Url = HTTP_REQUEST_URL_THREE, + header = HEADER; + + + // if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token; + if (store.state.app.token) header[TOKENNAME] = store.state.app.token; + + // header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv'; + return new Promise((reslove, reject) => { + // uni.showLoading({ + // title: '加载中' + // }) + uni.request({ + // url: Url + '/api/v1' + url, + url: Url + '/api' + url, + method: method || 'GET', + header: { + ...header + }, + data: method != 'GET' ? data || {} : {}, + params: method == 'GET' ? data : {}, + success: (res) => { + if (noVerify) + reslove(res.data); + else if (res.data.code == -1) { + if (onReLogin) { + store.commit('LOGOUT'); + return reject(); + } + // 如果登录超时,自动重新登录并且继续发送请求 + store.dispatch("RE_LOGIN", { + url: url, + method: method, + data: data, + opt: { + noAuth, + noVerify + } + }).then((e) => { + reslove(e); + }).catch((err) => { + reject(res.data); + }) + // store.commit("SET_REQUEST", false); + } else if (res.data.code == 0) { + if (res.data.msg != '无登录信息') { + uni.showToast({ + title: res.data.msg || '请检查网络', + icon: 'none', + }) + } + reject(res.data); + } else if (res.data.code == 1) { + store.commit("SET_REQUEST"); + reslove(res.data); + } else if (res.data.code == 200) { + store.commit("SET_REQUEST"); + reslove(res.data.data); + } else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) { + toLogin(); + reject(res.data); + } else if (res.data.code == 501) { + reject(res.data); + } else { + uni.showToast({ + title: res.data.msg || '请检查网络', + icon: 'none' + }) + reject(res.data.msg || '请检查网络'); + } + }, + fail: (message) => { + // uni.hideLoading() + uni.showToast({ + title: '网络错误', + icon: 'none' + }) + reject('请求失败'); + } + }) + }); +} + +const oahttp = {}; + +['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => { + oahttp[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {}) +}); + +export default oahttp; \ No newline at end of file