commit 509ceb9515834f34a02fea9cd54aa72fda54b3da Author: itgaojian Date: Thu Feb 22 11:04:15 2024 +0800 初始化项目 diff --git a/app.js b/app.js new file mode 100755 index 0000000..ecb9817 --- /dev/null +++ b/app.js @@ -0,0 +1,34 @@ +var req = require('./utils/request.js') +// app.js +App({ + http: req, + urls: req.apis, + data: { + + }, + onLaunch() { + //获取状态栏高度 + var _self = this + wx.getSystemInfo({ + success: e => { + _self.globalData.StatusBar = e.statusBarHeight; + let capsule = wx.getMenuButtonBoundingClientRect(); + if (capsule) { + _self.globalData.Custom = capsule; + _self.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight; + } else { + _self.globalData.CustomBar = e.statusBarHeight + 50; + } + } + }) + //获取手机屏幕高度、宽度 + _self.globalData.windowHeight = wx.getSystemInfoSync().windowHeight + _self.globalData.windowWidth = wx.getSystemInfoSync().windowWidth + }, + globalData: { + userInfo: {}, + token: '', + userId: '', + showUserId: '', //当前浏览的人的ID + }, +}) \ No newline at end of file diff --git a/app.json b/app.json new file mode 100755 index 0000000..abbb1b1 --- /dev/null +++ b/app.json @@ -0,0 +1,148 @@ +{ + "pages": [ + "pages/index/index", + "pages/serve/index/index", + "pages/mine/index/index", + "pages/mine/myCard/myCard", + "pages/mine/myCardDetail/myCardDetail", + "pages/mine/otherCard/othercarddetail", + "pages/mine/setting/columnsetting", + "pages/mine/shop/shopedit", + "pages/mine/shop/shopauthentication", + "pages/mine/shop/shopauthenticationedit", + "pages/mine/shop/shopauthenticationdetail", + "pages/mine/shop/addshop", + "pages/mine/shop/choosetrade", + "pages/mine/shop/mineshop", + "pages/mine/shop/mineshopdetail", + "pages/mine/manage/shopstaff", + "pages/mine/manage/shopmember", + "pages/mine/manage/shopposition", + "pages/mine/manage/addposition", + "pages/mine/product/catalogmanage/catalogmanage", + "pages/mine/product/catalogmanage/addcatalog", + "pages/mine/product/productmanage/addproduct", + "pages/mine/product/productmanage/productlist", + "pages/mine/product/productmanage/choosecatalog", + "pages/mine/product/productmanage/productmanage", + "pages/mine/product/productmanage/searchproduct", + "pages/mine/order/ordersuccess", + "pages/mine/order/orderlist", + "pages/mine/order/orderdetail", + "pages/mine/columnlist/columnlist", + "pages/mine/product/recycle/catagoryrecycle", + "pages/mine/product/coupon/addcoupon", + "pages/mine/product/recycle/productrecycle", + "pages/mine/product/coupon/couponlist", + "pages/mine/product/coupon/editcoupon", + "pages/mine/product/coupon/choosegoods", + "pages/mine/vip/vipcenter", + "pages/mine/income/incomelist" + ], + "subPackages": [ + { + "root": "packagecard", + "pages": [ + "cardList/cardList", + "cardDetail/cardDetail", + "moments/publish/momentpublish", + "moments/edit/momentedit", + "moments/list/momentslist", + "moments/publish/momentpublishline", + "sharePage/sharePage", + "moments/list/momentsshowlist", + "moments/momentsdetail/momentsdetail", + "moments/showlist/showlist", + "shop/catalog/bannerlist/bannerlist", + "shop/catalog/column/column", + "shop/catalog/list/list", + "shop/shopingcart/cart", + "shop/product/product", + "shop/bespeak/bespeak", + "shop/product/goodsdetail", + "shop/product/affirmorder", + "shop/catalog/bannerlist/goodscataloglist", + "common/corpperimg/cropperimg", + "sharePage/cardcode", + "paypage/paypage", + "purse/takecash", + "marketing/marketinginfo", + "marketing/marketingposter", + "marketing/marketingpublish", + "marketing/posteredit", + "paypage/paystate", + "lucre/historylucre", + "purse/recordlist" + ] + } + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#E6B980", + "navigationBarTitleText": "服务", + "navigationBarTextStyle": "white", + "navigationStyle": "custom" + }, + "tabBar": { + "color": "#000000", + "selectedColor": "#000000", + "borderStyle": "black", + "list": [ + { + "text": "首页", + "pagePath": "pages/index/index", + "iconPath": "images/ic_card_normal.png", + "selectedIconPath": "images/ic_card_sel.png" + }, + { + "text": "服务", + "pagePath": "pages/serve/index/index", + "iconPath": "images/ic_serve_normal.png", + "selectedIconPath": "images/ic_serve_sel.png" + }, + { + "text": "我的", + "pagePath": "pages/mine/index/index", + "iconPath": "images/ic_mine_normal.png", + "selectedIconPath": "images/ic_mine_sel.png" + } + ] + }, + "style": "v2", + "sitemapLocation": "sitemap.json", + "usingComponents": { + "cu-custom": "/components/cuicustom/cu-custom", + "customcart": "/components/cartfoot/customcart", + "van-tabbar": "/vant/dist/tabbar/index", + "van-tabbar-item": "/vant/dist/tabbar-item/index", + "van-swipe-cell": "/vant/dist/swipe-cell/index", + "van-cell-group": "/vant/dist/cell-group/index", + "van-cell": "/vant/dist/cell/index", + "van-empty": "/vant/dist/empty/index", + "van-action-sheet": "/vant/dist/action-sheet/index", + "van-submit-bar": "/vant/dist/submit-bar/index", + "van-stepper": "/vant/dist/stepper/index", + "van-image": "/vant/dist/image/index", + "van-loading": "/vant/dist/loading/index", + "van-switch": "/vant/dist/switch/index", + "van-tab": "/vant/dist/tab/index", + "van-tabs": "/vant/dist/tabs/index", + "van-picker": "/vant/dist/picker/index", + "van-popup": "/vant/dist/popup/index", + "van-dropdown-menu": "/vant/dist/dropdown-menu/index", + "van-dropdown-item": "/vant/dist/dropdown-item/index", + "van-collapse": "/vant/dist/collapse/index", + "van-collapse-item": "/vant/dist/collapse-item/index" + }, + "plugins": { + "chooseLocation": { + "version": "1.0.6", + "provider": "wx76a9a06e5b4e693e" + } + }, + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序定位" + } + } +} \ No newline at end of file diff --git a/app.wxss b/app.wxss new file mode 100755 index 0000000..b43f71a --- /dev/null +++ b/app.wxss @@ -0,0 +1,153 @@ +/**app.wxss**/ +@import "/class/main.wxss"; +@import "/class/icon.wxss"; + + +page { + background-color: #f7f7f7; + /* background-color: #00eeff; */ +} + + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +scroll-view { + height: 100%; +} + +.line-solid-gray { + border-bottom-style: dashed; + border-bottom-width: 2rpx; + border-bottom-color: #dfdfdf; +} + +.line-so-gray { + border-bottom-style: solid; + border-bottom-width: 2rpx; + border-bottom-color: #dfdfdf; + width: 100%; + margin: 15rpx; +} + +.nav-list { + display: flex; + flex-wrap: wrap; + padding: 0px 40rpx 0px; + justify-content: space-between; +} + +.nav-li { + padding: 30rpx; + border-radius: 12rpx; + width: 45%; + margin: 0 2.5% 40rpx; + background-image: url(https://image.weilanwl.com/color2.0/cardBg.png); + background-size: cover; + background-position: center; + position: relative; + z-index: 1; +} + +.icon-star-red { + content: '*'; + color: red; +} + +.bottom-action { + display: flex; + flex-direction: row; + justify-content: space-between; + width: 75%; + align-items: center; +} + +.nav-li::after { + content: ""; + position: absolute; + z-index: -1; + background-color: inherit; + width: 100%; + height: 100%; + left: 0; + bottom: -10%; + border-radius: 10rpx; + opacity: 0.2; + transform: scale(0.9, 0.9); +} + +.nav-li.cur { + color: #fff; + background: rgb(94, 185, 94); + box-shadow: 4rpx 4rpx 6rpx rgba(94, 185, 94, 0.4); +} + +.nav-title { + font-size: 32rpx; + font-weight: 300; +} + +.nav-title::first-letter { + font-size: 40rpx; + margin-right: 4rpx; +} + +.nav-name { + font-size: 28rpx; + text-transform: Capitalize; + margin-top: 20rpx; + position: relative; +} + +.nav-name::before { + content: ""; + position: absolute; + display: block; + width: 40rpx; + height: 6rpx; + background: #fff; + bottom: 0; + right: 0; + opacity: 0.5; +} + +.nav-name::after { + content: ""; + position: absolute; + display: block; + width: 100rpx; + height: 1px; + background: #fff; + bottom: 0; + right: 40rpx; + opacity: 0.3; +} + +.nav-name::first-letter { + font-weight: bold; + font-size: 36rpx; + margin-right: 1px; +} + +.nav-li text { + position: absolute; + right: 30rpx; + top: 30rpx; + font-size: 52rpx; + width: 60rpx; + height: 60rpx; + text-align: center; + line-height: 60rpx; +} + +.text-light { + font-weight: 300; +} + +.hint-msg { + display: flex; + justify-content: space-between; +} \ No newline at end of file diff --git a/class/icon.wxss b/class/icon.wxss new file mode 100755 index 0000000..e19a7bb --- /dev/null +++ b/class/icon.wxss @@ -0,0 +1,1226 @@ +@keyframes cuIcon-spin { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + + 100% { + -webkit-transform: rotate(359deg); + transform: rotate(359deg); + } +} + +.iconfont-spin { + -webkit-animation: cuIcon-spin 2s infinite linear; + animation: cuIcon-spin 2s infinite linear; + display: inline-block; +} + +.iconfont-pulse { + -webkit-animation: cuIcon-spin 1s infinite steps(8); + animation: cuIcon-spin 1s infinite steps(8); + display: inline-block; +} + +[class*="cuIcon-"] { + font-family: "cuIcon"; + font-size: inherit; + font-style: normal; +} + +@font-face { + font-family: "cuIcon"; + src: url('//at.alicdn.com/t/font_533566_yfq2d9wdij.eot?t=1545239985831'); + /* IE9*/ + src: url('//at.alicdn.com/t/font_533566_yfq2d9wdij.eot?t=1545239985831#iefix') format('embedded-opentype'), + /* IE6-IE8 */ + url('data:application/x-font-woff;charset=utf-8;base64,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') format('woff'), + url('//at.alicdn.com/t/font_533566_yfq2d9wdij.ttf?t=1545239985831') format('truetype'), + /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ + url('//at.alicdn.com/t/font_533566_yfq2d9wdij.svg?t=1545239985831#iconfont') format('svg'); + /* iOS 4.1- */ +} + +.cuIcon-appreciate:before { + content: "\e644"; +} + +.cuIcon-check:before { + content: "\e645"; +} + +.cuIcon-close:before { + content: "\e646"; +} + +.cuIcon-edit:before { + content: "\e649"; +} + +.cuIcon-emoji:before { + content: "\e64a"; +} + +.cuIcon-favorfill:before { + content: "\e64b"; +} + +.cuIcon-favor:before { + content: "\e64c"; +} + +.cuIcon-loading:before { + content: "\e64f"; +} + +.cuIcon-locationfill:before { + content: "\e650"; +} + +.cuIcon-location:before { + content: "\e651"; +} + +.cuIcon-phone:before { + content: "\e652"; +} + +.cuIcon-roundcheckfill:before { + content: "\e656"; +} + +.cuIcon-roundcheck:before { + content: "\e657"; +} + +.cuIcon-roundclosefill:before { + content: "\e658"; +} + +.cuIcon-roundclose:before { + content: "\e659"; +} + +.cuIcon-roundrightfill:before { + content: "\e65a"; +} + +.cuIcon-roundright:before { + content: "\e65b"; +} + +.cuIcon-search:before { + content: "\e65c"; +} + +.cuIcon-taxi:before { + content: "\e65d"; +} + +.cuIcon-timefill:before { + content: "\e65e"; +} + +.cuIcon-time:before { + content: "\e65f"; +} + +.cuIcon-unfold:before { + content: "\e661"; +} + +.cuIcon-warnfill:before { + content: "\e662"; +} + +.cuIcon-warn:before { + content: "\e663"; +} + +.cuIcon-camerafill:before { + content: "\e664"; +} + +.cuIcon-camera:before { + content: "\e665"; +} + +.cuIcon-commentfill:before { + content: "\e666"; +} + +.cuIcon-comment:before { + content: "\e667"; +} + +.cuIcon-likefill:before { + content: "\e668"; +} + +.cuIcon-like:before { + content: "\e669"; +} + +.cuIcon-notificationfill:before { + content: "\e66a"; +} + +.cuIcon-notification:before { + content: "\e66b"; +} + +.cuIcon-order:before { + content: "\e66c"; +} + +.cuIcon-samefill:before { + content: "\e66d"; +} + +.cuIcon-same:before { + content: "\e66e"; +} + +.cuIcon-deliver:before { + content: "\e671"; +} + +.cuIcon-evaluate:before { + content: "\e672"; +} + +.cuIcon-pay:before { + content: "\e673"; +} + +.cuIcon-send:before { + content: "\e675"; +} + +.cuIcon-shop:before { + content: "\e676"; +} + +.cuIcon-ticket:before { + content: "\e677"; +} + +.cuIcon-back:before { + content: "\e679"; +} + +.cuIcon-cascades:before { + content: "\e67c"; +} + +.cuIcon-discover:before { + content: "\e67e"; +} + +.cuIcon-list:before { + content: "\e682"; +} + +.cuIcon-more:before { + content: "\e684"; +} + +.cuIcon-scan:before { + content: "\e689"; +} + +.cuIcon-settings:before { + content: "\e68a"; +} + +.cuIcon-questionfill:before { + content: "\e690"; +} + +.cuIcon-question:before { + content: "\e691"; +} + +.cuIcon-shopfill:before { + content: "\e697"; +} + +.cuIcon-form:before { + content: "\e699"; +} + +.cuIcon-pic:before { + content: "\e69b"; +} + +.cuIcon-filter:before { + content: "\e69c"; +} + +.cuIcon-footprint:before { + content: "\e69d"; +} + +.cuIcon-top:before { + content: "\e69e"; +} + +.cuIcon-pulldown:before { + content: "\e69f"; +} + +.cuIcon-pullup:before { + content: "\e6a0"; +} + +.cuIcon-right:before { + content: "\e6a3"; +} + +.cuIcon-refresh:before { + content: "\e6a4"; +} + +.cuIcon-moreandroid:before { + content: "\e6a5"; +} + +.cuIcon-deletefill:before { + content: "\e6a6"; +} + +.cuIcon-refund:before { + content: "\e6ac"; +} + +.cuIcon-cart:before { + content: "\e6af"; +} + +.cuIcon-qrcode:before { + content: "\e6b0"; +} + +.cuIcon-remind:before { + content: "\e6b2"; +} + +.cuIcon-delete:before { + content: "\e6b4"; +} + +.cuIcon-profile:before { + content: "\e6b7"; +} + +.cuIcon-home:before { + content: "\e6b8"; +} + +.cuIcon-cartfill:before { + content: "\e6b9"; +} + +.cuIcon-discoverfill:before { + content: "\e6ba"; +} + +.cuIcon-homefill:before { + content: "\e6bb"; +} + +.cuIcon-message:before { + content: "\e6bc"; +} + +.cuIcon-addressbook:before { + content: "\e6bd"; +} + +.cuIcon-link:before { + content: "\e6bf"; +} + +.cuIcon-lock:before { + content: "\e6c0"; +} + +.cuIcon-unlock:before { + content: "\e6c2"; +} + +.cuIcon-vip:before { + content: "\e6c3"; +} + +.cuIcon-weibo:before { + content: "\e6c4"; +} + +.cuIcon-activity:before { + content: "\e6c5"; +} + +.cuIcon-friendaddfill:before { + content: "\e6c9"; +} + +.cuIcon-friendadd:before { + content: "\e6ca"; +} + +.cuIcon-friendfamous:before { + content: "\e6cb"; +} + +.cuIcon-friend:before { + content: "\e6cc"; +} + +.cuIcon-goods:before { + content: "\e6cd"; +} + +.cuIcon-selection:before { + content: "\e6ce"; +} + +.cuIcon-explore:before { + content: "\e6d2"; +} + +.cuIcon-present:before { + content: "\e6d3"; +} + +.cuIcon-squarecheckfill:before { + content: "\e6d4"; +} + +.cuIcon-square:before { + content: "\e6d5"; +} + +.cuIcon-squarecheck:before { + content: "\e6d6"; +} + +.cuIcon-round:before { + content: "\e6d7"; +} + +.cuIcon-roundaddfill:before { + content: "\e6d8"; +} + +.cuIcon-roundadd:before { + content: "\e6d9"; +} + +.cuIcon-add:before { + content: "\e6da"; +} + +.cuIcon-notificationforbidfill:before { + content: "\e6db"; +} + +.cuIcon-explorefill:before { + content: "\e6dd"; +} + +.cuIcon-fold:before { + content: "\e6de"; +} + +.cuIcon-game:before { + content: "\e6df"; +} + +.cuIcon-redpacket:before { + content: "\e6e0"; +} + +.cuIcon-selectionfill:before { + content: "\e6e1"; +} + +.cuIcon-similar:before { + content: "\e6e2"; +} + +.cuIcon-appreciatefill:before { + content: "\e6e3"; +} + +.cuIcon-infofill:before { + content: "\e6e4"; +} + +.cuIcon-info:before { + content: "\e6e5"; +} + +.cuIcon-forwardfill:before { + content: "\e6ea"; +} + +.cuIcon-forward:before { + content: "\e6eb"; +} + +.cuIcon-rechargefill:before { + content: "\e6ec"; +} + +.cuIcon-recharge:before { + content: "\e6ed"; +} + +.cuIcon-vipcard:before { + content: "\e6ee"; +} + +.cuIcon-voice:before { + content: "\e6ef"; +} + +.cuIcon-voicefill:before { + content: "\e6f0"; +} + +.cuIcon-friendfavor:before { + content: "\e6f1"; +} + +.cuIcon-wifi:before { + content: "\e6f2"; +} + +.cuIcon-share:before { + content: "\e6f3"; +} + +.cuIcon-wefill:before { + content: "\e6f4"; +} + +.cuIcon-we:before { + content: "\e6f5"; +} + +.cuIcon-lightauto:before { + content: "\e6f6"; +} + +.cuIcon-lightforbid:before { + content: "\e6f7"; +} + +.cuIcon-lightfill:before { + content: "\e6f8"; +} + +.cuIcon-camerarotate:before { + content: "\e6f9"; +} + +.cuIcon-light:before { + content: "\e6fa"; +} + +.cuIcon-barcode:before { + content: "\e6fb"; +} + +.cuIcon-flashlightclose:before { + content: "\e6fc"; +} + +.cuIcon-flashlightopen:before { + content: "\e6fd"; +} + +.cuIcon-searchlist:before { + content: "\e6fe"; +} + +.cuIcon-service:before { + content: "\e6ff"; +} + +.cuIcon-sort:before { + content: "\e700"; +} + +.cuIcon-down:before { + content: "\e703"; +} + +.cuIcon-mobile:before { + content: "\e704"; +} + +.cuIcon-mobilefill:before { + content: "\e705"; +} + +.cuIcon-copy:before { + content: "\e706"; +} + +.cuIcon-countdownfill:before { + content: "\e707"; +} + +.cuIcon-countdown:before { + content: "\e708"; +} + +.cuIcon-noticefill:before { + content: "\e709"; +} + +.cuIcon-notice:before { + content: "\e70a"; +} + +.cuIcon-upstagefill:before { + content: "\e70e"; +} + +.cuIcon-upstage:before { + content: "\e70f"; +} + +.cuIcon-babyfill:before { + content: "\e710"; +} + +.cuIcon-baby:before { + content: "\e711"; +} + +.cuIcon-brandfill:before { + content: "\e712"; +} + +.cuIcon-brand:before { + content: "\e713"; +} + +.cuIcon-choicenessfill:before { + content: "\e714"; +} + +.cuIcon-choiceness:before { + content: "\e715"; +} + +.cuIcon-clothesfill:before { + content: "\e716"; +} + +.cuIcon-clothes:before { + content: "\e717"; +} + +.cuIcon-creativefill:before { + content: "\e718"; +} + +.cuIcon-creative:before { + content: "\e719"; +} + +.cuIcon-female:before { + content: "\e71a"; +} + +.cuIcon-keyboard:before { + content: "\e71b"; +} + +.cuIcon-male:before { + content: "\e71c"; +} + +.cuIcon-newfill:before { + content: "\e71d"; +} + +.cuIcon-new:before { + content: "\e71e"; +} + +.cuIcon-pullleft:before { + content: "\e71f"; +} + +.cuIcon-pullright:before { + content: "\e720"; +} + +.cuIcon-rankfill:before { + content: "\e721"; +} + +.cuIcon-rank:before { + content: "\e722"; +} + +.cuIcon-bad:before { + content: "\e723"; +} + +.cuIcon-cameraadd:before { + content: "\e724"; +} + +.cuIcon-focus:before { + content: "\e725"; +} + +.cuIcon-friendfill:before { + content: "\e726"; +} + +.cuIcon-cameraaddfill:before { + content: "\e727"; +} + +.cuIcon-apps:before { + content: "\e729"; +} + +.cuIcon-paintfill:before { + content: "\e72a"; +} + +.cuIcon-paint:before { + content: "\e72b"; +} + +.cuIcon-picfill:before { + content: "\e72c"; +} + +.cuIcon-refresharrow:before { + content: "\e72d"; +} + +.cuIcon-colorlens:before { + content: "\e6e6"; +} + +.cuIcon-markfill:before { + content: "\e730"; +} + +.cuIcon-mark:before { + content: "\e731"; +} + +.cuIcon-presentfill:before { + content: "\e732"; +} + +.cuIcon-repeal:before { + content: "\e733"; +} + +.cuIcon-album:before { + content: "\e734"; +} + +.cuIcon-peoplefill:before { + content: "\e735"; +} + +.cuIcon-people:before { + content: "\e736"; +} + +.cuIcon-servicefill:before { + content: "\e737"; +} + +.cuIcon-repair:before { + content: "\e738"; +} + +.cuIcon-file:before { + content: "\e739"; +} + +.cuIcon-repairfill:before { + content: "\e73a"; +} + +.cuIcon-taoxiaopu:before { + content: "\e73b"; +} + +.cuIcon-weixin:before { + content: "\e612"; +} + +.cuIcon-attentionfill:before { + content: "\e73c"; +} + +.cuIcon-attention:before { + content: "\e73d"; +} + +.cuIcon-commandfill:before { + content: "\e73e"; +} + +.cuIcon-command:before { + content: "\e73f"; +} + +.cuIcon-communityfill:before { + content: "\e740"; +} + +.cuIcon-community:before { + content: "\e741"; +} + +.cuIcon-read:before { + content: "\e742"; +} + +.cuIcon-calendar:before { + content: "\e74a"; +} + +.cuIcon-cut:before { + content: "\e74b"; +} + +.cuIcon-magic:before { + content: "\e74c"; +} + +.cuIcon-backwardfill:before { + content: "\e74d"; +} + +.cuIcon-playfill:before { + content: "\e74f"; +} + +.cuIcon-stop:before { + content: "\e750"; +} + +.cuIcon-tagfill:before { + content: "\e751"; +} + +.cuIcon-tag:before { + content: "\e752"; +} + +.cuIcon-group:before { + content: "\e753"; +} + +.cuIcon-all:before { + content: "\e755"; +} + +.cuIcon-backdelete:before { + content: "\e756"; +} + +.cuIcon-hotfill:before { + content: "\e757"; +} + +.cuIcon-hot:before { + content: "\e758"; +} + +.cuIcon-post:before { + content: "\e759"; +} + +.cuIcon-radiobox:before { + content: "\e75b"; +} + +.cuIcon-rounddown:before { + content: "\e75c"; +} + +.cuIcon-upload:before { + content: "\e75d"; +} + +.cuIcon-writefill:before { + content: "\e760"; +} + +.cuIcon-write:before { + content: "\e761"; +} + +.cuIcon-radioboxfill:before { + content: "\e763"; +} + +.cuIcon-punch:before { + content: "\e764"; +} + +.cuIcon-shake:before { + content: "\e765"; +} + +.cuIcon-move:before { + content: "\e768"; +} + +.cuIcon-safe:before { + content: "\e769"; +} + +.cuIcon-activityfill:before { + content: "\e775"; +} + +.cuIcon-crownfill:before { + content: "\e776"; +} + +.cuIcon-crown:before { + content: "\e777"; +} + +.cuIcon-goodsfill:before { + content: "\e778"; +} + +.cuIcon-messagefill:before { + content: "\e779"; +} + +.cuIcon-profilefill:before { + content: "\e77a"; +} + +.cuIcon-sound:before { + content: "\e77b"; +} + +.cuIcon-sponsorfill:before { + content: "\e77c"; +} + +.cuIcon-sponsor:before { + content: "\e77d"; +} + +.cuIcon-upblock:before { + content: "\e77e"; +} + +.cuIcon-weblock:before { + content: "\e77f"; +} + +.cuIcon-weunblock:before { + content: "\e780"; +} + +.cuIcon-my:before { + content: "\e78b"; +} + +.cuIcon-myfill:before { + content: "\e78c"; +} + +.cuIcon-emojifill:before { + content: "\e78d"; +} + +.cuIcon-emojiflashfill:before { + content: "\e78e"; +} + +.cuIcon-flashbuyfill:before { + content: "\e78f"; +} + +.cuIcon-text:before { + content: "\e791"; +} + +.cuIcon-goodsfavor:before { + content: "\e794"; +} + +.cuIcon-musicfill:before { + content: "\e795"; +} + +.cuIcon-musicforbidfill:before { + content: "\e796"; +} + +.cuIcon-card:before { + content: "\e624"; +} + +.cuIcon-triangledownfill:before { + content: "\e79b"; +} + +.cuIcon-triangleupfill:before { + content: "\e79c"; +} + +.cuIcon-roundleftfill-copy:before { + content: "\e79e"; +} + +.cuIcon-font:before { + content: "\e76a"; +} + +.cuIcon-title:before { + content: "\e82f"; +} + +.cuIcon-recordfill:before { + content: "\e7a4"; +} + +.cuIcon-record:before { + content: "\e7a6"; +} + +.cuIcon-cardboardfill:before { + content: "\e7a9"; +} + +.cuIcon-cardboard:before { + content: "\e7aa"; +} + +.cuIcon-formfill:before { + content: "\e7ab"; +} + +.cuIcon-coin:before { + content: "\e7ac"; +} + +.cuIcon-cardboardforbid:before { + content: "\e7af"; +} + +.cuIcon-circlefill:before { + content: "\e7b0"; +} + +.cuIcon-circle:before { + content: "\e7b1"; +} + +.cuIcon-attentionforbid:before { + content: "\e7b2"; +} + +.cuIcon-attentionforbidfill:before { + content: "\e7b3"; +} + +.cuIcon-attentionfavorfill:before { + content: "\e7b4"; +} + +.cuIcon-attentionfavor:before { + content: "\e7b5"; +} + +.cuIcon-titles:before { + content: "\e701"; +} + +.cuIcon-icloading:before { + content: "\e67a"; +} + +.cuIcon-full:before { + content: "\e7bc"; +} + +.cuIcon-mail:before { + content: "\e7bd"; +} + +.cuIcon-peoplelist:before { + content: "\e7be"; +} + +.cuIcon-goodsnewfill:before { + content: "\e7bf"; +} + +.cuIcon-goodsnew:before { + content: "\e7c0"; +} + +.cuIcon-medalfill:before { + content: "\e7c1"; +} + +.cuIcon-medal:before { + content: "\e7c2"; +} + +.cuIcon-newsfill:before { + content: "\e7c3"; +} + +.cuIcon-newshotfill:before { + content: "\e7c4"; +} + +.cuIcon-newshot:before { + content: "\e7c5"; +} + +.cuIcon-news:before { + content: "\e7c6"; +} + +.cuIcon-videofill:before { + content: "\e7c7"; +} + +.cuIcon-video:before { + content: "\e7c8"; +} + +.cuIcon-exit:before { + content: "\e7cb"; +} + +.cuIcon-skinfill:before { + content: "\e7cc"; +} + +.cuIcon-skin:before { + content: "\e7cd"; +} + +.cuIcon-moneybagfill:before { + content: "\e7ce"; +} + +.cuIcon-usefullfill:before { + content: "\e7cf"; +} + +.cuIcon-usefull:before { + content: "\e7d0"; +} + +.cuIcon-moneybag:before { + content: "\e7d1"; +} + +.cuIcon-redpacket_fill:before { + content: "\e7d3"; +} + +.cuIcon-subscription:before { + content: "\e7d4"; +} + +.cuIcon-loading1:before { + content: "\e633"; +} + +.cuIcon-github:before { + content: "\e692"; +} + +.cuIcon-global:before { + content: "\e7eb"; +} + +.cuIcon-settingsfill:before { + content: "\e6ab"; +} + +.cuIcon-back_android:before { + content: "\e7ed"; +} + +.cuIcon-expressman:before { + content: "\e7ef"; +} + +.cuIcon-evaluate_fill:before { + content: "\e7f0"; +} + +.cuIcon-group_fill:before { + content: "\e7f5"; +} + +.cuIcon-play_forward_fill:before { + content: "\e7f6"; +} + +.cuIcon-deliver_fill:before { + content: "\e7f7"; +} + +.cuIcon-notice_forbid_fill:before { + content: "\e7f8"; +} + +.cuIcon-fork:before { + content: "\e60c"; +} + +.cuIcon-pick:before { + content: "\e7fa"; +} + +.cuIcon-wenzi:before { + content: "\e6a7"; +} + +.cuIcon-ellipse:before { + content: "\e600"; +} + +.cuIcon-qr_code:before { + content: "\e61b"; +} + +.cuIcon-dianhua:before { + content: "\e64d"; +} + +.cuIcon-icon:before { + content: "\e602"; +} + +.cuIcon-loading2:before { + content: "\e7f1"; +} + +.cuIcon-btn:before { + content: "\e601"; +} diff --git a/class/main.wxss b/class/main.wxss new file mode 100755 index 0000000..30c364f --- /dev/null +++ b/class/main.wxss @@ -0,0 +1,4462 @@ +/* + ColorUi for MP-weixin v2.1.4 | by 文晓港 2019年4月25日19:15:42 + 仅供学习交流,如作它用所承受的法律责任一概与作者无关 + 使用ColorUi开发扩展与插件时,请注明基于ColorUi开发 + + (QQ交流群:240787041) +*/ + +/* ================== + 初始化 + ==================== */ +page { + /* Color 可以自定义相关配色 */ + /* var属性兼容性 --> https://www.caniuse.com/#feat=css-variables */ + /* 标准色 */ + --red: #e54d42; + --orange: #f37b1d; + --yellow: #fbbd08; + --olive: #8dc63f; + --green: #39b54a; + --cyan: #1cbbb4; + --blue: #0054bd; + --purple: #6739b6; + --mauve: #9c26b0; + --pink: #e03997; + --brown: #a5673f; + --grey: #8799a3; + --black: #333333; + --darkGray: #666666; + --gray: #999999; + --ghostWhite: #f1f1f1; + --white: #ffffff; + --depBlack: #000000; + /* 浅色 */ + --redLight: #fadbd9; + --orangeLight: #fde6d2; + --yellowLight: #E6B980; + --oliveLight: #e8f4d9; + --greenLight: #d7f0db; + --cyanLight: #d2f1f0; + --blueLight: #cce6ff; + --purpleLight: #e1d7f0; + --mauveLight: #ebd4ef; + --pinkLight: #f9d7ea; + --brownLight: #ede1d9; + --greyLight: #e7ebed; + /* 渐变色 */ + --gradualRed: linear-gradient(45deg, #f43f3b, #ec008c); + --gradualOrange: linear-gradient(45deg, #ff9700, #ed1c24); + --gradualGreen: linear-gradient(45deg, #39b54a, #8dc63f); + --gradualPurple: linear-gradient(45deg, #9000ff, #5e00ff); + --gradualPink: linear-gradient(45deg, #ec008c, #6739b6); + --gradualBlue: linear-gradient(45deg, #0081ff, #1cbbb4); + --gradualWhite: linear-gradient(45deg, #ffffff, #f8f8f8); + --gradualGray: linear-gradient(85deg, #FAF9F9, #F5F2F2); + --gradualYellow: linear-gradient(85deg, #F4DBB8, #E6B980); + --gradualYellow2: linear-gradient(0deg, #ffb957, #E6B980); + /* 阴影透明色 */ + --ShadowSize: 6rpx 6rpx 8rpx; + --redShadow: rgba(204, 69, 59, 0.2); + --orangeShadow: rgba(217, 109, 26, 0.2); + --yellowShadow: rgba(224, 170, 7, 0.2); + --oliveShadow: rgba(124, 173, 55, 0.2); + --greenShadow: rgba(48, 156, 63, 0.2); + --cyanShadow: rgba(28, 187, 180, 0.2); + --blueShadow: rgba(0, 102, 204, 0.2); + --purpleShadow: rgba(88, 48, 156, 0.2); + --mauveShadow: rgba(133, 33, 150, 0.2); + --pinkShadow: rgba(199, 50, 134, 0.2); + --brownShadow: rgba(140, 88, 53, 0.2); + --greyShadow: rgba(114, 130, 138, 0.2); + --grayShadow: rgba(114, 130, 138, 0.2); + --blackShadow: rgba(26, 26, 26, 0.2); + + background-color: var(--ghostWhite); + font-size: 28rpx; + color: var(--black); + font-family: Helvetica Neue, Helvetica, sans-serif; +} + +view, +scroll-view, +swiper, +button, +input, +textarea, +label, +navigator, +image { + box-sizing: border-box; +} + +.round { + border-radius: 5000rpx; +} + +.radius { + border-radius: 6rpx; +} + +/* ================== + 图片 + ==================== */ + +image { + max-width: 100%; + display: inline-block; + position: relative; + z-index: 0; +} + +image.loading::before { + content: ""; + background-color: #f5f5f5; + display: block; + position: absolute; + width: 100%; + height: 100%; + z-index: -2; +} + +image.loading::after { + content: "\e7f1"; + font-family: "cuIcon"; + position: absolute; + top: 0; + left: 0; + width: 32rpx; + height: 32rpx; + line-height: 32rpx; + right: 0; + bottom: 0; + z-index: -1; + font-size: 32rpx; + margin: auto; + color: #ccc; + -webkit-animation: cuIcon-spin 2s infinite linear; + animation: cuIcon-spin 2s infinite linear; + display: block; +} + +.response { + width: 100%; +} + +/* ================== + 开关 + ==================== */ + +switch, +checkbox, +radio { + position: relative; +} + +switch::after, +switch::before { + font-family: "cuIcon"; + content: "\e645"; + position: absolute; + color: var(--white) !important; + top: 0%; + left: 0rpx; + font-size: 26rpx; + line-height: 26px; + width: 50%; + text-align: center; + pointer-events: none; + transform: scale(0, 0); + transition: all 0.3s ease-in-out 0s; + z-index: 9; + bottom: 0; + height: 26px; + margin: auto; +} + +switch::before { + content: "\e646"; + right: 0; + transform: scale(1, 1); + left: auto; +} + +switch[checked]::after, +switch.checked::after { + transform: scale(1, 1); +} + +switch[checked]::before, +switch.checked::before { + transform: scale(0, 0); +} + +switch[checked]::before { + transform: scale(0, 0); +} + +radio::before, +checkbox::before { + font-family: "cuIcon"; + content: "\e645"; + position: absolute; + color: var(--white) !important; + top: 50%; + margin-top: -8px; + right: 5px; + font-size: 32rpx; + line-height: 16px; + pointer-events: none; + transform: scale(1, 1); + transition: all 0.3s ease-in-out 0s; + z-index: 9; +} + +radio .wx-radio-input, +checkbox .wx-checkbox-input { + margin: 0; + width: 20px; + height: 20px; +} + +checkbox.round .wx-checkbox-input { + border-radius: 100rpx; +} + +switch .wx-switch-input { + border: none; + padding: 0 24px; + width: 48px; + height: 26px; + margin: 0; + border-radius: 100rpx; +} + +switch .wx-switch-input:not([class*="bg-"]) { + background: var(--grey) !important; +} + +switch .wx-switch-input::after { + margin: auto; + width: 26px; + height: 26px; + border-radius: 100rpx; + left: 0rpx; + top: 0rpx; + bottom: 0rpx; + position: absolute; + transform: scale(0.9, 0.9); + transition: all 0.1s ease-in-out 0s; +} + +switch .wx-switch-input.wx-switch-input-checked::after { + margin: auto; + left: 22px; + box-shadow: none; + transform: scale(0.9, 0.9); +} + +radio-group { + display: inline-block; +} + + + +switch.radius .wx-switch-input::after, +switch.radius .wx-switch-input, +switch.radius .wx-switch-input::before { + border-radius: 10rpx; +} + +switch .wx-switch-input::before, +radio.radio::before, +checkbox .wx-checkbox-input::before, +radio .wx-radio-input::before, +radio.radio::before { + display: none; +} + +radio.radio[checked]::after { + content: ""; + background-color: transparent; + display: block; + position: absolute; + width: 8px; + height: 8px; + z-index: 999; + top: 0rpx; + left: 0rpx; + right: 0; + bottom: 0; + margin: auto; + border-radius: 200rpx; + border: 8px solid var(--white) !important; +} + +.switch-sex::after { + content: "\e71c"; +} + +.switch-sex::before { + content: "\e71a"; +} + +.switch-sex .wx-switch-input { + background: var(--red) !important; + border-color: var(--red) !important; +} + +.switch-sex[checked] .wx-switch-input { + background: var(--blue) !important; + border-color: var(--blue) !important; +} + +switch.red[checked] .wx-switch-input, +checkbox.red[checked] .wx-checkbox-input, +radio.red[checked] .wx-radio-input { + border-color: var(--red) !important; +} + +switch.orange[checked] .wx-switch-input, +checkbox.orange[checked] .wx-checkbox-input, +radio.orange[checked] .wx-radio-input { + border-color: var(--orange) !important; +} + +switch.yellow[checked] .wx-switch-input, +checkbox.yellow[checked] .wx-checkbox-input, +radio.yellow[checked] .wx-radio-input { + border-color: var(--yellow) !important; +} + +switch.olive[checked] .wx-switch-input, +checkbox.olive[checked] .wx-checkbox-input, +radio.olive[checked] .wx-radio-input { + border-color: var(--olive) !important; +} + +switch.green[checked] .wx-switch-input, +checkbox.green[checked] .wx-checkbox-input, +checkbox[checked] .wx-checkbox-input, +radio.green[checked] .wx-radio-input { + border-color: var(--green) !important; +} + +switch.cyan[checked] .wx-switch-input, +checkbox.cyan[checked] .wx-checkbox-input, +radio.cyan[checked] .wx-radio-input { + border-color: var(--cyan) !important; +} + +switch.blue[checked] .wx-switch-input, +checkbox.blue[checked] .wx-checkbox-input, +radio.blue[checked] .wx-radio-input { + border-color: var(--blue) !important; +} + +switch.purple[checked] .wx-switch-input, +checkbox.purple[checked] .wx-checkbox-input, +radio.purple[checked] .wx-radio-input { + border-color: var(--purple) !important; +} + +switch.mauve[checked] .wx-switch-input, +checkbox.mauve[checked] .wx-checkbox-input, +radio.mauve[checked] .wx-radio-input { + border-color: var(--mauve) !important; +} + +switch.pink[checked] .wx-switch-input, +checkbox.pink[checked] .wx-checkbox-input, +radio.pink[checked] .wx-radio-input { + border-color: var(--pink) !important; +} + +switch.brown[checked] .wx-switch-input, +checkbox.brown[checked] .wx-checkbox-input, +radio.brown[checked] .wx-radio-input { + border-color: var(--brown) !important; +} + +switch.grey[checked] .wx-switch-input, +checkbox.grey[checked] .wx-checkbox-input, +radio.grey[checked] .wx-radio-input { + border-color: var(--grey) !important; +} + +switch.gray[checked] .wx-switch-input, +checkbox.gray[checked] .wx-checkbox-input, +radio.gray[checked] .wx-radio-input { + border-color: var(--grey) !important; +} + +switch.black[checked] .wx-switch-input, +checkbox.black[checked] .wx-checkbox-input, +radio.black[checked] .wx-radio-input { + border-color: var(--black) !important; +} + +switch.white[checked] .wx-switch-input, +checkbox.white[checked] .wx-checkbox-input, +radio.white[checked] .wx-radio-input { + border-color: var(--white) !important; +} + +switch.red[checked] .wx-switch-input.wx-switch-input-checked, +checkbox.red[checked] .wx-checkbox-input, +radio.red[checked] .wx-radio-input { + background-color: var(--red) !important; + color: var(--white) !important; +} + +switch.orange[checked] .wx-switch-input, +checkbox.orange[checked] .wx-checkbox-input, +radio.orange[checked] .wx-radio-input { + background-color: var(--orange) !important; + color: var(--white) !important; +} + +switch.yellow[checked] .wx-switch-input, +checkbox.yellow[checked] .wx-checkbox-input, +radio.yellow[checked] .wx-radio-input { + background-color: var(--yellow) !important; + color: var(--black) !important; +} + +switch.olive[checked] .wx-switch-input, +checkbox.olive[checked] .wx-checkbox-input, +radio.olive[checked] .wx-radio-input { + background-color: var(--olive) !important; + color: var(--white) !important; +} + +switch.green[checked] .wx-switch-input, +switch[checked] .wx-switch-input, +checkbox.green[checked] .wx-checkbox-input, +checkbox[checked] .wx-checkbox-input, +radio.green[checked] .wx-radio-input, +radio[checked] .wx-radio-input { + background-color: var(--green) !important; + color: var(--white) !important; +} + +switch.cyan[checked] .wx-switch-input, +checkbox.cyan[checked] .wx-checkbox-input, +radio.cyan[checked] .wx-radio-input { + background-color: var(--cyan) !important; + color: var(--white) !important; +} + +switch.blue[checked] .wx-switch-input, +checkbox.blue[checked] .wx-checkbox-input, +radio.blue[checked] .wx-radio-input { + background-color: var(--blue) !important; + color: var(--white) !important; +} + +switch.purple[checked] .wx-switch-input, +checkbox.purple[checked] .wx-checkbox-input, +radio.purple[checked] .wx-radio-input { + background-color: var(--purple) !important; + color: var(--white) !important; +} + +switch.mauve[checked] .wx-switch-input, +checkbox.mauve[checked] .wx-checkbox-input, +radio.mauve[checked] .wx-radio-input { + background-color: var(--mauve) !important; + color: var(--white) !important; +} + +switch.pink[checked] .wx-switch-input, +checkbox.pink[checked] .wx-checkbox-input, +radio.pink[checked] .wx-radio-input { + background-color: var(--pink) !important; + color: var(--white) !important; +} + +switch.brown[checked] .wx-switch-input, +checkbox.brown[checked] .wx-checkbox-input, +radio.brown[checked] .wx-radio-input { + background-color: var(--brown) !important; + color: var(--white) !important; +} + +switch.grey[checked] .wx-switch-input, +checkbox.grey[checked] .wx-checkbox-input, +radio.grey[checked] .wx-radio-input { + background-color: var(--grey) !important; + color: var(--white) !important; +} + +switch.gray[checked] .wx-switch-input, +checkbox.gray[checked] .wx-checkbox-input, +radio.gray[checked] .wx-radio-input { + background-color: #f0f0f0 !important; + color: var(--black) !important; +} + +switch.black[checked] .wx-switch-input, +checkbox.black[checked] .wx-checkbox-input, +radio.black[checked] .wx-radio-input { + background-color: var(--black) !important; + color: var(--white) !important; +} + +switch.white[checked] .wx-switch-input, +checkbox.white[checked] .wx-checkbox-input, +radio.white[checked] .wx-radio-input { + background-color: var(--white) !important; + color: var(--black) !important; +} + +/* ================== + 边框 + ==================== */ + +/* -- 实线 -- */ + +.solid, +.solid-top, +.solid-right, +.solid-bottom, +.solid-left, +.solids, +.solids-top, +.solids-right, +.solids-bottom, +.solids-left, +.dashed, +.dashed-top, +.dashed-right, +.dashed-bottom, +.dashed-left { + position: relative; +} + +.solid::after, +.solid-top::after, +.solid-right::after, +.solid-bottom::after, +.solid-left::after, +.solids::after, +.solids-top::after, +.solids-right::after, +.solids-bottom::after, +.solids-left::after, +.dashed::after, +.dashed-top::after, +.dashed-right::after, +.dashed-bottom::after, +.dashed-left::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border-radius: inherit; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; +} + +.solid::after { + border: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.solid-top::after { + border-top: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.solid-right::after { + border-right: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.solid-bottom::after { + border-bottom: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.solid-left::after { + border-left: 1rpx solid rgba(0, 0, 0, 0.1); +} + +.solids::after { + border: 8rpx solid #eee; +} + +.solids-top::after { + border-top: 8rpx solid #eee; +} + +.solids-right::after { + border-right: 8rpx solid #eee; +} + +.solids-bottom::after { + border-bottom: 8rpx solid #eee; +} + +.solids-left::after { + border-left: 8rpx solid #eee; +} + +/* -- 虚线 -- */ + +.dashed::after { + border: 1rpx dashed #ddd; +} + +.dashed-top::after { + border-top: 1rpx dashed #ddd; +} + +.dashed-right::after { + border-right: 1rpx dashed #ddd; +} + +.dashed-bottom::after { + border-bottom: 1rpx dashed #ddd; +} + +.dashed-left::after { + border-left: 1rpx dashed #ddd; +} + +/* -- 阴影 -- */ + +.shadow[class*='white'] { + --ShadowSize: 0 1rpx 6rpx; +} + +.shadow-lg { + --ShadowSize: 0rpx 40rpx 100rpx 0rpx; +} + +.shadow-warp { + position: relative; + box-shadow: 0 0 10rpx rgba(0, 0, 0, 0.1); +} + +.shadow-warp:before, +.shadow-warp:after { + position: absolute; + content: ""; + top: 20rpx; + bottom: 30rpx; + left: 20rpx; + width: 50%; + box-shadow: 0 30rpx 20rpx rgba(0, 0, 0, 0.2); + transform: rotate(-3deg); + z-index: -1; +} + +.shadow-warp:after { + right: 20rpx; + left: auto; + transform: rotate(3deg); +} + +.shadow-blur { + position: relative; +} + +.shadow-blur::before { + content: ""; + display: block; + background: inherit; + filter: blur(10rpx); + position: absolute; + width: 100%; + height: 100%; + top: 10rpx; + left: 10rpx; + z-index: -1; + opacity: 0.4; + transform-origin: 0 0; + border-radius: inherit; + transform: scale(1, 1); +} + +/* ================== + 按钮 + ==================== */ + +.cu-btn { + position: relative; + border: 0rpx; + display: inline-flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + padding: 20rpx 30rpx; + font-size: 28rpx; + height: 90rpx; + line-height: 1; + text-align: center; + text-decoration: none; + overflow: visible; + margin-left: initial; + transform: translate(0rpx, 0rpx); + margin-right: initial; +} + +.cu-btn::after { + display: none; + background-color: #f5f5f5; +} + +.cu-btn:active { + background-color: #f5f5f5; + color: black; +} + +.cu-btn:focus { + background-color: #f5f5f5; + color: black; +} + +.cu-btn:not([class*="bg-"]) { + background-color: #f0f0f0; +} + +.cu-btn[class*="line"] { + background-color: transparent; +} + +.cu-btn[class*="line"]::after { + content: " "; + display: block; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border: 1rpx solid currentColor; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border-radius: 12rpx; + z-index: 1; + pointer-events: none; +} + +.cu-btn.foot { + position: fixed; + width: 100%; + bottom: 0; + z-index: 1024; + box-shadow: 0 -1rpx 6rpx rgba(0, 0, 0, 0.1); +} + +.foot { + position: fixed; + width: 100%; + bottom: 0; + z-index: 10; +} + +.cu-btn.round[class*="line"]::after { + border-radius: 1000rpx; +} + +.cu-btn.radius[class*="line"]::after { + border-radius: 10rpx +} + +.cu-btn[class*="lines"]::after { + border: 6rpx solid currentColor; +} + +.cu-btn[class*="bg-"]::after { + display: none; +} + +.cu-btn.sm { + padding: 0 20rpx; + font-size: 20rpx; + height: 48rpx; +} + +.cu-btn.lg { + padding: 0 40rpx; + font-size: 32rpx; + height: 80rpx; +} + +.cu-btn.icon.sm { + width: 48rpx; + height: 48rpx; +} + +.cu-btn.icon { + width: 64rpx; + height: 64rpx; + border-radius: 500rpx; + padding: 0; +} + +button.icon.lg { + width: 80rpx; + height: 80rpx; +} + +.image-32 { + width: 64rpx; + height: 64rpx; +} + +.image-64 { + width: 128rpx; + height: 128rpx; +} + +.cu-btn.shadow-blur::before { + top: 4rpx; + left: 4rpx; + filter: blur(6rpx); + opacity: 0.6; +} + +.cu-btn.button-hover { + transform: translate(1rpx, 1rpx); +} + +.block { + display: block; +} + +.cu-btn.block { + display: flex; +} + +.cu-btn[disabled] { + opacity: 0.6; + color: var(--white); +} + +/* ================== + 徽章 + ==================== */ + +.cu-tag { + vertical-align: middle; + position: relative; + display: inline-flex; + align-items: center; + justify-content: center; + box-sizing: border-box; + padding: 0rpx 16rpx; + height: 48rpx; + font-family: Helvetica Neue, Helvetica, sans-serif; + white-space: nowrap; +} + +.cu-tag:not([class*="bg"]):not([class*="line"]) { + background-color: var(--ghostWhite); +} + +.cu-tag[class*="line-"]::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border: 1rpx solid currentColor; + transform: scale(0.5); + transform-origin: 0 0; + box-sizing: border-box; + border-radius: inherit; + z-index: 1; + pointer-events: none; +} + +.cu-tag.radius[class*="line"]::after { + border-radius: 12rpx; +} + +.cu-tag.round[class*="line"]::after { + border-radius: 1000rpx; +} + +.cu-tag[class*="line-"]::after { + border-radius: 0; +} + +.cu-tag+.cu-tag { + margin-left: 10rpx; +} + +.cu-tag.sm { + font-size: 20rpx; + padding: 0rpx 12rpx; + height: 32rpx; +} + +.cu-tag.lg { + font-size: 24rpx; + padding: 0rpx 12rpx; + height: 20px; +} + +.cu-capsule { + display: inline-flex; + vertical-align: middle; +} + +.cu-capsule+.cu-capsule { + /* margin-left: 10rpx; */ + margin-left: 0rpx; +} + +.cu-capsule .cu-tag { + margin: 0; +} + +.cu-capsule .cu-tag[class*="line-"]:last-child::after { + border-left: 0rpx solid transparent; +} + +.cu-capsule .cu-tag[class*="line-"]:first-child::after { + border-right: 0rpx solid transparent; +} + +.cu-capsule.radius .cu-tag:first-child { + border-top-left-radius: 6rpx; + border-bottom-left-radius: 6rpx; +} + +.cu-capsule.radius .cu-tag:last-child::after, +.cu-capsule.radius .cu-tag[class*="line-"] { + border-top-right-radius: 12rpx; + border-bottom-right-radius: 12rpx; +} + +.cu-capsule.round .cu-tag:first-child { + border-top-left-radius: 200rpx; + border-bottom-left-radius: 200rpx; + text-indent: 4rpx; +} + +.cu-capsule.round .cu-tag:last-child::after, +.cu-capsule.round .cu-tag:last-child { + border-top-right-radius: 200rpx; + border-bottom-right-radius: 200rpx; + text-indent: -4rpx; +} + +.cu-tag.badge { + border-radius: 200rpx; + position: absolute; + top: -10rpx; + right: -10rpx; + font-size: 20rpx; + padding: 0rpx 10rpx; + height: 28rpx; + color: var(--white); +} + +.cu-tag.badge:not([class*="bg-"]) { + background-color: #dd514c; +} + +.cu-tag.badgegray { + border-radius: 200rpx; + position: absolute; + top: -10rpx; + right: -10rpx; + font-size: 20rpx; + padding: 0rpx 10rpx; + height: 28rpx; + color: var(--white); +} + +.cu-tag.badgegray:not([class*="bg-"]) { + background-color: #555; +} + +.cu-tag:empty:not([class*="cuIcon-"]) { + padding: 0rpx; + width: 16rpx; + height: 16rpx; + top: -4rpx; + right: -4rpx; +} + +.cu-tag[class*="cuIcon-"] { + width: 32rpx; + height: 32rpx; + top: -4rpx; + right: -4rpx; +} + +/* ================== + 头像 + ==================== */ + +.cu-avatar { + font-variant: small-caps; + margin: 0; + padding: 0; + display: inline-flex; + text-align: center; + justify-content: center; + align-items: center; + background-color: #ccc; + color: var(--white); + white-space: nowrap; + position: relative; + width: 64rpx; + height: 64rpx; + background-size: cover; + background-position: center; + vertical-align: middle; + font-size: 1.5em; +} + +.cu-avatar.sm { + width: 48rpx; + height: 48rpx; + font-size: 1em; +} + +.cu-avatar.lg { + width: 96rpx; + height: 96rpx; + font-size: 2em; +} + +.cu-avatar.xl { + width: 128rpx; + height: 128rpx; + font-size: 2.5em; +} + +.cu-avatar .avatar-text { + font-size: 0.4em; +} + +.cu-avatar-group { + direction: rtl; + unicode-bidi: bidi-override; + padding: 0 10rpx 0 40rpx; + display: inline-block; +} + +.cu-avatar-group .cu-avatar { + margin-left: -30rpx; + border: 4rpx solid var(--ghostWhite); + vertical-align: middle; +} + +.cu-avatar-group .cu-avatar.sm { + margin-left: -20rpx; + border: 1rpx solid var(--ghostWhite); +} + +/* ================== + 进度条 + ==================== */ + +.cu-progress { + overflow: hidden; + height: 28rpx; + background-color: #ebeef5; + display: inline-flex; + align-items: center; + width: 100%; +} + +.cu-progress+view, +.cu-progress+text { + line-height: 1; +} + +.cu-progress.xs { + height: 10rpx; +} + +.cu-progress.sm { + height: 20rpx; +} + +.cu-progress view { + width: 0; + height: 100%; + align-items: center; + display: flex; + justify-items: flex-end; + justify-content: space-around; + font-size: 20rpx; + color: var(--white); + transition: width 0.6s ease; +} + +.cu-progress text { + align-items: center; + display: flex; + font-size: 20rpx; + color: var(--black); + text-indent: 10rpx; +} + +.cu-progress.text-progress { + padding-right: 60rpx; +} + +.cu-progress.striped view { + background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); + background-size: 72rpx 72rpx; +} + +.cu-progress.active view { + animation: progress-stripes 2s linear infinite; +} + +@keyframes progress-stripes { + from { + background-position: 72rpx 0; + } + + to { + background-position: 0 0; + } +} + +/* ================== + 加载 + ==================== */ + +.cu-load { + display: block; + line-height: 3em; + text-align: center; +} + +.cu-load::before { + font-family: "cuIcon"; + display: inline-block; + margin-right: 6rpx; +} + +.cu-load.loading::before { + content: "\e67a"; + animation: cuIcon-spin 2s infinite linear; +} + +.cu-load.loading::after { + content: "加载中..."; +} + +.cu-load.over::before { + content: "\e64a"; +} + +.cu-load.over::after { + content: "没有更多了"; +} + +.cu-load.erro::before { + content: "\e658"; +} + +.cu-load.erro::after { + content: "加载失败"; +} + +.cu-load.load-icon::before { + font-size: 32rpx; +} + +.cu-load.load-icon::after { + display: none; +} + +.cu-load.load-icon.over { + display: none; +} + +.cu-load.load-modal { + position: fixed; + top: 0; + right: 0; + bottom: 140rpx; + left: 0; + margin: auto; + width: 260rpx; + height: 260rpx; + background-color: var(--white); + border-radius: 10rpx; + box-shadow: 0 0 0rpx 2000rpx rgba(0, 0, 0, 0.5); + display: flex; + align-items: center; + flex-direction: column; + justify-content: center; + font-size: 28rpx; + z-index: 9999; + line-height: 2.4em; +} + +.cu-load.load-modal [class*="cuIcon-"] { + font-size: 60rpx; +} + +.cu-load.load-modal image { + width: 70rpx; + height: 70rpx; +} + +.cu-load.load-modal::after { + content: ""; + position: absolute; + background-color: var(--white); + border-radius: 50%; + width: 200rpx; + height: 200rpx; + font-size: 10px; + border-top: 6rpx solid rgba(0, 0, 0, 0.05); + border-right: 6rpx solid rgba(0, 0, 0, 0.05); + border-bottom: 6rpx solid rgba(0, 0, 0, 0.05); + border-left: 6rpx solid var(--orange); + animation: cuIcon-spin 1s infinite linear; + z-index: -1; +} + +.load-progress { + pointer-events: none; + top: 0; + position: fixed; + width: 100%; + left: 0; + z-index: 2000; +} + +.load-progress.hide { + display: none; +} + +.load-progress .load-progress-bar { + position: relative; + width: 100%; + height: 4rpx; + overflow: hidden; + transition: all 200ms ease 0s; +} + +.load-progress .load-progress-spinner { + position: absolute; + top: 10rpx; + right: 10rpx; + z-index: 2000; + display: block; +} + +.load-progress .load-progress-spinner::after { + content: ""; + display: block; + width: 24rpx; + height: 24rpx; + -webkit-box-sizing: border-box; + box-sizing: border-box; + border: solid 4rpx transparent; + border-top-color: inherit; + border-left-color: inherit; + border-radius: 50%; + -webkit-animation: load-progress-spinner 0.4s linear infinite; + animation: load-progress-spinner 0.4s linear infinite; +} + +@-webkit-keyframes load-progress-spinner { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +@keyframes load-progress-spinner { + 0% { + -webkit-transform: rotate(0); + transform: rotate(0); + } + + 100% { + -webkit-transform: rotate(360deg); + transform: rotate(360deg); + } +} + +/* ================== + 列表 + ==================== */ +.grayscale { + filter: grayscale(1); +} + +/* .cu-list+.cu-list { + +} */ + +.cu-list>.cu-item { + transition: all .6s ease-in-out 0s; + transform: translateX(0rpx) +} + +.cu-list>.cu-item.move-cur { + transform: translateX(-260rpx) +} + +.cu-list>.cu-item .move { + position: absolute; + right: 0; + display: flex; + width: 260rpx; + height: 100%; + transform: translateX(100%) +} + +.cu-list>.cu-item .move view { + display: flex; + flex: 1; + justify-content: center; + align-items: center +} + +.cu-list.menu-avatar { + overflow: hidden; +} + +.cu-list.menu-avatar>.cu-item { + position: relative; + display: flex; + padding-right: 10rpx; + height: 160rpx; + background-color: var(--white); + justify-content: flex-end; + align-items: center +} + +.cu-list.menu-avatar>.cu-item>.cu-avatar { + position: absolute; + left: 30rpx +} + +.cu-list.menu-avatar>.cu-item .flex .text-cut { + max-width: 510rpx +} + +.cu-list.menu-avatar>.cu-item .content { + position: absolute; + left: 165rpx; + width: calc(100% - 96rpx - 60rpx - 120rpx - 20rpx); + line-height: 1.6em; +} + +.cu-list.menu-avatar>.cu-item .content.flex-sub { + width: calc(100% - 96rpx - 60rpx - 20rpx); +} + +.cu-list.menu-avatar>.cu-item .content>view:first-child { + font-size: 30rpx; + display: flex; + align-items: center +} + +.cu-list.menu-avatar>.cu-item .content .cu-tag.sm { + display: inline-block; + margin-left: 10rpx; + height: 28rpx; + font-size: 16rpx; + line-height: 32rpx +} + +.cu-list.menu-avatar>.cu-item .action { + width: 120rpx; + text-align: center +} + +.cu-list.menu-avatar>.cu-item .action view+view { + margin-top: 10rpx +} + +.cu-list.menu-avatar.comment>.cu-item .content { + position: relative; + left: 0; + width: auto; + flex: 1; +} + +.cu-list.menu-avatar.comment>.cu-item { + padding: 30rpx 30rpx 30rpx 120rpx; + height: auto +} + +.cu-list.menu-avatar.comment .cu-avatar { + align-self: flex-start +} + +.cu-list.menu>.cu-item { + position: relative; + display: flex; + padding: 0 30rpx; + min-height: 100rpx; + background-color: var(--white); + justify-content: space-between; + align-items: center +} + +.cu-list.menu>.cu-item:last-child:after { + border: none +} + +.border-line { + border: 1rpx solid #ddd; + border-radius: 10rpx; +} + +.cu-list.menu>.cu-item:after { + position: absolute; + top: 0; + left: 0; + box-sizing: border-box; + width: 200%; + height: 200%; + border-bottom: 1rpx solid #ddd; + border-radius: inherit; + content: " "; + transform: scale(.5); + transform-origin: 0 0; + pointer-events: none +} + +.cu-list.menu>.cu-item.grayscale { + background-color: #f5f5f5 +} + +.cu-list.menu>.cu-item.cur { + background-color: #fcf7e9 +} + +.cu-list.menu>.cu-item.arrow { + padding-right: 90rpx +} + +.cu-list.menu>.cu-item.arrow:before { + position: absolute; + top: 0; + right: 30rpx; + bottom: 0; + display: block; + margin: auto; + width: 30rpx; + height: 30rpx; + color: var(--grey); + content: "\e6a3"; + text-align: center; + font-size: 34rpx; + font-family: "cuIcon"; + line-height: 30rpx +} + +.cu-list.menu>.cu-item button.content { + padding: 0; + background-color: transparent; + justify-content: flex-start +} + +.cu-list.menu>.cu-item button.content:after { + display: none +} + +.cu-list.menu>.cu-item .cu-avatar-group .cu-avatar { + border-color: var(--white) +} + +.cu-list.menu>.cu-item .content>view:first-child { + display: flex; + align-items: center +} + +.cu-list.menu>.cu-item .content>text[class*=cuIcon] { + display: inline-block; + margin-right: 10rpx; + width: 1.6em; + text-align: center +} + +.cu-list.menu>.cu-item .content>image { + display: inline-block; + margin-right: 10rpx; + width: 1.6em; + height: 1.6em; + vertical-align: middle +} + +.cu-list.menu>.cu-item .content { + font-size: 30rpx; + line-height: 1.6em; + flex: 1 +} + +.cu-list.menu>.cu-item .content .cu-tag.sm { + display: inline-block; + margin-left: 10rpx; + height: 28rpx; + font-size: 16rpx; + line-height: 32rpx +} + +.cu-list.menu>.cu-item .action .cu-tag:empty { + right: 10rpx +} + +.cu-list.menu { + display: block; + overflow: hidden +} + +.cu-list.menu.sm-border>.cu-item:after { + left: 30rpx; + width: calc(200% - 120rpx) +} + +.cu-list.grid>.cu-item { + position: relative; + display: flex; + padding: 20rpx 0 30rpx; + transition-duration: 0s; + flex-direction: column +} + +.cu-list.grid>.cu-item:after { + position: absolute; + top: 0; + left: 0; + box-sizing: border-box; + width: 200%; + height: 200%; + border-right: 1px solid rgba(0, 0, 0, .1); + border-bottom: 1px solid rgba(0, 0, 0, .1); + border-radius: inherit; + content: " "; + transform: scale(.5); + transform-origin: 0 0; + pointer-events: none +} + +.cu-list.grid>.cu-item text { + display: block; + margin-top: 10rpx; + color: #888; + font-size: 26rpx; + line-height: 40rpx +} + +.cu-list.grid>.cu-item [class*=cuIcon] { + position: relative; + display: block; + margin-top: 20rpx; + width: 100%; + font-size: 48rpx +} + +.cu-list.grid>.cu-item .cu-tag { + right: auto; + left: 50%; + margin-left: 20rpx +} + +.cu-list.grid { + background-color: var(--white); + text-align: center +} + +.cu-list.grid.no-border>.cu-item { + padding-top: 10rpx; + padding-bottom: 20rpx +} + +.cu-list.grid.no-border>.cu-item:after { + border: none +} + +.cu-list.grid.no-border { + padding: 0rpx 20rpx +} + +.cu-list.grid.col-3>.cu-item:nth-child(3n):after, +.cu-list.grid.col-4>.cu-item:nth-child(4n):after, +.cu-list.grid.col-5>.cu-item:nth-child(5n):after { + border-right-width: 0 +} + +.cu-list.card-menu { + overflow: hidden; + margin-right: 15rpx; + margin-left: 15rpx; + border-radius: 5rpx +} + + +/* ================== + 操作条 + ==================== */ + +.cu-bar { + display: flex; + position: relative; + align-items: center; + min-height: 60rpx; + justify-content: space-between; +} + +.cu-bar .action { + display: flex; + align-items: center; + height: 100%; + justify-content: center; + max-width: 100%; +} + +.cu-bar .action.border-title { + position: relative; + top: -10rpx; +} + +.cu-bar .action.border-title text[class*="bg-"]:last-child { + position: absolute; + bottom: -0.5rem; + min-width: 2rem; + height: 6rpx; + left: 0; +} + +.cu-bar .action.sub-title { + position: relative; + top: -0.2rem; +} + +.cu-bar .action.sub-title text { + position: relative; + z-index: 1; +} + +.cu-bar .action.sub-title text[class*="bg-"]:last-child { + position: absolute; + display: inline-block; + bottom: -0.2rem; + border-radius: 6rpx; + width: 100%; + height: 0.6rem; + left: 0.6rem; + opacity: 0.3; + z-index: 0; +} + +.cu-bar .action.sub-title text[class*="text-"]:last-child { + position: absolute; + display: inline-block; + bottom: -0.7rem; + left: 0.5rem; + opacity: 0.2; + z-index: 0; + text-align: right; + font-weight: 900; + font-size: 36rpx; +} + +.cu-bar.justify-center .action.border-title text:last-child, +.cu-bar.justify-center .action.sub-title text:last-child { + left: 0; + right: 0; + margin: auto; + text-align: center; +} + +.cu-bar .action:first-child { + margin-left: 20rpx; + font-size: 30rpx; +} + +.cu-bar .action text.text-cut { + text-align: left; + width: 100%; +} + +.cu-bar .cu-avatar:first-child { + margin-left: 20rpx; +} + +.cu-bar .action:first-child>text[class*="cuIcon-"] { + margin-left: -0.3em; + margin-right: 0.3em; +} + +.cu-bar .action:last-child { + margin-right: 30rpx; +} + +.cu-bar .action>text[class*="cuIcon-"], +.cu-bar .action>view[class*="cuIcon-"] { + font-size: 36rpx; +} + +.cu-bar .action>text[class*="cuIcon-"]+text[class*="cuIcon-"] { + margin-left: 0.5em; +} + +.cu-bar .content { + position: absolute; + text-align: center; + width: calc(100% - 340rpx); + left: 0; + right: 0; + bottom: 0; + top: 0; + margin: auto; + height: 60rpx; + font-size: 32rpx; + line-height: 60rpx; + cursor: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.cu-bar.ios .content { + bottom: 7px; + height: 30px; + font-size: 32rpx; + line-height: 30px; +} + +.cu-bar.btn-group { + justify-content: space-around; +} + +.cu-bar.btn-group button { + padding: 20rpx 32rpx; +} + +.cu-bar.btn-group button { + flex: 1; + margin: 0 20rpx; + max-width: 50%; +} + +.cu-bar .search-form { + background-color: #f5f5f5; + line-height: 64rpx; + height: 64rpx; + font-size: 24rpx; + color: var(--black); + flex: 1; + display: flex; + align-items: center; + margin: 0 30rpx; +} + +.cu-bar .search-form+.action { + margin-right: 30rpx; +} + +.cu-bar .search-form input { + flex: 1; + padding-right: 30rpx; + height: 64rpx; + line-height: 64rpx; + font-size: 26rpx; + background-color: transparent; +} + +.cu-bar .search-form [class*="cuIcon-"] { + margin: 0 0.5em 0 0.8em; +} + +.cu-bar .search-form [class*="cuIcon-"]::before { + top: 0rpx; +} + +.cu-bar.fixed, +.nav.fixed { + position: fixed; + width: 100%; + top: 0; + z-index: 1024; + box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.1); +} + +.cu-bar.foot { + position: fixed; + width: 100%; + bottom: 0; + z-index: 1024; + box-shadow: 0 -1rpx 6rpx rgba(0, 0, 0, 0.1); +} + +.cu-bar.tabbar { + padding: 0; + height: calc(100rpx + env(safe-area-inset-bottom) / 2); + padding-bottom: calc(env(safe-area-inset-bottom) / 2); +} + +.cu-tabbar-height { + min-height: 100rpx; + height: calc(100rpx + env(safe-area-inset-bottom) / 2); +} + +.cu-bar.tabbar.shadow { + box-shadow: 0 -1rpx 6rpx rgba(0, 0, 0, 0.1); +} + +.cu-bar.tabbar .action { + font-size: 22rpx; + position: relative; + flex: 1; + text-align: center; + padding: 0; + display: block; + height: auto; + line-height: 1; + margin: 0; + overflow: initial; +} + +.cu-bar.tabbar.shop .action { + width: 140rpx; + flex: initial; +} + +.cu-bar.tabbar .action.add-action { + position: relative; + z-index: 2; + padding-top: 50rpx; + background-color: inherit; +} + +.cu-bar.tabbar .action.add-action [class*="cuIcon-"] { + position: absolute; + width: 70rpx; + z-index: 2; + height: 70rpx; + border-radius: 50%; + line-height: 70rpx; + font-size: 50rpx; + top: -35rpx; + left: 0; + right: 0; + margin: auto; + padding: 0; +} + +.cu-bar.tabbar .action.add-action::after { + content: ""; + position: absolute; + width: 100rpx; + height: 100rpx; + top: -50rpx; + left: 0; + right: 0; + margin: auto; + box-shadow: 0 -3rpx 8rpx rgba(0, 0, 0, 0.08); + border-radius: 50rpx; + background-color: inherit; + z-index: 0; +} + +.cu-bar.tabbar .action.add-action::before { + content: ""; + position: absolute; + width: 100rpx; + height: 30rpx; + bottom: 30rpx; + left: 0; + right: 0; + margin: auto; + background-color: inherit; + z-index: 1; +} + +.cu-bar.tabbar .btn-group { + flex: 1; + display: flex; + justify-content: space-around; + align-items: center; + padding: 0 10rpx; +} + +.cu-bar.tabbar button.action::after { + border: 0; +} + +.cu-bar.tabbar .action [class*="cuIcon-"] { + width: 100rpx; + position: relative; + display: block; + height: auto; + margin: 0 auto 10rpx; + text-align: center; + font-size: 40rpx; +} + +.cu-bar.tabbar .action .cuIcon-cu-image { + margin: 0 auto; +} + +.cu-bar.tabbar .action .cuIcon-cu-image image { + width: 50rpx; + height: 50rpx; + display: inline-block; +} + +.cu-bar.tabbar .submit { + align-items: center; + display: flex; + justify-content: center; + text-align: center; + position: relative; + flex: 2; + align-self: stretch; +} + +.cu-bar.tabbar .submit:last-child { + flex: 2.6; +} + +.cu-bar.tabbar .submit+.submit { + flex: 2; +} + +.cu-bar.tabbar.border .action::before { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + transform: scale(0.5); + transform-origin: 0 0; + border-right: 1rpx solid rgba(0, 0, 0, 0.1); + z-index: 3; +} + +.cu-bar.tabbar.border .action:last-child:before { + display: none; +} + +.cu-bar.input { + padding-right: 20rpx; + background-color: var(--white); +} + +.cu-bar.input input { + overflow: initial; + line-height: 64rpx; + height: 64rpx; + min-height: 64rpx; + flex: 1; + font-size: 30rpx; + margin: 0 20rpx; +} + +.cu-bar.input .action { + margin-left: 20rpx; +} + +.cu-bar.input .action [class*="cuIcon-"] { + font-size: 48rpx; +} + +.cu-bar.input input+.action { + margin-right: 20rpx; + margin-left: 0rpx; +} + +.cu-bar.input .action:first-child [class*="cuIcon-"] { + margin-left: 0rpx; +} + +.cu-custom { + display: block; + position: relative; +} + +.cu-custom .cu-bar .content { + width: calc(100% - 440rpx); +} + + +.cu-custom .cu-bar .content image { + height: 60rpx; + width: 240rpx; +} + +.cu-custom .cu-bar { + min-height: 0px; + padding-right: 220rpx; + box-shadow: 0rpx 0rpx 0rpx; + z-index: 9999; +} + +.cu-custom .cu-bar .border-custom { + position: relative; + background: rgba(0, 0, 0, 0.15); + border-radius: 1000rpx; + height: 30px; +} + +.cu-custom .cu-bar .border-custom::after { + content: " "; + width: 200%; + height: 200%; + position: absolute; + top: 0; + left: 0; + border-radius: inherit; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + border: 1rpx solid var(--white); + opacity: 0.5; +} + +.cu-custom .cu-bar .border-custom::before { + content: " "; + width: 1rpx; + height: 110%; + position: absolute; + top: 22.5%; + left: 0; + right: 0; + margin: auto; + transform: scale(0.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + opacity: 0.6; + background-color: var(--white); +} + +.cu-custom .cu-bar .border-custom text { + display: block; + flex: 1; + margin: auto !important; + text-align: center; + font-size: 34rpx; +} + +/* ================== + 导航栏 + ==================== */ + +.nav { + white-space: nowrap; +} + +::-webkit-scrollbar { + display: none; +} + +.nav .cu-item { + height: 90rpx; + display: inline-block; + line-height: 90rpx; + margin: 0 10rpx; + padding: 0 20rpx; +} + +.nav .cu-item.cur { + border-bottom: 4rpx solid; +} + +/* ================== + 时间轴 + ==================== */ + +.cu-timeline { + display: block; + background-color: var(--white); +} + +.cu-timeline .cu-time { + width: 120rpx; + text-align: center; + padding: 20rpx 0; + font-size: 26rpx; + color: #888; + display: block; +} + +.cu-timeline>.cu-item { + padding: 30rpx 30rpx 30rpx 120rpx; + position: relative; + display: block; + z-index: 0; +} + +.cu-timeline>.cu-item:not([class*="text-"]) { + color: #ccc; +} + +.cu-timeline>.cu-item::after { + content: ""; + display: block; + position: absolute; + width: 1rpx; + background-color: #ddd; + left: 60rpx; + height: 100%; + top: 0; + z-index: 8; +} + +.cu-timeline>.cu-item::before { + font-family: "cuIcon"; + display: block; + position: absolute; + top: 36rpx; + z-index: 9; + background-color: var(--white); + width: 50rpx; + height: 50rpx; + text-align: center; + border: none; + line-height: 50rpx; + left: 36rpx; +} + +.cu-timeline>.cu-item:not([class*="cuIcon-"])::before { + content: "\e763"; +} + +.cu-timeline>.cu-item[class*="cuIcon-"]::before { + background-color: var(--white); + width: 50rpx; + height: 50rpx; + text-align: center; + border: none; + line-height: 50rpx; + left: 36rpx; +} + +.cu-timeline>.cu-item>.content { + padding: 30rpx; + border-radius: 6rpx; + display: block; + line-height: 1.6; +} + +.cu-timeline>.cu-item>.content:not([class*="bg-"]) { + background-color: var(--ghostWhite); + color: var(--black); +} + +.cu-timeline>.cu-item>.content+.content { + margin-top: 20rpx; +} + +/* ================== + 聊天 + ==================== */ + +.cu-chat { + display: flex; + flex-direction: column; +} + +.cu-chat .cu-item { + display: flex; + padding: 30rpx 30rpx 70rpx; + position: relative; +} + +.cu-chat .cu-item>.cu-avatar { + width: 80rpx; + height: 80rpx; +} + +.cu-chat .cu-item>.main { + max-width: calc(100% - 260rpx); + margin: 0 40rpx; + display: flex; + align-items: center; +} + +.cu-chat .cu-item>image { + height: 320rpx; +} + +.cu-chat .cu-item>.main .content { + padding: 20rpx; + border-radius: 6rpx; + display: inline-flex; + max-width: 100%; + align-items: center; + font-size: 30rpx; + position: relative; + min-height: 80rpx; + line-height: 40rpx; + text-align: left; +} + +.cu-chat .cu-item>.main .content:not([class*="bg-"]) { + background-color: var(--white); + color: var(--black); +} + +.cu-chat .cu-item .date { + position: absolute; + font-size: 24rpx; + color: var(--grey); + width: calc(100% - 320rpx); + bottom: 20rpx; + left: 160rpx; +} + +.cu-chat .cu-item .action { + padding: 0 30rpx; + display: flex; + align-items: center; +} + +.cu-chat .cu-item>.main .content::after { + content: ""; + top: 27rpx; + transform: rotate(45deg); + position: absolute; + z-index: 100; + display: inline-block; + overflow: hidden; + width: 24rpx; + height: 24rpx; + left: -12rpx; + right: initial; + background-color: inherit; +} + +.cu-chat .cu-item.self>.main .content::after { + left: auto; + right: -12rpx; +} + +.cu-chat .cu-item>.main .content::before { + content: ""; + top: 30rpx; + transform: rotate(45deg); + position: absolute; + z-index: -1; + display: inline-block; + overflow: hidden; + width: 24rpx; + height: 24rpx; + left: -12rpx; + right: initial; + background-color: inherit; + filter: blur(5rpx); + opacity: 0.3; +} + +.cu-chat .cu-item>.main .content:not([class*="bg-"])::before { + background-color: var(--black); + opacity: 0.1; +} + +.cu-chat .cu-item.self>.main .content::before { + left: auto; + right: -12rpx; +} + +.cu-chat .cu-item.self { + justify-content: flex-end; + text-align: right; +} + +.cu-chat .cu-info { + display: inline-block; + margin: 20rpx auto; + font-size: 24rpx; + padding: 8rpx 12rpx; + background-color: rgba(0, 0, 0, 0.2); + border-radius: 6rpx; + color: var(--white); + max-width: 400rpx; + line-height: 1.4; +} + +/* ================== + 卡片 + ==================== */ + +.cu-card { + display: block; + overflow: hidden; +} + +.cu-card>.cu-item { + display: block; + background-color: var(--white); + overflow: hidden; + border-radius: 10rpx; + margin: 10rpx; +} + +.cu-card>.cu-item.shadow-blur { + overflow: initial; +} + +.cu-card.no-card>.cu-item { + margin: 0rpx; + border-radius: 0rpx; +} + +.cu-card .grid.grid-square { + margin-bottom: -20rpx; +} + +.cu-card.case .image { + position: relative; +} + +.cu-card.case .image image { + width: 100%; +} + +.cu-card.case .image .cu-tag { + position: absolute; + left: 0; + top: 0; +} + +.cu-card.case .image .cu-bar { + position: absolute; + bottom: 0; + width: 100%; + background-color: transparent; + padding: 0rpx 30rpx; +} + +.cu-card.case.no-card .image { + margin: 30rpx 30rpx 0; + overflow: hidden; + border-radius: 10rpx; +} + +.cu-card.dynamic { + display: block; +} + +.cu-card.dynamic>.cu-item { + display: block; + background-color: var(--white); + overflow: hidden; +} + +.cu-card.dynamic>.cu-item>.text-content { + padding: 0 30rpx 0; + max-height: 6.4em; + overflow: hidden; + font-size: 30rpx; + margin-bottom: 20rpx; +} + +.cu-card.dynamic>.cu-item .square-img { + width: 100%; + height: 200rpx; + border-radius: 6rpx; +} + +.cu-card.dynamic>.cu-item .only-img { + width: 100%; + height: 320rpx; + border-radius: 6rpx; +} + +.cu-card.article { + display: block; +} + +.cu-card.article>.cu-item { + padding-bottom: 30rpx; +} + +.cu-card.article>.cu-item .title { + font-size: 30rpx; + font-weight: 900; + color: var(--black); + line-height: 100rpx; + padding: 0 30rpx; +} + +.cu-card.article>.cu-item .content { + display: flex; + padding: 0 30rpx; +} + +.cu-card.article>.cu-item .content>image { + width: 240rpx; + height: 8.4em; + margin-right: 20rpx; + border-radius: 6rpx; +} + +.cu-card.article>.cu-item .content .desc { + flex: 1; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.cu-card.article>.cu-item .content .text-content { + font-size: 28rpx; + color: #888; + height: 4.8em; + overflow: hidden; +} + +/* ================== + 表单 + ==================== */ + +.cu-form-group { + width: 100%; + background-color: var(--white); + display: flex; + align-items: center; + justify-content: space-between; +} + +.cu-form-group+.cu-form-group { + border-top: 1rpx solid #eee; +} + +.cu-form-group .title { + text-align: justify; + padding-right: 20rpx; + font-size: 32rpx; + position: relative; +} + +.cu-form-group .title-right { + text-align: right; + padding-right: 20rpx; + font-size: 30rpx; + position: relative; + height: 60rpx; + line-height: 60rpx; +} + +.cu-form-group .title-left { + text-align: left; + padding-right: 20rpx; + font-size: 30rpx; + position: relative; + height: 60rpx; + line-height: 60rpx; +} + +.cu-form-group input { + flex: 1; + font-size: 30rpx; + color: #555; + padding-right: 20rpx; +} + +.cu-form-group .content { + flex: 1; + text-align: right; + font-size: 30rpx; + color: #000000; + padding-right: 20rpx; +} + +.cu-form-group .content-red { + flex: 1; + text-align: right; + font-size: 30rpx; + color: #FF0000; + padding-right: 20rpx; +} + +.cu-form-group .content-left { + flex: 1; + text-align: left; + font-size: 30rpx; + color: #000000; + padding-right: 20rpx; +} + +.cu-form-group>text[class*="cuIcon-"] { + font-size: 36rpx; + padding: 0; + box-sizing: border-box; +} + +.cu-form-group textarea { + margin: 0rpx; + height: 10em; + width: 100%; + line-height: 1.2em; + flex: 1; + font-size: 28rpx; + padding: 15rpx; +} + +.cu-form-group.align-start .title { + height: 1em; + margin-top: 32rpx; + line-height: 1em; +} + +.cu-form-group picker { + flex: 1; + padding-right: 40rpx; + overflow: hidden; + position: relative; +} + +.cu-form-group picker .picker { + line-height: 60rpx; + font-size: 32rpx; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 100%; + text-align: right; +} + +.cu-form-group picker .picker-left { + line-height: 60rpx; + font-size: 28rpx; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 100%; + text-align: left; +} + +.cu-form-group picker::after { + font-family: "cuIcon"; + display: block; + content: "\e6a3"; + position: absolute; + font-size: 34rpx; + color: var(--grey); + line-height: 60rpx; + width: 60rpx; + text-align: center; + top: 0; + bottom: 0; + right: -20rpx; + margin: auto; +} + +.cu-form-group textarea[disabled], +.cu-form-group textarea[disabled] .placeholder { + color: transparent; +} + +/* ================== + 模态窗口 + ==================== */ + +.cu-modal { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1110; + opacity: 0; + outline: 0; + text-align: center; + -ms-transform: scale(1.185); + transform: scale(1.185); + backface-visibility: hidden; + perspective: 2000rpx; + background: rgba(0, 0, 0, 0.6); + transition: all 0.3s ease-in-out 0s; + pointer-events: none; +} + +.cu-modal::before { + content: "\200B"; + display: inline-block; + height: 100%; + vertical-align: middle; +} + +.cu-modal.show { + opacity: 1; + transition-duration: 0.3s; + -ms-transform: scale(1); + transform: scale(1); + overflow-x: hidden; + overflow-y: auto; + pointer-events: auto; +} + +.cu-dialog { + position: relative; + display: inline-block; + vertical-align: middle; + margin-left: auto; + margin-right: auto; + width: 680rpx; + max-width: 100%; + background-color: #f8f8f8; + border-radius: 10rpx; + overflow: hidden; +} + +.cu-modal.bottom-modal::before { + vertical-align: bottom; +} + +.cu-modal.bottom-modal .cu-dialog { + width: 100%; + border-radius: 0; +} + +.cu-modal.bottom-modal { + margin-bottom: -1000rpx; +} + +.cu-modal.bottom-modal.show { + margin-bottom: 0; +} + +.cu-modal.drawer-modal { + transform: scale(1); + display: flex; +} + +.cu-modal.drawer-modal .cu-dialog { + height: 100%; + min-width: 200rpx; + border-radius: 0; + margin: initial; + transition-duration: 0.3s; +} + +.cu-modal.drawer-modal.justify-start .cu-dialog { + transform: translateX(-100%); +} + +.cu-modal.drawer-modal.justify-end .cu-dialog { + transform: translateX(100%); +} + +.cu-modal.drawer-modal.show .cu-dialog { + transform: translateX(0%); +} + +.cu-modal .cu-dialog>.cu-bar:first-child .action { + min-width: 100rpx; + margin-right: 0; + min-height: 100rpx; +} + +/* ================== + 轮播 + ==================== */ +swiper .a-swiper-dot { + display: inline-block; + width: 16rpx; + height: 16rpx; + background: rgba(0, 0, 0, .3); + border-radius: 50%; + vertical-align: middle; +} + +swiper[class*="-dot"] .wx-swiper-dots { + display: flex; + align-items: center; + width: 100%; + justify-content: center; +} + +swiper.square-dot .wx-swiper-dot { + background-color: var(--white); + opacity: 0.4; + width: 10rpx; + height: 10rpx; + border-radius: 20rpx; + margin: 0 8rpx !important; +} + +swiper.square-dot .wx-swiper-dot.wx-swiper-dot-active { + opacity: 1; + width: 30rpx; +} + +swiper.round-dot .wx-swiper-dot { + width: 10rpx; + height: 10rpx; + position: relative; + margin: 4rpx 8rpx !important; +} + +swiper.round-dot .wx-swiper-dot.wx-swiper-dot-active::after { + content: ""; + position: absolute; + width: 10rpx; + height: 10rpx; + top: 0rpx; + left: 0rpx; + right: 0; + bottom: 0; + margin: auto; + background-color: var(--white); + border-radius: 20rpx; +} + +swiper.round-dot .wx-swiper-dot.wx-swiper-dot-active { + width: 18rpx; + height: 18rpx; +} + +.screen-swiper { + min-height: 375rpx; +} + +.screen-swiper-lg { + min-height: 245rpx; +} + +.screen-swiper.xl { + height: 600rpx; +} + +.screen-swiper image, +.screen-swiper video, +.swiper-item image, +.swiper-item video { + width: 100%; + display: block; + height: 100%; + margin: 0; + pointer-events: none; +} + +.card-swiper { + height: 420rpx !important; +} + +.card-swiper swiper-item { + width: 610rpx !important; + left: 70rpx; + box-sizing: border-box; + padding: 40rpx 0rpx 70rpx; + overflow: initial; +} + +.card-swiper swiper-item .swiper-item { + width: 100%; + display: block; + height: 100%; + border-radius: 10rpx; + transform: scale(0.9); + transition: all 0.2s ease-in 0s; + overflow: hidden; +} + +.card-swiper swiper-item.cur .swiper-item { + transform: none; + transition: all 0.2s ease-in 0s; +} + + +.tower-swiper { + height: 420rpx; + position: relative; + max-width: 750rpx; + overflow: hidden; +} + +.tower-swiper .tower-item { + position: absolute; + width: 300rpx; + height: 380rpx; + top: 0; + bottom: 0; + left: 50%; + margin: auto; + transition: all 0.2s ease-in 0s; + opacity: 1; +} + +.tower-swiper .tower-item.none { + opacity: 0; +} + +.tower-swiper .tower-item .swiper-item { + width: 100%; + height: 100%; + border-radius: 6rpx; + overflow: hidden; +} + +/* ================== + 步骤条 + ==================== */ + +.cu-steps { + display: flex; +} + +scroll-view.cu-steps { + display: block; + white-space: nowrap; +} + +scroll-view.cu-steps .cu-item { + display: inline-block; +} + +.cu-steps .cu-item { + flex: 1; + text-align: center; + position: relative; + min-width: 100rpx; +} + +.cu-steps .cu-item:not([class*="text-"]) { + color: var(--grey); +} + +.cu-steps .cu-item [class*="cuIcon-"], +.cu-steps .cu-item .num { + display: block; + font-size: 40rpx; + line-height: 80rpx; +} + +.cu-steps .cu-item::before, +.cu-steps .cu-item::after, +.cu-steps.steps-arrow .cu-item::before, +.cu-steps.steps-arrow .cu-item::after { + content: ""; + display: block; + position: absolute; + height: 0px; + width: calc(100% - 80rpx); + border-bottom: 1px solid #ccc; + left: calc(0px - (100% - 80rpx) / 2); + top: 40rpx; + z-index: 0; +} + +.cu-steps.steps-arrow .cu-item::before, +.cu-steps.steps-arrow .cu-item::after { + content: "\e6a3"; + font-family: "cuIcon"; + height: 30rpx; + border-bottom-width: 0px; + line-height: 30rpx; + top: 0; + bottom: 0; + margin: auto; + color: #ccc; +} + +.cu-steps.steps-bottom .cu-item::before, +.cu-steps.steps-bottom .cu-item::after { + bottom: 40rpx; + top: initial; +} + +.cu-steps .cu-item::after { + border-bottom: 1px solid currentColor; + width: 0px; + transition: all 0.3s ease-in-out 0s; +} + +.cu-steps .cu-item[class*="text-"]::after { + width: calc(100% - 80rpx); + color: currentColor; +} + +.cu-steps .cu-item:first-child::before, +.cu-steps .cu-item:first-child::after { + display: none; +} + +.cu-steps .cu-item .num { + width: 40rpx; + height: 40rpx; + border-radius: 50%; + line-height: 40rpx; + margin: 20rpx auto; + font-size: 24rpx; + border: 1px solid currentColor; + position: relative; + overflow: hidden; +} + +.cu-steps .cu-item[class*="text-"] .num { + background-color: currentColor; +} + +.cu-steps .cu-item .num::before, +.cu-steps .cu-item .num::after { + content: attr(data-index); + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; + transition: all 0.3s ease-in-out 0s; + transform: translateY(0rpx); +} + +.cu-steps .cu-item[class*="text-"] .num::before { + transform: translateY(-40rpx); + color: var(--white); +} + +.cu-steps .cu-item .num::after { + transform: translateY(40rpx); + color: var(--white); + transition: all 0.3s ease-in-out 0s; +} + +.cu-steps .cu-item[class*="text-"] .num::after { + content: "\e645"; + font-family: "cuIcon"; + color: var(--white); + transform: translateY(0rpx); +} + +.cu-steps .cu-item[class*="text-"] .num.err::after { + content: "\e646"; +} + +/* ================== + 布局 + ==================== */ + +/* -- flex弹性布局 -- */ + +.flex { + display: flex; +} + +.basis-xs { + flex-basis: 20%; +} + +.basis-sm { + flex-basis: 40%; +} + +.basis-df { + flex-basis: 50%; +} + +.basis-lg { + flex-basis: 60%; +} + +.basis-xl { + flex-basis: 80%; +} + +.flex-sub { + flex: 1; +} + +.flex-twice { + flex: 2; +} + +.flex-treble { + flex: 3; +} + +.flex-direction { + flex-direction: column; +} + +.flex-wrap { + flex-wrap: wrap; +} + +.flex-nowrap { + flex-wrap: nowrap; +} + +.align-start { + align-items: flex-start; +} + +.align-end { + align-items: flex-end; +} + +.align-center { + align-items: center; +} + +.align-stretch { + align-items: stretch; +} + +.self-start { + align-self: flex-start; +} + +.self-center { + align-self: flex-center; +} + +.selfcenter { + align-self: center; +} + +.self-end { + align-self: flex-end; +} + +.self-stretch { + align-self: stretch; +} + +.align-stretch { + align-items: stretch; +} + +.justify-start { + justify-content: flex-start; +} + +.justify-end { + justify-content: flex-end; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.justify-around { + justify-content: space-around; +} + +/* grid布局 */ + +.grid { + display: flex; + flex-wrap: wrap; +} + +.grid.grid-square { + overflow: hidden; +} + +.grid.grid-square .cu-tag { + position: absolute; + right: 0; + top: 0; + border-bottom-left-radius: 6rpx; + padding: 6rpx 12rpx; + height: auto; + background-color: rgba(0, 0, 0, 0.5); +} + +.grid.grid-square>view>text[class*="cuIcon-"] { + font-size: 52rpx; + position: absolute; + color: var(--grey); + margin: auto; + top: 0; + bottom: 0; + left: 0; + right: 0; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} + +.grid.grid-square>view { + margin-right: 15rpx; + border-radius: 6rpx; + position: relative; + overflow: hidden; +} + +.grid.grid-square>view.bg-img image { + width: 100%; + height: 100%; + position: absolute; +} + +.grid.col-1.grid-square>view { + padding-bottom: 100%; + height: 0; + margin-right: 0; +} + +.grid.col-2.grid-square>view { + padding-bottom: calc((100% - 20rpx)/2); + height: 0; + width: calc((100% - 20rpx)/2); +} + +.grid.col-3.grid-square>view { + padding-bottom: calc((100% - 30rpx)/3); + height: 0; + width: calc((100% - 30rpx)/3); +} + +.grid.col-4.grid-square>view { + padding-bottom: calc((100% - 60rpx)/4); + height: 0; + width: calc((100% - 60rpx)/4); +} + +.grid.col-5.grid-square>view { + padding-bottom: calc((100% - 80rpx)/5); + height: 0; + width: calc((100% - 80rpx)/5); +} + +.grid.col-2.grid-square>view:nth-child(2n), +.grid.col-3.grid-square>view:nth-child(3n), +.grid.col-4.grid-square>view:nth-child(4n), +.grid.col-5.grid-square>view:nth-child(5n) { + margin-right: 0; +} + +.grid.col-1>view { + width: 100%; +} + +.grid.col-2>view { + width: 50%; +} + +.grid.col-3>view { + width: 33.33%; +} + +.grid.col-4>view { + width: 25%; +} + +.grid.col-5>view { + width: 20%; +} + +/* -- 内外边距 -- */ + +.margin-0 { + margin: 0; +} + +.margin-xs { + margin: 10rpx; +} + +.margin-sm { + margin: 20rpx; +} + +.margin { + margin: 30rpx; +} + +.margin-lg { + margin: 40rpx; +} + +.margin-xl { + margin: 50rpx; +} + +.margin-top-ls { + margin-top: 2rpx; +} + +.margin-top-xs { + margin-top: 10rpx; +} + +.margin-top-sm { + margin-top: 20rpx; +} + +.margin-top { + margin-top: 30rpx; +} + +.margin-top-lg { + margin-top: 40rpx; +} + +.margin-top-xl { + margin-top: 50rpx; +} + +.margin-right-xs { + margin-right: 10rpx; +} + +.margin-right-sm { + margin-right: 20rpx; +} + +.margin-right { + margin-right: 30rpx; +} + +.margin-right-lg { + margin-right: 40rpx; +} + +.margin-right-xl { + margin-right: 50rpx; +} + +.margin-bottom-xs { + margin-bottom: 10rpx; +} + +.margin-bottom-sm { + margin-bottom: 20rpx; +} + +.margin-bottom { + margin-bottom: 30rpx; +} + +.margin-bottom-lg { + margin-bottom: 40rpx; +} + +.margin-bottom-xl { + margin-bottom: 50rpx; +} + +.margin-bottom-xxl { + margin-bottom: 80rpx +} + +.margin-bottom-xxxl { + margin-bottom: 130rpx +} + +.margin-left-xs { + margin-left: 10rpx; +} + +.margin-left-sm { + margin-left: 20rpx; +} + +.margin-left { + margin-left: 30rpx; +} + +.margin-left-lg { + margin-left: 40rpx; +} + +.margin-left-xl { + margin-left: 50rpx; +} + +.margin-lr-xs { + margin-left: 10rpx; + margin-right: 10rpx; +} + +.margin-lr-sm { + margin-left: 20rpx; + margin-right: 20rpx; +} + +.margin-lr { + margin-left: 30rpx; + margin-right: 30rpx; +} + +.margin-lr-lg { + margin-left: 40rpx; + margin-right: 40rpx; +} + +.margin-lr-xl { + margin-left: 50rpx; + margin-right: 50rpx; +} + +.margin-tb-xs { + margin-top: 10rpx; + margin-bottom: 10rpx; +} + +.margin-tb-sm { + margin-top: 20rpx; + margin-bottom: 20rpx; +} + +.margin-tb { + margin-top: 30rpx; + margin-bottom: 30rpx; +} + +.margin-tb-lg { + margin-top: 40rpx; + margin-bottom: 40rpx; +} + +.margin-tb-xl { + margin-top: 50rpx; + margin-bottom: 50rpx; +} + +.padding-0 { + padding: 0; +} + +.padding-xs { + padding: 10rpx; +} + +.padding-sm { + padding: 20rpx; +} + +.padding { + padding: 30rpx; +} + +.padding-lg { + padding: 40rpx; +} + +.padding-xl { + padding: 50rpx; +} + +.padding-top-xs { + padding-top: 10rpx; +} + +.padding-top-sm { + padding-top: 20rpx; +} + +.padding-top { + padding-top: 30rpx; +} + +.padding-top-lg { + padding-top: 40rpx; +} + +.padding-top-xl { + padding-top: 50rpx; +} + +.padding-right-xs { + padding-right: 10rpx; +} + +.padding-right-sm { + padding-right: 20rpx; +} + +.padding-right { + padding-right: 30rpx; +} + +.padding-right-lg { + padding-right: 40rpx; +} + +.padding-right-xl { + padding-right: 50rpx; +} + +.padding-bottom-xs { + padding-bottom: 10rpx; +} + +.padding-bottom-sm { + padding-bottom: 20rpx; +} + +.padding-bottom { + padding-bottom: 30rpx; +} + +.padding-bottom-lg { + padding-bottom: 40rpx; +} + +.padding-bottom-xl { + padding-bottom: 50rpx; +} + +.padding-bottom-xxl { + padding-bottom: 80rpx; +} + +.padding-left-xs { + padding-left: 10rpx; +} + +.padding-left-sm { + padding-left: 20rpx; +} + +.padding-left { + padding-left: 30rpx; +} + +.padding-left-lg { + padding-left: 40rpx; +} + +.padding-left-xl { + padding-left: 50rpx; +} + +.padding-lr-xs { + padding-left: 10rpx; + padding-right: 10rpx; +} + +.padding-lr-sm { + padding-left: 20rpx; + padding-right: 20rpx; +} + +.padding-lr { + padding-left: 30rpx; + padding-right: 30rpx; +} + +.padding-lr-lg { + padding-left: 40rpx; + padding-right: 40rpx; +} + +.padding-lr-xl { + padding-left: 50rpx; + padding-right: 50rpx; +} + +.padding-tb-xs { + padding-top: 10rpx; + padding-bottom: 10rpx; +} + +.padding-tb-sm { + padding-top: 20rpx; + padding-bottom: 20rpx; +} + +.padding-tb { + padding-top: 30rpx; + padding-bottom: 30rpx; +} + +.padding-tb-lg { + padding-top: 40rpx; + padding-bottom: 40rpx; +} + +.padding-tb-xl { + padding-top: 50rpx; + padding-bottom: 50rpx; +} + +/* -- 浮动 -- */ + +.cf::after, +.cf::before { + content: " "; + display: table; +} + +.cf::after { + clear: both; +} + +.fl { + float: left; +} + +.fr { + float: right; +} + +/* ================== + 背景 + ==================== */ + +.line-red::after, +.lines-red::after { + border-color: var(--red); +} + +.line-orange::after, +.lines-orange::after { + border-color: var(--orange); +} + +.line-yellow::after, +.lines-yellow::after { + border-color: var(--yellow); +} + +.line-olive::after, +.lines-olive::after { + border-color: var(--olive); +} + +.line-green::after, +.lines-green::after { + border-color: var(--green); +} + +.line-cyan::after, +.lines-cyan::after { + border-color: var(--cyan); +} + +.line-blue::after, +.lines-blue::after { + border-color: var(--blue); +} + +.line-purple::after, +.lines-purple::after { + border-color: var(--purple); +} + +.line-mauve::after, +.lines-mauve::after { + border-color: var(--mauve); +} + +.line-pink::after, +.lines-pink::after { + border-color: var(--pink); +} + +.line-brown::after, +.lines-brown::after { + border-color: var(--brown); +} + +.line-grey::after, +.lines-grey::after { + border-color: var(--grey); +} + +.line-gray::after, +.lines-gray::after { + border-color: var(--gray); +} + +.line-black::after, +.lines-black::after { + border-color: var(--black); +} + +.line-white::after, +.lines-white::after { + border-color: var(--white); +} + +.bg-red { + background-color: var(--red); + color: var(--white); +} + +.bg-yellowlight { + background-color: var(--yellowLight); + color: var(--white); +} + +.line-yellowlight2 { + color: var(--yellowLight); +} + +.bg-orange { + background-color: var(--orange); + color: var(--white); +} + +.bg-yellow { + background-color: var(--yellow); + color: var(--black); +} + +.bg-yellow-light { + color: var(--yellowLight); +} + +.bg-yellow-light-2 { + background-image: var(--gradualYellow2); + color: var(--white); +} + +.bg-yellow-light-1 { + background-color: var(--yellowLight); + color: var(--white); +} + +.bg-yellow-light-3 { + color: var(--yellowLight); +} + +.bg-olive { + background-color: var(--olive); + color: var(--white); +} + +.bg-green { + background-color: var(--green); + color: var(--white); +} + +.bg-cyan { + background-color: var(--cyan); + color: var(--white); +} + +.bg-blue { + background-color: var(--yellowLight); + color: var(--white); +} + +.bg-purple { + background-color: var(--purple); + color: var(--white); +} + +.bg-mauve { + background-color: var(--mauve); + color: var(--white); +} + +.bg-pink { + background-color: var(--pink); + color: var(--white); +} + +.bg-brown { + background-color: var(--brown); + color: var(--white); +} + +.bg-grey { + background-color: var(--grey); + color: var(--white); +} + +.text-color { + color: var(--white); +} + +.bg-gray { + background-color: #f0f0f0; + color: var(--black); +} + +.bg-trgray { + background-color: #f8f8f8; + color: var(--black); +} + +.bg-black { + background-color: var(--black); + color: var(--white); +} + +.bg-black-tr { + color: var(--white); + background: rgba(0, 0, 0, 0.4); +} + +.bg-white { + background-color: var(--white); + color: var(--darkGray); +} + +.bg-shadeTop { + background-image: linear-gradient(rgba(0, 0, 0, 1), rgba(0, 0, 0, 0.01)); + color: var(--white); +} + +.bg-shadeBottom { + background-image: linear-gradient(rgba(0, 0, 0, 0.01), rgba(0, 0, 0, 1)); + color: var(--white); +} + +.bg-red.light { + color: var(--red); + background-color: var(--redLight); +} + +.bg-orange.light { + color: var(--orange); + background-color: var(--orangeLight); +} + +.bg-yellow.light { + color: var(--yellow); + background-color: var(--yellowLight); +} + +.bg-olive.light { + color: var(--olive); + background-color: var(--oliveLight); +} + +.bg-green.light { + color: var(--green); + background-color: var(--greenLight); +} + +.bg-cyan.light { + color: var(--cyan); + background-color: var(--cyanLight); +} + +.bg-blue.light { + color: var(--blue); + background-color: var(--blueLight); +} + +.bg-purple.light { + color: var(--purple); + background-color: var(--purpleLight); +} + +.bg-mauve.light { + color: var(--mauve); + background-color: var(--mauveLight); +} + +.bg-pink.light { + color: var(--pink); + background-color: var(--pinkLight); +} + +.bg-brown.light { + color: var(--brown); + background-color: var(--brownLight); +} + +.bg-grey.light { + color: var(--grey); + background-color: var(--greyLight); +} + +.bg-gradual-red { + background-image: var(--gradualRed); + color: var(--white); +} + +.bg-gradual-orange { + background-image: var(--gradualOrange); + color: var(--white); +} + +.bg-gradual-green { + background-image: var(--gradualGreen); + color: var(--white); +} + +.bg-gradual-purple { + background-image: var(--gradualPurple); + color: var(--white); +} + +.bg-gradual-pink { + background-image: var(--gradualPink); + color: var(--white); +} + +.bg-yellow-yellow { + background-image: var(--gradualYellow); + color: var(--white) +} + +.bg-gradual-blue { + background-image: var(--gradualBlue); + color: var(--white); +} + +.bg-gradual-gray { + background-image: var(--gradualGray); + color: var(--white); +} + +.shadow[class*="-red"] { + box-shadow: var(--ShadowSize) var(--redShadow); +} + +.shadow[class*="-orange"] { + box-shadow: var(--ShadowSize) var(--orangeShadow); +} + +.shadow[class*="-yellow"] { + box-shadow: var(--ShadowSize) var(--yellowShadow); +} + +.shadow[class*="-olive"] { + box-shadow: var(--ShadowSize) var(--oliveShadow); +} + +.shadow[class*="-green"] { + box-shadow: var(--ShadowSize) var(--greenShadow); +} + +.shadow[class*="-cyan"] { + box-shadow: var(--ShadowSize) var(--cyanShadow); +} + +.shadow[class*="-blue"] { + box-shadow: var(--ShadowSize) var(--blueShadow); +} + +.shadow[class*="-purple"] { + box-shadow: var(--ShadowSize) var(--purpleShadow); +} + +.shadow[class*="-mauve"] { + box-shadow: var(--ShadowSize) var(--mauveShadow); +} + +.shadow[class*="-pink"] { + box-shadow: var(--ShadowSize) var(--pinkShadow); +} + +.shadow[class*="-brown"] { + box-shadow: var(--ShadowSize) var(--brownShadow); +} + +.shadow[class*="-grey"] { + box-shadow: var(--ShadowSize) var(--greyShadow); +} + +.shadow[class*="-gray"] { + box-shadow: var(--ShadowSize) var(--grayShadow); +} + +.shadow[class*="-black"] { + box-shadow: var(--ShadowSize) var(--blackShadow); +} + +.shadow[class*="-white"] { + box-shadow: var(--ShadowSize) var(--blackShadow); +} + +.text-shadow[class*="-red"] { + text-shadow: var(--ShadowSize) var(--redShadow); +} + +.text-shadow[class*="-orange"] { + text-shadow: var(--ShadowSize) var(--orangeShadow); +} + +.text-shadow[class*="-yellow"] { + text-shadow: var(--ShadowSize) var(--yellowShadow); +} + +.text-shadow[class*="-olive"] { + text-shadow: var(--ShadowSize) var(--oliveShadow); +} + +.text-shadow[class*="-green"] { + text-shadow: var(--ShadowSize) var(--greenShadow); +} + +.text-shadow[class*="-cyan"] { + text-shadow: var(--ShadowSize) var(--cyanShadow); +} + +.text-shadow[class*="-blue"] { + text-shadow: var(--ShadowSize) var(--blueShadow); +} + +.text-shadow[class*="-purple"] { + text-shadow: var(--ShadowSize) var(--purpleShadow); +} + +.text-shadow[class*="-mauve"] { + text-shadow: var(--ShadowSize) var(--mauveShadow); +} + +.text-shadow[class*="-pink"] { + text-shadow: var(--ShadowSize) var(--pinkShadow); +} + +.text-shadow[class*="-brown"] { + text-shadow: var(--ShadowSize) var(--brownShadow); +} + +.text-shadow[class*="-grey"] { + text-shadow: var(--ShadowSize) var(--greyShadow); +} + +.text-shadow[class*="-gray"] { + text-shadow: var(--ShadowSize) var(--grayShadow); +} + +.text-shadow[class*="-black"] { + text-shadow: var(--ShadowSize) var(--blackShadow); +} + +.bg-img { + background-size: cover; + background-position: center; + background-repeat: no-repeat; + margin-bottom: 15rpx; +} + +.bg-mask { + background-color: var(--black); + position: relative; +} + +.bg-mask::after { + content: ""; + border-radius: inherit; + width: 100%; + height: 100%; + display: block; + background-color: rgba(0, 0, 0, 0.4); + position: absolute; + left: 0; + right: 0; + bottom: 0; + top: 0; +} + +.bg-mask view, +.bg-mask cover-view { + z-index: 5; + position: relative; +} + +.bg-video { + position: relative; +} + +.bg-video video { + display: block; + height: 100%; + width: 100%; + -o-object-fit: cover; + object-fit: cover; + position: absolute; + top: 0; + z-index: 0; + pointer-events: none; +} + +/* ================== + 文本 + ==================== */ + +.text-xs { + font-size: 20rpx; +} + +.text-sm { + font-size: 24rpx; +} + +.text-df { + font-size: 28rpx; +} + +.text-lg { + font-size: 32rpx; +} + +.text-xl { + font-size: 36rpx; +} + +.text-xxl { + font-size: 44rpx; +} + +.text-sl { + font-size: 80rpx; +} + +.text-xsl { + font-size: 120rpx; +} + +.text-Abc { + text-transform: Capitalize; +} + +.text-ABC { + text-transform: Uppercase; +} + +.text-abc { + text-transform: Lowercase; +} + +.text-price::before { + content: "¥"; + font-size: 80%; + margin-right: 4rpx; +} + +.text-cut { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.text-cut-width { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: 370rpx; +} + +.text-bold { + font-weight: bold; +} + +.text-center { + text-align: center; +} + +.text-content { + line-height: 1.6; +} + +.text-left { + text-align: left; +} + +.text-right { + text-align: right; +} + +.text-red, +.line-red, +.lines-red { + color: var(--red); +} + +.text-orange, +.line-orange, +.lines-orange { + color: var(--orange); +} + +.text-yellow, +.line-yellow, +.lines-yellow { + color: var(--yellow); +} + +.text-olive, +.line-olive, +.lines-olive { + color: var(--olive); +} + +.text-green, +.line-green, +.lines-green { + color: var(--green); +} + +.text-cyan, +.line-cyan, +.lines-cyan { + color: var(--cyan); +} + +.text-blue, +.line-blue, +.lines-blue { + color: var(--blue); +} + +.text-purple, +.line-purple, +.lines-purple { + color: var(--purple); +} + +.text-mauve, +.line-mauve, +.lines-mauve { + color: var(--mauve); +} + +.text-pink, +.line-pink, +.lines-pink { + color: var(--pink); +} + +.text-brown, +.line-brown, +.lines-brown { + color: var(--brown); +} + +.text-grey, +.line-grey, +.lines-grey { + color: var(--grey); +} + +.text-gray, +.line-gray, +.lines-gray { + color: var(--gray); +} + +.text-gray2 { + color: #333333; +} + +.text-black, +.line-black, +.lines-black { + color: var(--black); +} + +.line-depblack, +.lines-depblack, +l .text-depblack { + color: var(--depBlack) +} + +.text-white, +.line-white, +.lines-white { + color: var(--white); +} + +/* 自定义 */ +.tab { + position: fixed; + display: flex; + left: 0; + right: 0; + background: #fff; + flex-direction: column; + z-index: 100; + width: 100%; +} + +.tab-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; +} + +.options-box { + display: flex; + flex-direction: column; + justify-content: flex-start; + width: 100%; + flex-wrap: wrap; + padding: 15rpx; + box-shadow: 0rpx 2rpx 2rpx rgba(4, 0, 0, .2); +} + +.options-box .item { + font-size: 28rpx; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + min-width: 20%; + border-radius: 20rpx; + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.options-box .item:nth-child(1) { + padding: 0rpx 0rpx 7.5rpx 0rpx; +} + +.loading-box { + width: 100%; + display: flex; + justify-content: center; +} + +.play-box { + display: flex; + margin-left: 20rpx; + flex-direction: column; + width: 80%; + background-color: white; + border-radius: 15rpx; + align-items: center; + justify-content: center; + padding: 10rpx 0rpx; +} + +.play-box-shadow { + display: flex; + flex-direction: column; + width: 80%; + background-color: white; + border-radius: 15rpx; + align-items: center; + justify-content: center; + padding: 15rpx; + position: relative; + margin-bottom: 15rpx; + box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.2), 0 6rpx 20rpx 0 rgba(0, 0, 0, 0.19); +} + +.play-box-shadow-little { + display: flex; + flex-direction: column; + width: 100%; + background-color: white; + border-radius: 15rpx; + align-items: center; + justify-content: center; + padding: 15rpx; + position: relative; + margin-bottom: 15rpx; + box-shadow: 0 0 4rpx 0 rgba(0, 0, 0, 0.2), 0 0 10rpx 0 rgba(0, 0, 0, 0.04); +} + +.page-box { + width: 100%; + padding: 15rpx; + background: #F7F7F7; + /* background: #64faff; */ + display: flex; + flex-direction: column; + align-items: center; +} + +.play-box-arrow-flex { + width: 100%; + display: flex; + position: absolute; + justify-content: center; + align-items: center; +} + +.play-box-arrow-pos { + top: 40rpx; + left: 40rpx; + position: absolute; + width: 100%; + height: 100%; +} + +.shadow-box { + width: 100%; + border-radius: 10rpx; + border: 1rpx solid #f9f9f9; +} + +.border-blue-radius { + border-radius: 20rpx; + border: 1rpx solid #0054bd; + color: #0054bd; +} + +.border-blue-radius:active { + border-radius: 20rpx; + border: 1rpx solid #9b9c9c; + color: #000000; +} + +/* box-shadow: 10px 10px 5px #cacaca; 阴影 */ +.play-box image { + width: 60rpx; + height: 60rpx; +} + +.play-box image:active { + background-color: rgb(204, 202, 202); + border-radius: 50%; +} + +.play-box-shadow image { + width: 60rpx; + height: 60rpx; +} + +.play-box-shadow image:active { + background-color: rgb(204, 202, 202); + border-radius: 50%; +} + +.play-box-shadow-little image { + width: 60rpx; + height: 60rpx; +} + +.play-box-shadow-little image:active { + background-color: rgb(204, 202, 202); + border-radius: 50%; +} + +.text-left input { + text-align: right; +} + +.text-length-hint-right { + width: 100%; + text-align: right; + padding-right: 20rpx; + font-size: 32rpx; + margin-top: 10rpx; +} + +.line-gray-sm { + background-color: var(--gray); + height: 10rpx; +} + +.line-gray-ssm { + background-color: rgb(243, 243, 243); + height: 2rpx; + width: 95%; + align-self: center; +} + +.line-gray-xs { + background-color: var(--gray); + height: 20rpx; +} + +.line-gray-lg { + background-color: var(--gray); + height: 30rpx; +} + +.line-gray-xl { + background-color: var(--gray); + height: 40rpx; +} + +.hint-title { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + height: 90rpx; + font-size: 32rpx; + color: black; +} + +.hint-title image { + width: 48rpx; + height: 48rpx; +} + +.hint-title text { + position: relative; + top: 1px; + left: -30rpx +} + +/* pages/mine/shop/mineshop.wxss */ +.cardTitle { + color: #fff; + padding: 20rpx 40rpx; + font-size: 80rpx; + font-weight: 300; + background-color: #ffffff; + position: relative; + text-align: center; + text-shadow: 0px 0px 6rpx rgba(0, 0, 0, 0.3); + border: 1px dashed gray; +} + +.border-bottom-sm { + border-bottom-color: #eeeeee; + border-bottom-width: 1rpx; + border-bottom-style: solid; +} + +.card-title-sm { + color: #fff; + margin: 10rpx; + padding: 0rpx 20rpx; + font-size: 60rpx; + font-weight: 300; + background-color: #ffffff; + position: relative; + text-align: center; + border: 1px dashed gray; +} + +.cardTitle::before { + position: absolute; + width: 60rpx; + height: 6rpx; + border-radius: 20rpx; + display: block; + transform: skew(10deg, 0deg); +} + +.cardTitle::after { + position: absolute; + width: 140rpx; + border-radius: 6rpx; + height: 24rpx; + display: block; + bottom: 76rpx; + left: 90rpx; + opacity: 0.1; +} + +@font-face { + font-family: 'iconfont'; + src: url('data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAL0AA0AAAAABuAAAAKeAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GVgCCQhEICoFIgUsLCgABNgIkAxAEIAWFCAc7G/EFyI7CtuUTYyoihNONcXgQEVRrZM/uPqJC9R9w0UQSwQIK9+ACqNiRAwSbikMy4vzv/ctzs6kgViBK4/2V3m7glqriKpOmpCuok+pM3Exrgwaysdw21XlCXbQtisOAogDTae0fEzfw24P9u77x786VNuXwyeFSiMvjICscjo1CwPvVkXr4sLDtwZ6b0IxekIQsCwUJUcQRNaS96QAchtfHf5FRT1KTWceSTTktSP/lghbRRDVhgwNchgBkZPQhMJ1IoI+pIVAUwS+X/wqWuL6AgKglAJFAuJ+HoJ43qgoJFFCPwHywCkABQMzvbGi83DBxfd/dKasq55m43zjwNvpPRXXJ6ut9d6P/0ermpr0rb93/ZnJpVf9JXfisafAKE91rytdv4eEfTJyfNueJmqipKfDaOeU29Orq7Twm1WjvFnrp7ayKsR51Tkn9eqdWhr2Fet0UeZpk8UsLg0KCNkPLBMKpx9qLE/bq7Gff8/Xv787eyuRLAAJBx5fpxfXWyX/1TcWgdquqJvJaVgHqJRAM199QAPmcAACUAigorEMo5iOQ0KgRFYBOtyBAj2AEQr0VCCR1diKQ1dstQFHvtAA1mjwDgVr1voJAo6kxFwSadMVRWZQGTIFAhnaZZNJqI5m1M4AFHSNr9Fona7U7Jhut8lzeZDh2wcw8Okwj7tgtfDRpF0o1U1MRcjgzGt/m4voS5dXjkWUg3g4sw4gZKDTSgTha1PToRrgKo6MnDfuIECoczqr0EaHhpeCibBVG1+cmekZikThO4EOgo6bkI7fGJxgFBTUfGjpqMkwzLhSu8na9URzJuXCIif+nIiNShXrfB2zBcRqJwoQRGodDNVNTAlPWhWJx02hTLYlGqikIKVJ7o54zXmOGRIRsMAAA') format('woff2'), + url('data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAS0AA0AAAAABuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAEmAAAABoAAAAcjuL8y0dERUYAAAR4AAAAHgAAAB4AKQAKT1MvMgAAAaAAAABCAAAAVjyGSApjbWFwAAAB9AAAAD4AAAFCAA/pw2dhc3AAAARwAAAACAAAAAj//wADZ2x5ZgAAAkAAAAC3AAAAyKXtiRxoZWFkAAABMAAAADAAAAA2HF0Zv2hoZWEAAAFgAAAAHQAAACQHgwOFaG10eAAAAeQAAAAPAAAAEAwAAFpsb2NhAAACNAAAAAoAAAAKAGQAAG1heHAAAAGAAAAAHwAAACABDwBQbmFtZQAAAvgAAAFJAAACiCnmEVVwb3N0AAAERAAAACkAAAA7epyHrHjaY2BkYGAAYsUHE+Lj+W2+MnCzMIDAnflZD+F01P9JzEuZ84BcDgYmkCgATbQMO3jaY2BkYGBu+N/AEMPCAALMSxkYGVABCwBTNQMRAAAAeNpjYGRgYGBhcGEA0QwMTEDMBYQMDP/BfAYAD3EBYAB42mNgZGFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDA7PJJ5JMDf8b2CIYW5gaAAKM4LkAN59DAsAAHjaY2GAABYIjgIAANoAZwB42mNgYGBmgGAZBkYGELAB8hjBfBYGBSDNAoRA/jOJ//8hpORrqEoGRjYGGJOBkQlIMDGgAkaGYQ8AVqkHuAAAAAAAAAAAAAAAZAAAeNodirENwjAURP2xFGjASA75EhK2FJBT+VsC4jRACkpKOlr3DMMODJIdsgE9BQMYHHTFPd07Buz2ffAnv7MzYzAFBYs8K40DWawgz9alqfe+luMZ/KmxQJB6W2jg+2HZbYfjmDcnSJhnfBMjjIIiIvX2E9LYTE4fbJyjK/AY/cWSx79xOhntUFcKXiEYi0eB2McO5ZKMroVCaPu5UpQSQlFZY5KHttBC+SOWUsSu14IO5gdbfykbAHjafZA9TgMxEIWf8wckEkIgqF1RANr8lCkTKfQIpaNINt6QaNdeeZ1IOQEtFQeg5RgcgBsg0XIKXpZJkyJr7ejzm5nnsQGc4xsK/98l7oQVjvEoXMERMuEq9RfhGvlduI4WPoUb1H+Em7hVA+EWLtQbHVTthLub0m3LCmcYCFdwiifhKvWVcI38KlzHFT6EG9S/hJsY41e4hWtlqQzhYTBBYJxBY4oN4wIxHCySMgbWoTn0ZhLMTE83ehE7mzgbKO9XYpcDHmg554Ap7T23Zr5KJ/5gy4HUmG4eBUu2KY0uInQoG18snNXdqHOw/Z7ttrTYv2uBNcfsUQ1s1Pw92zPSSGwMr5CSNfIyt6QSU49oa6zxu2cp1vNeCIlOvMv0iMeaNHU6925p4sDi5/KMHH20uZI996gcPmNZCHm/3U7EIIpdhj+T2HEZAAAAeNpjYGKAAC4wyciADljAokyMTAKJxSWpRZnF2cW6hrrJ+QWVADoqBkcAAAAAAAAB//8AAgABAAAADAAAABYAAAACAAEAAwADAAEABAAAAAIAAAAAeNpjYGBgZACCq0vUOUD0nflZD2E0AER/BzYAAA==') format('woff'), + url('iconfont.ttf') format('truetype'); + font-weight: normal; + font-style: normal; + font-display: swap; +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 12rpx; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-star-red:before { + content: "\e618"; + color: red; +} \ No newline at end of file diff --git a/components/cartfoot/customcart.js b/components/cartfoot/customcart.js new file mode 100755 index 0000000..1d6ccc7 --- /dev/null +++ b/components/cartfoot/customcart.js @@ -0,0 +1,228 @@ +const app = getApp(); +Component({ + options: { + addGlobalClass: true, + multipleSlots: true + }, + lifetimes: { + attached() { + let shopCartData = app.globalData.shopCart + var amount = 0 + if (shopCartData.length > 0) { + shopCartData.forEach(it => { + if (it.shopId == this.properties.shopId) { + this.data.shopCart = this.data.shopCart.concat(it) + amount += it.buyNum + } + }) + } + this.setData({ + shopId: this.properties.shopId, + shopCart: this.data.shopCart, + buyAmount: amount + }) + } + }, + /** + * 组件的对外属性 + */ + properties: { + shopCart: { + type: Array, + default: [] + }, + goods: { + type: Object, + default: null + }, + shopId: { + type: String, + default: '', + }, + showBtn: { + type: Boolean, + default: true + } + }, + /** + * 组件的初始数据 + */ + data: { + shopCart: [], + show: false, + buyAmount: 0 + }, + /** + * 组件的方法列表 + */ + methods: { + //添加商品 + addCart(event) { + var _self = this + let goods = event.currentTarget.dataset.goods + goods.buyNum = 0 + if (goods != null) { + //判断是否存在 + var isExist = false + for (var i = 0; i < _self.data.shopCart.length; ++i) { + var it = _self.data.shopCart[i] + if (it.goodsId == goods.goodsId) { + //判断是否超出库存 + if (it.buyNum < goods.goodsTotal) { + it.buyNum += 1 + } else { + wx.showToast({ + title: '超出库存范围', + icon: 'error' + }) + } + isExist = true + break; + } + } + if (!isExist) { + //不存在 + goods.buyNum = 1 + _self.data.shopCart = _self.data.shopCart.concat(goods) + } + let amount = 0 + _self.data.shopCart.forEach(it => { + amount += it.buyNum + }) + _self.setData({ + shopCart: _self.data.shopCart, + buyAmount: amount + }) + app.globalData.shopCart = _self.data.shopCart + this.triggerEvent('refreshShopCart') + } + }, + //显示购物车列表 + showCart() { + let cart = { + shopId: this.data.shopId, + shopCart: this.data.shopCart + } + this.triggerEvent('showcart', cart) + }, + //立即订购 + nowOrder(event) { + if (this.data.shopCart.length > 0) { + wx.navigateTo({ + url: '/pages/shop/product/affirmorder?shopId=' + this.data.shopId, + }) + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + onClose() { + this.setData({ + show: false + }) + }, + //外部添加商品 + listAddToCart(goods) { + let _self = this + goods.buyNum = 0 + if (goods != null) { + //判断是否存在 + var isExist = false + for (var i = 0; i < _self.data.shopCart.length; ++i) { + var it = _self.data.shopCart[i] + if (it.goodsId == goods.goodsId) { + //判断是否超出库存 + if (it.buyNum < goods.goodsTotal) { + it.buyNum += 1 + } else { + wx.showToast({ + title: '超出库存范围', + icon: 'error' + }) + } + isExist = true + break; + } + } + if (!isExist) { + //不存在 + goods.buyNum = 1 + _self.data.shopCart = _self.data.shopCart.concat(goods) + } + let amount = 0 + _self.data.shopCart.forEach(it => { + amount += it.buyNum + }) + _self.setData({ + shopCart: _self.data.shopCart, + buyAmount: amount + }) + app.globalData.shopCart = _self.data.shopCart + } + }, + //移除商品 + listRemoveCart(goods) { + let _self = this + goods.buyNum = 0 + if (goods != null) { + //判断是否存在 + var isExist = false + for (var i = 0; i < _self.data.shopCart.length; ++i) { + var it = _self.data.shopCart[i] + if (it.goodsId == goods.goodsId) { + //判断是否超出库存 + if (it.buyNum < goods.goodsTotal) { + it.buyNum -= 1 + } else { + wx.showToast({ + title: '超出库存范围', + icon: 'error' + }) + } + isExist = true + break; + } + } + let amount = 0 + _self.data.shopCart.forEach(it => { + amount += it.buyNum + }) + _self.setData({ + shopCart: _self.data.shopCart, + buyAmount: amount + }) + if (amount == 0) { + app.globalData.shopCart = [] + _self.setData({ + shopCart: [] + }) + } else { + app.globalData.shopCart = _self.data.shopCart + } + } + }, + //刷新 + refreshCart() { + let shopCartData = app.globalData.shopCart + this.setData({ + shopCart: [] + }) + var amount = 0 + if (shopCartData.length > 0) { + shopCartData.forEach(it => { + if (it.shopId == this.properties.shopId) { + this.data.shopCart = this.data.shopCart.concat(it) + amount += it.buyNum + } + }) + } + this.setData({ + shopId: this.properties.shopId, + shopCart: this.data.shopCart, + buyAmount: amount + }) + } + } +}) \ No newline at end of file diff --git a/components/cartfoot/customcart.json b/components/cartfoot/customcart.json new file mode 100755 index 0000000..e8cfaaf --- /dev/null +++ b/components/cartfoot/customcart.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/cartfoot/customcart.wxml b/components/cartfoot/customcart.wxml new file mode 100755 index 0000000..c19fb5a --- /dev/null +++ b/components/cartfoot/customcart.wxml @@ -0,0 +1,17 @@ + + + + + 收藏 + + + + {{buyAmount}} + + 购物车 + + 加入购物车 + + + 立即购买 + \ No newline at end of file diff --git a/components/cartfoot/customcart.wxss b/components/cartfoot/customcart.wxss new file mode 100755 index 0000000..8242ee1 --- /dev/null +++ b/components/cartfoot/customcart.wxss @@ -0,0 +1 @@ +/* components/cartfoot/cuscart.wxss */ \ No newline at end of file diff --git a/components/cuicustom/cu-custom.js b/components/cuicustom/cu-custom.js new file mode 100755 index 0000000..ad2e20a --- /dev/null +++ b/components/cuicustom/cu-custom.js @@ -0,0 +1,92 @@ +const app = getApp(); +Component({ + /** + * 组件的一些选项 + */ + options: { + addGlobalClass: true, + multipleSlots: true + }, + /** + * 组件的对外属性 + */ + properties: { + bgColor: { + type: String, + default: '1' + }, + isWhite: { + type: [Boolean, String], + default: false + }, + isCustom: { + type: [Boolean, String], + default: false + }, + isIndex: { + type: [Boolean, String], + default: false + }, + isBack: { + type: [Boolean, String], + default: false + }, + isRelaunch: { + type: [Boolean, String], + default: false + }, + isClickTitle: { + type: [Boolean, String], + default: false + }, + bgImage: { + type: String, + default: '' + }, + }, + /** + * 组件的初始数据 + */ + data: { + StatusBar: app.globalData.StatusBar, + CustomBar: app.globalData.CustomBar, + Custom: app.globalData.Custom, + userIcon: wx.getStorageSync('userIcon') || '/images/ic_user_default.png' + }, + /** + * 组件的方法列表 + */ + methods: { + BackPage() { + wx.navigateBack({ + delta: 1 + }); + }, + GoHome() { + wx.navigateBack({ + delta: 1, + }) + }, + toHome() { + wx.reLaunch({ + url: '/pages/index/index', + }) + }, + goCenter() { + wx.switchTab({ + url: '/pages/mine/index/index', + }) + }, + //刷新 + refreshCart() { + let icon = app.globalData.userIcon + this.setData({ + userIcon: icon + }) + }, + // 点击标题 + showIcre() { + this.triggerEvent('show', {}, {}) + } + } +}) \ No newline at end of file diff --git a/components/cuicustom/cu-custom.json b/components/cuicustom/cu-custom.json new file mode 100755 index 0000000..e8cfaaf --- /dev/null +++ b/components/cuicustom/cu-custom.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/cuicustom/cu-custom.wxml b/components/cuicustom/cu-custom.wxml new file mode 100755 index 0000000..27e0170 --- /dev/null +++ b/components/cuicustom/cu-custom.wxml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + 个人中心 + + + + \ No newline at end of file diff --git a/components/cuicustom/cu-custom.wxss b/components/cuicustom/cu-custom.wxss new file mode 100755 index 0000000..2bea59b --- /dev/null +++ b/components/cuicustom/cu-custom.wxss @@ -0,0 +1,38 @@ +/* colorui/components/cu-custom.wxss */ +.center { + padding: 5px 10rpx; + border-radius: 60rpx; + border: 1px solid #dddddd; + width: 180rpx; + height: 65rpx; + box-sizing: border-box; + line-height: 65rpx; + display: flex; + justify-content: space-between; + align-items: center; + margin-left: 20rpx; +} + +.center image { + width: 45rpx; + height: 100%; + border-radius: 50%; + vertical-align: top; +} + +.title-bar-bg { + background-color: #E6B980; + /* background-color: #ffffff; */ + color: #fff; + /* color: #000000; */ +} + +.title-bar-bg-white { + background-color: #ffffff; + color: #000000; +} + +.title-bar-bg-dark { + background-color: #000000; + color: #ffffff; +} \ No newline at end of file diff --git a/components/loadmore/index.js b/components/loadmore/index.js new file mode 100755 index 0000000..f7dc2e7 --- /dev/null +++ b/components/loadmore/index.js @@ -0,0 +1,35 @@ +Component({ + properties: { + mtype:{ + type:Number, + value:1, + observer: function (newVal, oldVal) { + this.setData({ + mtype: newVal + }) + } + }, + nodata_str:{ + type:String, + value:'暂无数据', + observer: function (newVal, oldVal) { + this.setData({ + nodata_str: newVal + }) + } + }, + hidden:{ + type:Boolean, + value:true, + observer: function (newVal, oldVal) { + this.setData({ + hidden: newVal + }) + } + }, + tipcolor:{ + type:String, + value:"#f9f9f9" + } + } +}) \ No newline at end of file diff --git a/components/loadmore/index.json b/components/loadmore/index.json new file mode 100755 index 0000000..32640e0 --- /dev/null +++ b/components/loadmore/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/loadmore/index.wxml b/components/loadmore/index.wxml new file mode 100755 index 0000000..54e506c --- /dev/null +++ b/components/loadmore/index.wxml @@ -0,0 +1,21 @@ + + + + + + + + + + + + diff --git a/components/loadmore/index.wxss b/components/loadmore/index.wxss new file mode 100755 index 0000000..3925aa7 --- /dev/null +++ b/components/loadmore/index.wxss @@ -0,0 +1,57 @@ +.zan-loadmore{ + position:relative; + width:65%; + margin:0 auto; + line-height:20px; + font-size:14px; + text-align:center; + display: block; + vertical-align: middle +} +.zan-loading{ + width:20px; + height:20px; + display:inline-block; + vertical-align:middle; + animation:weuiLoading 1s steps(12,end) infinite; +} +.zan-loadmore .zan-loading{ + margin-right:4px +} +.zan-loadmore__tips{ + display:inline-block; + vertical-align:middle; + height:20px; + line-height:20px; + color:#999 +} +.zan-loadmore--nodata,.zan-loadmore--nomore{ + border-top:1rpx solid #e5e5e5; +} +.zan-loadmore--nodata{ + margin-top:20rpx +} +.zan-loadmore--nodata .zan-loadmore__tips{ + position:relative; + top:-11px; + padding:0 6px +} +.zan-loadmore--nomore .zan-loadmore__tips{ + position:relative; + top:-11px; + padding:0 6px +} +.zan-loadmore__dot{ + position:absolute; + left:50%; + top:10px; + margin-left:-2px; + margin-top:-2px; + content:" "; + width:4px; + height:4px; + border-radius:50%; + background-color:#e5e5e5; + display:inline-block; + vertical-align:middle; +} \ No newline at end of file diff --git a/images/code-icon.png b/images/code-icon.png new file mode 100755 index 0000000..151b96c Binary files /dev/null and b/images/code-icon.png differ diff --git a/images/contact-icon.png b/images/contact-icon.png new file mode 100755 index 0000000..28ad37d Binary files /dev/null and b/images/contact-icon.png differ diff --git a/images/create-btn.png b/images/create-btn.png new file mode 100755 index 0000000..6731b0d Binary files /dev/null and b/images/create-btn.png differ diff --git a/images/htm.png b/images/htm.png new file mode 100755 index 0000000..d977745 Binary files /dev/null and b/images/htm.png differ diff --git a/images/ic_address_icon.png b/images/ic_address_icon.png new file mode 100755 index 0000000..7c2d2af Binary files /dev/null and b/images/ic_address_icon.png differ diff --git a/images/ic_arrow_cir.png b/images/ic_arrow_cir.png new file mode 100755 index 0000000..dc97612 Binary files /dev/null and b/images/ic_arrow_cir.png differ diff --git a/images/ic_arrow_down.png b/images/ic_arrow_down.png new file mode 100755 index 0000000..82937f3 Binary files /dev/null and b/images/ic_arrow_down.png differ diff --git a/images/ic_arrow_right.png b/images/ic_arrow_right.png new file mode 100755 index 0000000..e78c4ae Binary files /dev/null and b/images/ic_arrow_right.png differ diff --git a/images/ic_arrow_up.png b/images/ic_arrow_up.png new file mode 100755 index 0000000..a4dfcf3 Binary files /dev/null and b/images/ic_arrow_up.png differ diff --git a/images/ic_audio_play.png b/images/ic_audio_play.png new file mode 100755 index 0000000..d296040 Binary files /dev/null and b/images/ic_audio_play.png differ diff --git a/images/ic_audio_playing.png b/images/ic_audio_playing.png new file mode 100755 index 0000000..c67cf01 Binary files /dev/null and b/images/ic_audio_playing.png differ diff --git a/images/ic_audio_rewind.png b/images/ic_audio_rewind.png new file mode 100755 index 0000000..b8fb0f5 Binary files /dev/null and b/images/ic_audio_rewind.png differ diff --git a/images/ic_audio_speed.png b/images/ic_audio_speed.png new file mode 100755 index 0000000..e480941 Binary files /dev/null and b/images/ic_audio_speed.png differ diff --git a/images/ic_auth.png b/images/ic_auth.png new file mode 100755 index 0000000..a283a05 Binary files /dev/null and b/images/ic_auth.png differ diff --git a/images/ic_call_phone_icon.png b/images/ic_call_phone_icon.png new file mode 100755 index 0000000..c3c8e2f Binary files /dev/null and b/images/ic_call_phone_icon.png differ diff --git a/images/ic_card_normal.png b/images/ic_card_normal.png new file mode 100755 index 0000000..7e95937 Binary files /dev/null and b/images/ic_card_normal.png differ diff --git a/images/ic_card_sel.png b/images/ic_card_sel.png new file mode 100755 index 0000000..6540429 Binary files /dev/null and b/images/ic_card_sel.png differ diff --git a/images/ic_cash.png b/images/ic_cash.png new file mode 100755 index 0000000..b8a3e2d Binary files /dev/null and b/images/ic_cash.png differ diff --git a/images/ic_code_icon.png b/images/ic_code_icon.png new file mode 100755 index 0000000..ccfb678 Binary files /dev/null and b/images/ic_code_icon.png differ diff --git a/images/ic_collect_icon.png b/images/ic_collect_icon.png new file mode 100755 index 0000000..0bdff9b Binary files /dev/null and b/images/ic_collect_icon.png differ diff --git a/images/ic_column_icon.png b/images/ic_column_icon.png new file mode 100755 index 0000000..d0a4bfe Binary files /dev/null and b/images/ic_column_icon.png differ diff --git a/images/ic_comment_icon.png b/images/ic_comment_icon.png new file mode 100755 index 0000000..6960eaa Binary files /dev/null and b/images/ic_comment_icon.png differ diff --git a/images/ic_corner_mark_bg.png b/images/ic_corner_mark_bg.png new file mode 100755 index 0000000..fdcbb7f Binary files /dev/null and b/images/ic_corner_mark_bg.png differ diff --git a/images/ic_email_icon.png b/images/ic_email_icon.png new file mode 100755 index 0000000..661ffab Binary files /dev/null and b/images/ic_email_icon.png differ diff --git a/images/ic_empty_data.png b/images/ic_empty_data.png new file mode 100755 index 0000000..ec1e560 Binary files /dev/null and b/images/ic_empty_data.png differ diff --git a/images/ic_empty_desc.png b/images/ic_empty_desc.png new file mode 100755 index 0000000..66824c8 Binary files /dev/null and b/images/ic_empty_desc.png differ diff --git a/images/ic_empty_map.png b/images/ic_empty_map.png new file mode 100755 index 0000000..f1b9542 Binary files /dev/null and b/images/ic_empty_map.png differ diff --git a/images/ic_empty_text.png b/images/ic_empty_text.png new file mode 100755 index 0000000..79e9d00 Binary files /dev/null and b/images/ic_empty_text.png differ diff --git a/images/ic_empty_voice.png b/images/ic_empty_voice.png new file mode 100755 index 0000000..e9dac8f Binary files /dev/null and b/images/ic_empty_voice.png differ diff --git a/images/ic_favour.png b/images/ic_favour.png new file mode 100755 index 0000000..c066e8e Binary files /dev/null and b/images/ic_favour.png differ diff --git a/images/ic_goods_catalog.png b/images/ic_goods_catalog.png new file mode 100755 index 0000000..b8275eb Binary files /dev/null and b/images/ic_goods_catalog.png differ diff --git a/images/ic_goods_list_icon.png b/images/ic_goods_list_icon.png new file mode 100755 index 0000000..5031f9b Binary files /dev/null and b/images/ic_goods_list_icon.png differ diff --git a/images/ic_hot_number_bg.png b/images/ic_hot_number_bg.png new file mode 100755 index 0000000..727d265 Binary files /dev/null and b/images/ic_hot_number_bg.png differ diff --git a/images/ic_information_icon.png b/images/ic_information_icon.png new file mode 100755 index 0000000..0402e9b Binary files /dev/null and b/images/ic_information_icon.png differ diff --git a/images/ic_member_list_icon.png b/images/ic_member_list_icon.png new file mode 100755 index 0000000..58e3144 Binary files /dev/null and b/images/ic_member_list_icon.png differ diff --git a/images/ic_member_qrcode.png b/images/ic_member_qrcode.png new file mode 100755 index 0000000..72f5f0b Binary files /dev/null and b/images/ic_member_qrcode.png differ diff --git a/images/ic_mine_normal.png b/images/ic_mine_normal.png new file mode 100755 index 0000000..98647dd Binary files /dev/null and b/images/ic_mine_normal.png differ diff --git a/images/ic_mine_sel.png b/images/ic_mine_sel.png new file mode 100755 index 0000000..dafb1fa Binary files /dev/null and b/images/ic_mine_sel.png differ diff --git a/images/ic_mine_title_bg.png b/images/ic_mine_title_bg.png new file mode 100755 index 0000000..4c76db6 Binary files /dev/null and b/images/ic_mine_title_bg.png differ diff --git a/images/ic_order_all.png b/images/ic_order_all.png new file mode 100755 index 0000000..eb8d1d6 Binary files /dev/null and b/images/ic_order_all.png differ diff --git a/images/ic_order_close.png b/images/ic_order_close.png new file mode 100755 index 0000000..b6f5ddf Binary files /dev/null and b/images/ic_order_close.png differ diff --git a/images/ic_order_finish.png b/images/ic_order_finish.png new file mode 100755 index 0000000..ddcd25e Binary files /dev/null and b/images/ic_order_finish.png differ diff --git a/images/ic_order_pay.png b/images/ic_order_pay.png new file mode 100755 index 0000000..24645bc Binary files /dev/null and b/images/ic_order_pay.png differ diff --git a/images/ic_order_wait_pay.png b/images/ic_order_wait_pay.png new file mode 100755 index 0000000..4311b68 Binary files /dev/null and b/images/ic_order_wait_pay.png differ diff --git a/images/ic_pause_icon.png b/images/ic_pause_icon.png new file mode 100755 index 0000000..ed5eb02 Binary files /dev/null and b/images/ic_pause_icon.png differ diff --git a/images/ic_pay_order_icon.png b/images/ic_pay_order_icon.png new file mode 100755 index 0000000..3928712 Binary files /dev/null and b/images/ic_pay_order_icon.png differ diff --git a/images/ic_phone_icon.png b/images/ic_phone_icon.png new file mode 100755 index 0000000..097f601 Binary files /dev/null and b/images/ic_phone_icon.png differ diff --git a/images/ic_play_icon.png b/images/ic_play_icon.png new file mode 100755 index 0000000..2830b59 Binary files /dev/null and b/images/ic_play_icon.png differ diff --git a/images/ic_position_icon.png b/images/ic_position_icon.png new file mode 100755 index 0000000..9cc8fe6 Binary files /dev/null and b/images/ic_position_icon.png differ diff --git a/images/ic_poster_icon.png b/images/ic_poster_icon.png new file mode 100755 index 0000000..f8eeb18 Binary files /dev/null and b/images/ic_poster_icon.png differ diff --git a/images/ic_purse.png b/images/ic_purse.png new file mode 100755 index 0000000..7d66338 Binary files /dev/null and b/images/ic_purse.png differ diff --git a/images/ic_record_start copy.png b/images/ic_record_start copy.png new file mode 100755 index 0000000..a13d65f Binary files /dev/null and b/images/ic_record_start copy.png differ diff --git a/images/ic_record_start.png b/images/ic_record_start.png new file mode 100755 index 0000000..a13d65f Binary files /dev/null and b/images/ic_record_start.png differ diff --git a/images/ic_recycle_icon.png b/images/ic_recycle_icon.png new file mode 100755 index 0000000..03ab945 Binary files /dev/null and b/images/ic_recycle_icon.png differ diff --git a/images/ic_scan_icon.png b/images/ic_scan_icon.png new file mode 100755 index 0000000..77f9f34 Binary files /dev/null and b/images/ic_scan_icon.png differ diff --git a/images/ic_serve_normal.png b/images/ic_serve_normal.png new file mode 100755 index 0000000..740e69e Binary files /dev/null and b/images/ic_serve_normal.png differ diff --git a/images/ic_serve_sel.png b/images/ic_serve_sel.png new file mode 100755 index 0000000..e81f714 Binary files /dev/null and b/images/ic_serve_sel.png differ diff --git a/images/ic_setting.png b/images/ic_setting.png new file mode 100755 index 0000000..fae0a4d Binary files /dev/null and b/images/ic_setting.png differ diff --git a/images/ic_share_cir_icon.png b/images/ic_share_cir_icon.png new file mode 100755 index 0000000..902c50d Binary files /dev/null and b/images/ic_share_cir_icon.png differ diff --git a/images/ic_share_icon.png b/images/ic_share_icon.png new file mode 100755 index 0000000..2990e53 Binary files /dev/null and b/images/ic_share_icon.png differ diff --git a/images/ic_share_img.png b/images/ic_share_img.png new file mode 100755 index 0000000..3bc772b Binary files /dev/null and b/images/ic_share_img.png differ diff --git a/images/ic_share_moment.png b/images/ic_share_moment.png new file mode 100755 index 0000000..28ce6fb Binary files /dev/null and b/images/ic_share_moment.png differ diff --git a/images/ic_squareness_del.png b/images/ic_squareness_del.png new file mode 100755 index 0000000..8b50cee Binary files /dev/null and b/images/ic_squareness_del.png differ diff --git a/images/ic_staff_list_icon.png b/images/ic_staff_list_icon.png new file mode 100755 index 0000000..c82857c Binary files /dev/null and b/images/ic_staff_list_icon.png differ diff --git a/images/ic_staff_qrcode.png b/images/ic_staff_qrcode.png new file mode 100755 index 0000000..75bdd6b Binary files /dev/null and b/images/ic_staff_qrcode.png differ diff --git a/images/ic_success.png b/images/ic_success.png new file mode 100755 index 0000000..bbc230d Binary files /dev/null and b/images/ic_success.png differ diff --git a/images/ic_take_cash_record.png b/images/ic_take_cash_record.png new file mode 100755 index 0000000..b047677 Binary files /dev/null and b/images/ic_take_cash_record.png differ diff --git a/images/ic_temp.png b/images/ic_temp.png new file mode 100755 index 0000000..7f99bfc Binary files /dev/null and b/images/ic_temp.png differ diff --git a/images/ic_unauth.png b/images/ic_unauth.png new file mode 100755 index 0000000..3d7e84d Binary files /dev/null and b/images/ic_unauth.png differ diff --git a/images/ic_unfavour.png b/images/ic_unfavour.png new file mode 100755 index 0000000..0cbe712 Binary files /dev/null and b/images/ic_unfavour.png differ diff --git a/images/ic_user_default.png b/images/ic_user_default.png new file mode 100755 index 0000000..ef30c1e Binary files /dev/null and b/images/ic_user_default.png differ diff --git a/images/ic_version_contrast.png b/images/ic_version_contrast.png new file mode 100755 index 0000000..8bd77a0 Binary files /dev/null and b/images/ic_version_contrast.png differ diff --git a/images/ic_video_default.png b/images/ic_video_default.png new file mode 100755 index 0000000..61e2562 Binary files /dev/null and b/images/ic_video_default.png differ diff --git a/images/ic_video_play.png b/images/ic_video_play.png new file mode 100755 index 0000000..b3402c8 Binary files /dev/null and b/images/ic_video_play.png differ diff --git a/images/ic_vip_icon.png b/images/ic_vip_icon.png new file mode 100755 index 0000000..61c2195 Binary files /dev/null and b/images/ic_vip_icon.png differ diff --git a/images/ic_voice_record.gif b/images/ic_voice_record.gif new file mode 100755 index 0000000..5cf6cd6 Binary files /dev/null and b/images/ic_voice_record.gif differ diff --git a/images/ic_wait_consignment.png b/images/ic_wait_consignment.png new file mode 100755 index 0000000..ace5a22 Binary files /dev/null and b/images/ic_wait_consignment.png differ diff --git a/images/ic_wait_pay.png b/images/ic_wait_pay.png new file mode 100755 index 0000000..071d895 Binary files /dev/null and b/images/ic_wait_pay.png differ diff --git a/images/ic_wait_receipt.png b/images/ic_wait_receipt.png new file mode 100755 index 0000000..2fb56c2 Binary files /dev/null and b/images/ic_wait_receipt.png differ diff --git a/images/ic_wechart_icon.png b/images/ic_wechart_icon.png new file mode 100755 index 0000000..0b9b8d2 Binary files /dev/null and b/images/ic_wechart_icon.png differ diff --git a/images/ic_wechat_icon.png b/images/ic_wechat_icon.png new file mode 100755 index 0000000..2f7cdea Binary files /dev/null and b/images/ic_wechat_icon.png differ diff --git a/images/ic_yellow_bg.png b/images/ic_yellow_bg.png new file mode 100755 index 0000000..257a1a1 Binary files /dev/null and b/images/ic_yellow_bg.png differ diff --git a/images/jpg.png b/images/jpg.png new file mode 100755 index 0000000..8573f34 Binary files /dev/null and b/images/jpg.png differ diff --git a/images/lib.png b/images/lib.png new file mode 100755 index 0000000..ec41045 Binary files /dev/null and b/images/lib.png differ diff --git a/images/map.png b/images/map.png new file mode 100755 index 0000000..46f3482 Binary files /dev/null and b/images/map.png differ diff --git a/images/mp3.png b/images/mp3.png new file mode 100755 index 0000000..e909b57 Binary files /dev/null and b/images/mp3.png differ diff --git a/images/mp4.png b/images/mp4.png new file mode 100755 index 0000000..c0ae5cc Binary files /dev/null and b/images/mp4.png differ diff --git a/images/share-icon.png b/images/share-icon.png new file mode 100755 index 0000000..569c44c Binary files /dev/null and b/images/share-icon.png differ diff --git a/images/share_count.png b/images/share_count.png new file mode 100755 index 0000000..6e2c3dc Binary files /dev/null and b/images/share_count.png differ diff --git a/images/title-bg.png b/images/title-bg.png new file mode 100755 index 0000000..a7e94e2 Binary files /dev/null and b/images/title-bg.png differ diff --git a/images/txt.png b/images/txt.png new file mode 100755 index 0000000..308dff0 Binary files /dev/null and b/images/txt.png differ diff --git a/images/view-count.png b/images/view-count.png new file mode 100755 index 0000000..23bc6a3 Binary files /dev/null and b/images/view-count.png differ diff --git a/packagecard/cardDetail/cardDetail.js b/packagecard/cardDetail/cardDetail.js new file mode 100755 index 0000000..1c7103b --- /dev/null +++ b/packagecard/cardDetail/cardDetail.js @@ -0,0 +1,403 @@ +const app = getApp() +var CryptoJS = require('../../utils/util.js'); +Page({ + + /** + * 页面的初始数据 + */ + data: { + preview: '', + showHide: false, + isLoading: false, + isMain: '', + cardPersonId: '', + choose_index: 0, + active: 0, + cardUrl: app.urls.baseImgUrl, + areaList: [], + cardInfo: {}, + bgImg: '', + fontFamilyList: [], + useFontFamily: '', + cardId: '', + cardHeight: '', + shareTicket: '', + encryptedData: '', + iv: '', + isFromOut: false, + token: '', + oldToken: '', + fromMine: false, + imgTempSrc: '', + currentIndex: 0, + windowWidth: app.globalData.windowWidth, + scale: 1 + }, + tabChange(e) { + this.setData({ + active: e.detail + }) + if (this.data.active == 0) { + //首页 + // wx.redirectTo({ + // url: '/pages/index/index', + // }) + } else if (this.data.active == 1) { + // 服务 + if (app.globalData.servicePageType == 1) { + wx.redirectTo({ + url: '/pages/shop/catalog/bannerlist/bannerlist', + }) + } else if (app.globalData.servicePageType == 2) { + wx.redirectTo({ + url: '/pages/shop/catalog/column/column', + }) + } else if (app.globalData.servicePageType == 3) { + wx.redirectTo({ + url: '/pages/shop/catalog/list/list', + }) + } else if (app.globalData.servicePageType == 4) { + wx.redirectTo({ + url: '/pages/shop/bespeak/bespeak', + }) + } + } else { + //我的 + wx.redirectTo({ + url: '/pages/mine/index/index', + }) + } + }, + // 生成我的名片 + createMyCard: function () { + var self = this + wx.showLoading({ + title: '生成中...', + success() { + self.setData({ + isLoading: true + }) + } + }) + var content = { + pictureTemplateId: self.data.cardId, + cardTemplateUseAreaList: [] + } + for (let i = 0; i < self.data.areaList.length; i++) { + if (self.data.areaList[i].templateAreaType != '1') { + var info = { + cardTemplateUseId: "", + picturesTemplateAreaId: self.data.areaList[i].picturesTemplateAreaId, + templateAreaFile: self.data.areaList[i].templateAreaFile, + templateAreaFontValue: self.data.areaList[i].templateAreaFontValue + } + content.cardTemplateUseAreaList.push(info) + } + } + app.http.post(app.urls.creatCard, { + data: content, + header: { + token: self.data.token + } + }).then(res => { + if (res.statusCode == '200') { + wx.hideLoading({ + success: (res) => { + self.setData({ + isLoading: false, + }) + wx.showModal({ + content: '恭喜您名片创建成功,如需查看请到(我的 → 我的卡包)', + cancelText: '继续创建', + confirmText: '返回列表', + cancelColor: '#333333', + confirmColor: '#333333', + success(res) { + if (res.confirm) { + self.backList() + } else { + self.continueCreate() + } + } + }) + }, + }) + } + }).catch(res => { + self.setData({ + isLoading: false, + showHide: false + }) + }) + }, + //输入框失去焦点 + inputBlur(e) { + var _self = this + // templateAreaFontLength + var value = e.detail.value + var index = e.currentTarget.dataset.num + var item = e.currentTarget.dataset.item + //计算限制长度 + //最大长度 + var maxLength = item.templateAreaFontLength + if (value != '' && maxLength > 0) { + value = value.substr(0, maxLength) + //重新设置 + _self.data.areaList[index].templateAreaFontValue = value + _self.data.areaList[index].focus = false + _self.setData({ + areaList: _self.data.areaList + }) + } + //生成二维码图片 + if (item.templateAreaServerLink != '1') { + _self.getFileId(index) + } + }, + // 选择图片 + choosePhoto: function (e) { + var self = this + var cur = e.currentTarget.dataset.cur + var item = e.currentTarget.dataset.item + console.log(cur) + self.setData({ + currentIndex: cur + }) + //宽高比 + var scale = item.templateAreaWidth / item.templateAreaHeight + wx.chooseImage({ + count: 1, + sourceType: ['album', 'camera'], + success: function (res) { + wx.navigateTo({ + url: '/packagecard/common/corpperimg/cropperimg?imgSrc=' + res.tempFiles[0].path + '&scale=' + scale, + }) + } + }) + }, + doUploadImg(path) { + var _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }).then(res => { + wx.hideLoading({}) + res = JSON.parse(res) + var change = 'areaList[' + _self.data.currentIndex + '].templateAreaFile' + _self.setData({ + [change]: res.data + }) + wx.showToast({ + title: '上传成功', + duration: 1500 + }) + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }).catch(res => { + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }) + }, + // 获取名片信息 + getNameCard: function () { + var self = this; + var queryInfo = '' + if (self.data.fromMine) { + queryInfo = '?cardPersonId=' + self.data.cardPersonId + } + app.http.get(app.urls.getCardDetail.format({ + cardTemplateId: self.data.cardId + }), { + header: { + token: app.globalData.token + }, + data: {} + }).then(res => { + var area = res.data.areaList + var scale = res.data.picturesTemplateWidth / self.data.windowWidth + res.data.picturesTemplateWidth = res.data.picturesTemplateWidth / scale + res.data.picturesTemplateHeight = res.data.picturesTemplateHeight / scale + for (let i = 0; i < area.length; i++) { + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + area[i].templateAreaFontSize = area[i].templateAreaFontSize / scale + 'px' + area[i].templateAreaHeight = area[i].templateAreaHeight / scale + area[i].templateAreaWidth = area[i].templateAreaWidth / scale + area[i].templateAreaDown = area[i].templateAreaDown / scale + area[i].templateAreaTop = area[i].templateAreaTop / scale + area[i].templateAreaRight = area[i].templateAreaRight / scale + area[i].templateAreaLeft = area[i].templateAreaLeft / scale + } + self.setData({ + cardInfo: res.data, + areaList: area + }) + }) + .catch(err => { + + }) + + }, + // 获取名片内容区域 + getNameCradArea: function () { + var self = this; + var arr = [] + app.restAjax.get(app.restAjax.path('{cardUrl}app/cardtemplatearea/listcardtemplateareabytemplateid/' + self.data.cardId, [app.tradeUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + for (let i = 0; i < data.length; i++) { + data[i]['focus'] = false + if (data[i].templateAreaType != '1') { + arr.push(data[i]) + } else { + var font = parseInt(data[i].templateAreaFontSize.replace('px', '')) + font = Math.floor(font * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx' + data[i].templateAreaFontSize = font + arr.push(data[i]) + } + } + self.setData({ + areaList: arr + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 编辑信息 + editInfo: function (e) { + var cur = e.currentTarget.dataset.num + var text = e.detail.value + var item = 'areaList[' + cur + '].templateAreaFontValue' + this.setData({ + [item]: text + }) + }, + // 点击内容区域获取input焦点 + giveFocus: function (e) { + console.log(e.currentTarget.dataset.cur) + var cur = e.currentTarget.dataset.cur + var item = 'areaList[' + cur + '].focus' + this.setData({ + [item]: true + }) + }, + // 继续创建 + continueCreate: function () { + this.setData({ + showHide: false + }) + }, + // 返回模板列表 + backList: function () { + wx.navigateBack({ + delta: 1, + }) + }, + // 获取用户信息 + getUserInfo: function () { + var self = this + app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + app.globalData.userInfo = data + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 非文字、图片区域换取fileid + getFileId: function (e) { + var self = this + var cur = e + var content = self.data.areaList[cur].templateAreaFontValue + console.log(content) + var areaId = self.data.areaList[cur].picturesTemplateAreaId + app.http.get(app.urls.getFileId.format({ + picturesTemplateAreaId: areaId + }), { + header: { + token: app.globalData.token + }, + data: { + content: content + } + }).then(res => { + console.log(res.data) + var change = 'areaList[' + cur + '].templateAreaFile' + self.setData({ + [change]: res.data.data + }) + }) + .catch(err => { + + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var self = this + this.setData({ + cardId: options.id, + token: app.globalData.token, + }) + this.getNameCard() + }, + postRecord: function (res) { + var self = this + app.restAjax.post(app.restAjax.path('{loginUrl}app/cardtemplateforwardingrecord/savecardtemplateforwardingrecord', [app.tradeUrl]), { + encryptedData: res.encryptedData, + iv: res.iv, + templateUseId: self.data.cardId, + templateFromUserId: self.data.oldToken, + templateToUserId: self.data.token + }, { + headers: { + token: self.data.token + } + }, function (code, data) { + console.log('1' + data) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + openPage() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + console.log(this.data.imgTempSrc) + if (this.data.imgTempSrc != '') { + this.doUploadImg(this.data.imgTempSrc) + } + }, + +}) \ No newline at end of file diff --git a/packagecard/cardDetail/cardDetail.json b/packagecard/cardDetail/cardDetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/cardDetail/cardDetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/cardDetail/cardDetail.wxml b/packagecard/cardDetail/cardDetail.wxml new file mode 100755 index 0000000..545113f --- /dev/null +++ b/packagecard/cardDetail/cardDetail.wxml @@ -0,0 +1,94 @@ + + 创建名片 + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + 适用行业:{{cardInfo.templateIndustryName}} + + + + + + {{item.templateAreaName}} + 最多输入{{item.templateAreaFontLength}}个字符 + + + + + + + + + + + + {{item.templateAreaName}} + 最多输入1张图片 + + + + + + + + + + + + + + + + 创建成功 + 恭喜您名片创建成功,如需查看请到(我的 → 我的卡包) + + 继续创建 + 返回模板 + + + \ No newline at end of file diff --git a/packagecard/cardDetail/cardDetail.wxss b/packagecard/cardDetail/cardDetail.wxss new file mode 100755 index 0000000..c737781 --- /dev/null +++ b/packagecard/cardDetail/cardDetail.wxss @@ -0,0 +1,223 @@ +.card { + width: 100%; + height: 0; + position: relative; + box-sizing: border-box; + z-index: 100; + /* text-align: center; */ +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.area-box { + background: none !important; + z-index: 111; +} + +.area-box image { + width: 100%; + height: 100%; +} + +.card-info { + padding-bottom: 100rpx; + width: 100%; + margin-top: 15rpx; +} + +.card-title { + font-size: 30rpx; + background: #ffffff; + width: 100%; + padding: 15rpx; +} + +.row { + display: flex; + border-bottom: 1px solid #EEE; + background: #ffffff; + border-bottom: 1rpx solid #f5f5f5; +} + +.row-ver { + display: flex; + border-bottom: 1px solid #EEE; + border-bottom: 1rpx solid #f5f5f5; + flex-direction: column; + background-color: #ffffff; + padding: 15rpx; +} + +.row-ver:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.row-ver:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.item-title { + flex: 1; + font-size: 32rpx; + line-height: 50rpx; + color: #808080; +} + +.item-title-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 7.5rpx; +} + +.item-input { + flex: 4; + box-sizing: border-box; + display: flex; + align-items: center; + margin-top: 15rpx; +} + +.item-input input { + width: 100%; + text-align: left; + height: 50rpx; + font-size: 32rpx; + color: #333; +} + +.item-input image { + max-width: 70%; + /* max-height: 120rpx; */ +} + +.item-code-input image { + max-width: 35%; + max-height: 160rpx; +} + + + + +.hide-link { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 1000; +} + +.hide { + position: absolute; + top: 50%; + left: 50%; + width: 60%; + transform: translate(-50%, -50%); + border-radius: 10rpx; + background: #fff; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.hide-btn { + display: flex; + width: 50%; + height: 60rpx; + background: #1d7ff0; + color: #fff; + font-size: 30rpx; + justify-content: center; + align-items: center; + border-bottom-left-radius: 10rpx; + border-bottom-right-radius: 10rpx; +} + +.hide-btn:nth-child(1) { + background: #E6B980; + border-bottom-left-radius: 10rpx; + border-bottom-right-radius: 0rpx; +} + +.hide-btn:last-child { + border-bottom-left-radius: 0rpx; + border-bottom-right-radius: 10rpx; +} + +.hide-text { + font-size: 36rpx; + color: #000; + padding: 50rpx 30rpx; +} + +.hide-title { + font-size: 43rpx; + color: #ffC107; + padding: 10rpx; +} + +.hide-btn-box { + display: flex; + width: 100%; + justify-content: space-between; +} + +.input-box { + width: 100%; +} + +.content-box { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15rpx; +} + +.cuIcon-cameraadd { + font-size: 60rpx; +} + +.card-img-box { + display: flex; + flex-direction: row; + align-items: center; + margin-right: 40rpx; + justify-content: space-between; +} + +.card-img-box image { + width: 200rpx; + height: 200rpx; +} + +.hint-txt { + text-align: right; + color: #fd9494; + font-size: 24rpx; +} + + +/* 换行 */ +.wrap-line { + overflow-wrap: break-word; +} + +/* 居中 */ +.wrap-center { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/packagecard/cardList/cardList.js b/packagecard/cardList/cardList.js new file mode 100755 index 0000000..b4964bc --- /dev/null +++ b/packagecard/cardList/cardList.js @@ -0,0 +1,223 @@ +const app = getApp() +// pages/list/list.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: app.urls.baseImgUrl, + cardList: [], + currentIndex: 0, + optionsList: [], + isNeedPay: false, //是否需要交费 + needPayPrice: 0, //个人需要交费 + needPayTeamPrice: 0, //团体需要交费 + curTypeId: '', + isRefreshing: false, //是否在刷新 + isRefresh: false, + isShowCodeInput: false, //测试true + code: '', //邀请码 + conentHeight: 550, //滚动内容的高度 + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // this.getPayState() + //屏幕高度-标题的高度 + this.setData({ + conentHeight: app.globalData.windowHeight + }) + }, + onShow() { + this.dorefreshList() + }, + //列表刷新 + dorefreshList() { + var _self = this + _self.setData({ + isRefresh: false, + isRefreshing: true, + cardList: [] + }) + _self.getPayState() + }, + //获取类型 + getOptionsList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getDictionaryList.format({ + dataParentId: '4bf68c60-eac5-480d-b5e1-15203d0282f9' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (res.data.length > 0) { + _self.setData({ + optionsList: res.data, + curTypeId: res.data[_self.data.currentIndex].dataId, + currentIndex: _self.data.currentIndex + }) + //根据第一条获取数据 + _self.getList() + } + }) + .catch(err => { + console.log(err) + _self.setData({ + isRefreshing: false + }) + }) + }, + getList() { + var self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCardList, { + header: { + token: app.globalData.token + }, + data: { + templateType: self.data.curTypeId + } + }).then(res => { + wx.hideLoading({}) + res.data.forEach(it => { + if (it.picturesTemplateNumber > 1000 && it.picturesTemplateNumber < 10000) { + it.number = it.picturesTemplateNumber / 1000 + 'K+' + } else if (it.picturesTemplateNumber > 10000 && it.picturesTemplateNumber < 1000000) { + it.number = it.picturesTemplateNumber / 10000 + 'W+' + } else { + it.number = it.picturesTemplateNumber + } + }) + self.setData({ + cardList: res.data, + isRefreshing: false + }) + }) + .catch(err => { + wx.hideLoading({}) + self.setData({ + isRefreshing: false + }) + }) + }, + + goDetail: function (e) { + var _self = this + var id = e.currentTarget.dataset.id + var isPay = e.currentTarget.dataset.ispay //是否需要交费 + var price = e.currentTarget.dataset.price //价格 + var payState = e.currentTarget.dataset.paystate //交费转态 + if (_self.data.isNeedPay) { + wx.navigateTo({ + url: '/packagecard/paypage/paypage?price=' + _self.data.needPayPrice + '&teamprice=' + _self.data.needPayTeamPrice + '&displayTreaty=1&type=1', + }) + } else { + //已经支付过 + if (isPay == '1') { + //需要付款 + //判断是否交过费 + if (payState) { + wx.navigateTo({ + url: '../cardDetail/cardDetail?id=' + id, + }) + } else { + //交费 + wx.navigateTo({ + url: '/packagecard/paypage/paypage?price=' + price + '&type=2', + }) + } + } else { + //免费 + wx.navigateTo({ + url: '../cardDetail/cardDetail?id=' + id, + }) + } + } + }, + + onChange(e) { + var _self = this + _self.setData({ + currentIndex: e.detail.index, + curTypeId: _self.data.optionsList[e.detail.index].dataId, + cardList: [] + }) + //重置所有数据重新加载 + this.getList() + }, + //获取支付状态 + getPayState() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPayState, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //支付过跳转名片创建页面,没有支付跳转支付页面 + _self.setData({ + isNeedPay: res.data.cardCharge, //是否需要交费 + needPayPrice: res.data.cardChargePrice, //个人 + needPayTeamPrice: res.data.cardChargeDepartmentPrice, //团体 + }) + _self.getOptionsList() + }) + .catch(err => { + _self.setData({ + isRefreshing: false + }) + }) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.getList() + }, + onClose(e) { + this.setData({ + isShowCodeInput: false + }) + }, + inpuWatch(e) { + this.setData({ + code: e.detail.value + }) + }, + //邀请码创建 + codeCreate(e) { + var _self = this + if (_self.data.code == '') { + wx.showToast({ + title: '请输入邀请码', + icon: 'none' + }) + } else { + //未支付过跳转支付 + wx.navigateTo({ + url: '/packagecard/paypage/paypage?price=' + _self.data.needPayPrice + '&teamprice=' + _self.data.needPayTeamPrice + '&displayTreaty=1' + '&type=1&code=' + _self.data.code, + }) + } + }, + //无邀请码创建 + noCodeCreate(e) { + wx.navigateTo({ + url: '/packagecard/paypage/paypage?price=' + _self.data.needPayPrice + '&teamprice=' + _self.data.needPayTeamPrice + '&displayTreaty=1&type=1', + }) + } +}) \ No newline at end of file diff --git a/packagecard/cardList/cardList.json b/packagecard/cardList/cardList.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/cardList/cardList.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/cardList/cardList.wxml b/packagecard/cardList/cardList.wxml new file mode 100755 index 0000000..0c69c80 --- /dev/null +++ b/packagecard/cardList/cardList.wxml @@ -0,0 +1,58 @@ + + 模板列表 + + + + + + + + + + + + + + + + + + + + + ¥ {{item.templatePrice}} + + + 免费 + + + + + + 使用次数:{{item.number}} + + + + + + + + + + + + + + 邀请码 + + + + + + + + \ No newline at end of file diff --git a/packagecard/cardList/cardList.wxss b/packagecard/cardList/cardList.wxss new file mode 100755 index 0000000..91e3253 --- /dev/null +++ b/packagecard/cardList/cardList.wxss @@ -0,0 +1,124 @@ +.card { + width: 100%; + box-shadow: 0 0 20rpx #EEE; + background: #fff; + border-radius: 10rpx; + padding: 15rpx; + margin: 0rpx 0rpx 15rpx 0rpx; +} + +.card:nth-child(1) { + padding: 0rpx 0rpx 7.5rpx 0rpx; +} + +.card:last-child { + padding: 7.5rpx 0rpx 15rpx 0rpx; +} + +.card-img { + width: 100%; + height: 400rpx; + position: relative; + margin-top: 15rpx; + border-radius: 10rpx; +} + +.card-name { + font-size: 36rpx; + padding: 15rpx 0rpx 0rpx 15rpx; +} + +.price-box { + width: 128rpx; + height: 128rpx; + z-index: 3; + position: absolute; + left: 0rpx; + top: 0rpx; +} + +.price-box image { + width: 128rpx; + height: 128rpx; +} + +.price-text { + position: absolute; + z-index: 3; + top: 25%; + left: 45%; + transform: rotate(45deg); + font-size: 32rpx; + color: #ffffff; +} + +.price { + position: absolute; + z-index: 3; + top: -20rpx; + left: 65rpx; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 32rpx; + color: #ffff00; + width: 100%; +} + +.number-box { + width: 128rpx; + height: 128rpx; + position: absolute; + bottom: 0rpx; + right: 0rpx; +} + +.number-box image { + width: 100%; + height: 100%; + margin-top: 0rpx; + border-radius: 0rpx; +} + +.number-content { + width: 100%; + color: #fff; + position: absolute; + top: 30rpx; + right: -70rpx; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 18rpx; + text-align: center; +} + +.code-box { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; +} + +.code-box input { + line-height: 80rpx; + height: 80rpx; + font-size: 28rpx; + text-align: center; + border: 1rpx solid #f2f2f2; + background-color: #f2f2f2; + border-radius: 10rpx; + width: 95%; +} + +.code-box .code-title { + font-size: 38rpx; + color: var(--yellowLight); + padding-bottom: 15rpx; + text-align: center; + margin-top: 15rpx; +} + +.code-box .btns { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} \ No newline at end of file diff --git a/packagecard/common/corpperimg/cropperimg.js b/packagecard/common/corpperimg/cropperimg.js new file mode 100755 index 0000000..9d6640a --- /dev/null +++ b/packagecard/common/corpperimg/cropperimg.js @@ -0,0 +1,50 @@ +// packagecard/common/corpperimg/cropperimg.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgSrc: '', + scale: 1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + imgSrc: options.imgSrc, + scale: options.scale + }) + console.log(this.data.scale) + }, + cropperDone(e) { + const { + src, + cropperData + } = e.detail; + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + imgTempSrc: src + }) + }, + + cropperCancel() { + wx.navigateBack({}) + }, + + cropperFail(e) { + const err = e.detail; + console.log(e); + wx.showToast({ + title: '裁剪失败,请重试', + icon: 'none', + success() { + wx.navigateBack({}) + } + }) + } +}) \ No newline at end of file diff --git a/packagecard/common/corpperimg/cropperimg.json b/packagecard/common/corpperimg/cropperimg.json new file mode 100755 index 0000000..2b8ed20 --- /dev/null +++ b/packagecard/common/corpperimg/cropperimg.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "cropper": "/vant/dist/cropper/index" + } +} \ No newline at end of file diff --git a/packagecard/common/corpperimg/cropperimg.wxml b/packagecard/common/corpperimg/cropperimg.wxml new file mode 100755 index 0000000..6d35643 --- /dev/null +++ b/packagecard/common/corpperimg/cropperimg.wxml @@ -0,0 +1,5 @@ + + 图片裁剪 + + \ No newline at end of file diff --git a/packagecard/common/corpperimg/cropperimg.wxss b/packagecard/common/corpperimg/cropperimg.wxss new file mode 100755 index 0000000..bd3e9ed --- /dev/null +++ b/packagecard/common/corpperimg/cropperimg.wxss @@ -0,0 +1 @@ +/* packagecard/common/corpperimg/cropperimg.wxss */ \ No newline at end of file diff --git a/packagecard/common/webpage/webpage.js b/packagecard/common/webpage/webpage.js new file mode 100755 index 0000000..d65ffba --- /dev/null +++ b/packagecard/common/webpage/webpage.js @@ -0,0 +1,22 @@ +// pages/common/webpage.js +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + url: options.url + }) + }, + +}) \ No newline at end of file diff --git a/packagecard/common/webpage/webpage.json b/packagecard/common/webpage/webpage.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/common/webpage/webpage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/common/webpage/webpage.wxml b/packagecard/common/webpage/webpage.wxml new file mode 100755 index 0000000..2aa3f26 --- /dev/null +++ b/packagecard/common/webpage/webpage.wxml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/packagecard/common/webpage/webpage.wxss b/packagecard/common/webpage/webpage.wxss new file mode 100755 index 0000000..4e9e6ce --- /dev/null +++ b/packagecard/common/webpage/webpage.wxss @@ -0,0 +1 @@ +/* pages/common/webpage.wxss */ \ No newline at end of file diff --git a/packagecard/lucre/historylucre.js b/packagecard/lucre/historylucre.js new file mode 100755 index 0000000..9775f69 --- /dev/null +++ b/packagecard/lucre/historylucre.js @@ -0,0 +1,66 @@ +// packagecard/lucre/historylucre.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/lucre/historylucre.json b/packagecard/lucre/historylucre.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/lucre/historylucre.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/lucre/historylucre.wxml b/packagecard/lucre/historylucre.wxml new file mode 100755 index 0000000..ea42efa --- /dev/null +++ b/packagecard/lucre/historylucre.wxml @@ -0,0 +1,2 @@ + +packagecard/lucre/historylucre.wxml diff --git a/packagecard/lucre/historylucre.wxss b/packagecard/lucre/historylucre.wxss new file mode 100755 index 0000000..41a8800 --- /dev/null +++ b/packagecard/lucre/historylucre.wxss @@ -0,0 +1 @@ +/* packagecard/lucre/historylucre.wxss */ \ No newline at end of file diff --git a/packagecard/marketing/marketinginfo.js b/packagecard/marketing/marketinginfo.js new file mode 100755 index 0000000..e2ab9c1 --- /dev/null +++ b/packagecard/marketing/marketinginfo.js @@ -0,0 +1,59 @@ +// packagecard/marketing/marketinginfo.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + isRefreshing: false, //是否在刷新 + isLoadMore: true, //是否在加载中 + infoList: [], + hasMore: true, //是否有更多数据了 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var _self = this + }, + loadMore() { + var _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + console.log('加载更多') + this.setData({ + isLoadMore: true + }) + setTimeout(() => { + for (var i = 0; i < 20; i++) { + var item = {} + item['name'] = '新添加' + (i + 1) + _self.data.infoList.push(item) + } + _self.setData({ + infoList: _self.data.infoList, + isLoadMore: false + }) + }, 10000); + } + }, + dorefreshList() { + console.log('下拉刷新了') + var _self = this + this.setData({ + isRefreshing: true + }) + setTimeout(() => { + _self.setData({ + isRefreshing: false + }) + }, 2000); + }, + onReachBottom() { + // this.loadMore() + } +}) \ No newline at end of file diff --git a/packagecard/marketing/marketinginfo.json b/packagecard/marketing/marketinginfo.json new file mode 100755 index 0000000..f18b355 --- /dev/null +++ b/packagecard/marketing/marketinginfo.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "onReachBottomDistance": 50 +} \ No newline at end of file diff --git a/packagecard/marketing/marketinginfo.wxml b/packagecard/marketing/marketinginfo.wxml new file mode 100755 index 0000000..92efb31 --- /dev/null +++ b/packagecard/marketing/marketinginfo.wxml @@ -0,0 +1,112 @@ + + 营销资讯 + + + + + + + + + + 但是这个属性只支持单行文本的溢出显示省略 + + 来源 + 2021-06-29 + + + + + + + + + 但是这个属性只支持单行文本的溢出显示省略号,如果我们要实现多行文本溢出显示省略号呢 + + 来源 + 2021-06-29 + + + + + + + 但是这个属性只支持单行文本的溢出显示省略号,如果我们要实现多行文本溢出显示省略号呢 + + 来源 + 2021-06-29 + + + + + + + + + 但是这个属性只支持单行文本的溢出显示省略 + + + + 来源 + 2021-06-29 + + + + + + + 但是这个属性只支持单行文本的溢出显示省略 + + + + + + + 来源 + 2021-06-29 + + + + + + + 但是这个属性只支持单行文本的溢出显示省略 + + + + + + + 来源 + 2021-06-29 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/marketing/marketinginfo.wxss b/packagecard/marketing/marketinginfo.wxss new file mode 100755 index 0000000..3b2b1ff --- /dev/null +++ b/packagecard/marketing/marketinginfo.wxss @@ -0,0 +1,155 @@ +/* packagecard/marketing/marketinginfo.wxss */ +/* 横向 */ +.item-box-row { + display: flex; + flex-direction: row; + align-items: center; + background-color: #ffffff; + justify-content: flex-start; + width: 100%; + border-bottom: 1rpx solid #f3f3f3; + padding: 15rpx; +} + +/* 纵向 */ +.item-box-column { + display: flex; + flex-direction: column; + align-items: center; + background-color: #ffffff; + justify-content: flex-start; + width: 100%; + border-bottom: 1rpx solid #f3f3f3; + padding: 15rpx; +} + +.item-box-column .item-content { + width: 100%; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: space-between; +} + +.big-img { + width: 100%; + height: 300rpx; + border-radius: 5rpx; + margin-top: 15rpx; +} + +.movie-img-box { + width: 100%; + height: 300rpx; + border-radius: 5rpx; + margin-top: 15rpx; + position: relative; +} + +.movie-icon { + width: 96rpx; + height: 96rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.img-box { + display: flex; + flex-direction: row; + align-items: flex-start; + justify-content: space-around; + width: 100%; + margin-top: 15rpx; +} + +.img-box image { + width: 32%; + height: 128rpx; + border-radius: 5rpx; +} + +.item-box-row image { + width: 214rpx; + height: 64px; + border-radius: 5rpx; +} + +/* 文本和底部 */ +.item-box-row .item-content { + display: flex; + flex-direction: column; + justify-content: space-between; + width: 80%; + min-height: 128rpx; +} + +/* 文本内容 */ +.item-content .text { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + font-size: 30rpx; + color: #000000; + -webkit-line-clamp: 2; +} + + + + + + + +.item .content-box-row .text { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + font-size: 30rpx; + color: #000000; + -webkit-line-clamp: 2; +} + +.item .content-box-column { + display: flex; + flex-direction: column; + justify-content: space-between; + width: 100%; + align-items: center; +} + +.item .content-box-column image { + width: 100%; + height: 100rpx; +} + +.item .content-box-column .text { + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + font-size: 30rpx; + color: #000000; + -webkit-line-clamp: 2; +} + +.bottom-start { + display: flex; + flex-direction: row; + justify-content: flex-start; + width: 100%; + font-size: 24rpx; + margin-top: 15rpx; + color: #6b6b6b; + align-items: center; +} + +.bottom-end { + margin-top: 15rpx; + display: flex; + flex-direction: row; + justify-content: flex-end; + font-size: 24rpx; + color: #6b6b6b; + width: 100%; + align-items: center; +} \ No newline at end of file diff --git a/packagecard/marketing/marketingposter.js b/packagecard/marketing/marketingposter.js new file mode 100755 index 0000000..9ad8b48 --- /dev/null +++ b/packagecard/marketing/marketingposter.js @@ -0,0 +1,486 @@ +// packagecard/marketing/marketingposter.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + posterTempleteList: [], + posterHistoryList: [], + currentIndex: 0, + currentPage: 1, + totalPage: 0, + isShowSel: false, + tabList: [{ + name: '营销模板', + }, { + name: '我的海报' + }], + isRefreshing: false, //是否刷新中 + isLoadMore: false, //是否在加载中 + hasMore: true, + imgUrl: app.urls.baseImgUrl, + isRefresh: false, + currentTypeIndex: 0, //当前选择的类型索引 + optionsList: [], //类型 + curTypeId: '', + isShowOptions: false, //是否显示选项 + curItemIndex: -1, //点击分享按钮弹出的 + curTypeName: '全部', + contentHeight: 550, //内容区域的高度 + shareTitle: '活动' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var _self = this + //获取类型 + _self.getOptionsList() + this.setData({ + contentHeight: app.globalData.windowHeight + }) + try { + var title = wx.getStorageSync('postertitle') + if (title) { + _self.setData({ + shareTitle: title + }) + } + } catch (error) { + + } + }, + //获取类型 + getOptionsList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getDictionaryList.format({ + dataParentId: '4bf68c60-eac5-480d-b5e1-15203d0282f9' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (res.data.length > 0) { + _self.setData({ + optionsList: res.data, + }) + //根据第一条获取数据 + _self.getTempleteList() + } + var allItem = { + dataName: '全部', + dataId: '2' + } + var tempItem = { + dataName: '我的收藏', + dataId: '1' + } + _self.data.optionsList.unshift(allItem) + _self.data.optionsList.push(tempItem) + _self.setData({ + curTypeId: res.data[0].dataId, + optionsList: _self.data.optionsList + }) + }) + .catch(err => { + console.log(err) + }) + }, + //显示类型选项 + showType() { + this.setData({ + isShowOptions: !this.data.isShowOptions + }) + }, + + //选择类型 + chooseType(e) { + var _self = this + var id = e.currentTarget.dataset.id + var idx = e.currentTarget.dataset.idx + var name = e.currentTarget.dataset.name + _self.setData({ + currentTypeIndex: idx, + curTypeId: id, + curTypeName: name, + posterHistoryList: [], + posterTempleteList: [], + isShowOptions: false + }) + if (_self.data.currentIndex == 0) { + if (_self.data.curTypeId == '1') { + _self.getFavorList() + } else { + _self.getTempleteList() + } + } else { + _self.getHistoryList() + } + }, + //收藏 + doFavor(e) { + var _self = this + var idx = e.currentTarget.dataset.idx + var id = e.currentTarget.dataset.id + var favor = e.currentTarget.dataset.favor + var msg = '' + if (favor) { + msg = '取消收藏...' + } else { + msg = '收藏中...' + } + wx.showLoading({ + title: msg, + }) + app.http.post(app.urls.doSaveCollect, { + header: { + token: app.globalData.token + }, + data: { + businessId: id, + projectId: 'poster' + } + }) + .then(res => { + wx.hideLoading({}) + _self.data.posterTempleteList[idx].cardCollect = !favor + _self.setData({ + posterTempleteList: _self.data.posterTempleteList + }) + }) + .catch(err => {}) + }, + //是否需要刷新 + onShow() { + var _self = this + if (_self.data.isRefresh) { + _self.dorefreshList() + } + }, + doShare(e) { + var _self = this + var idx = e.currentTarget.dataset.idx + _self.setData({ + curItemIndex: idx, + isShowSel: true + }) + }, + //分享 + onShareAppMessage(res) { + var _self = this + _self.setData({ + isShowSel: false + }) + wx.showShareMenu({ + withShareTicket: true, + success: function (res) { + console.log(res) + } + }) + var type = res.target.dataset.sharetype + var img = _self.data.imgUrl + _self.data.posterHistoryList[_self.data.curItemIndex].cardTemplateUsePhotoUrl + var id = _self.data.posterHistoryList[_self.data.curItemIndex].cardTemplateUseId + var userId = _self.data.posterHistoryList[_self.data.curItemIndex].creator + if (type && type == '2') { + //转发个人动态 + + } else { + var param = '/pages/index/index?cardTemplateUseId=' + id + '&userId=' + userId; + return { + title: _self.data.shareTitle, + path: param, + imageUrl: img + } + } + }, + //预览图片 + toImg() { + var _self = this + _self.setData({ + isShowSel: false + }) + var img = _self.data.imgUrl + _self.data.posterHistoryList[_self.data.curItemIndex].cardTemplateUsePhotoUrl + wx.previewImage({ + urls: [img], + }) + }, + //保存图片到相册 + toAlbum() { + var _self = this + _self.setData({ + isShowSel: false + }) + var img = _self.data.imgUrl + _self.data.posterHistoryList[_self.data.curItemIndex].cardTemplateUsePhotoUrl + wx.getSetting({ + success(res) { + if (res.authSetting['scope.writePhotosAlbum']) { + //已经授权相册权限 + _self.saveToAlbum(img) + } else if (res.authSetting['scope.writePhotosAlbum'] == undefined) { + wx.authorize({ + scope: 'scope.writePhotosAlbum', + success(res) { + _self.saveToAlbum(img) + }, + fail() { + wx.showToast({ + title: '您没有授权,无法保存', + icon: 'none' + }) + } + }) + } else { + wx.openSetting({ + success(res) { + if (res.authSetting['scope.writePhotosAlbum']) { + _self.saveToAlbum(img) + } else { + wx.showToast({ + title: '您没有授权,无法保存', + icon: 'none' + }) + } + } + }) + } + } + }) + }, + //保存图片到相册 + saveToAlbum(url) { + wx.showLoading({ + title: '保存中...', + }) + wx.downloadFile({ + url: url, + success(res) { + if (res.statusCode == 200) { + var path = res.tempFilePath + wx.saveImageToPhotosAlbum({ + filePath: path, + success(res) { + wx.hideLoading({}) + if (res.errMsg == 'saveImageToPhotosAlbum:ok') { + wx.showToast({ + title: '保存成功', + icon: 'success' + }) + } + }, + fail(err) { + wx.hideLoading({}) + wx.showToast({ + title: '保存失败,稍后重试', + icon: 'error' + }) + } + }) + } + }, + fail(err) { + wx.hideLoading({}) + wx.showToast({ + title: '保存失败,稍后重试', + icon: 'error' + }) + } + }) + }, + loadMore() { + var _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + this.setData({ + isLoadMore: true + }) + } + }, + dorefreshList() { + var _self = this + _self.setData({ + posterHistoryList: [], + posterTempleteList: [], + isRefreshing: true, + isLoadMore: false, + hasMore: true, + isRefresh: false + }) + if (_self.data.currentIndex == 0) { + //获取模板 + if (_self.data.curTypeId == '1') { + _self.getFavorList() + } else { + _self.getTempleteList() + } + } else { + _self.getHistoryList() + } + }, + //获取模板列表 + getTempleteList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPosterTempleteList, { + header: { + token: app.globalData.token + }, + data: { + templateType: _self.data.curTypeId == '2' ? '' : _self.data.curTypeId + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(it => { + if (it.picturesTemplateNumber < 100) { + //小于100次显示数值 + } else { + //大于100次 + if (it.picturesTemplateNumber > 100 && it.picturesTemplateNumber < 999) { + it.number = '一百+' + } + } + }) + _self.setData({ + isRefreshing: false, + isLoadMore: false, + posterTempleteList: res.data + }) + }) + .catch(err => { + console.log(err) + _self.setData({ + isRefreshing: false, + isLoadMore: false + }) + }) + }, + //获取收藏的列表 + getFavorList() { + var _self = this + _self.setData({ + posterTempleteList: [] + }) + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPosterFavorList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false, + isLoadMore: false, + posterTempleteList: res.data + }) + }) + .catch(err => { + _self.setData({ + isRefreshing: false, + isLoadMore: false + }) + }) + }, + + //获取历史发布列表 + getHistoryList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPosterHistory, { + header: { + token: app.globalData.token + }, + data: { + mode: '2', + templateType: _self.data.curTypeId == '2' ? '' : _self.data.curTypeId + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + posterHistoryList: res.data, + isRefreshing: false, + isLoadMore: false + }) + }) + .catch(err => { + _self.setData({ + isLoadMore: false, + isRefreshing: false + }) + console.log(err) + }) + }, + onReachBottom() { + // this.loadMore() + }, + onChange(e) { + var _self = this + if (_self.data.currentIndex != 0) { + var tempItem = { + dataName: '我的收藏', + dataId: '1' + } + _self.data.optionsList.push(tempItem) + } else { + _self.data.optionsList.splice(_self.data.optionsList.length - 1, 1) + } + _self.setData({ + optionsList: _self.data.optionsList + }) + _self.setData({ + currentIndex: e.detail.index + }) + //重置所有数据重新加载 + _self.dorefreshList() + }, + //去创建海报 + toCreate(e) { + var id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/packagecard/marketing/marketingpublish?posterId=' + id + }) + }, + //编辑海报 + toEdit(e) { + var id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/packagecard/marketing/posteredit?id=' + id, + }) + }, + // 生成随机id + buildId: function () { + var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + + var nums = ""; + + for (var i = 0; i < 36; i++) { + var id = parseInt(Math.random() * 61); + + nums += chars[id]; + } + return nums + }, + //隐藏弹框 + onClose(e) { + this.setData({ + isShowSel: false + }) + } +}) \ No newline at end of file diff --git a/packagecard/marketing/marketingposter.json b/packagecard/marketing/marketingposter.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/marketing/marketingposter.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/marketing/marketingposter.wxml b/packagecard/marketing/marketingposter.wxml new file mode 100755 index 0000000..85eed1c --- /dev/null +++ b/packagecard/marketing/marketingposter.wxml @@ -0,0 +1,104 @@ + + 营销海报 + + + + + + + + + + + + {{curTypeName}} + + + + + + + {{item.dataName}} + + + + + + + + + + + + + + + + + + + + 使用次数:{{item.picturesTemplateNumber > 999 ? '999+': + item.picturesTemplateNumber}} + + + + + + + 加载中... + + + + + + + + + + + + + + + + + + + + 加载中... + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/marketing/marketingposter.wxss b/packagecard/marketing/marketingposter.wxss new file mode 100755 index 0000000..e617a8e --- /dev/null +++ b/packagecard/marketing/marketingposter.wxss @@ -0,0 +1,117 @@ +/* packagecard/marketing/marketingposter.wxss */ +page { + height: 100%; +} + +.tab { + position: fixed; + display: flex; + left: 0; + right: 0; + background: #fff; + flex-direction: column; + z-index: 100; + width: 100%; +} + +.tab-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; +} + + +.img-box { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: flex-start; + flex-wrap: wrap; + margin: 15rpx; + position: relative; +} + +.img-box .start { + position: absolute; + top: 25rpx; + left: 25rpx; + z-index: 2; + font-size: 60rpx; +} + +.img-box image { + width: 350rpx; + margin-top: 15rpx; + border-radius: 10rpx; +} + +.number-box { + width: 128rpx; + height: 128rpx; + position: absolute; + bottom: 7rpx; + right: 0rpx; +} + +.number-box image { + width: 100%; + height: 100%; + margin-top: 0rpx; + border-radius: 0rpx; +} + +.number-content { + width: 100%; + color: #fff; + position: absolute; + top: 30rpx; + right: -70rpx; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 20rpx; + text-align: center; +} + +.img-box .item { + width: 350rpx; + margin-top: 15rpx; + border-radius: 10rpx; + position: relative; +} + +.item-box .btn { + width: 0rpx; + padding: 0rpx; + margin: 0rpx; + background-color: #2222ff; + position: absolute; + bottom: 5rpx; +} + +.share-item { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + padding: 0rpx 15rpx 15rpx 15rpx; + margin: 15rpx; +} + +.share-item:active { + background-color: #f3f3f3; +} + +.share-item:nth-child(1) { + padding: 15rpx 15rpx 15rpx 15rpx; +} + +.share-item image { + width: 80rpx; + height: 80rpx; +} + +.share-item text { + margin-left: 15rpx; + font-size: 32rpx; +} \ No newline at end of file diff --git a/packagecard/marketing/marketingpublish.js b/packagecard/marketing/marketingpublish.js new file mode 100755 index 0000000..0cd6366 --- /dev/null +++ b/packagecard/marketing/marketingpublish.js @@ -0,0 +1,258 @@ +//发布营销图片 + +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + posterId: '', //模板Id + imgUrl: app.urls.baseImgUrl, //图片基础路径 + areaList: [], //模板内容 + cardInfo: {}, //模板内容 + windowWidth: app.globalData.windowWidth, //屏幕宽度 + scale: 1, //缩放 + imgTempSrc: '', + currentIndex: 0, + isShowPoster: false, //生成海报后展示海报 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + posterId: options.posterId + }) + this.getPosterDetail() + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + if (this.data.imgTempSrc != '') { + this.doUploadImg(this.data.imgTempSrc) + } + }, + //获取海报详情 + getPosterDetail() { + var _self = this; + app.http.get(app.urls.getCardDetail.format({ + cardTemplateId: _self.data.posterId + }), { + header: { + token: app.globalData.token + }, + }).then(res => { + var area = res.data.areaList + var scale = res.data.picturesTemplateWidth / _self.data.windowWidth + res.data.picturesTemplateWidth = res.data.picturesTemplateWidth / scale + res.data.picturesTemplateHeight = res.data.picturesTemplateHeight / scale + for (let i = 0; i < area.length; i++) { + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + area[i].templateAreaFontSize = area[i].templateAreaFontSize / scale + 'px' + area[i].templateAreaHeight = area[i].templateAreaHeight / scale + area[i].templateAreaWidth = area[i].templateAreaWidth / scale + area[i].templateAreaDown = area[i].templateAreaDown / scale + area[i].templateAreaTop = area[i].templateAreaTop / scale + area[i].templateAreaRight = area[i].templateAreaRight / scale + area[i].templateAreaLeft = area[i].templateAreaLeft / scale + } + _self.setData({ + cardInfo: res.data, + areaList: area + }) + }) + .catch(err => { + + }) + }, + // 生成海报 + createPoster() { + var self = this + wx.showLoading({ + title: '生成中...', + success() { + self.setData({ + isLoading: true + }) + } + }) + var content = { + pictureTemplateId: self.data.posterId, + cardTemplateUseAreaList: [] + } + for (let i = 0; i < self.data.areaList.length; i++) { + if (self.data.areaList[i].templateAreaType != '1') { + var info = { + cardTemplateUseId: "", + picturesTemplateAreaId: self.data.areaList[i].picturesTemplateAreaId, + templateAreaFile: self.data.areaList[i].templateAreaFile, + templateAreaFontValue: self.data.areaList[i].templateAreaFontValue + } + content.cardTemplateUseAreaList.push(info) + } + } + app.http.post(app.urls.creatCard, { + data: content, + header: { + token: app.globalData.token + } + }).then(res => { + if (res.statusCode == '200') { + self.setData({ + isLoading: false, + }) + //获取海报 + wx.showToast({ + title: '海报生成成功', + success(res) { + setTimeout(() => { + wx.navigateBack({}) + }, 1000) + } + }) + } + }).catch(res => { + self.setData({ + isLoading: false, + showHide: false + }) + }) + }, + //输入框失去焦点 + inputBlur(e) { + var _self = this + // templateAreaFontLength + var value = e.detail.value + var index = e.currentTarget.dataset.num + var item = e.currentTarget.dataset.item + //计算限制长度 + //最大长度 + var maxLength = item.templateAreaFontLength + if (value != '' && maxLength > 0) { + value = value.substr(0, maxLength) + //重新设置 + _self.data.areaList[index].templateAreaFontValue = value + _self.data.areaList[index].focus = false + _self.setData({ + areaList: _self.data.areaList + }) + } + //生成二维码图片 + if (item.templateAreaServerLink != '1') { + _self.getFileId(index) + } + }, + // 选择图片 + choosePhoto: function (e) { + var self = this + var cur = e.currentTarget.dataset.cur + var item = e.currentTarget.dataset.item + console.log(cur) + self.setData({ + currentIndex: cur + }) + //宽高比 + var scale = item.templateAreaWidth / item.templateAreaHeight + wx.chooseImage({ + count: 1, + sourceType: ['album', 'camera'], + success: function (res) { + wx.navigateTo({ + url: '/packagecard/common/corpperimg/cropperimg?imgSrc=' + res.tempFiles[0].path + '&scale=' + scale, + }) + } + }) + }, + doUploadImg(path) { + var _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }).then(res => { + wx.hideLoading({}) + res = JSON.parse(res) + var change = 'areaList[' + _self.data.currentIndex + '].templateAreaFile' + _self.setData({ + [change]: res.data + }) + wx.showToast({ + title: '上传成功', + duration: 1500 + }) + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }).catch(res => { + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }) + }, + // 编辑信息 + editInfo: function (e) { + var cur = e.currentTarget.dataset.num + var text = e.detail.value + var item = 'areaList[' + cur + '].templateAreaFontValue' + this.setData({ + [item]: text + }) + }, + // 点击内容区域获取input焦点 + giveFocus: function (e) { + var cur = e.currentTarget.dataset.cur + var item = 'areaList[' + cur + '].focus' + this.setData({ + [item]: true + }) + }, + // 非文字、图片区域换取fileid + getFileId(e) { + var self = this + var cur = e + var content = self.data.areaList[cur].templateAreaFontValue + var areaId = self.data.areaList[cur].picturesTemplateAreaId + app.http.get(app.urls.getFileId.format({ + picturesTemplateAreaId: areaId + }), { + header: { + token: app.globalData.token + }, + data: { + content: content + } + }).then(res => { + var change = 'areaList[' + cur + '].templateAreaFile' + self.setData({ + [change]: res.data.data + }) + }) + .catch(err => { + + }) + }, + +}) \ No newline at end of file diff --git a/packagecard/marketing/marketingpublish.json b/packagecard/marketing/marketingpublish.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/marketing/marketingpublish.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/marketing/marketingpublish.wxml b/packagecard/marketing/marketingpublish.wxml new file mode 100755 index 0000000..f1453f2 --- /dev/null +++ b/packagecard/marketing/marketingpublish.wxml @@ -0,0 +1,80 @@ + + 创建海报 + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + + + + {{item.templateAreaFontValue}} + + + + + + 适用行业:{{cardInfo.templateIndustryName}} + + + + + + {{item.templateAreaName}} + + 最多输入{{item.templateAreaFontLength}}个字符 + + + + + + + + + + + + {{item.templateAreaName}} + 最多输入1张图片 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/marketing/marketingpublish.wxss b/packagecard/marketing/marketingpublish.wxss new file mode 100755 index 0000000..98418e2 --- /dev/null +++ b/packagecard/marketing/marketingpublish.wxss @@ -0,0 +1,222 @@ +.card { + width: 100%; + height: 0; + position: relative; + box-sizing: border-box; + z-index: 100; + /* text-align: center; */ +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.area-box { + background: none !important; + z-index: 111; +} + +.area-box image { + width: 100%; + height: 100%; +} + +.card-info { + padding-bottom: 100rpx; + width: 100%; + margin-top: 15rpx; +} + +.card-title { + font-size: 30rpx; + background: #ffffff; + width: 100%; + padding: 15rpx; +} + +.row { + display: flex; + border-bottom: 1px solid #EEE; + background: #ffffff; + border-bottom: 1rpx solid #f5f5f5; +} + +.row-ver { + display: flex; + border-bottom: 1px solid #EEE; + border-bottom: 1rpx solid #f5f5f5; + flex-direction: column; + background-color: #ffffff; + padding: 15rpx; +} + +.row-ver:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.row-ver:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.item-title { + flex: 1; + font-size: 32rpx; + line-height: 50rpx; + color: #808080; +} + +.item-title-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 7.5rpx; +} + +.item-input { + flex: 4; + box-sizing: border-box; + display: flex; + align-items: center; + margin-top: 15rpx; +} + +.item-input input { + width: 100%; + text-align: left; + height: 50rpx; + font-size: 32rpx; + color: #333; +} + +.item-input image { + max-width: 70%; + /* max-height: 120rpx; */ +} + +.item-code-input image { + max-width: 35%; + max-height: 160rpx; +} + + + + +.hide-link { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 1000; +} + +.hide { + position: absolute; + top: 50%; + left: 50%; + width: 60%; + transform: translate(-50%, -50%); + border-radius: 10rpx; + background: #fff; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.hide-btn { + display: flex; + width: 50%; + height: 60rpx; + background: #1d7ff0; + color: #fff; + font-size: 30rpx; + justify-content: center; + align-items: center; + border-bottom-left-radius: 10rpx; + border-bottom-right-radius: 10rpx; +} + +.hide-btn:nth-child(1) { + background: #E6B980; + border-bottom-left-radius: 10rpx; + border-bottom-right-radius: 0rpx; +} + +.hide-btn:last-child { + border-bottom-left-radius: 0rpx; + border-bottom-right-radius: 10rpx; +} + +.hide-text { + font-size: 36rpx; + color: #000; + padding: 50rpx 30rpx; +} + +.hide-title { + font-size: 43rpx; + color: #ffC107; + padding: 10rpx; +} + +.hide-btn-box { + display: flex; + width: 100%; + justify-content: space-between; +} + +.input-box { + width: 100%; +} + +.content-box { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15rpx; +} + +.cuIcon-cameraadd { + font-size: 60rpx; +} + +.card-img-box { + display: flex; + flex-direction: row; + align-items: center; + margin-right: 40rpx; + justify-content: space-between; +} + +.card-img-box image { + width: 200rpx; + height: 200rpx; +} + +.hint-txt { + text-align: right; + color: #fd9494; + font-size: 24rpx; +} + +/* 换行 */ +.wrap-line { + overflow-wrap: break-word; +} + +/* 居中 */ +.wrap-center { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/packagecard/marketing/posteredit.js b/packagecard/marketing/posteredit.js new file mode 100755 index 0000000..77ff4a5 --- /dev/null +++ b/packagecard/marketing/posteredit.js @@ -0,0 +1,318 @@ +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + preview: '', + showHide: false, + isLoading: false, + isMain: '', + cardPersonId: '', + choose_index: 0, + active: 0, + cardUrl: app.urls.baseImgUrl, + areaList: [], + cardInfo: {}, + bgImg: '', + fontFamilyList: [], + useFontFamily: '', + cardId: '', + cardHeight: '', + shareTicket: '', + encryptedData: '', + iv: '', + isFromOut: false, + token: '', + oldToken: '', + imgTempSrc: '', + currentIndex: 0, + windowWidth: app.globalData.windowWidth + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var self = this + this.setData({ + cardId: options.id, + token: app.globalData.token + }) + this.getPosterDetail() + }, + onShow(e) { + if (this.data.imgTempSrc != '') { + this.doUploadImg(this.data.imgTempSrc) + } + }, + // 删除海报 + deleteCard() { + var self = this + wx.showModal({ + cancelColor: '#000', + title: '提示', + content: '确定要删除该海报吗?', + success: function (res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.deleteCard.format({ + ids: self.data.cardId + }), { + header: { + token: self.data.token + } + }).then(res => { + wx.hideLoading({}) + if (res.statusCode == '200') { + wx.showToast({ + title: '删除成功', + icon: 'success', + success() { + setTimeout(() => { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + var isDel = self.data.cardInfo.cardTemplateUseDefault == '1' + lastPage.setData({ + isRefresh: true, + isDelPage: isDel + }) + wx.navigateBack({}) + }, 500); + } + }) + } + }).catch(res => { + + }) + } + } + }) + + }, + // 更新海报 + updateCard(e) { + wx.showLoading({ + title: '修改中...', + }) + var self = this + var area = [] + for (let i = 0; i < self.data.areaList.length; i++) { + var info = { + cardTemplateUseId: self.data.areaList[i].cardTemplateUseId, + cardTemplateUseAreaId: self.data.areaList[i].cardTemplateUseAreaId, + templateAreaFile: self.data.areaList[i].templateAreaFile, + templateAreaFontValue: self.data.areaList[i].templateAreaFontValue + } + area.push(info) + } + + var postInfo = { + cardTemplateUseAreaList: area, + cardTemplateUseDefault: self.data.cardInfo.cardTemplateUseDefault, + cardTemplateUsePassword: self.data.cardInfo.cardTemplateUsePassword, + cardTemplateUseSwitch: self.data.cardInfo.cardTemplateUseSwitch, + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId + } + app.http.put(app.urls.updateMyCard.format({ + cardTemplateUseId: self.data.cardId + }), { + header: { + token: app.globalData.token + }, + data: postInfo + }).then(res => { + wx.hideLoading({}) + if (res.statusCode == '200') { + wx.showToast({ + title: '修改成功', + icon: 'success', + success() { + setTimeout(() => { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isRefresh: true + }) + wx.navigateBack({}) + }, 500) + } + }) + } + }) + .catch(err => { + + }) + }, + + //输入框失去焦点 + inputBlur(e) { + var _self = this + // templateAreaFontLength + var value = e.detail.value + var index = e.currentTarget.dataset.num + var item = e.currentTarget.dataset.item + //计算限制长度 + //最大长度 + var maxLength = item.templateAreaFontLength + if (value != '' && maxLength > 0) { + value = value.substr(0, maxLength) + //重新设置 + _self.data.areaList[index].templateAreaFontValue = value + _self.data.areaList[index].focus = false + _self.setData({ + areaList: _self.data.areaList + }) + } + //生成二维码图片 + if (item.templateAreaServerLink != '1') { + _self.getFileId(index) + } + }, + // 选择图片 + choosePhoto: function (e) { + var self = this + var cur = e.currentTarget.dataset.cur + var item = e.currentTarget.dataset.item + self.setData({ + currentIndex: cur + }) + //宽高比 + var scale = item.templateAreaWidth / item.templateAreaHeight + wx.chooseImage({ + count: 1, + sourceType: ['album', 'camera'], + success: function (res) { + wx.navigateTo({ + url: '/packagecard/common/corpperimg/cropperimg?imgSrc=' + res.tempFiles[0].path + '&scale=' + scale, + }) + } + }) + }, + doUploadImg(path) { + var _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }).then(res => { + wx.hideLoading({}) + res = JSON.parse(res) + var change = 'areaList[' + _self.data.currentIndex + '].templateAreaFile' + _self.setData({ + [change]: res.data + }) + wx.showToast({ + title: '上传成功', + duration: 1500 + }) + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }).catch(res => { + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }) + }, + // 获取海报信息 + getPosterDetail() { + var self = this; + app.http.get(app.urls.getMyCardDetail.format({ + cardTemplateUseId: self.data.cardId + }), { + header: { + token: app.globalData.token + }, + data: {} + }).then(res => { + var area = res.data.areaList + var scale = res.data.cardTemplateUseWidth / self.data.windowWidth + res.data.cardTemplateUseWidth = res.data.cardTemplateUseWidth / scale + res.data.cardTemplateUseHeight = res.data.cardTemplateUseHeight / scale + for (let i = 0; i < area.length; i++) { + area[i].templateAreaFontSize = area[i].templateAreaFontSize / scale + 'px' + area[i].templateAreaHeight = area[i].templateAreaHeight / scale + area[i].templateAreaWidth = area[i].templateAreaWidth / scale + area[i].templateAreaDown = area[i].templateAreaDown / scale + area[i].templateAreaTop = area[i].templateAreaTop / scale + area[i].templateAreaRight = area[i].templateAreaRight / scale + area[i].templateAreaLeft = area[i].templateAreaLeft / scale + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + } + self.setData({ + cardInfo: res.data, + areaList: area + }) + }) + .catch(err => { + + }) + }, + // 编辑信息 + editInfo: function (e) { + var cur = e.currentTarget.dataset.num + var text = e.detail.value + var item = 'areaList[' + cur + '].templateAreaFontValue' + this.setData({ + [item]: text + }) + }, + // 点击内容区域获取input焦点 + giveFocus(e) { + var cur = e.currentTarget.dataset.cur + var item = 'areaList[' + cur + '].focus' + this.setData({ + [item]: true + }) + }, + // 非文字、图片区域换取fileid + getFileId(index) { + var self = this + var cur = index + var content = self.data.areaList[cur].templateAreaFontValue + var areaId = self.data.areaList[cur].picturesTemplateAreaId + app.http.get(app.urls.getFileId.format({ + picturesTemplateAreaId: areaId + }), { + header: { + token: app.globalData.token + }, + data: { + content: content + } + }).then(res => { + console.log(res.data) + var change = 'areaList[' + cur + '].templateAreaFile' + self.setData({ + [change]: res.data.data + }) + }) + .catch(err => { + + }) + }, + +}) \ No newline at end of file diff --git a/packagecard/marketing/posteredit.json b/packagecard/marketing/posteredit.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/marketing/posteredit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/marketing/posteredit.wxml b/packagecard/marketing/posteredit.wxml new file mode 100755 index 0000000..1701d55 --- /dev/null +++ b/packagecard/marketing/posteredit.wxml @@ -0,0 +1,82 @@ + + 海报 + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + 适用行业:{{cardInfo.templateIndustryName}} + + + + + + {{item.templateAreaName}} + + 最多输入{{item.templateAreaFontLength}}个字符 + + + + + + + + + + + {{item.templateAreaName}} + 最多输入1张图片 + + + + + + + + + + + + 提交修改 + 删除海报 + \ No newline at end of file diff --git a/packagecard/marketing/posteredit.wxss b/packagecard/marketing/posteredit.wxss new file mode 100755 index 0000000..89ac72d --- /dev/null +++ b/packagecard/marketing/posteredit.wxss @@ -0,0 +1,220 @@ +.card { + width: 100%; + height: 0; + position: relative; + box-sizing: border-box; + z-index: 100; + /* text-align: center; */ + } + + .card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + + .area-box { + white-space: nowrap; + background: none !important; + z-index: 111; + } + + .area-box image { + width: 100%; + height: 100%; + } + + .card-info { + padding-bottom: 100rpx; + width: 100%; + margin-top: 15rpx; + } + + .card-title { + font-size: 30rpx; + background: #ffffff; + width: 100%; + padding: 15rpx; + } + + .row { + display: flex; + border-bottom: 1px solid #EEE; + background: #ffffff; + border-bottom: 1rpx solid #f5f5f5; + } + + .row-ver { + display: flex; + border-bottom: 1px solid #EEE; + border-bottom: 1rpx solid #f5f5f5; + flex-direction: column; + background-color: #ffffff; + padding: 15rpx; + } + + .row-ver:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; + } + + .row-ver:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; + } + + .item-title { + flex: 1; + font-size: 32rpx; + line-height: 50rpx; + color: #808080; + } + + .item-title-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 7.5rpx; + } + + .item-input { + flex: 4; + box-sizing: border-box; + display: flex; + align-items: center; + margin-top: 15rpx; + } + + .item-input input { + width: 100%; + text-align: left; + height: 50rpx; + font-size: 32rpx; + color: #333; + } + + .item-input image { + max-width: 70%; + /* max-height: 120rpx; */ + } + + .item-code-input image { + max-width: 35%; + max-height: 160rpx; + } + + + + + .hide-link { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 1000; + } + + .hide { + position: absolute; + top: 50%; + left: 50%; + width: 90%; + transform: translate(-50%, -50%); + border-radius: 10rpx; + background: #fff; + } + + .hide-btn { + display: flex; + width: 49%; + height: 60rpx; + background: #1296db; + color: #fff; + font-size: 30rpx; + border-radius: 10rpx; + justify-content: center; + align-items: center; + } + + .hide-text { + font-size: 30rpx; + color: #000; + } + + .hide-btn-box { + display: flex; + justify-content: space-between; + } + + .input-box { + width: 100%; + } + + .content-box { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15rpx; + } + + .cuIcon-cameraadd { + font-size: 60rpx; + } + + .card-img-box { + display: flex; + flex-direction: row; + align-items: center; + margin-right: 40rpx; + justify-content: space-between; + } + + .card-img-box image { + width: 200rpx; + height: 200rpx; + } + + .hint-txt { + text-align: right; + color: #fd9494; + font-size: 24rpx; + } + + .share { + padding: 15rpx 15rpx; + text-align: center; + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: #fff; + z-index: 1000; + } + + .share .btn { + display: inline-block; + width: 32% !important; + background: #0054bd; + color: #fff; + margin-right: 2%; + font-size: 28rpx; + font-weight: normal; + height: 70rpx; + line-height: 70rpx; + text-align: center; + border-radius: 10rpx; + } + + .share .btn:nth-child(1) { + background: coral; + } + + .share .btn:last-child { + margin-right: 0; + background: #ff2525; + } \ No newline at end of file diff --git a/packagecard/moments/edit/momentedit.js b/packagecard/moments/edit/momentedit.js new file mode 100755 index 0000000..2d2c2d7 --- /dev/null +++ b/packagecard/moments/edit/momentedit.js @@ -0,0 +1,1234 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +var location = { + latitude: 39.89631551, + longitude: 116.323459711 +}; +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + uploadCount: 0, + uploadVideoCount: 0, + currentIndex: 0, + columnId: '', //栏目Id + uId: '', //内容UID + fieldList: [], //栏目字段 + textList: [], //文本添加内容 + textareaList: [], //文本域添加内容 + audioList: [], //音频添加内容 + videoList: [], //视频添加内容 + photoList: [], //视频添加内容 + linkList: [], //连接添加内容 + locationList: [], //定位添加内容 + isShowText: false, //文本弹窗开关 + isShowDesc: false, //文本域弹窗开关 + isShowPhoto: false, //图片选择弹框 + isShowLink: false, //链接弹窗 + isShowAudio: false, //录音弹窗 + isShowVideo: false, //视频弹窗 + isShowTags: false, //多选 + isShowType: false, + tempText: '', + tempDesc: '', + linkStr: '', + map: null, + waitFlag: false, + isStartRecord: false, //是否录音中 + speck_time: 0, + speedStep: 5, //快进快退秒数 + setInter: '', //定时器 + currentItem: undefined, + isAuthAudio: false, + title: '栏目内容修改', + curLat: 0.00, + curLng: 0.00, + isRecording: false, + maxDuration: 60, //上传视频大小限制 + displayType: [{ + name: '九宫格', + id: 1 + }, { + name: '轮播', + id: 2 + }, { + name: '轮播(自动)', + id: 3 + }, { + name: '平铺', + id: 4 + }, ], //图片展示方式 + selDisplayType: 1, //图片展示方式 + displayTypeStr: '九宫格', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + columnId: options.id, + uId: options.uid, + title: options.title + '修改' + }) + var _self = this + wx.getLocation({ + success(res) { + _self.setData({ + curLat: res.latitude, + curLng: res.longitude + }) + } + }) + this.checkPermission() + this.getMomentContent() + }, + getMomentContent() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMomentsContent.format({ + configColumnId: _self.data.columnId, + uid: _self.data.uId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //构建数据 + _self.buildDetail(res.data) + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + }, + //构建展示数据 + buildDetail(data) { + var _self = this + data.list.forEach(it => { + switch (it.dataType) { + case '2': //图片 + var photoIds = it.value.split('@') + var items = photoIds[0].split(',') + if (photoIds.length > 1) { + switch (photoIds[1]) { + case '1': //九宫格 + _self.setData({ + selDisplayType: '1', //图片展示方式 + displayTypeStr: '九宫格', + }) + break + case '2': //轮播 + _self.setData({ + selDisplayType: '2', //图片展示方式 + displayTypeStr: '轮播', + }) + break + case '3': //轮播自动 + _self.setData({ + selDisplayType: '3', //图片展示方式 + displayTypeStr: '轮播(自动)', + }) + break + case '4': //平铺 + _self.setData({ + selDisplayType: '4', //图片展示方式 + displayTypeStr: '平铺', + }) + break + } + } + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '4': //视频 + var items = it.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i].length > 0) { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + id: ss[0], + thumbId: ss[1], + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + it.valueList = tempList + break + case '3': //音频 + var items = it.value.split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var ss = item.split('&') + var totalStr = '00:00' + var duration = 100 + if (ss.length > 1) { + var dur = ss[1] + duration = dur + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + + var tempItem = { + id: ss[0], //id + path: app.urls.baseImgUrl + ss[0], //地址 + isPlay: false, //是否播放中 + duration: duration, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '6': //定位 + var items = it.value.split('-') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '8': //单选 + it.dictionariesList.forEach(ss => { + if (it.value.indexOf(ss.dataId) != -1) { + it.selValue = ss.dataName + } + }) + break + case '9': + var selValue = '' + it.dictionariesList.forEach(ss => { + if (it.value.indexOf(ss.dataId) != -1) { + selValue += ss.dataName + ',' + ss.isSel = true + } else { + ss.isSel = false + } + }) + selValue = selValue.substr(0, selValue.length - 1) + it.selValue = selValue + break + } + }) + _self.setData({ + fieldList: data.list + }) + }, + showMutliSel(e) { + this.setData({ + isShowTags: true, + currentIndex: e.currentTarget.dataset.index + }) + }, + //单选 + pickerChange(e) { + var _self = this + var index = e.currentTarget.dataset.index + var selIndex = e.detail.value + _self.data.fieldList[index].index = selIndex + _self.data.fieldList[index].value = _self.data.fieldList[index].dictionariesList[selIndex].dataId + _self.data.fieldList[index].selValue = _self.data.fieldList[index].dictionariesList[selIndex].dataName + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + inputText(e) { + var index = e.currentTarget.dataset.index + var _self = this + _self.data.fieldList[index].value = e.detail.value + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + onShow() { + if (chooseLocation.getLocation() != null) { + var item = this.data.fieldList[this.data.curMapIndex] + if (item.valueList.length < item.maxCount) { + this.data.fieldList[this.data.curMapIndex].valueList.push(chooseLocation.getLocation()) + this.setData({ + fieldList: this.data.fieldList + }) + } + } + var _self = this + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + }, + //选择视频来源 + chooseVideo(e) { + var _self = this + var item = e.currentTarget.dataset.item + var countNum = item.maxCount - item.valueList.length + var index = e.currentTarget.dataset.index + wx.chooseMedia({ + count: Number.parseInt(countNum), + mediaType: ['video'], + sourceType: ['camera', 'album'], + maxDuration: 60, + success: (res) => { + if (res.tempFiles.length > 0) { + if (res.tempFiles[0].duration <= _self.data.maxDuration) { + _self.doUploadVideo(index, res.tempFiles, _self.data.uploadVideoCount) + } else { + wx.showToast({ + title: '视频最长60秒', + icon: 'none' + }) + } + } + }, + fail: (err) => { + // console.log(err) + // wx.showToast({ + // title: '选取视频失败,(拍摄时长:60秒)', + // icon: 'none' + // }) + } + }) + }, + //上传视频 + doUploadVideo(fieldIndex, paths, videoCount) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadVideoCount < count) { + app.http.upload(app.urls.doUploadVideo, { + path: paths[_self.data.uploadVideoCount].tempFilePath, + name: 'video', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + _self.doUploadVideoImg(fieldIndex, id, paths, _self.data.uploadVideoCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, paths, _self.data.uploadVideoCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: 0 + }) + } + }, + //上传视频封面图片 + doUploadVideoImg(fieldIndex, videoId, videos, videoCount) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + path: videos[_self.data.uploadVideoCount].thumbTempFilePath, + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + console.log(res) + wx.hideLoading({}) + var videoUrl = app.urls.baseImgUrl + videoId + var thumbImg = app.urls.baseImgUrl + JSON.parse(res).data + var thumbI = JSON.parse(res).data + var item = { + id: videoId, + thumbId: thumbI, + path: videoUrl, + imgPath: thumbImg + } + _self.data.fieldList[fieldIndex].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, videos, _self.data.uploadVideoCount) + }) + .catch(err => { + console.log(err) + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, videos, _self.data.uploadVideoCount) + }) + }, + //预览视频 + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //删除视频 + delVideo(e) { + let _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[index].valueList.splice(idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + //添加链接 + addLink() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'LINK') { + item = _self.data.items[i] + break + } + } + if (_self.data.linkList.length < item.count) { + if (_self.data.linkStr == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.linkList.push(_self.data.linkStr) + _self.setData({ + linkList: _self.data.linkList, + linkStr: '' + }) + if (_self.data.linkList.length == item.count) { + _self.setData({ + isShowLink: false + }) + } + } + }, + //文本域添加输入的文字 + addDesc() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXTAREA') { + item = _self.data.items[i] + break + } + } + if (_self.data.textareaList.length < item.count) { + if (_self.data.tempDesc == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textareaList.push(_self.data.tempDesc) + _self.setData({ + textareaList: _self.data.textareaList, + tempDesc: '' + }) + if (_self.data.textareaList.length == item.count) { + _self.setData({ + isShowDesc: false + }) + } + } + }, + //添加输入的文字 + addStr() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXT') { + item = _self.data.items[i] + break + } + } + if (_self.data.textList.length < item.count) { + if (_self.data.tempText == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textList.push(_self.data.tempText) + _self.setData({ + textList: _self.data.textList, + tempText: '' + }) + if (_self.data.textList.length == item.count) { + _self.setData({ + isShowText: false + }) + } + } + }, + //删除 + delText(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textList: this.data.textList + }) + } + } + }) + }, + delLink(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.linkList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + linkList: this.data.linkList + }) + } + } + }) + }, + delDesc(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textareaList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textareaList: this.data.textareaList + }) + } + } + }) + }, + //确定选择图片展示方式 + confirmSel(e) { + const { + piacker, + value + } = e.detail + this.setData({ + selDisplayType: value.id, + displayTypeStr: value.name, + isShowType: false + }) + }, + //取消选择展示方式 + cancelSel(e) { + this.setData({ + isShowType: false + }) + }, + //监听输入的文字 + textInput(e) { + this.setData({ + [e.currentTarget.id]: e.detail.value + }) + }, + //关闭弹窗 + onHide(e) { + this.setData({ + isShowText: false, + isShowDesc: false, + isShowPhoto: false, + isShowLink: false, + isShowAudio: false, + isShowVideo: false, + isShowTags: false + }) + }, + + chooseTags(e) { + var _self = this + var index = e.currentTarget.dataset.idx + _self.data.fieldList[_self.data.currentIndex].dictionariesList[index].isSel = !_self.data.fieldList[_self.data.currentIndex].dictionariesList[index].isSel + _self.setData({ + fieldList: _self.data.fieldList + }) + var value = '' + var ids = '' + _self.data.fieldList[_self.data.currentIndex].dictionariesList.forEach(it => { + if (it.isSel) { + value += it.dataName + ',' + ids += it.dataId + ',' + } + }) + value = value.substr(0, value.length - 1) + ids = ids.substr(0, ids.length - 1) + _self.data.fieldList[_self.data.currentIndex].selValue = value + _self.data.fieldList[_self.data.currentIndex].value = ids + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + selTags() { + this.setData({ + isShowTags: false + }) + }, + //选择图片 + choosePhoto(e) { + var _self = this + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + var countNum = item.maxCount - item.valueList.length + + wx.chooseImage({ + count: Number.parseInt(countNum), + sourceType: ['album', 'camera'], + success: (res) => { + _self.doUploadImg(index, res.tempFilePaths, _self.data.uploadCount) + }, + fail: (err) => { + + } + }) + }, + //删除图片 + delImg(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.fieldList[e.currentTarget.dataset.itemindex].valueList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + fieldList: this.data.fieldList + }) + } + } + }) + }, + //预览图片 + viewImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + doUploadImg(index, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadCount < count) { + app.http.upload(app.urls.doUploadImg, { + path: paths[_self.data.uploadCount], + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr + } + _self.data.fieldList[index].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadCount: 0 + }) + } + }, + //地图选点 + chooseLocation(e) { + var index = e.currentTarget.dataset.index + this.setData({ + curMapIndex: index + }) + var curLoc = JSON.stringify(location) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${curLoc}&category=${category}` + }); + }, + delMap(e) { + var _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[e.currentTarget.dataset.index].valueList.splice(e.currentTarget.dataset.idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + //删除视频 + delAudio(e) { + console.log(e) + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该音频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[e.currentTarget.dataset.index].valueList.splice(e.currentTarget.dataset.idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + doStartRecord() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.startRecord() + } + }) + } else { + _self.startRecord() + } + } + }) + }, + startRecord() { + var that = this + that.data.setInter = setInterval( + function () { + var speck_time = parseInt(that.data.speck_time + 1); + that.setData({ + speck_time: parseInt(speck_time), + isStartRecord: true + }); + if (that.data.speck_time > 0 && that.data.speck_time <= 59) { + that.start(); + } else { + clearInterval(that.data.setInter); + // 获取到结束时间 + that.stop(); + wx.showToast({ + title: '录音最长60S哦!', + duration: 2000, + icon: "none" + }) + } + }, 1000); + }, + doEndRecord() { + var _self = this; + clearInterval(_self.data.setInter); + // 获取到结束时间 + if (_self.data.speck_time > 3) { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(true); + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } else { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(false); + wx.showToast({ + title: '录制时间过短', + duration: 2000, + icon: "none" + }) + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } + }, + //开始录音的时候 + start() { + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //停止录音 + stop(success) { + var _self = this + recorderManager.stop(); + recorderManager.onStop((res) => { + if (success) { + //进行录音文件上传 + _self.doUploadAudio(res) + } + }) + }, + doUploadAudio(audio) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadAudio, { + path: audio.tempFilePath, + name: 'audio', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (_self.data.fieldList[_self.data.currentIndex].valueList.length < _self.data.currentItem.maxCount) { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + //计算时长 + var dur = parseInt(audio.duration / 1000) + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + var totalStr = totalMStr + ':' + totalSStr + var item = { + id: id, //id + path: pathStr, //地址 + isPlay: false, //是否播放中 + duration: dur, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + _self.data.fieldList[_self.data.currentIndex].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + if (_self.data.fieldList[_self.data.currentIndex].valueList.length == _self.data.currentItem.maxCount) { + _self.setData({ + isShowAudio: false + }) + } + } + }) + .catch(err => {}) + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + _self.data.fieldList[index].valueList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.fieldList[index].valueList[idx].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.fieldList[index].valueList[idx].isPlay = true + _self.setData({ + fieldList: _self.data.fieldList + }) + }); + + innerAudioContext.onCanplay((res) => { + // if (_self.data.waitFlag) { + // innerAudioContext.play() + // _self.setData({ + // waitFlag: false + // }) + // } + }) + innerAudioContext.onStop((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + // innerAudioContext.pause() + // _self.setData({ + // waitFlag: true + // }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.fieldList[index].valueList[idx].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.fieldList[index].valueList[idx].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.fieldList[index].valueList[idx].curDurationStr = curMStr + ':' + curSStr + _self.data.fieldList[index].valueList[idx].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + + }, + //快进5秒 + speed(e) { + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }, + slider4change(e) { + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //显示弹框 + showDialog(e) { + console.log(e) + this.setData({ + isShowAudio: true, + currentItem: e.currentTarget.dataset.item, + currentIndex: e.currentTarget.dataset.index + }) + }, + //提交保存 + doPublish() { + var _self = this + if (_self.checkParams()) { + wx.showToast({ + title: '保存中...', + }) + var params = _self.buildParams() + console.log(params) + app.http.post(app.urls.doSaveMoments.format({ + configColumnId: _self.data.columnId + }), { + data: params, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pages = getCurrentPages(); + let beforePage = pages[pages.length - 2]; + beforePage.setData({ + isRefresh: true + }) + wx.navigateBack({ + delta: 1 + }) + }) + .catch(err => { + console.log(err) + }) + } + }, + //校验参数 + checkParams() { + var _self = this + var isLegal = true + for (var i = 0; i < _self.data.fieldList.length; i++) { + var field = _self.data.fieldList[i] + if (field.must) { + if (field.dataType == '1' || field.dataType == '7' || field.dataType == '8' || field.dataType == '9') { + if (field.value.length <= 0) { + wx.showToast({ + title: '请输入或选择' + field.comment, + icon: 'none' + }) + isLegal = false + break + } + } else { + if (field.valueList.length <= 0) { + wx.showToast({ + title: '请上传' + field.comment, + icon: 'none' + }) + isLegal = false + break + } + } + } + } + return isLegal + }, + //构建提交参数 + buildParams() { + var _self = this + var params = { + uid: _self.data.uId + } + for (var i = 0; i < _self.data.fieldList.length; i++) { + var field = _self.data.fieldList[i] + if (field.dataType == '1' || field.dataType == '7' || field.dataType == '8' || field.dataType == '9') { + if (field.value.length > 0) { + params[field.name] = field.value + } + } else { + if (field.valueList.length > 0) { + var ids = "" + if (field.dataType == '6') { + field.valueList.forEach(it => { + ids += it.latitude + ',' + it.longitude + '-' + }) + } else if (field.dataType == '4') { + field.valueList.forEach(it => { + ids += it.id + '&' + it.thumbId + ',' + }) + } else if (field.dataType == '3') { + field.valueList.forEach(it => { + ids += it.id + '&' + it.duration + ',' + }) + } else if (field.dataType == '2') { //图片 + field.valueList.forEach(it => { + ids += it.id + ',' + }) + ids = ids.substr(0, ids.length - 1) + ids += '@' + _self.data.selDisplayType + } else { + field.valueList.forEach(it => { + ids += it.id + ',' + }) + } + if (field.dataType != '2') { + ids = ids.substr(0, ids.length - 1) + } + params[field.name] = ids + } + } + } + return params + }, + //显示图片展示方式 + showDisplayType(e) { + this.setData({ + isShowType: true + }) + }, +}) \ No newline at end of file diff --git a/packagecard/moments/edit/momentedit.json b/packagecard/moments/edit/momentedit.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/edit/momentedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/edit/momentedit.wxml b/packagecard/moments/edit/momentedit.wxml new file mode 100755 index 0000000..863a1d3 --- /dev/null +++ b/packagecard/moments/edit/momentedit.wxml @@ -0,0 +1,323 @@ + + {{title}} + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + + + + {{item.comment}}{{item.valueList.length}}/{{item.maxCount}} + + + + + {{displayTypeStr}} + + + + + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + 语音,可以给名片访客留下更深的印象 + + + 点击添加 + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + + 在地图上选取一个地点 + + + 点击添加 + + + + + + {{item.comment}} + + + {{item.selValue}} + + + + + + + + {{item.comment}} + + + {{item.selValue}} + + + + + + + + + + + + + + + + + + + + + 00:{{speck_time>9 ? speck_time : '0'+ speck_time}} + 长按录音 + + + + + {{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}} + + 点击播放 + 删除 + + + + + + + + 点击添加 + + + + + + + 点击添加 + + + + + + + 相册 + + + 相机 + + + + + + + + 相册 + + + 相机 + + + + + + + + + 点击添加 + + + + + + + + + + {{item.dataName}} + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/moments/edit/momentedit.wxss b/packagecard/moments/edit/momentedit.wxss new file mode 100755 index 0000000..1d8e84c --- /dev/null +++ b/packagecard/moments/edit/momentedit.wxss @@ -0,0 +1,58 @@ +/* pages/moments/publish/momentpublish.wxss */ + + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} + +.item-bottom-margin { + margin-bottom: 15rpx; + width: 100%; +} + +.item-padding { + padding: 15rpx; +} \ No newline at end of file diff --git a/packagecard/moments/list/momentslist.js b/packagecard/moments/list/momentslist.js new file mode 100755 index 0000000..9f651f7 --- /dev/null +++ b/packagecard/moments/list/momentslist.js @@ -0,0 +1,430 @@ +// pages/moments/list/momentslist.js +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + + /** + * 页面的初始数据 + */ + data: { + columnId: '', + type: '', + speedStep: 5, //快进快退秒数 + waitFlag: false, + configMode: '2', //1单条数据 2多条数据 + dataList: [], + count: 2, + isLoadMore: false, + imgUrl: app.urls.baseImgUrl, + isRefresh: false, + title: '栏目内容' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let _self = this + console.log(options.mode) + _self.setData({ + columnId: options.id, + configMode: options.mode, + type: options.type, + title: options.title + }) + _self.getList() + }, + onShow() { + if (this.data.isRefresh) { + wx.startPullDownRefresh({}) + this.setData({ + isRefresh: false + }) + } + }, + //获取栏目数据 + getList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMomentsList.format({ + configColumnId: _self.data.columnId + }), { + header: { + token: app.globalData.token + }, + data: { + backSystem: 'backSystem' + } + }) + .then(res => { + wx.hideLoading({}) + // 构建数据 + // 1:文字,2:照片,3:音频,4:视频,5:链接,6:定位,7:文章 + res.data.forEach(it => { + it.list.forEach(item => { + switch (item.dataType) { + case '2': //图片 + var photoIds = item.value.split('@') + var items = photoIds[0].split(',') + if (photoIds.length > 1) { + item.dataMode = photoIds[1] + } else { + item.dataMode = '1' + } + // var items = item.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i] != '') { + var urls = _self.data.imgUrl + items[i] + var tempItem = { + path: urls, + imgPath: '../../../images/ic_temp.png' + } + tempList.push(tempItem) + } + } + item.valueList = tempList + break + case '4': //视频 + var items = item.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i] != '') { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + item.valueList = tempList + break + case '6': //定位 + var items = item.value.split('-') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i] != '') { + //截取经纬度 + var latlng = items[i].split(',') + var tempItem = { + latitude: latlng[0], //纬度 + longitude: latlng[1], //经度 + } + tempList.push(tempItem) + } + } + item.valueList = tempList + break + case '3': //音频 + var items = item.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i] != '') { + var ss = items[i].split('&') + var totalStr = '00:00' + if (ss.length > 1) { + var dur = ss[1] + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + var urls = _self.data.imgUrl + ss[0] + var tempItem = { + path: urls, //地址 + isPlay: false, //是否播放中 + duration: 100, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + } + item.valueList = tempList + break + case '8': //单选 + item.dictionariesList.forEach(ss => { + if (item.value.indexOf(ss.dataId) != -1) { + item.selValue = ss.dataName + } + }) + break + case '9': + item.dictionariesList.forEach(ss => { + if (item.value.indexOf(ss.dataId) != -1) { + ss.isSel = true + } else { + ss.isSel = false + } + }) + break + } + }) + }) + _self.setData({ + dataList: res.data + }) + wx.stopPullDownRefresh({}) + }) + .catch(err => { + console.log(err) + wx.stopPullDownRefresh({}) + }) + }, + //展开更多 + toggleHandler: function (e) { + var that = this; + var index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.trendsList.length; i++) { + if (index == i) { + that.data.trendsList[index].auto = true; + that.data.trendsList[index].seeMore = false; + } + } + that.setData({ + trendsList: that.data.trendsList + }) + }, + //收起更多 + toggleContent: function (e) { + var that = this; + var index = e.currentTarget.dataset.index; + for (var i = 0; i < that.data.trendsList.length; i++) { + if (index == i) { + that.data.trendsList[index].auto = true; + that.data.trendsList[index].seeMore = true; + } + } + that.setData({ + trendsList: that.data.trendsList + }) + }, + //预览图片 + viewImg(e) { + wx.previewImage({ + urls: [e.currentTarget.dataset.url], + }) + }, + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + onPullDownRefresh() { + this.getList() + }, + onReachBottom() { + console.log('触底了') + }, + play(e) { + //进行播放 + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var ix = e.currentTarget.dataset.i + var _self = this + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + if (item.valueList) { + item.valueList.forEach(ii => { + if (ii.isPlay) { + innerAudioContext.stop() + } + ii.isPlay = false + ii.curDuation = 0 + ii.curDuationStr = '00:00' + }) + } + }) + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + + // 播放音频文件 + innerAudioContext.src = _self.data.dataList[index].list[idx].valueList[ix].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.dataList[index].list[idx].valueList[ix].isPlay = true + _self.setData({ + dataList: _self.data.dataList + }) + }); + + innerAudioContext.onCanplay((res) => { + // if (_self.data.waitFlag) { + // innerAudioContext.play() + // _self.setData({ + // waitFlag: false + // }) + // } + }) + innerAudioContext.onStop((res) => { + _self.data.dataList[index].list[idx].valueList[ix].isPlay = false + _self.data.dataList[index].list[idx].valueList[ix].curDuration = 0 + _self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.dataList[index].list[idx].valueList[ix].isPlay = false + _self.data.dataList[index].list[idx].valueList[ix].curDuration = 0 + _self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.dataList[index].list[idx].valueList[ix].isPlay = false + _self.data.dataList[index].list[idx].valueList[ix].curDuration = 0 + _self.data.dataList[index].list[idx].valueList[ix].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + // innerAudioContext.pause() + // _self.setData({ + // waitFlag: true + // }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.dataList[index].list[idx].valueList[ix].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.dataList[index].list[idx].valueList[ix].duration = parseInt(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.dataList[index].list[idx].valueList[ix].curDurationStr = curMStr + ':' + curSStr + _self.data.dataList[index].list[idx].valueList[ix].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + dataList: _self.data.dataList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //删除 + delItem(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.doDelMoment(e.currentTarget.dataset.index) + } + } + }) + }, + doDelMoment(index) { + var _self = this + wx.showLoading({ + title: '删除中...', + }) + var item = _self.data.dataList[index] + app.http.delete(app.urls.doDelMoment.format({ + configColumnId: _self.data.columnId, + uid: item.uid + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + this.data.dataList.splice(index, 1) + this.setData({ + dataList: this.data.dataList + }) + wx.startPullDownRefresh({}) + }) + .catch(err => { + console.log(err) + wx.hideLoading({}) + }) + }, + doPublish() { + wx.navigateTo({ + url: '../publish/momentpublishline?id=' + this.data.columnId + '&title=' + this.data.title + }) + }, + editMoment(e) { + var _self = this + var item = _self.data.dataList[e.currentTarget.dataset.index] + wx.navigateTo({ + url: '../edit/momentedit?id=' + _self.data.columnId + '&uid=' + item.uid + '&title=' + _self.data.title + }) + }, + onUnload(e) { + if (innerAudioContext) { + innerAudioContext.stop() + } + } +}) \ No newline at end of file diff --git a/packagecard/moments/list/momentslist.json b/packagecard/moments/list/momentslist.json new file mode 100755 index 0000000..7360326 --- /dev/null +++ b/packagecard/moments/list/momentslist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/packagecard/moments/list/momentslist.wxml b/packagecard/moments/list/momentslist.wxml new file mode 100755 index 0000000..0c2c7f6 --- /dev/null +++ b/packagecard/moments/list/momentslist.wxml @@ -0,0 +1,140 @@ + + {{title}} + + + + + + 发表时间:{{item.gmtCreate}} + + + + + + 该条数据存在违规内容,请修改后重新发布. + 违规描述:{{item.checkRemark}} + + + + + + + + + {{columnId == 'de7b5e22-64f9-4c60-a1f9-6ac004dfb9a8' ? child.comment+':' :'' + }}{{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.selValue}} + + + + + + + + + {{item.dataName}} + + + + + + + + + + + + + + + + 加载中... + \ No newline at end of file diff --git a/packagecard/moments/list/momentslist.wxss b/packagecard/moments/list/momentslist.wxss new file mode 100755 index 0000000..bf35bc3 --- /dev/null +++ b/packagecard/moments/list/momentslist.wxss @@ -0,0 +1,87 @@ +/* pages/moments/list/momentslist.wxss */ + +.box { + margin: 0rpx 10rpx; +} + +.text_box { + width: 100%; + font-size: 30rpx; + font-weight: 400; + line-height: 48rpx; +} + +.textFour_box { + width: 100%; + font-size: 30rpx; + font-weight: 400; + line-height: 26px; + text-align: justify; +} + +.toggle-icon { + width: 25rpx; + height: 25rpx; +} + +.text_toggloe_box { + display: flex; + justify-content: left; + flex-direction: row; + align-items: center; + margin: 10rpx 0; +} + +.text_toggle_text { + font-size: 30rpx; + line-height: 32rpx; + margin-right: 10rpx; + color: black; +} + +.three { + text-overflow: -o-ellipsis-lastline; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 3; + line-clamp: 3; + -webkit-box-orient: vertical; +} + +.item-box { + margin: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.item-box:nth-child(1) { + margin: 15rpx 15rpx 7.5rpx 15rpx; +} + +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.column-item { + margin: 0rpx; + padding: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} \ No newline at end of file diff --git a/packagecard/moments/list/momentsshowlist.js b/packagecard/moments/list/momentsshowlist.js new file mode 100755 index 0000000..9c95fab --- /dev/null +++ b/packagecard/moments/list/momentsshowlist.js @@ -0,0 +1,19 @@ +// pages/moments/list/momentsshowlist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + url: 'https://cbc.wgink.ink/systemcard/app/cardconfigarticle/listrelease?token=' + app.globalData.token + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + +}) \ No newline at end of file diff --git a/packagecard/moments/list/momentsshowlist.json b/packagecard/moments/list/momentsshowlist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/list/momentsshowlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/list/momentsshowlist.wxml b/packagecard/moments/list/momentsshowlist.wxml new file mode 100755 index 0000000..8f7ecf7 --- /dev/null +++ b/packagecard/moments/list/momentsshowlist.wxml @@ -0,0 +1,7 @@ + + + 详情 + + + + diff --git a/packagecard/moments/list/momentsshowlist.wxss b/packagecard/moments/list/momentsshowlist.wxss new file mode 100755 index 0000000..4234541 --- /dev/null +++ b/packagecard/moments/list/momentsshowlist.wxss @@ -0,0 +1 @@ +/* pages/moments/list/momentsshowlist.wxss */ \ No newline at end of file diff --git a/packagecard/moments/momentsdetail/momentsdetail.js b/packagecard/moments/momentsdetail/momentsdetail.js new file mode 100755 index 0000000..085aa09 --- /dev/null +++ b/packagecard/moments/momentsdetail/momentsdetail.js @@ -0,0 +1,668 @@ +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + data: { + dataList: [], + speedStep: 5, //快进快退秒数 + waitFlag: false, + avatarUrl: app.globalData.userInfo.avatarUrl, + imgUrl: app.urls.baseImgUrl, + uId: '', + columnId: '', + publishTime: '' + }, + onLoad(options) { + var _self = this + this.setData({ + uId: options.uId, + columnId: options.cId + }) + _self.getMainMoment() + }, + + + getMainMoment() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMomentsContent.format({ + configColumnId: _self.data.columnId, + uid: _self.data.uId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //构建数据 + _self.buildDetail(res.data) + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + }, + //构建展示数据 + buildDetail(data) { + var _self = this + _self.setData({ + publishTime: data.gmtCreate + }) + data.list.forEach(it => { + switch (it.dataType) { + case '2': //图片 + var items = it.value.split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '4': //视频 + var items = it.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i].length > 0) { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + it.valueList = tempList + break + case '3': //音频 + var items = it.value.split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var ss = item.split('&') + var totalStr = '00:00' + if (ss.length > 1) { + var dur = ss[1] + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + var tempItem = { + id: ss[0], //id + path: app.urls.baseImgUrl + ss[0], //地址 + isPlay: false, //是否播放中 + duration: 100, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '6': //定位 + var items = it.value.split('-') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + } + }) + it.valueList = tempList + break + case '8': //单选 + it.dictionariesList.forEach(ss => { + if (it.value.indexOf(ss.dataId) != -1) { + it.selValue = ss.dataName + } + }) + break + case '9': + var selValue = '' + it.dictionariesList.forEach(ss => { + if (it.value.indexOf(ss.dataId) != -1) { + selValue += ss.dataName + ',' + ss.isSel = true + } else { + ss.isSel = false + } + }) + selValue = selValue.substr(0, selValue.length - 1) + it.selValue = selValue + break + } + }) + _self.setData({ + dataList: data.list + }) + }, + + //预览图片 + viewImg(e) { + wx.previewImage({ + urls: [e.currentTarget.dataset.url], + }) + }, + //预览视频 + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + play(e) { + //进行播放 + const _self = this + const index = e.currentTarget.dataset.index + const ix = e.currentTarget.dataset.i + const a = e.currentTarget.dataset.a + var audio = e.currentTarget.dataset.item + //先需要停止其他录音文件的播放 + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + if (item.dataType == '3') { + if (item.valueList) { + item.valueList.forEach(ii => { + if (ii.isPlay) { + innerAudioContext.stop() + } + ii.isPlay = false + ii.curDuration = 0 + ii.curDuationStr = '00:00' + }) + } + } + }) + }) + if (!audio.isPlay) { + innerAudioContext = wx.createInnerAudioContext() + innerAudioContext.src = _self.data.dataList[index].list[ix].valueList[a].path + '.mp3' + innerAudioContext.autoplay = true + console.log(_self.data.dataList[index].list[ix].valueList[a].path) + } else { + innerAudioContext.stop() + } + + + innerAudioContext.onPlay(() => { + console.log('onPlay') + _self.data.dataList[index].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList + }) + }); + + innerAudioContext.onCanplay((res) => { + // if (_self.data.waitFlag) { + // innerAudioContext.play() + // _self.setData({ + // waitFlag: false + // }) + // } + }) + innerAudioContext.onStop((res) => { + console.log('停止播放') + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onEnded((res) => { + console.log(res) + console.log('播放完毕') + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onError((res) => { + console.log('播放错误') + console.log(res) + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onSeeking(() => { + // console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + // console.log('onWaiting') + // innerAudioContext.pause() + // _self.setData({ + // waitFlag: true + // }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.dataList[index].list[ix].valueList[a].duration = parseInt(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = curMStr + ':' + curSStr + _self.data.dataList[index].list[ix].valueList[a].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + dataList: _self.data.dataList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[ix].valueList[a].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[ix].valueList[a].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + // 跳转模板列表 + goList: function () { + wx.navigateTo({ + url: 'packagecard/cardList/cardList', + }) + }, + // 获取个人简介 + getPersonIntro: function () { + var self = this + app.restAjax.get(app.restAjax.path('{personIntroUrl}app/userexpand/get/' + app.globalData.userInfo.userId, [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + personIntro: data + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 获取用户信息 + getUserInfo: function () { + var self = this + app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + app.globalData.userInfo = data + self.getList() + + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 获取默认名片 + getDefault: function () { + var self = this + app.http.get(app.urls.getDefaultCard, { + header: { + token: app.globalData.token + }, + data: {} + }).then(res => { + var area = res.data.areaList + for (let i = 0; i < area.length; i++) { + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + if (area[i].templateAreaSource == 'phone') { + self.setData({ + phoneTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'wechat') { + self.setData({ + wechatTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'email') { + self.setData({ + emailTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'address') { + self.setData({ + addressTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'name') { + self.setData({ + nameTxt: area[i].templateAreaFontValue + }) + } + } + self.setData({ + cardInfo: res.data, + areaList: area, + dataList: [] + }) + + if (res.data) { + self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) + self.getBrowCardUserList(res.data.cardTemplateUseId) + self.getMainColumn(res.data.creator) + } + }).catch(res => { + + }) + }, + //获取浏览当前名片的用户头像列表 + getBrowCardUserList(id) { + var _self = this + app.http.get(app.urls.getCardBrowUserList, { + header: { + token: app.globalData.token + }, + data: { + page: '1', + rows: '7', + cardTemplateUseId: id + } + }) + .then(res => { + if (res.data) { + _self.setData({ + browUserList: res.data.rows + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + // 存入通讯录 + addContact: function () { + var self = this + wx.addPhoneContact({ + firstName: self.data.nameTxt, + mobilePhoneNumber: self.data.phoneNum + }) + }, + // 加入卡包 + includedCard: function () { + var self = this + app.http.post(app.urls.includedCard, { + header: { + token: self.data.token + }, + data: { + cardTemplateUseBagId: "", + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateUseStar: "", + cardTemplateUseTag: "", + cardTemplateUseTop: "" + } + }).then(res => { + console.log(res.data) + if (res.statusCode == '200') { + wx.showToast({ + title: '加入卡包成功!', + }) + } + }) + }, + // 拨打电话 + makeCall: function () { + var self = this + var phone = self.data.phoneTxt + if (phone) { + wx.makePhoneCall({ + phoneNumber: phone, + }) + } + }, + // 获取浏览数 + getViewCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + viewInfo: data + }) + }, function (code, data) { + if (data.msg) { + app.dialog.msg(data.msg); + } + }); + }, + // 获取转发数 + getForwardCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), { + templateUseId: self.data.cardInfo.cardPersonId + }, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + forwardCount: data.data + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 复制文本 + copyText: function (e) { + var self = this + var text = e.currentTarget.dataset.text + if (text) { + wx.setClipboardData({ + data: text, + success: function () {} + }) + } + }, + // 获取头像 + checkPermission() { + var _self = this + try { + var names = wx.getStorageSync('name') + var icon = wx.getStorageSync('userIcon') + + if (names) { + this.setData({ + name: names, + userIcon: icon + }) + } else { + wx.showModal({ + title: '提示', + content: '小程序需要您微信头像以及昵称用于展示,请授权.', + showCancel: false, + success(res) { + if (res.confirm) { + _self.getUserProfile(3) + } + } + }) + } + } catch (error) { + wx.showToast({ + title: '获取信息失败', + icon: 'error' + }) + } + }, + getUserProfile(e) { + let _self = this + wx.getUserProfile({ + desc: '获取微信头像以及昵称用于展示', + success: (res) => { + wx.setStorage({ + data: res.userInfo.nickName, + key: 'name', + }) + wx.setStorage({ + data: res.userInfo.avatarUrl, + key: 'userIcon', + }) + _self.setData({ + name: res.userInfo.nickName, + userIcon: res.userInfo.avatarUrl + }) + app.globalData.userIcon = res.userInfo.avatarUrl + app.globalData.userInfo = res.userInfo + _self.selectComponent('#head').refreshCart() + }, + fail(err) { + //判断是否绑定手机号 + wx.showToast({ + title: '获取个人信息失败', + icon: 'error', + }) + } + }) + }, + // 生成随机id + buildId: function () { + var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + + var nums = ""; + + for (var i = 0; i < 36; i++) { + var id = parseInt(Math.random() * 61); + + nums += chars[id]; + } + return nums + }, + // 展示名片码 + showBarCode: function () { + this.setData({ + isShowBarCode: true + }) + wx.hideTabBar() + }, + // 隐藏名片码 + hideBarCode: function () { + this.setData({ + isShowBarCode: false + }) + wx.showTabBar() + }, + // 转发记录 + shareRecord: function (cardTemplateDispatchId) { + var self = this + app.http.post(app.urls.shareRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateDispatchParentId: '', + cardTemplateDispatchId: cardTemplateDispatchId + } + }).then(res => { + console.log(res.data) + self.setData({ + shareRecordId: res.data.data + }) + }) + }, + /** + * 用户点击右上角分享 + */ + // onShareAppMessage: function (res) { + // console.log(res) + // var self = this + // wx.showShareMenu({ + // withShareTicket: true, + // success: function (res) { + // console.log(res) + // } + // }) + + // if (res.from == 'button') { + // var postId = self.buildId() + // self.shareRecord(postId) + + // var param = '/pages/sharePage/sharePage?cardTemplateDispatchId=' + postId; + // return { + // title: '名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享名片分享', + // path: param, + // imageUrl: self.data.shareImgUrl + // } + // // return返回 title 转发标题 path 路径 imageUrl 自定义图片,可以本地路径 代码包文件路径 支持png jpg 显示长宽比5:4 + // } + // }, +}) \ No newline at end of file diff --git a/packagecard/moments/momentsdetail/momentsdetail.json b/packagecard/moments/momentsdetail/momentsdetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/momentsdetail/momentsdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/momentsdetail/momentsdetail.wxml b/packagecard/moments/momentsdetail/momentsdetail.wxml new file mode 100755 index 0000000..f7adee3 --- /dev/null +++ b/packagecard/moments/momentsdetail/momentsdetail.wxml @@ -0,0 +1,203 @@ + + 详情 + + + + + + + + + + + + + + + {{child.value}} + + 来源:网络 + 发布时间:{{publishTime}} + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.comment}}:{{child.selValue}} + + + + + + + + + {{child.comment}} + + + + + {{ss.dataName}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/moments/momentsdetail/momentsdetail.wxss b/packagecard/moments/momentsdetail/momentsdetail.wxss new file mode 100755 index 0000000..e63bd7d --- /dev/null +++ b/packagecard/moments/momentsdetail/momentsdetail.wxss @@ -0,0 +1,696 @@ +.card-container { + height: 0; + box-sizing: border-box; +} + +.share-btn { + background: #eee; +} + +.card { + width: 100%; + height: 0; + box-sizing: border-box; + background: #fff; + position: relative; + overflow: hidden; + /* text-align: center; */ +} + +.area-box { + white-space: nowrap; + word-break: break-all; +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.person { + padding: 20rpx; +} + +.dynamic-container { + margin-top: -50rpx; + position: relative; + background-color: #fff; + padding: 20rpx; + border-radius: 20rpx; +} + +.dynamic-title image { + width: 30rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4rpx; +} + +.catelog-title { + display: flex; + position: relative; + align-items: center; + justify-content: space-between; +} + +.catelog-title .action { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; + padding-right: 30rpx; +} + +.title { + font-size: 30rpx; + position: relative; + color: #fff; + border-top-right-radius: 48rpx; + border-top-left-radius: 48rpx; + background: #0054bd; + display: inline-block; + padding: 10rpx 60rpx 60rpx 10rpx; + margin-bottom: -50rpx; +} + +.title text { + margin-left: 20rpx; +} + +.column-box { + display: flex; + flex-direction: column; + background-color: #fff; + width: 100%; +} + +.column-content { + display: flex; + flex-direction: column; + padding: 10rpx 20rpx 40rpx; + background-color: #fff; + border-radius: 48rpx; + width: 100%; + box-shadow: 0px 2px 2px #f0f0f0; + z-index: 2; +} + +.intro-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.serve-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.person-content { + padding: 20rpx; + border-radius: 20rpx; + background: #fff; + margin-top: -30rpx; + font-size: 30rpx; + color: #000; + line-height: 40rpx; + word-break: break-all; + line-height: 40rpx; + letter-spacing: 2rpx; + position: relative; +} + +.company-title { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #ddd; +} + +.company-title image { + width: 140rpx; + height: 140rpx; +} + +.company-name { + width: 520rpx; + height: 140rpx; + display: flex; + align-items: center; + font-size: 34rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.company-content { + background: #fff; + border-radius: 20rpx; + padding: 20rpx; + margin-top: -30rpx; + position: relative; +} + +.company-content image { + width: 100%; + height: 300rpx; + border-radius: 20rpx; +} + +.company .person-content { + margin-top: 0; +} + +.dynamic-title { + width: 710rpx; + margin: 0 auto; + display: block; +} + +.dynamic-box { + margin-bottom: 20rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; + position: relative; + height: 400rpx; +} + +.dynamic-box image { + width: 100%; + height: 400rpx; +} + +.dynamic-text { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + line-height: 60rpx; + color: #fff; + padding: 0 10rpx; + font-size: 30rpx; +} + +.person-info { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 1px solid #EEE; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + overflow: hidden; +} + +.avatar image { + width: 100%; + height: 100%; +} + +.person-name { + width: 530rpx; +} + +.name { + font-size: 32rpx; + margin: 15rpx 0 10rpx; + color: #000; +} + +.time { + color: #b2b2b2; +} + +.dynamic-content { + margin: 20rpx 0; +} + +.dynamic-img { + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.dynamic-img image { + width: 32%; + margin-right: 2%; + height: 160rpx; + margin-bottom: 10rpx; +} + +.dynamic-img image:nth-child(3n) { + margin-right: 0; +} + +.dynamic-img-text { + position: absolute; + left: 0; + right: 0; + bottom: 3rpx; + padding: 0 20rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 32rpx; + line-height: 70rpx; +} + +.dynamic-good { + margin: 10rpx 0; + display: flex; + justify-content: space-between; +} + +.good-count { + color: #333; + font-size: 28rpx; +} + +.good-btn image { + width: 40rpx; + height: 40rpx; + vertical-align: top; +} + +.dynamic-reply { + background: #eee; + padding: 15rpx; + margin-top: 15rpx; +} + +.reply { + font-size: 32rpx; + color: #000; + margin-bottom: 5rpx; +} + +.reply-name { + font-weight: bold; + display: inline; +} + +.dynamic-reply-input { + margin-top: 10rpx; +} + +.dynamic-reply-input input { + width: 100%; + height: 60rpx; + border-bottom: 1px solid #eee; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #0054bd; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card image { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.share-save { + text-align: center; + display: flex; + justify-content: space-between; +} + +.share-btn { + border: 1px solid #1296db; + background: none; + color: #1296db; + font-weight: normal; +} + +.save-btn { + border: 1px solid #1296db; + background: #1296db; + color: #fff; + font-weight: normal; +} + +.bottom-btn { + margin-top: 20rpx; + padding: 0 20rpx; + width: 100%; + white-space: nowrap; +} + +.phone-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.wechate-box .icon { + width: 35rpx; + height: 30rpx; + vertical-align: top; +} + +.email-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.bottom-btn-box { + display: inline-block; + min-width: 32%; + line-height: 30rpx; + padding: 20rpx; + box-sizing: border-box; + border: 1px solid #DDD; + border-radius: 10rpx; + margin-right: 10rpx; +} + +.bottom-text { + margin-top: 10rpx; +} + +.top-box { + padding: 15rpx 15rpx 20rpx 15rpx; +} + +.good { + display: flex; + justify-content: space-between; + padding-left: 20rpx; + padding-bottom: 20rpx; + background-color: #fff; +} + +.good-avatar, +.good-click { + line-height: 45rpx; + color: #333; +} + +.column-item { + margin: 0rpx; + padding: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.good-click { + display: flex; +} + +.view-count { + margin-right: 30rpx; + padding-right: 30rpx; + border-right: 1px solid #808080; + color: #808080; + display: flex; + flex-direction: row; + font-size: 36rpx; +} + +.view-count-no { + margin-right: 30rpx; + padding-right: 30rpx; + color: #808080; + display: flex; + flex-direction: row; + align-items: center; + font-size: 36rpx; +} + +.good-avatar image { + width: 100%; + height: 100%; +} + +.good-click image { + width: 38rpx; + height: 38rpx; +} + +.view-count image { + width: 32rpx; + height: 32rpx; +} + +.view-count-no image { + width: 32rpx; + height: 32rpx; +} + +.avatar-list { + width: 45rpx; + height: 45rpx; + margin-right: 10rpx; + vertical-align: top; + display: inline-block; +} + +.mid { + display: flex; + background: #0054bd; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + padding: 40rpx 0 80rpx; + margin-top: -20rpx; + position: relative; +} + +.mid-box { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-right: 1px solid #2f82ea; + background: none; + font-weight: normal; + width: auto !important; + padding: 0 !important; +} + +.mid-box:last-child { + border: none; +} + +.mid-box image { + width: 60rpx; + height: 60rpx; + margin-bottom: 20rpx; +} + +.mid-box-text { + font-size: 30rpx; + color: #fff; +} + +.mid-btn { + position: relative; + margin-top: -60rpx; + display: flex; + padding: 30rpx; + background: #fff; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + flex-wrap: wrap; + justify-content: space-between; +} + +.mid-btn-box { + flex-shrink: 0; + width: 49%; + margin-bottom: 20rpx; + padding: 15rpx; + border-radius: 20rpx; + background: #eee; + display: flex; + justify-content: space-between; + box-sizing: border-box; +} + +.mid-btn-box:nth-child(3), +.mid-btn-box:nth-child(4) { + margin-bottom: 0; +} + +.mid-btn-box image { + width: 80rpx; + height: 80rpx; +} + +.mid-btn-text { + width: 200rpx; +} + +.text-top { + line-height: 45rpx; + font-size: 30rpx; + color: #000; +} + +.text-bottom { + font-size: 26rpx; + color: #898989; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bar-code { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 999; +} + +.bar-code .content { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: 96%; + background: #fff; + /* width: 500rpx; + height: 500rpx; */ + border-radius: 10rpx; + padding: 20rpx; + min-width: 80%; + min-height: 50%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.code-title { + font-size: 32rpx; + font-weight: bold; + color: #000; +} + +.code-txt { + font-size: 32rpx; + color: #000; +} + +.bar-code image { + width: 300rpx; + height: 300rpx; +} + +.news-title { + background: #ffffff; + width: 100%; + display: flex; + padding: 20rpx; + flex-direction: column; +} + +.news-title-desc-box { + display: flex; + margin-top: 15rpx; + flex-direction: row; + justify-content: space-between; +} + +.news-title-desc { + color: rgb(158, 154, 154); + font-size: 28rpx; + text-align: right; +} + +.news-title-text { + font-size: 36rpx; + color: #000000; + text-align: center +} + +.news-content { + font-size: 30rpx; + color: #333333; + line-height: 50rpx; +} + +.comment-box { + width: 95%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.movie-item { + height: 280rpx; + width: 100%; + padding-bottom: 0px; +} + +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.comment-item { + width: 100%; + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; +} + +.comment-item image { + width: 128rpx; + height: 128rpx; +} + +.comment-content { + display: flex; + flex-direction: row; + justify-content: left; + align-items: flex-start; +} \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublish.js b/packagecard/moments/publish/momentpublish.js new file mode 100755 index 0000000..14342a4 --- /dev/null +++ b/packagecard/moments/publish/momentpublish.js @@ -0,0 +1,802 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +var location = { + latitude: 39.90877, + longitude: 116.39695 +}; //默认坐标点 +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + maringHeight: app.globalData.CustomBar, + fieldList: [{ + type: 'text' + }, { + type: 'video' + }, { + type: 'audio' + }, { + type: 'map' + }, { + type: 'select' + }, { + type: 'textarea' + }, { + type: 'link' + }, { + type: 'photo' + }, ], //允许发布的字段列表 + valueList: [], //当前添加的内容列表 + isShowInput: false, //是否显示文本输入 + isShowPhoto: false, //是否显示图片编辑框 + isShowVideo: false, //是否显示视频编辑框 + isShowLink: false, //是否显示链接输入框 + isShowSelect: false, //是否显示选项弹框 + isShowAudio: false, //是否显示录音弹框 + curTextValue: '', //当前输入的文本内容 + curLinkText: '', //当前链接输入的文本内容 + isShowEdit: false, //是否显示编辑 + currentIndex: -1, //当前点击的条目索引 + photoList: [], //当前选择的图片列表 + videoList: [], //当前选择的视频列表 + curSelPhotoDisplay: '1', //图片的显示方式 1.九宫格 2.轮播 3.轮播(自动) 4.平铺 + curVideoDisplay: '1', //视频展示方式 1.九宫格 2.平铺 + curTextAlign: '1', //文字显示排列 1.居左 2.居中 3.居右 + curFieldType: '0', //编辑选择的文件类型 + selDirection: '1', //选中的插入方向 1.插入到下面 2.插入的上面 + isInsert: false, //是否显示插入选项 + topBoxHeight: 100, //顶部类型选择框的高度 + audioFile: null, //当前的录音文件 + audioDuration: 0, //录音文件的时长 + isRecording: false, //是否正在录音 + optionsList: [{ + id: '1', + name: '选项一', + isSel: false + }, { + id: '2', + name: '选项二', + isSel: false + }, { + id: '3', + name: '选项三', + isSel: false + }, { + id: '4', + name: '选项四', + isSel: false + }, { + id: '5', + name: '选项五', + isSel: false + }], //选项 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + columnId: options.id + }) + this.checkPermission() + wx.getLocation({ + success(res) { + location.latitude = res.latitude + location.longitude = res.longitude + } + }) + this.countBoxHeight() + }, + countBoxHeight() { + var _self = this + var query = wx.createSelectorQuery() + query.select('#top-box').boundingClientRect() + query.exec(res => { + _self.setData({ + topBoxHeight: res[0].height + 7 + }) + }) + }, + onShow() { + var _self = this + if (chooseLocation.getLocation() != null) { + var item = chooseLocation.getLocation() + var tempItem = {} + tempItem['type'] = 'map' + tempItem['value'] = item + _self.data.valueList.push(tempItem) + _self.setData({ + valueList: _self.data.valueList + }) + } + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + showType(e) { + var type = e.currentTarget.dataset.type + var _self = this + switch (type) { + case 'text': + case 'textarea': //文本域 + this.setData({ + isShowInput: true + }) + break + case 'video': //视频 + _self.chooseVideo() + break + case 'audio': //音频 + _self.checkRecordPermission() + break + case 'photo': //图片 + _self.chooseImg() + break + case 'map': //地图 + _self.doChooseLocation() + break + case 'select': //选项 + _self.setData({ + isShowSelect: true + }) + break + case 'link': //链接 + _self.setData({ + isShowLink: true + }) + break + } + }, + //去选择图片 + chooseImg() { + var _self = this + wx.chooseImage({ + count: 9, + sourceType: ['album', 'camera'], + success: (res) => { + // _self.doUploadImg(index, res.tempFilePaths, _self.data.uploadCount) + //构建数据 + console.log(res) + res.tempFilePaths.forEach(it => { + var tempItem = {} + tempItem['path'] = it + _self.data.photoList.push(tempItem) + }) + _self.setData({ + photoList: _self.data.photoList, + isShowPhoto: true + }) + }, + fail: (err) => { + if (err.errMsg.indexOf('fail cancel') == -1) { + wx.showToast({ + title: '请重新选择', + icon: 'error' + }) + } + } + }) + }, + //去选择视频 + chooseVideo() { + var _self = this + wx.chooseMedia({ + count: 9, + mediaType: ['video'], + sourceType: ['album', 'camera'], + maxDuration: 60, + success(res) { + res.tempFiles.forEach(it => { + var tempItem = {} + tempItem['path'] = it.tempFilePath + tempItem['coverPath'] = it.thumbTempFilePath + _self.data.videoList.push(tempItem) + }) + _self.setData({ + videoList: _self.data.videoList, + isShowVideo: true + }) + }, + fail(err) { + if (err.errMsg.indexOf('fail cancel') == -1) { + wx.showToast({ + title: '请重新选择', + icon: 'error' + }) + } + } + }) + }, + //控制显示 + showEditBox(e) { + var index = e.currentTarget.dataset.idx + var _self = this + if (_self.data.currentIndex == index) { + this.setData({ + currentIndex: -1, + }) + } else { + this.setData({ + currentIndex: index + }) + } + }, + //选择插入的方向 + chooseDirection(e) { + var idx = e.currentTarget.dataset.idx + this.setData({ + selDirection: idx + }) + }, + //选择图片的显示方式 + choosePhotoDisplay(e) { + var type = e.currentTarget.dataset.type + this.setData({ + curSelPhotoDisplay: type + }) + }, + //选择视频的显示方式 + chooseVideoDisplay(e) { + var type = e.currentTarget.dataset.type + this.setData({ + curVideoDisplay: type + }) + }, + //选择文字排列方式 + chooseTextAlign(e) { + var type = e.currentTarget.dataset.type + this.setData({ + curTextAlign: type + }) + }, + //编辑选择出入的类型 + chooseFieldType(e) { + var type = e.currentTarget.dataset.type + this.setData({ + curFieldType: type + }) + }, + //确定选择的图片 + confirmPhoto() { + var _self = this + if (_self.data.photoList.length > 0) { + //上传图片 + var tempList = [] + _self.data.photoList.forEach(it => { + var item = {} + item['path'] = it.path + tempList.push(item) + }) + var tempPhoto = {} + tempPhoto['type'] = 'photo' + tempPhoto['valueList'] = tempList + tempPhoto['displayType'] = _self.data.curSelPhotoDisplay + _self.data.valueList.push(tempPhoto) + _self.setData({ + valueList: _self.data.valueList, + photoList: [], + curSelPhotoDisplay: 1, + isShowPhoto: false + }) + } else { + wx.showToast({ + title: '请选择图片', + icon: 'error' + }) + } + }, + //确定选择的视频 + confirmVideo() { + var _self = this + if (_self.data.videoList.length > 0) { + var tempList = [] + _self.data.videoList.forEach(it => { + var item = {} + item['path'] = it.path + item['coverPath'] = it.coverPath + tempList.push(item) + }) + var tempVideo = {} + tempVideo['type'] = 'video' + tempVideo['valueList'] = tempList + tempVideo['displayType'] = _self.data.curVideoDisplay + _self.data.valueList.push(tempVideo) + _self.setData({ + valueList: _self.data.valueList, + videoList: [], + curVideoDisplay: 1, + isShowVideo: false + }) + } else { + wx.showToast({ + title: '请选择视频', + icon: 'error' + }) + } + }, + //确定插入数据 + doInsert() { + //根据选择的类型与方向插入数据 + }, + hideEditBox() { + //隐藏编辑框 + this.setData({ + currentIndex: -1 + }) + }, + onClose() { + this.setData({ + isShowInput: false, + isShowLink: false, + isShowSelect: false + }) + }, + //输入框监听 + inputWatch(e) { + var _self = this + _self.setData({ + curTextValue: e.detail.value + }) + }, + //链接输入框监听 + inputLink(e) { + var _self = this + _self.setData({ + curLinkText: e.detail.value + }) + }, + //保存输入的链接 + doConfirmLink() { + var _self = this + if (_self.data.curLinkText == '') { + wx.showToast({ + title: '请输入链接', + icon: 'error' + }) + } else { + //保存 + var tempText = {} + tempText['type'] = 'link' + tempText['value'] = _self.data.curLinkText + _self.data.valueList.push(tempText) + _self.setData({ + valueList: _self.data.valueList, + curLinkText: '', + isShowLink: false + }) + } + }, + //保存输入的文本 + doConfirmInput() { + var _self = this + if (_self.data.curTextValue == '') { + wx.showToast({ + title: '请输入内容', + icon: 'error' + }) + } else { + //保存 + var tempText = {} + tempText['type'] = 'text' + tempText['value'] = _self.data.curTextValue + var textAlign = 'left' + console.log(_self.data.curTextAlign) + switch (_self.data.curTextAlign) { + case '1': + textAlign = 'left' + break + case '2': + textAlign = 'center' + break + case '3': + textAlign = 'right' + break + } + tempText['textAlign'] = textAlign + _self.data.valueList.push(tempText) + _self.setData({ + valueList: _self.data.valueList, + curTextValue: '', + isShowInput: false + }) + } + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + //预览图片 + viewPhoto(e) { + var url = e.currentTarget.dataset.url + wx.previewImage({ + urls: [url], + }) + }, + //删除图片 + delPhoto(e) { + var _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.photoList.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + photoList: _self.data.photoList + }) + } + } + }) + }, + //选择定位点 + doChooseLocation(e) { + // var index = e.currentTarget.dataset.index + // this.setData({ + // curMapIndex: index + // }) + var curLoc = JSON.stringify(location) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${curLoc}&category=${category}` + }); + }, + //编辑条目 + editItem(e) { + + }, + //插入条目 + insertItem(e) { + var _self = this + _self.setData({ + isInsert: !_self.data.isInsert + }) + }, + //删除条目 + delItem(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + success(res) { + if (res.confirm) { + + } + } + }) + }, + //选项选择 + chooseTags(e) { + var _self = this + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + _self.data.optionsList[idx].isSel = !item.isSel + _self.setData({ + optionsList: _self.data.optionsList + }) + }, + //保存选定的选项 + doConfirmSel() { + var _self = this + var tempList = [] + _self.data.optionsList.forEach(it => { + if (it.isSel) { + tempList.push(it) + } + }) + var tempSel = {} + tempSel['type'] = 'select' + tempSel['valueList'] = tempList + _self.data.valueList.push(tempSel) + _self.data.optionsList.forEach(it => { + it.isSel = false + }) + _self.setData({ + valueList: _self.data.valueList, + isShowSelect: false, + optionsList: _self.data.optionsList + }) + }, + //确定音频 + doConfirmAudio() { + var _self = this + var tempAudio = {} + tempAudio['type'] = 'audio' + tempAudio['value'] = _self.data.audioFile + _self.data.valueList.push(tempAudio) + _self.setData({ + valueList: _self.data.valueList, + audioFile: null, + isShowAudio: false + }) + }, + //校验录音权限 + checkRecordPermission() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isShowAudio: true + }) + } + }) + } else { + _self.setData({ + isShowAudio: true + }) + } + } + }) + }, + //开始录音 + startRecord() { + var _self = this + //1.启动定时器用来记录时间 + _self.data.setInter = setInterval( + function () { + var audioDuration = parseInt(_self.data.audioDuration + 1); + _self.setData({ + audioDuration: parseInt(audioDuration), + isRecording: true + }); + }, 1000) + //2.开始录音 + _self.start() + }, + //开始录音 + start() { + console.log('开始录音') + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //结束录音 + doEndRecord() { + var _self = this + clearInterval(_self.data.setInter); + //判断时长是否达到要求 + recorderManager.stop(); + recorderManager.onStop((res) => { + //进行录音文件上传 + if (_self.data.audioDuration < 10) { + wx.showToast({ + title: '录音时长需大于10秒', + icon: 'none' + }) + } else { + //可以上传 + // res tempFilePath 路径 duration 毫秒 fileSize 大小 + res.isPlay = false + res.durationStr = _self.data.audioDuration + '' + res.duration = _self.data.audioDuration + res.totalDurationStr = '00:' + (_self.data.audioDuration > 9 ? _self.data.audioDuration : '0' + _self.data.audioDuration) + res.curDurationStr = '00:00' + res.curDuration = 0 + res.isPlay = false + // _self.doUploadAudio(res) + _self.setData({ + audioFile: res + }) + } + _self.setData({ + audioDuration: 0, + isRecording: false, + }) + }) + }, + //删除录音 + delAudio() { + var _self = this + wx.showModal({ + title: '警告', + content: '确定要删除该条录音吗?', + success(res) { + if (res.confirm) { + _self.setData({ + audioFile: null + }) + } + } + }) + }, + //隐藏各类弹框 + closePop(e) { + var type = e.currentTarget.dataset.type + var _self = this + if (type && type == 'audio') { + if (_self.data.audioFile != null) { + wx.showModal({ + title: '警告', + content: '关闭录音弹窗将清除当前录制的音频文件,确定要关闭吗?', + success(res) { + if (res.confirm) { + _self.setData({ + audioFile: null, + isShowAudio: false + }) + } + } + }) + } else { + _self.setData({ + isShowAudio: false + }) + } + } + this.setData({ + isShowPhoto: false, + isShowEdit: false, + isShowVideo: false, + isShowSelect: false, + }) + }, + //音频拖动 + slider4change(e) { + var _self = this + var audio = e.currentTarget.dataset.item + if (audio.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + play(e) { + //进行播放 + var audio = e.currentTarget.dataset.item + var _self = this + var type = e.currentTarget.dataset.type + var idx = e.currentTarget.dataset.idx + if (audio.isPlay) { + innerAudioContext.stop() + } else { + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = audio.tempFilePath + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + innerAudioContext.onPlay(() => { + _self.data.audioFile.isPlay = true + _self.setData({ + audioFile: _self.data.audioFile + }) + }); + innerAudioContext.onStop((res) => { + console.log('停止播放') + //重置文件的状态 + _self.setAudioDefault() + }) + innerAudioContext.onEnded((res) => { + console.log('播放结束') + //重置文件的状态 + _self.setAudioDefault() + }) + innerAudioContext.onError((res) => { + wx.showToast({ + title: '播放失败', + icon: 'error' + }) + _self.setAudioDefault() + }) + innerAudioContext.onTimeUpdate(() => { + _self.data.audioFile.curDuration = innerAudioContext.currentTime + var time = Number.parseInt(_self.data.audioFile.curDuration) + _self.data.audioFile.curDurationStr = '00:' + (time > 9 ? time : '0' + time) + _self.setData({ + audioFile: _self.data.audioFile + }) + }) + }, + //设置录音文件恢复初始 + setAudioDefault() { + var _self = this + //重置文件的状态 + _self.data.audioFile.curDurationStr = '00:00' + _self.data.audioFile.curDuration = 0 + _self.data.audioFile.isPlay = false + _self.setData({ + audioFile: _self.data.audioFile + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].valueList[ix].curDuration = _self.data.dataList[index].list[idx].valueList[ix].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].valueList[ix].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + } +}) \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublish.json b/packagecard/moments/publish/momentpublish.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/publish/momentpublish.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublish.wxml b/packagecard/moments/publish/momentpublish.wxml new file mode 100755 index 0000000..dab6377 --- /dev/null +++ b/packagecard/moments/publish/momentpublish.wxml @@ -0,0 +1,426 @@ + + 内容发布 + + + + + 本栏目可以发布 + + + + + + + 文本 + + + + 图片 + + + + 视频 + + + + 音频 + + + + 选项 + + + + 定位 + + + + 链接 + + + + + + + + + + + + + {{item.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.value.curDurationStr}} + + {{item.value.totalDurationStr}} + + + + + + + + + + + + + + + + + + {{item.value.name}}-{{item.value.address}} + + + + + + + + + + + {{item.value}} + + + + + + + {{options.name}} + + + + + + + + + 编辑 + + + + 插入 + + + + 删除 + + + + + + 方向: + + + + + + + 插入到下面 + + + + + + + + 插入到上面 + + + + + + 类型: + + + + + {{item.type}} + + + + + + + + + + + + + + + + + + + + 文本 + + + + + 文字居左 + + + + 文字居中 + + + + 文字居右 + + + + + + + + + + + + + 链接 + + + + + + + + + + + + + + 00:{{audioDuration > 9 ? audioDuration : '0'+ audioDuration}} + 长按录音 + + + + + + {{audioFile.curDurationStr}} + + {{audioFile.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + 图片 {{photoList.length}}/9 + + + + + + + + + 九宫格 + + + + 轮播 + + + + 轮播(自动) + + + + 平铺 + + + + + + + + + + + + + + + + + + + + + + + + 视频 {{videoList.length}}/9 + + + + + + + + + 九宫格 + + + + 平铺 + + + + + + + + + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + + + \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublish.wxss b/packagecard/moments/publish/momentpublish.wxss new file mode 100755 index 0000000..4792557 --- /dev/null +++ b/packagecard/moments/publish/momentpublish.wxss @@ -0,0 +1,239 @@ +/* pages/moments/publish/momentpublish.wxss */ + +.page-box-2 { + margin: 15rpx; + padding: 15rpx; + background-color: #ffffff; + display: flex; + flex-direction: column; + align-items: flex-start; +} + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} + +.type-box { + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; + width: 100%; + flex-wrap: wrap; +} + +.type-box .item { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.type-box image { + width: 84rpx; + height: 84rpx; +} + +.input-box { + display: flex; + width: 100%; + flex-direction: column; + align-items: flex-start; + justify-content: center; + padding: 15rpx; +} + +.input-box .title { + font-size: 32rpx; + color: #000; +} + +.input-box textarea { + font-size: 28rpx; + color: #000; + width: 100%; + border: 1rpx solid #f5f5f5; + padding: 15rpx; + margin-top: 15rpx; + height: 200rpx; +} + +.control-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-around; + padding: 15rpx; + border: 1rpx solid #f5f5f5; + margin-top: 15rpx; +} + +.control-box .item { + font-size: 32rpx; + flex-grow: 1; + text-align: center; +} + +.item-input { + line-height: 80rpx; + height: 80rpx; + width: 100%; + background-color: #f5f5f5; + text-align: left; + padding-left: 15rpx; + margin-top: 15rpx; + border-radius: 10rpx; +} + +.control-box .item:active { + background-color: #f5f5f5; +} + +.control-box .item:nth-child(2) { + font-size: 32rpx; + border-left: 1rpx solid #f5f5f5; + border-right: 1rpx solid #f5f5f5; + padding: 0rpx 15rpx; + margin-right: 15rpx; +} + +.item-box { + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; + width: 100%; +} + +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.choose-box { + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; + justify-content: flex-start; + font-size: 32rpx; + flex-wrap: wrap; + width: 100%; +} + +.choose-box .item-text { + margin-left: 15rpx; +} + +.choose-box .item-text:nth-child(1) { + margin-left: 0rpx; +} + +.choose-item:nth-child(1) { + margin-left: 0rpx; +} + +.choose-box .item { + margin-left: 15rpx; + padding: 8rpx; +} + +.choose-box .item:nth-child(1) { + margin-left: 0rpx; +} + +.dir-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; + width: 100%; +} + +.dir-parent-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 100%; + margin-top: 15rpx; +} + +.dir-parent-box .title { + width: 120rpx; +} + +.sel-item { + margin: 15rpx; +} + +/* 选中的条目边框 */ +.sel-border { + border: 1rpx solid #E6B980; + border-radius: 10rpx; + padding-bottom: 15rpx; +} + +/* 语音弹框 */ +.audio-box { + display: flex; + flex-direction: row; + width: 100%; + justify-content: center; + align-items: center; + min-height: 400rpx; +} \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublishline.js b/packagecard/moments/publish/momentpublishline.js new file mode 100755 index 0000000..e64cb4b --- /dev/null +++ b/packagecard/moments/publish/momentpublishline.js @@ -0,0 +1,1113 @@ +const app = getApp() +const recorderManager = wx.getRecorderManager() +var innerAudioContext = wx.createInnerAudioContext() +const chooseLocation = requirePlugin('chooseLocation'); +const key = 'Y6FBZ-GLQC3-6273Q-3DRTL-W43G5-G6BXN'; //使用在腾讯位置服务申请的key +const referer = '名片-小程序'; //调用插件的app的名称 +var location = { + latitude: 39.90877, + longitude: 116.39695 +}; //默认坐标点 +const category = '生活服务,娱乐休闲'; +Page({ + + /** + * 页面的初始数据 + */ + data: { + uploadCount: 0, + uploadVideoCount: 0, + currentIndex: 0, + columnId: '', //栏目Id + fieldList: [], //栏目字段 + textList: [], //文本添加内容 + textareaList: [], //文本域添加内容 + audioList: [], //音频添加内容 + videoList: [], //视频添加内容 + photoList: [], //视频添加内容 + linkList: [], //连接添加内容 + locationList: [], //定位添加内容 + isShowText: false, //文本弹窗开关 + isShowDesc: false, //文本域弹窗开关 + isShowPhoto: false, //图片选择弹框 + isShowLink: false, //链接弹窗 + isShowAudio: false, //录音弹窗 + isShowVideo: false, //视频弹窗 + isShowTags: false, //多选弹窗 + isShowType: false, //图片展示方式 + tempText: '', + tempDesc: '', + linkStr: '', + map: null, + waitFlag: false, + isStartRecord: false, //是否录音中 + speck_time: 0, + speedStep: 5, //快进快退秒数 + setInter: '', //定时器 + currentItem: undefined, + isAuthAudio: false, + title: '栏目内容发布', + curMutliIndex: 0, //多选 + displayType: [{ + name: '九宫格', + id: 1 + }, { + name: '轮播', + id: 2 + }, { + name: '轮播(自动)', + id: 3 + }, { + name: '平铺', + id: 4 + }, ], //图片展示方式 + selDisplayType: 1, //图片展示方式 + displayTypeStr: '九宫格', + maxDuration: 60, //上传视频大小限制 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + columnId: options.id, + title: options.title + '发布' + }) + var _self = this + wx.getLocation({ + success(res) { + console.log(res) + location.latitude = res.latitude + location.longitude = res.longitude + } + }) + this.checkPermission() + this.getFieldList() + }, + getFieldList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMomentsField.format({ + configColumnId: _self.data.columnId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach((it, index) => { + it.order = index + // 2:照片,3:音频,4:视频,5:链接,6:定位 + switch (it.dataType) { + case '2': + case '3': + case '4': + case '5': + case '6': + it.valueList = [] + break + case '8': + it.index = 0 + it.value = it.dictionariesList[0].dataId + break + case '9': + it.selValue = '请选择' + it.selIndexs = [] + it.dictionariesList.forEach(ss => { + ss.isSel = false + }) + break + } + }) + _self.setData({ + fieldList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + }, + inputText(e) { + var index = e.currentTarget.dataset.index + var type = e.currentTarget.dataset.type + if (type != 1) { + var _self = this + _self.data.fieldList[index].value = e.detail.value + _self.setData({ + fieldList: _self.data.fieldList + }) + } else { + var _self = this + _self.data.fieldList[index].order = e.detail.value + _self.setData({ + fieldList: _self.data.fieldList + }) + } + + }, + //申请录音权限 + checkPermission() { + var _self = this + wx.getSetting({ + success(res) { + var isAuth = res.authSetting['scope.record'] + if (typeof (isAuth) == 'undefined') { + wx.authorize({ + scope: 'scope.record', + success() { + _self.setData({ + isAuthAudio: true + }) + }, + fail() { + _self.setData({ + isAuthAudio: false + }) + } + }) + } else { + if (!isAuth) { + _self.openSetting() + } + } + } + }) + }, + openSetting() { + wx.showModal({ + title: '提示', + content: '发布内容需要您授权录音权限.', + success(res) { + if (res.confirm) { + wx.openSetting({ + withSubscriptions: true, + }) + } + } + }) + }, + onShow() { + if (chooseLocation.getLocation() != null) { + var item = this.data.fieldList[this.data.curMapIndex] + if (item.valueList.length < item.maxCount) { + this.data.fieldList[this.data.curMapIndex].valueList.push(chooseLocation.getLocation()) + this.setData({ + fieldList: this.data.fieldList + }) + } + } + var _self = this + wx.getSetting({ + withSubscriptions: true, + success(res) { + var isAuth = res.authSetting['scope.record'] + _self.setData({ + isAuthAudio: isAuth + }) + } + }) + + }, + //单选 + pickerChange(e) { + var _self = this + var index = e.currentTarget.dataset.index + var selIndex = e.detail.value + _self.data.fieldList[index].index = selIndex + _self.data.fieldList[index].value = _self.data.fieldList[index].dictionariesList[selIndex].dataId + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + //确定选择图片展示方式 + confirmSel(e) { + const { + piacker, + value + } = e.detail + this.setData({ + selDisplayType: value.id, + displayTypeStr: value.name, + isShowType: false + }) + }, + //取消选择展示方式 + cancelSel(e) { + this.setData({ + isShowType: false + }) + }, + onUnload() { + chooseLocation.setLocation(null) + this.setData({ + map: null + }) + }, + //选择视频来源 + chooseVideo(e) { + var _self = this + var item = e.currentTarget.dataset.item + var countNum = item.maxCount - item.valueList.length + var index = e.currentTarget.dataset.index + wx.chooseMedia({ + count: Number.parseInt(countNum), + mediaType: ['video'], + sourceType: ['camera', 'album'], + maxDuration: 60, + success: (res) => { + console.log(res) + if (res.tempFiles.length > 0) { + if (res.tempFiles[0].duration <= _self.data.maxDuration) { + _self.doUploadVideo(index, res.tempFiles, _self.data.uploadVideoCount) + } else { + wx.showToast({ + title: '视频最长60秒', + icon: 'none' + }) + } + } + }, + fail: (err) => {} + }) + }, + //上传视频 + doUploadVideo(fieldIndex, paths, videoCount) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadVideoCount < count) { + app.http.upload(app.urls.doUploadVideo, { + path: paths[_self.data.uploadVideoCount].tempFilePath, + name: 'video', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + _self.doUploadVideoImg(fieldIndex, id, paths, _self.data.uploadVideoCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, paths, _self.data.uploadVideoCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: 0 + }) + } + }, + //上传视频封面图片 + doUploadVideoImg(fieldIndex, videoId, videos, videoCount) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + path: videos[_self.data.uploadVideoCount].thumbTempFilePath, + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + console.log(res) + wx.hideLoading({}) + var videoUrl = app.urls.baseImgUrl + videoId + var thumbImg = app.urls.baseImgUrl + JSON.parse(res).data + var thumbI = JSON.parse(res).data + var item = { + id: videoId, + thumbId: thumbI, + path: videoUrl, + imgPath: thumbImg + } + _self.data.fieldList[fieldIndex].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, videos, _self.data.uploadVideoCount) + }) + .catch(err => { + console.log(err) + wx.hideLoading({}) + _self.setData({ + uploadVideoCount: ++_self.data.uploadVideoCount + }) + _self.doUploadVideo(fieldIndex, videos, _self.data.uploadVideoCount) + }) + }, + //预览视频 + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //删除视频 + delVideo(e) { + let _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[index].valueList.splice(idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + //添加链接 + addLink() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'LINK') { + item = _self.data.items[i] + break + } + } + if (_self.data.linkList.length < item.count) { + if (_self.data.linkStr == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.linkList.push(_self.data.linkStr) + _self.setData({ + linkList: _self.data.linkList, + linkStr: '' + }) + if (_self.data.linkList.length == item.count) { + _self.setData({ + isShowLink: false + }) + } + } + }, + //文本域添加输入的文字 + addDesc() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXTAREA') { + item = _self.data.items[i] + break + } + } + if (_self.data.textareaList.length < item.count) { + if (_self.data.tempDesc == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textareaList.push(_self.data.tempDesc) + _self.setData({ + textareaList: _self.data.textareaList, + tempDesc: '' + }) + if (_self.data.textareaList.length == item.count) { + _self.setData({ + isShowDesc: false + }) + } + } + }, + //添加输入的文字 + addStr() { + var _self = this + var item = null + for (var i = 0; i < _self.data.items.length; i++) { + if (_self.data.items[i].type == 'TEXT') { + item = _self.data.items[i] + break + } + } + if (_self.data.textList.length < item.count) { + if (_self.data.tempText == '') { + wx.showToast({ + title: '请输入文字内容', + icon: 'error' + }) + return + } + _self.data.textList.push(_self.data.tempText) + _self.setData({ + textList: _self.data.textList, + tempText: '' + }) + if (_self.data.textList.length == item.count) { + _self.setData({ + isShowText: false + }) + } + } + }, + //删除 + delText(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textList: this.data.textList + }) + } + } + }) + }, + delLink(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.linkList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + linkList: this.data.linkList + }) + } + } + }) + }, + delDesc(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.textareaList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + textareaList: this.data.textareaList + }) + } + } + }) + }, + //监听输入的文字 + textInput(e) { + this.setData({ + [e.currentTarget.id]: e.detail.value + }) + }, + //关闭弹窗 + onHide(e) { + this.setData({ + isShowText: false, + isShowDesc: false, + isShowPhoto: false, + isShowLink: false, + isShowAudio: false, + isShowVideo: false, + isShowTags: false, + isShowType: false + }) + }, + chooseTags(e) { + var _self = this + var index = e.currentTarget.dataset.idx + _self.data.fieldList[_self.data.currentIndex].dictionariesList[index].isSel = !_self.data.fieldList[_self.data.currentIndex].dictionariesList[index].isSel + _self.setData({ + fieldList: _self.data.fieldList + }) + var value = '' + var ids = '' + _self.data.fieldList[_self.data.currentIndex].dictionariesList.forEach(it => { + if (it.isSel) { + value += it.dataName + ',' + ids += it.dataId + ',' + } + }) + value = value.substr(0, value.length - 1) + ids = ids.substr(0, ids.length - 1) + _self.data.fieldList[_self.data.currentIndex].selValue = value + _self.data.fieldList[_self.data.currentIndex].value = ids + _self.setData({ + fieldList: _self.data.fieldList + }) + }, + selTags() { + this.setData({ + isShowTags: false + }) + }, + //选择图片 + choosePhoto(e) { + var _self = this + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + var countNum = item.maxCount - item.valueList.length + + wx.chooseImage({ + count: Number.parseInt(countNum), + sourceType: ['album', 'camera'], + success: (res) => { + _self.doUploadImg(index, res.tempFilePaths, _self.data.uploadCount) + }, + fail: (err) => { + + } + }) + }, + //删除图片 + delImg(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.fieldList[e.currentTarget.dataset.itemindex].valueList.splice(e.currentTarget.dataset.index, 1) + this.setData({ + fieldList: this.data.fieldList + }) + } + } + }) + }, + //预览图片 + viewImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + doUploadImg(index, paths, curIndex) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + var count = paths.length //几次 + if (_self.data.uploadCount < count) { + app.http.upload(app.urls.doUploadImg, { + path: paths[_self.data.uploadCount], + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + var item = { + id: id, + path: pathStr + } + _self.data.fieldList[index].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + uploadCount: ++_self.data.uploadCount + }) + _self.doUploadImg(index, paths, _self.data.uploadCount) + }) + } else { + wx.hideLoading({}) + _self.setData({ + uploadCount: 0 + }) + } + }, + //地图选点 + chooseLocation(e) { + var index = e.currentTarget.dataset.index + this.setData({ + curMapIndex: index + }) + var curLoc = JSON.stringify(location) + wx.navigateTo({ + url: `plugin://chooseLocation/index?key=${key}&referer=${referer}&location=${curLoc}&category=${category}` + }); + }, + delMap(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该条数据吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[e.currentTarget.dataset.index].valueList.splice(e.currentTarget.dataset.idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + //删除视频 + delAudio(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该音频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.fieldList[e.currentTarget.dataset.index].valueList.splice(e.currentTarget.dataset.idx, 1) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + } + }) + }, + doStartRecord() { + var _self = this + wx.getSetting({ + success(res) { + if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + _self.startRecord() + } + }) + } else { + _self.startRecord() + } + } + }) + }, + startRecord() { + var that = this + that.data.setInter = setInterval( + function () { + var speck_time = parseInt(that.data.speck_time + 1); + that.setData({ + speck_time: parseInt(speck_time), + isStartRecord: true + }); + if (that.data.speck_time > 0 && that.data.speck_time <= 59) { + that.start(); + } else { + clearInterval(that.data.setInter); + // 获取到结束时间 + that.stop(); + wx.showToast({ + title: '录音最长60S哦!', + duration: 2000, + icon: "none" + }) + } + }, 1000); + }, + doEndRecord() { + var _self = this; + clearInterval(_self.data.setInter); + // 获取到结束时间 + if (_self.data.speck_time > 10) { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(true); + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } else { + //清除计时器 即清除setInter + clearInterval(_self.data.setInter); + // 获取到结束时间 + _self.stop(false); + wx.showToast({ + title: '时间需大于10秒', + duration: 2000, + icon: "none" + }) + _self.setData({ + speck_time: "0", + isStartRecord: false + }) + } + }, + //开始录音的时候 + start() { + const options = { + duration: 60000, + format: 'mp3', //音频格式,有效值 aac/mp3 + } + //开始录音 + recorderManager.start(options); + recorderManager.onStart(() => { + console.log('recorder start') + }); + //错误回调 + recorderManager.onError((res) => { + console.log(res); + _self.stop(false); + }) + }, + //停止录音 + stop(success) { + var _self = this + recorderManager.stop(); + recorderManager.onStop((res) => { + if (success) { + //进行录音文件上传 + _self.doUploadAudio(res) + } + }) + }, + doUploadAudio(audio) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadAudio, { + path: audio.tempFilePath, + name: 'audio', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (_self.data.fieldList[_self.data.currentIndex].valueList.length < _self.data.currentItem.maxCount) { + wx.hideLoading({}) + //插入到集合中 + var id = JSON.parse(res).data + var pathStr = app.urls.baseImgUrl + id + //计算时长 + var dur = parseInt(audio.duration / 1000) + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + var totalStr = totalMStr + ':' + totalSStr + var item = { + id: id, //id + path: pathStr, //地址 + isPlay: false, //是否播放中 + duration: dur, //时长 + curDuation: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + _self.data.fieldList[_self.data.currentIndex].valueList.push(item) + _self.setData({ + fieldList: _self.data.fieldList + }) + if (_self.data.fieldList[_self.data.currentIndex].valueList.length == _self.data.currentItem.maxCount) { + _self.setData({ + isShowAudio: false + }) + } + } + }) + .catch(err => {}) + }, + play(e) { + + //进行播放 + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + _self.data.fieldList[index].valueList.forEach(it => { + if (it.isPlay) { + innerAudioContext.stop() + } + it.isPlay = false + it.curDuation = 0 + it.curDuationStr = '00:00' + }) + if (!item.isPlay) { + // innerAudioContext.stop() + //找到该文件 + innerAudioContext = wx.createInnerAudioContext() + // 播放音频文件 + innerAudioContext.src = _self.data.fieldList[index].valueList[idx].path + innerAudioContext.autoplay = true + } + //先需要停止其他录音文件的播放 + + innerAudioContext.onPlay(() => { + _self.data.fieldList[index].valueList[idx].isPlay = true + _self.setData({ + fieldList: _self.data.fieldList + }) + }); + + innerAudioContext.onCanplay((res) => { + if (_self.data.waitFlag) { + innerAudioContext.play() + _self.setData({ + waitFlag: false + }) + } + }) + innerAudioContext.onStop((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onEnded((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onError((res) => { + _self.data.fieldList[index].valueList[idx].isPlay = false + _self.data.fieldList[index].valueList[idx].curDuration = 0 + _self.data.fieldList[index].valueList[idx].curDurationStr = '00:00' + _self.setData({ + fieldList: _self.data.fieldList, + }) + }) + innerAudioContext.onSeeking(() => { + console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + innerAudioContext.pause() + _self.setData({ + waitFlag: true + }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.fieldList[index].valueList[idx].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.fieldList[index].valueList[idx].duration = parseInt(innerAudioContext.duration) + console.log(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.fieldList[index].valueList[idx].curDurationStr = curMStr + ':' + curSStr + _self.data.fieldList[index].valueList[idx].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + + }, + //快进5秒 + speed(e) { + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + var item = e.currentTarget.dataset.item + var _self = this + if (item.isPlay) { + _self.data.fieldList[index].valueList[idx].curDuration = _self.data.fieldList[index].valueList[idx].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.fieldList[index].valueList[idx].curDuration) + _self.setData({ + fieldList: _self.data.fieldList + }) + } + }, + slider4change(e) { + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //显示弹框 + showDialog(e) { + console.log(e) + this.setData({ + isShowAudio: true, + currentItem: e.currentTarget.dataset.item, + currentIndex: e.currentTarget.dataset.index + }) + }, + //显示图片展示方式 + showDisplayType(e) { + this.setData({ + isShowType: true + }) + }, + showMutliSel(e) { + this.setData({ + isShowTags: true, + currentIndex: e.currentTarget.dataset.index + }) + }, + //提交保存 + doPublish() { + var _self = this + if (_self.checkParams()) { + wx.showToast({ + title: '保存中...', + }) + var params = _self.buildParams() + console.log(params) + app.http.post(app.urls.doSaveMoments.format({ + configColumnId: _self.data.columnId + }), { + data: params, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pages = getCurrentPages(); + let beforePage = pages[pages.length - 2]; + beforePage.setData({ + isRefresh: true + }) + wx.navigateBack({ + delta: 1 + }) + }) + .catch(err => { + // wx.hideLoading({}) + console.log(err) + }) + } + }, + //校验参数 + checkParams() { + var _self = this + var isLegal = true + for (var i = 0; i < _self.data.fieldList.length; i++) { + var field = _self.data.fieldList[i] + if (field.must) { + if (field.dataType == '1' || field.dataType == '7' || field.dataType == '8' || field.dataType == '9') { + if (field.value.length <= 0) { + wx.showToast({ + title: '请输入或选择' + field.comment, + icon: 'none' + }) + isLegal = false + break + } + } else { + if (field.valueList.length <= 0) { + wx.showToast({ + title: '请上传' + field.comment, + icon: 'none' + }) + isLegal = false + break + } + } + } + } + return isLegal + }, + //构建提交参数 + buildParams() { + var params = {} + var _self = this + for (var i = 0; i < _self.data.fieldList.length; i++) { + var field = _self.data.fieldList[i] + if (field.dataType == '1' || field.dataType == '7' || field.dataType == '8' || field.dataType == '9') { + if (field.value.length > 0) { + params[field.name] = field.value + } + } else { + if (field.valueList.length > 0) { + var ids = "" + if (field.dataType == '6') { + field.valueList.forEach(it => { + ids += it.latitude + ',' + it.longitude + '-' + }) + } else if (field.dataType == '4') { //视频 + field.valueList.forEach(it => { + ids += it.id + '&' + it.thumbId + ',' + }) + } else if (field.dataType == '3') { //音频 + field.valueList.forEach(it => { + ids += it.id + '&' + it.duration + ',' + }) + } else if (field.dataType == '2') { //图片 + field.valueList.forEach(it => { + ids += it.id + ',' + }) + ids = ids.substr(0, ids.length - 1) + ids += '@' + _self.data.selDisplayType + } else { + field.valueList.forEach(it => { + ids += it.id + ',' + }) + } + + if (field.dataType != '2') { + ids = ids.substr(0, ids.length - 1) + } + params[field.name] = ids + } + } + } + return params + } +}) \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublishline.json b/packagecard/moments/publish/momentpublishline.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/publish/momentpublishline.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublishline.wxml b/packagecard/moments/publish/momentpublishline.wxml new file mode 100755 index 0000000..0d51c72 --- /dev/null +++ b/packagecard/moments/publish/momentpublishline.wxml @@ -0,0 +1,328 @@ + + {{title}} + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + + + + {{item.comment}}{{item.valueList.length}}/{{item.maxCount}} + + + + + {{displayTypeStr}} + + + + + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + 语音,可以给名片访客留下更深的印象 + + + 点击添加 + + + + + + + + {{item.comment}} + + + {{item.valueList.length}}/{{item.maxCount}} + + + + + + + + + + + + + + + + + + + + {{item.comment}} + + + + + + + + {{item.comment}} + + + + + + + + + + {{m.name}}-{{m.address}} + + + + + + + + + + + + + + + 在地图上选取一个地点 + + + 点击添加 + + + + + + {{item.comment}} + + + {{item.dictionariesList[item.index].dataName}} + + + + + + + + {{item.comment}} + + + {{item.selValue}} + + + + + + + + + + + + + + + + + + + + + + + 00:{{speck_time>9 ? speck_time : '0'+ speck_time}} + 长按录音 + + + + + {{audioFile.isPlay ? '播放中:'+speck_time+'秒' : '时长:'+audioFile.duration+'秒'}} + + 点击播放 + 删除 + + + + + + + + 点击添加 + + + + + + + 点击添加 + + + + + + + 相册 + + + 相机 + + + + + + + + 相册 + + + 相机 + + + + + + + + + 点击添加 + + + + + + + + + + {{item.dataName}} + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/moments/publish/momentpublishline.wxss b/packagecard/moments/publish/momentpublishline.wxss new file mode 100755 index 0000000..999c3ce --- /dev/null +++ b/packagecard/moments/publish/momentpublishline.wxss @@ -0,0 +1,63 @@ +/* pages/moments/publish/momentpublish.wxss */ + + +van-action-sheet input { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + height: 60rpx; + line-height: 60rpx; + margin-top: 9rpx; + padding-left: 10rpx; +} + +van-action-sheet textarea { + border: 1px solid rgb(194, 194, 194); + border-radius: 10rpx; + margin-top: 9rpx; + padding: 10rpx; +} + +van-action-sheet .line { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; + border-top-width: 1rpx; + border-top-color: #f5f5f5; + border-top-style: solid; + border-bottom-width: 1rpx; + border-bottom-color: #f5f5f5; + border-bottom-style: solid; +} + +van-action-sheet .noline { + height: 90rpx; + text-align: center; + line-height: 90rpx; + width: 90%; +} + + +van-action-sheet .line:active { + color: black; + background-color: #f5f5f5; +} + +van-action-sheet .noline:active { + color: black; + background-color: #f5f5f5; +} + +.cu-form-group .title { + min-width: calc(4em + 30rpx); +} + + +.item-bottom-margin { + margin-bottom: 15rpx; + width: 100%; +} + +.item-padding { + padding: 15rpx; +} \ No newline at end of file diff --git a/packagecard/moments/showlist/showlist.js b/packagecard/moments/showlist/showlist.js new file mode 100755 index 0000000..fb96713 --- /dev/null +++ b/packagecard/moments/showlist/showlist.js @@ -0,0 +1,374 @@ +// pages/moments/showlist/showlist.js +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + data: { + currentIndex: 0, + tabList: [], + curId: '', //当前栏目ID + tempUserId: '', //当前栏目用户ID + dataList: [], //当前数据 + speedStep: 5, //快进快退秒数 + waitFlag: false, + topHeight: app.globalData.CustomBar, + currentTab: '', //当前选中的栏目 + count: 3, + }, + + onLoad(options) { + this.setData({ + curId: options.id, + tempUserId: options.userId, + }) + this.getTabs() + }, + getTabs() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMainColumn, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: _self.data.tempUserId + } + }) + .then(res => { + for (var i = 0; i < res.data.length; i++) { + if (res.data[i].configColumnId == _self.data.curId) { + _self.setData({ + currentTab: res.data[i], + currentIndex: i + }) + } + } + wx.hideLoading({}) + _self.setData({ + tabList: res.data + }) + _self.getMainMoment(_self.data.curId) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //切换标签 + onChange(e) { + var index = e.detail.index + var id = this.data.tabList[index].configColumnId + var _self = this + _self.setData({ + currentIndex: index, + currentTab: this.data.tabList[index] + }) + //重新请求数据 + _self.getMainMoment(id) + }, + getMainMoment(id) { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMainMoment.format({ + configColumnId: id + }), { + header: { + token: app.globalData.token + }, + data: { + userId: _self.data.tempUserId + } + }) + .then(res => { + wx.hideLoading({}) + _self.buildMainData(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + buildMainData(datas) { + var _self = this + datas.forEach(it => { + it.list.forEach(iem => { + switch (iem.dataType) { + case '2': //图片 + var photoIds = iem.value.split('@') + if (photoIds.length > 1) { + //展示方式 + iem.dataMode = photoIds[1] + } else { + iem.dataMode = '1' + } + var items = photoIds[0].split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '3': //音频 + var items = iem.value.split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var ss = item.split('&') + var totalStr = '00:00' + if (ss.length > 1) { + var dur = ss[1] + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + var tempItem = { + id: ss[0], //id + path: app.urls.baseImgUrl + ss[0], //地址 + isPlay: false, //是否播放中 + duration: 100000, //时长 + curDuration: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '4': //视频 + var items = iem.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i].length > 0) { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + iem.valueList = tempList + break + case '6': + var items = iem.value.split('-') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '8': //单选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + iem.selValue = ss.dataName + } + }) + break + case '9': //多选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + ss.isSel = true + } else { + ss.isSel = false + } + }) + break + } + }) + }) + _self.setData({ + dataList: datas + }) + }, + //预览图片 + viewImg(e) { + var imgPaths = [] + var imgs = e.currentTarget.dataset.values + this.setData({ + isNeedRefresh: false + }) + imgs.forEach(it => { + imgPaths.push(it.path) + }) + wx.previewImage({ + urls: imgPaths, + current: e.currentTarget.dataset.cur + }) + // wx.previewImage({ + // urls: [e.currentTarget.dataset.url], + // }) + }, + //预览视频 + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + play(e) { + //进行播放 + const _self = this + const index = e.currentTarget.dataset.index + const ix = e.currentTarget.dataset.i + const a = e.currentTarget.dataset.a + var audio = e.currentTarget.dataset.item + //先需要停止其他录音文件的播放 + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + if (item.dataType == '3') { + if (item.valueList) { + item.valueList.forEach(ii => { + if (ii.isPlay) { + innerAudioContext.stop() + } + ii.isPlay = false + ii.curDuration = 0 + ii.curDuationStr = '00:00' + }) + } + } + }) + }) + if (!audio.isPlay) { + innerAudioContext = wx.createInnerAudioContext() + innerAudioContext.src = _self.data.dataList[index].list[ix].valueList[a].path + '.mp3' + innerAudioContext.autoplay = true + } else { + innerAudioContext.stop() + } + innerAudioContext.onPlay(() => { + console.log('onPlay') + _self.data.dataList[index].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList + }) + }); + + innerAudioContext.onCanplay((res) => {}) + innerAudioContext.onStop((res) => { + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onEnded((res) => { + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onError((res) => { + _self.data.dataList[index].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onSeeking(() => {}) + innerAudioContext.onWaiting(() => {}) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.dataList[index].list[ix].valueList[a].duration = parseInt(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.dataList[index].list[ix].valueList[a].curDurationStr = curMStr + ':' + curSStr + _self.data.dataList[index].list[ix].valueList[a].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + dataList: _self.data.dataList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[ix].valueList[a].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[ix].valueList[a].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + onUnload(res) { + if (innerAudioContext) { + innerAudioContext.stop() + } + }, + showDetail(e) { + if (this.data.currentTab.configColumnType.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) { + //需要跳详情 + var cId = this.data.currentTab.configColumnId + var uId = e.currentTarget.dataset.uid + wx.navigateTo({ + url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, + }) + } + } +}) \ No newline at end of file diff --git a/packagecard/moments/showlist/showlist.json b/packagecard/moments/showlist/showlist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/moments/showlist/showlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/moments/showlist/showlist.wxml b/packagecard/moments/showlist/showlist.wxml new file mode 100755 index 0000000..caa1e51 --- /dev/null +++ b/packagecard/moments/showlist/showlist.wxml @@ -0,0 +1,230 @@ + + 栏目 + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.comment}}:{{child.selValue}} + + + + + + + + + {{child.comment}} + + + + + {{ss.dataName}} + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/moments/showlist/showlist.wxss b/packagecard/moments/showlist/showlist.wxss new file mode 100755 index 0000000..89afa6d --- /dev/null +++ b/packagecard/moments/showlist/showlist.wxss @@ -0,0 +1,672 @@ +.tab { + position: fixed; + left: 0; + right: 0; + background: #fff; + display: flex; + flex-direction: row; + height: 80rpx; + z-index: 100; +} + +.tab-box { + display: flex; + justify-content: center; + align-items: center; + font-size: 32rpx; + color: #000; +} + +.tab-box.active { + color: #055fe6; + border-bottom: 2px solid #055fe6; + box-sizing: border-box; +} + +.movie-item { + height: 280rpx; + width: 100%; + padding-bottom: 0px; +} + + +.card-container { + height: 0; + box-sizing: border-box; +} + +.share-btn { + background: #eee; +} + +.card { + width: 100%; + height: 0; + box-sizing: border-box; + background: #fff; + position: relative; + overflow: hidden; + /* text-align: center; */ +} + +.area-box { + white-space: nowrap; + word-break: break-all; +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.person { + padding: 20rpx; +} + +.dynamic-container { + margin-top: -50rpx; + position: relative; + background-color: #fff; + padding: 20rpx; + border-radius: 20rpx; +} + +.dynamic-title image { + width: 30rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4rpx; +} + +.catelog-title { + display: flex; + position: relative; + align-items: center; + justify-content: space-between; +} + +.catelog-title .action { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; + padding-right: 30rpx; +} + +.title { + font-size: 30rpx; + position: relative; + color: #fff; + border-top-right-radius: 48rpx; + border-top-left-radius: 48rpx; + background: #0054bd; + display: inline-block; + padding: 10rpx 60rpx 60rpx 10rpx; + margin-bottom: -50rpx; +} + +.title text { + margin-left: 20rpx; +} + +.column-box { + display: flex; + flex-direction: column; + background-color: #fff; + width: 100%; +} + +.column-content { + display: flex; + flex-direction: column; + background-color: #fff; + border-radius: 10rpx; + width: 100%; + box-shadow: 0px 2px 2px #f0f0f0; + z-index: 2; +} + +.intro-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.serve-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.person-content { + padding: 20rpx; + border-radius: 20rpx; + background: #fff; + margin-top: -30rpx; + font-size: 30rpx; + color: #000; + line-height: 40rpx; + word-break: break-all; + line-height: 40rpx; + letter-spacing: 2rpx; + position: relative; +} +.column-item { + margin: 0rpx; + padding: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.img-item { + width: 100%; + border-radius: 5rpx; +} + +.img-item:nth-child(1) { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.img-item:last-child { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.company-title { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #ddd; +} + +.company-title image { + width: 140rpx; + height: 140rpx; +} + +.company-name { + width: 520rpx; + height: 140rpx; + display: flex; + align-items: center; + font-size: 34rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.company-content { + background: #fff; + border-radius: 20rpx; + padding: 20rpx; + margin-top: -30rpx; + position: relative; +} + +.company-content image { + width: 100%; + height: 300rpx; + border-radius: 20rpx; +} + +.company .person-content { + margin-top: 0; +} + +.dynamic-title { + width: 710rpx; + margin: 0 auto; + display: block; +} + +.dynamic-box { + margin-bottom: 20rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; + position: relative; + height: 400rpx; +} + +.dynamic-box image { + width: 100%; + height: 400rpx; +} + +.dynamic-text { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + line-height: 60rpx; + color: #fff; + padding: 0 10rpx; + font-size: 30rpx; +} + +.person-info { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 1px solid #EEE; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + overflow: hidden; +} + +.avatar image { + width: 100%; + height: 100%; +} + +.person-name { + width: 530rpx; +} + +.name { + font-size: 32rpx; + margin: 15rpx 0 10rpx; + color: #000; +} + +.time { + color: #b2b2b2; +} + +.dynamic-content { + margin: 20rpx 0; +} + +.dynamic-img { + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.dynamic-img image { + width: 32%; + margin-right: 2%; + height: 160rpx; + margin-bottom: 10rpx; +} + +.dynamic-img image:nth-child(3n) { + margin-right: 0; +} + +.dynamic-img-text { + position: absolute; + left: 0; + right: 0; + bottom: 3rpx; + padding: 0 20rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 32rpx; + line-height: 70rpx; +} + +.dynamic-good { + margin: 10rpx 0; + display: flex; + justify-content: space-between; +} + +.good-count { + color: #333; + font-size: 28rpx; +} + +.good-btn image { + width: 40rpx; + height: 40rpx; + vertical-align: top; +} + +.dynamic-reply { + background: #eee; + padding: 15rpx; + margin-top: 15rpx; +} + +.reply { + font-size: 32rpx; + color: #000; + margin-bottom: 5rpx; +} + +.reply-name { + font-weight: bold; + display: inline; +} + +.dynamic-reply-input { + margin-top: 10rpx; +} + +.dynamic-reply-input input { + width: 100%; + height: 60rpx; + border-bottom: 1px solid #eee; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #0054bd; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card image { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.share-save { + text-align: center; + display: flex; + justify-content: space-between; +} + +.share-btn { + border: 1px solid #1296db; + background: none; + color: #1296db; + font-weight: normal; +} + +.save-btn { + border: 1px solid #1296db; + background: #1296db; + color: #fff; + font-weight: normal; +} + +.bottom-btn { + margin-top: 20rpx; + padding: 0 20rpx; + width: 100%; + white-space: nowrap; +} + +.phone-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.wechate-box .icon { + width: 35rpx; + height: 30rpx; + vertical-align: top; +} + +.email-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.bottom-btn-box { + display: inline-block; + min-width: 32%; + line-height: 30rpx; + padding: 20rpx; + box-sizing: border-box; + border: 1px solid #DDD; + border-radius: 10rpx; + margin-right: 10rpx; +} + +.bottom-text { + margin-top: 10rpx; +} + +.top-box { + padding-bottom: 20rpx; + background-color: #F7F7F7; +} + +.good { + display: flex; + justify-content: space-between; + padding-left: 20rpx; + padding-bottom: 20rpx; + background-color: #fff; +} + +.good-avatar, +.good-click { + line-height: 45rpx; + color: #333; +} + +.good-click { + display: flex; +} + +.view-count { + margin-right: 30rpx; + padding-right: 30rpx; + border-right: 1px solid #808080; + color: #808080; + display: flex; + flex-direction: row; + font-size: 36rpx; +} + +.view-count-no { + margin-right: 30rpx; + padding-right: 30rpx; + color: #808080; + display: flex; + flex-direction: row; + align-items: center; + font-size: 36rpx; +} + +.good-avatar image { + width: 100%; + height: 100%; +} + +.good-click image { + width: 38rpx; + height: 38rpx; +} + +.view-count image { + width: 32rpx; + height: 32rpx; +} + +.view-count-no image { + width: 32rpx; + height: 32rpx; +} + +.avatar-list { + width: 45rpx; + height: 45rpx; + margin-right: 10rpx; + vertical-align: top; + display: inline-block; +} + +.mid { + display: flex; + background: #0054bd; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + padding: 40rpx 0 80rpx; + margin-top: -20rpx; + position: relative; +} + +.mid-box { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-right: 1px solid #2f82ea; + background: none; + font-weight: normal; + width: auto !important; + padding: 0 !important; +} + +.mid-box:last-child { + border: none; +} + +.mid-box image { + width: 60rpx; + height: 60rpx; + margin-bottom: 20rpx; +} + +.mid-box-text { + font-size: 30rpx; + color: #fff; +} + +.mid-btn { + position: relative; + margin-top: -60rpx; + display: flex; + padding: 30rpx; + background: #fff; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + flex-wrap: wrap; + justify-content: space-between; +} + +.mid-btn-box { + flex-shrink: 0; + width: 49%; + margin-bottom: 20rpx; + padding: 15rpx; + border-radius: 20rpx; + background: #eee; + display: flex; + justify-content: space-between; + box-sizing: border-box; +} + +.mid-btn-box:nth-child(3), +.mid-btn-box:nth-child(4) { + margin-bottom: 0; +} + +.mid-btn-box image { + width: 80rpx; + height: 80rpx; +} + +.mid-btn-text { + width: 200rpx; +} + +.text-top { + line-height: 45rpx; + font-size: 30rpx; + color: #000; +} + +.text-bottom { + font-size: 26rpx; + color: #898989; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bar-code { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 999; +} + +.bar-code .content { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: 96%; + background: #fff; + /* width: 500rpx; + height: 500rpx; */ + border-radius: 10rpx; + padding: 20rpx; + min-width: 80%; + min-height: 50%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.code-title { + font-size: 32rpx; + font-weight: bold; + color: #000; +} + +.code-txt { + font-size: 32rpx; + color: #000; +} + +.bar-code image { + width: 300rpx; + height: 300rpx; +} \ No newline at end of file diff --git a/packagecard/paypage/paypage.js b/packagecard/paypage/paypage.js new file mode 100755 index 0000000..dbbedf5 --- /dev/null +++ b/packagecard/paypage/paypage.js @@ -0,0 +1,321 @@ +// packagecard/paypage/paypage.js +const app = getApp() +const utils = require('../../utils/util') +const RSA = require('../../utils/rsa') +Page({ + + /** + * 页面的初始数据 + */ + data: { + nodes: [{ + name: 'div', + children: [{ + type: 'text', + text: ' ' + }] + }], + inviteCode: '', //邀请码 + dispatchCode: '', //人员码 + price: 0, //价格 + orderNumber: '00001', + orderDate: '2020-20-20', + orderGoodsName: '', + hintMsg: '', //提示信息 + isInput: true, //是否是手动输入金额 + isChecked: false, //勾选用户协议 + isShowTreaty: false, //是否显示协议 + treatyStr: '', //协议内容 + isDisplayTreaty: false, //是否需要勾选用户协议 + isShowHint: false, //是否显示提示内容 + type: 1, //1.支付总20 2.支付单个 + isShowUseDeal: false, //使用协议 + isShowServiceTreaty: false, //会员服务协议 + isShowIntimacyTreaty: false, //隐私政策 + typeList: [], //开通的类型列表 + selTypeIndex: 0, //当前选中的类型列表 + selTypeId: '', //当前选中的类型id + selType: '', //选中的类型type + isShowContrast: false, //是否显示版本对比 + contrastId: '', //版本对比图片ID + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + orderGoodsName: '会员服务费', + hintMsg: '您本次支付的费用为会员服务费,本次支付成功后可以使用免费模板来创建名片', + isShowHint: true + }) + this.getPayTypeList() + }, + //获取开通类型列表 + getPayTypeList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMemberTypeList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (res.data.length > 0) { + res.data.sort((a, b) => { + return b.cardChargeRoleStatus - a.cardChargeRoleStatus + }) + _self.setData({ + typeList: res.data, + selTypeIndex: 0, + selTypeId: res.data[0].cardChargeRoleId, + price: res.data[0].cardChargeRolePrice, + orderGoodsName: res.data[0].cardChargeRoleName, + selType: res.data[0].cardChargeRoleType + }) + } + }) + .catch(err => { + + }) + }, + //获取总使用权限的订单预支付信息 + getUsePayOrder() { + wx.showLoading({ + title: '加载中...', + }) + }, + changeCheck(e) { + this.setData({ + isChecked: !this.data.isChecked + }) + }, + inputWatch(e) { + this.setData({ + inviteCode: e.detail.value + }) + }, + //显示协议 + showTreaty() { + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getTreaty, { + header: { + token: app.globalData.token + } + }) + .then(res => { + console.log(res.data) + wx.hideLoading({}) + this.setData({ + treatyStr: res.data, + isShowTreaty: true + }) + }) + .catch(err => { + + }) + }, + onClose() { + this.setData({ + isShowUseDeal: false, //使用协议 + isShowServiceTreaty: false, //会员服务协议 + isShowIntimacyTreaty: false, //隐私政策 + isShowContrast: false //版本对比 + }) + }, + //提交支付 + doPay() { + var _self = this + if (_self.data.isChecked) { + _self.wxPay() + } else { + wx.showToast({ + title: '请勾选使用协议', + icon: 'error', + success(res) { + setTimeout(() => { + _self.useDeal() + }, 800) + } + }) + } + }, + + //微信支付 + wxPay() { + wx.showLoading({ + title: '支付中...', + }) + if (this.data.type == 1) { + this.doPayUseOrder() + } else if (this.data.type == 2) { + this.doPaySingleOrder() + } + }, + //支付单一名片 + doPaySingleOrder() { + + }, + //选中开通的 + chooseType(e) { + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var _self = this + if (item.cardChargeRoleStatus == 1) { + _self.setData({ + selTypeIndex: idx, + selTypeId: item.cardChargeRoleId, + price: item.cardChargeRolePrice, + orderGoodsName: item.cardChargeRoleName, + selType: item.cardChargeRoleType + }) + } + }, + //支付总的金额 + doPayUseOrder() { + var _self = this + app.http.post(app.urls.getCardPayState.format({ + mode: _self.data.selType + }), { + header: { + token: app.globalData.token + }, + data: { + cardChargeInvitationUserId: _self.data.inviteCode != '' ? _self.data.inviteCode : app.globalData.showUserId, + cardChargeRole: _self.data.selTypeId + } + }) + .then(res => { + wx.hideLoading({}) + if (res.statusCode == 200) { + var tempId = res.data.prepayId + wx.requestPayment({ + nonceStr: res.data.nonceStr, + package: 'prepay_id=' + res.data.prepayId, + paySign: res.data.paySign, + signType: 'RSA', + timeStamp: res.data.timestamp, + success(res) { + if (res.errMsg == 'requestPayment:ok') { + //支付成功 + wx.redirectTo({ + url: '/pages/mine/order/ordersuccess?type=' + 2 + '&msg=支付成功&fMsg=去创建名片&price=' + _self.data.price + '&prepayId=' + tempId, + }) + } + }, + fail(err) { + if (err.errMsg == 'requestPayment:fail cancel') { + //支付取消 + wx.showToast({ + title: '您取消了支付', + icon: 'error' + }) + } else { + wx.showToast({ + title: '支付失败,请稍后重试', + icon: 'none' + }) + } + } + }) + } + }) + .catch(err => { + // wx.showToast({ + // title: '获取订单失败', + // icon: 'err' + // }) + }) + }, + //用户协议 + useDeal() { + wx.showLoading({ + title: '加载中...', + }) + this.setData({ + treatyStr: '' + }) + app.http.get(app.urls.getTreaty.format({ + key: 'cardCreateTemplateUse' + }), {}) + .then(res => { + wx.hideLoading({}) + this.setData({ + treatyStr: res.data.data, + isShowUseDeal: true + }) + }) + .catch(err => { + + }) + }, + //会员服务协议 + serviceDeal() { + wx.showLoading({ + title: '加载中...', + }) + this.setData({ + treatyStr: '' + }) + app.http.get(app.urls.getTreaty.format({ + key: 'cardCreateTreaty' + }), {}) + .then(res => { + wx.hideLoading({}) + this.setData({ + treatyStr: res.data.data, + isShowUseDeal: true + }) + }) + .catch(err => { + + }) + }, + //隐私政策 + useIntimacy() { + wx.showLoading({ + title: '加载中...', + }) + this.setData({ + treatyStr: '' + }) + app.http.get(app.urls.getTreaty.format({ + key: 'privacyPolicy' + }), {}) + .then(res => { + wx.hideLoading({}) + this.setData({ + treatyStr: res.data.data, + isShowIntimacyTreaty: true + }) + }) + .catch(err => { + + }) + }, + //显示版本对比 + showContrast() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getVersionContrast, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + contrastId: app.urls.baseImgUrl + res.data.data, + isShowContrast: true, + }) + }) + .catch(err => {}) + } +}) \ No newline at end of file diff --git a/packagecard/paypage/paypage.json b/packagecard/paypage/paypage.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/paypage/paypage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/paypage/paypage.wxml b/packagecard/paypage/paypage.wxml new file mode 100755 index 0000000..eaea0a3 --- /dev/null +++ b/packagecard/paypage/paypage.wxml @@ -0,0 +1,102 @@ + + 会员服务 + + + + + 会员服务费 + {{(orderGoodsName)}} + + + + + + {{price}} + + + + 付款提示: + {{hintMsg}} + + + + 邀请码 (选填) + + + + + + + + + + {{item.cardChargeRoleName}} + + ¥{{item.cardChargeRolePrice}} + + + + + + + + + 已阅读并同意《使用协议》&《会员服务协议》&《隐私政策》 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/paypage/paypage.wxss b/packagecard/paypage/paypage.wxss new file mode 100755 index 0000000..a9d7f41 --- /dev/null +++ b/packagecard/paypage/paypage.wxss @@ -0,0 +1,206 @@ +/* packagecard/paypage/paypage.wxss */ +.pay-info { + display: flex; + flex-direction: column; + justify-content: center; + align-content: center; + width: 100%; + padding: 15rpx; + border-radius: 5rpx; + +} + +.info-box { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + background-color: #ffffff; + border-bottom-left-radius: 15rpx; + border-bottom-right-radius: 15rpx; + box-shadow: 0 4rpx 4rpx 0 rgba(52, 52, 55, 0.05), 0 6rpx 5px 0 rgba(52, 52, 55, 0.19); +} + +.input-box { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + background-color: #ffffff; + border-bottom-left-radius: 15rpx; + border-bottom-right-radius: 15rpx; + box-shadow: 0 4rpx 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); +} + +.pay-info-item { + font-size: 28rpx; + width: 100%; + text-align: center; + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.pay-info-item:nth-child(1) { + padding: 0rpx 0rpx 7.5rpx 0rpx; + color: #999999; + font-size: 30rpx; +} + +.order-price-box { + display: flex; + flex-direction: row; + justify-content: center; + align-content: center; + width: 100%; + margin: 15rpx; +} + +.hint-msg { + width: 100%; + font-size: 25rpx; + color: #9c9a9a; + text-align: center; + line-height: 50rpx; + justify-content: center; +} + +.order-price-box .icon { + font-size: 45rpx; + text-align: center; + line-height: 80rpx; +} + +.order-price-box .price { + font-size: 90rpx; + text-align: center; + line-height: 60rpx; +} + +.price-input { + font-size: 45rpx; + text-align: center; + align-self: center; + border: 1rpx solid #5f5f5f; + padding: 15rpx; + margin-left: 15rpx; + height: 70rpx; + border-radius: 10rpx; +} + +.code-box { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + width: 100%; + font-size: 28rpx; + background-color: #ffffff; + box-shadow: 0 4rpx 4rpx 0 rgba(52, 52, 55, 0.05), 0 6rpx 5px 0 rgba(52, 52, 55, 0.19); + margin-top: 15rpx; + padding: 15rpx 0rpx; + color: #050505; +} + +.code-box .title { + text-align: center; + font-weight: normal; +} + +.code-box image { + width: 96rpx; + height: 96rpx; +} + +.code-input { + text-align: left; + align-self: center; + padding: 15rpx; + margin-left: 15rpx; + height: 70rpx; + border-radius: 10rpx; + width: 60%; +} + +.treaty-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + margin-bottom: 40rpx; + font-size: 28rpx; + margin-top: 15rpx; + background-color: #ffffff; + height: 50%; + width: 90%; +} + +.treaty-content-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15rpx; + height: 90%; + background-color: #ffffff; + border-radius: 5rpx; +} + +.treaty-content-box .title { + font-size: 36rpx; + color: #000; +} + +.treaty-content-box .content { + font-size: 28rpx; + color: #000; + margin-top: 15rpx; +} + +.code-msg { + width: 66%; + font-size: 24rpx; + color: #9c9a9a; + text-align: center; + justify-content: center; +} + +.type-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + padding: 15rpx; + margin-bottom: 210rpx; + box-shadow: 0 4rpx 4rpx 0 rgba(52, 52, 55, 0.05), 0 6rpx 5px 0 rgba(52, 52, 55, 0.19); + margin-top: 15rpx; + background-color: #ffffff; +} + +.type-item { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 30rpx 15rpx 0rpx 15rpx; + font-size: 28rpx; + +} + +.type-item:nth-child(1) { + padding: 0rpx 15rpx 0rpx 15rpx; +} + +.yellow-text { + color: #E6B980; +} + +.gray-text { + color: #c7c7c7; +} + +.black-text { + color: #0f0f0f; +} \ No newline at end of file diff --git a/packagecard/paypage/paystate.js b/packagecard/paypage/paystate.js new file mode 100755 index 0000000..a342a93 --- /dev/null +++ b/packagecard/paypage/paystate.js @@ -0,0 +1,66 @@ +// packagecard/paypage/paystate.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/paypage/paystate.json b/packagecard/paypage/paystate.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/paypage/paystate.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/paypage/paystate.wxml b/packagecard/paypage/paystate.wxml new file mode 100755 index 0000000..2213f5f --- /dev/null +++ b/packagecard/paypage/paystate.wxml @@ -0,0 +1,6 @@ + + 订单状态 + + + 当前支付结果后台正在处理中,请您耐心等待.如半个小时后任未处理完成 + \ No newline at end of file diff --git a/packagecard/paypage/paystate.wxss b/packagecard/paypage/paystate.wxss new file mode 100755 index 0000000..ab95c9e --- /dev/null +++ b/packagecard/paypage/paystate.wxss @@ -0,0 +1 @@ +/* packagecard/paypage/paystate.wxss */ \ No newline at end of file diff --git a/packagecard/purse/recordlist.js b/packagecard/purse/recordlist.js new file mode 100755 index 0000000..2a9ce88 --- /dev/null +++ b/packagecard/purse/recordlist.js @@ -0,0 +1,89 @@ +// pages/mine/vip/vipcenter.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curPage: 1, + isRefreshing: false, //是否在刷新中 + hasMore: true, //是否有更多数据 + isLoadMore: false, //是否正在加载更多 + recordList: [], + isDredge: true, //是否开通过会员 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) {}, + onShow(e) { + wx.startPullDownRefresh({}) + }, + //获取提现记录列表 + getRecordList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getTakeCashList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.curPage, + rows: '10' + } + }) + .then(res => { + wx.stopPullDownRefresh({}) + wx.hideLoading({}) + _self.data.recordList = _self.data.recordList.concat(res.data.rows) + var more = _self.data.recordList.length < res.data.total + _self.setData({ + recordList: _self.data.recordList, + isRefreshing: false, + isLoadMore: false, + hasMore: more + }) + }) + .catch(err => { + wx.stopPullDownRefresh({}) + _self.setData({ + isRefreshing: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + + //加载更多 + doLoadMore() { + var _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + this.setData({ + isLoadMore: true, + curPage: ++_self.data.curPage + }) + this.getRecordList() + } + }, + onReachBottom() { + this.doLoadMore() + }, + //下拉刷新 + onPullDownRefresh() { + this.setData({ + isLoadMore: false, + isRefreshing: true, + hasMore: true, + recordList: [], + curPage: 1 + }) + this.getRecordList() + } +}) \ No newline at end of file diff --git a/packagecard/purse/recordlist.json b/packagecard/purse/recordlist.json new file mode 100755 index 0000000..7360326 --- /dev/null +++ b/packagecard/purse/recordlist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/packagecard/purse/recordlist.wxml b/packagecard/purse/recordlist.wxml new file mode 100755 index 0000000..d7ddffe --- /dev/null +++ b/packagecard/purse/recordlist.wxml @@ -0,0 +1,37 @@ + + 提现记录 + + + + + + + 申请时间:{{item.accountWithdrawApplyTime}} + + 提现金额:¥{{item.accountWithdrawMoney/100}} + + + 未通过原因:{{item.accountWithdrawCheckRemark}} + + + + + + + 未通过 + + + 审核中 + + + 已通过 + + + + + 加载中... + + + + \ No newline at end of file diff --git a/packagecard/purse/recordlist.wxss b/packagecard/purse/recordlist.wxss new file mode 100755 index 0000000..d2b5f5c --- /dev/null +++ b/packagecard/purse/recordlist.wxss @@ -0,0 +1,121 @@ +/* pages/mine/vip/vipcenter.wxss */ + + +.info-box { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + align-self: center; + box-shadow: 0rpx 4rpx 8rpx 0rpx #efd9be, 0rpx 6rpx 20rpx 0rpx #efd9be; + border-radius: 10rpx; + padding: 10rpx 0rpx; +} + +.base-info { + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; + padding: 15rpx; +} + +.base-info .user-icon { + width: 128rpx; + height: 128rpx; + border-radius: 50%; + border: 6rpx solid #ffbc00; +} + +.base-info-text-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; +} + +.name-box { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.name-box .name { + font-size: 32rpx; + color: #ffffff; + line-height: 10rpx; +} + +.name-box image { + width: 48rpx; + height: 48rpx; + margin-left: 15rpx; +} + +.item { + display: flex; + flex-direction: row; + position: relative; + justify-content: flex-start; + align-items: center; + background-color: #ffffff; + width: 100%; + padding: 15rpx; + margin-top: 15rpx; +} + +.item:nth-child(1) { + margin-top: 0rpx; +} + +.subscript { + width: 96rpx; + height: 96rpx; + position: absolute; + right: 0rpx; + bottom: 0rpx; +} + +.subscript image { + width: 100%; + height: 100%; +} + +.state { + position: absolute; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 22rpx; + width: 100%; + height: 100%; + top: 28%; + left: 112%; + color: #ffffff; +} + +.item .icon { + width: 96rpx; + height: 96rpx; + border-radius: 50%; +} + +.item .content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; + width: 85%; +} + +.title { + font-size: 32rpx; + color: #E6B980; +} + +.hint-msg { + font-size: 28rpx; + color: #333333; +} \ No newline at end of file diff --git a/packagecard/purse/takecash.js b/packagecard/purse/takecash.js new file mode 100755 index 0000000..583b2be --- /dev/null +++ b/packagecard/purse/takecash.js @@ -0,0 +1,117 @@ +// packagecard/purse/takecash.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + selType: '1', + accountInfo: {}, + takeValue: 0, //提现的金额 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getAccount() + }, + //获取账户信息 + getAccount() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMyAccount, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + accountInfo: res.data + }) + }) + .catch(err => { + console.log(err) + }) + }, + //全部提现 + takeAll() { + this.setData({ + takeValue: this.data.accountInfo.accountMoney / 100 + }) + }, + //监听输入框 + inputWatch(e) { + this.setData({ + takeValue: e.detail.value + }) + }, + //提交提现申请 + doCash(e) { + //判断输入的值是否大于账户中的数量 + var _self = this + if (_self.data.takeValue == 0) { + wx.showToast({ + title: '请输入提现金额', + icon: 'error' + }) + return + } + if (_self.data.takeValue < 1) { + wx.showToast({ + title: '最低提现1元', + icon: 'error' + }) + return + } + if (_self.data.takeValue > (_self.data.accountInfo.accountMoney / 100)) { + wx.showToast({ + title: '超过零钱余额', + icon: 'error' + }) + return + } + //提现 + _self.toCash() + }, + toCash() { + var _self = this + wx.showLoading({ + title: '申请中...', + }) + app.http.post(app.urls.doTakeCash, { + header: { + token: app.globalData.token + }, + data: { + accountWithdrawMoney: _self.data.takeValue * 100 + } + }) + .then(res => { + + wx.hideLoading({}) + wx.showToast({ + title: '申请成功', + icon: 'success', + success(res) { + setTimeout(() => { + wx.navigateBack({}) + }, 800) + } + }) + }) + .catch(err => { + console.log(err) + }) + }, + //提现记录 + toRecord() { + wx.navigateTo({ + url: '/packagecard/purse/recordlist', + }) + } +}) \ No newline at end of file diff --git a/packagecard/purse/takecash.json b/packagecard/purse/takecash.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/purse/takecash.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/purse/takecash.wxml b/packagecard/purse/takecash.wxml new file mode 100755 index 0000000..f4fa579 --- /dev/null +++ b/packagecard/purse/takecash.wxml @@ -0,0 +1,70 @@ + + 立即提现 + + + + 可提现金额(元) + + ¥ + {{accountInfo.accountMoney/100}} + + + + 最低提现金额(元) + ¥1.00 + + + 查看提现记录 + + + + + + + + 提现金额 + + + ¥ + + 全部提现 + + + 提现至微信零钱 + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/purse/takecash.wxss b/packagecard/purse/takecash.wxss new file mode 100755 index 0000000..677de42 --- /dev/null +++ b/packagecard/purse/takecash.wxss @@ -0,0 +1,82 @@ +/* packagecard/purse/takecash.wxss */ +.content-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + width: 100%; + background-color: #E6B980; + border-radius: 10rpx; + color: #ffffff; +} + +.content-bottom-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + background-color: #D6A970; + border-bottom-left-radius: 10rpx; + border-bottom-right-radius: 10rpx; + padding: 25rpx; + font-size: 28rpx; + margin-top: 25rpx; +} + +.cash-box { + padding: 15rpx; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: flex-start; + width: 100%; + background-color: #fff; + border-radius: 5rpx; + box-shadow: 0 4rpx 8rpx 0 #DFDBDB, 0 6rpx 20rpx 0 #DFDBDB; + margin-top: 15rpx; +} + +.cash-box .title { + font-size: 32rpx; +} + +.cash-bottom-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + border-top: 1rpx solid #f3f3f3; + padding: 20rpx 20rpx 0rpx 20rpx; +} + +.input-box { + width: 100%; + display: flex; + flex-direction: row; + align-items: flex-end; + justify-content: flex-start; + font-size: 80rpx; + padding: 20rpx; + line-height: 80rpx; +} + +.input-box input { + width: 80%; + text-align: left; + line-height: 80rpx; + height: 80rpx; + font-size: 80rpx; + padding-left: 15rpx; +} + +.title-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 100%; + font-size: 32rpx; + padding: 0rpx 20rpx 20rpx 20rpx; +} \ No newline at end of file diff --git a/packagecard/sharePage/cardcode.js b/packagecard/sharePage/cardcode.js new file mode 100755 index 0000000..ef4e54d --- /dev/null +++ b/packagecard/sharePage/cardcode.js @@ -0,0 +1,67 @@ +// packagecard/sharePage/cardcode.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: app.urls.baseImgUrl, + animationData: {}, + cardImg: '', + id: '', + contentHeight: app.globalData.windowHeight, + translateUp: {}, //上平移 + translateDown: {}, //下移 + animDuration: 800, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + cardImg: options.cardImg, + id: options.id + }) + + }, + onReady() { + var _self = this + this.setData({ + animationData: {}, + translateDown: {}, + translateUp: {} + }) + var rotate = wx.createAnimation({ + duration: _self.data.animDuration, + timingFunction: 'linear', + transformOrigin: '50% 50% 0' + }) + rotate.rotate(180).step() + //上移 + var trUp = wx.createAnimation({ + duration: _self.data.animDuration, + timingFunction: 'linear', + transformOrigin: '50% 50% 0' + }) + trUp.translateY(160).step() + //下移 + var trDown = wx.createAnimation({ + duration: _self.data.animDuration, + timingFunction: 'linear', + transformOrigin: '50% 50% 0' + }) + trDown.translateY(-160).step() + this.setData({ + animationData: rotate.export(), + }) + + setTimeout(() => { + _self.setData({ + translateUp: trUp.export(), + translateDown: trDown.export() + }) + }, _self.data.time); + } +}) \ No newline at end of file diff --git a/packagecard/sharePage/cardcode.json b/packagecard/sharePage/cardcode.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/sharePage/cardcode.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/sharePage/cardcode.wxml b/packagecard/sharePage/cardcode.wxml new file mode 100755 index 0000000..0637c23 --- /dev/null +++ b/packagecard/sharePage/cardcode.wxml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/sharePage/cardcode.wxss b/packagecard/sharePage/cardcode.wxss new file mode 100755 index 0000000..2734a2a --- /dev/null +++ b/packagecard/sharePage/cardcode.wxss @@ -0,0 +1,38 @@ +/* packagecard/sharePage/cardcode.wxss */ + + +.content-box { + border-radius: 10rpx; + min-width: 100%; + display: flex; + flex-direction: column; + background: #ffffff; + align-items: center; + justify-content: center; +} + +.image1 { + width: 70%; + height: 70%; + /* box-shadow: 10rpx 10rpx 40rpx #dadada; */ + align-self: center; + /* border-radius: 50%; */ +} + +.box { + width: 95%; + /* box-shadow: 10rpx 10rpx 40rpx #dadada; */ + position: absolute; + z-index: 1; + display: flex; + justify-content: center; + align-items: center; + padding: 15rpx; +} + +.image2 { + width: 95%; + box-shadow: 1rpx 1rpx 5rpx #f5f5f5; + position: absolute; + z-index: 2; +} \ No newline at end of file diff --git a/packagecard/sharePage/sharePage.js b/packagecard/sharePage/sharePage.js new file mode 100755 index 0000000..35e3de5 --- /dev/null +++ b/packagecard/sharePage/sharePage.js @@ -0,0 +1,684 @@ +// pages/sharePage/sharePage.js +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + curIndex: 0, + token: '', + cardTemplateUseId: '', + cardTemplateDispatchId: '', + cardInfo: {}, + areaList: [], + haveCard: false, + bgImg: '', + areaList: [], + cardHeight: '', + cardInfo: {}, + cardUrl: app.urls.baseImgUrl, + personIntro: {}, + companyIntro: {}, + shareImg: '', + phoneTxt: '', + emailTxt: '', + wechateTxt: '', + addressTxt: '', + viewInfo: {}, + forwardCount: '', + imgUrl: app.urls.baseImgUrl, + personId: '', + shareRecordId: '', + nameTxt: '名片', + dataList: [], + isShowBarCode: false, + browUserList: [], + tempUserId: '', + shareImgUrl: '' + }, + // 登录 + doLogin() { + var self = this; + wx.showLoading({ + title: '加载中...', + }) + wx.login({ + success(res) { + app.http.post(app.urls.wxLogin, { + data: { + jsCode: res.code + } + }) + .then(res => { + wx.hideLoading({}) + var token = res.data.data.split('_')[0] + wx.setStorageSync('token', token) + wx.setStorageSync('bindPhone', res.data.data.split('_')[1]) + self.setData({ + token: token + }) + app.globalData.token = token + self.getCardId() + }) + .catch(err => { + wx.hideLoading({}) + console.log(err) + }) + } + }) + }, + // 保存查看记录 + saveCheckRecord: function () { + var self = this + console.log('1123') + app.http.post(app.urls.checkRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardTemplateUseId, + cardTemplateDispatchId: self.data.cardTemplateDispatchId + } + }).then(res => { + console.log(res) + }).catch(res => { + console.log(res) + }) + }, + // 获取名片 + getCard: function () { + var self = this + app.http.get(app.urls.shareCard.format({ + cardTemplateUseId: self.data.cardTemplateUseId + }), { + header: { + token: self.data.token + }, + data: {} + }).then(res => { + console.log(res.data) + var area = res.data.areaList + for (let i = 0; i < area.length; i++) { + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + if (area[i].templateAreaSource == 'phone') { + self.setData({ + phoneTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'wechat') { + self.setData({ + wechatTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'email') { + self.setData({ + emailTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'address') { + self.setData({ + addressTxt: area[i].templateAreaFontValue + }) + } else if (area[i].templateAreaSource == 'name') { + self.setData({ + nameTxt: area[i].templateAreaFontValue + }) + } + } + self.setData({ + cardInfo: res.data, + areaList: area, + dataList: [] + }) + if (res.data) { + self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) + self.getBrowCardUserList(res.data.cardTemplateUseId) + self.setData({ + tempUserId: res.data.creator + }) + self.getMainColumn(res.data.creator) + } + }) + }, + //获取首页展示的栏目 + getMainColumn(id) { + var _self = this + app.http.get(app.urls.getMainColumn, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: id + } + }) + .then(res => { + wx.showLoading({ + title: '加载中...', + }) + console.log(res.data) + _self.getMainMoment(res.data, id, 0) + }) + .catch(err => {}) + }, + getMainMoment(datas, id, index) { + var _self = this + var count = datas.length + if (index < count) { + app.http.get(app.urls.getMainMoment.format({ + configColumnId: datas[_self.data.curIndex].configColumnId + }), { + header: { + token: app.globalData.token + }, + data: { + userId: id + } + }) + .then(res => { + if (res.data.length > 0) { + var tempItem = { + cId: datas[_self.data.curIndex].configColumnId, + type: datas[_self.data.curIndex].configColumnType, + name: datas[_self.data.curIndex].configColumnName, + mode: datas[_self.data.curIndex].configTableMode, + list: res.data.slice(0, datas[_self.data.curIndex].configColumnRowCount) + } + _self.data.dataList.push(tempItem) + } + _self.setData({ + curIndex: ++_self.data.curIndex + }) + _self.getMainMoment(datas, id, _self.data.curIndex) + }) + .catch(err => { + _self.setData({ + curIndex: ++_self.data.curIndex + }) + _self.getMainMoment(datas, id, _self.data.curIndex) + }) + } else { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + _self.buildMainData() + } + }, + //构建主页显示数据 + buildMainData() { + var _self = this + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(iem => { + switch (iem.dataType) { + case '2': //图片 + var items = iem.value.split(',') + var tempList = [] + items.forEach(item => { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + }) + iem.valueList = tempList + break + case '3': //音频 + var items = iem.value.split(',') + var tempList = [] + items.forEach(item => { + var tempItem = { + id: item, //id + path: app.urls.baseImgUrl + item, //地址 + isPlay: false, //是否播放中 + duration: 100000, //时长 + curDuration: 0, + curDurationStr: '00:00', + totalDurationStr: '00:00' + } + tempList.push(tempItem) + }) + iem.valueList = tempList + break + case '4': //视频 + var items = iem.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + iem.valueList = tempList + break + case '6': + var items = iem.value.split('-') + var tempList = [] + items.forEach(item => { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + }) + iem.valueList = tempList + break + case '8': //单选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + iem.selValue = ss.dataName + } + }) + break + case '9': //多选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + ss.isSel = true + } else { + ss.isSel = false + } + }) + break + } + }) + }) + }) + _self.setData({ + curIndex: 0, + dataList: _self.data.dataList + }) + }, + // 加入卡包 + includedCard: function () { + var self = this + app.http.post(app.urls.includedCard, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseBagId: "", + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateUseStar: "", + cardTemplateUseTag: "", + cardTemplateUseTop: "" + } + }).then(res => { + if (res.statusCode == '200') { + wx.showToast({ + title: '加入卡包成功!', + }) + } + }) + }, + // 获取名片id + getCardId: function () { + var self = this + app.http.get(app.urls.getCardUseId.format({ + cardTemplateDispatchId: self.data.cardTemplateDispatchId + }), { + header: { + token: self.data.token + } + }).then(res => { + self.setData({ + cardTemplateUseId: res.data.cardTemplateUseDTO.cardTemplateUseId + }) + self.getCard() + self.saveCheckRecord() + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + cardTemplateDispatchId: options.cardTemplateDispatchId + }) + this.doLogin() + }, + // 拨打电话 + makeCall: function () { + var self = this + var phone = self.data.phoneTxt + if (phone) { + wx.makePhoneCall({ + phoneNumber: phone, + }) + } + }, + // 复制文本 + copyText: function (e) { + var self = this + var text = e.currentTarget.dataset.text + if (text) { + wx.setClipboardData({ + data: text, + success: function () {} + }) + } + }, + // 展示名片码 + showBarCode: function () { + this.setData({ + isShowBarCode: true + }) + }, + // 隐藏名片码 + hideBarCode: function () { + this.setData({ + isShowBarCode: false + }) + }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function (res) { + var self = this + wx.showShareMenu({ + withShareTicket: true, + success: function (res) { + console.log(res) + } + }) + + if (res.from == 'button') { + var postId = self.buildId() + self.shareRecord(postId) + + var param = '/pages/sharePage/sharePage?cardTemplateDispatchId=' + postId; + return { + title: '名片分享', + path: param, + imageUrl: self.data.shareImgUrl + } + // return返回 title 转发标题 path 路径 imageUrl 自定义图片,可以本地路径 代码包文件路径 支持png jpg 显示长宽比5:4 + } + }, + //获取浏览当前名片的用户头像列表 + getBrowCardUserList(id) { + var _self = this + app.http.get(app.urls.getCardBrowUserList, { + header: { + token: app.globalData.token + }, + data: { + page: '1', + rows: '7', + cardTemplateUseId: id + } + }) + .then(res => { + if (res.data) { + _self.setData({ + browUserList: res.data.rows + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + // 转发记录 + shareRecord: function (cardTemplateDispatchId) { + var self = this + app.http.post(app.urls.shareRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateDispatchParentId: self.data.cardTemplateDispatchId, + cardTemplateDispatchId: cardTemplateDispatchId + } + }).then(res => { + console.log(res.data) + self.setData({ + shareRecordId: res.data.data + }) + }) + }, + // 生成随机id + buildId: function () { + var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + var nums = ""; + for (var i = 0; i < 36; i++) { + var id = parseInt(Math.random() * 61); + nums += chars[id]; + } + return nums + }, + //预览图片 + viewImg(e) { + wx.previewImage({ + urls: [e.currentTarget.dataset.url], + }) + }, + //预览视频 + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + play(e) { + //进行播放 + const _self = this + const index = e.currentTarget.dataset.index + const idx = e.currentTarget.dataset.idx + const ix = e.currentTarget.dataset.i + const a = e.currentTarget.dataset.a + var audio = e.currentTarget.dataset.item + //先需要停止其他录音文件的播放 + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(ix => { + if (ix.dataType == '3') { + if (ix.valueList) { + ix.valueList.forEach(ii => { + if (ii.isPlay) { + innerAudioContext.stop() + } + ii.isPlay = false + ii.curDuration = 0 + ii.curDuationStr = '00:00' + }) + } + } + }) + }) + }) + if (!audio.isPlay) { + innerAudioContext = wx.createInnerAudioContext() + innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3' + innerAudioContext.autoplay = true + console.log(_self.data.dataList[index].list[idx].list[ix].valueList[a].path) + } else { + innerAudioContext.stop() + } + + + innerAudioContext.onPlay(() => { + console.log('onPlay') + _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList + }) + }); + + innerAudioContext.onCanplay((res) => { + // if (_self.data.waitFlag) { + // innerAudioContext.play() + // _self.setData({ + // waitFlag: false + // }) + // } + }) + innerAudioContext.onStop((res) => { + console.log('停止播放') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onEnded((res) => { + console.log(res) + console.log('播放完毕') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onError((res) => { + console.log('播放错误') + console.log(res) + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + }) + innerAudioContext.destroy() + }) + innerAudioContext.onSeeking(() => { + // console.log(innerAudioContext.currentTime) + }) + innerAudioContext.onWaiting(() => { + // console.log('onWaiting') + // innerAudioContext.pause() + // _self.setData({ + // waitFlag: true + // }) + }) + innerAudioContext.onTimeUpdate(() => { + if (innerAudioContext.duration != Infinity) { + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = parseInt(innerAudioContext.currentTime) + _self.data.dataList[index].list[idx].list[ix].valueList[a].duration = parseInt(innerAudioContext.duration) + var curM = parseInt(innerAudioContext.currentTime / 60) //分钟 + var curS = parseInt(innerAudioContext.currentTime % 60) //秒 + var tM = parseInt(innerAudioContext.duration / 60) //分钟 + var tS = parseInt(innerAudioContext.duration % 60) //秒 + var curMStr = curM > 9 ? curM : '0' + curM + var curSStr = curS > 9 ? curS : '0' + curS + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = curMStr + ':' + curSStr + _self.data.dataList[index].list[idx].list[ix].valueList[a].totalDurationStr = totalMStr + ':' + totalSStr + _self.setData({ + dataList: _self.data.dataList + }) + } + }) + }, + //倒退5秒 + rewind(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration - _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + + }, + //快进5秒 + speed(e) { + var _self = this + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + var idx = e.currentTarget.dataset.idx + var a = e.currentTarget.dataset.a + var ix = e.currentTarget.dataset.i + if (item.isPlay) { + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration + _self.data.speedStep + innerAudioContext.seek(_self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration) + _self.setData({ + dataList: _self.data.dataList + }) + } + }, + slider4change(e) { + var index = e.currentTarget.dataset.index + var item = e.currentTarget.dataset.item + if (item.isPlay) { + innerAudioContext.seek(e.detail.value) + } + }, + //将分享的Base64图片保存至本地 + toSaveLocalImg(data) { + var base64 = data + var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png' + var imageData = base64.replace(/^data:image\/\w+;base64,/, ""); + var fs = wx.getFileSystemManager(); + fs.writeFileSync(imgPath, imageData, "base64"); + this.setData({ + shareImgUrl: imgPath + }) + }, + goHome() { + wx.switchTab({ + url: '/pages/index/index', + }) + }, + //显示详情 + showDetail(e) { + var type = e.currentTarget.dataset.ctype //需要跳详情 + if (type.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) { + //需要跳详情 + var cId = e.currentTarget.dataset.cid + var uId = e.currentTarget.dataset.id + wx.navigateTo({ + url: '../moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, + }) + } + }, + //显示更多栏目数据 + showMore(e) { + var item = e.currentTarget.dataset.item + if (item.mode == '2') { + var userid = e.currentTarget.dataset.userid + var idx = e.currentTarget.dataset.idx + wx.navigateTo({ + url: '../../pages/moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx + }) + } + }, + //tabbar切换 + onChange(e) { + this.setData({ + active: e.detail + }) + } +}) \ No newline at end of file diff --git a/packagecard/sharePage/sharePage.json b/packagecard/sharePage/sharePage.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/sharePage/sharePage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/sharePage/sharePage.wxml b/packagecard/sharePage/sharePage.wxml new file mode 100755 index 0000000..6bcbca7 --- /dev/null +++ b/packagecard/sharePage/sharePage.wxml @@ -0,0 +1,306 @@ + + + {{nameTxt}} + + + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + + + + + + + 加入卡包 + + + + 名片码 + + + + + + + 电话 + {{phoneTxt}} + + + + + + 微信 + {{wechateTxt}} + + + + + + 邮箱 + {{emailTxt}} + + + + + + 地址 + {{addressTxt}} + + + + + + + + + + + + + + {{cardInfo.cardTemplateUseScansNumber >999? '999+' : + cardInfo.cardTemplateUseScansNumber}} + + + + {{cardInfo.cardTemplateUseDispatchNumber>999 ? + '999+':cardInfo.cardTemplateUseDispatchNumber}} + + + + + + + + + + + + + + {{item.name}} + + + + 更多 + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.comment}}:{{child.selValue}} + + + + + + + + + {{child.comment}} + + + + + {{ss.dataName}} + + + + + 详情 > + + + + + + + + + + + + + + + + + + 一段话 + + + 有可能还会与其他内容重叠。元素的背景会延伸穿过内边距。不允许指定负边距值。 + + + + + + + + + + + 首页 + 服务 + \ No newline at end of file diff --git a/packagecard/sharePage/sharePage.wxss b/packagecard/sharePage/sharePage.wxss new file mode 100755 index 0000000..094b5e7 --- /dev/null +++ b/packagecard/sharePage/sharePage.wxss @@ -0,0 +1,603 @@ +page { + background: #F7F7F7; +} + +.card-container { + height: 0; + box-sizing: border-box; +} + +.share-btn { + background: #eee; +} + +.card { + width: 100%; + height: 0; + box-sizing: border-box; + background: #fff; + position: relative; + overflow: hidden; + /* text-align: center; */ +} + +.area-box { + white-space: nowrap; + word-break: break-all; +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.person { + padding: 20rpx; +} + +.dynamic-container { + margin-top: -50rpx; + position: relative; + background-color: #fff; + padding: 20rpx; + border-radius: 20rpx; +} + +.dynamic-title image { + width: 30rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4rpx; +} + +.catelog-title { + display: flex; + position: relative; + align-items: center; + justify-content: space-between; +} + +.catelog-title .action { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; + padding-right: 30rpx; +} + +.title { + font-size: 30rpx; + position: relative; + color: #fff; + border-top-right-radius: 48rpx; + border-top-left-radius: 48rpx; + background: #0054bd; + display: inline-block; + padding: 10rpx 60rpx 60rpx 10rpx; + margin-bottom: -50rpx; +} + +.title text { + margin-left: 20rpx; +} + +.column-box { + display: flex; + flex-direction: column; + background-color: #fff; + width: 100%; +} +.column-content { + display: flex; + flex-direction: column; + padding: 10rpx 20rpx 40rpx; + background-color: #fff; + border-radius: 48rpx; + width: 100%; + box-shadow: 0px 2px 2px #f0f0f0; + z-index: 2; +} +.intro-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.serve-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.person-content { + padding: 20rpx; + border-radius: 20rpx; + background: #fff; + margin-top: -30rpx; + font-size: 30rpx; + color: #000; + line-height: 40rpx; + word-break: break-all; + line-height: 40rpx; + letter-spacing: 2rpx; + position: relative; +} + +.company-title { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #ddd; +} + +.company-title image { + width: 140rpx; + height: 140rpx; +} + +.company-name { + width: 520rpx; + height: 140rpx; + display: flex; + align-items: center; + font-size: 34rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.company-content { + background: #fff; + border-radius: 20rpx; + padding: 20rpx; + margin-top: -30rpx; + position: relative; +} + +.company-content image { + width: 100%; + height: 300rpx; + border-radius: 20rpx; +} + +.company .person-content { + margin-top: 0; +} + +.dynamic-title { + width: 710rpx; + margin: 0 auto; + display: block; +} + +.dynamic-box { + margin-bottom: 20rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; + position: relative; + height: 400rpx; +} + +.dynamic-box image { + width: 100%; + height: 400rpx; +} + +.dynamic-text { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + line-height: 60rpx; + color: #fff; + padding: 0 10rpx; + font-size: 30rpx; +} + +.person-info { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 1px solid #EEE; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + overflow: hidden; +} + +.avatar image { + width: 100%; + height: 100%; +} + +.person-name { + width: 530rpx; +} + +.name { + font-size: 32rpx; + margin: 15rpx 0 10rpx; + color: #000; +} + +.time { + color: #b2b2b2; +} + +.dynamic-content { + margin: 20rpx 0; +} + +.dynamic-img { + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.dynamic-img image { + width: 32%; + margin-right: 2%; + height: 160rpx; + margin-bottom: 10rpx; +} + +.dynamic-img image:nth-child(3n) { + margin-right: 0; +} + +.dynamic-img-text { + position: absolute; + left: 0; + right: 0; + bottom: 3rpx; + padding: 0 20rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 32rpx; + line-height: 70rpx; +} + +.dynamic-good { + margin: 10rpx 0; + display: flex; + justify-content: space-between; +} + +.good-count { + color: #333; + font-size: 28rpx; +} + +.good-btn image { + width: 40rpx; + height: 40rpx; + vertical-align: top; +} + +.dynamic-reply { + background: #eee; + padding: 15rpx; + margin-top: 15rpx; +} + +.reply { + font-size: 32rpx; + color: #000; + margin-bottom: 5rpx; +} + +.reply-name { + font-weight: bold; + display: inline; +} + +.dynamic-reply-input { + margin-top: 10rpx; +} + +.dynamic-reply-input input { + width: 100%; + height: 60rpx; + border-bottom: 1px solid #eee; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #0054bd; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card image { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.share-save { + text-align: center; + display: flex; + justify-content: space-between; +} + +.share-btn { + border: 1px solid #1296db; + background: none; + color: #1296db; + font-weight: normal; +} + +.save-btn { + border: 1px solid #1296db; + background: #1296db; + color: #fff; + font-weight: normal; +} + +.bottom-btn { + margin-top: 20rpx; + padding: 0 20rpx; + width: 100%; + white-space: nowrap; +} + +.phone-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.wechate-box .icon { + width: 35rpx; + height: 30rpx; + vertical-align: top; +} + +.email-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.bottom-btn-box { + display: inline-block; + min-width: 32%; + line-height: 30rpx; + padding: 20rpx; + box-sizing: border-box; + border: 1px solid #DDD; + border-radius: 10rpx; + margin-right: 10rpx; +} + +.bottom-text { + margin-top: 10rpx; +} + +.top-box { + padding-bottom: 20rpx; + background-color: #F7F7F7; +} + +.good { + display: flex; + justify-content: space-between; + padding-left: 20rpx; + padding-bottom: 20rpx; + background-color: #fff; +} + +.good-avatar, +.good-click { + line-height: 45rpx; + color: #333; +} + +.good-click { + display: flex; +} + +.view-count { + margin-right: 30rpx; + padding-right: 30rpx; + border-right: 1px solid #808080; + color: #808080; + display: flex; + flex-direction: row; + font-size: 36rpx; +} + +.view-count-no { + margin-right: 30rpx; + padding-right: 30rpx; + color: #808080; + display: flex; + flex-direction: row; + align-items: center; + font-size: 36rpx; +} + +.good-avatar image { + width: 100%; + height: 100%; +} + +.good-click image { + width: 38rpx; + height: 38rpx; +} + +.view-count image { + width: 32rpx; + height: 32rpx; +} + +.view-count-no image { + width: 32rpx; + height: 32rpx; +} + +.avatar-list { + width: 45rpx; + height: 45rpx; + margin-right: 10rpx; + vertical-align: top; + display: inline-block; +} + +.mid { + display: flex; + background: #0054bd; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + padding: 40rpx 0 80rpx; + margin-top: -20rpx; + position: relative; +} + +.mid-box { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border-right: 1px solid #2f82ea; + background: none; + font-weight: normal; + width: auto !important; + padding: 0 !important; +} + +.mid-box:last-child { + border: none; +} + +.mid-box image { + width: 60rpx; + height: 60rpx; + margin-bottom: 20rpx; +} + +.mid-box-text { + font-size: 30rpx; + color: #fff; +} + +.mid-btn { + position: relative; + margin-top: -60rpx; + display: flex; + padding: 30rpx; + background: #fff; + border-top-left-radius: 60rpx; + border-top-right-radius: 60rpx; + flex-wrap: wrap; + justify-content: space-between; +} + +.mid-btn-box { + flex-shrink: 0; + width: 49%; + margin-bottom: 20rpx; + padding: 15rpx; + border-radius: 20rpx; + background: #eee; + display: flex; + justify-content: space-between; + box-sizing: border-box; +} + +.mid-btn-box:nth-child(3), +.mid-btn-box:nth-child(4) { + margin-bottom: 0; +} + +.mid-btn-box image { + width: 80rpx; + height: 80rpx; +} + +.mid-btn-text { + width: 200rpx; +} + +.text-top { + line-height: 45rpx; + font-size: 30rpx; + color: #000; +} + +.text-bottom { + font-size: 26rpx; + color: #898989; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bar-code { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 999; +} + +.bar-code .content { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: 96%; + background: #fff; + /* width: 500rpx; + height: 500rpx; */ + border-radius: 10rpx; + padding: 20rpx; + min-width: 80%; + min-height: 50%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.code-title { + font-size: 32rpx; + font-weight: bold; + color: #000; +} + +.code-txt { + font-size: 32rpx; + color: #000; +} + +.bar-code image { + width: 300rpx; + height: 300rpx; +} \ No newline at end of file diff --git a/packagecard/shop/bespeak/bespeak.js b/packagecard/shop/bespeak/bespeak.js new file mode 100755 index 0000000..424e4eb --- /dev/null +++ b/packagecard/shop/bespeak/bespeak.js @@ -0,0 +1,205 @@ +// pages/shop/bespeak/bespeak.js +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopBean: null, + active: 1, + testGoods: { + name: "商品" + }, + goodsList: [], + shopCart: [], + tabList: [], + TabCur: 0, + scrollLeft: 0, + swiperlist: [], + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + }) + this.getShopDetail() + this.getShopGoodsCatalog() + this.getShopGoodsList() + }, + getShopDetail() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get(app.restAjax.path(app.apis.getShopDetail, [app.baseUrls.tradeUrl, _self.data.shopId]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + wx.hideLoading({}) + if (code == 200) { + console.log(data) + _self.setData({ + shopBean: data + }) + } + }, function (code, data) { + wx.hideLoading({}) + if (data.msg) { + wx.showToast({ + title: data.msg, + icon: 'none' + }) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }); + }, + //获取店铺所有商品类目 + getShopGoodsList() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get( + app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, _self.data.shopId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + if (data.rows.length > 0) { + _self.buildData(data.rows) + } else { + //TODO 没有数据 + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + wx.showToast({ + title: error.msg, + }) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //获取商店所有分类 + getShopGoodsCatalog() { + let _self = this + app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopCatalogList, [app.restAjax.baseUrl.tradeUrl, _self.data.shopId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + if (code == 200) { + _self.setData({ + tabList: data + }) + _self.getGoodsListByCategory(_self.data.tabList[0].categoryId) + } + }, (code, error) => { + if (error.msg) { + wx.showToast({ + title: error.msg, + icon: 'none' + }) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + getGoodsListByCategory(categoryId) { + wx.showLoading({ + title: '加载中', + }) + let _self = this + app.restAjax.get( + app.restAjax.path(app.restAjax.apis.getGoodsByCatalogAndShop, [app.restAjax.baseUrl.tradeUrl, categoryId]), { + page: 1, + shopId: _self.data.shopId + }, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + if (data.rows.length > 0) { + data.rows.forEach(it => { + var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length) + it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId + }) + _self.data.goodsList = _self.data.goodsList.concat(data.rows) + _self.setData({ + goodsList: _self.data.goodsList + }) + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + wx.showToast({ + title: error.msg, + icon: 'none' + }) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //构建热梦商品 + buildData(datas) { + let _self = this + datas.forEach(it => { + var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length) + it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId + _self.data.swiperlist.push(it) + }) + _self.setData({ + swiperlist: _self.data.swiperlist + }) + }, + tabSelect(e) { + this.setData({ + goodsList: [], + TabCur: e.currentTarget.dataset.id, + scrollLeft: (e.currentTarget.dataset.id - 1) * 60 + }) + var cItem = this.data.tabList[this.data.TabCur] + this.getGoodsListByCategory(cItem.categoryId) + }, + callPhone() {}, + //商品分类页面 + showCategoryGoods() { + var item = this.data.tabList[this.data.TabCur] + wx.navigateTo({ + url: '../catalog/bannerlist/goodscataloglist?shopId=' + this.data.shopId + '&catalogId=' + item.categoryId, + }) + }, + //商品详情页面 + toGoodsDetail(e) { + let _self = this + wx.navigateTo({ + url: '../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, +}) \ No newline at end of file diff --git a/packagecard/shop/bespeak/bespeak.json b/packagecard/shop/bespeak/bespeak.json new file mode 100755 index 0000000..b55b5a2 --- /dev/null +++ b/packagecard/shop/bespeak/bespeak.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/packagecard/shop/bespeak/bespeak.wxml b/packagecard/shop/bespeak/bespeak.wxml new file mode 100755 index 0000000..56bb38f --- /dev/null +++ b/packagecard/shop/bespeak/bespeak.wxml @@ -0,0 +1,82 @@ + + + 服务 + + + + + + + + + + + + + + + + + + {{shopBean.shopName}} + + + {{shopBean.shopSummary}} + + + + + + + + + + {{shopBean.shopAddress}} + + + + + + + + 精选商品 + + + + + {{item.categoryName}} + + + + 更多 > + + + + + + + + + {{item.goodsName}} + + + + \ No newline at end of file diff --git a/packagecard/shop/bespeak/bespeak.wxss b/packagecard/shop/bespeak/bespeak.wxss new file mode 100755 index 0000000..3f97deb --- /dev/null +++ b/packagecard/shop/bespeak/bespeak.wxss @@ -0,0 +1,19 @@ +.test { + display: flex; + flex-direction: row; + flex-wrap: nowrap; + margin-bottom: 80rpx; + justify-content: flex-start; + align-items: center; +} + +.scroll-content { + position: absolute; + width: 100%; + top: 470rpx; + border-top-right-radius: 60rpx; + border-top-left-radius: 60rpx; + padding-top: 20rpx; + z-index: 30; + background-color: white; +} \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/bannerlist.js b/packagecard/shop/catalog/bannerlist/bannerlist.js new file mode 100755 index 0000000..5a76837 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/bannerlist.js @@ -0,0 +1,358 @@ +// pages/shop/catalog/bannerlist/bannerlist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + active: 1, + swiperlist: [], + typeMenu: [], + goodsList: [], + currentPage: 1, + contentHeight: app.globalData.windowHeight, + isLoadMore: false, //是否在加载中 + hasMore: true, //是否还有更多数据 + currentPage: 1, + totalSize: 0, + baseImg: app.urls.baseImgUrl, + isShowCart: false, + shopCart: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCart: app.globalData.shopCart + }) + //获取热门商品 + this.getShopGoodsList(this.data.shopId) + //获取店铺类别 + this.getShopGoodsCatalog(this.data.shopId) + //获取全部商品 + this.getShopGoodsListByPage(this.data.shopId) + this.selectComponent('#sCart').refreshCart() + }, + //获取店铺所有商品类目 + getShopGoodsList(shopId) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get( + app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, shopId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + if (code == 200) { + if (data.rows.length > 0) { + _self.buildData(data.rows) + } else { + //TODO 没有数据 + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //构建热梦商品 + buildData(datas) { + let _self = this + datas.forEach(it => { + var picId = it.goodsPhotos.substring(0, it.goodsPhotos.indexOf(',') != -1 ? it.goodsPhotos.indexOf(',') : it.goodsPhotos.length) + it.hotPic = app.restAjax.baseUrl.tradeUrl + app.restAjax.baseUrl.baseImgUrl + picId + _self.data.swiperlist.push(it) + }) + _self.setData({ + swiperlist: _self.data.swiperlist + }) + }, + //显示热门商品详情 + showHot(e) { + let _self = this + wx.navigateTo({ + url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + //获取商店所有分类 + getShopGoodsCatalog(shopId) { + let _self = this + app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopCatalogList, [app.restAjax.baseUrl.tradeUrl, shopId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + if (code == 200) { + _self.setData({ + typeMenu: data + }) + } + }, (code, error) => { + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //分页获取商品 + getShopGoodsListByPage(id) { + let _self = this + app.restAjax.get( + app.restAjax.path(app.restAjax.apis.getShopGoodsList, [app.restAjax.baseUrl.tradeUrl, id]), { + page: _self.data.currentPage + }, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + _self.setData({ + isLoadMore: false + }) + if (code == 200) { + if (data.rows.length > 0) { + data.rows.forEach(it => { + it.buyNum = 0 + }) + data.rows.forEach(it => { + //判断购物车是否存在该商品 + if (app.globalData.shopCart.length > 0) { + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + it.buyNum = i.buyNum + } + }) + } + }) + _self.data.goodsList = _self.data.goodsList.concat(data.rows) + _self.setData({ + goodsList: _self.data.goodsList + }) + } else { + _self.setData({ + hasMore: false + }) + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getShopGoodsListByPage(_self.data.shopId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + //商品详情页面 + toGoodsDetail(e) { + let _self = this + wx.navigateTo({ + url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + //商品分类页面 + toGoodsCatalogPage(e) { + wx.navigateTo({ + url: './goodscataloglist?shopId=' + this.data.shopId + '&catalogId=' + e.currentTarget.dataset.item.categoryId, + }) + }, + onShow() { + let _self = this + if (app.globalData.shopCart.length > 0) { + _self.data.goodsList.forEach(it => { + var isExist = false + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + isExist = true + it.buyNum = i.buyNum + } + }) + if (!isExist) { + it.buyNum = 0 + } + }) + } else { + _self.data.goodsList.forEach(it => { + it.buyNum = 0 + }) + } + this.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + this.selectComponent('#sCart').refreshCart() + }, + //列表添加购物车 + addToCart(e) { + let _self = this + let goods = e.currentTarget.dataset.item + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum += 1 + if (it.buyNum > goods.goodsTotal) { + it.buyNum = goods.goodsTotal + wx.showToast({ + title: '超出库存', + icon: 'error' + }) + } + } + }) + this.selectComponent('#sCart').listAddToCart(goods) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + }, + removeToCart(e) { + let goods = e.currentTarget.dataset.item + let _self = this + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum -= 1 + } + }) + this.selectComponent('#sCart').listRemoveCart(goods) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + }, + //显示购物车弹框 + doShowCart() { + var _self = this + if (this.data.shopCart.length > 0) { + //判断当前购物车是否存在该商店的商品 + var isExist = false + this.data.shopCart.forEach(it => { + if (it.shopId == _self.data.shopId) { + isExist = true + } + }) + if (isExist) { + if (this.data.isShowCart) { + this.setData({ + isShowCart: false + }) + } else { + this.setData({ + isShowCart: true + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + //隐藏购物车弹框 + onHideCart() { + this.setData({ + isShowCart: false + }) + }, + //删除购物车中的商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + var goods = e.currentTarget.dataset.goods + app.globalData.shopCart.splice(index, 1) + //删除购物车中数据 + _self.selectComponent('#sCart').refreshCart() + //将列表中的数据购买数量重置 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = 0 + } + }) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + if (_self.data.shopCart.length <= 0) { + _self.setData({ + isShowCart: false + }) + } + }, + //购物车弹框删除或添加商品 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + //遍历列表 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //遍历购物车 + _self.data.shopCart.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //刷新视图 + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: _self.data.shopCart + }) + //刷新购物车 + _self.selectComponent('#sCart').refreshCart() + }, + onHide() { + this.setData({ + isShowCart: false + }) + } +}) \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/bannerlist.json b/packagecard/shop/catalog/bannerlist/bannerlist.json new file mode 100755 index 0000000..b55b5a2 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/bannerlist.json @@ -0,0 +1,4 @@ +{ + "usingComponents": { + } +} \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/bannerlist.wxml b/packagecard/shop/catalog/bannerlist/bannerlist.wxml new file mode 100755 index 0000000..0c47259 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/bannerlist.wxml @@ -0,0 +1,78 @@ + + + 服务 + + + + + + + + + + + + + + + {{item.categoryName}} + + + + + + 全部商品 + + + + + + + {{item.goodsName}} + + + {{item.goodsSummary}} + + + + ¥{{item.goodsUnitPrice}} + + + + {{item.buyNum}} + + + + + + + + + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/bannerlist.wxss b/packagecard/shop/catalog/bannerlist/bannerlist.wxss new file mode 100755 index 0000000..ee58289 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/bannerlist.wxss @@ -0,0 +1,9 @@ +/* pages/shop/catalog/bannerlist/bannerlist.wxss */ + +.screen-swiper { + min-height:455rpx; +} +.page { + height: 100Vh; + width: 100vw; +} diff --git a/packagecard/shop/catalog/bannerlist/goodscataloglist.js b/packagecard/shop/catalog/bannerlist/goodscataloglist.js new file mode 100755 index 0000000..d704277 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/goodscataloglist.js @@ -0,0 +1,250 @@ +// pages/shop/catalog/bannerlist/goodscataloglist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + catalogId: '', + active: 1, + swiperlist: [], + typeMenu: [], + shopCart: [], + isShowCart: false, + goodsList: [], + currentPage: 1, + contentHeight: app.globalData.windowHeight, + isLoadMore: false, //是否在加载中 + hasMore: true, //是否还有更多数据 + currentPage: 1, + totalSize: 0, + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + catalogId: options.catalogId, + shopCart: app.globalData.shopCart + }) + this.getShopGoodsList(this.data.catalogId) + }, + //根据类目Id获取商店商品 + getShopGoodsList(catalogID) { + let _self = this + app.restAjax.get( + app.restAjax.path(app.restAjax.apis.getGoodsByCatalogAndShop, [app.restAjax.baseUrl.tradeUrl, catalogID]), { + page: _self.data.currentPage, + shopId: _self.data.shopId + }, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + _self.setData({ + isLoadMore: false + }) + if (code == 200) { + if (data.rows.length > 0) { + data.rows.forEach(it => { + //判断购物车是否存在该商品 + if (app.globalData.shopCart.length > 0) { + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + it.buyNum = i.buyNum + } else { + it.buyNum = 0 + } + }) + } else { + it.buyNum = 0 + } + }) + _self.data.goodsList = _self.data.goodsList.concat(data.rows) + _self.setData({ + goodsList: _self.data.goodsList + }) + } else { + _self.setData({ + hasMore: false + }) + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getShopGoodsList(_self.data.catalogId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + //商品详情页面 + toGoodsDetail(e) { + let _self = this + wx.navigateTo({ + url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + onShow() { + let _self = this + if (app.globalData.shopCart.length > 0) { + _self.data.goodsList.forEach(it => { + var isExist = false + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + isExist = true + it.buyNum = i.buyNum + } + }) + if (!isExist) { + it.buyNum = 0 + } + }) + } else { + _self.data.goodsList.forEach(it => { + it.buyNum = 0 + }) + } + _self.setData({ + goodsList: _self.data.goodsList + }) + if (_self.selectComponent('#sCart')) { + _self.selectComponent('#sCart').refreshCart() + } + }, + //列表添加购物车 + addToCart(e) { + let _self = this + let goods = e.currentTarget.dataset.item + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum += 1 + if (it.buyNum > goods.goodsTotal) { + it.buyNum = goods.goodsTotal + wx.showToast({ + title: '超出库存', + icon: 'error' + }) + } + } + }) + _self.setData({ + goodsList: _self.data.goodsList + }) + _self.selectComponent('#sCart').listAddToCart(goods) + }, + removeToCart(e) { + let goods = e.currentTarget.dataset.item + let _self = this + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum -= 1 + } + }) + _self.setData({ + goodsList: _self.data.goodsList + }) + this.selectComponent('#sCart').listRemoveCart(goods) + }, + //显示购物车弹框 + doShowCart() { + if (this.data.shopCart.length > 0) { + this.setData({ + isShowCart: true + }) + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + //隐藏购物车弹框 + onHideCart() { + this.setData({ + isShowCart: false + }) + }, + //删除购物车中的商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + var goods = e.currentTarget.dataset.goods + app.globalData.shopCart.splice(index, 1) + //删除购物车中数据 + _self.selectComponent('#sCart').refreshCart() + //将列表中的数据购买数量重置 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = 0 + } + }) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + if (_self.data.shopCart.length <= 0) { + _self.setData({ + isShowCart: false + }) + } + }, + //购物车弹框删除或添加商品 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + //遍历列表 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //遍历购物车 + _self.data.shopCart.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //刷新视图 + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: _self.data.shopCart + }) + //刷新购物车 + _self.selectComponent('#sCart').refreshCart() + }, + onHide() { + this.setData({ + isShowCart: false + }) + } +}) \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/goodscataloglist.json b/packagecard/shop/catalog/bannerlist/goodscataloglist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/goodscataloglist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/goodscataloglist.wxml b/packagecard/shop/catalog/bannerlist/goodscataloglist.wxml new file mode 100755 index 0000000..f96e27c --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/goodscataloglist.wxml @@ -0,0 +1,64 @@ + + + 服务 + + + + + + + + + {{item.goodsName}} + + + {{item.goodsSummary}} + + + + + ¥{{item.goodsUnitPrice}} + + + + {{item.buyNum}} + + + + + + + + + + + + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/catalog/bannerlist/goodscataloglist.wxss b/packagecard/shop/catalog/bannerlist/goodscataloglist.wxss new file mode 100755 index 0000000..c5f30f1 --- /dev/null +++ b/packagecard/shop/catalog/bannerlist/goodscataloglist.wxss @@ -0,0 +1 @@ +/* pages/shop/catalog/bannerlist/goodscataloglist.wxss */ \ No newline at end of file diff --git a/packagecard/shop/catalog/column/column.js b/packagecard/shop/catalog/column/column.js new file mode 100755 index 0000000..7d91160 --- /dev/null +++ b/packagecard/shop/catalog/column/column.js @@ -0,0 +1,475 @@ +// pages/category/index.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + productList: [], + isRefreshing: false, + currentPage: 1, + totalSize: 0, + shopId: '', + isAddPage: false, + isCatalogPage: false, + activeNames: ['0'], + baseImageUrl: app.urls.baseImgUrl, + currentCatalogId: '', + curIndex: 0, + active: 1, + curGoodsList: [], + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + isLoadMore: false, + hasMore: true, + isShowCart: false, + shopCart: [], + baseImg: app.urls.baseImgUrl, + }, + /** + * 切换类目 + */ + switchRightTap(e) { + let curindex = parseInt(e.currentTarget.dataset.curindex); + this.data.productList[curindex].goodsList = [] + this.setData({ + currentPage: 1, + hasMore: true, + isLoadMore: false, + curIndex: curindex + }) + let item = this.data.productList[curindex] + this.getGoodsListByCId(item.categoryId) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCart: app.globalData.shopCart + }) + this.getShopCatalogList(this.data.shopId) + this.selectComponent('#sCart').refreshCart() + }, + //获取店铺所有商品类目 + getShopCatalogList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get(app.restAjax.path(app.apis.getShopCatalogList, [app.baseUrls.tradeUrl, id]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + if (code == 200) { + _self.buildDatas(data) + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + doAdd(e) { + let key = e.currentTarget.dataset.key + if ('chooseCatalog' == key) { + wx.navigateTo({ + url: './choosecatalog?shopId=' + this.data.shopId, + }) + } else { + if (e.currentTarget.dataset.item) { + wx.navigateTo({ + url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + e.currentTarget.dataset.item.categoryId, + }) + } else { + wx.showToast({ + title: '请先添加类目', + icon: 'error' + }) + } + } + }, + manageGoods(e) { + wx.navigateTo({ + url: '../../product/goodsdetail?shopId=' + e.currentTarget.dataset.item.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId + }) + }, + /** + * 获取商品列表 + */ + getGoodsList(shopId) { + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get(app.restAjax.path(app.apis.getShopGoodsList, [app.baseUrls.tradeUrl, shopId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + this.setData({ + isRefreshing: false + }) + if (code == 200) { + this.buildDatas(data) + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //构建数据 + buildDatas(data) { + let _self = this + if (data.length > 0) { + data.forEach(el => { + el.goodsList = [] + _self.data.productList.push(el) + }) + _self.setData({ + curIndex: 0, + productList: _self.data.productList + }) + _self.getGoodsListByCId(_self.data.productList[0].categoryId) + } + }, + //去除重复的 + unique(rows) { + let temp = rows.concat() + let tempList = [] + for (var i = 0; i < temp.length; i++) { + for (var j = i + 1; j < temp.length; j++) { + if (temp[i].categoryId == temp[j].categoryId) { + temp.splice(j, 1); + j-- + } + } + } + temp.forEach(el => { + tempList.push({ + name: el.categoryName, + id: el.categoryId, + goods: [] + }) + }) + return tempList + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isLoadMore: false, + hasMore: true, + productList: [] + }) + this.getShopCatalogList(this.data.shopId) + }, + onShow() { + if (this.data.isAddPage) { + this.setData({ + isAddPage: false + }) + this.dorefreshList() + } + this.selectComponent('#sCart').refreshCart() + }, + //根据类目ID获取商品 + getGoodsListByCId(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get(app.restAjax.path(app.apis.getGoodsByCatalogAndShop, [app.baseUrls.tradeUrl, id]), { + page: _self.data.currentPage, + shopId: _self.data.shopId + }, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (code == 200) { + if (data.rows.length > 0) { + data.rows.forEach(it => { + it.buyNum = 0 + }) + data.rows.forEach(it => { + //判断购物车是否存在该商品 + if (app.globalData.shopCart.length > 0) { + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + it.buyNum = i.buyNum + } + }) + } + }) + _self.data.productList.forEach(el => { + if (el.categoryId == id) { + el.goodsList = el.goodsList.concat(data.rows) + } + }) + _self.setData({ + productList: _self.data.productList + }) + } else { + _self.setData({ + hasMore: false + }) + } + } + }, (code, error) => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + onChange(e) { + let _self = this + let item = e.currentTarget.dataset.item + this.setData({ + activeNames: e.detail, + currentCatalogId: item.categoryId + }) + console.log(e) + if (e.detail.length > 1) { + //展开 + if (item.goodsList || item.goodsList.length <= 0) { + _self.getGoodsListByCId(item.categoryId) + } + } + }, + doSearchGoods() { + wx.navigateTo({ + url: './searchproduct?shopId=' + this.data.shopId, + }) + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + let item = _self.data.productList[_self.data.curIndex] + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getGoodsListByCId(item.categoryId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + doDelCategory(e) { + let _self = this + wx.showLoading({ + title: '删除中...', + }) + app.restAjax.delete(app.restAjax.path(app.apis.doDelShopCategoryById, [app.baseUrls.tradeUrl, e.currentTarget.dataset.item.categoryId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + _self.setData({ + productList: [] + }) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.getShopCatalogList(_self.data.shopId) + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + showConfirmDialog(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该类目吗?(删除后该类目下所有商品将删除!)', + success(res) { + if (res.confirm) { + _self.doDelCategory(e) + } else { + + } + } + }) + }, + //列表添加购物车 + addToCart(e) { + let _self = this + let goods = e.currentTarget.dataset.item + _self.data.productList[_self.data.curIndex].goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum += 1 + if (it.buyNum > goods.goodsTotal) { + it.buyNum = goods.goodsTotal + wx.showToast({ + title: '超出库存', + icon: 'error' + }) + } + } + }) + this.selectComponent('#sCart').listAddToCart(goods) + _self.setData({ + productList: _self.data.productList, + shopCart: app.globalData.shopCart + }) + }, + removeToCart(e) { + let goods = e.currentTarget.dataset.item + let _self = this + _self.data.productList[_self.data.curIndex].goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum -= 1 + } + }) + this.selectComponent('#sCart').listRemoveCart(goods) + _self.setData({ + productList: _self.data.productList, + shopCart: app.globalData.shopCart + }) + }, + //显示购物车弹框 + doShowCart() { + var _self = this + if (this.data.shopCart.length > 0) { + //判断当前购物车是否存在该商店的商品 + var isExist = false + this.data.shopCart.forEach(it => { + if (it.shopId == _self.data.shopId) { + isExist = true + } + }) + if (isExist) { + if (this.data.isShowCart) { + this.setData({ + isShowCart: false + }) + } else { + this.setData({ + isShowCart: true + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + //隐藏购物车弹框 + onHideCart() { + this.setData({ + isShowCart: false + }) + }, + //删除购物车中的商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + var goods = e.currentTarget.dataset.goods + app.globalData.shopCart.splice(index, 1) + //删除购物车中数据 + _self.selectComponent('#sCart').refreshCart() + //将列表中的数据购买数量重置 + _self.data.productList[_self.data.curIndex].goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = 0 + } + }) + _self.setData({ + productList: _self.data.productList, + shopCart: app.globalData.shopCart + }) + if (_self.data.shopCart.length <= 0) { + _self.setData({ + isShowCart: false + }) + } + }, + //购物车弹框删除或添加商品 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + //遍历列表 + _self.data.productList[_self.data.curIndex].goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //遍历购物车 + _self.data.shopCart.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //刷新视图 + _self.setData({ + productList: _self.data.productList, + shopCart: _self.data.shopCart + }) + //刷新购物车 + _self.selectComponent('#sCart').refreshCart() + }, + onHide() { + this.setData({ + isShowCart: false + }) + } +}) \ No newline at end of file diff --git a/packagecard/shop/catalog/column/column.json b/packagecard/shop/catalog/column/column.json new file mode 100755 index 0000000..457e187 --- /dev/null +++ b/packagecard/shop/catalog/column/column.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "分类", + "usingComponents": { + "loadmore": "/components/loadmore/index" + } +} \ No newline at end of file diff --git a/packagecard/shop/catalog/column/column.wxml b/packagecard/shop/catalog/column/column.wxml new file mode 100755 index 0000000..db9e809 --- /dev/null +++ b/packagecard/shop/catalog/column/column.wxml @@ -0,0 +1,76 @@ + + + 商品管理 + + + + + + + {{item.categoryName}} + + + + + + + + + + + + + + {{item.goodsName}} + + + + {{item.goodsSummary}} + + + ¥:{{item.goodsUnitPrice}} + + + + {{item.buyNum}} + + + + + + + 加载中... + + + + + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/catalog/column/column.wxss b/packagecard/shop/catalog/column/column.wxss new file mode 100755 index 0000000..0f14c3c --- /dev/null +++ b/packagecard/shop/catalog/column/column.wxss @@ -0,0 +1,94 @@ +/* pages/mine/product/productmanage/productlist.wxss */ + +.category { + display: flex; + flex-direction: row; + height: 100%; + margin-bottom: 80rpx; +} + +.nav_left { + background: #f8f8f8; + width: 30%; + height: 100%; + white-space: nowrap; +} + +.nav_right { + background: #fff; + width: 70%; + height: 100%; +} + +.nav_left_bg { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 10rpx; + background: #f8f8f8; + position: relative; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.nav_left_items { + font-size: 28rpx; + color: #333; + height: 100rpx; + line-height: 100rpx; + text-align: center; +} + +.nav_left_border { + border-left-color: #0054bd; + border-left-width: 2px; + border-left-style: solid; +} + +.nav_left_item-active { + background-color: #fff; + color: #0054bd; +} + +.jd-category { + margin: 40rpx 16rpx 0; +} + +.jd-category-wrap { + overflow: hidden; + padding: 20rpx 20rpx 0; +} + +.jd-category .title { + font-size: 28rpx; + height: 60rpx; + line-height: 30rpx; + font-weight: 700; + color: #080808 +} + +.jd-category-style { + width: 32.8%; + float: left; + display: flex; + flex-direction: column; + justify-content: center; +} + +.list_img { + width: 150rpx; + height: 150rpx; +} + +.list_text { + text-align: center; + font-size: 24rpx; + color: #686868; + margin-top: 10rpx; + height: 70rpx; +} \ No newline at end of file diff --git a/packagecard/shop/catalog/list/list.js b/packagecard/shop/catalog/list/list.js new file mode 100755 index 0000000..f01e4d7 --- /dev/null +++ b/packagecard/shop/catalog/list/list.js @@ -0,0 +1,300 @@ +// pages/shop/catalog/list/list.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + active: 1, + swiperlist: [], + typeMenu: [], + goodsList: [], + currentPage: 1, + contentHeight: app.globalData.windowHeight, + isLoadMore: false, //是否在加载中 + hasMore: true, //是否还有更多数据 + currentPage: 1, + totalSize: 0, + baseImg: app.urls.baseImgUrl, + isShowCart: false, + shopCart: [], + countTime: 2000, //延迟搜索 时间 + searchWaiting: false, //是否等待搜索倒计时中, + searchKey: '' + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCart: app.globalData.shopCart + }) + //获取全部商品 + this.getShopGoodsListByPage() + this.selectComponent('#sCart').refreshCart() + }, + getShopGoodsListByPage() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get( + app.restAjax.path(app.apis.getShopGoodsList, [app.baseUrls.tradeUrl, _self.data.shopId]), { + page: _self.data.currentPage, + keywords: _self.data.searchKey + }, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (code == 200) { + if (data.rows.length > 0) { + data.rows.forEach(it => { + //构建图片 + var photos = it.goodsPhotos + var pList = photos.split(',') + it.showPhoto = _self.data.baseImg + pList[0] + //判断购物车是否存在该商品 + if (app.globalData.shopCart.length > 0) { + app.globalData.shopCart.forEach(i => { + if (i.goodsId == it.goodsId) { + it.buyNum = i.buyNum + } else { + it.buyNum = 0 + } + }) + } else { + it.buyNum = 0 + } + }) + _self.data.goodsList = _self.data.goodsList.concat(data.rows) + _self.setData({ + goodsList: _self.data.goodsList + }) + } else { + _self.setData({ + hasMore: false + }) + } + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getShopGoodsListByPage(_self.data.shopId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + //商品详情页面 + toGoodsDetail(e) { + let _self = this + wx.navigateTo({ + url: '../../product/goodsdetail?shopId=' + _self.data.shopId + '&goodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + //列表添加购物车 + addToCart(e) { + let _self = this + let goods = e.currentTarget.dataset.item + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum += 1 + if (it.buyNum > goods.goodsTotal) { + it.buyNum = goods.goodsTotal + wx.showToast({ + title: '超出库存', + icon: 'error' + }) + } + } + }) + this.selectComponent('#sCart').listAddToCart(goods) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + }, + removeToCart(e) { + let goods = e.currentTarget.dataset.item + let _self = this + _self.data.goodsList.forEach(it => { + if (goods.goodsId == it.goodsId) { + it.buyNum -= 1 + } + }) + this.selectComponent('#sCart').listRemoveCart(goods) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + }, + //显示购物车弹框 + doShowCart() { + var _self = this + if (this.data.shopCart.length > 0) { + //判断当前购物车是否存在该商店的商品 + var isExist = false + this.data.shopCart.forEach(it => { + if (it.shopId == _self.data.shopId) { + isExist = true + } + }) + if (isExist) { + if (this.data.isShowCart) { + this.setData({ + isShowCart: false + }) + } else { + this.setData({ + isShowCart: true + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + //隐藏购物车弹框 + onHideCart() { + this.setData({ + isShowCart: false + }) + }, + //删除购物车中的商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + var goods = e.currentTarget.dataset.goods + app.globalData.shopCart.splice(index, 1) + //删除购物车中数据 + _self.selectComponent('#sCart').refreshCart() + //将列表中的数据购买数量重置 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = 0 + } + }) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + if (_self.data.shopCart.length <= 0) { + _self.setData({ + isShowCart: false + }) + } + }, + //购物车弹框删除或添加商品 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + //遍历列表 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //遍历购物车 + _self.data.shopCart.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //刷新视图 + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: _self.data.shopCart + }) + //刷新购物车 + _self.selectComponent('#sCart').refreshCart() + }, + onHide() { + this.setData({ + isShowCart: false + }) + }, + searchGoods(e) { + this.setData({ + countTime: 2000, + searchKey: e.detail.value, + }) + //是否处于搜索倒计时中 + if (!this.data.searchWaiting) { + this.timer(); + } + }, + /** + * 延迟搜索 + */ + timer() { + var that = this; + this.setData({ + searchWaiting: true + }) + + let promise = new Promise((resolve, reject) => { + let setTimer = setInterval( + () => { + console.log('搜索倒计时: ' + that.data.countTime); + this.setData({ + countTime: this.data.countTime - 1000 + }) + if (this.data.countTime <= 0) { + console.log('开始搜索: ' + that.data.params); + this.setData({ + countTime: 2000, + searchWaiting: false, + }) + resolve(setTimer) + } + }, 1000) + }) + promise.then((setTimer) => { + this.setData({ + currentPage: 1, + goodsList: [] + }) + this.getShopGoodsListByPage() + clearInterval(setTimer) //清除计时器 + }) + }, +}) \ No newline at end of file diff --git a/packagecard/shop/catalog/list/list.json b/packagecard/shop/catalog/list/list.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/shop/catalog/list/list.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/shop/catalog/list/list.wxml b/packagecard/shop/catalog/list/list.wxml new file mode 100755 index 0000000..5d43f97 --- /dev/null +++ b/packagecard/shop/catalog/list/list.wxml @@ -0,0 +1,60 @@ + + + 服务 + + + + + + + + + + + + + + + + 热销 + + + + + {{item.goodsName}} + + + ¥{{item.goodsUnitPrice}} + + + + + + + + + + + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/catalog/list/list.wxss b/packagecard/shop/catalog/list/list.wxss new file mode 100755 index 0000000..3273b4a --- /dev/null +++ b/packagecard/shop/catalog/list/list.wxss @@ -0,0 +1 @@ +/* pages/shop/catalog/list/list.wxss */ \ No newline at end of file diff --git a/packagecard/shop/index/shop.js b/packagecard/shop/index/shop.js new file mode 100755 index 0000000..fa61260 --- /dev/null +++ b/packagecard/shop/index/shop.js @@ -0,0 +1,115 @@ +// pages/shop/shop.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + type: app.globalData.servicePageType, + isPageBack: false, + active: 1 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // if (this.data.type == 1) { + // console.log("测试") + // wx.navigateTo({ + // url: '../../shop/catalog/bannerlist/bannerlist' + // }) + // } else if (this.data.type == 2) { + // wx.navigateTo({ + // url: '../../shop/catalog/column/column', + // }) + // } else if (this.data.type == 3) { + // wx.navigateTo({ + // url: '../../shop/catalog/list/list', + // }) + // } else if (this.data.type == 4) { + // wx.navigateTo({ + // url: '../../shop/bespeak/bespeak', + // }) + // } + }, + tabChange(e) { + this.setData({ + active: e.detail + }) + if (this.data.active == 0) { + //首页 + wx.redirectTo({ + url: '/pages/index/index', + }) + } else if (this.data.active == 1) { + // 服务 + wx.redirectTo({ + url: '/pages/shop/index/shop', + }) + } else { + //我的 + wx.redirectTo({ + url: '/pages/mine/index/index', + }) + } + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () {}, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + // if (!this.data.isPageBack) { + // if (this.data.type == 1) { + // console.log("测试") + // wx.navigateTo({ + // url: '../../shop/catalog/bannerlist/bannerlist' + // }) + // } else if (this.data.type == 2) { + // wx.navigateTo({ + // url: '../../shop/catalog/column/column', + // }) + // } else if (this.data.type == 3) { + // wx.navigateTo({ + // url: '../../shop/catalog/list/list', + // }) + // } else if (this.data.type == 4) { + // wx.navigateTo({ + // url: '../../shop/catalog/bannerlist/bannerlist' + // }) + // } + // } + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () {}, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () {}, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + clickT: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/shop/index/shop.json b/packagecard/shop/index/shop.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/shop/index/shop.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/shop/index/shop.wxml b/packagecard/shop/index/shop.wxml new file mode 100755 index 0000000..7c0076d --- /dev/null +++ b/packagecard/shop/index/shop.wxml @@ -0,0 +1,8 @@ + + + + 服务 + + + 数据加载中... + \ No newline at end of file diff --git a/packagecard/shop/index/shop.wxss b/packagecard/shop/index/shop.wxss new file mode 100755 index 0000000..98cd144 --- /dev/null +++ b/packagecard/shop/index/shop.wxss @@ -0,0 +1 @@ +/* pages/shop/shop.wxss */ \ No newline at end of file diff --git a/packagecard/shop/product/affirmorder.js b/packagecard/shop/product/affirmorder.js new file mode 100755 index 0000000..747236b --- /dev/null +++ b/packagecard/shop/product/affirmorder.js @@ -0,0 +1,170 @@ +// pages/shop/product/affirmorder.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + totalPrice: 0, + goodsList: [], //商品列表 + shopId: '', + shopDetailBean: null, //店铺详情 + baseImg: app.urls.baseImgUrl, + remark: '', //备注 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + let shopCart = app.globalData.shopCart + let price = 0 + shopCart.forEach(it => { + if (it.shopId == this.data.shopId) { + it.totalPrice = it.goodsUnitPrice * it.buyNum + this.data.goodsList = this.data.goodsList.concat(it) + price += it.totalPrice + } + }) + //计算价格 + this.setData({ + totalPrice: price *= 100, + goodsList: this.data.goodsList + }) + this.getShopDetailById(this.data.shopId) + }, + //提交订单 + onSubmit() { + let _self = this + wx.showLoading({ + title: '预定中...', + }) + var params = _self.buildSubmitParams() + console.log(params) + app.restAjax.post(app.restAjax.path(app.restAjax.apis.doSaveOrder, [app.restAjax.baseUrl.tradeUrl]), params, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + //提交成功 + app.globalData.shopCart = [] + wx.redirectTo({ + url: '../../mine/order/ordersuccess?price=' + _self.data.totalPrice / 100 + '&shopId=' + _self.data.shopId + '&orderId=' + data.data, + }) + } + }, (code, err) => { + wx.hideLoading({}) + if (err.msg) { + app.dialog.msg(err.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //构建订单信息 + buildSubmitParams() { + let _self = this + var array = [] + _self.data.goodsList.forEach(it => { + var item = { + "goodsCount": it.buyNum, + "goodsId": it.goodsId, + "goodsLogo": it.goodsIcon, + "goodsName": it.goodsName, + "goodsPrice": it.goodsUnitPrice, + "shopId": it.shopId, + "totalPrice": it.totalPrice, + "words": _self.data.remark + } + array = array.concat(item) + }) + return array + }, + textareaBInput(e) { + this.setData({ + remark: e.detail.value + }) + }, + //获取店铺详情 + getShopDetailById(id) { + wx.showLoading({ + title: '加载中...', + }) + app.restAjax.get(app.restAjax.path(app.restAjax.apis.getShopDetail, [app.restAjax.baseUrl.tradeUrl, id]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + this.setData({ + shopDetailBean: data + }) + } + }, (code, err) => { + wx.hideLoading({}) + if (err.msg) { + app.dialog.msg(err.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //商品数量修改 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + let price = 0 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + it.totalPrice = it.goodsUnitPrice * it.buyNum + } + price += it.totalPrice + }) + _self.setData({ + totalPrice: price * 100, + goodsList: _self.data.goodsList + }) + app.globalData.shopCart = _self.data.goodsList + }, + // 删除商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + wx.showModal({ + title: '提示', + content: '确定要删除该商品吗?', + success(res) { + if (res.confirm) { + _self.data.goodsList.splice(index, 1) + _self.setData({ + goodsList: _self.data.goodsList + }) + var price = 0 + _self.data.goodsList.forEach(it => { + it.totalPrice = it.goodsUnitPrice * it.buyNum + price += it.totalPrice + }) + _self.setData({ + totalPrice: price * 100 + }) + app.globalData.shopCart = _self.data.goodsList + } + } + }) + } +}) \ No newline at end of file diff --git a/packagecard/shop/product/affirmorder.json b/packagecard/shop/product/affirmorder.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/shop/product/affirmorder.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/shop/product/affirmorder.wxml b/packagecard/shop/product/affirmorder.wxml new file mode 100755 index 0000000..d64df71 --- /dev/null +++ b/packagecard/shop/product/affirmorder.wxml @@ -0,0 +1,54 @@ + + + 订单确认 + + + + + + + + + + {{shopDetailBean.shopName}} + + 店铺地址:{{shopDetailBean.shopAddress}} + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + + + + + 订单备注 + + + + + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/product/affirmorder.wxss b/packagecard/shop/product/affirmorder.wxss new file mode 100755 index 0000000..090b183 --- /dev/null +++ b/packagecard/shop/product/affirmorder.wxss @@ -0,0 +1 @@ +/* pages/shop/product/affirmorder.wxss */ \ No newline at end of file diff --git a/packagecard/shop/product/goodsdetail.js b/packagecard/shop/product/goodsdetail.js new file mode 100755 index 0000000..311f418 --- /dev/null +++ b/packagecard/shop/product/goodsdetail.js @@ -0,0 +1,160 @@ +// pages/shop/product/goodsdetail.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', //商店ID + goodsId: '', //商品ID + picList: [], //商品 + goodsDetail: null, //商品详情Bean + goodsPrices: 10000, + _options: null, + isShowCart: false, + shopCart: [], + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + _options: options, + shopId: options.shopId, + goodsId: options.goodsId, + shopCart: app.globalData.shopCart + }) + console.log(this.data.baseImg) + this.getGoodsDetail() + }, + //获取商品详情 + getGoodsDetail() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.restAjax.get(app.restAjax.path(app.restAjax.apis.getGoodsDetail, [app.restAjax.baseUrl.tradeUrl, _self.data.goodsId]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + _self.buildPicList(data) + _self.setData({ + goodsDetail: data + }) + } + }, (code, err) => { + wx.hideLoading({}) + if (err.msg) { + app.dialog.msg(err.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + //构建图片数据 + buildPicList(data) { + let _self = this + let picStrs = data.goodsPhotos.split(',') + picStrs.forEach(it => { + let url = _self.data.baseImg + it + _self.data.picList = _self.data.picList.concat(url) + }) + _self.setData({ + picList: _self.data.picList + }) + }, + + onShow() { + this.setData({ + shopCart: app.globalData.shopCart + }) + this.selectComponent('#sCart').refreshCart() + }, + //显示购物车弹框 + doShowCart() { + if (this.data.shopCart.length > 0) { + this.setData({ + isShowCart: true + }) + } else { + wx.showToast({ + title: '购物车空空如也', + icon: 'error' + }) + } + }, + //隐藏购物车弹框 + onHideCart() { + this.setData({ + isShowCart: false + }) + }, + //删除购物车中的商品 + delGoods(e) { + let _self = this + var index = e.currentTarget.dataset.index + var goods = e.currentTarget.dataset.goods + app.globalData.shopCart.splice(index, 1) + //删除购物车中数据 + _self.selectComponent('#sCart').refreshCart() + //将列表中的数据购买数量重置 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = 0 + } + }) + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: app.globalData.shopCart + }) + if (_self.data.shopCart.length <= 0) { + _self.setData({ + isShowCart: false + }) + } + }, + //购物车弹框删除或添加商品 + onChange(e) { + let buyNum = e.detail + let goods = e.currentTarget.dataset.goods + let _self = this + //遍历列表 + _self.data.goodsList.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //遍历购物车 + _self.data.shopCart.forEach(it => { + if (it.goodsId == goods.goodsId) { + it.buyNum = buyNum + } + }) + //刷新视图 + _self.setData({ + goodsList: _self.data.goodsList, + shopCart: _self.data.shopCart + }) + //刷新购物车 + _self.selectComponent('#sCart').refreshCart() + }, + onHide() { + this.setData({ + isShowCart: false + }) + }, + doRefreshShopcart() { + this.setData({ + shopCart: app.globalData.shopCart + }) + } +}) \ No newline at end of file diff --git a/packagecard/shop/product/goodsdetail.json b/packagecard/shop/product/goodsdetail.json new file mode 100755 index 0000000..c307dc7 --- /dev/null +++ b/packagecard/shop/product/goodsdetail.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-action-sheet": "/vant/dist/action-sheet/index" + } +} \ No newline at end of file diff --git a/packagecard/shop/product/goodsdetail.wxml b/packagecard/shop/product/goodsdetail.wxml new file mode 100755 index 0000000..98f06c2 --- /dev/null +++ b/packagecard/shop/product/goodsdetail.wxml @@ -0,0 +1,68 @@ + + + 详情 + + + + + + + + + + + + + + + ¥ {{goodsDetail.goodsUnitPrice}} + + + {{goodsDetail.goodsName}} + 库存:{{goodsDetail.goodsTotal}} + + + + {{goodsDetail.goodsSummary}} + + + 宝贝详情 + + + + + + + + + + + + + + + + + + + + + + {{item.goodsName}} + {{item.goodsSummary}} + + ¥{{item.goodsUnitPrice}} + + 删除 + + + + + + + \ No newline at end of file diff --git a/packagecard/shop/product/goodsdetail.wxss b/packagecard/shop/product/goodsdetail.wxss new file mode 100755 index 0000000..70c1d70 --- /dev/null +++ b/packagecard/shop/product/goodsdetail.wxss @@ -0,0 +1,11 @@ +/* pages/shop/product/goodsdetail.wxss */ +.scroll-content { + position: absolute; + width: 100%; + top: 530rpx; + border-top-right-radius: 60rpx; + border-top-left-radius: 60rpx; + padding-top: 20rpx; + z-index: 30; + background-color: white; +} \ No newline at end of file diff --git a/packagecard/shop/product/product.js b/packagecard/shop/product/product.js new file mode 100755 index 0000000..37ed604 --- /dev/null +++ b/packagecard/shop/product/product.js @@ -0,0 +1,98 @@ +// pages/shop/product/product.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + isSticky: false, + titleBarHeight: 0, + statusBarHeight: 0, + swiperlist: [ + 'https://image.weilanwl.com/img/4x3-1.jpg', + 'https://image.weilanwl.com/img/4x3-2.jpg', + 'https://image.weilanwl.com/img/4x3-3.jpg', + 'https://image.weilanwl.com/img/4x3-4.jpg', + ], + tabList: [ + "热门推荐", + "破尿酸", + "除皱瘦脸", + "眼部整形", + "水光华能" + ], + TabCur: 0, + scrollLeft: 0 + }, + tabSelect(e) { + this.setData({ + TabCur: e.currentTarget.dataset.id, + scrollLeft: (e.currentTarget.dataset.id - 1) * 60 + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let height = app.globalData.CustomBar + let statusHeight = app.globalData.StatusBar + this.setData({ + titleBarHeight: height, + statusBarHeight: statusHeight + }) + }, + scrollSticky(event) { + this.setData({ + isSticky: event.detail.isFixed + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/packagecard/shop/product/product.json b/packagecard/shop/product/product.json new file mode 100755 index 0000000..e94303e --- /dev/null +++ b/packagecard/shop/product/product.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-sticky": "../../../vant/dist/sticky/index" + } +} \ No newline at end of file diff --git a/packagecard/shop/product/product.wxml b/packagecard/shop/product/product.wxml new file mode 100755 index 0000000..1d8f294 --- /dev/null +++ b/packagecard/shop/product/product.wxml @@ -0,0 +1,24 @@ + + + 商品详情 + + + + + + + + + + + + + + + {{tabList[index]}} + + + + \ No newline at end of file diff --git a/packagecard/shop/product/product.wxss b/packagecard/shop/product/product.wxss new file mode 100755 index 0000000..ae8edfd --- /dev/null +++ b/packagecard/shop/product/product.wxss @@ -0,0 +1 @@ +/* pages/shop/product/product.wxss */ \ No newline at end of file diff --git a/packagecard/shop/shopingcart/cart.js b/packagecard/shop/shopingcart/cart.js new file mode 100755 index 0000000..8a74a4a --- /dev/null +++ b/packagecard/shop/shopingcart/cart.js @@ -0,0 +1,59 @@ +// pages/shop/shopingcart/cart.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, +}) \ No newline at end of file diff --git a/packagecard/shop/shopingcart/cart.json b/packagecard/shop/shopingcart/cart.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/packagecard/shop/shopingcart/cart.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/packagecard/shop/shopingcart/cart.wxml b/packagecard/shop/shopingcart/cart.wxml new file mode 100755 index 0000000..06aee2e --- /dev/null +++ b/packagecard/shop/shopingcart/cart.wxml @@ -0,0 +1,2 @@ + +pages/shop/shopingcart/cart.wxml diff --git a/packagecard/shop/shopingcart/cart.wxss b/packagecard/shop/shopingcart/cart.wxss new file mode 100755 index 0000000..5db4629 --- /dev/null +++ b/packagecard/shop/shopingcart/cart.wxss @@ -0,0 +1 @@ +/* pages/shop/shopingcart/cart.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100755 index 0000000..362f90f --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,1239 @@ +const app = getApp() +const innerAudioContext = wx.createInnerAudioContext() +Page({ + data: { + nameTxt: '名片', + dataList: [], + curIndex: 0, //用来记录请求次数 + speedStep: 5, //快进快退秒数 + waitFlag: false, + avatarUrl: app.globalData.userInfo.avatarUrl, + areaList: [], + cardHeight: '', + cardInfo: {}, + cardUrl: app.urls.baseImgUrl, + personIntro: {}, + companyIntro: {}, + shareImg: '', + phoneTxt: '未录入', + emailTxt: '未录入', + wechateTxt: '未录入', + addressTxt: '未录入', + viewInfo: {}, + forwardCount: '', + imgUrl: app.urls.baseImgUrl, + shareRecordId: '', + isShowBarCode: false, + browUserList: [], + shareImgUrl: '', + tempUserId: '', //当前名片用户的ID + cardTemplateDispatchId: '', //用来标记是否是分享过来的 + cardTemplateUseId: '', //分享过来的名片id + isShowCard: false, //用来显示我浏览过的名片 + otherCardList: [], //卡包名片 + isPlayAudio: false, //标识当前是否在播放音乐 + audioId: '', + uId: '', //海报过来的UserId + count: 3, + isMine: 1, //1 自己 2 其他 + isDefault: true, + animationData: {}, + isShowBtn: false, + isShowPhone: false, + isBindPhone: false, + isNeedRefresh: true, + isShowComment: false, //是否显示评论弹框 + posterId: '', //分享过来的海报ID + posterImg: '', //分享过来的海报图片 + isShowPoster: false, + defaultBtnIcon: '/images/ic_share_img.png', + shareTitle: '您好,这是我的电子名片,请查看.' + }, + onLoad(options) { + var self = this + self.checkPermission() + if (options.cardTemplateDispatchId) { + this.setData({ + cardTemplateDispatchId: options.cardTemplateDispatchId, + isMine: 2 + }) + } + if (options.cardTemplateUseId) { + //展示图片 + self.setData({ + posterId: options.cardTemplateUseId, + uId: options.userId + }) + } + self.buildId() + self.doLogin() + }, + // 登录 + doLogin() { + var self = this; + wx.showLoading({ + title: '加载中...', + }) + wx.login({ + success(res) { + app.http.post(app.urls.wxLogin, { + data: { + jsCode: res.code + } + }) + .then(res => { + wx.hideLoading({}) + var token = res.data.data.split('_')[0] + var isBind = res.data.data.split('_')[1] + self.setData({ + isBindPhone: isBind == 0 + }) + wx.setStorageSync('token', token) + wx.setStorageSync('bindPhone', isBind) + app.globalData.token = token + //保存用户名和头像 + self.doSaveUserInfo() + self.getInfo() //获取用户基本信息 + if (self.data.isMine == 2) { + if (self.data.cardTemplateDispatchId != '') { + self.getCardId() //获取分享过来的名片 + } + } else { + self.getDefault() //获取自己的名片 + } + self.getOtherCard(2) + self.getBtnIcon() //获取首页按钮图片 + if (self.data.posterId != '') { + self.getPosterImg() + } + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }) + }, + //获取分享的海报 + getPosterImg() { + var _self = this + app.http.get(app.urls.getMyCardDetail.format({ + cardTemplateUseId: _self.data.posterId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + var img = _self.data.imgUrl + res.data.cardTemplateUsePhotoUrl + console.log(img) + _self.setData({ + posterImg: img, + isShowPoster: true + }) + }) + .catch(err => { + + }) + }, + //首页按钮图片 + getBtnIcon() { + var _self = this + app.http.get(app.urls.getIndexIcon, { + header: { + token: app.globalData.token + } + }) + .then(res => { + if (res.data.data) { + _self.setData({ + defaultBtnIcon: _self.data.imgUrl + res.data.data + }) + } + }) + .catch(err => { + // console.error(err) + }) + }, + //保存用户头像及微信昵称 + doSaveUserInfo() { + try { + var names = wx.getStorageSync('name') + var icon = wx.getStorageSync('userIcon') + var _self = this + if (names) { + app.http.put(app.urls.doSaveUserInfo, { + header: { + token: app.globalData.token + }, + data: { + avatarUrl: icon, + nickName: names + } + }) + .then(res => {}) + .catch(err => { + console.log(err) + }) + } + } catch (err) { + console.log(err) + } + }, + //获取首页展示的栏目 + getMainColumn(id) { + var _self = this + _self.setData({ + dataList: [] + }) + app.http.get(app.urls.getMainColumn, { + header: { + token: app.globalData.token + }, + data: { + creator: id + } + }) + .then(res => { + wx.showLoading({ + title: '加载中...', + }) + _self.getMainMoment(res.data, id, 0) + }) + .catch(err => { + wx.stopPullDownRefresh({}) + }) + }, + //获取首页基础数据 电话 微信号 地址 邮箱 + getMainBaseUserInfo(userid) { + var _self = this + app.http.get(app.urls.getMainMoment.format({ + configColumnId: 'de7b5e22-64f9-4c60-a1f9-6ac004dfb9a8' + }), { + header: { + token: app.globalData.token + }, + data: { + userId: userid + } + }) + .then(res => { + if (res.data.length > 0) { + _self.setData({ + isShowBtn: true + }) + res.data[0].list.forEach(it => { + switch (it.name) { + case 'phone': + _self.setData({ + phoneTxt: it.value + }) + break + case 'wechat': + _self.setData({ + wechateTxt: it.value + }) + break + case 'email': + _self.setData({ + emailTxt: it.value + }) + break + case 'address': + _self.setData({ + addressTxt: it.value + }) + break + case 'cardtitle': + wx.setStorageSync('cardtitle', it.value) + _self.setData({ + shareTitle: it.value.length > 0 ? it.value : '您好,这是我的电子名片,请查看.' + }) + break + case 'postertitle': + wx.setStorageSync('postertitle', it.value) + break + } + }) + } else { + _self.setData({ + isShowBtn: false + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + onClose() { + this.setData({ + isShowPoster: false + }) + }, + //获取首页栏目数据 + getMainMoment(datas, userid, index) { + var _self = this + var count = datas.length + if (index < count) { + app.http.get(app.urls.getMainMoment.format({ + configColumnId: datas[_self.data.curIndex].configColumnId + }), { + header: { + token: app.globalData.token + }, + data: { + userId: userid + } + }) + .then(res => { + if (res.data.length > 0) { + // collectSwitch: datas[_self.data.curIndex].configColumnCollect, //收藏开关 + // commentSwitch: datas[_self.data.curIndex].configColumnComment, //评论开关 + // shareSwitch: datas[_self.data.curIndex].configColumnDispatch, //转发开关 + // likeSwitch: datas[_self.data.curIndex].configColumnLike, //点赞开关 + var tempItem = { + cId: datas[_self.data.curIndex].configColumnId, + type: datas[_self.data.curIndex].configColumnType, + name: datas[_self.data.curIndex].configColumnName, + mode: datas[_self.data.curIndex].configTableMode, + list: res.data.slice(0, datas[_self.data.curIndex].configColumnRowCount) + } + _self.data.dataList.push(tempItem) + } + _self.setData({ + curIndex: ++_self.data.curIndex + }) + _self.getMainMoment(datas, userid, _self.data.curIndex) + + }) + .catch(err => { + _self.setData({ + curIndex: ++_self.data.curIndex + }) + if (datas[_self.data.curIndex]) { + _self.getMainMoment(datas, userid, _self.data.curIndex) + } + }) + } else { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + _self.buildMainData() + } + }, + //构建主页显示数据 + buildMainData() { + var _self = this + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(iem => { + switch (iem.dataType) { + case '2': //图片 + var photoIds = iem.value.split('@') + if (photoIds.length > 1) { + //展示方式 + iem.dataMode = photoIds[1] + } else { + iem.dataMode = '1' + } + var items = photoIds[0].split(',') + var tempList = [] + items.forEach(item => { + if (item != '') { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '3': //音频 + var items = iem.value.split(',') + var tempList = [] + items.forEach(item => { + if (item != '') { + var ss = item.split('&') + var totalStr = '00:00' + if (ss.length > 1) { + var dur = ss[1] + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + var tempItem = { + id: ss[0], //id + path: app.urls.baseImgUrl + ss[0], //地址 + isPlay: false, //是否播放中 + duration: 100000, //时长 + curDuration: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '4': //视频 + var items = iem.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i] != '') { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + iem.valueList = tempList + break + case '6': + var items = iem.value.split('-') + var tempList = [] + items.forEach(item => { + if (item != '') { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '8': //单选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + iem.selValue = ss.dataName + } + }) + break + case '9': //多选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + ss.isSel = true + } else { + ss.isSel = false + } + }) + break + } + }) + }) + }) + _self.setData({ + curIndex: 0, + dataList: _self.data.dataList + }) + }, + //显示更多栏目数据 + showMore(e) { + this.setData({ + isNeedRefresh: false + }) + var item = e.currentTarget.dataset.item + if (item.mode == '2') { + var userid = e.currentTarget.dataset.userid + var idx = e.currentTarget.dataset.idx + wx.navigateTo({ + url: '/packagecard/moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx, + }) + } + }, + onPullDownRefresh() { + if (app.globalData.token != '') { + this.setData({ + isNeedRefresh: true, + }) + if (this.data.isMine == 2) { + if (this.data.cardTemplateUseId != '') { + this.setData({ + dataList: [], + cardInfo: null, + areaList: null + }) + this.getCard() + } + } else { + this.getDefault() + } + this.getOtherCard(2) + this.getBtnIcon() + } else { + this.doLogin() + } + }, + //预览图片 + viewImg(e) { + var imgPaths = [] + var imgs = e.currentTarget.dataset.values + this.setData({ + isNeedRefresh: false + }) + imgs.forEach(it => { + imgPaths.push(it.path) + }) + wx.previewImage({ + urls: imgPaths, + current: e.currentTarget.dataset.cur + }) + }, + //预览视频 + viewVideo(e) { + var url = e.currentTarget.dataset.url + this.setData({ + isNeedRefresh: false + }) + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + play(e) { + //进行播放 + const _self = this + const index = e.currentTarget.dataset.index + const idx = e.currentTarget.dataset.idx + const ix = e.currentTarget.dataset.i + const a = e.currentTarget.dataset.a + var audio = e.currentTarget.dataset.item + console.log(_self.data.isPlayAudio) + if (_self.data.isPlayAudio) { + //有播放的 + //先需要停止其他录音文件的播放 + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(ix => { + if (ix.dataType == '3') { + if (ix.valueList) { + ix.valueList.forEach(ii => { + ii.isPlay = false + ii.curDuration = 0 + ii.curDuationStr = '00:00' + }) + } + } + }) + }) + }) + _self.setData({ + dataList: _self.data.dataList + }) + innerAudioContext.stop() + if (_self.data.audioId != audio.id) { + wx.showLoading({ + title: '加载中...', + }) + setTimeout(function () { + wx.hideLoading({}) + innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3' + innerAudioContext.startTime = 0 + innerAudioContext.autoplay = true + _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: true, + audioId: audio.id + }) + }, 1500) + } + } else { + //没有播放的 + innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3' + innerAudioContext.startTime = 0 + innerAudioContext.autoplay = true + innerAudioContext.play() + _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: true, + audioId: audio.id + }) + } + innerAudioContext.onPlay(() => { + + }); + + innerAudioContext.onCanplay((res) => {}) + innerAudioContext.onStop((res) => { + console.log('onStop===') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onEnded((res) => { + console.log(res) + console.log('播放完毕') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onError((res) => { + console.log('播放错误') + console.log(res) + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onSeeking(() => { + // console.log(innerAudioContext.currentTime) + }) + }, + + // 跳转模板列表 + //判断是否绑定手机 + //绑定过 + goList: function () { + //TODO 测试 + wx.navigateTo({ + url: '/packagecard/cardList/cardList', + }) + }, + // 获取个人简介 + getPersonIntro: function () { + var self = this + app.restAjax.get(app.restAjax.path('{personIntroUrl}app/userexpand/get/' + app.globalData.userInfo.userId, [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + personIntro: data + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 获取用户信息 + getUserInfo: function () { + var self = this + app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + app.globalData.userInfo = data + self.getList() + + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + //获取 + getInfo() { + app.http.get(app.urls.getUserBaseInfo, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.setStorageSync('usercode', res.data.userCode) + wx.setStorageSync('userId', res.data.userId) + }) + .catch(err => { + console.log(err) + }) + }, + // 获取默认名片 + getDefault: function () { + var self = this + app.globalData.showUserId = '' + self.setData({ + cardInfo: {}, + areaList: [] + }) + app.http.get(app.urls.getDefaultCard.format({ + userId: self.data.uId + }), { + header: { + token: app.globalData.token + } + }).then(res => { + var area = res.data.areaList + area.forEach(it => { + if (it.templateAreaSource == 'name') { + self.setData({ + nameTxt: it.templateAreaFontValue + }) + } + }) + self.setData({ + cardInfo: res.data, + isDefault: res.data.cardTemplateUseSystem == '1', + areaList: area, + dataList: [] + }) + if (res.data) { + self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) + self.getBrowCardUserList(res.data.cardTemplateUseId) + self.setData({ + tempUserId: res.data.creator, + cardTemplateUseId: res.data.cardTemplateUseId + }) + app.globalData.userId = res.data.creator + self.getMainColumn(res.data.creator) + self.getMainBaseUserInfo(res.data.creator) + } + }).catch(res => { + wx.stopPullDownRefresh({}) + }) + }, + //获取浏览当前名片的用户头像列表 + getBrowCardUserList(id) { + var _self = this + app.http.get(app.urls.getCardBrowUserList, { + header: { + token: app.globalData.token + }, + data: { + page: '1', + rows: '7', + cardTemplateUseId: id + } + }) + .then(res => { + if (res.data) { + _self.setData({ + browUserList: res.data.rows + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + // 存入通讯录 + addContact: function () { + var self = this + wx.addPhoneContact({ + firstName: self.data.nameTxt, + mobilePhoneNumber: self.data.phoneNum + }) + }, + // 加入卡包 + includedCard: function () { + var self = this + app.http.post(app.urls.includedCard, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseBagId: "", + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateUseStar: "", + cardTemplateUseTag: "", + cardTemplateUseTop: "" + } + }).then(res => { + console.log(res.data) + wx.showToast({ + title: '加入卡包成功!', + }) + }) + .catch(err => { + + }) + }, + // 拨打电话 + makeCall: function () { + var self = this + var phone = self.data.phoneTxt + if (phone) { + wx.makePhoneCall({ + phoneNumber: phone, + }) + } + }, + // 获取浏览数 + getViewCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + viewInfo: data + }) + }, function (code, data) { + if (data.msg) { + app.dialog.msg(data.msg); + } + }); + }, + // 获取转发数 + getForwardCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), { + templateUseId: self.data.cardInfo.cardPersonId + }, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + forwardCount: data.data + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 复制文本 + copyText: function (e) { + var self = this + var text = e.currentTarget.dataset.text + if (text) { + wx.setClipboardData({ + data: text, + success: function () {} + }) + } + }, + // 获取头像 + checkPermission() { + var _self = this + try { + var names = wx.getStorageSync('name') + var icon = wx.getStorageSync('userIcon') + + if (names) { + this.setData({ + name: names, + userIcon: icon + }) + } else { + wx.showModal({ + title: '提示', + content: '小程序需要您微信头像以及昵称用于展示,请授权.', + showCancel: false, + success(res) { + if (res.confirm) { + _self.getUserProfile(3) + } + } + }) + } + } catch (error) { + wx.showToast({ + title: '获取信息失败', + icon: 'error' + }) + } + }, + //获取手机号进行绑定 + getPhoneNumber(e) { + var _self = this + var iv = e.detail.iv + var encryptedData = e.detail.encryptedData + console.log(encryptedData) + if (encryptedData) { + wx.showLoading({ + title: '绑定中...', + }) + app.http.put(app.urls.doUpdatePhone, { + header: { + token: app.globalData.token + }, + data: { + iv: iv, + encryptedData: encryptedData + } + }) + .then(res => { + wx.hideLoading({}) + //保存绑定状态 + wx.setStorageSync('token', res.data.data) + wx.setStorageSync('bindPhone', 0) + _self.setData({ + isBindPhone: true + }) + app.globalData.token = res.data.data + wx.showToast({ + title: '绑定成功', + success(e) { + wx.navigateTo({ + url: '/packagecard/cardList/cardList', + }) + } + }) + }) + .catch(err => {}) + } + }, + getUserProfile(e) { + let _self = this + wx.getUserProfile({ + desc: '获取微信头像以及昵称用于展示', + success: (res) => { + wx.setStorage({ + data: res.userInfo.nickName, + key: 'name', + }) + wx.setStorage({ + data: res.userInfo.avatarUrl, + key: 'userIcon', + }) + _self.setData({ + name: res.userInfo.nickName, + userIcon: res.userInfo.avatarUrl + }) + app.globalData.userIcon = res.userInfo.avatarUrl + app.globalData.userInfo = res.userInfo + _self.selectComponent('#head').refreshCart() + }, + fail(err) { + //判断是否绑定手机号 + wx.showToast({ + title: '获取信息失败', + icon: 'error', + }) + } + }) + }, + // 生成随机id + buildId: function () { + var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + + var nums = ""; + + for (var i = 0; i < 36; i++) { + var id = parseInt(Math.random() * 61); + + nums += chars[id]; + } + return nums + }, + // 展示名片码 + showBarCode: function () { + // TODO 测试 + // wx.navigateTo({ + // url: '/packagecard/moments/publish/momentpublish', + // }) + this.setData({ + isNeedRefresh: false + }) + var _self = this + wx.navigateTo({ + url: '/packagecard/sharePage/cardcode?cardImg=' + _self.data.cardInfo.cardTemplateUsePhotoUrl + '&id=' + _self.data.cardInfo.cardTemplateUseBarcode, + }) + }, + // 隐藏名片码 + hideBarCode: function () { + this.setData({ + isShowBarCode: false + }) + wx.showTabBar() + }, + // 转发记录 + shareRecord: function (cardTemplateDispatchId) { + var self = this + app.http.post(app.urls.shareRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateDispatchParentId: '', + cardTemplateDispatchId: cardTemplateDispatchId + } + }).then(res => { + self.setData({ + shareRecordId: res.data.data + }) + }) + }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function (res) { + var self = this + self.setData({ + isNeedRefresh: false + }) + wx.showShareMenu({ + withShareTicket: true, + success: function (res) { + console.log(res) + } + }) + var type = res.target.dataset.sharetype + if (type && type == '2') { + //转发个人动态 + + } else { + var postId = self.buildId() + self.shareRecord(postId) + var param = '/pages/index/index?cardTemplateDispatchId=' + postId; + return { + title: self.data.shareTitle, + path: param, + imageUrl: self.data.shareImgUrl + } + } + }, + //将分享的Base64图片保存至本地 + toSaveLocalImg(data) { + var _self = this + var base64 = data + var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png' + var imageData = base64.replace(/^data:image\/\w+;base64,/, ""); + var fs = wx.getFileSystemManager(); + fs.writeFileSync(imgPath, imageData, "base64"); + this.setData({ + shareImgUrl: imgPath + }) + }, + //显示详情 + showDetail(e) { + this.setData({ + isNeedRefresh: false + }) + var type = e.currentTarget.dataset.ctype //需要跳详情 + if (type.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) { + //需要跳详情 + var cId = e.currentTarget.dataset.cid + var uId = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, + }) + } + }, + + /**分享过来的数据**/ + + // 获取名片id + getCardId: function () { + var self = this + app.http.get(app.urls.getCardUseId.format({ + cardTemplateDispatchId: self.data.cardTemplateDispatchId + }), { + header: { + token: app.globalData.token + } + }).then(res => { + self.setData({ + cardTemplateUseId: res.data.cardTemplateUseDTO.cardTemplateUseId + }) + self.getCard() + self.saveCheckRecord() + }) + }, + // 获取名片 + getCard() { + var self = this + app.http.get(app.urls.shareCard.format({ + cardTemplateUseId: self.data.cardTemplateUseId + }), { + header: { + token: app.globalData.token + } + }).then(res => { + app.globalData.showUserId = res.data.creator + wx.stopPullDownRefresh({}) + var area = res.data.areaList + area.forEach(it => { + if (it.templateAreaSource == 'name') { + self.setData({ + nameTxt: it.templateAreaFontValue + }) + } + }) + self.setData({ + cardInfo: res.data, + areaList: area, + dataList: [] + }) + + if (res.data) { + self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片 + self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量 + app.globalData.userId = res.data.creator //保存当前名片的用户ID + self.setData({ + tempUserId: res.data.creator + }) + self.getMainColumn(res.data.creator) //获取当前用户的栏目 + self.getMainBaseUserInfo(res.data.creator) + } + }) + .catch(err => { + wx.stopPullDownRefresh({}) + }) + }, + + // 保存查看记录 + saveCheckRecord: function () { + var self = this + app.http.post(app.urls.checkRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardTemplateUseId, + cardTemplateDispatchId: self.data.cardTemplateDispatchId + } + }).then(res => { + console.log(res) + }).catch(res => { + console.log(res) + }) + }, + onHide(e) { + this.setData({ + isShowCard: false, + isShowPhone: false + }) + if (innerAudioContext) { + innerAudioContext.stop() + } + }, + //显示浏览历史 + showCardHistory(e) { + var _self = this + if (_self.data.otherCardList.length > 0) { + this.setData({ + isShowCard: true + }) + } else { + this.getOtherCard(1) + } + }, + // 获取浏览历史 + getOtherCard(type) { + var self = this + self.setData({ + otherCardList: [] + }) + app.http.get(app.urls.getBrowseHistoryList, { + header: { + token: app.globalData.token + }, + data: { + page: 1, + rows: 7, + homePage: 1 + } + }).then(res => { + var curArr + if (res.data.rows.length > 0) { + self.buildOtherCardList(res.data.rows) + } + if (type == 1) { + self.setData({ + isShowCard: true + }) + } + }) + .catch(err => {}) + }, + changeCard(e) { + var item = e.currentTarget.dataset.item + var type = e.currentTarget.dataset.type + var _self = this + if (type == 1) { + this.setData({ + cardTemplateDispatchId: '', + cardTemplateUseId: '', + isShowCard: false, + isMine: 1, + isDefault: false, + uId: '' + }) + this.getDefault() + } else if (type == 2) { + this.setData({ + cardTemplateUseId: '', + isShowCard: false, + isMine: 2, + isDefault: true + }) + this.getCard() + } else { + this.setData({ + cardTemplateUseId: item.cardTemplateUseId, + isShowCard: false, + isMine: 2, + isDefault: true + }) + this.getCard() + } + }, + //重新构建浏览历史数据 + buildOtherCardList(row) { + var temp + var _self = this + row.forEach(it => { + var list = it.cardTemplateUseDTO.areaList + temp = {} + list.forEach(item => { + if (item.templateAreaSource == 'name') { + temp['name'] = item.templateAreaFontValue + } else if (item.templateAreaSource == 'phone') { + temp['phone'] = item.templateAreaFontValue + } else if (item.templateAreaSource == 'address') { + temp['address'] = item.templateAreaFontValue + } else if (item.templateAreaSource == 'department') { + temp['department'] = item.templateAreaFontValue + } + }) + temp['cardTemplateUseId'] = it.cardTemplateUseId + _self.data.otherCardList.push(temp) + }) + _self.setData({ + otherCardList: _self.data.otherCardList + }) + }, + onShow(e) { + if (app.globalData.token != '') { + if (this.data.isMine != 2) { + if (this.data.isNeedRefresh) { + wx.startPullDownRefresh({}) + } + } + } + this.setData({ + isNeedRefresh: true + }) + }, + onCloseDialog() { + this.setData({ + isShowComment: false + }) + }, + //显示评论 + showComment(e) { + this.setData({ + isShowComment: true + }) + }, + //点赞 + doLike(e) { + + }, + //收藏 + doCollect(e) { + + } +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100755 index 0000000..69b19d4 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,4 @@ +{ + "enablePullDownRefresh": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml new file mode 100755 index 0000000..0351f2a --- /dev/null +++ b/pages/index/index.wxml @@ -0,0 +1,450 @@ + + + + {{nameTxt}} + + + + + + + + + + + + + + + + + + + + + + + 02/ + + + 加入卡包 + + + + 03/ + + + 名片码 + + + + + + + 拨打电话 + + {{phoneTxt}} + + + + + 添加微信 + + {{wechateTxt}} + + + + + 邮箱 + + {{emailTxt}} + + + + + 地址 + + {{addressTxt}} + + + + + + + + + + + + + {{cardInfo.cardTemplateUseScansNumber >999? '999+' : + cardInfo.cardTemplateUseScansNumber}} + + + + {{cardInfo.cardTemplateUseDispatchNumber>999 ? + '999+':cardInfo.cardTemplateUseDispatchNumber}} + + + + + + + + + + + + + + + + {{item.name}} + + + + 更多 + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.comment}}:{{child.selValue}} + + + + + + + + + {{child.comment}} + + + + + {{ss.dataName}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 十而百智慧名片 + + + 一份信心,一份努力,一份成功;十分信心,十分努力,十分成功. + + + + + + + + + + + + 我的 + + + + + + + {{item.name}} + + + + 电话:{{item.phone}} + + + 公司:{{item.department}} + + + 地址:{{item.address}} + + + + + + + + + + + + + 创建名片需要绑定您的手机号,请授权 + + + + + + + + + + 图片或视频 + + + 发布 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss new file mode 100755 index 0000000..5811671 --- /dev/null +++ b/pages/index/index.wxss @@ -0,0 +1,785 @@ +.card-container { + box-sizing: border-box; +} + +.share-btn { + background: #eee; +} + +.card { + width: 100%; + box-sizing: border-box; + position: relative; + overflow: hidden; + /* text-align: center; */ +} + +.area-box { + white-space: nowrap; + word-break: break-all; + z-index: 111; +} + +.card-bgImg { + width: 100%; +} + +.person { + padding: 20rpx; +} + +.dynamic-container { + margin-top: -50rpx; + position: relative; + background-color: #fff; + padding: 20rpx; + border-radius: 20rpx; +} + +.dynamic-title image { + width: 30rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4rpx; +} + +.catelog-title { + display: flex; + position: relative; + align-items: center; + padding: 15rpx; + justify-content: space-between; +} + +.catelog-title .action { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; +} + +.title { + font-size: 30rpx; + position: relative; + color: #000; + display: inline-block; +} + +.title text { + margin-left: 20rpx; +} + +.column-box { + display: flex; + flex-direction: column; + background-color: #fff; + width: 100%; +} + +.column-box-row { + display: flex; + flex-direction: row; + align-items: center; + background-color: #fff; + width: 100%; + padding: 15rpx; +} + +.column-item { + margin: 0rpx; + padding: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.img-item { + width: 100%; + border-radius: 5rpx; +} + +.img-item:nth-child(1) { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.img-item:last-child { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.column-content { + display: flex; + flex-direction: column; + background-color: #fff; + border-radius: 10rpx; + width: 100%; + box-shadow: 0px 2px 2px #f0f0f0; + z-index: 2; +} + +.intro-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.serve-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.person-content { + padding: 20rpx; + border-radius: 20rpx; + background: #fff; + margin-top: -30rpx; + font-size: 30rpx; + color: #000; + line-height: 40rpx; + word-break: break-all; + line-height: 40rpx; + letter-spacing: 2rpx; + position: relative; +} + +.company-title { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #ddd; +} + +.company-title image { + width: 140rpx; + height: 140rpx; +} + +.company-name { + width: 520rpx; + height: 140rpx; + display: flex; + align-items: center; + font-size: 34rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.company-content { + background: #fff; + border-radius: 20rpx; + padding: 20rpx; + margin-top: -30rpx; + position: relative; +} + +.company-content image { + width: 100%; + height: 300rpx; + border-radius: 20rpx; +} + +.company .person-content { + margin-top: 0; +} + +.dynamic-title { + width: 710rpx; + margin: 0 auto; + display: block; +} + +.dynamic-box { + margin-bottom: 20rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; + position: relative; + height: 400rpx; +} + +.dynamic-box image { + width: 100%; + height: 400rpx; +} + +.dynamic-text { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + line-height: 60rpx; + color: #fff; + padding: 0 10rpx; + font-size: 30rpx; +} + +.person-info { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 1px solid #EEE; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + overflow: hidden; +} + +.avatar image { + width: 100%; + height: 100%; +} + +.person-name { + width: 530rpx; +} + +.name { + font-size: 32rpx; + margin: 15rpx 0 10rpx; + color: #000; +} + +.time { + color: #b2b2b2; +} + +.dynamic-content { + margin: 20rpx 0; +} + +.dynamic-img { + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.dynamic-img image { + width: 32%; + margin-right: 2%; + height: 160rpx; + margin-bottom: 10rpx; +} + +.dynamic-img image:nth-child(3n) { + margin-right: 0; +} + +.dynamic-img-text { + position: absolute; + left: 0; + right: 0; + bottom: 3rpx; + padding: 0 20rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 32rpx; + line-height: 70rpx; +} + +.dynamic-good { + margin: 10rpx 0; + display: flex; + justify-content: space-between; +} + +.good-count { + color: #333; + font-size: 28rpx; +} + +.good-btn image { + width: 40rpx; + height: 40rpx; + vertical-align: top; +} + +.dynamic-reply { + background: #eee; + padding: 15rpx; + margin-top: 15rpx; +} + +.reply { + font-size: 32rpx; + color: #000; + margin-bottom: 5rpx; +} + +.reply-name { + font-weight: bold; + display: inline; +} + +.dynamic-reply-input { + margin-top: 10rpx; +} + +.dynamic-reply-input input { + width: 100%; + height: 60rpx; + border-bottom: 1px solid #eee; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #E6B980; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card-box { + position: fixed; + right: 20rpx; + bottom: 20rpx; + /* padding: 20rpx; */ + /* background: #E6B980; */ + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card-box button { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.creat-card-box image { + width: 100%; + height: 100%; + border-radius: 50%; +} + +.share-save { + text-align: center; + display: flex; + justify-content: space-between; +} + +.share-btn { + border: 1px solid #E6B980; + background: none; + color: #1296db; + font-weight: normal; +} + +.save-btn { + border: 1px solid #1296db; + background: #1296db; + color: #fff; + font-weight: normal; +} + +.bottom-btn { + margin-top: 20rpx; + padding: 0 20rpx; + width: 100%; + white-space: nowrap; +} + +.phone-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.wechate-box .icon { + width: 35rpx; + height: 30rpx; + vertical-align: top; +} + +.email-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.bottom-btn-box { + display: inline-block; + min-width: 32%; + line-height: 30rpx; + padding: 20rpx; + box-sizing: border-box; + border: 1px solid #DDD; + border-radius: 10rpx; + margin-right: 10rpx; +} + +.bottom-text { + margin-top: 10rpx; +} + +.top-box { + width: 100%; +} + +.good { + display: flex; + justify-content: space-between; + width: 100%; + background-color: #fff; + padding: 15rpx; +} + +.good-avatar, +.good-click { + line-height: 45rpx; + color: #333; +} + +.good-avatar { + font-size: 0; +} + +.good-click { + display: flex; +} + +.view-count { + border-right: 1px solid #808080; + color: #808080; + display: flex; + flex-direction: row; + font-size: 36rpx; + align-items: center; + justify-content: center; +} + +.view-count-no { + color: #808080; + display: flex; + flex-direction: row; + align-items: center; + font-size: 36rpx; + margin-left: 15rpx; +} + +.good-avatar image { + width: 100%; + height: 100%; + border-radius: 50%; +} + + +.good-click image { + width: 38rpx; + height: 38rpx; +} + +.view-count image { + width: 32rpx; + height: 32rpx; +} + +.view-count-no image { + width: 32rpx; + height: 32rpx; +} + +.movie-item { + height: 280rpx; + width: 100%; + padding-bottom: 0px; +} + + + +.avatar-list { + width: 45rpx; + height: 45rpx; + margin-left: -15rpx; + vertical-align: top; + display: inline-block; + border-radius: 50%; + border: 2px solid #fff; + position: relative; +} + +.avatar-list:first-child { + margin-left: 0; +} + +.mid { + display: flex; + width: 100%; + background: white; + position: relative; +} + +.mid-box { + flex: 1; + width: 100%; + display: flex; + flex-direction: column; + align-items: left; + justify-content: left; + border: 2rpx solid #EAC390; + border-radius: 10rpx; + background-color: white; + font-weight: normal; + padding: 15rpx; +} + +.mid-box:nth-child(1) { + background: white; +} + +.mid-box:nth-child(2) { + margin-left: 15rpx; +} + +.mid-box:last-child { + border: none; + border-radius: 10rpx; + margin-left: 15rpx; +} + +.mid-box image { + width: 48rpx; + height: 48rpx; +} + +.mid-box-text { + font-size: 28rpx; + color: #000; + text-align: left; + font-weight: bold; +} + +.mid-box-text-white { + font-size: 28rpx; + color: #FFF; + text-align: left; + font-weight: bold; +} + +.mid-btn { + position: relative; + margin-top: 15rpx; + display: flex; + width: 100%; + border: 1rpx solid rgb(235, 235, 235); + border-radius: 15rpx; + background: #fff; + box-shadow: 10rpx 10rpx 20rpx 20rpx #e4e4e426; + flex-wrap: nowrap; + flex-direction: column; + justify-content: center; +} + +.mid-btn-box { + flex-shrink: 0; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + box-sizing: border-box; +} + + + +.mid-btn-box:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(2) { + padding: 7.5rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(3) { + padding: 7.5rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(4) { + padding: 7.5rpx 15rpx 15rpx 15rpx +} + +.mid-btn-title { + display: flex; + flex-direction: row; + justify-content: flex-start; + flex: 3; + align-items: center; +} + +.mid-btn-title .image { + width: 48rpx; + height: 48rpx; +} + +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.mid-btn-title text { + margin-left: 15rpx; + font-size: 28rpx; + color: #333333; +} + + +.mid-btn-box image { + width: 80rpx; + height: 80rpx; +} + +.mid-btn-text { + width: 200rpx; +} + +.text-top { + line-height: 45rpx; + font-size: 30rpx; + color: #000; +} + +.text-bottom { + font-size: 26rpx; + color: #898989; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bar-code { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 999; +} + +.bar-code-tr { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0); + z-index: 999; +} + +.bar-code .content { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: 96%; + background: #fff; + /* width: 500rpx; + height: 500rpx; */ + border-radius: 10rpx; + padding: 20rpx; + min-width: 60%; + min-height: 45%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.code-title { + font-size: 32rpx; + font-weight: bold; + color: #000; +} + +.code-txt { + font-size: 32rpx; + color: #000; +} + +.bar-code image { + width: 300rpx; + height: 300rpx; +} + +.func-box { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.func-items { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 15rpx; +} + +.func-item { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex: 1; + color: #000; + width: 23%; + border-right: 1rpx solid #d8d8d8; +} + +.func-item:last-child { + border-right: 0rpx; +} + +.func-item:active { + background-color: #f3f3f3; + color: #dfdfdf; +} + +.func-item image { + width: 48rpx; + height: 48rpx; +} + +.func-item text { + margin-left: 10rpx; +} \ No newline at end of file diff --git a/pages/mine/columnlist/columnlist.js b/pages/mine/columnlist/columnlist.js new file mode 100755 index 0000000..d82c238 --- /dev/null +++ b/pages/mine/columnlist/columnlist.js @@ -0,0 +1,72 @@ +// pages/mine/columnlist/columnlist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + groupId: '', + menuList: [], + title: '栏目', + imgUrl: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + groupId: options.id, + title: options.title + }) + this.getList() + }, + + getList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getColumnListByGroupId, { + header: { + token: app.globalData.token + }, + data: { + configColumnGroupId: _self.data.groupId + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + menuList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + choosePage(e) { + // 栏目列表页跳转方式1:小程序页面,2:其他小程序,3:网址 + var path = e.currentTarget.dataset.path + var type = e.currentTarget.dataset.type + var item = e.currentTarget.dataset.item + switch (type) { + case '1': //跳转小程序内部 + case '3': //链接 + wx.navigateTo({ + url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType + '&title=' + item.configColumnName + }) + break + case '2': //其他小程序 + wx.navigateToMiniProgram({ + appId: '', + success(res) { + // 打开成功 + } + }) + break + } + }, + +}) \ No newline at end of file diff --git a/pages/mine/columnlist/columnlist.json b/pages/mine/columnlist/columnlist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/columnlist/columnlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/columnlist/columnlist.wxml b/pages/mine/columnlist/columnlist.wxml new file mode 100755 index 0000000..8aab312 --- /dev/null +++ b/pages/mine/columnlist/columnlist.wxml @@ -0,0 +1,33 @@ + + + {{title}} + + + + + + + + + + + {{group.configColumnName}} + + + {{group.configColumnRemark}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/columnlist/columnlist.wxss b/pages/mine/columnlist/columnlist.wxss new file mode 100755 index 0000000..40eb1ec --- /dev/null +++ b/pages/mine/columnlist/columnlist.wxss @@ -0,0 +1 @@ +/* pages/mine/columnlist/columnlist.wxss */ \ No newline at end of file diff --git a/pages/mine/income/incomelist.js b/pages/mine/income/incomelist.js new file mode 100755 index 0000000..7722442 --- /dev/null +++ b/pages/mine/income/incomelist.js @@ -0,0 +1,85 @@ +// pages/mine/income/incomelist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curPage: 1, + isRefreshing: false, //是否在刷新中 + hasMore: true, //是否有更多数据 + isLoadMore: false, //是否正在加载更多 + recordList: [] + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getList() + }, + getList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getIncomeList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.curPage, + rows: '10' + } + }) + .then(res => { + wx.stopPullDownRefresh({}) + wx.hideLoading({}) + _self.data.recordList = _self.data.recordList.concat(res.data.rows) + var more = _self.data.recordList.length < res.data.total + _self.setData({ + recordList: _self.data.recordList, + isRefreshing: false, + isLoadMore: false, + hasMore: more + }) + }) + .catch(err => { + wx.stopPullDownRefresh({}) + _self.setData({ + isRefreshing: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + //加载更多 + doLoadMore() { + var _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + this.setData({ + isLoadMore: true, + curPage: ++_self.data.curPage + }) + this.getList() + } + }, + onReachBottom() { + this.doLoadMore() + }, + //下拉刷新 + onPullDownRefresh() { + this.setData({ + isLoadMore: false, + isRefreshing: true, + hasMore: true, + recordList: [], + curPage: 1 + }) + this.getList() + } +}) \ No newline at end of file diff --git a/pages/mine/income/incomelist.json b/pages/mine/income/incomelist.json new file mode 100755 index 0000000..2a7b263 --- /dev/null +++ b/pages/mine/income/incomelist.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true, + "onReachBottomDistance": 50 +} \ No newline at end of file diff --git a/pages/mine/income/incomelist.wxml b/pages/mine/income/incomelist.wxml new file mode 100755 index 0000000..5401b1f --- /dev/null +++ b/pages/mine/income/incomelist.wxml @@ -0,0 +1,25 @@ + + 收益记录 + + + + + + {{item.accountItemDescription}} + 收益到账:{{item.gmtCreate}} + 收益金额:¥{{item.accountItemSysMoney/100}} + + + + + {{item.accountItemType}} + + + + 加载中... + + + + + \ No newline at end of file diff --git a/pages/mine/income/incomelist.wxss b/pages/mine/income/incomelist.wxss new file mode 100755 index 0000000..a881a7c --- /dev/null +++ b/pages/mine/income/incomelist.wxss @@ -0,0 +1,121 @@ +/* pages/mine/vip/vipcenter.wxss */ + + +.info-box { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + align-self: center; + box-shadow: 0rpx 4rpx 8rpx 0rpx #efd9be, 0rpx 6rpx 20rpx 0rpx #efd9be; + border-radius: 10rpx; + padding: 10rpx 0rpx; +} + +.base-info { + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; + padding: 15rpx; +} + +.base-info .user-icon { + width: 128rpx; + height: 128rpx; + border-radius: 50%; + border: 6rpx solid #ffbc00; +} + +.base-info-text-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; +} + +.name-box { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.name-box .name { + font-size: 32rpx; + color: #ffffff; + line-height: 10rpx; +} + +.name-box image { + width: 48rpx; + height: 48rpx; + margin-left: 15rpx; +} + +.item { + display: flex; + flex-direction: row; + position: relative; + justify-content: flex-start; + align-items: center; + background-color: #ffffff; + width: 100%; + padding: 15rpx; + margin-top: 15rpx; +} + +.item:nth-child(1) { + margin-top: 0rpx; +} + +.subscript { + width: 96rpx; + height: 96rpx; + position: absolute; + right: 0rpx; + bottom: 0rpx; +} + +.subscript image { + width: 100%; + height: 100%; +} + +.state { + position: absolute; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 22rpx; + width: 100%; + height: 100%; + top: 30%; + left: 110%; + color: #ffffff; +} + +.item .icon { + width: 96rpx; + height: 96rpx; + border-radius: 50%; +} + +.item .content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; + width: 85%; +} + +.title { + font-size: 32rpx; + color: #E6B980; +} + +.hint-msg { + font-size: 28rpx; + color: #333333; +} \ No newline at end of file diff --git a/pages/mine/index/index.js b/pages/mine/index/index.js new file mode 100755 index 0000000..6c9bc87 --- /dev/null +++ b/pages/mine/index/index.js @@ -0,0 +1,450 @@ +// pages/mine/index/index.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + nickName: '昵称', + name: '用户名称', + userIcon: '/images/ic_user_default.png', + menuList: [], + imgUrl: app.urls.baseImgUrl, + Height: 0, + isShow: true, + isBindPhone: false, + isPay: true, //是否需要交费 + code: '', + isOpen: true, + payState: {}, + accountInfo: undefined, + userId: '' + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + var _self = this + _self.setData({ + nickName: app.globalData.userInfo.name, + name: app.globalData.userInfo.name + }) + try { + var isBind = wx.getStorageSync('bindPhone') + var code = wx.getStorageSync('usercode') + var userId = wx.getStorageSync('userId') + if (code && code.length > 0) { + _self.setData({ + code: code, + userId: userId + }) + } + _self.setData({ + isBindPhone: isBind == 0 + }) + } catch (err) { + console.log(err) + } + }, + //获取我的账户信息 + getAccountInfo() { + var _self = this + app.http.get(app.urls.getMyAccount, { + header: { + token: app.globalData.token + } + }) + .then(res => { + _self.setData({ + accountInfo: res.data + }) + }) + .catch(err => { + console.log(err) + }) + }, + //获取支付状态 + getPayState() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getPayState, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //支付过跳转名片创建页面,没有支付跳转支付页面 + if (res.data.cardChargeEnd && res.data.cardChargeEnd.length > 0) { + res.data.cardChargeEnd = _self.formatDate(res.data.cardChargeEnd) + } + _self.setData({ + isPay: res.data.cardCharge, + payState: res.data + }) + }) + .catch(err => { + + }) + }, + formatDate(date) { + if (date.length > 0) { + return date.slice(0, 11) + } else { + return '' + } + }, + //获取菜单状态 + getMenuState() { + var _self = this + app.http.get(app.urls.getMenuState, { + header: { + token: app.globalData.token + } + }) + .then(res => { + _self.setData({ + isOpen: res.data + }) + }) + .catch(err => { + + }) + }, + //获取菜单 + getItemList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMenuList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + var data = res.data + wx.stopPullDownRefresh({}) + wx.hideLoading({}) + var is = true + data.forEach(it => { + it.configColumnList.sort((a, b) => a.configColumnGroupOrder - b.configColumnGroupOrder) + if (it.configColumnGroupName == '创建名片') { + is = false + } + }) + _self.setData({ + menuList: data, + isShow: is + }) + }) + .catch(err => { + console.log(err) + wx.stopPullDownRefresh({}) + wx.hideLoading({}) + }) + }, + checkPermission() { + var _self = this + try { + var names = wx.getStorageSync('name') + var icon = wx.getStorageSync('userIcon') + if (names) { + this.setData({ + name: names, + userIcon: icon + }) + } else { + wx.showModal({ + title: '提示', + content: '小程序需要您微信头像以及昵称用于展示,请授权.', + showCancel: false, + success(res) { + console.log(res) + if (res.confirm) { + // _self.getUserProfile(3) + } + } + }) + } + } catch (error) { + wx.showToast({ + title: '获取信息失败', + icon: 'error' + }) + } + }, + getUserProfile(e) { + let _self = this + wx.getUserProfile({ + desc: '获取微信头像以及昵称用于展示', + success: (res) => { + wx.setStorage({ + data: res.userInfo.nickName, + key: 'name', + }) + wx.setStorage({ + data: res.userInfo.avatarUrl, + key: 'userIcon', + }) + _self.setData({ + name: res.userInfo.nickName, + userIcon: res.userInfo.avatarUrl + }) + }, + fail(err) { + //判断是否绑定手机号 + wx.showToast({ + title: '获取个人信息失败', + icon: 'error', + }) + } + }) + }, + addShop() { + wx.navigateTo({ + url: '../shop/addshop', + }) + }, + onShow() { + var name = wx.getStorageSync('name') + var userIcon = wx.getStorageSync('userIcon') + var isBind = wx.getStorageSync('bindPhone') + if (name) { + this.setData({ + name: name, + userIcon: userIcon, + isBindPhone: isBind == 0 + }) + } + // this.getMenuState() + this.getItemList() + this.getPayState() + this.getAccountInfo() + }, + //item 状态 1 待付款 2待发货 3待收货 4售后/退款 + showOrder(e) { + var item = e.currentTarget.dataset.item + console.log(item) + var path = '/pages/mine/order/orderlist?status=' + item + wx.navigateTo({ + url: path, + }) + }, + choosePage(e) { + // 栏目列表页跳转方式1:小程序页面,2:其他小程序,3:网址 + var path = e.currentTarget.dataset.path + var type = e.currentTarget.dataset.type + var item = e.currentTarget.dataset.item + switch (type) { + case '1': //跳转小程序内部 + case '3': //链接 + wx.navigateTo({ + url: path + '?id=' + item.configColumnId + '&mode=' + item.configTableMode + '&type=' + item.configColumnType + '&title=' + item.configColumnName + }) + break + case '2': //其他小程序 + wx.navigateToMiniProgram({ + appId: '', + success(res) { + // 打开成功 + } + }) + break + } + }, + onPullDownRefresh() { + this.getItemList() + this.getPayState() + this.getAccountInfo() + this.getBaseInfo() + }, + getBaseInfo() { + var _self = this + app.http.get(app.urls.getMainMoment.format({ + configColumnId: 'de7b5e22-64f9-4c60-a1f9-6ac004dfb9a8' + }), { + header: { + token: app.globalData.token + }, + data: { + userId: _self.data.userId + } + }) + .then(res => { + if (res.data.length > 0) { + res.data[0].list.forEach(it => { + switch (it.name) { + case 'cardtitle': + wx.setStorageSync('cardtitle', it.value) + break + case 'postertitle': + wx.setStorageSync('postertitle', it.value) + break + } + }) + } else {} + }) + .catch(err => {}) + }, + //跳转到二级栏目页面 + goColumnList(e) { + var item = e.currentTarget.dataset.item + // 1小程序 . 2其他小程序 . 3网址 . 4栏目列表 + if (item.configColumnGroupTargetMode == '1') { + //小程序 + wx.navigateTo({ + url: item.configColumnGroupTargetUrl, + }) + } else if (item.configColumnGroupTargetMode == '2') { + //其他小程序 + } else if (item.configColumnGroupTargetMode == '3') { + //url + } else { + //二级列表 + wx.navigateTo({ + url: '../columnlist/columnlist?id=' + item.configColumnGroupId + '&title=' + item.configColumnGroupName, + }) + } + + }, + // 跳转到 我的名片 + goMyCard: function () { + wx.navigateTo({ + url: '../myCard/myCard', + }) + }, + //跳转设置页面 + showSetting() { + wx.navigateTo({ + url: '../../mine/setting/columnsetting' + }) + }, + imgHeight(e) { + var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度 + var imgh = e.detail.height; //图片高度 + var imgw = e.detail.width; //图片宽度 + var swiperH = winWid * imgh / imgw * 0.88 + "px" + + this.setData({ + Height: swiperH //设置高度 + }) + }, + //引导跳转 + toFunction(e) { + var _self = this + var path = '' + _self.data.menuList.forEach(it => { + //判断引导 + if (it.configColumnGroupDirection == '3') { + //引导 + path = it.configColumnGroupTargetUrl + } + }) + wx.navigateTo({ + url: path, + }) + }, + //获取手机号进行绑定 + getPhoneNumber(e) { + var _self = this + var iv = e.detail.iv + var encryptedData = e.detail.encryptedData + if (encryptedData) { + wx.showLoading({ + title: '绑定中...', + }) + app.http.put(app.urls.doUpdatePhone, { + header: { + token: app.globalData.token + }, + data: { + iv: iv, + encryptedData: encryptedData + } + }) + .then(res => { + wx.hideLoading({}) + //保存绑定状态 + wx.setStorageSync('token', res.data.data) + wx.setStorageSync('bindPhone', 1) + _self.setData({ + isBindPhone: true + }) + app.globalData.token = token + wx.showToast({ + title: '绑定成功', + success(e) { + wx.navigateTo({ + url: '/packagecard/cardList/cardList', + }) + } + }) + }) + .catch(err => {}) + } + }, + //复制邀请码 + copyCode() { + var _self = this + if (_self.data.code != '') { + wx.setClipboardData({ + data: _self.data.code, + success: function () {} + }) + } else { + wx.showToast({ + title: '无邀请码', + icon: 'error' + }) + } + }, + //营销资讯 + toInformation() { + wx.navigateTo({ + url: '/packagecard/marketing/marketinginfo', + }) + }, + //营销海报 + toReport() { + wx.navigateTo({ + url: '/packagecard/marketing/marketingposter', + }) + }, + //收益统计 + toStatistics() { + wx.navigateTo({ + url: '/pages/mine/income/incomelist', + }) + }, + //会员中心 + vipCenter() { + wx.navigateTo({ + url: '/pages/mine/vip/vipcenter', + }) + }, + //扫码 + toScan() { + wx.scanCode({ + success(res) { + + } + }) + }, + //订单页面跳转 + showOrder(e) { + var type = e.currentTarget.dataset.type + // 0待付款 1待发货 2待收货 3全部 + wx.navigateTo({ + url: '/pages/mine/order/orderlist?status=' + type, + }) + }, + doCash(e) { + wx.navigateTo({ + url: '/packagecard/purse/takecash', + }) + } +}) \ No newline at end of file diff --git a/pages/mine/index/index.json b/pages/mine/index/index.json new file mode 100755 index 0000000..69b19d4 --- /dev/null +++ b/pages/mine/index/index.json @@ -0,0 +1,4 @@ +{ + "enablePullDownRefresh": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/index/index.wxml b/pages/mine/index/index.wxml new file mode 100755 index 0000000..320f2ab --- /dev/null +++ b/pages/mine/index/index.wxml @@ -0,0 +1,217 @@ + + + + + + + 会员中心 + + + + {{payState.cardChargeEnd=='' ? '去开通会员':'会员已到期'}} + + + {{'到期时间:'+payState.cardChargeEnd}} + + + + + + + + + + + 待付款 + + + + 待发货 + + + + 待收货 + + + + 全部 + + + + + + + 边玩边赚 + + + 收益统计 + + + + + + + + {{accountInfo.dayMoney/100}} + + + 今日预估 + + + + + {{accountInfo.monthMoney/100}} + + + 本月预估 + + + + + ¥ + {{accountInfo.sysMoney/100}} + + + 累计收益 + + + + + + + + + + 钱包 + + + + ¥{{accountInfo.accountMoney/100}} + 余额 + + + + + 去提现 + + + + + + + + + + + 智能营销 + + + + + + + 营销资讯 + + + + + + 营销海报 + + + + + + + + + + + + + + {{group.configColumnGroupName}} + + + + + + + {{item.configColumnName}} + + + + + + + + + {{group.configColumnGroupName}} + {{group.configColumnGroupRemark}} + + + + + + + + + {{group.configColumnGroupName}} + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/index/index.wxss b/pages/mine/index/index.wxss new file mode 100755 index 0000000..02cfdb6 --- /dev/null +++ b/pages/mine/index/index.wxss @@ -0,0 +1,452 @@ +/* pages/mine/index/index.wxss */ + +.UCenter-bg { + height: 400rpx; + display: flex; + justify-content: center; + overflow: hidden; + position: relative; + flex-direction: column; + align-items: flex-start; + color: #fff; + font-weight: 300; + top: 0; + /* text-shadow: 0 0 3px rgba(0, 0, 0, 0.3); */ + width: 100%; +} + +.UCenter-bg .user-info { + width: 85%; + height: 200rpx; + position: absolute; + align-self: center; + display: flex; + flex-direction: row; + align-items: center; +} + +.user-info .user-icon { + width: 136rpx; + height: 136rpx; + border-radius: 50%; +} + +.vip-box { + position: absolute; + top: 300rpx; + left: 80rpx; + color: #fff; +} + +.vip-box .title { + font-size: 32rpx; + font-weight: bold; +} + +.vip-box .msg { + font-size: 28rpx; +} + +.sign-txt { + position: absolute; + top: 280rpx; + width: 80%; + align-self: center; + display: flex; + color: white; + font-size: 28rpx; + font-weight: bold; +} + +.user-content { + display: flex; + flex-direction: column; + justify-content: space-between; + margin: 30rpx; +} + +.user-content .title { + font-size: 38rpx; + color: #fff; + font-weight: bold; + margin-bottom: 15rpx; +} + + +.user-content .des { + font-size: 32rpx; + margin-top: 15rpx; + color: #fff; +} + +.UCenter-bg image { + width: 100%; + height: 400px; +} + +.UCenter-bg .icon { + width: 48rpx; + height: 48rpx; + +} + +.UCenter-bg .icons { + z-index: 10; + position: absolute; + right: 15rpx; +} + +.scroll-content { + width: 100%; + display: flex; + flex-direction: column; + z-index: 99; + min-height: 300rpx; +} + +.UCenter-bg .gif-wave { + position: absolute; + width: 100%; + bottom: 0; + left: 0; + z-index: 99; + mix-blend-mode: screen; + height: 100rpx; +} + +map, +.mapBox { + left: 0; + z-index: 99; + mix-blend-mode: screen; + height: 100rpx; +} + +map, +.mapBox { + width: 750rpx; + height: 300rpx; +} + +.play-box { + display: flex; + margin-left: 20rpx; + flex-direction: column; + width: 80%; + background-color: white; + border-radius: 15rpx; + align-items: center; + justify-content: center; + padding: 10rpx 0rpx; + box-shadow: 10px 10px 5px #cacaca; +} + +.play-box image { + width: 60rpx; + height: 60rpx; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #E6B980; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.order-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + margin: 15rpx; + padding: 15rpx; + background-color: #fff; +} + +.order-item { + width: 128rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} + +.order-item image { + width: 64rpx; + height: 64rpx; +} + +.order-item text { + margin-top: 15rpx; +} + +.purse-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + background-color: #fff; + margin: 0rpx 15rpx 15rpx 15rpx; + padding: 15rpx; +} + +.purse-title { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; +} + +.purse-title .title { + font-size: 32rpx; + color: #000; +} + +.purse-title .hint { + font-size: 28rpx; + color: #5f5f5f; +} + +.purse-content-box { + display: flex; + flex-direction: row; + width: 100%; + font-size: 28rpx; + color: #000; + align-items: center; + justify-content: space-around; +} + +.purse-content-box .item { + display: flex; + flex-direction: column; + width: 100%; + font-size: 28rpx; + color: #000; + align-items: center; + justify-content: center; +} + +.purse-content-box .item:nth-child(2) { + border-left: 1rpx solid #dfdfdf; + border-right: 1rpx solid #dfdfdf; +} + +.marketing-box { + display: flex; + flex-direction: row; + width: 100%; + font-size: 28rpx; + color: #000; + align-items: center; + justify-content: space-around; + margin-top: 15rpx; +} + +.marketing-box .item { + display: flex; + flex-direction: row; + width: 100%; + font-size: 28rpx; + color: #000; + align-items: center; + justify-content: center; + background-color: #f5f5f5; + border-radius: 10rpx; +} + +.marketing-box .item:active { + color: #000; + background-color: #fcfcfc; +} + +.marketing-box .item:nth-child(2) { + margin-left: 15rpx; +} + +.price { + font-size: 32rpx; + color: #000; + line-height: 64rpx; + height: 64rpx; + text-align: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 180rpx; +} + +.img-48 { + width: 48rpx; + height: 48rpx; +} + +.money-box { + display: flex; + flex-direction: row; + justify-content: space-around; + align-items: center; + width: 66%; + background-color: #f5f5f5; +} + +.moeny-box-2 { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: 33%; + height: 145rpx; +} + +.money-box .item { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + height: 145rpx; + z-index: 2; + padding: 15rpx; +} + +.img-bg-128 { + position: absolute; + height: 145rpx; + width: 33%; +} + +.item-white { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + height: 145rpx; + padding: 15rpx; + z-index: 2; + color: #fff; + font-size: 28rpx; +} + +.money-box .item image { + width: 64rpx; + height: 64rpx; +} + +.bg-box { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-around; + width: 100%; + background-color: #f5f5f5; + border-radius: 10rpx; + margin-top: 15rpx; +} + +.img-64 { + width: 64rpx; + height: 64rpx; +} + +.text-28 { + font-size: 28rpx; + color: #000; + margin-top: 15rpx; +} + +.creat-card image { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.item-box { + display: flex; + flex-direction: row; + width: 100%; + align-items: center; + height: 128rpx; + background-color: #ffffff; + padding: 15rpx; +} + +.item-img { + width: 96rpx; + height: 96rpx; +} + +.item-content { + display: flex; + flex-direction: column; + justify-content: center; + min-height: 128rpx; + padding: 15rpx; + width: 80%; +} + +.group-box { + margin: 5rpx 15rpx 0rpx 15rpx; + background-color: #ffffff; +} + +.group-box:nth-child(1) { + margin: 0rpx 15rpx 0rpx 15rpx; +} + +.ver-box { + display: flex; + flex-direction: column; +} + +.ver-box-title { + font-size: 32rpx; + color: black; + font-weight: bold; + padding: 15rpx 15rpx 0rpx 15rpx; +} + +.ver-box-list { + display: flex; + flex-direction: row; + padding-left: 15rpx; + align-items: flex-start; + justify-content: flex-start; +} + +.ver-box-items { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + margin: 15rpx 15rpx 15rpx 15rpx; +} + +.ver-box-items text { + margin-top: 15rpx; + font-size: 24rpx; + max-width: 96rpx; +} + +.ver-box-items:nth-child(1) { + margin: 15rpx 15rpx 15rpx 0rpx; +} + +.ver-box-items image { + /* align-self: flex-start; */ + height: 96rpx; + width: 96rpx; + border-radius: 10rpx; +} \ No newline at end of file diff --git a/pages/mine/manage/addposition.js b/pages/mine/manage/addposition.js new file mode 100755 index 0000000..89235a9 --- /dev/null +++ b/pages/mine/manage/addposition.js @@ -0,0 +1,88 @@ +//职位添加 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', //店铺ID + positionName: '', //名称 + positionOrder: 0, //排序 + positionSummary: '' //职位描述 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + checkParams() { + if (this.data.positionName == '') { + wx.showToast({ + title: '请输入职位名称', + icon: "none" + }) + return false + } + if (this.data.positionOrder == 0) { + wx.showToast({ + title: '请输入职位排序', + }) + return false + } + return true + }, + addPosition() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '添加中...', + }) + app.http.post(app.urls.doSavePosition, { + header: { + token: app.globalData.token + }, + data: { + shopId: _self.data.curShopId, + positionName: _self.data.positionName, + positionSummary: _self.data.positionSummary, + positionOrder: _self.data.positionOrder + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + success: function () { + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddSuccess: true + }) + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + textareaBInput(e) { + this.setData({ + positionSummary: e.detail.value + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/addposition.json b/pages/mine/manage/addposition.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/addposition.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/addposition.wxml b/pages/mine/manage/addposition.wxml new file mode 100755 index 0000000..6ecd634 --- /dev/null +++ b/pages/mine/manage/addposition.wxml @@ -0,0 +1,39 @@ + + + 添加职位 + + +
+ + + + 名称 + + + + + + + 排序 + + + + + + + + 职位描述 + + + + + + + + +
+ + + +
\ No newline at end of file diff --git a/pages/mine/manage/addposition.wxss b/pages/mine/manage/addposition.wxss new file mode 100755 index 0000000..292344d --- /dev/null +++ b/pages/mine/manage/addposition.wxss @@ -0,0 +1 @@ +/* pages/mine/manage/addposition.wxss */ \ No newline at end of file diff --git a/pages/mine/manage/shopmember.js b/pages/mine/manage/shopmember.js new file mode 100755 index 0000000..0d6343e --- /dev/null +++ b/pages/mine/manage/shopmember.js @@ -0,0 +1,108 @@ +//店铺会员管理页面 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', + currentPage: 1, + memberList: [], + refresherTriggered: false, + isCellOpen: false, + }, + onOpen() { + this.setData({ + isCellOpen: true + }) + }, + onClose(event) { + let _self = this + const { + position, + instance + } = event.detail; + switch (position) { + case 'right': + case 'cell': + instance.close(); + _self.setData({ + isCellOpen: false + }) + break; + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getMemberList(this.data.curShopId) + }, + getMemberList(id) { + console.log(app) + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMemberList.format({ + shopId: id + }), { + header: { + token: app.globalData.token + }, + data: { + shopId: id + } + }) + .then(res => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + _self.setData({ + memberList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + }) + }, + showMemberDetail(e) { + console.log(e) + }, + //删除会员 + doDelMember(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该会员吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelMember.format({ + ids: e.currentTarget.dataset.key.memberId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.getMemberList(_self.data.curShopId) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/shopmember.json b/pages/mine/manage/shopmember.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopmember.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopmember.wxml b/pages/mine/manage/shopmember.wxml new file mode 100755 index 0000000..8a67aa3 --- /dev/null +++ b/pages/mine/manage/shopmember.wxml @@ -0,0 +1,32 @@ + + 店铺会员 + + + + + + + + {{item.userName.length>0 ? item.userName:'未录入'}} + + + 等级:{{item.memberLevel}} + + + + + + + + + 删除 + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopmember.wxss b/pages/mine/manage/shopmember.wxss new file mode 100755 index 0000000..1aa5056 --- /dev/null +++ b/pages/mine/manage/shopmember.wxss @@ -0,0 +1 @@ +/* pages/mine/staff/shopmember.wxss */ \ No newline at end of file diff --git a/pages/mine/manage/shopposition.js b/pages/mine/manage/shopposition.js new file mode 100755 index 0000000..1577896 --- /dev/null +++ b/pages/mine/manage/shopposition.js @@ -0,0 +1,110 @@ +// pages/mine/manage/shopposition.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + positionList: [], + currentPage: 1, + curShopId: '', + isAddSuccess: false, + isRefreshing: false + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getPositionList(options.shopId) + }, + getPositionList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPositionList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + positionList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + toAddPosition() { + wx.navigateTo({ + url: './addposition?shopId=' + this.data.curShopId, + }) + }, + doDelPositon(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该职位吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelPositon.format({ + ids: e.currentTarget.dataset.item.positionId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.dorefreshList() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isRefreshing: true + }) + this.getPositionList(this.data.curShopId) + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let _self = this + if (_self.data.isAddSuccess) { + _self.setData({ + isAddSuccess: false + }) + //刷新页面 + this.dorefreshList() + } + }, + +}) \ No newline at end of file diff --git a/pages/mine/manage/shopposition.json b/pages/mine/manage/shopposition.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopposition.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopposition.wxml b/pages/mine/manage/shopposition.wxml new file mode 100755 index 0000000..283156e --- /dev/null +++ b/pages/mine/manage/shopposition.wxml @@ -0,0 +1,35 @@ + + + 店铺职位 + + + + + {{item.positionOrder}} + + + {{item.positionName}} + + + + {{item.positionSummary.length>0 ? item.positionSummary :'未录入' }} + + + + + 删除 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopposition.wxss b/pages/mine/manage/shopposition.wxss new file mode 100755 index 0000000..f7d7126 --- /dev/null +++ b/pages/mine/manage/shopposition.wxss @@ -0,0 +1,6 @@ +/* pages/mine/manage/shopposition.wxss */ +.cut { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.js b/pages/mine/manage/shopstaff.js new file mode 100755 index 0000000..28c8795 --- /dev/null +++ b/pages/mine/manage/shopstaff.js @@ -0,0 +1,125 @@ +// pages/mine/staff/shopstaff.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + curShopId: '', + shopStaffList: [], + currentPage: 1, + isCellOpen: false, + isRefreshing: false + }, + onOpen() { + this.setData({ + isCellOpen: true + }) + }, + onClose(event) { + let _self = this + const { + position, + instance + } = event.detail; + switch (position) { + case 'right': + case 'cell': + instance.close(); + _self.setData({ + isCellOpen: false + }) + break; + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + curShopId: options.shopId + }) + this.getStaffList(this.data.curShopId) + }, + //获取店铺员工列表 + getStaffList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getStaffList.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + shopStaffList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + + }, + //审核员工 + doVerify(e) { + + }, + //删除员工 + doDelItem(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该职员吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.delStaff.format({ + ids: e.currentTarget.dataset.key.staffId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + }) + _self.dorefreshList() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + showStaffDetail(e) { + if (!this.data.isCellOpen) { + console.log(e) + } + }, + //修改员工信息 + doEditItem(e) { + console.log(e) + }, + + dorefreshList() { + this.setData({ + currentPage: 1, + isRefreshing: true + }) + this.getStaffList(this.data.curShopId) + }, +}) \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.json b/pages/mine/manage/shopstaff.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/manage/shopstaff.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.wxml b/pages/mine/manage/shopstaff.wxml new file mode 100755 index 0000000..2c08006 --- /dev/null +++ b/pages/mine/manage/shopstaff.wxml @@ -0,0 +1,65 @@ + + + 店铺职工 + + + + + + + + + {{item.userName.length>0 ? item.userName:'未录入'}} + + + {{item.positionName.length>0? item.positionName :'未录入'}} + + + + + 审核 + + + + {{item.isLeader==1 ? '(领导)':''}}管理员 + + + + {{item.isLeader==1 ? '领导':'职工'}} + + + + + 不通过 + + + + + + + + + 删除 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/manage/shopstaff.wxss b/pages/mine/manage/shopstaff.wxss new file mode 100755 index 0000000..9565511 --- /dev/null +++ b/pages/mine/manage/shopstaff.wxss @@ -0,0 +1 @@ +/* pages/mine/staff/shopstaff.wxss */ \ No newline at end of file diff --git a/pages/mine/myCard/myCard.js b/pages/mine/myCard/myCard.js new file mode 100755 index 0000000..9fcc858 --- /dev/null +++ b/pages/mine/myCard/myCard.js @@ -0,0 +1,288 @@ +const app = getApp() +// pages/list/list.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + imgUrl: app.urls.baseImgUrl, + cardList: [], + otherCardList: [], + historyList: [], + tab: 0, + oldArr: [], + token: '', + page: { + rows: 10, + page: 1 + }, + topHeight: app.globalData.CustomBar, + isRefresh: false, + isDelPage: false, + // 我的名片 + // 他人名片 + // 浏览历史 + tabList: [{ + name: '我的名片' + }, { + name: '他人名片' + }, { + name: '浏览历史' + }] + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + token: app.globalData.token + }) + this.getList() + }, + + onShow: function () { + if (this.data.isRefresh) { + this.setData({ + isRefresh: false + }) + wx.startPullDownRefresh({}) + } + }, + // 我的名片列表 + getList: function () { + var self = this + wx.showLoading({ + title: '加载中...', + }) + wx.showNavigationBarLoading() + app.http.get(app.urls.getMyCard, { + header: { + token: self.data.token + }, + data: {} + }).then(res => { + wx.hideLoading({}) + self.setData({ + cardList: res.data + }) + if (res.data.length > 0) { + if (self.data.isDelPage) { + self.setData({ + isDelPage: false + }) + self.setDefaultCard(res.data[0].cardTemplateUseId) + //设置第一条为主名片 + } + } + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }).catch(res => { + wx.hideLoading({}) + wx.hideNavigationBarLoading() //完成停止加载 + wx.stopPullDownRefresh() //停止下拉刷新 + }) + }, + // 查看详情 + goDetail: function (e) { + var id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '../myCardDetail/myCardDetail?id=' + id + }) + }, + // 获取他人名片列表 + getOtherCard: function () { + wx.showLoading({ + title: '加载中...', + }) + var self = this + app.http.get(app.urls.otherCardList, { + header: { + token: self.data.token + }, + data: {} + }).then(res => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + var curArr + if (res.data.rows.length > 0) { + curArr = self.data.otherCardList.concat(res.data.rows) + self.setData({ + otherCardList: curArr + }) + } else { + self.setData({ + [page.page]: self.data.page.page - 1 + }) + } + }) + .catch(err => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + }) + }, + getHistory() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getBrowseHistoryList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + var curArr + if (res.data.rows.length > 0) { + curArr = _self.data.historyList.concat(res.data.rows) + _self.setData({ + historyList: curArr + }) + } else { + let key = `_self.data.page.page` + _self.setData({ + [key]: _self.data.page.page - 1 + }) + } + }) + .catch(err => { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + console.log(err) + }) + }, + // 切换 + changeTab(e) { + var cur = e.detail.index + if (this.data.tab != cur) { + this.setData({ + tab: cur + }) + if (cur == 0) { + this.setData({ + cardList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getList() + } else if (cur == 1) { + this.setData({ + otherCardList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getOtherCard() + } else if (cur == 2) { + this.setData({ + historyList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getHistory() + } + } + }, + // 名片置顶 + toggleTop: function (e) { + var self = this + var bagId = e.currentTarget.dataset.bag + var isTop = e.currentTarget.dataset.top + if (isTop == '0') { + isTop = true + } else { + isTop = false + } + app.http.put(app.urls.setTop.format({ + cardTemplateUseBagId: bagId, + cardTemplateUseTop: isTop + }), { + header: { + token: app.globalData.token + }, + data: {} + }).then(res => { + console.log(res.data) + wx.showToast({ + title: '设置成功!', + }) + self.setData({ + otherCardList: [] + }) + self.getOtherCard() + }) + }, + + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + if (this.data.tab == '0') { + this.setData({ + cardList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getList() + } else if (this.data.tab == '1') { + this.setData({ + otherCardList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getOtherCard() + } else if (this.data.tab == '2') { + this.setData({ + historyList: [], + page: { + rows: 10, + page: 1 + } + }) + this.getHistory() + } + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + var self = this + if (this.data.tab == 1) { + this.setData({ + [page.page]: self.data.page.page++ + }) + this.getOtherCard() + } + }, + showCard(e) { + wx.navigateTo({ + url: '../otherCard/othercarddetail?cardTemplateUseId=' + e.currentTarget.dataset.id, + }) + }, + setDefaultCard(id) { + var self = this + app.http.put(app.urls.setDefaultCard.format({ + cardTemplateUseId: id + }), { + header: { + token: self.data.token + } + }).then(res => { + wx.startPullDownRefresh({}) + }).catch(res => {}) + }, +}) \ No newline at end of file diff --git a/pages/mine/myCard/myCard.json b/pages/mine/myCard/myCard.json new file mode 100755 index 0000000..7360326 --- /dev/null +++ b/pages/mine/myCard/myCard.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/mine/myCard/myCard.wxml b/pages/mine/myCard/myCard.wxml new file mode 100755 index 0000000..180aba4 --- /dev/null +++ b/pages/mine/myCard/myCard.wxml @@ -0,0 +1,88 @@ + + 我的名片 + + + + + + + + + + + + + + + + + 主名片 + + + + + + + + + + + + + + + + + 取消置顶 + 置顶 + + + + + + + + + + + + + + + + + + 置顶 + + + + + + + {{list.creatorName}} + + + 浏览时间:{{list.gmtCreate}} + + + + + + + + \ No newline at end of file diff --git a/pages/mine/myCard/myCard.wxss b/pages/mine/myCard/myCard.wxss new file mode 100755 index 0000000..01948d0 --- /dev/null +++ b/pages/mine/myCard/myCard.wxss @@ -0,0 +1,146 @@ +.list { + margin-top: 80rpx; + z-index: 1; + position: relative; + padding: 15rpx; +} + +.card { + box-shadow: 0 0 20rpx #EEE; + padding: 15rpx; + margin: 0rpx 0rpx 15rpx 0rpx; + border-radius: 10rpx; +} + +.card-container { + position: relative; + height: 0; +} + +.card-img { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; +} + +.card-img image { + width: 100%; + height: 100%; +} + +.card-name { + font-size: 36rpx; +} + +.card-name-sm { + font-size: 25rpx; + align-items: center; + margin-top: 15rpx; +} + +.main { + position: absolute; + top: -15rpx; + right: -15rpx; + background: #E6B980; + color: #fff; + padding: 5rpx 15rpx; + z-index: 10; + border-top-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + opacity: 0.8; +} + +.main-red { + position: absolute; + top: -15rpx; + right: -15rpx; + background: #ff0000; + color: #fff; + padding: 5rpx 15rpx; + z-index: 10; + border-top-left-radius: 20rpx; + border-bottom-right-radius: 20rpx; + opacity: 0.5; +} + +.tab { + position: fixed; + left: 0; + right: 0; + background: #fff; + display: flex; + height: 80rpx; + z-index: 100; +} + +.tab-box { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + font-size: 32rpx; + color: #000; +} + +.tab-box.active { + color: #E6B980; + border-bottom: 2px solid #E6B980; + box-sizing: border-box; +} + +.card { + width: 100%; + box-sizing: border-box; + background: #fff; + z-index: 100; + position: relative; + /* text-align: center; */ +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.area-box { + white-space: nowrap; +} + +.card-name { + font-size: 36rpx; +} + +.other-card { + display: flex; + justify-content: space-between; +} + +.card-img-box { + display: flex; + flex-direction: row; + align-items: center; + margin-right: 40rpx; +} + +.card-img-box image { + width: 200rpx; + height: 200rpx; +} + +.set-top { + background: #E6B980; + color: white; + padding: 0rpx 15rpx; + border-radius: 5rpx; +} + +.set-top:active { + background: #f5f5f5; + color: #000; +} \ No newline at end of file diff --git a/pages/mine/myCardDetail/myCardDetail.js b/pages/mine/myCardDetail/myCardDetail.js new file mode 100755 index 0000000..3ee8ece --- /dev/null +++ b/pages/mine/myCardDetail/myCardDetail.js @@ -0,0 +1,417 @@ +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + preview: '', + showHide: false, + isLoading: false, + isMain: '', + cardPersonId: '', + choose_index: 0, + active: 0, + cardUrl: app.urls.baseImgUrl, + areaList: [], + cardInfo: {}, + bgImg: '', + fontFamilyList: [], + useFontFamily: '', + cardId: '', + cardHeight: '', + shareTicket: '', + encryptedData: '', + iv: '', + isFromOut: false, + token: '', + oldToken: '', + imgTempSrc: '', + currentIndex: 0, + windowWidth: app.globalData.windowWidth + }, + // 删除名片 + deleteCard: function () { + var self = this + wx.showModal({ + cancelColor: '#000', + title: '提示', + content: '确认删除该名片?', + success: function (res) { + if (res.confirm) { + app.http.delete(app.urls.deleteCard.format({ + ids: self.data.cardId + }), { + header: { + token: self.data.token + } + }).then(res => { + if (res.statusCode == '200') { + wx.showToast({ + title: '删除成功', + icon: 'success', + success() { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + var isDel = self.data.cardInfo.cardTemplateUseDefault == '1' + lastPage.setData({ + isRefresh: true, + isDelPage: isDel + }) + wx.navigateBack({}) + } + }) + } + }).catch(res => { + + }) + } + } + }) + + }, + // 更新名片信息 + updateCard: function (e) { + var self = this + var area = [] + for (let i = 0; i < self.data.areaList.length; i++) { + var info = { + cardTemplateUseId: self.data.areaList[i].cardTemplateUseId, + cardTemplateUseAreaId: self.data.areaList[i].cardTemplateUseAreaId, + templateAreaFile: self.data.areaList[i].templateAreaFile, + templateAreaFontValue: self.data.areaList[i].templateAreaFontValue + } + area.push(info) + } + + var postInfo = { + cardTemplateUseAreaList: area, + cardTemplateUseDefault: self.data.cardInfo.cardTemplateUseDefault, + cardTemplateUsePassword: self.data.cardInfo.cardTemplateUsePassword, + cardTemplateUseSwitch: self.data.cardInfo.cardTemplateUseSwitch, + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId + } + app.http.put(app.urls.updateMyCard.format({ + cardTemplateUseId: self.data.cardId + }), { + header: { + token: app.globalData.token + }, + data: postInfo + }).then(res => { + if (res.statusCode == '200') { + wx.showToast({ + title: '修改成功', + icon: 'success', + success() { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isRefresh: true + }) + wx.navigateBack({}) + } + }) + } + }) + .catch(err => { + + }) + }, + onShow(e) { + if (this.data.imgTempSrc != '') { + this.doUploadImg(this.data.imgTempSrc) + } + }, + //输入框失去焦点 + inputBlur(e) { + var _self = this + // templateAreaFontLength + var value = e.detail.value + var index = e.currentTarget.dataset.num + var item = e.currentTarget.dataset.item + //计算限制长度 + //最大长度 + var maxLength = item.templateAreaFontLength + if (value != '' && maxLength > 0) { + value = value.substr(0, maxLength) + //重新设置 + _self.data.areaList[index].templateAreaFontValue = value + _self.data.areaList[index].focus = false + _self.setData({ + areaList: _self.data.areaList + }) + } + //生成二维码图片 + if (item.templateAreaServerLink != '1') { + _self.getFileId(index) + } + }, + // 选择图片 + choosePhoto: function (e) { + var self = this + var cur = e.currentTarget.dataset.cur + var item = e.currentTarget.dataset.item + self.setData({ + currentIndex: cur + }) + //宽高比 + var scale = item.templateAreaWidth / item.templateAreaHeight + wx.chooseImage({ + count: 1, + sourceType: ['album', 'camera'], + success: function (res) { + wx.navigateTo({ + url: '/packagecard/common/corpperimg/cropperimg?imgSrc=' + res.tempFiles[0].path + '&scale=' + scale, + }) + } + }) + }, + doUploadImg(path) { + var _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }).then(res => { + wx.hideLoading({}) + res = JSON.parse(res) + var change = 'areaList[' + _self.data.currentIndex + '].templateAreaFile' + _self.setData({ + [change]: res.data + }) + wx.showToast({ + title: '上传成功', + duration: 1500 + }) + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }).catch(res => { + _self.setData({ + imgTempSrc: '', + currentIndex: 0 + }) + }) + }, + getPhoneNumber: function (e) { + console.log(e.detail.errMsg) + console.log(e.detail.iv) + console.log(e.detail.encryptedData) + }, + // 获取名片信息 + getNameCard: function () { + var self = this; + // var queryInfo = '' + // if (self.data.fromMine) { + // queryInfo = '?cardPersonId=' + self.data.cardPersonId + // } + app.http.get(app.urls.getMyCardDetail.format({ + cardTemplateUseId: self.data.cardId + }), { + header: { + token: app.globalData.token + }, + data: {} + }).then(res => { + var area = res.data.areaList + var scale = res.data.cardTemplateUseWidth / self.data.windowWidth + console.log(scale + '===' + self.data.windowWidth) + res.data.cardTemplateUseWidth = res.data.cardTemplateUseWidth / scale + res.data.cardTemplateUseHeight = res.data.cardTemplateUseHeight / scale + for (let i = 0; i < area.length; i++) { + area[i].templateAreaFontSize = area[i].templateAreaFontSize / scale + 'px' + area[i].templateAreaHeight = area[i].templateAreaHeight / scale + area[i].templateAreaWidth = area[i].templateAreaWidth / scale + area[i].templateAreaDown = area[i].templateAreaDown / scale + area[i].templateAreaTop = area[i].templateAreaTop / scale + area[i].templateAreaRight = area[i].templateAreaRight / scale + area[i].templateAreaLeft = area[i].templateAreaLeft / scale + if (area[i].templateAreaFontCenter == '1') { + area[i].templateAreaFontCenter = 'left' + } else if (area[i].templateAreaFontCenter == '2') { + area[i].templateAreaFontCenter = 'center' + } else { + area[i].templateAreaFontCenter = 'right' + } + if (area[i].templateAreaFontBold == '0') { + area[i].templateAreaFontBold = 'normal' + } else if (area[i].templateAreaFontBold == '1') { + area[i].templateAreaFontBold = 'bold' + } else { + area[i]['templateAreaFontStyle'] = 'italic' + } + } + self.setData({ + cardInfo: res.data, + areaList: area + }) + }) + .catch(err => { + + }) + }, + // 获取名片内容区域 + getNameCradArea: function () { + var self = this; + var arr = [] + app.restAjax.get(app.restAjax.path('{cardUrl}app/cardtemplatearea/listcardtemplateareabytemplateid/' + self.data.cardId, [app.tradeUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + for (let i = 0; i < data.length; i++) { + data[i]['focus'] = false + if (data[i].templateAreaType != '1') { + arr.push(data[i]) + } else { + var font = parseInt(data[i].templateAreaFontSize.replace('px', '')) + font = Math.floor(font * 750 / wx.getSystemInfoSync().windowWidth) + 'rpx' + data[i].templateAreaFontSize = font + arr.push(data[i]) + } + } + self.setData({ + areaList: arr + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 编辑信息 + editInfo: function (e) { + var cur = e.currentTarget.dataset.num + var text = e.detail.value + var item = 'areaList[' + cur + '].templateAreaFontValue' + this.setData({ + [item]: text + }) + }, + // 点击内容区域获取input焦点 + giveFocus: function (e) { + var cur = e.currentTarget.dataset.cur + var item = 'areaList[' + cur + '].focus' + this.setData({ + [item]: true + }) + }, + // 继续创建 + continueCreate: function () { + this.setData({ + showHide: false + }) + }, + // 返回模板列表 + backList: function () { + wx.navigateBack({ + delta: 1, + }) + }, + // 获取用户信息 + getUserInfo: function () { + var self = this + app.restAjax.get(app.restAjax.path('{loginUrl}app/user/get-app-user', [app.personIntroUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + app.globalData.userInfo = data + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 非文字、图片区域换取fileid + getFileId: function (index) { + var self = this + var cur = index + var content = self.data.areaList[cur].templateAreaFontValue + var areaId = self.data.areaList[cur].picturesTemplateAreaId + app.http.get(app.urls.getFileId.format({ + picturesTemplateAreaId: areaId + }), { + header: { + token: app.globalData.token + }, + data: { + content: content + } + }).then(res => { + console.log(res.data) + var change = 'areaList[' + cur + '].templateAreaFile' + self.setData({ + [change]: res.data.data + }) + }) + .catch(err => { + + }) + }, + // 设为主名片 + setDefaultCard: function () { + var self = this + app.http.put(app.urls.setDefaultCard.format({ + cardTemplateUseId: self.data.cardId + }), { + header: { + token: self.data.token + } + }).then(res => { + console.log(res) + if (res.statusCode == '200') { + wx.showToast({ + title: '设置成功', + icon: 'success', + success() { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isRefresh: true + }) + wx.navigateBack({}) + } + }) + } + }).catch(res => { + + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var self = this + this.setData({ + cardId: options.id, + token: app.globalData.token + }) + this.getNameCard() + }, + postRecord: function (res) { + var self = this + app.restAjax.post(app.restAjax.path('{loginUrl}app/cardtemplateforwardingrecord/savecardtemplateforwardingrecord', [app.tradeUrl]), { + encryptedData: res.encryptedData, + iv: res.iv, + templateUseId: self.data.cardId, + templateFromUserId: self.data.oldToken, + templateToUserId: self.data.token + }, { + headers: { + token: self.data.token + } + }, function (code, data) { + console.log('1' + data) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + openPage() { + + }, + +}) \ No newline at end of file diff --git a/pages/mine/myCardDetail/myCardDetail.json b/pages/mine/myCardDetail/myCardDetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/myCardDetail/myCardDetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/myCardDetail/myCardDetail.wxml b/pages/mine/myCardDetail/myCardDetail.wxml new file mode 100755 index 0000000..098e1fd --- /dev/null +++ b/pages/mine/myCardDetail/myCardDetail.wxml @@ -0,0 +1,83 @@ + + 名片 + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + + + + + {{item.templateAreaFontValue}} + + + + + + + 适用行业:{{cardInfo.templateIndustryName}} + + + + + + {{item.templateAreaName}} + 最多输入{{item.templateAreaFontLength}}个字符 + + + + + + + + + + + {{item.templateAreaName}} + 最多输入1张图片 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/myCardDetail/myCardDetail.wxss b/pages/mine/myCardDetail/myCardDetail.wxss new file mode 100755 index 0000000..5ff6ab2 --- /dev/null +++ b/pages/mine/myCardDetail/myCardDetail.wxss @@ -0,0 +1,232 @@ +.card { + width: 100%; + height: 0; + position: relative; + box-sizing: border-box; + z-index: 100; + /* text-align: center; */ +} + +.card-bgImg { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.area-box { + background: none !important; + z-index: 111; +} + +.area-box image { + width: 100%; + height: 100%; +} + +.card-info { + padding-bottom: 100rpx; + width: 100%; + margin-top: 15rpx; +} + +.card-title { + font-size: 30rpx; + background: #ffffff; + width: 100%; + padding: 15rpx; +} + +.row { + display: flex; + border-bottom: 1px solid #EEE; + background: #ffffff; + border-bottom: 1rpx solid #f5f5f5; +} + +.row-ver { + display: flex; + border-bottom: 1px solid #EEE; + border-bottom: 1rpx solid #f5f5f5; + flex-direction: column; + background-color: #ffffff; + padding: 15rpx; +} + +.row-ver:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.row-ver:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.item-title { + flex: 1; + font-size: 32rpx; + line-height: 50rpx; + color: #808080; +} + +.item-title-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 7.5rpx; +} + +.item-input { + flex: 4; + box-sizing: border-box; + display: flex; + align-items: center; + margin-top: 15rpx; +} + +.item-input input { + width: 100%; + text-align: left; + height: 50rpx; + font-size: 32rpx; + color: #333; +} + +.item-input image { + max-width: 70%; + /* max-height: 120rpx; */ +} + +.item-code-input image { + max-width: 35%; + max-height: 160rpx; +} + + + + +.hide-link { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 1000; +} + +.hide { + position: absolute; + top: 50%; + left: 50%; + width: 90%; + transform: translate(-50%, -50%); + border-radius: 10rpx; + background: #fff; +} + +.hide-btn { + display: flex; + width: 49%; + height: 60rpx; + background: #1296db; + color: #fff; + font-size: 30rpx; + border-radius: 10rpx; + justify-content: center; + align-items: center; +} + +.hide-text { + font-size: 30rpx; + color: #000; +} + +.hide-btn-box { + display: flex; + justify-content: space-between; +} + +.input-box { + width: 100%; +} + +.content-box { + width: 100%; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + padding: 15rpx; +} + +.cuIcon-cameraadd { + font-size: 60rpx; +} + +.card-img-box { + display: flex; + flex-direction: row; + align-items: center; + margin-right: 40rpx; + justify-content: space-between; +} + +.card-img-box image { + width: 200rpx; + height: 200rpx; +} + +.hint-txt { + text-align: right; + color: #fd9494; + font-size: 24rpx; +} + +.share { + padding: 15rpx 15rpx; + text-align: center; + position: fixed; + bottom: 0; + left: 0; + right: 0; + background: #fff; + z-index: 1000; +} + +.share .btn { + display: inline-block; + width: 32% !important; + background: #0054bd; + color: #fff; + margin-right: 2%; + font-size: 28rpx; + font-weight: normal; + height: 70rpx; + line-height: 70rpx; + text-align: center; + border-radius: 10rpx; +} + +.share .btn:nth-child(1) { + background: coral; +} + +.share .btn:last-child { + margin-right: 0; + background: #ff2525; +} + +/* 换行 */ +.wrap-line { + overflow-wrap: break-word; +} + +/* 居中 */ +.wrap-center { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/pages/mine/order/orderdetail.js b/pages/mine/order/orderdetail.js new file mode 100755 index 0000000..40453d7 --- /dev/null +++ b/pages/mine/order/orderdetail.js @@ -0,0 +1,69 @@ +/** + * 订单详情 + */ +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + orderId: '', + shopId: '', + shopDetailBean: null, + orderList: [], + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + orderId: options.orderId, + shopId: options.shopId + }) + this.getShopDetailById(this.data.shopId) + this.getOrderDetail() + }, + //获取店铺详情 + getShopDetailById(id) { + app.http.get(app.urls.getShopDetail.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + this.setData({ + shopDetailBean: res.data + }) + }) + .catch(err => { + + }) + }, + getOrderDetail() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getOrderDetail.format({ + orderId: _self.data.orderId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setData({ + orderList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } +}) \ No newline at end of file diff --git a/pages/mine/order/orderdetail.json b/pages/mine/order/orderdetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/orderdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/orderdetail.wxml b/pages/mine/order/orderdetail.wxml new file mode 100755 index 0000000..8517b9a --- /dev/null +++ b/pages/mine/order/orderdetail.wxml @@ -0,0 +1,51 @@ + + + 订单详情 + + + + + + + + + + + + + {{shopDetailBean.shopName}} + + 店铺地址:{{shopDetailBean.shopAddress}} + + + + + + + + + + {{item.goodsName}} + + ¥{{item.goodsPrice}} + 数量:{{item.goodsCount}} + 总价:{{item.totalPrice}} + + + + + + + + + + 订单备注 + + + + + {{orderList[0].words}} + + + + \ No newline at end of file diff --git a/pages/mine/order/orderdetail.wxss b/pages/mine/order/orderdetail.wxss new file mode 100755 index 0000000..267702a --- /dev/null +++ b/pages/mine/order/orderdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/order/orderdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/order/orderlist.js b/pages/mine/order/orderlist.js new file mode 100755 index 0000000..6c7b72d --- /dev/null +++ b/pages/mine/order/orderlist.js @@ -0,0 +1,133 @@ +// pages/mine/order/orderlist.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + orderList: [], //订单列表 + waitList: [], //待付款 + marchList: [], //进行中 + completeList: [], //已完成 + tab: 0, //当前tab + currentType: '', + currentPage: 1, + totalSize: 0, + hasMore: true, + isLoadMore: false, + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + imgUrl: app.urls.baseImgUrl, + tabList: [{ + name: '待付款' + }, { + name: '待发货' + }, { + name: '待收货' + }, { + name: '全部' + }] + }, + onChange(e) { + this.setData({ + tab: e.detail.index + }) + // var cur = e.currentTarget.dataset.tab + // if (this.data.tab != cur) { + // this.setData({ + // tab: cur, + // currentType: cur, + // currentPage: 1, + // orderList: [] + // }) + // this.getOrderList() + // } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + var state = options.status + this.setData({ + tab: Number.parseInt(state) + }) + // if (state == 5) { + // this.setData({ + // currentType: '', + // tab: 4 + // }) + // } else { + // this.setData({ + // currentType: state, + // tab: state + // }) + // } + // this.getOrderList() + }, + //获取订单列表 + getOrderList() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMineOrderList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (res.data.rows.length > 0) { + _self.data.orderList = _self.data.orderList.concat(res.data.rows) + _self.setData({ + orderList: _self.data.orderList + }) + } else { + _self.setData({ + hasMore: false + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + hasMore: true, + currentPage: --_self.data.currentPage, + isLoadMore: false + }) + }) + + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getOrderList() + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + //显示订单详情 + toDetail(e) { + wx.navigateTo({ + url: './orderdetail?orderId=' + e.currentTarget.dataset.item.orderId + '&shopId=' + e.currentTarget.dataset.item.shopId, + }) + } +}) \ No newline at end of file diff --git a/pages/mine/order/orderlist.json b/pages/mine/order/orderlist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/orderlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/orderlist.wxml b/pages/mine/order/orderlist.wxml new file mode 100755 index 0000000..21d398e --- /dev/null +++ b/pages/mine/order/orderlist.wxml @@ -0,0 +1,51 @@ + + + 我的订单 + + + + + + + + + + + + + + + + + + + {{item.shopName}} + + + 下单时间:{{item.gmtCreate}} + + 订单金额: + ¥{{item.amountMoney}} + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/order/orderlist.wxss b/pages/mine/order/orderlist.wxss new file mode 100755 index 0000000..eb21286 --- /dev/null +++ b/pages/mine/order/orderlist.wxss @@ -0,0 +1,46 @@ +/* pages/mine/order/orderlist.wxss */ + .tab{ + position: fixed; + left: 0; + right: 0; + background: #fff; + display: flex; + height: 80rpx; + z-index: 100; + } + .tab-box{ + flex: 1; + display: flex; + justify-content: center; + align-items: center; + font-size: 32rpx; + color: #000; + } + .tab-box.active{ + color: #055fe6; + border-bottom: 2px solid #055fe6; + box-sizing: border-box; + } + .card{ + width: 100%; + box-sizing: border-box; + background: #fff; + z-index: 100; + position: relative; + /* text-align: center; */ + } + .card-bgImg{ + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + } + .area-box{ + white-space: nowrap; + } + .card-name{ + font-size: 36rpx; + margin: 10rpx 0; + padding: 0 20rpx; + } \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.js b/pages/mine/order/ordersuccess.js new file mode 100755 index 0000000..9ae6892 --- /dev/null +++ b/pages/mine/order/ordersuccess.js @@ -0,0 +1,72 @@ +// pages/mine/order/ordersuccess.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + totalPrice: 0, + shopId: '', + orderId: '', + hintMsg: '商品下单成功', + funcMsg: '查看订单详情', + type: 1, //1.商品订单 2.名片 + prepayId: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + totalPrice: options.price, + shopId: options.shopId, + orderId: options.orderId, + hintMsg: options.msg, + funcMsg: options.fMsg, + type: options.type, + prepayId: options.prepayId + }) + if (options.prepayId) { + this.doSaveOrderState() + } + }, + //保存订单状态 + doSaveOrderState() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.doSaveOrderPayState.format({ + cardChargeOrderNumber: _self.data.prepayId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + }) + .catch(err => { + + }) + }, + toShowOrderDetail() { + var _self = this + if (_self.data.type == 1) { + //商品订单 + wx.redirectTo({ + url: './orderdetail?shopId=' + this.data.shopId + '&orderId=' + this.data.orderId, + }) + } else if (_self.data.type == 2) { + //名片订单 + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isRefresh: true + }) + wx.navigateBack({}) + } + } +}) \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.json b/pages/mine/order/ordersuccess.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/order/ordersuccess.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.wxml b/pages/mine/order/ordersuccess.wxml new file mode 100755 index 0000000..d20d00e --- /dev/null +++ b/pages/mine/order/ordersuccess.wxml @@ -0,0 +1,12 @@ + + + 订单 + + + + {{hintMsg}} + 支付金额:¥{{totalPrice}} + + + + \ No newline at end of file diff --git a/pages/mine/order/ordersuccess.wxss b/pages/mine/order/ordersuccess.wxss new file mode 100755 index 0000000..0a56e8e --- /dev/null +++ b/pages/mine/order/ordersuccess.wxss @@ -0,0 +1 @@ +/* pages/mine/order/ordersuccess.wxss */ \ No newline at end of file diff --git a/pages/mine/otherCard/othercarddetail.js b/pages/mine/otherCard/othercarddetail.js new file mode 100755 index 0000000..e21bb7b --- /dev/null +++ b/pages/mine/otherCard/othercarddetail.js @@ -0,0 +1,713 @@ +const app = getApp() +var innerAudioContext = wx.createInnerAudioContext() +Page({ + data: { + nameTxt: '名片', + dataList: [], + curIndex: 0, //用来记录请求次数 + speedStep: 5, //快进快退秒数 + waitFlag: false, + avatarUrl: app.globalData.userInfo.avatarUrl, + areaList: [], + cardHeight: '', + cardInfo: {}, + cardUrl: app.urls.baseImgUrl, + personIntro: {}, + companyIntro: {}, + shareImg: '', + phoneTxt: '未录入', + emailTxt: '未录入', + wechateTxt: '未录入', + addressTxt: '未录入', + viewInfo: {}, + forwardCount: '', + imgUrl: app.urls.baseImgUrl, + shareRecordId: '', + isShowBarCode: false, + browUserList: [], + shareImgUrl: '', + tempUserId: '', //当前名片用户的ID + cardTemplateDispatchId: '', //用来标记是否是分享过来的 + cardTemplateUseId: '', //分享过来的名片id + isShowCard: false, //用来显示我浏览过的名片 + otherCardList: [], //卡包名片 + isPlayAudio: false, //标识当前是否在播放音乐 + audioId: '', + count: 3, + animationData: {}, + isShowBtn: false + }, + onLoad(options) { + var self = this + self.setData({ + cardTemplateUseId: options.cardTemplateUseId + }) + self.buildId() + self.getCard() + }, + // 获取名片 + getCard() { + var self = this + app.http.get(app.urls.shareCard.format({ + cardTemplateUseId: self.data.cardTemplateUseId + }), { + header: { + token: app.globalData.token + } + }).then(res => { + var area = res.data.areaList + area.forEach(it => { + if (it.templateAreaSource == 'name') { + self.setData({ + nameTxt: it.templateAreaFontValue + }) + } + }) + self.setData({ + cardInfo: res.data, + areaList: area, + dataList: [] + }) + + if (res.data) { + self.toSaveLocalImg(res.data.cardTemplateUseDispatchPhoto) //保存分享的图片 + self.getBrowCardUserList(res.data.cardTemplateUseId) //获取浏览数量 + self.setData({ + tempUserId: res.data.creator + }) + self.getMainColumn(res.data.creator) //获取当前用户的栏目 + self.getMainBaseUserInfo(res.data.creator) //获取当前人员基础信息 + } + }) + }, + //将分享的Base64图片保存至本地 + toSaveLocalImg(data) { + var _self = this + var base64 = data + var imgPath = wx.env.USER_DATA_PATH + '/index' + 'share.png' + var imageData = base64.replace(/^data:image\/\w+;base64,/, ""); + var fs = wx.getFileSystemManager(); + fs.writeFileSync(imgPath, imageData, "base64"); + this.setData({ + shareImgUrl: imgPath + }) + }, + //获取浏览当前名片的用户头像列表 + getBrowCardUserList(id) { + var _self = this + app.http.get(app.urls.getCardBrowUserList, { + header: { + token: app.globalData.token + }, + data: { + page: '1', + rows: '7', + cardTemplateUseId: id + } + }) + .then(res => { + if (res.data) { + _self.setData({ + browUserList: res.data.rows + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + //获取首页展示的栏目 + getMainColumn(id) { + console.log(id) + var _self = this + _self.setData({ + dataList: [] + }) + app.http.get(app.urls.getMainColumn, { + header: { + token: app.globalData.token + }, + data: { + creator: id + } + }) + .then(res => { + wx.showLoading({ + title: '加载中...', + }) + _self.getMainMoment(res.data, id, 0) + }) + .catch(err => { + wx.stopPullDownRefresh({}) + }) + }, + //获取首页栏目数据 + getMainMoment(datas, userid, index) { + var _self = this + var count = datas.length + if (index < count) { + app.http.get(app.urls.getMainMoment.format({ + configColumnId: datas[_self.data.curIndex].configColumnId + }), { + header: { + token: app.globalData.token + }, + data: { + userId: userid + } + }) + .then(res => { + if (res.data.length > 0) { + var tempItem = { + cId: datas[_self.data.curIndex].configColumnId, + type: datas[_self.data.curIndex].configColumnType, + name: datas[_self.data.curIndex].configColumnName, + mode: datas[_self.data.curIndex].configTableMode, + list: res.data.slice(0, datas[_self.data.curIndex].configColumnRowCount) + } + _self.data.dataList.push(tempItem) + } + _self.setData({ + curIndex: ++_self.data.curIndex + }) + _self.getMainMoment(datas, userid, _self.data.curIndex) + + }) + .catch(err => { + _self.setData({ + curIndex: ++_self.data.curIndex + }) + if (datas[_self.data.curIndex]) { + _self.getMainMoment(datas, userid, _self.data.curIndex) + } + }) + } else { + wx.hideLoading({}) + wx.stopPullDownRefresh({}) + _self.buildMainData() + } + }, + //构建主页显示数据 + buildMainData() { + var _self = this + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(iem => { + switch (iem.dataType) { + case '2': //图片 + var photoIds = iem.value.split('@') + if (photoIds.length > 1) { + //展示方式 + iem.dataMode = photoIds[1] + } else { + iem.dataMode = '1' + } + var items = photoIds[0].split(',') + var tempList = [] + items.forEach(item => { + var tempItem = { + id: item, + path: app.urls.baseImgUrl + item, + } + tempList.push(tempItem) + }) + iem.valueList = tempList + break + case '3': //音频 + var items = iem.value.split(',') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var ss = item.split('&') + var totalStr = '00:00' + if (ss.length > 1) { + var dur = ss[1] + var tM = parseInt(dur / 60) //分钟 + var tS = parseInt(dur % 60) //秒 + var totalMStr = tM > 9 ? tM : '0' + tM + var totalSStr = +tS > 9 ? tS : '0' + tS + totalStr = totalMStr + ':' + totalSStr + } + var tempItem = { + id: ss[0], //id + path: app.urls.baseImgUrl + ss[0], //地址 + isPlay: false, //是否播放中 + duration: 100000, //时长 + curDuration: 0, + curDurationStr: '00:00', + totalDurationStr: totalStr + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '4': //视频 + var items = iem.value.split(',') + var tempList = [] + for (var i = 0; i < items.length; i++) { + if (items[i].length > 0) { + var ss = items[i].split('&') + var videoUrl = app.urls.baseImgUrl + ss[0] + var imgUrl = app.urls.baseImgUrl + ss[1] + var tempItem = { + path: videoUrl, + imgPath: imgUrl + } + tempList.push(tempItem) + } + } + iem.valueList = tempList + break + case '6': + var items = iem.value.split('-') + var tempList = [] + items.forEach(item => { + if (item.length > 0) { + var latlng = item.split(',') + var tempItem = { + name: '', + address: '', + latitude: latlng[0], + longitude: latlng[1], + } + tempList.push(tempItem) + } + }) + iem.valueList = tempList + break + case '8': //单选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + iem.selValue = ss.dataName + } + }) + break + case '9': //多选 + iem.dictionariesList.forEach(ss => { + if (iem.value.indexOf(ss.dataId) != -1) { + ss.isSel = true + } else { + ss.isSel = false + } + }) + break + } + }) + }) + }) + _self.setData({ + curIndex: 0, + dataList: _self.data.dataList + }) + }, + //获取首页基础数据 电话 微信号 地址 邮箱 + getMainBaseUserInfo(userid) { + var _self = this + app.http.get(app.urls.getMainMoment.format({ + configColumnId: 'de7b5e22-64f9-4c60-a1f9-6ac004dfb9a8' + }), { + header: { + token: app.globalData.token + }, + data: { + userId: userid + } + }) + .then(res => { + if (res.data.length > 0) { + _self.setData({ + isShowBtn: true + }) + res.data[0].list.forEach(it => { + switch (it.name) { + case 'phone': + _self.setData({ + phoneTxt: it.value + }) + break + case 'wechat': + _self.setData({ + wechateTxt: it.value + }) + break + case 'email': + _self.setData({ + emailTxt: it.value + }) + break + case 'address': + _self.setData({ + addressTxt: it.value + }) + break + } + }) + } else { + _self.setData({ + isShowBtn: false + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + // 生成随机id + buildId: function () { + var chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + + var nums = ""; + + for (var i = 0; i < 36; i++) { + var id = parseInt(Math.random() * 61); + + nums += chars[id]; + } + return nums + }, + //显示详情 + showDetail(e) { + var type = e.currentTarget.dataset.ctype //需要跳详情 + if (type.indexOf('dda5007c-5fb7-48f2-8537-3cb8ea298242') != -1) { + //需要跳详情 + var cId = e.currentTarget.dataset.cid + var uId = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/packagecard/moments/momentsdetail/momentsdetail?uId=' + uId + '&cId=' + cId, + }) + } + }, + onHide(e) { + this.setData({ + isShowCard: false + }) + if (innerAudioContext) { + innerAudioContext.stop() + } + }, + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function (res) { + var self = this + wx.showShareMenu({ + withShareTicket: true, + success: function (res) { + console.log(res) + } + }) + + // if (res.from == 'button') { + var postId = self.buildId() + self.shareRecord(postId) + + var param = '/pages/index/index?cardTemplateDispatchId=' + postId; + return { + title: '您好,这是我的电子名片,请查看.', + path: param, + imageUrl: self.data.shareImgUrl + } + // return返回 title 转发标题 path 路径 imageUrl 自定义图片,可以本地路径 代码包文件路径 支持png jpg 显示长宽比5:4 + // } + }, + // 转发记录 + shareRecord: function (cardTemplateDispatchId) { + var self = this + app.http.post(app.urls.shareRecord, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateDispatchParentId: '', + cardTemplateDispatchId: cardTemplateDispatchId + } + }).then(res => { + self.setData({ + shareRecordId: res.data.data + }) + }) + }, + // 展示名片码 + showBarCode: function () { + var _self = this + wx.navigateTo({ + url: '/packagecard/sharePage/cardcode?cardImg=' + _self.data.cardInfo.cardTemplateUsePhotoUrl + '&id=' + _self.data.cardInfo.cardTemplateUseBarcode, + }) + // this.setData({ + // isShowBarCode: true + // }) + // wx.hideTabBar() + // var anim = wx.createAnimation({ + // duration: 1200, + // timingFunction: 'linear', + // transformOrigin: '50% 50% 0' + // }) + // anim.rotate(180).step() + // this.setData({ + // animationData: anim.export() + // }) + }, + // 隐藏名片码 + hideBarCode: function () { + this.setData({ + isShowBarCode: false + }) + wx.showTabBar() + }, + // 获取转发数 + getForwardCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateforwardingrecord/count', [app.cardUrl]), { + templateUseId: self.data.cardInfo.cardPersonId + }, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + forwardCount: data.data + }) + }, function (code, data) { + app.dialog.msg(data.msg); + }); + }, + // 复制文本 + copyText: function (e) { + var self = this + var text = e.currentTarget.dataset.text + if (text) { + wx.setClipboardData({ + data: text, + success: function () {} + }) + } + }, + // 加入卡包 + includedCard: function () { + var self = this + app.http.post(app.urls.includedCard, { + header: { + token: app.globalData.token + }, + data: { + cardTemplateUseBagId: "", + cardTemplateUseId: self.data.cardInfo.cardTemplateUseId, + cardTemplateUseStar: "", + cardTemplateUseTag: "", + cardTemplateUseTop: "" + } + }).then(res => { + console.log(res.data) + wx.showToast({ + title: '加入卡包成功!', + }) + }) + .catch(err => { + + }) + }, + // 拨打电话 + makeCall: function () { + var self = this + var phone = self.data.phoneTxt + if (phone) { + wx.makePhoneCall({ + phoneNumber: phone, + }) + } + }, + // 获取浏览数 + getViewCount: function () { + var self = this + app.restAjax.get(app.restAjax.path('{cardUrl}app/templateviewrecord/getByTemplateUseId/' + self.data.cardInfo.cardPersonId, [app.cardUrl]), {}, { + headers: { + token: app.globalData.token + } + }, function (code, data) { + self.setData({ + viewInfo: data + }) + }, function (code, data) { + if (data.msg) { + app.dialog.msg(data.msg); + } + }); + }, + //获取浏览当前名片的用户头像列表 + getBrowCardUserList(id) { + var _self = this + app.http.get(app.urls.getCardBrowUserList, { + header: { + token: app.globalData.token + }, + data: { + page: '1', + rows: '7', + cardTemplateUseId: id + } + }) + .then(res => { + if (res.data) { + _self.setData({ + browUserList: res.data.rows + }) + } + }) + .catch(err => { + console.log(err) + }) + }, + // 存入通讯录 + addContact: function () { + var self = this + wx.addPhoneContact({ + firstName: self.data.nameTxt, + mobilePhoneNumber: self.data.phoneNum + }) + }, + //预览图片 + viewImg(e) { + var imgs = e.currentTarget.dataset.values + var cur = e.currentTarget.dataset.url + var imgPaths = [] + imgs.forEach(it => { + imgPaths.push(it.path) + }) + wx.previewImage({ + urls: imgPaths, + current: cur + }) + }, + //预览视频 + viewVideo(e) { + var url = e.currentTarget.dataset.url + wx.previewMedia({ + sources: [{ + url: url, + type: 'video' + }], + }) + }, + play(e) { + //进行播放 + const _self = this + const index = e.currentTarget.dataset.index + const idx = e.currentTarget.dataset.idx + const ix = e.currentTarget.dataset.i + const a = e.currentTarget.dataset.a + var audio = e.currentTarget.dataset.item + console.log(_self.data.isPlayAudio) + if (_self.data.isPlayAudio) { + //有播放的 + //先需要停止其他录音文件的播放 + _self.data.dataList.forEach(it => { + it.list.forEach(item => { + item.list.forEach(ix => { + if (ix.dataType == '3') { + if (ix.valueList) { + ix.valueList.forEach(ii => { + ii.isPlay = false + ii.curDuration = 0 + ii.curDuationStr = '00:00' + }) + } + } + }) + }) + }) + _self.setData({ + dataList: _self.data.dataList + }) + innerAudioContext.stop() + if (_self.data.audioId != audio.id) { + wx.showLoading({ + title: '加载中...', + }) + setTimeout(function () { + wx.hideLoading({}) + innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3' + innerAudioContext.startTime = 0 + innerAudioContext.autoplay = true + _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: true, + audioId: audio.id + }) + }, 1500) + } + } else { + //没有播放的 + innerAudioContext.src = _self.data.dataList[index].list[idx].list[ix].valueList[a].path + '.mp3' + innerAudioContext.startTime = 0 + innerAudioContext.autoplay = true + innerAudioContext.play() + _self.data.dataList[index].list[idx].list[ix].valueList[a]['isPlay'] = true + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: true, + audioId: audio.id + }) + } + innerAudioContext.onPlay(() => { + + }); + + innerAudioContext.onCanplay((res) => {}) + innerAudioContext.onStop((res) => { + console.log('onStop===') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onEnded((res) => { + console.log(res) + console.log('播放完毕') + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onError((res) => { + console.log('播放错误') + console.log(res) + _self.data.dataList[index].list[idx].list[ix].valueList[a].isPlay = false + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDuration = 0 + _self.data.dataList[index].list[idx].list[ix].valueList[a].curDurationStr = '00:00' + _self.setData({ + dataList: _self.data.dataList, + isPlayAudio: false + }) + }) + innerAudioContext.onSeeking(() => { + // console.log(innerAudioContext.currentTime) + }) + }, + + // 跳转模板列表 + goList: function () { + wx.navigateTo({ + url: '/packagecard/cardList/cardList', + }) + }, + //显示更多栏目数据 + showMore(e) { + var item = e.currentTarget.dataset.item + if (item.mode == '2') { + var userid = e.currentTarget.dataset.userid + var idx = e.currentTarget.dataset.idx + wx.navigateTo({ + url: '/packagecard/moments/showlist/showlist?id=' + item.cId + '&userId=' + userid + '&index=' + idx, + }) + } + }, +}) \ No newline at end of file diff --git a/pages/mine/otherCard/othercarddetail.json b/pages/mine/otherCard/othercarddetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/otherCard/othercarddetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/otherCard/othercarddetail.wxml b/pages/mine/otherCard/othercarddetail.wxml new file mode 100755 index 0000000..ee10e41 --- /dev/null +++ b/pages/mine/otherCard/othercarddetail.wxml @@ -0,0 +1,359 @@ + + + + {{nameTxt}} + + + + + + + + + + + + + + + + + + + 02/ + + + 加入卡包 + + + + 03/ + + + 名片码 + + + + + + + 拨打电话 + + {{phoneTxt}} + + + + + 添加微信 + + {{wechateTxt}} + + + + + 邮箱 + + {{emailTxt}} + + + + + 地址 + + {{addressTxt}} + + + + + + + + + + + + + {{cardInfo.cardTemplateUseScansNumber >999? '999+' : + cardInfo.cardTemplateUseScansNumber}} + + + + {{cardInfo.cardTemplateUseDispatchNumber>999 ? + '999+':cardInfo.cardTemplateUseDispatchNumber}} + + + + + + + + + + + + + + + {{item.name}} + + + + 更多 + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{audio.curDurationStr}} + + {{audio.totalDurationStr}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{child.value}} + + + + + + + + + + {{child.comment}}:{{child.selValue}} + + + + + + + + + {{child.comment}} + + + + + {{ss.dataName}} + + + + + + + + + + + + + + + + + + + + 十而百智慧名片 + + + 一份信心,一份努力,一份成功;十分信心,十分努力,十分成功. + + + + + + + + + + + + 我的 + + + + + + + {{item.name}} + + + + 电话:{{item.phone}} + + + 公司:{{item.department}} + + + 地址:{{item.address}} + + + + + + + \ No newline at end of file diff --git a/pages/mine/otherCard/othercarddetail.wxss b/pages/mine/otherCard/othercarddetail.wxss new file mode 100755 index 0000000..3e7b7e8 --- /dev/null +++ b/pages/mine/otherCard/othercarddetail.wxss @@ -0,0 +1,749 @@ +.card-container { + box-sizing: border-box; +} + +.share-btn { + background: #eee; +} + +.card { + width: 100%; + box-sizing: border-box; + position: relative; + overflow: hidden; + /* text-align: center; */ +} + +.area-box { + white-space: nowrap; + word-break: break-all; + z-index: 111; +} + +.card-bgImg { + width: 100%; +} + +.person { + padding: 20rpx; +} + +.dynamic-container { + margin-top: -50rpx; + position: relative; + background-color: #fff; + padding: 20rpx; + border-radius: 20rpx; +} + +.dynamic-title image { + width: 30rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4rpx; +} + +.catelog-title { + display: flex; + position: relative; + align-items: center; + padding: 15rpx; + justify-content: space-between; +} + +.catelog-title .action { + display: flex; + align-items: center; + justify-content: center; + max-width: 100%; +} + +.title { + font-size: 30rpx; + position: relative; + color: #000; + display: inline-block; +} + +.title text { + margin-left: 20rpx; +} + +.column-box { + display: flex; + flex-direction: column; + background-color: #fff; + width: 100%; +} + +.column-box-row { + display: flex; + flex-direction: row; + align-items: center; + background-color: #fff; + width: 100%; + padding: 15rpx; +} + +.column-item { + margin: 0rpx; + padding: 7.5rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx; +} + +.column-item:last-child { + padding: 7.5rpx 15rpx 15rpx 15rpx; +} + +.img-item { + width: 100%; + border-radius: 5rpx; +} + +.img-item:nth-child(1) { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.img-item:last-child { + padding: 7.5rpx 0rpx 7.5rpx 0rpx; +} + +.column-content { + display: flex; + flex-direction: column; + background-color: #fff; + border-radius: 10rpx; + width: 100%; + box-shadow: 0px 2px 2px #f0f0f0; + z-index: 2; +} + +.intro-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.serve-title image { + width: 28rpx; + height: 30rpx; + vertical-align: middle; + margin-top: -4px; +} + +.person-content { + padding: 20rpx; + border-radius: 20rpx; + background: #fff; + margin-top: -30rpx; + font-size: 30rpx; + color: #000; + line-height: 40rpx; + word-break: break-all; + line-height: 40rpx; + letter-spacing: 2rpx; + position: relative; +} + +.company-title { + display: flex; + justify-content: space-between; + border-bottom: 1px solid #ddd; +} + +.company-title image { + width: 140rpx; + height: 140rpx; +} + +.company-name { + width: 520rpx; + height: 140rpx; + display: flex; + align-items: center; + font-size: 34rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.company-content { + background: #fff; + border-radius: 20rpx; + padding: 20rpx; + margin-top: -30rpx; + position: relative; +} + +.company-content image { + width: 100%; + height: 300rpx; + border-radius: 20rpx; +} + +.company .person-content { + margin-top: 0; +} + +.dynamic-title { + width: 710rpx; + margin: 0 auto; + display: block; +} + +.dynamic-box { + margin-bottom: 20rpx; + background: #fff; + border-radius: 20rpx; + overflow: hidden; + position: relative; + height: 400rpx; +} + +.dynamic-box image { + width: 100%; + height: 400rpx; +} + +.dynamic-text { + position: absolute; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.6); + line-height: 60rpx; + color: #fff; + padding: 0 10rpx; + font-size: 30rpx; +} + +.person-info { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 1px solid #EEE; +} + +.avatar { + width: 120rpx; + height: 120rpx; + border-radius: 50%; + overflow: hidden; +} + +.avatar image { + width: 100%; + height: 100%; +} + +.person-name { + width: 530rpx; +} + +.name { + font-size: 32rpx; + margin: 15rpx 0 10rpx; + color: #000; +} + +.time { + color: #b2b2b2; +} + +.dynamic-content { + margin: 20rpx 0; +} + +.dynamic-img { + position: relative; + display: flex; + justify-content: space-between; + flex-wrap: wrap; +} + +.dynamic-img image { + width: 32%; + margin-right: 2%; + height: 160rpx; + margin-bottom: 10rpx; +} + +.dynamic-img image:nth-child(3n) { + margin-right: 0; +} + +.dynamic-img-text { + position: absolute; + left: 0; + right: 0; + bottom: 3rpx; + padding: 0 20rpx; + background: rgba(0, 0, 0, 0.6); + color: #fff; + font-size: 32rpx; + line-height: 70rpx; +} + +.dynamic-good { + margin: 10rpx 0; + display: flex; + justify-content: space-between; +} + +.good-count { + color: #333; + font-size: 28rpx; +} + +.good-btn image { + width: 40rpx; + height: 40rpx; + vertical-align: top; +} + +.dynamic-reply { + background: #eee; + padding: 15rpx; + margin-top: 15rpx; +} + +.reply { + font-size: 32rpx; + color: #000; + margin-bottom: 5rpx; +} + +.reply-name { + font-weight: bold; + display: inline; +} + +.dynamic-reply-input { + margin-top: 10rpx; +} + +.dynamic-reply-input input { + width: 100%; + height: 60rpx; + border-bottom: 1px solid #eee; +} + +.creat-card { + position: fixed; + right: 20rpx; + bottom: 20rpx; + padding: 20rpx; + background: #E6B980; + border-radius: 50%; + box-sizing: border-box; + align-items: center; + justify-content: center; + flex-direction: column; + width: 140rpx; + height: 140rpx; + z-index: 100; +} + +.creat-card image { + width: 80rpx; + height: 60rpx; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} + +.share-save { + text-align: center; + display: flex; + justify-content: space-between; +} + +.share-btn { + border: 1px solid #E6B980; + background: none; + color: #1296db; + font-weight: normal; +} + +.save-btn { + border: 1px solid #1296db; + background: #1296db; + color: #fff; + font-weight: normal; +} + +.bottom-btn { + margin-top: 20rpx; + padding: 0 20rpx; + width: 100%; + white-space: nowrap; +} + +.phone-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.wechate-box .icon { + width: 35rpx; + height: 30rpx; + vertical-align: top; +} + +.email-box .icon { + width: 30rpx; + height: 30rpx; + vertical-align: top; +} + +.bottom-btn-box { + display: inline-block; + min-width: 32%; + line-height: 30rpx; + padding: 20rpx; + box-sizing: border-box; + border: 1px solid #DDD; + border-radius: 10rpx; + margin-right: 10rpx; +} + +.bottom-text { + margin-top: 10rpx; +} + +.top-box { + width: 100%; +} + +.good { + display: flex; + justify-content: space-between; + width: 100%; + background-color: #fff; + padding: 15rpx; +} + +.good-avatar, +.good-click { + line-height: 45rpx; + color: #333; +} + +.good-avatar { + font-size: 0; +} + +.good-click { + display: flex; +} + +.view-count { + border-right: 1px solid #808080; + color: #808080; + display: flex; + flex-direction: row; + font-size: 36rpx; + align-items: center; + justify-content: center; +} + +.view-count-no { + color: #808080; + display: flex; + flex-direction: row; + align-items: center; + font-size: 36rpx; + margin-left: 15rpx; +} + +.good-avatar image { + width: 100%; + height: 100%; + border-radius: 50%; +} + + +.good-click image { + width: 38rpx; + height: 38rpx; +} + +.view-count image { + width: 32rpx; + height: 32rpx; +} + +.view-count-no image { + width: 32rpx; + height: 32rpx; +} + +.movie-item { + height: 280rpx; + width: 100%; + padding-bottom: 0px; +} + + + +.avatar-list { + width: 45rpx; + height: 45rpx; + margin-left: -15rpx; + vertical-align: top; + display: inline-block; + border-radius: 50%; + border: 2px solid #fff; + position: relative; +} + +.avatar-list:first-child { + margin-left: 0; +} + +.mid { + display: flex; + width: 100%; + background: white; + position: relative; +} + +.mid-box { + flex: 1; + width: 100%; + display: flex; + flex-direction: column; + align-items: left; + justify-content: left; + border: 2rpx solid #EAC390; + border-radius: 10rpx; + background-color: white; + font-weight: normal; + padding: 15rpx; +} + +.mid-box:nth-child(1) { + background: white; +} + +.mid-box:nth-child(2) { + margin-left: 15rpx; +} + +.mid-box:last-child { + border: none; + border-radius: 10rpx; + margin-left: 15rpx; +} + +.mid-box image { + width: 48rpx; + height: 48rpx; +} + +.mid-box-text { + font-size: 28rpx; + color: #000; + text-align: left; + font-weight: bold; +} + +.mid-box-text-white { + font-size: 28rpx; + color: #FFF; + text-align: left; + font-weight: bold; +} + +.mid-btn { + position: relative; + margin-top: 15rpx; + display: flex; + width: 100%; + border: 1rpx solid rgb(235, 235, 235); + border-radius: 15rpx; + background: #fff; + box-shadow: 10rpx 10rpx 20rpx 20rpx #e4e4e426; + flex-wrap: nowrap; + flex-direction: column; + justify-content: center; +} + +.mid-btn-box { + flex-shrink: 0; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + box-sizing: border-box; +} + + + +.mid-btn-box:nth-child(1) { + padding: 15rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(2) { + padding: 7.5rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(3) { + padding: 7.5rpx 15rpx 7.5rpx 15rpx +} + +.mid-btn-box:nth-child(4) { + padding: 7.5rpx 15rpx 15rpx 15rpx +} + +.mid-btn-title { + display: flex; + flex-direction: row; + justify-content: flex-start; + flex: 3; + align-items: center; +} + +.mid-btn-title .image { + width: 48rpx; + height: 48rpx; +} + +.movie-box { + display: flex; + width: 100%; + border-radius: 10rpx; + height: 350rpx; + flex-direction: row; + align-items: center; + justify-content: center; +} + +.movie-box image { + border-radius: 10rpx; + width: 100%; + height: 350rpx; +} + +.mid-btn-title text { + margin-left: 15rpx; + font-size: 28rpx; + color: #333333; +} + + +.mid-btn-box image { + width: 80rpx; + height: 80rpx; +} + +.mid-btn-text { + width: 200rpx; +} + +.text-top { + line-height: 45rpx; + font-size: 30rpx; + color: #000; +} + +.text-bottom { + font-size: 26rpx; + color: #898989; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.bar-code { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0.6); + z-index: 999; +} + +.bar-code-tr { + position: fixed; + top: 0; + bottom: 0; + right: 0; + left: 0; + background: rgba(0, 0, 0, 0); + z-index: 999; +} + +.bar-code .content { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + max-width: 96%; + background: #fff; + border-radius: 10rpx; + padding: 20rpx; + min-width: 60%; + min-height: 45%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; +} + +.code-title { + font-size: 32rpx; + font-weight: bold; + color: #000; +} + +.code-txt { + font-size: 32rpx; + color: #000; +} + +.bar-code image { + width: 300rpx; + height: 300rpx; +} + +.func-box { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.func-items { + width: 100%; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-top: 10rpx; +} + +.func-item { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + flex: 1; +} + +.func-item image { + width: 48rpx; + height: 48rpx; +} + +.func-item text { + margin-left: 10rpx; +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.js b/pages/mine/product/catalogmanage/addcatalog.js new file mode 100755 index 0000000..d85fe22 --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.js @@ -0,0 +1,264 @@ +// 添加分类 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogName: '', + catalogOrder: 0, + catalogOneList: [], + catalogTwoList: [], + oneIndex: 0, + oneCatalog: null, + twoIndex: 0, + twoCatalog: null, + catalogLogoPhotos: [], + catalogSummary: '', + formPage: 0, + typeList: [{ + name: '商品', + id: '1', + isSel: true + }, { + name: '优惠券', + id: '2', + isSel: false + }], + selType: '1' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if (options.type) { + this.setData({ + formPage: 1 + }) + } + this.getCatalogList(1, 0, 1, 0) + }, + //获取一级类目 + getCatalogList(type, id, level, code) { + let _self = this + app.http.get(app.urls.getCatalogList.format({ + level: level + }), { + header: { + token: app.globalData.token + }, + data: { + id: id, + code: code + } + }) + .then(res => { + if (type == 1) { + _self.setData({ + oneIndex: 0, + catalogOneList: res.data + }) + } else { + _self.setData({ + twoIndex: 0, + catalogTwoList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doSelType(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.typeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + _self.setData({ + selType: item.id + }) + } else { + it.isSel = false + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + }, + //一级类目选择 + oneCatalogSelect(e) { + this.setData({ + oneIndex: e.detail.value, + oneCatalog: this.data.catalogOneList[e.detail.value] + }) + this.getCatalogList(2, this.data.catalogOneList[this.data.oneIndex].id, 2, this.data.catalogOneList[this.data.oneIndex].code) + }, + //二级类目选择 + twoCatalogSelect(e) { + this.setData({ + twoIndex: e.detail.value, + twoCatalog: this.data.catalogTwoList[e.detail.value] + }) + }, + //预览Logo + ViewLicImg() { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + DelLogoP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.catalogLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos + }) + } + } + }) + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + let _self = this + wx.showLoading({ + title: '上传中...', + }) + app.http.upload(app.urls.doUploadImg, { + path: path, + name: 'image', + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + let tempList = _self.data.catalogLogoPhotos.concat(item) + _self.setData({ + catalogLogoPhotos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '上传失败', + }) + }) + }, + //校验参数 + checkParams() { + if (this.data.catalogName == '') { + wx.showToast({ + title: '请输入类目名称', + icon: 'none' + }) + return false + } + if (this.data.catalogOrder == 0) { + wx.showToast({ + title: '请输入类目排序', + icon: 'none' + }) + return false + } + if (this.data.catalogLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传类目Logo', + icon: 'none' + }) + } + + + return true + }, + //添加类目 + doAdd() { + let _self = this + if (_self.checkParams()) { + //确定添加 + wx.showLoading({ + title: '添加中...', + }) + app.http.post(app.urls.doSaveCatalog, { + header: { + token: app.globalData.token + }, + data: { + categoryName: _self.data.catalogName, //名称 + categorySort: _self.data.catalogOrder, //排序 + categoryLogo: _self.data.catalogLogoPhotos.length > 0 ? _self.data.catalogLogoPhotos[0].id : '', //logo + categorySummary: _self.data.catalogSummary, //说明 + from: 'mini', //来源 + coupon: '1' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + // wx.showModal({ + // title: '提示', + // content: '添加成功后需要审核(1-3个工作日)并且无法删除和修改,确定要添加该类目吗?', + // success(res) { + // if (res.confirm) { + + // } + // } + // }) + } + }, + //监听输入 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + catalogInput(e) { + this.setData({ + catalogSummary: e.detail.value + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.json b/pages/mine/product/catalogmanage/addcatalog.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.wxml b/pages/mine/product/catalogmanage/addcatalog.wxml new file mode 100755 index 0000000..245d048 --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.wxml @@ -0,0 +1,73 @@ + + 商品类目添加 + + + + + + 类目名称 + + + + + + + 类目排序 + + + + + + + + + 类目Logo + + + {{catalogLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 类目描述 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/addcatalog.wxss b/pages/mine/product/catalogmanage/addcatalog.wxss new file mode 100755 index 0000000..79ce33b --- /dev/null +++ b/pages/mine/product/catalogmanage/addcatalog.wxss @@ -0,0 +1,4 @@ +/* pages/mine/product/catalogmanage/addcatalog.wxss */ +.cu-form-group .title { + min-width: calc(4em + 30rpx); +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.js b/pages/mine/product/catalogmanage/catalogedit.js new file mode 100755 index 0000000..b03b49a --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.js @@ -0,0 +1,241 @@ +// pages/mine/product/catalogmanage/catalogedit.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogId: '', //id + catalogLogoPhotos: [], //图标 + catalogSummary: '', //说明 + catalogName: '', //名称 + catalogOrder: 0, //排序 + typeList: [{ + name: '商品', + id: '1', + isSel: false + }, { + name: '优惠券', + id: '2', + isSel: false + }], + selType: '1' + }, + // doUpdateCatalog getCatalogDetail + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + catalogId: options.catalogId + }) + this.getCatalogDetail() + }, + doSelType(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.typeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + _self.setData({ + selType: item.id + }) + } else { + it.isSel = false + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + }, + //获取名称 + getCatalogDetail() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getCatalogDetail.format({ + categoryId: _self.data.catalogId + }), { + header: { + token: app.globalData.token, + isThree: 'yes' + } + }) + .then(res => { + wx.hideLoading({}) + var p = { + id: res.data.categoryLogo, + path: app.urls.baseImgUrl + res.data.categoryLogo + } + _self.data.catalogLogoPhotos.push(p) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos, //图标 + catalogSummary: res.data.categorySummary, //说明 + catalogName: res.data.categoryName, //名称 + catalogOrder: res.data.categorySort, //排序 + selType: res.data.coupon + }) + _self.data.typeList.forEach(it => { + if (it.id == _self.data.selType) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //预览Logo + ViewLicImg() { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + DelLogoP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.catalogLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + catalogLogoPhotos: _self.data.catalogLogoPhotos + }) + } + } + }) + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + let tempList = _self.data.catalogLogoPhotos.concat(item) + _self.setData({ + catalogLogoPhotos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //校验参数 + checkParams() { + if (this.data.catalogName == '') { + wx.showToast({ + title: '请输入类目名称', + icon: 'none' + }) + return false + } + if (this.data.catalogOrder == 0) { + wx.showToast({ + title: '请输入类目排序', + icon: 'none' + }) + return false + } + if (this.data.catalogLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传类目Logo', + icon: 'none' + }) + } + + return true + }, + //添加类目 + doAdd() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '修改中...', + }) + app.http.put(app.urls.doUpdateCatalog.format({ + categoryId: _self.data.catalogId + }), { + header: { + isThree: 'yes', + token: app.globalData.token + }, + data: { + categoryName: _self.data.catalogName, //名称 + categorySort: _self.data.catalogOrder, //排序 + categoryLogo: _self.data.catalogLogoPhotos.length > 0 ? _self.data.catalogLogoPhotos[0].id : '', //logo + categorySummary: _self.data.catalogSummary, //说明 + coupon: '1' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '修改成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //监听输入 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + catalogInput(e) { + this.setData({ + catalogSummary: e.detail.value + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.json b/pages/mine/product/catalogmanage/catalogedit.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.wxml b/pages/mine/product/catalogmanage/catalogedit.wxml new file mode 100755 index 0000000..ac1dae0 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.wxml @@ -0,0 +1,76 @@ + + + 商品类目编辑 + + + + + + 类目名称 + + + + + + + 类目排序 + + + + + + + + + 类目Logo + + + {{catalogLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 类目描述 + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogedit.wxss b/pages/mine/product/catalogmanage/catalogedit.wxss new file mode 100755 index 0000000..7948df8 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogedit.wxss @@ -0,0 +1 @@ +/* pages/mine/product/catalogmanage/catalogedit.wxss */ \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.js b/pages/mine/product/catalogmanage/catalogmanage.js new file mode 100755 index 0000000..79f4f84 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.js @@ -0,0 +1,223 @@ +// pages/mine/product/catalogmanage/catalogmanage.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogList: [], + currentPage: 1, + isRefreshing: false, + activeNames: ['0'], + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + selectItems: [], //选中的行业, + selectItemNames: '', + isAddPage: false //用来判断是否需要刷新页面 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCatalogList() + }, + //获取店铺商品类目 + getCatalogList() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogThirdList, { + header: { + token: app.globalData.token + }, + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + res.data.forEach(el => { + el.isSel = false + }) + _self.setData({ + catalogThirdList: res.data + }) + console.log(res) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + toRecycle() { + wx.navigateTo({ + url: '/pages/mine/product/recycle/catagoryrecycle', + }) + }, + // 选中了条目 + selectItem(e) { + let _self = this + let { + type, + item, + index + } = e.currentTarget.dataset + // if (type == '1') { + // _self.data.catalogOneList.forEach(el => { + // if (el.id == item.id) { + // el.isSel = true + // } else { + // el.isSel = false + // } + // }) + // _self.setData({ + // catalogOneList: _self.data.catalogOneList, + // catalogTwoList: [], + // catalogThirdList: [] + // }) + // _self.getCatalogList(item.id, '2', item.code) + // } else if (type == '2') { + // _self.data.catalogTwoList.forEach(el => { + // if (el.id == item.id) { + // el.isSel = true + // } else { + // el.isSel = false + // } + // }) + // _self.setData({ + // catalogTwoList: _self.data.catalogTwoList, + // catalogThirdList: [] + // }) + // _self.getCatalogList(item.id, '3', item.code) + // } else { + // } + _self.data.catalogThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + }, + toAddPage() { + wx.navigateTo({ + url: './addcatalog', + }) + }, + //刷新列表 + dorefreshList() { + this.setData({ + catalogThirdList: [], //三级类目 + isRefreshing: true, + currentPage: 1 + }) + this.getCatalogList() + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.dorefreshList() + }, + doDel(e) { + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该类目吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCatelog.format({ + ids: item.categoryId + }), { + header: { + token: app.globalData.token, + isThree: 'yes' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.data.catalogThirdList.splice(index, 1) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + doEdit(e) { + var item = e.currentTarget.dataset.item + wx.navigateTo({ + url: './catalogedit?catalogId=' + item.categoryId, + }) + }, + + // //获取类目列表 + // getCatalogList(id, level, code) { + // let _self = this + // wx.showLoading({ + // title: '加载中...', + // }) + // app.http.get(app.urls.getCatalogList.format({ + // level: level + // }), { + // header: { + // token: app.globalData.token + // }, + // data: { + // id: id, + // code: code + // } + // }) + // .then(res => { + // wx.hideLoading({}) + // _self.setData({ + // isRefreshing: false + // }) + // data.forEach(el => { + // el.isSel = false + // }) + // if (level == '1') { + // _self.setData({ + // catalogOneList: res.data + // }) + // } else if (level == '2') { + // _self.setData({ + // catalogTwoList: res.data + // }) + // } else { + // _self.setData({ + // catalogThirdList: res.data + // }) + // } + // }) + // .catch(err => { + // wx.hideLoading({}) + // _self.setData({ + // isRefreshing: false + // }) + // }) + // }, +}) \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.json b/pages/mine/product/catalogmanage/catalogmanage.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.wxml b/pages/mine/product/catalogmanage/catalogmanage.wxml new file mode 100755 index 0000000..f3bd4f9 --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.wxml @@ -0,0 +1,36 @@ + + + 商品类目 + + + + + + + + + + + + {{item.categoryName}} + + + 删除 + + + 编辑 + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/catalogmanage/catalogmanage.wxss b/pages/mine/product/catalogmanage/catalogmanage.wxss new file mode 100755 index 0000000..ccc03dd --- /dev/null +++ b/pages/mine/product/catalogmanage/catalogmanage.wxss @@ -0,0 +1 @@ +/* pages/mine/product/catalogmanage/catalogmanage.wxss */ \ No newline at end of file diff --git a/pages/mine/product/coupon/addcoupon.js b/pages/mine/product/coupon/addcoupon.js new file mode 100755 index 0000000..26f3de2 --- /dev/null +++ b/pages/mine/product/coupon/addcoupon.js @@ -0,0 +1,571 @@ +// pages/mine/product/coupon/addcoupon.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + typeList: [{ + id: '1', + name: '无门槛', + isInput: false, + isSel: true, + value: '', + pValue: '0', + key: 'type1' + }, { + id: '2', + name: '订单满', + isInput: true, + isSel: false, + pValue: '1', + value: '', + key: 'type2' + }], //使用门槛 + scopeList: [{ + id: '1', + name: '全部商品', + isSel: true, + pValue: '0', + isShowBtn: false, + }, { + id: '2', + name: '指定商品', + isSel: false, + pValue: '1', + isShowBtn: true, + }], + dueTimeList: [{ + id: '1', + name: '', + startDate: '', + endDate: '', + type: 'picker', + isSel: true, + pValue: '0', + key: 'dueTime1', + value: '' + }, { + id: '2', + name: '领取当日开始', + startDate: '', + endDate: '', + type: 'input', + pValue: '1', + isSel: false, + key: 'dueTime2', + value: '' + }, { + id: '3', + name: '领取次日开始', + startDate: '', + endDate: '', + pValue: '2', + type: 'input', + isSel: false, + key: 'dueTime3', + value: '' + }], //有效期 + rankList: [{ + id: '1', + name: '不限', + isSel: true, + pValue: '0', + hint: '' + }, { + id: '2', + name: '仅注册用户可领取', + isSel: false, + hint: '', + pValue: '1', + }, { + id: '3', + name: '仅新客可领取', + isSel: false, + hint: '该限制仅在客户主动领取优惠券时生效', + pValue: '2', + }], //身份限制 + astrictList: [{ + id: '1', + name: '不限', + isInput: false, + isSel: true, + value: '', + key: 'type3', + pValue: '0', + }, { + id: '2', + name: '每人限领', + isInput: true, + isSel: false, + value: '', + pValue: '1', + key: 'type4' + }], //领取限制 + showTemplete: { + name: '商品详情页可领取优惠券', + isSel: false + }, + shareBean: { + name: '优惠券允许分享给好友领取', + isSel: false + }, + startDate: '请选择', + endDate: '请选择', + couponName: '', //优惠券名称 + couponCount: '', //优惠券张数 + price: '', + summary: '', //使用说明 + isShowGoods: false, //是否显示添加的商品 + goodsList: [], //选中的商品 + shopId: '', //商店ID + baseImageUrl: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + }, + //使用门槛 + doSelType(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.typeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + }, + //可用商品 + doSelScope(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.scopeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + if (it.id == '2') { + _self.setData({ + isShowGoods: true + }) + } else { + _self.setData({ + isShowGoods: false + }) + } + } else { + it.isSel = false + } + }) + _self.setData({ + scopeList: _self.data.scopeList + }) + }, + //有效期 + doSelDueTime(e) { + var item = e.currentTarget.dataset.item + // dueTimeList + var item = e.currentTarget.dataset.item + var _self = this + _self.data.dueTimeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + }, + //日期选择 + dateChange(e) { + var _self = this + var model = e.currentTarget.dataset.model + var value = e.detail.value + _self.data.dueTimeList.forEach(it => { + if (it.id == '1') { + it[model] = value + _self.setData({ + [model]: value + }) + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + console.log(e) + }, + //身份限制 + doSelRank(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.rankList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + rankList: _self.data.rankList + }) + }, + //领取展示 + doSelShow() { + var _self = this + _self.data.showTemplete.isSel = !_self.data.showTemplete.isSel + _self.setData({ + showTemplete: _self.data.showTemplete + }) + }, + //使用条件 + doSelCon(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.astrictList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + astrictList: _self.data.astrictList + }) + }, + //使用说明输入 + textareaBInput(e) { + this.setData({ + summary: e.detail.value + }) + }, + inputWatch(e) { + var model = e.currentTarget.dataset.model + var value = e.detail.value + var _self = this + switch (model) { + case 'type2': //使用门槛 + _self.data.typeList.forEach(it => { + if (it.key == model) { + it.value = value + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + break + case 'dueTime2': //有效期 + case 'dueTime3': + _self.data.dueTimeList.forEach(it => { + if (it.key == model) { + it.endDate = value + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + break + case 'type4': //每人限领 + _self.data.astrictList.forEach(it => { + if (it.key == model) { + it.value = value + } + }) + _self.setData({ + astrictList: _self.data.astrictList + }) + break + default: + _self.setData({ + [model]: value + }) + break + } + }, + doShare() { + var _self = this + _self.data.shareBean.isSel = !_self.data.shareBean.isSel + _self.setData({ + shareBean: _self.data.shareBean + }) + }, + //选择商品 + addGoods() { + var _self = this + _self.data.scopeList.forEach(it => { + if (it.id == '2') { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + scopeList: _self.data.scopeList, + isShowGoods: true + }) + wx.navigateTo({ + url: '/pages/mine/product/coupon/choosegoods?shopId=' + this.data.shopId, + }) + }, + //删除商品 + delGoods(e) { + console.log(e) + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + var _self = this + wx.showModal({ + title: '警告', + content: '确认要删除该商品吗?', + success(res) { + if (res.confirm) { + //去除 + _self.data.goodsList.splice(index, 1) + _self.setData({ + goodsList: _self.data.goodsList + }) + } + } + }) + }, + //校验参数 + checkParams() { + var _self = this + if (_self.data.couponName == '') { + wx.showToast({ + title: '请输入卷名称', + icon: 'error' + }) + return false + } + if (_self.data.price == 0) { + wx.showToast({ + title: '请输入优惠金额', + icon: 'error' + }) + return false + } + var type = true + _self.data.typeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + if (it.value == '') { + wx.showToast({ + title: '请输入使用门槛', + icon: 'error' + }) + type = false + } + } + } + }) + if (!type) { + return false + } + var scope = true + _self.data.scopeList.forEach(it => { + if (it.id == '2' && it.isSel) { + if (_self.data.goodsList.length <= 0) { + wx.showToast({ + title: '请选择适用商品', + icon: 'error' + }) + scope = false + } + } + }) + if (!scope) { + return false + } + if (_self.data.couponCount == '') { + wx.showToast({ + title: '请输入发行张数', + icon: 'error' + }) + return false + } + var due = true + _self.data.dueTimeList.forEach(it => { + if (it.isSel) { + console.log('有效期') + if (it.id == '1') { + console.log('有效期选中') + //选择开始 + if (_self.data.startDate == '请选择') { + console.log('未输入开始时间') + wx.showToast({ + title: '请选择开始日期', + icon: 'error' + }) + due = false + } + if (_self.data.endDate == '请选择') { + wx.showToast({ + title: '请选择结束日期', + icon: 'error' + }) + due = false + } + } else { + if (it.endDate == '') { + wx.showToast({ + title: '请输入使用期限', + icon: 'error' + }) + due = false + } + } + } + }) + if (!due) { + return due + } + var astrict = true + _self.data.astrictList.forEach(it => { + if (it.id == '2' && it.isSel) { + if (it.value == '') { + wx.showToast({ + title: '请输入每人限领', + icon: 'error' + }) + astrict = false + } + } + }) + if (!astrict) { + return false + } + return true + }, + buildParams() { + var params = {} + var _self = this + params['shopId'] = _self.data.shopId //店铺ID + params['couponName'] = _self.data.couponName //名称 + params['amount'] = _self.data.price //优惠金额 + _self.data.typeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + //输入 + params['useType'] = it.pValue + params['useAmount'] = it.value + } else { + params['useType'] = it.pValue + } + } + }) + + _self.data.scopeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + //指定商品 + params['useCommodity'] = it.pValue + var ids = [] + _self.data.goodsList.forEach(ii => { + var item = { + shopgoodId: ii.goodsId + } + ids.push(item) + }) + params['shopgoodVOList'] = ids + } else { + //全部商品 + params['useCommodity'] = it.pValue + } + } + }) + params['distributionVolume'] = _self.data.couponCount //发放数量 + //有效期 + _self.data.dueTimeList.forEach(it => { + if (it.isSel) { + if (it.id == '1') { + //时间范围 + params['expiringDate'] = it.pValue + params['startDate'] = it.startDate + params['endDate'] = it.endDate + } else { + //次日开始 + params['expiringDays'] = it.endDate + params['expiringDate'] = it.pValue + } + } + }) + //身份限制 + _self.data.rankList.forEach(it => { + if (it.isSel) { + params['identityRestrictions'] = it.pValue + } + }) + //使用条件 + _self.data.astrictList.forEach(it => { + if (it.isSel) { + if (it.isSel) { + // 次数 + params['quota'] = it.pValue + params['quotaEveryone'] = it.value + } else { + // 不限 + params['quota'] = it.pValue + } + } + }) + //领取展示 + if (_self.data.showTemplete.isSel) { + params['getShow'] = '0' + } + // 分享 + if (_self.data.shareBean.isSel) { + params['share'] = '0' + } + //使用说明 + if (_self.data.summary != '') { + params['useExplain'] = _self.data.summary + } + return params + }, + doSave() { + var _self = this + if (_self.checkParams()) { + var params = _self.buildParams() + wx.showLoading({ + title: '添加中...', + }) + app.http.post(app.urls.doSaveCoupon, { + header: { + token: app.globalData.token + }, + data: params + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + onShow(e) { + this.setData({ + goodsList: this.data.goodsList + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/coupon/addcoupon.json b/pages/mine/product/coupon/addcoupon.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/coupon/addcoupon.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/coupon/addcoupon.wxml b/pages/mine/product/coupon/addcoupon.wxml new file mode 100755 index 0000000..c3b2854 --- /dev/null +++ b/pages/mine/product/coupon/addcoupon.wxml @@ -0,0 +1,226 @@ + + 新增优惠券 + + +
+ + + + 卷名称 + + + + + + + 优惠金额 + + + + + + + 使用门槛 + + + + + + + {{item.name}} + + + + + + + + + + + 可用商品 + + + + + + + {{item.name}} + + + 添加商品 + + + + + + 当前选中:{{goodsList.length}}种商品 + + + + + + + + {{item.goodsName}} + + + + + ¥:{{item.goodsUnitPrice}} + + 库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}} + + + + + + 删除 + + + + + + + 总发放量 + + + + + + + + + + 有效期 + + + + + + + + + + + {{item.name}} + + + + + {{startDate}} + + + + + + {{endDate}} + + + + + + 天内有效 + + + + + + 领取和使用规则 + + + + + 身份限制 + + + + + + + + + + + {{item.name}} + + {{item.hint}} + + + + + + 每人限领 + + + + + + + {{item.name}} + + + + + + + + + + + 领取展示 + + + + + + + {{showTemplete.name}} + + 查看示例 + + + + + 分享设置 + + + + + + + {{shareBean.name}} + + + + + + + 使用说明 + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/pages/mine/product/coupon/addcoupon.wxss b/pages/mine/product/coupon/addcoupon.wxss new file mode 100755 index 0000000..7b7031d --- /dev/null +++ b/pages/mine/product/coupon/addcoupon.wxss @@ -0,0 +1,28 @@ +/* pages/mine/product/coupon/addcoupon.wxss */ +page { + font-size: 28rpx; +} + +.row-item-width { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 30%; +} + +.row-item-width input { + text-align: center; +} + +.row-item { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 95%; +} + +.item-padding { + padding: 5rpx 0rpx; +} \ No newline at end of file diff --git a/pages/mine/product/coupon/choosegoods.js b/pages/mine/product/coupon/choosegoods.js new file mode 100755 index 0000000..ebc8857 --- /dev/null +++ b/pages/mine/product/coupon/choosegoods.js @@ -0,0 +1,272 @@ +// pages/mine/product/productmanage/productlist.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + productList: [], + isRefreshing: false, + currentPage: 1, + totalSize: 0, + shopId: '', + isAddPage: false, + isCatalogPage: false, + activeNames: ['0'], + baseImageUrl: app.urls.baseImgUrl, + currentCatalogId: '', + curIndex: 0, + active: 1, + curGoodsList: [], + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + isLoadMore: false, + hasMore: true, + selGoods: [], //选中的商品列表 + isFirst: false + }, + /** + * 切换类目 + */ + switchRightTap(e) { + let curindex = parseInt(e.currentTarget.dataset.curindex); + this.data.productList[curindex].goodsList = [] + this.setData({ + currentPage: 1, + hasMore: true, + isLoadMore: false, + curIndex: curindex + }) + let item = this.data.productList[curindex] + //根据类目的类型来判断添加商品还是优惠券 2是优惠券 + if (item.coupon == '2') { + this.getCouponListByCid(item.categoryId) + } else { + this.getGoodsListByCId(item.categoryId) + } + }, + //获取优惠券列表 + getCouponListByCid(id) { + + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + isFirst: true + }) + this.getShopCatalogList(this.data.shopId) + }, + //获取店铺所有商品类目 + getShopCatalogList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogThirdList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 获取商品列表 + */ + getGoodsList(shopId) { + wx.showLoading({ + title: '加载中...', + }) + app.htt.get(app.urls.getShopGoodsList.format({ + shopId: shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setData({ + isRefreshing: false + }) + this.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //获取商品的index + getIndex(item) { + for (var i = 0; i < this.data.selGoods.length; i++) { + if (this.data.selGoods[i].goodsId == item.goodsId) { + return i + } + } + return -1; + }, + //选择商品 + selGoods(e) { + var _self = this + var item = e.currentTarget.dataset.item + _self.data.productList[_self.data.curIndex].goodsList.forEach(it => { + if (it.goodsId == item.goodsId) { + it.isSel = !item.isSel + } + }) + if (item.isSel) { + //取消 + var index = _self.getIndex(item) + _self.data.selGoods.splice(index, 1) + } else { + //添加 + _self.data.selGoods.push(item) + } + _self.setData({ + productList: _self.data.productList, + selGoods: _self.data.selGoods + }) + }, + //构建数据 + buildDatas(data) { + let _self = this + if (data.length > 0) { + data.forEach(el => { + el.goodsList = [] + _self.data.productList.push(el) + }) + _self.setData({ + curIndex: 0, + productList: _self.data.productList + }) + _self.getGoodsListByCId(_self.data.productList[0].categoryId) + } + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isLoadMore: false, + hasMore: true, + productList: [] + }) + this.getShopCatalogList(this.data.shopId) + }, + //根据类目ID获取商品 + getGoodsListByCId(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getGoodsByCatalogAndShop.format({ + categoryId: id + }), { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (res.data.rows.length > 0) { + res.data.rows.forEach(it => { + it.isSel = false + }) + _self.data.selGoods.forEach(it => { + res.data.rows.forEach(ii => { + if (ii.goodsId == it.goodsId) { + ii.isSel = true + } + }) + }) + _self.data.productList.forEach(el => { + if (el.categoryId == id) { + el.goodsList = el.goodsList.concat(res.data.rows) + } + }) + _self.setData({ + productList: _self.data.productList + }) + } else { + _self.setData({ + hasMore: false + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + }) + }, + onChange(e) { + let _self = this + let item = e.currentTarget.dataset.item + this.setData({ + activeNames: e.detail, + currentCatalogId: item.categoryId + }) + if (e.detail.length > 1) { + //展开 + if (item.goodsList || item.goodsList.length <= 0) { + _self.getGoodsListByCId(item.categoryId) + } + } + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + let item = _self.data.productList[_self.data.curIndex] + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getGoodsListByCId(item.categoryId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + confirm() { + var _self = this + if (_self.data.selGoods.length <= 0) { + wx.showToast({ + title: '请选择商品', + }) + } else { + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + goodsList: [] + }) + lastPage.setData({ + goodsList: _self.data.selGoods + }) + wx.navigateBack({}) + } + } +}) \ No newline at end of file diff --git a/pages/mine/product/coupon/choosegoods.json b/pages/mine/product/coupon/choosegoods.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/coupon/choosegoods.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/coupon/choosegoods.wxml b/pages/mine/product/coupon/choosegoods.wxml new file mode 100755 index 0000000..d8a109e --- /dev/null +++ b/pages/mine/product/coupon/choosegoods.wxml @@ -0,0 +1,46 @@ + + + 商品选择 + + + + + + + {{item.categoryName}} + + + + + + + + + + + + + {{item.goodsName}} + + + + + ¥:{{item.goodsUnitPrice}} + + 库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}} + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/coupon/choosegoods.wxss b/pages/mine/product/coupon/choosegoods.wxss new file mode 100755 index 0000000..864c941 --- /dev/null +++ b/pages/mine/product/coupon/choosegoods.wxss @@ -0,0 +1,93 @@ +/* pages/mine/product/productmanage/productlist.wxss */ +.category { + display: flex; + flex-direction: row; + height: 100%; + margin-bottom: 80rpx; +} + +.nav_left { + background: #f8f8f8; + width: 30%; + height: 100%; + white-space: nowrap; +} + +.nav_right { + background: #fff; + width: 70%; + height: 100%; +} + +.nav_left_bg { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 10rpx; + background: #f8f8f8; + position: relative; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.nav_left_items { + font-size: 28rpx; + color: #333; + height: 100rpx; + line-height: 100rpx; + text-align: center; +} + +.nav_left_border { + border-left-color: #0054bd; + border-left-width: 2px; + border-left-style: solid; +} + +.nav_left_item-active { + background-color: #fff; + color: #0054bd; +} + +.jd-category { + margin: 40rpx 16rpx 0; +} + +.jd-category-wrap { + overflow: hidden; + padding: 20rpx 20rpx 0; +} + +.jd-category .title { + font-size: 28rpx; + height: 60rpx; + line-height: 30rpx; + font-weight: 700; + color: #080808 +} + +.jd-category-style { + width: 32.8%; + float: left; + display: flex; + flex-direction: column; + justify-content: center; +} + +.list_img { + width: 150rpx; + height: 150rpx; +} + +.list_text { + text-align: center; + font-size: 24rpx; + color: #686868; + margin-top: 10rpx; + height: 70rpx; +} \ No newline at end of file diff --git a/pages/mine/product/coupon/couponlist.js b/pages/mine/product/coupon/couponlist.js new file mode 100755 index 0000000..f457194 --- /dev/null +++ b/pages/mine/product/coupon/couponlist.js @@ -0,0 +1,114 @@ +// pages/mine/product/coupon/couponlist.js +// 优惠券列表 +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + couponList: [], + currentPage: 1, + isRefreshing: false, + isAddPage: false, + hasMore: true, + isLoadMore: false, + shopId: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getCouponList() + }, + getCouponList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCouponList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false, + couponList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + //跳转添加页面 + toAddPage() { + wx.navigateTo({ + url: '/pages/mine/product/coupon/addcoupon?shopId=' + this.data.shopId, + }) + }, + //跳转编辑页面 + toEditPage(e) { + var item = e.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/mine/product/coupon/editcoupon?id=' + item.couponId + '&shopId=' + this.data.shopId, + }) + }, + //删除 + doDel(e) { + var item = e.currentTarget.dataset.item + var _self = this + wx.showModal({ + title: '警告', + content: '确定要删除该优惠券吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCoupon.format({ + ids: item.couponId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.dorefresh() + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + dorefresh() { + this.setData({ + couponList: [], + isRefreshing: true, + }) + this.getCouponList() + }, + onShow(e) { + if (this.data.isAddPage) { + this.setData({ + isAddPage: false + }) + this.dorefresh() + } + }, +}) \ No newline at end of file diff --git a/pages/mine/product/coupon/couponlist.json b/pages/mine/product/coupon/couponlist.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/coupon/couponlist.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/coupon/couponlist.wxml b/pages/mine/product/coupon/couponlist.wxml new file mode 100755 index 0000000..5fc72e7 --- /dev/null +++ b/pages/mine/product/coupon/couponlist.wxml @@ -0,0 +1,59 @@ + + 新增优惠券 + + + + + + + + {{item.couponName}} + + + + + + 领取当日{{item.expiringDays}}天内有效 + + + 领取次日{{item.expiringDays}}天内有效 + + + + + 全部商品 + + + 限品类 + + + + + + {{item.amount}} + + + + + 无限制 + + + 订单满{{item.useAmount}}可用 + + + + + + 删除 + 恢复 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/coupon/couponlist.wxss b/pages/mine/product/coupon/couponlist.wxss new file mode 100755 index 0000000..d3f5c67 --- /dev/null +++ b/pages/mine/product/coupon/couponlist.wxss @@ -0,0 +1,56 @@ +/* pages/mine/product/coupon/couponlist.wxss */ +page { + background: #f2f2f2; +} + +.right-box { + width: 100%; + position: relative; + min-height: 200rpx; + flex: 3; + display: flex; + align-items: center; + justify-content: center; + border-radius: 15rpx 10rpx 10rpx 15rpx; + flex-direction: column; +} + +.price { + color: #ffffff; + font-size: 54rpx; +} + +.price-icon { + color: #ffffff; + font-size: 28rpx; +} + +.price-term { + font-size: 20rpx; + color: #ffffff; +} + +.left-box { + width: 100%; + flex: 7; + background: #ffffff; + position: relative; + border-radius: 10rpx 15rpx 15rpx 10rpx; + min-height: 200rpx; + display: flex; + align-items: flex-start; + flex-direction: column; + justify-content: center; +} + +.btn-box { + width: 100%; + display: flex; + flex-direction: row; + justify-content: flex-end; + padding: 10rpx; +} + +.btn { + padding: 10rpx 40rpx; +} \ No newline at end of file diff --git a/pages/mine/product/coupon/editcoupon.js b/pages/mine/product/coupon/editcoupon.js new file mode 100755 index 0000000..c5fb600 --- /dev/null +++ b/pages/mine/product/coupon/editcoupon.js @@ -0,0 +1,694 @@ +// pages/mine/product/coupon/addcoupon.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + typeList: [{ + id: '1', + name: '无门槛', + isInput: false, + isSel: true, + value: '', + pValue: '0', + key: 'type1' + }, { + id: '2', + name: '订单满', + isInput: true, + isSel: false, + pValue: '1', + value: '', + key: 'type2' + }], //使用门槛 + scopeList: [{ + id: '1', + name: '全部商品', + isSel: true, + pValue: '0', + isShowBtn: false, + }, { + id: '2', + name: '指定商品', + isSel: false, + pValue: '1', + isShowBtn: true, + }], + dueTimeList: [{ + id: '1', + name: '', + startDate: '', + endDate: '', + type: 'picker', + isSel: true, + pValue: '0', + key: 'dueTime1', + value: '' + }, { + id: '2', + name: '领取当日开始', + startDate: '', + endDate: '', + type: 'input', + pValue: '1', + isSel: false, + key: 'dueTime2', + value: '' + }, { + id: '3', + name: '领取次日开始', + startDate: '', + endDate: '', + pValue: '2', + type: 'input', + isSel: false, + key: 'dueTime3', + value: '' + }], //有效期 + rankList: [{ + id: '1', + name: '不限', + isSel: true, + pValue: '0', + hint: '' + }, { + id: '2', + name: '仅注册用户可领取', + isSel: false, + hint: '', + pValue: '1', + }, { + id: '3', + name: '仅新客可领取', + isSel: false, + hint: '该限制仅在客户主动领取优惠券时生效', + pValue: '2', + }], //身份限制 + astrictList: [{ + id: '1', + name: '不限', + isInput: false, + isSel: true, + value: '', + key: 'type3', + pValue: '0', + }, { + id: '2', + name: '每人限领', + isInput: true, + isSel: false, + value: '', + pValue: '1', + key: 'type4' + }], //领取限制 + showTemplete: { + name: '商品详情页可领取优惠券', + isSel: false + }, + shareBean: { + name: '优惠券允许分享给好友领取', + isSel: false + }, + startDate: '请选择', + endDate: '请选择', + couponName: '', //优惠券名称 + couponCount: '', //优惠券张数 + price: '', + summary: '', //使用说明 + isShowGoods: false, //是否显示添加的商品 + goodsList: [], //选中的商品 + shopId: '', //商店ID + baseImageUrl: app.urls.baseImgUrl, + couponId: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + couponId: options.id, + shopId: options.shopId + }) + //获取详情 + this.getDetail() + }, + //获取详情 + getDetail() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getCouponDetail.format({ + couponId: _self.data.couponId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + _self.buildDetailData(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //回显数据 + buildDetailData(data) { + var _self = this + _self.setData({ + couponName: data.couponName, + couponCount: data.distributionVolume, + price: data.amount, + summary: data.useExplain + }) + //分享设置 + if (data.share != '') { + _self.data.shareBean.isSel = true + _self.setData({ + shareBean: _self.data.shareBean + }) + } + //领取展示 + if (data.getShow != '') { + _self.data.showTemplete.isSel = true + _self.setData({ + showTemplete: _self.data.showTemplete + }) + } + //使用门槛 + if (data.useType == '1') { + _self.data.typeList[0].isSel = false + _self.data.typeList[1].isSel = true + _self.data.typeList[1].value = data.useAmount + _self.setData({ + typeList: _self.data.typeList, + }) + } + //可用商品 + if (data.useCommodity == '1') { + _self.data.scopeList[0].isSel = false + _self.data.scopeList[1].isSel = true + _self.setData({ + scopeList: _self.data.scopeList, + goodsList: data.shopGoodsDTOList, + isShowGoods: true + }) + } + //有效期 + switch (data.expiringDate) { + case 0: + _self.data.dueTimeList[0].isSel = true + _self.data.dueTimeList[1].isSel = false + _self.data.dueTimeList[2].isSel = false + _self.data.dueTimeList[0].startDate = data.startDate + _self.data.dueTimeList[0].endDate = data.endDate + break + case 1: + _self.data.dueTimeList[0].isSel = false + _self.data.dueTimeList[1].isSel = true + _self.data.dueTimeList[2].isSel = false + _self.data.dueTimeList[1].endDate = data.expiringDays + break + case 2: + _self.data.dueTimeList[0].isSel = false + _self.data.dueTimeList[1].isSel = false + _self.data.dueTimeList[2].isSel = true + _self.data.dueTimeList[2].endDate = data.expiringDays + break + } + _self.setData({ + dueTimeList: _self.data.dueTimeList, + startDate: data.startDate == '' ? '请选择' : data.startDate, + endDate: data.endDate == '' ? '请选择' : data.endDate + }) + //身份限制 + switch (data.identityRestrictions) { + case 0: + _self.data.rankList['0'].isSel = true + _self.data.rankList['1'].isSel = false + _self.data.rankList['2'].isSel = false + break + case 1: + _self.data.rankList['0'].isSel = false + _self.data.rankList['1'].isSel = true + _self.data.rankList['2'].isSel = false + break + case 2: + _self.data.rankList['0'].isSel = false + _self.data.rankList['1'].isSel = false + _self.data.rankList['2'].isSel = true + break + } + _self.setData({ + rankList: _self.data.rankList + }) + //每人限领 + if (data.quota == '1') { + // quotaEveryone + _self.data.astrictList[1].value = data.quotaEveryone + _self.data.astrictList[1].isSel = true + _self.data.astrictList[0].isSel = false + _self.setData({ + astrictList: _self.data.astrictList + }) + } + wx.hideLoading({}) + }, + //使用门槛 + doSelType(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.typeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + }, + //可用商品 + doSelScope(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.scopeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + if (it.id == '2') { + _self.setData({ + isShowGoods: true + }) + } else { + _self.setData({ + isShowGoods: false + }) + } + } else { + it.isSel = false + } + }) + _self.setData({ + scopeList: _self.data.scopeList + }) + }, + //有效期 + doSelDueTime(e) { + var item = e.currentTarget.dataset.item + // dueTimeList + var item = e.currentTarget.dataset.item + var _self = this + _self.data.dueTimeList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + }, + //日期选择 + dateChange(e) { + var _self = this + var model = e.currentTarget.dataset.model + var value = e.detail.value + _self.data.dueTimeList.forEach(it => { + if (it.id == '1') { + it[model] = value + _self.setData({ + [model]: value + }) + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + console.log(e) + }, + //身份限制 + doSelRank(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.rankList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + rankList: _self.data.rankList + }) + }, + //领取展示 + doSelShow() { + var _self = this + _self.data.showTemplete.isSel = !_self.data.showTemplete.isSel + _self.setData({ + showTemplete: _self.data.showTemplete + }) + }, + doShare() { + var _self = this + _self.data.shareBean.isSel = !_self.data.shareBean.isSel + _self.setData({ + shareBean: _self.data.shareBean + }) + }, + //使用条件 + doSelCon(e) { + var item = e.currentTarget.dataset.item + var _self = this + _self.data.astrictList.forEach(it => { + if (it.id == item.id) { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + astrictList: _self.data.astrictList + }) + }, + //使用说明输入 + textareaBInput(e) { + this.setData({ + summary: e.detail.value + }) + }, + inputWatch(e) { + var model = e.currentTarget.dataset.model + var value = e.detail.value + var _self = this + switch (model) { + case 'type2': //使用门槛 + _self.data.typeList.forEach(it => { + if (it.key == model) { + it.value = value + } + }) + _self.setData({ + typeList: _self.data.typeList + }) + break + case 'dueTime2': //有效期 + case 'dueTime3': + _self.data.dueTimeList.forEach(it => { + if (it.key == model) { + it.endDate = value + } + }) + _self.setData({ + dueTimeList: _self.data.dueTimeList + }) + break + case 'type4': //每人限领 + _self.data.astrictList.forEach(it => { + if (it.key == model) { + it.value = value + } + }) + _self.setData({ + astrictList: _self.data.astrictList + }) + break + default: + _self.setData({ + [model]: value + }) + break + } + }, + //选择商品 + addGoods() { + var _self = this + _self.data.scopeList.forEach(it => { + if (it.id == '2') { + it.isSel = true + } else { + it.isSel = false + } + }) + _self.setData({ + scopeList: _self.data.scopeList, + isShowGoods: true + }) + wx.navigateTo({ + url: '/pages/mine/product/coupon/choosegoods?shopId=' + this.data.shopId, + }) + }, + //删除商品 + delGoods(e) { + console.log(e) + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + var _self = this + wx.showModal({ + title: '警告', + content: '确认要删除该商品吗?', + success(res) { + if (res.confirm) { + //去除 + _self.data.goodsList.splice(index, 1) + _self.setData({ + goodsList: _self.data.goodsList + }) + } + } + }) + }, + //校验参数 + checkParams() { + var _self = this + if (_self.data.couponName == '') { + wx.showToast({ + title: '请输入卷名称', + icon: 'error' + }) + return false + } + if (_self.data.price == 0) { + wx.showToast({ + title: '请输入优惠金额', + icon: 'error' + }) + return false + } + var type = true + _self.data.typeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + if (it.value == '') { + wx.showToast({ + title: '请输入使用门槛', + icon: 'error' + }) + type = false + } + } + } + }) + if (!type) { + return false + } + var scope = true + _self.data.scopeList.forEach(it => { + if (it.id == '2' && it.isSel) { + if (_self.data.goodsList.length <= 0) { + wx.showToast({ + title: '请选择适用商品', + icon: 'error' + }) + scope = false + } + } + }) + if (!scope) { + return false + } + if (_self.data.couponCount == '') { + wx.showToast({ + title: '请输入发行张数', + icon: 'error' + }) + return false + } + var due = true + _self.data.dueTimeList.forEach(it => { + if (it.isSel) { + console.log('有效期') + if (it.id == '1') { + console.log('有效期选中') + //选择开始 + if (_self.data.startDate == '请选择') { + console.log('未输入开始时间') + wx.showToast({ + title: '请选择开始日期', + icon: 'error' + }) + due = false + } + if (_self.data.endDate == '请选择') { + wx.showToast({ + title: '请选择结束日期', + icon: 'error' + }) + due = false + } + } else { + if (it.endDate == '') { + wx.showToast({ + title: '请输入使用期限', + icon: 'error' + }) + due = false + } + } + } + }) + if (!due) { + return due + } + var astrict = true + _self.data.astrictList.forEach(it => { + if (it.id == '2' && it.isSel) { + if (it.value == '') { + wx.showToast({ + title: '请输入每人限领', + icon: 'error' + }) + astrict = false + } + } + }) + if (!astrict) { + return false + } + return true + }, + buildParams() { + var params = {} + var _self = this + params['shopId'] = _self.data.shopId //店铺ID + params['couponName'] = _self.data.couponName //名称 + params['amount'] = _self.data.price //优惠金额 + _self.data.typeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + //输入 + params['useType'] = it.pValue + params['useAmount'] = it.value + } else { + params['useType'] = it.pValue + } + } + }) + + _self.data.scopeList.forEach(it => { + if (it.isSel) { + if (it.id == '2') { + //指定商品 + params['useCommodity'] = it.pValue + var ids = [] + _self.data.goodsList.forEach(ii => { + var item = { + shopgoodId: ii.goodsId + } + ids.push(item) + }) + params['shopgoodVOList'] = ids + } else { + //全部商品 + params['useCommodity'] = it.pValue + } + } + }) + params['distributionVolume'] = _self.data.couponCount //发放数量 + //有效期 + _self.data.dueTimeList.forEach(it => { + if (it.isSel) { + if (it.id == '1') { + //时间范围 + params['expiringDate'] = it.pValue + params['startDate'] = it.startDate + params['endDate'] = it.endDate + } else { + //次日开始 + params['expiringDays'] = it.endDate + params['expiringDate'] = it.pValue + } + } + }) + //身份限制 + _self.data.rankList.forEach(it => { + if (it.isSel) { + params['identityRestrictions'] = it.pValue + } + }) + //使用条件 + _self.data.astrictList.forEach(it => { + if (it.isSel) { + if (it.isSel) { + // 次数 + params['quota'] = it.pValue + params['quotaEveryone'] = it.value + } else { + // 不限 + params['quota'] = it.pValue + } + } + }) + //领取展示 + if (_self.data.showTemplete.isSel) { + params['getShow'] = '0' + } + // 分享 + if (_self.data.shareBean.isSel) { + params['share'] = '0' + } + //使用说明 + if (_self.data.summary != '') { + params['useExplain'] = _self.data.summary + } + return params + }, + doSave() { + var _self = this + if (_self.checkParams()) { + var params = _self.buildParams() + wx.showLoading({ + title: '修改中...', + }) + app.http.put(app.urls.doUpdateCoupon.format({ + couponId: _self.data.couponId + }), { + header: { + token: app.globalData.token + }, + data: params + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '修改成功', + icon: 'success' + }) + let arr = getCurrentPages() + let lastPage = (arr.length >= 2) ? arr[arr.length - 2] : undefined + lastPage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } +}) \ No newline at end of file diff --git a/pages/mine/product/coupon/editcoupon.json b/pages/mine/product/coupon/editcoupon.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/coupon/editcoupon.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/coupon/editcoupon.wxml b/pages/mine/product/coupon/editcoupon.wxml new file mode 100755 index 0000000..f096ac0 --- /dev/null +++ b/pages/mine/product/coupon/editcoupon.wxml @@ -0,0 +1,227 @@ + + 新增优惠券 + + +
+ + + + 卷名称 + + + + + + + 优惠金额 + + + + + + + 使用门槛 + + + + + + + {{item.name}} + + + + + + + + + + + 可用商品 + + + + + + + {{item.name}} + + + 添加商品 + + + + + + 当前选中:{{goodsList.length}}种商品 + + + + + + + + {{item.goodsName}} + + + + + ¥:{{item.goodsUnitPrice}} + + 库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}} + + + + + + 删除 + + + + + + + 总发放量 + + + + + + + + + + 有效期 + + + + + + + + + + + {{item.name}} + + + + + {{startDate}} + + + + + + {{endDate}} + + + + + + 天内有效 + + + + + + 领取和使用规则 + + + + + 身份限制 + + + + + + + + + + + {{item.name}} + + {{item.hint}} + + + + + + 每人限领 + + + + + + + {{item.name}} + + + + + + + + + + + 领取展示 + + + + + + + {{showTemplete.name}} + + 查看示例 + + + + + + 分享设置 + + + + + + + {{shareBean.name}} + + + + + + + 使用说明 + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/pages/mine/product/coupon/editcoupon.wxss b/pages/mine/product/coupon/editcoupon.wxss new file mode 100755 index 0000000..7b7031d --- /dev/null +++ b/pages/mine/product/coupon/editcoupon.wxss @@ -0,0 +1,28 @@ +/* pages/mine/product/coupon/addcoupon.wxss */ +page { + font-size: 28rpx; +} + +.row-item-width { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 30%; +} + +.row-item-width input { + text-align: center; +} + +.row-item { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + width: 95%; +} + +.item-padding { + padding: 5rpx 0rpx; +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.js b/pages/mine/product/productmanage/addproduct.js new file mode 100755 index 0000000..cff3a0b --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.js @@ -0,0 +1,361 @@ +// pages/mine/product/productmanage/addproduct.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + cataLogId: '', //上级页面传递 + goodsName: '', //商品名称 + goodsCount: 0, //商品数量 + goodsPrice: 0.00, //商品单价 + goodsUnit: '', //商品单位 + goodsStatus: 1, //商品状态 1 上架 2 下架 + goodsPay: 1, //支付方式 1 线上 2 线下 + goodsLogoPhotos: [], //商品Logo + goodsPhotos: [], //商品图片 + goodsVideos: [], //商品视频 + goodsSummary: '', //商品说明 + goodsOrder: 0, //商品排序 + isPopular: false //是否是热门商品 + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + cataLogId: options.cataLogId + }) + }, + //商品状态切换 + selGoodsStatus(e) { + this.setData({ + goodsStatus: e.detail.value + }) + }, + //是否是热门 + selGoodsPopular(e) { + this.setData({ + isPopular: e.detail.value + }) + }, + //支付方式切换 + selGoodsPay(e) { + this.setData({ + goodsPay: e.detail.value + }) + }, + //输入框监听 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + //商品说明 + goodsSummaryInput(e) { + this.setData({ + goodsSummary: e.detail.value + }) + }, + /** + * 添加图片、视频 1 logo 2 图片 + */ + chooseLogo() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + choosePhoto() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + /** + * 删除图片、视频 + */ + delLogo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + } + }) + }, + delPhoto(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + } + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + } + }) + }, + /** + * 预览图片、视频 + */ + viewLogo(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewPhoto(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //上传图片 + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 1) { + let tempList = _self.data.goodsLogoPhotos.concat(item) + _self.setData({ + goodsLogoPhotos: tempList + }) + } else { + //图片 + let tempList = _self.data.goodsPhotos.concat(item) + _self.setData({ + goodsPhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pathStr = e.tempFiles[0].thumbTempFilePath + var id = JSON.parse(res).data + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.goodsVideos.concat(item) + _self.setData({ + goodsVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //添加商品 + doAdd() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '添加中...', + }) + let p = '' + _self.data.goodsPhotos.forEach(el => { + p += el.id + ',' + }) + if (p.length != '') { + p = p.substr(0, p.length - 1) + } + let videoId = '' + if (_self.data.goodsVideos.length > 0) { + videoId = _self.data.goodsVideos[0].id + } + app.http.post(app.urls.doSaveGoods, { + header: { + token: app.globalData.token + }, + data: { + categoryId: _self.data.cataLogId, + goodsIcon: _self.data.goodsLogoPhotos[0].id, + goodsName: _self.data.goodsName, + goodsPhotos: p, + goodsSort: _self.data.goodsOrder, + goodsStatus: _self.data.goodsStatus, + goodsSummary: _self.data.goodsSummary, + goodsTotal: _self.data.goodsCount, + goodsUnit: _self.data.goodsUnit, + goodsUnitPrice: _self.data.goodsPrice, + goodsVideo: videoId, + paymentType: _self.data.goodsPay, + shopId: _self.data.shopId, + isPopular: _self.isPopular ? '1' : '0' + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '添加成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数合法性 + checkParams() { + if (this.data.goodsName == '') { + wx.showToast({ + title: '请输入商品名称', + icon: 'error' + }) + return false + } + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + if (this.data.goodsUnit == '') { + wx.showToast({ + title: '请输入商品单位', + icon: 'error' + }) + return false + } + if (this.data.goodsLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品Logo', + icon: 'error' + }) + return false + } + if (this.data.goodsPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品图片', + icon: 'error' + }) + return false + } + return true + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.json b/pages/mine/product/productmanage/addproduct.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.wxml b/pages/mine/product/productmanage/addproduct.wxml new file mode 100755 index 0000000..1f79a29 --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.wxml @@ -0,0 +1,157 @@ + + 商品添加 + + + + + + 商品名称 + + + + + + + 是否热门 + + + + + + + + + 商品数量 + + + + + + + 商品单价 + + + + + + + 商品单位 + + + + + + + + 商品状态 + + + 上架 + 下架 + + + + + + + + 支付方式 + + + 线上 + 线下 + + + + + + + 商品Logo + + + {{goodsLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品图片 + + + {{goodsPhotos.length}}/9 + + + + + + + + + + + + + + + + + + + 商品视频 + + + {{goodsVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品说明 + + + + + + + + + + + 商品排序 + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/addproduct.wxss b/pages/mine/product/productmanage/addproduct.wxss new file mode 100755 index 0000000..09ac7b7 --- /dev/null +++ b/pages/mine/product/productmanage/addproduct.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/addproduct.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.js b/pages/mine/product/productmanage/choosecatalog.js new file mode 100755 index 0000000..5ed5eaf --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.js @@ -0,0 +1,156 @@ +// pages/mine/product/productmanage/choosecatalog.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + selCatalogId: '', + selCatalogName: '', + catalogList: [], + currentPage: 1, + isRefreshing: false, + activeNames: ['0'], + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getCatalogList(0, 1, 0) + }, + doChoose() { + if (this.data.selCatalogId == '') { + wx.showToast({ + title: '请选择三级类目', + icon: 'error' + }) + } else { + wx.redirectTo({ + url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + this.data.selCatalogId, + }) + } + }, + //获取类目列表 + getCatalogList(id, level, code) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogList.format({ + level: level + }), { + header: { + token: app.globalData.token + }, + data: { + id: id, + code: code + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + data.forEach(el => { + el.isSel = false + }) + if (level == '1') { + _self.setData({ + catalogOneList: res.data + }) + } else if (level == '2') { + _self.setData({ + catalogTwoList: res.data + }) + } else { + _self.setData({ + catalogThirdList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + // 选中了条目 + selectItem(e) { + let _self = this + let { + type, + item, + index + } = e.currentTarget.dataset + if (type == '1') { + _self.data.catalogOneList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogOneList: _self.data.catalogOneList, + catalogTwoList: [], + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '2', item.code) + } else if (type == '2') { + _self.data.catalogTwoList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + } else { + el.isSel = false + } + }) + _self.setData({ + catalogTwoList: _self.data.catalogTwoList, + catalogThirdList: [] + }) + _self.getCatalogList(item.id, '3', item.code) + } else { + _self.data.catalogThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = true + this.setData({ + selCatalogId: el.id, + selCatalogName: el.name + }) + } else { + el.isSel = false + } + }) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + } + }, + toAddPage() { + wx.navigateTo({ + url: './addcatalog', + }) + }, + //刷新列表 + dorefreshList() { + this.setData({ + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + isRefreshing: true, + currentPage: 1 + }) + this.getCatalogList(0, 1, 0) + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.json b/pages/mine/product/productmanage/choosecatalog.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.wxml b/pages/mine/product/productmanage/choosecatalog.wxml new file mode 100755 index 0000000..a847001 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.wxml @@ -0,0 +1,88 @@ + + + 商品类目 + + + + + + + 当前选中类别:{{selCatalogName}} + + + + + + + 商品类目(一级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(二级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 商品类目(三级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/choosecatalog.wxss b/pages/mine/product/productmanage/choosecatalog.wxss new file mode 100755 index 0000000..5a20666 --- /dev/null +++ b/pages/mine/product/productmanage/choosecatalog.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/choosecatalog.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.js b/pages/mine/product/productmanage/productlist.js new file mode 100755 index 0000000..c1de860 --- /dev/null +++ b/pages/mine/product/productmanage/productlist.js @@ -0,0 +1,322 @@ +// pages/mine/product/productmanage/productlist.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + productList: [], + isRefreshing: false, + currentPage: 1, + totalSize: 0, + shopId: '', + isAddPage: false, + isCatalogPage: false, + activeNames: ['0'], + baseImageUrl: app.urls.baseImgUrl, + currentCatalogId: '', + curIndex: 0, + active: 1, + curGoodsList: [], + contentHeight: app.globalData.windowHeight - app.globalData.CustomBar, + isLoadMore: false, + hasMore: true + }, + /** + * 切换类目 + */ + switchRightTap(e) { + let curindex = parseInt(e.currentTarget.dataset.curindex); + this.data.productList[curindex].goodsList = [] + this.setData({ + currentPage: 1, + hasMore: true, + isLoadMore: false, + curIndex: curindex + }) + let item = this.data.productList[curindex] + //根据类目的类型来判断添加商品还是优惠券 2是优惠券 + if (item.coupon == '2') { + this.getCouponListByCid(item.categoryId) + } else { + this.getGoodsListByCId(item.categoryId) + } + }, + //获取优惠券列表 + getCouponListByCid(id) { + + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopCatalogList(this.data.shopId) + }, + //获取店铺所有商品类目 + getShopCatalogList(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getCatalogThirdList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //添加类目 + addCategory() { + wx.navigateTo({ + url: '/pages/mine/product/catalogmanage/addcatalog', + }) + }, + //添加 + doAdd(e) { + let key = e.currentTarget.dataset.key + if ('chooseCatalog' == key) { + wx.navigateTo({ + url: './choosecatalog?shopId=' + this.data.shopId, + }) + } else { + var item = e.currentTarget.dataset.item + if (item.coupon == '2') { + wx.navigateTo({ + url: '/pages/mine/product/coupon/addcoupon?shopId=' + this.data.shopId + '&cataLogId=' + item.categoryId, + }) + } else { + wx.navigateTo({ + url: './addproduct?shopId=' + this.data.shopId + '&cataLogId=' + item.categoryId, + }) + } + } + }, + //管理商品 + manageGoods(e) { + wx.navigateTo({ + url: './productmanage?shopId=' + e.currentTarget.dataset.item.shopId + '&shopGoodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + /** + * 获取商品列表 + */ + getGoodsList(shopId) { + wx.showLoading({ + title: '加载中...', + }) + app.htt.get(app.urls.getShopGoodsList.format({ + shopId: shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setData({ + isRefreshing: false + }) + this.buildDatas(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //构建数据 + buildDatas(data) { + let _self = this + if (data.length > 0) { + data.forEach(el => { + el.goodsList = [] + _self.data.productList.push(el) + }) + _self.setData({ + curIndex: 0, + productList: _self.data.productList + }) + _self.getGoodsListByCId(_self.data.productList[0].categoryId) + } + }, + //去除重复的 + unique(rows) { + let temp = rows.concat() + let tempList = [] + for (var i = 0; i < temp.length; i++) { + for (var j = i + 1; j < temp.length; j++) { + if (temp[i].categoryId == temp[j].categoryId) { + temp.splice(j, 1); + j-- + } + } + } + temp.forEach(el => { + tempList.push({ + name: el.categoryName, + id: el.categoryId, + goods: [] + }) + }) + return tempList + }, + //刷新页面 + dorefreshList() { + this.setData({ + currentPage: 1, + isLoadMore: false, + hasMore: true, + productList: [] + }) + this.getShopCatalogList(this.data.shopId) + }, + doRecover() { + wx.navigateTo({ + url: '/pages/mine/product/recycle/productrecycle', + }) + }, + onShow() { + if (this.data.isAddPage) { + this.setData({ + isAddPage: false + }) + this.dorefreshList() + } + }, + //根据类目ID获取商品 + getGoodsListByCId(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getGoodsByCatalogAndShop.format({ + categoryId: id + }), { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + if (res.data.rows.length > 0) { + _self.data.productList.forEach(el => { + if (el.categoryId == id) { + el.goodsList = el.goodsList.concat(res.data.rows) + } + }) + _self.setData({ + productList: _self.data.productList + }) + } else { + _self.setData({ + hasMore: false + }) + } + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isLoadMore: false + }) + }) + }, + onChange(e) { + let _self = this + let item = e.currentTarget.dataset.item + console.log(item) + this.setData({ + activeNames: e.detail, + currentCatalogId: item.categoryId + }) + console.log(e) + if (e.detail.length > 1) { + //展开 + if (item.goodsList || item.goodsList.length <= 0) { + _self.getGoodsListByCId(item.categoryId) + } + } + }, + doSearchGoods() { + wx.navigateTo({ + url: './searchproduct?shopId=' + this.data.shopId, + }) + }, + //加载更多 + doLoadMore(e) { + let _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + let item = _self.data.productList[_self.data.curIndex] + _self.setData({ + isLoadMore: true, + currentPage: ++_self.data.currentPage + }) + _self.getGoodsListByCId(item.categoryId) + } else { + wx.showToast({ + title: '暂无更多数据', + icon: 'none', + duration: 500 + }) + } + }, + doDelCategory(e) { + let _self = this + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelShopCategoryById.format({ + ids: e.currentTarget.dataset.item.categoryId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + productList: [] + }) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + _self.getShopCatalogList(_self.data.shopId) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showConfirmDialog(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该类目吗?(删除后该类目下所有商品将删除!)', + success(res) { + if (res.confirm) { + _self.doDelCategory(e) + } + } + }) + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.json b/pages/mine/product/productmanage/productlist.json new file mode 100755 index 0000000..438d942 --- /dev/null +++ b/pages/mine/product/productmanage/productlist.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-loading": "/vant/dist/loading/index" + } +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.wxml b/pages/mine/product/productmanage/productlist.wxml new file mode 100755 index 0000000..d304b69 --- /dev/null +++ b/pages/mine/product/productmanage/productlist.wxml @@ -0,0 +1,68 @@ + + + 商品管理 + + + + + 请输入搜索关键字,例如:手机 + + + + + + + + + + + + + + + {{item.categoryName}} + + + + + + + + + + + + + + + + + + + {{item.goodsStatus=='1' ? '在售' : '下架' }} + + + + {{item.goodsName}} + + + + {{item.goodsSummary}} + + + ¥:{{item.goodsUnitPrice}} + + 库存:{{item.goodsTotal > 1000 ? '999+' : item.goodsTotal}} + + + + + 加载中... + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/productlist.wxss b/pages/mine/product/productmanage/productlist.wxss new file mode 100755 index 0000000..0fad7cd --- /dev/null +++ b/pages/mine/product/productmanage/productlist.wxss @@ -0,0 +1,98 @@ +/* pages/mine/product/productmanage/productlist.wxss */ +page { + padding-top: 80rpx; +} + +/* pages/category/index.wxss */ +.category { + display: flex; + flex-direction: row; + height: 100%; + margin-bottom: 80rpx; +} + +.nav_left { + background: #f8f8f8; + width: 30%; + height: 100%; + white-space: nowrap; +} + +.nav_right { + background: #fff; + width: 70%; + height: 100%; +} + +.nav_left_bg { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 10rpx; + background: #f8f8f8; + position: relative; +} + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.nav_left_items { + font-size: 28rpx; + color: #333; + height: 100rpx; + line-height: 100rpx; + text-align: center; +} + +.nav_left_border { + border-left-color: #0054bd; + border-left-width: 2px; + border-left-style: solid; +} + +.nav_left_item-active { + background-color: #fff; + color: #0054bd; +} + +.jd-category { + margin: 40rpx 16rpx 0; +} + +.jd-category-wrap { + overflow: hidden; + padding: 20rpx 20rpx 0; +} + +.jd-category .title { + font-size: 28rpx; + height: 60rpx; + line-height: 30rpx; + font-weight: 700; + color: #080808 +} + +.jd-category-style { + width: 32.8%; + float: left; + display: flex; + flex-direction: column; + justify-content: center; +} + +.list_img { + width: 150rpx; + height: 150rpx; +} + +.list_text { + text-align: center; + font-size: 24rpx; + color: #686868; + margin-top: 10rpx; + height: 70rpx; +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.js b/pages/mine/product/productmanage/productmanage.js new file mode 100755 index 0000000..8212660 --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.js @@ -0,0 +1,520 @@ +// pages/mine/product/productmanage/productmanage.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + goodsId: '', + goodsBean: null, + shopId: '', + cataLogId: '', //上级页面传递 + goodsName: '', //商品名称 + goodsCount: 0, //商品数量 + goodsPrice: 0.00, //商品单价 + goodsUnit: '', //商品单位 + goodsStatus: 1, //商品状态 1 上架 2 下架 + goodsPay: 1, //支付方式 1 线上 2 线下 + goodsLogoPhotos: [], //商品Logo + goodsPhotos: [], //商品图片 + goodsVideos: [], //商品视频 + goodsSummary: '', //商品说明 + goodsOrder: 0, //商品排序 + categoryName: '请选择类目', + isPopular: false, + categoryList: [], //商品类目 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + goodsId: options.shopGoodsId + }) + this.getGoodsDetail(this.data.goodsId) + this.getCategoryList() + }, + //获取商品类目 + getCategoryList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getCatalogThirdList, { + header: { + token: app.globalData.token + }, + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(el => { + el.isSel = false + }) + _self.setData({ + categoryList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //类目切换 + selCategory(e) { + var _self = this + var index = e.detail.value + _self.setData({ + cataLogId: _self.data.categoryList[index].categoryId, + categoryName: _self.data.categoryList[index].categoryName + }) + }, + //获取商品详情 + getGoodsDetail(id) { + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getGoodsDetail.format({ + goodsId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + this.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + selGoodsPopular(e) { + console.log(e) + this.setData({ + isPopular: e.detail.value + }) + }, + setDataToView(data) { + console.log(data) + let _self = this + if (data.goodsPhotos != '') { + let ids = data.goodsPhotos + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.goodsPhotos.push({ + id: el, + path: app.urls.baseImgUrl + el + }) + } + }) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + if (data.goodsIcon != '') { + let ids = data.goodsIcon + _self.data.goodsLogoPhotos.push({ + id: ids, + path: app.urls.baseImgUrl + ids + }) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + + if (data.goodsVideo != '') { + let ids = data.goodsVideo + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.goodsVideos.push({ + id: el, + videoUrl: app.urls.baseImgUrl + el, + path: '/images/ic_video_default.png', + }) + } + }) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + this.setData({ + goodsBean: data, + shopId: data.shopId, + cataLogId: data.cataLogId, //上级页面传递 + goodsName: data.goodsName, //商品名称 + goodsCount: data.goodsTotal, //商品数量 + goodsPrice: data.goodsUnitPrice, //商品单价 + goodsUnit: data.goodsUnit, //商品单位 + goodsStatus: data.goodsStatus, //商品状态 1 上架 2 下架 + goodsPay: data.paymentType, //支付方式 1 线上 2 线下 + goodsSummary: data.goodsSummary, //商品说明 + goodsOrder: data.goodsSort, //商品排序 + isPopular: data.isPopular == '0' ? false : true, + categoryName: data.categoryName, //商品类目 + }) + }, + //商品状态切换 + selGoodsStatus(e) { + this.setData({ + goodsStatus: e.detail.value + }) + }, + //支付方式切换 + selGoodsPay(e) { + this.setData({ + goodsPay: e.detail.value + }) + }, + //输入框监听 + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + //商品说明 + goodsSummaryInput(e) { + this.setData({ + goodsSummary: e.detail.value + }) + }, + /** + * 添加图片、视频 1 logo 2 图片 + */ + chooseLogo() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + choosePhoto() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + /** + * 删除图片、视频 + */ + delLogo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsLogoPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsLogoPhotos: _self.data.goodsLogoPhotos + }) + } + } + }) + }, + delPhoto(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsPhotos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsPhotos: _self.data.goodsPhotos + }) + } + } + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.goodsVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + goodsVideos: _self.data.goodsVideos + }) + } + } + }) + }, + /** + * 预览图片、视频 + */ + viewLogo(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewPhoto(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + //上传图片 + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 1) { + let tempList = _self.data.goodsLogoPhotos.concat(item) + _self.setData({ + goodsLogoPhotos: tempList + }) + } else { + //图片 + let tempList = _self.data.goodsPhotos.concat(item) + _self.setData({ + goodsPhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = e.tempFiles[0].thumbTempFilePath + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.goodsVideos.concat(item) + _self.setData({ + goodsVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //修改 + doUpdate() { + if (this.checkParams()) { + let _self = this + wx.showLoading({ + title: '更新中...', + }) + let p = '' + _self.data.goodsPhotos.forEach(el => { + p += el.id + ',' + }) + if (p.length != '') { + p = p.substr(0, p.length - 1) + } + let videoId = '' + if (_self.data.goodsVideos.length > 0) { + videoId = _self.data.goodsVideos[0].id + } + app.http.put(app.urls.doUpdateGoods.format({ + shopGoodsId: _self.data.goodsId + }), { + header: { + token: app.globalData.token + }, + data: { + categoryId: _self.data.cataLogId, + goodsIcon: _self.data.goodsLogoPhotos[0].id, + goodsName: _self.data.goodsName, + goodsPhotos: p, + goodsSort: _self.data.goodsOrder, + goodsStatus: _self.data.goodsStatus, + goodsSummary: _self.data.goodsSummary, + goodsTotal: _self.data.goodsCount, + goodsUnit: _self.data.goodsUnit, + goodsUnitPrice: _self.data.goodsPrice, + goodsVideo: videoId, + paymentType: _self.data.goodsPay, + shopId: _self.data.shopId, + isPopular: _self.data.isPopular ? 1 : 0 + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '更新成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + doDelGoods() { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该商品吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelGoods.format({ + ids: _self.data.goodsId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + wx.navigateBack({}) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //校验参数合法性 + checkParams() { + if (this.data.goodsName == '') { + wx.showToast({ + title: '请输入商品名称', + icon: 'error' + }) + return false + } + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + + if (this.data.goodsCount == 0) { + wx.showToast({ + title: '请输入商品数量', + icon: 'error' + }) + return false + } + if (this.data.goodsUnit == '') { + wx.showToast({ + title: '请输入商品单位', + icon: 'error' + }) + return false + } + if (this.data.goodsLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品Logo', + icon: 'error' + }) + return false + } + if (this.data.goodsPhotos.length <= 0) { + wx.showToast({ + title: '请上传商品图片', + icon: 'error' + }) + return false + } + return true + } +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.json b/pages/mine/product/productmanage/productmanage.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.wxml b/pages/mine/product/productmanage/productmanage.wxml new file mode 100755 index 0000000..9bd18ba --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.wxml @@ -0,0 +1,180 @@ + + + 商品管理 + + + + + + 商品名称 + + + + + + + 是否热门 + + + + + + + + + 商品类目 + + + + + {{categoryName}} + + + + + + + + 商品数量 + + + + + + + 商品单价 + + + + + + + 商品单位 + + + + + + + + 商品状态 + + + 上架 + 下架 + + + + + + + + 支付方式 + + + 线上 + 线下 + + + + + + + 商品Logo + + + {{goodsLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品图片 + + + {{goodsPhotos.length}}/9 + + + + + + + + + + + + + + + + + + + 商品视频 + + + {{goodsVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 商品说明 + + + + + + + + + + + 商品排序 + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/productmanage.wxss b/pages/mine/product/productmanage/productmanage.wxss new file mode 100755 index 0000000..6c87c3c --- /dev/null +++ b/pages/mine/product/productmanage/productmanage.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/productmanage.wxss */ \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.js b/pages/mine/product/productmanage/searchproduct.js new file mode 100755 index 0000000..07d870d --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.js @@ -0,0 +1,102 @@ +// pages/mine/product/productmanage/searchproduct.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + CustomBar: app.globalData.CustomBar, + goodsList: [], + baseImageUrl: app.urls.baseImgUrl, + shopId: '', + countTime: 2000, //延迟搜索 时间 + searchWaiting: false, //是否等待搜索倒计时中, + searchKey: '' + }, + /** + * 获取商品列表 + */ + getGoodsList(keywords) { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getShopGoodsList.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + }, + data: { + keywords: keywords + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + _self.setData({ + goodsList: res.data.rows + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + }, + manageGoods(e) { + wx.navigateTo({ + url: './productmanage?shopGoodsId=' + e.currentTarget.dataset.item.goodsId, + }) + }, + searchGoods(e) { + this.setData({ + countTime: 2000, + searchKey: e.detail.value, + }) + //是否处于搜索倒计时中 + if (!this.data.searchWaiting) { + this.timer(); + } + }, + /** + * 延迟搜索 + */ + timer() { + var that = this; + this.setData({ + searchWaiting: true + }) + + let promise = new Promise((resolve, reject) => { + let setTimer = setInterval( + () => { + console.log('搜索倒计时: ' + that.data.countTime); + this.setData({ + countTime: this.data.countTime - 1000 + }) + if (this.data.countTime <= 0) { + console.log('开始搜索: ' + that.data.params); + this.setData({ + countTime: 2000, + searchWaiting: false, + }) + resolve(setTimer) + } + }, 1000) + }) + promise.then((setTimer) => { + this.getGoodsList(this.data.searchKey) + clearInterval(setTimer) //清除计时器 + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.json b/pages/mine/product/productmanage/searchproduct.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.wxml b/pages/mine/product/productmanage/searchproduct.wxml new file mode 100755 index 0000000..fef3c77 --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.wxml @@ -0,0 +1,33 @@ + + 商品搜索 + + + + + + + + + + + + + {{good.goodsStatus=='1' ? '在售' : '下架' }} + + + + {{good.goodsName}} + + + {{good.goodsSummary}} + + + + + 库存:{{good.goodsTotal > 1000 ? '999+' : good.goodsTotal}} + 单价:{{good.goodsUnitPrice}} + + + + + \ No newline at end of file diff --git a/pages/mine/product/productmanage/searchproduct.wxss b/pages/mine/product/productmanage/searchproduct.wxss new file mode 100755 index 0000000..fd4e82f --- /dev/null +++ b/pages/mine/product/productmanage/searchproduct.wxss @@ -0,0 +1 @@ +/* pages/mine/product/productmanage/searchproduct.wxss */ \ No newline at end of file diff --git a/pages/mine/product/recycle/catagoryrecycle.js b/pages/mine/product/recycle/catagoryrecycle.js new file mode 100755 index 0000000..88b4d27 --- /dev/null +++ b/pages/mine/product/recycle/catagoryrecycle.js @@ -0,0 +1,296 @@ +// pages/mine/product/catalogmanage/catalogmanage.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + catalogList: [], + currentPage: 1, + isRefreshing: false, + activeNames: ['0'], + catalogOneList: [], //一级类目 + catalogTwoList: [], //二级类目 + catalogThirdList: [], //三级类目 + selectItems: [], //选中的行业, + selectItemNames: '', + isAddPage: false //用来判断是否需要刷新页面 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCatalogList() + }, + //获取店铺商品类目 + getCatalogList() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getRecycleCategoryList, { + header: { + token: app.globalData.token + }, + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + res.data.forEach(el => { + el.isSel = false + }) + _self.setData({ + catalogThirdList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + //清除全部 + toClearAll() { + if (this.data.catalogThirdList.length > 0) { + let _self = this + wx.showModal({ + title: '警告', + content: '删除后会删除该类目下所有商品,确定要删除该类目吗?', + success(res) { + if (res.confirm) { + var ids = '' + _self.data.catalogThirdList.forEach(it => { + ids += it.categoryId + ',' + }) + ids = ids.slice(0, ids.length - 1) + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCatalogRecycle.format({ + ids: ids + }), { + header: { + token: app.globalData.token, + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success', + success() { + _self.dorefreshList() + } + }) + + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + } else { + wx.showToast({ + title: '回收站空空如也', + }) + } + }, + //删除选中的 + toDelSel() { + var _self = this + var ids = '' + _self.data.catalogThirdList.forEach(it => { + if (it.isSel) { + ids += it.categoryId + ',' + } + }) + if (ids.length > 0) { + ids = ids.slice(0, ids.length - 1) + wx.showModal({ + title: '警告', + content: '删除后会删除该类目下所有商品,确定要删除该类目吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCatalogRecycle.format({ + ids: ids + }), { + header: { + token: app.globalData.token, + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success', + success() { + _self.dorefreshList() + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + } else { + wx.showToast({ + title: '请选择要删除的类目', + }) + } + }, + //删除单条 + toDel(e) { + var item = e.currentTarget.dataset.item + var index = e.currentTarget.dataset.index + let _self = this + wx.showModal({ + title: '警告', + content: '删除后会删除该类目下所有商品,确定要删除该类目吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelCatalogRecycle.format({ + ids: item.categoryId + }), { + header: { + token: app.globalData.token, + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'success', + success() { + _self.dorefreshList() + } + }) + + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //恢复单个 + toRecoverOne(e) { + var item = e.currentTarget.dataset.item + var _self = this + wx.showLoading({ + title: '恢复中...', + }) + app.http.put(app.urls.doRecoverCatelog.format({ + ids: item.categoryId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '恢复成功', + success() { + _self.dorefreshList() + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //恢复全部 + toRecoverAll() { + var _self = this + if (_self.data.catalogThirdList.length > 0) { + var ids = '' + var _self = this + _self.data.catalogThirdList.forEach(it => { + ids += it.categoryId + "," + }) + ids = ids.slice(0, ids.length - 1) + wx.showLoading({ + title: '恢复中...', + }) + app.http.put(app.urls.doRecoverCatelog.format({ + ids: ids + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '恢复成功', + success() { + _self.dorefreshList() + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } else { + wx.showToast({ + title: '回收站空空如也', + }) + } + }, + //刷新列表 + dorefreshList() { + this.setData({ + catalogThirdList: [], //三级类目 + isRefreshing: true, + currentPage: 1 + }) + this.getCatalogList() + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let _self = this + if (_self.data.isAddPage) { + _self.dorefreshList() + } + }, + doEdit(e) { + var item = e.currentTarget.dataset.item + wx.navigateTo({ + url: './catalogedit?catalogId=' + item.id, + }) + }, + // 选中了条目 + selectItem(e) { + let _self = this + let { + type, + item, + index + } = e.currentTarget.dataset + _self.data.catalogThirdList.forEach(el => { + if (el.categoryId == item.categoryId) { + el.isSel = !item.isSel + } + }) + _self.setData({ + catalogThirdList: _self.data.catalogThirdList + }) + }, +}) \ No newline at end of file diff --git a/pages/mine/product/recycle/catagoryrecycle.json b/pages/mine/product/recycle/catagoryrecycle.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/recycle/catagoryrecycle.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/recycle/catagoryrecycle.wxml b/pages/mine/product/recycle/catagoryrecycle.wxml new file mode 100755 index 0000000..e803bf6 --- /dev/null +++ b/pages/mine/product/recycle/catagoryrecycle.wxml @@ -0,0 +1,39 @@ + + + 类目回收站 + + + + + + + + + + + + {{item.categoryName}} + + + 删除 + + + 恢复 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/recycle/catagoryrecycle.wxss b/pages/mine/product/recycle/catagoryrecycle.wxss new file mode 100755 index 0000000..bf97caa --- /dev/null +++ b/pages/mine/product/recycle/catagoryrecycle.wxss @@ -0,0 +1 @@ +/* pages/mine/product/recycle/catagoryrecycle.wxss */ \ No newline at end of file diff --git a/pages/mine/product/recycle/productrecycle.js b/pages/mine/product/recycle/productrecycle.js new file mode 100755 index 0000000..7ddc4c3 --- /dev/null +++ b/pages/mine/product/recycle/productrecycle.js @@ -0,0 +1,166 @@ +// pages/mine/product/recycle/productrecycle.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + goodsList: [], //回收站商品 + isRefreshing: false, + baseImageUrl: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getList() + }, + getList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getRecycleGoodsList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + goodsList: res.data, + isRefreshing: false + }) + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + isRefreshing: false + }) + }) + }, + //删除一个 + doDelOne(e) { + var _self = this + var item = e.currentTarget.dataset.item + wx.showModal({ + title: '警告', + content: '删除商品将无法找回,请确认要删除吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelRecycleGoods.format({ + ids: item.goodsId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + icon: 'none', + success() { + _self.dorefreshList() + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //清除全部 + doClearAll() { + var _self = this + if (_self.data.goodsList.length > 0) { + wx.showModal({ + title: '警告', + content: '删除商品将无法找回,确认要清空回收站吗?', + success(res) { + if (res.confirm) { + var ids = '' + _self.data.goodsList.forEach(it => { + ids += it.goodsId + ',' + }) + wx.showLoading({ + title: '删除中...', + }) + ids = ids.slice(0, ids.length - 1) + app.http.delete(app.urls.doDelRecycleGoods.format({ + ids: ids + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + success() { + _self.dorefreshList() + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + } else { + wx.showToast({ + title: '回收站空空如也', + icon: 'none' + }) + } + }, + //恢复一个 + doRecoverOne(e) { + var item = e.currentTarget.dataset.item + var _self = this + wx.showLoading({ + title: '恢复中...', + }) + app.http.put(app.urls.doRecoverGoods.format({ + ids: item.goodsId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '恢复成功', + success() { + _self.dorefreshList() + } + }) + var pages = getCurrentPages(); //当前页面 + var beforePage = pages[pages.length - 2]; //前一页 + beforePage.setData({ + isAddPage: true + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //刷新列表 + dorefreshList() { + this.setData({ + goodsList: [], //三级类目 + isRefreshing: true, + }) + this.getList() + }, +}) \ No newline at end of file diff --git a/pages/mine/product/recycle/productrecycle.json b/pages/mine/product/recycle/productrecycle.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/product/recycle/productrecycle.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/product/recycle/productrecycle.wxml b/pages/mine/product/recycle/productrecycle.wxml new file mode 100755 index 0000000..fcbb830 --- /dev/null +++ b/pages/mine/product/recycle/productrecycle.wxml @@ -0,0 +1,39 @@ + + + 商品回收站 + + + + + + + + + + {{item.goodsName}} + + + {{item.goodsSummary}} + + + ¥:{{item.goodsUnitPrice}} + + 所属类目:{{item.categoryName}} + + + + + + 删除 + 恢复 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/product/recycle/productrecycle.wxss b/pages/mine/product/recycle/productrecycle.wxss new file mode 100755 index 0000000..ace1462 --- /dev/null +++ b/pages/mine/product/recycle/productrecycle.wxss @@ -0,0 +1,12 @@ +/* pages/mine/product/recycle/productrecycle.wxss */ +.btn-box { + width: 100%; + display: flex; + flex-direction: row; + justify-content: flex-end; + padding: 10rpx; +} + +.btn { + padding: 10rpx 40rpx; +} \ No newline at end of file diff --git a/pages/mine/setting/columnsetting.js b/pages/mine/setting/columnsetting.js new file mode 100755 index 0000000..fe45a92 --- /dev/null +++ b/pages/mine/setting/columnsetting.js @@ -0,0 +1,404 @@ +// pages/mine/setting/columnsetting.js +const app = getApp() +Page({ + data: { + activeNames: ['1'], + curIndex: 0, + menuList: [], + imgUrl: app.urls.baseImgUrl, + inputColumnName: '', + isShowInput: false, + curId: '', + curIndex: 0, + curIdx: 0, + pageInfo: { + rowHeight: 64, + scrollHeight: 85, + startIndex: null, + scrollY: true, + readyPlaceIndex: null, + startY: 0, + selectedIndex: null, + startIdx: null, + selectedIdx: null + }, + movableViewInfo: { + y: 0, + showClass: 'none', + data: {} + }, + pageInfoX: { + rowWidth: 96, + scrollHeight: 85, + startIndex: null, + scrollX: true, + readyPlaceIndex: null, + startX: 0, + selectedIndex: null, + startIdx: null, + selectedIdx: null + }, + movableViewInfoX: { + x: 0, + showClass: 'none', + data: {} + }, + }, + onLoad: function (options) { + this.getColumnList() + try { + var isFrist = wx.getStorageSync('isFirst') + if (isFrist) { + + } else { + wx.setStorage({ + key: 'isFirst', + data: true + }) + wx.showModal({ + title: '提示', + content: '点击列表条目名称可以自定义栏目名称,点击开关可以控制是否在首页展示该条目.', + showCancel: false, + success(res) { + + } + }) + } + } catch (err) { + console.log('获取失败') + wx.showModal({ + title: '提示', + content: '点击列表条目名称可以自定义栏目名称,点击开关可以控制是否在首页展示该条目.', + showCancel: false, + success(res) { + + } + }) + } + }, + getColumnList() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getMineColumnList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + var data = res.data + wx.hideLoading({}) + data.forEach((it, index) => { + it.phoneOrder = index + }) + _self.setData({ + menuList: data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //保存我的栏目是否显示 + doSaveColumnDisplay(e) { + // configColumnId + var id = e.currentTarget.dataset.id + var index = e.currentTarget.dataset.index + var idx = e.currentTarget.dataset.idx + console.log(id + '===' + idx + '===' + index) + var _self = this + wx.showLoading({ + title: '保存中...', + }) + app.http.post(app.urls.doSaveColumnDisplay, { + header: { + token: app.globalData.token + }, + data: { + configColumnId: id + } + }) + .then(res => { + wx.hideLoading({}) + var setMode = _self.data.menuList[index].configColumnList[idx].configColumnSet + if (setMode == '0') { + setMode = '1' + } else { + setMode = '0' + } + _self.data.menuList[index].configColumnList[idx].configColumnSet = setMode + _self.setData({ + menuList: _self.data.menuList + }) + }) + .catch(err => { + console.log(err) + wx.hideLoading({}) + wx.showToast({ + title: '保存失败', + icon: 'error' + }) + }) + }, + //保存我的栏目名称 + doSaveColumnName() { + var _self = this + wx.showLoading({ + title: '修改中...', + }) + app.http.post(app.urls.doSaveColumnName, { + header: { + token: app.globalData.token + }, + data: { + configColumnId: _self.data.curId, + configColumnName: _self.data.inputColumnName + } + }) + .then(res => { + wx.hideLoading({}) + _self.data.menuList[_self.data.curIndex].configColumnList[_self.data.curIdx].configColumnRemark = _self.data.menuList[_self.data.curIndex].configColumnList[_self.data.curIdx].configColumnName + _self.data.menuList[_self.data.curIndex].configColumnList[_self.data.curIdx].configColumnName = _self.data.inputColumnName + // 刷新数据 + _self.setData({ + menuList: _self.data.menuList, + inputColumnName: '', + }) + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '修改失败', + icon: 'error' + }) + }) + }, + showInput(e) { + var id = e.currentTarget.dataset.id //栏目 + var index = e.currentTarget.dataset.index //栏目组 + var idx = e.currentTarget.dataset.idx //栏目 + this.setData({ + isShowInput: true, + curId: id, + curIndex: index, + curIdx: idx + }) + }, + //保存自定义栏目名称 + addName(e) { + var _self = this + _self.setData({ + isShowInput: false, + }) + _self.doSaveColumnName() + }, + //栏目名称输入监听 + textInput(e) { + this.setData({ + inputColumnName: e.detail.value + }) + }, + onHide(e) { + this.setData({ + isShowInput: false + }) + }, + dragStart: function (event) { + var startIndex = event.currentTarget.dataset.index + var startIdx = event.currentTarget.dataset.idx + console.log('获取到的元素为', this.data.menuList[startIndex].configColumnList[startIdx]) + // 初始化页面数据 + var pageInfo = this.data.pageInfo + pageInfo.startY = event.touches[0].clientY + pageInfo.readyPlaceIndex = startIndex + pageInfo.selectedIndex = startIndex + pageInfo.selectedIdx = startIdx + pageInfo.scrollY = false + pageInfo.startIndex = startIndex + pageInfo.startIdx = startIdx + this.setData({ + 'movableViewInfo.y': pageInfo.startY - (pageInfo.rowHeight / 2) + }) + // 初始化拖动控件数据 + var movableViewInfo = this.data.movableViewInfo + movableViewInfo.data = this.data.menuList[startIndex].configColumnList[startIdx] + movableViewInfo.showClass = "inline" + + this.setData({ + movableViewInfo: movableViewInfo, + pageInfo: pageInfo + }) + }, + + dragMove: function (event) { + var optionList = this.data.menuList + var pageInfo = this.data.pageInfo + // 计算拖拽距离 + var movableViewInfo = this.data.movableViewInfo + var movedDistance = event.touches[0].clientY - pageInfo.startY + movableViewInfo.y = pageInfo.startY - (pageInfo.rowHeight / 2) + movedDistance + console.log('移动的距离为', movedDistance) + + // 修改预计放置位置 + var movedIndex = parseInt(movedDistance / pageInfo.rowHeight) + var readyPlaceIndex = pageInfo.startIdx + movedIndex + if (readyPlaceIndex < 0) { + readyPlaceIndex = 0 + } else if (readyPlaceIndex >= optionList[pageInfo.selectedIndex].configColumnList.length) { + readyPlaceIndex = optionList[pageInfo.selectedIndex].configColumnList.length - 1 + } + + if (readyPlaceIndex != pageInfo.selectedIdx) { + var selectedData = optionList[pageInfo.selectedIndex].configColumnList[pageInfo.selectedIdx] + + optionList[pageInfo.selectedIndex].configColumnList.splice(pageInfo.selectedIdx, 1) + optionList[pageInfo.selectedIndex].configColumnList.splice(readyPlaceIndex, 0, selectedData) + pageInfo.selectedIdx = readyPlaceIndex + } + // 移动movableView + pageInfo.readyPlaceIndex = readyPlaceIndex + // console.log('移动到了索引', readyPlaceIndex, '选项为', optionList[readyPlaceIndex]) + + this.setData({ + movableViewInfo: movableViewInfo, + menuList: optionList, + pageInfo: pageInfo + }) + }, + + dragEnd: function (event) { + // 重置页面数据 + var pageInfo = this.data.pageInfo + var order = order = pageInfo.readyPlaceIndex + 1 + this.doSaveOrder(pageInfo.selectedIndex) + pageInfo.readyPlaceIndex = null + pageInfo.startY = null + pageInfo.selectedIndex = null + pageInfo.selectedIdx = null + pageInfo.startIndex = null + pageInfo.startIdx = null + pageInfo.scrollY = true + // 隐藏movableView + var movableViewInfo = this.data.movableViewInfo + movableViewInfo.showClass = 'none' + + this.setData({ + pageInfo: pageInfo, + movableViewInfo: movableViewInfo + }) + }, + dragStartX(e) { + var startIndex = e.currentTarget.dataset.index + var startIdx = e.currentTarget.dataset.idx + console.log('获取到的元素为', this.data.menuList[startIndex].configColumnList[startIdx]) + // 初始化页面数据 + var pageInfo = this.data.pageInfoX + pageInfo.startX = e.touches[0].clientX + console.log(pageInfo.startX) + pageInfo.readyPlaceIndex = startIndex + pageInfo.selectedIndex = startIndex + pageInfo.selectedIdx = startIdx + pageInfo.scrollX = false + pageInfo.startIndex = startIndex + pageInfo.startIdx = startIdx + this.setData({ + 'movableViewInfoX.x': pageInfo.startX - (pageInfo.rowWidth / 2) + }) + // 初始化拖动控件数据 + var movableViewInfo = this.data.movableViewInfoX + movableViewInfo.data = this.data.menuList[startIndex].configColumnList[startIdx] + movableViewInfo.showClass = "inline" + console.log(movableViewInfo) + this.setData({ + movableViewInfoX: movableViewInfo, + pageInfoX: pageInfo + }) + }, + dragMoveX(event) { + var optionList = this.data.menuList + var pageInfo = this.data.pageInfoX + // 计算拖拽距离 + var movableViewInfo = this.data.movableViewInfoX + var movedDistance = event.touches[0].clientX - pageInfo.startX + movableViewInfo.x = pageInfo.startX - (pageInfo.rowWidth / 2) + movedDistance + console.log('移动的距离为', movedDistance) + + // 修改预计放置位置 + var movedIndex = parseInt(movedDistance / pageInfo.rowWidth) + var readyPlaceIndex = pageInfo.startIdx + movedIndex + if (readyPlaceIndex < 0) { + readyPlaceIndex = 0 + } else if (readyPlaceIndex >= optionList[pageInfo.selectedIndex].configColumnList.length) { + readyPlaceIndex = optionList[pageInfo.selectedIndex].configColumnList.length - 1 + } + + if (readyPlaceIndex != pageInfo.selectedIdx) { + var selectedData = optionList[pageInfo.selectedIndex].configColumnList[pageInfo.selectedIdx] + + optionList[pageInfo.selectedIndex].configColumnList.splice(pageInfo.selectedIdx, 1) + optionList[pageInfo.selectedIndex].configColumnList.splice(readyPlaceIndex, 0, selectedData) + pageInfo.selectedIdx = readyPlaceIndex + } + // 移动movableView + pageInfo.readyPlaceIndex = readyPlaceIndex + // console.log('移动到了索引', readyPlaceIndex, '选项为', optionList[readyPlaceIndex]) + + this.setData({ + movableViewInfoX: movableViewInfo, + menuList: optionList, + pageInfoX: pageInfo + }) + }, + dragEndX(e) { + // 重置页面数据 + var pageInfo = this.data.pageInfoX + // var order = order = pageInfo.readyPlaceIndex + 1 + // this.doSaveOrder(order, this.data.movableViewInfo.data.configColumnId) + pageInfo.readyPlaceIndex = null + pageInfo.startX = null + pageInfo.selectedIndex = null + pageInfo.selectedIdx = null + pageInfo.startIndex = null + pageInfo.startIdx = null + pageInfo.scrollY = true + // 隐藏movableView + var movableViewInfo = this.data.movableViewInfoX + movableViewInfo.showClass = 'none' + + this.setData({ + pageInfoX: pageInfo, + movableViewInfoX: movableViewInfo + }) + }, + + //保存排序 + doSaveOrder(index) { + wx.showLoading({ + title: '保存中...', + }) + var _self = this + + var orders = {} + _self.data.menuList[index].configColumnList.forEach((it, index) => { + orders[it.configColumnId] = index + 1 + }) + app.http.post(app.urls.doOrderColumn, { + header: { + token: app.globalData.token + }, + data: { + configColumnOrder: orders + } + }) + .then(res => { + wx.hideLoading({}) + }) + .catch(err => {}) + }, + onChange(e) { + this.setData({ + activeNames: e.detail + }) + } +}) \ No newline at end of file diff --git a/pages/mine/setting/columnsetting.json b/pages/mine/setting/columnsetting.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/setting/columnsetting.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/setting/columnsetting.wxml b/pages/mine/setting/columnsetting.wxml new file mode 100755 index 0000000..2958232 --- /dev/null +++ b/pages/mine/setting/columnsetting.wxml @@ -0,0 +1,122 @@ + + 设置 + + + + + 1.可以通过点击条目名称来修改栏目名称\n2.选择开关用来关闭/开启栏目的展示\n3.拖动排序按钮来进行排列条目的展示顺序\n + + + + + + + + + {{group.configColumnGroupName}} + + + + + + + + {{movableViewInfoX.data.configColumnName}} + + + + + + + + + + + + + {{item.configColumnName}} + + + + + + + + + {{group.configColumnGroupName}} + + + + + + {{movableViewInfo.data.configColumnName}} + 原名称:{{movableViewInfo.data.configColumnRemark}} + + + + + + + + + + + + + + + {{item.configColumnName}} + 原名称:{{item.configColumnRemark}} + + + + + + + + + + + + + + + + + + + + + + 保存 + + \ No newline at end of file diff --git a/pages/mine/setting/columnsetting.wxss b/pages/mine/setting/columnsetting.wxss new file mode 100755 index 0000000..4dd19c3 --- /dev/null +++ b/pages/mine/setting/columnsetting.wxss @@ -0,0 +1,109 @@ +/* pages/mine/setting/columnsetting.wxss */ + +.scroll-content { + width: 100%; + display: flex; + flex-direction: column; + padding: 0rpx 15rpx 15rpx 15rpx; +} + + +.item-box { + display: flex; + flex-direction: row; + width: 100%; + align-items: center; + height: 128rpx; + background-color: #ffffff; + padding: 15rpx; + border-bottom: 1rpx solid #f2f2f2; + justify-content: space-between; +} + +.item-box-move { + display: flex; + flex-direction: row; + margin: 0rpx 15rpx; + width: 100%; + align-items: center; + background-color: #ffffff; + padding: 15rpx; + border-bottom: 1rpx solid #f2f2f2; + justify-content: space-between; +} + +.item-img { + width: 96rpx; + height: 96rpx; +} + +.item-content { + display: flex; + flex-direction: column; + justify-content: center; + min-height: 128rpx; + padding: 15rpx; + width: 70%; +} + +.group-box { + margin-top: 15rpx; + background-color: #ffffff; +} + +.ver-box { + display: flex; + flex-direction: column; +} + +.ver-box-title { + font-size: 32rpx; + color: black; + padding: 15rpx 15rpx 0rpx 15rpx; +} + +.ver-box-list { + display: flex; + flex-direction: row; + padding-left: 15rpx; + align-items: flex-start; + justify-content: flex-start; + flex-wrap: wrap; +} + +.ver-box-items { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + margin: 15rpx 15rpx 15rpx 30rpx; +} + +.ver-box-items:nth-child(1) { + margin: 15rpx 15rpx 15rpx 0rpx; +} + +.ver-box-items image { + /* align-self: flex-start; */ + height: 96rpx; + width: 96rpx; + border-radius: 10rpx; +} + +.ver-box-items text { + margin-top: 15rpx; + max-width: 96rpx; + font-size: 24rpx; +} + +.movable-area { + position: absolute; + top: 0; + left: 0; + z-index: 10; + width: 96%; +} + +.movable-row { + box-shadow: #D9D9D9 0px 0px 20px; +} \ No newline at end of file diff --git a/pages/mine/shop/addshop.js b/pages/mine/shop/addshop.js new file mode 100755 index 0000000..be0839d --- /dev/null +++ b/pages/mine/shop/addshop.js @@ -0,0 +1,613 @@ +const app = getApp(); +Page({ + data: { + StatusBar: app.globalData.StatusBar, + CustomBar: app.globalData.CustomBar, + startDate: "", + endDate: "", + shopName: "", //商店名称 + shopAddress: "", //商店地址 + index: null, + date: '2021-08-08', //营业时间 + shopLicensePhotos: [], //商店营业执照 + shopLogoPhotos: [], //商店Logo + textareaBValue: '', //店铺简介, + isBusiness: true, //是否开业 + selTradeId: '', //行业类型 + shopVideos: [], //宣传视频 + selTemplateId: '1', + selTradeNames: '请选择行业', + areaList: [], //地区列表 + area2List: [], //二级区域 + area3List: [], //三级区域 + area1: '请选择省份', //一级区域 + area2: '请选择盟市', //一级区域 + area3: '请选择旗县区', //一级区域 + area1Id: '', + area2Id: '', + area3Id: '', + templeteList: [], //展示模板样式 + industryList: [], //行业 + picker: null, + imgUrl: app.urls.baseImgUrl + }, + onLoad(options) { + this.getShopList() + }, + getShopList() { + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getMineShopList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (res.data.rows.length > 0) { + //跳转商店详情 + wx.redirectTo({ + url: '/pages/mine/shop/mineshop?shopId=' + res.data.rows[0].shopId, + }) + } else { + //先判断是否有商店 + this.getAreaDiction('0', 1) + this.getIndesutryAll() + } + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '数据有误', + }) + wx.navigateBack({}) + }) + }, + getIndesutryAll() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getIndustryAll, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.buildIndustryData(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + buildIndustryData(data) { + var _self = this + var first = {} + var second = {} + + first.values = data + first.className = 'column1' + second.values = data[0].subList + second.className = 'column2' + second.defaultIndex = 0 + _self.data.industryList.push(first, second) + _self.setData({ + industryList: _self.data.industryList + }) + }, + onHide(e) { + this.setData({ + isShowIndustry: false + }) + }, + showChooseTrade(e) { + this.setData({ + isShowIndustry: true + }) + }, + onChange(event) { + var _self = this + const { + picker, + value, + index + } = event.detail; + _self.setData({ + picker: picker + }) + picker.setColumnValues(1, value[0].subList); + }, + confirmIndustry() { + //确定选择行业 + var _self = this + var value = _self.selectComponent('#picker').getValues() + if (value[1]) { + //获取行业模板 + _self.getTempleteList(value[1].industryId) + _self.setData({ + selTradeId: value[1].industryId, + selTradeNames: value[1].industryName, + isShowIndustry: false + }) + } else { + wx.showToast({ + title: '请选择行业', + }) + } + }, + cancelIndustry() { + //取消选择行业 + this.setData({ + isShowIndustry: false + }) + }, + getTempleteList(id) { + var _self = this + _self.setData({ + templeteList: [] + }) + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getTempleteList.format({ + industryId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(it => { + it.checked = false + }) + res.data[0].checked = true + _self.setData({ + templeteList: res.data, + selTemplateId: res.data[0].shopTemplateConfigId + }) + console.log(_self.data.templeteList) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + PickerChange(e) { + this.setData({ + index: e.detail.value + }) + }, + // 商店注册 + RegisterShop() { + if (this.checkParams()) { + wx.showLoading({ + title: '注册中...' + }) + let _self = this + let industryIds = _self.data.selTradeId + app.http.post(app.urls.doSaveShop, { + header: { + token: app.globalData.token + }, + data: { + shopName: _self.data.shopName, + shopAddress: _self.data.shopAddress, + shopSummary: _self.data.textareaBValue, + openDate: _self.data.date, + shopLogo: _self.data.shopLogoPhotos[0].id, + industryIds: industryIds, + shopTemplateId: _self.data.selTemplateId, + isOpen: _self.data.isBusiness ? '1' : '0', + shopVideo: _self.data.shopVideos.length > 0 ? _self.data.shopVideos[0].id : '', + area: _self.data.area1Id, + areaName: _self.data.area1, + areaCity: _self.data.area2Id, + areaCityName: _self.data.area2, + areaCounty: _self.data.area3Id, + areaCountyName: _self.data.area3, + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '注册成功', + icon: 'success', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //选择模板样式 + choosetemplate(e) { + this.setData({ + selTemplateId: e.detail.value + }) + }, + DateChange(e) { + this.setData({ + date: e.detail.value + }) + }, + + checkIsBusiness(e) { + this.setData({ + isBusiness: e.detail.value + }) + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //删除Logo + DelLogoP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLogoPhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLogoPhotos: this.data.shopLogoPhotos + }) + } + } + }) + }, + //删除营业执照 + DelLicenseP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 2) { + //Logo + let tempList = _self.data.shopLogoPhotos.concat(item) + _self.setData({ + shopLogoPhotos: tempList + }) + } else { + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.setData({ + shopLicensePhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + wx.showToast({ + title: '上传失败,请重试', + icon: 'none' + }) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + ViewLogoImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.shopVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + shopVideos: _self.data.shopVideos + }) + } + } + }) + }, + textareaBInput(e) { + this.setData({ + textareaBValue: e.detail.value + }) + }, + checkParams() { + var _self = this + if (_self.data.shopName == '') { + wx.showToast({ + title: '商店名称为必填项', + icon: 'none' + }) + return false + } + if (_self.data.area1Id == '') { + wx.showToast({ + title: '请选择省份', + icon: 'none' + }) + return false + } + if (_self.data.area2Id == '') { + wx.showToast({ + title: '请选择盟市', + icon: 'none' + }) + return false + } + if (_self.data.area3Id == '') { + wx.showToast({ + title: '请选择旗县区', + icon: 'none' + }) + return false + } + if (_self.data.shopAddress == '') { + wx.showToast({ + title: '店铺地址为必填项', + icon: 'none' + }) + return false + } + if (_self.data.selTradeId == 0) { + wx.showToast({ + title: '请选择行业', + icon: 'none' + }) + return false + } + if (_self.data.date == '') { + wx.showToast({ + title: '请选择开业时间', + icon: 'none' + }) + return false + } + if (_self.data.shopLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传店铺Logo', + icon: 'none' + }) + return false + } + + return true + }, + showModal(e) { + this.setData({ + modalName: e.currentTarget.dataset.target + }) + }, + hideModal(e) { + this.setData({ + modalName: null + }) + }, + + + getAreaDiction(id, type) { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getAreaDictionaryList.format({ + areaParentId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (type == 1) { + _self.setData({ + areaList: res.data + }) + } else if (type == 2) { + _self.setData({ + area2List: res.data + }) + } else { + _self.setData({ + area3List: res.data + }) + } + + }) + .catch(err => { + console.log(err) + }) + }, + //选择视屏 + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + var id = JSON.parse(res).data + let pathStr = e.tempFiles[0].thumbTempFilePath + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.shopVideos.concat(item) + _self.setData({ + shopVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showTemplete(e) { + var item = e.currentTarget.dataset.path + var path = [] + path.push(item) + wx.previewImage({ + urls: path, + }) + }, + changeTemplete(e) { + var _self = this + var item = e.currentTarget.dataset.item + _self.data.templeteList.forEach(it => { + if (it.shopTemplateConfigId != item.shopTemplateConfigId) { + it.checked = false + } else { + it.checked = true + } + }) + _self.setData({ + selTemplateId: item.shopTemplateConfigId, + templeteList: _self.data.templeteList + }) + }, + provinceChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.areaList[index] + _self.setData({ + area1: item.areaName, + area1Id: item.areaId, + area2Id: '', + area2: '请选择盟市', + area3Id: '', + area3: '请选择旗县区', + area3List: [] + }) + _self.getAreaDiction(_self.data.area1Id, 2) + }, + cityChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.area2List[index] + _self.setData({ + area2: item.areaName, + area2Id: item.areaId, + area3Id: '', + area3: '请选择旗县区' + }) + _self.getAreaDiction(_self.data.area2Id, 3) + }, + districtChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.area3List[index] + _self.setData({ + area3: item.areaName, + area3Id: item.areaId + }) + } +}) \ No newline at end of file diff --git a/pages/mine/shop/addshop.json b/pages/mine/shop/addshop.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/addshop.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/addshop.wxml b/pages/mine/shop/addshop.wxml new file mode 100755 index 0000000..f6e9390 --- /dev/null +++ b/pages/mine/shop/addshop.wxml @@ -0,0 +1,181 @@ + + 店铺注册 + + +
+ + + + 店铺名称 + + + + + + 店铺地址(省) + + + + {{area1}} + + + + + + 店铺地址(市) + + + + {{area2}} + + + + + + 店铺地址(县区) + + + + {{area3}} + + + + + + + 详细地址 + + + + + + + 行    业 + + + {{selTradeNames}} + + + + + + + 开业日期 + + + + {{date}} + + + + + + + 是否开业 + + + + + + + + + 店铺Logo + + + {{shopLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + 宣传视频 + + + {{shopVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 店铺简介 + + + + + + + + + + + 店铺样式 + + + + + + + + + {{item.shopTemplateConfigName}} + + + + + + +
+
+ + + + + + + + + 取消 + + + 确定 + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/addshop.wxss b/pages/mine/shop/addshop.wxss new file mode 100755 index 0000000..28fc0ab --- /dev/null +++ b/pages/mine/shop/addshop.wxss @@ -0,0 +1,38 @@ +.cu-form-group .title { + min-width: calc(4em + 30rpx); +} + +.show-box { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; +} + +.show-item { + display: flex; + width: 33%; + align-items: center; + flex-direction: column; + justify-content: center; +} + +.show-item-check { + display: flex; + width: 100%; + flex-direction: row; + margin-bottom: 10rpx; + align-items: center; + justify-content: center; + height: 80rpx; +} + +.show-item image { + width: 100%; + height: 320rpx; + border-radius: 10rpx; +} + +.show-item-check text { + font-size: 30rpx; +} \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.js b/pages/mine/shop/choosetrade.js new file mode 100755 index 0000000..8c7f25b --- /dev/null +++ b/pages/mine/shop/choosetrade.js @@ -0,0 +1,207 @@ +// pages/mine/shop/choose.js +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + activeNames: ['0'], + tradeList: [], //一级行业类型 + tradeTwoList: [], //二级行业类型 + tradeThirdList: [], //三级行业类型, + selectItems: [], //选中的行业, + selectItemNames: '' + }, + getTradeList() { + wx.showLoading({ + title: '获取中...' + }) + let _self = this + app.http.get(app.urls.getIndustryList, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + data.forEach(el => { + el.isSel = false + }) + _self.setData({ + tradeList: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //type 2 二级 3三级 + getTradeListById(id, type) { + console.log(type) + wx.showLoading({ + title: '获取中...' + }) + let _self = this + app.http.get(app.urls.getIndustryList, { + header: { + token: app.globalData.token + }, + data: { + id: id + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(el => { + el.isSel = false + }) + _self.data.selectItems.forEach(element => { + res.data.forEach(el => { + if (element.id == el.id) { + el.isSel = true + } + }) + }) + if (type == '1') { + _self.setData({ + tradeTwoList: res.data + }) + } else if (type == '2') { + _self.setData({ + tradeThirdList: res.data + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //选中 + selectItem(e) { + let item = e.currentTarget.dataset.item + let type = e.currentTarget.dataset.type + this.doSelectItem(item) + if (type == '1') { + this.data.tradeList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeList: this.data.tradeList + }) + } else if (type == '2') { + this.data.tradeTwoList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeTwoList: this.data.tradeTwoList + }) + } else { + this.data.tradeThirdList.forEach(el => { + if (item.id == el.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeThirdList: this.data.tradeThirdList + }) + } + }, + //点击文字 + chooseItem(e) { + let item = e.currentTarget.dataset.i + let type = e.currentTarget.dataset.type + if (type == '1') { + this.setData({ + tradeTwoList: [], + tradeThirdList: [] + }) + this.getTradeListById(item.id, type) + } else if (type == '2') { + this.setData({ + tradeThirdList: [] + }) + this.getTradeListById(item.id, type) + } else { + this.doSelectItem(item) + this.data.tradeThirdList.forEach(el => { + if (el.id == item.id) { + el.isSel = !el.isSel + } + }) + this.setData({ + tradeThirdList: this.data.tradeThirdList + }) + } + }, + doSelectItem(item) { + let _self = this + let isSel = !item.isSel + console.log(isSel) + if (isSel) { + _self.data.selectItems.push(item) + + _self.setData({ + selectItems: _self.data.selectItems + }) + console.log(_self.data.selectItems) + } else { + //剔除 + let index = -1 + for (var i = 0; i < _self.data.selectItems.length; ++i) { + if (item.id == _self.data.selectItems[i].id) { + index = i + break + } + } + if (index != -1) { + _self.data.selectItems.splice(index, 1) + } + _self.setData({ + selectItems: _self.data.selectItems + }) + } + var names = '' + _self.data.selectItems.forEach(el => { + names += el.name + ',' + }) + console.log(names) + _self.setData({ + selectItemNames: names + }) + }, + onChange(e) { + this.setData({ + activeNames: e.detail + }) + }, + selected() { + let _self = this + if (_self.data.selectItems.length > 0) { + let pages = getCurrentPages() + let prevPage = pages[pages.length - 2] + prevPage.setData({ + selTradeList: _self.data.selectItems + }) + wx.navigateBack({ + delta: 1, + }) + } else { + wx.showToast({ + title: '未选择任何行业', + icon: 'error' + }) + } + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getTradeList() + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.json b/pages/mine/shop/choosetrade.json new file mode 100755 index 0000000..f637356 --- /dev/null +++ b/pages/mine/shop/choosetrade.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "van-collapse": "/vant/dist/collapse/index", + "van-collapse-item": "/vant/dist/collapse-item/index" + } +} \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.wxml b/pages/mine/shop/choosetrade.wxml new file mode 100755 index 0000000..d0c3c84 --- /dev/null +++ b/pages/mine/shop/choosetrade.wxml @@ -0,0 +1,93 @@ + + + 行业选择 + + + + 当前选择 + + + + + {{item.name}} + + + + + + + + + 行业类型(一级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 行业类型(二级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + 行业类型(三级) + + + + + + + + + + + {{item.name}} + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/choosetrade.wxss b/pages/mine/shop/choosetrade.wxss new file mode 100755 index 0000000..40c05c1 --- /dev/null +++ b/pages/mine/shop/choosetrade.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/choose.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/mineshop.js b/pages/mine/shop/mineshop.js new file mode 100755 index 0000000..bab53f6 --- /dev/null +++ b/pages/mine/shop/mineshop.js @@ -0,0 +1,382 @@ +// pages/mine/shop/mineshop.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + mineShopList: [], + instance: null, + currentPage: 1, + baseImageUrl: app.urls.baseImgUrl, + isOpenCell: false, + refresherTriggered: false, + shopBean: null, + shopId: '', + top: app.globalData.CustomBar + 10, //状态栏+标题栏+页面margin-top + }, + onOpen(e) { + this.setData({ + isOpenCell: true + }) + }, + onClose(e) { + const { + position, + instance + } = e.detail + switch (position) { + case 'right': + case 'cell': + this.setData({ + isOpenCell: false + }) + instance.close() + break + } + }, + //显示店铺详情 + showShopDetail(e) { + if (!this.data.isOpenCell) { + wx.navigateTo({ + url: './mineshopdetail?shopId=' + e.currentTarget.dataset.item.shopId, + }) + } + }, + //删除店铺 + doDelItem(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该店铺吗?', + success(res) { + if (res.confirm) { + wx.showLoading({ + title: '删除中...', + }) + app.http.delete(app.urls.doDelShop.format({ + ids: _self.data.shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '删除成功', + success() { + wx.navigateBack({}) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + } + }) + }, + //编辑店铺 + doEditItem(e) { + wx.navigateTo({ + url: './shopedit?shopId=' + this.data.shopId, + }) + }, + //添加店铺 + toAddShop() { + wx.navigateTo({ + url: './addshop', + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopDetail(options.shopId) + }, + onShow() { + this.getShopDetail(this.data.shopId) + }, + getShopDetail(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopDetail.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopBean: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + getMineShopList() { + wx.showLoading({ + title: '加载中...', + }) + let _self = this + app.http.get(app.urls.getMineShopList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.currentPage + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + refresherTriggered: false + }) + _self.setData({ + mineShopList: res.data.rows + }) + _self.doOpenOneCell() + }) + .catch(err => { + wx.hideLoading({}) + _self.setData({ + refresherTriggered: false + }) + }) + }, + //自动打开第一个条目 + doOpenOneCell() { + var cell = this.selectComponent('#swipe-item-0') + if (cell && app.globalData.isFirst) { + cell.open() + app.globalData.isFirst = false + } + }, + //刷新页面 + refreshView() { + this.setData({ + currentPage: 1, + refresherTriggered: true + }) + this.getMineShopList() + }, + //认证 + doAuth(e) { + if (e.currentTarget.dataset.item.isCertification == 0) { + //去认证 + wx.navigateTo({ + url: './shopauthentication?shopId=' + e.currentTarget.dataset.item.shopId, + }) + } + }, + //显示宣传视频 + showMovie(e) { + var path = e.currentTarget.dataset.path + if (path) { + var tempList = [{ + url: this.data.baseImageUrl + path, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + } + }, + //显示当前模板 + showTemplete(e) { + var path = e.currentTarget.dataset.path + if (path) { + var tempList = [{ + url: this.data.baseImageUrl + path, + type: 'image' + }] + wx.previewMedia({ + sources: tempList, + }) + } + }, + //职位管理 + positionManage() { + wx.navigateTo({ + url: '../manage/shopposition?shopId=' + this.data.shopBean.shopId, + }) + }, + // 职员管理 + staffManage() { + wx.navigateTo({ + url: '../manage/shopstaff?shopId=' + this.data.shopBean.shopId, + }) + }, + // 会员管理 + memberManage() { + wx.navigateTo({ + url: '../manage/shopmember?shopId=' + this.data.shopBean.shopId, + }) + }, + // 商品类目管理 + catalogManage() { + wx.navigateTo({ + url: '../product/catalogmanage/catalogmanage?shopId=' + this.data.shopBean.shopId, + }) + }, + //商品管理 + productManage() { + wx.navigateTo({ + url: '../product/productmanage/productlist?shopId=' + this.data.shopBean.shopId, + }) + }, + // 优惠券管理 + couponManage() { + wx.navigateTo({ + url: '/pages/mine/product/coupon/couponlist?shopId=' + this.data.shopBean.shopId, + }) + }, + /** + * 获取添加员工二维码 + */ + addStaff() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 获取添加会员二维码 + */ + addMember() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + scanCode() { + let _self = this + wx.scanCode({ + onlyFromCamera: true, + success(res) { + _self.doAddMember(res.result) + }, + fail(err) { + console.log(err) + } + }) + }, + onClose() { + this.setData({ + show: false + }) + }, + doAddMember(res) { + console.log(res) + var result = JSON.parse(res) + console.log(result) + if (result.type == '2') { + //会员添加 + wx.showLoading({ + title: '会员注册中...', + }) + } else if (result.type == '1') { + //员工添加 + wx.showLoading({ + title: '员工注册中...', + }) + } + var url = app.urls.url + result.url + app.http.post(url, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (result.type == 2) { + wx.showToast({ + title: '会员注册成功', + icon: 'success' + }) + } else if (result.type == 1) { + wx.showToast({ + title: '员工注册成功,请等待审核', + icon: 'none' + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showCertificationInfo(e) { + let _self = this + if (_self.data.shopBean.auditStatus == 0) { + if (_self.data.shopBean.shopCertificationId == '') { + //未提交审核 + wx.navigateTo({ + url: './shopauthentication?shopId=' + _self.data.shopId, + }) + } else { + //审核中 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + } else if (_self.data.shopBean.auditStatus == 1) { + //审核通过 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } else { + //审核不通过 + wx.navigateTo({ + url: './shopauthenticationedit?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/mineshop.json b/pages/mine/shop/mineshop.json new file mode 100755 index 0000000..78c1815 --- /dev/null +++ b/pages/mine/shop/mineshop.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-dialog": "/vant/dist/dialog/index" + } +} \ No newline at end of file diff --git a/pages/mine/shop/mineshop.wxml b/pages/mine/shop/mineshop.wxml new file mode 100755 index 0000000..37ef746 --- /dev/null +++ b/pages/mine/shop/mineshop.wxml @@ -0,0 +1,200 @@ + + + 我的店铺 + + + + + + + + {{shopBean.shopName}} + {{shopBean.industryName}} + 开业时间:{{shopBean.openDate}} + + + + + + 宣传视频 + + + + 店铺样式 + + + + + + 地址:{{shopBean.areaName+shopBean.areaCityName+shopBean.areaCountyName+shopBean.shopAddress}} + + + + + + + + + 删除店铺 + 信息编辑 + {{shopBean.isCertification == 0 ? '店铺认证' : '认证信息' }} + + + + + + 店铺管理 + + + + + + + + + + 优惠券管理 + + + + + + + + + + + 职位管理 + + + + + + + + + + + 员工管理 + + + + + + + + + + 会员管理 + + + + + + + + + + 商品类目管理 + + + + + + + + + 商品管理 + + + + + + + + + + 会员二维码 + + + + + + + + + + 员工二维码 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/mineshop.wxss b/pages/mine/shop/mineshop.wxss new file mode 100755 index 0000000..9d566d3 --- /dev/null +++ b/pages/mine/shop/mineshop.wxss @@ -0,0 +1,174 @@ +/* pages/mine/shop/mineshop.wxss */ +page { + background: #F7F7F7; +} + +/* +.cardTitle { + color: #fff; + padding: 20rpx 40rpx; + font-size: 70rpx; + font-weight: 300; + position: relative; + text-align: center; + text-shadow: 0px 0px 6rpx rgba(0, 0, 0, 0.3) +} + +.cardTitle::before { + position: absolute; + width: 60rpx; + height: 6rpx; + border-radius: 20rpx; + display: block; +} + +.cardTitle::after { + position: absolute; + width: 140rpx; + border-radius: 6rpx; + height: 24rpx; + display: block; + bottom: 76rpx; + left: 90rpx; + opacity: 0.1; +} */ +.page-content { + display: flex; + width: 100%; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.info-box { + width: 95%; + display: flex; + flex-direction: column; + align-items: center; + border-radius: 10rpx; + /* background-color: #E6B980; */ + margin-top: 20rpx; + align-self: center; + box-shadow: 10px 10px 60px 5px #efd9be; + border-radius: 10rpx; + padding: 10rpx 0rpx; +} + +.base-info { + width: 95%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + margin: 10rpx; +} + +.base-info-text { + display: flex; + flex: 1; + margin-left: 10rpx; + flex-direction: column; + align-items: left; + justify-content: space-between; + height: 200rpx; + text-align: right; +} + + +.shop-name { + font-size: 36rpx; + text-align: center; + color: #bf7708; +} + +.base-info image { + width: 200rpx; + height: 200rpx; + border-radius: 10rpx; +} + +.base-info-loc { + margin-top: 20rpx; + font-size: 36rpx; + width: 95%; + text-align: left; +} + +.shop-img { + margin-top: 20rpx; + display: flex; + width: 95%; + flex-direction: column; + justify-content: center; + align-items: left; +} + +.shop-img-item { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + min-height: 60rpx; +} + +.shop-img-item image { + width: 48rpx; + height: 48rpx; +} + +.authentication-info { + position: absolute; + right: 20rpx; +} + +.authentication-info image { + width: 100rpx; + height: 100rpx; +} + +.control-box { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + width: 95%; + margin-top: 30rpx; +} + +.control-btn { + flex: 1; + color: #ffffff; + padding: 10rpx 0rpx; + text-align: center; + border-radius: 10rpx; + margin: 10rpx; +} + + + +.control-btn:nth-child(1) { + background-image: linear-gradient(85deg, #f7b5b5, #f51f1f); +} + +.control-btn:nth-child(1):active { + color: #000000; + background-image: linear-gradient(85deg, #979797, #bbbbbb); +} + +.control-btn:nth-child(2) { + background-image: linear-gradient(85deg, #b8d4f4, #037ccc); +} + +.control-btn:nth-child(2):active { + color: #000000; + background-image: linear-gradient(85deg, #979797, #bbbbbb); +} + +.control-btn:nth-child(3) { + background-image: linear-gradient(85deg, #F4DBB8, #E6B980); +} + +.control-btn:nth-child(3):active { + color: #000000; + background-image: linear-gradient(85deg, #979797, #bbbbbb); +} \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.js b/pages/mine/shop/mineshopdetail.js new file mode 100755 index 0000000..8954964 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.js @@ -0,0 +1,218 @@ +// pages/mine/shop/mineshopdetail.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopBean: null, + baseImageUrl: app.urls.baseImgUrl, + shopId: '', + show: false, + qrCode: '', + baseImg: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopDetail(options.shopId) + }, + getShopDetail(id) { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopDetail.format({ + shopId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopBean: res.data + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //职位管理 + positionManage() { + wx.navigateTo({ + url: '../manage/shopposition?shopId=' + this.data.shopBean.shopId, + }) + }, + // 职员管理 + staffManage() { + wx.navigateTo({ + url: '../manage/shopstaff?shopId=' + this.data.shopBean.shopId, + }) + }, + // 会员管理 + memberManage() { + wx.navigateTo({ + url: '../manage/shopmember?shopId=' + this.data.shopBean.shopId, + }) + }, + // 商品类目管理 + catalogManage() { + wx.navigateTo({ + url: '../product/catalogmanage/catalogmanage?shopId=' + this.data.shopBean.shopId, + }) + }, + productManage() { + wx.navigateTo({ + url: '../product/productmanage/productlist?shopId=' + this.data.shopBean.shopId, + }) + }, + /** + * 获取添加员工二维码 + */ + addStaff() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + /** + * 获取添加会员二维码 + */ + addMember() { + let _self = this + wx.showLoading({ + title: '获取中...', + }) + app.http.get(app.urls.getShopCode.format({ + shopId: _self.data.shopId, + type: '1' + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (code == 200) { + _self.setData({ + qrCode: app.urls.baseImgUrl + res.data.data, + show: true + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + scanCode() { + let _self = this + wx.scanCode({ + onlyFromCamera: true, + success(res) { + _self.doAddMember(res.result) + }, + fail(err) { + console.log(err) + } + }) + }, + onClose() { + this.setData({ + show: false + }) + }, + doAddMember(res) { + console.log(res) + var result = JSON.parse(res) + console.log(result) + if (result.type == '2') { + //会员添加 + wx.showLoading({ + title: '会员注册中...', + }) + } else if (result.type == '1') { + //员工添加 + wx.showLoading({ + title: '员工注册中...', + }) + } + var url = app.urls.url + result.url + app.http.post(url, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (result.type == 2) { + wx.showToast({ + title: '会员注册成功', + icon: 'success' + }) + } else if (result.type == 1) { + wx.showToast({ + title: '员工注册成功,请等待审核', + icon: 'none' + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showCertificationInfo(e) { + let _self = this + if (_self.data.shopBean.auditStatus == 0) { + if (_self.data.shopBean.shopCertificationId == '') { + //未提交审核 + wx.navigateTo({ + url: './shopauthentication?shopId=' + _self.data.shopId, + }) + } else { + //审核中 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + } else if (_self.data.shopBean.auditStatus == 1) { + //审核通过 + wx.navigateTo({ + url: './shopauthenticationdetail?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } else { + //审核不通过 + wx.navigateTo({ + url: './shopauthenticationedit?shopId=' + _self.data.shopId + '&certificationId=' + _self.data.shopBean.shopCertificationId, + }) + } + }, + onShow() { + this.getShopDetail(this.data.shopId) + } +}) \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.json b/pages/mine/shop/mineshopdetail.json new file mode 100755 index 0000000..78c1815 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "van-dialog": "/vant/dist/dialog/index" + } +} \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.wxml b/pages/mine/shop/mineshopdetail.wxml new file mode 100755 index 0000000..f1ebae6 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.wxml @@ -0,0 +1,196 @@ + + 店铺详情 + + + + + 基础信息 + + + + + + 认证信息 + + + + {{shopBean.shopCertificationId== '' ? '未认证' : '审核中'}} + + 已认证 + 审核未通过 + + + + + + 店铺名称 + + {{shopBean.shopName}} + + + + + 店铺地址 + + {{shopBean.shopAddress}} + + + + + 开业日期 + + {{shopBean.openDate}} + + + + + 是否开业 + + {{shopBean.isOpen==0? '未开业':'营业中'}} + + + + + 店铺Logo + + + + + + + + + + + + + + 宣传视频 + + + + + + + + + + 店铺简介 + + + + + {{shopBean.shopSummary}} + + + + + + 展示样式 + + + + + {{'样式'+shopBean.shopTemplateId}} + + + + + + + 店铺管理 + + + + + + + + + 职位管理 + + + + + + + + + + + 员工管理 + + + + + + + + + + 会员管理 + + + + + + + + + + 商品类目管理 + + + + + + + + + 商品管理 + + + + + + + + + + 会员二维码 + + + + + + + + + + 员工二维码 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/mineshopdetail.wxss b/pages/mine/shop/mineshopdetail.wxss new file mode 100755 index 0000000..7ed23b4 --- /dev/null +++ b/pages/mine/shop/mineshopdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/mineshopdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.js b/pages/mine/shop/shopauthentication.js new file mode 100755 index 0000000..d8c1b0c --- /dev/null +++ b/pages/mine/shop/shopauthentication.js @@ -0,0 +1,315 @@ +// pages/mine/shop/shopauthentication.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }, + // certificationImage: '', //照片 + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //删除营业执照 + DelLicenseP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + let _self = this + _self.setData({ + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.getAuthInfo(tempList) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + getAuthInfo(templist) { + let _self = this + app.http.get(app.urls.getAuthenticationInfo.format({ + id: templist[0].id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopLicensePhotos: templist, + }) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + textAreaInput(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + setDataToView(data) { + let _self = this + _self.setData({ + certificationName: data.licenseName == '无' ? '' : data.licenseName, //企业名称 + certificationType: data.licenseType == '无' ? '' : data.licenseType, //企业类型 + certificationNumber: data.licenseNumber == '无' ? '' : data.licenseNumber, //证书编号 + certificationId: data.licenseId == '无' ? '' : data.licenseId, //统一信用代码 + certificationComposition: data.licenseComposition == '无' ? '' : data.licenseComposition, //企业组成形式 + certificationLegalPerson: data.licenseLegalPerson == '无' ? '' : data.licenseLegalPerson, //法定代表人 + certificationBusiness: data.licenseBusiness == '无' ? '' : data.licenseBusiness, //企业营业范围 + certificationCapital: data.licenseCapital == '无' ? '' : data.licenseCapital, //企业注册资本 + certificationFoundTime: data.licenseFoundTime == '无' ? '' : data.licenseFoundTime, //企业注册时间 + certificationLicenseTerm: data.licenseTerm == '无' ? '' : data.licenseTerm, //营业期限 + certificationAddress: data.licenseResidence == '无' ? '' : data.licenseResidence, //企业地址 + certificationAuthority: data.licenseAuthority == '无' ? '' : data.licenseAuthority, //登记机关 + }) + }, + //进行认证 + authShop() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '认证中...', + }) + app.http.post(app.urls.doAuthentication, { + header: { + token: app.globalData.token + }, + data: { + certificationAddress: _self.data.certificationAddress, + certificationAuthority: _self.data.certificationAuthority, + certificationBusiness: _self.data.certificationBusiness, + certificationCapital: _self.data.certificationCapital, + certificationComposition: _self.data.certificationComposition, + certificationFoundTime: _self.data.certificationFoundTime, + certificationId: _self.data.certificationId, + certificationImage: _self.data.shopLicensePhotos[0].id, + certificationLegalPerson: _self.data.certificationLegalPerson, + certificationLicenseTerm: _self.data.certificationLicenseTerm, + certificationName: _self.data.certificationName, + certificationNumber: _self.data.certificationNumber, + certificationType: _self.data.certificationType, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + wx.showModal({ + title: '提示', + content: '信息审核中,(1至3个工作日完成),请耐心等待.', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数 + checkParams() { + if (this.data.shopLicensePhotos.length <= 0) { + wx.showToast({ + title: '请上传营业执照相片', + icon: 'none' + }) + return false + } + // certificationName: '', //企业名称 + if (this.data.certificationName == '') { + wx.showToast({ + title: '请输入企业名称', + icon: 'none' + }) + return false + } + // certificationType: '', //企业类型 + if (this.data.certificationType == '') { + wx.showToast({ + title: '请输入企业类型', + icon: 'none' + }) + return false + } + // certificationNumber: '', //证书编号 + if (this.data.certificationNumber == '') { + wx.showToast({ + title: '请输入证书编号', + icon: 'none' + }) + return false + } + // certificationId: '', //统一信用代码 + if (this.data.certificationId == '') { + wx.showToast({ + title: '请输入统一信用代码', + icon: 'none' + }) + return false + } + // certificationComposition: '', //企业组成形式 + if (this.data.certificationComposition == '') { + wx.showToast({ + title: '请输入企业组成形式', + icon: 'none' + }) + return false + } + // certificationLegalPerson: '', //法定代表人 + if (this.data.certificationLegalPerson == '') { + wx.showToast({ + title: '请输入法定代表人', + icon: 'none' + }) + return false + } + // certificationBusiness: '', //企业营业范围 + if (this.data.certificationBusiness == '') { + wx.showToast({ + title: '请输入企业营业范围', + icon: 'none' + }) + return false + } + // certificationCapital: '', //企业注册资本 + if (this.data.certificationCapital == '') { + wx.showToast({ + title: '请输入企业注册资本', + icon: 'none' + }) + return false + } + // certificationFoundTime: '', //企业注册时间 + if (this.data.certificationFoundTime == '') { + wx.showToast({ + title: '请输入企业注册时间', + icon: 'none' + }) + return false + } + // certificationLicenseTerm: '', //营业期限 + if (this.data.certificationLicenseTerm == '') { + wx.showToast({ + title: '请输入营业期限', + icon: 'none' + }) + return false + } + // certificationAddress: '', //企业地址 + if (this.data.certificationAddress == '') { + wx.showToast({ + title: '请输入企业地址', + icon: 'none' + }) + return false + } + // certificationAuthority: '', //登记机关 + if (this.data.certificationAuthority == '') { + wx.showToast({ + title: '请输入登记机关', + icon: 'none' + }) + return false + } + return true + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.json b/pages/mine/shop/shopauthentication.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthentication.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.wxml b/pages/mine/shop/shopauthentication.wxml new file mode 100755 index 0000000..14def23 --- /dev/null +++ b/pages/mine/shop/shopauthentication.wxml @@ -0,0 +1,131 @@ + + + 店铺认证 + + + + + 店铺营业执照 + + + {{shopLicensePhotos.length}}/1 + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + 类型 + + + + + + 证书编号 + + + + + + 统一信用代码 + + + + + + 企业组成形式 + + + + + + 法定代表人 + + + + + + 经营范围 + + + + + + + + + + 注册资本 + + + + + + 成立日期 + + + + + + 营业期限 + + + + + + 企业地址 + + + + + + + + + + 登记机关 + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthentication.wxss b/pages/mine/shop/shopauthentication.wxss new file mode 100755 index 0000000..56298a2 --- /dev/null +++ b/pages/mine/shop/shopauthentication.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthentication.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.js b/pages/mine/shop/shopauthenticationdetail.js new file mode 100755 index 0000000..8225b69 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.js @@ -0,0 +1,88 @@ +// pages/mine/shop/shopauthenticationdetail.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopCertificationId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCertificationId: options.certificationId + }) + this.getAuthenticationInfo() + }, + getAuthenticationInfo() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + setDataToView(data) { + let _self = this + if (data.certificationImage != '') { + let ids = data.certificationImage + _self.data.shopLicensePhotos.push({ + id: ids, + path: app.baseUrls.tradeUrl + app.baseImgUrl + ids + }) + } + _self.setData({ + certificationName: data.certificationName, //企业名称 + certificationType: data.certificationType, //企业类型 + certificationNumber: data.certificationNumber, //证书编号 + certificationId: data.certificationId, //统一信用代码 + certificationComposition: data.certificationComposition, //企业组成形式 + certificationLegalPerson: data.certificationLegalPerson, //法定代表人 + certificationBusiness: data.certificationBusiness, //企业营业范围 + certificationCapital: data.certificationCapital, //企业注册资本 + certificationFoundTime: data.certificationFoundTime, //企业注册时间 + certificationLicenseTerm: data.certificationLicenseTerm, //营业期限 + certificationAddress: data.certificationAddress, //企业地址 + certificationAuthority: data.certificationAuthority, //登记机关 + shopLicensePhotos: _self.data.shopLicensePhotos + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + } +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.json b/pages/mine/shop/shopauthenticationdetail.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.wxml b/pages/mine/shop/shopauthenticationdetail.wxml new file mode 100755 index 0000000..b854f85 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.wxml @@ -0,0 +1,106 @@ + + + 店铺认证详情 + + + + + 店铺营业执照 + + + + + + + + + + + + + + 名称 + + {{certificationName}} + + + + 类型 + + {{certificationType}} + + + + 证书编号 + + {{certificationNumber}} + + + + 统一信用代码 + + {{certificationId}} + + + + 企业组成形式 + + {{certificationComposition}} + + + + 法定代表人 + + {{certificationLegalPerson}} + + + + 经营范围 + + + + + + {{certificationBusiness}} + + + + + 注册资本 + + {{certificationCapital}} + + + + 成立日期 + + {{certificationFoundTime}} + + + + 营业期限 + + {{certificationLicenseTerm}} + + + + 企业地址 + + + + + + {{certificationAddress}} + + + + + 登记机关 + + {{certificationAuthority}} + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationdetail.wxss b/pages/mine/shop/shopauthenticationdetail.wxss new file mode 100755 index 0000000..e3340e5 --- /dev/null +++ b/pages/mine/shop/shopauthenticationdetail.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthenticationdetail.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.js b/pages/mine/shop/shopauthenticationedit.js new file mode 100755 index 0000000..6119d10 --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.js @@ -0,0 +1,365 @@ +// pages/mine/shop/shopauthentication.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopCertificationId: '', + shopLicensePhotos: [], //店铺营业执照图片 + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + auditResult: '', //不通过原因 + auditStatus: 0, //状态 + }, + // certificationImage: '', //照片 + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId, + shopCertificationId: options.certificationId + }) + this.getAuthenticationInfo() + }, + getAuthenticationInfo() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setDataToView(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //删除营业执照 + DelLicenseP(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + let _self = this + _self.setData({ + certificationName: '', //企业名称 + certificationType: '', //企业类型 + certificationNumber: '', //证书编号 + certificationId: '', //统一信用代码 + certificationComposition: '', //企业组成形式 + certificationLegalPerson: '', //法定代表人 + certificationBusiness: '', //企业营业范围 + certificationCapital: '', //企业注册资本 + certificationFoundTime: '', //企业注册时间 + certificationLicenseTerm: '', //营业期限 + certificationAddress: '', //企业地址 + certificationAuthority: '', //登记机关 + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + let pathStr = app.urls.baseImgUrl + JSON.parse(res).data + let item = { + id: JSON.parse(res).data, + path: pathStr + } + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.getAuthInfo(tempList) + }) + .catch(err => { + wx.hideLoading({}) + if (data.msg) { + app.dialog.msg(data.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + getAuthInfo(templist) { + let _self = this + app.restAjax.get(app.restAjax.path(app.apis.getAuthenticationInfo, [app.baseUrls.tradeUrl, templist[0].id]), {}, { + headers: { + token: app.globalData.token + } + }, (code, data) => { + wx.hideLoading({}) + if (code == 200) { + _self.setData({ + shopLicensePhotos: templist, + }) + _self.setDataToView(data) + } + }, (code, error) => { + wx.hideLoading({}) + if (error.msg) { + app.dialog.msg(error.msg) + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + textAreaInput(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + setDataToView(data) { + let _self = this + if (data.certificationImage != '') { + let ids = data.certificationImage + _self.data.shopLicensePhotos.push({ + id: ids, + path: app.baseUrls.tradeUrl + app.baseImgUrl + ids + }) + } + _self.setData({ + certificationName: data.certificationName, //企业名称 + certificationType: data.certificationType, //企业类型 + certificationNumber: data.certificationNumber, //证书编号 + certificationId: data.certificationId, //统一信用代码 + certificationComposition: data.certificationComposition, //企业组成形式 + certificationLegalPerson: data.certificationLegalPerson, //法定代表人 + certificationBusiness: data.certificationBusiness, //企业营业范围 + certificationCapital: data.certificationCapital, //企业注册资本 + certificationFoundTime: data.certificationFoundTime, //企业注册时间 + certificationLicenseTerm: data.certificationLicenseTerm, //营业期限 + certificationAddress: data.certificationAddress, //企业地址 + certificationAuthority: data.certificationAuthority, //登记机关 + shopLicensePhotos: _self.data.shopLicensePhotos, + auditResult: data.auditResult, + auditStatus: data.auditStatus + }) + }, + //进行认证 + authShop() { + let _self = this + if (_self.checkParams()) { + wx.showLoading({ + title: '认证中...', + }) + app.http.get(app.urls.doUpdateAuthenticationInfo.format({ + shopCertificationId: _self.data.shopCertificationId + }), { + header: { + token: app.globalData.token + }, + data: { + certificationAddress: _self.data.certificationAddress, + certificationAuthority: _self.data.certificationAuthority, + certificationBusiness: _self.data.certificationBusiness, + certificationCapital: _self.data.certificationCapital, + certificationComposition: _self.data.certificationComposition, + certificationFoundTime: _self.data.certificationFoundTime, + certificationId: _self.data.certificationId, + certificationImage: _self.data.shopLicensePhotos[0].id, + certificationLegalPerson: _self.data.certificationLegalPerson, + certificationLicenseTerm: _self.data.certificationLicenseTerm, + certificationName: _self.data.certificationName, + certificationNumber: _self.data.certificationNumber, + certificationType: _self.data.certificationType, + shopId: _self.data.shopId + } + }) + .then(res => { + wx.hideLoading({}) + wx.showModal({ + title: '提示', + content: '信息审核中,(1至3个工作日完成),请耐心等待.', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + //校验参数 + checkParams() { + if (this.data.shopLicensePhotos.length <= 0) { + wx.showToast({ + title: '请上传营业执照相片', + icon: 'none' + }) + return false + } + // certificationName: '', //企业名称 + if (this.data.certificationName == '') { + wx.showToast({ + title: '请输入企业名称', + icon: 'none' + }) + return false + } + // certificationType: '', //企业类型 + if (this.data.certificationType == '') { + wx.showToast({ + title: '请输入企业类型', + icon: 'none' + }) + return false + } + // certificationNumber: '', //证书编号 + if (this.data.certificationNumber == '') { + wx.showToast({ + title: '请输入证书编号', + icon: 'none' + }) + return false + } + // certificationId: '', //统一信用代码 + if (this.data.certificationId == '') { + wx.showToast({ + title: '请输入统一信用代码', + icon: 'none' + }) + return false + } + // certificationComposition: '', //企业组成形式 + if (this.data.certificationComposition == '') { + wx.showToast({ + title: '请输入企业组成形式', + icon: 'none' + }) + return false + } + // certificationLegalPerson: '', //法定代表人 + if (this.data.certificationLegalPerson == '') { + wx.showToast({ + title: '请输入法定代表人', + icon: 'none' + }) + return false + } + // certificationBusiness: '', //企业营业范围 + if (this.data.certificationBusiness == '') { + wx.showToast({ + title: '请输入企业营业范围', + icon: 'none' + }) + return false + } + // certificationCapital: '', //企业注册资本 + if (this.data.certificationCapital == '') { + wx.showToast({ + title: '请输入企业注册资本', + icon: 'none' + }) + return false + } + // certificationFoundTime: '', //企业注册时间 + if (this.data.certificationFoundTime == '') { + wx.showToast({ + title: '请输入企业注册时间', + icon: 'none' + }) + return false + } + // certificationLicenseTerm: '', //营业期限 + if (this.data.certificationLicenseTerm == '') { + wx.showToast({ + title: '请输入营业期限', + icon: 'none' + }) + return false + } + // certificationAddress: '', //企业地址 + if (this.data.certificationAddress == '') { + wx.showToast({ + title: '请输入企业地址', + icon: 'none' + }) + return false + } + // certificationAuthority: '', //登记机关 + if (this.data.certificationAuthority == '') { + wx.showToast({ + title: '请输入登记机关', + icon: 'none' + }) + return false + } + return true + }, +}) \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.json b/pages/mine/shop/shopauthenticationedit.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.wxml b/pages/mine/shop/shopauthenticationedit.wxml new file mode 100755 index 0000000..66a887b --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.wxml @@ -0,0 +1,148 @@ + + + 认证信息修改 + + + + + + + + + + 未通过原因: + + + {{auditResult}} + + + + + + + + 店铺营业执照 + + + {{shopLicensePhotos.length}}/1 + + + + + + + + + + + + + + + + + + + + + 名称 + + + + + + + 类型 + + + + + + 证书编号 + + + + + + 统一信用代码 + + + + + + 企业组成形式 + + + + + + 法定代表人 + + + + + + 经营范围 + + + + + + + + + + 注册资本 + + + + + + 成立日期 + + + + + + 营业期限 + + + + + + 企业地址 + + + + + + + + + + 登记机关 + + + + + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopauthenticationedit.wxss b/pages/mine/shop/shopauthenticationedit.wxss new file mode 100755 index 0000000..335448b --- /dev/null +++ b/pages/mine/shop/shopauthenticationedit.wxss @@ -0,0 +1 @@ +/* pages/mine/shop/shopauthenticationedit.wxss */ \ No newline at end of file diff --git a/pages/mine/shop/shopedit.js b/pages/mine/shop/shopedit.js new file mode 100755 index 0000000..4820d36 --- /dev/null +++ b/pages/mine/shop/shopedit.js @@ -0,0 +1,684 @@ +// pages/mine/shop/shopedit.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopId: '', + shopBean: null, + StatusBar: app.globalData.StatusBar, + CustomBar: app.globalData.CustomBar, + startDate: "", + endDate: "", + shopName: "", //商店名称 + shopAddress: "", //商店地址 + index: null, + date: '2021-08-08', //营业时间 + shopLicensePhotos: [], //商店营业执照 + shopLogoPhotos: [], //商店Logo + textareaBValue: '', //店铺简介, + isBusiness: true, //是否开业 + selTradeId: '', //行业类型 + shopVideos: [], //宣传视频 + selTemplateId: '1', + selTradeNames: '请选择行业', + areaList: [], //地区列表 + area2List: [], //二级区域 + area3List: [], //三级区域 + area1: '请选择省份', //一级区域 + area2: '请选择盟市', //一级区域 + area3: '请选择旗县区', //一级区域 + area1Id: '', + area2Id: '', + area3Id: '', + templeteList: [], //展示模板样式 + industryList: [], //行业 + picker: null, + imgUrl: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + shopId: options.shopId + }) + this.getShopDetail() + //先判断是否有商店 + this.getAreaDiction('0', 1) + this.getIndesutryAll() + }, + //获取商店详情 + getShopDetail() { + let _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getShopDetail.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.setData({ + shopBean: res.data + }) + _self.setDataToView() + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //回写数据 + setDataToView() { + let _self = this + + if (_self.data.shopBean.shopLogo != '') { + let ids = _self.data.shopBean.shopLogo + _self.data.shopLogoPhotos.push({ + id: ids, + path: app.urls.baseImgUrl + ids + }) + } + + if (_self.data.shopBean.shopVideo != '') { + let ids = _self.data.shopBean.shopVideo + let idsList = ids.split(',') + idsList.forEach(el => { + if (el != '') { + _self.data.shopVideos.push({ + id: el, + videoUrl: app.urls.baseImgUrl + el, + path: '/images/ic_video_default.png', + }) + } + }) + } + this.setData({ + shopName: _self.data.shopBean.shopName, + shopAddress: _self.data.shopBean.shopAddress, + textareaBValue: _self.data.shopBean.shopSummary, + isBusiness: _self.data.shopBean.isOpen == 0 ? false : true, + date: _self.data.shopBean.openDate, + selTemplateId: _self.data.shopBean.shopTemplateId, + shopLogoPhotos: _self.data.shopLogoPhotos, + shopVideos: _self.data.shopVideos, + selTradeNames: _self.data.shopBean.industryName, + selTradeList: _self.data.selTradeList, + selTradeId: _self.data.shopBean.industryId, + area1: _self.data.shopBean.areaName, //一级区域 + area2: _self.data.shopBean.areaCityName, //一级区域 + area3: _self.data.shopBean.areaCountyName, //一级区域 + area1Id: _self.data.shopBean.area, + area2Id: _self.data.shopBean.areaCity, + area3Id: _self.data.shopBean.areaCounty, + }) + this.getTempleteList(_self.data.selTradeId, 1) + this.getAreaDiction(_self.data.area1Id, 2) + this.getAreaDiction(_self.data.area2Id, 3) + }, + getAreaDiction(id, type) { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getAreaDictionaryList.format({ + areaParentId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + if (type == 1) { + _self.setData({ + areaList: res.data + }) + } else if (type == 2) { + _self.setData({ + area2List: res.data + }) + } else { + _self.setData({ + area3List: res.data + }) + } + + }) + .catch(err => { + console.log(err) + }) + }, + getIndesutryAll() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getIndustryAll, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + _self.buildIndustryData(res.data) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + buildIndustryData(data) { + var _self = this + var first = {} + var second = {} + + first.values = data + first.className = 'column1' + second.values = data[0].subList + second.className = 'column2' + second.defaultIndex = 0 + _self.data.industryList.push(first, second) + _self.setData({ + industryList: _self.data.industryList + }) + }, + onHide(e) { + this.setData({ + isShowIndustry: false + }) + }, + showChooseTrade(e) { + var _self = this + wx.showModal({ + title: '警告', + content: '更换行业,会导致现有商品全部放入回收站,请确认您要更换行业吗?', + success(res) { + if (res.confirm) { + _self.setData({ + isShowIndustry: true + }) + } + } + }) + }, + onChange(event) { + var _self = this + const { + picker, + value, + index + } = event.detail; + _self.setData({ + picker: picker + }) + picker.setColumnValues(1, value[0].subList); + }, + confirmIndustry() { + //确定选择行业 + var _self = this + var value = _self.selectComponent('#picker').getValues() + if (value[1]) { + //获取行业模板 + _self.getTempleteList(value[1].industryId, 2) + _self.setData({ + selTradeId: value[1].industryId, + selTradeNames: value[1].industryName, + isShowIndustry: false + }) + } else { + wx.showToast({ + title: '请选择行业', + }) + } + }, + cancelIndustry() { + //取消选择行业 + this.setData({ + isShowIndustry: false + }) + }, + getTempleteList(id, type) { + var _self = this + _self.setData({ + templeteList: [] + }) + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getTempleteList.format({ + industryId: id + }), { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + res.data.forEach(it => { + if (type == 1) { + if (_self.data.shopBean.shopTemplateId == it.shopTemplateConfigId) { + it.checked = true + } else { + it.checked = false + } + } else { + it.checked = false + } + }) + if (type == 2) { + res.data[0].checked = true + _self.setData({ + selTemplateId: res.data[0].shopTemplateConfigId + }) + } + _self.setData({ + templeteList: res.data, + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + //更新 + doUpdateShop() { + if (this.checkParams()) { + wx.showLoading({ + title: '修改中...', + }) + let _self = this + let industryIds = _self.data.selTradeId + app.http.put(app.urls.doUpdateShopInfo.format({ + shopId: _self.data.shopId + }), { + header: { + token: app.globalData.token + }, + data: { + shopName: _self.data.shopName, + shopAddress: _self.data.shopAddress, + shopSummary: _self.data.textareaBValue, + openDate: _self.data.date, + shopLogo: _self.data.shopLogoPhotos[0].id, + industryIds: industryIds, + shopTemplateId: _self.data.selTemplateId, + isOpen: _self.data.isBusiness ? '1' : '0', + shopVideo: _self.data.shopVideos.length > 0 ? _self.data.shopVideos[0].id : '', + area: _self.data.area1Id, + areaName: _self.data.area1, + areaCity: _self.data.area2Id, + areaCityName: _self.data.area2, + areaCounty: _self.data.area3Id, + areaCountyName: _self.data.area3, + } + }) + .then(res => { + wx.hideLoading({}) + wx.showToast({ + title: '修改成功', + icon: 'success', + success(res) { + wx.navigateBack({ + delta: 1, + }) + } + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + } + }, + PickerChange(e) { + this.setData({ + index: e.detail.value + }) + }, + //选择模板样式 + choosetemplate(e) { + this.setData({ + selTemplateId: e.detail.value + }) + }, + DateChange(e) { + this.setData({ + date: e.detail.value + }) + }, + + checkIsBusiness(e) { + this.setData({ + isBusiness: e.detail.value + }) + }, + //选择营业执照 + ChooseLicenseP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(1, element) + }); + } + }); + }, + //选择logo + ChooseLogoP() { + let _self = this + wx.chooseImage({ + count: 1, //默认9 + sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], //从相册选择 + success: (res) => { + res.tempFilePaths.forEach(element => { + _self.doUploadImg(2, element) + }); + } + }); + }, + //删除Logo + DelLogoP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLogoPhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLogoPhotos: this.data.shopLogoPhotos + }) + } + } + }) + }, + //删除营业执照 + DelLicenseP(e) { + wx.showModal({ + title: '提示', + content: '确定要删除该图片吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + this.data.shopLicensePhotos.splice(e.currentTarget.dataset.index, 1) + this.setData({ + shopLicensePhotos: this.data.shopLicensePhotos + }) + } + } + }) + }, + //进行图片上传 type 1 营业执照 2 logo + doUploadImg(type, path) { + let _self = this + app.http.upload(app.urls.doUploadImg, { + name: 'image', + path: path, + header: { + token: app.globalData.token + } + }) + .then(res => { + var id = JSON.parse(res).data + let pathStr = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr + } + if (type == 2) { + //Logo + let tempList = _self.data.shopLogoPhotos.concat(item) + _self.setData({ + shopLogoPhotos: tempList + }) + } else { + //营业执照 + let tempList = _self.data.shopLicensePhotos.concat(item) + _self.setData({ + shopLicensePhotos: tempList + }) + } + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + inputWatch(e) { + let key = e.currentTarget.dataset.model + this.setData({ + [key]: e.detail.value + }) + }, + ViewLogoImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + ViewLicImg(e) { + var tempList = [e.currentTarget.dataset.url] + wx.previewImage({ + urls: tempList, + current: e.currentTarget.dataset.url + }); + }, + viewVideo(e) { + var tempList = [{ + url: e.currentTarget.dataset.url, + type: 'video' + }] + wx.previewMedia({ + sources: tempList, + current: 0, + showmenu: false + }) + }, + delVideo(e) { + let _self = this + wx.showModal({ + title: '提示', + content: '确定要删除该视频吗?', + cancelText: '取消', + confirmText: '确定', + success: res => { + if (res.confirm) { + _self.data.shopVideos.splice(e.currentTarget.dataset.index, 1) + _self.setData({ + shopVideos: _self.data.shopVideos + }) + } + } + }) + }, + textareaBInput(e) { + this.setData({ + textareaBValue: e.detail.value + }) + }, + checkParams() { + var _self = this + if (_self.data.shopName == '') { + wx.showToast({ + title: '商店名称为必填项', + icon: 'none' + }) + return false + } + if (_self.data.area1Id == '') { + wx.showToast({ + title: '请选择省份', + icon: 'none' + }) + return false + } + if (_self.data.area2Id == '') { + wx.showToast({ + title: '请选择盟市', + icon: 'none' + }) + return false + } + if (_self.data.area3Id == '') { + wx.showToast({ + title: '请选择旗县区', + icon: 'none' + }) + return false + } + if (_self.data.shopAddress == '') { + wx.showToast({ + title: '店铺地址为必填项', + icon: 'none' + }) + return false + } + if (_self.data.selTradeId == 0) { + wx.showToast({ + title: '请选择行业', + icon: 'none' + }) + return false + } + if (_self.data.date == '') { + wx.showToast({ + title: '请选择开业时间', + icon: 'none' + }) + return false + } + if (_self.data.shopLogoPhotos.length <= 0) { + wx.showToast({ + title: '请上传店铺Logo', + icon: 'none' + }) + return false + } + + return true + }, + showModal(e) { + this.setData({ + modalName: e.currentTarget.dataset.target + }) + }, + hideModal(e) { + this.setData({ + modalName: null + }) + }, + //选择视屏 + chooseVideo() { + let _self = this + wx.chooseMedia({ + count: 1, + mediaType: ['video'], + sourceType: ['album', 'camera'], //从相册选择 + maxDuration: 30, + success: (res) => { + _self.doUploadVideo(res) + } + }); + }, + doUploadVideo(e) { + wx.showLoading({ + title: '上传中...', + }) + let _self = this + app.http.upload(app.urls.doUploadVideo, { + name: 'video', + path: e.tempFiles[0].tempFilePath, + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + let pathStr = e.tempFiles[0].thumbTempFilePath + var id = JSON.parse(res).data + let videoU = app.urls.baseImgUrl + id + let item = { + id: id, + path: pathStr, + videoUrl: videoU + } + let tempList = _self.data.shopVideos.concat(item) + _self.setData({ + shopVideos: tempList + }) + }) + .catch(err => { + wx.hideLoading({}) + }) + }, + showTemplete(e) { + var item = e.currentTarget.dataset.path + var path = [] + path.push(item) + wx.previewImage({ + urls: path, + }) + }, + changeTemplete(e) { + var _self = this + var item = e.currentTarget.dataset.item + _self.data.templeteList.forEach(it => { + if (it.shopTemplateConfigId != item.shopTemplateConfigId) { + it.checked = false + } else { + it.checked = true + } + }) + _self.setData({ + selTemplateId: item.shopTemplateConfigId, + templeteList: _self.data.templeteList + }) + }, + provinceChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.areaList[index] + _self.setData({ + area1: item.areaName, + area1Id: item.areaId, + area2Id: '', + area2: '请选择盟市', + area3Id: '', + area3: '请选择旗县区', + area3List: [], //三级区域 + }) + _self.getAreaDiction(_self.data.area1Id, 2) + }, + cityChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.area2List[index] + _self.setData({ + area2: item.areaName, + area2Id: item.areaId, + area3Id: '', + area3: '请选择旗县区' + }) + _self.getAreaDiction(_self.data.area2Id, 3) + }, + districtChange(e) { + var _self = this + var index = e.detail.value + var item = _self.data.area3List[index] + _self.setData({ + area3: item.areaName, + area3Id: item.areaId + }) + } +}) \ No newline at end of file diff --git a/pages/mine/shop/shopedit.json b/pages/mine/shop/shopedit.json new file mode 100755 index 0000000..8835af0 --- /dev/null +++ b/pages/mine/shop/shopedit.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/mine/shop/shopedit.wxml b/pages/mine/shop/shopedit.wxml new file mode 100755 index 0000000..a8d1121 --- /dev/null +++ b/pages/mine/shop/shopedit.wxml @@ -0,0 +1,185 @@ + + 店铺信息编辑 + + +
+ + + + 店铺名称 + + + + + + 店铺地址(省) + + + + {{area1}} + + + + + + 店铺地址(市) + + + + {{area2}} + + + + + + 店铺地址(县区) + + + + {{area3}} + + + + + + + 详细地址 + + + + + + + 行    业 + + + {{selTradeNames}} + + + + + + + 开业日期 + + + + {{date}} + + + + + + + 是否开业 + + + + + + + + 店铺Logo + + + {{shopLogoPhotos.length}}/1 + + + + + + + + + + + + + + + + + + 宣传视频 + + + {{shopVideos.length}}/1 + + + + + + + + + + + + + + + + + + + 店铺简介 + + + + + + + + + + + 店铺样式 + + + + + + + + + {{item.shopTemplateConfigName}} + + + + + + +
+
+ + + + + + + + + 取消 + + + 确定 + + + + + + \ No newline at end of file diff --git a/pages/mine/shop/shopedit.wxss b/pages/mine/shop/shopedit.wxss new file mode 100755 index 0000000..5144be3 --- /dev/null +++ b/pages/mine/shop/shopedit.wxss @@ -0,0 +1,38 @@ +.cu-form-group .title { + min-width: calc(4em + 30rpx); + } + + .show-box { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; + } + + .show-item { + display: flex; + width: 33%; + align-items: center; + flex-direction: column; + justify-content: center; + } + + .show-item-check { + display: flex; + width: 100%; + flex-direction: row; + margin-bottom: 10rpx; + align-items: center; + justify-content: center; + height: 80rpx; + } + + .show-item image { + width: 100%; + height: 320rpx; + border-radius: 10rpx; + } + + .show-item-check text { + font-size: 30rpx; + } \ No newline at end of file diff --git a/pages/mine/vip/vipcenter.js b/pages/mine/vip/vipcenter.js new file mode 100755 index 0000000..f038b87 --- /dev/null +++ b/pages/mine/vip/vipcenter.js @@ -0,0 +1,143 @@ +// pages/mine/vip/vipcenter.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + name: '用户名称', + userIcon: '/images/ic_user_default.png', + curPage: 1, + isRefreshing: false, //是否在刷新中 + hasMore: true, //是否有更多数据 + isLoadMore: false, //是否正在加载更多 + recordList: [], + isDredge: true, //是否开通过会员 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) {}, + onShow(e) { + var name = wx.getStorageSync('name') + var userIcon = wx.getStorageSync('userIcon') + if (name) { + this.setData({ + name: name, + userIcon: userIcon + }) + } + wx.startPullDownRefresh({}) + // this.getPayState() + // this.getPayHistoryList() + }, + getPayState() { + wx.showLoading({ + title: '加载中...', + }) + var _self = this + app.http.get(app.urls.getPayState, { + header: { + token: app.globalData.token + } + }) + .then(res => { + wx.hideLoading({}) + //支付过跳转名片创建页面,没有支付跳转支付页面 + //第一次开通 + _self.setData({ + isDredge: res.data.cardCharge && res.data.cardChargeEnd == '' + }) + if (res.data.cardChargeEnd && res.data.cardChargeEnd.length > 0) { + res.data.cardChargeEnd = _self.formatDate(res.data.cardChargeEnd) + } + _self.setData({ + payState: res.data + }) + }) + .catch(err => { + + }) + }, + formatDate(date) { + if (date.length > 0) { + return date.slice(0, 11) + } else { + return '' + } + }, + //获取支付历史列表 + getPayHistoryList() { + var _self = this + wx.showLoading({ + title: '加载中...', + }) + app.http.get(app.urls.getPayHistoryList, { + header: { + token: app.globalData.token + }, + data: { + page: _self.data.curPage, + rows: '10' + } + }) + .then(res => { + wx.stopPullDownRefresh({}) + wx.hideLoading({}) + _self.data.recordList = _self.data.recordList.concat(res.data.rows) + var more = _self.data.recordList.length < res.data.total + _self.setData({ + recordList: _self.data.recordList, + isRefreshing: false, + isLoadMore: false, + hasMore: more + }) + }) + .catch(err => { + wx.stopPullDownRefresh({}) + _self.setData({ + isRefreshing: false, + isLoadMore: false, + hasMore: true + }) + }) + }, + + //立即续费 + doRenew() { + wx.navigateTo({ + url: '/packagecard/paypage/paypage', + }) + }, + //加载更多 + doLoadMore() { + var _self = this + if (_self.data.hasMore) { + if (_self.data.isLoadMore) { + return + } + this.setData({ + isLoadMore: true, + curPage: ++_self.data.curPage + }) + this.getPayHistoryList() + } + }, + onReachBottom() { + this.doLoadMore() + }, + //下拉刷新 + onPullDownRefresh() { + this.setData({ + isLoadMore: false, + isRefreshing: true, + hasMore: true, + recordList: [], + curPage: 1 + }) + this.getPayState() + this.getPayHistoryList() + } +}) \ No newline at end of file diff --git a/pages/mine/vip/vipcenter.json b/pages/mine/vip/vipcenter.json new file mode 100755 index 0000000..53da382 --- /dev/null +++ b/pages/mine/vip/vipcenter.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "onReachBottomDistance": 50, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/mine/vip/vipcenter.wxml b/pages/mine/vip/vipcenter.wxml new file mode 100755 index 0000000..0cb07e2 --- /dev/null +++ b/pages/mine/vip/vipcenter.wxml @@ -0,0 +1,58 @@ + + 会员中心 + + + + + + + + + {{name}} + + + + 会员将于{{payState.cardChargeEnd}}到期 + + 会员已于{{payState.cardChargeEnd}}到期 + + + + 立即续费 + + + + + + + {{item.cardChargeRemark}} + 支付时间:{{item.cardChargeOrderTime}} + 支付金额:¥{{item.cardChargePrice}} + + + + + + 已取消 + + + 支付成功 + + + + + 加载中... + + + + + + + + 您还未开通会员,点击下方按钮去开通会员 + + + \ No newline at end of file diff --git a/pages/mine/vip/vipcenter.wxss b/pages/mine/vip/vipcenter.wxss new file mode 100755 index 0000000..214df79 --- /dev/null +++ b/pages/mine/vip/vipcenter.wxss @@ -0,0 +1,117 @@ +/* pages/mine/vip/vipcenter.wxss */ + + +.info-box { + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + align-self: center; + box-shadow: 0rpx 4rpx 8rpx 0rpx #efd9be, 0rpx 6rpx 20rpx 0rpx #efd9be; + border-radius: 10rpx; + padding: 10rpx 0rpx; +} + +.base-info { + width: 100%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; + padding: 15rpx; +} + +.base-info .user-icon { + width: 128rpx; + height: 128rpx; + border-radius: 50%; + border: 6rpx solid #ffbc00; +} + +.base-info-text-box { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; +} + +.name-box { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +.name-box .name { + font-size: 32rpx; + color: #ffffff; + line-height: 10rpx; +} + +.name-box image { + width: 48rpx; + height: 48rpx; + margin-left: 15rpx; +} + +.item { + display: flex; + flex-direction: row; + position: relative; + justify-content: flex-start; + align-items: center; + background-color: #ffffff; + width: 100%; + padding: 15rpx; + margin-top: 15rpx; +} + +.subscript { + width: 96rpx; + height: 96rpx; + position: absolute; + right: 0rpx; + bottom: 0rpx; +} + +.subscript image { + width: 100%; + height: 100%; +} + +.state { + position: absolute; + transform: rotate(-45deg) translate(-50%, -50%); + font-size: 22rpx; + width: 100%; + height: 100%; + top: 30%; + left: 110%; + color: #ffffff; +} + +.item .icon { + width: 96rpx; + height: 96rpx; + border-radius: 50%; +} + +.item .content { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + margin-left: 15rpx; + width: 85%; +} + +.title { + font-size: 32rpx; + color: #E6B980; +} + +.hint-msg { + font-size: 28rpx; + color: #333333; +} \ No newline at end of file diff --git a/pages/serve/index/index.js b/pages/serve/index/index.js new file mode 100755 index 0000000..e494348 --- /dev/null +++ b/pages/serve/index/index.js @@ -0,0 +1,32 @@ +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + shopUrl: '', + imgUlr: app.urls.baseImgUrl + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var url = app.urls.shopUrl + app.globalData.userId + '?token=' + app.globalData.token + this.setData({ + shopUrl: url + }) + + }, + onShow() { + wx.setNavigationBarTitle({ + title: '服务' + }) + var _self = this + var url = app.urls.shopUrl + app.globalData.userId + '?token=' + app.globalData.token + this.setData({ + shopUrl: url + }) + }, +}) \ No newline at end of file diff --git a/pages/serve/index/index.json b/pages/serve/index/index.json new file mode 100755 index 0000000..7360326 --- /dev/null +++ b/pages/serve/index/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/serve/index/index.wxml b/pages/serve/index/index.wxml new file mode 100755 index 0000000..70902c1 --- /dev/null +++ b/pages/serve/index/index.wxml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pages/serve/index/index.wxss b/pages/serve/index/index.wxss new file mode 100755 index 0000000..c5c921c --- /dev/null +++ b/pages/serve/index/index.wxss @@ -0,0 +1 @@ +/* pages/serve/index/index.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100755 index 0000000..a69dadf --- /dev/null +++ b/project.config.json @@ -0,0 +1,73 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [] + }, + "setting": { + "urlCheck": false, + "es6": true, + "enhance": false, + "postcss": true, + "preloadBackgroundData": false, + "minified": true, + "newFeature": false, + "coverView": true, + "nodeModules": false, + "autoAudits": false, + "showShadowRootInWxmlPanel": true, + "scopeDataCheck": false, + "uglifyFileName": false, + "checkInvalidKey": true, + "checkSiteMap": true, + "uploadWithSourceMap": true, + "compileHotReLoad": false, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + }, + "enableEngineNative": false, + "useIsolateContext": true, + "userConfirmedBundleSwitch": false, + "packNpmManually": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false + }, + "compileType": "miniprogram", + "libVersion": "2.17.0", + "appid": "wxe17874894f7ff27b", + "projectname": "card", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file diff --git a/sitemap.json b/sitemap.json new file mode 100755 index 0000000..ca02add --- /dev/null +++ b/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/utils/api.js b/utils/api.js new file mode 100755 index 0000000..6ecf127 --- /dev/null +++ b/utils/api.js @@ -0,0 +1,154 @@ +var apis = { + // url: 'http://192.168.0.115:8091/systemcard/', + // userCenter: 'http://192.168.0.115:8091/systemcard/', + // baseImgUrl: 'http://192.168.0.115:8091/systemcard/route/file/download/true/', + + // url: 'https://cbc.wgink.ink/systemcard/', + // userCenter: 'https://cbc.wgink.ink/systemcard/', + // baseImgUrl: 'https://cbc.wgink.ink/systemcard/route/file/download/true/', + + url: 'https://www.tenlion.com.cn/systemcard/', + userCenter: 'https://www.tenlion.com.cn/systemcard/', + baseImgUrl: 'https://www.tenlion.com.cn/systemcard/route/file/download/true/', + + // url: 'http://192.168.0.111:8091/systemcard/', + // userCenter: 'http://192.168.0.111:8091/systemcard/', + // baseImgUrl: 'http://192.168.0.111:8091/systemcard/route/file/download/true/', + + // url: 'http://192.168.0.103:7008/study/', + // userCenter: 'http://192.168.0.103:7008/study/', + // baseImgUrl: 'http://192.168.0.103:7008/study/route/file/download/true/', + + + shopUrl: `https://www.tenlion.com.cn/systemcard/app/shoptemplateconfig/pagerelease/`, + // shopUrl: `http://192.168.0.115:8091/systemcard/app/shoptemplateconfig/pagerelease/`, + doSaveUserInfo: `app/miniapp/user/update-info`, //保存微信头像与名称 + doUpdatePhone: `app/miniapp/update-phone`, //绑定手机号 token, {phone:''} put + doUploadImg: `app/file/uploadimage`, //上传图片 + doUploadVideo: `app/file/uploadvideo`, //上传视频 + doUploadAudio: `app/file/uploadaudio`, //上传音频 + /**用户相关 */ + wxLogin: `wechat-miniapp/sign/default`, //微信用户登录 + getUserBaseInfo: `app/cardcharge/getuser`, + getDictionaryList: `app/data/listallbyparentid/{dataParentId}`, //获取字典全部列表 + getAreaDictionaryList: `app/area/listbyparentid/{areaParentId}`, //获取地区全部字典 + getPayState: `app/cardcharge/getprice`, //获取支付状态 + getTreaty: `app/projectconfigrelease/html/{key}`, //获取协议 1.privacyPolicy 隐私协议 2.cardCreateTemplateUse 使用协议 3.cardUserServicesTreaty 认证协议 4.cardCreateTreaty 服务协议 + getMemberTypeList: `app/cardchargerole/list`, //获取会员开通类型列表 + getMenuState: ``, //获取菜单开关状态 + getIndexIcon: `app/projectconfigrelease/file/createCardIcon`, //获取首页按钮ID + getMyAccount: `app/account/get`, //获取账户信息 + getIncomeList: `app/accountitem/listpage`, //获取收益记录 + doTakeCash: `app/accountwithdraw/save`, //申请提现单位分 accountWithdrawMoney + getTakeCashList: `app/accountwithdraw/listpage`, //获取提现历史 + /* 支付 */ + getOrderState: `app/miniapp/pay/save-place-order-demo`, + getCardPayState: `app/cardcharge/savecharge/{mode}`, //获取开通名片的订单信息 + doSaveOrderPayState: `app/cardcharge/checkorder/{cardChargeOrderNumber}`, //保存订单支付状态 + getPayHistoryList: `app/cardcharge/listpage`, //获取 + getVersionContrast: `app/projectconfigrelease/file/versionContrastPhoto`, //版本对比图 + /*用户 */ + /**店铺相关 **/ + doSaveShop: `app/shop/save`, //保存商店 + doUpdateShopInfo: `app/shop/updateshop/{shopId}`, //更新店铺信息 + getIndustryList: `app/industry/listztreeindustry`, //获取行业类型列表 + getIndustryAll: `app/industry/get-all-industry`, //获取全部行业 + delStaff: `app/shopstaff/remove/{ids}`, //删除职工信息 + doDelMember: `app/shopmember/remove/{ids}`, //删除会员信息 + getShopDetail: `app/shop/get/{shopId}`, //获取店铺详情 + doDelShop: `app/shop/remove/{ids}`, //删除商店 + doSavePosition: `app/shopposition/save`, //保存职位, + getMemberList: `app/shopmember/getShopMemberList/{shopId}`, //获取会员列表 + getPositionList: `app/shopposition/getShopPositlist/{shopId}`, //获取职位列表 + getMineShopList: `app/shop/myListPage`, //获取我的全部商店 + delPosition: `app/shopposition/remove/{ids}`, //删除职位 + getStaffList: `app/shopstaff/getShopStafList/{shopId}`, //获取职工列表 + getGoodsDetail: `app/shopgoods/get/{goodsId}`, //获取商品详情 + getShopCode: `app/shop/getshopcode/{shopId}/{type}`, //获取店铺二维码 type 1员工 2会员 + getAuthenticationInfo: `app/shopcertification/businessLicenseOCR/{id}`, //根据上传的图片ID获取上传营业执照内容 + doAuthentication: `app/shopcertification/save`, //进行认证 + getShopAuthenticationInfo: `app/shopcertification/get/{shopCertificationId}`, //获取店铺认证信息 + doUpdateAuthenticationInfo: `app/shopcertification/updateshopcertification/{shopCertificationId}`, //更新店铺认证信息 + getTempleteList: `app/shoptemplateconfig/get-template-by-industryId/{industryId}`, //根据行业ID获取模板列表 + /** 营销 **/ + getPosterDetail: ``, //获取海报详情 + getPosterTempleteList: `app/cardtemplate/listposter`, //获取海报模板列表 + getPosterHistory: `app/cardtemplateuse/list`, //获取发布的海报历史 mode 1.名片 2.海报 + getMarketingInfoList: ``, //获取营销资讯 + doSavePoster: `app/cardtemplateuse/saveposter`, //创建海报 + /** 优惠券 **/ + doSaveCoupon: `app/coupon/save`, //保存优惠券 + getCouponList: `app/coupon/list`, //获取优惠卷列表 + doUpdateCoupon: `app/coupon/updatecoupon/{couponId}`, //更新优惠券 + doDelCoupon: `app/coupon/remove/{ids}`, //删除优惠券 + getCouponDetail: `app/coupon/get/{couponId}`, //获取优惠券详情 + /**商品相关 **/ + doSaveStaff: ``, //保存职工信息 + getCatalogList: `app/category/listztreecategory/{level}`, //获取商品类目列表 + getCatalogThirdList: `app/category/third-data`, //获取三级商品类目 + getRecycleCategoryList: `app/category/recycle-category`, //获取回收站类目 + doDelCatalogRecycle: `app/category/delete-category/{ids}`, //删除回收站的分类 + getRecycleGoodsList: `app/shopgoods/recycle-shopgood`, //回收站商品 + doDelRecycleGoods: `app/shopgoods/delete-shopgood/{ids}`, // 删除回收站数据 + doRecoverGoods: `app/shopgoods/recovery-shopgood/{ids}`, //恢复回收站数据 + getShopGoodsList: `app/shopgoods/listpageshopgoods/{shopId}`, //根据店铺ID获取商品 + getGoodsByCatalogAndShop: `app/shopgoods/goodslistbycategoryid/{categoryId}`, //根据分类和店铺ID获取商品 请求参数shopId:params + doSaveCatalog: `app/category/save-category-sub`, //添加商品类目 + doDelCatelog: `app/category/removecategory/{ids}`, //删除商品类目 + doRecoverCatelog: `app/category/recovery-category/{ids}`, //恢复删除的类目 + getCatalogDetail: `app/category/getcategorybyid/{categoryId}`, //根据ID获取类目详情 + doUpdateCatalog: `app/category/updatecategory/{categoryId}`, //修改类目详情 + doSaveGoods: `app/shopgoods/save`, //添加商品 + doDelGoods: `app/shopgoods/remove/{ids}`, //删除商品 + doUpdateGoods: `app/shopgoods/updateshopgoods/{shopGoodsId}`, //更新商品信息 + doDelShopCategoryById: `app/category/removecategory/{ids}`, //删除商店类目 + getShopCatalogList: `app/category/categorylistbyshopid/{shopId}`, //获取店铺分类商品 + doSaveOrder: `app/orderdetail/save`, //提交订单 POST + getMineOrderList: `app/order/listpageorder`, //我的订单列表 + getOrderDetail: `app/order/get/{orderId}`, //获取订单详情 + + //个人中心列表 + //栏目数据 + /**个人中心 */ + getMenuList: `app/cardconfigcolumngroup/list`, + getMomentsList: `app/configcolumndata/list/{configColumnId}`, //获取栏目数据列表 + doSaveMoments: `app/configcolumndata/save/{configColumnId}`, //保存栏目数据 + getMomentsField: `app/configcolumndata/listfield/{configColumnId}`, //获取栏目字段列表 + doDelMoment: `app/configcolumndata/delete/{configColumnId}/{uid}`, //删除栏目数据 + getMomentsContent: `app/configcolumndata/get/{configColumnId}/{uid}`, //获取栏目数据 + getMainColumn: `app/cardconfigcolumn/listhome`, //获取首页显示栏目 + getColumnListByGroupId: `app/cardconfigcolumn/list`, //根据栏目组id获取栏目? configColumnGroupId + getMainMoment: `app/configcolumndata/list/{configColumnId}`, //获取首页栏目数据 通过栏目ID获取栏目下的数据列表(包含每条数据的字段集合) 传入userId参数则查询指定人的 , 没传入userId参数则查询当前token的 + getMineColumnList: `app/cardconfigcolumngroup/setlist`, //获取我的栏目配置列表 + doSaveColumnDisplay: `app/configcolumnset/savedisplay`, //保存我的栏目隐藏显示 + doSaveColumnName: `app/configcolumnset/savename`, //保存我的栏目名称 + doOrderColumn: `app/configcolumnset/saveorder`, //保存栏目排序, post {configColumnId, configColumnOrder} + //评论 点赞 收藏 + doSaveCollect: `app/contentcollect/save`, //保存取消收藏 businessId=xxx&projectId=poster + doSaveLike: `app/contentlike/save`, //保存取消点赞 ?businessId + getPosterFavorList: `app/cardtemplate/mylistposter`, //获取我的海报收藏列表 + //名片信息 + getCardList: `app/cardtemplate/list`, //获取名片列表 + getCardDetail: `app/cardtemplate/get/{cardTemplateId}`, //获取名片详情 + creatCard: `app/cardtemplateuse/save`, //新增名片 + getFileId: `app/pictruestemplatearea/createfile/{picturesTemplateAreaId}`, //换取fileId + getMyCard: `app/cardtemplateuse/list`, //我的名片列表 + getMyCardDetail: `app/cardtemplateuse/get/{cardTemplateUseId}`, //我的名片详情 + updateMyCard: `app/cardtemplateuse/update/{cardTemplateUseId}`, //更新名片内容 + setDefaultCard: `app/cardtemplateuse/default/{cardTemplateUseId}`, //制定名片 + deleteCard: `app/cardtemplateuse/remove/{ids}`, //删除名片 + getDefaultCard: `app/cardtemplateuse/getdefault/{userId}`, //首页默认名片 + shareRecord: `app/cardtemplatedispatch/save`, //转发记录 + checkRecord: `app/cardtemplatescans/save`, //保存查看记录 + shareCard: `app/cardtemplateuse/getdispatch/{cardTemplateUseId}`, //查看分享名片 + includedCard: `app/cardtemplateusebag/save`, //加入卡包 + otherCardList: `app/cardtemplateusebag/listpage`, //他人名片列表 + setTop: `app/cardtemplateusebag/updatetop/{cardTemplateUseBagId}/{cardTemplateUseTop}`, // 名片置顶 + getCardUseId: `app/cardtemplatedispatch/get/{cardTemplateDispatchId}`, //获取名片id + getBrowseHistoryList: `app/cardtemplatescans/listpage/1`, //获取浏览历史 + getCardBrowUserList: `app/cardtemplatescans/listhome`, //需要传递page rows cardTemplateUseId +} + +module.exports = { + apis +} \ No newline at end of file diff --git a/utils/request.js b/utils/request.js new file mode 100755 index 0000000..ae32549 --- /dev/null +++ b/utils/request.js @@ -0,0 +1,339 @@ +const api = require('./api'); +/** + * 例子 + */ +// app.http.get(url.format({ +// path方式 ... +// }), { +// header: { +// ... +// }, +// data: { +// ... +// } +// }).then(res => { + +// }) +//.catch(err => { + +// }) +var methods = { + POST_METHOD: 'POST', + DELETE_METHOD: 'DELETE', + PUT_METHOD: 'PUT', + GET_METHOD: 'GET' +}; + +/** + * 新增 + * @param url + * @param dataObj + * @param args + * @param successCallback + * @param errorCallback + * @param completeCallback + */ +function postJson(url, args) { + return doAjax(url, methods.POST_METHOD, args); +} + +/** + * 删除 + * @param url + * @param dataObj + * @param args + * @param successCallback + * @param errorCallback + * @param completeCallback + */ +function deleteForm(url, args) { + return doAjax(url, methods.DELETE_METHOD, args); +} + +/** + * 修改 + * @param url + * @param dataObj + * @param args + * @param successCallback + * @param errorCallback + * @param completeCallback + */ +function putJson(url, args) { + return doAjax(url, methods.PUT_METHOD, args); +} + +/** + * 查询 + * @param url + * @param dataObj + * @param args + * @param successCallback + * @param errorCallback + * @param completeCallback + */ +function getForm(url, args) { + return doAjax(url, methods.GET_METHOD, args); +} + +/** + * 执行上传 + * @param url + * @param method + * @param dataObj + * @param args + * @param successCallback + * @param errorCallback + * @param completeCallback + */ +function doAjax(url, method, args) { + // var headers = {}; + // if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) { + // headers = args.headers; + // } + return new Promise((success, errorback) => { + //构建请求Url + var requestUrl = api.apis.url + url + wx.request({ + url: requestUrl, + method: method, + data: args.data || {}, + header: args.header || {}, + timeout: 50000, + dataType: 'json', + success: res => { + if (res.statusCode == 200) { + success(res) + } else { + errorback(res) + var hintMsg = '网络错误' + if (res.data && res.data.msg) { + hintMsg = res.data.msg + } + wx.showToast({ + title: hintMsg, + icon: 'none' + }) + } + }, + fail: err => { + wx.hideLoading({}) + errorback(err) + var hintMsg = '网络错误' + if (err.data && err.data.msg) { + hintMsg = err.data.msg + } + wx.showToast({ + title: hintMsg + '(100)', + icon: 'none' + }) + }, + }) + }) +} + +/** + * 检测是路径参数有重复值 + * @param pathArgArray + * @returns {boolean} + */ +function pathArgsHasSameValue(pathArgArray) { + var tempArgIndex = 0; + var tempArgs = pathArgArray[tempArgIndex]; + for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) { + if (tempArgs == item) { + throw new Error('参数' + item + '有重复值!!!'); + } + if (i == pathArgArray.length - 1) { + tempArgs = pathArgArray[++tempArgIndex]; + i = tempArgIndex; + continue; + } + } +} + +/** + * 获取页面间传递的参数 + * @param url + */ +function getParamsArg(url) { + var params = url.split('?')[1]; + var paramsObj = {}; + if (typeof (params) == 'undefined' || params == null) { + return paramsObj; + } + var paramsKVs = params.split('&'); + for (var i = 0, item = null; item = paramsKVs[i++];) { + var kvs = item.split('='); + if (kvs.length == 1) { + paramsObj[kvs[0]] = null; + } + if (kvs.length == 2) { + paramsObj[kvs[0]] = decodeURI(kvs[1]); + } + } + return paramsObj; +} + +/** + * 构建路径 + * @param basePath 请求路径,{参数}, + * @param pathArgs 替换的路径参数,不能重复 + * @returns {*} + */ +function buildPath(basePath, pathArgs) { + var path = basePath; + if (!basePath || !(typeof (basePath) == 'string')) { + throw new Error('basePath必须为字符串!!!'); + } + if (!pathArgs || !Array.isArray(pathArgs)) { + throw new Error('pathArgs必须为数组!!!'); + } + var pathArgArray = basePath.match(/\{\w+\}/g); + if (!pathArgArray) { + return path; + } + pathArgsHasSameValue(pathArgArray); + for (var i = 0, item; item = pathArgArray[i]; i++) { + path = path.replace(item, pathArgs[i]); + } + return path; +} + +/** + * 通过form对象上传文件 + * @param url + * @param formData + * @param args + * @param successCallback + * @param errorCallback + * @param beforeCallback + * @param completeCallback + */ +function postFile(url, path, name, args, successCallback, errorCallback, completeCallback) { + var headers = {}; + if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) { + headers = args.headers; + } + wx.uploadFile({ + filePath: path, + name: name, + url: url, + header: headers, + success: function (response) { + if (response.statusCode == 200) { + successCallback(response.statusCode, response.data, args); + } else { + if (errorCallback && typeof (errorCallback) == 'function') { + errorCallback(response.statusCode, response.data); + } + } + }, + fail: function (response) { + if (errorCallback && typeof errorCallback == 'function') { + errorCallback(response.statusCode, response.data) + } + }, + complete: function () { + if (completeCallback && typeof (completeCallback) == 'function') { + completeCallback(); + } + } + }) +}; +/** + * Promise 上传文件 + */ +function upload(url, params) { + return new Promise((success, errorback) => { + var requestUrl = api.apis.url + url + wx.uploadFile({ + filePath: params.path, + name: params.name, + url: requestUrl, + header: params.header, + success: function (response) { + console.log('success') + if (response.statusCode == 200) { + success(response.data); + } else { + errorback(response) + if (typeof (response.data) != undefined) { + try { + var data = JSON.parse(response.data) + wx.showToast({ + title: data.msg, + icon: 'none' + }) + } catch (err) { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + } else { + wx.showToast({ + title: '网络错误', + icon: 'error' + }) + } + } + }, + fail: function (response) { + wx.hideLoading({}) + try { + if (typeof (response.data.msg) != undefined) { + wx.showToast({ + title: response.data.msg, + icon: 'none' + }) + } else { + wx.showToast({ + title: '网络错误(100)', + icon: 'error' + }) + } + } catch (err) { + wx.showToast({ + title: '网络错误(100)', + icon: 'error' + }) + } + } + }) + }) +} + +/** + * xss 转义 + * @param html + * @returns {string} + */ +function escape(html) { + return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&') + .replace(//g, '>') + .replace(/'/g, ''').replace(/"/g, '"'); +} + +String.prototype.format = function (params) { + let s = this + for (let item in params) { + let re = new RegExp('{' + item + '}', 'gm') + s = s.replace(re, params[item]) + } + return s +} + + +module.exports = { + post: postJson, + delete: deleteForm, + put: putJson, + get: getForm, + params: getParamsArg, + path: buildPath, + escape: escape, + file: postFile, + upload: upload, + apis: api.apis +} \ No newline at end of file diff --git a/utils/rsa.js b/utils/rsa.js new file mode 100755 index 0000000..300699e --- /dev/null +++ b/utils/rsa.js @@ -0,0 +1,14462 @@ +var navigator2 = { + appName: 'Netscape', + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1' +}; + +var window2 = { + ASN1 : null, + Base64 : null, + Hex : null, + crypto : null, + href : null +}; + +var KJUR = null; + +if (typeof YAHOO == "undefined" || !YAHOO) { + var YAHOO = {}; +} +YAHOO.namespace = function() { + var b = arguments, + g = null, + e, c, f; + for (e = 0; e < b.length; e = e + 1) { + f = ("" + b[e]).split("."); + g = YAHOO; + for (c = (f[0] == "YAHOO") ? 1 : 0; c < f.length; c = c + 1) { + g[f[c]] = g[f[c]] || {}; + g = g[f[c]]; + } + } + return g; +}; +YAHOO.log = function(d, a, c) { + var b = YAHOO.widget.Logger; + if (b && b.log) { + return b.log(d, a, c); + } else { + return false; + } +}; +YAHOO.register = function(a, f, e) { + var k = YAHOO.env.modules, + c, j, h, g, d; + if (!k[a]) { + k[a] = { + versions: [], + builds: [] + }; + } + c = k[a]; + j = e.version; + h = e.build; + g = YAHOO.env.listeners; + c.name = a; + c.version = j; + c.build = h; + c.versions.push(j); + c.builds.push(h); + c.mainClass = f; + for (d = 0; d < g.length; d = d + 1) { + g[d](c); + } + if (f) { + f.VERSION = j; + f.BUILD = h; + } else { + YAHOO.log("mainClass is undefined for module " + a, "warn"); + } +}; +YAHOO.env = YAHOO.env || { + modules: [], + listeners: [] +}; +YAHOO.env.getVersion = function(a) { + return YAHOO.env.modules[a] || null; +}; +YAHOO.env.parseUA = function(d) { + var e = function(i) { + var j = 0; + return parseFloat(i.replace(/\./g, + function() { + return (j++==1) ? "": "."; + })); + }, + h = navigator2, + g = { + ie: 0, + opera: 0, + gecko: 0, + webkit: 0, + chrome: 0, + mobile: null, + air: 0, + ipad: 0, + iphone: 0, + ipod: 0, + ios: null, + android: 0, + webos: 0, + caja: h && h.cajaVersion, + secure: false, + os: null + }, + c = d || (navigator2 && navigator2.userAgent), + f = window2 && window2.location, + b = f && f.href, + a; + g.secure = b && (b.toLowerCase().indexOf("https") === 0); + if (c) { + if ((/windows|win32/i).test(c)) { + g.os = "windows"; + } else { + if ((/macintosh/i).test(c)) { + g.os = "macintosh"; + } else { + if ((/rhino/i).test(c)) { + g.os = "rhino"; + } + } + } + if ((/KHTML/).test(c)) { + g.webkit = 1; + } + a = c.match(/AppleWebKit\/([^\s]*)/); + if (a && a[1]) { + g.webkit = e(a[1]); + if (/ Mobile\//.test(c)) { + g.mobile = "Apple"; + a = c.match(/OS ([^\s]*)/); + if (a && a[1]) { + a = e(a[1].replace("_", ".")); + } + g.ios = a; + g.ipad = g.ipod = g.iphone = 0; + a = c.match(/iPad|iPod|iPhone/); + if (a && a[0]) { + g[a[0].toLowerCase()] = g.ios; + } + } else { + a = c.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/); + if (a) { + g.mobile = a[0]; + } + if (/webOS/.test(c)) { + g.mobile = "WebOS"; + a = c.match(/webOS\/([^\s]*);/); + if (a && a[1]) { + g.webos = e(a[1]); + } + } + if (/ Android/.test(c)) { + g.mobile = "Android"; + a = c.match(/Android ([^\s]*);/); + if (a && a[1]) { + g.android = e(a[1]); + } + } + } + a = c.match(/Chrome\/([^\s]*)/); + if (a && a[1]) { + g.chrome = e(a[1]); + } else { + a = c.match(/AdobeAIR\/([^\s]*)/); + if (a) { + g.air = a[0]; + } + } + } + if (!g.webkit) { + a = c.match(/Opera[\s\/]([^\s]*)/); + if (a && a[1]) { + g.opera = e(a[1]); + a = c.match(/Version\/([^\s]*)/); + if (a && a[1]) { + g.opera = e(a[1]); + } + a = c.match(/Opera Mini[^;]*/); + if (a) { + g.mobile = a[0]; + } + } else { + a = c.match(/MSIE\s([^;]*)/); + if (a && a[1]) { + g.ie = e(a[1]); + } else { + a = c.match(/Gecko\/([^\s]*)/); + if (a) { + g.gecko = 1; + a = c.match(/rv:([^\s\)]*)/); + if (a && a[1]) { + g.gecko = e(a[1]); + } + } + } + } + } + } + return g; +}; +YAHOO.env.ua = YAHOO.env.parseUA(); (function() { + YAHOO.namespace("util", "widget", "example"); + if ("undefined" !== typeof YAHOO_config) { + var b = YAHOO_config.listener, + a = YAHOO.env.listeners, + d = true, + c; + if (b) { + for (c = 0; c < a.length; c++) { + if (a[c] == b) { + d = false; + break; + } + } + if (d) { + a.push(b); + } + } + } +})(); +YAHOO.lang = YAHOO.lang || {}; (function() { + var f = YAHOO.lang, + a = Object.prototype, + c = "[object Array]", + h = "[object Function]", + i = "[object Object]", + b = [], + g = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "/": "/", + "`": "`" + }, + d = ["toString", "valueOf"], + e = { + isArray: function(j) { + return a.toString.apply(j) === c; + }, + isBoolean: function(j) { + return typeof j === "boolean"; + }, + isFunction: function(j) { + return (typeof j === "function") || a.toString.apply(j) === h; + }, + isNull: function(j) { + return j === null; + }, + isNumber: function(j) { + return typeof j === "number" && isFinite(j); + }, + isObject: function(j) { + return (j && (typeof j === "object" || f.isFunction(j))) || false; + }, + isString: function(j) { + return typeof j === "string"; + }, + isUndefined: function(j) { + return typeof j === "undefined"; + }, + _IEEnumFix: (YAHOO.env.ua.ie) ? + function(l, k) { + var j, n, m; + for (j = 0; j < d.length; j = j + 1) { + n = d[j]; + m = k[n]; + if (f.isFunction(m) && m != a[n]) { + l[n] = m; + } + } + }: function() {}, + escapeHTML: function(j) { + return j.replace(/[&<>"'\/`]/g, + function(k) { + return g[k]; + }); + }, + extend: function(m, n, l) { + if (!n || !m) { + throw new Error("extend failed, please check that " + "all dependencies are included."); + } + var k = function() {}, + j; + k.prototype = n.prototype; + m.prototype = new k(); + m.prototype.constructor = m; + m.superclass = n.prototype; + if (n.prototype.constructor == a.constructor) { + n.prototype.constructor = n; + } + if (l) { + for (j in l) { + if (f.hasOwnProperty(l, j)) { + m.prototype[j] = l[j]; + } + } + f._IEEnumFix(m.prototype, l); + } + }, + augmentObject: function(n, m) { + if (!m || !n) { + throw new Error("Absorb failed, verify dependencies."); + } + var j = arguments, + l, o, k = j[2]; + if (k && k !== true) { + for (l = 2; l < j.length; l = l + 1) { + n[j[l]] = m[j[l]]; + } + } else { + for (o in m) { + if (k || !(o in n)) { + n[o] = m[o]; + } + } + f._IEEnumFix(n, m); + } + return n; + }, + augmentProto: function(m, l) { + if (!l || !m) { + throw new Error("Augment failed, verify dependencies."); + } + var j = [m.prototype, l.prototype], + k; + for (k = 2; k < arguments.length; k = k + 1) { + j.push(arguments[k]); + } + f.augmentObject.apply(this, j); + return m; + }, + dump: function(j, p) { + var l, n, r = [], + t = "{...}", + k = "f(){...}", + q = ", ", + m = " => "; + if (!f.isObject(j)) { + return j + ""; + } else { + if (j instanceof Date || ("nodeType" in j && "tagName" in j)) { + return j; + } else { + if (f.isFunction(j)) { + return k; + } + } + } + p = (f.isNumber(p)) ? p: 3; + if (f.isArray(j)) { + r.push("["); + for (l = 0, n = j.length; l < n; l = l + 1) { + if (f.isObject(j[l])) { + r.push((p > 0) ? f.dump(j[l], p - 1) : t); + } else { + r.push(j[l]); + } + r.push(q); + } + if (r.length > 1) { + r.pop(); + } + r.push("]"); + } else { + r.push("{"); + for (l in j) { + if (f.hasOwnProperty(j, l)) { + r.push(l + m); + if (f.isObject(j[l])) { + r.push((p > 0) ? f.dump(j[l], p - 1) : t); + } else { + r.push(j[l]); + } + r.push(q); + } + } + if (r.length > 1) { + r.pop(); + } + r.push("}"); + } + return r.join(""); + }, + substitute: function(x, y, E, l) { + var D, C, B, G, t, u, F = [], + p, + z = x.length, + A = "dump", + r = " ", + q = "{", + m = "}", + n, + w; + for (;;) { + D = x.lastIndexOf(q, z); + if (D < 0) { + break; + } + C = x.indexOf(m, D); + if (D + 1 > C) { + break; + } + p = x.substring(D + 1, C); + G = p; + u = null; + B = G.indexOf(r); + if (B > -1) { + u = G.substring(B + 1); + G = G.substring(0, B); + } + t = y[G]; + if (E) { + t = E(G, t, u); + } + if (f.isObject(t)) { + if (f.isArray(t)) { + t = f.dump(t, parseInt(u, 10)); + } else { + u = u || ""; + n = u.indexOf(A); + if (n > -1) { + u = u.substring(4); + } + w = t.toString(); + if (w === i || n > -1) { + t = f.dump(t, parseInt(u, 10)); + } else { + t = w; + } + } + } else { + if (!f.isString(t) && !f.isNumber(t)) { + t = "~-" + F.length + "-~"; + F[F.length] = p; + } + } + x = x.substring(0, D) + t + x.substring(C + 1); + if (l === false) { + z = D - 1; + } + } + for (D = F.length - 1; D >= 0; D = D - 1) { + x = x.replace(new RegExp("~-" + D + "-~"), "{" + F[D] + "}", "g"); + } + return x; + }, + trim: function(j) { + try { + return j.replace(/^\s+|\s+$/g, ""); + } catch(k) { + return j; + } + }, + merge: function() { + var n = {}, + k = arguments, + j = k.length, + m; + for (m = 0; m < j; m = m + 1) { + f.augmentObject(n, k[m], true); + } + return n; + }, + later: function(t, k, u, n, p) { + t = t || 0; + k = k || {}; + var l = u, + s = n, + q, j; + if (f.isString(u)) { + l = k[u]; + } + if (!l) { + throw new TypeError("method undefined"); + } + if (!f.isUndefined(n) && !f.isArray(s)) { + s = [n]; + } + q = function() { + l.apply(k, s || b); + }; + j = (p) ? setInterval(q, t) : setTimeout(q, t); + return { + interval: p, + cancel: function() { + if (this.interval) { + clearInterval(j); + } else { + clearTimeout(j); + } + } + }; + }, + isValue: function(j) { + return (f.isObject(j) || f.isString(j) || f.isNumber(j) || f.isBoolean(j)); + } + }; + f.hasOwnProperty = (a.hasOwnProperty) ? + function(j, k) { + return j && j.hasOwnProperty && j.hasOwnProperty(k); + }: function(j, k) { + return ! f.isUndefined(j[k]) && j.constructor.prototype[k] !== j[k]; + }; + e.augmentObject(f, e, true); + YAHOO.util.Lang = f; + f.augment = f.augmentProto; + YAHOO.augment = f.augmentProto; + YAHOO.extend = f.extend; +})(); +YAHOO.register("yahoo", YAHOO, { + version: "2.9.0", + build: "2800" +}); + +var CryptoJS = CryptoJS || (function(e, g) { + var a = {}; + var b = a.lib = {}; + var j = b.Base = (function() { + function n() {} + return { + extend: function(p) { + n.prototype = this; + var o = new n(); + if (p) { + o.mixIn(p) + } + if (!o.hasOwnProperty("init")) { + o.init = function() { + o.$super.init.apply(this, arguments) + } + } + o.init.prototype = o; + o.$super = this; + return o + }, + create: function() { + var o = this.extend(); + o.init.apply(o, arguments); + return o + }, + init: function() {}, + mixIn: function(p) { + for (var o in p) { + if (p.hasOwnProperty(o)) { + this[o] = p[o] + } + } + if (p.hasOwnProperty("toString")) { + this.toString = p.toString + } + }, + clone: function() { + return this.init.prototype.extend(this) + } + } + } ()); + var l = b.WordArray = j.extend({ + init: function(o, n) { + o = this.words = o || []; + if (n != g) { + this.sigBytes = n + } else { + this.sigBytes = o.length * 4 + } + }, + toString: function(n) { + return (n || h).stringify(this) + }, + concat: function(t) { + var q = this.words; + var p = t.words; + var n = this.sigBytes; + var s = t.sigBytes; + this.clamp(); + if (n % 4) { + for (var r = 0; r < s; r++) { + var o = (p[r >>> 2] >>> (24 - (r % 4) * 8)) & 255; + q[(n + r) >>> 2] |= o << (24 - ((n + r) % 4) * 8) + } + } else { + for (var r = 0; r < s; r += 4) { + q[(n + r) >>> 2] = p[r >>> 2] + } + } + this.sigBytes += s; + return this + }, + clamp: function() { + var o = this.words; + var n = this.sigBytes; + o[n >>> 2] &= 4294967295 << (32 - (n % 4) * 8); + o.length = e.ceil(n / 4) + }, + clone: function() { + var n = j.clone.call(this); + n.words = this.words.slice(0); + return n + }, + random: function(p) { + var o = []; + for (var n = 0; n < p; n += 4) { + o.push((e.random() * 4294967296) | 0) + } + return new l.init(o, p) + } + }); + var m = a.enc = {}; + var h = m.Hex = { + stringify: function(p) { + var r = p.words; + var o = p.sigBytes; + var q = []; + for (var n = 0; n < o; n++) { + var s = (r[n >>> 2] >>> (24 - (n % 4) * 8)) & 255; + q.push((s >>> 4).toString(16)); + q.push((s & 15).toString(16)) + } + return q.join("") + }, + parse: function(p) { + var n = p.length; + var q = []; + for (var o = 0; o < n; o += 2) { + q[o >>> 3] |= parseInt(p.substr(o, 2), 16) << (24 - (o % 8) * 4) + } + return new l.init(q, n / 2) + } + }; + var d = m.Latin1 = { + stringify: function(q) { + var r = q.words; + var p = q.sigBytes; + var n = []; + for (var o = 0; o < p; o++) { + var s = (r[o >>> 2] >>> (24 - (o % 4) * 8)) & 255; + n.push(String.fromCharCode(s)) + } + return n.join("") + }, + parse: function(p) { + var n = p.length; + var q = []; + for (var o = 0; o < n; o++) { + q[o >>> 2] |= (p.charCodeAt(o) & 255) << (24 - (o % 4) * 8) + } + return new l.init(q, n) + } + }; + var c = m.Utf8 = { + stringify: function(n) { + try { + return decodeURIComponent(escape(d.stringify(n))) + } catch(o) { + throw new Error("Malformed UTF-8 data") + } + }, + parse: function(n) { + return d.parse(unescape(encodeURIComponent(n))) + } + }; + var i = b.BufferedBlockAlgorithm = j.extend({ + reset: function() { + this._data = new l.init(); + this._nDataBytes = 0 + }, + _append: function(n) { + if (typeof n == "string") { + n = c.parse(n) + } + this._data.concat(n); + this._nDataBytes += n.sigBytes + }, + _process: function(w) { + var q = this._data; + var x = q.words; + var n = q.sigBytes; + var t = this.blockSize; + var v = t * 4; + var u = n / v; + if (w) { + u = e.ceil(u) + } else { + u = e.max((u | 0) - this._minBufferSize, 0) + } + var s = u * t; + var r = e.min(s * 4, n); + if (s) { + for (var p = 0; p < s; p += t) { + this._doProcessBlock(x, p) + } + var o = x.splice(0, s); + q.sigBytes -= r + } + return new l.init(o, r) + }, + clone: function() { + var n = j.clone.call(this); + n._data = this._data.clone(); + return n + }, + _minBufferSize: 0 + }); + var f = b.Hasher = i.extend({ + cfg: j.extend(), + init: function(n) { + this.cfg = this.cfg.extend(n); + this.reset() + }, + reset: function() { + i.reset.call(this); + this._doReset() + }, + update: function(n) { + this._append(n); + this._process(); + return this + }, + finalize: function(n) { + if (n) { + this._append(n) + } + var o = this._doFinalize(); + return o + }, + blockSize: 512 / 32, + _createHelper: function(n) { + return function(p, o) { + return new n.init(o).finalize(p) + } + }, + _createHmacHelper: function(n) { + return function(p, o) { + return new k.HMAC.init(n, o).finalize(p) + } + } + }); + var k = a.algo = {}; + return a +} (Math)); + +(function(g) { + var a = CryptoJS, + f = a.lib, + e = f.Base, + h = f.WordArray, + a = a.x64 = {}; + a.Word = e.extend({ + init: function(b, c) { + this.high = b; + this.low = c + } + }); + a.WordArray = e.extend({ + init: function(b, c) { + b = this.words = b || []; + this.sigBytes = c != g ? c: 8 * b.length + }, + toX32: function() { + for (var b = this.words, + c = b.length, + a = [], d = 0; d < c; d++) { + var e = b[d]; + a.push(e.high); + a.push(e.low) + } + return h.create(a, this.sigBytes) + }, + clone: function() { + for (var b = e.clone.call(this), c = b.words = this.words.slice(0), a = c.length, d = 0; d < a; d++) c[d] = c[d].clone(); + return b + } + }) +})(); + +CryptoJS.lib.Cipher || +function(u) { + var g = CryptoJS, + f = g.lib, + k = f.Base, + l = f.WordArray, + q = f.BufferedBlockAlgorithm, + r = g.enc.Base64, + v = g.algo.EvpKDF, + n = f.Cipher = q.extend({ + cfg: k.extend(), + createEncryptor: function(a, b) { + return this.create(this._ENC_XFORM_MODE, a, b) + }, + createDecryptor: function(a, b) { + return this.create(this._DEC_XFORM_MODE, a, b) + }, + init: function(a, b, c) { + this.cfg = this.cfg.extend(c); + this._xformMode = a; + this._key = b; + this.reset() + }, + reset: function() { + q.reset.call(this); + this._doReset() + }, + process: function(a) { + this._append(a); + return this._process() + }, + finalize: function(a) { + a && this._append(a); + return this._doFinalize() + }, + keySize: 4, + ivSize: 4, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, + _createHelper: function(a) { + return { + encrypt: function(b, c, d) { + return ("string" == typeof c ? s: j).encrypt(a, b, c, d) + }, + decrypt: function(b, c, d) { + return ("string" == typeof c ? s: j).decrypt(a, b, c, d) + } + } + } + }); + f.StreamCipher = n.extend({ + _doFinalize: function() { + return this._process(!0) + }, + blockSize: 1 + }); + var m = g.mode = {}, + t = function(a, b, c) { + var d = this._iv; + d ? this._iv = u: d = this._prevBlock; + for (var e = 0; e < c; e++) a[b + e] ^= d[e] + }, + h = (f.BlockCipherMode = k.extend({ + createEncryptor: function(a, b) { + return this.Encryptor.create(a, b) + }, + createDecryptor: function(a, b) { + return this.Decryptor.create(a, b) + }, + init: function(a, b) { + this._cipher = a; + this._iv = b + } + })).extend(); + h.Encryptor = h.extend({ + processBlock: function(a, b) { + var c = this._cipher, + d = c.blockSize; + t.call(this, a, b, d); + c.encryptBlock(a, b); + this._prevBlock = a.slice(b, b + d) + } + }); + h.Decryptor = h.extend({ + processBlock: function(a, b) { + var c = this._cipher, + d = c.blockSize, + e = a.slice(b, b + d); + c.decryptBlock(a, b); + t.call(this, a, b, d); + this._prevBlock = e + } + }); + m = m.CBC = h; + h = (g.pad = {}).Pkcs7 = { + pad: function(a, b) { + for (var c = 4 * b, + c = c - a.sigBytes % c, + d = c << 24 | c << 16 | c << 8 | c, + e = [], f = 0; f < c; f += 4) e.push(d); + c = l.create(e, c); + a.concat(c) + }, + unpad: function(a) { + a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255 + } + }; + f.BlockCipher = n.extend({ + cfg: n.cfg.extend({ + mode: m, + padding: h + }), + reset: function() { + n.reset.call(this); + var a = this.cfg, + b = a.iv, + a = a.mode; + if (this._xformMode == this._ENC_XFORM_MODE) var c = a.createEncryptor; + else c = a.createDecryptor, + this._minBufferSize = 1; + this._mode = c.call(a, this, b && b.words) + }, + _doProcessBlock: function(a, b) { + this._mode.processBlock(a, b) + }, + _doFinalize: function() { + var a = this.cfg.padding; + if (this._xformMode == this._ENC_XFORM_MODE) { + a.pad(this._data, this.blockSize); + var b = this._process(!0) + } else b = this._process(!0), + a.unpad(b); + return b + }, + blockSize: 4 + }); + var p = f.CipherParams = k.extend({ + init: function(a) { + this.mixIn(a) + }, + toString: function(a) { + return (a || this.formatter).stringify(this) + } + }), + m = (g.format = {}).OpenSSL = { + stringify: function(a) { + var b = a.ciphertext; + a = a.salt; + return (a ? l.create([1398893684, 1701076831]).concat(a).concat(b) : b).toString(r) + }, + parse: function(a) { + a = r.parse(a); + var b = a.words; + if (1398893684 == b[0] && 1701076831 == b[1]) { + var c = l.create(b.slice(2, 4)); + b.splice(0, 4); + a.sigBytes -= 16 + } + return p.create({ + ciphertext: a, + salt: c + }) + } + }, + j = f.SerializableCipher = k.extend({ + cfg: k.extend({ + format: m + }), + encrypt: function(a, b, c, d) { + d = this.cfg.extend(d); + var e = a.createEncryptor(c, d); + b = e.finalize(b); + e = e.cfg; + return p.create({ + ciphertext: b, + key: c, + iv: e.iv, + algorithm: a, + mode: e.mode, + padding: e.padding, + blockSize: a.blockSize, + formatter: d.format + }) + }, + decrypt: function(a, b, c, d) { + d = this.cfg.extend(d); + b = this._parse(b, d.format); + return a.createDecryptor(c, d).finalize(b.ciphertext) + }, + _parse: function(a, b) { + return "string" == typeof a ? b.parse(a, this) : a + } + }), + g = (g.kdf = {}).OpenSSL = { + execute: function(a, b, c, d) { + d || (d = l.random(8)); + a = v.create({ + keySize: b + c + }).compute(a, d); + c = l.create(a.words.slice(b), 4 * c); + a.sigBytes = 4 * b; + return p.create({ + key: a, + iv: c, + salt: d + }) + } + }, + s = f.PasswordBasedCipher = j.extend({ + cfg: j.cfg.extend({ + kdf: g + }), + encrypt: function(a, b, c, d) { + d = this.cfg.extend(d); + c = d.kdf.execute(c, a.keySize, a.ivSize); + d.iv = c.iv; + a = j.encrypt.call(this, a, b, c.key, d); + a.mixIn(c); + return a + }, + decrypt: function(a, b, c, d) { + d = this.cfg.extend(d); + b = this._parse(b, d.format); + c = d.kdf.execute(c, a.keySize, a.ivSize, b.salt); + d.iv = c.iv; + return j.decrypt.call(this, a, b, c.key, d) + } + }) +} (); + +(function() { + for (var q = CryptoJS, + x = q.lib.BlockCipher, + r = q.algo, + j = [], y = [], z = [], A = [], B = [], C = [], s = [], u = [], v = [], w = [], g = [], k = 0; 256 > k; k++) g[k] = 128 > k ? k << 1 : k << 1 ^ 283; + for (var n = 0, + l = 0, + k = 0; 256 > k; k++) { + var f = l ^ l << 1 ^ l << 2 ^ l << 3 ^ l << 4, + f = f >>> 8 ^ f & 255 ^ 99; + j[n] = f; + y[f] = n; + var t = g[n], + D = g[t], + E = g[D], + b = 257 * g[f] ^ 16843008 * f; + z[n] = b << 24 | b >>> 8; + A[n] = b << 16 | b >>> 16; + B[n] = b << 8 | b >>> 24; + C[n] = b; + b = 16843009 * E ^ 65537 * D ^ 257 * t ^ 16843008 * n; + s[f] = b << 24 | b >>> 8; + u[f] = b << 16 | b >>> 16; + v[f] = b << 8 | b >>> 24; + w[f] = b; + n ? (n = t ^ g[g[g[E ^ t]]], l ^= g[g[l]]) : n = l = 1 + } + var F = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], + r = r.AES = x.extend({ + _doReset: function() { + for (var c = this._key, + e = c.words, + a = c.sigBytes / 4, + c = 4 * ((this._nRounds = a + 6) + 1), b = this._keySchedule = [], h = 0; h < c; h++) if (h < a) b[h] = e[h]; + else { + var d = b[h - 1]; + h % a ? 6 < a && 4 == h % a && (d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255]) : (d = d << 8 | d >>> 24, d = j[d >>> 24] << 24 | j[d >>> 16 & 255] << 16 | j[d >>> 8 & 255] << 8 | j[d & 255], d ^= F[h / a | 0] << 24); + b[h] = b[h - a] ^ d + } + e = this._invKeySchedule = []; + for (a = 0; a < c; a++) h = c - a, + d = a % 4 ? b[h] : b[h - 4], + e[a] = 4 > a || 4 >= h ? d: s[j[d >>> 24]] ^ u[j[d >>> 16 & 255]] ^ v[j[d >>> 8 & 255]] ^ w[j[d & 255]] + }, + encryptBlock: function(c, e) { + this._doCryptBlock(c, e, this._keySchedule, z, A, B, C, j) + }, + decryptBlock: function(c, e) { + var a = c[e + 1]; + c[e + 1] = c[e + 3]; + c[e + 3] = a; + this._doCryptBlock(c, e, this._invKeySchedule, s, u, v, w, y); + a = c[e + 1]; + c[e + 1] = c[e + 3]; + c[e + 3] = a + }, + _doCryptBlock: function(c, e, a, b, h, d, j, m) { + for (var n = this._nRounds, + f = c[e] ^ a[0], g = c[e + 1] ^ a[1], k = c[e + 2] ^ a[2], p = c[e + 3] ^ a[3], l = 4, t = 1; t < n; t++) var q = b[f >>> 24] ^ h[g >>> 16 & 255] ^ d[k >>> 8 & 255] ^ j[p & 255] ^ a[l++], + r = b[g >>> 24] ^ h[k >>> 16 & 255] ^ d[p >>> 8 & 255] ^ j[f & 255] ^ a[l++], + s = b[k >>> 24] ^ h[p >>> 16 & 255] ^ d[f >>> 8 & 255] ^ j[g & 255] ^ a[l++], + p = b[p >>> 24] ^ h[f >>> 16 & 255] ^ d[g >>> 8 & 255] ^ j[k & 255] ^ a[l++], + f = q, + g = r, + k = s; + q = (m[f >>> 24] << 24 | m[g >>> 16 & 255] << 16 | m[k >>> 8 & 255] << 8 | m[p & 255]) ^ a[l++]; + r = (m[g >>> 24] << 24 | m[k >>> 16 & 255] << 16 | m[p >>> 8 & 255] << 8 | m[f & 255]) ^ a[l++]; + s = (m[k >>> 24] << 24 | m[p >>> 16 & 255] << 16 | m[f >>> 8 & 255] << 8 | m[g & 255]) ^ a[l++]; + p = (m[p >>> 24] << 24 | m[f >>> 16 & 255] << 16 | m[g >>> 8 & 255] << 8 | m[k & 255]) ^ a[l++]; + c[e] = q; + c[e + 1] = r; + c[e + 2] = s; + c[e + 3] = p + }, + keySize: 8 + }); + q.AES = x._createHelper(r) +})(); + +(function() { + function j(b, c) { + var a = (this._lBlock >>> b ^ this._rBlock) & c; + this._rBlock ^= a; + this._lBlock ^= a << b + } + function l(b, c) { + var a = (this._rBlock >>> b ^ this._lBlock) & c; + this._lBlock ^= a; + this._rBlock ^= a << b + } + var h = CryptoJS, + e = h.lib, + n = e.WordArray, + e = e.BlockCipher, + g = h.algo, + q = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], + p = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], + r = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], + s = [{ + "0": 8421888, + 268435456 : 32768, + 536870912 : 8421378, + 805306368 : 2, + 1073741824 : 512, + 1342177280 : 8421890, + 1610612736 : 8389122, + 1879048192 : 8388608, + 2147483648 : 514, + 2415919104 : 8389120, + 2684354560 : 33280, + 2952790016 : 8421376, + 3221225472 : 32770, + 3489660928 : 8388610, + 3758096384 : 0, + 4026531840 : 33282, + 134217728 : 0, + 402653184 : 8421890, + 671088640 : 33282, + 939524096 : 32768, + 1207959552 : 8421888, + 1476395008 : 512, + 1744830464 : 8421378, + 2013265920 : 2, + 2281701376 : 8389120, + 2550136832 : 33280, + 2818572288 : 8421376, + 3087007744 : 8389122, + 3355443200 : 8388610, + 3623878656 : 32770, + 3892314112 : 514, + 4160749568 : 8388608, + 1 : 32768, + 268435457 : 2, + 536870913 : 8421888, + 805306369 : 8388608, + 1073741825 : 8421378, + 1342177281 : 33280, + 1610612737 : 512, + 1879048193 : 8389122, + 2147483649 : 8421890, + 2415919105 : 8421376, + 2684354561 : 8388610, + 2952790017 : 33282, + 3221225473 : 514, + 3489660929 : 8389120, + 3758096385 : 32770, + 4026531841 : 0, + 134217729 : 8421890, + 402653185 : 8421376, + 671088641 : 8388608, + 939524097 : 512, + 1207959553 : 32768, + 1476395009 : 8388610, + 1744830465 : 2, + 2013265921 : 33282, + 2281701377 : 32770, + 2550136833 : 8389122, + 2818572289 : 514, + 3087007745 : 8421888, + 3355443201 : 8389120, + 3623878657 : 0, + 3892314113 : 33280, + 4160749569 : 8421378 + }, + { + "0": 1074282512, + 16777216 : 16384, + 33554432 : 524288, + 50331648 : 1074266128, + 67108864 : 1073741840, + 83886080 : 1074282496, + 100663296 : 1073758208, + 117440512 : 16, + 134217728 : 540672, + 150994944 : 1073758224, + 167772160 : 1073741824, + 184549376 : 540688, + 201326592 : 524304, + 218103808 : 0, + 234881024 : 16400, + 251658240 : 1074266112, + 8388608 : 1073758208, + 25165824 : 540688, + 41943040 : 16, + 58720256 : 1073758224, + 75497472 : 1074282512, + 92274688 : 1073741824, + 109051904 : 524288, + 125829120 : 1074266128, + 142606336 : 524304, + 159383552 : 0, + 176160768 : 16384, + 192937984 : 1074266112, + 209715200 : 1073741840, + 226492416 : 540672, + 243269632 : 1074282496, + 260046848 : 16400, + 268435456 : 0, + 285212672 : 1074266128, + 301989888 : 1073758224, + 318767104 : 1074282496, + 335544320 : 1074266112, + 352321536 : 16, + 369098752 : 540688, + 385875968 : 16384, + 402653184 : 16400, + 419430400 : 524288, + 436207616 : 524304, + 452984832 : 1073741840, + 469762048 : 540672, + 486539264 : 1073758208, + 503316480 : 1073741824, + 520093696 : 1074282512, + 276824064 : 540688, + 293601280 : 524288, + 310378496 : 1074266112, + 327155712 : 16384, + 343932928 : 1073758208, + 360710144 : 1074282512, + 377487360 : 16, + 394264576 : 1073741824, + 411041792 : 1074282496, + 427819008 : 1073741840, + 444596224 : 1073758224, + 461373440 : 524304, + 478150656 : 0, + 494927872 : 16400, + 511705088 : 1074266128, + 528482304 : 540672 + }, + { + "0": 260, + 1048576 : 0, + 2097152 : 67109120, + 3145728 : 65796, + 4194304 : 65540, + 5242880 : 67108868, + 6291456 : 67174660, + 7340032 : 67174400, + 8388608 : 67108864, + 9437184 : 67174656, + 10485760 : 65792, + 11534336 : 67174404, + 12582912 : 67109124, + 13631488 : 65536, + 14680064 : 4, + 15728640 : 256, + 524288 : 67174656, + 1572864 : 67174404, + 2621440 : 0, + 3670016 : 67109120, + 4718592 : 67108868, + 5767168 : 65536, + 6815744 : 65540, + 7864320 : 260, + 8912896 : 4, + 9961472 : 256, + 11010048 : 67174400, + 12058624 : 65796, + 13107200 : 65792, + 14155776 : 67109124, + 15204352 : 67174660, + 16252928 : 67108864, + 16777216 : 67174656, + 17825792 : 65540, + 18874368 : 65536, + 19922944 : 67109120, + 20971520 : 256, + 22020096 : 67174660, + 23068672 : 67108868, + 24117248 : 0, + 25165824 : 67109124, + 26214400 : 67108864, + 27262976 : 4, + 28311552 : 65792, + 29360128 : 67174400, + 30408704 : 260, + 31457280 : 65796, + 32505856 : 67174404, + 17301504 : 67108864, + 18350080 : 260, + 19398656 : 67174656, + 20447232 : 0, + 21495808 : 65540, + 22544384 : 67109120, + 23592960 : 256, + 24641536 : 67174404, + 25690112 : 65536, + 26738688 : 67174660, + 27787264 : 65796, + 28835840 : 67108868, + 29884416 : 67109124, + 30932992 : 67174400, + 31981568 : 4, + 33030144 : 65792 + }, + { + "0": 2151682048, + 65536 : 2147487808, + 131072 : 4198464, + 196608 : 2151677952, + 262144 : 0, + 327680 : 4198400, + 393216 : 2147483712, + 458752 : 4194368, + 524288 : 2147483648, + 589824 : 4194304, + 655360 : 64, + 720896 : 2147487744, + 786432 : 2151678016, + 851968 : 4160, + 917504 : 4096, + 983040 : 2151682112, + 32768 : 2147487808, + 98304 : 64, + 163840 : 2151678016, + 229376 : 2147487744, + 294912 : 4198400, + 360448 : 2151682112, + 425984 : 0, + 491520 : 2151677952, + 557056 : 4096, + 622592 : 2151682048, + 688128 : 4194304, + 753664 : 4160, + 819200 : 2147483648, + 884736 : 4194368, + 950272 : 4198464, + 1015808 : 2147483712, + 1048576 : 4194368, + 1114112 : 4198400, + 1179648 : 2147483712, + 1245184 : 0, + 1310720 : 4160, + 1376256 : 2151678016, + 1441792 : 2151682048, + 1507328 : 2147487808, + 1572864 : 2151682112, + 1638400 : 2147483648, + 1703936 : 2151677952, + 1769472 : 4198464, + 1835008 : 2147487744, + 1900544 : 4194304, + 1966080 : 64, + 2031616 : 4096, + 1081344 : 2151677952, + 1146880 : 2151682112, + 1212416 : 0, + 1277952 : 4198400, + 1343488 : 4194368, + 1409024 : 2147483648, + 1474560 : 2147487808, + 1540096 : 64, + 1605632 : 2147483712, + 1671168 : 4096, + 1736704 : 2147487744, + 1802240 : 2151678016, + 1867776 : 4160, + 1933312 : 2151682048, + 1998848 : 4194304, + 2064384 : 4198464 + }, + { + "0": 128, + 4096 : 17039360, + 8192 : 262144, + 12288 : 536870912, + 16384 : 537133184, + 20480 : 16777344, + 24576 : 553648256, + 28672 : 262272, + 32768 : 16777216, + 36864 : 537133056, + 40960 : 536871040, + 45056 : 553910400, + 49152 : 553910272, + 53248 : 0, + 57344 : 17039488, + 61440 : 553648128, + 2048 : 17039488, + 6144 : 553648256, + 10240 : 128, + 14336 : 17039360, + 18432 : 262144, + 22528 : 537133184, + 26624 : 553910272, + 30720 : 536870912, + 34816 : 537133056, + 38912 : 0, + 43008 : 553910400, + 47104 : 16777344, + 51200 : 536871040, + 55296 : 553648128, + 59392 : 16777216, + 63488 : 262272, + 65536 : 262144, + 69632 : 128, + 73728 : 536870912, + 77824 : 553648256, + 81920 : 16777344, + 86016 : 553910272, + 90112 : 537133184, + 94208 : 16777216, + 98304 : 553910400, + 102400 : 553648128, + 106496 : 17039360, + 110592 : 537133056, + 114688 : 262272, + 118784 : 536871040, + 122880 : 0, + 126976 : 17039488, + 67584 : 553648256, + 71680 : 16777216, + 75776 : 17039360, + 79872 : 537133184, + 83968 : 536870912, + 88064 : 17039488, + 92160 : 128, + 96256 : 553910272, + 100352 : 262272, + 104448 : 553910400, + 108544 : 0, + 112640 : 553648128, + 116736 : 16777344, + 120832 : 262144, + 124928 : 537133056, + 129024 : 536871040 + }, + { + "0": 268435464, + 256 : 8192, + 512 : 270532608, + 768 : 270540808, + 1024 : 268443648, + 1280 : 2097152, + 1536 : 2097160, + 1792 : 268435456, + 2048 : 0, + 2304 : 268443656, + 2560 : 2105344, + 2816 : 8, + 3072 : 270532616, + 3328 : 2105352, + 3584 : 8200, + 3840 : 270540800, + 128 : 270532608, + 384 : 270540808, + 640 : 8, + 896 : 2097152, + 1152 : 2105352, + 1408 : 268435464, + 1664 : 268443648, + 1920 : 8200, + 2176 : 2097160, + 2432 : 8192, + 2688 : 268443656, + 2944 : 270532616, + 3200 : 0, + 3456 : 270540800, + 3712 : 2105344, + 3968 : 268435456, + 4096 : 268443648, + 4352 : 270532616, + 4608 : 270540808, + 4864 : 8200, + 5120 : 2097152, + 5376 : 268435456, + 5632 : 268435464, + 5888 : 2105344, + 6144 : 2105352, + 6400 : 0, + 6656 : 8, + 6912 : 270532608, + 7168 : 8192, + 7424 : 268443656, + 7680 : 270540800, + 7936 : 2097160, + 4224 : 8, + 4480 : 2105344, + 4736 : 2097152, + 4992 : 268435464, + 5248 : 268443648, + 5504 : 8200, + 5760 : 270540808, + 6016 : 270532608, + 6272 : 270540800, + 6528 : 270532616, + 6784 : 8192, + 7040 : 2105352, + 7296 : 2097160, + 7552 : 0, + 7808 : 268435456, + 8064 : 268443656 + }, + { + "0": 1048576, + 16 : 33555457, + 32 : 1024, + 48 : 1049601, + 64 : 34604033, + 80 : 0, + 96 : 1, + 112 : 34603009, + 128 : 33555456, + 144 : 1048577, + 160 : 33554433, + 176 : 34604032, + 192 : 34603008, + 208 : 1025, + 224 : 1049600, + 240 : 33554432, + 8 : 34603009, + 24 : 0, + 40 : 33555457, + 56 : 34604032, + 72 : 1048576, + 88 : 33554433, + 104 : 33554432, + 120 : 1025, + 136 : 1049601, + 152 : 33555456, + 168 : 34603008, + 184 : 1048577, + 200 : 1024, + 216 : 34604033, + 232 : 1, + 248 : 1049600, + 256 : 33554432, + 272 : 1048576, + 288 : 33555457, + 304 : 34603009, + 320 : 1048577, + 336 : 33555456, + 352 : 34604032, + 368 : 1049601, + 384 : 1025, + 400 : 34604033, + 416 : 1049600, + 432 : 1, + 448 : 0, + 464 : 34603008, + 480 : 33554433, + 496 : 1024, + 264 : 1049600, + 280 : 33555457, + 296 : 34603009, + 312 : 1, + 328 : 33554432, + 344 : 1048576, + 360 : 1025, + 376 : 34604032, + 392 : 33554433, + 408 : 34603008, + 424 : 0, + 440 : 34604033, + 456 : 1049601, + 472 : 1024, + 488 : 33555456, + 504 : 1048577 + }, + { + "0": 134219808, + 1 : 131072, + 2 : 134217728, + 3 : 32, + 4 : 131104, + 5 : 134350880, + 6 : 134350848, + 7 : 2048, + 8 : 134348800, + 9 : 134219776, + 10 : 133120, + 11 : 134348832, + 12 : 2080, + 13 : 0, + 14 : 134217760, + 15 : 133152, + 2147483648 : 2048, + 2147483649 : 134350880, + 2147483650 : 134219808, + 2147483651 : 134217728, + 2147483652 : 134348800, + 2147483653 : 133120, + 2147483654 : 133152, + 2147483655 : 32, + 2147483656 : 134217760, + 2147483657 : 2080, + 2147483658 : 131104, + 2147483659 : 134350848, + 2147483660 : 0, + 2147483661 : 134348832, + 2147483662 : 134219776, + 2147483663 : 131072, + 16 : 133152, + 17 : 134350848, + 18 : 32, + 19 : 2048, + 20 : 134219776, + 21 : 134217760, + 22 : 134348832, + 23 : 131072, + 24 : 0, + 25 : 131104, + 26 : 134348800, + 27 : 134219808, + 28 : 134350880, + 29 : 133120, + 30 : 2080, + 31 : 134217728, + 2147483664 : 131072, + 2147483665 : 2048, + 2147483666 : 134348832, + 2147483667 : 133152, + 2147483668 : 32, + 2147483669 : 134348800, + 2147483670 : 134217728, + 2147483671 : 134219808, + 2147483672 : 134350880, + 2147483673 : 134217760, + 2147483674 : 134219776, + 2147483675 : 0, + 2147483676 : 133120, + 2147483677 : 2080, + 2147483678 : 131104, + 2147483679 : 134350848 + }], + t = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], + m = g.DES = e.extend({ + _doReset: function() { + for (var b = this._key.words, + c = [], a = 0; 56 > a; a++) { + var f = q[a] - 1; + c[a] = b[f >>> 5] >>> 31 - f % 32 & 1 + } + b = this._subKeys = []; + for (f = 0; 16 > f; f++) { + for (var d = b[f] = [], e = r[f], a = 0; 24 > a; a++) d[a / 6 | 0] |= c[(p[a] - 1 + e) % 28] << 31 - a % 6, + d[4 + (a / 6 | 0)] |= c[28 + (p[a + 24] - 1 + e) % 28] << 31 - a % 6; + d[0] = d[0] << 1 | d[0] >>> 31; + for (a = 1; 7 > a; a++) d[a] >>>= 4 * (a - 1) + 3; + d[7] = d[7] << 5 | d[7] >>> 27 + } + c = this._invSubKeys = []; + for (a = 0; 16 > a; a++) c[a] = b[15 - a] + }, + encryptBlock: function(b, c) { + this._doCryptBlock(b, c, this._subKeys) + }, + decryptBlock: function(b, c) { + this._doCryptBlock(b, c, this._invSubKeys) + }, + _doCryptBlock: function(b, c, a) { + this._lBlock = b[c]; + this._rBlock = b[c + 1]; + j.call(this, 4, 252645135); + j.call(this, 16, 65535); + l.call(this, 2, 858993459); + l.call(this, 8, 16711935); + j.call(this, 1, 1431655765); + for (var f = 0; 16 > f; f++) { + for (var d = a[f], e = this._lBlock, h = this._rBlock, g = 0, k = 0; 8 > k; k++) g |= s[k][((h ^ d[k]) & t[k]) >>> 0]; + this._lBlock = h; + this._rBlock = e ^ g + } + a = this._lBlock; + this._lBlock = this._rBlock; + this._rBlock = a; + j.call(this, 1, 1431655765); + l.call(this, 8, 16711935); + l.call(this, 2, 858993459); + j.call(this, 16, 65535); + j.call(this, 4, 252645135); + b[c] = this._lBlock; + b[c + 1] = this._rBlock + }, + keySize: 2, + ivSize: 2, + blockSize: 2 + }); + h.DES = e._createHelper(m); + g = g.TripleDES = e.extend({ + _doReset: function() { + var b = this._key.words; + this._des1 = m.createEncryptor(n.create(b.slice(0, 2))); + this._des2 = m.createEncryptor(n.create(b.slice(2, 4))); + this._des3 = m.createEncryptor(n.create(b.slice(4, 6))) + }, + encryptBlock: function(b, c) { + this._des1.encryptBlock(b, c); + this._des2.decryptBlock(b, c); + this._des3.encryptBlock(b, c) + }, + decryptBlock: function(b, c) { + this._des3.decryptBlock(b, c); + this._des2.encryptBlock(b, c); + this._des1.decryptBlock(b, c) + }, + keySize: 6, + ivSize: 2, + blockSize: 2 + }); + h.TripleDES = e._createHelper(g) +})(); + +(function() { + var h = CryptoJS, + j = h.lib.WordArray; + h.enc.Base64 = { + stringify: function(b) { + var e = b.words, + f = b.sigBytes, + c = this._map; + b.clamp(); + b = []; + for (var a = 0; a < f; a += 3) for (var d = (e[a >>> 2] >>> 24 - 8 * (a % 4) & 255) << 16 | (e[a + 1 >>> 2] >>> 24 - 8 * ((a + 1) % 4) & 255) << 8 | e[a + 2 >>> 2] >>> 24 - 8 * ((a + 2) % 4) & 255, g = 0; 4 > g && a + 0.75 * g < f; g++) b.push(c.charAt(d >>> 6 * (3 - g) & 63)); + if (e = c.charAt(64)) for (; b.length % 4;) b.push(e); + return b.join("") + }, + parse: function(b) { + var e = b.length, + f = this._map, + c = f.charAt(64); + c && (c = b.indexOf(c), -1 != c && (e = c)); + for (var c = [], a = 0, d = 0; d < e; d++) if (d % 4) { + var g = f.indexOf(b.charAt(d - 1)) << 2 * (d % 4), + h = f.indexOf(b.charAt(d)) >>> 6 - 2 * (d % 4); + c[a >>> 2] |= (g | h) << 24 - 8 * (a % 4); + a++ + } + return j.create(c, a) + }, + _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" + } +})(); + +(function(E) { + function h(a, f, g, j, p, h, k) { + a = a + (f & g | ~f & j) + p + k; + return (a << h | a >>> 32 - h) + f + } + function k(a, f, g, j, p, h, k) { + a = a + (f & j | g & ~j) + p + k; + return (a << h | a >>> 32 - h) + f + } + function l(a, f, g, j, h, k, l) { + a = a + (f ^ g ^ j) + h + l; + return (a << k | a >>> 32 - k) + f + } + function n(a, f, g, j, h, k, l) { + a = a + (g ^ (f | ~j)) + h + l; + return (a << k | a >>> 32 - k) + f + } + for (var r = CryptoJS, + q = r.lib, + F = q.WordArray, + s = q.Hasher, + q = r.algo, + a = [], t = 0; 64 > t; t++) a[t] = 4294967296 * E.abs(E.sin(t + 1)) | 0; + q = q.MD5 = s.extend({ + _doReset: function() { + this._hash = new F.init([1732584193, 4023233417, 2562383102, 271733878]) + }, + _doProcessBlock: function(m, f) { + for (var g = 0; 16 > g; g++) { + var j = f + g, + p = m[j]; + m[j] = (p << 8 | p >>> 24) & 16711935 | (p << 24 | p >>> 8) & 4278255360 + } + var g = this._hash.words, + j = m[f + 0], + p = m[f + 1], + q = m[f + 2], + r = m[f + 3], + s = m[f + 4], + t = m[f + 5], + u = m[f + 6], + v = m[f + 7], + w = m[f + 8], + x = m[f + 9], + y = m[f + 10], + z = m[f + 11], + A = m[f + 12], + B = m[f + 13], + C = m[f + 14], + D = m[f + 15], + b = g[0], + c = g[1], + d = g[2], + e = g[3], + b = h(b, c, d, e, j, 7, a[0]), + e = h(e, b, c, d, p, 12, a[1]), + d = h(d, e, b, c, q, 17, a[2]), + c = h(c, d, e, b, r, 22, a[3]), + b = h(b, c, d, e, s, 7, a[4]), + e = h(e, b, c, d, t, 12, a[5]), + d = h(d, e, b, c, u, 17, a[6]), + c = h(c, d, e, b, v, 22, a[7]), + b = h(b, c, d, e, w, 7, a[8]), + e = h(e, b, c, d, x, 12, a[9]), + d = h(d, e, b, c, y, 17, a[10]), + c = h(c, d, e, b, z, 22, a[11]), + b = h(b, c, d, e, A, 7, a[12]), + e = h(e, b, c, d, B, 12, a[13]), + d = h(d, e, b, c, C, 17, a[14]), + c = h(c, d, e, b, D, 22, a[15]), + b = k(b, c, d, e, p, 5, a[16]), + e = k(e, b, c, d, u, 9, a[17]), + d = k(d, e, b, c, z, 14, a[18]), + c = k(c, d, e, b, j, 20, a[19]), + b = k(b, c, d, e, t, 5, a[20]), + e = k(e, b, c, d, y, 9, a[21]), + d = k(d, e, b, c, D, 14, a[22]), + c = k(c, d, e, b, s, 20, a[23]), + b = k(b, c, d, e, x, 5, a[24]), + e = k(e, b, c, d, C, 9, a[25]), + d = k(d, e, b, c, r, 14, a[26]), + c = k(c, d, e, b, w, 20, a[27]), + b = k(b, c, d, e, B, 5, a[28]), + e = k(e, b, c, d, q, 9, a[29]), + d = k(d, e, b, c, v, 14, a[30]), + c = k(c, d, e, b, A, 20, a[31]), + b = l(b, c, d, e, t, 4, a[32]), + e = l(e, b, c, d, w, 11, a[33]), + d = l(d, e, b, c, z, 16, a[34]), + c = l(c, d, e, b, C, 23, a[35]), + b = l(b, c, d, e, p, 4, a[36]), + e = l(e, b, c, d, s, 11, a[37]), + d = l(d, e, b, c, v, 16, a[38]), + c = l(c, d, e, b, y, 23, a[39]), + b = l(b, c, d, e, B, 4, a[40]), + e = l(e, b, c, d, j, 11, a[41]), + d = l(d, e, b, c, r, 16, a[42]), + c = l(c, d, e, b, u, 23, a[43]), + b = l(b, c, d, e, x, 4, a[44]), + e = l(e, b, c, d, A, 11, a[45]), + d = l(d, e, b, c, D, 16, a[46]), + c = l(c, d, e, b, q, 23, a[47]), + b = n(b, c, d, e, j, 6, a[48]), + e = n(e, b, c, d, v, 10, a[49]), + d = n(d, e, b, c, C, 15, a[50]), + c = n(c, d, e, b, t, 21, a[51]), + b = n(b, c, d, e, A, 6, a[52]), + e = n(e, b, c, d, r, 10, a[53]), + d = n(d, e, b, c, y, 15, a[54]), + c = n(c, d, e, b, p, 21, a[55]), + b = n(b, c, d, e, w, 6, a[56]), + e = n(e, b, c, d, D, 10, a[57]), + d = n(d, e, b, c, u, 15, a[58]), + c = n(c, d, e, b, B, 21, a[59]), + b = n(b, c, d, e, s, 6, a[60]), + e = n(e, b, c, d, z, 10, a[61]), + d = n(d, e, b, c, q, 15, a[62]), + c = n(c, d, e, b, x, 21, a[63]); + g[0] = g[0] + b | 0; + g[1] = g[1] + c | 0; + g[2] = g[2] + d | 0; + g[3] = g[3] + e | 0 + }, + _doFinalize: function() { + var a = this._data, + f = a.words, + g = 8 * this._nDataBytes, + j = 8 * a.sigBytes; + f[j >>> 5] |= 128 << 24 - j % 32; + var h = E.floor(g / 4294967296); + f[(j + 64 >>> 9 << 4) + 15] = (h << 8 | h >>> 24) & 16711935 | (h << 24 | h >>> 8) & 4278255360; + f[(j + 64 >>> 9 << 4) + 14] = (g << 8 | g >>> 24) & 16711935 | (g << 24 | g >>> 8) & 4278255360; + a.sigBytes = 4 * (f.length + 1); + this._process(); + a = this._hash; + f = a.words; + for (g = 0; 4 > g; g++) j = f[g], + f[g] = (j << 8 | j >>> 24) & 16711935 | (j << 24 | j >>> 8) & 4278255360; + return a + }, + clone: function() { + var a = s.clone.call(this); + a._hash = this._hash.clone(); + return a + } + }); + r.MD5 = s._createHelper(q); + r.HmacMD5 = s._createHmacHelper(q) +})(Math); + +(function() { + var k = CryptoJS, + b = k.lib, + m = b.WordArray, + l = b.Hasher, + d = [], + b = k.algo.SHA1 = l.extend({ + _doReset: function() { + this._hash = new m.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) + }, + _doProcessBlock: function(n, p) { + for (var a = this._hash.words, + e = a[0], f = a[1], h = a[2], j = a[3], b = a[4], c = 0; 80 > c; c++) { + if (16 > c) d[c] = n[p + c] | 0; + else { + var g = d[c - 3] ^ d[c - 8] ^ d[c - 14] ^ d[c - 16]; + d[c] = g << 1 | g >>> 31 + } + g = (e << 5 | e >>> 27) + b + d[c]; + g = 20 > c ? g + ((f & h | ~f & j) + 1518500249) : 40 > c ? g + ((f ^ h ^ j) + 1859775393) : 60 > c ? g + ((f & h | f & j | h & j) - 1894007588) : g + ((f ^ h ^ j) - 899497514); + b = j; + j = h; + h = f << 30 | f >>> 2; + f = e; + e = g + } + a[0] = a[0] + e | 0; + a[1] = a[1] + f | 0; + a[2] = a[2] + h | 0; + a[3] = a[3] + j | 0; + a[4] = a[4] + b | 0 + }, + _doFinalize: function() { + var b = this._data, + d = b.words, + a = 8 * this._nDataBytes, + e = 8 * b.sigBytes; + d[e >>> 5] |= 128 << 24 - e % 32; + d[(e + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296); + d[(e + 64 >>> 9 << 4) + 15] = a; + b.sigBytes = 4 * d.length; + this._process(); + return this._hash + }, + clone: function() { + var b = l.clone.call(this); + b._hash = this._hash.clone(); + return b + } + }); + k.SHA1 = l._createHelper(b); + k.HmacSHA1 = l._createHmacHelper(b) +})(); + +(function(k) { + for (var g = CryptoJS, + h = g.lib, + v = h.WordArray, + j = h.Hasher, + h = g.algo, + s = [], t = [], u = function(q) { + return 4294967296 * (q - (q | 0)) | 0 + }, + l = 2, b = 0; 64 > b;) { + var d; + a: { + d = l; + for (var w = k.sqrt(d), r = 2; r <= w; r++) if (! (d % r)) { + d = !1; + break a + } + d = !0 + } + d && (8 > b && (s[b] = u(k.pow(l, 0.5))), t[b] = u(k.pow(l, 1 / 3)), b++); + l++ + } + var n = [], + h = h.SHA256 = j.extend({ + _doReset: function() { + this._hash = new v.init(s.slice(0)) + }, + _doProcessBlock: function(q, h) { + for (var a = this._hash.words, + c = a[0], d = a[1], b = a[2], k = a[3], f = a[4], g = a[5], j = a[6], l = a[7], e = 0; 64 > e; e++) { + if (16 > e) n[e] = q[h + e] | 0; + else { + var m = n[e - 15], + p = n[e - 2]; + n[e] = ((m << 25 | m >>> 7) ^ (m << 14 | m >>> 18) ^ m >>> 3) + n[e - 7] + ((p << 15 | p >>> 17) ^ (p << 13 | p >>> 19) ^ p >>> 10) + n[e - 16] + } + m = l + ((f << 26 | f >>> 6) ^ (f << 21 | f >>> 11) ^ (f << 7 | f >>> 25)) + (f & g ^ ~f & j) + t[e] + n[e]; + p = ((c << 30 | c >>> 2) ^ (c << 19 | c >>> 13) ^ (c << 10 | c >>> 22)) + (c & d ^ c & b ^ d & b); + l = j; + j = g; + g = f; + f = k + m | 0; + k = b; + b = d; + d = c; + c = m + p | 0 + } + a[0] = a[0] + c | 0; + a[1] = a[1] + d | 0; + a[2] = a[2] + b | 0; + a[3] = a[3] + k | 0; + a[4] = a[4] + f | 0; + a[5] = a[5] + g | 0; + a[6] = a[6] + j | 0; + a[7] = a[7] + l | 0 + }, + _doFinalize: function() { + var d = this._data, + b = d.words, + a = 8 * this._nDataBytes, + c = 8 * d.sigBytes; + b[c >>> 5] |= 128 << 24 - c % 32; + b[(c + 64 >>> 9 << 4) + 14] = k.floor(a / 4294967296); + b[(c + 64 >>> 9 << 4) + 15] = a; + d.sigBytes = 4 * b.length; + this._process(); + return this._hash + }, + clone: function() { + var b = j.clone.call(this); + b._hash = this._hash.clone(); + return b + } + }); + g.SHA256 = j._createHelper(h); + g.HmacSHA256 = j._createHmacHelper(h) +})(Math); + +(function() { + var b = CryptoJS, + d = b.lib.WordArray, + a = b.algo, + c = a.SHA256, + a = a.SHA224 = c.extend({ + _doReset: function() { + this._hash = new d.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]) + }, + _doFinalize: function() { + var a = c._doFinalize.call(this); + a.sigBytes -= 4; + return a + } + }); + b.SHA224 = c._createHelper(a); + b.HmacSHA224 = c._createHmacHelper(a) +})(); + +(function() { + function a() { + return d.create.apply(d, arguments) + } + for (var n = CryptoJS, + r = n.lib.Hasher, + e = n.x64, + d = e.Word, + T = e.WordArray, + e = n.algo, + ea = [a(1116352408, 3609767458), a(1899447441, 602891725), a(3049323471, 3964484399), a(3921009573, 2173295548), a(961987163, 4081628472), a(1508970993, 3053834265), a(2453635748, 2937671579), a(2870763221, 3664609560), a(3624381080, 2734883394), a(310598401, 1164996542), a(607225278, 1323610764), a(1426881987, 3590304994), a(1925078388, 4068182383), a(2162078206, 991336113), a(2614888103, 633803317), a(3248222580, 3479774868), a(3835390401, 2666613458), a(4022224774, 944711139), a(264347078, 2341262773), a(604807628, 2007800933), a(770255983, 1495990901), a(1249150122, 1856431235), a(1555081692, 3175218132), a(1996064986, 2198950837), a(2554220882, 3999719339), a(2821834349, 766784016), a(2952996808, 2566594879), a(3210313671, 3203337956), a(3336571891, 1034457026), a(3584528711, 2466948901), a(113926993, 3758326383), a(338241895, 168717936), a(666307205, 1188179964), a(773529912, 1546045734), a(1294757372, 1522805485), a(1396182291, 2643833823), a(1695183700, 2343527390), a(1986661051, 1014477480), a(2177026350, 1206759142), a(2456956037, 344077627), a(2730485921, 1290863460), a(2820302411, 3158454273), a(3259730800, 3505952657), a(3345764771, 106217008), a(3516065817, 3606008344), a(3600352804, 1432725776), a(4094571909, 1467031594), a(275423344, 851169720), a(430227734, 3100823752), a(506948616, 1363258195), a(659060556, 3750685593), a(883997877, 3785050280), a(958139571, 3318307427), a(1322822218, 3812723403), a(1537002063, 2003034995), a(1747873779, 3602036899), a(1955562222, 1575990012), a(2024104815, 1125592928), a(2227730452, 2716904306), a(2361852424, 442776044), a(2428436474, 593698344), a(2756734187, 3733110249), a(3204031479, 2999351573), a(3329325298, 3815920427), a(3391569614, 3928383900), a(3515267271, 566280711), a(3940187606, 3454069534), a(4118630271, 4000239992), a(116418474, 1914138554), a(174292421, 2731055270), a(289380356, 3203993006), a(460393269, 320620315), a(685471733, 587496836), a(852142971, 1086792851), a(1017036298, 365543100), a(1126000580, 2618297676), a(1288033470, 3409855158), a(1501505948, 4234509866), a(1607167915, 987167468), a(1816402316, 1246189591)], v = [], w = 0; 80 > w; w++) v[w] = a(); + e = e.SHA512 = r.extend({ + _doReset: function() { + this._hash = new T.init([new d.init(1779033703, 4089235720), new d.init(3144134277, 2227873595), new d.init(1013904242, 4271175723), new d.init(2773480762, 1595750129), new d.init(1359893119, 2917565137), new d.init(2600822924, 725511199), new d.init(528734635, 4215389547), new d.init(1541459225, 327033209)]) + }, + _doProcessBlock: function(a, d) { + for (var f = this._hash.words, + F = f[0], e = f[1], n = f[2], r = f[3], G = f[4], H = f[5], I = f[6], f = f[7], w = F.high, J = F.low, X = e.high, K = e.low, Y = n.high, L = n.low, Z = r.high, M = r.low, $ = G.high, N = G.low, aa = H.high, O = H.low, ba = I.high, P = I.low, ca = f.high, Q = f.low, k = w, g = J, z = X, x = K, A = Y, y = L, U = Z, B = M, l = $, h = N, R = aa, C = O, S = ba, D = P, V = ca, E = Q, m = 0; 80 > m; m++) { + var s = v[m]; + if (16 > m) var j = s.high = a[d + 2 * m] | 0, + b = s.low = a[d + 2 * m + 1] | 0; + else { + var j = v[m - 15], + b = j.high, + p = j.low, + j = (b >>> 1 | p << 31) ^ (b >>> 8 | p << 24) ^ b >>> 7, + p = (p >>> 1 | b << 31) ^ (p >>> 8 | b << 24) ^ (p >>> 7 | b << 25), + u = v[m - 2], + b = u.high, + c = u.low, + u = (b >>> 19 | c << 13) ^ (b << 3 | c >>> 29) ^ b >>> 6, + c = (c >>> 19 | b << 13) ^ (c << 3 | b >>> 29) ^ (c >>> 6 | b << 26), + b = v[m - 7], + W = b.high, + t = v[m - 16], + q = t.high, + t = t.low, + b = p + b.low, + j = j + W + (b >>> 0 < p >>> 0 ? 1 : 0), + b = b + c, + j = j + u + (b >>> 0 < c >>> 0 ? 1 : 0), + b = b + t, + j = j + q + (b >>> 0 < t >>> 0 ? 1 : 0); + s.high = j; + s.low = b + } + var W = l & R ^ ~l & S, + t = h & C ^ ~h & D, + s = k & z ^ k & A ^ z & A, + T = g & x ^ g & y ^ x & y, + p = (k >>> 28 | g << 4) ^ (k << 30 | g >>> 2) ^ (k << 25 | g >>> 7), + u = (g >>> 28 | k << 4) ^ (g << 30 | k >>> 2) ^ (g << 25 | k >>> 7), + c = ea[m], + fa = c.high, + da = c.low, + c = E + ((h >>> 14 | l << 18) ^ (h >>> 18 | l << 14) ^ (h << 23 | l >>> 9)), + q = V + ((l >>> 14 | h << 18) ^ (l >>> 18 | h << 14) ^ (l << 23 | h >>> 9)) + (c >>> 0 < E >>> 0 ? 1 : 0), + c = c + t, + q = q + W + (c >>> 0 < t >>> 0 ? 1 : 0), + c = c + da, + q = q + fa + (c >>> 0 < da >>> 0 ? 1 : 0), + c = c + b, + q = q + j + (c >>> 0 < b >>> 0 ? 1 : 0), + b = u + T, + s = p + s + (b >>> 0 < u >>> 0 ? 1 : 0), + V = S, + E = D, + S = R, + D = C, + R = l, + C = h, + h = B + c | 0, + l = U + q + (h >>> 0 < B >>> 0 ? 1 : 0) | 0, + U = A, + B = y, + A = z, + y = x, + z = k, + x = g, + g = c + b | 0, + k = q + s + (g >>> 0 < c >>> 0 ? 1 : 0) | 0 + } + J = F.low = J + g; + F.high = w + k + (J >>> 0 < g >>> 0 ? 1 : 0); + K = e.low = K + x; + e.high = X + z + (K >>> 0 < x >>> 0 ? 1 : 0); + L = n.low = L + y; + n.high = Y + A + (L >>> 0 < y >>> 0 ? 1 : 0); + M = r.low = M + B; + r.high = Z + U + (M >>> 0 < B >>> 0 ? 1 : 0); + N = G.low = N + h; + G.high = $ + l + (N >>> 0 < h >>> 0 ? 1 : 0); + O = H.low = O + C; + H.high = aa + R + (O >>> 0 < C >>> 0 ? 1 : 0); + P = I.low = P + D; + I.high = ba + S + (P >>> 0 < D >>> 0 ? 1 : 0); + Q = f.low = Q + E; + f.high = ca + V + (Q >>> 0 < E >>> 0 ? 1 : 0) + }, + _doFinalize: function() { + var a = this._data, + d = a.words, + f = 8 * this._nDataBytes, + e = 8 * a.sigBytes; + d[e >>> 5] |= 128 << 24 - e % 32; + d[(e + 128 >>> 10 << 5) + 30] = Math.floor(f / 4294967296); + d[(e + 128 >>> 10 << 5) + 31] = f; + a.sigBytes = 4 * d.length; + this._process(); + return this._hash.toX32() + }, + clone: function() { + var a = r.clone.call(this); + a._hash = this._hash.clone(); + return a + }, + blockSize: 32 + }); + n.SHA512 = r._createHelper(e); + n.HmacSHA512 = r._createHmacHelper(e) +})(); + +(function() { + var c = CryptoJS, + a = c.x64, + b = a.Word, + e = a.WordArray, + a = c.algo, + d = a.SHA512, + a = a.SHA384 = d.extend({ + _doReset: function() { + this._hash = new e.init([new b.init(3418070365, 3238371032), new b.init(1654270250, 914150663), new b.init(2438529370, 812702999), new b.init(355462360, 4144912697), new b.init(1731405415, 4290775857), new b.init(2394180231, 1750603025), new b.init(3675008525, 1694076839), new b.init(1203062813, 3204075428)]) + }, + _doFinalize: function() { + var a = d._doFinalize.call(this); + a.sigBytes -= 16; + return a + } + }); + c.SHA384 = d._createHelper(a); + c.HmacSHA384 = d._createHmacHelper(a) +})(); + +(function() { + var q = CryptoJS, + d = q.lib, + n = d.WordArray, + p = d.Hasher, + d = q.algo, + x = n.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]), + y = n.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]), + z = n.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]), + A = n.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]), + B = n.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), + C = n.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), + d = d.RIPEMD160 = p.extend({ + _doReset: function() { + this._hash = n.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) + }, + _doProcessBlock: function(e, v) { + for (var b = 0; 16 > b; b++) { + var c = v + b, + f = e[c]; + e[c] = (f << 8 | f >>> 24) & 16711935 | (f << 24 | f >>> 8) & 4278255360 + } + var c = this._hash.words, + f = B.words, + d = C.words, + n = x.words, + q = y.words, + p = z.words, + w = A.words, + t, g, h, j, r, u, k, l, m, s; + u = t = c[0]; + k = g = c[1]; + l = h = c[2]; + m = j = c[3]; + s = r = c[4]; + for (var a, b = 0; 80 > b; b += 1) a = t + e[v + n[b]] | 0, + a = 16 > b ? a + ((g ^ h ^ j) + f[0]) : 32 > b ? a + ((g & h | ~g & j) + f[1]) : 48 > b ? a + (((g | ~h) ^ j) + f[2]) : 64 > b ? a + ((g & j | h & ~j) + f[3]) : a + ((g ^ (h | ~j)) + f[4]), + a |= 0, + a = a << p[b] | a >>> 32 - p[b], + a = a + r | 0, + t = r, + r = j, + j = h << 10 | h >>> 22, + h = g, + g = a, + a = u + e[v + q[b]] | 0, + a = 16 > b ? a + ((k ^ (l | ~m)) + d[0]) : 32 > b ? a + ((k & m | l & ~m) + d[1]) : 48 > b ? a + (((k | ~l) ^ m) + d[2]) : 64 > b ? a + ((k & l | ~k & m) + d[3]) : a + ((k ^ l ^ m) + d[4]), + a |= 0, + a = a << w[b] | a >>> 32 - w[b], + a = a + s | 0, + u = s, + s = m, + m = l << 10 | l >>> 22, + l = k, + k = a; + a = c[1] + h + m | 0; + c[1] = c[2] + j + s | 0; + c[2] = c[3] + r + u | 0; + c[3] = c[4] + t + k | 0; + c[4] = c[0] + g + l | 0; + c[0] = a + }, + _doFinalize: function() { + var e = this._data, + d = e.words, + b = 8 * this._nDataBytes, + c = 8 * e.sigBytes; + d[c >>> 5] |= 128 << 24 - c % 32; + d[(c + 64 >>> 9 << 4) + 14] = (b << 8 | b >>> 24) & 16711935 | (b << 24 | b >>> 8) & 4278255360; + e.sigBytes = 4 * (d.length + 1); + this._process(); + e = this._hash; + d = e.words; + for (b = 0; 5 > b; b++) c = d[b], + d[b] = (c << 8 | c >>> 24) & 16711935 | (c << 24 | c >>> 8) & 4278255360; + return e + }, + clone: function() { + var d = p.clone.call(this); + d._hash = this._hash.clone(); + return d + } + }); + q.RIPEMD160 = p._createHelper(d); + q.HmacRIPEMD160 = p._createHmacHelper(d) +})(Math); + +/* +CryptoJS v3.1.2 hmac.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function() { + var c = CryptoJS, + k = c.enc.Utf8; + c.algo.HMAC = c.lib.Base.extend({ + init: function(a, b) { + a = this._hasher = new a.init; + "string" == typeof b && (b = k.parse(b)); + var c = a.blockSize, + e = 4 * c; + b.sigBytes > e && (b = a.finalize(b)); + b.clamp(); + for (var f = this._oKey = b.clone(), g = this._iKey = b.clone(), h = f.words, j = g.words, d = 0; d < c; d++) h[d] ^= 1549556828, + j[d] ^= 909522486; + f.sigBytes = g.sigBytes = e; + this.reset() + }, + reset: function() { + var a = this._hasher; + a.reset(); + a.update(this._iKey) + }, + update: function(a) { + this._hasher.update(a); + return this + }, + finalize: function(a) { + var b = this._hasher; + a = b.finalize(a); + b.reset(); + return b.finalize(this._oKey.clone().concat(a)) + } + }) +})(); + +/* +CryptoJS v3.1.2 pbkdf2-min.js +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +(function() { + var b = CryptoJS, + a = b.lib, + d = a.Base, + m = a.WordArray, + a = b.algo, + q = a.HMAC, + l = a.PBKDF2 = d.extend({ + cfg: d.extend({ + keySize: 4, + hasher: a.SHA1, + iterations: 1 + }), + init: function(a) { + this.cfg = this.cfg.extend(a) + }, + compute: function(a, b) { + for (var c = this.cfg, + f = q.create(c.hasher, a), g = m.create(), d = m.create([1]), l = g.words, r = d.words, n = c.keySize, c = c.iterations; l.length < n;) { + var h = f.update(b).finalize(d); + f.reset(); + for (var j = h.words, + s = j.length, + k = h, + p = 1; p < c; p++) { + k = f.finalize(k); + f.reset(); + for (var t = k.words, + e = 0; e < s; e++) j[e] ^= t[e] + } + g.concat(h); + r[0]++ + } + g.sigBytes = 4 * n; + return g + } + }); + b.PBKDF2 = function(a, b, c) { + return l.create(c).compute(a, b) + } +})(); + +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +var b64pad = "="; +function hex2b64(d) { + var b; + var e; + var a = ""; + for (b = 0; b + 3 <= d.length; b += 3) { + e = parseInt(d.substring(b, b + 3), 16); + a += b64map.charAt(e >> 6) + b64map.charAt(e & 63) + } + if (b + 1 == d.length) { + e = parseInt(d.substring(b, b + 1), 16); + a += b64map.charAt(e << 2) + } else { + if (b + 2 == d.length) { + e = parseInt(d.substring(b, b + 2), 16); + a += b64map.charAt(e >> 2) + b64map.charAt((e & 3) << 4) + } + } + if (b64pad) { + while ((a.length & 3) > 0) { + a += b64pad + } + } + return a +} +function b64tohex(f) { + var d = ""; + var e; + var b = 0; + var c; + var a; + for (e = 0; e < f.length; ++e) { + if (f.charAt(e) == b64pad) { + break + } + a = b64map.indexOf(f.charAt(e)); + if (a < 0) { + continue + } + if (b == 0) { + d += int2char(a >> 2); + c = a & 3; + b = 1 + } else { + if (b == 1) { + d += int2char((c << 2) | (a >> 4)); + c = a & 15; + b = 2 + } else { + if (b == 2) { + d += int2char(c); + d += int2char(a >> 2); + c = a & 3; + b = 3 + } else { + d += int2char((c << 2) | (a >> 4)); + d += int2char(a & 15); + b = 0 + } + } + } + } + if (b == 1) { + d += int2char(c << 2) + } + return d +} +function b64toBA(e) { + var d = b64tohex(e); + var c; + var b = new Array(); + for (c = 0; 2 * c < d.length; ++c) { + b[c] = parseInt(d.substring(2 * c, 2 * c + 2), 16) + } + return b +}; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +var dbits; +var canary = 244837814094590; +var j_lm = ((canary & 16777215) == 15715070); +function BigInteger(e, d, f) { + if (e != null) { + if ("number" == typeof e) { + this.fromNumber(e, d, f) + } else { + if (d == null && "string" != typeof e) { + this.fromString(e, 256) + } else { + this.fromString(e, d) + } + } + } +} +function nbi() { + return new BigInteger(null) +} +function am1(f, a, b, e, h, g) { + while (--g >= 0) { + var d = a * this[f++] + b[e] + h; + h = Math.floor(d / 67108864); + b[e++] = d & 67108863 + } + return h +} +function am2(f, q, r, e, o, a) { + var k = q & 32767, + p = q >> 15; + while (--a >= 0) { + var d = this[f] & 32767; + var g = this[f++] >> 15; + var b = p * d + g * k; + d = k * d + ((b & 32767) << 15) + r[e] + (o & 1073741823); + o = (d >>> 30) + (b >>> 15) + p * g + (o >>> 30); + r[e++] = d & 1073741823 + } + return o +} +function am3(f, q, r, e, o, a) { + var k = q & 16383, + p = q >> 14; + while (--a >= 0) { + var d = this[f] & 16383; + var g = this[f++] >> 14; + var b = p * d + g * k; + d = k * d + ((b & 16383) << 14) + r[e] + o; + o = (d >> 28) + (b >> 14) + p * g; + r[e++] = d & 268435455 + } + return o +} +if (j_lm && (navigator2.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30 +} else { + if (j_lm && (navigator2.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26 + } else { + BigInteger.prototype.am = am3; + dbits = 28 + } +} +BigInteger.prototype.DB = dbits; +BigInteger.prototype.DM = ((1 << dbits) - 1); +BigInteger.prototype.DV = (1 << dbits); +var BI_FP = 52; +BigInteger.prototype.FV = Math.pow(2, BI_FP); +BigInteger.prototype.F1 = BI_FP - dbits; +BigInteger.prototype.F2 = 2 * dbits - BI_FP; +var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; +var BI_RC = new Array(); +var rr, vv; +rr = "0".charCodeAt(0); +for (vv = 0; vv <= 9; ++vv) { + BI_RC[rr++] = vv +} +rr = "a".charCodeAt(0); +for (vv = 10; vv < 36; ++vv) { + BI_RC[rr++] = vv +} +rr = "A".charCodeAt(0); +for (vv = 10; vv < 36; ++vv) { + BI_RC[rr++] = vv +} +function int2char(a) { + return BI_RM.charAt(a) +} +function intAt(b, a) { + var d = BI_RC[b.charCodeAt(a)]; + return (d == null) ? -1 : d +} +function bnpCopyTo(b) { + for (var a = this.t - 1; a >= 0; --a) { + b[a] = this[a] + } + b.t = this.t; + b.s = this.s +} +function bnpFromInt(a) { + this.t = 1; + this.s = (a < 0) ? -1 : 0; + if (a > 0) { + this[0] = a + } else { + if (a < -1) { + this[0] = a + this.DV + } else { + this.t = 0 + } + } +} +function nbv(a) { + var b = nbi(); + b.fromInt(a); + return b +} +function bnpFromString(h, c) { + var e; + if (c == 16) { + e = 4 + } else { + if (c == 8) { + e = 3 + } else { + if (c == 256) { + e = 8 + } else { + if (c == 2) { + e = 1 + } else { + if (c == 32) { + e = 5 + } else { + if (c == 4) { + e = 2 + } else { + this.fromRadix(h, c); + return + } + } + } + } + } + } + this.t = 0; + this.s = 0; + var g = h.length, + d = false, + f = 0; + while (--g >= 0) { + var a = (e == 8) ? h[g] & 255 : intAt(h, g); + if (a < 0) { + if (h.charAt(g) == "-") { + d = true + } + continue + } + d = false; + if (f == 0) { + this[this.t++] = a + } else { + if (f + e > this.DB) { + this[this.t - 1] |= (a & ((1 << (this.DB - f)) - 1)) << f; + this[this.t++] = (a >> (this.DB - f)) + } else { + this[this.t - 1] |= a << f + } + } + f += e; + if (f >= this.DB) { + f -= this.DB + } + } + if (e == 8 && (h[0] & 128) != 0) { + this.s = -1; + if (f > 0) { + this[this.t - 1] |= ((1 << (this.DB - f)) - 1) << f + } + } + this.clamp(); + if (d) { + BigInteger.ZERO.subTo(this, this) + } +} +function bnpClamp() { + var a = this.s & this.DM; + while (this.t > 0 && this[this.t - 1] == a) {--this.t + } +} +function bnToString(c) { + if (this.s < 0) { + return "-" + this.negate().toString(c) + } + var e; + if (c == 16) { + e = 4 + } else { + if (c == 8) { + e = 3 + } else { + if (c == 2) { + e = 1 + } else { + if (c == 32) { + e = 5 + } else { + if (c == 4) { + e = 2 + } else { + return this.toRadix(c) + } + } + } + } + } + var g = (1 << e) - 1, + l, + a = false, + h = "", + f = this.t; + var j = this.DB - (f * this.DB) % e; + if (f-->0) { + if (j < this.DB && (l = this[f] >> j) > 0) { + a = true; + h = int2char(l) + } + while (f >= 0) { + if (j < e) { + l = (this[f] & ((1 << j) - 1)) << (e - j); + l |= this[--f] >> (j += this.DB - e) + } else { + l = (this[f] >> (j -= e)) & g; + if (j <= 0) { + j += this.DB; --f + } + } + if (l > 0) { + a = true + } + if (a) { + h += int2char(l) + } + } + } + return a ? h: "0" +} +function bnNegate() { + var a = nbi(); + BigInteger.ZERO.subTo(this, a); + return a +} +function bnAbs() { + return (this.s < 0) ? this.negate() : this +} +function bnCompareTo(b) { + var d = this.s - b.s; + if (d != 0) { + return d + } + var c = this.t; + d = c - b.t; + if (d != 0) { + return (this.s < 0) ? -d: d + } + while (--c >= 0) { + if ((d = this[c] - b[c]) != 0) { + return d + } + } + return 0 +} +function nbits(a) { + var c = 1, + b; + if ((b = a >>> 16) != 0) { + a = b; + c += 16 + } + if ((b = a >> 8) != 0) { + a = b; + c += 8 + } + if ((b = a >> 4) != 0) { + a = b; + c += 4 + } + if ((b = a >> 2) != 0) { + a = b; + c += 2 + } + if ((b = a >> 1) != 0) { + a = b; + c += 1 + } + return c +} +function bnBitLength() { + if (this.t <= 0) { + return 0 + } + return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM)) +} +function bnpDLShiftTo(c, b) { + var a; + for (a = this.t - 1; a >= 0; --a) { + b[a + c] = this[a] + } + for (a = c - 1; a >= 0; --a) { + b[a] = 0 + } + b.t = this.t + c; + b.s = this.s +} +function bnpDRShiftTo(c, b) { + for (var a = c; a < this.t; ++a) { + b[a - c] = this[a] + } + b.t = Math.max(this.t - c, 0); + b.s = this.s +} +function bnpLShiftTo(j, e) { + var b = j % this.DB; + var a = this.DB - b; + var g = (1 << a) - 1; + var f = Math.floor(j / this.DB), + h = (this.s << b) & this.DM, + d; + for (d = this.t - 1; d >= 0; --d) { + e[d + f + 1] = (this[d] >> a) | h; + h = (this[d] & g) << b + } + for (d = f - 1; d >= 0; --d) { + e[d] = 0 + } + e[f] = h; + e.t = this.t + f + 1; + e.s = this.s; + e.clamp() +} +function bnpRShiftTo(g, d) { + d.s = this.s; + var e = Math.floor(g / this.DB); + if (e >= this.t) { + d.t = 0; + return + } + var b = g % this.DB; + var a = this.DB - b; + var f = (1 << b) - 1; + d[0] = this[e] >> b; + for (var c = e + 1; c < this.t; ++c) { + d[c - e - 1] |= (this[c] & f) << a; + d[c - e] = this[c] >> b + } + if (b > 0) { + d[this.t - e - 1] |= (this.s & f) << a + } + d.t = this.t - e; + d.clamp() +} +function bnpSubTo(d, f) { + var e = 0, + g = 0, + b = Math.min(d.t, this.t); + while (e < b) { + g += this[e] - d[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + if (d.t < this.t) { + g -= d.s; + while (e < this.t) { + g += this[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + g += this.s + } else { + g += this.s; + while (e < d.t) { + g -= d[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + g -= d.s + } + f.s = (g < 0) ? -1 : 0; + if (g < -1) { + f[e++] = this.DV + g + } else { + if (g > 0) { + f[e++] = g + } + } + f.t = e; + f.clamp() +} +function bnpMultiplyTo(c, e) { + var b = this.abs(), + f = c.abs(); + var d = b.t; + e.t = d + f.t; + while (--d >= 0) { + e[d] = 0 + } + for (d = 0; d < f.t; ++d) { + e[d + b.t] = b.am(0, f[d], e, d, 0, b.t) + } + e.s = 0; + e.clamp(); + if (this.s != c.s) { + BigInteger.ZERO.subTo(e, e) + } +} +function bnpSquareTo(d) { + var a = this.abs(); + var b = d.t = 2 * a.t; + while (--b >= 0) { + d[b] = 0 + } + for (b = 0; b < a.t - 1; ++b) { + var e = a.am(b, a[b], d, 2 * b, 0, 1); + if ((d[b + a.t] += a.am(b + 1, 2 * a[b], d, 2 * b + 1, e, a.t - b - 1)) >= a.DV) { + d[b + a.t] -= a.DV; + d[b + a.t + 1] = 1 + } + } + if (d.t > 0) { + d[d.t - 1] += a.am(b, a[b], d, 2 * b, 0, 1) + } + d.s = 0; + d.clamp() +} +function bnpDivRemTo(n, h, g) { + var w = n.abs(); + if (w.t <= 0) { + return + } + var k = this.abs(); + if (k.t < w.t) { + if (h != null) { + h.fromInt(0) + } + if (g != null) { + this.copyTo(g) + } + return + } + if (g == null) { + g = nbi() + } + var d = nbi(), + a = this.s, + l = n.s; + var v = this.DB - nbits(w[w.t - 1]); + if (v > 0) { + w.lShiftTo(v, d); + k.lShiftTo(v, g) + } else { + w.copyTo(d); + k.copyTo(g) + } + var p = d.t; + var b = d[p - 1]; + if (b == 0) { + return + } + var o = b * (1 << this.F1) + ((p > 1) ? d[p - 2] >> this.F2: 0); + var A = this.FV / o, + z = (1 << this.F1) / o, + x = 1 << this.F2; + var u = g.t, + s = u - p, + f = (h == null) ? nbi() : h; + d.dlShiftTo(s, f); + if (g.compareTo(f) >= 0) { + g[g.t++] = 1; + g.subTo(f, g) + } + BigInteger.ONE.dlShiftTo(p, f); + f.subTo(d, d); + while (d.t < p) { + d[d.t++] = 0 + } + while (--s >= 0) { + var c = (g[--u] == b) ? this.DM: Math.floor(g[u] * A + (g[u - 1] + x) * z); + if ((g[u] += d.am(0, c, g, s, 0, p)) < c) { + d.dlShiftTo(s, f); + g.subTo(f, g); + while (g[u] < --c) { + g.subTo(f, g) + } + } + } + if (h != null) { + g.drShiftTo(p, h); + if (a != l) { + BigInteger.ZERO.subTo(h, h) + } + } + g.t = p; + g.clamp(); + if (v > 0) { + g.rShiftTo(v, g) + } + if (a < 0) { + BigInteger.ZERO.subTo(g, g) + } +} +function bnMod(b) { + var c = nbi(); + this.abs().divRemTo(b, null, c); + if (this.s < 0 && c.compareTo(BigInteger.ZERO) > 0) { + b.subTo(c, c) + } + return c +} +function Classic(a) { + this.m = a +} +function cConvert(a) { + if (a.s < 0 || a.compareTo(this.m) >= 0) { + return a.mod(this.m) + } else { + return a + } +} +function cRevert(a) { + return a +} +function cReduce(a) { + a.divRemTo(this.m, null, a) +} +function cMulTo(a, c, b) { + a.multiplyTo(c, b); + this.reduce(b) +} +function cSqrTo(a, b) { + a.squareTo(b); + this.reduce(b) +} +Classic.prototype.convert = cConvert; +Classic.prototype.revert = cRevert; +Classic.prototype.reduce = cReduce; +Classic.prototype.mulTo = cMulTo; +Classic.prototype.sqrTo = cSqrTo; +function bnpInvDigit() { + if (this.t < 1) { + return 0 + } + var a = this[0]; + if ((a & 1) == 0) { + return 0 + } + var b = a & 3; + b = (b * (2 - (a & 15) * b)) & 15; + b = (b * (2 - (a & 255) * b)) & 255; + b = (b * (2 - (((a & 65535) * b) & 65535))) & 65535; + b = (b * (2 - a * b % this.DV)) % this.DV; + return (b > 0) ? this.DV - b: -b +} +function Montgomery(a) { + this.m = a; + this.mp = a.invDigit(); + this.mpl = this.mp & 32767; + this.mph = this.mp >> 15; + this.um = (1 << (a.DB - 15)) - 1; + this.mt2 = 2 * a.t +} +function montConvert(a) { + var b = nbi(); + a.abs().dlShiftTo(this.m.t, b); + b.divRemTo(this.m, null, b); + if (a.s < 0 && b.compareTo(BigInteger.ZERO) > 0) { + this.m.subTo(b, b) + } + return b +} +function montRevert(a) { + var b = nbi(); + a.copyTo(b); + this.reduce(b); + return b +} +function montReduce(a) { + while (a.t <= this.mt2) { + a[a.t++] = 0 + } + for (var c = 0; c < this.m.t; ++c) { + var b = a[c] & 32767; + var d = (b * this.mpl + (((b * this.mph + (a[c] >> 15) * this.mpl) & this.um) << 15)) & a.DM; + b = c + this.m.t; + a[b] += this.m.am(0, d, a, c, 0, this.m.t); + while (a[b] >= a.DV) { + a[b] -= a.DV; + a[++b]++ + } + } + a.clamp(); + a.drShiftTo(this.m.t, a); + if (a.compareTo(this.m) >= 0) { + a.subTo(this.m, a) + } +} +function montSqrTo(a, b) { + a.squareTo(b); + this.reduce(b) +} +function montMulTo(a, c, b) { + a.multiplyTo(c, b); + this.reduce(b) +} +Montgomery.prototype.convert = montConvert; +Montgomery.prototype.revert = montRevert; +Montgomery.prototype.reduce = montReduce; +Montgomery.prototype.mulTo = montMulTo; +Montgomery.prototype.sqrTo = montSqrTo; +function bnpIsEven() { + return ((this.t > 0) ? (this[0] & 1) : this.s) == 0 +} +function bnpExp(h, j) { + if (h > 4294967295 || h < 1) { + return BigInteger.ONE + } + var f = nbi(), + a = nbi(), + d = j.convert(this), + c = nbits(h) - 1; + d.copyTo(f); + while (--c >= 0) { + j.sqrTo(f, a); + if ((h & (1 << c)) > 0) { + j.mulTo(a, d, f) + } else { + var b = f; + f = a; + a = b + } + } + return j.revert(f) +} +function bnModPowInt(b, a) { + var c; + if (b < 256 || a.isEven()) { + c = new Classic(a) + } else { + c = new Montgomery(a) + } + return this.exp(b, c) +} +BigInteger.prototype.copyTo = bnpCopyTo; +BigInteger.prototype.fromInt = bnpFromInt; +BigInteger.prototype.fromString = bnpFromString; +BigInteger.prototype.clamp = bnpClamp; +BigInteger.prototype.dlShiftTo = bnpDLShiftTo; +BigInteger.prototype.drShiftTo = bnpDRShiftTo; +BigInteger.prototype.lShiftTo = bnpLShiftTo; +BigInteger.prototype.rShiftTo = bnpRShiftTo; +BigInteger.prototype.subTo = bnpSubTo; +BigInteger.prototype.multiplyTo = bnpMultiplyTo; +BigInteger.prototype.squareTo = bnpSquareTo; +BigInteger.prototype.divRemTo = bnpDivRemTo; +BigInteger.prototype.invDigit = bnpInvDigit; +BigInteger.prototype.isEven = bnpIsEven; +BigInteger.prototype.exp = bnpExp; +BigInteger.prototype.toString = bnToString; +BigInteger.prototype.negate = bnNegate; +BigInteger.prototype.abs = bnAbs; +BigInteger.prototype.compareTo = bnCompareTo; +BigInteger.prototype.bitLength = bnBitLength; +BigInteger.prototype.mod = bnMod; +BigInteger.prototype.modPowInt = bnModPowInt; +BigInteger.ZERO = nbv(0); +BigInteger.ONE = nbv(1); +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function bnClone() { + var a = nbi(); + this.copyTo(a); + return a +} +function bnIntValue() { + if (this.s < 0) { + if (this.t == 1) { + return this[0] - this.DV + } else { + if (this.t == 0) { + return - 1 + } + } + } else { + if (this.t == 1) { + return this[0] + } else { + if (this.t == 0) { + return 0 + } + } + } + return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0] +} +function bnByteValue() { + return (this.t == 0) ? this.s: (this[0] << 24) >> 24 +} +function bnShortValue() { + return (this.t == 0) ? this.s: (this[0] << 16) >> 16 +} +function bnpChunkSize(a) { + return Math.floor(Math.LN2 * this.DB / Math.log(a)) +} +function bnSigNum() { + if (this.s < 0) { + return - 1 + } else { + if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) { + return 0 + } else { + return 1 + } + } +} +function bnpToRadix(c) { + if (c == null) { + c = 10 + } + if (this.signum() == 0 || c < 2 || c > 36) { + return "0" + } + var f = this.chunkSize(c); + var e = Math.pow(c, f); + var i = nbv(e), + j = nbi(), + h = nbi(), + g = ""; + this.divRemTo(i, j, h); + while (j.signum() > 0) { + g = (e + h.intValue()).toString(c).substr(1) + g; + j.divRemTo(i, j, h) + } + return h.intValue().toString(c) + g +} +function bnpFromRadix(m, h) { + this.fromInt(0); + if (h == null) { + h = 10 + } + var f = this.chunkSize(h); + var g = Math.pow(h, f), + e = false, + a = 0, + l = 0; + for (var c = 0; c < m.length; ++c) { + var k = intAt(m, c); + if (k < 0) { + if (m.charAt(c) == "-" && this.signum() == 0) { + e = true + } + continue + } + l = h * l + k; + if (++a >= f) { + this.dMultiply(g); + this.dAddOffset(l, 0); + a = 0; + l = 0 + } + } + if (a > 0) { + this.dMultiply(Math.pow(h, a)); + this.dAddOffset(l, 0) + } + if (e) { + BigInteger.ZERO.subTo(this, this) + } +} +function bnpFromNumber(f, e, h) { + if ("number" == typeof e) { + if (f < 2) { + this.fromInt(1) + } else { + this.fromNumber(f, h); + if (!this.testBit(f - 1)) { + this.bitwiseTo(BigInteger.ONE.shiftLeft(f - 1), op_or, this) + } + if (this.isEven()) { + this.dAddOffset(1, 0) + } + while (!this.isProbablePrime(e)) { + this.dAddOffset(2, 0); + if (this.bitLength() > f) { + this.subTo(BigInteger.ONE.shiftLeft(f - 1), this) + } + } + } + } else { + var d = new Array(), + g = f & 7; + d.length = (f >> 3) + 1; + e.nextBytes(d); + if (g > 0) { + d[0] &= ((1 << g) - 1) + } else { + d[0] = 0 + } + this.fromString(d, 256) + } +} +function bnToByteArray() { + var b = this.t, + c = new Array(); + c[0] = this.s; + var e = this.DB - (b * this.DB) % 8, + f, + a = 0; + if (b-->0) { + if (e < this.DB && (f = this[b] >> e) != (this.s & this.DM) >> e) { + c[a++] = f | (this.s << (this.DB - e)) + } + while (b >= 0) { + if (e < 8) { + f = (this[b] & ((1 << e) - 1)) << (8 - e); + f |= this[--b] >> (e += this.DB - 8) + } else { + f = (this[b] >> (e -= 8)) & 255; + if (e <= 0) { + e += this.DB; --b + } + } + if ((f & 128) != 0) { + f |= -256 + } + if (a == 0 && (this.s & 128) != (f & 128)) {++a + } + if (a > 0 || f != this.s) { + c[a++] = f + } + } + } + return c +} +function bnEquals(b) { + return (this.compareTo(b) == 0) +} +function bnMin(b) { + return (this.compareTo(b) < 0) ? this: b +} +function bnMax(b) { + return (this.compareTo(b) > 0) ? this: b +} +function bnpBitwiseTo(c, h, e) { + var d, g, b = Math.min(c.t, this.t); + for (d = 0; d < b; ++d) { + e[d] = h(this[d], c[d]) + } + if (c.t < this.t) { + g = c.s & this.DM; + for (d = b; d < this.t; ++d) { + e[d] = h(this[d], g) + } + e.t = this.t + } else { + g = this.s & this.DM; + for (d = b; d < c.t; ++d) { + e[d] = h(g, c[d]) + } + e.t = c.t + } + e.s = h(this.s, c.s); + e.clamp() +} +function op_and(a, b) { + return a & b +} +function bnAnd(b) { + var c = nbi(); + this.bitwiseTo(b, op_and, c); + return c +} +function op_or(a, b) { + return a | b +} +function bnOr(b) { + var c = nbi(); + this.bitwiseTo(b, op_or, c); + return c +} +function op_xor(a, b) { + return a ^ b +} +function bnXor(b) { + var c = nbi(); + this.bitwiseTo(b, op_xor, c); + return c +} +function op_andnot(a, b) { + return a & ~b +} +function bnAndNot(b) { + var c = nbi(); + this.bitwiseTo(b, op_andnot, c); + return c +} +function bnNot() { + var b = nbi(); + for (var a = 0; a < this.t; ++a) { + b[a] = this.DM & ~this[a] + } + b.t = this.t; + b.s = ~this.s; + return b +} +function bnShiftLeft(b) { + var a = nbi(); + if (b < 0) { + this.rShiftTo( - b, a) + } else { + this.lShiftTo(b, a) + } + return a +} +function bnShiftRight(b) { + var a = nbi(); + if (b < 0) { + this.lShiftTo( - b, a) + } else { + this.rShiftTo(b, a) + } + return a +} +function lbit(a) { + if (a == 0) { + return - 1 + } + var b = 0; + if ((a & 65535) == 0) { + a >>= 16; + b += 16 + } + if ((a & 255) == 0) { + a >>= 8; + b += 8 + } + if ((a & 15) == 0) { + a >>= 4; + b += 4 + } + if ((a & 3) == 0) { + a >>= 2; + b += 2 + } + if ((a & 1) == 0) {++b + } + return b +} +function bnGetLowestSetBit() { + for (var a = 0; a < this.t; ++a) { + if (this[a] != 0) { + return a * this.DB + lbit(this[a]) + } + } + if (this.s < 0) { + return this.t * this.DB + } + return - 1 +} +function cbit(a) { + var b = 0; + while (a != 0) { + a &= a - 1; ++b + } + return b +} +function bnBitCount() { + var c = 0, + a = this.s & this.DM; + for (var b = 0; b < this.t; ++b) { + c += cbit(this[b] ^ a) + } + return c +} +function bnTestBit(b) { + var a = Math.floor(b / this.DB); + if (a >= this.t) { + return (this.s != 0) + } + return ((this[a] & (1 << (b % this.DB))) != 0) +} +function bnpChangeBit(c, b) { + var a = BigInteger.ONE.shiftLeft(c); + this.bitwiseTo(a, b, a); + return a +} +function bnSetBit(a) { + return this.changeBit(a, op_or) +} +function bnClearBit(a) { + return this.changeBit(a, op_andnot) +} +function bnFlipBit(a) { + return this.changeBit(a, op_xor) +} +function bnpAddTo(d, f) { + var e = 0, + g = 0, + b = Math.min(d.t, this.t); + while (e < b) { + g += this[e] + d[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + if (d.t < this.t) { + g += d.s; + while (e < this.t) { + g += this[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + g += this.s + } else { + g += this.s; + while (e < d.t) { + g += d[e]; + f[e++] = g & this.DM; + g >>= this.DB + } + g += d.s + } + f.s = (g < 0) ? -1 : 0; + if (g > 0) { + f[e++] = g + } else { + if (g < -1) { + f[e++] = this.DV + g + } + } + f.t = e; + f.clamp() +} +function bnAdd(b) { + var c = nbi(); + this.addTo(b, c); + return c +} +function bnSubtract(b) { + var c = nbi(); + this.subTo(b, c); + return c +} +function bnMultiply(b) { + var c = nbi(); + this.multiplyTo(b, c); + return c +} +function bnSquare() { + var a = nbi(); + this.squareTo(a); + return a +} +function bnDivide(b) { + var c = nbi(); + this.divRemTo(b, c, null); + return c +} +function bnRemainder(b) { + var c = nbi(); + this.divRemTo(b, null, c); + return c +} +function bnDivideAndRemainder(b) { + var d = nbi(), + c = nbi(); + this.divRemTo(b, d, c); + return new Array(d, c) +} +function bnpDMultiply(a) { + this[this.t] = this.am(0, a - 1, this, 0, 0, this.t); ++this.t; + this.clamp() +} +function bnpDAddOffset(b, a) { + if (b == 0) { + return + } + while (this.t <= a) { + this[this.t++] = 0 + } + this[a] += b; + while (this[a] >= this.DV) { + this[a] -= this.DV; + if (++a >= this.t) { + this[this.t++] = 0 + }++this[a] + } +} +function NullExp() {} +function nNop(a) { + return a +} +function nMulTo(a, c, b) { + a.multiplyTo(c, b) +} +function nSqrTo(a, b) { + a.squareTo(b) +} +NullExp.prototype.convert = nNop; +NullExp.prototype.revert = nNop; +NullExp.prototype.mulTo = nMulTo; +NullExp.prototype.sqrTo = nSqrTo; +function bnPow(a) { + return this.exp(a, new NullExp()) +} +function bnpMultiplyLowerTo(b, f, e) { + var d = Math.min(this.t + b.t, f); + e.s = 0; + e.t = d; + while (d > 0) { + e[--d] = 0 + } + var c; + for (c = e.t - this.t; d < c; ++d) { + e[d + this.t] = this.am(0, b[d], e, d, 0, this.t) + } + for (c = Math.min(b.t, f); d < c; ++d) { + this.am(0, b[d], e, d, 0, f - d) + } + e.clamp() +} +function bnpMultiplyUpperTo(b, e, d) {--e; + var c = d.t = this.t + b.t - e; + d.s = 0; + while (--c >= 0) { + d[c] = 0 + } + for (c = Math.max(e - this.t, 0); c < b.t; ++c) { + d[this.t + c - e] = this.am(e - c, b[c], d, 0, 0, this.t + c - e) + } + d.clamp(); + d.drShiftTo(1, d) +} +function Barrett(a) { + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2 * a.t, this.r2); + this.mu = this.r2.divide(a); + this.m = a +} +function barrettConvert(a) { + if (a.s < 0 || a.t > 2 * this.m.t) { + return a.mod(this.m) + } else { + if (a.compareTo(this.m) < 0) { + return a + } else { + var b = nbi(); + a.copyTo(b); + this.reduce(b); + return b + } + } +} +function barrettRevert(a) { + return a +} +function barrettReduce(a) { + a.drShiftTo(this.m.t - 1, this.r2); + if (a.t > this.m.t + 1) { + a.t = this.m.t + 1; + a.clamp() + } + this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); + this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); + while (a.compareTo(this.r2) < 0) { + a.dAddOffset(1, this.m.t + 1) + } + a.subTo(this.r2, a); + while (a.compareTo(this.m) >= 0) { + a.subTo(this.m, a) + } +} +function barrettSqrTo(a, b) { + a.squareTo(b); + this.reduce(b) +} +function barrettMulTo(a, c, b) { + a.multiplyTo(c, b); + this.reduce(b) +} +Barrett.prototype.convert = barrettConvert; +Barrett.prototype.revert = barrettRevert; +Barrett.prototype.reduce = barrettReduce; +Barrett.prototype.mulTo = barrettMulTo; +Barrett.prototype.sqrTo = barrettSqrTo; +function bnModPow(q, f) { + var o = q.bitLength(), + h, + b = nbv(1), + v; + if (o <= 0) { + return b + } else { + if (o < 18) { + h = 1 + } else { + if (o < 48) { + h = 3 + } else { + if (o < 144) { + h = 4 + } else { + if (o < 768) { + h = 5 + } else { + h = 6 + } + } + } + } + } + if (o < 8) { + v = new Classic(f) + } else { + if (f.isEven()) { + v = new Barrett(f) + } else { + v = new Montgomery(f) + } + } + var p = new Array(), + d = 3, + s = h - 1, + a = (1 << h) - 1; + p[1] = v.convert(this); + if (h > 1) { + var A = nbi(); + v.sqrTo(p[1], A); + while (d <= a) { + p[d] = nbi(); + v.mulTo(A, p[d - 2], p[d]); + d += 2 + } + } + var l = q.t - 1, + x, u = true, + c = nbi(), + y; + o = nbits(q[l]) - 1; + while (l >= 0) { + if (o >= s) { + x = (q[l] >> (o - s)) & a + } else { + x = (q[l] & ((1 << (o + 1)) - 1)) << (s - o); + if (l > 0) { + x |= q[l - 1] >> (this.DB + o - s) + } + } + d = h; + while ((x & 1) == 0) { + x >>= 1; --d + } + if ((o -= d) < 0) { + o += this.DB; --l + } + if (u) { + p[x].copyTo(b); + u = false + } else { + while (d > 1) { + v.sqrTo(b, c); + v.sqrTo(c, b); + d -= 2 + } + if (d > 0) { + v.sqrTo(b, c) + } else { + y = b; + b = c; + c = y + } + v.mulTo(c, p[x], b) + } + while (l >= 0 && (q[l] & (1 << o)) == 0) { + v.sqrTo(b, c); + y = b; + b = c; + c = y; + if (--o < 0) { + o = this.DB - 1; --l + } + } + } + return v.revert(b) +} +function bnGCD(c) { + var b = (this.s < 0) ? this.negate() : this.clone(); + var h = (c.s < 0) ? c.negate() : c.clone(); + if (b.compareTo(h) < 0) { + var e = b; + b = h; + h = e + } + var d = b.getLowestSetBit(), + f = h.getLowestSetBit(); + if (f < 0) { + return b + } + if (d < f) { + f = d + } + if (f > 0) { + b.rShiftTo(f, b); + h.rShiftTo(f, h) + } + while (b.signum() > 0) { + if ((d = b.getLowestSetBit()) > 0) { + b.rShiftTo(d, b) + } + if ((d = h.getLowestSetBit()) > 0) { + h.rShiftTo(d, h) + } + if (b.compareTo(h) >= 0) { + b.subTo(h, b); + b.rShiftTo(1, b) + } else { + h.subTo(b, h); + h.rShiftTo(1, h) + } + } + if (f > 0) { + h.lShiftTo(f, h) + } + return h +} +function bnpModInt(e) { + if (e <= 0) { + return 0 + } + var c = this.DV % e, + b = (this.s < 0) ? e - 1 : 0; + if (this.t > 0) { + if (c == 0) { + b = this[0] % e + } else { + for (var a = this.t - 1; a >= 0; --a) { + b = (c * b + this[a]) % e + } + } + } + return b +} +function bnModInverse(f) { + var j = f.isEven(); + if ((this.isEven() && j) || f.signum() == 0) { + return BigInteger.ZERO + } + var i = f.clone(), + h = this.clone(); + var g = nbv(1), + e = nbv(0), + l = nbv(0), + k = nbv(1); + while (i.signum() != 0) { + while (i.isEven()) { + i.rShiftTo(1, i); + if (j) { + if (!g.isEven() || !e.isEven()) { + g.addTo(this, g); + e.subTo(f, e) + } + g.rShiftTo(1, g) + } else { + if (!e.isEven()) { + e.subTo(f, e) + } + } + e.rShiftTo(1, e) + } + while (h.isEven()) { + h.rShiftTo(1, h); + if (j) { + if (!l.isEven() || !k.isEven()) { + l.addTo(this, l); + k.subTo(f, k) + } + l.rShiftTo(1, l) + } else { + if (!k.isEven()) { + k.subTo(f, k) + } + } + k.rShiftTo(1, k) + } + if (i.compareTo(h) >= 0) { + i.subTo(h, i); + if (j) { + g.subTo(l, g) + } + e.subTo(k, e) + } else { + h.subTo(i, h); + if (j) { + l.subTo(g, l) + } + k.subTo(e, k) + } + } + if (h.compareTo(BigInteger.ONE) != 0) { + return BigInteger.ZERO + } + if (k.compareTo(f) >= 0) { + return k.subtract(f) + } + if (k.signum() < 0) { + k.addTo(f, k) + } else { + return k + } + if (k.signum() < 0) { + return k.add(f) + } else { + return k + } +} +var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]; +var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]; +function bnIsProbablePrime(e) { + var d, b = this.abs(); + if (b.t == 1 && b[0] <= lowprimes[lowprimes.length - 1]) { + for (d = 0; d < lowprimes.length; ++d) { + if (b[0] == lowprimes[d]) { + return true + } + } + return false + } + if (b.isEven()) { + return false + } + d = 1; + while (d < lowprimes.length) { + var a = lowprimes[d], + c = d + 1; + while (c < lowprimes.length && a < lplim) { + a *= lowprimes[c++] + } + a = b.modInt(a); + while (d < c) { + if (a % lowprimes[d++] == 0) { + return false + } + } + } + return b.millerRabin(e) +} +function bnpMillerRabin(f) { + var g = this.subtract(BigInteger.ONE); + var c = g.getLowestSetBit(); + if (c <= 0) { + return false + } + var h = g.shiftRight(c); + f = (f + 1) >> 1; + if (f > lowprimes.length) { + f = lowprimes.length + } + var b = nbi(); + for (var e = 0; e < f; ++e) { + b.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]); + var l = b.modPow(h, this); + if (l.compareTo(BigInteger.ONE) != 0 && l.compareTo(g) != 0) { + var d = 1; + while (d++> 8) & 255; + rng_pool[rng_pptr++] ^= (a >> 16) & 255; + rng_pool[rng_pptr++] ^= (a >> 24) & 255; + if (rng_pptr >= rng_psize) { + rng_pptr -= rng_psize + } +} +function rng_seed_time() { + rng_seed_int(new Date().getTime()) +} +if (rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if (window2.crypto && window2.crypto.getRandomValues) { + var ua = new Uint8Array(32); + window2.crypto.getRandomValues(ua); + for (t = 0; t < 32; ++t) { + rng_pool[rng_pptr++] = ua[t] + } + } + if (navigator2.appName == "Netscape" && navigator2.appVersion < "5" && window2.crypto && window2.crypto.random) { + var z = window2.crypto.random(32); + for (t = 0; t < z.length; ++t) { + rng_pool[rng_pptr++] = z.charCodeAt(t) & 255 + } + } + while (rng_pptr < rng_psize) { + t = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = t >>> 8; + rng_pool[rng_pptr++] = t & 255 + } + rng_pptr = 0; + rng_seed_time() +} +function rng_get_byte() { + if (rng_state == null) { + rng_seed_time(); + rng_state = prng_newstate(); + rng_state.init(rng_pool); + for (rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) { + rng_pool[rng_pptr] = 0 + } + rng_pptr = 0 + } + return rng_state.next() +} +function rng_get_bytes(b) { + var a; + for (a = 0; a < b.length; ++a) { + b[a] = rng_get_byte() + } +} +function SecureRandom() {} +SecureRandom.prototype.nextBytes = rng_get_bytes; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function parseBigInt(b, a) { + return new BigInteger(b, a) +} +function linebrk(c, d) { + var a = ""; + var b = 0; + while (b + d < c.length) { + a += c.substring(b, b + d) + "\n"; + b += d + } + return a + c.substring(b, c.length) +} +function byte2Hex(a) { + if (a < 16) { + return "0" + a.toString(16) + } else { + return a.toString(16) + } +} +function pkcs1pad2(e, h) { + if (h < e.length + 11) { + alert("Message too long for RSA"); + return null + } + var g = new Array(); + var d = e.length - 1; + while (d >= 0 && h > 0) { + var f = e.charCodeAt(d--); + if (f < 128) { + g[--h] = f + } else { + if ((f > 127) && (f < 2048)) { + g[--h] = (f & 63) | 128; + g[--h] = (f >> 6) | 192 + } else { + g[--h] = (f & 63) | 128; + g[--h] = ((f >> 6) & 63) | 128; + g[--h] = (f >> 12) | 224 + } + } + } + g[--h] = 0; + var b = new SecureRandom(); + var a = new Array(); + while (h > 2) { + a[0] = 0; + while (a[0] == 0) { + b.nextBytes(a) + } + g[--h] = a[0] + } + g[--h] = 2; + g[--h] = 0; + return new BigInteger(g) +} +function oaep_mgf1_arr(c, a, e) { + var b = "", + d = 0; + while (b.length < a) { + b += e(String.fromCharCode.apply(String, c.concat([(d & 4278190080) >> 24, (d & 16711680) >> 16, (d & 65280) >> 8, d & 255]))); + d += 1 + } + return b +} +function oaep_pad(q, a, f, l) { + var c = KJUR.crypto.MessageDigest; + var o = KJUR.crypto.Util; + var b = null; + if (!f) { + f = "sha1" + } + if (typeof f === "string") { + b = c.getCanonicalAlgName(f); + l = c.getHashLength(b); + f = function(i) { + return hextorstr(o.hashString(i, b)) + } + } + if (q.length + 2 * l + 2 > a) { + throw "Message too long for RSA" + } + var k = "", + e; + for (e = 0; e < a - q.length - 2 * l - 2; e += 1) { + k += "\x00" + } + var h = f("") + k + "\x01" + q; + var g = new Array(l); + new SecureRandom().nextBytes(g); + var j = oaep_mgf1_arr(g, h.length, f); + var p = []; + for (e = 0; e < h.length; e += 1) { + p[e] = h.charCodeAt(e) ^ j.charCodeAt(e) + } + var m = oaep_mgf1_arr(p, g.length, f); + var d = [0]; + for (e = 0; e < g.length; e += 1) { + d[e + 1] = g[e] ^ m.charCodeAt(e) + } + return new BigInteger(d.concat(p)) +} +function RSAKey() { + this.n = null; + this.e = 0; + this.d = null; + this.p = null; + this.q = null; + this.dmp1 = null; + this.dmq1 = null; + this.coeff = null +} +function RSASetPublic(b, a) { + this.isPublic = true; + this.isPrivate = false; + if (typeof b !== "string") { + this.n = b; + this.e = a + } else { + if (b != null && a != null && b.length > 0 && a.length > 0) { + this.n = parseBigInt(b, 16); + this.e = parseInt(a, 16) + } else { + throw "Invalid RSA public key" + } + } +} +function RSADoPublic(a) { + return a.modPowInt(this.e, this.n) +} +function RSAEncrypt(d) { + var a = pkcs1pad2(d, (this.n.bitLength() + 7) >> 3); + if (a == null) { + return null + } + var e = this.doPublic(a); + if (e == null) { + return null + } + var b = e.toString(16); + if ((b.length & 1) == 0) { + return b + } else { + return "0" + b + } +} +function RSAEncryptOAEP(f, e, b) { + var a = oaep_pad(f, (this.n.bitLength() + 7) >> 3, e, b); + if (a == null) { + return null + } + var g = this.doPublic(a); + if (g == null) { + return null + } + var d = g.toString(16); + if ((d.length & 1) == 0) { + return d + } else { + return "0" + d + } +} +RSAKey.prototype.doPublic = RSADoPublic; +RSAKey.prototype.setPublic = RSASetPublic; +RSAKey.prototype.encrypt = RSAEncrypt; +RSAKey.prototype.encryptOAEP = RSAEncryptOAEP; +RSAKey.prototype.type = "RSA"; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function pkcs1unpad2(g, j) { + var a = g.toByteArray(); + var f = 0; + while (f < a.length && a[f] == 0) {++f + } + if (a.length - f != j - 1 || a[f] != 2) { + return null + }++f; + while (a[f] != 0) { + if (++f >= a.length) { + return null + } + } + var e = ""; + while (++f < a.length) { + var h = a[f] & 255; + if (h < 128) { + e += String.fromCharCode(h) + } else { + if ((h > 191) && (h < 224)) { + e += String.fromCharCode(((h & 31) << 6) | (a[f + 1] & 63)); ++f + } else { + e += String.fromCharCode(((h & 15) << 12) | ((a[f + 1] & 63) << 6) | (a[f + 2] & 63)); + f += 2 + } + } + } + return e +} +function oaep_mgf1_str(c, a, e) { + var b = "", + d = 0; + while (b.length < a) { + b += e(c + String.fromCharCode.apply(String, [(d & 4278190080) >> 24, (d & 16711680) >> 16, (d & 65280) >> 8, d & 255])); + d += 1 + } + return b +} +function oaep_unpad(o, b, g, p) { + var e = KJUR.crypto.MessageDigest; + var r = KJUR.crypto.Util; + var c = null; + if (!g) { + g = "sha1" + } + if (typeof g === "string") { + c = e.getCanonicalAlgName(g); + p = e.getHashLength(c); + g = function(d) { + return hextorstr(r.hashString(d, c)) + } + } + o = o.toByteArray(); + var h; + for (h = 0; h < o.length; h += 1) { + o[h] &= 255 + } + while (o.length < b) { + o.unshift(0) + } + o = String.fromCharCode.apply(String, o); + if (o.length < 2 * p + 2) { + throw "Cipher too short" + } + var f = o.substr(1, p); + var s = o.substr(p + 1); + var q = oaep_mgf1_str(s, p, g); + var k = [], + h; + for (h = 0; h < f.length; h += 1) { + k[h] = f.charCodeAt(h) ^ q.charCodeAt(h) + } + var l = oaep_mgf1_str(String.fromCharCode.apply(String, k), o.length - p, g); + var j = []; + for (h = 0; h < s.length; h += 1) { + j[h] = s.charCodeAt(h) ^ l.charCodeAt(h) + } + j = String.fromCharCode.apply(String, j); + if (j.substr(0, p) !== g("")) { + throw "Hash mismatch" + } + j = j.substr(p); + var a = j.indexOf("\x01"); + var m = (a != -1) ? j.substr(0, a).lastIndexOf("\x00") : -1; + if (m + 1 != a) { + throw "Malformed data" + } + return j.substr(a + 1) +} +function RSASetPrivate(c, a, b) { + this.isPrivate = true; + if (typeof c !== "string") { + this.n = c; + this.e = a; + this.d = b + } else { + if (c != null && a != null && c.length > 0 && a.length > 0) { + this.n = parseBigInt(c, 16); + this.e = parseInt(a, 16); + this.d = parseBigInt(b, 16) + } else { + alert("Invalid RSA private key") + } + } +} +function RSASetPrivateEx(g, d, e, c, b, a, h, f) { + this.isPrivate = true; + this.isPublic = false; + if (g == null) { + throw "RSASetPrivateEx N == null" + } + if (d == null) { + throw "RSASetPrivateEx E == null" + } + if (g.length == 0) { + throw "RSASetPrivateEx N.length == 0" + } + if (d.length == 0) { + throw "RSASetPrivateEx E.length == 0" + } + if (g != null && d != null && g.length > 0 && d.length > 0) { + this.n = parseBigInt(g, 16); + this.e = parseInt(d, 16); + this.d = parseBigInt(e, 16); + this.p = parseBigInt(c, 16); + this.q = parseBigInt(b, 16); + this.dmp1 = parseBigInt(a, 16); + this.dmq1 = parseBigInt(h, 16); + this.coeff = parseBigInt(f, 16) + } else { + alert("Invalid RSA private key in RSASetPrivateEx") + } +} +function RSAGenerate(b, i) { + var a = new SecureRandom(); + var f = b >> 1; + this.e = parseInt(i, 16); + var c = new BigInteger(i, 16); + for (;;) { + for (;;) { + this.p = new BigInteger(b - f, 1, a); + if (this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) { + break + } + } + for (;;) { + this.q = new BigInteger(f, 1, a); + if (this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) { + break + } + } + if (this.p.compareTo(this.q) <= 0) { + var h = this.p; + this.p = this.q; + this.q = h + } + var g = this.p.subtract(BigInteger.ONE); + var d = this.q.subtract(BigInteger.ONE); + var e = g.multiply(d); + if (e.gcd(c).compareTo(BigInteger.ONE) == 0) { + this.n = this.p.multiply(this.q); + this.d = c.modInverse(e); + this.dmp1 = this.d.mod(g); + this.dmq1 = this.d.mod(d); + this.coeff = this.q.modInverse(this.p); + break + } + } + this.isPrivate = true +} +function RSADoPrivate(a) { + if (this.p == null || this.q == null) { + return a.modPow(this.d, this.n) + } + var c = a.mod(this.p).modPow(this.dmp1, this.p); + var b = a.mod(this.q).modPow(this.dmq1, this.q); + while (c.compareTo(b) < 0) { + c = c.add(this.p) + } + return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b) +} +function RSADecrypt(b) { + var d = parseBigInt(b, 16); + var a = this.doPrivate(d); + if (a == null) { + return null + } + return pkcs1unpad2(a, (this.n.bitLength() + 7) >> 3) +} +function RSADecryptOAEP(e, d, b) { + var f = parseBigInt(e, 16); + var a = this.doPrivate(f); + if (a == null) { + return null + } + return oaep_unpad(a, (this.n.bitLength() + 7) >> 3, d, b) +} +RSAKey.prototype.doPrivate = RSADoPrivate; +RSAKey.prototype.setPrivate = RSASetPrivate; +RSAKey.prototype.setPrivateEx = RSASetPrivateEx; +RSAKey.prototype.generate = RSAGenerate; +RSAKey.prototype.decrypt = RSADecrypt; +RSAKey.prototype.decryptOAEP = RSADecryptOAEP; +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ +function ECFieldElementFp(b, a) { + this.x = a; + this.q = b +} +function feFpEquals(a) { + if (a == this) { + return true + } + return (this.q.equals(a.q) && this.x.equals(a.x)) +} +function feFpToBigInteger() { + return this.x +} +function feFpNegate() { + return new ECFieldElementFp(this.q, this.x.negate().mod(this.q)) +} +function feFpAdd(a) { + return new ECFieldElementFp(this.q, this.x.add(a.toBigInteger()).mod(this.q)) +} +function feFpSubtract(a) { + return new ECFieldElementFp(this.q, this.x.subtract(a.toBigInteger()).mod(this.q)) +} +function feFpMultiply(a) { + return new ECFieldElementFp(this.q, this.x.multiply(a.toBigInteger()).mod(this.q)) +} +function feFpSquare() { + return new ECFieldElementFp(this.q, this.x.square().mod(this.q)) +} +function feFpDivide(a) { + return new ECFieldElementFp(this.q, this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q)) +} +ECFieldElementFp.prototype.equals = feFpEquals; +ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger; +ECFieldElementFp.prototype.negate = feFpNegate; +ECFieldElementFp.prototype.add = feFpAdd; +ECFieldElementFp.prototype.subtract = feFpSubtract; +ECFieldElementFp.prototype.multiply = feFpMultiply; +ECFieldElementFp.prototype.square = feFpSquare; +ECFieldElementFp.prototype.divide = feFpDivide; +function ECPointFp(c, a, d, b) { + this.curve = c; + this.x = a; + this.y = d; + if (b == null) { + this.z = BigInteger.ONE + } else { + this.z = b + } + this.zinv = null +} +function pointFpGetX() { + if (this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q) + } + return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q)) +} +function pointFpGetY() { + if (this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q) + } + return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q)) +} +function pointFpEquals(a) { + if (a == this) { + return true + } + if (this.isInfinity()) { + return a.isInfinity() + } + if (a.isInfinity()) { + return this.isInfinity() + } + var c, b; + c = a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q); + if (!c.equals(BigInteger.ZERO)) { + return false + } + b = a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q); + return b.equals(BigInteger.ZERO) +} +function pointFpIsInfinity() { + if ((this.x == null) && (this.y == null)) { + return true + } + return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO) +} +function pointFpNegate() { + return new ECPointFp(this.curve, this.x, this.y.negate(), this.z) +} +function pointFpAdd(l) { + if (this.isInfinity()) { + return l + } + if (l.isInfinity()) { + return this + } + var p = l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q); + var o = l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q); + if (BigInteger.ZERO.equals(o)) { + if (BigInteger.ZERO.equals(p)) { + return this.twice() + } + return this.curve.getInfinity() + } + var j = new BigInteger("3"); + var e = this.x.toBigInteger(); + var n = this.y.toBigInteger(); + var c = l.x.toBigInteger(); + var k = l.y.toBigInteger(); + var m = o.square(); + var i = m.multiply(o); + var d = e.multiply(m); + var g = p.square().multiply(this.z); + var a = g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q); + var h = d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q); + var f = i.multiply(this.z).multiply(l.z).mod(this.curve.q); + return new ECPointFp(this.curve, this.curve.fromBigInteger(a), this.curve.fromBigInteger(h), f) +} +function pointFpTwice() { + if (this.isInfinity()) { + return this + } + if (this.y.toBigInteger().signum() == 0) { + return this.curve.getInfinity() + } + var g = new BigInteger("3"); + var c = this.x.toBigInteger(); + var h = this.y.toBigInteger(); + var e = h.multiply(this.z); + var j = e.multiply(h).mod(this.curve.q); + var i = this.curve.a.toBigInteger(); + var k = c.square().multiply(g); + if (!BigInteger.ZERO.equals(i)) { + k = k.add(this.z.square().multiply(i)) + } + k = k.mod(this.curve.q); + var b = k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q); + var f = k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q); + var d = e.square().multiply(e).shiftLeft(3).mod(this.curve.q); + return new ECPointFp(this.curve, this.curve.fromBigInteger(b), this.curve.fromBigInteger(f), d) +} +function pointFpMultiply(b) { + if (this.isInfinity()) { + return this + } + if (b.signum() == 0) { + return this.curve.getInfinity() + } + var g = b; + var f = g.multiply(new BigInteger("3")); + var l = this.negate(); + var d = this; + var c; + for (c = f.bitLength() - 2; c > 0; --c) { + d = d.twice(); + var a = f.testBit(c); + var j = g.testBit(c); + if (a != j) { + d = d.add(a ? this: l) + } + } + return d +} +function pointFpMultiplyTwo(c, a, b) { + var d; + if (c.bitLength() > b.bitLength()) { + d = c.bitLength() - 1 + } else { + d = b.bitLength() - 1 + } + var f = this.curve.getInfinity(); + var e = this.add(a); + while (d >= 0) { + f = f.twice(); + if (c.testBit(d)) { + if (b.testBit(d)) { + f = f.add(e) + } else { + f = f.add(this) + } + } else { + if (b.testBit(d)) { + f = f.add(a) + } + }--d + } + return f +} +ECPointFp.prototype.getX = pointFpGetX; +ECPointFp.prototype.getY = pointFpGetY; +ECPointFp.prototype.equals = pointFpEquals; +ECPointFp.prototype.isInfinity = pointFpIsInfinity; +ECPointFp.prototype.negate = pointFpNegate; +ECPointFp.prototype.add = pointFpAdd; +ECPointFp.prototype.twice = pointFpTwice; +ECPointFp.prototype.multiply = pointFpMultiply; +ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo; +function ECCurveFp(e, d, c) { + this.q = e; + this.a = this.fromBigInteger(d); + this.b = this.fromBigInteger(c); + this.infinity = new ECPointFp(this, null, null) +} +function curveFpGetQ() { + return this.q +} +function curveFpGetA() { + return this.a +} +function curveFpGetB() { + return this.b +} +function curveFpEquals(a) { + if (a == this) { + return true + } + return (this.q.equals(a.q) && this.a.equals(a.a) && this.b.equals(a.b)) +} +function curveFpGetInfinity() { + return this.infinity +} +function curveFpFromBigInteger(a) { + return new ECFieldElementFp(this.q, a) +} +function curveFpDecodePointHex(d) { + switch (parseInt(d.substr(0, 2), 16)) { + case 0: + return this.infinity; + case 2: + case 3: + return null; + case 4: + case 6: + case 7: + var a = (d.length - 2) / 2; + var c = d.substr(2, a); + var b = d.substr(a + 2, a); + return new ECPointFp(this, this.fromBigInteger(new BigInteger(c, 16)), this.fromBigInteger(new BigInteger(b, 16))); + default: + return null + } +} +ECCurveFp.prototype.getQ = curveFpGetQ; +ECCurveFp.prototype.getA = curveFpGetA; +ECCurveFp.prototype.getB = curveFpGetB; +ECCurveFp.prototype.equals = curveFpEquals; +ECCurveFp.prototype.getInfinity = curveFpGetInfinity; +ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger; +ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex; +/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib + */ +ECFieldElementFp.prototype.getByteLength = function() { + return Math.floor((this.toBigInteger().bitLength() + 7) / 8) +}; +ECPointFp.prototype.getEncoded = function(c) { + var d = function(h, f) { + var g = h.toByteArrayUnsigned(); + if (f < g.length) { + g = g.slice(g.length - f) + } else { + while (f > g.length) { + g.unshift(0) + } + } + return g + }; + var a = this.getX().toBigInteger(); + var e = this.getY().toBigInteger(); + var b = d(a, 32); + if (c) { + if (e.isEven()) { + b.unshift(2) + } else { + b.unshift(3) + } + } else { + b.unshift(4); + b = b.concat(d(e, 32)) + } + return b +}; +ECPointFp.decodeFrom = function(g, c) { + var f = c[0]; + var e = c.length - 1; + var d = c.slice(1, 1 + e / 2); + var b = c.slice(1 + e / 2, 1 + e); + d.unshift(0); + b.unshift(0); + var a = new BigInteger(d); + var h = new BigInteger(b); + return new ECPointFp(g, g.fromBigInteger(a), g.fromBigInteger(h)) +}; +ECPointFp.decodeFromHex = function(g, c) { + var f = c.substr(0, 2); + var e = c.length - 2; + var d = c.substr(2, e / 2); + var b = c.substr(2 + e / 2, e / 2); + var a = new BigInteger(d, 16); + var h = new BigInteger(b, 16); + return new ECPointFp(g, g.fromBigInteger(a), g.fromBigInteger(h)) +}; +ECPointFp.prototype.add2D = function(c) { + if (this.isInfinity()) { + return c + } + if (c.isInfinity()) { + return this + } + if (this.x.equals(c.x)) { + if (this.y.equals(c.y)) { + return this.twice() + } + return this.curve.getInfinity() + } + var g = c.x.subtract(this.x); + var e = c.y.subtract(this.y); + var a = e.divide(g); + var d = a.square().subtract(this.x).subtract(c.x); + var f = a.multiply(this.x.subtract(d)).subtract(this.y); + return new ECPointFp(this.curve, d, f) +}; +ECPointFp.prototype.twice2D = function() { + if (this.isInfinity()) { + return this + } + if (this.y.toBigInteger().signum() == 0) { + return this.curve.getInfinity() + } + var b = this.curve.fromBigInteger(BigInteger.valueOf(2)); + var e = this.curve.fromBigInteger(BigInteger.valueOf(3)); + var a = this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b)); + var c = a.square().subtract(this.x.multiply(b)); + var d = a.multiply(this.x.subtract(c)).subtract(this.y); + return new ECPointFp(this.curve, c, d) +}; +ECPointFp.prototype.multiply2D = function(b) { + if (this.isInfinity()) { + return this + } + if (b.signum() == 0) { + return this.curve.getInfinity() + } + var g = b; + var f = g.multiply(new BigInteger("3")); + var l = this.negate(); + var d = this; + var c; + for (c = f.bitLength() - 2; c > 0; --c) { + d = d.twice(); + var a = f.testBit(c); + var j = g.testBit(c); + if (a != j) { + d = d.add2D(a ? this: l) + } + } + return d +}; +ECPointFp.prototype.isOnCurve = function() { + var d = this.getX().toBigInteger(); + var i = this.getY().toBigInteger(); + var f = this.curve.getA().toBigInteger(); + var c = this.curve.getB().toBigInteger(); + var h = this.curve.getQ(); + var e = i.multiply(i).mod(h); + var g = d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h); + return e.equals(g) +}; +ECPointFp.prototype.toString = function() { + return "(" + this.getX().toBigInteger().toString() + "," + this.getY().toBigInteger().toString() + ")" +}; +ECPointFp.prototype.validate = function() { + var c = this.curve.getQ(); + if (this.isInfinity()) { + throw new Error("Point is at infinity.") + } + var a = this.getX().toBigInteger(); + var b = this.getY().toBigInteger(); + if (a.compareTo(BigInteger.ONE) < 0 || a.compareTo(c.subtract(BigInteger.ONE)) > 0) { + throw new Error("x coordinate out of bounds") + } + if (b.compareTo(BigInteger.ONE) < 0 || b.compareTo(c.subtract(BigInteger.ONE)) > 0) { + throw new Error("y coordinate out of bounds") + } + if (!this.isOnCurve()) { + throw new Error("Point is not on the curve.") + } + if (this.multiply(c).isInfinity()) { + throw new Error("Point is not a scalar multiple of G.") + } + return true +}; +/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval + */ +var jsonParse = (function() { + var e = "(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)"; + var j = '(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))'; + var i = '(?:"' + j + '*")'; + var d = new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|" + e + "|" + i + ")", "g"); + var k = new RegExp("\\\\(?:([^u])|u(.{4}))", "g"); + var g = { + '"': '"', + "/": "/", + "\\": "\\", + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t" + }; + function h(l, m, n) { + return m ? g[m] : String.fromCharCode(parseInt(n, 16)) + } + var c = new String(""); + var a = "\\"; + var f = { + "{": Object, + "[": Array + }; + var b = Object.hasOwnProperty; + return function(u, q) { + var p = u.match(d); + var x; + var v = p[0]; + var l = false; + if ("{" === v) { + x = {} + } else { + if ("[" === v) { + x = [] + } else { + x = []; + l = true + } + } + var t; + var r = [x]; + for (var o = 1 - l, + m = p.length; o < m; ++o) { + v = p[o]; + var w; + switch (v.charCodeAt(0)) { + default: + w = r[0]; + w[t || w.length] = +(v); + t = void 0; + break; + case 34: + v = v.substring(1, v.length - 1); + if (v.indexOf(a) !== -1) { + v = v.replace(k, h) + } + w = r[0]; + if (!t) { + if (w instanceof Array) { + t = w.length + } else { + t = v || c; + break + } + } + w[t] = v; + t = void 0; + break; + case 91: + w = r[0]; + r.unshift(w[t || w.length] = []); + t = void 0; + break; + case 93: + r.shift(); + break; + case 102: + w = r[0]; + w[t || w.length] = false; + t = void 0; + break; + case 110: + w = r[0]; + w[t || w.length] = null; + t = void 0; + break; + case 116: + w = r[0]; + w[t || w.length] = true; + t = void 0; + break; + case 123: + w = r[0]; + r.unshift(w[t || w.length] = {}); + t = void 0; + break; + case 125: + r.shift(); + break + } + } + if (l) { + if (r.length !== 1) { + throw new Error() + } + x = x[0] + } else { + if (r.length) { + throw new Error() + } + } + if (q) { + var s = function(C, B) { + var D = C[B]; + if (D && typeof D === "object") { + var n = null; + for (var z in D) { + if (b.call(D, z) && D !== C) { + var y = s(D, z); + if (y !== void 0) { + D[z] = y + } else { + if (!n) { + n = [] + } + n.push(z) + } + } + } + if (n) { + for (var A = n.length; --A >= 0;) { + delete D[n[A]] + } + } + } + return q.call(C, B, D) + }; + x = s({ + "": x + }, + "") + } + return x + } +})(); +/*! asn1-1.0.12.js (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +KJUR.asn1.ASN1Util = new +function() { + this.integerToByteHex = function(a) { + var b = a.toString(16); + if ((b.length % 2) == 1) { + b = "0" + b + } + return b + }; + this.bigIntToMinTwosComplementsHex = function(j) { + var f = j.toString(16); + if (f.substr(0, 1) != "-") { + if (f.length % 2 == 1) { + f = "0" + f + } else { + if (!f.match(/^[0-7]/)) { + f = "00" + f + } + } + } else { + var a = f.substr(1); + var e = a.length; + if (e % 2 == 1) { + e += 1 + } else { + if (!f.match(/^[0-7]/)) { + e += 2 + } + } + var g = ""; + for (var d = 0; d < e; d++) { + g += "f" + } + var c = new BigInteger(g, 16); + var b = c.xor(j).add(BigInteger.ONE); + f = b.toString(16).replace(/^-/, "") + } + return f + }; + this.getPEMStringFromHex = function(a, b) { + var c = hextob64(a); + var d = c.replace(/(.{64})/g, "$1\r\n"); + d = d.replace(/\r\n$/, ""); + return "-----BEGIN " + b + "-----\r\n" + d + "\r\n-----END " + b + "-----\r\n" + }; + this.newObject = function(b) { + var g = KJUR.asn1; + var k = Object.keys(b); + if (k.length != 1) { + throw "key of param shall be only one." + } + var j = k[0]; + if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + j + ":") == -1) { + throw "undefined key: " + j + } + if (j == "bool") { + return new g.DERBoolean(b[j]) + } + if (j == "int") { + return new g.DERInteger(b[j]) + } + if (j == "bitstr") { + return new g.DERBitString(b[j]) + } + if (j == "octstr") { + return new g.DEROctetString(b[j]) + } + if (j == "null") { + return new g.DERNull(b[j]) + } + if (j == "oid") { + return new g.DERObjectIdentifier(b[j]) + } + if (j == "enum") { + return new g.DEREnumerated(b[j]) + } + if (j == "utf8str") { + return new g.DERUTF8String(b[j]) + } + if (j == "numstr") { + return new g.DERNumericString(b[j]) + } + if (j == "prnstr") { + return new g.DERPrintableString(b[j]) + } + if (j == "telstr") { + return new g.DERTeletexString(b[j]) + } + if (j == "ia5str") { + return new g.DERIA5String(b[j]) + } + if (j == "utctime") { + return new g.DERUTCTime(b[j]) + } + if (j == "gentime") { + return new g.DERGeneralizedTime(b[j]) + } + if (j == "seq") { + var m = b[j]; + var h = []; + for (var e = 0; e < m.length; e++) { + var l = g.ASN1Util.newObject(m[e]); + h.push(l) + } + return new g.DERSequence({ + array: h + }) + } + if (j == "set") { + var m = b[j]; + var h = []; + for (var e = 0; e < m.length; e++) { + var l = g.ASN1Util.newObject(m[e]); + h.push(l) + } + return new g.DERSet({ + array: h + }) + } + if (j == "tag") { + var c = b[j]; + if (Object.prototype.toString.call(c) === "[object Array]" && c.length == 3) { + var d = g.ASN1Util.newObject(c[2]); + return new g.DERTaggedObject({ + tag: c[0], + explicit: c[1], + obj: d + }) + } else { + var f = {}; + if (c.explicit !== undefined) { + f.explicit = c.explicit + } + if (c.tag !== undefined) { + f.tag = c.tag + } + if (c.obj === undefined) { + throw "obj shall be specified for 'tag'." + } + f.obj = g.ASN1Util.newObject(c.obj); + return new g.DERTaggedObject(f) + } + } + }; + this.jsonToASN1HEX = function(b) { + var a = this.newObject(b); + return a.getEncodedHex() + } +}; +KJUR.asn1.ASN1Util.oidHexToInt = function(a) { + var j = ""; + var k = parseInt(a.substr(0, 2), 16); + var d = Math.floor(k / 40); + var c = k % 40; + var j = d + "." + c; + var e = ""; + for (var f = 2; f < a.length; f += 2) { + var g = parseInt(a.substr(f, 2), 16); + var h = ("00000000" + g.toString(2)).slice( - 8); + e = e + h.substr(1, 7); + if (h.substr(0, 1) == "0") { + var b = new BigInteger(e, 2); + j = j + "." + b.toString(10); + e = "" + } + } + return j +}; +KJUR.asn1.ASN1Util.oidIntToHex = function(f) { + var e = function(a) { + var k = a.toString(16); + if (k.length == 1) { + k = "0" + k + } + return k + }; + var d = function(o) { + var n = ""; + var k = new BigInteger(o, 10); + var a = k.toString(2); + var l = 7 - a.length % 7; + if (l == 7) { + l = 0 + } + var q = ""; + for (var m = 0; m < l; m++) { + q += "0" + } + a = q + a; + for (var m = 0; m < a.length - 1; m += 7) { + var p = a.substr(m, 7); + if (m != a.length - 7) { + p = "1" + p + } + n += e(parseInt(p, 2)) + } + return n + }; + if (!f.match(/^[0-9.]+$/)) { + throw "malformed oid string: " + f + } + var g = ""; + var b = f.split("."); + var j = parseInt(b[0]) * 40 + parseInt(b[1]); + g += e(j); + b.splice(0, 2); + for (var c = 0; c < b.length; c++) { + g += d(b[c]) + } + return g +}; +KJUR.asn1.ASN1Object = function() { + var c = true; + var b = null; + var d = "00"; + var e = "00"; + var a = ""; + this.getLengthHexFromValue = function() { + if (typeof this.hV == "undefined" || this.hV == null) { + throw "this.hV is null or undefined." + } + if (this.hV.length % 2 == 1) { + throw "value hex must be even length: n=" + a.length + ",v=" + this.hV + } + var i = this.hV.length / 2; + var h = i.toString(16); + if (h.length % 2 == 1) { + h = "0" + h + } + if (i < 128) { + return h + } else { + var g = h.length / 2; + if (g > 15) { + throw "ASN.1 length too long to represent by 8x: n = " + i.toString(16) + } + var f = 128 + g; + return f.toString(16) + h + } + }; + this.getEncodedHex = function() { + if (this.hTLV == null || this.isModified) { + this.hV = this.getFreshValueHex(); + this.hL = this.getLengthHexFromValue(); + this.hTLV = this.hT + this.hL + this.hV; + this.isModified = false + } + return this.hTLV + }; + this.getValueHex = function() { + this.getEncodedHex(); + return this.hV + }; + this.getFreshValueHex = function() { + return "" + } +}; +KJUR.asn1.DERAbstractString = function(c) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var b = null; + var a = null; + this.getString = function() { + return this.s + }; + this.setString = function(d) { + this.hTLV = null; + this.isModified = true; + this.s = d; + this.hV = stohex(this.s) + }; + this.setStringHex = function(d) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = d + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (typeof c != "undefined") { + if (typeof c == "string") { + this.setString(c) + } else { + if (typeof c.str != "undefined") { + this.setString(c.str) + } else { + if (typeof c.hex != "undefined") { + this.setStringHex(c.hex) + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object); +KJUR.asn1.DERAbstractTime = function(c) { + KJUR.asn1.DERAbstractTime.superclass.constructor.call(this); + var b = null; + var a = null; + this.localDateToUTC = function(f) { + utc = f.getTime() + (f.getTimezoneOffset() * 60000); + var e = new Date(utc); + return e + }; + this.formatDate = function(m, o, e) { + var g = this.zeroPadding; + var n = this.localDateToUTC(m); + var p = String(n.getFullYear()); + if (o == "utc") { + p = p.substr(2, 2) + } + var l = g(String(n.getMonth() + 1), 2); + var q = g(String(n.getDate()), 2); + var h = g(String(n.getHours()), 2); + var i = g(String(n.getMinutes()), 2); + var j = g(String(n.getSeconds()), 2); + var r = p + l + q + h + i + j; + if (e === true) { + var f = n.getMilliseconds(); + if (f != 0) { + var k = g(String(f), 3); + k = k.replace(/[0]+$/, ""); + r = r + "." + k + } + } + return r + "Z" + }; + this.zeroPadding = function(e, d) { + if (e.length >= d) { + return e + } + return new Array(d - e.length + 1).join("0") + e + }; + this.getString = function() { + return this.s + }; + this.setString = function(d) { + this.hTLV = null; + this.isModified = true; + this.s = d; + this.hV = stohex(d) + }; + this.setByDateValue = function(h, j, e, d, f, g) { + var i = new Date(Date.UTC(h, j - 1, e, d, f, g, 0)); + this.setByDate(i) + }; + this.getFreshValueHex = function() { + return this.hV + } +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object); +KJUR.asn1.DERAbstractStructured = function(b) { + KJUR.asn1.DERAbstractString.superclass.constructor.call(this); + var a = null; + this.setByASN1ObjectArray = function(c) { + this.hTLV = null; + this.isModified = true; + this.asn1Array = c + }; + this.appendASN1Object = function(c) { + this.hTLV = null; + this.isModified = true; + this.asn1Array.push(c) + }; + this.asn1Array = new Array(); + if (typeof b != "undefined") { + if (typeof b.array != "undefined") { + this.asn1Array = b.array + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object); +KJUR.asn1.DERBoolean = function() { + KJUR.asn1.DERBoolean.superclass.constructor.call(this); + this.hT = "01"; + this.hTLV = "0101ff" +}; +YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object); +KJUR.asn1.DERInteger = function(a) { + KJUR.asn1.DERInteger.superclass.constructor.call(this); + this.hT = "02"; + this.setByBigInteger = function(b) { + this.hTLV = null; + this.isModified = true; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b) + }; + this.setByInteger = function(c) { + var b = new BigInteger(String(c), 10); + this.setByBigInteger(b) + }; + this.setValueHex = function(b) { + this.hV = b + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (typeof a != "undefined") { + if (typeof a.bigint != "undefined") { + this.setByBigInteger(a.bigint) + } else { + if (typeof a["int"] != "undefined") { + this.setByInteger(a["int"]) + } else { + if (typeof a == "number") { + this.setByInteger(a) + } else { + if (typeof a.hex != "undefined") { + this.setValueHex(a.hex) + } + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object); +KJUR.asn1.DERBitString = function(b) { + if (b !== undefined && typeof b.obj !== "undefined") { + var a = KJUR.asn1.ASN1Util.newObject(b.obj); + b.hex = "00" + a.getEncodedHex() + } + KJUR.asn1.DERBitString.superclass.constructor.call(this); + this.hT = "03"; + this.setHexValueIncludingUnusedBits = function(c) { + this.hTLV = null; + this.isModified = true; + this.hV = c + }; + this.setUnusedBitsAndHexValue = function(c, e) { + if (c < 0 || 7 < c) { + throw "unused bits shall be from 0 to 7: u = " + c + } + var d = "0" + c; + this.hTLV = null; + this.isModified = true; + this.hV = d + e + }; + this.setByBinaryString = function(e) { + e = e.replace(/0+$/, ""); + var f = 8 - e.length % 8; + if (f == 8) { + f = 0 + } + for (var g = 0; g <= f; g++) { + e += "0" + } + var j = ""; + for (var g = 0; g < e.length - 1; g += 8) { + var d = e.substr(g, 8); + var c = parseInt(d, 2).toString(16); + if (c.length == 1) { + c = "0" + c + } + j += c + } + this.hTLV = null; + this.isModified = true; + this.hV = "0" + f + j + }; + this.setByBooleanArray = function(e) { + var d = ""; + for (var c = 0; c < e.length; c++) { + if (e[c] == true) { + d += "1" + } else { + d += "0" + } + } + this.setByBinaryString(d) + }; + this.newFalseArray = function(e) { + var c = new Array(e); + for (var d = 0; d < e; d++) { + c[d] = false + } + return c + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (typeof b != "undefined") { + if (typeof b == "string" && b.toLowerCase().match(/^[0-9a-f]+$/)) { + this.setHexValueIncludingUnusedBits(b) + } else { + if (typeof b.hex != "undefined") { + this.setHexValueIncludingUnusedBits(b.hex) + } else { + if (typeof b.bin != "undefined") { + this.setByBinaryString(b.bin) + } else { + if (typeof b.array != "undefined") { + this.setByBooleanArray(b.array) + } + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object); +KJUR.asn1.DEROctetString = function(b) { + if (b !== undefined && typeof b.obj !== "undefined") { + var a = KJUR.asn1.ASN1Util.newObject(b.obj); + b.hex = a.getEncodedHex() + } + KJUR.asn1.DEROctetString.superclass.constructor.call(this, b); + this.hT = "04" +}; +YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERNull = function() { + KJUR.asn1.DERNull.superclass.constructor.call(this); + this.hT = "05"; + this.hTLV = "0500" +}; +YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object); +KJUR.asn1.DERObjectIdentifier = function(c) { + var b = function(d) { + var e = d.toString(16); + if (e.length == 1) { + e = "0" + e + } + return e + }; + var a = function(k) { + var j = ""; + var e = new BigInteger(k, 10); + var d = e.toString(2); + var f = 7 - d.length % 7; + if (f == 7) { + f = 0 + } + var m = ""; + for (var g = 0; g < f; g++) { + m += "0" + } + d = m + d; + for (var g = 0; g < d.length - 1; g += 7) { + var l = d.substr(g, 7); + if (g != d.length - 7) { + l = "1" + l + } + j += b(parseInt(l, 2)) + } + return j + }; + KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this); + this.hT = "06"; + this.setValueHex = function(d) { + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = d + }; + this.setValueOidString = function(f) { + if (!f.match(/^[0-9.]+$/)) { + throw "malformed oid string: " + f + } + var g = ""; + var d = f.split("."); + var j = parseInt(d[0]) * 40 + parseInt(d[1]); + g += b(j); + d.splice(0, 2); + for (var e = 0; e < d.length; e++) { + g += a(d[e]) + } + this.hTLV = null; + this.isModified = true; + this.s = null; + this.hV = g + }; + this.setValueName = function(e) { + var d = KJUR.asn1.x509.OID.name2oid(e); + if (d !== "") { + this.setValueOidString(d) + } else { + throw "DERObjectIdentifier oidName undefined: " + e + } + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (c !== undefined) { + if (typeof c === "string") { + if (c.match(/^[0-2].[0-9.]+$/)) { + this.setValueOidString(c) + } else { + this.setValueName(c) + } + } else { + if (c.oid !== undefined) { + this.setValueOidString(c.oid) + } else { + if (c.hex !== undefined) { + this.setValueHex(c.hex) + } else { + if (c.name !== undefined) { + this.setValueName(c.name) + } + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object); +KJUR.asn1.DEREnumerated = function(a) { + KJUR.asn1.DEREnumerated.superclass.constructor.call(this); + this.hT = "0a"; + this.setByBigInteger = function(b) { + this.hTLV = null; + this.isModified = true; + this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b) + }; + this.setByInteger = function(c) { + var b = new BigInteger(String(c), 10); + this.setByBigInteger(b) + }; + this.setValueHex = function(b) { + this.hV = b + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (typeof a != "undefined") { + if (typeof a["int"] != "undefined") { + this.setByInteger(a["int"]) + } else { + if (typeof a == "number") { + this.setByInteger(a) + } else { + if (typeof a.hex != "undefined") { + this.setValueHex(a.hex) + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object); +KJUR.asn1.DERUTF8String = function(a) { + KJUR.asn1.DERUTF8String.superclass.constructor.call(this, a); + this.hT = "0c" +}; +YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERNumericString = function(a) { + KJUR.asn1.DERNumericString.superclass.constructor.call(this, a); + this.hT = "12" +}; +YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERPrintableString = function(a) { + KJUR.asn1.DERPrintableString.superclass.constructor.call(this, a); + this.hT = "13" +}; +YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERTeletexString = function(a) { + KJUR.asn1.DERTeletexString.superclass.constructor.call(this, a); + this.hT = "14" +}; +YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERIA5String = function(a) { + KJUR.asn1.DERIA5String.superclass.constructor.call(this, a); + this.hT = "16" +}; +YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString); +KJUR.asn1.DERUTCTime = function(a) { + KJUR.asn1.DERUTCTime.superclass.constructor.call(this, a); + this.hT = "17"; + this.setByDate = function(b) { + this.hTLV = null; + this.isModified = true; + this.date = b; + this.s = this.formatDate(this.date, "utc"); + this.hV = stohex(this.s) + }; + this.getFreshValueHex = function() { + if (typeof this.date == "undefined" && typeof this.s == "undefined") { + this.date = new Date(); + this.s = this.formatDate(this.date, "utc"); + this.hV = stohex(this.s) + } + return this.hV + }; + if (a !== undefined) { + if (a.str !== undefined) { + this.setString(a.str) + } else { + if (typeof a == "string" && a.match(/^[0-9]{12}Z$/)) { + this.setString(a) + } else { + if (a.hex !== undefined) { + this.setStringHex(a.hex) + } else { + if (a.date !== undefined) { + this.setByDate(a.date) + } + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime); +KJUR.asn1.DERGeneralizedTime = function(a) { + KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, a); + this.hT = "18"; + this.withMillis = false; + this.setByDate = function(b) { + this.hTLV = null; + this.isModified = true; + this.date = b; + this.s = this.formatDate(this.date, "gen", this.withMillis); + this.hV = stohex(this.s) + }; + this.getFreshValueHex = function() { + if (this.date === undefined && this.s === undefined) { + this.date = new Date(); + this.s = this.formatDate(this.date, "gen", this.withMillis); + this.hV = stohex(this.s) + } + return this.hV + }; + if (a !== undefined) { + if (a.str !== undefined) { + this.setString(a.str) + } else { + if (typeof a == "string" && a.match(/^[0-9]{14}Z$/)) { + this.setString(a) + } else { + if (a.hex !== undefined) { + this.setStringHex(a.hex) + } else { + if (a.date !== undefined) { + this.setByDate(a.date) + } + } + } + } + if (a.millis === true) { + this.withMillis = true + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime); +KJUR.asn1.DERSequence = function(a) { + KJUR.asn1.DERSequence.superclass.constructor.call(this, a); + this.hT = "30"; + this.getFreshValueHex = function() { + var c = ""; + for (var b = 0; b < this.asn1Array.length; b++) { + var d = this.asn1Array[b]; + c += d.getEncodedHex() + } + this.hV = c; + return this.hV + } +}; +YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured); +KJUR.asn1.DERSet = function(a) { + KJUR.asn1.DERSet.superclass.constructor.call(this, a); + this.hT = "31"; + this.sortFlag = true; + this.getFreshValueHex = function() { + var b = new Array(); + for (var c = 0; c < this.asn1Array.length; c++) { + var d = this.asn1Array[c]; + b.push(d.getEncodedHex()) + } + if (this.sortFlag == true) { + b.sort() + } + this.hV = b.join(""); + return this.hV + }; + if (typeof a != "undefined") { + if (typeof a.sortflag != "undefined" && a.sortflag == false) { + this.sortFlag = false + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured); +KJUR.asn1.DERTaggedObject = function(a) { + KJUR.asn1.DERTaggedObject.superclass.constructor.call(this); + this.hT = "a0"; + this.hV = ""; + this.isExplicit = true; + this.asn1Object = null; + this.setASN1Object = function(b, c, d) { + this.hT = c; + this.isExplicit = b; + this.asn1Object = d; + if (this.isExplicit) { + this.hV = this.asn1Object.getEncodedHex(); + this.hTLV = null; + this.isModified = true + } else { + this.hV = null; + this.hTLV = d.getEncodedHex(); + this.hTLV = this.hTLV.replace(/^../, c); + this.isModified = false + } + }; + this.getFreshValueHex = function() { + return this.hV + }; + if (typeof a != "undefined") { + if (typeof a.tag != "undefined") { + this.hT = a.tag + } + if (typeof a.explicit != "undefined") { + this.isExplicit = a.explicit + } + if (typeof a.obj != "undefined") { + this.asn1Object = a.obj; + this.setASN1Object(this.isExplicit, this.hT, this.asn1Object) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object); +/*! asn1hex-1.1.9.js (c) 2012-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var ASN1HEX = new +function() {}; +ASN1HEX.getByteLengthOfL_AtObj = function(b, c) { + if (b.substring(c + 2, c + 3) != "8") { + return 1 + } + var a = parseInt(b.substring(c + 3, c + 4)); + if (a == 0) { + return - 1 + } + if (0 < a && a < 10) { + return a + 1 + } + return - 2 +}; +ASN1HEX.getHexOfL_AtObj = function(b, c) { + var a = ASN1HEX.getByteLengthOfL_AtObj(b, c); + if (a < 1) { + return "" + } + return b.substring(c + 2, c + 2 + a * 2) +}; +ASN1HEX.getIntOfL_AtObj = function(c, d) { + var b = ASN1HEX.getHexOfL_AtObj(c, d); + if (b == "") { + return - 1 + } + var a; + if (parseInt(b.substring(0, 1)) < 8) { + a = new BigInteger(b, 16) + } else { + a = new BigInteger(b.substring(2), 16) + } + return a.intValue() +}; +ASN1HEX.getStartPosOfV_AtObj = function(b, c) { + var a = ASN1HEX.getByteLengthOfL_AtObj(b, c); + if (a < 0) { + return a + } + return c + (a + 1) * 2 +}; +ASN1HEX.getHexOfV_AtObj = function(c, d) { + var b = ASN1HEX.getStartPosOfV_AtObj(c, d); + var a = ASN1HEX.getIntOfL_AtObj(c, d); + return c.substring(b, b + a * 2) +}; +ASN1HEX.getHexOfTLV_AtObj = function(c, e) { + var b = c.substr(e, 2); + var d = ASN1HEX.getHexOfL_AtObj(c, e); + var a = ASN1HEX.getHexOfV_AtObj(c, e); + return b + d + a +}; +ASN1HEX.getPosOfNextSibling_AtObj = function(c, d) { + var b = ASN1HEX.getStartPosOfV_AtObj(c, d); + var a = ASN1HEX.getIntOfL_AtObj(c, d); + return b + a * 2 +}; +ASN1HEX.getPosArrayOfChildren_AtObj = function(f, j) { + var c = new Array(); + var i = ASN1HEX.getStartPosOfV_AtObj(f, j); + if (f.substr(j, 2) == "03") { + c.push(i + 2) + } else { + c.push(i) + } + var b = ASN1HEX.getIntOfL_AtObj(f, j); + var g = i; + var d = 0; + while (1) { + var e = ASN1HEX.getPosOfNextSibling_AtObj(f, g); + if (e == null || (e - i >= (b * 2))) { + break + } + if (d >= 200) { + break + } + c.push(e); + g = e; + d++ + } + return c +}; +ASN1HEX.getNthChildIndex_AtObj = function(d, b, e) { + var c = ASN1HEX.getPosArrayOfChildren_AtObj(d, b); + return c[e] +}; +ASN1HEX.getDecendantIndexByNthList = function(e, d, c) { + if (c.length == 0) { + return d + } + var f = c.shift(); + var b = ASN1HEX.getPosArrayOfChildren_AtObj(e, d); + return ASN1HEX.getDecendantIndexByNthList(e, b[f], c) +}; +ASN1HEX.getDecendantHexTLVByNthList = function(d, c, b) { + var a = ASN1HEX.getDecendantIndexByNthList(d, c, b); + return ASN1HEX.getHexOfTLV_AtObj(d, a) +}; +ASN1HEX.getDecendantHexVByNthList = function(d, c, b) { + var a = ASN1HEX.getDecendantIndexByNthList(d, c, b); + return ASN1HEX.getHexOfV_AtObj(d, a) +}; +ASN1HEX.getVbyList = function(d, c, b, e) { + var a = ASN1HEX.getDecendantIndexByNthList(d, c, b); + if (a === undefined) { + throw "can't find nthList object" + } + if (e !== undefined) { + if (d.substr(a, 2) != e) { + throw "checking tag doesn't match: " + d.substr(a, 2) + "!=" + e + } + } + return ASN1HEX.getHexOfV_AtObj(d, a) +}; +ASN1HEX.hextooidstr = function(e) { + var h = function(b, a) { + if (b.length >= a) { + return b + } + return new Array(a - b.length + 1).join("0") + b + }; + var l = []; + var o = e.substr(0, 2); + var f = parseInt(o, 16); + l[0] = new String(Math.floor(f / 40)); + l[1] = new String(f % 40); + var m = e.substr(2); + var k = []; + for (var g = 0; g < m.length / 2; g++) { + k.push(parseInt(m.substr(g * 2, 2), 16)) + } + var j = []; + var d = ""; + for (var g = 0; g < k.length; g++) { + if (k[g] & 128) { + d = d + h((k[g] & 127).toString(2), 7) + } else { + d = d + h((k[g] & 127).toString(2), 7); + j.push(new String(parseInt(d, 2))); + d = "" + } + } + var n = l.join("."); + if (j.length > 0) { + n = n + "." + j.join(".") + } + return n +}; +ASN1HEX.dump = function(q, c, k, g) { + var e = q; + if (q instanceof KJUR.asn1.ASN1Object) { + e = q.getEncodedHex() + } + var o = function(x, i) { + if (x.length <= i * 2) { + return x + } else { + var v = x.substr(0, i) + "..(total " + x.length / 2 + "bytes).." + x.substr(x.length - i, i); + return v + } + }; + if (c === undefined) { + c = { + ommit_long_octet: 32 + } + } + if (k === undefined) { + k = 0 + } + if (g === undefined) { + g = "" + } + var t = c.ommit_long_octet; + if (e.substr(k, 2) == "01") { + var h = ASN1HEX.getHexOfV_AtObj(e, k); + if (h == "00") { + return g + "BOOLEAN FALSE\n" + } else { + return g + "BOOLEAN TRUE\n" + } + } + if (e.substr(k, 2) == "02") { + var h = ASN1HEX.getHexOfV_AtObj(e, k); + return g + "INTEGER " + o(h, t) + "\n" + } + if (e.substr(k, 2) == "03") { + var h = ASN1HEX.getHexOfV_AtObj(e, k); + return g + "BITSTRING " + o(h, t) + "\n" + } + if (e.substr(k, 2) == "04") { + var h = ASN1HEX.getHexOfV_AtObj(e, k); + if (ASN1HEX.isASN1HEX(h)) { + var j = g + "OCTETSTRING, encapsulates\n"; + j = j + ASN1HEX.dump(h, c, 0, g + " "); + return j + } else { + return g + "OCTETSTRING " + o(h, t) + "\n" + } + } + if (e.substr(k, 2) == "05") { + return g + "NULL\n" + } + if (e.substr(k, 2) == "06") { + var l = ASN1HEX.getHexOfV_AtObj(e, k); + var a = KJUR.asn1.ASN1Util.oidHexToInt(l); + var n = KJUR.asn1.x509.OID.oid2name(a); + var b = a.replace(/\./g, " "); + if (n != "") { + return g + "ObjectIdentifier " + n + " (" + b + ")\n" + } else { + return g + "ObjectIdentifier (" + b + ")\n" + } + } + if (e.substr(k, 2) == "0c") { + return g + "UTF8String '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "'\n" + } + if (e.substr(k, 2) == "13") { + return g + "PrintableString '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "'\n" + } + if (e.substr(k, 2) == "14") { + return g + "TeletexString '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "'\n" + } + if (e.substr(k, 2) == "16") { + return g + "IA5String '" + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "'\n" + } + if (e.substr(k, 2) == "17") { + return g + "UTCTime " + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "\n" + } + if (e.substr(k, 2) == "18") { + return g + "GeneralizedTime " + hextoutf8(ASN1HEX.getHexOfV_AtObj(e, k)) + "\n" + } + if (e.substr(k, 2) == "30") { + if (e.substr(k, 4) == "3000") { + return g + "SEQUENCE {}\n" + } + var j = g + "SEQUENCE\n"; + var d = ASN1HEX.getPosArrayOfChildren_AtObj(e, k); + var f = c; + if ((d.length == 2 || d.length == 3) && e.substr(d[0], 2) == "06" && e.substr(d[d.length - 1], 2) == "04") { + var u = ASN1HEX.getHexOfV_AtObj(e, d[0]); + var a = KJUR.asn1.ASN1Util.oidHexToInt(u); + var n = KJUR.asn1.x509.OID.oid2name(a); + var p = JSON.parse(JSON.stringify(c)); + p.x509ExtName = n; + f = p + } + for (var r = 0; r < d.length; r++) { + j = j + ASN1HEX.dump(e, f, d[r], g + " ") + } + return j + } + if (e.substr(k, 2) == "31") { + var j = g + "SET\n"; + var d = ASN1HEX.getPosArrayOfChildren_AtObj(e, k); + for (var r = 0; r < d.length; r++) { + j = j + ASN1HEX.dump(e, c, d[r], g + " ") + } + return j + } + var w = parseInt(e.substr(k, 2), 16); + if ((w & 128) != 0) { + var m = w & 31; + if ((w & 32) != 0) { + var j = g + "[" + m + "]\n"; + var d = ASN1HEX.getPosArrayOfChildren_AtObj(e, k); + for (var r = 0; r < d.length; r++) { + j = j + ASN1HEX.dump(e, c, d[r], g + " ") + } + return j + } else { + var h = ASN1HEX.getHexOfV_AtObj(e, k); + if (h.substr(0, 8) == "68747470") { + h = hextoutf8(h) + } + if (c.x509ExtName === "subjectAltName" && m == 2) { + h = hextoutf8(h) + } + var j = g + "[" + m + "] " + h + "\n"; + return j + } + } + return g + "UNKNOWN(" + e.substr(k, 2) + ") " + ASN1HEX.getHexOfV_AtObj(e, k) + "\n" +}; +ASN1HEX.isASN1HEX = function(d) { + if (d.length % 2 == 1) { + return false + } + var c = ASN1HEX.getIntOfL_AtObj(d, 0); + var b = d.substr(0, 2); + var e = ASN1HEX.getHexOfL_AtObj(d, 0); + var a = d.length - b.length - e.length; + if (a == c * 2) { + return true + } + return false +}; +ASN1HEX.pemToHex = function(b, d) { + if (b.indexOf("-----BEGIN ") == -1) { + throw "can't find PEM header: " + d + } + if (d !== undefined) { + b = b.replace("-----BEGIN " + d + "-----", ""); + b = b.replace("-----END " + d + "-----", "") + } else { + b = b.replace(/-----BEGIN [^-]+-----/, ""); + b = b.replace(/-----END [^-]+-----/, "") + } + var c = b.replace(/\s+/g, ""); + var a = b64tohex(c); + return a +}; +/*! asn1x509-1.0.22.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +if (typeof KJUR.asn1.x509 == "undefined" || !KJUR.asn1.x509) { + KJUR.asn1.x509 = {} +} +KJUR.asn1.x509.Certificate = function(g) { + KJUR.asn1.x509.Certificate.superclass.constructor.call(this); + var b = null; + var d = null; + var f = null; + var c = null; + var a = null; + var e = null; + this.setRsaPrvKeyByPEMandPass = function(i, k) { + var h = PKCS5PKEY.getDecryptedKeyHex(i, k); + var j = new RSAKey(); + j.readPrivateKeyFromASN1HexString(h); + this.prvKey = j + }; + this.sign = function() { + this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg; + var i = new KJUR.crypto.Signature({ + alg: this.asn1SignatureAlg.nameAlg + }); + i.init(this.prvKey); + i.updateHex(this.asn1TBSCert.getEncodedHex()); + this.hexSig = i.sign(); + this.asn1Sig = new KJUR.asn1.DERBitString({ + hex: "00" + this.hexSig + }); + var h = new KJUR.asn1.DERSequence({ + array: [this.asn1TBSCert, this.asn1SignatureAlg, this.asn1Sig] + }); + this.hTLV = h.getEncodedHex(); + this.isModified = false + }; + this.setSignatureHex = function(h) { + this.asn1SignatureAlg = this.asn1TBSCert.asn1SignatureAlg; + this.hexSig = h; + this.asn1Sig = new KJUR.asn1.DERBitString({ + hex: "00" + this.hexSig + }); + var i = new KJUR.asn1.DERSequence({ + array: [this.asn1TBSCert, this.asn1SignatureAlg, this.asn1Sig] + }); + this.hTLV = i.getEncodedHex(); + this.isModified = false + }; + this.getEncodedHex = function() { + if (this.isModified == false && this.hTLV != null) { + return this.hTLV + } + throw "not signed yet" + }; + this.getPEMString = function() { + var j = this.getEncodedHex(); + var h = CryptoJS.enc.Hex.parse(j); + var i = CryptoJS.enc.Base64.stringify(h); + var k = i.replace(/(.{64})/g, "$1\r\n"); + return "-----BEGIN CERTIFICATE-----\r\n" + k + "\r\n-----END CERTIFICATE-----\r\n" + }; + if (g !== undefined) { + if (g.tbscertobj !== undefined) { + this.asn1TBSCert = g.tbscertobj + } + if (g.prvkeyobj !== undefined) { + this.prvKey = g.prvkeyobj + } else { + if (g.rsaprvkey !== undefined) { + this.prvKey = g.rsaprvkey + } else { + if ((g.rsaprvpem !== undefined) && (g.rsaprvpas !== undefined)) { + this.setRsaPrvKeyByPEMandPass(g.rsaprvpem, g.rsaprvpas) + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.Certificate, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.TBSCertificate = function(a) { + KJUR.asn1.x509.TBSCertificate.superclass.constructor.call(this); + this._initialize = function() { + this.asn1Array = new Array(); + this.asn1Version = new KJUR.asn1.DERTaggedObject({ + obj: new KJUR.asn1.DERInteger({ + "int": 2 + }) + }); + this.asn1SerialNumber = null; + this.asn1SignatureAlg = null; + this.asn1Issuer = null; + this.asn1NotBefore = null; + this.asn1NotAfter = null; + this.asn1Subject = null; + this.asn1SubjPKey = null; + this.extensionsArray = new Array() + }; + this.setSerialNumberByParam = function(b) { + this.asn1SerialNumber = new KJUR.asn1.DERInteger(b) + }; + this.setSignatureAlgByParam = function(b) { + this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(b) + }; + this.setIssuerByParam = function(b) { + this.asn1Issuer = new KJUR.asn1.x509.X500Name(b) + }; + this.setNotBeforeByParam = function(b) { + this.asn1NotBefore = new KJUR.asn1.x509.Time(b) + }; + this.setNotAfterByParam = function(b) { + this.asn1NotAfter = new KJUR.asn1.x509.Time(b) + }; + this.setSubjectByParam = function(b) { + this.asn1Subject = new KJUR.asn1.x509.X500Name(b) + }; + this.setSubjectPublicKeyByParam = function(b) { + this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(b) + }; + this.setSubjectPublicKeyByGetKey = function(c) { + var b = KEYUTIL.getKey(c); + this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(b) + }; + this.appendExtension = function(b) { + this.extensionsArray.push(b) + }; + this.appendExtensionByName = function(c, b) { + KJUR.asn1.x509.Extension.appendByNameToArray(c, b, this.extensionsArray) + }; + this.getEncodedHex = function() { + if (this.asn1NotBefore == null || this.asn1NotAfter == null) { + throw "notBefore and/or notAfter not set" + } + var c = new KJUR.asn1.DERSequence({ + array: [this.asn1NotBefore, this.asn1NotAfter] + }); + this.asn1Array = new Array(); + this.asn1Array.push(this.asn1Version); + this.asn1Array.push(this.asn1SerialNumber); + this.asn1Array.push(this.asn1SignatureAlg); + this.asn1Array.push(this.asn1Issuer); + this.asn1Array.push(c); + this.asn1Array.push(this.asn1Subject); + this.asn1Array.push(this.asn1SubjPKey); + if (this.extensionsArray.length > 0) { + var d = new KJUR.asn1.DERSequence({ + array: this.extensionsArray + }); + var b = new KJUR.asn1.DERTaggedObject({ + explicit: true, + tag: "a3", + obj: d + }); + this.asn1Array.push(b) + } + var e = new KJUR.asn1.DERSequence({ + array: this.asn1Array + }); + this.hTLV = e.getEncodedHex(); + this.isModified = false; + return this.hTLV + }; + this._initialize() +}; +YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.Extension = function(b) { + KJUR.asn1.x509.Extension.superclass.constructor.call(this); + var a = null; + this.getEncodedHex = function() { + var f = new KJUR.asn1.DERObjectIdentifier({ + oid: this.oid + }); + var e = new KJUR.asn1.DEROctetString({ + hex: this.getExtnValueHex() + }); + var d = new Array(); + d.push(f); + if (this.critical) { + d.push(new KJUR.asn1.DERBoolean()) + } + d.push(e); + var c = new KJUR.asn1.DERSequence({ + array: d + }); + return c.getEncodedHex() + }; + this.critical = false; + if (typeof b != "undefined") { + if (typeof b.critical != "undefined") { + this.critical = b.critical + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.Extension, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.Extension.appendByNameToArray = function(e, c, b) { + if (e.toLowerCase() == "basicconstraints") { + var d = new KJUR.asn1.x509.BasicConstraints(c); + b.push(d) + } else { + if (e.toLowerCase() == "keyusage") { + var d = new KJUR.asn1.x509.KeyUsage(c); + b.push(d) + } else { + if (e.toLowerCase() == "crldistributionpoints") { + var d = new KJUR.asn1.x509.CRLDistributionPoints(c); + b.push(d) + } else { + if (e.toLowerCase() == "extkeyusage") { + var d = new KJUR.asn1.x509.ExtKeyUsage(c); + b.push(d) + } else { + if (e.toLowerCase() == "authoritykeyidentifier") { + var d = new KJUR.asn1.x509.AuthorityKeyIdentifier(c); + b.push(d) + } else { + if (e.toLowerCase() == "authorityinfoaccess") { + var d = new KJUR.asn1.x509.AuthorityInfoAccess(c); + b.push(d) + } else { + if (e.toLowerCase() == "subjectaltname") { + var d = new KJUR.asn1.x509.SubjectAltName(c); + b.push(d) + } else { + if (e.toLowerCase() == "issueraltname") { + var d = new KJUR.asn1.x509.IssuerAltName(c); + b.push(d) + } else { + throw "unsupported extension name: " + e + } + } + } + } + } + } + } + } +}; +KJUR.asn1.x509.KeyUsage = function(a) { + KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this, a); + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "2.5.29.15"; + if (typeof a != "undefined") { + if (typeof a.bin != "undefined") { + this.asn1ExtnValue = new KJUR.asn1.DERBitString(a) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.BasicConstraints = function(c) { + KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this, c); + var a = false; + var b = -1; + this.getExtnValueHex = function() { + var e = new Array(); + if (this.cA) { + e.push(new KJUR.asn1.DERBoolean()) + } + if (this.pathLen > -1) { + e.push(new KJUR.asn1.DERInteger({ + "int": this.pathLen + })) + } + var d = new KJUR.asn1.DERSequence({ + array: e + }); + this.asn1ExtnValue = d; + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "2.5.29.19"; + this.cA = false; + this.pathLen = -1; + if (typeof c != "undefined") { + if (typeof c.cA != "undefined") { + this.cA = c.cA + } + if (typeof c.pathLen != "undefined") { + this.pathLen = c.pathLen + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.CRLDistributionPoints = function(a) { + KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this, a); + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.setByDPArray = function(b) { + this.asn1ExtnValue = new KJUR.asn1.DERSequence({ + array: b + }) + }; + this.setByOneURI = function(e) { + var b = new KJUR.asn1.x509.GeneralNames([{ + uri: e + }]); + var d = new KJUR.asn1.x509.DistributionPointName(b); + var c = new KJUR.asn1.x509.DistributionPoint({ + dpobj: d + }); + this.setByDPArray([c]) + }; + this.oid = "2.5.29.31"; + if (typeof a != "undefined") { + if (typeof a.array != "undefined") { + this.setByDPArray(a.array) + } else { + if (typeof a.uri != "undefined") { + this.setByOneURI(a.uri) + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.ExtKeyUsage = function(a) { + KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this, a); + this.setPurposeArray = function(b) { + this.asn1ExtnValue = new KJUR.asn1.DERSequence(); + for (var c = 0; c < b.length; c++) { + var d = new KJUR.asn1.DERObjectIdentifier(b[c]); + this.asn1ExtnValue.appendASN1Object(d) + } + }; + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "2.5.29.37"; + if (typeof a != "undefined") { + if (typeof a.array != "undefined") { + this.setPurposeArray(a.array) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.ExtKeyUsage, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.AuthorityKeyIdentifier = function(a) { + KJUR.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this, a); + this.asn1KID = null; + this.asn1CertIssuer = null; + this.asn1CertSN = null; + this.getExtnValueHex = function() { + var c = new Array(); + if (this.asn1KID) { + c.push(new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: "80", + obj: this.asn1KID + })) + } + if (this.asn1CertIssuer) { + c.push(new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: "a1", + obj: this.asn1CertIssuer + })) + } + if (this.asn1CertSN) { + c.push(new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: "82", + obj: this.asn1CertSN + })) + } + var b = new KJUR.asn1.DERSequence({ + array: c + }); + this.asn1ExtnValue = b; + return this.asn1ExtnValue.getEncodedHex() + }; + this.setKIDByParam = function(b) { + this.asn1KID = new KJUR.asn1.DEROctetString(b) + }; + this.setCertIssuerByParam = function(b) { + this.asn1CertIssuer = new KJUR.asn1.x509.X500Name(b) + }; + this.setCertSNByParam = function(b) { + this.asn1CertSN = new KJUR.asn1.DERInteger(b) + }; + this.oid = "2.5.29.35"; + if (typeof a != "undefined") { + if (typeof a.kid != "undefined") { + this.setKIDByParam(a.kid) + } + if (typeof a.issuer != "undefined") { + this.setCertIssuerByParam(a.issuer) + } + if (typeof a.sn != "undefined") { + this.setCertSNByParam(a.sn) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.AuthorityKeyIdentifier, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.AuthorityInfoAccess = function(a) { + KJUR.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this, a); + this.setAccessDescriptionArray = function(c) { + var g = new Array(); + for (var b = 0; b < c.length; b++) { + var e = new KJUR.asn1.DERObjectIdentifier(c[b].accessMethod); + var d = new KJUR.asn1.x509.GeneralName(c[b].accessLocation); + var f = new KJUR.asn1.DERSequence({ + array: [e, d] + }); + g.push(f) + } + this.asn1ExtnValue = new KJUR.asn1.DERSequence({ + array: g + }) + }; + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "1.3.6.1.5.5.7.1.1"; + if (typeof a != "undefined") { + if (typeof a.array != "undefined") { + this.setAccessDescriptionArray(a.array) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.AuthorityInfoAccess, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.SubjectAltName = function(a) { + KJUR.asn1.x509.SubjectAltName.superclass.constructor.call(this, a); + this.setNameArray = function(b) { + this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(b) + }; + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "2.5.29.17"; + if (a !== undefined) { + if (a.array !== undefined) { + this.setNameArray(a.array) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.SubjectAltName, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.IssuerAltName = function(a) { + KJUR.asn1.x509.IssuerAltName.superclass.constructor.call(this, a); + this.setNameArray = function(b) { + this.asn1ExtnValue = new KJUR.asn1.x509.GeneralNames(b) + }; + this.getExtnValueHex = function() { + return this.asn1ExtnValue.getEncodedHex() + }; + this.oid = "2.5.29.18"; + if (a !== undefined) { + if (a.array !== undefined) { + this.setNameArray(a.array) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.IssuerAltName, KJUR.asn1.x509.Extension); +KJUR.asn1.x509.CRL = function(f) { + KJUR.asn1.x509.CRL.superclass.constructor.call(this); + var a = null; + var c = null; + var e = null; + var b = null; + var d = null; + this.setRsaPrvKeyByPEMandPass = function(h, j) { + var g = PKCS5PKEY.getDecryptedKeyHex(h, j); + var i = new RSAKey(); + i.readPrivateKeyFromASN1HexString(g); + this.rsaPrvKey = i + }; + this.sign = function() { + this.asn1SignatureAlg = this.asn1TBSCertList.asn1SignatureAlg; + sig = new KJUR.crypto.Signature({ + alg: "SHA1withRSA", + prov: "cryptojs/jsrsa" + }); + sig.initSign(this.rsaPrvKey); + sig.updateHex(this.asn1TBSCertList.getEncodedHex()); + this.hexSig = sig.sign(); + this.asn1Sig = new KJUR.asn1.DERBitString({ + hex: "00" + this.hexSig + }); + var g = new KJUR.asn1.DERSequence({ + array: [this.asn1TBSCertList, this.asn1SignatureAlg, this.asn1Sig] + }); + this.hTLV = g.getEncodedHex(); + this.isModified = false + }; + this.getEncodedHex = function() { + if (this.isModified == false && this.hTLV != null) { + return this.hTLV + } + throw "not signed yet" + }; + this.getPEMString = function() { + var i = this.getEncodedHex(); + var g = CryptoJS.enc.Hex.parse(i); + var h = CryptoJS.enc.Base64.stringify(g); + var j = h.replace(/(.{64})/g, "$1\r\n"); + return "-----BEGIN X509 CRL-----\r\n" + j + "\r\n-----END X509 CRL-----\r\n" + }; + if (typeof f != "undefined") { + if (typeof f.tbsobj != "undefined") { + this.asn1TBSCertList = f.tbsobj + } + if (typeof f.rsaprvkey != "undefined") { + this.rsaPrvKey = f.rsaprvkey + } + if ((typeof f.rsaprvpem != "undefined") && (typeof f.rsaprvpas != "undefined")) { + this.setRsaPrvKeyByPEMandPass(f.rsaprvpem, f.rsaprvpas) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.CRL, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.TBSCertList = function(b) { + KJUR.asn1.x509.TBSCertList.superclass.constructor.call(this); + var a = null; + this.setSignatureAlgByParam = function(c) { + this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier(c) + }; + this.setIssuerByParam = function(c) { + this.asn1Issuer = new KJUR.asn1.x509.X500Name(c) + }; + this.setThisUpdateByParam = function(c) { + this.asn1ThisUpdate = new KJUR.asn1.x509.Time(c) + }; + this.setNextUpdateByParam = function(c) { + this.asn1NextUpdate = new KJUR.asn1.x509.Time(c) + }; + this.addRevokedCert = function(c, d) { + var f = {}; + if (c != undefined && c != null) { + f.sn = c + } + if (d != undefined && d != null) { + f.time = d + } + var e = new KJUR.asn1.x509.CRLEntry(f); + this.aRevokedCert.push(e) + }; + this.getEncodedHex = function() { + this.asn1Array = new Array(); + if (this.asn1Version != null) { + this.asn1Array.push(this.asn1Version) + } + this.asn1Array.push(this.asn1SignatureAlg); + this.asn1Array.push(this.asn1Issuer); + this.asn1Array.push(this.asn1ThisUpdate); + if (this.asn1NextUpdate != null) { + this.asn1Array.push(this.asn1NextUpdate) + } + if (this.aRevokedCert.length > 0) { + var c = new KJUR.asn1.DERSequence({ + array: this.aRevokedCert + }); + this.asn1Array.push(c) + } + var d = new KJUR.asn1.DERSequence({ + array: this.asn1Array + }); + this.hTLV = d.getEncodedHex(); + this.isModified = false; + return this.hTLV + }; + this._initialize = function() { + this.asn1Version = null; + this.asn1SignatureAlg = null; + this.asn1Issuer = null; + this.asn1ThisUpdate = null; + this.asn1NextUpdate = null; + this.aRevokedCert = new Array() + }; + this._initialize() +}; +YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.CRLEntry = function(c) { + KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this); + var b = null; + var a = null; + this.setCertSerial = function(d) { + this.sn = new KJUR.asn1.DERInteger(d) + }; + this.setRevocationDate = function(d) { + this.time = new KJUR.asn1.x509.Time(d) + }; + this.getEncodedHex = function() { + var d = new KJUR.asn1.DERSequence({ + array: [this.sn, this.time] + }); + this.TLV = d.getEncodedHex(); + return this.TLV + }; + if (typeof c != "undefined") { + if (typeof c.time != "undefined") { + this.setRevocationDate(c.time) + } + if (typeof c.sn != "undefined") { + this.setCertSerial(c.sn) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.X500Name = function(b) { + KJUR.asn1.x509.X500Name.superclass.constructor.call(this); + this.asn1Array = new Array(); + this.setByString = function(c) { + var d = c.split("/"); + d.shift(); + for (var e = 0; e < d.length; e++) { + this.asn1Array.push(new KJUR.asn1.x509.RDN({ + str: d[e] + })) + } + }; + this.setByLdapString = function(c) { + var d = KJUR.asn1.x509.X500Name.ldapToOneline(c); + this.setByString(d) + }; + this.setByObject = function(e) { + for (var c in e) { + if (e.hasOwnProperty(c)) { + var d = new KJUR.asn1.x509.RDN({ + str: c + "=" + e[c] + }); + this.asn1Array ? this.asn1Array.push(d) : this.asn1Array = [d] + } + } + }; + this.getEncodedHex = function() { + if (typeof this.hTLV == "string") { + return this.hTLV + } + var c = new KJUR.asn1.DERSequence({ + array: this.asn1Array + }); + this.hTLV = c.getEncodedHex(); + return this.hTLV + }; + if (b !== undefined) { + if (b.str !== undefined) { + this.setByString(b.str) + } else { + if (b.ldapstr !== undefined) { + this.setByLdapString(b.ldapstr) + } else { + if (typeof b === "object") { + this.setByObject(b) + } + } + } + if (b.certissuer !== undefined) { + var a = new X509(); + a.hex = ASN1HEX.pemToHex(b.certissuer); + this.hTLV = a.getIssuerHex() + } + if (b.certsubject !== undefined) { + var a = new X509(); + a.hex = ASN1HEX.pemToHex(b.certsubject); + this.hTLV = a.getSubjectHex() + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.X500Name, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.X500Name.onelineToLDAP = function(d) { + if (d.substr(0, 1) !== "/") { + throw "malformed input" + } + var b = ""; + d = d.substr(1); + var c = d.split("/"); + c.reverse(); + c = c.map(function(a) { + return a.replace(/,/, "\\,") + }); + return c.join(",") +}; +KJUR.asn1.x509.X500Name.ldapToOneline = function(g) { + var c = g.split(","); + var e = false; + var b = []; + for (var f = 0; c.length > 0; f++) { + var h = c.shift(); + if (e === true) { + var d = b.pop(); + var j = (d + "," + h).replace(/\\,/g, ","); + b.push(j); + e = false + } else { + b.push(h) + } + if (h.substr( - 1, 1) === "\\") { + e = true + } + } + b = b.map(function(a) { + return a.replace("/", "\\/") + }); + b.reverse(); + return "/" + b.join("/") +}; +KJUR.asn1.x509.RDN = function(a) { + KJUR.asn1.x509.RDN.superclass.constructor.call(this); + this.asn1Array = new Array(); + this.addByString = function(b) { + this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({ + str: b + })) + }; + this.addByMultiValuedString = function(d) { + var b = KJUR.asn1.x509.RDN.parseString(d); + for (var c = 0; c < b.length; c++) { + this.addByString(b[c]) + } + }; + this.getEncodedHex = function() { + var b = new KJUR.asn1.DERSet({ + array: this.asn1Array + }); + this.TLV = b.getEncodedHex(); + return this.TLV + }; + if (typeof a != "undefined") { + if (typeof a.str != "undefined") { + this.addByMultiValuedString(a.str) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.RDN, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.RDN.parseString = function(m) { + var j = m.split(/\+/); + var h = false; + var c = []; + for (var g = 0; j.length > 0; g++) { + var k = j.shift(); + if (h === true) { + var f = c.pop(); + var d = (f + "+" + k).replace(/\\\+/g, "+"); + c.push(d); + h = false + } else { + c.push(k) + } + if (k.substr( - 1, 1) === "\\") { + h = true + } + } + var l = false; + var b = []; + for (var g = 0; c.length > 0; g++) { + var k = c.shift(); + if (l === true) { + var e = b.pop(); + if (k.match(/"$/)) { + var d = (e + "+" + k).replace(/^([^=]+)="(.*)"$/, "$1=$2"); + b.push(d); + l = false + } else { + b.push(e + "+" + k) + } + } else { + b.push(k) + } + if (k.match(/^[^=]+="/)) { + l = true + } + } + return b +}; +KJUR.asn1.x509.AttributeTypeAndValue = function(b) { + KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this); + var d = null; + var c = null; + var a = "utf8"; + this.setByString = function(f) { + var e = f.match(/^([^=]+)=(.+)$/); + if (e) { + this.setByAttrTypeAndValueStr(e[1], e[2]) + } else { + throw "malformed attrTypeAndValueStr: " + f + } + }; + this.setByAttrTypeAndValueStr = function(g, f) { + this.typeObj = KJUR.asn1.x509.OID.atype2obj(g); + var e = a; + if (g == "C") { + e = "prn" + } + this.valueObj = this.getValueObj(e, f) + }; + this.getValueObj = function(f, e) { + if (f == "utf8") { + return new KJUR.asn1.DERUTF8String({ + str: e + }) + } + if (f == "prn") { + return new KJUR.asn1.DERPrintableString({ + str: e + }) + } + if (f == "tel") { + return new KJUR.asn1.DERTeletexString({ + str: e + }) + } + if (f == "ia5") { + return new KJUR.asn1.DERIA5String({ + str: e + }) + } + throw "unsupported directory string type: type=" + f + " value=" + e + }; + this.getEncodedHex = function() { + var e = new KJUR.asn1.DERSequence({ + array: [this.typeObj, this.valueObj] + }); + this.TLV = e.getEncodedHex(); + return this.TLV + }; + if (typeof b != "undefined") { + if (typeof b.str != "undefined") { + this.setByString(b.str) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.SubjectPublicKeyInfo = function(d) { + KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this); + var b = null; + var c = null; + var a = null; + this.setRSAKey = function(e) { + if (!RSAKey.prototype.isPrototypeOf(e)) { + throw "argument is not RSAKey instance" + } + this.rsaKey = e; + var g = new KJUR.asn1.DERInteger({ + bigint: e.n + }); + var f = new KJUR.asn1.DERInteger({ + "int": e.e + }); + var i = new KJUR.asn1.DERSequence({ + array: [g, f] + }); + var h = i.getEncodedHex(); + this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: "rsaEncryption" + }); + this.asn1SubjPKey = new KJUR.asn1.DERBitString({ + hex: "00" + h + }) + }; + this.setRSAPEM = function(g) { + if (g.match(/-----BEGIN PUBLIC KEY-----/)) { + var n = g; + n = n.replace(/^-----[^-]+-----/, ""); + n = n.replace(/-----[^-]+-----\s*$/, ""); + var m = n.replace(/\s+/g, ""); + var f = CryptoJS.enc.Base64.parse(m); + var i = CryptoJS.enc.Hex.stringify(f); + var k = RSAKey.getHexValueArrayOfChildrenFromHex(i); + var h = k[1]; + var l = h.substr(2); + var e = RSAKey.getHexValueArrayOfChildrenFromHex(l); + var j = new RSAKey(); + j.setPublic(e[0], e[1]); + this.setRSAKey(j) + } else { + throw "key not supported" + } + }; + this.getASN1Object = function() { + if (this.asn1AlgId == null || this.asn1SubjPKey == null) { + throw "algId and/or subjPubKey not set" + } + var e = new KJUR.asn1.DERSequence({ + array: [this.asn1AlgId, this.asn1SubjPKey] + }); + return e + }; + this.getEncodedHex = function() { + var e = this.getASN1Object(); + this.hTLV = e.getEncodedHex(); + return this.hTLV + }; + this._setRSAKey = function(e) { + var g = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": { + bigint: e.n + } + }, + { + "int": { + "int": e.e + } + }] + }); + var f = g.getEncodedHex(); + this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: "rsaEncryption" + }); + this.asn1SubjPKey = new KJUR.asn1.DERBitString({ + hex: "00" + f + }) + }; + this._setEC = function(e) { + var f = new KJUR.asn1.DERObjectIdentifier({ + name: e.curveName + }); + this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: "ecPublicKey", + asn1params: f + }); + this.asn1SubjPKey = new KJUR.asn1.DERBitString({ + hex: "00" + e.pubKeyHex + }) + }; + this._setDSA = function(e) { + var f = new KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": { + bigint: e.p + } + }, + { + "int": { + bigint: e.q + } + }, + { + "int": { + bigint: e.g + } + }] + }); + this.asn1AlgId = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: "dsa", + asn1params: f + }); + var g = new KJUR.asn1.DERInteger({ + bigint: e.y + }); + this.asn1SubjPKey = new KJUR.asn1.DERBitString({ + hex: "00" + g.getEncodedHex() + }) + }; + if (typeof d != "undefined") { + if (typeof RSAKey != "undefined" && d instanceof RSAKey) { + this._setRSAKey(d) + } else { + if (typeof KJUR.crypto.ECDSA != "undefined" && d instanceof KJUR.crypto.ECDSA) { + this._setEC(d) + } else { + if (typeof KJUR.crypto.DSA != "undefined" && d instanceof KJUR.crypto.DSA) { + this._setDSA(d) + } else { + if (typeof d.rsakey != "undefined") { + this.setRSAKey(d.rsakey) + } else { + if (typeof d.rsapem != "undefined") { + this.setRSAPEM(d.rsapem) + } + } + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.Time = function(c) { + KJUR.asn1.x509.Time.superclass.constructor.call(this); + var b = null; + var a = null; + this.setTimeParams = function(d) { + this.timeParams = d + }; + this.getEncodedHex = function() { + var d = null; + if (this.timeParams != null) { + if (this.type == "utc") { + d = new KJUR.asn1.DERUTCTime(this.timeParams) + } else { + d = new KJUR.asn1.DERGeneralizedTime(this.timeParams) + } + } else { + if (this.type == "utc") { + d = new KJUR.asn1.DERUTCTime() + } else { + d = new KJUR.asn1.DERGeneralizedTime() + } + } + this.TLV = d.getEncodedHex(); + return this.TLV + }; + this.type = "utc"; + if (typeof c != "undefined") { + if (typeof c.type != "undefined") { + this.type = c.type + } else { + if (typeof c.str != "undefined") { + if (c.str.match(/^[0-9]{12}Z$/)) { + this.type = "utc" + } + if (c.str.match(/^[0-9]{14}Z$/)) { + this.type = "gen" + } + } + } + this.timeParams = c + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.Time, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.AlgorithmIdentifier = function(b) { + KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this); + this.nameAlg = null; + this.asn1Alg = null; + this.asn1Params = null; + this.paramEmpty = false; + this.getEncodedHex = function() { + if (this.nameAlg === null && this.asn1Alg === null) { + throw "algorithm not specified" + } + if (this.nameAlg !== null && this.asn1Alg === null) { + this.asn1Alg = KJUR.asn1.x509.OID.name2obj(this.nameAlg) + } + var c = [this.asn1Alg]; + if (this.asn1Params !== null) { + c.push(this.asn1Params) + } + var d = new KJUR.asn1.DERSequence({ + array: c + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (b !== undefined) { + if (b.name !== undefined) { + this.nameAlg = b.name + } + if (b.asn1params !== undefined) { + this.asn1Params = b.asn1params + } + if (b.paramempty !== undefined) { + this.paramEmpty = b.paramempty + } + } + if (this.asn1Params === null && this.paramEmpty === false && this.nameAlg !== null) { + var a = this.nameAlg.toLowerCase(); + if (a.substr( - 7, 7) !== "withdsa" && a.substr( - 9, 9) !== "withecdsa") { + this.asn1Params = new KJUR.asn1.DERNull() + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.GeneralName = function(d) { + KJUR.asn1.x509.GeneralName.superclass.constructor.call(this); + var c = null; + var b = null; + var a = { + rfc822: "81", + dns: "82", + dn: "a4", + uri: "86" + }; + this.explicit = false; + this.setByParam = function(k) { + var j = null; + var g = null; + if (k === undefined) { + return + } + if (k.rfc822 !== undefined) { + this.type = "rfc822"; + g = new KJUR.asn1.DERIA5String({ + str: k[this.type] + }) + } + if (k.dns !== undefined) { + this.type = "dns"; + g = new KJUR.asn1.DERIA5String({ + str: k[this.type] + }) + } + if (k.uri !== undefined) { + this.type = "uri"; + g = new KJUR.asn1.DERIA5String({ + str: k[this.type] + }) + } + if (k.dn !== undefined) { + this.type = "dn"; + g = new KJUR.asn1.x509.X500Name({ + str: k.dn + }) + } + if (k.ldapdn !== undefined) { + this.type = "dn"; + g = new KJUR.asn1.x509.X500Name({ + ldapstr: k.ldapdn + }) + } + if (k.certissuer !== undefined) { + this.type = "dn"; + this.explicit = true; + var h = k.certissuer; + var f = null; + if (h.match(/^[0-9A-Fa-f]+$/)) { + f == h + } + if (h.indexOf("-----BEGIN ") != -1) { + f = ASN1HEX.pemToHex(h) + } + if (f == null) { + throw "certissuer param not cert" + } + var e = new X509(); + e.hex = f; + var i = e.getIssuerHex(); + g = new KJUR.asn1.ASN1Object(); + g.hTLV = i + } + if (k.certsubj !== undefined) { + this.type = "dn"; + this.explicit = true; + var h = k.certsubj; + var f = null; + if (h.match(/^[0-9A-Fa-f]+$/)) { + f == h + } + if (h.indexOf("-----BEGIN ") != -1) { + f = ASN1HEX.pemToHex(h) + } + if (f == null) { + throw "certsubj param not cert" + } + var e = new X509(); + e.hex = f; + var i = e.getSubjectHex(); + g = new KJUR.asn1.ASN1Object(); + g.hTLV = i + } + if (this.type == null) { + throw "unsupported type in params=" + k + } + this.asn1Obj = new KJUR.asn1.DERTaggedObject({ + explicit: this.explicit, + tag: a[this.type], + obj: g + }) + }; + this.getEncodedHex = function() { + return this.asn1Obj.getEncodedHex() + }; + if (d !== undefined) { + this.setByParam(d) + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.GeneralName, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.GeneralNames = function(b) { + KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this); + var a = null; + this.setByParamArray = function(e) { + for (var c = 0; c < e.length; c++) { + var d = new KJUR.asn1.x509.GeneralName(e[c]); + this.asn1Array.push(d) + } + }; + this.getEncodedHex = function() { + var c = new KJUR.asn1.DERSequence({ + array: this.asn1Array + }); + return c.getEncodedHex() + }; + this.asn1Array = new Array(); + if (typeof b != "undefined") { + this.setByParamArray(b) + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.GeneralNames, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.DistributionPointName = function(b) { + KJUR.asn1.x509.DistributionPointName.superclass.constructor.call(this); + var e = null; + var c = null; + var a = null; + var d = null; + this.getEncodedHex = function() { + if (this.type != "full") { + throw "currently type shall be 'full': " + this.type + } + this.asn1Obj = new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: this.tag, + obj: this.asn1V + }); + this.hTLV = this.asn1Obj.getEncodedHex(); + return this.hTLV + }; + if (typeof b != "undefined") { + if (KJUR.asn1.x509.GeneralNames.prototype.isPrototypeOf(b)) { + this.type = "full"; + this.tag = "a0"; + this.asn1V = b + } else { + throw "This class supports GeneralNames only as argument" + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.DistributionPointName, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.DistributionPoint = function(b) { + KJUR.asn1.x509.DistributionPoint.superclass.constructor.call(this); + var a = null; + this.getEncodedHex = function() { + var c = new KJUR.asn1.DERSequence(); + if (this.asn1DP != null) { + var d = new KJUR.asn1.DERTaggedObject({ + explicit: true, + tag: "a0", + obj: this.asn1DP + }); + c.appendASN1Object(d) + } + this.hTLV = c.getEncodedHex(); + return this.hTLV + }; + if (typeof b != "undefined") { + if (typeof b.dpobj != "undefined") { + this.asn1DP = b.dpobj + } + } +}; +YAHOO.lang.extend(KJUR.asn1.x509.DistributionPoint, KJUR.asn1.ASN1Object); +KJUR.asn1.x509.OID = new +function(a) { + this.atype2oidList = { + CN: "2.5.4.3", + L: "2.5.4.7", + ST: "2.5.4.8", + O: "2.5.4.10", + OU: "2.5.4.11", + C: "2.5.4.6", + STREET: "2.5.4.9", + DC: "0.9.2342.19200300.100.1.25", + UID: "0.9.2342.19200300.100.1.1", + SN: "2.5.4.4", + DN: "2.5.4.49", + E: "1.2.840.113549.1.9.1", + businessCategory: "2.5.4.15", + postalCode: "2.5.4.17", + jurisdictionOfIncorporationL: "1.3.6.1.4.1.311.60.2.1.1", + jurisdictionOfIncorporationSP: "1.3.6.1.4.1.311.60.2.1.2", + jurisdictionOfIncorporationC: "1.3.6.1.4.1.311.60.2.1.3" + }; + this.name2oidList = { + sha1: "1.3.14.3.2.26", + sha256: "2.16.840.1.101.3.4.2.1", + sha384: "2.16.840.1.101.3.4.2.2", + sha512: "2.16.840.1.101.3.4.2.3", + sha224: "2.16.840.1.101.3.4.2.4", + md5: "1.2.840.113549.2.5", + md2: "1.3.14.7.2.2.1", + ripemd160: "1.3.36.3.2.1", + MD2withRSA: "1.2.840.113549.1.1.2", + MD4withRSA: "1.2.840.113549.1.1.3", + MD5withRSA: "1.2.840.113549.1.1.4", + SHA1withRSA: "1.2.840.113549.1.1.5", + SHA224withRSA: "1.2.840.113549.1.1.14", + SHA256withRSA: "1.2.840.113549.1.1.11", + SHA384withRSA: "1.2.840.113549.1.1.12", + SHA512withRSA: "1.2.840.113549.1.1.13", + SHA1withECDSA: "1.2.840.10045.4.1", + SHA224withECDSA: "1.2.840.10045.4.3.1", + SHA256withECDSA: "1.2.840.10045.4.3.2", + SHA384withECDSA: "1.2.840.10045.4.3.3", + SHA512withECDSA: "1.2.840.10045.4.3.4", + dsa: "1.2.840.10040.4.1", + SHA1withDSA: "1.2.840.10040.4.3", + SHA224withDSA: "2.16.840.1.101.3.4.3.1", + SHA256withDSA: "2.16.840.1.101.3.4.3.2", + rsaEncryption: "1.2.840.113549.1.1.1", + commonName: "2.5.4.3", + localityName: "2.5.4.7", + stateOrProvinceName: "2.5.4.8", + organizationName: "2.5.4.10", + organizationalUnitName: "2.5.4.11", + countryName: "2.5.4.6", + streetAddress: "2.5.4.9", + domainComponent: "0.9.2342.19200300.100.1.25", + userId: "0.9.2342.19200300.100.1.1", + surname: "2.5.4.4", + distinguishedName: "2.5.4.49", + emailAddress: "1.2.840.113549.1.9.1", + businessCategory: "2.5.4.15", + postalCode: "2.5.4.17", + jurisdictionOfIncorporationL: "1.3.6.1.4.1.311.60.2.1.1", + jurisdictionOfIncorporationSP: "1.3.6.1.4.1.311.60.2.1.2", + jurisdictionOfIncorporationC: "1.3.6.1.4.1.311.60.2.1.3", + subjectKeyIdentifier: "2.5.29.14", + keyUsage: "2.5.29.15", + subjectAltName: "2.5.29.17", + issuerAltName: "2.5.29.18", + basicConstraints: "2.5.29.19", + nameConstraints: "2.5.29.30", + cRLDistributionPoints: "2.5.29.31", + certificatePolicies: "2.5.29.32", + authorityKeyIdentifier: "2.5.29.35", + policyConstraints: "2.5.29.36", + extKeyUsage: "2.5.29.37", + authorityInfoAccess: "1.3.6.1.5.5.7.1.1", + ocsp: "1.3.6.1.5.5.7.48.1", + caIssuers: "1.3.6.1.5.5.7.48.2", + anyExtendedKeyUsage: "2.5.29.37.0", + serverAuth: "1.3.6.1.5.5.7.3.1", + clientAuth: "1.3.6.1.5.5.7.3.2", + codeSigning: "1.3.6.1.5.5.7.3.3", + emailProtection: "1.3.6.1.5.5.7.3.4", + timeStamping: "1.3.6.1.5.5.7.3.8", + ocspSigning: "1.3.6.1.5.5.7.3.9", + ecPublicKey: "1.2.840.10045.2.1", + secp256r1: "1.2.840.10045.3.1.7", + secp256k1: "1.3.132.0.10", + secp384r1: "1.3.132.0.34", + pkcs5PBES2: "1.2.840.113549.1.5.13", + pkcs5PBKDF2: "1.2.840.113549.1.5.12", + "des-EDE3-CBC": "1.2.840.113549.3.7", + data: "1.2.840.113549.1.7.1", + "signed-data": "1.2.840.113549.1.7.2", + "enveloped-data": "1.2.840.113549.1.7.3", + "digested-data": "1.2.840.113549.1.7.5", + "encrypted-data": "1.2.840.113549.1.7.6", + "authenticated-data": "1.2.840.113549.1.9.16.1.2", + tstinfo: "1.2.840.113549.1.9.16.1.4", + extensionRequest: "1.2.840.113549.1.9.14", + }; + this.objCache = {}; + this.name2obj = function(b) { + if (typeof this.objCache[b] != "undefined") { + return this.objCache[b] + } + if (typeof this.name2oidList[b] == "undefined") { + throw "Name of ObjectIdentifier not defined: " + b + } + var c = this.name2oidList[b]; + var d = new KJUR.asn1.DERObjectIdentifier({ + oid: c + }); + this.objCache[b] = d; + return d + }; + this.atype2obj = function(b) { + if (typeof this.objCache[b] != "undefined") { + return this.objCache[b] + } + if (typeof this.atype2oidList[b] == "undefined") { + throw "AttributeType name undefined: " + b + } + var c = this.atype2oidList[b]; + var d = new KJUR.asn1.DERObjectIdentifier({ + oid: c + }); + this.objCache[b] = d; + return d + } +}; +KJUR.asn1.x509.OID.oid2name = function(b) { + var c = KJUR.asn1.x509.OID.name2oidList; + for (var a in c) { + if (c[a] == b) { + return a + } + } + return "" +}; +KJUR.asn1.x509.OID.oid2atype = function(b) { + var c = KJUR.asn1.x509.OID.atype2oidList; + for (var a in c) { + if (c[a] == b) { + return a + } + } + return b +}; +KJUR.asn1.x509.OID.name2oid = function(a) { + var b = KJUR.asn1.x509.OID.name2oidList; + if (b[a] === undefined) { + return "" + } + return b[a] +}; +KJUR.asn1.x509.X509Util = new +function() { + this.getPKCS8PubKeyPEMfromRSAKey = function(i) { + var h = null; + var f = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(i.n); + var j = KJUR.asn1.ASN1Util.integerToByteHex(i.e); + var a = new KJUR.asn1.DERInteger({ + hex: f + }); + var g = new KJUR.asn1.DERInteger({ + hex: j + }); + var l = new KJUR.asn1.DERSequence({ + array: [a, g] + }); + var c = l.getEncodedHex(); + var d = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: "rsaEncryption" + }); + var b = new KJUR.asn1.DERBitString({ + hex: "00" + c + }); + var k = new KJUR.asn1.DERSequence({ + array: [d, b] + }); + var e = k.getEncodedHex(); + var h = KJUR.asn1.ASN1Util.getPEMStringFromHex(e, "PUBLIC KEY"); + return h + } +}; +KJUR.asn1.x509.X509Util.newCertPEM = function(f) { + var c = KJUR.asn1.x509; + var e = new c.TBSCertificate(); + if (f.serial !== undefined) { + e.setSerialNumberByParam(f.serial) + } else { + throw "serial number undefined." + } + if (typeof f.sigalg.name === "string") { + e.setSignatureAlgByParam(f.sigalg) + } else { + throw "unproper signature algorithm name" + } + if (f.issuer !== undefined) { + e.setIssuerByParam(f.issuer) + } else { + throw "issuer name undefined." + } + if (f.notbefore !== undefined) { + e.setNotBeforeByParam(f.notbefore) + } else { + throw "notbefore undefined." + } + if (f.notafter !== undefined) { + e.setNotAfterByParam(f.notafter) + } else { + throw "notafter undefined." + } + if (f.subject !== undefined) { + e.setSubjectByParam(f.subject) + } else { + throw "subject name undefined." + } + if (f.sbjpubkey !== undefined) { + e.setSubjectPublicKeyByGetKey(f.sbjpubkey) + } else { + throw "subject public key undefined." + } + if (f.ext !== undefined && f.ext.length !== undefined) { + for (var b = 0; b < f.ext.length; b++) { + for (key in f.ext[b]) { + e.appendExtensionByName(key, f.ext[b][key]) + } + } + } + if (f.cakey === undefined && f.sighex === undefined) { + throw "param cakey and sighex undefined." + } + var d = null; + var a = null; + if (f.cakey) { + if (f.cakey.isPrivate === true) { + d = f.cakey + } else { + d = KEYUTIL.getKey.apply(null, f.cakey) + } + a = new c.Certificate({ + tbscertobj: e, + prvkeyobj: d + }); + a.sign() + } + if (f.sighex) { + a = new c.Certificate({ + tbscertobj: e + }); + a.setSignatureHex(f.sighex) + } + return a.getPEMString() +}; +/*! asn1cms-1.0.3.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +if (typeof KJUR.asn1.cms == "undefined" || !KJUR.asn1.cms) { + KJUR.asn1.cms = {} +} +KJUR.asn1.cms.Attribute = function(b) { + KJUR.asn1.cms.Attribute.superclass.constructor.call(this); + var a = []; + this.getEncodedHex = function() { + var f, e, c; + f = new KJUR.asn1.DERObjectIdentifier({ + oid: this.attrTypeOid + }); + e = new KJUR.asn1.DERSet({ + array: this.valueList + }); + try { + e.getEncodedHex() + } catch(d) { + throw "fail valueSet.getEncodedHex in Attribute(1)/" + d + } + c = new KJUR.asn1.DERSequence({ + array: [f, e] + }); + try { + this.hTLV = c.getEncodedHex() + } catch(d) { + throw "failed seq.getEncodedHex in Attribute(2)/" + d + } + return this.hTLV + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.Attribute, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.ContentType = function(b) { + KJUR.asn1.cms.ContentType.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.3"; + var a = null; + if (typeof b != "undefined") { + var a = new KJUR.asn1.DERObjectIdentifier(b); + this.valueList = [a] + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.ContentType, KJUR.asn1.cms.Attribute); +KJUR.asn1.cms.MessageDigest = function(e) { + KJUR.asn1.cms.MessageDigest.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.4"; + if (typeof e != "undefined") { + if (e.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo && typeof e.hashAlg == "string") { + var b = e.eciObj.eContentValueHex; + var a = e.hashAlg; + var c = KJUR.crypto.Util.hashHex(b, a); + var d = new KJUR.asn1.DEROctetString({ + hex: c + }); + d.getEncodedHex(); + this.valueList = [d] + } else { + var d = new KJUR.asn1.DEROctetString(e); + d.getEncodedHex(); + this.valueList = [d] + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.MessageDigest, KJUR.asn1.cms.Attribute); +KJUR.asn1.cms.SigningTime = function(c) { + KJUR.asn1.cms.SigningTime.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.5"; + if (typeof c != "undefined") { + var a = new KJUR.asn1.x509.Time(c); + try { + a.getEncodedHex() + } catch(b) { + throw "SigningTime.getEncodedHex() failed/" + b + } + this.valueList = [a] + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.SigningTime, KJUR.asn1.cms.Attribute); +KJUR.asn1.cms.SigningCertificate = function(d) { + KJUR.asn1.cms.SigningCertificate.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.12"; + var a = KJUR.asn1; + var c = KJUR.asn1.cms; + var b = KJUR.crypto; + this.setCerts = function(l) { + var j = []; + for (var h = 0; h < l.length; h++) { + var f = ASN1HEX.pemToHex(l[h]); + var e = b.Util.hashHex(f, "sha1"); + var m = new a.DEROctetString({ + hex: e + }); + m.getEncodedHex(); + var k = new c.IssuerAndSerialNumber({ + cert: l[h] + }); + k.getEncodedHex(); + var n = new a.DERSequence({ + array: [m, k] + }); + n.getEncodedHex(); + j.push(n) + } + var g = new a.DERSequence({ + array: j + }); + g.getEncodedHex(); + this.valueList = [g] + }; + if (typeof d != "undefined") { + if (typeof d.array == "object") { + this.setCerts(d.array) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificate, KJUR.asn1.cms.Attribute); +KJUR.asn1.cms.SigningCertificateV2 = function(e) { + KJUR.asn1.cms.SigningCertificateV2.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.47"; + var b = KJUR.asn1; + var f = KJUR.asn1.x509; + var d = KJUR.asn1.cms; + var c = KJUR.crypto; + this.setCerts = function(p, h) { + var n = []; + for (var l = 0; l < p.length; l++) { + var j = ASN1HEX.pemToHex(p[l]); + var r = []; + if (h != "sha256") { + r.push(new f.AlgorithmIdentifier({ + name: h + })) + } + var g = c.Util.hashHex(j, h); + var q = new b.DEROctetString({ + hex: g + }); + q.getEncodedHex(); + r.push(q); + var m = new d.IssuerAndSerialNumber({ + cert: p[l] + }); + m.getEncodedHex(); + r.push(m); + var o = new b.DERSequence({ + array: r + }); + o.getEncodedHex(); + n.push(o) + } + var k = new b.DERSequence({ + array: n + }); + k.getEncodedHex(); + this.valueList = [k] + }; + if (typeof e != "undefined") { + if (typeof e.array == "object") { + var a = "sha256"; + if (typeof e.hashAlg == "string") { + a = e.hashAlg + } + this.setCerts(e.array, a) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.SigningCertificateV2, KJUR.asn1.cms.Attribute); +KJUR.asn1.cms.IssuerAndSerialNumber = function(c) { + KJUR.asn1.cms.IssuerAndSerialNumber.superclass.constructor.call(this); + var e = null; + var b = null; + var a = KJUR.asn1; + var d = a.x509; + this.setByCertPEM = function(i) { + var g = ASN1HEX.pemToHex(i); + var f = new X509(); + f.hex = g; + var j = f.getIssuerHex(); + this.dIssuer = new d.X500Name(); + this.dIssuer.hTLV = j; + var h = f.getSerialNumberHex(); + this.dSerial = new a.DERInteger({ + hex: h + }) + }; + this.getEncodedHex = function() { + var f = new KJUR.asn1.DERSequence({ + array: [this.dIssuer, this.dSerial] + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (typeof c == "string" && c.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(c) + } + if (c.issuer && c.serial) { + if (c.issuer instanceof KJUR.asn1.x509.X500Name) { + this.dIssuer = c.issuer + } else { + this.dIssuer = new KJUR.asn1.x509.X500Name(c.issuer) + } + if (c.serial instanceof KJUR.asn1.DERInteger) { + this.dSerial = c.serial + } else { + this.dSerial = new KJUR.asn1.DERInteger(c.serial) + } + } + if (typeof c.cert == "string") { + this.setByCertPEM(c.cert) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.IssuerAndSerialNumber, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.AttributeList = function(a) { + KJUR.asn1.cms.AttributeList.superclass.constructor.call(this); + this.list = new Array(); + this.sortFlag = true; + this.add = function(b) { + if (b instanceof KJUR.asn1.cms.Attribute) { + this.list.push(b) + } + }; + this.length = function() { + return this.list.length + }; + this.clear = function() { + this.list = new Array(); + this.hTLV = null; + this.hV = null + }; + this.getEncodedHex = function() { + if (typeof this.hTLV == "string") { + return this.hTLV + } + var b = new KJUR.asn1.DERSet({ + array: this.list, + sortflag: this.sortFlag + }); + this.hTLV = b.getEncodedHex(); + return this.hTLV + }; + if (typeof a != "undefined") { + if (typeof a.sortflag != "undefined" && a.sortflag == false) { + this.sortFlag = false + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.AttributeList, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.SignerInfo = function(c) { + KJUR.asn1.cms.SignerInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.cms; + var d = KJUR.asn1.x509; + this.dCMSVersion = new a.DERInteger({ + "int": 1 + }); + this.dSignerIdentifier = null; + this.dDigestAlgorithm = null; + this.dSignedAttrs = new b.AttributeList(); + this.dSigAlg = null; + this.dSig = null; + this.dUnsignedAttrs = new b.AttributeList(); + this.setSignerIdentifier = function(f) { + if (typeof f == "string" && f.indexOf("CERTIFICATE") != -1 && f.indexOf("BEGIN") != -1 && f.indexOf("END") != -1) { + var e = f; + this.dSignerIdentifier = new b.IssuerAndSerialNumber({ + cert: f + }) + } + }; + this.setForContentAndHash = function(e) { + if (typeof e != "undefined") { + if (e.eciObj instanceof KJUR.asn1.cms.EncapsulatedContentInfo) { + this.dSignedAttrs.add(new b.ContentType({ + oid: "1.2.840.113549.1.7.1" + })); + this.dSignedAttrs.add(new b.MessageDigest({ + eciObj: e.eciObj, + hashAlg: e.hashAlg + })) + } + if (typeof e.sdObj != "undefined" && e.sdObj instanceof KJUR.asn1.cms.SignedData) { + if (e.sdObj.digestAlgNameList.join(":").indexOf(e.hashAlg) == -1) { + e.sdObj.digestAlgNameList.push(e.hashAlg) + } + } + if (typeof e.hashAlg == "string") { + this.dDigestAlgorithm = new d.AlgorithmIdentifier({ + name: e.hashAlg + }) + } + } + }; + this.sign = function(j, f) { + this.dSigAlg = new d.AlgorithmIdentifier({ + name: f + }); + var g = this.dSignedAttrs.getEncodedHex(); + var e = KEYUTIL.getKey(j); + var i = new KJUR.crypto.Signature({ + alg: f + }); + i.init(e); + i.updateHex(g); + var h = i.sign(); + this.dSig = new a.DEROctetString({ + hex: h + }) + }; + this.addUnsigned = function(e) { + this.hTLV = null; + this.dUnsignedAttrs.hTLV = null; + this.dUnsignedAttrs.add(e) + }; + this.getEncodedHex = function() { + if (this.dSignedAttrs instanceof KJUR.asn1.cms.AttributeList && this.dSignedAttrs.length() == 0) { + throw "SignedAttrs length = 0 (empty)" + } + var e = new a.DERTaggedObject({ + obj: this.dSignedAttrs, + tag: "a0", + explicit: false + }); + var h = null; + if (this.dUnsignedAttrs.length() > 0) { + h = new a.DERTaggedObject({ + obj: this.dUnsignedAttrs, + tag: "a1", + explicit: false + }) + } + var g = [this.dCMSVersion, this.dSignerIdentifier, this.dDigestAlgorithm, e, this.dSigAlg, this.dSig, ]; + if (h != null) { + g.push(h) + } + var f = new a.DERSequence({ + array: g + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.EncapsulatedContentInfo = function(c) { + KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.cms; + var d = KJUR.asn1.x509; + this.dEContentType = new a.DERObjectIdentifier({ + name: "data" + }); + this.dEContent = null; + this.isDetached = false; + this.eContentValueHex = null; + this.setContentType = function(e) { + if (e.match(/^[0-2][.][0-9.]+$/)) { + this.dEContentType = new a.DERObjectIdentifier({ + oid: e + }) + } else { + this.dEContentType = new a.DERObjectIdentifier({ + name: e + }) + } + }; + this.setContentValue = function(e) { + if (typeof e != "undefined") { + if (typeof e.hex == "string") { + this.eContentValueHex = e.hex + } else { + if (typeof e.str == "string") { + this.eContentValueHex = utf8tohex(e.str) + } + } + } + }; + this.setContentValueHex = function(e) { + this.eContentValueHex = e + }; + this.setContentValueStr = function(e) { + this.eContentValueHex = utf8tohex(e) + }; + this.getEncodedHex = function() { + if (typeof this.eContentValueHex != "string") { + throw "eContentValue not yet set" + } + var g = new a.DEROctetString({ + hex: this.eContentValueHex + }); + this.dEContent = new a.DERTaggedObject({ + obj: g, + tag: "a0", + explicit: true + }); + var e = [this.dEContentType]; + if (!this.isDetached) { + e.push(this.dEContent) + } + var f = new a.DERSequence({ + array: e + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.ContentInfo = function(c) { + KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.cms; + var d = KJUR.asn1.x509; + this.dContentType = null; + this.dContent = null; + this.setContentType = function(e) { + if (typeof e == "string") { + this.dContentType = d.OID.name2obj(e) + } + }; + this.getEncodedHex = function() { + var f = new a.DERTaggedObject({ + obj: this.dContent, + tag: "a0", + explicit: true + }); + var e = new a.DERSequence({ + array: [this.dContentType, f] + }); + this.hTLV = e.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (c.type) { + this.setContentType(c.type) + } + if (c.obj && c.obj instanceof a.ASN1Object) { + this.dContent = c.obj + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.SignedData = function(c) { + KJUR.asn1.cms.SignedData.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.cms; + var d = KJUR.asn1.x509; + this.dCMSVersion = new a.DERInteger({ + "int": 1 + }); + this.dDigestAlgs = null; + this.digestAlgNameList = []; + this.dEncapContentInfo = new b.EncapsulatedContentInfo(); + this.dCerts = null; + this.certificateList = []; + this.crlList = []; + this.signerInfoList = [new b.SignerInfo()]; + this.addCertificatesByPEM = function(e) { + var f = ASN1HEX.pemToHex(e); + var g = new a.ASN1Object(); + g.hTLV = f; + this.certificateList.push(g) + }; + this.getEncodedHex = function() { + if (typeof this.hTLV == "string") { + return this.hTLV + } + if (this.dDigestAlgs == null) { + var k = []; + for (var j = 0; j < this.digestAlgNameList.length; j++) { + var h = this.digestAlgNameList[j]; + var m = new d.AlgorithmIdentifier({ + name: h + }); + k.push(m) + } + this.dDigestAlgs = new a.DERSet({ + array: k + }) + } + var e = [this.dCMSVersion, this.dDigestAlgs, this.dEncapContentInfo]; + if (this.dCerts == null) { + if (this.certificateList.length > 0) { + var l = new a.DERSet({ + array: this.certificateList + }); + this.dCerts = new a.DERTaggedObject({ + obj: l, + tag: "a0", + explicit: false + }) + } + } + if (this.dCerts != null) { + e.push(this.dCerts) + } + var g = new a.DERSet({ + array: this.signerInfoList + }); + e.push(g); + var f = new a.DERSequence({ + array: e + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + }; + this.getContentInfo = function() { + this.getEncodedHex(); + var e = new b.ContentInfo({ + type: "signed-data", + obj: this + }); + return e + }; + this.getContentInfoEncodedHex = function() { + var e = this.getContentInfo(); + var f = e.getEncodedHex(); + return f + }; + this.getPEM = function() { + var e = this.getContentInfoEncodedHex(); + var f = a.ASN1Util.getPEMStringFromHex(e, "CMS"); + return f + } +}; +YAHOO.lang.extend(KJUR.asn1.cms.SignedData, KJUR.asn1.ASN1Object); +KJUR.asn1.cms.CMSUtil = new +function() {}; +KJUR.asn1.cms.CMSUtil.newSignedData = function(a) { + var h = KJUR.asn1.cms; + var g = KJUR.asn1.cades; + var f = new h.SignedData(); + f.dEncapContentInfo.setContentValue(a.content); + if (typeof a.certs == "object") { + for (var b = 0; b < a.certs.length; b++) { + f.addCertificatesByPEM(a.certs[b]) + } + } + f.signerInfoList = []; + for (var b = 0; b < a.signerInfos.length; b++) { + var d = a.signerInfos[b]; + var c = new h.SignerInfo(); + c.setSignerIdentifier(d.signerCert); + c.setForContentAndHash({ + sdObj: f, + eciObj: f.dEncapContentInfo, + hashAlg: d.hashAlg + }); + for (attrName in d.sAttr) { + var j = d.sAttr[attrName]; + if (attrName == "SigningTime") { + var e = new h.SigningTime(j); + c.dSignedAttrs.add(e) + } + if (attrName == "SigningCertificate") { + var e = new h.SigningCertificate(j); + c.dSignedAttrs.add(e) + } + if (attrName == "SigningCertificateV2") { + var e = new h.SigningCertificateV2(j); + c.dSignedAttrs.add(e) + } + if (attrName == "SignaturePolicyIdentifier") { + var e = new g.SignaturePolicyIdentifier(j); + c.dSignedAttrs.add(e) + } + } + c.sign(d.signerPrvKey, d.sigAlg); + f.signerInfoList.push(c) + } + return f +}; +/*! asn1tsp-1.0.1.js (c) 2014 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +if (typeof KJUR.asn1.tsp == "undefined" || !KJUR.asn1.tsp) { + KJUR.asn1.tsp = {} +} +KJUR.asn1.tsp.Accuracy = function(b) { + KJUR.asn1.tsp.Accuracy.superclass.constructor.call(this); + var a = KJUR.asn1; + this.seconds = null; + this.millis = null; + this.micros = null; + this.getEncodedHex = function() { + var e = null; + var g = null; + var i = null; + var c = []; + if (this.seconds != null) { + e = new a.DERInteger({ + "int": this.seconds + }); + c.push(e) + } + if (this.millis != null) { + var h = new a.DERInteger({ + "int": this.millis + }); + g = new a.DERTaggedObject({ + obj: h, + tag: "80", + explicit: false + }); + c.push(g) + } + if (this.micros != null) { + var f = new a.DERInteger({ + "int": this.micros + }); + i = new a.DERTaggedObject({ + obj: f, + tag: "81", + explicit: false + }); + c.push(i) + } + var d = new a.DERSequence({ + array: c + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (typeof b != "undefined") { + if (typeof b.seconds == "number") { + this.seconds = b.seconds + } + if (typeof b.millis == "number") { + this.millis = b.millis + } + if (typeof b.micros == "number") { + this.micros = b.micros + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.Accuracy, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.MessageImprint = function(b) { + KJUR.asn1.tsp.MessageImprint.superclass.constructor.call(this); + var a = KJUR.asn1; + var c = KJUR.asn1.x509; + this.dHashAlg = null; + this.dHashValue = null; + this.getEncodedHex = function() { + if (typeof this.hTLV == "string") { + return this.hTLV + } + var d = new a.DERSequence({ + array: [this.dHashAlg, this.dHashValue] + }); + return d.getEncodedHex() + }; + if (typeof b != "undefined") { + if (typeof b.hashAlg == "string") { + this.dHashAlg = new c.AlgorithmIdentifier({ + name: b.hashAlg + }) + } + if (typeof b.hashValue == "string") { + this.dHashValue = new a.DEROctetString({ + hex: b.hashValue + }) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.MessageImprint, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.TimeStampReq = function(c) { + KJUR.asn1.tsp.TimeStampReq.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.tsp; + this.dVersion = new a.DERInteger({ + "int": 1 + }); + this.dMessageImprint = null; + this.dPolicy = null; + this.dNonce = null; + this.certReq = true; + this.setMessageImprint = function(d) { + if (d instanceof KJUR.asn1.tsp.MessageImprint) { + this.dMessageImprint = d; + return + } + if (typeof d == "object") { + this.dMessageImprint = new b.MessageImprint(d) + } + }; + this.getEncodedHex = function() { + if (this.dMessageImprint == null) { + throw "messageImprint shall be specified" + } + var d = [this.dVersion, this.dMessageImprint]; + if (this.dPolicy != null) { + d.push(this.dPolicy) + } + if (this.dNonce != null) { + d.push(this.dNonce) + } + if (this.certReq) { + d.push(new a.DERBoolean()) + } + var e = new a.DERSequence({ + array: d + }); + this.hTLV = e.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (typeof c.mi == "object") { + this.setMessageImprint(c.mi) + } + if (typeof c.policy == "object") { + this.dPolicy = new a.DERObjectIdentifier(c.policy) + } + if (typeof c.nonce == "object") { + this.dNonce = new a.DERInteger(c.nonce) + } + if (typeof c.certreq == "boolean") { + this.certReq = c.certreq + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampReq, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.TSTInfo = function(c) { + KJUR.asn1.tsp.TSTInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var d = KJUR.asn1.x509; + var b = KJUR.asn1.tsp; + this.dVersion = new a.DERInteger({ + "int": 1 + }); + this.dPolicy = null; + this.dMessageImprint = null; + this.dSerialNumber = null; + this.dGenTime = null; + this.dAccuracy = null; + this.dOrdering = null; + this.dNonce = null; + this.dTsa = null; + this.getEncodedHex = function() { + var e = [this.dVersion]; + if (this.dPolicy == null) { + throw "policy shall be specified." + } + e.push(this.dPolicy); + if (this.dMessageImprint == null) { + throw "messageImprint shall be specified." + } + e.push(this.dMessageImprint); + if (this.dSerialNumber == null) { + throw "serialNumber shall be specified." + } + e.push(this.dSerialNumber); + if (this.dGenTime == null) { + throw "genTime shall be specified." + } + e.push(this.dGenTime); + if (this.dAccuracy != null) { + e.push(this.dAccuracy) + } + if (this.dOrdering != null) { + e.push(this.dOrdering) + } + if (this.dNonce != null) { + e.push(this.dNonce) + } + if (this.dTsa != null) { + e.push(this.dTsa) + } + var f = new a.DERSequence({ + array: e + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (typeof c.policy == "string") { + if (!c.policy.match(/^[0-9.]+$/)) { + throw "policy shall be oid like 0.1.4.134" + } + this.dPolicy = new a.DERObjectIdentifier({ + oid: c.policy + }) + } + if (typeof c.messageImprint != "undefined") { + this.dMessageImprint = new b.MessageImprint(c.messageImprint) + } + if (typeof c.serialNumber != "undefined") { + this.dSerialNumber = new a.DERInteger(c.serialNumber) + } + if (typeof c.genTime != "undefined") { + this.dGenTime = new a.DERGeneralizedTime(c.genTime) + } + if (typeof c.accuracy != "undefind") { + this.dAccuracy = new b.Accuracy(c.accuracy) + } + if (typeof c.ordering != "undefined" && c.ordering == true) { + this.dOrdering = new a.DERBoolean() + } + if (typeof c.nonce != "undefined") { + this.dNonce = new a.DERInteger(c.nonce) + } + if (typeof c.tsa != "undefined") { + this.dTsa = new d.X500Name(c.tsa) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.TSTInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.TimeStampResp = function(c) { + KJUR.asn1.tsp.TimeStampResp.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.tsp; + this.dStatus = null; + this.dTST = null; + this.getEncodedHex = function() { + if (this.dStatus == null) { + throw "status shall be specified" + } + var d = [this.dStatus]; + if (this.dTST != null) { + d.push(this.dTST) + } + var e = new a.DERSequence({ + array: d + }); + this.hTLV = e.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (typeof c.status == "object") { + this.dStatus = new b.PKIStatusInfo(c.status) + } + if (typeof c.tst != "undefined" && c.tst instanceof KJUR.asn1.ASN1Object) { + this.dTST = c.tst.getContentInfo() + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.TimeStampResp, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.PKIStatusInfo = function(c) { + KJUR.asn1.tsp.PKIStatusInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.tsp; + this.dStatus = null; + this.dStatusString = null; + this.dFailureInfo = null; + this.getEncodedHex = function() { + if (this.dStatus == null) { + throw "status shall be specified" + } + var d = [this.dStatus]; + if (this.dStatusString != null) { + d.push(this.dStatusString) + } + if (this.dFailureInfo != null) { + d.push(this.dFailureInfo) + } + var e = new a.DERSequence({ + array: d + }); + this.hTLV = e.getEncodedHex(); + return this.hTLV + }; + if (typeof c != "undefined") { + if (typeof c.status == "object") { + this.dStatus = new b.PKIStatus(c.status) + } + if (typeof c.statstr == "object") { + this.dStatusString = new b.PKIFreeText({ + array: c.statstr + }) + } + if (typeof c.failinfo == "object") { + this.dFailureInfo = new b.PKIFailureInfo(c.failinfo) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatusInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.PKIStatus = function(e) { + KJUR.asn1.tsp.PKIStatus.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.tsp; + var d = null; + this.getEncodedHex = function() { + this.hTLV = this.dStatus.getEncodedHex(); + return this.hTLV + }; + if (typeof e != "undefined") { + if (typeof e.name != "undefined") { + var c = b.PKIStatus.valueList; + if (typeof c[e.name] == "undefined") { + throw "name undefined: " + e.name + } + this.dStatus = new a.DERInteger({ + "int": c[e.name] + }) + } else { + this.dStatus = new a.DERInteger(e) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.PKIStatus, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.PKIStatus.valueList = { + granted: 0, + grantedWithMods: 1, + rejection: 2, + waiting: 3, + revocationWarning: 4, + revocationNotification: 5 +}; +KJUR.asn1.tsp.PKIFreeText = function(b) { + KJUR.asn1.tsp.PKIFreeText.superclass.constructor.call(this); + var a = KJUR.asn1; + this.textList = []; + this.getEncodedHex = function() { + var c = []; + for (var e = 0; e < this.textList.length; e++) { + c.push(new a.DERUTF8String({ + str: this.textList[e] + })) + } + var d = new a.DERSequence({ + array: c + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (typeof b != "undefined") { + if (typeof b.array == "object") { + this.textList = b.array + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.PKIFreeText, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.PKIFailureInfo = function(d) { + KJUR.asn1.tsp.PKIFailureInfo.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.tsp; + this.value = null; + this.getEncodedHex = function() { + if (this.value == null) { + throw "value shall be specified" + } + var e = new Number(this.value).toString(2); + var f = new a.DERBitString(); + f.setByBinaryString(e); + this.hTLV = f.getEncodedHex(); + return this.hTLV + }; + if (typeof d != "undefined") { + if (typeof d.name == "string") { + var c = b.PKIFailureInfo.valueList; + if (typeof c[d.name] == "undefined") { + throw "name undefined: " + d.name + } + this.value = c[d.name] + } else { + if (typeof d["int"] == "number") { + this.value = d["int"] + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.PKIFailureInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.tsp.PKIFailureInfo.valueList = { + badAlg: 0, + badRequest: 2, + badDataFormat: 5, + timeNotAvailable: 14, + unacceptedPolicy: 15, + unacceptedExtension: 16, + addInfoNotAvailable: 17, + systemFailure: 25 +}; +KJUR.asn1.tsp.AbstractTSAAdapter = function(a) { + this.getTSTHex = function(c, b) { + throw "not implemented yet" + } +}; +KJUR.asn1.tsp.SimpleTSAAdapter = function(a) { + KJUR.asn1.tsp.SimpleTSAAdapter.superclass.constructor.call(this); + this.params = null; + this.serial = 0; + this.getTSTHex = function(c, b) { + var e = KJUR.crypto.Util.hashHex(c, b); + this.params.tstInfo.messageImprint = { + hashAlg: b, + hashValue: e + }; + this.params.tstInfo.serialNumber = { + "int": this.serial++ + }; + var d = Math.floor(Math.random() * 1000000000); + this.params.tstInfo.nonce = { + "int": d + }; + var f = KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); + return f.getContentInfoEncodedHex() + }; + if (typeof a != "undefined") { + this.params = a + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.SimpleTSAAdapter, KJUR.asn1.tsp.AbstractTSAAdapter); +KJUR.asn1.tsp.FixedTSAAdapter = function(a) { + KJUR.asn1.tsp.FixedTSAAdapter.superclass.constructor.call(this); + this.params = null; + this.getTSTHex = function(c, b) { + var d = KJUR.crypto.Util.hashHex(c, b); + this.params.tstInfo.messageImprint = { + hashAlg: b, + hashValue: d + }; + var e = KJUR.asn1.tsp.TSPUtil.newTimeStampToken(this.params); + return e.getContentInfoEncodedHex() + }; + if (typeof a != "undefined") { + this.params = a + } +}; +YAHOO.lang.extend(KJUR.asn1.tsp.FixedTSAAdapter, KJUR.asn1.tsp.AbstractTSAAdapter); +KJUR.asn1.tsp.TSPUtil = new +function() {}; +KJUR.asn1.tsp.TSPUtil.newTimeStampToken = function(b) { + var j = KJUR.asn1.cms; + var a = KJUR.asn1.tsp; + var g = new j.SignedData(); + var e = new a.TSTInfo(b.tstInfo); + var f = e.getEncodedHex(); + g.dEncapContentInfo.setContentValue({ + hex: f + }); + g.dEncapContentInfo.setContentType("tstinfo"); + if (typeof b.certs == "object") { + for (var c = 0; c < b.certs.length; c++) { + g.addCertificatesByPEM(b.certs[c]) + } + } + var d = g.signerInfoList[0]; + d.setSignerIdentifier(b.signerCert); + d.setForContentAndHash({ + sdObj: g, + eciObj: g.dEncapContentInfo, + hashAlg: b.hashAlg + }); + var h = new j.SigningCertificate({ + array: [b.signerCert] + }); + d.dSignedAttrs.add(h); + d.sign(b.signerPrvKey, b.sigAlg); + return g +}; +KJUR.asn1.tsp.TSPUtil.parseTimeStampReq = function(d) { + var f = {}; + f.certreq = false; + var h = ASN1HEX.getPosArrayOfChildren_AtObj(d, 0); + if (h.length < 2) { + throw "TimeStampReq must have at least 2 items" + } + var c = ASN1HEX.getHexOfTLV_AtObj(d, h[1]); + f.mi = KJUR.asn1.tsp.TSPUtil.parseMessageImprint(c); + for (var e = 2; e < h.length; e++) { + var b = h[e]; + var a = d.substr(b, 2); + if (a == "06") { + var g = ASN1HEX.getHexOfV_AtObj(d, b); + f.policy = ASN1HEX.hextooidstr(g) + } + if (a == "02") { + f.nonce = ASN1HEX.getHexOfV_AtObj(d, b) + } + if (a == "01") { + f.certreq = true + } + } + return f +}; +KJUR.asn1.tsp.TSPUtil.parseMessageImprint = function(c) { + var h = {}; + if (c.substr(0, 2) != "30") { + throw "head of messageImprint hex shall be '30'" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(c, 0); + var i = ASN1HEX.getDecendantIndexByNthList(c, 0, [0, 0]); + var d = ASN1HEX.getHexOfV_AtObj(c, i); + var e = ASN1HEX.hextooidstr(d); + var g = KJUR.asn1.x509.OID.oid2name(e); + if (g == "") { + throw "hashAlg name undefined: " + e + } + var b = g; + var f = ASN1HEX.getDecendantIndexByNthList(c, 0, [1]); + h.hashAlg = b; + h.hashValue = ASN1HEX.getHexOfV_AtObj(c, f); + return h +}; +/*! asn1cades-1.0.1.js (c) 2014-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +if (typeof KJUR.asn1.cades == "undefined" || !KJUR.asn1.cades) { + KJUR.asn1.cades = {} +} +KJUR.asn1.cades.SignaturePolicyIdentifier = function(e) { + KJUR.asn1.cades.SignaturePolicyIdentifier.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.15"; + var b = KJUR.asn1; + var d = KJUR.asn1.cades; + if (typeof e != "undefined") { + if (typeof e.oid == "string" && typeof e.hash == "object") { + var f = new b.DERObjectIdentifier({ + oid: e.oid + }); + var a = new d.OtherHashAlgAndValue(e.hash); + var c = new b.DERSequence({ + array: [f, a] + }); + this.valueList = [c] + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.SignaturePolicyIdentifier, KJUR.asn1.cms.Attribute); +KJUR.asn1.cades.OtherHashAlgAndValue = function(b) { + KJUR.asn1.cades.OtherHashAlgAndValue.superclass.constructor.call(this); + var a = KJUR.asn1; + var c = KJUR.asn1.x509; + this.dAlg = null; + this.dHash = null; + this.getEncodedHex = function() { + var d = new a.DERSequence({ + array: [this.dAlg, this.dHash] + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (typeof b != "undefined") { + if (typeof b.alg == "string" && typeof b.hash == "string") { + this.dAlg = new c.AlgorithmIdentifier({ + name: b.alg + }); + this.dHash = new a.DEROctetString({ + hex: b.hash + }) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherHashAlgAndValue, KJUR.asn1.ASN1Object); +KJUR.asn1.cades.SignatureTimeStamp = function(c) { + KJUR.asn1.cades.SignatureTimeStamp.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.14"; + this.tstHex = null; + var a = KJUR.asn1; + if (typeof c != "undefined") { + if (typeof c.res != "undefined") { + if (typeof c.res == "string" && c.res.match(/^[0-9A-Fa-f]+$/)) {} else { + if (c.res instanceof KJUR.asn1.ASN1Object) {} else { + throw "res param shall be ASN1Object or hex string" + } + } + } + if (typeof c.tst != "undefined") { + if (typeof c.tst == "string" && c.tst.match(/^[0-9A-Fa-f]+$/)) { + var b = new a.ASN1Object(); + this.tstHex = c.tst; + b.hTLV = this.tstHex; + b.getEncodedHex(); + this.valueList = [b] + } else { + if (c.tst instanceof KJUR.asn1.ASN1Object) {} else { + throw "tst param shall be ASN1Object or hex string" + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.SignatureTimeStamp, KJUR.asn1.cms.Attribute); +KJUR.asn1.cades.CompleteCertificateRefs = function(c) { + KJUR.asn1.cades.CompleteCertificateRefs.superclass.constructor.call(this); + this.attrTypeOid = "1.2.840.113549.1.9.16.2.21"; + var a = KJUR.asn1; + var b = KJUR.asn1.cades; + this.setByArray = function(d) { + this.valueList = []; + for (var e = 0; e < d.length; e++) { + var f = new b.OtherCertID(d[e]); + this.valueList.push(f) + } + }; + if (typeof c != "undefined") { + if (typeof c == "object" && typeof c.length == "number") { + this.setByArray(c) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.CompleteCertificateRefs, KJUR.asn1.cms.Attribute); +KJUR.asn1.cades.OtherCertID = function(d) { + KJUR.asn1.cades.OtherCertID.superclass.constructor.call(this); + var a = KJUR.asn1; + var c = KJUR.asn1.cms; + var b = KJUR.asn1.cades; + this.hasIssuerSerial = true; + this.dOtherCertHash = null; + this.dIssuerSerial = null; + this.setByCertPEM = function(e) { + this.dOtherCertHash = new b.OtherHash(e); + if (this.hasIssuerSerial) { + this.dIssuerSerial = new c.IssuerAndSerialNumber(e) + } + }; + this.getEncodedHex = function() { + if (this.hTLV != null) { + return this.hTLV + } + if (this.dOtherCertHash == null) { + throw "otherCertHash not set" + } + var e = [this.dOtherCertHash]; + if (this.dIssuerSerial != null) { + e.push(this.dIssuerSerial) + } + var f = new a.DERSequence({ + array: e + }); + this.hTLV = f.getEncodedHex(); + return this.hTLV + }; + if (typeof d != "undefined") { + if (typeof d == "string" && d.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(d) + } + if (typeof d == "object") { + if (d.hasis === false) { + this.hasIssuerSerial = false + } + if (typeof d.cert == "string") { + this.setByCertPEM(d.cert) + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherCertID, KJUR.asn1.ASN1Object); +KJUR.asn1.cades.OtherHash = function(c) { + KJUR.asn1.cades.OtherHash.superclass.constructor.call(this); + var a = KJUR.asn1; + var b = KJUR.asn1.cades; + this.alg = "sha256"; + this.dOtherHash = null; + this.setByCertPEM = function(d) { + if (d.indexOf("-----BEGIN ") == -1) { + throw "certPEM not to seem PEM format" + } + var e = ASN1HEX.pemToHex(d); + var f = KJUR.crypto.Util.hashHex(e, this.alg); + this.dOtherHash = new b.OtherHashAlgAndValue({ + alg: this.alg, + hash: f + }) + }; + this.getEncodedHex = function() { + if (this.dOtherHash == null) { + throw "OtherHash not set" + } + return this.dOtherHash.getEncodedHex() + }; + if (typeof c != "undefined") { + if (typeof c == "string") { + if (c.indexOf("-----BEGIN ") != -1) { + this.setByCertPEM(c) + } else { + if (c.match(/^[0-9A-Fa-f]+$/)) { + this.dOtherHash = new a.DEROctetString({ + hex: c + }) + } else { + throw "unsupported string value for params" + } + } + } else { + if (typeof c == "object") { + if (typeof c.cert == "string") { + if (typeof c.alg == "string") { + this.alg = c.alg + } + this.setByCertPEM(c.cert) + } else { + this.dOtherHash = new b.OtherHashAlgAndValue(c) + } + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.cades.OtherHash, KJUR.asn1.ASN1Object); +KJUR.asn1.cades.CAdESUtil = new +function() {}; +KJUR.asn1.cades.CAdESUtil.addSigTS = function(c, b, a) {}; +KJUR.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned = function(d) { + var q = KJUR.asn1; + var p = KJUR.asn1.cms; + var c = KJUR.asn1.cades.CAdESUtil; + var a = {}; + if (ASN1HEX.getDecendantHexTLVByNthList(d, 0, [0]) != "06092a864886f70d010702") { + throw "hex is not CMS SignedData" + } + var s = ASN1HEX.getDecendantIndexByNthList(d, 0, [1, 0]); + var b = ASN1HEX.getPosArrayOfChildren_AtObj(d, s); + if (b.length < 4) { + throw "num of SignedData elem shall be 4 at least" + } + var f = b.shift(); + a.version = ASN1HEX.getHexOfTLV_AtObj(d, f); + var l = b.shift(); + a.algs = ASN1HEX.getHexOfTLV_AtObj(d, l); + var m = b.shift(); + a.encapcontent = ASN1HEX.getHexOfTLV_AtObj(d, m); + a.certs = null; + a.revs = null; + a.si = []; + var n = b.shift(); + if (d.substr(n, 2) == "a0") { + a.certs = ASN1HEX.getHexOfTLV_AtObj(d, n); + n = b.shift() + } + if (d.substr(n, 2) == "a1") { + a.revs = ASN1HEX.getHexOfTLV_AtObj(d, n); + n = b.shift() + } + var k = n; + if (d.substr(k, 2) != "31") { + throw "Can't find signerInfos" + } + var j = ASN1HEX.getPosArrayOfChildren_AtObj(d, k); + for (var h = 0; h < j.length; h++) { + var o = j[h]; + var e = c.parseSignerInfoForAddingUnsigned(d, o, h); + a.si[h] = e + } + var g = null; + a.obj = new p.SignedData(); + g = new q.ASN1Object(); + g.hTLV = a.version; + a.obj.dCMSVersion = g; + g = new q.ASN1Object(); + g.hTLV = a.algs; + a.obj.dDigestAlgs = g; + g = new q.ASN1Object(); + g.hTLV = a.encapcontent; + a.obj.dEncapContentInfo = g; + g = new q.ASN1Object(); + g.hTLV = a.certs; + a.obj.dCerts = g; + a.obj.signerInfoList = []; + for (var h = 0; h < a.si.length; h++) { + a.obj.signerInfoList.push(a.si[h].obj) + } + return a +}; +KJUR.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned = function(d, k, a) { + var m = KJUR.asn1; + var l = KJUR.asn1.cms; + var b = {}; + var e = ASN1HEX.getPosArrayOfChildren_AtObj(d, k); + if (e.length != 6) { + throw "not supported items for SignerInfo (!=6)" + } + var f = e.shift(); + b.version = ASN1HEX.getHexOfTLV_AtObj(d, f); + var n = e.shift(); + b.si = ASN1HEX.getHexOfTLV_AtObj(d, n); + var h = e.shift(); + b.digalg = ASN1HEX.getHexOfTLV_AtObj(d, h); + var c = e.shift(); + b.sattrs = ASN1HEX.getHexOfTLV_AtObj(d, c); + var i = e.shift(); + b.sigalg = ASN1HEX.getHexOfTLV_AtObj(d, i); + var j = e.shift(); + b.sig = ASN1HEX.getHexOfTLV_AtObj(d, j); + b.sigval = ASN1HEX.getHexOfV_AtObj(d, j); + var g = null; + b.obj = new l.SignerInfo(); + g = new m.ASN1Object(); + g.hTLV = b.version; + b.obj.dCMSVersion = g; + g = new m.ASN1Object(); + g.hTLV = b.si; + b.obj.dSignerIdentifier = g; + g = new m.ASN1Object(); + g.hTLV = b.digalg; + b.obj.dDigestAlgorithm = g; + g = new m.ASN1Object(); + g.hTLV = b.sattrs; + b.obj.dSignedAttrs = g; + g = new m.ASN1Object(); + g.hTLV = b.sigalg; + b.obj.dSigAlg = g; + g = new m.ASN1Object(); + g.hTLV = b.sig; + b.obj.dSig = g; + b.obj.dUnsignedAttrs = new l.AttributeList(); + return b +}; +/*! asn1csr-1.0.3.js (c) 2015-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR.asn1.csr == "undefined" || !KJUR.asn1.csr) { + KJUR.asn1.csr = {} +} +KJUR.asn1.csr.CertificationRequest = function(f) { + KJUR.asn1.csr.CertificationRequest.superclass.constructor.call(this); + var b = null; + var d = null; + var e = null; + var c = null; + var a = null; + this.sign = function(i, h) { + if (this.prvKey == null) { + this.prvKey = h + } + this.asn1SignatureAlg = new KJUR.asn1.x509.AlgorithmIdentifier({ + name: i + }); + sig = new KJUR.crypto.Signature({ + alg: i + }); + sig.initSign(this.prvKey); + sig.updateHex(this.asn1CSRInfo.getEncodedHex()); + this.hexSig = sig.sign(); + this.asn1Sig = new KJUR.asn1.DERBitString({ + hex: "00" + this.hexSig + }); + var g = new KJUR.asn1.DERSequence({ + array: [this.asn1CSRInfo, this.asn1SignatureAlg, this.asn1Sig] + }); + this.hTLV = g.getEncodedHex(); + this.isModified = false + }; + this.getPEMString = function() { + var g = KJUR.asn1.ASN1Util.getPEMStringFromHex(this.getEncodedHex(), "CERTIFICATE REQUEST"); + return g + }; + this.getEncodedHex = function() { + if (this.isModified == false && this.hTLV != null) { + return this.hTLV + } + throw "not signed yet" + }; + if (typeof f != "undefined") { + if (typeof f.csrinfo != "undefined") { + this.asn1CSRInfo = f.csrinfo + } + } +}; +YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequest, KJUR.asn1.ASN1Object); +KJUR.asn1.csr.CertificationRequestInfo = function(a) { + KJUR.asn1.csr.CertificationRequestInfo.superclass.constructor.call(this); + this._initialize = function() { + this.asn1Array = new Array(); + this.asn1Version = new KJUR.asn1.DERInteger({ + "int": 0 + }); + this.asn1Subject = null; + this.asn1SubjPKey = null; + this.extensionsArray = new Array() + }; + this.setSubjectByParam = function(b) { + this.asn1Subject = new KJUR.asn1.x509.X500Name(b) + }; + this.setSubjectPublicKeyByGetKey = function(c) { + var b = KEYUTIL.getKey(c); + this.asn1SubjPKey = new KJUR.asn1.x509.SubjectPublicKeyInfo(b) + }; + this.appendExtensionByName = function(c, b) { + KJUR.asn1.x509.Extension.appendByNameToArray(c, b, this.extensionsArray) + }; + this.getEncodedHex = function() { + this.asn1Array = new Array(); + this.asn1Array.push(this.asn1Version); + this.asn1Array.push(this.asn1Subject); + this.asn1Array.push(this.asn1SubjPKey); + if (this.extensionsArray.length > 0) { + var e = new KJUR.asn1.DERSequence({ + array: this.extensionsArray + }); + var d = new KJUR.asn1.DERSet({ + array: [e] + }); + var c = new KJUR.asn1.DERSequence({ + array: [new KJUR.asn1.DERObjectIdentifier({ + oid: "1.2.840.113549.1.9.14" + }), d] + }); + var b = new KJUR.asn1.DERTaggedObject({ + explicit: true, + tag: "a0", + obj: c + }); + this.asn1Array.push(b) + } else { + var b = new KJUR.asn1.DERTaggedObject({ + explicit: false, + tag: "a0", + obj: new KJUR.asn1.DERNull() + }); + this.asn1Array.push(b) + } + var f = new KJUR.asn1.DERSequence({ + array: this.asn1Array + }); + this.hTLV = f.getEncodedHex(); + this.isModified = false; + return this.hTLV + }; + this._initialize() +}; +YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo, KJUR.asn1.ASN1Object); +KJUR.asn1.csr.CSRUtil = new +function() {}; +KJUR.asn1.csr.CSRUtil.newCSRPEM = function(g) { + var d = KJUR.asn1.csr; + if (g.subject === undefined) { + throw "parameter subject undefined" + } + if (g.sbjpubkey === undefined) { + throw "parameter sbjpubkey undefined" + } + if (g.sigalg === undefined) { + throw "parameter sigalg undefined" + } + if (g.sbjprvkey === undefined) { + throw "parameter sbjpubkey undefined" + } + var b = new d.CertificationRequestInfo(); + b.setSubjectByParam(g.subject); + b.setSubjectPublicKeyByGetKey(g.sbjpubkey); + if (g.ext !== undefined && g.ext.length !== undefined) { + for (var c = 0; c < g.ext.length; c++) { + for (key in g.ext[c]) { + b.appendExtensionByName(key, g.ext[c][key]) + } + } + } + var e = new d.CertificationRequest({ + csrinfo: b + }); + var a = KEYUTIL.getKey(g.sbjprvkey); + e.sign(g.sigalg, a); + var f = e.getPEMString(); + return f +}; +KJUR.asn1.csr.CSRUtil.getInfo = function(b) { + var a = {}; + a.subject = {}; + a.pubkey = {}; + if (b.indexOf("-----BEGIN CERTIFICATE REQUEST") == -1) { + throw "argument is not PEM file" + } + var c = ASN1HEX.pemToHex(b, "CERTIFICATE REQUEST"); + a.subject.hex = ASN1HEX.getDecendantHexTLVByNthList(c, 0, [0, 1]); + a.subject.name = X509.hex2dn(a.subject.hex); + a.pubkey.hex = ASN1HEX.getDecendantHexTLVByNthList(c, 0, [0, 2]); + a.pubkey.obj = KEYUTIL.getKey(a.pubkey.hex, null, "pkcs8pub"); + return a +}; +/*! asn1ocsp-1.0.1.js (c) 2016 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1) { + KJUR.asn1 = {} +} +if (typeof KJUR.asn1.ocsp == "undefined" || !KJUR.asn1.ocsp) { + KJUR.asn1.ocsp = {} +} +KJUR.asn1.ocsp.DEFAULT_HASH = "sha1"; +KJUR.asn1.ocsp.CertID = function(c) { + KJUR.asn1.ocsp.CertID.superclass.constructor.call(this); + var a = KJUR.asn1; + var e = KJUR.asn1.x509; + this.dHashAlg = null; + this.dIssuerNameHash = null; + this.dIssuerKeyHash = null; + this.dSerialNumber = null; + this.setByValue = function(i, h, f, g) { + if (g === undefined) { + g = KJUR.asn1.ocsp.DEFAULT_HASH + } + this.dHashAlg = new e.AlgorithmIdentifier({ + name: g + }); + this.dIssuerNameHash = new a.DEROctetString({ + hex: i + }); + this.dIssuerKeyHash = new a.DEROctetString({ + hex: h + }); + this.dSerialNumber = new a.DERInteger({ + hex: f + }) + }; + this.setByCert = function(m, i, k) { + if (k === undefined) { + k = KJUR.asn1.ocsp.DEFAULT_HASH + } + var f = new X509(); + f.readCertPEM(i); + var n = new X509(); + n.readCertPEM(m); + var o = X509.getPublicKeyInfoPropOfCertPEM(m); + var l = o.keyhex; + var g = f.getSerialNumberHex(); + var h = KJUR.crypto.Util.hashHex(n.getSubjectHex(), k); + var j = KJUR.crypto.Util.hashHex(l, k); + this.setByValue(h, j, g, k); + this.hoge = f.getSerialNumberHex() + }; + this.getEncodedHex = function() { + if (this.dHashAlg === null && this.dIssuerNameHash === null && this.dIssuerKeyHash === null && this.dSerialNumber === null) { + throw "not yet set values" + } + var f = [this.dHashAlg, this.dIssuerNameHash, this.dIssuerKeyHash, this.dSerialNumber]; + var g = new a.DERSequence({ + array: f + }); + this.hTLV = g.getEncodedHex(); + return this.hTLV + }; + if (typeof c !== "undefined") { + var b = c; + if (typeof b.issuerCert !== "undefined" && typeof b.subjectCert !== "undefined") { + var d = KJUR.asn1.ocsp.DEFAULT_HASH; + if (typeof b.alg === "undefined") { + d = undefined + } + this.setByCert(b.issuerCert, b.subjectCert, d) + } else { + if (typeof b.namehash !== "undefined" && typeof b.keyhash !== "undefined" && typeof b.serial !== "undefined") { + var d = KJUR.asn1.ocsp.DEFAULT_HASH; + if (typeof b.alg === "undefined") { + d = undefined + } + this.setByValue(b.namehash, b.keyhash, b.serial, d) + } else { + throw "invalid constructor arguments" + } + } + } +}; +YAHOO.lang.extend(KJUR.asn1.ocsp.CertID, KJUR.asn1.ASN1Object); +KJUR.asn1.ocsp.Request = function(b) { + KJUR.asn1.ocsp.Request.superclass.constructor.call(this); + this.dReqCert = null; + this.dExt = null; + this.getEncodedHex = function() { + var c = []; + if (this.dReqCert === null) { + throw "reqCert not set" + } + c.push(this.dReqCert); + var d = new KJUR.asn1.DERSequence({ + array: c + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (typeof b !== "undefined") { + var a = new KJUR.asn1.ocsp.CertID(b); + this.dReqCert = a + } +}; +YAHOO.lang.extend(KJUR.asn1.ocsp.Request, KJUR.asn1.ASN1Object); +KJUR.asn1.ocsp.TBSRequest = function(a) { + KJUR.asn1.ocsp.TBSRequest.superclass.constructor.call(this); + this.version = 0; + this.dRequestorName = null; + this.dRequestList = []; + this.dRequestExt = null; + this.setRequestListByParam = function(d) { + var b = []; + for (var c = 0; c < d.length; c++) { + var e = new KJUR.asn1.ocsp.Request(d[0]); + b.push(e) + } + this.dRequestList = b + }; + this.getEncodedHex = function() { + var b = []; + if (this.version !== 0) { + throw "not supported version: " + this.version + } + if (this.dRequestorName !== null) { + throw "requestorName not supported" + } + var d = new KJUR.asn1.DERSequence({ + array: this.dRequestList + }); + b.push(d); + if (this.dRequestExt !== null) { + throw "requestExtensions not supported" + } + var c = new KJUR.asn1.DERSequence({ + array: b + }); + this.hTLV = c.getEncodedHex(); + return this.hTLV + }; + if (typeof a !== "undefined") { + if (typeof a.reqList !== "undefined") { + this.setRequestListByParam(a.reqList) + } + } +}; +YAHOO.lang.extend(KJUR.asn1.ocsp.TBSRequest, KJUR.asn1.ASN1Object); +KJUR.asn1.ocsp.OCSPRequest = function(b) { + KJUR.asn1.ocsp.OCSPRequest.superclass.constructor.call(this); + this.dTbsRequest = null; + this.dOptionalSignature = null; + this.getEncodedHex = function() { + var c = []; + if (this.dTbsRequest !== null) { + c.push(this.dTbsRequest) + } else { + throw "tbsRequest not set" + } + if (this.dOptionalSignature !== null) { + throw "optionalSignature not supported" + } + var d = new KJUR.asn1.DERSequence({ + array: c + }); + this.hTLV = d.getEncodedHex(); + return this.hTLV + }; + if (typeof b !== "undefined") { + if (typeof b.reqList !== "undefined") { + var a = new KJUR.asn1.ocsp.TBSRequest(b); + this.dTbsRequest = a + } + } +}; +YAHOO.lang.extend(KJUR.asn1.ocsp.OCSPRequest, KJUR.asn1.ASN1Object); +KJUR.asn1.ocsp.OCSPUtil = {}; +KJUR.asn1.ocsp.OCSPUtil.getRequestHex = function(a, b, e) { + if (e === undefined) { + e = KJUR.asn1.ocsp.DEFAULT_HASH + } + var d = { + alg: e, + issuerCert: a, + subjectCert: b + }; + var c = new KJUR.asn1.ocsp.OCSPRequest({ + reqList: [d] + }); + return c.getEncodedHex() +}; +KJUR.asn1.ocsp.OCSPUtil.getOCSPResponseInfo = function(f) { + var a = {}; + try { + var b = ASN1HEX.getVbyList(f, 0, [0], "0a"); + a.responseStatus = parseInt(b, 16) + } catch(d) {} + if (a.responseStatus !== 0) { + return a + } + try { + var e = ASN1HEX.getDecendantIndexByNthList(f, 0, [1, 0, 1, 0, 0, 2, 0, 1]); + if (f.substr(e, 2) === "80") { + a.certStatus = "good" + } else { + if (f.substr(e, 2) === "a1") { + a.certStatus = "revoked"; + a.revocationTime = hextoutf8(ASN1HEX.getDecendantHexVByNthList(f, e, [0])) + } else { + if (f.substr(e, 2) === "82") { + a.certStatus = "unknown" + } + } + } + } catch(d) {} + try { + var c = ASN1HEX.getDecendantIndexByNthList(f, 0, [1, 0, 1, 0, 0, 2, 0, 2]); + a.thisUpdate = hextoutf8(ASN1HEX.getHexOfV_AtObj(f, c)) + } catch(d) {} + try { + var g = ASN1HEX.getDecendantIndexByNthList(f, 0, [1, 0, 1, 0, 0, 2, 0, 3]); + if (f.substr(g, 2) === "a0") { + a.nextUpdate = hextoutf8(ASN1HEX.getDecendantHexVByNthList(f, g, [0])) + } + } catch(d) {} + return a +}; +/*! base64x-1.1.8 (c) 2012-2016 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var KJUR; +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.lang == "undefined" || !KJUR.lang) { + KJUR.lang = {} +} +KJUR.lang.String = function() {}; +function Base64x() {} +function stoBA(d) { + var b = new Array(); + for (var c = 0; c < d.length; c++) { + b[c] = d.charCodeAt(c) + } + return b +} +function BAtos(b) { + var d = ""; + for (var c = 0; c < b.length; c++) { + d = d + String.fromCharCode(b[c]) + } + return d +} +function BAtohex(b) { + var e = ""; + for (var d = 0; d < b.length; d++) { + var c = b[d].toString(16); + if (c.length == 1) { + c = "0" + c + } + e = e + c + } + return e +} +function stohex(a) { + return BAtohex(stoBA(a)) +} +function stob64(a) { + return hex2b64(stohex(a)) +} +function stob64u(a) { + return b64tob64u(hex2b64(stohex(a))) +} +function b64utos(a) { + return BAtos(b64toBA(b64utob64(a))) +} +function b64tob64u(a) { + a = a.replace(/\=/g, ""); + a = a.replace(/\+/g, "-"); + a = a.replace(/\//g, "_"); + return a +} +function b64utob64(a) { + if (a.length % 4 == 2) { + a = a + "==" + } else { + if (a.length % 4 == 3) { + a = a + "=" + } + } + a = a.replace(/-/g, "+"); + a = a.replace(/_/g, "/"); + return a +} +function hextob64u(a) { + if (a.length % 2 == 1) { + a = "0" + a + } + return b64tob64u(hex2b64(a)) +} +function b64utohex(a) { + return b64tohex(b64utob64(a)) +} +var utf8tob64u, b64utoutf8; +if (typeof Buffer === "function") { + utf8tob64u = function(a) { + return b64tob64u(new Buffer(a, "utf8").toString("base64")) + }; + b64utoutf8 = function(a) { + return new Buffer(b64utob64(a), "base64").toString("utf8") + } +} else { + utf8tob64u = function(a) { + return hextob64u(uricmptohex(encodeURIComponentAll(a))) + }; + b64utoutf8 = function(a) { + return decodeURIComponent(hextouricmp(b64utohex(a))) + } +} +function utf8tob64(a) { + return hex2b64(uricmptohex(encodeURIComponentAll(a))) +} +function b64toutf8(a) { + return decodeURIComponent(hextouricmp(b64tohex(a))) +} +function utf8tohex(a) { + return uricmptohex(encodeURIComponentAll(a)) +} +function hextoutf8(a) { + return decodeURIComponent(hextouricmp(a)) +} +function hextorstr(c) { + var b = ""; + for (var a = 0; a < c.length - 1; a += 2) { + b += String.fromCharCode(parseInt(c.substr(a, 2), 16)) + } + return b +} +function rstrtohex(c) { + var a = ""; + for (var b = 0; b < c.length; b++) { + a += ("0" + c.charCodeAt(b).toString(16)).slice( - 2) + } + return a +} +function hextob64(a) { + return hex2b64(a) +} +function hextob64nl(b) { + var a = hextob64(b); + var c = a.replace(/(.{64})/g, "$1\r\n"); + c = c.replace(/\r\n$/, ""); + return c +} +function b64nltohex(b) { + var a = b.replace(/[^0-9A-Za-z\/+=]*/g, ""); + var c = b64tohex(a); + return c +} +function hextoArrayBuffer(d) { + if (d.length % 2 != 0) { + throw "input is not even length" + } + if (d.match(/^[0-9A-Fa-f]+$/) == null) { + throw "input is not hexadecimal" + } + var b = new ArrayBuffer(d.length / 2); + var a = new DataView(b); + for (var c = 0; c < d.length / 2; c++) { + a.setUint8(c, parseInt(d.substr(c * 2, 2), 16)) + } + return b +} +function ArrayBuffertohex(b) { + var d = ""; + var a = new DataView(b); + for (var c = 0; c < b.byteLength; c++) { + d += ("00" + a.getUint8(c).toString(16)).slice( - 2) + } + return d +} +function uricmptohex(a) { + return a.replace(/%/g, "") +} +function hextouricmp(a) { + return a.replace(/(..)/g, "%$1") +} +function encodeURIComponentAll(a) { + var d = encodeURIComponent(a); + var b = ""; + for (var c = 0; c < d.length; c++) { + if (d[c] == "%") { + b = b + d.substr(c, 3); + c = c + 2 + } else { + b = b + "%" + stohex(d[c]) + } + } + return b +} +function newline_toUnix(a) { + a = a.replace(/\r\n/mg, "\n"); + return a +} +function newline_toDos(a) { + a = a.replace(/\r\n/mg, "\n"); + a = a.replace(/\n/mg, "\r\n"); + return a +} +KJUR.lang.String.isInteger = function(a) { + if (a.match(/^[0-9]+$/)) { + return true + } else { + if (a.match(/^-[0-9]+$/)) { + return true + } else { + return false + } + } +}; +KJUR.lang.String.isHex = function(a) { + if (a.length % 2 == 0 && (a.match(/^[0-9a-f]+$/) || a.match(/^[0-9A-F]+$/))) { + return true + } else { + return false + } +}; +KJUR.lang.String.isBase64 = function(a) { + a = a.replace(/\s+/g, ""); + if (a.match(/^[0-9A-Za-z+\/]+={0,3}$/) && a.length % 4 == 0) { + return true + } else { + return false + } +}; +KJUR.lang.String.isBase64URL = function(a) { + if (a.match(/[+/ = ] / )) { + return false + } + a = b64utob64(a); + return KJUR.lang.String.isBase64(a) +}; +KJUR.lang.String.isIntegerArray = function(a) { + a = a.replace(/\s+/g, ""); + if (a.match(/^\[[0-9,]+\]$/)) { + return true + } else { + return false + } +}; +function intarystrtohex(b) { + b = b.replace(/^\s*\[\s*/, ""); + b = b.replace(/\s*\]\s*$/, ""); + b = b.replace(/\s*/g, ""); + try { + var c = b.split(/,/).map(function(g, e, h) { + var f = parseInt(g); + if (f < 0 || 255 < f) { + throw "integer not in range 0-255" + } + var d = ("00" + f.toString(16)).slice( - 2); + return d + }).join(""); + return c + } catch(a) { + throw "malformed integer array string: " + a + } +} +var strdiffidx = function(c, a) { + var d = c.length; + if (c.length > a.length) { + d = a.length + } + for (var b = 0; b < d; b++) { + if (c.charCodeAt(b) != a.charCodeAt(b)) { + return b + } + } + if (c.length != a.length) { + return d + } + return - 1 +}; +/*! crypto-1.1.12.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) { + KJUR.crypto = {} +} +KJUR.crypto.Util = new +function() { + this.DIGESTINFOHEAD = { + sha1: "3021300906052b0e03021a05000414", + sha224: "302d300d06096086480165030402040500041c", + sha256: "3031300d060960864801650304020105000420", + sha384: "3041300d060960864801650304020205000430", + sha512: "3051300d060960864801650304020305000440", + md2: "3020300c06082a864886f70d020205000410", + md5: "3020300c06082a864886f70d020505000410", + ripemd160: "3021300906052b2403020105000414", + }; + this.DEFAULTPROVIDER = { + md5: "cryptojs", + sha1: "cryptojs", + sha224: "cryptojs", + sha256: "cryptojs", + sha384: "cryptojs", + sha512: "cryptojs", + ripemd160: "cryptojs", + hmacmd5: "cryptojs", + hmacsha1: "cryptojs", + hmacsha224: "cryptojs", + hmacsha256: "cryptojs", + hmacsha384: "cryptojs", + hmacsha512: "cryptojs", + hmacripemd160: "cryptojs", + MD5withRSA: "cryptojs/jsrsa", + SHA1withRSA: "cryptojs/jsrsa", + SHA224withRSA: "cryptojs/jsrsa", + SHA256withRSA: "cryptojs/jsrsa", + SHA384withRSA: "cryptojs/jsrsa", + SHA512withRSA: "cryptojs/jsrsa", + RIPEMD160withRSA: "cryptojs/jsrsa", + MD5withECDSA: "cryptojs/jsrsa", + SHA1withECDSA: "cryptojs/jsrsa", + SHA224withECDSA: "cryptojs/jsrsa", + SHA256withECDSA: "cryptojs/jsrsa", + SHA384withECDSA: "cryptojs/jsrsa", + SHA512withECDSA: "cryptojs/jsrsa", + RIPEMD160withECDSA: "cryptojs/jsrsa", + SHA1withDSA: "cryptojs/jsrsa", + SHA224withDSA: "cryptojs/jsrsa", + SHA256withDSA: "cryptojs/jsrsa", + MD5withRSAandMGF1: "cryptojs/jsrsa", + SHA1withRSAandMGF1: "cryptojs/jsrsa", + SHA224withRSAandMGF1: "cryptojs/jsrsa", + SHA256withRSAandMGF1: "cryptojs/jsrsa", + SHA384withRSAandMGF1: "cryptojs/jsrsa", + SHA512withRSAandMGF1: "cryptojs/jsrsa", + RIPEMD160withRSAandMGF1: "cryptojs/jsrsa", + }; + this.CRYPTOJSMESSAGEDIGESTNAME = { + md5: CryptoJS.algo.MD5, + sha1: CryptoJS.algo.SHA1, + sha224: CryptoJS.algo.SHA224, + sha256: CryptoJS.algo.SHA256, + sha384: CryptoJS.algo.SHA384, + sha512: CryptoJS.algo.SHA512, + ripemd160: CryptoJS.algo.RIPEMD160 + }; + this.getDigestInfoHex = function(a, b) { + if (typeof this.DIGESTINFOHEAD[b] == "undefined") { + throw "alg not supported in Util.DIGESTINFOHEAD: " + b + } + return this.DIGESTINFOHEAD[b] + a + }; + this.getPaddedDigestInfoHex = function(h, a, j) { + var c = this.getDigestInfoHex(h, a); + var d = j / 4; + if (c.length + 22 > d) { + throw "key is too short for SigAlg: keylen=" + j + "," + a + } + var b = "0001"; + var k = "00" + c; + var g = ""; + var l = d - b.length - k.length; + for (var f = 0; f < l; f += 2) { + g += "ff" + } + var e = b + g + k; + return e + }; + this.hashString = function(a, c) { + var b = new KJUR.crypto.MessageDigest({ + alg: c + }); + return b.digestString(a) + }; + this.hashHex = function(b, c) { + var a = new KJUR.crypto.MessageDigest({ + alg: c + }); + return a.digestHex(b) + }; + this.sha1 = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "sha1", + prov: "cryptojs" + }); + return b.digestString(a) + }; + this.sha256 = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "sha256", + prov: "cryptojs" + }); + return b.digestString(a) + }; + this.sha256Hex = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "sha256", + prov: "cryptojs" + }); + return b.digestHex(a) + }; + this.sha512 = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "sha512", + prov: "cryptojs" + }); + return b.digestString(a) + }; + this.sha512Hex = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "sha512", + prov: "cryptojs" + }); + return b.digestHex(a) + } +}; +KJUR.crypto.Util.md5 = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "md5", + prov: "cryptojs" + }); + return b.digestString(a) +}; +KJUR.crypto.Util.ripemd160 = function(a) { + var b = new KJUR.crypto.MessageDigest({ + alg: "ripemd160", + prov: "cryptojs" + }); + return b.digestString(a) +}; +KJUR.crypto.Util.SECURERANDOMGEN = new SecureRandom(); +KJUR.crypto.Util.getRandomHexOfNbytes = function(b) { + var a = new Array(b); + KJUR.crypto.Util.SECURERANDOMGEN.nextBytes(a); + return BAtohex(a) +}; +KJUR.crypto.Util.getRandomBigIntegerOfNbytes = function(a) { + return new BigInteger(KJUR.crypto.Util.getRandomHexOfNbytes(a), 16) +}; +KJUR.crypto.Util.getRandomHexOfNbits = function(d) { + var c = d % 8; + var a = (d - c) / 8; + var b = new Array(a + 1); + KJUR.crypto.Util.SECURERANDOMGEN.nextBytes(b); + b[0] = (((255 << c) & 255) ^ 255) & b[0]; + return BAtohex(b) +}; +KJUR.crypto.Util.getRandomBigIntegerOfNbits = function(a) { + return new BigInteger(KJUR.crypto.Util.getRandomHexOfNbits(a), 16) +}; +KJUR.crypto.Util.getRandomBigIntegerZeroToMax = function(b) { + var a = b.bitLength(); + while (1) { + var c = KJUR.crypto.Util.getRandomBigIntegerOfNbits(a); + if (b.compareTo(c) != -1) { + return c + } + } +}; +KJUR.crypto.Util.getRandomBigIntegerMinToMax = function(e, b) { + var c = e.compareTo(b); + if (c == 1) { + throw "biMin is greater than biMax" + } + if (c == 0) { + return e + } + var a = b.subtract(e); + var d = KJUR.crypto.Util.getRandomBigIntegerZeroToMax(a); + return d.add(e) +}; +KJUR.crypto.MessageDigest = function(c) { + var b = null; + var a = null; + var d = null; + this.setAlgAndProvider = function(g, f) { + g = KJUR.crypto.MessageDigest.getCanonicalAlgName(g); + if (g !== null && f === undefined) { + f = KJUR.crypto.Util.DEFAULTPROVIDER[g] + } + if (":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(g) != -1 && f == "cryptojs") { + try { + this.md = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[g].create() + } catch(e) { + throw "setAlgAndProvider hash alg set fail alg=" + g + "/" + e + } + this.updateString = function(h) { + this.md.update(h) + }; + this.updateHex = function(h) { + var i = CryptoJS.enc.Hex.parse(h); + this.md.update(i) + }; + this.digest = function() { + var h = this.md.finalize(); + return h.toString(CryptoJS.enc.Hex) + }; + this.digestString = function(h) { + this.updateString(h); + return this.digest() + }; + this.digestHex = function(h) { + this.updateHex(h); + return this.digest() + } + } + if (":sha256:".indexOf(g) != -1 && f == "sjcl") { + try { + this.md = new sjcl.hash.sha256() + } catch(e) { + throw "setAlgAndProvider hash alg set fail alg=" + g + "/" + e + } + this.updateString = function(h) { + this.md.update(h) + }; + this.updateHex = function(i) { + var h = sjcl.codec.hex.toBits(i); + this.md.update(h) + }; + this.digest = function() { + var h = this.md.finalize(); + return sjcl.codec.hex.fromBits(h) + }; + this.digestString = function(h) { + this.updateString(h); + return this.digest() + }; + this.digestHex = function(h) { + this.updateHex(h); + return this.digest() + } + } + }; + this.updateString = function(e) { + throw "updateString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName + }; + this.updateHex = function(e) { + throw "updateHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName + }; + this.digest = function() { + throw "digest() not supported for this alg/prov: " + this.algName + "/" + this.provName + }; + this.digestString = function(e) { + throw "digestString(str) not supported for this alg/prov: " + this.algName + "/" + this.provName + }; + this.digestHex = function(e) { + throw "digestHex(hex) not supported for this alg/prov: " + this.algName + "/" + this.provName + }; + if (c !== undefined) { + if (c.alg !== undefined) { + this.algName = c.alg; + if (c.prov === undefined) { + this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName] + } + this.setAlgAndProvider(this.algName, this.provName) + } + } +}; +KJUR.crypto.MessageDigest.getCanonicalAlgName = function(a) { + if (typeof a === "string") { + a = a.toLowerCase(); + a = a.replace(/-/, "") + } + return a +}; +KJUR.crypto.MessageDigest.getHashLength = function(c) { + var b = KJUR.crypto.MessageDigest; + var a = b.getCanonicalAlgName(c); + if (b.HASHLENGTH[a] === undefined) { + throw "not supported algorithm: " + c + } + return b.HASHLENGTH[a] +}; +KJUR.crypto.MessageDigest.HASHLENGTH = { + md5: 16, + sha1: 20, + sha224: 28, + sha256: 32, + sha384: 48, + sha512: 64, + ripemd160: 20 +}; +KJUR.crypto.Mac = function(d) { + var f = null; + var c = null; + var a = null; + var e = null; + var b = null; + this.setAlgAndProvider = function(k, i) { + k = k.toLowerCase(); + if (k == null) { + k = "hmacsha1" + } + k = k.toLowerCase(); + if (k.substr(0, 4) != "hmac") { + throw "setAlgAndProvider unsupported HMAC alg: " + k + } + if (i === undefined) { + i = KJUR.crypto.Util.DEFAULTPROVIDER[k] + } + this.algProv = k + "/" + i; + var g = k.substr(4); + if (":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(g) != -1 && i == "cryptojs") { + try { + var j = KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[g]; + this.mac = CryptoJS.algo.HMAC.create(j, this.pass) + } catch(h) { + throw "setAlgAndProvider hash alg set fail hashAlg=" + g + "/" + h + } + this.updateString = function(l) { + this.mac.update(l) + }; + this.updateHex = function(l) { + var m = CryptoJS.enc.Hex.parse(l); + this.mac.update(m) + }; + this.doFinal = function() { + var l = this.mac.finalize(); + return l.toString(CryptoJS.enc.Hex) + }; + this.doFinalString = function(l) { + this.updateString(l); + return this.doFinal() + }; + this.doFinalHex = function(l) { + this.updateHex(l); + return this.doFinal() + } + } + }; + this.updateString = function(g) { + throw "updateString(str) not supported for this alg/prov: " + this.algProv + }; + this.updateHex = function(g) { + throw "updateHex(hex) not supported for this alg/prov: " + this.algProv + }; + this.doFinal = function() { + throw "digest() not supported for this alg/prov: " + this.algProv + }; + this.doFinalString = function(g) { + throw "digestString(str) not supported for this alg/prov: " + this.algProv + }; + this.doFinalHex = function(g) { + throw "digestHex(hex) not supported for this alg/prov: " + this.algProv + }; + this.setPassword = function(h) { + if (typeof h == "string") { + var g = h; + if (h.length % 2 == 1 || !h.match(/^[0-9A-Fa-f]+$/)) { + g = rstrtohex(h) + } + this.pass = CryptoJS.enc.Hex.parse(g); + return + } + if (typeof h != "object") { + throw "KJUR.crypto.Mac unsupported password type: " + h + } + var g = null; + if (h.hex !== undefined) { + if (h.hex.length % 2 != 0 || !h.hex.match(/^[0-9A-Fa-f]+$/)) { + throw "Mac: wrong hex password: " + h.hex + } + g = h.hex + } + if (h.utf8 !== undefined) { + g = utf8tohex(h.utf8) + } + if (h.rstr !== undefined) { + g = rstrtohex(h.rstr) + } + if (h.b64 !== undefined) { + g = b64tohex(h.b64) + } + if (h.b64u !== undefined) { + g = b64utohex(h.b64u) + } + if (g == null) { + throw "KJUR.crypto.Mac unsupported password type: " + h + } + this.pass = CryptoJS.enc.Hex.parse(g) + }; + if (d !== undefined) { + if (d.pass !== undefined) { + this.setPassword(d.pass) + } + if (d.alg !== undefined) { + this.algName = d.alg; + if (d.prov === undefined) { + this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName] + } + this.setAlgAndProvider(this.algName, this.provName) + } + } +}; +KJUR.crypto.Signature = function(o) { + var q = null; + var n = null; + var r = null; + var c = null; + var l = null; + var d = null; + var k = null; + var h = null; + var p = null; + var e = null; + var b = -1; + var g = null; + var j = null; + var a = null; + var i = null; + var f = null; + this._setAlgNames = function() { + var s = this.algName.match(/^(.+)with(.+)$/); + if (s) { + this.mdAlgName = s[1].toLowerCase(); + this.pubkeyAlgName = s[2].toLowerCase() + } + }; + this._zeroPaddingOfSignature = function(x, w) { + var v = ""; + var t = w / 4 - x.length; + for (var u = 0; u < t; u++) { + v = v + "0" + } + return v + x + }; + this.setAlgAndProvider = function(u, t) { + this._setAlgNames(); + if (t != "cryptojs/jsrsa") { + throw "provider not supported: " + t + } + if (":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName) != -1) { + try { + this.md = new KJUR.crypto.MessageDigest({ + alg: this.mdAlgName + }) + } catch(s) { + throw "setAlgAndProvider hash alg set fail alg=" + this.mdAlgName + "/" + s + } + this.init = function(w, x) { + var y = null; + try { + if (x === undefined) { + y = KEYUTIL.getKey(w) + } else { + y = KEYUTIL.getKey(w, x) + } + } catch(v) { + throw "init failed:" + v + } + if (y.isPrivate === true) { + this.prvKey = y; + this.state = "SIGN" + } else { + if (y.isPublic === true) { + this.pubKey = y; + this.state = "VERIFY" + } else { + throw "init failed.:" + y + } + } + }; + this.initSign = function(v) { + if (typeof v.ecprvhex == "string" && typeof v.eccurvename == "string") { + this.ecprvhex = v.ecprvhex; + this.eccurvename = v.eccurvename + } else { + this.prvKey = v + } + this.state = "SIGN" + }; + this.initVerifyByPublicKey = function(v) { + if (typeof v.ecpubhex == "string" && typeof v.eccurvename == "string") { + this.ecpubhex = v.ecpubhex; + this.eccurvename = v.eccurvename + } else { + if (v instanceof KJUR.crypto.ECDSA) { + this.pubKey = v + } else { + if (v instanceof RSAKey) { + this.pubKey = v + } + } + } + this.state = "VERIFY" + }; + this.initVerifyByCertificatePEM = function(v) { + var w = new X509(); + w.readCertPEM(v); + this.pubKey = w.subjectPublicKeyRSA; + this.state = "VERIFY" + }; + this.updateString = function(v) { + this.md.updateString(v) + }; + this.updateHex = function(v) { + this.md.updateHex(v) + }; + this.sign = function() { + this.sHashHex = this.md.digest(); + if (typeof this.ecprvhex != "undefined" && typeof this.eccurvename != "undefined") { + var v = new KJUR.crypto.ECDSA({ + curve: this.eccurvename + }); + this.hSign = v.signHex(this.sHashHex, this.ecprvhex) + } else { + if (this.prvKey instanceof RSAKey && this.pubkeyAlgName == "rsaandmgf1") { + this.hSign = this.prvKey.signWithMessageHashPSS(this.sHashHex, this.mdAlgName, this.pssSaltLen) + } else { + if (this.prvKey instanceof RSAKey && this.pubkeyAlgName == "rsa") { + this.hSign = this.prvKey.signWithMessageHash(this.sHashHex, this.mdAlgName) + } else { + if (this.prvKey instanceof KJUR.crypto.ECDSA) { + this.hSign = this.prvKey.signWithMessageHash(this.sHashHex) + } else { + if (this.prvKey instanceof KJUR.crypto.DSA) { + this.hSign = this.prvKey.signWithMessageHash(this.sHashHex) + } else { + throw "Signature: unsupported public key alg: " + this.pubkeyAlgName + } + } + } + } + } + return this.hSign + }; + this.signString = function(v) { + this.updateString(v); + return this.sign() + }; + this.signHex = function(v) { + this.updateHex(v); + return this.sign() + }; + this.verify = function(v) { + this.sHashHex = this.md.digest(); + if (typeof this.ecpubhex != "undefined" && typeof this.eccurvename != "undefined") { + var w = new KJUR.crypto.ECDSA({ + curve: this.eccurvename + }); + return w.verifyHex(this.sHashHex, v, this.ecpubhex) + } else { + if (this.pubKey instanceof RSAKey && this.pubkeyAlgName == "rsaandmgf1") { + return this.pubKey.verifyWithMessageHashPSS(this.sHashHex, v, this.mdAlgName, this.pssSaltLen) + } else { + if (this.pubKey instanceof RSAKey && this.pubkeyAlgName == "rsa") { + return this.pubKey.verifyWithMessageHash(this.sHashHex, v) + } else { + if (this.pubKey instanceof KJUR.crypto.ECDSA) { + return this.pubKey.verifyWithMessageHash(this.sHashHex, v) + } else { + if (this.pubKey instanceof KJUR.crypto.DSA) { + return this.pubKey.verifyWithMessageHash(this.sHashHex, v) + } else { + throw "Signature: unsupported public key alg: " + this.pubkeyAlgName + } + } + } + } + } + } + } + }; + this.init = function(s, t) { + throw "init(key, pass) not supported for this alg:prov=" + this.algProvName + }; + this.initVerifyByPublicKey = function(s) { + throw "initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov=" + this.algProvName + }; + this.initVerifyByCertificatePEM = function(s) { + throw "initVerifyByCertificatePEM(certPEM) not supported for this alg:prov=" + this.algProvName + }; + this.initSign = function(s) { + throw "initSign(prvKey) not supported for this alg:prov=" + this.algProvName + }; + this.updateString = function(s) { + throw "updateString(str) not supported for this alg:prov=" + this.algProvName + }; + this.updateHex = function(s) { + throw "updateHex(hex) not supported for this alg:prov=" + this.algProvName + }; + this.sign = function() { + throw "sign() not supported for this alg:prov=" + this.algProvName + }; + this.signString = function(s) { + throw "digestString(str) not supported for this alg:prov=" + this.algProvName + }; + this.signHex = function(s) { + throw "digestHex(hex) not supported for this alg:prov=" + this.algProvName + }; + this.verify = function(s) { + throw "verify(hSigVal) not supported for this alg:prov=" + this.algProvName + }; + this.initParams = o; + if (o !== undefined) { + if (o.alg !== undefined) { + this.algName = o.alg; + if (o.prov === undefined) { + this.provName = KJUR.crypto.Util.DEFAULTPROVIDER[this.algName] + } else { + this.provName = o.prov + } + this.algProvName = this.algName + ":" + this.provName; + this.setAlgAndProvider(this.algName, this.provName); + this._setAlgNames() + } + if (o.psssaltlen !== undefined) { + this.pssSaltLen = o.psssaltlen + } + if (o.prvkeypem !== undefined) { + if (o.prvkeypas !== undefined) { + throw "both prvkeypem and prvkeypas parameters not supported" + } else { + try { + var q = new RSAKey(); + q.readPrivateKeyFromPEMString(o.prvkeypem); + this.initSign(q) + } catch(m) { + throw "fatal error to load pem private key: " + m + } + } + } + } +}; +KJUR.crypto.Cipher = function(a) {}; +KJUR.crypto.Cipher.encrypt = function(e, f, d) { + if (f instanceof RSAKey && f.isPublic) { + var c = KJUR.crypto.Cipher.getAlgByKeyAndName(f, d); + if (c === "RSA") { + return f.encrypt(e) + } + if (c === "RSAOAEP") { + return f.encryptOAEP(e, "sha1") + } + var b = c.match(/^RSAOAEP(\d+)$/); + if (b !== null) { + return f.encryptOAEP(e, "sha" + b[1]) + } + throw "Cipher.encrypt: unsupported algorithm for RSAKey: " + d + } else { + throw "Cipher.encrypt: unsupported key or algorithm" + } +}; +KJUR.crypto.Cipher.decrypt = function(e, f, d) { + if (f instanceof RSAKey && f.isPrivate) { + var c = KJUR.crypto.Cipher.getAlgByKeyAndName(f, d); + if (c === "RSA") { + return f.decrypt(e) + } + if (c === "RSAOAEP") { + return f.decryptOAEP(e, "sha1") + } + var b = c.match(/^RSAOAEP(\d+)$/); + if (b !== null) { + return f.decryptOAEP(e, "sha" + b[1]) + } + throw "Cipher.decrypt: unsupported algorithm for RSAKey: " + d + } else { + throw "Cipher.decrypt: unsupported key or algorithm" + } +}; +KJUR.crypto.Cipher.getAlgByKeyAndName = function(b, a) { + if (b instanceof RSAKey) { + if (":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(a) != -1) { + return a + } + if (a === null || a === undefined) { + return "RSA" + } + throw "getAlgByKeyAndName: not supported algorithm name for RSAKey: " + a + } + throw "getAlgByKeyAndName: not supported algorithm name: " + a +}; +KJUR.crypto.OID = new +function() { + this.oidhex2name = { + "2a864886f70d010101": "rsaEncryption", + "2a8648ce3d0201": "ecPublicKey", + "2a8648ce380401": "dsa", + "2a8648ce3d030107": "secp256r1", + "2b8104001f": "secp192k1", + "2b81040021": "secp224r1", + "2b8104000a": "secp256k1", + "2b81040023": "secp521r1", + "2b81040022": "secp384r1", + "2a8648ce380403": "SHA1withDSA", + "608648016503040301": "SHA224withDSA", + "608648016503040302": "SHA256withDSA", + } +}; +/*! ecdsa-modified-1.1.0.js (c) Stephan Thomas, Kenji Urushima | github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) { + KJUR.crypto = {} +} +KJUR.crypto.ECDSA = function(h) { + var e = "secp256r1"; + var g = null; + var b = null; + var f = null; + var a = new SecureRandom(); + var d = null; + this.type = "EC"; + this.isPrivate = false; + this.isPublic = false; + function c(s, o, r, n) { + var j = Math.max(o.bitLength(), n.bitLength()); + var t = s.add2D(r); + var q = s.curve.getInfinity(); + for (var p = j - 1; p >= 0; --p) { + q = q.twice2D(); + q.z = BigInteger.ONE; + if (o.testBit(p)) { + if (n.testBit(p)) { + q = q.add2D(t) + } else { + q = q.add2D(s) + } + } else { + if (n.testBit(p)) { + q = q.add2D(r) + } + } + } + return q + } + this.getBigRandom = function(i) { + return new BigInteger(i.bitLength(), a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE) + }; + this.setNamedCurve = function(i) { + this.ecparams = KJUR.crypto.ECParameterDB.getByName(i); + this.prvKeyHex = null; + this.pubKeyHex = null; + this.curveName = i + }; + this.setPrivateKeyHex = function(i) { + this.isPrivate = true; + this.prvKeyHex = i + }; + this.setPublicKeyHex = function(i) { + this.isPublic = true; + this.pubKeyHex = i + }; + this.getPublicKeyXYHex = function() { + var k = this.pubKeyHex; + if (k.substr(0, 2) !== "04") { + throw "this method supports uncompressed format(04) only" + } + var j = this.ecparams.keylen / 4; + if (k.length !== 2 + j * 2) { + throw "malformed public key hex length" + } + var i = {}; + i.x = k.substr(2, j); + i.y = k.substr(2 + j); + return i + }; + this.getShortNISTPCurveName = function() { + var i = this.curveName; + if (i === "secp256r1" || i === "NIST P-256" || i === "P-256" || i === "prime256v1") { + return "P-256" + } + if (i === "secp384r1" || i === "NIST P-384" || i === "P-384") { + return "P-384" + } + return null + }; + this.generateKeyPairHex = function() { + var k = this.ecparams.n; + var n = this.getBigRandom(k); + var l = this.ecparams.G.multiply(n); + var q = l.getX().toBigInteger(); + var o = l.getY().toBigInteger(); + var i = this.ecparams.keylen / 4; + var m = ("0000000000" + n.toString(16)).slice( - i); + var r = ("0000000000" + q.toString(16)).slice( - i); + var p = ("0000000000" + o.toString(16)).slice( - i); + var j = "04" + r + p; + this.setPrivateKeyHex(m); + this.setPublicKeyHex(j); + return { + ecprvhex: m, + ecpubhex: j + } + }; + this.signWithMessageHash = function(i) { + return this.signHex(i, this.prvKeyHex) + }; + this.signHex = function(o, j) { + var t = new BigInteger(j, 16); + var l = this.ecparams.n; + var q = new BigInteger(o, 16); + do { + var m = this.getBigRandom(l); + var u = this.ecparams.G; + var p = u.multiply(m); + var i = p.getX().toBigInteger().mod(l) + } while ( i . compareTo ( BigInteger . ZERO ) <= 0); + var v = m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l); + return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i, v) + }; + this.sign = function(m, u) { + var q = u; + var j = this.ecparams.n; + var p = BigInteger.fromByteArrayUnsigned(m); + do { + var l = this.getBigRandom(j); + var t = this.ecparams.G; + var o = t.multiply(l); + var i = o.getX().toBigInteger().mod(j) + } while ( i . compareTo ( BigInteger . ZERO ) <= 0); + var v = l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j); + return this.serializeSig(i, v) + }; + this.verifyWithMessageHash = function(j, i) { + return this.verifyHex(j, i, this.pubKeyHex) + }; + this.verifyHex = function(m, i, p) { + var l, j; + var o = KJUR.crypto.ECDSA.parseSigHex(i); + l = o.r; + j = o.s; + var k; + k = ECPointFp.decodeFromHex(this.ecparams.curve, p); + var n = new BigInteger(m, 16); + return this.verifyRaw(n, l, j, k) + }; + this.verify = function(o, p, j) { + var l, i; + if (Bitcoin.Util.isArray(p)) { + var n = this.parseSig(p); + l = n.r; + i = n.s + } else { + if ("object" === typeof p && p.r && p.s) { + l = p.r; + i = p.s + } else { + throw "Invalid value for signature" + } + } + var k; + if (j instanceof ECPointFp) { + k = j + } else { + if (Bitcoin.Util.isArray(j)) { + k = ECPointFp.decodeFrom(this.ecparams.curve, j) + } else { + throw "Invalid format for pubkey value, must be byte array or ECPointFp" + } + } + var m = BigInteger.fromByteArrayUnsigned(o); + return this.verifyRaw(m, l, i, k) + }; + this.verifyRaw = function(o, i, w, m) { + var l = this.ecparams.n; + var u = this.ecparams.G; + if (i.compareTo(BigInteger.ONE) < 0 || i.compareTo(l) >= 0) { + return false + } + if (w.compareTo(BigInteger.ONE) < 0 || w.compareTo(l) >= 0) { + return false + } + var p = w.modInverse(l); + var k = o.multiply(p).mod(l); + var j = i.multiply(p).mod(l); + var q = u.multiply(k).add(m.multiply(j)); + var t = q.getX().toBigInteger().mod(l); + return t.equals(i) + }; + this.serializeSig = function(k, j) { + var l = k.toByteArraySigned(); + var i = j.toByteArraySigned(); + var m = []; + m.push(2); + m.push(l.length); + m = m.concat(l); + m.push(2); + m.push(i.length); + m = m.concat(i); + m.unshift(m.length); + m.unshift(48); + return m + }; + this.parseSig = function(n) { + var m; + if (n[0] != 48) { + throw new Error("Signature not a valid DERSequence") + } + m = 2; + if (n[m] != 2) { + throw new Error("First element in signature must be a DERInteger") + } + var l = n.slice(m + 2, m + 2 + n[m + 1]); + m += 2 + n[m + 1]; + if (n[m] != 2) { + throw new Error("Second element in signature must be a DERInteger") + } + var i = n.slice(m + 2, m + 2 + n[m + 1]); + m += 2 + n[m + 1]; + var k = BigInteger.fromByteArrayUnsigned(l); + var j = BigInteger.fromByteArrayUnsigned(i); + return { + r: k, + s: j + } + }; + this.parseSigCompact = function(m) { + if (m.length !== 65) { + throw "Signature has the wrong length" + } + var j = m[0] - 27; + if (j < 0 || j > 7) { + throw "Invalid signature type" + } + var o = this.ecparams.n; + var l = BigInteger.fromByteArrayUnsigned(m.slice(1, 33)).mod(o); + var k = BigInteger.fromByteArrayUnsigned(m.slice(33, 65)).mod(o); + return { + r: l, + s: k, + i: j + } + }; + this.readPKCS5PrvKeyHex = function(l) { + var n = ASN1HEX; + var m = KJUR.crypto.ECDSA.getName; + var p = n.getVbyList; + if (n.isASN1HEX(l) === false) { + throw "not ASN.1 hex string" + } + var i, k, o; + try { + i = p(l, 0, [2, 0], "06"); + k = p(l, 0, [1], "04"); + try { + o = p(l, 0, [3, 0], "03").substr(2) + } catch(j) {} + } catch(j) { + throw "malformed PKCS#1/5 plain ECC private key" + } + this.curveName = m(i); + if (this.curveName === undefined) { + throw "unsupported curve name" + } + this.setNamedCurve(this.curveName); + this.setPublicKeyHex(o); + this.setPrivateKeyHex(k); + this.isPublic = false + }; + this.readPKCS8PrvKeyHex = function(l) { + var q = ASN1HEX; + var i = KJUR.crypto.ECDSA.getName; + var n = q.getVbyList; + if (q.isASN1HEX(l) === false) { + throw "not ASN.1 hex string" + } + var j, p, m, k; + try { + j = n(l, 0, [1, 0], "06"); + p = n(l, 0, [1, 1], "06"); + m = n(l, 0, [2, 0, 1], "04"); + try { + k = n(l, 0, [2, 0, 2, 0], "03").substr(2) + } catch(o) {} + } catch(o) { + throw "malformed PKCS#8 plain ECC private key" + } + this.curveName = i(p); + if (this.curveName === undefined) { + throw "unsupported curve name" + } + this.setNamedCurve(this.curveName); + this.setPublicKeyHex(k); + this.setPrivateKeyHex(m); + this.isPublic = false + }; + this.readPKCS8PubKeyHex = function(l) { + var n = ASN1HEX; + var m = KJUR.crypto.ECDSA.getName; + var p = n.getVbyList; + if (n.isASN1HEX(l) === false) { + throw "not ASN.1 hex string" + } + var k, i, o; + try { + k = p(l, 0, [0, 0], "06"); + i = p(l, 0, [0, 1], "06"); + o = p(l, 0, [1], "03").substr(2) + } catch(j) { + throw "malformed PKCS#8 ECC public key" + } + this.curveName = m(i); + if (this.curveName === null) { + throw "unsupported curve name" + } + this.setNamedCurve(this.curveName); + this.setPublicKeyHex(o) + }; + this.readCertPubKeyHex = function(k, p) { + if (p !== 5) { + p = 6 + } + var m = ASN1HEX; + var l = KJUR.crypto.ECDSA.getName; + var o = m.getVbyList; + if (m.isASN1HEX(k) === false) { + throw "not ASN.1 hex string" + } + var i, n; + try { + i = o(k, 0, [0, p, 0, 1], "06"); + n = o(k, 0, [0, p, 1], "03").substr(2) + } catch(j) { + throw "malformed X.509 certificate ECC public key" + } + this.curveName = l(i); + if (this.curveName === null) { + throw "unsupported curve name" + } + this.setNamedCurve(this.curveName); + this.setPublicKeyHex(n) + }; + if (h !== undefined) { + if (h.curve !== undefined) { + this.curveName = h.curve + } + } + if (this.curveName === undefined) { + this.curveName = e + } + this.setNamedCurve(this.curveName); + if (h !== undefined) { + if (h.prv !== undefined) { + this.setPrivateKeyHex(h.prv) + } + if (h.pub !== undefined) { + this.setPublicKeyHex(h.pub) + } + } +}; +KJUR.crypto.ECDSA.parseSigHex = function(a) { + var b = KJUR.crypto.ECDSA.parseSigHexInHexRS(a); + var d = new BigInteger(b.r, 16); + var c = new BigInteger(b.s, 16); + return { + r: d, + s: c + } +}; +KJUR.crypto.ECDSA.parseSigHexInHexRS = function(c) { + if (c.substr(0, 2) != "30") { + throw "signature is not a ASN.1 sequence" + } + var b = ASN1HEX.getPosArrayOfChildren_AtObj(c, 0); + if (b.length != 2) { + throw "number of signature ASN.1 sequence elements seem wrong" + } + var g = b[0]; + var f = b[1]; + if (c.substr(g, 2) != "02") { + throw "1st item of sequene of signature is not ASN.1 integer" + } + if (c.substr(f, 2) != "02") { + throw "2nd item of sequene of signature is not ASN.1 integer" + } + var e = ASN1HEX.getHexOfV_AtObj(c, g); + var d = ASN1HEX.getHexOfV_AtObj(c, f); + return { + r: e, + s: d + } +}; +KJUR.crypto.ECDSA.asn1SigToConcatSig = function(c) { + var d = KJUR.crypto.ECDSA.parseSigHexInHexRS(c); + var b = d.r; + var a = d.s; + if (b.substr(0, 2) == "00" && (((b.length / 2) * 8) % (16 * 8)) == 8) { + b = b.substr(2) + } + if (a.substr(0, 2) == "00" && (((a.length / 2) * 8) % (16 * 8)) == 8) { + a = a.substr(2) + } + if ((((b.length / 2) * 8) % (16 * 8)) != 0) { + throw "unknown ECDSA sig r length error" + } + if ((((a.length / 2) * 8) % (16 * 8)) != 0) { + throw "unknown ECDSA sig s length error" + } + return b + a +}; +KJUR.crypto.ECDSA.concatSigToASN1Sig = function(a) { + if ((((a.length / 2) * 8) % (16 * 8)) != 0) { + throw "unknown ECDSA concatinated r-s sig length error" + } + var c = a.substr(0, a.length / 2); + var b = a.substr(a.length / 2); + return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c, b) +}; +KJUR.crypto.ECDSA.hexRSSigToASN1Sig = function(b, a) { + var d = new BigInteger(b, 16); + var c = new BigInteger(a, 16); + return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d, c) +}; +KJUR.crypto.ECDSA.biRSSigToASN1Sig = function(e, c) { + var b = new KJUR.asn1.DERInteger({ + bigint: e + }); + var a = new KJUR.asn1.DERInteger({ + bigint: c + }); + var d = new KJUR.asn1.DERSequence({ + array: [b, a] + }); + return d.getEncodedHex() +}; +KJUR.crypto.ECDSA.getName = function(a) { + if (a === "2a8648ce3d030107") { + return "secp256r1" + } + if (a === "2b8104000a") { + return "secp256k1" + } + if (a === "2b81040022") { + return "secp384r1" + } + if ("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a) !== -1) { + return "secp256r1" + } + if ("|secp256k1|".indexOf(a) !== -1) { + return "secp256k1" + } + if ("|secp384r1|NIST P-384|P-384|".indexOf(a) !== -1) { + return "secp384r1" + } + return null +}; +/*! ecparam-1.0.0.js (c) 2013 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) { + KJUR.crypto = {} +} +KJUR.crypto.ECParameterDB = new +function() { + var b = {}; + var c = {}; + function a(d) { + return new BigInteger(d, 16) + } + this.getByName = function(e) { + var d = e; + if (typeof c[d] != "undefined") { + d = c[e] + } + if (typeof b[d] != "undefined") { + return b[d] + } + throw "unregistered EC curve name: " + d + }; + this.regist = function(A, l, o, g, m, e, j, f, k, u, d, x) { + b[A] = {}; + var s = a(o); + var z = a(g); + var y = a(m); + var t = a(e); + var w = a(j); + var r = new ECCurveFp(s, z, y); + var q = r.decodePointHex("04" + f + k); + b[A]["name"] = A; + b[A]["keylen"] = l; + b[A]["curve"] = r; + b[A]["G"] = q; + b[A]["n"] = t; + b[A]["h"] = w; + b[A]["oid"] = d; + b[A]["info"] = x; + for (var v = 0; v < u.length; v++) { + c[u[v]] = A + } + } +}; +KJUR.crypto.ECParameterDB.regist("secp128r1", 128, "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC", "E87579C11079F43DD824993C2CEE5ED3", "FFFFFFFE0000000075A30D1B9038A115", "1", "161FF7528B899B2D0C28607CA52C5B86", "CF5AC8395BAFEB13C02DA292DDED7A83", [], "", "secp128r1 : SECG curve over a 128 bit prime field"); +KJUR.crypto.ECParameterDB.regist("secp160k1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73", "0", "7", "0100000000000000000001B8FA16DFAB9ACA16B6B3", "1", "3B4C382CE37AA192A4019E763036F4F5DD4D7EBB", "938CF935318FDCED6BC28286531733C3F03C4FEE", [], "", "secp160k1 : SECG curve over a 160 bit prime field"); +KJUR.crypto.ECParameterDB.regist("secp160r1", 160, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", "0100000000000000000001F4C8F927AED3CA752257", "1", "4A96B5688EF573284664698968C38BB913CBFC82", "23A628553168947D59DCC912042351377AC5FB32", [], "", "secp160r1 : SECG curve over a 160 bit prime field"); +KJUR.crypto.ECParameterDB.regist("secp192k1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37", "0", "3", "FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D", "1", "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D", "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D", []); +KJUR.crypto.ECParameterDB.regist("secp192r1", 192, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC", "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1", "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831", "1", "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012", "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811", []); +KJUR.crypto.ECParameterDB.regist("secp224r1", 224, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE", "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4", "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D", "1", "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21", "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", []); +KJUR.crypto.ECParameterDB.regist("secp256k1", 256, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F", "0", "7", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", "1", "79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", "483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", []); +KJUR.crypto.ECParameterDB.regist("secp256r1", 256, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", "1", "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", ["NIST P-256", "P-256", "prime256v1"]); +KJUR.crypto.ECParameterDB.regist("secp384r1", 384, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", "1", "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7", "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", ["NIST P-384", "P-384"]); +KJUR.crypto.ECParameterDB.regist("secp521r1", 521, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409", "1", "C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66", "011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", ["NIST P-521", "P-521"]); +/*! dsa-2.1.0.js (c) 2016-2017 Kenji Urushimma | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.crypto == "undefined" || !KJUR.crypto) { + KJUR.crypto = {} +} +KJUR.crypto.DSA = function() { + this.p = null; + this.q = null; + this.g = null; + this.y = null; + this.x = null; + this.type = "DSA"; + this.isPrivate = false; + this.isPublic = false; + this.setPrivate = function(d, c, b, e, a) { + this.isPrivate = true; + this.p = d; + this.q = c; + this.g = b; + this.y = e; + this.x = a + }; + this.setPrivateHex = function(d, b, f, i, j) { + var c, a, e, g, h; + c = new BigInteger(d, 16); + a = new BigInteger(b, 16); + e = new BigInteger(f, 16); + if (typeof i === "string" && i.length > 1) { + g = new BigInteger(i, 16) + } else { + g = null + } + h = new BigInteger(j, 16); + this.setPrivate(c, a, e, g, h) + }; + this.setPublic = function(c, b, a, d) { + this.isPublic = true; + this.p = c; + this.q = b; + this.g = a; + this.y = d; + this.x = null + }; + this.setPublicHex = function(f, e, d, g) { + var b, a, h, c; + b = new BigInteger(f, 16); + a = new BigInteger(e, 16); + h = new BigInteger(d, 16); + c = new BigInteger(g, 16); + this.setPublic(b, a, h, c) + }; + this.signWithMessageHash = function(d) { + var c = this.p; + var b = this.q; + var f = this.g; + var i = this.y; + var j = this.x; + var e = KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE), b.subtract(BigInteger.ONE)); + var l = d.substr(0, b.bitLength() / 4); + var h = new BigInteger(l, 16); + var a = (f.modPow(e, c)).mod(b); + var n = (e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b); + var m = KJUR.asn1.ASN1Util.jsonToASN1HEX({ + seq: [{ + "int": { + bigint: a + } + }, + { + "int": { + bigint: n + } + }] + }); + return m + }; + this.verifyWithMessageHash = function(h, f) { + var d = this.p; + var b = this.q; + var j = this.g; + var l = this.y; + var i = this.parseASN1Signature(f); + var a = i[0]; + var t = i[1]; + var o = h.substr(0, b.bitLength() / 4); + var k = new BigInteger(o, 16); + if (BigInteger.ZERO.compareTo(a) > 0 || a.compareTo(b) > 0) { + throw "invalid DSA signature" + } + if (BigInteger.ZERO.compareTo(t) > 0 || t.compareTo(b) > 0) { + throw "invalid DSA signature" + } + var m = t.modInverse(b); + var e = k.multiply(m).mod(b); + var c = a.multiply(m).mod(b); + var n = j.modPow(e, d).multiply(l.modPow(c, d)).mod(d).mod(b); + return n.compareTo(a) == 0 + }; + this.parseASN1Signature = function(a) { + try { + var d = new BigInteger(ASN1HEX.getVbyList(a, 0, [0], "02"), 16); + var c = new BigInteger(ASN1HEX.getVbyList(a, 0, [1], "02"), 16); + return [d, c] + } catch(b) { + throw "malformed ASN.1 DSA signature" + } + }; + this.readPKCS5PrvKeyHex = function(c) { + var b, a, f, g, i; + var j = ASN1HEX; + var d = j.getVbyList; + if (j.isASN1HEX(c) === false) { + throw "not ASN.1 hex string" + } + try { + b = d(c, 0, [1], "02"); + a = d(c, 0, [2], "02"); + f = d(c, 0, [3], "02"); + g = d(c, 0, [4], "02"); + i = d(c, 0, [5], "02") + } catch(e) { + console.log("EXCEPTION:" + e); + throw "malformed PKCS#1/5 plain DSA private key" + } + this.setPrivateHex(b, a, f, g, i) + }; + this.readPKCS8PrvKeyHex = function(d) { + var f, c, b, g; + var e = ASN1HEX; + var i = e.getVbyList; + if (e.isASN1HEX(d) === false) { + throw "not ASN.1 hex string" + } + try { + f = i(d, 0, [1, 1, 0], "02"); + c = i(d, 0, [1, 1, 1], "02"); + b = i(d, 0, [1, 1, 2], "02"); + g = i(d, 0, [2, 0], "02") + } catch(a) { + console.log("EXCEPTION:" + a); + throw "malformed PKCS#8 plain DSA private key" + } + this.setPrivateHex(f, c, b, null, g) + }; + this.readPKCS8PubKeyHex = function(d) { + var f, c, b, g; + var e = ASN1HEX; + var i = e.getVbyList; + if (e.isASN1HEX(d) === false) { + throw "not ASN.1 hex string" + } + try { + f = i(d, 0, [0, 1, 0], "02"); + c = i(d, 0, [0, 1, 1], "02"); + b = i(d, 0, [0, 1, 2], "02"); + g = i(d, 0, [1, 0], "02") + } catch(a) { + console.log("EXCEPTION:" + a); + throw "malformed PKCS#8 DSA public key" + } + this.setPublicHex(f, c, b, g) + }; + this.readCertPubKeyHex = function(c, f) { + if (f !== 5) { + f = 6 + } + var b, a, g, i; + var j = ASN1HEX; + var d = j.getVbyList; + if (j.isASN1HEX(c) === false) { + throw "not ASN.1 hex string" + } + try { + b = d(c, 0, [0, f, 0, 1, 0], "02"); + a = d(c, 0, [0, f, 0, 1, 1], "02"); + g = d(c, 0, [0, f, 0, 1, 2], "02"); + i = d(c, 0, [0, f, 1, 0], "02") + } catch(e) { + console.log("EXCEPTION:" + e); + throw "malformed X.509 certificate DSA public key" + } + this.setPublicHex(b, a, g, i) + } +}; +/*! pkcs5pkey-1.1.0.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var PKCS5PKEY = function() { + var c = function(o, q, p) { + return j(CryptoJS.AES, o, q, p) + }; + var d = function(o, q, p) { + return j(CryptoJS.TripleDES, o, q, p) + }; + var j = function(r, w, t, p) { + var q = CryptoJS.enc.Hex.parse(w); + var v = CryptoJS.enc.Hex.parse(t); + var o = CryptoJS.enc.Hex.parse(p); + var s = {}; + s.key = v; + s.iv = o; + s.ciphertext = q; + var u = r.decrypt(s, v, { + iv: o + }); + return CryptoJS.enc.Hex.stringify(u) + }; + var k = function(o, q, p) { + return e(CryptoJS.AES, o, q, p) + }; + var n = function(o, q, p) { + return e(CryptoJS.TripleDES, o, q, p) + }; + var e = function(t, y, w, q) { + var s = CryptoJS.enc.Hex.parse(y); + var x = CryptoJS.enc.Hex.parse(w); + var p = CryptoJS.enc.Hex.parse(q); + var o = {}; + var v = t.encrypt(s, x, { + iv: p + }); + var r = CryptoJS.enc.Hex.parse(v.toString()); + var u = CryptoJS.enc.Base64.stringify(r); + return u + }; + var g = { + "AES-256-CBC": { + proc: c, + eproc: k, + keylen: 32, + ivlen: 16 + }, + "AES-192-CBC": { + proc: c, + eproc: k, + keylen: 24, + ivlen: 16 + }, + "AES-128-CBC": { + proc: c, + eproc: k, + keylen: 16, + ivlen: 16 + }, + "DES-EDE3-CBC": { + proc: d, + eproc: n, + keylen: 24, + ivlen: 8 + } + }; + var b = function(o) { + return g[o]["proc"] + }; + var l = function(o) { + var q = CryptoJS.lib.WordArray.random(o); + var p = CryptoJS.enc.Hex.stringify(q); + return p + }; + var m = function(u) { + var v = {}; + var p = u.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)", "m")); + if (p) { + v.cipher = p[1]; + v.ivsalt = p[2] + } + var o = u.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----")); + if (o) { + v.type = o[1] + } + var t = -1; + var w = 0; + if (u.indexOf("\r\n\r\n") != -1) { + t = u.indexOf("\r\n\r\n"); + w = 2 + } + if (u.indexOf("\n\n") != -1) { + t = u.indexOf("\n\n"); + w = 1 + } + var r = u.indexOf("-----END"); + if (t != -1 && r != -1) { + var q = u.substring(t + w * 2, r - w); + q = q.replace(/\s+/g, ""); + v.data = q + } + return v + }; + var i = function(p, x, o) { + var u = o.substring(0, 16); + var s = CryptoJS.enc.Hex.parse(u); + var q = CryptoJS.enc.Utf8.parse(x); + var t = g[p]["keylen"] + g[p]["ivlen"]; + var w = ""; + var v = null; + for (;;) { + var r = CryptoJS.algo.MD5.create(); + if (v != null) { + r.update(v) + } + r.update(q); + r.update(s); + v = r.finalize(); + w = w + CryptoJS.enc.Hex.stringify(v); + if (w.length >= t * 2) { + break + } + } + var y = {}; + y.keyhex = w.substr(0, g[p]["keylen"] * 2); + y.ivhex = w.substr(g[p]["keylen"] * 2, g[p]["ivlen"] * 2); + return y + }; + var a = function(o, u, q, v) { + var r = CryptoJS.enc.Base64.parse(o); + var p = CryptoJS.enc.Hex.stringify(r); + var t = g[u]["proc"]; + var s = t(p, q, v); + return s + }; + var f = function(o, r, p, t) { + var q = g[r]["eproc"]; + var s = q(o, p, t); + return s + }; + return { + version: "1.0.5", + getHexFromPEM: function(o, p) { + return ASN1HEX.pemToHex(o, p) + }, + getDecryptedKeyHexByKeyIV: function(p, s, r, q) { + var o = b(s); + return o(p, r, q) + }, + parsePKCS5PEM: function(o) { + return m(o) + }, + getKeyAndUnusedIvByPasscodeAndIvsalt: function(p, o, q) { + return i(p, o, q) + }, + decryptKeyB64: function(o, q, p, r) { + return a(o, q, p, r) + }, + getDecryptedKeyHex: function(x, w) { + var p = m(x); + var s = p.type; + var q = p.cipher; + var o = p.ivsalt; + var r = p.data; + var v = i(q, w, o); + var u = v.keyhex; + var t = a(r, q, u, o); + return t + }, + getRSAKeyFromEncryptedPKCS5PEM: function(q, p) { + var r = this.getDecryptedKeyHex(q, p); + var o = new RSAKey(); + o.readPrivateKeyFromASN1HexString(r); + return o + }, + getEncryptedPKCS5PEMFromPrvKeyHex: function(r, y, s, q) { + if (typeof s == "undefined" || s == null) { + s = "AES-256-CBC" + } + if (typeof g[s] == "undefined") { + throw "PKCS5PKEY unsupported algorithm: " + s + } + if (typeof q == "undefined" || q == null) { + var u = g[s]["ivlen"]; + var t = l(u); + q = t.toUpperCase() + } + var x = i(s, y, q); + var w = x.keyhex; + var v = f(r, s, w, q); + var p = v.replace(/(.{64})/g, "$1\r\n"); + var o = "-----BEGIN RSA PRIVATE KEY-----\r\n"; + o += "Proc-Type: 4,ENCRYPTED\r\n"; + o += "DEK-Info: " + s + "," + q + "\r\n"; + o += "\r\n"; + o += p; + o += "\r\n-----END RSA PRIVATE KEY-----\r\n"; + return o + }, + getEncryptedPKCS5PEMFromRSAKey: function(C, D, o, s) { + var A = new KJUR.asn1.DERInteger({ + "int": 0 + }); + var v = new KJUR.asn1.DERInteger({ + bigint: C.n + }); + var z = new KJUR.asn1.DERInteger({ + "int": C.e + }); + var B = new KJUR.asn1.DERInteger({ + bigint: C.d + }); + var t = new KJUR.asn1.DERInteger({ + bigint: C.p + }); + var r = new KJUR.asn1.DERInteger({ + bigint: C.q + }); + var y = new KJUR.asn1.DERInteger({ + bigint: C.dmp1 + }); + var u = new KJUR.asn1.DERInteger({ + bigint: C.dmq1 + }); + var x = new KJUR.asn1.DERInteger({ + bigint: C.coeff + }); + var E = new KJUR.asn1.DERSequence({ + array: [A, v, z, B, t, r, y, u, x] + }); + var w = E.getEncodedHex(); + return this.getEncryptedPKCS5PEMFromPrvKeyHex(w, D, o, s) + }, + newEncryptedPKCS5PEM: function(o, p, s, t) { + if (typeof p == "undefined" || p == null) { + p = 1024 + } + if (typeof s == "undefined" || s == null) { + s = "10001" + } + var q = new RSAKey(); + q.generate(p, s); + var r = null; + if (typeof t == "undefined" || t == null) { + r = this.getEncryptedPKCS5PEMFromRSAKey(pkey, o) + } else { + r = this.getEncryptedPKCS5PEMFromRSAKey(pkey, o, t) + } + return r + }, + getRSAKeyFromPlainPKCS8PEM: function(q) { + if (q.match(/ENCRYPTED/)) { + throw "pem shall be not ENCRYPTED" + } + var p = ASN1HEX.pemToHex(q, "PRIVATE KEY"); + var o = this.getRSAKeyFromPlainPKCS8Hex(p); + return o + }, + getRSAKeyFromPlainPKCS8Hex: function(p) { + var o = new RSAKey(); + o.readPKCS8PrvKeyHex(p); + return o + }, + parseHexOfEncryptedPKCS8: function(v) { + var r = {}; + var q = ASN1HEX.getPosArrayOfChildren_AtObj(v, 0); + if (q.length != 2) { + throw "malformed format: SEQUENCE(0).items != 2: " + q.length + } + r.ciphertext = ASN1HEX.getHexOfV_AtObj(v, q[1]); + var x = ASN1HEX.getPosArrayOfChildren_AtObj(v, q[0]); + if (x.length != 2) { + throw "malformed format: SEQUENCE(0.0).items != 2: " + x.length + } + if (ASN1HEX.getHexOfV_AtObj(v, x[0]) != "2a864886f70d01050d") { + throw "this only supports pkcs5PBES2" + } + var o = ASN1HEX.getPosArrayOfChildren_AtObj(v, x[1]); + if (x.length != 2) { + throw "malformed format: SEQUENCE(0.0.1).items != 2: " + o.length + } + var p = ASN1HEX.getPosArrayOfChildren_AtObj(v, o[1]); + if (p.length != 2) { + throw "malformed format: SEQUENCE(0.0.1.1).items != 2: " + p.length + } + if (ASN1HEX.getHexOfV_AtObj(v, p[0]) != "2a864886f70d0307") { + throw "this only supports TripleDES" + } + r.encryptionSchemeAlg = "TripleDES"; + r.encryptionSchemeIV = ASN1HEX.getHexOfV_AtObj(v, p[1]); + var s = ASN1HEX.getPosArrayOfChildren_AtObj(v, o[0]); + if (s.length != 2) { + throw "malformed format: SEQUENCE(0.0.1.0).items != 2: " + s.length + } + if (ASN1HEX.getHexOfV_AtObj(v, s[0]) != "2a864886f70d01050c") { + throw "this only supports pkcs5PBKDF2" + } + var w = ASN1HEX.getPosArrayOfChildren_AtObj(v, s[1]); + if (w.length < 2) { + throw "malformed format: SEQUENCE(0.0.1.0.1).items < 2: " + w.length + } + r.pbkdf2Salt = ASN1HEX.getHexOfV_AtObj(v, w[0]); + var t = ASN1HEX.getHexOfV_AtObj(v, w[1]); + try { + r.pbkdf2Iter = parseInt(t, 16) + } catch(u) { + throw "malformed format pbkdf2Iter: " + t + } + return r + }, + getPBKDF2KeyHexFromParam: function(t, o) { + var s = CryptoJS.enc.Hex.parse(t.pbkdf2Salt); + var p = t.pbkdf2Iter; + var r = CryptoJS.PBKDF2(o, s, { + keySize: 192 / 32, + iterations: p + }); + var q = CryptoJS.enc.Hex.stringify(r); + return q + }, + getPlainPKCS8HexFromEncryptedPKCS8PEM: function(w, x) { + var q = ASN1HEX.pemToHex(w, "ENCRYPTED PRIVATE KEY"); + var o = this.parseHexOfEncryptedPKCS8(q); + var t = PKCS5PKEY.getPBKDF2KeyHexFromParam(o, x); + var u = {}; + u.ciphertext = CryptoJS.enc.Hex.parse(o.ciphertext); + var s = CryptoJS.enc.Hex.parse(t); + var r = CryptoJS.enc.Hex.parse(o.encryptionSchemeIV); + var v = CryptoJS.TripleDES.decrypt(u, s, { + iv: r + }); + var p = CryptoJS.enc.Hex.stringify(v); + return p + }, + getRSAKeyFromEncryptedPKCS8PEM: function(r, q) { + var p = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r, q); + var o = this.getRSAKeyFromPlainPKCS8Hex(p); + return o + }, + getKeyFromEncryptedPKCS8PEM: function(r, p) { + var o = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(r, p); + var q = this.getKeyFromPlainPrivatePKCS8Hex(o); + return q + }, + parsePlainPrivatePKCS8Hex: function(r) { + var p = {}; + p.algparam = null; + if (r.substr(0, 2) != "30") { + throw "malformed plain PKCS8 private key(code:001)" + } + var q = ASN1HEX.getPosArrayOfChildren_AtObj(r, 0); + if (q.length != 3) { + throw "malformed plain PKCS8 private key(code:002)" + } + if (r.substr(q[1], 2) != "30") { + throw "malformed PKCS8 private key(code:003)" + } + var o = ASN1HEX.getPosArrayOfChildren_AtObj(r, q[1]); + if (o.length != 2) { + throw "malformed PKCS8 private key(code:004)" + } + if (r.substr(o[0], 2) != "06") { + throw "malformed PKCS8 private key(code:005)" + } + p.algoid = ASN1HEX.getHexOfV_AtObj(r, o[0]); + if (r.substr(o[1], 2) == "06") { + p.algparam = ASN1HEX.getHexOfV_AtObj(r, o[1]) + } + if (r.substr(q[2], 2) != "04") { + throw "malformed PKCS8 private key(code:006)" + } + p.keyidx = ASN1HEX.getStartPosOfV_AtObj(r, q[2]); + return p + }, + getKeyFromPlainPrivatePKCS8PEM: function(p) { + var o = ASN1HEX.pemToHex(p, "PRIVATE KEY"); + var q = this.getKeyFromPlainPrivatePKCS8Hex(o); + return q + }, + getKeyFromPlainPrivatePKCS8Hex: function(o) { + var p = this.parsePlainPrivatePKCS8Hex(o); + var q; + if (p.algoid == "2a864886f70d010101") { + q = new RSAKey() + } else { + if (p.algoid == "2a8648ce380401") { + q = new KJUR.crypto.DSA() + } else { + if (p.algoid == "2a8648ce3d0201") { + q = new KJUR.crypto.ECDSA() + } else { + throw "unsupported private key algorithm" + } + } + } + q.readPKCS8PrvKeyHex(o); + return q + }, + getRSAKeyFromPublicPKCS8PEM: function(p) { + var q = ASN1HEX.pemToHex(p, "PUBLIC KEY"); + var o = this.getRSAKeyFromPublicPKCS8Hex(q); + return o + }, + getKeyFromPublicPKCS8PEM: function(p) { + var q = ASN1HEX.pemToHex(p, "PUBLIC KEY"); + var o = this.getKeyFromPublicPKCS8Hex(q); + return o + }, + getKeyFromPublicPKCS8Hex: function(o) { + var p; + var q = ASN1HEX.getVbyList(h, 0, [0, 0], "06"); + if (q === "2a864886f70d010101") { + p = new RSAKey() + } else { + if (q === "2a8648ce380401") { + p = new KJUR.crypto.DSA() + } else { + if (q === "2a8648ce3d0201") { + p = new KJUR.crypto.ECDSA() + } else { + throw "unsupported PKCS#8 public key hex" + } + } + } + p.readPKCS8PubKeyHex(h); + return p + }, + parsePublicRawRSAKeyHex: function(q) { + var o = {}; + if (q.substr(0, 2) != "30") { + throw "malformed RSA key(code:001)" + } + var p = ASN1HEX.getPosArrayOfChildren_AtObj(q, 0); + if (p.length != 2) { + throw "malformed RSA key(code:002)" + } + if (q.substr(p[0], 2) != "02") { + throw "malformed RSA key(code:003)" + } + o.n = ASN1HEX.getHexOfV_AtObj(q, p[0]); + if (q.substr(p[1], 2) != "02") { + throw "malformed RSA key(code:004)" + } + o.e = ASN1HEX.getHexOfV_AtObj(q, p[1]); + return o + }, + parsePrivateRawRSAKeyHexAtObj: function(p, r) { + var q = r.keyidx; + if (p.substr(q, 2) != "30") { + throw "malformed RSA private key(code:001)" + } + var o = ASN1HEX.getPosArrayOfChildren_AtObj(p, q); + if (o.length != 9) { + throw "malformed RSA private key(code:002)" + } + r.key = {}; + r.key.n = ASN1HEX.getHexOfV_AtObj(p, o[1]); + r.key.e = ASN1HEX.getHexOfV_AtObj(p, o[2]); + r.key.d = ASN1HEX.getHexOfV_AtObj(p, o[3]); + r.key.p = ASN1HEX.getHexOfV_AtObj(p, o[4]); + r.key.q = ASN1HEX.getHexOfV_AtObj(p, o[5]); + r.key.dp = ASN1HEX.getHexOfV_AtObj(p, o[6]); + r.key.dq = ASN1HEX.getHexOfV_AtObj(p, o[7]); + r.key.co = ASN1HEX.getHexOfV_AtObj(p, o[8]) + }, + parsePrivateRawECKeyHexAtObj: function(p, r) { + var q = r.keyidx; + if (p.substr(q, 2) != "30") { + throw "malformed ECC private key(code:001)" + } + var o = ASN1HEX.getPosArrayOfChildren_AtObj(p, q); + if (o.length != 3) { + throw "malformed ECC private key(code:002)" + } + if (p.substr(o[1], 2) != "04") { + throw "malformed ECC private key(code:003)" + } + r.key = ASN1HEX.getHexOfV_AtObj(p, o[1]) + }, + parsePublicPKCS8Hex: function(r) { + var p = {}; + p.algparam = null; + var q = ASN1HEX.getPosArrayOfChildren_AtObj(r, 0); + if (q.length != 2) { + throw "outer DERSequence shall have 2 elements: " + q.length + } + var s = q[0]; + if (r.substr(s, 2) != "30") { + throw "malformed PKCS8 public key(code:001)" + } + var o = ASN1HEX.getPosArrayOfChildren_AtObj(r, s); + if (o.length != 2) { + throw "malformed PKCS8 public key(code:002)" + } + if (r.substr(o[0], 2) != "06") { + throw "malformed PKCS8 public key(code:003)" + } + p.algoid = ASN1HEX.getHexOfV_AtObj(r, o[0]); + if (r.substr(o[1], 2) == "06") { + p.algparam = ASN1HEX.getHexOfV_AtObj(r, o[1]) + } + if (r.substr(q[1], 2) != "03") { + throw "malformed PKCS8 public key(code:004)" + } + p.key = ASN1HEX.getHexOfV_AtObj(r, q[1]).substr(2); + return p + }, + getRSAKeyFromPublicPKCS8Hex: function(o) { + var p = new RSAKey(); + p.readPKCS8PubKeyHex(o); + return p + }, + } +} (); +/*! keyutil-1.0.15.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var KEYUTIL = function() { + var d = function(p, r, q) { + return k(CryptoJS.AES, p, r, q) + }; + var e = function(p, r, q) { + return k(CryptoJS.TripleDES, p, r, q) + }; + var a = function(p, r, q) { + return k(CryptoJS.DES, p, r, q) + }; + var k = function(s, x, u, q) { + var r = CryptoJS.enc.Hex.parse(x); + var w = CryptoJS.enc.Hex.parse(u); + var p = CryptoJS.enc.Hex.parse(q); + var t = {}; + t.key = w; + t.iv = p; + t.ciphertext = r; + var v = s.decrypt(t, w, { + iv: p + }); + return CryptoJS.enc.Hex.stringify(v) + }; + var l = function(p, r, q) { + return g(CryptoJS.AES, p, r, q) + }; + var o = function(p, r, q) { + return g(CryptoJS.TripleDES, p, r, q) + }; + var f = function(p, r, q) { + return g(CryptoJS.DES, p, r, q) + }; + var g = function(t, y, v, q) { + var s = CryptoJS.enc.Hex.parse(y); + var x = CryptoJS.enc.Hex.parse(v); + var p = CryptoJS.enc.Hex.parse(q); + var w = t.encrypt(s, x, { + iv: p + }); + var r = CryptoJS.enc.Hex.parse(w.toString()); + var u = CryptoJS.enc.Base64.stringify(r); + return u + }; + var i = { + "AES-256-CBC": { + proc: d, + eproc: l, + keylen: 32, + ivlen: 16 + }, + "AES-192-CBC": { + proc: d, + eproc: l, + keylen: 24, + ivlen: 16 + }, + "AES-128-CBC": { + proc: d, + eproc: l, + keylen: 16, + ivlen: 16 + }, + "DES-EDE3-CBC": { + proc: e, + eproc: o, + keylen: 24, + ivlen: 8 + }, + "DES-CBC": { + proc: a, + eproc: f, + keylen: 8, + ivlen: 8 + } + }; + var c = function(p) { + return i[p]["proc"] + }; + var m = function(p) { + var r = CryptoJS.lib.WordArray.random(p); + var q = CryptoJS.enc.Hex.stringify(r); + return q + }; + var n = function(v) { + var w = {}; + var q = v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)", "m")); + if (q) { + w.cipher = q[1]; + w.ivsalt = q[2] + } + var p = v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----")); + if (p) { + w.type = p[1] + } + var u = -1; + var x = 0; + if (v.indexOf("\r\n\r\n") != -1) { + u = v.indexOf("\r\n\r\n"); + x = 2 + } + if (v.indexOf("\n\n") != -1) { + u = v.indexOf("\n\n"); + x = 1 + } + var t = v.indexOf("-----END"); + if (u != -1 && t != -1) { + var r = v.substring(u + x * 2, t - x); + r = r.replace(/\s+/g, ""); + w.data = r + } + return w + }; + var j = function(q, y, p) { + var v = p.substring(0, 16); + var t = CryptoJS.enc.Hex.parse(v); + var r = CryptoJS.enc.Utf8.parse(y); + var u = i[q]["keylen"] + i[q]["ivlen"]; + var x = ""; + var w = null; + for (;;) { + var s = CryptoJS.algo.MD5.create(); + if (w != null) { + s.update(w) + } + s.update(r); + s.update(t); + w = s.finalize(); + x = x + CryptoJS.enc.Hex.stringify(w); + if (x.length >= u * 2) { + break + } + } + var z = {}; + z.keyhex = x.substr(0, i[q]["keylen"] * 2); + z.ivhex = x.substr(i[q]["keylen"] * 2, i[q]["ivlen"] * 2); + return z + }; + var b = function(p, v, r, w) { + var s = CryptoJS.enc.Base64.parse(p); + var q = CryptoJS.enc.Hex.stringify(s); + var u = i[v]["proc"]; + var t = u(q, r, w); + return t + }; + var h = function(p, s, q, u) { + var r = i[s]["eproc"]; + var t = r(p, q, u); + return t + }; + return { + version: "1.0.0", + getHexFromPEM: function(p, q) { + return ASN1HEX.pemToHex(p, q) + }, + getDecryptedKeyHexByKeyIV: function(q, t, s, r) { + var p = c(t); + return p(q, s, r) + }, + parsePKCS5PEM: function(p) { + return n(p) + }, + getKeyAndUnusedIvByPasscodeAndIvsalt: function(q, p, r) { + return j(q, p, r) + }, + decryptKeyB64: function(p, r, q, s) { + return b(p, r, q, s) + }, + getDecryptedKeyHex: function(y, x) { + var q = n(y); + var t = q.type; + var r = q.cipher; + var p = q.ivsalt; + var s = q.data; + var w = j(r, x, p); + var v = w.keyhex; + var u = b(s, r, v, p); + return u + }, + getRSAKeyFromEncryptedPKCS5PEM: function(r, q) { + var s = this.getDecryptedKeyHex(r, q); + var p = new RSAKey(); + p.readPrivateKeyFromASN1HexString(s); + return p + }, + getEncryptedPKCS5PEMFromPrvKeyHex: function(x, s, A, t, r) { + var p = ""; + if (typeof t == "undefined" || t == null) { + t = "AES-256-CBC" + } + if (typeof i[t] == "undefined") { + throw "KEYUTIL unsupported algorithm: " + t + } + if (typeof r == "undefined" || r == null) { + var v = i[t]["ivlen"]; + var u = m(v); + r = u.toUpperCase() + } + var z = j(t, A, r); + var y = z.keyhex; + var w = h(s, t, y, r); + var q = w.replace(/(.{64})/g, "$1\r\n"); + var p = "-----BEGIN " + x + " PRIVATE KEY-----\r\n"; + p += "Proc-Type: 4,ENCRYPTED\r\n"; + p += "DEK-Info: " + t + "," + r + "\r\n"; + p += "\r\n"; + p += q; + p += "\r\n-----END " + x + " PRIVATE KEY-----\r\n"; + return p + }, + getEncryptedPKCS5PEMFromRSAKey: function(D, E, r, t) { + var B = new KJUR.asn1.DERInteger({ + "int": 0 + }); + var w = new KJUR.asn1.DERInteger({ + bigint: D.n + }); + var A = new KJUR.asn1.DERInteger({ + "int": D.e + }); + var C = new KJUR.asn1.DERInteger({ + bigint: D.d + }); + var u = new KJUR.asn1.DERInteger({ + bigint: D.p + }); + var s = new KJUR.asn1.DERInteger({ + bigint: D.q + }); + var z = new KJUR.asn1.DERInteger({ + bigint: D.dmp1 + }); + var v = new KJUR.asn1.DERInteger({ + bigint: D.dmq1 + }); + var y = new KJUR.asn1.DERInteger({ + bigint: D.coeff + }); + var F = new KJUR.asn1.DERSequence({ + array: [B, w, A, C, u, s, z, v, y] + }); + var x = F.getEncodedHex(); + return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA", x, E, r, t) + }, + newEncryptedPKCS5PEM: function(p, q, t, u) { + if (typeof q == "undefined" || q == null) { + q = 1024 + } + if (typeof t == "undefined" || t == null) { + t = "10001" + } + var r = new RSAKey(); + r.generate(q, t); + var s = null; + if (typeof u == "undefined" || u == null) { + s = this.getEncryptedPKCS5PEMFromRSAKey(r, p) + } else { + s = this.getEncryptedPKCS5PEMFromRSAKey(r, p, u) + } + return s + }, + getRSAKeyFromPlainPKCS8PEM: function(r) { + if (r.match(/ENCRYPTED/)) { + throw "pem shall be not ENCRYPTED" + } + var q = ASN1HEX.pemToHex(r, "PRIVATE KEY"); + var p = this.getRSAKeyFromPlainPKCS8Hex(q); + return p + }, + getRSAKeyFromPlainPKCS8Hex: function(q) { + var p = new RSAKey(); + p.readPKCS8PrvKeyHex(q); + return p + }, + parseHexOfEncryptedPKCS8: function(w) { + var s = {}; + var r = ASN1HEX.getPosArrayOfChildren_AtObj(w, 0); + if (r.length != 2) { + throw "malformed format: SEQUENCE(0).items != 2: " + r.length + } + s.ciphertext = ASN1HEX.getHexOfV_AtObj(w, r[1]); + var y = ASN1HEX.getPosArrayOfChildren_AtObj(w, r[0]); + if (y.length != 2) { + throw "malformed format: SEQUENCE(0.0).items != 2: " + y.length + } + if (ASN1HEX.getHexOfV_AtObj(w, y[0]) != "2a864886f70d01050d") { + throw "this only supports pkcs5PBES2" + } + var p = ASN1HEX.getPosArrayOfChildren_AtObj(w, y[1]); + if (y.length != 2) { + throw "malformed format: SEQUENCE(0.0.1).items != 2: " + p.length + } + var q = ASN1HEX.getPosArrayOfChildren_AtObj(w, p[1]); + if (q.length != 2) { + throw "malformed format: SEQUENCE(0.0.1.1).items != 2: " + q.length + } + if (ASN1HEX.getHexOfV_AtObj(w, q[0]) != "2a864886f70d0307") { + throw "this only supports TripleDES" + } + s.encryptionSchemeAlg = "TripleDES"; + s.encryptionSchemeIV = ASN1HEX.getHexOfV_AtObj(w, q[1]); + var t = ASN1HEX.getPosArrayOfChildren_AtObj(w, p[0]); + if (t.length != 2) { + throw "malformed format: SEQUENCE(0.0.1.0).items != 2: " + t.length + } + if (ASN1HEX.getHexOfV_AtObj(w, t[0]) != "2a864886f70d01050c") { + throw "this only supports pkcs5PBKDF2" + } + var x = ASN1HEX.getPosArrayOfChildren_AtObj(w, t[1]); + if (x.length < 2) { + throw "malformed format: SEQUENCE(0.0.1.0.1).items < 2: " + x.length + } + s.pbkdf2Salt = ASN1HEX.getHexOfV_AtObj(w, x[0]); + var u = ASN1HEX.getHexOfV_AtObj(w, x[1]); + try { + s.pbkdf2Iter = parseInt(u, 16) + } catch(v) { + throw "malformed format pbkdf2Iter: " + u + } + return s + }, + getPBKDF2KeyHexFromParam: function(u, p) { + var t = CryptoJS.enc.Hex.parse(u.pbkdf2Salt); + var q = u.pbkdf2Iter; + var s = CryptoJS.PBKDF2(p, t, { + keySize: 192 / 32, + iterations: q + }); + var r = CryptoJS.enc.Hex.stringify(s); + return r + }, + getPlainPKCS8HexFromEncryptedPKCS8PEM: function(x, y) { + var r = ASN1HEX.pemToHex(x, "ENCRYPTED PRIVATE KEY"); + var p = this.parseHexOfEncryptedPKCS8(r); + var u = KEYUTIL.getPBKDF2KeyHexFromParam(p, y); + var v = {}; + v.ciphertext = CryptoJS.enc.Hex.parse(p.ciphertext); + var t = CryptoJS.enc.Hex.parse(u); + var s = CryptoJS.enc.Hex.parse(p.encryptionSchemeIV); + var w = CryptoJS.TripleDES.decrypt(v, t, { + iv: s + }); + var q = CryptoJS.enc.Hex.stringify(w); + return q + }, + getRSAKeyFromEncryptedPKCS8PEM: function(s, r) { + var q = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s, r); + var p = this.getRSAKeyFromPlainPKCS8Hex(q); + return p + }, + getKeyFromEncryptedPKCS8PEM: function(s, q) { + var p = this.getPlainPKCS8HexFromEncryptedPKCS8PEM(s, q); + var r = this.getKeyFromPlainPrivatePKCS8Hex(p); + return r + }, + parsePlainPrivatePKCS8Hex: function(s) { + var q = {}; + q.algparam = null; + if (s.substr(0, 2) != "30") { + throw "malformed plain PKCS8 private key(code:001)" + } + var r = ASN1HEX.getPosArrayOfChildren_AtObj(s, 0); + if (r.length != 3) { + throw "malformed plain PKCS8 private key(code:002)" + } + if (s.substr(r[1], 2) != "30") { + throw "malformed PKCS8 private key(code:003)" + } + var p = ASN1HEX.getPosArrayOfChildren_AtObj(s, r[1]); + if (p.length != 2) { + throw "malformed PKCS8 private key(code:004)" + } + if (s.substr(p[0], 2) != "06") { + throw "malformed PKCS8 private key(code:005)" + } + q.algoid = ASN1HEX.getHexOfV_AtObj(s, p[0]); + if (s.substr(p[1], 2) == "06") { + q.algparam = ASN1HEX.getHexOfV_AtObj(s, p[1]) + } + if (s.substr(r[2], 2) != "04") { + throw "malformed PKCS8 private key(code:006)" + } + q.keyidx = ASN1HEX.getStartPosOfV_AtObj(s, r[2]); + return q + }, + getKeyFromPlainPrivatePKCS8PEM: function(q) { + var p = ASN1HEX.pemToHex(q, "PRIVATE KEY"); + var r = this.getKeyFromPlainPrivatePKCS8Hex(p); + return r + }, + getKeyFromPlainPrivatePKCS8Hex: function(p) { + var q = this.parsePlainPrivatePKCS8Hex(p); + var r; + if (q.algoid == "2a864886f70d010101") { + r = new RSAKey() + } else { + if (q.algoid == "2a8648ce380401") { + r = new KJUR.crypto.DSA() + } else { + if (q.algoid == "2a8648ce3d0201") { + r = new KJUR.crypto.ECDSA() + } else { + throw "unsupported private key algorithm" + } + } + } + r.readPKCS8PrvKeyHex(p); + return r + }, + getRSAKeyFromPublicPKCS8PEM: function(q) { + var r = ASN1HEX.pemToHex(q, "PUBLIC KEY"); + var p = this.getRSAKeyFromPublicPKCS8Hex(r); + return p + }, + getKeyFromPublicPKCS8PEM: function(q) { + var r = ASN1HEX.pemToHex(q, "PUBLIC KEY"); + var p = this.getKeyFromPublicPKCS8Hex(r); + return p + }, + getKeyFromPublicPKCS8Hex: function(q) { + var p; + var r = ASN1HEX.getVbyList(q, 0, [0, 0], "06"); + if (r === "2a864886f70d010101") { + p = new RSAKey() + } else { + if (r === "2a8648ce380401") { + p = new KJUR.crypto.DSA() + } else { + if (r === "2a8648ce3d0201") { + p = new KJUR.crypto.ECDSA() + } else { + throw "unsupported PKCS#8 public key hex" + } + } + } + p.readPKCS8PubKeyHex(q); + return p + }, + parsePublicRawRSAKeyHex: function(r) { + var p = {}; + if (r.substr(0, 2) != "30") { + throw "malformed RSA key(code:001)" + } + var q = ASN1HEX.getPosArrayOfChildren_AtObj(r, 0); + if (q.length != 2) { + throw "malformed RSA key(code:002)" + } + if (r.substr(q[0], 2) != "02") { + throw "malformed RSA key(code:003)" + } + p.n = ASN1HEX.getHexOfV_AtObj(r, q[0]); + if (r.substr(q[1], 2) != "02") { + throw "malformed RSA key(code:004)" + } + p.e = ASN1HEX.getHexOfV_AtObj(r, q[1]); + return p + }, + parsePrivateRawRSAKeyHexAtObj: function(q, u) { + var t = ASN1HEX; + var r = t.getHexOfV_AtObj; + var s = t.getDecendantIndexByNthList(q, 0, [2, 0]); + var p = t.getPosArrayOfChildren_AtObj(q, s); + if (p.length !== 9) { + throw "malformed PKCS#8 plain RSA private key" + } + u.key = {}; + u.key.n = r(q, p[1]); + u.key.e = r(q, p[2]); + u.key.d = r(q, p[3]); + u.key.p = r(q, p[4]); + u.key.q = r(q, p[5]); + u.key.dp = r(q, p[6]); + u.key.dq = r(q, p[7]); + u.key.co = r(q, p[8]) + }, + parsePrivateRawECKeyHexAtObj: function(p, t) { + var s = ASN1HEX; + var q = t.keyidx; + var r = new KJUR.crypto.ECDSA(); + r.readPKCS8PrvKeyHex(p); + t.key = r.prvKeyHex; + t.pubkey = r.pubKeyHex + }, + parsePublicPKCS8Hex: function(s) { + var q = {}; + q.algparam = null; + var r = ASN1HEX.getPosArrayOfChildren_AtObj(s, 0); + if (r.length != 2) { + throw "outer DERSequence shall have 2 elements: " + r.length + } + var t = r[0]; + if (s.substr(t, 2) != "30") { + throw "malformed PKCS8 public key(code:001)" + } + var p = ASN1HEX.getPosArrayOfChildren_AtObj(s, t); + if (p.length != 2) { + throw "malformed PKCS8 public key(code:002)" + } + if (s.substr(p[0], 2) != "06") { + throw "malformed PKCS8 public key(code:003)" + } + q.algoid = ASN1HEX.getHexOfV_AtObj(s, p[0]); + if (s.substr(p[1], 2) == "06") { + q.algparam = ASN1HEX.getHexOfV_AtObj(s, p[1]) + } else { + if (s.substr(p[1], 2) == "30") { + q.algparam = {}; + q.algparam.p = ASN1HEX.getVbyList(s, p[1], [0], "02"); + q.algparam.q = ASN1HEX.getVbyList(s, p[1], [1], "02"); + q.algparam.g = ASN1HEX.getVbyList(s, p[1], [2], "02") + } + } + if (s.substr(r[1], 2) != "03") { + throw "malformed PKCS8 public key(code:004)" + } + q.key = ASN1HEX.getHexOfV_AtObj(s, r[1]).substr(2); + return q + }, + getRSAKeyFromPublicPKCS8Hex: function(p) { + var q = new RSAKey(); + q.readPKCS8PubKeyHex(p); + return q + }, + } +} (); +KEYUTIL.getKey = function(i, f, j) { + if (typeof RSAKey != "undefined" && i instanceof RSAKey) { + return i + } + if (typeof KJUR.crypto.ECDSA != "undefined" && i instanceof KJUR.crypto.ECDSA) { + return i + } + if (typeof KJUR.crypto.DSA != "undefined" && i instanceof KJUR.crypto.DSA) { + return i + } + if (i.curve !== undefined && i.xy !== undefined && i.d === undefined) { + return new KJUR.crypto.ECDSA({ + pub: i.xy, + curve: i.curve + }) + } + if (i.curve !== undefined && i.d !== undefined) { + return new KJUR.crypto.ECDSA({ + prv: i.d, + curve: i.curve + }) + } + if (i.kty === undefined && i.n !== undefined && i.e !== undefined && i.d === undefined) { + var D = new RSAKey(); + D.setPublic(i.n, i.e); + return D + } + if (i.kty === undefined && i.n !== undefined && i.e !== undefined && i.d !== undefined && i.p !== undefined && i.q !== undefined && i.dp !== undefined && i.dq !== undefined && i.co !== undefined && i.qi === undefined) { + var D = new RSAKey(); + D.setPrivateEx(i.n, i.e, i.d, i.p, i.q, i.dp, i.dq, i.co); + return D + } + if (i.kty === undefined && i.n !== undefined && i.e !== undefined && i.d !== undefined && i.p === undefined) { + var D = new RSAKey(); + D.setPrivate(i.n, i.e, i.d); + return D + } + if (i.p !== undefined && i.q !== undefined && i.g !== undefined && i.y !== undefined && i.x === undefined) { + var D = new KJUR.crypto.DSA(); + D.setPublic(i.p, i.q, i.g, i.y); + return D + } + if (i.p !== undefined && i.q !== undefined && i.g !== undefined && i.y !== undefined && i.x !== undefined) { + var D = new KJUR.crypto.DSA(); + D.setPrivate(i.p, i.q, i.g, i.y, i.x); + return D + } + if (i.kty === "RSA" && i.n !== undefined && i.e !== undefined && i.d === undefined) { + var D = new RSAKey(); + D.setPublic(b64utohex(i.n), b64utohex(i.e)); + return D + } + if (i.kty === "RSA" && i.n !== undefined && i.e !== undefined && i.d !== undefined && i.p !== undefined && i.q !== undefined && i.dp !== undefined && i.dq !== undefined && i.qi !== undefined) { + + var D = new RSAKey(); + D.setPrivateEx(b64utohex(i.n), b64utohex(i.e), b64utohex(i.d), b64utohex(i.p), b64utohex(i.q), b64utohex(i.dp), b64utohex(i.dq), b64utohex(i.qi)); + return D + } + if (i.kty === "RSA" && i.n !== undefined && i.e !== undefined && i.d !== undefined) { + + var D = new RSAKey(); + D.setPrivate(b64utohex(i.n), b64utohex(i.e), b64utohex(i.d)); + return D + } + if (i.kty === "EC" && i.crv !== undefined && i.x !== undefined && i.y !== undefined && i.d === undefined) { + var e = new KJUR.crypto.ECDSA({ + curve: i.crv + }); + var n = e.ecparams.keylen / 4; + var t = ("0000000000" + b64utohex(i.x)).slice( - n); + var r = ("0000000000" + b64utohex(i.y)).slice( - n); + var o = "04" + t + r; + e.setPublicKeyHex(o); + return e + } + if (i.kty === "EC" && i.crv !== undefined && i.x !== undefined && i.y !== undefined && i.d !== undefined) { + var e = new KJUR.crypto.ECDSA({ + curve: i.crv + }); + var n = e.ecparams.keylen / 4; + var t = ("0000000000" + b64utohex(i.x)).slice( - n); + var r = ("0000000000" + b64utohex(i.y)).slice( - n); + var o = "04" + t + r; + var b = ("0000000000" + b64utohex(i.d)).slice( - n); + e.setPublicKeyHex(o); + e.setPrivateKeyHex(b); + return e + } + if (j === "pkcs5prv") { + + var A = i, + w = ASN1HEX, + C, D; + C = w.getPosArrayOfChildren_AtObj(A, 0); + + if (C.length === 9) { + D = new RSAKey(); + D.readPrivateKeyFromASN1HexString(i) + } else { + if (C.length === 6) { + D = new KJUR.crypto.DSA(); + D.readPKCS5PrvKeyHex(A) + } else { + if (C.length > 2 && A.substr(C[1], 2) === "04") { + D = new KJUR.crypto.ECDSA(); + D.readPKCS5PrvKeyHex(A) + } else { + throw "unsupported PKCS#1/5 hexadecimal key" + } + } + } + + return D + } + if (j === "pkcs8prv") { + var D = KEYUTIL.getKeyFromPlainPrivatePKCS8Hex(i); + return D + } + if (j === "pkcs8pub") { + return KEYUTIL.getKeyFromPublicPKCS8Hex(i) + } + if (j === "x509pub") { + return X509.getPublicKeyFromCertHex(i) + } + if (i.indexOf("-END CERTIFICATE-", 0) != -1 || i.indexOf("-END X509 CERTIFICATE-", 0) != -1 || i.indexOf("-END TRUSTED CERTIFICATE-", 0) != -1) { + return X509.getPublicKeyFromCertPEM(i) + } + if (i.indexOf("-END PUBLIC KEY-") != -1) { + return KEYUTIL.getKeyFromPublicPKCS8PEM(i) + } + if (i.indexOf("-END RSA PRIVATE KEY-") != -1 && i.indexOf("4,ENCRYPTED") == -1) { + var k = ASN1HEX.pemToHex(i, "RSA PRIVATE KEY"); + return KEYUTIL.getKey(k, null, "pkcs5prv") + } + if (i.indexOf("-END DSA PRIVATE KEY-") != -1 && i.indexOf("4,ENCRYPTED") == -1) { + var z = ASN1HEX.pemToHex(i, "DSA PRIVATE KEY"); + var v = ASN1HEX.getVbyList(z, 0, [1], "02"); + var u = ASN1HEX.getVbyList(z, 0, [2], "02"); + var B = ASN1HEX.getVbyList(z, 0, [3], "02"); + var l = ASN1HEX.getVbyList(z, 0, [4], "02"); + var m = ASN1HEX.getVbyList(z, 0, [5], "02"); + var D = new KJUR.crypto.DSA(); + D.setPrivate(new BigInteger(v, 16), new BigInteger(u, 16), new BigInteger(B, 16), new BigInteger(l, 16), new BigInteger(m, 16)); + return D + } + if (i.indexOf("-END PRIVATE KEY-") != -1) { + return KEYUTIL.getKeyFromPlainPrivatePKCS8PEM(i) + } + if (i.indexOf("-END RSA PRIVATE KEY-") != -1 && i.indexOf("4,ENCRYPTED") != -1) { + return KEYUTIL.getRSAKeyFromEncryptedPKCS5PEM(i, f) + } + if (i.indexOf("-END EC PRIVATE KEY-") != -1 && i.indexOf("4,ENCRYPTED") != -1) { + var z = KEYUTIL.getDecryptedKeyHex(i, f); + var D = ASN1HEX.getVbyList(z, 0, [1], "04"); + var d = ASN1HEX.getVbyList(z, 0, [2, 0], "06"); + var s = ASN1HEX.getVbyList(z, 0, [3, 0], "03").substr(2); + var c = ""; + if (KJUR.crypto.OID.oidhex2name[d] !== undefined) { + c = KJUR.crypto.OID.oidhex2name[d] + } else { + throw "undefined OID(hex) in KJUR.crypto.OID: " + d + } + var e = new KJUR.crypto.ECDSA({ + curve: c + }); + e.setPublicKeyHex(s); + e.setPrivateKeyHex(D); + e.isPublic = false; + return e + } + if (i.indexOf("-END DSA PRIVATE KEY-") != -1 && i.indexOf("4,ENCRYPTED") != -1) { + var z = KEYUTIL.getDecryptedKeyHex(i, f); + var v = ASN1HEX.getVbyList(z, 0, [1], "02"); + var u = ASN1HEX.getVbyList(z, 0, [2], "02"); + var B = ASN1HEX.getVbyList(z, 0, [3], "02"); + var l = ASN1HEX.getVbyList(z, 0, [4], "02"); + var m = ASN1HEX.getVbyList(z, 0, [5], "02"); + var D = new KJUR.crypto.DSA(); + D.setPrivate(new BigInteger(v, 16), new BigInteger(u, 16), new BigInteger(B, 16), new BigInteger(l, 16), new BigInteger(m, 16)); + return D + } + if (i.indexOf("-END ENCRYPTED PRIVATE KEY-") != -1) { + return KEYUTIL.getKeyFromEncryptedPKCS8PEM(i, f) + } + throw "not supported argument" +}; +KEYUTIL.generateKeypair = function(a, c) { + if (a == "RSA") { + var b = c; + var h = new RSAKey(); + h.generate(b, "10001"); + h.isPrivate = true; + h.isPublic = true; + var f = new RSAKey(); + var e = h.n.toString(16); + var i = h.e.toString(16); + f.setPublic(e, i); + f.isPrivate = false; + f.isPublic = true; + var k = {}; + k.prvKeyObj = h; + k.pubKeyObj = f; + return k + } else { + if (a == "EC") { + var d = c; + var g = new KJUR.crypto.ECDSA({ + curve: d + }); + var j = g.generateKeyPairHex(); + var h = new KJUR.crypto.ECDSA({ + curve: d + }); + h.setPublicKeyHex(j.ecpubhex); + h.setPrivateKeyHex(j.ecprvhex); + h.isPrivate = true; + h.isPublic = false; + var f = new KJUR.crypto.ECDSA({ + curve: d + }); + f.setPublicKeyHex(j.ecpubhex); + f.isPrivate = false; + f.isPublic = true; + var k = {}; + k.prvKeyObj = h; + k.pubKeyObj = f; + return k + } else { + throw "unknown algorithm: " + a + } + } +}; +KEYUTIL.getPEM = function(a, r, o, g, j) { + var v = KJUR.asn1; + var u = KJUR.crypto; + function p(s) { + var w = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 0 + }, + { + "int": { + bigint: s.n + } + }, + { + "int": s.e + }, + { + "int": { + bigint: s.d + } + }, + { + "int": { + bigint: s.p + } + }, + { + "int": { + bigint: s.q + } + }, + { + "int": { + bigint: s.dmp1 + } + }, + { + "int": { + bigint: s.dmq1 + } + }, + { + "int": { + bigint: s.coeff + } + }] + }); + return w + } + function q(w) { + var s = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 1 + }, + { + octstr: { + hex: w.prvKeyHex + } + }, + { + tag: ["a0", true, { + oid: { + name: w.curveName + } + }] + }, + { + tag: ["a1", true, { + bitstr: { + hex: "00" + w.pubKeyHex + } + }] + }] + }); + return s + } + function n(s) { + var w = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 0 + }, + { + "int": { + bigint: s.p + } + }, + { + "int": { + bigint: s.q + } + }, + { + "int": { + bigint: s.g + } + }, + { + "int": { + bigint: s.y + } + }, + { + "int": { + bigint: s.x + } + }] + }); + return w + } + if (((typeof RSAKey != "undefined" && a instanceof RSAKey) || (typeof u.DSA != "undefined" && a instanceof u.DSA) || (typeof u.ECDSA != "undefined" && a instanceof u.ECDSA)) && a.isPublic == true && (r === undefined || r == "PKCS8PUB")) { + var t = new KJUR.asn1.x509.SubjectPublicKeyInfo(a); + var m = t.getEncodedHex(); + return v.ASN1Util.getPEMStringFromHex(m, "PUBLIC KEY") + } + if (r == "PKCS1PRV" && typeof RSAKey != "undefined" && a instanceof RSAKey && (o === undefined || o == null) && a.isPrivate == true) { + var t = p(a); + var m = t.getEncodedHex(); + return v.ASN1Util.getPEMStringFromHex(m, "RSA PRIVATE KEY") + } + if (r == "PKCS1PRV" && typeof RSAKey != "undefined" && a instanceof KJUR.crypto.ECDSA && (o === undefined || o == null) && a.isPrivate == true) { + var f = new KJUR.asn1.DERObjectIdentifier({ + name: a.curveName + }); + var l = f.getEncodedHex(); + var e = q(a); + var k = e.getEncodedHex(); + var i = ""; + i += v.ASN1Util.getPEMStringFromHex(l, "EC PARAMETERS"); + i += v.ASN1Util.getPEMStringFromHex(k, "EC PRIVATE KEY"); + return i + } + if (r == "PKCS1PRV" && typeof KJUR.crypto.DSA != "undefined" && a instanceof KJUR.crypto.DSA && (o === undefined || o == null) && a.isPrivate == true) { + var t = n(a); + var m = t.getEncodedHex(); + return v.ASN1Util.getPEMStringFromHex(m, "DSA PRIVATE KEY") + } + if (r == "PKCS5PRV" && typeof RSAKey != "undefined" && a instanceof RSAKey && (o !== undefined && o != null) && a.isPrivate == true) { + var t = p(a); + var m = t.getEncodedHex(); + if (g === undefined) { + g = "DES-EDE3-CBC" + } + return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA", m, o, g) + } + if (r == "PKCS5PRV" && typeof KJUR.crypto.ECDSA != "undefined" && a instanceof KJUR.crypto.ECDSA && (o !== undefined && o != null) && a.isPrivate == true) { + var t = q(a); + var m = t.getEncodedHex(); + if (g === undefined) { + g = "DES-EDE3-CBC" + } + return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC", m, o, g) + } + if (r == "PKCS5PRV" && typeof KJUR.crypto.DSA != "undefined" && a instanceof KJUR.crypto.DSA && (o !== undefined && o != null) && a.isPrivate == true) { + var t = n(a); + var m = t.getEncodedHex(); + if (g === undefined) { + g = "DES-EDE3-CBC" + } + return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA", m, o, g) + } + var h = function(w, s) { + var y = b(w, s); + var x = new KJUR.asn1.ASN1Util.newObject({ + seq: [{ + seq: [{ + oid: { + name: "pkcs5PBES2" + } + }, + { + seq: [{ + seq: [{ + oid: { + name: "pkcs5PBKDF2" + } + }, + { + seq: [{ + octstr: { + hex: y.pbkdf2Salt + } + }, + { + "int": y.pbkdf2Iter + }] + }] + }, + { + seq: [{ + oid: { + name: "des-EDE3-CBC" + } + }, + { + octstr: { + hex: y.encryptionSchemeIV + } + }] + }] + }] + }, + { + octstr: { + hex: y.ciphertext + } + }] + }); + return x.getEncodedHex() + }; + var b = function(D, E) { + var x = 100; + var C = CryptoJS.lib.WordArray.random(8); + var B = "DES-EDE3-CBC"; + var s = CryptoJS.lib.WordArray.random(8); + var y = CryptoJS.PBKDF2(E, C, { + keySize: 192 / 32, + iterations: x + }); + var z = CryptoJS.enc.Hex.parse(D); + var A = CryptoJS.TripleDES.encrypt(z, y, { + iv: s + }) + ""; + var w = {}; + w.ciphertext = A; + w.pbkdf2Salt = CryptoJS.enc.Hex.stringify(C); + w.pbkdf2Iter = x; + w.encryptionSchemeAlg = B; + w.encryptionSchemeIV = CryptoJS.enc.Hex.stringify(s); + return w + }; + if (r == "PKCS8PRV" && typeof RSAKey != "undefined" && a instanceof RSAKey && a.isPrivate == true) { + var d = p(a); + var c = d.getEncodedHex(); + var t = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 0 + }, + { + seq: [{ + oid: { + name: "rsaEncryption" + } + }, + { + "null": true + }] + }, + { + octstr: { + hex: c + } + }] + }); + var m = t.getEncodedHex(); + if (o === undefined || o == null) { + return v.ASN1Util.getPEMStringFromHex(m, "PRIVATE KEY") + } else { + var k = h(m, o); + return v.ASN1Util.getPEMStringFromHex(k, "ENCRYPTED PRIVATE KEY") + } + } + if (r == "PKCS8PRV" && typeof KJUR.crypto.ECDSA != "undefined" && a instanceof KJUR.crypto.ECDSA && a.isPrivate == true) { + var d = new KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 1 + }, + { + octstr: { + hex: a.prvKeyHex + } + }, + { + tag: ["a1", true, { + bitstr: { + hex: "00" + a.pubKeyHex + } + }] + }] + }); + var c = d.getEncodedHex(); + var t = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 0 + }, + { + seq: [{ + oid: { + name: "ecPublicKey" + } + }, + { + oid: { + name: a.curveName + } + }] + }, + { + octstr: { + hex: c + } + }] + }); + var m = t.getEncodedHex(); + if (o === undefined || o == null) { + return v.ASN1Util.getPEMStringFromHex(m, "PRIVATE KEY") + } else { + var k = h(m, o); + return v.ASN1Util.getPEMStringFromHex(k, "ENCRYPTED PRIVATE KEY") + } + } + if (r == "PKCS8PRV" && typeof KJUR.crypto.DSA != "undefined" && a instanceof KJUR.crypto.DSA && a.isPrivate == true) { + var d = new KJUR.asn1.DERInteger({ + bigint: a.x + }); + var c = d.getEncodedHex(); + var t = KJUR.asn1.ASN1Util.newObject({ + seq: [{ + "int": 0 + }, + { + seq: [{ + oid: { + name: "dsa" + } + }, + { + seq: [{ + "int": { + bigint: a.p + } + }, + { + "int": { + bigint: a.q + } + }, + { + "int": { + bigint: a.g + } + }] + }] + }, + { + octstr: { + hex: c + } + }] + }); + var m = t.getEncodedHex(); + if (o === undefined || o == null) { + return v.ASN1Util.getPEMStringFromHex(m, "PRIVATE KEY") + } else { + var k = h(m, o); + return v.ASN1Util.getPEMStringFromHex(k, "ENCRYPTED PRIVATE KEY") + } + } + throw "unsupported object nor format" +}; +KEYUTIL.getKeyFromCSRPEM = function(b) { + var a = ASN1HEX.pemToHex(b, "CERTIFICATE REQUEST"); + var c = KEYUTIL.getKeyFromCSRHex(a); + return c +}; +KEYUTIL.getKeyFromCSRHex = function(a) { + var c = KEYUTIL.parseCSRHex(a); + var b = KEYUTIL.getKey(c.p8pubkeyhex, null, "pkcs8pub"); + return b +}; +KEYUTIL.parseCSRHex = function(c) { + var b = {}; + var e = c; + if (e.substr(0, 2) != "30") { + throw "malformed CSR(code:001)" + } + var d = ASN1HEX.getPosArrayOfChildren_AtObj(e, 0); + if (d.length < 1) { + throw "malformed CSR(code:002)" + } + if (e.substr(d[0], 2) != "30") { + throw "malformed CSR(code:003)" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(e, d[0]); + if (a.length < 3) { + throw "malformed CSR(code:004)" + } + b.p8pubkeyhex = ASN1HEX.getHexOfTLV_AtObj(e, a[2]); + return b +}; +KEYUTIL.getJWKFromKey = function(d) { + var b = {}; + if (d instanceof RSAKey && d.isPrivate) { + b.kty = "RSA"; + b.n = hextob64u(d.n.toString(16)); + b.e = hextob64u(d.e.toString(16)); + b.d = hextob64u(d.d.toString(16)); + b.p = hextob64u(d.p.toString(16)); + b.q = hextob64u(d.q.toString(16)); + b.dp = hextob64u(d.dmp1.toString(16)); + b.dq = hextob64u(d.dmq1.toString(16)); + b.qi = hextob64u(d.coeff.toString(16)); + return b + } else { + if (d instanceof RSAKey && d.isPublic) { + b.kty = "RSA"; + b.n = hextob64u(d.n.toString(16)); + b.e = hextob64u(d.e.toString(16)); + return b + } else { + if (d instanceof KJUR.crypto.ECDSA && d.isPrivate) { + var a = d.getShortNISTPCurveName(); + if (a !== "P-256" && a !== "P-384") { + throw "unsupported curve name for JWT: " + a + } + var c = d.getPublicKeyXYHex(); + b.kty = "EC"; + b.crv = a; + b.x = hextob64u(c.x); + b.y = hextob64u(c.y); + b.d = hextob64u(d.prvKeyHex); + return b + } else { + if (d instanceof KJUR.crypto.ECDSA && d.isPublic) { + var a = d.getShortNISTPCurveName(); + if (a !== "P-256" && a !== "P-384") { + throw "unsupported curve name for JWT: " + a + } + var c = d.getPublicKeyXYHex(); + b.kty = "EC"; + b.crv = a; + b.x = hextob64u(c.x); + b.y = hextob64u(c.y); + return b + } + } + } + } + throw "not supported key object" +}; +/*! rsapem-1.2.0.js (c) 2012-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +RSAKey.pemToBase64 = function(b) { + var a = b; + a = a.replace("-----BEGIN RSA PRIVATE KEY-----", ""); + a = a.replace("-----END RSA PRIVATE KEY-----", ""); + a = a.replace(/[ \n]+/g, ""); + return a +}; +RSAKey.getPosArrayOfChildrenFromHex = function(g) { + var j = new Array(); + var i = ASN1HEX.getStartPosOfV_AtObj(g, 0); + var b = ASN1HEX.getPosOfNextSibling_AtObj(g, i); + var e = ASN1HEX.getPosOfNextSibling_AtObj(g, b); + var f = ASN1HEX.getPosOfNextSibling_AtObj(g, e); + var l = ASN1HEX.getPosOfNextSibling_AtObj(g, f); + var k = ASN1HEX.getPosOfNextSibling_AtObj(g, l); + var d = ASN1HEX.getPosOfNextSibling_AtObj(g, k); + var c = ASN1HEX.getPosOfNextSibling_AtObj(g, d); + var h = ASN1HEX.getPosOfNextSibling_AtObj(g, c); + j.push(i, b, e, f, l, k, d, c, h); + return j +}; +RSAKey.getHexValueArrayOfChildrenFromHex = function(f) { + var l = RSAKey.getPosArrayOfChildrenFromHex(f); + var e = ASN1HEX.getHexOfV_AtObj(f, l[0]); + var j = ASN1HEX.getHexOfV_AtObj(f, l[1]); + var b = ASN1HEX.getHexOfV_AtObj(f, l[2]); + var c = ASN1HEX.getHexOfV_AtObj(f, l[3]); + var h = ASN1HEX.getHexOfV_AtObj(f, l[4]); + var g = ASN1HEX.getHexOfV_AtObj(f, l[5]); + var m = ASN1HEX.getHexOfV_AtObj(f, l[6]); + var k = ASN1HEX.getHexOfV_AtObj(f, l[7]); + var d = ASN1HEX.getHexOfV_AtObj(f, l[8]); + var i = new Array(); + i.push(e, j, b, c, h, g, m, k, d); + return i +}; +RSAKey.prototype.readPrivateKeyFromPEMString = function(e) { + var c = RSAKey.pemToBase64(e); + var d = b64tohex(c); + var b = RSAKey.getHexValueArrayOfChildrenFromHex(d); + this.setPrivateEx(b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8]) +}; +RSAKey.prototype.readPrivateKeyFromASN1HexString = function(a) { + this.readPKCS5PrvKeyHex(a) +}; +RSAKey.prototype.readPKCS5PrvKeyHex = function(c) { + var b = RSAKey.getHexValueArrayOfChildrenFromHex(c); + this.setPrivateEx(b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8]) +}; +RSAKey.prototype.readPKCS8PrvKeyHex = function(e) { + var c, j, l, b, a, f, d, k; + var m = ASN1HEX; + var g = m.getVbyList; + if (m.isASN1HEX(e) === false) { + throw "not ASN.1 hex string" + } + try { + c = g(e, 0, [2, 0, 1], "02"); + j = g(e, 0, [2, 0, 2], "02"); + l = g(e, 0, [2, 0, 3], "02"); + b = g(e, 0, [2, 0, 4], "02"); + a = g(e, 0, [2, 0, 5], "02"); + f = g(e, 0, [2, 0, 6], "02"); + d = g(e, 0, [2, 0, 7], "02"); + k = g(e, 0, [2, 0, 8], "02") + } catch(i) { + throw "malformed PKCS#8 plain RSA private key" + } + this.setPrivateEx(c, j, l, b, a, f, d, k) +}; +RSAKey.prototype.readPKCS5PubKeyHex = function(b) { + if (ASN1HEX.isASN1HEX(b) === false) { + throw "keyHex is not ASN.1 hex string" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(b, 0); + if (a.length !== 2 || b.substr(a[0], 2) !== "02" || b.substr(a[1], 2) !== "02") { + throw "wrong hex for PKCS#5 public key" + } + var d = ASN1HEX.getHexOfV_AtObj(b, a[0]); + var c = ASN1HEX.getHexOfV_AtObj(b, a[1]); + this.setPublic(d, c) +}; +RSAKey.prototype.readPKCS8PubKeyHex = function(b) { + if (ASN1HEX.isASN1HEX(b) === false) { + throw "not ASN.1 hex string" + } + if (ASN1HEX.getDecendantHexTLVByNthList(b, 0, [0, 0]) !== "06092a864886f70d010101") { + throw "not PKCS8 RSA public key" + } + var a = ASN1HEX.getDecendantHexTLVByNthList(b, 0, [1, 0]); + this.readPKCS5PubKeyHex(a) +}; +RSAKey.prototype.readCertPubKeyHex = function(b, c) { + if (c !== 5) { + c = 6 + } + if (ASN1HEX.isASN1HEX(b) === false) { + throw "not ASN.1 hex string" + } + var a = ASN1HEX.getDecendantHexTLVByNthList(b, 0, [0, c]); + this.readPKCS8PubKeyHex(a) +}; +/*! rsasign-1.2.7.js (c) 2012 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +var _RE_HEXDECONLY = new RegExp(""); +_RE_HEXDECONLY.compile("[^0-9a-f]", "gi"); +function _rsasign_getHexPaddedDigestInfoForString(d, e, a) { + var b = function(f) { + return KJUR.crypto.Util.hashString(f, a) + }; + var c = b(d); + return KJUR.crypto.Util.getPaddedDigestInfoHex(c, a, e) +} +function _zeroPaddingOfSignature(e, d) { + var c = ""; + var a = d / 4 - e.length; + for (var b = 0; b < a; b++) { + c = c + "0" + } + return c + e +} +function _rsasign_signString(d, a) { + + var b = function(e) { + return KJUR.crypto.Util.hashString(e, a) + }; + var c = b(d); + return this.signWithMessageHash(c, a) +} +function _rsasign_signWithMessageHash(e, c) { + var f = KJUR.crypto.Util.getPaddedDigestInfoHex(e, c, this.n.bitLength()); + var b = parseBigInt(f, 16); + var d = this.doPrivate(b); + var a = d.toString(16); + return _zeroPaddingOfSignature(a, this.n.bitLength()) +} +function _rsasign_signStringWithSHA1(a) { + return _rsasign_signString.call(this, a, "sha1") +} +function _rsasign_signStringWithSHA256(a) { + return _rsasign_signString.call(this, a, "sha256") +} +function pss_mgf1_str(c, a, e) { + var b = "", + d = 0; + while (b.length < a) { + b += hextorstr(e(rstrtohex(c + String.fromCharCode.apply(String, [(d & 4278190080) >> 24, (d & 16711680) >> 16, (d & 65280) >> 8, d & 255])))); + d += 1 + } + return b +} +function _rsasign_signStringPSS(e, a, d) { + var c = function(f) { + return KJUR.crypto.Util.hashHex(f, a) + }; + var b = c(rstrtohex(e)); + if (d === undefined) { + d = -1 + } + return this.signWithMessageHashPSS(b, a, d) +} +function _rsasign_signWithMessageHashPSS(l, a, k) { + var b = hextorstr(l); + var g = b.length; + var m = this.n.bitLength() - 1; + var c = Math.ceil(m / 8); + var d; + var o = function(i) { + return KJUR.crypto.Util.hashHex(i, a) + }; + if (k === -1 || k === undefined) { + k = g + } else { + if (k === -2) { + k = c - g - 2 + } else { + if (k < -2) { + throw "invalid salt length" + } + } + } + if (c < (g + k + 2)) { + throw "data too long" + } + var f = ""; + if (k > 0) { + f = new Array(k); + new SecureRandom().nextBytes(f); + f = String.fromCharCode.apply(String, f) + } + var n = hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00" + b + f))); + var j = []; + for (d = 0; d < c - k - g - 2; d += 1) { + j[d] = 0 + } + var e = String.fromCharCode.apply(String, j) + "\x01" + f; + var h = pss_mgf1_str(n, e.length, o); + var q = []; + for (d = 0; d < e.length; d += 1) { + q[d] = e.charCodeAt(d) ^ h.charCodeAt(d) + } + var p = (65280 >> (8 * c - m)) & 255; + q[0] &= ~p; + for (d = 0; d < g; d++) { + q.push(n.charCodeAt(d)) + } + q.push(188); + return _zeroPaddingOfSignature(this.doPrivate(new BigInteger(q)).toString(16), this.n.bitLength()) +} +function _rsasign_getDecryptSignatureBI(a, d, c) { + var b = new RSAKey(); + b.setPublic(d, c); + var e = b.doPublic(a); + return e +} +function _rsasign_getHexDigestInfoFromSig(a, c, b) { + var e = _rsasign_getDecryptSignatureBI(a, c, b); + var d = e.toString(16).replace(/^1f+00/, ""); + return d +} +function _rsasign_getAlgNameAndHashFromHexDisgestInfo(f) { + for (var e in KJUR.crypto.Util.DIGESTINFOHEAD) { + var d = KJUR.crypto.Util.DIGESTINFOHEAD[e]; + var b = d.length; + if (f.substring(0, b) == d) { + var c = [e, f.substring(b)]; + return c + } + } + return [] +} +function _rsasign_verifySignatureWithArgs(f, b, g, j) { + var e = _rsasign_getHexDigestInfoFromSig(b, g, j); + var h = _rsasign_getAlgNameAndHashFromHexDisgestInfo(e); + if (h.length == 0) { + return false + } + var d = h[0]; + var i = h[1]; + var a = function(k) { + return KJUR.crypto.Util.hashString(k, d) + }; + var c = a(f); + return (i == c) +} +function _rsasign_verifyHexSignatureForMessage(c, b) { + var d = parseBigInt(c, 16); + var a = _rsasign_verifySignatureWithArgs(b, d, this.n.toString(16), this.e.toString(16)); + return a +} +function _rsasign_verifyString(f, j) { + j = j.replace(_RE_HEXDECONLY, ""); + j = j.replace(/[ \n]+/g, ""); + var b = parseBigInt(j, 16); + if (b.bitLength() > this.n.bitLength()) { + return 0 + } + var i = this.doPublic(b); + var e = i.toString(16).replace(/^1f+00/, ""); + var g = _rsasign_getAlgNameAndHashFromHexDisgestInfo(e); + if (g.length == 0) { + return false + } + var d = g[0]; + var h = g[1]; + var a = function(k) { + return KJUR.crypto.Util.hashString(k, d) + }; + var c = a(f); + return (h == c) +} +function _rsasign_verifyWithMessageHash(e, a) { + a = a.replace(_RE_HEXDECONLY, ""); + a = a.replace(/[ \n]+/g, ""); + var b = parseBigInt(a, 16); + if (b.bitLength() > this.n.bitLength()) { + return 0 + } + var h = this.doPublic(b); + var g = h.toString(16).replace(/^1f+00/, ""); + var c = _rsasign_getAlgNameAndHashFromHexDisgestInfo(g); + if (c.length == 0) { + return false + } + var d = c[0]; + var f = c[1]; + return (f == e) +} +function _rsasign_verifyStringPSS(c, b, a, f) { + var e = function(g) { + return KJUR.crypto.Util.hashHex(g, a) + }; + var d = e(rstrtohex(c)); + if (f === undefined) { + f = -1 + } + return this.verifyWithMessageHashPSS(d, b, a, f) +} +function _rsasign_verifyWithMessageHashPSS(f, s, l, c) { + var k = new BigInteger(s, 16); + if (k.bitLength() > this.n.bitLength()) { + return false + } + var r = function(i) { + return KJUR.crypto.Util.hashHex(i, l) + }; + var j = hextorstr(f); + var h = j.length; + var g = this.n.bitLength() - 1; + var m = Math.ceil(g / 8); + var q; + if (c === -1 || c === undefined) { + c = h + } else { + if (c === -2) { + c = m - h - 2 + } else { + if (c < -2) { + throw "invalid salt length" + } + } + } + if (m < (h + c + 2)) { + throw "data too long" + } + var a = this.doPublic(k).toByteArray(); + for (q = 0; q < a.length; q += 1) { + a[q] &= 255 + } + while (a.length < m) { + a.unshift(0) + } + if (a[m - 1] !== 188) { + throw "encoded message does not end in 0xbc" + } + a = String.fromCharCode.apply(String, a); + var d = a.substr(0, m - h - 1); + var e = a.substr(d.length, h); + var p = (65280 >> (8 * m - g)) & 255; + if ((d.charCodeAt(0) & p) !== 0) { + throw "bits beyond keysize not zero" + } + var n = pss_mgf1_str(e, d.length, r); + var o = []; + for (q = 0; q < d.length; q += 1) { + o[q] = d.charCodeAt(q) ^ n.charCodeAt(q) + } + o[0] &= ~p; + var b = m - h - c - 2; + for (q = 0; q < b; q += 1) { + if (o[q] !== 0) { + throw "leftmost octets not zero" + } + } + if (o[b] !== 1) { + throw "0x01 marker not found" + } + return e === hextorstr(r(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00" + j + String.fromCharCode.apply(String, o.slice( - c))))) +} +RSAKey.prototype.signWithMessageHash = _rsasign_signWithMessageHash; +RSAKey.prototype.signString = _rsasign_signString; +RSAKey.prototype.signStringWithSHA1 = _rsasign_signStringWithSHA1; +RSAKey.prototype.signStringWithSHA256 = _rsasign_signStringWithSHA256; +RSAKey.prototype.sign = _rsasign_signString; +RSAKey.prototype.signWithSHA1 = _rsasign_signStringWithSHA1; +RSAKey.prototype.signWithSHA256 = _rsasign_signStringWithSHA256; +RSAKey.prototype.signWithMessageHashPSS = _rsasign_signWithMessageHashPSS; +RSAKey.prototype.signStringPSS = _rsasign_signStringPSS; +RSAKey.prototype.signPSS = _rsasign_signStringPSS; +RSAKey.SALT_LEN_HLEN = -1; +RSAKey.SALT_LEN_MAX = -2; +RSAKey.prototype.verifyWithMessageHash = _rsasign_verifyWithMessageHash; +RSAKey.prototype.verifyString = _rsasign_verifyString; +RSAKey.prototype.verifyHexSignatureForMessage = _rsasign_verifyHexSignatureForMessage; +RSAKey.prototype.verify = _rsasign_verifyString; +RSAKey.prototype.verifyHexSignatureForByteArrayMessage = _rsasign_verifyHexSignatureForMessage; +RSAKey.prototype.verifyWithMessageHashPSS = _rsasign_verifyWithMessageHashPSS; +RSAKey.prototype.verifyStringPSS = _rsasign_verifyStringPSS; +RSAKey.prototype.verifyPSS = _rsasign_verifyStringPSS; +RSAKey.SALT_LEN_RECOVER = -2; +/*! x509-1.1.12.js (c) 2012-2017 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +function X509() { + this.subjectPublicKeyRSA = null; + this.subjectPublicKeyRSA_hN = null; + this.subjectPublicKeyRSA_hE = null; + this.hex = null; + this.getSerialNumberHex = function() { + return ASN1HEX.getDecendantHexVByNthList(this.hex, 0, [0, 1]) + }; + this.getSignatureAlgorithmField = function() { + var b = ASN1HEX.getDecendantHexVByNthList(this.hex, 0, [0, 2, 0]); + var a = KJUR.asn1.ASN1Util.oidHexToInt(b); + var c = KJUR.asn1.x509.OID.oid2name(a); + return c + }; + this.getIssuerHex = function() { + return ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 3]) + }; + this.getIssuerString = function() { + return X509.hex2dn(ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 3])) + }; + this.getSubjectHex = function() { + return ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 5]) + }; + this.getSubjectString = function() { + return X509.hex2dn(ASN1HEX.getDecendantHexTLVByNthList(this.hex, 0, [0, 5])) + }; + this.getNotBefore = function() { + var a = ASN1HEX.getDecendantHexVByNthList(this.hex, 0, [0, 4, 0]); + a = a.replace(/(..)/g, "%$1"); + a = decodeURIComponent(a); + return a + }; + this.getNotAfter = function() { + var a = ASN1HEX.getDecendantHexVByNthList(this.hex, 0, [0, 4, 1]); + a = a.replace(/(..)/g, "%$1"); + a = decodeURIComponent(a); + return a + }; + this.readCertPEM = function(c) { + var e = ASN1HEX.pemToHex(c); + var b = X509.getPublicKeyHexArrayFromCertHex(e); + var d = new RSAKey(); + d.setPublic(b[0], b[1]); + this.subjectPublicKeyRSA = d; + this.subjectPublicKeyRSA_hN = b[0]; + this.subjectPublicKeyRSA_hE = b[1]; + this.hex = e + }; + this.readCertPEMWithoutRSAInit = function(c) { + var d = ASN1HEX.pemToHex(c); + var b = X509.getPublicKeyHexArrayFromCertHex(d); + if (typeof this.subjectPublicKeyRSA.setPublic === "function") { + this.subjectPublicKeyRSA.setPublic(b[0], b[1]) + } + this.subjectPublicKeyRSA_hN = b[0]; + this.subjectPublicKeyRSA_hE = b[1]; + this.hex = d + }; + this.getInfo = function() { + var p = "Basic Fields\n"; + p += " serial number: " + this.getSerialNumberHex() + "\n"; + p += " signature algorithm: " + this.getSignatureAlgorithmField() + "\n"; + p += " issuer: " + this.getIssuerString() + "\n"; + p += " notBefore: " + this.getNotBefore() + "\n"; + p += " notAfter: " + this.getNotAfter() + "\n"; + p += " subject: " + this.getSubjectString() + "\n"; + p += " subject public key info: \n"; + var j = X509.getSubjectPublicKeyInfoPosFromCertHex(this.hex); + var d = ASN1HEX.getHexOfTLV_AtObj(this.hex, j); + var n = KEYUTIL.getKey(d, null, "pkcs8pub"); + if (n instanceof RSAKey) { + p += " key algorithm: RSA\n"; + p += " n=" + n.n.toString(16).substr(0, 16) + "...\n"; + p += " e=" + n.e.toString(16) + "\n" + } + p += "X509v3 Extensions:\n"; + var m = X509.getV3ExtInfoListOfCertHex(this.hex); + for (var e = 0; e < m.length; e++) { + var b = m[e]; + var o = KJUR.asn1.x509.OID.oid2name(b.oid); + if (o === "") { + o = b.oid + } + var k = ""; + if (b.critical === true) { + k = "CRITICAL" + } + p += " " + o + " " + k + ":\n"; + if (o === "basicConstraints") { + var g = X509.getExtBasicConstraints(this.hex); + if (g.cA === undefined) { + p += " {}\n" + } else { + p += " cA=true"; + if (g.pathLen !== undefined) { + p += ", pathLen=" + g.pathLen + } + p += "\n" + } + } else { + if (o === "keyUsage") { + p += " " + X509.getExtKeyUsageString(this.hex) + "\n" + } else { + if (o === "subjectKeyIdentifier") { + p += " " + X509.getExtSubjectKeyIdentifier(this.hex) + "\n" + } else { + if (o === "authorityKeyIdentifier") { + var a = X509.getExtAuthorityKeyIdentifier(this.hex); + if (a.kid !== undefined) { + p += " kid=" + a.kid + "\n" + } + } else { + if (o === "extKeyUsage") { + var h = X509.getExtExtKeyUsageName(this.hex); + p += " " + h.join(", ") + "\n" + } else { + if (o === "subjectAltName") { + var f = X509.getExtSubjectAltName(this.hex); + p += " " + f.join(", ") + "\n" + } else { + if (o === "cRLDistributionPoints") { + var l = X509.getExtCRLDistributionPointsURI(this.hex); + p += " " + l + "\n" + } else { + if (o === "authorityInfoAccess") { + var c = X509.getExtAIAInfo(this.hex); + if (c.ocsp !== undefined) { + p += " ocsp: " + c.ocsp.join(",") + "\n" + } + if (c.caissuer !== undefined) { + p += " caissuer: " + c.caissuer.join(",") + "\n" + } + } + } + } + } + } + } + } + } + } + p += "signature algorithm: " + X509.getSignatureAlgorithmName(this.hex) + "\n"; + p += "signature: " + X509.getSignatureValueHex(this.hex).substr(0, 16) + "...\n"; + return p + } +} +X509.pemToBase64 = function(a) { + var b = a; + b = b.replace("-----BEGIN CERTIFICATE-----", ""); + b = b.replace("-----END CERTIFICATE-----", ""); + b = b.replace(/[ \n]+/g, ""); + return b +}; +X509.pemToHex = function(a) { + return ASN1HEX.pemToHex(a) +}; +X509.getSubjectPublicKeyPosFromCertHex = function(f) { + var e = X509.getSubjectPublicKeyInfoPosFromCertHex(f); + if (e == -1) { + return - 1 + } + var b = ASN1HEX.getPosArrayOfChildren_AtObj(f, e); + if (b.length != 2) { + return - 1 + } + var d = b[1]; + if (f.substring(d, d + 2) != "03") { + return - 1 + } + var c = ASN1HEX.getStartPosOfV_AtObj(f, d); + if (f.substring(c, c + 2) != "00") { + return - 1 + } + return c + 2 +}; +X509.getSubjectPublicKeyInfoPosFromCertHex = function(d) { + var c = ASN1HEX.getStartPosOfV_AtObj(d, 0); + var b = ASN1HEX.getPosArrayOfChildren_AtObj(d, c); + if (b.length < 1) { + return - 1 + } + if (d.substring(b[0], b[0] + 10) == "a003020102") { + if (b.length < 6) { + return - 1 + } + return b[6] + } else { + if (b.length < 5) { + return - 1 + } + return b[5] + } +}; +X509.getPublicKeyHexArrayFromCertHex = function(f) { + var e = X509.getSubjectPublicKeyPosFromCertHex(f); + var b = ASN1HEX.getPosArrayOfChildren_AtObj(f, e); + if (b.length != 2) { + return [] + } + var d = ASN1HEX.getHexOfV_AtObj(f, b[0]); + var c = ASN1HEX.getHexOfV_AtObj(f, b[1]); + if (d != null && c != null) { + return [d, c] + } else { + return [] + } +}; +X509.getHexTbsCertificateFromCert = function(b) { + var a = ASN1HEX.getStartPosOfV_AtObj(b, 0); + return a +}; +X509.getPublicKeyHexArrayFromCertPEM = function(c) { + var d = ASN1HEX.pemToHex(c); + var b = X509.getPublicKeyHexArrayFromCertHex(d); + return b +}; +X509.hex2dn = function(f, b) { + if (b === undefined) { + b = 0 + } + if (f.substr(b, 2) !== "30") { + throw "malformed DN" + } + var c = new Array(); + var d = ASN1HEX.getPosArrayOfChildren_AtObj(f, b); + for (var e = 0; e < d.length; e++) { + c.push(X509.hex2rdn(f, d[e])) + } + c = c.map(function(a) { + return a.replace("/", "\\/") + }); + return "/" + c.join("/") +}; +X509.hex2rdn = function(f, b) { + if (b === undefined) { + b = 0 + } + if (f.substr(b, 2) !== "31") { + throw "malformed RDN" + } + var c = new Array(); + var d = ASN1HEX.getPosArrayOfChildren_AtObj(f, b); + for (var e = 0; e < d.length; e++) { + c.push(X509.hex2attrTypeValue(f, d[e])) + } + c = c.map(function(a) { + return a.replace("+", "\\+") + }); + return c.join("+") +}; +X509.hex2attrTypeValue = function(g, b) { + if (b === undefined) { + b = 0 + } + if (g.substr(b, 2) !== "30") { + throw "malformed attribute type and value" + } + var c = ASN1HEX.getPosArrayOfChildren_AtObj(g, b); + if (c.length !== 2 || g.substr(c[0], 2) !== "06") { + "malformed attribute type and value" + } + var d = ASN1HEX.getHexOfV_AtObj(g, c[0]); + var h = KJUR.asn1.ASN1Util.oidHexToInt(d); + var f = KJUR.asn1.x509.OID.oid2atype(h); + var a = ASN1HEX.getHexOfV_AtObj(g, c[1]); + var e = hextorstr(a); + return f + "=" + e +}; +X509.getPublicKeyFromCertHex = function(c) { + var a, e, b; + var g = 6; + var d = ASN1HEX; + var f = d.getVbyList; + b = d.getDecendantHexTLVByNthList(c, 0, [0, 0]); + if (b !== "a003020102") { + g = 5 + } + e = f(c, 0, [0, g, 0, 0], "06"); + if (e === "2a864886f70d010101") { + a = new RSAKey() + } else { + if (e === "2a8648ce380401") { + a = new KJUR.crypto.DSA() + } else { + if (e === "2a8648ce3d0201") { + a = new KJUR.crypto.ECDSA() + } else { + throw "unsupported public key in X.509 cert" + } + } + } + a.readCertPubKeyHex(c, g); + return a +}; +X509.getPublicKeyFromCertPEM = function(a) { + var c = ASN1HEX; + var b = c.pemToHex(a); + return X509.getPublicKeyFromCertHex(b) +}; +X509.getPublicKeyInfoPropOfCertPEM = function(e) { + var i = {}; + i.algparam = null; + var f = ASN1HEX.pemToHex(e); + var d = ASN1HEX.getPosArrayOfChildren_AtObj(f, 0); + if (d.length != 3) { + throw "malformed X.509 certificate PEM (code:001)" + } + if (f.substr(d[0], 2) != "30") { + throw "malformed X.509 certificate PEM (code:002)" + } + var c = ASN1HEX.getPosArrayOfChildren_AtObj(f, d[0]); + var g = 6; + if (f.substr(c[0], 2) !== "a0") { + g = 5 + } + if (c.length < g + 1) { + throw "malformed X.509 certificate PEM (code:003)" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(f, c[g]); + if (a.length != 2) { + throw "malformed X.509 certificate PEM (code:004)" + } + var h = ASN1HEX.getPosArrayOfChildren_AtObj(f, a[0]); + if (h.length != 2) { + throw "malformed X.509 certificate PEM (code:005)" + } + i.algoid = ASN1HEX.getHexOfV_AtObj(f, h[0]); + if (f.substr(h[1], 2) == "06") { + i.algparam = ASN1HEX.getHexOfV_AtObj(f, h[1]) + } else { + if (f.substr(h[1], 2) == "30") { + i.algparam = ASN1HEX.getHexOfTLV_AtObj(f, h[1]) + } + } + if (f.substr(a[1], 2) != "03") { + throw "malformed X.509 certificate PEM (code:006)" + } + var b = ASN1HEX.getHexOfV_AtObj(f, a[1]); + i.keyhex = b.substr(2); + return i +}; +X509.getPublicKeyInfoPosOfCertHEX = function(c) { + var b = ASN1HEX.getPosArrayOfChildren_AtObj(c, 0); + if (b.length != 3) { + throw "malformed X.509 certificate PEM (code:001)" + } + if (c.substr(b[0], 2) != "30") { + throw "malformed X.509 certificate PEM (code:002)" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(c, b[0]); + if (a.length < 7) { + throw "malformed X.509 certificate PEM (code:003)" + } + return a[6] +}; +X509.getV3ExtInfoListOfCertHex = function(g) { + var b = ASN1HEX.getPosArrayOfChildren_AtObj(g, 0); + if (b.length != 3) { + throw "malformed X.509 certificate PEM (code:001)" + } + if (g.substr(b[0], 2) != "30") { + throw "malformed X.509 certificate PEM (code:002)" + } + var a = ASN1HEX.getPosArrayOfChildren_AtObj(g, b[0]); + if (a.length < 8) { + throw "malformed X.509 certificate PEM (code:003)" + } + if (g.substr(a[7], 2) != "a3") { + throw "malformed X.509 certificate PEM (code:004)" + } + var h = ASN1HEX.getPosArrayOfChildren_AtObj(g, a[7]); + if (h.length != 1) { + throw "malformed X.509 certificate PEM (code:005)" + } + if (g.substr(h[0], 2) != "30") { + throw "malformed X.509 certificate PEM (code:006)" + } + var f = ASN1HEX.getPosArrayOfChildren_AtObj(g, h[0]); + var e = f.length; + var d = new Array(e); + for (var c = 0; c < e; c++) { + d[c] = X509.getV3ExtItemInfo_AtObj(g, f[c]) + } + return d +}; +X509.getV3ExtItemInfo_AtObj = function(f, g) { + var e = {}; + e.posTLV = g; + var b = ASN1HEX.getPosArrayOfChildren_AtObj(f, g); + if (b.length != 2 && b.length != 3) { + throw "malformed X.509v3 Ext (code:001)" + } + if (f.substr(b[0], 2) != "06") { + throw "malformed X.509v3 Ext (code:002)" + } + var d = ASN1HEX.getHexOfV_AtObj(f, b[0]); + e.oid = ASN1HEX.hextooidstr(d); + e.critical = false; + if (b.length == 3) { + e.critical = true + } + var c = b[b.length - 1]; + if (f.substr(c, 2) != "04") { + throw "malformed X.509v3 Ext (code:003)" + } + e.posV = ASN1HEX.getStartPosOfV_AtObj(f, c); + return e +}; +X509.getHexOfTLV_V3ExtValue = function(b, a) { + var c = X509.getPosOfTLV_V3ExtValue(b, a); + if (c == -1) { + return null + } + return ASN1HEX.getHexOfTLV_AtObj(b, c) +}; +X509.getHexOfV_V3ExtValue = function(b, a) { + var c = X509.getPosOfTLV_V3ExtValue(b, a); + if (c == -1) { + return null + } + return ASN1HEX.getHexOfV_AtObj(b, c) +}; +X509.getPosOfTLV_V3ExtValue = function(f, b) { + var d = b; + if (!b.match(/^[0-9.]+$/)) { + d = KJUR.asn1.x509.OID.name2oid(b) + } + if (d == "") { + return - 1 + } + var c = X509.getV3ExtInfoListOfCertHex(f); + for (var a = 0; a < c.length; a++) { + var e = c[a]; + if (e.oid == d) { + return e.posV + } + } + return - 1 +}; +X509.getExtBasicConstraints = function(d) { + var a = X509.getHexOfV_V3ExtValue(d, "basicConstraints"); + if (a === null) { + return null + } + if (a === "") { + return {} + } + if (a === "0101ff") { + return { + cA: true + } + } + if (a.substr(0, 8) === "0101ff02") { + var c = ASN1HEX.getHexOfV_AtObj(a, 6); + var b = parseInt(c, 16); + return { + cA: true, + pathLen: b + } + } + throw "unknown error" +}; +X509.KEYUSAGE_NAME = ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; +X509.getExtKeyUsageBin = function(d) { + var b = X509.getHexOfV_V3ExtValue(d, "keyUsage"); + if (b == "") { + return "" + } + if (b.length % 2 != 0 || b.length <= 2) { + throw "malformed key usage value" + } + var a = parseInt(b.substr(0, 2)); + var c = parseInt(b.substr(2), 16).toString(2); + return c.substr(0, c.length - a) +}; +X509.getExtKeyUsageString = function(e) { + var d = X509.getExtKeyUsageBin(e); + var b = new Array(); + for (var c = 0; c < d.length; c++) { + if (d.substr(c, 1) == "1") { + b.push(X509.KEYUSAGE_NAME[c]) + } + } + return b.join(",") +}; +X509.getExtSubjectKeyIdentifier = function(b) { + var a = X509.getHexOfV_V3ExtValue(b, "subjectKeyIdentifier"); + return a +}; +X509.getExtAuthorityKeyIdentifier = function(f) { + var b = {}; + var e = X509.getHexOfTLV_V3ExtValue(f, "authorityKeyIdentifier"); + if (e === null) { + return null + } + var c = ASN1HEX.getPosArrayOfChildren_AtObj(e, 0); + for (var d = 0; d < c.length; d++) { + if (e.substr(c[d], 2) === "80") { + b.kid = ASN1HEX.getHexOfV_AtObj(e, c[d]) + } + } + return b +}; +X509.getExtExtKeyUsageName = function(k) { + var b = new Array(); + var f = X509.getHexOfTLV_V3ExtValue(k, "extKeyUsage"); + if (f === null) { + return null + } + var c = ASN1HEX.getPosArrayOfChildren_AtObj(f, 0); + for (var e = 0; e < c.length; e++) { + var j = ASN1HEX.getHexOfV_AtObj(f, c[e]); + var g = KJUR.asn1.ASN1Util.oidHexToInt(j); + var d = KJUR.asn1.x509.OID.oid2name(g); + b.push(d) + } + return b +}; +X509.getExtSubjectAltName = function(g) { + var b = new Array(); + var f = X509.getHexOfTLV_V3ExtValue(g, "subjectAltName"); + var c = ASN1HEX.getPosArrayOfChildren_AtObj(f, 0); + for (var e = 0; e < c.length; e++) { + if (f.substr(c[e], 2) === "82") { + var d = hextoutf8(ASN1HEX.getHexOfV_AtObj(f, c[e])); + b.push(d) + } + } + return b +}; +X509.getExtCRLDistributionPointsURI = function(n) { + var p = new Array(); + var k = X509.getHexOfTLV_V3ExtValue(n, "cRLDistributionPoints"); + var o = ASN1HEX.getPosArrayOfChildren_AtObj(k, 0); + for (var g = 0; g < o.length; g++) { + var l = ASN1HEX.getHexOfTLV_AtObj(k, o[g]); + var b = ASN1HEX.getPosArrayOfChildren_AtObj(l, 0); + for (var e = 0; e < b.length; e++) { + if (l.substr(b[e], 2) === "a0") { + var f = ASN1HEX.getHexOfV_AtObj(l, b[e]); + if (f.substr(0, 2) === "a0") { + var c = ASN1HEX.getHexOfV_AtObj(f, 0); + if (c.substr(0, 2) === "86") { + var m = ASN1HEX.getHexOfV_AtObj(c, 0); + var d = hextoutf8(m); + p.push(d) + } + } + } + } + } + return p +}; +X509.getExtAIAInfo = function(g) { + var j = {}; + j.ocsp = []; + j.caissuer = []; + var h = X509.getPosOfTLV_V3ExtValue(g, "authorityInfoAccess"); + if (h == -1) { + return null + } + if (g.substr(h, 2) != "30") { + throw "malformed AIA Extn Value" + } + var d = ASN1HEX.getPosArrayOfChildren_AtObj(g, h); + for (var c = 0; c < d.length; c++) { + var a = d[c]; + var b = ASN1HEX.getPosArrayOfChildren_AtObj(g, a); + if (b.length != 2) { + throw "malformed AccessDescription of AIA Extn" + } + var e = b[0]; + var f = b[1]; + if (ASN1HEX.getHexOfV_AtObj(g, e) == "2b06010505073001") { + if (g.substr(f, 2) == "86") { + j.ocsp.push(hextoutf8(ASN1HEX.getHexOfV_AtObj(g, f))) + } + } + if (ASN1HEX.getHexOfV_AtObj(g, e) == "2b06010505073002") { + if (g.substr(f, 2) == "86") { + j.caissuer.push(hextoutf8(ASN1HEX.getHexOfV_AtObj(g, f))) + } + } + } + return j +}; +X509.getSignatureAlgorithmName = function(d) { + var b = ASN1HEX.getDecendantHexVByNthList(d, 0, [1, 0]); + var a = KJUR.asn1.ASN1Util.oidHexToInt(b); + var c = KJUR.asn1.x509.OID.oid2name(a); + return c +}; +X509.getSignatureValueHex = function(b) { + var a = ASN1HEX.getDecendantHexVByNthList(b, 0, [2]); + if (a.substr(0, 2) !== "00") { + throw "can't get signature value" + } + return a.substr(2) +}; +X509.getSerialNumberHex = function(a) { + return ASN1HEX.getDecendantHexVByNthList(a, 0, [0, 1]) +}; +X509.verifySignature = function(f, c) { + var d = X509.getSignatureAlgorithmName(f); + var a = X509.getSignatureValueHex(f); + var b = ASN1HEX.getDecendantHexTLVByNthList(f, 0, [0]); + var e = new KJUR.crypto.Signature({ + alg: d + }); + e.init(c); + e.updateHex(b); + return e.verify(a) +}; +/*! jws-3.3.5 (c) 2013-2016 Kenji Urushima | kjur.github.com/jsrsasign/license + */ +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.jws == "undefined" || !KJUR.jws) { + KJUR.jws = {} +} +KJUR.jws.JWS = function() { + var a = KJUR.jws.JWS; + this.parseJWS = function(e, h) { + if ((this.parsedJWS !== undefined) && (h || (this.parsedJWS.sigvalH !== undefined))) { + return + } + var g = e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/); + if (g == null) { + throw "JWS signature is not a form of 'Head.Payload.SigValue'." + } + var i = g[1]; + var c = g[2]; + var j = g[3]; + var l = i + "." + c; + this.parsedJWS = {}; + this.parsedJWS.headB64U = i; + this.parsedJWS.payloadB64U = c; + this.parsedJWS.sigvalB64U = j; + this.parsedJWS.si = l; + if (!h) { + var f = b64utohex(j); + var d = parseBigInt(f, 16); + this.parsedJWS.sigvalH = f; + this.parsedJWS.sigvalBI = d + } + var b = b64utoutf8(i); + var k = b64utoutf8(c); + this.parsedJWS.headS = b; + this.parsedJWS.payloadS = k; + if (!a.isSafeJSONString(b, this.parsedJWS, "headP")) { + throw "malformed JSON string for JWS Head: " + b + } + } +}; +KJUR.jws.JWS.sign = function(a, i, c, m, l) { + var k = KJUR.jws.JWS; + var q, e, j; + if (typeof i != "string" && typeof i != "object") { + throw "spHeader must be JSON string or object: " + i + } + if (typeof i == "object") { + e = i; + q = JSON.stringify(e) + } + if (typeof i == "string") { + q = i; + if (!k.isSafeJSONString(q)) { + throw "JWS Head is not safe JSON string: " + q + } + e = k.readSafeJSONString(q) + } + j = c; + if (typeof c == "object") { + j = JSON.stringify(c) + } + if ((a == "" || a == null) && e.alg !== undefined) { + a = e.alg + } + if ((a != "" && a != null) && e.alg === undefined) { + e.alg = a; + q = JSON.stringify(e) + } + if (a !== e.alg) { + throw "alg and sHeader.alg doesn't match: " + a + "!=" + e.alg + } + var d = null; + if (k.jwsalg2sigalg[a] === undefined) { + throw "unsupported alg name: " + a + } else { + d = k.jwsalg2sigalg[a] + } + var b = utf8tob64u(q); + var g = utf8tob64u(j); + var o = b + "." + g; + var n = ""; + if (d.substr(0, 4) == "Hmac") { + if (m === undefined) { + throw "mac key shall be specified for HS* alg" + } + var h = new KJUR.crypto.Mac({ + alg: d, + prov: "cryptojs", + pass: m + }); + h.updateString(o); + n = h.doFinal() + } else { + if (d.indexOf("withECDSA") != -1) { + var p = new KJUR.crypto.Signature({ + alg: d + }); + p.init(m, l); + p.updateString(o); + hASN1Sig = p.sign(); + n = KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig) + } else { + if (d != "none") { + var p = new KJUR.crypto.Signature({ + alg: d + }); + p.init(m, l); + p.updateString(o); + n = p.sign() + } + } + } + var f = hextob64u(n); + return o + "." + f +}; +KJUR.jws.JWS.verify = function(p, t, j) { + var m = KJUR.jws.JWS; + var q = p.split("."); + var d = q[0]; + var l = q[1]; + var b = d + "." + l; + var r = b64utohex(q[2]); + var i = m.readSafeJSONString(b64utoutf8(q[0])); + var h = null; + var s = null; + if (i.alg === undefined) { + throw "algorithm not specified in header" + } else { + h = i.alg; + s = h.substr(0, 2) + } + if (j != null && Object.prototype.toString.call(j) === "[object Array]" && j.length > 0) { + var c = ":" + j.join(":") + ":"; + if (c.indexOf(":" + h + ":") == -1) { + throw "algorithm '" + h + "' not accepted in the list" + } + } + if (h != "none" && t === null) { + throw "key shall be specified to verify." + } + if (typeof t == "string" && t.indexOf("-----BEGIN ") != -1) { + t = KEYUTIL.getKey(t) + } + if (s == "RS" || s == "PS") { + if (! (t instanceof RSAKey)) { + throw "key shall be a RSAKey obj for RS* and PS* algs" + } + } + if (s == "ES") { + if (! (t instanceof KJUR.crypto.ECDSA)) { + throw "key shall be a ECDSA obj for ES* algs" + } + } + if (h == "none") {} + var n = null; + if (m.jwsalg2sigalg[i.alg] === undefined) { + throw "unsupported alg name: " + h + } else { + n = m.jwsalg2sigalg[h] + } + if (n == "none") { + throw "not supported" + } else { + if (n.substr(0, 4) == "Hmac") { + var k = null; + if (t === undefined) { + throw "hexadecimal key shall be specified for HMAC" + } + var g = new KJUR.crypto.Mac({ + alg: n, + pass: t + }); + g.updateString(b); + k = g.doFinal(); + return r == k + } else { + if (n.indexOf("withECDSA") != -1) { + var f = null; + try { + f = KJUR.crypto.ECDSA.concatSigToASN1Sig(r) + } catch(o) { + return false + } + var e = new KJUR.crypto.Signature({ + alg: n + }); + e.init(t); + e.updateString(b); + return e.verify(f) + } else { + var e = new KJUR.crypto.Signature({ + alg: n + }); + e.init(t); + e.updateString(b); + return e.verify(r) + } + } + } +}; +KJUR.jws.JWS.parse = function(g) { + var c = g.split("."); + var b = {}; + var f, e, d; + if (c.length != 2 && c.length != 3) { + throw "malformed sJWS: wrong number of '.' splitted elements" + } + f = c[0]; + e = c[1]; + if (c.length == 3) { + d = c[2] + } + b.headerObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f)); + b.payloadObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e)); + b.headerPP = JSON.stringify(b.headerObj, null, " "); + if (b.payloadObj == null) { + b.payloadPP = b64utoutf8(e) + } else { + b.payloadPP = JSON.stringify(b.payloadObj, null, " ") + } + if (d !== undefined) { + b.sigHex = b64utohex(d) + } + return b +}; +KJUR.jws.JWS.verifyJWT = function(d, j, l) { + var h = KJUR.jws.JWS; + var i = d.split("."); + var c = i[0]; + var g = i[1]; + var m = c + "." + g; + var k = b64utohex(i[2]); + var f = h.readSafeJSONString(b64utoutf8(c)); + var e = h.readSafeJSONString(b64utoutf8(g)); + if (f.alg === undefined) { + return false + } + if (l.alg === undefined) { + throw "acceptField.alg shall be specified" + } + if (!h.inArray(f.alg, l.alg)) { + return false + } + if (e.iss !== undefined && typeof l.iss === "object") { + if (!h.inArray(e.iss, l.iss)) { + return false + } + } + if (e.sub !== undefined && typeof l.sub === "object") { + if (!h.inArray(e.sub, l.sub)) { + return false + } + } + if (e.aud !== undefined && typeof l.aud === "object") { + if (typeof e.aud == "string") { + if (!h.inArray(e.aud, l.aud)) { + return false + } + } else { + if (typeof e.aud == "object") { + if (!h.includedArray(e.aud, l.aud)) { + return false + } + } + } + } + var b = KJUR.jws.IntDate.getNow(); + if (l.verifyAt !== undefined && typeof l.verifyAt === "number") { + b = l.verifyAt + } + if (l.gracePeriod === undefined || typeof l.gracePeriod !== "number") { + l.gracePeriod = 0 + } + if (e.exp !== undefined && typeof e.exp == "number") { + if (e.exp + l.gracePeriod < b) { + return false + } + } + if (e.nbf !== undefined && typeof e.nbf == "number") { + if (b < e.nbf - l.gracePeriod) { + return false + } + } + if (e.iat !== undefined && typeof e.iat == "number") { + if (b < e.iat - l.gracePeriod) { + return false + } + } + if (e.jti !== undefined && l.jti !== undefined) { + if (e.jti !== l.jti) { + return false + } + } + if (!KJUR.jws.JWS.verify(d, j, l.alg)) { + return false + } + return true +}; +KJUR.jws.JWS.includedArray = function(b, a) { + var d = KJUR.jws.JWS.inArray; + if (b === null) { + return false + } + if (typeof b !== "object") { + return false + } + if (typeof b.length !== "number") { + return false + } + for (var c = 0; c < b.length; c++) { + if (!d(b[c], a)) { + return false + } + } + return true +}; +KJUR.jws.JWS.inArray = function(d, b) { + if (b === null) { + return false + } + if (typeof b !== "object") { + return false + } + if (typeof b.length !== "number") { + return false + } + for (var c = 0; c < b.length; c++) { + if (b[c] == d) { + return true + } + } + return false +}; +KJUR.jws.JWS.jwsalg2sigalg = { + HS256: "HmacSHA256", + HS384: "HmacSHA384", + HS512: "HmacSHA512", + RS256: "SHA256withRSA", + RS384: "SHA384withRSA", + RS512: "SHA512withRSA", + ES256: "SHA256withECDSA", + ES384: "SHA384withECDSA", + PS256: "SHA256withRSAandMGF1", + PS384: "SHA384withRSAandMGF1", + PS512: "SHA512withRSAandMGF1", + none: "none", +}; +KJUR.jws.JWS.isSafeJSONString = function(c, b, d) { + var e = null; + try { + e = jsonParse(c); + if (typeof e != "object") { + return 0 + } + if (e.constructor === Array) { + return 0 + } + if (b) { + b[d] = e + } + return 1 + } catch(a) { + return 0 + } +}; +KJUR.jws.JWS.readSafeJSONString = function(b) { + var c = null; + try { + c = jsonParse(b); + if (typeof c != "object") { + return null + } + if (c.constructor === Array) { + return null + } + return c + } catch(a) { + return null + } +}; +KJUR.jws.JWS.getEncodedSignatureValueFromJWS = function(b) { + var a = b.match(/^[^.]+\.[^.]+\.([^.]+)$/); + if (a == null) { + throw "JWS signature is not a form of 'Head.Payload.SigValue'." + } + return a[1] +}; +KJUR.jws.JWS.getJWKthumbprint = function(d) { + if (d.kty !== "RSA" && d.kty !== "EC" && d.kty !== "oct") { + throw "unsupported algorithm for JWK Thumprint" + } + var a = "{"; + if (d.kty === "RSA") { + if (typeof d.n != "string" || typeof d.e != "string") { + throw "wrong n and e value for RSA key" + } + a += '"e":"' + d.e + '",'; + a += '"kty":"' + d.kty + '",'; + a += '"n":"' + d.n + '"}' + } else { + if (d.kty === "EC") { + if (typeof d.crv != "string" || typeof d.x != "string" || typeof d.y != "string") { + throw "wrong crv, x and y value for EC key" + } + a += '"crv":"' + d.crv + '",'; + a += '"kty":"' + d.kty + '",'; + a += '"x":"' + d.x + '",'; + a += '"y":"' + d.y + '"}' + } else { + if (d.kty === "oct") { + if (typeof d.k != "string") { + throw "wrong k value for oct(symmetric) key" + } + a += '"kty":"' + d.kty + '",'; + a += '"k":"' + d.k + '"}' + } + } + } + var b = rstrtohex(a); + var c = KJUR.crypto.Util.hashHex(b, "sha256"); + var e = hextob64u(c); + return e +}; +KJUR.jws.IntDate = {}; +KJUR.jws.IntDate.get = function(a) { + if (a == "now") { + return KJUR.jws.IntDate.getNow() + } else { + if (a == "now + 1hour") { + return KJUR.jws.IntDate.getNow() + 60 * 60 + } else { + if (a == "now + 1day") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 + } else { + if (a == "now + 1month") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 30 + } else { + if (a == "now + 1year") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 365 + } else { + if (a.match(/Z$/)) { + return KJUR.jws.IntDate.getZulu(a) + } else { + if (a.match(/^[0-9]+$/)) { + return parseInt(a) + } + } + } + } + } + } + } + throw "unsupported format: " + a +}; +KJUR.jws.IntDate.getZulu = function(k) { + var b = k.match(/(\d+)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z/); + if (b) { + var a = b[1]; + var i = parseInt(a); + if (a.length == 4) {} else { + if (a.length == 2) { + if (50 <= i && i < 100) { + i = 1900 + i + } else { + if (0 <= i && i < 50) { + i = 2000 + i + } else { + throw "malformed year string for UTCTime" + } + } + } else { + throw "malformed year string" + } + } + var g = parseInt(b[2]) - 1; + var j = parseInt(b[3]); + var c = parseInt(b[4]); + var e = parseInt(b[5]); + var f = parseInt(b[6]); + var h = new Date(Date.UTC(i, g, j, c, e, f)); + return~~ (h / 1000) + } + throw "unsupported format: " + k +}; +KJUR.jws.IntDate.getNow = function() { + var a = ~~ (new Date() / 1000); + return a +}; +KJUR.jws.IntDate.intDate2UTCString = function(a) { + var b = new Date(a * 1000); + return b.toUTCString() +}; +KJUR.jws.IntDate.intDate2Zulu = function(e) { + var i = new Date(e * 1000); + var h = ("0000" + i.getUTCFullYear()).slice( - 4); + var g = ("00" + (i.getUTCMonth() + 1)).slice( - 2); + var b = ("00" + i.getUTCDate()).slice( - 2); + var a = ("00" + i.getUTCHours()).slice( - 2); + var c = ("00" + i.getUTCMinutes()).slice( - 2); + var f = ("00" + i.getUTCSeconds()).slice( - 2); + return h + g + b + a + c + f + "Z" +}; +if (typeof KJUR == "undefined" || !KJUR) { + KJUR = {} +} +if (typeof KJUR.jws == "undefined" || !KJUR.jws) { + KJUR.jws = {} +} +KJUR.jws.JWSJS = function() { + var b = KJUR.jws.JWS; + var a = KJUR.jws.JWS; + this.aHeader = []; + this.sPayload = ""; + this.aSignature = []; + this.init = function() { + this.aHeader = []; + this.sPayload = undefined; + this.aSignature = [] + }; + this.initWithJWS = function(d) { + this.init(); + var c = d.split("."); + if (c.length != 3) { + throw "malformed input JWS" + } + this.aHeader.push(c[0]); + this.sPayload = c[1]; + this.aSignature.push(c[2]) + }; + this.addSignature = function(c, f, k, i) { + if (this.sPayload === undefined || this.sPayload === null) { + throw "there's no JSON-JS signature to add." + } + var j = this.aHeader.length; + if (this.aHeader.length != this.aSignature.length) { + throw "aHeader.length != aSignature.length" + } + try { + var d = KJUR.jws.JWS.sign(c, f, this.sPayload, k, i); + var h = d.split("."); + var l = h[0]; + var e = h[2]; + this.aHeader.push(h[0]); + this.aSignature.push(h[2]) + } catch(g) { + if (this.aHeader.length > j) { + this.aHeader.pop() + } + if (this.aSignature.length > j) { + this.aSignature.pop() + } + throw "addSignature failed: " + g + } + }; + this.addSignatureByHeaderKey = function(f, c) { + var e = b64utoutf8(this.sPayload); + var d = new KJUR.jws.JWS(); + var g = d.generateJWSByP1PrvKey(f, e, c); + this.aHeader.push(d.parsedJWS.headB64U); + this.aSignature.push(d.parsedJWS.sigvalB64U) + }; + this.addSignatureByHeaderPayloadKey = function(f, e, c) { + var d = new KJUR.jws.JWS(); + var g = d.generateJWSByP1PrvKey(f, e, c); + this.aHeader.push(d.parsedJWS.headB64U); + this.sPayload = d.parsedJWS.payloadB64U; + this.aSignature.push(d.parsedJWS.sigvalB64U) + }; + this.verifyAll = function(f) { + if (this.aHeader.length !== f.length || this.aSignature.length !== f.length) { + return false + } + for (var e = 0; e < f.length; e++) { + var d = f[e]; + if (d.length !== 2) { + return false + } + var c = this.verifyNth(e, d[0], d[1]); + if (c === false) { + return false + } + } + return true + }; + this.verifyNth = function(d, h, e) { + if (this.aHeader.length <= d || this.aSignature.length <= d) { + return false + } + var f = this.aHeader[d]; + var i = this.aSignature[d]; + var j = f + "." + this.sPayload + "." + i; + var c = false; + try { + c = a.verify(j, h, e) + } catch(g) { + return false + } + return c + }; + this.verifyWithCerts = function(d) { + if (this.aHeader.length != d.length) { + throw "num headers does not match with num certs" + } + if (this.aSignature.length != d.length) { + throw "num signatures does not match with num certs" + } + var l = this.sPayload; + var h = ""; + for (var e = 0; e < d.length; e++) { + var f = d[e]; + var g = this.aHeader[e]; + var n = this.aSignature[e]; + var c = g + "." + l + "." + n; + var k = new KJUR.jws.JWS(); + try { + var m = k.verifyJWSByPemX509Cert(c, f); + if (m != 1) { + h += (e + 1) + "th signature unmatch. " + } + } catch(j) { + h += (e + 1) + "th signature fail(" + j + "). " + } + } + if (h == "") { + return 1 + } else { + throw h + } + }; + this.readJWSJS = function(e) { + if (typeof e === "string") { + var d = b.readSafeJSONString(e); + if (d == null) { + throw "argument is not safe JSON object string" + } + this.aHeader = d.headers; + this.sPayload = d.payload; + this.aSignature = d.signatures + } else { + try { + if (e.headers.length > 0) { + this.aHeader = e.headers + } else { + throw "malformed header" + } + if (typeof e.payload === "string") { + this.sPayload = e.payload + } else { + throw "malformed signatures" + } + if (e.signatures.length > 0) { + this.signatures = e.signatures + } else { + throw "malformed signatures" + } + } catch(c) { + throw "malformed JWS-JS JSON object: " + c + } + } + }; + this.getJSON = function() { + return { + headers: this.aHeader, + payload: this.sPayload, + signatures: this.aSignature + } + }; + this.isEmpty = function() { + if (this.aHeader.length == 0) { + return 1 + } + return 0 + } +}; +module.exports = { + RSAKey: RSAKey, + KEYUTIL: KEYUTIL, + hex2b64: hex2b64, + b64tohex: b64tohex +} \ No newline at end of file diff --git a/utils/util.js b/utils/util.js new file mode 100755 index 0000000..ac61a10 --- /dev/null +++ b/utils/util.js @@ -0,0 +1,239 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} +//获取当前时间的时间戳 +const getCurTimestamp = () => { + return Date.parse(new Date()) +} +/****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/ +// 生成随机字符串 +const randomString = (len) => { + len = len || 32; + var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; + var maxPos = $chars.length; + var pwd = ''; + for (i = 0; i < len; i++) { + pwd += $chars.charAt(Math.floor(Math.random() * maxPos)); + } + return pwd; +} +var rotateLeft = function (lValue, iShiftBits) { + return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits)); +} +var addUnsigned = function (lX, lY) { + var lX4, lY4, lX8, lY8, lResult; + lX8 = (lX & 0x80000000); + lY8 = (lY & 0x80000000); + lX4 = (lX & 0x40000000); + lY4 = (lY & 0x40000000); + lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF); + if (lX4 & lY4) return (lResult ^ 0x80000000 ^ lX8 ^ lY8); + if (lX4 | lY4) { + if (lResult & 0x40000000) return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); + else return (lResult ^ 0x40000000 ^ lX8 ^ lY8); + } else { + return (lResult ^ lX8 ^ lY8); + } +} +var F = function (x, y, z) { + return (x & y) | ((~x) & z); +} +var G = function (x, y, z) { + return (x & z) | (y & (~z)); +} +var H = function (x, y, z) { + return (x ^ y ^ z); +} +var I = function (x, y, z) { + return (y ^ (x | (~z))); +} +var FF = function (a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(F(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); +}; +var GG = function (a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(G(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); +}; +var HH = function (a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(H(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); +}; +var II = function (a, b, c, d, x, s, ac) { + a = addUnsigned(a, addUnsigned(addUnsigned(I(b, c, d), x), ac)); + return addUnsigned(rotateLeft(a, s), b); +}; +var convertToWordArray = function (string) { + var lWordCount; + var lMessageLength = string.length; + var lNumberOfWordsTempOne = lMessageLength + 8; + var lNumberOfWordsTempTwo = (lNumberOfWordsTempOne - (lNumberOfWordsTempOne % 64)) / 64; + var lNumberOfWords = (lNumberOfWordsTempTwo + 1) * 16; + var lWordArray = Array(lNumberOfWords - 1); + var lBytePosition = 0; + var lByteCount = 0; + while (lByteCount < lMessageLength) { + lWordCount = (lByteCount - (lByteCount % 4)) / 4; + lBytePosition = (lByteCount % 4) * 8; + lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition)); + lByteCount++; + } + lWordCount = (lByteCount - (lByteCount % 4)) / 4; + lBytePosition = (lByteCount % 4) * 8; + lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition); + lWordArray[lNumberOfWords - 2] = lMessageLength << 3; + lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29; + return lWordArray; +}; +var wordToHex = function (lValue) { + var WordToHexValue = "", + WordToHexValueTemp = "", + lByte, lCount; + for (lCount = 0; lCount <= 3; lCount++) { + lByte = (lValue >>> (lCount * 8)) & 255; + WordToHexValueTemp = "0" + lByte.toString(16); + WordToHexValue = WordToHexValue + WordToHexValueTemp.substr(WordToHexValueTemp.length - 2, 2); + } + return WordToHexValue; +}; +var uTF8Encode = function (string) { + string = string.replace(/\x0d\x0a/g, "\x0a"); + var output = ""; + for (var n = 0; n < string.length; n++) { + var c = string.charCodeAt(n); + if (c < 128) { + output += String.fromCharCode(c); + } else if ((c > 127) && (c < 2048)) { + output += String.fromCharCode((c >> 6) | 192); + output += String.fromCharCode((c & 63) | 128); + } else { + output += String.fromCharCode((c >> 12) | 224); + output += String.fromCharCode(((c >> 6) & 63) | 128); + output += String.fromCharCode((c & 63) | 128); + } + } + return output; +}; + +var md5 = function (string) { + var x = Array(); + var k, AA, BB, CC, DD, a, b, c, d; + var S11 = 7, + S12 = 12, + S13 = 17, + S14 = 22; + var S21 = 5, + S22 = 9, + S23 = 14, + S24 = 20; + var S31 = 4, + S32 = 11, + S33 = 16, + S34 = 23; + var S41 = 6, + S42 = 10, + S43 = 15, + S44 = 21; + string = uTF8Encode(string); + x = convertToWordArray(string); + a = 0x67452301; + b = 0xEFCDAB89; + c = 0x98BADCFE; + d = 0x10325476; + for (k = 0; k < x.length; k += 16) { + AA = a; + BB = b; + CC = c; + DD = d; + a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478); + d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756); + c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB); + b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE); + a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF); + d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A); + c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613); + b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501); + a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8); + d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF); + c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1); + b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE); + a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122); + d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193); + c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E); + b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821); + a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562); + d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340); + c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51); + b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA); + a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D); + d = GG(d, a, b, c, x[k + 10], S22, 0x2441453); + c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681); + b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8); + a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6); + d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6); + c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87); + b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED); + a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905); + d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8); + c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9); + b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A); + a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942); + d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681); + c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122); + b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C); + a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44); + d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9); + c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60); + b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70); + a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6); + d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA); + c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085); + b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05); + a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039); + d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5); + c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8); + b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665); + a = II(a, b, c, d, x[k + 0], S41, 0xF4292244); + d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97); + c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7); + b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039); + a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3); + d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92); + c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D); + b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1); + a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F); + d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0); + c = II(c, d, a, b, x[k + 6], S43, 0xA3014314); + b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1); + a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82); + d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235); + c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB); + b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391); + a = addUnsigned(a, AA); + b = addUnsigned(b, BB); + c = addUnsigned(c, CC); + d = addUnsigned(d, DD); + } + var tempValue = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d); + return tempValue.toLowerCase(); +} + + +module.exports = { + formatTime: formatTime, + md5: md5, + currentTimestamp: getCurTimestamp, + randomString: randomString +} \ No newline at end of file diff --git a/vant/dist/action-sheet/index.d.ts b/vant/dist/action-sheet/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/action-sheet/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/action-sheet/index.js b/vant/dist/action-sheet/index.js new file mode 100755 index 0000000..042a906 --- /dev/null +++ b/vant/dist/action-sheet/index.js @@ -0,0 +1,70 @@ +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +VantComponent({ + mixins: [button], + props: { + show: Boolean, + title: String, + cancelText: String, + description: String, + round: { + type: Boolean, + value: true, + }, + zIndex: { + type: Number, + value: 100, + }, + actions: { + type: Array, + value: [], + }, + overlay: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + closeOnClickAction: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + }, + methods: { + onSelect(event) { + const { index } = event.currentTarget.dataset; + const { actions, closeOnClickAction, canIUseGetUserProfile } = this.data; + const item = actions[index]; + if (item) { + this.$emit('select', item); + if (closeOnClickAction) { + this.onClose(); + } + if (item.openType === 'getUserInfo' && canIUseGetUserProfile) { + wx.getUserProfile({ + desc: item.getUserProfileDesc || ' ', + complete: (userProfile) => { + this.$emit('getuserinfo', userProfile); + }, + }); + } + } + }, + onCancel() { + this.$emit('cancel'); + }, + onClose() { + this.$emit('close'); + }, + onClickOverlay() { + this.$emit('click-overlay'); + this.onClose(); + }, + }, +}); diff --git a/vant/dist/action-sheet/index.json b/vant/dist/action-sheet/index.json new file mode 100755 index 0000000..19bf989 --- /dev/null +++ b/vant/dist/action-sheet/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-popup": "../popup/index", + "van-loading": "../loading/index" + } +} diff --git a/vant/dist/action-sheet/index.wxml b/vant/dist/action-sheet/index.wxml new file mode 100755 index 0000000..b04cc3a --- /dev/null +++ b/vant/dist/action-sheet/index.wxml @@ -0,0 +1,69 @@ + + + + + {{ title }} + + + + {{ description }} + + + + + + + + + + {{ cancelText }} + + + diff --git a/vant/dist/action-sheet/index.wxss b/vant/dist/action-sheet/index.wxss new file mode 100755 index 0000000..6248757 --- /dev/null +++ b/vant/dist/action-sheet/index.wxss @@ -0,0 +1,105 @@ +@import '../common/index.wxss'; + +.van-action-sheet { + max-height: 90% !important; + max-height: var(--action-sheet-max-height, 90%) !important; + color: #323233; + color: var(--action-sheet-item-text-color, #323233) +} + +.van-action-sheet__cancel, +.van-action-sheet__item { + padding: 14px 16px; + text-align: center; + font-size: 16px; + font-size: var(--action-sheet-item-font-size, 16px); + line-height: 22px; + line-height: var(--action-sheet-item-line-height, 22px); + background-color: #fff; + background-color: var(--action-sheet-item-background, #fff) +} + +.van-action-sheet__cancel--hover, +.van-action-sheet__item--hover { + background-color: #f2f3f5; + background-color: var(--active-color, #f2f3f5) +} + +.van-action-sheet__cancel:after, +.van-action-sheet__item:after { + border-width: 0 +} + +.van-action-sheet__cancel { + color: #646566; + color: var(--action-sheet-cancel-text-color, #646566) +} + +.van-action-sheet__gap { + display: block; + height: 8px; + height: var(--action-sheet-cancel-padding-top, 8px); + background-color: #f7f8fa; + background-color: var(--action-sheet-cancel-padding-color, #f7f8fa) +} + +.van-action-sheet__item--disabled { + color: #c8c9cc; + color: var(--action-sheet-item-disabled-text-color, #c8c9cc) +} + +.van-action-sheet__item--disabled.van-action-sheet__item--hover { + background-color: #fff; + background-color: var(--action-sheet-item-background, #fff) +} + +.van-action-sheet__subname { + margin-top: 8px; + margin-top: var(--padding-xs, 8px); + font-size: 12px; + font-size: var(--action-sheet-subname-font-size, 12px); + color: #969799; + color: var(--action-sheet-subname-color, #969799); + line-height: 20px; + line-height: var(--action-sheet-subname-line-height, 20px) +} + +.van-action-sheet__header { + text-align: center; + font-weight: 500; + font-weight: var(--font-weight-bold, 500); + font-size: 16px; + font-size: var(--action-sheet-header-font-size, 16px); + line-height: 48px; + line-height: var(--action-sheet-header-height, 48px) +} + +.van-action-sheet__description { + text-align: center; + padding: 20px 16px; + padding: 20px var(--padding-md, 16px); + color: #969799; + color: var(--action-sheet-description-color, #969799); + font-size: 14px; + font-size: var(--action-sheet-description-font-size, 14px); + line-height: 20px; + line-height: var(--action-sheet-description-line-height, 20px) +} + +.van-action-sheet__close { + position: absolute !important; + top: 0; + right: 0; + line-height: inherit !important; + padding: 0 16px; + padding: var(--action-sheet-close-icon-padding, 0 16px); + font-size: 22px !important; + font-size: var(--action-sheet-close-icon-size, 22px) !important; + color: #c8c9cc; + color: var(--action-sheet-close-icon-color, #c8c9cc) +} + +.van-action-sheet__loading { + display: -webkit-flex !important; + display: flex !important +} \ No newline at end of file diff --git a/vant/dist/area/index.d.ts b/vant/dist/area/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/area/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/area/index.js b/vant/dist/area/index.js new file mode 100755 index 0000000..3b3494d --- /dev/null +++ b/vant/dist/area/index.js @@ -0,0 +1,232 @@ +import { VantComponent } from '../common/component'; +import { pickerProps } from '../picker/shared'; +import { requestAnimationFrame } from '../common/utils'; +const EMPTY_CODE = '000000'; +VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: Object.assign(Object.assign({}, pickerProps), { + value: { + type: String, + observer(value) { + this.code = value; + this.setValues(); + }, + }, + areaList: { + type: Object, + value: {}, + observer: 'setValues', + }, + columnsNum: { + type: null, + value: 3, + }, + columnsPlaceholder: { + type: Array, + observer(val) { + this.setData({ + typeToColumnsPlaceholder: { + province: val[0] || '', + city: val[1] || '', + county: val[2] || '', + }, + }); + }, + }, + }), + data: { + columns: [{ values: [] }, { values: [] }, { values: [] }], + typeToColumnsPlaceholder: {}, + }, + mounted() { + requestAnimationFrame(() => { + this.setValues(); + }); + }, + methods: { + getPicker() { + if (this.picker == null) { + this.picker = this.selectComponent('.van-area__picker'); + } + return this.picker; + }, + onCancel(event) { + this.emit('cancel', event.detail); + }, + onConfirm(event) { + const { index } = event.detail; + let { value } = event.detail; + value = this.parseValues(value); + this.emit('confirm', { value, index }); + }, + emit(type, detail) { + detail.values = detail.value; + delete detail.value; + this.$emit(type, detail); + }, + parseValues(values) { + const { columnsPlaceholder } = this.data; + return values.map((value, index) => { + if ( + value && + (!value.code || value.name === columnsPlaceholder[index]) + ) { + return Object.assign(Object.assign({}, value), { + code: '', + name: '', + }); + } + return value; + }); + }, + onChange(event) { + const { index, picker, value } = event.detail; + this.code = value[index].code; + this.setValues().then(() => { + this.$emit('change', { + picker, + values: this.parseValues(picker.getValues()), + index, + }); + }); + }, + getConfig(type) { + const { areaList } = this.data; + return (areaList && areaList[`${type}_list`]) || {}; + }, + getList(type, code) { + if (type !== 'province' && !code) { + return []; + } + const { typeToColumnsPlaceholder } = this.data; + const list = this.getConfig(type); + let result = Object.keys(list).map((code) => ({ + code, + name: list[code], + })); + if (code != null) { + // oversea code + if (code[0] === '9' && type === 'city') { + code = '9'; + } + result = result.filter((item) => item.code.indexOf(code) === 0); + } + if (typeToColumnsPlaceholder[type] && result.length) { + // set columns placeholder + const codeFill = + type === 'province' + ? '' + : type === 'city' + ? EMPTY_CODE.slice(2, 4) + : EMPTY_CODE.slice(4, 6); + result.unshift({ + code: `${code}${codeFill}`, + name: typeToColumnsPlaceholder[type], + }); + } + return result; + }, + getIndex(type, code) { + let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6; + const list = this.getList(type, code.slice(0, compareNum - 2)); + // oversea code + if (code[0] === '9' && type === 'province') { + compareNum = 1; + } + code = code.slice(0, compareNum); + for (let i = 0; i < list.length; i++) { + if (list[i].code.slice(0, compareNum) === code) { + return i; + } + } + return 0; + }, + setValues() { + const picker = this.getPicker(); + if (!picker) { + return; + } + let code = this.code || this.getDefaultCode(); + const provinceList = this.getList('province'); + const cityList = this.getList('city', code.slice(0, 2)); + const stack = []; + const indexes = []; + const { columnsNum } = this.data; + if (columnsNum >= 1) { + stack.push(picker.setColumnValues(0, provinceList, false)); + indexes.push(this.getIndex('province', code)); + } + if (columnsNum >= 2) { + stack.push(picker.setColumnValues(1, cityList, false)); + indexes.push(this.getIndex('city', code)); + if (cityList.length && code.slice(2, 4) === '00') { + [{ code }] = cityList; + } + } + if (columnsNum === 3) { + stack.push( + picker.setColumnValues( + 2, + this.getList('county', code.slice(0, 4)), + false + ) + ); + indexes.push(this.getIndex('county', code)); + } + return Promise.all(stack) + .catch(() => {}) + .then(() => picker.setIndexes(indexes)) + .catch(() => {}); + }, + getDefaultCode() { + const { columnsPlaceholder } = this.data; + if (columnsPlaceholder.length) { + return EMPTY_CODE; + } + const countyCodes = Object.keys(this.getConfig('county')); + if (countyCodes[0]) { + return countyCodes[0]; + } + const cityCodes = Object.keys(this.getConfig('city')); + if (cityCodes[0]) { + return cityCodes[0]; + } + return ''; + }, + getValues() { + const picker = this.getPicker(); + if (!picker) { + return []; + } + return this.parseValues(picker.getValues().filter((value) => !!value)); + }, + getDetail() { + const values = this.getValues(); + const area = { + code: '', + country: '', + province: '', + city: '', + county: '', + }; + if (!values.length) { + return area; + } + const names = values.map((item) => item.name); + area.code = values[values.length - 1].code; + if (area.code[0] === '9') { + area.country = names[1] || ''; + area.province = names[2] || ''; + } else { + area.province = names[0] || ''; + area.city = names[1] || ''; + area.county = names[2] || ''; + } + return area; + }, + reset(code) { + this.code = code || ''; + return this.setValues(); + }, + }, +}); diff --git a/vant/dist/area/index.json b/vant/dist/area/index.json new file mode 100755 index 0000000..a778e91 --- /dev/null +++ b/vant/dist/area/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/vant/dist/area/index.wxml b/vant/dist/area/index.wxml new file mode 100755 index 0000000..f7dc51f --- /dev/null +++ b/vant/dist/area/index.wxml @@ -0,0 +1,20 @@ + + + diff --git a/vant/dist/area/index.wxs b/vant/dist/area/index.wxs new file mode 100755 index 0000000..07723c1 --- /dev/null +++ b/vant/dist/area/index.wxs @@ -0,0 +1,8 @@ +/* eslint-disable */ +function displayColumns(columns, columnsNum) { + return columns.slice(0, +columnsNum); +} + +module.exports = { + displayColumns: displayColumns, +}; diff --git a/vant/dist/area/index.wxss b/vant/dist/area/index.wxss new file mode 100755 index 0000000..99694d6 --- /dev/null +++ b/vant/dist/area/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/vant/dist/button/index.d.ts b/vant/dist/button/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/button/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/button/index.js b/vant/dist/button/index.js new file mode 100755 index 0000000..f2fe270 --- /dev/null +++ b/vant/dist/button/index.js @@ -0,0 +1,58 @@ +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +import { canIUseFormFieldButton } from '../common/version'; +const mixins = [button, openType]; +if (canIUseFormFieldButton()) { + mixins.push('wx://form-field-button'); +} +VantComponent({ + mixins, + classes: ['hover-class', 'loading-class'], + data: { + baseStyle: '', + }, + props: { + formType: String, + icon: String, + classPrefix: { + type: String, + value: 'van-icon', + }, + plain: Boolean, + block: Boolean, + round: Boolean, + square: Boolean, + loading: Boolean, + hairline: Boolean, + disabled: Boolean, + loadingText: String, + customStyle: String, + loadingType: { + type: String, + value: 'circular', + }, + type: { + type: String, + value: 'default', + }, + dataset: null, + size: { + type: String, + value: 'normal', + }, + loadingSize: { + type: String, + value: '20px', + }, + color: String, + }, + methods: { + onClick() { + if (!this.data.loading) { + this.$emit('click'); + } + }, + noop() {}, + }, +}); diff --git a/vant/dist/button/index.json b/vant/dist/button/index.json new file mode 100755 index 0000000..e00a588 --- /dev/null +++ b/vant/dist/button/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index", + "van-loading": "../loading/index" + } +} diff --git a/vant/dist/button/index.wxml b/vant/dist/button/index.wxml new file mode 100755 index 0000000..e4cec8a --- /dev/null +++ b/vant/dist/button/index.wxml @@ -0,0 +1,53 @@ + + + + diff --git a/vant/dist/button/index.wxs b/vant/dist/button/index.wxs new file mode 100755 index 0000000..8b649fe --- /dev/null +++ b/vant/dist/button/index.wxs @@ -0,0 +1,39 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); + +function rootStyle(data) { + if (!data.color) { + return data.customStyle; + } + + var properties = { + color: data.plain ? data.color : '#fff', + background: data.plain ? null : data.color, + }; + + // hide border when color is linear-gradient + if (data.color.indexOf('gradient') !== -1) { + properties.border = 0; + } else { + properties['border-color'] = data.color; + } + + return style([properties, data.customStyle]); +} + +function loadingColor(data) { + if (data.plain) { + return data.color ? data.color : '#c9c9c9'; + } + + if (data.type === 'default') { + return '#c9c9c9'; + } + + return '#fff'; +} + +module.exports = { + rootStyle: rootStyle, + loadingColor: loadingColor, +}; diff --git a/vant/dist/button/index.wxss b/vant/dist/button/index.wxss new file mode 100755 index 0000000..5a591fb --- /dev/null +++ b/vant/dist/button/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0} \ No newline at end of file diff --git a/vant/dist/calendar/calendar.wxml b/vant/dist/calendar/calendar.wxml new file mode 100755 index 0000000..26938c1 --- /dev/null +++ b/vant/dist/calendar/calendar.wxml @@ -0,0 +1,65 @@ + +
+ +
+ + + + + + + + + + + + {{ + computed.getButtonDisabled(type, currentDate) + ? confirmDisabledText + : confirmText + }} + + +
diff --git a/vant/dist/calendar/components/header/index.d.ts b/vant/dist/calendar/components/header/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/calendar/components/header/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/calendar/components/header/index.js b/vant/dist/calendar/components/header/index.js new file mode 100755 index 0000000..bf9243f --- /dev/null +++ b/vant/dist/calendar/components/header/index.js @@ -0,0 +1,16 @@ +import { VantComponent } from '../../../common/component'; +VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + subtitle: String, + showTitle: Boolean, + showSubtitle: Boolean, + }, + data: { + weekdays: ['日', '一', '二', '三', '四', '五', '六'], + }, + methods: {}, +}); diff --git a/vant/dist/calendar/components/header/index.json b/vant/dist/calendar/components/header/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/calendar/components/header/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/calendar/components/header/index.wxml b/vant/dist/calendar/components/header/index.wxml new file mode 100755 index 0000000..eb8e4b4 --- /dev/null +++ b/vant/dist/calendar/components/header/index.wxml @@ -0,0 +1,16 @@ + + + + {{ title }} + + + + {{ subtitle }} + + + + + {{ item }} + + + diff --git a/vant/dist/calendar/components/header/index.wxss b/vant/dist/calendar/components/header/index.wxss new file mode 100755 index 0000000..4075e48 --- /dev/null +++ b/vant/dist/calendar/components/header/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 2px 10px rgba(125,126,128,.16);box-shadow:var(--calendar-header-box-shadow,0 2px 10px rgba(125,126,128,.16))}.van-calendar__header-subtitle,.van-calendar__header-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:-webkit-flex;display:flex}.van-calendar__weekday{-webkit-flex:1;flex:1;text-align:center;font-size:12px;font-size:var(--calendar-weekdays-font-size,12px);line-height:30px;line-height:var(--calendar-weekdays-height,30px)} \ No newline at end of file diff --git a/vant/dist/calendar/components/month/index.d.ts b/vant/dist/calendar/components/month/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/calendar/components/month/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/calendar/components/month/index.js b/vant/dist/calendar/components/month/index.js new file mode 100755 index 0000000..4c872a9 --- /dev/null +++ b/vant/dist/calendar/components/month/index.js @@ -0,0 +1,157 @@ +import { VantComponent } from '../../../common/component'; +import { + getMonthEndDay, + compareDay, + getPrevDay, + getNextDay, +} from '../../utils'; +VantComponent({ + props: { + date: { + type: null, + observer: 'setDays', + }, + type: { + type: String, + observer: 'setDays', + }, + color: String, + minDate: { + type: null, + observer: 'setDays', + }, + maxDate: { + type: null, + observer: 'setDays', + }, + showMark: Boolean, + rowHeight: null, + formatter: { + type: null, + observer: 'setDays', + }, + currentDate: { + type: null, + observer: 'setDays', + }, + allowSameDay: Boolean, + showSubtitle: Boolean, + showMonthTitle: Boolean, + }, + data: { + visible: true, + days: [], + }, + methods: { + onClick(event) { + const { index } = event.currentTarget.dataset; + const item = this.data.days[index]; + if (item.type !== 'disabled') { + this.$emit('click', item); + } + }, + setDays() { + const days = []; + const startDate = new Date(this.data.date); + const year = startDate.getFullYear(); + const month = startDate.getMonth(); + const totalDay = getMonthEndDay( + startDate.getFullYear(), + startDate.getMonth() + 1 + ); + for (let day = 1; day <= totalDay; day++) { + const date = new Date(year, month, day); + const type = this.getDayType(date); + let config = { + date, + type, + text: day, + bottomInfo: this.getBottomInfo(type), + }; + if (this.data.formatter) { + config = this.data.formatter(config); + } + days.push(config); + } + this.setData({ days }); + }, + getMultipleDayType(day) { + const { currentDate } = this.data; + if (!Array.isArray(currentDate)) { + return ''; + } + const isSelected = (date) => + currentDate.some((item) => compareDay(item, date) === 0); + if (isSelected(day)) { + const prevDay = getPrevDay(day); + const nextDay = getNextDay(day); + const prevSelected = isSelected(prevDay); + const nextSelected = isSelected(nextDay); + if (prevSelected && nextSelected) { + return 'multiple-middle'; + } + if (prevSelected) { + return 'end'; + } + return nextSelected ? 'start' : 'multiple-selected'; + } + return ''; + }, + getRangeDayType(day) { + const { currentDate, allowSameDay } = this.data; + if (!Array.isArray(currentDate)) { + return; + } + const [startDay, endDay] = currentDate; + if (!startDay) { + return; + } + const compareToStart = compareDay(day, startDay); + if (!endDay) { + return compareToStart === 0 ? 'start' : ''; + } + const compareToEnd = compareDay(day, endDay); + if (compareToStart === 0 && compareToEnd === 0 && allowSameDay) { + return 'start-end'; + } + if (compareToStart === 0) { + return 'start'; + } + if (compareToEnd === 0) { + return 'end'; + } + if (compareToStart > 0 && compareToEnd < 0) { + return 'middle'; + } + }, + getDayType(day) { + const { type, minDate, maxDate, currentDate } = this.data; + if (compareDay(day, minDate) < 0 || compareDay(day, maxDate) > 0) { + return 'disabled'; + } + if (type === 'single') { + return compareDay(day, currentDate) === 0 ? 'selected' : ''; + } + if (type === 'multiple') { + return this.getMultipleDayType(day); + } + /* istanbul ignore else */ + if (type === 'range') { + return this.getRangeDayType(day); + } + }, + getBottomInfo(type) { + if (this.data.type === 'range') { + if (type === 'start') { + return '开始'; + } + if (type === 'end') { + return '结束'; + } + if (type === 'start-end') { + return '开始/结束'; + } + } + }, + }, +}); diff --git a/vant/dist/calendar/components/month/index.json b/vant/dist/calendar/components/month/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/calendar/components/month/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/calendar/components/month/index.wxml b/vant/dist/calendar/components/month/index.wxml new file mode 100755 index 0000000..55bab83 --- /dev/null +++ b/vant/dist/calendar/components/month/index.wxml @@ -0,0 +1,39 @@ + + + + + + {{ computed.formatMonthTitle(date) }} + + + + + {{ computed.getMark(date) }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + {{ item.topInfo }} + {{ item.text }} + + {{ item.bottomInfo }} + + + + + diff --git a/vant/dist/calendar/components/month/index.wxs b/vant/dist/calendar/components/month/index.wxs new file mode 100755 index 0000000..a057079 --- /dev/null +++ b/vant/dist/calendar/components/month/index.wxs @@ -0,0 +1,67 @@ +/* eslint-disable */ +var utils = require('../../utils.wxs'); + +function getMark(date) { + return getDate(date).getMonth() + 1; +} + +var ROW_HEIGHT = 64; + +function getDayStyle(type, index, date, rowHeight, color) { + var style = []; + var offset = getDate(date).getDay(); + + if (index === 0) { + style.push(['margin-left', (100 * offset) / 7 + '%']); + } + + if (rowHeight !== ROW_HEIGHT) { + style.push(['height', rowHeight + 'px']); + } + + if (color) { + if ( + type === 'start' || + type === 'end' || + type === 'multiple-selected' || + type === 'multiple-middle' + ) { + style.push(['background', color]); + } else if (type === 'middle') { + style.push(['color', color]); + } + } + + return style + .map(function(item) { + return item.join(':'); + }) + .join(';'); +} + +function formatMonthTitle(date) { + date = getDate(date); + return date.getFullYear() + '年' + (date.getMonth() + 1) + '月'; +} + +function getMonthStyle(visible, date, rowHeight) { + if (!visible) { + date = getDate(date); + + var totalDay = utils.getMonthEndDay( + date.getFullYear(), + date.getMonth() + 1 + ); + var offset = getDate(date).getDay(); + var padding = Math.ceil((totalDay + offset) / 7) * rowHeight; + + return 'padding-bottom:' + padding + 'px'; + } +} + +module.exports = { + getMark: getMark, + getDayStyle: getDayStyle, + formatMonthTitle: formatMonthTitle, + getMonthStyle: getMonthStyle +}; diff --git a/vant/dist/calendar/components/month/index.wxss b/vant/dist/calendar/components/month/index.wxss new file mode 100755 index 0000000..17c12f4 --- /dev/null +++ b/vant/dist/calendar/components/month/index.wxss @@ -0,0 +1 @@ +@import '../../../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__month-title{text-align:center;height:44px;height:var(--calendar-header-title-height,44px);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:14px;font-size:var(--calendar-month-title-font-size,14px);line-height:44px;line-height:var(--calendar-header-title-height,44px)}.van-calendar__days{position:relative;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none;color:rgba(242,243,245,.8);color:var(--calendar-month-mark-color,rgba(242,243,245,.8));font-size:160px;font-size:var(--calendar-month-mark-font-size,160px)}.van-calendar__day,.van-calendar__selected-day{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:64px;height:var(--calendar-day-height,64px);font-size:16px;font-size:var(--calendar-day-font-size,16px)}.van-calendar__day--end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected,.van-calendar__day--start,.van-calendar__day--start-end{color:#fff;color:var(--calendar-range-edge-color,#fff);background-color:#ee0a24;background-color:var(--calendar-range-edge-background-color,#ee0a24)}.van-calendar__day--start{border-radius:4px 0 0 4px;border-radius:var(--border-radius-md,4px) 0 0 var(--border-radius-md,4px)}.van-calendar__day--end{border-radius:0 4px 4px 0;border-radius:0 var(--border-radius-md,4px) var(--border-radius-md,4px) 0}.van-calendar__day--multiple-selected,.van-calendar__day--start-end{border-radius:4px;border-radius:var(--border-radius-md,4px)}.van-calendar__day--middle{color:#ee0a24;color:var(--calendar-range-middle-color,#ee0a24)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;content:"";opacity:.1;opacity:var(--calendar-range-middle-background-opacity,.1)}.van-calendar__day--disabled{cursor:default;color:#c8c9cc;color:var(--calendar-day-disabled-color,#c8c9cc)}.van-calendar__bottom-info,.van-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;font-size:var(--calendar-info-font-size,10px);line-height:14px;line-height:var(--calendar-info-line-height,14px)}@media (max-width:350px){.van-calendar__bottom-info,.van-calendar__top-info{font-size:9px}}.van-calendar__top-info{top:6px}.van-calendar__bottom-info{bottom:6px}.van-calendar__selected-day{width:54px;width:var(--calendar-selected-day-size,54px);height:54px;height:var(--calendar-selected-day-size,54px);color:#fff;color:var(--calendar-selected-day-color,#fff);background-color:#ee0a24;background-color:var(--calendar-selected-day-background-color,#ee0a24);border-radius:4px;border-radius:var(--border-radius-md,4px)} \ No newline at end of file diff --git a/vant/dist/calendar/index.d.ts b/vant/dist/calendar/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/calendar/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/calendar/index.js b/vant/dist/calendar/index.js new file mode 100755 index 0000000..d7b7f27 --- /dev/null +++ b/vant/dist/calendar/index.js @@ -0,0 +1,297 @@ +import { VantComponent } from '../common/component'; +import { + ROW_HEIGHT, + getNextDay, + compareDay, + copyDates, + calcDateNum, + formatMonthTitle, + compareMonth, + getMonths, + getDayByOffset, +} from './utils'; +import Toast from '../toast/toast'; +import { requestAnimationFrame } from '../common/utils'; +VantComponent({ + props: { + title: { + type: String, + value: '日期选择', + }, + color: String, + show: { + type: Boolean, + observer(val) { + if (val) { + this.initRect(); + this.scrollIntoView(); + } + }, + }, + formatter: null, + confirmText: { + type: String, + value: '确定', + }, + rangePrompt: String, + defaultDate: { + type: null, + observer(val) { + this.setData({ currentDate: val }); + this.scrollIntoView(); + }, + }, + allowSameDay: Boolean, + confirmDisabledText: String, + type: { + type: String, + value: 'single', + observer: 'reset', + }, + minDate: { + type: null, + value: Date.now(), + }, + maxDate: { + type: null, + value: new Date( + new Date().getFullYear(), + new Date().getMonth() + 6, + new Date().getDate() + ).getTime(), + }, + position: { + type: String, + value: 'bottom', + }, + rowHeight: { + type: null, + value: ROW_HEIGHT, + }, + round: { + type: Boolean, + value: true, + }, + poppable: { + type: Boolean, + value: true, + }, + showMark: { + type: Boolean, + value: true, + }, + showTitle: { + type: Boolean, + value: true, + }, + showConfirm: { + type: Boolean, + value: true, + }, + showSubtitle: { + type: Boolean, + value: true, + }, + safeAreaInsetBottom: { + type: Boolean, + value: true, + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + }, + maxRange: { + type: null, + value: null, + }, + }, + data: { + subtitle: '', + currentDate: null, + scrollIntoView: '', + }, + created() { + this.setData({ + currentDate: this.getInitialDate(), + }); + }, + mounted() { + if (this.data.show || !this.data.poppable) { + this.initRect(); + this.scrollIntoView(); + } + }, + methods: { + reset() { + this.setData({ currentDate: this.getInitialDate() }); + this.scrollIntoView(); + }, + initRect() { + if (this.contentObserver != null) { + this.contentObserver.disconnect(); + } + const contentObserver = this.createIntersectionObserver({ + thresholds: [0, 0.1, 0.9, 1], + observeAll: true, + }); + this.contentObserver = contentObserver; + contentObserver.relativeTo('.van-calendar__body'); + contentObserver.observe('.month', (res) => { + if (res.boundingClientRect.top <= res.relativeRect.top) { + // @ts-ignore + this.setData({ subtitle: formatMonthTitle(res.dataset.date) }); + } + }); + }, + getInitialDate() { + const { type, defaultDate, minDate } = this.data; + if (type === 'range') { + const [startDay, endDay] = defaultDate || []; + return [ + startDay || minDate, + endDay || getNextDay(new Date(minDate)).getTime(), + ]; + } + if (type === 'multiple') { + return defaultDate || [minDate]; + } + return defaultDate || minDate; + }, + scrollIntoView() { + requestAnimationFrame(() => { + const { + currentDate, + type, + show, + poppable, + minDate, + maxDate, + } = this.data; + // @ts-ignore + const targetDate = type === 'single' ? currentDate : currentDate[0]; + const displayed = show || !poppable; + if (!targetDate || !displayed) { + return; + } + const months = getMonths(minDate, maxDate); + months.some((month, index) => { + if (compareMonth(month, targetDate) === 0) { + this.setData({ scrollIntoView: `month${index}` }); + return true; + } + return false; + }); + }); + }, + onOpen() { + this.$emit('open'); + }, + onOpened() { + this.$emit('opened'); + }, + onClose() { + this.$emit('close'); + }, + onClosed() { + this.$emit('closed'); + }, + onClickDay(event) { + const { date } = event.detail; + const { type, currentDate, allowSameDay } = this.data; + if (type === 'range') { + // @ts-ignore + const [startDay, endDay] = currentDate; + if (startDay && !endDay) { + const compareToStart = compareDay(date, startDay); + if (compareToStart === 1) { + this.select([startDay, date], true); + } else if (compareToStart === -1) { + this.select([date, null]); + } else if (allowSameDay) { + this.select([date, date]); + } + } else { + this.select([date, null]); + } + } else if (type === 'multiple') { + let selectedIndex; + // @ts-ignore + const selected = currentDate.some((dateItem, index) => { + const equal = compareDay(dateItem, date) === 0; + if (equal) { + selectedIndex = index; + } + return equal; + }); + if (selected) { + // @ts-ignore + const cancelDate = currentDate.splice(selectedIndex, 1); + this.setData({ currentDate }); + this.unselect(cancelDate); + } else { + // @ts-ignore + this.select([...currentDate, date]); + } + } else { + this.select(date, true); + } + }, + unselect(dateArray) { + const date = dateArray[0]; + if (date) { + this.$emit('unselect', copyDates(date)); + } + }, + select(date, complete) { + if (complete && this.data.type === 'range') { + const valid = this.checkRange(date); + if (!valid) { + // auto selected to max range if showConfirm + if (this.data.showConfirm) { + this.emit([ + date[0], + getDayByOffset(date[0], this.data.maxRange - 1), + ]); + } else { + this.emit(date); + } + return; + } + } + this.emit(date); + if (complete && !this.data.showConfirm) { + this.onConfirm(); + } + }, + emit(date) { + const getTime = (date) => (date instanceof Date ? date.getTime() : date); + this.setData({ + currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), + }); + this.$emit('select', copyDates(date)); + }, + checkRange(date) { + const { maxRange, rangePrompt } = this.data; + if (maxRange && calcDateNum(date) > maxRange) { + Toast({ + context: this, + message: rangePrompt || `选择天数不能超过 ${maxRange} 天`, + }); + return false; + } + return true; + }, + onConfirm() { + if ( + this.data.type === 'range' && + !this.checkRange(this.data.currentDate) + ) { + return; + } + wx.nextTick(() => { + // @ts-ignore + this.$emit('confirm', copyDates(this.data.currentDate)); + }); + }, + }, +}); diff --git a/vant/dist/calendar/index.json b/vant/dist/calendar/index.json new file mode 100755 index 0000000..397d5ae --- /dev/null +++ b/vant/dist/calendar/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "header": "./components/header/index", + "month": "./components/month/index", + "van-button": "../button/index", + "van-popup": "../popup/index", + "van-toast": "../toast/index" + } +} diff --git a/vant/dist/calendar/index.wxml b/vant/dist/calendar/index.wxml new file mode 100755 index 0000000..7df0b98 --- /dev/null +++ b/vant/dist/calendar/index.wxml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/vant/dist/calendar/index.wxs b/vant/dist/calendar/index.wxs new file mode 100755 index 0000000..2c04be1 --- /dev/null +++ b/vant/dist/calendar/index.wxs @@ -0,0 +1,37 @@ +/* eslint-disable */ +var utils = require('./utils.wxs'); + +function getMonths(minDate, maxDate) { + var months = []; + var cursor = getDate(minDate); + + cursor.setDate(1); + + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (utils.compareMonth(cursor, getDate(maxDate)) !== 1); + + return months; +} + +function getButtonDisabled(type, currentDate) { + if (currentDate == null) { + return true; + } + + if (type === 'range') { + return !currentDate[0] || !currentDate[1]; + } + + if (type === 'multiple') { + return !currentDate.length; + } + + return !currentDate; +} + +module.exports = { + getMonths: getMonths, + getButtonDisabled: getButtonDisabled +}; diff --git a/vant/dist/calendar/index.wxss b/vant/dist/calendar/index.wxss new file mode 100755 index 0000000..9d78e0f --- /dev/null +++ b/vant/dist/calendar/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-calendar{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;height:100%;height:var(--calendar-height,100%);background-color:#fff;background-color:var(--calendar-background-color,#fff)}.van-calendar__close-icon{top:11px}.van-calendar__popup--bottom,.van-calendar__popup--top{height:80%;height:var(--calendar-popup-height,80%)}.van-calendar__popup--left,.van-calendar__popup--right{height:100%}.van-calendar__body{-webkit-flex:1;flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.van-calendar__footer{-webkit-flex-shrink:0;flex-shrink:0;padding:0 16px;padding:0 var(--padding-md,16px)}.van-calendar__footer--safe-area-inset-bottom{padding-bottom:env(safe-area-inset-bottom)}.van-calendar__footer+.van-calendar__footer,.van-calendar__footer:empty{display:none}.van-calendar__footer:empty+.van-calendar__footer{display:block!important}.van-calendar__confirm{height:36px!important;height:var(--calendar-confirm-button-height,36px)!important;margin:7px 0!important;margin:var(--calendar-confirm-button-margin,7px 0)!important;line-height:34px!important;line-height:var(--calendar-confirm-button-line-height,34px)!important} \ No newline at end of file diff --git a/vant/dist/calendar/utils.d.ts b/vant/dist/calendar/utils.d.ts new file mode 100755 index 0000000..02af08d --- /dev/null +++ b/vant/dist/calendar/utils.d.ts @@ -0,0 +1,17 @@ +export declare const ROW_HEIGHT = 64; +export declare function formatMonthTitle(date: Date): string; +export declare function compareMonth( + date1: Date | number, + date2: Date | number +): 0 | 1 | -1; +export declare function compareDay( + day1: Date | number, + day2: Date | number +): 0 | 1 | -1; +export declare function getDayByOffset(date: Date, offset: number): Date; +export declare function getPrevDay(date: Date): Date; +export declare function getNextDay(date: Date): Date; +export declare function calcDateNum(date: [Date, Date]): number; +export declare function copyDates(dates: Date | Date[]): Date | Date[]; +export declare function getMonthEndDay(year: number, month: number): number; +export declare function getMonths(minDate: number, maxDate: number): number[]; diff --git a/vant/dist/calendar/utils.js b/vant/dist/calendar/utils.js new file mode 100755 index 0000000..281a35c --- /dev/null +++ b/vant/dist/calendar/utils.js @@ -0,0 +1,78 @@ +export const ROW_HEIGHT = 64; +export function formatMonthTitle(date) { + if (!(date instanceof Date)) { + date = new Date(date); + } + return `${date.getFullYear()}年${date.getMonth() + 1}月`; +} +export function compareMonth(date1, date2) { + if (!(date1 instanceof Date)) { + date1 = new Date(date1); + } + if (!(date2 instanceof Date)) { + date2 = new Date(date2); + } + const year1 = date1.getFullYear(); + const year2 = date2.getFullYear(); + const month1 = date1.getMonth(); + const month2 = date2.getMonth(); + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + return year1 > year2 ? 1 : -1; +} +export function compareDay(day1, day2) { + if (!(day1 instanceof Date)) { + day1 = new Date(day1); + } + if (!(day2 instanceof Date)) { + day2 = new Date(day2); + } + const compareMonthResult = compareMonth(day1, day2); + if (compareMonthResult === 0) { + const date1 = day1.getDate(); + const date2 = day2.getDate(); + return date1 === date2 ? 0 : date1 > date2 ? 1 : -1; + } + return compareMonthResult; +} +export function getDayByOffset(date, offset) { + date = new Date(date); + date.setDate(date.getDate() + offset); + return date; +} +export function getPrevDay(date) { + return getDayByOffset(date, -1); +} +export function getNextDay(date) { + return getDayByOffset(date, 1); +} +export function calcDateNum(date) { + const day1 = new Date(date[0]).getTime(); + const day2 = new Date(date[1]).getTime(); + return (day2 - day1) / (1000 * 60 * 60 * 24) + 1; +} +export function copyDates(dates) { + if (Array.isArray(dates)) { + return dates.map((date) => { + if (date === null) { + return date; + } + return new Date(date); + }); + } + return new Date(dates); +} +export function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +export function getMonths(minDate, maxDate) { + const months = []; + const cursor = new Date(minDate); + cursor.setDate(1); + do { + months.push(cursor.getTime()); + cursor.setMonth(cursor.getMonth() + 1); + } while (compareMonth(cursor, maxDate) !== 1); + return months; +} diff --git a/vant/dist/calendar/utils.wxs b/vant/dist/calendar/utils.wxs new file mode 100755 index 0000000..e57f6b3 --- /dev/null +++ b/vant/dist/calendar/utils.wxs @@ -0,0 +1,25 @@ +/* eslint-disable */ +function getMonthEndDay(year, month) { + return 32 - getDate(year, month - 1, 32).getDate(); +} + +function compareMonth(date1, date2) { + date1 = getDate(date1); + date2 = getDate(date2); + + var year1 = date1.getFullYear(); + var year2 = date2.getFullYear(); + var month1 = date1.getMonth(); + var month2 = date2.getMonth(); + + if (year1 === year2) { + return month1 === month2 ? 0 : month1 > month2 ? 1 : -1; + } + + return year1 > year2 ? 1 : -1; +} + +module.exports = { + getMonthEndDay: getMonthEndDay, + compareMonth: compareMonth +}; diff --git a/vant/dist/card/index.d.ts b/vant/dist/card/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/card/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/card/index.js b/vant/dist/card/index.js new file mode 100755 index 0000000..6aaf99f --- /dev/null +++ b/vant/dist/card/index.js @@ -0,0 +1,49 @@ +import { link } from '../mixins/link'; +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'num-class', + 'desc-class', + 'thumb-class', + 'title-class', + 'price-class', + 'origin-price-class', + ], + mixins: [link], + props: { + tag: String, + num: String, + desc: String, + thumb: String, + title: String, + price: { + type: String, + observer: 'updatePrice', + }, + centered: Boolean, + lazyLoad: Boolean, + thumbLink: String, + originPrice: String, + thumbMode: { + type: String, + value: 'aspectFit', + }, + currency: { + type: String, + value: '¥', + }, + }, + methods: { + updatePrice() { + const { price } = this.data; + const priceArr = price.toString().split('.'); + this.setData({ + integerStr: priceArr[0], + decimalStr: priceArr[1] ? `.${priceArr[1]}` : '', + }); + }, + onClickThumb() { + this.jumpLink('thumbLink'); + }, + }, +}); diff --git a/vant/dist/card/index.json b/vant/dist/card/index.json new file mode 100755 index 0000000..e917407 --- /dev/null +++ b/vant/dist/card/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-tag": "../tag/index" + } +} diff --git a/vant/dist/card/index.wxml b/vant/dist/card/index.wxml new file mode 100755 index 0000000..62173e4 --- /dev/null +++ b/vant/dist/card/index.wxml @@ -0,0 +1,56 @@ + + + + + + + + + {{ tag }} + + + + + + + {{ title }} + + + {{ desc }} + + + + + + + + + {{ currency }} + {{ integerStr }} + {{ decimalStr }} + + + {{ currency }} {{ originPrice }} + + x {{ num }} + + + + + + + + + + diff --git a/vant/dist/card/index.wxss b/vant/dist/card/index.wxss new file mode 100755 index 0000000..a21a599 --- /dev/null +++ b/vant/dist/card/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:space-between;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{-webkit-justify-content:center;justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute!important;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right} \ No newline at end of file diff --git a/vant/dist/cell-group/index.d.ts b/vant/dist/cell-group/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/cell-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/cell-group/index.js b/vant/dist/cell-group/index.js new file mode 100755 index 0000000..99bcdb9 --- /dev/null +++ b/vant/dist/cell-group/index.js @@ -0,0 +1,10 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + title: String, + border: { + type: Boolean, + value: true, + }, + }, +}); diff --git a/vant/dist/cell-group/index.json b/vant/dist/cell-group/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/cell-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/cell-group/index.wxml b/vant/dist/cell-group/index.wxml new file mode 100755 index 0000000..6e0b471 --- /dev/null +++ b/vant/dist/cell-group/index.wxml @@ -0,0 +1,9 @@ + + {{ title }} + + + + diff --git a/vant/dist/cell-group/index.wxss b/vant/dist/cell-group/index.wxss new file mode 100755 index 0000000..edbccd5 --- /dev/null +++ b/vant/dist/cell-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)} \ No newline at end of file diff --git a/vant/dist/cell/index.d.ts b/vant/dist/cell/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/cell/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/cell/index.js b/vant/dist/cell/index.js new file mode 100755 index 0000000..a0123d1 --- /dev/null +++ b/vant/dist/cell/index.js @@ -0,0 +1,38 @@ +import { link } from '../mixins/link'; +import { VantComponent } from '../common/component'; +VantComponent({ + classes: [ + 'title-class', + 'label-class', + 'value-class', + 'right-icon-class', + 'hover-class', + ], + mixins: [link], + props: { + title: null, + value: null, + icon: String, + size: String, + label: String, + center: Boolean, + isLink: Boolean, + required: Boolean, + clickable: Boolean, + titleWidth: String, + customStyle: String, + arrowDirection: String, + useLabelSlot: Boolean, + border: { + type: Boolean, + value: true, + }, + titleStyle: String, + }, + methods: { + onClick(event) { + this.$emit('click', event.detail); + this.jumpLink(); + }, + }, +}); diff --git a/vant/dist/cell/index.json b/vant/dist/cell/index.json new file mode 100755 index 0000000..0a336c0 --- /dev/null +++ b/vant/dist/cell/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/vant/dist/cell/index.wxml b/vant/dist/cell/index.wxml new file mode 100755 index 0000000..7d7d746 --- /dev/null +++ b/vant/dist/cell/index.wxml @@ -0,0 +1,46 @@ + + + + + + + + + {{ title }} + + + + + {{ label }} + + + + + {{ value }} + + + + + + + + diff --git a/vant/dist/cell/index.wxs b/vant/dist/cell/index.wxs new file mode 100755 index 0000000..e3500c4 --- /dev/null +++ b/vant/dist/cell/index.wxs @@ -0,0 +1,17 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function titleStyle(data) { + return style([ + { + 'max-width': addUnit(data.titleWidth), + 'min-width': addUnit(data.titleWidth), + }, + data.titleStyle, + ]); +} + +module.exports = { + titleStyle: titleStyle, +}; diff --git a/vant/dist/cell/index.wxss b/vant/dist/cell/index.wxss new file mode 100755 index 0000000..605570d --- /dev/null +++ b/vant/dist/cell/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)} \ No newline at end of file diff --git a/vant/dist/checkbox-group/index.d.ts b/vant/dist/checkbox-group/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/checkbox-group/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/checkbox-group/index.js b/vant/dist/checkbox-group/index.js new file mode 100755 index 0000000..1c87155 --- /dev/null +++ b/vant/dist/checkbox-group/index.js @@ -0,0 +1,31 @@ +import { useChildren } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: useChildren('checkbox', function (target) { + this.updateChild(target); + }), + props: { + max: Number, + value: { + type: Array, + observer: 'updateChildren', + }, + disabled: { + type: Boolean, + observer: 'updateChildren', + }, + }, + methods: { + updateChildren() { + this.children.forEach((child) => this.updateChild(child)); + }, + updateChild(child) { + const { value, disabled } = this.data; + child.setData({ + value: value.indexOf(child.data.name) !== -1, + parentDisabled: disabled, + }); + }, + }, +}); diff --git a/vant/dist/checkbox-group/index.json b/vant/dist/checkbox-group/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/checkbox-group/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/checkbox-group/index.wxml b/vant/dist/checkbox-group/index.wxml new file mode 100755 index 0000000..4fa864c --- /dev/null +++ b/vant/dist/checkbox-group/index.wxml @@ -0,0 +1 @@ + diff --git a/vant/dist/checkbox-group/index.wxss b/vant/dist/checkbox-group/index.wxss new file mode 100755 index 0000000..99694d6 --- /dev/null +++ b/vant/dist/checkbox-group/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/vant/dist/checkbox/index.d.ts b/vant/dist/checkbox/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/checkbox/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/checkbox/index.js b/vant/dist/checkbox/index.js new file mode 100755 index 0000000..281f69a --- /dev/null +++ b/vant/dist/checkbox/index.js @@ -0,0 +1,74 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +function emit(target, value) { + target.$emit('input', value); + target.$emit('change', value); +} +VantComponent({ + field: true, + relation: useParent('checkbox-group'), + classes: ['icon-class', 'label-class'], + props: { + value: Boolean, + disabled: Boolean, + useIconSlot: Boolean, + checkedColor: String, + labelPosition: { + type: String, + value: 'right', + }, + labelDisabled: Boolean, + shape: { + type: String, + value: 'round', + }, + iconSize: { + type: null, + value: 20, + }, + }, + data: { + parentDisabled: false, + }, + methods: { + emitChange(value) { + if (this.parent) { + this.setParentValue(this.parent, value); + } else { + emit(this, value); + } + }, + toggle() { + const { parentDisabled, disabled, value } = this.data; + if (!disabled && !parentDisabled) { + this.emitChange(!value); + } + }, + onClickLabel() { + const { labelDisabled, parentDisabled, disabled, value } = this.data; + if (!disabled && !labelDisabled && !parentDisabled) { + this.emitChange(!value); + } + }, + setParentValue(parent, value) { + const parentValue = parent.data.value.slice(); + const { name } = this.data; + const { max } = parent.data; + if (value) { + if (max && parentValue.length >= max) { + return; + } + if (parentValue.indexOf(name) === -1) { + parentValue.push(name); + emit(parent, parentValue); + } + } else { + const index = parentValue.indexOf(name); + if (index !== -1) { + parentValue.splice(index, 1); + emit(parent, parentValue); + } + } + }, + }, +}); diff --git a/vant/dist/checkbox/index.json b/vant/dist/checkbox/index.json new file mode 100755 index 0000000..0a336c0 --- /dev/null +++ b/vant/dist/checkbox/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-icon": "../icon/index" + } +} diff --git a/vant/dist/checkbox/index.wxml b/vant/dist/checkbox/index.wxml new file mode 100755 index 0000000..0c008d8 --- /dev/null +++ b/vant/dist/checkbox/index.wxml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/vant/dist/checkbox/index.wxs b/vant/dist/checkbox/index.wxs new file mode 100755 index 0000000..eb9c772 --- /dev/null +++ b/vant/dist/checkbox/index.wxs @@ -0,0 +1,20 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) { + var styles = { + 'font-size': addUnit(iconSize), + }; + + if (checkedColor && value && !disabled && !parentDisabled) { + styles['border-color'] = checkedColor; + styles['background-color'] = checkedColor; + } + + return style(styles); +} + +module.exports = { + iconStyle: iconStyle, +}; diff --git a/vant/dist/checkbox/index.wxss b/vant/dist/checkbox/index.wxss new file mode 100755 index 0000000..afaf37b --- /dev/null +++ b/vant/dist/checkbox/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/vant/dist/circle/canvas.d.ts b/vant/dist/circle/canvas.d.ts new file mode 100755 index 0000000..6aa52de --- /dev/null +++ b/vant/dist/circle/canvas.d.ts @@ -0,0 +1,6 @@ +/// +declare type CanvasContext = WechatMiniprogram.CanvasContext; +export declare function adaptor( + ctx: CanvasContext & Record +): CanvasContext; +export {}; diff --git a/vant/dist/circle/canvas.js b/vant/dist/circle/canvas.js new file mode 100755 index 0000000..c311335 --- /dev/null +++ b/vant/dist/circle/canvas.js @@ -0,0 +1,43 @@ +export function adaptor(ctx) { + // @ts-ignore + return Object.assign(ctx, { + setStrokeStyle(val) { + ctx.strokeStyle = val; + }, + setLineWidth(val) { + ctx.lineWidth = val; + }, + setLineCap(val) { + ctx.lineCap = val; + }, + setFillStyle(val) { + ctx.fillStyle = val; + }, + setFontSize(val) { + ctx.font = String(val); + }, + setGlobalAlpha(val) { + ctx.globalAlpha = val; + }, + setLineJoin(val) { + ctx.lineJoin = val; + }, + setTextAlign(val) { + ctx.textAlign = val; + }, + setMiterLimit(val) { + ctx.miterLimit = val; + }, + setShadow(offsetX, offsetY, blur, color) { + ctx.shadowOffsetX = offsetX; + ctx.shadowOffsetY = offsetY; + ctx.shadowBlur = blur; + ctx.shadowColor = color; + }, + setTextBaseline(val) { + ctx.textBaseline = val; + }, + createCircularGradient() {}, + draw() {}, + }); +} diff --git a/vant/dist/circle/index.d.ts b/vant/dist/circle/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/circle/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/circle/index.js b/vant/dist/circle/index.js new file mode 100755 index 0000000..c3a2894 --- /dev/null +++ b/vant/dist/circle/index.js @@ -0,0 +1,186 @@ +import { BLUE, WHITE } from '../common/color'; +import { VantComponent } from '../common/component'; +import { getSystemInfoSync } from '../common/utils'; +import { isObj } from '../common/validator'; +import { canIUseCanvas2d } from '../common/version'; +import { adaptor } from './canvas'; +function format(rate) { + return Math.min(Math.max(rate, 0), 100); +} +const PERIMETER = 2 * Math.PI; +const BEGIN_ANGLE = -Math.PI / 2; +const STEP = 1; +VantComponent({ + props: { + text: String, + lineCap: { + type: String, + value: 'round', + }, + value: { + type: Number, + value: 0, + observer: 'reRender', + }, + speed: { + type: Number, + value: 50, + }, + size: { + type: Number, + value: 100, + observer() { + this.drawCircle(this.currentValue); + }, + }, + fill: String, + layerColor: { + type: String, + value: WHITE, + }, + color: { + type: null, + value: BLUE, + observer() { + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); + }, + }, + type: { + type: String, + value: '', + }, + strokeWidth: { + type: Number, + value: 4, + }, + clockwise: { + type: Boolean, + value: true, + }, + }, + data: { + hoverColor: BLUE, + }, + methods: { + getContext() { + const { type, size } = this.data; + if (type === '' || !canIUseCanvas2d()) { + const ctx = wx.createCanvasContext('van-circle', this); + return Promise.resolve(ctx); + } + const dpr = getSystemInfoSync().pixelRatio; + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(this) + .select('#van-circle') + .node() + .exec((res) => { + const canvas = res[0].node; + const ctx = canvas.getContext(type); + if (!this.inited) { + this.inited = true; + canvas.width = size * dpr; + canvas.height = size * dpr; + ctx.scale(dpr, dpr); + } + resolve(adaptor(ctx)); + }); + }); + }, + setHoverColor() { + const { color, size } = this.data; + if (isObj(color)) { + return this.getContext().then((context) => { + const LinearColor = context.createLinearGradient(size, 0, 0, 0); + Object.keys(color) + .sort((a, b) => parseFloat(a) - parseFloat(b)) + .map((key) => + LinearColor.addColorStop(parseFloat(key) / 100, color[key]) + ); + this.hoverColor = LinearColor; + }); + } + this.hoverColor = color; + return Promise.resolve(); + }, + presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) { + const { strokeWidth, lineCap, clockwise, size } = this.data; + const position = size / 2; + const radius = position - strokeWidth / 2; + context.setStrokeStyle(strokeStyle); + context.setLineWidth(strokeWidth); + context.setLineCap(lineCap); + context.beginPath(); + context.arc(position, position, radius, beginAngle, endAngle, !clockwise); + context.stroke(); + if (fill) { + context.setFillStyle(fill); + context.fill(); + } + }, + renderLayerCircle(context) { + const { layerColor, fill } = this.data; + this.presetCanvas(context, layerColor, 0, PERIMETER, fill); + }, + renderHoverCircle(context, formatValue) { + const { clockwise } = this.data; + // 结束角度 + const progress = PERIMETER * (formatValue / 100); + const endAngle = clockwise + ? BEGIN_ANGLE + progress + : 3 * Math.PI - (BEGIN_ANGLE + progress); + this.presetCanvas(context, this.hoverColor, BEGIN_ANGLE, endAngle); + }, + drawCircle(currentValue) { + const { size } = this.data; + this.getContext().then((context) => { + context.clearRect(0, 0, size, size); + this.renderLayerCircle(context); + const formatValue = format(currentValue); + if (formatValue !== 0) { + this.renderHoverCircle(context, formatValue); + } + context.draw(); + }); + }, + reRender() { + // tofector 动画暂时没有想到好的解决方案 + const { value, speed } = this.data; + if (speed <= 0 || speed > 1000) { + this.drawCircle(value); + return; + } + this.clearInterval(); + this.currentValue = this.currentValue || 0; + this.interval = setInterval(() => { + if (this.currentValue !== value) { + if (this.currentValue < value) { + this.currentValue += STEP; + } else { + this.currentValue -= STEP; + } + this.drawCircle(this.currentValue); + } else { + this.clearInterval(); + } + }, 1000 / speed); + }, + clearInterval() { + if (this.interval) { + clearInterval(this.interval); + this.interval = null; + } + }, + }, + mounted() { + this.currentValue = this.data.value; + this.setHoverColor().then(() => { + this.drawCircle(this.currentValue); + }); + }, + destroyed() { + this.clearInterval(); + }, +}); diff --git a/vant/dist/circle/index.json b/vant/dist/circle/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/circle/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/circle/index.wxml b/vant/dist/circle/index.wxml new file mode 100755 index 0000000..52bc59f --- /dev/null +++ b/vant/dist/circle/index.wxml @@ -0,0 +1,9 @@ + + + + + + + + {{ text }} + diff --git a/vant/dist/circle/index.wxss b/vant/dist/circle/index.wxss new file mode 100755 index 0000000..3ab63df --- /dev/null +++ b/vant/dist/circle/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-circle{position:relative;display:inline-block;text-align:center}.van-circle__text{position:absolute;top:50%;left:0;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#323233;color:var(--circle-text-color,#323233)} \ No newline at end of file diff --git a/vant/dist/col/index.d.ts b/vant/dist/col/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/col/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/col/index.js b/vant/dist/col/index.js new file mode 100755 index 0000000..20f326f --- /dev/null +++ b/vant/dist/col/index.js @@ -0,0 +1,9 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + relation: useParent('row'), + props: { + span: Number, + offset: Number, + }, +}); diff --git a/vant/dist/col/index.json b/vant/dist/col/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/col/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/col/index.wxml b/vant/dist/col/index.wxml new file mode 100755 index 0000000..975348b --- /dev/null +++ b/vant/dist/col/index.wxml @@ -0,0 +1,9 @@ + + + + + + diff --git a/vant/dist/col/index.wxs b/vant/dist/col/index.wxs new file mode 100755 index 0000000..507c1cb --- /dev/null +++ b/vant/dist/col/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + if (!data.gutter) { + return ''; + } + + return style({ + 'padding-right': addUnit(data.gutter / 2), + 'padding-left': addUnit(data.gutter / 2), + }); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/vant/dist/col/index.wxss b/vant/dist/col/index.wxss new file mode 100755 index 0000000..44c896a --- /dev/null +++ b/vant/dist/col/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%} \ No newline at end of file diff --git a/vant/dist/collapse-item/animate.d.ts b/vant/dist/collapse-item/animate.d.ts new file mode 100755 index 0000000..0c33c00 --- /dev/null +++ b/vant/dist/collapse-item/animate.d.ts @@ -0,0 +1,6 @@ +/// +export declare function setContentAnimate( + context: WechatMiniprogram.Component.TrivialInstance, + expanded: boolean, + mounted: boolean +): void; diff --git a/vant/dist/collapse-item/animate.js b/vant/dist/collapse-item/animate.js new file mode 100755 index 0000000..7ce1dae --- /dev/null +++ b/vant/dist/collapse-item/animate.js @@ -0,0 +1,70 @@ +import { canIUseAnimate } from '../common/version'; +import { getRect } from '../common/utils'; +function useAnimate(context, expanded, mounted, height) { + const selector = '.van-collapse-item__wrapper'; + if (expanded) { + context.animate( + selector, + [ + { height: 0, ease: 'ease-in-out', offset: 0 }, + { height: `${height}px`, ease: 'ease-in-out', offset: 1 }, + { height: `auto`, ease: 'ease-in-out', offset: 1 }, + ], + mounted ? 300 : 0, + () => { + context.clearAnimation(selector); + } + ); + return; + } + context.animate( + selector, + [ + { height: `${height}px`, ease: 'ease-in-out', offset: 0 }, + { height: 0, ease: 'ease-in-out', offset: 1 }, + ], + 300, + () => { + context.clearAnimation(selector); + } + ); +} +function useAnimation(context, expanded, mounted, height) { + const animation = wx.createAnimation({ + duration: 0, + timingFunction: 'ease-in-out', + }); + if (expanded) { + if (height === 0) { + animation.height('auto').top(1).step(); + } else { + animation + .height(height) + .top(1) + .step({ + duration: mounted ? 300 : 1, + }) + .height('auto') + .step(); + } + context.setData({ + animation: animation.export(), + }); + return; + } + animation.height(height).top(0).step({ duration: 1 }).height(0).step({ + duration: 300, + }); + context.setData({ + animation: animation.export(), + }); +} +export function setContentAnimate(context, expanded, mounted) { + getRect(context, '.van-collapse-item__content') + .then((rect) => rect.height) + .then((height) => { + canIUseAnimate() + ? useAnimate(context, expanded, mounted, height) + : useAnimation(context, expanded, mounted, height); + }); +} diff --git a/vant/dist/collapse-item/index.d.ts b/vant/dist/collapse-item/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/collapse-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/collapse-item/index.js b/vant/dist/collapse-item/index.js new file mode 100755 index 0000000..c44c27e --- /dev/null +++ b/vant/dist/collapse-item/index.js @@ -0,0 +1,59 @@ +import { VantComponent } from '../common/component'; +import { useParent } from '../common/relation'; +import { setContentAnimate } from './animate'; +VantComponent({ + classes: ['title-class', 'content-class'], + relation: useParent('collapse'), + props: { + name: null, + title: null, + value: null, + icon: String, + label: String, + disabled: Boolean, + clickable: Boolean, + border: { + type: Boolean, + value: true, + }, + isLink: { + type: Boolean, + value: true, + }, + }, + data: { + expanded: false, + }, + mounted() { + this.updateExpanded(); + this.mounted = true; + }, + methods: { + updateExpanded() { + if (!this.parent) { + return; + } + const { value, accordion } = this.parent.data; + const { children = [] } = this.parent; + const { name } = this.data; + const index = children.indexOf(this); + const currentName = name == null ? index : name; + const expanded = accordion + ? value === currentName + : (value || []).some((name) => name === currentName); + if (expanded !== this.data.expanded) { + setContentAnimate(this, expanded, this.mounted); + } + this.setData({ index, expanded }); + }, + onClick() { + if (this.data.disabled) { + return; + } + const { name, expanded } = this.data; + const index = this.parent.children.indexOf(this); + const currentName = name == null ? index : name; + this.parent.switch(currentName, !expanded); + }, + }, +}); diff --git a/vant/dist/collapse-item/index.json b/vant/dist/collapse-item/index.json new file mode 100755 index 0000000..0e5425c --- /dev/null +++ b/vant/dist/collapse-item/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index" + } +} diff --git a/vant/dist/collapse-item/index.wxml b/vant/dist/collapse-item/index.wxml new file mode 100755 index 0000000..ae4cc83 --- /dev/null +++ b/vant/dist/collapse-item/index.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + diff --git a/vant/dist/collapse-item/index.wxss b/vant/dist/collapse-item/index.wxss new file mode 100755 index 0000000..0bb936c --- /dev/null +++ b/vant/dist/collapse-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;transition:-webkit-transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s),-webkit-transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c8c9cc!important;color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important;background-color:var(--white,#fff)!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{padding:15px;padding:var(--collapse-item-content-padding,15px);color:#969799;color:var(--collapse-item-content-text-color,#969799);font-size:13px;font-size:var(--collapse-item-content-font-size,13px);line-height:1.5;line-height:var(--collapse-item-content-line-height,1.5);background-color:#fff;background-color:var(--collapse-item-content-background-color,#fff)} \ No newline at end of file diff --git a/vant/dist/collapse/index.d.ts b/vant/dist/collapse/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/collapse/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/collapse/index.js b/vant/dist/collapse/index.js new file mode 100755 index 0000000..60e4611 --- /dev/null +++ b/vant/dist/collapse/index.js @@ -0,0 +1,44 @@ +import { VantComponent } from '../common/component'; +import { useChildren } from '../common/relation'; +VantComponent({ + relation: useChildren('collapse-item'), + props: { + value: { + type: null, + observer: 'updateExpanded', + }, + accordion: { + type: Boolean, + observer: 'updateExpanded', + }, + border: { + type: Boolean, + value: true, + }, + }, + methods: { + updateExpanded() { + this.children.forEach((child) => { + child.updateExpanded(); + }); + }, + switch(name, expanded) { + const { accordion, value } = this.data; + const changeItem = name; + if (!accordion) { + name = expanded + ? (value || []).concat(name) + : (value || []).filter((activeName) => activeName !== name); + } else { + name = expanded ? name : ''; + } + if (expanded) { + this.$emit('open', changeItem); + } else { + this.$emit('close', changeItem); + } + this.$emit('change', name); + this.$emit('input', name); + }, + }, +}); diff --git a/vant/dist/collapse/index.json b/vant/dist/collapse/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/collapse/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/collapse/index.wxml b/vant/dist/collapse/index.wxml new file mode 100755 index 0000000..fd4e171 --- /dev/null +++ b/vant/dist/collapse/index.wxml @@ -0,0 +1,3 @@ + + + diff --git a/vant/dist/collapse/index.wxss b/vant/dist/collapse/index.wxss new file mode 100755 index 0000000..99694d6 --- /dev/null +++ b/vant/dist/collapse/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/vant/dist/common/color.d.ts b/vant/dist/common/color.d.ts new file mode 100755 index 0000000..386f307 --- /dev/null +++ b/vant/dist/common/color.d.ts @@ -0,0 +1,7 @@ +export declare const RED = "#ee0a24"; +export declare const BLUE = "#1989fa"; +export declare const WHITE = "#fff"; +export declare const GREEN = "#07c160"; +export declare const ORANGE = "#ff976a"; +export declare const GRAY = "#323233"; +export declare const GRAY_DARK = "#969799"; diff --git a/vant/dist/common/color.js b/vant/dist/common/color.js new file mode 100755 index 0000000..6b285bd --- /dev/null +++ b/vant/dist/common/color.js @@ -0,0 +1,7 @@ +export const RED = '#ee0a24'; +export const BLUE = '#1989fa'; +export const WHITE = '#fff'; +export const GREEN = '#07c160'; +export const ORANGE = '#ff976a'; +export const GRAY = '#323233'; +export const GRAY_DARK = '#969799'; diff --git a/vant/dist/common/component.d.ts b/vant/dist/common/component.d.ts new file mode 100755 index 0000000..6b0a958 --- /dev/null +++ b/vant/dist/common/component.d.ts @@ -0,0 +1,8 @@ +/// +import { VantComponentOptions } from '../definitions/index'; +declare function VantComponent< + Data extends WechatMiniprogram.Component.DataOption, + Props extends WechatMiniprogram.Component.PropertyOption, + Methods extends WechatMiniprogram.Component.MethodOption +>(vantOptions: VantComponentOptions): void; +export { VantComponent }; diff --git a/vant/dist/common/component.js b/vant/dist/common/component.js new file mode 100755 index 0000000..5530c6f --- /dev/null +++ b/vant/dist/common/component.js @@ -0,0 +1,45 @@ +import { basic } from '../mixins/basic'; +function mapKeys(source, target, map) { + Object.keys(map).forEach((key) => { + if (source[key]) { + target[map[key]] = source[key]; + } + }); +} +function VantComponent(vantOptions) { + const options = {}; + mapKeys(vantOptions, options, { + data: 'data', + props: 'properties', + mixins: 'behaviors', + methods: 'methods', + beforeCreate: 'created', + created: 'attached', + mounted: 'ready', + destroyed: 'detached', + classes: 'externalClasses', + }); + // add default externalClasses + options.externalClasses = options.externalClasses || []; + options.externalClasses.push('custom-class'); + // add default behaviors + options.behaviors = options.behaviors || []; + options.behaviors.push(basic); + // add relations + const { relation } = vantOptions; + if (relation) { + options.relations = relation.relations; + options.behaviors.push(relation.mixin); + } + // map field to form-field behavior + if (vantOptions.field) { + options.behaviors.push('wx://form-field'); + } + // add default options + options.options = { + multipleSlots: true, + addGlobalClass: true, + }; + Component(options); +} +export { VantComponent }; diff --git a/vant/dist/common/index.wxss b/vant/dist/common/index.wxss new file mode 100755 index 0000000..ad44c84 --- /dev/null +++ b/vant/dist/common/index.wxss @@ -0,0 +1,83 @@ +.van-ellipsis { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis +} + +.van-multi-ellipsis--l2 { + -webkit-line-clamp: 2 +} + +.van-multi-ellipsis--l2, +.van-multi-ellipsis--l3 { + display: -webkit-box; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical +} + +.van-multi-ellipsis--l3 { + -webkit-line-clamp: 3 +} + +.van-clearfix:after { + display: table; + clear: both; + content: "" +} + +.van-hairline, +.van-hairline--bottom, +.van-hairline--left, +.van-hairline--right, +.van-hairline--surround, +.van-hairline--top, +.van-hairline--top-bottom { + position: relative +} + +.van-hairline--bottom:after, +.van-hairline--left:after, +.van-hairline--right:after, +.van-hairline--surround:after, +.van-hairline--top-bottom:after, +.van-hairline--top:after, +.van-hairline:after { + position: absolute; + box-sizing: border-box; + -webkit-transform-origin: center; + transform-origin: center; + content: " "; + pointer-events: none; + top: -50%; + right: -50%; + bottom: -50%; + left: -50%; + border: 0 solid #ebedf0; + -webkit-transform: scale(.5); + transform: scale(.5) +} + +.van-hairline--top:after { + border-top-width: 1px +} + +.van-hairline--left:after { + border-left-width: 1px +} + +.van-hairline--right:after { + border-right-width: 1px +} + +.van-hairline--bottom:after { + border-bottom-width: 1px +} + +.van-hairline--top-bottom:after { + border-width: 1px 0 +} + +.van-hairline--surround:after { + border-width: 1px +} \ No newline at end of file diff --git a/vant/dist/common/relation.d.ts b/vant/dist/common/relation.d.ts new file mode 100755 index 0000000..be5f2ee --- /dev/null +++ b/vant/dist/common/relation.d.ts @@ -0,0 +1,21 @@ +/// +declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance; +export declare function useParent( + name: string, + onEffect?: (this: TrivialInstance) => void +): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export declare function useChildren( + name: string, + onEffect?: (this: TrivialInstance, target: TrivialInstance) => void +): { + relations: { + [x: string]: WechatMiniprogram.Component.RelationOption; + }; + mixin: string; +}; +export {}; diff --git a/vant/dist/common/relation.js b/vant/dist/common/relation.js new file mode 100755 index 0000000..99c1a49 --- /dev/null +++ b/vant/dist/common/relation.js @@ -0,0 +1,64 @@ +export function useParent(name, onEffect) { + const path = `../${name}/index`; + return { + relations: { + [path]: { + type: 'ancestor', + linked() { + onEffect && onEffect.call(this); + }, + linkChanged() { + onEffect && onEffect.call(this); + }, + unlinked() { + onEffect && onEffect.call(this); + }, + }, + }, + mixin: Behavior({ + created() { + Object.defineProperty(this, 'parent', { + get: () => this.getRelationNodes(path)[0], + }); + Object.defineProperty(this, 'index', { + // @ts-ignore + get: () => { + var _a, _b; + return (_b = + (_a = this.parent) === null || _a === void 0 + ? void 0 + : _a.children) === null || _b === void 0 + ? void 0 + : _b.indexOf(this); + }, + }); + }, + }), + }; +} +export function useChildren(name, onEffect) { + const path = `../${name}/index`; + return { + relations: { + [path]: { + type: 'descendant', + linked(target) { + onEffect && onEffect.call(this, target); + }, + linkChanged(target) { + onEffect && onEffect.call(this, target); + }, + unlinked(target) { + onEffect && onEffect.call(this, target); + }, + }, + }, + mixin: Behavior({ + created() { + Object.defineProperty(this, 'children', { + get: () => this.getRelationNodes(path) || [], + }); + }, + }), + }; +} diff --git a/vant/dist/common/style/clearfix.wxss b/vant/dist/common/style/clearfix.wxss new file mode 100755 index 0000000..a0ca838 --- /dev/null +++ b/vant/dist/common/style/clearfix.wxss @@ -0,0 +1 @@ +.van-clearfix:after{display:table;clear:both;content:""} \ No newline at end of file diff --git a/vant/dist/common/style/ellipsis.wxss b/vant/dist/common/style/ellipsis.wxss new file mode 100755 index 0000000..1e9dbc9 --- /dev/null +++ b/vant/dist/common/style/ellipsis.wxss @@ -0,0 +1 @@ +.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3} \ No newline at end of file diff --git a/vant/dist/common/style/hairline.wxss b/vant/dist/common/style/hairline.wxss new file mode 100755 index 0000000..41246f9 --- /dev/null +++ b/vant/dist/common/style/hairline.wxss @@ -0,0 +1,55 @@ +.van-hairline, +.van-hairline--bottom, +.van-hairline--left, +.van-hairline--right, +.van-hairline--surround, +.van-hairline--top, +.van-hairline--top-bottom { + position: relative +} + +.van-hairline--bottom:after, +.van-hairline--left:after, +.van-hairline--right:after, +.van-hairline--surround:after, +.van-hairline--top-bottom:after, +.van-hairline--top:after, +.van-hairline:after { + position: absolute; + box-sizing: border-box; + -webkit-transform-origin: center; + transform-origin: center; + content: " "; + pointer-events: none; + top: -50%; + right: -50%; + bottom: -50%; + left: -50%; + border: 0 solid #ebedf0; + -webkit-transform: scale(.5); + transform: scale(.5) +} + +.van-hairline--top:after { + border-top-width: 1px +} + +.van-hairline--left:after { + border-left-width: 1px +} + +.van-hairline--right:after { + border-right-width: 1px +} + +.van-hairline--bottom:after { + border-bottom-width: 1px +} + +.van-hairline--top-bottom:after { + border-width: 1px 0 +} + +.van-hairline--surround:after { + border-width: 1px +} \ No newline at end of file diff --git a/vant/dist/common/style/mixins/clearfix.wxss b/vant/dist/common/style/mixins/clearfix.wxss new file mode 100755 index 0000000..e69de29 diff --git a/vant/dist/common/style/mixins/ellipsis.wxss b/vant/dist/common/style/mixins/ellipsis.wxss new file mode 100755 index 0000000..e69de29 diff --git a/vant/dist/common/style/mixins/hairline.wxss b/vant/dist/common/style/mixins/hairline.wxss new file mode 100755 index 0000000..e69de29 diff --git a/vant/dist/common/style/theme.wxss b/vant/dist/common/style/theme.wxss new file mode 100755 index 0000000..e69de29 diff --git a/vant/dist/common/style/var.wxss b/vant/dist/common/style/var.wxss new file mode 100755 index 0000000..e69de29 diff --git a/vant/dist/common/utils.d.ts b/vant/dist/common/utils.d.ts new file mode 100755 index 0000000..1ceccd1 --- /dev/null +++ b/vant/dist/common/utils.d.ts @@ -0,0 +1,30 @@ +/// +export declare function range(num: number, min: number, max: number): number; +export declare function nextTick(cb: (...args: any[]) => void): void; +export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSyncResult; +export declare function addUnit(value?: string | number): string | undefined; +export declare function requestAnimationFrame( + cb: () => void +): number | WechatMiniprogram.NodesRef; +export declare function pickExclude(obj: unknown, keys: string[]): {}; +export declare function getRect( + context: WechatMiniprogram.Component.TrivialInstance, + selector: string +): Promise; +export declare function getAllRect( + context: WechatMiniprogram.Component.TrivialInstance, + selector: string +): Promise; +export declare function groupSetData( + context: WechatMiniprogram.Component.TrivialInstance, + cb: () => void +): void; +export declare function toPromise( + promiseLike: Promise | unknown +): Promise; +export declare function getCurrentPage(): T & + WechatMiniprogram.OptionalInterface & + WechatMiniprogram.Page.InstanceProperties & + WechatMiniprogram.Page.InstanceMethods> & + WechatMiniprogram.Page.Data> & + Record; diff --git a/vant/dist/common/utils.js b/vant/dist/common/utils.js new file mode 100755 index 0000000..8135171 --- /dev/null +++ b/vant/dist/common/utils.js @@ -0,0 +1,89 @@ +import { isDef, isNumber, isPlainObject, isPromise } from './validator'; +import { canIUseGroupSetData, canIUseNextTick } from './version'; +export function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +export function nextTick(cb) { + if (canIUseNextTick()) { + wx.nextTick(cb); + } else { + setTimeout(() => { + cb(); + }, 1000 / 30); + } +} +let systemInfo; +export function getSystemInfoSync() { + if (systemInfo == null) { + systemInfo = wx.getSystemInfoSync(); + } + return systemInfo; +} +export function addUnit(value) { + if (!isDef(value)) { + return undefined; + } + value = String(value); + return isNumber(value) ? `${value}px` : value; +} +export function requestAnimationFrame(cb) { + const systemInfo = getSystemInfoSync(); + if (systemInfo.platform === 'devtools') { + return setTimeout(() => { + cb(); + }, 1000 / 30); + } + return wx + .createSelectorQuery() + .selectViewport() + .boundingClientRect() + .exec(() => { + cb(); + }); +} +export function pickExclude(obj, keys) { + if (!isPlainObject(obj)) { + return {}; + } + return Object.keys(obj).reduce((prev, key) => { + if (!keys.includes(key)) { + prev[key] = obj[key]; + } + return prev; + }, {}); +} +export function getRect(context, selector) { + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(context) + .select(selector) + .boundingClientRect() + .exec((rect = []) => resolve(rect[0])); + }); +} +export function getAllRect(context, selector) { + return new Promise((resolve) => { + wx.createSelectorQuery() + .in(context) + .selectAll(selector) + .boundingClientRect() + .exec((rect = []) => resolve(rect[0])); + }); +} +export function groupSetData(context, cb) { + if (canIUseGroupSetData()) { + context.groupSetData(cb); + } else { + cb(); + } +} +export function toPromise(promiseLike) { + if (isPromise(promiseLike)) { + return promiseLike; + } + return Promise.resolve(promiseLike); +} +export function getCurrentPage() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} diff --git a/vant/dist/common/validator.d.ts b/vant/dist/common/validator.d.ts new file mode 100755 index 0000000..ae7c48f --- /dev/null +++ b/vant/dist/common/validator.d.ts @@ -0,0 +1,11 @@ +export declare function isFunction(val: unknown): val is Function; +export declare function isPlainObject( + val: unknown +): val is Record; +export declare function isPromise(val: unknown): val is Promise; +export declare function isDef(value: unknown): boolean; +export declare function isObj(x: unknown): x is Record; +export declare function isNumber(value: string): boolean; +export declare function isBoolean(value: unknown): value is boolean; +export declare function isImageUrl(url: string): boolean; +export declare function isVideoUrl(url: string): boolean; diff --git a/vant/dist/common/validator.js b/vant/dist/common/validator.js new file mode 100755 index 0000000..1c7d1e9 --- /dev/null +++ b/vant/dist/common/validator.js @@ -0,0 +1,30 @@ +export function isFunction(val) { + return typeof val === 'function'; +} +export function isPlainObject(val) { + return val !== null && typeof val === 'object' && !Array.isArray(val); +} +export function isPromise(val) { + return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch); +} +export function isDef(value) { + return value !== undefined && value !== null; +} +export function isObj(x) { + const type = typeof x; + return x !== null && (type === 'object' || type === 'function'); +} +export function isNumber(value) { + return /^\d+(\.\d+)?$/.test(value); +} +export function isBoolean(value) { + return typeof value === 'boolean'; +} +const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i; +const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i; +export function isImageUrl(url) { + return IMAGE_REGEXP.test(url); +} +export function isVideoUrl(url) { + return VIDEO_REGEXP.test(url); +} diff --git a/vant/dist/common/version.d.ts b/vant/dist/common/version.d.ts new file mode 100755 index 0000000..89c4ddd --- /dev/null +++ b/vant/dist/common/version.d.ts @@ -0,0 +1,6 @@ +export declare function canIUseModel(): boolean; +export declare function canIUseFormFieldButton(): boolean; +export declare function canIUseAnimate(): boolean; +export declare function canIUseGroupSetData(): boolean; +export declare function canIUseNextTick(): boolean; +export declare function canIUseCanvas2d(): boolean; diff --git a/vant/dist/common/version.js b/vant/dist/common/version.js new file mode 100755 index 0000000..34d698e --- /dev/null +++ b/vant/dist/common/version.js @@ -0,0 +1,45 @@ +import { getSystemInfoSync } from './utils'; +function compareVersion(v1, v2) { + v1 = v1.split('.'); + v2 = v2.split('.'); + const len = Math.max(v1.length, v2.length); + while (v1.length < len) { + v1.push('0'); + } + while (v2.length < len) { + v2.push('0'); + } + for (let i = 0; i < len; i++) { + const num1 = parseInt(v1[i], 10); + const num2 = parseInt(v2[i], 10); + if (num1 > num2) { + return 1; + } + if (num1 < num2) { + return -1; + } + } + return 0; +} +function gte(version) { + const system = getSystemInfoSync(); + return compareVersion(system.SDKVersion, version) >= 0; +} +export function canIUseModel() { + return gte('2.9.3'); +} +export function canIUseFormFieldButton() { + return gte('2.10.3'); +} +export function canIUseAnimate() { + return gte('2.9.0'); +} +export function canIUseGroupSetData() { + return gte('2.4.0'); +} +export function canIUseNextTick() { + return wx.canIUse('nextTick'); +} +export function canIUseCanvas2d() { + return gte('2.9.0'); +} diff --git a/vant/dist/count-down/index.d.ts b/vant/dist/count-down/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/count-down/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/count-down/index.js b/vant/dist/count-down/index.js new file mode 100755 index 0000000..78dbb88 --- /dev/null +++ b/vant/dist/count-down/index.js @@ -0,0 +1,99 @@ +import { VantComponent } from '../common/component'; +import { isSameSecond, parseFormat, parseTimeData } from './utils'; +function simpleTick(fn) { + return setTimeout(fn, 30); +} +VantComponent({ + props: { + useSlot: Boolean, + millisecond: Boolean, + time: { + type: Number, + observer: 'reset', + }, + format: { + type: String, + value: 'HH:mm:ss', + }, + autoStart: { + type: Boolean, + value: true, + }, + }, + data: { + timeData: parseTimeData(0), + formattedTime: '0', + }, + destroyed() { + clearTimeout(this.tid); + this.tid = null; + }, + methods: { + // 开始 + start() { + if (this.counting) { + return; + } + this.counting = true; + this.endTime = Date.now() + this.remain; + this.tick(); + }, + // 暂停 + pause() { + this.counting = false; + clearTimeout(this.tid); + }, + // 重置 + reset() { + this.pause(); + this.remain = this.data.time; + this.setRemain(this.remain); + if (this.data.autoStart) { + this.start(); + } + }, + tick() { + if (this.data.millisecond) { + this.microTick(); + } else { + this.macroTick(); + } + }, + microTick() { + this.tid = simpleTick(() => { + this.setRemain(this.getRemain()); + if (this.remain !== 0) { + this.microTick(); + } + }); + }, + macroTick() { + this.tid = simpleTick(() => { + const remain = this.getRemain(); + if (!isSameSecond(remain, this.remain) || remain === 0) { + this.setRemain(remain); + } + if (this.remain !== 0) { + this.macroTick(); + } + }); + }, + getRemain() { + return Math.max(this.endTime - Date.now(), 0); + }, + setRemain(remain) { + this.remain = remain; + const timeData = parseTimeData(remain); + if (this.data.useSlot) { + this.$emit('change', timeData); + } + this.setData({ + formattedTime: parseFormat(this.data.format, timeData), + }); + if (remain === 0) { + this.pause(); + this.$emit('finish'); + } + }, + }, +}); diff --git a/vant/dist/count-down/index.json b/vant/dist/count-down/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/count-down/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/count-down/index.wxml b/vant/dist/count-down/index.wxml new file mode 100755 index 0000000..e206e16 --- /dev/null +++ b/vant/dist/count-down/index.wxml @@ -0,0 +1,4 @@ + + + {{ formattedTime }} + diff --git a/vant/dist/count-down/index.wxss b/vant/dist/count-down/index.wxss new file mode 100755 index 0000000..bc33f5d --- /dev/null +++ b/vant/dist/count-down/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-count-down{color:#323233;color:var(--count-down-text-color,#323233);font-size:14px;font-size:var(--count-down-font-size,14px);line-height:20px;line-height:var(--count-down-line-height,20px)} \ No newline at end of file diff --git a/vant/dist/count-down/utils.d.ts b/vant/dist/count-down/utils.d.ts new file mode 100755 index 0000000..e4a58dd --- /dev/null +++ b/vant/dist/count-down/utils.d.ts @@ -0,0 +1,10 @@ +export declare type TimeData = { + days: number; + hours: number; + minutes: number; + seconds: number; + milliseconds: number; +}; +export declare function parseTimeData(time: number): TimeData; +export declare function parseFormat(format: string, timeData: TimeData): string; +export declare function isSameSecond(time1: number, time2: number): boolean; diff --git a/vant/dist/count-down/utils.js b/vant/dist/count-down/utils.js new file mode 100755 index 0000000..a9f05b8 --- /dev/null +++ b/vant/dist/count-down/utils.js @@ -0,0 +1,53 @@ +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) { + const { days } = timeData; + let { hours, minutes, seconds, milliseconds } = timeData; + if (format.indexOf('DD') === -1) { + hours += days * 24; + } else { + format = format.replace('DD', padZero(days)); + } + 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/vant/dist/cropper/index.js b/vant/dist/cropper/index.js new file mode 100755 index 0000000..9a80a7a --- /dev/null +++ b/vant/dist/cropper/index.js @@ -0,0 +1,381 @@ +const defaultData = { + isShowCropper:false, + // 初始化的宽高 + cropperInitW: 750, + cropperInitH: 750, + // 动态的宽高 + cropperW: 750, + cropperH: 750, + // 动态的left top值 + cropperL: 0, + cropperT: 0, + + transL: 0, + transT: 0, + + // 图片缩放值 + scaleP: 0, + imageW: 0, + imageH: 0, + + // 裁剪框 宽高 + cutL: 0, + cutT: 0, + cutB: 0, + cutR: 0, + + qualityWidth: '', + innerAspectRadio: 750 / wx.getSystemInfoSync().windowWidth, + + C_CONSTANTS:{ + SCREEN_WIDTH : 750, + PAGE_X:0, // 手按下的x位置 + PAGE_Y:0, // 手按下y的位置 + PR : wx.getSystemInfoSync().pixelRatio, // dpi + T_PAGE_X:{}, // 手移动的时候x的位置 + T_PAGE_Y:{}, // 手移动的时候Y的位置 + CUT_L:0, // 初始化拖拽元素的left值 + CUT_T:0, // 初始化拖拽元素的top值 + CUT_R:0, // 初始化拖拽元素的 + CUT_B:0, // 初始化拖拽元素的 + CUT_W:0, // 初始化拖拽元素的宽度 + CUT_H:0, // 初始化拖拽元素的高度 + IMG_RATIO:0, // 图片比例 + IMG_REAL_W:0, // 图片实际的宽度 + IMG_REAL_H:0, // 图片实际的高度 + IMG_TYPE:'',//图片的格式 + DRAFG_MOVE_RATIO : 750 / wx.getSystemInfoSync().windowWidth //移动时候的比例 + } +}; +let data = {}; + +try{ + data = JSON.parse(JSON.stringify(defaultData)); +}catch(e){console.log(e)}; + +Component({ + properties: { + imageSrc:{ + type:String, + value:'', + observer(newVal, oldVal) { + if(newVal !== oldVal){ + this.setData({ + isShowCropper:true + },() => { + this.loadImage(); + }) + } + + } + }, + isCircleCrop:{ + type:Boolean, + value:false + }, + enableScale:{ + type:Boolean, + value:false + }, + ratio:{ + type:Number, + value:1 + } + }, + data, + ready(){ + if(this.data.isCircleCrop){ + //圆形裁剪 强制比例为1 + this.setData({ + ratio:1 + }) + } + }, + methods: { + loadImage() { + let {ratio,imageSrc} = this.data; + let {IMG_REAL_W,IMG_REAL_H,IMG_RATIO,SCREEN_WIDTH,IMG_TYPE} = this.data.C_CONSTANTS; + wx.getImageInfo({ + src: imageSrc, + success: res => { + IMG_REAL_W = res.width; + IMG_REAL_H = res.height; + IMG_RATIO = IMG_REAL_W / IMG_REAL_H; + IMG_TYPE = res.type === 'png' ? 'png' : 'jpg'; + // 根据图片的宽高显示不同的效果 保证图片可以正常显示 + let temp = {}; + let cropperData = {}; + if (IMG_RATIO >= 1) { + cropperData = { + cropperW: SCREEN_WIDTH, + cropperH: SCREEN_WIDTH / IMG_RATIO, + // 初始化left right + cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2), + cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2) + } + if(ratio > 1){ + temp = { + cutL: (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2, + cutT: (SCREEN_WIDTH / IMG_RATIO - SCREEN_WIDTH / IMG_RATIO / ratio ) / 2, + cutR: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2 - SCREEN_WIDTH / IMG_RATIO, + cutB: SCREEN_WIDTH / IMG_RATIO - (SCREEN_WIDTH / IMG_RATIO - SCREEN_WIDTH / IMG_RATIO / ratio ) / 2 - SCREEN_WIDTH / IMG_RATIO / ratio + } + }else{ + temp = { + cutT:0, + cutB:0, + cutL:(SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO * ratio) / 2, + cutR: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO * ratio) / 2 - SCREEN_WIDTH / IMG_RATIO * ratio + } + } + } else { + cropperData = { + cropperW: SCREEN_WIDTH * IMG_RATIO, + cropperH: SCREEN_WIDTH, + // 初始化left right + cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2), + cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2) + } + if(ratio > 1){ + temp = { + cutL:0, + cutR:0, + cutT: (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO / ratio) / 2, + cutB: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO / ratio) / 2 - SCREEN_WIDTH * IMG_RATIO / ratio + } + }else{ + temp = { + cutL: (SCREEN_WIDTH * IMG_RATIO - SCREEN_WIDTH * IMG_RATIO * ratio) / 2, + cutR: SCREEN_WIDTH * IMG_RATIO - (SCREEN_WIDTH * IMG_RATIO - SCREEN_WIDTH * IMG_RATIO * ratio) / 2 - SCREEN_WIDTH * IMG_RATIO * ratio, + cutT: (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2, + cutB: SCREEN_WIDTH - (SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2 - SCREEN_WIDTH * IMG_RATIO + } + + } + } + this.setData({ + C_CONSTANTS:Object.assign({},this.data.C_CONSTANTS,{ + IMG_REAL_W, + IMG_REAL_H, + IMG_RATIO, + IMG_TYPE + }), + isShowCropper: true, + // 图片缩放值 + scaleP: IMG_REAL_W / SCREEN_WIDTH, + qualityWidth: IMG_REAL_W, + innerAspectRadio: IMG_RATIO, + ...temp, + ...cropperData + }) + } + }); + + }, + contentStartMove(e) { + this.setData({ + 'C_CONSTANTS.PAGE_X':e.touches[0].pageX, + 'C_CONSTANTS.PAGE_Y':e.touches[0].pageY + }) + }, + // 拖动时候触发的touchMove事件 + contentMoveing(e) { + let {PAGE_X,PAGE_Y,DRAFG_MOVE_RATIO} = this.data.C_CONSTANTS; + let {cutL,cutR,cutT,cutB} = this.data; + let dragLengthX = (PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO + let dragLengthY = (PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO + // 左移 + if (dragLengthX > 0) { + if (cutL - dragLengthX < 0) dragLengthX = cutL + } else { + if (cutR + dragLengthX < 0) dragLengthX = -cutR + } + + if (dragLengthY > 0) { + if (cutT - dragLengthY < 0) dragLengthY = cutT + } else { + if (cutB + dragLengthY < 0) dragLengthY = -cutB + } + this.setData({ + cutL: cutL - dragLengthX, + cutT: cutT - dragLengthY, + cutR: cutR + dragLengthX, + cutB: cutB + dragLengthY, + 'C_CONSTANTS.PAGE_X':e.touches[0].pageX, + 'C_CONSTANTS.PAGE_Y':e.touches[0].pageY + }); + }, + // 设置大小的时候触发的touchStart事件 + dragStart(e) { + let {cutL,cutR,cutT,cutB} = this.data; + this.setData({ + C_CONSTANTS:Object.assign({},this.data.C_CONSTANTS,{ + T_PAGE_X : e.touches[0].pageX, + T_PAGE_Y : e.touches[0].pageY, + CUT_L : cutL, + CUT_R : cutR, + CUT_B : cutB, + CUT_T : cutT + }) + }) + + }, + // 设置大小的时候触发的touchMove事件 + dragMove(e) { + let dragType = e.target.dataset.drag + let {ratio,cropperW,cropperH,cutL,cutT,cutR,cutB,enableScale} = this.data; + let {CUT_R,CUT_L,CUT_T,CUT_B,T_PAGE_X,T_PAGE_Y,DRAFG_MOVE_RATIO} = this.data.C_CONSTANTS; + let dragLength; + switch (dragType) { + case 'right': + dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO + if (CUT_R + dragLength < 0) dragLength = -CUT_R + cutR = CUT_R + dragLength; + if(enableScale){ + cutT = CUT_T + dragLength / ratio; + } + if(cutR < 0 || cutT < 0 || cutT > cropperH || cutR > cropperW) return; + break; + case 'left': + dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO + if (CUT_L - dragLength < 0) dragLength = CUT_L + if ((CUT_L - dragLength) > (this.data.cropperW - this.data.cutR)) dragLength = CUT_L - (this.data.cropperW - this.data.cutR) + cutL = CUT_L - dragLength; + if(enableScale){ + cutT = CUT_T - dragLength / ratio; + } + if(cutL < 0 || cutT < 0 || cutT > cropperH || cutL > cropperW) return; + break; + case 'top': + dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO + if (CUT_T - dragLength < 0) dragLength = CUT_T + if ((CUT_T - dragLength) > (this.data.cropperH - this.data.cutB)) dragLength = CUT_T - (this.data.cropperH - this.data.cutB) + cutT = CUT_T - dragLength; + if(enableScale){ + cutR = CUT_R - dragLength * ratio; + } + break; + case 'bottom': + dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO + if (CUT_B + dragLength < 0) dragLength = -CUT_B + cutB = CUT_B + dragLength; + if(enableScale){ + cutR = CUT_R + dragLength * ratio; + } + if(cutR < 0 || cutT < 0 || cutT > cropperH || cutR > cropperW) return; + break; + default:''; + } + this.setData({ + cutL, + cutT, + cutR, + cutB + }); + }, + contentTouchEnd(){}, + // 获取图片 + confirmCropper() { + const {isCircleCrop} = this.data;; + if(isCircleCrop){ + this.circleCrop() + }else{ + this.normalCropper(); + } + }, + + normalCropper(){ + let {imageSrc,cropperW,cropperH,cutL,cutT,cutR,cutB} = this.data; + let {IMG_REAL_W,IMG_REAL_H,IMG_TYPE} = this.data.C_CONSTANTS; + // 将图片写入画布 + const ctx = wx.createCanvasContext('cropper',this) + ctx.drawImage(imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H); + ctx.draw(true, () => { + // 获取画布要裁剪的位置和宽度 均为百分比 * 画布中图片的宽度 保证了在微信小程序中裁剪的图片模糊 位置不对的问题 canvasT = (_this.data.cutT / _this.data.cropperH) * (_this.data.imageH / pixelRatio) + let canvasW = ((cropperW - cutL - cutR) / cropperW) * IMG_REAL_W + let canvasH = ((cropperH - cutT - cutB) / cropperH) * IMG_REAL_H + let canvasL = (cutL / cropperW) * IMG_REAL_W + let canvasT = (cutT / cropperH) * IMG_REAL_H + wx.canvasToTempFilePath({ + x: canvasL, + y: canvasT, + width: canvasW, + height: canvasH, + destWidth: canvasW, + destHeight: canvasH, + fileType:IMG_TYPE || 'jpg', + canvasId: 'cropper', + success: (res) => { + //图片裁剪成功 + this.cancelCropper(); + this.triggerEvent('cropperDone', { + src:res.tempFilePath, + cropperData:{ + x: canvasL, + y: canvasT, + width: canvasW, + height: canvasH + } + }) + }, + fail:err =>{ + this.triggerEvent('cropperFail',err) + } + },this); + }) + }, + + circleCrop(){ + let {imageSrc,cropperW,cropperH,cutL,cutT,cutR,cutB} = this.data; + let {IMG_REAL_W,IMG_REAL_H,IMG_TYPE} = this.data.C_CONSTANTS; + // 将图片写入画布 + const ctx = wx.createCanvasContext('cropper',this) + let canvasW = ((cropperW - cutL - cutR) / cropperW) * IMG_REAL_W + let canvasL = (cutL / cropperW) * IMG_REAL_W + let canvasT = (cutT / cropperH) * IMG_REAL_H + + this.setData({ + canvasW:canvasW, + canvasH:canvasW + },() => { + ctx.arc(canvasW / 2,canvasW / 2,canvasW / 2,0,2 * Math.PI); + ctx.clip(); + ctx.drawImage(imageSrc, canvasL, canvasT, canvasW, canvasW,0,0,canvasW,canvasW); + ctx.draw(true, () => { + wx.canvasToTempFilePath({ + fileType:IMG_TYPE || 'jpg', + canvasId: 'cropper', + success: (res) => { + //图片裁剪成功 + this.cancelCropper(); + this.triggerEvent('cropperDone', { + src:res.tempFilePath, + cropperData:{ + x: canvasL, + y: canvasT, + width: canvasW, + height: canvasW + } + }) + }, + fail:err =>{ + this.triggerEvent('cropperFail',err) + } + },this); + }) + }) + }, + + cancelCropper(){ + let originData = {} + try{ + originData = JSON.parse(JSON.stringify(defaultData)) + }catch(e){}; + + this.setData({ + ...originData + }); + this.triggerEvent('cropperCancel') + } + } +}) \ No newline at end of file diff --git a/vant/dist/cropper/index.json b/vant/dist/cropper/index.json new file mode 100755 index 0000000..fba482a --- /dev/null +++ b/vant/dist/cropper/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/vant/dist/cropper/index.wxml b/vant/dist/cropper/index.wxml new file mode 100755 index 0000000..373095b --- /dev/null +++ b/vant/dist/cropper/index.wxml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vant/dist/cropper/index.wxss b/vant/dist/cropper/index.wxss new file mode 100755 index 0000000..08aa641 --- /dev/null +++ b/vant/dist/cropper/index.wxss @@ -0,0 +1,296 @@ +/* pages/wx-cropper/index.wxss */ +.wx-cropper-info { + position: fixed; + top: 140rpx; + left: 0; + right: 0; + bottom: 0; + display: block; + z-index: 10000; + align-items: center; + flex-direction: column; + height: 100%; + background: #000; +} + +.cropper-config { + display: flex; + position: fixed; + width: 100%; + bottom: 20rpx; +} + +.cropper-config .btn { + min-width: 300rpx; +} + +.cropper-config .cropper-confirm { + background: #fac208; +} + +.cropper-content { + min-height: 750rpx; + width: 100%; + height: 100%; +} + +.wx-corpper { + position: relative; + overflow: hidden; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + box-sizing: border-box; +} + +.wx-corpper-content { + position: relative; +} + +.wx-corpper-content .img { + display: block; + width: 100%; + min-width: 0 !important; + max-width: none !important; + height: 100%; + min-height: 0 !important; + max-height: none !important; + image-orientation: 0deg !important; + margin: 0 auto; +} + +/* 移动图片效果 */ +.wx-cropper-drag-box { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + cursor: move; + background: rgba(0, 0, 0, 0.6); + z-index: 1; +} + +/* 内部的信息 */ +.wx-corpper-crop-box { + position: absolute; + background: rgba(255, 255, 255, 0.3); + z-index: 2; +} + +.wx-corpper-crop-box .wx-cropper-view-box { + position: relative; + display: block; + width: 100%; + height: 100%; + overflow: visible; + outline: 1px solid #69f; + outline-color: rgba(102, 153, 255, .75) +} + +/* 横向虚线 */ +.wx-cropper-dashed-h { + position: absolute; + top: 33.33333333%; + left: 0; + width: 100%; + height: 33.33333333%; + border-top: 1px dashed rgba(255, 255, 255, 0.5); + border-bottom: 1px dashed rgba(255, 255, 255, 0.5); +} + +/* 纵向虚线 */ +.wx-cropper-dashed-v { + position: absolute; + left: 33.33333333%; + top: 0; + width: 33.33333333%; + height: 100%; + border-left: 1px dashed rgba(255, 255, 255, 0.5); + border-right: 1px dashed rgba(255, 255, 255, 0.5); +} + +/* 四个方向的线 为了之后的拖动事件*/ +.wx-cropper-line-t { + position: absolute; + display: block; + width: 100%; + background-color: #69f; + top: 0; + left: 0; + height: 1px; + opacity: 0.1; + cursor: n-resize; +} + +.wx-cropper-line-t::before { + content: ''; + position: absolute; + top: 50%; + right: 0rpx; + width: 100%; + -webkit-transform: translate3d(0, -50%, 0); + transform: translate3d(0, -50%, 0); + bottom: 0; + height: 41rpx; + background: transparent; + z-index: 11; +} + +.wx-cropper-line-r { + position: absolute; + display: block; + background-color: #69f; + top: 0; + right: 0px; + width: 1px; + opacity: 0.1; + height: 100%; + cursor: e-resize; +} + +.wx-cropper-line-r::before { + content: ''; + position: absolute; + top: 0; + left: 50%; + width: 41rpx; + -webkit-transform: translate3d(-50%, 0, 0); + transform: translate3d(-50%, 0, 0); + bottom: 0; + height: 100%; + background: transparent; + z-index: 11; +} + +.wx-cropper-line-b { + position: absolute; + display: block; + width: 100%; + background-color: #69f; + bottom: 0; + left: 0; + height: 1px; + opacity: 0.1; + cursor: s-resize; +} + +.wx-cropper-line-b::before { + content: ''; + position: absolute; + top: 50%; + right: 0rpx; + width: 100%; + -webkit-transform: translate3d(0, -50%, 0); + transform: translate3d(0, -50%, 0); + bottom: 0; + height: 41rpx; + background: transparent; + z-index: 11; +} + +.wx-cropper-line-l { + position: absolute; + display: block; + background-color: #69f; + top: 0; + left: 0; + width: 1px; + opacity: 0.1; + height: 100%; + cursor: w-resize; +} + +.wx-cropper-line-l::before { + content: ''; + position: absolute; + top: 0; + left: 50%; + width: 41rpx; + -webkit-transform: translate3d(-50%, 0, 0); + transform: translate3d(-50%, 0, 0); + bottom: 0; + height: 100%; + background: transparent; + z-index: 11; +} + +.wx-cropper-point { + width: 5px; + height: 5px; + background-color: #69f; + opacity: .75; + position: absolute; + z-index: 3; +} + +.point-t { + top: -3px; + left: 50%; + margin-left: -3px; + cursor: n-resize; +} + +.point-tr { + top: -3px; + left: 100%; + margin-left: -3px; + cursor: n-resize; +} + +.point-r { + top: 50%; + left: 100%; + margin-left: -3px; + margin-top: -3px; + cursor: n-resize; +} + +.point-rb { + left: 100%; + top: 100%; + -webkit-transform: translate3d(-50%, -50%, 0); + transform: translate3d(-50%, -50%, 0); + cursor: n-resize; + /* width: 24rpx; */ + /* height: 24rpx; */ + background-color: #69f; + position: absolute; + z-index: 1112; + opacity: 1; +} + +.point-b { + left: 50%; + top: 100%; + margin-left: -3px; + margin-top: -3px; + cursor: n-resize; +} + +.point-bl { + left: 0%; + top: 100%; + margin-left: -3px; + margin-top: -3px; + cursor: n-resize; +} + +.point-l { + left: 0%; + top: 50%; + margin-left: -3px; + margin-top: -3px; + cursor: n-resize; +} + +.point-lt { + left: 0%; + top: 0%; + margin-left: -3px; + margin-top: -3px; + cursor: n-resize; +} \ No newline at end of file diff --git a/vant/dist/datetime-picker/index.d.ts b/vant/dist/datetime-picker/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/datetime-picker/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/datetime-picker/index.js b/vant/dist/datetime-picker/index.js new file mode 100755 index 0000000..75bd063 --- /dev/null +++ b/vant/dist/datetime-picker/index.js @@ -0,0 +1,324 @@ +import { VantComponent } from '../common/component'; +import { isDef } from '../common/validator'; +import { pickerProps } from '../picker/shared'; +const currentYear = new Date().getFullYear(); +function isValidDate(date) { + return isDef(date) && !isNaN(new Date(date).getTime()); +} +function range(num, min, max) { + return Math.min(Math.max(num, min), max); +} +function padZero(val) { + return `00${val}`.slice(-2); +} +function times(n, iteratee) { + let index = -1; + const result = Array(n < 0 ? 0 : n); + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} +function getTrueValue(formattedValue) { + if (formattedValue === undefined) { + formattedValue = '1'; + } + while (isNaN(parseInt(formattedValue, 10))) { + formattedValue = formattedValue.slice(1); + } + return parseInt(formattedValue, 10); +} +function getMonthEndDay(year, month) { + return 32 - new Date(year, month - 1, 32).getDate(); +} +const defaultFormatter = (type, value) => value; +VantComponent({ + classes: ['active-class', 'toolbar-class', 'column-class'], + props: Object.assign(Object.assign({}, pickerProps), { + value: { + type: null, + observer: 'updateValue', + }, + filter: null, + type: { + type: String, + value: 'datetime', + observer: 'updateValue', + }, + showToolbar: { + type: Boolean, + value: true, + }, + formatter: { + type: null, + value: defaultFormatter, + }, + minDate: { + type: Number, + value: new Date(currentYear - 10, 0, 1).getTime(), + observer: 'updateValue', + }, + maxDate: { + type: Number, + value: new Date(currentYear + 10, 11, 31).getTime(), + observer: 'updateValue', + }, + minHour: { + type: Number, + value: 0, + observer: 'updateValue', + }, + maxHour: { + type: Number, + value: 23, + observer: 'updateValue', + }, + minMinute: { + type: Number, + value: 0, + observer: 'updateValue', + }, + maxMinute: { + type: Number, + value: 59, + observer: 'updateValue', + }, + }), + data: { + innerValue: Date.now(), + columns: [], + }, + methods: { + updateValue() { + const { data } = this; + const val = this.correctValue(data.value); + const isEqual = val === data.innerValue; + if (!isEqual) { + this.updateColumnValue(val).then(() => { + this.$emit('input', val); + }); + } else { + this.updateColumns(); + } + }, + getPicker() { + if (this.picker == null) { + this.picker = this.selectComponent('.van-datetime-picker'); + const { picker } = this; + const { setColumnValues } = picker; + picker.setColumnValues = (...args) => + setColumnValues.apply(picker, [...args, false]); + } + return this.picker; + }, + updateColumns() { + const { formatter = defaultFormatter } = this.data; + const results = this.getOriginColumns().map((column) => ({ + values: column.values.map((value) => formatter(column.type, value)), + })); + return this.set({ columns: results }); + }, + getOriginColumns() { + const { filter } = this.data; + const results = this.getRanges().map(({ type, range }) => { + let values = times(range[1] - range[0] + 1, (index) => { + let value = range[0] + index; + value = type === 'year' ? `${value}` : padZero(value); + return value; + }); + if (filter) { + values = filter(type, values); + } + return { type, values }; + }); + return results; + }, + getRanges() { + const { data } = this; + if (data.type === 'time') { + return [ + { + type: 'hour', + range: [data.minHour, data.maxHour], + }, + { + type: 'minute', + range: [data.minMinute, data.maxMinute], + }, + ]; + } + const { + maxYear, + maxDate, + maxMonth, + maxHour, + maxMinute, + } = this.getBoundary('max', data.innerValue); + const { + minYear, + minDate, + minMonth, + minHour, + minMinute, + } = this.getBoundary('min', data.innerValue); + const result = [ + { + type: 'year', + range: [minYear, maxYear], + }, + { + type: 'month', + range: [minMonth, maxMonth], + }, + { + type: 'day', + range: [minDate, maxDate], + }, + { + type: 'hour', + range: [minHour, maxHour], + }, + { + type: 'minute', + range: [minMinute, maxMinute], + }, + ]; + if (data.type === 'date') result.splice(3, 2); + if (data.type === 'year-month') result.splice(2, 3); + return result; + }, + correctValue(value) { + const { data } = this; + // validate value + const isDateType = data.type !== 'time'; + if (isDateType && !isValidDate(value)) { + value = data.minDate; + } else if (!isDateType && !value) { + const { minHour } = data; + value = `${padZero(minHour)}:00`; + } + // time type + if (!isDateType) { + let [hour, minute] = value.split(':'); + hour = padZero(range(hour, data.minHour, data.maxHour)); + minute = padZero(range(minute, data.minMinute, data.maxMinute)); + return `${hour}:${minute}`; + } + // date type + value = Math.max(value, data.minDate); + value = Math.min(value, data.maxDate); + return value; + }, + getBoundary(type, innerValue) { + const value = new Date(innerValue); + const boundary = new Date(this.data[`${type}Date`]); + const year = boundary.getFullYear(); + let month = 1; + let date = 1; + let hour = 0; + let minute = 0; + if (type === 'max') { + month = 12; + date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1); + hour = 23; + minute = 59; + } + if (value.getFullYear() === year) { + month = boundary.getMonth() + 1; + if (value.getMonth() + 1 === month) { + date = boundary.getDate(); + if (value.getDate() === date) { + hour = boundary.getHours(); + if (value.getHours() === hour) { + minute = boundary.getMinutes(); + } + } + } + } + return { + [`${type}Year`]: year, + [`${type}Month`]: month, + [`${type}Date`]: date, + [`${type}Hour`]: hour, + [`${type}Minute`]: minute, + }; + }, + onCancel() { + this.$emit('cancel'); + }, + onConfirm() { + this.$emit('confirm', this.data.innerValue); + }, + onChange() { + const { data } = this; + let value; + const picker = this.getPicker(); + const originColumns = this.getOriginColumns(); + if (data.type === 'time') { + const indexes = picker.getIndexes(); + value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1] + .values[indexes[1]]}`; + } else { + const indexes = picker.getIndexes(); + const values = indexes.map( + (value, index) => originColumns[index].values[value] + ); + const year = getTrueValue(values[0]); + const month = getTrueValue(values[1]); + const maxDate = getMonthEndDay(year, month); + let date = getTrueValue(values[2]); + if (data.type === 'year-month') { + date = 1; + } + date = date > maxDate ? maxDate : date; + let hour = 0; + let minute = 0; + if (data.type === 'datetime') { + hour = getTrueValue(values[3]); + minute = getTrueValue(values[4]); + } + value = new Date(year, month - 1, date, hour, minute); + } + value = this.correctValue(value); + this.updateColumnValue(value).then(() => { + this.$emit('input', value); + this.$emit('change', picker); + }); + }, + updateColumnValue(value) { + let values = []; + const { type } = this.data; + const formatter = this.data.formatter || defaultFormatter; + const picker = this.getPicker(); + if (type === 'time') { + const pair = value.split(':'); + values = [formatter('hour', pair[0]), formatter('minute', pair[1])]; + } else { + const date = new Date(value); + values = [ + formatter('year', `${date.getFullYear()}`), + formatter('month', padZero(date.getMonth() + 1)), + ]; + if (type === 'date') { + values.push(formatter('day', padZero(date.getDate()))); + } + if (type === 'datetime') { + values.push( + formatter('day', padZero(date.getDate())), + formatter('hour', padZero(date.getHours())), + formatter('minute', padZero(date.getMinutes())) + ); + } + } + return this.set({ innerValue: value }) + .then(() => this.updateColumns()) + .then(() => picker.setValues(values)); + }, + }, + created() { + const innerValue = this.correctValue(this.data.value); + this.updateColumnValue(innerValue).then(() => { + this.$emit('input', innerValue); + }); + }, +}); diff --git a/vant/dist/datetime-picker/index.json b/vant/dist/datetime-picker/index.json new file mode 100755 index 0000000..a778e91 --- /dev/null +++ b/vant/dist/datetime-picker/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-picker": "../picker/index" + } +} diff --git a/vant/dist/datetime-picker/index.wxml b/vant/dist/datetime-picker/index.wxml new file mode 100755 index 0000000..ade2202 --- /dev/null +++ b/vant/dist/datetime-picker/index.wxml @@ -0,0 +1,16 @@ + diff --git a/vant/dist/datetime-picker/index.wxss b/vant/dist/datetime-picker/index.wxss new file mode 100755 index 0000000..99694d6 --- /dev/null +++ b/vant/dist/datetime-picker/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss'; \ No newline at end of file diff --git a/vant/dist/definitions/index.d.ts b/vant/dist/definitions/index.d.ts new file mode 100755 index 0000000..586e7bb --- /dev/null +++ b/vant/dist/definitions/index.d.ts @@ -0,0 +1,43 @@ +/// +interface VantComponentInstance { + parent: WechatMiniprogram.Component.TrivialInstance; + children: WechatMiniprogram.Component.TrivialInstance[]; + index: number; + $emit: ( + name: string, + detail?: unknown, + options?: WechatMiniprogram.Component.TriggerEventOption + ) => void; +} +export declare type VantComponentOptions< + Data extends WechatMiniprogram.Component.DataOption, + Props extends WechatMiniprogram.Component.PropertyOption, + Methods extends WechatMiniprogram.Component.MethodOption +> = { + data?: Data; + field?: boolean; + classes?: string[]; + mixins?: string[]; + props?: Props; + relation?: { + relations: Record; + mixin: string; + }; + methods?: Methods; + beforeCreate?: () => void; + created?: () => void; + mounted?: () => void; + destroyed?: () => void; +} & ThisType< + VantComponentInstance & + WechatMiniprogram.Component.Instance< + Data & { + name: string; + value: any; + }, + Props, + Methods + > & + Record +>; +export {}; diff --git a/vant/dist/definitions/index.js b/vant/dist/definitions/index.js new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/definitions/index.js @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/dialog/dialog.d.ts b/vant/dist/dialog/dialog.d.ts new file mode 100755 index 0000000..7144032 --- /dev/null +++ b/vant/dist/dialog/dialog.d.ts @@ -0,0 +1,80 @@ +/// +export declare type Action = 'confirm' | 'cancel' | 'overlay'; +interface DialogOptions { + lang?: string; + show?: boolean; + title?: string; + width?: string | number | null; + zIndex?: number; + theme?: string; + context?: + | WechatMiniprogram.Page.TrivialInstance + | WechatMiniprogram.Component.TrivialInstance; + message?: string; + overlay?: boolean; + selector?: string; + ariaLabel?: string; + className?: string; + customStyle?: string; + transition?: string; + /** + * @deprecated use beforeClose instead + */ + asyncClose?: boolean; + beforeClose?: null | ((action: Action) => Promise | void); + businessId?: number; + sessionFrom?: string; + overlayStyle?: string; + appParameter?: string; + messageAlign?: string; + sendMessageImg?: string; + showMessageCard?: boolean; + sendMessagePath?: string; + sendMessageTitle?: string; + confirmButtonText?: string; + cancelButtonText?: string; + showConfirmButton?: boolean; + showCancelButton?: boolean; + closeOnClickOverlay?: boolean; + confirmButtonOpenType?: string; +} +declare const Dialog: { + (options: DialogOptions): Promise< + WechatMiniprogram.Component.Instance< + Record, + Record, + Record, + Record, + false + > + >; + alert( + options: DialogOptions + ): Promise< + WechatMiniprogram.Component.Instance< + Record, + Record, + Record, + Record, + false + > + >; + confirm( + options: DialogOptions + ): Promise< + WechatMiniprogram.Component.Instance< + Record, + Record, + Record, + Record, + false + > + >; + close(): void; + stopLoading(): void; + currentOptions: DialogOptions; + defaultOptions: DialogOptions; + setDefaultOptions(options: DialogOptions): void; + resetDefaultOptions(): void; +}; +export default Dialog; diff --git a/vant/dist/dialog/dialog.js b/vant/dist/dialog/dialog.js new file mode 100755 index 0000000..542c07b --- /dev/null +++ b/vant/dist/dialog/dialog.js @@ -0,0 +1,84 @@ +let queue = []; +const defaultOptions = { + show: false, + title: '', + width: null, + theme: 'default', + message: '', + zIndex: 100, + overlay: true, + selector: '#van-dialog', + className: '', + asyncClose: false, + beforeClose: null, + transition: 'scale', + customStyle: '', + messageAlign: '', + overlayStyle: '', + confirmButtonText: '确认', + cancelButtonText: '取消', + showConfirmButton: true, + showCancelButton: false, + closeOnClickOverlay: false, + confirmButtonOpenType: '', +}; +let currentOptions = Object.assign({}, defaultOptions); +function getContext() { + const pages = getCurrentPages(); + return pages[pages.length - 1]; +} +const Dialog = (options) => { + options = Object.assign(Object.assign({}, currentOptions), options); + return new Promise((resolve, reject) => { + const context = options.context || getContext(); + const dialog = context.selectComponent(options.selector); + delete options.context; + delete options.selector; + if (dialog) { + dialog.setData( + Object.assign( + { + callback: (action, instance) => { + action === 'confirm' ? resolve(instance) : reject(instance); + }, + }, + options + ) + ); + wx.nextTick(() => { + dialog.setData({ show: true }); + }); + queue.push(dialog); + } else { + console.warn( + '未找到 van-dialog 节点,请确认 selector 及 context 是否正确' + ); + } + }); +}; +Dialog.alert = (options) => Dialog(options); +Dialog.confirm = (options) => + Dialog(Object.assign({ showCancelButton: true }, options)); +Dialog.close = () => { + queue.forEach((dialog) => { + dialog.close(); + }); + queue = []; +}; +Dialog.stopLoading = () => { + queue.forEach((dialog) => { + dialog.stopLoading(); + }); +}; +Dialog.currentOptions = currentOptions; +Dialog.defaultOptions = defaultOptions; +Dialog.setDefaultOptions = (options) => { + currentOptions = Object.assign(Object.assign({}, currentOptions), options); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions = () => { + currentOptions = Object.assign({}, defaultOptions); + Dialog.currentOptions = currentOptions; +}; +Dialog.resetDefaultOptions(); +export default Dialog; diff --git a/vant/dist/dialog/index.d.ts b/vant/dist/dialog/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/dialog/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/dialog/index.js b/vant/dist/dialog/index.js new file mode 100755 index 0000000..5388cda --- /dev/null +++ b/vant/dist/dialog/index.js @@ -0,0 +1,122 @@ +import { VantComponent } from '../common/component'; +import { button } from '../mixins/button'; +import { openType } from '../mixins/open-type'; +import { GRAY, RED } from '../common/color'; +import { toPromise } from '../common/utils'; +VantComponent({ + mixins: [button, openType], + props: { + show: { + type: Boolean, + observer(show) { + !show && this.stopLoading(); + }, + }, + title: String, + message: String, + theme: { + type: String, + value: 'default', + }, + useSlot: Boolean, + className: String, + customStyle: String, + asyncClose: Boolean, + messageAlign: String, + beforeClose: null, + overlayStyle: String, + useTitleSlot: Boolean, + showCancelButton: Boolean, + closeOnClickOverlay: Boolean, + confirmButtonOpenType: String, + width: null, + zIndex: { + type: Number, + value: 2000, + }, + confirmButtonText: { + type: String, + value: '确认', + }, + cancelButtonText: { + type: String, + value: '取消', + }, + confirmButtonColor: { + type: String, + value: RED, + }, + cancelButtonColor: { + type: String, + value: GRAY, + }, + showConfirmButton: { + type: Boolean, + value: true, + }, + overlay: { + type: Boolean, + value: true, + }, + transition: { + type: String, + value: 'scale', + }, + }, + data: { + loading: { + confirm: false, + cancel: false, + }, + callback: () => {}, + }, + methods: { + onConfirm() { + this.handleAction('confirm'); + }, + onCancel() { + this.handleAction('cancel'); + }, + onClickOverlay() { + this.close('overlay'); + }, + close(action) { + this.setData({ show: false }); + wx.nextTick(() => { + this.$emit('close', action); + const { callback } = this.data; + if (callback) { + callback(action, this); + } + }); + }, + stopLoading() { + this.setData({ + loading: { + confirm: false, + cancel: false, + }, + }); + }, + handleAction(action) { + this.$emit(action, { dialog: this }); + const { asyncClose, beforeClose } = this.data; + if (!asyncClose && !beforeClose) { + this.close(action); + return; + } + this.setData({ + [`loading.${action}`]: true, + }); + if (beforeClose) { + toPromise(beforeClose(action)).then((value) => { + if (value) { + this.close(action); + } else { + this.stopLoading(); + } + }); + } + }, + }, +}); diff --git a/vant/dist/dialog/index.json b/vant/dist/dialog/index.json new file mode 100755 index 0000000..43417fc --- /dev/null +++ b/vant/dist/dialog/index.json @@ -0,0 +1,9 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-button": "../button/index", + "van-goods-action": "../goods-action/index", + "van-goods-action-button": "../goods-action-button/index" + } +} diff --git a/vant/dist/dialog/index.wxml b/vant/dist/dialog/index.wxml new file mode 100755 index 0000000..fd13bc9 --- /dev/null +++ b/vant/dist/dialog/index.wxml @@ -0,0 +1,113 @@ + + + + + + {{ title }} + + + + + {{ message }} + + + + + {{ cancelButtonText }} + + + {{ confirmButtonText }} + + + + + + {{ cancelButtonText }} + + + {{ confirmButtonText }} + + + diff --git a/vant/dist/dialog/index.wxss b/vant/dist/dialog/index.wxss new file mode 100755 index 0000000..c6bac95 --- /dev/null +++ b/vant/dist/dialog/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dialog{top:45%!important;overflow:hidden;width:320px;width:var(--dialog-width,320px);font-size:16px;font-size:var(--dialog-font-size,16px);border-radius:16px;border-radius:var(--dialog-border-radius,16px);background-color:#fff;background-color:var(--dialog-background-color,#fff)}@media (max-width:321px){.van-dialog{width:90%;width:var(--dialog-small-screen-width,90%)}}.van-dialog__header{text-align:center;padding-top:24px;padding-top:var(--dialog-header-padding-top,24px);font-weight:500;font-weight:var(--dialog-header-font-weight,500);line-height:24px;line-height:var(--dialog-header-line-height,24px)}.van-dialog__header--isolated{padding:24px 0;padding:var(--dialog-header-isolated-padding,24px 0)}.van-dialog__message{overflow-y:auto;text-align:center;-webkit-overflow-scrolling:touch;font-size:14px;font-size:var(--dialog-message-font-size,14px);line-height:20px;line-height:var(--dialog-message-line-height,20px);max-height:60vh;max-height:var(--dialog-message-max-height,60vh);padding:24px;padding:var(--dialog-message-padding,24px)}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--hasTitle{padding-top:8px;padding-top:var(--dialog-has-title-message-padding-top,8px);color:#646566;color:var(--dialog-has-title-message-text-color,#646566)}.van-dialog__message--round-button{padding-bottom:16px;color:#323233}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__footer--round-button{position:relative!important;padding:8px 24px 16px!important}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0} \ No newline at end of file diff --git a/vant/dist/divider/index.d.ts b/vant/dist/divider/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/divider/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/divider/index.js b/vant/dist/divider/index.js new file mode 100755 index 0000000..e725740 --- /dev/null +++ b/vant/dist/divider/index.js @@ -0,0 +1,12 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + dashed: Boolean, + hairline: Boolean, + contentPosition: String, + fontSize: String, + borderColor: String, + textColor: String, + customStyle: String, + }, +}); diff --git a/vant/dist/divider/index.json b/vant/dist/divider/index.json new file mode 100755 index 0000000..a89ef4d --- /dev/null +++ b/vant/dist/divider/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} diff --git a/vant/dist/divider/index.wxml b/vant/dist/divider/index.wxml new file mode 100755 index 0000000..f6a5a45 --- /dev/null +++ b/vant/dist/divider/index.wxml @@ -0,0 +1,9 @@ + + + + + + diff --git a/vant/dist/divider/index.wxs b/vant/dist/divider/index.wxs new file mode 100755 index 0000000..215b14f --- /dev/null +++ b/vant/dist/divider/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function rootStyle(data) { + return style([ + { + 'border-color': data.borderColor, + color: data.textColor, + 'font-size': addUnit(data.fontSize), + }, + data.customStyle, + ]); +} + +module.exports = { + rootStyle: rootStyle, +}; diff --git a/vant/dist/divider/index.wxss b/vant/dist/divider/index.wxss new file mode 100755 index 0000000..c055e3a --- /dev/null +++ b/vant/dist/divider/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-divider{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;margin:16px 0;margin:var(--divider-margin,16px 0);color:#969799;color:var(--divider-text-color,#969799);font-size:14px;font-size:var(--divider-font-size,14px);line-height:24px;line-height:var(--divider-line-height,24px);border:0 solid #ebedf0;border-color:var(--divider-border-color,#ebedf0)}.van-divider:after,.van-divider:before{display:block;-webkit-flex:1;flex:1;box-sizing:border-box;height:1px;border-color:inherit;border-style:inherit;border-width:1px 0 0}.van-divider:before{content:""}.van-divider--hairline:after,.van-divider--hairline:before{-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-divider--dashed{border-style:dashed}.van-divider--center:before,.van-divider--left:before,.van-divider--right:before{margin-right:16px;margin-right:var(--divider-content-padding,16px)}.van-divider--center:after,.van-divider--left:after,.van-divider--right:after{content:"";margin-left:16px;margin-left:var(--divider-content-padding,16px)}.van-divider--left:before{max-width:10%;max-width:var(--divider-content-left-width,10%)}.van-divider--right:after{max-width:10%;max-width:var(--divider-content-right-width,10%)} \ No newline at end of file diff --git a/vant/dist/dropdown-item/index.d.ts b/vant/dist/dropdown-item/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/dropdown-item/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/dropdown-item/index.js b/vant/dist/dropdown-item/index.js new file mode 100755 index 0000000..95da1ee --- /dev/null +++ b/vant/dist/dropdown-item/index.js @@ -0,0 +1,111 @@ +import { useParent } from '../common/relation'; +import { VantComponent } from '../common/component'; +VantComponent({ + field: true, + relation: useParent('dropdown-menu', function () { + this.updateDataFromParent(); + }), + props: { + value: { + type: null, + observer: 'rerender', + }, + title: { + type: String, + observer: 'rerender', + }, + disabled: Boolean, + titleClass: { + type: String, + observer: 'rerender', + }, + options: { + type: Array, + value: [], + observer: 'rerender', + }, + popupStyle: String, + }, + data: { + transition: true, + showPopup: false, + showWrapper: false, + displayTitle: '', + }, + methods: { + rerender() { + wx.nextTick(() => { + var _a; + (_a = this.parent) === null || _a === void 0 + ? void 0 + : _a.updateItemListData(); + }); + }, + updateDataFromParent() { + if (this.parent) { + const { + overlay, + duration, + activeColor, + closeOnClickOverlay, + direction, + } = this.parent.data; + this.setData({ + overlay, + duration, + activeColor, + closeOnClickOverlay, + direction, + }); + } + }, + onOpen() { + this.$emit('open'); + }, + onOpened() { + this.$emit('opened'); + }, + onClose() { + this.$emit('close'); + }, + onClosed() { + this.$emit('closed'); + this.setData({ showWrapper: false }); + }, + onOptionTap(event) { + const { option } = event.currentTarget.dataset; + const { value } = option; + const shouldEmitChange = this.data.value !== value; + this.setData({ showPopup: false, value }); + this.$emit('close'); + this.rerender(); + if (shouldEmitChange) { + this.$emit('change', value); + } + }, + toggle(show, options = {}) { + var _a; + const { showPopup } = this.data; + if (typeof show !== 'boolean') { + show = !showPopup; + } + if (show === showPopup) { + return; + } + this.setData({ + transition: !options.immediate, + showPopup: show, + }); + if (show) { + (_a = this.parent) === null || _a === void 0 + ? void 0 + : _a.getChildWrapperStyle().then((wrapperStyle) => { + this.setData({ wrapperStyle, showWrapper: true }); + this.rerender(); + }); + } else { + this.rerender(); + } + }, + }, +}); diff --git a/vant/dist/dropdown-item/index.json b/vant/dist/dropdown-item/index.json new file mode 100755 index 0000000..88d5409 --- /dev/null +++ b/vant/dist/dropdown-item/index.json @@ -0,0 +1,8 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "../popup/index", + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/vant/dist/dropdown-item/index.wxml b/vant/dist/dropdown-item/index.wxml new file mode 100755 index 0000000..dd75292 --- /dev/null +++ b/vant/dist/dropdown-item/index.wxml @@ -0,0 +1,48 @@ + + + + + + + {{ item.text }} + + + + + + + diff --git a/vant/dist/dropdown-item/index.wxss b/vant/dist/dropdown-item/index.wxss new file mode 100755 index 0000000..7cab3f2 --- /dev/null +++ b/vant/dist/dropdown-item/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-dropdown-item{position:fixed;right:0;left:0;overflow:hidden}.van-dropdown-item__option{text-align:left}.van-dropdown-item__option--active .van-dropdown-item__icon,.van-dropdown-item__option--active .van-dropdown-item__title{color:#ee0a24;color:var(--dropdown-menu-option-active-color,#ee0a24)}.van-dropdown-item--up{top:0}.van-dropdown-item--down{bottom:0}.van-dropdown-item__icon{display:block;line-height:inherit} \ No newline at end of file diff --git a/vant/dist/dropdown-item/shared.d.ts b/vant/dist/dropdown-item/shared.d.ts new file mode 100755 index 0000000..c90bd9e --- /dev/null +++ b/vant/dist/dropdown-item/shared.d.ts @@ -0,0 +1,5 @@ +export interface Option { + text: string; + value: string | number; + icon: string; +} diff --git a/vant/dist/dropdown-item/shared.js b/vant/dist/dropdown-item/shared.js new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/dropdown-item/shared.js @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/dropdown-menu/index.d.ts b/vant/dist/dropdown-menu/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/dropdown-menu/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/dropdown-menu/index.js b/vant/dist/dropdown-menu/index.js new file mode 100755 index 0000000..aba11b9 --- /dev/null +++ b/vant/dist/dropdown-menu/index.js @@ -0,0 +1,112 @@ +import { VantComponent } from '../common/component'; +import { useChildren } from '../common/relation'; +import { addUnit, getRect, getSystemInfoSync } from '../common/utils'; +let ARRAY = []; +VantComponent({ + field: true, + relation: useChildren('dropdown-item', function () { + this.updateItemListData(); + }), + props: { + activeColor: { + type: String, + observer: 'updateChildrenData', + }, + overlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData', + }, + zIndex: { + type: Number, + value: 10, + }, + duration: { + type: Number, + value: 200, + observer: 'updateChildrenData', + }, + direction: { + type: String, + value: 'down', + observer: 'updateChildrenData', + }, + closeOnClickOverlay: { + type: Boolean, + value: true, + observer: 'updateChildrenData', + }, + closeOnClickOutside: { + type: Boolean, + value: true, + }, + }, + data: { + itemListData: [], + }, + beforeCreate() { + const { windowHeight } = getSystemInfoSync(); + this.windowHeight = windowHeight; + ARRAY.push(this); + }, + destroyed() { + ARRAY = ARRAY.filter((item) => item !== this); + }, + methods: { + updateItemListData() { + this.setData({ + itemListData: this.children.map((child) => child.data), + }); + }, + updateChildrenData() { + this.children.forEach((child) => { + child.updateDataFromParent(); + }); + }, + toggleItem(active) { + this.children.forEach((item, index) => { + const { showPopup } = item.data; + if (index === active) { + item.toggle(); + } else if (showPopup) { + item.toggle(false, { immediate: true }); + } + }); + }, + close() { + this.children.forEach((child) => { + child.toggle(false, { immediate: true }); + }); + }, + getChildWrapperStyle() { + const { zIndex, direction } = this.data; + return getRect(this, '.van-dropdown-menu').then((rect) => { + const { top = 0, bottom = 0 } = rect; + const offset = direction === 'down' ? bottom : this.windowHeight - top; + let wrapperStyle = `z-index: ${zIndex};`; + if (direction === 'down') { + wrapperStyle += `top: ${addUnit(offset)};`; + } else { + wrapperStyle += `bottom: ${addUnit(offset)};`; + } + return wrapperStyle; + }); + }, + onTitleTap(event) { + const { index } = event.currentTarget.dataset; + const child = this.children[index]; + if (!child.data.disabled) { + ARRAY.forEach((menuItem) => { + if ( + menuItem && + menuItem.data.closeOnClickOutside && + menuItem !== this + ) { + menuItem.close(); + } + }); + this.toggleItem(index); + } + }, + }, +}); diff --git a/vant/dist/dropdown-menu/index.json b/vant/dist/dropdown-menu/index.json new file mode 100755 index 0000000..467ce29 --- /dev/null +++ b/vant/dist/dropdown-menu/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/vant/dist/dropdown-menu/index.wxml b/vant/dist/dropdown-menu/index.wxml new file mode 100755 index 0000000..220dcb4 --- /dev/null +++ b/vant/dist/dropdown-menu/index.wxml @@ -0,0 +1,17 @@ + + + + + + + + {{ computed.displayTitle(item) }} + + + + + + \ No newline at end of file diff --git a/vant/dist/dropdown-menu/index.wxs b/vant/dist/dropdown-menu/index.wxs new file mode 100755 index 0000000..6538854 --- /dev/null +++ b/vant/dist/dropdown-menu/index.wxs @@ -0,0 +1,16 @@ +/* eslint-disable */ +function displayTitle(item) { + if (item.title) { + return item.title; + } + + var match = item.options.filter(function(option) { + return option.value === item.value; + }); + var displayTitle = match.length ? match[0].text : ''; + return displayTitle; +} + +module.exports = { + displayTitle: displayTitle +}; diff --git a/vant/dist/dropdown-menu/index.wxss b/vant/dist/dropdown-menu/index.wxss new file mode 100755 index 0000000..a410188 --- /dev/null +++ b/vant/dist/dropdown-menu/index.wxss @@ -0,0 +1,77 @@ +@import '../common/index.wxss'; + +.van-dropdown-menu { + display: -webkit-flex; + display: flex; + box-shadow: 0 2px 12px rgba(100, 101, 102, .12); + -webkit-user-select: none; + user-select: none; + height: 50px; + height: var(--dropdown-menu-height, 50px); + background-color: #fff; + background-color: var(--dropdown-menu-background-color, #fff) +} + +.van-dropdown-menu__item { + display: -webkit-flex; + display: flex; + -webkit-flex: 1; + flex: 1; + -webkit-align-items: center; + align-items: center; + -webkit-justify-content: center; + justify-content: center; + min-width: 0 +} + +.van-dropdown-menu__item:active { + opacity: .7 +} + +.van-dropdown-menu__item--disabled:active { + opacity: 1 +} + +.van-dropdown-menu__item--disabled .van-dropdown-menu__title { + color: #969799; + color: var(--dropdown-menu-title-disabled-text-color, #969799) +} + +.van-dropdown-menu__title { + position: relative; + box-sizing: border-box; + max-width: 100%; + padding: 0 8px; + padding: var(--dropdown-menu-title-padding, 0 8px); + color: #323233; + color: var(--dropdown-menu-title-text-color, #323233); + font-size: 14px; + font-size: var(--dropdown-menu-title-font-size, 14px); + line-height: 18px; + line-height: var(--dropdown-menu-title-line-height, 18px) +} + +.van-dropdown-menu__title:after { + position: absolute; + top: 50%; + right: -4px; + margin-top: -5px; + border-color: transparent transparent currentcolor currentcolor; + border-style: solid; + border-width: 3px; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + opacity: .8; + content: "" +} + +.van-dropdown-menu__title--active { + color: #ee0a24; + color: var(--dropdown-menu-title-active-text-color, #ee0a24) +} + +.van-dropdown-menu__title--down:after { + margin-top: -1px; + -webkit-transform: rotate(135deg); + transform: rotate(135deg) +} \ No newline at end of file diff --git a/vant/dist/empty/index.d.ts b/vant/dist/empty/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/empty/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/empty/index.js b/vant/dist/empty/index.js new file mode 100755 index 0000000..32ec116 --- /dev/null +++ b/vant/dist/empty/index.js @@ -0,0 +1,10 @@ +import { VantComponent } from '../common/component'; +VantComponent({ + props: { + description: String, + image: { + type: String, + value: 'default', + }, + }, +}); diff --git a/vant/dist/empty/index.json b/vant/dist/empty/index.json new file mode 100755 index 0000000..e8cfaaf --- /dev/null +++ b/vant/dist/empty/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/vant/dist/empty/index.wxml b/vant/dist/empty/index.wxml new file mode 100755 index 0000000..9c7b719 --- /dev/null +++ b/vant/dist/empty/index.wxml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + {{ description }} + + + + + + diff --git a/vant/dist/empty/index.wxs b/vant/dist/empty/index.wxs new file mode 100755 index 0000000..9696dd4 --- /dev/null +++ b/vant/dist/empty/index.wxs @@ -0,0 +1,14 @@ +/* eslint-disable */ +var PRESETS = ['error', 'search', 'default', 'network']; + +function imageUrl(image) { + if (PRESETS.indexOf(image) !== -1) { + return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png'; + } + + return image; +} + +module.exports = { + imageUrl: imageUrl, +}; diff --git a/vant/dist/empty/index.wxss b/vant/dist/empty/index.wxss new file mode 100755 index 0000000..ea23d5f --- /dev/null +++ b/vant/dist/empty/index.wxss @@ -0,0 +1,49 @@ +@import '../common/index.wxss'; + +.van-empty { + display: -webkit-flex; + display: flex; + -webkit-flex-direction: column; + flex-direction: column; + -webkit-align-items: center; + align-items: center; + -webkit-justify-content: center; + justify-content: center; + box-sizing: border-box; + padding: 10px 0 +} + +.van-empty__image { + width: 100px; + height: 100px +} + +.van-empty__image:empty { + display: none +} + +.van-empty__image__img { + width: 100%; + height: 100% +} + +.van-empty__image:not(:empty)+.van-empty__image { + display: none +} + +.van-empty__description { + margin-top: 16px; + padding: 0 60px; + color: #969799; + font-size: 14px; + line-height: 20px +} + +.van-empty__description:empty, +.van-empty__description:not(:empty)+.van-empty__description { + display: none +} + +.van-empty__bottom { + margin-top: 24px +} \ No newline at end of file diff --git a/vant/dist/field/index.d.ts b/vant/dist/field/index.d.ts new file mode 100755 index 0000000..cb0ff5c --- /dev/null +++ b/vant/dist/field/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/vant/dist/field/index.js b/vant/dist/field/index.js new file mode 100755 index 0000000..fd3472d --- /dev/null +++ b/vant/dist/field/index.js @@ -0,0 +1,126 @@ +import { nextTick } from '../common/utils'; +import { VantComponent } from '../common/component'; +import { commonProps, inputProps, textareaProps } from './props'; +VantComponent({ + field: true, + classes: ['input-class', 'right-icon-class', 'label-class'], + props: Object.assign( + Object.assign( + Object.assign(Object.assign({}, commonProps), inputProps), + textareaProps + ), + { + size: String, + icon: String, + label: String, + error: Boolean, + center: Boolean, + isLink: Boolean, + leftIcon: String, + rightIcon: String, + autosize: null, + required: Boolean, + iconClass: String, + clickable: Boolean, + inputAlign: String, + customStyle: String, + errorMessage: String, + arrowDirection: String, + showWordLimit: Boolean, + errorMessageAlign: String, + readonly: { + type: Boolean, + observer: 'setShowClear', + }, + clearable: { + type: Boolean, + observer: 'setShowClear', + }, + border: { + type: Boolean, + value: true, + }, + titleWidth: { + type: String, + value: '6.2em', + }, + } + ), + data: { + focused: false, + innerValue: '', + showClear: false, + }, + created() { + this.value = this.data.value; + this.setData({ innerValue: this.value }); + }, + methods: { + onInput(event) { + const { value = '' } = event.detail || {}; + this.value = value; + this.setShowClear(); + this.emitChange(); + }, + onFocus(event) { + this.focused = true; + this.setShowClear(); + this.$emit('focus', event.detail); + }, + onBlur(event) { + this.focused = false; + this.setShowClear(); + this.$emit('blur', event.detail); + }, + onClickIcon() { + this.$emit('click-icon'); + }, + onClickInput(event) { + this.$emit('click-input', event.detail); + }, + onClear() { + this.setData({ innerValue: '' }); + this.value = ''; + this.setShowClear(); + nextTick(() => { + this.emitChange(); + this.$emit('clear', ''); + }); + }, + onConfirm(event) { + const { value = '' } = event.detail || {}; + this.value = value; + this.setShowClear(); + this.$emit('confirm', value); + }, + setValue(value) { + this.value = value; + this.setShowClear(); + if (value === '') { + this.setData({ innerValue: '' }); + } + this.emitChange(); + }, + onLineChange(event) { + this.$emit('linechange', event.detail); + }, + onKeyboardHeightChange(event) { + this.$emit('keyboardheightchange', event.detail); + }, + emitChange() { + this.setData({ value: this.value }); + nextTick(() => { + this.$emit('input', this.value); + this.$emit('change', this.value); + }); + }, + setShowClear() { + const { clearable, readonly } = this.data; + const { focused, value } = this; + this.setData({ + showClear: !!clearable && !!focused && !!value && !readonly, + }); + }, + noop() {}, + }, +}); diff --git a/vant/dist/field/index.json b/vant/dist/field/index.json new file mode 100755 index 0000000..5906c50 --- /dev/null +++ b/vant/dist/field/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-cell": "../cell/index", + "van-icon": "../icon/index" + } +} diff --git a/vant/dist/field/index.wxml b/vant/dist/field/index.wxml new file mode 100755 index 0000000..9dc8b66 --- /dev/null +++ b/vant/dist/field/index.wxml @@ -0,0 +1,56 @@ + + + + + + + {{ label }} + + + + + + + + + + + + + + + + + + + + + {{ value.length >= maxlength ? maxlength : value.length }}/{{ maxlength }} + + + {{ errorMessage }} + + diff --git a/vant/dist/field/index.wxs b/vant/dist/field/index.wxs new file mode 100755 index 0000000..78575b9 --- /dev/null +++ b/vant/dist/field/index.wxs @@ -0,0 +1,18 @@ +/* eslint-disable */ +var style = require('../wxs/style.wxs'); +var addUnit = require('../wxs/add-unit.wxs'); + +function inputStyle(autosize) { + if (autosize && autosize.constructor === 'Object') { + return style({ + 'min-height': addUnit(autosize.minHeight), + 'max-height': addUnit(autosize.maxHeight), + }); + } + + return ''; +} + +module.exports = { + inputStyle: inputStyle, +}; diff --git a/vant/dist/field/index.wxss b/vant/dist/field/index.wxss new file mode 100755 index 0000000..171f613 --- /dev/null +++ b/vant/dist/field/index.wxss @@ -0,0 +1 @@ +@import '../common/index.wxss';.van-field{--cell-icon-size:16px;--cell-icon-size:var(--field-icon-size,16px)}.van-field__label{color:#646566;color:var(--field-label-color,#646566)}.van-field__label--disabled{color:#c8c9cc;color:var(--field-disabled-text-color,#c8c9cc)}.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{box-sizing:border-box;padding:3.6px 0;line-height:1.2em;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty+.van-field__control{display:block}.van-field__control{position:relative;display:none;box-sizing:border-box;width:100%;margin:0;padding:0;line-height:inherit;text-align:left;background-color:initial;border:0;resize:none;color:#323233;color:var(--field-input-text-color,#323233);height:24px;height:var(--cell-line-height,24px);min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__control:empty{display:none}.van-field__control--textarea{height:18px;height:var(--field-text-area-min-height,18px);min-height:18px;min-height:var(--field-text-area-min-height,18px)}.van-field__control--error{color:#ee0a24;color:var(--field-input-error-text-color,#ee0a24)}.van-field__control--disabled{background-color:initial;opacity:1;color:#c8c9cc;color:var(--field-input-disabled-text-color,#c8c9cc)}.van-field__control--center{text-align:center}.van-field__control--right{text-align:right}.van-field__control--custom{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__placeholder{position:absolute;top:0;right:0;left:0;pointer-events:none;color:#c8c9cc;color:var(--field-placeholder-text-color,#c8c9cc)}.van-field__placeholder--error{color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__icon-root{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;min-height:24px;min-height:var(--cell-line-height,24px)}.van-field__clear-root,.van-field__icon-container{line-height:inherit;vertical-align:middle;padding:0 8px;padding:0 var(--padding-xs,8px);margin-right:-8px;margin-right:-var(--padding-xs,8px)}.van-field__button,.van-field__clear-root,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear-root{font-size:16px;font-size:var(--field-clear-icon-size,16px);color:#c8c9cc;color:var(--field-clear-icon-color,#c8c9cc)}.van-field__icon-container{font-size:16px;font-size:var(--field-icon-size,16px);color:#969799;color:var(--field-icon-container-color,#969799)}.van-field__icon-container:empty{display:none}.van-field__button{padding-left:8px;padding-left:var(--padding-xs,8px)}.van-field__button:empty{display:none}.van-field__error-message{text-align:left;font-size:12px;font-size:var(--field-error-message-text-font-size,12px);color:#ee0a24;color:var(--field-error-message-color,#ee0a24)}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{text-align:right;margin-top:4px;margin-top:var(--padding-base,4px);color:#646566;color:var(--field-word-limit-color,#646566);font-size:12px;font-size:var(--field-word-limit-font-size,12px);line-height:16px;line-height:var(--field-word-limit-line-height,16px)}.van-field__word-num{display:inline}.van-field__word-num--full{color:#ee0a24;color:var(--field-word-num-full-color,#ee0a24)} \ No newline at end of file diff --git a/vant/dist/field/input.wxml b/vant/dist/field/input.wxml new file mode 100755 index 0000000..3ecab24 --- /dev/null +++ b/vant/dist/field/input.wxml @@ -0,0 +1,27 @@ + diff --git a/vant/dist/field/props.d.ts b/vant/dist/field/props.d.ts new file mode 100755 index 0000000..5cd130a --- /dev/null +++ b/vant/dist/field/props.d.ts @@ -0,0 +1,4 @@ +/// +export declare const commonProps: WechatMiniprogram.Component.PropertyOption; +export declare const inputProps: WechatMiniprogram.Component.PropertyOption; +export declare const textareaProps: WechatMiniprogram.Component.PropertyOption; diff --git a/vant/dist/field/props.js b/vant/dist/field/props.js new file mode 100755 index 0000000..218749f --- /dev/null +++ b/vant/dist/field/props.js @@ -0,0 +1,63 @@ +export const commonProps = { + value: { + type: String, + observer(value) { + if (value !== this.value) { + this.setData({ innerValue: value }); + this.value = value; + } + }, + }, + placeholder: String, + placeholderStyle: String, + placeholderClass: String, + disabled: Boolean, + maxlength: { + type: Number, + value: -1, + }, + cursorSpacing: { + type: Number, + value: 50, + }, + autoFocus: Boolean, + focus: Boolean, + cursor: { + type: Number, + value: -1, + }, + selectionStart: { + type: Number, + value: -1, + }, + selectionEnd: { + type: Number, + value: -1, + }, + adjustPosition: { + type: Boolean, + value: true, + }, + holdKeyboard: Boolean, +}; +export const inputProps = { + type: { + type: String, + value: 'text', + }, + password: Boolean, + confirmType: String, + confirmHold: Boolean, +}; +export const textareaProps = { + autoHeight: Boolean, + fixed: Boolean, + showConfirmBar: { + type: Boolean, + value: true, + }, + disableDefaultPadding: { + type: Boolean, + value: true, + }, +}; diff --git a/vant/dist/field/textarea.wxml b/vant/dist/field/textarea.wxml new file mode 100755 index 0000000..5015a51 --- /dev/null +++ b/vant/dist/field/textarea.wxml @@ -0,0 +1,29 @@ +