diff --git a/App.vue b/App.vue index 7f53dbd..fae2683 100644 --- a/App.vue +++ b/App.vue @@ -3,6 +3,7 @@ import { go2 } from '@/utils/hook.js' import { isString } from '@/utils/is.js' import store from '@/store/index.js' import handlePushMsg from '@/utils/handlePushMsg.js' +import { checkUpdate } from '@/apis/commonApi.js' export default { onLaunch: function () { const token = store.state.qnToken @@ -14,12 +15,12 @@ export default { go2('client') } // #ifdef APP-PLUS - let client = uni.getSystemInfoSync().platform setTimeout(() => { plus.push.addEventListener( 'click', function (msg) { + console.log('click msg',msg) handlePushMsg(msg) }, false @@ -38,7 +39,7 @@ export default { let payload = JSON.stringify(msg.payload) console.log('ios receive:', title, payload, content) plus.push.createMessage(content, payload, { - title: title, + title: title }) if (msg.payload.messageType == 4) { enquiryVoice() @@ -46,10 +47,11 @@ export default { } } if (client === 'android') { + console.log('receive msg',msg) let title = msg.title let content = msg.content plus.push.createMessage(content, JSON.stringify(msg.payload), { - title: title, + title: title }) if (msg.payload.messageType == 4) { enquiryVoice() @@ -80,12 +82,21 @@ export default { }) }, 3000) } + // app更新 + //#ifdef APP-PLUS + checkUpdate().then((version) => { + let curVersion = plus.runtime.version + if(version != curVersion) { + plus.runtime.openURL(`https://www.pgyer.com/ST8i`) + } + }) + //#endif }, onShow: function () { // 先默认进入应用就清除所有消息 plus.runtime.setBadgeNumber(0) }, - onHide: function () {}, + onHide: function () {} } diff --git a/apis/commonApi.js b/apis/commonApi.js index 0d15d95..21dc9e9 100644 --- a/apis/commonApi.js +++ b/apis/commonApi.js @@ -159,3 +159,15 @@ export function getFrontIdCardOcr(data = {}) { data: data }) } + +/** + * 获取当前应用版本号 + * @param {object} data + * @value {string} version + */ +export function checkUpdate(data = {}) { + return http.get({ + url: '/base-paper-trading/get/app/version', + data: data + }) +} diff --git a/env/index.js b/env/index.js index a0bfcb1..bcf6a22 100644 --- a/env/index.js +++ b/env/index.js @@ -1,8 +1,8 @@ /** * @description 唯一环境变量 */ -const env = 'test' +// const env = 'test' // const env = 'dev' -// const env = 'production' +const env = 'production' export default env diff --git a/hybrid/html/share.html b/hybrid/html/share.html deleted file mode 100644 index 55b15e3..0000000 --- a/hybrid/html/share.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - Document - - - - - - - - - - - \ No newline at end of file diff --git a/manifest.json b/manifest.json index 54b3900..b8f8646 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "纸掌柜", "appid" : "__UNI__8C1E198", "description" : "", - "versionName" : "1.0.0", + "versionName" : "1.0.1", "versionCode" : 102, "transformPx" : false, "networkTimeout" : { @@ -144,22 +144,7 @@ "uniStatistics" : { "enable" : true }, - "nativePlugins" : { - "DC-PushSound" : { - "__plugin_info__" : { - "name" : "自定义推送铃声(iOS)", - "description" : "自定义iOS推送铃声", - "platforms" : "iOS", - "url" : "https://ext.dcloud.net.cn/plugin?id=690", - "android_package_name" : "paper.shopkeeper.sdk", - "ios_bundle_id" : "com.qniao.paper.shopkeeper", - "isCloud" : true, - "bought" : 1, - "pid" : "690", - "parameters" : {} - } - } - } + "nativePlugins" : {} }, /* 快应用特有相关 */ "quickapp" : {}, diff --git a/nativeplugins/DC-PushSound/ios/pushsound.caf b/nativeplugins/DC-PushSound/ios/pushsound.caf deleted file mode 100644 index e699d36..0000000 Binary files a/nativeplugins/DC-PushSound/ios/pushsound.caf and /dev/null differ diff --git a/pages/credit-company-order/index.vue b/pages/credit-company-order/index.vue index 46e6c45..3331d88 100644 --- a/pages/credit-company-order/index.vue +++ b/pages/credit-company-order/index.vue @@ -71,6 +71,7 @@ + 暂无相关订单 diff --git a/pages/mall/index.vue b/pages/mall/index.vue index 2ef0312..3dc4048 100644 --- a/pages/mall/index.vue +++ b/pages/mall/index.vue @@ -64,14 +64,14 @@ - + 纸商城 - + 请先完善企业基本信息 - + @@ -113,13 +113,13 @@ export default { abs = getTimer(value) } return abs - }, + } }, data() { return { shareInfo: { storeCodeImg: '', - storeName: '', + storeName: '' }, visible: false, // 分享弹窗 shareAreaVisible: false, // 底部弹窗 @@ -127,17 +127,17 @@ export default { supplierId: null, name: null, productNumber: 0, - currentProductNumber: 0, + currentProductNumber: 0 }, option: { size: 10, auto: true, emptyText: '暂无数据~', - disabled: false, + disabled: false }, pattern: { backgroundColor: '#007AFF', - buttonColor: '#007AFF', + buttonColor: '#007AFF' }, content: [], horizontal: 'right', @@ -148,12 +148,12 @@ export default { pageSize: 10, storeId: null, name: null, - supplierId: this.$store.state.supplierInfo.supplierId, + supplierId: this.$store.state.supplierInfo.supplierId }, listData: [], logo: '/static/imgs/mine/user-avatar.png', backgroundStyle: 'background: url("/static/imgs/mall/top-bg.png") no-repeat;', - storeInfo: '', + storeInfo: '' } }, computed: { @@ -162,12 +162,12 @@ export default { }, hasLogin() { return this.$store.state.qnToken != '' - }, + } }, onShow() { if (this.hasCompany) { this.storeInformation = { - supplierId: this.$store.state.supplierInfo.supplierId, + supplierId: this.$store.state.supplierInfo.supplierId } this.downCallback() this.getSupplier(this.$store.state.supplierInfo.supplierId) @@ -176,7 +176,8 @@ export default { methods: { back, loginChange() { - go2('login') + this.$store.commit('setNextPage', { name: 'mall' }) + go2('login', {}, true) }, // 获取上新商品数量 getSupplier(id) { @@ -205,6 +206,9 @@ export default { }, // 获取纸品列表 queryData() { + if (!this.hasCompany || !this.hasLogin) { + return + } return new Promise((resolve, reject) => { SupplierList({ ...this.orderPagination }) .then((res) => { @@ -249,7 +253,7 @@ export default { // 按钮点击事件 nativeTo() { var params = { - title: '添加纸品', + title: '添加纸品' } go2('add-paper', params) }, @@ -257,7 +261,7 @@ export default { editPaper(item) { var params = { ...item, - title: '编辑纸品', + title: '编辑纸品' } go2('add-paper', params) }, @@ -273,13 +277,13 @@ export default { productStatusChange(item) { var params = { id: item.id, - status: item.status === 30111 ? 30112 : 30111, + status: item.status === 30111 ? 30112 : 30111 } productStatus(params).then((res) => { if (res) { uni.showToast({ title: '状态修改成功', - icon: 'success', + icon: 'success' }) setTimeout(() => { this.orderPagination.pageNum = 1 @@ -295,7 +299,7 @@ export default { return } getSupplierQrCode({ - mallSupplierId: this.$store.state.supplierInfo.supplierId, + mallSupplierId: this.$store.state.supplierInfo.supplierId }).then((res) => { if (res) { this.visible = true @@ -306,7 +310,7 @@ export default { } else { uni.showToast({ title: '请先完善企业信息', - icon: 'none', + icon: 'none' }) } }, @@ -331,13 +335,13 @@ export default { }, fail: (err) => { console.log('err', err) - }, + } }) }, showShareArea() { this.shareAreaVisible = true - }, - }, + } + } } diff --git a/utils/hook.js b/utils/hook.js index f893362..d49c9cf 100644 --- a/utils/hook.js +++ b/utils/hook.js @@ -11,7 +11,7 @@ const tabList = ['client', 'trade', 'mall', 'mine'] export function tab2(tabPage) { if (tabList.includes(tabPage)) { uni.switchTab({ - url: `/pages/${tabPage}/index`, + url: `/pages/${tabPage}/index` }) } } @@ -22,7 +22,7 @@ export function tab2(tabPage) { export function back() { if (getCurrentPages().length > 1) { uni.navigateBack({ - delta: 1, + delta: 1 }) } else { go2('client') @@ -51,16 +51,16 @@ export function go2(url, data = {}, isRedirect = false) { }) if (tabList.includes(url)) { uni.switchTab({ - url: `/pages/${url}/index${param ? '?' + param : ''}`, + url: `/pages/${url}/index${param ? '?' + param : ''}` }) } else { if (isRedirect) { uni.redirectTo({ - url: `/pages/${url}/index${param ? '?' + param : ''}`, + url: `/pages/${url}/index${param ? '?' + param : ''}` }) } else { uni.navigateTo({ - url: `/pages/${url}/index${param ? '?' + param : ''}`, + url: `/pages/${url}/index${param ? '?' + param : ''}` }) } } @@ -88,11 +88,12 @@ export function loginGo2(url, data = {}, isRedirect) { * @return {null} */ export function exit(redirect = false) { - store.dispatch('logout') // #ifdef APP-PLUS let cid = plus.push.getClientInfo().clientid let platform = uni.getSystemInfoSync().platform - pushCustomerOff(cid, platform) + pushCustomerOff(cid, platform).then((res) => { + store.dispatch('logout') + }) // #endif go2('login', {}, redirect) } @@ -125,7 +126,7 @@ export function uploadImage(sourceType = ['album', 'camera'], count = 1) { fail: (err) => { console.error('chooseImage error:', err) resolve(null) - }, + } }) }) } @@ -144,7 +145,7 @@ export function uploadFile(path, type = 'image') { name: type, header: { Authorization: store.state.qnToken, - 'X-APP-ID': XAPPID, + 'X-APP-ID': XAPPID }, // fileType: type, success: (res) => { @@ -159,7 +160,7 @@ export function uploadFile(path, type = 'image') { fail: (err) => { console.error('uploadFile error:', err) reject(err) - }, + } }) }) } @@ -190,9 +191,9 @@ export function screenShot() { uni.showToast({ title: '保存图片成功', mask: false, - duration: 1500, + duration: 1500 }) - }, + } }) }, function (e) { @@ -200,7 +201,7 @@ export function screenShot() { uni.showToast({ title: '保存图片失败,请手动截图', mask: false, - duration: 1500, + duration: 1500 }) } ) @@ -210,7 +211,7 @@ export function screenShot() { uni.showToast({ title: '保存图片失败,请手动截图', mask: false, - duration: 1500, + duration: 1500 }) } ) @@ -239,7 +240,7 @@ export function saveBase64ToTempFile(base64) { bitmap.save( url, { - overwrite: true, + overwrite: true }, () => { bitmap.clear() @@ -265,7 +266,7 @@ export function saveImageToPhotosAlbum(path) { uni.showToast({ title: '保存图片成功', mask: false, - duration: 1500, + duration: 1500 }) resolve() }, @@ -273,10 +274,10 @@ export function saveImageToPhotosAlbum(path) { uni.showToast({ title: '保存图片失败,请手动截图', mask: false, - duration: 1500, + duration: 1500 }) resolve() - }, + } }) }) }