0.0.2 • Published 9 months ago
market-client-ts v0.0.2
用户行为数据收集包
描述
收集用户行为,为运营提供支持
future
- 跨网络
- 共识存证
安装
npm install market-client-ts
使用
import { SendCoin, CacheRegister, EmitLog } from 'market-client-ts'
- 注册
- 调用转账接口,为用户使用此网络提供能量
SendCoin(phone, 1000);
- 登录
- 调用register接口,判断用户是否存在
const { user } = await CacheRegister(phone);
- 查询企业
- 调用EmitLog接口,上传用户行为
- 构建行为信息
interface SearchCompany {
url: string; // 查询url
uname: string; // 查询url名称, 默认查企
app: string; // 应用名称, 默认招商
company: string; // 查询内容
}
// case
const msg: SearchCompany = {
url: "url",
company: appName,
};
- 调用接口上传
const result = await EmitLog(phone, msg);
vue Demo - 基于文件项目导入
<script setup lang="ts">
import { useAddress } from "@/def-composables/useAddress";
import IgntAssets from "../components/IgntAssets.vue";
import IgntTransactions from "../components/IgntTransactions.vue";
import IgntTransfer from "../components/IgntTransfer.vue";
import { SendCoin, CacheRegister, EmitLog } from 'market-client-ts'
const phone = "1"
SendCoin(phone, 10)
CacheRegister(phone)
const msg = {
url: "string",
uname: "string",
app: "string",
company: "string"
}
const result = await EmitLog(phone, msg)
console.log(result)
const { address } = useAddress();
</script>
package.json配置
{
"dependencies": {
"@cosmjs/encoding": "^0.29.3",
"@cosmjs/stargate": "^0.29.3",
"@headlessui/tailwindcss": "^0.1.1",
"@headlessui/vue": "^1.7.3",
"@ignt/vue-library": "^0.4.3",
"@tanstack/vue-query": "^4.13.5",
"axios": "^1.1.3",
"bignumber.js": "^9.1.0",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.6",
"gradient-avatar": "^1.0.2",
"long": "^5.2.0",
"market-client-ts": "file:../ts-client",
"market-user-ts": "file:../ts-client/market.market/use",
"pinia": "^2.0.23",
"qrcode": "^1.5.1",
"vue": "^3.2.41",
"vue-router": "^4.1.6"
},
"devDependencies": {
"@cosmjs/proto-signing": "^0.29.3",
"@keplr-wallet/types": "^0.11.14",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rushstack/eslint-patch": "^1.2.0",
"@types/crypto-js": "^4.1.1",
"@types/events": "^3.0.0",
"@types/jsdom": "^20.0.0",
"@types/node": "^18.11.8",
"@types/qrcode": "^1.5.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/tsconfig": "^0.1.3",
"autoprefixer": "^10.4.13",
"eslint": "^8.26.0",
"eslint-plugin-vue": "^9.6.0",
"events": "^3.3.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.18",
"prettier": "^2.7.1",
"sass": "^1.55.0",
"tailwindcss": "^3.2.1",
"typescript": "~4.8.4",
"vite": "^3.2.1",
"vue-tsc": "^1.0.9"
},
"engines": {
"node": "\u003e=16.0.0",
"npm": "\u003e=8.0.0"
},
"name": "@ignt/vue-template",
"private": true,
"scripts": {
"build": "run-p type-check build-only",
"build-only": "vite build",
"dev": "vite",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"postinstall": "node postinstall.js",
"prepare": "node prepare.js",
"preview": "vite preview --port 4173",
"type-check": "vue-tsc --noEmit"
},
"version": "0.4.3"
}