mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 14:19:38 +08:00
描述:扫码
This commit is contained in:
parent
33bb16948f
commit
d562019fb2
13
miniprogram/api/common/scan.js
Normal file
13
miniprogram/api/common/scan.js
Normal file
@ -0,0 +1,13 @@
|
||||
import {
|
||||
request
|
||||
} from '../selfRequest';
|
||||
|
||||
|
||||
// 用户信息
|
||||
export function callScanUrl(url, paramUrl) {
|
||||
return request({
|
||||
url: url + paramUrl,
|
||||
method: "get",
|
||||
urlIsAll: true
|
||||
});
|
||||
}
|
@ -2,7 +2,13 @@ const app = getApp()
|
||||
|
||||
export function request(params) {
|
||||
// 初始化参数
|
||||
let urlIsAll = params.urlIsAll;
|
||||
let url = app.DOMAIN_NAME + params.url;
|
||||
if (urlIsAll) {
|
||||
url = params.url;
|
||||
} else {
|
||||
url = app.DOMAIN_NAME + params.url;
|
||||
}
|
||||
let header = params.header || {};
|
||||
let data = params.data || {};
|
||||
let method = params.method || "GET";
|
||||
|
@ -1,4 +1,12 @@
|
||||
const app = getApp()
|
||||
|
||||
import Notify from '@vant/weapp/notify/notify';
|
||||
|
||||
import {
|
||||
callScanUrl
|
||||
} from "../../api/common/scan.js"
|
||||
|
||||
|
||||
Page({
|
||||
onShareAppMessage(res) {},
|
||||
data: {
|
||||
@ -186,4 +194,57 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// 扫一扫
|
||||
jumpScan() {
|
||||
let _this = this;
|
||||
wx.scanCode({
|
||||
scanType: 'qrCode',
|
||||
success(res) {
|
||||
console.log('success', res)
|
||||
let url = res.result;
|
||||
// 扫码调用地址
|
||||
_this.scanCallUrl(url)
|
||||
},
|
||||
fail(res) {
|
||||
console.log('fail', res)
|
||||
// 危险通知
|
||||
_this.showErrMsg('扫码失败!')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 扫码调用地址
|
||||
scanCallUrl(url) {
|
||||
let _this = this;
|
||||
let paramUrl = '&userId=' + wx.getStorageSync('userId')
|
||||
callScanUrl(url, paramUrl).then(res => {
|
||||
if (res.code == 0) {
|
||||
// 成功通知
|
||||
_this.showSuccessMsg(res.msg)
|
||||
} else {
|
||||
// 危险通知
|
||||
_this.showErrMsg(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 成功通知
|
||||
showSuccessMsg(msg) {
|
||||
Notify({
|
||||
type: 'success',
|
||||
top: '160rpx',
|
||||
message: msg
|
||||
});
|
||||
},
|
||||
|
||||
// 危险通知
|
||||
showErrMsg(msg) {
|
||||
Notify({
|
||||
type: 'danger',
|
||||
top: '160rpx',
|
||||
message: msg
|
||||
});
|
||||
},
|
||||
|
||||
})
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "中电郑州数据创新中心",
|
||||
"navigationStyle": "custom"
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"van-notify": "@vant/weapp/notify/index"
|
||||
}
|
||||
}
|
@ -1,8 +1,5 @@
|
||||
<view class="containerView public">
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 园区 -->
|
||||
<view bindtap="navparkList" class="topList">
|
||||
<text style="font-size: 28rpx;">当前园区:{{parkName? parkName:'请先选择园区'}}</text>
|
||||
@ -10,7 +7,7 @@
|
||||
</view>
|
||||
|
||||
<view class="topHead">
|
||||
<image class="scanImg" src="{{IMG_NAME + '/profile/static/index/scan.png'}}" mode="aspectFill"></image>
|
||||
<image class="scanImg" src="{{IMG_NAME + '/profile/static/index/scan.png'}}" mode="aspectFill" bind:tap="jumpScan"></image>
|
||||
<view class="title">中电郑州数据创新中心</view>
|
||||
</view>
|
||||
|
||||
@ -45,3 +42,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 消息提示 -->
|
||||
<van-notify id="van-notify"/>
|
@ -1,9 +1,15 @@
|
||||
let app = getApp()
|
||||
|
||||
import Notify from '@vant/weapp/notify/notify';
|
||||
|
||||
import {
|
||||
userProfile
|
||||
} from "../../api/user/user.js"
|
||||
|
||||
import {
|
||||
callScanUrl
|
||||
} from "../../api/common/scan.js"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -41,6 +47,10 @@ Page({
|
||||
},
|
||||
],
|
||||
customerPages: [{
|
||||
name: "预约记录",
|
||||
url: "/pages/meeting/reservationRecord/reservationRecord",
|
||||
},
|
||||
{
|
||||
name: "我的活动",
|
||||
url: "/pages/myActivities/myActivities",
|
||||
},
|
||||
@ -107,8 +117,9 @@ Page({
|
||||
|
||||
navigateTo(e) {
|
||||
if (wx.getStorageSync('userId')) {
|
||||
let dataset = e.currentTarget.dataset;
|
||||
wx.navigateTo({
|
||||
url: e.currentTarget.dataset.url,
|
||||
url: dataset.url + "?name=" + dataset.name,
|
||||
})
|
||||
} else {
|
||||
app.getlogin()
|
||||
@ -127,4 +138,54 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
// 扫一扫
|
||||
jumpScan() {
|
||||
let _this = this;
|
||||
wx.scanCode({
|
||||
scanType: 'qrCode',
|
||||
success(res) {
|
||||
console.log('success', res)
|
||||
let url = res.result;
|
||||
// 扫码调用地址
|
||||
_this.scanCallUrl(url)
|
||||
},
|
||||
fail(res) {
|
||||
console.log('fail', res)
|
||||
// 危险通知
|
||||
_this.showErrMsg('扫码失败!')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 扫码调用地址
|
||||
scanCallUrl(url) {
|
||||
let _this = this;
|
||||
let paramUrl = '&userId=' + wx.getStorageSync('userId')
|
||||
callScanUrl(url, paramUrl).then(res => {
|
||||
if (res.code == 0) {
|
||||
// 成功通知
|
||||
_this.showSuccessMsg(res.msg)
|
||||
} else {
|
||||
// 危险通知
|
||||
_this.showErrMsg(res.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 成功通知
|
||||
showSuccessMsg(msg) {
|
||||
Notify({
|
||||
type: 'success',
|
||||
message: msg
|
||||
});
|
||||
},
|
||||
|
||||
// 危险通知
|
||||
showErrMsg(msg) {
|
||||
Notify({
|
||||
type: 'danger',
|
||||
message: msg
|
||||
});
|
||||
},
|
||||
|
||||
})
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "我的",
|
||||
"usingComponents": {
|
||||
"van-icon": "@vant/weapp/icon/index"
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-notify": "@vant/weapp/notify/index"
|
||||
}
|
||||
}
|
@ -12,7 +12,14 @@
|
||||
|
||||
<!-- 菜单 -->
|
||||
<view class="itemView">
|
||||
<view class="itemData" wx:for="{{customerPages}}" wx:key="*this" bindtap='navigateTo' data-url="{{item.url}}">
|
||||
<!-- 扫一扫 -->
|
||||
<view class="itemData" bindtap='jumpScan'>
|
||||
<view class="label">扫一扫</view>
|
||||
<view class="propOpen"></view>
|
||||
<van-icon name="scan" size="40rpx" color="gray" />
|
||||
</view>
|
||||
<!-- 菜单列表 -->
|
||||
<view class="itemData" wx:for="{{customerPages}}" wx:key="*this" bindtap='navigateTo' data-url="{{item.url}}" data-name="{{item.name}}">
|
||||
<view class="label">{{item.name}}</view>
|
||||
<view class="propOpen"></view>
|
||||
<van-icon name="arrow" size="40rpx" color="gray" />
|
||||
@ -28,3 +35,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 消息提示 -->
|
||||
<van-notify id="van-notify" />
|
@ -16,7 +16,7 @@
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 28rpx 24rpx;
|
||||
border-bottom: 1px solid rgb(126, 126, 126, 0.2);
|
||||
border-bottom: 1px solid rgb(241, 241, 241, 0.8);
|
||||
}
|
||||
|
||||
.itemView .itemData:last-of-type {
|
||||
|
Loading…
x
Reference in New Issue
Block a user