diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..7311359 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml \ No newline at end of file diff --git a/.idea/jurong_circle_front_app.iml b/.idea/jurong_circle_front_app.iml new file mode 100644 index 0000000..24643cc --- /dev/null +++ b/.idea/jurong_circle_front_app.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d462f81 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uniappSupport.xml b/.idea/uniappSupport.xml new file mode 100644 index 0000000..eb1cb23 --- /dev/null +++ b/.idea/uniappSupport.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..d83f103 --- /dev/null +++ b/App.vue @@ -0,0 +1,17 @@ + + + diff --git a/components/Tabbar/Tabbar.vue b/components/Tabbar/Tabbar.vue new file mode 100644 index 0000000..24229d7 --- /dev/null +++ b/components/Tabbar/Tabbar.vue @@ -0,0 +1,128 @@ + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..882ba04 --- /dev/null +++ b/index.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + +
+ +
+ + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..734be3d --- /dev/null +++ b/main.js @@ -0,0 +1,30 @@ +import App from './App' + +// 引入 uView UI +import uView from './uni_modules/vk-uview-ui'; + +// #ifndef VUE3 +import Vue from 'vue' +import './uni.promisify.adaptor' +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +app.$mount() +// #endif + +// #ifdef VUE3 +import { + createSSRApp +} from 'vue' +export function createApp() { + const app = createSSRApp(App) + + app.use(uView) + + return { + app + } +} +// #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..7e5ad07 --- /dev/null +++ b/manifest.json @@ -0,0 +1,72 @@ +{ + "name" : "jurong_circle_front_app", + "appid" : "__UNI__11908F8", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "vueVersion" : "3" +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f0949f9 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,548 @@ +{ + "name": "jurong_circle_front_app", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "vk-uview-ui": "^1.5.2" + }, + "devDependencies": { + "sass": "^1.92.1", + "sass-loader": "^16.0.5" + } + }, + "node_modules/@parcel/watcher": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", + "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "dependencies": { + "detect-libc": "^1.0.3", + "is-glob": "^4.0.3", + "micromatch": "^4.0.5", + "node-addon-api": "^7.0.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "@parcel/watcher-android-arm64": "2.5.1", + "@parcel/watcher-darwin-arm64": "2.5.1", + "@parcel/watcher-darwin-x64": "2.5.1", + "@parcel/watcher-freebsd-x64": "2.5.1", + "@parcel/watcher-linux-arm-glibc": "2.5.1", + "@parcel/watcher-linux-arm-musl": "2.5.1", + "@parcel/watcher-linux-arm64-glibc": "2.5.1", + "@parcel/watcher-linux-arm64-musl": "2.5.1", + "@parcel/watcher-linux-x64-glibc": "2.5.1", + "@parcel/watcher-linux-x64-musl": "2.5.1", + "@parcel/watcher-win32-arm64": "2.5.1", + "@parcel/watcher-win32-ia32": "2.5.1", + "@parcel/watcher-win32-x64": "2.5.1" + } + }, + "node_modules/@parcel/watcher-android-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz", + "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz", + "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-darwin-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz", + "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-freebsd-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz", + "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz", + "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz", + "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz", + "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-arm64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz", + "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-glibc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz", + "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-linux-x64-musl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz", + "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-arm64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz", + "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-ia32": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz", + "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/@parcel/watcher-win32-x64": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz", + "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "optional": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "optional": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "optional": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/immutable": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.3.tgz", + "integrity": "sha512-+chQdDfvscSF1SJqv2gn4SRO2ZyS3xL3r7IW/wWEEzrzLisnOlKiQu5ytC/BVNcS15C39WT2Hg/bjKjDMcu+zg==", + "dev": true + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "optional": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "optional": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true + }, + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, + "optional": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/sass": { + "version": "1.92.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.92.1.tgz", + "integrity": "sha512-ffmsdbwqb3XeyR8jJR6KelIXARM9bFQe8A6Q3W4Klmwy5Ckd5gz7jgUNHo4UOqutU5Sk1DtKLbpDP0nLCg1xqQ==", + "dev": true, + "dependencies": { + "chokidar": "^4.0.0", + "immutable": "^5.0.2", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "optionalDependencies": { + "@parcel/watcher": "^2.4.1" + } + }, + "node_modules/sass-loader": { + "version": "16.0.5", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-16.0.5.tgz", + "integrity": "sha512-oL+CMBXrj6BZ/zOq4os+UECPL+bWqt6OAC6DWS8Ln8GZRcMDjlJ4JC3FBDuHJdYaFWIdKNIBYmtZtK2MaMkNIw==", + "dev": true, + "dependencies": { + "neo-async": "^2.6.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "sass": "^1.3.0", + "sass-embedded": "*", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "optional": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/vk-uview-ui": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/vk-uview-ui/-/vk-uview-ui-1.5.2.tgz", + "integrity": "sha512-RRZgiEAc8qaUerSi7lSbrkCoLBgRUwFQHwP1V44pJO7Js+7HeHFEkkpPrtkOi14hl4CntR4qIhIDvaKmIJqVsw==", + "engines": { + "HBuilderX": "^3.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..02a5747 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "devDependencies": { + "sass": "^1.92.1", + "sass-loader": "^16.0.5" + }, + "dependencies": { + "vk-uview-ui": "^1.5.2" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..a4233d7 --- /dev/null +++ b/pages.json @@ -0,0 +1,41 @@ +{ + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/home/index", + "style": { + "navigationBarTitleText": "主页" + } + }, + { + "path": "pages/my/my", + "style": { + "navigationBarTitleText": "我的" + } + }, + { + "path": "pages/message/message", + "style": { + "navigationBarTitleText": "消息" + } + }, + { + "path": "pages/program/program", + "style": { + "navigationBarTitleText": "项目" + } + }, + { + "path": "pages/finance/finance", + "style": { + "navigationBarTitleText": "金融" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "uniIdRouter": {} +} \ No newline at end of file diff --git a/pages/finance/finance.vue b/pages/finance/finance.vue new file mode 100644 index 0000000..3f3594a --- /dev/null +++ b/pages/finance/finance.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/pages/home/index.vue b/pages/home/index.vue new file mode 100644 index 0000000..d20c287 --- /dev/null +++ b/pages/home/index.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/pages/message/message.vue b/pages/message/message.vue new file mode 100644 index 0000000..47382f5 --- /dev/null +++ b/pages/message/message.vue @@ -0,0 +1,13 @@ + + + + + + diff --git a/pages/my/my.vue b/pages/my/my.vue new file mode 100644 index 0000000..054ad91 --- /dev/null +++ b/pages/my/my.vue @@ -0,0 +1,13 @@ + + + + + + diff --git a/pages/program/program.vue b/pages/program/program.vue new file mode 100644 index 0000000..5f2a5ec --- /dev/null +++ b/pages/program/program.vue @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000..b5771e2 Binary files /dev/null and b/static/logo.png differ diff --git a/static/tabbar/1-active.png b/static/tabbar/1-active.png new file mode 100644 index 0000000..ae23c81 Binary files /dev/null and b/static/tabbar/1-active.png differ diff --git a/static/tabbar/1.png b/static/tabbar/1.png new file mode 100644 index 0000000..5e2b085 Binary files /dev/null and b/static/tabbar/1.png differ diff --git a/static/tabbar/2-active.png b/static/tabbar/2-active.png new file mode 100644 index 0000000..240867d Binary files /dev/null and b/static/tabbar/2-active.png differ diff --git a/static/tabbar/2.png b/static/tabbar/2.png new file mode 100644 index 0000000..51e73b1 Binary files /dev/null and b/static/tabbar/2.png differ diff --git a/static/tabbar/3-active.png b/static/tabbar/3-active.png new file mode 100644 index 0000000..5bae28d Binary files /dev/null and b/static/tabbar/3-active.png differ diff --git a/static/tabbar/3.png b/static/tabbar/3.png new file mode 100644 index 0000000..c4fc0e1 Binary files /dev/null and b/static/tabbar/3.png differ diff --git a/static/tabbar/4-active.png b/static/tabbar/4-active.png new file mode 100644 index 0000000..724f676 Binary files /dev/null and b/static/tabbar/4-active.png differ diff --git a/static/tabbar/4.png b/static/tabbar/4.png new file mode 100644 index 0000000..3ffffb3 Binary files /dev/null and b/static/tabbar/4.png differ diff --git a/static/tabbar/5-active.png b/static/tabbar/5-active.png new file mode 100644 index 0000000..4fb9196 Binary files /dev/null and b/static/tabbar/5-active.png differ diff --git a/static/tabbar/5.png b/static/tabbar/5.png new file mode 100644 index 0000000..fd13fec Binary files /dev/null and b/static/tabbar/5.png differ diff --git a/static/tabbar/bg-1.png b/static/tabbar/bg-1.png new file mode 100644 index 0000000..24fb410 Binary files /dev/null and b/static/tabbar/bg-1.png differ diff --git a/static/tabbar/bg-2.png b/static/tabbar/bg-2.png new file mode 100644 index 0000000..8b938f2 Binary files /dev/null and b/static/tabbar/bg-2.png differ diff --git a/static/tabbar/bg-3.png b/static/tabbar/bg-3.png new file mode 100644 index 0000000..d44b060 Binary files /dev/null and b/static/tabbar/bg-3.png differ diff --git a/static/tabbar/bg-4.png b/static/tabbar/bg-4.png new file mode 100644 index 0000000..f299d88 Binary files /dev/null and b/static/tabbar/bg-4.png differ diff --git a/static/tabbar/bg-5.png b/static/tabbar/bg-5.png new file mode 100644 index 0000000..4d49626 Binary files /dev/null and b/static/tabbar/bg-5.png differ diff --git a/uni.promisify.adaptor.js b/uni.promisify.adaptor.js new file mode 100644 index 0000000..5fec4f3 --- /dev/null +++ b/uni.promisify.adaptor.js @@ -0,0 +1,13 @@ +uni.addInterceptor({ + returnValue (res) { + if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) { + return res; + } + return new Promise((resolve, reject) => { + res.then((res) => { + if (!res) return resolve(res) + return res[0] ? reject(res[0]) : resolve(res[1]) + }); + }); + }, +}); \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..6b8dae3 --- /dev/null +++ b/uni.scss @@ -0,0 +1,79 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$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:#ffffff; +$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:12px; +$uni-font-size-base:14px; +$uni-font-size-lg:16px; + +/* 图片尺寸 */ +$uni-img-size-sm:20px; +$uni-img-size-base:26px; +$uni-img-size-lg:40px; + +/* Border Radius */ +$uni-border-radius-sm: 2px; +$uni-border-radius-base: 3px; +$uni-border-radius-lg: 6px; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 5px; +$uni-spacing-row-base: 10px; +$uni-spacing-row-lg: 15px; + +/* 垂直间距 */ +$uni-spacing-col-sm: 4px; +$uni-spacing-col-base: 8px; +$uni-spacing-col-lg: 12px; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2C405A; // 文章标题颜色 +$uni-font-size-title:20px; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle:26px; +$uni-color-paragraph: #3F536E; // 文章段落颜色 +$uni-font-size-paragraph:15px; + + +@import "@/uni_modules/vk-uview-ui/theme.scss"; \ No newline at end of file diff --git a/uni_modules/vk-uview-ui/changelog.md b/uni_modules/vk-uview-ui/changelog.md new file mode 100644 index 0000000..b7bcc37 --- /dev/null +++ b/uni_modules/vk-uview-ui/changelog.md @@ -0,0 +1,201 @@ +## 1.6.5(2025-09-12) +* 【修复】`u-parse` 在同一个页面使用多个组件渲染时,在web端渲染表现错误的问题 +* 【优化】`u-picker` 地址文本解析函数,支持识别更复杂的文本 +## 1.6.4(2025-07-07) +* 【修复】select 的 defaultValue 属性在app端不生效的问题 +## 1.6.3(2025-05-23) +* 【重要】更新省市区数据源至2025年 +* 【优化】去除微信小程序平台上提示 uni.getSystemInfoSync 过期的警告问题 +* 【优化】u-back-top 组件新增属性 show-back-top,设置为true可强制显示 +* 【优化】调整 u-tabbar、u-badge、u-back-top 组件,将单位rpx统一调整为px,确保所有屏幕大小显示一致 +* 【优化】u-popup 支持设置背景色 +## 1.6.2(2025-03-11) +* 【修复】radio 无法统一设置 size 的问题 +* 【修复】u-dropdown 激活菜单后 label 颜色未变化的问题 +* 【修复】td 组件和 th 组件 width 属性在微信小程序不生效的问题 +* 【修复】parse 富文本组件图片设置了可点击预览但不生效的问题 +* 【优化】u-search 在输入的时候,因为右侧出现删除按钮导致文字居中效果体验在首次输入时会闪一下的问题 +## 1.6.1(2024-12-20) +* 【优化】input组件在鸿蒙元服务的兼容性 + +**特别注意** + +1. 当前鸿蒙元服务自身框架有一些小问题,渲染页面会可能会出现卡顿和部分样式丢失问题,经排查为元服务自身框架问题。 +## 1.6.0(2024-12-18) +* 【重要】兼容鸿蒙App和鸿蒙元服务 + +**特别注意** + +1. 当前鸿蒙元服务自身框架有一些小问题,渲染页面会可能会出现卡顿和部分样式丢失问题,经排查为元服务自身框架问题。 +## 1.5.7(2024-09-02) +* 【修复】`u-input` type 为select时,在支付宝小程序无法点击的问题 +* 【修复】`u-picker` 在微信小程序部分情况下会报警告的问题 +## 1.5.6(2024-09-02) +* 【修复】Vue3模式下,支付宝小程序启动报错的问题 +## 1.5.5(2024-08-29) +* 【修复】`u-collapse-item` 在部分情况下始终折叠无法打开的问题 +* 【修复】`u-popup` 初始化时 `@close` 事件就会执行的bug +## 1.5.4(2024-07-17) +* 【修复】`u-input` 设置 maxlength 后,在ios输入法中表现异常的问题 +* 【修复】`u-input` 在抖音小程序中会报错的问题 +* 【优化】部分组件在抖音小程序中的兼容性问题 +* 【优化】`u-tabbar` 跳转能力,支持非tabbar页面 +* 【优化】`u-table`新增属性tdStyle +## 1.5.3(2024-05-28) +* 【修复】`u-form` 属性 `borderBottom` 不生效的问题 +* 【修复】`u-picker` 的 `columnchange` 事件第一行不触发的问题 +* 【修复】`u-parse` 解析富文本后得到的对象传递到 `u-trees` 时不存在style时报错的问题 +* 【优化】`u-calendar` 多选时,未选择结束时间则不能点击确认按钮 +* 【优化】`u-picker` 组件,弹窗的默认时间若未设置,则为当前时间 +## 1.5.2(2023-12-28) +* 【修复】`u-input` 缺少emits选项 `confirm` 的问题 +## 1.5.1(2023-10-13) +* 【修复】`u-parse` 在小程序上部分情况下不显示图片的问题 +* 【修复】`u-alert-tips` 使用 `closeText` 时 `close` 事件无效的问题 & 样式微调 +## 1.5.0(2023-06-01) +* 【修复】`u-parse` 在vue3真机白屏问题和h5样式污染问题 +* 【修复】`u-select` 默认值的问题 +* 【修复】`u-parse` 在app和微信小程序中 `preview` 属性不生效的问题 +## 1.4.8(2023-05-17) +* 【优化】部分组件属性的可选值的代码提示 +* 【优化】`u-circle-progres` 组件 在进度条到100%的时候发出一个 `finish` 事件 +* 【修复】`u-picker` 的时间选择器在ios下默认值无效的bug +* 【修复】`u-card` 圆角问题 +* 【修复】`u-button` 支持 `info` 类型 +## 1.4.7(2023-04-24) +* 【修复】`u-picker` 在vue3的App环境下默认值无效的bug +## 1.4.5(2022-12-05) +* 【修复】`u-row`、`u-col` 使用 `@click.stop` 会报错的问题,同时建议改用 `@click.native.stop` 来代替 `@click.stop` +## 1.4.4(2022-11-12) +* 【修复】`u-calendar` `u-modal` `u-picker` `u-popup` 组件在页面进入后马上需要弹窗时,无法正常弹窗的问题。 +## 1.4.3(2022-10-22) +* 【优化】部分组件的细节 +## 1.4.2(2022-10-15) +* 【修复】`1.4.1` 引出的 `u-subsection` 的部分问题 +## 1.4.1(2022-10-14) +* 【修复】`u-count-to` 若设置了千分位符合,会错误显示-的问题 +* 【修复】`u-subsection` 部分细节问题 +## 1.4.0(2022-10-07) +* 【修复】`u-section` 点击更多,会触发两次事件的问题 +* 【修复】`loadMore` 加载更多,icon-type为circle不会转动的问题 +* 【修复】`u-subsection` current 有转入值时,变更值,样式不更新(需用 `v-model="current"` 代替 `:current="current"`) +## 1.3.13(2022-09-28) +* 【修复】`u-avatar-cropper` 组件在vue3中会报错的问题。 +## 1.3.12(2022-08-30) +* 【优化】`u-keyboard` 组件内部细节。 +## 1.3.11(2022-08-30) +* 【修复】`u-subsection` 组件的 `list` 属性不支持动态修改的问题。 +## 1.3.10(2022-07-30) +* 【优化】上传组件部分细节 +## 1.3.9(2022-07-07) +* 【更新】省市区数据源 +* 【优化】`u-subsection` 组件支持在右上角显示数字角标 +```html + +``` + +```js +export default { + data() { + return { + list: [ + { + name: '待发货', + num: 10 + }, + { + name: '待付款', + num: 5 + }, + { + name: '待评价', + num: 15 + } + ] + } + } +} +``` +## 1.3.8(2022-06-13) +* 【优化】组件 `u-icon`,使之更方便的兼容第三方icon(满足规则自动计算customPrefix) +**规则如下:** +* 当 `name` 中包含 `-icon-` 字符串时 +* 如 `vk-icon-goods`,则组件的 `customPrefix` 属性自动识别为 `vk-icon` ,`name`属性 自动识别为 `goods` +* 如 `vk-2-icon-goods-list`,则组件的 `customPrefix` 属性自动识别为 `vk-2-icon` ,`name`属性 自动识别为 `goods-list` +## 1.3.7(2022-06-10) +* 【优化】组件 `u-action-sheet` `u-calendar` `u-dropdown-item` `u-field` `u-input` `u-keyboard` `u-modal` `u-radio-group` `u-rate` `u-search` `u-slider` `u-switch` `u-tabbar` `u-waterfall` 在 `vue3` 模式下的细节问题。 +## 1.3.6(2022-06-10) +* 【优化】组件 `u-action-sheet` `u-calendar` `u-dropdown-item` `u-field` `u-input` `u-keyboard` `u-modal` `u-radio-group` `u-rate` `u-search` `u-slider` `u-switch` `u-tabbar` `u-waterfall` 在 `vue3` 模式下的细节问题。 +## 1.3.5(2022-05-28) +* 【优化】组件 `u-mask` `u-popup` `u-select` `u-modal` `u-keyboard` `u-calendar` `u-action-sheet` `u-picker` 均新增 `blur` 属性,可用于设置弹出遮罩的模糊度,默认为0(不模糊) +* ![](https://vkceyugu.cdn.bspapp.com/VKCEYUGU-cf0c5e69-620c-4f3c-84ab-f4619262939f/49b773a3-273f-4b1c-95e8-a42dcba1a53c.png) +## 1.3.4(2022-05-03) +* 【修复】`u-tabs` 组件细节问题。 +## 1.1.4(2022-03-22) +* 【修复】`u-field` 组件 `arrowDirection` 属性无效的问题。 +## 1.1.3(2022-03-21) +* 【优化】部分细节。 +## 1.1.2(2022-03-21) +* 【优化】部分细节。 +## 1.1.1(2022-03-17) +* 【优化】部分细节。 +## 1.1.0(2022-03-12) +* 【重要】`u-picker` 组件新增 `regionDiscern` 方法 智能识别省市区街道地址 +如将字符串 `浙江省杭州市西湖区希望路1333弄是啊我庭12号楼1203` 中识别为 +```json +{ + "province": { + "code": "330000", + "name": "浙江省" + }, + "city": { + "code": "330100", + "name": "杭州市" + }, + "area": { + "code": "330106", + "name": "西湖区" + }, + "address": "龙井路1号", + "formatted_address": "浙江省杭州市西湖区龙井路1号" +} +``` +而组件的 `addressDiscern` 方法还可以识别收货信息,如 `张三 13888888888 上海市嘉定区希望路1333弄是啊我庭12号楼1203` 中识别姓名、手机号、地址(支持多种格式) +## 1.0.13(2022-03-12) +* 【优化】部分细节。 +## 1.0.12(2022-03-09) +* 【修复】`u-radio-group` 在 vue3 模式下,设置默认值可能会无效的问题。 +## 1.0.11(2022-03-07) +* 【优化】部分细节。 +## 1.0.10(2022-03-05) +* 【修复】`u-radio` 中的值相等的判断 == 改为 === +* 【优化】部分注释的错别字。 +## 1.0.9(2022-03-03) +* 【修复】`u-parse` 在 vue3模式下编译到app无法正常显示的问题。 +## 1.0.8(2022-02-26) +* 【优化】`u-form` 组件新增2个属性 `inputAlign` 和 `clearable` 用于统一设置表单内所有 `u-input` 组件的对应属性默认值 +* 【优化】更新城市数据源信息 +## 1.0.7(2022-02-25) +* 【重要】`u-picker` 组件新增 `addressDiscern` 方法 智能识别收货信息 + +如在 `张三 13888888888 上海市嘉定区希望路1333弄是啊我庭12号楼1203` 中识别姓名、手机号、地址(支持多种格式) +即使这样的字符串也能识别 `!!!!~~~$张三~~~上海市嘉定区希望路1333弄是啊我庭12号楼1203【【【【13888888888】` +## 1.0.6(2022-02-24) +* 【优化】`u-form-item` 组件的 `prop` 属性支持 a.b 形式 +## 1.0.5(2022-01-11) +* 【修复】`u-sticky` 组件 在微信小程序中无法正常吸顶的问题 +## 1.0.4(2021-12-31) +* 【优化】`u-dropdown-item` 组件 0和"" 无法区分的问题。 +* 【修复】`u-modal` 在Vue3版本中使用了mask-close-able属性无效的问题 +## 1.0.3(2021-12-20) +【优化】u-icon在微信小程序下可能会显示null字符串的问题 +## 1.0.2(2021-12-09) +* 1、【优化】`u-button` 组件新增 `timerId` 属性 +* 之前的效果是:所有按钮一定时间内只能点击1次(`共用计算时间`)导致点击按钮A后无法马上点击按钮B +* 优化的效果是:每个按钮一定时间内只能点击1次(`分开计算时间`)且支持设置相同的 timerId 来达到指定按钮 `共用计算时间` +## 1.0.1(2021-11-22) +* 修复 u-parse 组件在微信小程序上的显示问题。 +## 1.0.0(2021-11-18) +uView Vue3.0 横空出世,继承uView1.0意志,再战江湖,风云再起!by vk 2021-11-18 diff --git a/uni_modules/vk-uview-ui/components/u--text/u--text.vue b/uni_modules/vk-uview-ui/components/u--text/u--text.vue new file mode 100644 index 0000000..e9297da --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u--text/u--text.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/uni_modules/vk-uview-ui/components/u-action-sheet/u-action-sheet.vue b/uni_modules/vk-uview-ui/components/u-action-sheet/u-action-sheet.vue new file mode 100644 index 0000000..07771c1 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-action-sheet/u-action-sheet.vue @@ -0,0 +1,246 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-alert-tips/u-alert-tips.vue b/uni_modules/vk-uview-ui/components/u-alert-tips/u-alert-tips.vue new file mode 100644 index 0000000..7c923e1 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-alert-tips/u-alert-tips.vue @@ -0,0 +1,260 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue b/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue new file mode 100644 index 0000000..fb60db4 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue @@ -0,0 +1,312 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-avatar-cropper/weCropper.js b/uni_modules/vk-uview-ui/components/u-avatar-cropper/weCropper.js new file mode 100644 index 0000000..ef1d5c8 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-avatar-cropper/weCropper.js @@ -0,0 +1,1258 @@ +/** + * we-cropper v1.3.9 + * (c) 2020 dlhandsome + * @license MIT + */ +'use strict'; + +import getSystemInfoSync from '../../libs/function/getSystemInfoSync.js' + +var device = void 0; +var TOUCH_STATE = ['touchstarted', 'touchmoved', 'touchended']; + +function firstLetterUpper(str) { + return str.charAt(0).toUpperCase() + str.slice(1) +} + +function setTouchState(instance) { + var arg = [], + len = arguments.length - 1; + while (len-- > 0) arg[len] = arguments[len + 1]; + + TOUCH_STATE.forEach(function(key, i) { + if (arg[i] !== undefined) { + instance[key] = arg[i]; + } + }); +} + +function validator(instance, o) { + Object.defineProperties(instance, o); +} + +function getDevice() { + if (!device) { + device = getSystemInfoSync(); + } + return device +} + +var tmp = {}; + +var ref = getDevice(); +var pixelRatio = ref.pixelRatio; + +var DEFAULT = { + id: { + default: 'cropper', + get: function get() { + return tmp.id + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("id:" + value + " is invalid")); + } + tmp.id = value; + } + }, + width: { + default: 750, + get: function get() { + return tmp.width + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("width:" + value + " is invalid")); + } + tmp.width = value; + } + }, + height: { + default: 750, + get: function get() { + return tmp.height + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("height:" + value + " is invalid")); + } + tmp.height = value; + } + }, + pixelRatio: { + default: pixelRatio, + get: function get() { + return tmp.pixelRatio + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("pixelRatio:" + value + " is invalid")); + } + tmp.pixelRatio = value; + } + }, + scale: { + default: 2.5, + get: function get() { + return tmp.scale + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("scale:" + value + " is invalid")); + } + tmp.scale = value; + } + }, + zoom: { + default: 5, + get: function get() { + return tmp.zoom + }, + set: function set(value) { + if (typeof(value) !== 'number') { + console.error(("zoom:" + value + " is invalid")); + } else if (value < 0 || value > 10) { + console.error("zoom should be ranged in 0 ~ 10"); + } + tmp.zoom = value; + } + }, + src: { + default: '', + get: function get() { + return tmp.src + }, + set: function set(value) { + if (typeof(value) !== 'string') { + console.error(("src:" + value + " is invalid")); + } + tmp.src = value; + } + }, + cut: { + default: {}, + get: function get() { + return tmp.cut + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("cut:" + value + " is invalid")); + } + tmp.cut = value; + } + }, + boundStyle: { + default: {}, + get: function get() { + return tmp.boundStyle + }, + set: function set(value) { + if (typeof(value) !== 'object') { + console.error(("boundStyle:" + value + " is invalid")); + } + tmp.boundStyle = value; + } + }, + onReady: { + default: null, + get: function get() { + return tmp.ready + }, + set: function set(value) { + tmp.ready = value; + } + }, + onBeforeImageLoad: { + default: null, + get: function get() { + return tmp.beforeImageLoad + }, + set: function set(value) { + tmp.beforeImageLoad = value; + } + }, + onImageLoad: { + default: null, + get: function get() { + return tmp.imageLoad + }, + set: function set(value) { + tmp.imageLoad = value; + } + }, + onBeforeDraw: { + default: null, + get: function get() { + return tmp.beforeDraw + }, + set: function set(value) { + tmp.beforeDraw = value; + } + } +}; + +var ref$1 = getDevice(); +var windowWidth = ref$1.windowWidth; + +function prepare() { + var self = this; + + // v1.4.0 版本中将不再自动绑定we-cropper实例 + self.attachPage = function() { + var pages = getCurrentPages(); + // 获取到当前page上下文 + var pageContext = pages[pages.length - 1]; + // 把this依附在Page上下文的wecropper属性上,便于在page钩子函数中访问 + Object.defineProperty(pageContext, 'wecropper', { + get: function get() { + console.warn( + 'Instance will not be automatically bound to the page after v1.4.0\n\n' + + 'Please use a custom instance name instead\n\n' + + 'Example: \n' + + 'this.mycropper = new WeCropper(options)\n\n' + + '// ...\n' + + 'this.mycropper.getCropperImage()' + ); + return self + }, + configurable: true + }); + }; + + self.createCtx = function() { + var id = self.id; + var targetId = self.targetId; + + if (id) { + self.ctx = self.ctx || uni.createCanvasContext(id); + self.targetCtx = self.targetCtx || uni.createCanvasContext(targetId); + } else { + console.error("constructor: create canvas context failed, 'id' must be valuable"); + } + }; + + self.deviceRadio = windowWidth / 750; +} + +var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== + 'undefined' ? self : {}; + + + + + +function createCommonjsModule(fn, module) { + return module = { + exports: {} + }, fn(module, module.exports), module.exports; +} + +var tools = createCommonjsModule(function(module, exports) { + /** + * String type check + */ + exports.isStr = function(v) { + return typeof v === 'string'; + }; + /** + * Number type check + */ + exports.isNum = function(v) { + return typeof v === 'number'; + }; + /** + * Array type check + */ + exports.isArr = Array.isArray; + /** + * undefined type check + */ + exports.isUndef = function(v) { + return v === undefined; + }; + + exports.isTrue = function(v) { + return v === true; + }; + + exports.isFalse = function(v) { + return v === false; + }; + /** + * Function type check + */ + exports.isFunc = function(v) { + return typeof v === 'function'; + }; + /** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ + exports.isObj = exports.isObject = function(obj) { + return obj !== null && typeof obj === 'object' + }; + + /** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ + var _toString = Object.prototype.toString; + exports.isPlainObject = function(obj) { + return _toString.call(obj) === '[object Object]' + }; + + /** + * Check whether the object has the property. + */ + var hasOwnProperty = Object.prototype.hasOwnProperty; + exports.hasOwn = function(obj, key) { + return hasOwnProperty.call(obj, key) + }; + + /** + * Perform no operation. + * Stubbing args to make Flow happy without leaving useless transpiled code + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/) + */ + exports.noop = function(a, b, c) {}; + + /** + * Check if val is a valid array index. + */ + exports.isValidArrayIndex = function(val) { + var n = parseFloat(String(val)); + return n >= 0 && Math.floor(n) === n && isFinite(val) + }; +}); + +var tools_7 = tools.isFunc; +var tools_10 = tools.isPlainObject; + +var EVENT_TYPE = ['ready', 'beforeImageLoad', 'beforeDraw', 'imageLoad']; + +function observer() { + var self = this; + + self.on = function(event, fn) { + if (EVENT_TYPE.indexOf(event) > -1) { + if (tools_7(fn)) { + event === 'ready' ? + fn(self) : + self[("on" + (firstLetterUpper(event)))] = fn; + } + } else { + console.error(("event: " + event + " is invalid")); + } + return self + }; +} + +function wxPromise(fn) { + return function(obj) { + var args = [], + len = arguments.length - 1; + while (len-- > 0) args[len] = arguments[len + 1]; + + if (obj === void 0) obj = {}; + return new Promise(function(resolve, reject) { + obj.success = function(res) { + resolve(res); + }; + obj.fail = function(err) { + reject(err); + }; + fn.apply(void 0, [obj].concat(args)); + }) + } +} + +function draw(ctx, reserve) { + if (reserve === void 0) reserve = false; + + return new Promise(function(resolve) { + ctx.draw(reserve, resolve); + }) +} + +var getImageInfo = wxPromise(uni.getImageInfo); + +var canvasToTempFilePath = wxPromise(uni.canvasToTempFilePath); + +var base64 = createCommonjsModule(function(module, exports) { + /*! http://mths.be/base64 v0.1.0 by @mathias | MIT license */ + (function(root) { + + // Detect free variables `exports`. + var freeExports = 'object' == 'object' && exports; + + // Detect free variable `module`. + var freeModule = 'object' == 'object' && module && + module.exports == freeExports && module; + + // Detect free variable `global`, from Node.js or Browserified code, and use + // it as `root`. + var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + var InvalidCharacterError = function(message) { + this.message = message; + }; + InvalidCharacterError.prototype = new Error; + InvalidCharacterError.prototype.name = 'InvalidCharacterError'; + + var error = function(message) { + // Note: the error messages used throughout this file match those used by + // the native `atob`/`btoa` implementation in Chromium. + throw new InvalidCharacterError(message); + }; + + var TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + // http://whatwg.org/html/common-microsyntaxes.html#space-character + var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g; + + // `decode` is designed to be fully compatible with `atob` as described in the + // HTML Standard. http://whatwg.org/html/webappapis.html#dom-windowbase64-atob + // The optimized base64-decoding algorithm used is based on @atk’s excellent + // implementation. https://gist.github.com/atk/1020396 + var decode = function(input) { + input = String(input) + .replace(REGEX_SPACE_CHARACTERS, ''); + var length = input.length; + if (length % 4 == 0) { + input = input.replace(/==?$/, ''); + length = input.length; + } + if ( + length % 4 == 1 || + // http://whatwg.org/C#alphanumeric-ascii-characters + /[^+a-zA-Z0-9/]/.test(input) + ) { + error( + 'Invalid character: the string to be decoded is not correctly encoded.' + ); + } + var bitCounter = 0; + var bitStorage; + var buffer; + var output = ''; + var position = -1; + while (++position < length) { + buffer = TABLE.indexOf(input.charAt(position)); + bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer; + // Unless this is the first of a group of 4 characters… + if (bitCounter++ % 4) { + // …convert the first 8 bits to a single ASCII character. + output += String.fromCharCode( + 0xFF & bitStorage >> (-2 * bitCounter & 6) + ); + } + } + return output; + }; + + // `encode` is designed to be fully compatible with `btoa` as described in the + // HTML Standard: http://whatwg.org/html/webappapis.html#dom-windowbase64-btoa + var encode = function(input) { + input = String(input); + if (/[^\0-\xFF]/.test(input)) { + // Note: no need to special-case astral symbols here, as surrogates are + // matched, and the input is supposed to only contain ASCII anyway. + error( + 'The string to be encoded contains characters outside of the ' + + 'Latin1 range.' + ); + } + var padding = input.length % 3; + var output = ''; + var position = -1; + var a; + var b; + var c; + var buffer; + // Make sure any padding is handled outside of the loop. + var length = input.length - padding; + + while (++position < length) { + // Read three bytes, i.e. 24 bits. + a = input.charCodeAt(position) << 16; + b = input.charCodeAt(++position) << 8; + c = input.charCodeAt(++position); + buffer = a + b + c; + // Turn the 24 bits into four chunks of 6 bits each, and append the + // matching character for each of them to the output. + output += ( + TABLE.charAt(buffer >> 18 & 0x3F) + + TABLE.charAt(buffer >> 12 & 0x3F) + + TABLE.charAt(buffer >> 6 & 0x3F) + + TABLE.charAt(buffer & 0x3F) + ); + } + + if (padding == 2) { + a = input.charCodeAt(position) << 8; + b = input.charCodeAt(++position); + buffer = a + b; + output += ( + TABLE.charAt(buffer >> 10) + + TABLE.charAt((buffer >> 4) & 0x3F) + + TABLE.charAt((buffer << 2) & 0x3F) + + '=' + ); + } else if (padding == 1) { + buffer = input.charCodeAt(position); + output += ( + TABLE.charAt(buffer >> 2) + + TABLE.charAt((buffer << 4) & 0x3F) + + '==' + ); + } + + return output; + }; + + var base64 = { + 'encode': encode, + 'decode': decode, + 'version': '0.1.0' + }; + + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + typeof undefined == 'function' && + typeof undefined.amd == 'object' && + undefined.amd + ) { + undefined(function() { + return base64; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { // in Node.js or RingoJS v0.8.0+ + freeModule.exports = base64; + } else { // in Narwhal or RingoJS v0.7.0- + for (var key in base64) { + base64.hasOwnProperty(key) && (freeExports[key] = base64[key]); + } + } + } else { // in Rhino or a web browser + root.base64 = base64; + } + + }(commonjsGlobal)); +}); + +function makeURI(strData, type) { + return 'data:' + type + ';base64,' + strData +} + +function fixType(type) { + type = type.toLowerCase().replace(/jpg/i, 'jpeg'); + var r = type.match(/png|jpeg|bmp|gif/)[0]; + return 'image/' + r +} + +function encodeData(data) { + var str = ''; + if (typeof data === 'string') { + str = data; + } else { + for (var i = 0; i < data.length; i++) { + str += String.fromCharCode(data[i]); + } + } + return base64.encode(str) +} + +/** + * 获取图像区域隐含的像素数据 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param done 完成回调 + */ +function getImageData(canvasId, x, y, width, height, done) { + uni.canvasGetImageData({ + canvasId: canvasId, + x: x, + y: y, + width: width, + height: height, + success: function success(res) { + done(res, null); + }, + fail: function fail(res) { + done(null, res); + } + }); +} + +/** + * 生成bmp格式图片 + * 按照规则生成图片响应头和响应体 + * @param oData 用来描述 canvas 区域隐含的像素数据 { data, width, height } = oData + * @returns {*} base64字符串 + */ +function genBitmapImage(oData) { + // + // BITMAPFILEHEADER: http://msdn.microsoft.com/en-us/library/windows/desktop/dd183374(v=vs.85).aspx + // BITMAPINFOHEADER: http://msdn.microsoft.com/en-us/library/dd183376.aspx + // + var biWidth = oData.width; + var biHeight = oData.height; + var biSizeImage = biWidth * biHeight * 3; + var bfSize = biSizeImage + 54; // total header size = 54 bytes + + // + // typedef struct tagBITMAPFILEHEADER { + // WORD bfType; + // DWORD bfSize; + // WORD bfReserved1; + // WORD bfReserved2; + // DWORD bfOffBits; + // } BITMAPFILEHEADER; + // + var BITMAPFILEHEADER = [ + // WORD bfType -- The file type signature; must be "BM" + 0x42, 0x4D, + // DWORD bfSize -- The size, in bytes, of the bitmap file + bfSize & 0xff, bfSize >> 8 & 0xff, bfSize >> 16 & 0xff, bfSize >> 24 & 0xff, + // WORD bfReserved1 -- Reserved; must be zero + 0, 0, + // WORD bfReserved2 -- Reserved; must be zero + 0, 0, + // DWORD bfOffBits -- The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits. + 54, 0, 0, 0 + ]; + + // + // typedef struct tagBITMAPINFOHEADER { + // DWORD biSize; + // LONG biWidth; + // LONG biHeight; + // WORD biPlanes; + // WORD biBitCount; + // DWORD biCompression; + // DWORD biSizeImage; + // LONG biXPelsPerMeter; + // LONG biYPelsPerMeter; + // DWORD biClrUsed; + // DWORD biClrImportant; + // } BITMAPINFOHEADER, *PBITMAPINFOHEADER; + // + var BITMAPINFOHEADER = [ + // DWORD biSize -- The number of bytes required by the structure + 40, 0, 0, 0, + // LONG biWidth -- The width of the bitmap, in pixels + biWidth & 0xff, biWidth >> 8 & 0xff, biWidth >> 16 & 0xff, biWidth >> 24 & 0xff, + // LONG biHeight -- The height of the bitmap, in pixels + biHeight & 0xff, biHeight >> 8 & 0xff, biHeight >> 16 & 0xff, biHeight >> 24 & 0xff, + // WORD biPlanes -- The number of planes for the target device. This value must be set to 1 + 1, 0, + // WORD biBitCount -- The number of bits-per-pixel, 24 bits-per-pixel -- the bitmap + // has a maximum of 2^24 colors (16777216, Truecolor) + 24, 0, + // DWORD biCompression -- The type of compression, BI_RGB (code 0) -- uncompressed + 0, 0, 0, 0, + // DWORD biSizeImage -- The size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps + biSizeImage & 0xff, biSizeImage >> 8 & 0xff, biSizeImage >> 16 & 0xff, biSizeImage >> 24 & 0xff, + // LONG biXPelsPerMeter, unused + 0, 0, 0, 0, + // LONG biYPelsPerMeter, unused + 0, 0, 0, 0, + // DWORD biClrUsed, the number of color indexes of palette, unused + 0, 0, 0, 0, + // DWORD biClrImportant, unused + 0, 0, 0, 0 + ]; + + var iPadding = (4 - ((biWidth * 3) % 4)) % 4; + + var aImgData = oData.data; + + var strPixelData = ''; + var biWidth4 = biWidth << 2; + var y = biHeight; + var fromCharCode = String.fromCharCode; + + do { + var iOffsetY = biWidth4 * (y - 1); + var strPixelRow = ''; + for (var x = 0; x < biWidth; x++) { + var iOffsetX = x << 2; + strPixelRow += fromCharCode(aImgData[iOffsetY + iOffsetX + 2]) + + fromCharCode(aImgData[iOffsetY + iOffsetX + 1]) + + fromCharCode(aImgData[iOffsetY + iOffsetX]); + } + + for (var c = 0; c < iPadding; c++) { + strPixelRow += String.fromCharCode(0); + } + + strPixelData += strPixelRow; + } while (--y) + + var strEncoded = encodeData(BITMAPFILEHEADER.concat(BITMAPINFOHEADER)) + encodeData(strPixelData); + + return strEncoded +} + +/** + * 转换为图片base64 + * @param canvasId canvas标识 + * @param x 将要被提取的图像数据矩形区域的左上角 x 坐标 + * @param y 将要被提取的图像数据矩形区域的左上角 y 坐标 + * @param width 将要被提取的图像数据矩形区域的宽度 + * @param height 将要被提取的图像数据矩形区域的高度 + * @param type 转换图片类型 + * @param done 完成回调 + */ +function convertToImage(canvasId, x, y, width, height, type, done) { + if (done === void 0) done = function() {}; + + if (type === undefined) { + type = 'png'; + } + type = fixType(type); + if (/bmp/.test(type)) { + getImageData(canvasId, x, y, width, height, function(data, err) { + var strData = genBitmapImage(data); + tools_7(done) && done(makeURI(strData, 'image/' + type), err); + }); + } else { + console.error('暂不支持生成\'' + type + '\'类型的base64图片'); + } +} + +var CanvasToBase64 = { + convertToImage: convertToImage, + // convertToPNG: function (width, height, done) { + // return convertToImage(width, height, 'png', done) + // }, + // convertToJPEG: function (width, height, done) { + // return convertToImage(width, height, 'jpeg', done) + // }, + // convertToGIF: function (width, height, done) { + // return convertToImage(width, height, 'gif', done) + // }, + convertToBMP: function(ref, done) { + if (ref === void 0) ref = {}; + var canvasId = ref.canvasId; + var x = ref.x; + var y = ref.y; + var width = ref.width; + var height = ref.height; + if (done === void 0) done = function() {}; + + return convertToImage(canvasId, x, y, width, height, 'bmp', done) + } +}; + +function methods() { + var self = this; + + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; // 裁剪框默认高度,即整个画布高度 + + var id = self.id; + var targetId = self.targetId; + var pixelRatio = self.pixelRatio; + + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + self.updateCanvas = function(done) { + if (self.croperTarget) { + // 画布绘制图片 + self.ctx.drawImage( + self.croperTarget, + self.imgLeft, + self.imgTop, + self.scaleWidth, + self.scaleHeight + ); + } + tools_7(self.onBeforeDraw) && self.onBeforeDraw(self.ctx, self); + + self.setBoundStyle(self.boundStyle); // 设置边界样式 + + self.ctx.draw(false, done); + return self + }; + + self.pushOrigin = self.pushOrign = function(src) { + self.src = src; + + tools_7(self.onBeforeImageLoad) && self.onBeforeImageLoad(self.ctx, self); + + return getImageInfo({ + src: src + }) + .then(function(res) { + var innerAspectRadio = res.width / res.height; + var customAspectRadio = width / height; + + self.croperTarget = res.path; + + if (innerAspectRadio < customAspectRadio) { + self.rectX = x; + self.baseWidth = width; + self.baseHeight = width / innerAspectRadio; + self.rectY = y - Math.abs((height - self.baseHeight) / 2); + } else { + self.rectY = y; + self.baseWidth = height * innerAspectRadio; + self.baseHeight = height; + self.rectX = x - Math.abs((width - self.baseWidth) / 2); + } + + self.imgLeft = self.rectX; + self.imgTop = self.rectY; + self.scaleWidth = self.baseWidth; + self.scaleHeight = self.baseHeight; + + self.update(); + + return new Promise(function(resolve) { + self.updateCanvas(resolve); + }) + }) + .then(function() { + tools_7(self.onImageLoad) && self.onImageLoad(self.ctx, self); + }) + }; + + self.removeImage = function() { + self.src = ''; + self.croperTarget = ''; + return draw(self.ctx) + }; + + self.getCropperBase64 = function(done) { + if (done === void 0) done = function() {}; + + CanvasToBase64.convertToBMP({ + canvasId: id, + x: x, + y: y, + width: width, + height: height + }, done); + }; + + self.getCropperImage = function(opt, fn) { + var customOptions = opt; + + var canvasOptions = { + canvasId: id, + x: x, + y: y, + width: width, + height: height + }; + + var task = function() { + return Promise.resolve(); + }; + + if ( + tools_10(customOptions) && + customOptions.original + ) { + // original mode + task = function() { + self.targetCtx.drawImage( + self.croperTarget, + self.imgLeft * pixelRatio, + self.imgTop * pixelRatio, + self.scaleWidth * pixelRatio, + self.scaleHeight * pixelRatio + ); + + canvasOptions = { + canvasId: targetId, + x: x * pixelRatio, + y: y * pixelRatio, + width: width * pixelRatio, + height: height * pixelRatio + }; + + return draw(self.targetCtx) + }; + } + + return task() + .then(function() { + if (tools_10(customOptions)) { + canvasOptions = Object.assign({}, canvasOptions, customOptions); + } + + if (tools_7(customOptions)) { + fn = customOptions; + } + + var arg = canvasOptions.componentContext ? [canvasOptions, canvasOptions.componentContext] : [canvasOptions]; + + return canvasToTempFilePath.apply(null, arg) + }) + .then(function(res) { + var tempFilePath = res.tempFilePath; + + return tools_7(fn) ? + fn.call(self, tempFilePath, null) : + tempFilePath + }) + .catch(function(err) { + if (tools_7(fn)) { + fn.call(self, null, err); + } else { + throw err + } + }) + }; +} + +/** + * 获取最新缩放值 + * @param oldScale 上一次触摸结束后的缩放值 + * @param oldDistance 上一次触摸结束后的双指距离 + * @param zoom 缩放系数 + * @param touch0 第一指touch对象 + * @param touch1 第二指touch对象 + * @returns {*} + */ +var getNewScale = function(oldScale, oldDistance, zoom, touch0, touch1) { + var xMove, yMove, newDistance; + // 计算二指最新距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + newDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + return oldScale + 0.001 * zoom * (newDistance - oldDistance) +}; + +function update() { + var self = this; + + if (!self.src) { + return + } + + self.__oneTouchStart = function(touch) { + self.touchX0 = Math.round(touch.x); + self.touchY0 = Math.round(touch.y); + }; + + self.__oneTouchMove = function(touch) { + var xMove, yMove; + // 计算单指移动的距离 + if (self.touchended) { + return self.updateCanvas() + } + xMove = Math.round(touch.x - self.touchX0); + yMove = Math.round(touch.y - self.touchY0); + + var imgLeft = Math.round(self.rectX + xMove); + var imgTop = Math.round(self.rectY + yMove); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__twoTouchStart = function(touch0, touch1) { + var xMove, yMove, oldDistance; + + self.touchX1 = Math.round(self.rectX + self.scaleWidth / 2); + self.touchY1 = Math.round(self.rectY + self.scaleHeight / 2); + + // 计算两指距离 + xMove = Math.round(touch1.x - touch0.x); + yMove = Math.round(touch1.y - touch0.y); + oldDistance = Math.round(Math.sqrt(xMove * xMove + yMove * yMove)); + + self.oldDistance = oldDistance; + }; + + self.__twoTouchMove = function(touch0, touch1) { + var oldScale = self.oldScale; + var oldDistance = self.oldDistance; + var scale = self.scale; + var zoom = self.zoom; + + self.newScale = getNewScale(oldScale, oldDistance, zoom, touch0, touch1); + + // 设定缩放范围 + self.newScale <= 1 && (self.newScale = 1); + self.newScale >= scale && (self.newScale = scale); + + self.scaleWidth = Math.round(self.newScale * self.baseWidth); + self.scaleHeight = Math.round(self.newScale * self.baseHeight); + var imgLeft = Math.round(self.touchX1 - self.scaleWidth / 2); + var imgTop = Math.round(self.touchY1 - self.scaleHeight / 2); + + self.outsideBound(imgLeft, imgTop); + + self.updateCanvas(); + }; + + self.__xtouchEnd = function() { + self.oldScale = self.newScale; + self.rectX = self.imgLeft; + self.rectY = self.imgTop; + }; +} + +var handle = { + // 图片手势初始监测 + touchStart: function touchStart(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, true, null, null); + + // 计算第一个触摸点的位置,并参照改点进行缩放 + self.__oneTouchStart(touch0); + + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchStart(touch0, touch1); + } + }, + + // 图片手势动态缩放 + touchMove: function touchMove(e) { + var self = this; + var ref = e.touches; + var touch0 = ref[0]; + var touch1 = ref[1]; + + if (!self.src) { + return + } + + setTouchState(self, null, true); + + // 单指手势时触发 + if (e.touches.length === 1) { + self.__oneTouchMove(touch0); + } + // 两指手势触发 + if (e.touches.length >= 2) { + self.__twoTouchMove(touch0, touch1); + } + }, + + touchEnd: function touchEnd(e) { + var self = this; + + if (!self.src) { + return + } + + setTouchState(self, false, false, true); + self.__xtouchEnd(); + } +}; + +function cut() { + var self = this; + var boundWidth = self.width; // 裁剪框默认宽度,即整个画布宽度 + var boundHeight = self.height; + // 裁剪框默认高度,即整个画布高度 + var ref = self.cut; + var x = ref.x; + if (x === void 0) x = 0; + var y = ref.y; + if (y === void 0) y = 0; + var width = ref.width; + if (width === void 0) width = boundWidth; + var height = ref.height; + if (height === void 0) height = boundHeight; + + /** + * 设置边界 + * @param imgLeft 图片左上角横坐标值 + * @param imgTop 图片左上角纵坐标值 + */ + self.outsideBound = function(imgLeft, imgTop) { + self.imgLeft = imgLeft >= x ? + x : + self.scaleWidth + imgLeft - x <= width ? + x + width - self.scaleWidth : + imgLeft; + + self.imgTop = imgTop >= y ? + y : + self.scaleHeight + imgTop - y <= height ? + y + height - self.scaleHeight : + imgTop; + }; + + /** + * 设置边界样式 + * @param color 边界颜色 + */ + self.setBoundStyle = function(ref) { + if (ref === void 0) ref = {}; + var color = ref.color; + if (color === void 0) color = '#04b00f'; + var mask = ref.mask; + if (mask === void 0) mask = 'rgba(0, 0, 0, 0.3)'; + var lineWidth = ref.lineWidth; + if (lineWidth === void 0) lineWidth = 1; + + var half = lineWidth / 2; + var boundOption = [{ + start: { + x: x - half, + y: y + 10 - half + }, + step1: { + x: x - half, + y: y - half + }, + step2: { + x: x + 10 - half, + y: y - half + } + }, + { + start: { + x: x - half, + y: y + height - 10 + half + }, + step1: { + x: x - half, + y: y + height + half + }, + step2: { + x: x + 10 - half, + y: y + height + half + } + }, + { + start: { + x: x + width - 10 + half, + y: y - half + }, + step1: { + x: x + width + half, + y: y - half + }, + step2: { + x: x + width + half, + y: y + 10 - half + } + }, + { + start: { + x: x + width + half, + y: y + height - 10 + half + }, + step1: { + x: x + width + half, + y: y + height + half + }, + step2: { + x: x + width - 10 + half, + y: y + height + half + } + } + ]; + + // 绘制半透明层 + self.ctx.beginPath(); + self.ctx.setFillStyle(mask); + self.ctx.fillRect(0, 0, x, boundHeight); + self.ctx.fillRect(x, 0, width, y); + self.ctx.fillRect(x, y + height, width, boundHeight - y - height); + self.ctx.fillRect(x + width, 0, boundWidth - x - width, boundHeight); + self.ctx.fill(); + + boundOption.forEach(function(op) { + self.ctx.beginPath(); + self.ctx.setStrokeStyle(color); + self.ctx.setLineWidth(lineWidth); + self.ctx.moveTo(op.start.x, op.start.y); + self.ctx.lineTo(op.step1.x, op.step1.y); + self.ctx.lineTo(op.step2.x, op.step2.y); + self.ctx.stroke(); + }); + }; +} + +var version = "1.3.9"; + +var WeCropper = function WeCropper(params) { + var self = this; + var _default = {}; + + validator(self, DEFAULT); + + Object.keys(DEFAULT).forEach(function(key) { + _default[key] = DEFAULT[key].default; + }); + Object.assign(self, _default, params); + + self.prepare(); + self.attachPage(); + self.createCtx(); + self.observer(); + self.cutt(); + self.methods(); + self.init(); + self.update(); + + return self +}; + +WeCropper.prototype.init = function init() { + var self = this; + var src = self.src; + + self.version = version; + + typeof self.onReady === 'function' && self.onReady(self.ctx, self); + + if (src) { + self.pushOrign(src); + } else { + self.updateCanvas(); + } + setTouchState(self, false, false, false); + + self.oldScale = 1; + self.newScale = 1; + + return self +}; + +Object.assign(WeCropper.prototype, handle); + +WeCropper.prototype.prepare = prepare; +WeCropper.prototype.observer = observer; +WeCropper.prototype.methods = methods; +WeCropper.prototype.cutt = cut; +WeCropper.prototype.update = update; + +export default WeCropper; diff --git a/uni_modules/vk-uview-ui/components/u-avatar/u-avatar.vue b/uni_modules/vk-uview-ui/components/u-avatar/u-avatar.vue new file mode 100644 index 0000000..3764160 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-avatar/u-avatar.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-back-top/u-back-top.vue b/uni_modules/vk-uview-ui/components/u-back-top/u-back-top.vue new file mode 100644 index 0000000..fa9bc9f --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-back-top/u-back-top.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-badge/u-badge.vue b/uni_modules/vk-uview-ui/components/u-badge/u-badge.vue new file mode 100644 index 0000000..3da89b5 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-badge/u-badge.vue @@ -0,0 +1,216 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-button/u-button.vue b/uni_modules/vk-uview-ui/components/u-button/u-button.vue new file mode 100644 index 0000000..c6cf375 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-button/u-button.vue @@ -0,0 +1,661 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-calendar/u-calendar.vue b/uni_modules/vk-uview-ui/components/u-calendar/u-calendar.vue new file mode 100644 index 0000000..c9f6b8b --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-calendar/u-calendar.vue @@ -0,0 +1,682 @@ + + + + diff --git a/uni_modules/vk-uview-ui/components/u-car-keyboard/u-car-keyboard.vue b/uni_modules/vk-uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file mode 100644 index 0000000..e55db26 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-car-keyboard/u-car-keyboard.vue @@ -0,0 +1,267 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-card/u-card.vue b/uni_modules/vk-uview-ui/components/u-card/u-card.vue new file mode 100644 index 0000000..a795dc4 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-card/u-card.vue @@ -0,0 +1,301 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-cell-group/u-cell-group.vue b/uni_modules/vk-uview-ui/components/u-cell-group/u-cell-group.vue new file mode 100644 index 0000000..3fbca72 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-cell-group/u-cell-group.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-cell-item/u-cell-item.vue b/uni_modules/vk-uview-ui/components/u-cell-item/u-cell-item.vue new file mode 100644 index 0000000..0dd3895 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-cell-item/u-cell-item.vue @@ -0,0 +1,317 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uni_modules/vk-uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file mode 100644 index 0000000..18c39e7 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-checkbox-group/u-checkbox-group.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-checkbox/u-checkbox.vue b/uni_modules/vk-uview-ui/components/u-checkbox/u-checkbox.vue new file mode 100644 index 0000000..6d9d862 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-checkbox/u-checkbox.vue @@ -0,0 +1,338 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-circle-progress/u-circle-progress.vue b/uni_modules/vk-uview-ui/components/u-circle-progress/u-circle-progress.vue new file mode 100644 index 0000000..b5796a4 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-circle-progress/u-circle-progress.vue @@ -0,0 +1,227 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-col/u-col.vue b/uni_modules/vk-uview-ui/components/u-col/u-col.vue new file mode 100644 index 0000000..7552bf7 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-col/u-col.vue @@ -0,0 +1,157 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/vk-uview-ui/components/u-collapse-item/u-collapse-item.vue b/uni_modules/vk-uview-ui/components/u-collapse-item/u-collapse-item.vue new file mode 100644 index 0000000..a240817 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-collapse-item/u-collapse-item.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-collapse/u-collapse.vue b/uni_modules/vk-uview-ui/components/u-collapse/u-collapse.vue new file mode 100644 index 0000000..f6e4bf0 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-collapse/u-collapse.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-column-notice/u-column-notice.vue b/uni_modules/vk-uview-ui/components/u-column-notice/u-column-notice.vue new file mode 100644 index 0000000..709ca5c --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-column-notice/u-column-notice.vue @@ -0,0 +1,238 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-count-down/u-count-down.vue b/uni_modules/vk-uview-ui/components/u-count-down/u-count-down.vue new file mode 100644 index 0000000..962d10a --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-count-down/u-count-down.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-count-down/utils.js b/uni_modules/vk-uview-ui/components/u-count-down/utils.js new file mode 100644 index 0000000..8c75005 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-count-down/utils.js @@ -0,0 +1,62 @@ +// 补0,如1 -> 01 +function padZero(num, targetLength = 2) { + let str = `${num}` + while (str.length < targetLength) { + str = `0${str}` + } + return str +} +const SECOND = 1000 +const MINUTE = 60 * SECOND +const HOUR = 60 * MINUTE +const DAY = 24 * HOUR +export function parseTimeData(time) { + const days = Math.floor(time / DAY) + const hours = Math.floor((time % DAY) / HOUR) + const minutes = Math.floor((time % HOUR) / MINUTE) + const seconds = Math.floor((time % MINUTE) / SECOND) + const milliseconds = Math.floor(time % SECOND) + return { + days, + hours, + minutes, + seconds, + milliseconds + } +} +export function parseFormat(format, timeData) { + let { + days, + hours, + minutes, + seconds, + milliseconds + } = timeData + // 如果格式化字符串中不存在DD(天),则将天的时间转为小时中去 + if (format.indexOf('DD') === -1) { + hours += days * 24 + } else { + // 对天补0 + format = format.replace('DD', padZero(days)) + } + // 其他同理于DD的格式化处理方式 + if (format.indexOf('HH') === -1) { + minutes += hours * 60 + } else { + format = format.replace('HH', padZero(hours)) + } + if (format.indexOf('mm') === -1) { + seconds += minutes * 60 + } else { + format = format.replace('mm', padZero(minutes)) + } + if (format.indexOf('ss') === -1) { + milliseconds += seconds * 1000 + } else { + format = format.replace('ss', padZero(seconds)) + } + return format.replace('SSS', padZero(milliseconds, 3)) +} +export function isSameSecond(time1, time2) { + return Math.floor(time1 / 1000) === Math.floor(time2 / 1000) +} diff --git a/uni_modules/vk-uview-ui/components/u-count-to/u-count-to.vue b/uni_modules/vk-uview-ui/components/u-count-to/u-count-to.vue new file mode 100644 index 0000000..107eea4 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-count-to/u-count-to.vue @@ -0,0 +1,266 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-divider/u-divider.vue b/uni_modules/vk-uview-ui/components/u-divider/u-divider.vue new file mode 100644 index 0000000..d09e439 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-divider/u-divider.vue @@ -0,0 +1,159 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-dropdown-item/u-dropdown-item.vue b/uni_modules/vk-uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file mode 100644 index 0000000..81eba63 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-dropdown-item/u-dropdown-item.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-dropdown/u-dropdown.vue b/uni_modules/vk-uview-ui/components/u-dropdown/u-dropdown.vue new file mode 100644 index 0000000..2f335ef --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-dropdown/u-dropdown.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-empty/u-empty.vue b/uni_modules/vk-uview-ui/components/u-empty/u-empty.vue new file mode 100644 index 0000000..2c77b24 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-empty/u-empty.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/uni_modules/vk-uview-ui/components/u-field/u-field.vue b/uni_modules/vk-uview-ui/components/u-field/u-field.vue new file mode 100644 index 0000000..f7c7235 --- /dev/null +++ b/uni_modules/vk-uview-ui/components/u-field/u-field.vue @@ -0,0 +1,402 @@ +