mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-18 16:35:53 +08:00
style: 新增复制粘贴以及拨打电话封装模块,优化部分文件中的变量名、将冗余功能抽出、优化订单详情展示
This commit is contained in:
@@ -35,6 +35,53 @@ export function goodsFormatPrice(val) {
|
||||
return valNum.toFixed(2).split(".");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将内容复制到粘贴板
|
||||
*/
|
||||
import { h5Copy } from "@/js_sdk/h5-copy/h5-copy.js";
|
||||
export function setClipboard(val){
|
||||
// #ifdef H5
|
||||
if (val === null || val === undefined) {
|
||||
val = "";
|
||||
} else val = val + "";
|
||||
const result = h5Copy(val);
|
||||
if (result === false) {
|
||||
uni.showToast({
|
||||
title: "不支持",
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "复制成功",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.setClipboardData({
|
||||
data: val,
|
||||
success: function () {
|
||||
uni.showToast({
|
||||
title: "复制成功!",
|
||||
duration: 2000,
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
|
||||
/**
|
||||
* 拨打电话
|
||||
*/
|
||||
|
||||
export function callPhone(phoneNumber) {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: phoneNumber,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 脱敏姓名
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user