12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <template>
- <view>
- <block v-if="access_token">
- <web-view :src="url + urlPath + '?queryList=' + queryList + '&token=' + access_token" @message="handleGetMessage"></web-view>
- </block>
- </view>
- </template>
- <script>
- import { User } from "@/config/api.js";
- export default {
- data() {
- return {
- //url:"http://192.168.2.22:3000/cygx_pc/",//开发
- // url: "https://cygxpctest.hzinsights.com/cygx_pc", //测试
- url: 'https://cygxpc.hzinsights.com/cygx_pc', //生产
- urlPath: "",
- queryList: "",
- urlShare: "",
- titleShare: "",
- access_token: "",
- };
- },
- methods: {
- getToken() {
- uni.login({
- success: (result) => {
- User.wechatLog({
- Code: result.code,
- }).then((res) => {
- try {
- let token = res.Data.Authorization;
- this.$db.set("access_token", token);
- this.access_token = token;
- } catch (e) {}
- });
- },
- });
- },
- handleGetMessage(e) {
- const data = e.detail.data[e.detail.data.length - 1];
- this.urlShare = data.url;
- this.titleShare = data.title;
- },
- initLoad(optios) {
- let urlType = ["index", "reportForm", "activity", "themeActivity", "activityDetail", "reportDetail", "IndustryReport", "reportSecretDetail", "roadEssence"];
- if (JSON.stringify(optios) !== "{}" && optios.path) {
- let pathUrl = optios.path.split("/")[2];
- this.urlPath = urlType.includes(pathUrl) ? '/' + pathUrl : "/index";
- this.queryList = optios.query || "";
- }
- },
- },
- onLoad(optios) {
- this.getToken();
- this.initLoad(optios);
- },
- onShareAppMessage(op) {
- return {
- title: this.titleShare,
- path: this.urlShare,
- };
- },
- };
- </script>
- <style></style>
|