优化注释

This commit is contained in:
lemon橪
2021-05-17 18:19:26 +08:00
parent 4545097a4a
commit 49eb30f265
69 changed files with 972 additions and 2622 deletions

View File

@@ -99,7 +99,7 @@ export default {
this.params.pageNumber,
this.params.pageSize
).then((res) => {
console.log("加载");
if (res.data.result.records.length == 0) {
this.empty = true;
} else {
@@ -109,7 +109,7 @@ export default {
this.$set(this, "addressList", res.data.result.records);
console.log(this.addressList);
}
uni.hideLoading();
@@ -139,7 +139,7 @@ export default {
},
//新建。编辑地址
addAddress(id) {
console.log("点击");
if (id) {
uni.navigateTo({
url:

View File

@@ -73,7 +73,7 @@ export default {
async mounted() {
this.getWallet();
let result = await getUserWallet(); //预存款
console.log(result)
this.walletNum = result.data.result.memberWallet;
},
methods: {

View File

@@ -58,7 +58,7 @@ export default {
title: title, //这是修改后的导航栏文字
});
this.routers = option;
console.log(this.routers);
option.type == 0 ? this.achievement() : this.history();
},
mounted() {},

View File

@@ -157,7 +157,7 @@ export default {
},
watch: {
showFlag(val) {
console.log(val);
},
},
onShow() {

View File

@@ -36,7 +36,7 @@ export default {
methods: {
cashd() {
this.price = this.price + "";
console.log(typeof this.price);
if (this.$u.test.amount(parseInt(this.price))) {
cash({ price: this.price }).then((res) => {

View File

@@ -133,7 +133,7 @@ export default {
*/
clickGoodsSwiperAction(val) {
deleteGoodsCollection(val.skuId).then((res) => {
console.log(res);
if (res.statusCode == 200) {
this.storeList = [];
this.goodList = [];
@@ -159,7 +159,7 @@ export default {
*/
tabClick(index) {
this.tabCurrentIndex = index;
console.log(this.tabCurrentIndex);
},
/**

View File

@@ -87,7 +87,7 @@ export default {
},
/**
* 获得累计使用
* 获得累计积分使用
*/
initPointData() {
getMemberPointSum().then((res) => {
@@ -99,6 +99,9 @@ export default {
</script>
<style lang="scss" scoped>
.point-list{
margin-top: 50rpx;
}
.title {
height: 80rpx;
text-align: center;

View File

@@ -5,14 +5,10 @@
<view>点击修改头像</view>
</view>
<u-form :model="form" ref="uForm" class="form">
<!-- <u-form-item label="用户名" label-width="150"
><u-input v-model="form.username" disabled
/></u-form-item> -->
<u-form-item label="昵称" label-width="150">
<u-input v-model="form.nickName" placeholder="请输入昵称" />
</u-form-item>
<u-form-item label="性别" label-width="150">
<!-- {{typeof list[0].value}} {{form.sex + typeof form.sex}} -->
<u-radio-group v-model="form.sex" :active-color="lightColor">
<u-radio name="1"></u-radio>
<u-radio name="0"></u-radio>
@@ -20,8 +16,8 @@
</u-form-item>
<u-form-item label="生日" label-width="150" right-icon="arrow-right">
<u-input v-model="birthday" disabled placeholder="请选择出生日期" @click="showBirth = true" />
<u-picker v-model="showBirth" mode="time" :confirm-color="lightColor" @confirm="selectTime"></u-picker>
<u-input v-model="birthday" disabled placeholder="请选择出生日期" @click="showBirthday = true" />
<u-picker v-model="showBirthday" mode="time" :confirm-color="lightColor" @confirm="selectTime"></u-picker>
</u-form-item>
<u-form-item label="城市" label-width="150" placeholder="请选择城市" right-icon="arrow-right">
<u-input v-model="form.___path" disabled @click="clickRegion" />
@@ -35,7 +31,6 @@
<script>
import { saveUserInfo } from "@/api/members.js";
import { upload } from "@/api/common.js";
import storage from "@/utils/storage.js";
import uFormItem from "@/uview-ui/components/u-form-item/u-form-item.vue";
import gkcity from "@/components/m-city/m-city.vue";
@@ -43,46 +38,36 @@ export default {
components: { uFormItem, "m-city": gkcity },
data() {
return {
lightColor: this.$lightColor,
lightColor: this.$lightColor, //高亮颜色
form: {
face: "/static/missing-face.png",
regionId: [],
region: [],
sex: "1",
___path: "",
nickName: storage.getUserInfo().nickName || "",
birthday: storage.getUserInfo().birthday || "",
face: storage.getUserInfo().face || "/static/missing-face.png", //默认头像
regionId: [], //地址Id
region: storage.getUserInfo().region || [], //地址
sex: storage.getUserInfo().sex || 1, //性别
___path: storage.getUserInfo().region,
},
birthday: "",
birthday: storage.getUserInfo().birthday || "", //生日
photo: [
{ text: "立即拍照", color: this.$mainColor },
{ text: "从相册选择", color: this.$mainColor },
],
value: "",
region: [
//请求城市默认地址
{
id: "",
localName: "请选择",
children: [],
},
],
list: [
{
sex: "男",
value: "1",
disabled: false,
},
{
sex: "女",
value: "0",
disabled: false,
},
],
showBirth: false,
showRegion: false,
showAction: false,
showBirthday: false, //显示生日日期
};
},
created() {},
methods: {
/**
* 选择地址回调
*/
getpickerParentValue(e) {
this.form.region = [];
this.form.regionId = [];
@@ -100,19 +85,24 @@ export default {
this.form.___path = name;
}
});
console.log(this.form);
},
/**
* 点击选择地址
*/
clickRegion() {
this.$refs.cityPicker.show();
},
/**
* 提交保存
*/
submit() {
if (this.form.regionId.length != 0 && this.birthday) {
delete this.form.___path;
let params = JSON.parse(JSON.stringify(this.form));
saveUserInfo(params).then((res) => {
console.log(res);
if (res.statusCode == 200) {
storage.setUserInfo(res.data.result);
uni.navigateBack();
@@ -126,6 +116,10 @@ export default {
});
}
},
/**
* 修改头像
*/
changeFace(index) {
uni.chooseImage({
success: (chooseImageRes) => {
@@ -146,34 +140,31 @@ export default {
},
});
},
/**
* 选择地址
*/
selectRegion(region) {
//选择地址
this.$set(
this.form,
"address",
`${region.province.label} ${region.city.label} ${region.area.label}`
);
},
/**
* 选择时间
*/
selectTime(time) {
// 生日
console.log(time);
this.form.birthday = `${time.year}-${time.month}-${time.day}`;
this.birthday = `${time.year} - ${time.month} - ${time.day}`;
// this.form.timestamp = `${time.year} - ${time.month} - ${time.day}`;
},
},
onLoad() {
// this.form.userName = storage.getUserInfo().username
this.form.nickName = storage.getUserInfo().nickName;
this.form.sex = storage.getUserInfo().sex || 1;
this.form.birthday = storage.getUserInfo().birthday;
this.birthday = storage.getUserInfo().birthday || "";
this.form.___path = storage.getUserInfo().region;
this.form.face = storage.getUserInfo().face || "";
this.form.regionId = storage.getUserInfo().regionId || [];
this.form.region = storage.getUserInfo().region || [];
console.log(this.form);
},
/**
* 加载数据
*/
onLoad() {},
};
</script>

View File

@@ -137,7 +137,7 @@ export default {
that.getCacheSize(); // 重新计算缓存
},
function (e) {
console.log(e.message);
}
);
} else {

View File

@@ -58,7 +58,7 @@
<u-icon size="120" style="margin: 50rpx 0" color="#ff9f28" name="checkmark"></u-icon>
<view class="mark">
<view>获得积分</view>
<text>{{ continuity_point }}</text>
<text>{{ continuityPoint }}</text>
</view>
<text class="text">连续签到可获得额外奖励哦</text>
</view>
@@ -71,19 +71,16 @@ import { sign, signTime } from "@/api/point.js";
export default {
data() {
return {
continuity: 1,
continuity_point: 2,
header: {
top: 0,
height: 50,
},
continuity: 1, //本月连续签到天数
continuityPoint: 2, //获得的积分
signFlag: false,
animationData: {},
maskFlag: false,
transFlag: false,
weekArr: ["日", "一", "二", "三", "四", "五", "六"],
maskFlag: false, //
transFlag: false, //动画
weekArr: ["日", "一", "二", "三", "四", "五", "六"], //周数组
dateArr: [], //每个月的天数
monthArr: [
//实例化每个月
"1月",
"2月",
"3月",
@@ -118,6 +115,10 @@ export default {
this.getDate();
},
methods: {
/**
* 补0
*/
makeUp(val) {
if (val >= 10) {
return val;
@@ -125,18 +126,18 @@ export default {
return "0" + val;
}
},
// 返回
back() {
uni.navigateBack();
},
// 签到
/**
* 点击签到
*/
async signIn() {
await sign().then((response) => {
if (this.ifSign) return;
if (this.signFlag) return;
if (response.data.code != 200) {
uni.$showToast({
title: response.message,
uni.showToast({
title: response.data.message,
duration: 2000,
icon: "none",
});
@@ -164,41 +165,24 @@ export default {
);
});
},
// 关闭弹窗
/**
* 签到成功后关闭弹窗
*/
close() {
var that = this;
this.maskFlag = false;
this.transFlag = true;
setTimeout(function () {
setTimeout(() => {
that.transFlag = false;
}, 500);
},
change(id) {
var i = this.monthArr.indexOf(this.currentMonth),
curDay = null;
if (id === "1") {
i++;
if (i > 11) {
this.currentYear++;
i = 0;
}
this.currentMonth = this.monthArr[i];
this.currentMonthIndex = i + 1;
} else {
i--;
if (i < 0) {
this.currentYear--;
i = 11;
}
this.currentMonth = this.monthArr[i];
this.currentMonthIndex = i + 1;
}
curDay = this.getWeekByDay(this.currentYear + "-" + (i + 1) + "-1");
this.getMonthDays(i, curDay);
this.curentSignData();
},
/**
* 获取今天时间
*
*/
getDate() {
//获取日子
var date = new Date(),
index = date.getMonth(),
curDay = null;
@@ -206,16 +190,17 @@ export default {
this.currentMonth = this.monthArr[index];
this.currentMonthIndex = index + 1;
this.currentDay = date.getDate();
console.log(this.currentDay);
console.log(this.signArr[this.signArr.length - 1]);
if (this.currentDay == this.signArr[this.signArr.length - 1]) {
console.log("12");
this.ifSign = true;
}
curDay = this.getWeekByDay(this.currentYear + "-" + (index + 1) + "-1");
this.getMonthDays(index, curDay);
this.curentSignData();
},
/**
* 获取当前已经签到的时间
*/
curentSignData() {
var date = new Date(),
index = date.getMonth(),
@@ -224,15 +209,13 @@ export default {
for (var i = 0; i < this.signAll.length; i++) {
var item = this.signAll[i];
item.createTime = item.createTime.split(" ")[0];
var itemVal = item.createTime.split("-");
console.log(itemVal);
if (
Number(itemVal[0]) === Number(this.currentYear) &&
Number(itemVal[1]) === Number(this.currentMonthIndex)
) {
this.signArr.push(Number(itemVal[2]));
console.log(JSON.stringify(this.signArr));
}
if (
Number(itemVal[0]) === Number(date.getFullYear()) &&
@@ -243,6 +226,14 @@ export default {
}
}
},
/**
* 循环出当前月份的时间
* 例子:
* "","","","","","",1,
* 2 ,3 ,4 ,5 ,6 ,7 ,8,
* ...依次向下排
*/
getMonthDays(index, day) {
//day 当月1号是周几
this.dateArr = [];
@@ -293,8 +284,11 @@ export default {
}
this.dataObj.push(this.dateArr);
},
/**
* 获取当前月份有几周
*/
getWeekByDay(dayValue) {
//dayValue=“2014-01-01”
var day = new Date(Date.parse(dayValue.replace(/-/g, "/"))).getDay(); //将日期值格式化
return day;
},