You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
4.7 KiB
Vue

2 months ago
<template>
<view class="p-person-info g_w_all g_h_all g_bg_f_5 g_kuaishou">
2 months ago
<view class="g_bg_f sticky" :style="{ boxShadow: '0px 4px 4px 0px rgba(218, 218, 218, 0.5)' }">
2 months ago
<g-tabs bg-color="transparent" from="index" :list="menuList" :is-scroll="false" :current="menuActive" bar-width="64" bar-height="6" @change="handleUpdateMenu" font-size="32" duration="0.05" height="76"></g-tabs>
2 months ago
</view>
2 months ago
<scroll-view class="" :scroll-y="true" style="height: calc(100vh - 38px)">
<view class="g_h_10"> </view>
<!-- 根据menuActive显示不同内容 -->
<view v-if="menuActive === 0" class="g_flex_column_start">
<!-- 个人资料内容 -->
<view class="">
<g-panel-form-item :list="list" @clickItem="handleClickItem" />
</view>
<!-- <view class="" hover-class="none" hover-stop-propagation="false">
<g-panel-form-item
:list="[
{
icon: '',
label: '人海号',
result: userinfo.bocaiId,
type: 'slot',
tip: 'copy',
},
]"
@copyVal="onCopyVal"
/>
</view> -->
1 week ago
<view class="g_pt_8">
2 months ago
<g-panel-form-item :list="[{ icon_after: userinfo.realName ? 'yirenzheng g_c_main' : '', label: '实名认证', result: userinfo.realName ? '' : '去认证', path: '/root/person/idcardForm', type: userinfo.realName ? 'slot' : '' }]" @clickItem="goRealName" />
</view>
</view>
<view v-else>
<!-- 企业资料内容直接引入组件 -->
<OrderEdit v-if="reset" />
</view>
</scroll-view>
2 months ago
</view>
</template>
<script>
2 months ago
import OrderEdit from "./orderEdit.vue";
2 months ago
export default {
onReady() {
2 months ago
this.G.setNavStyle();
2 months ago
},
onShareAppMessage() {
return this.G.shareFun();
},
2 months ago
components: {
OrderEdit,
},
2 months ago
data() {
return {
2 months ago
themeColor: getApp().globalData.themeColor,
isAdmin: uni.getStorageSync("apply-userinfo").admin,
2 months ago
userinfo: {},
list: [],
cdnBaseImg: this.G.store().cdnBaseImg,
localBaseImg: this.G.store().localBaseImg,
2 months ago
svgBaseImg: this.G.store().svgBaseImg,
menuList: [
{
name: "个人资料",
tip: "0",
},
{
name: "企业资料",
tip: "1",
},
],
menuActive: 0,
reset: true,
2 months ago
};
},
2 months ago
onLoad(options) {
2 months ago
let that = this;
2 months ago
if (options.active) {
that.menuActive = parseInt(options.active);
}
2 months ago
uni.$on("changePersonDesp", function (data) {
console.log(data.info);
console.log("监听到事件来自 update ,携带参数 msg 为:" + data.info);
that.userinfo.desp = data.info;
let info = {
fieldName: "desp",
fieldValue: that.userinfo.desp,
};
setTimeout(() => {
that.editField(info);
}, 100);
});
},
onShow() {
let that = this;
2 months ago
// this.reset = false;
// console.log("this.reset", this.reset);
// setTimeout(() => {
// this.reset = true;
// }, 10);
console.log("this.reset", this.reset);
2 months ago
that.init();
2 months ago
// that.getBocaiId();
2 months ago
},
methods: {
init() {
let that = this;
2 months ago
let userinfo = uni.getStorageSync("apply-userinfo");
2 months ago
that.userinfo = {
2 months ago
imgSrc: userinfo.user.imgSrc || that.svgBaseImg + "defaultAva.svg",
userName: userinfo.userName,
tel: userinfo.user.tel,
2 months ago
desp: that.userinfo.desp || "请简单介绍",
2 months ago
realName: userinfo.user.realName,
id: userinfo.user.id,
2 months ago
};
2 months ago
console.log("userinfo", that.userinfo);
2 months ago
let defaultList = [
{
icon: "",
label: "头像",
result: "",
value: that.userinfo.imgSrc,
path: "/root/person/avatar",
tip: "avatar",
pColumn: 22,
},
{
icon: "",
label: "用户名",
result: that.userinfo.userName,
path: "/root/person/change?title=设置用户名&remark=好的花名,让团队成员更好记住你&value=" + that.userinfo.userName,
tip: "username",
},
{
icon: "",
label: "手机号",
result: that.userinfo.tel,
path: "/root/person/change?title=设置手机号&remark=&value=" + that.userinfo.tel,
tip: "mobile",
},
];
that.list = defaultList;
},
2 months ago
getBocaiId() {
let that = this;
this.F.wyyxPost(this.api.wyyx_getConfig, { userId: that.userinfo.id }, (res) => {
console.log("res", res);
that.userinfo.bocaiId = res.accid;
});
},
2 months ago
editField(info) {
let that = this;
console.log(info);
that.G.Put(that.api.user_changeTobeSupplierField, info, (res) => {
that.showSuccess();
});
},
handleClickItem(e) {
let that = this;
uni.navigateTo({
url: e.item.path,
});
},
2 months ago
goRealName(e) {
if (!this.userinfo.realName) {
uni.navigateTo({
url: e.item.path,
});
}
},
handleUpdateMenu(index) {
this.menuActive = index;
},
onCopyVal(e) {
uni.setClipboardData({
data: e.item.result,
success(res) {
uni.showToast({
title: "复制成功",
icon: "success",
});
},
});
},
2 months ago
},
};
</script>
<style></style>