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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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>
</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>
<view v-show="menuActive === 1">
<!-- -->
<OrderEdit v-if="reset" />
</view>
</scroll-view>
</view>
</template>
<script>
import gPanelFormItem from "@/components/panel/formItem.vue";
import OrderEdit from "./orderEdit.vue";
export default {
onReady() {
this.G.setNavStyle();
},
onShareAppMessage() {
return this.G.shareFun();
},
components: {
gPanelFormItem,
OrderEdit,
},
data() {
return {
isAdmin: uni.getStorageSync("apply-userinfo").admin,
globalData: getApp().globalData,
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,
};
},
onLoad(options) {
let that = this;
if (options.active) {
that.menuActive = parseInt(options.active);
}
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);
that.init();
},
methods: {
init() {
let that = this;
let userinfo = uni.getStorageSync("apply-userinfo");
that.userinfo = {
imgSrc: userinfo.user.imgSrc || "https://matripe-cms.oss-cn-beijing.aliyuncs.com/1shoudan/defaultAva.svg",
userName: userinfo.userName,
tel: userinfo.user.tel,
desp: that.userinfo.desp || "请简单介绍",
realName: userinfo.user.realName,
id: userinfo.user.id,
};
console.log("userinfo", that.userinfo);
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/changeUser?title=设置用户名&remark=好的花名,让团队成员更好记住你&value=" + that.userinfo.userName,
tip: "username",
},
{
icon: "",
label: "手机号",
result: that.userinfo.tel,
path: "/root/person/changeUser?title=设置手机号&remark=&value=" + that.userinfo.tel,
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",
});
},
});
},
},
};
</script>
<style></style>