diff --git a/common/http.api.js b/common/http.api.js index c87d55b..4faf4a7 100644 --- a/common/http.api.js +++ b/common/http.api.js @@ -17,9 +17,13 @@ const install = (Vue, vm) => { getFunList:(params = {})=>vm.$u.get(config.adminPath+'/system/funList/list', params), //我的访客列表 getMyVisitor:(params = {})=>vm.$u.get(config.adminPath+'/property/visitorManagement/list',params), + //新增访客 + addVisitor:(params = {})=>vm.$u.post(config.adminPath+'/property/visitorManagement',params), + //报事报修 getOrderList:(params = {})=>vm.$u.get(config.adminPath+'/property/workOrders/list',params), + // 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等 lang: (params = {}) => vm.$u.get('/lang/'+params.lang), index: (params = {}) => vm.$u.get(config.adminPath+'/mobile/index', params), diff --git a/common/upload.js b/common/upload.js new file mode 100644 index 0000000..fead158 --- /dev/null +++ b/common/upload.js @@ -0,0 +1,72 @@ +// utils/upload.js + +export const uploadFiles = ({ + files = [], + url = '', + name = 'file', + formData = {}, + fileType = 'image', + vm, // 关键:传入 vm 以便访问 vuex_token、vuex_remember 等 +}) => { + return new Promise(async (resolve, reject) => { + if (!url) return reject(new Error('上传地址不能为空')); + if (!Array.isArray(files) || files.length === 0) return reject(new Error('文件列表不能为空')); + + const results = []; + for (let i = 0; i < files.length; i++) { + const filePath = files[i]; + try { + const res = await uploadSingleFile({ filePath, url, name, formData, fileType, vm }); + results.push(res); + } catch (err) { + reject(err); + return; + } + } + resolve(results); + }); +}; + +function uploadSingleFile({ filePath, url, name, formData = {}, fileType = 'image', vm }) { + return new Promise((resolve, reject) => { + const headers = { + 'x-requested-with': 'XMLHttpRequest', + source: 'uniapp', + clientId: 'dab457a1ea14411787c240db05bb0832', + }; + + // 手动加上 Token + if (vm?.vuex_token) { + headers.Authorization = `Bearer ${vm.vuex_token}`; + } + + // 加上 rememberMe + if (vm?.vuex_remember) { + headers['x-remember'] = vm.vuex_remember; + } + console.log('request', headers); + uni.uploadFile({ + url, + filePath, + name, + formData, + header: headers, + fileType, + success: (res) => { + try { + const data = JSON.parse(res.data); + if (res.statusCode === 200) { + resolve(data); + } else { + reject(data); + } + } catch (e) { + reject(e); + } + }, + fail: (err) => { + reject(err); + } + }); + }); +} diff --git a/components/CarBindDialog.vue b/components/CarBindDialog.vue new file mode 100644 index 0000000..0cad77b --- /dev/null +++ b/components/CarBindDialog.vue @@ -0,0 +1,254 @@ + + + + + diff --git a/pages.json b/pages.json index 7098ad8..c019a3b 100644 --- a/pages.json +++ b/pages.json @@ -321,6 +321,12 @@ "style": { "navigationBarTitleText": "缴费记录" } + }, + { + "path": "pages/sys/user/myPayment/myCarCode", + "style": { + "navigationBarTitleText": "我的车牌" + } }, { "path": "pages/sys/user/myRepair/myRepair", @@ -407,5 +413,13 @@ "navigationBarTextStyle": "black", "navigationBarTitleText": "Aidex", "navigationBarBackgroundColor": "#ffffff" - } + }, + "easycom": { + "autoscan": true, + "custom": { + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + } + } + + } \ No newline at end of file diff --git a/pages/sys/user/myPayment/myCarCode.vue b/pages/sys/user/myPayment/myCarCode.vue new file mode 100644 index 0000000..04d255a --- /dev/null +++ b/pages/sys/user/myPayment/myCarCode.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/pages/sys/user/myVisitor/creatVisitor.vue b/pages/sys/user/myVisitor/creatVisitor.vue index 0e3e364..3519e0c 100644 --- a/pages/sys/user/myVisitor/creatVisitor.vue +++ b/pages/sys/user/myVisitor/creatVisitor.vue @@ -1,359 +1,402 @@ - - - - - \ No newline at end of file