Browse Source

适配小程序

dufeng 5 months ago
parent
commit
262b056e73
4 changed files with 76 additions and 15 deletions
  1. 2 0
      main.js
  2. 50 0
      package-lock.json
  3. 23 14
      pages/workflowTask/index.vue
  4. 1 1
      pages/workflowTask/webviewPages/webview.js

+ 2 - 0
main.js

@@ -6,6 +6,8 @@ import {setTip} from '@/utils/common.js'
 import color from '@/utils/color.js'
 import  './utils/webview.js'
 
+import VConsole from 'vconsole';
+const vConsole = new VConsole();
 Vue.config.productionTip = false
 App.mpType = 'app'
 

+ 50 - 0
package-lock.json

@@ -0,0 +1,50 @@
+{
+  "requires": true,
+  "lockfileVersion": 1,
+  "dependencies": {
+    "@babel/runtime": {
+      "version": "7.26.9",
+      "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.26.9.tgz",
+      "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
+      "requires": {
+        "regenerator-runtime": "^0.14.0"
+      }
+    },
+    "copy-text-to-clipboard": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz",
+      "integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q=="
+    },
+    "core-js": {
+      "version": "3.40.0",
+      "resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.40.0.tgz",
+      "integrity": "sha512-7vsMc/Lty6AGnn7uFpYT56QesI5D2Y/UkgKounk87OP9Z2H9Z8kj6jzcSGAxFmUtDOS0ntK6lbQz+Nsa0Jj6mQ=="
+    },
+    "mutation-observer": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmmirror.com/mutation-observer/-/mutation-observer-1.0.3.tgz",
+      "integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA=="
+    },
+    "regenerator-runtime": {
+      "version": "0.14.1",
+      "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
+      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
+    },
+    "vconsole": {
+      "version": "3.15.1",
+      "resolved": "https://registry.npmmirror.com/vconsole/-/vconsole-3.15.1.tgz",
+      "integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==",
+      "requires": {
+        "@babel/runtime": "^7.17.2",
+        "copy-text-to-clipboard": "^3.0.1",
+        "core-js": "^3.11.0",
+        "mutation-observer": "^1.0.3"
+      }
+    },
+    "weixin-js-sdk": {
+      "version": "1.6.5",
+      "resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz",
+      "integrity": "sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ=="
+    }
+  }
+}

+ 23 - 14
pages/workflowTask/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="h100vh page-bg-color">
-		<u-navbar :customBack="handleBackHome" :title="typeLabel[currentType]"></u-navbar>
+		<u-navbar v-if="showNavbar" :customBack="handleBackHome" :title="typeLabel[currentType]"></u-navbar>
 		<view class="workflow-page" :style="{height: `calc(100vh - ${diStatusBarHeight}px - 48px)`}">
 			<view class="workflow-main">
 				<start-workflow v-if="currentType === 'start'"></start-workflow>
@@ -11,6 +11,7 @@
 </template>
 
 <script>
+    // import wx from "weixin-js-sdk";
 	import startWorkflow from './startWorkflow/startWorkflow'
 	import approveCenter from './approveCenter/index'
     import constant from '@/utils/constant.js'
@@ -18,6 +19,7 @@
 		data() {
 			return {
 				currentType: 'start',
+                showNavbar:true,
 				typeLabel: {
 					start: '发起申请',
 					myLaunch: '我发起的',
@@ -32,8 +34,15 @@
 		onLoad(options) {
 			this.diStatusBarHeight = uni.getSystemInfoSync().statusBarHeight
 			this.currentType = options.type
-            console.log('类型',options.type)
+            if(options?.mpType){
+                this.showNavbar=false
+            }
+            uni.setNavigationBarTitle({
+                    title: this.typeLabel[this.currentType] || ''
+                });
+            // console.log('类型',options.type)
 		},
+       
 		components: {
 			startWorkflow,
 			approveCenter
@@ -43,18 +52,18 @@
 				console.log('000000')
                 let url=constant.host()
                 window.parent.postMessage('/pages/index/index',url+'/mobile/pages/flow/flow')
-                try {
-                    uni.webView.postMessage({
-                        data: {
-                            action: '/pages/index/index'
-                        }
-                    });
-                } catch (error) {
-                    console.warn('unipostMessage',error)
-                }
-               
-				// uni.switchTab({
-				// 	url: '/pages/home/home'
+                // try {
+                    // console.log('unipostMessage')
+                    // uni.webView.postMessage({
+                    //     data: {
+                    //         action: '/pages/index/index'
+                    //     }
+                    // });
+                // } catch (error) {
+                //     console.warn('unipostMessage',error)
+                // }
+                // uni.switchTab({
+				// 	url: '/pages/index/index'
 				// })
 			}
 		}

+ 1 - 1
pages/workflowTask/webviewPages/webview.js

@@ -1,6 +1,6 @@
 let server_url = window.location.host
 if(process.env.NODE_ENV === 'development'){
-    server_url = 'tq.5000v.com:8035'//'tq.5000v.com:8025'
+    server_url = 'localhost:9529'//'tq.5000v.com:8025'
 }
 export default {
 	data() {