|
@@ -1,52 +1,112 @@
|
|
|
<template>
|
|
|
- <download-excel class="export-excel-wrapper" :data="json_data" :fields="json_fields" footer='页脚' header='导出数据'
|
|
|
- name="设备管理数据表.xls">
|
|
|
- <!-- 上面可以自定义自己的样式,还可以引用其他组件button -->
|
|
|
- <button type="primary" size="small">导出EXCEL</button>
|
|
|
- </download-excel>
|
|
|
+
|
|
|
+ <view>
|
|
|
+
|
|
|
+ <button class="bg-blue" @click="scancode()">扫码</button>
|
|
|
+
|
|
|
+ </view>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
export default {
|
|
|
+
|
|
|
data() {
|
|
|
- return {
|
|
|
- json_fields: {
|
|
|
- "单位编号": "company", //常规字段
|
|
|
- "状态": "device_state",
|
|
|
- "设备编号": "owner_code",
|
|
|
- "设备名称": "owner_name",
|
|
|
- "单元地址": "unitinfo",
|
|
|
- "创建时间": "install_time",
|
|
|
- },
|
|
|
- json_data: [{
|
|
|
- name: "Tony Peña",
|
|
|
- city: "New York",
|
|
|
- country: "United States",
|
|
|
- birthdate: "1978-03-15",
|
|
|
- phone: {
|
|
|
- mobile: "1-541-754-3010",
|
|
|
- landline: "(541) 754-3010"
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- name: "Thessaloniki",
|
|
|
- city: "Athens",
|
|
|
- country: "Greece",
|
|
|
- birthdate: "1987-11-23",
|
|
|
- phone: {
|
|
|
- mobile: "+1 855 275 5071",
|
|
|
- landline: "(2741) 2621-244"
|
|
|
+
|
|
|
+ return {}
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoad() {
|
|
|
+
|
|
|
+ // #ifdef H5
|
|
|
+ let redirect_uri = location.href.split('#')[0]
|
|
|
+ this.$http.get('你的接口', {
|
|
|
+ sing_url: redirect_uri
|
|
|
+ }).then(res => {
|
|
|
+ this.wx_co(res.data)
|
|
|
+ }).catch(e => {
|
|
|
+ console.log('错误信息', e);
|
|
|
+ });
|
|
|
+
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+
|
|
|
+ wx_co: function(wx_co) {
|
|
|
+ this.$wx.config({
|
|
|
+
|
|
|
+ debug: false, // 开启调试模式
|
|
|
+
|
|
|
+ appId: wx_co.appId, // 必填,公众号的唯一标识
|
|
|
+
|
|
|
+ timestamp: wx_co.timestamp, // 必填,生成签名的时间戳
|
|
|
+
|
|
|
+ nonceStr: wx_co.nonceStr, // 必填,生成签名的随机串
|
|
|
+
|
|
|
+ signature: wx_co.signature, // 必填,签名,见附录1
|
|
|
+
|
|
|
+ jsApiList: ['onMenuShareAppMessage', 'scanQRCode'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$wx.ready(function() { //需在用户可能点击分享按钮前就先调用
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.$wx.checkJsApi({
|
|
|
+
|
|
|
+ jsApiList: ['scanQRCode'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
|
|
+
|
|
|
+ success: function(res) {
|
|
|
+
|
|
|
+ // 以键值对的形式返回,可用的api值true,不可用为false
|
|
|
+
|
|
|
+ // 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.$wx.error(function(res) {
|
|
|
+
|
|
|
+ console.log(res, 'this.$wx.error') // config信息验证失败会执行error函数
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ scancode: function() {
|
|
|
+ alert(1);
|
|
|
+ this.$wx.scanQRCode({
|
|
|
+
|
|
|
+ needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
+
|
|
|
+ scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
+
|
|
|
+ success: function(res) {
|
|
|
+ alert(2);
|
|
|
+ var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
|
|
|
+
|
|
|
}
|
|
|
- ],
|
|
|
- json_meta: [
|
|
|
- [{
|
|
|
- " key ": " charset ",
|
|
|
- " value ": " utf- 8 "
|
|
|
- }]
|
|
|
- ]
|
|
|
- };
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+
|
|
|
+</style>
|