mo-bai 4 years ago
parent
commit
bb8a4b9eb1
9 changed files with 77 additions and 102 deletions
  1. 19
      App.vue
  2. 12
      apis/commonApi.js
  3. 4
      env/index.js
  4. 39
      hybrid/html/share.html
  5. 19
      manifest.json
  6. BIN
      nativeplugins/DC-PushSound/ios/pushsound.caf
  7. 1
      pages/credit-company-order/index.vue
  8. 48
      pages/mall/index.vue
  9. 37
      utils/hook.js

19
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 () {}
}
</script>

12
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
})
}

4
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

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>

19
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" : {},

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

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

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

48
pages/mall/index.vue

@ -64,14 +64,14 @@
<view class="offer-prices" @click="nativeTo()"><image class="my-image" src="../../static/imgs/trade/camera.png"></image></view>
</view>
</view>
<view v-else>
<view v-show="!hasCompany || !hasLogin">
<uni-nav-bar :fixed="true" :status-bar="true">
<view slot="left" style="font-size: 40rpx; color: #000000">纸商城</view>
</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>
</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 class="flex-col section_4" v-show="visible">
<image src="/static/imgs/mall/close-icon.png" class="image_9" @click="closeShare" />
@ -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
},
},
}
}
}
</script>

37
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()
},
}
})
})
}
Loading…
Cancel
Save