Jing-Jiu 4 years ago
parent
commit
38cb2ca43d
2 changed files with 158 additions and 137 deletions
  1. 131 112
      pages/enterprise/enterprise_detail.vue
  2. 27 25
      pages/enterprise/product_detail.vue

+ 131 - 112
pages/enterprise/enterprise_detail.vue

@@ -35,23 +35,42 @@
               {{ value }}
             </p>
           </view>
-          <view class="term-value-group" v-else style="flex-direction:row;align-items: center;padding-left: 20rpx;">
-				<div class="flex_i">
+          <view
+            class="term-value-group"
+            v-else
+            style="
+              flex-direction: row;
+              align-items: center;
+              padding-left: 20rpx;
+            "
+          >
+            <view class="flex_i">
+              <view class="">
                 {{ item.value[0] }}
-              </div>
-              <div class="copy" @click="copy(item.value[0])" style="color: #02a7f0;margin-left: 15rpx;">复制</div>
+              </view>
+              <view
+                class="copy"
+                @click="copy(item.value[0])"
+                style="color: #02a7f0; margin-left: 15rpx"
+                >复制</view
+              >
             </view>
           </view>
         </view>
       </view>
     </view>
-    <view v-if="active === 1" class="proInfo">
+    <view v-else-if="active === 1" class="proInfo">
       <view class="products">
-        <view class="product" @click="toDetail(item.id)" v-for="(item,idx) in productList" :key="idx">
+        <view
+          class="product"
+          @click="toDetail(item.id)"
+          v-for="(item, idx) in productList"
+          :key="idx"
+        >
           <view class="img">
             <image :src="'https://kiq.xazhima.com' + item.pic_url"></image>
           </view>
-          <view class="name">{{item.name}}</view>
+          <view class="name">{{ item.name }}</view>
         </view>
       </view>
     </view>
