From 98fff8a58bbf72f55328c0307f612267982160d0 Mon Sep 17 00:00:00 2001 From: jia <1451658316@qq.com> Date: Fri, 8 Sep 2023 10:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=A7=86=E9=A2=91=E6=A8=AA?= =?UTF-8?q?=E7=AB=96=E5=B1=8F=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WaterfallsFlowItems.vue | 33 ++- pages/admin/financial_management/index.vue | 4 +- .../receivedCommission/index.vue | 2 +- pages/plantGrass/plant_detail/index.vue | 2 +- pages/short_video/appSwiper/index.nvue | 6 +- pages/trading_hall/transfer_goods/index.vue | 4 +- pages/users/order_confirm/index.vue | 10 +- utils/uniMP.js | 262 +++++++++--------- 8 files changed, 170 insertions(+), 153 deletions(-) diff --git a/components/WaterfallsFlowItem/WaterfallsFlowItems.vue b/components/WaterfallsFlowItem/WaterfallsFlowItems.vue index c648c9a..b619aaf 100644 --- a/components/WaterfallsFlowItem/WaterfallsFlowItems.vue +++ b/components/WaterfallsFlowItem/WaterfallsFlowItems.vue @@ -23,7 +23,7 @@ require: true }, userid: { - type: String|Number, + type: String | Number, require: true }, }, @@ -38,22 +38,29 @@ methods: { - gogogo(item) { - if (item.video_link.length > 0) { - uni.navigateTo({ - // #ifdef MP || H5 - url: `/pages/short_video/nvueSwiper/index?id=${item.community_id}&uid=${this.userid}&user=1` - // #endif - // #ifdef APP - url: `/pages/short_video/appSwiper/index?id=${item.community_id}&uid=${this.userid}&user=1` - // #endif - }) + if (this.userid) { + if (item.video_link.length > 0) { + uni.navigateTo({ + // #ifdef MP || H5 + url: `/pages/short_video/nvueSwiper/index?id=${item.community_id}&uid=${this.userid}&user=1` + // #endif + // #ifdef APP + url: `/pages/short_video/appSwiper/index?id=${item.community_id}&uid=${this.userid}&user=1` + // #endif + }) + } else { + uni.navigateTo({ + url: `/pages/plantGrass/plant_detail/index?id=${item.community_id}` + }) + } } else { - uni.navigateTo({ - url: `/pages/plantGrass/plant_detail/index?id=${item.community_id}` + this.$util.Tips({ + title: '用户信息不存在,请完成登录在进行该操作', + icon: 'error' }) } + }, } diff --git a/pages/admin/financial_management/index.vue b/pages/admin/financial_management/index.vue index dc31959..751c9a5 100644 --- a/pages/admin/financial_management/index.vue +++ b/pages/admin/financial_management/index.vue @@ -116,12 +116,12 @@ 任务名称: {{ item.remark }} - + --> 收益来源: diff --git a/pages/commissionedSales/receivedCommission/index.vue b/pages/commissionedSales/receivedCommission/index.vue index 40d36ef..2a290fc 100644 --- a/pages/commissionedSales/receivedCommission/index.vue +++ b/pages/commissionedSales/receivedCommission/index.vue @@ -23,7 +23,7 @@ - + 待处理 diff --git a/pages/plantGrass/plant_detail/index.vue b/pages/plantGrass/plant_detail/index.vue index 37d7269..bc8f403 100644 --- a/pages/plantGrass/plant_detail/index.vue +++ b/pages/plantGrass/plant_detail/index.vue @@ -23,7 +23,7 @@ - + {{followDetail.author.nickname}} diff --git a/pages/short_video/appSwiper/index.nvue b/pages/short_video/appSwiper/index.nvue index c245860..212a0f7 100644 --- a/pages/short_video/appSwiper/index.nvue +++ b/pages/short_video/appSwiper/index.nvue @@ -401,7 +401,7 @@ newTime: 0, //跟手滑动后的最新时间💗 timeNumber: 0, //🌟💗 ProgressBarBottom: 20, //进度条离底部的距离💗 - object_fit: 'cover', //视频样式默认包含🌟💗 + object_fit: 'contain', //视频样式默认包含🌟💗 mode: 'aspectFit', //图片封面样式🌟💗 timeout: "", //🌟用来阻止 setTimeout()方法 voice: "", //🌟用来阻止 setTimeout()方法 @@ -1116,7 +1116,7 @@ /* #ifdef MP */ padding-top: 200rpx; /* #endif */ - // background-color: #000000; + background-color: #000000; background-color: #F5F5F5; .goods_item { @@ -1238,7 +1238,7 @@ left: 0; top: 70rpx; height: 86rpx; - + .icon-xiangzuo { margin-left: 10px; diff --git a/pages/trading_hall/transfer_goods/index.vue b/pages/trading_hall/transfer_goods/index.vue index 895a38c..fec3e7c 100644 --- a/pages/trading_hall/transfer_goods/index.vue +++ b/pages/trading_hall/transfer_goods/index.vue @@ -616,10 +616,8 @@ if (this.type == 'edit') { this.formData.product_info = [] } - this.productList = [] - this.price = 0; - + this.price = 0; if (data.length > 0) { this.productList = data; for (let i in data) { diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue index 911d4ba..fae8f15 100644 --- a/pages/users/order_confirm/index.vue +++ b/pages/users/order_confirm/index.vue @@ -8,10 +8,10 @@ {{addressInfo.phone}} - - [默认]{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.street || ''}}{{typeof(addressInfo.brigade)=='string'?addressInfo.brigade:addressInfo.brigade.name }}{{addressInfo.detail}} + [默认]{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}{{addressInfo.street || ''}} + {{typeof(addressInfo.brigade)=='string'?addressInfo.brigade:addressInfo.brigade.name }}{{addressInfo.detail}} { this.getConfirm(that.addressId); }) diff --git a/utils/uniMP.js b/utils/uniMP.js index 6872c60..0bd86ef 100644 --- a/utils/uniMP.js +++ b/utils/uniMP.js @@ -1,4 +1,9 @@ -import { getGXconfig } from "@/api/uniMP.js"; +import { + getGXconfig +} from "@/api/uniMP.js"; +import { + HTTP_REQUEST_URL +} from '@/config/app'; const mp = uni.requireNativePlugin('uniMP'); let appid = ''; // 应用id @@ -7,146 +12,153 @@ let timer = null; // 加载计时器 // 比较版本号大小 function compareVersions(version1, version2) { - const arr1 = version1.split('.').map(Number); - const arr2 = version2.split('.').map(Number); - for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) { - const num1 = i < arr1.length ? arr1[i] : 0; - const num2 = i < arr2.length ? arr2[i] : 0; - if (num1 > num2) { - return 1; - } else if (num1 < num2) { - return -1; - } - } - return 0; + const arr1 = version1.split('.').map(Number); + const arr2 = version2.split('.').map(Number); + for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) { + const num1 = i < arr1.length ? arr1[i] : 0; + const num2 = i < arr2.length ? arr2[i] : 0; + if (num1 > num2) { + return 1; + } else if (num1 < num2) { + return -1; + } + } + return 0; } // 加载小程序 const loadMP = async (id) => { - appid = id; - let info = await getGXconfig(); - console.log('最新版本', info.data); - console.log(mp, uni); - // return ; - uni.showLoading({ - title: '下载中...', - mask: true - }) - mp.getUniMPVersion(id, (ret) => { - console.log('当前版本', ret); - if (0 != ret.code || compareVersions(info.data.version, ret.versionInfo.name) == 1 || true) { - let count = 0; - timer = setInterval(() => { - if (count < 100) uni.showLoading({ - title: `下载中... ${count}%`, - mask: true - }) - else uni.showLoading({ - title: '安装中...', - mask: true - }) - }, 600) - let downloadTask = uni.downloadFile({ - url: info.data.version_info?.dow_url, - success(res) { - wgtFile = res.tempFilePath; - console.log('下载完成', wgtFile); - installMP(); - } - }); - downloadTask.onProgressUpdate((res) => { - // console.log('下载进度' + res.progress); - if (res.progress > count) count += 10; - if (count >= 90) { - clearInterval(timer); - timer = null; - } - }); - } else { - open() - } - }); + appid = id; + let info = await getGXconfig(); + console.log('最新版本', info.data); + console.log(mp, uni); + // return ; + uni.showLoading({ + title: '下载中...', + mask: true + }) + mp.getUniMPVersion(id, (ret) => { + console.log('当前版本', ret); + let flag; + if (HTTP_REQUEST_URL == 'https://shop.lihaink.cn') { + flag = false + } else { + flag = true + } + if (0 != ret.code || compareVersions(info.data.version, ret.versionInfo.name) == 1 || flag == + true) { + let count = 0; + timer = setInterval(() => { + if (count < 100) uni.showLoading({ + title: `下载中... ${count}%`, + mask: true + }) + else uni.showLoading({ + title: '安装中...', + mask: true + }) + }, 600) + let downloadTask = uni.downloadFile({ + url: info.data.version_info?.dow_url, + success(res) { + wgtFile = res.tempFilePath; + console.log('下载完成', wgtFile); + installMP(); + } + }); + downloadTask.onProgressUpdate((res) => { + // console.log('下载进度' + res.progress); + if (res.progress > count) count += 10; + if (count >= 90) { + clearInterval(timer); + timer = null; + } + }); + } else { + open() + } + }); }; // 小程序版本信息 const getVersion = (id) => { - appid = id; - return new Promise((resolve, reject) => { - mp.getUniMPVersion(appid, (ret) => { - console.log('供销', ret); - }); - }) + appid = id; + return new Promise((resolve, reject) => { + mp.getUniMPVersion(appid, (ret) => { + console.log('供销', ret); + }); + }) } // 安装小程序 const installMP = () => { - mp.getUniMPVersion(appid, (ret) => { - console.log('安装:供销', ret); - doInstallMP(); - // if (0 != ret.code) { //获取失败时安装应用 - // doInstallMP(); - // } else { - // uni.showModal({ - // title: '提示', - // content: 'uni小程序已安装,是否覆盖?', - // success: res => { - // res.confirm && doInstallMP(); - // } - // }); - // } - console.log('getUniMPVersion: ' + JSON.stringify(ret)); - }); + mp.getUniMPVersion(appid, (ret) => { + console.log('安装:供销', ret); + doInstallMP(); + // if (0 != ret.code) { //获取失败时安装应用 + // doInstallMP(); + // } else { + // uni.showModal({ + // title: '提示', + // content: 'uni小程序已安装,是否覆盖?', + // success: res => { + // res.confirm && doInstallMP(); + // } + // }); + // } + console.log('getUniMPVersion: ' + JSON.stringify(ret)); + }); }; const doInstallMP = () => { - mp.installUniMP({ - appid: appid, - wgtFile: wgtFile - }, (r) => { - if (0 == r.code) { - // uni.showToast({ - // title: '安装成功' - // }); - console.log('小程序安装成功'); - open(); - } else { - uni.hideLoading(); - uni.showModal({ - title: '安装失败', - content: JSON.stringify(r), - showCancel: false - }); - } - console.log('安装供销: ' + JSON.stringify(r)); - }); + mp.installUniMP({ + appid: appid, + wgtFile: wgtFile + }, (r) => { + if (0 == r.code) { + // uni.showToast({ + // title: '安装成功' + // }); + console.log('小程序安装成功'); + open(); + } else { + uni.hideLoading(); + uni.showModal({ + title: '安装失败', + content: JSON.stringify(r), + showCancel: false + }); + } + console.log('安装供销: ' + JSON.stringify(r)); + }); }; const open = (id = null) => { - let token = uni.getStorageSync('LOGIN_STATUS_TOKEN'); - if (!token) return uni.showToast({ - icon: 'none', - title: '请先登录' - }) - mp.openUniMP({ - appid: id || appid, - extraData: { - uniMP: true, - token: token, - } - }, (ret) => { - uni.hideLoading(); - if (0 != ret.code) { - uni.showModal({ - title: '启动失败', - content: JSON.stringify(ret), - showCancel: false - }); - } - console.log('openUniMP: ' + JSON.stringify(ret)); - }); + let token = uni.getStorageSync('LOGIN_STATUS_TOKEN'); + if (!token) return uni.showToast({ + icon: 'none', + title: '请先登录' + }) + mp.openUniMP({ + appid: id || appid, + extraData: { + uniMP: true, + token: token, + } + }, (ret) => { + uni.hideLoading(); + if (0 != ret.code) { + uni.showModal({ + title: '启动失败', + content: JSON.stringify(ret), + showCancel: false + }); + } + console.log('openUniMP: ' + JSON.stringify(ret)); + }); } export default { - loadMP, - installMP, - doInstallMP, - getVersion, - open + loadMP, + installMP, + doInstallMP, + getVersion, + open } \ No newline at end of file