| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import store from "@/store/index.js";
- import config from "@/common/config";
- export default {
- isGoLogin(isBack = true) {
- if (!uni.getStorageSync("seller_account")) {
- uni.navigateTo({
- url: "/pages/login/login?isBack=" + 1,
- });
- return true;
- } else {
- return false;
- }
- },
- isLogin() {
- if (uni.getStorageSync("seller_account")) {
- return true;
- } else {
- return false;
- }
- },
- //提示
- showToast(title, icon = "none", time = 2000) {
- return setTimeout(() => {
- uni.showToast({
- title: title,
- icon: icon,
- duration: time,
- });
- }, 500);
- },
- //图片路径填补
- splitImgHost(url, scale = false, width = 250) {
- if (!url) {
- return "";
- } else if (
- url.indexOf("http") != -1 ||
- url.indexOf("https") != -1 ||
- url.indexOf("wxfile") != -1
- ) {
- } else {
- url = config.BASE_IMG_URL + url;
- }
- if (scale) {
- url = url + "?x-oss-process=image/resize,w_" + width;
- }
- return url;
- },
- setUuid(id) {
- uni.setStorageSync("uuid", id);
- },
- getUuid() {
- return uni.getStorageSync("uuid");
- },
- exit() {
- uni.removeStorageSync("seller_account");
- uni.removeStorageSync("token");
- store.state.userInfo = null;
- uni.reLaunch({
- url: "/pages/index/index",
- });
- },
- };
- // 监测域名
- export function checkDomain(str) {
- let domain =
- /^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn)|(mobi)|(name)|(sh)|(ac)| (io)|(tw)|(com\.tw)|(hk)|(com\.hk)|(ws)|(travel)|(us)|(tm)|(la)|(me\.uk)|(org\.uk)|(ltd\.uk)|(plc\.uk)|(in)|(eu)|(it)|(jp))$/;
- return domain.test(str);
- }
|