Commit 75d047b8 authored by chenyishuai@singsingenglish.com's avatar chenyishuai@singsingenglish.com
parents d3a971a4 21bb7871
<template>
<div class="address2">
<div class="item" v-if="deliverDetail">
<div class="head next">
<i style="background:#60ADF0"></i>
本期收货地址
<!-- <span class="fl-r" @click="goEdit" v-if="deliverDetail.flag">
<span class="iconfont icon-icon_edit"></span> 修改
</span>
<span class="fl-r Invalid" v-if="!deliverDetail.flag">
<span class="iconfont icon-icon_edit"></span> 修改
</span>-->
</div>
<div class="content">
<div class="top">
<span>{{deliverDetail.receive_name}}</span>
<span>{{deliverDetail.receive_mobile}}</span>
</div>
<div
class="bottom"
>{{deliverDetail.province_name}} {{deliverDetail.city}}{{deliverDetail.area}}{{deliverDetail.address}}</div>
<div class="line"></div>
<div class="timeInfo">
<div class="text">
<p>地址修改时间:{{deliverDetail.created_at}}</p>
<p v-if="!deliverDetail.express_no">预计发货时间:{{deliverDetail.deliver_at}}</p>
<p v-if="deliverDetail.express_no">发货时间:{{deliverDetail.deliver_at}}</p>
<div v-if="deliverDetail.express_no">
物流信息:{{deliverDetail.express_name}} {{deliverDetail.express_no}}
<van-button round size="small" @click="search(1)" type="info">查看物流</van-button>
</div>
<div v-if="!deliverDetail.express_no">物流信息:- -</div>
</div>
</div>
</div>
</div>
<div class="item" v-if="noDeliverDetail">
<div class="head next">
<i style="background:#FFD454"></i>
下期收货地址
<span class="fl-r" @click="goEdit" v-if="noDeliverDetail.flag">
<span class="iconfont icon-icon_edit"></span> 修改
</span>
<span class="fl-r Invalid" v-if="!noDeliverDetail.flag">
<span class="iconfont icon-icon_edit"></span> 修改
</span>
</div>
<div class="content">
<div class="top">
<span>{{noDeliverDetail.receive_name}}</span>
<span>{{noDeliverDetail.receive_mobile}}</span>
</div>
<div
class="bottom"
>{{noDeliverDetail.province_name}} {{noDeliverDetail.city_name}}{{noDeliverDetail.area_name}}{{noDeliverDetail.address}}</div>
<div class="line"></div>
<div class="timeInfo">
<div class="text">
<p>地址修改时间:{{noDeliverDetail.created_at}}</p>
<p v-if="!noDeliverDetail.express_no">预计发货时间:{{noDeliverDetail.deliver_at}}</p>
<p v-if="noDeliverDetail.express_no">发货时间:{{noDeliverDetail.deliver_at}}</p>
<div v-if="noDeliverDetail.express_no">
物流信息:{{noDeliverDetail.express_name}} {{noDeliverDetail.express_no}}
<van-button round size="small" @click="search(2)" type="info">查看物流</van-button>
</div>
<div v-if="!noDeliverDetail.express_no">物流信息:- -</div>
</div>
</div>
</div>
</div>
<div class="tip">
<p>*预计发货前24小时不可修改地址,若有需要请联系您的专属班主任老师</p>
</div>
</div>
<!-- <div class="address2">
<div class="content">
<div class="top">
<span>{{addressInfo.receive_name}}</span>
......@@ -14,20 +87,22 @@
<p>(最新地址修改时间:{{addressInfo.updated_at}})</p>
<p>*若要修改收货地址,请联系您的专属班主任老师</p>
</div>
</div>
</div>-->
</template>
<script>
import line from "../../assets/activity/img_line@2x.png";
import {shopSuccess} from "../../util/imgUrl";
import { getUserAdressApi } from "../../service/api";
import { shopSuccess } from "../../util/imgUrl";
import { getNewestAddressListAPi } from "../../service/api";
export default {
name: "Address",
components: {},
data() {
return {
line: line,
addressInfo: {}
addressInfo: {},
noDeliverDetail: null, //下期收货地址
deliverDetail: null //本期收货地址
};
},
mounted() {
......@@ -35,10 +110,31 @@ export default {
},
methods: {
initPage() {
getUserAdressApi().then(res => {
getNewestAddressListAPi().then(res => {
// this.starNum = res.last_value
this.addressInfo = res;
if (res) {
if (res.deliver_detail && res.deliver_detail.length > 0) {
this.deliverDetail = res.deliver_detail[0];
console.log(this.deliverDetail);
}
if (res.no_deliver_detail && res.no_deliver_detail.length > 0) {
this.noDeliverDetail = res.no_deliver_detail[0];
}
}
});
},
goEdit() {
this.$router.push({
name: "addressModify",
params: { data: JSON.stringify(this.noDeliverDetail) }
});
},
search(index) {
let express_no =
index == 1
? this.deliverDetail.express_no
: this.noDeliverDetail.express_no;
window.location = `https://m.baidu.com/from=1013755s/s?word=${express_no}&sa=tb&ts=2790568&t_kt=0&ie=utf-8&rsv_t=cbe2F%252FT5T3MIzkRl%252Fg8ZUw%252FEPHZmn2wHIrB8cLvgNlEKyyDqUNPrTyDEEDjkAb8&rsv_pq=11793168499026332712&ss=110000000001&tj=1&rqlang=zh&rsv_sug4=4111&inputT=3178&oq=快递单号查询`;
}
}
};
......@@ -46,11 +142,44 @@ export default {
<style scoped lang="less">
@import "../../util/public";
@import "../../util/public";
.address2 {
background: #f5f5f9;
.van-button {
margin-left: 20 * @toVw;
}
.head {
i {
display: inline-block;
border-radius: 50%;
width: 11 * @toVw;
height: 11 * @toVw;
}
padding: 13 * @toVw;
background: white;
border-bottom: 1px solid #e2e2e2;
color: #666666;
font-size: 14 * @toVw;
}
.Invalid {
color: #cccccc;
}
.now {
i {
background: #60adf0;
}
}
.item {
margin-top: 10px;
}
.next {
i {
background: #ffd454;
}
}
.content {
background: white;
padding: 10 * @toVw 20 * @toVw;
padding: 13 * @toVw 0 13 * @toVw 26 * @toVw;
.top {
line-height: 28 * @toVw;
color: #333333;
......@@ -62,13 +191,34 @@ export default {
font-size: 14 * @toVw;
line-height: 20 * @toVw;
}
.timeInfo {
display: flex;
.text {
color: #999999;
font-size: 12 * @toVw;
margin-left: 0;
line-height: 26 * @toVw;
}
.right {
margin-top: 43 * @toVw;
}
.van-button--info {
background: white;
width: 74 * @toVw;
color: #60adf0;
border-color: #60adf0;
}
}
}
.linebox{
.linebox {
background: white;
}
.line {
width: 100%;
display: block;
border-bottom: 1px solid #e2e2e2;
margin: 12 * @toVw 0;
-webkit-transform: scale(1, 0.5);
}
.tip {
padding: 10 * @toVw 20 * @toVw;
......
<template>
<div class="addressEdit">
<div>
<mt-field label="收货人" v-model="receiveName" placeholder="请填写收货人"></mt-field>
<mt-field
label="手机号"
type="tel"
v-model="receiveMobile"
placeholder="请填写手机号"
:attr="{maxlength: 13}"
></mt-field>
<mt-field
label="所在地区"
v-model="addressArea"
placeholder="请填写所在地区"
:readonly="true"
:disableClear="true"
>
<mt-cell is-link style="position:absolute;width: 40px;height:100%;right:0;top:-24px;"></mt-cell>
<div class="stbox" style="position:absolute;right: 0;top: -24px;left: 0;bottom: 0;">
<mt-cell
id="mtcell"
:value="addressArea"
@click.native="showPicker"
style="opacity:0;position:absolute;width:300px;height: 100%;right:10%;top:0;"
></mt-cell>
</div>
</mt-field>
<mt-field label="详细地址" placeholder="请填写详细地址" v-model="address"></mt-field>
<div @click="onSave();buttonClick('保存地址')" class="btn">
<van-button round size="large" type="info">保存</van-button>
</div>
</div>
<my-address
:showAddressPicker="showAddressPicker"
@save-address="saveAddress"
@hide-picker="hidePicker"
:init="addressArea"
></my-address>
</div>
</template>
<script>
import MyAddress from "@/components/address-picker/Address.vue";
import {
saveActivityAddressApi,
getActivityAddressApi,
modifyAddressApi
} from "../../service/api";
import addressList from "../address-picker/addr";
import { Cell, Toast } from "vant";
export default {
name: "",
components: {
MyAddress,
[Cell.name]: Cell
},
data() {
return {
addressData: null,
receiveName: "",
receiveMobile: "",
addressDetail: "",
showAddressPicker: false,
addressArea: "",
addressAreaCode: "",
address: "",
deliverId: ""
};
},
mounted() {
if (this.$route.params && this.$route.params.data) {
let addressData = JSON.parse(this.$route.params.data);
this.addressData = addressData;
this.receiveName = addressData.receive_name;
this.receiveMobile = addressData.receive_mobile;
this.address = addressData.address;
this.deliverId = addressData.id;
this.addressArea =
addressData.province_name +
"-" +
addressData.city_name +
"-" +
addressData.area_name;
}
this.getAddressCode();
},
methods: {
closeAdd() {
this.$emit("closeAdd", false);
},
buttonClick(buttonName) {
this.$sa.track("buttonClick", {
tabTitle: "商品",
moduleTitle: "地址填写",
buttonType: "功能",
buttonName: buttonName
});
},
getAddressCode() {
let provinceName = this.addressData.province_name;
let cityName = this.addressData.city_name;
let areaName = this.addressData.area_name;
let provinceCode, cityCode, areaCode;
for (let i = 0, len = addressList.length; i < len; i++) {
let item = addressList[i];
if (cityName == item.label) {
provinceCode = item.value;
let secondArr = item.children;
for (let j = 0, long = secondArr.length; j < long; j++) {
let secondItem = secondArr[j];
if (cityName == secondItem.label) {
cityCode = secondItem.value;
let thirdArr = secondItem.children;
for (let k = 0, l = thirdArr.length; k < l; k++) {
if ((areaName = thirdArr[k].label)) {
areaCode = thirdArr[k].value;
break;
}
}
}
}
}
}
this.addressAreaCode = provinceCode + "-" + cityCode + "-" + areaCode;
},
onSave: function() {
let values = this.addressAreaCode.split("-");
let labels = this.addressArea.split("-");
if (!this.receiveName) {
Toast("收货人不能为空");
return false;
} else if (!this.receiveMobile) {
Toast("手机号不能为空");
return false;
} else if (!/^1\d{10,12}$/.test(this.receiveMobile)) {
Toast("手机号格式不正确");
return false;
} else if (!this.addressArea) {
Toast("所在地区不能为空");
return false;
} else if (!this.address) {
Toast("详细地址不能为空");
return false;
}
let param = {};
param.deliver_id = this.deliverId;
param.receive_name = this.receiveName;
param.receive_mobile = this.receiveMobile;
param.address = this.address;
param.province_id = values[0];
param.province_name = labels[0];
param.city_id = values[1];
param.city = labels[1];
param.area_id = values[2];
param.area = labels[2];
console.log(param);
modifyAddressApi(param, this.deliverId)
.then(res => {
this.closeAdd();
Toast("修改成功");
this.$router.replace({
name: "Address"
});
})
.catch(error => {
console.log(error);
});
},
onValuesChange: function(picker, values) {
if (values[0] > values[1]) {
picker.setSlotValue(1, values[0]);
}
},
hidePicker() {
// 接受子组件关闭popup事件
this.showAddressPicker = false;
},
showPicker() {
this.showAddressPicker = !this.showAddressPicker;
},
saveAddress(labels, values) {
console.log(labels);
// 从子组件接受返回所选值 val
this.addressArea = labels;
this.addressAreaCode = values;
this.showAddressPicker = !this.showAddressPicker;
}
}
};
</script>
<style lang="less">
@import "../../util/public";
.addressEdit {
background: #f5f5f9;
// .mint-cell-wrapper{border-bottom: 1px solid #E2E2E2;width: 94%;}
.stbox {
position: relative;
}
input::-webkit-input-placeholder {
color: #cccccc;
}
.van-popup {
background: white;
}
.gray {
background: #cccccc;
border: none;
}
.mint-cell {
color: #333333;
}
.btn {
margin-top: 50 * @toVw;
padding: 0 34 * @toVw;
}
#mtcell {
// background: red;
span {
color: #333333;
}
.mint-cell-title {
width: 105px;
flex: none;
}
.mint-cell-value {
flex: 1;
text-align: left;
// background: red;
span {
text-indent: 0;
margin-left: 4px;
}
}
}
.mint-field-core {
// background: red;
text-indent: 2px;
}
.holder {
color: rgb(204, 204, 204);
position: absolute;
top: 10 * @toVw;
left: 108 * @toVw;
}
// .mint-cell-value{color: #333333;}
.head {
i {
display: inline-block;
border-radius: 50%;
width: 11 * @toVw;
height: 11 * @toVw;
}
padding: 13 * @toVw;
background: white;
border-bottom: 1px solid #e2e2e2;
color: #666666;
font-size: 14 * @toVw;
}
.now {
i {
background: #60adf0;
}
}
.item {
margin-top: 10px;
}
.next {
i {
background: #ffd454;
}
}
.content {
background: white;
padding: 13 * @toVw 0 13 * @toVw 33 * @toVw;
.top {
line-height: 28 * @toVw;
color: #333333;
font-weight: bold;
font-size: 17 * @toVw;
}
.bottom {
color: #666666;
font-size: 14 * @toVw;
line-height: 20 * @toVw;
}
.timeInfo {
display: flex;
.text {
color: #999999;
font-size: 12 * @toVw;
margin-left: 0;
line-height: 26 * @toVw;
}
.right {
margin-top: 43 * @toVw;
}
.van-button--info {
background: white;
width: 74 * @toVw;
color: #60adf0;
border-color: #60adf0;
}
}
}
.linebox {
background: white;
}
.line {
width: 100%;
display: block;
border-bottom: 1px solid #e2e2e2;
margin: 12 * @toVw 0;
}
.tip {
padding: 10 * @toVw 20 * @toVw;
color: #999999;
font-size: 12 * @toVw;
line-height: 23 * @toVw;
}
}
@media screen and (orientation: landscape) {
}
</style>
......@@ -2,8 +2,8 @@ import Vue from 'vue'
import store from "@/store"
import common from '../util/common'
import Router from 'vue-router'
import sa from'sa-sdk-javascript';
import {getUserDetailApi} from "../service/api";
import sa from 'sa-sdk-javascript';
import { getUserDetailApi } from "../service/api";
Vue.use(Router);
......@@ -28,396 +28,405 @@ let browser = {
language: (navigator.browserLanguage || navigator.language).toLowerCase()
};
let ua = window.navigator.userAgent.toLowerCase();
const router =new Router({
const router = new Router({
routes: [
{
path: '/',
name: 'index',
component: e=>require(['@/components/index'],e),//
meta:{
deep:0,
title:'唱唱启蒙'
component: e => require(['@/components/index'], e),//
meta: {
deep: 0,
title: '唱唱启蒙'
}
},
{
path: '/orderTrans',
name: 'orderTrans',
component: e=>require(['@/components/orderTrans/index'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/orderTrans/index'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/addressEdit',
name: 'addressEdit',
component: e=>require(['@/components/mine/addressEdit'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/mine/addressEdit'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/addressModify',
name: 'addressModify',
component: e => require(['@/components/mine/addressModify'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/subAccept',
name: 'subAccept',
component: e=>require(['@/components/subAccount/accept'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/subAccount/accept'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/subAccount',
name: 'subAccount',
component: e=>require(['@/components/subAccount/index'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/subAccount/index'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/address',
name: 'Address',
component: e=>require(['@/components/mine/address'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/mine/address'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/activityAddr',
name: 'activityAddr',
component: e=>require(['@/components/mine/activityAddr'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/mine/activityAddr'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/liuyi',
name: 'liuyi',
component: e=>require(['@/components/activity/liuyi'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/activity/liuyi'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/starRank',
name: 'starRank',
component: e=>require(['@/components/star/starRank'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/star/starRank'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/starDetail',
name: 'starDetail',
component: e=>require(['@/components/star/detail'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/star/detail'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/starResult',
name: 'starResult',
component: e=>require(['@/components/star/result'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/star/result'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/zhibo',
name: 'zhibo',
component: e=>require(['@/components/indexPage/zb'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/indexPage/zb'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/med',
name: 'med',
component: e=>require(['@/components/indexPage/med'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/indexPage/med'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/preview',
name: 'preview',
component: e=>require(['@/components/indexPage/preview'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/indexPage/preview'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/bbda',
name: 'bbda',
component: e=>require(['@/components/indexPage/bbda'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/indexPage/bbda'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
{
path: '/exChange',
name: 'exChange',
component: e=>require(['@/components/exChange'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/exChange'], e),//
meta: {
deep: 0,
noNew: true,
}
}, {
path: '/newLesson',
name: 'newLesson',
component: e=>require(['@/components/newLesson'],e),//
meta:{
deep:0
component: e => require(['@/components/newLesson'], e),//
meta: {
deep: 0
}
}, {
path: '/star',
name: 'star',
component: e=>require(['@/components/star'],e),//
meta:{
deep:0,
noNew:true,
component: e => require(['@/components/star'], e),//
meta: {
deep: 0,
noNew: true,
}
},
{
path: '/shareGoods',
name: 'shareGoods',
component: e=>require(['@/components/newLesson/shareGoods'],e),//
meta:{
deep:0,
noNew:true
component: e => require(['@/components/newLesson/shareGoods'], e),//
meta: {
deep: 0,
noNew: true
}
},{
}, {
path: '/myGoodsList',
name: 'myGoodsList',
component: e=>require(['@/components/myGoodsList'],e),
meta:{
deep:1
component: e => require(['@/components/myGoodsList'], e),
meta: {
deep: 1
}
},{
}, {
path: '/mine',
name: 'mine',
component: e=>require(['@/components/mine/index'],e),
meta:{
deep:1
component: e => require(['@/components/mine/index'], e),
meta: {
deep: 1
}
},{
}, {
path: '/order',
name: 'order',
component: e=>require(['@/components/order'],e),
meta:{
deep:2
component: e => require(['@/components/order'], e),
meta: {
deep: 2
}
},{
}, {
path: '/share',
name: 'share',
component: e=>require(['@/components/share'],e),
meta:{
deep:2
component: e => require(['@/components/share'], e),
meta: {
deep: 2
}
},
{
path: '/author',
name: 'author',
component: e=>require(['@/components/author'],e),
meta:{
deep:100,
noNew:true
component: e => require(['@/components/author'], e),
meta: {
deep: 100,
noNew: true
}
},{
}, {
path: '/buyDetail',
name: 'buyDetail',
component: e=>require(['@/components/buy/index'],e),
meta:{
skip_login:false,
noNew:true,
deep:10
component: e => require(['@/components/buy/index'], e),
meta: {
skip_login: false,
noNew: true,
deep: 10
}
}, {
path: '/buy',
name: 'buy',
component: e=>require(['@/components/buy/buy'],e),
meta:{
noNew:true,
deep:11
component: e => require(['@/components/buy/buy'], e),
meta: {
noNew: true,
deep: 11
}
}, {
path: '/success',
name: 'success',
component: e=>require(['@/components/buy/success'],e),
meta:{
noNew:true,
deep:12
component: e => require(['@/components/buy/success'], e),
meta: {
noNew: true,
deep: 12
}
},{
}, {
path: '/buySuccess',
name: 'buySuccess',
component: e=>require(['@/components/buy/buySuccess'],e),
meta:{
noNew:true,
deep:12
component: e => require(['@/components/buy/buySuccess'], e),
meta: {
noNew: true,
deep: 12
}
}, {
path: '/map',
name: 'map',
component: e=>require(['@/components/map/index'],e),
meta:{
deep:3
component: e => require(['@/components/map/index'], e),
meta: {
deep: 3
}
},
{
path: '/saleSuccess',
name: 'saleSuccess',
component: e=>require(['@/components/buy/saleSuccess'],e),
meta:{
deep:4
component: e => require(['@/components/buy/saleSuccess'], e),
meta: {
deep: 4
}
}, {
path: '/bindMobile',
name: 'bindMobile',
component: e=>require(['@/components/bindMobile'],e),
meta:{
deep:0
component: e => require(['@/components/bindMobile'], e),
meta: {
deep: 0
}
},
{
path: '/activity',
name: 'activity',
component: e=>require(['@/components/buy/activity'],e),
meta:{
skip_login:true,
noNew:true,
component: e => require(['@/components/buy/activity'], e),
meta: {
skip_login: true,
noNew: true,
}
},
{
path: '/activityInvite',
name: 'activityInvite',
component: e=>require(['@/components/buy/activityInvite'],e),
meta:{
skip_login:true,
noNew:true,
component: e => require(['@/components/buy/activityInvite'], e),
meta: {
skip_login: true,
noNew: true,
}
},
{
path: '/inviteList',
name: 'inviteList',
component: e=>require(['@/components/buy/inviteList'],e),
meta:{
skip_login:true,
noNew:true,
component: e => require(['@/components/buy/inviteList'], e),
meta: {
skip_login: true,
noNew: true,
}
},
{
path: '/collection',
name: 'collection',
component: e=>require(['@/components/collection'],e),
meta:{
skip_login:true
component: e => require(['@/components/collection'], e),
meta: {
skip_login: true
}
},
{
path: '/noWechat',
name: 'noWechat',
component: e=>require(['@/components/noWechat'],e),
meta:{
skip_login:false
component: e => require(['@/components/noWechat'], e),
meta: {
skip_login: false
}
},
{
path: '/mpShop',
name: 'mpShop',
component: e=>require(['@/components/buy/mpShop'],e),
meta:{
skip_login:false,
noNew:true,
component: e => require(['@/components/buy/mpShop'], e),
meta: {
skip_login: false,
noNew: true,
}
},
{
path: '/shareConfig',
name: 'shareConfig',
component: e=>require(['@/components/shareConfig'],e),
meta:{
noNew:true,
component: e => require(['@/components/shareConfig'], e),
meta: {
noNew: true,
}
},
{
path: '/inspectorActivit',
name: 'inspectorActivit',
component: e=>require(['@/components/inspector/inspectorActivit'],e),
meta:{
noNew:true,
component: e => require(['@/components/inspector/inspectorActivit'], e),
meta: {
noNew: true,
}
},
{
path: '/inspectorList',
name: 'inspectorList',
component: e=>require(['@/components/inspector/inspectorList'],e),
meta:{
noNew:true,
component: e => require(['@/components/inspector/inspectorList'], e),
meta: {
noNew: true,
}
},
{
path: '/secMap',
name: 'secMap',
component: e=>require(['@/components/map/secMap'],e),
meta:{
noNew:true,
component: e => require(['@/components/map/secMap'], e),
meta: {
noNew: true,
}
},
{
path: '/hasaccount',
name: 'hasaccount',
component: e=>require(['@/components/map/hasaccount'],e),
meta:{
noNew:true,
component: e => require(['@/components/map/hasaccount'], e),
meta: {
noNew: true,
}
},
{
path:'*',
component: e=>require(['@/components/error'],e),
path: '*',
component: e => require(['@/components/error'], e),
},
]
});
router.beforeEach((to,from,next)=> {
router.beforeEach((to, from, next) => {
// 神策路由埋点
Vue.nextTick(() => {
sa.quick("autoTrackSinglePage");
});
// 判断是否是微信环境 排除本地
if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_'){
if(to.name == 'noWechat'){
if (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_') {
if (to.name == 'noWechat') {
// 在微信里打开非微信提示页
if(to.query.url){
if (to.query.url) {
next(decodeURIComponent(to.query.url))
}else{
next({name:'index'});
} else {
next({ name: 'index' });
}
}
}else{
if(to.name !== 'noWechat' && process.env.NODE_ENV === 'production') {
next({name:'noWechat',query:{url:encodeURIComponent(to.fullPath)}});
} else {
if (to.name !== 'noWechat' && process.env.NODE_ENV === 'production') {
next({ name: 'noWechat', query: { url: encodeURIComponent(to.fullPath) } });
}
}
// 移动端判断
store.dispatch('isMobile',browser.versions.mobile);
store.dispatch('isMobile', browser.versions.mobile);
// 默认title
if(process.env.NODE_ENV === 'production'){
if (process.env.NODE_ENV === 'production') {
document.title = '唱唱启蒙英语';
}else{
} else {
document.title = '唱唱测试';
}
if(to.name === 'secMap' ){
if (to.name === 'secMap') {
// (function(d, w, c) {
// var s = d.createElement('script');
// w[c] = w[c] || function() {
......@@ -430,70 +439,70 @@ router.beforeEach((to,from,next)=> {
// _AIHECONG('ini',{ entId : 11875,button:true });
// debugger
}
let goOn=function(){
if(localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== ''){
let goOn = function () {
if (localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== '') {
console.log(localStorage.getItem('retUrl'))
let retUrl = localStorage.getItem('retUrl').toString();
localStorage.removeItem('retUrl');
next(retUrl);
}else{
} else {
next()
}
};
if(to.name === 'author' || to.name === 'bindMobile' || to.name === 'noWechat' || to.name === 'inspectorActivit'){
if (to.name === 'author' || to.name === 'bindMobile' || to.name === 'noWechat' || to.name === 'inspectorActivit') {
// 无需登录的页面
next()
}else if(window.location.href.indexOf('token')>-1 && to.name === 'index'){
} else if (window.location.href.indexOf('token') > -1 && to.name === 'index') {
let token = common.getUrlParam().token || to.query.token;
console.log(common.getUrlParam())
console.log(to.name)
// debugger
store.dispatch('setToken',token);
getUserDetailApi().then(res=>{
store.dispatch('setToken', token);
getUserDetailApi().then(res => {
// debugger
localStorage.setItem('userDesc',JSON.stringify(res));
localStorage.setItem('userDesc', JSON.stringify(res));
sa.login(res.user_id);
goOn()
}).catch((res)=>{
}).catch((res) => {
console.log(res)
// debugger
if(localStorage.getItem('userDesc')){
if (localStorage.getItem('userDesc')) {
goOn()
}
});
}else if(localStorage.getItem('cc_token')) {
} else if (localStorage.getItem('cc_token')) {
// 已登陆
store.dispatch('setToken', localStorage.getItem('cc_token'));
if(localStorage.getItem('userDesc')){
if (localStorage.getItem('userDesc')) {
sa.login(JSON.parse(localStorage.getItem('userDesc')).user_id);
goOn()
}else{
getUserDetailApi().then(res=>{
localStorage.setItem('userDesc',JSON.stringify(res));
} else {
getUserDetailApi().then(res => {
localStorage.setItem('userDesc', JSON.stringify(res));
sa.login(res.user_id);
goOn()
}).catch(()=>{
if(localStorage.getItem('userDesc')){
}).catch(() => {
if (localStorage.getItem('userDesc')) {
goOn()
}
});
}
// debugger
}else{
} else {
// 未登陆,保存下路径
let query = {retUrl:to.fullPath};
localStorage.setItem('retUrl',to.fullPath);
if(window.location.href.indexOf('gdt_vid')>-1){
localStorage.setItem('gdt_vid',common.getUrlParam().gdt_vid);
let query = { retUrl: to.fullPath };
localStorage.setItem('retUrl', to.fullPath);
if (window.location.href.indexOf('gdt_vid') > -1) {
localStorage.setItem('gdt_vid', common.getUrlParam().gdt_vid);
console.log(query.gdt_vid)
}
console.log(process.env.AUTHOR_UEL)
console.log(window.location.href)
if(to.meta.noNew){
if (to.meta.noNew) {
query.is_new_user_url = 1;
window.location.href = `${process.env.AUTHOR_UEL}`
}else{
} else {
// debugger
window.location.href = `${process.env.AUTHOR_UEL}&is_new_user_url=1`
}
......
import Vue from 'vue';
import {post,fetch,patch,put,del,upload,ret2} from './index'
const _baseUrl=process.env.API_URL;
Vue.prototype.$post=post;
Vue.prototype.$fetch=fetch;
Vue.prototype.$patch=patch;
Vue.prototype.$put=put;
Vue.prototype.$del=del;
import { post, fetch, patch, put, del, upload, ret2 } from './index'
const _baseUrl = process.env.API_URL;
Vue.prototype.$post = post;
Vue.prototype.$fetch = fetch;
Vue.prototype.$patch = patch;
Vue.prototype.$put = put;
Vue.prototype.$del = del;
Vue.prototype.$upload = upload;
Vue.prototype.$ret2 = ret2;
......@@ -14,20 +14,20 @@ const getBannerListUrl = `${_baseUrl}api/client/banner/list`;
export const getBannerListApi = function () {
return Vue.prototype.$fetch(getBannerListUrl)
};
const bannerListUrl =`/api/client/banner/list/`;
export const bannerListApi = function (type,json) {
return Vue.prototype.$fetch(bannerListUrl+type,json)
const bannerListUrl = `/api/client/banner/list/`;
export const bannerListApi = function (type, json) {
return Vue.prototype.$fetch(bannerListUrl + type, json)
};
// 获取微信授权
const getwechatParamUrl = `${_baseUrl}api/client/jssdk`;
export const getwechatParam = function (json) {
return Vue.prototype.$fetch(getwechatParamUrl,json)
return Vue.prototype.$fetch(getwechatParamUrl, json)
};
// 文件上传
const uploadFileUrl = `${_baseUrl}api/public/upload/zone`;
export const uploadFileApi = function (json) {
return Vue.prototype.$upload(uploadFileUrl,json)
return Vue.prototype.$upload(uploadFileUrl, json)
};
// 获取商品详情
......@@ -35,6 +35,19 @@ const getGoodsDetailUrl = `${_baseUrl}api/client/goods/info/`;
export const getGoodsDetailApi = function (id) {
return Vue.prototype.$fetch(`${getGoodsDetailUrl}${id}`)
};
//待发货收货地址修改
// 编辑用户活动地址
export const modifyAddressApi = function (json, deliver_id) {
return Vue.prototype.$put(`${_baseUrl}api/client/deliver/edit/${deliver_id}`, json)
};
//用户最新物流信息
const getNewestAddressListUrl = `${_baseUrl}api/client/deliver/newest/list`;
export const getNewestAddressListAPi = function () {
return Vue.prototype.$fetch(getNewestAddressListUrl)
};
// 获取用户地址
const getUserAdressUrl = `${_baseUrl}api/client/address/info`;
export const getUserAdressApi = function () {
......@@ -43,27 +56,28 @@ export const getUserAdressApi = function () {
// 微信支付
const payUrl = `${_baseUrl}api/client/bill/wechat/pay`
export const payApi = function (json) {
return Vue.prototype.$fetch(payUrl,json)
return Vue.prototype.$fetch(payUrl, json)
};
// 保存用户地址
const saveAddressUrl = `${_baseUrl}api/client/address/save`
export const saveAddressApi = function (json) {
return Vue.prototype.$post(saveAddressUrl,json)
return Vue.prototype.$post(saveAddressUrl, json)
};
// 保存用户活动地址
export const saveActivityAddressApi = function (json) {
return Vue.prototype.$post(`${_baseUrl}api/client/user/starActivity/address`,json)
return Vue.prototype.$post(`${_baseUrl}api/client/user/starActivity/address`, json)
};
// 编辑用户活动地址
export const editActivityAddressApi = function (json,address_id) {
return Vue.prototype.$put(`${_baseUrl}api/client/user/starActivity/address/edit/${address_id}`,json)
export const editActivityAddressApi = function (json, address_id) {
return Vue.prototype.$put(`${_baseUrl}api/client/user/starActivity/address/edit/${address_id}`, json)
};
// 获取用户活动地址
export const getActivityAddressApi = function (json) {
return Vue.prototype.$fetch(`${_baseUrl}api/client/user/starActivity/address/list`,json)
return Vue.prototype.$fetch(`${_baseUrl}api/client/user/starActivity/address/list`, json)
};
//
// 用户已购课程
const getUserLessonUrl = `${_baseUrl}api/client/user/course/list`
export const getUserLessonApi = function () {
......@@ -71,8 +85,8 @@ export const getUserLessonApi = function () {
};
// 课包列表
const getLessonListUrl = `${_baseUrl}api/client/course/category/list/`
export const getLessonListApi = function (id,json) {
return Vue.prototype.$fetch(`${getLessonListUrl}${id}`,json)
export const getLessonListApi = function (id, json) {
return Vue.prototype.$fetch(`${getLessonListUrl}${id}`, json)
};
// 获取主题列表
const getCourseListUrl = `${_baseUrl}api/client/course/relation/list/`
......@@ -81,7 +95,7 @@ export const getCourseListApi = function (id) {
};
//获取课包详情
const getLessonDetailUrl = `${_baseUrl}api/client/element/info/`
export const getLessonDetailApi = function (periods_id,category_id,element_id) {
export const getLessonDetailApi = function (periods_id, category_id, element_id) {
return Vue.prototype.$fetch(`${getLessonDetailUrl}${periods_id}/${category_id}/${element_id}`)
};
// 获取客户详情
......@@ -91,8 +105,8 @@ export const getUserDetailApi = function () {
};
// 提交看课数据
const subUserLessonUrl = `${_baseUrl}api/client/user/watch/log/`;
export const subUserLessonApi = function (element_id,category_id,periods_id,json) {
return Vue.prototype.$post(`${subUserLessonUrl}${element_id}/${category_id}/${periods_id}`,json)
export const subUserLessonApi = function (element_id, category_id, periods_id, json) {
return Vue.prototype.$post(`${subUserLessonUrl}${element_id}/${category_id}/${periods_id}`, json)
};
// 获取团购详情
const getGroupDetailUrl = `${_baseUrl}api/client/group/info/`;
......@@ -107,7 +121,7 @@ export const getOrderDetailApi = function (id) {
// 获取用户订单列表
const getOrderListUrl = `${_baseUrl}api/client/order/list`;
export const getOrderListApi = function (json) {
return Vue.prototype.$fetch(getOrderListUrl,json)
return Vue.prototype.$fetch(getOrderListUrl, json)
};
// 用户看课统计
const getUserWatchUrl = `${_baseUrl}api/client/user/watch/report`;
......@@ -127,82 +141,82 @@ export const getNewApi = function () {
// 查看是否可购买该商品
const getStatusWechatUrl = `${_baseUrl}api/client/bill/wechat/status`;
export const getStatusWechatApi = function (json) {
return Vue.prototype.$fetch(getStatusWechatUrl,json)
return Vue.prototype.$fetch(getStatusWechatUrl, json)
};
// 用户可用优惠券
const getCouponListUrl = `${_baseUrl}api/client/user/coupon/list`;
export const getCouponListApi = function (id) {
return Vue.prototype.$fetch(getCouponListUrl,{goods_id:id})
return Vue.prototype.$fetch(getCouponListUrl, { goods_id: id })
};
// 获取商品列表
const getGoodsListUrl = `${_baseUrl}api/client/goods/list`;
export const getGoodsListApi = function (json) {
return Vue.prototype.$fetch(getGoodsListUrl,json)
return Vue.prototype.$fetch(getGoodsListUrl, json)
};
//获取邀请战绩收益
const getInviteResultUrl = `${_baseUrl}api/client/user/invite/earnings`;
export const getInviteResultApi = function (json,id) {
return Vue.prototype.$fetch(`${getInviteResultUrl}/${id}`,json)
export const getInviteResultApi = function (json, id) {
return Vue.prototype.$fetch(`${getInviteResultUrl}/${id}`, json)
};
//获取邀请战绩用户列表
const getInviteListUrl = `${_baseUrl}api/client/user/invite/list`;
export const getInviteListApi = function (json,id) {
return Vue.prototype.$fetch(`${getInviteListUrl}/${id}`,json)
export const getInviteListApi = function (json, id) {
return Vue.prototype.$fetch(`${getInviteListUrl}/${id}`, json)
};
// 发送验证码
const sendMobileCodeUrl = `${_baseUrl}api/client/mobile/code`;
export const sendMobileCodeApi = function (json) {
return Vue.prototype.$post(sendMobileCodeUrl,json)
return Vue.prototype.$post(sendMobileCodeUrl, json)
};
// 绑定手机号
const bindMobileUrl = `${_baseUrl}api/client/user/mobile/bind`;
export const bindMobileApi = function (json) {
return Vue.prototype.$put(bindMobileUrl,json)
return Vue.prototype.$put(bindMobileUrl, json)
};
// 用户通过订单号换课
const orderTransUrl = `${_baseUrl}api/client/user/mobile/bind/order_id`;
export const orderTransApi = function (json,order_id) {
return Vue.prototype.$put(orderTransUrl,json)
export const orderTransApi = function (json, order_id) {
return Vue.prototype.$put(orderTransUrl, json)
};
// 获取引导参数
const getGuideUrl =`${_baseUrl}api/client/user/bootPage`;
const getGuideUrl = `${_baseUrl}api/client/user/bootPage`;
export const getGuideApi = function (json) {
return Vue.prototype.$fetch(getGuideUrl,json)
return Vue.prototype.$fetch(getGuideUrl, json)
};
// 设置引导参数
const setGuideUrl =`${_baseUrl}api/client/user/bootPage`;
const setGuideUrl = `${_baseUrl}api/client/user/bootPage`;
export const setGuideApi = function (json) {
return Vue.prototype.$post(setGuideUrl,json)
return Vue.prototype.$post(setGuideUrl, json)
};
// 查找跳转
const getRedirectUrl =`${_baseUrl}api/client/redirect`;
const getRedirectUrl = `${_baseUrl}api/client/redirect`;
export const getRedirectApi = function (json) {
return Vue.prototype.$fetch(getRedirectUrl,json)
return Vue.prototype.$fetch(getRedirectUrl, json)
};
// 获取用户收藏
const getUserCollectUrl =`${_baseUrl}api/client/user/collect`;
const getUserCollectUrl = `${_baseUrl}api/client/user/collect`;
export const getUserCollectApi = function (json) {
return Vue.prototype.$fetch(getUserCollectUrl,json)
return Vue.prototype.$fetch(getUserCollectUrl, json)
};
// 用户添加收藏
const addUserCollectUrl =`${_baseUrl}api/client/user/collect`;
const addUserCollectUrl = `${_baseUrl}api/client/user/collect`;
export const addUserCollectApi = function (json) {
return Vue.prototype.$post(addUserCollectUrl,json)
return Vue.prototype.$post(addUserCollectUrl, json)
};
// 用户取消收藏
const delUserCollectUrl =`${_baseUrl}api/client/user/collect/`;
const delUserCollectUrl = `${_baseUrl}api/client/user/collect/`;
export const delUserCollectApi = function (id) {
return Vue.prototype.$put(delUserCollectUrl+id)
return Vue.prototype.$put(delUserCollectUrl + id)
};
// 获取他人看课统计
const getOtherUserWatchUrl = `/api/client/user/watch/report/`;
export const getOtherUserWatchApi = function (id) {
return Vue.prototype.$fetch(getOtherUserWatchUrl+id)
return Vue.prototype.$fetch(getOtherUserWatchUrl + id)
};
// 获取分享商品
......@@ -214,7 +228,7 @@ export const getShareGoodsApi = function () {
// 获取短网址
const getShortUrl = `/api/public/short/url`;
export const getShortApi = function (json) {
return Vue.prototype.$fetch(getShortUrl,json)
return Vue.prototype.$fetch(getShortUrl, json)
};
// 获取用户总积分
......@@ -226,44 +240,44 @@ export const getUserIntegralApi = function () {
// 获取用户积分列表
const getUserIntegralListUrl = '/api/client/user/integral';
export const getUserIntegralListApi = function (json) {
return Vue.prototype.$fetch(getUserIntegralListUrl,json)
return Vue.prototype.$fetch(getUserIntegralListUrl, json)
};
// 兑换码兑换
const ExChangeUrl = `/api/client/user/mobile/bind/exchange`;
export const ExChangeApi = function (json) {
return Vue.prototype.$put(ExChangeUrl,json)
return Vue.prototype.$put(ExChangeUrl, json)
};
// 获取可选择的期数
const getYujiListUrl = `/api/client/yunji/config`;
export const getYujiListUrlApi = function (json) {
return Vue.prototype.$fetch(getYujiListUrl,json)
return Vue.prototype.$fetch(getYujiListUrl, json)
};
// 提交选择的期数
const postYujiListUrl =`/api/client/user/add/class/`;
const postYujiListUrl = `/api/client/user/add/class/`;
export const postYujiListApi = function (id) {
return Vue.prototype.$post(postYujiListUrl+id)
return Vue.prototype.$post(postYujiListUrl + id)
};
// 判断用户是否需要选择期数
const getCourseStatusUrl =`/api/client/user/course/status`;
const getCourseStatusUrl = `/api/client/user/course/status`;
export const getCourseStatusApi = function () {
return Vue.prototype.$fetch(getCourseStatusUrl)
};
// 首页获取用户课程信息
const getCourseInfoUrl =`/api/client/user/course/info`;
const getCourseInfoUrl = `/api/client/user/course/info`;
export const getCourseInfoApi = function (periods_id) {
// periods_id=12
// debugger
return periods_id?Vue.prototype.$fetch(getCourseInfoUrl,{'periods_id':periods_id}): Vue.prototype.$fetch(getCourseInfoUrl)
return periods_id ? Vue.prototype.$fetch(getCourseInfoUrl, { 'periods_id': periods_id }) : Vue.prototype.$fetch(getCourseInfoUrl)
};
// 宝宝昵称设置
const putBabyInfoUrl =`/api/client/me/set`;
const putBabyInfoUrl = `/api/client/me/set`;
export const putBabyInfoApi = function (json) {
return Vue.prototype.$put(putBabyInfoUrl,json)
return Vue.prototype.$put(putBabyInfoUrl, json)
};
// 获取自动化商品数据
export const getAutomationApi = function (type,id) {
export const getAutomationApi = function (type, id) {
return Vue.prototype.$fetch(`/api/client/course/automation/list/${type}/${id}`)
};
// 自动化看课推荐转化商品及其优惠券
......@@ -318,4 +332,4 @@ export const searchAccountinfoApi = function (authorization) {
export const getStarInfoApi = function () {
return Vue.prototype.$fetch(`/api/client/user/starActivity`)
};
//
//
......@@ -64,11 +64,11 @@ export default {
return theRequest;
},
// 倒计时
leftTimer(enddate,Interval) {
leftTimer(enddate, Interval) {
if (enddate > new Date()) {
var leftTime = (enddate) - new Date(); //计算剩余的毫秒数
}else{
if(Interval){
} else {
if (Interval) {
clearInterval(Interval)
}
// console.log(enddate)
......@@ -87,9 +87,9 @@ export default {
// console.log(hours)
// console.log(minutes)
// console.log(seconds)
if(days > 0){
if (days > 0) {
return days + "天"
}else if(hours >= 0 || minutes >= 0 || seconds >= 0){
} else if (hours >= 0 || minutes >= 0 || seconds >= 0) {
return hours + ":" + minutes + ":" + seconds;
}
// if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) return days + "天" + hours + ":" + minutes + ":" + seconds;
......@@ -98,11 +98,11 @@ export default {
// window.clearInterval(_ordertimer);
// _ordertimer = null;
// }
},
checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) {
i = "0" + i;
},
checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) {
i = "0" + i;
}
return i;
}
return i;
}
}
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