diff --git a/manifest.json b/manifest.json index d43c6da..52c3903 100644 --- a/manifest.json +++ b/manifest.json @@ -184,7 +184,7 @@ "versionCode": 100 }, "mp-weixin": { - "appid": "wx63c280fe3248a3e7", + "appid": "wxa66f2777a5656baf", "setting": { "urlCheck": false, "minified": true, diff --git a/pages.json b/pages.json index 72d5009..ee0d71d 100644 --- a/pages.json +++ b/pages.json @@ -82,6 +82,15 @@ "title": "自定义页面", "group": "商城" } + }, + { + "path" : "pages/mulu/mulu", + "style" : + { + "navigationBarTitleText" : "详情", + "enablePullDownRefresh" : true, + "navigationStyle": "default" + } } ], "subPackages": [{ diff --git a/pages/activity/groupon/detail.vue b/pages/activity/groupon/detail.vue index 0db9ab3..0cf22f1 100644 --- a/pages/activity/groupon/detail.vue +++ b/pages/activity/groupon/detail.vue @@ -1,6 +1,11 @@ diff --git a/pages/index/cart.vue b/pages/index/cart.vue index ae90777..d32fed2 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -1,196 +1,230 @@ \ No newline at end of file + .goods-box { + background-color: #fff; + } + } + } + diff --git a/pages/index/index.vue b/pages/index/index.vue index 208c959..bde6bac 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,88 +1,91 @@ diff --git a/pages/index/login.vue b/pages/index/login.vue index b2c82a4..8ccea5e 100644 --- a/pages/index/login.vue +++ b/pages/index/login.vue @@ -17,16 +17,18 @@ const event = options.event; const code = options.code; const state = options.state; - if (event === 'login') { // 场景一:登录 + if (event === 'login') { + // 场景一:登录 const res = await sheep.$platform.useProvider().login(code, state); - } else if (event === 'bind') { // 场景二:绑定 + } else if (event === 'bind') { + // 场景二:绑定 sheep.$platform.useProvider().bind(code, state); } // 检测 H5 登录回调 let returnUrl = uni.getStorageSync('returnUrl'); if (returnUrl) { - uni.removeStorage({key:'returnUrl'}); + uni.removeStorage({ key: 'returnUrl' }); location.replace(returnUrl); } else { uni.switchTab({ diff --git a/pages/index/page.vue b/pages/index/page.vue index b5d8ef3..cb37a0c 100644 --- a/pages/index/page.vue +++ b/pages/index/page.vue @@ -26,7 +26,7 @@ page: {}, }); onLoad(async (options) => { - let id = options.id + let id = options.id; // #ifdef MP // 小程序预览自定义页面 diff --git a/pages/index/user.vue b/pages/index/user.vue index 705451a..19064fd 100644 --- a/pages/index/user.vue +++ b/pages/index/user.vue @@ -8,7 +8,11 @@ :navbarStyle="template.navigationBar" onShareAppMessage > - + diff --git a/pages/mulu/detail-content-card.vue b/pages/mulu/detail-content-card.vue new file mode 100644 index 0000000..eaacc82 --- /dev/null +++ b/pages/mulu/detail-content-card.vue @@ -0,0 +1,52 @@ + + + + + + diff --git a/pages/mulu/mulu.vue b/pages/mulu/mulu.vue new file mode 100644 index 0000000..3ab3e7c --- /dev/null +++ b/pages/mulu/mulu.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/pages/order/aftersale/apply.vue b/pages/order/aftersale/apply.vue index 7512302..9a67c5a 100644 --- a/pages/order/aftersale/apply.vue +++ b/pages/order/aftersale/apply.vue @@ -98,11 +98,7 @@ - @@ -30,7 +30,9 @@ 充值时间 - {{ sheep.$helper.timeFormat(item.payTime, 'yyyy-mm-dd hh:MM:ss') }} + + {{ sheep.$helper.timeFormat(item.payTime, 'yyyy-mm-dd hh:MM:ss') }} diff --git a/pages/pay/recharge.vue b/pages/pay/recharge.vue index 9432886..63f39c0 100644 --- a/pages/pay/recharge.vue +++ b/pages/pay/recharge.vue @@ -1,259 +1,274 @@ \ No newline at end of file + .face-value-tag { + background: $white; + color: var(--ui-BG-Main); + font-family: OPPOSANS; + } + } + } + diff --git a/pages/public/faq.vue b/pages/public/faq.vue index af811c9..f268058 100644 --- a/pages/public/faq.vue +++ b/pages/public/faq.vue @@ -53,7 +53,7 @@ if (true) { sheep.$router.go('/pages/public/richtext', { title: '常见问题', - }) + }); return; } getFaqList(); diff --git a/pages/public/richtext.vue b/pages/public/richtext.vue index e4a0921..17ee72c 100644 --- a/pages/public/richtext.vue +++ b/pages/public/richtext.vue @@ -41,7 +41,6 @@ } getRichTextContent(options.id, options.title); }); - \ No newline at end of file + .cancel-btn { + width: 710rpx; + height: 80rpx; + border-radius: 40rpx; + background: var(--ui-BG); + } + } + diff --git a/pages/user/address/list.vue b/pages/user/address/list.vue index a812afc..9fd501e 100644 --- a/pages/user/address/list.vue +++ b/pages/user/address/list.vue @@ -1,143 +1,156 @@ \ No newline at end of file + .sync-wxaddress { + flex: 1; + line-height: 80rpx; + background: $white; + border-radius: 80rpx; + font-size: 30rpx; + font-weight: 500; + color: $dark-6; + margin-right: 18rpx; + } + } + diff --git a/pages/user/goods-collect.vue b/pages/user/goods-collect.vue index 03099bc..6ae38be 100644 --- a/pages/user/goods-collect.vue +++ b/pages/user/goods-collect.vue @@ -5,7 +5,8 @@ - 共 {{ state.pagination.total }} 件商品 + 共 + {{ state.pagination.total }} 件商品 @@ -129,7 +131,7 @@ if (code !== 0) { return; } - state.pagination.list = _.concat(state.pagination.list, data.list) + state.pagination.list = _.concat(state.pagination.list, data.list); state.pagination.total = data.total; state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'; } @@ -174,7 +176,7 @@ // 加载更多 function loadMore() { if (state.loadStatus === 'noMore') { - return + return; } state.pagination.pageNo++; getData(); diff --git a/pages/user/goods-log.vue b/pages/user/goods-log.vue index 630f7c5..5a2e235 100644 --- a/pages/user/goods-log.vue +++ b/pages/user/goods-log.vue @@ -81,11 +81,13 @@ @@ -154,10 +155,7 @@ - + {{ state.thirdInfo.nickname }} @@ -198,14 +196,15 @@ const placeholderStyle = 'color:#BBBBBB;font-size:28rpx;line-height:normal'; - const sexRadioMap = [{ + const sexRadioMap = [ + { name: '男', value: '1', }, { name: '女', value: '2', - } + }, ]; const userInfo = computed(() => sheep.$store('user').userInfo); @@ -279,7 +278,7 @@ // 保存信息 async function onSubmit() { - const { code } = await UserApi.updateUser({ + const { code } = await UserApi.updateUser({ avatar: state.model.avatar, nickname: state.model.nickname, sex: state.model.sex, diff --git a/pages/user/wallet/money.vue b/pages/user/wallet/money.vue index 149eb30..acc24fb 100644 --- a/pages/user/wallet/money.vue +++ b/pages/user/wallet/money.vue @@ -13,7 +13,9 @@ /> - {{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }} + {{ + state.showMoney ? fen2yuan(userWallet.balance) : '*****' + }} @@ -24,7 +26,12 @@ - + - + + + - - - - - + + + + + \ No newline at end of file + diff --git a/sheep/api/infra/file.js b/sheep/api/infra/file.js index a4bac46..e4d47ad 100644 --- a/sheep/api/infra/file.js +++ b/sheep/api/infra/file.js @@ -15,8 +15,8 @@ const FileApi = { name: 'file', header: { // Accept: 'text/json', - Accept : '*/*', - 'tenant-id' :'1', + Accept: '*/*', + 'tenant-id': '1', // Authorization: 'Bearer test247', }, success: (uploadFileRes) => { diff --git a/sheep/api/member/address.js b/sheep/api/member/address.js index d0c16ce..2835ce7 100644 --- a/sheep/api/member/address.js +++ b/sheep/api/member/address.js @@ -5,7 +5,7 @@ const AddressApi = { getAddressList: () => { return request({ url: '/member/address/list', - method: 'GET' + method: 'GET', }); }, // 创建用户收件地址 @@ -16,7 +16,7 @@ const AddressApi = { data, custom: { showSuccess: true, - successMsg: '保存成功' + successMsg: '保存成功', }, }); }, @@ -28,7 +28,7 @@ const AddressApi = { data, custom: { showSuccess: true, - successMsg: '更新成功' + successMsg: '更新成功', }, }); }, @@ -37,7 +37,7 @@ const AddressApi = { return request({ url: '/member/address/get', method: 'GET', - params: { id } + params: { id }, }); }, // 删除用户收件地址 @@ -45,7 +45,24 @@ const AddressApi = { return request({ url: '/member/address/delete', method: 'DELETE', - params: { id } + params: { id }, + }); + }, + + // 文章列表 + textList: (id) => { + return request({ + url: '/promotion/article/list', + method: 'GET', + params: { id }, + }); + }, + // 文章列表详情 + textListDetail: (id) => { + return request({ + url: '/promotion/article/get', + method: 'GET', + params: { id }, }); }, }; diff --git a/sheep/api/member/auth.js b/sheep/api/member/auth.js index a1c0660..eaa54ea 100644 --- a/sheep/api/member/auth.js +++ b/sheep/api/member/auth.js @@ -56,7 +56,7 @@ const AuthUtil = { url: '/member/auth/refresh-token', method: 'POST', params: { - refreshToken + refreshToken, }, custom: { loading: false, // 不用加载中 @@ -103,7 +103,7 @@ const AuthUtil = { data: { phoneCode, loginCode, - state + state, }, custom: { showSuccess: true, @@ -118,13 +118,13 @@ const AuthUtil = { url: '/member/auth/create-weixin-jsapi-signature', method: 'POST', params: { - url + url, }, custom: { showError: false, showLoading: false, }, - }) + }); }, // }; diff --git a/sheep/api/member/point.js b/sheep/api/member/point.js index 188ffd4..b305ba3 100644 --- a/sheep/api/member/point.js +++ b/sheep/api/member/point.js @@ -4,7 +4,7 @@ const PointApi = { // 获得用户积分记录分页 getPointRecordPage: (params) => { if (params.addStatus === undefined) { - delete params.addStatus + delete params.addStatus; } const queryString = Object.keys(params) .map((key) => encodeURIComponent(key) + '=' + params[key]) @@ -13,7 +13,7 @@ const PointApi = { url: `/member/point/record/page?${queryString}`, method: 'GET', }); - } + }, }; export default PointApi; diff --git a/sheep/api/member/signin.js b/sheep/api/member/signin.js index 35169ef..b4010eb 100644 --- a/sheep/api/member/signin.js +++ b/sheep/api/member/signin.js @@ -34,4 +34,4 @@ const SignInApi = { }, }; -export default SignInApi; \ No newline at end of file +export default SignInApi; diff --git a/sheep/api/member/social.js b/sheep/api/member/social.js index f7ab259..b55d6a4 100644 --- a/sheep/api/member/social.js +++ b/sheep/api/member/social.js @@ -7,7 +7,7 @@ const SocialApi = { url: '/member/social-user/get', method: 'GET', params: { - type + type, }, custom: { showLoading: false, @@ -22,7 +22,7 @@ const SocialApi = { data: { type, code, - state + state, }, custom: { custom: { @@ -40,7 +40,7 @@ const SocialApi = { method: 'DELETE', data: { type, - openid + openid, }, custom: { showLoading: false, @@ -51,4 +51,4 @@ const SocialApi = { }, }; -export default SocialApi; \ No newline at end of file +export default SocialApi; diff --git a/sheep/api/member/user.js b/sheep/api/member/user.js index 5f06e42..ce6e352 100644 --- a/sheep/api/member/user.js +++ b/sheep/api/member/user.js @@ -21,7 +21,7 @@ const UserApi = { custom: { auth: true, showSuccess: true, - successMsg: '更新成功' + successMsg: '更新成功', }, }); }, @@ -34,7 +34,7 @@ const UserApi = { custom: { loadingMsg: '验证中', showSuccess: true, - successMsg: '修改成功' + successMsg: '修改成功', }, }); }, @@ -44,12 +44,12 @@ const UserApi = { url: '/member/user/update-mobile-by-weixin', method: 'PUT', data: { - code + code, }, custom: { showSuccess: true, loadingMsg: '获取中', - successMsg: '修改成功' + successMsg: '修改成功', }, }); }, @@ -62,7 +62,7 @@ const UserApi = { custom: { loadingMsg: '验证中', showSuccess: true, - successMsg: '修改成功' + successMsg: '修改成功', }, }); }, @@ -75,11 +75,10 @@ const UserApi = { custom: { loadingMsg: '验证中', showSuccess: true, - successMsg: '修改成功' - } + successMsg: '修改成功', + }, }); }, - }; export default UserApi; diff --git a/sheep/api/migration/app.js b/sheep/api/migration/app.js index 158414f..b0734f5 100644 --- a/sheep/api/migration/app.js +++ b/sheep/api/migration/app.js @@ -10,12 +10,12 @@ export default { method: 'GET', params: { ids: ids.join(','), - } + }, }), getMpLink: () => request({ url: 'app/mplive/getMpLink', - method: 'GET' + method: 'GET', }), }, }; diff --git a/sheep/api/migration/index.js b/sheep/api/migration/index.js index 31a85ef..62680cd 100644 --- a/sheep/api/migration/index.js +++ b/sheep/api/migration/index.js @@ -7,4 +7,4 @@ Object.keys(files).forEach((key) => { }; }); -export default api; \ No newline at end of file +export default api; diff --git a/sheep/api/pay/channel.js b/sheep/api/pay/channel.js index 4e7bfc5..fca7bc0 100644 --- a/sheep/api/pay/channel.js +++ b/sheep/api/pay/channel.js @@ -6,7 +6,7 @@ const PayChannelApi = { return request({ url: '/pay/channel/get-enable-code-list', method: 'GET', - params: { appId } + params: { appId }, }); }, }; diff --git a/sheep/api/pay/order.js b/sheep/api/pay/order.js index f985359..d6c9070 100644 --- a/sheep/api/pay/order.js +++ b/sheep/api/pay/order.js @@ -6,7 +6,7 @@ const PayOrderApi = { return request({ url: '/pay/order/get', method: 'GET', - params: { id } + params: { id }, }); }, // 提交支付订单 @@ -14,9 +14,9 @@ const PayOrderApi = { return request({ url: '/pay/order/submit', method: 'POST', - data + data, }); - } + }, }; export default PayOrderApi; diff --git a/sheep/api/product/history.js b/sheep/api/product/history.js index 9ed53e3..c57da6f 100644 --- a/sheep/api/product/history.js +++ b/sheep/api/product/history.js @@ -31,7 +31,7 @@ const SpuHistoryApi = { method: 'GET', data, custom: { - showLoading: false + showLoading: false, }, }); }, diff --git a/sheep/api/promotion/article.js b/sheep/api/promotion/article.js index ded5fb1..c5f2ffe 100644 --- a/sheep/api/promotion/article.js +++ b/sheep/api/promotion/article.js @@ -1,12 +1,12 @@ import request from '@/sheep/request'; export default { - // 获得文章详情 - getArticle: (id, title) => { - return request({ - url: '/promotion/article/get', - method: 'GET', - params: { id, title } - }); - } -} + // 获得文章详情 + getArticle: (id, title) => { + return request({ + url: '/promotion/article/get', + method: 'GET', + params: { id, title }, + }); + }, +}; diff --git a/sheep/api/promotion/combination.js b/sheep/api/promotion/combination.js index 44f61e9..2b05b50 100644 --- a/sheep/api/promotion/combination.js +++ b/sheep/api/promotion/combination.js @@ -47,9 +47,9 @@ const CombinationApi = { // 获得我的拼团记录分页 getCombinationRecordPage: (params) => { return request({ - url: "/promotion/combination-record/page", + url: '/promotion/combination-record/page', method: 'GET', - params + params, }); }, diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index c9dfa52..497c503 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -95,7 +95,7 @@ const CouponApi = { showLoading: false, // 避免影响 settlementOrder 结算的结果 }, }); - } + }, }; export default CouponApi; diff --git a/sheep/api/promotion/diy.js b/sheep/api/promotion/diy.js index e524f69..deff330 100644 --- a/sheep/api/promotion/diy.js +++ b/sheep/api/promotion/diy.js @@ -16,7 +16,7 @@ const DiyApi = { url: '/promotion/diy-template/get', method: 'GET', params: { - id + id, }, custom: { showError: false, @@ -29,8 +29,8 @@ const DiyApi = { url: '/promotion/diy-page/get', method: 'GET', params: { - id - } + id, + }, }); }, }; diff --git a/sheep/api/promotion/rewardActivity.js b/sheep/api/promotion/rewardActivity.js index 5f74db7..aec9150 100644 --- a/sheep/api/promotion/rewardActivity.js +++ b/sheep/api/promotion/rewardActivity.js @@ -8,7 +8,7 @@ const RewardActivityApi = { method: 'GET', params: { id }, }); - } + }, }; -export default RewardActivityApi; \ No newline at end of file +export default RewardActivityApi; diff --git a/sheep/api/promotion/seckill.js b/sheep/api/promotion/seckill.js index 4d41e8b..ac9137f 100644 --- a/sheep/api/promotion/seckill.js +++ b/sheep/api/promotion/seckill.js @@ -1,4 +1,4 @@ -import request from "@/sheep/request"; +import request from '@/sheep/request'; const SeckillApi = { // 获得秒杀时间段列表 @@ -25,9 +25,9 @@ const SeckillApi = { return request({ url: 'promotion/seckill-activity/get-detail', method: 'GET', - params: { id } + params: { id }, }); - } -} + }, +}; export default SeckillApi; diff --git a/sheep/api/system/area.js b/sheep/api/system/area.js index 7c41eff..aa4a729 100644 --- a/sheep/api/system/area.js +++ b/sheep/api/system/area.js @@ -5,7 +5,7 @@ const AreaApi = { getAreaTree: () => { return request({ url: '/system/area/tree', - method: 'GET' + method: 'GET', }); }, }; diff --git a/sheep/api/trade/afterSale.js b/sheep/api/trade/afterSale.js index 44c4dd3..1eef445 100644 --- a/sheep/api/trade/afterSale.js +++ b/sheep/api/trade/afterSale.js @@ -57,7 +57,7 @@ const AfterSaleApi = { method: 'PUT', data, }); - } + }, }; export default AfterSaleApi; diff --git a/sheep/api/trade/brokerage.js b/sheep/api/trade/brokerage.js index 206e7ec..32e4d13 100644 --- a/sheep/api/trade/brokerage.js +++ b/sheep/api/trade/brokerage.js @@ -2,18 +2,18 @@ import request from '@/sheep/request'; const BrokerageApi = { // 绑定分销用户 - bindBrokerageUser: (data)=>{ + bindBrokerageUser: (data) => { return request({ url: '/trade/brokerage-user/bind', method: 'PUT', - data + data, }); }, // 获得个人分销信息 getBrokerageUser: () => { return request({ url: '/trade/brokerage-user/get', - method: 'GET' + method: 'GET', }); }, // 获得个人分销统计 @@ -24,12 +24,12 @@ const BrokerageApi = { }); }, // 获得分销记录分页 - getBrokerageRecordPage: params => { + getBrokerageRecordPage: (params) => { if (params.status === undefined) { - delete params.status + delete params.status; } const queryString = Object.keys(params) - .map(key => encodeURIComponent(key) + '=' + params[key]) + .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ url: `/trade/brokerage-record/page?${queryString}`, @@ -37,7 +37,7 @@ const BrokerageApi = { }); }, // 创建分销提现 - createBrokerageWithdraw: data => { + createBrokerageWithdraw: (data) => { return request({ url: '/trade/brokerage-withdraw/create', method: 'POST', @@ -45,15 +45,15 @@ const BrokerageApi = { }); }, // 获得商品的分销金额 - getProductBrokeragePrice: spuId => { + getProductBrokeragePrice: (spuId) => { return request({ url: '/trade/brokerage-record/get-product-brokerage-price', method: 'GET', - params: { spuId } + params: { spuId }, }); }, // 获得分销用户排行(基于佣金) - getRankByPrice: params => { + getRankByPrice: (params) => { const queryString = `times=${params.times[0]}×=${params.times[1]}`; return request({ url: `/trade/brokerage-user/get-rank-by-price?${queryString}`, @@ -61,9 +61,9 @@ const BrokerageApi = { }); }, // 获得分销用户排行分页(基于佣金) - getBrokerageUserChildSummaryPageByPrice: params => { + getBrokerageUserChildSummaryPageByPrice: (params) => { const queryString = Object.keys(params) - .map(key => encodeURIComponent(key) + '=' + params[key]) + .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ url: `/trade/brokerage-user/rank-page-by-price?${queryString}`, @@ -71,9 +71,9 @@ const BrokerageApi = { }); }, // 获得分销用户排行分页(基于用户量) - getBrokerageUserRankPageByUserCount: params => { + getBrokerageUserRankPageByUserCount: (params) => { const queryString = Object.keys(params) - .map(key => encodeURIComponent(key) + '=' + params[key]) + .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ url: `/trade/brokerage-user/rank-page-by-user-count?${queryString}`, @@ -81,13 +81,13 @@ const BrokerageApi = { }); }, // 获得下级分销统计分页 - getBrokerageUserChildSummaryPage: params => { + getBrokerageUserChildSummaryPage: (params) => { return request({ url: '/trade/brokerage-user/child-summary-page', method: 'GET', params, - }) - } -} + }); + }, +}; -export default BrokerageApi +export default BrokerageApi; diff --git a/sheep/api/trade/cart.js b/sheep/api/trade/cart.js index 63cea18..cc6dbfe 100644 --- a/sheep/api/trade/cart.js +++ b/sheep/api/trade/cart.js @@ -9,21 +9,21 @@ const CartApi = { custom: { showSuccess: true, successMsg: '已添加到购物车~', - } + }, }); }, updateCartCount: (data) => { return request({ url: '/trade/cart/update-count', method: 'PUT', - data: data + data: data, }); }, updateCartSelected: (data) => { return request({ url: '/trade/cart/update-selected', method: 'PUT', - data: data + data: data, }); }, deleteCart: (ids) => { @@ -31,8 +31,8 @@ const CartApi = { url: '/trade/cart/delete', method: 'DELETE', params: { - ids - } + ids, + }, }); }, getCartList: () => { @@ -47,4 +47,4 @@ const CartApi = { }, }; -export default CartApi; \ No newline at end of file +export default CartApi; diff --git a/sheep/api/trade/delivery.js b/sheep/api/trade/delivery.js index 27a08d9..7ba35aa 100644 --- a/sheep/api/trade/delivery.js +++ b/sheep/api/trade/delivery.js @@ -7,7 +7,7 @@ const DeliveryApi = { url: `/trade/delivery/express/list`, method: 'get', }); - } + }, }; export default DeliveryApi; diff --git a/sheep/components/s-activity-pop/s-activity-pop.vue b/sheep/components/s-activity-pop/s-activity-pop.vue index 432dc45..9593982 100644 --- a/sheep/components/s-activity-pop/s-activity-pop.vue +++ b/sheep/components/s-activity-pop/s-activity-pop.vue @@ -43,7 +43,7 @@ const emits = defineEmits(['close']); const state = reactive({ activityInfo: computed(() => props.modelValue), - activityMap: {} + activityMap: {}, }); watch( @@ -51,13 +51,13 @@ () => { // 展示的情况下,加载每个活动的详细信息 if (props.show) { - state.activityInfo?.forEach(activity => { - RewardActivityApi.getRewardActivity(activity.id).then(res => { + state.activityInfo?.forEach((activity) => { + RewardActivityApi.getRewardActivity(activity.id).then((res) => { if (res.code !== 0) { return; } state.activityMap[activity.id] = res.data; - }) + }); }); } }, diff --git a/sheep/components/s-address-item/s-address-item.vue b/sheep/components/s-address-item/s-address-item.vue index f1b54b3..5d99155 100644 --- a/sheep/components/s-address-item/s-address-item.vue +++ b/sheep/components/s-address-item/s-address-item.vue @@ -18,9 +18,7 @@ {{ props.item.detailAddress }} - - {{ props.item.name }} {{ props.item.mobile }} - + {{ props.item.name }} {{ props.item.mobile }} 请选择收货地址 diff --git a/sheep/components/s-auth-modal/components/account-login.vue b/sheep/components/s-auth-modal/components/account-login.vue index 579614c..bee146c 100644 --- a/sheep/components/s-auth-modal/components/account-login.vue +++ b/sheep/components/s-auth-modal/components/account-login.vue @@ -89,7 +89,7 @@ // 同意协议 if (!props.agreeStatus) { - emits('onConfirm', true) + emits('onConfirm', true); sheep.$helper.toast('请勾选同意'); return; } diff --git a/sheep/components/s-auth-modal/components/change-password.vue b/sheep/components/s-auth-modal/components/change-password.vue index b02ea02..04fab6d 100644 --- a/sheep/components/s-auth-modal/components/change-password.vue +++ b/sheep/components/s-auth-modal/components/change-password.vue @@ -53,9 +53,7 @@ - + diff --git a/sheep/components/s-auth-modal/components/reset-password.vue b/sheep/components/s-auth-modal/components/reset-password.vue index bc1be8b..80f4602 100644 --- a/sheep/components/s-auth-modal/components/reset-password.vue +++ b/sheep/components/s-auth-modal/components/reset-password.vue @@ -110,7 +110,7 @@ return; } // 成功后,用户重新登录 - showAuthModal('accountLogin') + showAuthModal('accountLogin'); }; diff --git a/sheep/components/s-auth-modal/components/sms-login.vue b/sheep/components/s-auth-modal/components/sms-login.vue index 0651b78..a2e0044 100644 --- a/sheep/components/s-auth-modal/components/sms-login.vue +++ b/sheep/components/s-auth-modal/components/sms-login.vue @@ -102,7 +102,7 @@ return; } if (!props.agreeStatus) { - emits('onConfirm', true) + emits('onConfirm', true); sheep.$helper.toast('请勾选同意'); return; } diff --git a/sheep/components/s-auth-modal/s-auth-modal.vue b/sheep/components/s-auth-modal/s-auth-modal.vue index cf6a6ff..14e89aa 100644 --- a/sheep/components/s-auth-modal/s-auth-modal.vue +++ b/sheep/components/s-auth-modal/s-auth-modal.vue @@ -10,7 +10,11 @@ /> - + @@ -32,7 +36,11 @@ 还没有账号? - @@ -81,17 +89,13 @@ /> 我已阅读并遵守 - - 《用户协议》 - + 《用户协议》 - - 《隐私协议》 - + 《隐私协议》 - + diff --git a/sheep/components/s-block-item/s-block-item.vue b/sheep/components/s-block-item/s-block-item.vue index 9cd6007..89862c8 100644 --- a/sheep/components/s-block-item/s-block-item.vue +++ b/sheep/components/s-block-item/s-block-item.vue @@ -1,81 +1,158 @@ - + \ No newline at end of file diff --git a/sheep/components/s-block/s-block.vue b/sheep/components/s-block/s-block.vue index 152b8a6..0817fde 100644 --- a/sheep/components/s-block/s-block.vue +++ b/sheep/components/s-block/s-block.vue @@ -21,8 +21,7 @@ const elBackground = computed(() => { if (props.styles) { - if (props.styles.bgType === 'color') - return { background: props.styles.bgColor }; + if (props.styles.bgType === 'color') return { background: props.styles.bgColor }; if (props.styles.bgType === 'img') return { background: `url(${sheep.$url.cdn( diff --git a/sheep/components/s-count-down/s-count-down.vue b/sheep/components/s-count-down/s-count-down.vue index 98b3a1f..7132b3e 100644 --- a/sheep/components/s-count-down/s-count-down.vue +++ b/sheep/components/s-count-down/s-count-down.vue @@ -1,173 +1,199 @@ \ No newline at end of file + color: #e93323; + } + diff --git a/sheep/components/s-coupon-block/s-coupon-block.vue b/sheep/components/s-coupon-block/s-coupon-block.vue index 6250b4b..c4e5921 100644 --- a/sheep/components/s-coupon-block/s-coupon-block.vue +++ b/sheep/components/s-coupon-block/s-coupon-block.vue @@ -47,8 +47,8 @@ import sheep from '@/sheep'; import CouponApi from '@/sheep/api/promotion/coupon'; import { ref, onMounted } from 'vue'; - import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from "@/sheep/util/const"; - import { floatToFixed2, formatDate } from "@/sheep/util"; + import { CouponTemplateValidityTypeEnum, PromotionDiscountTypeEnum } from '@/sheep/util/const'; + import { floatToFixed2, formatDate } from '@/sheep/util'; const props = defineProps({ data: { @@ -61,7 +61,7 @@ }, }); const { columns, button } = props.data; - const SIZE_LIST = ['lg', 'md', 'xs'] + const SIZE_LIST = ['lg', 'md', 'xs']; const couponBg = { background: `url(${sheep.$url.cdn(props.data.bgImg)}) no-repeat top center / 100% 100%`, }; @@ -72,36 +72,36 @@ // 格式化【折扣类型】 const formatCouponDiscountType = (coupon) => { - if(coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) { - return 'reduce' + if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) { + return 'reduce'; } - if(coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) { - return 'percent' + if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) { + return 'percent'; } - return `未知【${coupon.discountType}】` - } + return `未知【${coupon.discountType}】`; + }; // 格式化【折扣】 const formatCouponDiscountValue = (coupon) => { - if(coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) { - return floatToFixed2(coupon.discountPrice) + if (coupon.discountType === PromotionDiscountTypeEnum.PRICE.type) { + return floatToFixed2(coupon.discountPrice); } - if(coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) { - return coupon.discountPercent + if (coupon.discountType === PromotionDiscountTypeEnum.PERCENT.type) { + return coupon.discountPercent; } - return `未知【${coupon.discountType}】` - } + return `未知【${coupon.discountType}】`; + }; // 格式化【有效期限】 const formatValidityType = (row) => { if (row.validityType === CouponTemplateValidityTypeEnum.DATE.type) { - return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}` + return `${formatDate(row.validStartTime)} 至 ${formatDate(row.validEndTime)}`; } if (row.validityType === CouponTemplateValidityTypeEnum.TERM.type) { - return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用` + return `领取后第 ${row.fixedStartTerm} - ${row.fixedEndTerm} 天内可用`; } - return '未知【' + row.validityType + '】' - } + return '未知【' + row.validityType + '】'; + }; const couponList = ref([]); // 立即领取优惠券 @@ -112,16 +112,16 @@ title: msg, icon: 'none', }); - return + return; } - await getCouponTemplateList() + await getCouponTemplateList(); } const getCouponTemplateList = async () => { const { data } = await CouponApi.getCouponTemplateListByIds(props.data.couponIds.join(',')); couponList.value = data; - } + }; onMounted(() => { - getCouponTemplateList() + getCouponTemplateList(); }); diff --git a/sheep/components/s-coupon-card/s-coupon-card.vue b/sheep/components/s-coupon-card/s-coupon-card.vue index bd5705b..b83635f 100644 --- a/sheep/components/s-coupon-card/s-coupon-card.vue +++ b/sheep/components/s-coupon-card/s-coupon-card.vue @@ -1,79 +1,84 @@ \ No newline at end of file + .menu-wallet { + width: 144rpx; + } + } + diff --git a/sheep/components/s-coupon-get/s-coupon-get.vue b/sheep/components/s-coupon-get/s-coupon-get.vue index 6df6b55..37638ab 100644 --- a/sheep/components/s-coupon-get/s-coupon-get.vue +++ b/sheep/components/s-coupon-get/s-coupon-get.vue @@ -52,7 +52,7 @@ const emits = defineEmits(['get', 'close']); const state = reactive({ - couponInfo: computed(() => props.modelValue) + couponInfo: computed(() => props.modelValue), }); // 领取优惠劵 diff --git a/sheep/components/s-coupon-list/s-coupon-list.vue b/sheep/components/s-coupon-list/s-coupon-list.vue index 411a4c0..3a577d2 100644 --- a/sheep/components/s-coupon-list/s-coupon-list.vue +++ b/sheep/components/s-coupon-list/s-coupon-list.vue @@ -37,23 +37,16 @@ 有效期:领取后 {{ data.fixedEndTerm }} 天内可用 - + 有效期: {{ sheep.$helper.timeFormat(data.validStartTime, 'yyyy-mm-dd') }} 至 {{ sheep.$helper.timeFormat(data.validEndTime, 'yyyy-mm-dd') }} - + 满 {{ fen2yuan(data.usePrice) }} 可用 @@ -202,4 +195,4 @@ .price-text { color: #ff0000; } - \ No newline at end of file + diff --git a/sheep/components/s-coupon-select/s-coupon-select.vue b/sheep/components/s-coupon-select/s-coupon-select.vue index e1a9db4..7f5de4f 100644 --- a/sheep/components/s-coupon-select/s-coupon-select.vue +++ b/sheep/components/s-coupon-select/s-coupon-select.vue @@ -55,7 +55,8 @@ import { computed, reactive } from 'vue'; const props = defineProps({ - modelValue: { // 优惠劵列表 + modelValue: { + // 优惠劵列表 type: Object, default() {}, }, @@ -84,7 +85,7 @@ // 确认优惠劵 const onConfirm = () => { emits('confirm', state.couponId); - } + }; \ No newline at end of file + .disabled-btn { + font-weight: 400; + color: #c6c6c6; + background: #f8f8f8; + } + } + } + } + diff --git a/sheep/components/s-share-modal/canvas-poster/index.vue b/sheep/components/s-share-modal/canvas-poster/index.vue index 87ee562..e5f332f 100644 --- a/sheep/components/s-share-modal/canvas-poster/index.vue +++ b/sheep/components/s-share-modal/canvas-poster/index.vue @@ -7,7 +7,7 @@ class="poster-img" :src="painterImageUrl" :style="{ - height: poster.css.height+ 'px', + height: poster.css.height + 'px', width: poster.css.width + 'px', }" :show-menu-by-longpress="true" @@ -57,8 +57,7 @@ }, shareInfo: { type: Object, - default: () => { - }, + default: () => {}, }, }); @@ -110,7 +109,7 @@ // 获得海报数据 async function getPoster() { - painterImageUrl.value = undefined + painterImageUrl.value = undefined; poster.views = await getPosterData({ width: poster.css.width, shareInfo: props.shareInfo, @@ -164,5 +163,4 @@ .poster-img { border-radius: 20rpx; } - diff --git a/sheep/components/s-share-modal/canvas-poster/poster/goods.js b/sheep/components/s-share-modal/canvas-poster/poster/goods.js index 883e4be..07bf042 100644 --- a/sheep/components/s-share-modal/canvas-poster/poster/goods.js +++ b/sheep/components/s-share-modal/canvas-poster/poster/goods.js @@ -8,7 +8,9 @@ const goods = async (poster) => { return [ { type: 'image', - src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg)), + src: formatImageUrlProtocol( + sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.goods_bg), + ), css: { width, position: 'fixed', diff --git a/sheep/components/s-share-modal/canvas-poster/poster/groupon.js b/sheep/components/s-share-modal/canvas-poster/poster/groupon.js index d1b6b78..5ca16ba 100644 --- a/sheep/components/s-share-modal/canvas-poster/poster/groupon.js +++ b/sheep/components/s-share-modal/canvas-poster/poster/groupon.js @@ -8,7 +8,9 @@ const groupon = async (poster) => { return [ { type: 'image', - src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg)), + src: formatImageUrlProtocol( + sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.groupon_bg), + ), css: { width, position: 'fixed', diff --git a/sheep/components/s-share-modal/canvas-poster/poster/user.js b/sheep/components/s-share-modal/canvas-poster/poster/user.js index 5c4d3b9..0939796 100644 --- a/sheep/components/s-share-modal/canvas-poster/poster/user.js +++ b/sheep/components/s-share-modal/canvas-poster/poster/user.js @@ -8,7 +8,9 @@ const user = async (poster) => { return [ { type: 'image', - src: formatImageUrlProtocol(sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg)), + src: formatImageUrlProtocol( + sheep.$url.cdn(sheep.$store('app').platform.share.posterInfo.user_bg), + ), css: { width, position: 'fixed', diff --git a/sheep/components/s-share-modal/s-share-modal.vue b/sheep/components/s-share-modal/s-share-modal.vue index 717940e..5b76c03 100644 --- a/sheep/components/s-share-modal/s-share-modal.vue +++ b/sheep/components/s-share-modal/s-share-modal.vue @@ -3,7 +3,10 @@ - + @@ -17,7 +20,11 @@ open-type="share" @tap="onShareByForward" > - + @@ -41,7 +48,11 @@ class="share-item share-btn ss-flex-col ss-col-center" @tap="onShareByCopyLink" > - + diff --git a/sheep/components/s-title-block/s-title-block.vue b/sheep/components/s-title-block/s-title-block.vue index 513a3cc..b108ee0 100644 --- a/sheep/components/s-title-block/s-title-block.vue +++ b/sheep/components/s-title-block/s-title-block.vue @@ -9,11 +9,17 @@ {{ data.title }} - {{ data.description }} + {{ + data.description + }} - + {{ data.more.text }} @@ -58,7 +64,7 @@ const titleStyles = { color: props.data.titleColor, fontSize: `${props.data.titleSize}px`, - textAlign: props.data.textAlign + textAlign: props.data.textAlign, }; // 副标题 diff --git a/sheep/components/s-user-card/s-user-card.vue b/sheep/components/s-user-card/s-user-card.vue index d234098..ab21efb 100644 --- a/sheep/components/s-user-card/s-user-card.vue +++ b/sheep/components/s-user-card/s-user-card.vue @@ -1,30 +1,35 @@ \ No newline at end of file + .bind-btn { + width: 100rpx; + height: 50rpx; + background: #ff6100; + border-radius: 25rpx; + font-size: 24rpx; + font-weight: 500; + color: #ffffff; + } + } + diff --git a/sheep/components/s-wallet-card/s-wallet-card.vue b/sheep/components/s-wallet-card/s-wallet-card.vue index 54348e9..28b65b6 100644 --- a/sheep/components/s-wallet-card/s-wallet-card.vue +++ b/sheep/components/s-wallet-card/s-wallet-card.vue @@ -1,93 +1,105 @@ - diff --git a/sheep/config/index.js b/sheep/config/index.js index 48f46ef..3edc07d 100644 --- a/sheep/config/index.js +++ b/sheep/config/index.js @@ -16,5 +16,5 @@ export default { baseUrl, apiPath, staticUrl, - websocketPath + websocketPath, }; diff --git a/sheep/hooks/useGoods.js b/sheep/hooks/useGoods.js index 5627447..f23a6ab 100644 --- a/sheep/hooks/useGoods.js +++ b/sheep/hooks/useGoods.js @@ -11,7 +11,7 @@ import { formatDate } from '@/sheep/util'; */ export function formatSales(type, num) { let prefix = type !== 'exact' && num < 10 ? '销量' : '已售'; - return formatNum(prefix, type, num) + return formatNum(prefix, type, num); } /** @@ -21,10 +21,9 @@ export function formatSales(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatExchange(type, num) { - return formatNum('已兑换', type, num) + return formatNum('已兑换', type, num); } - /** * 格式化库存 * @param {'exact' | any} type 格式类型:exact=精确值,其它=大致数量 @@ -32,7 +31,7 @@ export function formatExchange(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatStock(type, num) { - return formatNum('库存', type, num) + return formatNum('库存', type, num); } /** @@ -43,7 +42,7 @@ export function formatStock(type, num) { * @return {string} 格式化后的销量字符串 */ export function formatNum(prefix, type, num) { - num = (num || 0); + num = num || 0; // 情况一:精确数值 if (type === 'exact') { return prefix + num; @@ -67,7 +66,7 @@ export function formatPrice(e) { } // 视频格式后缀列表 -const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'] +const VIDEO_SUFFIX_LIST = ['.avi', '.mp4']; /** * 转换商品轮播的链接列表:根据链接的后缀,判断是视频链接还是图片链接 @@ -76,12 +75,16 @@ const VIDEO_SUFFIX_LIST = ['.avi', '.mp4'] * @return {{src: string, type: 'video' | 'image' }[]} 转换后的链接列表 */ export function formatGoodsSwiper(urlList) { - return urlList?.filter(url => url).map((url, key) => { - const isVideo = VIDEO_SUFFIX_LIST.some(suffix => url.includes(suffix)); - const type = isVideo ? 'video' : 'image' - const src = $url.cdn(url); - return { type, src } - }) || []; + return ( + urlList + ?.filter((url) => url) + .map((url, key) => { + const isVideo = VIDEO_SUFFIX_LIST.some((suffix) => url.includes(suffix)); + const type = isVideo ? 'video' : 'image'; + const src = $url.cdn(url); + return { type, src }; + }) || [] + ); } /** @@ -94,9 +97,7 @@ export function formatOrderColor(order) { if (order.status === 0) { return 'info-color'; } - if (order.status === 10 - || order.status === 20 - || (order.status === 30 && !order.commentStatus)) { + if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) { return 'warning-color'; } if (order.status === 30 && order.commentStatus) { @@ -139,7 +140,7 @@ export function formatOrderStatus(order) { */ export function formatOrderStatusDescription(order) { if (order.status === 0) { - return `请在 ${ formatDate(order.payExpireTime) } 前完成支付`; + return `请在 ${formatDate(order.payExpireTime)} 前完成支付`; } if (order.status === 10) { return '商家未发货,请耐心等待'; @@ -162,24 +163,30 @@ export function formatOrderStatusDescription(order) { * @param order 订单 */ export function handleOrderButtons(order) { - order.buttons = [] - if (order.type === 3) { // 查看拼团 + order.buttons = []; + if (order.type === 3) { + // 查看拼团 order.buttons.push('combination'); } - if (order.status === 20) { // 确认收货 + if (order.status === 20) { + // 确认收货 order.buttons.push('confirm'); } - if (order.logisticsId > 0) { // 查看物流 + if (order.logisticsId > 0) { + // 查看物流 order.buttons.push('express'); } - if (order.status === 0) { // 取消订单 / 发起支付 + if (order.status === 0) { + // 取消订单 / 发起支付 order.buttons.push('cancel'); order.buttons.push('pay'); } - if (order.status === 30 && !order.commentStatus) { // 发起评价 + if (order.status === 30 && !order.commentStatus) { + // 发起评价 order.buttons.push('comment'); } - if (order.status === 40) { // 删除订单 + if (order.status === 40) { + // 删除订单 order.buttons.push('delete'); } } @@ -257,10 +264,12 @@ export function formatAfterSaleStatusDescription(afterSale) { */ export function handleAfterSaleButtons(afterSale) { afterSale.buttons = []; - if ([10, 20, 30].includes(afterSale.status)) { // 取消订单 + if ([10, 20, 30].includes(afterSale.status)) { + // 取消订单 afterSale.buttons.push('cancel'); } - if (afterSale.status === 20) { // 退货信息 + if (afterSale.status === 20) { + // 退货信息 afterSale.buttons.push('delivery'); } } @@ -324,7 +333,7 @@ function getDayjsTime(time) { * @returns {string} 元,例如说 1.00 元 */ export function fen2yuan(price) { - return (price / 100.0).toFixed(2) + return (price / 100.0).toFixed(2); } /** @@ -345,26 +354,26 @@ export function convertProductPropertyList(skus) { let result = []; for (const sku of skus) { if (!sku.properties) { - continue + continue; } for (const property of sku.properties) { // ① 先处理属性 - let resultProperty = result.find(item => item.id === property.propertyId) + let resultProperty = result.find((item) => item.id === property.propertyId); if (!resultProperty) { resultProperty = { id: property.propertyId, name: property.propertyName, - values: [] - } - result.push(resultProperty) + values: [], + }; + result.push(resultProperty); } // ② 再处理属性值 - let resultValue = resultProperty.values.find(item => item.id === property.valueId) + let resultValue = resultProperty.values.find((item) => item.id === property.valueId); if (!resultValue) { resultProperty.values.push({ id: property.valueId, - name: property.valueName - }) + name: property.valueName, + }); } } } diff --git a/sheep/hooks/useWebSocket.js b/sheep/hooks/useWebSocket.js index 1831617..1e2e233 100644 --- a/sheep/hooks/useWebSocket.js +++ b/sheep/hooks/useWebSocket.js @@ -22,12 +22,9 @@ export function useWebSocket(opt) { destroy: false, // 是否销毁 pingTimeout: null, // 心跳检测定时器 reconnectTimeout: null, // 重连定时器ID的属性 - onConnected: () => { - }, // 连接成功时触发 - onClosed: () => { - }, // 连接关闭时触发 - onMessage: (data) => { - }, // 收到消息 + onConnected: () => {}, // 连接成功时触发 + onClosed: () => {}, // 连接关闭时触发 + onMessage: (data) => {}, // 收到消息 }); const SocketTask = ref(null); // SocketTask 由 uni.connectSocket() 接口创建 @@ -58,7 +55,8 @@ export function useWebSocket(opt) { // 情况一:实例销毁 if (options.destroy) { options.onClosed(); - } else { // 情况二:连接失败重连 + } else { + // 情况二:连接失败重连 // 停止心跳检查 stopHeartBeat(); // 重连 @@ -140,10 +138,8 @@ export function useWebSocket(opt) { copyValueToTarget(options, opt); SocketTask.value = uni.connectSocket({ url: options.url, - complete: () => { - }, - success: () => { - }, + complete: () => {}, + success: () => {}, }); initEventListeners(); }; diff --git a/sheep/index.js b/sheep/index.js index 9af8f08..f8b31a6 100644 --- a/sheep/index.js +++ b/sheep/index.js @@ -43,7 +43,6 @@ function ShoproDebug() { // new vconsole.default(); // }); // #endif - // TODO 芋艿:可以打印路由 // 同步前端页面到后端 // console.log(ROUTES) diff --git a/sheep/libs/mplive-manifest-plugin.js b/sheep/libs/mplive-manifest-plugin.js index d1df9bf..a4777c9 100644 --- a/sheep/libs/mplive-manifest-plugin.js +++ b/sheep/libs/mplive-manifest-plugin.js @@ -3,30 +3,30 @@ const fs = require('fs'); const manifestPath = process.env.UNI_INPUT_DIR + '/manifest.json'; let Manifest = fs.readFileSync(manifestPath, { - encoding: 'utf-8' + encoding: 'utf-8', }); function mpliveMainfestPlugin(isOpen) { - if (process.env.UNI_PLATFORM !== 'mp-weixin') return; + if (process.env.UNI_PLATFORM !== 'mp-weixin') return; - const manifestData = JSON.parse(Manifest) + const manifestData = JSON.parse(Manifest); - if (isOpen === '0') { - delete manifestData['mp-weixin'].plugins['live-player-plugin']; - } + if (isOpen === '0') { + delete manifestData['mp-weixin'].plugins['live-player-plugin']; + } - if (isOpen === '1') { - manifestData['mp-weixin'].plugins['live-player-plugin'] = { - "version": "1.3.5", - "provider": "wx2b03c6e691cd7370" - } - } + if (isOpen === '1') { + manifestData['mp-weixin'].plugins['live-player-plugin'] = { + version: '1.3.5', + provider: 'wx2b03c6e691cd7370', + }; + } - Manifest = JSON.stringify(manifestData, null, 2) + Manifest = JSON.stringify(manifestData, null, 2); - fs.writeFileSync(manifestPath, Manifest, { - "flag": "w" - }) + fs.writeFileSync(manifestPath, Manifest, { + flag: 'w', + }); } -export default mpliveMainfestPlugin +export default mpliveMainfestPlugin; diff --git a/sheep/libs/sdk-h5-weixin.js b/sheep/libs/sdk-h5-weixin.js index a71b951..62aea55 100644 --- a/sheep/libs/sdk-h5-weixin.js +++ b/sheep/libs/sdk-h5-weixin.js @@ -39,7 +39,7 @@ export default { nonceStr: data.nonceStr, signature: data.signature, jsApiList: ['chooseWXPay'], // TODO 芋艿:后续可以设置更多权限; - openTagList: data.openTagList + openTagList: data.openTagList, }); } @@ -54,7 +54,7 @@ export default { if (configSuccess) { console.log('微信 JSSDK 初始化成功'); } - }) + }); // 回调 if (callback) { diff --git a/sheep/platform/pay.js b/sheep/platform/pay.js index 447b64a..a751204 100644 --- a/sheep/platform/pay.js +++ b/sheep/platform/pay.js @@ -35,7 +35,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, WechatMiniProgram: { wechat: () => { @@ -49,7 +49,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, App: { wechat: () => { @@ -63,7 +63,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, H5: { wechat: () => { @@ -77,7 +77,7 @@ export default class SheepPay { }, mock: () => { this.mockPay(); - } + }, }, }; return payAction[sheep.$platform.name][this.payment](); @@ -89,7 +89,7 @@ export default class SheepPay { let data = { id: this.id, channelCode: channel, - channelExtras: {} + channelExtras: {}, }; // 特殊逻辑:微信公众号、小程序支付时,必须传入 openid if (['wx_pub', 'wx_lite'].includes(channel)) { @@ -108,8 +108,11 @@ export default class SheepPay { // 失败时 if (res.code !== 0 && res.msg.indexOf('无效的openid') >= 0) { // 特殊逻辑:微信公众号、小程序支付时,必须传入 openid 不正确的情况 - if (res.msg.indexOf('无效的openid') >= 0 // 获取的 openid 不正确时,或者随便输入了个 openid - || res.msg.indexOf('下单账号与支付账号不一致') >= 0) { // https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00 + if ( + res.msg.indexOf('无效的openid') >= 0 || // 获取的 openid 不正确时,或者随便输入了个 openid + res.msg.indexOf('下单账号与支付账号不一致') >= 0 + ) { + // https://developers.weixin.qq.com/community/develop/doc/00008c53c347804beec82aed051c00 this.bindWeixin(); } } @@ -133,8 +136,10 @@ export default class SheepPay { }, fail: (error) => { if (error.errMsg.indexOf('chooseWXPay:没有此SDK或暂不支持此SDK模拟') >= 0) { - sheep.$helper.toast('发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付'); - return + sheep.$helper.toast( + '发起微信支付失败,原因:可能是微信开发者工具不支持,建议使用微信打开网页后支付', + ); + return; } this.payResult('fail'); }, @@ -145,7 +150,9 @@ export default class SheepPay { async wechatWapPay() { const { error, data } = await this.prepay(); if (error === 0) { - const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment}&orderType=${this.orderType}`; + const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${ + this.payment + }&orderType=${this.orderType}`; location.href = `${data.pay_data.h5_url}&redirect_url=${encodeURIComponent(redirect_url)}`; } } @@ -154,7 +161,9 @@ export default class SheepPay { async redirectPay() { let { error, data } = await this.prepay(); if (error === 0) { - const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${this.payment}&orderType=${this.orderType}`; + const redirect_url = `${getRootUrl()}pages/pay/result?id=${this.id}&payment=${ + this.payment + }&orderType=${this.orderType}`; location.href = data.pay_data + encodeURIComponent(redirect_url); } } @@ -266,7 +275,7 @@ export default class SheepPay { sheep.$router.redirect('/pages/pay/result', { id: this.id, orderType: this.orderType, - payState: resultType + payState: resultType, }); } @@ -282,7 +291,6 @@ export default class SheepPay { }, }); } - } export function getPayMethods(channels) { @@ -316,24 +324,28 @@ export function getPayMethods(channels) { title: '模拟支付', value: 'mock', disabled: true, - } + }, ]; - const platform = sheep.$platform.name + const platform = sheep.$platform.name; // 1. 处理【微信支付】 const wechatMethod = payMethods[0]; - if ((platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) - || (platform === 'WechatMiniProgram' && channels.includes('wx_lite')) - || (platform === 'App' && channels.includes('wx_app'))) { + if ( + (platform === 'WechatOfficialAccount' && channels.includes('wx_pub')) || + (platform === 'WechatMiniProgram' && channels.includes('wx_lite')) || + (platform === 'App' && channels.includes('wx_app')) + ) { wechatMethod.disabled = false; } wechatMethod.disabled = false; // TODO 芋艿:临时测试 // 2. 处理【支付宝支付】 const alipayMethod = payMethods[1]; - if ((platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) - || platform === 'WechatMiniProgram' && channels.includes('alipay_wap') - || platform === 'App' && channels.includes('alipay_app')) { + if ( + (platform === 'WechatOfficialAccount' && channels.includes('alipay_wap')) || + (platform === 'WechatMiniProgram' && channels.includes('alipay_wap')) || + (platform === 'App' && channels.includes('alipay_app')) + ) { alipayMethod.disabled = false; } // 3. 处理【余额支付】 @@ -348,4 +360,4 @@ export function getPayMethods(channels) { mockMethod.disabled = false; } return payMethods; -} \ No newline at end of file +} diff --git a/sheep/platform/provider/wechat/miniProgram.js b/sheep/platform/provider/wechat/miniProgram.js index a5b64b0..e31408c 100644 --- a/sheep/platform/provider/wechat/miniProgram.js +++ b/sheep/platform/provider/wechat/miniProgram.js @@ -1,4 +1,4 @@ -import third from '@/sheep/api/migration/third' +import third from '@/sheep/api/migration/third'; import AuthUtil from '@/sheep/api/member/auth'; import SocialApi from '@/sheep/api/member/social'; import UserApi from '@/sheep/api/member/user'; @@ -201,5 +201,5 @@ export default { getInfo, getOpenid, subscribeMessage, - checkUpdate + checkUpdate, }; diff --git a/sheep/platform/provider/wechat/officialAccount.js b/sheep/platform/provider/wechat/officialAccount.js index 2d3e5dd..e555cba 100644 --- a/sheep/platform/provider/wechat/officialAccount.js +++ b/sheep/platform/provider/wechat/officialAccount.js @@ -19,7 +19,7 @@ async function login(code = '', state = '') { uni.setStorageSync('returnUrl', location.href); window.location = loginUrl; } - // 情况二:有 code 时,使用 code 去自动登录 + // 情况二:有 code 时,使用 code 去自动登录 } else { // 解密 code 发起登陆 const loginResult = await AuthUtil.socialLogin(socialType, code, state); @@ -60,8 +60,7 @@ const unbind = async (openid) => { // 获取公众号登陆地址 async function getLoginUrl(event = 'login') { - const page = getRootUrl() + 'pages/index/login' - + '?event=' + event; // event 目的,区分是 login 还是 bind + const page = getRootUrl() + 'pages/index/login' + '?event=' + event; // event 目的,区分是 login 还是 bind const { code, data } = await AuthUtil.socialAuthRedirect(socialType, page); if (code !== 0) { return undefined; diff --git a/sheep/platform/provider/wechat/openPlatform.js b/sheep/platform/provider/wechat/openPlatform.js index a80f0d7..e02e127 100644 --- a/sheep/platform/provider/wechat/openPlatform.js +++ b/sheep/platform/provider/wechat/openPlatform.js @@ -15,7 +15,7 @@ const login = () => { provider: 'weixin', onlyAuthorize: true, }); - debugger + debugger; if (loginRes.errMsg == 'login:ok') { // TODO third.wechat.login 函数未实现 const res = await third.wechat.login({ @@ -29,7 +29,7 @@ const login = () => { }); if (res.error === 0) { - $share.bindBrokerageUser() + $share.bindBrokerageUser(); resolve(true); } } else { @@ -60,5 +60,5 @@ async function getInfo() { export default { load, login, - getInfo + getInfo, }; diff --git a/sheep/platform/share.js b/sheep/platform/share.js index 9ab2a3a..d7ae9c4 100644 --- a/sheep/platform/share.js +++ b/sheep/platform/share.js @@ -178,7 +178,7 @@ const decryptSpm = (spm) => { }; // 绑定推广员 -const bindBrokerageUser = async (val= undefined) => { +const bindBrokerageUser = async (val = undefined) => { try { const shareId = val || uni.getStorageSync('shareId'); if (!shareId) { @@ -186,8 +186,7 @@ const bindBrokerageUser = async (val= undefined) => { } await BrokerageApi.bindBrokerageUser({ bindUserId: shareId }); uni.removeStorageSync('shareId'); - } catch { - } + } catch {} }; // 更新公众号分享sdk diff --git a/sheep/request/index.js b/sheep/request/index.js index 99c38a4..bc42a02 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -7,231 +7,231 @@ import Request from 'luch-request'; import { baseUrl, apiPath } from '@/sheep/config'; import $store from '@/sheep/store'; import $platform from '@/sheep/platform'; -import { - showAuthModal -} from '@/sheep/hooks/useModal'; +import { showAuthModal } from '@/sheep/hooks/useModal'; import AuthUtil from '@/sheep/api/member/auth'; const options = { - // 显示操作成功消息 默认不显示 - showSuccess: false, - // 成功提醒 默认使用后端返回值 - successMsg: '', - // 显示失败消息 默认显示 - showError: true, - // 失败提醒 默认使用后端返回信息 - errorMsg: '', - // 显示请求时loading模态框 默认显示 - showLoading: true, - // loading提醒文字 - loadingMsg: '加载中', - // 需要授权才能请求 默认放开 - auth: false, - // ... + // 显示操作成功消息 默认不显示 + showSuccess: false, + // 成功提醒 默认使用后端返回值 + successMsg: '', + // 显示失败消息 默认显示 + showError: true, + // 失败提醒 默认使用后端返回信息 + errorMsg: '', + // 显示请求时loading模态框 默认显示 + showLoading: true, + // loading提醒文字 + loadingMsg: '加载中', + // 需要授权才能请求 默认放开 + auth: false, + // ... }; // Loading全局实例 let LoadingInstance = { - target: null, - count: 0, + target: null, + count: 0, }; /** * 关闭loading */ function closeLoading() { - if (LoadingInstance.count > 0) LoadingInstance.count--; - if (LoadingInstance.count === 0) uni.hideLoading(); + if (LoadingInstance.count > 0) LoadingInstance.count--; + if (LoadingInstance.count === 0) uni.hideLoading(); } /** * @description 请求基础配置 可直接使用访问自定义请求 */ const http = new Request({ - baseURL: baseUrl + apiPath, - timeout: 8000, - method: 'GET', - header: { - Accept: 'text/json', - 'Content-Type': 'application/json;charset=UTF-8', - platform: $platform.name, - }, - // #ifdef APP-PLUS - sslVerify: false, - // #endif - // #ifdef H5 - // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) - withCredentials: false, - // #endif - custom: options, + baseURL: baseUrl + apiPath, + timeout: 8000, + method: 'GET', + header: { + Accept: 'text/json', + 'Content-Type': 'application/json;charset=UTF-8', + platform: $platform.name, + }, + // #ifdef APP-PLUS + sslVerify: false, + // #endif + // #ifdef H5 + // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) + withCredentials: false, + // #endif + custom: options, }); /** * @description 请求拦截器 */ http.interceptors.request.use( - (config) => { + (config) => { // 自定义处理【auth 授权】:必须登录的接口,则跳出 AuthModal 登录弹窗 - if (config.custom.auth && !$store('user').isLogin) { - showAuthModal(); - return Promise.reject(); - } + if (config.custom.auth && !$store('user').isLogin) { + showAuthModal(); + return Promise.reject(); + } // 自定义处理【loading 加载中】:如果需要显示 loading,则显示 loading - if (config.custom.showLoading) { - LoadingInstance.count++; - LoadingInstance.count === 1 && - uni.showLoading({ - title: config.custom.loadingMsg, - mask: true, - fail: () => { - uni.hideLoading(); - }, - }); - } + if (config.custom.showLoading) { + LoadingInstance.count++; + LoadingInstance.count === 1 && + uni.showLoading({ + title: config.custom.loadingMsg, + mask: true, + fail: () => { + uni.hideLoading(); + }, + }); + } // 增加 token 令牌、terminal 终端、tenant 租户的请求头 - const token = getAccessToken(); - if (token) { + const token = getAccessToken(); + if (token) { config.header['Authorization'] = token; } - // TODO 芋艿:特殊处理 - config.header['Accept'] = '*/*' + // TODO 芋艿:特殊处理 + config.header['Accept'] = '*/*'; config.header['tenant-id'] = '1'; config.header['terminal'] = '20'; // config.header['Authorization'] = 'Bearer test247'; - return config; - }, - (error) => { - return Promise.reject(error); - }, + return config; + }, + (error) => { + return Promise.reject(error); + }, ); /** * @description 响应拦截器 */ http.interceptors.response.use( - (response) => { - // 约定:如果是 /auth/ 下的 URL 地址,并且返回了 accessToken 说明是登录相关的接口,则自动设置登陆令牌 - if (response.config.url.indexOf('/member/auth/') >= 0 && response.data?.data?.accessToken) { - $store('user').setToken(response.data.data.accessToken, response.data.data.refreshToken); - } + (response) => { + // 约定:如果是 /auth/ 下的 URL 地址,并且返回了 accessToken 说明是登录相关的接口,则自动设置登陆令牌 + if (response.config.url.indexOf('/member/auth/') >= 0 && response.data?.data?.accessToken) { + $store('user').setToken(response.data.data.accessToken, response.data.data.refreshToken); + } // 自定处理【loading 加载中】:如果需要显示 loading,则关闭 loading - response.config.custom.showLoading && closeLoading(); + response.config.custom.showLoading && closeLoading(); // 自定义处理【error 错误提示】:如果需要显示错误提示,则显示错误提示 - if (response.data.code !== 0) { + if (response.data.code !== 0) { // 特殊:如果 401 错误码,则跳转到登录页 or 刷新令牌 if (response.data.code === 401) { return refreshToken(response.config); } // 错误提示 - if (response.config.custom.showError) { - uni.showToast({ - title: response.data.msg || '服务器开小差啦,请稍后再试~', - icon: 'none', - mask: true, - }); + if (response.config.custom.showError) { + uni.showToast({ + title: response.data.msg || '服务器开小差啦,请稍后再试~', + icon: 'none', + mask: true, + }); } - } + } - // 自定义处理【showSuccess 成功提示】:如果需要显示成功提示,则显示成功提示 - if (response.config.custom.showSuccess - && response.config.custom.successMsg !== '' - && response.data.code === 0) { + // 自定义处理【showSuccess 成功提示】:如果需要显示成功提示,则显示成功提示 + if ( + response.config.custom.showSuccess && + response.config.custom.successMsg !== '' && + response.data.code === 0 + ) { uni.showToast({ - title: response.config.custom.successMsg, - icon: 'none', - }); - } + title: response.config.custom.successMsg, + icon: 'none', + }); + } // 返回结果:包括 code + data + msg - return Promise.resolve(response.data); - }, - (error) => { - const userStore = $store('user'); - const isLogin = userStore.isLogin; - let errorMessage = '网络请求出错'; - if (error !== undefined) { - switch (error.statusCode) { - case 400: - errorMessage = '请求错误'; - break; - case 401: + return Promise.resolve(response.data); + }, + (error) => { + const userStore = $store('user'); + const isLogin = userStore.isLogin; + let errorMessage = '网络请求出错'; + if (error !== undefined) { + switch (error.statusCode) { + case 400: + errorMessage = '请求错误'; + break; + case 401: errorMessage = isLogin ? '您的登陆已过期' : '请先登录'; // 正常情况下,后端不会返回 401 错误,所以这里不处理 handleAuthorized break; - case 403: - errorMessage = '拒绝访问'; - break; - case 404: - errorMessage = '请求出错'; - break; - case 408: - errorMessage = '请求超时'; - break; - case 429: - errorMessage = '请求频繁, 请稍后再访问'; - break; - case 500: - errorMessage = '服务器开小差啦,请稍后再试~'; - break; - case 501: - errorMessage = '服务未实现'; - break; - case 502: - errorMessage = '网络错误'; - break; - case 503: - errorMessage = '服务不可用'; - break; - case 504: - errorMessage = '网络超时'; - break; - case 505: - errorMessage = 'HTTP 版本不受支持'; - break; - } - if (error.errMsg.includes('timeout')) errorMessage = '请求超时'; - // #ifdef H5 - if (error.errMsg.includes('Network')) - errorMessage = window.navigator.onLine ? '服务器异常' : '请检查您的网络连接'; - // #endif - } + case 403: + errorMessage = '拒绝访问'; + break; + case 404: + errorMessage = '请求出错'; + break; + case 408: + errorMessage = '请求超时'; + break; + case 429: + errorMessage = '请求频繁, 请稍后再访问'; + break; + case 500: + errorMessage = '服务器开小差啦,请稍后再试~'; + break; + case 501: + errorMessage = '服务未实现'; + break; + case 502: + errorMessage = '网络错误'; + break; + case 503: + errorMessage = '服务不可用'; + break; + case 504: + errorMessage = '网络超时'; + break; + case 505: + errorMessage = 'HTTP 版本不受支持'; + break; + } + if (error.errMsg.includes('timeout')) errorMessage = '请求超时'; + // #ifdef H5 + if (error.errMsg.includes('Network')) + errorMessage = window.navigator.onLine ? '服务器异常' : '请检查您的网络连接'; + // #endif + } - if (error && error.config) { - if (error.config.custom.showError === false) { - uni.showToast({ - title: error.data?.msg || errorMessage, - icon: 'none', - mask: true, - }); - } - error.config.custom.showLoading && closeLoading(); - } + if (error && error.config) { + if (error.config.custom.showError === false) { + uni.showToast({ + title: error.data?.msg || errorMessage, + icon: 'none', + mask: true, + }); + } + error.config.custom.showLoading && closeLoading(); + } - return false; - }, + return false; + }, ); // Axios 无感知刷新令牌,参考 https://www.dashingdog.cn/article/11 与 https://segmentfault.com/a/1190000020210980 实现 -let requestList = [] // 请求队列 -let isRefreshToken = false // 是否正在刷新中 +let requestList = []; // 请求队列 +let isRefreshToken = false; // 是否正在刷新中 const refreshToken = async (config) => { // 如果当前已经是 refresh-token 的 URL 地址,并且还是 401 错误,说明是刷新令牌失败了,直接返回 Promise.reject(error) if (config.url.indexOf('/member/auth/refresh-token') >= 0) { - return Promise.reject('error') + return Promise.reject('error'); } // 如果未认证,并且未进行刷新令牌,说明可能是访问令牌过期了 if (!isRefreshToken) { - isRefreshToken = true + isRefreshToken = true; // 1. 如果获取不到刷新令牌,则只能执行登出操作 - const refreshToken = getRefreshToken() + const refreshToken = getRefreshToken(); if (!refreshToken) { - return handleAuthorized() + return handleAuthorized(); } // 2. 进行刷新访问令牌 try { @@ -242,34 +242,34 @@ const refreshToken = async (config) => { throw new Error('刷新令牌失败'); } // 2.1 刷新成功,则回放队列的请求 + 当前请求 - config.header.Authorization = 'Bearer ' + getAccessToken() + config.header.Authorization = 'Bearer ' + getAccessToken(); requestList.forEach((cb) => { - cb() - }) - requestList = [] - return request(config) + cb(); + }); + requestList = []; + return request(config); } catch (e) { // 为什么需要 catch 异常呢?刷新失败时,请求因为 Promise.reject 触发异常。 // 2.2 刷新失败,只回放队列的请求 requestList.forEach((cb) => { - cb() - }) + cb(); + }); // 提示是否要登出。即不回放当前请求!不然会形成递归 - return handleAuthorized() + return handleAuthorized(); } finally { - requestList = [] - isRefreshToken = false + requestList = []; + isRefreshToken = false; } } else { // 添加到队列,等待刷新获取到新的令牌 return new Promise((resolve) => { requestList.push(() => { - config.header.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token 请根据实际情况自行修改 - resolve(request(config)) - }) - }) + config.header.Authorization = 'Bearer ' + getAccessToken(); // 让每个请求携带自定义token 请根据实际情况自行修改 + resolve(request(config)); + }); + }); } -} +}; /** * 处理 401 未登录的错误 @@ -281,22 +281,22 @@ const handleAuthorized = () => { // 登录超时 return Promise.reject({ code: 401, - msg: userStore.isLogin ? '您的登陆已过期' : '请先登录' - }) -} + msg: userStore.isLogin ? '您的登陆已过期' : '请先登录', + }); +}; /** 获得访问令牌 */ const getAccessToken = () => { return uni.getStorageSync('token'); -} +}; /** 获得刷新令牌 */ const getRefreshToken = () => { return uni.getStorageSync('refresh-token'); -} - -const request = (config) => { - return http.middleware(config); }; -export default request; \ No newline at end of file +const request = (config) => { + return http.middleware(config); +}; + +export default request; diff --git a/sheep/store/app.js b/sheep/store/app.js index 55d0997..6b6d2c8 100644 --- a/sheep/store/app.js +++ b/sheep/store/app.js @@ -43,7 +43,7 @@ const app = defineStore({ }, }, shareInfo: {}, // 全局分享信息 - has_wechat_trade_managed: 0 // 小程序发货信息管理 0 没有 || 1 有 + has_wechat_trade_managed: 0, // 小程序发货信息管理 0 没有 || 1 有 }), actions: { // 获取Shopro应用配置和模板 @@ -55,7 +55,7 @@ const app = defineStore({ } // 加载装修配置 - await adaptTemplate(this.template, templateId) + await adaptTemplate(this.template, templateId); // TODO 芋艿:未来支持管理后台可配;对应 https://api.shopro.sheepjs.com/shop/api/init if (true) { @@ -71,15 +71,15 @@ const app = defineStore({ }; this.platform = { share: { - methods: ["poster", "link"], - linkAddress: "http://127.0.0.1:3000", // TODO 芋艿:可以考虑改到 .env 那 + methods: ['poster', 'link'], + linkAddress: 'http://127.0.0.1:3000', // TODO 芋艿:可以考虑改到 .env 那 posterInfo: { - "user_bg": "/static/img/shop/config/user-poster-bg.png", - "goods_bg": "/static/img/shop/config/goods-poster-bg.png", - "groupon_bg": "/static/img/shop/config/groupon-poster-bg.png" - } + user_bg: '/static/img/shop/config/user-poster-bg.png', + goods_bg: '/static/img/shop/config/goods-poster-bg.png', + groupon_bg: '/static/img/shop/config/groupon-poster-bg.png', + }, }, - bind_mobile: 0 + bind_mobile: 0, }; this.has_wechat_trade_managed = 0; @@ -111,24 +111,24 @@ const app = defineStore({ // todo: @owen 先做数据适配,后期重构 const adaptTemplate = async (appTemplate, templateId) => { const { data: diyTemplate } = templateId - // 查询指定模板,一般是预览时使用 - ? await DiyApi.getDiyTemplate(templateId) - : await DiyApi.getUsedDiyTemplate(); + ? // 查询指定模板,一般是预览时使用 + await DiyApi.getDiyTemplate(templateId) + : await DiyApi.getUsedDiyTemplate(); // 模板不存在 if (!diyTemplate) { $router.error('TemplateError'); - return + return; } const tabBar = diyTemplate?.property?.tabBar; if (tabBar) { - appTemplate.basic.tabbar = tabBar + appTemplate.basic.tabbar = tabBar; if (tabBar?.theme) { appTemplate.basic.theme = tabBar?.theme; } } appTemplate.home = diyTemplate?.home; appTemplate.user = diyTemplate?.user; -} +}; export default app; diff --git a/sheep/store/cart.js b/sheep/store/cart.js index 7ea7019..ade0fc5 100644 --- a/sheep/store/cart.js +++ b/sheep/store/cart.js @@ -78,7 +78,7 @@ const cart = defineStore({ async selectAll(flag) { const { code } = await CartApi.updateCartSelected({ ids: this.list.map((item) => item.id), - selected: flag + selected: flag, }); if (code === 0) { await this.getList(); diff --git a/sheep/store/modal.js b/sheep/store/modal.js index bde9e0a..5d3b9f0 100644 --- a/sheep/store/modal.js +++ b/sheep/store/modal.js @@ -13,7 +13,7 @@ const modal = defineStore({ changeMobile: 0, resetPassword: 0, changePassword: 0, - } + }, }), persist: { enabled: true, diff --git a/sheep/store/user.js b/sheep/store/user.js index a4c1a7f..a55a318 100644 --- a/sheep/store/user.js +++ b/sheep/store/user.js @@ -68,12 +68,12 @@ const user = defineStore({ // 获取订单、优惠券等其他资产信息 getNumData() { - OrderApi.getOrderCount().then(res => { + OrderApi.getOrderCount().then((res) => { if (res.code === 0) { this.numData.orderCount = res.data; } }); - CouponApi.getUnusedCouponCount().then(res => { + CouponApi.getUnusedCouponCount().then((res) => { if (res.code === 0) { this.numData.unusedCouponCount = res.data; } @@ -143,20 +143,22 @@ const user = defineStore({ } // 绑定推广员 - $share.bindBrokerageUser() + $share.bindBrokerageUser(); }, // 登出系统 async logout() { this.resetUserData(); return !this.isLogin; - } + }, }, persist: { enabled: true, - strategies: [{ - key: 'user-store', - }] + strategies: [ + { + key: 'user-store', + }, + ], }, }); diff --git a/sheep/ui/su-fixed/su-fixed.vue b/sheep/ui/su-fixed/su-fixed.vue index e2a9808..c010bf4 100644 --- a/sheep/ui/su-fixed/su-fixed.vue +++ b/sheep/ui/su-fixed/su-fixed.vue @@ -150,7 +150,8 @@ }); const computedQuery = () => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(vm) .select(`#fixed-${uuid}`) .boundingClientRect((data) => { diff --git a/sheep/ui/su-navbar/su-navbar.vue b/sheep/ui/su-navbar/su-navbar.vue index af96f24..fb34cf1 100644 --- a/sheep/ui/su-navbar/su-navbar.vue +++ b/sheep/ui/su-navbar/su-navbar.vue @@ -212,8 +212,8 @@ }); const searchModel = computed(() => { - return props.defaultSearch - }) + return props.defaultSearch; + }); const themeBgColor = computed(() => { if (props.dark) { diff --git a/sheep/ui/su-notice-bar/su-notice-bar.vue b/sheep/ui/su-notice-bar/su-notice-bar.vue index fc5075a..96654a8 100644 --- a/sheep/ui/su-notice-bar/su-notice-bar.vue +++ b/sheep/ui/su-notice-bar/su-notice-bar.vue @@ -214,7 +214,8 @@ boxWidth = 0, textWidth = 0; let textQuery = new Promise((resolve, reject) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() // #ifndef MP-ALIPAY .in(this) // #endif @@ -226,7 +227,8 @@ }); }); let boxQuery = new Promise((resolve, reject) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() // #ifndef MP-ALIPAY .in(this) // #endif diff --git a/sheep/ui/su-progress/su-progress.vue b/sheep/ui/su-progress/su-progress.vue index 4612705..8227670 100644 --- a/sheep/ui/su-progress/su-progress.vue +++ b/sheep/ui/su-progress/su-progress.vue @@ -170,7 +170,7 @@ margin-left: 10rpx; font-size: 16rpx; width: 100rpx; - color: #FFB9B9; + color: #ffb9b9; } .percentage { diff --git a/sheep/ui/su-sticky/su-sticky.vue b/sheep/ui/su-sticky/su-sticky.vue index a8831a2..c937577 100644 --- a/sheep/ui/su-sticky/su-sticky.vue +++ b/sheep/ui/su-sticky/su-sticky.vue @@ -130,7 +130,8 @@ }, $uGetRect(selector, all) { return new Promise((resolve) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(this) [all ? 'selectAll' : 'select'](selector) .boundingClientRect((rect) => { @@ -218,7 +219,8 @@ // 方法内进行判断,避免在其他平台生成无用代码 // #ifdef APP-VUE || MP-WEIXIN return new Promise((resolve) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(this) .select('.u-sticky') .fields({ diff --git a/sheep/ui/su-subline/su-subline.vue b/sheep/ui/su-subline/su-subline.vue index c11d176..18d4c34 100644 --- a/sheep/ui/su-subline/su-subline.vue +++ b/sheep/ui/su-subline/su-subline.vue @@ -1,5 +1,5 @@ @@ -31,13 +31,13 @@ // 高度 height: { type: [Number, String], - default: 'auto' + default: 'auto', }, // 左右边距:none - 无边距,horizontal - 左右留边 paddingType: { type: String, - default: 'none' - } + default: 'none', + }, }); const elStyle = computed(() => { @@ -45,18 +45,18 @@ 'border-top-width': `${props.lineWidth}px`, 'border-top-color': props.lineColor, 'border-top-style': props.borderType, - margin: props.paddingType === 'none' ? '0' : '0px 16px' + margin: props.paddingType === 'none' ? '0' : '0px 16px', }; }); diff --git a/sheep/ui/su-swiper/su-swiper.vue b/sheep/ui/su-swiper/su-swiper.vue index cff1c4b..ea229cc 100644 --- a/sheep/ui/su-swiper/su-swiper.vue +++ b/sheep/ui/su-swiper/su-swiper.vue @@ -196,11 +196,11 @@ const onPreview = () => { if (!props.isPreview) return; let previewImage = clone(props.list); - previewImage.forEach((item,index) => { - if(item.type === 'video') { + previewImage.forEach((item, index) => { + if (item.type === 'video') { previewImage.splice(index, 1); } - }) + }); uni.previewImage({ urls: previewImage.length < 1 diff --git a/sheep/ui/su-tab-item/su-tab-item.vue b/sheep/ui/su-tab-item/su-tab-item.vue index 615df2f..bcbbed7 100644 --- a/sheep/ui/su-tab-item/su-tab-item.vue +++ b/sheep/ui/su-tab-item/su-tab-item.vue @@ -89,7 +89,8 @@ const titleStyle = computed(() => uiTabProvide?.props?.titleStyle); const computedQuery = () => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(vm) .select('#tab-' + props.index) .boundingClientRect((data) => { diff --git a/sheep/ui/su-tab/su-tab.vue b/sheep/ui/su-tab/su-tab.vue index 17a7983..a81d868 100644 --- a/sheep/ui/su-tab/su-tab.vue +++ b/sheep/ui/su-tab/su-tab.vue @@ -190,7 +190,8 @@ }); const computedQuery = () => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(vm) .select('#tab-' + vm.uid) .boundingClientRect((data) => { diff --git a/sheep/ui/su-tabbar/su-tabbar.vue b/sheep/ui/su-tabbar/su-tabbar.vue index 92e0352..4e13166 100644 --- a/sheep/ui/su-tabbar/su-tabbar.vue +++ b/sheep/ui/su-tabbar/su-tabbar.vue @@ -156,7 +156,8 @@ }, getRect(selector, all) { return new Promise((resolve) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(this) [all ? 'selectAll' : 'select'](selector) .boundingClientRect((rect) => { diff --git a/sheep/ui/su-tabs/su-tabs.vue b/sheep/ui/su-tabs/su-tabs.vue index 05d7dcb..5081e83 100644 --- a/sheep/ui/su-tabs/su-tabs.vue +++ b/sheep/ui/su-tabs/su-tabs.vue @@ -221,7 +221,8 @@ methods: { $uGetRect(selector, all) { return new Promise((resolve) => { - uni.createSelectorQuery() + uni + .createSelectorQuery() .in(this) [all ? 'selectAll' : 'select'](selector) .boundingClientRect((rect) => { diff --git a/sheep/ui/su-video/su-video.vue b/sheep/ui/su-video/su-video.vue index a75a79c..a1aac92 100644 --- a/sheep/ui/su-video/su-video.vue +++ b/sheep/ui/su-video/su-video.vue @@ -94,7 +94,7 @@ autoplay: { type: Boolean, default: false, - } + }, }); // 事件 diff --git a/sheep/url/index.js b/sheep/url/index.js index d216f83..4367403 100644 --- a/sheep/url/index.js +++ b/sheep/url/index.js @@ -71,7 +71,8 @@ function append_thumbnail_params(url, params) { if (!gravity && gravity != 'center') { // 指定了裁剪区域 mode = 'mfit'; - crop_str = '/crop,g_' + gravityFormatMap('aliyun', gravity) + ',w_' + width + ',h_' + height; + crop_str = + '/crop,g_' + gravityFormatMap('aliyun', gravity) + ',w_' + width + ',h_' + height; } // 质量压缩 diff --git a/sheep/util/const.js b/sheep/util/const.js index e5eba0c..ca65656 100644 --- a/sheep/util/const.js +++ b/sheep/util/const.js @@ -1,68 +1,67 @@ // ========== MALL - 营销模块 ========== -import dayjs from "dayjs"; +import dayjs from 'dayjs'; /** * 优惠类型枚举 */ export const PromotionDiscountTypeEnum = { - PRICE: { - type: 1, - name: '满减' - }, - PERCENT: { - type: 2, - name: '折扣' - } -} + PRICE: { + type: 1, + name: '满减', + }, + PERCENT: { + type: 2, + name: '折扣', + }, +}; /** * 优惠劵模板的有限期类型的枚举 */ export const CouponTemplateValidityTypeEnum = { - DATE: { - type: 1, - name: '固定日期可用' - }, - TERM: { - type: 2, - name: '领取之后可用' - } -} + DATE: { + type: 1, + name: '固定日期可用', + }, + TERM: { + type: 2, + name: '领取之后可用', + }, +}; /** * 营销的商品范围枚举 */ export const PromotionProductScopeEnum = { - ALL: { - scope: 1, - name: '通用劵' - }, - SPU: { - scope: 2, - name: '商品劵' - }, - CATEGORY: { - scope: 3, - name: '品类劵' - } -} - + ALL: { + scope: 1, + name: '通用劵', + }, + SPU: { + scope: 2, + name: '商品劵', + }, + CATEGORY: { + scope: 3, + name: '品类劵', + }, +}; // 时间段的状态枚举 export const TimeStatusEnum = { - WAIT_START: '即将开始', - STARTED: '进行中', - END: '已结束', -} + WAIT_START: '即将开始', + STARTED: '进行中', + END: '已结束', +}; export const getTimeStatusEnum = (startTime, endTime) => { - const now = dayjs(); - if (now.isBefore(startTime)) { - return TimeStatusEnum.WAIT_START; - } else if (now.isAfter(endTime)) { - return TimeStatusEnum.END; - } else { - return TimeStatusEnum.STARTED; - } -} + const now = dayjs(); + if (now.isBefore(startTime)) { + return TimeStatusEnum.WAIT_START; + } else if (now.isAfter(endTime)) { + return TimeStatusEnum.END; + } else { + return TimeStatusEnum.STARTED; + } +}; diff --git a/sheep/util/index.js b/sheep/util/index.js index e2d8ff7..fb0113f 100644 --- a/sheep/util/index.js +++ b/sheep/util/index.js @@ -1,4 +1,4 @@ -import dayjs from "dayjs"; +import dayjs from 'dayjs'; /** * 将一个整数转换为分数保留两位小数 @@ -6,10 +6,10 @@ import dayjs from "dayjs"; * @return {number} 分数 */ export const formatToFraction = (num) => { - if (typeof num === 'undefined') return 0 - const parsedNumber = typeof num === 'string' ? parseFloat(num) : num - return parseFloat((parsedNumber / 100).toFixed(2)) -} + if (typeof num === 'undefined') return 0; + const parsedNumber = typeof num === 'string' ? parseFloat(num) : num; + return parseFloat((parsedNumber / 100).toFixed(2)); +}; /** * 将一个数转换为 1.00 这样 @@ -19,26 +19,26 @@ export const formatToFraction = (num) => { * @return {string} 分数 */ export const floatToFixed2 = (num) => { - let str = '0.00' + let str = '0.00'; if (typeof num === 'undefined') { - return str + return str; } - const f = formatToFraction(num) - const decimalPart = f.toString().split('.')[1] - const len = decimalPart ? decimalPart.length : 0 + const f = formatToFraction(num); + const decimalPart = f.toString().split('.')[1]; + const len = decimalPart ? decimalPart.length : 0; switch (len) { case 0: - str = f.toString() + '.00' - break + str = f.toString() + '.00'; + break; case 1: - str = f.toString() + '.0' - break + str = f.toString() + '.0'; + break; case 2: - str = f.toString() - break + str = f.toString(); + break; } - return str -} + return str; +}; /** * 将一个分数转换为整数 @@ -47,11 +47,11 @@ export const floatToFixed2 = (num) => { * @return {number} 整数 */ export const convertToInteger = (num) => { - if (typeof num === 'undefined') return 0 - const parsedNumber = typeof num === 'string' ? parseFloat(num) : num + if (typeof num === 'undefined') return 0; + const parsedNumber = typeof num === 'string' ? parseFloat(num) : num; // TODO 分转元后还有小数则四舍五入 - return Math.round(parsedNumber * 100) -} + return Math.round(parsedNumber * 100); +}; /** * 时间日期转换 @@ -64,16 +64,16 @@ export const convertToInteger = (num) => { * @description format 季度 + 星期 + 几周:"YYYY-mm-dd HH:MM:SS WWW QQQQ ZZZ" * @returns {string} 返回拼接后的时间字符串 */ -export function formatDate(date, format= 'YYYY-MM-DD HH:mm:ss') { +export function formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') { // 日期不存在,则返回空 if (!date) { - return '' + return ''; } // 日期存在,则进行格式化 if (format === undefined) { - format = 'YYYY-MM-DD HH:mm:ss' + format = 'YYYY-MM-DD HH:mm:ss'; } - return dayjs(date).format(format) + return dayjs(date).format(format); } /** @@ -85,16 +85,22 @@ export function formatDate(date, format= 'YYYY-MM-DD HH:mm:ss') { * @param {*} children 孩子节点字段 默认 'children' * @param {*} rootId 根Id 默认 0 */ -export function handleTree(data, id = 'id', parentId = 'parentId', children = 'children', rootId = 0) { +export function handleTree( + data, + id = 'id', + parentId = 'parentId', + children = 'children', + rootId = 0, +) { // 对源数据深度克隆 - const cloneData = JSON.parse(JSON.stringify(data)) + const cloneData = JSON.parse(JSON.stringify(data)); // 循环所有项 - const treeData = cloneData.filter(father => { - let branchArr = cloneData.filter(child => { + const treeData = cloneData.filter((father) => { + let branchArr = cloneData.filter((child) => { //返回每一项的子级数组 - return father[id] === child[parentId] + return father[id] === child[parentId]; }); - branchArr.length > 0 ? father.children = branchArr : ''; + branchArr.length > 0 ? (father.children = branchArr) : ''; //返回第一层 return father[parentId] === rootId; }); @@ -120,14 +126,14 @@ export function resetPagination(pagination) { * @param source 源对象 */ export const copyValueToTarget = (target, source) => { - const newObj = Object.assign({}, target, source) + const newObj = Object.assign({}, target, source); // 删除多余属性 Object.keys(newObj).forEach((key) => { // 如果不是target中的属性则删除 if (Object.keys(target).indexOf(key) === -1) { - delete newObj[key] + delete newObj[key]; } - }) + }); // 更新目标对象值 - Object.assign(target, newObj) -} + Object.assign(target, newObj); +}; diff --git a/uni_modules/mp-html/components/mp-html/mp-html.vue b/uni_modules/mp-html/components/mp-html/mp-html.vue index a9b5dec..08c9c08 100644 --- a/uni_modules/mp-html/components/mp-html/mp-html.vue +++ b/uni_modules/mp-html/components/mp-html/mp-html.vue @@ -321,7 +321,6 @@ export default { } // #endif this.$set(this, 'nodes', append ? (this.nodes || []).concat(nodes) : nodes) - // #ifndef APP-PLUS-NVUE this._videos = [] this.$nextTick(() => {