Files
medicine_app/common/commonJS.js
2024-06-19 16:12:23 +08:00

169 lines
4.5 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"]),
// imgShow(url){
// if (uni.getSystemInfoSync().platform == 'ios') {
// return oss访问图片地址 + img;
// } else {
// return oss访问图片地址 + img + '?x-oss-process=image/format,webp'; }
// },
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);
}
})
}
}
})
},
//复制内容
handleCopy(value, title) {
uniCopy({
content: value,
success: (res) => {
uni.showToast({
title: title + '复制成功',
icon: 'none'
})
},
error: (e) => {
// uni.showToast({
// title: e,
// icon: 'none',
// duration:3000,
// })
}
})
},
//用户协议
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", // POST、GET、PUT、DELETE具体说明查看官方文档
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/login",
});
} else if (res.cancel) {
// 取消操作
}
},
});
// this.signShow = false;
// this.setUserInfo({ token: null });
// uni.reLaunch({
// url: "/pages/user/login/login",
// });
}, // 注销账户
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) {
// 取消操作
}
},
});
},
}