Commit 82d212e4 authored by chenwei's avatar chenwei

提交关于个人信息的代码

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