Commit 75d047b8 authored by chenyishuai@singsingenglish.com's avatar chenyishuai@singsingenglish.com
parents d3a971a4 21bb7871
<template> <template>
<div class="address2"> <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="content">
<div class="top"> <div class="top">
<span>{{addressInfo.receive_name}}</span> <span>{{addressInfo.receive_name}}</span>
...@@ -14,20 +87,22 @@ ...@@ -14,20 +87,22 @@
<p>(最新地址修改时间:{{addressInfo.updated_at}})</p> <p>(最新地址修改时间:{{addressInfo.updated_at}})</p>
<p>*若要修改收货地址,请联系您的专属班主任老师</p> <p>*若要修改收货地址,请联系您的专属班主任老师</p>
</div> </div>
</div> </div>-->
</template> </template>
<script> <script>
import line from "../../assets/activity/img_line@2x.png"; import line from "../../assets/activity/img_line@2x.png";
import {shopSuccess} from "../../util/imgUrl"; import { shopSuccess } from "../../util/imgUrl";
import { getUserAdressApi } from "../../service/api"; import { getNewestAddressListAPi } from "../../service/api";
export default { export default {
name: "Address", name: "Address",
components: {}, components: {},
data() { data() {
return { return {
line: line, line: line,
addressInfo: {} addressInfo: {},
noDeliverDetail: null, //下期收货地址
deliverDetail: null //本期收货地址
}; };
}, },
mounted() { mounted() {
...@@ -35,10 +110,31 @@ export default { ...@@ -35,10 +110,31 @@ export default {
}, },
methods: { methods: {
initPage() { initPage() {
getUserAdressApi().then(res => { getNewestAddressListAPi().then(res => {
// this.starNum = res.last_value // 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 { ...@@ -46,11 +142,44 @@ export default {
<style scoped lang="less"> <style scoped lang="less">
@import "../../util/public"; @import "../../util/public";
@import "../../util/public";
.address2 { .address2 {
background: #f5f5f9; 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 { .content {
background: white; background: white;
padding: 10 * @toVw 20 * @toVw; padding: 13 * @toVw 0 13 * @toVw 26 * @toVw;
.top { .top {
line-height: 28 * @toVw; line-height: 28 * @toVw;
color: #333333; color: #333333;
...@@ -62,13 +191,34 @@ export default { ...@@ -62,13 +191,34 @@ export default {
font-size: 14 * @toVw; font-size: 14 * @toVw;
line-height: 20 * @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; background: white;
} }
.line { .line {
width: 100%; width: 100%;
display: block; display: block;
border-bottom: 1px solid #e2e2e2;
margin: 12 * @toVw 0;
-webkit-transform: scale(1, 0.5);
} }
.tip { .tip {
padding: 10 * @toVw 20 * @toVw; 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' ...@@ -2,8 +2,8 @@ import Vue from 'vue'
import store from "@/store" import store from "@/store"
import common from '../util/common' import common from '../util/common'
import Router from 'vue-router' import Router from 'vue-router'
import sa from'sa-sdk-javascript'; import sa from 'sa-sdk-javascript';
import {getUserDetailApi} from "../service/api"; import { getUserDetailApi } from "../service/api";
Vue.use(Router); Vue.use(Router);
...@@ -28,396 +28,405 @@ let browser = { ...@@ -28,396 +28,405 @@ let browser = {
language: (navigator.browserLanguage || navigator.language).toLowerCase() language: (navigator.browserLanguage || navigator.language).toLowerCase()
}; };
let ua = window.navigator.userAgent.toLowerCase(); let ua = window.navigator.userAgent.toLowerCase();
const router =new Router({ const router = new Router({
routes: [ routes: [
{ {
path: '/', path: '/',
name: 'index', name: 'index',
component: e=>require(['@/components/index'],e),// component: e => require(['@/components/index'], e),//
meta:{ meta: {
deep:0, deep: 0,
title:'唱唱启蒙' title: '唱唱启蒙'
} }
}, },
{ {
path: '/orderTrans', path: '/orderTrans',
name: 'orderTrans', name: 'orderTrans',
component: e=>require(['@/components/orderTrans/index'],e),// component: e => require(['@/components/orderTrans/index'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/addressEdit', path: '/addressEdit',
name: 'addressEdit', name: 'addressEdit',
component: e=>require(['@/components/mine/addressEdit'],e),// component: e => require(['@/components/mine/addressEdit'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
}
},
{
path: '/addressModify',
name: 'addressModify',
component: e => require(['@/components/mine/addressModify'], e),//
meta: {
deep: 0,
noNew: true,
} }
}, },
{ {
path: '/subAccept', path: '/subAccept',
name: 'subAccept', name: 'subAccept',
component: e=>require(['@/components/subAccount/accept'],e),// component: e => require(['@/components/subAccount/accept'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/subAccount', path: '/subAccount',
name: 'subAccount', name: 'subAccount',
component: e=>require(['@/components/subAccount/index'],e),// component: e => require(['@/components/subAccount/index'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/address', path: '/address',
name: 'Address', name: 'Address',
component: e=>require(['@/components/mine/address'],e),// component: e => require(['@/components/mine/address'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/activityAddr', path: '/activityAddr',
name: 'activityAddr', name: 'activityAddr',
component: e=>require(['@/components/mine/activityAddr'],e),// component: e => require(['@/components/mine/activityAddr'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/liuyi', path: '/liuyi',
name: 'liuyi', name: 'liuyi',
component: e=>require(['@/components/activity/liuyi'],e),// component: e => require(['@/components/activity/liuyi'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/starRank', path: '/starRank',
name: 'starRank', name: 'starRank',
component: e=>require(['@/components/star/starRank'],e),// component: e => require(['@/components/star/starRank'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/starDetail', path: '/starDetail',
name: 'starDetail', name: 'starDetail',
component: e=>require(['@/components/star/detail'],e),// component: e => require(['@/components/star/detail'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/starResult', path: '/starResult',
name: 'starResult', name: 'starResult',
component: e=>require(['@/components/star/result'],e),// component: e => require(['@/components/star/result'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/zhibo', path: '/zhibo',
name: 'zhibo', name: 'zhibo',
component: e=>require(['@/components/indexPage/zb'],e),// component: e => require(['@/components/indexPage/zb'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/med', path: '/med',
name: 'med', name: 'med',
component: e=>require(['@/components/indexPage/med'],e),// component: e => require(['@/components/indexPage/med'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/preview', path: '/preview',
name: 'preview', name: 'preview',
component: e=>require(['@/components/indexPage/preview'],e),// component: e => require(['@/components/indexPage/preview'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/bbda', path: '/bbda',
name: 'bbda', name: 'bbda',
component: e=>require(['@/components/indexPage/bbda'],e),// component: e => require(['@/components/indexPage/bbda'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/exChange', path: '/exChange',
name: 'exChange', name: 'exChange',
component: e=>require(['@/components/exChange'],e),// component: e => require(['@/components/exChange'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, { }, {
path: '/newLesson', path: '/newLesson',
name: 'newLesson', name: 'newLesson',
component: e=>require(['@/components/newLesson'],e),// component: e => require(['@/components/newLesson'], e),//
meta:{ meta: {
deep:0 deep: 0
} }
}, { }, {
path: '/star', path: '/star',
name: 'star', name: 'star',
component: e=>require(['@/components/star'],e),// component: e => require(['@/components/star'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/shareGoods', path: '/shareGoods',
name: 'shareGoods', name: 'shareGoods',
component: e=>require(['@/components/newLesson/shareGoods'],e),// component: e => require(['@/components/newLesson/shareGoods'], e),//
meta:{ meta: {
deep:0, deep: 0,
noNew:true noNew: true
} }
},{ }, {
path: '/myGoodsList', path: '/myGoodsList',
name: 'myGoodsList', name: 'myGoodsList',
component: e=>require(['@/components/myGoodsList'],e), component: e => require(['@/components/myGoodsList'], e),
meta:{ meta: {
deep:1 deep: 1
} }
},{ }, {
path: '/mine', path: '/mine',
name: 'mine', name: 'mine',
component: e=>require(['@/components/mine/index'],e), component: e => require(['@/components/mine/index'], e),
meta:{ meta: {
deep:1 deep: 1
} }
},{ }, {
path: '/order', path: '/order',
name: 'order', name: 'order',
component: e=>require(['@/components/order'],e), component: e => require(['@/components/order'], e),
meta:{ meta: {
deep:2 deep: 2
} }
},{ }, {
path: '/share', path: '/share',
name: 'share', name: 'share',
component: e=>require(['@/components/share'],e), component: e => require(['@/components/share'], e),
meta:{ meta: {
deep:2 deep: 2
} }
}, },
{ {
path: '/author', path: '/author',
name: 'author', name: 'author',
component: e=>require(['@/components/author'],e), component: e => require(['@/components/author'], e),
meta:{ meta: {
deep:100, deep: 100,
noNew:true noNew: true
} }
},{ }, {
path: '/buyDetail', path: '/buyDetail',
name: 'buyDetail', name: 'buyDetail',
component: e=>require(['@/components/buy/index'],e), component: e => require(['@/components/buy/index'], e),
meta:{ meta: {
skip_login:false, skip_login: false,
noNew:true, noNew: true,
deep:10 deep: 10
} }
}, { }, {
path: '/buy', path: '/buy',
name: 'buy', name: 'buy',
component: e=>require(['@/components/buy/buy'],e), component: e => require(['@/components/buy/buy'], e),
meta:{ meta: {
noNew:true, noNew: true,
deep:11 deep: 11
} }
}, { }, {
path: '/success', path: '/success',
name: 'success', name: 'success',
component: e=>require(['@/components/buy/success'],e), component: e => require(['@/components/buy/success'], e),
meta:{ meta: {
noNew:true, noNew: true,
deep:12 deep: 12
} }
},{ }, {
path: '/buySuccess', path: '/buySuccess',
name: 'buySuccess', name: 'buySuccess',
component: e=>require(['@/components/buy/buySuccess'],e), component: e => require(['@/components/buy/buySuccess'], e),
meta:{ meta: {
noNew:true, noNew: true,
deep:12 deep: 12
} }
}, { }, {
path: '/map', path: '/map',
name: 'map', name: 'map',
component: e=>require(['@/components/map/index'],e), component: e => require(['@/components/map/index'], e),
meta:{ meta: {
deep:3 deep: 3
} }
}, },
{ {
path: '/saleSuccess', path: '/saleSuccess',
name: 'saleSuccess', name: 'saleSuccess',
component: e=>require(['@/components/buy/saleSuccess'],e), component: e => require(['@/components/buy/saleSuccess'], e),
meta:{ meta: {
deep:4 deep: 4
} }
}, { }, {
path: '/bindMobile', path: '/bindMobile',
name: 'bindMobile', name: 'bindMobile',
component: e=>require(['@/components/bindMobile'],e), component: e => require(['@/components/bindMobile'], e),
meta:{ meta: {
deep:0 deep: 0
} }
}, },
{ {
path: '/activity', path: '/activity',
name: 'activity', name: 'activity',
component: e=>require(['@/components/buy/activity'],e), component: e => require(['@/components/buy/activity'], e),
meta:{ meta: {
skip_login:true, skip_login: true,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/activityInvite', path: '/activityInvite',
name: 'activityInvite', name: 'activityInvite',
component: e=>require(['@/components/buy/activityInvite'],e), component: e => require(['@/components/buy/activityInvite'], e),
meta:{ meta: {
skip_login:true, skip_login: true,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/inviteList', path: '/inviteList',
name: 'inviteList', name: 'inviteList',
component: e=>require(['@/components/buy/inviteList'],e), component: e => require(['@/components/buy/inviteList'], e),
meta:{ meta: {
skip_login:true, skip_login: true,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/collection', path: '/collection',
name: 'collection', name: 'collection',
component: e=>require(['@/components/collection'],e), component: e => require(['@/components/collection'], e),
meta:{ meta: {
skip_login:true skip_login: true
} }
}, },
{ {
path: '/noWechat', path: '/noWechat',
name: 'noWechat', name: 'noWechat',
component: e=>require(['@/components/noWechat'],e), component: e => require(['@/components/noWechat'], e),
meta:{ meta: {
skip_login:false skip_login: false
} }
}, },
{ {
path: '/mpShop', path: '/mpShop',
name: 'mpShop', name: 'mpShop',
component: e=>require(['@/components/buy/mpShop'],e), component: e => require(['@/components/buy/mpShop'], e),
meta:{ meta: {
skip_login:false, skip_login: false,
noNew:true, noNew: true,
} }
}, },
{ {
path: '/shareConfig', path: '/shareConfig',
name: 'shareConfig', name: 'shareConfig',
component: e=>require(['@/components/shareConfig'],e), component: e => require(['@/components/shareConfig'], e),
meta:{ meta: {
noNew:true, noNew: true,
} }
}, },
{ {
path: '/inspectorActivit', path: '/inspectorActivit',
name: 'inspectorActivit', name: 'inspectorActivit',
component: e=>require(['@/components/inspector/inspectorActivit'],e), component: e => require(['@/components/inspector/inspectorActivit'], e),
meta:{ meta: {
noNew:true, noNew: true,
} }
}, },
{ {
path: '/inspectorList', path: '/inspectorList',
name: 'inspectorList', name: 'inspectorList',
component: e=>require(['@/components/inspector/inspectorList'],e), component: e => require(['@/components/inspector/inspectorList'], e),
meta:{ meta: {
noNew:true, noNew: true,
} }
}, },
{ {
path: '/secMap', path: '/secMap',
name: 'secMap', name: 'secMap',
component: e=>require(['@/components/map/secMap'],e), component: e => require(['@/components/map/secMap'], e),
meta:{ meta: {
noNew:true, noNew: true,
} }
}, },
{ {
path: '/hasaccount', path: '/hasaccount',
name: 'hasaccount', name: 'hasaccount',
component: e=>require(['@/components/map/hasaccount'],e), component: e => require(['@/components/map/hasaccount'], e),
meta:{ meta: {
noNew:true, noNew: true,
} }
}, },
{ {
path:'*', path: '*',
component: e=>require(['@/components/error'],e), component: e => require(['@/components/error'], e),
}, },
] ]
}); });
router.beforeEach((to,from,next)=> { router.beforeEach((to, from, next) => {
// 神策路由埋点 // 神策路由埋点
Vue.nextTick(() => { Vue.nextTick(() => {
sa.quick("autoTrackSinglePage"); sa.quick("autoTrackSinglePage");
}); });
// 判断是否是微信环境 排除本地 // 判断是否是微信环境 排除本地
if(ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_'){ if (ua.match(/MicroMessenger/i) == 'micromessenger' || ua.match(/_SQ_/i) == '_sq_') {
if(to.name == 'noWechat'){ if (to.name == 'noWechat') {
// 在微信里打开非微信提示页 // 在微信里打开非微信提示页
if(to.query.url){ if (to.query.url) {
next(decodeURIComponent(to.query.url)) next(decodeURIComponent(to.query.url))
}else{ } else {
next({name:'index'}); next({ name: 'index' });
} }
} }
}else{ } else {
if(to.name !== 'noWechat' && process.env.NODE_ENV === 'production') { if (to.name !== 'noWechat' && process.env.NODE_ENV === 'production') {
next({name:'noWechat',query:{url:encodeURIComponent(to.fullPath)}}); next({ name: 'noWechat', query: { url: encodeURIComponent(to.fullPath) } });
} }
} }
// 移动端判断 // 移动端判断
store.dispatch('isMobile',browser.versions.mobile); store.dispatch('isMobile', browser.versions.mobile);
// 默认title // 默认title
if(process.env.NODE_ENV === 'production'){ if (process.env.NODE_ENV === 'production') {
document.title = '唱唱启蒙英语'; document.title = '唱唱启蒙英语';
}else{ } else {
document.title = '唱唱测试'; document.title = '唱唱测试';
} }
if(to.name === 'secMap' ){ if (to.name === 'secMap') {
// (function(d, w, c) { // (function(d, w, c) {
// var s = d.createElement('script'); // var s = d.createElement('script');
// w[c] = w[c] || function() { // w[c] = w[c] || function() {
...@@ -430,70 +439,70 @@ router.beforeEach((to,from,next)=> { ...@@ -430,70 +439,70 @@ router.beforeEach((to,from,next)=> {
// _AIHECONG('ini',{ entId : 11875,button:true }); // _AIHECONG('ini',{ entId : 11875,button:true });
// debugger // debugger
} }
let goOn=function(){ let goOn = function () {
if(localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== ''){ if (localStorage.getItem('retUrl') && localStorage.getItem('retUrl') !== null && localStorage.getItem('retUrl') !== '') {
console.log(localStorage.getItem('retUrl')) console.log(localStorage.getItem('retUrl'))
let retUrl = localStorage.getItem('retUrl').toString(); let retUrl = localStorage.getItem('retUrl').toString();
localStorage.removeItem('retUrl'); localStorage.removeItem('retUrl');
next(retUrl); next(retUrl);
}else{ } else {
next() 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() 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; let token = common.getUrlParam().token || to.query.token;
console.log(common.getUrlParam()) console.log(common.getUrlParam())
console.log(to.name) console.log(to.name)
// debugger // debugger
store.dispatch('setToken',token); store.dispatch('setToken', token);
getUserDetailApi().then(res=>{ getUserDetailApi().then(res => {
// debugger // debugger
localStorage.setItem('userDesc',JSON.stringify(res)); localStorage.setItem('userDesc', JSON.stringify(res));
sa.login(res.user_id); sa.login(res.user_id);
goOn() goOn()
}).catch((res)=>{ }).catch((res) => {
console.log(res) console.log(res)
// debugger // debugger
if(localStorage.getItem('userDesc')){ if (localStorage.getItem('userDesc')) {
goOn() goOn()
} }
}); });
}else if(localStorage.getItem('cc_token')) { } else if (localStorage.getItem('cc_token')) {
// 已登陆 // 已登陆
store.dispatch('setToken', 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); sa.login(JSON.parse(localStorage.getItem('userDesc')).user_id);
goOn() goOn()
}else{ } else {
getUserDetailApi().then(res=>{ getUserDetailApi().then(res => {
localStorage.setItem('userDesc',JSON.stringify(res)); localStorage.setItem('userDesc', JSON.stringify(res));
sa.login(res.user_id); sa.login(res.user_id);
goOn() goOn()
}).catch(()=>{ }).catch(() => {
if(localStorage.getItem('userDesc')){ if (localStorage.getItem('userDesc')) {
goOn() goOn()
} }
}); });
} }
// debugger // debugger
}else{ } else {
// 未登陆,保存下路径 // 未登陆,保存下路径
let query = {retUrl:to.fullPath}; let query = { retUrl: to.fullPath };
localStorage.setItem('retUrl',to.fullPath); localStorage.setItem('retUrl', to.fullPath);
if(window.location.href.indexOf('gdt_vid')>-1){ if (window.location.href.indexOf('gdt_vid') > -1) {
localStorage.setItem('gdt_vid',common.getUrlParam().gdt_vid); localStorage.setItem('gdt_vid', common.getUrlParam().gdt_vid);
console.log(query.gdt_vid) console.log(query.gdt_vid)
} }
console.log(process.env.AUTHOR_UEL) console.log(process.env.AUTHOR_UEL)
console.log(window.location.href) console.log(window.location.href)
if(to.meta.noNew){ if (to.meta.noNew) {
query.is_new_user_url = 1; query.is_new_user_url = 1;
window.location.href = `${process.env.AUTHOR_UEL}` window.location.href = `${process.env.AUTHOR_UEL}`
}else{ } else {
// debugger // debugger
window.location.href = `${process.env.AUTHOR_UEL}&is_new_user_url=1` window.location.href = `${process.env.AUTHOR_UEL}&is_new_user_url=1`
} }
......
import Vue from 'vue'; import Vue from 'vue';
import {post,fetch,patch,put,del,upload,ret2} from './index' import { post, fetch, patch, put, del, upload, ret2 } from './index'
const _baseUrl=process.env.API_URL; const _baseUrl = process.env.API_URL;
Vue.prototype.$post=post; Vue.prototype.$post = post;
Vue.prototype.$fetch=fetch; Vue.prototype.$fetch = fetch;
Vue.prototype.$patch=patch; Vue.prototype.$patch = patch;
Vue.prototype.$put=put; Vue.prototype.$put = put;
Vue.prototype.$del=del; Vue.prototype.$del = del;
Vue.prototype.$upload = upload; Vue.prototype.$upload = upload;
Vue.prototype.$ret2 = ret2; Vue.prototype.$ret2 = ret2;
...@@ -14,20 +14,20 @@ const getBannerListUrl = `${_baseUrl}api/client/banner/list`; ...@@ -14,20 +14,20 @@ const getBannerListUrl = `${_baseUrl}api/client/banner/list`;
export const getBannerListApi = function () { export const getBannerListApi = function () {
return Vue.prototype.$fetch(getBannerListUrl) return Vue.prototype.$fetch(getBannerListUrl)
}; };
const bannerListUrl =`/api/client/banner/list/`; const bannerListUrl = `/api/client/banner/list/`;
export const bannerListApi = function (type,json) { export const bannerListApi = function (type, json) {
return Vue.prototype.$fetch(bannerListUrl+type,json) return Vue.prototype.$fetch(bannerListUrl + type, json)
}; };
// 获取微信授权 // 获取微信授权
const getwechatParamUrl = `${_baseUrl}api/client/jssdk`; const getwechatParamUrl = `${_baseUrl}api/client/jssdk`;
export const getwechatParam = function (json) { export const getwechatParam = function (json) {
return Vue.prototype.$fetch(getwechatParamUrl,json) return Vue.prototype.$fetch(getwechatParamUrl, json)
}; };
// 文件上传 // 文件上传
const uploadFileUrl = `${_baseUrl}api/public/upload/zone`; const uploadFileUrl = `${_baseUrl}api/public/upload/zone`;
export const uploadFileApi = function (json) { 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/`; ...@@ -35,6 +35,19 @@ const getGoodsDetailUrl = `${_baseUrl}api/client/goods/info/`;
export const getGoodsDetailApi = function (id) { export const getGoodsDetailApi = function (id) {
return Vue.prototype.$fetch(`${getGoodsDetailUrl}${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`; const getUserAdressUrl = `${_baseUrl}api/client/address/info`;
export const getUserAdressApi = function () { export const getUserAdressApi = function () {
...@@ -43,27 +56,28 @@ export const getUserAdressApi = function () { ...@@ -43,27 +56,28 @@ export const getUserAdressApi = function () {
// 微信支付 // 微信支付
const payUrl = `${_baseUrl}api/client/bill/wechat/pay` const payUrl = `${_baseUrl}api/client/bill/wechat/pay`
export const payApi = function (json) { export const payApi = function (json) {
return Vue.prototype.$fetch(payUrl,json) return Vue.prototype.$fetch(payUrl, json)
}; };
// 保存用户地址 // 保存用户地址
const saveAddressUrl = `${_baseUrl}api/client/address/save` const saveAddressUrl = `${_baseUrl}api/client/address/save`
export const saveAddressApi = function (json) { export const saveAddressApi = function (json) {
return Vue.prototype.$post(saveAddressUrl,json) return Vue.prototype.$post(saveAddressUrl, json)
}; };
// 保存用户活动地址 // 保存用户活动地址
export const saveActivityAddressApi = function (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) { export const editActivityAddressApi = function (json, address_id) {
return Vue.prototype.$put(`${_baseUrl}api/client/user/starActivity/address/edit/${address_id}`,json) return Vue.prototype.$put(`${_baseUrl}api/client/user/starActivity/address/edit/${address_id}`, json)
}; };
// 获取用户活动地址 // 获取用户活动地址
export const getActivityAddressApi = function (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` const getUserLessonUrl = `${_baseUrl}api/client/user/course/list`
export const getUserLessonApi = function () { export const getUserLessonApi = function () {
...@@ -71,8 +85,8 @@ export const getUserLessonApi = function () { ...@@ -71,8 +85,8 @@ export const getUserLessonApi = function () {
}; };
// 课包列表 // 课包列表
const getLessonListUrl = `${_baseUrl}api/client/course/category/list/` const getLessonListUrl = `${_baseUrl}api/client/course/category/list/`
export const getLessonListApi = function (id,json) { export const getLessonListApi = function (id, json) {
return Vue.prototype.$fetch(`${getLessonListUrl}${id}`,json) return Vue.prototype.$fetch(`${getLessonListUrl}${id}`, json)
}; };
// 获取主题列表 // 获取主题列表
const getCourseListUrl = `${_baseUrl}api/client/course/relation/list/` const getCourseListUrl = `${_baseUrl}api/client/course/relation/list/`
...@@ -81,7 +95,7 @@ export const getCourseListApi = function (id) { ...@@ -81,7 +95,7 @@ export const getCourseListApi = function (id) {
}; };
//获取课包详情 //获取课包详情
const getLessonDetailUrl = `${_baseUrl}api/client/element/info/` 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}`) return Vue.prototype.$fetch(`${getLessonDetailUrl}${periods_id}/${category_id}/${element_id}`)
}; };
// 获取客户详情 // 获取客户详情
...@@ -91,8 +105,8 @@ export const getUserDetailApi = function () { ...@@ -91,8 +105,8 @@ export const getUserDetailApi = function () {
}; };
// 提交看课数据 // 提交看课数据
const subUserLessonUrl = `${_baseUrl}api/client/user/watch/log/`; const subUserLessonUrl = `${_baseUrl}api/client/user/watch/log/`;
export const subUserLessonApi = function (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) return Vue.prototype.$post(`${subUserLessonUrl}${element_id}/${category_id}/${periods_id}`, json)
}; };
// 获取团购详情 // 获取团购详情
const getGroupDetailUrl = `${_baseUrl}api/client/group/info/`; const getGroupDetailUrl = `${_baseUrl}api/client/group/info/`;
...@@ -107,7 +121,7 @@ export const getOrderDetailApi = function (id) { ...@@ -107,7 +121,7 @@ export const getOrderDetailApi = function (id) {
// 获取用户订单列表 // 获取用户订单列表
const getOrderListUrl = `${_baseUrl}api/client/order/list`; const getOrderListUrl = `${_baseUrl}api/client/order/list`;
export const getOrderListApi = function (json) { 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`; const getUserWatchUrl = `${_baseUrl}api/client/user/watch/report`;
...@@ -127,82 +141,82 @@ export const getNewApi = function () { ...@@ -127,82 +141,82 @@ export const getNewApi = function () {
// 查看是否可购买该商品 // 查看是否可购买该商品
const getStatusWechatUrl = `${_baseUrl}api/client/bill/wechat/status`; const getStatusWechatUrl = `${_baseUrl}api/client/bill/wechat/status`;
export const getStatusWechatApi = function (json) { 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`; const getCouponListUrl = `${_baseUrl}api/client/user/coupon/list`;
export const getCouponListApi = function (id) { 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`; const getGoodsListUrl = `${_baseUrl}api/client/goods/list`;
export const getGoodsListApi = function (json) { 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`; const getInviteResultUrl = `${_baseUrl}api/client/user/invite/earnings`;
export const getInviteResultApi = function (json,id) { export const getInviteResultApi = function (json, id) {
return Vue.prototype.$fetch(`${getInviteResultUrl}/${id}`,json) return Vue.prototype.$fetch(`${getInviteResultUrl}/${id}`, json)
}; };
//获取邀请战绩用户列表 //获取邀请战绩用户列表
const getInviteListUrl = `${_baseUrl}api/client/user/invite/list`; const getInviteListUrl = `${_baseUrl}api/client/user/invite/list`;
export const getInviteListApi = function (json,id) { export const getInviteListApi = function (json, id) {
return Vue.prototype.$fetch(`${getInviteListUrl}/${id}`,json) return Vue.prototype.$fetch(`${getInviteListUrl}/${id}`, json)
}; };
// 发送验证码 // 发送验证码
const sendMobileCodeUrl = `${_baseUrl}api/client/mobile/code`; const sendMobileCodeUrl = `${_baseUrl}api/client/mobile/code`;
export const sendMobileCodeApi = function (json) { 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`; const bindMobileUrl = `${_baseUrl}api/client/user/mobile/bind`;
export const bindMobileApi = function (json) { 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`; const orderTransUrl = `${_baseUrl}api/client/user/mobile/bind/order_id`;
export const orderTransApi = function (json,order_id) { export const orderTransApi = function (json, order_id) {
return Vue.prototype.$put(orderTransUrl,json) 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) { 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) { 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) { 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) { 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) { 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) { export const delUserCollectApi = function (id) {
return Vue.prototype.$put(delUserCollectUrl+id) return Vue.prototype.$put(delUserCollectUrl + id)
}; };
// 获取他人看课统计 // 获取他人看课统计
const getOtherUserWatchUrl = `/api/client/user/watch/report/`; const getOtherUserWatchUrl = `/api/client/user/watch/report/`;
export const getOtherUserWatchApi = function (id) { 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 () { ...@@ -214,7 +228,7 @@ export const getShareGoodsApi = function () {
// 获取短网址 // 获取短网址
const getShortUrl = `/api/public/short/url`; const getShortUrl = `/api/public/short/url`;
export const getShortApi = function (json) { 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 () { ...@@ -226,44 +240,44 @@ export const getUserIntegralApi = function () {
// 获取用户积分列表 // 获取用户积分列表
const getUserIntegralListUrl = '/api/client/user/integral'; const getUserIntegralListUrl = '/api/client/user/integral';
export const getUserIntegralListApi = function (json) { 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`; const ExChangeUrl = `/api/client/user/mobile/bind/exchange`;
export const ExChangeApi = function (json) { export const ExChangeApi = function (json) {
return Vue.prototype.$put(ExChangeUrl,json) return Vue.prototype.$put(ExChangeUrl, json)
}; };
// 获取可选择的期数 // 获取可选择的期数
const getYujiListUrl = `/api/client/yunji/config`; const getYujiListUrl = `/api/client/yunji/config`;
export const getYujiListUrlApi = function (json) { 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) { 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 () { export const getCourseStatusApi = function () {
return Vue.prototype.$fetch(getCourseStatusUrl) 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) { export const getCourseInfoApi = function (periods_id) {
// periods_id=12 // periods_id=12
// debugger // 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) { 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}`) return Vue.prototype.$fetch(`/api/client/course/automation/list/${type}/${id}`)
}; };
// 自动化看课推荐转化商品及其优惠券 // 自动化看课推荐转化商品及其优惠券
...@@ -318,4 +332,4 @@ export const searchAccountinfoApi = function (authorization) { ...@@ -318,4 +332,4 @@ export const searchAccountinfoApi = function (authorization) {
export const getStarInfoApi = function () { export const getStarInfoApi = function () {
return Vue.prototype.$fetch(`/api/client/user/starActivity`) return Vue.prototype.$fetch(`/api/client/user/starActivity`)
}; };
// //
...@@ -64,11 +64,11 @@ export default { ...@@ -64,11 +64,11 @@ export default {
return theRequest; return theRequest;
}, },
// 倒计时 // 倒计时
leftTimer(enddate,Interval) { leftTimer(enddate, Interval) {
if (enddate > new Date()) { if (enddate > new Date()) {
var leftTime = (enddate) - new Date(); //计算剩余的毫秒数 var leftTime = (enddate) - new Date(); //计算剩余的毫秒数
}else{ } else {
if(Interval){ if (Interval) {
clearInterval(Interval) clearInterval(Interval)
} }
// console.log(enddate) // console.log(enddate)
...@@ -87,9 +87,9 @@ export default { ...@@ -87,9 +87,9 @@ export default {
// console.log(hours) // console.log(hours)
// console.log(minutes) // console.log(minutes)
// console.log(seconds) // console.log(seconds)
if(days > 0){ if (days > 0) {
return days + "天" return days + "天"
}else if(hours >= 0 || minutes >= 0 || seconds >= 0){ } else if (hours >= 0 || minutes >= 0 || seconds >= 0) {
return hours + ":" + minutes + ":" + seconds; return hours + ":" + minutes + ":" + seconds;
} }
// if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) return days + "天" + hours + ":" + minutes + ":" + seconds; // if (days >= 0 || hours >= 0 || minutes >= 0 || seconds >= 0) return days + "天" + hours + ":" + minutes + ":" + seconds;
...@@ -98,11 +98,11 @@ export default { ...@@ -98,11 +98,11 @@ export default {
// window.clearInterval(_ordertimer); // window.clearInterval(_ordertimer);
// _ordertimer = null; // _ordertimer = null;
// } // }
}, },
checkTime(i) { //将0-9的数字前面加上0,例1变为01 checkTime(i) { //将0-9的数字前面加上0,例1变为01
if (i < 10) { if (i < 10) {
i = "0" + i; 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