From e4c29a08b4afb8111dc57516821e6fe47f57eb5d Mon Sep 17 00:00:00 2001 From: lcj <17763797832@163.com> Date: Tue, 14 Jul 2026 11:56:33 +0800 Subject: [PATCH] 123 --- App.vue | 17 + common/http.api.js | 23 + common/http.interceptor.js | 62 + components/TabBar/TabBar.vue | 81 + index.html | 20 + main.js | 29 + manifest.json | 72 + pages.json | 83 + pages/discount/discount.vue | 30 + pages/guide/join.vue | 30 + pages/guide/use.vue | 30 + pages/index/index.vue | 188 +++ pages/mine/mine.vue | 24 + pages/rights/rights.vue | 30 + pages/venue/venue.vue | 30 + pages/winners/winners.vue | 30 + static/logo.png | Bin 0 -> 4023 bytes static/shouye.png | Bin 0 -> 640 bytes static/shouye_select.png | Bin 0 -> 594 bytes static/wode.png | Bin 0 -> 996 bytes static/wode_select.png | Bin 0 -> 860 bytes uni.promisify.adaptor.js | 13 + uni.scss | 77 + uview-ui/LICENSE | 21 + uview-ui/README.md | 106 ++ .../u-action-sheet/u-action-sheet.vue | 190 +++ .../components/u-alert-tips/u-alert-tips.vue | 256 ++++ .../u-avatar-cropper/u-avatar-cropper.vue | 290 ++++ .../components/u-avatar-cropper/weCropper.js | 1265 +++++++++++++++ uview-ui/components/u-avatar/u-avatar.vue | 244 +++ uview-ui/components/u-back-top/u-back-top.vue | 153 ++ uview-ui/components/u-badge/u-badge.vue | 216 +++ uview-ui/components/u-button/u-button.vue | 596 ++++++++ uview-ui/components/u-calendar/u-calendar.vue | 639 ++++++++ .../u-car-keyboard/u-car-keyboard.vue | 257 ++++ uview-ui/components/u-card/u-card.vue | 299 ++++ .../components/u-cell-group/u-cell-group.vue | 70 + .../components/u-cell-item/u-cell-item.vue | 316 ++++ .../u-checkbox-group/u-checkbox-group.vue | 123 ++ uview-ui/components/u-checkbox/u-checkbox.vue | 284 ++++ .../u-circle-progress/u-circle-progress.vue | 220 +++ .../u-line-progress/u-line-progress.vue | 147 ++ uview-ui/components/u-col/u-col.vue | 156 ++ .../u-collapse-item/u-collapse-item.vue | 205 +++ uview-ui/components/u-collapse/u-collapse.vue | 99 ++ .../u-column-notice/u-column-notice.vue | 237 +++ .../components/u-count-down/u-count-down.vue | 318 ++++ uview-ui/components/u-count-to/u-count-to.vue | 241 +++ uview-ui/components/u-divider/u-divider.vue | 153 ++ .../u-dropdown-item/u-dropdown-item.vue | 132 ++ uview-ui/components/u-dropdown/u-dropdown.vue | 298 ++++ uview-ui/components/u-empty/u-empty.vue | 193 +++ uview-ui/components/u-field/u-field.vue | 384 +++++ .../components/u-form-item/u-form-item.vue | 431 ++++++ uview-ui/components/u-form/u-form.vue | 134 ++ .../u-full-screen/u-full-screen.vue | 52 + uview-ui/components/u-gap/u-gap.vue | 54 + .../components/u-grid-item/u-grid-item.vue | 126 ++ uview-ui/components/u-grid/u-grid.vue | 108 ++ uview-ui/components/u-icon/u-icon.vue | 336 ++++ uview-ui/components/u-image/u-image.vue | 267 ++++ .../u-index-anchor/u-index-anchor.vue | 89 ++ .../components/u-index-list/u-index-list.vue | 315 ++++ uview-ui/components/u-input/u-input.vue | 387 +++++ uview-ui/components/u-keyboard/u-keyboard.vue | 217 +++ .../components/u-lazy-load/u-lazy-load.vue | 244 +++ .../u-line-progress/u-line-progress.vue | 147 ++ uview-ui/components/u-line/u-line.vue | 84 + uview-ui/components/u-link/u-link.vue | 89 ++ .../u-loading-page/u-loading-page.vue | 25 + uview-ui/components/u-loading/u-loading.vue | 103 ++ uview-ui/components/u-loadmore/u-loadmore.vue | 203 +++ uview-ui/components/u-mask/u-mask.vue | 123 ++ .../u-message-input/u-message-input.vue | 311 ++++ uview-ui/components/u-modal/u-modal.vue | 283 ++++ uview-ui/components/u-navbar/u-navbar.vue | 315 ++++ .../components/u-no-network/u-no-network.vue | 233 +++ .../components/u-notice-bar/u-notice-bar.vue | 272 ++++ .../components/u-number-box/u-number-box.vue | 363 +++++ .../u-number-keyboard/u-number-keyboard.vue | 158 ++ .../components/u-parse/libs/CssHandler.js | 100 ++ .../components/u-parse/libs/MpHtmlParser.js | 580 +++++++ uview-ui/components/u-parse/libs/config.js | 80 + uview-ui/components/u-parse/libs/handler.wxs | 22 + uview-ui/components/u-parse/libs/trees.vue | 505 ++++++ uview-ui/components/u-parse/u-parse.vue | 645 ++++++++ uview-ui/components/u-picker/u-picker.vue | 676 ++++++++ uview-ui/components/u-popup/u-popup.vue | 456 ++++++ .../u-radio-group/u-radio-group.vue | 128 ++ uview-ui/components/u-radio/u-radio.vue | 271 ++++ uview-ui/components/u-rate/u-rate.vue | 275 ++++ .../components/u-read-more/u-read-more.vue | 179 +++ .../components/u-row-notice/u-row-notice.vue | 269 ++++ uview-ui/components/u-row/u-row.vue | 84 + uview-ui/components/u-search/u-search.vue | 342 +++++ uview-ui/components/u-section/u-section.vue | 154 ++ uview-ui/components/u-select/u-select.vue | 417 +++++ uview-ui/components/u-skeleton/u-skeleton.vue | 199 +++ uview-ui/components/u-slider/u-slider.vue | 257 ++++ uview-ui/components/u-steps/u-steps.vue | 200 +++ uview-ui/components/u-sticky/u-sticky.vue | 157 ++ .../components/u-subsection/u-subsection.vue | 355 +++++ .../u-swipe-action/u-swipe-action.vue | 255 ++++ uview-ui/components/u-swiper/u-swiper.vue | 340 +++++ uview-ui/components/u-switch/u-switch.vue | 163 ++ uview-ui/components/u-tabbar/u-tabbar.vue | 330 ++++ uview-ui/components/u-table/u-table.vue | 84 + .../u-tabs-swiper/u-tabs-swiper.vue | 488 ++++++ uview-ui/components/u-tabs/u-tabs.vue | 369 +++++ uview-ui/components/u-tag/u-tag.vue | 294 ++++ uview-ui/components/u-td/u-td.vue | 66 + uview-ui/components/u-th/u-th.vue | 63 + .../u-time-line-item/u-time-line-item.vue | 83 + .../components/u-time-line/u-time-line.vue | 43 + uview-ui/components/u-toast/u-toast.vue | 220 +++ uview-ui/components/u-top-tips/u-top-tips.vue | 121 ++ uview-ui/components/u-tr/u-tr.vue | 25 + uview-ui/components/u-upload/u-upload.vue | 654 ++++++++ .../u-verification-code.vue | 164 ++ .../components/u-waterfall/u-waterfall.vue | 176 +++ uview-ui/components/uview-v1/uview-v1.vue | 0 uview-ui/iconfont.css | 910 +++++++++++ uview-ui/index.js | 141 ++ uview-ui/index.scss | 23 + uview-ui/libs/config/config.js | 15 + uview-ui/libs/config/zIndex.js | 20 + uview-ui/libs/css/color.scss | 155 ++ uview-ui/libs/css/common.scss | 176 +++ uview-ui/libs/css/style.components.scss | 7 + uview-ui/libs/css/style.h5.scss | 8 + uview-ui/libs/css/style.mp.scss | 72 + uview-ui/libs/css/style.nvue.scss | 3 + uview-ui/libs/css/style.vue.scss | 175 +++ uview-ui/libs/function/$parent.js | 18 + uview-ui/libs/function/addUnit.js | 8 + uview-ui/libs/function/bem.js | 5 + uview-ui/libs/function/color.js | 37 + uview-ui/libs/function/colorGradient.js | 134 ++ uview-ui/libs/function/debounce.js | 29 + uview-ui/libs/function/deepClone.js | 23 + uview-ui/libs/function/deepMerge.js | 30 + uview-ui/libs/function/getParent.js | 47 + uview-ui/libs/function/guid.js | 41 + uview-ui/libs/function/md5.js | 385 +++++ uview-ui/libs/function/queryParams.js | 58 + uview-ui/libs/function/random.js | 10 + uview-ui/libs/function/randomArray.js | 7 + uview-ui/libs/function/route.js | 122 ++ uview-ui/libs/function/sys.js | 9 + uview-ui/libs/function/test.js | 232 +++ uview-ui/libs/function/throttle.js | 32 + uview-ui/libs/function/timeFormat.js | 51 + uview-ui/libs/function/timeFrom.js | 47 + uview-ui/libs/function/toast.js | 9 + uview-ui/libs/function/trim.js | 15 + uview-ui/libs/function/type2icon.js | 35 + uview-ui/libs/mixin/mixin.js | 64 + uview-ui/libs/mixin/mpShare.js | 18 + uview-ui/libs/request/index.js | 169 ++ uview-ui/libs/store/index.js | 19 + uview-ui/libs/util/area.js | 1 + uview-ui/libs/util/async-validator.js | 1356 +++++++++++++++++ uview-ui/libs/util/city.js | 1 + uview-ui/libs/util/emitter.js | 51 + uview-ui/libs/util/province.js | 1 + uview-ui/package.json | 39 + uview-ui/theme.scss | 38 + 167 files changed, 29581 insertions(+) create mode 100644 App.vue create mode 100644 common/http.api.js create mode 100644 common/http.interceptor.js create mode 100644 components/TabBar/TabBar.vue create mode 100644 index.html create mode 100644 main.js create mode 100644 manifest.json create mode 100644 pages.json create mode 100644 pages/discount/discount.vue create mode 100644 pages/guide/join.vue create mode 100644 pages/guide/use.vue create mode 100644 pages/index/index.vue create mode 100644 pages/mine/mine.vue create mode 100644 pages/rights/rights.vue create mode 100644 pages/venue/venue.vue create mode 100644 pages/winners/winners.vue create mode 100644 static/logo.png create mode 100644 static/shouye.png create mode 100644 static/shouye_select.png create mode 100644 static/wode.png create mode 100644 static/wode_select.png create mode 100644 uni.promisify.adaptor.js create mode 100644 uni.scss create mode 100644 uview-ui/LICENSE create mode 100644 uview-ui/README.md create mode 100644 uview-ui/components/u-action-sheet/u-action-sheet.vue create mode 100644 uview-ui/components/u-alert-tips/u-alert-tips.vue create mode 100644 uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue create mode 100644 uview-ui/components/u-avatar-cropper/weCropper.js create mode 100644 uview-ui/components/u-avatar/u-avatar.vue create mode 100644 uview-ui/components/u-back-top/u-back-top.vue create mode 100644 uview-ui/components/u-badge/u-badge.vue create mode 100644 uview-ui/components/u-button/u-button.vue create mode 100644 uview-ui/components/u-calendar/u-calendar.vue create mode 100644 uview-ui/components/u-car-keyboard/u-car-keyboard.vue create mode 100644 uview-ui/components/u-card/u-card.vue create mode 100644 uview-ui/components/u-cell-group/u-cell-group.vue create mode 100644 uview-ui/components/u-cell-item/u-cell-item.vue create mode 100644 uview-ui/components/u-checkbox-group/u-checkbox-group.vue create mode 100644 uview-ui/components/u-checkbox/u-checkbox.vue create mode 100644 uview-ui/components/u-circle-progress/u-circle-progress.vue create mode 100644 uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue create mode 100644 uview-ui/components/u-col/u-col.vue create mode 100644 uview-ui/components/u-collapse-item/u-collapse-item.vue create mode 100644 uview-ui/components/u-collapse/u-collapse.vue create mode 100644 uview-ui/components/u-column-notice/u-column-notice.vue create mode 100644 uview-ui/components/u-count-down/u-count-down.vue create mode 100644 uview-ui/components/u-count-to/u-count-to.vue create mode 100644 uview-ui/components/u-divider/u-divider.vue create mode 100644 uview-ui/components/u-dropdown-item/u-dropdown-item.vue create mode 100644 uview-ui/components/u-dropdown/u-dropdown.vue create mode 100644 uview-ui/components/u-empty/u-empty.vue create mode 100644 uview-ui/components/u-field/u-field.vue create mode 100644 uview-ui/components/u-form-item/u-form-item.vue create mode 100644 uview-ui/components/u-form/u-form.vue create mode 100644 uview-ui/components/u-full-screen/u-full-screen.vue create mode 100644 uview-ui/components/u-gap/u-gap.vue create mode 100644 uview-ui/components/u-grid-item/u-grid-item.vue create mode 100644 uview-ui/components/u-grid/u-grid.vue create mode 100644 uview-ui/components/u-icon/u-icon.vue create mode 100644 uview-ui/components/u-image/u-image.vue create mode 100644 uview-ui/components/u-index-anchor/u-index-anchor.vue create mode 100644 uview-ui/components/u-index-list/u-index-list.vue create mode 100644 uview-ui/components/u-input/u-input.vue create mode 100644 uview-ui/components/u-keyboard/u-keyboard.vue create mode 100644 uview-ui/components/u-lazy-load/u-lazy-load.vue create mode 100644 uview-ui/components/u-line-progress/u-line-progress.vue create mode 100644 uview-ui/components/u-line/u-line.vue create mode 100644 uview-ui/components/u-link/u-link.vue create mode 100644 uview-ui/components/u-loading-page/u-loading-page.vue create mode 100644 uview-ui/components/u-loading/u-loading.vue create mode 100644 uview-ui/components/u-loadmore/u-loadmore.vue create mode 100644 uview-ui/components/u-mask/u-mask.vue create mode 100644 uview-ui/components/u-message-input/u-message-input.vue create mode 100644 uview-ui/components/u-modal/u-modal.vue create mode 100644 uview-ui/components/u-navbar/u-navbar.vue create mode 100644 uview-ui/components/u-no-network/u-no-network.vue create mode 100644 uview-ui/components/u-notice-bar/u-notice-bar.vue create mode 100644 uview-ui/components/u-number-box/u-number-box.vue create mode 100644 uview-ui/components/u-number-keyboard/u-number-keyboard.vue create mode 100644 uview-ui/components/u-parse/libs/CssHandler.js create mode 100644 uview-ui/components/u-parse/libs/MpHtmlParser.js create mode 100644 uview-ui/components/u-parse/libs/config.js create mode 100644 uview-ui/components/u-parse/libs/handler.wxs create mode 100644 uview-ui/components/u-parse/libs/trees.vue create mode 100644 uview-ui/components/u-parse/u-parse.vue create mode 100644 uview-ui/components/u-picker/u-picker.vue create mode 100644 uview-ui/components/u-popup/u-popup.vue create mode 100644 uview-ui/components/u-radio-group/u-radio-group.vue create mode 100644 uview-ui/components/u-radio/u-radio.vue create mode 100644 uview-ui/components/u-rate/u-rate.vue create mode 100644 uview-ui/components/u-read-more/u-read-more.vue create mode 100644 uview-ui/components/u-row-notice/u-row-notice.vue create mode 100644 uview-ui/components/u-row/u-row.vue create mode 100644 uview-ui/components/u-search/u-search.vue create mode 100644 uview-ui/components/u-section/u-section.vue create mode 100644 uview-ui/components/u-select/u-select.vue create mode 100644 uview-ui/components/u-skeleton/u-skeleton.vue create mode 100644 uview-ui/components/u-slider/u-slider.vue create mode 100644 uview-ui/components/u-steps/u-steps.vue create mode 100644 uview-ui/components/u-sticky/u-sticky.vue create mode 100644 uview-ui/components/u-subsection/u-subsection.vue create mode 100644 uview-ui/components/u-swipe-action/u-swipe-action.vue create mode 100644 uview-ui/components/u-swiper/u-swiper.vue create mode 100644 uview-ui/components/u-switch/u-switch.vue create mode 100644 uview-ui/components/u-tabbar/u-tabbar.vue create mode 100644 uview-ui/components/u-table/u-table.vue create mode 100644 uview-ui/components/u-tabs-swiper/u-tabs-swiper.vue create mode 100644 uview-ui/components/u-tabs/u-tabs.vue create mode 100644 uview-ui/components/u-tag/u-tag.vue create mode 100644 uview-ui/components/u-td/u-td.vue create mode 100644 uview-ui/components/u-th/u-th.vue create mode 100644 uview-ui/components/u-time-line-item/u-time-line-item.vue create mode 100644 uview-ui/components/u-time-line/u-time-line.vue create mode 100644 uview-ui/components/u-toast/u-toast.vue create mode 100644 uview-ui/components/u-top-tips/u-top-tips.vue create mode 100644 uview-ui/components/u-tr/u-tr.vue create mode 100644 uview-ui/components/u-upload/u-upload.vue create mode 100644 uview-ui/components/u-verification-code/u-verification-code.vue create mode 100644 uview-ui/components/u-waterfall/u-waterfall.vue create mode 100644 uview-ui/components/uview-v1/uview-v1.vue create mode 100644 uview-ui/iconfont.css create mode 100644 uview-ui/index.js create mode 100644 uview-ui/index.scss create mode 100644 uview-ui/libs/config/config.js create mode 100644 uview-ui/libs/config/zIndex.js create mode 100644 uview-ui/libs/css/color.scss create mode 100644 uview-ui/libs/css/common.scss create mode 100644 uview-ui/libs/css/style.components.scss create mode 100644 uview-ui/libs/css/style.h5.scss create mode 100644 uview-ui/libs/css/style.mp.scss create mode 100644 uview-ui/libs/css/style.nvue.scss create mode 100644 uview-ui/libs/css/style.vue.scss create mode 100644 uview-ui/libs/function/$parent.js create mode 100644 uview-ui/libs/function/addUnit.js create mode 100644 uview-ui/libs/function/bem.js create mode 100644 uview-ui/libs/function/color.js create mode 100644 uview-ui/libs/function/colorGradient.js create mode 100644 uview-ui/libs/function/debounce.js create mode 100644 uview-ui/libs/function/deepClone.js create mode 100644 uview-ui/libs/function/deepMerge.js create mode 100644 uview-ui/libs/function/getParent.js create mode 100644 uview-ui/libs/function/guid.js create mode 100644 uview-ui/libs/function/md5.js create mode 100644 uview-ui/libs/function/queryParams.js create mode 100644 uview-ui/libs/function/random.js create mode 100644 uview-ui/libs/function/randomArray.js create mode 100644 uview-ui/libs/function/route.js create mode 100644 uview-ui/libs/function/sys.js create mode 100644 uview-ui/libs/function/test.js create mode 100644 uview-ui/libs/function/throttle.js create mode 100644 uview-ui/libs/function/timeFormat.js create mode 100644 uview-ui/libs/function/timeFrom.js create mode 100644 uview-ui/libs/function/toast.js create mode 100644 uview-ui/libs/function/trim.js create mode 100644 uview-ui/libs/function/type2icon.js create mode 100644 uview-ui/libs/mixin/mixin.js create mode 100644 uview-ui/libs/mixin/mpShare.js create mode 100644 uview-ui/libs/request/index.js create mode 100644 uview-ui/libs/store/index.js create mode 100644 uview-ui/libs/util/area.js create mode 100644 uview-ui/libs/util/async-validator.js create mode 100644 uview-ui/libs/util/city.js create mode 100644 uview-ui/libs/util/emitter.js create mode 100644 uview-ui/libs/util/province.js create mode 100644 uview-ui/package.json create mode 100644 uview-ui/theme.scss diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..9bb63c7 --- /dev/null +++ b/App.vue @@ -0,0 +1,17 @@ + + diff --git a/common/http.api.js b/common/http.api.js new file mode 100644 index 0000000..25d356f --- /dev/null +++ b/common/http.api.js @@ -0,0 +1,23 @@ +0 // 如果没有通过拦截器配置域名的话,可以在这里写上完整的URL(加上域名部分) +let LoginUrl = 'app-api/auth/checkerLogin'; + + +// 此处第二个参数vm,就是我们在页面使用的this,你可以通过vm获取vuex等操作,更多内容详见uView对拦截器的介绍部分: +// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F +const install = (Vue, vm) => { + // 此处没有使用传入的params参数 + let checkerLogin = (params = {}) => vm.$u.post(LoginUrl, params); + + + // 此处使用了传入的params参数,一切自定义即可 + + // 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下 + vm.$u.api = { + checkerLogin, + + }; +} + +export default { + install +} \ No newline at end of file diff --git a/common/http.interceptor.js b/common/http.interceptor.js new file mode 100644 index 0000000..0f824c3 --- /dev/null +++ b/common/http.interceptor.js @@ -0,0 +1,62 @@ +// 这里的vm,就是我们在vue文件里面的this,所以我们能在这里获取vuex的变量,比如存放在里面的token +// 同时,我们也可以在此使用getApp().globalData,如果你把token放在getApp().globalData的话,也是可以使用的 +const install = (Vue, vm) => { + Vue.prototype.$u.http.setConfig({ + baseUrl: 'https://dscp-uat.hn12301.net', + // loadingText: '努力加载中~', + // loadingTime: 18800, + // 如果将此值设置为true,拦截回调中将会返回服务端返回的所有数据response,而不是response.data + // 设置为true后,就需要在this.$u.http.interceptor.response进行多一次的判断,请打印查看具体值 + // originalData: true, + // 设置自定义头部content-type + header: { + 'Content-Type': 'application/json' + } + }); + // 请求拦截,配置Token等参数 + Vue.prototype.$u.http.interceptor.request = (config) => { + // config.header.Token = 'xxxxxx'; + + // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式,见:https://uviewui.com/components/globalVariable.html + // config.header.token = vm.token; + + // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 + // config.header.token = vm.$store.state.token; + + // 方式三,如果token放在了globalData,通过getApp().globalData获取 + // config.header.token = getApp().globalData.username; + + // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的,所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 + const token = uni.getStorageSync('token'); + config.header.Authorization = 'Bearer '+token; + + return config; + } + // 响应拦截,判断状态码是否通过 + Vue.prototype.$u.http.interceptor.response = (res) => { + // 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据 + // 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果 + console.log(res); + if(res.errcode == 0) { + + // 如果把originalData设置为了true,这里return回什么,this.$u.post的then回调中就会得到什么 + return res; + }else if(res.errcode==-99){ + uni.navigateTo({ + url:'/pages/index/login' + }) + }else { + + // uni.showToast({ + // icon:'none', + // title:res.errmsg, + // duration:5000 + // }) + return res + }; + } +} + +export default { + install +} \ No newline at end of file diff --git a/components/TabBar/TabBar.vue b/components/TabBar/TabBar.vue new file mode 100644 index 0000000..7da9ca3 --- /dev/null +++ b/components/TabBar/TabBar.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..b5d330d --- /dev/null +++ b/index.html @@ -0,0 +1,20 @@ + + + + + + + + + + +
+ + + diff --git a/main.js b/main.js new file mode 100644 index 0000000..bde1deb --- /dev/null +++ b/main.js @@ -0,0 +1,29 @@ +import App from './App' + +// #ifndef VUE3 +import Vue from 'vue' +import './uni.promisify.adaptor' +import uView from './uview-ui' +Vue.use(uView) +Vue.config.productionTip = false +App.mpType = 'app' +const app = new Vue({ + ...App +}) +import httpInterceptor from '@/common/http.interceptor.js' +// 这里需要写在最后,是为了等Vue创建对象完成,引入"app"对象(也即页面的"this"实例) +Vue.use(httpInterceptor, app) +import httpApi from '@/common/http.api.js'; +Vue.use(httpApi, app) +app.$mount() +// #endif + +// #ifdef VUE3 +import { createSSRApp } from 'vue' +export function createApp() { + const app = createSSRApp(App) + return { + app + } +} +// #endif \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..e3ea378 --- /dev/null +++ b/manifest.json @@ -0,0 +1,72 @@ +{ + "name" : "怀化人社", + "appid" : "__UNI__4E1C680", + "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" : "2" +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..be00761 --- /dev/null +++ b/pages.json @@ -0,0 +1,83 @@ +{ + "easycom": { + "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "首页", + "navigationStyle": "custom" + } + }, + { + "path": "pages/mine/mine", + "style": { + "navigationBarTitleText": "我的" + } + }, + { + "path": "pages/venue/venue", + "style": { + "navigationBarTitleText": "文旅场馆" + } + }, + { + "path": "pages/discount/discount", + "style": { + "navigationBarTitleText": "商户折扣" + } + }, + { + "path": "pages/rights/rights", + "style": { + "navigationBarTitleText": "权益包" + } + }, + { + "path": "pages/winners/winners", + "style": { + "navigationBarTitleText": "中奖名单" + } + }, + { + "path": "pages/guide/join", + "style": { + "navigationBarTitleText": "参加指南" + } + }, + { + "path": "pages/guide/use", + "style": { + "navigationBarTitleText": "使用指南" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "怀化人社", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "custom": true, + "color": "#999999", + "selectedColor": "#007aff", + "backgroundColor": "#ffffff", + "list": [ + { + "pagePath": "pages/index/index", + "iconPath": "static/shouye.png", + "selectedIconPath": "static/shouye_select.png", + "text": "首页" + }, + { + "pagePath": "pages/mine/mine", + "iconPath": "static/wode.png", + "selectedIconPath": "static/wode_select.png", + "text": "我的" + } + ] + }, + "uniIdRouter": {} +} diff --git a/pages/discount/discount.vue b/pages/discount/discount.vue new file mode 100644 index 0000000..45001c0 --- /dev/null +++ b/pages/discount/discount.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/pages/guide/join.vue b/pages/guide/join.vue new file mode 100644 index 0000000..b1bb9ee --- /dev/null +++ b/pages/guide/join.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/pages/guide/use.vue b/pages/guide/use.vue new file mode 100644 index 0000000..ed5f9ae --- /dev/null +++ b/pages/guide/use.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/pages/index/index.vue b/pages/index/index.vue new file mode 100644 index 0000000..2bb38ae --- /dev/null +++ b/pages/index/index.vue @@ -0,0 +1,188 @@ + + + + + diff --git a/pages/mine/mine.vue b/pages/mine/mine.vue new file mode 100644 index 0000000..00cb7e2 --- /dev/null +++ b/pages/mine/mine.vue @@ -0,0 +1,24 @@ + + + + + diff --git a/pages/rights/rights.vue b/pages/rights/rights.vue new file mode 100644 index 0000000..a380ffc --- /dev/null +++ b/pages/rights/rights.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/pages/venue/venue.vue b/pages/venue/venue.vue new file mode 100644 index 0000000..4bdf09b --- /dev/null +++ b/pages/venue/venue.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/pages/winners/winners.vue b/pages/winners/winners.vue new file mode 100644 index 0000000..a7f9d87 --- /dev/null +++ b/pages/winners/winners.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/static/logo.png b/static/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..b5771e209bb677e2ebd5ff766ad5ee11790f305a GIT binary patch literal 4023 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 S2k83%0000VXL1c>@8vBp`wSzc9K3NCl(_PYMB2 z0rv<`3IWn6^b4Uem1=8b0v<8Rl22F?2#^WjjQNDG2!+O#w4jq$qg;T!!X5lWYKjYW z1R?S;%3k17*e@cb^D)G{@GmqrBR!TYfJfWkNHdird}GZ%^@U1H7O=!JR#Bi%!OXicSa`x=`PxuEJd*it { + 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..411923c --- /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 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +@import 'uview-ui/theme.scss'; +$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; diff --git a/uview-ui/LICENSE b/uview-ui/LICENSE new file mode 100644 index 0000000..8e39ead --- /dev/null +++ b/uview-ui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/uview-ui/README.md b/uview-ui/README.md new file mode 100644 index 0000000..06d5676 --- /dev/null +++ b/uview-ui/README.md @@ -0,0 +1,106 @@ +

