4d9925d8 by joe

基本功能

1 parent c581f236
......@@ -16,6 +16,11 @@
<strong>We're sorry but vue-cli3-framework doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<script src="./js/global-params.js"></script>
<script src="./js/jweixin-1.1.0.js"></script>
<script src="./js/hdp-4.4.0.min.js"></script>
<script src="./js/as.js"></script>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
......
let global_gzh_name = "袋鼠妈妈学堂";
let global_gzh_wxAppId = "wxaf7d9b7414c6df11";
let global_register_redirect = false;
// let global_gzh_name = "安敏健行";
// let global_gzh_wxAppId = "wx3a4821f58cc1ded7";
// let global_register_redirect = "https://nutwpgateway.novaetech.cn/wx/oauth2/authorize?brandId=17378876&scope=snsapi_base&url=http%3A%2F%2Fh5.novaetech.cn%2F%23%2Fshowqrcode";
\ No newline at end of file
This diff could not be displayed because it is too large.
......@@ -6,10 +6,6 @@ import Router from '../router'
// Toast
// } from 'vant';
function Toast(msg) {
console.log("msg:", msg);
}
// axios的默认url
// axios.defaults.baseURL = ""
......@@ -54,7 +50,7 @@ axios.interceptors.response.use(
store.removeSession();
store.saveRedirectUrl();
Router.push("/");
}
}
return Promise.reject(response);
}
} else {
......@@ -192,21 +188,21 @@ export const formdata = params => {
export const request = {
post(url, data) {
return axios.post(`${requestDomain}${url}`, data);
return axios.post(`${base}${url}`, data);
},
get(url, data) {
return axios.get(`${requestDomain}${url}`, { params: data });
return axios.get(`${base}${url}`, { params: data });
},
form(url, params) {
let formData = new FormData(); //使用formData对象
for (let key in params) {
formData.append(key, params[key]);
}
let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${requestDomain}${url}`;
let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${base}${url}`;
return axios.post(requestUrl, formData, formDataHeaders)
},
build(url, params){
let fullUrl = `${requestDomain}${url}`;
let fullUrl = `${base}${url}`;
let split = "";
for(let key in params){
if(split){
......
<template>
<van-overlay :show="show" >
</van-overlay>
<van-popup v-model="data.show">
<div class="model">
<div class="model-close" @click="modelCloseHandler"></div>
<div class="model-content">
<div class="model-head-line"></div>
<div class="model-title">{{data.title}}</div>
<div class="successModel" v-if="data.index == 'default'">
<div class="model-data">{{data.content}}</div>
<div v-if="data.btnShow" class="sys-btn-02" @click="modelBtnClickHandler">{{data.btnText}}</div>
<div
v-if="data.labelBtnShow"
class="label-btn"
@click="labelBtnClickHandler"
>{{data.labelBtnText}}</div>
<div class="model-bottom-line"></div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import Vue from "vue";
import { Overlay } from "vant";
Vue.use(Overlay);
import { Popup } from "vant";
Vue.use(Popup);
export default {
props: ["value"],
data() {
return {
model: this.value,
show: false
data: this.value
};
},
methods: {},
created() {}
methods: {
modelCloseHandler() {
this.$emit("close");
this.data.show = false;
},
modelBtnClickHandler() {
this.data.show = false;
typeof this.data.confirmHandler == "function" &&
this.data.confirmHandler();
},
labelBtnClickHandler() {
this.data.show = false;
typeof this.data.labelBtnHandler == "function" &&
this.data.labelBtnHandler();
}
},
created() {
this.data = this.data
? this.data
: {
title: "",
description: "",
show: false,
index: "default",
btnShow: false,
btnText: "",
confirmHandler: null,
labelBtnShow: false,
labelBtnText: "",
labelBtnHandler: null
};
}
};
</script>
<style lang="less" scoped>
.van-popup {
background-color: transparent;
top: 40%;
}
.model {
display: flex;
width: 480px;
min-height: 576px;
flex-direction: column;
align-items: flex-end;
}
.model-head-line {
height: 50px;
background-color: transparent;
}
.model-bottom-line {
height: 50px;
background-color: transparent;
}
.model-close {
width: 64px;
height: 116px;
background: url(../../assets/imgs/model-close.png);
background-size: 100%;
}
.model-content {
width: 480px;
min-height: 460px;
height: auto;
background: url(../../assets/imgs/model-bottom.png) no-repeat;
background-size: 100% auto;
background-position: bottom;
border-radius: 30px;
background-color: #fff;
}
.model-title {
font-size: 45px;
font-weight: bold;
}
.model-data {
font-size: 30px;
margin: 50px auto 70px auto;
width: 400px;
text-align: center;
}
.sys-btn-02 {
width: 300px;
font-size: 30px;
line-height: 80px;
}
.label-btn {
font-size: 26px;
text-align: center;
}
</style>
......
......@@ -56,11 +56,15 @@ export default {
},
login() {
httpPost({ url: urls.login, data: this.loginParam }).then(res => {
store.putSession(res.sessionId);
let path = store.getRedirectUrl();
path = !path ? "/index" : path;
store.delRedirectUrl();
this.$router.push(path);
if (!res.sessionId) {
store.toWxLogin();
} else {
store.putSession(res.sessionId);
let path = store.getRedirectUrl();
path = !path ? "/index" : path;
store.delRedirectUrl();
this.$router.push(path);
}
});
}
},
......
......@@ -185,6 +185,8 @@ export default {
});
httpPost({ url: urls.submit, data: this.formData }).then(res => {
Toast.clear();
this.formData.worksCode = res;
console.log("submit === =", res);
this.$emit("submit", res);
});
}
......@@ -314,7 +316,6 @@ export default {
color: #4f9984;
font-size: 18px;
}
}
.view-btn-group {
......
......@@ -57,15 +57,17 @@
</template>
<script>
let urls = {};
let urls = {
praise: "/jiajiaCHApi/app/works/praise"
};
import { httpGet, httpPost } from "@/api/fetch-api";
import { request } from "@/api/fetch-api";
import Vue from "vue";
import { Toast } from "vant";
import { Popup } from "vant";
import { Swipe, SwipeItem } from "vant";
Vue.use(Popup);
Vue.use(Swipe).use(SwipeItem);
Vue.use(Toast);
export default {
......@@ -81,9 +83,28 @@ export default {
},
selfPraiseHandler() {
// 自己点赞
let data = {
worksCode: this.formData.worksCode
};
Toast.loading({
mask: true,
message: "数据提交..."
});
request
.post(urls.praise, data)
.then(res => {
Toast.clear();
this.$emit("praiseSuccess")
})
.catch(res => {
let msg = res.data.errMsg;
Toast(msg);
});
},
showShareHandler() {
// 出现分享层
this.$emit("showShare")
console.log("show share")
}
},
created() {
......
......@@ -2,16 +2,26 @@
<div class="home">
<div class="head-leap"></div>
<ViewModel v-model="formData" v-if="init && !formEdit" v-on:edit="formEdit=true"></ViewModel>
<EditModel v-model="formData" v-if="init && formEdit" v-on:submit="initActivity"></EditModel>
<ViewModel
v-model="formData"
v-if="init && !formEdit"
v-on:edit="formEdit=true"
v-on:praiseSuccess="showPraiseSuccessModel"
v-on:showShare="shareModelVisiable=true"
></ViewModel>
<EditModel v-model="formData" v-if="init && formEdit" v-on:submit="showSuccessModel"></EditModel>
<div class="bottom-line"></div>
<bottom-tool v-model="activityIndex"></bottom-tool>
<!-- <van-popup class="messagePopue" v-model="successModelVisiable" :close-on-click-overlay="false">
<div></div>
</van-popup>-->
<biz-model v-model="model"></biz-model>
<!-- 分享蒙层 -->
<div class="shareModel" v-if="shareModelVisiable" @click="shareModelVisiable = false">
<div class="shareModelContainer">
<div class="shareModelMask"></div>
<div class="shareIcon"></div>
</div>
</div>
</div>
</template>
......@@ -22,6 +32,7 @@ let urls = {
};
import BottomTool from "@/components/bottom-tools/bottom-tools";
import BizModel from "@/components/biz-model/biz-model";
import EditModel from "./components/EditModel";
import ViewModel from "./components/ViewModel";
......@@ -30,14 +41,8 @@ import AreaList from "@/api/area";
import Vue from "vue";
import { Toast } from "vant";
import { Area } from "vant";
import { Popup } from "vant";
import { Swipe, SwipeItem } from "vant";
Vue.use(Popup);
Vue.use(Area);
Vue.use(Toast);
Vue.use(Swipe).use(SwipeItem);
export default {
name: "home",
......@@ -47,8 +52,9 @@ export default {
formEdit: false,
init: false,
isMy: 1,
successModelVisiable: true,
shareModelVisiable: false,
formData: {
worksCode: "",
name: "",
province: "",
provinceCode: "",
......@@ -59,6 +65,18 @@ export default {
parentName: "",
parentMobile: "",
worksList: []
},
model: {
show: false,
title: "",
content: "",
index: "default",
btnShow: false,
btnText: "",
confirmHandler: null,
labelBtnShow: false,
labelBtnText: "",
labelBtnHandler: null
}
};
},
......@@ -78,13 +96,57 @@ export default {
} else {
this.formEdit = false;
}
this.initShare();
});
},
showSuccessModel() {
this.model.title = "温馨提示";
this.model.content = "报名已成功!";
this.model.index = "default";
this.model.btnShow = true;
this.model.btnText = "查看我的主页";
this.model.show = true;
let that = this;
this.model.confirmHandler = function() {
that.initActivity();
};
},
showPraiseSuccessModel() {
this.model.show = true;
this.model.title = "点赞成功";
this.model.content = "您已获得一次抽奖机会";
this.model.btnShow = true;
this.model.btnText = "前往抽奖";
let that = this;
this.model.confirmHandler = function() {
that.$router.push("/draw");
};
this.model.labelBtnShow = true;
this.model.labelBtnText = "查看个人主页";
this.model.labelBtnHandler = function() {
that.initActivity();
};
},
initShare() {
let link = location.origin + location.pathname;
if (this.formData.worksCode) {
link += "?worksCode=" + this.formData.worksCode;
}
let desc = this.formData.profile || null;
let imgurl =
this.formData.worksList.length > 0
? this.formData.worksList[0].worksUrl
: null;
as.setShare(link, null, desc, imgurl);
}
},
components: {
BottomTool,
EditModel,
ViewModel
ViewModel,
BizModel
},
created() {
this.initActivity();
......@@ -113,4 +175,37 @@ export default {
height: 250px;
background-color: transparent;
}
.shareModel {
position: fixed;
height: 100%;
width: 100%;
left: 0px;
top: 0px;
z-index: 9999;
}
.shareModelContainer {
position: relative;
height: 100%;
width: 100%;
}
.shareModelMask {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
}
.shareIcon {
position: absolute;
top: 0px;
right: 30px;
width: 425px;
height: 220px;
background: url(../../assets/imgs/model-share-tip.png) no-repeat;
background-size: 100%;
}
</style>
......