84 lines
2.4 KiB
JavaScript
84 lines
2.4 KiB
JavaScript
export const myMixins = {
|
||
data() {
|
||
return {
|
||
touchStart: [],
|
||
touchEnd: [],
|
||
slideShow: true
|
||
}
|
||
},
|
||
methods: {
|
||
goPage(page, query) {
|
||
this.$router.push({
|
||
name: page,
|
||
query: query
|
||
})
|
||
},
|
||
copyText(){//复制订单编号
|
||
const copyText = document.getElementById('copyText');
|
||
const range = document.createRange();
|
||
range.selectNode(copyText);
|
||
window.getSelection().removeAllRanges(); // 清除当前页面的选择内容
|
||
window.getSelection().addRange(range);
|
||
document.execCommand('copy');
|
||
window.getSelection().removeAllRanges(); // 清除选择内容的高亮状态
|
||
this.$toast('复制成功')
|
||
},
|
||
goBack(){//h5返回APP
|
||
let data = {"action":"goBack","params":""}
|
||
var u = navigator.userAgent;
|
||
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||
// var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
||
if(isiOS){
|
||
window.webkit.messageHandlers.nativeObject.postMessage(data);
|
||
}else {
|
||
window.android.sendMessage("goBack");
|
||
}
|
||
},
|
||
goH5Detail(item,type){//h5传参到app文档资料,培训文档
|
||
console.log("type",type)
|
||
let data = {
|
||
"action": "goTraining",
|
||
"params": {
|
||
"id":type == '培训文档' ? Number(10000+item.id) : item.id,
|
||
}
|
||
};
|
||
|
||
let u = navigator.userAgent;
|
||
let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||
if(isiOS){
|
||
console.log("data",data)
|
||
window.webkit.messageHandlers.nativeObject.postMessage(data);
|
||
}else {
|
||
if(type == '培训文档'){
|
||
window.android.sendMessage("articleId=" +'q'+ item.id);
|
||
}else{
|
||
window.android.sendMessage("articleId=" + item.id);
|
||
}
|
||
}
|
||
},
|
||
h5GoBack(){
|
||
this.$router.back();
|
||
},
|
||
noMultipleClicks(methods, info) {
|
||
// methods是需要点击后需要执行的函数, info是点击需要传的参数
|
||
let that = this;
|
||
if (that.noClick) {
|
||
// 第一次点击
|
||
that.noClick = false;
|
||
if (info && info !== '') {
|
||
//info是执行函数需要传的参数
|
||
methods(info)
|
||
} else {
|
||
methods();
|
||
}
|
||
setTimeout(() => {
|
||
console.log("shengxiaoxi")
|
||
that.noClick = true;
|
||
}, 3000)
|
||
} else {
|
||
// 这里是重复点击的判断
|
||
}
|
||
}
|
||
}
|
||
}
|