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/changeUser.vue

183 lines
4.3 KiB
Vue

<template>
<view class="p-person-change g_w_all g_h_all g_bg_f_5 g_kuaishou">
<view class="g_h_10"></view>
<view v-if="info.title == '设置用户名'">
<g-panel-form-slot
:list="[
{
icon: '',
label: '用户名',
result: '',
path: '',
tip: 'user-name',
type: 'slot',
pColumn: 12,
},
]"
>
5 months ago
<slot>
<!-- #ifdef APP-PLUS || H5 || MP-TOUTIAO || MP-KUAISHOU -->
<u-input type="text"
:clearable="false"
:password-icon="false"
placeholder="请输入用户名" input-align="right"
class="g_text_r g_w_all"
placeholder-style="color:#999999;font-size:32rpx;line-height:1"
v-model="info.value"
5 months ago
style="width: calc(100vw - 106px);flex: none;"
/>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<u-input type="text"
:clearable="false"
:password-icon="false"
placeholder="请输入用户名" input-align="right"
class="g_text_r g_w_all"
placeholder-style="color:#999999;font-size:32rpx;line-height:1"
v-model="info.value"
/>
<!-- #endif -->
</slot>
</g-panel-form-slot>
4 months ago
<view class="g_flex_row_end" hover-class="none" hover-stop-propagation="false"
4 months ago
style="padding: 10px 22px;"
>
<view class=""
style="position: relative;font-size: 14px;color: #576b95;"
>
获取微信昵称
<button open-type="getUserInfo" @getuserinfo="getUserInfo"
style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;opacity: 0;color: #576b95;"
>获取微信昵称</button>
</view>
</view>
5 months ago
<view class="g_flex_row_center" style="margin-top:90px">
<g-button btnText="提交" type="primary" @clickBtn="submitForm" />
</view>
</view>
<view v-if="info.type == 'order'">
<g-panel-form-slot
:list="[
{
icon: '',
label: info.remark,
result: '',
path: '',
tip: 'user-name',
type: 'slot',
pColumn: 12,
},
]"
>
<slot>
<u-input type="text" :clearable="false" :password-icon="false" :placeholder="info.place" input-align="right" class="g_text_r g_w_all" placeholder-style="color:#999999;font-size:32rpx;line-height:1" v-model="info.value" />
</slot>
</g-panel-form-slot>
<view class="g_mt_90 g_flex_row_center">
<g-button btnText="提交" type="primary" @clickBtn="submitOrderForm" />
</view>
</view>
<view v-if="info.title == '设置手机号'">
<g-panel-form-item
:list="[
{
icon: '',
label: '手机号',
result: info.value,
path: '',
tip: 'user-tel',
type: 'slot',
},
]"
/>
<view class="g_fs_14 g_c_9 g_flex_row_center g_mt_10">暂不支持修改</view>
</view>
</view>
</template>
<script>
export default {
onReady() {
this.G.setNavStyle();
},
onShareAppMessage() {
return this.G.shareFun();
},
data() {
return {
info: {},
};
},
onLoad(options) {
console.log("options", options);
this.info = options;
uni.setNavigationBarTitle({
title: options.title,
});
},
methods: {
4 months ago
getUserInfo(e){
console.log(e)
this.info.value = e.detail.userInfo.nickName;
},
submitForm() {
let that = this;
if (that.info.value == "") {
uni.showToast({
title: "请输入用户名",
icon: "none",
});
return false;
}
that.G.Post(
that.api.user_changeName,
{
userName: that.info.value,
formdata: true,
},
() => {
uni.showToast({
title: "修改成功",
icon: "success",
});
that.G.checkToken();
// uni.setStorageSync('apply-username', that.info.value)
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
);
},
submitOrderForm(info) {
let that = this;
console.log(that.info.value);
if (!this.info.value.trim()) {
uni.showToast({
title: "名称不能为空",
icon: "none",
});
return false;
}
if (that.info.title == "修改账号名称") {
if (that.info.value.length > 10) {
uni.showToast({
title: "账号名称最多10个字",
icon: "none",
});
return;
}
uni.$emit("changeAccountName", { info: this.info.value });
uni.navigateBack();
5 months ago
} else if (that.info.title == "修改企业全称") {
uni.$emit("changeStoreName", { info: this.info.value });
uni.navigateBack();
}
},
},
};
</script>
<style></style>