sunChengjie 11 months ago
parent
commit
84071fc53f
5 changed files with 22 additions and 10 deletions
  1. 1 1
      config/index.js
  2. 9 5
      src/main.js
  3. 1 2
      src/pages/express.vue
  4. 10 2
      src/pages/myaddressbook.vue
  5. 1 0
      src/script/wxGetOpenId.js

+ 1 - 1
config/index.js

@@ -19,7 +19,7 @@ module.exports = {
     },
 
     // Various Dev Server settings
-    host: 'localhost', // can be overwritten by process.env.HOST
+    host: '0.0.0.0', // can be overwritten by process.env.HOST
     port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,

+ 9 - 5
src/main.js

@@ -3,7 +3,6 @@
 
 import Vue from 'vue'
 import { VueJsonp } from 'vue-jsonp'
-Vue.use(VueJsonp)
 import App from './App'
 import router from './router'
 import store from './store/store' // 引入store
@@ -17,8 +16,11 @@ import clipboard from 'clipboard'
 import 'vant/lib/index.css'
 import wx from 'weixin-js-sdk'
 import VConsole from 'vconsole';
-const vconsole = new VConsole()
 import request from "@/utils/request"
+import { getWxOpenId } from './script/wxGetOpenId.js'
+import common from './script/common.js'
+Vue.use(VueJsonp)
+new VConsole()
 Vue.prototype.$axios = request
 Vue.prototype.$wx = wx
 Vue.component('tabbar', tabbar)
@@ -28,9 +30,9 @@ Vue.component('backindex', backIndex)
 Vue.config.productionTip = false
 Vue.use(Vant)
 Vue.use(resource)
-import common from './script/common.js'
 Vue.use(common)
 Vue.prototype.clipboard = clipboard
+
 // 时间戳过滤器
 Vue.filter('dateFormat', (dataStr) => {
     var time = new Date(dataStr)
@@ -52,7 +54,7 @@ Vue.filter('dateFormat', (dataStr) => {
 
 
 // import { getWxOpenId } from './script/wxGetOpenId.js'
-import { getWxOpenId } from './script/wxGetOpenId.js'
+
 const whiteList = ['/Login']
 router.beforeEach((to, from, next) => {
     // if (to.matched.some(record => record.meta.needLogin)) { // 判断该路由是否需要登录权限
@@ -64,7 +66,9 @@ router.beforeEach((to, from, next) => {
         } else if (!localStorage.getItem('openid')) {
             console.log('无openId')
             // overallExample.getOpenid()
-            getWxOpenId()
+            getWxOpenId().then(() => {
+                next()
+            })
             console.log('overallExample.getOpenid()走完了')
         } else {
             console.log('什么都有')

+ 1 - 2
src/pages/express.vue

@@ -3,8 +3,7 @@
 		<!--运单号-->
 		<div v-show="wayShow" class="sm" style="padding-top: 10px;height: 50px;">
 			<div>
-				<van-field style="background-color: rgb(0, 196, 184);" maxlength="50" v-model="waybillNo" name="运单号"
-					label="运单号" placeholder="运单号" />
+				<van-field maxlength="50" v-model="waybillNo" name="运单号" label="运单号" placeholder="运单号" />
 				<img @click="wxScanCode(1)" src="../assets/images/sm.png" alt="">
 			</div>
 		</div>

+ 10 - 2
src/pages/myaddressbook.vue

@@ -6,7 +6,7 @@
 				<div>
 					<div class="jj">
 						<div class="jjaddress" @click="transmitMessage(item)">
-							<p style="background: #fa9c22;">收</p>
+							<p style="background: #00c4b8;">收</p>
 							<div :id="'copytkl' + item.id">
 								<p>{{ item.addresseeName }} {{ item.addresseePhone }}</p>
 								<p>{{ item.addresseeAddress }} </p>
@@ -32,7 +32,7 @@
 			</div>
 			<!-- 寄件 -->
 			<div class="btn-jj">
-				<van-button type="info" @click="link(2)" color="#fa9c22">添加收件人</van-button>
+				<van-button type="info" @click=" link(2)">添加收件人</van-button>
 			</div>
 		</div>
 	</div>
@@ -143,6 +143,14 @@ export default {
 </script>
 
 <style scoped lang="less">
+.van-button--info {
+	background-color: #00c4b8;
+	color: #fff;
+	background-color: #00c4b8;
+	border: 1px solid #00c4b8;
+}
+
+
 .content {
 	.tab {
 		font-size: .36rem;

+ 1 - 0
src/script/wxGetOpenId.js

@@ -28,6 +28,7 @@ export async function getWxOpenId() {
 async function urlredirect() {
     const res = await getWxConfig({})
     const href = window.location.href
+    console.log(href, '这是href')
     window.location.href =
         `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.wxConfig.appId}&redirect_uri=${encodeURIComponent(href)}` + `&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect`;
 }