基本功能
Showing
14 changed files
with
278 additions
and
42 deletions
... | @@ -16,6 +16,11 @@ | ... | @@ -16,6 +16,11 @@ |
16 | <strong>We're sorry but vue-cli3-framework doesn't work properly without JavaScript enabled. Please enable it to | 16 | <strong>We're sorry but vue-cli3-framework doesn't work properly without JavaScript enabled. Please enable it to |
17 | continue.</strong> | 17 | continue.</strong> |
18 | </noscript> | 18 | </noscript> |
19 | |||
20 | <script src="./js/global-params.js"></script> | ||
21 | <script src="./js/jweixin-1.1.0.js"></script> | ||
22 | <script src="./js/hdp-4.4.0.min.js"></script> | ||
23 | <script src="./js/as.js"></script> | ||
19 | <div id="app"></div> | 24 | <div id="app"></div> |
20 | <!-- built files will be auto injected --> | 25 | <!-- built files will be auto injected --> |
21 | </body> | 26 | </body> | ... | ... |
public/js/as.js
0 → 100644
This diff is collapsed.
Click to expand it.
public/js/global-params.js
0 → 100644
1 | let global_gzh_name = "袋鼠妈妈学堂"; | ||
2 | let global_gzh_wxAppId = "wxaf7d9b7414c6df11"; | ||
3 | let global_register_redirect = false; | ||
4 | |||
5 | // let global_gzh_name = "安敏健行"; | ||
6 | // let global_gzh_wxAppId = "wx3a4821f58cc1ded7"; | ||
7 | // 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 | ... | \ No newline at end of file |
public/js/hdp-4.4.0.min.js
0 → 100644
This diff could not be displayed because it is too large.
public/js/jweixin-1.1.0.js
0 → 100644
This diff is collapsed.
Click to expand it.
... | @@ -6,10 +6,6 @@ import Router from '../router' | ... | @@ -6,10 +6,6 @@ import Router from '../router' |
6 | // Toast | 6 | // Toast |
7 | // } from 'vant'; | 7 | // } from 'vant'; |
8 | 8 | ||
9 | function Toast(msg) { | ||
10 | console.log("msg:", msg); | ||
11 | } | ||
12 | |||
13 | // axios的默认url | 9 | // axios的默认url |
14 | // axios.defaults.baseURL = "" | 10 | // axios.defaults.baseURL = "" |
15 | 11 | ||
... | @@ -54,7 +50,7 @@ axios.interceptors.response.use( | ... | @@ -54,7 +50,7 @@ axios.interceptors.response.use( |
54 | store.removeSession(); | 50 | store.removeSession(); |
55 | store.saveRedirectUrl(); | 51 | store.saveRedirectUrl(); |
56 | Router.push("/"); | 52 | Router.push("/"); |
57 | } | 53 | } |
58 | return Promise.reject(response); | 54 | return Promise.reject(response); |
59 | } | 55 | } |
60 | } else { | 56 | } else { |
... | @@ -192,21 +188,21 @@ export const formdata = params => { | ... | @@ -192,21 +188,21 @@ export const formdata = params => { |
192 | 188 | ||
193 | export const request = { | 189 | export const request = { |
194 | post(url, data) { | 190 | post(url, data) { |
195 | return axios.post(`${requestDomain}${url}`, data); | 191 | return axios.post(`${base}${url}`, data); |
196 | }, | 192 | }, |
197 | get(url, data) { | 193 | get(url, data) { |
198 | return axios.get(`${requestDomain}${url}`, { params: data }); | 194 | return axios.get(`${base}${url}`, { params: data }); |
199 | }, | 195 | }, |
200 | form(url, params) { | 196 | form(url, params) { |
201 | let formData = new FormData(); //使用formData对象 | 197 | let formData = new FormData(); //使用formData对象 |
202 | for (let key in params) { | 198 | for (let key in params) { |
203 | formData.append(key, params[key]); | 199 | formData.append(key, params[key]); |
204 | } | 200 | } |
205 | let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${requestDomain}${url}`; | 201 | let requestUrl = url.indexOf("://") >= 0 ? `${url}` : `${base}${url}`; |
206 | return axios.post(requestUrl, formData, formDataHeaders) | 202 | return axios.post(requestUrl, formData, formDataHeaders) |
207 | }, | 203 | }, |
208 | build(url, params){ | 204 | build(url, params){ |
209 | let fullUrl = `${requestDomain}${url}`; | 205 | let fullUrl = `${base}${url}`; |
210 | let split = ""; | 206 | let split = ""; |
211 | for(let key in params){ | 207 | for(let key in params){ |
212 | if(split){ | 208 | if(split){ | ... | ... |
src/assets/imgs/model-bottom.png
0 → 100644
79.8 KB
src/assets/imgs/model-close.png
0 → 100644
1.59 KB
src/assets/imgs/model-share-tip.png
0 → 100644
51 KB
1 | <template> | 1 | <template> |
2 | <van-overlay :show="show" > | 2 | <van-popup v-model="data.show"> |
3 | 3 | <div class="model"> | |
4 | </van-overlay> | 4 | <div class="model-close" @click="modelCloseHandler"></div> |
5 | <div class="model-content"> | ||
6 | <div class="model-head-line"></div> | ||
7 | <div class="model-title">{{data.title}}</div> | ||
8 | |||
9 | <div class="successModel" v-if="data.index == 'default'"> | ||
10 | <div class="model-data">{{data.content}}</div> | ||
11 | <div v-if="data.btnShow" class="sys-btn-02" @click="modelBtnClickHandler">{{data.btnText}}</div> | ||
12 | <div | ||
13 | v-if="data.labelBtnShow" | ||
14 | class="label-btn" | ||
15 | @click="labelBtnClickHandler" | ||
16 | >{{data.labelBtnText}}</div> | ||
17 | <div class="model-bottom-line"></div> | ||
18 | </div> | ||
19 | </div> | ||
20 | </div> | ||
21 | </van-popup> | ||
5 | </template> | 22 | </template> |
6 | 23 | ||
7 | <script> | 24 | <script> |
8 | import Vue from "vue"; | 25 | import Vue from "vue"; |
9 | import { Overlay } from "vant"; | 26 | import { Popup } from "vant"; |
10 | Vue.use(Overlay); | 27 | Vue.use(Popup); |
11 | 28 | ||
12 | export default { | 29 | export default { |
13 | props: ["value"], | 30 | props: ["value"], |
14 | data() { | 31 | data() { |
15 | return { | 32 | return { |
16 | model: this.value, | 33 | data: this.value |
17 | show: false | ||
18 | }; | 34 | }; |
19 | }, | 35 | }, |
20 | methods: {}, | 36 | methods: { |
21 | created() {} | 37 | modelCloseHandler() { |
38 | this.$emit("close"); | ||
39 | this.data.show = false; | ||
40 | }, | ||
41 | modelBtnClickHandler() { | ||
42 | this.data.show = false; | ||
43 | typeof this.data.confirmHandler == "function" && | ||
44 | this.data.confirmHandler(); | ||
45 | }, | ||
46 | labelBtnClickHandler() { | ||
47 | this.data.show = false; | ||
48 | typeof this.data.labelBtnHandler == "function" && | ||
49 | this.data.labelBtnHandler(); | ||
50 | } | ||
51 | }, | ||
52 | created() { | ||
53 | this.data = this.data | ||
54 | ? this.data | ||
55 | : { | ||
56 | title: "", | ||
57 | description: "", | ||
58 | show: false, | ||
59 | index: "default", | ||
60 | btnShow: false, | ||
61 | btnText: "", | ||
62 | confirmHandler: null, | ||
63 | labelBtnShow: false, | ||
64 | labelBtnText: "", | ||
65 | labelBtnHandler: null | ||
66 | }; | ||
67 | } | ||
22 | }; | 68 | }; |
23 | </script> | 69 | </script> |
24 | 70 | ||
25 | <style lang="less" scoped> | 71 | <style lang="less" scoped> |
72 | .van-popup { | ||
73 | background-color: transparent; | ||
74 | top: 40%; | ||
75 | } | ||
76 | .model { | ||
77 | display: flex; | ||
78 | width: 480px; | ||
79 | min-height: 576px; | ||
80 | flex-direction: column; | ||
81 | align-items: flex-end; | ||
82 | } | ||
83 | |||
84 | .model-head-line { | ||
85 | height: 50px; | ||
86 | background-color: transparent; | ||
87 | } | ||
88 | .model-bottom-line { | ||
89 | height: 50px; | ||
90 | background-color: transparent; | ||
91 | } | ||
92 | |||
93 | .model-close { | ||
94 | width: 64px; | ||
95 | height: 116px; | ||
96 | background: url(../../assets/imgs/model-close.png); | ||
97 | background-size: 100%; | ||
98 | } | ||
99 | |||
100 | .model-content { | ||
101 | width: 480px; | ||
102 | min-height: 460px; | ||
103 | height: auto; | ||
104 | background: url(../../assets/imgs/model-bottom.png) no-repeat; | ||
105 | background-size: 100% auto; | ||
106 | background-position: bottom; | ||
107 | border-radius: 30px; | ||
108 | background-color: #fff; | ||
109 | } | ||
110 | |||
111 | .model-title { | ||
112 | font-size: 45px; | ||
113 | font-weight: bold; | ||
114 | } | ||
115 | |||
116 | .model-data { | ||
117 | font-size: 30px; | ||
118 | margin: 50px auto 70px auto; | ||
119 | width: 400px; | ||
120 | text-align: center; | ||
121 | } | ||
122 | |||
123 | .sys-btn-02 { | ||
124 | width: 300px; | ||
125 | font-size: 30px; | ||
126 | line-height: 80px; | ||
127 | } | ||
128 | |||
129 | .label-btn { | ||
130 | font-size: 26px; | ||
131 | text-align: center; | ||
132 | } | ||
26 | </style> | 133 | </style> | ... | ... |
... | @@ -56,11 +56,15 @@ export default { | ... | @@ -56,11 +56,15 @@ export default { |
56 | }, | 56 | }, |
57 | login() { | 57 | login() { |
58 | httpPost({ url: urls.login, data: this.loginParam }).then(res => { | 58 | httpPost({ url: urls.login, data: this.loginParam }).then(res => { |
59 | store.putSession(res.sessionId); | 59 | if (!res.sessionId) { |
60 | let path = store.getRedirectUrl(); | 60 | store.toWxLogin(); |
61 | path = !path ? "/index" : path; | 61 | } else { |
62 | store.delRedirectUrl(); | 62 | store.putSession(res.sessionId); |
63 | this.$router.push(path); | 63 | let path = store.getRedirectUrl(); |
64 | path = !path ? "/index" : path; | ||
65 | store.delRedirectUrl(); | ||
66 | this.$router.push(path); | ||
67 | } | ||
64 | }); | 68 | }); |
65 | } | 69 | } |
66 | }, | 70 | }, | ... | ... |
... | @@ -185,6 +185,8 @@ export default { | ... | @@ -185,6 +185,8 @@ export default { |
185 | }); | 185 | }); |
186 | httpPost({ url: urls.submit, data: this.formData }).then(res => { | 186 | httpPost({ url: urls.submit, data: this.formData }).then(res => { |
187 | Toast.clear(); | 187 | Toast.clear(); |
188 | this.formData.worksCode = res; | ||
189 | console.log("submit === =", res); | ||
188 | this.$emit("submit", res); | 190 | this.$emit("submit", res); |
189 | }); | 191 | }); |
190 | } | 192 | } |
... | @@ -314,7 +316,6 @@ export default { | ... | @@ -314,7 +316,6 @@ export default { |
314 | color: #4f9984; | 316 | color: #4f9984; |
315 | font-size: 18px; | 317 | font-size: 18px; |
316 | } | 318 | } |
317 | |||
318 | } | 319 | } |
319 | 320 | ||
320 | .view-btn-group { | 321 | .view-btn-group { | ... | ... |
... | @@ -57,15 +57,17 @@ | ... | @@ -57,15 +57,17 @@ |
57 | </template> | 57 | </template> |
58 | 58 | ||
59 | <script> | 59 | <script> |
60 | let urls = {}; | 60 | let urls = { |
61 | praise: "/jiajiaCHApi/app/works/praise" | ||
62 | }; | ||
61 | 63 | ||
62 | import { httpGet, httpPost } from "@/api/fetch-api"; | 64 | import { request } from "@/api/fetch-api"; |
63 | 65 | ||
64 | import Vue from "vue"; | 66 | import Vue from "vue"; |
65 | import { Toast } from "vant"; | 67 | import { Toast } from "vant"; |
66 | import { Popup } from "vant"; | 68 | import { Swipe, SwipeItem } from "vant"; |
67 | 69 | ||
68 | Vue.use(Popup); | 70 | Vue.use(Swipe).use(SwipeItem); |
69 | Vue.use(Toast); | 71 | Vue.use(Toast); |
70 | 72 | ||
71 | export default { | 73 | export default { |
... | @@ -81,9 +83,28 @@ export default { | ... | @@ -81,9 +83,28 @@ export default { |
81 | }, | 83 | }, |
82 | selfPraiseHandler() { | 84 | selfPraiseHandler() { |
83 | // 自己点赞 | 85 | // 自己点赞 |
86 | let data = { | ||
87 | worksCode: this.formData.worksCode | ||
88 | }; | ||
89 | Toast.loading({ | ||
90 | mask: true, | ||
91 | message: "数据提交..." | ||
92 | }); | ||
93 | request | ||
94 | .post(urls.praise, data) | ||
95 | .then(res => { | ||
96 | Toast.clear(); | ||
97 | this.$emit("praiseSuccess") | ||
98 | }) | ||
99 | .catch(res => { | ||
100 | let msg = res.data.errMsg; | ||
101 | Toast(msg); | ||
102 | }); | ||
84 | }, | 103 | }, |
85 | showShareHandler() { | 104 | showShareHandler() { |
86 | // 出现分享层 | 105 | // 出现分享层 |
106 | this.$emit("showShare") | ||
107 | console.log("show share") | ||
87 | } | 108 | } |
88 | }, | 109 | }, |
89 | created() { | 110 | created() { | ... | ... |
... | @@ -2,16 +2,26 @@ | ... | @@ -2,16 +2,26 @@ |
2 | <div class="home"> | 2 | <div class="home"> |
3 | <div class="head-leap"></div> | 3 | <div class="head-leap"></div> |
4 | 4 | ||
5 | <ViewModel v-model="formData" v-if="init && !formEdit" v-on:edit="formEdit=true"></ViewModel> | 5 | <ViewModel |
6 | <EditModel v-model="formData" v-if="init && formEdit" v-on:submit="initActivity"></EditModel> | 6 | v-model="formData" |
7 | v-if="init && !formEdit" | ||
8 | v-on:edit="formEdit=true" | ||
9 | v-on:praiseSuccess="showPraiseSuccessModel" | ||
10 | v-on:showShare="shareModelVisiable=true" | ||
11 | ></ViewModel> | ||
12 | <EditModel v-model="formData" v-if="init && formEdit" v-on:submit="showSuccessModel"></EditModel> | ||
7 | 13 | ||
8 | <div class="bottom-line"></div> | 14 | <div class="bottom-line"></div> |
9 | 15 | ||
10 | <bottom-tool v-model="activityIndex"></bottom-tool> | 16 | <bottom-tool v-model="activityIndex"></bottom-tool> |
11 | 17 | <biz-model v-model="model"></biz-model> | |
12 | <!-- <van-popup class="messagePopue" v-model="successModelVisiable" :close-on-click-overlay="false"> | 18 | <!-- 分享蒙层 --> |
13 | <div></div> | 19 | <div class="shareModel" v-if="shareModelVisiable" @click="shareModelVisiable = false"> |
14 | </van-popup>--> | 20 | <div class="shareModelContainer"> |
21 | <div class="shareModelMask"></div> | ||
22 | <div class="shareIcon"></div> | ||
23 | </div> | ||
24 | </div> | ||
15 | </div> | 25 | </div> |
16 | </template> | 26 | </template> |
17 | 27 | ||
... | @@ -22,6 +32,7 @@ let urls = { | ... | @@ -22,6 +32,7 @@ let urls = { |
22 | }; | 32 | }; |
23 | 33 | ||
24 | import BottomTool from "@/components/bottom-tools/bottom-tools"; | 34 | import BottomTool from "@/components/bottom-tools/bottom-tools"; |
35 | import BizModel from "@/components/biz-model/biz-model"; | ||
25 | import EditModel from "./components/EditModel"; | 36 | import EditModel from "./components/EditModel"; |
26 | import ViewModel from "./components/ViewModel"; | 37 | import ViewModel from "./components/ViewModel"; |
27 | 38 | ||
... | @@ -30,14 +41,8 @@ import AreaList from "@/api/area"; | ... | @@ -30,14 +41,8 @@ import AreaList from "@/api/area"; |
30 | 41 | ||
31 | import Vue from "vue"; | 42 | import Vue from "vue"; |
32 | import { Toast } from "vant"; | 43 | import { Toast } from "vant"; |
33 | import { Area } from "vant"; | ||
34 | import { Popup } from "vant"; | ||
35 | import { Swipe, SwipeItem } from "vant"; | ||
36 | 44 | ||
37 | Vue.use(Popup); | ||
38 | Vue.use(Area); | ||
39 | Vue.use(Toast); | 45 | Vue.use(Toast); |
40 | Vue.use(Swipe).use(SwipeItem); | ||
41 | 46 | ||
42 | export default { | 47 | export default { |
43 | name: "home", | 48 | name: "home", |
... | @@ -47,8 +52,9 @@ export default { | ... | @@ -47,8 +52,9 @@ export default { |
47 | formEdit: false, | 52 | formEdit: false, |
48 | init: false, | 53 | init: false, |
49 | isMy: 1, | 54 | isMy: 1, |
50 | successModelVisiable: true, | 55 | shareModelVisiable: false, |
51 | formData: { | 56 | formData: { |
57 | worksCode: "", | ||
52 | name: "", | 58 | name: "", |
53 | province: "", | 59 | province: "", |
54 | provinceCode: "", | 60 | provinceCode: "", |
... | @@ -59,6 +65,18 @@ export default { | ... | @@ -59,6 +65,18 @@ export default { |
59 | parentName: "", | 65 | parentName: "", |
60 | parentMobile: "", | 66 | parentMobile: "", |
61 | worksList: [] | 67 | worksList: [] |
68 | }, | ||
69 | model: { | ||
70 | show: false, | ||
71 | title: "", | ||
72 | content: "", | ||
73 | index: "default", | ||
74 | btnShow: false, | ||
75 | btnText: "", | ||
76 | confirmHandler: null, | ||
77 | labelBtnShow: false, | ||
78 | labelBtnText: "", | ||
79 | labelBtnHandler: null | ||
62 | } | 80 | } |
63 | }; | 81 | }; |
64 | }, | 82 | }, |
... | @@ -78,13 +96,57 @@ export default { | ... | @@ -78,13 +96,57 @@ export default { |
78 | } else { | 96 | } else { |
79 | this.formEdit = false; | 97 | this.formEdit = false; |
80 | } | 98 | } |
99 | this.initShare(); | ||
81 | }); | 100 | }); |
101 | }, | ||
102 | showSuccessModel() { | ||
103 | this.model.title = "温馨提示"; | ||
104 | this.model.content = "报名已成功!"; | ||
105 | this.model.index = "default"; | ||
106 | this.model.btnShow = true; | ||
107 | this.model.btnText = "查看我的主页"; | ||
108 | this.model.show = true; | ||
109 | |||
110 | let that = this; | ||
111 | this.model.confirmHandler = function() { | ||
112 | that.initActivity(); | ||
113 | }; | ||
114 | }, | ||
115 | showPraiseSuccessModel() { | ||
116 | this.model.show = true; | ||
117 | this.model.title = "点赞成功"; | ||
118 | this.model.content = "您已获得一次抽奖机会"; | ||
119 | this.model.btnShow = true; | ||
120 | this.model.btnText = "前往抽奖"; | ||
121 | |||
122 | let that = this; | ||
123 | this.model.confirmHandler = function() { | ||
124 | that.$router.push("/draw"); | ||
125 | }; | ||
126 | this.model.labelBtnShow = true; | ||
127 | this.model.labelBtnText = "查看个人主页"; | ||
128 | this.model.labelBtnHandler = function() { | ||
129 | that.initActivity(); | ||
130 | }; | ||
131 | }, | ||
132 | initShare() { | ||
133 | let link = location.origin + location.pathname; | ||
134 | if (this.formData.worksCode) { | ||
135 | link += "?worksCode=" + this.formData.worksCode; | ||
136 | } | ||
137 | let desc = this.formData.profile || null; | ||
138 | let imgurl = | ||
139 | this.formData.worksList.length > 0 | ||
140 | ? this.formData.worksList[0].worksUrl | ||
141 | : null; | ||
142 | as.setShare(link, null, desc, imgurl); | ||
82 | } | 143 | } |
83 | }, | 144 | }, |
84 | components: { | 145 | components: { |
85 | BottomTool, | 146 | BottomTool, |
86 | EditModel, | 147 | EditModel, |
87 | ViewModel | 148 | ViewModel, |
149 | BizModel | ||
88 | }, | 150 | }, |
89 | created() { | 151 | created() { |
90 | this.initActivity(); | 152 | this.initActivity(); |
... | @@ -113,4 +175,37 @@ export default { | ... | @@ -113,4 +175,37 @@ export default { |
113 | height: 250px; | 175 | height: 250px; |
114 | background-color: transparent; | 176 | background-color: transparent; |
115 | } | 177 | } |
178 | |||
179 | .shareModel { | ||
180 | position: fixed; | ||
181 | height: 100%; | ||
182 | width: 100%; | ||
183 | left: 0px; | ||
184 | top: 0px; | ||
185 | z-index: 9999; | ||
186 | } | ||
187 | |||
188 | .shareModelContainer { | ||
189 | position: relative; | ||
190 | height: 100%; | ||
191 | width: 100%; | ||
192 | } | ||
193 | |||
194 | .shareModelMask { | ||
195 | position: absolute; | ||
196 | left: 0px; | ||
197 | top: 0px; | ||
198 | width: 100%; | ||
199 | height: 100%; | ||
200 | background-color: rgba(0, 0, 0, 0.7); | ||
201 | } | ||
202 | .shareIcon { | ||
203 | position: absolute; | ||
204 | top: 0px; | ||
205 | right: 30px; | ||
206 | width: 425px; | ||
207 | height: 220px; | ||
208 | background: url(../../assets/imgs/model-share-tip.png) no-repeat; | ||
209 | background-size: 100%; | ||
210 | } | ||
116 | </style> | 211 | </style> | ... | ... |
-
Please register or sign in to post a comment