From a2c305591fcc4a8b32d99f2ea342ced31beb9510 Mon Sep 17 00:00:00 2001 From: itgaojian163 Date: Tue, 8 Apr 2025 14:36:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=8D=B7=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E5=8A=A8=E7=94=BB,=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 101 +++++++++--------- components/ad-popup/ad-popup.js | 63 ++++++++++- components/ad-popup/ad-popup.wxml | 2 +- net/api/payApi.js | 5 + net/http.js | 1 + .../createProjectInfo/createProjectInfo.js | 8 ++ .../createProjectInfo/createProjectInfo.wxml | 4 +- .../createProjectInfo/createProjectInfo.wxss | 5 + pages/copyright/payment/payment.js | 26 ++++- pages/index/index.js | 12 +-- pages/index/index.wxml | 6 +- pages/index/index.wxss | 8 +- .../mineAccount/mineCoupons/mineCoupons.wxss | 6 +- pages/mine/mineIndex/mine.js | 2 +- pages/mine/mineIndex/mine.wxml | 4 +- utils/util.js | 13 ++- 16 files changed, 184 insertions(+), 82 deletions(-) diff --git a/app.json b/app.json index a70a26f..8afb67c 100644 --- a/app.json +++ b/app.json @@ -1,53 +1,52 @@ { - "pages": [ - "pages/login/login", - "pages/index/index", - "pages/treaty/privacy/privacy", - "pages/treaty/service/service", - "pages/mine/mineIndex/mine", - "pages/copyright/createProjectInfo/createProjectInfo", - "pages/copyright/createBuy/createBuy", - "pages/copyright/payment/payment", - "pages/mine/mineAccount/mineCoupons/mineCoupons", - "pages/copyright/publicPay/publicPay", - "pages/copyright/common/payState", - "pages/readTxt/readTxt", - "pages/mine/mineAccount/mineInfo/mineInfo", - "pages/mine/mineAccount/mineOrder/mineOrder", - "pages/mine/mineAccount/mineContact/mineContact", - "pages/treaty/rule/rule" - ], - "window": { - "navigationBarTextStyle": "black", - "navigationBarTitleText": "AI喵著", - "navigationBarBackgroundColor": "#ffffff" - }, - "tabBar": { - "color": "#515151", - "selectedColor": "#FE9944", - "list": [ - { - "pagePath": "pages/index/index", - "text": "首页", - "iconPath": "/static/images/ic_home_normal.png", - "selectedIconPath": "/static/images/ic_home_select.png" - }, - { - "pagePath": "pages/mine/mineIndex/mine", - "text": "我的", - "iconPath": "/static/images/ic_mine_normal.png", - "selectedIconPath": "/static/images/ic_mine_select.png" - } - ] - }, - "style": "v2", - "componentFramework": "glass-easel", - "sitemapLocation": "sitemap.json", - "lazyCodeLoading": "requiredComponents", - "usingComponents": { - "ad-popup": "./components/ad-popup/ad-popup" - }, - "useExtendedLib": { - "weui": true - } + "pages": [ + "pages/login/login", + "pages/index/index", + "pages/treaty/privacy/privacy", + "pages/treaty/service/service", + "pages/mine/mineIndex/mine", + "pages/copyright/createProjectInfo/createProjectInfo", + "pages/copyright/createBuy/createBuy", + "pages/copyright/payment/payment", + "pages/mine/mineAccount/mineCoupons/mineCoupons", + "pages/copyright/publicPay/publicPay", + "pages/copyright/common/payState", + "pages/readTxt/readTxt", + "pages/mine/mineAccount/mineInfo/mineInfo", + "pages/mine/mineAccount/mineOrder/mineOrder", + "pages/mine/mineAccount/mineContact/mineContact", + "pages/treaty/rule/rule" + ], + "window": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "AI喵著", + "navigationBarBackgroundColor": "#ffffff" + }, + "tabBar": { + "color": "#515151", + "selectedColor": "#FE9944", + "list": [{ + "pagePath": "pages/index/index", + "text": "首页", + "iconPath": "/static/images/ic_home_normal.png", + "selectedIconPath": "/static/images/ic_home_select.png" + }, + { + "pagePath": "pages/mine/mineIndex/mine", + "text": "我的", + "iconPath": "/static/images/ic_mine_normal.png", + "selectedIconPath": "/static/images/ic_mine_select.png" + } + ] + }, + "style": "v2", + "componentFramework": "glass-easel", + "sitemapLocation": "sitemap.json", + "lazyCodeLoading": "requiredComponents", + "usingComponents": { + "ad-popup": "./components/ad-popup/ad-popup" + }, + "useExtendedLib": { + "weui": true + } } \ No newline at end of file diff --git a/components/ad-popup/ad-popup.js b/components/ad-popup/ad-popup.js index 43dc329..9669b28 100644 --- a/components/ad-popup/ad-popup.js +++ b/components/ad-popup/ad-popup.js @@ -17,7 +17,25 @@ Component({ } }, data: { - checked: false + checked: false, + initPosition: { + left: 50, + top: 50 + }, + animation: {}, + screenWidth: 0, + screenHeight: 0 + }, + lifetimes: { + ready() { + const systemInfo = wx.getWindowInfo() + this.screenWidth = systemInfo.windowWidth; + this.screenHeight = systemInfo.windowHeight; + this.setData({ + screenHeight: systemInfo.windowHeight, + screenWidth: systemInfo.windowWidth + }) + } }, methods: { toggleCheck() { @@ -33,10 +51,47 @@ Component({ this.triggerEvent('close', this.data.checked); // 触发关闭事件 }, onFurl() { - this.setData({ - visible: false - }) + this.startAnimation() this.triggerEvent('furl', this.data.checked); //触发收下试卷 + }, + startAnimation() { + // 先重置元素状态 + this.setData({ + showBox: true, + animation: {} + }); + // 短暂延迟确保重置完成 + setTimeout(() => { + const animation = wx.createAnimation({ + duration: 1000, + timingFunction: 'ease-in-out' + }); + const targetLeft = this.data.screenWidth - 170; + const targetTop = this.data.screenHeight - 170; + console.log(this.data.screenHeight) + console.log(this.data.screenWidth) + animation + .translate(targetLeft - this.data.initPosition.left, targetTop - this.data.initPosition.top) + .scale(0.03) + .rotate(180) + .skew(10, 10) + .opacity(0) + .step(); + this.setData({ + animation: animation.export() + }); + // 动画结束后隐藏元素 + setTimeout(() => { + this.setData({ + visible: false, + initPosition: { + left: 50, + top: 50 + }, + animation: {} + }); + }, 1000); + }, 50); } } }) \ No newline at end of file diff --git a/components/ad-popup/ad-popup.wxml b/components/ad-popup/ad-popup.wxml index d613397..7b6c0fa 100644 --- a/components/ad-popup/ad-popup.wxml +++ b/components/ad-popup/ad-popup.wxml @@ -1,5 +1,5 @@ - + diff --git a/net/api/payApi.js b/net/api/payApi.js index 609a47a..33f8be0 100644 --- a/net/api/payApi.js +++ b/net/api/payApi.js @@ -7,6 +7,7 @@ const apiPath = { getPayOrder: '/api/pay/get-pay', //获取支付订单 enterprisePay: '/api/pay/pay-account-recharge/${accountRechargeId}', //企业付款完成支付 enterpriseAccountInfo: '/api/pay/get-pay-system-bank', //获取公司账户信息 + wxPayParams: '/api/accountrecharge/save-wx-pay-prepay-id', //获取微信支付所需参数 rechargeMoney金额 packageInfoId套餐包ID } class PayService { static doGetBuyPackageList(type, data) { @@ -26,6 +27,10 @@ class PayService { static doGetOrder(data) { return request(apiPath.getPayOrder, "POST", data) } + //获取微信支付参数 + static doGetWxPayParams(data) { + return request(apiPath.wxPayParams, "POST", data, null, "operator") + } } export default PayService; \ No newline at end of file diff --git a/net/http.js b/net/http.js index def7655..cacacf6 100644 --- a/net/http.js +++ b/net/http.js @@ -2,6 +2,7 @@ const Cache = require('../utils/storage'); // 定义api服务地址 // const baseUrl = 'https://www.xzszwhy.cn/daqi/app'; const operatorUrl = 'http://192.168.0.15:8091/operator'; +// const operatorUrl = 'https://www.aimzhu.com/operator'; const copyrightUrl = 'http://192.168.0.15:7025/copyright'; const uploadImgUrl = copyrightUrl + '/api/file/v2/upload-image' const previewUrl = copyrightUrl + '/route/file/v2/download/true/' diff --git a/pages/copyright/createProjectInfo/createProjectInfo.js b/pages/copyright/createProjectInfo/createProjectInfo.js index b420b2b..d21b2d4 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.js +++ b/pages/copyright/createProjectInfo/createProjectInfo.js @@ -52,6 +52,14 @@ Page({ wx.setNavigationBarTitle({ title: '创建软著', }) + wx.setNavigationBarColor({ + frontColor: '#000000', // 必写项,字体颜色仅支持#ffffff和#000000 + backgroundColor: '#F0F0F0', // 传递的颜色值,仅支持十六进制颜色 + animation: { // 可选项 + duration: 500, + timingFunc: 'easeIn' + } + }) const typeParams = options.type //类型 const priceParams = options.price //价格 const isUrgentParams = options.isUrgent diff --git a/pages/copyright/createProjectInfo/createProjectInfo.wxml b/pages/copyright/createProjectInfo/createProjectInfo.wxml index a9b010c..a013d00 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.wxml +++ b/pages/copyright/createProjectInfo/createProjectInfo.wxml @@ -61,7 +61,7 @@ 优惠券 - {{selectCoupons.id? selectCoupons.id : '请选择优惠券'}} + {{selectCoupons.couponId? selectCoupons.coupon.title : '请选择优惠券'}} 取消 选择 @@ -133,7 +133,7 @@ 优惠卷 - 减{{amount/100}}元 + 减{{item.coupon.amount/100}}元 {{item.coupon.title}} 有效期:{{item.coupon.useGmtStart}}至{{item.coupon.useGmtEnd}} diff --git a/pages/copyright/createProjectInfo/createProjectInfo.wxss b/pages/copyright/createProjectInfo/createProjectInfo.wxss index 2d481d2..fb47200 100644 --- a/pages/copyright/createProjectInfo/createProjectInfo.wxss +++ b/pages/copyright/createProjectInfo/createProjectInfo.wxss @@ -1,3 +1,7 @@ +page { + background: linear-gradient(to bottom, #F0F0F0, #FFFFFF); +} + .create-container { display: flex; flex-direction: column; @@ -77,6 +81,7 @@ flex-direction: row; justify-content: space-between; padding-right: 10px; + align-items: center; } .desc .icon { diff --git a/pages/copyright/payment/payment.js b/pages/copyright/payment/payment.js index 6628c97..776723a 100644 --- a/pages/copyright/payment/payment.js +++ b/pages/copyright/payment/payment.js @@ -70,7 +70,8 @@ Page({ if (regex.test(inputValue)) { //数字 _self.setData({ - payMoney: e.detail.value + payMoney: e.detail.value, + selectBag: {} }) } else { wx.showToast({ @@ -79,7 +80,8 @@ Page({ success: () => { setTimeout(() => { _self.setData({ - payMoney: 100 + payMoney: 100, + selectBag: {} }) }, 1000); } @@ -117,14 +119,30 @@ Page({ }, //TODO 调用微信支付 toWeChatPay() { - + const _self = this + wx.showLoading({ + title: '支付中...', + }) + const data = { + rechargeMoney: _self.data.payMoney, + packageInfoId: _self.data.selectBag.packageInfoId ? _self.data.selectBag.packageInfoId : '' + } + PayService.doGetWxPayParams(data) + .then(res => { + wx.hideLoading() + console.log(res) + }) + .catch(err => { + wx.hideLoading() + console.log(err) + }) }, //去支付 doPay() { const _self = this if (_self.data.payWay == '1') { //微信 - toWeChatPay() + _self.toWeChatPay() } else { //对公 需要传递参数 选中套餐 or 直接冲钱 const id = _self.data.selectBag.packageInfoId diff --git a/pages/index/index.js b/pages/index/index.js index a8e8892..2a98737 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -117,12 +117,9 @@ Page({ }, //创建项目 createCopy() { - this.setData({ - showAd: true + wx.navigateTo({ + url: '/pages/copyright/createBuy/createBuy', }) - // wx.navigateTo({ - // url: '/pages/copyright/createBuy/createBuy', - // }) }, //充值 goPayment() { @@ -286,7 +283,7 @@ Page({ const _self = this this.setData({ showDownload: true, - sysPreviewUrl: copyrightUrl + item.previewUrl, + sysPreviewUrl: `${copyrightUrl}/${item.previewUrl}`, tempItem: item }) }, @@ -465,7 +462,8 @@ Page({ showSuccess: true, showAd: false }) - }, err => { + }) + .catch(err => { wx.hideLoading() _self.setData({ errorHint: err.msg ? err.msg : '本次领取操作未成功,请重新进入小程序后再次尝试。', diff --git a/pages/index/index.wxml b/pages/index/index.wxml index e97fa94..2c7cb81 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -51,8 +51,8 @@ - - + + @@ -93,7 +93,6 @@ 资料下载 - 温馨提示:若您想把下载的文件留存到本地,打开预览页面后,在界面右上角操作栏内,选择使用其他软件打开或者保存文件功能就能实现。 项目预览链接 {{sysPreviewUrl}} @@ -147,6 +146,7 @@ + 温馨提示:若您想把下载的文件留存到本地,打开预览页面后,在界面右上角操作栏内,选择使用其他软件打开或者保存文件功能就能实现。 diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 48dc0c1..4f25c89 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -64,7 +64,7 @@ .notice-box { background-color: #FFE5BC; margin-top: 20rpx; - + border-radius: 3px; display: flex; flex-direction: row; justify-content: flex-start; @@ -374,7 +374,8 @@ .download-item:nth-of-type(n+2) { margin-top: 10px; } -.download-item:last-child{ + +.download-item:last-child { margin-bottom: 80px; } @@ -501,7 +502,8 @@ color: rgb(248, 185, 50); font-weight: bold; } -.weui-half-screen-dialog__ft{ + +.weui-half-screen-dialog__ft { height: 0; padding: 0; } \ No newline at end of file diff --git a/pages/mine/mineAccount/mineCoupons/mineCoupons.wxss b/pages/mine/mineAccount/mineCoupons/mineCoupons.wxss index 809e8e2..d4b0d55 100644 --- a/pages/mine/mineAccount/mineCoupons/mineCoupons.wxss +++ b/pages/mine/mineAccount/mineCoupons/mineCoupons.wxss @@ -139,7 +139,7 @@ page { } .l-price { - font-size: 30px; + font-size: 20px; font-weight: bold; margin-left: 5px; } @@ -157,9 +157,9 @@ page { .r-title { line-height: 25px; color: #313131; - font-size: 18px; + font-size: 14px; font-weight: bold; - text-align: left; + text-align: center; font-family: PingFangSC-medium; } diff --git a/pages/mine/mineIndex/mine.js b/pages/mine/mineIndex/mine.js index 0fff20d..acf02c3 100644 --- a/pages/mine/mineIndex/mine.js +++ b/pages/mine/mineIndex/mine.js @@ -74,11 +74,11 @@ Page({ console.log(err) }) }, + //获取账户余额 getMinePackageCount() { const _self = this UserApi.doGetMinePackageCount() .then(res => { - console.log(res) _self.setData({ allCount: res.ALL, materialCount: res.MATERIAL diff --git a/pages/mine/mineIndex/mine.wxml b/pages/mine/mineIndex/mine.wxml index 8562cc1..a2747f0 100644 --- a/pages/mine/mineIndex/mine.wxml +++ b/pages/mine/mineIndex/mine.wxml @@ -34,8 +34,8 @@ - - + + diff --git a/utils/util.js b/utils/util.js index 5d5217b..e79f229 100644 --- a/utils/util.js +++ b/utils/util.js @@ -175,6 +175,16 @@ const removeImgStyleFromRichText = (richText) => { } return richText; } +//生成32位随机字符串 +const random32Str = () => { + const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + let randomString = ''; + for (let i = 0; i < 32; i++) { + const randomIndex = Math.floor(Math.random() * charSet.length); + randomString += charSet.charAt(randomIndex); + } + return randomString; +} module.exports = { formatTime: formatTime, formatDate: formatDate, @@ -185,5 +195,6 @@ module.exports = { formatHtml: formatRichText, removeImgStyle: removeImgStyleFromRichText, dateTimePicker: dateTimePicker, - pxToRpx: pxToRpx + pxToRpx: pxToRpx, + random32Str: random32Str } \ No newline at end of file