@@ -80,7 +99,7 @@ export default {
       model: {},
       productList: [],
       isShow: false,
-	  infoObj:{},
+      infoObj: {},
     };
   },
   onLoad(option) {
@@ -122,7 +141,7 @@ export default {
         data: { id },
         success: (res) => {
           if (res.data.code === 200) {
-			this.infoObj = res.data.data;
+            this.infoObj = res.data.data;
             let {
               name,
               pic_url,
@@ -242,109 +261,109 @@ export default {
         },
       });
     },
-	goAuthPage(){
-		uni.navigateTo({
-			url:'../auth/index'
-		})
-	},
-	collectionPage() {
-	if(!getApp().globalData.user_phone){
-		this.goAuthPage();
-		return
-	   }
-	  let md5Sign = md5(
-	    "method=" +
-	      "user" +
-	      "&timestamp=" +
-	      getApp().globalData.globalTimestamp +
-	      "&secret=" +
-	      getApp().globalData.secret
-	  );
-	  let url =
-	    getApp().globalData.shareUrl +
-	    "api/api.php" +
-	    "?method=user&source=company&action=collect_add&timestamp=" +
-	    getApp().globalData.globalTimestamp +
-	    "&sign=" +
-	    md5Sign;
-	  uni.request({
-	    url: url,
-	    method: "POST",
-	    header: {
-	      "content-type": "application/x-www-form-urlencoded",
-	    },
-	    data: {
-	      openId: getApp().globalData.open_id,
-	      source: "company",
-	      source_name: "企业",
-	      source_id: this.infoObj.id,
-	      source_title: this.infoObj.name,
-	    },
-	    success: (res) => {
-	      if (res.data.code === 200) {
-	        res.data.data
-	          ? (this.infoObj.if_collect = true)
-	          : (this.infoObj.if_collect = false);
-	        this.$forceUpdate();
-	        uni.showToast({
-	          duration: 3000,
-	          title: res.data.msg,
-	          icon: "none",
-	        });
-	      }
-	    },
-	    fail: () => {
-	      console.log("连接失败");
-	    },
-	  });
-	},
-	shareRequest() {
-	  let md5Sign = md5(
-	    "method=" +
-	      "user" +
-	      "&timestamp=" +
-	      getApp().globalData.globalTimestamp +
-	      "&secret=" +
-	      getApp().globalData.secret
-	  );
-	  let url =
-	    getApp().globalData.shareUrl +
-	    "api/api.php" +
-	    "?method=user&source=company&action=repost&timestamp=" +
-	    getApp().globalData.globalTimestamp +
-	    "&sign=" +
-	    md5Sign;
-	  uni.request({
-	    url: url,
-	    method: "POST",
-	    header: {
-	      "content-type": "application/x-www-form-urlencoded",
-	    },
-	    data: {
-	      openId: getApp().globalData.open_id,
-	      source_id: this.infoObj.id,
-	      source: "company",
-	    },
-	    success: (res) => {
-	      if (res.data.code === 200) {
-	        console.log(res);
-	      }
-	    },
-	    fail: () => {
-	      console.log("连接失败");
-	    },
-	  });
-	},
-	sharePage() {
-	  let that = this;
-	  uni.showShareMenu({
-	    title: that.infoObj.title,
-	    path: "pages/enterprise/enterprise_detail?id=" + that.infoObj.id,
-	    success(res) {
-	      that.shareRequest();
-	    },
-	  });
-	},
+    goAuthPage() {
+      uni.navigateTo({
+        url: "../auth/index",
+      });
+    },
+    collectionPage() {
+      if (!getApp().globalData.user_phone) {
+        this.goAuthPage();
+        return;
+      }
+      let md5Sign = md5(
+        "method=" +
+          "user" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=user&source=company&action=collect_add&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: {
+          openId: getApp().globalData.open_id,
+          source: "company",
+          source_name: "企业",
+          source_id: this.infoObj.id,
+          source_title: this.infoObj.name,
+        },
+        success: (res) => {
+          if (res.data.code === 200) {
+            res.data.data
+              ? (this.infoObj.if_collect = true)
+              : (this.infoObj.if_collect = false);
+            this.$forceUpdate();
+            uni.showToast({
+              duration: 3000,
+              title: res.data.msg,
+              icon: "none",
+            });
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    shareRequest() {
+      let md5Sign = md5(
+        "method=" +
+          "user" +
+          "&timestamp=" +
+          getApp().globalData.globalTimestamp +
+          "&secret=" +
+          getApp().globalData.secret
+      );
+      let url =
+        getApp().globalData.shareUrl +
+        "api/api.php" +
+        "?method=user&source=company&action=repost&timestamp=" +
+        getApp().globalData.globalTimestamp +
+        "&sign=" +
+        md5Sign;
+      uni.request({
+        url: url,
+        method: "POST",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        data: {
+          openId: getApp().globalData.open_id,
+          source_id: this.infoObj.id,
+          source: "company",
+        },
+        success: (res) => {
+          if (res.data.code === 200) {
+            console.log(res);
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
+    sharePage() {
+      let that = this;
+      uni.showShareMenu({
+        title: that.infoObj.title,
+        path: "pages/enterprise/enterprise_detail?id=" + that.infoObj.id,
+        success(res) {
+          that.shareRequest();
+        },
+      });
+    },
     copy(data) {
       uni.setClipboardData({
         data,

+ 27 - 25
pages/enterprise/product_detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="content">
-    <!--<div class="title">
+    <!-- <div class="title">
       <div class="logo">
         <img :src="company.logo" alt="" />
       </div>
@@ -9,45 +9,47 @@
       </div>
     </div> -->
     <div class="fwb" v-html="company"></div>
-<!--    <div style="width: 100%">
+    <div style="width: 100%">
       <footer-share
         style="width: 100%"
         :isCollection="true"
         @collectionPages="collectionPage"
         @sharePages="sharePage"
       ></footer-share>
-    </div> -->
+    </div>
   </div>
 </template>
 <script>
 export default {
   onLoad(option) {
-  	this.getRich(option.id);
+    this.getRich(option.id);
   },
   data() {
     return {
-      company:'',
-	  }
+      company: "",
+    };
+  },
+  methods: {
+    getRich(ids) {
+      uni.request({
+        url: `https://kiq.xazhima.com/content/company_product/${Math.floor(
+          ids / 1000
+        )}/${ids}.html`,
+        method: "GET",
+        header: {
+          "content-type": "application/x-www-form-urlencoded",
+        },
+        success: (res) => {
+          if (res.statusCode === 200) {
+            this.company = res.data;
+          }
+        },
+        fail: () => {
+          console.log("连接失败");
+        },
+      });
+    },
   },
-  methods:{
-	  getRich(ids) {
-	    uni.request({
-	      url: `https://kiq.xazhima.com/content/company_product/${Math.floor(ids / 1000)}/${ids}.html`,
-	      method: "GET",
-	      header: {
-	        "content-type": "application/x-www-form-urlencoded",
-	      },
-	      success: (res) => {
-	        if (res.statusCode === 200) {
-				this.company = res.data;
-	        }
-	      },
-	      fail: () => {
-	        console.log("连接失败");
-	      },
-	    });
-	  },
-  }
 };
 </script>
 <style lang="scss">