Browse Source

删除语音推送插件

devlop
邓雄飞 4 years ago
parent
commit
cbeb1a8fea
8 changed files with 76 additions and 100 deletions
  1. 20
      App.vue
  2. 12
      apis/commonApi.js
  3. 39
      hybrid/html/share.html
  4. 17
      manifest.json
  5. BIN
      nativeplugins/DC-PushSound/ios/pushsound.caf
  6. 1
      pages/credit-company-order/index.vue
  7. 50
      pages/mall/index.vue
  8. 37
      utils/hook.js

20
App.vue

@ -3,6 +3,7 @@ import { go2 } from '@/utils/hook.js'
import { isString } from '@/utils/is.js' import { isString } from '@/utils/is.js'
import store from '@/store/index.js' import store from '@/store/index.js'
import handlePushMsg from '@/utils/handlePushMsg.js' import handlePushMsg from '@/utils/handlePushMsg.js'
import { checkUpdate } from '@/apis/commonApi.js'
export default { export default {
onLaunch: function () { onLaunch: function () {
const token = store.state.qnToken const token = store.state.qnToken
@ -14,12 +15,12 @@ export default {
go2('client') go2('client')
} }
// #ifdef APP-PLUS // #ifdef APP-PLUS
let client = uni.getSystemInfoSync().platform let client = uni.getSystemInfoSync().platform
setTimeout(() => { setTimeout(() => {
plus.push.addEventListener( plus.push.addEventListener(
'click', 'click',
function (msg) { function (msg) {
console.log('click msg',msg)
handlePushMsg(msg) handlePushMsg(msg)
}, },
false false
@ -37,7 +38,7 @@ export default {
let title = msg.title let title = msg.title
let payload = JSON.stringify(msg.payload) let payload = JSON.stringify(msg.payload)
plus.push.createMessage(content, payload, { plus.push.createMessage(content, payload, {
title: title,
title: title
}) })
if (msg.payload.messageType == 4) { if (msg.payload.messageType == 4) {
enquiryVoice() enquiryVoice()
@ -45,10 +46,11 @@ export default {
} }
} }
if (client === 'android') { if (client === 'android') {
console.log('receive msg',msg)
let title = msg.title let title = msg.title
let content = msg.content let content = msg.content
plus.push.createMessage(content, JSON.stringify(msg.payload), { plus.push.createMessage(content, JSON.stringify(msg.payload), {
title: title,
title: title
}) })
if (msg.payload.messageType == 4) { if (msg.payload.messageType == 4) {
enquiryVoice() enquiryVoice()
@ -79,12 +81,22 @@ export default {
}) })
}, 3000) }, 3000)
} }
// app
//#ifdef APP-PLUS
checkUpdate().then((version) => {
let curVersion = plus.runtime.version
// if(version != curVersion) {
// plus.runtime.openURL(`https://www.pgyer.com/ST8i`)
// }
console.log(version, curVersion)
})
//#endif
}, },
onShow: function () { onShow: function () {
// //
plus.runtime.setBadgeNumber(0) plus.runtime.setBadgeNumber(0)
}, },
onHide: function () {},
onHide: function () {}
} }
</script> </script>

12
apis/commonApi.js

@ -159,3 +159,15 @@ export function getFrontIdCardOcr(data = {}) {
data: 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
})
}

39
hybrid/html/share.html

