diff --git a/api/global.js b/api/global.js deleted file mode 100644 index 02d7320..0000000 --- a/api/global.js +++ /dev/null @@ -1,9 +0,0 @@ -const baseURL = 'https://www.51xingka.net/LSMOIL/' -const token = '123456' -const userSite = '林花落了春红,太匆匆' - -export default { - baseURL, - token, - userSite -} \ No newline at end of file diff --git a/api/login.js b/api/login.js new file mode 100644 index 0000000..7db37aa --- /dev/null +++ b/api/login.js @@ -0,0 +1,14 @@ +import request from '@/utils/request' +const service_name = "identity-service" +const group_name = "oilUser" +export default { + loginWeixin (code) { + return request({ + url: `/${service_name}/${group_name}/loginWeixin`, + method: 'post', + data: { + code + } + }) + } +} diff --git a/api/unite.js b/api/unite.js deleted file mode 100644 index dc2abfc..0000000 --- a/api/unite.js +++ /dev/null @@ -1,10 +0,0 @@ -import request from '@/utils/request' -export default { - api (data) { - return request({ - url: '/lsm/api', - method: 'post', - data: data - }) - } -} diff --git a/api/weixin.js b/api/weixin.js deleted file mode 100644 index dbc86ba..0000000 --- a/api/weixin.js +++ /dev/null @@ -1,63 +0,0 @@ -import request from '@/utils/request' -const baseUrl = 'https://api.weixin.qq.com/sns/oauth2/authorize' -let scope = 'snsapi_base ' -const appId = '10037e6f6a4e6da4016a62a47e51000c' -let redirectUri = 'www.51xingka.net' -export default { - getmyCode () { - return request({ - url: `${baseUrl}?appid=${appId}&redirect_uri=${redirectUri}&response_type=code&scope=${scope}#wechat_redirect `, - method: 'get' - - }) - }, - getWeixinLocation (accessToken) { - return request({ - url: `https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=${accessToken}&type=jsapi`, - method: 'get' - }) - }, - // 获取微信accessToken - getToken (code, accountSource) { - return request({ - url: `/driver/loginWeixinOil`, - method: 'post', - data: { - code, - accountSource - } - }) - }, - login (data) { - return request({ - url: `/driver/loginAccount`, - method: 'post', - data: data - }) - }, - logout (data) { - return request({ - url: `/driver/logout`, - method: 'post', - data: data - }) - }, - loginAccountBySms (data) { - return request({ - url: `/driver/loginAccountBySms`, - method: 'post', - data: data - }) - }, - unifiedOrder (data) { - return request({ - url: `/pay/unifiedorder`, - method: 'post', - data: data, - headers: { - 'Content-Type': 'application/xml' - } - }) - } - -} diff --git a/main.js b/main.js index 562cbfe..4f5401a 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,6 @@ import Vue from 'vue' import App from './App' import cuCustom from './colorui/components/cu-custom.vue' import encode from '@/utils/encode' -import global from '@/api/global.js' Vue.component('cu-custom',cuCustom) Vue.config.productionTip = false diff --git a/package-lock.json b/package-lock.json index 1a3d64d..53e2839 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,65 +1,57 @@ { - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "axios": { - "version": "0.19.2", - "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.19.2.tgz", - "integrity": "sha1-PqNsXYgY0NX4qKl6bTa4bNwAyyc=", - "requires": { - "follow-redirects": "1.5.10" - } - }, - "crypto-js": { - "version": "4.0.0", - "resolved": "https://registry.npm.taobao.org/crypto-js/download/crypto-js-4.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcrypto-js%2Fdownload%2Fcrypto-js-4.0.0.tgz", - "integrity": "sha1-KQSrJnep0EKFai6i74DekuSjbcw=" - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", - "requires": { - "ms": "2.0.0" - } - }, - "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.10.tgz?cache=0&sync_timestamp=1592518530318&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.5.10.tgz", - "integrity": "sha1-e3qfmuov3/NnhqlP9kPtB/T/Xio=", - "requires": { - "debug": "=3.1.0" - } - }, - "js-base64": { - "version": "2.6.1", - "resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.6.1.tgz?cache=0&sync_timestamp=1592639177349&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-base64%2Fdownload%2Fjs-base64-2.6.1.tgz", - "integrity": "sha1-wyg3QiXS5lVpeR3tc8JY4sWTNMc=" - }, - "js-cookie": { - "version": "2.2.1", - "resolved": "https://registry.npm.taobao.org/js-cookie/download/js-cookie-2.2.1.tgz", - "integrity": "sha1-aeEG3F1YBolFYpAqpbrsN0Tpsrg=" - }, - "js-md5": { - "version": "0.7.3", - "resolved": "https://registry.npm.taobao.org/js-md5/download/js-md5-0.7.3.tgz", - "integrity": "sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I=" - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fms%2Fdownload%2Fms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "qs": { - "version": "6.9.4", - "resolved": "https://registry.npm.taobao.org/qs/download/qs-6.9.4.tgz", - "integrity": "sha1-kJCykNH5FyjTwi5UhDykSupatoc=" - }, - "vee-validate": { - "version": "3.3.6", - "resolved": "https://registry.npm.taobao.org/vee-validate/download/vee-validate-3.3.6.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvee-validate%2Fdownload%2Fvee-validate-3.3.6.tgz", - "integrity": "sha1-WswjNynfoFNW9MGX+y+nxpQzJGQ=" - } - } + "name": "lsm_oil_site", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npm.taobao.org/axios/download/axios-0.19.2.tgz?cache=0&sync_timestamp=1594827603723&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.19.2.tgz", + "integrity": "sha1-PqNsXYgY0NX4qKl6bTa4bNwAyyc=", + "requires": { + "follow-redirects": "1.5.10" + } + }, + "crypto-js": { + "version": "4.0.0", + "resolved": "https://registry.npm.taobao.org/crypto-js/download/crypto-js-4.0.0.tgz", + "integrity": "sha1-KQSrJnep0EKFai6i74DekuSjbcw=" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz", + "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.10.tgz?cache=0&sync_timestamp=1597057976909&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.5.10.tgz", + "integrity": "sha1-e3qfmuov3/NnhqlP9kPtB/T/Xio=", + "requires": { + "debug": "=3.1.0" + } + }, + "js-base64": { + "version": "2.6.1", + "resolved": "https://registry.npm.taobao.org/js-base64/download/js-base64-2.6.1.tgz?cache=0&sync_timestamp=1596920188035&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-base64%2Fdownload%2Fjs-base64-2.6.1.tgz", + "integrity": "sha1-wyg3QiXS5lVpeR3tc8JY4sWTNMc=" + }, + "js-cookie": { + "version": "2.2.1", + "resolved": "https://registry.npm.taobao.org/js-cookie/download/js-cookie-2.2.1.tgz", + "integrity": "sha1-aeEG3F1YBolFYpAqpbrsN0Tpsrg=" + }, + "js-md5": { + "version": "0.7.3", + "resolved": "https://registry.npm.taobao.org/js-md5/download/js-md5-0.7.3.tgz", + "integrity": "sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } } diff --git a/package.json b/package.json new file mode 100644 index 0000000..911e93c --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "lsm_oil_site", + "version": "1.0.0", + "description": "", + "main": "main.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "http://192.168.0.140:3000/xkhl/LSM_OIL_SITE.git" + }, + "author": "", + "license": "ISC", + "dependencies": { + "axios": "0.19.2", + "crypto-js": "4.0.0", + "js-base64": "2.6.1", + "js-cookie": "2.2.1", + "js-md5": "0.7.3" + } +} diff --git a/pages.json b/pages.json index f1a868a..9099d01 100644 --- a/pages.json +++ b/pages.json @@ -1,66 +1,16 @@ { "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages { - "path": "pages/station-info/station-info", - "style": {} - }, { + "path" : "pages/login/login", + "style" : {} + }, + { "path": "pages/index/index", "style": { "navigationBarTitleText": "星油" } - }, { - "path": "pages/qrcode/qrcodeList/qrcodeList", - "style": {} - }, { - "path": "pages/qrcode/QrCode_xy/QrCode_xy", - "style": {} - }, { - "path": "pages/authentication/authForm/authForm", - "style": {} - }, { - "path": "pages/stationList/stationDetail/stationDetail", - "style": { - "navigationBarTitleText": "中石化(紫云路)" - } - }, { - "path": "pages/stationList/stationList", - "style": { - "navigationBarTitleText": "附近油站" - } - }, - { - "path": "pages/login/login", - "style": {} } - - - - , { - "path": "pages/qrcode/QrCode-wjy/QrCode-wjy", - "style": {} - }, { - "path": "pages/authentication/facial/facial", - "style": {} - }, { - "path": "pages/authentication/fingerPrint/fingerPrint", - "style": {} - } - - , { - "path": "pages/userPage/userPage", - "style": {} - }, { - "path": "pages/wallet/record/record", - "style": {} - }, { - "path": "pages/order/orderList/orderList", - "style": {} - }, { - "path": "pages/orderList/orderList", - "style": {} - } - - ], + ], "globalStyle": { "mp-alipay": { /* 支付宝小程序特有相关 */ diff --git a/pages/authentication/authForm/authForm.vue b/pages/authentication/authForm/authForm.vue deleted file mode 100644 index 66f8fbb..0000000 --- a/pages/authentication/authForm/authForm.vue +++ /dev/null @@ -1,197 +0,0 @@ - - - - - diff --git a/pages/authentication/facial/facial.vue b/pages/authentication/facial/facial.vue deleted file mode 100644 index 7812c4d..0000000 --- a/pages/authentication/facial/facial.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - diff --git a/pages/authentication/fingerPrint/fingerPrint.vue b/pages/authentication/fingerPrint/fingerPrint.vue deleted file mode 100644 index 5630f80..0000000 --- a/pages/authentication/fingerPrint/fingerPrint.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/pages/index/index.vue b/pages/index/index.vue index 5b6d76c..a7593df 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -24,7 +24,7 @@ 89 - @@ -33,7 +33,7 @@ 1899.50 - @@ -41,7 +41,7 @@ - + {{ cuIconList[0].badge > 99 ? '99+' : cuIconList[0].badge }} @@ -49,7 +49,7 @@ {{ cuIconList[0].name }} - + {{ cuIconList[1].badge > 99 ? '99+' : cuIconList[1].badge }} @@ -57,7 +57,7 @@ {{ cuIconList[1].name }} - + {{ cuIconList[2].badge > 99 ? '99+' : cuIconList[2].badge }} @@ -89,52 +89,10 @@ {{ cuIconList[5].name }} - - @@ -185,20 +143,6 @@ }, onLoad() {}, methods: { - thirdAdd(){ - uni.chooseAddress({ - success(res) { - console.log(res.userName) - console.log(res.postalCode) - console.log(res.provinceName) - console.log(res.cityName) - console.log(res.countyName) - console.log(res.detailInfo) - console.log(res.nationalCode) - console.log(res.telNumber) - } - }) - }, scanQr(){ uni.scanCode({ onlyFromCamera: true, @@ -212,44 +156,6 @@ }) } }) - }, - copy() { - uni.setClipboardData({ - data: 'lallalala', - success() { - uni.showToast({ - title: '复制成功', - position: 'bottom', - icon: 'none' - }) - } - }) - }, - toAuth() { - uni.navigateTo({ - url: '/pages/authentication/authForm/authForm' - }) - }, - toQrcode() { - uni.navigateTo({ - url: '/pages/qrcode/qrcodeList/qrcodeList' - }); - }, - routerTo(url) { - uni.navigateTo({ - url: url - }); - }, - toLogin() { - uni.navigateTo({ - url: 'pages/login/login' - }); - }, - // 拨打电话 - makeCall() { - uni.makePhoneCall({ - phoneNumber: '4008-56-5355' //仅为示例 - }) } } }; diff --git a/pages/login/components/loginBottom.vue b/pages/login/components/loginBottom.vue deleted file mode 100644 index 02e82b9..0000000 --- a/pages/login/components/loginBottom.vue +++ /dev/null @@ -1,26 +0,0 @@ - - - - - diff --git a/pages/login/login.vue b/pages/login/login.vue index 440e95c..19d2bee 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,267 +1,33 @@ - + diff --git a/pages/order/orderList/orderList.vue b/pages/order/orderList/orderList.vue deleted file mode 100644 index bad16ed..0000000 --- a/pages/order/orderList/orderList.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - - - diff --git a/pages/orderList/orderList.vue b/pages/orderList/orderList.vue deleted file mode 100644 index bcfb80b..0000000 --- a/pages/orderList/orderList.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/pages/qrcode/QrCode-wjy/QrCode-wjy.vue b/pages/qrcode/QrCode-wjy/QrCode-wjy.vue deleted file mode 100644 index 67df5d0..0000000 --- a/pages/qrcode/QrCode-wjy/QrCode-wjy.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - diff --git a/pages/qrcode/QrCode_xy/QrCode_xy.vue b/pages/qrcode/QrCode_xy/QrCode_xy.vue deleted file mode 100644 index c76ea8b..0000000 --- a/pages/qrcode/QrCode_xy/QrCode_xy.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - - - diff --git a/pages/qrcode/qrcodeList/qrcodeList.vue b/pages/qrcode/qrcodeList/qrcodeList.vue deleted file mode 100644 index 58f3d3c..0000000 --- a/pages/qrcode/qrcodeList/qrcodeList.vue +++ /dev/null @@ -1,132 +0,0 @@ - - - - - diff --git a/pages/ssss.vue b/pages/ssss.vue deleted file mode 100644 index fea156c..0000000 --- a/pages/ssss.vue +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/pages/station-info/station-info.vue b/pages/station-info/station-info.vue deleted file mode 100644 index f5eaf96..0000000 --- a/pages/station-info/station-info.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/pages/stationList/components/PriceList.vue b/pages/stationList/components/PriceList.vue deleted file mode 100644 index 93e996f..0000000 --- a/pages/stationList/components/PriceList.vue +++ /dev/null @@ -1,80 +0,0 @@ - - - - - diff --git a/pages/stationList/components/StationItem.vue b/pages/stationList/components/StationItem.vue deleted file mode 100644 index 7b6e6fd..0000000 --- a/pages/stationList/components/StationItem.vue +++ /dev/null @@ -1,138 +0,0 @@ - - - - - diff --git a/pages/stationList/components/price-list.vue b/pages/stationList/components/price-list.vue deleted file mode 100644 index 6dd640a..0000000 --- a/pages/stationList/components/price-list.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/pages/stationList/stationDetail/stationDetail.vue b/pages/stationList/stationDetail/stationDetail.vue deleted file mode 100644 index 11c2b48..0000000 --- a/pages/stationList/stationDetail/stationDetail.vue +++ /dev/null @@ -1,205 +0,0 @@ - - - - - diff --git a/pages/stationList/stationList.vue b/pages/stationList/stationList.vue deleted file mode 100644 index 245b1c6..0000000 --- a/pages/stationList/stationList.vue +++ /dev/null @@ -1,128 +0,0 @@ - - - - - diff --git a/pages/userPage/userPage.vue b/pages/userPage/userPage.vue deleted file mode 100644 index 84b27f8..0000000 --- a/pages/userPage/userPage.vue +++ /dev/null @@ -1,104 +0,0 @@ - - - - - diff --git a/pages/wallet/record/record.vue b/pages/wallet/record/record.vue deleted file mode 100644 index ab9452b..0000000 --- a/pages/wallet/record/record.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - - diff --git a/utils/auth.js b/utils/auth.js deleted file mode 100644 index 4d1aa84..0000000 --- a/utils/auth.js +++ /dev/null @@ -1,15 +0,0 @@ -import Cookies from 'js-cookie' - -const TokenKey = 'token' - -export function getToken () { - return Cookies.get(TokenKey) -} - -export function setToken (token) { - return Cookies.set(TokenKey, token) -} - -export function removeToken () { - return Cookies.remove(TokenKey) -} diff --git a/utils/request.js b/utils/request.js index 1a81ad2..8cf038e 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,53 +1,39 @@ import axios from 'axios' import utils from '@/utils/encode' -import qs from 'qs' const service = axios.create({ - // #ifndef MP - baseURL: 'http://192.168.0.140:861', - // #endif - // #ifdef MP - baseURL: 'http://192.168.0.140:861', - // #endif + baseURL: 'http://192.168.0.142:48080', timeout: 5000 }) -let data = { - params: '', - serviceCode: '', - digest: '', - appkey: 'dirverAppAndroid' -} service.interceptors.request.use( config => { + const env = process.env.NODE_ENV + // 拦截请求 - console.log('发送请求', data) uni.showLoading({ title: '加载中...' }) const token = uni.getStorageSync('Authorization') config.headers['Authorization'] = token - if (config.method === 'post' && config.url.indexOf('/weixin') < 0 && config.url.indexOf('/api') >= 0) { - // 发送请求前,将参数加密,并生成密钥 - data.serviceCode = config.data.serviceCode - data.params = utils.encrypt(JSON.stringify(config.data)) - data.digest = utils.md5Salt(JSON.stringify(config.data)) - // console.log('参数:', data) - config.data = qs.stringify(data) + + if (env === 'production') { + // 生产环境,加密,不输出任何东西 + // 设置jsessionid和token + const JSESSIONID = utils.uuid() + config.headers['JSESSIONID'] = JSESSIONID + config.headers['token'] = utils.bcrypt(JSESSIONID) + if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) { + const data = { // 用于存储加密 + params: '' // 加密后的密文 + } + // 要加密 + data.params = utils.encrypt(JSON.stringify(config.data)) + config.data = data + } + } else { + console.log('请求路径', config.url, '参数加密前', config.data) } - if (config.method === 'post' && config.url.indexOf('/upload') >= 0) { - // 上传图片前压缩图片 - // compress() - // console.log(data.params) - // console.log('upload') - } - if (config.method === 'post' && config.url.indexOf('/weixin') >= 0) { - // 上传图片前压缩图片 - // compress() - // console.log(data.params) - // console.log('upload') - config.baseURL = 'http://192.168.0.140:8089' - } - console.log('请求参数:', config) + return config }, error => { @@ -63,24 +49,26 @@ service.interceptors.request.use( service.interceptors.response.use( response => { const res = response.data - uni.hideLoading() - if (res.code != '1000') { - // 操作不成功,返回错误信息 - if (res.code === 404) { - // 直接跳转到首页 - uni.reLaunch({ - url: '/pages/index/index' - }); - } else if (res.code === 'TOKEN-9999') { - // 登录过期,清除缓存 - uni.removeStorageSync("Authorization") - } else { - uni.showToast({ - title: res.msg, - icon: "none" - }) - return Promise.reject(error) + const env = process.env.NODE_ENV + + if (env === 'production') { + // 生产环境,进行加密解密,不输出日志 + if (res.encrypt === 1) { + // 加密的数据,需要解密 + const dataParam = JSON.parse(utils.decrypt(res.data)) + res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam } + } else { + console.log('请求路径', response.config.url, '返回结果未加密', res) + console.log('-------------------------------------------') + } + + uni.hideLoading() + if (res.code != 20000) { + uni.showToast({ + title: res.msg, + icon: "none" + }) } return res }, @@ -99,11 +87,9 @@ service.defaults.adapter = function(config) { return new Promise((resolve, reject) => { var settle = require('axios/lib/core/settle'); var buildURL = require('axios/lib/helpers/buildURL'); - var url = (config.url.indexOf('/weixin') < 0 && config.url.indexOf('/api') >= 0) ? (config.baseURL + buildURL( - config.url, config.params, config.paramsSerializer)) : config.baseWxURL uni.request({ method: config.method.toUpperCase(), - url: url, + url: config.baseURL + buildURL(config.url, config.params, config.paramsSerializer), header: config.headers, data: config.data, dataType: config.dataType,