Commit c01b56ca authored by jyx's avatar jyx

处理跨域,添加登录,认证页

parent 2eeb036c
......@@ -112,8 +112,8 @@
titlePadding: 8,
windowWidth: 0,
bottomSafePadding: 12,
h5Url: 'https://api.mints-id.com/index.html',
baseUrl: 'https://dx.mints-tech.cn/minip-api/miniApi',
h5Url: 'https://api.mints-tech.cn/camera-api',
baseUrl: 'https://api.mints-tech.cn/camera-api',
// baseUrl: 'http://test.mints-id.com/ww-new/api',
titleButtonWidth: 38,
token: '',
......
import {
post,
get
} from '../net/httpFetch.js'
module.exports = {
/**
* 我的
*/
baseMsg(params) {
return post('roseApi/user/baseMsg', params)
},
/**
* 手机号登录
*/
mobileLogin(params) {
return post('roseApi/user/mobilelogin/h5', params)
},
/**
* 获取验证码
*/
sendMobileCode(params) {
return post('roseApi/user/sendMobileCode', params)
},
/**
* 获得人脸核验url
*/
getWxFaceParam(params) {
return post('roseApi/face/getWxFaceParam', params)
},
/**
* 返回人脸核验url,跳转后录制视频
*/
faceResult(params) {
return post('roseApi/face/faceResult', params)
},
}
\ No newline at end of file
// 定义 UserProfile 对象
export const UserProfile = {
PROFILE_SG: {
str: "身高",
arr: getHeightArr(),
},
PROFILE_TZ: {
str: "体重",
arr: getWeightArr(),
},
PROFILE_SX: {
str: "身形",
arr: ["大长腿", "A4腰", "丰满", "锁骨", "微胖", "170CM"],
},
PROFILE_JYFW: {
str: "交友范围",
arr: [],
},
PROFILE_ZY: {
str: "职业",
arr: [{
"name": "无",
"children": [
{"name": "无"},
]
},
{
"name": "娱乐体育",
"children": [
{"name": "影视"},
{"name": "运动体育"},
{"name": "音乐"},
{"name": "模特"},
]
},
{
"name": "工程制造",
"children": [
{"name": "建筑"},
{"name": "土木工程"},
{"name": "机械制造"},
{"name": "电子"},
{"name": "生物医药"},
{"name": "食品"},
{"name": "服饰"},
{"name": "能源"},
]
},
{
"name": "金融保险",
"children": [
{"name": "投资"},
{"name": "股票/基金"},
{"name": "保险"},
{"name": "银行"},
{"name": "信托/担保"},
]
},
{
"name": "交通运输",
"children": [
{"name": "航空"},
{"name": "铁路"},
{"name": "航运/船舶"},
{"name": "公共交通"},
{"name": "物流运输"},
]
},
{
"name": "信息技术",
"children": [
{"name": "互联网"},
{"name": "IT"},
{"name": "通讯"},
{"name": "电信运营"},
{"name": "网络游戏"},
]
},
{
"name": "文化传播",
"children": [
{"name": "媒体出版"},
{"name": "设计"},
{"name": "文化传播"},
{"name": "广告创意"},
{"name": "动漫"},
{"name": "公关/会展"},
{"name": "摄影"},
]
},
{
"name": "公共事业",
"children": [
{"name": "医疗"},
{"name": "法律"},
{"name": "教育"},
{"name": "科研"},
{"name": "公益"},
]
},
{
"name": "商业服务",
"children": [
{"name": "咨询"},
{"name": "个体经营"},
{"name": "美容美发"},
{"name": "旅游"},
{"name": "酒店餐饮"},
{"name": "贸易"},
{"name": "汽车"},
{"name": "物业管理"},
{"name": "装修/装潢"},
{"name": "侦探"},
]
}
],
},
PROFILE_GXBQ: {
str: "个性标签",
arr: [],
},
PROFILE_NL: {
str: "年龄",
arr: getAgeArr(),
},
PROFILE_JYJM: {
str: "交友节目",
arr: [
"旅游",
"夜蒲聚会",
"兜风",
"游艇派对",
"玩游戏",
"运动",
"看电影",
"去唱歌",
"吃吃喝喝",
],
},
UNKNOWN: {
str: "未知",
arr: null,
},
USUAL_LABEL_MALE: {
str: "日常",
arr: [
{"name": "泡吧","s": false},
{"name": "不抽烟","s": false},
{"name": "旅游","s": false},
{"name": "聚会","s": false},
{"name": "不喝酒","s": false},
{"name": "酒神","s": false},
{"name": "吃货","s": false},
{"name": "游戏","s": false},
{"name": "本科","s": false},
{"name": "宅家","s": false},
{"name": "蹦迪","s": false},
{"name": "看脸","s": false},
{"name": "健身","s": false},
{"name": "读书","s": false},
{"name": "上班","s": false},
],
},
SPECIAL_LABEL_MALE: {
str: "特质",
arr: [
{"name": "硬汉","s": false},
{"name": "大方","s": false},
{"name": "暖男","s": false},
{"name": "文艺","s": false},
{"name": "会玩","s": false},
{"name": "随性","s": false},
{"name": "只走心","s": false},
{"name": "浪漫","s": false},
{"name": "阳光","s": false},
{"name": "直爽","s": false},
{"name": "磁性","s": false},
{"name": "小鲜肉","s": false},
{"name": "高素质","s": false},
{"name": "爱干净","s": false},
{"name": "磁性","s": false},
{"name": "腹肌","s": false},
],
},
USUAL_LABEL_FEMALE: {
str: "日常",
arr: [
{"name": "泡吧","s": false},
{"name": "不抽烟","s": false},
{"name": "旅游","s": false},
{"name": "聚会","s": false},
{"name": "不喝酒","s": false},
{"name": "酒神","s": false},
{"name": "吃货","s": false},
{"name": "游戏","s": false},
{"name": "本科","s": false},
{"name": "宅家","s": false},
{"name": "Cosplay","s": false},
{"name": "颜控","s": false},
{"name": "细节控","s": false},
{"name": "声控","s": false},
{"name": "手控","s": false},
],
},
SPECIAL_LABEL_FEMALE: {
str: "特质",
arr: [
{"name": "老司机","s": false},
{"name": "气质","s": false},
{"name": "性感","s": false},
{"name": "会玩","s": false},
{"name": "高冷","s": false},
{"name": "嗲妹子","s": false},
{"name": "清纯","s": false},
{"name": "萝莉","s": false},
{"name": "妩媚","s": false},
{"name": "百变","s": false},
{"name": "直爽","s": false},
{"name": "随性","s": false},
{"name": "萌萌哒","s": false},
{"name": "爱干净","s": false},
{"name": "比较乖","s": false},
],
},
SPECIAL_LIKE_FEMALE: {
str: "喜欢的女生特质",
arr: [
{"name": "泡吧","s": false},
{"name": "不抽烟","s": false},
{"name": "cosplay","s": false},
{"name": "游戏","s": false},
{"name": "不喝酒","s": false},
{"name": "酒神","s": false},
{"name": "吃货","s": false},
{"name": "老司机","s": false},
{"name": "气质","s": false},
{"name": "性感","s": false},
{"name": "会玩","s": false},
{"name": "高冷","s": false},
{"name": "嗲妹子","s": false},
{"name": "清纯","s": false},
{"name": "萝莉","s": false},
{"name": "妩媚","s": false},
{"name": "百变","s": false},
{"name": "直爽","s": false},
{"name": "随性","s": false},
{"name": "萌萌哒","s": false},
{"name": "爱干净","s": false},
{"name": "比较乖","s": false},
],
},
};
// 生成体重数组
function getWeightArr() {
const start = 30;
const end = 120;
const arr = [];
for (let i = start; i <= end; i++) {
arr.push(`${i}KG`);
}
return arr;
}
// 生成身高数组
function getHeightArr() {
const start = 140;
const end = 230;
const arr = [];
for (let i = start; i <= end; i++) {
arr.push(`${i}CM`);
}
return arr;
}
// 生成年龄数组
function getAgeArr() {
const start = 1975;
const end = 2006;
const arr = [];
for (let i = start; i <= end; i++) {
arr.push(`${i}`);
}
return arr;
}
\ No newline at end of file
const CryptoJS = require('./crypto-js.js')
const key = CryptoJS.enc.Utf8.parse("abcdnnnnnn123456"); //十六位十六进制数作为密钥
var iv = CryptoJS.enc.Utf8.parse('3266e4c9b8138d3b'); //十六位 aes转换后使用
/**
* 加密(需要先加载lib/aes/aes.min.js文件)
* @param word
* @returns {*}
*/
export function encrypt(word) {
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
let ens = encrypted.ciphertext.toString(CryptoJS.enc.Base64)
return ens;
}
/**
* 解密
* @param word
* @returns {*}
*/
export function decrypt(word) {
// 去除 换行符 空格 下划线
var replaceWord = word.replace(/[\r\n]/g, "").replace(/\-g/, '+').replace(/_/, '/');
//返回的是解密后的对象
let decrypt = CryptoJS.AES.decrypt(replaceWord, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
//将解密对象转换成UTF8的字符串
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
// 返回解密结果
return decryptedStr.toString();
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
import {
encrypt,
decrypt
} from '../encry/aesUtil.js'
import md5 from 'js-md5'
import {
encode,
decode
} from 'js-base64';
import {
removeUserInfo
} from '../store/user.js';
const optionsUrl = {
isDebug: process.env.NODE_ENV === 'development',
devUrl: "",
prodUrl: "https://api.mints-tech.cn/camera-api/"
}
const API_ROOT = optionsUrl.isDebug ? optionsUrl.devUrl : optionsUrl.prodUrl
const headers = {
'token': '',
'version': '1.0.0',
'pkgName': 'com.duben.loveplayletd',
'channel': 'h5',
'Content-Type': 'application/json',
}
function getAuth() {
return new Promise((resolve, reject) => {
uni.getStorage({
key: 'TOKEN_ID',
success: function(data) {
headers.token = data
resolve(true)
},
fail: function(data, code) {
resolve(false)
}
})
})
}
function realFetch(url, data = null, method = 'get') {
// 打印日志
console.log('┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
console.log('┃ REQUEST ')
console.log('┃ url: ', API_ROOT + url)
console.log('┃ method: ', method)
console.log('┃ data: ', JSON.stringify(data))
console.log('┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
var token = headers.token
var time = '' + new Date().getTime()
var jsonData = JSON.stringify(data)
var channel = 'quick_' + 'scan'
var _sign = token + ':' + channel + ':' + time
var sign = '' + md5(_sign)
var check = '' + md5(_sign + ':' + jsonData)
var params = {
'channel': channel,
'sign': sign,
'check': check,
'data': encrypt(jsonData)
}
let option = {}; // 请求参数
option.url = API_ROOT + url
option.method = method
option.data = encrypt(jsonData)
headers['last-session'] = encode(time) // base64 编码
headers['new-session'] = md5(time) // md5 加密
option.header = {
...headers
}
return new Promise((resolve, reject) => {
uni.request({
...option,
success: (data) => {
console.log(data)
var result = {}
if (typeof data.data === 'object') {
result = data.data
} else {
let result = JSON.parse(data.data)
}
console.log(
'┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
)
console.log('┃ RESULT: ')
console.log('┃ url: ', API_ROOT + url)
console.log('┃ method: ', method)
console.log('┃ status: ', result.status ?? '')
console.log('┃ message: ', result.message ?? '')
console.log('┃ data: ', result.data != undefined ? decrypt(result.data ?? '') : "")
console.log(
'┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'
)
if (result.status == 200) {
if (result.data != undefined) {
resolve(decrypt(result.data))
} else {
resolve(result.message ?? '')
}
} else if (result.status == 401) {
removeUserInfo()
// token失效
reject(result.message)
} else {
reject(result.message)
}
},
fail: (error) => {
reject(error)
}
})
})
}
function withAuth(url, data = null, method = 'get', canSkip = false) {
return getAuth().then((auth) => {
if (auth || canSkip) {
return realFetch(url, data, method)
} else {
return realFetch(url, data, method)
}
})
}
function post(url, data = null, config = {}) {
return withAuth(url, data, 'post', config.canSkip)
}
function get(url, data = null, config = {}) {
return withAuth(url, data, 'get', config.canSkip)
}
module.exports = {
post,
get
}
\ No newline at end of file
export function setUserInfo(obj) {
uni.setStorageSync('TOKEN_ID', obj.token)
uni.setStorageSync('MOBILE', obj.mobile)
uni.setStorageSync('USER_ID', obj.pk_id)
uni.setStorageSync('CODE_ID', obj.idcode)
uni.setStorageSync('NICK_NAME', obj.nickName)
uni.setStorageSync('HEAD', obj.head)
uni.setStorageSync('OPENID', obj.openId)
uni.setStorageSync('ACTIVITE_FLAG', obj.activiteFlag == 1)
uni.setStorageSync('USER_GET_ONE_HOUR_VIP', obj.userGetOneHourVip)
uni.setStorageSync('IS_FOREVER', obj.isForever)
uni.setStorageSync('EXPIRE_TIME', obj.expireTime)
if (obj.expireTime > 0) {
uni.setStorageSync('VIP_FLAG', true)
} else {
uni.setStorageSync('VIP_FLAG', false)
}
// uni.setStorageSync('CREATE_TIME', obj.createTime)
if (obj.mobile != null || obj.mobile != '' || obj.openId != null || obj.openId != '') {
uni.setStorageSync('IS_TEMP_USER', false)
} else {
uni.setStorageSync('IS_TEMP_USER', true)
}
}
export function setBaseMsg(obj) {
uni.setStorageSync('MOBILE', obj.mobile)
uni.setStorageSync('USER_ID', obj.pk_id)
uni.setStorageSync('CODE_ID', obj.idcode)
uni.setStorageSync('NICK_NAME', obj.nickName)
uni.setStorageSync('HEAD', obj.head)
uni.setStorageSync('OPENID', obj.openId)
uni.setStorageSync('ACTIVITE_FLAG', obj.activiteFlag == 1)
uni.setStorageSync('USER_GET_ONE_HOUR_VIP', obj.userGetOneHourVip)
uni.setStorageSync('IS_FOREVER', obj.isForever)
uni.setStorageSync('EXPIRE_TIME', obj.expireTime)
if (obj.expireTime > 0) {
uni.setStorageSync('VIP_FLAG', 1)
} else {
uni.setStorageSync('VIP_FLAG', 0)
}
// uni.setStorageSync('CREATE_TIME', obj.createTime)
if (obj.mobile != null || obj.mobile != '' || obj.openId != null || obj.openId != '') {
uni.setStorageSync('IS_TEMP_USER', false)
} else {
uni.setStorageSync('IS_TEMP_USER', true)
}
}
export function removeUserInfo() {
// 清空
uni.clearStorage()
}
export function setMobile(obj) {
uni.setStorageSync('MOBILE', obj.mobile)
}
export function initUser() {
uni.getStorage('TOKEN_ID')
.then((data) => {
user.token = data
})
.catch((err) => {
user.token = ''
})
uni.getStorage('MOBILE')
.then((data) => {
user.mobile = data
})
.catch((err) => {
user.mobile = ''
})
uni.getStorage('USER_ID')
.then((data) => {
user.uid = data
})
.catch((err) => {
user.uid = ''
})
uni.getStorage('IS_TEMP_USER')
.then((data) => {
user.isTempUser = data
})
.catch((err) => {
user.isTempUser = ''
})
uni.getStorage('CODE_ID')
.then((data) => {
user.codeId = data
})
.catch((err) => {
user.codeId = ''
})
uni.getStorage('ACTIVITE_FLAG')
.then((data) => {
user.activiteFlag = data
})
.catch((err) => {
user.activiteFlag = false
})
uni.getStorage('USER_GET_ONE_HOUR_VIP')
.then((data) => {
user.userGetOneHourVip = data
})
.catch((err) => {
user.userGetOneHourVip = ''
})
uni.getStorage('IS_FOREVER')
.then((data) => {
user.isForever = data
})
.catch((err) => {
user.isForever = ''
})
uni.getStorage('NICK_NAME')
.then((data) => {
user.nickName = data
})
.catch((err) => {
user.nickName = ''
})
uni.getStorage('HEAD')
.then((data) => {
user.head = data
})
.catch((err) => {
user.head = ''
})
uni.getStorage('OPENID')
.then((data) => {
user.openId = data
})
.catch((err) => {
user.openId = ''
})
uni.getStorage('VIP_FLAG')
.then((data) => {
user.vipFlag = data
})
.catch((err) => {
user.vipFlag = 0
})
uni.getStorage('EXPIRE_TIME')
.then((data) => {
user.expireTime = data
})
.catch((err) => {
user.expireTime = 0
})
return user
}
export var user = {
token: '', // Token
mobile: '', // 手机号
uid: '', // 用户id
isTempUser: '', // 游客或登录用户
codeId: '', // 用户code
nickName: '', // 昵称
head: '', // 头像
openId: '', // 微信openId
activiteFlag: '', // 匹配用户
userGetOneHourVip: '', // 应用市场弹窗
isForever: '', // 永久会员
expireTime: '', // 会员到期时间
vipFlag: '', // 会员
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<picker @change="pickerChange" @columnchange="columnchange" :range="array" range-key="name" :value="value"
mode="multiSelector">
<slot></slot>
</picker>
</template>
<script>
import AllAddress from './AddressData.js'
import {
UserProfile
} from '@/common/constant/userProfile.js';
export default {
data() {
return {
value: [],
array: [],
index: 0
}
},
props: {
level: { //级数
type: Number,
default: 3
},
},
created() {
this.init()
},
methods: {
// 初始化地址选项
init() {
this.array = new Array(this.level);
for (let i = 0; i < this.array.length; i++) {
if (i == 0) {
// this.array[i] = AllAddress
this.array[i] = UserProfile.PROFILE_ZY.arr
} else {
this.array[i] = [];
if (this.array[i - 1][0].children != null) {
this.array[i] = this.array[i - 1][0].children;
}
}
}
this.$forceUpdate()
},
// 地址控件改变控件
columnchange(e) {
let aIndex = JSON.parse(JSON.stringify(e.detail.column + 1)); //第几组
let j = e.detail.value; //索引值
// console.log('e.detail',e.detail)
// console.log('选择:第'+ aIndex +'组,索引值为第' +j +'个 值为'+this.array[aIndex-1][j].name);
for (let i = aIndex; i < this.array.length; i++) {
//选的第几组 和索引值
//1、选第一组 children 默认第二组的第一个,第三组的值为第二组的第一个children
//2、选第二组 children 默认第三组的值为第二组的选中的children第一个值
this.array[i] = [];
console.log('this.array[i] ', i, )
if (e.detail.column === 0 && i === 2) {
if (this.array[i - 1][0].children != null) {
this.array[i] = this.array[i - 1][0].children;
}
} else {
if (this.array[i - 1][j].children != null) {
this.array[i] = this.array[i - 1][j].children;
}
}
// console.log('this.array[i] ',this.array[i] )
}
this.$forceUpdate();
},
//点击确定
pickerChange(e) {
var result = [];
for (let i = 0; i < this.array.length; i++) {
result.push({
name: this.array[i][e.target.value[i]].name,
id: this.array[i][e.target.value[i]].id
})
};
this.$emit('change', {
data: result
})
}
}
}
</script>
<style>
</style>
\ No newline at end of file
{
"name" : "智能扫描精灵",
"appid" : "__UNI__4941001",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : 1000,
"transformPx" : false,
"name": "智能扫描精灵",
"appid": "__UNI__4941001",
"description": "",
"versionName": "1.0.0",
"versionCode": 1000,
"transformPx": false,
/* 5+App特有相关 */
"app-plus" : {
"compatible" : {
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : false,
"autoclose" : true,
"delay" : 0
"app-plus": {
"compatible": {
"ignoreVersion": true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
},
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": false,
"autoclose": true,
"delay": 0
},
/* 模块配置 */
"modules" : {
"Payment" : {}
"modules": {
"Payment": {}
},
/* 应用发布信息 */
"distribute" : {
"distribute": {
/* android打包配置 */
"android" : {
"permissions" : [
"android": {
"permissions": [
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
......@@ -36,199 +36,193 @@
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>"
],
"permissionExternalStorage" : {
"request" : "none",
"prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
"permissionExternalStorage": {
"request": "none",
"prompt": "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
},
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
"autoSdkPermissions" : true,
"schemes" : "twofiveone"
"abiFilters": ["armeabi-v7a", "arm64-v8a", "x86"],
"autoSdkPermissions": true,
"schemes": "twofiveone"
},
/* ios打包配置 */
"ios" : {
"idfa" : false,
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "您在完成实名认证的过程中需要上传相关证件照片,故需获取您的相册读取权限。",
"NSCameraUsageDescription" : "您在完成实名认证的过程中需要上传相关证件照片,故需获取您的拍照权限。",
"NSPhotoLibraryAddUsageDescription" : "用于APP日常运行过程中文件存储与读取,包括但不限于上传下载、日志文件等。"
"ios": {
"idfa": false,
"privacyDescription": {
"NSPhotoLibraryUsageDescription": "您在完成实名认证的过程中需要上传相关证件照片,故需获取您的相册读取权限。",
"NSCameraUsageDescription": "您在完成实名认证的过程中需要上传相关证件照片,故需获取您的拍照权限。",
"NSPhotoLibraryAddUsageDescription": "用于APP日常运行过程中文件存储与读取,包括但不限于上传下载、日志文件等。"
},
"urltypes" : "twofiveone"
"urltypes": "twofiveone"
},
/* SDK配置 */
"sdkConfigs" : {
"share" : {
"weixin" : {
"appid" : "",
"UniversalLinks" : ""
}
},
"oauth" : {},
"ad" : {},
"payment" : {
"weixin" : {
"__platform__" : [ "ios", "android" ],
"appid" : "wxaa277a94b5a33c63",
"UniversalLinks" : ""
}
},
"speech" : {}
},
"icons" : {
"android" : {
"hdpi" : "",
"xhdpi" : "",
"xxhdpi" : "",
"xxxhdpi" : ""
},
"ios" : {
"appstore" : "",
"ipad" : {
"app" : "",
"app@2x" : "",
"notification" : "",
"notification@2x" : "",
"proapp@2x" : "",
"settings" : "",
"settings@2x" : "",
"spotlight" : "",
"spotlight@2x" : ""
},
"iphone" : {
"app@2x" : "",
"app@3x" : "",
"notification@2x" : "",
"notification@3x" : "",
"settings@2x" : "",
"settings@3x" : "",
"spotlight@2x" : "",
"spotlight@3x" : ""
}
}
},
"splashscreen" : {
"androidStyle" : "default",
"useOriginalMsgbox" : true,
"alwaysShowBeforeRender" : false,
"autoclose" : false,
"waiting" : false,
"delay" : 0,
"iosStyle" : "common",
"android" : {
"hdpi" : "",
"xhdpi" : "",
"xxhdpi" : ""
},
"ios" : {
"storyboard" : "unpackage/res/splash/LaunchScreen.storyboard_.zip"
}
}
},
"uniStatistics" : {
"enable" : true
"sdkConfigs": {
"share": {
"weixin": {
"appid": "",
"UniversalLinks": ""
}
},
"oauth": {},
"ad": {},
"payment": {
"weixin": {
"__platform__": ["ios", "android"],
"appid": "wxaa277a94b5a33c63",
"UniversalLinks": ""
}
},
"speech": {}
},
"icons": {
"android": {
"hdpi": "",
"xhdpi": "",
"xxhdpi": "",
"xxxhdpi": ""
},
"ios": {
"appstore": "",
"ipad": {
"app": "",
"app@2x": "",
"notification": "",
"notification@2x": "",
"proapp@2x": "",
"settings": "",
"settings@2x": "",
"spotlight": "",
"spotlight@2x": ""
},
"iphone": {
"app@2x": "",
"app@3x": "",
"notification@2x": "",
"notification@3x": "",
"settings@2x": "",
"settings@3x": "",
"spotlight@2x": "",
"spotlight@3x": ""
}
}
},
"splashscreen": {
"androidStyle": "default",
"useOriginalMsgbox": true,
"alwaysShowBeforeRender": false,
"autoclose": false,
"waiting": false,
"delay": 0,
"iosStyle": "common",
"android": {
"hdpi": "",
"xhdpi": "",
"xxhdpi": ""
},
"ios": {
"storyboard": "unpackage/res/splash/LaunchScreen.storyboard_.zip"
}
}
},
"uniStatistics": {
"enable": true
}
},
/* 快应用特有相关 */
"quickapp" : {},
"quickapp": {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wxaa277a94b5a33c63",
"setting" : {
"urlCheck" : false,
"es6" : false,
"postcss" : true,
"minified" : true
"mp-weixin": {
"appid": "wxaa277a94b5a33c63",
"setting": {
"urlCheck": false,
"es6": false,
"postcss": true,
"minified": true
},
"usingComponents" : true,
"uniStatistics" : {
"enable" : true
"usingComponents": true,
"uniStatistics": {
"enable": true
},
"optimization" : {
"subPackages" : true
"optimization": {
"subPackages": true
},
"lazyCodeLoading" : "requiredComponents" // 依赖按需注入
"lazyCodeLoading": "requiredComponents" // 依赖按需注入
},
"mp-alipay" : {
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
"mp-alipay": {
"usingComponents": true,
"uniStatistics": {
"enable": false
},
"appid" : "2021004129666486"
"appid": "2021004129666486"
},
"mp-baidu" : {
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
"mp-baidu": {
"usingComponents": true,
"uniStatistics": {
"enable": false
}
},
"mp-toutiao" : {
"usingComponents" : true,
"uniStatistics" : {
"enable" : false
"mp-toutiao": {
"usingComponents": true,
"uniStatistics": {
"enable": false
},
"appid" : "tt21e1575cbed7b45301"
"appid": "tt21e1575cbed7b45301"
},
"uniStatistics" : {
"enable" : false,
"version" : "2"
"uniStatistics": {
"enable": false,
"version": "2"
},
"vueVersion" : "2",
"h5" : {
"optimization" : {
"treeShaking" : {
"enable" : true
"vueVersion": "2",
"h5": {
"optimization": {
"treeShaking": {
"enable": true
}
},
"title" : "康陪侣",
"router" : {
"base" : "./"
"title": "爱短剧",
"router": {
"base": "./"
},
"uniStatistics" : {
"enable" : true
}
"uniStatistics": {
"enable": true
},
"mp-jd" : {
"uniStatistics" : {
"enable" : false
"devServer": {
"port": 8080,
"proxy": {
"/roseApi": {
"target": "https://api.mints-tech.cn/camera-api",
"changeOrgin": true, //是否跨域
"pathRewrite": {
"^/roseApi": ""
}
},
"mp-kuaishou" : {
"uniStatistics" : {
"enable" : false
"/api": {
"target": "https://api.mints-tech.cn/camera-api",
"changeOrgin": true, //是否跨域
"pathRewrite": {
"^/api": ""
}
}
}
}
},
"mp-lark" : {
"uniStatistics" : {
"enable" : false
"mp-jd": {
"uniStatistics": {
"enable": false
}
},
"mp-qq" : {
"uniStatistics" : {
"enable" : false
"mp-kuaishou": {
"uniStatistics": {
"enable": false
}
},
"quickapp-webview-huawei" : {
"uniStatistics" : {
"enable" : false
"mp-lark": {
"uniStatistics": {
"enable": false
}
},
"quickapp-webview-union" : {
"uniStatistics" : {
"enable" : false
"mp-qq": {
"uniStatistics": {
"enable": false
}
}
}
\ No newline at end of file
// "devServer" : {
// "proxy" : {
// "/https://nft-web.tech-mints.com" : {
// "target" : "https://nft-web.tech-mints.com",
// "changeOrgin" : true, //是否跨域
// "seure" : true, //是否支持https协议的代理
// "pathRewrite" : {
// "^/https://nft-web.tech-mints.com" : "/",
// "^/zs-ui/hap/https://nft-web.tech-mints.com" : "/"
// }
// }
// },
// "https" : true
// }
export default {
data() {
return {
method: 'GET',
url: '',
info: {}
};
},
onUnload() {
this.info = {}
},
methods: {
getData() {
return {};
},
dataLoaded() {},
loadData() {
let {
method,
url
} = this;
let data = this.getData();
this[method.toLowerCase()]({
url,
data,
success: ({
result
}) => {
this.info = result;
// console.log(result)
this.dataLoaded();
}
})
}
}
};
// export default {
// created() {
// //#ifdef MP-WEIXIN
// wx.showShareMenu({
// withShareTicket: true,
// menus: ['shareAppMessage', 'shareTimeline']
// });
// //#endif
// },
// }
export default {
data() {
return {
......
import AlmostLottery from '@/uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue';
export default {
data() {
return {
loading: true,
// 以下是转盘配置相关数据
lotteryConfig: {
// 抽奖转盘的整体尺寸,单位rpx
lotterySize: 700,
// 抽奖按钮的尺寸,单位rpx
action: {
width: 188,
height: 228,
top: 228 - 188,
padding: 85
},
imgCircled: false,
},
// 转盘外环图,如有需要,请参考替换为自己的设计稿
lotteryBg: require('@/static/turn/zp.png'),
// // 抽奖按钮图
actionBg: require('@/static/turn/point.png'),
// 以下是奖品配置数据
// 奖品数据
prizeList: [
],
// 中奖下标
prizeIndex: -1,
// 是否正在抽奖中,避免重复触发
prizeing: false,
}
},
components: {
AlmostLottery
},
methods:{
remoteGetPrizeIndex(prizeId) {
let list = [...this.prizeList]
// 拿到后端返回的 prizeId 后,开始循环比对得出那个中奖的数据
for (let i = 0; i < list.length; i++) {
let item = list[i]
if (item.prizeId === prizeId) {
this.prizeIndex = i
break
}
}
console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].prizeName)
// 如果奖品设有库存
},
// 抽奖转盘绘制完成
handleDrawFinish(res) {
console.log('抽奖转盘绘制完成', res)
}
}
}
import {
message,
loading,
redirectTo
} from "@/utils/fun.js"
const app = getApp();
export default {
data() {
return {
url: '',
imgList: [],
tempList: [],
current: 0,
count: 0,
leftHeight: 0,
rightHeight: 0,
};
},
methods: {
getData(page, size) {
return {
page,
size
}
},
loadData() {
if (!app.globalData.userInfo) {
// redirectTo('user/login');
return;
}
},
queryList(page, size) {
if (!app.globalData.userInfo) {
this.$refs.paging.complete([]);
return;
}
this.tempList = [];
this.current = 0;
if (page === 1) {
this.leftHeight = 0;
this.rightHeight = 0;
}
loading.show();
this.post({
url: this.url,
data: this.getData(page, size),
auth: true,
showLoading: false,
success: ({
data
}) => {
if (!data || !data.length) {
loading.hide();
this.$refs.paging.complete([]);
} else {
this.count = data.length;
this.imgList = data.map(item => {
item.url = `${item.url}?imageView2/2/w/250/interlace/1/q/99`;
return item;
});
this.loadImage();
}
},
fail: () => {
loading.hide();
}
});
},
loadImage() {
uni.getImageInfo({
src: this.imgList[this.current].url,
success: (image) => {
this.loadSuccess(image);
},
fail: () => {
this.imgList[this.current].url = this.imgList[this.current].url.replace(/\?imageView2.+/g, '');
uni.getImageInfo({
src: this.imgList[this.current].url,
success: (image) => {
this.loadSuccess(image);
}
})
}
})
},
loadSuccess(image) {
if (this.leftHeight <= this.rightHeight) {
this.imgList[this.current]['location'] = 'left';
this.leftHeight = this.leftHeight + image.height;
} else {
this.imgList[this.current]['location'] = 'right';
this.rightHeight = this.rightHeight + image.height;
}
this.current++;
if (this.current >= this.count) {
loading.hide();
this.$refs.paging.complete(this.imgList);
} else {
this.loadImage();
}
}
// loadImage({
// detail
// }, index, item) {
// item['index'] = index;
// item['height'] = 100 / detail.width * detail.height;
// console.log(detail.width, detail.height)
// this.tempList.push(Object.assign({}, item));
// if (this.tempList.length === this.count) {
// this.tempList = this.tempList.sort((a, b) => {
// return a.index - b.index
// })
// this.tempList = this.tempList.map(item => {
// if (this.leftHeight <= this.rightHeight) {
// item['location'] = 'left';
// item['leftHeight'] = this.leftHeight;
// this.leftHeight = this.leftHeight + item.height;
// } else {
// item['location'] = 'right';
// item['rightHeight'] = this.rightHeight;
// this.rightHeight = this.rightHeight + item.height;
// }
// return item;
// });
// loading.hide();
// this.imgList = [];
// this.$refs.paging.complete(this.tempList);
// }
// }
}
};
{
"name": "scan",
"name": "friends",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"@pdf-lib/fontkit": "^1.1.1",
"cropperjs": "^1.6.2",
"crypto-js": "^4.2.0",
"js-base64": "^3.7.7",
"js-md5": "^0.8.3",
"pdf-lib": "^1.17.1",
"uview": "^0.1.0"
}
......@@ -22,17 +26,6 @@
"node": ">=6.0.0"
}
},
"node_modules/@babel/runtime": {
"version": "7.24.5",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.24.5.tgz",
"integrity": "sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@pdf-lib/fontkit": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/@pdf-lib/fontkit/-/fontkit-1.1.1.tgz",
......@@ -57,12 +50,6 @@
"pako": "^1.0.10"
}
},
"node_modules/@types/raf": {
"version": "3.4.3",
"resolved": "https://registry.npmmirror.com/@types/raf/-/raf-3.4.3.tgz",
"integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
"optional": true
},
"node_modules/@vue/compiler-sfc": {
"version": "2.7.16",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz",
......@@ -82,68 +69,6 @@
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.12.2.tgz",
"integrity": "sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA=="
},
"node_modules/atob": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"bin": {
"atob": "bin/atob.js"
},
"engines": {
"node": ">= 4.5.0"
}
},
"node_modules/base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/btoa": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/btoa/-/btoa-1.2.1.tgz",
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==",
"bin": {
"btoa": "bin/btoa.js"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/canvg": {
"version": "3.0.10",
"resolved": "https://registry.npmmirror.com/canvg/-/canvg-3.0.10.tgz",
"integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==",
"optional": true,
"dependencies": {
"@babel/runtime": "^7.12.5",
"@types/raf": "^3.4.0",
"core-js": "^3.8.3",
"raf": "^3.4.1",
"regenerator-runtime": "^0.13.7",
"rgbcolor": "^1.0.1",
"stackblur-canvas": "^2.0.0",
"svg-pathdata": "^6.0.3"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/canvg/node_modules/core-js": {
"version": "3.37.0",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.37.0.tgz",
"integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==",
"hasInstallScript": true,
"optional": true
},
"node_modules/canvg/node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
"optional": true
},
"node_modules/core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
......@@ -151,13 +76,15 @@
"deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.",
"hasInstallScript": true
},
"node_modules/css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/css-line-break/-/css-line-break-2.1.0.tgz",
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
"dependencies": {
"utrie": "^1.0.2"
}
"node_modules/cropperjs": {
"version": "1.6.2",
"resolved": "https://registry.npmmirror.com/cropperjs/-/cropperjs-1.6.2.tgz",
"integrity": "sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA=="
},
"node_modules/crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"node_modules/csstype": {
"version": "3.1.3",
......@@ -173,52 +100,15 @@
"node": ">=0.10.0"
}
},
"node_modules/dompurify": {
"version": "2.5.3",
"resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-2.5.3.tgz",
"integrity": "sha512-09uyBM2URzOfXMUAqGRnm9R9IUeSkzO9PktXc2eVQIsBmmJUqRmfL1xW2QPBxVJEtlEVs5d8ndrsIQsyAqs81g==",
"optional": true
},
"node_modules/fflate": {
"version": "0.4.8",
"resolved": "https://registry.npmmirror.com/fflate/-/fflate-0.4.8.tgz",
"integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA=="
},
"node_modules/html2canvas": {
"version": "1.4.1",
"resolved": "https://registry.npmmirror.com/html2canvas/-/html2canvas-1.4.1.tgz",
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
"dependencies": {
"css-line-break": "^2.1.0",
"text-segmentation": "^1.0.3"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/jspdf": {
"version": "2.5.1",
"resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.1.tgz",
"integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==",
"dependencies": {
"@babel/runtime": "^7.14.0",
"atob": "^2.1.2",
"btoa": "^1.2.1",
"fflate": "^0.4.8"
},
"optionalDependencies": {
"canvg": "^3.0.6",
"core-js": "^3.6.0",
"dompurify": "^2.2.0",
"html2canvas": "^1.0.0-rc.5"
}
"node_modules/js-base64": {
"version": "3.7.7",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz",
"integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
},
"node_modules/jspdf/node_modules/core-js": {
"version": "3.37.0",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.37.0.tgz",
"integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==",
"hasInstallScript": true,
"optional": true
"node_modules/js-md5": {
"version": "0.8.3",
"resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.8.3.tgz",
"integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ=="
},
"node_modules/nanoid": {
"version": "3.3.7",
......@@ -248,12 +138,6 @@
"tslib": "^1.11.1"
}
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"optional": true
},
"node_modules/picocolors": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.1.tgz",
......@@ -293,29 +177,6 @@
"node": ">=10.13.0"
}
},
"node_modules/raf": {
"version": "3.4.1",
"resolved": "https://registry.npmmirror.com/raf/-/raf-3.4.1.tgz",
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
"optional": true,
"dependencies": {
"performance-now": "^2.1.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"node_modules/rgbcolor": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/rgbcolor/-/rgbcolor-1.0.1.tgz",
"integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
"optional": true,
"engines": {
"node": ">= 0.8.15"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
......@@ -334,45 +195,11 @@
"node": ">=0.10.0"
}
},
"node_modules/stackblur-canvas": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
"integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
"optional": true,
"engines": {
"node": ">=0.1.14"
}
},
"node_modules/svg-pathdata": {
"version": "6.0.3",
"resolved": "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
"integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
"optional": true,
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/text-segmentation": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/text-segmentation/-/text-segmentation-1.0.3.tgz",
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
"dependencies": {
"utrie": "^1.0.2"
}
},
"node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/utrie": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/utrie/-/utrie-1.0.2.tgz",
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
"dependencies": {
"base64-arraybuffer": "^1.0.2"
}
},
"node_modules/uview": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/uview/-/uview-0.1.0.tgz",
......@@ -410,14 +237,6 @@
"integrity": "sha512-EOv5IK8arwh3LI47dz1b0tKUb/1uhHAnHJOrjgtQMIpu1uXd9mlFrJg9IUgGUgZ41Ch0K8REPTYpO7B76b4vJg==",
"peer": true
},
"@babel/runtime": {
"version": "7.24.5",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.24.5.tgz",
"integrity": "sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==",
"requires": {
"regenerator-runtime": "^0.14.0"
}
},
"@pdf-lib/fontkit": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/@pdf-lib/fontkit/-/fontkit-1.1.1.tgz",
......@@ -442,12 +261,6 @@
"pako": "^1.0.10"
}
},
"@types/raf": {
"version": "3.4.3",
"resolved": "https://registry.npmmirror.com/@types/raf/-/raf-3.4.3.tgz",
"integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==",
"optional": true
},
"@vue/compiler-sfc": {
"version": "2.7.16",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz",
......@@ -465,63 +278,20 @@
"resolved": "https://registry.npmmirror.com/async-validator/-/async-validator-1.12.2.tgz",
"integrity": "sha512-57EETfCPFiB7M4QscvQzWSGNsmtkjjzZv318SK1CBlstk+hycV72ocjriMOOM48HjvmoAoJGpJNjC7Z76RlnZA=="
},
"atob": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg=="
},
"base64-arraybuffer": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz",
"integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ=="
},
"btoa": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/btoa/-/btoa-1.2.1.tgz",
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g=="
},
"canvg": {
"version": "3.0.10",
"resolved": "https://registry.npmmirror.com/canvg/-/canvg-3.0.10.tgz",
"integrity": "sha512-qwR2FRNO9NlzTeKIPIKpnTY6fqwuYSequ8Ru8c0YkYU7U0oW+hLUvWadLvAu1Rl72OMNiFhoLu4f8eUjQ7l/+Q==",
"optional": true,
"requires": {
"@babel/runtime": "^7.12.5",
"@types/raf": "^3.4.0",
"core-js": "^3.8.3",
"raf": "^3.4.1",
"regenerator-runtime": "^0.13.7",
"rgbcolor": "^1.0.1",
"stackblur-canvas": "^2.0.0",
"svg-pathdata": "^6.0.3"
},
"dependencies": {
"core-js": {
"version": "3.37.0",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.37.0.tgz",
"integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==",
"optional": true
},
"regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
"optional": true
}
}
},
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-2.6.12.tgz",
"integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ=="
},
"css-line-break": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/css-line-break/-/css-line-break-2.1.0.tgz",
"integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==",
"requires": {
"utrie": "^1.0.2"
}
"cropperjs": {
"version": "1.6.2",
"resolved": "https://registry.npmmirror.com/cropperjs/-/cropperjs-1.6.2.tgz",
"integrity": "sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA=="
},
"crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"csstype": {
"version": "3.1.3",
......@@ -534,48 +304,15 @@
"resolved": "https://registry.npmmirror.com/deepmerge/-/deepmerge-1.5.2.tgz",
"integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ=="
},
"dompurify": {
"version": "2.5.3",
"resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-2.5.3.tgz",
"integrity": "sha512-09uyBM2URzOfXMUAqGRnm9R9IUeSkzO9PktXc2eVQIsBmmJUqRmfL1xW2QPBxVJEtlEVs5d8ndrsIQsyAqs81g==",
"optional": true
},
"fflate": {
"version": "0.4.8",
"resolved": "https://registry.npmmirror.com/fflate/-/fflate-0.4.8.tgz",
"integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA=="
},
"html2canvas": {
"version": "1.4.1",
"resolved": "https://registry.npmmirror.com/html2canvas/-/html2canvas-1.4.1.tgz",
"integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==",
"requires": {
"css-line-break": "^2.1.0",
"text-segmentation": "^1.0.3"
}
"js-base64": {
"version": "3.7.7",
"resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz",
"integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw=="
},
"jspdf": {
"version": "2.5.1",
"resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.1.tgz",
"integrity": "sha512-hXObxz7ZqoyhxET78+XR34Xu2qFGrJJ2I2bE5w4SM8eFaFEkW2xcGRVUss360fYelwRSid/jT078kbNvmoW0QA==",
"requires": {
"@babel/runtime": "^7.14.0",
"atob": "^2.1.2",
"btoa": "^1.2.1",
"canvg": "^3.0.6",
"core-js": "^3.6.0",
"dompurify": "^2.2.0",
"fflate": "^0.4.8",
"html2canvas": "^1.0.0-rc.5"
},
"dependencies": {
"core-js": {
"version": "3.37.0",
"resolved": "https://registry.npmmirror.com/core-js/-/core-js-3.37.0.tgz",
"integrity": "sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==",
"optional": true
}
}
"js-md5": {
"version": "0.8.3",
"resolved": "https://registry.npmmirror.com/js-md5/-/js-md5-0.8.3.tgz",
"integrity": "sha512-qR0HB5uP6wCuRMrWPTrkMaev7MJZwJuuw4fnwAzRgP4J4/F8RwtodOKpGp4XpqsLBFzzgqIO42efFAyz2Et6KQ=="
},
"nanoid": {
"version": "3.3.7",
......@@ -599,12 +336,6 @@
"tslib": "^1.11.1"
}
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",
"optional": true
},
"picocolors": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.1.tgz",
......@@ -634,26 +365,6 @@
"optional": true,
"peer": true
},
"raf": {
"version": "3.4.1",
"resolved": "https://registry.npmmirror.com/raf/-/raf-3.4.1.tgz",
"integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==",
"optional": true,
"requires": {
"performance-now": "^2.1.0"
}
},
"regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"rgbcolor": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/rgbcolor/-/rgbcolor-1.0.1.tgz",
"integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==",
"optional": true
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz",
......@@ -666,39 +377,11 @@
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
"peer": true
},
"stackblur-canvas": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz",
"integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==",
"optional": true
},
"svg-pathdata": {
"version": "6.0.3",
"resolved": "https://registry.npmmirror.com/svg-pathdata/-/svg-pathdata-6.0.3.tgz",
"integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==",
"optional": true
},
"text-segmentation": {
"version": "1.0.3",
"resolved": "https://registry.npmmirror.com/text-segmentation/-/text-segmentation-1.0.3.tgz",
"integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==",
"requires": {
"utrie": "^1.0.2"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"utrie": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/utrie/-/utrie-1.0.2.tgz",
"integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==",
"requires": {
"base64-arraybuffer": "^1.0.2"
}
},
"uview": {
"version": "0.1.0",
"resolved": "https://registry.npmmirror.com/uview/-/uview-0.1.0.tgz",
......
{
"uni-app": {
"scripts": {
"mp-dingtalk": {
"title": "钉钉小程序",
"env": {
"UNI_PLATFORM": "mp-alipay"
},
"define": {
"MP-DINGTALK": true
}
},
"mp-weixin-test": {
"title": "本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
},
"mp-app-test": {
"title": "App 本地测试版本",
"env": {
"UNI_PLATFORM": "mp-weixin"
},
"define": {
"MP-APP-TEST": true
}
}
"dev": "cross-env NODE_ENV=development uniapp-cli build --watch",
"build:prod": "cross-env NODE_ENV=production uniapp-cli build"
}
},
"dependencies": {
"@pdf-lib/fontkit": "^1.1.1",
"pdf-lib": "^1.17.1",
"cropperjs": "^1.6.2",
"crypto-js": "^4.2.0",
"js-base64": "^3.7.7",
"js-md5": "^0.8.3",
"uview": "^0.1.0"
}
}
\ No newline at end of file
......@@ -20,14 +20,15 @@
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "#000000"
"navigationBarTextStyle": "black"
}
}, {
"path": "pages/brower/brower",
},
{
"path": "pages/login/login",
"style": {
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white"
}
}
],
......@@ -52,105 +53,33 @@
}
}]
}, {
"root": "pagesC",
"root": "pagesB",
"pages": [{
"path": "scan/scan",
"style": {
"navigationBarTitleText": "扫描",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
}, {
"path": "edit/edit",
"path": "auth/auth",
"style": {
"navigationBarTitleText": "编辑",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "真人认证",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white"
}
}, {
"path": "result/result",
"style": {
"navigationBarTitleText": "识别结果",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
},
{
"path": "measure/measure",
"style": {
"navigationBarTitleText": "AR测量",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
},
{
"path": "measureinfo/measureinfo",
"style": {
"navigationBarTitleText": "测量介绍",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
},
{
"path": "measurescan/measurescan",
"path": "label/label",
"style": {
"navigationBarTitleText": "测量拍摄",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
},
{
"path": "measureresult/measureresult",
"style": {
"navigationBarTitleText": "测量拍摄",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black"
}
},
{
"path": "superresult/superresult",
"style": {
"navigationBarTitleText": "万能识别结果",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
}
},
{
"path": "transresult/transresult",
"style": {
"navigationBarTitleText": "翻译结果",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
}
},
{
"path": "excelocr/excelocr",
"style": {
"navigationBarTitleText": "表格识别",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
"navigationBarTitleText": "个性标签",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white",
"app-plus": {
"titleNView": {
"buttons": [{
"text": "确定",
"color": "#E9D07E",
"fontSize": "14px"
}]
}
},
{
"path": "excelresult/excelresult",
"style": {
"navigationBarTitleText": "识别结果",
"navigationStyle": "default",
"navigationBarBackgroundColor": "#2196f3",
"navigationBarTextStyle": "black"
}
}
]
}]
}, {
"root": "pagesD",
"pages": [{
......@@ -264,7 +193,7 @@
// 当我们进入了pages/home页面以后就会预下载pagesA分包
"pages/home": {
"network": "all", //在指定网络下预下载,可选值为:all(不限网络)、wifi(仅wifi下预下载)
"packages": ["pagesA", "pagesC", "pagesD"] //进入页面后预下载分包
"packages": ["pagesA", "pagesB", "pagesD"] //进入页面后预下载分包
}
},
"globalStyle": {
......
<template>
<view class="container">
<view class="title">短信验证码登录/注册</view>
<view class="input-group">
<input class="input" type="number" placeholder="+86 输入手机号" v-model="phoneNumber" />
</view>
<view class="input-group">
<input class="input" type="number" placeholder="输入验证码" v-model="verificationCode" />
<view class="get-code-btn" @click="getVerificationCode">获取验证码</view>
</view>
<button class="login-btn" @click="login">登录</button>
<view class="agreement">
<checkbox-group @change="agreeToTerms">
<label>
<checkbox value="agree" /> 已阅读并同意用户协议和隐私政策
</label>
</checkbox-group>
</view>
</view>
</template>
<script>
import {
mobileLogin,
sendMobileCode
} from '@/common/api/user.js'
import {
redirectTo,
message,
} from '@/utils/fun.js';
const app = getApp();
export default {
name: 'index',
data() {
return {
phoneNumber: '',
verificationCode: '',
agreed: false
};
},
methods: {
getVerificationCode() {},
login() {},
switchToPasswordLogin() {},
agreeToTerms(e) {
this.agreed = e.detail.value.includes('agree');
}
}
};
</script>
<style scoped>
.container {
height: 100vh;
background-color: black;
padding: 20rpx;
display: flex;
flex-direction: column;
}
.title {
margin-top: 150rpx;
font-size: 40rpx;
margin-bottom: 20rpx;
color: white;
}
.input-group {
position: relative;
margin-top: 50rpx;
}
.input {
width: 90%;
color: white;
border-bottom: solid 1rpx #555555;
background-color: transparent;
height: 80rpx;
padding: 15rpx;
}
.get-code-btn {
right: 10%;
top: 40rpx;
position: absolute;
color: white;
}
.login-btn {
width: 90%;
background-color: #E8CF83;
color: black;
border: none;
margin-top: 100rpx;
border-radius: 50rpx;
}
.switch-login {
text-align: center;
margin-bottom: 15rpx;
}
.agreement {
margin-top: 100rpx;
color: white;
text-align: center;
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="steps">
<text :class="step>=1?'steps-item-s':'steps-item'">1</text>
<view class="steps-line"></view>
<text :class="step>=2?'steps-item-s':'steps-item'">2</text>
<view class="steps-line"></view>
<text :class="step>=3?'steps-item-s':'steps-item'">3</text>
<view class="steps-line"></view>
<text :class="step>=4?'steps-item-s':'steps-item'">4</text>
</view>
<view v-if="step==1">
<view class="step-section">
<text class="step-title">上传头像</text>
<image v-if="!croppedImageUrl" mode="aspectFill" src="/static/auth/upload_avatar.png"
@click="uploadImage" style="width: 216px;height: 131px;margin: 0 auto;"></image>
<image v-else mode="aspectFill" :src="croppedImageUrl" @click="uploadImage"
style="width: 150px;height: 150px;margin: 0 auto;"></image>
</view>
<view class="step-section">
<text class="step-title">头像规范</text>
<image mode="aspectFill" src="/static/auth/rule_avatar.png"
style="width: 298px;height: 78px;margin: 0 auto;"></image>
</view>
</view>
<view v-if="step==3">
<view class="step-container">
<view class="form-item">
<text>身高</text>
<picker mode="selector" :range="heightRange" @change="onHeightChange">
<view class="picker">{{ selectedHeight || '请选择您的身高' }}</view>
</picker>
</view>
<view class="form-item">
<text>体重</text>
<picker mode="selector" :range="weightRange" @change="onWeightChange">
<view class="picker">{{ selectedWeight || '请选择您的体重' }}</view>
</picker>
</view>
<view class="form-item">
<text>身型</text>
<picker mode="selector" :range="bodyTypeRange" @change="onBodyTypeChange">
<view class="picker">{{ selectedBodyType || '请选择您的身型' }}</view>
</picker>
</view>
<view class="form-item">
<text>交友范围(可多选)</text>
<view class="picker" @click="openPicker">{{ selectedFriendRange || '请选择您的交友范围' }}</view>
</view>
<view class="form-item">
<text>职业</text>
<AddressPicker @change="change" :level="2">
<view class="picker">{{ selectedOccupation || '请选择您的职业' }}</view>
</AddressPicker>
</view>
<view class="form-item">
<text>个性标签</text>
<view class="picker" @click="openTags">{{ allTags.length>0 ?personalityTags:'请选择您的个性标签' }}</view>
</view>
<view class="tags-container">
<view v-for="(tag, index) in allTags" :key="index" class="tag">
<text>{{ tag.name }}</text>
</view>
</view>
</view>
</view>
<view v-if="step==4">
<view class="step-section">
<text class="step-title">添加联系方式</text>
<text class="step-info">我们会保护你的隐私,联系方式只是展示给审核人员和付费后的VIP男士。</text>
</view>
<view class="step-section">
<text class="step-title">添加联系方式</text>
<input type="text" placeholder="请输入您的微信号" @input="showChangePrompt" :value="wxCode" />
</view>
<view class="step-section">
<text class="step-title">添加微信二维码</text>
<image v-if="!croppedImageUrl" mode="aspectFill" src="/static/auth/upload_avatar.png"
@click="uploadImage" style="width: 216px;height: 131px;margin: 0 auto;"></image>
<image v-else mode="aspectFill" :src="croppedImageUrl" @click="uploadImage"
style="width: 150px;height: 150px;margin: 0 auto;"></image>
</view>
</view>
<image class="next-button" src="/static/auth/next.png" @click="doNext"></image>
<!-- 用于显示原始图片和裁剪框 -->
<view class="crop-container" v-if="tempPath">
<div class="image-container">
<img class="crop-img" ref="imageRef" :src="tempPath" alt="原始图片" />
<!-- 裁剪操作按钮 -->
<button class="crop-button" @click="cropImage" v-if="cropper">裁剪</button>
</div>
</view>
<cc-selectDity :province="province" :city="city" :show="show" :hideArea="true" @changeClick="changeClick"
@sureSelectArea="onsetCity" @hideShow="onhideShow"></cc-selectDity>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
mobileLogin
} from '@/common/api/user.js'
import Cropper from 'cropperjs';
import 'cropperjs/dist/cropper.css';
import {
navigateTo,
message,
loading
} from '@/utils/fun.js';
import AddressPicker from "@/components/address-picker/AddressPicker.vue"
import {
UserProfile
} from '@/common/constant/userProfile.js';
const app = getApp();
export default {
name: 'auth',
mixins: [common],
components: {
AddressPicker
},
data() {
return {
step: 3,
avatarUrl: '',
tempPath: '',
imageType: '',
cropper: null,
croppedImageUrl: '',
heightRange: UserProfile.PROFILE_SG.arr,
weightRange: UserProfile.PROFILE_TZ.arr,
bodyTypeRange: UserProfile.PROFILE_SX.arr,
selectedHeight: '',
selectedWeight: '',
selectedBodyType: '',
selectedFriendRange: '',
selectedOccupation: '',
personalityTags: '',
show: false,
province: "广东省",
city: "广州市",
wxCode: '',
wxCodeUrl: '',
allTags: [],
isWeChatBrowser: false
};
},
onLoad(option) {
this.getIsWxBrower()
mobileLogin({
mobile: 18311400069,
smsCode: 1234
}).then(data => {
})
.catch((err) => {
})
},
onShow() {
if (this.trace_source != undefined) {
this.allTags = this.trace_source.message
if (this.allTags.length > 0) {
for (var i = 0; i < this.allTags.length; i++) {
if (i == 0) {
this.personalityTags = this.allTags[i].name
} else {
this.personalityTags += '-' + this.allTags[i].name
}
}
}
}
},
methods: {
getIsWxBrower() {
const ua = window.navigator.userAgent.toLowerCase()
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
this.isWeChatBrowser = true
} else {
this.isWeChatBrowser = false
}
},
doNext() {
if (this.step == 1) {
if (this.croppedImageUrl == undefined || this.croppedImageUrl == null || this.croppedImageUrl == '') {
message.notify('请先上传头像')
return
}
loading.show('上传头像中')
this.uploadImg(this.croppedImageUrl)
} else if (this.step == 2) {
} else if (this.step == 3) {
if (this.selectedHeight == undefined || this.selectedHeight == null || this.selectedHeight == '') {
message.notify('请选择您的身高')
return
}
if (this.selectedWeight == undefined || this.selectedWeight == null || this.selectedWeight == '') {
message.notify('请选择您的体重')
return
}
if (this.selectedBodyType == undefined || this.selectedBodyType == null || this.selectedBodyType ==
'') {
message.notify('请选择您的身型')
return
}
if (this.selectedFriendRange == undefined || this.selectedFriendRange == null ||
this.selectedFriendRange == '') {
message.notify('请选择您的交友范围')
return
}
if (this.selectedOccupation == undefined || this.selectedOccupation == null ||
this.selectedOccupation == '') {
message.notify('请选择您的职业')
return
}
if (this.allTags == undefined || this.allTags.length == 0) {
message.notify('请选择您的个性标签')
return
}
} else if (this.step == 4) {
if (this.wxCode == undefined || this.wxCode == null ||
this.wxCode == '') {
message.notify('请输入您的微信号')
return
}
if (this.wxCode == undefined || this.wxCode == null ||
this.wxCode == '') {
message.notify('请上传您的微信二维码')
return
}
}
},
uploadImage() {
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
success: (res) => {
this.tempPath = res.tempFilePaths;
// 裁剪图片
this.$nextTick(() => {
this.initCropper();
});
}
});
},
uploadImg(tempFilePath) {
if (this.step == 1) {
} else if (this.step == 4) {
}
let that = this;
let tempUrl = '/ai/image/upload';
uni.uploadFile({
url: `${app.globalData.baseUrl}${tempUrl}`,
filePath: tempFilePath,
header: {
'content-type': 'multipart/form-data',
pkgname: app.globalData.pkgName,
token: uni.getStorageSync('token')
},
name: 'file',
formData: {
"type": this.imageType
},
success: (uploadFileRes) => {
let data = JSON.parse(uploadFileRes.data)
if (this.step == 1) {
that.avatarUrl = data.data.url
} else if (this.step == 4) {
that.wxCodeUrl = data.data.url
}
},
fail: (res) => {
loading.hide()
uni.hideLoading()
}
});
},
// 初始化 Cropper 实例的方法
initCropper() {
const image = this.$refs.imageRef;
this.cropper = new Cropper(image, {
aspectRatio: 1, // 裁剪框的宽高比,这里设置为 1:1
viewMode: 1, // 裁剪框的显示模式
autoCropArea: 0.8, // 初始裁剪区域占图片的比例
movable: true, // 裁剪框是否可移动
zoomable: true, // 图片是否可缩放
rotatable: false, // 图片是否可旋转
scalable: true // 裁剪框是否可缩放
});
},
// 执行裁剪操作的方法
cropImage() {
if (this.cropper) {
const canvas = this.cropper.getCroppedCanvas();
this.croppedImageUrl = canvas.toDataURL('image/jpeg');
this.tempPath = ''
// 销毁 Cropper 实例
this.cropper.destroy();
this.cropper = null;
}
},
// step-3
onHeightChange(e) {
this.selectedHeight = this.heightRange[e.detail.value];
},
onWeightChange(e) {
this.selectedWeight = this.weightRange[e.detail.value];
},
onBodyTypeChange(e) {
this.selectedBodyType = this.bodyTypeRange[e.detail.value];
},
openPicker() {
console.log('执行打开地址选择器')
this.show = true
},
changeClick(value, value2, value3, value4) {
console.log('地址选择器 = ' + value + value2 + value3 + value4);
this.province = value;
this.city = value2;
},
onhideShow() {
this.show = false
console.log('执行了关闭地址选择器')
},
//选中省市区
onsetCity(e) {
let data = e.detail.target.dataset;
let address = data.province + '-' + data.city;
this.show = false
this.selectedFriendRange = address
},
change(result) {
console.log(JSON.stringify(result.data));
let planLocate = '';
result.data.forEach((item, index) => {
if (index === 0) {
planLocate += item.name
} else {
planLocate += '-' + item.name
}
});
this.selectedOccupation = planLocate
},
openTags() {
navigateTo(`/pagesB/label/label`)
},
// step-4
showChangePrompt(e) {
this.wxCode = e.detail.value
},
}
};
</script>
<style lang="scss">
.body {
background-color: black;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 150rpx;
}
.steps {
display: flex;
justify-content: space-around;
align-items: center;
color: white;
margin: 0 50rpx;
}
.steps-line {
width: 30rpx;
height: 1rpx;
background: #818181;
}
.steps-item-s {
text-align: center;
line-height: 50rpx;
width: 50rpx;
height: 50rpx;
border-radius: 50rpx;
background: #E8C265;
color: black;
}
.steps-item {
text-align: center;
line-height: 50rpx;
width: 50rpx;
height: 50rpx;
border-radius: 50rpx;
background: #999999;
color: white;
}
.step-section {
display: flex;
flex-direction: column;
color: white;
margin-top: 50rpx;
}
.step-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
.step-info {
color: #999999;
font-size: 26rpx;
font-weight: bold;
margin-bottom: 30rpx;
}
.next-button {
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 50px;
width: 50px;
height: 50px;
z-index: 2;
}
.crop-container {
position: absolute;
z-index: 999;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
}
.image-container {
position: absolute;
max-width: 100%;
max-height: 60%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.crop-button {
margin-top: 10px;
width: 120px;
color: black;
background: white;
}
.step-container {
margin-top: 50rpx;
padding: 20rpx;
}
.form-item {
color: white;
margin-bottom: 30rpx;
}
.picker {
margin-top: 10rpx;
border: 1rpx solid #ccc;
padding: 15rpx;
color: white;
border-radius: 5rpx;
}
input {
color: white;
border: 1rpx solid #ccc;
padding: 15rpx;
border-radius: 5rpx;
}
.tags-container {
display: flex;
flex-wrap: wrap;
}
.tag {
padding: 5rpx 20rpx;
margin: 0 10rpx;
color: #9C9AA5;
background-color: #272530;
border-radius: 50rpx;
cursor: pointer;
text {
font-size: 20rpx;
}
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="header">
<text>已选择</text>
<text class="header-select">{{ selectedTags.length }}/{{maxSelectLimit}}</text>
</view>
<view class="tabs-section" v-if="isLike">
<view class="all-tags-container">
<view v-for="(tag, index) in likeTags" :key="index" :class="!tag.s?'tag':'tag_s'"
@click="toggleTag(tag)">
<text>{{ tag.name }}</text>
</view>
</view>
</view>
<view v-else>
<view class="tabs-section">
<text class="margin-b20">日常</text>
<view class="all-tags-container">
<view v-for="(tag, index) in usualTags" :key="index" :class="!tag.s?'tag':'tag_s'"
@click="toggleTag(tag)">
<text>{{ tag.name }}</text>
</view>
</view>
</view>
<view class="tabs-section">
<text class="margin-b20">特质</text>
<view class="all-tags-container">
<view v-for="(tag, index) in specialTags" :key="index" :class="!tag.s?'tag':'tag_s'"
@click="toggleTag(tag)">
<text>{{ tag.name }}</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
UserProfile
} from '@/common/constant/userProfile.js';
import {
message,
loading
} from '@/utils/fun.js';
const app = getApp();
export default {
name: 'index',
mixins: [common],
data() {
return {
maxSelectLimit: 6,
selectedTags: [],
usualTags: [],
specialTags: [],
likeTags: [],
isLike: false
};
},
onLoad(option) {
this.isLike = option.like
this.initData()
},
onNavigationBarButtonTap() {
this.goBack()
},
onShow() {
this.selectedTags = []
},
methods: {
goBack() {
const data = {
message: this.selectedTags
};
let pages = getCurrentPages(); //获取所有页面栈实例列表
let nowPage = pages[pages.length - 1]; //当前页页面实例
let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.trace_source = data //修改上一页data里面的地址
uni.navigateBack({})
},
initData() {
if (!this.isLike) {
// 男性
this.usualTags = UserProfile.USUAL_LABEL_MALE.arr
this.specialTags = UserProfile.SPECIAL_LABEL_MALE.arr
// 女性
this.usualTags = UserProfile.USUAL_LABEL_FEMALE.arr
this.specialTags = UserProfile.SPECIAL_LABEL_FEMALE.arr
} else {
this.likeTags = UserProfile.SPECIAL_LIKE_FEMALE.arr
}
},
toggleTag(tag) {
const index = this.selectedTags.indexOf(tag);
if (index === -1) {
if (this.selectedTags.length < 6) {
tag.s = true
this.selectedTags.push(tag);
}
} else {
tag.s = false
this.selectedTags.splice(index, 1);
}
}
}
};
</script>
<style lang="scss">
.body {
background-color: black;
padding-left: 30rpx;
padding-right: 30rpx;
padding-top: 150rpx;
}
.header {
font-size: 36rpx;
margin-bottom: 20rpx;
color: white;
}
.header-select {
font-size: 36rpx;
margin-left: 10rpx;
color: #E8CF83;
}
.tabs-section {
display: flex;
flex-direction: column;
color: white;
margin-top: 50rpx;
}
.all-tags-container {
display: flex;
flex-wrap: wrap;
}
.tag {
padding: 10rpx 20rpx;
margin: 10rpx;
color: #9C9AA5;
background-color: #272530;
border-radius: 50rpx;
cursor: pointer;
}
.tag_s {
padding: 10rpx 20rpx;
margin: 10rpx;
color: #0B0907;
background-color: #E9D07E;
border-radius: 50rpx;
cursor: pointer;
}
.tag text {
font-size: 26rpx;
}
</style>
\ No newline at end of file
<template>
<view class="wrapper">
<view class="show-img">
<image style="width: 80%;height: 90%;" :src="imgUri" mode="widthFix"></image>
</view>
<view class="item-bottom">
<view class="item-bottom-content" @click="crop">
<image class="img" src="../../static/ic_copy.png"></image>
<text class="text1">裁剪</text>
</view>
<view class="item-bottom-content" @click="clickOcr">
<image class="img2" src="../../static/ic_scan_ocr.png"></image>
<text class="text1">识别</text>
</view>
</view>
<l-clipper v-if="showlip" :image-url="tempUri" :isShowPhotoBtn="false" type="2d" :minWidth="400" :maxHeight="400"
@success="clipperSuc" @cancel="showlip = false" />
</view>
</template>
<script>
import {
pdfFn
} from '../../utils/pdf.js'
import {
navigateBack
} from '@/utils/fun';
import common from '@/mixins/common';
import {
ScanIndexBean,
ScanTypeBean
} from '@/utils/constant.js'
const app = getApp();
import {
navigateTo,
message,
redirectTo
} from '@/utils/fun';
export default {
name: 'edit',
mixins: [common],
data() {
return {
imgUri: '',
tempUri: '',
tempPath: '',
userBean: {},
type: '',
ocrUrl: '',
scantype: '',
showlip: false
};
},
onLoad(option) {
this.tempUri = decodeURIComponent(option.uri)
this.type = option.type
if (this.type == 0) {
// 万能识别
this.scantype = ScanTypeBean.advanced_general
} else if (option.type == 1) {
// 身份证
// this.scantype = ScanTypeBean.idcard_front
this.scantype = decodeURIComponent(option.cardType)
} else if (option.type == 2) {
// 拍照翻译
this.scantype = ScanTypeBean.fanyi
} else if (option.type == 3) {
// 文字识别
this.scantype = ScanTypeBean.accurate_basic
} else if (option.type == 4) {
// 文件识别
this.scantype = ScanTypeBean.accurate_basic
} else if (option.type == 5) {
// 表格识别
this.scantype = ScanTypeBean.img_to_excel
} else if (option.type == 6) {
// 图片转pdf
this.scantype = ScanTypeBean.scan_pdf
}
},
onShow() {
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
},
methods: {
loadData() {
setTimeout(() => {
this.compress();
}, 200);
},
crop() {
this.showlip = true
},
compress() {
uni.showLoading({
title: '加载中...'
})
let that = this
// #ifdef MP-TOUTIAO
tt.compressImage({
src: that.tempUri,
quality: 80,
success: res => {
console.log('compressImage22223333',res)
that.uploadImg(res.tempFilePath)
},
fail: err => {
that.uploadImg(that.tempUri)
}
})
// #endif
},
clickOcr() {
if (this.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
this.ocr(this.ocrUrl)
}
},
clipperSuc(event){
this.tempUri = event.url;
this.showlip = false;
this.compress();
},
ocr(imgUrl) {
if (this.scantype == ScanTypeBean.scan_pdf) {
this.generatePDF([this.tempPath])
}else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.zh, ScanTypeBean.en, imgUrl)
} else if (this.scantype == ScanTypeBean.fanyi) {
this.fanyi(ScanTypeBean.en, ScanTypeBean.zh, imgUrl)
} else {
this.dealImage(imgUrl)
}
},
fanyi(from, to, imgUrl) {
let that = this;
this.post({
url: '/ai/fanyi',
data: {
from: from,
to: to,
imgUrl: imgUrl
},
showLoading: true,
success: ({
data
}) => {
that.goResult(data, imgUrl);
},
fail: () => {
setTimeout(() => {
message.notify('图片异常,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
uni.hideLoading()
}
});
},
dealImage(myimgUrl) {
let that = this;
this.post({
url: '/ai/dealImage',
data: {
type: that.scantype,
imgUrl: myimgUrl
},
showLoading: true,
success: ({
data
}) => {
that.goResult(data, myimgUrl);
},
fail: () => {
uni.hideLoading()
setTimeout(() => {
message.notify('图片异常,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
}
});
},
uploadImg(tempFilePath) {
this.tempPath=tempFilePath
let that = this;
let tempUrl = '/ai/image/upload';
tt.uploadFile({
url: `${app.globalData.baseUrl}${tempUrl}`,
filePath: tempFilePath,
header: {
'content-type': 'multipart/form-data',
pkgname: app.globalData.pkgName,
token: tt.getStorageSync('token')
},
name: 'file',
formData: {
"type": this.scantype
},
success: (uploadFileRes) => {
let myData = JSON.parse(uploadFileRes.data)
that.ocrUrl = myData.data.url
that.dyLink(that.ocrUrl)
},
fail: (res) => {
uni.hideLoading()
}
});
},
dyLink(url) {
let that = this;
this.post({
url: '/ai/image/dyLink',
data: {
imgUrl: url
},
showLoading: true,
success: ({
data
}) => {
that.imgUri = that.tempUri
if (that.scantype == ScanTypeBean.scan_pdf) {
if (that.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
return
}
that.generatePDF([that.tempPath])
}
},
fail: () => {
uni.hideLoading()
setTimeout(() => {
message.notify('图片存在风险,请重新上传');
setTimeout(() => {
navigateBack();
}, 500);
}, 1000);
}
});
},
goResult(data, imgUrl) {
uni.hideLoading()
if (this.type == 0) {
redirectTo(`/pagesC/superresult/superresult`, {
result: data.wiki.name,
wiki: data.wiki.baikeDescription,
imgUrl: data.innerUrl
})
} else if (this.type == 2) {
redirectTo(`/pagesC/transresult/transresult`, {
imgUrl: imgUrl,
from: data.from,
to: data.to
})
} else if (this.type == 1) {
var text = ''
if (data.cardList != null && data.cardList.length > 0) {
let list = data.cardList;
for (let i in list) {
for (let key in list[i]) {
text += "\n" + key + ":" + list[i][key]
}
}
}
redirectTo(`/pagesC/result/result`, {
imgUrl: imgUrl,
result: text,
type: this.type
})
} else if (this.type == 5) {
redirectTo(`/pagesC/excelocr/excelocr`, {
imgUrl: imgUrl,
task_id: data.results.task_id
})
} else {
redirectTo(`/pagesC/result/result`, {
imgUrl: imgUrl,
result: data.fontText,
type: this.type
})
}
},
generatePDF(imageUrls) {
let that = this
pdfFn(imageUrls, 2).then((resl) => {
var fs = tt.getFileSystemManager();
console.log("123==", imageUrls)
fs.writeFile({
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() + '.pdf',
data: resl.docBase64,
encoding: "base64",
success: resx => {
tt.openDocument({
filePath: tt.env.USER_DATA_PATH + '/' + that.getCurrentTime() +
'.pdf',
showMenu: true,
success: function(resxl) {
uni.hideLoading()
console.log(resxl);
},
fail(err) {
uni.hideLoading()
console.log(err);
}
})
}
})
})
},
getCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
}
}
</script>
<style lang="scss">
.wrapper {
display: flex;
flex-direction: column;
height: 100%;
}
.show-img {
flex: 1;
background-color: #f0f8ff;
display: flex;
justify-content: center;
align-items: center;
}
.item-bottom {
background-color: #ffffff;
height: 165rpx;
padding-bottom: 15rpx;
display: flex;
flex-direction: row;
}
.item-bottom-content {
display: flex;
flex-direction: column;
flex: 1;
align-items: center;
.img {
margin-top: 30rpx;
width: 50rpx;
height: 50rpx;
}
.img2 {
margin-top: 30rpx;
width: 50rpx;
height: 50rpx;
}
.text1 {
margin-top: 6rpx;
color: #000000;
}
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view style="display: flex;flex-direction: column;height: 100%;">
<view style="height: 60%;text-align: center;">
<image mode="heightFix" class="mt-30" style="width: 500rpx;"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_share_right.png" />
</view>
<view class="flex1" style="height: 40%;padding: 30rpx 50rpx;">
<view style="font-weight: bold;font-size: 40rpx;margin-top: 50rpx;">正在识别文件</view>
<view style="font-size: 36rpx;margin-top: 50rpx;">请耐心等候</view>
<progress class="mt-30" activeColor="#008cfb" :percent="100-totalSeconds" stroke-width="10" />
</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
redirectTo,
navigateBack
} from '@/utils/fun';
const app = getApp();
export default {
name: 'ocr',
mixins: [common],
data() {
return {
imgUrl: '',
task_id: '',
timer: null, // 计时器
totalSeconds: 80, // 计时器
};
},
onLoad(option) {
this.task_id = decodeURIComponent(option.task_id)
this.imgUrl = decodeURIComponent(option.imgUrl)
},
onUnload() {
this.clearCountdown(); // 清除计时器
},
created() {
this.startCountdown(); // 开始倒计时
this.queryExcel()
},
methods: {
queryExcel() {
let that = this
this.post({
url: '/ai/queryExcel',
showLoading: false,
data: {
task_id: that.task_id,
},
success: ({
data
}) => {
if (data.code == 1) {
if (data.excel == '' && data.word == '') {
that.ocrFail()
return
}
that.clearCountdown()
redirectTo(`/pagesC/excelresult/excelresult`, {
imgUrl: that.imgUrl,
word: data.word,
excel: data.excel
})
}
},
fail: () => {
that.clearCountdown()
that.ocrFail()
}
});
},
// 开始倒计时
startCountdown() {
this.timer = setInterval(() => {
if (this.totalSeconds > 0) {
if (this.totalSeconds % 5 == 0) {
this.queryExcel()
}
this.totalSeconds -= 1;
} else {
this.clearCountdown();
this.ocrFail()
}
}, 1000);
},
// 清除倒计时
clearCountdown() {
clearInterval(this.timer);
this.timer = null;
},
ocrFail() {
uni.showModal({
title: '提示',
content: '表格识别失败',
showCancel: false,
confirmColor: '#008cfb',
success: function(res) {
navigateBack()
}
});
}
},
}
</script>
<style lang="scss">
</style>
\ No newline at end of file
<template>
<view class="body">
<view style="display: flex;flex-direction: column;height: 100%;">
<view style="height: 40%; display: flex;justify-content: center;align-items: center;">
<image mode="heightFix" :src="imgUrl" />
</view>
<view style="background: white;height: 50%;text-align: center;">
<image mode="heightFix" class="mt-20"
src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_share_right.png" />
</view>
<view style="height: 10%;display: flex;flex-direction: row;background: white;">
<view @click="close"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">返回</view>
</view>
<button @click="downloadFile"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">打开文件</view>
</button>
</view>
</view>
</view>
</template>
<script>
import {
navigateBack
} from '../../utils/fun';
import common from '@/mixins/common';
const app = getApp();
export default {
name: 'excelresult',
mixins: [common],
data() {
return {
word: '',
excel: '',
imgUrl: '',
};
},
onLoad(option) {
this.imgUrl = decodeURIComponent(option.imgUrl)
this.word = decodeURIComponent(option.word)
this.excel = decodeURIComponent(option.excel)
},
methods: {
downloadFile() {
uni.showLoading({
title: '加载中...'
})
var downloadUrl = this.word
if (downloadUrl == "") {
downloadUrl = this.excel
}
let that = this
uni.downloadFile({
url: downloadUrl, //仅为示例,并非真实的资源
success: (res) => {
uni.hideLoading()
if (res.statusCode === 200) {
that.open(res.tempFilePath)
}
},
fail: (error) => {
uni.hideLoading()
console.log(error)
}
});
},
close() {
navigateBack()
},
open(filePath) {
tt.openDocument({
filePath: filePath,
showMenu: true,
success: function(resxl) {
uni.hideLoading()
console.log(resxl);
},
fail(err) {
uni.hideLoading()
console.log(err);
}
})
}
},
}
</script>
<style lang="scss">
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="flex" style="padding:10rpx;">
<image @click="handleMeasureLength" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_ar_length.png">
</image>
<image @click="handleMeasureHeight" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_ar_height.png">
</image>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
import {
navigateTo
} from '@/utils/fun';
export default {
name: 'measure',
mixins: [common],
data() {
return {
}
},
methods: {
handleMeasureLength() {
navigateTo(`/pagesC/measureinfo/measureinfo`, {
isMeasureHeight: 0
})
},
handleMeasureHeight() {
navigateTo(`/pagesC/measureinfo/measureinfo`, {
isMeasureHeight: 1
})
}
}
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<view class="body">
<scroll-view scroll-y style="width: 100%;overflow: hidden;white-space: nowrap;flex:1;padding-top: 10rpx;">
<image mode="widthFix" v-if="isMeasureHeight==0" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_ar_height.png">
</image>
<image mode="widthFix" v-else src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_ar_length.png ">
</image>
</scroll-view>
<view class="button" style="margin-bottom: 50rpx;" @click="handleScan">开始测量</view>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
import {
navigateTo
} from '@/utils/fun';
export default {
name: 'measureinfo',
mixins: [common],
data() {
return {
isMeasureHeight: 0
}
},
onLoad(options) {
this.isMeasureHeight = options.isMeasureHeight
},
methods: {
handleScan() {
navigateTo(`/pagesC/measurescan/measurescan`, {
isMeasureHeight: this.isMeasureHeight
})
}
}
}
</script>
<style lang="scss">
.scroll-view {
flex: 1;
overflow: hidden;
height: 90%;
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="flex1" style="border-radius: 30rpx;background-color: #DAE6FB;color: black;width: 85%;margin: 0 auto;
padding: 15rpx 20rpx;margin-top: 20rpx;">
<view class="flex" style="height: 80rpx;justify-content: center;">
<view style="color: #187CFB;flex:1;">测量结果</view>
<view>{{distance}}cm</view>
</view>
<view class="flex" style="height: 80rpx;justify-content: center;">
<view style="flex:1;">您的身高</view>
<view>{{height}}cm</view>
</view>
<view class="flex" style="height: 80rpx;justify-content: center;">
<view style="flex:1;">俯视角度</view>
<view>{{angle}}°</view>
</view>
<view v-if="isMeasureHeight==1" class="flex" style="height: 80rpx;justify-content: center;">
<view style="flex:1;">仰角角度</view>
<view>{{angle2}}°</view>
</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
import {
navigateTo
} from '@/utils/fun';
export default {
name: 'measureresult',
mixins: [common],
data() {
return {
isMeasureHeight: 0,
height: '',
angle: '',
angle2: '',
distance: '',
}
},
onLoad(options) {
this.isMeasureHeight = options.isMeasureHeight
this.height = options.height
this.angle = options.angle
this.angle2 = options.angle2
this.distance = Math.round(options.distance * 100) / 100
},
methods: {}
}
</script>
<style lang="scss">
</style>
\ No newline at end of file
<template>
<view class="body">
<view style="position:absolute;width:100%;height:100%;">
<camera v-if="showCamera" id="camera" resolution="high" device-position="back" flash="off" @error="error"
@initdone="initdone" style="width:100%;height:100%;">
</camera>
</view>
<image class="icon_center" mode="aspectFit" src="../../static/ic_center.png" />
<image class="icon_close" @click="close" mode="aspectFit" src="../../static/ic_close.png" />
<view class="text_position">
<view>靶心对准物体</view>
<view style="color: red;">{{scanPosition}}</view>
<view>后点击拍照</view>
</view>
<image v-if="isMeasureHeight==1 && isClickTwo" class="icon_back" @click="takeBack" mode="aspectFit"
src="../../static/ic_back.png" />
<image class="icon_take" @click="takePhoto" mode="aspectFit" src="../../static/ic_take_photo.png" />
<uni-data-picker class="picker" placeholder="请选择身高" :localdata="items" popup-title="请选择身高"
@nodeclick="onnodeclick" :clear-icon="false">
<view class="pickerveiw">
<image style="width: 40rpx;height: 40rpx;" src="/static/ic_edit_blue.png"></image>
<text style="color: #187CFB;font-size: 30rpx;margin-left: 15rpx;">{{mHeight}}cm</text>
</view>
</uni-data-picker>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
imageCompress
} from "@/utils/utils.js"
import {
openSetting,
} from '@/utils/utils.js';
import {
redirectTo,
navigateTo,
navigateBack
} from '@/utils/fun';
const app = getApp();
export default {
name: 'measurescan',
mixins: [common],
data() {
return {
isMeasureHeight: 0,
mHeight: 170,
scanPosition: '底部',
isClickTwo: false,
items: [],
showPicker: false,
userBean: {},
showCamera: true
}
},
onLoad(options) {
var minHeight = 100
for (let i = 12; i > 0; i--) {
this.items.unshift({
text: (minHeight += 10),
value: '身高' + minHeight
})
}
this.isMeasureHeight = options.isMeasureHeight
},
onShow() {
this.post({
url: '/user/baseMsg',
showLoading: false,
success: ({
data
}) => {
this.userBean = data;
}
});
this.showCamera = true
},
methods: {
takePhoto() {
if (!this.showCamera) {
this.showCamera = true
}
if (this.isMeasureHeight == 1 && !this.isClickTwo) {
this.isClickTwo = true
this.scanPosition = "顶部"
return
}
if (this.userBean.expireTime <= 0) {
// 开通VIP会员
navigateTo(`/pagesA/vipPay/vipPay`)
} else {
this.toResult()
}
},
error(e) {
console.log(e.detail);
if (e.errNo == 10200) {
this.showCamera = false
this.goAuthSetting()
}
},
goAuthSetting() {
tt.showModal({
title: `获取权限失败`,
content: `未授权,请在设置页授权`,
success(res) {
if (res.confirm) {
openSetting()
} else if (res.cancel) {
uni.showToast({
title: '取消授权'
})
}
},
});
},
initdone({
detail: {
maxZoom
}
}) {
// 最大放大倍速
this.maxZoom = maxZoom / 2
},
close() {
navigateBack();
},
toResult() {
var angle = Math.floor(Math.random() * 180) + 1;
var angle2 = Math.floor(Math.random() * 180) + 1;
var distance = Math.abs(this.mHeight * Math.tan(angle * Math.PI / 180))
redirectTo(`/pagesC/measureresult/measureresult`, {
isMeasureHeight: this.isMeasureHeight,
height: this.mHeight,
angle: angle,
angle2: angle2,
distance: distance
})
},
onnodeclick(res) {
this.mHeight = parseInt(res.text)
},
takeBack() {
this.isClickTwo = false
this.scanPosition = "低部"
}
}
}
</script>
<style lang="scss">
.body {
background: black;
position: relative;
}
.icon_close {
position: absolute;
width: 80rpx;
height: 80rpx;
left: 30rpx;
top: 30rpx;
}
.icon_take {
position: absolute;
width: 120rpx;
height: 120rpx;
left: 50%;
bottom: 150rpx;
margin-left: -50rpx;
}
.icon_back {
position: absolute;
width: 80rpx;
height: 80rpx;
left: 20%;
bottom: 170rpx;
}
.text_position {
position: absolute;
width: 100%;
left: 50%;
bottom: 300rpx;
margin-left: -50%;
color: white;
display: flex;
flex-direction: row;
justify-content: center;
}
.icon_center {
position: absolute;
width: 150rpx;
height: 150rpx;
left: 50%;
top: 50%;
margin-top: -75rpx;
margin-left: -75rpx;
}
.picker {
position: absolute;
top: 30rpx;
right: 30rpx;
border-radius: 10rpx;
background-color: transparent;
}
.pickerveiw {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding: 10rpx 20rpx;
background: rgba(255, 255, 255, 0.8);
border-radius: 20rpx;
}
</style>
\ No newline at end of file
<template>
<view class="body">
<!-- <status-title :showBack="true" iconColor="black">识别结果</status-title> -->
<view style="display: flex;flex-direction: column;height: 100%;">
<view style="height: 40%; display: flex;justify-content: center;align-items: center;">
<image mode="heightFix" :src="imgUrl" />
</view>
<view style="background: white;height: 50%;display: flex;flex-direction: column;padding: 30rpx 20rpx;">
<view style="font-weight: bold;padding-left: 10rpx;font-size: 40rpx;">识别结果</view>
<scroll-view :scroll-y="true" style="overflow: hidden;white-space: nowrap;flex:1;">
<view v-if="type==3 || type == 1 || type == 4">
<block v-for="(item, index) in dataList" :key="index">
<view>
<view style="margin: 10rpx;font-size: 30rpx;">{{item}}</view>
<view style="height: 1rpx;width: 100%;background: darkgray;"
v-if="index<dataList.length-1"></view>
</view>
</block>
</view>
</scroll-view>
</view>
<view style="height: 10%;display: flex;flex-direction: row;background: white;">
<view @click="copy"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">复制</view>
</view>
<button open-type="share"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">导出</view>
</button>
</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
export default {
name: 'result',
mixins: [common],
data() {
return {
result: '',
imgUrl: '',
dataList: [],
type: 0
};
},
onLoad(option) {
this.type = option.type
this.result = decodeURIComponent(option.result)
this.imgUrl = decodeURIComponent(option.imgUrl)
this.dataList = this.result.split('\n')
},
onShareAppMessage() {
return {
title: '智能扫描精灵',
summary: this.result,
success() {
console.log('分享成功');
},
fail(err) {
console.error('分享失败', err);
}
};
},
methods: {
copy() {
uni.setClipboardData({
data: this.result,
complete() {
uni.showToast({
title: "已复制到剪贴板"
})
}
})
}
},
}
</script>
<style lang="scss">
</style>
\ No newline at end of file
<template>
<view class="body">
<view style="position:relative;width:100%;height:70%;">
<camera v-if="showCamera" id="camera" resolution="high" device-position="back" flash="off" @error="error"
@initdone="initdone" style="width:100%;height:100%;">
</camera>
</view>
<view class="hint" v-if="current==0">请保持水平清晰</view>
<view class="card" v-if="current==1" @click="showPop">
<text>{{currentCard}}</text>
<image src="../../static/arrow_down.png" style="width: 30rpx;height: 30rpx;"></image>
</view>
<view style="display: flex;flex-direction: column;width:100%;height:30%;'">
<tabs-center2 class="center" :tabs="tabs" v-model="current" @change="handleChange" />
<view style="display: flex;">
<view class="icon_flex" @click="close">
<image mode="aspectFit" style="width: 80rpx;height: 80rpx;" src="../../static/ic_close.png" />
</view>
<view class="icon_flex" @click="takePhoto">
<image mode="aspectFit" src="../../static/ic_take_photo.png" />
</view>
<view class="icon_flex" @click="openAlbum">
<image mode="aspectFit" style="width: 80rpx;height: 80rpx;" src="../../static/ic_photo.png" />
</view>
</view>
</view>
<uni-popup ref="popup" type="bottom" borderRadius="20rpx 20rpx 0 0" background-color="#fff">
<view class="popup-content">
<text class="mt-20 margin-b10" style="font-weight: bold;">请选择证件类型</text>
<view style="width: 100%;height: 1rpx;background-color: royalblue;"></view>
<block v-for="(item, index) in list" :key="index">
<text class="mt-20" @click="change(index)">{{item}}</text>
</block>
</view>
</uni-popup>
</view>
</template>
<script>
import common from '@/mixins/common';
import {
ScanIndexBean,
ScanTypeBean
} from '@/utils/constant.js'
import {
imageCompress
} from "@/utils/utils.js"
import {
openSetting,
} from '@/utils/utils.js';
import {
navigateTo,
navigateBack,
reLaunch
} from '@/utils/fun';
const app = getApp();
export default {
name: 'scan',
mixins: [common],
data() {
return {
current: 0,
currentCard: '身份证正面',
tabs: [{
title: '万能识别',
value: 0
}, {
title: '证件识别',
value: 1
}, {
title: '拍照翻译',
value: 2
}, {
title: '文字识别',
value: 3
}, {
title: '文件扫描',
value: 4
}, {
title: '表格识别',
value: 5
}, {
title: '图片转PDF',
value: 6
}, ],
list: ['身份证正面', '身份证反面'],
cardType: ScanTypeBean.idcard_front,
showCamera: true
}
},
onLoad(option) {
this.current = option.type
},
onShow() {
this.showCamera = true
},
methods: {
takePhoto() {
if (!this.showCamera) {
this.showCamera = true
}
uni.showLoading({
title: '加载中...'
})
let that = this
// #ifdef MP-TOUTIAO
let cameraContext = tt.createCameraContext('camera');
cameraContext.takePhoto({
quality: 'high',
success(res) {
uni.hideLoading()
navigateTo(`/pagesC/edit/edit`, {
uri: res.tempImagePath,
type: that.current,
cardType: that.cardType
})
},
fail(err) {
uni.hideLoading()
console.log(err);
},
});
// #endif
},
openAlbum() {
let that = this
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ["album"],
success: (res) => {
navigateTo(`/pagesC/edit/edit`, {
uri: res.tempFilePaths,
type: that.current,
cardType: that.cardType
})
},
fail: (res) => {
// 拒绝授权
if (res.errNo == 10200) {
setTimeout(() => {
that.goAuthSetting()
}, 500)
}
}
});
},
error(e) {
if (e.errNo == 10200) {
this.showCamera = false
this.goAuthSetting()
}
console.log(e.detail);
},
goAuthSetting() {
tt.showModal({
title: `获取权限失败`,
content: `未授权,请在设置页授权`,
success(res) {
if (res.confirm) {
openSetting()
} else if (res.cancel) {
uni.showToast({
title: '取消授权'
})
}
},
});
},
initdone({
detail: {
maxZoom
}
}) {
// 最大放大倍速
this.maxZoom = maxZoom / 2
},
close() {
navigateBack();
},
handleChange(res) {
this.current = res.value
if (!this.showCamera) {
this.showCamera = true
}
},
showPop() {
this.$refs.popup.open('bottom')
},
change(e) {
this.$refs.popup.close()
if (e == 0) {
this.cardType = ScanTypeBean.idcard_front
} else {
this.cardType = ScanTypeBean.idcard_back
}
this.currentCard = this.list[e]
}
}
}
</script>
<style lang="scss">
.body {
background: black;
}
.img {
width: 60rpx;
height: 60rpx;
}
.font {
text-align: center;
font-size: 30rpx;
color: white;
margin-top: 30rpx;
}
.font2 {
text-align: center;
font-size: 30rpx;
color: royalblue;
margin-top: 30rpx;
}
.icon_flex {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-top: 50rpx;
image {
width: 120rpx;
height: 120rpx;
}
}
.card {
padding-left: 20rpx;
padding-right: 20rpx;
color: white;
border-radius: 10rpx;
background-color: black;
position: absolute;
width: 180rpx;
height: 70rpx;
margin-left: -100rpx;
left: 50%;
top: 8%;
display: flex;
align-items: center;
justify-content: space-between;
}
.hint {
padding-left: 20rpx;
padding-right: 20rpx;
padding-top: 10rpx;
padding-bottom: 10rpx;
color: white;
border-radius: 10rpx;
background-color: black;
position: absolute;
left: 50%;
bottom: 30%;
transform: translate(-50%, -50%);
animation: fadeInOut 2s ease infinite;
}
.popup-content {
display: flex;
flex-direction: column;
// align-items: center;
// justify-content: center;
padding: 15px;
font-size: 36rpx;
background-color: #fff;
}
@keyframes fadeInOut {
0% {
opacity: 0.3;
}
50% {
opacity: 0.7;
}
100% {
opacity: 0.3;
}
}
</style>
\ No newline at end of file
<template>
<view class="body">
<view class="content flex-v">
<view class="flex">
<image style="height: 200rpx;margin-left: 30rpx;" mode="heightFix" :src="imgUrl"></image>
<view class="flex-v" style="margin-left: 30rpx;">
<text style="color: gray;font-size: 36rpx;">图中可能是</text>
<text style="color: black;font-size: 40rpx;max-width: 400rpx;margin-top: 20rpx;">{{result}}</text>
</view>
</view>
<view class="flex-v" style="margin-top: 80rpx;">
<view class="flex">
<text style="color: black;font-size: 40rpx;">百科</text>
<text style="color: gray;font-size: 30rpx;margin-left: 20rpx;">WIKIPEDIA</text>
</view>
<view style="height: 1rpx;background-color: gray;margin-top: 10rpx;"></view>
<text style="color: black;font-size: 36rpx;;margin-top: 30rpx;">{{wiki?wiki:'暂无百科介绍'}}</text>
</view>
</view>
<image class="img" src="https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/ic_ai_result.png" mode="widthFix"></image>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
export default {
name: '百科结果',
mixins: [common],
data() {
return {
result: '',
wiki: '',
imgUrl: '',
};
},
onLoad(option) {
this.result = decodeURIComponent(option.result)
this.wiki = decodeURIComponent(option.wiki)
this.imgUrl = decodeURIComponent(option.imgUrl)
},
onShareAppMessage() {
return {
title: '智能扫描精灵',
summary: this.result,
success() {
console.log('分享成功');
},
fail(err) {
console.error('分享失败', err);
}
};
},
methods: {
copy() {
uni.setClipboardData({
data: this.result,
complete() {
uni.showToast({
title: "已复制到剪贴板"
})
}
})
}
},
}
</script>
<style lang="scss">
.body {
position: relative;
}
.content {
position: absolute;
width: 90%;
height: 80%;
top: 100rpx;
left: 5%;
background-color: white;
border-radius: 20rpx;
box-shadow: 0 0 4px darkgray;
padding: 80rpx 30rpx 0 30rpx;
}
.img {
position: absolute;
width: 294rpx;
height: 62rpx;
left: 50%;
margin-left: -146rpx;
top: 69rpx;
}
</style>
\ No newline at end of file
<template>
<view class="body">
<!-- <status-title :showBack="true" iconColor="black">识别结果</status-title> -->
<view style="display: flex;flex-direction: column;height: 100%;">
<view style="height: 40%; display: flex;justify-content: center;align-items: center;">
<image mode="heightFix" :src="imgUrl"></image>
</view>
<view style="background: white;height: 50%;display: flex;flex-direction: column;padding: 30rpx 20rpx;">
<view style="font-weight: bold;padding-left: 10rpx;font-size: 40rpx;">识别结果</view>
<scroll-view :scroll-x="true" style="overflow: hidden;white-space: nowrap;flex:1;width: 100%;">
<view style="padding: 10rpx;">{{from}}</view>
<view style="padding: 10rpx;">{{to}}</view>
</scroll-view>
</view>
<view style="height: 10%;display: flex;flex-direction: row;background: white;">
<view @click="copy"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">复制</view>
</view>
<button open-type="share"
style="display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;">
<image style="width: 30rpx;height: 30rpx;" src="../../static/ic_copy.png">
</image>
<view style="font-size: 30rpx;">导出</view>
</button>
</view>
</view>
</view>
</template>
<script>
import common from '@/mixins/common';
const app = getApp();
export default {
name: 'transresult',
mixins: [common],
data() {
return {
imgUrl: '',
from: '',
to: '',
};
},
onLoad(option) {
this.from = decodeURIComponent(option.from)
this.to = decodeURIComponent(option.to)
this.imgUrl = decodeURIComponent(option.imgUrl)
},
onShareAppMessage() {
return {
title: '智能扫描精灵',
summary: this.result,
success() {
console.log('分享成功');
},
fail(err) {
console.error('分享失败', err);
}
};
},
methods: {
copy() {
uni.setClipboardData({
data: this.to,
complete() {
uni.showToast({
title: "已复制到剪贴板"
})
}
})
}
},
}
</script>
<style lang="scss">
</style>
\ No newline at end of file
## 9.1.2(2024-10-03)
组件优化
## 9.1.0(2024-07-14)
组件优化
## 9.1(2024-04-04)
修复组件存在的问题
## 9.0(2024-04-04)
有前端伙伴修复了组件存在的一些问题
## 8.0(2024-03-04)
优化组件代码
## 7.0(2023-12-28)
增加地址编码
## 6.0.1(2023-10-13)
适配vue3
## 6.0(2023-10-08)
修复vue3.0bug, 兼容vue2.0
## 5.0(2023-09-16)
1:增加初始省市区默认值设置 2:优化组件体验
## 4.0.1(2023-09-03)
优化了一些问题
## 4.0.0(2023-08-26)
更新中国最新省市区数据
## 3.0.2(2023-08-26)
修改区数据格式
## 3.0.1(2023-07-31)
修复vue3.0bug
## 3.0(2023-07-19)
组件优化
## 2.0.3(2023-07-19)
修复退出界面,省市区选项显示bug
## 2.0.2(2023-07-13)
更新无锡市信息
## 2.0.1(2023-07-11)
组件优化
## 2.0.0(2023-07-11)
修复vue3.0bug, 支持vue3.0
## 1.0.6(2023-06-29)
组件优化
## 1.0.4(2023-06-29)
组件优化
## 1.0.3(2023-06-29)
组件优化
## 1.0.2(2023-06-29)
组件说明优化
## 1.0.1(2023-06-29)
组件优化
## 1.0.0(2023-06-28)
组件初始化
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<view>
<!--自定义地址选择器-->
<view class="cc_area_mask" v-show="show == true"></view>
<view :class="'cc_area_view ' + (show ? 'show':'hide')">
<view class="cc_area_view_btns">
<text class="cc_area_view_btn_cancle" @tap="handleNYZAreaCancle">取消</text>
<text class="cc_area_view_btn_sure" @tap="handleNYZAreaSelect" :data-province="province"
:data-city="city" :data-area="area">确定</text>
</view>
<picker-view class="cc_area_pick_view" indicator-style="height: 35px;" @change="handleNYZAreaChange"
:value="value">
<picker-view-column>
<view v-for="(item, index) in provinces" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in citys" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column v-if="!hideArea">
<view v-for="(item, index) in areas" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</template>
<script>
import {
getProvinces,
getMyCity,
getAreas,
getAreasCode
} from "./area.js"
let index = [0, 0, 0];
let provinces = getProvinces();
let citys = getMyCity(index[0]);
let areas = getMyCity(index[0], index[1]);
export default {
mixins: [{
methods: {
setData: function(obj, callback) {
let that = this;
const handleData = (tepData, tepKey, afterKey) => {
tepKey = tepKey.split('.');
tepKey.forEach(item => {
if (tepData[item] === null || tepData[item] === undefined) {
let reg = /^[0-9]+$/;
tepData[item] = reg.test(afterKey) ? [] : {};
tepData = tepData[item];
} else {
tepData = tepData[item];
}
});
return tepData;
};
const isFn = function(value) {
return typeof value == 'function' || false;
};
Object.keys(obj).forEach(function(key) {
let val = obj[key];
key = key.replace(/\]/g, '').replace(/\[/g, '.');
let front, after;
let index_after = key.lastIndexOf('.');
if (index_after != -1) {
after = key.slice(index_after + 1);
front = handleData(that, key.slice(0, index_after), after);
} else {
after = key;
front = that;
}
if (front.$data && front.$data[after] === undefined) {
Object.defineProperty(front, after, {
get() {
return front.$data[after];
},
set(newValue) {
front.$data[after] = newValue;
that.$forceUpdate();
},
enumerable: true,
configurable: true
});
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
} else {
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
}
});
isFn(callback) && this.$nextTick(callback);
}
}
}],
data() {
return {
provinces: getProvinces(),
citys: getMyCity(index[0]),
areas: getAreas(index[0], index[1]),
value: [0, 0, 0]
};
},
components: {},
props: {
// 省
province: {
//控制area_select显示隐藏
type: String,
default: ''
},
// 市
city: {
//控制area_select显示隐藏
type: String,
default: ''
},
// 区
area: {
//控制area_select显示隐藏
type: String,
default: ''
},
show: {
//控制area_select显示隐藏
type: Boolean,
default: false
},
hideArea: {
type: Boolean,
default: false
},
maskShow: {
//是否显示蒙层
type: Boolean,
default: true
}
},
watch: {
province() {
this.init();
},
city() {
this.init();
},
area() {
this.init();
}
},
mounted() {
// let provinceIndex = this.provinces.indexOf(this.province);
// this.citys = getMyCity(provinceIndex);
// let cityIndex = this.citys.indexOf(this.city);
// this.areas = getAreas(provinceIndex, cityIndex);
// let areaIndex = this.areas.indexOf(this.area);
// // 设置选择序列
// this.value = [provinceIndex, cityIndex, areaIndex];
// let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
this.init();
//console.log(areaCode)
//console.log("this.value = " + JSON.stringify(this.value));
},
methods: {
init() {
//console.log(this.area)
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
// 设置选择序列
try {
this.value = [provinceIndex, cityIndex, areaIndex];
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
} catch {
}
},
handleNYZAreaChange: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
var value = e.detail.value;
/**
* 滚动的是省
* 省改变 市、区都不变
*/
if (index[0] != value[0]) {
index = [value[0], 0, 0];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], 0);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], 0, 0],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],
areaCode);
} else if (index[1] != value[1]) {
/**
* 市改变了 省不变 区变
*/
index = [value[0], value[1], 0];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], index[1], 0],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],
areaCode);
} else if (index[2] != value[2]) {
/**
* 区改变了
*/
index = [value[0], value[1], value[2]];
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], value[1]);
that.setData({
citys: selectCitys,
areas: selectAreas,
value: [index[0], index[1], index[2]],
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]],
areaCode);
}
},
/**
* 确定按钮的点击事件
*/
handleNYZAreaSelect: function(e) {
var myEventDetail = e; // detail对象,提供给事件监听函数
var myEventOption = {}; // 触发事件的选项
this.$emit('sureSelectArea', {
detail: myEventDetail
}, myEventOption);
index = [0, 0, 0];
},
/**
* 取消按钮的点击事件
*/
handleNYZAreaCancle: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
this.$emit('hideShow', {
detail: false
});
// 复原初始状态
index = [0, 0, 0];
}
}
};
</script>
<style scoped lang="scss">
.cc_area_view {
width: 100%;
position: fixed;
bottom: -1000px;
left: 0px;
background-color: #fff;
z-index: 21;
transition: all 0.3s;
}
.cc_area_pick_view {
height: 400px;
width: 100%;
}
.cc_area_colum_view {
line-height: 35px;
text-align: center;
font-size: 28upx;
}
.hide {
bottom: -1000upx;
transition: all 0.3s;
}
.show {
bottom: 0upx;
transition: all 0.3s;
}
.cc_area_view_btns {
background-color: #fff;
border-bottom: 1px solid #eeeeee;
font-size: 30upx;
padding: 18upx 0upx;
}
.cc_area_view_btns>text {
display: inline-block;
word-spacing: 4upx;
letter-spacing: 4upx;
}
.cc_area_view_btn_cancle {
color: #939393;
padding-right: 20upx;
padding-left: 25upx;
}
.cc_area_view_btn_sure {
float: right;
padding-left: 20upx;
padding-right: 25upx;
}
.cc_area_mask {
width: 100%;
height: 100vh;
background-color: rgba(28, 28, 28, 0.6);
position: absolute;
top: 0upx;
left: 0upx;
z-index: 20;
}
</style>
\ No newline at end of file
<template>
<view>
<!--自定义地址选择器-->
<view class="cc_area_mask" v-show="show == true"></view>
<view :class="'cc_area_view ' + (show ? 'show':'hide')">
<view class="cc_area_view_btns">
<text class="cc_area_view_btn_cancle" @tap="handleNYZAreaCancle">取消</text>
<text class="cc_area_view_btn_title" style="color: #393939;font-size: 32upx;">地区选择</text>
<text class="cc_area_view_btn_sure" @tap="handleNYZAreaSelect" :data-province="province"
:data-city="city" :data-area="area" style="color: #4284e5;">确定</text>
</view>
<picker-view class="cc_area_pick_view" indicator-style="height: 35px;" @change="handleNYZAreaChange"
:value="value">
<picker-view-column>
<view v-for="(item, index) in provinces" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in citys" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
<picker-view-column>
<view v-for="(item, index) in areas" :key="index" class="cc_area_colum_view">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</template>
<script>
import {
getProvinces,
getMyCity,
getAreas,
getAreasCode
} from "./area.js"
let index = [0, 0, 0];
let provinces = getProvinces();
let citys = getMyCity(index[0]);
let areas = getMyCity(index[0], index[1]);
export default {
mixins: [{
methods: {
setData: function(obj, callback) {
let that = this;
const handleData = (tepData, tepKey, afterKey) => {
tepKey = tepKey.split('.');
tepKey.forEach(item => {
if (tepData[item] === null || tepData[item] === undefined) {
let reg = /^[0-9]+$/;
tepData[item] = reg.test(afterKey) ? [] : {};
tepData = tepData[item];
} else {
tepData = tepData[item];
}
});
return tepData;
};
const isFn = function(value) {
return typeof value == 'function' || false;
};
Object.keys(obj).forEach(function(key) {
let val = obj[key];
key = key.replace(/\]/g, '').replace(/\[/g, '.');
let front, after;
let index_after = key.lastIndexOf('.');
if (index_after != -1) {
after = key.slice(index_after + 1);
front = handleData(that, key.slice(0, index_after), after);
} else {
after = key;
front = that;
}
if (front.$data && front.$data[after] === undefined) {
Object.defineProperty(front, after, {
get() {
return front.$data[after];
},
set(newValue) {
front.$data[after] = newValue;
that.$forceUpdate();
},
enumerable: true,
configurable: true
});
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
} else {
// #ifndef VUE3
that.$set(front, after, val);
// #endif
// #ifdef VUE3
Reflect.set(front, after, val);
// #endif
}
});
isFn(callback) && this.$nextTick(callback);
}
}
}],
data() {
return {
provinces: getProvinces(),
citys: getMyCity(index[0]),
areas: getAreas(index[0], index[1]),
value: [0, 0, 0]
};
},
components: {},
props: {
// 省
province: {
//控制area_select显示隐藏
type: String,
default: ''
},
// 市
city: {
//控制area_select显示隐藏
type: String,
default: ''
},
// 区
area: {
//控制area_select显示隐藏
type: String,
default: ''
},
show: {
//控制area_select显示隐藏
type: Boolean,
default: false
},
maskShow: {
//是否显示蒙层
type: Boolean,
default: true
}
},
watch: {
province() {
this.init();
},
city() {
this.init();
},
area() {
this.init();
}
},
mounted() {
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
// 设置选择序列
this.value = [provinceIndex, cityIndex, areaIndex];
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
//console.log(areaCode)
//console.log("this.value = " + JSON.stringify(this.value));
},
methods: {
init() {
//console.log(this.area)
let provinceIndex = this.provinces.indexOf(this.province);
this.citys = getMyCity(provinceIndex);
let cityIndex = this.citys.indexOf(this.city);
this.areas = getAreas(provinceIndex, cityIndex);
let areaIndex = this.areas.indexOf(this.area);
//获取地区编码
let areaCode = getAreasCode(provinceIndex, cityIndex, areaIndex);
// 设置选择序列
this.value = [provinceIndex, cityIndex, areaIndex];
},
handleNYZAreaChange: function(e) {
var that = this;
var value = e.detail.value;
// 更新 index
index = value;
// 获取对应的城市和区域数据
let selectCitys = getMyCity(index[0]);
let selectAreas = getAreas(index[0], index[1]);
// 触发 setData 更新数据
that.setData({
citys: selectCitys,
areas: selectAreas,
value: index
});
let areaCode = getAreasCode(index[0], index[1], index[2]);
// 触发事件
that.$emit("changeClick", provinces[index[0]], selectCitys[index[1]], selectAreas[index[2]], areaCode);
},
/**
* 确定按钮的点击事件
*/
handleNYZAreaSelect: function(e) {
var myEventDetail = e;
var myEventOption = {};
this.$emit('sureSelectArea', {
detail: myEventDetail
}, myEventOption);
// 复原初始状态
index = [0, 0, 0];
},
handleNYZAreaCancle: function(e) {
var that = this;
this.$emit('hideShow', {
detail: false
});
// 复原初始状态
index = [0, 0, 0];
}
},
/**
* 取消按钮的点击事件
*/
handleNYZAreaCancle: function(e) {
var that = this;
//console.log("e:" + JSON.stringify(e));
this.$emit('hideShow', {
detail: false
});
// 复原初始状态
index = [0, 0, 0];
}
}
</script>
<style scoped lang="scss">
.cc_area_view {
width: 100%;
position: fixed;
bottom: -1000px;
left: 0px;
background-color: #fff;
z-index: 21;
transition: all 0.3s;
}
.cc_area_pick_view {
height: 400px;
width: 100%;
}
.cc_area_colum_view {
line-height: 35px;
text-align: center;
font-size: 28upx;
}
.hide {
bottom: -1000upx;
transition: all 0.3s;
}
.show {
bottom: 0upx;
transition: all 0.3s;
}
.cc_area_view_btns {
background-color: #fff;
border-bottom: 1px solid #eeeeee;
font-size: 30upx;
padding: 18upx 0upx;
display: flex;
justify-content: space-between;
}
.cc_area_view_btns>text {
display: inline-block;
word-spacing: 4upx;
letter-spacing: 4upx;
}
.cc_area_view_btn_cancle {
color: #939393;
padding-right: 20upx;
padding-left: 25upx;
}
.cc_area_view_btn_sure {
float: right;
padding-left: 20upx;
padding-right: 25upx;
}
.cc_area_mask {
width: 100%;
height: 100vh;
background-color: rgba(28, 28, 28, 0.6);
position: absolute;
top: 0upx;
left: 0upx;
z-index: 20;
}
</style>
\ No newline at end of file
{
"id": "cc-selectDity",
"displayName": "自定义简单实用中国省市区三级联动选择器picker 设置收获地址界面模版(适配vue3)",
"version": "9.1.2",
"description": "自定义简单实用中国省市区三级联动选择器picker 地区选择器picker 设置收获地址界面模版",
"keywords": [
"citypicker",
"省市区",
"picker",
"三级联动",
"选择器"
],
"repository": "",
"engines": {
"HBuilderX": "^3.8.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
},
"快应用": {
"华为": "y",
"联盟": "y"
}
}
}
}
}
\ No newline at end of file
async function pdfFn(imgArr, isWatermark) {
const {
PDFDocument,
rgb
} = require('pdf-lib'); //引入pdf-lib模块,转成pdf的时候用到
// const {
// fontkit
// } = require('@pdf-lib/fontkit') //引入@pdf-lib/fontkit模块,水印的时候用到
//接收小程序端传来的图片数组
let img_arr = imgArr;
//arr是用来存储fileContent的数组
let arr = [];
//pdf的总高度,是等于数组里面的所有图片的高度之和
let zheight = 0;
//用来存储处理过后的各个图片信息的数组
let content_arr = [];
const doc = await PDFDocument.create();
let page = doc.addPage();
// doc.registerFontkit(fontkit);
// 下载图片 获取fileContent,并且存入arr数组
for (let i = 0; i < img_arr.length; i++) {
let lian = img_arr[i]
// const last_len = lian.lastIndexOf('/') + 1;
// const len = lian.length;
// var data = lian.substring(last_len, len)
let sBase64 = tt.getFileSystemManager().readFileSync(lian, 'base64');
arr.push(sBase64);
};
// //获取所有照片组成的高度和宽度
for (let j = 0; j < arr.length; j++) {
//判断图片是png
if (img_arr[j].match(/.png/g)) {
let img = await doc.embedPng(arr[j]);
//计算图片展示的宽高,根据原有的比例和pdf的宽度来算
let h = (img.height * 700) / img.width;
let obj = {
img: img,
width: 700,
height: h,
};
content_arr.push(obj);
zheight = parseInt(zheight + h);
};
//判断图片是jpg
if (img_arr[j].match(/.jpg/g)) {
let img = await doc.embedJpg(arr[j]);
//计算图片展示的宽高,根据原有的比例和pdf的宽度来算
let h = (img.height * 700) / img.width;
let obj = {
img: img,
width: 700,
height: h,
};
content_arr.push(obj);
zheight = parseInt(zheight + h);
};
//判断如果图片不是png或者jpg。则返回提示
if (!img_arr[j].match(/.jpg/g) && !img_arr[j].match(/.png/g)) {
let str = '图片只支持jpg和png格式'
return str
};
};
//开始设置pdf的高度和宽度
page.setWidth(800);
page.setHeight(zheight);
//guodu_height用来存储排在前面的高度
let guodu_height = 0;
//开始绘制
for (let i = 0; i < content_arr.length; i++) {
guodu_height = guodu_height + content_arr[i].height
let height = zheight - guodu_height
page.drawImage(content_arr[i].img, {
x: 50, //左右各间隔50
y: height,
width: content_arr[i].width,
height: content_arr[i].height,
});
};
// 嵌入水印,水印不能中文,不然会报错
if (isWatermark == 1) {
page.moveTo(100, zheight / 2);
page.drawText(`Identification Assistant \n` +
`\n` +
`version: 1.0.12 \n`, {
size: 50,
color: rgb(1, 0, 0),
});
page.moveDown(100);
page.drawText('Exclusive Watermark', {
size: 40,
color: rgb(1, 0, 0),
});
};
const docBase64 = await doc.saveAsBase64();
return {
docBase64,
};
}
module.exports = {
pdfFn
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment