53687232 by joe

12

1 parent d48fd4cd
......@@ -5,10 +5,69 @@
<router-link to="/about">About</router-link>
</div>-->
<router-view />
<biz-model v-model="shareModel"></biz-model>
</div>
</template>
<script>
let urls = {
share: "/jiajiaCHApi/app/works/share"
};
import BizModel from "@/components/biz-model/biz-model";
import { httpPost } from "@/api/fetch-api";
export default {
data() {
return {
shareModel: {
show: false,
title: "",
content: "",
index: "default",
btnShow: false,
btnText: "",
confirmHandler: null,
labelBtnShow: false,
labelBtnText: "",
labelBtnHandler: null
}
};
},
methods: {
init() {
// alert("init");
// as.appSuccess = this.shareSuccessHandler;
// as.success = this.shareSuccessHandler;
},
shareSuccessHandler() {
httpPost({ url: urls.share, data: { worksCode: "" } }).then(res => {
if (res == 1) {
let that = this;
this.shareModel.show = true;
this.shareModel.title = "分享成功";
this.shareModel.content = "您已获得一次抽奖机会";
this.shareModel.btnShow = true;
this.shareModel.btnText = "前往抽奖";
this.shareModel.confirmHandler = function() {
that.$router.push("/draw");
};
this.shareModel.labelBtnShow = false;
}
});
}
},
created() {
this.init();
},
components: {
BizModel
}
};
</script>
<style lang="scss">
@import "./styles/support.scss";
......@@ -136,7 +195,6 @@ body {
}
}
.home {
position: relative;
text-align: center;
......
......@@ -20,7 +20,8 @@ let wxOauthUrl = global_wx_oauth_url;
let whileList = [
"https://api.k.wxpai.cn/bizproxy/kdapi/file/upload"
"https://api.k.wxpai.cn/bizproxy/kdapi/file/upload",
"https://api.k.wxpai.cn/bizproxy/kdapi/file/uploadBase64"
]
// let base = COM.baseUrl;
......@@ -133,9 +134,12 @@ export const store = {
localStorage.removeItem("_jiajia_childrenhost_sesson");
},
saveRedirectUrl() {
let current = Router.history.current || {};
if (!Router.history.current || !Router.history.current.path) {
return;
}
let current = Router.history.current;
let data = {
route: current.path,
route: current.path == "/" ? "/index" : current.path,
params: current.query
}
localStorage.setItem("_jiajia_childrenhost_redirect", JSON.stringify(data));
......@@ -152,6 +156,9 @@ export const store = {
if (dataStr) {
let data = JSON.parse(dataStr);
let path = data.route;
if (!path) {
return "/index";
}
let sep = "?";
if (data.params) {
for (let key in data.params) {
......@@ -161,7 +168,7 @@ export const store = {
}
return path;
}
return null;
return "/index";
},
delRedirectUrl() {
localStorage.removeItem("_jiajia_childrenhost_redirect");
......
......@@ -15,12 +15,17 @@
class="prize-thumb"
v-bind:style="{backgroundImage:'url(' + data.drawResult.thumb + ')'}"
></div>
<div class="prize-name">{{data.drawResult.prizeName}}</div>
<div
v-if="data.drawResult.prizeType == 'coupon'"
class="prize-sn"
>{{data.drawResult.prizeSn}}</div>
<div class="tip-container">
<span class="use-tip">奖品说明</span>
</div>
<div class="tip-container" v-if="data.drawResult.prizeType == 'integral'">
<span class="tip">积分可以在立乐家商城兑换礼品</span>
<span class="tip">积分可以在立乐家积分商场兑换礼品</span>
</div>
<div class="tip-container" v-if="data.drawResult.prizeType == 'coupon'">
<span class="tip">优惠券可以在立乐家商城购物当现金使用</span>
......@@ -113,7 +118,8 @@ export default {
return {
loading: false,
data: this.value,
submitForm: !this.value || !this.value.drawResult
submitForm:
!this.value || !this.value.drawResult
? {
drawCode: "",
contactName: "",
......@@ -355,4 +361,10 @@ input::-webkit-input-placeholder {
color: #4f9984;
font-size: 26px;
}
.prize-sn {
text-align: center;
font-size: 30px;
font-weight: 600;
}
</style>
......
......@@ -79,7 +79,7 @@ export default {
toWorksViewHandler(code) {
let link = location.origin + location.pathname;
link += "?worksCode=" + code;
as.setShare(link, null, null, null);
as.setShare(link, "", "", "");
this.$emit("worksDetail", { worksCode: code });
},
searchWorksHandler(action) {
......@@ -109,6 +109,7 @@ export default {
tempList = [];
list.push(tempList);
}
this._changeImageList(res.list[index]);
tempList.push(res.list[index]);
}
// console.log(list);
......@@ -124,8 +125,28 @@ export default {
Toast.clear(true);
});
},
_changeImageList(works) {
let worksList = works.worksList;
if (!worksList || worksList.length == 0) {
return;
}
if (worksList[0].worksType == "pic") {
return;
}
let changeIndex = -1;
for (let index = 0; index < worksList.length; index++) {
if (worksList[index].worksType == "pic") {
changeIndex = index;
break;
}
}
if (changeIndex > -1) {
let worksTmp = worksList.splice(changeIndex, 1);
worksList.unshift(worksTmp[0]);
works.worksList = worksList;
}
},
refreshMore() {
// console.log("refresh more");
this.listForm.page++;
this.searchWorksHandler();
}
......
......@@ -8,9 +8,16 @@
<div class="head-line"></div>
<div class="swipe">
<van-swipe :autoplay="5000">
<van-swipe-item v-for="(works, index) in formData.worksList" :key="index">
<van-swipe-item v-for="(item, index) in formData.worksList" :key="index">
<!-- <img :src="works.worksUrl" /> -->
<div class="img" v-bind:style="{backgroundImage:'url(' + works.worksUrl + ')'}"></div>
<div
v-if="item.worksType=='pic'"
class="img"
v-bind:style="{backgroundImage:'url(' + item.worksUrl + ')'}"
></div>
<video v-if="item.worksType=='video'" controls>
<source :src="item.worksUrl" type="video/mp4" />
</video>
</van-swipe-item>
</van-swipe>
</div>
......@@ -43,7 +50,6 @@
<div class="msg">{{formData.slogan}}</div>
</div>
<div class="text-container space top">
<div class="label">个人简介:</div>
<div class="msg">{{formData.profile}}</div>
......@@ -165,6 +171,11 @@ export default {
width: 630px;
background-size: cover;
}
video {
height: 451px;
width: 630px;
}
}
.space {
......
......@@ -11,8 +11,15 @@
<div class="self-content">
<div class="swipe">
<van-swipe :autoplay="5000">
<van-swipe-item v-for="(works, index) in formData.worksList" :key="index">
<div class="img" v-bind:style="{backgroundImage:'url(' + works.worksUrl + ')'}"></div>
<van-swipe-item v-for="(item, index) in formData.worksList" :key="index">
<div
v-if="item.worksType=='pic'"
class="img"
v-bind:style="{backgroundImage:'url(' + item.worksUrl + ')'}"
></div>
<video v-if="item.worksType=='video'" controls>
<source :src="item.worksUrl" type="video/mp4" />
</video>
</van-swipe-item>
</van-swipe>
</div>
......@@ -213,6 +220,11 @@ export default {
width: 265px;
background-size: cover;
}
video {
height: 190px;
width: 265px;
}
}
.space {
......
......@@ -116,21 +116,20 @@ export default {
}
},
initActivity() {
Toast.loading({
mask: true,
message: "加载中..."
});
httpGet({ url: urls.myWork }).then(res => {
this.init = true;
// Toast.loading({
// mask: true,
// message: "加载中..."
// });
// httpGet({ url: urls.myWork }).then(res => {
// this.init = true;
// this.formData = res.data || {};
// if (!res.data) {
// this.formEdit = true;
// } else {
// this.formEdit = false;
// }
// Toast.clear();
// });
this.formData = res.data || {};
if (!res.data) {
this.formEdit = true;
} else {
this.formEdit = false;
}
Toast.clear();
});
},
showRuleHandler() {
this.model.show = true;
......@@ -176,7 +175,7 @@ export default {
},
created() {
this.initUrlQuery();
// this.initActivity();
this.initActivity();
},
components: {
BottomTool,
......
......@@ -63,7 +63,7 @@
<div class="sys-btn-02" :class="{disabled : !autoRegister}" @click="submitFormHandler">确认提交</div>
<div
class="center base-margin auto-register-tips"
class="center base-margin-top auto-register-tips"
@click="acceptRegisterHandler"
v-if="formData.worksCode == '' || formData.worksCode == null "
>
......@@ -71,6 +71,15 @@
<div class="tips">自动注册为立白集团会员,立享会员权益,详见“更多福利”</div>
</div>
<div class="center base-margin auto-register-tips">
<div class="icon-register" :class="{activity : privacy}"></div>
<div class="tips">
我已阅读并同意
<u @click="showAgreementHandler">用户协议</u>
<u @click="showPrivacyHandler">隐私政策</u>
</div>
</div>
<van-popup position="bottom" :style="{ height: '40%' }" v-model="area.show">
<van-area
:area-list="areaList"
......@@ -108,6 +117,7 @@ export default {
data() {
return {
autoRegister: true,
privacy: true,
successModelVisiable: true,
area: {
show: false
......@@ -140,6 +150,12 @@ export default {
if (!this.autoRegister) {
}
},
showAgreementHandler() {
this.$emit("agreement");
},
showPrivacyHandler() {
this.$emit("privacy");
},
submitFormHandler() {
if (!this.autoRegister) {
return;
......@@ -197,9 +213,12 @@ export default {
.then(res => {
this.loading = false;
Toast.clear();
let data = {
isFirst : !this.formData.worksCode ? 1 : 0,
worksCode : res
};
this.formData.worksCode = res;
console.log("submit === =", res);
this.$emit("submit", res);
this.$emit("submit", data);
})
.catch(res => {
this.loading = false;
......@@ -360,8 +379,12 @@ export default {
background-size: 100%;
}
.base-margin {
.base-margin-top{
margin-top: 40px;
}
.base-margin {
margin-top: 20px;
margin-bottom: 80px;
}
......
<template>
<div>
<div class="img-container" v-for="(item,index) in fileList" :key="index">
<img :src="item.worksUrl" />
<img v-if="item.worksType=='pic'" :src="item.worksUrl" />
<video v-if="item.worksType=='video'" controls>
<source :src="item.worksUrl" type="video/mp4" />
</video>
<i class="van-icon van-icon-delete" @click="deleteImageHandler(index)"></i>
</div>
<van-uploader
ref="vanUploader"
class="uploader"
accept="image/*, audio/mp4, video/mp4"
:before-read="beforeUpload"
:after-read="uploadSumit"
v-if="!fileList || fileList.length < 3"
>+</van-uploader>
<image-clipper
ref="clipper"
v-if="imageData.show"
:img="imageData.data"
:clipper-img-width="750"
:clipper-img-height="537"
@ok="imageClipperHandler"
@cancel="imageData.show=false"
></image-clipper>
</div>
</template>
<script>
import { request } from "@/api/fetch-api.js";
import { request, httpPost } from "@/api/fetch-api.js";
import ImageClipper from "./ImageClipper";
import Vue from "vue";
import { Uploader } from "vant";
import { Toast } from "vant";
Vue.use(Uploader);
Vue.use(Toast);
/**
* 外层插件可通过监听:v-on:before-upload;v-on:after-upload两个事件监听上传结果
......@@ -32,27 +50,85 @@ export default {
data() {
return {
fileList: this.value,
uploadUrl: "https://api.k.wxpai.cn/bizproxy/kdapi/file/upload",
uploadFile: "https://api.k.wxpai.cn/bizproxy/kdapi/file/upload",
uploadUrl: "https://api.k.wxpai.cn/bizproxy/kdapi/file/uploadBase64",
imageData: {
show: false,
data: ""
}
};
},
methods: {
beforeUpload(params) {
// console.log(params);
// let worksType = params.type.indexOf("image") >= 0 ? "pic" : "video";
// if (
// worksType == "video" &&
// (!this.fileList || this.fileList.length == 0)
// ) {
// Toast("第一个作品必须上传图片!");
// return false;
// }
return true;
},
uploadSumit(params) {
console.log(params);
let worksType = params.file.type.indexOf("image") >= 0 ? "pic" : "video";
if (worksType == "pic") {
this.imageData.data = params.content;
this.imageData.show = true;
} else {
Toast.loading({
mask: true,
forbidClick: true,
message: "视频提交中..."
});
let data = {
path: "/pro/jiajiaChildrenHost/works",
file: params.file
};
request
.form(this.uploadUrl, data)
.form(this.uploadFile, data)
.then(result => {
Toast.clear();
let uploadResult = {
worksUrl: result.data.content,
worksType: params.file.type.indexOf("image") >= 0 ? "pic" : "video"
worksType: "video"
};
if (!this.fileList) {
this.fileList = [];
}
this.fileList.push(uploadResult);
this.$emit("input", this.fileList);
})
.catch(res => {});
}
},
imageClipperHandler(base64) {
let data = {
path: "/pro/jiajiaChildrenHost/works",
data: base64
};
Toast.loading({
mask: true,
forbidClick: true,
message: "图片提交中..."
});
httpPost({ url: this.uploadUrl, data: data })
.then(result => {
Toast.clear();
console.log(result);
let uploadResult = {
worksUrl: result,
worksType: "pic"
};
if (!this.fileList) {
this.fileList = [];
}
this.fileList.push(uploadResult);
console.log("submit image : ", this.fileList);
this.imageData.show = false;
this.$emit("input", this.fileList);
})
.catch(res => {});
......@@ -65,6 +141,9 @@ export default {
currentValue: function() {
return this.value;
}
},
components: {
ImageClipper
}
};
</script>
......@@ -99,6 +178,9 @@ export default {
img {
width: 100%;
}
video {
width: 100%;
}
.van-icon {
background-color: rgba($color: #000000, $alpha: 0.3);
......
......@@ -11,9 +11,16 @@
</div>
<div class="swipe">
<van-swipe :autoplay="5000">
<van-swipe-item v-for="(works, index) in formData.worksList" :key="index">
<van-swipe-item v-for="(item, index) in formData.worksList" :key="index">
<!-- <img :src="works.worksUrl" /> -->
<div class="img" v-bind:style="{backgroundImage:'url(' + works.worksUrl + ')'}"></div>
<div
v-if="item.worksType=='pic'"
class="img"
v-bind:style="{backgroundImage:'url(' + item.worksUrl + ')'}"
></div>
<video v-if="item.worksType=='video'" controls>
<source :src="item.worksUrl" type="video/mp4" />
</video>
</van-swipe-item>
</van-swipe>
</div>
......@@ -171,6 +178,11 @@ export default {
width: 630px;
background-size: cover;
}
video {
height: 451px;
width: 630px;
}
}
.space {
......
......@@ -9,7 +9,13 @@
v-on:praiseSuccess="showPraiseSuccessModel"
v-on:showShare="shareModelVisiable=true"
></ViewModel>
<EditModel v-model="formData" v-if="init && formEdit" v-on:submit="showSuccessModel"></EditModel>
<EditModel
v-model="formData"
v-if="init && formEdit"
v-on:submit="submitSuccessHandler"
v-on:agreement="showAgreementModel"
v-on:privacy="showPrivacyModel"
></EditModel>
<div class="bottom-line"></div>
......@@ -100,9 +106,22 @@ export default {
this.initShare();
});
},
showSuccessModel() {
submitSuccessHandler(data) {
if (data.isFirst) {
this.model.title = "温馨提示";
this.model.content = "报名已成功!获得1次抽奖机会";
this.model.index = "default";
this.model.btnShow = true;
this.model.btnText = "前往抽奖";
this.model.show = true;
let that = this;
this.model.confirmHandler = function() {
that.$router.push("/draw");
};
} else {
this.model.title = "温馨提示";
this.model.content = "报名已成功!";
this.model.content = "作品信息修改成功!";
this.model.index = "default";
this.model.btnShow = true;
this.model.btnText = "查看我的主页";
......@@ -112,11 +131,13 @@ export default {
this.model.confirmHandler = function() {
that.initActivity();
};
}
},
showPraiseSuccessModel() {
this.model.show = true;
this.model.title = "点赞成功";
this.model.content = "您已获得一次抽奖机会";
this.model.index = "default";
this.model.btnShow = true;
this.model.btnText = "前往抽奖";
......@@ -130,6 +151,14 @@ export default {
that.initActivity();
};
},
showAgreementModel() {
this.model.index = "agreement";
this.model.show = true;
},
showPrivacyModel() {
this.model.index = "privacy";
this.model.show = true;
},
initShare() {
let link = location.origin + location.pathname;
if (this.formData.worksCode) {
......
......@@ -73,7 +73,7 @@ const router = new Router({
router.beforeEach((to, from, next) => {
let link = location.origin + location.pathname;
as.setShare(link, null, null, null);
as.setShare(link, "", "", "");
const title = to.meta && to.meta.title;
if (title) {
document.title = title;
......
......@@ -38,8 +38,8 @@ module.exports = {
// 它支持webPack-dev-server的所有选项
devServer: {
host: "192.168.0.101",
// host: "localhost",
// host: "192.168.0.101",
host: "localhost",
port: 9001, // 端口号
https: false, // https:{type:Boolean}
open: true, //配置自动启动浏览器
......