wansfa 2 gadi atpakaļ
vecāks
revīzija
448a51e2f8

+ 250 - 0
public/wx.html

@@ -0,0 +1,250 @@
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <link rel="icon" href="data:;base64,=">
+  <meta charset="UTF-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title></title>
+  <meta name="description" content="">
+  <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.1/weui.min.css"></link>
+  <script src="https://n.stcfile.com/inner/wlh5/jquery.min.js"></script>
+  <link rel="stylesheet" type="text/css" href="https://n.stcfile.com/inner/wlh5/home_links.css">
+  <script>
+    window.onerror = e => {
+      console.error(e)
+    }
+  </script>
+</head>
+<body>
+  <div class="page full">
+    <div id="public-web-container" class="public-container">
+        <div id="safe-notice" style="display:none;">
+            <div class="safe-notice">
+                <img src="https://n.stcfile.com/inner/wlh5/safe.png">
+                <p>本链接经过<font style="font-weight: 500;color: #333333;">SSL安全加密</font>,请放心点击!</p>
+            </div>
+        </div>
+        <div id="style_normal" style="display:none;">
+            <img class="logo" src="">
+            <p class="notice-msg"><small style="font-weight: 500;">正在跳转中...</small><br>如未自动打开微信请点击下方按钮</p>
+            <div class="button-container" onclick="getInfos()">
+                <a id="public-web-jump-button" type="button" class="default" style="width: 66%; margin-top: 20px;">
+                    <span id="public-web-jump-button-loading" class="weui-primary-loading weui-primary-loading_transparent">
+                        <i class="weui-primary-loading__dot"></i>
+                    </span>
+                    <span style="font-weight: 500;">正在打开微信</span>
+                  </a>
+            </div>
+            <a id="dianjiimg_links" href="">
+            </a>
+            <div class="qrcodes-container" id="qrcodes"></div>
+        </div>
+        <div id="style_full" style="display:none;">
+            <a id="dianjiimg_links_full" href="">
+                <img class="fullimg" src="">
+            </a>
+            <div id="button_container_full" class="button-container-none">
+                <a id="public-web-jump-button-full" href="" style="">
+                </a>
+            </div>
+        </div>
+    </div>
+  </div>
+
+  <script type="text/javascript">
+    var cid=0;
+    $(document).ready(function() {
+        cid=getQueryString("cid");
+        htmlInfo();
+        getInfos();
+    });
+
+    function  getQueryString(name){
+      var  reg = new  RegExp( "(^|&)" + name + "=([^&]*)(&|$)" );
+      var  r = window.location.search.substr(1).match(reg);
+      if (r!= null ) return   unescape(r[2]); return  null ;
+    }
+
+    
+    function htmlInfo() {
+      var mobile_flag = isMobile();
+        if (mobile_flag) {
+          $("#safe-notice").show();
+          $("#style_normal").show();
+          $(".logo").attr("src","https://n.stcfile.com/inner/wlh5/wx_202204.png")
+        } else {
+          $("#safe-notice").hide();
+          $("#style_normal").hide();
+          $(".public-container").html('请使用手机访问本链接'+'</p>');
+        }
+    }
+
+    function getInfos() {
+      console.log('getInfos')
+      var weixin = isWeiXin();
+    //   var res={
+    //     "code": 200,
+    //     "msg": "success",
+    //     "result": {
+    //              "openlink": "weixin:\/\/dl\/business\/?t=B7IYjoq9ZPq"
+    //           }
+    //     };
+	   
+	  //  if (res.status === 200) {
+    //     if (!weixin) {
+    //       $("#dianjiimg_links").attr('href', res.result.openlink)
+    //       // $("#public-web-jump-button").attr("href", res.result.openlink)
+    //       jsUpdate(res)
+    //     }
+	  //  } else {
+	  //  	    $(".public-container").html('<p class="error-msg">'+res.msg+'</p>');
+	  //  }
+	
+	  
+      $.ajax({
+            url: "http://192.169.1.150:7015/app/user/getAppletScheme",
+            data: {
+              "cardId":cid,
+              // "domain": "eturl.cn",
+              // "cookie":"ca77320dfefbda77f218b15fb5e64e96",
+              // "f":"bd084627"
+            },
+            success: function(res) {
+                  if (res.code === 200) {
+                      if (!weixin) {
+                        $("#dianjiimg_links").attr('href', res.result.openlink)
+                        // $("#public-web-jump-button").attr("href", res.result.openlink)
+                        jsUpdate(res)
+                      }
+                  } 
+                  else {
+                        $(".public-container").html('<p class="error-msg">'+res.msg+'</p>');
+                  }
+              }
+      });
+   
+	}
+    function jsUpdate(res) {
+            var mobile_flag = isMobile();
+            var weixin = isWeiXin();
+            if(mobile_flag){
+                var baidu = isBaidu();
+                var uc = isUc();
+                var weibo = isWeibo();
+                var douyin = isDouyin();
+                if (weixin) {
+
+                } 
+                else if (uc) {
+                    $("#public-web-jump-button").html("点击立即前往微信");
+                    $("#dianjiimg").show();
+                    window.location.href = res.result.openlink;
+                } 
+                else if (douyin) {
+                    if (res.result.openlink !== '') {
+                      window.location.href = res.result.openlink;
+                      // $("#public-web-jump-button span").click();
+                    }
+                } 
+                else if (weibo) {
+                  window.location.href = res.result.openlink;
+                } 
+                else {
+                    $("#dianjiimg").show();
+                    if (res.result.openlink !== '') {
+                      window.location.href = res.result.openlink;
+                      // $("#public-web-jump-button span").click();
+                    }
+                    setTimeout(function (){
+                        $("#public-web-jump-button").html("点击立即前往微信");
+                        $("#dianjiimg").show();
+                    }, 3000);
+                }
+            } else {
+                // 强行调用一波URLScheme
+                if (res.result.openlink !== '') {
+                  window.location.href = res.result.openlink;
+                }
+                $(".notice-msg").html("请使用手机访问本网页!");
+            }
+        }
+
+    function isWeiXin(){
+        var ua = navigator.userAgent.toLowerCase()
+        var isWXWork = ua.match(/wxwork/i) == 'wxwork'
+        var isWeixin = !isWXWork && ua.match(/micromessenger/i) == 'micromessenger'
+        return isWeixin;
+    }
+
+    function isDouyin(){
+            ua = navigator.userAgent.toLowerCase();
+            if (ua.indexOf('aweme') >-1){
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+    function isBaidu(){
+        ua = navigator.userAgent.toLowerCase();
+        if (ua.indexOf('baiduboxapp/') >-1){
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function isUc() {
+        if (navigator.userAgent.match(/(UCBrowser|Quark)/i)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function isWeibo() {
+        var ua = navigator.userAgent;
+        if(ua.indexOf('Weibo') > -1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    function getQueryVariable(variable)
+    {
+        var query = window.location.search.substring(1);
+        var vars = query.split("&");
+        for (var i=0;i<vars.length;i++) {
+            var pair = vars[i].split("=");
+            if(pair[0] == variable){return pair[1];}
+        }
+        return(false);
+    }
+
+    function isMobile() {
+        var mobile_flag = true;
+        if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|XiaoMi|IEMobile)/i)) {
+            mobile_flag = true;
+        } else {
+            mobile_flag = false;
+        }
+        var screen_width = window.screen.availWidth;
+        if(screen_width < 700){
+            mobile_flag = true;
+        }
+        return mobile_flag;
+    }
+
+    function isIphone() {
+        if (navigator.userAgent.match(/(iPhone|iPod|ios|iPad)/i)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+  </script>
+</body>
+</html>

+ 53 - 0
src/api/company/companyUserCard.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询card列表
+export function listCard(query) {
+  return request({
+    url: '/company/companUsercard/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询card详细
+export function getCard(id) {
+  return request({
+    url: '/company/companUsercard/' + id,
+    method: 'get'
+  })
+}
+
+// 新增card
+export function addCard(data) {
+  return request({
+    url: '/company/companUsercard',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改card
+export function updateCard(data) {
+  return request({
+    url: '/company/companUsercard',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除card
+export function delCard(id) {
+  return request({
+    url: '/company/companUsercard/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出card
+export function exportCard(query) {
+  return request({
+    url: '/company/companUsercard/export',
+    method: 'get',
+    params: query
+  })
+}

+ 353 - 0
src/views/company/companyUser/card/index.vue

@@ -0,0 +1,353 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="名片标题" prop="title">
+        <el-input
+          v-model="queryParams.title"
+          placeholder="请输入名片标题"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+
+      <el-form-item label="类型" prop="type">
+        <el-select v-model="queryParams.type" placeholder="请选择类型" clearable size="small">
+          <el-option label="请选择字典生成" value="" />
+        </el-select>
+      </el-form-item>
+
+      <!-- <el-form-item label="名片访问次数" prop="lookNum">
+        <el-input
+          v-model="queryParams.lookNum"
+          placeholder="请输入名片访问次数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="名片访问人数" prop="personNum">
+        <el-input
+          v-model="queryParams.personNum"
+          placeholder="请输入名片访问人数"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item> -->
+
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['company:companUsercard:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['company:companUsercard:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['company:companUsercard:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['company:companUsercard:export']"
+        >导出</el-button>
+      </el-col>
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="cardList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="Id" align="center" prop="id" />
+      <el-table-column label="名片标题" align="center" prop="title" />
+      <el-table-column label="用户ID" align="center" prop="userId" />
+      <!-- <el-table-column label="微信url_scheme" align="center" prop="urlScheme" /> -->
+      <!-- <el-table-column label="微信url_scheme" align="center" prop="companyId" /> -->
+      <el-table-column label="名片图片地址" align="center" prop="imageUrl" />
+      <el-table-column label="名片类型" align="center" prop="type" />
+      <el-table-column label="微信名片短链接" align="center" prop="shortUrl" />
+      <el-table-column label="是否访问" align="center" prop="isVisit" />
+      <el-table-column label="名片访问次数" align="center" prop="lookNum" />
+      <!-- <el-table-column label="名片访问人数" align="center" prop="personNum" />
+      <el-table-column label="名片访问ip数" align="center" prop="ipNum" /> -->
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['company:companUsercard:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['company:companUsercard:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改card对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="名片标题" prop="title">
+          <el-input v-model="form.title" placeholder="请输入名片标题" />
+        </el-form-item>
+        <el-form-item label="用户ID" prop="userId">
+          <el-input v-model="form.userId" placeholder="请输入用户ID" />
+        </el-form-item>
+        <el-form-item label="微信url_scheme" prop="urlScheme">
+          <el-input v-model="form.urlScheme" placeholder="请输入微信url_scheme" />
+        </el-form-item>
+        <el-form-item label="微信url_scheme" prop="companyId">
+          <el-input v-model="form.companyId" placeholder="请输入微信url_scheme" />
+        </el-form-item>
+        <el-form-item label="名片图片地址" prop="imageUrl">
+          <el-input v-model="form.imageUrl" placeholder="请输入名片图片地址" />
+        </el-form-item>
+        <el-form-item label="0:个微 1:企微" prop="type">
+          <el-select v-model="form.type" placeholder="请选择0:个微 1:企微">
+            <el-option label="请选择字典生成" value="" />
+          </el-select>
+        </el-form-item>
+        <!-- <el-form-item label="微信名片短链接" prop="shortUrl">
+          <el-input v-model="form.shortUrl" placeholder="请输入微信名片短链接" />
+        </el-form-item>
+        <el-form-item label="是否访问" prop="isVisit">
+          <el-input v-model="form.isVisit" placeholder="请输入微信名片短链接" />
+        </el-form-item> -->
+        <el-form-item label="名片访问次数" prop="lookNum">
+          <el-input v-model="form.lookNum" placeholder="请输入名片访问次数" />
+        </el-form-item>
+        <!-- <el-form-item label="名片访问人数" prop="personNum">
+          <el-input v-model="form.personNum" placeholder="请输入名片访问人数" />
+        </el-form-item>
+        <el-form-item label="名片访问ip数" prop="ipNum">
+          <el-input v-model="form.ipNum" placeholder="请输入名片访问ip数" />
+        </el-form-item> -->
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listCard, getCard, delCard, addCard, updateCard, exportCard } from "@/api/company/companyUserCard";
+
+export default {
+  name: "companyUserCard",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // card表格数据
+      cardList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        userId: null,
+        urlScheme: null,
+        companyId: null,
+        imageUrl: null,
+        type: null,
+        shortUrl: null,
+        isVisit: null,
+        lookNum: null,
+        personNum: null,
+        ipNum: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        userId: [
+          { required: true, message: "用户ID不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询card列表 */
+    getList() {
+      this.loading = true;
+      listCard(this.queryParams).then(response => {
+        this.cardList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        title: null,
+        userId: null,
+        urlScheme: null,
+        companyId: null,
+        imageUrl: null,
+        type: null,
+        shortUrl: null,
+        isVisit: null,
+        lookNum: null,
+        personNum: null,
+        ipNum: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加card";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getCard(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改个人名片";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateCard(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addCard(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delCard(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportCard(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    }
+  }
+};
+</script>