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.
apply-assistant-v3/root/person/info.vue

185 lines
4.7 KiB
Vue

6 months ago
<template>
<view class="p-person-info g_w_all g_h_all g_bg_f_5 g_kuaishou">
<view class="g_bg_f sticky" :style="{ boxShadow: '0px 4px 4px 0px rgba(218, 218, 218, 0.5)' }">
<u-tabs bg-color="transparent" from="index" :list="menuList" :is-scroll="false" :current="menuActive" :active-color="globalData.themeColor" bar-width="64" bar-height="6" @change="handleUpdateMenu" font-size="32" duration="0.05" height="76"></u-tabs>
6 months ago
</view>
<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" style="height: calc(100% - 9px)">
<!-- 个人资料内容 -->
<view class="">
<g-panel-form-item :list="list" @clickItem="handleClickItem" />
</view>
<!-- <view class="g_pt_16">
<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>
5 months ago
<view v-show="menuActive === 1">
<!-- 企业资料内容直接引入组件 -->
<OrderEdit v-if="reset" />
</view>
</scroll-view>
6 months ago
</view>
</template>
<script>
import gPanelFormItem from "@/components/panel/formItem.vue";
import OrderEdit from "./orderEdit.vue";
6 months ago
export default {
onReady() {
this.G.setNavStyle();
},
onShareAppMessage() {
return this.G.shareFun();
},
components: {
gPanelFormItem,
OrderEdit,
},
6 months ago
data() {
return {
isAdmin: uni.getStorageSync("apply-userinfo").admin,
globalData: getApp().globalData,
6 months ago
userinfo: {},
list: [],
cdnBaseImg: this.G.store().cdnBaseImg,
localBaseImg: this.G.store().localBaseImg,
svgBaseImg: this.G.store().svgBaseImg,
menuList: [
{
name: "个人资料",
tip: "0",
},
{
name: "企业资料",
tip: "1",
},
],
menuActive: 0,
reset: true,
6 months ago
};
},
onLoad(options) {
6 months ago
let that = this;
if (options.active) {
that.menuActive = parseInt(options.active);
}
6 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;
// this.reset = false;
// console.log("this.reset", this.reset);
// setTimeout(() => {
// this.reset = true;
// }, 10);
console.log("this.reset", this.reset);
6 months ago
that.init();
},
methods: {
init() {
let that = this;
let userinfo = uni.getStorageSync("apply-userinfo");
6 months ago
that.userinfo = {
5 months ago
imgSrc: userinfo.user.imgSrc || "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/defaultAva.svg",
userName: userinfo.userName,
tel: userinfo.user.tel,
6 months ago
desp: that.userinfo.desp || "请简单介绍",
realName: userinfo.user.realName,
id: userinfo.user.id,
6 months ago
};
console.log("userinfo", that.userinfo);
6 months ago
let defaultList = [
{
icon: "",
label: "头像",
result: "",
value: that.userinfo.imgSrc,
path: "/root/person/avatar",
tip: "avatar",
3 months ago
pColumn: 19,
6 months ago
},
{
icon: "",
label: "用户名",
result: that.userinfo.userName,
5 months ago
path: "/root/person/changeUser?title=设置用户名&remark=好的花名,让团队成员更好记住你&value=" + that.userinfo.userName,
6 months ago
tip: "username",
},
{
icon: "",
label: "手机号",
result: that.userinfo.tel,
5 months ago
path: "/root/person/changeUser?title=设置手机号&remark=&value=" + that.userinfo.tel,
6 months ago
tip: "mobile",
},
];
if (uni.getStorageSync("apply-supplierAccount") == 1) {
// 有
that.list = defaultList.concat([
{
icon: "",
label: "二维码名片",
result: "",
path: "/root/bind/search?active=1",
tip: "code",
},
]);
} else {
// 无
that.list = defaultList;
}
},
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,
});
},
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",
});
},
});
},
6 months ago
},
};
</script>
<style></style>