Files
medicine_app/pages/mine/set/index.vue
2025-02-07 15:56:20 +08:00

722 lines
17 KiB
Vue
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.
<template>
<view class="container commonPageBox">
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="设置" bgColor="#258feb" fontColor="#fff"></z-nav-bar>
<view class="contentBox commonPageContentBox">
<view class="set_box">
<list
:dataList="dataList"
@hancleClick="handleClickRightContent"
label="title"
>
<template slot="rightSlot" slot-scope="slotProps">
<text class="fdButtonBox aui-text-success">{{
slotProps.row.content
}}</text>
<view> </view>
</template>
</list>
</view>
<view class="button_box">
<u-button
shape="square"
type=""
class="common_red_button button"
size="medium"
@click="handleClickButton(1)"
>注销账号</u-button
>
<u-button
shape="square"
type=""
class="common_grey_button button"
size="medium"
@click="handleClickButton(2)"
>退出登录</u-button
>
</view>
</view>
<u-modal
:show="signShow"
:content="signContent"
:showCancelButton="true"
@cancel="signShow = false"
@confirm="signOut"
>
</u-modal>
<u-popup key="1" v-if="showCodeImg" :show="showCodeImg" :round="10" @close="closePup">
<view class="box6">
<text style="color: #999; margin-bottom: 20rpx;">点击图片后长按图片保存到手机或使用微信扫描二维码添加客服企业微信</text>
<image @click="previewImage('/static/qiyeWx.jpg')" src="/static/qiyeWx.jpg" mode="widthFix" style="width: 100px; height: 100px; margin: 0 auto;"></image>
</view>
</u-popup>
</view>
</template>
<script>
// #ifdef APP-PLUS
import updata from "@/uni_modules/uni-upgrade-center-app/utils/check-update";
// #endif
import list from "@/pages/component/commonComponents/list";
import $http from "@/config/requestConfig.js";
import { mapState, mapMutations } from "vuex";
export default {
components: {
list,
},
data() {
return {
signShow: false,
signContent: "是否要退出登录?",
playData: {},
options: {},
searchValue: "",
showCodeImg:false,
twoCateList: [], // 二级分类标题
titleList: [], // 方剂标题
curOneCateIndex: 0, // 当前选中的一级分类
curTwoCateIndex: 0, // 当前选中的二级分类
searchList: [], // 搜索结果数组
showSearchList: false,
userMes: {}, // 用户信息
searchDisable: false, // 搜索不可用
limitShow: false,
limitTitle: "提示",
limitContent: "",
scrollViewHeight: 0,
dataList: [
{
title: "客服热线",
content: "022-24142321",
type: "tel",
},
{
title: "客服邮箱",
content: "appyilujiankang@sina.com",
type: "email",
},
{
title: "企业微信",
content: "",
type: "wxNumber",
},
{
title: "版本检测",
content: "",
type: "checkVersion",
},
// {
// "title": "清楚缓存",
// content: 'yilujiankangkefu'
// },
],
otherList: [
{
title: "关于我们",
url: "/pages/mine/aboutUs/index",
type: "pageJump",
},
// {
// "title": "清楚缓存",
// content: 'yilujiankangkefu'
// },
],
};
},
onLoad(options) {
console.log(options, "989");
this.options = options;
this.getUserInfo();
// this.getCateList()
},
onHide() {
// this.showSearchList = false
// this.searchList = []
},
computed: {
...mapState(["userInfo"]),
},
methods: {
...mapMutations(["setUserInfo"]),
closePup(){
this.showCodeImg = false
},
signOut() {
this.signShow = false;
this.setUserInfo({ token: null });
uni.removeStorageSync('countryData');
uni.redirectTo({
url: "/pages/user/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) {
// 取消操作
}
},
});
},
handleClickButton(type) {
switch (type) {
case 1:
this.logout();
// this.$commonJS.logout()
break;
case 2:
this.signShow = true;
// this.$commonJS.signOut()
break;
//
}
},
handleClickRightContent(row) {
console.log("row.type at line 122:", row);
switch (row.type) {
case "tel":
this.$commonJS.handleMakingPhoneCalls(row.content);
break;
case "email":
this.$commonJS.handleCopy(row.content, row.title);
break;
case "wxNumber":
this.showCodeImg = true
// this.$commonJS.handleCopy(row.content, row.title);
break;
case "checkVersion":
this.getNewVersion()
break;
case "pageJump":
uni.navigateTo({
url: row.url,
});
break;
//
}
},
// 获取用户详情
getUserInfo() {
// 用户详情
if (this.userInfo.id != undefined) {
this.$http.post("book/user/info/" + this.userInfo.id).then((res) => {
this.userMes = res.user;
this.getCateList();
console.log(this.userMes, "呼呼");
});
}
},
// 版本检测
async getNewVersion(){
// #ifdef APP-PLUS
var info = await updata();
console.log('info',JSON.stringify(info))
if(info.result.code == 0){
uni.showToast({
title:info.result.message,
icon:'none'
})
}
// #endif
},
// 详情
gotoDetail(v) {
console.log(v);
uni.navigateTo({
// url: '../bookShop/commodityDetail?id=' + item.id
url: `/pages/curriculum/order/curriculum/index?navTitle=${v.title}&title=${v.title}&oid=${v.oid}`,
});
},
// 获取名称
getTitles(dictType) {
console.log("dictType", dictType);
if (this.curOneCateIndex == 0) {
if (dictType == 2) {
uni.navigateTo({
url: "./zhuanzhuchuban",
});
return;
}
$http
.request({
url: "book/generalArticle/articleByPage",
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
type: dictType == 1 ? "1" : "2",
limit: 1000,
current: 1,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log(res, "内容获取成功");
if (res.code == 0 && res.result && res.result.records.length > 0) {
this.titleList = res.result.records;
} else {
this.titleList = [];
}
})
.catch((e) => {
this.titleList = [];
console.log(e);
});
}
if (this.curOneCateIndex == 1) {
$http
.request({
url: "book/medicaldes/inheritListByPage",
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
dictType: dictType,
limit: 1000,
current: 1,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log(res, "内容获取成功");
if (res.code == 0 && res.result.records.length > 0) {
this.titleList = res.result.records;
for (let i = 0; i < this.titleList.length; i++) {
this.titleList[i].imageslist = [];
this.titleList[i].imageslist = this.titleList[i].img.split(";");
}
} else {
this.titleList = [];
}
})
.catch((e) => {
this.titleList = [];
console.log(e);
});
}
if (this.curOneCateIndex == 2) {
$http
.request({
url: "book/medicaldes/lightListByType?type=" + dictType,
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
limit: 1000,
page: 1,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log(res, "内容获取成功");
if (res.code == 0 && res.result.length > 0) {
this.titleList = res.result;
} else {
this.titleList = [];
}
})
.catch((e) => {
this.titleList = [];
console.log(e);
});
}
if (this.curOneCateIndex == 3) {
$http
.request({
url: "book/medicaldes/recordByType?type=" + dictType,
method: "POST",
data: {
// loadAnimate: 'none', // 请求加载动画
limit: 1000,
page: 1,
},
header: {
//默认 无 说明:请求头
"Content-Type": "application/json",
},
})
.then((res) => {
console.log(res, "内容获取成功");
if (res.code == 0 && res.result.length > 0) {
this.titleList = res.result;
} else {
this.titleList = [];
}
})
.catch((e) => {
this.titleList = [];
console.log(e);
});
}
},
setTwoCateIndex(item, index) {
let dictType = item.dictType;
this.curTwoCateIndex = index;
this.getTitles(dictType);
},
async setOneCateIndex(item, index) {
console.log(index, 99999);
var that = this;
let type = item.type;
this.curOneCateIndex = index;
this.curTwoCateIndex = 0;
this.searchValue = "";
this.searchList = [];
this.showSearchList = false;
// if (index != 2) {
await this.getTowCateList(type);
},
async getTowCateList(type) {
var that = this;
$http
.request({
url: "book/medicaldes/typeList?label=" + type,
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
loadAnimate: "none", // 请求加载动画
},
})
.then((res) => {
console.log(res, "二级分类获取成功");
if (res.code == 0 && res.result.length >= 0) {
this.twoCateList = res.result;
if (this.curOneCateIndex == 0) {
this.twoCateList = [
{
dictType: "1",
dictValue: "学术思想",
},
{
dictType: "2",
dictValue: "出版专著",
},
{
dictType: "3",
dictValue: "学术平台",
},
];
}
if (this.curOneCateIndex == 2) {
this.twoCateList = [
{
dictType: "1",
dictValue: "吴门之歌",
},
{
dictType: "2",
dictValue: "巴山夜语",
},
{
dictType: "3",
dictValue: "吴门之徽",
},
];
}
if (this.curOneCateIndex == 3) {
this.twoCateList = [
{
dictType: "1",
dictValue: "学术贡献",
},
{
dictType: "2",
dictValue: "抗疫纪实",
},
{
dictType: "3",
dictValue: "吴门公益",
},
];
}
this.getTitles(this.twoCateList[0].dictType);
this.$nextTick(async () => {
await uni
.createSelectorQuery()
.select(".cateList")
.boundingClientRect(function (rect) {
console.log(rect.height, "22222");
var height = 42 + rect.height + 20;
that.scrollViewHeight = height;
console.log(that.scrollViewHeight, "111111");
that.$forceUpdate();
console.log("元素高度2", height);
})
.exec();
});
} else {
this.twoCateList = [];
this.titleList = [];
}
})
.catch((e) => {
this.twoCateList = [];
this.titleList = [];
console.log(e);
});
},
transformData(inputData) {
const result = {};
inputData.forEach((item) => {
const { letter } = item;
if (!result[letter]) {
result[letter] = [];
}
result[letter].push(item);
});
// const finalResult = Object.keys(result).map(key => ({ [key]: result[key] }));
return result;
},
getCateList(id) {
id ? "" : (id = 0);
this.twoCateList = [];
this.curTwoCateIndex = 0;
this.getTowCateList(this.oneCateList[0].type);
},
// 放大图片
previewImage(url) {
console.log(url);
this.showCodeImg = false
uni.previewImage({
urls: [url],
// longPressActions: {
// itemList: ["很抱歉,暂不支持保存图片到本地"],
// success: function (res) {
// // console.log(res,'+++++')
// },
// },
});
},
},
onBackPress() {
// #ifdef APP-PLUS
plus.key.hideSoftKeybord();
// #endif
},
};
</script>
<style lang="scss" scoped>
@import "@/style/common.scss";
.box6 {
padding: 20rpx;
text-align: center;
.title {
font-size: 28rpx;
margin: 10px 0;
}
.list {
padding: 0 10px;
padding-bottom: 20rpx;
.item {
font-size: 26rpx;
color: #333;
margin-bottom: 10rpx;
padding-top:20rpx ;
padding-bottom:20rpx ;
line-height:40rpx;
border-radius: 50rpx;
border: 1px solid #eee;
}
.item.active {
color: $themeColor;
border: 1px solid $themeColor;
}
.item:last-child {
// border-bottom: none
}
}
.tbn {
justify-content: center;
}
.buybtn { padding: 0 20rpx;
background-color: #00d8df;
margin: 0;
margin-right: 20rpx;
text {
color: #fff;
}
}
.saveBtnss {
align-items: center;
justify-content: center;
height: 80rpx;
// width: 46%;
overflow: hidden;
border-radius: 50rpx;
text {
padding-left: 10rpx;
font-size: 28rpx;
}
}
.gouwuche {
border: 1px solid #666;
padding-right: 20rpx;
text {
// color: #fff;
}
}
}
.u-grid-list {
// height: 40rpx;
}
.searchList {
.item {
font-size: 28rpx;
padding: 20rpx;
border-bottom: 1px solid #dadbde;
}
}
.scroll-view_H {
background-color: #fff;
white-space: nowrap;
padding: 10rpx;
}
.scroll-Y {
height: 100%;
}
.scroll-view_H {
white-space: nowrap;
width: 100%;
}
.scroll-view-item {
// height: 300rpx;
// line-height: 300rpx;
// text-align: center;
// font-size: 36rpx;
}
.scroll-view-item_H {
display: inline-block;
width: 100%;
// height: 300rpx;
// line-height: 300rpx;
// text-align: center;
// font-size: 36rpx;
}
.titleList {
height: 100%;
}
.titleList2 {
height: calc(100% - 170rpx);
}
/deep/.scroll-view-item:nth-child(2n-1) {
background-color: transparent !important;
}
.fdButtonBox {
color: #b0b0b0;
// width: 100%;
float: right;
padding: 4rpx 14rpx;
font-size: 28rpx;
font-weight: 500;
line-height: 40rpx;
display: inline-block;
border-radius: 10rpx;
box-sizing: border-box;
// margin-top: 10rpx;
// display: flex;
// align-items: center;
}
.commonPageBox {
background-color: #f5f5f5;
}
/deep/.set_box {
background-color: #fff;
height: auto;
padding: 20rpx;
padding-bottom: 0;
padding-top: 0;
}
/deep/.titleItem {
line-height: 45rpx;
// width: calc(100% - 120rpx) !important;
}
.button_box {
width: 100%;
position: fixed;
bottom: 40rpx;
padding: 20rpx 80rpx;
.button {
margin-top: 40rpx;
}
}
/deep/.rightArrow {
margin-top: 6rpx !important;
}
</style>