Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
A
az-uniapp-wechat-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李智书
az-uniapp-wechat-web
Commits
05c4e0c0
Commit
05c4e0c0
authored
Jul 02, 2021
by
李智书
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.新增微信用户信息查询页面
parent
09f6b1d0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
253 additions
and
29 deletions
+253
-29
App.vue
App.vue
+3
-0
main.js
main.js
+5
-1
pages.json
pages.json
+32
-28
pages/QueryMyWechat/QueryMyWechat.vue
pages/QueryMyWechat/QueryMyWechat.vue
+212
-0
template.h5.html
template.h5.html
+1
-0
No files found.
App.vue
View file @
05c4e0c0
...
@@ -15,4 +15,7 @@
...
@@ -15,4 +15,7 @@
<
style
>
<
style
>
/*每个页面公共css */
/*每个页面公共css */
@import
url("./common/css/weui.min.css")
;
@import
url("./common/css/weui.min.css")
;
/* #ifdef H5 */
@import
url("./node_modules/vant/lib/index.css")
;
/* #endif */
</
style
>
</
style
>
main.js
View file @
05c4e0c0
...
@@ -22,6 +22,10 @@ Vue.prototype.$ImgUrl = 'https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static
...
@@ -22,6 +22,10 @@ Vue.prototype.$ImgUrl = 'https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static
// #ifdef H5
// #ifdef H5
import
Vant
from
'
vant
'
;
Vue
.
use
(
Vant
);
// echarts图标
// echarts图标
// var echarts = require('echarts')
// var echarts = require('echarts')
// Vue.prototype.$echarts = echarts
// Vue.prototype.$echarts = echarts
...
@@ -32,7 +36,7 @@ Vue.prototype.$ImgUrl = 'https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static
...
@@ -32,7 +36,7 @@ Vue.prototype.$ImgUrl = 'https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static
// Vue.prototype.$jweixin = jweixin
// Vue.prototype.$jweixin = jweixin
// console.log(jweixin);
// console.log(jweixin);
import
VConsole
from
'
vconsole
'
;
import
VConsole
from
'
vconsole
'
;
const
vConsole
=
new
VConsole
();
//
const vConsole = new VConsole();
//加载es5>>js
//加载es5>>js
function
loadJs
(
path
,
callback
)
{
function
loadJs
(
path
,
callback
)
{
...
...
pages.json
View file @
05c4e0c0
...
@@ -80,33 +80,37 @@
...
@@ -80,33 +80,37 @@
}
}
}
}
}
},
{
,{
"path"
:
"pages/AccessControlModular/SchoolAttendance/SchoolAttendance"
,
"path"
:
"pages/AccessControlModular/SchoolAttendance/SchoolAttendance"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
""
,
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
}
},
{
,{
"path"
:
"pages/AccessControlModular/StudentAttendance/StudentAttendance"
,
"path"
:
"pages/AccessControlModular/StudentAttendance/StudentAttendance"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
""
,
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
}
},
{
,{
"path"
:
"pages/AccessControlModular/TeacherAttendance/TeacherAttendance"
,
"path"
:
"pages/AccessControlModular/TeacherAttendance/TeacherAttendance"
,
"style"
:
{
"style"
:
{
"navigationBarTitleText"
:
""
,
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
"enablePullDownRefresh"
:
false
}
}
},
{
"path"
:
"pages/QueryMyWechat/QueryMyWechat"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"我的微信信息"
,
"enablePullDownRefresh"
:
false
,
"h5"
:
{
"titleNView"
:
"transparent"
}
}
}
}
],
],
"globalStyle"
:
{
"globalStyle"
:
{
...
...
pages/QueryMyWechat/QueryMyWechat.vue
0 → 100644
View file @
05c4e0c0
<
template
>
<view
class=
"container"
>
<view
class=
"WechatUserInfo"
>
<view
class=
"left"
>
<image
class=
"avatarurl"
:src=
"WechatUserInfo.avatarurl"
mode=
"aspectFit"
></image>
</view>
<view
class=
"right"
>
<view
class=
"nickname"
>
昵称:
{{
WechatUserInfo
.
nickname
}}
</view>
</view>
<van-cell-group
class=
"cell-group"
>
<van-cell
label=
"点击可复制"
center
title=
"openid"
@
click=
"CellGroup(WechatUserInfo.openid)"
:clickable=
"true"
:value=
"WechatUserInfo.openid"
/>
<van-cell
label=
"点击可复制"
center
title=
"appid"
@
click=
"CellGroup(WechatUserInfo.appid)"
:clickable=
"true"
:value=
"WechatUserInfo.appid"
/>
<van-cell
label=
"点击可复制"
center
title=
"unionid"
@
click=
"CellGroup(WechatUserInfo.unionid)"
:clickable=
"true"
:value=
"WechatUserInfo.unionid"
/>
<van-cell
label=
"点击可复制"
center
title=
"用户渠道来源"
@
click=
"CellGroup(WechatUserInfo.subscribe)"
:clickable=
"true"
:value=
"WechatUserInfo.subscribe"
/>
<van-cell
label=
"点击可复制"
center
title=
"国家"
@
click=
"CellGroup(WechatUserInfo.country)"
:clickable=
"true"
:value=
"WechatUserInfo.country"
/>
<van-cell
label=
"点击可复制"
center
title=
"省份"
@
click=
"CellGroup(WechatUserInfo.province)"
:clickable=
"true"
:value=
"WechatUserInfo.province"
/>
<van-cell
label=
"点击可复制"
center
title=
"城市"
@
click=
"CellGroup(WechatUserInfo.city)"
:clickable=
"true"
:value=
"WechatUserInfo.city"
/>
<!-- //性别 0:未知、1:男、2:女 -->
<van-cell
label=
"点击可复制"
center
title=
"性别"
@
click=
"CellGroup(WechatUserInfo.gender)"
:clickable=
"true"
:value=
"['未知','男','女'][WechatUserInfo.gender]"
/>
<van-cell
label=
"点击可复制"
center
title=
"语言"
@
click=
"CellGroup(WechatUserInfo.language)"
:clickable=
"true"
:value=
"WechatUserInfo.language"
/>
</van-cell-group>
</view>
</view>
</
template
>
<
script
>
import
{
Dialog
}
from
'
vant
'
;
//公共参数
var
gHost
=
"
https://
"
+
window
.
location
.
host
;
if
(
window
.
location
.
protocol
!=
"
https:
"
)
{
gHost
=
"
http://
"
+
window
.
location
.
host
;
}
export
default
{
name
:
"
QueryMyWechat
"
,
data
()
{
return
{
WechatUserInfo
:
{
appid
:
""
,
avatarurl
:
""
,
city
:
""
,
country
:
""
,
gender
:
1
,
id
:
6496
,
language
:
""
,
nickname
:
""
,
openid
:
""
,
province
:
""
,
subscribe
:
""
,
unionid
:
""
}
}
},
onLoad
:
function
(
options
)
{
console
.
log
(
options
)
let
ua
=
navigator
.
userAgent
.
toLowerCase
();
if
(
ua
.
indexOf
(
'
micromessenger
'
)
==
-
1
)
{
Dialog
({
title
:
'
系统提示
'
,
message
:
'
请通过微信浏览器打开!
'
});
return
;
}
let
{
code
,
state
}
=
options
this
.
QueryMyWechatInfo
({
code
,
state
})
},
mounted
:
function
()
{
},
methods
:
{
async
QueryMyWechatInfo
(
params
)
{
try
{
let
sessionid
=
await
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
gHost
+
'
/mp_wechat/x/access_token
'
,
type
:
"
POST
"
,
dataType
:
"
json
"
,
contentType
:
"
application/x-www-form-urlencoded
"
,
async
:
false
,
data
:
params
,
success
:
function
(
resp1
)
{
if
(
resp1
.
code
!=
"
10000
"
)
{
reject
(
resp1
)
}
else
{
resolve
(
resp1
.
results
)
}
},
error
:
function
(
err
)
{
reject
(
err
)
}
});
})
let
results
=
await
new
Promise
((
resolve
,
reject
)
=>
{
//查询微信信息
$
.
ajax
({
url
:
gHost
+
'
/mp_wechat/svmpwechat/QueryMyWechatInfo
'
,
type
:
"
POST
"
,
dataType
:
"
json
"
,
contentType
:
"
application/x-www-form-urlencoded
"
,
async
:
false
,
data
:
{
"
mp_session_id
"
:
sessionid
},
success
:
function
(
resp2
)
{
console
.
log
(
resp2
)
if
(
resp2
.
code
!=
"
10000
"
)
{
weui
.
alert
(
resp2
.
message
,
function
()
{
console
.
log
(
'
ok
'
);
},
{
title
:
'
提示
'
});
reject
(
resp2
.
message
)
}
else
{
resolve
(
resp2
.
results
)
}
},
error
:
function
(
err2
)
{
weui
.
alert
(
err2
.
toString
(),
function
()
{
console
.
log
(
'
ok
'
);
},
{
title
:
'
ERROR
'
});
}
});
})
this
.
WechatUserInfo
=
results
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
Dialog
({
title
:
'
系统提示
'
,
message
:
'
发生错误!
'
});
}
},
CellGroup
(
value
)
{
console
.
log
(
value
);
Dialog
({
title
:
'
系统提示
'
,
message
:
'
复制成功!
'
});
uni
.
setClipboardData
({
data
:
value
,
success
:
function
()
{
console
.
log
(
'
success
'
);
},
fail
:
function
(
fail
)
{
console
.
log
(
fail
);
}
});
}
}
}
</
script
>
<
style
scoped
>
page
{
background-color
:
#f7f8fa
;
}
.container
{
width
:
700
rpx
;
margin
:
0
auto
;
background-color
:
#FFFFFF
;
}
.WechatUserInfo
{
margin-top
:
30
rpx
;
}
.WechatUserInfo
.left
{
text-align
:
center
;
height
:
250
rpx
;
line-height
:
250
rpx
;
}
.WechatUserInfo
.right
{
text-align
:
center
;
height
:
100
rpx
;
line-height
:
100
rpx
;
font-size
:
40
rpx
;
font-weight
:
bold
;
}
.WechatUserInfo
.avatarurl
{
width
:
200
rpx
;
height
:
200
rpx
;
border-radius
:
10
rpx
;
position
:
relative
;
top
:
30
rpx
;
}
.cell-group
{
margin-bottom
:
100
rpx
;
}
</
style
>
\ No newline at end of file
template.h5.html
View file @
05c4e0c0
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
(
coverSupport
?
'
, viewport-fit=cover
'
:
''
)
+
'
" />
'
)
(
coverSupport
?
'
, viewport-fit=cover
'
:
''
)
+
'
" />
'
)
</script>
</script>
<link
rel=
"stylesheet"
href=
"<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css"
/>
<link
rel=
"stylesheet"
href=
"<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css"
/>
<script
src=
"//cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.8/clipboard.min.js"
></script>
</head>
</head>
<body>
<body>
<noscript>
<noscript>
...
...
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