Showing
7 changed files
with
143 additions
and
16 deletions
| ... | @@ -61,6 +61,8 @@ const config = { | ... | @@ -61,6 +61,8 @@ const config = { |
| 61 | "@/components": path.resolve(__dirname, "../src/components"), | 61 | "@/components": path.resolve(__dirname, "../src/components"), |
| 62 | "@/images": path.resolve(__dirname, "../src/assets/images"), | 62 | "@/images": path.resolve(__dirname, "../src/assets/images"), |
| 63 | "@/assets": path.resolve(__dirname, "../src/assets"), | 63 | "@/assets": path.resolve(__dirname, "../src/assets"), |
| 64 | + "@/composables": path.resolve(__dirname, "../src/composables"), | ||
| 65 | + "@/api": path.resolve(__dirname, "../src/api"), | ||
| 64 | }, | 66 | }, |
| 65 | sourceRoot: 'src', | 67 | sourceRoot: 'src', |
| 66 | outputRoot: 'dist', | 68 | outputRoot: 'dist', | ... | ... |
| ... | @@ -23,6 +23,7 @@ | ... | @@ -23,6 +23,7 @@ |
| 23 | "pinia": "^2.0.6", | 23 | "pinia": "^2.0.6", |
| 24 | "taro-plugin-pinia": "^1.0.0", | 24 | "taro-plugin-pinia": "^1.0.0", |
| 25 | "taro-ui-vue3": "^1.0.0-alpha.21", | 25 | "taro-ui-vue3": "^1.0.0-alpha.21", |
| 26 | + "uuid": "^9.0.0", | ||
| 26 | "vant": "^4.0.0-alpha.3", | 27 | "vant": "^4.0.0-alpha.3", |
| 27 | "vue": "^3.2.24" | 28 | "vue": "^3.2.24" |
| 28 | }, | 29 | }, |
| ... | @@ -16276,6 +16277,16 @@ | ... | @@ -16276,6 +16277,16 @@ |
| 16276 | "node": ">=0.8.0" | 16277 | "node": ">=0.8.0" |
| 16277 | } | 16278 | } |
| 16278 | }, | 16279 | }, |
| 16280 | + "node_modules/sockjs/node_modules/uuid": { | ||
| 16281 | + "version": "3.4.0", | ||
| 16282 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | ||
| 16283 | + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
| 16284 | + "devOptional": true, | ||
| 16285 | + "license": "MIT", | ||
| 16286 | + "bin": { | ||
| 16287 | + "uuid": "bin/uuid" | ||
| 16288 | + } | ||
| 16289 | + }, | ||
| 16279 | "node_modules/sockjs/node_modules/websocket-driver": { | 16290 | "node_modules/sockjs/node_modules/websocket-driver": { |
| 16280 | "version": "0.6.5", | 16291 | "version": "0.6.5", |
| 16281 | "resolved": "http://mirrors.tencent.com/npm/websocket-driver/-/websocket-driver-0.6.5.tgz", | 16292 | "resolved": "http://mirrors.tencent.com/npm/websocket-driver/-/websocket-driver-0.6.5.tgz", |
| ... | @@ -18376,13 +18387,12 @@ | ... | @@ -18376,13 +18387,12 @@ |
| 18376 | } | 18387 | } |
| 18377 | }, | 18388 | }, |
| 18378 | "node_modules/uuid": { | 18389 | "node_modules/uuid": { |
| 18379 | - "version": "3.4.0", | 18390 | + "version": "9.0.0", |
| 18380 | - "resolved": "https://mirrors.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | 18391 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz", |
| 18381 | - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | 18392 | + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", |
| 18382 | - "devOptional": true, | ||
| 18383 | "license": "MIT", | 18393 | "license": "MIT", |
| 18384 | "bin": { | 18394 | "bin": { |
| 18385 | - "uuid": "bin/uuid" | 18395 | + "uuid": "dist/bin/uuid" |
| 18386 | } | 18396 | } |
| 18387 | }, | 18397 | }, |
| 18388 | "node_modules/v8-compile-cache": { | 18398 | "node_modules/v8-compile-cache": { |
| ... | @@ -19105,6 +19115,16 @@ | ... | @@ -19105,6 +19115,16 @@ |
| 19105 | "node": ">= 6" | 19115 | "node": ">= 6" |
| 19106 | } | 19116 | } |
| 19107 | }, | 19117 | }, |
| 19118 | + "node_modules/webpack-log/node_modules/uuid": { | ||
| 19119 | + "version": "3.4.0", | ||
| 19120 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | ||
| 19121 | + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
| 19122 | + "devOptional": true, | ||
| 19123 | + "license": "MIT", | ||
| 19124 | + "bin": { | ||
| 19125 | + "uuid": "bin/uuid" | ||
| 19126 | + } | ||
| 19127 | + }, | ||
| 19108 | "node_modules/webpack-merge": { | 19128 | "node_modules/webpack-merge": { |
| 19109 | "version": "4.2.2", | 19129 | "version": "4.2.2", |
| 19110 | "resolved": "http://mirrors.tencent.com/npm/webpack-merge/-/webpack-merge-4.2.2.tgz", | 19130 | "resolved": "http://mirrors.tencent.com/npm/webpack-merge/-/webpack-merge-4.2.2.tgz", |
| ... | @@ -31087,6 +31107,12 @@ | ... | @@ -31087,6 +31107,12 @@ |
| 31087 | "websocket-driver": "0.6.5" | 31107 | "websocket-driver": "0.6.5" |
| 31088 | }, | 31108 | }, |
| 31089 | "dependencies": { | 31109 | "dependencies": { |
| 31110 | + "uuid": { | ||
| 31111 | + "version": "3.4.0", | ||
| 31112 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | ||
| 31113 | + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
| 31114 | + "devOptional": true | ||
| 31115 | + }, | ||
| 31090 | "websocket-driver": { | 31116 | "websocket-driver": { |
| 31091 | "version": "0.6.5", | 31117 | "version": "0.6.5", |
| 31092 | "resolved": "http://mirrors.tencent.com/npm/websocket-driver/-/websocket-driver-0.6.5.tgz", | 31118 | "resolved": "http://mirrors.tencent.com/npm/websocket-driver/-/websocket-driver-0.6.5.tgz", |
| ... | @@ -32639,10 +32665,9 @@ | ... | @@ -32639,10 +32665,9 @@ |
| 32639 | "devOptional": true | 32665 | "devOptional": true |
| 32640 | }, | 32666 | }, |
| 32641 | "uuid": { | 32667 | "uuid": { |
| 32642 | - "version": "3.4.0", | 32668 | + "version": "9.0.0", |
| 32643 | - "resolved": "https://mirrors.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | 32669 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz", |
| 32644 | - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | 32670 | + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" |
| 32645 | - "devOptional": true | ||
| 32646 | }, | 32671 | }, |
| 32647 | "v8-compile-cache": { | 32672 | "v8-compile-cache": { |
| 32648 | "version": "2.3.0", | 32673 | "version": "2.3.0", |
| ... | @@ -33210,6 +33235,14 @@ | ... | @@ -33210,6 +33235,14 @@ |
| 33210 | "requires": { | 33235 | "requires": { |
| 33211 | "ansi-colors": "^3.0.0", | 33236 | "ansi-colors": "^3.0.0", |
| 33212 | "uuid": "^3.3.2" | 33237 | "uuid": "^3.3.2" |
| 33238 | + }, | ||
| 33239 | + "dependencies": { | ||
| 33240 | + "uuid": { | ||
| 33241 | + "version": "3.4.0", | ||
| 33242 | + "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz", | ||
| 33243 | + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", | ||
| 33244 | + "devOptional": true | ||
| 33245 | + } | ||
| 33213 | } | 33246 | } |
| 33214 | }, | 33247 | }, |
| 33215 | "webpack-merge": { | 33248 | "webpack-merge": { | ... | ... |
| ... | @@ -48,6 +48,7 @@ | ... | @@ -48,6 +48,7 @@ |
| 48 | "pinia": "^2.0.6", | 48 | "pinia": "^2.0.6", |
| 49 | "taro-plugin-pinia": "^1.0.0", | 49 | "taro-plugin-pinia": "^1.0.0", |
| 50 | "taro-ui-vue3": "^1.0.0-alpha.21", | 50 | "taro-ui-vue3": "^1.0.0-alpha.21", |
| 51 | + "uuid": "^9.0.0", | ||
| 51 | "vant": "^4.0.0-alpha.3", | 52 | "vant": "^4.0.0-alpha.3", |
| 52 | "vue": "^3.2.24" | 53 | "vue": "^3.2.24" |
| 53 | }, | 54 | }, | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-05-18 22:56:08 | 2 | * @Date: 2022-05-18 22:56:08 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-14 17:33:20 | 4 | + * @LastEditTime: 2022-10-17 13:19:28 |
| 5 | * @FilePath: /swx/src/api/fn.js | 5 | * @FilePath: /swx/src/api/fn.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | -import axios from '../utils/request'; | 8 | +import axios from '@/utils/request'; |
| 9 | -import Toast from '../components/vant-weapp/toast/toast'; | 9 | +import Toast from '@/components/vant-weapp/toast/toast'; |
| 10 | import qs from 'Qs' | 10 | import qs from 'Qs' |
| 11 | 11 | ||
| 12 | /** | 12 | /** | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-14 17:36:27 | 4 | + * @LastEditTime: 2022-10-17 09:31:22 |
| 5 | * @FilePath: /swx/src/utils/request.js | 5 | * @FilePath: /swx/src/utils/request.js |
| 6 | * @Description: 简单axios封装,后续按实际处理 | 6 | * @Description: 简单axios封装,后续按实际处理 |
| 7 | */ | 7 | */ |
| ... | @@ -9,6 +9,9 @@ | ... | @@ -9,6 +9,9 @@ |
| 9 | import axios from 'axios-miniprogram'; | 9 | import axios from 'axios-miniprogram'; |
| 10 | import Taro from '@tarojs/taro' | 10 | import Taro from '@tarojs/taro' |
| 11 | import Toast from '../components/vant-weapp/toast/toast'; | 11 | import Toast from '../components/vant-weapp/toast/toast'; |
| 12 | +import { strExist } from './tools' | ||
| 13 | +import qs from 'Qs' | ||
| 14 | + | ||
| 12 | // import { ProgressStart, ProgressEnd } from '@/components/axios-progress/progress'; | 15 | // import { ProgressStart, ProgressEnd } from '@/components/axios-progress/progress'; |
| 13 | // import store from '@/store' | 16 | // import store from '@/store' |
| 14 | // import { getToken } from '@/utils/auth' | 17 | // import { getToken } from '@/utils/auth' |
| ... | @@ -29,7 +32,11 @@ service.interceptors.request.use( | ... | @@ -29,7 +32,11 @@ service.interceptors.request.use( |
| 29 | config => { | 32 | config => { |
| 30 | // console.warn(config) | 33 | // console.warn(config) |
| 31 | // console.warn(store) | 34 | // console.warn(store) |
| 32 | - | 35 | + /** |
| 36 | + * POST PHP需要修改数据格式 | ||
| 37 | + * 序列化POST请求时需要屏蔽上传相关接口,上传相关接口序列化后报错 | ||
| 38 | + */ | ||
| 39 | + config.data = config.method === 'post' && !strExist(['a=upload', 'upload.qiniup.com'], config.url) ? qs.stringify(config.data) : config.data; | ||
| 33 | return config | 40 | return config |
| 34 | }, | 41 | }, |
| 35 | error => { | 42 | error => { | ... | ... |
src/utils/tools.js
0 → 100644
| 1 | +/* | ||
| 2 | + * @Date: 2022-04-18 15:59:42 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2022-06-30 13:54:32 | ||
| 5 | + * @FilePath: /tswj/src/utils/tools.js | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | + */ | ||
| 8 | +import dayjs from 'dayjs'; | ||
| 9 | + | ||
| 10 | +// 格式化时间 | ||
| 11 | +const formatDate = (date) => { | ||
| 12 | + return dayjs(date).format('YYYY-MM-DD HH:mm'); | ||
| 13 | +}; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @description 判断浏览器属于平台 | ||
| 17 | + * @returns | ||
| 18 | + */ | ||
| 19 | +const wxInfo = () => { | ||
| 20 | + let u = navigator.userAgent; | ||
| 21 | + let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器 | ||
| 22 | + let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 | ||
| 23 | + let uAgent = navigator.userAgent.toLowerCase(); | ||
| 24 | + let isTable = (uAgent.match(/MicroMessenger/i) == 'micromessenger') ? true : false; | ||
| 25 | + return { | ||
| 26 | + isAndroid, | ||
| 27 | + isiOS, | ||
| 28 | + isTable | ||
| 29 | + }; | ||
| 30 | +}; | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * @description 判断多行省略文本 | ||
| 34 | + * @param {*} id 目标dom标签 | ||
| 35 | + * @returns | ||
| 36 | + */ | ||
| 37 | +const hasEllipsis = (id) => { | ||
| 38 | + let oDiv = document.getElementById(id); | ||
| 39 | + let flag = false; | ||
| 40 | + if (oDiv.scrollHeight > oDiv.clientHeight) { | ||
| 41 | + flag = true | ||
| 42 | + } | ||
| 43 | + return flag | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +/** | ||
| 47 | + * @description 解析URL参数 | ||
| 48 | + * @param {*} url | ||
| 49 | + * @returns | ||
| 50 | + */ | ||
| 51 | +const parseQueryString = url => { | ||
| 52 | + var json = {}; | ||
| 53 | + var arr = url.indexOf('?') >= 0 ? url.substr(url.indexOf('?') + 1).split('&') : []; | ||
| 54 | + arr.forEach(item => { | ||
| 55 | + var tmp = item.split('='); | ||
| 56 | + json[tmp[0]] = tmp[1]; | ||
| 57 | + }); | ||
| 58 | + return json; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +/** | ||
| 62 | + * 字符串包含字符数组中字符的状态 | ||
| 63 | + * @param {*} array 字符数组 | ||
| 64 | + * @param {*} str 字符串 | ||
| 65 | + * @returns 包含状态 | ||
| 66 | + */ | ||
| 67 | +const strExist = (array, str) => { | ||
| 68 | + const exist = array.filter(arr => { | ||
| 69 | + if (str.indexOf(arr) >= 0) return str; | ||
| 70 | + }) | ||
| 71 | + return exist.length > 0 | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +export { formatDate, wxInfo, hasEllipsis, parseQueryString, strExist }; |
| ... | @@ -10243,11 +10243,21 @@ | ... | @@ -10243,11 +10243,21 @@ |
| 10243 | "resolved" "http://mirrors.tencent.com/npm/utils-merge/-/utils-merge-1.0.1.tgz" | 10243 | "resolved" "http://mirrors.tencent.com/npm/utils-merge/-/utils-merge-1.0.1.tgz" |
| 10244 | "version" "1.0.1" | 10244 | "version" "1.0.1" |
| 10245 | 10245 | ||
| 10246 | -"uuid@^3.3.2", "uuid@^3.4.0": | 10246 | +"uuid@^3.3.2": |
| 10247 | "integrity" "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | 10247 | "integrity" "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" |
| 10248 | - "resolved" "https://mirrors.tencent.com/npm/uuid/-/uuid-3.4.0.tgz" | 10248 | + "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz" |
| 10249 | "version" "3.4.0" | 10249 | "version" "3.4.0" |
| 10250 | 10250 | ||
| 10251 | +"uuid@^3.4.0": | ||
| 10252 | + "integrity" "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" | ||
| 10253 | + "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz" | ||
| 10254 | + "version" "3.4.0" | ||
| 10255 | + | ||
| 10256 | +"uuid@^9.0.0": | ||
| 10257 | + "integrity" "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" | ||
| 10258 | + "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz" | ||
| 10259 | + "version" "9.0.0" | ||
| 10260 | + | ||
| 10251 | "v8-compile-cache@^2.0.3": | 10261 | "v8-compile-cache@^2.0.3": |
| 10252 | "integrity" "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" | 10262 | "integrity" "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" |
| 10253 | "resolved" "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" | 10263 | "resolved" "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" | ... | ... |
-
Please register or login to post a comment