#115

    作者:广西南宁市
    访问的地址被防火墙给屏蔽了,你需要改成我们国内可用的代理地址
    在cmd中输入:
    go env -w GOPROXY=https://goproxy.cn
    Run code
    Cut to clipboard

      安装GO语言相关插件

      在vscode中安装GO语言相关插件的时候,报错:

      A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
      文章:Go语言捕获fatal错误,程序异常退出,致命错误  发表时间:2023-03-31, 02:52:05  
      展开↯

      #116

      作者:广西南宁市
      svn access to ...forbidden
      解决办法清除svn缓存:
      TortoiseSVN-> Settings -> Saved Data
      然后clear,
      主要是最后一个(Authentication data)clear,
      或者直接clear all
      #,广西南宁市,2023-02-24,16:37:01, svn命令行提交新增所有修改的文件
      svn add . --no-ignore --force svn ci -m "提交所有全部文件"
      Run code
      Cut to clipboard

        命令行执行svn ci提交的时候,如果是新增的文件,不会被提交
        加上svn add命令,即可自动添加新增的文件
        然后再执行svn ci命令,即可将新增的文件提交到svn
        #,广西南宁市,2023-02-24,16:37:57, svn配置钩子后,提交代码提示post-commit hook failed (exit code 255) with no output错误
        post-commit hook failed (exit code 255) with no output.
        就是我们没有为post-commit赋予执行权限
        没有x权限,为post-commit添加x权限

        chmod +x post-commit
        #,广西南宁市,2023-02-24,16:39:08, svn: line 19: Option expected
        修改svnserve.conf时,打开注释时,配置的前面有空格,应该顶格写
        文章:Linux系统中svn服务器设置开机启动  发表时间:2020-07-12, 18:53:24  
        展开↯

        #117

        作者:广西南宁市
        [mysqld]
        port=3306

        log_bin_trust_function_creators=1
        文章:解决myql Error Code : 1060 Duplicate column name 'xxx' 问题  发表时间:2023-02-20, 00:57:19  
        展开↯

        #118

        作者:广西南宁市
        [Err] 1060 - Duplicate column name 'XXX'
        在mysql中,多个表联合查询时,出现错误:[Err] 1060 - Duplicate column name 'XXX'

        原因:

        使用的是:select * 操作,造成了列名重复,例如a表里面有列名'content',b表里面也有列名'content',此时就会报错。

        解决方法:

        直接指定想要返回的是什么,例如:select a.content 来操作。
        文章:解决myql Error Code : 1060 Duplicate column name 'xxx' 问题  发表时间:2023-02-20, 00:55:16  
        展开↯

        #119

        作者:广西南宁市
        css3 实现瀑布流
        .wrap { margin-top: 50px; width: 100%; padding: 0 20px; /* 瀑布流容器内元素的间隔 */ column-gap:10px; /* 瀑布容器内排列的列数 */ column-count: 2; } .item { padding: 10px; border: 1px solid #000; margin-bottom: 10px; height: 50px; /* avoid避免在主体框中插入任何中断(页面,列或区域) */ break-inside: avoid; }
        Run code
        Cut to clipboard
          #,广西南宁市,2023-01-13,21:05:22, css3瀑布流顶部不对齐,列断裂
          问题展现

          找了半天,发现是 item 的 margin-bottom 导致的:第一列的最后一个item的margin-bottom跑到第二列第一个item上面了,改成padding-bottom即可,
          因为padding属于内容,只要不折断,就不会跑到另一列
          文章:js判断一个值是否为数字  发表时间:2023-01-13, 17:14:25  
          展开↯

          #120

          作者:广西南宁市
          微信小程序页面自动滚动到指定位置
          1.使用wx.createSelectorQuery().select().boundingClientRect()查询到需要滚动到的元素位置 2.使用wx.pageScrollTo()将页面滚动到对应位置
          Run code
          Cut to clipboard

            scrollTo() { // 1.使用wx.createSelectorQuery()查询到需要滚动到的元素位置 wx.createSelectorQuery().select('.bb4').boundingClientRect(res => { // 到这里,我们可以从res中读到class为bb4的top,即离顶部的距离(px) // 2使用wx.pageScrollTo()将页面滚动到对应位置 wx.pageScrollTo({ scrollTop: res.top, // 滚动到的位置(距离顶部 px) duration: 0 //滚动所需时间 如果不需要滚动过渡动画,设为0(ms) }) }).exec() }
            Run code
            Cut to clipboard

              scrollTo() { // 1.使用wx.createSelectorQuery()查询到需要滚动到的元素位置 wx.createSelectorQuery().select('.bb4').boundingClientRect(res => { // 2.使用wx.getSysTemInfo()获取设备及页面高度windowHeight(px) wx.getSystemInfo({ success(ress) { wx.pageScrollTo({ // 3. 滚动的距离根据设备的页面高度进行微调(px) scrollTop: res.top - ress.windowHeight/2 + 50, duration: 200 }) } }) }).exec() }
              Run code
              Cut to clipboard
                文章:js判断一个值是否为数字  发表时间:2023-01-13, 17:15:28  
                展开↯

                #121

                作者:广西南宁市
                JavaScript 判断是否为数字
                jquery中$.isNumeric的源码
                !isNaN(parseFloat(value)) && isFinite(value);
                Run code
                Cut to clipboard
                  文章:js判断一个值是否为数字  发表时间:2023-01-13, 17:13:44  
                  展开↯

                  #122

                  作者:广西南宁市
                  是 .pem 不是 .pen
                  文章:腾讯云申请自有证书上传部署到七牛云  发表时间:2022-11-29, 01:08:52  
                  展开↯

                  #123

                  作者:广西南宁市西乡塘区
                  Thinkphp的 is null 查询条件是什么,
                  以及exp表达式如何使用

                  一、总结
                  一句话总结:$map['name'] = array('exp','is null');
                  1、is null判断的常见错误写法有哪些?
                  $map1['f_jieduan_id']=['=',null];
                  $map1['f_g_id']=['=',null];

                  2、
                  $map1['f_jieduan_id']=['is null'];
                  $map1['f_g_id']=['is null'];

                  3、
                  $map['name'] = array('is',null);//无法实现
                  2、thinkphp中exp表达式如何使用,作用是什么?
                  其实就是告诉thinkphp这是原生的sql语句

                  关于exp表达式:
                  可支持任何sql语法
                  如:
                  $map['id'] = array('between',array(1,5));

                  可写成:
                  $map['id'] = array('exp','between (1,5)');

                  还可用于数据更新:
                  $data['age'] = array('exp','age+1');
                  M('user')->where('id=1')->save($data);//该用户的年龄加1

                  二、Thinkphp的 is null 查询条件,以及exp表达式的使用
                  Thinkphp中若要用到 is null 查询条件,使用以下方法无法实现:

                  $map['name'] = array('is',null);//无法实现
                  可使用exp表达式:

                  $map['name'] = array('exp','is null');
                  关于exp表达式:
                  可支持任何sql语法
                  如:
                  $map['id'] = array('between',array(1,5));

                  可写成:
                  $map['id'] = array('exp','between (1,5)');

                  还可用于数据更新:
                  $data['age'] = array('exp','age+1');
                  M('user')->where('id=1')->save($data);//该用户的年龄加1

                  参考:Thinkphp的 is null 查询条件,以及exp表达式的使用 - CSDN博客
                  https://blog.csdn.net/codercwm/article/details/51523963

                  三、is null判断的常见错误写法
                  1、
                  $map1['f_jieduan_id']=['=',null];
                  $map1['f_g_id']=['=',null];

                  2、
                  $map1['f_jieduan_id']=['is null'];
                  $map1['f_g_id']=['is null'];

                  3、
                  $map['name'] = array('is',null);//无法实现

                  文章:程序员编程常用网页工具集[游戏]  发表时间:2022-11-24, 15:36:10  
                  展开↯

                  #124

                  作者:广西南宁市西乡塘区
                  Apache ECharts
                  一个基于 JavaScript 的开源可视化图表库
                  echarts更新缓存
                  文章:echarts配置,数据动态更新缓存问题优解  发表时间:2022-11-24, 15:28:31  
                  展开↯

                  #125

                  作者:广西南宁市西乡塘区
                  windows无法识别 'git' 命令:exec: "git": executable file not found in %PATH%
                  choco cmd无法识别
                  windows安装gitea

                  注册为Windows服务
                  要注册为Windows服务,首先以Administrator身份运行 cmd,然后执行以下命令:

                  sc create gitea start= auto binPath= "\"C:\gitea\gitea.exe\" web --config \"C:\gitea\custom\conf\app.ini\""
                  别忘了将 C:\gitea 替换成你的 Gitea 安装目录。

                  之后在控制面板打开 “Windows Services”,搜索 “gitea”,右键选择 “Run”。在浏览器打开 http://localhost:3000 就可以访问了。(如果你修改了端口,请访问对应的端口,3000是默认端口)。

                  从Windows服务中删除
                  以Administrator身份运行 cmd,然后执行以下命令:

                  sc delete gitea
                  文章:gitea git executable not found  发表时间:2022-11-24, 15:16:30  
                  展开↯

                  #126

                  作者:广西南宁市
                  switch ($exchange_time) { case 1 : //本月 //本月起始时间: $begin_time = date("Y-m-d H:i:s",mktime (0,0,0, date("m"),1,date("Y"))); $end_time = date("Y-m-d H:i:s",mktime (23,59,59, date("m"),date("t"),date("Y"))); break; case 2 : //上个月 //上个月的起始时间: $begin_time = date('Y-m-01 00:00:00',strtotime('-1 month')); $end_time = date("Y-m-d 23:59:59", strtotime(-date('d').'day')); break; case 3 : //上上个月 $begin_time = date("Y-m-d H:i:s",mktime(0, 0 , 0,date("m")-2,1,date("Y"))); $end_time = date("Y-m-d H:i:s",mktime(23,59,59,date("m")-1 ,0,date("Y"))); break; } echodate("Ymd",strtotime("now")),"\n"; echodate("Ymd",strtotime("-1 week Monday")),"\n"; echodate("Ymd",strtotime("-1 week Sunday")),"\n"; echodate("Ymd",strtotime("+0 week Monday")),"\n"; echodate("Ymd",strtotime("+0 week Sunday")),"\n"; echo"*********第几个月:"; echodate('n'); echo"*********本周周几:"; echodate("w"); echo"*********本月天数:"; echodate("t"); echo"*********"; echo'<br>上周起始时间:<br>'; echodate("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1-7,date("Y"))),"\n"; echodate("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7-7,date("Y"))),"\n"; echo'<br>本周起始时间:<br>'; echodate("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"))),"\n"; echodate("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"))),"\n"; echo'<br>上月起始时间:<br>'; echodate("Y-m-d H:i:s",mktime(0, 0 , 0,date("m")-1,1,date("Y"))),"\n"; echodate("Y-m-d H:i:s",mktime(23,59,59,date("m") ,0,date("Y"))),"\n"; echo'<br>本月起始时间:<br>'; echodate("Y-m-d H:i:s",mktime(0, 0 , 0,date("m"),1,date("Y"))),"\n"; echodate("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("t"),date("Y"))),"\n"; $season= ceil((date('n'))/3);//当月是第几季度 echo'<br>本季度起始时间:<br>'; echodate('Y-m-d H:i:s',mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"\n"; echodate('Y-m-d H:i:s',mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$season*3,1,date("Y"))),date('Y'))),"\n"; $season= ceil((date('n'))/3)-1;//上季度是第几季度 echo'<br>上季度起始时间:<br>'; echodate('Y-m-d H:i:s',mktime(0, 0, 0,$season*3-3+1,1,date('Y'))),"\n"; echodate('Y-m-d H:i:s',mktime(23,59,59,$season*3,date('t',mktime(0, 0 , 0,$seas))
                  Run code
                  Cut to clipboard
                    展开↯

                    #127

                    作者:广西南宁市
                    TP6 model mysql 语句 where is null 查询写法
                    use think\facade\Db; use think\db\Raw; $mode = (new User())->where([ ['name','EXP',new Raw('IS NOT NULL')], // 写法一 ['mobile','EXP',`DB::raw('IS NULL')`] // 写法二 ])->field("*")->select()->toArray()
                    Run code
                    Cut to clipboard
                      #,广西南宁市西乡塘区,2022-10-11,09:34:00,
                      $_c1=OrdersRecycleProductsModel::where('time', 'EXP', 'IS NULL') // ->limit(100) ->count(); // ->select();
                      Run code
                      Cut to clipboard
                        文章:TP6 where is null写法  发表时间:2022-07-29, 09:32:31  
                        展开↯

                        #128

                        作者:山东省烟台市
                        #,广西南宁市,2022-08-04,10:56:06, OnlyFans
                        #,广西南宁市,2022-08-05,02:58:45, http://www.wy799.com/
                        #,广西南宁市,2022-08-16,16:38:17, 早乙女露依THZ-35
                        #,广西,2022-08-22,14:31:10, Ellen Farber
                        #,广西南宁市青秀区,2022-08-23,21:39:22, http://www.qihuys487.com/
                        #,广西南宁市,2022-08-30,09:48:08,
                        #,广西南宁市,2022-09-02,15:41:54, http://www.jqdaima.com/
                        #,广西南宁市,2022-09-09,04:53:39, http://www.ix44.com/
                        #,广西南宁市,2022-09-09,04:55:19, http://66jb.cc/
                        #,广西南宁市,2022-09-14,09:15:14, IPX-641
                        #,广西南宁市,2022-09-15,10:00:37, https://www.fi11sm135.com/
                        #,广西南宁市,2022-09-15,10:27:07, 次元小镇
                        https://dimtown.com/
                        搜番
                        https://sofan.icu/
                        solji.kim
                        #,广西南宁市,2022-09-20,03:09:12, www.51cbi.com
                        #,广西南宁市,2022-09-30,01:58:28, https://66mat.buzz/
                        文章:js+jQuery实现网页打字机效果(带光标)js模拟光标打字  发表时间:2022-08-03, 17:29:54  
                        展开↯

                        #129

                        作者:广西南宁市
                        tp报错: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is
                        SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'appointment.ob_order.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

                        去掉 sql_mode 配置项参数中逗号后面的空格
                        打开mysql配置文件,在[mysqld]下添加如下一行:sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,保存重启
                        Run code
                        Cut to clipboard
                          展开↯

                          #130

                          作者:广西南宁市
                          UniApp vue 分享图片 合成画布 图片合并 小程序 二维码 推广海报
                          <template> <view> <canvas v-if="!canvas_src" style="width: 375px; height: 605px;margin-top:-1000px;position: absolute;top:-1000px;z-index: -1;" canvas-id="myCanvas" id="myCanvas"></canvas> <view class="tkxj_0"></view> <view class="tkxj_1" v-if="canvas_src"> <u-image :src="canvas_src" mode="heightFix" height="70vh" style="display:inline-block;"></u-image> <view class="ggbb_1" @click="close();">X</view> <view class="ggbb_2" @click="save_img();">保存图片</view> </view> </view> </template> <script> export default { name: 'add-img', props: { data_l:{ type:Object, default:()=>{} }, acv_index: { type: Number, default: 0 }, bgColor: { type: String, default: '#efefef' }, // 宽度,单位任意 width: { type: [String, Number], default: '100%' }, add_img_src: { type: Boolean, default: false }, // 是否懒加载,微信小程序、App、百度小程序、字节跳动小程序 lazyLoad: { type: Boolean, default: true }, // 背景颜色,用于深色页面加载图片时,为了和背景色融合 // close: { // type: Function, // default: ()=>{} // }, bgColor: { type: String, default: '#f3f4f6' }, getConfig:{ type:Object, default:()=>{} }, goods_info:{ type:Object, default:()=>{} } }, data() { return { backgroundStyle: {}, // getConfig: {}, num:1, canvas_src:'', qrcode:'' // v_show_d:this.v_show }; }, watch: { }, computed: { }, onShow() { // this.$nextTick(() => { // console.log(2132131) // this.nGetConfig(this) // }) }, mounted: function () { let res2 = wx.getSystemInfoSync(); this.xw_whith = 375;//res2.windowWidth; this.xw_height = 603;//res2.windowHeight; // console.log(res2); // console.log(2132131) // this.nGetConfig(this,(res)=>{ // //getConfig 子子孙传值不过来 临时解决办法 // // console.log(res) // this.getConfig=res; // this.drawShareImg(); // }) // console.log(this.acv_index) this._shop_details_qrcode(); // this.drawShareImg(); }, methods: { //生成二维码 _shop_details_qrcode(){ this.nAjax({ url: "index/_shop_details_qrcode", // clogin: true, showLoading: true, // showLoadingTitle: "正在发送", // 'header':{ // 'content-type':'application/x-www-form-urlencoded', // 'test':123 // }, // 'method':'GET', data: { tuid: this.getConfig._fx.txt.uid, tshopid: this.goods_info.id, }, successShow: { show: false, type: "toast", // 'icon':'success', duration: 1500, // type: "modal", // title: "提示", // showCancel: false, // // 'cancelText':'取消', // // 'confirmText':'确定', // confirm: () => { // console.log("用户点击确定"); // }, // 'cancel':()=>{ // console.log('用户点击取消'); // }, }, errorShow: { show: true, // 'type':'toast', // 'icon':'error', // 'duration':3500, type: "modal", title: "", showCancel: false, // 'cancelText':'取消', confirmText: "知道了", confirm: () => { // console.log("用户点击确定"); }, // 'cancel':()=>{ // console.log('用户点击取消'); // }, }, success: (res) => { this.qrcode=res.data.qrcode; this.drawShareImg(); }, // fail:()=>{ // }, // complete:()=>{ // } }); }, _getImageInfo(src,callback){ uni.getImageInfo({ 'src':src, 'success':res=>{ callback(res) } }); }, // 合成分享图核心代码 drawShareImg() { uni.showLoading({ title: '加载中' }); let img_arr=[ { 'src':this.goods_info.cover_img, //商品封面 '_x':this.getConfig._fx.position.dt._x, '_y':this.getConfig._fx.position.dt._y, }, { 'src':this.getConfig['all']['list2']['15'], //底图 '_x':this.getConfig._fx.dt._x, '_y':this.getConfig._fx.dt._y, }, { 'src':this.getConfig._fx.txt.avatarUrl || this.getConfig['all']['list2']['16'], //头像 '_x':this.getConfig._fx.position.tx._x, '_y':this.getConfig._fx.position.tx._y, }, { 'src':this.qrcode, //二维码 'http://jgy.com/'+ '_x':this.getConfig._fx.position.ewm._x, '_y':this.getConfig._fx.position.ewm._y, } // this.getConfig._fx.ewm ]; // console.log(img_arr) let img_arr_new=[]; this._getImageInfo(img_arr[0].src,res=>{ //封面 // let width=this.xw_whith; // let height=res.height*width/res.width; let height=this.xw_height-160; let width=res.width*height/res.height; if(width>this.xw_whith){ img_arr[0]._x=0-(width-this.xw_whith)/2; } res.width=width res.height=height res._x=img_arr[0]._x; res._y=img_arr[0]._y; img_arr_new.push(res); this._getImageInfo(img_arr[1].src,res=>{ //底图 let width=this.xw_whith; let height=this.xw_height; //this.xw_whith*res.width/this.xw_height res.width=width res.height=height img_arr_new.push(res) this._getImageInfo(img_arr[2].src,res=>{ //头像 res._x=img_arr[2]._x; res.height=res.height*60/res.width; res.width=60; res._y=this.xw_height-img_arr[2]._y-res.height; img_arr_new.push(res) this._getImageInfo(img_arr[3].src,res=>{ //二维码 // let width=this.xw_whith; // let height=res.height*width/res.width; let height=100; let width=100; res.width=width res.height=height res._x=this.xw_whith-img_arr[3]._x-res.width; res._y=this.xw_height-img_arr[3]._y-res.height; img_arr_new.push(res) this.drawShareImg0(img_arr_new); }) }) }) }) }, /* * 参数说明 * ctx Canvas实例 * img 图片地址 * x x轴坐标 * y y轴坐标 * w 宽度 * h 高度 * r 弧度大小 */ circleImg(ctx, img, x, y, r=13, w=50, h=50) { ctx.save(); // 画一个图形 if (w < 2 * r) r = w / 2; if (h < 2 * r) r = h / 2; ctx.beginPath(); ctx.moveTo(x + r, y); ctx.arcTo(x + w, y, x + w, y + h, r); ctx.arcTo(x + w, y + h, x, y + h, r); ctx.arcTo(x, y + h, x, y, r); ctx.arcTo(x, y, x + w, y, r); ctx.closePath(); ctx.strokeStyle = '#FFFFFF'; // 设置绘制圆形边框的颜色 ctx.stroke(); ctx.clip(); ctx.drawImage(img, x, y, w, h); ctx.restore(); }, /* * 圆角图片=>参数说明 * ctx Canvas实例 * img 图片地址 * x x轴坐标 * y y轴坐标 * r 圆形半径 */ circleImg2(ctx, img, x, y, r) { ctx.save(); let d = 2 * r; let cx = x + r; let cy = y + r; ctx.arc(cx, cy, r, 0, 2 * Math.PI); ctx.clip(); ctx.drawImage(img, x, y, d, d); ctx.restore(); }, drawShareImg0(img_arr_new) { // let that=this; //用户名 let uname=this.getConfig._fx.txt.uname; let txt1=this.getConfig._fx.txt.txt1; let txt2=this.getConfig._fx.txt.txt2; let shop_title=this.goods_info.title; let price='¥'+this.goods_info.price; let price2='¥'+this.goods_info.market_price; if(!this.goods_info.market_price || this.goods_info.market_price<0.01) price2=''; let ww, hh; const ctx = uni.createCanvasContext('myCanvas',this) ww = this.xw_whith; //准确的宽高 hh = this.xw_height; // ctx.drawImage("https://img.jinguiyuan.cn/FkZdT5PqHitcbcVzGhstB8jasKXQ", 0, 0, ww, hh) // ctx.drawImage("https://img.jinguiyuan.cn/FkZdT5PqHitcbcVzGhstB8jasKXQ", 30, hh - 87, 50, 50) //封面 ctx.drawImage(img_arr_new[0].path, img_arr_new[0]._x, img_arr_new[0]._y,img_arr_new[0].width,img_arr_new[0].height); //底图 ctx.drawImage(img_arr_new[1].path, img_arr_new[1]._x, img_arr_new[1]._y,img_arr_new[1].width,img_arr_new[1].height); //头像 this.circleImg(ctx,img_arr_new[2].path, img_arr_new[2]._x, img_arr_new[2]._y); //二维码 ctx.drawImage(img_arr_new[3].path, img_arr_new[3]._x, img_arr_new[3]._y,img_arr_new[3].width,img_arr_new[3].height); // img_arr_new.forEach((v,i)=>{ // if(2==i){ // this.circleImg(ctx,v.path, v._x, v._y,30) // }else ctx.drawImage(v.path, v._x, v._y,v.width,v.height); // }) ctx.setFontSize(16) ctx.setFillStyle('#000') ctx.fillText(uname, 100, hh - 105) ctx.setFontSize(14) ctx.setFillStyle('#999') let u_w=120+ctx.measureText(uname).width; //100+uname.length*17+8 ctx.fillText(txt1, u_w, hh - 105) //商品标题 // console.log(333) // console.log(ctx.measureText(shop_title.substring(0,15)).width) let si=0; let s_shop_title=shop_title; for(let i=0;i<=shop_title.length;i++){ // console.log(ctx.measureText(shop_title.substring(0,i)).width) let ss_t=shop_title.substring(0,i)+'...'; if(!si && ctx.measureText(ss_t).width>178) { si=i; s_shop_title=ss_t; } } ctx.setFontSize(18) ctx.setFillStyle('#000') ctx.fillText(s_shop_title, 18, hh - 55) //会员价 文字 ctx.setFontSize(14) ctx.setFillStyle('#000') ctx.fillText(txt2, 20, hh - 25) //会员价 ctx.setFontSize(18) ctx.setFillStyle('#b12704') ctx.fillText(price, 65, hh - 25) //市场价 if(price2){ ctx.setFontSize(16) ctx.setFillStyle('#9fa1a0') let p_w=82+ctx.measureText(price).width; ctx.fillText(price2, p_w, hh - 25) //删除线 ctx.beginPath(); const textWidth = ctx.measureText(price2).width; ctx.rect(p_w, hh - 31, textWidth+3, 1); ctx.fillStyle = '#9fa1a0'; ctx.fill(); } //开始绘画 ctx.draw() //这里需要做个延迟防止绘制没结束生成图片黑的问题 setTimeout(() => { uni.canvasToTempFilePath({ canvasId: 'myCanvas', success: (res)=> { // 在H5平台下,tempFilePath 为 base64 // console.log(res.tempFilePath) this.canvas_src=res.tempFilePath; uni.hideLoading(); } },this) }, 1000); }, close(){ // console.log(this.v_show); this.$emit("close"); // this.blurInput(,); }, save_img(){ uni.authorize({ scope: 'scope.writePhotosAlbum', success:()=> { //保存图片 uni.saveImageToPhotosAlbum({ filePath:this.canvas_src, success:(res)=> { this.close(); uni.showToast({ title: '保存成功', duration: 2000 }); uni.vibrateLong(); } }) }, fail:()=>{ uni.showModal({ title: '提示', confirmText:'去设置', content: '请授权相册', success: (res)=> { if (res.confirm) { uni.openSetting(); // console.log('用户点击确定'); } else if (res.cancel) { // console.log('用户点击取消'); } } }); return; //只有用户主动操作下的直接回调才会生效。非用户操作或间接回调都不会拉起setting页面 uni.showToast({ title: '请授权相册', duration: 2000 }); setTimeout(()=>{ uni.openSetting(); },1500) // console.log(12312) } }) } }, }; </script> <style scoped> .tkxj_0{ position: fixed; left: 0px; top: 0px; width: 100vw; height: 100vh; z-index: 99998; background: #000; opacity: 0.7; } .tkxj_1{ position: fixed; top: 140rpx; left: 0px; width: 100vw; z-index: 99999; padding-bottom: 100px; text-align: center; } .ggbb_1{ position: absolute; color: #fff; left: 36rpx; top: -45px; border: 1px solid #fff; font-size: 16px; width: 30px; height: 30px; line-height: 28px; border-radius: 50%; } .ggbb_2{ color: #fff; font-size: 18px; border: 1px solid #fff; height: 36px; line-height: 36px; border-radius: 12px; display: inline-block; padding: 0px 15px; position: absolute; bottom: 30rpx; left: 50%; margin-left: -52px; width: 104px; } </style>
                          Run code
                          Cut to clipboard
                            #,广西南宁市,2022-09-13,10:46:38, Canvas 绘制圆形图片、绘制圆角矩形图片

                            制作圆形和圆角矩形并不是一个方法,但大同小异

                            圆形使用的是:arc()
                            圆角使用的是:arcTo()

                            圆形:利用 Canvas 先画出一个圆形,然后将图片定位到圆形中心位置进行剪切,将超出圆形的部分去掉,就会形成一个圆形

                            圆角:利用 Canvas 先画出一个圆角矩形,然后将图片定位到圆角矩形位置进行剪切,将超出圆形的部分去掉,就会形成一个圆角矩形
                            区别在于,圆角需要我们一段一段的自己画出来,而圆形有现成的方法只用设置想要的值即可

                            // 开始制作头像 createPlacard() { uni.getImageInfo({ src: '...7/02/e0eb38388da1c.jpg', // 网络图片需先下载,得到临时本地路径,否则绘入 Canvas 可能会出现空白 success: (img)=> { const ctx = wx.createCanvasContext('myCanvas', this); ctx.fillStyle = "#FFFFFF"; ctx.fillRect(0, 0, uni.upx2px(750), uni.upx2px(1000)); // 如何在 Canvas 中绘入圆形图片? // 原理:利用 Canvas 先画出一个圆形,然后将图片定位到圆形中心位置进行剪切,将超出圆形的部分去掉,就会形成一个圆形 this.circleImgOne(ctx, img.path, uni.upx2px(175), uni.upx2px(95), uni.upx2px(200)); // 如何在 Canvas 中绘入圆角矩形? // 原理:利用 Canvas 先画出一个圆角矩形,然后将图片定位到圆角矩形位置进行剪切,将超出圆形的部分去掉,就会形成一个圆角矩形 //this.circleImgTwo(ctx, img.path, uni.upx2px(105), uni.upx2px(95), uni.upx2px(512), uni.upx2px(382), uni.upx2px(20)); ctx.draw(); uni.hideLoading() } }) }
                            Run code
                            Cut to clipboard


                              /* * 参数说明 * ctx Canvas实例 * img 图片地址 * x x轴坐标 * y y轴坐标 * r 圆形半径 */ circleImgOne(ctx, img, x, y, r) { // 如果在绘制图片之后还有需要绘制别的元素,需启动 save() 、restore() 方法,否则 clip() 方法会导致之后元素都不可见 // save():保存当前 Canvas 画布状态 // restore():恢复到保存时的状态 /* ctx.save(); */ let d = r * 2; let cx = x + r; let cy = y + r; ctx.arc(cx, cy, r, 0, 2 * Math.PI); ctx.strokeStyle = '#FFFFFF'; // 设置绘制圆形边框的颜色 ctx.stroke(); // 绘制出圆形,默认为黑色,可通过 ctx.strokeStyle = '#FFFFFF', 设置想要的颜色 ctx.clip(); ctx.drawImage(img, x, y, d, d); /* ctx.restore(); */ },
                              Run code
                              Cut to clipboard



                                /* * 参数说明 * ctx Canvas实例 * img 图片地址 * x x轴坐标 * y y轴坐标 * w 宽度 * h 高度 * r 弧度大小 */ circleImgTwo(ctx, img, x, y, w, h, r) { // 画一个图形 if (w < 2 * r) r = w / 2; if (h < 2 * r) r = h / 2; ctx.beginPath(); ctx.moveTo(x + r, y); ctx.arcTo(x + w, y, x + w, y + h, r); ctx.arcTo(x + w, y + h, x, y + h, r); ctx.arcTo(x, y + h, x, y, r); ctx.arcTo(x, y, x + w, y, r); ctx.closePath(); ctx.strokeStyle = '#FFFFFF'; // 设置绘制圆形边框的颜色 ctx.stroke(); ctx.clip(); ctx.drawImage(img, x, y, w, h); }
                                Run code
                                Cut to clipboard


                                  #,广西南宁市,2022-09-13,10:55:45, canvas文字超过宽自动换行
                                  drawText(ctx, txtwid, t, x, y, w){ var chr = t.split(""); var temp = ""; var row = []; ctx.font = "20px Arial"; ctx.fillStyle = "black"; ctx.textBaseline = "middle"; for(var a = 0; a < chr.length; a++){ if( ctx.measureText(temp).width < w ){ ; } else{ row.push(temp); temp = ""; } temp += chr[a]; } row.push(temp); for(var b = 0; b < row.length; b++){ ctx.setFontSize(txtwid); ctx.setFillStyle("#333333"); ctx.fillText(row[b],x,y+(b+1)*20); } },
                                  Run code
                                  Cut to clipboard
                                    #,广西南宁市,2022-09-13,21:03:48, 小程序自定义组件中使用canvas不生效
                                    canvas组件注册无效,这个因为createCanvasContext方法是有两个参数,
                                    在page页面默认传了一个this,在组件里面需要手动传this。
                                    const ctx = wx.createCanvasContext('myCanvas',this);
                                    Run code
                                    Cut to clipboard
                                      文章:uni-app:iPhone的底部安全区域  发表时间:2022-09-13, 10:24:28  
                                      展开↯

                                      #131

                                      作者:广西南宁市
                                      解决cURL error 60: SSL certificate problem: unable to get local issuer certifica
                                      报错:cURL error 60: SSL certificate problem: unable to get local issuer certifica

                                      报错原因:因为没有配置信任的服务器HTTPS验证。默认情况下,cURL被设为不信任任何CAs,因此浏览器无法通过HTTPs访问你服务器。
                                      解决方式
                                      下载证书


                                      修改php.ini文件,去掉前面“;” 路径带上""


                                      openssl这个扩展开启


                                      文章:easywechat学习笔记  发表时间:2022-09-13, 10:33:55  
                                      展开↯

                                      #132

                                      作者:广西南宁市
                                      vue deep样式穿透使用
                                      在vue2中使用 ::v-deep
                                      ::v-deep .el-col { margin-bottom: 20px; }
                                      Run code
                                      Cut to clipboard

                                        ’ >>> ‘和’ /deep/ '支持已弃用。

                                        在vue3中::v-deep可以使用但是不推荐使用,官方推荐v-deep(.className)
                                        ::v-deep(.el-col) { margin-bottom: 20px; } // 缩写 :deep(.el-col) { margin-bottom: 20px; }
                                        Run code
                                        Cut to clipboard


                                          全局样式设置 ::v-global(.ClassName) 缩写 :global(.ClassName) 插槽内的样式设置 ::v-slotted(.ClassName) 缩写 :slotted(.ClassName)
                                          Run code
                                          Cut to clipboard

                                            文章:uni-app:iPhone的底部安全区域  发表时间:2022-09-13, 10:27:04  
                                            展开↯

                                            #133

                                            作者:广西南宁市
                                            animate
                                            #,广西南宁市,2022-08-01,23:00:23,
                                            实现滚动条滚过一段距离后才调用animate.css
                                            配合wow.js使用,只有当屏幕滚动到添加animate动画区域的时候,动画效果才出现。
                                            WOW.js在页面滚动时展现动感的元素动画效果
                                            #,广西南宁市,2022-09-13,10:15:36, Flex布局在线调试工具
                                            #,广西南宁市,2022-09-13,10:20:26, iconfont-阿里巴巴矢量图标库
                                            文章:程序员编程常用网页工具集[游戏]  发表时间:2022-08-01, 02:01:49  
                                            展开↯
                                            你好,残忍屏蔽广告

                                            确定要清除编辑框内容吗?

                                            该删除操作将不可恢复。

                                            删除 取消

                                            激活Windows

                                            转到"设置"以激活Windows。