@ -1,39 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.qrcode {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<image class="qrcode">
</image>
</body>
<script>
document.addEventListener('plusready', function () {
console.log('window', window.location.search)
let params = {}
window.location.search.substr(1).split('&').forEach(item => {
const [key, value] = item.split('=')
params[key] = decodeURI(value)
})
console.log(JSON.stringify(params))
if (params.img) {
const img = document.querySelector('.qrcode')
img.src = params.img
}
});
</script>
</html>

17
manifest.json

@ -144,22 +144,7 @@
"uniStatistics" : { "uniStatistics" : {
"enable" : true "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" : {}, "quickapp" : {},

BIN
nativeplugins/DC-PushSound/ios/pushsound.caf

1
pages/credit-company-order/index.vue

@ -71,6 +71,7 @@
</view> </view>
</view> </view>
</view> </view>
<view v-show="!orderList || orderList.length == 0" class="flex-row-center-center" style="margin-top: 20rpx">暂无相关订单</view>
</view> </view>
</template> </template>

50
pages/mall/index.vue

@ -1,6 +1,6 @@
<template> <template>
<view style="position: relative"> <view style="position: relative">
<view v-if="hasCompany && hasLogin" class="wrapper">
<view v-show="hasCompany && hasLogin" class="wrapper">
<uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true"> <uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true">
<view slot="left" class="left-title">纸商城</view> <view slot="left" class="left-title">纸商城</view>
<view slot="right" class="right-title" @tap="shareTap">分享</view> <view slot="right" class="right-title" @tap="shareTap">分享</view>
@ -64,14 +64,14 @@
<view class="offer-prices" @click="nativeTo()"><image class="my-image" src="../../static/imgs/trade/camera.png"></image></view> <view class="offer-prices" @click="nativeTo()"><image class="my-image" src="../../static/imgs/trade/camera.png"></image></view>
</view> </view>
</view> </view>
<view v-else>
<view v-show="!hasCompany || !hasLogin">
<uni-nav-bar :fixed="true" :status-bar="true"> <uni-nav-bar :fixed="true" :status-bar="true">
<view slot="left" style="font-size: 40rpx; color: #000000">纸商城</view> <view slot="left" style="font-size: 40rpx; color: #000000">纸商城</view>
</uni-nav-bar> </uni-nav-bar>
<view v-if="hasLogin && !hasCompany" class="flex-col-center-center" style="margin-top: 100rpx">
<view v-show="hasLogin && !hasCompany" class="flex-col-center-center" style="margin-top: 100rpx">
<text style="font-size: 30rpx; text-align: center; font-weight: 600">请先完善企业基本信息</text> <text style="font-size: 30rpx; text-align: center; font-weight: 600">请先完善企业基本信息</text>
</view> </view>
<view class="" v-if="!hasLogin"><not-logged @loginChange="loginChange()"></not-logged></view>
<view class="" v-show="!hasLogin"><not-logged @loginChange="loginChange()"></not-logged></view>
</view> </view>
<view class="flex-col section_4" v-show="visible"> <view class="flex-col section_4" v-show="visible">
<image src="/static/imgs/mall/close-icon.png" class="image_9" @click="closeShare" /> <image src="/static/imgs/mall/close-icon.png" class="image_9" @click="closeShare" />
@ -113,13 +113,13 @@ export default {
abs = getTimer(value) abs = getTimer(value)
} }
return abs return abs
},
}
}, },
data() { data() {
return { return {
shareInfo: { shareInfo: {
storeCodeImg: '', storeCodeImg: '',
storeName: '',
storeName: ''
}, },
visible: false, // visible: false, //
shareAreaVisible: false, // shareAreaVisible: false, //
@ -127,17 +127,17 @@ export default {
supplierId: null, supplierId: null,
name: null, name: null,
productNumber: 0, productNumber: 0,
currentProductNumber: 0,
currentProductNumber: 0
}, },
option: { option: {
size: 10, size: 10,
auto: true, auto: true,
emptyText: '暂无数据~', emptyText: '暂无数据~',
disabled: false,
disabled: false
}, },
pattern: { pattern: {
backgroundColor: '#007AFF', backgroundColor: '#007AFF',
buttonColor: '#007AFF',
buttonColor: '#007AFF'
}, },
content: [], content: [],
horizontal: 'right', horizontal: 'right',
@ -148,12 +148,12 @@ export default {
pageSize: 10, pageSize: 10,
storeId: null, storeId: null,
name: null, name: null,
supplierId: this.$store.state.supplierInfo.supplierId,
supplierId: this.$store.state.supplierInfo.supplierId
}, },
listData: [], listData: [],
logo: '/static/imgs/mine/user-avatar.png', logo: '/static/imgs/mine/user-avatar.png',
backgroundStyle: 'background: url("/static/imgs/mall/top-bg.png") no-repeat;', backgroundStyle: 'background: url("/static/imgs/mall/top-bg.png") no-repeat;',
storeInfo: '',
storeInfo: ''
} }
}, },
computed: { computed: {
@ -162,12 +162,12 @@ export default {
}, },
hasLogin() { hasLogin() {
return this.$store.state.qnToken != '' return this.$store.state.qnToken != ''
},
}
}, },
onShow() { onShow() {
if (this.hasCompany) { if (this.hasCompany) {
this.storeInformation = { this.storeInformation = {
supplierId: this.$store.state.supplierInfo.supplierId,
supplierId: this.$store.state.supplierInfo.supplierId
} }
this.downCallback() this.downCallback()
this.getSupplier(this.$store.state.supplierInfo.supplierId) this.getSupplier(this.$store.state.supplierInfo.supplierId)
@ -176,7 +176,8 @@ export default {
methods: { methods: {
back, back,
loginChange() { loginChange() {
go2('login')
this.$store.commit('setNextPage', { name: 'mall' })
go2('login', {}, true)
}, },
// //
getSupplier(id) { getSupplier(id) {
@ -205,6 +206,9 @@ export default {
}, },
// //
queryData() { queryData() {
if (!hasCompany || !hasLogin) {
return
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
SupplierList({ ...this.orderPagination }) SupplierList({ ...this.orderPagination })
.then((res) => { .then((res) => {
@ -249,7 +253,7 @@ export default {
// //
nativeTo() { nativeTo() {
var params = { var params = {
title: '添加纸品',
title: '添加纸品'
} }
go2('add-paper', params) go2('add-paper', params)
}, },
@ -257,7 +261,7 @@ export default {
editPaper(item) { editPaper(item) {
var params = { var params = {
...item, ...item,
title: '编辑纸品',
title: '编辑纸品'
} }
go2('add-paper', params) go2('add-paper', params)
}, },
@ -273,13 +277,13 @@ export default {
productStatusChange(item) { productStatusChange(item) {
var params = { var params = {
id: item.id, id: item.id,
status: item.status === 30111 ? 30112 : 30111,
status: item.status === 30111 ? 30112 : 30111
} }
productStatus(params).then((res) => { productStatus(params).then((res) => {
if (res) { if (res) {
uni.showToast({ uni.showToast({
title: '状态修改成功', title: '状态修改成功',
icon: 'success',
icon: 'success'
}) })
setTimeout(() => { setTimeout(() => {
this.orderPagination.pageNum = 1 this.orderPagination.pageNum = 1
@ -295,7 +299,7 @@ export default {
return return
} }
getSupplierQrCode({ getSupplierQrCode({
mallSupplierId: this.$store.state.supplierInfo.supplierId,
mallSupplierId: this.$store.state.supplierInfo.supplierId
}).then((res) => { }).then((res) => {
if (res) { if (res) {
this.visible = true this.visible = true
@ -306,7 +310,7 @@ export default {
} else { } else {
uni.showToast({ uni.showToast({
title: '请先完善企业信息', title: '请先完善企业信息',
icon: 'none',
icon: 'none'
}) })
} }
}, },
@ -331,13 +335,13 @@ export default {
}, },
fail: (err) => { fail: (err) => {
console.log('err', err) console.log('err', err)
},
}
}) })
}, },
showShareArea() { showShareArea() {
this.shareAreaVisible = true this.shareAreaVisible = true
},
},
}
}
} }
</script> </script>

37
utils/hook.js

@ -11,7 +11,7 @@ const tabList = ['client', 'trade', 'mall', 'mine']
export function tab2(tabPage) { export function tab2(tabPage) {
if (tabList.includes(tabPage)) { if (tabList.includes(tabPage)) {
uni.switchTab({ uni.switchTab({
url: `/pages/${tabPage}/index`,
url: `/pages/${tabPage}/index`
}) })
} }
} }
@ -22,7 +22,7 @@ export function tab2(tabPage) {
export function back() { export function back() {
if (getCurrentPages().length > 1) { if (getCurrentPages().length > 1) {
uni.navigateBack({ uni.navigateBack({
delta: 1,
delta: 1
}) })
} else { } else {
go2('client') go2('client')
@ -51,16 +51,16 @@ export function go2(url, data = {}, isRedirect = false) {
}) })
if (tabList.includes(url)) { if (tabList.includes(url)) {
uni.switchTab({ uni.switchTab({
url: `/pages/${url}/index${param ? '?' + param : ''}`,
url: `/pages/${url}/index${param ? '?' + param : ''}`
}) })
} else { } else {
if (isRedirect) { if (isRedirect) {
uni.redirectTo({ uni.redirectTo({
url: `/pages/${url}/index${param ? '?' + param : ''}`,
url: `/pages/${url}/index${param ? '?' + param : ''}`
}) })
} else { } else {
uni.navigateTo({ 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} * @return {null}
*/ */
export function exit(redirect = false) { export function exit(redirect = false) {
store.dispatch('logout')
// #ifdef APP-PLUS // #ifdef APP-PLUS
let cid = plus.push.getClientInfo().clientid let cid = plus.push.getClientInfo().clientid
let platform = uni.getSystemInfoSync().platform let platform = uni.getSystemInfoSync().platform
pushCustomerOff(cid, platform)
pushCustomerOff(cid, platform).then((res) => {
store.dispatch('logout')
})
// #endif // #endif
go2('login', {}, redirect) go2('login', {}, redirect)
} }
@ -125,7 +126,7 @@ export function uploadImage(sourceType = ['album', 'camera'], count = 1) {
fail: (err) => { fail: (err) => {
console.error('chooseImage error:', err) console.error('chooseImage error:', err)
resolve(null) resolve(null)
},
}
}) })
}) })
} }
@ -144,7 +145,7 @@ export function uploadFile(path, type = 'image') {
name: type, name: type,
header: { header: {
Authorization: store.state.qnToken, Authorization: store.state.qnToken,
'X-APP-ID': XAPPID,
'X-APP-ID': XAPPID
}, },
// fileType: type, // fileType: type,
success: (res) => { success: (res) => {
@ -159,7 +160,7 @@ export function uploadFile(path, type = 'image') {
fail: (err) => { fail: (err) => {
console.error('uploadFile error:', err) console.error('uploadFile error:', err)
reject(err) reject(err)
},
}
}) })
}) })
} }
@ -190,9 +191,9 @@ export function screenShot() {
uni.showToast({ uni.showToast({
title: '保存图片成功', title: '保存图片成功',
mask: false, mask: false,
duration: 1500,
duration: 1500
}) })
},
}
}) })
}, },
function (e) { function (e) {
@ -200,7 +201,7 @@ export function screenShot() {
uni.showToast({ uni.showToast({
title: '保存图片失败,请手动截图', title: '保存图片失败,请手动截图',
mask: false, mask: false,
duration: 1500,
duration: 1500
}) })
} }
) )
@ -210,7 +211,7 @@ export function screenShot() {
uni.showToast({ uni.showToast({
title: '保存图片失败,请手动截图', title: '保存图片失败,请手动截图',
mask: false, mask: false,
duration: 1500,
duration: 1500
}) })
} }
) )
@ -239,7 +240,7 @@ export function saveBase64ToTempFile(base64) {
bitmap.save( bitmap.save(
url, url,
{ {
overwrite: true,
overwrite: true
}, },
() => { () => {
bitmap.clear() bitmap.clear()
@ -265,7 +266,7 @@ export function saveImageToPhotosAlbum(path) {
uni.showToast({ uni.showToast({
title: '保存图片成功', title: '保存图片成功',
mask: false, mask: false,
duration: 1500,
duration: 1500
}) })
resolve() resolve()
}, },
@ -273,10 +274,10 @@ export function saveImageToPhotosAlbum(path) {
uni.showToast({ uni.showToast({
title: '保存图片失败,请手动截图', title: '保存图片失败,请手动截图',
mask: false, mask: false,
duration: 1500,
duration: 1500
}) })
resolve() resolve()
},
}
}) })
}) })
} }
Loading…
Cancel
Save