+ logo +

+

uView

+

多平台快速开发的UI框架

+ + +## 说明 + +uView UI,是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 + +## 特性 + +- 兼容安卓,iOS,微信小程序,H5,QQ小程序,百度小程序,支付宝小程序,头条小程序 +- 60+精选组件,功能丰富,多端兼容,让您快速集成,开箱即用 +- 众多贴心的JS利器,让您飞镖在手,召之即来,百步穿杨 +- 众多的常用页面和布局,让您专注逻辑,事半功倍 +- 详尽的文档支持,现代化的演示效果 +- 按需引入,精简打包体积 + + +## 安装 + +```bash +# npm方式安装 +npm i uview-ui +``` + +## 快速上手 + +1. `main.js`引入uView库 +```js +// main.js +import uView from 'uview-ui'; +Vue.use(uView); +``` + +2. `App.vue`引入基础样式(注意style标签需声明scss属性支持) +```css +/* App.vue */ + +``` + +3. `uni.scss`引入全局scss变量文件 +```css +/* uni.scss */ +@import "uview-ui/theme.scss"; +``` + +4. `pages.json`配置easycom规则(按需引入) + +```js +// pages.json +{ + "easycom": { + // npm安装的方式不需要前面的"@/",下载安装的方式需要"@/" + // npm安装方式 + "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" + // 下载安装方式 + // "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" + }, + // 此为本身已有的内容 + "pages": [ + // ...... + ] +} +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +``` + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 链接 + +- [官方文档](https://uviewui.com/) +- [更新日志](https://uviewui.com/components/changelog.html) +- [升级指南](https://uviewui.com/components/changelog.html) +- [关于我们](https://uviewui.com/cooperation/about.html) + +## 预览 + +您可以通过**微信**扫码,查看最佳的演示效果。 +
+
+ + + +## 版权信息 +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 diff --git a/uview-ui/components/u-action-sheet/u-action-sheet.vue b/uview-ui/components/u-action-sheet/u-action-sheet.vue new file mode 100644 index 0000000..722b668 --- /dev/null +++ b/uview-ui/components/u-action-sheet/u-action-sheet.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/uview-ui/components/u-alert-tips/u-alert-tips.vue b/uview-ui/components/u-alert-tips/u-alert-tips.vue new file mode 100644 index 0000000..e81fc37 --- /dev/null +++ b/uview-ui/components/u-alert-tips/u-alert-tips.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue new file mode 100644 index 0000000..a48dd54 --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/u-avatar-cropper.vue @@ -0,0 +1,290 @@ + + + + + diff --git a/uview-ui/components/u-avatar-cropper/weCropper.js b/uview-ui/components/u-avatar-cropper/weCropper.js new file mode 100644 index 0000000..df02483 --- /dev/null +++ b/uview-ui/components/u-avatar-cropper/weCropper.js @@ -0,0 +1,1265 @@ +/** + * we-cropper v1.3.9 + * (c) 2020 dlhandsome + * @license MIT + */ +(function(global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.WeCropper = factory()); +}(this, (function() { + 'use strict'; + + 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 = uni.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; + + return WeCropper; + +}))); diff --git a/uview-ui/components/u-avatar/u-avatar.vue b/uview-ui/components/u-avatar/u-avatar.vue new file mode 100644 index 0000000..289b9b0 --- /dev/null +++ b/uview-ui/components/u-avatar/u-avatar.vue @@ -0,0 +1,244 @@ + + + + + diff --git a/uview-ui/components/u-back-top/u-back-top.vue b/uview-ui/components/u-back-top/u-back-top.vue new file mode 100644 index 0000000..7970fc7 --- /dev/null +++ b/uview-ui/components/u-back-top/u-back-top.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-badge/u-badge.vue b/uview-ui/components/u-badge/u-badge.vue new file mode 100644 index 0000000..e85b133 --- /dev/null +++ b/uview-ui/components/u-badge/u-badge.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/uview-ui/components/u-button/u-button.vue b/uview-ui/components/u-button/u-button.vue new file mode 100644 index 0000000..82c3a6f --- /dev/null +++ b/uview-ui/components/u-button/u-button.vue @@ -0,0 +1,596 @@ + + + + + diff --git a/uview-ui/components/u-calendar/u-calendar.vue b/uview-ui/components/u-calendar/u-calendar.vue new file mode 100644 index 0000000..2b30184 --- /dev/null +++ b/uview-ui/components/u-calendar/u-calendar.vue @@ -0,0 +1,639 @@ + + + + \ No newline at end of file diff --git a/uview-ui/components/u-car-keyboard/u-car-keyboard.vue b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file mode 100644 index 0000000..84b1467 --- /dev/null +++ b/uview-ui/components/u-car-keyboard/u-car-keyboard.vue @@ -0,0 +1,257 @@ + + + + + diff --git a/uview-ui/components/u-card/u-card.vue b/uview-ui/components/u-card/u-card.vue new file mode 100644 index 0000000..a3cb2aa --- /dev/null +++ b/uview-ui/components/u-card/u-card.vue @@ -0,0 +1,299 @@ + + + + + diff --git a/uview-ui/components/u-cell-group/u-cell-group.vue b/uview-ui/components/u-cell-group/u-cell-group.vue new file mode 100644 index 0000000..3fbca72 --- /dev/null +++ b/uview-ui/components/u-cell-group/u-cell-group.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/uview-ui/components/u-cell-item/u-cell-item.vue b/uview-ui/components/u-cell-item/u-cell-item.vue new file mode 100644 index 0000000..055af3a --- /dev/null +++ b/uview-ui/components/u-cell-item/u-cell-item.vue @@ -0,0 +1,316 @@ + + + + + diff --git a/uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file mode 100644 index 0000000..6a149b3 --- /dev/null +++ b/uview-ui/components/u-checkbox-group/u-checkbox-group.vue @@ -0,0 +1,123 @@ + + + + + diff --git a/uview-ui/components/u-checkbox/u-checkbox.vue b/uview-ui/components/u-checkbox/u-checkbox.vue new file mode 100644 index 0000000..9414461 --- /dev/null +++ b/uview-ui/components/u-checkbox/u-checkbox.vue @@ -0,0 +1,284 @@ + + + + + diff --git a/uview-ui/components/u-circle-progress/u-circle-progress.vue b/uview-ui/components/u-circle-progress/u-circle-progress.vue new file mode 100644 index 0000000..46e7c18 --- /dev/null +++ b/uview-ui/components/u-circle-progress/u-circle-progress.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue b/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue new file mode 100644 index 0000000..77e2da2 --- /dev/null +++ b/uview-ui/components/u-circle-progress/u-line-progress/u-line-progress.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/uview-ui/components/u-col/u-col.vue b/uview-ui/components/u-col/u-col.vue new file mode 100644 index 0000000..3b6cc64 --- /dev/null +++ b/uview-ui/components/u-col/u-col.vue @@ -0,0 +1,156 @@ + + + + + diff --git a/uview-ui/components/u-collapse-item/u-collapse-item.vue b/uview-ui/components/u-collapse-item/u-collapse-item.vue new file mode 100644 index 0000000..6656657 --- /dev/null +++ b/uview-ui/components/u-collapse-item/u-collapse-item.vue @@ -0,0 +1,205 @@ + + + + + diff --git a/uview-ui/components/u-collapse/u-collapse.vue b/uview-ui/components/u-collapse/u-collapse.vue new file mode 100644 index 0000000..8572957 --- /dev/null +++ b/uview-ui/components/u-collapse/u-collapse.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/uview-ui/components/u-column-notice/u-column-notice.vue b/uview-ui/components/u-column-notice/u-column-notice.vue new file mode 100644 index 0000000..dd8bd31 --- /dev/null +++ b/uview-ui/components/u-column-notice/u-column-notice.vue @@ -0,0 +1,237 @@ + + + + + diff --git a/uview-ui/components/u-count-down/u-count-down.vue b/uview-ui/components/u-count-down/u-count-down.vue new file mode 100644 index 0000000..7285d67 --- /dev/null +++ b/uview-ui/components/u-count-down/u-count-down.vue @@ -0,0 +1,318 @@ + + + + + diff --git a/uview-ui/components/u-count-to/u-count-to.vue b/uview-ui/components/u-count-to/u-count-to.vue new file mode 100644 index 0000000..053dc5f --- /dev/null +++ b/uview-ui/components/u-count-to/u-count-to.vue @@ -0,0 +1,241 @@ + + + + + diff --git a/uview-ui/components/u-divider/u-divider.vue b/uview-ui/components/u-divider/u-divider.vue new file mode 100644 index 0000000..6f8d7e6 --- /dev/null +++ b/uview-ui/components/u-divider/u-divider.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/uview-ui/components/u-dropdown-item/u-dropdown-item.vue b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file mode 100644 index 0000000..ba60d8f --- /dev/null +++ b/uview-ui/components/u-dropdown-item/u-dropdown-item.vue @@ -0,0 +1,132 @@ + + + + + diff --git a/uview-ui/components/u-dropdown/u-dropdown.vue b/uview-ui/components/u-dropdown/u-dropdown.vue new file mode 100644 index 0000000..a62e469 --- /dev/null +++ b/uview-ui/components/u-dropdown/u-dropdown.vue @@ -0,0 +1,298 @@ + + + + + diff --git a/uview-ui/components/u-empty/u-empty.vue b/uview-ui/components/u-empty/u-empty.vue new file mode 100644 index 0000000..2c77b24 --- /dev/null +++ b/uview-ui/components/u-empty/u-empty.vue @@ -0,0 +1,193 @@ + + + + + diff --git a/uview-ui/components/u-field/u-field.vue b/uview-ui/components/u-field/u-field.vue new file mode 100644 index 0000000..b562798 --- /dev/null +++ b/uview-ui/components/u-field/u-field.vue @@ -0,0 +1,384 @@ +