diff --git a/.env.development b/.env.development index 5bb01777..f6307727 100644 --- a/.env.development +++ b/.env.development @@ -18,4 +18,4 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' # h5专用地址 -VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7002' +VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001' diff --git a/src/common/common.js b/src/common/common.js index 9640ffe0..665d1ade 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -1,5 +1,6 @@ +// #ifdef APP-PLUS import showDialog from '@/common/dialogMessage' - +// #endif function msg(title, duration = 1000) { uni.showToast({ title: title, @@ -10,40 +11,49 @@ function msg(title, duration = 1000) { } function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') { - return new Promise((resolve, reject) => { - // 创建通用参数对象 - const dialogOptions = { - title, - content: msg, - showCancel, - cancelText, - confirmText, - success: (res) => { - // 统一处理成功回调,解析为布尔值 - console.log('res.confirm', res.confirm); - resolve(!!res.confirm); - } - }; - - if (getPhoneEnvBool('AND')) { - // 安卓环境使用showDialog,补充cancel回调 - showDialog({ - ...dialogOptions, - cancel: () => { - console.log('用户点击取消'); - resolve(false); // 取消时也返回Promise结果 - } - }); - } else { - // 其他环境使用uni.showModal,补充fail回调 - uni.showModal({ - ...dialogOptions, - fail: (res) => { - reject(res); - } - }); - } - }); + return new Promise((resolve, reject) => { + // 创建通用参数对象 + const dialogOptions = { + title, + content: msg, + showCancel, + cancelText, + confirmText, + success: (res) => { + // 统一处理成功回调,解析为布尔值 + console.log('res.confirm', res.confirm); + resolve(!!res.confirm); + } + }; + // #ifdef APP-PLUS + if (getPhoneEnvBool('AND')) { + // 安卓环境使用showDialog,补充cancel回调 + showDialog({ + ...dialogOptions, + cancel: () => { + console.log('用户点击取消'); + resolve(false); // 取消时也返回Promise结果 + } + }); + } else { + // 其他环境使用uni.showModal,补充fail回调 + uni.showModal({ + ...dialogOptions, + fail: (res) => { + reject(res); + } + }); + } + // #endif + // #ifdef H5 + uni.showModal({ + ...dialogOptions, + fail: (res) => { + reject(res); + } + }); + // #endif + }); } const loading = (title = '加载中', mask = true) => uni.showLoading({ @@ -140,18 +150,20 @@ export const getUserInfo = (key = '') => { * @returns {boolean} 如果当前平台匹配指定标识返回true,否则返回false */ export const getPhoneEnvBool = (flag) => { - // 获取当前设备的平台信息 - - const { platform } = uni.getSystemInfoSync(); - - // 平台与标识的映射关系 - const platformMap = { - ios: 'IOS', - android: 'AND', - }; + // 获取当前设备的平台信息 - // 根据当前平台返回匹配结果 - return platformMap[platform] === flag; + const { + platform + } = uni.getSystemInfoSync(); + + // 平台与标识的映射关系 + const platformMap = { + ios: 'IOS', + android: 'AND', + }; + + // 根据当前平台返回匹配结果 + return platformMap[platform] === flag; }; diff --git a/src/common/dialogMessage.js b/src/common/dialogMessage.js index d215f8c4..b2451f01 100644 --- a/src/common/dialogMessage.js +++ b/src/common/dialogMessage.js @@ -1,4 +1,5 @@ export default function showDialog(options) { + const view = new plus.nativeObj.View('customModal', { top: '0', left: '0', @@ -7,7 +8,7 @@ export default function showDialog(options) { backgroundColor: 'rgba(0,0,0,0.1)', position: 'fixed' }); - + const screenWidth = plus.screen.resolutionWidth; const screenHeight = plus.screen.resolutionHeight; const borderRadius = 10; @@ -212,7 +213,7 @@ export default function showDialog(options) { } } }, false); - + view.show(); return { @@ -220,4 +221,5 @@ export default function showDialog(options) { view.close(); } }; + } \ No newline at end of file diff --git a/src/pages/courseDetail/components/comment.vue b/src/pages/courseDetail/components/comment.vue index afd12197..b99ce974 100644 --- a/src/pages/courseDetail/components/comment.vue +++ b/src/pages/courseDetail/components/comment.vue @@ -167,10 +167,18 @@ } } - const getData = () => { - if (status.value !== 'loadmore' && status.value !== '') return - status.value = 'loading' - page.value++ + const getData = (from = '') => { + if (from == 'submit') { + status.value = '' + total.value = -1 + page.value = 1 + message_list.length = 0 + } else { + if (status.value !== 'loadmore' && status.value !== '') return + status.value = 'loading' + page.value++ + } + queryTraCrsBbsInfoByCrsId({ crsId: props.crsId, page: page.value, diff --git a/src/pages/courseDetail/index.vue b/src/pages/courseDetail/index.vue index e4b1b77b..68c108af 100644 --- a/src/pages/courseDetail/index.vue +++ b/src/pages/courseDetail/index.vue @@ -37,30 +37,22 @@ :inactive-style="{ color: '#666666', 'font-size': '30rpx' }"> - - - + - + - + - - + - - -