143 lines
3.8 KiB
JavaScript
143 lines
3.8 KiB
JavaScript
|
||
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);
|
||
}
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//复制内容
|
||
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) {
|
||
// 取消操作
|
||
}
|
||
},
|
||
});
|
||
},
|
||
|
||
|
||
}
|
||
|