diff --git a/.env.prod b/.env.prod index 1725c6c..6fed58f 100644 --- a/.env.prod +++ b/.env.prod @@ -1,6 +1,17 @@ +// 生产环境 NODE_ENV = 'production' + +// 入口地址 VUE_APP_BASE_URL = 'https://cdn.xglpa.com/tcubic/pdf/' + +// 业务接口 VUE_APP_API = 'https://cdn.xglpa.com/tcubic/pdf/' + +// CDN地址 VUE_APP_CDN = 'https://cdn.xglpa.com/tcubic/pdf/' -VUE_APP_APPID = '1aeedce2a31340e591a5d64080d6105b' -VUE_APP_ACTIVITYID = '20220510563146' \ No newline at end of file + +// XGL授权接口 +VUE_APP_XGL_DOMAIN = https://wealth.newone.com.cn + +// 招商证券授权接口 +VUE_APP_ZS_DOMAIN = https://wealth.newone.com.cn \ No newline at end of file diff --git a/.env.test b/.env.test index 7993c1d..3c811a2 100644 --- a/.env.test +++ b/.env.test @@ -1,6 +1,17 @@ +// 测试环境 NODE_ENV = 'test' -VUE_APP_BASE_URL = 'https://hd.xglpa.com/zszq-celebration/activity/' + +// 入口地址 +VUE_APP_BASE_URL = 'https://test.szxgl.cn/zszq-celebration/activity/' + +// 业务接口 VUE_APP_API = 'https://test.szxgl.cn/zszq-celebration' + +// CDN地址 VUE_APP_CDN = 'https://test.szxgl.cn/zszq-celebration/activity/' -VUE_APP_APPID = '1aeedce2a31340e591a5d64080d6105b' -VUE_APP_ACTIVITYID = '20220510563146' \ No newline at end of file + +// XGL授权接口 +VUE_APP_XGL_DOMAIN = 'https://test.szxgl.cn/zszq-celebration/zsApi/xfhdAuthorize' + +// 招商证券授权接口 +VUE_APP_ZS_DOMAIN = 'https://wealth.newone.com.cn' \ No newline at end of file diff --git a/deploy.config.js b/deploy.config.js index 8e679bc..aac53ed 100644 --- a/deploy.config.js +++ b/deploy.config.js @@ -10,7 +10,7 @@ module.exports = { host: '39.108.110.167', // 服务器地址 port: 22, // 服务器端口号 username: 'root', // 服务器登录用户名 - password: 'XfhdTest123', // 服务器登录密码 + password: 'xFhD@Test123', // 服务器登录密码 distPath: 'dist', // 本地打包生成目录 webDir: "/mnt/services/tomcat-8090-test/webapps/zszq-celebration/activity", // test替换自己实际项目目录 服务器部署路径(不可为空或'/') isRemoveRemoteFile: true // 是否删除远程文件(默认true) diff --git a/dist.zip b/dist.zip deleted file mode 100644 index acf5eff..0000000 Binary files a/dist.zip and /dev/null differ diff --git a/src/api/authorize-api.js b/src/api/authorize-api.js new file mode 100644 index 0000000..5558fc5 --- /dev/null +++ b/src/api/authorize-api.js @@ -0,0 +1,127 @@ +import axios from 'axios' +import qs from 'qs' + +const domain_zs = process.env.VUE_APP_ZS_AUTHORIZE_DOMAIN; +const domain_xgl = process.env.VUE_APP_XGL_AUTHORIZE_DOMAIN; +/////////////////////////// + +// get || post 请求方法封装 +function get(url, params = {}) { + return new Promise((resolve, reject) => { + axios + .get(url, { + params: params + }) + .then(res => { + resolve(res.data) + }) + .catch(err => { + reject(err) + }) + }) + // 或者return axios.get(); +} +/** + * post方法,对应post请求 + * @param {String} url [请求的url地址] + * @param {Object} params [请求时携带的参数] + */ +function post(url, params) { + return new Promise((resolve, reject) => { + axios + .post(url, qs.stringify(params)) + .then(res => { + resolve(res.data) + }) + .catch(err => { + reject(err) + }) + }) + // 或者return axios.post(); +} + + + +// 1.公众号网页授权 +// 请求方法:get请求 +// 请求链接:/wxauth/official/account/authorize +// 请求参数: +// redirectUrl 请求链接 +// scope 授权类型:0用户授权,1静默授权 +// 返回值:无 +// 备注:回调页面URL后可能携带参数:token、userid、forceauth。 +// 先取token,如有,表示登录成功(登录成功userid会有值), +// 如token无值,取forceauth,为1时表示需要进行0-用户授权跳转。 +function get_authorize() { + let href = window.location.href + let h_idx = window.location.href.indexOf('#') + let out_href = href.slice(0, h_idx) + + window.location.href = `${domain_xgl}/wxauth/official/account/authorize?redirectUrl=${out_href}&scope=${1}"` +} + + +// 2.获取微信公众号jssdk +// 请求方法:get请求 +// 请求链接:/wxauth/official/account/jssdk/get +// 请求参数: +// url 请求链接 +function get_jssdk(url, params) { + // Bus.debug && (params.openid = Bus.testOpenId) + // return readyGet(domain_zs + "/wxauth/official/account/jssdk/get", params) + return new Promise((resolve, reject) => { + axios + .get(url, { + params: params + }) + .then(res => { + resolve(res.data) + }) + .catch(err => { + reject(err) + }) + }) + +} + +function getOpenId(code) { + return new Promise((reslove, reject) => { + utils.rebuildAjax.post(process.env.VUE_APP_BASE_URL + 'cott-acts/api/wx/oauthInfo', { + code + }).then((res) => { + if (res.ret == 0) { + Vue.prototype.$userInfo = { + openid: res.data.openid, + nickname: res.data.nickname, + headimgurl: res.data.headimgurl + }; + reslove(); + } else { + location.replace(window.location.protocol + '//' + window.location.host + window.location.pathname) + } + }) + }) + +} + +// 获取wx 授权 code +function getCode(activityId, gameId, rankType) { + let redirect_uri = `${window.location.protocol}//${window.location.host + window.location.pathname}?activityId=${activityId}&gameId=${gameId}&rankType=${rankType}`; + utils.rebuildAjax.post(process.env.VUE_APP_BASE_URL + 'cott-acts/api/wx/getOAuthUrl', { + redirect_uri + }).then((res) => { + if (res.ret == 0) { + console.log(res.url) + location.replace(res.url); + } + }) +} + + + + + +export { + get_authorize, + get_jssdk, +} diff --git a/src/components/Index.vue b/src/components/Index.vue index 5a75699..9479a39 100644 --- a/src/components/Index.vue +++ b/src/components/Index.vue @@ -1,63 +1,144 @@ \ No newline at end of file diff --git a/src/components/MyPrize.vue b/src/components/MyPrize.vue new file mode 100644 index 0000000..d67903e --- /dev/null +++ b/src/components/MyPrize.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/src/page/Home/Home.vue b/src/page/Home/Home.vue index 16a9f1d..e01b62c 100644 --- a/src/page/Home/Home.vue +++ b/src/page/Home/Home.vue @@ -1,6 +1,9 @@ @@ -18,17 +21,14 @@ import Index from "@/components/Index" onBeforeMount(() => { }); // 页面挂载 -onMounted(() => { +onMounted(() => { }); + + +// 来自首页的事件 +const indexPage = (actions) => { + console.log("来自index组件:", actions); +} - // 微信分享 - const optionShare = { - title: '2022中国中产女性财富管理及幸福指数报告', // 分享标题 - desc: ' ', // 分享描述 - link: process.env.VUE_APP_BASE_URL + 'index.html', // 分享链接 - imgUrl: process.env.VUE_APP_CDN + 'share.jpg', // 分享图标 - } - wxShare(optionShare) -});