处理IOS 链接判断找ai问问加快链接
This commit is contained in:
parent
1f99299bd7
commit
d51e8c9006
582
App.vue
582
App.vue
|
@ -1,280 +1,302 @@
|
||||||
<script>
|
<script>
|
||||||
var xBlufi = require("./utils/blufi/xBlufi.js")
|
var xBlufi = require("./utils/blufi/xBlufi.js")
|
||||||
var call
|
var call
|
||||||
var data_call
|
var data_call
|
||||||
var ble_id = "1231"
|
var ble_id = "1231"
|
||||||
var ble_url
|
var ble_url
|
||||||
|
|
||||||
var user_info
|
var user_info
|
||||||
|
|
||||||
// 在文件顶部添加一个变量来存储当前连接的MAC地址
|
// 在文件顶部添加一个变量来存储当前连接的MAC地址
|
||||||
var current_connected_mac = null;
|
var current_connected_mac = null;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
topicTypeIndex: 0,
|
topicTypeIndex: 0,
|
||||||
token: "",
|
token: "",
|
||||||
isShow: true,
|
isShow: true,
|
||||||
bleInfo: {
|
bleInfo: {
|
||||||
current_connected_mac: null,
|
current_connected_mac: null,
|
||||||
ble_id: "1231",
|
ble_id: "1231",
|
||||||
ble_url: null,
|
ble_url: null,
|
||||||
devicesList: [],
|
devicesList: [],
|
||||||
xBlufi: xBlufi
|
xBlufi: xBlufi
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
plus.navigator.closeSplashscreen()
|
plus.navigator.closeSplashscreen()
|
||||||
// #endif
|
// #endif
|
||||||
console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch')
|
console.log('App @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Launch')
|
||||||
// #ifndef APP-PLUS
|
// #ifndef APP-PLUS
|
||||||
console.log('App 1111111111111Launch')
|
console.log('App 1111111111111Launch')
|
||||||
xBlufi.initXBlufi(1);
|
|
||||||
console.log("xBlufi初始化", xBlufi) // 修改日志输出,确保输出有意义的信息
|
// wx.openBluetoothAdapter({
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // 取消注释,确保事件监听被正确设置
|
// success: function (res) {
|
||||||
xBlufi.notifyStartDiscoverBle({
|
// console.log('蓝牙适配器初始化成功')
|
||||||
'isStart': true
|
// //xBlufi.initXBlufi(1)
|
||||||
})
|
|
||||||
// #endif
|
// xBlufi.initXBlufi(1);
|
||||||
|
// console.log("xBlufi初始化", xBlufi) // 修改日志输出,确保输出有意义的信息
|
||||||
// 添加以下代码,将方法绑定到 uni 全局对象
|
// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // 取消注释,确保事件监听被正确设置
|
||||||
uni.$emit('init_app_methods', {
|
// xBlufi.notifyStartDiscoverBle({
|
||||||
set_ble_mac: this.set_ble_mac.bind(this)
|
// 'isStart': true
|
||||||
})
|
// })
|
||||||
},
|
// // xBlufi.notifyStartDiscoverBle({
|
||||||
onLaunch(options) {
|
// // 'isStart': true
|
||||||
uni.setInnerAudioOption({
|
// // })
|
||||||
obeyMuteSwitch: false
|
|
||||||
})
|
// // 你可以在这里继续调用其他蓝牙相关的API
|
||||||
|
// },
|
||||||
},
|
// fail: function (err) {
|
||||||
onShow: function () {
|
// uni.showToast({
|
||||||
|
// title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
|
||||||
},
|
// icon: 'none',
|
||||||
onHide: function () {
|
// duration:3000
|
||||||
|
// })
|
||||||
},
|
// console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
|
||||||
methods: {
|
// }
|
||||||
get_ble_name(callback) {
|
// })
|
||||||
if (callback != undefined) {
|
|
||||||
xBlufi.notifyConnectBle({
|
// #endif
|
||||||
isStart: false,
|
|
||||||
deviceId: ble_id,
|
// 添加以下代码,将方法绑定到 uni 全局对象
|
||||||
name: ""
|
uni.$emit('init_app_methods', {
|
||||||
})
|
set_ble_mac: this.set_ble_mac.bind(this)
|
||||||
console.log('关闭蓝牙接口', ble_id);
|
})
|
||||||
call = callback
|
},
|
||||||
}
|
onLaunch(options) {
|
||||||
},
|
uni.setInnerAudioOption({
|
||||||
get_ble_data(callback) {
|
obeyMuteSwitch: false
|
||||||
if (callback != undefined)
|
})
|
||||||
data_call = callback;
|
|
||||||
},
|
},
|
||||||
set_ble_mac(mac) {
|
onShow: function () {
|
||||||
const bleInfo = this.globalData.bleInfo
|
|
||||||
// 如果MAC地址与当前连接的相同,则不重复连接
|
},
|
||||||
if (mac === bleInfo.current_connected_mac) {
|
onHide: function () {
|
||||||
console.log('设备已连接,无需重复连接')
|
|
||||||
return
|
},
|
||||||
}
|
methods: {
|
||||||
if (mac != undefined && bleInfo.devicesList) {
|
get_ble_name(callback) {
|
||||||
const device = bleInfo.devicesList.find(device =>
|
if (callback != undefined) {
|
||||||
device.name && device.name.toLowerCase().includes(mac.toLowerCase())
|
xBlufi.notifyConnectBle({
|
||||||
)
|
isStart: false,
|
||||||
if (device) {
|
deviceId: ble_id,
|
||||||
bleInfo.ble_url = ''
|
name: ""
|
||||||
uni.hideLoading()
|
})
|
||||||
bleInfo.ble_id = device.deviceId
|
console.log('关闭蓝牙接口', ble_id);
|
||||||
bleInfo.xBlufi.notifyConnectBle({
|
call = callback
|
||||||
isStart: true,
|
}
|
||||||
deviceId: device.deviceId
|
},
|
||||||
})
|
get_ble_data(callback) {
|
||||||
uni.showToast({
|
if (callback != undefined)
|
||||||
title: "连接蓝牙设备中",
|
data_call = callback;
|
||||||
icon: 'none',
|
},
|
||||||
duration: 1500
|
set_ble_mac(mac) {
|
||||||
})
|
const bleInfo = this.globalData.bleInfo
|
||||||
bleInfo.xBlufi.notifyInitBleEsp32({
|
// 如果MAC地址与当前连接的相同,则不重复连接
|
||||||
deviceId: device.deviceId
|
if (mac === bleInfo.current_connected_mac) {
|
||||||
})
|
console.log('设备已连接,无需重复连接')
|
||||||
// 更新全局MAC地址
|
return
|
||||||
bleInfo.current_connected_mac = mac
|
}
|
||||||
} else {
|
if (mac != undefined && bleInfo.devicesList) {
|
||||||
uni.showToast({
|
const device = bleInfo.devicesList.find(device =>
|
||||||
title: "未找到匹配的设备",
|
device.name && device.name.toLowerCase().includes(mac.toLowerCase())
|
||||||
icon: 'none',
|
)
|
||||||
duration: 1500
|
if (device) {
|
||||||
})
|
bleInfo.ble_url = ''
|
||||||
}
|
uni.hideLoading()
|
||||||
}
|
bleInfo.ble_id = device.deviceId
|
||||||
},
|
bleInfo.xBlufi.notifyConnectBle({
|
||||||
set_ble_id(id, url) {
|
isStart: true,
|
||||||
console.log("id", id)
|
deviceId: device.deviceId
|
||||||
if (id != undefined) {
|
})
|
||||||
ble_url = url
|
uni.showToast({
|
||||||
uni.hideLoading()
|
title: "连接蓝牙设备中",
|
||||||
ble_id = id
|
icon: 'none',
|
||||||
xBlufi.notifyConnectBle({
|
duration: 1500
|
||||||
isStart: true,
|
})
|
||||||
deviceId: id
|
bleInfo.xBlufi.notifyInitBleEsp32({
|
||||||
// name
|
deviceId: device.deviceId
|
||||||
})
|
})
|
||||||
uni.showToast({
|
// 更新全局MAC地址
|
||||||
title: "连接蓝牙设备中",
|
bleInfo.current_connected_mac = mac
|
||||||
icon: 'none',
|
} else {
|
||||||
duration: 3500
|
uni.showToast({
|
||||||
})
|
title: "未找到匹配的设备",
|
||||||
xBlufi.notifyInitBleEsp32({
|
icon: 'none',
|
||||||
deviceId: id
|
duration: 1500
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ble_send(data) {
|
},
|
||||||
if (data != undefined) {
|
set_ble_id(id, url) {
|
||||||
xBlufi.notifySendCustomData({
|
console.log("id", id)
|
||||||
customData: data,
|
if (id != undefined) {
|
||||||
});
|
ble_url = url
|
||||||
}
|
uni.hideLoading()
|
||||||
},
|
ble_id = id
|
||||||
get_user_iphone(data) {
|
xBlufi.notifyConnectBle({
|
||||||
return user_info;
|
isStart: true,
|
||||||
},
|
deviceId: id
|
||||||
set_user_iphone(data) {
|
// name
|
||||||
console.log("电话存储")
|
})
|
||||||
uni.setStorage({
|
uni.showToast({
|
||||||
key: 'user_info',
|
title: "连接蓝牙设备中",
|
||||||
data: data,
|
icon: 'none',
|
||||||
success: () => {
|
duration: 3500
|
||||||
console.log('已经缓存,userInfo:', data.phone);
|
})
|
||||||
resolve('success')
|
xBlufi.notifyInitBleEsp32({
|
||||||
}
|
deviceId: id
|
||||||
});
|
})
|
||||||
user_info = data
|
}
|
||||||
},
|
},
|
||||||
call(e) {
|
ble_send(data) {
|
||||||
call = e;
|
if (data != undefined) {
|
||||||
},
|
xBlufi.notifySendCustomData({
|
||||||
funListenDeviceMsgEvent(options) {
|
customData: data,
|
||||||
switch (options.type) {
|
});
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
}
|
||||||
if (!options.result) {
|
},
|
||||||
// 清除全局MAC地址
|
get_user_iphone(data) {
|
||||||
this.globalData.bleInfo.current_connected_mac = null;
|
return user_info;
|
||||||
const pages = getCurrentPages();
|
},
|
||||||
const currentPage = pages[pages.length - 1];
|
set_user_iphone(data) {
|
||||||
console.log("当前页面路径", currentPage.route)
|
console.log("电话存储")
|
||||||
if (currentPage.route != 'pages/index/index') {
|
uni.setStorage({
|
||||||
uni.showModal({
|
key: 'user_info',
|
||||||
title: '设备提示!',
|
data: data,
|
||||||
content: '与设备断开请重联',
|
success: () => {
|
||||||
showCancel: false,
|
console.log('已经缓存,userInfo:', data.phone);
|
||||||
success: function (res) {
|
resolve('success')
|
||||||
uni.reLaunch({
|
}
|
||||||
url: '/pages/index/index'
|
});
|
||||||
});
|
user_info = data
|
||||||
}
|
},
|
||||||
});
|
call(e) {
|
||||||
}
|
call = e;
|
||||||
}
|
},
|
||||||
break;
|
funListenDeviceMsgEvent(options) {
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
switch (options.type) {
|
||||||
uni.hideLoading();
|
case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED:
|
||||||
if (!options.result) {
|
if (!options.result) {
|
||||||
uni.hideLoading();
|
// 清除全局MAC地址
|
||||||
uni.showModal({
|
this.globalData.bleInfo.current_connected_mac = null;
|
||||||
title: '温馨提示',
|
const pages = getCurrentPages();
|
||||||
content: '配网失败,请确认是2.4G模式并且账户密码正确',
|
const currentPage = pages[pages.length - 1];
|
||||||
showCancel: false //是否显示取消按钮
|
console.log("当前页面路径", currentPage.route)
|
||||||
});
|
if (currentPage.route != 'pages/index/index') {
|
||||||
} else {
|
uni.showModal({
|
||||||
if (options.data.progress == 100) {
|
title: '设备提示!',
|
||||||
let ssid = options.data.ssid;
|
content: '与设备断开请重联',
|
||||||
uni.hideLoading();
|
showCancel: false,
|
||||||
uni.showModal({
|
success: function (res) {
|
||||||
title: '温馨提示',
|
uni.reLaunch({
|
||||||
content: `连接成功路由器`,
|
url: '/pages/index/index'
|
||||||
showCancel: false,
|
});
|
||||||
//是否显示取消按钮
|
}
|
||||||
success: function (res) {
|
});
|
||||||
// uni.navigateBack()
|
}
|
||||||
uni.navigateTo({
|
}
|
||||||
url: '/pages/dd/xiaoai'
|
break;
|
||||||
});
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT:
|
||||||
console.log("确定成功之后 返回 ");
|
uni.hideLoading();
|
||||||
}
|
if (!options.result) {
|
||||||
});
|
uni.hideLoading();
|
||||||
}
|
uni.showModal({
|
||||||
}
|
title: '温馨提示',
|
||||||
break;
|
content: '配网失败,请确认是2.4G模式并且账户密码正确',
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
showCancel: false //是否显示取消按钮
|
||||||
if (data_call != undefined) {
|
});
|
||||||
data_call(options.data)
|
} else {
|
||||||
}
|
if (options.data.progress == 100) {
|
||||||
break;
|
let ssid = options.data.ssid;
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
uni.hideLoading();
|
||||||
if (options.result) {
|
uni.showModal({
|
||||||
this.globalData.bleInfo.devicesList = options.data; // 假设你想在组件内部使用这个变量,应该这样设置
|
title: '温馨提示',
|
||||||
console.log("获取设备列表", this.globalData.bleInfo.devicesList)
|
content: `连接成功路由器`,
|
||||||
if (call != undefined) {
|
showCancel: false,
|
||||||
console.log("获取设备列表", this.globalData.bleInfo.devicesList)
|
//是否显示取消按钮
|
||||||
call(this.globalData.bleInfo.devicesList)
|
success: function (res) {
|
||||||
}
|
// uni.navigateBack()
|
||||||
}
|
uni.navigateTo({
|
||||||
break;
|
url: '/pages/dd/xiaoai'
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
});
|
||||||
console.log("连接回调:" + JSON.stringify(options));
|
console.log("确定成功之后 返回 ");
|
||||||
if (options.result) {
|
}
|
||||||
uni.hideLoading();
|
});
|
||||||
uni.showToast({
|
}
|
||||||
title: '连接成功',
|
}
|
||||||
icon: 'none'
|
break;
|
||||||
});
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
console.log("连接进入:", ble_url);
|
if (data_call != undefined) {
|
||||||
// uni.navigateTo({ url: ble_url });
|
data_call(options.data)
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
uni.showToast({
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
|
||||||
title: '连接超时,请重新链接',
|
if (options.result) {
|
||||||
icon: 'none'
|
this.globalData.bleInfo.devicesList = options.data; // 假设你想在组件内部使用这个变量,应该这样设置
|
||||||
});
|
console.log("获取设备列表", this.globalData.bleInfo.devicesList)
|
||||||
}
|
if (call != undefined) {
|
||||||
break;
|
console.log("获取设备列表", this.globalData.bleInfo.devicesList)
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
call(this.globalData.bleInfo.devicesList)
|
||||||
if (!options.result) {
|
}
|
||||||
uni.showToast({
|
}
|
||||||
title: '蓝牙未开启解决方法',
|
break;
|
||||||
icon: 'none',
|
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
|
||||||
duration: 3000
|
console.log("连接回调:" + JSON.stringify(options));
|
||||||
});
|
if (options.result) {
|
||||||
}
|
uni.hideLoading();
|
||||||
break;
|
uni.showToast({
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
title: '连接成功',
|
||||||
if (options.result) {
|
icon: 'none'
|
||||||
console.log('蓝牙停止搜索ok');
|
});
|
||||||
} else {
|
console.log("连接进入:", ble_url);
|
||||||
console.log('蓝牙停止搜索失败');
|
// uni.navigateTo({ url: ble_url });
|
||||||
}
|
}
|
||||||
break;
|
else {
|
||||||
}
|
uni.showToast({
|
||||||
}
|
title: '连接超时,请重新链接',
|
||||||
}
|
icon: 'none'
|
||||||
}
|
});
|
||||||
</script>
|
}
|
||||||
|
break;
|
||||||
<style lang="scss">
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
/*每个页面公共css */
|
if (!options.result) {
|
||||||
@import "uview-ui/index.scss";
|
uni.showToast({
|
||||||
@import "./common/css/iconfont.css";
|
title: '蓝牙未开启解决方法',
|
||||||
|
icon: 'none',
|
||||||
// 自定义tabar样式修改
|
duration: 3000
|
||||||
/deep/.u-tabbar__content__item__text {
|
});
|
||||||
font-size: 20rpx !important;
|
}
|
||||||
bottom: 10rpx !important;
|
break;
|
||||||
}
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
|
||||||
|
if (options.result) {
|
||||||
page {
|
console.log('蓝牙停止搜索ok');
|
||||||
background-color: #f8f8f8;
|
} else {
|
||||||
}
|
console.log('蓝牙停止搜索失败');
|
||||||
</style>
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/*每个页面公共css */
|
||||||
|
@import "uview-ui/index.scss";
|
||||||
|
@import "./common/css/iconfont.css";
|
||||||
|
|
||||||
|
// 自定义tabar样式修改
|
||||||
|
/deep/.u-tabbar__content__item__text {
|
||||||
|
font-size: 20rpx !important;
|
||||||
|
bottom: 10rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,141 +1,141 @@
|
||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
// Vue.prototype.$u.http.setConfig({
|
// Vue.prototype.$u.http.setConfig({
|
||||||
// baseURL: 'https://yruibao.com/admin',
|
// baseURL: 'https://yruibao.com/admin',
|
||||||
// // baseUrl: 'http://192.168.10.104:8088',
|
// // baseUrl: 'http://192.168.10.104:8088',
|
||||||
// method: 'POST',
|
// method: 'POST',
|
||||||
// // 设置为json,返回后会对数据进行一次JSON.parse()
|
// // 设置为json,返回后会对数据进行一次JSON.parse()
|
||||||
// dataType: 'json',
|
// dataType: 'json',
|
||||||
// showLoading: true, // 是否显示请求中的loading
|
// showLoading: true, // 是否显示请求中的loading
|
||||||
// loadingText: '...', // 请求loading中的文字提示
|
// loadingText: '...', // 请求loading中的文字提示
|
||||||
// loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
|
// loadingTime: 800, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
|
||||||
// originalData: false, // 是否在拦截器中返回服务端的原始数据
|
// originalData: false, // 是否在拦截器中返回服务端的原始数据
|
||||||
// loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
|
// loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
|
||||||
// // 配置请求头信息
|
// // 配置请求头信息
|
||||||
// header: {
|
// header: {
|
||||||
// 'content-type': 'application/json;charset=UTF-8',
|
// 'content-type': 'application/json;charset=UTF-8',
|
||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
baseUrl: 'http://192.168.2.27:10002',
|
// baseUrl: 'http://192.168.2.27:10002',
|
||||||
// baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
baseUrl: 'https://kg.chuangtewl.com/prod-api',
|
||||||
// loadingText: '加载中...',
|
// loadingText: '加载中...',
|
||||||
// loadingTime: 1000,
|
// loadingTime: 1000,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/json;charset=UTF-8',
|
'content-type': 'application/json;charset=UTF-8',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// 请求拦截部分,如配置,每次请求前都会执行
|
// 请求拦截部分,如配置,每次请求前都会执行
|
||||||
Vue.prototype.$u.http.interceptor.request = (config) => {
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
||||||
// 引用token
|
// 引用token
|
||||||
// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式
|
// 方式一,存放在vuex的token,假设使用了uView封装的vuex方式
|
||||||
// 见:https://uviewui.com/components/globalVariable.html
|
// 见:https://uviewui.com/components/globalVariable.html
|
||||||
// config.header.token = vm.token;
|
// config.header.token = vm.token;
|
||||||
// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
|
// 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取
|
||||||
// config.header.token = vm.$store.state.token;
|
// config.header.token = vm.$store.state.token;
|
||||||
// 方式三,如果token放在了globalData,通过getApp().globalData获取
|
// 方式三,如果token放在了globalData,通过getApp().globalData获取
|
||||||
// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的
|
// 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的
|
||||||
// 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
|
// 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
// const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE1ZmE2YzM0LWM0Y2YtNGEwMS05YjY2LTE1M2M4YWY1YzU1YSJ9.Wze_tAjY7cCfw2K6mtDpTSd-QFLRF4A49Fx7bq7g2tVLKL4v5bqqHfpG0VQy7_a_CUQch5RPBTBIKMVCDupIqg"
|
// const token = " eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImE1ZmE2YzM0LWM0Y2YtNGEwMS05YjY2LTE1M2M4YWY1YzU1YSJ9.Wze_tAjY7cCfw2K6mtDpTSd-QFLRF4A49Fx7bq7g2tVLKL4v5bqqHfpG0VQy7_a_CUQch5RPBTBIKMVCDupIqg"
|
||||||
// console.log("我是token", token)
|
// console.log("我是token", token)
|
||||||
config.header.Authorization = token;
|
config.header.Authorization = token;
|
||||||
// config.header.Tenant-Id=1
|
// config.header.Tenant-Id=1
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
config.header.Authorization = 'Bearer '+token;
|
config.header.Authorization = 'Bearer '+token;
|
||||||
// #endif
|
// #endif
|
||||||
// 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值
|
// 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值
|
||||||
if(config.url == '/user/login') config.header.noToken = true;
|
if(config.url == '/user/login') config.header.noToken = true;
|
||||||
// 最后需要将config进行return
|
// 最后需要将config进行return
|
||||||
return config;
|
return config;
|
||||||
|
|
||||||
// 如果return一个false值,则会取消本次请求
|
// 如果return一个false值,则会取消本次请求
|
||||||
// if(config.url == '/user/rest') return false; // 取消某次请求
|
// if(config.url == '/user/rest') return false; // 取消某次请求
|
||||||
}
|
}
|
||||||
|
|
||||||
// 响应拦截,如配置,每次请求结束都会执行本方法
|
// 响应拦截,如配置,每次请求结束都会执行本方法
|
||||||
Vue.prototype.$u.http.interceptor.response = (res) => {
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
||||||
// if(res.code == 10022 || res.code == 10023) {
|
// if(res.code == 10022 || res.code == 10023) {
|
||||||
// // res为服务端返回值,可能有code,result等字段
|
// // res为服务端返回值,可能有code,result等字段
|
||||||
// // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
// // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
||||||
// // 如果配置了originalData为true,请留意这里的返回值
|
// // 如果配置了originalData为true,请留意这里的返回值
|
||||||
// uni.redirectTo({
|
// uni.redirectTo({
|
||||||
// url:"/pages/login/login",
|
// url:"/pages/login/login",
|
||||||
// fail:function(mes){
|
// fail:function(mes){
|
||||||
// console.log(mes)
|
// console.log(mes)
|
||||||
// },
|
// },
|
||||||
// success:function(mes){
|
// success:function(mes){
|
||||||
// console.log(mes)
|
// console.log(mes)
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
// // return res.result;
|
// // return res.result;
|
||||||
// }
|
// }
|
||||||
if(res.code == 401) {
|
if(res.code == 401) {
|
||||||
// res为服务端返回值,可能有code,result等字段
|
// res为服务端返回值,可能有code,result等字段
|
||||||
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
// 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到
|
||||||
// 如果配置了originalData为true,请留意这里的返回值
|
// 如果配置了originalData为true,请留意这里的返回值
|
||||||
|
|
||||||
// return res.result;
|
// return res.result;
|
||||||
|
|
||||||
uni.login({
|
uni.login({
|
||||||
success: function(ret) {
|
success: function(ret) {
|
||||||
// console.log("main.js==>res", ret)
|
// console.log("main.js==>res", ret)
|
||||||
// vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{
|
// vm.$u.post('/user/login',{"js_code": ret.code}).then(res=>{
|
||||||
// if (res.code == 10003) {
|
// if (res.code == 10003) {
|
||||||
// // console.log("新用户登录")
|
// // console.log("新用户登录")
|
||||||
// uni.setStorageSync('token', res.data);
|
// uni.setStorageSync('token', res.data);
|
||||||
|
|
||||||
// } else if (res.code == 200) {
|
// } else if (res.code == 200) {
|
||||||
// // console.log("老用户登录",res.data)
|
// // console.log("老用户登录",res.data)
|
||||||
// uni.setStorageSync('token', res.data);
|
// uni.setStorageSync('token', res.data);
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
wx.login({
|
wx.login({
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
console.log('登录!', res);
|
console.log('登录!', res);
|
||||||
let data = {
|
let data = {
|
||||||
loginCode: res.code,
|
loginCode: res.code,
|
||||||
appId:1
|
appId:1
|
||||||
}
|
}
|
||||||
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
|
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
|
||||||
if (res.code == 10003) {
|
if (res.code == 10003) {
|
||||||
// uni.navigateTo({
|
// uni.navigateTo({
|
||||||
// url:'/pages/login/login'
|
// url:'/pages/login/login'
|
||||||
// })
|
// })
|
||||||
|
|
||||||
} else if (res.code == 200) {
|
} else if (res.code == 200) {
|
||||||
// console.log("老用户登录",res.data)
|
// console.log("老用户登录",res.data)
|
||||||
// uni.switchTab({
|
// uni.switchTab({
|
||||||
// url:'/pages/index/index'
|
// url:'/pages/index/index'
|
||||||
// })
|
// })
|
||||||
uni.setStorageSync('token', res.token)
|
uni.setStorageSync('token', res.token)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
// else if(res.code == 201) {
|
// else if(res.code == 201) {
|
||||||
// // 假设201为token失效,这里跳转登录
|
// // 假设201为token失效,这里跳转登录
|
||||||
// vm.$u.toast('验证失败,请重新登录');
|
// vm.$u.toast('验证失败,请重新登录');
|
||||||
// setTimeout(() => {
|
// setTimeout(() => {
|
||||||
// // 此为uView的方法,详见路由相关文档
|
// // 此为uView的方法,详见路由相关文档
|
||||||
// vm.$u.route('/pages/user/login')
|
// vm.$u.route('/pages/user/login')
|
||||||
// }, 1500)
|
// }, 1500)
|
||||||
// return false;
|
// return false;
|
||||||
// } else {
|
// } else {
|
||||||
// // 如果返回false,则会调用Promise的reject回调,
|
// // 如果返回false,则会调用Promise的reject回调,
|
||||||
// // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值
|
// // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name" : "kaiguan",
|
"name" : "kaiguan",
|
||||||
"appid" : "__UNI__F877C47",
|
"appid" : "__UNI__96CC1F5",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
|
|
95
package-lock.json
generated
95
package-lock.json
generated
|
@ -1,40 +1,55 @@
|
||||||
{
|
{
|
||||||
"name": "dianbiao",
|
"name": "dianbiao",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"packages": {
|
||||||
"echarts": {
|
"": {
|
||||||
"version": "5.4.3",
|
"name": "dianbiao",
|
||||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.3.tgz",
|
"version": "1.0.0",
|
||||||
"integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==",
|
"license": "ISC",
|
||||||
"requires": {
|
"dependencies": {
|
||||||
"tslib": "2.3.0",
|
"dianbiao": "file:",
|
||||||
"zrender": "5.4.4"
|
"echarts": "^5.4.0",
|
||||||
}
|
"js-base64": "^3.7.3",
|
||||||
},
|
"uview-ui": "^1.8.8"
|
||||||
"js-base64": {
|
}
|
||||||
"version": "3.7.5",
|
},
|
||||||
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
|
"node_modules/dianbiao": {
|
||||||
"integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
|
"resolved": "",
|
||||||
},
|
"link": true
|
||||||
"tslib": {
|
},
|
||||||
"version": "2.3.0",
|
"node_modules/echarts": {
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
"version": "5.4.3",
|
||||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.3.tgz",
|
||||||
},
|
"integrity": "sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA==",
|
||||||
"uview-ui": {
|
"dependencies": {
|
||||||
"version": "1.8.8",
|
"tslib": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.8.tgz",
|
"zrender": "5.4.4"
|
||||||
"integrity": "sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg=="
|
}
|
||||||
},
|
},
|
||||||
"zrender": {
|
"node_modules/js-base64": {
|
||||||
"version": "5.4.4",
|
"version": "3.7.5",
|
||||||
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz",
|
||||||
"integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==",
|
"integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA=="
|
||||||
"requires": {
|
},
|
||||||
"tslib": "2.3.0"
|
"node_modules/tslib": {
|
||||||
}
|
"version": "2.3.0",
|
||||||
}
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
||||||
}
|
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
||||||
}
|
},
|
||||||
|
"node_modules/uview-ui": {
|
||||||
|
"version": "1.8.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/uview-ui/-/uview-ui-1.8.8.tgz",
|
||||||
|
"integrity": "sha512-Osal3yzXiHor0In9OPTZuXTaqTbDglMZ9RGK/MPYDoQQs+y0hrBCUD0Xp5T70C8i2lLu2X6Z11zJhmsQWMR7Jg=="
|
||||||
|
},
|
||||||
|
"node_modules/zrender": {
|
||||||
|
"version": "5.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.4.tgz",
|
||||||
|
"integrity": "sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw==",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "2.3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
51
package.json
51
package.json
|
@ -1,25 +1,26 @@
|
||||||
{
|
{
|
||||||
"name": "dianbiao",
|
"name": "dianbiao",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/lchighpass/lchighpass-speaking.git"
|
"url": "git+https://github.com/lchighpass/lchighpass-speaking.git"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/lchighpass/lchighpass-speaking/issues"
|
"url": "https://github.com/lchighpass/lchighpass-speaking/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
|
"homepage": "https://github.com/lchighpass/lchighpass-speaking#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"echarts": "^5.4.0",
|
"dianbiao": "file:",
|
||||||
"js-base64": "^3.7.3",
|
"echarts": "^5.4.0",
|
||||||
"uview-ui": "^1.8.8"
|
"js-base64": "^3.7.3",
|
||||||
}
|
"uview-ui": "^1.8.8"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -50,6 +50,7 @@ function initXBlufi(type) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XMQTT_SYSTEM.WeChat:
|
case XMQTT_SYSTEM.WeChat:
|
||||||
|
console.log("初始化@@@@@@@!!!!!!!!!!!!")
|
||||||
if(once==0)
|
if(once==0)
|
||||||
{
|
{
|
||||||
once = 1;
|
once = 1;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3824
pages/shanghudd.vue
3824
pages/shanghudd.vue
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user