init
This commit is contained in:
149
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.js
vendored
Normal file
149
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.js
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var common_vendor = require("../../common/vendor.js");
|
||||
var pages_api_my = require("../api/my.js");
|
||||
var utils_index = require("../../utils/index.js");
|
||||
require("../../utils/request.js");
|
||||
require("../../utils/env.js");
|
||||
require("../api/login.js");
|
||||
const _sfc_main = {
|
||||
__name: "index",
|
||||
setup(__props) {
|
||||
const token = common_vendor.ref();
|
||||
const sexList = common_vendor.reactive(["\u5973", "\u7537"]);
|
||||
let nickName = common_vendor.ref("");
|
||||
let avatarUrl = common_vendor.ref("");
|
||||
let startDate = common_vendor.ref();
|
||||
let endDate = common_vendor.ref();
|
||||
let idCard = common_vendor.ref("");
|
||||
let name = common_vendor.ref("");
|
||||
let sex = common_vendor.ref(1);
|
||||
let birthday = common_vendor.ref("1995-09-01");
|
||||
const isRealNameAuth = common_vendor.ref(false);
|
||||
common_vendor.onShow(() => {
|
||||
startDate.value = getDate("start");
|
||||
endDate.value = getDate("end");
|
||||
nickName.value = common_vendor.index.getStorageSync("nickName") || "\u795E\u9886\u7528\u6237";
|
||||
avatarUrl.value = common_vendor.index.getStorageSync("avatarUrl") || "../../static/defaultHeadImg.png";
|
||||
token.value = common_vendor.index.getStorageSync("token");
|
||||
baseUserInfo();
|
||||
});
|
||||
const handleLogout = () => {
|
||||
common_vendor.index.removeStorageSync("token");
|
||||
common_vendor.index.removeStorageSync("nickName");
|
||||
common_vendor.index.removeStorageSync("avatarUrl");
|
||||
common_vendor.index.switchTab({
|
||||
url: "/pages/index/index"
|
||||
});
|
||||
};
|
||||
const baseUserInfo = () => {
|
||||
pages_api_my.getUserInfo().then((res) => {
|
||||
if (res) {
|
||||
isRealNameAuth.value = Boolean(res.data.idCardNoVerify);
|
||||
idCard.value = res.data.idCardNo || "";
|
||||
name.value = res.data.name;
|
||||
sex.value = res.data.sex;
|
||||
birthday.value = res.data.birthday;
|
||||
nickName.value = res.data.phone;
|
||||
common_vendor.index.setStorageSync("nickName", res.data.phone);
|
||||
}
|
||||
});
|
||||
};
|
||||
const getDate = (type) => {
|
||||
const date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
if (type === "start") {
|
||||
year = year - 60;
|
||||
} else {
|
||||
year = year + 2;
|
||||
}
|
||||
month = month > 9 ? month : "0" + month;
|
||||
day = day > 9 ? day : "0" + day;
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
const toLogin = () => {
|
||||
if (common_vendor.index.getStorageSync("token")) {
|
||||
getUserInfoFunc();
|
||||
} else {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/index"
|
||||
});
|
||||
}
|
||||
};
|
||||
const handleToAddress = () => {
|
||||
common_vendor.index.navigateTo({
|
||||
url: common_vendor.index.getStorageSync("token") ? "/pages/address/index?type=address&isFromAddress=true" : "/pages/login/index"
|
||||
});
|
||||
};
|
||||
const handleTorealName = () => {
|
||||
if (!common_vendor.index.getStorageSync("token")) {
|
||||
return common_vendor.index.navigateTo({
|
||||
url: "/pages/login/index"
|
||||
});
|
||||
}
|
||||
if (isRealNameAuth.value) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/subPages/authentication-success/index?name=" + name.value + "&idCard=" + idCard.value
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/subPages/realName-authentication/index"
|
||||
});
|
||||
}
|
||||
};
|
||||
const getDateChange = (e) => {
|
||||
pages_api_my.updateUserInfo({
|
||||
birthday: e.detail.value
|
||||
}).then((res) => {
|
||||
baseUserInfo();
|
||||
}).catch((err) => {
|
||||
common_vendor.index.showToast({
|
||||
title: "\u7F51\u7EDC\u5F02\u5E38",
|
||||
duration: 2e3,
|
||||
icon: "none"
|
||||
});
|
||||
});
|
||||
};
|
||||
const changeSex = (e) => {
|
||||
pages_api_my.updateUserInfo({
|
||||
sex: Number(e.detail.value)
|
||||
}).then((res) => {
|
||||
baseUserInfo();
|
||||
}).catch((err) => {
|
||||
common_vendor.index.showToast({
|
||||
title: "\u7F51\u7EDC\u5F02\u5E38",
|
||||
duration: 2e3,
|
||||
icon: "none"
|
||||
});
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.unref(avatarUrl),
|
||||
b: common_vendor.t(common_vendor.unref(nickName)),
|
||||
c: common_vendor.o(toLogin),
|
||||
d: common_vendor.o(handleToAddress),
|
||||
e: common_vendor.o(handleTorealName),
|
||||
f: common_vendor.o((...args) => common_vendor.unref(utils_index.handleSecondQi) && common_vendor.unref(utils_index.handleSecondQi)(...args)),
|
||||
g: token.value
|
||||
}, token.value ? {
|
||||
h: common_vendor.t(common_vendor.unref(sex) ? "\u7537" : "\u5973"),
|
||||
i: common_vendor.o(changeSex),
|
||||
j: common_vendor.unref(sex),
|
||||
k: sexList,
|
||||
l: common_vendor.t(common_vendor.unref(birthday)),
|
||||
m: common_vendor.unref(birthday),
|
||||
n: common_vendor.unref(startDate),
|
||||
o: common_vendor.unref(endDate),
|
||||
p: common_vendor.o(getDateChange)
|
||||
} : {}, {
|
||||
q: token.value
|
||||
}, token.value ? {
|
||||
r: common_vendor.o(handleLogout)
|
||||
} : {});
|
||||
};
|
||||
}
|
||||
};
|
||||
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4dcceeb0"], ["__file", "E:/project/project-wl-yonghuduan-uniapp-vue3/pages/my/index.vue"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
5
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.json
vendored
Normal file
5
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "我的",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.wxml
vendored
Normal file
1
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="my data-v-4dcceeb0"><view class="banner data-v-4dcceeb0"><view class="headBox data-v-4dcceeb0" bindtap="{{c}}"><image class="data-v-4dcceeb0" src="{{a}}"/><view class="userName data-v-4dcceeb0">{{b}}</view></view></view><view class="list-top data-v-4dcceeb0"><view class="list-item data-v-4dcceeb0" bindtap="{{d}}"><view class="left data-v-4dcceeb0"><image class="icon data-v-4dcceeb0" src="/static/my-address.png"/><view class="label data-v-4dcceeb0">地址簿</view></view><image class="arrow data-v-4dcceeb0" src="/static/icon15.png"/></view><view class="list-item data-v-4dcceeb0" bindtap="{{e}}"><view class="left data-v-4dcceeb0"><image class="icon data-v-4dcceeb0" src="/static/my-name.png"/><view class="label data-v-4dcceeb0">实名认证</view></view><image class="arrow data-v-4dcceeb0" src="/static/icon15.png"/></view><view class="list-item data-v-4dcceeb0" bindtap="{{f}}"><view class="left data-v-4dcceeb0"><image class="icon data-v-4dcceeb0" src="/static/my-send.png"/><view class="label data-v-4dcceeb0">专属快递员</view></view><image class="arrow data-v-4dcceeb0" src="/static/icon15.png"/></view></view><view wx:if="{{g}}" class="list-bottom data-v-4dcceeb0"><picker class="data-v-4dcceeb0" mode="selector" bindchange="{{i}}" value="{{j}}" range="{{k}}"><view class="list-item sex data-v-4dcceeb0"><view class="label data-v-4dcceeb0">性别</view><view class="item-value data-v-4dcceeb0">{{h}}</view><image class="arrow data-v-4dcceeb0" src="/static/icon15.png"/></view></picker><view class="line data-v-4dcceeb0"></view><picker class="data-v-4dcceeb0" mode="date" value="{{m}}" start="{{n}}" end="{{o}}" bindchange="{{p}}"><view class="list-item data-v-4dcceeb0"><view class="label data-v-4dcceeb0">生日</view><view class="item-value data-v-4dcceeb0">{{l}}</view><image class="arrow data-v-4dcceeb0" src="/static/icon15.png"/></view></picker></view><view wx:if="{{q}}" class="logout data-v-4dcceeb0" bindtap="{{r}}">退出登录</view></view>
|
||||
122
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.wxss
vendored
Normal file
122
project-wl-yonghuduan-uniapp-vue3/unpackage/dist/dev/mp-weixin/pages/my/index.wxss
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user