Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lumastoreapp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xieyishang
lumastoreapp
Commits
6abaf387
Commit
6abaf387
authored
Oct 31, 2024
by
xieyishang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~~
parent
22c7b4dd
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
739 additions
and
5 deletions
+739
-5
components/showxieyi/showxieyi.vue
components/showxieyi/showxieyi.vue
+1
-1
main.js
main.js
+16
-0
manifest.json
manifest.json
+2
-2
pages/setup/setup.vue
pages/setup/setup.vue
+1
-1
pages/user/fenxiao/addcard/addcard.vue
pages/user/fenxiao/addcard/addcard.vue
+11
-1
utils/js_sdk/AS-NotifyTheAuthority/index.js
utils/js_sdk/AS-NotifyTheAuthority/index.js
+144
-0
utils/js_sdk/AS-NotifyTheAuthority/package.json
utils/js_sdk/AS-NotifyTheAuthority/package.json
+20
-0
utils/js_sdk/index.js
utils/js_sdk/index.js
+270
-0
utils/js_sdk/permission.js
utils/js_sdk/permission.js
+274
-0
No files found.
components/showxieyi/showxieyi.vue
View file @
6abaf387
...
...
@@ -7,7 +7,7 @@
<text
class=
"uni-tip-title"
>
用户协议和隐私政策
</text>
<view
class=
"uni-tip-content flex ali-c"
>
请您务必审慎阅读、充分理解"用户协议"和"隐私政策"各条款,包括但不限于为您提供软件内容的服务,我们需要收集您的设备信息、操作日志等个人信息您可以在设置中查看个人信息并修改你的信息您可阅读
<navigator
class=
"xieyitags"
url=
"/pages/Agreement/Agreementuser"
>
《用户协议》
</navigator>
和
<navigator
class=
"xieyitags"
url=
"/pages/Agreement/Agreement"
>
《隐私政策》
</navigator>
了解详细信息。如您同意,请点击"同意"开始接受我们的服务
</view>
<view
class=
"uni-tip-group-button"
>
<text
class=
"uni-tip-button"
@
click=
"cancel('tip')"
>
暂不使用
</text>
<text
class=
"uni-tip-button"
@
click=
"cancel('tip')"
>
拒绝
</text>
<text
class=
"uni-tip-button"
@
click=
"tongyi('tip')"
>
同意
</text>
</view>
</view>
...
...
main.js
View file @
6abaf387
...
...
@@ -6,6 +6,22 @@ import store from './store'//状态管理
import
LbPicker
from
'
@/components/lb-picker
'
Vue
.
component
(
"
lb-picker
"
,
LbPicker
)
//权限申请
import
{
addPermisionInterceptor
}
from
'
@/utils/js_sdk/index.js
'
addPermisionInterceptor
(
'
scanCode
'
,
'
为了扫码从相册获取图片, 我们需要申请您设备的相机和照片读取权限
'
);
//OK
addPermisionInterceptor
(
'
makePhoneCall
'
,
'
为了联系客服/用户/咨询等, 我们需要申请您设备的拨打电话权限
'
);
//OK
addPermisionInterceptor
(
'
chooseImage
'
,
'
为了上传产品资料和完善商户资料等, 我们需要申请您设备的相机和存储权限
'
)
addPermisionInterceptor
(
'
chooseVideo
'
,
'
为了发布产品图片视频等, 我们需要申请您设备的相机和存储权限
'
)
addPermisionInterceptor
(
'
saveImageToPhotosAlbum
'
,
'
为了保存商家码到手机相册, 我们需要申请您设备的存储权限
'
)
addPermisionInterceptor
(
'
chooseLocation
'
,
'
为了获取你的经营地址位置, 我们需要获取你的位置权限
'
)
import
{
getTimeOut
,
timestampToTime
,
//10位时间戳 转年月日时分秒
...
...
manifest.json
View file @
6abaf387
...
...
@@ -2,8 +2,8 @@
"name"
:
"鹿马商家助手"
,
"appid"
:
"__UNI__1EA80F1"
,
//这个是
web
的
"description"
:
"商家"
,
"versionName"
:
"1.20
2
"
,
"versionCode"
:
120
2
,
"versionName"
:
"1.20
6
"
,
"versionCode"
:
120
6
,
"transformPx"
:
false
,
"compatible"
:
{
"ignoreVersion"
:
true
//
true
表示忽略版本检查提示框,HBuilderX
1.9
.
0
及以上版本支持
...
...
pages/setup/setup.vue
View file @
6abaf387
...
...
@@ -76,7 +76,7 @@
<image
class=
"jiantousi"
src=
"/static/news/jiantousi.png"
mode=
""
></image>
</navigator>
<navigator
url=
"/pages/Agreement/Agreement"
class=
"list-cell b-b"
hover-class=
"cell-hover"
:hover-stay-time=
"50"
>
<text
class=
"cell-tit"
>
隐私
策略
</text>
<text
class=
"cell-tit"
>
隐私
政策
</text>
<image
class=
"jiantousi"
src=
"/static/news/jiantousi.png"
mode=
""
></image>
</navigator>
<view
class=
"list-cell b-b"
hover-class=
"cell-hover"
@
click=
"go"
:hover-stay-time=
"50"
>
...
...
pages/user/fenxiao/addcard/addcard.vue
View file @
6abaf387
...
...
@@ -55,7 +55,17 @@
};
},
onLoad
(
option
)
{
this
.
$showModal
({
title
:
'
温馨提示
'
,
concent
:
'
系统添加银行卡需要你填写(开户行 银行卡号 开户支行 姓名)是否同意?
'
,
confirmVal
:
'
同意
'
,
cancelVal
:
'
取消
'
,
}).
then
(
res
=>
{
}).
catch
(()
=>
{
uni
.
navigateBack
();
})
},
...
...
utils/js_sdk/AS-NotifyTheAuthority/index.js
0 → 100644
View file @
6abaf387
/**
* https://ext.dcloud.net.cn/plugin?id=11947
* 当前通知权限开启查询
* @returns {Boolean} true:已开启 false:未开启
*/
import
sj_show_modal
from
'
../../../components/G_show_modal/index.js
'
;
//弹窗
const
$showModal
=
(
op
=
{})
=>
{
console
.
info
(
"
ddd
"
);
return
new
Promise
((
resolve
,
reject
)
=>
{
let
ssm
=
new
sj_show_modal
({
...
op
,
$event
:
(
e
)
=>
{
if
(
e
.
res
)
{
resolve
(
e
);
}
else
{
reject
(
e
);
}
}
})
ssm
.
show
();
})
}
export
const
isNotificationsEnabled
=
()
=>
{
// #ifdef APP-PLUS
if
(
plus
.
os
.
name
==
'
Android
'
)
{
// 判断是Android
var
main
=
plus
.
android
.
runtimeMainActivity
()
var
NotificationManagerCompat
=
plus
.
android
.
importClass
(
'
android.support.v4.app.NotificationManagerCompat
'
)
if
(
NotificationManagerCompat
==
null
)
{
NotificationManagerCompat
=
plus
.
android
.
importClass
(
'
androidx.core.app.NotificationManagerCompat
'
)
}
// 返回是否有权限
return
NotificationManagerCompat
.
from
(
main
).
areNotificationsEnabled
()
}
else
if
(
plus
.
os
.
name
==
'
iOS
'
)
{
// 判断是iOS
var
isOn
=
undefined
var
types
=
0
var
app
=
plus
.
ios
.
invoke
(
'
UIApplication
'
,
'
sharedApplication
'
)
var
settings
=
plus
.
ios
.
invoke
(
app
,
'
currentUserNotificationSettings
'
)
if
(
settings
)
{
types
=
settings
.
plusGetAttribute
(
'
types
'
)
plus
.
ios
.
deleteObject
(
settings
)
}
else
{
types
=
plus
.
ios
.
invoke
(
app
,
'
enabledRemoteNotificationTypes
'
)
}
plus
.
ios
.
deleteObject
(
app
)
isOn
=
0
!=
types
// 返回是否有权限
return
isOn
}
// #endif
}
/**
* 前往系统设置的功能
* @param {Boolean} type true:开启 false:关闭
* @returns
*/
export
const
permissions
=
(
type
)
=>
{
// #ifdef APP-PLUS
if
(
plus
.
os
.
name
==
'
Android
'
)
{
// 判断是Android
var
main
=
plus
.
android
.
runtimeMainActivity
()
var
pkName
=
main
.
getPackageName
()
var
uid
=
main
.
getApplicationInfo
().
plusGetAttribute
(
'
uid
'
)
$showModal
({
title
:
`通知权限
${
type
?
'
开启
'
:
'
关闭
'
}
提醒`
,
concent
:
`是否前往设置
${
type
?
'
开启
'
:
'
关闭
'
}
通知权限?`
,
confirmVal
:
'
确定
'
,
cancelVal
:
'
取消
'
,
}).
then
(
res
=>
{
var
Intent
=
plus
.
android
.
importClass
(
'
android.content.Intent
'
)
var
Build
=
plus
.
android
.
importClass
(
'
android.os.Build
'
)
//android 8.0引导
if
(
Build
.
VERSION
.
SDK_INT
>=
26
)
{
var
intent
=
new
Intent
(
'
android.settings.APP_NOTIFICATION_SETTINGS
'
)
intent
.
putExtra
(
'
android.provider.extra.APP_PACKAGE
'
,
pkName
)
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
21
)
{
//android 5.0-7.0
var
intent
=
new
Intent
(
'
android.settings.APP_NOTIFICATION_SETTINGS
'
)
intent
.
putExtra
(
'
app_package
'
,
pkName
)
intent
.
putExtra
(
'
app_uid
'
,
uid
)
}
else
{
//(<21)其他--跳转到该应用管理的详情页
intent
.
setAction
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
)
var
uri
=
Uri
.
fromParts
(
'
package
'
,
mainActivity
.
getPackageName
(),
null
)
intent
.
setData
(
uri
)
}
// 跳转到该应用的系统通知设置页
main
.
startActivity
(
intent
)
}).
catch
(
err
=>
{
console
.
log
(
'
err
'
,
err
)
console
.
log
(
'
点击了取消
'
)
})
}
else
if
(
plus
.
os
.
name
==
'
iOS
'
)
{
// 判断是iOS
var
app
=
plus
.
ios
.
invoke
(
'
UIApplication
'
,
'
sharedApplication
'
)
plus
.
ios
.
deleteObject
(
app
)
$showModal
({
title
:
`通知权限
${
type
?
'
开启
'
:
'
关闭
'
}
提醒`
,
concent
:
`是否前往设置
${
type
?
'
开启
'
:
'
关闭
'
}
通知权限?`
,
confirmVal
:
'
确定
'
,
cancelVal
:
'
取消
'
,
}).
then
(
res
=>
{
var
app
=
plus
.
ios
.
invoke
(
'
UIApplication
'
,
'
sharedApplication
'
)
var
setting
=
plus
.
ios
.
invoke
(
'
NSURL
'
,
'
URLWithString:
'
,
'
app-settings:
'
)
plus
.
ios
.
invoke
(
app
,
'
openURL:
'
,
setting
)
plus
.
ios
.
deleteObject
(
setting
)
plus
.
ios
.
deleteObject
(
app
)
}).
catch
(
err
=>
{
console
.
log
(
'
err
'
,
err
)
console
.
log
(
'
点击了取消
'
)
})
}
// #endif
}
\ No newline at end of file
utils/js_sdk/AS-NotifyTheAuthority/package.json
0 → 100644
View file @
6abaf387
{
"id"
:
"AS-NotifyTheAuthority"
,
"name"
:
"AS-NotifyTheAuthority(推送通知权限查询与前往设置的功能)"
,
"displayName"
:
"AS-NotifyTheAuthority(推送通知权限查询与前往设置的功能)"
,
"version"
:
"1.0.1"
,
"description"
:
"Android(安卓)IOS(苹果)的推送通知权限查询与前往设置的功能"
,
"keywords"
:
[
"通知权限"
,
"推送权限"
,
"ios通知"
,
"安卓通知"
,
"通知"
],
"dcloudext"
:
{
"category"
:
[
"JS SDK"
,
"通用 SDK"
]
}
}
\ No newline at end of file
utils/js_sdk/index.js
0 → 100644
View file @
6abaf387
// https://ext.dcloud.net.cn/plugin?id=15897
import
permisionUtil
from
"
./permission.js
"
import
sj_show_modal
from
'
../../components/G_show_modal/index.js
'
;
//弹窗
const
$showModal
=
(
op
=
{})
=>
{
console
.
info
(
"
ddd
"
);
return
new
Promise
((
resolve
,
reject
)
=>
{
let
ssm
=
new
sj_show_modal
({
...
op
,
$event
:
(
e
)
=>
{
if
(
e
.
res
)
{
resolve
(
e
);
}
else
{
reject
(
e
);
}
}
})
ssm
.
show
();
})
}
const
permisionMap
=
{
//选择图片
chooseImage
:
async
function
()
{
try
{
const
status1
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.CAMERA
'
)
const
status2
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.READ_EXTERNAL_STORAGE
'
)
if
(
status1
==
1
||
status2
==
1
)
{
return
Promise
.
resolve
(
1
)
}
else
{
return
Promise
.
resolve
(
-
1
)
}
}
catch
(
e
)
{
return
Promise
.
resolve
(
0
)
}
},
//选择视频
chooseVideo
:
async
function
()
{
try
{
const
status1
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.CAMERA
'
)
const
status2
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.READ_EXTERNAL_STORAGE
'
)
if
(
status1
==
1
||
status2
==
1
)
{
return
Promise
.
resolve
(
1
)
}
else
{
return
Promise
.
resolve
(
-
1
)
}
}
catch
(
e
)
{
return
Promise
.
resolve
(
0
)
}
},
//保存图片
saveImageToPhotosAlbum
:
async
function
()
{
try
{
const
status
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.WRITE_EXTERNAL_STORAGE
'
)
return
Promise
.
resolve
(
status
)
}
catch
(
e
)
{
return
Promise
.
resolve
(
0
)
}
},
//获取经纬度
getLocation
:
async
function
()
{
try
{
const
status
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.ACCESS_FINE_LOCATION
'
)
return
Promise
.
resolve
(
status
)
}
catch
(
e
)
{
return
Promise
.
resolve
(
0
)
}
},
//打电话
makePhoneCall
:
async
function
()
{
try
{
const
status
=
await
permisionUtil
.
requestAndroidPermission
(
'
android.permission.CALL_PHONE
'
)
return
Promise
.
resolve
(
status
)
}
catch
(
e
)
{
return
Promise
.
resolve
(
0
)
}
}
}
const
resultHandler
=
function
(
args
,
err
)
{
args
.
fail
&&
args
.
fail
(
err
)
args
.
complete
&&
args
.
complete
(
err
)
}
/**
* @func addPermisionInterceptor
* @desc 添加权限申请说明
* @param {String} permisionName 要拦截的 uniApi 名称
* @param {String} content 申请权限说明信息
* @return {}
* @Author huiliyi
* @Email 1824159241@qq.com
*/
export
const
addPermisionInterceptor
=
function
(
permisionName
,
content
)
{
const
prefix
=
'
permision_
'
uni
.
addInterceptor
(
permisionName
,
{
//拦截器 https://uniapp.dcloud.net.cn/api/interceptor.html#addinterceptor
invoke
:
(
args
)
=>
{
//触发前
const
{
uniPlatform
,
platform
}
=
uni
.
getSystemInfoSync
()
if
(
uniPlatform
!=
'
app
'
||
platform
!=
"
android
"
)
return
true
return
new
Promise
(
(
resolve
,
reject
)
=>
{
//之前同意过
let
locstatus
=
uni
.
getStorageSync
(
prefix
+
permisionName
);
if
(
locstatus
==
1
)
{
resolve
(
args
)
return
}
//之前拒绝过
if
(
locstatus
===
0
||
locstatus
===
-
1
){
//拒绝后 设置成0 再店设置成-1 再点设置成 空
if
(
locstatus
===
0
){
uni
.
setStorageSync
(
prefix
+
permisionName
,
-
1
)
}
else
if
(
locstatus
===
-
1
){
uni
.
setStorageSync
(
prefix
+
permisionName
,
""
)
}
reject
(
args
)
resultHandler
(
args
,
{
errMsg
:
'
用户之前拒绝了权限请求,不再询问
'
})
console
.
info
(
"
用户之前拒绝了权限请求,不再询问
"
);
return
}
console
.
info
(
"
locstatus
"
,
locstatus
);
/*
uni.showModal({
title: '权限申请说明',
content,
cancelText: '不同意',
confirmText: '同意',
success: async (res) => {
try {
if (res.confirm) {
let status = 0
if (permisionMap[permisionName]) {
status = await permisionMap[permisionName]()
} else {
status = 1
console.error(`addPermisionInterceptor fail, ${permisionName}-未配置获取权限方法`)
}
uni.setStorageSync(prefix + permisionName, status)
if (status === 1) {
resolve(args)
}
if (status === 0) {
reject(args)
resultHandler(args, {
errMsg: '申请权限失败'
})
}
if (status === -1) {
reject(args)
resultHandler(args, {
errMsg: '用户已拒绝该权限'
})
uni.showModal({
title: '是否前往开启权限?',
cancelText: '否',
confirmText: '是',
success: (res) => {
if (res.confirm) {
permisionUtil.gotoAppPermissionSetting()
}
}
})
}
}
if (res.cancel) {
uni.setStorageSync(prefix + permisionName, 0)
reject(args)
resultHandler(args, {
errMsg: '用户不同意申请权限'
})
}
} catch (err) {
reject(args)
resultHandler(args, err)
}
},
fail: err => {
reject(args)
resultHandler(args, err)
}
})
*/
//申请弹窗
// let bool = await
$showModal
({
title
:
'
权限申请说明
'
,
concent
:
content
,
confirmVal
:
'
同意
'
,
cancelVal
:
'
不同意
'
,
}).
then
(
async
(
res
)
=>
{
try
{
let
status
=
0
if
(
permisionMap
[
permisionName
])
{
status
=
await
permisionMap
[
permisionName
]()
}
else
{
status
=
1
console
.
error
(
`addPermisionInterceptor fail,
${
permisionName
}
-未配置获取权限方法`
)
}
uni
.
setStorageSync
(
prefix
+
permisionName
,
status
)
if
(
status
===
1
)
{
resolve
(
args
)
}
if
(
status
===
0
)
{
reject
(
args
)
resultHandler
(
args
,
{
errMsg
:
'
申请权限失败
'
})
}
if
(
status
===
-
1
)
{
reject
(
args
)
resultHandler
(
args
,
{
errMsg
:
'
用户已拒绝该权限
'
})
$showModal
({
title
:
'
提示
'
,
concent
:
'
是否前往开启权限?
'
,
confirmVal
:
'
是
'
,
cancelVal
:
'
否
'
,
}).
then
(
res
=>
{
//是
permisionUtil
.
gotoAppPermissionSetting
()
}).
catch
(
err
=>
{
//否
})
}
}
catch
(
err
)
{
reject
(
args
)
resultHandler
(
args
,
err
)
}
}).
catch
((
err
)
=>
{
//不同意
console
.
info
(
"
不同意
"
);
uni
.
setStorageSync
(
prefix
+
permisionName
,
0
)
reject
(
args
)
resultHandler
(
args
,
{
errMsg
:
'
用户不同意申请权限
'
})
})
});
},
fail
(
err
)
{
console
.
log
(
'
interceptor-fail
'
,
err
)
if
(
err
.
errMsg
.
includes
(
'
fail No Permission
'
)
||
(
err
.
errMsg
==
'
getLocation:fail 获取定位权限失败
'
&&
err
.
code
==
22
))
{
uni
.
setStorageSync
(
prefix
+
permisionName
,
0
)
$showModal
({
title
:
'
提示
'
,
concent
:
'
是否前往开启权限?
'
,
confirmVal
:
'
是
'
,
cancelVal
:
'
否
'
,
}).
then
(
res
=>
{
//是
permisionUtil
.
gotoAppPermissionSetting
()
}).
catch
(
err
=>
{
//否
})
}
}
})
}
\ No newline at end of file
utils/js_sdk/permission.js
0 → 100644
View file @
6abaf387
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment