diff --git a/api/goods_api.js b/api/goods_api.js index ea61e53..436d2af 100644 --- a/api/goods_api.js +++ b/api/goods_api.js @@ -23,7 +23,9 @@ const goods_api = { createGoodsOrder(data) { return request('/expertAPI/createGoodsOrder', data, 'post', true); }, - + payGoodsOrder(data) { + return request('/expertAPI/payGoodsOrder', data, 'post', true); + }, getGoodsOrderList(data) { return request('/expertAPI/goodsOrderList', data, 'post', true); } diff --git a/pages.json b/pages.json index cae0e47..20bb20b 100644 --- a/pages.json +++ b/pages.json @@ -1541,7 +1541,7 @@ "list": [ { "name": "", - "path": "pages/index/index", + "path": "pages_app/myWelfare/myWelfare", "query": "" } ] diff --git a/pages_app/buyUpan/address.vue b/pages_app/buyUpan/address.vue index 821af8a..287815d 100644 --- a/pages_app/buyUpan/address.vue +++ b/pages_app/buyUpan/address.vue @@ -256,6 +256,7 @@ const submit = () => { .left{ text-align: left; max-width: 125rpx; + width:auto!important; } .price{ color: #FF4D4F; diff --git a/pages_app/myCode/myCode.vue b/pages_app/myCode/myCode.vue index 3ee88f5..a1f4308 100644 --- a/pages_app/myCode/myCode.vue +++ b/pages_app/myCode/myCode.vue @@ -1,10 +1,11 @@ @@ -78,72 +79,196 @@ const goBack = () => { onShow(()=>{ userInfo.value = uni.getStorageSync('userInfo') }) + +// 处理保存错误 +const handleSaveError = (err) => { + if (err.errMsg && (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize'))) { + uni.showModal({ + title: '权限提示', + content: '需要相册权限才能保存图片,请在设置中开启权限', + showCancel: false, + confirmText: '知道了' + }); + } else { + uni.showToast({ + title: '保存失败,请重试', + icon: 'none', + duration: 2000 + }); + } +}; + const onSave = () => { - // 检查是否有二维码图片 - if (!userInfo.value.qrcode) { - uni.showToast({ title: '二维码不存在', icon: 'none' }); + // #ifdef APP-PLUS + // 检查是否在 App 端 + if (typeof plus === 'undefined') { + uni.showToast({ title: '当前环境不支持此功能', icon: 'none' }); return; } // 显示加载提示 uni.showLoading({ title: '保存中...' }); - // 下载二维码图片 - uni.downloadFile({ - url: docUrl + userInfo.value.qrcode, - success: (res) => { - if (res.statusCode === 200) { - // 保存到相册 - uni.saveImageToPhotosAlbum({ - filePath: res.tempFilePath, - success: () => { + // 添加超时处理 + let timeoutTimer = setTimeout(() => { + uni.hideLoading(); + uni.showToast({ + title: '操作超时,请重试', + icon: 'none', + duration: 2000 + }); + }, 15000); // 15秒超时 + + // 获取当前 webview + const currentWebview = plus.webview.currentWebview(); + + // 使用 draw 方法将页面绘制成图片 + currentWebview.draw({ + bitmap: true, + success: (bitmap) => { + clearTimeout(timeoutTimer); + try { + // 将 bitmap 转换为 base64 + const base64 = bitmap.toBase64DataURL('image/png', 1.0); + + // 去除 base64 前缀 + const base64Data = base64.indexOf(',') > -1 ? base64.split(',')[1] : base64; + + // 生成临时文件路径 + const fileName = 'mycode_' + Date.now() + '.png'; + const tempPath = `_doc/${fileName}`; + + // 使用 plus.io 写入文件 + plus.io.resolveLocalFileSystemURL('_doc', (entry) => { + entry.getFile(fileName, { create: true, exclusive: false }, (fileEntry) => { + fileEntry.createWriter((writer) => { + // base64 转 ArrayBuffer + const binaryString = atob(base64Data); + const len = binaryString.length; + const bytes = new Uint8Array(len); + for (let i = 0; i < len; i++) { + bytes[i] = binaryString.charCodeAt(i); + } + + writer.onwriteend = () => { + // 写入完成,回收 bitmap + bitmap.recycle(); + + // 转换为本地路径 + const localPath = plus.io.convertLocalFileSystemURL(fileEntry.fullPath); + + // 保存到相册 + uni.saveImageToPhotosAlbum({ + filePath: localPath, + success: () => { + uni.hideLoading(); + uni.showToast({ + title: '保存成功', + icon: 'success', + duration: 2000 + }); + }, + fail: (err) => { + uni.hideLoading(); + console.error('保存到相册失败:', err); + handleSaveError(err); + } + }); + }; + + writer.onerror = (err) => { + uni.hideLoading(); + console.error('写入文件失败:', err); + bitmap.recycle(); + uni.showToast({ + title: '保存失败,请重试', + icon: 'none', + duration: 2000 + }); + }; + + // 创建 Blob 对象并写入 + try { + const blob = new Blob([bytes], { type: 'image/png' }); + writer.write(blob); + } catch (e) { + // 如果 Blob 不支持,尝试直接写入 ArrayBuffer + try { + writer.write(bytes.buffer); + } catch (e2) { + uni.hideLoading(); + console.error('写入失败:', e2); + bitmap.recycle(); + uni.showToast({ + title: '保存失败,请重试', + icon: 'none', + duration: 2000 + }); + } + } + }, (err) => { + clearTimeout(timeoutTimer); uni.hideLoading(); + console.error('创建写入器失败:', err); + bitmap.recycle(); uni.showToast({ - title: '保存成功', + title: '保存失败,请重试', icon: 'none', duration: 2000 }); - }, - fail: (err) => { - uni.hideLoading(); - console.error('保存失败:', err); - - // 根据错误类型给出不同提示 - if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize')) { - uni.showModal({ - title: '权限提示', - content: '需要相册权限才能保存图片,请在设置中开启权限', - showCancel: false, - confirmText: '知道了' - }); - } else { - uni.showToast({ - title: '保存失败,请重试', - icon: 'none', - duration: 2000 - }); - } - } + }); + }, (err) => { + clearTimeout(timeoutTimer); + uni.hideLoading(); + console.error('获取文件失败:', err); + bitmap.recycle(); + uni.showToast({ + title: '保存失败,请重试', + icon: 'none', + duration: 2000 + }); }); - } else { + }, (err) => { + clearTimeout(timeoutTimer); uni.hideLoading(); + console.error('解析文件系统失败:', err); + bitmap.recycle(); uni.showToast({ - title: '下载失败,请检查网络', + title: '保存失败,请重试', + icon: 'none', + duration: 2000 + }); + }); + } catch (error) { + clearTimeout(timeoutTimer); + uni.hideLoading(); + console.error('处理失败:', error); + if (bitmap && bitmap.recycle) { + bitmap.recycle(); + } + uni.showToast({ + title: '保存失败,请重试', icon: 'none', duration: 2000 }); } }, fail: (err) => { + clearTimeout(timeoutTimer); uni.hideLoading(); - console.error('下载失败:', err); + console.error('截图失败:', err); uni.showToast({ - title: '下载失败,请检查网络', + title: '截图失败,请重试', icon: 'none', duration: 2000 }); } }); + // #endif + + // #ifndef APP-PLUS + uni.showToast({ title: '此功能仅支持 App 端', icon: 'none' }); + // #endif }; @@ -252,7 +377,7 @@ const onSave = () => { .qr-card { position: relative; - margin: -120rpx 30rpx 30rpx; + margin: 76rpx 30rpx 30rpx; background: #ffffff; border-radius: 20rpx; padding: 140rpx 30rpx 30rpx; diff --git a/pages_app/myPoint/myPoint.vue b/pages_app/myPoint/myPoint.vue index 9f2a8ab..b6970ac 100644 --- a/pages_app/myPoint/myPoint.vue +++ b/pages_app/myPoint/myPoint.vue @@ -164,13 +164,39 @@ + + + + + + + + + + + + + 今天是我们相识的第{{signInfo.gdxzday}}天 + 本周共签到{{signInfo.totalDay}}次 + 已经连续签到{{signInfo.continuous_day}}天 + 连续签到获取更多积分 + + {{signInfo.news.summary}} + + + + + + + - diff --git a/pages_app/myWelfare/myWelfare.vue b/pages_app/myWelfare/myWelfare.vue index 15fdbeb..96cc58d 100644 --- a/pages_app/myWelfare/myWelfare.vue +++ b/pages_app/myWelfare/myWelfare.vue @@ -211,11 +211,13 @@ } } const switchTab = (index) => { - activeTab.value = index; + if (index === 0) { + activeTab.value = index; getWelfarePage(); } else if (index === 1) { + activeTab.value = index; useWelfarePage(); } else if (index === 2) { navTo({ @@ -250,11 +252,29 @@ url: '/pages_app/zhinan/zhinan' }); }else if(benefit.name == 'daicha'){ - if(benefit.num == 0){ - showDialog.value = true; - }else{ - - } + // if(benefit.num == 0){ + // showDialog.value = true; + // }else{ + plus.share.getServices(res => { + const wechat = res.find(i => i.id === 'weixin') + if (wechat) { + wechat.openCustomerServiceChat({ + corpid: 'wwc72af5440141e84e',//第三步获取 + url: 'https://work.weixin.qq.com/kfid/kfceb116f7032dbbb91', + }, src => { + console.log("success:") + }, err => { + console.log("error:") + }) + } else { + uni.showToast({ + title: '当前环境不支持', + icon: "error" + }); + } +}); + + //} } } }; @@ -267,7 +287,7 @@ const gofuliDetail = () => { navTo({ - url: '/pages_app/myPoint/myPoint' + url: '/pages_app/myWelfare/welfareDetail' }) }; @@ -277,15 +297,34 @@ }) }; const goRules = () => { + navTo({ - url: '/pages_app/webview/webview?url='+encodeURIComponent(docUrl+'integral/integral_welfare.html')+'&title=福利规则' + url: '/pages_app/webview/webview?url='+encodeURIComponent('https://doc.igandan.com/app/integral/integral_welfare.html')+'&title=福利规则' }) }; const useWelfarePage = () => { api.useWelfarePage().then(res => { if (res.code === '200' && res.data) { // 更新福利列表数据 - benefitsList.value = res.data; + res.data.forEach(item => { + item.name = item.name.replace(' ', ''); + }); + + // 定义排序顺序:肝胆积分、肝胆视频、肝胆课件、查找文献、知识U盘 + const sortOrder = ['jifen', 'video', 'kejian', 'daicha', 'upan']; + + // 对列表进行排序 + benefitsList.value = res.data.sort((a, b) => { + const indexA = sortOrder.indexOf(a.name); + const indexB = sortOrder.indexOf(b.name); + + // 如果找不到对应的排序索引,放在最后 + if (indexA === -1 && indexB === -1) return 0; + if (indexA === -1) return 1; + if (indexB === -1) return -1; + + return indexA - indexB; + }); } }); }; @@ -470,21 +509,27 @@ border:2rpx solid #fff; &.jifen{ border:2rpx solid #ffad17; + background:#feeae9; } &.wenxian{ border:2rpx solid #33c966; + background:#fdeafe; } &.video{ border:2rpx solid #ff951d; + background:#fefbea; } &.kejian{ border:2rpx solid #f17dff; + background:#fdeafe; } &.upan{ border:2rpx solid #40cdc5; + background:#eafffa; } &.wanfang{ border:2rpx solid #4aa2fe; + background:#fff; } .disabled-text { color: $text-light !important; diff --git a/pages_app/ppt/ppt.vue b/pages_app/ppt/ppt.vue index 70c34ad..831f636 100644 --- a/pages_app/ppt/ppt.vue +++ b/pages_app/ppt/ppt.vue @@ -591,8 +591,13 @@ } .filter-item{ display:flex; + align-items: center; + .filterbox{ - margin-top: 5rpx; + margin-top: 0rpx; + } + .newbox{ + margin-top: -11rpx; } .filter-text{ color:#666; diff --git a/pages_goods/exchange/address.vue b/pages_goods/exchange/address.vue index 549c105..a9abc93 100644 --- a/pages_goods/exchange/address.vue +++ b/pages_goods/exchange/address.vue @@ -16,13 +16,13 @@ - + 邮箱 - + - + 地址 请选择地址 {{ regionText }} @@ -30,14 +30,15 @@ - + 详细地址 + - 确定 + 确定兑换 @@ -62,20 +63,80 @@ 地区数据加载中... + + + - diff --git a/pages_goods/exchange/index.vue b/pages_goods/exchange/index.vue index 6d1d6db..06e3d84 100644 --- a/pages_goods/exchange/index.vue +++ b/pages_goods/exchange/index.vue @@ -5,7 +5,7 @@ - + {{ title }} {{ price }}积分 @@ -37,16 +37,38 @@ - - 我要兑换 + + 我要兑换 + + + diff --git a/static/background.jpg b/static/background.jpg index bad7099..d8069fc 100644 Binary files a/static/background.jpg and b/static/background.jpg differ diff --git a/static/signin_false.png b/static/signin_false.png new file mode 100644 index 0000000..35a5bb1 Binary files /dev/null and b/static/signin_false.png differ diff --git a/static/signin_true.png b/static/signin_true.png new file mode 100644 index 0000000..abba670 Binary files /dev/null and b/static/signin_true.png differ diff --git a/tsconfig.json b/tsconfig.json index 4eb524f..e8c6fcd 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -101,5 +101,6 @@ + diff --git a/utils/request.js b/utils/request.js index 89ac557..43c7994 100644 --- a/utils/request.js +++ b/utils/request.js @@ -120,9 +120,9 @@ export const request = (url, data = {}, method = 'post', loading = false, conten if(process.env.UNI_PLATFORM == "mp-weixin"){ uni.redirectTo({url:'/pages_app/login/login'}) } - // else{ - // uni.navigateTo({url:'/pages_app/login/login'}) - // } + else{ + uni.navigateTo({url:'/pages_app/login/login'}) + } uni.sendNativeEvent('getNewToken', { msg: 'getNewToken' },ret => {