| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <template>
- <view class="content">
- <image class="logo" src="/static/logo.png"></image>
- <view class="text-area">
- <text class="title">{{title}}</text>
- </view>
- <view>
- <input id="myInput" type="text" v-model="funName" placeholder="请输入方法名" />
- <button id="btnCheck" @click="funCheck">验证</button>
- </view>
- <button @click="btnTestClick">toTest</button>
- <view id="iframeView">
- <iframe :src="iframeSRC" id="myIframe">该浏览器不支持 iframe 标签</iframe>
- </view>
- <view id="routerTest">
- <view>
- <router-link to="../test/test2">test2</router-link>
- </view>
- <view>
- <router-view></router-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- components: {
- },
- data() {
- return {
- title: 'Hello',
- funName: '',
- myHost: 'http://39.105.166.141:8085',
- webviewStyles: {
- progress: {
- color: '#FF3333'
- }
- },
- iframeSRC: '#pages/test/test2'
- }
- },
- onLoad() {
- // uni.redirectTo({
- // url:"../test/StartLearning"
- // })
- },
- mounted() {
- window.addEventListener('message', event => {
- let data = event.data;
- console.log(data);
- if (data.cmd === 'jump') {
- console.log("-----------jump111");
- // this.iframeSRC = '#pages/test/test3';
- // this.iframeSRC = '#pages/index/index';
- this.iframeSRC = 'https://www.baidu.com';
- } else if (data.cmd === 'jump2') {
- console.log("-----------jump222");
- this.iframeSRC = '#pages/test/test2';
- // this.iframeSRC = 'https://www.baidu.com';
- } else {
- console.log("***********notjump");
- }
- })
- },
- methods: {
- funCheck() {
- console.log(this.funName)
- this.testPOST();
- },
- testPOST() {
- let url = "http://39.105.166.141:8085/user/loginin";
- uni.request({
- header: {
- // 'Content-Type': 'application/x-www-form-urlencoded'
- 'Content-Type': 'application/json'
- },
- url: url,
- method: 'POST',
- data: {
- "IlabAccount": "teststudent01",
- "Password": "qgsTest002"
- },
- dataType: 'json',
- success: (res) => {
- // var result = JSON.parse(res);
- console.log("success***", res)
- },
- fail: (res) => {
- console.log("fail***", res)
- }
- });
- },
- btnTestClick() {
- uni.navigateTo({
- url: '/pages/test/test',
- });
- },
- }
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .logo {
- height: 200rpx;
- width: 200rpx;
- margin-top: 200rpx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50rpx;
- }
- .text-area {
- display: flex;
- justify-content: center;
- }
- .title {
- font-size: 36rpx;
- color: #8f8f94;
- }
- #myInput {
- border: #007AFF 1rpx solid;
- }
- #iframeView {
- margin-top: 20rpx;
- }
- #myIframe {
- border: none;
- }
- #routerTest {
- width: 500rpx;
- height: 200rpx;
- border: #aa00ff 1rpx solid;
- flex-direction: row;
- }
- </style>
|