Files
taimed/common/commonJS.js
liuyuan 9126f47346 tijiao
2025-08-15 15:20:32 +08:00

163 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import uniCopy from '@/js_sdk/xb-copy/uni-copy.js'
import $http from '@/config/requestConfig'
import { mapState, mapMutations } from "vuex";
export default {
...mapMutations(["setUserInfo"]),
showToast(title, icon) {
return uni.showToast({
title: title,
icon: icon ? icon : 'none'
})
},
//拨打电话
handleMakingPhoneCalls(value, title) {
uni.showModal({
title: title ? title : '联系我们',
content: value,
confirmText: '确认',
success(res) {
if (res.confirm) {
uni.makePhoneCall({
phoneNumber: value, //电话号码
success: function (e) {
console.log(e);
},
fail: function (e) {
console.log(e);
}
})
}
}
})
},
refreshPrevPageData() {
setTimeout(() => {
const pages = getCurrentPages(); // 获取页面栈
;
if (pages.length > 1) {
const prevPage = pages[pages.length - 2]; // 获取上一页实例
console.log('at line 514:', '调用刷新函数',prevPage);
if (prevPage && typeof prevPage.$vm.refreshData === 'function') {
console.log('at line 514:', '调用刷新函数');
prevPage.$vm.refreshData(); // 调用刷新函数
}
}
setTimeout(() => {
uni.navigateBack({ delta: 1 });
}, 1000);
}, 500); // 延迟500ms后执行
},
//复制内容
handleCopy(value, title) {
uniCopy({
content: value,
success: (res) => {
uni.showToast({
title: title + '复制成功',
icon: 'none'
})
},
error: (e) => {
}
})
},
//用户协议
async getAgreement(id) {
console.log('id at line 56:', id)
var data = {
id: id
}
var result = {
title: '',
content: ''
}
await $http
.request({
url: "sys/agreement/getAgreement",
method: "POST",
data: data,
header: {
"Content-Type": "application/json",
},
}).then((res) => {
console.log('res at line 111:', res)
if (res.code == 0) {
result = res.agreement
}
})
return result
},
async getCheckCourseStatus(data) {
var result
await $http
.post('app/phone.do?getCheckCourseStatus', {
customerType
:
"D",
token
: uni.getStorageSync("token")
,
customerOid
: uni.getStorageSync("customerOid"),
oid: data.oid
})
.then(async res => {
result = res.obj
})
return result
},
// 退出登录
signOut() {
uni.showModal({
title: "提示",
content: "确定要退出当前账户吗?",
success: function (res) {
if (res.confirm) {
setUserInfo({ token: null });
uni.reLaunch({
url: "/pages/user/login",
});
} else if (res.cancel) {
// 取消操作
}
},
});
},
// 注销账户
logout() {
let that = this;
uni.showModal({
title: "提示",
content: "确定要注销当前账户吗?",
success: function (res) {
if (res.confirm) {
uni.showModal({
title: "提示",
showCancel: false,
content: `注销申请已提交成功,请联系客服进行后续操作022-24142321`,
success: function (res1) {
if (res1.confirm) {
that.signOut();
}
},
});
} else if (res.cancel) {
// 取消操作
}
},
});
}
}