Commit 82d212e4 authored by chenwei's avatar chenwei

提交关于个人信息的代码

parent e9eb444e
......@@ -192,7 +192,6 @@ export function checkControlPwd(orderId) {
//获取城市
export function getCityListByParent(query) {
console.log("99999", query);
return request({
url: "/admin-api/ecw/region/getCityListByParent",
method: "get",
......
......@@ -25,6 +25,7 @@ export default {
bannerdetail: "banner detail",
coupons: "coupons",
customer: "customers",
integral: "integral",
supplier: "suppliers",
ecash: "e-cash",
delivery: "delivery",
......@@ -378,6 +379,9 @@ export default {
validate1: "name",
validate2: "phone number",
validate3: "English name",
validateCity: "city",
validateCountry: "city",
saveButton: "Please input info",
editPwdNotice: "Before performing this operation, initialize the password",
initPwdNotice: "Ensure that the two passwords are the same",
companyWebsiteNotice:
......
This diff is collapsed.
This diff is collapsed.
/** When your routing table is too long, you can split it into small modules **/
import Jdlayout from '@/layout/jdlayout'
import Jdlayout from "@/layout/jdlayout";
const jiedaoRouter = {
path: '/jiedao',
path: "/jiedao",
component: Jdlayout,
redirect: '/jiedao/jd-profile',
name: 'Table',
redirect: "/jiedao/jd-profile",
name: "Table",
meta: {
title: 'profile',
icon: 'table'
title: "profile",
icon: "table",
},
children: [
{
path: 'jd-profile',
component: () => import('@/views/jiedao/profile'),
name: 'Profile',
meta: { title: 'profile' }
path: "jd-profile",
component: () => import("@/views/jiedao/profile"),
name: "Profile",
meta: { title: "profile" },
},
{
path: 'jd-setting',
component: () => import('@/views/jiedao/profile/setting'),
name: 'Setting',
meta: { title: 'setting' }
path: "jd-setting",
component: () => import("@/views/jiedao/profile/setting"),
name: "Setting",
meta: { title: "setting" },
},
{
path: 'jd-advice',
component: () => import('@/views/jiedao/profile/advice'),
name: 'Advice',
meta: { title: 'advice' }
path: "jd-advice",
component: () => import("@/views/jiedao/profile/advice"),
name: "Advice",
meta: { title: "advice" },
},
{
path: 'jd-help',
component: () => import('@/views/jiedao/profile/help'),
name: 'Help',
meta: { title: 'help' }
path: "jd-help",
component: () => import("@/views/jiedao/profile/help"),
name: "Help",
meta: { title: "help" },
},
{
path: 'jd-message',
component: () => import('@/views/jiedao/profile/message'),
name: 'Message',
meta: { title: 'message' }
path: "jd-message",
component: () => import("@/views/jiedao/profile/message"),
name: "Message",
meta: { title: "message" },
},
{
path: 'jd-message',
component: () => import('@/views/jiedao/profile/messagedetail'),
name: 'Message',
meta: { title: 'message' },
path: "jd-message",
component: () => import("@/views/jiedao/profile/messagedetail"),
name: "Message",
meta: { title: "message" },
children: [
{
path: 'jd-messagedetail',
component: () => import('@/views/jiedao/profile/messagedetail'),
name: 'Messagedetail',
meta: { title: 'messagedetail' }
}
]
path: "jd-messagedetail",
component: () => import("@/views/jiedao/profile/messagedetail"),
name: "Messagedetail",
meta: { title: "messagedetail" },
},
],
},
{
path: 'jd-notice',
component: () => import('@/views/jiedao/profile/notice'),
name: 'Notice',
meta: { title: 'notice' }
path: "jd-notice",
component: () => import("@/views/jiedao/profile/notice"),
name: "Notice",
meta: { title: "notice" },
},
{
path: 'jd-notice',
component: () => import('@/views/jiedao/profile/noticedetail'),
name: 'Notice',
meta: { title: 'notice' },
path: "jd-notice",
component: () => import("@/views/jiedao/profile/noticedetail"),
name: "Notice",
meta: { title: "notice" },
children: [
{
path: 'jd-noticedetail',
component: () => import('@/views/jiedao/profile/noticedetail'),
name: 'Noticedetail',
meta: { title: 'noticedetail' }
}
]
path: "jd-noticedetail",
component: () => import("@/views/jiedao/profile/noticedetail"),
name: "Noticedetail",
meta: { title: "noticedetail" },
},
],
},
{
path: 'jd-bannerdetail',
component: () => import('@/views/jiedao/profile/bannerdetail'),
name: 'Banner',
meta: { title: 'bannerdetail' }
path: "jd-bannerdetail",
component: () => import("@/views/jiedao/profile/bannerdetail"),
name: "Banner",
meta: { title: "bannerdetail" },
},
{
path: 'jd-coupon',
component: () => import('@/views/jiedao/profile/coupons'),
name: 'Coupons',
meta: { title: 'coupons' }
path: "jd-coupon",
component: () => import("@/views/jiedao/profile/coupons"),
name: "Coupons",
meta: { title: "coupons" },
},
{
path: 'jd-customer',
component: () => import('@/views/jiedao/profile/customer'),
name: 'Customer',
meta: { title: 'customer' }
path: "jd-integral",
component: () => import("@/views/jiedao/profile/integral"),
name: "Integral",
meta: { title: "integral" },
},
{
path: 'jd-supplier',
component: () => import('@/views/jiedao/profile/supplier'),
name: 'Supplier',
meta: { title: 'supplier' }
path: "jd-customer",
component: () => import("@/views/jiedao/profile/customer"),
name: "Customer",
meta: { title: "customer" },
},
{
path: 'jd-ecash',
component: () => import('@/views/jiedao/profile/ecash'),
name: 'Ecash',
meta: { title: 'ecash' }
path: "jd-supplier",
component: () => import("@/views/jiedao/profile/supplier"),
name: "Supplier",
meta: { title: "supplier" },
},
{
path: 'jd-delivery',
component: () => import('@/views/jiedao/profile/delivery'),
name: 'Delivery',
meta: { title: 'delivery' }
path: "jd-ecash",
component: () => import("@/views/jiedao/profile/ecash"),
name: "Ecash",
meta: { title: "ecash" },
},
{
path: 'jd-controlorder',
component: () => import('@/views/jiedao/profile/controlorder'),
name: 'Controlorder',
meta: { title: 'controlorder' }
path: "jd-delivery",
component: () => import("@/views/jiedao/profile/delivery"),
name: "Delivery",
meta: { title: "delivery" },
},
{
path: 'jd-waitmoneyorder',
component: () => import('@/views/jiedao/profile/waitmoneyorder'),
name: 'Waitmoneyorder',
meta: { title: 'waitmoneyorder' }
path: "jd-controlorder",
component: () => import("@/views/jiedao/profile/controlorder"),
name: "Controlorder",
meta: { title: "controlorder" },
},
{
path: 'jd-receivedorder',
component: () => import('@/views/jiedao/profile/receivedorder'),
name: 'Receivedorder',
meta: { title: 'receivedorder' }
path: "jd-waitmoneyorder",
component: () => import("@/views/jiedao/profile/waitmoneyorder"),
name: "Waitmoneyorder",
meta: { title: "waitmoneyorder" },
},
{
path: 'jd-postorder',
component: () => import('@/views/jiedao/profile/postorder'),
name: 'Postorder',
meta: { title: 'postorder' }
path: "jd-receivedorder",
component: () => import("@/views/jiedao/profile/receivedorder"),
name: "Receivedorder",
meta: { title: "receivedorder" },
},
{
path: 'jd-orderdetail',
component: () => import('@/views/jiedao/profile/orderdetail'),
name: 'Orderdetail',
meta: { title: 'orderdetail' }
path: "jd-postorder",
component: () => import("@/views/jiedao/profile/postorder"),
name: "Postorder",
meta: { title: "postorder" },
},
{
path: 'jd-price',
component: () => import('@/views/jiedao/profile/price'),
name: 'Orderdetail',
meta: { title: 'price' }
path: "jd-orderdetail",
component: () => import("@/views/jiedao/profile/orderdetail"),
name: "Orderdetail",
meta: { title: "orderdetail" },
},
{
path: 'jd-logistics',
component: () => import('@/views/jiedao/profile/logistics'),
name: 'Logistics',
meta: { title: 'logistics' }
path: "jd-price",
component: () => import("@/views/jiedao/profile/price"),
name: "Orderdetail",
meta: { title: "price" },
},
{
path: 'jd-abnormal',
component: () => import('@/views/jiedao/profile/abnormal'),
name: 'Abnormal',
meta: { title: 'abnormal' }
path: "jd-logistics",
component: () => import("@/views/jiedao/profile/logistics"),
name: "Logistics",
meta: { title: "logistics" },
},
{
path: 'jd-idcard',
component: () => import('@/views/jiedao/profile/idcard'),
name: 'Notice',
meta: { title: 'idcard' }
path: "jd-abnormal",
component: () => import("@/views/jiedao/profile/abnormal"),
name: "Abnormal",
meta: { title: "abnormal" },
},
{
path: 'jd-deliveryedit',
component: () => import('@/views/jiedao/profile/delivery'),
name: 'Notice',
meta: { title: 'delivery' }
path: "jd-idcard",
component: () => import("@/views/jiedao/profile/idcard"),
name: "Notice",
meta: { title: "idcard" },
},
{
path: 'jd-deliverysuccess',
component: () => import('@/views/jiedao/profile/deliverysuccess'),
name: 'Notice',
meta: { title: 'deliverysuccess' }
}
]
}
export default jiedaoRouter
path: "jd-deliveryedit",
component: () => import("@/views/jiedao/profile/delivery"),
name: "Notice",
meta: { title: "delivery" },
},
{
path: "jd-deliverysuccess",
component: () => import("@/views/jiedao/profile/deliverysuccess"),
name: "Notice",
meta: { title: "deliverysuccess" },
},
],
};
export default jiedaoRouter;
<template>
<div class="app-container">
我的积分
<img src="@/assets/setting/user.png" />
</div>
</template>
This diff is collapsed.
......@@ -161,21 +161,6 @@ export default {
}, 1000);
});
},
getInfo() {
getInfo().then((r) => {
if (r.data.city) {
this.$router.push({
path: this.redirect || "//myInfo",
query: this.otherQuery,
});
} else {
}
this.$router.push({
path: this.redirect || "/jiedao/jd-profile",
query: this.otherQuery,
});
});
},
getInfos() {
getInfo().then((r) => {
this.loading = false;
......@@ -196,20 +181,8 @@ export default {
this.$refs.loginForm.validate(async (valid) => {
if (valid) {
this.loading = true;
await this.$store.dispatch("user/login", this.loginForm);
await this.$store.dispatch("user/smsLogin", this.loginForm);
await this.getInfos();
// this.$store
// .dispatch("user/smsLogin", this.loginForm)
// .then(() => {
// this.$router.push({
// path: this.redirect || "/jiedao/jd-profile",
// query: this.otherQuery,
// });
// this.loading = false;
// })
// .catch(() => {
// this.loading = false;
// });
} else {
console.log("error submit!!");
return false;
......
......@@ -169,15 +169,6 @@ export default {
this.loading = true;
await this.$store.dispatch("user/login", this.loginForm);
await this.getInfos();
// .then(() => {
// console.log("9999997--ee--");
// return this.getInfos();
// console.log("9999997----");
// this.loading = false;
// })
// .catch(() => {
// this.loading = false;
// });
} else {
console.log("error submit!!");
return false;
......
......@@ -6,14 +6,14 @@
<div class="right_back">
<div class="start-bar"></div>
<el-form
ref="loginForm"
ref="myInfo"
:model="params"
:rules="rules"
autocomplete="on"
label-position="left"
label-width="80px"
>
<el-form-item prop="username" :label="$t('myInfo.name')">
<el-form-item prop="nickname" :label="$t('myInfo.name')">
<el-input
ref="username"
v-model="params.nickname"
......@@ -23,9 +23,8 @@
tabindex="1"
/>
</el-form-item>
<el-form-item prop="username" :label="$t('myInfo.nameEn')">
<el-form-item :label="$t('myInfo.nameEn')">
<el-input
ref="username"
v-model="params.englishName"
:placeholder="$t('notices.nameEn')"
name="username"
......@@ -34,10 +33,10 @@
/>
</el-form-item>
<!-- 生日 -->
<el-form-item prop="username" :label="$t('myInfo.birth')">
<el-form-item :label="$t('myInfo.birth')">
<el-date-picker
v-model="params.birthday"
type="datetime"
type="date"
:placeholder="$t('notices.birthday')"
/>
</el-form-item>
......@@ -79,7 +78,7 @@
</el-select>
</el-col>
</el-row>
<el-form-item :label="$t('myInfo.country')">
<el-form-item prop="country" :label="$t('myInfo.country')">
<el-select
v-model="params.country"
@change="getCityList"
......@@ -92,7 +91,7 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('myInfo.city')">
<el-form-item prop="city" :label="$t('myInfo.city')">
<el-select v-model="params.city" :placeholder="$t('notices.city')">
<el-option
v-for="(item, index) in cityList"
......@@ -102,9 +101,8 @@
</el-select>
</el-form-item>
<!-- 地址 -->
<el-form-item prop="username" :label="$t('myInfo.adderss')">
<el-form-item :label="$t('myInfo.adderss')">
<el-input
ref="username"
v-model="params.adderss"
:placeholder="$t('notices.adderss')"
name="username"
......@@ -112,9 +110,8 @@
tabindex="1"
/>
</el-form-item>
<el-form-item prop="username" :label="$t('myInfo.department')">
<el-form-item :label="$t('myInfo.department')">
<el-input
ref="username"
v-model="params.department"
:placeholder="$t('notices.department')"
name="department"
......@@ -122,9 +119,8 @@
tabindex="1"
/>
</el-form-item>
<el-form-item prop="username" :label="$t('myInfo.job')">
<el-form-item :label="$t('myInfo.job')">
<el-input
ref="username"
v-model="params.department"
:placeholder="$t('notices.job')"
name="username"
......@@ -133,34 +129,15 @@
/>
</el-form-item>
</el-form>
<!-- <div class="consultAdd">
<div class="consult-item">
<div class="consult-item-label">
<span>{{ $t("myInfo.birth") }}</span>
</div>
</div>
</div> -->
<!-- <div class="consult-item">
</div>
<div style="width: 100%; text-align: center; margin-top: 60px">
<el-button
type="primary"
round
style="width: 70%"
@click.native.prevent="submitForm"
>{{ $t("myInfo.edit") }}</el-button
>
</div>
<div class="consult-item">
<div class="consult-item-label">
<span>{{ myInfo.country }}</span>
</div>
<div class="consult-item-put">
<picker
style="width: 100%"
:range="countryArray"
:range-key="rangeKey == 'zh' ? 'titleZh' : 'titleEn'"
@change="bindCountyChange"
>
<div :class="{ placeholder: !params.country }">{{
params.countryValue ? params.countryValue : notices.country
}}</div>
</picker>
<div class="" @click="submitForm">{{ myInfo.edit }}</div> -->
<!-- </div> -->
</div>
</div>
</template>
......@@ -170,18 +147,20 @@ import {
getCode,
getCountryList,
getCityListByParent,
getInfo,
getTradeCountryList,
update,
} from "@/api/user";
import { langData } from "@/data/lang";
import { deepClone } from "@/utils";
export default {
data() {
const currentDate = this.getDate({
format: true,
});
return {
rules: {},
params: {},
params: {
areaCode: "86",
city: null,
country: null,
},
areaData: [],
areaName: [],
countryAreaCodeList: [],
......@@ -190,18 +169,46 @@ export default {
areaIndex: 0,
countryList: [],
genderData: [
{ value: 0, label: this.$t("myInfo.girl") },
{ value: 1, label: this.$t("myInfo.boy") },
{ value: 2, label: this.$t("myInfo.secret") },
{ value: "0", label: this.$t("myInfo.girl") },
{ value: "1", label: this.$t("myInfo.boy") },
{ value: "2", label: this.$t("myInfo.secret") },
],
// 国家列表
// 城市列表
cityList: [],
rules: {
nickname: [
{
required: true,
message: this.$t("notices.name"),
trigger: "blur",
},
],
mobile: [
{
required: true,
message: this.$t("login.mobileRules"),
trigger: "blur",
},
{ pattern: /^[0-9]\d*$/, message: this.$t("customer.phoneRules2") },
],
city: [
{
required: true,
message: this.$t("notices.city"),
trigger: "change",
},
],
country: [
{
required: true,
message: this.$t("notices.country"),
trigger: "change",
},
],
},
};
},
onLoad() {
this.getUserInfo();
},
computed: {
language: {
get() {
......@@ -224,87 +231,43 @@ export default {
this.countryAreaCodeList = r.data;
});
this.getTradeCountryList();
this.getUserInfo();
},
methods: {
submitForm() {
this.$request
.put("/app-api/member/user/update", this.params)
.then((res) => {
if (res.code == 0) {
uni.showToast({
title: this.notices.edited,
icon: "none",
});
} else {
uni.showToast({
title: res.msg,
icon: "none",
this.$refs["myInfo"].validate((valid) => {
if (valid) {
update(this.params).then((res) => {
this.$router.push({
path: "/jiedao/jd-profile",
});
}
});
});
} else {
console.log("error submit!!");
return false;
}
});
},
getUserInfo() {
this.$request.get("/app-api/member/user/get").then((res) => {
if (res.code == 0 && res.data) {
this.params = res.data;
if (!res.data.gender) {
this.params.gender = 2;
}
if (res.data.birthday) {
this.date = res.data.birthday;
}
this.$store.dispatch("user/getInfo").then((res) => {
this.params = deepClone(res);
if (!res.gender) {
this.params.gender = "2";
}
});
},
getDate(type) {
const date = new Date();
let year = date.getFullYear() - 16;
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === "start") {
year = year - 80;
} else if (type === "end") {
year = year;
}
month = month > 9 ? month : "0" + month;
day = day > 9 ? day : "0" + day;
return `${year}-${month}-${day}`;
},
bindDateChange: function (e) {
this.date = e.detail.value;
this.params.birthday = e.detail.value;
},
//获取城市接口
getTradeCountryList() {
getTradeCountryList().then((res) => {
this.countryList = res.data;
});
},
// 国家选择 change
bindCountyChange(e) {
// const index = e.detail.value;
// const { titleZh, titleEn, id } = this.countryArray[index];
// const value = this.rangeKey == "zh" ? titleZh : titleEn;
// this.$set(this.params, "countryValue", value);
// this.$set(this.params, "country", id);
// this.getCityList(id);
},
// 获取城市列表
getCityList(id) {
getCityListByParent({ id }).then((res) => {
this.cityList = res.data;
});
},
// 城市选择 change
bindCityChange(e) {
const index = e.detail.value;
const { titleZh, titleEn, id } = this.cityArray[index];
const value = this.rangeKey == "zh" ? titleZh : titleEn;
this.$set(this.params, "cityValue", value);
this.$set(this.params, "city", id);
},
},
};
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment