Browse Source

修改不兼容多平台的语法

zyh
Gao xiaosong 4 years ago
parent
commit
29459e76ca
  1. 1180
      pages/activity/DargainDetails/index.vue
  2. 8
      pages/activity/GoodsGroup/index.vue
  3. 132
      pages/user/ChangePassword/index.vue
  4. 2
      pages/user/User/index.vue

1180
pages/activity/DargainDetails/index.vue

File diff suppressed because it is too large Load Diff

8
pages/activity/GoodsGroup/index.vue

@ -2,7 +2,7 @@
<view class="page_box">
<view class="content_box">
<scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore">
<view class="group-wrap" :style="`background: url('${$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat;`">
<view class="group-wrap" :style="{ background: background }">
<view class="group-head x-bc">
<text class="group-head__title">爆款拼团</text>
<text class="group-head__notice">省钱省心限时拼</text>
@ -63,7 +63,11 @@ export default {
this.getGrouponList()
},
onPullDownRefresh() {},
computed: {},
computed: {
background() {
return `url('${this.$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat`
},
},
methods: {
//
jump(path, parmas) {

132
pages/user/ChangePassword/index.vue

@ -13,12 +13,7 @@
</view>
<view class="item acea-row row-between-wrapper">
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button
class="code font-color-red"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
<button class="code font-color-red" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
</view>
</view>
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
@ -26,124 +21,115 @@
</template>
<style scoped lang="less">
.ChangePassword .phone input {
width: 2*100rpx;
width: 2 * 100rpx;
text-align: center;
}
</style>
<script>
// import { mapGetters } from "vuex";
import sendVerifyCode from "@/mixins/SendVerifyCode";
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
import { registerReset, registerVerify, getUserInfo } from "@/api/user";
import sendVerifyCode from '@/mixins/SendVerifyCode'
import attrs, { required, alpha_num, chs_phone } from '@/utils/validate'
import { validatorDefaultCatch } from '@/utils/dialog'
import { registerReset, registerVerify, getUserInfo } from '@/api/user'
export default {
name: "ChangePassword",
name: 'ChangePassword',
components: {},
props: {},
data: function() {
return {
password: "",
password2: "",
captcha: "",
phone: "", //
yphone: "" //
};
password: '',
password2: '',
captcha: '',
phone: '', //
yphone: '', //
}
},
mixins: [sendVerifyCode],
// computed: mapGetters(["userInfo"]),
mounted: function() {
this.getUserInfo();
this.getUserInfo()
},
methods: {
getUserInfo: function() {
let that = this;
let that = this
getUserInfo().then(res => {
that.yphone = res.data.phone;
let reg = /^(\d{3})\d*(\d{4})$/;
that.phone = that.yphone.replace(reg, "$1****$2");
});
that.yphone = res.data.phone
let reg = /^(\d{3})\d*(\d{4})$/
that.phone = that.yphone.replace(reg, '$1****$2')
})
},
async confirm() {
let that = this;
const { password, password2, captcha } = that;
let that = this
const { password, password2, captcha } = that
try {
await that
.$validator({
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
password: [required(required.message('密码')), attrs.range([6, 16], attrs.range.message('密码')), alpha_num(alpha_num.message('密码'))],
captcha: [required(required.message('验证码')), alpha_num(alpha_num.message('验证码'))],
})
.validate({ password, captcha });
.validate({ password, captcha })
} catch (e) {
return validatorDefaultCatch(e);
return validatorDefaultCatch(e)
}
if (password !== password2) return uni.showToast({
title: '两次密码不一致',
icon: "none",
duration: 2000
});
if (password !== password2)
return uni.showToast({
title: '两次密码不一致',
icon: 'none',
duration: 2000,
})
registerReset({
account: that.yphone,
captcha: that.captcha,
password: that.password
password: that.password,
})
.then(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
icon: 'none',
duration: 2000,
})
// that.$yrouter.push({ path: "/pages/user/Login/index" });
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000,
})
})
},
async code() {
let that = this;
const { yphone } = that;
let that = this
const { yphone } = that
try {
await that
.$validator({
yphone: [
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
yphone: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
})
.validate({ yphone });
.validate({ yphone })
} catch (e) {
return validatorDefaultCatch(e);
return validatorDefaultCatch(e)
}
registerVerify({ phone: yphone })
.then(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
that.sendCode();
icon: 'none',
duration: 2000,
})
that.sendCode()
})
.catch(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
}
}
};
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000,
})
})
},
},
}
</script>

2
pages/user/User/index.vue

@ -128,7 +128,7 @@
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
import { getUserInfo, getMenuUser, bindingPhone } from '@/api/user'
import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user'
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils'
import cookie from '@/utils/store/cookie'
import SwitchWindow from '@/components/SwitchWindow'

Loading…
Cancel
Save