diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..287bdf7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.vscode/settings.json +/unpackage/dist +/unpackage/cache +/unpackage/release +/unpackage/debug + +.vscode/ + +.DS_Store +/**/.DS_Store diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..ee5be77 --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,20 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "app-plus" : + { + "launchtype" : "local" + }, + "default" : + { + "launchtype" : "local" + }, + "mp-weixin" : + { + "launchtype" : "local" + }, + "type" : "uniCloud" + } + ] +} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..6f7972c --- /dev/null +++ b/App.vue @@ -0,0 +1,65 @@ + + + diff --git a/README copy.md b/README copy.md new file mode 100644 index 0000000..2d3dc96 --- /dev/null +++ b/README copy.md @@ -0,0 +1,3 @@ +# 飞鸟快印微信小程序 + +uni-app diff --git a/apis/addressApi.js b/apis/addressApi.js new file mode 100644 index 0000000..3a3f448 --- /dev/null +++ b/apis/addressApi.js @@ -0,0 +1,34 @@ +import http from '@/utils/http/index.js' + +/** + * 获取用户地址列表 + * @param {object} data 参数 userId + */ +export function getAddressList(data = {}) { + return http.get({ + url: `/wukong-fast-print/get/personal-shipping-address/list`, + data + }) +} + +/** + * 保存或修改用户地址列表 + * @param {object} data 参数 id + */ +export function changeAddress(data = {}) { + return http.post({ + url: `/wukong-fast-print/save/personal-shipping-address`, + data + }) +} + +/** + * 删除用户地址 + * @param {object} data 参数 id + */ +export function deleteAddress(data = {}) { + return http.post({ + url: `/wukong-fast-print/delete/my-address`, + data + }) +} diff --git a/apis/commonApi.js b/apis/commonApi.js new file mode 100644 index 0000000..46247d6 --- /dev/null +++ b/apis/commonApi.js @@ -0,0 +1,379 @@ +import http from '@/utils/http/index.js' +import store from '@/store/index' +import { XAPPID} from '@/enums/index.js' +import { wxAuthorize } from '@/apis/mineApi.js' + +let priceMap = null + +/** + * 获取价目表 + * @param {boolean} refresh 是否刷新 + * @returns + */ +export function getPriceMap(refresh = false) { + return new Promise((resolve) => { + if (!refresh && priceMap) { + resolve(priceMap) + } else { + http.get({ url: '/wukong-fast-print/get/printing/file/marked/price/by' }).then((res) => { + priceMap = res + resolve(res) + }) + } + }) +} + +let postageMap = null +/** + * 获取邮费 + * @param {boolean} refresh 是否刷新 + * @returns + */ +export function getPostagePrice(refresh = true, goodsId = '') { + return new Promise((resolve) => { + if (!refresh && postageMap) { + resolve(postageMap) + } else { + let data = { goodsId } + let params = goodsId ? { url: '/wukong-fast-print/get/postage/conditions', data } : { url: '/wukong-fast-print/get/postage/conditions' } + http.get(params).then((res) => { + postageMap = res + resolve(res) + }) + } + }) +} + +/** + * 获取OSS上传信息 + * @returns + */ +export function getOssInfo() { + return http.get({ + url: '/wukong-fast-print/getOssSign' + }) +} + +let loading = false +let resolveQueue = [] +let rejectQueue = [] +/** + * 获取用户tmpAuthToken和openId + * @return {Promise} + */ +export function getUserAccountInfo() { + if (loading) { + return new Promise((resolve, reject) => { + resolveQueue.push(resolve) + rejectQueue.push(reject) + }) + } + loading = true + return new Promise((resolve, reject) => { + uni.login({ + provider: 'weixin', + success: (loginRes) => { + let code = loginRes.code + getSession({ authCode: code }) + .then((res) => { + resolve(res) + resolveQueue.forEach((fn) => { + fn(res) + }) + }) + .catch((err) => { + reject(err) + rejectQueue.forEach((fn) => { + fn(err) + }) + }) + .finally(() => { + loading = false + resolveQueue = [] + rejectQueue = [] + }) + }, + fail: (err) => { + reject(err) + rejectQueue.forEach((fn) => { + fn(err) + }) + loading = false + resolveQueue = [] + rejectQueue = [] + } + }) + }) +} + +/** + * 获取微信小程序认证会话 + * @param {object} data 参数 authCode + */ +export function getSession(data = {}) { + return http.post( + { + url: `/uec/get/wechat-applet-session`, + data + }, + { hideLoading: true } + ) +} +// wx登陆生成器缓存 +let loginGenerator = {} +// wx会话缓存 +let session = {} +/** + * 微信小程序登陆 + * @param {object} data + * @returns {(login:Function,getSession:Function)} + */ +export function wxLoginGenerate() { + if (loginGenerator.login && loginGenerator.getSession) { + if (Date.now() > session.expireTime) { + loginGenerator.getSession() + } + return loginGenerator + } + let completed = false + function getSession() { + getUserAccountInfo() + .then(({ tmpAuthToken, openId, expireTime }) => { + expireTime = expireTime.replace(/-/g, '/') + store.commit('setOpenId', openId) + session = { tmpAuthToken, openId, expireTime: new Date(expireTime) } + completed = true + }) + .catch((err) => { + console.log(err) + completed = false + }) + } + getSession() + function login() { + return new Promise((resolve, reject) => { + if (!completed) { + reject('未获取到会话,请再次点击登陆') + return + } + if (Date.now() > session.expireTime) { + getSession() + reject('会话已失效,请再次点击登陆') + return + } + uni.getUserProfile({ + desc: '获取你的昵称、头像', + success: (res) => { + let iv = res.iv + let encryptedData = res.encryptedData + uni.showLoading({ + title: '加载中' + }) + wxAuthorize({ iv, encryptedData, tmpAuthToken: session.tmpAuthToken }) + .then((info) => { + let userInfo = { + name: res.userInfo.nickName, + userId: info.userId, + avatar: res.userInfo.avatarUrl, + mobile: '' + } + store.commit('setUserInfo', userInfo) + store.commit('setToken', info.token) + resolve(userInfo) + }) + .catch(() => { + reject('获取用户信息异常,请联系客服') + }) + .finally(() => { + uni.hideLoading() + }) + }, + fail: () => { + reject('请同意昵称和头像信息的授权') + } + }) + }) + } + loginGenerator = { login, getSession } + return loginGenerator +} + +/** + * 获取当前账号的企业实名认证地址 + * @param {object} data 参数 enterpriseId + */ +export function getVerifyUrl(data = {}) { + return http.post({ url: '/yyt-uec/get/fdd-enterprise-verify-url?enterpriseId=' + data.enterpriseId, data }) +} + +/** + * 生成担保合同的签约地址,同意纸盘商只需要签约一次即可 + * @param {object} data 参数 mallSupplierId + */ +export function getGuaranteeContract(data = {}) { + return http.post({ + url: `/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=${data.mallSupplierId}&customerEnterpriseId=${data.customerEnterpriseId}`, + data + }) +} + +/** + * 转换合同成图片 + * @param {object} data 图片地址链接 fileUrl + */ +export function transformFileToImg(data) { + return http.get({ + url: '/document/get/enterprise-documents/file-image-base64', + data: data + }) +} + +/** + * 获取快递列表 + * @param {object} data + */ +export function getPostageList(data) { + return http.get({ + url: '/wukong-fast-print/get/printing/express/type', + data: data + }) +} + +/** + * 获取网盘链接地址 + * @param {object} data + */ +export function getBandingLink(data) { + return http.get({ + url: '/uec/user/get/baidu-pan/authorize-page', + data: data + }) +} + +/** + * 获取当前账号企业的飞算额度 + * @param {object} data 参数 enterpriseId + */ +export function getFsCredit(data = {}) { + return http.get({ + url: '/yyt-uec/credit/get/enterprise-feisuan-credit', + data + }) +} + +/** + * 获取当前账号企业的被担保的月结额度 + * @param {object} data 参数 enterpriseId supplierId + */ +export function getMonthCredit(data = {}) { + return http.get({ url: '/yyt-uec/customer/get/supplier-credit', data }) +} + +/** + * 推送客户绑定 + * + */ +export function pushCustomerBind(cid, platformType = 'android', appId = XAPPID) { + return http.post({ + url: '/base-paper-trading/user/binding/geTui/cid', + data: { cid, appId, platformType } + }) +} + +/** + * 推送客户绑定 + * + */ +export function pushCustomerOff(cid, platformType = 'android', appId = XAPPID) { + return http.post({ + url: '/base-paper-trading/user/geTui/offline', + data: { cid, appId, platformType } + }) +} + +/** + * 营业执照OCR识别 photoUrl + */ +export function getLicenseOcr(data = {}) { + return http.post({ + url: '/base-paper-trading/ocr/business-license', + data: data + }) +} + +/** + * 身份证正面OCR识别 image + */ +export function getFrontIdCardOcr(data = {}) { + return http.post({ + url: '/base-paper-trading/ocr/id-card/face', + data: data + }) +} + +/** + * 飞鸟快印绑定代销商 + * @param {object} data storeUserId + */ +export function bindingStore(data = {}) { + return http.post( + { + url: '/wukong-fast-print/user/create/distribution-relation', + data: data + }, + { hideLoading: true } + ) +} + +/** + * 获取二维码绑定的userId + * @param {object} data host QrCodeRecordId + */ +export function getQrCodeRecordId(data = {}) { + return http.get( + { + url: '/uec/verify/qrcode', + data + }, + { hideLoading: true } + ) +} + +/** + * 获取半天妖客户经理列表 + * @param {object} data host QrCodeRecordId + */ +export function getBTAreaList() { + return http.get( + { + url: '/wukong-fast-print/get/ban/tian/yao/area/customer/manager/list' + }, + { hideLoading: true } + ) +} + +/** + * 获取活动海报 + */ +export function getPoster(data = {}) { + return http.get({ + url: '/uec/fission/get/poster', + data + }) +} + +/** + * 用户修改用户昵称和头像 + * @param {*} data + * @returns + */ +export function changeUserInfo(data = {}) { + return http.post({ + url: '/uec/user/update/user-info', + data: data + }) +} + +export function uploadAvatar(path) { + return http.uploadFile({ data: { filePath: path } }) +} diff --git a/apis/mineApi.js b/apis/mineApi.js new file mode 100644 index 0000000..9ee7ebf --- /dev/null +++ b/apis/mineApi.js @@ -0,0 +1,79 @@ +import http from '@/utils/http/index.js' + +/** + * 微信登录认证获取token + * @param {object} data 参数 encryptedData iv tmpAuthToken + */ +export function wxAuthorize(data = {}) { + return http.post({ + url: `/uec/authorize/by-wechat-applet/without-regest`, + data + }) +} + +/** + * 微信小程序静默登录 + * @param {object} data 参数 authCode + */ +export function silentLogin(data = {}) { + return http.post( + { + url: `/uec/authorize/by-wechat-applet/without-regest/unlogin`, + data + }, + { hideLoading: true } + ) +} + +/** + * 获取用户代理商状态 + * @param {object} data 参数 + */ +export function getStoreState(data = {}) { + return http.get( + { + url: `/wukong-fast-print/get/agency/shop/status`, + data + }, + { hideLoading: true } + ) +} + +/** + * 获取代理商佣金统计 + * @param {object} data 参数 + */ +export function getStoreStatistics(data = {}) { + return http.get( + { + url: `/wukong-fast-print/get/agency/commission/statistics`, + data + }, + { hideLoading: true } + ) +} + + +/** + * 提交店铺申请 + * @param {object} data 参数 + */ +export function makeStoreApplication(data = {}) { + return http.post({ + url: `/wukong-fast-print/submit/agency/store/apply`, + data + }) +} + +/** + * 获取代理商佣金统计 + * @param {object} data 参数 + */ + export function getPreferentialCardList(data = {}) { + return http.get( + { + url: `/wukong-fast-print/get/preferential/card/list`, + data + } + ) +} diff --git a/common/css/reset.scss b/common/css/reset.scss new file mode 100644 index 0000000..ae26b09 --- /dev/null +++ b/common/css/reset.scss @@ -0,0 +1,275 @@ +page { + font-size: $uni-font-size-base; + line-height: 1; + background-color: #f7f8fa; + -webkit-overflow-scrolling: touch; /* 使ios列表滑动流畅*/ +} +// 标签重置 +page, +view, +input, +text, +form, +navigator, +rich-text, +picker, +scroll-view, +cover-view, +open-data { + box-sizing: border-box; +} +rich-text, +open-data, +form { + display: block; +} + +view, +image, +text { + box-sizing: border-box; + flex-shrink: 0; +} +// flex快捷类 +.flex-row { + display: flex; + flex-direction: row; +} + +.flex-col { + display: flex; + flex-direction: column; +} + +.justify-start { + display: flex; + justify-content: flex-start; +} + +.justify-center { + display: flex; + justify-content: center; +} + +.justify-end { + display: flex; + justify-content: flex-end; +} + +.justify-evenly { + display: flex; + justify-content: space-evenly; +} + +.justify-around { + display: flex; + justify-content: space-around; +} + +.justify-between { + display: flex; + justify-content: space-between; +} + +.items-start { + display: flex; + align-items: flex-start; +} + +.items-center { + display: flex; + align-items: center; +} + +.items-end { + display: flex; + align-items: flex-end; +} +.text-ellipsis { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +cover-view { + line-height: 1.5; + white-space: normal; +} +// 隐藏滑动条 +*::webkit-scrollbar { + display: none; +} +// 重置按钮样式 +button::after { + border: 0; +} + +/* 清除浮动 */ +.clearfix:after { + content: '.'; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +// 两行省略号 +.u-line-2 { + -webkit-line-clamp: 2; + overflow: hidden; + word-break: break-all; + text-overflow: ellipsis; + display: -webkit-box; // 弹性伸缩盒 + -webkit-box-orient: vertical; // 设置伸缩盒子元素排列方式 +} + +// flex 快捷类 +.flex-row-start-start { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-start; +} +.flex-row-start-center { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: center; +} +.flex-row-start-end { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: flex-end; +} +.flex-row-start-space { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: space-between; +} +.flex-row-center-start { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; +} +.flex-row-center-center { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; +} +.flex-row-center-end { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-end; +} +.flex-row-center-space { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; +} +.flex-row-end-start { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: flex-start; +} +.flex-row-end-center { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: center; +} +.flex-row-end-end { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: flex-end; +} +.flex-row-end-space { + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: space-between; +} + +.flex-col-start-start { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; +} +.flex-col-start-center { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; +} +.flex-col-start-end { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-end; +} +.flex-col-start-space { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: space-between; +} +.flex-col-center-start { + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; +} +.flex-col-center-center { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +.flex-col-center-end { + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; +} +.flex-col-center-space { + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} +.flex-col-end-start { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: flex-start; +} +.flex-col-end-center { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: center; +} +.flex-col-end-end { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: flex-end; +} +.flex-col-end-space { + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: space-between; +} +// flex 快捷子类 +.flex-base { + flex-grow: 0; + flex-shrink: 0; +} diff --git a/components/qn-easyinput/qn-easyinput.vue b/components/qn-easyinput/qn-easyinput.vue new file mode 100644 index 0000000..984486c --- /dev/null +++ b/components/qn-easyinput/qn-easyinput.vue @@ -0,0 +1,501 @@ + + + + + diff --git a/components/qn-input-number/qn-input-number.vue b/components/qn-input-number/qn-input-number.vue new file mode 100644 index 0000000..353dfc6 --- /dev/null +++ b/components/qn-input-number/qn-input-number.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/components/qn-mask/qn-mask.vue b/components/qn-mask/qn-mask.vue new file mode 100644 index 0000000..98278f6 --- /dev/null +++ b/components/qn-mask/qn-mask.vue @@ -0,0 +1,95 @@ + + + + + diff --git a/components/scroll-list/images.js b/components/scroll-list/images.js new file mode 100644 index 0000000..ed8007a --- /dev/null +++ b/components/scroll-list/images.js @@ -0,0 +1,5 @@ +export default { + empty: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHoAAABoCAYAAAA+R+R0AAAG50lEQVR4Xu2df1PURhjHn71fOQ8ZsKIoWioWsHcOLU49O53OqbwDfQm+AugraN+B+grad1D7CkDPzrSeHbAM54+2YLHiyGAL43DclSTb2UgwQC7Zu01ySfbJPzdym2ef5/vJdzeX7KwE8JBCASJFlVgkIGhJLgIEjaAlUUCSMtHRCFoSBSQpEx2NoCVRQJIy0dEBgi5XqtOlYmEiwC53u0LQAalersxfBUhOA2gTpeLYTEDdIuighUbQQSsecH/vAJvHO0eb/wrS2Th0+wiezckAYAF9oLOZoOZsBO0jaBYaHe2zwGELj3N02Ij4lA+Ctgg7PTvbO3Hhwrr56ZPmHQuLv6MBgMFNqcocAPkOgN4oFQtnOkYkhh2H6masXFn4FoB8Qym5cflS/vsY6t2xkkIDmjk6qSrPgZIpAvpU6dL58Y6pEsOOQwM6htqGqiQEHSoc/iWDoP3TNlSREXSocPiXDIL2T9tQRUbQocLhXzII2j9tQxUZQYcKh3/JIGj/tA1VZGlAsydvaS1zk1JiPEMnhD7fTv73NXuJEioiPiUjBeifHiyM64TMJBKkK3com2Ja1rbqqq7TzQSlV7+6dH7OJ31DEzZ2oO89rF4jFCatChOAz0kikTt3diB5KKsYX23VG/B0cUWjul6jAL9a21MCty9fLNwJDSUPEokV6B3IP6TTSVXJZAznskNJp+B4Xw+YkM2/M9iraxvQ2FZ3pdyqN3RN0xOUwPU4wY4U6PKD6iQQuOZwgY9n0qme/PCHJJlMtO2Dueoi6Dplc3fTIZ0CzGkquT3xZf552x0FeGJkQN9/+Pg3SulYJp1SD2Xfu9Wq1WatDtmsAqNDA0ISPltagXq9AV25rG2czVpDVzUtAUDXVTVxIQqwIwH6fqU6RQFuDg70weDAsaYQ55/+BVuNbch/fBpEHP3o8RL0dndBfvh0075WXv8Diy9eAxC4XbpYmBK6sgI42TPQd39hq0MArnxx3vj08ihXqjNKJl0qfjrsOB6/WX8Lj//4GzKZtDEvt3PU6g3QNN2AfLS32zHEz7PPmLPLpWLBae12O2l4fo5noHcWq4MfC9IZ6J7u3JWxcx+5CsBgM7eJHAP9H7hCZvHZCLLxtnYXQYuobTm3FdAedckVRhrQbLhOJMgVO1V0nd71ahhH0FzXnWMjoaEbQePQLX4J4tDtqYZCjrZmEpabMU/VcQkmzRxt1cHvn1e8d90I2l4Bzxztp8B4MyauLoIW0FDKoVtAL9dTvXJ0vbENvy+9goH+I3D0iPNTL9ekZH1gwiNMu228Ar38cg2WV9bAeGZ+qq/ddHbPQ0cLS7g3AIIWF1SqOboVR2+8rUFPd85RYXS0+AW4JwKPo2cXluBwLgtDg8chlUzaZsADWtU0mH/yAti77fzwKce5HEEHDJrBqTz603i9yBYLjA6dsF008OZf9hrzJRztPQz5kYPvmhlcBpnFUzJpGPtkELJKumk1CDpg0Kw7BunZ0ivYrDUMR48MnTjgRjYczz9ZNu66zw7278ny9doGLC2vGpC7cooBudnIYJ6IoDsAmnXJIC0urxoL/tgxMnQS+vt69mTD2uwHaDqdNWSLCEeHTnJVgKC5ZOJvxDNHW6MZy3yWV22da9er6XS7C8MpSwTNz5CrZaugWVD2cMRpfuXq2KURgvZCRUuMdkB7nIJtOATtscoIWlxQqR6YiMu1NwI62mNF0dHigqKjBTQUcbSfCzXsSkLQHQLt59IrBC0A1e5UEUcjaBtF4zJHB7U8Gh3dYUcjaBcAcXG0tUwcumM8dCNoCR2NP68kcbTHtwuu4QL7HX2vUr1DgNwCoJOlYuG6a2b4UqMViVzbBgba3J6CAvx4uVhw2nDmQNLsZiyrpEsXx5x3PHCt1uMGUu544KZh+cHCHBCyTgHGtVTjTCs79r3fw+SYsSY7DIe0e5i4ic9272M79Jmfbu33f79zoXymZFJqVrHflajVmO22N3clogAbmkrGcVeidpVsct6Os1sa9j1O4X04AnPqNrkVBcgs6cDmaN8Ex8BcCiBoLpmi3whBR58hVwUImkum6DdC0NFnyFWBEOi9/9s5V39SNCoVx2ashVp12v+d2Y5Hy2bn8ojaNuid12yh3wOTRwQf2syYW2Ue1EmbOHghVKcBgEfL3bit5tw2aNYRz1XYakJxaB8rR8cBiEw1CDlaJqGiXiuCjjpBzvwRNKdQUW+GoKNOkDP/UIJ2WhbL6tq/F7i5opKzZk+bebkvuaeJ7QuGoAXVRdCCAuLp3ioQSkd7WyJGYwogaEmuAwSNoCVRQJIy0dEIWhIFJCkTHY2gJVFAkjLR0QhaEgUkKRMdjaAlUUCSMtHRkoD+H39JyZZ6zcs+AAAAAElFTkSuQmCC', + success: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC4wMSIvPjxwYXRoIGQ9Ik0xMCAyNEwyMCAzNEw0MCAxNCIgc3Ryb2tlPSIjMzAzMTMzIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==', + error: 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgdmlld0JveD0iMCAwIDQ4IDQ4IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC4wMSIvPjxwYXRoIGQ9Ik0xNCAxNEwzNCAzNCIgc3Ryb2tlPSIjMzAzMTMzIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0xNCAzNEwzNCAxNCIgc3Ryb2tlPSIjMzAzMTMzIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==' +} diff --git a/components/scroll-list/scroll-list.vue b/components/scroll-list/scroll-list.vue new file mode 100644 index 0000000..5555721 --- /dev/null +++ b/components/scroll-list/scroll-list.vue @@ -0,0 +1,696 @@ + + + + + diff --git a/enums/index.js b/enums/index.js new file mode 100644 index 0000000..f34481f --- /dev/null +++ b/enums/index.js @@ -0,0 +1,110 @@ +import env from '@/env/index.js' +const urlEnv = env === 'production' ? '' : `-${env}` + +export const XAPPID = '503258978847966413' + +// 统一支付接口 +export const PAY_URL = `https://api-client-psc${urlEnv}.qniao.cn/payment-settlement-center/pay` + +/** + * 上传地址 + */ +export const uploadUrl = { + image: `https://api-client-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/image`, + file: `https://api-client-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/file`, + // video: `https://api-client-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/file?type=mp4` + video: `https://api-client-yyt${urlEnv}.qniao.cn/yyt-uec/file-uploading/upload/video/file?type=mp4`, + printFile: `https://api-ops-yyt${urlEnv}.qniao.cn/wukong-fast-print/printing-file/upload/file` +} + +/** + * 文件类型 图片:1,视频:2 + */ +export const fileType = { + IMG: 1, + VIDEO: 2 +} + +/** + * 收货地址是否默认 1:默认 0:非默认 + */ +export const addressType = { + DEFAULT: true, + NOT_DEFAULT: false +} + +/** + * 支付方式 1:微信支付 2:月结支付 4:飞算支付 + */ +export const paymentMethodEnum = { + WECHAT_PAY: 1, + MONTHLY_PAY: 2, + FLY_PAY: 4 +} + +export const paymentMethodMap = { + [paymentMethodEnum.WECHAT_PAY]: '微信支付', + [paymentMethodEnum.MONTHLY_PAY]: '月结支付', + [paymentMethodEnum.FLY_PAY]: '飞算支付' +} + +/** + * 订单状态 0:全部 40001:待付款 40002:待确认 40003:生产中 40004:运输中 40005:已完成 40009:待揽收 40006:已取消 40007:退款中 + */ +export const orderStatus = { + ALL: 0, + WAIT_PAY: 40001, + WAIT_CONFIRM: 40002, + PRINTING: 40003, + TRANSPORTING: 40004, + COMPLETED: 40005, + WAIT_COLLECT: 40009, + CANCELLED: 40006, + REFUND: 40007, + REFUNDED: 40008 +} + +/** + * 订单全部状态 40001:待付款 40002:待确认 40003:生产中 40004:运输中 40005:已完成 40007:退款中 40008:已退款 40009:待揽收 40006:已取消 + */ +export const orderStatusMap = { + 40001: '待付款', + 40002: '待确认', + 40003: '生产中', + 40004: '运输中', + 40005: '已完成', + 40007: '退款中', + 40008: '已退款', + 40006: '已取消', + 40009: '待发货' +} +/** + * 物料状态 20003:已发货 20004:已完成 20005:已取消 + */ +export const suppliesOrderItemStatus = { + TRANSPORTING: 20003, + COMPLETED: 20004, + CANCEL: 20005 +} +/** + * 解决oss图片缓存问题 + */ +let images = { + 'service-bg': `https://qncloud.oss-cn-shenzhen.aliyuncs.com/wukong-printer-wx/service-bg.png` +} + +function splicingTimestamps(obj) { + for (let key in obj) { + obj[key] = obj[key] + `?timeStamp=${Date.now()}` + } + return obj +} + +export const imgStamp = Object.freeze(splicingTimestamps(images)) + +/** + * 全局事件key + */ +export const cacheKey = { + ORDER_PARAM: 'orderParam' // 订单列表查询参数参数 +} diff --git a/env/index.js b/env/index.js new file mode 100644 index 0000000..a0bfcb1 --- /dev/null +++ b/env/index.js @@ -0,0 +1,8 @@ +/** + * @description 唯一环境变量 + */ +const env = 'test' +// const env = 'dev' +// const env = 'production' + +export default env diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..a57f870 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./*"], + "/*": ["./*"] + }, + "target": "ES6" + }, + "include": ["./**/*"], + "exclude": ["./uni_modules"] +} diff --git a/main.js b/main.js new file mode 100644 index 0000000..1ec2ef8 --- /dev/null +++ b/main.js @@ -0,0 +1,29 @@ +import App from './App' +import store from './store' +import Vue from 'vue' +import { Monitor } from '@/utils/monitor/index' +import { XAPPID } from '@/enums/index.js' +import env from '@/env/index.js' +import vueWxRouter from '@/utils/vueWxRouter' + +const urlEnv = env === 'production' ? '' : `-${env}` +// # ifdef MP-WEIXIN +// const monitor = new Monitor({ +// url: `https://api-client-yyt${urlEnv}.qniao.cn/wukong-fast-print/vue/error/message`, +// timeout: 5000, +// method: 'POST', +// env, +// header: { 'X-APP-ID': XAPPID } +// }) +// monitor.init() +// # endif + +Vue.config.productionTip = false +// Vue.prototype.$store = store +App.mpType = 'app' +Vue.use(vueWxRouter) +const app = new Vue({ + ...App, + store +}) +app.$mount() diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..41605ef --- /dev/null +++ b/manifest.json @@ -0,0 +1,192 @@ +{ + "name" : "飞鸟快印", + "appid" : "__UNI__EBBA73E", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : 100, + "transformPx" : false, + "networkTimeout" : { + "request" : 6000 + }, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + "compatible" : { + "ignoreVersion" : true + }, + /* 模块配置 */ + "modules" : { + "iBeacon" : {}, + "Share" : {}, + "Payment" : {} + }, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "abiFilters" : [ "armeabi-v7a", "x86" ] + }, + /* ios打包配置 */ + "ios" : { + "privacyDescription" : { + "NSPhotoLibraryUsageDescription" : "该应用需要读取你的相册,以便为你编辑信息", + "NSPhotoLibraryAddUsageDescription" : "该应用需要读取你的相册,以便为你保存信息", + "NSCameraUsageDescription" : "该应用需要使用你的摄像头,以便为你编辑信息", + "NSLocationWhenInUseUsageDescription" : "该应用需要你的地理位置,以便为你提供当前位置附近印包厂信息", + "NSLocationAlwaysUsageDescription" : "该应用需要你的地理位置,以便为你提供当前位置附近印包厂信息", + "NSLocationAlwaysAndWhenInUseUsageDescription" : "该应用需要你的地理位置,以便为你提供当前位置附近印包厂信息" + }, + "idfa" : false + }, + /* SDK配置 */ + "sdkConfigs" : { + "maps" : { + "amap" : { + "appkey_ios" : "0182ee2a9fdd5fd3ef6a8bd5a2f98325", + "appkey_android" : "877848546f7f3717101a17c33e1d4df3" + } + }, + "payment" : { + "weixin" : { + "__platform__" : [ "ios", "android" ], + "appid" : "wx6c66084e2de41575", + "UniversalLinks" : "https://apple-app-yyt-printpackage.qniao.cn/" + } + }, + "ad" : {}, + "geolocation" : { + "amap" : { + "__platform__" : [ "ios", "android" ], + "appkey_ios" : "0182ee2a9fdd5fd3ef6a8bd5a2f98325", + "appkey_android" : "877848546f7f3717101a17c33e1d4df3" + } + }, + "share" : { + "weixin" : { + "appid" : "wx6c66084e2de41575", + "UniversalLinks" : "https://apple-app-yyt-printpackage.qniao.cn/" + } + }, + "push" : { + "unipush" : {} + } + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + }, + "splashscreen" : { + "androidStyle" : "default", + "iosStyle" : "common" + } + }, + "uniStatistics" : { + "enable" : true + }, + "nativePlugins" : {} + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "wx74a65d2467a4d8ab", + "setting" : { + "urlCheck" : false, + "minified" : true + }, + "usingComponents" : true, + "plugins" : { + "materialPlugin" : { + "version" : "1.0.5", + "provider" : "wx4d2deeab3aed6e5a" + }, + "live-player-plugin" : { + "version" : "1.3.5", + "provider" : "wx2b03c6e691cd7370" + } + }, + "permission" : {}, + "requiredPrivateInfos" : [ "chooseAddress" ], + "lazyCodeLoading" : "requiredComponents" + }, + "navigateToMiniProgramAppIDList" : [ "wx654ce96a7324e76f" ], + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "2", + "h5" : { + "router" : { + "mode" : "history" + }, + "devServer" : { + "port" : 9090 + } + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..39194ba --- /dev/null +++ b/package-lock.json @@ -0,0 +1,12 @@ +{ + "name": "canvas 生成海报", + "version": "3.2.2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "canvas 生成海报", + "version": "3.2.2" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..46a9d73 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "id": "hch-poster", + "name": "canvas 生成海报", + "version": "3.2.2", + "description": "分享弹窗,生成海报并支持保存,支持多端(H5,微信小程序,支付宝小程序,百度小程序,字节跳动小程序,QQ小程序)", + "keywords": [ + "分享", + "海报", + "自定义图片", + "小程序码", + "商城商品分享海报。" + ] +} \ No newline at end of file diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..ff84c3c --- /dev/null +++ b/pages.json @@ -0,0 +1,103 @@ +{ + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/mine/index", + "style": { + "navigationBarTitleText": "个人中心", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/address/index", + "style": { + "navigationBarTitleText": "我的地址", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/pay/index", + "style": { + "navigationBarTitleText": "支付", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/pay-result/index", + "style": { + "navigationBarTitleText": "支付结果", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/h5-view/index", + "style": { + "navigationBarTitleText": "统一的H5落地页", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/h5-page/index", + "style": { + "navigationBarTitleText": "飞鸟快印", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/login/index", + "style": { + "navigationBarTitleText": "登陆", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/page-view/index", + "style": { + "navigationBarTitleText": "飞鸟快印", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8", + "backgroundColorTop": "#FFFFFF" + }, + "tabBar": { + "color": "#888", + "selectedColor": "#007AFF", + "borderStyle": "white", + "backgroundColor": "#f9f9f9", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/imgs/tabbar/index-gray.png", + "selectedIconPath": "static/imgs/tabbar/index-blue.png", + "text": "首页" + }, + { + "pagePath": "pages/mine/index", + "iconPath": "static/imgs/tabbar/mine-gray.png", + "selectedIconPath": "static/imgs/tabbar/mine-blue.png", + "text": "我的" + } + ] + } +} diff --git a/pages/address/index.vue b/pages/address/index.vue new file mode 100644 index 0000000..809c70e --- /dev/null +++ b/pages/address/index.vue @@ -0,0 +1,313 @@ + + + + + diff --git a/pages/h5-page/index.vue b/pages/h5-page/index.vue new file mode 100644 index 0000000..25601a7 --- /dev/null +++ b/pages/h5-page/index.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/pages/h5-view/index.vue b/pages/h5-view/index.vue new file mode 100644 index 0000000..65b99bb --- /dev/null +++ b/pages/h5-view/index.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..7df7658 --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/pages/login/index.vue b/pages/login/index.vue new file mode 100644 index 0000000..36352ae --- /dev/null +++ b/pages/login/index.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/pages/mine/index.vue b/pages/mine/index.vue new file mode 100644 index 0000000..a98efa6 --- /dev/null +++ b/pages/mine/index.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/pages/page-view/index.vue b/pages/page-view/index.vue new file mode 100644 index 0000000..7d4b1d7 --- /dev/null +++ b/pages/page-view/index.vue @@ -0,0 +1,87 @@ + + + diff --git a/pages/pay-result/index.vue b/pages/pay-result/index.vue new file mode 100644 index 0000000..bb92b98 --- /dev/null +++ b/pages/pay-result/index.vue @@ -0,0 +1,114 @@ + + + + + diff --git a/pages/pay/components/FileItem.vue b/pages/pay/components/FileItem.vue new file mode 100644 index 0000000..c2619df --- /dev/null +++ b/pages/pay/components/FileItem.vue @@ -0,0 +1,151 @@ + + + + + diff --git a/pages/pay/components/OrderInfo.vue b/pages/pay/components/OrderInfo.vue new file mode 100644 index 0000000..4d48405 --- /dev/null +++ b/pages/pay/components/OrderInfo.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/pages/pay/components/OtherItem.vue b/pages/pay/components/OtherItem.vue new file mode 100644 index 0000000..beffe7b --- /dev/null +++ b/pages/pay/components/OtherItem.vue @@ -0,0 +1,454 @@ + + + + + diff --git a/pages/pay/components/officialAccountPopup.vue b/pages/pay/components/officialAccountPopup.vue new file mode 100644 index 0000000..87adf76 --- /dev/null +++ b/pages/pay/components/officialAccountPopup.vue @@ -0,0 +1,77 @@ + + + + \ No newline at end of file diff --git a/pages/pay/index.vue b/pages/pay/index.vue new file mode 100644 index 0000000..549e479 --- /dev/null +++ b/pages/pay/index.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..f47521d --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,20 @@ +module.exports = { + printWidth: 160, + semi: false, + vueIndentScriptAndStyle: true, + singleQuote: true, + endOfLine: 'lf', + tabWidth: 2, + useTabs: false, + quoteProps: 'preserve', + bracketSpacing: true, + trailingComma: 'none', + // 解决标签结尾 > 格式化到下一行的问题,htmlWhitespaceSensitivity不能为 strict + jsxBracketSameLine: false, + jsxSingleQuote: false, + arrowParens: 'always', + insertPragma: false, + requirePragma: false, + proseWrap: 'never', + htmlWhitespaceSensitivity: 'ignore' +} diff --git a/static/icon/iconfont.css b/static/icon/iconfont.css new file mode 100644 index 0000000..670320d --- /dev/null +++ b/static/icon/iconfont.css @@ -0,0 +1,25 @@ +@font-face { + font-family: "iconfont"; /* Project id 3120523 */ + src: url('/static/icon/iconfont.ttf') format('truetype'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-Less:before { + content: "\e734"; +} + +.icon-m_dow_arrow:before { + content: "\e600"; +} + +.icon-required:before { + content: "\e60e"; +} + diff --git a/static/icon/iconfont.ttf b/static/icon/iconfont.ttf new file mode 100644 index 0000000..b220aa9 Binary files /dev/null and b/static/icon/iconfont.ttf differ diff --git a/static/imgs/general/add-icon.png b/static/imgs/general/add-icon.png new file mode 100644 index 0000000..fc5705b Binary files /dev/null and b/static/imgs/general/add-icon.png differ diff --git a/static/imgs/general/baiduPan-icon.png b/static/imgs/general/baiduPan-icon.png new file mode 100644 index 0000000..b99dabc Binary files /dev/null and b/static/imgs/general/baiduPan-icon.png differ diff --git a/static/imgs/general/blue-arrow-down.png b/static/imgs/general/blue-arrow-down.png new file mode 100644 index 0000000..75235fe Binary files /dev/null and b/static/imgs/general/blue-arrow-down.png differ diff --git a/static/imgs/general/blue-plus-icon.png b/static/imgs/general/blue-plus-icon.png new file mode 100644 index 0000000..692632d Binary files /dev/null and b/static/imgs/general/blue-plus-icon.png differ diff --git a/static/imgs/general/camera-icon.png b/static/imgs/general/camera-icon.png new file mode 100644 index 0000000..9928853 Binary files /dev/null and b/static/imgs/general/camera-icon.png differ diff --git a/static/imgs/general/cart-icon.png b/static/imgs/general/cart-icon.png new file mode 100644 index 0000000..d7fc016 Binary files /dev/null and b/static/imgs/general/cart-icon.png differ diff --git a/static/imgs/general/close-circle-icon.png b/static/imgs/general/close-circle-icon.png new file mode 100644 index 0000000..752614b Binary files /dev/null and b/static/imgs/general/close-circle-icon.png differ diff --git a/static/imgs/general/close-icon.png b/static/imgs/general/close-icon.png new file mode 100644 index 0000000..d9db864 Binary files /dev/null and b/static/imgs/general/close-icon.png differ diff --git a/static/imgs/general/coupon-txt-icon.png b/static/imgs/general/coupon-txt-icon.png new file mode 100644 index 0000000..453ab13 Binary files /dev/null and b/static/imgs/general/coupon-txt-icon.png differ diff --git a/static/imgs/general/customer-service-icon.png b/static/imgs/general/customer-service-icon.png new file mode 100644 index 0000000..a0f110e Binary files /dev/null and b/static/imgs/general/customer-service-icon.png differ diff --git a/static/imgs/general/default-fn-logo.png b/static/imgs/general/default-fn-logo.png new file mode 100644 index 0000000..b7bcba0 Binary files /dev/null and b/static/imgs/general/default-fn-logo.png differ diff --git a/static/imgs/general/doc-icon.png b/static/imgs/general/doc-icon.png new file mode 100644 index 0000000..3d967de Binary files /dev/null and b/static/imgs/general/doc-icon.png differ diff --git a/static/imgs/general/down-act-icon.png b/static/imgs/general/down-act-icon.png new file mode 100644 index 0000000..a593af5 Binary files /dev/null and b/static/imgs/general/down-act-icon.png differ diff --git a/static/imgs/general/down-icon.png b/static/imgs/general/down-icon.png new file mode 100644 index 0000000..2533fcb Binary files /dev/null and b/static/imgs/general/down-icon.png differ diff --git a/static/imgs/general/down.png b/static/imgs/general/down.png new file mode 100644 index 0000000..7e635f8 Binary files /dev/null and b/static/imgs/general/down.png differ diff --git a/static/imgs/general/eye-icon.png b/static/imgs/general/eye-icon.png new file mode 100644 index 0000000..fb93d52 Binary files /dev/null and b/static/imgs/general/eye-icon.png differ diff --git a/static/imgs/general/folder-icon.png b/static/imgs/general/folder-icon.png new file mode 100644 index 0000000..d3a2de5 Binary files /dev/null and b/static/imgs/general/folder-icon.png differ diff --git a/static/imgs/general/gesture.png b/static/imgs/general/gesture.png new file mode 100644 index 0000000..fadbdf7 Binary files /dev/null and b/static/imgs/general/gesture.png differ diff --git a/static/imgs/general/hand-up-icon.gif b/static/imgs/general/hand-up-icon.gif new file mode 100644 index 0000000..cd6b3df Binary files /dev/null and b/static/imgs/general/hand-up-icon.gif differ diff --git a/static/imgs/general/jinShan-icon.png b/static/imgs/general/jinShan-icon.png new file mode 100644 index 0000000..0e7d6f8 Binary files /dev/null and b/static/imgs/general/jinShan-icon.png differ diff --git a/static/imgs/general/local-icon.png b/static/imgs/general/local-icon.png new file mode 100644 index 0000000..5ecdf87 Binary files /dev/null and b/static/imgs/general/local-icon.png differ diff --git a/static/imgs/general/logo-icon.png b/static/imgs/general/logo-icon.png new file mode 100644 index 0000000..77c1b88 Binary files /dev/null and b/static/imgs/general/logo-icon.png differ diff --git a/static/imgs/general/not-support-icon.png b/static/imgs/general/not-support-icon.png new file mode 100644 index 0000000..11ab81f Binary files /dev/null and b/static/imgs/general/not-support-icon.png differ diff --git a/static/imgs/general/order-success-icon.png b/static/imgs/general/order-success-icon.png new file mode 100644 index 0000000..3a22631 Binary files /dev/null and b/static/imgs/general/order-success-icon.png differ diff --git a/static/imgs/general/pdf-icon.png b/static/imgs/general/pdf-icon.png new file mode 100644 index 0000000..4dee5c2 Binary files /dev/null and b/static/imgs/general/pdf-icon.png differ diff --git a/static/imgs/general/plus-icon.png b/static/imgs/general/plus-icon.png new file mode 100644 index 0000000..c140a08 Binary files /dev/null and b/static/imgs/general/plus-icon.png differ diff --git a/static/imgs/general/ppt-icon.png b/static/imgs/general/ppt-icon.png new file mode 100644 index 0000000..54ada93 Binary files /dev/null and b/static/imgs/general/ppt-icon.png differ diff --git a/static/imgs/general/qn-txt.png b/static/imgs/general/qn-txt.png new file mode 100644 index 0000000..10afac9 Binary files /dev/null and b/static/imgs/general/qn-txt.png differ diff --git a/static/imgs/general/question-mask-icon.png b/static/imgs/general/question-mask-icon.png new file mode 100644 index 0000000..1ee1117 Binary files /dev/null and b/static/imgs/general/question-mask-icon.png differ diff --git a/static/imgs/general/reduce-icon.png b/static/imgs/general/reduce-icon.png new file mode 100644 index 0000000..53c7c39 Binary files /dev/null and b/static/imgs/general/reduce-icon.png differ diff --git a/static/imgs/general/right-arrow-blue.png b/static/imgs/general/right-arrow-blue.png new file mode 100644 index 0000000..7a40ef1 Binary files /dev/null and b/static/imgs/general/right-arrow-blue.png differ diff --git a/static/imgs/general/right-arrow.png b/static/imgs/general/right-arrow.png new file mode 100644 index 0000000..fb86b61 Binary files /dev/null and b/static/imgs/general/right-arrow.png differ diff --git a/static/imgs/general/select-icon-small.png b/static/imgs/general/select-icon-small.png new file mode 100644 index 0000000..d3da12c Binary files /dev/null and b/static/imgs/general/select-icon-small.png differ diff --git a/static/imgs/general/select-icon.png b/static/imgs/general/select-icon.png new file mode 100644 index 0000000..3339917 Binary files /dev/null and b/static/imgs/general/select-icon.png differ diff --git a/static/imgs/general/selected-icon-small.png b/static/imgs/general/selected-icon-small.png new file mode 100644 index 0000000..6dd4008 Binary files /dev/null and b/static/imgs/general/selected-icon-small.png differ diff --git a/static/imgs/general/selected-icon.png b/static/imgs/general/selected-icon.png new file mode 100644 index 0000000..39e37d4 Binary files /dev/null and b/static/imgs/general/selected-icon.png differ diff --git a/static/imgs/general/share.png b/static/imgs/general/share.png new file mode 100644 index 0000000..ab1f9b7 Binary files /dev/null and b/static/imgs/general/share.png differ diff --git a/static/imgs/general/tenCent-icon.png b/static/imgs/general/tenCent-icon.png new file mode 100644 index 0000000..3c52a74 Binary files /dev/null and b/static/imgs/general/tenCent-icon.png differ diff --git a/static/imgs/general/top-arrow-icon.png b/static/imgs/general/top-arrow-icon.png new file mode 100644 index 0000000..02ef740 Binary files /dev/null and b/static/imgs/general/top-arrow-icon.png differ diff --git a/static/imgs/general/txt-bg.png b/static/imgs/general/txt-bg.png new file mode 100644 index 0000000..dbf05a7 Binary files /dev/null and b/static/imgs/general/txt-bg.png differ diff --git a/static/imgs/general/up-act-icon.png b/static/imgs/general/up-act-icon.png new file mode 100644 index 0000000..b1f5e74 Binary files /dev/null and b/static/imgs/general/up-act-icon.png differ diff --git a/static/imgs/general/up-arrow-icon.png b/static/imgs/general/up-arrow-icon.png new file mode 100644 index 0000000..105bb4c Binary files /dev/null and b/static/imgs/general/up-arrow-icon.png differ diff --git a/static/imgs/general/up-icon.png b/static/imgs/general/up-icon.png new file mode 100644 index 0000000..b96d10f Binary files /dev/null and b/static/imgs/general/up-icon.png differ diff --git a/static/imgs/general/upload-tip.png b/static/imgs/general/upload-tip.png new file mode 100644 index 0000000..4cb9b49 Binary files /dev/null and b/static/imgs/general/upload-tip.png differ diff --git a/static/imgs/general/uploading.gif b/static/imgs/general/uploading.gif new file mode 100644 index 0000000..3d42386 Binary files /dev/null and b/static/imgs/general/uploading.gif differ diff --git a/static/imgs/general/wx-icon.png b/static/imgs/general/wx-icon.png new file mode 100644 index 0000000..d3e3f8c Binary files /dev/null and b/static/imgs/general/wx-icon.png differ diff --git a/static/imgs/index/customer-service-icon.png b/static/imgs/index/customer-service-icon.png new file mode 100644 index 0000000..8185565 Binary files /dev/null and b/static/imgs/index/customer-service-icon.png differ diff --git a/static/imgs/index/horn-icon.png b/static/imgs/index/horn-icon.png new file mode 100644 index 0000000..0939ce5 Binary files /dev/null and b/static/imgs/index/horn-icon.png differ diff --git a/static/imgs/index/hot-icon.gif b/static/imgs/index/hot-icon.gif new file mode 100644 index 0000000..12c97c5 Binary files /dev/null and b/static/imgs/index/hot-icon.gif differ diff --git a/static/imgs/index/index-community-icon.png b/static/imgs/index/index-community-icon.png new file mode 100644 index 0000000..b879995 Binary files /dev/null and b/static/imgs/index/index-community-icon.png differ diff --git a/static/imgs/index/index-coupon-icon.png b/static/imgs/index/index-coupon-icon.png new file mode 100644 index 0000000..bcd62aa Binary files /dev/null and b/static/imgs/index/index-coupon-icon.png differ diff --git a/static/imgs/index/index-library-icon.png b/static/imgs/index/index-library-icon.png new file mode 100644 index 0000000..964b691 Binary files /dev/null and b/static/imgs/index/index-library-icon.png differ diff --git a/static/imgs/index/index-luck-draw-icon.png b/static/imgs/index/index-luck-draw-icon.png new file mode 100644 index 0000000..36602ca Binary files /dev/null and b/static/imgs/index/index-luck-draw-icon.png differ diff --git a/static/imgs/index/index-sign-in-icon.png b/static/imgs/index/index-sign-in-icon.png new file mode 100644 index 0000000..4aae23f Binary files /dev/null and b/static/imgs/index/index-sign-in-icon.png differ diff --git a/static/imgs/index/send-icon.gif b/static/imgs/index/send-icon.gif new file mode 100644 index 0000000..a2024b0 Binary files /dev/null and b/static/imgs/index/send-icon.gif differ diff --git a/static/imgs/tabbar/category-blue.png b/static/imgs/tabbar/category-blue.png new file mode 100644 index 0000000..f43a181 Binary files /dev/null and b/static/imgs/tabbar/category-blue.png differ diff --git a/static/imgs/tabbar/category-gray.png b/static/imgs/tabbar/category-gray.png new file mode 100644 index 0000000..fcd58df Binary files /dev/null and b/static/imgs/tabbar/category-gray.png differ diff --git a/static/imgs/tabbar/index-blue.png b/static/imgs/tabbar/index-blue.png new file mode 100644 index 0000000..edc9af2 Binary files /dev/null and b/static/imgs/tabbar/index-blue.png differ diff --git a/static/imgs/tabbar/index-gray.png b/static/imgs/tabbar/index-gray.png new file mode 100644 index 0000000..07fe841 Binary files /dev/null and b/static/imgs/tabbar/index-gray.png differ diff --git a/static/imgs/tabbar/mine-blue.png b/static/imgs/tabbar/mine-blue.png new file mode 100644 index 0000000..f893dcf Binary files /dev/null and b/static/imgs/tabbar/mine-blue.png differ diff --git a/static/imgs/tabbar/mine-gray.png b/static/imgs/tabbar/mine-gray.png new file mode 100644 index 0000000..c6c94fb Binary files /dev/null and b/static/imgs/tabbar/mine-gray.png differ diff --git a/static/imgs/tabbar/order-blue.png b/static/imgs/tabbar/order-blue.png new file mode 100644 index 0000000..019a51d Binary files /dev/null and b/static/imgs/tabbar/order-blue.png differ diff --git a/static/imgs/tabbar/order-gray.png b/static/imgs/tabbar/order-gray.png new file mode 100644 index 0000000..73197d1 Binary files /dev/null and b/static/imgs/tabbar/order-gray.png differ diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..7699207 --- /dev/null +++ b/store/index.js @@ -0,0 +1,163 @@ +import Vue from 'vue' +import Vuex from 'vuex' +import { isObject, isArray } from '@/utils/is' + +let qnToken = null, + /** + * @value avatar 头像 + * @value name 用户名 + * @value userId 用户id + * @value mobile 手机号 + */ + userInfo = null, + openId = null +const userInfoParams = ['name', 'userId', 'mobile', 'avatar'] +try { + openId = uni.getStorageSync('openId') + qnToken = uni.getStorageSync('qnToken') + userInfo = uni.getStorageSync('userInfo') + if (userInfo) { + userInfo = JSON.parse(userInfo) + } +} catch (e) { + console.warn('初始化错误:', e) +} + +Vue.use(Vuex) +let store = null +if (!store) { + store = new Vuex.Store({ + state: { + openId: openId || '', + qnToken: qnToken || '', // token + userInfo: userInfo || {}, // 用户信息 + nextPage: { + name: '', + data: {} + }, + /** + * 监听cache的type即可,每次取值后都必须调用commit('resetCache') + */ + cache: { + type: 'none', + data: null + } + }, + mutations: { + setCache(state, { type, data }) { + state.cache.type = type + state.cache.data = data + }, + resetCache(state) { + state.cache.type = 'none' + state.cache.data = null + }, + setOpenId(state, token) { + try { + uni.setStorageSync('openId', token) + state.openId = token + } catch (e) { + console.warn('更改openId失败:', e) + } + }, + removeOpenId(state) { + try { + uni.removeStorageSync('openId') + state.openId = '' + } catch (e) { + console.warn('删除openId失败:', e) + } + }, + setToken(state, token) { + try { + uni.setStorageSync('qnToken', token) + console.log('设置token成功') + state.qnToken = token + } catch (e) { + console.warn('更改token失败:', e) + } + }, + removeToken(state) { + try { + uni.removeStorageSync('qnToken') + console.log('删除token') + state.qnToken = '' + } catch (e) { + console.warn('删除token失败:', e) + } + }, + setUserInfo(state, userInfo) { + if (!isObject(userInfo)) { + console.warn('userInfo必须是对象') + return + } + for (let param of userInfoParams) { + if (userInfo[param] === undefined) { + console.warn('userInfo必须包含' + param + '属性') + return + } + } + try { + uni.setStorageSync('userInfo', JSON.stringify(userInfo)) + state.userInfo = userInfo + } catch (e) { + console.warn('设置userInfo失败:', e) + } + }, + /** + * 更改当前用户信息 + * @param {*} state 状态 + * @param {arr} map 以key-value形式存储的数组 + * @value key 需要更改的key + * @value value 更改后的值 + */ + changeUserInfo(state, map) { + if (!isArray(map)) { + console.warn('map必须是数组') + return + } + let userInfo = state.userInfo + map.forEach((item) => { + if (userInfoParams.includes(item.key)) { + userInfo[item.key] = item.value + } + }) + try { + uni.setStorageSync('userInfo', JSON.stringify(userInfo)) + state.userInfo = userInfo + } catch (e) { + console.warn('更改userInfo失败:', e) + } + }, + removeUserInfo(state) { + try { + uni.removeStorageSync('userInfo') + state.userInfo = {} + } catch (e) { + console.warn('删除userInfo失败:', e) + } + }, + setNextPage(state, nextPage) { + if (!isObject(nextPage)) { + console.warn('nextPage必须是对象') + return + } + state.nextPage.name = nextPage.name || '' + state.nextPage.data = nextPage.data || {} + }, + removeNextPage(state) { + state.nextPage.name = '' + state.nextPage.data = {} + } + }, + actions: { + logout({ commit }) { + commit('removeOpenId') + commit('removeToken') + commit('removeUserInfo') + } + } + }) +} + +export default store diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..b8a3d5b --- /dev/null +++ b/uni.scss @@ -0,0 +1,77 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ +$uni-btn-color: #007aff; + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #0b0f0c; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color: #333; //基本色 +$uni-text-color-inverse: #fff; //反色 +$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable: #c0c0c0; + +/* 背景颜色 */ +$uni-bg-color: #fff; +$uni-bg-color-grey: #f8f8f8; +$uni-bg-color-hover: #f1f1f1; //点击状态颜色 +$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色 + +/* 边框颜色 */ +$uni-border-color: #c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm: 24rpx; +$uni-font-size-base: 28rpx; +$uni-font-size-lg: 32rpx; + +/* 图片尺寸 */ +$uni-img-size-sm: 40rpx; +$uni-img-size-base: 52rpx; +$uni-img-size-lg: 80rpx; + +/* Border Radius */ +$uni-border-radius-sm: 4rpx; +$uni-border-radius-base: 6rpx; +$uni-border-radius-lg: 12rpx; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 10px; +$uni-spacing-row-base: 20rpx; +$uni-spacing-row-lg: 30rpx; + +/* 垂直间距 */ +$uni-spacing-col-sm: 8rpx; +$uni-spacing-col-base: 16rpx; +$uni-spacing-col-lg: 24rpx; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2c405a; // 文章标题颜色 +$uni-font-size-title: 40rpx; +$uni-color-subtitle: #555; // 二级标题颜色 +$uni-font-size-subtitle: 36rpx; +$uni-color-paragraph: #3f536e; // 文章段落颜色 +$uni-font-size-paragraph: 30rpx; diff --git a/uni_modules/uni-badge/changelog.md b/uni_modules/uni-badge/changelog.md new file mode 100644 index 0000000..544ecc1 --- /dev/null +++ b/uni_modules/uni-badge/changelog.md @@ -0,0 +1,29 @@ +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge) +## 1.1.7(2021-11-08) +- 优化 升级ui +- 修改 size 属性默认值调整为 small +- 修改 type 属性,默认值调整为 error,info 替换 default +## 1.1.6(2021-09-22) +- 修复 在字节小程序上样式不生效的 bug +## 1.1.5(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.4(2021-07-29) +- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性 +## 1.1.3(2021-06-24) +- 优化 示例项目 +## 1.1.1(2021-05-12) +- 新增 组件示例地址 +## 1.1.0(2021-05-12) +- 新增 uni-badge 的 absolute 属性,支持定位 +- 新增 uni-badge 的 offset 属性,支持定位偏移 +- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 +- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ +- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 +## 1.0.7(2021-05-07) +- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug +- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug +- 新增 uni-badge 属性 custom-style, 支持自定义样式 +## 1.0.6(2021-02-04) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-badge/components/uni-badge/uni-badge.vue b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue new file mode 100644 index 0000000..1981b4e --- /dev/null +++ b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue @@ -0,0 +1,268 @@ + + + + + diff --git a/uni_modules/uni-badge/package.json b/uni_modules/uni-badge/package.json new file mode 100644 index 0000000..7ba6d2f --- /dev/null +++ b/uni_modules/uni-badge/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-badge", + "displayName": "uni-badge 数字角标", + "version": "1.2.0", + "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", + "keywords": [ + "", + "badge", + "uni-ui", + "uniui", + "数字角标", + "徽章" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-badge/readme.md b/uni_modules/uni-badge/readme.md new file mode 100644 index 0000000..bdf175d --- /dev/null +++ b/uni_modules/uni-badge/readme.md @@ -0,0 +1,10 @@ +## Badge 数字角标 +> **组件名:uni-badge** +> 代码块: `uBadge` + +数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景, + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-badge) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-data-select/changelog.md b/uni_modules/uni-data-select/changelog.md new file mode 100644 index 0000000..61e1edc --- /dev/null +++ b/uni_modules/uni-data-select/changelog.md @@ -0,0 +1,10 @@ +## 0.1.3(2022-06-02) +- 修复 localdata 赋值不生效的 bug +- 新增 支持 uni.scss 修改颜色 +- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用) +## 0.1.2(2022-05-08) +- 修复 当 value 为 0 时选择不生效的 bug +## 0.1.1(2022-05-07) +- 新增 记住上次的选项(仅 collection 存在时有效) +## 0.1.0(2022-04-22) +- 初始化 diff --git a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue new file mode 100644 index 0000000..3c53ca4 --- /dev/null +++ b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue @@ -0,0 +1,420 @@ + + + + + diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json new file mode 100644 index 0000000..2a31eef --- /dev/null +++ b/uni_modules/uni-data-select/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-data-select", + "displayName": "uni-data-select 下拉框选择器", + "version": "0.1.3", + "description": "通过数据驱动的下拉框选择器", + "keywords": [ + "uni-ui", + "select", + "uni-data-select", + "下拉框", + "下拉选" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.1" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-load-more"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "u", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-data-select/readme.md b/uni_modules/uni-data-select/readme.md new file mode 100644 index 0000000..eb58de3 --- /dev/null +++ b/uni_modules/uni-data-select/readme.md @@ -0,0 +1,8 @@ +## DataSelect 下拉框选择器 +> **组件名:uni-data-select** +> 代码块: `uDataSelect` + +当选项过多时,使用下拉菜单展示并选择内容 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-icons/changelog.md b/uni_modules/uni-icons/changelog.md new file mode 100644 index 0000000..6449885 --- /dev/null +++ b/uni_modules/uni-icons/changelog.md @@ -0,0 +1,22 @@ +## 1.3.5(2022-01-24) +- 优化 size 属性可以传入不带单位的字符串数值 +## 1.3.4(2022-01-24) +- 优化 size 支持其他单位 +## 1.3.3(2022-01-17) +- 修复 nvue 有些图标不显示的bug,兼容老版本图标 +## 1.3.2(2021-12-01) +- 优化 示例可复制图标名称 +## 1.3.1(2021-11-23) +- 优化 兼容旧组件 type 值 +## 1.3.0(2021-11-19) +- 新增 更多图标 +- 优化 自定义图标使用方式 +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons) +## 1.1.7(2021-11-08) +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.5(2021-05-12) +- 新增 组件示例地址 +## 1.1.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-icons/components/uni-icons/icons.js b/uni_modules/uni-icons/components/uni-icons/icons.js new file mode 100644 index 0000000..7889936 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/icons.js @@ -0,0 +1,1169 @@ +export default { + "id": "2852637", + "name": "uniui图标库", + "font_family": "uniicons", + "css_prefix_text": "uniui-", + "description": "", + "glyphs": [ + { + "icon_id": "25027049", + "name": "yanse", + "font_class": "color", + "unicode": "e6cf", + "unicode_decimal": 59087 + }, + { + "icon_id": "25027048", + "name": "wallet", + "font_class": "wallet", + "unicode": "e6b1", + "unicode_decimal": 59057 + }, + { + "icon_id": "25015720", + "name": "settings-filled", + "font_class": "settings-filled", + "unicode": "e6ce", + "unicode_decimal": 59086 + }, + { + "icon_id": "25015434", + "name": "shimingrenzheng-filled", + "font_class": "auth-filled", + "unicode": "e6cc", + "unicode_decimal": 59084 + }, + { + "icon_id": "24934246", + "name": "shop-filled", + "font_class": "shop-filled", + "unicode": "e6cd", + "unicode_decimal": 59085 + }, + { + "icon_id": "24934159", + "name": "staff-filled-01", + "font_class": "staff-filled", + "unicode": "e6cb", + "unicode_decimal": 59083 + }, + { + "icon_id": "24932461", + "name": "VIP-filled", + "font_class": "vip-filled", + "unicode": "e6c6", + "unicode_decimal": 59078 + }, + { + "icon_id": "24932462", + "name": "plus_circle_fill", + "font_class": "plus-filled", + "unicode": "e6c7", + "unicode_decimal": 59079 + }, + { + "icon_id": "24932463", + "name": "folder_add-filled", + "font_class": "folder-add-filled", + "unicode": "e6c8", + "unicode_decimal": 59080 + }, + { + "icon_id": "24932464", + "name": "yanse-filled", + "font_class": "color-filled", + "unicode": "e6c9", + "unicode_decimal": 59081 + }, + { + "icon_id": "24932465", + "name": "tune-filled", + "font_class": "tune-filled", + "unicode": "e6ca", + "unicode_decimal": 59082 + }, + { + "icon_id": "24932455", + "name": "a-rilidaka-filled", + "font_class": "calendar-filled", + "unicode": "e6c0", + "unicode_decimal": 59072 + }, + { + "icon_id": "24932456", + "name": "notification-filled", + "font_class": "notification-filled", + "unicode": "e6c1", + "unicode_decimal": 59073 + }, + { + "icon_id": "24932457", + "name": "wallet-filled", + "font_class": "wallet-filled", + "unicode": "e6c2", + "unicode_decimal": 59074 + }, + { + "icon_id": "24932458", + "name": "paihangbang-filled", + "font_class": "medal-filled", + "unicode": "e6c3", + "unicode_decimal": 59075 + }, + { + "icon_id": "24932459", + "name": "gift-filled", + "font_class": "gift-filled", + "unicode": "e6c4", + "unicode_decimal": 59076 + }, + { + "icon_id": "24932460", + "name": "fire-filled", + "font_class": "fire-filled", + "unicode": "e6c5", + "unicode_decimal": 59077 + }, + { + "icon_id": "24928001", + "name": "refreshempty", + "font_class": "refreshempty", + "unicode": "e6bf", + "unicode_decimal": 59071 + }, + { + "icon_id": "24926853", + "name": "location-ellipse", + "font_class": "location-filled", + "unicode": "e6af", + "unicode_decimal": 59055 + }, + { + "icon_id": "24926735", + "name": "person-filled", + "font_class": "person-filled", + "unicode": "e69d", + "unicode_decimal": 59037 + }, + { + "icon_id": "24926703", + "name": "personadd-filled", + "font_class": "personadd-filled", + "unicode": "e698", + "unicode_decimal": 59032 + }, + { + "icon_id": "24923351", + "name": "back", + "font_class": "back", + "unicode": "e6b9", + "unicode_decimal": 59065 + }, + { + "icon_id": "24923352", + "name": "forward", + "font_class": "forward", + "unicode": "e6ba", + "unicode_decimal": 59066 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrow-right", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrowthinright", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrow-left", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrowthinleft", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrow-up", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrowthinup", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrow-down", + "unicode": "e6be", + "unicode_decimal": 59070 + },{ + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrowthindown", + "unicode": "e6be", + "unicode_decimal": 59070 + }, + { + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "bottom", + "unicode": "e6b8", + "unicode_decimal": 59064 + },{ + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "arrowdown", + "unicode": "e6b8", + "unicode_decimal": 59064 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "right", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "arrowright", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "top", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "arrowup", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "left", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "arrowleft", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923334", + "name": "eye", + "font_class": "eye", + "unicode": "e651", + "unicode_decimal": 58961 + }, + { + "icon_id": "24923335", + "name": "eye-filled", + "font_class": "eye-filled", + "unicode": "e66a", + "unicode_decimal": 58986 + }, + { + "icon_id": "24923336", + "name": "eye-slash", + "font_class": "eye-slash", + "unicode": "e6b3", + "unicode_decimal": 59059 + }, + { + "icon_id": "24923337", + "name": "eye-slash-filled", + "font_class": "eye-slash-filled", + "unicode": "e6b4", + "unicode_decimal": 59060 + }, + { + "icon_id": "24923305", + "name": "info-filled", + "font_class": "info-filled", + "unicode": "e649", + "unicode_decimal": 58953 + }, + { + "icon_id": "24923299", + "name": "reload-01", + "font_class": "reload", + "unicode": "e6b2", + "unicode_decimal": 59058 + }, + { + "icon_id": "24923195", + "name": "mic_slash_fill", + "font_class": "micoff-filled", + "unicode": "e6b0", + "unicode_decimal": 59056 + }, + { + "icon_id": "24923165", + "name": "map-pin-ellipse", + "font_class": "map-pin-ellipse", + "unicode": "e6ac", + "unicode_decimal": 59052 + }, + { + "icon_id": "24923166", + "name": "map-pin", + "font_class": "map-pin", + "unicode": "e6ad", + "unicode_decimal": 59053 + }, + { + "icon_id": "24923167", + "name": "location", + "font_class": "location", + "unicode": "e6ae", + "unicode_decimal": 59054 + }, + { + "icon_id": "24923064", + "name": "starhalf", + "font_class": "starhalf", + "unicode": "e683", + "unicode_decimal": 59011 + }, + { + "icon_id": "24923065", + "name": "star", + "font_class": "star", + "unicode": "e688", + "unicode_decimal": 59016 + }, + { + "icon_id": "24923066", + "name": "star-filled", + "font_class": "star-filled", + "unicode": "e68f", + "unicode_decimal": 59023 + }, + { + "icon_id": "24899646", + "name": "a-rilidaka", + "font_class": "calendar", + "unicode": "e6a0", + "unicode_decimal": 59040 + }, + { + "icon_id": "24899647", + "name": "fire", + "font_class": "fire", + "unicode": "e6a1", + "unicode_decimal": 59041 + }, + { + "icon_id": "24899648", + "name": "paihangbang", + "font_class": "medal", + "unicode": "e6a2", + "unicode_decimal": 59042 + }, + { + "icon_id": "24899649", + "name": "font", + "font_class": "font", + "unicode": "e6a3", + "unicode_decimal": 59043 + }, + { + "icon_id": "24899650", + "name": "gift", + "font_class": "gift", + "unicode": "e6a4", + "unicode_decimal": 59044 + }, + { + "icon_id": "24899651", + "name": "link", + "font_class": "link", + "unicode": "e6a5", + "unicode_decimal": 59045 + }, + { + "icon_id": "24899652", + "name": "notification", + "font_class": "notification", + "unicode": "e6a6", + "unicode_decimal": 59046 + }, + { + "icon_id": "24899653", + "name": "staff", + "font_class": "staff", + "unicode": "e6a7", + "unicode_decimal": 59047 + }, + { + "icon_id": "24899654", + "name": "VIP", + "font_class": "vip", + "unicode": "e6a8", + "unicode_decimal": 59048 + }, + { + "icon_id": "24899655", + "name": "folder_add", + "font_class": "folder-add", + "unicode": "e6a9", + "unicode_decimal": 59049 + }, + { + "icon_id": "24899656", + "name": "tune", + "font_class": "tune", + "unicode": "e6aa", + "unicode_decimal": 59050 + }, + { + "icon_id": "24899657", + "name": "shimingrenzheng", + "font_class": "auth", + "unicode": "e6ab", + "unicode_decimal": 59051 + }, + { + "icon_id": "24899565", + "name": "person", + "font_class": "person", + "unicode": "e699", + "unicode_decimal": 59033 + }, + { + "icon_id": "24899566", + "name": "email-filled", + "font_class": "email-filled", + "unicode": "e69a", + "unicode_decimal": 59034 + }, + { + "icon_id": "24899567", + "name": "phone-filled", + "font_class": "phone-filled", + "unicode": "e69b", + "unicode_decimal": 59035 + }, + { + "icon_id": "24899568", + "name": "phone", + "font_class": "phone", + "unicode": "e69c", + "unicode_decimal": 59036 + }, + { + "icon_id": "24899570", + "name": "email", + "font_class": "email", + "unicode": "e69e", + "unicode_decimal": 59038 + }, + { + "icon_id": "24899571", + "name": "personadd", + "font_class": "personadd", + "unicode": "e69f", + "unicode_decimal": 59039 + }, + { + "icon_id": "24899558", + "name": "chatboxes-filled", + "font_class": "chatboxes-filled", + "unicode": "e692", + "unicode_decimal": 59026 + }, + { + "icon_id": "24899559", + "name": "contact", + "font_class": "contact", + "unicode": "e693", + "unicode_decimal": 59027 + }, + { + "icon_id": "24899560", + "name": "chatbubble-filled", + "font_class": "chatbubble-filled", + "unicode": "e694", + "unicode_decimal": 59028 + }, + { + "icon_id": "24899561", + "name": "contact-filled", + "font_class": "contact-filled", + "unicode": "e695", + "unicode_decimal": 59029 + }, + { + "icon_id": "24899562", + "name": "chatboxes", + "font_class": "chatboxes", + "unicode": "e696", + "unicode_decimal": 59030 + }, + { + "icon_id": "24899563", + "name": "chatbubble", + "font_class": "chatbubble", + "unicode": "e697", + "unicode_decimal": 59031 + }, + { + "icon_id": "24881290", + "name": "upload-filled", + "font_class": "upload-filled", + "unicode": "e68e", + "unicode_decimal": 59022 + }, + { + "icon_id": "24881292", + "name": "upload", + "font_class": "upload", + "unicode": "e690", + "unicode_decimal": 59024 + }, + { + "icon_id": "24881293", + "name": "weixin", + "font_class": "weixin", + "unicode": "e691", + "unicode_decimal": 59025 + }, + { + "icon_id": "24881274", + "name": "compose", + "font_class": "compose", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "24881275", + "name": "qq", + "font_class": "qq", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "24881276", + "name": "download-filled", + "font_class": "download-filled", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "24881277", + "name": "pengyouquan", + "font_class": "pyq", + "unicode": "e682", + "unicode_decimal": 59010 + }, + { + "icon_id": "24881279", + "name": "sound", + "font_class": "sound", + "unicode": "e684", + "unicode_decimal": 59012 + }, + { + "icon_id": "24881280", + "name": "trash-filled", + "font_class": "trash-filled", + "unicode": "e685", + "unicode_decimal": 59013 + }, + { + "icon_id": "24881281", + "name": "sound-filled", + "font_class": "sound-filled", + "unicode": "e686", + "unicode_decimal": 59014 + }, + { + "icon_id": "24881282", + "name": "trash", + "font_class": "trash", + "unicode": "e687", + "unicode_decimal": 59015 + }, + { + "icon_id": "24881284", + "name": "videocam-filled", + "font_class": "videocam-filled", + "unicode": "e689", + "unicode_decimal": 59017 + }, + { + "icon_id": "24881285", + "name": "spinner-cycle", + "font_class": "spinner-cycle", + "unicode": "e68a", + "unicode_decimal": 59018 + }, + { + "icon_id": "24881286", + "name": "weibo", + "font_class": "weibo", + "unicode": "e68b", + "unicode_decimal": 59019 + }, + { + "icon_id": "24881288", + "name": "videocam", + "font_class": "videocam", + "unicode": "e68c", + "unicode_decimal": 59020 + }, + { + "icon_id": "24881289", + "name": "download", + "font_class": "download", + "unicode": "e68d", + "unicode_decimal": 59021 + }, + { + "icon_id": "24879601", + "name": "help", + "font_class": "help", + "unicode": "e679", + "unicode_decimal": 59001 + }, + { + "icon_id": "24879602", + "name": "navigate-filled", + "font_class": "navigate-filled", + "unicode": "e67a", + "unicode_decimal": 59002 + }, + { + "icon_id": "24879603", + "name": "plusempty", + "font_class": "plusempty", + "unicode": "e67b", + "unicode_decimal": 59003 + }, + { + "icon_id": "24879604", + "name": "smallcircle", + "font_class": "smallcircle", + "unicode": "e67c", + "unicode_decimal": 59004 + }, + { + "icon_id": "24879605", + "name": "minus-filled", + "font_class": "minus-filled", + "unicode": "e67d", + "unicode_decimal": 59005 + }, + { + "icon_id": "24879606", + "name": "micoff", + "font_class": "micoff", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "24879588", + "name": "closeempty", + "font_class": "closeempty", + "unicode": "e66c", + "unicode_decimal": 58988 + }, + { + "icon_id": "24879589", + "name": "clear", + "font_class": "clear", + "unicode": "e66d", + "unicode_decimal": 58989 + }, + { + "icon_id": "24879590", + "name": "navigate", + "font_class": "navigate", + "unicode": "e66e", + "unicode_decimal": 58990 + }, + { + "icon_id": "24879591", + "name": "minus", + "font_class": "minus", + "unicode": "e66f", + "unicode_decimal": 58991 + }, + { + "icon_id": "24879592", + "name": "image", + "font_class": "image", + "unicode": "e670", + "unicode_decimal": 58992 + }, + { + "icon_id": "24879593", + "name": "mic", + "font_class": "mic", + "unicode": "e671", + "unicode_decimal": 58993 + }, + { + "icon_id": "24879594", + "name": "paperplane", + "font_class": "paperplane", + "unicode": "e672", + "unicode_decimal": 58994 + }, + { + "icon_id": "24879595", + "name": "close", + "font_class": "close", + "unicode": "e673", + "unicode_decimal": 58995 + }, + { + "icon_id": "24879596", + "name": "help-filled", + "font_class": "help-filled", + "unicode": "e674", + "unicode_decimal": 58996 + }, + { + "icon_id": "24879597", + "name": "plus-filled", + "font_class": "paperplane-filled", + "unicode": "e675", + "unicode_decimal": 58997 + }, + { + "icon_id": "24879598", + "name": "plus", + "font_class": "plus", + "unicode": "e676", + "unicode_decimal": 58998 + }, + { + "icon_id": "24879599", + "name": "mic-filled", + "font_class": "mic-filled", + "unicode": "e677", + "unicode_decimal": 58999 + }, + { + "icon_id": "24879600", + "name": "image-filled", + "font_class": "image-filled", + "unicode": "e678", + "unicode_decimal": 59000 + }, + { + "icon_id": "24855900", + "name": "locked-filled", + "font_class": "locked-filled", + "unicode": "e668", + "unicode_decimal": 58984 + }, + { + "icon_id": "24855901", + "name": "info", + "font_class": "info", + "unicode": "e669", + "unicode_decimal": 58985 + }, + { + "icon_id": "24855903", + "name": "locked", + "font_class": "locked", + "unicode": "e66b", + "unicode_decimal": 58987 + }, + { + "icon_id": "24855884", + "name": "camera-filled", + "font_class": "camera-filled", + "unicode": "e658", + "unicode_decimal": 58968 + }, + { + "icon_id": "24855885", + "name": "chat-filled", + "font_class": "chat-filled", + "unicode": "e659", + "unicode_decimal": 58969 + }, + { + "icon_id": "24855886", + "name": "camera", + "font_class": "camera", + "unicode": "e65a", + "unicode_decimal": 58970 + }, + { + "icon_id": "24855887", + "name": "circle", + "font_class": "circle", + "unicode": "e65b", + "unicode_decimal": 58971 + }, + { + "icon_id": "24855888", + "name": "checkmarkempty", + "font_class": "checkmarkempty", + "unicode": "e65c", + "unicode_decimal": 58972 + }, + { + "icon_id": "24855889", + "name": "chat", + "font_class": "chat", + "unicode": "e65d", + "unicode_decimal": 58973 + }, + { + "icon_id": "24855890", + "name": "circle-filled", + "font_class": "circle-filled", + "unicode": "e65e", + "unicode_decimal": 58974 + }, + { + "icon_id": "24855891", + "name": "flag", + "font_class": "flag", + "unicode": "e65f", + "unicode_decimal": 58975 + }, + { + "icon_id": "24855892", + "name": "flag-filled", + "font_class": "flag-filled", + "unicode": "e660", + "unicode_decimal": 58976 + }, + { + "icon_id": "24855893", + "name": "gear-filled", + "font_class": "gear-filled", + "unicode": "e661", + "unicode_decimal": 58977 + }, + { + "icon_id": "24855894", + "name": "home", + "font_class": "home", + "unicode": "e662", + "unicode_decimal": 58978 + }, + { + "icon_id": "24855895", + "name": "home-filled", + "font_class": "home-filled", + "unicode": "e663", + "unicode_decimal": 58979 + }, + { + "icon_id": "24855896", + "name": "gear", + "font_class": "gear", + "unicode": "e664", + "unicode_decimal": 58980 + }, + { + "icon_id": "24855897", + "name": "smallcircle-filled", + "font_class": "smallcircle-filled", + "unicode": "e665", + "unicode_decimal": 58981 + }, + { + "icon_id": "24855898", + "name": "map-filled", + "font_class": "map-filled", + "unicode": "e666", + "unicode_decimal": 58982 + }, + { + "icon_id": "24855899", + "name": "map", + "font_class": "map", + "unicode": "e667", + "unicode_decimal": 58983 + }, + { + "icon_id": "24855825", + "name": "refresh-filled", + "font_class": "refresh-filled", + "unicode": "e656", + "unicode_decimal": 58966 + }, + { + "icon_id": "24855826", + "name": "refresh", + "font_class": "refresh", + "unicode": "e657", + "unicode_decimal": 58967 + }, + { + "icon_id": "24855808", + "name": "cloud-upload", + "font_class": "cloud-upload", + "unicode": "e645", + "unicode_decimal": 58949 + }, + { + "icon_id": "24855809", + "name": "cloud-download-filled", + "font_class": "cloud-download-filled", + "unicode": "e646", + "unicode_decimal": 58950 + }, + { + "icon_id": "24855810", + "name": "cloud-download", + "font_class": "cloud-download", + "unicode": "e647", + "unicode_decimal": 58951 + }, + { + "icon_id": "24855811", + "name": "cloud-upload-filled", + "font_class": "cloud-upload-filled", + "unicode": "e648", + "unicode_decimal": 58952 + }, + { + "icon_id": "24855813", + "name": "redo", + "font_class": "redo", + "unicode": "e64a", + "unicode_decimal": 58954 + }, + { + "icon_id": "24855814", + "name": "images-filled", + "font_class": "images-filled", + "unicode": "e64b", + "unicode_decimal": 58955 + }, + { + "icon_id": "24855815", + "name": "undo-filled", + "font_class": "undo-filled", + "unicode": "e64c", + "unicode_decimal": 58956 + }, + { + "icon_id": "24855816", + "name": "more", + "font_class": "more", + "unicode": "e64d", + "unicode_decimal": 58957 + }, + { + "icon_id": "24855817", + "name": "more-filled", + "font_class": "more-filled", + "unicode": "e64e", + "unicode_decimal": 58958 + }, + { + "icon_id": "24855818", + "name": "undo", + "font_class": "undo", + "unicode": "e64f", + "unicode_decimal": 58959 + }, + { + "icon_id": "24855819", + "name": "images", + "font_class": "images", + "unicode": "e650", + "unicode_decimal": 58960 + }, + { + "icon_id": "24855821", + "name": "paperclip", + "font_class": "paperclip", + "unicode": "e652", + "unicode_decimal": 58962 + }, + { + "icon_id": "24855822", + "name": "settings", + "font_class": "settings", + "unicode": "e653", + "unicode_decimal": 58963 + }, + { + "icon_id": "24855823", + "name": "search", + "font_class": "search", + "unicode": "e654", + "unicode_decimal": 58964 + }, + { + "icon_id": "24855824", + "name": "redo-filled", + "font_class": "redo-filled", + "unicode": "e655", + "unicode_decimal": 58965 + }, + { + "icon_id": "24841702", + "name": "list", + "font_class": "list", + "unicode": "e644", + "unicode_decimal": 58948 + }, + { + "icon_id": "24841489", + "name": "mail-open-filled", + "font_class": "mail-open-filled", + "unicode": "e63a", + "unicode_decimal": 58938 + }, + { + "icon_id": "24841491", + "name": "hand-thumbsdown-filled", + "font_class": "hand-down-filled", + "unicode": "e63c", + "unicode_decimal": 58940 + }, + { + "icon_id": "24841492", + "name": "hand-thumbsdown", + "font_class": "hand-down", + "unicode": "e63d", + "unicode_decimal": 58941 + }, + { + "icon_id": "24841493", + "name": "hand-thumbsup-filled", + "font_class": "hand-up-filled", + "unicode": "e63e", + "unicode_decimal": 58942 + }, + { + "icon_id": "24841494", + "name": "hand-thumbsup", + "font_class": "hand-up", + "unicode": "e63f", + "unicode_decimal": 58943 + }, + { + "icon_id": "24841496", + "name": "heart-filled", + "font_class": "heart-filled", + "unicode": "e641", + "unicode_decimal": 58945 + }, + { + "icon_id": "24841498", + "name": "mail-open", + "font_class": "mail-open", + "unicode": "e643", + "unicode_decimal": 58947 + }, + { + "icon_id": "24841488", + "name": "heart", + "font_class": "heart", + "unicode": "e639", + "unicode_decimal": 58937 + }, + { + "icon_id": "24839963", + "name": "loop", + "font_class": "loop", + "unicode": "e633", + "unicode_decimal": 58931 + }, + { + "icon_id": "24839866", + "name": "pulldown", + "font_class": "pulldown", + "unicode": "e632", + "unicode_decimal": 58930 + }, + { + "icon_id": "24813798", + "name": "scan", + "font_class": "scan", + "unicode": "e62a", + "unicode_decimal": 58922 + }, + { + "icon_id": "24813786", + "name": "bars", + "font_class": "bars", + "unicode": "e627", + "unicode_decimal": 58919 + }, + { + "icon_id": "24813788", + "name": "cart-filled", + "font_class": "cart-filled", + "unicode": "e629", + "unicode_decimal": 58921 + }, + { + "icon_id": "24813790", + "name": "checkbox", + "font_class": "checkbox", + "unicode": "e62b", + "unicode_decimal": 58923 + }, + { + "icon_id": "24813791", + "name": "checkbox-filled", + "font_class": "checkbox-filled", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "24813794", + "name": "shop", + "font_class": "shop", + "unicode": "e62f", + "unicode_decimal": 58927 + }, + { + "icon_id": "24813795", + "name": "headphones", + "font_class": "headphones", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "24813796", + "name": "cart", + "font_class": "cart", + "unicode": "e631", + "unicode_decimal": 58929 + } + ] +} diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue new file mode 100644 index 0000000..86e7444 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.css b/uni_modules/uni-icons/components/uni-icons/uniicons.css new file mode 100644 index 0000000..2f56eab --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uniicons.css @@ -0,0 +1,663 @@ +.uniui-color:before { + content: "\e6cf"; +} + +.uniui-wallet:before { + content: "\e6b1"; +} + +.uniui-settings-filled:before { + content: "\e6ce"; +} + +.uniui-auth-filled:before { + content: "\e6cc"; +} + +.uniui-shop-filled:before { + content: "\e6cd"; +} + +.uniui-staff-filled:before { + content: "\e6cb"; +} + +.uniui-vip-filled:before { + content: "\e6c6"; +} + +.uniui-plus-filled:before { + content: "\e6c7"; +} + +.uniui-folder-add-filled:before { + content: "\e6c8"; +} + +.uniui-color-filled:before { + content: "\e6c9"; +} + +.uniui-tune-filled:before { + content: "\e6ca"; +} + +.uniui-calendar-filled:before { + content: "\e6c0"; +} + +.uniui-notification-filled:before { + content: "\e6c1"; +} + +.uniui-wallet-filled:before { + content: "\e6c2"; +} + +.uniui-medal-filled:before { + content: "\e6c3"; +} + +.uniui-gift-filled:before { + content: "\e6c4"; +} + +.uniui-fire-filled:before { + content: "\e6c5"; +} + +.uniui-refreshempty:before { + content: "\e6bf"; +} + +.uniui-location-filled:before { + content: "\e6af"; +} + +.uniui-person-filled:before { + content: "\e69d"; +} + +.uniui-personadd-filled:before { + content: "\e698"; +} + +.uniui-back:before { + content: "\e6b9"; +} + +.uniui-forward:before { + content: "\e6ba"; +} + +.uniui-arrow-right:before { + content: "\e6bb"; +} + +.uniui-arrowthinright:before { + content: "\e6bb"; +} + +.uniui-arrow-left:before { + content: "\e6bc"; +} + +.uniui-arrowthinleft:before { + content: "\e6bc"; +} + +.uniui-arrow-up:before { + content: "\e6bd"; +} + +.uniui-arrowthinup:before { + content: "\e6bd"; +} + +.uniui-arrow-down:before { + content: "\e6be"; +} + +.uniui-arrowthindown:before { + content: "\e6be"; +} + +.uniui-bottom:before { + content: "\e6b8"; +} + +.uniui-arrowdown:before { + content: "\e6b8"; +} + +.uniui-right:before { + content: "\e6b5"; +} + +.uniui-arrowright:before { + content: "\e6b5"; +} + +.uniui-top:before { + content: "\e6b6"; +} + +.uniui-arrowup:before { + content: "\e6b6"; +} + +.uniui-left:before { + content: "\e6b7"; +} + +.uniui-arrowleft:before { + content: "\e6b7"; +} + +.uniui-eye:before { + content: "\e651"; +} + +.uniui-eye-filled:before { + content: "\e66a"; +} + +.uniui-eye-slash:before { + content: "\e6b3"; +} + +.uniui-eye-slash-filled:before { + content: "\e6b4"; +} + +.uniui-info-filled:before { + content: "\e649"; +} + +.uniui-reload:before { + content: "\e6b2"; +} + +.uniui-micoff-filled:before { + content: "\e6b0"; +} + +.uniui-map-pin-ellipse:before { + content: "\e6ac"; +} + +.uniui-map-pin:before { + content: "\e6ad"; +} + +.uniui-location:before { + content: "\e6ae"; +} + +.uniui-starhalf:before { + content: "\e683"; +} + +.uniui-star:before { + content: "\e688"; +} + +.uniui-star-filled:before { + content: "\e68f"; +} + +.uniui-calendar:before { + content: "\e6a0"; +} + +.uniui-fire:before { + content: "\e6a1"; +} + +.uniui-medal:before { + content: "\e6a2"; +} + +.uniui-font:before { + content: "\e6a3"; +} + +.uniui-gift:before { + content: "\e6a4"; +} + +.uniui-link:before { + content: "\e6a5"; +} + +.uniui-notification:before { + content: "\e6a6"; +} + +.uniui-staff:before { + content: "\e6a7"; +} + +.uniui-vip:before { + content: "\e6a8"; +} + +.uniui-folder-add:before { + content: "\e6a9"; +} + +.uniui-tune:before { + content: "\e6aa"; +} + +.uniui-auth:before { + content: "\e6ab"; +} + +.uniui-person:before { + content: "\e699"; +} + +.uniui-email-filled:before { + content: "\e69a"; +} + +.uniui-phone-filled:before { + content: "\e69b"; +} + +.uniui-phone:before { + content: "\e69c"; +} + +.uniui-email:before { + content: "\e69e"; +} + +.uniui-personadd:before { + content: "\e69f"; +} + +.uniui-chatboxes-filled:before { + content: "\e692"; +} + +.uniui-contact:before { + content: "\e693"; +} + +.uniui-chatbubble-filled:before { + content: "\e694"; +} + +.uniui-contact-filled:before { + content: "\e695"; +} + +.uniui-chatboxes:before { + content: "\e696"; +} + +.uniui-chatbubble:before { + content: "\e697"; +} + +.uniui-upload-filled:before { + content: "\e68e"; +} + +.uniui-upload:before { + content: "\e690"; +} + +.uniui-weixin:before { + content: "\e691"; +} + +.uniui-compose:before { + content: "\e67f"; +} + +.uniui-qq:before { + content: "\e680"; +} + +.uniui-download-filled:before { + content: "\e681"; +} + +.uniui-pyq:before { + content: "\e682"; +} + +.uniui-sound:before { + content: "\e684"; +} + +.uniui-trash-filled:before { + content: "\e685"; +} + +.uniui-sound-filled:before { + content: "\e686"; +} + +.uniui-trash:before { + content: "\e687"; +} + +.uniui-videocam-filled:before { + content: "\e689"; +} + +.uniui-spinner-cycle:before { + content: "\e68a"; +} + +.uniui-weibo:before { + content: "\e68b"; +} + +.uniui-videocam:before { + content: "\e68c"; +} + +.uniui-download:before { + content: "\e68d"; +} + +.uniui-help:before { + content: "\e679"; +} + +.uniui-navigate-filled:before { + content: "\e67a"; +} + +.uniui-plusempty:before { + content: "\e67b"; +} + +.uniui-smallcircle:before { + content: "\e67c"; +} + +.uniui-minus-filled:before { + content: "\e67d"; +} + +.uniui-micoff:before { + content: "\e67e"; +} + +.uniui-closeempty:before { + content: "\e66c"; +} + +.uniui-clear:before { + content: "\e66d"; +} + +.uniui-navigate:before { + content: "\e66e"; +} + +.uniui-minus:before { + content: "\e66f"; +} + +.uniui-image:before { + content: "\e670"; +} + +.uniui-mic:before { + content: "\e671"; +} + +.uniui-paperplane:before { + content: "\e672"; +} + +.uniui-close:before { + content: "\e673"; +} + +.uniui-help-filled:before { + content: "\e674"; +} + +.uniui-paperplane-filled:before { + content: "\e675"; +} + +.uniui-plus:before { + content: "\e676"; +} + +.uniui-mic-filled:before { + content: "\e677"; +} + +.uniui-image-filled:before { + content: "\e678"; +} + +.uniui-locked-filled:before { + content: "\e668"; +} + +.uniui-info:before { + content: "\e669"; +} + +.uniui-locked:before { + content: "\e66b"; +} + +.uniui-camera-filled:before { + content: "\e658"; +} + +.uniui-chat-filled:before { + content: "\e659"; +} + +.uniui-camera:before { + content: "\e65a"; +} + +.uniui-circle:before { + content: "\e65b"; +} + +.uniui-checkmarkempty:before { + content: "\e65c"; +} + +.uniui-chat:before { + content: "\e65d"; +} + +.uniui-circle-filled:before { + content: "\e65e"; +} + +.uniui-flag:before { + content: "\e65f"; +} + +.uniui-flag-filled:before { + content: "\e660"; +} + +.uniui-gear-filled:before { + content: "\e661"; +} + +.uniui-home:before { + content: "\e662"; +} + +.uniui-home-filled:before { + content: "\e663"; +} + +.uniui-gear:before { + content: "\e664"; +} + +.uniui-smallcircle-filled:before { + content: "\e665"; +} + +.uniui-map-filled:before { + content: "\e666"; +} + +.uniui-map:before { + content: "\e667"; +} + +.uniui-refresh-filled:before { + content: "\e656"; +} + +.uniui-refresh:before { + content: "\e657"; +} + +.uniui-cloud-upload:before { + content: "\e645"; +} + +.uniui-cloud-download-filled:before { + content: "\e646"; +} + +.uniui-cloud-download:before { + content: "\e647"; +} + +.uniui-cloud-upload-filled:before { + content: "\e648"; +} + +.uniui-redo:before { + content: "\e64a"; +} + +.uniui-images-filled:before { + content: "\e64b"; +} + +.uniui-undo-filled:before { + content: "\e64c"; +} + +.uniui-more:before { + content: "\e64d"; +} + +.uniui-more-filled:before { + content: "\e64e"; +} + +.uniui-undo:before { + content: "\e64f"; +} + +.uniui-images:before { + content: "\e650"; +} + +.uniui-paperclip:before { + content: "\e652"; +} + +.uniui-settings:before { + content: "\e653"; +} + +.uniui-search:before { + content: "\e654"; +} + +.uniui-redo-filled:before { + content: "\e655"; +} + +.uniui-list:before { + content: "\e644"; +} + +.uniui-mail-open-filled:before { + content: "\e63a"; +} + +.uniui-hand-down-filled:before { + content: "\e63c"; +} + +.uniui-hand-down:before { + content: "\e63d"; +} + +.uniui-hand-up-filled:before { + content: "\e63e"; +} + +.uniui-hand-up:before { + content: "\e63f"; +} + +.uniui-heart-filled:before { + content: "\e641"; +} + +.uniui-mail-open:before { + content: "\e643"; +} + +.uniui-heart:before { + content: "\e639"; +} + +.uniui-loop:before { + content: "\e633"; +} + +.uniui-pulldown:before { + content: "\e632"; +} + +.uniui-scan:before { + content: "\e62a"; +} + +.uniui-bars:before { + content: "\e627"; +} + +.uniui-cart-filled:before { + content: "\e629"; +} + +.uniui-checkbox:before { + content: "\e62b"; +} + +.uniui-checkbox-filled:before { + content: "\e62c"; +} + +.uniui-shop:before { + content: "\e62f"; +} + +.uniui-headphones:before { + content: "\e630"; +} + +.uniui-cart:before { + content: "\e631"; +} diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.ttf b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf new file mode 100644 index 0000000..835f33b Binary files /dev/null and b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf differ diff --git a/uni_modules/uni-icons/package.json b/uni_modules/uni-icons/package.json new file mode 100644 index 0000000..d1c4e77 --- /dev/null +++ b/uni_modules/uni-icons/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-icons", + "displayName": "uni-icons 图标", + "version": "1.3.5", + "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", + "keywords": [ + "uni-ui", + "uniui", + "icon", + "图标" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.2.14" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-icons/readme.md b/uni_modules/uni-icons/readme.md new file mode 100644 index 0000000..86234ba --- /dev/null +++ b/uni_modules/uni-icons/readme.md @@ -0,0 +1,8 @@ +## Icons 图标 +> **组件名:uni-icons** +> 代码块: `uIcons` + +用于展示 icons 图标 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-load-more/changelog.md b/uni_modules/uni-load-more/changelog.md new file mode 100644 index 0000000..8f03f1d --- /dev/null +++ b/uni_modules/uni-load-more/changelog.md @@ -0,0 +1,19 @@ +## 1.3.3(2022-01-20) +- 新增 showText属性 ,是否显示文本 +## 1.3.2(2022-01-19) +- 修复 nvue 平台下不显示文本的bug +## 1.3.1(2022-01-19) +- 修复 微信小程序平台样式选择器报警告的问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-load-more](https://uniapp.dcloud.io/component/uniui/uni-load-more) +## 1.2.1(2021-08-24) +- 新增 支持国际化 +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.8(2021-05-12) +- 新增 组件示例地址 +## 1.1.7(2021-03-30) +- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug +## 1.1.6(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json new file mode 100644 index 0000000..a4f14a5 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "Pull up to show more", + "uni-load-more.contentrefresh": "loading...", + "uni-load-more.contentnomore": "No more data" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json new file mode 100644 index 0000000..f15d510 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉显示更多", + "uni-load-more.contentrefresh": "正在加载...", + "uni-load-more.contentnomore": "没有更多数据了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json new file mode 100644 index 0000000..a255c6d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉顯示更多", + "uni-load-more.contentrefresh": "正在加載...", + "uni-load-more.contentnomore": "沒有更多數據了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue new file mode 100644 index 0000000..e5eff4d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue @@ -0,0 +1,399 @@ + + + + + diff --git a/uni_modules/uni-load-more/package.json b/uni_modules/uni-load-more/package.json new file mode 100644 index 0000000..2fa6f04 --- /dev/null +++ b/uni_modules/uni-load-more/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-load-more", + "displayName": "uni-load-more 加载更多", + "version": "1.3.3", + "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", + "keywords": [ + "uni-ui", + "uniui", + "加载更多", + "load-more" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-load-more/readme.md b/uni_modules/uni-load-more/readme.md new file mode 100644 index 0000000..54dc1fa --- /dev/null +++ b/uni_modules/uni-load-more/readme.md @@ -0,0 +1,14 @@ + + +### LoadMore 加载更多 +> **组件名:uni-load-more** +> 代码块: `uLoadMore` + + +用于列表中,做滚动加载使用,展示 loading 的各种状态。 + + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-load-more) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-nav-bar/changelog.md b/uni_modules/uni-nav-bar/changelog.md new file mode 100644 index 0000000..75b0586 --- /dev/null +++ b/uni_modules/uni-nav-bar/changelog.md @@ -0,0 +1,22 @@ +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-nav-bar](https://uniapp.dcloud.io/component/uniui/uni-nav-bar) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.11(2021-05-12) +- 新增 组件示例地址 +## 1.0.10(2021-04-30) +- 修复 在nvue下fixed为true,宽度不能撑满的Bug +## 1.0.9(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.8(2021-04-14) +- uni-ui 修复 uni-nav-bar 当 fixed 属性为 true 时铺不满屏幕的 bug + +## 1.0.7(2021-02-25) +- 修复 easycom 下,找不到 uni-status-bar 的bug + +## 1.0.6(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue new file mode 100644 index 0000000..2fdfe35 --- /dev/null +++ b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue @@ -0,0 +1,254 @@ + + + + + diff --git a/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue new file mode 100644 index 0000000..976af6c --- /dev/null +++ b/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/uni_modules/uni-nav-bar/package.json b/uni_modules/uni-nav-bar/package.json new file mode 100644 index 0000000..fe08493 --- /dev/null +++ b/uni_modules/uni-nav-bar/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-nav-bar", + "displayName": "uni-nav-bar 自定义导航栏", + "version": "1.2.0", + "description": "自定义导航栏组件,主要用于头部导航。", + "keywords": [ + "uni-ui", + "导航", + "导航栏", + "自定义导航栏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-nav-bar/readme.md b/uni_modules/uni-nav-bar/readme.md new file mode 100644 index 0000000..3934b32 --- /dev/null +++ b/uni_modules/uni-nav-bar/readme.md @@ -0,0 +1,15 @@ + + +## NavBar 导航栏 +> **组件名:uni-nav-bar** +> 代码块: `uNavBar` + +导航栏组件,主要用于头部导航。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-nav-bar) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-popup/changelog.md b/uni_modules/uni-popup/changelog.md new file mode 100644 index 0000000..a9e2d66 --- /dev/null +++ b/uni_modules/uni-popup/changelog.md @@ -0,0 +1,60 @@ +## 1.7.9(2022-04-02) +- 修复 弹出层内部无法滚动的bug +## 1.7.8(2022-03-28) +- 修复 小程序中高度错误的bug +## 1.7.7(2022-03-17) +- 修复 快速调用open出现问题的Bug +## 1.7.6(2022-02-14) +- 修复 safeArea 属性不能设置为false的bug +## 1.7.5(2022-01-19) +- 修复 isMaskClick 失效的bug +## 1.7.4(2022-01-19) +- 新增 cancelText \ confirmText 属性 ,可自定义文本 +- 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色 +- 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题 +## 1.7.3(2022-01-13) +- 修复 设置 safeArea 属性不生效的bug +## 1.7.2(2021-11-26) +- 优化 组件示例 +## 1.7.1(2021-11-26) +- 修复 vuedoc 文字错误 +## 1.7.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup) +## 1.6.2(2021-08-24) +- 新增 支持国际化 +## 1.6.1(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.6.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.5.0(2021-06-23) +- 新增 mask-click 遮罩层点击事件 +## 1.4.5(2021-06-22) +- 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.4(2021-06-18) +- 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug +## 1.4.3(2021-06-08) +- 修复 错误的 watch 字段 +- 修复 safeArea 属性不生效的问题 +- 修复 点击内容,再点击遮罩无法关闭的Bug +## 1.4.2(2021-05-12) +- 新增 组件示例地址 +## 1.4.1(2021-04-29) +- 修复 组件内放置 input 、textarea 组件,无法聚焦的问题 +## 1.4.0 (2021-04-29) +- 新增 type 属性的 left\right 值,支持左右弹出 +- 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗 +- 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色 +- 新增 safeArea 属性,是否适配底部安全区 +- 修复 App\h5\微信小程序底部安全区占位不对的Bug +- 修复 App 端弹出等待的Bug +- 优化 提升低配设备性能,优化动画卡顿问题 +- 优化 更简单的组件自定义方式 +## 1.2.9(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.2.8(2021-02-05) +- 调整为uni_modules目录规范 +## 1.2.7(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持 PC 端 +- 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端 diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js new file mode 100644 index 0000000..6ef26a2 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue new file mode 100644 index 0000000..a5d0f2a --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue new file mode 100644 index 0000000..91370a8 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue @@ -0,0 +1,143 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue new file mode 100644 index 0000000..5be7624 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue @@ -0,0 +1,187 @@ + + + + diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/en.json b/uni_modules/uni-popup/components/uni-popup/i18n/en.json new file mode 100644 index 0000000..7f1bd06 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/en.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "cancel", + "uni-popup.ok": "ok", + "uni-popup.placeholder": "pleace enter", + "uni-popup.title": "Hint", + "uni-popup.shareTitle": "Share to" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/index.js b/uni_modules/uni-popup/components/uni-popup/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json new file mode 100644 index 0000000..5e3003c --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "确定", + "uni-popup.placeholder": "请输入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json new file mode 100644 index 0000000..13e39eb --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "uni-popup.cancel": "取消", + "uni-popup.ok": "確定", + "uni-popup.placeholder": "請輸入", + "uni-popup.title": "提示", + "uni-popup.shareTitle": "分享到" +} diff --git a/uni_modules/uni-popup/components/uni-popup/keypress.js b/uni_modules/uni-popup/components/uni-popup/keypress.js new file mode 100644 index 0000000..62dda46 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + // this.$once('hook:beforeDestroy', () => { + // document.removeEventListener('keyup', listener) + // }) + }, + render: () => {} +} +// #endif diff --git a/uni_modules/uni-popup/components/uni-popup/popup.js b/uni_modules/uni-popup/components/uni-popup/popup.js new file mode 100644 index 0000000..c4e5781 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/popup.js @@ -0,0 +1,26 @@ + +export default { + data() { + return { + + } + }, + created(){ + this.popup = this.getParent() + }, + methods:{ + /** + * 获取父元素实例 + */ + getParent(name = 'uniPopup') { + let parent = this.$parent; + let parentName = parent.$options.name; + while (parentName !== name) { + parent = parent.$parent; + if (!parent) return false + parentName = parent.$options.name; + } + return parent; + }, + } +} diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue new file mode 100644 index 0000000..db90c59 --- /dev/null +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -0,0 +1,474 @@ + + + + diff --git a/uni_modules/uni-popup/package.json b/uni_modules/uni-popup/package.json new file mode 100644 index 0000000..069e9ce --- /dev/null +++ b/uni_modules/uni-popup/package.json @@ -0,0 +1,90 @@ +{ + "id": "uni-popup", + "displayName": "uni-popup 弹出层", + "version": "1.7.9", + "description": " Popup 组件,提供常用的弹层", + "keywords": [ + "uni-ui", + "弹出层", + "弹窗", + "popup", + "弹框" + ], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-transition" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-popup/readme.md b/uni_modules/uni-popup/readme.md new file mode 100644 index 0000000..fdad4b3 --- /dev/null +++ b/uni_modules/uni-popup/readme.md @@ -0,0 +1,17 @@ + + +## Popup 弹出层 +> **组件名:uni-popup** +> 代码块: `uPopup` +> 关联组件:`uni-transition` + + +弹出层组件,在应用中弹出一个消息提示窗口、提示框等 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-popup) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + + diff --git a/uni_modules/uni-scss/changelog.md b/uni_modules/uni-scss/changelog.md new file mode 100644 index 0000000..b863bb0 --- /dev/null +++ b/uni_modules/uni-scss/changelog.md @@ -0,0 +1,8 @@ +## 1.0.3(2022-01-21) +- 优化 组件示例 +## 1.0.2(2021-11-22) +- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题 +## 1.0.1(2021-11-22) +- 修复 vue3中scss语法兼容问题 +## 1.0.0(2021-11-18) +- init diff --git a/uni_modules/uni-scss/index.scss b/uni_modules/uni-scss/index.scss new file mode 100644 index 0000000..1744a5f --- /dev/null +++ b/uni_modules/uni-scss/index.scss @@ -0,0 +1 @@ +@import './styles/index.scss'; diff --git a/uni_modules/uni-scss/manifest.json b/uni_modules/uni-scss/manifest.json new file mode 100644 index 0000000..9f8baee --- /dev/null +++ b/uni_modules/uni-scss/manifest.json @@ -0,0 +1,95 @@ +{ + "name" : "", + "appid" : "", + "description": "应用描述", + "versionName": "1.0.0", + "versionCode": "100", + "transformPx": false, + /* 5+App特有相关 */ + "app-plus": { + "usingComponents": true, + "splashscreen": { + "alwaysShowBeforeRender": true, + "waiting": true, + "autoclose": true, + "delay": 0 + }, + "modules": { + "OAuth": {}, + "Payment": {}, + "Push": {}, + "Share": {}, + "Speech": {}, + "VideoPlayer": {} + }, + /* 应用发布信息 */ + "distribute": { + /* android打包配置 */ + "android": { + "permissions": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios": { + "UIBackgroundModes": ["audio"] + }, + /* SDK配置 */ + "sdkConfigs": { + "speech": { + "ifly": {} + } + }, + "orientation": ["portrait-primary"] + } + }, + /* 快应用特有相关 */ + "quickapp": {}, + /* 小程序特有相关 */ + "mp-weixin": { + "appid": "", + "setting": { + "urlCheck": false + }, + "usingComponents": true + }, + "h5": { + "template": "template.h5.html", + "router": { + "mode": "history", + "base": "/h5/" + } + } +} diff --git a/uni_modules/uni-scss/package.json b/uni_modules/uni-scss/package.json new file mode 100644 index 0000000..7cc0ccb --- /dev/null +++ b/uni_modules/uni-scss/package.json @@ -0,0 +1,82 @@ +{ + "id": "uni-scss", + "displayName": "uni-scss 辅助样式", + "version": "1.0.3", + "description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。", + "keywords": [ + "uni-scss", + "uni-ui", + "辅助样式" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "JS SDK", + "通用 SDK" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-scss/readme.md b/uni_modules/uni-scss/readme.md new file mode 100644 index 0000000..b7d1c25 --- /dev/null +++ b/uni_modules/uni-scss/readme.md @@ -0,0 +1,4 @@ +`uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/index.scss b/uni_modules/uni-scss/styles/index.scss new file mode 100644 index 0000000..ffac4fe --- /dev/null +++ b/uni_modules/uni-scss/styles/index.scss @@ -0,0 +1,7 @@ +@import './setting/_variables.scss'; +@import './setting/_border.scss'; +@import './setting/_color.scss'; +@import './setting/_space.scss'; +@import './setting/_radius.scss'; +@import './setting/_text.scss'; +@import './setting/_styles.scss'; diff --git a/uni_modules/uni-scss/styles/setting/_border.scss b/uni_modules/uni-scss/styles/setting/_border.scss new file mode 100644 index 0000000..12a11c3 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_border.scss @@ -0,0 +1,3 @@ +.uni-border { + border: 1px $uni-border-1 solid; +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_color.scss b/uni_modules/uni-scss/styles/setting/_color.scss new file mode 100644 index 0000000..1ededd9 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_color.scss @@ -0,0 +1,66 @@ + +// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 +// @mixin get-styles($k,$c) { +// @if $k == size or $k == weight{ +// font-#{$k}:#{$c} +// }@else{ +// #{$k}:#{$c} +// } +// } +$uni-ui-color:( + // 主色 + primary: $uni-primary, + primary-disable: $uni-primary-disable, + primary-light: $uni-primary-light, + // 辅助色 + success: $uni-success, + success-disable: $uni-success-disable, + success-light: $uni-success-light, + warning: $uni-warning, + warning-disable: $uni-warning-disable, + warning-light: $uni-warning-light, + error: $uni-error, + error-disable: $uni-error-disable, + error-light: $uni-error-light, + info: $uni-info, + info-disable: $uni-info-disable, + info-light: $uni-info-light, + // 中性色 + main-color: $uni-main-color, + base-color: $uni-base-color, + secondary-color: $uni-secondary-color, + extra-color: $uni-extra-color, + // 背景色 + bg-color: $uni-bg-color, + // 边框颜色 + border-1: $uni-border-1, + border-2: $uni-border-2, + border-3: $uni-border-3, + border-4: $uni-border-4, + // 黑色 + black:$uni-black, + // 白色 + white:$uni-white, + // 透明 + transparent:$uni-transparent +) !default; +@each $key, $child in $uni-ui-color { + .uni-#{"" + $key} { + color: $child; + } + .uni-#{"" + $key}-bg { + background-color: $child; + } +} +.uni-shadow-sm { + box-shadow: $uni-shadow-sm; +} +.uni-shadow-base { + box-shadow: $uni-shadow-base; +} +.uni-shadow-lg { + box-shadow: $uni-shadow-lg; +} +.uni-mask { + background-color:$uni-mask; +} diff --git a/uni_modules/uni-scss/styles/setting/_radius.scss b/uni_modules/uni-scss/styles/setting/_radius.scss new file mode 100644 index 0000000..9a0428b --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_radius.scss @@ -0,0 +1,55 @@ +@mixin radius($r,$d:null ,$important: false){ + $radius-value:map-get($uni-radius, $r) if($important, !important, null); + // Key exists within the $uni-radius variable + @if (map-has-key($uni-radius, $r) and $d){ + @if $d == t { + border-top-left-radius:$radius-value; + border-top-right-radius:$radius-value; + }@else if $d == r { + border-top-right-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == b { + border-bottom-left-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == l { + border-top-left-radius:$radius-value; + border-bottom-left-radius:$radius-value; + }@else if $d == tl { + border-top-left-radius:$radius-value; + }@else if $d == tr { + border-top-right-radius:$radius-value; + }@else if $d == br { + border-bottom-right-radius:$radius-value; + }@else if $d == bl { + border-bottom-left-radius:$radius-value; + } + }@else{ + border-radius:$radius-value; + } +} + +@each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $key} { + @include radius($key) + } + }@else{ + .uni-radius { + @include radius($key) + } + } +} + +@each $direction in t, r, b, l,tl, tr, br, bl { + @each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $direction}-#{"" + $key} { + @include radius($key,$direction,false) + } + }@else{ + .uni-radius-#{$direction} { + @include radius($key,$direction,false) + } + } + } +} diff --git a/uni_modules/uni-scss/styles/setting/_space.scss b/uni_modules/uni-scss/styles/setting/_space.scss new file mode 100644 index 0000000..3c89528 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_space.scss @@ -0,0 +1,56 @@ + +@mixin fn($space,$direction,$size,$n) { + @if $n { + #{$space}-#{$direction}: #{$size*$uni-space-root}px + } @else { + #{$space}-#{$direction}: #{-$size*$uni-space-root}px + } +} +@mixin get-styles($direction,$i,$space,$n){ + @if $direction == t { + @include fn($space, top,$i,$n); + } + @if $direction == r { + @include fn($space, right,$i,$n); + } + @if $direction == b { + @include fn($space, bottom,$i,$n); + } + @if $direction == l { + @include fn($space, left,$i,$n); + } + @if $direction == x { + @include fn($space, left,$i,$n); + @include fn($space, right,$i,$n); + } + @if $direction == y { + @include fn($space, top,$i,$n); + @include fn($space, bottom,$i,$n); + } + @if $direction == a { + @if $n { + #{$space}:#{$i*$uni-space-root}px; + } @else { + #{$space}:#{-$i*$uni-space-root}px; + } + } +} + +@each $orientation in m,p { + $space: margin; + @if $orientation == m { + $space: margin; + } @else { + $space: padding; + } + @for $i from 0 through 16 { + @each $direction in t, r, b, l, x, y, a { + .uni-#{$orientation}#{$direction}-#{$i} { + @include get-styles($direction,$i,$space,true); + } + .uni-#{$orientation}#{$direction}-n#{$i} { + @include get-styles($direction,$i,$space,false); + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_styles.scss b/uni_modules/uni-scss/styles/setting/_styles.scss new file mode 100644 index 0000000..689afec --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_styles.scss @@ -0,0 +1,167 @@ +/* #ifndef APP-NVUE */ + +$-color-white:#fff; +$-color-black:#000; +@mixin base-style($color) { + color: #fff; + background-color: $color; + border-color: mix($-color-black, $color, 8%); + &:not([hover-class]):active { + background: mix($-color-black, $color, 10%); + border-color: mix($-color-black, $color, 20%); + color: $-color-white; + outline: none; + } +} +@mixin is-color($color) { + @include base-style($color); + &[loading] { + @include base-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &[loading], + &:not([hover-class]):active { + color: $-color-white; + border-color: mix(darken($color,10%), $-color-white); + background-color: mix($color, $-color-white); + } + } + +} +@mixin base-plain-style($color) { + color:$color; + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 70%); + &:not([hover-class]):active { + background: mix($-color-white, $color, 80%); + color: $color; + outline: none; + border-color: mix($-color-white, $color, 50%); + } +} +@mixin is-plain($color){ + &[plain] { + @include base-plain-style($color); + &[loading] { + @include base-plain-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &:active { + color: mix($-color-white, $color, 40%); + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 80%); + } + } + } +} + + +.uni-btn { + margin: 5px; + color: #393939; + border:1px solid #ccc; + font-size: 16px; + font-weight: 200; + background-color: #F9F9F9; + // TODO 暂时处理边框隐藏一边的问题 + overflow: visible; + &::after{ + border: none; + } + + &:not([type]),&[type=default] { + color: #999; + &[loading] { + background: none; + &::before { + margin-right:5px; + } + } + + + + &[disabled]{ + color: mix($-color-white, #999, 60%); + &, + &[loading], + &:active { + color: mix($-color-white, #999, 60%); + background-color: mix($-color-white,$-color-black , 98%); + border-color: mix($-color-white, #999, 85%); + } + } + + &[plain] { + color: #999; + background: none; + border-color: $uni-border-1; + &:not([hover-class]):active { + background: none; + color: mix($-color-white, $-color-black, 80%); + border-color: mix($-color-white, $-color-black, 90%); + outline: none; + } + &[disabled]{ + &, + &[loading], + &:active { + background: none; + color: mix($-color-white, #999, 60%); + border-color: mix($-color-white, #999, 85%); + } + } + } + } + + &:not([hover-class]):active { + color: mix($-color-white, $-color-black, 50%); + } + + &[size=mini] { + font-size: 16px; + font-weight: 200; + border-radius: 8px; + } + + + + &.uni-btn-small { + font-size: 14px; + } + &.uni-btn-mini { + font-size: 12px; + } + + &.uni-btn-radius { + border-radius: 999px; + } + &[type=primary] { + @include is-color($uni-primary); + @include is-plain($uni-primary) + } + &[type=success] { + @include is-color($uni-success); + @include is-plain($uni-success) + } + &[type=error] { + @include is-color($uni-error); + @include is-plain($uni-error) + } + &[type=warning] { + @include is-color($uni-warning); + @include is-plain($uni-warning) + } + &[type=info] { + @include is-color($uni-info); + @include is-plain($uni-info) + } +} +/* #endif */ diff --git a/uni_modules/uni-scss/styles/setting/_text.scss b/uni_modules/uni-scss/styles/setting/_text.scss new file mode 100644 index 0000000..a34d08f --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_text.scss @@ -0,0 +1,24 @@ +@mixin get-styles($k,$c) { + @if $k == size or $k == weight{ + font-#{$k}:#{$c} + }@else{ + #{$k}:#{$c} + } +} + +@each $key, $child in $uni-headings { + /* #ifndef APP-NVUE */ + .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ + /* #ifdef APP-NVUE */ + .container .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ +} diff --git a/uni_modules/uni-scss/styles/setting/_variables.scss b/uni_modules/uni-scss/styles/setting/_variables.scss new file mode 100644 index 0000000..557d3d7 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_variables.scss @@ -0,0 +1,146 @@ +// @use "sass:math"; +@import '../tools/functions.scss'; +// 间距基础倍数 +$uni-space-root: 2 !default; +// 边框半径默认值 +$uni-radius-root:5px !default; +$uni-radius: () !default; +// 边框半径断点 +$uni-radius: map-deep-merge( + ( + 0: 0, + // TODO 当前版本暂时不支持 sm 属性 + // 'sm': math.div($uni-radius-root, 2), + null: $uni-radius-root, + 'lg': $uni-radius-root * 2, + 'xl': $uni-radius-root * 6, + 'pill': 9999px, + 'circle': 50% + ), + $uni-radius +); +// 字体家族 +$body-font-family: 'Roboto', sans-serif !default; +// 文本 +$heading-font-family: $body-font-family !default; +$uni-headings: () !default; +$letterSpacing: -0.01562em; +$uni-headings: map-deep-merge( + ( + 'h1': ( + size: 32px, + weight: 300, + line-height: 50px, + // letter-spacing:-0.01562em + ), + 'h2': ( + size: 28px, + weight: 300, + line-height: 40px, + // letter-spacing: -0.00833em + ), + 'h3': ( + size: 24px, + weight: 400, + line-height: 32px, + // letter-spacing: normal + ), + 'h4': ( + size: 20px, + weight: 400, + line-height: 30px, + // letter-spacing: 0.00735em + ), + 'h5': ( + size: 16px, + weight: 400, + line-height: 24px, + // letter-spacing: normal + ), + 'h6': ( + size: 14px, + weight: 500, + line-height: 18px, + // letter-spacing: 0.0125em + ), + 'subtitle': ( + size: 12px, + weight: 400, + line-height: 20px, + // letter-spacing: 0.00937em + ), + 'body': ( + font-size: 14px, + font-weight: 400, + line-height: 22px, + // letter-spacing: 0.03125em + ), + 'caption': ( + 'size': 12px, + 'weight': 400, + 'line-height': 20px, + // 'letter-spacing': 0.03333em, + // 'text-transform': false + ) + ), + $uni-headings +); + + + +// 主色 +$uni-primary: #2979ff !default; +$uni-primary-disable:lighten($uni-primary,20%) !default; +$uni-primary-light: lighten($uni-primary,25%) !default; + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37 !default; +$uni-success-disable:lighten($uni-success,20%) !default; +$uni-success-light: lighten($uni-success,25%) !default; + +$uni-warning: #f3a73f !default; +$uni-warning-disable:lighten($uni-warning,20%) !default; +$uni-warning-light: lighten($uni-warning,25%) !default; + +$uni-error: #e43d33 !default; +$uni-error-disable:lighten($uni-error,20%) !default; +$uni-error-light: lighten($uni-error,25%) !default; + +$uni-info: #8f939c !default; +$uni-info-disable:lighten($uni-info,20%) !default; +$uni-info-light: lighten($uni-info,25%) !default; + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a !default; // 主要文字 +$uni-base-color: #6a6a6a !default; // 常规文字 +$uni-secondary-color: #909399 !default; // 次要文字 +$uni-extra-color: #c7c7c7 !default; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0 !default; +$uni-border-2: #EDEDED !default; +$uni-border-3: #DCDCDC !default; +$uni-border-4: #B9B9B9 !default; + +// 常规色 +$uni-black: #000000 !default; +$uni-white: #ffffff !default; +$uni-transparent: rgba($color: #000000, $alpha: 0) !default; + +// 背景色 +$uni-bg-color: #f7f7f7 !default; + +/* 水平间距 */ +$uni-spacing-sm: 8px !default; +$uni-spacing-base: 15px !default; +$uni-spacing-lg: 30px !default; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4) !default; diff --git a/uni_modules/uni-scss/styles/tools/functions.scss b/uni_modules/uni-scss/styles/tools/functions.scss new file mode 100644 index 0000000..ac6f63e --- /dev/null +++ b/uni_modules/uni-scss/styles/tools/functions.scss @@ -0,0 +1,19 @@ +// 合并 map +@function map-deep-merge($parent-map, $child-map){ + $result: $parent-map; + @each $key, $child in $child-map { + $parent-has-key: map-has-key($result, $key); + $parent-value: map-get($result, $key); + $parent-type: type-of($parent-value); + $child-type: type-of($child); + $parent-is-map: $parent-type == map; + $child-is-map: $child-type == map; + + @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ + $result: map-merge($result, ( $key: $child )); + }@else { + $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); + } + } + @return $result; +}; diff --git a/uni_modules/uni-scss/theme.scss b/uni_modules/uni-scss/theme.scss new file mode 100644 index 0000000..80ee62f --- /dev/null +++ b/uni_modules/uni-scss/theme.scss @@ -0,0 +1,31 @@ +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; +// 主色 +$uni-primary: #2979ff; +// 辅助色 +$uni-success: #4cd964; +// 警告色 +$uni-warning: #f0ad4e; +// 错误色 +$uni-error: #dd524d; +// 描述色 +$uni-info: #909399; +// 中性色 +$uni-main-color: #303133; +$uni-base-color: #606266; +$uni-secondary-color: #909399; +$uni-extra-color: #C0C4CC; +// 背景色 +$uni-bg-color: #f5f5f5; +// 边框颜色 +$uni-border-1: #DCDFE6; +$uni-border-2: #E4E7ED; +$uni-border-3: #EBEEF5; +$uni-border-4: #F2F6FC; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); diff --git a/uni_modules/uni-scss/variables.scss b/uni_modules/uni-scss/variables.scss new file mode 100644 index 0000000..1c062d4 --- /dev/null +++ b/uni_modules/uni-scss/variables.scss @@ -0,0 +1,62 @@ +@import './styles/setting/_variables.scss'; +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; + +// 主色 +$uni-primary: #2979ff; +$uni-primary-disable:mix(#fff,$uni-primary,50%); +$uni-primary-light: mix(#fff,$uni-primary,80%); + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37; +$uni-success-disable:mix(#fff,$uni-success,50%); +$uni-success-light: mix(#fff,$uni-success,80%); + +$uni-warning: #f3a73f; +$uni-warning-disable:mix(#fff,$uni-warning,50%); +$uni-warning-light: mix(#fff,$uni-warning,80%); + +$uni-error: #e43d33; +$uni-error-disable:mix(#fff,$uni-error,50%); +$uni-error-light: mix(#fff,$uni-error,80%); + +$uni-info: #8f939c; +$uni-info-disable:mix(#fff,$uni-info,50%); +$uni-info-light: mix(#fff,$uni-info,80%); + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a; // 主要文字 +$uni-base-color: #6a6a6a; // 常规文字 +$uni-secondary-color: #909399; // 次要文字 +$uni-extra-color: #c7c7c7; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0; +$uni-border-2: #EDEDED; +$uni-border-3: #DCDCDC; +$uni-border-4: #B9B9B9; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); + +// 背景色 +$uni-bg-color: #f7f7f7; + +/* 水平间距 */ +$uni-spacing-sm: 8px; +$uni-spacing-base: 15px; +$uni-spacing-lg: 30px; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4); diff --git a/uni_modules/uni-steps/changelog.md b/uni_modules/uni-steps/changelog.md new file mode 100644 index 0000000..cb9d367 --- /dev/null +++ b/uni_modules/uni-steps/changelog.md @@ -0,0 +1,16 @@ +## 1.1.1(2021-11-22) +- 修复 vue3中某些scss变量无法找到的问题 +## 1.1.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-steps](https://uniapp.dcloud.io/component/uniui/uni-steps) +## 1.0.8(2021-05-12) +- 新增 项目示例地址 +## 1.0.7(2021-05-06) +- 修复 uni-steps 横向布局时,多行文字高度不合理的 bug +## 1.0.6(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.5(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-steps/components/uni-steps/uni-steps.vue b/uni_modules/uni-steps/components/uni-steps/uni-steps.vue new file mode 100644 index 0000000..a6c8f28 --- /dev/null +++ b/uni_modules/uni-steps/components/uni-steps/uni-steps.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/uni_modules/uni-steps/package.json b/uni_modules/uni-steps/package.json new file mode 100644 index 0000000..c687b40 --- /dev/null +++ b/uni_modules/uni-steps/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-steps", + "displayName": "uni-steps 步骤条", + "version": "1.1.1", + "description": "步骤条组件,提供横向和纵向两种布局格式。", + "keywords": [ + "uni-ui", + "uniui", + "步骤条", + "时间轴" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-steps/readme.md b/uni_modules/uni-steps/readme.md new file mode 100644 index 0000000..da7a4bf --- /dev/null +++ b/uni_modules/uni-steps/readme.md @@ -0,0 +1,13 @@ + + +## Steps 步骤条 +> **组件名:uni-steps** +> 代码块: `uSteps` + + +步骤条,常用于显示进度 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-steps) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-transition/changelog.md b/uni_modules/uni-transition/changelog.md new file mode 100644 index 0000000..b1a824b --- /dev/null +++ b/uni_modules/uni-transition/changelog.md @@ -0,0 +1,20 @@ +## 1.3.1(2021-11-23) +- 修复 init 方法初始化问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition) +## 1.2.1(2021-09-27) +- 修复 init 方法不生效的 Bug +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.1(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的 Bug +## 1.1.0(2021-04-22) +- 新增 通过方法自定义动画 +- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式 +- 优化 动画触发逻辑,使动画更流畅 +- 优化 支持单独的动画类型 +- 优化 文档示例 +## 1.0.2(2021-02-05) +- 调整为 uni_modules 目录规范 diff --git a/uni_modules/uni-transition/components/uni-transition/createAnimation.js b/uni_modules/uni-transition/components/uni-transition/createAnimation.js new file mode 100644 index 0000000..5f54365 --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/createAnimation.js @@ -0,0 +1,128 @@ +// const defaultOption = { +// duration: 300, +// timingFunction: 'linear', +// delay: 0, +// transformOrigin: '50% 50% 0' +// } +// #ifdef APP-NVUE +const nvueAnimation = uni.requireNativePlugin('animation') +// #endif +class MPAnimation { + constructor(options, _this) { + this.options = options + this.animation = uni.createAnimation(options) + this.currentStepAnimates = {} + this.next = 0 + this.$ = _this + + } + + _nvuePushAnimates(type, args) { + let aniObj = this.currentStepAnimates[this.next] + let styles = {} + if (!aniObj) { + styles = { + styles: {}, + config: {} + } + } else { + styles = aniObj + } + if (animateTypes1.includes(type)) { + if (!styles.styles.transform) { + styles.styles.transform = '' + } + let unit = '' + if(type === 'rotate'){ + unit = 'deg' + } + styles.styles.transform += `${type}(${args+unit}) ` + } else { + styles.styles[type] = `${args}` + } + this.currentStepAnimates[this.next] = styles + } + _animateRun(styles = {}, config = {}) { + let ref = this.$.$refs['ani'].ref + if (!ref) return + return new Promise((resolve, reject) => { + nvueAnimation.transition(ref, { + styles, + ...config + }, res => { + resolve() + }) + }) + } + + _nvueNextAnimate(animates, step = 0, fn) { + let obj = animates[step] + if (obj) { + let { + styles, + config + } = obj + this._animateRun(styles, config).then(() => { + step += 1 + this._nvueNextAnimate(animates, step, fn) + }) + } else { + this.currentStepAnimates = {} + typeof fn === 'function' && fn() + this.isEnd = true + } + } + + step(config = {}) { + // #ifndef APP-NVUE + this.animation.step(config) + // #endif + // #ifdef APP-NVUE + this.currentStepAnimates[this.next].config = Object.assign({}, this.options, config) + this.currentStepAnimates[this.next].styles.transformOrigin = this.currentStepAnimates[this.next].config.transformOrigin + this.next++ + // #endif + return this + } + + run(fn) { + // #ifndef APP-NVUE + this.$.animationData = this.animation.export() + this.$.timer = setTimeout(() => { + typeof fn === 'function' && fn() + }, this.$.durationTime) + // #endif + // #ifdef APP-NVUE + this.isEnd = false + let ref = this.$.$refs['ani'] && this.$.$refs['ani'].ref + if(!ref) return + this._nvueNextAnimate(this.currentStepAnimates, 0, fn) + this.next = 0 + // #endif + } +} + + +const animateTypes1 = ['matrix', 'matrix3d', 'rotate', 'rotate3d', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scale3d', + 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'translate', 'translate3d', 'translateX', 'translateY', + 'translateZ' +] +const animateTypes2 = ['opacity', 'backgroundColor'] +const animateTypes3 = ['width', 'height', 'left', 'right', 'top', 'bottom'] +animateTypes1.concat(animateTypes2, animateTypes3).forEach(type => { + MPAnimation.prototype[type] = function(...args) { + // #ifndef APP-NVUE + this.animation[type](...args) + // #endif + // #ifdef APP-NVUE + this._nvuePushAnimates(type, args) + // #endif + return this + } +}) + +export function createAnimation(option, _this) { + if(!_this) return + clearTimeout(_this.timer) + return new MPAnimation(option, _this) +} diff --git a/uni_modules/uni-transition/components/uni-transition/uni-transition.vue b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue new file mode 100644 index 0000000..0d739bd --- /dev/null +++ b/uni_modules/uni-transition/components/uni-transition/uni-transition.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/uni_modules/uni-transition/package.json b/uni_modules/uni-transition/package.json new file mode 100644 index 0000000..d15fdf0 --- /dev/null +++ b/uni_modules/uni-transition/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-transition", + "displayName": "uni-transition 过渡动画", + "version": "1.3.1", + "description": "元素的简单过渡动画", + "keywords": [ + "uni-ui", + "uniui", + "动画", + "过渡", + "过渡动画" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-transition/readme.md b/uni_modules/uni-transition/readme.md new file mode 100644 index 0000000..2f8a77e --- /dev/null +++ b/uni_modules/uni-transition/readme.md @@ -0,0 +1,11 @@ + + +## Transition 过渡动画 +> **组件名:uni-transition** +> 代码块: `uTransition` + + +元素过渡动画 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-transition) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/utils/eventBus.js b/utils/eventBus.js new file mode 100644 index 0000000..fe12d90 --- /dev/null +++ b/utils/eventBus.js @@ -0,0 +1,48 @@ +/** + * eventBus + */ +class EventBus { + constructor() { + this.events = {} + } + /** + * @description: on + */ + on(event, callback) { + if (!this.events[event]) { + this.events[event] = [] + } + this.events[event].push(callback) + } + /** + * @description: once + */ + once(event, callback) { + const fn = (...args) => { + callback(...args) + this.off(event, fn) + } + this.on(event, fn) + } + /** + * @description: off + */ + off(event, callback) { + if (!this.events[event]) { + return + } + this.events[event] = this.events[event].filter((cb) => cb !== callback) + } + /** + * @description: emit + */ + emit(event, ...args) { + if (!this.events[event]) { + return + } + this.events[event].forEach((cb) => cb(...args)) + } +} + +const eventBus = new EventBus() +export default eventBus diff --git a/utils/hook.js b/utils/hook.js new file mode 100644 index 0000000..4fa6d9b --- /dev/null +++ b/utils/hook.js @@ -0,0 +1,421 @@ +import store from '@/store/index' +import { uploadUrl, XAPPID, enterpriseType } from '@/enums/index.js' +import { pushCustomerOff } from '@/apis/commonApi' +import { debounce, parseUrl } from '@/utils/index' +// 框架方法封装 +const tabList = ['index', 'order', 'mine', 'category'] + +/** + * @param {string} 返回上一级 + * @return {null} + */ +export function back() { + if (getCurrentPages().length > 1) { + uni.navigateBack({ + delta: 1 + }) + } else { + go2('index') + } +} + +/** + * 获取当前页面 + */ +export function getActivePage() { + const curPages = getCurrentPages() + if (curPages.length) { + return curPages[curPages.length - 1] + } + return null +} + +/** + * 跳转到指定页面,包括tabBar页面 + * @param {string} url 页面名称 + * @param {object} data 页面参数 + * @param {boolean} isRedirect 是否重定向 默认false + * @param {boolean} isReLaunch 是否重新加载 默认false + * @return {null} + */ +export function go2(url, data = {}, isRedirect = false, isReLaunch = false) { + if (!url) { + console.error('请选择页面') + return + } + let param = '' + Object.keys(data).forEach((key) => { + let value = data[key] + let type = typeof value + if (type === 'object') { + value = JSON.stringify(value) + } + if (param === '') { + param = `${key}=${value}` + } else { + param += `&${key}=${value}` + } + }) + if (isReLaunch) { + uni.reLaunch({ + url: `/pages/${url}/index${param ? '?' + param : ''}` + }) + return + } + if (tabList.includes(url)) { + uni.switchTab({ + url: `/pages/${url}/index${param ? '?' + param : ''}` + }) + } else { + if (isRedirect) { + uni.redirectTo({ + url: `/pages/${url}/index${param ? '?' + param : ''}` + }) + } else { + uni.navigateTo({ + url: `/pages/${url}/index${param ? '?' + param : ''}` + }) + } + } +} + +/** + * 跳转到指定页面,包括tabBar页面,校验是否已登录,未登录则跳转到登录页面 + * @param {string} url 页面名称 + * @param {object} data 页面参数 + * @param {string} isRedirect 是否重定向 默认false + * @return {null} + */ +export function loginGo2(url, data = {}, isRedirect = false) { + const token = store.state.qnToken + if (token) { + go2(url, data, isRedirect) + } else { + store.commit('setNextPage', { name: url, data }) + go2('login') + } +} + +/** + * 重定向到登陆页面 + */ +export const redirectLogin = debounce(() => { + let pages = getCurrentPages() + let curPage = pages[pages.length - 1] + let fullPath = curPage.$page.fullPath + const { host, query } = parseUrl(fullPath) + if (host) { + let reg = /\/pages\/(.*)\/index/ + let path = reg.exec(host)[1] + if (path !== 'login') { + go2('login', { target: path, data: JSON.stringify(query) }, false, true) + } + } +}, 300) + +/** + * 退出登录并跳转到登录页面 + * @return {null} + */ +export function exit(redirect = false) { + // #ifdef APP-PLUS + let cid = plus.push.getClientInfo().clientid + let platform = uni.getSystemInfoSync().platform + pushCustomerOff(cid, platform) + // #endif + store.dispatch('logout') + go2('login', {}, redirect) +} + +/** + * 图片文件上传 + * @param {array} sourceType 上传的方式 album:相册 camera:相机 + * @param {number} count 上传的数量 + * @return {Promise} 以数组的形式返回对应的文件地址 + */ +export function uploadImage(sourceType = ['album', 'camera'], count = 1) { + return new Promise((resolve, reject) => { + uni.chooseImage({ + count: count, + sizeType: ['original', 'compressed'], + sourceType: sourceType, + success: (res) => { + const tempFilePaths = res.tempFilePaths + let cache = tempFilePaths.map((path) => { + return uploadFile(path, 'image') + }) + Promise.all(cache) + .then((result) => { + resolve(result) + }) + .catch((err) => { + reject(err) + }) + }, + fail: (err) => { + console.error('chooseImage error:', err) + resolve(null) + } + }) + }) +} + +/** + * 视频文件上传 + * @param {array} sourceType 上传的方式 album:相册 camera:相机 + * @param {boolean} compressed 是否压缩 + * @return {Promise} 返回对应的文件地址 + * @value {string} url 视频地址 + * @value {string} thumb 视频缩略图地址 + */ +export function uploadVideo(sourceType = ['album', 'camera'], compressed = true) { + return new Promise((resolve, reject) => { + uni.chooseVideo({ + compressed, + sourceType: sourceType, + maxDuration: 30, + success: (res) => { + const tempFilePath = res.tempFilePath + console.log('video size:', res, res.size) + if (res.size && res.size > 1024 * 1024 * 10) { + reject('视频大小不能超过10M') + } else { + uploadFile(tempFilePath, 'video') + .then((result) => { + resolve(result) + }) + .catch((err) => { + reject(err) + }) + } + }, + fail: (err) => { + console.error('chooseImage error:', err) + resolve(null) + } + }) + }) +} + +/** + * 单文件上传 + * @param {string} path 文件路径 + * @param {string} type 文件类型 image | file,默认为image + * @returns {Promise} 返回单文件上传地址 + */ +export function uploadFile(path, type = 'image') { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: uploadUrl[type], + filePath: path, + name: type == 'image' ? 'image' : 'file', + header: { + Authorization: store.state.qnToken, + 'X-APP-ID': XAPPID + }, + // fileType: type, + success: (res) => { + let result = JSON.parse(res.data) + if (result.data) { + if (type == 'video') { + resolve({ + url: result.data.videoFileUrl, + thumb: result.data.videoImgUrl + }) + } else { + resolve(result.data) + } + } else { + reject(result.message) + } + }, + fail: (err) => { + console.error('uploadFile error:', err) + reject(err) + } + }) + }) +} + +/** + * 屏幕截图并保存到相册(不包含状态栏和tabBar),原理就是用webview的draw方法 + */ +export function screenShot() { + let pages = getCurrentPages() + let page = pages[pages.length - 1] + let bitmap = null + // 获取当前页面 webview 的对象实例 + let currentWebview = page.$getAppWebview() + bitmap = new plus.nativeObj.Bitmap('amway_img') + // 将webview内容绘制到Bitmap对象中 + currentWebview.draw( + bitmap, + function () { + console.log('截屏绘制图片成功') + bitmap.save( + '_doc/a.jpg', + {}, + function (i) { + uni.saveImageToPhotosAlbum({ + filePath: i.target, + success: function () { + bitmap.clear() //销毁Bitmap图片 + uni.showToast({ + title: '保存图片成功', + mask: false, + duration: 1500 + }) + } + }) + }, + function (e) { + uni.showToast({ + title: '保存图片失败,请手动截图', + mask: false, + duration: 1500 + }) + } + ) + }, + function (e) { + uni.showToast({ + title: '保存图片失败,请手动截图', + mask: false, + duration: 1500 + }) + } + ) +} + +/** + * 判断是否授权相册并保存图片base64到相册 + * @param {string} base64 图片base64 + */ +export function saveImage(base64) { + saveBase64ToTempFile(base64).then((url) => { + saveImageToPhotosAlbum(url) + }) +} + +/** + * 将base64保存为临时文件,并返回文件路径 + * @param {string} base64 + * @returns + */ +export function saveBase64ToTempFile(base64) { + return new Promise((resolve, reject) => { + const bitmap = new plus.nativeObj.Bitmap('img') + bitmap.loadBase64Data(base64, () => { + const url = '_doc/' + new Date().getTime() + '.png' + bitmap.save( + url, + { + overwrite: true + }, + () => { + bitmap.clear() + resolve(url) + }, + (e) => { + reject(e) + } + ) + }) + }) +} + +/** + * 保存图片到相册 + * @param {string} path 图片路径 + */ +export function saveImageToPhotosAlbum(path) { + return new Promise((resolve, reject) => { + uni.saveImageToPhotosAlbum({ + filePath: path, + success: (res) => { + uni.showToast({ + title: '保存图片成功', + mask: false, + duration: 1500 + }) + resolve() + }, + fail: (err) => { + uni.showToast({ + title: '保存图片失败,请手动截图', + mask: false, + duration: 1500 + }) + resolve() + } + }) + }) +} + +/** + * 根据类型获取缓存 + * @param {string} type 缓存类型 + * @returns object 缓存数据 + */ +export function getCache(type) { + let data = null + if (store.state.cache.type === type) { + data = store.state.cache.data + // 防止同一事件循环的数据竞争 + setTimeout(() => { + store.commit('resetCache') + }) + } + return data +} + +/** + * 设置缓存 + * @param {string} type 缓存类型 + * @param {object} data 缓存数据 + * @returns null + */ +export function setCache(type, data) { + store.commit('setCache', { type, data }) +} + +/** + * 根据后端统一的skuList转化为前端需要的skuList + * @param {array} list + * @returns {array} skuList + */ +export function transformSku(list) { + let skuList = [] + list.forEach((item) => { + let sku = { + id: item.id, + stock: item.stock, + scribingPrice: item.scribingPrice, + listPrice: item.listPrice + } + let attrs = {} + item.attrList.forEach((attr) => { + attrs[attr.skuAttrId] = { + value: attr.skuAttrValueId, + extraInfo: attr + } + }) + skuList.push({ ...sku, attrs }) + }) + return skuList +} + +/** + * 跳转到微信客服 + */ +export function jumpService(info) { + // #ifdef MP-WEIXIN + wx.openCustomerServiceChat(info || { extInfo: { url: 'https://work.weixin.qq.com/kfid/kfca1fe7388697db25c' }, corpId: 'wwe1732a63029fe997' }) + // #endif + + // #ifndef MP-WEIXIN + uni.showToast({ + title: '请在微信中打开' + }) + // #endif +} diff --git a/utils/http/http.js b/utils/http/http.js new file mode 100644 index 0000000..586990f --- /dev/null +++ b/utils/http/http.js @@ -0,0 +1,137 @@ +import { isFunction } from '../is.js' +import env from '@/env/index.js' +const urlEnv = env === 'production' ? '' : `-${env}` +const uploadUrl = `https://api-ops-yyt${urlEnv}.qniao.cn/cloud-print-user-center/utils/uploadImage` +export default class Http { + constructor(config = {}, { reqInterceptor, resInterceptor, transformConfig } = {}) { + this.baseUrl = config.baseUrl + this.header = config.header || { + 'content-type': 'application/json;charset=UTF-8' + } + this.requestOption = config.requestOption || {} + this.reqInterceptor = reqInterceptor + this.resInterceptor = resInterceptor + this.transformConfig = transformConfig + } + post(config, options) { + return this.request( + { + method: 'POST', + ...config + }, + options + ) + } + get(config, options) { + return this.request( + { + method: 'GET', + ...config + }, + options + ) + } + /** + * @param {Object} config 和请求相关的参数 + * @param {Object} options 对请求数据进行额外处理的参数 + */ + request(config, options) { + let conf = Object.assign({}, config) + const { transformConfig, reqInterceptor, resInterceptor } = this + if (transformConfig && isFunction(transformConfig)) { + conf = transformConfig(this, config) + } + let opt = Object.assign({}, this.requestOption, options) + if (reqInterceptor && isFunction(reqInterceptor)) { + conf = reqInterceptor(conf, opt) + } + return new Promise((resolve, reject) => { + uni.request({ + url: conf.url, + data: conf.data, + // enableHttpDNS: openHttpDNS && hasHttpDNSQuota && !hasSystemProxy, + // httpDNSServiceId: 'wxa410372c837a5f26', + timeout: conf.timeout || 5000, + header: conf.header, + method: conf.method, + success: (res) => { + let data = resInterceptor(res, opt) + if (data === null) { + console.log('报错的请求参数:', conf) + let error = res + // 组装一下错误 + if (res.data && res.data.message) { + error = { + message: res.data.message, + code:res.data.code + } + } + reject(error) + return + } + // 服务器错误也会用then抛出,需要自己判断data==null + resolve(data) + }, + fail: (err) => { + if (err.errno === 5) { + uni.showToast({ + title: '网络异常,请重新进入小程序', + icon: 'none', + duration: 2000 + }) + } + // httpDNS额度用完 + else if (err.errno === 602103) { + // hasHttpDNSQuota = false + this.request(config, options) + } else { + uni.showToast({ + title: '服务器正在维护中,请在首页联系客服', + icon: 'none', + duration: 2000 + }) + } + reject(err) + } + }) + }).catch((err) => { + // 不会再进入后面传递的then函数了 + return Promise.reject(err) + }) + } + // config:{} + uploadFile(config, options) { + return new Promise((resolve, reject) => { + let conf = Object.assign({}, config) + conf.url = uploadUrl + const { reqInterceptor } = this + let opt = Object.assign({}, this.requestOption, options) + if (reqInterceptor && isFunction(reqInterceptor)) { + conf = reqInterceptor(conf, opt) + } + delete conf.header['Content-Type'] + uni.uploadFile({ + url: conf.url, + header: { + ...conf.header, + image: config.data.filePath + // 'Content-Type': 'image/png' + }, + filePath: config.data.filePath, + name: config.data.fileName || 'image', + formData: { + image: config.data.filePath + }, + success: (res) => { + uni.hideLoading() + resolve(res.data) + }, + fail: (err) => { + reject(err) + } + }) + }).catch((err) => { + console.error('upload native err', err) + }) + } +} diff --git a/utils/http/index.js b/utils/http/index.js new file mode 100644 index 0000000..0ab971e --- /dev/null +++ b/utils/http/index.js @@ -0,0 +1,150 @@ +import Http from './http.js' +import env from '@/env/index.js' +import { XAPPID, encryptType } from '@/enums/index.js' +import { md5 } from '@/utils/md5.js' +import { redirectLogin } from '@/utils/hook' + +// 请求封装文件 +const urlEnv = env === 'production' ? '' : `-${env}` +/** + * 系统默认的请求域名 + */ +export const baseUrl = `https://api-client-yyt${urlEnv}.qniao.cn` +// 请求url列表 +const prefixList = { + // '/yyt-uec': `https://api-client-yyt${urlEnv}.qniao.cn`, + // '/base-paper-trading': `https://api-client-yyt${urlEnv}.qniao.cn`, + '/uec': `https://api-client-uec${urlEnv}.qniao.cn` + // '/document': `https://api-client-yyt${urlEnv}.qniao.cn`, + // '/cloud-print-user-center':`https://api-client-yyt${urlEnv}.qniao.cn` +} + +const config = { + baseUrl: '', + header: { + 'content-type': 'application/json;charset=UTF-8' + }, + requestOption: { + // 是否需要隐藏loading + hideLoading: false, + // 是否需要自定义错误提醒 + customToast: false, + // 是否返回原始数据 + isReturnNativeResponse: false, + // 需要对返回数据进行处理 + isTransformResponse: true, + // 是否加密 + isEncrypt: false + } +} + +// 请求拦截 +const reqInterceptor = (config, options) => { + const { url } = config + // 添加token + let token = '' + try { + if (url.startsWith('uec')) { + token = uni.getStorageSync('uecToken') + } else { + token = uni.getStorageSync('qnToken') + } + } catch (e) { + console.error('获取缓存失败:', e) + } + config.header = { + ...config.header, + Authorization: token || '', + 'X-APP-ID': XAPPID + } + // 改变url + let newUrl = '' + if (url.startsWith('http')) { + newUrl = url + } else { + let hit = false + for (let key in prefixList) { + if (url.startsWith(key)) { + newUrl = prefixList[key] + url + hit = true + break + } + } + if (!hit) { + newUrl = baseUrl + url + } + } + config.url = newUrl + if (!options.hideLoading) { + uni.showLoading({ + title: '加载中...' + }) + } + if (options.isEncrypt) { + let data = config.data + const signStr = JSON.stringify(data) + const signStrMore = `&Authorization=${token}&X-APP-ID=${XAPPID}` + const sign = md5(JSON.stringify(data) + signStrMore) + data.sign = sign + data.signStr = signStr + data.signType = encryptType.MD5 + } + return config +} + +// 响应拦截 +const resInterceptor = (response, options) => { + uni.hideLoading() + if (options.isReturnNativeResponse) { + return response + } + // 直接返回 {code,data,message} + if (!options.isTransformResponse) { + return response.data + } + const { statusCode } = response + const res = response.data + if (statusCode >= 200 && statusCode < 300) { + if (res.code == 0) { + // 将成功的null置位1 + return res.data === null ? 1 : res.data + } else if (res.code == 401) { + // 重定向到登陆 + redirectLogin() + } else { + handleToast(options) + } + } else { + handleToast(options) + } + return null +} + +function handleToast(options) { + if (options.customToast) return + uni.showToast({ + title: '服务器正在维护中,请在首页联系客服', + icon: 'none', + duration: 2000 + }) +} + +const transformConfig = (ins, config) => { + let conf = { + ...config + } + conf.baseUrl = config.baseUrl || ins.baseUrl || '' + conf.header = config.header || ins.header + conf.method = config.method || 'GET' + conf.data = config.data || config.params || {} + conf.dataType = config.dataType || 'json' + conf.responseType = config.responseType || 'text' + return conf +} +const http = new Http(config, { + reqInterceptor, + resInterceptor, + transformConfig +}) + +export default http diff --git a/utils/index.js b/utils/index.js new file mode 100644 index 0000000..5fb58c7 --- /dev/null +++ b/utils/index.js @@ -0,0 +1,480 @@ +import env from '@/env/index.js' +import store from '@/store/index.js' +import { isDate, isString, isArray } from './is.js' +/** + * 日期格式化,样例 yyyy-mm-dd hh:MM:ss + * @param date Date 需要转换的日期 + * @param fmt string 转化的格式 yyyy-mm-dd hh:MM:ss + */ +export const dateTimeFormat = (date, fmt) => { + if (isString(date)) { + date = date.replace(/-/g, '/') + } + if (!isDate(date)) { + date = new Date(date) + } + if (!date || isNaN(date.getTime())) { + throw new Error('日期不正确') + } + let ret + const opt = { + 'y+': date.getFullYear().toString(), // 年 + 'm+': (date.getMonth() + 1).toString(), // 月 + 'd+': date.getDate().toString(), // 日 + 'h+': date.getHours().toString(), // 时 + 'M+': date.getMinutes().toString(), // 分 + 's+': date.getSeconds().toString() // 秒 + } + for (let k in opt) { + ret = new RegExp('(' + k + ')').exec(fmt) + if (ret) { + fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')) + } + } + return fmt +} +/** + * 日期格式化文字描述,样例 yyyy-mm-dd hh:MM:ss + * @param stringTime 需要转换的日期 + */ +export const getTimer = (stringTime) => { + let minute = 1000 * 60 + let hour = minute * 60 + let day = hour * 24 + let week = day * 7 + let month = day * 30 + let time1 = new Date().getTime() //当前的时间戳 + let time2 = Date.parse(new Date(stringTime)) //指定时间的时间戳 + let time = time1 - time2 + + let result = null + if (time / month >= 1) { + result = parseInt(time / month) + '月前' + } else if (time / week >= 1) { + result = parseInt(time / week) + '周前' + } else if (time / day >= 1) { + result = parseInt(time / day) + '天前' + } else if (time / hour >= 1) { + result = parseInt(time / hour) + '小时前' + } else if (time / minute >= 1) { + result = parseInt(time / minute) + '分钟前' + } else { + result = '刚刚' + } + return result +} + +/** + * 创建websocket + * @param {*} data + * @value {string} pageInfo 页面信息 + * @value {true} retry 是否重连,默认false + * @returns 一个websocket实例 + */ +export const makeSocket = async ({ pageInfo = '', retry = false }) => { + const socket = { + sockTask: null, + close: function () { + this.sockTask.close({ + code: 1000 + }) + closeFlag = true + }, + onMessage: function () { + console.log('onMessage') + }, + onError: function () { + console.log('onError') + }, + onRetry: function () { + console.log('onRetry') + } + } + + let limitedNum = 0 + let closeFlag = false + let timer = null + + async function createSocket() { + let url = '' + if (env == 'production') { + url = 'wss://api-client-yyt.qniao.cn/qn-websocket-service/wechatwebsock?token=' + } else if (env == 'test') { + url = 'wss://api-client-yyt-test.qniao.cn/qn-websocket-service/wechatwebsock?token=' + } + const token = store.state.qnToken + const socketTask = await uni.connectSocket({ + url: `${url}${token}`, + header: { + 'content-type': 'application/json' + }, + success: () => { + console.log('websocket连接成功') + }, + fail: () => { + console.log('websocket连接失败') + } + }) + socketTask.onOpen(() => { + console.log(pageInfo + ' onOpen') + timer = setInterval(() => { + socketTask.send({ + data: 'ping' + }) + }, 10000) + }) + socketTask.onClose(() => { + console.log(pageInfo + ' onClose') + clearInterval(timer) + timer = null + if (!closeFlag && retry && limitedNum < 20) { + limitedNum++ + console.log('重连次数:' + limitedNum) + createSocket().then(() => { + installSocket() + socket.onRetry() + }) + } + }) + + socket.sockTask = socketTask + } + + await createSocket() + function installSocket() { + if (socket.sockTask) { + socket.onMessage = (fn) => { + socket.sockTask.onMessage((res) => { + let data = JSON.parse(res.data) + console.log(pageInfo + '接收到消息:', data) + if (data.type != 'heartbeat') { + fn(data) + } + }) + } + socket.onError = (fn) => { + socket.sockTask.onError((err) => { + fn(err) + }) + } + } + } + installSocket() + + return socket +} + +let _boundaryCheckingState = true + +/** + * {beyond:是否超出目标时间,day:天,hours:小时,minutes:分钟,seconds:秒钟} + * @param time 计算时间 + * @param target 对照时间 + * @returns 时间差对象 + */ +export const difTime = (time, target) => { + if (isString(time)) { + time = time.replace(/-/g, '/') + } + if (isString(target)) { + target = target.replace(/-/g, '/') + } + let begin = new Date(time).getTime() + // 兼容ios时间 + let end = new Date(target).getTime() + let beyond = begin < end ? false : true + let diff = Math.abs(begin - end) + // 计算天数 + let day = Math.floor(diff / (24 * 3600 * 1000)) + day != day ? (day = 0) : '' + diff = diff % (24 * 3600 * 1000) + // 计算小时数 + let hours = Math.floor(diff / (3600 * 1000)) + hours != hours ? (hours = 0) : '' + diff = diff % (3600 * 1000) + // 计算分钟数 + let minutes = Math.floor(diff / (60 * 1000)) + minutes != minutes ? (minutes = 0) : '' + diff = diff % (60 * 1000) + // 计算秒数 + let seconds = Math.floor(diff / 1000) + seconds != seconds ? (seconds = 0) : '' + return { + beyond, + day, + hours, + minutes, + seconds + } +} + +/** + * 迭代操作 + */ +function iteratorOperation(arr, operation) { + const [num1, num2, ...others] = arr + let res = operation(num1, num2) + + others.forEach((num) => { + res = operation(res, num) + }) + + return res +} + +/** + * Return digits length of a number + * @param {*number} num Input number + */ +function digitLength(num) { + // Get digit length of e + const eSplit = num.toString().split(/[eE]/) + const len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0) + return len > 0 ? len : 0 +} + +/** + * 把错误的数据转正 + * strip(0.09999999999999998)=0.1 + */ +function strip(num, precision = 15) { + return +parseFloat(Number(num).toPrecision(precision)) +} + +/** + * 把小数转成整数,支持科学计数法。如果是小数则放大成整数 + * @param {*number} num 输入数 + */ +function float2Fixed(num) { + if (num.toString().indexOf('e') === -1) { + return Number(num.toString().replace('.', '')) + } + const dLen = digitLength(num) + return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num) +} + +/** + * 检测数字是否越界,如果越界给出提示 + * @param {*number} num 输入数 + */ +function checkBoundary(num) { + if (_boundaryCheckingState) { + if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) { + console.warn(`${num} is beyond boundary when transfer to integer, the results may not be accurate`) + } + } +} + +/** + * 精确乘法 + */ +function times(...nums) { + if (nums.length > 2) { + return iteratorOperation(nums, times) + } + + const [num1, num2] = nums + const num1Changed = float2Fixed(num1) + const num2Changed = float2Fixed(num2) + const baseNum = digitLength(num1) + digitLength(num2) + const leftValue = num1Changed * num2Changed + + checkBoundary(leftValue) + + return leftValue / Math.pow(10, baseNum) +} + +/** + * 精确除法 + */ +function divide(...nums) { + if (nums.length > 2) { + return iteratorOperation(nums, divide) + } + + const [num1, num2] = nums + const num1Changed = float2Fixed(num1) + const num2Changed = float2Fixed(num2) + checkBoundary(num1Changed) + checkBoundary(num2Changed) + // fix: 类似 10 ** -4 为 0.00009999999999999999,strip 修正 + return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1)))) +} + +/** + * 精确四舍五入 + */ +export const round = (num, ratio) => { + const base = Math.pow(10, ratio) + let result = divide(Math.round(Math.abs(times(num, base))), base) + if (num < 0 && result !== 0) { + result = times(result, -1) + } + return result +} + +/** + * 根据规则校验字段 + * @param {*} value 输入值 + * @param {array} rules 规则集 {type,required,message} + * @value {boolean} required 是否必填 + * @value {string} type 字段类型校验,目前支持 phone + * @returns {object} {isValid,msg} + */ +export const validateField = (value, rules) => { + let isValid = true + let msg = '' + for (let rule of rules) { + if (rule.required) { + if (value === '' || value === undefined || value === null) { + isValid = false + msg = rule.message + break + } + if (isArray(value) && value.length === 0) { + isValid = false + msg = rule.message + break + } + } + if (rule.type === 'phone' && value !== '' && !/^1[3456789]\d{9}$/.test(value)) { + isValid = false + msg = rule.message + break + } + } + return { + isValid, + msg + } +} + +/** + * 正确数字保留几位小数显示 + * @param {(number | string)} value 要修正的对象 + * @param {number} precision 保留位数 + * @returns {string} + */ +export const numToString = function (value, precision = 2) { + const zeros = '00000000000000' + let temp = '' + try { + temp = round(value, precision) + '' + let dot = temp.indexOf('.') + if (dot == -1) { + temp = temp + '.' + zeros.substring(0, 0 + precision) + } else { + // 计算差几个0,精度 - 现有位数 + let digits = precision - (temp.length - dot - 1) + digits > 0 ? (temp = temp + zeros.substring(0, digits)) : '' + } + } catch (error) { + console.log('数字格式错误') + return value + } + return temp +} + +/** + * 简易版防抖函数 + * @param {Function} fn 函数 + * @param {number} delay 延迟时间 + * @returns {Function} + */ +export function debounce(fn, delay) { + let timer = null + return function (...args) { + if (timer) { + clearTimeout(timer) + timer = null + } + timer = setTimeout(() => { + timer = null + fn.apply(this, args) + }, delay) + } +} + +/** + * 简易版节流函数,可以带异步数据返回 + * @param {Function} fn 函数,如果需要返回内容则需要返回Promise,并在then中return内容 + * @param {number} delay 延迟时间单位毫秒 + */ +export function throttle(fn, delay) { + let timer = null, + first = true, + result = null, + lastInvokeTime = 0, + remainingTime = null + return function (...args) { + if (first) { + result = fn.apply(this, args) + first = false + lastInvokeTime = Date.now() + return result + } + // 如果上次调用时间与当前时间差大于等于delay,则直接执行 + if (Date.now() - lastInvokeTime >= delay) { + result = fn.apply(this, args) + lastInvokeTime = Date.now() + return result + } else { + remainingTime = delay - (Date.now() - lastInvokeTime) + if (timer) { + clearTimeout(timer) + createTimer.call(this, remainingTime, args) + } else { + createTimer.call(this, remainingTime, args) + } + } + + return result + } + + function createTimer(time, args) { + timer = null + timer = setTimeout(() => { + result = fn.apply(this, args) + timer = null + lastInvokeTime = Date.now() + }, time) + } +} + +/** + * 简易的解析地址的函数 + * @param {string} url 需要解析的url地址 + * @returns {object} {host,query} + */ +export function parseUrl(url) { + let query = {} + let host = url + if (url.indexOf('?') > -1) { + host = url.substring(0, url.indexOf('?')) + let str = url.split('?')[1] + let arr2 = str.split('&') + arr2.forEach((item) => { + let arr3 = item.split('=') + query[arr3[0]] = arr3[1] + }) + } + return { host, query } +} + +/** + * 获取数组的所有子集 + * @param {Array} arr 数组 + * @returns Array> + */ +export function getAllSubsets(arr) { + let res = [[]] + for (let item of arr) { + const tempRes = res.map((subset) => { + const one = subset.concat([]) + one.push(item) + return one + }) + res = res.concat(tempRes) + } + return res +} diff --git a/utils/is.js b/utils/is.js new file mode 100644 index 0000000..9ff756c --- /dev/null +++ b/utils/is.js @@ -0,0 +1,25 @@ +const toString = Object.prototype.toString + +export function is(val, type) { + return toString.call(val) === `[object ${type}]` +} + +export function isFunction(val) { + return is(val, 'Function') +} + +export function isObject(val) { + return is(val, 'Object') +} + +export function isArray(val) { + return is(val, 'Array') +} + +export function isDate(val) { + return is(val, 'Date') +} + +export function isString(val) { + return is(val, 'String') +} diff --git a/utils/md5.js b/utils/md5.js new file mode 100644 index 0000000..3281de6 --- /dev/null +++ b/utils/md5.js @@ -0,0 +1,223 @@ +export function md5(string) { + function RotateLeft(lValue, iShiftBits) { + return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)) + } + + function AddUnsigned(lX, lY) { + let lX4, lY4, lX8, lY8, lResult + lX8 = lX & 0x80000000 + lY8 = lY & 0x80000000 + lX4 = lX & 0x40000000 + lY4 = lY & 0x40000000 + lResult = (lX & 0x3fffffff) + (lY & 0x3fffffff) + if (lX4 & lY4) { + return lResult ^ 0x80000000 ^ lX8 ^ lY8 + } + if (lX4 | lY4) { + if (lResult & 0x40000000) { + return lResult ^ 0xc0000000 ^ lX8 ^ lY8 + } else { + return lResult ^ 0x40000000 ^ lX8 ^ lY8 + } + } else { + return lResult ^ lX8 ^ lY8 + } + } + + function F(x, y, z) { + return (x & y) | (~x & z) + } + function G(x, y, z) { + return (x & z) | (y & ~z) + } + function H(x, y, z) { + return x ^ y ^ z + } + function I(x, y, z) { + return y ^ (x | ~z) + } + + function FF(a, b, c, d, x, s, ac) { + a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)) + return AddUnsigned(RotateLeft(a, s), b) + } + + function GG(a, b, c, d, x, s, ac) { + a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)) + return AddUnsigned(RotateLeft(a, s), b) + } + + function HH(a, b, c, d, x, s, ac) { + a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)) + return AddUnsigned(RotateLeft(a, s), b) + } + + function II(a, b, c, d, x, s, ac) { + a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)) + return AddUnsigned(RotateLeft(a, s), b) + } + + function ConvertToWordArray(string) { + let lWordCount + let lMessageLength = string.length + let lNumberOfWords_temp1 = lMessageLength + 8 + let lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64 + let lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16 + let lWordArray = Array(lNumberOfWords - 1) + let lBytePosition = 0 + let lByteCount = 0 + while (lByteCount < lMessageLength) { + lWordCount = (lByteCount - (lByteCount % 4)) / 4 + lBytePosition = (lByteCount % 4) * 8 + lWordArray[lWordCount] = lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition) + lByteCount++ + } + lWordCount = (lByteCount - (lByteCount % 4)) / 4 + lBytePosition = (lByteCount % 4) * 8 + lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition) + lWordArray[lNumberOfWords - 2] = lMessageLength << 3 + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29 + return lWordArray + } + + function WordToHex(lValue) { + let WordToHexValue = '', + WordToHexValue_temp = '', + lByte, + lCount + for (lCount = 0; lCount <= 3; lCount++) { + lByte = (lValue >>> (lCount * 8)) & 255 + WordToHexValue_temp = '0' + lByte.toString(16) + WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2) + } + return WordToHexValue + } + + function Utf8Encode(string) { + string = string.replace(/\r\n/g, '\n') + let utftext = '' + + for (let n = 0; n < string.length; n++) { + let c = string.charCodeAt(n) + + if (c < 128) { + utftext += String.fromCharCode(c) + } else if (c > 127 && c < 2048) { + utftext += String.fromCharCode((c >> 6) | 192) + utftext += String.fromCharCode((c & 63) | 128) + } else { + utftext += String.fromCharCode((c >> 12) | 224) + utftext += String.fromCharCode(((c >> 6) & 63) | 128) + utftext += String.fromCharCode((c & 63) | 128) + } + } + + return utftext + } + + let k, AA, BB, CC, DD, a, b, c, d + let S11 = 7, + S12 = 12, + S13 = 17, + S14 = 22 + let S21 = 5, + S22 = 9, + S23 = 14, + S24 = 20 + let S31 = 4, + S32 = 11, + S33 = 16, + S34 = 23 + let S41 = 6, + S42 = 10, + S43 = 15, + S44 = 21 + + string = Utf8Encode(string) + + let x = ConvertToWordArray(string) + + a = 0x67452301 + b = 0xefcdab89 + c = 0x98badcfe + d = 0x10325476 + + for (k = 0; k < x.length; k += 16) { + AA = a + BB = b + CC = c + DD = d + a = FF(a, b, c, d, x[k + 0], S11, 0xd76aa478) + d = FF(d, a, b, c, x[k + 1], S12, 0xe8c7b756) + c = FF(c, d, a, b, x[k + 2], S13, 0x242070db) + b = FF(b, c, d, a, x[k + 3], S14, 0xc1bdceee) + a = FF(a, b, c, d, x[k + 4], S11, 0xf57c0faf) + d = FF(d, a, b, c, x[k + 5], S12, 0x4787c62a) + c = FF(c, d, a, b, x[k + 6], S13, 0xa8304613) + b = FF(b, c, d, a, x[k + 7], S14, 0xfd469501) + a = FF(a, b, c, d, x[k + 8], S11, 0x698098d8) + d = FF(d, a, b, c, x[k + 9], S12, 0x8b44f7af) + c = FF(c, d, a, b, x[k + 10], S13, 0xffff5bb1) + b = FF(b, c, d, a, x[k + 11], S14, 0x895cd7be) + a = FF(a, b, c, d, x[k + 12], S11, 0x6b901122) + d = FF(d, a, b, c, x[k + 13], S12, 0xfd987193) + c = FF(c, d, a, b, x[k + 14], S13, 0xa679438e) + b = FF(b, c, d, a, x[k + 15], S14, 0x49b40821) + a = GG(a, b, c, d, x[k + 1], S21, 0xf61e2562) + d = GG(d, a, b, c, x[k + 6], S22, 0xc040b340) + c = GG(c, d, a, b, x[k + 11], S23, 0x265e5a51) + b = GG(b, c, d, a, x[k + 0], S24, 0xe9b6c7aa) + a = GG(a, b, c, d, x[k + 5], S21, 0xd62f105d) + d = GG(d, a, b, c, x[k + 10], S22, 0x2441453) + c = GG(c, d, a, b, x[k + 15], S23, 0xd8a1e681) + b = GG(b, c, d, a, x[k + 4], S24, 0xe7d3fbc8) + a = GG(a, b, c, d, x[k + 9], S21, 0x21e1cde6) + d = GG(d, a, b, c, x[k + 14], S22, 0xc33707d6) + c = GG(c, d, a, b, x[k + 3], S23, 0xf4d50d87) + b = GG(b, c, d, a, x[k + 8], S24, 0x455a14ed) + a = GG(a, b, c, d, x[k + 13], S21, 0xa9e3e905) + d = GG(d, a, b, c, x[k + 2], S22, 0xfcefa3f8) + c = GG(c, d, a, b, x[k + 7], S23, 0x676f02d9) + b = GG(b, c, d, a, x[k + 12], S24, 0x8d2a4c8a) + a = HH(a, b, c, d, x[k + 5], S31, 0xfffa3942) + d = HH(d, a, b, c, x[k + 8], S32, 0x8771f681) + c = HH(c, d, a, b, x[k + 11], S33, 0x6d9d6122) + b = HH(b, c, d, a, x[k + 14], S34, 0xfde5380c) + a = HH(a, b, c, d, x[k + 1], S31, 0xa4beea44) + d = HH(d, a, b, c, x[k + 4], S32, 0x4bdecfa9) + c = HH(c, d, a, b, x[k + 7], S33, 0xf6bb4b60) + b = HH(b, c, d, a, x[k + 10], S34, 0xbebfbc70) + a = HH(a, b, c, d, x[k + 13], S31, 0x289b7ec6) + d = HH(d, a, b, c, x[k + 0], S32, 0xeaa127fa) + c = HH(c, d, a, b, x[k + 3], S33, 0xd4ef3085) + b = HH(b, c, d, a, x[k + 6], S34, 0x4881d05) + a = HH(a, b, c, d, x[k + 9], S31, 0xd9d4d039) + d = HH(d, a, b, c, x[k + 12], S32, 0xe6db99e5) + c = HH(c, d, a, b, x[k + 15], S33, 0x1fa27cf8) + b = HH(b, c, d, a, x[k + 2], S34, 0xc4ac5665) + a = II(a, b, c, d, x[k + 0], S41, 0xf4292244) + d = II(d, a, b, c, x[k + 7], S42, 0x432aff97) + c = II(c, d, a, b, x[k + 14], S43, 0xab9423a7) + b = II(b, c, d, a, x[k + 5], S44, 0xfc93a039) + a = II(a, b, c, d, x[k + 12], S41, 0x655b59c3) + d = II(d, a, b, c, x[k + 3], S42, 0x8f0ccc92) + c = II(c, d, a, b, x[k + 10], S43, 0xffeff47d) + b = II(b, c, d, a, x[k + 1], S44, 0x85845dd1) + a = II(a, b, c, d, x[k + 8], S41, 0x6fa87e4f) + d = II(d, a, b, c, x[k + 15], S42, 0xfe2ce6e0) + c = II(c, d, a, b, x[k + 6], S43, 0xa3014314) + b = II(b, c, d, a, x[k + 13], S44, 0x4e0811a1) + a = II(a, b, c, d, x[k + 4], S41, 0xf7537e82) + d = II(d, a, b, c, x[k + 11], S42, 0xbd3af235) + c = II(c, d, a, b, x[k + 2], S43, 0x2ad7d2bb) + b = II(b, c, d, a, x[k + 9], S44, 0xeb86d391) + a = AddUnsigned(a, AA) + b = AddUnsigned(b, BB) + c = AddUnsigned(c, CC) + d = AddUnsigned(d, DD) + } + + let temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d) + + return temp.toLowerCase() +} diff --git a/utils/monitor/Error.js b/utils/monitor/Error.js new file mode 100644 index 0000000..2483fcc --- /dev/null +++ b/utils/monitor/Error.js @@ -0,0 +1,46 @@ +import { TrackerEvents } from './monitorEnum' +export class Error { + constructor(eventName, error) { + this.eventName = eventName + this.error = error + } + getCurrentEnv() { + if (this.eventName == TrackerEvents.jsError) { + this.error = { + message: this.error.message, + stack: this.error.stack + } + } + return { + activePage: this.getActivePage()?.route || 'none', + accountInfo: this.getLocalStorage(), + eventName: this.eventName, + time: this.getTime(), + error: this.error, + extraInfo: this.getExtraInfo() + } + } + getActivePage() { + const curPages = getCurrentPages() + if (curPages.length) { + return curPages[curPages.length - 1] + } + return null + } + getLocalStorage() { + return { + token: wx.getStorageSync('qnToken'), + userInfo: wx.getStorageSync('userInfo') + } + } + getTime() { + let date = new Date() + return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}` + } + getExtraInfo() { + return this.extraInfo + } + setExtraInfo(extraInfo) { + this.extraInfo = extraInfo + } +} diff --git a/utils/monitor/index.js b/utils/monitor/index.js new file mode 100644 index 0000000..6db4494 --- /dev/null +++ b/utils/monitor/index.js @@ -0,0 +1,48 @@ +/** + * 微信小程序监控插件 + * 1. 监听 js错误 网络资源加载错误 打印错误 + * 2. 错误上报 + */ +import { rewriteApp } from './rewriteApp' +import { rewriteRequest, rewriteUpload } from './rewriteRequest' +import { Error } from './Error' + +export class Monitor { + static instance + constructor(options) { + this.options = options + this.behaviorQueue = [] + this.instance = this + // this.init() + } + /** + * 初始化 + */ + init() { + rewriteApp(this) + rewriteRequest(this) + rewriteUpload(this) + // rewritePage(this) + } + pushBehaviorItem(item) { + if (this.behaviorQueue.length >= 20) { + this.behaviorQueue.shift() + } + this.behaviorQueue.push(item) + } + handleErrorEvent(eventName, error, extraInfo) { + // 获取当前场景 + const errorInfo = new Error(eventName, error) + extraInfo ? errorInfo.setExtraInfo(extraInfo) : '' + // 错误上报 + wx.request({ + url: this.options.url, + data: { errorMessage: JSON.stringify(errorInfo.getCurrentEnv()) }, + timeout: this.options.timeout || 5000, + header: this.options.header || {}, + method: this.options.method || 'POST', + monitorIgnore: this.options.monitorIgnore || true + }) + console.log('reportData', errorInfo.getCurrentEnv()) + } +} diff --git a/utils/monitor/monitorEnum.js b/utils/monitor/monitorEnum.js new file mode 100644 index 0000000..072a628 --- /dev/null +++ b/utils/monitor/monitorEnum.js @@ -0,0 +1,17 @@ +export const IBehaviorItemType = { + fn: 'function', + console: 'console', + http: 'http', + custom: 'custom', + tap: 'tap' +} + +export const TrackerEvents = { + event: 'event', + jsError: 'jsError', + reqError: 'reqError', + uploadError: 'uploadError', + unHandleRejection: 'unHandleRejection', + performanceInfoReady: 'performanceInfoReady', + slowHttpRequest: 'slowHttpRequest' +} diff --git a/utils/monitor/rewriteApp.js b/utils/monitor/rewriteApp.js new file mode 100644 index 0000000..78def56 --- /dev/null +++ b/utils/monitor/rewriteApp.js @@ -0,0 +1,30 @@ +import { IBehaviorItemType, TrackerEvents } from './monitorEnum' +export const appHooks = ['onUnhandledRejection', 'onError'] + +export function rewriteApp(monitor) { + const originApp = App + App = function (appOptions) { + appHooks.forEach((methodName) => { + const originMethod = appOptions[methodName] + + appOptions[methodName] = function (param) { + monitor.pushBehaviorItem({ + belong: 'app', + method: methodName, + activePage: null, + type: IBehaviorItemType.fn, + args: param + }) + const error = param + if (methodName === 'onUnhandledRejection') { + monitor.handleErrorEvent(TrackerEvents.unHandleRejection, error) + } + if (methodName === 'onError') { + monitor.handleErrorEvent(TrackerEvents.jsError, error) + } + return originMethod && originMethod.call(this, param) + } + }) + return originApp(appOptions) + } +} diff --git a/utils/monitor/rewritePage.js b/utils/monitor/rewritePage.js new file mode 100644 index 0000000..3f71700 --- /dev/null +++ b/utils/monitor/rewritePage.js @@ -0,0 +1,11 @@ +/** + * uni-app 没有使用微信小程序的 Page 方法创建页面,所以暂时不加该检测 + * @param {*} monitor + */ +export function rewritePage(monitor) { + const originPage = Page + Page = function (pageOptions) { + console.log('🍰', pageOptions) + return originPage(pageOptions) + } +} diff --git a/utils/monitor/rewriteRequest.js b/utils/monitor/rewriteRequest.js new file mode 100644 index 0000000..37f12c9 --- /dev/null +++ b/utils/monitor/rewriteRequest.js @@ -0,0 +1,105 @@ +import { IBehaviorItemType, TrackerEvents } from './monitorEnum' + +function generateRequestError(requestOption, response) { + const { url, header, method } = requestOption + return { + url, + header, + method, + params: requestOption.data, + response: response.data, + statusCode: response.statusCode + } +} + +function generateUploadError(requestOption, response) { + const { url, header } = requestOption + return { + url, + header, + params: requestOption.data, + response: response.data, + statusCode: response.statusCode + } +} + +export function rewriteRequest(monitor) { + const originRequest = wx.request + Object.defineProperty(wx, 'request', { + configurable: false, + enumerable: false, + writable: false, + value: function (options) { + const originSuccess = options.success + const originFail = options.fail + monitor.pushBehaviorItem({ + belong: 'request', + method: options.url, + activePage: null, + type: IBehaviorItemType.http, + args: null + }) + /** + * 后期业务逻辑需要抽出来 + * @param {...any} args + */ + options.success = function (...args) { + typeof originSuccess === 'function' && originSuccess.call(this, ...args) + if (options.monitorIgnore) return + const response = args[0] + let error = generateRequestError(options, response) + let { statusCode, data } = response + if (statusCode >= 200 && statusCode < 300) { + let code = data.code + if (code != 0) { + monitor.handleErrorEvent(TrackerEvents.reqError, error) + } + } else { + monitor.handleErrorEvent(TrackerEvents.reqError, error) + } + } + + /** 请求错误 */ + options.fail = function (...args) { + typeof originFail === 'function' && originFail.call(this, ...args) + if (options.monitorIgnore) return + let error = generateUploadError(options, { data: args[0] }) + monitor.handleErrorEvent(TrackerEvents.reqError, error) + } + return originRequest.call(this, options) + } + }) +} + +export function rewriteUpload(monitor) { + const originUpload = wx.uploadFile + Object.defineProperty(wx, 'uploadFile', { + configurable: false, + enumerable: false, + writable: false, + value: function (options) { + const originSuccess = options.success + const originFail = options.fail + /** + * 后期业务逻辑需要抽出来 + * @param {...any} args + */ + options.success = function (...args) { + typeof originSuccess === 'function' && originSuccess.call(this, ...args) + const response = args[0] + let error = generateUploadError(options, response) + let { statusCode } = response + if (statusCode < 200 || statusCode >= 300) { + monitor.handleErrorEvent(TrackerEvents.uploadError, error) + } + } + + /** 请求错误 */ + options.fail = function (...args) { + typeof originFail === 'function' && originFail.call(this, ...args) + monitor.handleErrorEvent(TrackerEvents.uploadError, args[0]) + } + return originUpload.call(this, options) + } + }) +} diff --git a/utils/socket/index.js b/utils/socket/index.js new file mode 100644 index 0000000..96fca4f --- /dev/null +++ b/utils/socket/index.js @@ -0,0 +1,52 @@ +import { makeSocket } from '@/utils/index' +import eventBus from '@/utils/eventBus' +import { getActivePage } from '@/utils/hook' +let socket = null +export function initSocket() { + if (socket) { + return socket + } + makeSocket({ pageInfo: 'all', retry: true }).then((res) => { + destroySocket() + socket = res + socket.onMessage(handleMessage) + socket.onError(handleError) + socket.onRetry = () => { + handleRetry() + } + }) +} + +export function destroySocket() { + if (socket) { + socket.close() + socket = null + } +} + +function handleError(error) { + console.log('error', error) + destroySocket() +} + +function handleRetry() { + socket.onMessage(handleMessage) + socket.onError(handleError) +} + +function handleMessage(data) { + if (data.type === 'fnFileAnalysisInform') { + eventBus.emit('singleFileAnalysis', data) + } + if (data.type === 'allFileAnalysisSuccess') { + let page = getActivePage() + if (!page || page.route != 'pages/print/index') { + uni.showToast({ + title: '文件全部解析完成,可以下单', + icon: 'none', + duration: 2000 + }) + } + destroySocket() + } +} diff --git a/utils/vueWxRouter.js b/utils/vueWxRouter.js new file mode 100644 index 0000000..2e863b4 --- /dev/null +++ b/utils/vueWxRouter.js @@ -0,0 +1,24 @@ +function init(Vue, options) { + const route = { + data: null, + id: null + } + function setData(data) { + route.data = data + route.id = String(Date.now()) + return route.id + } + function getData(id) { + return id === route.id ? route.data : null + } + Vue.prototype.$wxRouter = { + setData: setData, + getData: getData + } + Vue.prototype.$wxRoute = route +} +const vueWxRouter = { + install: init +} + +export default vueWxRouter