Browse Source

get system info to phone for switch

charblus 5 years ago
parent
commit
d4b4f1b73e
3 changed files with 57 additions and 11 deletions
  1. 7 7
      server/config.js
  2. 1 1
      src/components/BookInfo.vue
  3. 49 3
      src/pages/detail/Detail.vue

+ 7 - 7
server/config.js

@@ -1,22 +1,22 @@
 const CONF = {
     serverHost: 'localhost',
     tunnelServerUrl: '',
-    tunnelSignatureKey: '',
+    tunnelSignatureKey: '27fb7d1c161b7ca52d73cce0f1d833f9f5b5ec89',
     // 腾讯云相关配置可以查看云 API 密钥控制台:https://console.cloud.tencent.com/capi
-    qcloudAppId: '',
-    qcloudSecretId: '',
-    qcloudSecretKey: '',
-    wxMessageToken: '',
+    qcloudAppId: '1253858020',
+    qcloudSecretId: 'AKIDve8qJWnBerpdHhbTpwnQo21kDRQ9OqRq',
+    qcloudSecretKey: 'JOEtJVWQ6XjgR4TluoTs5C3f1JCpDLEt',
+    wxMessageToken: 'weixinmsgtoken',
     networkTimeout: 30000,
 
     port: '5757',
     rootPathname: '',
 
     // 微信小程序 App ID
-    appId: '',
+    appId: 'wxa28c90f932b1fb61',
 
     // 微信小程序 App Secret
-    appSecret: '',
+    appSecret: '64520465c87eab44d8c918a6ead2b33c',
 
     // 是否使用腾讯云代理登录小程序
     useQcloudLogin: false,

+ 1 - 1
src/components/BookInfo.vue

@@ -62,7 +62,7 @@ export default {
     padding: 0 15px;
     margin-top: 10px;
     p {
-      text-indent: 2em;
+      text-indent: 2em;  // 段落开头缩进2格
       font-size: 14px;
     }
   }

+ 49 - 3
src/pages/detail/Detail.vue

@@ -3,6 +3,22 @@
     <!-- 图书id{{bookid}} -->
     <BookInfo :info='info'></BookInfo>
     <!-- <button open-type='share' class="btn">转发给好友</button> -->
+    <div class="comment">
+      <textarea v-model="comment"
+                class="textarea"
+                :maxlength="100"
+                placeholder="请输入图书短评"></textarea>
+      <div class="location">
+        地理位置:
+         <switch color="#EA5A49" @change="getGeo" :checked="location" />
+         <span class="text-primary">{{location}}</span>
+      </div>
+      <div class="phone">
+        手机型号:
+         <switch color="#EA5A49" @change="getPhone" :checked="phone"/>
+         <span class="text-primary">{{phone}}</span>
+      </div>
+    </div>
   </div>
 </template>
 <script>
@@ -15,10 +31,25 @@ export default {
   data () {
     return {
       bookid: '',
-      info: {}
+      info: {},
+      comment: '',
+      location: '',
+      phone: ''
     }
   },
   methods: {
+    getGeo () {
+      
+    },
+    getPhone(e) {
+      if(e.target.value) {
+        const res = wx.getSystemInfoSync();
+        // console.log(res.model);
+        this.phone = res.model;
+      } else {
+        this.phone = '';
+      }
+    },
     async getDetail () {
       const info = await get('/weapp/bookdetail', {id: this.bookid})
       wx.setNavigationBarTitle({
@@ -26,7 +57,7 @@ export default {
       })
       console.log(info)
       this.info = info
-    },
+    }
   },
   onShareAppMessage: function(res) {
     return {
@@ -58,5 +89,20 @@ export default {
 }
 </script>
 <style lang="scss">
-
+.comment {
+  margin-top: 10px;
+  .textarea {
+    width: 730px;
+    background-color: #eee;
+    padding: 10px;
+  }
+  .location {
+    margin-top: 10px;
+    padding: 5px 10px;
+  }
+  .phone {
+    margin-top: 10px;
+    padding: 5px 10px;
+  }
+}
 </style>